On 26.05.14 23:24, BALATON Zoltan wrote:
Do not put exception handler routines between 0x00-0xff as some OSes use this area for their own purposes and can corrupt them. (In particular MorphOS writes to 0x80 during boot). This patch frees up this area by moving the routines that were there higher.
Signed-off-by: BALATON Zoltan balaton@eik.bme.hu
So do you happen to have any idea why the code was written the way it was written? I don't feel very confident that I grasp why the original author did it that way.
Alex
This replaces my previous attempt (Use exception vectors from ROM instead of copying them to page zero) as that relied on the MSR[IP] bit that was found not to be generally available.
Index: openbios-devel/arch/ppc/qemu/start.S
--- openbios-devel/arch/ppc/qemu/start.S (revision 1304) +++ openbios-devel/arch/ppc/qemu/start.S (working copy) @@ -280,21 +280,9 @@ GLOBL(__vectors): 1: nop // b 1b
-call_dsi_exception:
- LOAD_REG_FUNC(r3, dsi_exception)
- mtctr r3
- bctrl
- b exception_return
+VECTOR( 0x100, "SRE" ):
b _entry
-call_isi_exception:
- LOAD_REG_FUNC(r3, isi_exception)
- mtctr r3
- bctrl
- b exception_return
-exception_return:
- EXCEPTION_EPILOGUE
- trap_error: lis r1, 0x8000 /* r1=0x80000000 */ add. r1,r1,r1 /* r1=r1+r1 (high 32bit !0) */
@@ -309,9 +297,6 @@ trap_error: mtctr r4 bctr
-VECTOR( 0x100, "SRE" ):
b _entry
ILLEGAL_VECTOR( 0x200 )
VECTOR( 0x300, "DSI" ):
@@ -373,11 +358,16 @@ VECTOR( 0x2200, "ISI_64" ):
real_dsi: EXCEPTION_PREAMBLE
- b call_dsi_exception
LOAD_REG_FUNC(r3, dsi_exception)
b call_exception_handler
real_isi: EXCEPTION_PREAMBLE
- b call_isi_exception
- LOAD_REG_FUNC(r3, isi_exception)
+call_exception_handler:
mtctr r3
bctrl
EXCEPTION_EPILOGUE
GLOBL(__vectors_end):