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.
This commit is contained in:
parent
468071c356
commit
9c0fed3dcf
@ -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.
|
||||
*/
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user