Memory.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. #include <stdint.h>
  7. int main (int argc, char ** argv, char **envp)
  8. {
  9. void * p1 = (void *) DkVirtualMemoryAlloc (NULL,
  10. pal_control.alloc_align * 4,
  11. 0,
  12. PAL_PROT_READ|PAL_PROT_WRITE);
  13. void * p2 = (void *) DkVirtualMemoryAlloc (NULL,
  14. pal_control.alloc_align * 4,
  15. 0,
  16. PAL_PROT_READ|PAL_PROT_WRITE);
  17. void * p3 = (void *) DkVirtualMemoryAlloc (NULL,
  18. pal_control.alloc_align * 2,
  19. 0,
  20. PAL_PROT_READ|PAL_PROT_WRITE);
  21. DkVirtualMemoryAlloc ((void *) (((uint64_t) p1 + (uint64_t) p2) / 2),
  22. pal_control.alloc_align * 4,
  23. 0, PAL_PROT_READ|PAL_PROT_WRITE);
  24. DkVirtualMemoryAlloc (p3, pal_control.alloc_align * 2, 0,
  25. PAL_PROT_READ|PAL_PROT_WRITE);
  26. DkVirtualMemoryFree (p3, pal_control.alloc_align);
  27. return 0;
  28. }