diff options
author | dfr <dfr@FreeBSD.org> | 1998-12-30 10:38:59 +0000 |
---|---|---|
committer | dfr <dfr@FreeBSD.org> | 1998-12-30 10:38:59 +0000 |
commit | 9aad9d912f0ea64471669ecde4beea9e9ead4989 (patch) | |
tree | 26f76c3cf94310fcb261c62fe3f86fbe1b71440e /sys | |
parent | 14201fe4faa19db2e4da4f4944573149b4654cb8 (diff) | |
download | FreeBSD-src-9aad9d912f0ea64471669ecde4beea9e9ead4989.zip FreeBSD-src-9aad9d912f0ea64471669ecde4beea9e9ead4989.tar.gz |
Various changes to support OSF1 emulation:
* Move the user stack from VM_MAXUSER_ADDRESS to a place below the 32bit
boundary (needed to support 32bit OSF programs). This should also save
one pagetable per process.
* Add cvtqlsv to the set of instructions handled by the floating point
software completion code.
* Disable all floating point exceptions by default.
* A minor change to execve to allow the OSF1 image activator to support
dynamic loading.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/alpha/alpha/fp_emulate.c | 34 | ||||
-rw-r--r-- | sys/alpha/alpha/machdep.c | 10 | ||||
-rw-r--r-- | sys/alpha/alpha/trap.c | 5 | ||||
-rw-r--r-- | sys/alpha/alpha/vm_machdep.c | 10 | ||||
-rw-r--r-- | sys/alpha/include/vmparam.h | 12 | ||||
-rw-r--r-- | sys/kern/init_main.c | 4 | ||||
-rw-r--r-- | sys/kern/kern_exec.c | 11 | ||||
-rw-r--r-- | sys/powerpc/aim/vm_machdep.c | 10 | ||||
-rw-r--r-- | sys/powerpc/powerpc/vm_machdep.c | 10 | ||||
-rw-r--r-- | sys/sys/imgact.h | 3 |
10 files changed, 69 insertions, 40 deletions
diff --git a/sys/alpha/alpha/fp_emulate.c b/sys/alpha/alpha/fp_emulate.c index 32ec7ee..d6dc165 100644 --- a/sys/alpha/alpha/fp_emulate.c +++ b/sys/alpha/alpha/fp_emulate.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: fp_emulate.c,v 1.1 1998/12/04 10:52:47 dfr Exp $ */ #include <sys/param.h> @@ -208,6 +208,17 @@ static fp_register_t fp_reserved(union alpha_instruction ins, return GETREG(fpregs, ins.f_format.fc); } +static fp_register_t fp_cvtql(union alpha_instruction ins, + int src, int rnd, + u_int64_t control, u_int64_t *status, + struct fpreg *fpregs) + +{ + fp_register_t fb = GETREG(fpregs, ins.f_format.fb); + *status |= FPCR_INV; + return ((fb.q & 0xc0000000) << 32 | (fb.q & 0x3fffffff) << 29); +} + static int fp_emulate(union alpha_instruction ins, struct proc *p) { u_int64_t control = p->p_addr->u_pcb.pcb_fp_control; @@ -235,11 +246,13 @@ static int fp_emulate(union alpha_instruction ins, struct proc *p) u_int64_t status; /* - * Only attempt to emulate ieee instructions. + * Only attempt to emulate ieee instructions & integer overflow */ - if (ins.common.opcode != op_flti) + if ((ins.common.opcode != op_flti) && + (ins.f_format.function != fltl_cvtqlsv)){ + printf("fp_emulate: unhandled opcode = 0x%x, fun = 0x%x\n",ins.common.opcode,ins.f_format.function); return 0; - + } /* * Dump the float registers into the pcb so we can get at * them. @@ -259,10 +272,15 @@ static int fp_emulate(union alpha_instruction ins, struct proc *p) if (rnd == 3) rnd = (fpregs->fpr_cr >> FPCR_DYN_SHIFT) & 3; status = 0; - result = ops[ins.f_format.function & 0xf](ins, src, rnd, - control, &status, - fpregs); - + if (ins.common.opcode == op_fltl + && ins.f_format.function == fltl_cvtqlsv) + result = fp_cvtql(ins, src, rnd, control, &status, + fpregs); + else + result = ops[ins.f_format.function & 0xf](ins, src, rnd, + control, &status, + fpregs); + /* * Handle exceptions. */ diff --git a/sys/alpha/alpha/machdep.c b/sys/alpha/alpha/machdep.c index 39090de..64de963 100644 --- a/sys/alpha/alpha/machdep.c +++ b/sys/alpha/alpha/machdep.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: machdep.c,v 1.27 1998/12/16 16:28:56 bde Exp $ + * $Id: machdep.c,v 1.28 1998/12/23 11:50:50 dfr Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -1474,11 +1474,11 @@ setregs(struct proc *p, u_long entry, u_long stack) bzero(tfp->tf_regs, FRAME_SIZE * sizeof tfp->tf_regs[0]); bzero(&p->p_addr->u_pcb.pcb_fp, sizeof p->p_addr->u_pcb.pcb_fp); - p->p_addr->u_pcb.pcb_fp_control = (IEEE_TRAP_ENABLE_INV - | IEEE_TRAP_ENABLE_DZE - | IEEE_TRAP_ENABLE_OVF); + p->p_addr->u_pcb.pcb_fp_control = 0; p->p_addr->u_pcb.pcb_fp.fpr_cr = (FPCR_DYN_NORMAL - | FPCR_INED | FPCR_UNFD); + | FPCR_INVD | FPCR_DZED + | FPCR_OVFD | FPCR_INED + | FPCR_UNFD); alpha_pal_wrusp(stack); tfp->tf_regs[FRAME_PS] = ALPHA_PSL_USERSET; diff --git a/sys/alpha/alpha/trap.c b/sys/alpha/alpha/trap.c index 1811faca..107f1b0 100644 --- a/sys/alpha/alpha/trap.c +++ b/sys/alpha/alpha/trap.c @@ -1,4 +1,4 @@ -/* $Id: trap.c,v 1.8 1998/12/04 22:54:42 archie Exp $ */ +/* $Id: trap.c,v 1.9 1998/12/16 15:21:50 bde Exp $ */ /* $NetBSD: trap.c,v 1.31 1998/03/26 02:21:46 thorpej Exp $ */ /* @@ -450,7 +450,8 @@ trap(a0, a1, a2, entry, framep) * we need to reflect that as an access error. */ if (map != kernel_map && - (caddr_t)va >= vm->vm_maxsaddr) { + (caddr_t)va >= vm->vm_maxsaddr + && (caddr_t)va < (caddr_t)USRSTACK) { if (rv == KERN_SUCCESS) { unsigned nss; diff --git a/sys/alpha/alpha/vm_machdep.c b/sys/alpha/alpha/vm_machdep.c index e850785..592a089 100644 --- a/sys/alpha/alpha/vm_machdep.c +++ b/sys/alpha/alpha/vm_machdep.c @@ -38,7 +38,7 @@ * * from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91 * Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$ - * $Id: vm_machdep.c,v 1.5 1998/12/04 10:52:47 dfr Exp $ + * $Id: vm_machdep.c,v 1.6 1998/12/16 15:21:50 bde Exp $ */ /* * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. @@ -151,11 +151,11 @@ cpu_fork(p1, p2) * Set the floating point state. */ if ((p2->p_addr->u_pcb.pcb_fp_control & IEEE_INHERIT) == 0) { - p2->p_addr->u_pcb.pcb_fp_control = (IEEE_TRAP_ENABLE_INV - | IEEE_TRAP_ENABLE_DZE - | IEEE_TRAP_ENABLE_OVF); + p2->p_addr->u_pcb.pcb_fp_control = 0; p2->p_addr->u_pcb.pcb_fp.fpr_cr = (FPCR_DYN_NORMAL - | FPCR_INED | FPCR_UNFD); + | FPCR_INVD | FPCR_DZED + | FPCR_OVFD | FPCR_INED + | FPCR_UNFD); } /* diff --git a/sys/alpha/include/vmparam.h b/sys/alpha/include/vmparam.h index fead056..04c62a6 100644 --- a/sys/alpha/include/vmparam.h +++ b/sys/alpha/include/vmparam.h @@ -1,4 +1,4 @@ -/* $Id: vmparam.h,v 1.2 1998/06/10 10:55:30 dfr Exp $ */ +/* $Id: vmparam.h,v 1.3 1998/06/14 13:45:15 dfr Exp $ */ /* From: NetBSD: vmparam.h,v 1.6 1997/09/23 23:23:23 mjacob Exp */ #ifndef _ALPHA_VMPARAM_H #define _ALPHA_VMPARAM_H @@ -54,7 +54,15 @@ * kernel stack. */ #define USRTEXT CLBYTES -#define USRSTACK VM_MAXUSER_ADDRESS +/* #define USRSTACK VM_MAXUSER_ADDRESS */ + +/* + * This stack location is suitable for OSF1 emulation. Some OSF + * programs are built as 32bit and assume that the stack is reachable + * with a 32bit value. OSF1 manages to have a variable location for + * the user stack which we should probably also support. + */ +#define USRSTACK (0x12000000LL - (UPAGES*PAGE_SIZE)) /* * Virtual memory related constants, all in bytes diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index 609e001..9269b26 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -39,7 +39,7 @@ * SUCH DAMAGE. * * @(#)init_main.c 8.9 (Berkeley) 1/21/94 - * $Id: init_main.c,v 1.100 1998/12/19 02:55:33 julian Exp $ + * $Id: init_main.c,v 1.101 1998/12/19 08:23:31 julian Exp $ */ #include "opt_devfs.h" @@ -636,7 +636,7 @@ start_init(p) /* * Need just enough stack to hold the faked-up "execve()" arguments. */ - addr = trunc_page(VM_MAXUSER_ADDRESS - PAGE_SIZE); + addr = trunc_page(USRSTACK - PAGE_SIZE); if (vm_map_find(&p->p_vmspace->vm_map, NULL, 0, &addr, PAGE_SIZE, FALSE, VM_PROT_ALL, VM_PROT_ALL, 0) != 0) panic("init: couldn't allocate argument space"); p->p_vmspace->vm_maxsaddr = (caddr_t)addr; diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 93e7bbd..fc23c6e 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: kern_exec.c,v 1.90 1998/12/16 16:28:57 bde Exp $ + * $Id: kern_exec.c,v 1.91 1998/12/27 18:03:29 dfr Exp $ */ #include <sys/param.h> @@ -149,6 +149,7 @@ interpret: } imgp->vp = ndp->ni_vp; + imgp->fname = uap->fname; /* * Check file permissions (also 'opens' file) @@ -323,8 +324,8 @@ exec_fail_dealloc: kmem_free_wakeup(exec_map, (vm_offset_t)imgp->stringbase, ARG_MAX + PAGE_SIZE); - if (ndp->ni_vp) { - vrele(ndp->ni_vp); + if (imgp->vp) { + vrele(imgp->vp); zfree(namei_zone, ndp->ni_cnd.cn_pnbuf); } @@ -438,8 +439,8 @@ exec_new_vmspace(imgp) if (vmspace->vm_refcnt == 1) { if (vmspace->vm_shm) shmexit(imgp->proc); - pmap_remove_pages(&vmspace->vm_pmap, 0, USRSTACK); - vm_map_remove(map, 0, USRSTACK); + pmap_remove_pages(&vmspace->vm_pmap, 0, VM_MAXUSER_ADDRESS); + vm_map_remove(map, 0, VM_MAXUSER_ADDRESS); } else { vmspace_exec(imgp->proc); vmspace = imgp->proc->p_vmspace; diff --git a/sys/powerpc/aim/vm_machdep.c b/sys/powerpc/aim/vm_machdep.c index e850785..592a089 100644 --- a/sys/powerpc/aim/vm_machdep.c +++ b/sys/powerpc/aim/vm_machdep.c @@ -38,7 +38,7 @@ * * from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91 * Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$ - * $Id: vm_machdep.c,v 1.5 1998/12/04 10:52:47 dfr Exp $ + * $Id: vm_machdep.c,v 1.6 1998/12/16 15:21:50 bde Exp $ */ /* * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. @@ -151,11 +151,11 @@ cpu_fork(p1, p2) * Set the floating point state. */ if ((p2->p_addr->u_pcb.pcb_fp_control & IEEE_INHERIT) == 0) { - p2->p_addr->u_pcb.pcb_fp_control = (IEEE_TRAP_ENABLE_INV - | IEEE_TRAP_ENABLE_DZE - | IEEE_TRAP_ENABLE_OVF); + p2->p_addr->u_pcb.pcb_fp_control = 0; p2->p_addr->u_pcb.pcb_fp.fpr_cr = (FPCR_DYN_NORMAL - | FPCR_INED | FPCR_UNFD); + | FPCR_INVD | FPCR_DZED + | FPCR_OVFD | FPCR_INED + | FPCR_UNFD); } /* diff --git a/sys/powerpc/powerpc/vm_machdep.c b/sys/powerpc/powerpc/vm_machdep.c index e850785..592a089 100644 --- a/sys/powerpc/powerpc/vm_machdep.c +++ b/sys/powerpc/powerpc/vm_machdep.c @@ -38,7 +38,7 @@ * * from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91 * Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$ - * $Id: vm_machdep.c,v 1.5 1998/12/04 10:52:47 dfr Exp $ + * $Id: vm_machdep.c,v 1.6 1998/12/16 15:21:50 bde Exp $ */ /* * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. @@ -151,11 +151,11 @@ cpu_fork(p1, p2) * Set the floating point state. */ if ((p2->p_addr->u_pcb.pcb_fp_control & IEEE_INHERIT) == 0) { - p2->p_addr->u_pcb.pcb_fp_control = (IEEE_TRAP_ENABLE_INV - | IEEE_TRAP_ENABLE_DZE - | IEEE_TRAP_ENABLE_OVF); + p2->p_addr->u_pcb.pcb_fp_control = 0; p2->p_addr->u_pcb.pcb_fp.fpr_cr = (FPCR_DYN_NORMAL - | FPCR_INED | FPCR_UNFD); + | FPCR_INVD | FPCR_DZED + | FPCR_OVFD | FPCR_INED + | FPCR_UNFD); } /* diff --git a/sys/sys/imgact.h b/sys/sys/imgact.h index 8c3a787..04bafba 100644 --- a/sys/sys/imgact.h +++ b/sys/sys/imgact.h @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: imgact.h,v 1.16 1998/01/11 21:34:43 dyson Exp $ + * $Id: imgact.h,v 1.17 1998/03/02 05:47:43 peter Exp $ */ #ifndef _SYS_IMGACT_H_ @@ -53,6 +53,7 @@ struct image_params { char interpreter_name[64]; /* name of the interpreter */ void *auxargs; /* ELF Auxinfo structure pointer */ struct vm_page *firstpage; /* first page that we mapped */ + char *fname; /* pointer to filename of executable (user space) */ }; #ifdef KERNEL |