Commit 9cd77374 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'parisc-3.20-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux

Pull parisc update from Helge Deller:
 "The major change in here is the removal of the old HP-UX compat code
  which should have made it possible to load and execute 32-bit HP-UX
  binaries on PA-RISC Linux.  Since it was never functional and since
  nobody cares about old 32-bit HPUX binaries any longer, it's now time
  to free up 3200 lines of kernel code (CONFIG_HPUX and
  CONFIG_BINFMT_SOM).

  Other than that we wire up the execveat() syscall, fix sparse errors
  and have some whitespace cleanups"

* 'parisc-3.20-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
  fs/binfmt_som: Drop kernel support for HP-UX SOM binaries
  parisc: Remove unused function
  parisc: macro whitespace fixes
  parisc/uaccess: fix sparse errors
  parisc: hpux - Remove HPUX syscall numbers
  parisc: hpux - Remove hpux gateway page
  parisc: hpux - Delete files in hpux subdirectory
  parisc: hpux - Do not compile hpux subdirectory
  parisc: hpux - Drop support for HP-UX binaries
  parisc: Add error checks when building up signal trampoline handler
  parisc: Wire up execveat syscall
parents b0f0c26a 35e88d5c
......@@ -291,10 +291,6 @@ config SYSVIPC_COMPAT
config AUDIT_ARCH
def_bool y
config HPUX
bool "Support for HP-UX binaries"
depends on !64BIT
config NR_CPUS
int "Maximum number of CPUs (2-32)"
range 2 32
......
......@@ -84,7 +84,6 @@ head-y := arch/parisc/kernel/head.o
KBUILD_CFLAGS += $(cflags-y)
kernel-y := mm/ kernel/ math-emu/
kernel-$(CONFIG_HPUX) += hpux/
core-y += $(addprefix arch/parisc/, $(kernel-y))
libs-y += arch/parisc/lib/ $(LIBGCC)
......
#
# Makefile for HPUX emulation
#
obj-y := entry_hpux.o gate.o wrappers.o fs.o ioctl.o sys_hpux.o
This diff is collapsed.
/*
* Implements HPUX syscalls.
*
* Copyright (C) 1999 Matthew Wilcox <willy with parisc-linux.org>
* Copyright (C) 2000 Michael Ang <mang with subcarrier.org>
* Copyright (C) 2000 John Marvin <jsm with parisc-linux.org>
* Copyright (C) 2000 Philipp Rumpf
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/fs.h>
#include <linux/sched.h>
#include <linux/file.h>
#include <linux/ptrace.h>
#include <linux/slab.h>
#include <asm/errno.h>
#include <asm/uaccess.h>
int hpux_execve(struct pt_regs *regs)
{
return do_execve(getname((const char __user *) regs->gr[26]),
(const char __user *const __user *) regs->gr[25],
(const char __user *const __user *) regs->gr[24]);
}
struct hpux_dirent {
loff_t d_off;
ino_t d_ino;
short d_reclen;
short d_namlen;
char d_name[1];
};
struct getdents_callback {
struct dir_context ctx;
struct hpux_dirent __user *current_dir;
struct hpux_dirent __user *previous;
int count;
int error;
};
#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
static int filldir(struct dir_context *ctx, const char *name, int namlen,
loff_t offset, u64 ino, unsigned d_type)
{
struct hpux_dirent __user * dirent;
struct getdents_callback *buf =
container_of(ctx, struct getdents_callback, ctx);
ino_t d_ino;
int reclen = ALIGN(NAME_OFFSET(dirent) + namlen + 1, sizeof(long));
buf->error = -EINVAL; /* only used if we fail.. */
if (reclen > buf->count)
return -EINVAL;
d_ino = ino;
if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) {
buf->error = -EOVERFLOW;
return -EOVERFLOW;
}
dirent = buf->previous;
if (dirent)
if (put_user(offset, &dirent->d_off))
goto Efault;
dirent = buf->current_dir;
if (put_user(d_ino, &dirent->d_ino) ||
put_user(reclen, &dirent->d_reclen) ||
put_user(namlen, &dirent->d_namlen) ||
copy_to_user(dirent->d_name, name, namlen) ||
put_user(0, dirent->d_name + namlen))
goto Efault;
buf->previous = dirent;
buf->current_dir = (void __user *)dirent + reclen;
buf->count -= reclen;
return 0;
Efault:
buf->error = -EFAULT;
return -EFAULT;
}
#undef NAME_OFFSET
int hpux_getdents(unsigned int fd, struct hpux_dirent __user *dirent, unsigned int count)
{
struct fd arg;
struct hpux_dirent __user * lastdirent;
struct getdents_callback buf = {
.ctx.actor = filldir,
.current_dir = dirent,
.count = count
};
int error;
arg = fdget(fd);
if (!arg.file)
return -EBADF;
error = iterate_dir(arg.file, &buf.ctx);
if (error >= 0)
error = buf.error;
lastdirent = buf.previous;
if (lastdirent) {
if (put_user(buf.ctx.pos, &lastdirent->d_off))
error = -EFAULT;
else
error = count - buf.count;
}
fdput(arg);
return error;
}
int hpux_mount(const char *fs, const char *path, int mflag,
const char *fstype, const char *dataptr, int datalen)
{
return -ENOSYS;
}
static int cp_hpux_stat(struct kstat *stat, struct hpux_stat64 __user *statbuf)
{
struct hpux_stat64 tmp;
/* we probably want a different split here - is hpux 12:20? */
if (!new_valid_dev(stat->dev) || !new_valid_dev(stat->rdev))
return -EOVERFLOW;
memset(&tmp, 0, sizeof(tmp));
tmp.st_dev = new_encode_dev(stat->dev);
tmp.st_ino = stat->ino;
tmp.st_mode = stat->mode;
tmp.st_nlink = stat->nlink;
tmp.st_uid = from_kuid_munged(current_user_ns(), stat->uid);
tmp.st_gid = from_kgid_munged(current_user_ns(), stat->gid);
tmp.st_rdev = new_encode_dev(stat->rdev);
tmp.st_size = stat->size;
tmp.st_atime = stat->atime.tv_sec;
tmp.st_mtime = stat->mtime.tv_sec;
tmp.st_ctime = stat->ctime.tv_sec;
tmp.st_blocks = stat->blocks;
tmp.st_blksize = stat->blksize;
return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
}
long hpux_stat64(const char __user *filename, struct hpux_stat64 __user *statbuf)
{
struct kstat stat;
int error = vfs_stat(filename, &stat);
if (!error)
error = cp_hpux_stat(&stat, statbuf);
return error;
}
long hpux_fstat64(unsigned int fd, struct hpux_stat64 __user *statbuf)
{
struct kstat stat;
int error = vfs_fstat(fd, &stat);
if (!error)
error = cp_hpux_stat(&stat, statbuf);
return error;
}
long hpux_lstat64(const char __user *filename,
struct hpux_stat64 __user *statbuf)
{
struct kstat stat;
int error = vfs_lstat(filename, &stat);
if (!error)
error = cp_hpux_stat(&stat, statbuf);
return error;
}
/*
*
* Linux/PARISC Project (http://www.parisc-linux.org/)
*
* System call entry code Copyright (c) Matthew Wilcox 1999 <willy@bofh.ai>
* Licensed under the GNU GPL.
* thanks to Philipp Rumpf, Mike Shaver and various others
* sorry about the wall, puffin..
*/
#include <asm/assembly.h>
#include <asm/asm-offsets.h>
#include <asm/unistd.h>
#include <asm/errno.h>
#include <linux/linkage.h>
.level LEVEL
.text
.import hpux_call_table
.import hpux_syscall_exit,code
.align PAGE_SIZE
ENTRY(hpux_gateway_page)
nop
#ifdef CONFIG_64BIT
#warning NEEDS WORK for 64-bit
#endif
ldw -64(%r30), %r29 ;! 8th argument
ldw -60(%r30), %r19 ;! 7th argument
ldw -56(%r30), %r20 ;! 6th argument
ldw -52(%r30), %r21 ;! 5th argument
gate .+8, %r0 /* become privileged */
mtsp %r0,%sr4 /* get kernel space into sr4 */
mtsp %r0,%sr5 /* get kernel space into sr5 */
mtsp %r0,%sr6 /* get kernel space into sr6 */
mfsp %sr7,%r1 /* save user sr7 */
mtsp %r1,%sr3 /* and store it in sr3 */
mtctl %r30,%cr28
mfctl %cr30,%r1
xor %r1,%r30,%r30 /* ye olde xor trick */
xor %r1,%r30,%r1
xor %r1,%r30,%r30
ldo TASK_SZ_ALGN+FRAME_SIZE(%r30),%r30 /* set up kernel stack */
/* N.B.: It is critical that we don't set sr7 to 0 until r30
* contains a valid kernel stack pointer. It is also
* critical that we don't start using the kernel stack
* until after sr7 has been set to 0.
*/
mtsp %r0,%sr7 /* get kernel space into sr7 */
STREG %r1,TASK_PT_GR30-TASK_SZ_ALGN-FRAME_SIZE(%r30) /* save usp */
ldo -TASK_SZ_ALGN-FRAME_SIZE(%r30),%r1 /* get task ptr in %r1 */
/* Save some registers for sigcontext and potential task
switch (see entry.S for the details of which ones are
saved/restored). TASK_PT_PSW is zeroed so we can see whether
a process is on a syscall or not. For an interrupt the real
PSW value is stored. This is needed for gdb and sys_ptrace. */
STREG %r0, TASK_PT_PSW(%r1)
STREG %r2, TASK_PT_GR2(%r1) /* preserve rp */
STREG %r19, TASK_PT_GR19(%r1) /* 7th argument */
STREG %r20, TASK_PT_GR20(%r1) /* 6th argument */
STREG %r21, TASK_PT_GR21(%r1) /* 5th argument */
STREG %r22, TASK_PT_GR22(%r1) /* syscall # */
STREG %r23, TASK_PT_GR23(%r1) /* 4th argument */
STREG %r24, TASK_PT_GR24(%r1) /* 3rd argument */
STREG %r25, TASK_PT_GR25(%r1) /* 2nd argument */
STREG %r26, TASK_PT_GR26(%r1) /* 1st argument */
STREG %r27, TASK_PT_GR27(%r1) /* user dp */
STREG %r28, TASK_PT_GR28(%r1) /* return value 0 */
STREG %r0, TASK_PT_ORIG_R28(%r1) /* don't prohibit restarts */
STREG %r29, TASK_PT_GR29(%r1) /* 8th argument */
STREG %r31, TASK_PT_GR31(%r1) /* preserve syscall return ptr */
ldo TASK_PT_FR0(%r1), %r27 /* save fpregs from the kernel */
save_fp %r27 /* or potential task switch */
mfctl %cr11, %r27 /* i.e. SAR */
STREG %r27, TASK_PT_SAR(%r1)
loadgp
stw %r21, -52(%r30) ;! 5th argument
stw %r20, -56(%r30) ;! 6th argument
stw %r19, -60(%r30) ;! 7th argument
stw %r29, -64(%r30) ;! 8th argument
ldil L%hpux_call_table, %r21
ldo R%hpux_call_table(%r21), %r21
comiclr,>>= __NR_HPUX_syscalls, %r22, %r0
b,n syscall_nosys
LDREGX %r22(%r21), %r21
ldil L%hpux_syscall_exit,%r2
be 0(%sr7,%r21)
ldo R%hpux_syscall_exit(%r2),%r2
syscall_nosys:
ldil L%hpux_syscall_exit,%r1
be R%hpux_syscall_exit(%sr7,%r1)
ldo -ENOSYS(%r0),%r28
ENDPROC(hpux_gateway_page)
.align PAGE_SIZE
ENTRY(end_hpux_gateway_page)
/*
* Implements some necessary HPUX ioctls.
*
* Copyright (C) 1999-2002 Matthew Wilcox <willy with parisc-linux.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
* Supported ioctls:
* TCGETA
* TCSETA
* TCSETAW
* TCSETAF
* TCSBRK
* TCXONC
* TCFLSH
* TIOCGWINSZ
* TIOCSWINSZ
* TIOCGPGRP
* TIOCSPGRP
*/
#include <linux/sched.h>
#include <linux/syscalls.h>
#include <asm/errno.h>
#include <asm/ioctl.h>
#include <asm/termios.h>
#include <asm/uaccess.h>
static int hpux_ioctl_t(int fd, unsigned long cmd, unsigned long arg)
{
int result = -EOPNOTSUPP;
int nr = _IOC_NR(cmd);
switch (nr) {
case 106:
result = sys_ioctl(fd, TIOCSWINSZ, arg);
break;
case 107:
result = sys_ioctl(fd, TIOCGWINSZ, arg);
break;
}
return result;
}
int hpux_ioctl(int fd, unsigned long cmd, unsigned long arg)
{
int result = -EOPNOTSUPP;
int type = _IOC_TYPE(cmd);
switch (type) {
case 'T':
/* Our structures are now compatible with HPUX's */
result = sys_ioctl(fd, cmd, arg);
break;
case 't':
result = hpux_ioctl_t(fd, cmd, arg);
break;
}
return result;
}
This diff is collapsed.
/*
* Linux/PARISC Project (http://www.parisc-linux.org/)
*
* HP-UX System Call Wrapper routines and System Call Return Path
*
* Copyright (C) 2000 Hewlett-Packard (John Marvin)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifdef CONFIG_64BIT
#warning PA64 support needs more work...did first cut
#endif
#include <asm/asm-offsets.h>
#include <asm/assembly.h>
#include <asm/signal.h>
#include <linux/linkage.h>
.level LEVEL
.text
/* These should probably go in a header file somewhere.
* They are duplicated in kernel/wrappers.S
* Possibly we should consider consolidating these
* register save/restore macros.
*/
.macro reg_save regs
#ifdef CONFIG_64BIT
#warning NEEDS WORK for 64-bit
#endif
STREG %r3, PT_GR3(\regs)
STREG %r4, PT_GR4(\regs)
STREG %r5, PT_GR5(\regs)
STREG %r6, PT_GR6(\regs)
STREG %r7, PT_GR7(\regs)
STREG %r8, PT_GR8(\regs)
STREG %r9, PT_GR9(\regs)
STREG %r10,PT_GR10(\regs)
STREG %r11,PT_GR11(\regs)
STREG %r12,PT_GR12(\regs)
STREG %r13,PT_GR13(\regs)
STREG %r14,PT_GR14(\regs)
STREG %r15,PT_GR15(\regs)
STREG %r16,PT_GR16(\regs)
STREG %r17,PT_GR17(\regs)
STREG %r18,PT_GR18(\regs)
.endm
.macro reg_restore regs
LDREG PT_GR3(\regs), %r3
LDREG PT_GR4(\regs), %r4
LDREG PT_GR5(\regs), %r5
LDREG PT_GR6(\regs), %r6
LDREG PT_GR7(\regs), %r7
LDREG PT_GR8(\regs), %r8
LDREG PT_GR9(\regs), %r9
LDREG PT_GR10(\regs),%r10
LDREG PT_GR11(\regs),%r11
LDREG PT_GR12(\regs),%r12
LDREG PT_GR13(\regs),%r13
LDREG PT_GR14(\regs),%r14
LDREG PT_GR15(\regs),%r15
LDREG PT_GR16(\regs),%r16
LDREG PT_GR17(\regs),%r17
LDREG PT_GR18(\regs),%r18
.endm
.import sys_fork
ENTRY(hpux_fork_wrapper)
ldo TASK_REGS-TASK_SZ_ALGN-64(%r30),%r1 ;! get pt regs
;! pointer in task
reg_save %r1
STREG %r2,-20(%r30)
ldo 64(%r30),%r30
STREG %r2,PT_GR19(%r1) ;! save for child
STREG %r30,PT_GR21(%r1) ;! save for child
LDREG PT_GR30(%r1),%r25
mtctl %r25,%cr29
copy %r1,%r24
bl sys_clone,%r2
ldi SIGCHLD,%r26
LDREG -84(%r30),%r2
fork_return:
ldo -64(%r30),%r30
ldo TASK_REGS-TASK_SZ_ALGN-64(%r30),%r1 ;! get pt regs
reg_restore %r1
/*
* HP-UX wants pid (child gets parent pid, parent gets child pid)
* in r28 and a flag in r29 (r29 == 1 for child, 0 for parent).
* Linux fork returns 0 for child, pid for parent. Since HP-UX
* libc stub throws away parent pid and returns 0 for child,
* we'll just return 0 for parent pid now. Only applications
* that jump directly to the gateway page (not supported) will
* know the difference. We can fix this later if necessary.
*/
ldo -1024(%r0),%r1
comb,>>=,n %r28,%r1,fork_exit /* just let the syscall exit handle it */
or,= %r28,%r0,%r0
or,tr %r0,%r0,%r29 /* r28 <> 0, we are parent, set r29 to 0 */
ldo 1(%r0),%r29 /* r28 == 0, we are child, set r29 to 1 */
fork_exit:
bv %r0(%r2)
nop
ENDPROC(hpux_fork_wrapper)
/* Set the return value for the child */
ENTRY(hpux_child_return)
#if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT)
bl,n schedule_tail, %r2
#endif
LDREG TASK_PT_GR19-TASK_SZ_ALGN-128(%r30),%r2
b fork_return
copy %r0,%r28
ENDPROC(hpux_child_return)
.import hpux_execve
ENTRY(hpux_execv_wrapper)
copy %r0,%r24 /* NULL environment */
ENTRY(hpux_execve_wrapper)
ldo TASK_REGS-TASK_SZ_ALGN-64(%r30),%r1 ;! get pt regs
/*
* Do we need to save/restore r3-r18 here?
* I don't think so. why would new thread need old
* threads registers?
*/
/* Store arg0, arg1 and arg2 so that hpux_execve will find them */
STREG %r26,PT_GR26(%r1)
STREG %r25,PT_GR25(%r1)
STREG %r24,PT_GR24(%r1)
STREG %r2,-20(%r30)
ldo 64(%r30),%r30
bl hpux_execve,%r2
copy %r1,%arg0
ldo -64(%r30),%r30
LDREG -20(%r30),%r2
/* If exec succeeded we need to load the args */
ldo -1024(%r0),%r1
comb,>>= %r28,%r1,exec_error
copy %r2,%r19
ldo -TASK_SZ_ALGN-64(%r30),%r1 ;! get task ptr
LDREG TASK_PT_GR26(%r1),%r26
LDREG TASK_PT_GR25(%r1),%r25
LDREG TASK_PT_GR24(%r1),%r24
LDREG TASK_PT_GR23(%r1),%r23
copy %r0,%r2 /* Flag to syscall_exit not to clear args */
exec_error:
bv %r0(%r19)
nop
ENDPROC(hpux_execv_wrapper)
.import hpux_pipe
/* HP-UX expects pipefd's returned in r28 & r29 */
ENTRY(hpux_pipe_wrapper)
STREG %r2,-20(%r30)
ldo 64(%r30),%r30
bl hpux_pipe,%r2
ldo -56(%r30),%r26 /* pass local array to hpux_pipe */
ldo -1024(%r0),%r1
comb,>>= %r28,%r1,pipe_exit /* let syscall exit handle it */
LDREG -84(%r30),%r2
/* if success, load fd's from stack array */
LDREG -56(%r30),%r28
LDREG -52(%r30),%r29
pipe_exit:
bv %r0(%r2)
ldo -64(%r30),%r30
ENDPROC(hpux_pipe_wrapper)
.import syscall_exit
ENTRY(hpux_syscall_exit)
/*
*
* HP-UX call return conventions:
*
* if error:
* r22 = 1
* r28 = errno value
* r29 = secondary return value
* else
* r22 = 0
* r28 = return value
* r29 = secondary return value
*
* For now, we'll just check to see if r28 is < (unsigned long)-1024
* (to handle addresses > 2 Gb) and if so set r22 to zero. If not,
* we'll complement r28 and set r22 to 1. Wrappers will be
* needed for syscalls that care about the secondary return value.
* The wrapper may also need a way of avoiding the following code,
* but we'll deal with that when it becomes necessary.
*/
ldo -1024(%r0),%r1
comb,<< %r28,%r1,no_error
copy %r0,%r22
subi 0,%r28,%r28
ldo 1(%r0),%r22
no_error:
b,n syscall_exit
ENDPROC(hpux_syscall_exit)
.import hpux_unimplemented
ENTRY(hpux_unimplemented_wrapper)
b hpux_unimplemented
STREG %r22,-64(%r30) /* overwrite arg8 with syscall number */
ENDPROC(hpux_unimplemented_wrapper)
......@@ -330,8 +330,6 @@ struct mm_struct;
/* Free all resources held by a thread. */
extern void release_thread(struct task_struct *);
extern void map_hpux_gateway_page(struct task_struct *tsk, struct mm_struct *mm);
extern unsigned long get_wchan(struct task_struct *p);
#define KSTK_EIP(tsk) ((tsk)->thread.regs.iaoq[0])
......
......@@ -17,7 +17,7 @@
#define KERNEL_DS ((mm_segment_t){0})
#define USER_DS ((mm_segment_t){1})
#define segment_eq(a,b) ((a).seg == (b).seg)
#define segment_eq(a, b) ((a).seg == (b).seg)
#define get_ds() (KERNEL_DS)
#define get_fs() (current_thread_info()->addr_limit)
......@@ -42,14 +42,14 @@ static inline long access_ok(int type, const void __user * addr,
#if !defined(CONFIG_64BIT)
#define LDD_KERNEL(ptr) BUILD_BUG()
#define LDD_USER(ptr) BUILD_BUG()
#define STD_KERNEL(x, ptr) __put_kernel_asm64(x,ptr)
#define STD_USER(x, ptr) __put_user_asm64(x,ptr)
#define STD_KERNEL(x, ptr) __put_kernel_asm64(x, ptr)
#define STD_USER(x, ptr) __put_user_asm64(x, ptr)
#define ASM_WORD_INSN ".word\t"
#else
#define LDD_KERNEL(ptr) __get_kernel_asm("ldd",ptr)
#define LDD_USER(ptr) __get_user_asm("ldd",ptr)
#define STD_KERNEL(x, ptr) __put_kernel_asm("std",x,ptr)
#define STD_USER(x, ptr) __put_user_asm("std",x,ptr)
#define LDD_KERNEL(ptr) __get_kernel_asm("ldd", ptr)
#define LDD_USER(ptr) __get_user_asm("ldd", ptr)
#define STD_KERNEL(x, ptr) __put_kernel_asm("std", x, ptr)
#define STD_USER(x, ptr) __put_user_asm("std", x, ptr)
#define ASM_WORD_INSN ".dword\t"
#endif
......@@ -80,68 +80,68 @@ struct exception_data {
unsigned long fault_addr;
};
#define __get_user(x,ptr) \
({ \
register long __gu_err __asm__ ("r8") = 0; \
register long __gu_val __asm__ ("r9") = 0; \
\
if (segment_eq(get_fs(),KERNEL_DS)) { \
switch (sizeof(*(ptr))) { \
case 1: __get_kernel_asm("ldb",ptr); break; \
case 2: __get_kernel_asm("ldh",ptr); break; \
case 4: __get_kernel_asm("ldw",ptr); break; \
case 8: LDD_KERNEL(ptr); break; \
default: BUILD_BUG(); break; \
} \
} \
else { \
switch (sizeof(*(ptr))) { \
case 1: __get_user_asm("ldb",ptr); break; \
case 2: __get_user_asm("ldh",ptr); break; \
case 4: __get_user_asm("ldw",ptr); break; \
case 8: LDD_USER(ptr); break; \
default: BUILD_BUG(); break; \
} \
} \
\
(x) = (__typeof__(*(ptr))) __gu_val; \
__gu_err; \
#define __get_user(x, ptr) \
({ \
register long __gu_err __asm__ ("r8") = 0; \
register long __gu_val __asm__ ("r9") = 0; \
\
if (segment_eq(get_fs(), KERNEL_DS)) { \
switch (sizeof(*(ptr))) { \
case 1: __get_kernel_asm("ldb", ptr); break; \
case 2: __get_kernel_asm("ldh", ptr); break; \
case 4: __get_kernel_asm("ldw", ptr); break; \
case 8: LDD_KERNEL(ptr); break; \
default: BUILD_BUG(); break; \
} \
} \
else { \
switch (sizeof(*(ptr))) { \
case 1: __get_user_asm("ldb", ptr); break; \
case 2: __get_user_asm("ldh", ptr); break; \
case 4: __get_user_asm("ldw", ptr); break; \
case 8: LDD_USER(ptr); break; \
default: BUILD_BUG(); break; \
} \
} \
\
(x) = (__force __typeof__(*(ptr))) __gu_val; \
__gu_err; \
})
#define __get_kernel_asm(ldx,ptr) \
#define __get_kernel_asm(ldx, ptr) \
__asm__("\n1:\t" ldx "\t0(%2),%0\n\t" \
ASM_EXCEPTIONTABLE_ENTRY(1b, fixup_get_user_skip_1)\
: "=r"(__gu_val), "=r"(__gu_err) \
: "r"(ptr), "1"(__gu_err) \
: "r1");
#define __get_user_asm(ldx,ptr) \
#define __get_user_asm(ldx, ptr) \
__asm__("\n1:\t" ldx "\t0(%%sr3,%2),%0\n\t" \
ASM_EXCEPTIONTABLE_ENTRY(1b,fixup_get_user_skip_1)\
ASM_EXCEPTIONTABLE_ENTRY(1b, fixup_get_user_skip_1)\
: "=r"(__gu_val), "=r"(__gu_err) \
: "r"(ptr), "1"(__gu_err) \
: "r1");
#define __put_user(x,ptr) \
#define __put_user(x, ptr) \
({ \
register long __pu_err __asm__ ("r8") = 0; \
__typeof__(*(ptr)) __x = (__typeof__(*(ptr)))(x); \
\
if (segment_eq(get_fs(),KERNEL_DS)) { \
if (segment_eq(get_fs(), KERNEL_DS)) { \
switch (sizeof(*(ptr))) { \
case 1: __put_kernel_asm("stb",__x,ptr); break; \
case 2: __put_kernel_asm("sth",__x,ptr); break; \
case 4: __put_kernel_asm("stw",__x,ptr); break; \
case 8: STD_KERNEL(__x,ptr); break; \
case 1: __put_kernel_asm("stb", __x, ptr); break; \
case 2: __put_kernel_asm("sth", __x, ptr); break; \
case 4: __put_kernel_asm("stw", __x, ptr); break; \
case 8: STD_KERNEL(__x, ptr); break; \
default: BUILD_BUG(); break; \
} \
} \
else { \
switch (sizeof(*(ptr))) { \
case 1: __put_user_asm("stb",__x,ptr); break; \
case 2: __put_user_asm("sth",__x,ptr); break; \
case 4: __put_user_asm("stw",__x,ptr); break; \
case 8: STD_USER(__x,ptr); break; \
case 1: __put_user_asm("stb", __x, ptr); break; \
case 2: __put_user_asm("sth", __x, ptr); break; \
case 4: __put_user_asm("stw", __x, ptr); break; \
case 8: STD_USER(__x, ptr); break; \
default: BUILD_BUG(); break; \
} \
} \
......@@ -159,18 +159,18 @@ struct exception_data {
* r8/r9 are already listed as err/val.
*/
#define __put_kernel_asm(stx,x,ptr) \
#define __put_kernel_asm(stx, x, ptr) \
__asm__ __volatile__ ( \
"\n1:\t" stx "\t%2,0(%1)\n\t" \
ASM_EXCEPTIONTABLE_ENTRY(1b,fixup_put_user_skip_1)\
ASM_EXCEPTIONTABLE_ENTRY(1b, fixup_put_user_skip_1)\
: "=r"(__pu_err) \
: "r"(ptr), "r"(x), "0"(__pu_err) \
: "r1")
#define __put_user_asm(stx,x,ptr) \
#define __put_user_asm(stx, x, ptr) \
__asm__ __volatile__ ( \
"\n1:\t" stx "\t%2,0(%%sr3,%1)\n\t" \
ASM_EXCEPTIONTABLE_ENTRY(1b,fixup_put_user_skip_1)\
ASM_EXCEPTIONTABLE_ENTRY(1b, fixup_put_user_skip_1)\
: "=r"(__pu_err) \
: "r"(ptr), "r"(x), "0"(__pu_err) \
: "r1")
......@@ -178,23 +178,23 @@ struct exception_data {
#if !defined(CONFIG_64BIT)
#define __put_kernel_asm64(__val,ptr) do { \
#define __put_kernel_asm64(__val, ptr) do { \
__asm__ __volatile__ ( \
"\n1:\tstw %2,0(%1)" \
"\n2:\tstw %R2,4(%1)\n\t" \
ASM_EXCEPTIONTABLE_ENTRY(1b,fixup_put_user_skip_2)\
ASM_EXCEPTIONTABLE_ENTRY(2b,fixup_put_user_skip_1)\
ASM_EXCEPTIONTABLE_ENTRY(1b, fixup_put_user_skip_2)\
ASM_EXCEPTIONTABLE_ENTRY(2b, fixup_put_user_skip_1)\
: "=r"(__pu_err) \
: "r"(ptr), "r"(__val), "0"(__pu_err) \
: "r1"); \
} while (0)
#define __put_user_asm64(__val,ptr) do { \
#define __put_user_asm64(__val, ptr) do { \
__asm__ __volatile__ ( \
"\n1:\tstw %2,0(%%sr3,%1)" \
"\n2:\tstw %R2,4(%%sr3,%1)\n\t" \
ASM_EXCEPTIONTABLE_ENTRY(1b,fixup_put_user_skip_2)\
ASM_EXCEPTIONTABLE_ENTRY(2b,fixup_put_user_skip_1)\
ASM_EXCEPTIONTABLE_ENTRY(1b, fixup_put_user_skip_2)\
ASM_EXCEPTIONTABLE_ENTRY(2b, fixup_put_user_skip_1)\
: "=r"(__pu_err) \
: "r"(ptr), "r"(__val), "0"(__pu_err) \
: "r1"); \
......@@ -211,8 +211,8 @@ extern unsigned long lcopy_to_user(void __user *, const void *, unsigned long);
extern unsigned long lcopy_from_user(void *, const void __user *, unsigned long);
extern unsigned long lcopy_in_user(void __user *, const void __user *, unsigned long);
extern long strncpy_from_user(char *, const char __user *, long);
extern unsigned lclear_user(void __user *,unsigned long);
extern long lstrnlen_user(const char __user *,long);
extern unsigned lclear_user(void __user *, unsigned long);
extern long lstrnlen_user(const char __user *, long);
/*
* Complex access routines -- macros
*/
......
This diff is collapsed.
......@@ -1774,10 +1774,6 @@ ENTRY(sys_rt_sigreturn_wrapper)
ENDPROC(sys_rt_sigreturn_wrapper)
ENTRY(syscall_exit)
/* NOTE: HP-UX syscalls also come through here
* after hpux_syscall_exit fixes up return
* values. */
/* NOTE: Not all syscalls exit this way. rt_sigreturn will exit
* via syscall_exit_rfi if the signal was received while the process
* was running.
......@@ -1789,22 +1785,6 @@ ENTRY(syscall_exit)
LDREG TI_TASK(%r1),%r1
STREG %r28,TASK_PT_GR28(%r1)
#ifdef CONFIG_HPUX
/* <linux/personality.h> cannot be easily included */
#define PER_HPUX 0x10
ldw TASK_PERSONALITY(%r1),%r19
/* We can't use "CMPIB<> PER_HPUX" since "im5" field is sign extended */
ldo -PER_HPUX(%r19), %r19
cmpib,COND(<>),n 0,%r19,1f
/* Save other hpux returns if personality is PER_HPUX */
STREG %r22,TASK_PT_GR22(%r1)
STREG %r29,TASK_PT_GR29(%r1)
1:
#endif /* CONFIG_HPUX */
/* Seems to me that dp could be wrong here, if the syscall involved
* calling a module, and nothing got round to restoring dp on return.
*/
......
......@@ -193,9 +193,7 @@ copy_thread(unsigned long clone_flags, unsigned long usp,
* Make them const so the compiler knows they live in .text */
extern void * const ret_from_kernel_thread;
extern void * const child_return;
#ifdef CONFIG_HPUX
extern void * const hpux_child_return;
#endif
if (unlikely(p->flags & PF_KTHREAD)) {
memset(cregs, 0, sizeof(struct pt_regs));
if (!usp) /* idle thread */
......@@ -229,15 +227,8 @@ copy_thread(unsigned long clone_flags, unsigned long usp,
cregs->gr[30] = usp;
}
cregs->ksp = (unsigned long)stack + THREAD_SZ_ALGN + FRAME_SIZE;
if (personality(p->personality) == PER_HPUX) {
#ifdef CONFIG_HPUX
cregs->kpc = (unsigned long) &hpux_child_return;
#else
BUG();
#endif
} else {
cregs->kpc = (unsigned long) &child_return;
}
cregs->kpc = (unsigned long) &child_return;
/* Setup thread TLS area from the 4th parameter in clone */
if (clone_flags & CLONE_SETTLS)
cregs->cr27 = cregs->gr[23];
......
......@@ -9,8 +9,7 @@
*
* Like the IA-64, we are a recent enough port (we are *starting*
* with glibc2.2) that we do not need to support the old non-realtime
* Linux signals. Therefore we don't. HP/UX signals will go in
* arch/parisc/hpux/signal.c when we figure out how to do them.
* Linux signals. Therefore we don't.
*/
#include <linux/sched.h>
......@@ -476,6 +475,9 @@ insert_restart_trampoline(struct pt_regs *regs)
case -ERESTART_RESTARTBLOCK: {
/* Restart the system call - no handlers present */
unsigned int *usp = (unsigned int *)regs->gr[30];
unsigned long start = (unsigned long) &usp[2];
unsigned long end = (unsigned long) &usp[5];
long err = 0;
/* Setup a trampoline to restart the syscall
* with __NR_restart_syscall
......@@ -487,23 +489,21 @@ insert_restart_trampoline(struct pt_regs *regs)
* 16: ldi __NR_restart_syscall, %r20
*/
#ifdef CONFIG_64BIT
put_user(regs->gr[31] >> 32, &usp[0]);
put_user(regs->gr[31] & 0xffffffff, &usp[1]);
put_user(0x0fc010df, &usp[2]);
err |= put_user(regs->gr[31] >> 32, &usp[0]);
err |= put_user(regs->gr[31] & 0xffffffff, &usp[1]);
err |= put_user(0x0fc010df, &usp[2]);
#else
put_user(regs->gr[31], &usp[0]);
put_user(0x0fc0109f, &usp[2]);
err |= put_user(regs->gr[31], &usp[0]);
err |= put_user(0x0fc0109f, &usp[2]);
#endif
put_user(0xe0008200, &usp[3]);
put_user(0x34140000, &usp[4]);
err |= put_user(0xe0008200, &usp[3]);
err |= put_user(0x34140000, &usp[4]);
/* Stack is 64-byte aligned, and we only need
* to flush 1 cache line.
* Flushing one cacheline is cheap.
* "sync" on bigger (> 4 way) boxes is not.
*/
flush_user_dcache_range(regs->gr[30], regs->gr[30] + 4);
flush_user_icache_range(regs->gr[30], regs->gr[30] + 4);
WARN_ON(err);
/* flush data/instruction cache for new insns */
flush_user_dcache_range(start, end);
flush_user_icache_range(start, end);
regs->gr[31] = regs->gr[30] + 8;
return;
......
......@@ -230,9 +230,6 @@ send_IPI_allbutself(enum ipi_message_type op)
inline void
smp_send_stop(void) { send_IPI_allbutself(IPI_CPU_STOP); }
static inline void
smp_send_start(void) { send_IPI_allbutself(IPI_CPU_START); }
void
smp_send_reschedule(int cpu) { send_IPI_single(cpu, IPI_RESCHEDULE); }
......
......@@ -437,6 +437,7 @@
ENTRY_SAME(getrandom)
ENTRY_SAME(memfd_create) /* 340 */
ENTRY_SAME(bpf)
ENTRY_COMP(execveat)
/* Nothing yet */
......
......@@ -750,78 +750,6 @@ static void __init gateway_init(void)
PAGE_SIZE, PAGE_GATEWAY, 1);
}
#ifdef CONFIG_HPUX
void
map_hpux_gateway_page(struct task_struct *tsk, struct mm_struct *mm)
{
pgd_t *pg_dir;
pmd_t *pmd;
pte_t *pg_table;
unsigned long start_pmd;
unsigned long start_pte;
unsigned long address;
unsigned long hpux_gw_page_addr;
/* FIXME: This is 'const' in order to trick the compiler
into not treating it as DP-relative data. */
extern void * const hpux_gateway_page;
hpux_gw_page_addr = HPUX_GATEWAY_ADDR & PAGE_MASK;
/*
* Setup HP-UX Gateway page.
*
* The HP-UX gateway page resides in the user address space,
* so it needs to be aliased into each process.
*/
pg_dir = pgd_offset(mm,hpux_gw_page_addr);
#if PTRS_PER_PMD == 1
start_pmd = 0;
#else
start_pmd = ((hpux_gw_page_addr >> PMD_SHIFT) & (PTRS_PER_PMD - 1));
#endif
start_pte = ((hpux_gw_page_addr >> PAGE_SHIFT) & (PTRS_PER_PTE - 1));
address = __pa(&hpux_gateway_page);
#if PTRS_PER_PMD == 1
pmd = (pmd_t *)__pa(pg_dir);
#else
pmd = (pmd_t *) pgd_address(*pg_dir);
/*
* pmd is physical at this point
*/
if (!pmd) {
pmd = (pmd_t *) get_zeroed_page(GFP_KERNEL);
pmd = (pmd_t *) __pa(pmd);
}
__pgd_val_set(*pg_dir, PxD_FLAG_PRESENT | PxD_FLAG_VALID | (unsigned long) pmd);
#endif
/* now change pmd to kernel virtual addresses */
pmd = (pmd_t *)__va(pmd) + start_pmd;
/*
* pg_table is physical at this point
*/
pg_table = (pte_t *) pmd_address(*pmd);
if (!pg_table)
pg_table = (pte_t *) __pa(get_zeroed_page(GFP_KERNEL));
__pmd_val_set(*pmd, PxD_FLAG_PRESENT | PxD_FLAG_VALID | (unsigned long) pg_table);
/* now change pg_table to kernel virtual addresses */
pg_table = (pte_t *) __va(pg_table) + start_pte;
set_pte(pg_table, __mk_pte(address, PAGE_GATEWAY));
}
EXPORT_SYMBOL(map_hpux_gateway_page);
#endif
void __init paging_init(void)
{
int i;
......
......@@ -149,13 +149,6 @@ config BINFMT_EM86
later load the module when you want to use a Linux/Intel binary. The
module will be called binfmt_em86. If unsure, say Y.
config BINFMT_SOM
tristate "Kernel support for SOM binaries"
depends on PARISC && HPUX
help
SOM is a binary executable format inherited from HP/UX. Say
Y here to be able to load and execute SOM binaries directly.
config BINFMT_MISC
tristate "Kernel support for MISC binaries"
---help---
......
......@@ -38,7 +38,6 @@ obj-$(CONFIG_BINFMT_SCRIPT) += binfmt_script.o
obj-$(CONFIG_BINFMT_ELF) += binfmt_elf.o
obj-$(CONFIG_COMPAT_BINFMT_ELF) += compat_binfmt_elf.o
obj-$(CONFIG_BINFMT_ELF_FDPIC) += binfmt_elf_fdpic.o
obj-$(CONFIG_BINFMT_SOM) += binfmt_som.o
obj-$(CONFIG_BINFMT_FLAT) += binfmt_flat.o
obj-$(CONFIG_FS_MBCACHE) += mbcache.o
......
/*
* linux/fs/binfmt_som.c
*
* These are the functions used to load SOM format executables as used
* by HP-UX.
*
* Copyright 1999 Matthew Wilcox <willy@bofh.ai>
* based on binfmt_elf which is
* Copyright 1993, 1994: Eric Youngdale (ericy@cais.com).
*/
#include <linux/module.h>
#include <linux/fs.h>
#include <linux/stat.h>
#include <linux/sched.h>
#include <linux/mm.h>
#include <linux/mman.h>
#include <linux/errno.h>
#include <linux/signal.h>
#include <linux/binfmts.h>
#include <linux/som.h>
#include <linux/string.h>
#include <linux/file.h>
#include <linux/fcntl.h>
#include <linux/ptrace.h>
#include <linux/slab.h>
#include <linux/shm.h>
#include <linux/personality.h>
#include <linux/init.h>
#include <asm/uaccess.h>
#include <asm/pgtable.h>
#include <linux/elf.h>
static int load_som_binary(struct linux_binprm * bprm);
static int load_som_library(struct file *);
/*
* If we don't support core dumping, then supply a NULL so we
* don't even try.
*/
#if 0
static int som_core_dump(struct coredump_params *cprm);
#else
#define som_core_dump NULL
#endif
#define SOM_PAGESTART(_v) ((_v) & ~(unsigned long)(SOM_PAGESIZE-1))
#define SOM_PAGEOFFSET(_v) ((_v) & (SOM_PAGESIZE-1))
#define SOM_PAGEALIGN(_v) (((_v) + SOM_PAGESIZE - 1) & ~(SOM_PAGESIZE - 1))
static struct linux_binfmt som_format = {
.module = THIS_MODULE,
.load_binary = load_som_binary,
.load_shlib = load_som_library,
.core_dump = som_core_dump,
.min_coredump = SOM_PAGESIZE
};
/*
* create_som_tables() parses the env- and arg-strings in new user
* memory and creates the pointer tables from them, and puts their
* addresses on the "stack", returning the new stack pointer value.
*/
static void create_som_tables(struct linux_binprm *bprm)
{
char **argv, **envp;
int argc = bprm->argc;
int envc = bprm->envc;
unsigned long p;
unsigned long *sp;
/* Word-align the stack pointer */
sp = (unsigned long *)((bprm->p + 3) & ~3);
envp = (char **) sp;
sp += envc + 1;
argv = (char **) sp;
sp += argc + 1;
__put_user((unsigned long) envp,++sp);
__put_user((unsigned long) argv,++sp);
__put_user(argc, ++sp);
bprm->p = (unsigned long) sp;
p = current->mm->arg_start;
while (argc-- > 0) {
__put_user((char *)p,argv++);
p += strlen_user((char *)p);
}
__put_user(NULL, argv);
current->mm->arg_end = current->mm->env_start = p;
while (envc-- > 0) {
__put_user((char *)p,envp++);
p += strlen_user((char *)p);
}
__put_user(NULL, envp);
current->mm->env_end = p;
}
static int check_som_header(struct som_hdr *som_ex)
{
int *buf = (int *)som_ex;
int i, ck;
if (som_ex->system_id != SOM_SID_PARISC_1_0 &&
som_ex->system_id != SOM_SID_PARISC_1_1 &&
som_ex->system_id != SOM_SID_PARISC_2_0)
return -ENOEXEC;
if (som_ex->a_magic != SOM_EXEC_NONSHARE &&
som_ex->a_magic != SOM_EXEC_SHARE &&
som_ex->a_magic != SOM_EXEC_DEMAND)
return -ENOEXEC;
if (som_ex->version_id != SOM_ID_OLD &&
som_ex->version_id != SOM_ID_NEW)
return -ENOEXEC;
ck = 0;
for (i=0; i<32; i++)
ck ^= buf[i];
if (ck != 0)
return -ENOEXEC;
return 0;
}
static int map_som_binary(struct file *file,
const struct som_exec_auxhdr *hpuxhdr)
{
unsigned long code_start, code_size, data_start, data_size;
unsigned long bss_start, som_brk;
int retval;
int prot = PROT_READ | PROT_EXEC;
int flags = MAP_FIXED|MAP_PRIVATE|MAP_DENYWRITE|MAP_EXECUTABLE;
mm_segment_t old_fs = get_fs();
set_fs(get_ds());
code_start = SOM_PAGESTART(hpuxhdr->exec_tmem);
code_size = SOM_PAGEALIGN(hpuxhdr->exec_tsize);
current->mm->start_code = code_start;
current->mm->end_code = code_start + code_size;
retval = vm_mmap(file, code_start, code_size, prot,
flags, SOM_PAGESTART(hpuxhdr->exec_tfile));
if (retval < 0 && retval > -1024)
goto out;
data_start = SOM_PAGESTART(hpuxhdr->exec_dmem);
data_size = SOM_PAGEALIGN(hpuxhdr->exec_dsize);
current->mm->start_data = data_start;
current->mm->end_data = bss_start = data_start + data_size;
retval = vm_mmap(file, data_start, data_size,
prot | PROT_WRITE, flags,
SOM_PAGESTART(hpuxhdr->exec_dfile));
if (retval < 0 && retval > -1024)
goto out;
som_brk = bss_start + SOM_PAGEALIGN(hpuxhdr->exec_bsize);
current->mm->start_brk = current->mm->brk = som_brk;
retval = vm_mmap(NULL, bss_start, som_brk - bss_start,
prot | PROT_WRITE, MAP_FIXED | MAP_PRIVATE, 0);
if (retval > 0 || retval < -1024)
retval = 0;
out:
set_fs(old_fs);
return retval;
}
/*
* These are the functions used to load SOM executables and shared
* libraries. There is no binary dependent code anywhere else.
*/
static int
load_som_binary(struct linux_binprm * bprm)
{
int retval;
unsigned int size;
unsigned long som_entry;
struct som_hdr *som_ex;
struct som_exec_auxhdr *hpuxhdr;
struct pt_regs *regs = current_pt_regs();
/* Get the exec-header */
som_ex = (struct som_hdr *) bprm->buf;
retval = check_som_header(som_ex);
if (retval != 0)
goto out;
/* Now read in the auxiliary header information */
retval = -ENOMEM;
size = som_ex->aux_header_size;
if (size > SOM_PAGESIZE)
goto out;
hpuxhdr = kmalloc(size, GFP_KERNEL);
if (!hpuxhdr)
goto out;
retval = kernel_read(bprm->file, som_ex->aux_header_location,
(char *) hpuxhdr, size);
if (retval != size) {
if (retval >= 0)
retval = -EIO;
goto out_free;
}
/* Flush all traces of the currently running executable */
retval = flush_old_exec(bprm);
if (retval)
goto out_free;
/* OK, This is the point of no return */
current->personality = PER_HPUX;
setup_new_exec(bprm);
/* Set the task size for HP-UX processes such that
* the gateway page is outside the address space.
* This can be fixed later, but for now, this is much
* easier.
*/
current->thread.task_size = 0xc0000000;
/* Set map base to allow enough room for hp-ux heap growth */
current->thread.map_base = 0x80000000;
retval = map_som_binary(bprm->file, hpuxhdr);
if (retval < 0)
goto out_free;
som_entry = hpuxhdr->exec_entry;
kfree(hpuxhdr);
set_binfmt(&som_format);
install_exec_creds(bprm);
setup_arg_pages(bprm, STACK_TOP, EXSTACK_DEFAULT);
create_som_tables(bprm);
current->mm->start_stack = bprm->p;
#if 0
printk("(start_brk) %08lx\n" , (unsigned long) current->mm->start_brk);
printk("(end_code) %08lx\n" , (unsigned long) current->mm->end_code);
printk("(start_code) %08lx\n" , (unsigned long) current->mm->start_code);
printk("(end_data) %08lx\n" , (unsigned long) current->mm->end_data);
printk("(start_stack) %08lx\n" , (unsigned long) current->mm->start_stack);
printk("(brk) %08lx\n" , (unsigned long) current->mm->brk);
#endif
map_hpux_gateway_page(current,current->mm);
start_thread_som(regs, som_entry, bprm->p);
return 0;
/* error cleanup */
out_free:
kfree(hpuxhdr);
out:
return retval;
}
static int load_som_library(struct file *f)
{
/* No lib support in SOM yet. gizza chance.. */
return -ENOEXEC;
}
/* Install the SOM loader.
* N.B. We *rely* on the table being the right size with the
* right number of free slots...
*/
static int __init init_som_binfmt(void)
{
register_binfmt(&som_format);
return 0;
}
static void __exit exit_som_binfmt(void)
{
/* Remove the SOM loader. */
unregister_binfmt(&som_format);
}
core_initcall(init_som_binfmt);
module_exit(exit_som_binfmt);
MODULE_LICENSE("GPL");
......@@ -370,7 +370,6 @@ header-y += snmp.h
header-y += sock_diag.h
header-y += socket.h
header-y += sockios.h
header-y += som.h
header-y += sonet.h
header-y += sonypi.h
header-y += soundcard.h
......
#ifndef _LINUX_SOM_H
#define _LINUX_SOM_H
/* File format definition for SOM executables / shared libraries */
/* we need struct timespec */
#include <linux/time.h>
#define SOM_PAGESIZE 4096
/* this is the SOM header */
struct som_hdr {
short system_id; /* magic number - system */
short a_magic; /* magic number - file type */
unsigned int version_id; /* versiod ID: YYMMDDHH */
struct timespec file_time; /* system clock */
unsigned int entry_space; /* space for entry point */
unsigned int entry_subspace; /* subspace for entry point */
unsigned int entry_offset; /* offset of entry point */
unsigned int aux_header_location; /* auxiliary header location */
unsigned int aux_header_size; /* auxiliary header size */
unsigned int som_length; /* length of entire SOM */
unsigned int presumed_dp; /* compiler's DP value */
unsigned int space_location; /* space dictionary location */
unsigned int space_total; /* number of space entries */
unsigned int subspace_location; /* subspace entries location */
unsigned int subspace_total; /* number of subspace entries */
unsigned int loader_fixup_location; /* MPE/iX loader fixup */
unsigned int loader_fixup_total; /* number of fixup records */
unsigned int space_strings_location; /* (sub)space names */
unsigned int space_strings_size; /* size of strings area */
unsigned int init_array_location; /* reserved */
unsigned int init_array_total; /* reserved */
unsigned int compiler_location; /* module dictionary */
unsigned int compiler_total; /* number of modules */
unsigned int symbol_location; /* symbol dictionary */
unsigned int symbol_total; /* number of symbols */
unsigned int fixup_request_location; /* fixup requests */
unsigned int fixup_request_total; /* number of fixup requests */
unsigned int symbol_strings_location;/* module & symbol names area */
unsigned int symbol_strings_size; /* size of strings area */
unsigned int unloadable_sp_location; /* unloadable spaces location */
unsigned int unloadable_sp_size; /* size of data */
unsigned int checksum;
};
/* values for system_id */
#define SOM_SID_PARISC_1_0 0x020b
#define SOM_SID_PARISC_1_1 0x0210
#define SOM_SID_PARISC_2_0 0x0214
/* values for a_magic */
#define SOM_LIB_EXEC 0x0104
#define SOM_RELOCATABLE 0x0106
#define SOM_EXEC_NONSHARE 0x0107
#define SOM_EXEC_SHARE 0x0108
#define SOM_EXEC_DEMAND 0x010B
#define SOM_LIB_DYN 0x010D
#define SOM_LIB_SHARE 0x010E
#define SOM_LIB_RELOC 0x0619
/* values for version_id. Decimal not hex, yes. Grr. */
#define SOM_ID_OLD 85082112
#define SOM_ID_NEW 87102412
struct aux_id {
unsigned int mandatory :1; /* the linker must understand this */
unsigned int copy :1; /* Must be copied by the linker */
unsigned int append :1; /* Must be merged by the linker */
unsigned int ignore :1; /* Discard section if unknown */
unsigned int reserved :12;
unsigned int type :16; /* Header type */
unsigned int length; /* length of _following_ data */
};
/* The Exec Auxiliary Header. Called The HP-UX Header within HP apparently. */
struct som_exec_auxhdr {
struct aux_id som_auxhdr;
int exec_tsize; /* Text size in bytes */
int exec_tmem; /* Address to load text at */
int exec_tfile; /* Location of text in file */
int exec_dsize; /* Data size in bytes */
int exec_dmem; /* Address to load data at */
int exec_dfile; /* Location of data in file */
int exec_bsize; /* Uninitialised data (bss) */
int exec_entry; /* Address to start executing */
int exec_flags; /* loader flags */
int exec_bfill; /* initialisation value for bss */
};
/* Oh, the things people do to avoid casts. Shame it'll break with gcc's
* new aliasing rules really.
*/
union name_pt {
char * n_name;
unsigned int n_strx;
};
/* The Space Dictionary */
struct space_dictionary_record {
union name_pt name; /* index to subspace name */
unsigned int is_loadable :1; /* loadable */
unsigned int is_defined :1; /* defined within file */
unsigned int is_private :1; /* not sharable */
unsigned int has_intermediate_code :1; /* contains intermediate code */
unsigned int is_tspecific :1; /* thread specific */
unsigned int reserved :11; /* for future expansion */
unsigned int sort_key :8; /* for linker */
unsigned int reserved2 :8; /* for future expansion */
int space_number; /* index */
int subspace_index; /* index into subspace dict */
unsigned int subspace_quantity; /* number of subspaces */
int loader_fix_index; /* for loader */
unsigned int loader_fix_quantity; /* for loader */
int init_pointer_index; /* data pointer array index */
unsigned int init_pointer_quantity; /* number of data pointers */
};
/* The Subspace Dictionary */
struct subspace_dictionary_record {
int space_index;
unsigned int access_control_bits :7;
unsigned int memory_resident :1;
unsigned int dup_common :1;
unsigned int is_common :1;
unsigned int quadrant :2;
unsigned int initially_frozen :1;
unsigned int is_first :1;
unsigned int code_only :1;
unsigned int sort_key :8;
unsigned int replicate_init :1;
unsigned int continuation :1;
unsigned int is_tspecific :1;
unsigned int is_comdat :1;
unsigned int reserved :4;
int file_loc_init_value;
unsigned int initialization_length;
unsigned int subspace_start;
unsigned int subspace_length;
unsigned int reserved2 :5;
unsigned int alignment :27;
union name_pt name;
int fixup_request_index;
unsigned int fixup_request_quantity;
};
#endif /* _LINUX_SOM_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment