diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-05-08 21:16:23 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-05-08 21:49:50 -0700 |
commit | f9f419af71a89740448a54f765b89d20e5519d58 (patch) | |
tree | 562a7dc06c99b1676a24209613e38965025831e9 /linux/bootstrap | |
parent | df68e6eddcdd4b7c595a5ae4c0cffd5df5a664db (diff) | |
download | mu-f9f419af71a89740448a54f765b89d20e5519d58.tar.gz |
support checking overflow flag everywhere
Diffstat (limited to 'linux/bootstrap')
-rw-r--r-- | linux/bootstrap/017jump_disp8.cc | 24 | ||||
-rw-r--r-- | linux/bootstrap/018jump_disp32.cc | 24 |
2 files changed, 48 insertions, 0 deletions
diff --git a/linux/bootstrap/017jump_disp8.cc b/linux/bootstrap/017jump_disp8.cc index 30e60a74..37df6d5b 100644 --- a/linux/bootstrap/017jump_disp8.cc +++ b/linux/bootstrap/017jump_disp8.cc @@ -405,3 +405,27 @@ void test_jle_disp8_greater() { ); CHECK_TRACE_DOESNT_CONTAIN("run: jump 5"); } + +//:: jump if overflow + +:(before "End Initialize Op Names") +put_new(Name, "70", "jump disp8 bytes away if OF is set (jcc/jo)"); +put_new(Name, "71", "jump disp8 bytes away if OF is unset (jcc/jno)"); + +:(before "End Single-Byte Opcodes") +case 0x70: { // jump disp8 if OF is set + const int8_t offset = static_cast<int>(next()); + if (OF) { + trace(Callstack_depth+1, "run") << "jump " << NUM(offset) << end(); + EIP += offset; + } + break; +} +case 0x71: { // jump disp8 if OF is unset + const int8_t offset = static_cast<int>(next()); + if (!OF) { + trace(Callstack_depth+1, "run") << "jump " << NUM(offset) << end(); + EIP += offset; + } + break; +} diff --git a/linux/bootstrap/018jump_disp32.cc b/linux/bootstrap/018jump_disp32.cc index e77bc584..75fb576a 100644 --- a/linux/bootstrap/018jump_disp32.cc +++ b/linux/bootstrap/018jump_disp32.cc @@ -405,3 +405,27 @@ void test_jle_disp32_greater() { ); CHECK_TRACE_DOESNT_CONTAIN("run: jump 5"); } + +//:: jump if overflow + +:(before "End Initialize Op Names") +put_new(Name_0f, "80", "jump disp32 bytes away if OF is set (jcc/jo)"); +put_new(Name_0f, "81", "jump disp32 bytes away if OF is unset (jcc/jno)"); + +:(before "End Two-Byte Opcodes Starting With 0f") +case 0x80: { // jump disp8 if OF is set + const int32_t offset = next32(); + if (OF) { + trace(Callstack_depth+1, "run") << "jump " << NUM(offset) << end(); + EIP += offset; + } + break; +} +case 0x81: { // jump disp8 if OF is unset + const int32_t offset = next32(); + if (!OF) { + trace(Callstack_depth+1, "run") << "jump " << NUM(offset) << end(); + EIP += offset; + } + break; +} |