aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Benedict Torvalds <torvalds@klaava.Helsinki.FI>1992-04-08 09:03:21 +0000
committerNicolas Pitre <nico@cam.org>2007-08-19 14:19:02 -0400
commitb5de4a78ce363e94ad92d82c6ef2d6909bdd00dd (patch)
treeac9843150c2941e31a19baa5774900e5654e196d
parent4fd4c0232da4a9f7e163df707699cd74c1dc6fa8 (diff)
downloadarchive-b5de4a78ce363e94ad92d82c6ef2d6909bdd00dd.tar.gz
linux-0.95c known bugsv0.95c+
Well, only one known bug so far, but a couple of problems. I thought I'd mention them before anyone else does, and we'll call them "features" :^) The BUG: when using the readdir() system call, linux incorrectly doesn't let go of the last buffer used for reading: this results in the buffer being marked as used (and if you use readdir() heavily, the counter will eventually wrap around, which might result in incorrect marking as "not used"). This bug happily isn't easy to find: no current binary uses the readdir() system call unless you have gotten your hands on the new VFS gcc-2.1 release. Thanks to Remy Card for finding this one. Not too bad a bug though: the fix is very easy. Add a 'brelse(bh);' in the minix_readdir() function, like this: if (i) { put_fs_long(de->inode,&dirent->d_ino); put_fs_byte(0,i+dirent->d_name); put_fs_word(i,&dirent->d_reclen); return i; should really be : if (i) { put_fs_long(de->inode,&dirent->d_ino); put_fs_byte(0,i+dirent->d_name); put_fs_word(i,&dirent->d_reclen); + brelse (bh); return i; That is, just add the brelse before the early return. Sorry for the lack of real cdiffs - I'm not at home right now, and the above was taken directly from the bug-report mail. The problems: I've had one report that the floppy-driver in versions 0.95x breaks when accessing drive nr 2. It doesn't on my machine, but I'd appreciate it if people would test it out, and mail me about any problems. So far, only one report, but that's one too many. 0.95c doesn't correctly keep track of the 'rss' field in the task-structure. A fix was already posted (and nothing breaks even if you don't apply the fix - ps just gives slightly incorrect output) And the expected troubles with the change of 'a.out.h' - the old gdb doesn't recognize new executables etc. As soon as I get my own sources cleaned up, I'll send out a new binary for the 0.95c+ kernel to the ftp-sites. I've gotten a few mails from people unable to recompile everything - either because of lack of diskspace or some other problem. Tomorrow I'll put the new kernel image on nic.funet.fi and tsx-11 - it's basically the 0.95c kernel + the above bugfix + the lp-patches (somewhat edited by me). Linus <README-0.95c+> This is release 0.95c+ of the linux kernel - it contains some enhancements and bugfixes to the 0.95a kernel, as well as some minor fixes relative to the last alpha-patch (0.95c). The release is available as - binary (bootimage-0.95c+.Z) - full source (linux-0.95c+.tar.Z) - patches rel. to 0.95c (diff-0.95c.c+.Z) - patches rel. to 0.95a (diff-0.95a.c+.Z) NOTE TO PATCHERS!! Before patching, do this: - make an empty include-file linux/include/checkpoint.h - rename linux/kernel/math/math_emulate.c as just emulate.c That is, from the linux source directory do: $ > include/checkpoint.h $ mv kernel/math/math_emulate.c kernel/math/emulate.c Also note that patching from the 0.95a version is probably not worth it as it's easier to get the complete new sources. Although I'm making binaries and the full source available, this isn't really a major release: there is no new rootdisk, and this is more "my current kernel" and not really tested (I put in the last changes 5 minutes before packing all this up). The reason I'm making this available is that with the advent of gcc-2.1 and the VFS-library the old kernel doesn't really do everything the new libraries want: the readdir system call is needed to get things working. The default compiler after this release is considered to be gcc-2.0 or higher (although 1.40 still works - you don't /have/ to change). People who are unable or unwilling to patch a new kernel shouldn't be unable to run the new binaries. This kernel should be totally backwards compatible, so no binaries should break. I resisted adding the changed mount() system call into this release: the next major release will have a third parameter for mount() - the filesystem type name (ie mount /dev/xxx /mnt minix). Fixes relative to 0.95c: - corrected two minor bugs in readdir() (thanks to R Card) - lp-patches are in. I've edited them a bit, and will probably do some more editing in the future, but they seem to work fine. - 8-bit ISO latin output to the console (ie part of Johan Myreens general latin-1 patches: the keyboard patches aren't there) - other minor bug-fixes (thanks to HH Bergman for noticing the timer-table bug) Things I haven't had time to look into yet: - select still has some problems - reports that VC-output sometimes isdiscarded (never seen it myself) - probably other things I've simply forgot... Linus
-rw-r--r--Makefile18
-rw-r--r--fs/char_dev.c9
-rw-r--r--fs/minix/file_dev.c1
-rw-r--r--fs/read_write.c10
-rw-r--r--include/checkpoint.h0
-rw-r--r--include/linux/config.h23
-rw-r--r--include/linux/config_rel.h1
-rw-r--r--include/linux/config_ver.h1
-rw-r--r--include/linux/lp.h114
-rw-r--r--kernel/blk_drv/floppy.c2
-rw-r--r--kernel/blk_drv/hd.c2
-rw-r--r--kernel/chr_drv/Makefile17
-rw-r--r--kernel/chr_drv/console.c46
-rw-r--r--kernel/chr_drv/lp.c127
-rw-r--r--kernel/chr_drv/tty_io.c12
-rw-r--r--kernel/exit.c61
-rw-r--r--kernel/math/Makefile4
-rw-r--r--kernel/math/emulate.c (renamed from kernel/math/math_emulate.c)2
-rw-r--r--kernel/sched.c4
-rwxr-xr-xmakever.sh13
-rw-r--r--mm/swap.c7
21 files changed, 390 insertions, 84 deletions
diff --git a/Makefile b/Makefile
index e06ae02..59d5f66 100644
--- a/Makefile
+++ b/Makefile
@@ -8,8 +8,8 @@ MATH_EMULATION = -DKERNEL_MATH_EMULATION
# uncomment the correct keyboard:
#
-KEYBOARD = -DKBD_FINNISH
-# KEYBOARD = -DKBD_US
+# KEYBOARD = -DKBD_FINNISH
+KEYBOARD = -DKBD_US
# KEYBOARD = -DKBD_GR
# KEYBOARD = -DKBD_FR
# KEYBOARD = -DKBD_UK
@@ -18,13 +18,13 @@ KEYBOARD = -DKBD_FINNISH
#
# uncomment this line if you are using gcc-1.40
#
-#GCC_OPT = -fcombine-regs
+#GCC_OPT = -fcombine-regs -fstrength-reduce
#
# standard CFLAGS
#
-CFLAGS =-Wall -O -fstrength-reduce -fomit-frame-pointer $(GCC_OPT)
+CFLAGS =-Wall -O6 -fomit-frame-pointer $(GCC_OPT)
#
# ROOT_DEV specifies the default root-device when making the image.
@@ -32,7 +32,7 @@ CFLAGS =-Wall -O -fstrength-reduce -fomit-frame-pointer $(GCC_OPT)
# default of FLOPPY is used by 'build'.
#
-ROOT_DEV = /dev/hdb1
+# ROOT_DEV = /dev/hdb1
#
# if you want the ram-disk device, define this to be the
@@ -67,7 +67,13 @@ LIBS =lib/lib.a
$(CC) $(CFLAGS) \
-nostdinc -Iinclude -c -o $*.o $<
-all: Image
+all: Version Image
+
+Version:
+ @./makever.sh
+ @echo \#define UTS_RELEASE \"0.95c-`cat .version`\" > include/linux/config_rel.h
+ @echo \#define UTS_VERSION \"`date +%D`\" > include/linux/config_ver.h
+ touch include/linux/config.h
Image: boot/bootsect boot/setup tools/system tools/build
cp tools/system system.tmp
diff --git a/fs/char_dev.c b/fs/char_dev.c
index b174dcb..081b18e 100644
--- a/fs/char_dev.c
+++ b/fs/char_dev.c
@@ -10,11 +10,13 @@
#include <linux/sched.h>
#include <linux/kernel.h>
+#include <checkpoint.h>
#include <asm/segment.h>
#include <asm/io.h>
extern int tty_read(unsigned minor,char * buf,int count,unsigned short flags);
extern int tty_write(unsigned minor,char * buf,int count);
+extern int lp_write(unsigned minor,char *buf, int count);
typedef (*crw_ptr)(int,unsigned,char *,int,off_t *,unsigned short);
@@ -24,6 +26,11 @@ static int rw_ttyx(int rw,unsigned minor,char * buf,int count,off_t * pos, unsig
tty_write(minor,buf,count));
}
+static int rw_lp(int rw,unsigned minor,char * buf,int count,off_t * pos, unsigned short flags)
+{
+ return ((rw==READ)?-EINVAL:lp_write(minor,buf,count));
+}
+
static int rw_tty(int rw,unsigned minor,char * buf,int count, off_t * pos, unsigned short flags)
{
if (current->tty<0)
@@ -159,7 +166,7 @@ static crw_ptr crw_table[]={
NULL, /* /dev/hd */
rw_ttyx, /* /dev/ttyx */
rw_tty, /* /dev/tty */
- NULL, /* /dev/lp */
+ rw_lp, /* /dev/lp */
NULL}; /* unnamed pipes */
int char_read(struct inode * inode, struct file * filp, char * buf, int count)
diff --git a/fs/minix/file_dev.c b/fs/minix/file_dev.c
index 525aa7b..91995d9 100644
--- a/fs/minix/file_dev.c
+++ b/fs/minix/file_dev.c
@@ -49,6 +49,7 @@ int minix_readdir(struct inode * inode, struct file * filp, struct dirent * dire
put_fs_long(de->inode,&dirent->d_ino);
put_fs_byte(0,i+dirent->d_name);
put_fs_word(i,&dirent->d_reclen);
+ brelse(bh);
return i;
}
}
diff --git a/fs/read_write.c b/fs/read_write.c
index e99c287..1a9b20a 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -14,7 +14,11 @@
#include <linux/minix_fs.h>
#include <asm/segment.h>
-int sys_readdir(unsigned int fd, struct dirent * dirent)
+/*
+ * Count is not yet used: but we'll probably support reading several entries
+ * at once in the future. Use count=1 in the library for future expansions.
+ */
+int sys_readdir(unsigned int fd, struct dirent * dirent, unsigned int count)
{
struct file * file;
struct inode * inode;
@@ -22,8 +26,10 @@ int sys_readdir(unsigned int fd, struct dirent * dirent)
if (fd >= NR_OPEN || !(file = current->filp[fd]) ||
!(inode = file->f_inode))
return -EBADF;
- if (file->f_op && file->f_op->readdir)
+ if (file->f_op && file->f_op->readdir) {
+ verify_area(dirent, sizeof (*dirent));
return file->f_op->readdir(inode,file,dirent);
+ }
return -EBADF;
}
diff --git a/include/checkpoint.h b/include/checkpoint.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/include/checkpoint.h
diff --git a/include/linux/config.h b/include/linux/config.h
index fc2ce17..8c79f93 100644
--- a/include/linux/config.h
+++ b/include/linux/config.h
@@ -2,21 +2,22 @@
#define _CONFIG_H
/*
- * Define this if you want the math-emulation code: if this is undefined,
- * the kernel will be smaller, but you'll get FPU exceptions if you don't
- * have a 387 and are trying to use math.
- */
-
-#define KERNEL_MATH_EMULATION
-
-
-/*
* Defines for what uname() should return
*/
+#ifndef UTS_SYSNAME
#define UTS_SYSNAME "Linux"
+#endif
+#ifndef UTS_NODENAME
#define UTS_NODENAME "(none)" /* set by sethostname() */
-#define UTS_RELEASE "0" /* patchlevel */
-#define UTS_VERSION "0.95a"
+#endif
+#include <linux/config_rel.h>
+#ifndef UTS_RELEASE
+#define UTS_RELEASE "0.95c-0"
+#endif
+#include <linux/config_ver.h>
+#ifndef UTS_VERSION
+#define UTS_VERSION "mm/dd/yy"
+#endif
#define UTS_MACHINE "i386" /* hardware type */
/* Don't touch these, unless you really know what your doing. */
diff --git a/include/linux/config_rel.h b/include/linux/config_rel.h
new file mode 100644
index 0000000..0e26529
--- /dev/null
+++ b/include/linux/config_rel.h
@@ -0,0 +1 @@
+#define UTS_RELEASE "0.95c-18"
diff --git a/include/linux/config_ver.h b/include/linux/config_ver.h
new file mode 100644
index 0000000..1024624
--- /dev/null
+++ b/include/linux/config_ver.h
@@ -0,0 +1 @@
+#define UTS_VERSION "04/09/92"
diff --git a/include/linux/lp.h b/include/linux/lp.h
new file mode 100644
index 0000000..69049a7
--- /dev/null
+++ b/include/linux/lp.h
@@ -0,0 +1,114 @@
+/*
+$Header: /usr/src/linux/include/linux/lp.h,v 1.2 1992/01/21 23:59:24 james_r_wiegand Exp james_r_wiegand $
+*/
+
+#include <errno.h>
+#include <linux/kernel.h>
+#include <linux/sched.h>
+#include <asm/io.h>
+#include <asm/segment.h>
+
+/*
+ * usr/include/linux/lp.h c.1991-1992 James Wiegand
+ */
+
+/*
+ * caveat: my machine only has 1 printer @ lpt2 so lpt1 & lpt3 are
+ * implemented but UNTESTED
+ */
+
+/*
+ * Per POSIX guidelines, this module reserves the LP and lp prefixes
+ */
+#define LP_EXIST 0x0001
+#define LP_SELEC 0x0002
+#define LP_BUSY 0x0004
+#define LP_OFFL 0x0008
+#define LP_NOPA 0x0010
+#define LP_ERR 0x0020
+
+#define LP_TIMEOUT 200000
+
+#define LP_B(minor) lp_table[(minor)].base
+#define LP_F(minor) lp_table[(minor)].flags
+#define LP_T(minor) lp_table[(minor)].lp_task
+#define LP_S(minor) inb(LP_B((minor)) + 1)
+#define LP_R(minor) lp_table[(minor)].remainder
+
+/*
+since we are dealing with a horribly slow device
+I don't see the need for a queue
+*/
+#ifndef __LP_C__
+ extern
+#endif
+struct lp_struct {
+ int base;
+ int flags;
+ /* number of characters yet to be printed in current block */
+ int remainder;
+ /* needed for busy determination */
+ int lp_task;
+};
+
+/*
+ * the BIOS manuals say there can be up to 4 lpt devices
+ * but I have not seen a board where the 4th address is listed
+ * if you have different hardware change the table below
+ * please let me know if you have different equipment
+ * if you have more than 3 printers, remember to increase LP_NO
+ */
+#ifndef __LP_C__
+ extern
+#endif
+struct lp_struct lp_table[] = {
+ { 0x3bc, 0, },
+ { 0x378, 0, },
+ { 0x278, 0, }
+};
+
+#define LP_NO 3
+
+/*
+ * bit defines for 8255 status port
+ * base + 1
+ */
+#define LP_PBUSY 0x80 /* active low */
+#define LP_PACK 0x40 /* active low */
+#define LP_POUTPA 0x20
+#define LP_PSELECD 0x10
+#define LP_PERRORP 0x08 /*å active low*/
+#define LP_PIRQ 0x04 /* active low */
+
+/*
+ * defines for 8255 control port
+ * base + 2
+ */
+#define LP_PIRQEN 0x10
+#define LP_PSELECP 0x08
+#define LP_PINITP 0x04 /* active low */
+#define LP_PAUTOLF 0x02
+#define LP_PSTROBE 0x01
+
+/*
+ * the value written to ports to test existence. PC-style ports will
+ * return the value written. AT-style ports will return 0. so why not
+ * make them the same ?
+ */
+#define LP_DUMMY 0x00
+
+/*
+ * this is the port delay time. your mileage may vary
+ */
+#define LP_DELAY 150000
+
+/*
+ * function prototypes
+ */
+
+extern void lp_init(void);
+
+extern int lp_reset(int minor);
+extern int lp_char(char lpchar, int minor);
+extern int lp_write(unsigned minor, char *buf, int count);
+
diff --git a/kernel/blk_drv/floppy.c b/kernel/blk_drv/floppy.c
index a97bff6..82c3583 100644
--- a/kernel/blk_drv/floppy.c
+++ b/kernel/blk_drv/floppy.c
@@ -484,6 +484,8 @@ static void floppy_on_interrupt(void)
/* We cannot do a floppy-select, as that might sleep. We just force it */
selected = 1;
if (current_drive != (current_DOR & 3)) {
+ seek = 1;
+ current_track = NO_TRACK;
current_DOR &= 0xFC;
current_DOR |= current_drive;
outb(current_DOR,FD_DOR);
diff --git a/kernel/blk_drv/hd.c b/kernel/blk_drv/hd.c
index 187a406..1ca50c9 100644
--- a/kernel/blk_drv/hd.c
+++ b/kernel/blk_drv/hd.c
@@ -329,7 +329,7 @@ static int drive_busy(void)
unsigned int i;
unsigned char c;
- for (i = 0; i < 50000; i++) {
+ for (i = 0; i < 500000 ; i++) {
c = inb_p(HD_STATUS);
c &= (BUSY_STAT | READY_STAT | SEEK_STAT);
if (c == (READY_STAT | SEEK_STAT))
diff --git a/kernel/chr_drv/Makefile b/kernel/chr_drv/Makefile
index dc5d532..0246fc7 100644
--- a/kernel/chr_drv/Makefile
+++ b/kernel/chr_drv/Makefile
@@ -26,7 +26,7 @@ CPP =cpp -nostdinc -I../../include
-c -o $*.o $<
OBJS = tty_io.o console.o keyboard.o serial.o rs_io.o \
- tty_ioctl.o pty.o
+ tty_ioctl.o pty.o lp.o
chr_drv.a: $(OBJS)
$(AR) rcs chr_drv.a $(OBJS)
@@ -53,9 +53,18 @@ console.s console.o : console.c ../../include/linux/sched.h \
../../include/signal.h ../../include/sys/param.h ../../include/sys/time.h \
../../include/time.h ../../include/sys/resource.h \
../../include/linux/timer.h ../../include/linux/tty.h \
- ../../include/termios.h ../../include/linux/config.h ../../include/asm/io.h \
- ../../include/asm/system.h ../../include/asm/segment.h \
- ../../include/string.h ../../include/errno.h
+ ../../include/termios.h ../../include/linux/config.h \
+ ../../include/linux/config_rel.h ../../include/linux/config_ver.h \
+ ../../include/asm/io.h ../../include/asm/system.h \
+ ../../include/asm/segment.h ../../include/string.h ../../include/errno.h
+lp.s lp.o : lp.c ../../include/linux/lp.h ../../include/errno.h \
+ ../../include/linux/kernel.h ../../include/linux/sched.h \
+ ../../include/linux/head.h ../../include/linux/fs.h \
+ ../../include/sys/types.h ../../include/sys/dirent.h ../../include/limits.h \
+ ../../include/linux/mm.h ../../include/signal.h ../../include/sys/param.h \
+ ../../include/sys/time.h ../../include/time.h ../../include/sys/resource.h \
+ ../../include/asm/io.h ../../include/asm/segment.h \
+ ../../include/checkpoint.h
pty.s pty.o : pty.c ../../include/linux/tty.h ../../include/termios.h \
../../include/sys/types.h ../../include/linux/sched.h \
../../include/linux/head.h ../../include/linux/fs.h \
diff --git a/kernel/chr_drv/console.c b/kernel/chr_drv/console.c
index 6c65e32..2d62be3 100644
--- a/kernel/chr_drv/console.c
+++ b/kernel/chr_drv/console.c
@@ -167,20 +167,35 @@ static void sysbeep(void);
#define RESPONSE "\033[?1;2c"
static char * translations[] = {
-/* normal 7-bit ascii */
+/* 8-bit Latin-1 mapped to the PC charater set: '\0' means non-printable */
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
" !\"#$%&'()*+,-./0123456789:;<=>?"
"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
- "`abcdefghijklmnopqrstuvwxyz{|}~ ",
+ "`abcdefghijklmnopqrstuvwxyz{|}~\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\040\255\233\234\376\235\174\025\376\376\246\256\252\055\376\376"
+ "\370\361\375\376\376\346\024\371\376\376\247\257\254\253\376\250"
+ "\376\376\376\376\216\217\222\200\376\220\376\376\376\376\376\376"
+ "\376\245\376\376\376\376\231\376\376\376\376\376\232\376\376\341"
+ "\205\240\203\376\204\206\221\207\212\202\210\211\215\241\214\213"
+ "\376\244\225\242\223\376\224\366\376\227\243\226\201\376\376\230",
/* vt100 graphics */
- " !\"#$%&'()*+,-./\333123456789:;<=>?"
- "@ABCDEFGH\017JKLMNOPQRSTUVWXYZ[\\]^ "
- /* ' a b c d e f g h i j k l m n o */
- "\004\261\007\007\007\007\370\361\040\007\331\277\332\300\305\007"
- /* p q r s t u v w x y z { | } ~ */
- "\007\304\007\007\303\264\301\302\263\007\007\007\007\007\234 "
-
- /*"\004\261\007\007\007\007\370\361\007\007\275\267\326\323\327\304"
- "\304\304\304\304\307\266\320\322\272\363\362\343\\007\234\007 " */
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ " !\"#$%&'()*+,-./0123456789:;<=>?"
+ "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^ "
+ "\004\261\007\007\007\007\370\361\007\007\275\267\326\323\327\304"
+ "\304\304\304\304\307\266\320\322\272\363\362\343\007\234\007\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+ "\040\255\233\234\376\235\174\025\376\376\246\256\252\055\376\376"
+ "\370\361\375\376\376\346\024\371\376\376\247\257\254\253\376\250"
+ "\376\376\376\376\216\217\222\200\376\220\376\376\376\376\376\376"
+ "\376\245\376\376\376\376\231\376\376\376\376\376\232\376\376\341"
+ "\205\240\203\376\204\206\221\207\212\202\210\211\215\241\214\213"
+ "\376\244\225\242\223\376\224\366\376\227\243\226\201\376\376\230"
};
#define NORM_TRANS (translations[0])
@@ -394,10 +409,10 @@ static void csi_m(int currcons )
else
{ /* check if forground == background */
if (vc_cons[currcons].vc_bold_attr != -1)
- attr = (vc_cons[currcons].vc_bold_attr&0x0f)|(0xf0&(attr));
+ attr = (vc_cons[currcons].vc_bold_attr&0x0f)|(0xf0&(attr));
else
{ short newattr = (attr&0xf0)|(0xf&(~attr));
- attr = ((newattr&0xf)==((attr>>4)&0xf)?
+ attr = ((newattr&0xf)==((attr>>4)&0xf)?
(attr&0xf0)|(((attr&0xf)+1)%0xf):
newattr);
}
@@ -571,13 +586,14 @@ void con_write(struct tty_struct * tty)
state = ESnormal;
switch(state) {
case ESnormal:
- if (c > 31 && c < 127) {
+ if (translate[c]) {
+ c = translate[c];
while (x >= video_num_columns) {
x -= video_num_columns;
pos -= video_size_row;
lf(currcons);
}
- *(char *) pos = translate[c-32];
+ *(char *) pos = c;
*(char *) (pos+1) = attr;
pos += 2;
x++;
diff --git a/kernel/chr_drv/lp.c b/kernel/chr_drv/lp.c
new file mode 100644
index 0000000..0f6e88f
--- /dev/null
+++ b/kernel/chr_drv/lp.c
@@ -0,0 +1,127 @@
+/*
+ $Header: /usr/src/linux/kernel/chr_drv/lp.c,v 1.9 1992/01/06 16:11:19
+ james_r_wiegand Exp james_r_wiegand $
+*/
+
+#define __LP_C__
+#include <linux/lp.h>
+
+#include <checkpoint.h>
+
+int lp_reset(int minor)
+{
+ int testvalue;
+
+ /* reset value */
+ outb(0, LP_B(minor)+2);
+ for (testvalue = 0 ; testvalue < LP_DELAY ; testvalue++)
+ ;
+ outb(LP_PSELECP | LP_PINITP, LP_B(minor)+2);
+ return LP_S(minor);
+}
+
+void lp_init(void)
+{
+ int offset = 0;
+ unsigned int testvalue = 0;
+ int count = 0;
+
+ /* take on all known port values */
+ for (offset = 0; offset < LP_NO; offset++) {
+ /* write to port & read back to check */
+ outb( LP_DUMMY, LP_B(offset));
+ for (testvalue = 0 ; testvalue < LP_DELAY ; testvalue++)
+ ;
+ testvalue = inb(LP_B(offset));
+ if (testvalue != 255) {
+ LP_F(offset) |= LP_EXIST;
+ lp_reset(offset);
+ printk("lp_init: lp%d exists (%d)\n", offset, testvalue);
+ count++;
+ }
+ }
+ if (count == 0)
+ printk("lp_init: no lp devices found\n");
+}
+
+int lp_char(char lpchar, int minor)
+{
+ int retval = 0;
+ unsigned long count = 0;
+
+ outb(lpchar, LP_B(minor));
+ do {
+ retval = LP_S(minor);
+ schedule();
+ count ++;
+ } while(!(retval & LP_PBUSY) && count < LP_TIMEOUT);
+ if (count == LP_TIMEOUT) {
+ printk("lp%d timeout\n\r", minor);
+ return 0;
+ }
+ /* control port pr_table[0]+2 take strobe high */
+ outb(( LP_PSELECP | LP_PINITP | LP_PSTROBE ), ( LP_B( minor ) + 2 ));
+ /* take strobe low */
+ outb(( LP_PSELECP | LP_PINITP ), ( LP_B( minor ) + 2 ));
+ /* get something meaningful for return value */
+ return LP_S(minor);
+}
+
+int lp_write(unsigned minor, char *buf, int count)
+{
+ int retval;
+ int loop;
+ int tcount;
+ char c, *temp = buf;
+
+ if (minor > LP_NO - 1)
+ return -ENODEV;
+ if ((LP_F(minor) & LP_EXIST) == 0)
+ return -ENODEV;
+
+/* if we aren't the "owner task", check if the old owner has died... */
+ if (LP_T(minor) != current->pid && (LP_F(minor) & LP_BUSY)) {
+ for(tcount = 0; tcount < NR_TASKS; tcount++) {
+ if (!task[tcount])
+ continue;
+ if (task[tcount]->state == TASK_ZOMBIE)
+ continue;
+ if (task[tcount]->pid == LP_T(minor)) {
+ tcount = -1;
+ break;
+ }
+ }
+ if (tcount == -1)
+ return -EBUSY;
+ }
+
+ LP_T(minor) = current->pid;
+ LP_F(minor) |= LP_BUSY;
+ LP_R(minor) = count;
+ temp = buf;
+
+ for (loop = 0 ; loop < count ; loop++, temp++) {
+ c = get_fs_byte(temp);
+ retval = lp_char(c, minor);
+ LP_R(minor)--;
+ if (retval & LP_POUTPA) {
+ LP_F(minor) |= LP_NOPA;
+ return loop?loop:-ENOSPC;
+ } else
+ LP_F(minor) &= ~LP_NOPA;
+
+ if (!(retval & LP_PSELECD)) {
+ LP_F(minor) &= ~LP_SELEC;
+ return loop?loop:-EFAULT;
+ } else
+ LP_F(minor) &= ~LP_SELEC;
+
+ /* not offline or out of paper. on fire? */
+ if (!(retval & LP_PERRORP)) {
+ LP_F(minor) |= LP_ERR;
+ return loop?loop:-EIO;
+ } else
+ LP_F(minor) &= ~LP_SELEC;
+ }
+ return count;
+}
diff --git a/kernel/chr_drv/tty_io.c b/kernel/chr_drv/tty_io.c
index 95d7933..511860a 100644
--- a/kernel/chr_drv/tty_io.c
+++ b/kernel/chr_drv/tty_io.c
@@ -26,6 +26,8 @@
int kill_pg(int pgrp, int sig, int priv);
int is_orphaned_pgrp(int pgrp);
+
+extern void lp_init(void);
#define _L_FLAG(tty,f) ((tty)->termios.c_lflag & f)
#define _I_FLAG(tty,f) ((tty)->termios.c_iflag & f)
@@ -46,6 +48,7 @@ int is_orphaned_pgrp(int pgrp);
#define I_CRNL(tty) _I_FLAG((tty),ICRNL)
#define I_NOCR(tty) _I_FLAG((tty),IGNCR)
#define I_IXON(tty) _I_FLAG((tty),IXON)
+#define I_STRP(tty) _I_FLAG((tty),ISTRIP)
#define O_POST(tty) _O_FLAG((tty),OPOST)
#define O_NLCR(tty) _O_FLAG((tty),ONLCR)
@@ -139,6 +142,8 @@ void copy_to_cooked(struct tty_struct * tty)
break;
}
GETCH(tty->read_q,c);
+ if (I_STRP(tty))
+ c &= 0x7f;
if (c==13) {
if (I_CRNL(tty))
c=10;
@@ -153,8 +158,8 @@ void copy_to_cooked(struct tty_struct * tty)
(c==KILL_CHAR(tty))) {
/* deal with killing the input line */
while(!(EMPTY(tty->secondary) ||
- (c=LAST(tty->secondary))==10 ||
- ((EOF_CHAR(tty) != _POSIX_VDISABLE) &&
+ (c=LAST(tty->secondary))==10 ||
+ ((EOF_CHAR(tty) != _POSIX_VDISABLE) &&
(c==EOF_CHAR(tty))))) {
if (L_ECHO(tty)) {
if (c<32)
@@ -215,7 +220,7 @@ void copy_to_cooked(struct tty_struct * tty)
}
}
if (c==10 || (EOF_CHAR(tty) != _POSIX_VDISABLE &&
- c==EOF_CHAR(tty)))
+ c==EOF_CHAR(tty)))
tty->secondary->data++;
if ((L_ECHO(tty) || L_ECHONL(tty)) && (c==10)) {
PUTCH(10,tty->write_q);
@@ -502,4 +507,5 @@ void tty_init(void)
rs_init();
printk("%d virtual consoles\n\r",NR_CONSOLES);
printk("%d pty's\n\r",NR_PTYS);
+ lp_init();
}
diff --git a/kernel/exit.c b/kernel/exit.c
index f3fa393..50f6146 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -63,8 +63,8 @@ void release(struct task_struct * p)
return;
}
for (i=1 ; i<NR_TASKS ; i++)
- if (task[i]==p) {
- task[i]=NULL;
+ if (task[i] == p) {
+ task[i] = NULL;
/* Update links */
if (p->p_osptr)
p->p_osptr->p_ysptr = p->p_ysptr;
@@ -72,8 +72,7 @@ void release(struct task_struct * p)
p->p_ysptr->p_osptr = p->p_osptr;
else
p->p_pptr->p_cptr = p->p_osptr;
- free_page((long)p);
- schedule();
+ free_page((long) p);
return;
}
panic("trying to release non-existent task");
@@ -320,38 +319,28 @@ volatile void do_exit(long code)
* as a result of our exiting, and if they have any stopped
* jons, send them a SIGUP and then a SIGCONT. (POSIX 3.2.2.2)
*/
- if (p = current->p_cptr) {
- while (1) {
- p->flags &= ~PF_PTRACED;
- p->p_pptr = task[1];
- if (p->state == TASK_ZOMBIE)
- task[1]->signal |= (1<<(SIGCHLD-1));
- /*
- * process group orphan check
- * Case ii: Our child is in a different pgrp
- * than we are, and it was the only connection
- * outside, so the child pgrp is now orphaned.
- */
- if ((p->pgrp != current->pgrp) &&
- (p->session == current->session) &&
- is_orphaned_pgrp(p->pgrp) &&
- has_stopped_jobs(p->pgrp)) {
- kill_pg(p->pgrp,SIGHUP,1);
- kill_pg(p->pgrp,SIGCONT,1);
- }
- if (p->p_osptr) {
- p = p->p_osptr;
- continue;
- }
- /*
- * This is it; link everything into init's children
- * and leave
- */
- p->p_osptr = task[1]->p_cptr;
- task[1]->p_cptr->p_ysptr = p;
- task[1]->p_cptr = current->p_cptr;
- current->p_cptr = 0;
- break;
+ while (p = current->p_cptr) {
+ current->p_cptr = p->p_osptr;
+ p->p_ysptr = NULL;
+ p->flags &= ~PF_PTRACED;
+ p->p_pptr = task[1];
+ p->p_osptr = task[1]->p_cptr;
+ task[1]->p_cptr->p_ysptr = p;
+ task[1]->p_cptr = p;
+ if (p->state == TASK_ZOMBIE)
+ task[1]->signal |= (1<<(SIGCHLD-1));
+ /*
+ * process group orphan check
+ * Case ii: Our child is in a different pgrp
+ * than we are, and it was the only connection
+ * outside, so the child pgrp is now orphaned.
+ */
+ if ((p->pgrp != current->pgrp) &&
+ (p->session == current->session) &&
+ is_orphaned_pgrp(p->pgrp) &&
+ has_stopped_jobs(p->pgrp)) {
+ kill_pg(p->pgrp,SIGHUP,1);
+ kill_pg(p->pgrp,SIGCONT,1);
}
}
if (current->leader) {
diff --git a/kernel/math/Makefile b/kernel/math/Makefile
index 8406a2a..3c06183 100644
--- a/kernel/math/Makefile
+++ b/kernel/math/Makefile
@@ -22,7 +22,7 @@ CPP =cpp -nostdinc -I../../include
$(CC) $(CFLAGS) $(MATH_EMULATION) \
-c -o $*.o $<
-OBJS = math_emulate.o error.o convert.o ea.o get_put.o \
+OBJS = emulate.o error.o convert.o ea.o get_put.o \
add.o mul.o div.o compare.o
math.a: $(OBJS)
@@ -81,7 +81,7 @@ get_put.s get_put.o : get_put.c ../../include/signal.h ../../include/sys/types.h
../../include/linux/mm.h ../../include/linux/kernel.h \
../../include/sys/param.h ../../include/sys/time.h ../../include/time.h \
../../include/sys/resource.h ../../include/asm/segment.h
-math_emulate.s math_emulate.o : math_emulate.c ../../include/linux/config.h
+emulate.s emulate.o : emulate.c ../../include/linux/config.h
mul.s mul.o : mul.c ../../include/linux/math_emu.h ../../include/linux/sched.h \
../../include/linux/head.h ../../include/linux/fs.h \
../../include/sys/types.h ../../include/linux/mm.h \
diff --git a/kernel/math/math_emulate.c b/kernel/math/emulate.c
index b57d65b..b8e3ac2 100644
--- a/kernel/math/math_emulate.c
+++ b/kernel/math/emulate.c
@@ -1,5 +1,5 @@
/*
- * linux/kernel/math/math_emulate.c
+ * linux/kernel/math/emulate.c
*
* (C) 1991 Linus Torvalds
*/
diff --git a/kernel/sched.c b/kernel/sched.c
index 989fad9..3c274e6 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -305,7 +305,9 @@ static struct timer_list {
long jiffies;
void (*fn)();
struct timer_list * next;
-} timer_list[TIME_REQUESTS], * next_timer = NULL;
+} timer_list[TIME_REQUESTS] = { { 0, NULL, NULL }, };
+
+static struct timer_list * next_timer = NULL;
void add_timer(long jiffies, void (*fn)(void))
{
diff --git a/makever.sh b/makever.sh
new file mode 100755
index 0000000..1b230e2
--- /dev/null
+++ b/makever.sh
@@ -0,0 +1,13 @@
+#! /bin/sh
+
+if [ ! -f .version ]
+then
+ echo 0 > .version
+fi
+cycle=`cat .version`
+cycle=`expr $cycle + 1`
+if [ $cycle -gt 99 ]
+then
+ cycle=0
+fi
+echo $cycle > .version
diff --git a/mm/swap.c b/mm/swap.c
index 5c7e883..819bbe3 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -183,8 +183,13 @@ check_table:
dir_entry++;
goto check_dir;
}
- if (try_to_swap_out(page_entry + (unsigned long *) pg_table))
+ if (try_to_swap_out(page_entry + (unsigned long *) pg_table)) {
+ if (! task[dir_entry >> 4])
+ printk("swapping out page from non-existent task\n\r");
+ else
+ task[dir_entry >> 4]->rss--;
return 1;
+ }
goto check_table;
no_swap:
printk("Out of swap-memory\n\r");