History

Add endbr32 for i386

herman ten brugge committed 1 year ago

Commit 7657d871 parent 854d6c52 files · +9 −3Browse files

Unified · Split

2 files
  1. i386-asm.c +5 −2
  2. i386-asm.h +4 −1
i386-asm.c+5−2
@@ -1002,21 +1002,24 @@ again: · 1001 unmodified lines
1002 modrm_index = -1;1002 modrm_index = -1;
1003 modreg_index = -1;1003 modreg_index = -1;
1004 if (pa->instr_type & OPC_MODRM) {1004 if (pa->instr_type & OPC_MODRM) {
1005#ifdef TCC_TARGET_X86_64
1006 if (!nb_ops) {1005 if (!nb_ops) {
1007 /* A modrm opcode without operands is a special case (e.g. mfence).1006 /* A modrm opcode without operands is a special case (e.g. mfence).
1008 It has a group and acts as if there's an register operand 0 */1007 It has a group and acts as if there's an register operand 0 */
1009 i = 0;1008 i = 0;
1010 ops[i].type = OP_REG;1009 ops[i].type = OP_REG;
1010#ifdef TCC_TARGET_X86_64
1011 if (pa->sym == TOK_ASM_endbr64)1011 if (pa->sym == TOK_ASM_endbr64)
1012 ops[i].reg = 2; // dx1012 ops[i].reg = 2; // dx
1013 else if (pa->sym >= TOK_ASM_lfence && pa->sym <= TOK_ASM_sfence)1013 else if (pa->sym >= TOK_ASM_lfence && pa->sym <= TOK_ASM_sfence)
1014 ops[i].reg = 0; // ax1014 ops[i].reg = 0; // ax
1015#else
1016 if (pa->sym == TOK_ASM_endbr32)
1017 ops[i].reg = 3; // bx
1018#endif
1015 else1019 else
1016 tcc_error("bad MODR/M opcode without operands");1020 tcc_error("bad MODR/M opcode without operands");
1017 goto modrm_found;1021 goto modrm_found;
1018 }1022 }
1019#endif
1020 /* first look for an ea operand */1023 /* first look for an ea operand */
1021 for(i = 0;i < nb_ops; i++) {1024 for(i = 0;i < nb_ops; i++) {
1022 if (op_type[i] & OP_EA)1025 if (op_type[i] & OP_EA)
i386-asm.h+4−1
@@ -37,7 +37,10 @@ · 36 unmodified lines
37 DEF_ASM_OP0(pause, 0xf390)37 DEF_ASM_OP0(pause, 0xf390)
38 DEF_ASM_OP0(xlat, 0xd7)38 DEF_ASM_OP0(xlat, 0xd7)
39 39
40 /* strings */40 /* Control-Flow Enforcement */
41 DEF_ASM_OP0L(endbr32, 0xf30f1e, 7, OPC_MODRM)
42
43 /* strings */
41ALT(DEF_ASM_OP0L(cmpsb, 0xa6, 0, OPC_BWLX))44ALT(DEF_ASM_OP0L(cmpsb, 0xa6, 0, OPC_BWLX))
42ALT(DEF_ASM_OP0L(scmpb, 0xa6, 0, OPC_BWLX))45ALT(DEF_ASM_OP0L(scmpb, 0xa6, 0, OPC_BWLX))
43 46

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