Skip to contentSkip to conversation

Split i386 and x86_64 ptrace.h

PATCH In review Jeff Dike 2 participants 3 messages Aug 8, 2006 – Aug 9, 2006 User-mode Linux (UML)

lore
Share & tools
lore

Jeff Dike

author
#0 lore raw

PATCH 1/2 Split i386 and x86_64 ptrace.h

The use of SEGMENT_RPL_MASK in the i386 ptrace.h introduced by x86-allow-a-kernel-to-not-be-in-ring-0.patch broke the UML build, as UML includes the underlying architecture's ptrace.h, but has no easy access to the x86 segment definitions.

Rather than kludging around this, as in the past, this patch splits the userspace-usable parts, which are the bits that UML needs, of ptrace.h into ptrace-abi.h, which is included back into ptrace.h. Thus, there is no net effect on i386.

As a side-effect, this creates a ptrace header which is close to being usable in /usr/include.

x86_64 is also treated in this way for consistency.

This patch was run by linux-arch yesterday with no comment.

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

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#1 lore raw
Quoted 4 lines · Jeff Dike

x86_64 is also treated in this way for consistency.

This patch was run by linux-arch yesterday with no comment.

Well you should have sent it to me.

I think I would prefer a well placed ifdef __KERNEL__ or two for this - i don't like it when it becomes harder to grep include files like this (like the errno->errno-base split was quite bad in this regard)

-Andi

author
#2 lore raw
Quoted 3 lines · Andi Kleen

I think I would prefer a well placed ifdef __KERNEL__ or two for this - i don't like it when it becomes harder to grep include files like this (like the errno->errno-base split was quite bad in this regard)

__KERNEL__ doesn't help because UML defines it just like any other arch.

If you want to play ifdef tricks, it would have to be #ifdef UML, or something similar.

Jeff

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel