From ebcb14eaa7d915af58223da92bf13db5319c6506 Mon Sep 17 00:00:00 2001 From: Laurent Vivier Date: Fri, 25 Nov 2005 19:53:47 +0000 Subject: [PATCH] Move 32bit switch to 32bitmode.i --- first/32bitmode.i | 45 +++++++++++++++++++++++++++++++++++++++++++++ first/first.S | 44 +++----------------------------------------- 2 files changed, 48 insertions(+), 41 deletions(-) create mode 100644 first/32bitmode.i diff --git a/first/32bitmode.i b/first/32bitmode.i new file mode 100644 index 0000000..9628204 --- /dev/null +++ b/first/32bitmode.i @@ -0,0 +1,45 @@ +.macro switch32bitmode + + /* is a 32bit aware ROM ? */ + + movea.l ROMBase,%a0 + move.w 8(%a0), %d1 /* read ROM id */ + + cmp.w #0x0178, %d1 /* only 24bit ROM */ + bls.S bit32_ok + + /* is a 32bit aware processor ? */ + + cmp.w #1, CPUFlags /* Is 68000 or 68010 */ + bls.S bit32_ok + + /* test if we are in 32bit mode */ + + move.l #-1, %d0 + StripAddress + cmp.l #-1, %d0 + beq.S bit32_ok + + /* Switch to 32bit mode */ + + lea PRAM_buffer(%pc), %a0 /* where to store data */ + move.w #1, %d0 /* size of data */ + swap %d0 + move.w #0x08A, %d0 /* offset in PRAM */ + ReadXPRam + + lea PRAM_buffer(%pc), %a0 + or.b #0x05, (%a0) + + move.w #1, %d0 /* size of data */ + swap %d0 + move.w #0x08A, %d0 /* offset in PRAM */ + WriteXPRam + + /* jump to reset function in ROM */ + + movea.l ROMBase,%a0 + jmp 0x90(%a0) + +bit32_ok: +.endm diff --git a/first/first.S b/first/first.S index 3d6a0b1..07a5a46 100644 --- a/first/first.S +++ b/first/first.S @@ -10,6 +10,7 @@ .equ first_level_size, 2 * sector_size .include "macos.i" +.include "32bitmode.i" /****************************************************************************** * @@ -63,48 +64,9 @@ start: SetApplBase movel SysZone,TheZone - /* is a 32bit aware ROM ? */ + /* test if we are in 32bit mode, otherwise reboot in 32bit mode */ - movea.l ROMBase,%a0 - move.w 8(%a0), %d1 /* read ROM id */ - - cmp.w #0x0178, %d1 /* only 24bit ROM */ - bls.S bit32_ok - - /* is a 32bit aware processor ? */ - - cmp.w #1, CPUFlags /* Is 68000 or 68010 */ - bls.S bit32_ok - - /* test if we are in 32bit mode */ - - move.l #-1, %d0 - StripAddress - cmp.l #-1, %d0 - beq.S bit32_ok - - /* Switch to 32bit mode */ - - lea PRAM_buffer(%pc), %a0 /* where to store data */ - move.w #1, %d0 /* size of data */ - swap %d0 - move.w #0x08A, %d0 /* offset in PRAM */ - ReadXPRam - - lea PRAM_buffer(%pc), %a0 - or.b #0x05, (%a0) - - move.w #1, %d0 /* size of data */ - swap %d0 - move.w #0x08A, %d0 /* offset in PRAM */ - WriteXPRam - - /* jump to reset function in ROM */ - - movea.l ROMBase,%a0 - jmp 0x90(%a0) - -bit32_ok: + switch32bitmode /* buffer size to store second stage booter */