Commit 0b098c16 authored by Linus Torvalds's avatar Linus Torvalds

[PATCH] Linux-0.96b (June 21, 1992)

First cut at core-dumping.  Also, do more dynamic boottime memory
allocation, rather than allocating data structures statically.

Allocate task structures at run-time rather than having a big array of
them.

First "obsolete" system call.  The old "stat()" system call was too
limited, due to "struct stat" having various 16-bit fields etc (notably
inode numbers).  We make a new stat() function, and keep the old one
around as "old_stat()" for binary compatibility.

We also need a bigger "utsname" to hold real node names.

Whoo! NR_OPEN is now 32 rather than 20.

itimer() support driven by X11 adoption (Darren Senn).

gcc starts using fsqrt, so that gets added to the FP emulation.  We're
still basing that on my trivial code.

[Original changelog below]

0.96b is not a new major release: it's pretty close to 0.96a with all my
patches (1-4).  However, as there has been 4 patches already, I decided
it would be time for a full kernel release along with a bootimage, so
that people who don't feel confident with patching can use the new
features.

If you already have 0.96a patchlevel 4, 0.96b will offer you these new
features:

 - the math-emulation now handles fsqrt, as gcc-2.2.2 generates that
   inline.  I haven't tested the kernel code at all: I tested the
   algorithm in user space, but I'm lazy, so I never turned off my 387
   to do real testing.  I hope it works.
 - better vt100 terminal emulation thanks to Mika Liljeberg.
 - I removed a possible race-condition in the buffer-cache code.
 - minor fixes

The vt100 emulation should now be complete enough for almost everything
(including vt100 test suites): as a result the setterm utility had to be
changed (as the old setterm codes aren't compatible with the full vt100
codes).  setterm-0.96b.tar.Z contains the new setterm.

The soon-to-be-released gcc-2.2.2 will need the 0.96b kernel: (a) due to
the fsqrt emulation and (b) it uses the new stat() system call.  So
upgrading is a good idea.  (If you have a co-processor, (a) isn't used,
but (b) still stands)

If you have an unpatched 0.96a, the differences to 0.96b are roughly
(not counting the above-mentioned new things):

 - corrected the disk-buffer-list bug with read/write-errors
 - fixed read-ahead warning messages at end of disk
 - better support for text-mode restoration after running MGR and X
 - full core-dumping, attach/detach etc debugging features
 - 16550A support
 - less low 1MB memory used for kernel structures
 - various minor fixes

Note that the fact that new versions (pl4 and above) use more memory in
the 1M+ area means that linux will report less free memory (it's used
for buffer-cache instead).  This could concievably be a problem on 2MB
machines.  The standard kernel comes with only 4 pty's though, and if
you use the standard 80x25 text modes instead of svga modes, the VC
buffers will be smaller.  Please contact me if there are problems even
with this minimal setup.

0.96b does /not/ contain: the new scsi drivers, new filesystems or some
other patches I have gotten (ibm character set mode, loop-devices etc).
If you have sent me any other patch, you might want to remind me about
it.

                Linus
parent a5dcf393
......@@ -195,6 +195,6 @@ init/main.o : init/main.c include/stddef.h include/stdarg.h include/fcntl.h incl
include/time.h include/asm/system.h include/asm/io.h include/linux/config.h \
include/linux/config_rel.h include/linux/config_ver.h include/linux/config.dist.h \
include/linux/sched.h include/linux/head.h include/linux/fs.h include/sys/dirent.h \
include/limits.h include/linux/mm.h include/linux/kernel.h include/signal.h \
include/sys/param.h include/sys/time.h include/sys/resource.h include/linux/tty.h \
include/termios.h include/linux/unistd.h
include/limits.h include/sys/vfs.h include/linux/mm.h include/linux/kernel.h \
include/signal.h include/sys/param.h include/sys/time.h include/sys/resource.h \
include/linux/tty.h include/termios.h include/linux/unistd.h
......@@ -43,44 +43,46 @@ dep:
### Dependencies:
block_dev.o : block_dev.c ../include/errno.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/linux/kernel.h ../include/signal.h ../include/sys/param.h \
../include/sys/time.h ../include/time.h ../include/sys/resource.h ../include/asm/segment.h \
../include/asm/system.h
../include/sys/vfs.h ../include/linux/mm.h ../include/linux/kernel.h ../include/signal.h \
../include/sys/param.h ../include/sys/time.h ../include/time.h ../include/sys/resource.h \
../include/asm/segment.h ../include/asm/system.h
buffer.o : buffer.c ../include/stdarg.h ../include/linux/config.h ../include/linux/config_rel.h \
../include/linux/config_ver.h ../include/linux/config.dist.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/linux/kernel.h ../include/signal.h \
../include/sys/param.h ../include/sys/time.h ../include/time.h ../include/sys/resource.h \
../include/asm/system.h ../include/asm/io.h
../include/limits.h ../include/sys/vfs.h ../include/linux/mm.h ../include/linux/kernel.h \
../include/signal.h ../include/sys/param.h ../include/sys/time.h ../include/time.h \
../include/sys/resource.h ../include/asm/system.h ../include/asm/io.h
exec.o : exec.c ../include/signal.h ../include/sys/types.h ../include/errno.h \
../include/linux/string.h ../include/sys/stat.h ../include/a.out.h ../include/linux/fs.h \
../include/sys/dirent.h ../include/limits.h ../include/linux/sched.h ../include/linux/head.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
../include/linux/string.h ../include/linux/stat.h ../include/sys/ptrace.h ../include/a.out.h \
../include/fcntl.h ../include/linux/fs.h ../include/sys/dirent.h ../include/limits.h \
../include/sys/vfs.h ../include/linux/sched.h ../include/linux/head.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 ../include/sys/user.h
fcntl.o : fcntl.c ../include/errno.h ../include/fcntl.h ../include/sys/types.h \
../include/sys/stat.h ../include/asm/segment.h ../include/linux/string.h ../include/linux/sched.h \
../include/linux/stat.h ../include/asm/segment.h ../include/linux/string.h ../include/linux/sched.h \
../include/linux/head.h ../include/linux/fs.h ../include/sys/dirent.h ../include/limits.h \
../include/linux/mm.h ../include/linux/kernel.h ../include/signal.h ../include/sys/param.h \
../include/sys/time.h ../include/time.h ../include/sys/resource.h
../include/sys/vfs.h ../include/linux/mm.h ../include/linux/kernel.h ../include/signal.h \
../include/sys/param.h ../include/sys/time.h ../include/time.h ../include/sys/resource.h
file_table.o : file_table.c ../include/linux/fs.h ../include/sys/types.h ../include/sys/dirent.h \
../include/limits.h
inode.o : inode.c ../include/linux/string.h ../include/sys/stat.h ../include/sys/types.h \
../include/linux/sched.h ../include/linux/head.h ../include/linux/fs.h ../include/sys/dirent.h \
../include/limits.h ../include/linux/mm.h ../include/linux/kernel.h ../include/signal.h \
../include/sys/param.h ../include/sys/time.h ../include/time.h ../include/sys/resource.h \
../include/asm/system.h
ioctl.o : ioctl.c ../include/linux/string.h ../include/errno.h ../include/sys/stat.h \
../include/sys/types.h ../include/linux/sched.h ../include/linux/head.h ../include/linux/fs.h \
../include/sys/dirent.h ../include/limits.h ../include/linux/mm.h ../include/linux/kernel.h \
../include/limits.h ../include/sys/vfs.h
inode.o : inode.c ../include/linux/string.h ../include/linux/stat.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/sys/vfs.h ../include/linux/mm.h ../include/linux/kernel.h \
../include/signal.h ../include/sys/param.h ../include/sys/time.h ../include/time.h \
../include/sys/resource.h
namei.o : namei.c ../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/sys/resource.h ../include/asm/system.h
ioctl.o : ioctl.c ../include/linux/string.h ../include/errno.h ../include/linux/stat.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/sys/vfs.h ../include/linux/mm.h \
../include/linux/kernel.h ../include/signal.h ../include/sys/param.h ../include/sys/time.h \
../include/time.h ../include/sys/resource.h ../include/asm/segment.h ../include/linux/string.h \
../include/fcntl.h ../include/errno.h ../include/const.h ../include/sys/stat.h
../include/time.h ../include/sys/resource.h
namei.o : namei.c ../include/linux/sched.h ../include/linux/head.h ../include/linux/fs.h \
../include/sys/types.h ../include/sys/dirent.h ../include/limits.h ../include/sys/vfs.h \
../include/linux/mm.h ../include/linux/kernel.h ../include/signal.h ../include/sys/param.h \
../include/sys/time.h ../include/time.h ../include/sys/resource.h ../include/asm/segment.h \
../include/linux/string.h ../include/fcntl.h ../include/errno.h ../include/const.h \
../include/linux/stat.h
open.o : open.c ../include/errno.h ../include/fcntl.h ../include/sys/types.h \
../include/utime.h ../include/sys/stat.h ../include/sys/vfs.h ../include/linux/string.h \
../include/utime.h ../include/sys/vfs.h ../include/linux/stat.h ../include/linux/string.h \
../include/linux/sched.h ../include/linux/head.h ../include/linux/fs.h ../include/sys/dirent.h \
../include/limits.h ../include/linux/mm.h ../include/linux/kernel.h ../include/signal.h \
../include/sys/param.h ../include/sys/time.h ../include/time.h ../include/sys/resource.h \
......@@ -88,27 +90,28 @@ open.o : open.c ../include/errno.h ../include/fcntl.h ../include/sys/types.h \
pipe.o : pipe.c ../include/signal.h ../include/sys/types.h ../include/errno.h \
../include/termios.h ../include/fcntl.h ../include/asm/segment.h ../include/linux/sched.h \
../include/linux/head.h ../include/linux/fs.h ../include/sys/dirent.h ../include/limits.h \
../include/linux/mm.h ../include/linux/kernel.h ../include/sys/param.h ../include/sys/time.h \
../include/time.h ../include/sys/resource.h
read_write.o : read_write.c ../include/errno.h ../include/sys/types.h ../include/sys/stat.h \
../include/sys/dirent.h ../include/limits.h ../include/linux/kernel.h ../include/linux/sched.h \
../include/linux/head.h ../include/linux/fs.h ../include/linux/mm.h ../include/signal.h \
../include/sys/param.h ../include/sys/time.h ../include/time.h ../include/sys/resource.h \
../include/linux/minix_fs.h ../include/asm/segment.h
../include/sys/vfs.h ../include/linux/mm.h ../include/linux/kernel.h ../include/sys/param.h \
../include/sys/time.h ../include/time.h ../include/sys/resource.h
read_write.o : read_write.c ../include/errno.h ../include/sys/types.h ../include/sys/dirent.h \
../include/limits.h ../include/linux/stat.h ../include/linux/kernel.h ../include/linux/sched.h \
../include/linux/head.h ../include/linux/fs.h ../include/sys/vfs.h ../include/linux/mm.h \
../include/signal.h ../include/sys/param.h ../include/sys/time.h ../include/time.h \
../include/sys/resource.h ../include/linux/minix_fs.h ../include/asm/segment.h
select.o : select.c ../include/linux/fs.h ../include/sys/types.h ../include/sys/dirent.h \
../include/limits.h ../include/linux/kernel.h ../include/linux/tty.h ../include/asm/system.h \
../include/termios.h ../include/linux/sched.h ../include/linux/head.h ../include/linux/mm.h \
../include/limits.h ../include/sys/vfs.h ../include/linux/kernel.h ../include/linux/tty.h \
../include/asm/system.h ../include/termios.h ../include/linux/sched.h ../include/linux/head.h \
../include/linux/mm.h ../include/signal.h ../include/sys/param.h ../include/sys/time.h \
../include/time.h ../include/sys/resource.h ../include/linux/string.h ../include/linux/stat.h \
../include/asm/segment.h ../include/const.h ../include/errno.h
stat.o : stat.c ../include/errno.h ../include/linux/stat.h ../include/linux/fs.h \
../include/sys/types.h ../include/sys/dirent.h ../include/limits.h ../include/sys/vfs.h \
../include/linux/sched.h ../include/linux/head.h ../include/linux/mm.h ../include/linux/kernel.h \
../include/signal.h ../include/sys/param.h ../include/sys/time.h ../include/time.h \
../include/sys/resource.h ../include/linux/string.h ../include/asm/segment.h \
../include/sys/stat.h ../include/const.h ../include/errno.h
stat.o : stat.c ../include/errno.h ../include/sys/stat.h ../include/sys/types.h \
../include/linux/fs.h ../include/sys/dirent.h ../include/limits.h ../include/linux/sched.h \
../include/linux/head.h ../include/linux/mm.h ../include/linux/kernel.h ../include/signal.h \
../include/sys/param.h ../include/sys/time.h ../include/time.h ../include/sys/resource.h \
../include/asm/segment.h
../include/sys/resource.h ../include/asm/segment.h
super.o : super.c ../include/linux/config.h ../include/linux/config_rel.h ../include/linux/config_ver.h \
../include/linux/config.dist.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/linux/kernel.h ../include/signal.h ../include/sys/param.h \
../include/sys/time.h ../include/time.h ../include/sys/resource.h ../include/linux/minix_fs.h \
../include/asm/system.h ../include/asm/segment.h ../include/errno.h ../include/sys/stat.h
../include/sys/vfs.h ../include/linux/mm.h ../include/linux/kernel.h ../include/signal.h \
../include/sys/param.h ../include/sys/time.h ../include/time.h ../include/sys/resource.h \
../include/linux/minix_fs.h ../include/linux/stat.h ../include/asm/system.h \
../include/asm/segment.h ../include/errno.h
......@@ -273,10 +273,8 @@ struct buffer_head * getblk(int dev,int block)
wait_on_buffer(bh);
if (bh->b_count)
goto repeat;
while (bh->b_dirt) {
if (bh->b_dirt) {
sync_buffers(bh->b_dev);
wait_on_buffer(bh);
if (bh->b_count)
goto repeat;
}
/* NOTE!! While we slept waiting for this block, somebody else might */
......
......@@ -40,50 +40,55 @@ dep:
### Dependencies:
bitmap.o : bitmap.c ../../include/linux/string.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/linux/kernel.h \
../../include/signal.h ../../include/sys/param.h ../../include/sys/time.h ../../include/time.h \
../../include/sys/resource.h ../../include/linux/minix_fs.h
../../include/sys/dirent.h ../../include/limits.h ../../include/sys/vfs.h ../../include/linux/mm.h \
../../include/linux/kernel.h ../../include/signal.h ../../include/sys/param.h \
../../include/sys/time.h ../../include/time.h ../../include/sys/resource.h ../../include/linux/minix_fs.h
blkdev.o : blkdev.c ../../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/linux/kernel.h ../../include/signal.h \
../../include/sys/param.h ../../include/sys/time.h ../../include/time.h ../../include/sys/resource.h \
../../include/linux/minix_fs.h ../../include/linux/tty.h ../../include/asm/system.h \
../../include/termios.h ../../include/errno.h ../../include/fcntl.h ../../include/sys/stat.h
../../include/sys/vfs.h ../../include/linux/mm.h ../../include/linux/kernel.h \
../../include/signal.h ../../include/sys/param.h ../../include/sys/time.h ../../include/time.h \
../../include/sys/resource.h ../../include/linux/minix_fs.h ../../include/linux/tty.h \
../../include/asm/system.h ../../include/termios.h ../../include/linux/stat.h \
../../include/errno.h ../../include/fcntl.h
chrdev.o : chrdev.c ../../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/linux/kernel.h ../../include/signal.h \
../../include/sys/param.h ../../include/sys/time.h ../../include/time.h ../../include/sys/resource.h \
../../include/linux/minix_fs.h ../../include/linux/tty.h ../../include/asm/system.h \
../../include/termios.h ../../include/errno.h ../../include/fcntl.h ../../include/sys/stat.h
dir.o : dir.c ../../include/errno.h ../../include/sys/stat.h ../../include/sys/types.h \
../../include/asm/segment.h ../../include/linux/fs.h ../../include/sys/dirent.h \
../../include/limits.h ../../include/linux/minix_fs.h
../../include/sys/vfs.h ../../include/linux/mm.h ../../include/linux/kernel.h \
../../include/signal.h ../../include/sys/param.h ../../include/sys/time.h ../../include/time.h \
../../include/sys/resource.h ../../include/linux/minix_fs.h ../../include/linux/tty.h \
../../include/asm/system.h ../../include/termios.h ../../include/linux/stat.h \
../../include/errno.h ../../include/fcntl.h
dir.o : dir.c ../../include/errno.h ../../include/asm/segment.h ../../include/linux/fs.h \
../../include/sys/types.h ../../include/sys/dirent.h ../../include/limits.h \
../../include/sys/vfs.h ../../include/linux/minix_fs.h ../../include/linux/stat.h
file.o : file.c ../../include/errno.h ../../include/fcntl.h ../../include/sys/types.h \
../../include/sys/dirent.h ../../include/limits.h ../../include/sys/stat.h ../../include/asm/segment.h \
../../include/sys/dirent.h ../../include/limits.h ../../include/asm/segment.h \
../../include/asm/system.h ../../include/linux/sched.h ../../include/linux/head.h \
../../include/linux/fs.h ../../include/linux/mm.h ../../include/linux/kernel.h \
../../include/signal.h ../../include/sys/param.h ../../include/sys/time.h ../../include/time.h \
../../include/sys/resource.h ../../include/linux/minix_fs.h
inode.o : inode.c ../../include/linux/string.h ../../include/sys/stat.h ../../include/sys/types.h \
../../include/linux/sched.h ../../include/linux/head.h ../../include/linux/fs.h \
../../include/sys/dirent.h ../../include/limits.h ../../include/linux/mm.h ../../include/linux/kernel.h \
../../include/linux/fs.h ../../include/sys/vfs.h ../../include/linux/mm.h ../../include/linux/kernel.h \
../../include/signal.h ../../include/sys/param.h ../../include/sys/time.h ../../include/time.h \
../../include/sys/resource.h ../../include/linux/minix_fs.h ../../include/asm/system.h
../../include/sys/resource.h ../../include/linux/minix_fs.h ../../include/linux/stat.h
inode.o : inode.c ../../include/linux/string.h ../../include/linux/stat.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/sys/vfs.h ../../include/linux/mm.h \
../../include/linux/kernel.h ../../include/signal.h ../../include/sys/param.h \
../../include/sys/time.h ../../include/time.h ../../include/sys/resource.h ../../include/linux/minix_fs.h \
../../include/asm/system.h ../../include/asm/segment.h
namei.o : namei.c ../../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/linux/kernel.h ../../include/signal.h \
../../include/sys/param.h ../../include/sys/time.h ../../include/time.h ../../include/sys/resource.h \
../../include/linux/minix_fs.h ../../include/asm/segment.h ../../include/linux/string.h \
../../include/fcntl.h ../../include/errno.h ../../include/const.h ../../include/sys/stat.h
symlink.o : symlink.c ../../include/errno.h ../../include/sys/stat.h ../../include/sys/types.h \
../../include/asm/segment.h ../../include/linux/sched.h ../../include/linux/head.h \
../../include/linux/fs.h ../../include/sys/dirent.h ../../include/limits.h ../../include/linux/mm.h \
../../include/sys/vfs.h ../../include/linux/mm.h ../../include/linux/kernel.h \
../../include/signal.h ../../include/sys/param.h ../../include/sys/time.h ../../include/time.h \
../../include/sys/resource.h ../../include/linux/minix_fs.h ../../include/linux/string.h \
../../include/linux/stat.h ../../include/asm/segment.h ../../include/fcntl.h \
../../include/errno.h ../../include/const.h
symlink.o : symlink.c ../../include/errno.h ../../include/asm/segment.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/sys/vfs.h ../../include/linux/mm.h \
../../include/linux/kernel.h ../../include/signal.h ../../include/sys/param.h \
../../include/sys/time.h ../../include/time.h ../../include/sys/resource.h ../../include/linux/minix_fs.h
../../include/sys/time.h ../../include/time.h ../../include/sys/resource.h ../../include/linux/minix_fs.h \
../../include/linux/stat.h
truncate.o : truncate.c ../../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/linux/kernel.h \
../../include/limits.h ../../include/sys/vfs.h ../../include/linux/mm.h ../../include/linux/kernel.h \
../../include/signal.h ../../include/sys/param.h ../../include/sys/time.h ../../include/time.h \
../../include/sys/resource.h ../../include/linux/minix_fs.h ../../include/linux/tty.h \
../../include/asm/system.h ../../include/termios.h ../../include/errno.h ../../include/fcntl.h \
../../include/sys/stat.h
../../include/asm/system.h ../../include/termios.h ../../include/linux/stat.h \
../../include/errno.h ../../include/fcntl.h
#define UTS_RELEASE "0.96a-35"
#define UTS_RELEASE "0.96a-37"
#define UTS_VERSION "06/17/92"
#define UTS_VERSION "06/20/92"
......@@ -177,6 +177,10 @@ void fmul(const temp_real *, const temp_real *, temp_real *);
void fdiv(const temp_real *, const temp_real *, temp_real *);
/* sqrt.c */
void fsqrt(const temp_real *, temp_real *);
/* compare.c */
void fcom(const temp_real *, const temp_real *);
......
......@@ -183,7 +183,7 @@ extern long lp_init(long);
extern long con_init(long);
extern long tty_init(long);
extern void flush(struct tty_queue * queue);
extern void flush_input(struct tty_struct * tty);
extern int tty_ioctl(struct inode *, struct file *, unsigned int, unsigned int);
extern int is_orphaned_pgrp(int pgrp);
......
#ifndef _SYS_STAT_H
#define _SYS_STAT_H
#include <sys/types.h>
struct stat {
dev_t st_dev;
ino_t st_ino;
umode_t st_mode;
nlink_t st_nlink;
uid_t st_uid;
gid_t st_gid;
dev_t st_rdev;
off_t st_size;
time_t st_atime;
time_t st_mtime;
time_t st_ctime;
};
#define S_IFMT 00170000
#define S_IFSOCK 0140000
#define S_IFLNK 0120000
#define S_IFREG 0100000
#define S_IFBLK 0060000
#define S_IFDIR 0040000
#define S_IFCHR 0020000
#define S_IFIFO 0010000
#define S_ISUID 0004000
#define S_ISGID 0002000
#define S_ISVTX 0001000
#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
#define S_IRWXU 00700
#define S_IRUSR 00400
#define S_IWUSR 00200
#define S_IXUSR 00100
#define S_IRWXG 00070
#define S_IRGRP 00040
#define S_IWGRP 00020
#define S_IXGRP 00010
#define S_IRWXO 00007
#define S_IROTH 00004
#define S_IWOTH 00002
#define S_IXOTH 00001
extern int chmod(const char *_path, mode_t mode);
extern int fstat(int fildes, struct stat *stat_buf);
extern int mkdir(const char *_path, mode_t mode);
extern int mkfifo(const char *_path, mode_t mode);
extern int stat(const char *filename, struct stat *stat_buf);
extern mode_t umask(mode_t mask);
#endif
#ifndef _SYS_UTSNAME_H
#define _SYS_UTSNAME_H
#include <sys/types.h>
#include <sys/param.h>
struct utsname {
char sysname[9];
char nodename[MAXHOSTNAMELEN+1];
char release[9];
char version[9];
char machine[9];
};
extern int uname(struct utsname * utsbuf);
#endif
......@@ -60,54 +60,60 @@ dep:
### Dependencies:
exit.s exit.o : exit.c ../include/errno.h ../include/signal.h ../include/sys/types.h \
../include/sys/wait.h ../include/linux/sched.h ../include/linux/head.h ../include/linux/fs.h \
../include/sys/dirent.h ../include/limits.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/linux/tty.h ../include/asm/system.h ../include/termios.h ../include/asm/segment.h
../include/sys/dirent.h ../include/limits.h ../include/sys/vfs.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/linux/tty.h ../include/asm/system.h ../include/termios.h \
../include/asm/segment.h
fork.s fork.o : fork.c ../include/errno.h ../include/stddef.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/linux/kernel.h ../include/signal.h \
../include/sys/param.h ../include/sys/time.h ../include/time.h ../include/sys/resource.h \
../include/asm/segment.h ../include/asm/system.h
../include/limits.h ../include/sys/vfs.h ../include/linux/mm.h ../include/linux/kernel.h \
../include/signal.h ../include/sys/param.h ../include/sys/time.h ../include/time.h \
../include/sys/resource.h ../include/asm/segment.h ../include/asm/system.h
ioport.s ioport.o : ioport.c ../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/linux/kernel.h ../include/signal.h ../include/sys/param.h ../include/sys/time.h \
../include/time.h ../include/sys/resource.h ../include/errno.h
../include/sys/types.h ../include/sys/dirent.h ../include/limits.h ../include/sys/vfs.h \
../include/linux/mm.h ../include/linux/kernel.h ../include/signal.h ../include/sys/param.h \
../include/sys/time.h ../include/time.h ../include/sys/resource.h ../include/errno.h
itimer.s itimer.o : itimer.c ../include/linux/sched.h ../include/linux/head.h ../include/linux/fs.h \
../include/sys/types.h ../include/sys/dirent.h ../include/limits.h ../include/sys/vfs.h \
../include/linux/mm.h ../include/linux/kernel.h ../include/signal.h ../include/sys/param.h \
../include/sys/time.h ../include/time.h ../include/sys/resource.h ../include/asm/segment.h \
../include/errno.h
mktime.s mktime.o : mktime.c ../include/time.h
panic.s panic.o : panic.c ../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/sys/vfs.h ../include/linux/mm.h ../include/signal.h ../include/sys/param.h \
../include/sys/time.h ../include/time.h ../include/sys/resource.h
printk.s printk.o : printk.c ../include/stdarg.h ../include/stddef.h ../include/errno.h \
../include/asm/segment.h ../include/asm/system.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/linux/kernel.h ../include/signal.h ../include/sys/param.h \
../include/sys/time.h ../include/time.h ../include/sys/resource.h
../include/sys/vfs.h ../include/linux/mm.h ../include/linux/kernel.h ../include/signal.h \
../include/sys/param.h ../include/sys/time.h ../include/time.h ../include/sys/resource.h
ptrace.s ptrace.o : ptrace.c ../include/linux/head.h ../include/linux/kernel.h ../include/linux/sched.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/errno.h ../include/asm/segment.h \
../include/asm/system.h ../include/sys/ptrace.h
../include/sys/vfs.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/segment.h \
../include/asm/system.h ../include/errno.h ../include/sys/ptrace.h
sched.s sched.o : sched.c ../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/linux/kernel.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/sys.h \
../include/linux/fdreg.h ../include/asm/system.h ../include/asm/io.h ../include/asm/segment.h \
../include/errno.h
../include/sys/types.h ../include/sys/dirent.h ../include/limits.h ../include/sys/vfs.h \
../include/linux/mm.h ../include/linux/kernel.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/sys.h ../include/linux/fdreg.h ../include/asm/system.h ../include/asm/io.h \
../include/asm/segment.h ../include/errno.h
signal.s signal.o : signal.c ../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/linux/kernel.h ../include/signal.h ../include/sys/param.h ../include/sys/time.h \
../include/time.h ../include/sys/resource.h ../include/asm/segment.h ../include/sys/wait.h \
../include/errno.h
../include/sys/types.h ../include/sys/dirent.h ../include/limits.h ../include/sys/vfs.h \
../include/linux/mm.h ../include/linux/kernel.h ../include/signal.h ../include/sys/param.h \
../include/sys/time.h ../include/time.h ../include/sys/resource.h ../include/asm/segment.h \
../include/sys/wait.h ../include/sys/ptrace.h ../include/errno.h
sys.s sys.o : sys.c ../include/errno.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/linux/kernel.h ../include/signal.h ../include/sys/param.h \
../include/sys/time.h ../include/time.h ../include/sys/resource.h ../include/linux/tty.h \
../include/asm/system.h ../include/termios.h ../include/linux/config.h ../include/linux/config_rel.h \
../include/linux/config_ver.h ../include/linux/config.dist.h ../include/asm/segment.h \
../include/sys/times.h ../include/sys/utsname.h ../include/linux/string.h
../include/sys/vfs.h ../include/linux/mm.h ../include/linux/kernel.h ../include/signal.h \
../include/sys/param.h ../include/sys/time.h ../include/time.h ../include/sys/resource.h \
../include/linux/tty.h ../include/asm/system.h ../include/termios.h ../include/linux/config.h \
../include/linux/config_rel.h ../include/linux/config_ver.h ../include/linux/config.dist.h \
../include/asm/segment.h ../include/sys/times.h ../include/linux/utsname.h ../include/linux/string.h
traps.s traps.o : traps.c ../include/linux/string.h ../include/linux/head.h ../include/linux/sched.h \
../include/linux/fs.h ../include/sys/types.h ../include/sys/dirent.h ../include/limits.h \
../include/linux/mm.h ../include/linux/kernel.h ../include/signal.h ../include/sys/param.h \
../include/sys/time.h ../include/time.h ../include/sys/resource.h ../include/asm/system.h \
../include/asm/segment.h ../include/asm/io.h ../include/errno.h
../include/sys/vfs.h ../include/linux/mm.h ../include/linux/kernel.h ../include/signal.h \
../include/sys/param.h ../include/sys/time.h ../include/time.h ../include/sys/resource.h \
../include/asm/system.h ../include/asm/segment.h ../include/asm/io.h ../include/errno.h
vsprintf.s vsprintf.o : vsprintf.c ../include/stdarg.h ../include/linux/string.h
......@@ -48,29 +48,30 @@ dep:
### Dependencies:
floppy.s floppy.o : floppy.c ../../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/linux/kernel.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/fdreg.h ../../include/linux/fd.h \
../../include/asm/system.h ../../include/asm/io.h ../../include/asm/segment.h \
../../include/sys/vfs.h ../../include/linux/mm.h ../../include/linux/kernel.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/fdreg.h \
../../include/linux/fd.h ../../include/asm/system.h ../../include/asm/io.h ../../include/asm/segment.h \
../../include/errno.h blk.h
hd.s hd.o : hd.c ../../include/errno.h ../../include/linux/config.h ../../include/linux/config_rel.h \
../../include/linux/config_ver.h ../../include/linux/config.dist.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/linux/kernel.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/hdreg.h \
../../include/asm/system.h ../../include/asm/io.h ../../include/asm/segment.h \
blk.h
../../include/sys/dirent.h ../../include/limits.h ../../include/sys/vfs.h ../../include/linux/mm.h \
../../include/linux/kernel.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/hdreg.h ../../include/asm/system.h ../../include/asm/io.h \
../../include/asm/segment.h blk.h
ll_rw_blk.s ll_rw_blk.o : ll_rw_blk.c ../../include/errno.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/linux/kernel.h \
../../include/signal.h ../../include/sys/param.h ../../include/sys/time.h ../../include/time.h \
../../include/sys/resource.h ../../include/asm/system.h blk.h
../../include/sys/dirent.h ../../include/limits.h ../../include/sys/vfs.h ../../include/linux/mm.h \
../../include/linux/kernel.h ../../include/signal.h ../../include/sys/param.h \
../../include/sys/time.h ../../include/time.h ../../include/sys/resource.h ../../include/asm/system.h \
blk.h
ramdisk.s ramdisk.o : ramdisk.c ../../include/linux/string.h ../../include/linux/config.h \
../../include/linux/config_rel.h ../../include/linux/config_ver.h ../../include/linux/config.dist.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/linux/kernel.h ../../include/signal.h \
../../include/sys/param.h ../../include/sys/time.h ../../include/time.h ../../include/sys/resource.h \
../../include/linux/minix_fs.h ../../include/asm/system.h ../../include/asm/segment.h \
../../include/asm/memory.h blk.h
../../include/sys/vfs.h ../../include/linux/mm.h ../../include/linux/kernel.h \
../../include/signal.h ../../include/sys/param.h ../../include/sys/time.h ../../include/time.h \
../../include/sys/resource.h ../../include/linux/minix_fs.h ../../include/asm/system.h \
../../include/asm/segment.h ../../include/asm/memory.h blk.h
......@@ -112,7 +112,7 @@ void rd_load(void)
nblocks, rd_length >> BLOCK_SIZE_BITS);
return;
}
printk("Loading %d bytes into ram disk... 0000k",
printk("Loading %d bytes into ram disk\n",
nblocks << BLOCK_SIZE_BITS);
cp = rd_start;
while (nblocks) {
......@@ -127,12 +127,12 @@ void rd_load(void)
}
(void) memcpy(cp, bh->b_data, BLOCK_SIZE);
brelse(bh);
printk("\010\010\010\010\010%4dk",i);
if (!(nblocks-- & 15))
printk(".");
cp += BLOCK_SIZE;
block++;
nblocks--;
i++;
}
printk("\010\010\010\010\010done \n");
printk("\ndone\n");
ROOT_DEV=0x0101;
}
......@@ -48,7 +48,7 @@ dep:
### Dependencies:
console.s console.o : console.c ../../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/linux/kernel.h \
../../include/limits.h ../../include/sys/vfs.h ../../include/linux/mm.h ../../include/linux/kernel.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/asm/system.h ../../include/termios.h ../../include/linux/config.h \
......@@ -57,51 +57,51 @@ console.s console.o : console.c ../../include/linux/sched.h ../../include/linux/
../../include/errno.h ../../include/sys/kd.h vt_kern.h
keyboard.s keyboard.o : keyboard.c ../../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/linux/kernel.h \
../../include/limits.h ../../include/sys/vfs.h ../../include/linux/mm.h ../../include/linux/kernel.h \
../../include/signal.h ../../include/sys/param.h ../../include/sys/time.h ../../include/time.h \
../../include/sys/resource.h ../../include/linux/ctype.h ../../include/linux/tty.h \
../../include/asm/system.h ../../include/termios.h ../../include/asm/io.h
lp.s lp.o : lp.c ../../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/linux/kernel.h ../../include/signal.h \
../../include/sys/param.h ../../include/sys/time.h ../../include/time.h ../../include/sys/resource.h \
../../include/linux/lp.h ../../include/errno.h ../../include/asm/io.h ../../include/asm/segment.h
../../include/sys/vfs.h ../../include/linux/mm.h ../../include/linux/kernel.h \
../../include/signal.h ../../include/sys/param.h ../../include/sys/time.h ../../include/time.h \
../../include/sys/resource.h ../../include/linux/lp.h ../../include/errno.h \
../../include/asm/io.h ../../include/asm/segment.h
mem.s mem.o : mem.c ../../include/errno.h ../../include/sys/types.h ../../include/linux/sched.h \
../../include/linux/head.h ../../include/linux/fs.h ../../include/sys/dirent.h \
../../include/limits.h ../../include/linux/mm.h ../../include/linux/kernel.h \
../../include/limits.h ../../include/sys/vfs.h ../../include/linux/mm.h ../../include/linux/kernel.h \
../../include/signal.h ../../include/sys/param.h ../../include/sys/time.h ../../include/time.h \
../../include/sys/resource.h ../../include/linux/tty.h ../../include/asm/system.h \
../../include/termios.h ../../include/asm/segment.h ../../include/asm/io.h
pty.s pty.o : pty.c ../../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/linux/kernel.h ../../include/signal.h \
../../include/sys/param.h ../../include/sys/time.h ../../include/time.h ../../include/sys/resource.h \
../../include/linux/tty.h ../../include/asm/system.h ../../include/termios.h \
../../include/asm/io.h
../../include/sys/vfs.h ../../include/linux/mm.h ../../include/linux/kernel.h \
../../include/signal.h ../../include/sys/param.h ../../include/sys/time.h ../../include/time.h \
../../include/sys/resource.h ../../include/linux/tty.h ../../include/asm/system.h \
../../include/termios.h ../../include/asm/io.h
serial.s serial.o : serial.c ../../include/signal.h ../../include/sys/types.h ../../include/linux/sched.h \
../../include/linux/head.h ../../include/linux/fs.h ../../include/sys/dirent.h \
../../include/limits.h ../../include/linux/mm.h ../../include/linux/kernel.h \
../../include/limits.h ../../include/sys/vfs.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/linux/timer.h ../../include/linux/tty.h ../../include/asm/system.h \
../../include/termios.h ../../include/asm/io.h
tty_io.s tty_io.o : tty_io.c ../../include/linux/ctype.h ../../include/errno.h ../../include/signal.h \
../../include/sys/types.h ../../include/unistd.h ../../include/sys/stat.h ../../include/sys/time.h \
../../include/time.h ../../include/sys/times.h ../../include/sys/utsname.h ../../include/sys/param.h \
../../include/sys/resource.h ../../include/utime.h ../../include/fcntl.h ../../include/linux/sched.h \
../../include/linux/head.h ../../include/linux/fs.h ../../include/sys/dirent.h \
../../include/limits.h ../../include/linux/mm.h ../../include/linux/kernel.h \
../../include/linux/tty.h ../../include/asm/system.h ../../include/termios.h \
../../include/asm/io.h ../../include/asm/segment.h
tty_io.s tty_io.o : tty_io.c ../../include/errno.h ../../include/signal.h ../../include/sys/types.h \
../../include/fcntl.h ../../include/linux/sched.h ../../include/linux/head.h \
../../include/linux/fs.h ../../include/sys/dirent.h ../../include/limits.h ../../include/sys/vfs.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/linux/tty.h \
../../include/asm/system.h ../../include/termios.h ../../include/linux/ctype.h \
../../include/asm/io.h ../../include/asm/segment.h ../../include/sys/kd.h vt_kern.h
tty_ioctl.s tty_ioctl.o : tty_ioctl.c ../../include/errno.h ../../include/termios.h ../../include/sys/types.h \
../../include/linux/sched.h ../../include/linux/head.h ../../include/linux/fs.h \
../../include/sys/dirent.h ../../include/limits.h ../../include/linux/mm.h ../../include/linux/kernel.h \
../../include/signal.h ../../include/sys/param.h ../../include/sys/time.h ../../include/time.h \
../../include/sys/resource.h ../../include/linux/tty.h ../../include/asm/system.h \
../../include/asm/io.h ../../include/asm/segment.h
../../include/sys/dirent.h ../../include/limits.h ../../include/sys/vfs.h ../../include/linux/mm.h \
../../include/linux/kernel.h ../../include/signal.h ../../include/sys/param.h \
../../include/sys/time.h ../../include/time.h ../../include/sys/resource.h ../../include/linux/tty.h \
../../include/asm/system.h ../../include/asm/io.h ../../include/asm/segment.h
vt.s vt.o : vt.c ../../include/errno.h ../../include/sys/types.h ../../include/sys/kd.h \
../../include/sys/vt.h ../../include/asm/io.h ../../include/asm/segment.h ../../include/linux/sched.h \
../../include/linux/head.h ../../include/linux/fs.h ../../include/sys/dirent.h \
../../include/limits.h ../../include/linux/mm.h ../../include/linux/kernel.h \
../../include/limits.h ../../include/sys/vfs.h ../../include/linux/mm.h ../../include/linux/kernel.h \
../../include/signal.h ../../include/sys/param.h ../../include/sys/time.h ../../include/time.h \
../../include/sys/resource.h ../../include/linux/tty.h ../../include/asm/system.h \
../../include/termios.h vt_kern.h
../../include/termios.h ../../include/linux/timer.h vt_kern.h
......@@ -46,16 +46,6 @@
#include <sys/kd.h>
#include "vt_kern.h"
#define DEF_TERMIOS \
(struct termios) { \
ICRNL, \
OPOST | ONLCR, \
0, \
IXON | ISIG | ICANON | ECHO | ECHOCTL | ECHOKE, \
0, \
INIT_C_CC \
}
/*
* These are set up by the setup-routine at boot-time:
*/
......@@ -81,10 +71,13 @@ extern void vt_init(void);
extern void keyboard_interrupt(void);
extern void set_leds(void);
extern unsigned char kapplic;
extern unsigned char ckmode;
extern unsigned char krepeat;
extern unsigned char kleds;
extern unsigned char kmode;
extern unsigned char kraw;
extern unsigned char ke0;
extern unsigned char lfnlmode;
unsigned long video_num_columns; /* Number of text columns */
unsigned long video_num_lines; /* Number of test lines */
......@@ -96,31 +89,57 @@ static unsigned long video_size_row; /* Bytes per row */
static unsigned char video_page; /* Initial video page */
static unsigned short video_port_reg; /* Video register select port */
static unsigned short video_port_val; /* Video register value port */
static int can_do_colour = 0;
static int can_do_color = 0;
static struct {
unsigned short vc_video_erase_char;
unsigned char vc_attr;
unsigned char vc_def_attr;
int vc_bold_attr;
unsigned long vc_ques;
unsigned long vc_state;
char * vc_restate;
unsigned long vc_checkin;
unsigned short vc_video_erase_char; /* Current attributes & space */
unsigned char vc_def_color; /* Default colors */
unsigned char vc_color; /* Foreground & background */
unsigned char vc_s_color; /* Saved foreground & background */
unsigned char vc_ulcolor; /* Colour for underline mode */
unsigned char vc_halfcolor; /* Colour for half intensity mode */
unsigned long vc_origin; /* Used for EGA/VGA fast scroll */
unsigned long vc_scr_end; /* Used for EGA/VGA fast scroll */
unsigned long vc_pos;
unsigned long vc_x,vc_y;
unsigned long vc_top,vc_bottom;
unsigned long vc_state;
unsigned long vc_npar,vc_par[NPAR];
unsigned long vc_video_mem_start; /* Start of video RAM */
unsigned long vc_video_mem_end; /* End of video RAM (sort of) */
unsigned int vc_saved_x;
unsigned int vc_saved_y;
unsigned int vc_iscolor;
unsigned char vc_kbdapplic;
unsigned long vc_saved_x;
unsigned long vc_saved_y;
/* mode flags */
unsigned long vc_kbdapplic : 1; /* Application keyboard */
unsigned long vc_charset : 1; /* Character set G0 / G1 */
unsigned long vc_s_charset : 1; /* Saved character set */
unsigned long vc_decckm : 1; /* Cursor Keys Mode */
unsigned long vc_decscnm : 1; /* Screen Mode */
unsigned long vc_decom : 1; /* Origin Mode */
unsigned long vc_decawm : 1; /* Autowrap Mode */
unsigned long vc_decarm : 1; /* Autorepeat Mode */
unsigned long vc_deccm : 1; /* Cursor Visible */
unsigned long vc_decim : 1; /* Insert Mode */
unsigned long vc_lnm : 1; /* Line feed New line Mode */
/* attribute flags */
unsigned long vc_intensity : 2; /* 0=half-bright, 1=normal, 2=bold */
unsigned long vc_underline : 1;
unsigned long vc_blink : 1;
unsigned long vc_reverse : 1;
unsigned long vc_s_intensity : 2; /* saved rendition */
unsigned long vc_s_underline : 1;
unsigned long vc_s_blink : 1;
unsigned long vc_s_reverse : 1;
/* misc */
unsigned long vc_ques : 1;
unsigned long vc_need_wrap : 1;
unsigned long vc_tab_stop[5]; /* Tab stops. 160 columns. */
unsigned char vc_kbdmode;
char * vc_translate;
char * vc_G0_charset;
char * vc_G1_charset;
char * vc_saved_G0;
char * vc_saved_G1;
/* additional information is in vt_kern.h */
} vc_cons [NR_CONSOLES];
......@@ -138,25 +157,58 @@ static int console_blanked = 0;
#define x (vc_cons[currcons].vc_x)
#define y (vc_cons[currcons].vc_y)
#define state (vc_cons[currcons].vc_state)
#define restate (vc_cons[currcons].vc_restate)
#define checkin (vc_cons[currcons].vc_checkin)
#define npar (vc_cons[currcons].vc_npar)
#define par (vc_cons[currcons].vc_par)
#define ques (vc_cons[currcons].vc_ques)
#define attr (vc_cons[currcons].vc_attr)
#define attr (vc_cons[currcons].vc_video_erase_char >> 8)
#define saved_x (vc_cons[currcons].vc_saved_x)
#define saved_y (vc_cons[currcons].vc_saved_y)
#define translate (vc_cons[currcons].vc_translate)
#define G0_charset (vc_cons[currcons].vc_G0_charset)
#define G1_charset (vc_cons[currcons].vc_G1_charset)
#define saved_G0 (vc_cons[currcons].vc_saved_G0)
#define saved_G1 (vc_cons[currcons].vc_saved_G1)
#define video_mem_start (vc_cons[currcons].vc_video_mem_start)
#define video_mem_end (vc_cons[currcons].vc_video_mem_end)
#define def_attr (vc_cons[currcons].vc_def_attr)
#define video_erase_char (vc_cons[currcons].vc_video_erase_char)
#define iscolor (vc_cons[currcons].vc_iscolor)
#define decckm (vc_cons[currcons].vc_decckm)
#define decscnm (vc_cons[currcons].vc_decscnm)
#define decom (vc_cons[currcons].vc_decom)
#define decawm (vc_cons[currcons].vc_decawm)
#define decarm (vc_cons[currcons].vc_decarm)
#define deccm (vc_cons[currcons].vc_deccm)
#define decim (vc_cons[currcons].vc_decim)
#define lnm (vc_cons[currcons].vc_lnm)
#define kbdapplic (vc_cons[currcons].vc_kbdapplic)
#define need_wrap (vc_cons[currcons].vc_need_wrap)
#define color (vc_cons[currcons].vc_color)
#define s_color (vc_cons[currcons].vc_s_color)
#define def_color (vc_cons[currcons].vc_def_color)
#define foreground (color & 0x0f)
#define background (color & 0xf0)
#define charset (vc_cons[currcons].vc_charset)
#define s_charset (vc_cons[currcons].vc_s_charset)
#define intensity (vc_cons[currcons].vc_intensity)
#define underline (vc_cons[currcons].vc_underline)
#define blink (vc_cons[currcons].vc_blink)
#define reverse (vc_cons[currcons].vc_reverse)
#define s_intensity (vc_cons[currcons].vc_s_intensity)
#define s_underline (vc_cons[currcons].vc_s_underline)
#define s_blink (vc_cons[currcons].vc_s_blink)
#define s_reverse (vc_cons[currcons].vc_s_reverse)
#define ulcolor (vc_cons[currcons].vc_ulcolor)
#define halfcolor (vc_cons[currcons].vc_halfcolor)
#define kbdmode (vc_cons[currcons].vc_kbdmode)
#define tab_stop (vc_cons[currcons].vc_tab_stop)
#define kbdraw (vt_cons[currcons].vc_kbdraw)
#define kbde0 (vt_cons[currcons].vc_kbde0)
#define kbdleds (vt_cons[currcons].vc_kbdleds)
#define vtmode (vt_cons[currcons].vt_mode)
#define SET(mode,fg,v) \
(mode) = (v); \
if (currcons == fg_console) \
(fg) = (v)
int blankinterval = 5*60*HZ;
static int screen_size = 0;
......@@ -164,10 +216,10 @@ static int screen_size = 0;
static void sysbeep(void);
/*
* this is what the terminal answers to a ESC-Z or csi0c
* query (= vt100 response).
* this is what the terminal answers to a ESC-Z or csi0c query.
*/
#define RESPONSE "\033[?1;2c"
#define VT100ID "\033[?1;2c"
#define VT102ID "\033[?6c"
static char * translations[] = {
/* 8-bit Latin-1 mapped to the PC charater set: '\0' means non-printable */
......@@ -204,21 +256,45 @@ static char * translations[] = {
#define NORM_TRANS (translations[0])
#define GRAF_TRANS (translations[1])
/* NOTE! gotoxy thinks x==video_num_columns is ok */
static inline void gotoxy(int currcons, unsigned int new_x,unsigned int new_y)
static unsigned char color_table[] = { 0, 4, 2, 6, 1, 5, 3, 7,
8,12,10,14, 9,13,11,15 };
/*
* gotoxy() must verify all boundaries, because the arguments
* might also be negative. If the given position is out of
* bounds, the cursor is placed at the nearest margin.
*/
static void gotoxy(int currcons, int new_x, int new_y)
{
if (new_x > video_num_columns || new_y >= video_num_lines)
return;
int max_y;
if (new_x < 0)
x = 0;
else
if (new_x >= video_num_columns)
x = video_num_columns - 1;
else
x = new_x;
if (decom) {
new_y += top;
max_y = bottom;
} else
max_y = video_num_lines;
if (new_y < 0)
y = 0;
else
if (new_y >= max_y)
y = max_y - 1;
else
y = new_y;
pos = origin + y*video_size_row + (x<<1);
}
static inline void set_origin(int currcons)
static void set_origin(int currcons)
{
if (video_type != VIDEO_TYPE_EGAC && video_type != VIDEO_TYPE_EGAM)
return;
if (currcons != fg_console || vt_cons[currcons].vt_mode == KD_GRAPHICS)
if (currcons != fg_console || vtmode == KD_GRAPHICS)
return;
cli();
outb_p(12, video_port_reg);
......@@ -321,7 +397,7 @@ static void ri(int currcons)
scrdown(currcons,top,bottom);
}
static void cr(int currcons)
static inline void cr(int currcons)
{
pos -= x<<1;
x=0;
......@@ -347,7 +423,7 @@ static void csi_J(int currcons, int vpar)
start = pos;
break;
case 1: /* erase from start to cursor */
count = (pos-origin)>>1;
count = ((pos-origin)>>1)+1;
start = origin;
break;
case 2: /* erase whole display */
......@@ -372,14 +448,12 @@ static void csi_K(int currcons, int vpar)
switch (vpar) {
case 0: /* erase from cursor to end of line */
if (x>=video_num_columns)
return;
count = video_num_columns-x;
start = pos;
break;
case 1: /* erase from start of line to cursor */
start = pos - (x<<1);
count = (x<video_num_columns)?x:video_num_columns;
count = x+1;
break;
case 2: /* erase whole line */
start = pos - (x<<1);
......@@ -396,52 +470,99 @@ static void csi_K(int currcons, int vpar)
:"cx","di");
}
static void csi_m(int currcons )
/*
* I hope this works. The monochrome part is untested.
*/
static void update_attr(int currcons)
{
unsigned char a = color;
if (can_do_color) {
if (underline)
a = (a & 0xf8) | ulcolor;
else if (intensity == 0)
a = (a & 0xf0) | halfcolor;
}
if (reverse ^ decscnm)
a = (a & 0x88) | (((a >> 4) | (a << 4)) & 0x77);
if (blink)
a |= 0x80;
if (intensity == 2)
a |= 0x08;
if (!can_do_color) {
if (underline)
a = (a & 0xf8) | 0x01;
else if (intensity == 0)
a = (a & 0xf0) | 0x08;
}
video_erase_char = (a << 8) | ' ';
}
static void csi_m(int currcons)
{
int i;
static int conv_table[8] = { 0, 4, 2, 6, 1, 5, 3, 7 };
for (i=0;i<=npar;i++)
switch (par[i]) {
case 0: attr=def_attr;break; /* default */
case 1: attr=(iscolor?attr|0x08:attr|0x0f);break; /* bold */
/*case 4: attr=attr|0x01;break;*/ /* underline */
case 4: /* bold */
if (!iscolor)
attr |= 0x01;
else
{ /* check if forground == background */
if (vc_cons[currcons].vc_bold_attr != -1)
attr = (vc_cons[currcons].vc_bold_attr&0x0f)|(0xf0&(attr));
else
{ short newattr = (attr&0xf0)|(0xf&(~attr));
attr = ((newattr&0xf)==((attr>>4)&0xf)?
(attr&0xf0)|(((attr&0xf)+1)%0xf):
newattr);
}
}
case 0: /* all attributes off */
intensity = 1;
underline = 0;
reverse = 0;
blink = 0;
color = def_color;
break;
case 1:
intensity = 2;
break;
case 2:
intensity = 0;
break;
case 4:
underline = 1;
break;
case 5:
blink = 1;
break;
case 7:
reverse = 1;
break;
case 21:
case 22:
intensity = 1;
break;
case 24:
underline = 0;
break;
case 25:
blink = 0;
break;
case 27:
reverse = 0;
break;
case 39:
color = (def_color & 0x0f) | background;
break;
case 49:
color = (def_color & 0xf0) | foreground;
break;
case 5: attr=attr|0x80;break; /* blinking */
case 7: attr=(attr&0x88)|((attr<<4)&0x70)|
((attr>>4)&0x07);break; /* negative */
case 22: attr=attr&0xf7;break; /* not bold */
case 24: attr=attr&0xfe;break; /* not underline */
case 25: attr=attr&0x7f;break; /* not blinking */
case 27: attr=def_attr;break; /* positive image */
case 39: attr=(attr & 0xf8)|(def_attr & 0x07); break;
case 49: attr=(attr & 0x8f)|(def_attr & 0x70); break;
default:
if (!can_do_colour)
break;
iscolor = 1;
if ((par[i]>=30) && (par[i]<=37))
attr = (attr & 0xf8) | conv_table[par[i]-30];
else /* Background color */
if ((par[i]>=40) && (par[i]<=47))
attr = (attr & 0x8f) | (conv_table[par[i]-40]<<4);
else
if (par[i] >= 30 && par[i] <= 37)
color = color_table[par[i]-30]
| background;
else if (par[i] >= 40 && par[i] <= 47)
color = (color_table[par[i]-40]<<4)
| foreground;
break;
}
update_attr(currcons);
}
static inline void hide_cursor(int currcons)
{
outb_p(14, video_port_reg);
outb_p(0xff&((scr_end-video_mem_base)>>9), video_port_val);
outb_p(15, video_port_reg);
outb_p(0xff&((scr_end-video_mem_base)>>1), video_port_val);
}
static inline void set_cursor(int currcons)
......@@ -449,25 +570,18 @@ static inline void set_cursor(int currcons)
if (currcons != fg_console)
return;
cli();
if (deccm) {
outb_p(14, video_port_reg);
outb_p(0xff&((pos-video_mem_base)>>9), video_port_val);
outb_p(15, video_port_reg);
outb_p(0xff&((pos-video_mem_base)>>1), video_port_val);
} else
hide_cursor(currcons);
sti();
}
static inline void hide_cursor(int currcons)
{
outb_p(14, video_port_reg);
outb_p(0xff&((scr_end-video_mem_base)>>9), video_port_val);
outb_p(15, video_port_reg);
outb_p(0xff&((scr_end-video_mem_base)>>1), video_port_val);
}
static void respond(int currcons, struct tty_struct * tty)
static void respond_string(char * p, int currcons, struct tty_struct * tty)
{
char * p = RESPONSE;
while (*p) {
PUTCH(*p,tty->read_q);
p++;
......@@ -475,6 +589,123 @@ static void respond(int currcons, struct tty_struct * tty)
TTY_READ_FLUSH(tty);
}
static void respond_num(unsigned int n, int currcons, struct tty_struct * tty)
{
char buff[3];
int i = 0;
do {
buff[i++] = (n%10)+'0';
n /= 10;
} while(n && i < 3); /* We'll take no chances */
while (i--) {
PUTCH(buff[i],tty->read_q);
}
/* caller must flush */
}
static void cursor_report(int currcons, struct tty_struct * tty)
{
PUTCH('\033', tty->read_q);
PUTCH('[', tty->read_q);
respond_num(y + (decom ? top+1 : 1), currcons, tty);
PUTCH(';', tty->read_q);
respond_num(x+1, currcons, tty);
PUTCH('R', tty->read_q);
TTY_READ_FLUSH(tty);
}
static inline void status_report(int currcons, struct tty_struct * tty)
{
respond_string("\033[0n", currcons, tty); /* Terminal ok */
}
static inline void respond_ID(int currcons, struct tty_struct * tty)
{
respond_string(VT102ID, currcons, tty);
}
static void invert_screen(int currcons) {
unsigned char *p;
if (can_do_color)
for (p = (unsigned char *)origin+1; p < (unsigned char *)scr_end; p+=2)
*p = (*p & 0x88) | ((*p & 0x70) >> 4) | ((*p & 0x07) << 4);
else
for (p = (unsigned char *)origin+1; p < (unsigned char *)scr_end; p+=2)
*p = *p ^ (*p & 0x07 == 1 ? 0x70 : 0x77);
}
static void set_mode(int currcons, int on_off)
{
int i;
for (i=0; i<=npar; i++)
if (ques) switch(par[i]) { /* DEC private modes set/reset */
case 1: /* Cursor keys send ^[Ox/^[[x */
SET(decckm,ckmode,on_off);
break;
case 3: /* 80/132 mode switch unimplemented */
csi_J(currcons,2);
gotoxy(currcons,0,0);
break;
case 5: /* Inverted screen on/off */
if (decscnm != on_off) {
decscnm = on_off;
invert_screen(currcons);
update_attr(currcons);
}
break;
case 6: /* Origin relative/absolute */
decom = on_off;
gotoxy(currcons,0,0);
break;
case 7: /* Autowrap on/off */
decawm = on_off;
break;
case 8: /* Autorepeat on/off */
SET(decarm,krepeat,on_off);
break;
case 25: /* Cursor on/off */
deccm = on_off;
set_cursor(currcons);
break;
} else switch(par[i]) { /* ANSI modes set/reset */
case 4: /* Insert Mode on/off */
decim = on_off;
break;
case 20: /* Lf, Enter == CrLf/Lf */
SET(lnm,lfnlmode,on_off);
break;
}
}
static void setterm_command(int currcons)
{
switch(par[0]) {
case 1: /* set color for underline mode */
if (can_do_color && par[1] < 16) {
ulcolor = color_table[par[1]];
if (underline)
update_attr(currcons);
}
break;
case 2: /* set color for half intensity mode */
if (can_do_color && par[1] < 16) {
halfcolor = color_table[par[1]];
if (intensity == 0)
update_attr(currcons);
}
break;
case 8: /* store colors as defaults */
def_color = color;
break;
case 9: /* set blanking interval */
blankinterval = ((par[1] < 60) ? par[1] : 60) * 60 * HZ;
break;
}
}
static void insert_char(int currcons)
{
unsigned int i = x;
......@@ -499,8 +730,6 @@ static void delete_char(int currcons)
unsigned int i = x;
unsigned short * p = (unsigned short *) pos;
if (x >= video_num_columns)
return;
while (++i < video_num_columns) {
*p = *(p+1);
p++;
......@@ -557,16 +786,89 @@ static void save_cur(int currcons)
{
saved_x = x;
saved_y = y;
s_intensity = intensity;
s_blink = blink;
s_underline = underline;
s_blink = blink;
s_reverse = reverse;
s_charset = charset;
s_color = color;
saved_G0 = G0_charset;
saved_G1 = G1_charset;
}
static void restore_cur(int currcons)
{
gotoxy(currcons, saved_x, saved_y);
x = saved_x;
y = saved_y;
pos = origin + y*video_size_row + (x<<1);
intensity = s_intensity;
blink = s_blink;
underline = s_underline;
blink = s_blink;
reverse = s_reverse;
charset = s_charset;
color = s_color;
G0_charset = saved_G0;
G1_charset = saved_G1;
translate = charset ? G1_charset : G0_charset;
update_attr(currcons);
}
enum { ESnormal, ESesc, ESsquare, ESgetpars, ESgotpars, ESfunckey,
ESsetterm, ESsetgraph, ESgraph, ESgresc, ESignore };
EShash, ESsetG0, ESsetG1, ESignore };
static void reset_terminal(int currcons, int do_clear)
{
vtmode = KD_TEXT;
top = 0;
bottom = video_num_lines;
/* Default colors. */
def_color = 0x07; /* light gray */
ulcolor = 0x0f; /* bold white */
halfcolor = 0x08; /* dark gray */
color = def_color;
state = ESnormal;
ques = 0;
translate = NORM_TRANS;
G0_charset = NORM_TRANS;
G1_charset = GRAF_TRANS;
charset = 0;
kbdleds = 2;
kbdmode = 0;
kbdraw = 0;
kbde0 = 0;
need_wrap = 0;
decscnm = 0;
decom = 0;
decawm = 1;
deccm = 1;
decim = 0;
SET(decarm,krepeat,1);
SET(decckm,ckmode,0);
SET(kbdapplic,kapplic,0);
SET(lnm,lfnlmode,0);
intensity = 1;
underline = 0;
blink = 0;
reverse = 0;
update_attr(currcons);
tab_stop[0] = 0x01010100;
tab_stop[1] =
tab_stop[2] =
tab_stop[3] =
tab_stop[4] = 0x01010101;
if (do_clear) {
gotoxy(currcons,0,0);
csi_J(currcons,2);
}
save_cur(currcons);
}
void con_write(struct tty_struct * tty)
{
......@@ -580,54 +882,75 @@ void con_write(struct tty_struct * tty)
return;
}
while (!tty->stopped && (c = GETCH(tty->write_q)) >= 0) {
if (c == 24 || c == 26)
state = ESnormal;
switch(state) {
case ESnormal:
if (translate[c]) {
c = translate[c];
while (x >= video_num_columns) {
x -= video_num_columns;
pos -= video_size_row;
if (state == ESnormal && translate[c]) {
if (need_wrap) {
cr(currcons);
lf(currcons);
need_wrap = 0;
}
if (decim)
insert_char(currcons);
c = translate[c];
*(char *) pos = c;
*(char *) (pos+1) = attr;
pos += 2;
if (x == video_num_columns - 1) {
need_wrap = decawm;
continue;
}
x++;
} else if (c == 27)
state = ESesc;
else if (c == 10 || c == 11 || c == 12)
lf(currcons);
else if (c == 13)
cr(currcons);
else if (c == 127)
del(currcons);
else if (c == 8) {
pos+=2;
continue;
}
need_wrap = 0;
/*
* Control characters can be used in the _middle_
* of an escape sequence.
*/
if (c < 32 || c == 127) switch(c) {
case 7:
sysbeep();
break;
case 8:
if (x) {
x--;
pos -= 2;
}
} else if (c == 9) {
c = 8-(x&7);
x += c;
pos += c<<1;
if (x > video_num_columns) {
x -= video_num_columns;
pos -= video_size_row;
lf(currcons);
}
c = 9;
} else if (c == 7)
sysbeep();
else if (c == 14) {
checkin = 1;
translate = restate;
} else if (c == 15) {
translate = NORM_TRANS;
checkin = 0;
break;
case 9:
pos -= (x << 1);
while (x < video_num_columns - 1) {
x++;
if (tab_stop[x >> 5] & (1 << (x & 31)))
break;
}
pos += (x << 1);
break;
case 10: case 11: case 12:
lf(currcons);
if (!lfnlmode)
break;
case 13:
cr(currcons);
break;
case 14:
charset = 1;
translate = G1_charset;
break;
case 15:
charset = 0;
translate = G0_charset;
break;
case 24: case 26:
state = ESnormal;
break;
case 27:
state = ESesc;
break;
case 127:
del(currcons);
break;
} else switch(state) {
case ESesc:
state = ESnormal;
switch (c) {
......@@ -635,7 +958,8 @@ void con_write(struct tty_struct * tty)
state = ESsquare;
break;
case 'E':
gotoxy(currcons,0,y+1);
cr(currcons);
lf(currcons);
break;
case 'M':
ri(currcons);
......@@ -643,8 +967,11 @@ void con_write(struct tty_struct * tty)
case 'D':
lf(currcons);
break;
case 'H':
tab_stop[x >> 5] |= (1 << (x & 31));
break;
case 'Z':
respond(currcons,tty);
respond_ID(currcons,tty);
break;
case '7':
save_cur(currcons);
......@@ -653,32 +980,22 @@ void con_write(struct tty_struct * tty)
restore_cur(currcons);
break;
case '(':
case ')':
state = ESsetgraph;
state = ESsetG0;
break;
case 'P':
state = ESsetterm;
case ')':
state = ESsetG1;
break;
case '#':
state = -1;
state = EShash;
break;
case 'c':
tty->termios = DEF_TERMIOS;
state = ESnormal;
restate = NORM_TRANS;
checkin = 0;
top = 0;
bottom = video_num_lines;
translate = NORM_TRANS;
reset_terminal(currcons,1);
break;
case '>': /* Numeric keypad */
kbdapplic = 0;
if (currcons == fg_console)
kapplic = 0;
SET(kbdapplic,kapplic,0);
break;
case '=': /* Appl. keypad */
kbdapplic = 1;
if (currcons == fg_console)
kapplic = 1;
SET(kbdapplic,kapplic,1);
break;
}
break;
......@@ -704,6 +1021,21 @@ void con_write(struct tty_struct * tty)
} else state=ESgotpars;
case ESgotpars:
state = ESnormal;
switch(c) {
case 'h':
set_mode(currcons,1);
break;
case 'l':
set_mode(currcons,0);
break;
case 'n':
if (!ques)
if (par[0] == 5)
status_report(currcons,tty);
else if (par[0] == 6)
cursor_report(currcons,tty);
break;
}
if (ques) {
ques = 0;
break;
......@@ -761,20 +1093,33 @@ void con_write(struct tty_struct * tty)
case 'P':
csi_P(currcons,par[0]);
break;
case '@':
csi_at(currcons,par[0]);
case 'c':
if (!par[0])
respond_ID(currcons,tty);
break;
case 'g':
if (!par[0])
tab_stop[x >> 5] &= ~(1 << (x & 31));
else if (par[0] == 3) {
tab_stop[0] =
tab_stop[1] =
tab_stop[2] =
tab_stop[3] =
tab_stop[4] = 0;
}
break;
case 'm':
csi_m(currcons);
break;
case 'r':
if (par[0])
par[0]--;
if (!par[0])
par[0]++;
if (!par[1])
par[1] = video_num_lines;
/* Minimum allowed region is 2 lines */
if (par[0] < par[1] &&
par[1] <= video_num_lines) {
top=par[0];
top=par[0]-1;
bottom=par[1];
gotoxy(currcons,0,0);
}
......@@ -785,40 +1130,44 @@ void con_write(struct tty_struct * tty)
case 'u':
restore_cur(currcons);
break;
case 'l': /* blank interval */
case 'b': /* bold attribute */
if (!((npar >= 2) &&
((par[1]-13) == par[0]) &&
((par[2]-17) == par[0])))
case '@':
csi_at(currcons,par[0]);
break;
case ']': /* setterm functions */
setterm_command(currcons);
break;
if ((c=='l') && (par[0]<=60)) {
blankinterval = HZ*60*par[0];
}
if (c=='b')
vc_cons[currcons].vc_bold_attr
= par[0];
}
break;
case ESfunckey:
state = ESnormal;
break;
case ESsetterm: /* Setterm functions. */
case EShash:
state = ESnormal;
if (c == 'S') {
def_attr = attr;
video_erase_char = (video_erase_char&0x0ff) | (def_attr<<8);
} else if (c == 'L')
/*linewrap on*/;
else if (c == 'l')
/*linewrap off*/;
break;
case ESsetgraph:
if (c == '0') {
if (checkin)
translate = GRAF_TRANS;
restate = GRAF_TRANS;
} else if (c == 'B')
translate = restate = NORM_TRANS;
if (c == '8') {
/* DEC screen alignment test. kludge :-) */
video_erase_char =
(video_erase_char & 0xff00) | 'E';
csi_J(currcons, 2);
video_erase_char =
(video_erase_char & 0xff00) | ' ';
}
break;
case ESsetG0:
if (c == '0')
G0_charset = GRAF_TRANS;
else if (c == 'B')
G0_charset = NORM_TRANS;
if (charset == 0)
translate = G0_charset;
state = ESnormal;
break;
case ESsetG1:
if (c == '0')
G1_charset = GRAF_TRANS;
else if (c == 'B')
G1_charset = NORM_TRANS;
if (charset == 1)
translate = G1_charset;
state = ESnormal;
break;
default:
......@@ -826,7 +1175,7 @@ void con_write(struct tty_struct * tty)
}
}
timer_active &= ~(1<<BLANK_TIMER);
if (vt_cons[currcons].vt_mode == KD_GRAPHICS)
if (vtmode == KD_GRAPHICS)
return;
set_cursor(currcons);
if (currcons == fg_console)
......@@ -889,7 +1238,6 @@ long con_init(long kmem_start)
video_size_row = video_num_columns * 2;
video_num_lines = ORIG_VIDEO_LINES;
video_page = ORIG_VIDEO_PAGE;
video_erase_char = 0x0720;
screen_size = (video_num_lines * video_size_row);
kmem_start += NR_CONSOLES * screen_size;
timer_table[BLANK_TIMER].fn = blank_screen;
......@@ -919,7 +1267,7 @@ long con_init(long kmem_start)
}
else /* If not, it is color. */
{
can_do_colour = 1;
can_do_color = 1;
video_mem_base = 0xb8000;
video_port_reg = 0x3d4;
video_port_val = 0x3d5;
......@@ -937,7 +1285,7 @@ long con_init(long kmem_start)
}
}
/* Let the user known what kind of display driver we are using */
/* Let the user know what kind of display driver we are using */
display_ptr = ((char *)video_mem_base) + video_size_row - 8;
while (*display_desc)
......@@ -946,52 +1294,24 @@ long con_init(long kmem_start)
display_ptr++;
}
memsetw(vc_scrmembuf,video_erase_char,MEM_BUFFER_SIZE/2);
base = (long)vc_scrmembuf;
/* Initialize the variables used for scrolling (mostly EGA/VGA) */
base = origin = video_mem_start = (long)vc_scrmembuf;
scr_end = video_mem_end = base + screen_size;
vc_scrbuf[0] = (unsigned short *) origin;
top = 0;
bottom = video_num_lines;
attr = 0x07;
def_attr = 0x07;
restate = NORM_TRANS;
state = ESnormal;
checkin = 0;
ques = 0;
iscolor = 0;
translate = NORM_TRANS;
kbdleds = 2;
kbdmode = 0;
kbdraw = 0;
kbde0 = 0;
kbdapplic = 0;
vt_cons[0].vt_mode = KD_TEXT;
vc_cons[0].vc_bold_attr = -1;
gotoxy(currcons,orig_x,orig_y);
for (currcons = 1 ; currcons < NR_CONSOLES ; currcons++) {
vc_cons[currcons] = vc_cons[0];
vt_cons[currcons] = vt_cons[0];
base += screen_size;
x = y = 0;
base = (long)vc_scrmembuf;
for (currcons = 0; currcons<NR_CONSOLES; currcons++) {
pos = origin = video_mem_start = base;
scr_end = video_mem_end = base + screen_size;
scr_end = video_mem_end = (base += screen_size);
vc_scrbuf[currcons] = (unsigned short *) origin;
reset_terminal(currcons, currcons);
}
currcons = 0;
currcons = fg_console = 0;
video_mem_start = video_mem_base;
video_mem_end = video_mem_term;
origin = video_mem_start;
scr_end = video_mem_start + video_num_lines * video_size_row;
top = 0;
bottom = video_num_lines;
pos=origin + y*video_size_row + (x<<1);
gotoxy(currcons,orig_x,orig_y);
update_screen(fg_console);
set_trap_gate(0x21,&keyboard_interrupt);
outb_p(inb_p(0x21)&0xfd,0x21);
a=inb_p(0x61);
......@@ -1008,12 +1328,18 @@ void kbdsave(int new_console)
kbde0 = ke0;
kbdleds = kleds;
kbdapplic = kapplic;
decckm = ckmode;
decarm = krepeat;
lnm = lfnlmode;
currcons = new_console;
kmode = (kmode & 0x3F) | (kbdmode & 0xC0);
kraw = kbdraw;
ke0 = kbde0;
kleds = kbdleds;
kapplic = kbdapplic;
ckmode = decckm;
krepeat = decarm;
lfnlmode = lnm;
set_leds();
}
......@@ -1123,24 +1449,21 @@ void console_print(const char * b)
if (currcons<0 || currcons>=NR_CONSOLES)
currcons = 0;
while (c = *(b++)) {
if (c == 10) {
if (c == 10 || c == 13 || need_wrap) {
cr(currcons);
if (c == 10 || need_wrap)
lf(currcons);
need_wrap = 0;
continue;
}
if (c == 13) {
cr(currcons);
continue;
}
while (x >= video_num_columns) {
x -= video_num_columns;
pos -= video_size_row;
lf(currcons);
}
*(char *) pos = c;
*(char *) (pos+1) = attr;
pos += 2;
if (x == video_num_columns - 1) {
need_wrap = 1;
continue;
}
x++;
pos+=2;
}
set_cursor(currcons);
}
......@@ -29,11 +29,14 @@
#define NO_META_BIT 0x80
unsigned char kapplic = 0;
unsigned char ckmode = 0;
unsigned char krepeat = 1;
unsigned char kmode = 0;
unsigned char kleds = NUMLED;
unsigned char ke0 = 0;
unsigned char kraw = 0;
unsigned char kbd_flags = KBDFLAGS;
unsigned char lfnlmode = 0;
extern void do_keyboard_interrupt(void);
extern void ctrl_alt_del(void);
......@@ -57,7 +60,9 @@ static unsigned int handle_diacr(unsigned int);
void do_keyboard(void)
{
static unsigned char rep = 0xff, repke0 = 0;
unsigned char scancode, x;
struct tty_struct * tty = TTY_TABLE(0);
scancode=inb_p(0x60);
x=inb_p(0x61);
......@@ -69,15 +74,48 @@ void do_keyboard(void)
if (kraw) {
put_queue(scancode);
do_keyboard_interrupt();
} else if (scancode == 0xe0)
return;
}
if (scancode == 0xe0) {
ke0 = 1;
else if (scancode == 0xe1)
return;
}
if (scancode == 0xe1) {
ke0 = 2;
else {
return;
}
/*
* The keyboard maintains its own internal caps lock and num lock
* statuses. In caps lock mode E0 AA precedes make code and E0 2A
* follows break code. In num lock mode, E0 2A precedes make
* code and E0 AA follows break code. We do our own book-keeping,
* so we will just ignore these.
*/
if (ke0 == 1 && (scancode == 0x2a || scancode == 0xaa)) {
ke0 = 0;
return;
}
/*
* Repeat a key only if the input buffers are empty or the
* characters get echoed locally. This makes key repeat usable
* with slow applications and unders heavy loads.
*/
if (rep == 0xff) {
if (scancode < 0x80) {
rep = scancode;
repke0 = ke0;
}
} else if (ke0 == repke0 && (scancode & 0x7f) == rep)
if (scancode & 0x80)
rep = 0xff;
else if (!(krepeat && (L_ECHO(tty) || (EMPTY(tty->secondary) &&
EMPTY(tty->read_q))))) {
ke0 = 0;
return;
}
key_table[scancode](scancode);
do_keyboard_interrupt();
ke0 = 0;
}
}
static void put_queue(int ch)
......@@ -167,10 +205,10 @@ static void unrshift(int sc)
static void caps(int sc)
{
if (!(kmode&CAPSDOWN)) {
kleds^=CAPSLED;
kmode^=CAPS;
kmode|=CAPSDOWN;
if (!(kmode & CAPSDOWN)) {
kleds ^= CAPSLED;
kmode ^= CAPS;
kmode |= CAPSDOWN;
set_leds();
}
}
......@@ -178,7 +216,7 @@ static void caps(int sc)
void set_leds(void)
{
if (kleds != old_leds) {
old_leds=kleds;
old_leds = kleds;
kb_wait();
outb(0xed, 0x60); /* set leds command */
kb_ack();
......@@ -190,16 +228,16 @@ void set_leds(void)
static void uncaps(int sc)
{
kmode&=(~CAPSDOWN);
kmode &= ~CAPSDOWN;
}
static void scroll(int sc)
{
if (kmode&(LSHIFT|RSHIFT))
if (kmode & (LSHIFT | RSHIFT))
show_mem();
else
show_state();
kleds^=SCRLED;
kleds ^= SCRLED;
set_leds();
}
......@@ -208,7 +246,7 @@ static void num(int sc)
if (kapplic)
applkey(0x50);
else {
kleds^=NUMLED;
kleds ^= NUMLED;
set_leds();
}
}
......@@ -217,7 +255,7 @@ static void applkey(int key)
{
char buf[] = { 0x1b, 0x4f, 0x00, 0x00 };
buf[2]=key;
buf[2] = key;
puts_queue(buf);
}
......@@ -747,27 +785,27 @@ static void do_self(int sc)
{
unsigned char ch;
if (kmode&ALTGR)
ch=alt_map[sc];
else if (kmode&(LSHIFT|RSHIFT|LCTRL|RCTRL))
ch=shift_map[sc];
if (kmode & ALTGR)
ch = alt_map[sc];
else if (kmode & (LSHIFT | RSHIFT | LCTRL | RCTRL))
ch = shift_map[sc];
else
ch=key_map[sc];
ch = key_map[sc];
if (ch == 0)
return;
if ((ch=handle_diacr(ch)) == 0)
if ((ch = handle_diacr(ch)) == 0)
return;
if (kmode&(LCTRL|RCTRL|CAPS)) /* ctrl or caps */
if ((ch>='a' && ch <='z') || (ch>=224 && ch<=254))
if (kmode & (LCTRL | RCTRL | CAPS)) /* ctrl or caps */
if ((ch >= 'a' && ch <= 'z') || (ch >= 224 && ch <= 254))
ch -= 32;
if (kmode&(LCTRL|RCTRL)) /* ctrl */
if (kmode & (LCTRL | RCTRL)) /* ctrl */
ch &= 0x1f;
if (kmode&ALT)
if (kbd_flags&NO_META_BIT) {
if (kmode & ALT)
if (kbd_flags & NO_META_BIT) {
put_queue('\033');
put_queue(ch);
} else
......@@ -910,7 +948,7 @@ static void cur(int sc)
buf[2]=cur_table[sc];
if (buf[2] < '9')
buf[3]='~';
if (kapplic)
if ((buf[2] >= 'A' && buf[2] <= 'D') ? ckmode : kapplic)
buf[1]='O';
puts_queue(buf);
}
......@@ -952,12 +990,13 @@ static void star(int sc)
static void enter(int sc)
{
if (ke0 != 1)
do_self(sc);
else if (kapplic)
if (ke0 == 1 && kapplic)
applkey('M');
else
do_self(sc);
else {
put_queue(13);
if (lfnlmode)
put_queue(10);
}
}
static void minus(int sc)
......
......@@ -70,16 +70,13 @@ static void send_intr(unsigned line, unsigned port, struct tty_struct * tty)
#define TIMER ((SER1_TIMEOUT-1)+line)
timer_active &= ~(1 << TIMER);
if (!tty->stopped) {
do {
if ((c = GETCH(tty->write_q)) < 0)
return;
outb(c,port);
i++;
} while ( port_table[line] == PORT_16550A && \
i < 14 && !EMPTY(tty->write_q) && \
!tty->stopped);
}
} while ( port_table[line] == PORT_16550A &&
i < 14 && !EMPTY(tty->write_q));
timer_table[TIMER].expires = jiffies + 10;
timer_active |= 1 << TIMER;
if (LEFT(tty->write_q) > WAKEUP_CHARS)
......
......@@ -175,11 +175,13 @@ void copy_to_cooked(struct tty_struct * tty)
if ((INTR_CHAR(tty) != __DISABLED_CHAR) &&
(c==INTR_CHAR(tty))) {
kill_pg(tty->pgrp, SIGINT, 1);
flush_input(tty);
continue;
}
if ((QUIT_CHAR(tty) != __DISABLED_CHAR) &&
(c==QUIT_CHAR(tty))) {
kill_pg(tty->pgrp, SIGQUIT, 1);
flush_input(tty);
continue;
}
if ((SUSPEND_CHAR(tty) != __DISABLED_CHAR) &&
......
......@@ -42,7 +42,7 @@ static void change_speed(struct tty_struct * tty)
sti();
}
void flush(struct tty_queue * queue)
static void flush(struct tty_queue * queue)
{
if (queue) {
cli();
......@@ -52,6 +52,14 @@ void flush(struct tty_queue * queue)
}
}
void flush_input(struct tty_struct * tty)
{
flush(tty->read_q);
flush(tty->secondary);
tty->secondary->data = 0;
wake_up(&tty->read_q->proc_list);
}
static void wait_until_sent(struct tty_struct * tty)
{
while (!(current->signal & ~current->blocked) && !EMPTY(tty->write_q)) {
......@@ -250,8 +258,7 @@ int tty_ioctl(struct inode * inode, struct file * file,
case TCGETS:
return get_termios(tty,(struct termios *) arg);
case TCSETSF:
flush(tty->read_q);
flush(tty->secondary);
flush_input(tty);
if (other_tty)
flush(other_tty->write_q);
/* fallthrough */
......@@ -263,8 +270,7 @@ int tty_ioctl(struct inode * inode, struct file * file,
case TCGETA:
return get_termio(tty,(struct termio *) arg);
case TCSETAF:
flush(tty->read_q);
flush(tty->secondary);
flush_input(tty);
if (other_tty)
flush(other_tty->write_q);
/* fallthrough */
......@@ -299,15 +305,13 @@ int tty_ioctl(struct inode * inode, struct file * file,
return -EINVAL; /* not implemented */
case TCFLSH:
if (arg==0) {
flush(tty->read_q);
flush(tty->secondary);
flush_input(tty);
if (other_tty)
flush(other_tty->write_q);
} else if (arg==1)
flush(tty->write_q);
else if (arg==2) {
flush(tty->read_q);
flush(tty->secondary);
flush_input(tty);
flush(tty->write_q);
if (other_tty)
flush(other_tty->write_q);
......
......@@ -164,8 +164,7 @@ vt_ioctl(struct tty_struct *tty, int dev, int cmd, int arg)
}
else
return -EINVAL;
flush(tty->read_q);
flush(tty->secondary);
flush_input(tty);
return 0;
case KDGKBMODE:
verify_area((void *) arg, sizeof(unsigned long));
......
......@@ -23,7 +23,7 @@ CPP =cpp -nostdinc -I../../include
-c -o $*.o $<
OBJS = emulate.o error.o convert.o ea.o get_put.o \
add.o mul.o div.o compare.o
add.o mul.o div.o compare.o sqrt.o
math.a: $(OBJS)
$(AR) rcs math.a $(OBJS)
......@@ -42,44 +42,49 @@ dep:
### Dependencies:
add.s add.o : add.c ../../include/linux/math_emu.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/linux/kernel.h \
../../include/limits.h ../../include/sys/vfs.h ../../include/linux/mm.h ../../include/linux/kernel.h \
../../include/signal.h ../../include/sys/param.h ../../include/sys/time.h ../../include/time.h \
../../include/sys/resource.h
compare.s compare.o : compare.c ../../include/linux/math_emu.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/linux/kernel.h \
../../include/signal.h ../../include/sys/param.h ../../include/sys/time.h ../../include/time.h \
../../include/sys/resource.h
../../include/sys/dirent.h ../../include/limits.h ../../include/sys/vfs.h ../../include/linux/mm.h \
../../include/linux/kernel.h ../../include/signal.h ../../include/sys/param.h \
../../include/sys/time.h ../../include/time.h ../../include/sys/resource.h
convert.s convert.o : convert.c ../../include/linux/math_emu.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/linux/kernel.h \
../../include/signal.h ../../include/sys/param.h ../../include/sys/time.h ../../include/time.h \
../../include/sys/resource.h
../../include/sys/dirent.h ../../include/limits.h ../../include/sys/vfs.h ../../include/linux/mm.h \
../../include/linux/kernel.h ../../include/signal.h ../../include/sys/param.h \
../../include/sys/time.h ../../include/time.h ../../include/sys/resource.h
div.s div.o : div.c ../../include/linux/math_emu.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/linux/kernel.h \
../../include/limits.h ../../include/sys/vfs.h ../../include/linux/mm.h ../../include/linux/kernel.h \
../../include/signal.h ../../include/sys/param.h ../../include/sys/time.h ../../include/time.h \
../../include/sys/resource.h
ea.s ea.o : ea.c ../../include/stddef.h ../../include/linux/math_emu.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/linux/kernel.h \
../../include/signal.h ../../include/sys/param.h ../../include/sys/time.h ../../include/time.h \
../../include/sys/resource.h ../../include/asm/segment.h
../../include/sys/dirent.h ../../include/limits.h ../../include/sys/vfs.h ../../include/linux/mm.h \
../../include/linux/kernel.h ../../include/signal.h ../../include/sys/param.h \
../../include/sys/time.h ../../include/time.h ../../include/sys/resource.h ../../include/asm/segment.h
emulate.s emulate.o : emulate.c ../../include/signal.h ../../include/sys/types.h ../../include/linux/sched.h \
../../include/linux/head.h ../../include/linux/fs.h ../../include/sys/dirent.h \
../../include/limits.h ../../include/linux/mm.h ../../include/linux/kernel.h \
../../include/limits.h ../../include/sys/vfs.h ../../include/linux/mm.h ../../include/linux/kernel.h \
../../include/sys/param.h ../../include/sys/time.h ../../include/time.h ../../include/sys/resource.h
error.s error.o : error.c ../../include/signal.h ../../include/sys/types.h ../../include/linux/sched.h \
../../include/linux/head.h ../../include/linux/fs.h ../../include/sys/dirent.h \
../../include/limits.h ../../include/linux/mm.h ../../include/linux/kernel.h \
../../include/limits.h ../../include/sys/vfs.h ../../include/linux/mm.h ../../include/linux/kernel.h \
../../include/sys/param.h ../../include/sys/time.h ../../include/time.h ../../include/sys/resource.h
get_put.s get_put.o : get_put.c ../../include/signal.h ../../include/sys/types.h ../../include/linux/math_emu.h \
../../include/linux/sched.h ../../include/linux/head.h ../../include/linux/fs.h \
../../include/sys/dirent.h ../../include/limits.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
../../include/sys/dirent.h ../../include/limits.h ../../include/sys/vfs.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
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/sys/dirent.h \
../../include/limits.h ../../include/linux/mm.h ../../include/linux/kernel.h \
../../include/limits.h ../../include/sys/vfs.h ../../include/linux/mm.h ../../include/linux/kernel.h \
../../include/signal.h ../../include/sys/param.h ../../include/sys/time.h ../../include/time.h \
../../include/sys/resource.h
sqrt.s sqrt.o : sqrt.c ../../include/linux/math_emu.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/sys/vfs.h ../../include/linux/mm.h ../../include/linux/kernel.h \
../../include/signal.h ../../include/sys/param.h ../../include/sys/time.h ../../include/time.h \
../../include/sys/resource.h
......@@ -126,10 +126,14 @@ static void do_emu(struct info * info)
return;
case 0x1ef:
math_abort(info,1<<(SIGILL-1));
case 0x1fa:
fsqrt(PST(0),&tmp);
real_to_real(&tmp,&ST(0));
return;
case 0x1f0: case 0x1f1: case 0x1f2: case 0x1f3:
case 0x1f4: case 0x1f5: case 0x1f6: case 0x1f7:
case 0x1f8: case 0x1f9: case 0x1fa: case 0x1fb:
case 0x1fd: case 0x1fe: case 0x1ff:
case 0x1f8: case 0x1f9: case 0x1fb: case 0x1fd:
case 0x1fe: case 0x1ff:
printk("%04x fxxx not implemented\n\r",code + 0xd800);
math_abort(info,1<<(SIGILL-1));
case 0x1fc:
......
......@@ -11,6 +11,6 @@
void math_error(void)
{
if (last_task_used_math)
last_task_used_math->signal |= 1<<(SIGFPE-1);
send_sig(SIGFPE,last_task_used_math,1);
__asm__("fnclex");
}
/*
* linux/kernel/math/sqrt.c
*
* (C) 1991 Linus Torvalds
*/
/*
* simple and stupid temporary real fsqrt() routine
*
* There are probably better ways to do this, but this should work ok.
*/
#include <linux/math_emu.h>
#include <linux/sched.h>
static void shift_right(int * c)
{
__asm__("shrl $1,12(%0) ; rcrl $1,8(%0) ; rcrl $1,4(%0) ; rcrl $1,(%0)"
::"r" ((long) c));
}
static int sqr64(unsigned long * a, unsigned long * b)
{
unsigned long tmp[4];
__asm__("movl (%0),%%eax ; mull %%eax\n\t"
"movl %%eax,(%1) ; movl %%edx,4(%1)\n\t"
"movl 4(%0),%%eax ; mull %%eax\n\t"
"movl %%eax,8(%1) ; movl %%edx,12(%1)\n\t"
"movl (%0),%%eax ; mull 4(%0)\n\t"
"addl %%eax,%%eax ; adcl %%edx,%%edx\n\t"
"adcl $0,12(%1) ; addl %%eax,4(%1)\n\t"
"adcl %%edx,8(%1) ; adcl $0,12(%1)"
::"b" ((long) a),"c" ((long) tmp)
:"ax","bx","cx","dx");
if (tmp[3] > b[3] ||
(tmp[3] == b[3] && (tmp[2] > b[2] ||
(tmp[2] == b[2] && (tmp[1] > b[1] ||
(tmp[1] == b[1] && tmp[0] > b[0]))))))
return 0;
return 1;
}
void fsqrt(const temp_real * s, temp_real * d)
{
unsigned long src[4];
unsigned long res[2];
int exponent;
unsigned long mask, *c;
int i;
exponent = s->exponent;
src[0] = src[1] = 0;
src[2] = s->a;
src[3] = s->b;
d->exponent = 0;
d->a = d->b = 0;
if (exponent) /* fsqrt(0.0) = 0.0 */
return;
if (!src[2] && !src[3])
return;
if (exponent & 0x8000) {
send_sig(SIGFPE,current,0);
return;
}
if (exponent & 1) {
shift_right(src);
exponent++;
}
exponent >>= 1;
exponent += 0x1fff;
c = res + 2;
mask = 0;
for (i = 64 ; i > 0 ; i--) {
if (!(mask >>= 1)) {
c--;
mask = 0x80000000;
}
res[0] = d->a; res[1] = d->b;
*c |= mask;
if (sqr64(res,src)) {
d->a = res[0];
d->b = res[1];
}
}
if (!d->a && !d->b)
return;
while (!(d->b & 0x80000000)) {
__asm__("addl %%eax,%%eax ; adcl %%edx,%%edx"
:"=a" (d->a),"=d" (d->b)
:"0" (d->a),"1" (d->b));
exponent--;
}
d->exponent = exponent;
}
......@@ -94,7 +94,7 @@ int sys_signal(int signum, long handler, long restorer)
return -EINVAL;
tmp.sa_handler = (void (*)(int)) handler;
tmp.sa_mask = 0;
tmp.sa_flags = SA_ONESHOT | SA_NOMASK;
tmp.sa_flags = SA_ONESHOT | SA_NOMASK | SA_INTERRUPT;
tmp.sa_restorer = (void (*)(void)) restorer;
handler = (long) current->sigaction[signum-1].sa_handler;
current->sigaction[signum-1] = tmp;
......@@ -135,16 +135,17 @@ int do_signal(long signr,struct pt_regs * regs)
current->pid, signr, regs->eax, regs->orig_eax,
sa->sa_flags & SA_INTERRUPT);
#endif
sa_handler = (unsigned long) sa->sa_handler;
if ((regs->orig_eax != -1) &&
((regs->eax == -ERESTARTSYS) || (regs->eax == -ERESTARTNOINTR))) {
if ((regs->eax == -ERESTARTSYS) && ((sa->sa_flags & SA_INTERRUPT)))
if ((sa_handler > 1) && (regs->eax == -ERESTARTSYS) &&
(sa->sa_flags & SA_INTERRUPT))
regs->eax = -EINTR;
else {
regs->eax = regs->orig_eax;
regs->eip = old_eip -= 2;
}
}
sa_handler = (unsigned long) sa->sa_handler;
if (sa_handler==1) {
/* check for SIGCHLD: it's special */
if (signr == SIGCHLD)
......
......@@ -489,7 +489,7 @@ int sys_sethostname(char *name, int len)
if ((thisname.nodename[i] = get_fs_byte(name+i)) == 0)
return 0;
}
thisname.nodename[__NEW_UTS_LEN] = 0;
thisname.nodename[i] = 0;
return 0;
}
......
......@@ -40,35 +40,19 @@ dep:
cp tmp_make Makefile
### Dependencies:
_exit.s _exit.o : _exit.c ../include/unistd.h ../include/sys/stat.h ../include/sys/types.h \
../include/sys/time.h ../include/time.h ../include/sys/times.h ../include/sys/utsname.h \
../include/sys/param.h ../include/sys/resource.h ../include/utime.h ../include/linux/unistd.h
close.s close.o : close.c ../include/unistd.h ../include/sys/stat.h ../include/sys/types.h \
../include/sys/time.h ../include/time.h ../include/sys/times.h ../include/sys/utsname.h \
../include/sys/param.h ../include/sys/resource.h ../include/utime.h ../include/linux/unistd.h
_exit.s _exit.o : _exit.c ../include/linux/unistd.h
close.s close.o : close.c ../include/linux/unistd.h
ctype.s ctype.o : ctype.c ../include/linux/ctype.h
dup.s dup.o : dup.c ../include/unistd.h ../include/sys/stat.h ../include/sys/types.h \
../include/sys/time.h ../include/time.h ../include/sys/times.h ../include/sys/utsname.h \
../include/sys/param.h ../include/sys/resource.h ../include/utime.h ../include/linux/unistd.h
dup.s dup.o : dup.c ../include/linux/unistd.h
errno.s errno.o : errno.c
execve.s execve.o : execve.c ../include/unistd.h ../include/sys/stat.h ../include/sys/types.h \
../include/sys/time.h ../include/time.h ../include/sys/times.h ../include/sys/utsname.h \
../include/sys/param.h ../include/sys/resource.h ../include/utime.h ../include/linux/unistd.h
execve.s execve.o : execve.c ../include/linux/unistd.h
itimer.s itimer.o : itimer.c ../include/linux/unistd.h ../include/sys/time.h ../include/time.h \
../include/sys/types.h
malloc.s malloc.o : malloc.c ../include/linux/kernel.h ../include/linux/mm.h ../include/linux/fs.h \
../include/sys/types.h ../include/sys/dirent.h ../include/limits.h ../include/signal.h \
../include/asm/system.h
open.s open.o : open.c ../include/unistd.h ../include/sys/stat.h ../include/sys/types.h \
../include/sys/time.h ../include/time.h ../include/sys/times.h ../include/sys/utsname.h \
../include/sys/param.h ../include/sys/resource.h ../include/utime.h ../include/linux/unistd.h \
../include/stdarg.h
setsid.s setsid.o : setsid.c ../include/unistd.h ../include/sys/stat.h ../include/sys/types.h \
../include/sys/time.h ../include/time.h ../include/sys/times.h ../include/sys/utsname.h \
../include/sys/param.h ../include/sys/resource.h ../include/utime.h ../include/linux/unistd.h
../include/sys/types.h ../include/sys/dirent.h ../include/limits.h ../include/sys/vfs.h \
../include/signal.h ../include/asm/system.h
open.s open.o : open.c ../include/linux/unistd.h ../include/stdarg.h
setsid.s setsid.o : setsid.c ../include/sys/types.h ../include/linux/unistd.h
string.s string.o : string.c ../include/linux/string.h
wait.s wait.o : wait.c ../include/unistd.h ../include/sys/stat.h ../include/sys/types.h \
../include/sys/time.h ../include/time.h ../include/sys/times.h ../include/sys/utsname.h \
../include/sys/param.h ../include/sys/resource.h ../include/utime.h ../include/linux/unistd.h \
../include/sys/wait.h
write.s write.o : write.c ../include/unistd.h ../include/sys/stat.h ../include/sys/types.h \
../include/sys/time.h ../include/time.h ../include/sys/times.h ../include/sys/utsname.h \
../include/sys/param.h ../include/sys/resource.h ../include/utime.h ../include/linux/unistd.h
wait.s wait.o : wait.c ../include/linux/unistd.h ../include/sys/wait.h ../include/sys/types.h
write.s write.o : write.c ../include/linux/unistd.h ../include/sys/types.h
......@@ -39,15 +39,15 @@ dep:
### Dependencies:
memory.o : memory.c ../include/signal.h ../include/sys/types.h ../include/asm/system.h \
../include/linux/sched.h ../include/linux/head.h ../include/linux/fs.h ../include/sys/dirent.h \
../include/limits.h ../include/linux/mm.h ../include/linux/kernel.h ../include/sys/param.h \
../include/sys/time.h ../include/time.h ../include/sys/resource.h
mmap.o : mmap.c ../include/sys/stat.h ../include/sys/types.h ../include/linux/sched.h \
../include/linux/head.h ../include/linux/fs.h ../include/sys/dirent.h ../include/limits.h \
../include/linux/mm.h ../include/linux/kernel.h ../include/signal.h ../include/sys/param.h \
../include/sys/time.h ../include/time.h ../include/sys/resource.h ../include/asm/segment.h \
../include/asm/system.h ../include/errno.h ../include/sys/mman.h
swap.o : swap.c ../include/errno.h ../include/sys/stat.h ../include/sys/types.h \
../include/linux/mm.h ../include/linux/fs.h ../include/sys/dirent.h ../include/limits.h \
../include/linux/kernel.h ../include/signal.h ../include/linux/string.h ../include/linux/sched.h \
../include/linux/head.h ../include/sys/param.h ../include/sys/time.h ../include/time.h \
../include/sys/resource.h
../include/limits.h ../include/sys/vfs.h ../include/linux/mm.h ../include/linux/kernel.h \
../include/sys/param.h ../include/sys/time.h ../include/time.h ../include/sys/resource.h
mmap.o : mmap.c ../include/linux/stat.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/sys/vfs.h ../include/linux/mm.h ../include/linux/kernel.h ../include/signal.h \
../include/sys/param.h ../include/sys/time.h ../include/time.h ../include/sys/resource.h \
../include/asm/segment.h ../include/asm/system.h ../include/errno.h ../include/sys/mman.h
swap.o : swap.c ../include/errno.h ../include/linux/stat.h ../include/linux/mm.h \
../include/linux/fs.h ../include/sys/types.h ../include/sys/dirent.h ../include/limits.h \
../include/sys/vfs.h ../include/linux/kernel.h ../include/signal.h ../include/linux/string.h \
../include/linux/sched.h ../include/linux/head.h ../include/sys/param.h ../include/sys/time.h \
../include/time.h ../include/sys/resource.h
......@@ -565,7 +565,7 @@ static int share_page(struct inode * inode, unsigned long address)
struct task_struct ** p;
int i;
if (inode->i_count < 2 || !inode)
if (!inode || inode->i_count < 2)
return 0;
for (p = &LAST_TASK ; p > &FIRST_TASK ; --p) {
if (!*p)
......
......@@ -39,13 +39,14 @@ dep:
### Dependencies:
socket.o : socket.c ../include/signal.h ../include/sys/types.h ../include/errno.h \
../include/linux/sched.h ../include/linux/head.h ../include/linux/fs.h ../include/sys/dirent.h \
../include/limits.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/system.h \
../include/asm/segment.h ../include/sys/socket.h ../include/sys/stat.h ../include/fcntl.h \
../include/termios.h kern_sock.h socketcall.h
../include/limits.h ../include/sys/vfs.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/linux/stat.h ../include/asm/system.h ../include/asm/segment.h ../include/sys/socket.h \
../include/fcntl.h ../include/termios.h kern_sock.h socketcall.h
unix.o : unix.c ../include/signal.h ../include/sys/types.h ../include/errno.h \
../include/linux/string.h ../include/linux/sched.h ../include/linux/head.h ../include/linux/fs.h \
../include/sys/dirent.h ../include/limits.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/system.h ../include/asm/segment.h ../include/sys/socket.h ../include/sys/un.h \
../include/sys/stat.h ../include/fcntl.h ../include/termios.h kern_sock.h
../include/sys/dirent.h ../include/limits.h ../include/sys/vfs.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/linux/stat.h ../include/asm/system.h ../include/asm/segment.h \
../include/sys/socket.h ../include/sys/un.h ../include/fcntl.h ../include/termios.h \
kern_sock.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