aboutsummaryrefslogtreecommitdiff
path: root/debug/programs/init.c
blob: a2b41b02d60e2eb51af3d9322dcedb2f72460c67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
int main(void);

void handle_trap(unsigned int mcause, unsigned int mepc, unsigned int sp)
{
    while (1)
        ;
}

void _exit(int status)
{
    // 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());
}