News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Task Switching and the Stack

Started by AeroASM, April 24, 2005, 02:35:04 PM

Previous topic - Next topic

The Dude of Dudes

Hi AeroAsm,

Re: Sharing Stack Parameters among different processes

When you pass Stack Params to a Windows API function, the OS copies a pointer to them in edx and then does a switch to Ring0, which has it's own stack. Each Process has a user and Kernel stack for security reasons.

As far as implementing a memory manager, paging would be a lot more work than you think. If this is only a hobby OS, and you're not worried about security I would just use Segmentation (paging disabled). This way, the address you specify with segment/offset translates directly into a physical one. ie. 0000:FFFF = FFFF physical. If paging is enabled, the processor translates segment/offset to a linear addrress and then uses a page directory (and maybe a page table depending on the page size you choose) to get the  actual physical address. YOU have to create and update these page tables/directories when memory is allocated, when page faults occur (program tries to access an address that does not have an entry in the page table), when memory is freed, when memory sits 'idle' and should be paged out to a swapfile. It would be very cool to write a Memory Manager that uses paging, though!

thomasantony

There are 10 types of people in the world. Those who understand binary and those who don't.


Programmer's Directory. Submit for free