From 9e21789b5295e93fe4f283cab5851c9c86a3a358 Mon Sep 17 00:00:00 2001 From: Alex Mikhalevich <2990126+alexmikhalevich@users.noreply.github.com> Date: Sun, 29 Oct 2023 19:22:25 -0300 Subject: [PATCH] fixup! feat: implement hypervisor extension --- src/machine.cpp | 2 +- src/test-machine-c-api.cpp | 2 +- src/tests/machine-bind.lua | 16 ++++++++-------- src/tests/mcycle-overflow.lua | 2 +- src/tests/util.lua | 2 +- src/uarch-solidity-compat.h | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/machine.cpp b/src/machine.cpp index de22c0f23..ddddbc9b1 100644 --- a/src/machine.cpp +++ b/src/machine.cpp @@ -2203,7 +2203,7 @@ bool machine::read_uarch_halt_flag(void) const { return m_uarch.read_halt_flag(); } -/// \brief Sets the value ofthe microarchitecture halt flag. +/// \brief Sets the value of the microarchitecture halt flag. void machine::set_uarch_halt_flag() { m_uarch.set_halt_flag(); } diff --git a/src/test-machine-c-api.cpp b/src/test-machine-c-api.cpp index fd836f890..db02e83ad 100644 --- a/src/test-machine-c-api.cpp +++ b/src/test-machine-c-api.cpp @@ -1942,7 +1942,7 @@ class access_log_machine_fixture : public incomplete_machine_fixture { uint32_t test_uarch_ram[] = { 0x07b00513, // li a0,123 - 0x32800293, // li t0, UARCH_HALT_FLAG_SHADDOW_ADDR_DEF (0x328) + 0x3C000293, // li t0, UARCH_HALT_FLAG_SHADDOW_ADDR_DEF (0x3C0) 0x00100313, // li t1,1 0x0062b023, // sd t1,0(t0) Halt microarchitecture at uarch cycle 4 }; diff --git a/src/tests/machine-bind.lua b/src/tests/machine-bind.lua index 02a3d26ae..33f3add2d 100755 --- a/src/tests/machine-bind.lua +++ b/src/tests/machine-bind.lua @@ -773,16 +773,16 @@ do_test("dumped log content should match", function() local output = p:read(2000) p:close() local expected_output = "begin step\n" - .. " 1: read uarch.cycle@0x320(800): 0x0(0)\n" - .. " 2: read uarch.halt_flag@0x328(808): 0x0(0)\n" - .. " 3: read uarch.pc@0x330(816): 0x70000000(1879048192)\n" - .. " 4: read memory@0x70000000(1879048192): 0x3280029307b00513(3638911329427784979)\n" + .. " 1: read uarch.cycle@0x3b8(952): 0x0(0)\n" + .. " 2: read uarch.halt_flag@0x3c0(960): 0x0(0)\n" + .. " 3: read uarch.pc@0x3c8(968): 0x70000000(1879048192)\n" + .. " 4: read memory@0x70000000(1879048192): 0x3c00029307b00513(4323458472788100371)\n" .. " begin addi\n" - .. " 5: read uarch.x@0x340(832): 0x0(0)\n" - .. " 6: write uarch.x@0x390(912): 0x0(0) -> 0x7b(123)\n" - .. " 7: write uarch.pc@0x330(816): 0x70000000(1879048192) -> 0x70000004(1879048196)\n" + .. " 5: read uarch.x@0x3d8(984): 0x0(0)\n" + .. " 6: write uarch.x@0x428(1064): 0x0(0) -> 0x7b(123)\n" + .. " 7: write uarch.pc@0x3c8(968): 0x70000000(1879048192) -> 0x70000004(1879048196)\n" .. " end addi\n" - .. " 8: write uarch.cycle@0x320(800): 0x0(0) -> 0x1(1)\n" + .. " 8: write uarch.cycle@0x3b8(952): 0x0(0) -> 0x1(1)\n" .. "end step\n" print("Output of dump log:") diff --git a/src/tests/mcycle-overflow.lua b/src/tests/mcycle-overflow.lua index b2ad1caea..776fb704d 100755 --- a/src/tests/mcycle-overflow.lua +++ b/src/tests/mcycle-overflow.lua @@ -94,7 +94,7 @@ for _, proofs in ipairs({ true, false }) do assert(machine:read_uarch_cycle() == MAX_UARCH_CYCLE) assert(#log.accesses == 1) assert(log.accesses[1].type == "read") - assert(log.accesses[1].address == 0x320) -- address of uarch_cycle in shadow + assert(log.accesses[1].address == 0x3b8) -- address of uarch_cycle in shadow assert(log.accesses[1].read == string.pack("J", MAX_UARCH_CYCLE)) assert((log.accesses[1].proof ~= nil) == proofs) end) diff --git a/src/tests/util.lua b/src/tests/util.lua index 53b834db7..123a31fb3 100644 --- a/src/tests/util.lua +++ b/src/tests/util.lua @@ -49,7 +49,7 @@ local ZERO_PAGE = string.rep("\x00", PAGE_SIZE) test_util.uarch_programs = { halt = { - 0x32800293, -- li t0, UARCH_HALT_FLAG_SHADDOW_ADDR_DEF (0x328) + 0x3C000293, -- li t0, UARCH_HALT_FLAG_SHADDOW_ADDR_DEF (0x3C0) 0x00100313, -- li t1,1 UARCH_MMIO_HALT_VALUE_DEF 0x0062b023, -- sd t1,0(t0) Halt uarch }, diff --git a/src/uarch-solidity-compat.h b/src/uarch-solidity-compat.h index 1d67e29be..eb145276b 100644 --- a/src/uarch-solidity-compat.h +++ b/src/uarch-solidity-compat.h @@ -39,7 +39,7 @@ using uint32 = uint32_t; using int64 = int64_t; using uint64 = uint64_t; -// Wrapperfunctions used to access data from the uarch state accessor +// Wrapper functions used to access data from the uarch state accessor template static inline uint64 readWord(UarchState &a, uint64 paddr) {