[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [MiNT] Atari 030 patch for mmu030.S in current CVS
On Mon, 2005-08-01 at 19:31 +0200, Konrad M. Kokoszkiewicz wrote:
> > I've found why FreeMiNT 1.16.x won't work on my TT, and below is a patch
> > to fix it.
> >
> > It seems that a pop from the stack had crept into the mmu030.S file.
>
> This fix does not seem completely perfect at first glance. You rather have
> to restore the pop you deleted, and move the push to the very begin of the
> routine. Note that there are two branches to the label "normal_set", and
> both have to be inside the scope of the push/pop operation.
>
> In other words, these lines in mmu030.S:
>
> set_mmu:
> tst.l _offset_tt_ram
> beq.s normal_set
> movem.l d0-d2/a0-a2,-(sp)
>
> should look like this:
>
> set_mmu:
> movem.l d0-d2/a0-a2,-(sp)
> tst.l _offset_tt_ram
> beq.s normal_set
>
> And this - and not deleting the pop - seems to fix the real bug we have in
> this procedure.
No, that's still not quite right either.
Below is the right fix taking into account the second branch to
"normal_set".
Because "normal_set" loads "crp" from the stack, which becomes corrupt
if we've already pushed it. We need to pop it before it reaches loading
of crp.
Attached is a better fix which should take care of the second call to
"normal_set" as well.
Alan.
Index: sys/arch/mmu030.S
===================================================================
RCS file: /mint/freemint/sys/arch/mmu030.S,v
retrieving revision 1.7
diff -u -r1.7 mmu030.S
--- sys/arch/mmu030.S 7 May 2005 08:58:16 -0000 1.7
+++ sys/arch/mmu030.S 1 Aug 2005 18:45:42 -0000
@@ -26,9 +26,9 @@
.globl _sys_m_free
_set_mmu:
+ movem.l d0-d2/a0-a2,-(sp)
tst.l _offset_tt_ram
beq.s normal_set
- movem.l d0-d2/a0-a2,-(sp)
move.l #end_set_mmu_called_st_ram - set_mmu_called_st_ram,d1
clr.w -(sp) // ST-ram
move.l d1,-(sp)
@@ -66,13 +66,13 @@
movem.l (sp)+,d0-d2/a0-a2
rts
normal_set:
+ movem.l (sp)+,d0-d2/a0-a2
pmove (nulltc).l,tc // turn off mmu
dc.l 0xf0390800,nulltc // pmove nulltc,tt0
dc.l 0xf0390c00,nulltc // pmove nulltc,tt1
pmove 4(sp),crp // caution: crp is 8 bytes
pflusha
pmove 0xc(sp),tc
- movem.l (sp)+,d0-d2/a0-a2
rts
set_mmu_called_st_ram: