From a638bad3ccf700d58115c5a248b7a07e31377afa Mon Sep 17 00:00:00 2001 From: downsj Date: Wed, 26 Mar 1997 08:11:04 +0000 Subject: [PATCH] Merge in NetBSD changes as if 3/19/97, undo some of ours. --- sys/compat/hpux/hpux_compat.c | 8 +++--- sys/compat/hpux/hpux_exec.c | 43 ++++++++++++++---------------- sys/compat/hpux/hpux_exec.h | 20 +++++++------- sys/compat/hpux/hpux_syscallargs.h | 6 ++++- sys/compat/hpux/hpux_sysent.c | 5 ++-- sys/compat/hpux/syscalls.master | 11 +++++--- 6 files changed, 48 insertions(+), 45 deletions(-) diff --git a/sys/compat/hpux/hpux_compat.c b/sys/compat/hpux/hpux_compat.c index ac6bf224d4e..1146a725a05 100644 --- a/sys/compat/hpux/hpux_compat.c +++ b/sys/compat/hpux/hpux_compat.c @@ -1,5 +1,5 @@ -/* $OpenBSD: hpux_compat.c,v 1.7 1997/02/23 21:40:55 downsj Exp $ */ -/* $NetBSD: hpux_compat.c,v 1.23 1996/01/06 12:44:11 thorpej Exp $ */ +/* $OpenBSD: hpux_compat.c,v 1.8 1997/03/26 08:11:04 downsj Exp $ */ +/* $NetBSD: hpux_compat.c,v 1.30 1997/03/16 10:13:12 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -107,7 +107,7 @@ int bsdtohpuxerrnomap[NERR] = { /*80*/ BERR,BERR, 11 }; -extern char hpux_sigcode[], hpux_esigcode[]; +extern char sigcode[], esigcode[]; extern struct sysent hpux_sysent[]; extern char *hpux_syscallnames[]; @@ -1191,8 +1191,6 @@ hpux_sys_getaccess(p, v, retval) /* hpux_to_bsd_uoff() is found in hpux_machdep.c */ -/* hpux_dumpu() is found in hpux_machdep.c */ - /* * Ancient HP-UX system calls. Some 9.x executables even use them! */ diff --git a/sys/compat/hpux/hpux_exec.c b/sys/compat/hpux/hpux_exec.c index 4020c38eb3a..20ae5217a80 100644 --- a/sys/compat/hpux/hpux_exec.c +++ b/sys/compat/hpux/hpux_exec.c @@ -1,8 +1,8 @@ -/* $OpenBSD: hpux_exec.c,v 1.7 1997/02/23 21:40:56 downsj Exp $ */ -/* $NetBSD: hpux_exec.c,v 1.3 1996/01/06 12:44:13 thorpej Exp $ */ +/* $OpenBSD: hpux_exec.c,v 1.8 1997/03/26 08:11:06 downsj Exp $ */ +/* $NetBSD: hpux_exec.c,v 1.8 1997/03/16 10:14:44 thorpej Exp $ */ /* - * Copyright (c) 1995 Jason R. Thorpe. All rights reserved. + * Copyright (c) 1995, 1997 Jason R. Thorpe. All rights reserved. * Copyright (c) 1993, 1994 Christopher G. Demetriou * * Redistribution and use in source and binary forms, with or without @@ -64,7 +64,7 @@ #include const char hpux_emul_path[] = "/emul/hpux"; -extern char hpux_sigcode[], hpux_esigcode[]; +extern char sigcode[], esigcode[]; extern struct sysent hpux_sysent[]; extern char *hpux_syscallnames[]; extern int bsdtohpuxerrnomap[]; @@ -76,17 +76,17 @@ static int exec_hpux_prep_omagic __P((struct proc *, struct exec_package *)); struct emul emul_hpux = { "hpux", bsdtohpuxerrnomap, - sendsig, + hpux_sendsig, HPUX_SYS_syscall, HPUX_SYS_MAXSYSCALL, hpux_sysent, hpux_syscallnames, 0, copyargs, - setregs, + hpux_setregs, NULL, - hpux_sigcode, - hpux_esigcode, + sigcode, + esigcode, }; int @@ -107,6 +107,13 @@ exec_hpux_makecmds(p, epp) if (sysid != MID_HPUX) return (ENOEXEC); + /* + * HP-UX is a 4k page size system, and executables assume + * this. + */ + if (NBPG != HPUX_LDPGSZ) + return (ENOEXEC); + switch (magic) { case OMAGIC: error = exec_hpux_prep_omagic(p, epp); @@ -140,7 +147,7 @@ exec_hpux_prep_nmagic(p, epp) epp->ep_taddr = 0; epp->ep_tsize = execp->ha_text; - epp->ep_daddr = epp->ep_taddr + roundup(execp->ha_text, HPUX__LDPGSZ); + epp->ep_daddr = epp->ep_taddr + roundup(execp->ha_text, HPUX_LDPGSZ); epp->ep_dsize = execp->ha_data + execp->ha_bss; epp->ep_entry = execp->ha_entry; @@ -172,7 +179,6 @@ exec_hpux_prep_zmagic(p, epp) struct hpux_exec *execp = epp->ep_hdr; long bsize, baddr; long nontext; - int (*vm_func) __P((struct proc *, struct exec_vmcmd *)); /* * Check if vnode is in open for writing, because we want to @@ -197,26 +203,17 @@ exec_hpux_prep_zmagic(p, epp) epp->ep_taddr = 0; epp->ep_tsize = execp->ha_text; - epp->ep_daddr = epp->ep_taddr + roundup(execp->ha_text, HPUX__LDPGSZ); + epp->ep_daddr = epp->ep_taddr + roundup(execp->ha_text, HPUX_LDPGSZ); epp->ep_dsize = execp->ha_data + execp->ha_bss; epp->ep_entry = execp->ha_entry; - /* - * If our __LDPGSZ doesn't match HP-UX's, we can't demand-page - * the executable. - */ - if (__LDPGSZ == HPUX__LDPGSZ) - vm_func = vmcmd_map_pagedvn; - else - vm_func = vmcmd_map_readvn; - /* set up command for text segment */ - NEW_VMCMD(&epp->ep_vmcmds, vm_func, execp->ha_text, + NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_pagedvn, execp->ha_text, epp->ep_taddr, epp->ep_vp, HPUX_TXTOFF(*execp, ZMAGIC), VM_PROT_READ|VM_PROT_EXECUTE); /* set up command for data segment */ - NEW_VMCMD(&epp->ep_vmcmds, vm_func, execp->ha_data, + NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_pagedvn, execp->ha_data, epp->ep_daddr, epp->ep_vp, HPUX_DATAOFF(*execp, ZMAGIC), VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE); @@ -243,7 +240,7 @@ exec_hpux_prep_omagic(p, epp) epp->ep_taddr = 0; epp->ep_tsize = execp->ha_text; - epp->ep_daddr = epp->ep_taddr + roundup(execp->ha_text, HPUX__LDPGSZ); + epp->ep_daddr = epp->ep_taddr + roundup(execp->ha_text, HPUX_LDPGSZ); epp->ep_dsize = execp->ha_data + execp->ha_bss; epp->ep_entry = execp->ha_entry; diff --git a/sys/compat/hpux/hpux_exec.h b/sys/compat/hpux/hpux_exec.h index fb46131e916..6a9f741d272 100644 --- a/sys/compat/hpux/hpux_exec.h +++ b/sys/compat/hpux/hpux_exec.h @@ -1,5 +1,5 @@ -/* $OpenBSD: hpux_exec.h,v 1.3 1996/08/02 20:34:54 niklas Exp $ */ -/* $NetBSD: hpux_exec.h,v 1.6 1995/11/28 08:39:45 thorpej Exp $ */ +/* $OpenBSD: hpux_exec.h,v 1.4 1997/03/26 08:11:07 downsj Exp $ */ +/* $NetBSD: hpux_exec.h,v 1.7 1997/03/16 10:16:02 thorpej Exp $ */ /* * Copyright (c) 1995 Jason R. Thorpe. All rights reserved. @@ -82,31 +82,31 @@ struct hpux_exec { #define HPUX_MAGIC_DL 0x010d /* dynamic load library */ #define HPUX_MAGIC_SHL 0x010e /* shared library */ -#define HPUX__LDPGSZ 4096 /* align to this */ -#define HPUX__LDPGSHIFT 12 /* log2(HPUX__LDPGSZ) */ +#define HPUX_LDPGSZ 4096 /* align to this */ +#define HPUX_LDPGSHIFT 12 /* log2(HPUX_LDPGSZ) */ -#define HPUX__SEGMENT_ROUND(x) \ - (((x) + HPUX__LDPGSZ - 1) & ~(HPUX__LDPGSZ - 1)) +#define HPUX_SEGMENT_ROUND(x) \ + (((x) + HPUX_LDPGSZ - 1) & ~(HPUX_LDPGSZ - 1)) #define HPUX_TXTOFF(x, m) \ ((((m) == ZMAGIC) || \ ((m) == HPUX_MAGIC_SHL) || \ ((m) == HPUX_MAGIC_DL)) ? \ - HPUX__LDPGSZ : HPUX_EXEC_HDR_SIZE) + HPUX_LDPGSZ : HPUX_EXEC_HDR_SIZE) #define HPUX_DATAOFF(x, m) \ ((((m) == ZMAGIC) || \ ((m) == HPUX_MAGIC_SHL) || \ ((m) == HPUX_MAGIC_DL)) ? \ - (HPUX__LDPGSZ + HPUX__SEGMENT_ROUND((x).ha_text)) : \ + (HPUX_LDPGSZ + HPUX_SEGMENT_ROUND((x).ha_text)) : \ (HPUX_EXEC_HDR_SIZE + (x).ha_text)) #define HPUX_PASOFF(x, m) \ ((((m) == ZMAGIC) || \ ((m) == HPUX_MAGIC_SHL) || \ ((m) == HPUX_MAGIC_DL)) ? \ - (HPUX__LDPGSZ + HPUX__SEGMENT_ROUND((x).ha_text) + \ - HPUX__SEGMENT_ROUND((x).ha_data)) : \ + (HPUX_LDPGSZ + HPUX_SEGMENT_ROUND((x).ha_text) + \ + HPUX_SEGMENT_ROUND((x).ha_data)) : \ (HPUX_EXEC_HDR_SIZE + (x).ha_text + (x).ha_data)) #define HPUX_SYMOFF(x, m) (HPUX_PASOFF((x), (m)) + (x).ha_pascal) diff --git a/sys/compat/hpux/hpux_syscallargs.h b/sys/compat/hpux/hpux_syscallargs.h index f5b087bfa39..22e330136c7 100644 --- a/sys/compat/hpux/hpux_syscallargs.h +++ b/sys/compat/hpux/hpux_syscallargs.h @@ -218,6 +218,10 @@ struct hpux_sys_fstat_args { syscallarg(struct hpux_stat *) sb; }; +struct hpux_sys_sigreturn_args { + syscallarg(struct hpuxsigcontext *) sigcntxp; +}; + struct hpux_sys_sigvec_args { syscallarg(int) signo; syscallarg(struct sigvec *) nsv; @@ -450,7 +454,7 @@ int sys_dup2 __P((struct proc *, void *, register_t *)); int hpux_sys_fstat __P((struct proc *, void *, register_t *)); int sys_select __P((struct proc *, void *, register_t *)); int sys_fsync __P((struct proc *, void *, register_t *)); -int sys_sigreturn __P((struct proc *, void *, register_t *)); +int hpux_sys_sigreturn __P((struct proc *, void *, register_t *)); int hpux_sys_sigvec __P((struct proc *, void *, register_t *)); int hpux_sys_sigblock __P((struct proc *, void *, register_t *)); int hpux_sys_sigsetmask __P((struct proc *, void *, register_t *)); diff --git a/sys/compat/hpux/hpux_sysent.c b/sys/compat/hpux/hpux_sysent.c index 2fbb7cac2c7..e49cf2387cc 100644 --- a/sys/compat/hpux/hpux_sysent.c +++ b/sys/compat/hpux/hpux_sysent.c @@ -13,6 +13,7 @@ #include #include #include +#include #define s(type) sizeof(type) @@ -223,8 +224,8 @@ struct sysent hpux_sysent[] = { sys_nosys }, /* 101 = unimplemented */ { 0, 0, sys_nosys }, /* 102 = unimplemented */ - { 1, s(struct sys_sigreturn_args), - sys_sigreturn }, /* 103 = sigreturn */ + { 1, s(struct hpux_sys_sigreturn_args), + hpux_sys_sigreturn }, /* 103 = sigreturn */ { 0, 0, sys_nosys }, /* 104 = unimplemented */ { 0, 0, diff --git a/sys/compat/hpux/syscalls.master b/sys/compat/hpux/syscalls.master index 29a1565ea1f..34d934169f9 100644 --- a/sys/compat/hpux/syscalls.master +++ b/sys/compat/hpux/syscalls.master @@ -1,9 +1,9 @@ - $OpenBSD: syscalls.master,v 1.4 1996/08/25 12:19:51 deraadt Exp $ -; $NetBSD: syscalls.master,v 1.9 1995/11/28 08:39:56 thorpej Exp $ + $OpenBSD: syscalls.master,v 1.5 1997/03/26 08:11:09 downsj Exp $ +; $NetBSD: syscalls.master,v 1.13 1997/03/16 03:48:04 thorpej Exp $ ; @(#)syscalls.master 8.1 (Berkeley) 7/19/93 -; NetBSD COMPAT_HPUX system call name/number "master" file. +; OpenBSD COMPAT_HPUX system call name/number "master" file. ; (See syscalls.conf to see what it is processed into.) ; ; Fields: number type [type-dependent ...] @@ -42,6 +42,8 @@ #include #include +#include + 0 NOARGS { int sys_nosys(void); } syscall 1 NOARGS { int sys_exit(int rval); } 2 STD { int hpux_sys_fork(void); } @@ -160,7 +162,8 @@ 100 UNIMPL 101 UNIMPL 102 UNIMPL -103 NOARGS { int sys_sigreturn(struct sigcontext *sigcntxp); } +103 STD { int hpux_sys_sigreturn(struct hpuxsigcontext \ + *sigcntxp); } 104 UNIMPL 105 UNIMPL 106 UNIMPL -- 2.20.1