[PATCH 449] M68k IFPSP060

From: Geert Uytterhoeven
Date: Sun Jun 20 2004 - 12:44:30 EST


IFPSP060: Make sure that the destination address of a misaligned cas access is
properly mapped in, so the kernel won't oops in the emulation handler (from
Roman Zippel).

Signed-off-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>

--- linux-2.6.7/arch/m68k/ifpsp060/iskeleton.S 2004-05-03 11:01:24.000000000 +0200
+++ linux-m68k-2.6.7/arch/m68k/ifpsp060/iskeleton.S 2004-05-23 10:55:54.000000000 +0200
@@ -196,14 +196,57 @@
| Expected outputs:
| d0 = 0 -> success; non-zero -> failure
|
-| Linux/68k: As long as ints are disabled, no swapping out should
-| occur (hopefully...)
+| Linux/m68k: Make sure the page is properly paged in, so we use
+| plpaw and handle any exception here. The kernel must not be
+| preempted until _060_unlock_page(), so that the page stays mapped.
|
.global _060_real_lock_page
_060_real_lock_page:
- clr.l %d0
+ move.l %d2,-(%sp)
+ | load sfc/dfc
+ moveq #5,%d0
+ tst.b %d0
+ jne 1f
+ moveq #1,%d0
+1: movec.l %dfc,%d2
+ movec.l %d0,%dfc
+ movec.l %d0,%sfc
+
+ clr.l %d0
+ | prefetch address
+ .chip 68060
+ move.l %a0,%a1
+1: plpaw (%a1)
+ addq.w #1,%a0
+ tst.b %d1
+ jeq 2f
+ addq.w #2,%a0
+2: plpaw (%a0)
+3: .chip 68k
+
+ | restore sfc/dfc
+ movec.l %d2,%dfc
+ movec.l %d2,%sfc
+ move.l (%sp)+,%d2
rts

+.section __ex_table,"a"
+ .align 4
+ .long 1b,11f
+ .long 2b,21f
+.previous
+.section .fixup,"ax"
+ .even
+11: move.l #0x020003c0,%d0
+ or.l %d2,%d0
+ swap %d0
+ jra 3b
+21: move.l #0x02000bc0,%d0
+ or.l %d2,%d0
+ swap %d0
+ jra 3b
+.previous
+
|
| _060_unlock_page():
|
@@ -216,8 +259,7 @@
| d0 = `xxxxxxff -> supervisor; `xxxxxx00 -> user
| d1 = `xxxxxxff -> longword; `xxxxxx00 -> word
|
-| Linux/68k: As we do no special locking operation, also no unlocking
-| is needed...
+| Linux/m68k: perhaps reenable preemption here...

.global _060_real_unlock_page
_060_real_unlock_page:

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/