[OpenBIOS] [PATCH] sparc64: fix registers dealing with client

Igor Kovalenko igor.v.kovalenko at gmail.com
Fri Jul 10 22:25:56 CEST 2009


On Fri, Jul 10, 2009 at 11:20 PM, Blue Swirl<blauwirbel at gmail.com> wrote:
> On 7/6/09, Igor Kovalenko <igor.v.kovalenko at gmail.com> wrote:
>> Hi!
>>
>>  This patch improves previous proposal and adds:
>>
>>  - save/restore global registers across client interface calls.
>>  Since OS kernel generally has it's own idea of what
>>  the ABI is we have to follow this requirement.
>>
>>  - adjust stack to allow using unoptimized openbios
>>  build with linux kernel. Linux provides only 128 bytes
>>  on stack which is not enough to save arguments by
>>  code generated with gcc -O0
>>
>>  - fix switch_to so it actually could be used to switch
>>  to client image. context pointer must be volatile to
>>  prevent gcc optimizing out stores to it.
>>
>>  Signed-off-by: igor.v.kovalenko at gmail.com
>
> Thanks, but with the patch applied, SILO in most of my test images no
> longer boots. For example, HelenOS 0.2.0.5:
> OpenBIOS for Sparc64
> Configuration device id QEMU version 1 machine id 0
> CPUs: 1 x SUNW,UltraSPARC-II
> UUID: 00000000-0000-0000-0000-000000000000
> Welcome to OpenBIOS v1.0 built on Jul 10 2009 19:12
>  Type 'help' for detailed information
>
> [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 0x00000000ffe51999
> SIUnhandled Exception 0x0000000000000068
> PC = 0x00000000ffd0ff14 NPC = 0x00000000ffd0ff18
> Stopping execution

Thanks, I reproduced this problem.
Now looking into making -Os working.
OpenBIOS for Sparc64
Configuration device id QEMU version 1 machine id 0
CPUs: 1 x SUNW,UltraSPARC-II
UUID: 00000000-0000-0000-0000-000000000000
Welcome to OpenBIOS v1.0 built on Jul 10 2009 20:18
  Type 'help' for detailed information

[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 0x00000000ffe51999
SIUnhandled Exception 0x0000000000000068
PC = 0x00000000ffd100b0 NPC = 0x00000000ffd100b4
Stopping execution

BTW checked here with openbios gcc optimizations disabled, that works
for me so there is no fault. Here is a brief optimizations history :)

--- openbios-devel.orig/config/examples/cross-sparc64_rules.xml
+++ openbios-devel/config/examples/cross-sparc64_rules.xml
@@ -25,11 +25,17 @@ LD     := $(TARGET)ld
 NM     := $(TARGET)nm
 STRIP  := $(TARGET)strip
 RANLIB := $(TARGET)ranlib
-CFLAGS := -Os -Wall -DNATIVE_BITWIDTH_EQUALS_HOST_BITWIDTH -USWAP_ENDIANNESS -g
+#CFLAGS := -Os -Wall -DNATIVE_BITWIDTH_EQUALS_HOST_BITWIDTH
-USWAP_ENDIANNESS -g
+CFLAGS := -O0 -Wall -DNATIVE_BITWIDTH_EQUALS_HOST_BITWIDTH -USWAP_ENDIANNESS -g
+#CFLAGS := -O1 -Wall -DNATIVE_BITWIDTH_EQUALS_HOST_BITWIDTH
-USWAP_ENDIANNESS -g
+#CFLAGS := -Os -fno-inline -Wall
-DNATIVE_BITWIDTH_EQUALS_HOST_BITWIDTH -USWAP_ENDIANNESS -g
 CFLAGS+= -Wa,-xarch=v9b -Wa,-64 -m64 -mcpu=ultrasparc -mcmodel=medany
 CFLAGS+= -fno-builtin -nostdlib -ffreestanding
 CFLAGS+= -Wredundant-decls -Wshadow -Wpointer-arith
-Wstrict-prototypes -Wmissing-declarations
 CFLAGS+= -Wundef -Wendif-labels -Wstrict-aliasing -Wwrite-strings
-Wmissing-prototypes -Werror
+#CFLAGS+= -ffixed-g4 -ffixed-g5
+#CFLAGS+= -ffixed-g1 -ffixed-g5 -ffixed-g6 -ffixed-g7
+#CFLAGS+= -ffixed-g5 -ffixed-g6 -ffixed-g7
 INCLUDES := -I$(SRCDIR)/include -I$(SRCDIR)/kernel/include
-I$(ODIR)/target/include
 AS_FLAGS := -Wa,-xarch=v9b -Wa,-64 -g

-- 
Kind regards,
Igor V. Kovalenko



More information about the OpenBIOS mailing list