Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Questions about memory handling.

3 views
Skip to first unread message

Erik

unread,
Mar 13, 1999, 3:00:00 AM3/13/99
to
Hello... I am writing a simple OS for the x86 (well, trying to..) and I have
some problems I'm hoping you could help me out with. I am going to have a very
simple memory manager, without virtual memory support or anything. Now, if I
keep a page of he memory, with 4k blocks, and the user executes a 40k file, my
system will find a 40k hole in the map and put the program there.. It will then
create a GDT entry starting at the beginning of the hole with a limit of 40k
and an LDT for this program with a code, data and stack entry. (Am I right so
far?). This way I take it protection will not be very complicated. If the
program tries to write outside it's piece of memory, an exception will give
control to the kernel. But.. Say the program performs a malloc(50000). If the
program has fit that 40k hole perfectly, there's no place for the memory
allocation, even if I have sixteen gigs of free memory outside the hole. What
did I miss here..?
Also, how does a C-compiler (gcc) put the data/code in the file if you compile
and link it as a binary.? I don't want to put both DS and CS to cover the whole
hole, as my program might start poking into its' own code. How is this normally
done?
Happy for any help,

Erik Sintorn - f10...@hogia.net

Will Rose

unread,
Mar 14, 1999, 3:00:00 AM3/14/99
to
Erik (f10...@hogia.net) wrote:
: Hello... I am writing a simple OS for the x86 (well, trying to..) and I have

Try and get hold of the Intel databook on 386 protected mode programming;
it's the best explanation of these sort of low-level details. (Generally
the OS allocates more memory for each malloc(), since there's no reason
for separate malloc's to give contiguous chunks of memory.)

An executable is set up in several parts, whose layout must be known
to the loader. The loader writes one part to code space, another
to data space, a third perhaps to uninitialised data space, and so on.


Will
c...@crash.cts.com


Michael Kennett

unread,
Mar 14, 1999, 3:00:00 AM3/14/99
to
Intel are a very nice company who will send you detailed information on 3
CD-ROMS.
The Web address where you can order the technical information on the
i386/Pentium
family of processors is:

http://developer.intel.com/design/litcentr/


Will Rose <c...@cts.com> wrote in message news:7cf73h$hst$1...@nusku.cts.com...

0 new messages