Skip to contentSkip to conversation

Splitting asm-{i386/x86_64}/ptrace.h

RFC New Jeff Dike 1 participant 1 message Aug 7, 2006 Generic include/asm header files

lore
Share & tools
lore

Jeff Dike

author
#0 lore raw

RFC 1/1 Splitting asm-{i386/x86_64}/ptrace.h

I'm going to be sending the patch below to Andrew. It splits the userspace-usable stuff into ptrace-abi.h.

The impetus for this was the introduction of SEGMENT_RPL_MASK in place of 0x3 x86-allow-a-kernel-to-not-be-in-ring-0.patch. This breaks the UML build, as it pulls in the underlying arch's ptrace.h, but I have no easy way of grabbing the definition of SEGMENT_RPL_MASK.

Splitting the header so that UML gets only the parts that it can use cleans up the UML side of things nicely. It also produces a header which is close to something that can be dropped into libc.

Jeff

include/asm-i386/ptrace-abi.h new file +60 -0
Index: linux-2.6.17/include/asm-i386/ptrace-abi.h
===================================================================
@@ -0,0 +1,60 @@
+#ifndef I386_PTRACE_ABI_H
+#define I386_PTRACE_ABI_H
+
+#define EBX 0
+#define ECX 1
+#define EDX 2
+#define ESI 3
+#define EDI 4
+#define EBP 5
+#define EAX 6
+#define DS 7
+#define ES 8
+#define FS 9
+#define GS 10
+#define ORIG_EAX 11
+#define EIP 12
+#define CS  13
+#define EFL 14
+#define UESP 15
+#define SS   16
+#define FRAME_SIZE 17
+
+/* this struct defines the way the registers are stored on the
+   stack during a system call. */
+
+struct pt_regs {
+	long ebx;
+	long ecx;
+	long edx;
+	long esi;
+	long edi;
+	long ebp;
+	long eax;
+	int  xds;
+	int  xes;
+	long orig_eax;
+	long eip;
+	int  xcs;
+	long eflags;
+	long esp;
+	int  xss;
+};
+
+/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
+#define PTRACE_GETREGS            12
+#define PTRACE_SETREGS            13
+#define PTRACE_GETFPREGS          14
+#define PTRACE_SETFPREGS          15
+#define PTRACE_GETFPXREGS         18
+#define PTRACE_SETFPXREGS         19
+
+#define PTRACE_OLDSETOPTIONS         21
+
+#define PTRACE_GET_THREAD_AREA    25
+#define PTRACE_SET_THREAD_AREA    26
+
+#define PTRACE_SYSEMU		  31
+#define PTRACE_SYSEMU_SINGLESTEP  32
+
+#endif
include/asm-i386/ptrace.h +1 -55

62 lines not on this page · raw message

include/asm-x86_64/ptrace-abi.h new file +83 -0

83 lines not on this page · raw message

include/asm-x86_64/ptrace.h +1 -78

85 lines not on this page · raw message