aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/entry
diff options
context:
space:
mode:
authorztong <ztong@cs.unc.edu>2021-02-03 18:15:37 -0500
committerztong <ztong@cs.unc.edu>2021-02-03 18:15:37 -0500
commitffcea58b914c7febd2d3126552dee41216d3a203 (patch)
tree2e63e893807fb908cfd398c9a63d0412b019ea12 /arch/x86/entry
parent8b3b8657637b5a03b2f12f260516be964e6fc228 (diff)
Added KUTrace Support
Moved sched_litmus back to the top scheduling class
Diffstat (limited to 'arch/x86/entry')
-rw-r--r--arch/x86/entry/common.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c
index 3f8e22615812..24f30bb65ac4 100644
--- a/arch/x86/entry/common.c
+++ b/arch/x86/entry/common.c
@@ -37,6 +37,8 @@
37#define CREATE_TRACE_POINTS 37#define CREATE_TRACE_POINTS
38#include <trace/events/syscalls.h> 38#include <trace/events/syscalls.h>
39 39
40#include <linux/kutrace.h>
41
40#ifdef CONFIG_CONTEXT_TRACKING 42#ifdef CONFIG_CONTEXT_TRACKING
41/* Called on entry from user mode with IRQs off. */ 43/* Called on entry from user mode with IRQs off. */
42__visible inline void enter_from_user_mode(void) 44__visible inline void enter_from_user_mode(void)
@@ -287,7 +289,29 @@ __visible void do_syscall_64(unsigned long nr, struct pt_regs *regs)
287 289
288 if (likely(nr < NR_syscalls)) { 290 if (likely(nr < NR_syscalls)) {
289 nr = array_index_nospec(nr, NR_syscalls); 291 nr = array_index_nospec(nr, NR_syscalls);
292 /* dsites 2019.03.05 track all syscalls and normal returns */
293 /* Pass in low 16 bits of call arg0 and return value */
294 kutrace1(KUTRACE_SYSCALL64 | kutrace_map_nr(nr), regs->di & 0xFFFFul);
295
290 regs->ax = sys_call_table[nr](regs); 296 regs->ax = sys_call_table[nr](regs);
297
298 /* dsites 2019.03.05 track all syscalls and normal returns */
299 /* Pass in low 16 bits of return value */
300 kutrace1(KUTRACE_SYSRET64 | kutrace_map_nr(nr), regs->ax & 0xFFFFul);
301#ifdef CONFIG_KUTRACE
302 } else if ((nr == __NR_kutrace_control) &&
303 (kutrace_global_ops.kutrace_trace_control != NULL)) {
304 BUILD_BUG_ON_MSG(NR_syscalls > __NR_kutrace_control,
305 "__NR_kutrace_control is too small");
306 BUILD_BUG_ON_MSG(16 > TASK_COMM_LEN,
307 "TASK_COMM_LEN is less than 16");
308
309 /* Calling kutrace_control(u64 command, u64 arg) */
310 /* see arch/x86/calling.h: */
311 /* syscall arg0 in rdi (command), arg1 in rsi (arg) */
312 regs->ax = (*kutrace_global_ops.kutrace_trace_control)(
313 regs->di, regs->si);
314#endif
291#ifdef CONFIG_X86_X32_ABI 315#ifdef CONFIG_X86_X32_ABI
292 } else if (likely((nr & __X32_SYSCALL_BIT) && 316 } else if (likely((nr & __X32_SYSCALL_BIT) &&
293 (nr & ~__X32_SYSCALL_BIT) < X32_NR_syscalls)) { 317 (nr & ~__X32_SYSCALL_BIT) < X32_NR_syscalls)) {