-
Notifications
You must be signed in to change notification settings - Fork 15
/
ggx-09-src.patch
131 lines (126 loc) · 3.7 KB
/
ggx-09-src.patch
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
diff -r 83ab05171362 gas/ChangeLog.ggx
--- a/gas/ChangeLog.ggx Wed Mar 12 17:25:07 2008 -0700
+++ b/gas/ChangeLog.ggx Thu Mar 13 04:04:49 2008 -0700
@@ -1,3 +1,8 @@ 2008-03-11 Anthony Green <green@spinda
+2008-02-20 Anthony Green <[email protected]>
+
+ * config/tc-ggx.c (parse_register_operand): New function.
+ (md_assemble): Use it. Also parse GGX_F1_AB instructions.
+
2008-03-11 Anthony Green <[email protected]>
* config/tc-ggx.c (md_assemble): Encode different forms of
diff -r 83ab05171362 gas/config/tc-ggx.c
--- a/gas/config/tc-ggx.c Wed Mar 12 17:25:07 2008 -0700
+++ b/gas/config/tc-ggx.c Thu Mar 13 04:04:49 2008 -0700
@@ -81,6 +81,31 @@ parse_exp_save_ilp (char *s, expressionS
s = input_line_pointer;
input_line_pointer = save;
return s;
+}
+
+static int
+parse_register_operand (char **ptr)
+{
+ int reg;
+ char *s = *ptr;
+
+ if ((*s != '$') || (*(s+1) != 'r'))
+ {
+ as_bad ("expecting register");
+ ignore_rest_of_line ();
+ return -1;
+ }
+ reg = s[2] - '0';
+ if ((reg < 1) || (reg > 7))
+ {
+ as_bad ("illegal register number");
+ ignore_rest_of_line ();
+ return -1;
+ }
+
+ *ptr += 3;
+
+ return reg;
}
/* This is the guts of the machine-dependent assembler. STR points to
@@ -143,6 +168,21 @@ md_assemble (char *str)
break;
case GGX_F1_AB:
iword = opcode->opcode << 9;
+ while (ISSPACE (*op_end))
+ op_end++;
+ {
+ int dest, src;
+ dest = parse_register_operand (&op_end);
+ if (*op_end != ',')
+ as_warn ("expecting comma delimeted register operands");
+ op_end++;
+ src = parse_register_operand (&op_end);
+ iword += (dest << 6) + (src << 3);
+ while (ISSPACE (*op_end))
+ op_end++;
+ if (*op_end != 0)
+ as_warn ("extra stuff on line ignored");
+ }
break;
case GGX_F1_ABC:
iword = opcode->opcode << 9;
@@ -156,21 +196,7 @@ md_assemble (char *str)
char *where;
int regnum;
- if ((*op_end != '$') || (*(op_end+1) != 'r'))
- {
- as_bad ("expecting register");
- ignore_rest_of_line ();
- return;
- }
- regnum = op_end[2] - '0';
- if ((regnum < 1) || (regnum > 7))
- {
- as_bad ("illegal register number");
- ignore_rest_of_line ();
- return;
- }
-
- op_end += 3;
+ regnum = parse_register_operand (&op_end);
while (ISSPACE (*op_end))
op_end++;
diff -r 83ab05171362 opcodes/ChangeLog.ggx
--- a/opcodes/ChangeLog.ggx Wed Mar 12 17:25:07 2008 -0700
+++ b/opcodes/ChangeLog.ggx Thu Mar 13 04:04:49 2008 -0700
@@ -1,3 +1,9 @@ 2008-03-11 Anthony Green <green@spinda
+2008-03-11 Anthony Green <[email protected]>
+
+ * ggx-dis.c (print_insn_ggx): Add GGX_F1_AB support.
+ * ggx-opc.c (ggx_form1_opc_info): Add mov instruction.
+ Fix comment.
+
2008-03-11 Anthony Green <[email protected]>
* ggx-dis.c (OP_A, OP_B, OP_C): Define. Disassemble GGX_F1_A4
diff -r 83ab05171362 opcodes/ggx-dis.c
--- a/opcodes/ggx-dis.c Wed Mar 12 17:25:07 2008 -0700
+++ b/opcodes/ggx-dis.c Thu Mar 13 04:04:49 2008 -0700
@@ -60,6 +60,10 @@ print_insn_ggx (bfd_vma addr, struct dis
case GGX_F1_NARG:
fpr (stream, "%s", opcode->name);
break;
+ case GGX_F1_AB:
+ fpr (stream, "%s\t$r%d, $r%d", opcode->name,
+ OP_A(iword), OP_B(iword));
+ break;
case GGX_F1_A4:
{
unsigned imm;
diff -r 83ab05171362 opcodes/ggx-opc.c
--- a/opcodes/ggx-opc.c Wed Mar 12 17:25:07 2008 -0700
+++ b/opcodes/ggx-opc.c Thu Mar 13 04:04:49 2008 -0700
@@ -48,7 +48,7 @@ const ggx_opc_info_t ggx_form1_opc_info[
const ggx_opc_info_t ggx_form1_opc_info[64] =
{
{ 0x00, GGX_F1_A4, "ldi.l" },
- { 0x01, GGX_F1_NARG, "bad" },
+ { 0x01, GGX_F1_AB, "mov" },
{ 0x02, GGX_F1_NARG, "bad" },
{ 0x03, GGX_F1_NARG, "bad" },
{ 0x04, GGX_F1_NARG, "bad" },