Memory.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /* -*- mode:c; c-file-style:"k&r"; c-basic-offset: 4; tab-width:4; indent-tabs-mode:nil; mode:auto-fill; fill-column:78; -*- */
  2. /* vim: set ts=4 sw=4 et tw=78 fo=cqt wm=0: */
  3. /* This Hello World simply print out "Hello World" */
  4. #include "pal.h"
  5. #include "pal_debug.h"
  6. int main (int argc, char ** argv, char **envp)
  7. {
  8. void * p1 = (void *) DkVirtualMemoryAlloc (NULL,
  9. pal_control.alloc_align * 4,
  10. 0,
  11. PAL_PROT_READ|PAL_PROT_WRITE);
  12. void * p2 = (void *) DkVirtualMemoryAlloc (NULL,
  13. pal_control.alloc_align * 4,
  14. 0,
  15. PAL_PROT_READ|PAL_PROT_WRITE);
  16. void * p3 = (void *) DkVirtualMemoryAlloc (NULL,
  17. pal_control.alloc_align * 2,
  18. 0,
  19. PAL_PROT_READ|PAL_PROT_WRITE);
  20. DkVirtualMemoryAlloc ((void *) (((uint64_t) p1 + (uint64_t) p2) / 2),
  21. pal_control.alloc_align * 4,
  22. 0, PAL_PROT_READ|PAL_PROT_WRITE);
  23. DkVirtualMemoryAlloc (p3, pal_control.alloc_align * 2, 0,
  24. PAL_PROT_READ|PAL_PROT_WRITE);
  25. DkVirtualMemoryFree (p3, pal_control.alloc_align);
  26. return 0;
  27. }