1 |
cebix |
1.1 |
/* |
2 |
|
|
* emul_op.h - 68k opcodes for ROM patches |
3 |
|
|
* |
4 |
|
|
* SheepShaver (C) 1997-2002 Christian Bauer and Marc Hellwig |
5 |
|
|
* |
6 |
|
|
* This program is free software; you can redistribute it and/or modify |
7 |
|
|
* it under the terms of the GNU General Public License as published by |
8 |
|
|
* the Free Software Foundation; either version 2 of the License, or |
9 |
|
|
* (at your option) any later version. |
10 |
|
|
* |
11 |
|
|
* This program is distributed in the hope that it will be useful, |
12 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
|
|
* GNU General Public License for more details. |
15 |
|
|
* |
16 |
|
|
* You should have received a copy of the GNU General Public License |
17 |
|
|
* along with this program; if not, write to the Free Software |
18 |
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 |
|
|
*/ |
20 |
|
|
|
21 |
|
|
#ifndef EMUL_OP_H |
22 |
|
|
#define EMUL_OP_H |
23 |
|
|
|
24 |
|
|
// PowerPC opcodes |
25 |
|
|
const uint32 POWERPC_NOP = 0x60000000; |
26 |
|
|
const uint32 POWERPC_ILLEGAL = 0x00000000; |
27 |
|
|
const uint32 POWERPC_BLR = 0x4e800020; |
28 |
|
|
const uint32 POWERPC_BCTR = 0x4e800420; |
29 |
|
|
const uint32 POWERPC_EMUL_OP = 0x18000000; // Base opcode for EMUL_OP opcodes (only used with PPC emulation) |
30 |
|
|
|
31 |
gbeauche |
1.3 |
enum { // Selectors for NATIVE_EXEC callbacks (only used with PPC emulation) |
32 |
|
|
NATIVE_PATCH_NAME_REGISTRY, |
33 |
|
|
NATIVE_VIDEO_INSTALL_ACCEL, |
34 |
|
|
NATIVE_VIDEO_VBL, |
35 |
|
|
NATIVE_VIDEO_DO_DRIVER_IO, |
36 |
|
|
NATIVE_ETHER_IRQ, |
37 |
|
|
NATIVE_ETHER_INIT, |
38 |
|
|
NATIVE_ETHER_TERM, |
39 |
|
|
NATIVE_ETHER_OPEN, |
40 |
|
|
NATIVE_ETHER_CLOSE, |
41 |
|
|
NATIVE_ETHER_WPUT, |
42 |
|
|
NATIVE_ETHER_RSRV, |
43 |
|
|
NATIVE_SERIAL_NOTHING, |
44 |
|
|
NATIVE_SERIAL_OPEN, |
45 |
|
|
NATIVE_SERIAL_PRIME_IN, |
46 |
|
|
NATIVE_SERIAL_PRIME_OUT, |
47 |
|
|
NATIVE_SERIAL_CONTROL, |
48 |
|
|
NATIVE_SERIAL_STATUS, |
49 |
|
|
NATIVE_SERIAL_CLOSE, |
50 |
|
|
NATIVE_GET_RESOURCE, |
51 |
|
|
NATIVE_GET_1_RESOURCE, |
52 |
|
|
NATIVE_GET_IND_RESOURCE, |
53 |
|
|
NATIVE_GET_1_IND_RESOURCE, |
54 |
|
|
NATIVE_R_GET_RESOURCE, |
55 |
gbeauche |
1.4 |
NATIVE_DISABLE_INTERRUPT, |
56 |
|
|
NATIVE_ENABLE_INTERRUPT, |
57 |
gbeauche |
1.5 |
NATIVE_MAKE_EXECUTABLE, |
58 |
gbeauche |
1.3 |
NATIVE_OP_MAX |
59 |
|
|
}; |
60 |
gbeauche |
1.4 |
#define POWERPC_NATIVE_OP(SELECTOR) NativeOpTable[SELECTOR] |
61 |
|
|
#define POWERPC_NATIVE_OP_FUNC(SELECTOR) ((uint32)(uintptr)&POWERPC_NATIVE_OP(SELECTOR)) |
62 |
gbeauche |
1.3 |
extern const uint32 NativeOpTable[NATIVE_OP_MAX]; |
63 |
|
|
|
64 |
cebix |
1.1 |
// 68k opcodes |
65 |
|
|
const uint16 M68K_ILLEGAL = 0x4afc; |
66 |
|
|
const uint16 M68K_NOP = 0x4e71; |
67 |
|
|
const uint16 M68K_RTS = 0x4e75; |
68 |
|
|
const uint16 M68K_RTD = 0x4e74; |
69 |
|
|
const uint16 M68K_JMP = 0x4ef9; |
70 |
|
|
const uint16 M68K_JMP_A0 = 0x4ed0; |
71 |
|
|
const uint16 M68K_JSR = 0x4eb9; |
72 |
|
|
const uint16 M68K_JSR_A0 = 0x4e90; |
73 |
|
|
enum { // Selectors for EMUL_OP opcodes |
74 |
|
|
OP_BREAK, OP_XPRAM1, OP_XPRAM2, OP_XPRAM3, OP_NVRAM1, OP_NVRAM2, OP_NVRAM3, |
75 |
|
|
OP_FIX_MEMTOP, OP_FIX_MEMSIZE, OP_FIX_BOOTSTACK, |
76 |
|
|
OP_SONY_OPEN, OP_SONY_PRIME, OP_SONY_CONTROL, OP_SONY_STATUS, |
77 |
|
|
OP_DISK_OPEN, OP_DISK_PRIME, OP_DISK_CONTROL, OP_DISK_STATUS, |
78 |
|
|
OP_CDROM_OPEN, OP_CDROM_PRIME, OP_CDROM_CONTROL, OP_CDROM_STATUS, |
79 |
|
|
OP_AUDIO_DISPATCH, OP_SOUNDIN_OPEN, OP_SOUNDIN_PRIME, OP_SOUNDIN_CONTROL, OP_SOUNDIN_STATUS, OP_SOUNDIN_CLOSE, |
80 |
|
|
OP_ADBOP, OP_INSTIME, OP_RMVTIME, OP_PRIMETIME, OP_MICROSECONDS, OP_PUT_SCRAP, OP_GET_SCRAP, |
81 |
|
|
OP_DEBUG_STR, OP_INSTALL_DRIVERS, OP_NAME_REGISTRY, OP_RESET, OP_IRQ, |
82 |
|
|
OP_SCSI_DISPATCH, OP_SCSI_ATOMIC, |
83 |
|
|
OP_NTRB_17_PATCH, OP_NTRB_17_PATCH2, OP_NTRB_17_PATCH3, OP_CHECKLOAD, |
84 |
|
|
OP_EXTFS_COMM, OP_EXTFS_HFS, OP_IDLE_TIME, |
85 |
|
|
OP_MAX |
86 |
|
|
}; |
87 |
|
|
const uint16 M68K_EMUL_RETURN = 0xfe40; // Extended opcodes |
88 |
|
|
const uint16 M68K_EXEC_RETURN = 0xfe41; |
89 |
gbeauche |
1.3 |
const uint16 M68K_EXEC_NATIVE = 0xfe42; |
90 |
|
|
const uint16 M68K_EMUL_BREAK = 0xfe43; |
91 |
cebix |
1.1 |
const uint16 M68K_EMUL_OP_XPRAM1 = M68K_EMUL_BREAK + OP_XPRAM1; |
92 |
|
|
const uint16 M68K_EMUL_OP_XPRAM2 = M68K_EMUL_BREAK + OP_XPRAM2; |
93 |
|
|
const uint16 M68K_EMUL_OP_XPRAM3 = M68K_EMUL_BREAK + OP_XPRAM3; |
94 |
|
|
const uint16 M68K_EMUL_OP_NVRAM1 = M68K_EMUL_BREAK + OP_NVRAM1; |
95 |
|
|
const uint16 M68K_EMUL_OP_NVRAM2 = M68K_EMUL_BREAK + OP_NVRAM2; |
96 |
|
|
const uint16 M68K_EMUL_OP_NVRAM3 = M68K_EMUL_BREAK + OP_NVRAM3; |
97 |
|
|
const uint16 M68K_EMUL_OP_FIX_MEMTOP = M68K_EMUL_BREAK + OP_FIX_MEMTOP; |
98 |
|
|
const uint16 M68K_EMUL_OP_FIX_MEMSIZE = M68K_EMUL_BREAK + OP_FIX_MEMSIZE; |
99 |
|
|
const uint16 M68K_EMUL_OP_FIX_BOOTSTACK = M68K_EMUL_BREAK + OP_FIX_BOOTSTACK; |
100 |
|
|
const uint16 M68K_EMUL_OP_SONY_OPEN = M68K_EMUL_BREAK + OP_SONY_OPEN; |
101 |
|
|
const uint16 M68K_EMUL_OP_SONY_PRIME = M68K_EMUL_BREAK + OP_SONY_PRIME; |
102 |
|
|
const uint16 M68K_EMUL_OP_SONY_CONTROL = M68K_EMUL_BREAK + OP_SONY_CONTROL; |
103 |
|
|
const uint16 M68K_EMUL_OP_SONY_STATUS = M68K_EMUL_BREAK + OP_SONY_STATUS; |
104 |
|
|
const uint16 M68K_EMUL_OP_DISK_OPEN = M68K_EMUL_BREAK + OP_DISK_OPEN; |
105 |
|
|
const uint16 M68K_EMUL_OP_DISK_PRIME = M68K_EMUL_BREAK + OP_DISK_PRIME; |
106 |
|
|
const uint16 M68K_EMUL_OP_DISK_CONTROL = M68K_EMUL_BREAK + OP_DISK_CONTROL; |
107 |
|
|
const uint16 M68K_EMUL_OP_DISK_STATUS = M68K_EMUL_BREAK + OP_DISK_STATUS; |
108 |
|
|
const uint16 M68K_EMUL_OP_CDROM_OPEN = M68K_EMUL_BREAK + OP_CDROM_OPEN; |
109 |
|
|
const uint16 M68K_EMUL_OP_CDROM_PRIME = M68K_EMUL_BREAK + OP_CDROM_PRIME; |
110 |
|
|
const uint16 M68K_EMUL_OP_CDROM_CONTROL = M68K_EMUL_BREAK + OP_CDROM_CONTROL; |
111 |
|
|
const uint16 M68K_EMUL_OP_CDROM_STATUS = M68K_EMUL_BREAK + OP_CDROM_STATUS; |
112 |
|
|
const uint16 M68K_EMUL_OP_AUDIO_DISPATCH = M68K_EMUL_BREAK + OP_AUDIO_DISPATCH; |
113 |
|
|
const uint16 M68K_EMUL_OP_SOUNDIN_OPEN = M68K_EMUL_BREAK + OP_SOUNDIN_OPEN; |
114 |
|
|
const uint16 M68K_EMUL_OP_SOUNDIN_CLOSE = M68K_EMUL_BREAK + OP_SOUNDIN_CLOSE; |
115 |
|
|
const uint16 M68K_EMUL_OP_SOUNDIN_PRIME = M68K_EMUL_BREAK + OP_SOUNDIN_PRIME; |
116 |
|
|
const uint16 M68K_EMUL_OP_SOUNDIN_CONTROL = M68K_EMUL_BREAK + OP_SOUNDIN_CONTROL; |
117 |
|
|
const uint16 M68K_EMUL_OP_SOUNDIN_STATUS = M68K_EMUL_BREAK + OP_SOUNDIN_STATUS; |
118 |
|
|
const uint16 M68K_EMUL_OP_ADBOP = M68K_EMUL_BREAK + OP_ADBOP; |
119 |
|
|
const uint16 M68K_EMUL_OP_INSTIME = M68K_EMUL_BREAK + OP_INSTIME; |
120 |
|
|
const uint16 M68K_EMUL_OP_RMVTIME = M68K_EMUL_BREAK + OP_RMVTIME; |
121 |
|
|
const uint16 M68K_EMUL_OP_PRIMETIME = M68K_EMUL_BREAK + OP_PRIMETIME; |
122 |
|
|
const uint16 M68K_EMUL_OP_MICROSECONDS = M68K_EMUL_BREAK + OP_MICROSECONDS; |
123 |
|
|
const uint16 M68K_EMUL_OP_PUT_SCRAP = M68K_EMUL_BREAK + OP_PUT_SCRAP; |
124 |
|
|
const uint16 M68K_EMUL_OP_GET_SCRAP = M68K_EMUL_BREAK + OP_GET_SCRAP; |
125 |
|
|
const uint16 M68K_EMUL_OP_DEBUG_STR = M68K_EMUL_BREAK + OP_DEBUG_STR; |
126 |
|
|
const uint16 M68K_EMUL_OP_INSTALL_DRIVERS = M68K_EMUL_BREAK + OP_INSTALL_DRIVERS; |
127 |
|
|
const uint16 M68K_EMUL_OP_NAME_REGISTRY = M68K_EMUL_BREAK + OP_NAME_REGISTRY; |
128 |
|
|
const uint16 M68K_EMUL_OP_RESET = M68K_EMUL_BREAK + OP_RESET; |
129 |
|
|
const uint16 M68K_EMUL_OP_IRQ = M68K_EMUL_BREAK + OP_IRQ; |
130 |
|
|
const uint16 M68K_EMUL_OP_SCSI_DISPATCH = M68K_EMUL_BREAK + OP_SCSI_DISPATCH; |
131 |
|
|
const uint16 M68K_EMUL_OP_SCSI_ATOMIC = M68K_EMUL_BREAK + OP_SCSI_ATOMIC; |
132 |
|
|
const uint16 M68K_EMUL_OP_NTRB_17_PATCH = M68K_EMUL_BREAK + OP_NTRB_17_PATCH; |
133 |
|
|
const uint16 M68K_EMUL_OP_NTRB_17_PATCH2 = M68K_EMUL_BREAK + OP_NTRB_17_PATCH2; |
134 |
|
|
const uint16 M68K_EMUL_OP_NTRB_17_PATCH3 = M68K_EMUL_BREAK + OP_NTRB_17_PATCH3; |
135 |
|
|
const uint16 M68K_EMUL_OP_CHECKLOAD = M68K_EMUL_BREAK + OP_CHECKLOAD; |
136 |
|
|
const uint16 M68K_EMUL_OP_EXTFS_COMM = M68K_EMUL_BREAK + OP_EXTFS_COMM; |
137 |
|
|
const uint16 M68K_EMUL_OP_EXTFS_HFS = M68K_EMUL_BREAK + OP_EXTFS_HFS; |
138 |
|
|
const uint16 M68K_EMUL_OP_IDLE_TIME = M68K_EMUL_BREAK + OP_IDLE_TIME; |
139 |
|
|
|
140 |
gbeauche |
1.2 |
extern "C" void EmulOp(M68kRegisters *r, uint32 pc, int selector); |
141 |
cebix |
1.1 |
|
142 |
|
|
#endif |