Page 1 of 1

Physical Page Allocator?!

Posted: Sun Sep 07, 2003 2:06 am
by Perica
..

Re:Physical Page Allocator?!

Posted: Sun Sep 07, 2003 3:12 am
by Lantz
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?!

Posted: Sun Sep 07, 2003 3:20 am
by Perica
..

Re:Physical Page Allocator?!

Posted: Sun Sep 07, 2003 5:02 am
by uri
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?!

Posted: Sun Sep 07, 2003 10:37 am
by Slasher
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