diff options
Diffstat (limited to 'subx')
-rw-r--r-- | subx/022check_instruction.cc | 16 | ||||
-rw-r--r-- | subx/024pack_instructions.cc | 24 | ||||
-rw-r--r-- | subx/ex1.1.subx | 12 |
3 files changed, 26 insertions, 26 deletions
diff --git a/subx/022check_instruction.cc b/subx/022check_instruction.cc index cad19bfe..19a7bece 100644 --- a/subx/022check_instruction.cc +++ b/subx/022check_instruction.cc @@ -55,10 +55,10 @@ cerr << " instructions\n"; :(scenario check_missing_imm8_operand) % Hide_errors = true; == 0x1 -# opcode ModR/M SIB displacement immediate -# instruction mod, reg, Reg/Mem bits scale, index, base -# 1-3 bytes 0/1 byte 0/1 byte 0/1/2/4 bytes 0/1/2/4 bytes - cd # int ?? +# instruction effective address operand displacement immediate +# op subop mod rm32 base index scale r32 +# 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes + cd # int ?? +error: 'cd' (software interrupt): missing imm8 operand :(before "End One-time Setup") @@ -525,10 +525,10 @@ void check_operands_f3(const line& /*unused*/) { :(scenario check_missing_disp16_operand) % Hide_errors = true; == 0x1 -# opcode ModR/M SIB displacement immediate -# instruction mod, reg, Reg/Mem bits scale, index, base -# 1-3 bytes 0/1 byte 0/1 byte 0/1/2/4 bytes 0/1/2/4 bytes - 0f 84 # jmp if ZF to ?? +# instruction effective address operand displacement immediate +# op subop mod rm32 base index scale r32 +# 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes + 0f 84 # jmp if ZF to ?? +error: '0f 84' (jump disp16 bytes away if ZF is set): missing disp16 operand :(before "End Globals") diff --git a/subx/024pack_instructions.cc b/subx/024pack_instructions.cc index bb63cb00..0ff5050d 100644 --- a/subx/024pack_instructions.cc +++ b/subx/024pack_instructions.cc @@ -3,10 +3,10 @@ :(scenario pack_immediate_constants) == 0x1 -# instruction effective address operand displacement immediate -# op subop mod rm32 base index scale r32 -# 1-3 bytes 0/1/2/4 bytes 0/1/2/4 bytes - bb 42/imm32 # copy 42 to EBX +# instruction effective address operand displacement immediate +# op subop mod rm32 base index scale r32 +# 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes + bb 42/imm32 # copy 42 to EBX +translate: packing instruction 'bb 42/imm32' +translate: instruction after packing: 'bb 2a 00 00 00' +run: copy imm32 0x0000002a to EBX @@ -28,10 +28,10 @@ :(scenario pack_modrm_imm32) == 0x1 -# instruction effective address operand displacement immediate -# op subop mod rm32 base index scale r32 -# 1-3 bytes 0/1/2/4 bytes 0/1/2/4 bytes - 81 0/add/subop 3/mod/direct 3/ebx/rm32 1/imm32 # add 1 to EBX +# instruction effective address operand displacement immediate +# op subop mod rm32 base index scale r32 +# 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes + 81 0/add/subop 3/mod/direct 3/ebx/rm32 1/imm32 # add 1 to EBX +translate: packing instruction '81 0/add/subop 3/mod/direct 3/ebx/rm32 1/imm32' +translate: instruction after packing: '81 c3 01 00 00 00' @@ -180,10 +180,10 @@ void transform(const string& text_bytes) { :(scenario pack_immediate_constants_hex) == 0x1 -# instruction effective address operand displacement immediate -# op subop mod rm32 base index scale r32 -# 1-3 bytes 0/1/2/4 bytes 0/1/2/4 bytes - bb 0x2a/imm32 # copy 42 to EBX +# instruction effective address operand displacement immediate +# op subop mod rm32 base index scale r32 +# 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes + bb 0x2a/imm32 # copy 42 to EBX +translate: packing instruction 'bb 0x2a/imm32' +translate: instruction after packing: 'bb 2a 00 00 00' +run: copy imm32 0x0000002a to EBX diff --git a/subx/ex1.1.subx b/subx/ex1.1.subx index 51152f47..7dbcf8af 100644 --- a/subx/ex1.1.subx +++ b/subx/ex1.1.subx @@ -6,12 +6,12 @@ # $ subx run ex1 == 0x08048054 # code segment, after leaving room for ELF header -# instruction effective address operand displacement immediate -# op subop mod rm32 base index scale r32 -# 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes - bb 2a 00 00 00 # copy 0x2a (42) to EBX +# opcode ModR/M SIB displacement immediate +# instruction mod, reg, Reg/Mem bits scale, index, base +# 1-3 bytes 0/1 byte 0/1 byte 0/1/2/4 bytes 0/1/2/4 bytes + bb 2a 00 00 00 # copy 0x2a (42) to EBX # exit(EBX) - b8 01 00 00 00 # copy 1 to EAX - cd 80 # int 80h + b8 01 00 00 00 # copy 1 to EAX + cd 80 # int 80h # vim:ft=subx |