commit 5b55fad474216a984ba0fbefb5d478bdd4f16580 parent 96f288f4dba92525cc687ec043d4154e98b64183 Author: Dimitris Papastamos <dimitris.papastamos@arm.com> Date: Fri, 19 Oct 2018 15:46:24 +0100 [test] Make test3 go through trap Needs more work to cover all the other cases: - Inject via rmc() - Inject via libhdl - Inject via librmu Change-Id: I8cb9fd94f07eeaebd6e497fa8b92c6ad9e881fec Signed-off-by: Dimitris Papastamos <dimitris.papastamos@arm.com> Diffstat:
| M | test/test3/test.c | | | 22 | ++++++++++------------ |
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/test/test3/test.c b/test/test3/test.c @@ -1,24 +1,22 @@ #include <assert.h> +#include <setjmp.h> #include <stdio.h> #include <stdlib.h> #include <rcode.h> +jmp_buf env; + int main(void) { - Rmucmd cmd; struct trapframe frame; - cmd.imm1 = 0; - cmd.imm2 = 0; - cmd.fp = &frame; - - bss->cmd = &cmd; - if (!setjmp(cmd.recover)) - rmc(&cmd); - assert(cmd.fp->x0 == 0); - assert(cmd.fp->x1 == 0); - assert(cmd.fp->x2 == 1); + frame.esr = RMC << 26; /* imm1 = imm2 = 0 */ + if (!setjmp(env)) + trap(&frame); + assert(frame.x0 == 0); + assert(frame.x1 == 0); + assert(frame.x2 == 1); return 0; } @@ -38,5 +36,5 @@ dopanic(void) void swtch(struct trapframe *fp) { - panic("swtch() not implemented"); + longjmp(env, 1); }