Commit ee91d1a4 authored by Matthew Wilcox's avatar Matthew Wilcox Committed by Linus Torvalds

[PATCH] HPUX emulation updates

Build fixes, PA64 fixes, some new hpux syscalls, VFS fixes.
parent b1b782f7
#
# Makefile for the linux kernel.
# Makefile for HPUX emulation
#
obj-y := entry_hpux.o gate.o wrappers.o fs.o ioctl.o sys_hpux.o
EXTRA_AFLAGS := -traditional
include $(TOPDIR)/Rules.make
This diff is collapsed.
......@@ -34,8 +34,7 @@ int hpux_execve(struct pt_regs *regs)
}
struct hpux_dirent {
long d_off_pad; /* we only have a 32-bit off_t */
long d_off;
loff_t d_off;
ino_t d_ino;
short d_reclen;
short d_namlen;
......@@ -52,7 +51,8 @@ struct getdents_callback {
#define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de)))
#define ROUND_UP(x) (((x)+sizeof(long)-1) & ~(sizeof(long)-1))
static int filldir(void * __buf, const char * name, int namlen, loff_t offset, ino_t ino)
static int filldir(void * __buf, const char * name, int namlen, loff_t offset,
ino_t ino, unsigned d_type)
{
struct hpux_dirent * dirent;
struct getdents_callback * buf = (struct getdents_callback *) __buf;
......@@ -96,7 +96,7 @@ int hpux_getdents(unsigned int fd, struct hpux_dirent *dirent, unsigned int coun
buf.count = count;
buf.error = 0;
error = vfs_readdir(file, &buf, filldir);
error = vfs_readdir(file, filldir, &buf);
if (error < 0)
goto out_putf;
error = buf.error;
......@@ -139,7 +139,7 @@ static int cp_hpux_stat(struct kstat *stat, struct hpux_stat64 *statbuf)
return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
}
long hpux_stat64(const char *path, struct hpux_stat64 *buf)
long hpux_stat64(char *filename, struct hpux_stat64 *statbuf)
{
struct kstat stat;
int error = vfs_stat(filename, &stat);
......
/* ------------------------------------------------------------------------------
/*
*
* Linux/PARISC Project (http://www.thepuffingroup.com/parisc)
* 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.
......@@ -8,14 +8,23 @@
* sorry about the wall, puffin..
*/
#define __ASSEMBLY__
#include <asm/assembly.h>
#include <asm/offset.h>
#include <asm/offsets.h>
#include <asm/unistd.h>
#include <asm/errno.h>
#ifdef __LP64__
.level 2.0w
#else
.level 1.1
#endif
.text
#ifdef __LP64__
#define FRAME_SIZE 128
#else
#define FRAME_SIZE 64
#endif
.import hpux_call_table
.import hpux_syscall_exit,code
.export hpux_gateway_page
......@@ -23,35 +32,70 @@
.align 4096
hpux_gateway_page:
nop
mfsp %sr7,%r1 ;! we must set sr3 to the space
mtsp %r1,%sr3 ;! of the user before the gate
#ifdef __LP64__
#warning NEEDS WORK for 64-bit
#endif
ldw -64(%r30), %r28 ;! 8th argument
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
mtsp %r0,%sr7 ;! get kernel space into sr7
mfctl %cr30,%r1 ;! get the kernel task ptr
mtctl %r0,%cr30 ;! zero it (flag)
STREG %r30,TASK_PT_GR30(%r1) ;! preserve userspace sp
STREG %r2,TASK_PT_GR2(%r1) ;! preserve rp
STREG %r27,TASK_PT_GR27(%r1) ;! user dp
STREG %r31,TASK_PT_GR31(%r1) ;! preserve syscall return ptr
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 %r28, TASK_PT_ORIG_R28(%r1) /* return value 0 (saved for signals) */
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 */
loadgp ;! setup kernel dp
mfctl %cr11, %r27 /* i.e. SAR */
STREG %r27, TASK_PT_SAR(%r1)
ldo TASK_SZ_ALGN+64(%r1),%r30 ;! set up kernel stack
loadgp
stw %r21, -52(%r30) ;! 5th argument
stw %r20, -56(%r30) ;! 6th argument
stw %r19, -60(%r30) ;! 7th argument
stw %r28, -64(%r30) ;! 8th argument
stw %r29, -64(%r30) ;! 8th argument
ldil L%hpux_call_table, %r21
ldo R%hpux_call_table(%r21), %r21
......
......@@ -19,6 +19,7 @@
* TIOCSPGRP
*/
#include <linux/sched.h>
#include <linux/smp_lock.h>
#include <asm/errno.h>
#include <asm/ioctl.h>
......@@ -54,10 +55,6 @@ int hpux_ioctl(int fd, unsigned long cmd, unsigned long arg)
case 't':
result = hpux_ioctl_t(fd, cmd, arg);
break;
default:
/* If my mother ever sees this, I hope she disowns me.
* Take this out after NYLWE. */
result = sys_ioctl(fd, cmd, arg);
}
return result;
}
This diff is collapsed.
/*------------------------------------------------------------------------------
* Native PARISC/Linux Project (http://www.puffingroup.com/parisc)
/*
* Linux/PARISC Project (http://www.parisc-linux.org/)
*
* HP-UX System Call Wrapper routines and System Call Return Path
*
......@@ -24,12 +24,11 @@
#warning Must be changed for PA64
#endif
#include <asm/offset.h>
#include <asm/offsets.h>
.level 1.1
.text
#define __ASSEMBLY__
#include <asm/assembly.h>
#include <asm/signal.h>
......@@ -81,6 +80,7 @@
.export hpux_fork_wrapper
.export hpux_child_return
.import sys_fork
hpux_fork_wrapper:
......@@ -91,12 +91,10 @@ hpux_fork_wrapper:
stw %r2,-20(%r30)
ldo 64(%r30),%r30
stw %r2,PT_GR19(%r1) ;! save for child
stw %r30,PT_GR20(%r1) ;! save for child
ldil L%child_return,%r3
ldo R%child_return(%r3),%r3
stw %r3,PT_GR21(%r1) ;! save for child
stw %r30,PT_GR21(%r1) ;! save for child
ldw TASK_PT_GR30(%r1),%r25
ldw PT_GR30(%r1),%r25
mtctl %r25,%cr29
copy %r1,%r24
bl sys_clone,%r2
ldi SIGCHLD,%r26
......@@ -130,7 +128,12 @@ fork_exit:
/* Set the return value for the child */
child_return:
hpux_child_return:
#if CONFIG_SMP || CONFIG_PREEMPT
bl schedule_tail, %r2
nop
#endif
ldw TASK_PT_GR19-TASK_SZ_ALGN-128(%r30),%r2
b fork_return
copy %r0,%r28
......@@ -242,3 +245,10 @@ hpux_syscall_exit:
no_error:
b syscall_exit
nop
.export hpux_unimplemented_wrapper
.import hpux_unimplemented
hpux_unimplemented_wrapper:
b hpux_unimplemented
stw %r22,-64(%r30) /* overwrite arg8 with syscall number */
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