Subject: Re: [PATCH] Fixup for Amigas with memory at 0x200000
To: Aymeric Vincent <Aymeric.Vincent@labri.fr>
From: Ilpo Ruotsalainen <lonewolf@iki.fi>
List: port-amiga
Date: 01/10/2003 21:58:05
On Fri Jan 10 2003 at 21:38:59 +0200, Ilpo Ruotsalainen wrote:
> On Fri Jan 10 2003 at 21:35:53 +0200, Ilpo Ruotsalainen wrote:
> > After some debugging I've managed to narrow it down to this:
> > 
> > LMMUenable_start:
> > 
> > /* enable the MMU */
> > #if defined(M68040) || defined(M68060)
> >         RELOC(mmutype, %a0)
> >         cmpl    #MMU_68040,%a0@
> >         jne     Lenable030
> >         movl    #0xdff180,%a0
> >         movw    #0xa00,%a0@
> >         pflusha
> >         movl    #0xdff180,%a0
> >         movw    #0x00a,%a0@
> >         movl    #0xc000,%d0
> >         .word   0x4e7b, 0x0003          | movec %d0,%tc
> >         jmp     Lunshadow:l
> > #endif /* M68040 || M68060 */
> > /* ENABLE, SRP_ENABLE, 8K pages, 8bit A-level, 11bit B-level */
> > Ltc:    .long   0x82d08b00
> > Lenable030:
> >         movl    #0xdff180,%a0
> >         movw    #0x0a0,%a0@
> >         lea     Ltc,%a0
> >         pmove   %a0@,%tc
> >         jmp     Lunshadow:l
> > 
> > LMMUenable_end:
> > 
> > With the code looking like this, I end up with RED screen. Which seems
> > to say it dies on the "pflusha" instruction (unless that instruction
> > changes MMU mappings or such? I'd think it's the movec that changes them
> > but I don't know really almost anything about 68k MMUs...).
> 
> Hmpf, sent this a few minutes too early. Next iteration with the
> "pflusha" instruction removed produced a kernel that booted
> successfully. So that seems to be the guilty one, I'm not m68k guru
> enough to instantly know why it would die on that...

(I seem to have a bad habit of replying to myself a lot :P)

The problem is that locore.s is compiled as 030 code. 030 and 040/060
have different opcodes for pflusha, so the wrong 030 opcode is emitted
which causes 060 to crash and burn. Replacing the pflusha with .word
0xf518 (which is the 040 version of pflusha) generated a booting kernel.

-- 
Ilpo Ruotsalainen - <lonewolf@iki.fi> - http://www.iki.fi/lonewolf/