Subject: Re: Question about load-base
To: None <wrstuden@netbsd.org>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: port-macppc
Date: 12/22/2001 11:49:36
wrstuden@netbsd.org wrote:
> The question is: for "partition 0" loading on OF 1 & 2, does it have to be
> set to where the code will expect to run? Can it be set somewhere else?
> *Must* it be set somewhere else?
I guess load-base is only used to load and execute xcoff files.
For "partition x", Openfirmware uses addresses stored
in the Apple partition map.
macppc/stand/installboot/installboot.c:writeapplepartmap() writes
"faked" partition map entries to set address and length where bootxx
(i.e. primary bootloader) should be loaded:
---
/* block 2: NetBSD partition */
memset(&pme, 0, sizeof(pme));
pme.pmSig = DPME_MAGIC;
pme.pmMapBlkCnt = 2;
pme.pmPyPartStart = 4;
pme.pmPartBlkCnt = pme.pmDataCnt = 0x7fffffff;
strcpy(pme.pmPartName, "NetBSD");
strcpy(pme.pmPartType, "NetBSD/macppc");
pme.pmPartStatus = 0x3b;
pme.pmBootSize = 0x400;
pme.pmBootLoad = 0x4000;
pme.pmBootEntry = 0x4000;
strcpy(pme.pmProcessor, "PowerPC");
if (lseek(fd, 1024, SEEK_SET) != 1024)
return -1;
if (write(fd, &pme, 512) != 512)
return -1;
---
The loaded bootxx will load ofwboot (i.e. secondary loader) at address
of "entry_point", which is set by installboot.c:loadblocknums().
> The essence of the question though is will the "partition 0" code need to
> have its load address at 600000? If so, that means we need ofwboot.xcf and
> ofwboot.elf that load not at 600000, and ofwboot that loads at 600000.
The load address for ofwboot is defined in installboot.c as DEFAULT_ENTRY.
Current DEFAULT_ENTRY value is 0x600000, but I guess it could be changed.
---
Izumi Tsutsui
tsutsui@ceres.dti.ne.jp