Physical Page Allocator?!
Physical Page Allocator?!
..
Last edited by Perica on Sun Dec 03, 2006 9:15 pm, edited 2 times in total.
Re:Physical Page Allocator?!
Hmm im not sure if this is right, but ill give it a shot. You only need 4 mb of stack if your machine has 4 gb of physical memory, and if it does, 4 mb out of 4 gb isnt much to cry about.
Re:Physical Page Allocator?!
..
Last edited by Perica on Sun Dec 03, 2006 9:16 pm, edited 1 time in total.
Re:Physical Page Allocator?!
The amount of physical memory isn't likely to change while the PC is running. Simply check how much RAM is installed and set the size of your stack accordingly.
Re:Physical Page Allocator?!
hi,
lets say that you have 32mb of physical ram and the end of the kernel is marked by k_end.
To find the size of the stack you have to thinks as follows -
each address on the stack is suppose to mark the beginning of a 4kb page that starts on a page boundry.
32mb/4k = 8k entries each of which is 4 bytes(32bits or a long int). So the final size of the stack is 8k entries * 4bytes per entry = 32kb of stack required.
NOTE: 32mb give 32kb stack size,
256mb give 256kb stack size
so you can then do,
stack_start=k_end (stack starts at the end of the kernel)
stack_top=stack_start
to add (push) an address onto the stack
stack_top++;
*stack_top=address
to remove (pop) an address from the stack
address=*stack_top
stack_top--
hope this helps
lets say that you have 32mb of physical ram and the end of the kernel is marked by k_end.
To find the size of the stack you have to thinks as follows -
each address on the stack is suppose to mark the beginning of a 4kb page that starts on a page boundry.
32mb/4k = 8k entries each of which is 4 bytes(32bits or a long int). So the final size of the stack is 8k entries * 4bytes per entry = 32kb of stack required.
NOTE: 32mb give 32kb stack size,
256mb give 256kb stack size
so you can then do,
stack_start=k_end (stack starts at the end of the kernel)
stack_top=stack_start
to add (push) an address onto the stack
stack_top++;
*stack_top=address
to remove (pop) an address from the stack
address=*stack_top
stack_top--
hope this helps