mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00

The PTRACE_GETREGSET API has now existed since Linux 2.6.33. The XSAVE CPU feature should also be sufficiently common to be able to rely on it. With this, define our internal FP state to be the hosts XSAVE data. Add discovery for the hosts XSAVE size and place the FP registers at the end of task_struct so that we can adjust the size at runtime. Next we can implement the regset API on top and update the signal handling as well as ptrace APIs to use them. Also switch coredump creation to use the regset API and finally set HAVE_ARCH_TRACEHOOK. This considerably improves the signal frames. Previously they might not have contained all the registers (i386) and also did not have the sizes and magic values set to the correct values to permit userspace to decode the frame. As a side effect, this will permit UML to run on hosts with newer CPU extensions (such as AMX) that need even more register state. Signed-off-by: Benjamin Berg <benjamin.berg@intel.com> Link: https://patch.msgid.link/20241023094120.4083426-1-benjamin@sipsolutions.net Signed-off-by: Johannes Berg <johannes.berg@intel.com>
58 lines
1.6 KiB
C
58 lines
1.6 KiB
C
/*
|
|
* Copyright 2003 PathScale, Inc.
|
|
* Copyright (C) 2003 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
|
|
*
|
|
* Licensed under the GPL
|
|
*/
|
|
|
|
#ifndef __SYSDEP_X86_64_PTRACE_H
|
|
#define __SYSDEP_X86_64_PTRACE_H
|
|
|
|
#define REGS_R8(r) ((r)[HOST_R8])
|
|
#define REGS_R9(r) ((r)[HOST_R9])
|
|
#define REGS_R10(r) ((r)[HOST_R10])
|
|
#define REGS_R11(r) ((r)[HOST_R11])
|
|
#define REGS_R12(r) ((r)[HOST_R12])
|
|
#define REGS_R13(r) ((r)[HOST_R13])
|
|
#define REGS_R14(r) ((r)[HOST_R14])
|
|
#define REGS_R15(r) ((r)[HOST_R15])
|
|
|
|
#define HOST_FS_BASE 21
|
|
#define HOST_GS_BASE 22
|
|
#define HOST_DS 23
|
|
#define HOST_ES 24
|
|
#define HOST_FS 25
|
|
#define HOST_GS 26
|
|
|
|
/* Also defined in asm/ptrace-x86_64.h, but not in libc headers. So, these
|
|
* are already defined for kernel code, but not for userspace code.
|
|
*/
|
|
#ifndef FS_BASE
|
|
/* These aren't defined in ptrace.h, but exist in struct user_regs_struct,
|
|
* which is what x86_64 ptrace actually uses.
|
|
*/
|
|
#define FS_BASE (HOST_FS_BASE * sizeof(long))
|
|
#define GS_BASE (HOST_GS_BASE * sizeof(long))
|
|
#define DS (HOST_DS * sizeof(long))
|
|
#define ES (HOST_ES * sizeof(long))
|
|
#define FS (HOST_FS * sizeof(long))
|
|
#define GS (HOST_GS * sizeof(long))
|
|
#endif
|
|
|
|
#define UPT_R8(r) REGS_R8((r)->gp)
|
|
#define UPT_R9(r) REGS_R9((r)->gp)
|
|
#define UPT_R10(r) REGS_R10((r)->gp)
|
|
#define UPT_R11(r) REGS_R11((r)->gp)
|
|
#define UPT_R12(r) REGS_R12((r)->gp)
|
|
#define UPT_R13(r) REGS_R13((r)->gp)
|
|
#define UPT_R14(r) REGS_R14((r)->gp)
|
|
#define UPT_R15(r) REGS_R15((r)->gp)
|
|
|
|
#define UPT_SYSCALL_ARG1(r) UPT_DI(r)
|
|
#define UPT_SYSCALL_ARG2(r) UPT_SI(r)
|
|
#define UPT_SYSCALL_ARG3(r) UPT_DX(r)
|
|
#define UPT_SYSCALL_ARG4(r) UPT_R10(r)
|
|
#define UPT_SYSCALL_ARG5(r) UPT_R8(r)
|
|
#define UPT_SYSCALL_ARG6(r) UPT_R9(r)
|
|
|
|
#endif
|