aboutsummaryrefslogtreecommitdiff
path: root/debug/programs/init.c
diff options
context:
space:
mode:
authorTim Newsome <tim@sifive.com>2016-06-07 16:59:26 -0700
committerTim Newsome <tim@sifive.com>2016-07-18 18:51:54 -0700
commit6990284b8eab8d4e4f57f82ac8918913c5c63e97 (patch)
tree6c3f83d00f215e9e829745c9bde1a5573b82066b /debug/programs/init.c
parentf29d14a877d4873c12fa80c9df5b265474a85b05 (diff)
downloadriscv-tests-6990284b8eab8d4e4f57f82ac8918913c5c63e97.zip
riscv-tests-6990284b8eab8d4e4f57f82ac8918913c5c63e97.tar.gz
riscv-tests-6990284b8eab8d4e4f57f82ac8918913c5c63e97.tar.bz2
Made some progress towards working with spike.
I'm writing all the tests so they should just work on real hardware, too.
Diffstat (limited to 'debug/programs/init.c')
-rw-r--r--debug/programs/init.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/debug/programs/init.c b/debug/programs/init.c
index 074bc21..a2b41b0 100644
--- a/debug/programs/init.c
+++ b/debug/programs/init.c
@@ -6,9 +6,19 @@ void handle_trap(unsigned int mcause, unsigned int mepc, unsigned int sp)
;
}
-void _init()
+void _exit(int status)
{
- main();
+ // Make sure gcc doesn't inline _exit, so we can actually set a breakpoint
+ // on it.
+ volatile int i = 42;
+ while (i)
+ ;
+ // _exit isn't supposed to return.
while (1)
;
}
+
+void _init()
+{
+ _exit(main());
+}