Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/powerpc/powerpc Fixed a bug in the way errno return...



details:   https://anonhg.NetBSD.org/src/rev/d02e97527854
branches:  trunk
changeset: 503585:d02e97527854
user:      manu <manu%NetBSD.org@localhost>
date:      Fri Feb 09 17:48:01 2001 +0000

description:
Fixed a bug in the way errno return was handled in linux emulation (we returned the opposite of the expected errno)

diffstat:

 sys/arch/powerpc/powerpc/trap.c |  20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)

diffs (53 lines):

diff -r 1040bf7281ef -r d02e97527854 sys/arch/powerpc/powerpc/trap.c
--- a/sys/arch/powerpc/powerpc/trap.c   Fri Feb 09 17:23:46 2001 +0000
+++ b/sys/arch/powerpc/powerpc/trap.c   Fri Feb 09 17:48:01 2001 +0000
@@ -1,8 +1,9 @@
-/*     $NetBSD: trap.c,v 1.36 2001/02/04 17:38:11 briggs Exp $ */
+/*     $NetBSD: trap.c,v 1.37 2001/02/09 17:48:01 manu Exp $   */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
  * Copyright (C) 1995, 1996 TooLs GmbH.
+ * Copyright (C) 2001 Emmanuel Dreyfus
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -34,6 +35,7 @@
 #include "opt_altivec.h"
 #include "opt_ddb.h"
 #include "opt_ktrace.h"
+#include "opt_compat_linux.h"
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -66,6 +68,10 @@
 volatile int want_resched;
 #endif
 
+#ifdef COMPAT_LINUX
+extern struct emul emul_linux;
+#endif
+
 void *syscall = NULL;  /* XXX dummy symbol for emul_netbsd */
 
 static int fix_unaligned __P((struct proc *p, struct trapframe *frame));
@@ -247,7 +253,19 @@
 syscall_bad:
                                if (p->p_emul->e_errno)
                                        error = p->p_emul->e_errno[error];
+#ifdef COMPAT_LINUX
+                               if (p->p_emul == &emul_linux) {
+                                       /*
+                                        * Linux uses negative errno in kernel, but positive
+                                        * errno in userland. 
+                                        */
+                                       frame->fixreg[FIRSTARG] = -error;
+                               }
+                               else
+                                       frame->fixreg[FIRSTARG] = error;
+#else
                                frame->fixreg[FIRSTARG] = error;
+#endif
                                frame->cr |= 0x10000000;
                                break;
                        }



Home | Main Index | Thread Index | Old Index