9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] memory.c
@ 2002-05-10 12:40 andrey mirtchovski
  0 siblings, 0 replies; 2+ messages in thread
From: andrey mirtchovski @ 2002-05-10 12:40 UTC (permalink / raw)
  To: 9fans

ramscan() in /sys/src/9/pc/memory.c has the following code:

	x = PADDR(CPU0MACH+BY2PG);
	bda = (uchar*)KADDR(0x400);
	n = ((bda[0x14]<<8)|bda[0x13])*KB-x;

the comments above it note that 0x413 and 0x414 should be filled in by
the bootloader.  in our case the bootstrap program is LinuxBios +
9load burnt on a DiskOnChip.  the kernel is either downloaded or
located on a hard drive.  the is no BIOS as we know it.

what does bda represent and which numbers should we expect to find in
there?  the way it is right now, 'n' gets to be quite large, thereby
causing the memset(KADDR(x), 0, n); couple of lines down to overwrite
the kernel at memory location 80100020.

we've toyed with it a bit, setting what we think are the correct
numbers, but ideally we'd like to get LinuxBios (or something else) to
put the right thing at the right place (LinuxBios already knows how
much memory there is in the machine and is the ideal candidate to do
so).


andrey



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

* Re: [9fans] memory.c
@ 2002-05-10 20:28 jmk
  0 siblings, 0 replies; 2+ messages in thread
From: jmk @ 2002-05-10 20:28 UTC (permalink / raw)
  To: 9fans

 From 'The Undocumented PC':

	The word at 40:13h contains the size of the main memory in 1024-byte blocks.
	If an extended BIOS data area (EBDA) is used, the main memory size is reduced
	by the size of that area. For a typical 640K system, this word will contain
	the value 280h.

On Fri May 10 09:34:17 EDT 2002, andrey@lanl.gov wrote:
> ramscan() in /sys/src/9/pc/memory.c has the following code:
>
> 	x = PADDR(CPU0MACH+BY2PG);
> 	bda = (uchar*)KADDR(0x400);
> 	n = ((bda[0x14]<<8)|bda[0x13])*KB-x;
>
> the comments above it note that 0x413 and 0x414 should be filled in by
> the bootloader.  in our case the bootstrap program is LinuxBios +
> 9load burnt on a DiskOnChip.  the kernel is either downloaded or
> located on a hard drive.  the is no BIOS as we know it.
>
> what does bda represent and which numbers should we expect to find in
> there?  the way it is right now, 'n' gets to be quite large, thereby
> causing the memset(KADDR(x), 0, n); couple of lines down to overwrite
> the kernel at memory location 80100020.
>
> we've toyed with it a bit, setting what we think are the correct
> numbers, but ideally we'd like to get LinuxBios (or something else) to
> put the right thing at the right place (LinuxBios already knows how
> much memory there is in the machine and is the ideal candidate to do
> so).
>
>
> andrey


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

end of thread, other threads:[~2002-05-10 20:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-10 12:40 [9fans] memory.c andrey mirtchovski
2002-05-10 20:28 jmk

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 NNTP newsgroup(s).