Re:Having trouble with multiple address spaces
Posted: Sun Dec 07, 2003 5:43 pm
OK, looks like we're talking about the same thing. I've seen a few OSes which place variables at arbitrary address in memory (e.g. Menuet) and I can see no need for this -- it just makes the programmer's life harder.
Kernel stacks are allocated pagewise, growing down from E000_0000. I don't have any actual kernel stack deallocation yet, though clearly I need this in the long term. I could move this over to malloc, as long as I put unmapped guard pages at each end, or I could come up with a custom deallocator.
User stacks are allocated using the normal VMM allocator for user-mode memory. The kernel reserves the space immediately below 8000_000 at kernel startup, and allocates 1MB stacks there as each thread is created. Pages of the stack are faulted in as the thread references them, so physical memory is not wasted. Deallocation of user-mode stacks uses the normal VMM free function.
Kernel stacks are allocated pagewise, growing down from E000_0000. I don't have any actual kernel stack deallocation yet, though clearly I need this in the long term. I could move this over to malloc, as long as I put unmapped guard pages at each end, or I could come up with a custom deallocator.
User stacks are allocated using the normal VMM allocator for user-mode memory. The kernel reserves the space immediately below 8000_000 at kernel startup, and allocates 1MB stacks there as each thread is created. Pages of the stack are faulted in as the thread references them, so physical memory is not wasted. Deallocation of user-mode stacks uses the normal VMM free function.