Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/powerpc Prepare syscall.c for COMPAT_MACH support. ...
details: https://anonhg.NetBSD.org/src/rev/9e04c7761068
branches: trunk
changeset: 538790:9e04c7761068
user: manu <manu%NetBSD.org@localhost>
date: Wed Oct 30 06:37:37 2002 +0000
description:
Prepare syscall.c for COMPAT_MACH support. linux_syscall_intern is
moved to a Linux specific file, child_return is moved to trap.c,
and we introduce a EMULNAME macro co that syscall.c can be included to
define the system call handler for another emulation.
diffstat:
sys/arch/powerpc/conf/files.powerpc | 3 +-
sys/arch/powerpc/powerpc/linux_syscall.c | 52 ++++++++++++++++++++++++++++++
sys/arch/powerpc/powerpc/syscall.c | 55 ++++++++-----------------------
sys/arch/powerpc/powerpc/trap.c | 27 +++++++++++++++-
4 files changed, 94 insertions(+), 43 deletions(-)
diffs (213 lines):
diff -r 57695d65e3c5 -r 9e04c7761068 sys/arch/powerpc/conf/files.powerpc
--- a/sys/arch/powerpc/conf/files.powerpc Wed Oct 30 06:26:42 2002 +0000
+++ b/sys/arch/powerpc/conf/files.powerpc Wed Oct 30 06:37:37 2002 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.powerpc,v 1.36 2002/10/30 06:26:44 manu Exp $
+# $NetBSD: files.powerpc,v 1.37 2002/10/30 06:37:37 manu Exp $
defflag opt_altivec.h ALTIVEC K_ALTIVEC
defflag opt_openpic.h OPENPIC OPENPIC_SERIAL_MODE
@@ -61,3 +61,4 @@
include "compat/linux/arch/powerpc/files.linux_powerpc"
file arch/powerpc/powerpc/linux_sigcode.S compat_linux
file arch/powerpc/powerpc/linux_trap.c compat_linux
+file arch/powerpc/powerpc/linux_syscall.c compat_linux
diff -r 57695d65e3c5 -r 9e04c7761068 sys/arch/powerpc/powerpc/linux_syscall.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/powerpc/powerpc/linux_syscall.c Wed Oct 30 06:37:37 2002 +0000
@@ -0,0 +1,52 @@
+/* $NetBSD: linux_syscall.c,v 1.1 2002/10/30 06:37:38 manu Exp $ */
+
+/*-
+ * Copyright (c) 2002 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Emmanuel Dreyfus
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+
+__KERNEL_RCSID(0, "$NetBSD: linux_syscall.c,v 1.1 2002/10/30 06:37:38 manu Exp $");
+
+#include <sys/param.h>
+#include <sys/signal.h>
+#include <sys/types.h>
+#include <sys/proc.h>
+
+void
+linux_syscall_intern(struct proc *p)
+{
+ p->p_md.md_syscall = syscall_fancy;
+}
diff -r 57695d65e3c5 -r 9e04c7761068 sys/arch/powerpc/powerpc/syscall.c
--- a/sys/arch/powerpc/powerpc/syscall.c Wed Oct 30 06:26:42 2002 +0000
+++ b/sys/arch/powerpc/powerpc/syscall.c Wed Oct 30 06:37:37 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: syscall.c,v 1.4 2002/08/02 03:46:45 chs Exp $ */
+/* $NetBSD: syscall.c,v 1.5 2002/10/30 06:37:38 manu Exp $ */
/*
* Copyright (C) 2002 Matt Thomas
@@ -71,11 +71,15 @@
#define NARGREG 8 /* 8 args are in registers */
#define MOREARGS(sp) ((caddr_t)((uintptr_t)(sp) + 8)) /* more args go here */
-void syscall_plain(struct trapframe *frame);
-void syscall_fancy(struct trapframe *frame);
+#ifndef EMULNAME
+#define EMULNAME(x) (x)
+#endif
+
+void EMULNAME(syscall_plain)(struct trapframe *frame);
+void EMULNAME(syscall_fancy)(struct trapframe *frame);
void
-syscall_plain(struct trapframe *frame)
+EMULNAME(syscall_plain)(struct trapframe *frame)
{
struct proc *p = curproc;
const struct sysent *callp;
@@ -89,6 +93,7 @@
curcpu()->ci_ev_scalls.ev_count++;
code = frame->fixreg[0];
+
callp = p->p_emul->e_sysent;
params = frame->fixreg + FIRSTARG;
n = NARGREG;
@@ -167,7 +172,7 @@
}
void
-syscall_fancy(struct trapframe *frame)
+EMULNAME(syscall_fancy)(struct trapframe *frame)
{
struct proc *p = curproc;
const struct sysent *callp;
@@ -254,52 +259,20 @@
}
void
-syscall_intern(struct proc *p)
+EMULNAME(syscall_intern)(struct proc *p)
{
#ifdef KTRACE
if (p->p_traceflag & (KTRFAC_SYSCALL | KTRFAC_SYSRET)) {
- p->p_md.md_syscall = syscall_fancy;
+ p->p_md.md_syscall = EMULNAME(syscall_fancy);
return;
}
#endif
#ifdef SYSTRACE
if (ISSET(p->p_flag, P_SYSTRACE)) {
- p->p_md.md_syscall = syscall_fancy;
+ p->p_md.md_syscall = EMULNAME(syscall_fancy);
return;
}
#endif
- p->p_md.md_syscall = syscall_plain;
+ p->p_md.md_syscall = EMULNAME(syscall_plain);
}
-#ifdef COMPAT_LINUX
-void
-linux_syscall_intern(struct proc *p)
-{
- p->p_md.md_syscall = syscall_fancy;
-}
-#endif
-
-void
-child_return(void *arg)
-{
- struct proc * const p = arg;
- struct trapframe * const tf = trapframe(p);
-
- KERNEL_PROC_UNLOCK(p);
-
- tf->fixreg[FIRSTARG] = 0;
- tf->fixreg[FIRSTARG + 1] = 1;
- tf->cr &= ~0x10000000;
- tf->srr1 &= ~(PSL_FP|PSL_VEC); /* Disable FP & AltiVec, as we can't
- be them. */
- p->p_addr->u_pcb.pcb_fpcpu = NULL;
-#ifdef KTRACE
- if (KTRPOINT(p, KTR_SYSRET)) {
- KERNEL_PROC_LOCK(p);
- ktrsysret(p, SYS_fork, 0, 0);
- KERNEL_PROC_UNLOCK(p);
- }
-#endif
- /* Profiling? XXX */
- curcpu()->ci_schedstate.spc_curpriority = p->p_priority;
-}
diff -r 57695d65e3c5 -r 9e04c7761068 sys/arch/powerpc/powerpc/trap.c
--- a/sys/arch/powerpc/powerpc/trap.c Wed Oct 30 06:26:42 2002 +0000
+++ b/sys/arch/powerpc/powerpc/trap.c Wed Oct 30 06:37:37 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.69 2002/10/10 22:37:51 matt Exp $ */
+/* $NetBSD: trap.c,v 1.70 2002/10/30 06:37:38 manu Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -73,6 +73,31 @@
int badaddr_read __P((void *, size_t, int *));
void
+child_return(void *arg)
+{
+ struct proc * const p = arg;
+ struct trapframe * const tf = trapframe(p);
+
+ KERNEL_PROC_UNLOCK(p);
+
+ tf->fixreg[FIRSTARG] = 0;
+ tf->fixreg[FIRSTARG + 1] = 1;
+ tf->cr &= ~0x10000000;
+ tf->srr1 &= ~(PSL_FP|PSL_VEC); /* Disable FP & AltiVec, as we can't
+ be them. */
+ p->p_addr->u_pcb.pcb_fpcpu = NULL;
+#ifdef KTRACE
+ if (KTRPOINT(p, KTR_SYSRET)) {
+ KERNEL_PROC_LOCK(p);
+ ktrsysret(p, SYS_fork, 0, 0);
+ KERNEL_PROC_UNLOCK(p);
+ }
+#endif
+ /* Profiling? XXX */
+ curcpu()->ci_schedstate.spc_curpriority = p->p_priority;
+}
+
+void
trap(struct trapframe *frame)
{
struct cpu_info * const ci = curcpu();
Home |
Main Index |
Thread Index |
Old Index