1/*
2 * Copyright 2017, Data61
3 * Commonwealth Scientific and Industrial Research Organisation (CSIRO)
4 * ABN 41 687 119 230.
5 *
6 * This software may be distributed and modified according to the terms of
7 * the BSD 2-Clause license. Note that NO WARRANTY is provided.
8 * See "LICENSE_BSD2.txt" for details.
9 *
10 * @TAG(DATA61_BSD)
11 */
12
13#include "../../arch_fault.h"
14#include <assert.h>
15#include <sel4/sel4.h>
16#include <stddef.h>
17#include <stdint.h>
18
19void show_unknown_syscall_fault(seL4_CPtr thread_id, const char *name)
20{
21    assert(name != NULL);
22
23    uintptr_t eax = seL4_GetMR(0);
24    uintptr_t ebx = seL4_GetMR(1);
25    uintptr_t ecx = seL4_GetMR(2);
26    uintptr_t edx = seL4_GetMR(3);
27    uintptr_t esi = seL4_GetMR(4);
28    uintptr_t edi = seL4_GetMR(5);
29    uintptr_t ebp = seL4_GetMR(6);
30    uintptr_t eip = seL4_GetMR(7);
31    uintptr_t esp = seL4_GetMR(8);
32    uintptr_t eflags = seL4_GetMR(9);
33    int syscall = seL4_GetMR(10);
34    SHOW("unknown syscall (%d) from %s (ID 0x%x), pc = %p\n"
35         "   eax = %p\n"
36         "   ebx  = %p\n"
37         "   ecx  = %p\n"
38         "   edx  = %p\n"
39         "   esi  = %p\n"
40         "   edi  = %p\n"
41         "   ebp  = %p\n"
42         "   esp  = %p\n"
43         " eflags = %p\n",
44         syscall, name, thread_id, (void *)eip, (void *)eax, (void *)ebx,
45         (void *)ecx, (void *)edx, (void *)esi, (void *)edi, (void *)ebp, (void *)esp,
46         (void *)eflags);
47}
48