Assignment failing

Programming, for all ages and all languages.
Post Reply
Crazed123

Assignment failing

Post by Crazed123 »

Inside some of my kernel bootstrap code I run

Code: Select all

pFreeList^.mbBlock.lwMemoryLength:= lwHeapPages * 4096 - sizeof(TMemoryBlock) - sizeof(TMemoryBlockEnd);
in order to tell the heap how large it starts off. The problem is that with recent compilations (ie: returning to an earlier code version doesn't help) that line has begun to do nothing and I don't know why. I'll step to it, evaluate the r-expression. Then when I step once more and evaluate pFreeList^.mbBlock.lwMemoryLength I get 0.

This happens both in bochs and on real hardware.

*pulls hair off head*
AR

Re:Assignment failing

Post by AR »

Don't remember much Pascal but, if that's a pointer then are you sure it's valid? Does "lwHeapPages" contain 0 (either forgetting to set it or being corrupted by something along the way)?

Other than that, you may have to disassemble it and see if the compiler is doing it wrong.
Crazed123

Re:Assignment failing

Post by Crazed123 »

The actual solution was that pFreeList was paged in to physical memory that didn't exist, thus causing neither my PC nor Bochs to say anything about the invalid access. Fixed now and exchanged for another pagefauling headache.
Post Reply