RAM and PMode Stack

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
PlayOS

RAM and PMode Stack

Post by PlayOS »

Hi Guys,

I have a couple of questions, first of all how do I go about calculating the total available RAM on a system? I have not enabled paging or anything so I need a fast way without using pages. Also, what would be the best way to create a PMode stack, should I have a descriptor in the GDT made just for it? Also, should it be expand up or down? I am using my data descriptor for the stack at the moment and it is expand up.
PlayOS

Re:RAM and PMode Stack

Post by PlayOS »

Anyone got any ideas at all??
Whatever5k

Re:RAM and PMode Stack

Post by Whatever5k »

Look at this to determine your RAM-size: http://www.mega-tokyo.com/os/os-faq-mem ... ine_memory
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:RAM and PMode Stack

Post by Pype.Clicker »

you can keep your data descriptor as a stack segment. Having a separate stack segment can help avoiding stack overflows, but if you're programming in C, you'd better have stack & data aligned to the same base to avoid pointer conversions problems.

by the by, having a kernel stack that can generate stack fault exception also requires a task that will handle those exceptions (trying to handle them with an interrupt gate will result in triple fault, believe me :)
PlayOS

Re:RAM and PMode Stack

Post by PlayOS »

Whatever5k wrote: Look at this to determine your RAM-size: http://www.mega-tokyo.com/os/os-faq-mem ... ine_memory
Does anyone know how to convert the code here for direct probing into NASM source?
Post Reply