Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/syscall/syscall.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
#include "syscall/sys.h"
#include "syscall/usbdev.h"
#include "syscall/sysvipc.h"
#include "syscall/syscall_names.h"
#include "proved/timespec.h"

#include "syscall/time.h"
Expand Down Expand Up @@ -2802,9 +2803,22 @@ int syscall_dispatch(hv_vcpu_t vcpu, guest_t *g, int *exit_code, bool verbose)
if (verbose) {
uint64_t elr = 0;
hv_vcpu_get_sys_reg(vcpu, HV_SYS_REG_ELR_EL1, &elr);
const char *name = NULL;
if (x8 <= SC_MAX_SYSCALL_NUM) {
name = syscall_names[x8];
}

char nr_str[64];
if (name) {
snprintf(nr_str, sizeof(nr_str), "%s(%llu)", name,
(unsigned long long) x8);
} else {
snprintf(nr_str, sizeof(nr_str), "%llu", (unsigned long long) x8);
}
log_debug(
"syscall %llu@0x%llx(0x%llx, 0x%llx, 0x%llx, 0x%llx, "
"syscall %s@0x%llx(0x%llx, 0x%llx, 0x%llx, 0x%llx, "
"0x%llx, 0x%llx)",
nr_str,
(unsigned long long) x8,
(unsigned long long) (elr >= 4 ? elr - 4 : elr),
(unsigned long long) x0, (unsigned long long) x1,
Expand Down
15 changes: 15 additions & 0 deletions src/syscall/syscall_names.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#pragma once

#include "dispatch.h"

/* Name table generated from dispatch.tbl: shared with syscall.c so verbose
* logs can print syscall names. A new entry in dispatch.tbl automatically
* gains a name here; slots without a corresponding entry stay NULL and the
* caller falls back to printing the raw number.
*/
static const char *const syscall_names[SC_MAX_SYSCALL_NUM + 1] = {
#define _(sys_name, sc_handler, extra) [sys_name] = #sys_name,
SYSCALL_TABLE_ENTRIES(_)
#undef _
};

Loading