PDA

View Full Version : [Reading Source Code]Who can help me ?


Jedimaster
May 29th, 2004, 00:17
In the R3000A.h file, the following codes

typedef union {
struct {
unsigned long r0, at, v0, v1, a0, a1, a2, a3,
t0, t1, t2, t3, t4, t5, t6, t7,
s0, s1, s2, s3, s4, s5, s6, s7,
t8, t9, k0, k1, gp, sp, s8, ra, lo, hi;
} n;
unsigned long r[34]; /* Lo, Hi in r[33] and r[34] */
} GPRRegs;

typedef union {
struct {
unsigned long Index, Random, EntryLo0, EntryLo1,
Context, PageMask, Wired, Reserved0,
BadVAddr, Count, EntryHi, Compare,
Status, Cause, EPC, PRid,
Config, LLAddr, WatchLO, WatchHI,
XContext, Reserved1, Reserved2, Reserved3,
Reserved4, Reserved5, ECC, CacheErr,
TagLo, TagHi, ErrorEPC, Reserved6;
} n;
unsigned long r[32];
} CP0Regs;


What's the meaning of GPRRegs & CP0Regs ?

_E_
May 29th, 2004, 00:40
GPRRegs and CP0Regs are the union names, C unions are variable type that can contain many different variables such as structs, but only actually holds one of them at a time

Yours,
-Elly

Jedimaster
May 29th, 2004, 15:40
My Meaning IS:

What are they used for ? Which objects are they defined ?

zenogais
May 29th, 2004, 19:21
This code defines the Playstations R3000A CPU Registers. A union is used to assign one chunk of memory many different names. They're are useful in many places in low level emulation.

GPRRegs = General Purpose Registers
CP0Regs = Coprocessor 0 Registers

Jedimaster
May 30th, 2004, 02:05
O~~

Thanks very much, that's I wanted1

谢谢