public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] how can I alloc 64k memory?
@ 2002-03-24 20:11 li hui
  2002-04-03 19:46 ` Jonathan Larmour
  0 siblings, 1 reply; 3+ messages in thread
From: li hui @ 2002-03-24 20:11 UTC (permalink / raw)
  To: ecos-discuss

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=us-ascii, Size: 749 bytes --]

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.  

please tell me why!

__________________________________________________
Do You Yahoo!?
Yahoo! Movies - coverage of the 74th Academy Awards®
http://movies.yahoo.com/

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [ECOS] how can I alloc 64k memory?
  2002-03-24 20:11 [ECOS] how can I alloc 64k memory? li hui
@ 2002-04-03 19:46 ` Jonathan Larmour
  2002-04-04  1:48   ` Nick Garnett
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Larmour @ 2002-04-03 19:46 UTC (permalink / raw)
  To: li hui; +Cc: ecos-discuss

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. 

Jifl
-- 
Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062
Maybe this world is another planet's Hell -Aldous Huxley || Opinions==mine

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [ECOS] how can I alloc 64k memory?
  2002-04-03 19:46 ` Jonathan Larmour
@ 2002-04-04  1:48   ` Nick Garnett
  0 siblings, 0 replies; 3+ messages in thread
From: Nick Garnett @ 2002-04-04  1:48 UTC (permalink / raw)
  To: Jonathan Larmour; +Cc: li hui, ecos-discuss

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-04-04  9:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-24 20:11 [ECOS] how can I alloc 64k memory? li hui
2002-04-03 19:46 ` Jonathan Larmour
2002-04-04  1:48   ` Nick Garnett

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).