Commit | Line | Data |
---|---|---|
ef79bbde P |
1 | /* |
2 | * ppc definitions v0.5.1 | |
3 | * Authors: linuzappz <linuzappz@pcsx.net> | |
4 | * alexey silinov | |
5 | */ | |
6 | ||
7 | #ifndef __PPC_H__ | |
8 | #define __PPC_H__ | |
9 | ||
10 | #ifdef __cplusplus | |
11 | extern "C" { | |
12 | #endif | |
13 | ||
14 | // include basic types | |
15 | #include "../psxcommon.h" | |
16 | #include "ppc_mnemonics.h" | |
17 | ||
18 | #define NUM_HW_REGISTERS 29 | |
19 | ||
20 | /* general defines */ | |
21 | #define write8(val) *(u8 *)ppcPtr = val; ppcPtr++; | |
22 | #define write16(val) *(u16*)ppcPtr = val; ppcPtr+=2; | |
23 | #define write32(val) *(u32*)ppcPtr = val; ppcPtr+=4; | |
24 | #define write64(val) *(u64*)ppcPtr = val; ppcPtr+=8; | |
25 | ||
26 | #define CALLFunc(FUNC) \ | |
27 | { \ | |
28 | u32 _func = (FUNC); \ | |
29 | ReleaseArgs(); \ | |
30 | if ((_func & 0x1fffffc) == _func) { \ | |
31 | BLA(_func); \ | |
32 | } else { \ | |
33 | LIW(0, _func); \ | |
34 | MTCTR(0); \ | |
35 | BCTRL(); \ | |
36 | } \ | |
37 | } | |
38 | ||
39 | extern int cpuHWRegisters[NUM_HW_REGISTERS]; | |
40 | ||
41 | extern u32 *ppcPtr; | |
42 | extern u8 *j8Ptr[32]; | |
43 | extern u32 *j32Ptr[32]; | |
44 | ||
45 | void ppcInit(); | |
46 | void ppcSetPtr(u32 *ptr); | |
47 | void ppcShutdown(); | |
48 | ||
49 | void ppcAlign(int bytes); | |
50 | void returnPC(); | |
51 | void recRun(void (*func)(), u32 hw1, u32 hw2); | |
52 | u8 dynMemRead8(u32 mem); | |
53 | u16 dynMemRead16(u32 mem); | |
54 | u32 dynMemRead32(u32 mem); | |
55 | void dynMemWrite32(u32 mem, u32 val); | |
56 | ||
57 | #ifdef __cplusplus | |
58 | } | |
59 | #endif | |
60 | #endif |