forked from ArchC/sparc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsparc_gdb_funcs.cpp
70 lines (57 loc) · 1.52 KB
/
sparc_gdb_funcs.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/**
* @file sparc_gdb_funcs.cpp
* @author Sandro Rigo
* Marcus Bartholomeu
*
* The ArchC Team
* http://www.archc.org/
*
* Computer Systems Laboratory (LSC)
* IC-UNICAMP
* http://www.lsc.ic.unicamp.br
*
* @version 1.0
* @date Mon, 19 Jun 2006 15:50:50 -0300
*
* @brief The ArchC SPARC-V8 functional model.
*
* @attention Copyright (C) 2002-2006 --- The ArchC Team
*
*/
#include "sparc.H"
using namespace sparc_parms;
int sparc::nRegs(void) {
return 72;
}
ac_word sparc::reg_read( int reg ) {
/* General Purpose: G, O, L, I */
if ( ( reg >= 0 ) && ( reg < 32 ) ) {
return REGS[reg];
}
/* Y, PSR, WIM, PC, NPC */
else if ( reg == 64 ) return Y;
else if ( reg == 65 ) return PSR;
else if ( reg == 66 ) return WIM;
else if ( reg == 68 ) return ac_pc;
else if ( reg == 69 ) return npc;
/* Floating point, TBR, FPSR, CPSR */
return 0;
}
void sparc::reg_write( int reg, ac_word value ) {
/* General Purpose: G, O, L & I regs */
if ( ( reg >= 0 ) && ( reg < 32 ) ) {
REGS[reg] = value;
}
/* Y, PSR, WIM, PC, NPC */
else if ( reg == 64 ) Y = value;
else if ( reg == 65 ) PSR = value;
else if ( reg == 66 ) WIM = value;
else if ( reg == 68 ) ac_pc = value;
else if ( reg == 69 ) npc = value;
}
unsigned char sparc::mem_read( unsigned int address ) {
return IM->read_byte( address );
}
void sparc::mem_write( unsigned int address, unsigned char byte ) {
IM->write_byte( address, byte );
}