This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: how can I alloc 64k memory?


Jonathan Larmour <jlarmour@redhat.com> writes:

> li hui wrote:
> > 
> > I am working on ecos with x86 target.I try to alloc a
> > 64k memory. it is very strange that it is correct when
> > i compile with -g and download it to target machine by
> > serial.But when i chose startup from floppy,it is
> > failed alloc such big memory.
> > 
> > I tried two ways to alloc memory as follow:
> > 1.unsigned char img[65536];
> > 2.img=(unsigned char*)malloc(65536*sizrof(char))
> > 
> > use first way,it seems just can alloc memory as large
> > as 30*256.
> 
> There are differences in the memory layout between RAM and FLOPPY startup.
> Although assuming you are using CVS, you should have 640k to play with
> already, but maybe it isn't enough. If you want to make the FLOPPY startup
> more like RAM, then you will need to edit the memory layout. Increase the
> size of the "ram" region from 0xa0000 to whatever the real size of the
> memory is. 
> 

That will not actually work. FLOPPY startup can only load the program
into the bottom 640k of RAM. This is because it uses the BIOS to load
data from the floppy, and must do that in real mode. Memory above 1M
is only accessible in protected mode. Extending the memory layout will
not work since there are things like video RAM and ROMs between 640k
and 1MB.

The easiest way to get at memory above 1M from a FLOPPY startup
application is to dynamically create a memory pool in that region. You
can then allocate memory from that.

-- 
Nick Garnett, eCos Kernel Architect
Red Hat, Cambridge, UK


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]