[syslinux] Comboot Menu

ganapathy murali krishnan gmurali at cs.uchicago.edu
Mon Jan 19 16:10:42 PST 2004


So, the following should be a very simple memory manager?


--- BEGIN PSEUDO CODE ---

START = SS:SP+1 (1 byte above SS:SP)
END = Value(DS:0002)-1
myptr = pointer to START

(void *) myalloc(int numbytes)
{
     void * ans;
     ans = myptr;
     myptr = myptr + numbytes;
}

--- END PSEUDO CODE ---

As long I never have to deallocated memory, the above should be a 
workable memory managing system?

- Murali

H. Peter Anvin wrote:
> ganapathy murali krishnan wrote:
> 
>>Some comboot questions:
>>
>>How does one allocate memory? Is there a BIOS interrupt to allocate memory?
>>
> 
> 
> You don't.  You already have all the memory you're going to get.
> 
> For COM (as opposed to COM32) the amount of memory you have to play with
> is given by the WORD at offset DS:0002h; this gives the paragraph
> ("segment") address beyond your memory.  For example, assume:
> 
> DS 	 == 5000h
> DS:0002h == 7000h
> 
> ... this means that all the memory between 0x50000 and 0x6ffff inclusive
> is for you to play with.  It's your responsibility to set up a
> malloc-like system to manage this memory if you need it.
> 
> Note that SS:SP will start out as DS:FFFEh (5000:FFFE in this case), so
> the stack is smack in the middle of this memory range.
> 
> DOS behaves the same way with respect to .COM files.
> 
> 
>>Can the comboot api also include an interrupt to allocate some memory?
> 
> 
> No.  (In fact, under DOS you have to first *deallocate* the memory you
> have already been allocated in order to use any of the allocation APIs.)
> 
> 
>>I presume a .COM file can still access memory outside its 64K segment,
>>using ES and FS?
> 
> 
> Yes; within limits above.
> 
> 
>>The simple menu system is working fine as a .COM file and hard coded
>>menu entries. Need some memory allocation scheme if I read this stuff
>>from a file and if I have to suport submenu's and so forth.
> 
> 
> Great!  Hope this helps...
> 
> 	-hpa
> 





More information about the Syslinux mailing list