[OpenBIOS] [PATCH] sparc64: clear unused registers when calling client image

Igor Kovalenko igor.v.kovalenko at gmail.com
Tue May 26 23:19:57 CEST 2009

On Wed, May 20, 2009 at 8:57 PM, Blue Swirl <blauwirbel at gmail.com> wrote:
> On 5/19/09, Igor Kovalenko <igor.v.kovalenko at gmail.com> wrote:
>> This change seems to fix the problem here with silo not being able
>>  to deal with bss data. The problem is that silo does access to an address
>>  which is calculated from %i3 + bss offset, so %i3 must be somehow initialized.
>>  To do this I created start_client_image() helper which initializes
>>  clear context,
>>  fills it with stack pointer and client interface handler pointer then
>>  switches to it.
>>  According to docs all registers not used to convey data to client code must be
>>  cleared.
>>  Since my sparc64-elf-gcc cross compiler managed to discard stores
>>  to __context in switch_to() I had to make __context a volatile pointer.
>>  Signed-off-by: Igor Kovalenko <igor.v.kovalenko at gmail.com>
> There is something strange with the patch, for example SILO on Gentoo
> 2008.0 install CD does not load completely:
> [sparc64] Booting file 'cdrom' with parameters ''
> Not a bootable ELF image
> Not a Linux kernel image
> Loading a.out image...
> Loaded 7680 bytes
> entry point is 0x4000
> Jumping to entry point...
> switching to new context: entry point 0x4000 stack 0xffe50a51
> SIUnhandled Exception 0x0000000000000068
> PC = 0x00000000ffd0fd44 NPC = 0x00000000ffd0fd48
> Stopping execution

I now see there are other issues with that patch, for example stack
pointer is assigned at bottom of client image stack.

Let's do a workaround instead. This patch just clears %i3 before
calling client image, allowing silo to initialize and boot image.

Kind regards,
Igor V. Kovalenko
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sparc64-aout-silo-workaround.patch
Type: application/octet-stream
Size: 511 bytes
Desc: not available
URL: <http://lists.openbios.org/pipermail/openbios/attachments/20090527/72ad0aea/attachment.dmg>

More information about the OpenBIOS mailing list