diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-06-25 20:56:20 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-06-25 20:56:20 +0000 |
commit | c2bdf2c95fd132fc95b12bbaadf6805d3ddfd2a7 (patch) | |
tree | edf6f278427f1ac539d2873c97a9734b3846bd74 /sys/arch/hp300 | |
parent | ab284f4be300652ef057b9bcfd19529052975eac (diff) |
MID_M68K is the default now (with backwards compat for MID_M68K4K
Diffstat (limited to 'sys/arch/hp300')
-rw-r--r-- | sys/arch/hp300/hp300/machdep.c | 52 | ||||
-rw-r--r-- | sys/arch/hp300/include/exec.h | 9 | ||||
-rw-r--r-- | sys/arch/hp300/include/param.h | 2 |
3 files changed, 61 insertions, 2 deletions
diff --git a/sys/arch/hp300/hp300/machdep.c b/sys/arch/hp300/hp300/machdep.c index 81ca8c003dd..01195a65679 100644 --- a/sys/arch/hp300/hp300/machdep.c +++ b/sys/arch/hp300/hp300/machdep.c @@ -1634,6 +1634,11 @@ cpu_exec_aout_makecmds(p, epp) midmag = mid << 16 | magic; switch (midmag) { +#if defined(COMPAT_M68K4K) + case (MID_M68K4K << 16) | ZMAGIC: + error = cpu_exec_aout_prep_m68k4k(p, epp); + break; +#endif #ifdef COMPAT_NOMID case (MID_ZERO << 16) | ZMAGIC: error = exec_aout_prep_oldzmagic(p, epp); @@ -1653,3 +1658,50 @@ cpu_exec_aout_makecmds(p, epp) return ENOEXEC; #endif } + +#if defined(COMPAT_M68K4K) +int +cpu_exec_aout_prep_m68k4k(p, epp) + struct proc *p; + struct exec_package *epp; +{ + struct exec *execp = epp->ep_hdr; + + epp->ep_taddr = 4096; + epp->ep_tsize = execp->a_text; + epp->ep_daddr = epp->ep_taddr + execp->a_text; + epp->ep_dsize = execp->a_data + execp->a_bss; + epp->ep_entry = execp->a_entry; + + /* + * check if vnode is in open for writing, because we want to + * demand-page out of it. if it is, don't do it, for various + * reasons + */ + if ((execp->a_text != 0 || execp->a_data != 0) && + epp->ep_vp->v_writecount != 0) { +#ifdef DIAGNOSTIC + if (epp->ep_vp->v_flag & VTEXT) + panic("exec: a VTEXT vnode has writecount != 0\n"); +#endif + return ETXTBSY; + } + epp->ep_vp->v_flag |= VTEXT; + + /* set up command for text segment */ + NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_pagedvn, execp->a_text, + epp->ep_taddr, epp->ep_vp, 0, VM_PROT_READ|VM_PROT_EXECUTE); + + /* set up command for data segment */ + NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_pagedvn, execp->a_data, + epp->ep_daddr, epp->ep_vp, execp->a_text, + VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE); + + /* set up command for bss segment */ + NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero, execp->a_bss, + epp->ep_daddr + execp->a_data, NULLVP, 0, + VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE); + + return exec_aout_setup_stack(p, epp); +} +#endif /* COMPAT_M68K4K */ diff --git a/sys/arch/hp300/include/exec.h b/sys/arch/hp300/include/exec.h index 5e068296ea5..b19b2fda177 100644 --- a/sys/arch/hp300/include/exec.h +++ b/sys/arch/hp300/include/exec.h @@ -30,7 +30,7 @@ #ifndef _MACHINE_EXEC_H_ #define _MACHINE_EXEC_H_ -#define __LDPGSZ 4096 +#define __LDPGSZ 8192 /* Relocation format. */ struct relocation_info_m68k { @@ -46,4 +46,11 @@ struct relocation_info_m68k { }; #define relocation_info relocation_info_m68k +#define ELF_TARG_CLASS ELFCLASS32 +#define ELF_TARG_DATA ELFDATA2MSB +#define ELF_TARG_MACH EM_68K + +#define DO_AOUT /* support a.out */ +#define DO_ELF /* support ELF */ + #endif /* _MACHINE_EXEC_H_ */ diff --git a/sys/arch/hp300/include/param.h b/sys/arch/hp300/include/param.h index 11d963389d1..6b7edddb9f9 100644 --- a/sys/arch/hp300/include/param.h +++ b/sys/arch/hp300/include/param.h @@ -49,7 +49,7 @@ #define MACHINE "hp300" #define _MACHINE_ARCH m68k #define MACHINE_ARCH "m68k" -#define MID_MACHINE MID_M68K4K +#define MID_MACHINE MID_M68K /* * Round p (pointer or byte index) up to a correctly-aligned value for all |