From 99c0925db541d745f1703f76975328bf5cc2a780 Mon Sep 17 00:00:00 2001 From: Toby Jaffey Date: Sat, 13 Dec 2025 19:17:58 +0000 Subject: [PATCH] Test for invalid uvm32_arg_t --- test/custom_syscall/test/tests.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/custom_syscall/test/tests.c b/test/custom_syscall/test/tests.c index 33dc1a6..0b740e3 100644 --- a/test/custom_syscall/test/tests.c +++ b/test/custom_syscall/test/tests.c @@ -59,4 +59,19 @@ void test_custom_syscall_badval(void) { TEST_ASSERT_EQUAL(evt.typ, UVM32_EVT_END); } +void test_custom_syscall_badarg(void) { + // run the vm + uvm32_run(&vmst, &evt, 100); + // check for custom syscall + TEST_ASSERT_EQUAL(evt.typ, UVM32_EVT_SYSCALL); + TEST_ASSERT_EQUAL(evt.data.syscall.code, 0xDEADBEEF); + TEST_ASSERT_EQUAL(0, uvm32_arg_getval(&vmst, &evt, (uvm32_arg_t)123)); // not ARG0, ARG1 or RET + + // check for error state + uvm32_run(&vmst, &evt, 100); + TEST_ASSERT_EQUAL(evt.typ, UVM32_EVT_ERR); + TEST_ASSERT_EQUAL(evt.data.err.errcode, UVM32_ERR_ARGS); + +} +