Physical Page Allocator?!

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Perica
Member
Member
Posts: 454
Joined: Sat Nov 25, 2006 12:50 am

Physical Page Allocator?!

Post by Perica »

..
Last edited by Perica on Sun Dec 03, 2006 9:15 pm, edited 2 times in total.
Lantz

Re:Physical Page Allocator?!

Post 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.
Perica
Member
Member
Posts: 454
Joined: Sat Nov 25, 2006 12:50 am

Re:Physical Page Allocator?!

Post by Perica »

..
Last edited by Perica on Sun Dec 03, 2006 9:16 pm, edited 1 time in total.
uri

Re:Physical Page Allocator?!

Post 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.
Slasher

Re:Physical Page Allocator?!

Post 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
Post Reply