History

arm-asm: Add swi

Danny Milosavljevic committed 5 years ago

Commit c9e0c2a1 parent b4959592 files · +22 −0Browse files

Unified · Split

2 files
  1. arm-asm.c +21 −0
  2. arm-tok.h +1 −0
arm-asm.c+21−0
@@ -171,6 +171,25 @@ static void asm_nullary_opcode(int token) · 170 unmodified lines
171 }171 }
172}172}
173 173
174static void asm_unary_opcode(TCCState *s1, int token)
175{
176 Operand op;
177 parse_operand(s1, &op);
178
179 switch (ARM_INSTRUCTION_GROUP(token)) {
180 case TOK_ASM_swieq:
181 if (op.type != OP_IM8)
182 expect("immediate 8-bit unsigned integer");
183 else {
184 /* Note: Dummy operand (ignored by processor): ARM ref documented 0...255, ARM instruction set documented 24 bit */
185 asm_emit_opcode(token, (0xf << 24) | op.e.v);
186 }
187 break;
188 default:
189 expect("unary instruction");
190 }
191}
192
174static void asm_block_data_transfer_opcode(TCCState *s1, int token)193static void asm_block_data_transfer_opcode(TCCState *s1, int token)
175{194{
176 uint32_t opcode;195 uint32_t opcode;
@@ -247,6 +266,8 @@ ST_FUNC void asm_opcode(TCCState *s1, int token) · 70 unmodified lines
247 case TOK_ASM_wfeeq:266 case TOK_ASM_wfeeq:
248 case TOK_ASM_wfieq:267 case TOK_ASM_wfieq:
249 return asm_nullary_opcode(token);268 return asm_nullary_opcode(token);
269 case TOK_ASM_swieq:
270 return asm_unary_opcode(s1, token);
250 default:271 default:
251 expect("known instruction");272 expect("known instruction");
252 }273 }
arm-tok.h+1−0
@@ -54,6 +54,7 @@ · 53 unmodified lines
54 DEF_ASM_CONDED(nop)54 DEF_ASM_CONDED(nop)
55 DEF_ASM_CONDED(wfe)55 DEF_ASM_CONDED(wfe)
56 DEF_ASM_CONDED(wfi)56 DEF_ASM_CONDED(wfi)
57 DEF_ASM_CONDED(swi)
57 58
58 /* instruction macros */59 /* instruction macros */
59 60

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t