static void pt_test( void ) { /* need a decent sized stack */ char buf1[NPAGES * 4096], *buf2 = NULL; /* check the stack is above phys mem */ assert((void *) buf1 > (void *) 0x20000000); printf("Starting stack test..\n"); /* stack test */ do_pt_test(buf1); printf("Passed!\n"); printf("Starting heap test...\n"); /* heap test */ buf2 = malloc(NPAGES * 4096); assert(buf2); do_pt_test(buf2); free(buf2); printf("Passed\n"); }
static void pt_test( void ) { /* need a decent sized stack */ char buf1[NPAGES * 1024]; /* check the stack is above phys mem */ assert((void *) buf1 > (void *) 0x2000000); /* stack test */ do_pt_test(buf1); if(0) { char *buf2 = NULL; /* heap test */ buf2 = malloc(NPAGES * 1024); assert(buf2); //check the heap is above phys mem assert((void *) buf2 > (void *) 0x2000000); do_pt_test(buf2); free(buf2); } }