| @@ -424,15 +424,15 @@ static inline void asm_modrm(int reg, Operand *op) · 423 unmodified lines |
| 424 | static void asm_opcode(TCCState *s1, int opcode) | 424 | static void asm_opcode(TCCState *s1, int opcode) |
| 425 | { | 425 | { |
| 426 | const ASMInstr *pa; | 426 | const ASMInstr *pa; |
| 427 | int i, modrm_index, reg, v, op1, is_short_jmp, has_seg_prefix; | 427 | int i, modrm_index, reg, v, op1, is_short_jmp, seg_prefix; |
| 428 | int nb_ops, s, ss; | 428 | int nb_ops, s, ss; |
| 429 | Operand ops[MAX_OPERANDS], *pop, seg_prefix; | 429 | Operand ops[MAX_OPERANDS], *pop; |
| 430 | int op_type[3]; /* decoded op type */ | 430 | int op_type[3]; /* decoded op type */ |
| 431 | | 431 | |
| 432 | /* get operands */ | 432 | /* get operands */ |
| 433 | pop = ops; | 433 | pop = ops; |
| 434 | nb_ops = 0; | 434 | nb_ops = 0; |
| 435 | has_seg_prefix = 0; | 435 | seg_prefix = 0; |
| 436 | for(;;) { | 436 | for(;;) { |
| 437 | if (tok == ';' || tok == TOK_LINEFEED) | 437 | if (tok == ';' || tok == TOK_LINEFEED) |
| 438 | break; | 438 | break; |
| @@ -441,11 +441,10 @@ static void asm_opcode(TCCState *s1, int opcode) · 2 unmodified lines |
| 441 | } | 441 | } |
| 442 | parse_operand(s1, pop); | 442 | parse_operand(s1, pop); |
| 443 | if (tok == ':') { | 443 | if (tok == ':') { |
| 444 | if (pop->type != OP_SEG || has_seg_prefix) { | 444 | if (pop->type != OP_SEG || seg_prefix) { |
| 445 | error("incorrect prefix"); | 445 | error("incorrect prefix"); |
| 446 | } | 446 | } |
| 447 | seg_prefix = *pop; | 447 | seg_prefix = segment_prefixes[pop->reg]; |
| 448 | has_seg_prefix = 1; | | |
| 449 | next(); | 448 | next(); |
| 450 | parse_operand(s1, pop); | 449 | parse_operand(s1, pop); |
| 451 | if (!(pop->type & OP_EA)) { | 450 | if (!(pop->type & OP_EA)) { |
| @@ -565,8 +564,8 @@ static void asm_opcode(TCCState *s1, int opcode) · 113 unmodified lines |
| 565 | /* now generates the operation */ | 564 | /* now generates the operation */ |
| 566 | if (pa->instr_type & OPC_FWAIT) | 565 | if (pa->instr_type & OPC_FWAIT) |
| 567 | g(0x9b); | 566 | g(0x9b); |
| 568 | if (has_seg_prefix) | 567 | if (seg_prefix) |
| 569 | g(segment_prefixes[seg_prefix.reg]); | 568 | g(seg_prefix); |
| 570 | | 569 | |
| 571 | v = pa->opcode; | 570 | v = pa->opcode; |
| 572 | if (v == 0x69 || v == 0x69) { | 571 | if (v == 0x69 || v == 0x69) { |