mirror of
https://github.com/yasm/yasm
synced 2026-08-26 22:26:05 -04:00
Fix #122: Allow standalone prefixes.
Implementation copied from gas parser. svn path=/trunk/yasm/; revision=2021
This commit is contained in:
parent
4606b9506a
commit
de93025047
4 changed files with 19 additions and 4 deletions
|
|
@ -658,8 +658,9 @@ parse_instr(yasm_parser_nasm *parser_nasm)
|
|||
uintptr_t prefix = PREFIX_val;
|
||||
get_next_token();
|
||||
bc = parse_instr(parser_nasm);
|
||||
if (bc)
|
||||
yasm_insn_add_prefix(yasm_bc_get_insn(bc), prefix);
|
||||
if (!bc)
|
||||
bc = yasm_arch_create_empty_insn(p_object->arch, cur_line);
|
||||
yasm_insn_add_prefix(yasm_bc_get_insn(bc), prefix);
|
||||
return bc;
|
||||
}
|
||||
case SEGREG:
|
||||
|
|
@ -667,8 +668,9 @@ parse_instr(yasm_parser_nasm *parser_nasm)
|
|||
uintptr_t segreg = SEGREG_val;
|
||||
get_next_token();
|
||||
bc = parse_instr(parser_nasm);
|
||||
if (bc)
|
||||
yasm_insn_add_seg_prefix(yasm_bc_get_insn(bc), segreg);
|
||||
if (!bc)
|
||||
bc = yasm_arch_create_empty_insn(p_object->arch, cur_line);
|
||||
yasm_insn_add_seg_prefix(yasm_bc_get_insn(bc), segreg);
|
||||
return bc;
|
||||
}
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ EXTRA_DIST += modules/parsers/nasm/tests/hexconst.asm
|
|||
EXTRA_DIST += modules/parsers/nasm/tests/hexconst.hex
|
||||
EXTRA_DIST += modules/parsers/nasm/tests/long.asm
|
||||
EXTRA_DIST += modules/parsers/nasm/tests/long.hex
|
||||
EXTRA_DIST += modules/parsers/nasm/tests/nasm-prefix.asm
|
||||
EXTRA_DIST += modules/parsers/nasm/tests/nasm-prefix.hex
|
||||
EXTRA_DIST += modules/parsers/nasm/tests/newsect.asm
|
||||
EXTRA_DIST += modules/parsers/nasm/tests/newsect.hex
|
||||
EXTRA_DIST += modules/parsers/nasm/tests/orphannowarn.asm
|
||||
|
|
|
|||
5
modules/parsers/nasm/tests/nasm-prefix.asm
Normal file
5
modules/parsers/nasm/tests/nasm-prefix.asm
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
es
|
||||
mov ax, [bx]
|
||||
|
||||
a32
|
||||
mov ax, [bx]
|
||||
6
modules/parsers/nasm/tests/nasm-prefix.hex
Normal file
6
modules/parsers/nasm/tests/nasm-prefix.hex
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
26
|
||||
8b
|
||||
07
|
||||
67
|
||||
8b
|
||||
07
|
||||
Loading…
Add table
Add a link
Reference in a new issue