trampoline.S revision 1.1 1 1.1 itohy |
2 1.1 itohy | copy binary image and execute
3 1.1 itohy |
4 1.1 itohy | written by Yasha (ITOH Yasufumi)
5 1.1 itohy | public domain
6 1.1 itohy |
7 1.1 itohy | $NetBSD: trampoline.S,v 1.1 1998/09/01 19:55:33 itohy Exp $
8 1.1 itohy
9 1.1 itohy #include <machine/asm.h>
10 1.1 itohy #include "trampoline.h"
11 1.1 itohy
12 1.1 itohy | arg+0 bsr trampoline
13 1.1 itohy | +4 a3+0 temporary stack address
14 1.1 itohy | +8 a3+4 processor type
15 1.1 itohy | +12 a3+8 struct execkern_arg
16 1.1 itohy | +52 trampoline
17 1.1 itohy
18 1.1 itohy ENTRY_NOPROFILE(trampoline)
19 1.1 itohy oriw #0x0700,sr | keep out interrupts
20 1.1 itohy
21 1.1 itohy moveal sp@+,a3
22 1.1 itohy moveal a3@+,sp | set temporary stack
23 1.1 itohy
24 1.1 itohy movel a3@+,d2 | MPU type
25 1.1 itohy
26 1.1 itohy |
27 1.1 itohy | turn off MMU
28 1.1 itohy |
29 1.1 itohy moveq #MPU_68030,d0
30 1.1 itohy cmpl d2,d0
31 1.1 itohy bccs Lmmu030
32 1.1 itohy | 040/060
33 1.1 itohy moveq #0,d0
34 1.1 itohy .long 0x4E7B0003 | movec d0,tc
35 1.1 itohy .long 0x4E7B0004 | movec d0,itt0
36 1.1 itohy .long 0x4E7B0005 | movec d0,itt1
37 1.1 itohy .long 0x4E7B0006 | movec d0,dtt0
38 1.1 itohy .long 0x4E7B0007 | movec d0,dtt1
39 1.1 itohy .long 0x4E7B0806 | movec d0,urp
40 1.1 itohy .long 0x4E7B0807 | movec d0,srp
41 1.1 itohy bras Lmmudone
42 1.1 itohy Lmmu030:
43 1.1 itohy | 020/030
44 1.1 itohy clrl sp@-
45 1.1 itohy .long 0xF0174000 | pmove sp@,tc
46 1.1 itohy cmpl d0,d2
47 1.1 itohy bnes Lmmu020 | 68851 has no tt regs
48 1.1 itohy .long 0xF0170800 | pmove sp@,tt0
49 1.1 itohy .long 0xF0170C00 | pmove sp@,tt1
50 1.1 itohy Lmmu020:
51 1.1 itohy movel #0x7fff0001,sp@- | null root pointer
52 1.1 itohy .long 0xF0174C00 | pmove sp@,crp
53 1.1 itohy .long 0xF0174800 | pmove sp@,srp
54 1.1 itohy addql #8,sp
55 1.1 itohy Lmmudone:
56 1.1 itohy
57 1.1 itohy | minimize supervisor protection
58 1.1 itohy clrb AREA_SET_REG
59 1.1 itohy
60 1.1 itohy | reset VBR (for compatibility)
61 1.1 itohy subal a1,a1
62 1.1 itohy .long 0x4E7B9801 | movec a1,vbr
63 1.1 itohy
64 1.1 itohy | then transfer and exec kernel
65 1.1 itohy
66 1.1 itohy #define XK_NO_C_INTERFACE /* pass arg with a3 */
67 1.1 itohy #include "../common/execkern.S"
68 1.1 itohy
69 1.1 itohy GLOBAL(end_trampoline)
70