2
0
Fork 0

Eric's changes plaus changes from home.

This commit is contained in:
mike 1994-03-28 08:30:05 +00:00
parent 845755c0bf
commit d561792e14
12 changed files with 224 additions and 28 deletions

View file

@ -7,11 +7,11 @@ you need to create some device files:
# mknod /dev/socksys c 30 0
/dev/X0R - server side of SVR local X interface (see comments in TECH)
/dev/X0R - server side of SVR local X interface (see comments in Doc/Local-X)
# ln -s /dev/null /dev/X0R
/dev/spx - client side of SVR local X interface (see comments in TECH)
/dev/spx - client side of SVR local X interface (see comments in Doc/Local-X)
# mknod /dev/spx c 30 1

22
Doc/Local-X Normal file
View file

@ -0,0 +1,22 @@
** Local X interface
The local X interface is simplistic. It assumes only one local X server
exists and assumes that the pathname of the Unix domain socket for
local connections is always /tmp/.X11-unix/X0.
The SCO code opens both /dev/X0R and /dev/spx, writes a single byte
to /dev/X0R, reads a message from /dev/X0R with getmsg then writes this
message to /dev/spx with putmsg and closes /dev/X0R. This establishes
the /dev/spx file descriptor as a connection to the X server listening
on /dev/X0R.
We ignore all activity on the /dev/X0R device (hence it is a link to
/dev/null), getmsg and putmsg are stubbed so don't do anything and opens
on the /dev/spx simply replace the open inode with a socket connected
to the X server's Unix domain socket.
At some point in the future we will implement a simple minded /dev/X*
driver that returns some form of id via the getmsg which can then be
passed to /dev/spx with putmsg and which will allow /dev/spx to connect
to the relevant X server. This will only happen if someone actually
*needs* multiple local X servers...

View file

@ -1,7 +1,7 @@
#
# Makefile for the iBCS emulator files
#
# $Id: Makefile,v 1.7 1994/03/24 12:08:48 mike Exp $
# $Id: Makefile,v 1.8 1994/03/28 08:29:55 mike Exp $
# $Source: /nfs4/sophia/home/mjagdis/src/ibcs.cvs/ibcs/Makefile,v $
#
# Note! Dependencies are done automagically by 'make dep', which also
@ -69,7 +69,7 @@ include /usr/src/linux/.config
$(CC) $(CFLAGS) -c $<
OBJS = binfmt_coff.o binfmt_elf.o binfmt_xout.o \
map.o coff.o ioctl.o ipc.o mmap.o open.o \
map.o coff.o hrtsys.o ioctl.o ipc.o mmap.o open.o \
socket.o poll.o signal.o stat.o sysconf.o sysfs.o sysi86.o socksys.o \
ulimit.o wysev386.o wysev386i.o xnx.o xstat.o stream.o

View file

@ -1,7 +1,7 @@
#
# Makefile for the iBCS emulator files
#
# $Id: Makefile,v 1.7 1994/03/24 12:08:48 mike Exp $
# $Id: Makefile,v 1.8 1994/03/28 08:29:55 mike Exp $
# $Source: /nfs4/sophia/home/mjagdis/src/ibcs.cvs/ibcs/iBCSemul/Makefile,v $
#
# Note! Dependencies are done automagically by 'make dep', which also
@ -69,7 +69,7 @@ include /usr/src/linux/.config
$(CC) $(CFLAGS) -c $<
OBJS = binfmt_coff.o binfmt_elf.o binfmt_xout.o \
map.o coff.o ioctl.o ipc.o mmap.o open.o \
map.o coff.o hrtsys.o ioctl.o ipc.o mmap.o open.o \
socket.o poll.o signal.o stat.o sysconf.o sysfs.o sysi86.o socksys.o \
ulimit.o wysev386.o wysev386i.o xnx.o xstat.o stream.o

161
iBCSemul/hrtsys.c Normal file
View file

@ -0,0 +1,161 @@
/*
* linux/ibcs/hrtsys.c
*
* Copyright (C) 1994 Eric youngdale.
*
* The hrtsys interface is used by SVr4, and is effectively a way of doing
* itimer. I do not know why this is used instead of the regular itimer
* stuff, but it appears to be related to bsd programs/functionality.
*/
#include <linux/ptrace.h>
#include <linux/errno.h>
#include <linux/mm.h>
#include <linux/string.h>
#include <asm/segment.h>
struct hrt_time_t {
unsigned long secs;
unsigned long sub_sec; /* Less than one second. */
unsigned long resolution; /* Resolution of timer */
};
struct hrtcmd{
int cmd;
int clk;
struct hrt_time_t interval;
struct hrt_time_t tod;
int flags;
int error;
int reserved[3];
};
static int ibcs_hrtcntl(struct pt_regs * regs) {
unsigned int param[4];
struct timeval * tv;
int i, error;
for(i=0; i<4; i++)
param[i] = get_fs_long(((unsigned long *) regs->esp) + 2 + i);
if(param[0] != 1 || param[1] != 1 || param[2] != 0) return -EINVAL;
tv = (struct timeval *) param[3];
printk(KERN_DEBUG "hrtcntl(%x)\n", tv);
error = verify_area(VERIFY_WRITE, (char *) tv,sizeof *tv);
if (error)
return error;
return sys_gettimeofday(tv, NULL);
}
static int ibcs_hrtalarm(struct pt_regs * regs) {
struct itimerval get_buffer;
struct hrtcmd * hcmd;
int i, error, cmd, retval, which;
int old_fs = get_fs();
i = get_fs_long(((unsigned long *) regs->esp) + 3);
if(i != 1) return -EINVAL;
hcmd = (struct hrtcmd *) get_fs_long(((unsigned long *) regs->esp) + 2);
error = verify_area(VERIFY_WRITE, (char *) hcmd,sizeof *hcmd);
if (error)
return error;
cmd = get_fs_long(((unsigned long *) hcmd));
/* Now figure out which clock we want to fiddle with */
which = get_fs_long(((unsigned long *) hcmd)+1);
printk(KERN_DEBUG "%d hrtalarm(%x %d)\n",
current->pid, cmd, which);
switch(which){
case 4:
which = 2;
break;
case 2:
which = 1;
break;
case 1:
which = 0;
break;
default:
return -EINVAL;
};
switch(cmd) {
case 0xc:
if(get_fs_long(((unsigned long *) hcmd)+4) != 1000000) return -EINVAL;
memcpy_fromfs(&get_buffer.it_value, ((unsigned long *) hcmd)+2,
sizeof(struct timeval));
memset(&get_buffer.it_interval, 0, sizeof(struct timeval));
set_fs(get_ds());
retval = sys_setitimer(which, &get_buffer, NULL);
set_fs(old_fs);
break;
case 0xd:
set_fs(get_ds());
retval = sys_getitimer(which, &get_buffer);
set_fs(old_fs);
printk(KERN_DEBUG "hrtalarm(d %x) %x %x %x %x\n", hcmd,
get_buffer.it_interval.tv_sec,
get_buffer.it_interval.tv_usec,
get_buffer.it_value.tv_sec,
get_buffer.it_value.tv_usec);
put_fs_long(1000000, &hcmd->interval.resolution);
memcpy_tofs(((unsigned long *) hcmd)+2, &get_buffer.it_interval,
sizeof(get_buffer));
retval = 1;
break;
case 0xf:
if(get_fs_long(((unsigned long *) hcmd)+4) != 1000000) return -EINVAL;
if(get_fs_long(((unsigned long *) hcmd)+7) != 1000000) return -EINVAL;
memcpy_fromfs(&get_buffer.it_value, &hcmd->tod,
sizeof(struct timeval));
memcpy_fromfs(&get_buffer.it_interval, &hcmd->interval,
sizeof(struct timeval));
set_fs(get_ds());
retval = sys_setitimer(which, &get_buffer, NULL);
set_fs(old_fs);
break;
case 0x10:
memset(&get_buffer, 0, sizeof(get_buffer));
set_fs(get_ds());
retval = sys_setitimer(which, &get_buffer, NULL);
set_fs(old_fs);
break;
default:
retval = -EINVAL;
};
return retval;
}
int ibcs_hrtsys(struct pt_regs * regs) {
int func, retval;
func = get_fs_long(((unsigned long *) regs->esp) + 1);
printk(KERN_DEBUG "hrtsys(%d)\n", func);
switch(func){
case 0:
retval = ibcs_hrtcntl(regs);
break;
case 1:
retval = ibcs_hrtalarm(regs);
break;
case 2:
case 3:
default:
retval = -EINVAL;
break;
}
return retval;
}

View file

@ -5,7 +5,7 @@
*
* Writtin by Drew Sullivan.
*
* $Id: ioctl.c,v 1.2 1994/03/14 15:01:22 mike Exp $
* $Id: ioctl.c,v 1.3 1994/03/28 08:29:58 mike Exp $
* $Source: /nfs4/sophia/home/mjagdis/src/ibcs.cvs/ibcs/iBCSemul/ioctl.c,v $
*/
#include <linux/errno.h>
@ -50,6 +50,16 @@ int ibcs_ioctl(int fd, unsigned int ioctl_num, void *arg)
{
unsigned int class = ioctl_num >> 8;
if(ioctl_num & 0xe0000000) {
/* Must be an ioctl from SVr4 as specified in sys/iocomm.h */
switch(ioctl_num){
case 0x4004667f:
return sys_ioctl(fd, FIONREAD, arg);
default:
return -EINVAL;
};
}
switch (class) {
case 'f':
switch (ioctl_num & 0xff) {

View file

@ -3,7 +3,7 @@
*
* Copyright (C) 1994 Mike Jagdis (jaggy@purplet.demon.co.uk)
*
* $Id: map.c,v 1.1 1994/03/03 11:36:11 mike Exp $
* $Id: map.c,v 1.2 1994/03/28 08:29:58 mike Exp $
* $Source: /nfs4/sophia/home/mjagdis/src/ibcs.cvs/ibcs/iBCSemul/map.c,v $
*/
@ -26,7 +26,7 @@
/* Socket subsystem maps. */
#include "sockaf.inc"
#include "sockopt.inc"
#include "sockdom.inc"
#include "socktype.inc"
int

View file

@ -8,7 +8,7 @@
* to resolve a syscall or when changing trace settings.
* Careful!
*
* $Id: callmap.inc,v 1.6 1994/03/15 17:26:39 mike Exp $
* $Id: callmap.inc,v 1.7 1994/03/28 08:29:56 mike Exp $
* $Source: /nfs4/sophia/home/mjagdis/src/ibcs.cvs/ibcs/iBCSemul/maps/callmap.inc,v $
*/
@ -149,9 +149,9 @@ static IBCS_func XNX_func_0x28[] = {
{ xnx_sigprocmask, 3 ITR(1, "sigprocmask", "dxx") }, /* 40 */
{ xnx_sigpending, 1 ITR(1, "sigpending", "x") }, /* 41 */
{ xnx_sigsuspend, 1 ITR(1, "sigsuspend", "x") }, /* 42 */
{ sys_getgroups, 2 ITR(1, "getgroups", "dx") }, /* 43 */
{ sys_setgroups, 2 ITR(1, "setgroups", "dx") }, /* 44 */
{ sys_sysconf, 1 ITR(1, "sysconf", "d") }, /* 45 */
{ sys_getgroups, 2 ITR(0, "getgroups", "dx") }, /* 43 */
{ sys_setgroups, 2 ITR(0, "setgroups", "dx") }, /* 44 */
{ sys_sysconf, 1 ITR(0, "sysconf", "d") }, /* 45 */
{ xnx_pathconf, 2 ITR(1, "pathconf", "xd") }, /* 46 */
{ xnx_fpathconf, 2 ITR(1, "fpathconf", "dd") } /* 47 */
};
@ -279,7 +279,7 @@ static IBCS_func iBCS_func_0x48[] = {
{ 0, Ukn ITR(1, "rdebug", "") }, /* 76 */
{ 0, Ukn ITR(1, "rfstop", "") }, /* 77 */
{ 0, Ukn ITR(1, "rfsys", "") }, /* 78 */
{ sys_rmdir, 1 ITR(1, "rmdir", "s") } /* 79 */
{ sys_rmdir, 1 ITR(0, "rmdir", "s") } /* 79 */
};
static IBCS_func iBCS_func_0x50[] = {
{ sys_mkdir, 2 ITR(0, "mkdir", "so") }, /* 80 */
@ -299,7 +299,7 @@ static IBCS_func iBCS_func_0x58[] = {
{ sys_getgroups, 2 ITR(0, "getgroups", "dp") }, /* 92 */
{ 0, 3 ITR(1, "fchmod", "do") }, /* 93 */
{ 0, 3 ITR(1, "fchown", "dxx") }, /* 94 */
{ abi_sigprocmask, 3 ITR(1, "sigprocmask", "dxx") } /* 95 */
{ abi_sigprocmask, 3 ITR(0, "sigprocmask", "dxx") } /* 95 */
};
static IBCS_func SCOSVR3_func_0x58[] = {
{ 0, Ukn ITR(1, "?", "") }, /* 88 */
@ -312,9 +312,9 @@ static IBCS_func SCOSVR3_func_0x58[] = {
{ 0, Ukn ITR(1, "?", "") } /* 95 */
};
static IBCS_func iBCS_func_0x60[] = {
{ abi_sigsuspend, Spl ITR(1, "sigsuspend", "x") }, /* 96 */
{ abi_sigsuspend, Spl ITR(0, "sigsuspend", "x") }, /* 96 */
{ 0, 2 ITR(1, "sigaltstack", "xx") }, /* 97 */
{ abi_sigaction, 3 ITR(1, "sigaction", "dxx") }, /* 98 */
{ abi_sigaction, 3 ITR(0, "sigaction", "dxx") }, /* 98 */
{ 0, 1 ITR(1, "sigpending", "x") }, /* 99 */
{ 0, Ukn ITR(1, "context", "") }, /* 100 */
{ 0, Ukn ITR(1, "evsys", "") }, /* 101 */
@ -327,7 +327,7 @@ static IBCS_func iBCS_func_0x68[] = {
{ 0, Ukn ITR(1, "nfssys", "") }, /* 106 */
{ 0, Ukn ITR(1, "waitsys", "") }, /* 107 */
{ 0, Ukn ITR(1, "sigsendsys", "") }, /* 108 */
{ 0, Ukn ITR(1, "hrtsys", "") }, /* 109 */
{ ibcs_hrtsys, Spl ITR(0, "hrtsys", "xxx") }, /* 109 */
{ 0, Ukn ITR(1, "acancel", "") }, /* 110 */
{ 0, Ukn ITR(1, "async", "") } /* 111 */
};

View file

@ -3,7 +3,7 @@
*
* Copyright (C) 1994 Mike Jagdis (jaggy@purplet.demon.co.uk)
*
* $Id: socksys.c,v 1.7 1994/03/21 13:53:34 mike Exp $
* $Id: socksys.c,v 1.8 1994/03/28 08:29:59 mike Exp $
* $Source: /nfs4/sophia/home/mjagdis/src/ibcs.cvs/ibcs/iBCSemul/socksys.c,v $
*/
@ -124,12 +124,12 @@ socksys_syscall(struct inode *inode, struct file *file, int *sp)
int fd;
put_fs_long(
map_value(dom_map,
map_value(af_map,
get_fs_long(((unsigned long *)sp)+0),
0),
((unsigned long *)sp)+0);
put_fs_long(
map_value(af_map,
map_value(type_map,
get_fs_long(((unsigned long *)sp)+1),
0),
((unsigned long *)sp)+1);

View file

@ -3,7 +3,7 @@
*
* Copyright (C) 1994 Mike Jagdis (jaggy@purplet.demon.co.uk)
*
* $Id: wysev386.c,v 1.2 1994/03/03 11:36:16 mike Exp $
* $Id: wysev386.c,v 1.3 1994/03/28 08:30:00 mike Exp $
* $Source: /nfs4/sophia/home/mjagdis/src/ibcs.cvs/ibcs/iBCSemul/wysev386.c,v $
*/
@ -69,12 +69,12 @@ int wv386_wait3(int *loc)
int wv386_socket(struct pt_regs *regs)
{
put_fs_long(
map_value(dom_map,
map_value(af_map,
get_fs_long(((unsigned long*)regs->esp)+1),
0),
((unsigned long *)regs->esp)+1);
put_fs_long(
map_value(af_map,
map_value(type_map,
get_fs_long(((unsigned long*)regs->esp)+2),
0),
((unsigned long *)regs->esp)+2);

View file

@ -1,7 +1,7 @@
/*
* Function prototypes used by the iBCS2 emulator
*
* $Id: ibcs.h,v 1.5 1994/03/04 15:09:09 mike Exp $
* $Id: ibcs.h,v 1.6 1994/03/28 08:29:57 mike Exp $
* $Source: /nfs4/sophia/home/mjagdis/src/ibcs.cvs/ibcs/include/ibcs/ibcs.h,v $
*/
#include <linux/sys.h> /* for fn_ptr */
@ -105,6 +105,9 @@ struct poll{
};
extern int ibcs_poll(struct poll * ufds, size_t nfds, int timeout);
/* hrtsys.c */
extern int ibcs_hrtsys(struct pt_regs * regs);
/* signal.c */
void ibcs_sig_handler (struct pt_regs * regs, int sig, __sighandler_t handler);
extern int ibcs_signal(struct pt_regs * regs);

View file

@ -3,18 +3,18 @@
*
* Copyright (C) 1994 Mike Jagdis (jaggy@purplet.demon.co.uk)
*
* $Id: map.h,v 1.1 1994/03/03 11:36:11 mike Exp $
* $Id: map.h,v 1.2 1994/03/28 08:29:59 mike Exp $
* $Source: /nfs4/sophia/home/mjagdis/src/ibcs.cvs/ibcs/include/ibcs/map.h,v $
*/
struct map_segment {
int start, end;
char *map;
unsigned char *map;
};
extern struct map_segment *af_map[];
extern struct map_segment *dom_map[];
extern struct map_segment *type_map[];
extern struct map_segment *sopt_map[];
extern int map_value(struct map_segment *m[], int val, int def);