about summary refs log tree commit diff stats
path: root/linux/bootstrap/018jump_disp32.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-05-08 21:16:23 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-05-08 21:49:50 -0700
commitf9f419af71a89740448a54f765b89d20e5519d58 (patch)
tree562a7dc06c99b1676a24209613e38965025831e9 /linux/bootstrap/018jump_disp32.cc
parentdf68e6eddcdd4b7c595a5ae4c0cffd5df5a664db (diff)
downloadmu-f9f419af71a89740448a54f765b89d20e5519d58.tar.gz
support checking overflow flag everywhere
Diffstat (limited to 'linux/bootstrap/018jump_disp32.cc')
-rw-r--r--linux/bootstrap/018jump_disp32.cc24
1 files changed, 24 insertions, 0 deletions
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;
+}