Memory.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /* This Hello World simply print out "Hello World" */
  2. #include "pal.h"
  3. #include "pal_debug.h"
  4. #include <stdint.h>
  5. int main (int argc, char ** argv, char **envp)
  6. {
  7. void * p1 = (void *) DkVirtualMemoryAlloc (NULL,
  8. pal_control.alloc_align * 4,
  9. 0,
  10. PAL_PROT_READ|PAL_PROT_WRITE);
  11. void * p2 = (void *) DkVirtualMemoryAlloc (NULL,
  12. pal_control.alloc_align * 4,
  13. 0,
  14. PAL_PROT_READ|PAL_PROT_WRITE);
  15. void * p3 = (void *) DkVirtualMemoryAlloc (NULL,
  16. pal_control.alloc_align * 2,
  17. 0,
  18. PAL_PROT_READ|PAL_PROT_WRITE);
  19. DkVirtualMemoryAlloc ((void *) (((uint64_t) p1 + (uint64_t) p2) / 2),
  20. pal_control.alloc_align * 4,
  21. 0, PAL_PROT_READ|PAL_PROT_WRITE);
  22. DkVirtualMemoryAlloc (p3, pal_control.alloc_align * 2, 0,
  23. PAL_PROT_READ|PAL_PROT_WRITE);
  24. DkVirtualMemoryFree (p3, pal_control.alloc_align);
  25. return 0;
  26. }