Memory.c 1.1 KB

12345678910111213141516171819202122232425262728293031
  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 = DkVirtualMemoryAlloc (NULL, pal_control.alloc_align * 4, 0,
  9. PAL_PROT_READ|PAL_PROT_WRITE);
  10. void * p2 = DkVirtualMemoryAlloc (NULL, pal_control.alloc_align * 4, 0,
  11. PAL_PROT_READ|PAL_PROT_WRITE);
  12. void * p3 = DkVirtualMemoryAlloc (NULL, pal_control.alloc_align * 2, 0,
  13. PAL_PROT_READ|PAL_PROT_WRITE);
  14. DkVirtualMemoryAlloc ((void *) (((uint64_t) p1 + (uint64_t) p2) / 2),
  15. pal_control.alloc_align * 4,
  16. 0, PAL_PROT_READ|PAL_PROT_WRITE);
  17. DkVirtualMemoryAlloc (p3, pal_control.alloc_align * 2, 0,
  18. PAL_PROT_READ|PAL_PROT_WRITE);
  19. DkVirtualMemoryFree (p3, pal_control.alloc_align);
  20. return 0;
  21. }