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 |
|
|
NATIVE_OP_MAX |
56 |
|
|
}; |
57 |
|
|
#define POWERPC_NATIVE_OP_FUNC(SELECTOR) ((uint32)(uintptr)&NativeOpTable[SELECTOR]) |
58 |
|
|
extern const uint32 NativeOpTable[NATIVE_OP_MAX]; |
59 |
|
|
|
60 |
cebix |
1.1 |
// 68k opcodes |
61 |
|
|
const uint16 M68K_ILLEGAL = 0x4afc; |
62 |
|
|
const uint16 M68K_NOP = 0x4e71; |
63 |
|
|
const uint16 M68K_RTS = 0x4e75; |
64 |
|
|
const uint16 M68K_RTD = 0x4e74; |
65 |
|
|
const uint16 M68K_JMP = 0x4ef9; |
66 |
|
|
const uint16 M68K_JMP_A0 = 0x4ed0; |
67 |
|
|
const uint16 M68K_JSR = 0x4eb9; |
68 |
|
|
const uint16 M68K_JSR_A0 = 0x4e90; |
69 |
|
|
enum { // Selectors for EMUL_OP opcodes |
70 |
|
|
OP_BREAK, OP_XPRAM1, OP_XPRAM2, OP_XPRAM3, OP_NVRAM1, OP_NVRAM2, OP_NVRAM3, |
71 |
|
|
OP_FIX_MEMTOP, OP_FIX_MEMSIZE, OP_FIX_BOOTSTACK, |
72 |
|
|
OP_SONY_OPEN, OP_SONY_PRIME, OP_SONY_CONTROL, OP_SONY_STATUS, |
73 |
|
|
OP_DISK_OPEN, OP_DISK_PRIME, OP_DISK_CONTROL, OP_DISK_STATUS, |
74 |
|
|
OP_CDROM_OPEN, OP_CDROM_PRIME, OP_CDROM_CONTROL, OP_CDROM_STATUS, |
75 |
|
|
OP_AUDIO_DISPATCH, OP_SOUNDIN_OPEN, OP_SOUNDIN_PRIME, OP_SOUNDIN_CONTROL, OP_SOUNDIN_STATUS, OP_SOUNDIN_CLOSE, |
76 |
|
|
OP_ADBOP, OP_INSTIME, OP_RMVTIME, OP_PRIMETIME, OP_MICROSECONDS, OP_PUT_SCRAP, OP_GET_SCRAP, |
77 |
|
|
OP_DEBUG_STR, OP_INSTALL_DRIVERS, OP_NAME_REGISTRY, OP_RESET, OP_IRQ, |
78 |
|
|
OP_SCSI_DISPATCH, OP_SCSI_ATOMIC, |
79 |
|
|
OP_NTRB_17_PATCH, OP_NTRB_17_PATCH2, OP_NTRB_17_PATCH3, OP_CHECKLOAD, |
80 |
|
|
OP_EXTFS_COMM, OP_EXTFS_HFS, OP_IDLE_TIME, |
81 |
|
|
OP_MAX |
82 |
|
|
}; |
83 |
|
|
const uint16 M68K_EMUL_RETURN = 0xfe40; // Extended opcodes |
84 |
|
|
const uint16 M68K_EXEC_RETURN = 0xfe41; |
85 |
gbeauche |
1.3 |
const uint16 M68K_EXEC_NATIVE = 0xfe42; |
86 |
|
|
const uint16 M68K_EMUL_BREAK = 0xfe43; |
87 |
cebix |
1.1 |
const uint16 M68K_EMUL_OP_XPRAM1 = M68K_EMUL_BREAK + OP_XPRAM1; |
88 |
|
|
const uint16 M68K_EMUL_OP_XPRAM2 = M68K_EMUL_BREAK + OP_XPRAM2; |
89 |
|
|
const uint16 M68K_EMUL_OP_XPRAM3 = M68K_EMUL_BREAK + OP_XPRAM3; |
90 |
|
|
const uint16 M68K_EMUL_OP_NVRAM1 = M68K_EMUL_BREAK + OP_NVRAM1; |
91 |
|
|
const uint16 M68K_EMUL_OP_NVRAM2 = M68K_EMUL_BREAK + OP_NVRAM2; |
92 |
|
|
const uint16 M68K_EMUL_OP_NVRAM3 = M68K_EMUL_BREAK + OP_NVRAM3; |
93 |
|
|
const uint16 M68K_EMUL_OP_FIX_MEMTOP = M68K_EMUL_BREAK + OP_FIX_MEMTOP; |
94 |
|
|
const uint16 M68K_EMUL_OP_FIX_MEMSIZE = M68K_EMUL_BREAK + OP_FIX_MEMSIZE; |
95 |
|
|
const uint16 M68K_EMUL_OP_FIX_BOOTSTACK = M68K_EMUL_BREAK + OP_FIX_BOOTSTACK; |
96 |
|
|
const uint16 M68K_EMUL_OP_SONY_OPEN = M68K_EMUL_BREAK + OP_SONY_OPEN; |
97 |
|
|
const uint16 M68K_EMUL_OP_SONY_PRIME = M68K_EMUL_BREAK + OP_SONY_PRIME; |
98 |
|
|
const uint16 M68K_EMUL_OP_SONY_CONTROL = M68K_EMUL_BREAK + OP_SONY_CONTROL; |
99 |
|
|
const uint16 M68K_EMUL_OP_SONY_STATUS = M68K_EMUL_BREAK + OP_SONY_STATUS; |
100 |
|
|
const uint16 M68K_EMUL_OP_DISK_OPEN = M68K_EMUL_BREAK + OP_DISK_OPEN; |
101 |
|
|
const uint16 M68K_EMUL_OP_DISK_PRIME = M68K_EMUL_BREAK + OP_DISK_PRIME; |
102 |
|
|
const uint16 M68K_EMUL_OP_DISK_CONTROL = M68K_EMUL_BREAK + OP_DISK_CONTROL; |
103 |
|
|
const uint16 M68K_EMUL_OP_DISK_STATUS = M68K_EMUL_BREAK + OP_DISK_STATUS; |
104 |
|
|
const uint16 M68K_EMUL_OP_CDROM_OPEN = M68K_EMUL_BREAK + OP_CDROM_OPEN; |
105 |
|
|
const uint16 M68K_EMUL_OP_CDROM_PRIME = M68K_EMUL_BREAK + OP_CDROM_PRIME; |
106 |
|
|
const uint16 M68K_EMUL_OP_CDROM_CONTROL = M68K_EMUL_BREAK + OP_CDROM_CONTROL; |
107 |
|
|
const uint16 M68K_EMUL_OP_CDROM_STATUS = M68K_EMUL_BREAK + OP_CDROM_STATUS; |
108 |
|
|
const uint16 M68K_EMUL_OP_AUDIO_DISPATCH = M68K_EMUL_BREAK + OP_AUDIO_DISPATCH; |
109 |
|
|
const uint16 M68K_EMUL_OP_SOUNDIN_OPEN = M68K_EMUL_BREAK + OP_SOUNDIN_OPEN; |
110 |
|
|
const uint16 M68K_EMUL_OP_SOUNDIN_CLOSE = M68K_EMUL_BREAK + OP_SOUNDIN_CLOSE; |
111 |
|
|
const uint16 M68K_EMUL_OP_SOUNDIN_PRIME = M68K_EMUL_BREAK + OP_SOUNDIN_PRIME; |
112 |
|
|
const uint16 M68K_EMUL_OP_SOUNDIN_CONTROL = M68K_EMUL_BREAK + OP_SOUNDIN_CONTROL; |
113 |
|
|
const uint16 M68K_EMUL_OP_SOUNDIN_STATUS = M68K_EMUL_BREAK + OP_SOUNDIN_STATUS; |
114 |
|
|
const uint16 M68K_EMUL_OP_ADBOP = M68K_EMUL_BREAK + OP_ADBOP; |
115 |
|
|
const uint16 M68K_EMUL_OP_INSTIME = M68K_EMUL_BREAK + OP_INSTIME; |
116 |
|
|
const uint16 M68K_EMUL_OP_RMVTIME = M68K_EMUL_BREAK + OP_RMVTIME; |
117 |
|
|
const uint16 M68K_EMUL_OP_PRIMETIME = M68K_EMUL_BREAK + OP_PRIMETIME; |
118 |
|
|
const uint16 M68K_EMUL_OP_MICROSECONDS = M68K_EMUL_BREAK + OP_MICROSECONDS; |
119 |
|
|
const uint16 M68K_EMUL_OP_PUT_SCRAP = M68K_EMUL_BREAK + OP_PUT_SCRAP; |
120 |
|
|
const uint16 M68K_EMUL_OP_GET_SCRAP = M68K_EMUL_BREAK + OP_GET_SCRAP; |
121 |
|
|
const uint16 M68K_EMUL_OP_DEBUG_STR = M68K_EMUL_BREAK + OP_DEBUG_STR; |
122 |
|
|
const uint16 M68K_EMUL_OP_INSTALL_DRIVERS = M68K_EMUL_BREAK + OP_INSTALL_DRIVERS; |
123 |
|
|
const uint16 M68K_EMUL_OP_NAME_REGISTRY = M68K_EMUL_BREAK + OP_NAME_REGISTRY; |
124 |
|
|
const uint16 M68K_EMUL_OP_RESET = M68K_EMUL_BREAK + OP_RESET; |
125 |
|
|
const uint16 M68K_EMUL_OP_IRQ = M68K_EMUL_BREAK + OP_IRQ; |
126 |
|
|
const uint16 M68K_EMUL_OP_SCSI_DISPATCH = M68K_EMUL_BREAK + OP_SCSI_DISPATCH; |
127 |
|
|
const uint16 M68K_EMUL_OP_SCSI_ATOMIC = M68K_EMUL_BREAK + OP_SCSI_ATOMIC; |
128 |
|
|
const uint16 M68K_EMUL_OP_NTRB_17_PATCH = M68K_EMUL_BREAK + OP_NTRB_17_PATCH; |
129 |
|
|
const uint16 M68K_EMUL_OP_NTRB_17_PATCH2 = M68K_EMUL_BREAK + OP_NTRB_17_PATCH2; |
130 |
|
|
const uint16 M68K_EMUL_OP_NTRB_17_PATCH3 = M68K_EMUL_BREAK + OP_NTRB_17_PATCH3; |
131 |
|
|
const uint16 M68K_EMUL_OP_CHECKLOAD = M68K_EMUL_BREAK + OP_CHECKLOAD; |
132 |
|
|
const uint16 M68K_EMUL_OP_EXTFS_COMM = M68K_EMUL_BREAK + OP_EXTFS_COMM; |
133 |
|
|
const uint16 M68K_EMUL_OP_EXTFS_HFS = M68K_EMUL_BREAK + OP_EXTFS_HFS; |
134 |
|
|
const uint16 M68K_EMUL_OP_IDLE_TIME = M68K_EMUL_BREAK + OP_IDLE_TIME; |
135 |
|
|
|
136 |
gbeauche |
1.2 |
extern "C" void EmulOp(M68kRegisters *r, uint32 pc, int selector); |
137 |
cebix |
1.1 |
|
138 |
|
|
#endif |