diff --git a/p/riscv_test.h b/p/riscv_test.h
index a8c50c7a5..49054033c 100644
--- a/p/riscv_test.h
+++ b/p/riscv_test.h
@@ -1,9 +1,11 @@
 // See LICENSE for license details.
+// clang-format off
 
 #ifndef _ENV_PHYSICAL_SINGLE_CORE_H
 #define _ENV_PHYSICAL_SINGLE_CORE_H
 
-#include "../encoding.h"
+#include "encoding.h"
+#include "ibex_macros.h"
 
 //-----------------------------------------------------------------------
 // Begin Macro
@@ -153,21 +155,19 @@
 #define EXTRA_TVEC_MACHINE
 #define EXTRA_INIT
 #define EXTRA_INIT_TIMER
-#define FILTER_TRAP
-#define FILTER_PAGE_FAULT
 
 #define INTERRUPT_HANDLER j other_exception /* No interrupts should occur */
 
 #define RVTEST_CODE_BEGIN                                               \
         .section .text.init;                                            \
-        .align  6;                                                      \
+        .org 0x80;                                                      \
         .weak stvec_handler;                                            \
         .weak mtvec_handler;                                            \
         .globl _start;                                                  \
 _start:                                                                 \
         /* reset vector */                                              \
         j reset_vector;                                                 \
-        .align 2;                                                       \
+        .balign 256;                                                    \
 trap_vector:                                                            \
         /* test whether the test came from pass/fail */                 \
         csrr t5, mcause;                                                \
@@ -192,14 +192,13 @@ handle_exception:                                                       \
   1:    ori TESTNUM, TESTNUM, 1337;                                     \
   write_tohost:                                                         \
         sw TESTNUM, tohost, t5;                                         \
-        sw zero, tohost + 4, t5;                                        \
         j write_tohost;                                                 \
 reset_vector:                                                           \
         INIT_XREG;                                                      \
         RISCV_MULTICORE_DISABLE;                                        \
-        INIT_SATP;                                                      \
+      /*INIT_SATP; Ibex doesn't support supervisor mode */              \
         INIT_PMP;                                                       \
-        DELEGATE_NO_TRAPS;                                              \
+      /*DELEGATE_NO_TRAPS; Ibex doesn't support supervisor mode */      \
         li TESTNUM, 0;                                                  \
         la t0, trap_vector;                                             \
         csrw mtvec, t0;                                                 \
@@ -214,7 +213,7 @@ reset_vector:                                                           \
                (1 << CAUSE_MISALIGNED_FETCH) |                          \
                (1 << CAUSE_USER_ECALL) |                                \
                (1 << CAUSE_BREAKPOINT);                                 \
-        csrw medeleg, t0;                                               \
+      /*csrw medeleg, t0; Ibex doesn't support supervisor mode */       \
 1:      csrwi mstatus, 0;                                               \
         init;                                                           \
         EXTRA_INIT;                                                     \
@@ -238,20 +237,24 @@ reset_vector:                                                           \
 
 #define RVTEST_PASS                                                     \
         fence;                                                          \
-        li TESTNUM, 1;                                                  \
-        li a7, 93;                                                      \
-        li a0, 0;                                                       \
-        ecall
+        li x2, SIGNATURE_ADDR;                                          \
+        li x1, (FINISHED_IRQ << 8) | CORE_STATUS;                       \
+        sw x1, 0(x2);                                                   \
+        li x1, (TEST_PASS << 8) | TEST_RESULT;                          \
+        sw x1, 0(x2);                                                   \
+        2:;                                                             \
+        j 2b;
 
 #define TESTNUM gp
 #define RVTEST_FAIL                                                     \
         fence;                                                          \
-1:      beqz TESTNUM, 1b;                                               \
-        sll TESTNUM, TESTNUM, 1;                                        \
-        or TESTNUM, TESTNUM, 1;                                         \
-        li a7, 93;                                                      \
-        addi a0, TESTNUM, 0;                                            \
-        ecall
+        li x2, SIGNATURE_ADDR;                                          \
+        li x1, (FINISHED_IRQ << 8) | CORE_STATUS;                       \
+        sw x1, 0(x2);                                                   \
+        li x1, (TEST_FAIL << 8) | TEST_RESULT;                          \
+        sw x1, 0(x2);                                                   \
+        2:;                                                             \
+        j 2b;
 
 //-----------------------------------------------------------------------
 // Data Section Macro
@@ -262,8 +265,8 @@ reset_vector:                                                           \
 #define RVTEST_DATA_BEGIN                                               \
         EXTRA_DATA                                                      \
         .pushsection .tohost,"aw",@progbits;                            \
-        .align 6; .global tohost; tohost: .dword 0; .size tohost, 8;    \
-        .align 6; .global fromhost; fromhost: .dword 0; .size fromhost, 8;\
+        .align 6; .global tohost; tohost: .dword 0;                     \
+        .align 6; .global fromhost; fromhost: .dword 0;                 \
         .popsection;                                                    \
         .align 4; .global begin_signature; begin_signature:
 
