aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJohannes Stoelp <johannes.stoelp@gmail.com>2023-12-08 01:05:44 +0100
committerJohannes Stoelp <johannes.stoelp@gmail.com>2023-12-08 01:05:44 +0100
commit20744b382d4d0226037eab810f312accc28fbfe2 (patch)
tree7e6105482a2c9afa91cd0749d2e181ebc223d0cc
parent7fe96621631c9782479f67a228fca94112449cae (diff)
downloadjuicebox-asm-20744b382d4d0226037eab810f312accc28fbfe2.tar.gz
juicebox-asm-20744b382d4d0226037eab810f312accc28fbfe2.zip
tiny_vm: move cfg to jit compile function and enahce jit abi comment
-rw-r--r--examples/tiny_vm.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/examples/tiny_vm.rs b/examples/tiny_vm.rs
index bdeb202..992b684 100644
--- a/examples/tiny_vm.rs
+++ b/examples/tiny_vm.rs
@@ -36,9 +36,6 @@
//! }
//! ```
-#[cfg(not(any(target_arch = "x86_64", target_os = "linux")))]
-compile_error!("Only supported on x86_64 with SystemV abi");
-
use juicebox_asm::insn::*;
use juicebox_asm::Runtime;
use juicebox_asm::{Asm, Imm16, Imm64, Label, MemOp, Reg16, Reg64};
@@ -258,6 +255,7 @@ impl TinyVm {
}
}
+ #[cfg(all(any(target_arch = "x86_64", target_os = "linux")))]
/// Translate the bb at the current pc and return a JitFn pointer to it.
fn translate_next_bb(&mut self) -> JitFn {
let mut bb = Asm::new();
@@ -268,13 +266,15 @@ impl TinyVm {
pc = pc.wrapping_add(1);
- // JIT ABI.
+ // JIT abi: JitFn -> JitRet
+ //
+ // According to SystemV abi:
// enter
// rdi => regs
// rsi => dmem
// exit
- // rax => JitRet(0,
- // rdx => 1)
+ // rax => JitRet.0
+ // rdx => JitRet.1
// Generate memory operand into regs for guest register.
let reg_op = |r: TinyReg| {