Skip to contentSkip to conversation

x86: change most X86_32 pt_regs members to unsigned long

PATCH Applied Harvey Harrison 4 participants 4 messages Feb 8, 2008 – Feb 17, 2008 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/9 x86: change most X86_32 pt_regs members to unsigned long

All but ax and orig_ax can move with no changes.

---
 arch/x86/kernel/process_32.c |    5 ++---
 arch/x86/kernel/signal_32.c  |    4 ++--
 include/asm-x86/ptrace.h     |   28 ++++++++++++++--------------
 3 files changed, 18 insertions(+), 19 deletions(-)
arch/x86/kernel/process_32.c +2 -3
index dabdbef..32247ad 100644
@@ -358,7 +358,7 @@ void __show_registers(struct pt_regs *regs, int all)
 			init_utsname()->version);
 
 	printk("EIP: %04x:[<%08lx>] EFLAGS: %08lx CPU: %d\n",
-			0xffff & regs->cs, regs->ip, regs->flags,
+			(u16)regs->cs, regs->ip, regs->flags,
 			smp_processor_id());
 	print_symbol("EIP is at %s\n", regs->ip);
 
@@ -367,8 +367,7 @@ void __show_registers(struct pt_regs *regs, int all)
 	printk("ESI: %08lx EDI: %08lx EBP: %08lx ESP: %08lx\n",
 		regs->si, regs->di, regs->bp, sp);
 	printk(" DS: %04x ES: %04x FS: %04x GS: %04x SS: %04x\n",
-	       regs->ds & 0xffff, regs->es & 0xffff,
-	       regs->fs & 0xffff, gs, ss);
+	       (u16)regs->ds, (u16)regs->es, (u16)regs->fs, gs, ss);
 
 	if (!all)
 		return;
arch/x86/kernel/signal_32.c +2 -2
index caee1f0..7718395 100644
@@ -393,8 +393,8 @@ static int setup_frame(int sig, struct k_sigaction *ka,
 	regs->sp = (unsigned long) frame;
 	regs->ip = (unsigned long) ka->sa.sa_handler;
 	regs->ax = (unsigned long) sig;
-	regs->dx = (unsigned long) 0;
-	regs->cx = (unsigned long) 0;
+	regs->dx = 0;
+	regs->cx = 0;
 
 	regs->ds = __USER_DS;
 	regs->es = __USER_DS;
include/asm-x86/ptrace.h +14 -14
index d9e04b4..708337a 100644
@@ -36,23 +36,23 @@ struct pt_regs {
 #else /* __KERNEL__ */
 
 struct pt_regs {
-	long bx;
-	long cx;
-	long dx;
-	long si;
-	long di;
-	long bp;
+	unsigned long bx;
+	unsigned long cx;
+	unsigned long dx;
+	unsigned long si;
+	unsigned long di;
+	unsigned long bp;
 	long ax;
-	int  ds;
-	int  es;
-	int  fs;
+	unsigned long ds;
+	unsigned long es;
+	unsigned long fs;
 	/* int  gs; */
 	long orig_ax;
-	long ip;
-	int  cs;
-	long flags;
-	long sp;
-	int  ss;
+	unsigned long ip;
+	unsigned long cs;
+	unsigned long flags;
+	unsigned long sp;
+	unsigned long ss;
 };
 
 #include <asm/vm86.h>
Signature · 1 line
1.5.4.1219.g65b9
#1 lore raw
Quoted 29 lines · Harvey Harrison

All but ax and orig_ax can move with no changes.

include/asm-x86/ptrace.h +9 -9
@@ -36,23 +36,23 @@ struct pt_regs {
 #else /* __KERNEL__ */
 
 struct pt_regs {
-	long bx;
-	long cx;
-	long dx;
-	long si;
-	long di;
-	long bp;
+	unsigned long bx;
+	unsigned long cx;
+	unsigned long dx;
+	unsigned long si;
+	unsigned long di;
+	unsigned long bp;
 	long ax;
-	int  ds;
-	int  es;
-	int  fs;
+	unsigned long ds;
+	unsigned long es;
+	unsigned long fs;
 	/* int  gs; */
 	long orig_ax;

include/asm-x86/ptrace.h struct pt_regs { · line 55

Quoted 10 lines
include/asm-x86/ptrace.h +5 -5
-	long ip;
-	int  cs;
-	long flags;
-	long sp;
-	int  ss;
+	unsigned long ip;
+	unsigned long cs;
+	unsigned long flags;
+	unsigned long sp;
+	unsigned long ss;

Why?! You don't have even minimal chances to unify pt_regs for i386 and x86_64.

#2 lore raw
Quoted 2 lines · Alexey Dobriyan

Why?! You don't have even minimal chances to unify pt_regs for i386 and x86_64.

The structure itself, no. Some of the users may very well be candidates for unification, however.

-hpa