Commit 15b49594 authored by Linus Torvalds's avatar Linus Torvalds

Import 1.1.45

parent 2b130d1b
VERSION = 1
PATCHLEVEL = 1
SUBLEVEL = 44
SUBLEVEL = 45
ARCH = i386
all: Version zImage
......@@ -26,10 +28,6 @@ else
CONFIGURATION = config
endif
ifdef CONFIGURATION
CONFIGURE = dummy
endif
#
# ROOT_DEV specifies the default root-device when making the image.
# This can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case
......@@ -63,12 +61,6 @@ ifdef CONFIG_CPP
CFLAGS := $(CFLAGS) -x c++
endif
ifdef CONFIG_M486
CFLAGS := $(CFLAGS) -m486
else
CFLAGS := $(CFLAGS) -m386
endif
#
# if you want the ram-disk device, define this to be the
# size in blocks.
......@@ -76,30 +68,10 @@ endif
#RAMDISK = -DRAMDISK=512
AS86 =as86 -0 -a
LD86 =ld86 -0
#
# Set these to indicate how to link it..
#
# -zmagic:
# Include the make variables (CC, etc...)
#
#LOWLDFLAGS = -Ttext 0x1000
#HIGHLDFLAGS = -Ttext 0x100000
#
# -qmagic (we need to remove the 32 byte header for bootup purposes)
#
LOWLDFLAGS =-qmagic -Ttext 0xfe0
HIGHLDFLAGS =-qmagic -Ttext 0xfffe0
AS =as
LD =ld
HOSTCC =gcc
CC =gcc -D__KERNEL__ -I$(TOPDIR)/include
MAKE =make
CPP =$(CC) -E
AR =ar
STRIP =strip
include arch/$(ARCH)/Makefile
ARCHIVES =kernel/kernel.o mm/mm.o fs/fs.o net/net.o ipc/ipc.o
FILESYSTEMS =fs/filesystems.a
......@@ -110,8 +82,6 @@ DRIVERS =drivers/block/block.a \
LIBS =lib/lib.a
SUBDIRS =kernel drivers mm fs net ipc ibcs lib
KERNELHDRS =/usr/src/linux/include
ifdef CONFIG_SCSI
DRIVERS := $(DRIVERS) drivers/scsi/scsi.a
endif
......@@ -134,10 +104,21 @@ endif
Version: dummy
rm -f tools/version.h
oldconfig:
boot:
ln -sf arch/$(ARCH)/boot boot
include/asm:
( cd include ; ln -sf asm-$(ARCH) asm)
symlinks: boot include/asm
config.in: arch/$(ARCH)/config.in
cp $< $@
oldconfig: symlinks config.in
$(CONFIG_SHELL) Configure -d $(OPTS)
config:
config: symlinks config.in
$(CONFIG_SHELL) Configure $(OPTS)
linuxsubdirs: dummy
......@@ -168,61 +149,6 @@ tools/version.o: tools/version.c tools/version.h
init/main.o: $(CONFIGURE) init/main.c
$(CC) $(CFLAGS) $(PROFILING) -c -o $*.o $<
tools/system: boot/head.o init/main.o tools/version.o linuxsubdirs
$(LD) $(LOWLDFLAGS) boot/head.o init/main.o tools/version.o \
$(ARCHIVES) \
$(FILESYSTEMS) \
$(DRIVERS) \
$(LIBS) \
-o tools/system
nm tools/zSystem | grep -v '\(compiled\)\|\(\.o$$\)\|\( a \)' | \
sort > System.map
boot/setup: boot/setup.o
$(LD86) -s -o $@ $<
boot/setup.o: boot/setup.s
$(AS86) -o $@ $<
boot/setup.s: boot/setup.S $(CONFIGURE) include/linux/config.h Makefile
$(CPP) -traditional $(SVGA_MODE) $(RAMDISK) $< -o $@
boot/bootsect: boot/bootsect.o
$(LD86) -s -o $@ $<
boot/bootsect.o: boot/bootsect.s
$(AS86) -o $@ $<
boot/bootsect.s: boot/bootsect.S $(CONFIGURE) include/linux/config.h Makefile
$(CPP) -traditional $(SVGA_MODE) $(RAMDISK) $< -o $@
zBoot/zSystem: zBoot/*.c zBoot/*.S tools/zSystem
$(MAKE) -C zBoot
zImage: $(CONFIGURE) boot/bootsect boot/setup zBoot/zSystem tools/build
tools/build boot/bootsect boot/setup zBoot/zSystem $(ROOT_DEV) > zImage
sync
zdisk: zImage
dd bs=8192 if=zImage of=/dev/fd0
zlilo: $(CONFIGURE) zImage
if [ -f $(INSTALL_PATH)/vmlinuz ]; then mv $(INSTALL_PATH)/vmlinuz $(INSTALL_PATH)/vmlinuz.old; fi
if [ -f $(INSTALL_PATH)/zSystem.map ]; then mv $(INSTALL_PATH)/zSystem.map $(INSTALL_PATH)/zSystem.old; fi
cat zImage > $(INSTALL_PATH)/vmlinuz
cp zSystem.map $(INSTALL_PATH)/
if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi
tools/zSystem: boot/head.o init/main.o tools/version.o linuxsubdirs
$(LD) $(HIGHLDFLAGS) boot/head.o init/main.o tools/version.o \
$(ARCHIVES) \
$(FILESYSTEMS) \
$(DRIVERS) \
$(LIBS) \
-o tools/zSystem
nm tools/zSystem | grep -v '\(compiled\)\|\(\.o$$\)\|\( a \)' | \
sort > zSystem.map
fs: dummy
$(MAKE) linuxsubdirs SUBDIRS=fs
......@@ -244,20 +170,20 @@ drivers: dummy
net: dummy
$(MAKE) linuxsubdirs SUBDIRS=net
clean:
clean: archclean
rm -f kernel/ksyms.lst
rm -f core `find . -name '*.[oas]' -print`
rm -f core `find . -name 'core' -print`
rm -f zImage zSystem.map tools/zSystem tools/system
rm -f Image System.map boot/bootsect boot/setup
rm -f Image System.map tools/build
rm -f zBoot/zSystem zBoot/xtract zBoot/piggyback
rm -f .tmp* drivers/sound/configure
rm -f init/*.o tools/build boot/*.o tools/*.o
mrproper: clean
rm -f include/linux/autoconf.h tools/version.h
rm -f drivers/sound/local.h
rm -f .version .config* config.old
rm -f .version .config* config.in config.old
rm -f boot include/asm
rm -f .depend `find . -name .depend -print`
distclean: mrproper
......@@ -296,13 +222,6 @@ endif
#
# Leave these dummy entries for now to tell people that they are going away..
#
lilo:
@echo
@echo Uncompressed kernel images no longer supported. Use
@echo \"make zlilo\" instead.
@echo
@exit 1
Image:
@echo
@echo Uncompressed kernel images no longer supported. Use
......
#
# i386/Makefile
#
# This file is subject to the terms and conditions of the GNU General Public
# License. See the file "COPYING" in the main directory of this archive
# for more details.
#
# Copyright (C) 1994 by Linus Torvalds
#
AS86 =as86 -0 -a
LD86 =ld86 -0
AS =as
LD =ld
HOSTCC =gcc
CC =gcc -D__KERNEL__ -I$(TOPDIR)/include
MAKE =make
CPP =$(CC) -E
AR =ar
STRIP =strip
ifdef CONFIG_M486
CFLAGS := $(CFLAGS) -m486
else
CFLAGS := $(CFLAGS) -m386
endif
zBoot/zSystem: zBoot/*.c zBoot/*.S tools/zSystem
$(MAKE) -C zBoot
zImage: $(CONFIGURE) boot/bootsect boot/setup zBoot/zSystem tools/build
tools/build boot/bootsect boot/setup zBoot/zSystem $(ROOT_DEV) > zImage
sync
zdisk: zImage
dd bs=8192 if=zImage of=/dev/fd0
zlilo: $(CONFIGURE) zImage
if [ -f $(INSTALL_PATH)/vmlinuz ]; then mv $(INSTALL_PATH)/vmlinuz $(INSTALL_PATH)/vmlinuz.old; fi
if [ -f $(INSTALL_PATH)/zSystem.map ]; then mv $(INSTALL_PATH)/zSystem.map $(INSTALL_PATH)/zSystem.old; fi
cat zImage > $(INSTALL_PATH)/vmlinuz
cat zImage > $(INSTALL_PATH)/vmlinuz
cp zSystem.map $(INSTALL_PATH)/
if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi
#
# Set these to indicate how to link it..
#
# -zmagic:
#
#LOWLDFLAGS = -Ttext 0x1000
#HIGHLDFLAGS = -Ttext 0x100000
#
# -qmagic (we need to remove the 32 byte header for bootup purposes)
#
LOWLDFLAGS =-qmagic -Ttext 0xfe0
HIGHLDFLAGS =-qmagic -Ttext 0xfffe0
tools/system: boot/head.o init/main.o tools/version.o linuxsubdirs
$(LD) $(LOWLDFLAGS) boot/head.o init/main.o tools/version.o \
$(ARCHIVES) \
$(FILESYSTEMS) \
$(DRIVERS) \
$(LIBS) \
-o tools/system
nm tools/zSystem | grep -v '\(compiled\)\|\(\.o$$\)\|\( a \)' | \
sort > System.map
boot/setup: boot/setup.o
$(LD86) -s -o $@ $<
boot/setup.o: boot/setup.s
$(AS86) -o $@ $<
boot/setup.s: boot/setup.S $(CONFIGURE) include/linux/config.h Makefile
$(CPP) -traditional $(SVGA_MODE) $(RAMDISK) $< -o $@
boot/bootsect: boot/bootsect.o
$(LD86) -s -o $@ $<
boot/bootsect.o: boot/bootsect.s
$(AS86) -o $@ $<
boot/bootsect.s: boot/bootsect.S $(CONFIGURE) include/linux/config.h Makefile
$(CPP) -traditional $(SVGA_MODE) $(RAMDISK) $< -o $@
tools/zSystem: boot/head.o init/main.o tools/version.o linuxsubdirs
$(LD) $(HIGHLDFLAGS) boot/head.o init/main.o tools/version.o \
$(ARCHIVES) \
$(FILESYSTEMS) \
$(DRIVERS) \
$(LIBS) \
-o tools/zSystem
nm tools/zSystem | grep -v '\(compiled\)\|\(\.o$$\)\|\( a \)' | \
sort > zSystem.map
#
# Leave these dummy entries for now to tell people that they are going away..
#
lilo:
@echo
@echo Uncompressed kernel images no longer supported. Use
@echo \"make zlilo\" instead.
@echo
@exit 1
archclean:
rm -f boot/bootsect boot/setup
......@@ -984,7 +984,7 @@ dsccandt: .word 0x5032, 0x501c, 0x8419, 0x8432
dsccirrus: .word 0x5032, 0x501c, 0x8419, 0x842c, 0x841e, 0x6425
dsceverex: .word 0x5032, 0x501c, 0x5022, 0x503c, 0x642b, 0x644b, 0x8419, 0x842c, 0x501e, 0x641b, 0xa040, 0x841e
dscgenoa: .word 0x5032, 0x501c, 0x5020, 0x642a, 0x8419, 0x841d, 0x8420, 0x842c, 0x843c, 0x503c, 0x5042, 0x644b
dscparadise: .word 0x5032, 0x501c, 0x8419, 0x842b
dscparadise: .word 0x5032, 0x501c, 0x8419, 0x842c
dsctrident: .word 0x5032, 0x501c, 0x501e, 0x502b, 0x503c, 0x8419, 0x841e, 0x842b, 0x843c
dsctseng: .word 0x5032, 0x501c, 0x503c, 0x6428, 0x8419, 0x841c, 0x842c
dscvideo7: .word 0x5032, 0x501c, 0x502b, 0x503c, 0x643c, 0x8419, 0x842c, 0x841c
......
.file "poly_div.S"
/*---------------------------------------------------------------------------+
| poly_div.S |
| |
| A set of functions to divide 64 bit integers by fixed numbers. |
| |
| Copyright (C) 1992 W. Metzenthen, 22 Parker St, Ormond, Vic 3163, |
| Australia. E-mail billm@vaxc.cc.monash.edu.au |
| |
| Call from C as: |
| void poly_div2(unsigned long long *x) |
| void poly_div4(unsigned long long *x) |
| void poly_div16(unsigned long long *x) |
| |
+---------------------------------------------------------------------------*/
#include "fpu_asm.h"
.text
/*---------------------------------------------------------------------------*/
.align 2,144
.globl _poly_div2
_poly_div2:
pushl %ebp
movl %esp,%ebp
movl PARAM1,%ecx
movw (%ecx),%ax
shrl $1,4(%ecx)
rcrl $1,(%ecx)
testw $1,%ax
je poly_div2_exit
addl $1,(%ecx)
adcl $0,4(%ecx)
poly_div2_exit:
leave
ret
/*---------------------------------------------------------------------------*/
.align 2,144
.globl _poly_div4
_poly_div4:
pushl %ebp
movl %esp,%ebp
movl PARAM1,%ecx
movw (%ecx),%ax
movl 4(%ecx),%edx
shll $30,%edx
shrl $2,4(%ecx)
shrl $2,(%ecx)
orl %edx,(%ecx)
testw $2,%ax
je poly_div4_exit
addl $1,(%ecx)
adcl $0,4(%ecx)
poly_div4_exit:
leave
ret
/*---------------------------------------------------------------------------*/
.align 2,144
.globl _poly_div16
_poly_div16:
pushl %ebp
movl %esp,%ebp
movl PARAM1,%ecx
movw (%ecx),%ax
movl 4(%ecx),%edx
shll $28,%edx
shrl $4,4(%ecx)
shrl $4,(%ecx)
orl %edx,(%ecx)
testw $8,%ax
je poly_div16_exit
addl $1,(%ecx)
adcl $0,4(%ecx)
poly_div16_exit:
leave
ret
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------+
| poly_mul64.S |
| |
| Multiply two 64 bit integers. |
| |
| Copyright (C) 1992 W. Metzenthen, 22 Parker St, Ormond, Vic 3163, |
| Australia. E-mail billm@vaxc.cc.monash.edu.au |
| |
| Call from C as: |
| void mul64(long long *a, long long *b, long long *result) |
| |
+---------------------------------------------------------------------------*/
#include "fpu_asm.h"
.text
.align 2,144
.globl _mul64
_mul64:
pushl %ebp
movl %esp,%ebp
subl $16,%esp
pushl %esi
pushl %ebx
movl PARAM1,%esi
movl PARAM2,%ecx
movl PARAM3,%ebx
xor %eax,%eax
movl %eax,-4(%ebp)
movl %eax,-8(%ebp)
movl (%esi),%eax
mull (%ecx)
movl %eax,-16(%ebp) /* Not used */
movl %edx,-12(%ebp)
movl (%esi),%eax
mull 4(%ecx)
addl %eax,-12(%ebp)
adcl %edx,-8(%ebp)
adcl $0,-4(%ebp)
movl 4(%esi),%eax
mull (%ecx)
addl %eax,-12(%ebp)
adcl %edx,-8(%ebp)
adcl $0,-4(%ebp)
movl 4(%esi),%eax
mull 4(%ecx)
addl %eax,-8(%ebp)
adcl %edx,-4(%ebp)
testb $128,-9(%ebp)
je L_no_round
addl $1,-8(%ebp)
adcl $0,-4(%ebp)
L_no_round:
movl -8(%ebp),%esi
movl %esi,(%ebx)
movl -4(%ebp),%esi
movl %esi,4(%ebx)
popl %ebx
popl %esi
leave
ret
/*---------------------------------------------------------------------------+
| polynomial.S |
| |
| Fixed point arithmetic polynomial evaluation. |
| |
| Copyright (C) 1992,1993 |
| W. Metzenthen, 22 Parker St, Ormond, Vic 3163, |
| Australia. E-mail billm@vaxc.cc.monash.edu.au |
| |
| Call from C as: |
| void polynomial(unsigned accum[], unsigned x[], unsigned terms[][2], |
| int n) |
| |
| Computes: |
| terms[0] + (terms[1] + (terms[2] + ... + (terms[n-1]*x)*x)*x)*x) ... )*x |
| The result is returned in accum. |
| |
+---------------------------------------------------------------------------*/
.file "fpolynom.s"
#include "fpu_asm.h"
/* #define EXTRA_PRECISE // Do not use: not complete */
#define TERM_SIZE $8
#define SUM_MS -20(%ebp) /* sum ms long */
#define SUM_MIDDLE -24(%ebp) /* sum middle long */
#define SUM_LS -28(%ebp) /* sum ls long */
#define SUM_LS_HI -25(%ebp) /* high byte of sum ls */
#define ACCUM_MS -4(%ebp) /* accum ms long */
#define ACCUM_MIDDLE -8(%ebp) /* accum middle long */
#define ACCUM_LS -12(%ebp) /* accum ls long */
#define ACCUM_LS_HI -9(%ebp) /* high byte of accum ls */
.text
.align 2,144
.globl _polynomial
_polynomial:
pushl %ebp
movl %esp,%ebp
subl $32,%esp
pushl %esi
pushl %edi
pushl %ebx
movl PARAM2,%esi /* x */
movl PARAM3,%edi /* terms */
movl TERM_SIZE,%eax
mull PARAM4 /* n */
addl %eax,%edi
movl 4(%edi),%edx /* terms[n] */
movl %edx,SUM_MS
movl (%edi),%edx /* terms[n] */
movl %edx,SUM_MIDDLE
xor %eax,%eax
movl %eax,SUM_LS
subl TERM_SIZE,%edi
decl PARAM4
js L_accum_done
L_accum_loop:
xor %eax,%eax
movl %eax,ACCUM_MS
movl %eax,ACCUM_MIDDLE
movl SUM_MIDDLE,%eax
mull (%esi) /* x ls long */
/* movl %eax,-16(%ebp) // Not needed */
movl %edx,ACCUM_LS
movl SUM_MIDDLE,%eax
mull 4(%esi) /* x ms long */
addl %eax,ACCUM_LS
adcl %edx,ACCUM_MIDDLE
adcl $0,ACCUM_MS
movl SUM_MS,%eax
mull (%esi) /* x ls long */
addl %eax,ACCUM_LS
adcl %edx,ACCUM_MIDDLE
adcl $0,ACCUM_MS
movl SUM_MS,%eax
mull 4(%esi) /* x ms long */
addl %eax,ACCUM_MIDDLE
adcl %edx,ACCUM_MS
/*
* Now put the sum of next term and the accumulator
* into the sum register
*/
movl ACCUM_MIDDLE,%eax
addl (%edi),%eax /* term ls long */
movl %eax,SUM_MIDDLE
movl ACCUM_MS,%eax
adcl 4(%edi),%eax /* term ms long */
movl %eax,SUM_MS
#ifdef EXTRA_PRECISE
movl ACCUM_LS,%eax
movl %eax,SUM_LS
#else
testb $0x80,ACCUM_LS_HI /* ms bit of ACCUM_LS */
je L_no_poly_round
addl $1,SUM_MIDDLE
adcl $0,SUM_MS
L_no_poly_round:
#endif EXTRA_PRECISE
subl TERM_SIZE,%edi
decl PARAM4
jns L_accum_loop
L_accum_done:
#ifdef EXTRA_PRECISE
/* Round the result */
testb $128,SUM_LS_HI
je L_poly_done
addl $1,SUM_MIDDLE
adcl $0,SUM_MS
#endif EXTRA_PRECISE
L_poly_done:
movl PARAM1,%edi /* accum */
movl SUM_MIDDLE,%eax
movl %eax,(%edi)
movl SUM_MS,%eax
movl %eax,4(%edi)
popl %ebx
popl %edi
popl %esi
leave
ret
......@@ -10,8 +10,8 @@
#define SANITY
/* Undefine the following if you have to floppy disk controllers:
* This is untested. If you get two controllers working, with drives attached
* too both, please mail me: Alain.Knaff@imag.fr */
* This works at least for me; if you get two controllers working, with
* drives attached to both, please mail me: Alain.Knaff@imag.fr */
/* #define HAVE_2_CONTROLLERS */
/* Undefine the following if you have problems accessing ED disks, but don't
......@@ -226,19 +226,19 @@ static struct {
0, { 1, 0, 0, 0, 0, 0, 0, 0}, 150, 1 }, "360K PC" }, /*5 1/4 360 KB PC*/
{{2, 500, 16, 16, 6000, 40, 300, 14, 2, 6, 83, 3*HZ, 17, {3,1,2,0,2}, 0,
0, { 2, 5,18,31,11,11, 0, 0}, 150, 2 }, "1.2M" }, /*5 1/4 HD AT*/
0, { 2, 5, 6,23,10,20,11, 0}, 150, 2 }, "1.2M" }, /*5 1/4 HD AT*/
{{3, 250, 16, 16, 3000, 100, 300, 0, 2, 5, 83, 3*HZ, 20, {3,1,2,0,2}, 0,
0, { 4,14,13,10, 0, 0, 0, 0}, 150, 4 }, "720k" }, /*3 1/2 DD*/
0, { 4,22,21,30, 3, 0, 0, 0}, 150, 4 }, "720k" }, /*3 1/2 DD*/
{{4, 500, 16, 16, 3000, 40, 300, 10, 2, 5, 83, 3*HZ, 20, {3,1,2,0,2}, 0,
0, { 7, 4,24,14,20,13,23,21}, 150, 7 }, "1.44M" }, /*3 1/2 HD*/
0, { 7, 4,25,22,31,21,29,11}, 150, 7 }, "1.44M" }, /*3 1/2 HD*/
{{5, 1000, 15, 8, 3000, 40, 300, 10, 2, 5, 83, 3*HZ, 40, {3,1,2,0,2}, 0,
0, { 7, 8, 4,24,27,14,20,13}, 150, 8 }, "2.88M AMI BIOS" }, /*3 1/2 ED*/
0, { 7, 8, 4,25,28,22,31,21}, 150, 8 }, "2.88M AMI BIOS" }, /*3 1/2 ED*/
{{6, 1000, 15, 8, 3000, 40, 300, 10, 2, 5, 83, 3*HZ, 40, {3,1,2,0,2}, 0,
0, { 7, 8, 4,24,27,14,20,13}, 150, 8 }, "2.88M" } /*3 1/2 ED*/
0, { 7, 8, 4,25,28,22,31,21}, 150, 8 }, "2.88M" } /*3 1/2 ED*/
/* | ---autodetected formats-- | | |
read_track | | Name printed when booting
| Native format
......@@ -258,18 +258,18 @@ static struct floppy_raw_cmd raw_cmd;
*/
static struct floppy_struct floppy_type[32] = {
{ 0, 0,0, 0,0,0x00,0x00,0x00,0x00,NULL }, /* 0 no testing */
{ 720, 9,2,40,0,0x2A,0x02,0xDF,0x50,"d360" }, /* 1 360kB PC/QD */
{ 2400,15,2,80,0,0x1B,0x00,0xDF,0x54,"h1200" }, /* 2 *1.2 MB AT */
{ 720, 9,1,80,0,0x2A,0x02,0xDF,0x50,"D360" }, /* 3 360kB SS 3.5" */
{ 720, 9,2,40,0,0x2A,0x02,0xDF,0x50,"d360" }, /* 1 360KB PC */
{ 2400,15,2,80,0,0x1B,0x00,0xDF,0x54,"h1200" }, /* 2 1.2MB AT */
{ 720, 9,1,80,0,0x2A,0x02,0xDF,0x50,"D360" }, /* 3 360KB SS 3.5" */
{ 1440, 9,2,80,0,0x2A,0x02,0xDF,0x50,"D720" }, /* 4 720KB 3.5" */
{ 720, 9,2,40,1,0x23,0x01,0xDF,0x50,"h360" }, /* 5 *360kB AT */
{ 1440, 9,2,80,0,0x23,0x01,0xDF,0x50,"h720" }, /* 6 720kB AT */
{ 2880,18,2,80,0,0x1B,0x00,0xCF,0x6C,"H1440" }, /* 7 *1.44MB 3.5" */
{ 5760,36,2,80,0,0x1B,0x43,0xAF,0x54,"E2880" }, /* 8 *2.88MB 3.5" */
{ 720, 9,2,40,1,0x23,0x01,0xDF,0x50,"h360" }, /* 5 360KB AT */
{ 1440, 9,2,80,0,0x23,0x01,0xDF,0x50,"h720" }, /* 6 720KB AT */
{ 2880,18,2,80,0,0x1B,0x00,0xCF,0x6C,"H1440" }, /* 7 1.44MB 3.5" */
{ 5760,36,2,80,0,0x1B,0x43,0xAF,0x54,"E2880" }, /* 8 2.88MB 3.5" */
{ 5760,36,2,80,0,0x1B,0x43,0xAF,0x54,"CompaQ"}, /* 9 2.88MB 3.5" */
{ 2880,18,2,80,0,0x25,0x00,0xDF,0x02,"h1440" }, /* 10 *1.44MB 5.25" */
{ 3360,21,2,80,0,0x1c,0x00,0xcf,0x6c,"H1680" }, /* 11 *1.68MB 3.5" */
{ 2880,18,2,80,0,0x25,0x00,0xDF,0x02,"h1440" }, /* 10 1.44MB 5.25" */
{ 3360,21,2,80,0,0x1C,0x00,0xCF,0x6C,"H1680" }, /* 11 1.68MB 3.5" */
{ 820,10,2,41,1,0x25,0x01,0xDF,0x2E,"h410" }, /* 12 410KB 5.25" */
{ 1640,10,2,82,0,0x25,0x02,0xDF,0x2E,"H820" }, /* 13 820KB 3.5" */
{ 2952,18,2,82,0,0x25,0x00,0xDF,0x02,"h1476" }, /* 14 1.48MB 5.25" */
......@@ -279,19 +279,19 @@ static struct floppy_struct floppy_type[32] = {
{ 2988,18,2,83,0,0x25,0x00,0xDF,0x02,"h1494" }, /* 18 1.49MB 5.25" */
{ 3486,21,2,83,0,0x25,0x00,0xDF,0x0C,"H1743" }, /* 19 1.74 MB 3.5" */
{ 1760,11,2,80,0,0x1c,0x09,0xcf,0x6c,"d880" }, /* 20 880k 5.25" */
{ 2080,13,2,80,0,0x1c,0x0a,0xcf,0x6c,"D1040" }, /* 21 1.04MB 3.5" */
{ 2240,14,2,80,0,0x1c,0x1a,0xcf,0x6c,"D1120" }, /* 22 *1.12MB 3.5" */
{ 3200,20,2,80,0,0x1c,0x20,0xcf,0x6c,"h1600" }, /* 23 1.6MB 5.25" */
{ 3520,22,2,80,0,0x1c,0x08,0xcf,0x6c,"H1760" }, /* 24 1.76MB 3.5" */
{ 3840,24,2,80,0,0x1c,0x18,0xcf,0x6c,"H1920" }, /* 25 *1.92MB 3.5" */
{ 6400,40,2,80,0,0x25,0x5b,0xcf,0x6c,"E3200" }, /* 26 3.20MB 3.5" */
{ 7040,44,2,80,0,0x25,0x5b,0xcf,0x6c,"E3520" }, /* 27 3.52MB 3.5" */
{ 7680,48,2,80,0,0x25,0x63,0xcf,0x6c,"E3840" }, /* 28 *3.84MB 3.5" */
{ 3680,23,2,80,0,0x1c,0x10,0xcf,0x6c,"H1840" }, /* 29 1.84MB 3.5" */
{ 1600,10,2,80,0,0x25,0x02,0xDF,0x2E,"H800" }, /* 30 *800k 3.5" */
{ 3200,20,2,80,0,0x1c,0x00,0xcf,0x6c,"H1600" }, /* 31 *1.6MB 3.5" */
{ 1760,11,2,80,0,0x1C,0x09,0xCF,0x6C,"d880" }, /* 20 880KB 5.25" */
{ 2080,13,2,80,0,0x1C,0x0A,0xCF,0x6C,"D1040" }, /* 21 1.04MB 3.5" */
{ 2240,14,2,80,0,0x1C,0x1A,0xCF,0x6C,"D1120" }, /* 22 1.12MB 3.5" */
{ 3200,20,2,80,0,0x1C,0x20,0xCF,0x6C,"h1600" }, /* 23 1.6MB 5.25" */
{ 3520,22,2,80,0,0x1C,0x08,0xCF,0x6C,"H1760" }, /* 24 1.76MB 3.5" */
{ 3840,24,2,80,0,0x1C,0x18,0xCF,0x6C,"H1920" }, /* 25 1.92MB 3.5" */
{ 6400,40,2,80,0,0x25,0x5B,0xCF,0x6C,"E3200" }, /* 26 3.20MB 3.5" */
{ 7040,44,2,80,0,0x25,0x5B,0xCF,0x6C,"E3520" }, /* 27 3.52MB 3.5" */
{ 7680,48,2,80,0,0x25,0x63,0xCF,0x6C,"E3840" }, /* 28 3.84MB 3.5" */
{ 3680,23,2,80,0,0x1C,0x10,0xCF,0x6C,"H1840" }, /* 29 1.84MB 3.5" */
{ 1600,10,2,80,0,0x25,0x02,0xDF,0x2E,"H800" }, /* 30 800KB 3.5" */
{ 3200,20,2,80,0,0x1C,0x00,0xCF,0x6C,"H1600" }, /* 31 1.6MB 3.5" */
};
#define NUMBER(x) (sizeof(x) / sizeof(*(x)))
......@@ -2920,7 +2920,9 @@ void floppy_init(void)
config_types();
fdc_state[0].address = 0x3f0;
#if N_FDC > 1
fdc_state[1].address = 0x370;
#endif
for(fdc = 0 ; fdc < N_FDC; fdc++){
FDCS->dtr = -1;
FDCS->dor = 0;
......
......@@ -1018,7 +1018,7 @@ static void shutdown(struct async_struct * info)
!IRQ_ports[info->irq]->next_port)) {
if (IRQ_ports[info->irq]) {
free_irq(info->irq);
retval = request_irq(info->irq, rs_interrupt_single, 0, "serial");
retval = request_irq(info->irq, rs_interrupt_single, SA_INTERRUPT, "serial");
if (retval)
printk("serial shutdown: request_irq: error %d"
......
/*
* linux/fs/ext2/dcache.c
*
* Copyright (C) 1992, 1993, 1994 Remy Card (card@masi.ibp.fr)
* Laboratoire MASI - Institut Blaise Pascal
* Universite Pierre et Marie Curie (Paris VI)
*
*/
/*
* dcache.c contains the code that handles the directory cache used by
* lookup() and readdir()
*/
#include <asm/segment.h>
#include <linux/fs.h>
#include <linux/ext2_fs.h>
#include <linux/string.h>
#ifndef DONT_USE_DCACHE
#define DCACHE_NAME_LEN 32
struct dir_cache_entry {
unsigned short dev;
unsigned long dir;
unsigned long ino;
char name[DCACHE_NAME_LEN + 1];
int len;
struct dir_cache_entry * queue_prev;
struct dir_cache_entry * queue_next;
struct dir_cache_entry * prev;
struct dir_cache_entry * next;
};
static struct dir_cache_entry * first = NULL;
static struct dir_cache_entry * last = NULL;
static struct dir_cache_entry * first_free = NULL;
static int cache_initialized = 0;
#ifdef EXT2FS_DEBUG_CACHE
static int hits = 0;
static int misses = 0;
#endif
#define CACHE_SIZE 128
static struct dir_cache_entry dcache[CACHE_SIZE];
#define HASH_QUEUES 16
static struct dir_cache_entry * queue_head[HASH_QUEUES];
static struct dir_cache_entry * queue_tail[HASH_QUEUES];
#define hash(dev,dir) ((dev ^ dir) % HASH_QUEUES)
/*
* Initialize the cache
*/
static void init_cache (void)
{
int i;
dcache[0].prev = NULL;
dcache[0].next = &dcache[1];
dcache[0].queue_next = dcache[0].queue_prev = NULL;
for (i = 1; i < CACHE_SIZE - 1; i++) {
dcache[i].prev = &dcache[i - 1];
dcache[i].next = &dcache[i + 1];
dcache[i].queue_next = dcache[i].queue_prev = NULL;
}
dcache[i].prev = &dcache[i - 1];
dcache[i].next = NULL;
dcache[i].queue_next = dcache[i].queue_prev = NULL;
first_free = &dcache[0];
for (i = 0; i < HASH_QUEUES; i++)
queue_tail[i] = queue_head[i] = NULL;
cache_initialized = 1;
}
/*
* Find a name in the cache
*/
static struct dir_cache_entry * find_name (int queue, unsigned short dev,
unsigned long dir,
const char * name, int len)
{
struct dir_cache_entry * p;
for (p = queue_head[queue]; p != NULL && (p->dev != dev ||
p->dir != dir || p->len != len ||
strncmp (name, p->name, p->len) != 0);
p = p->queue_next)
;
return p;
}
#ifdef EXT2FS_DEBUG_CACHE
/*
* List the cache entries for debugging
*/
static void show_cache (const char * func_name)
{
struct dir_cache_entry * p;
printk ("%s: cache status\n", func_name);
for (p = first; p != NULL; p = p->next)
printk ("dev:%04x, dir=%4lu, name=%s\n",
p->dev, p->dir, p->name);
}
#endif
/*
* Add an entry at the beginning of the cache
*/
static void add_to_cache (struct dir_cache_entry * p)
{
p->prev = NULL;
p->next = first;
if (first)
first->prev = p;
if (!last)
last = p;
first = p;
}
/*
* Add an entry at the beginning of a queue
*/
static void add_to_queue (int queue, struct dir_cache_entry * p)
{
p->queue_prev = NULL;
p->queue_next = queue_head[queue];
if (queue_head[queue])
queue_head[queue]->queue_prev = p;
if (!queue_tail[queue])
queue_tail[queue] = p;
queue_head[queue] = p;
}
/*
* Remove an entry from the cache
*/
static void remove_from_cache (struct dir_cache_entry * p)
{
if (p->prev)
p->prev->next = p->next;
else
first = p->next;
if (p->next)
p->next->prev = p->prev;
else
last = p->prev;
p->prev = NULL;
p->next = NULL;
}
/*
* Remove an entry from a queue
*/
static void remove_from_queue (int queue, struct dir_cache_entry * p)
{
if (p->queue_prev)
p->queue_prev->queue_next = p->queue_next;
else
queue_head[queue] = p->queue_next;
if (p->queue_next)
p->queue_next->queue_prev = p->queue_prev;
else
queue_tail[queue] = p->queue_prev;
p->queue_prev = NULL;
p->queue_next = NULL;
}
/*
* Invalidate all cache entries on a device (called by put_super() when
* a file system is unmounted)
*/
void ext2_dcache_invalidate (unsigned short dev)
{
struct dir_cache_entry * p;
struct dir_cache_entry * p2;
if (!cache_initialized)
init_cache ();
for (p = first; p != NULL; p = p2) {
p2 = p->next;
if (p->dev == dev) {
remove_from_cache (p);
remove_from_queue (hash (p->dev, p->dir), p);
p->next = first_free;
first_free = p;
}
}
#ifdef EXT2FS_DEBUG_CACHE
show_cache ("dcache_invalidate");
#endif
}
/*
* Lookup a directory entry in the cache
*/
unsigned long ext2_dcache_lookup (unsigned short dev, unsigned long dir,
const char * name, int len)
{
char our_name[EXT2_NAME_LEN];
int queue;
struct dir_cache_entry * p;
if (!cache_initialized)
init_cache ();
if (len > DCACHE_NAME_LEN)
return 0;
memcpy (our_name, (char *) name, len);
our_name[len] = '\0';
#ifdef EXT2FS_DEBUG_CACHE
printk ("dcache_lookup (%04x, %lu, %s, %d)\n", dev, dir, our_name, len);
#endif
queue = hash (dev, dir);
if ((p = find_name (queue, dev, dir, our_name, len))) {
if (p != first) {
remove_from_cache (p);
add_to_cache (p);
}
if (p != queue_head[queue]) {
remove_from_queue (queue, p);
add_to_queue (queue, p);
}
#ifdef EXT2FS_DEBUG_CACHE
hits++;
printk ("dcache_lookup: %s,hit,inode=%lu,hits=%d,misses=%d\n",
our_name, p->ino, hits, misses);
show_cache ("dcache_lookup");
#endif
return p->ino;
} else {
#ifdef EXT2FS_DEBUG_CACHE
misses++;
printk ("dcache_lookup: %s,miss,hits=%d,misses=%d\n",
our_name, hits, misses);
show_cache ("dcache_lookup");
#endif
return 0;
}
}
/*
* Add a directory entry to the cache
*
* This function is called by ext2_lookup(), ext2_readdir()
* and the functions which create directory entries
*/
void ext2_dcache_add (unsigned short dev, unsigned long dir, const char * name,
int len, unsigned long ino)
{
struct dir_cache_entry * p;
int queue;
if (!cache_initialized)
init_cache ();
#ifdef EXT2FS_DEBUG_CACHE
printk ("dcache_add (%04x, %lu, %s, %d, %lu)\n",
dev, dir, name, len, ino);
#endif
if (len > DCACHE_NAME_LEN)
return;
queue = hash (dev, dir);
if ((p = find_name (queue, dev, dir, name, len))) {
p->dir = dir;
p->ino = ino;
if (p != first) {
remove_from_cache (p);
add_to_cache (p);
}
if (p != queue_head[queue]) {
remove_from_queue (queue, p);
add_to_queue (queue, p);
}
} else {
if (first_free) {
p = first_free;
first_free = p->next;
} else {
if (!last)
panic ("dcache_add: last == NULL\n");
else {
p = last;
last = p->prev;
if (last)
last->next = NULL;
remove_from_queue (hash (p->dev, p->dir), p);
}
}
p->dev = dev;
p->dir = dir;
p->ino = ino;
strncpy (p->name, name, len);
p->len = len;
p->name[len] = '\0';
add_to_cache (p);
add_to_queue (queue, p);
}
#ifdef EXT2FS_DEBUG_CACHE
show_cache ("dcache_add");
#endif
}
/*
* Remove a directory from the cache
*
* This function is called by the functions which remove directory entries
*/
void ext2_dcache_remove (unsigned short dev, unsigned long dir,
const char * name, int len)
{
struct dir_cache_entry * p;
int queue;
if (!cache_initialized)
init_cache ();
#ifdef EXT2FS_DEBUG_CACHE
printk ("dcache_remove (%04x, %lu, %s, %d)\n", dev, dir, name, len);
#endif
if (len > DCACHE_NAME_LEN)
return;
queue = hash (dev, dir);
if ((p = find_name (queue, dev, dir, name, len))) {
remove_from_cache (p);
remove_from_queue (queue, p);
p->next = first_free;
first_free = p;
}
#ifdef EXT2FS_DEBUG_CACHE
show_cache ("dcache_remove");
#endif
}
#endif
......@@ -177,6 +177,7 @@ static int msdos_create_entry(struct inode *dir,char *name,int is_dir,
dir->i_ctime = dir->i_mtime = CURRENT_TIME;
dir->i_dirt = 1;
memcpy(de->name,name,MSDOS_NAME);
memset(de->unused, 0, sizeof(de->unused));
de->attr = is_dir ? ATTR_DIR : ATTR_ARCH;
de->start = 0;
date_unix2dos(dir->i_mtime,&de->time,&de->date);
......
#ifndef _ASM_GENERIC_BITOPS_H_
#define _ASM_GENERIC_BITOPS_H_
/*
* For the benefit of those who are trying to port Linux to another
* architecture, here are some C-language equivalents. You should
* recode these in the native assembly language, if at all possible.
* To guarantee atomicity, these routines call cli() and sti() to
* disable interrupts while they operate. (You have to provide inline
* routines to cli() and sti().)
*
* Also note, these routines assume that you have 32 bit integers.
* You will have to change this if you are trying to port Linux to the
* Alpha architecture or to a Cray. :-)
*
* C language equivalents written by Theodore Ts'o, 9/26/92
*/
extern __inline__ int set_bit(int nr,int * addr)
{
int mask, retval;
addr += nr >> 5;
mask = 1 << (nr & 0x1f);
cli();
retval = (mask & *addr) != 0;
*addr |= mask;
sti();
return retval;
}
extern __inline__ int clear_bit(int nr, int * addr)
{
int mask, retval;
addr += nr >> 5;
mask = 1 << (nr & 0x1f);
cli();
retval = (mask & *addr) != 0;
*addr &= ~mask;
sti();
return retval;
}
extern __inline__ int test_bit(int nr, int * addr)
{
int mask;
addr += nr >> 5;
mask = 1 << (nr & 0x1f);
return ((mask & *addr) != 0);
}
#endif /* _ASM_GENERIC_BITOPS_H */
/*
* include/asm-generic/string.h
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*/
#ifndef _ASM_GENERIC_STRING_H_
#define _ASM_GENERIC_STRING_H_
/*
* Portable string functions. These are not complete:
* memcpy() and memmove() are still missing.
*/
#ifdef __USE_PORTABLE_strcpy
extern inline char * strcpy(char * dest,const char *src)
{
char *xdest = dest;
while(*dest++ = *src++);
return xdest;
}
#endif
#ifdef __USE_PORTABLE_strncpy
extern inline char * strncpy(char * dest,const char *src,size_t count)
{
char *xdest = dest;
while((*dest++ = *src++) && --count);
return dest;
}
#endif
#ifdef __USE_PORTABLE_strcat
extern inline char * strcat(char * dest, const char * src)
{
char *tmp = dest;
while (*dest)
dest++;
while ((*dest++ = *src++))
;
return tmp;
}
#endif
#ifdef __USE_PORTABLE_strncat
extern inline char * strncat(char *dest, const char *src, size_t count)
{
char *tmp = dest;
if (count) {
while (*dest)
dest++;
while ((*dest++ = *src++)) {
if (--count == 0)
break;
}
}
return tmp;
}
#endif
#ifdef __USE_PORTABLE_strcmp
extern int strcmp(const char * cs,const char * ct)
{
register char __res;
while(1) {
if(__res = *cs - *ct++ && *cs++)
break;
}
return __res;
}
#endif
#ifdef __USE_PORTABLE_strncmp
extern inline int strncmp(const char * cs,const char * ct,size_t count)
{
register char __res;
while(count) {
if(__res = *cs - *ct++ || !*cs++)
break;
count--;
}
return __res;
}
#endif
#ifdef __USE_PORTABLE_strchr
extern inline char * strchr(const char * s,char c)
{
const char ch = c;
for(; *s != ch; ++s)
if (*s == '\0')
return( NULL );
return( (char *) s);
}
#endif
#ifdef __USE_PORTABLE_strlen
extern inline size_t strlen(const char * s)
{
const char *sc;
for (sc = s; *sc != '\0'; ++sc) ;
return(sc - s);
}
#endif
#ifdef __USE_PORTABLE_strspn
extern inline size_t strspn(const char *s, const char *accept)
{
const char *p;
const char *a;
size_t count = 0;
for (p = s; *p != '\0'; ++p)
{
for (a = accept; *a != '\0'; ++a)
if (*p == *a)
break;
if (*a == '\0')
return count;
else
++count;
}
return count;
}
#endif
#ifdef __USE_PORTABLE_strpbrk
extern inline char * strpbrk(const char * cs,const char * ct)
{
const char *sc1,*sc2;
for( sc1 = cs; *sc1 != '\0'; ++sc1)
for( sc2 = ct; *sc2 != '\0'; ++sc2)
if (*sc1 == *sc2)
return((char *) sc1);
return( NULL );
}
#endif
#ifdef __USE_PORTABLE_strtok
extern inline char * strtok(char * s,const char * ct)
{
char *sbegin, *send;
static char *ssave = NULL;
sbegin = s ? s : ssave;
if (!sbegin) {
return NULL;
}
sbegin += strspn(sbegin,ct);
if (*sbegin == '\0') {
ssave = NULL;
return( NULL );
}
send = strpbrk( sbegin, ct);
if (send && *send != '\0')
*send++ = '\0';
ssave = send;
return (sbegin);
}
#endif
#ifdef __USE_PORTABLE_memset
extern inline void * memset(void * s,char c,size_t count)
{
void *xs = s;
while(n--)
*s++ = c;
return xs;
}
#endif
#ifdef __USE_PORTABLE_memcpy
#error "Portable memcpy() not implemented yet"
#endif
#ifdef __USE_PORTABLE_memmove
#error "Portable memmove() not implemented yet"
#endif
#ifdef __USE_PORTABLE_memcmp
extern inline int memcmp(const void * cs,const void * ct,size_t count)
{
const unsigned char *su1, *su2;
for( su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--)
if (*su1 != *su2)
return((*su1 < *su2) ? -1 : +1);
return(0);
}
#endif
#endif /* _ASM_GENERIC_STRING_H_ */
#ifndef _ASM_BITOPS_H
#define _ASM_BITOPS_H
#ifndef _I386_BITOPS_H
#define _I386_BITOPS_H
/*
* Copyright 1992, Linus Torvalds.
*/
#ifdef i386
/*
* These have to be done with inline assembly: that way the bit-setting
* is guaranteed to be atomic. All bit operations return 0 if the bit
......@@ -63,55 +63,4 @@ extern __inline__ int test_bit(int nr, void * addr)
return oldbit;
}
#else
/*
* For the benefit of those who are trying to port Linux to another
* architecture, here are some C-language equivalents. You should
* recode these in the native assembly language, if at all possible.
* To guarantee atomicity, these routines call cli() and sti() to
* disable interrupts while they operate. (You have to provide inline
* routines to cli() and sti().)
*
* Also note, these routines assume that you have 32 bit integers.
* You will have to change this if you are trying to port Linux to the
* Alpha architecture or to a Cray. :-)
*
* C language equivalents written by Theodore Ts'o, 9/26/92
*/
extern __inline__ int set_bit(int nr,int * addr)
{
int mask, retval;
addr += nr >> 5;
mask = 1 << (nr & 0x1f);
cli();
retval = (mask & *addr) != 0;
*addr |= mask;
sti();
return retval;
}
extern __inline__ int clear_bit(int nr, int * addr)
{
int mask, retval;
addr += nr >> 5;
mask = 1 << (nr & 0x1f);
cli();
retval = (mask & *addr) != 0;
*addr &= ~mask;
sti();
return retval;
}
extern __inline__ int test_bit(int nr, int * addr)
{
int mask;
addr += nr >> 5;
mask = 1 << (nr & 0x1f);
return ((mask & *addr) != 0);
}
#endif /* i386 */
#endif /* _ASM_BITOPS_H */
#endif /* _I386_BITOPS_H */
#ifndef _I386_DELAY_H
#define _I386_DELAY_H
/*
* Copyright (C) 1993 Linus Torvalds
*
* Delay routines, using a pre-computed "loops_per_second" value.
*/
extern __inline__ void __delay(int loops)
{
__asm__(".align 2,0x90\n1:\tdecl %0\n\tjns 1b": :"a" (loops):"ax");
}
/*
* division by multiplication: you don't have to worry about
* loss of precision.
*
* Use only for very small delays ( < 1 msec). Should probably use a
* lookup table, really, as the multiplications take much too long with
* short delays. This is a "reasonable" implementation, though (and the
* first constant multiplications gets optimized away if the delay is
* a constant)
*/
extern __inline__ void udelay(unsigned long usecs)
{
usecs *= 0x000010c6; /* 2**32 / 1000000 */
__asm__("mull %0"
:"=d" (usecs)
:"a" (usecs),"0" (loops_per_sec)
:"ax");
__delay(usecs);
}
#endif /* defined(_I386_DELAY_H) */
#ifndef _ASM_I386_UNISTD_H_
#define _ASM_I386_UNISTD_H_
/* XXX - _foo needs to be __foo, while __NR_bar could be _NR_bar. */
#define _syscall0(type,name) \
type name(void) \
{ \
long __res; \
__asm__ volatile ("int $0x80" \
: "=a" (__res) \
: "0" (__NR_##name)); \
if (__res >= 0) \
return (type) __res; \
errno = -__res; \
return -1; \
}
#define _syscall1(type,name,atype,a) \
type name(atype a) \
{ \
long __res; \
__asm__ volatile ("int $0x80" \
: "=a" (__res) \
: "0" (__NR_##name),"b" ((long)(a))); \
if (__res >= 0) \
return (type) __res; \
errno = -__res; \
return -1; \
}
#define _syscall2(type,name,atype,a,btype,b) \
type name(atype a,btype b) \
{ \
long __res; \
__asm__ volatile ("int $0x80" \
: "=a" (__res) \
: "0" (__NR_##name),"b" ((long)(a)),"c" ((long)(b))); \
if (__res >= 0) \
return (type) __res; \
errno = -__res; \
return -1; \
}
#define _syscall3(type,name,atype,a,btype,b,ctype,c) \
type name(atype a,btype b,ctype c) \
{ \
long __res; \
__asm__ volatile ("int $0x80" \
: "=a" (__res) \
: "0" (__NR_##name),"b" ((long)(a)),"c" ((long)(b)),"d" ((long)(c))); \
if (__res>=0) \
return (type) __res; \
errno=-__res; \
return -1; \
}
#define _syscall4(type,name,atype,a,btype,b,ctype,c,dtype,d) \
type name (atype a, btype b, ctype c, dtype d) \
{ \
long __res; \
__asm__ volatile ("int $0x80" \
: "=a" (__res) \
: "0" (__NR_##name),"b" ((long)(a)),"c" ((long)(b)), \
"d" ((long)(c)),"S" ((long)(d))); \
if (__res>=0) \
return (type) __res; \
errno=-__res; \
return -1; \
}
#define _syscall5(type,name,atype,a,btype,b,ctype,c,dtype,d,etype,e) \
type name (atype a,btype b,ctype c,dtype d,etype e) \
{ \
long __res; \
__asm__ volatile ("int $0x80" \
: "=a" (__res) \
: "0" (__NR_##name),"b" ((long)(a)),"c" ((long)(b)), \
"d" ((long)(c)),"S" ((long)(d)),"D" ((long)(e))); \
if (__res>=0) \
return (type) __res; \
errno=-__res; \
return -1; \
}
#endif /* _ASM_I386_UNISTD_H_ */
/*
* include/asm-mips/bitops.h
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (c) 1994 by Ralf Baechle
*/
#ifndef _ASM_MIPS_BITOPS_H_
#define _ASM_MIPS_BITOPS_H_
/*
* On MIPS inline assembler bitfunctions are as effective
* as the standard C counterparts.
*/
#include <asm-generic/bitops.h>
#endif /* _ASM_MIPS_BITOPS_H_ */
#ifndef _MIPS_DELAY_H
#define _MIPS_DELAY_H
extern __inline__ void __delay(int loops)
{
__asm__(".align 3\n"
"1:\tbeq\t$0,%0,1b\n\t"
"addiu\t%0,%0,-1\n\t"
:
:"d" (loops));
}
/*
* division by multiplication: you don't have to worry about
* loss of precision.
*
* Use only for very small delays ( < 1 msec). Should probably use a
* lookup table, really, as the multiplications take much too long with
* short delays. This is a "reasonable" implementation, though (and the
* first constant multiplications gets optimized away if the delay is
* a constant)
*/
extern __inline__ void udelay(unsigned long usecs)
{
usecs *= 0x000010c6; /* 2**32 / 1000000 */
__asm__("mul\t%0,%0,%1"
:"=d" (usecs)
:"0" (usecs),"d" (loops_per_sec)
:"ax");
__delay(usecs);
}
#endif /* defined(_MIPS_DELAY_H) */
/*
* include/asm-mips/mipsregs.h
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 1994 by Ralf Baechle
*/
#ifndef _ASM_MIPS_MIPSREGS_H_
#define _ASM_MIPS_MIPSREGS_H_
/*
* The following macros are espacially usefull for __asm__
* inline assembler.
*/
#ifndef __STR
#define __STR(x) #x
#endif
#ifndef STR
#define STR(x) __STR(x)
#endif
/*
* Coprozessor 0 register names
*/
#define CP0_INDEX $0
#define CP0_RANDOM $1
#define CP0_ENTRYLO0 $2
#define CP0_ENTRYLO1 $3
#define CP0_CONTEXT $4
#define CP0_PAGEMASK $5
#define CP0_WIRED $6
#define CP0_BADVADDR $8
#define CP0_COUNT $9
#define CP0_ENTRYHI $10
#define CP0_COMPARE $11
#define CP0_STATUS $12
#define CP0_CAUSE $13
#define CP0_EPC $14
#define CP0_PRID $15
#define CP0_CONFIG $16
#define CP0_LLADDR $17
#define CP0_WATCHLO $18
#define CP0_WATCHHI $19
#define CP0_XCONTEXT $20
#define CP0_ECC $26
#define CP0_CACHEERR $27
#define CP0_TAGLO $28
#define CP0_TAGHI $29
#define CP0_ERROREPC $30
/*
* Values for pagemask register
*/
#define PM_4K 0x000000000
#define PM_16K 0x000060000
#define PM_64K 0x0001e0000
#define PM_256K 0x0007e0000
#define PM_1M 0x001fe0000
#define PM_4M 0x007fe0000
#define PM_16M 0x01ffe0000
/*
* Values used for computation of new tlb entries
*/
#define PL_4K 12
#define PL_16K 14
#define PL_64K 16
#define PL_256K 18
#define PL_1M 20
#define PL_4M 22
#define PL_16M 24
/*
* Compute a vpn/pfn entry for EntryHi register
*/
#define VPN(addr,pagesizeshift) ((addr) & ~((1 << (pagesizeshift))-1))
#define PFN(addr,pagesizeshift) (((addr) & ((1 << (pagesizeshift))-1)) << 6)
#endif /* _ASM_MIPS_MIPSREGS_H_ */
/*
* include/asm-mips/segment.h
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 1994 by Ralf Baechle
*
*/
#ifndef _ASM_MIPS_SEGMENT_H_
#define _ASM_MIPS_SEGMENT_H_
#include <linux/segment.h>
static inline unsigned char get_user_byte(const char * addr)
{
register unsigned char _v;
__asm__ ("lbu\t%0,%1":"=r" (_v):"r" (*addr));
return _v;
}
#define get_fs_byte(addr) get_user_byte((char *)(addr))
static inline unsigned short get_user_word(const short *addr)
{
unsigned short _v;
__asm__ ("lhu\t%0,%1":"=r" (_v):"r" (*addr));
return _v;
}
#define get_fs_word(addr) get_user_word((short *)(addr))
static inline unsigned long get_user_long(const int *addr)
{
unsigned long _v;
__asm__ ("lwu\t%0,%1":"=r" (_v):"r" (*addr)); \
return _v;
}
#define get_fs_long(addr) get_user_long((int *)(addr))
static inline unsigned long get_user_dlong(const int *addr)
{
unsigned long _v;
__asm__ ("ld\t%0,%1":"=r" (_v):"r" (*addr)); \
return _v;
}
#define get_fs_dlong(addr) get_user_dlong((int *)(addr))
static inline void put_user_byte(char val,char *addr)
{
__asm__ ("sb\t%0,%1": /* no outputs */ :"r" (val),"r" (*addr));
}
#define put_fs_byte(x,addr) put_user_byte((x),(char *)(addr))
static inline void put_user_word(short val,short * addr)
{
__asm__ ("sh\t%0,%1": /* no outputs */ :"r" (val),"r" (*addr));
}
#define put_fs_word(x,addr) put_user_word((x),(short *)(addr))
static inline void put_user_long(unsigned long val,int * addr)
{
__asm__ ("sw\t%0,%1": /* no outputs */ :"r" (val),"r" (*addr));
}
#define put_fs_long(x,addr) put_user_long((x),(int *)(addr))
static inline void put_user_dlong(unsigned long val,int * addr)
{
__asm__ ("sd\t%0,%1": /* no outputs */ :"r" (val),"r" (*addr));
}
#define put_fs_dlong(x,addr) put_user_dlong((x),(int *)(addr))
/*
* These following two variables are defined in mips/head.S.
*/
extern unsigned long segment_fs;
static inline void __generic_memcpy_tofs(void * to, const void * from, unsigned long n)
{
__asm__(
".set\tnoreorder\n\t"
".set\tnoat\n"
"1:\tlbu\t$1,(%2)\n\t"
"addiu\t%2,%2,1\n\t"
"sb\t$1,(%1)\n\t"
"addiu\t%0,%0,-1\n\t"
"bne\t$0,%0,1b\n\t"
"addiu\t%1,%1,1\n\t"
".set\tat\n\t"
".set\treorder"
: /* no outputs */
:"d" (n),"d" (((long) to)| segment_fs),"d" ((long) from)
:"$1");
}
static inline void __constant_memcpy_tofs(void * to, const void * from, unsigned long n)
{
/*
* Use put_user_byte to avoid trouble with alignment.
*/
switch (n) {
case 0:
return;
case 1:
put_user_byte(*(const char *) from, (char *) to);
return;
case 2:
put_user_byte(*(const char *) from, (char *) to);
put_user_byte(*(1+(const char *) from), 1+(char *) to);
return;
case 3:
put_user_byte(*((const char *) from), (char *) to);
put_user_byte(*(1+(const char *) from), 1+(char *) to);
put_user_byte(*(2+(const char *) from), 2+(char *) to);
return;
case 4:
put_user_byte(*((const char *) from), (char *) to);
put_user_byte(*(1+(const char *) from), 1+(char *) to);
put_user_byte(*(2+(const char *) from), 2+(char *) to);
put_user_byte(*(3+(const char *) from), 3+(char *) to);
return;
}
__generic_memcpy_tofs(to, from, n);
return;
}
static inline void __generic_memcpy_fromfs(void * to, const void * from, unsigned long n)
{
__asm__(
".set\tnoreorder\n\t"
".set\tnoat\n"
"1:\tlbu\t$1,(%2)\n\t"
"addiu\t%2,%2,1\n\t"
"sb\t$1,(%1)\n\t"
"addiu\t%0,%0,-1\n\t"
"bne\t$0,%0,1b\n\t"
"addiu\t%1,%1,1\n\t"
".set\tat\n\t"
".set\treorder"
: /* no outputs */
:"d" (n),"d" ((long) to),"d" (((long) from | segment_fs))
:"$1","memory");
}
static inline void __constant_memcpy_fromfs(void * to, const void * from, unsigned long n)
{
/*
* Use put_user_byte to avoid trouble with alignment.
*/
switch (n) {
case 0:
return;
case 1:
*(char *)to = get_user_byte((const char *) from);
return;
case 2:
*(char *) to = get_user_byte((const char *) from);
*(char *) to = get_user_byte(1+(const char *) from);
return;
case 3:
*(char *) to = get_user_byte((const char *) from);
*(char *) to = get_user_byte(1+(const char *) from);
*(char *) to = get_user_byte(2+(const char *) from);
return;
case 4:
*(char *) to = get_user_byte((const char *) from);
*(char *) to = get_user_byte(1+(const char *) from);
*(char *) to = get_user_byte(2+(const char *) from);
*(char *) to = get_user_byte(3+(const char *) from);
return;
}
__generic_memcpy_fromfs(to, from, n);
return;
}
#define memcpy_fromfs(to, from, n) \
(__builtin_constant_p(n) ? \
__constant_memcpy_fromfs((to),(from),(n)) : \
__generic_memcpy_fromfs((to),(from),(n)))
#define memcpy_tofs(to, from, n) \
(__builtin_constant_p(n) ? \
__constant_memcpy_tofs((to),(from),(n)) : \
__generic_memcpy_tofs((to),(from),(n)))
static inline unsigned long get_fs(void)
{
return segment_fs;
}
static inline unsigned long get_ds(void)
{
return KERNEL_DS;
}
static inline void set_fs(unsigned long val)
{
segment_fs = val;
}
#endif /* _ASM_MIPS_SEGMENT_H_ */
/*
* include/asm-mips/string.h
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (c) 1994 by Ralf Baechle
*/
#ifndef _ASM_MIPS_STRING_H_
#define _ASM_MIPS_STRING_H_
#define __USE_PORTABLE_STRINGS_H_
extern inline char * strcpy(char * dest,const char *src)
{
char *xdest = dest;
__asm__ __volatile__(
".set\tnoreorder\n\t"
".set\tnoat\n"
"1:\tlbu\t$1,(%1)\n\t"
"addiu\t%1,%1,1\n\t"
"sb\t$1,(%0)\n\t"
"bne\t$0,$1,1b\n\t"
"addiu\t%0,%0,1\n\t"
".set\tat\n\t"
".set\treorder"
: "=d" (dest), "=d" (src)
: "0" (dest), "1" (src)
: "$1","memory");
return xdest;
}
extern inline char * strncpy(char *dest, const char *src, size_t n)
{
char *xdest = dest;
if (n == 0)
return xdest;
__asm__ __volatile__(
".set\tnoreorder\n\t"
".set\tnoat\n"
"1:\tlbu\t$1,(%1)\n\t"
"addiu\t%2,%2,-1\n\t"
"sb\t$1,(%0)\n\t"
"beq\t$0,$1,2f\n\t"
"addiu\t%0,%0,1\n\t"
"bne\t$0,%2,1b\n\t"
"addiu\t%1,%1,1\n"
"2:\n\t"
".set\tat\n\t"
".set\treorder\n\t"
: "=d" (dest), "=d" (src), "=d" (n)
: "0" (dest), "1" (src), "2" (n)
: "$1","memory");
return dest;
}
#define __USE_PORTABLE_strcat
#define __USE_PORTABLE_strncat
extern inline int strcmp(const char * cs,const char * ct)
{
int __res;
__asm__ __volatile__(
".set\tnoreorder\n\t"
".set\tnoat\n\t"
"lbu\t%2,(%0)\n"
"1:\tlbu\t$1,(%1)\n\t"
"addiu\t%0,%0,1\n\t"
"bne\t$1,%2,2f\n\t"
"addiu\t%1,%1,1\n\t"
"bne\t$0,%2,1b\n\t"
"lbu\t%2,(%0)\n"
"move\t%2,$1\n"
"2:\tsub\t%2,%2,$1\n"
"3:\t.set\tat\n\t"
".set\treorder\n\t"
: "=d" (cs), "=d" (ct), "=d" (__res)
: "0" (cs), "1" (ct)
: "$1");
return __res;
}
extern inline int strncmp(const char * cs,const char * ct,size_t count)
{
char __res;
__asm__ __volatile__(
".set\tnoreorder\n\t"
".set\tnoat\n"
"1:\tlbu\t%3,(%0)\n\t"
"beq\t$0,%2,2f\n\t"
"lbu\t$1,(%1)\n\t"
"addiu\t%2,%2,-1\n\t"
"bne\t$1,%3,3f\n\t"
"addiu\t%0,%0,1\n\t"
"bne\t$0,%3,1b\n\t"
"addiu\t%1,%1,1\n"
"2:\tmove\t%3,$1\n"
"3:\tsub\t%3,%3,$1\n\t"
".set\tat\n\t"
".set\treorder"
: "=d" (cs), "=d" (ct), "=d" (count), "=d" (__res)
: "0" (cs), "1" (ct), "2" (count)
: "$1");
return __res;
}
#define __USE_PORTABLE_strchr
#define __USE_PORTABLE_strlen
#define __USE_PORTABLE_strspn
#define __USE_PORTABLE_strpbrk
#define __USE_PORTABLE_strtok
extern inline void * memset(void * s,char c,size_t count)
{
void *xs = s;
if (!count)
return xs;
__asm__ __volatile__(
".set\tnoreorder\n"
"1:\tsb\t%3,(%0)\n\t"
"addiu\t%1,%1,-1\n\t"
"bne\t$0,%1,1b\n\t"
"addiu\t%3,%3,1\n\t"
".set\treorder"
: "=d" (s), "=d" (count)
: "0" (s), "d" (c), "1" (count)
: "memory");
return xs;
}
extern inline void * memcpy(void * to, const void * from, size_t n)
{
void *xto = to;
if (!n)
return xto;
__asm__ __volatile__(
".set\tnoreorder\n\t"
".set\tnoat\n"
"1:\tlbu\t$1,(%1)\n\t"
"addiu\t%1,%1,1\n\t"
"sb\t$1,(%0)\n\t"
"addiu\t%2,%2,-1\n\t"
"bne\t$0,%2,1b\n\t"
"addiu\t%0,%0,1\n\t"
".set\tat\n\t"
".set\treorder"
: "=d" (to), "=d" (from), "=d" (n)
: "0" (to), "1" (from), "2" (n)
: "$1","memory" );
return xto;
}
extern inline void * memmove(void * dest,const void * src, size_t n)
{
void *xdest = dest;
if (!n)
return xdest;
if (dest < src)
__asm__ __volatile__(
".set\tnoreorder\n\t"
".set\tnoat\n"
"1:\tlbu\t$1,(%1)\n\t"
"addiu\t%1,%1,1\n\t"
"sb\t$1,(%0)\n\t"
"addiu\t%2,%2,-1\n\t"
"bne\t$0,%2,1b\n\t"
"addiu\t%0,%0,1\n\t"
".set\tat\n\t"
".set\treorder"
: "=d" (dest), "=d" (src), "=d" (n)
: "0" (dest), "1" (src), "2" (n)
: "$1","memory" );
else
__asm__ __volatile__(
".set\tnoreorder\n\t"
".set\tnoat\n"
"1:\tlbu\t$1,-1(%1)\n\t"
"addiu\t%1,%1,-1\n\t"
"sb\t$1,-1(%0)\n\t"
"addiu\t%2,%2,-1\n\t"
"bne\t$0,%2,1b\n\t"
"addiu\t%0,%0,-1\n\t"
".set\tat\n\t"
".set\treorder"
: "=d" (dest), "=d" (src), "=d" (n)
: "0" (dest+n), "1" (src+n), "2" (n)
: "$1","memory" );
return xdest;
}
#define __USE_PORTABLE_memcmp
#endif /* _ASM_MIPS_STRING_H_ */
/*
* include/asm-mips/system.h
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 1994 by Ralf Baechle
*/
#ifndef _ASM_MIPS_SYSTEM_H_
#define _ASM_MIPS_SYSTEM_H_
#include <linux/segment.h>
#include <mips/mipsregs.h>
/*
* move_to_user_mode() doesn't switch to user mode on the mips, since
* that would run us into problems: The kernel is located at virtual
* address 0x80000000. If we now would switch over to user mode, we
* we would immediately get an address error exception.
* Anyway - we don't have problems with a task running in kernel mode,
* as long it's code is foolproof.
*/
#define move_to_user_mode()
#define sti() \
__asm__ __volatile__( \
"mfc0\t$1,"STR(CP0_STATUS)"\n\t" \
"ori\t$1,$1,1\n\t" \
"mtc0\t$1,"STR(CP0_STATUS)"\n\t" \
: /* no outputs */ \
: /* no inputs */ \
: "$1","memory")
#define cli() \
__asm__ __volatile__( \
"mfc0\t$1,"STR(CP0_STATUS)"\n\t" \
"srl\t$1,$1,1\n\t" \
"sll\t$1,$1,1\n\t" \
"mtc0\t$1,"STR(CP0_STATUS)"\n\t" \
: /* no outputs */ \
: /* no inputs */ \
: "$1","memory")
#define nop() __asm__ __volatile__ ("nop")
#define save_flags(x) \
__asm__ __volatile__( \
".set\tnoreorder\n\t" \
".set\tnoat\n\t" \
"mfc0\t%0,$12\n\t" \
".set\tat\n\t" \
".set\treorder" \
: "=r" (x) \
: /* no inputs */ \
: "memory")
#define restore_flags(x) \
__asm__ __volatile__( \
".set\tnoreorder\n\t" \
".set\tnoat\n\t" \
"mtc0\t%0,$12\n\t" \
".set\tat\n\t" \
".set\treorder" \
: /* no output */ \
: "r" (x) \
: "memory")
#endif /* _ASM_MIPS_SYSTEM_H_ */
#ifndef _ASM_MIPS_UNISTD_H_
#define _ASM_MIPS_UNISTD_H_
/* XXX - _foo needs to be __foo, while __NR_bar could be _NR_bar. */
#define _syscall0(type,name) \
type name(void) \
{ \
register long __res; \
__asm__ volatile (".set\tnoat\n\t" \
"li\t$1,%1\n\t" \
".set\tat\n\t" \
"syscall\n\t" \
: "=d" (__res) \
: "i" (__NR_##name) \
: "$1"); \
if (__res >= 0) \
return (type) __res; \
errno = -__res; \
return -1; \
}
#define _syscall1(type,name,atype,a) \
type name(atype a) \
{ \
register long __res; \
__asm__ volatile ("move\t$2,%2\n\t" \
".set\tnoat\n\t" \
"li\t$1,%1\n\t" \
".set\tat\n\t" \
"syscall" \
: "=d" (__res) \
: "i" (__NR_##name),"d" ((long)(a)) \
: "$1","$2"); \
if (__res >= 0) \
return (type) __res; \
errno = -__res; \
return -1; \
}
#define _syscall2(type,name,atype,a,btype,b) \
type name(atype a,btype b) \
{ \
register long __res; \
__asm__ volatile ("move\t$2,%2\n\t" \
"move\t$3,%3\n\t" \
".set\tnoat\n\t" \
"li\t$1,%1\n\t" \
".set\tat\n\t" \
"syscall" \
: "=d" (__res) \
: "i" (__NR_##name),"d" ((long)(a)), \
"d" ((long)(b))); \
: "$1","$2","$3"); \
if (__res >= 0) \
return (type) __res; \
errno = -__res; \
return -1; \
}
#define _syscall3(type,name,atype,a,btype,b,ctype,c) \
type name (atype a, btype b, ctype c) \
{ \
register long __res; \
__asm__ volatile ("move\t$2,%2\n\t" \
"move\t$3,%3\n\t" \
"move\t$4,%4\n\t" \
".set\tnoat\n\t" \
"li\t$1,%1\n\t" \
".set\tat\n\t" \
"syscall" \
: "=d" (__res) \
: "i" (__NR_##name),"d" ((long)(a)), \
"d" ((long)(b)), \
"d" ((long)(c)) \
: "$1","$2","$3","$4"); \
if (__res>=0) \
return (type) __res; \
errno=-__res; \
return -1; \
}
#define _syscall4(type,name,atype,a,btype,b,ctype,c,dtype,d) \
type name (atype a, btype b, ctype c, dtype d) \
{ \
register long __res; \
__asm__ volatile (".set\tnoat\n\t" \
"move\t$2,%2\n\t" \
"move\t$3,%3\n\t" \
"move\t$4,%4\n\t" \
"move\t$5,%5\n\t" \
".set\tnoat\n\t" \
"li\t$1,%1\n\t" \
".set\tat\n\t" \
"syscall" \
: "=d" (__res) \
: "i" (__NR_##name),"d" ((long)(a)), \
"d" ((long)(b)), \
"d" ((long)(c)), \
"d" ((long)(d)) \
: "$1","$2","$3","$4","$5"); \
if (__res>=0) \
return (type) __res; \
errno=-__res; \
return -1; \
}
#define _syscall5(type,name,atype,a,btype,b,ctype,c,dtype,d,etype,e) \
type name (atype a,btype b,ctype c,dtype d,etype e) \
{ \
register long __res; \
__asm__ volatile (".set\tnoat\n\t" \
"move\t$2,%2\n\t" \
"move\t$3,%3\n\t" \
"move\t$4,%4\n\t" \
"move\t$5,%5\n\t" \
"move\t$6,%6\n\t" \
".set\tnoat\n\t" \
"li\t$1,%1\n\t" \
".set\tat\n\t" \
"syscall" \
: "=d" (__res) \
: "i" (__NR_##name),"d" ((long)(a)), \
"d" ((long)(b)), \
"d" ((long)(c)), \
"d" ((long)(d)), \
"d" ((long)(e)) \
: "$1","$2","$3","$4","$5","$6"); \
if (__res>=0) \
return (type) __res; \
errno=-__res; \
return -1; \
}
#endif /* _ASM_MIPS_UNISTD_H_ */
#ifndef _I386_STRING_H_
#define _I386_STRING_H_
/*
* This string-include defines all string functions as inline
* functions. Use gcc. It also assumes ds=es=data space, this should be
* normal. Most of the string-functions are rather heavily hand-optimized,
* see especially strtok,strstr,str[c]spn. They should work, but are not
* very easy to understand. Everything is done entirely within the register
* set, making the functions fast and clean. String instructions have been
* used through-out, making for "slightly" unclear code :-)
*
* Copyright (C) 1991, 1992 Linus Torvalds
*/
extern inline char * strcpy(char * dest,const char *src)
{
__asm__ __volatile__(
"cld\n"
"1:\tlodsb\n\t"
"stosb\n\t"
"testb %%al,%%al\n\t"
"jne 1b"
: /* no output */
:"S" (src),"D" (dest):"si","di","ax","memory");
return dest;
}
extern inline char * strncpy(char * dest,const char *src,size_t count)
{
__asm__ __volatile__(
"cld\n"
"1:\tdecl %2\n\t"
"js 2f\n\t"
"lodsb\n\t"
"stosb\n\t"
"testb %%al,%%al\n\t"
"jne 1b\n\t"
"rep\n\t"
"stosb\n"
"2:"
: /* no output */
:"S" (src),"D" (dest),"c" (count):"si","di","ax","cx","memory");
return dest;
}
extern inline char * strcat(char * dest,const char * src)
{
__asm__ __volatile__(
"cld\n\t"
"repne\n\t"
"scasb\n\t"
"decl %1\n"
"1:\tlodsb\n\t"
"stosb\n\t"
"testb %%al,%%al\n\t"
"jne 1b"
: /* no output */
:"S" (src),"D" (dest),"a" (0),"c" (0xffffffff):"si","di","ax","cx");
return dest;
}
extern inline char * strncat(char * dest,const char * src,size_t count)
{
__asm__ __volatile__(
"cld\n\t"
"repne\n\t"
"scasb\n\t"
"decl %1\n\t"
"movl %4,%3\n"
"1:\tdecl %3\n\t"
"js 2f\n\t"
"lodsb\n\t"
"stosb\n\t"
"testb %%al,%%al\n\t"
"jne 1b\n"
"2:\txorl %2,%2\n\t"
"stosb"
: /* no output */
:"S" (src),"D" (dest),"a" (0),"c" (0xffffffff),"g" (count)
:"si","di","ax","cx","memory");
return dest;
}
extern inline int strcmp(const char * cs,const char * ct)
{
register int __res;
__asm__ __volatile__(
"cld\n"
"1:\tlodsb\n\t"
"scasb\n\t"
"jne 2f\n\t"
"testb %%al,%%al\n\t"
"jne 1b\n\t"
"xorl %%eax,%%eax\n\t"
"jmp 3f\n"
"2:\tsbbl %%eax,%%eax\n\t"
"orb $1,%%eax\n"
"3:"
:"=a" (__res):"S" (cs),"D" (ct):"si","di");
return __res;
}
extern inline int strncmp(const char * cs,const char * ct,size_t count)
{
register int __res;
__asm__ __volatile__(
"cld\n"
"1:\tdecl %3\n\t"
"js 2f\n\t"
"lodsb\n\t"
"scasb\n\t"
"jne 3f\n\t"
"testb %%al,%%al\n\t"
"jne 1b\n"
"2:\txorl %%eax,%%eax\n\t"
"jmp 4f\n"
"3:\tsbbl %%eax,%%eax\n\t"
"orb $1,%%al\n"
"4:"
:"=a" (__res):"S" (cs),"D" (ct),"c" (count):"si","di","cx");
return __res;
}
extern inline char * strchr(const char * s,char c)
{
register char * __res;
__asm__ __volatile__(
"cld\n\t"
"movb %%al,%%ah\n"
"1:\tlodsb\n\t"
"cmpb %%ah,%%al\n\t"
"je 2f\n\t"
"testb %%al,%%al\n\t"
"jne 1b\n\t"
"movl $1,%1\n"
"2:\tmovl %1,%0\n\t"
"decl %0"
:"=a" (__res):"S" (s),"0" (c):"si");
return __res;
}
extern inline char * strrchr(const char * s,char c)
{
register char * __res;
__asm__ __volatile__(
"cld\n\t"
"movb %%al,%%ah\n"
"1:\tlodsb\n\t"
"cmpb %%ah,%%al\n\t"
"jne 2f\n\t"
"leal -1(%%esi),%0\n"
"2:\ttestb %%al,%%al\n\t"
"jne 1b"
:"=d" (__res):"0" (0),"S" (s),"a" (c):"ax","si");
return __res;
}
extern inline size_t strspn(const char * cs, const char * ct)
{
register char * __res;
__asm__ __volatile__(
"cld\n\t"
"movl %4,%%edi\n\t"
"repne\n\t"
"scasb\n\t"
"notl %%ecx\n\t"
"decl %%ecx\n\t"
"movl %%ecx,%%edx\n"
"1:\tlodsb\n\t"
"testb %%al,%%al\n\t"
"je 2f\n\t"
"movl %4,%%edi\n\t"
"movl %%edx,%%ecx\n\t"
"repne\n\t"
"scasb\n\t"
"je 1b\n"
"2:\tdecl %0"
:"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct)
:"ax","cx","dx","di");
return __res-cs;
}
extern inline size_t strcspn(const char * cs, const char * ct)
{
register char * __res;
__asm__ __volatile__(
"cld\n\t"
"movl %4,%%edi\n\t"
"repne\n\t"
"scasb\n\t"
"notl %%ecx\n\t"
"decl %%ecx\n\t"
"movl %%ecx,%%edx\n"
"1:\tlodsb\n\t"
"testb %%al,%%al\n\t"
"je 2f\n\t"
"movl %4,%%edi\n\t"
"movl %%edx,%%ecx\n\t"
"repne\n\t"
"scasb\n\t"
"jne 1b\n"
"2:\tdecl %0"
:"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct)
:"ax","cx","dx","di");
return __res-cs;
}
extern inline char * strpbrk(const char * cs,const char * ct)
{
register char * __res;
__asm__ __volatile__(
"cld\n\t"
"movl %4,%%edi\n\t"
"repne\n\t"
"scasb\n\t"
"notl %%ecx\n\t"
"decl %%ecx\n\t"
"movl %%ecx,%%edx\n"
"1:\tlodsb\n\t"
"testb %%al,%%al\n\t"
"je 2f\n\t"
"movl %4,%%edi\n\t"
"movl %%edx,%%ecx\n\t"
"repne\n\t"
"scasb\n\t"
"jne 1b\n\t"
"decl %0\n\t"
"jmp 3f\n"
"2:\txorl %0,%0\n"
"3:"
:"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct)
:"ax","cx","dx","di");
return __res;
}
extern inline char * strstr(const char * cs,const char * ct)
{
register char * __res;
__asm__ __volatile__(
"cld\n\t" \
"movl %4,%%edi\n\t"
"repne\n\t"
"scasb\n\t"
"notl %%ecx\n\t"
"decl %%ecx\n\t" /* NOTE! This also sets Z if searchstring='' */
"movl %%ecx,%%edx\n"
"1:\tmovl %4,%%edi\n\t"
"movl %%esi,%%eax\n\t"
"movl %%edx,%%ecx\n\t"
"repe\n\t"
"cmpsb\n\t"
"je 2f\n\t" /* also works for empty string, see above */
"xchgl %%eax,%%esi\n\t"
"incl %%esi\n\t"
"cmpb $0,-1(%%eax)\n\t"
"jne 1b\n\t"
"xorl %%eax,%%eax\n\t"
"2:"
:"=a" (__res):"0" (0),"c" (0xffffffff),"S" (cs),"g" (ct)
:"cx","dx","di","si");
return __res;
}
extern inline size_t strlen(const char * s)
{
register int __res;
__asm__ __volatile__(
"cld\n\t"
"repne\n\t"
"scasb\n\t"
"notl %0\n\t"
"decl %0"
:"=c" (__res):"D" (s),"a" (0),"0" (0xffffffff):"di");
return __res;
}
extern char * ___strtok;
extern inline char * strtok(char * s,const char * ct)
{
register char * __res;
__asm__ __volatile__(
"testl %1,%1\n\t"
"jne 1f\n\t"
"testl %0,%0\n\t"
"je 8f\n\t"
"movl %0,%1\n"
"1:\txorl %0,%0\n\t"
"movl $-1,%%ecx\n\t"
"xorl %%eax,%%eax\n\t"
"cld\n\t"
"movl %4,%%edi\n\t"
"repne\n\t"
"scasb\n\t"
"notl %%ecx\n\t"
"decl %%ecx\n\t"
"je 7f\n\t" /* empty delimeter-string */
"movl %%ecx,%%edx\n"
"2:\tlodsb\n\t"
"testb %%al,%%al\n\t"
"je 7f\n\t"
"movl %4,%%edi\n\t"
"movl %%edx,%%ecx\n\t"
"repne\n\t"
"scasb\n\t"
"je 2b\n\t"
"decl %1\n\t"
"cmpb $0,(%1)\n\t"
"je 7f\n\t"
"movl %1,%0\n"
"3:\tlodsb\n\t"
"testb %%al,%%al\n\t"
"je 5f\n\t"
"movl %4,%%edi\n\t"
"movl %%edx,%%ecx\n\t"
"repne\n\t"
"scasb\n\t"
"jne 3b\n\t"
"decl %1\n\t"
"cmpb $0,(%1)\n\t"
"je 5f\n\t"
"movb $0,(%1)\n\t"
"incl %1\n\t"
"jmp 6f\n"
"5:\txorl %1,%1\n"
"6:\tcmpb $0,(%0)\n\t"
"jne 7f\n\t"
"xorl %0,%0\n"
"7:\ttestl %0,%0\n\t"
"jne 8f\n\t"
"movl %0,%1\n"
"8:"
:"=b" (__res),"=S" (___strtok)
:"0" (___strtok),"1" (s),"g" (ct)
:"ax","cx","dx","di","memory");
return __res;
}
extern inline void * memcpy(void * to, const void * from, size_t n)
{
__asm__ __volatile__(
"cld\n\t"
"movl %%edx, %%ecx\n\t"
"shrl $2,%%ecx\n\t"
"rep ; movsl\n\t"
"testb $1,%%dl\n\t"
"je 1f\n\t"
"movsb\n"
"1:\ttestb $2,%%dl\n\t"
"je 2f\n\t"
"movsw\n"
"2:\n"
: /* no output */
:"d" (n),"D" ((long) to),"S" ((long) from)
: "cx","di","si","memory");
return (to);
}
extern inline void * memmove(void * dest,const void * src, size_t n)
{
if (dest<src)
__asm__ __volatile__(
"cld\n\t"
"rep\n\t"
"movsb"
: /* no output */
:"c" (n),"S" (src),"D" (dest)
:"cx","si","di");
else
__asm__ __volatile__(
"std\n\t"
"rep\n\t"
"movsb\n\t"
"cld"
: /* no output */
:"c" (n),
"S" (n-1+(const char *)src),
"D" (n-1+(char *)dest)
:"cx","si","di","memory");
return dest;
}
extern inline int memcmp(const void * cs,const void * ct,size_t count)
{
register int __res;
__asm__ __volatile__(
"cld\n\t"
"repe\n\t"
"cmpsb\n\t"
"je 1f\n\t"
"sbbl %%eax,%%eax\n\t"
"orb $1,%%al\n"
"1:"
:"=a" (__res):"0" (0),"S" (cs),"D" (ct),"c" (count)
:"si","di","cx");
return __res;
}
extern inline void * memchr(const void * cs,char c,size_t count)
{
register void * __res;
if (!count)
return NULL;
__asm__ __volatile__(
"cld\n\t"
"repne\n\t"
"scasb\n\t"
"je 1f\n\t"
"movl $1,%0\n"
"1:\tdecl %0"
:"=D" (__res):"a" (c),"D" (cs),"c" (count)
:"cx");
return __res;
}
extern inline void * memset(void * s,char c,size_t count)
{
__asm__ __volatile__(
"cld\n\t"
"rep\n\t"
"stosb"
: /* no output */
:"a" (c),"D" (s),"c" (count)
:"cx","di","memory");
return s;
}
#endif
......@@ -9,29 +9,6 @@
extern unsigned long loops_per_sec;
extern __inline__ void __delay(int loops)
{
__asm__(".align 2,0x90\n1:\tdecl %0\n\tjns 1b": :"a" (loops):"ax");
}
#include <asm/delay.h>
/*
* division by multiplication: you don't have to worry about
* loss of precision.
*
* Use only for very small delays ( < 1 msec). Should probably use a
* lookup table, really, as the multiplications take much too long with
* short delays. This is a "reasonable" implementation, though (and the
* first constant multiplications gets optimized away if the delay is
* a constant)
*/
extern __inline__ void udelay(unsigned long usecs)
{
usecs *= 0x000010c6; /* 2**32 / 1000000 */
__asm__("mull %0"
:"=d" (usecs)
:"a" (usecs),"0" (loops_per_sec)
:"ax");
__delay(usecs);
}
#endif
#endif /* defined(_LINUX_DELAY_H) */
......@@ -7,18 +7,21 @@
*/
#ifdef FDPATCHES
#define FD_IOPORT fdc_state[fdc].address
/* Fd controller regs. S&C, about page 340 */
#define FD_STATUS (4 + fdc_state[fdc].address )
#define FD_DATA (5 + fdc_state[fdc].address )
#define FD_STATUS (4 + FD_IOPORT )
#define FD_DATA (5 + FD_IOPORT )
/* Digital Output Register */
#define FD_DOR (2 + fdc_state[fdc].address )
#define FD_DOR (2 + FD_IOPORT )
/* Digital Input Register (read) */
#define FD_DIR (7 + fdc_state[fdc].address )
#define FD_DIR (7 + FD_IOPORT )
/* Diskette Control Register (write)*/
#define FD_DCR (7 + fdc_state[fdc].address )
#define FD_DCR (7 + FD_IOPORT )
#else
......
......@@ -11,36 +11,21 @@
extern "C" {
#endif
#ifdef i386
#include <asm/string.h> /* inline functions for i386.. */
#else
extern char * strcpy(char *, const char *);
extern char * strncpy(char *, const char *, size_t);
extern char * strcat(char *, const char *);
extern char * strncat(char *, const char *, size_t);
extern int strcmp(const char *, const char *);
extern int strncmp(const char *, const char *, size_t);
extern char * strchr(const char *, char);
extern char * strrchr(const char *, char);
extern size_t strspn(const char *, const char *);
extern size_t strcspn(const char *, const char *);
extern char * strpbrk(const char *, const char *);
extern char * strstr(const char *, const char *);
extern size_t strlen(const char *);
extern char * strtok(char *, const char *);
extern void * memcpy(void *, const void *, size_t);
extern void * memmove(void *, const void *, size_t);
extern int memcmp(const void *, const void *, size_t);
extern void * memchr(const void *, char, size_t);
extern void * memset(void *, char, size_t);
/*
* Include machine specific inline routines
*/
#include <asm/string.h>
#ifdef __USE_PORTABLE_STRINGS_H_
/*
* include/generic/string.h imports all the string functions,
* for which no appropriate assembler replacements have been provided.
*/
#include <asm-generic/string.h>
#endif
#ifdef __cplusplus
}
#endif
#endif
#endif /* _LINUX_STRING_H_ */
#ifndef _LINUX_UNISTD_H
#define _LINUX_UNISTD_H
#ifndef _LINUX_UNISTD_H_
#define _LINUX_UNISTD_H_
/*
* This file contains the system call numbers and the syscallX
* macros
* This file contains the system call numbers.
*/
#define __NR_setup 0 /* used only by init, to get system going */
......@@ -149,85 +148,9 @@
extern int errno;
/* XXX - _foo needs to be __foo, while __NR_bar could be _NR_bar. */
#define _syscall0(type,name) \
type name(void) \
{ \
long __res; \
__asm__ volatile ("int $0x80" \
: "=a" (__res) \
: "0" (__NR_##name)); \
if (__res >= 0) \
return (type) __res; \
errno = -__res; \
return -1; \
}
#define _syscall1(type,name,atype,a) \
type name(atype a) \
{ \
long __res; \
__asm__ volatile ("int $0x80" \
: "=a" (__res) \
: "0" (__NR_##name),"b" ((long)(a))); \
if (__res >= 0) \
return (type) __res; \
errno = -__res; \
return -1; \
}
#define _syscall2(type,name,atype,a,btype,b) \
type name(atype a,btype b) \
{ \
long __res; \
__asm__ volatile ("int $0x80" \
: "=a" (__res) \
: "0" (__NR_##name),"b" ((long)(a)),"c" ((long)(b))); \
if (__res >= 0) \
return (type) __res; \
errno = -__res; \
return -1; \
}
#define _syscall3(type,name,atype,a,btype,b,ctype,c) \
type name(atype a,btype b,ctype c) \
{ \
long __res; \
__asm__ volatile ("int $0x80" \
: "=a" (__res) \
: "0" (__NR_##name),"b" ((long)(a)),"c" ((long)(b)),"d" ((long)(c))); \
if (__res>=0) \
return (type) __res; \
errno=-__res; \
return -1; \
}
#define _syscall4(type,name,atype,a,btype,b,ctype,c,dtype,d) \
type name (atype a, btype b, ctype c, dtype d) \
{ \
long __res; \
__asm__ volatile ("int $0x80" \
: "=a" (__res) \
: "0" (__NR_##name),"b" ((long)(a)),"c" ((long)(b)), \
"d" ((long)(c)),"S" ((long)(d))); \
if (__res>=0) \
return (type) __res; \
errno=-__res; \
return -1; \
}
#define _syscall5(type,name,atype,a,btype,b,ctype,c,dtype,d,etype,e) \
type name (atype a,btype b,ctype c,dtype d,etype e) \
{ \
long __res; \
__asm__ volatile ("int $0x80" \
: "=a" (__res) \
: "0" (__NR_##name),"b" ((long)(a)),"c" ((long)(b)), \
"d" ((long)(c)),"S" ((long)(d)),"D" ((long)(e))); \
if (__res>=0) \
return (type) __res; \
errno=-__res; \
return -1; \
}
/*
* Include machine specific syscallX macros
*/
#include <asm/unistd.h>
#endif /* _LINUX_UNISTD_H */
#endif /* _LINUX_UNISTD_H_ */
......@@ -486,11 +486,6 @@ asmlinkage void start_kernel(void)
printk("Ok, fpu using %s error reporting.\n",
ignore_irq13?"exception 16":"irq13");
}
if (hlt_works_ok) {
printk("Checking 'hlt' instruction... ");
__asm__ __volatile__("hlt ; hlt ; hlt ; hlt");
printk(" Ok.\n");
}
#ifndef CONFIG_MATH_EMULATION
else {
printk("No coprocessor found and no math emulation present.\n");
......@@ -498,6 +493,11 @@ asmlinkage void start_kernel(void)
for (;;) ;
}
#endif
if (hlt_works_ok) {
printk("Checking 'hlt' instruction... ");
__asm__ __volatile__("hlt ; hlt ; hlt ; hlt");
printk(" Ok.\n");
}
system_utsname.machine[1] = '0' + x86;
printk(linux_banner);
......
......@@ -256,7 +256,7 @@ int pcibios_read_config_byte(unsigned char bus,
"jc 1f\n\t"
"xor %%ah, %%ah\n"
"1:"
: "=cb" (*value),
: "=c" (*value),
"=a" (ret)
: "1" (PCIBIOS_READ_CONFIG_BYTE),
"b" (bx),
......@@ -278,7 +278,7 @@ int pcibios_read_config_word (unsigned char bus,
: "=c" (*value),
"=a" (ret)
: "1" (PCIBIOS_READ_CONFIG_WORD),
"bx" (bx),
"b" (bx),
"D" ((long) where),
"S" (&pci_indirect));
return (int) (ret & 0xff00) >> 8;
......@@ -294,10 +294,10 @@ int pcibios_read_config_dword (unsigned char bus,
"jc 1f\n\t"
"xor %%ah, %%ah\n"
"1:"
: "=ecx" (*value),
"=ax" (ret)
: "=c" (*value),
"=a" (ret)
: "1" (PCIBIOS_READ_CONFIG_DWORD),
"bx" (bx),
"b" (bx),
"D" ((long) where),
"S" (&pci_indirect));
return (int) (ret & 0xff00) >> 8;
......@@ -313,7 +313,7 @@ int pcibios_write_config_byte (unsigned char bus,
"jc 1f\n\t"
"xor %%ah, %%ah\n"
"1:"
: "=ax" (ret)
: "=a" (ret)
: "0" (PCIBIOS_WRITE_CONFIG_BYTE),
"c" (value),
"b" (bx),
......@@ -332,10 +332,10 @@ int pcibios_write_config_word (unsigned char bus,
"jc 1f\n\t"
"xor %%ah, %%ah\n"
"1:"
: "=ax" (ret)
: "=a" (ret)
: "0" (PCIBIOS_WRITE_CONFIG_WORD),
"cx" (value),
"bx" (bx),
"c" (value),
"b" (bx),
"D" ((long) where),
"S" (&pci_indirect));
return (int) (ret & 0xff00) >> 8;
......@@ -351,7 +351,7 @@ int pcibios_write_config_dword (unsigned char bus,
"jc 1f\n\t"
"xor %%ah, %%ah\n"
"1:"
: "=ax" (ret)
: "=a" (ret)
: "0" (PCIBIOS_WRITE_CONFIG_DWORD),
"c" (value),
"b" (bx),
......
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