Skip to contentSkip to conversation

uml: fix handling of no fpx_regs [critical, for 2.6.12]

PATCH In review [email protected] 3 participants 3 messages Apr 25, 2005 – Apr 26, 2005 User-mode Linux (UML)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 uml: fix handling of no fpx_regs [critical, for 2.6.12]

From: Andree Leidenfrost <[email protected]>, Paolo 'Blaisorblade' Giarrusso <[email protected]>

Fix the error path, which is triggered when the processor misses the fpx regs (i.e. the "fxsr" cpuinfo feature). For instance by VIA C3 Samuel2. Tested and obvious, please merge ASAP.

---

 linux-2.6.12-paolo/arch/um/os-Linux/sys-i386/registers.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
arch/um/os-Linux/sys-i386/registers.c renamed from arch/um/os-Linux/sys-i386/registers.c~uml-fix-no_fpx_regs_handling +4 -3
diff -puN arch/um/os-Linux/sys-i386/registers.c~uml-fix-no_fpx_regs_handling arch/um/os-Linux/sys-i386/registers.c
@@ -105,14 +105,15 @@ void init_registers(int pid)
 		panic("check_ptrace : PTRACE_GETREGS failed, errno = %d",
 		      err);
 
+	errno = 0;
 	err = ptrace(PTRACE_GETFPXREGS, pid, 0, exec_fpx_regs);
 	if(!err)
 		return;
+	if(errno != EIO)
+		panic("check_ptrace : PTRACE_GETFPXREGS failed, errno = %d",
+		      errno);
 
 	have_fpx_regs = 0;
-	if(err != EIO)
-		panic("check_ptrace : PTRACE_GETFPXREGS failed, errno = %d",
-		      err);
 
 	err = ptrace(PTRACE_GETFPREGS, pid, 0, exec_fp_regs);
 	if(err)

_

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#1 lore raw

mån 2005-04-25 klockan 21:12 +0200 skrev [email protected]:

Quoted 16 lines

From: Andree Leidenfrost <[email protected]>, Paolo 'Blaisorblade' Giarrusso <[email protected]>

Fix the error path, which is triggered when the processor misses the fpx regs (i.e. the "fxsr" cpuinfo feature). For instance by VIA C3 Samuel2. Tested and obvious, please merge ASAP.

---

 linux-2.6.12-paolo/arch/um/os-Linux/sys-i386/registers.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff -puN arch/um/os-Linux/sys-i386/registers.c~uml-fix-no_fpx_regs_handling arch/um/os-Linux/sys-i386/registers.c

arch/um/os-Linux/sys-i386/registers.c void init_registers(int pid) · line 114

Quoted 10 lines
arch/um/os-Linux/sys-i386/registers.c renamed from arch/um/os-Linux/sys-i386/registers.c~uml-fix-no_fpx_regs_handling +4 -0
@@ -105,14 +105,15 @@ void init_registers(int pid)
 		panic("check_ptrace : PTRACE_GETREGS failed, errno = %d",
 		      err);
 
+	errno = 0;
 	err = ptrace(PTRACE_GETFPXREGS, pid, 0, exec_fpx_regs);
 	if(!err)
 		return;
+	if(errno != EIO)
+		panic("check_ptrace : PTRACE_GETFPXREGS failed, errno = %d",
+		      errno);

Looks like you mean "if (err != EIO)" here

arch/um/os-Linux/sys-i386/registers.c void init_registers(int pid) · line 119

Quoted 7 lines
arch/um/os-Linux/sys-i386/registers.c renamed from arch/um/os-Linux/sys-i386/registers.c~uml-fix-no_fpx_regs_handling +0 -3
 	have_fpx_regs = 0;
-	if(err != EIO)
-		panic("check_ptrace : PTRACE_GETFPXREGS failed, errno = %d",
-		      err);
 
 	err = ptrace(PTRACE_GETFPREGS, pid, 0, exec_fp_regs);
 	if(err)

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&opÌk
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#2 lore raw

Hi Alexander

Quoted 20 lines · Alexander Nyberg

mån 2005-04-25 klockan 21:12 +0200 skrev [email protected]:

Quoted 19 lines

From: Andree Leidenfrost <[email protected]>, Paolo 'Blaisorblade' Giarrusso <[email protected]>

Fix the error path, which is triggered when the processor misses the fpx regs (i.e. the "fxsr" cpuinfo feature). For instance by VIA C3 Samuel2. Tested and obvious, please merge ASAP.

---

 linux-2.6.12-paolo/arch/um/os-Linux/sys-i386/registers.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff -puN arch/um/os-Linux/sys-i386/registers.c~uml-fix-no_fpx_regs_handling arch/um/os-Linux/sys-i386/registers.c

arch/um/os-Linux/sys-i386/registers.c renamed from arch/um/os-Linux/sys-i386/registers.c~uml-fix-no_fpx_regs_handling +0 -0
@@ -105,14 +105,15 @@ void init_registers(int pid)
 		panic("check_ptrace : PTRACE_GETREGS failed, errno = %d",
 		      err);
 
Quoted 9 lines

arch/um/os-Linux/sys-i386/registers.c void init_registers(int pid) · line 114

Quoted 7 lines
arch/um/os-Linux/sys-i386/registers.c renamed from arch/um/os-Linux/sys-i386/registers.c~uml-fix-no_fpx_regs_handling +4 -0
+	errno = 0;
 	err = ptrace(PTRACE_GETFPXREGS, pid, 0, exec_fpx_regs);
 	if(!err)
 		return;
+	if(errno != EIO)
+		panic("check_ptrace : PTRACE_GETFPXREGS failed, errno = %d",
+		      errno);

Looks like you mean "if (err != EIO)" here

No. The patch is correct.

ptrace will always return -1 in case of an error. The actual error code is in errno, hence this is what needs to be compared to EIO. Please also see the ptrace manpage.

Quoted 7 lines

arch/um/os-Linux/sys-i386/registers.c void init_registers(int pid) · line 119

Quoted 7 lines
arch/um/os-Linux/sys-i386/registers.c renamed from arch/um/os-Linux/sys-i386/registers.c~uml-fix-no_fpx_regs_handling +0 -3
 	have_fpx_regs = 0;
-	if(err != EIO)
-		panic("check_ptrace : PTRACE_GETFPXREGS failed, errno = %d",
-		      err);
 
 	err = ptrace(PTRACE_GETFPREGS, pid, 0, exec_fp_regs);
 	if(err)

Best regards
Andree

Signature · 2 lines
Andree Leidenfrost
Sydney - Australia