1 1.1 itohy | 2 1.1 itohy | copy binary image and execute 3 1.1 itohy | 4 1.3 itohy | written by ITOH Yasufumi 5 1.1 itohy | public domain 6 1.1 itohy | 7 1.3 itohy | $NetBSD: trampoline.S,v 1.3 2011/02/21 02:31:59 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.2 minoura | +4 %a3+0 temporary stack address 14 1.2 minoura | +8 %a3+4 processor type 15 1.2 minoura | +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.2 minoura oriw #0x0700,%sr | keep out interrupts 20 1.1 itohy 21 1.2 minoura moveal %sp@+,%a3 22 1.2 minoura moveal %a3@+,%sp | set temporary stack 23 1.1 itohy 24 1.2 minoura 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.2 minoura moveq #MPU_68030,%d0 30 1.2 minoura cmpl %d2,%d0 31 1.1 itohy bccs Lmmu030 32 1.1 itohy | 040/060 33 1.2 minoura moveq #0,%d0 34 1.2 minoura .long 0x4E7B0003 | movec %d0,%tc 35 1.2 minoura .long 0x4E7B0004 | movec %d0,%itt0 36 1.2 minoura .long 0x4E7B0005 | movec %d0,%itt1 37 1.2 minoura .long 0x4E7B0006 | movec %d0,%dtt0 38 1.2 minoura .long 0x4E7B0007 | movec %d0,%dtt1 39 1.2 minoura .long 0x4E7B0806 | movec %d0,%urp 40 1.2 minoura .long 0x4E7B0807 | movec %d0,%srp 41 1.1 itohy bras Lmmudone 42 1.1 itohy Lmmu030: 43 1.1 itohy | 020/030 44 1.2 minoura clrl %sp@- 45 1.2 minoura .long 0xF0174000 | pmove %sp@,%tc 46 1.2 minoura cmpl %d0,%d2 47 1.1 itohy bnes Lmmu020 | 68851 has no tt regs 48 1.2 minoura .long 0xF0170800 | pmove %sp@,%tt0 49 1.2 minoura .long 0xF0170C00 | pmove %sp@,%tt1 50 1.1 itohy Lmmu020: 51 1.2 minoura movel #0x7fff0001,%sp@- | null root pointer 52 1.2 minoura .long 0xF0174C00 | pmove %sp@,%crp 53 1.2 minoura .long 0xF0174800 | pmove %sp@,%srp 54 1.2 minoura 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.2 minoura subal %a1,%a1 62 1.2 minoura .long 0x4E7B9801 | movec %a1,%vbr 63 1.1 itohy 64 1.1 itohy | then transfer and exec kernel 65 1.1 itohy 66 1.2 minoura #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