[Prev][Next][Index][Thread]

Re: Malloc, LMM, and the COM stuff



> Date: Fri, 4 Jan 2002 12:17:59 -0500 (EST)
> From: Stephen A Muckle <smuckle@andrew.cmu.edu>
> To: <oskit-users@cs.utah.edu>
> Subject: Malloc, LMM, and the COM stuff
> 
> Hello,
> 	I'm a bit confused as to how the minimal C standard library, the
> LMM and the COM interfaces are all related. I'm trying to plan how the
> kernel and user applications will access memory, and I'm having some
> difficulty.
> 

The OSKit minimal C library malloc routines (libc/malloc/) use
libc_memory_object (a COM interface) whose default implementation
(clientos/mem.c) uses the LMM library.

> My current plan is to "pin" the lower 4-8mb of memory for kernel data
> structures. The rest of memory will be used for pages of user
> applications. I read that when oskit is booting, it puts all available
> physical memory into an lmm pool and that's what malloc has access to (the
> extern lmm_t malloc_lmm). I suppose I'll need to change this lmm so that
> it does not include memory over 4-8mb.
> 

Yes, the easiest way would be to ensure that only the desired memory gets
put into the malloc_lmm.  See base_*_mem_init in kern/x86/pc/.

> So my question is, how do I set up the LMM for a user program? I thought
> I'd have to initialize an LMM in the user program for malloc to use, but
> then I read some stuff about these com interfaces to oskit_mem_t's that
> say that they are the lowest level of the memory hierarchy.
> 

First, lets be clear that there is no "user program" in the simple usage
of the OSKit.  You link your kernel with the OSKit and the result is a
"kernel" running in supervisor mode.  But to isolate kernel (4-8MB) memory
from the rest you could put the rest in a different LMM and allocate user
memory out of that.  Unfortunately, that means you have to have your own
malloc as the min-libc version is hardwired to use the one COM interface.