Page 1 of 1

RAM and PMode Stack

Posted: Tue Aug 27, 2002 5:50 am
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.

Re:RAM and PMode Stack

Posted: Thu Aug 29, 2002 12:08 am
by PlayOS
Anyone got any ideas at all??

Re:RAM and PMode Stack

Posted: Thu Aug 29, 2002 2:35 am
by Whatever5k
Look at this to determine your RAM-size: http://www.mega-tokyo.com/os/os-faq-mem ... ine_memory

Re:RAM and PMode Stack

Posted: Thu Aug 29, 2002 2:40 am
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 :)

Re:RAM and PMode Stack

Posted: Thu Aug 29, 2002 4:50 am
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?