diff --git a/sys/arch/powerpc/conf/files.powerpc b/sys/arch/powerpc/conf/files.powerpc index 45e28b3c6a84..070b9d8c7a0c 100644 --- a/sys/arch/powerpc/conf/files.powerpc +++ b/sys/arch/powerpc/conf/files.powerpc @@ -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/files.linux" 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 --git a/sys/arch/powerpc/powerpc/linux_syscall.c b/sys/arch/powerpc/powerpc/linux_syscall.c new file mode 100644 index 000000000000..efe07d332c02 --- /dev/null +++ b/sys/arch/powerpc/powerpc/linux_syscall.c @@ -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 + +__KERNEL_RCSID(0, "$NetBSD: linux_syscall.c,v 1.1 2002/10/30 06:37:38 manu Exp $"); + +#include +#include +#include +#include + +void +linux_syscall_intern(struct proc *p) +{ + p->p_md.md_syscall = syscall_fancy; +} diff --git a/sys/arch/powerpc/powerpc/syscall.c b/sys/arch/powerpc/powerpc/syscall.c index d2118da1ff03..6eede5112391 100644 --- a/sys/arch/powerpc/powerpc/syscall.c +++ b/sys/arch/powerpc/powerpc/syscall.c @@ -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 @@ syscall_plain(struct trapframe *frame) 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 @@ syscall_bad: } void -syscall_fancy(struct trapframe *frame) +EMULNAME(syscall_fancy)(struct trapframe *frame) { struct proc *p = curproc; const struct sysent *callp; @@ -254,52 +259,20 @@ syscall_bad: } 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 --git a/sys/arch/powerpc/powerpc/trap.c b/sys/arch/powerpc/powerpc/trap.c index c12180aedd13..30cfa2aa46e9 100644 --- a/sys/arch/powerpc/powerpc/trap.c +++ b/sys/arch/powerpc/powerpc/trap.c @@ -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. @@ -72,6 +72,31 @@ int setfault __P((faultbuf)); /* defined in locore.S */ int badaddr __P((void *, size_t)); 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) {