Files
graphene/Pal/test/Memory.c
Chia-Che Tsai 1a1e199c79 release v0.4beta
Release of Graphene SGX:
Supporting native Linux application in Intel SGX enclaves.
Most applications are supported. Some features may still be buggy.

Improving portability of Graphene:
Eliminating GCC-ism of the host-generic code.
Easier to port to non-Posix platform (e.g., Windows without Cygwin).
2016-07-19 19:45:55 -04:00

40 lines
1.5 KiB
C

/* -*- mode:c; c-file-style:"k&r"; c-basic-offset: 4; tab-width:4; indent-tabs-mode:nil; mode:auto-fill; fill-column:78; -*- */
/* vim: set ts=4 sw=4 et tw=78 fo=cqt wm=0: */
/* This Hello World simply print out "Hello World" */
#include "pal.h"
#include "pal_debug.h"
#include <stdint.h>
int main (int argc, char ** argv, char **envp)
{
void * p1 = (void *) DkVirtualMemoryAlloc (NULL,
pal_control.alloc_align * 4,
0,
PAL_PROT_READ|PAL_PROT_WRITE);
void * p2 = (void *) DkVirtualMemoryAlloc (NULL,
pal_control.alloc_align * 4,
0,
PAL_PROT_READ|PAL_PROT_WRITE);
void * p3 = (void *) DkVirtualMemoryAlloc (NULL,
pal_control.alloc_align * 2,
0,
PAL_PROT_READ|PAL_PROT_WRITE);
DkVirtualMemoryAlloc ((void *) (((uint64_t) p1 + (uint64_t) p2) / 2),
pal_control.alloc_align * 4,
0, PAL_PROT_READ|PAL_PROT_WRITE);
DkVirtualMemoryAlloc (p3, pal_control.alloc_align * 2, 0,
PAL_PROT_READ|PAL_PROT_WRITE);
DkVirtualMemoryFree (p3, pal_control.alloc_align);
return 0;
}