summaryrefslogtreecommitdiffstats
path: root/sys/ia64/ia32
diff options
context:
space:
mode:
Diffstat (limited to 'sys/ia64/ia32')
-rw-r--r--sys/ia64/ia32/ia32_misc.c61
-rw-r--r--sys/ia64/ia32/ia32_reg.c80
-rw-r--r--sys/ia64/ia32/ia32_signal.c298
-rw-r--r--sys/ia64/ia32/ia32_trap.c282
4 files changed, 0 insertions, 721 deletions
diff --git a/sys/ia64/ia32/ia32_misc.c b/sys/ia64/ia32/ia32_misc.c
deleted file mode 100644
index 148e31a..0000000
--- a/sys/ia64/ia32/ia32_misc.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*-
- * Copyright (c) 2009 Konstantin Belousov
- * All rights reserved.
- *
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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>
-__FBSDID("$FreeBSD$");
-
-#include "opt_compat.h"
-
-#include <sys/param.h>
-#include <sys/mount.h>
-#include <sys/proc.h>
-#include <sys/socket.h>
-#include <sys/sysent.h>
-#include <sys/sysproto.h>
-#include <sys/systm.h>
-#include <sys/uio.h>
-
-#include <compat/freebsd32/freebsd32_util.h>
-#include <compat/freebsd32/freebsd32.h>
-#include <compat/freebsd32/freebsd32_proto.h>
-
-int
-freebsd32_sysarch(struct thread *td, struct freebsd32_sysarch_args *uap)
-{
-
- return (EOPNOTSUPP);
-}
-
-#ifdef COMPAT_43
-int
-ofreebsd32_getpagesize(struct thread *td,
- struct ofreebsd32_getpagesize_args *uap)
-{
-
- td->td_retval[0] = IA32_PAGE_SIZE;
- return (0);
-}
-#endif
diff --git a/sys/ia64/ia32/ia32_reg.c b/sys/ia64/ia32/ia32_reg.c
deleted file mode 100644
index ae47f72..0000000
--- a/sys/ia64/ia32/ia32_reg.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/*-
- * Copyright (c) 2005 Peter Wemm
- * All rights reserved.
- *
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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>
-__FBSDID("$FreeBSD$");
-
-#include "opt_compat.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/procfs.h>
-
-int
-fill_regs32(struct thread *td, struct reg32 *regs)
-{
-
- bzero(regs, sizeof(*regs));
- return (EOPNOTSUPP);
-}
-
-int
-set_regs32(struct thread *td, struct reg32 *regs)
-{
-
- return (EOPNOTSUPP);
-}
-
-int
-fill_fpregs32(struct thread *td, struct fpreg32 *regs)
-{
-
- bzero(regs, sizeof(*regs));
- return (EOPNOTSUPP);
-}
-
-int
-set_fpregs32(struct thread *td, struct fpreg32 *regs)
-{
-
- return (EOPNOTSUPP);
-}
-
-int
-fill_dbregs32(struct thread *td, struct dbreg32 *regs)
-{
-
- bzero(regs, sizeof(*regs));
- return (EOPNOTSUPP);
-}
-
-int
-set_dbregs32(struct thread *td, struct dbreg32 *regs)
-{
-
- return (EOPNOTSUPP);
-}
diff --git a/sys/ia64/ia32/ia32_signal.c b/sys/ia64/ia32/ia32_signal.c
deleted file mode 100644
index d17f060..0000000
--- a/sys/ia64/ia32/ia32_signal.c
+++ /dev/null
@@ -1,298 +0,0 @@
-/*-
- * Copyright (c) 2002 Doug Rabson
- * All rights reserved.
- *
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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>
-__FBSDID("$FreeBSD$");
-
-#include "opt_compat.h"
-
-#define __ELF_WORD_SIZE 32
-
-#include <sys/param.h>
-#include <sys/exec.h>
-#include <sys/fcntl.h>
-#include <sys/imgact.h>
-#include <sys/kernel.h>
-#include <sys/lock.h>
-#include <sys/malloc.h>
-#include <sys/mutex.h>
-#include <sys/mman.h>
-#include <sys/namei.h>
-#include <sys/pioctl.h>
-#include <sys/proc.h>
-#include <sys/procfs.h>
-#include <sys/resourcevar.h>
-#include <sys/systm.h>
-#include <sys/signalvar.h>
-#include <sys/stat.h>
-#include <sys/sx.h>
-#include <sys/syscall.h>
-#include <sys/sysctl.h>
-#include <sys/sysent.h>
-#include <sys/vnode.h>
-#include <sys/imgact_elf.h>
-#include <sys/sysproto.h>
-
-#include <machine/frame.h>
-#include <machine/md_var.h>
-#include <machine/pcb.h>
-
-#include <vm/vm.h>
-#include <vm/vm_kern.h>
-#include <vm/vm_param.h>
-#include <vm/pmap.h>
-#include <vm/vm_map.h>
-#include <vm/vm_object.h>
-#include <vm/vm_extern.h>
-
-#include <compat/freebsd32/freebsd32_signal.h>
-#include <compat/freebsd32/freebsd32_util.h>
-#include <compat/freebsd32/freebsd32_proto.h>
-#include <compat/ia32/ia32_signal.h>
-#include <x86/include/psl.h>
-#include <x86/include/segments.h>
-#include <x86/include/specialreg.h>
-
-char ia32_sigcode[] = {
- 0xff, 0x54, 0x24, 0x10, /* call *SIGF_HANDLER(%esp) */
- 0x8d, 0x44, 0x24, 0x14, /* lea SIGF_UC(%esp),%eax */
- 0x50, /* pushl %eax */
- 0xf7, 0x40, 0x54, 0x00, 0x00, 0x02, 0x02, /* testl $PSL_VM,UC_EFLAGS(%ea
-x) */
- 0x75, 0x03, /* jne 9f */
- 0x8e, 0x68, 0x14, /* movl UC_GS(%eax),%gs */
- 0xb8, 0x57, 0x01, 0x00, 0x00, /* 9: movl $SYS_sigreturn,%eax */
- 0x50, /* pushl %eax */
- 0xcd, 0x80, /* int $0x80 */
- 0xeb, 0xfe, /* 0: jmp 0b */
- 0
-};
-int sz_ia32_sigcode = sizeof(ia32_sigcode);
-
-#ifdef COMPAT_43
-int
-ofreebsd32_sigreturn(struct thread *td, struct ofreebsd32_sigreturn_args *uap)
-{
-
- return (EOPNOTSUPP);
-}
-#endif
-
-/*
- * Signal sending has not been implemented on ia64. This causes
- * the sigtramp code to not understand the arguments and the application
- * will generally crash if it tries to handle a signal. Calling
- * sendsig() means that at least untrapped signals will work.
- */
-void
-ia32_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
-{
- sendsig(catcher, ksi, mask);
-}
-
-#ifdef COMPAT_FREEBSD4
-int
-freebsd4_freebsd32_sigreturn(struct thread *td, struct freebsd4_freebsd32_sigreturn_args *uap)
-{
- return (sys_sigreturn(td, (struct sigreturn_args *)uap));
-}
-#endif
-
-int
-freebsd32_sigreturn(struct thread *td, struct freebsd32_sigreturn_args *uap)
-{
- return (sys_sigreturn(td, (struct sigreturn_args *)uap));
-}
-
-
-void
-ia32_setregs(struct thread *td, struct image_params *imgp, u_long stack)
-{
- struct trapframe *tf = td->td_frame;
- vm_offset_t gdt, ldt;
- u_int64_t codesel, datasel, ldtsel;
- u_int64_t codeseg, dataseg, gdtseg, ldtseg;
- struct segment_descriptor desc;
- struct vmspace *vmspace = td->td_proc->p_vmspace;
- struct sysentvec *sv;
-
- sv = td->td_proc->p_sysent;
- exec_setregs(td, imgp, stack);
-
- /* Non-syscall frames are cleared by exec_setregs() */
- if (tf->tf_flags & FRAME_SYSCALL) {
- bzero(&tf->tf_scratch, sizeof(tf->tf_scratch));
- bzero(&tf->tf_scratch_fp, sizeof(tf->tf_scratch_fp));
- } else
- tf->tf_special.ndirty = 0;
-
- tf->tf_special.psr |= IA64_PSR_IS;
- tf->tf_special.sp = stack;
-
- /* Point the RSE backstore to something harmless. */
- tf->tf_special.bspstore = (sv->sv_psstrings - sz_ia32_sigcode -
- SPARE_USRSPACE + 15) & ~15;
-
- codesel = LSEL(LUCODE_SEL, SEL_UPL);
- datasel = LSEL(LUDATA_SEL, SEL_UPL);
- ldtsel = GSEL(GLDT_SEL, SEL_UPL);
-
- /* Setup ia32 segment registers. */
- tf->tf_scratch.gr16 = (datasel << 48) | (datasel << 32) |
- (datasel << 16) | datasel;
- tf->tf_scratch.gr17 = (ldtsel << 32) | (datasel << 16) | codesel;
-
- /*
- * Build the GDT and LDT.
- */
- gdt = sv->sv_usrstack;
- vm_map_find(&vmspace->vm_map, NULL, 0, &gdt, IA32_PAGE_SIZE << 1, 0,
- VMFS_NO_SPACE, VM_PROT_ALL, VM_PROT_ALL, 0);
- ldt = gdt + IA32_PAGE_SIZE;
-
- desc.sd_lolimit = 8*NLDT-1;
- desc.sd_lobase = ldt & 0xffffff;
- desc.sd_type = SDT_SYSLDT;
- desc.sd_dpl = SEL_UPL;
- desc.sd_p = 1;
- desc.sd_hilimit = 0;
- desc.sd_def32 = 0;
- desc.sd_gran = 0;
- desc.sd_hibase = ldt >> 24;
- copyout(&desc, (caddr_t) gdt + 8*GLDT_SEL, sizeof(desc));
-
- desc.sd_lolimit = ((sv->sv_usrstack >> 12) - 1) & 0xffff;
- desc.sd_lobase = 0;
- desc.sd_type = SDT_MEMERA;
- desc.sd_dpl = SEL_UPL;
- desc.sd_p = 1;
- desc.sd_hilimit = ((sv->sv_usrstack >> 12) - 1) >> 16;
- desc.sd_def32 = 1;
- desc.sd_gran = 1;
- desc.sd_hibase = 0;
- copyout(&desc, (caddr_t) ldt + 8*LUCODE_SEL, sizeof(desc));
- desc.sd_type = SDT_MEMRWA;
- copyout(&desc, (caddr_t) ldt + 8*LUDATA_SEL, sizeof(desc));
-
- codeseg = 0 /* base */
- + (((sv->sv_usrstack >> 12) - 1) << 32) /* limit */
- + ((long)SDT_MEMERA << 52)
- + ((long)SEL_UPL << 57)
- + (1L << 59) /* present */
- + (1L << 62) /* 32 bits */
- + (1L << 63); /* page granularity */
- dataseg = 0 /* base */
- + (((sv->sv_usrstack >> 12) - 1) << 32) /* limit */
- + ((long)SDT_MEMRWA << 52)
- + ((long)SEL_UPL << 57)
- + (1L << 59) /* present */
- + (1L << 62) /* 32 bits */
- + (1L << 63); /* page granularity */
-
- tf->tf_scratch.csd = codeseg;
- tf->tf_scratch.ssd = dataseg;
- tf->tf_scratch.gr24 = dataseg; /* ESD */
- tf->tf_scratch.gr27 = dataseg; /* DSD */
- tf->tf_scratch.gr28 = dataseg; /* FSD */
- tf->tf_scratch.gr29 = dataseg; /* GSD */
-
- gdtseg = gdt /* base */
- + ((8L*NGDT - 1) << 32) /* limit */
- + ((long)SDT_SYSNULL << 52)
- + ((long)SEL_UPL << 57)
- + (1L << 59) /* present */
- + (0L << 62) /* 16 bits */
- + (0L << 63); /* byte granularity */
- ldtseg = ldt /* base */
- + ((8L*NLDT - 1) << 32) /* limit */
- + ((long)SDT_SYSLDT << 52)
- + ((long)SEL_UPL << 57)
- + (1L << 59) /* present */
- + (0L << 62) /* 16 bits */
- + (0L << 63); /* byte granularity */
-
- tf->tf_scratch.gr30 = ldtseg; /* LDTD */
- tf->tf_scratch.gr31 = gdtseg; /* GDTD */
-
- /* Set ia32 control registers on this processor. */
- ia64_set_cflg(CR0_PE | CR0_PG | ((long)(CR4_XMM | CR4_FXSR) << 32));
- ia64_set_eflag(PSL_USER);
-
- /* PS_STRINGS value for BSD/OS binaries. It is 0 for non-BSD/OS. */
- tf->tf_scratch.gr11 = td->td_proc->p_sysent->sv_psstrings;
-
- /*
- * XXX - Linux emulator
- * Make sure sure edx is 0x0 on entry. Linux binaries depend
- * on it.
- */
- td->td_retval[1] = 0;
-}
-
-void
-ia32_restorectx(struct pcb *pcb)
-{
-
- ia64_set_cflg(pcb->pcb_ia32_cflg);
- ia64_set_eflag(pcb->pcb_ia32_eflag);
- ia64_set_fcr(pcb->pcb_ia32_fcr);
- ia64_set_fdr(pcb->pcb_ia32_fdr);
- ia64_set_fir(pcb->pcb_ia32_fir);
- ia64_set_fsr(pcb->pcb_ia32_fsr);
-}
-
-void
-ia32_savectx(struct pcb *pcb)
-{
-
- pcb->pcb_ia32_cflg = ia64_get_cflg();
- pcb->pcb_ia32_eflag = ia64_get_eflag();
- pcb->pcb_ia32_fcr = ia64_get_fcr();
- pcb->pcb_ia32_fdr = ia64_get_fdr();
- pcb->pcb_ia32_fir = ia64_get_fir();
- pcb->pcb_ia32_fsr = ia64_get_fsr();
-}
-
-int
-freebsd32_getcontext(struct thread *td, struct freebsd32_getcontext_args *uap)
-{
-
- return (nosys(td, NULL));
-}
-
-int
-freebsd32_setcontext(struct thread *td, struct freebsd32_setcontext_args *uap)
-{
-
- return (nosys(td, NULL));
-}
-
-int
-freebsd32_swapcontext(struct thread *td, struct freebsd32_swapcontext_args *uap)
-{
-
- return (nosys(td, NULL));
-}
diff --git a/sys/ia64/ia32/ia32_trap.c b/sys/ia64/ia32/ia32_trap.c
deleted file mode 100644
index cea8f92..0000000
--- a/sys/ia64/ia32/ia32_trap.c
+++ /dev/null
@@ -1,282 +0,0 @@
-/*-
- * Copyright (c) 2004 Marcel Moolenaar
- * All rights reserved.
- *
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/ktr.h>
-#include <sys/sysproto.h>
-#include <sys/kernel.h>
-#include <sys/lock.h>
-#include <sys/mutex.h>
-#include <sys/pioctl.h>
-#include <sys/proc.h>
-#include <sys/ptrace.h>
-#include <sys/signalvar.h>
-#include <sys/syscall.h>
-#include <sys/sysent.h>
-#include <machine/cpu.h>
-#include <machine/fpu.h>
-#include <machine/frame.h>
-#include <machine/md_var.h>
-#include <x86/include/psl.h>
-
-#include <security/audit/audit.h>
-
-#include <compat/ia32/ia32_util.h>
-
-void
-ia32_set_syscall_retval(struct thread *td, int error)
-{
- struct proc *p;
- struct trapframe *tf;
-
- tf = td->td_frame;
-
- switch (error) {
- case 0:
- tf->tf_scratch.gr8 = td->td_retval[0]; /* eax */
- tf->tf_scratch.gr10 = td->td_retval[1]; /* edx */
- ia64_set_eflag(ia64_get_eflag() & ~PSL_C);
- break;
-
- case ERESTART:
- /*
- * Reconstruct pc, assuming lcall $X,y is 7 bytes,
- * int 0x80 is 2 bytes. XXX Assume int 0x80.
- */
- tf->tf_special.iip -= 2;
- break;
-
- case EJUSTRETURN:
- break;
-
- default:
- p = td->td_proc;
- if (p->p_sysent->sv_errsize) {
- if (error >= p->p_sysent->sv_errsize)
- error = -1; /* XXX */
- else
- error = p->p_sysent->sv_errtbl[error];
- }
- tf->tf_scratch.gr8 = error;
- ia64_set_eflag(ia64_get_eflag() | PSL_C);
- break;
- }
-}
-
-int
-ia32_fetch_syscall_args(struct thread *td, struct syscall_args *sa)
-{
- struct trapframe *tf;
- struct proc *p;
- uint32_t args[8];
- caddr_t params;
- int error, i;
-
- tf = td->td_frame;
- p = td->td_proc;
-
- params = (caddr_t)(tf->tf_special.sp & ((1L<<32)-1)) +
- sizeof(uint32_t);
- sa->code = tf->tf_scratch.gr8; /* eax */
-
- if (sa->code == SYS_syscall) {
- /* Code is first argument, followed by actual args. */
- sa->code = fuword32(params);
- params += sizeof(int);
- } else if (sa->code == SYS___syscall) {
- /*
- * Like syscall, but code is a quad, so as to maintain
- * quad alignment for the rest of the arguments. We
- * use a 32-bit fetch in case params is not aligned.
- */
- sa->code = fuword32(params);
- params += sizeof(quad_t);
- }
-
- if (p->p_sysent->sv_mask)
- sa->code &= p->p_sysent->sv_mask;
- if (sa->code >= p->p_sysent->sv_size)
- sa->callp = &p->p_sysent->sv_table[0];
- else
- sa->callp = &p->p_sysent->sv_table[sa->code];
- sa->narg = sa->callp->sy_narg;
-
- if (params != NULL && sa->narg != 0)
- error = copyin(params, (caddr_t)args, sa->narg * sizeof(int));
- else
- error = 0;
- sa->args = &sa->args32[0];
-
- if (error == 0) {
- for (i = 0; i < sa->narg; i++)
- sa->args32[i] = args[i];
- td->td_retval[0] = 0;
- td->td_retval[1] = tf->tf_scratch.gr10; /* edx */
- }
-
- return (error);
-}
-
-#include "../../kern/subr_syscall.c"
-
-static void
-ia32_syscall(struct trapframe *tf)
-{
- struct thread *td;
- struct syscall_args sa;
- register_t eflags;
- int error;
- ksiginfo_t ksi;
-
- td = curthread;
- eflags = ia64_get_eflag();
-
- error = syscallenter(td, &sa);
-
- /*
- * Traced syscall.
- */
- if ((eflags & PSL_T) && !(eflags & PSL_VM)) {
- ia64_set_eflag(ia64_get_eflag() & ~PSL_T);
- ksiginfo_init_trap(&ksi);
- ksi.ksi_signo = SIGTRAP;
- ksi.ksi_code = TRAP_TRACE;
- ksi.ksi_addr = (void *)tf->tf_special.iip;
- trapsignal(td, &ksi);
- }
-
- syscallret(td, error, &sa);
-}
-
-/*
- * ia32_trap() is called from exception.S to handle the IA-32 specific
- * interruption vectors.
- */
-void
-ia32_trap(int vector, struct trapframe *tf)
-{
- struct proc *p;
- struct thread *td;
- uint64_t ucode;
- int sig;
- ksiginfo_t ksi;
-
- KASSERT(TRAPF_USERMODE(tf), ("%s: In kernel mode???", __func__));
-
- ia64_set_fpsr(IA64_FPSR_DEFAULT);
- PCPU_INC(cnt.v_trap);
-
- td = curthread;
- td->td_frame = tf;
- td->td_pticks = 0;
- p = td->td_proc;
- if (td->td_ucred != p->p_ucred)
- cred_update_thread(td);
- sig = 0;
- ucode = 0;
- switch (vector) {
- case IA64_VEC_IA32_EXCEPTION:
- switch ((tf->tf_special.isr >> 16) & 0xffff) {
- case IA32_EXCEPTION_DIVIDE:
- ucode = FPE_INTDIV;
- sig = SIGFPE;
- break;
- case IA32_EXCEPTION_DEBUG:
- case IA32_EXCEPTION_BREAK:
- sig = SIGTRAP;
- break;
- case IA32_EXCEPTION_OVERFLOW:
- ucode = FPE_INTOVF;
- sig = SIGFPE;
- break;
- case IA32_EXCEPTION_BOUND:
- ucode = FPE_FLTSUB;
- sig = SIGFPE;
- break;
- case IA32_EXCEPTION_DNA:
- ucode = 0;
- sig = SIGFPE;
- break;
- case IA32_EXCEPTION_NOT_PRESENT:
- case IA32_EXCEPTION_STACK_FAULT:
- case IA32_EXCEPTION_GPFAULT:
- ucode = (tf->tf_special.isr & 0xffff) + BUS_SEGM_FAULT;
- sig = SIGBUS;
- break;
- case IA32_EXCEPTION_FPERROR:
- ucode = 0; /* XXX */
- sig = SIGFPE;
- break;
- case IA32_EXCEPTION_ALIGNMENT_CHECK:
- ucode = tf->tf_special.ifa; /* VA */
- sig = SIGBUS;
- break;
- case IA32_EXCEPTION_STREAMING_SIMD:
- ucode = 0; /* XXX */
- sig = SIGFPE;
- break;
- default:
- trap_panic(vector, tf);
- break;
- }
- break;
-
- case IA64_VEC_IA32_INTERCEPT:
- /* XXX Maybe need to emulate ia32 instruction. */
- trap_panic(vector, tf);
-
- case IA64_VEC_IA32_INTERRUPT:
- /* INT n instruction - probably a syscall. */
- if (((tf->tf_special.isr >> 16) & 0xffff) == 0x80) {
- ia32_syscall(tf);
- goto out;
- }
- ucode = (tf->tf_special.isr >> 16) & 0xffff;
- sig = SIGILL;
- break;
-
- default:
- /* Should never happen of course. */
- trap_panic(vector, tf);
- break;
- }
-
- KASSERT(sig != 0, ("%s: signal not set", __func__));
-
- ksiginfo_init_trap(&ksi);
- ksi.ksi_signo = sig;
- ksi.ksi_code = (int)ucode; /* XXX */
- /* ksi.ksi_addr */
- trapsignal(td, &ksi);
-
-out:
- userret(td, tf);
- do_ast(tf);
-}
OpenPOWER on IntegriCloud