From b8f4c13ba24da51357f1010c10955f587181326f Mon Sep 17 00:00:00 2001 From: minjaesong Date: Tue, 8 Dec 2020 17:35:09 +0900 Subject: [PATCH] added do-nothing function --- src/net/torvald/tsvm/VMJSR223Delegate.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/net/torvald/tsvm/VMJSR223Delegate.kt b/src/net/torvald/tsvm/VMJSR223Delegate.kt index 90671c9..6630923 100644 --- a/src/net/torvald/tsvm/VMJSR223Delegate.kt +++ b/src/net/torvald/tsvm/VMJSR223Delegate.kt @@ -109,6 +109,16 @@ class VMJSR223Delegate(val vm: VM) { return sb.toString() } + fun spin() { + Thread.sleep(4L); + } + + fun waitForMemChg(addr: Int, andMask: Int, xorMask: Int) { + while ((peek(addr) xor xorMask) and andMask == 0) { + spin(); + } + } + fun waitForMemChg(addr: Int, andMask: Int) = waitForMemChg(addr, andMask, 0) }