diff -u --recursive --new-file v1.1.44/linux/Makefile linux/Makefile --- v1.1.44/linux/Makefile Mon Aug 15 11:47:05 1994 +++ linux/Makefile Mon Aug 15 12:19:57 1994 @@ -1,7 +1,9 @@ VERSION = 1 PATCHLEVEL = 1 -SUBLEVEL = 44 +SUBLEVEL = 45 +ARCH = i386 + all: Version zImage .EXPORT_ALL_VARIABLES: @@ -26,10 +28,6 @@ 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 @@ 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 @@ #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 @@ 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 @@ 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 @@ 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 @@ 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 @@ # # 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 diff -u --recursive --new-file v1.1.44/linux/arch/i386/Makefile linux/arch/i386/Makefile --- v1.1.44/linux/arch/i386/Makefile Thu Jan 1 02:00:00 1970 +++ linux/arch/i386/Makefile Mon Aug 15 11:06:02 1994 @@ -0,0 +1,108 @@ +# +# 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 diff -u --recursive --new-file v1.1.44/linux/arch/i386/boot/bootsect.S linux/arch/i386/boot/bootsect.S --- v1.1.44/linux/arch/i386/boot/bootsect.S Thu Jan 1 02:00:00 1970 +++ linux/arch/i386/boot/bootsect.S Wed Aug 10 19:23:01 1994 @@ -0,0 +1,460 @@ +! +! SYS_SIZE is the number of clicks (16 bytes) to be loaded. +! 0x7F00 is 0x7F000 bytes = 508kB, more than enough for current +! versions of linux which compress the kernel +! +#include +SYSSIZE = DEF_SYSSIZE +! +! bootsect.s Copyright (C) 1991, 1992 Linus Torvalds +! modified by Drew Eckhardt +! modified by Bruce Evans (bde) +! +! bootsect.s is loaded at 0x7c00 by the bios-startup routines, and moves +! itself out of the way to address 0x90000, and jumps there. +! +! bde - should not jump blindly, there may be systems with only 512K low +! memory. Use int 0x12 to get the top of memory, etc. +! +! It then loads 'setup' directly after itself (0x90200), and the system +! at 0x10000, using BIOS interrupts. +! +! NOTE! currently system is at most (8*65536-4096) bytes long. This should +! be no problem, even in the future. I want to keep it simple. This 508 kB +! kernel size should be enough, especially as this doesn't contain the +! buffer cache as in minix (and especially now that the kernel is +! compressed :-) +! +! The loader has been made as simple as possible, and continuous +! read errors will result in a unbreakable loop. Reboot by hand. It +! loads pretty fast by getting whole tracks at a time whenever possible. + +.text + +SETUPSECS = 4 ! nr of setup-sectors +BOOTSEG = 0x07C0 ! original address of boot-sector +INITSEG = DEF_INITSEG ! we move boot here - out of the way +SETUPSEG = DEF_SETUPSEG ! setup starts here +SYSSEG = DEF_SYSSEG ! system loaded at 0x10000 (65536). + +! ROOT_DEV & SWAP_DEV are now written by "build". +ROOT_DEV = 0 +SWAP_DEV = 0 +#ifndef SVGA_MODE +#define SVGA_MODE ASK_VGA +#endif +#ifndef RAMDISK +#define RAMDISK 0 +#endif +#ifndef CONFIG_ROOT_RDONLY +#define CONFIG_ROOT_RDONLY 0 +#endif + +! ld86 requires an entry symbol. This may as well be the usual one. +.globl _main +_main: +#if 0 /* hook for debugger, harmless unless BIOS is fussy (old HP) */ + int 3 +#endif + mov ax,#BOOTSEG + mov ds,ax + mov ax,#INITSEG + mov es,ax + mov cx,#256 + sub si,si + sub di,di + cld + rep + movsw + jmpi go,INITSEG + +! ax and es already contain INITSEG + +go: mov di,#0x4000-12 ! 0x4000 is arbitrary value >= length of + ! bootsect + length of setup + room for stack + ! 12 is disk parm size + +! bde - changed 0xff00 to 0x4000 to use debugger at 0x6400 up (bde). We +! wouldn't have to worry about this if we checked the top of memory. Also +! my BIOS can be configured to put the wini drive tables in high memory +! instead of in the vector table. The old stack might have clobbered the +! drive table. + + mov ds,ax + mov ss,ax ! put stack at INITSEG:0x4000-12. + mov sp,di +/* + * Many BIOS's default disk parameter tables will not + * recognize multi-sector reads beyond the maximum sector number + * specified in the default diskette parameter tables - this may + * mean 7 sectors in some cases. + * + * Since single sector reads are slow and out of the question, + * we must take care of this by creating new parameter tables + * (for the first disk) in RAM. We will set the maximum sector + * count to 36 - the most we will encounter on an ED 2.88. + * + * High doesn't hurt. Low does. + * + * Segments are as follows: ds=es=ss=cs - INITSEG, + * fs = 0, gs is unused. + */ + +! cx contains 0 from rep movsw above + + mov fs,cx + mov bx,#0x78 ! fs:bx is parameter table address + push ds + seg fs + lds si,(bx) ! ds:si is source + + mov cl,#6 ! copy 12 bytes + cld + push di + + rep + movsw + + pop di + pop ds + + movb 4(di),*36 ! patch sector count + + seg fs + mov (bx),di + seg fs + mov 2(bx),es + +! load the setup-sectors directly after the bootblock. +! Note that 'es' is already set up. +! Also cx is 0 from rep movsw above. + +load_setup: + xor ah,ah ! reset FDC + xor dl,dl + int 0x13 + + xor dx, dx ! drive 0, head 0 + mov cl,#0x02 ! sector 2, track 0 + mov bx,#0x0200 ! address = 512, in INITSEG + mov ah,#0x02 ! service 2, nr of sectors + mov al,setup_sects ! (assume all on head 0, track 0) + int 0x13 ! read it + jnc ok_load_setup ! ok - continue + + push ax ! dump error code + call print_nl + mov bp, sp + call print_hex + pop ax + + jmp load_setup + +ok_load_setup: + +! Get disk drive parameters, specifically nr of sectors/track + +#if 0 + +! bde - the Phoenix BIOS manual says function 0x08 only works for fixed +! disks. It doesn't work for one of my BIOS's (1987 Award). It was +! fatal not to check the error code. + + xor dl,dl + mov ah,#0x08 ! AH=8 is get drive parameters + int 0x13 + xor ch,ch +#else + +! It seems that there is no BIOS call to get the number of sectors. Guess +! 36 sectors if sector 36 can be read, 18 sectors if sector 18 can be read, +! 15 if sector 15 can be read. Otherwise guess 9. + + mov si,#disksizes ! table of sizes to try + +probe_loop: + lodsb + cbw ! extend to word + mov sectors, ax + cmp si,#disksizes+4 + jae got_sectors ! if all else fails, try 9 + xchg ax, cx ! cx = track and sector + xor dx, dx ! drive 0, head 0 + xor bl, bl + mov bh,setup_sects + inc bh + shl bh,#1 ! address after setup (es = cs) + mov ax,#0x0201 ! service 2, 1 sector + int 0x13 + jc probe_loop ! try next value + +#endif + +got_sectors: + +! Restore es + + mov ax,#INITSEG + mov es,ax + +! Print some inane message + + mov ah,#0x03 ! read cursor pos + xor bh,bh + int 0x10 + + mov cx,#9 + mov bx,#0x0007 ! page 0, attribute 7 (normal) + mov bp,#msg1 + mov ax,#0x1301 ! write string, move cursor + int 0x10 + +! ok, we've written the message, now +! we want to load the system (at 0x10000) + + mov ax,#SYSSEG + mov es,ax ! segment of 0x010000 + call read_it + call kill_motor + call print_nl + +! After that we check which root-device to use. If the device is +! defined (!= 0), nothing is done and the given device is used. +! Otherwise, one of /dev/fd0H2880 (2,32) or /dev/PS0 (2,28) or /dev/at0 (2,8), +! depending on the number of sectors we pretend to know we have. + + seg cs + mov ax,root_dev + or ax,ax + jne root_defined + seg cs + mov bx,sectors + mov ax,#0x0208 ! /dev/ps0 - 1.2Mb + cmp bx,#15 + je root_defined + mov al,#0x1c ! /dev/PS0 - 1.44Mb + cmp bx,#18 + je root_defined + mov al,#0x20 ! /dev/fd0H2880 - 2.88Mb + cmp bx,#36 + je root_defined + mov al,#0 ! /dev/fd0 - autodetect +root_defined: + seg cs + mov root_dev,ax + +! after that (everything loaded), we jump to +! the setup-routine loaded directly after +! the bootblock: + + jmpi 0,SETUPSEG + +! This routine loads the system at address 0x10000, making sure +! no 64kB boundaries are crossed. We try to load it as fast as +! possible, loading whole tracks whenever we can. +! +! in: es - starting address segment (normally 0x1000) +! +sread: .word 0 ! sectors read of current track +head: .word 0 ! current head +track: .word 0 ! current track + +read_it: + mov al,setup_sects + inc al + mov sread,al + mov ax,es + test ax,#0x0fff +die: jne die ! es must be at 64kB boundary + xor bx,bx ! bx is starting address within segment +rp_read: + mov ax,es + sub ax,#SYSSEG + cmp ax,syssize ! have we loaded all yet? + jbe ok1_read + ret +ok1_read: + mov ax,sectors + sub ax,sread + mov cx,ax + shl cx,#9 + add cx,bx + jnc ok2_read + je ok2_read + xor ax,ax + sub ax,bx + shr ax,#9 +ok2_read: + call read_track + mov cx,ax + add ax,sread + cmp ax,sectors + jne ok3_read + mov ax,#1 + sub ax,head + jne ok4_read + inc track +ok4_read: + mov head,ax + xor ax,ax +ok3_read: + mov sread,ax + shl cx,#9 + add bx,cx + jnc rp_read + mov ax,es + add ah,#0x10 + mov es,ax + xor bx,bx + jmp rp_read + +read_track: + pusha + pusha + mov ax, #0xe2e ! loading... message 2e = . + mov bx, #7 + int 0x10 + popa + + mov dx,track + mov cx,sread + inc cx + mov ch,dl + mov dx,head + mov dh,dl + and dx,#0x0100 + mov ah,#2 + + push dx ! save for error dump + push cx + push bx + push ax + + int 0x13 + jc bad_rt + add sp, #8 + popa + ret + +bad_rt: push ax ! save error code + call print_all ! ah = error, al = read + + + xor ah,ah + xor dl,dl + int 0x13 + + + add sp, #10 + popa + jmp read_track + +/* + * print_all is for debugging purposes. + * It will print out all of the registers. The assumption is that this is + * called from a routine, with a stack frame like + * dx + * cx + * bx + * ax + * error + * ret <- sp + * +*/ + +print_all: + mov cx, #5 ! error code + 4 registers + mov bp, sp + +print_loop: + push cx ! save count left + call print_nl ! nl for readability + + cmp cl, #5 + jae no_reg ! see if register name is needed + + mov ax, #0xe05 + 'A - 1 + sub al, cl + int 0x10 + + mov al, #'X + int 0x10 + + mov al, #': + int 0x10 + +no_reg: + add bp, #2 ! next register + call print_hex ! print it + pop cx + loop print_loop + ret + +print_nl: + mov ax, #0xe0d ! CR + int 0x10 + mov al, #0xa ! LF + int 0x10 + ret + +/* + * print_hex is for debugging purposes, and prints the word + * pointed to by ss:bp in hexadecimal. +*/ + +print_hex: + mov cx, #4 ! 4 hex digits + mov dx, (bp) ! load word into dx +print_digit: + rol dx, #4 ! rotate so that lowest 4 bits are used + mov ax, #0xe0f ! ah = request, al = mask for nybble + and al, dl + add al, #0x90 ! convert al to ascii hex (four instructions) + daa + adc al, #0x40 + daa + int 0x10 + loop print_digit + ret + + +/* + * This procedure turns off the floppy drive motor, so + * that we enter the kernel in a known state, and + * don't have to worry about it later. + */ +kill_motor: + push dx + mov dx,#0x3f2 + xor al, al + outb + pop dx + ret + +sectors: + .word 0 + +disksizes: + .byte 36,18,15,9 + +msg1: + .byte 13,10 + .ascii "Loading" + +.org 497 +setup_sects: + .byte SETUPSECS +root_flags: + .word CONFIG_ROOT_RDONLY +syssize: + .word SYSSIZE +swap_dev: + .word SWAP_DEV +ram_size: + .word RAMDISK +vid_mode: + .word SVGA_MODE +root_dev: + .word ROOT_DEV +boot_flag: + .word 0xAA55 diff -u --recursive --new-file v1.1.44/linux/arch/i386/boot/head.S linux/arch/i386/boot/head.S --- v1.1.44/linux/arch/i386/boot/head.S Thu Jan 1 02:00:00 1970 +++ linux/arch/i386/boot/head.S Sun Aug 7 00:46:56 1994 @@ -0,0 +1,349 @@ +/* + * linux/boot/head.S + * + * Copyright (C) 1991, 1992 Linus Torvalds + */ + +/* + * head.S contains the 32-bit startup code. + */ + +.text +.globl _idt,_gdt, +.globl _swapper_pg_dir,_pg0 +.globl _empty_bad_page +.globl _empty_bad_page_table +.globl _empty_zero_page +.globl _floppy_track_buffer + +#include +#include +#define ASSEMBLER +#include + +#define CL_MAGIC_ADDR 0x90020 +#define CL_MAGIC 0xA33F +#define CL_BASE_ADDR 0x90000 +#define CL_OFFSET 0x90022 + +/* + * swapper_pg_dir is the main page directory, address 0x00001000 (or at + * address 0x00101000 for a compressed boot). + */ +startup_32: + cld + movl $(KERNEL_DS),%eax + mov %ax,%ds + mov %ax,%es + mov %ax,%fs + mov %ax,%gs + lss _stack_start,%esp +/* + * Clear BSS first so that there are no surprises... + */ + xorl %eax,%eax + movl $__edata,%edi + movl $__end,%ecx + subl %edi,%ecx + cld + rep + stosb +/* + * start system 32-bit setup. We need to re-do some of the things done + * in 16-bit mode for the "real" operations. + */ + call setup_idt + xorl %eax,%eax +1: incl %eax # check that A20 really IS enabled + movl %eax,0x000000 # loop forever if it isn't + cmpl %eax,0x100000 + je 1b +/* + * Initialize eflags. Some BIOS's leave bits like NT set. This would + * confuse the debugger if this code is traced. + * XXX - best to initialize before switching to protected mode. + */ + pushl $0 + popfl +/* + * Copy bootup parameters out of the way. First 2kB of + * _empty_zero_page is for boot parameters, second 2kB + * is for the command line. + */ + movl $0x90000,%esi + movl $_empty_zero_page,%edi + movl $512,%ecx + cld + rep + movsl + xorl %eax,%eax + movl $512,%ecx + rep + stosl + cmpw $(CL_MAGIC),CL_MAGIC_ADDR + jne 1f + movl $_empty_zero_page+2048,%edi + movzwl CL_OFFSET,%esi + addl $(CL_BASE_ADDR),%esi + movl $2048,%ecx + rep + movsb +1: +/* check if it is 486 or 386. */ +/* + * XXX - this does a lot of unnecessary setup. Alignment checks don't + * apply at our cpl of 0 and the stack ought to be aligned already, and + * we don't need to preserve eflags. + */ + movl %esp,%edi # save stack pointer + andl $0xfffffffc,%esp # align stack to avoid AC fault + movl $3,_x86 + pushfl # push EFLAGS + popl %eax # get EFLAGS + movl %eax,%ecx # save original EFLAGS + xorl $0x40000,%eax # flip AC bit in EFLAGS + pushl %eax # copy to EFLAGS + popfl # set EFLAGS + pushfl # get new EFLAGS + popl %eax # put it in eax + xorl %ecx,%eax # change in flags + andl $0x40000,%eax # check if AC bit changed + je is386 + movl $4,_x86 + movl %ecx,%eax + xorl $0x200000,%eax # check ID flag + pushl %eax + popfl # if we are on a straight 486DX, SX, or + pushfl # 487SX we can't change it + popl %eax + xorl %ecx,%eax + andl $0x200000,%eax + je is486 +isnew: pushl %ecx # restore original EFLAGS + popfl + movl $1, %eax # Use the CPUID instruction to + .byte 0x0f, 0xa2 # check the processor type + andl $0xf00, %eax # Set _x86 with the family + shrl $8, %eax # returned. + movl %eax, _x86 + movl %edi,%esp # restore esp + movl %cr0,%eax # 486+ + andl $0x80000011,%eax # Save PG,PE,ET + orl $0x50022,%eax # set AM, WP, NE and MP + jmp 2f +is486: pushl %ecx # restore original EFLAGS + popfl + movl %edi,%esp # restore esp + movl %cr0,%eax # 486 + andl $0x80000011,%eax # Save PG,PE,ET + orl $0x50022,%eax # set AM, WP, NE and MP + jmp 2f +is386: pushl %ecx # restore original EFLAGS + popfl + movl %edi,%esp # restore esp + movl %cr0,%eax # 386 + andl $0x80000011,%eax # Save PG,PE,ET + orl $2,%eax # set MP +2: movl %eax,%cr0 + call check_x87 + call setup_paging + lgdt gdt_descr + lidt idt_descr + ljmp $(KERNEL_CS),$1f +1: movl $(KERNEL_DS),%eax # reload all the segment registers + mov %ax,%ds # after changing gdt. + mov %ax,%es + mov %ax,%fs + mov %ax,%gs + lss _stack_start,%esp + xorl %eax,%eax + lldt %ax + pushl %eax # These are the parameters to main :-) + pushl %eax + pushl %eax + cld # gcc2 wants the direction flag cleared at all times + call _start_kernel +L6: + jmp L6 # main should never return here, but + # just in case, we know what happens. + +/* + * We depend on ET to be correct. This checks for 287/387. + */ +check_x87: + movl $0,_hard_math + clts + fninit + fstsw %ax + cmpb $0,%al + je 1f + movl %cr0,%eax /* no coprocessor: have to set bits */ + xorl $4,%eax /* set EM */ + movl %eax,%cr0 + ret +.align 2 +1: movl $1,_hard_math + .byte 0xDB,0xE4 /* fsetpm for 287, ignored by 387 */ + ret + +/* + * setup_idt + * + * sets up a idt with 256 entries pointing to + * ignore_int, interrupt gates. It doesn't actually load + * idt - that can be done only after paging has been enabled + * and the kernel moved to 0xC0000000. Interrupts + * are enabled elsewhere, when we can be relatively + * sure everything is ok. + */ +setup_idt: + lea ignore_int,%edx + movl $(KERNEL_CS << 16),%eax + movw %dx,%ax /* selector = 0x0010 = cs */ + movw $0x8E00,%dx /* interrupt gate - dpl=0, present */ + + lea _idt,%edi + mov $256,%ecx +rp_sidt: + movl %eax,(%edi) + movl %edx,4(%edi) + addl $8,%edi + dec %ecx + jne rp_sidt + ret + + +/* + * Setup_paging + * + * This routine sets up paging by setting the page bit + * in cr0. The page tables are set up, identity-mapping + * the first 4MB. The rest are initialized later. + * + * (ref: added support for up to 32mb, 17Apr92) -- Rik Faith + * (ref: update, 25Sept92) -- croutons@crunchy.uucp + * (ref: 92.10.11 - Linus Torvalds. Corrected 16M limit - no upper memory limit) + */ +.align 2 +setup_paging: + movl $1024*2,%ecx /* 2 pages - swapper_pg_dir+1 page table */ + xorl %eax,%eax + movl $_swapper_pg_dir,%edi /* swapper_pg_dir is at 0x1000 */ + cld;rep;stosl +/* Identity-map the kernel in low 4MB memory for ease of transition */ + movl $_pg0+7,_swapper_pg_dir /* set present bit/user r/w */ +/* But the real place is at 0xC0000000 */ + movl $_pg0+7,_swapper_pg_dir+3072 /* set present bit/user r/w */ + movl $_pg0+4092,%edi + movl $0x03ff007,%eax /* 4Mb - 4096 + 7 (r/w user,p) */ + std +1: stosl /* fill the page backwards - more efficient :-) */ + subl $0x1000,%eax + jge 1b + cld + movl $_swapper_pg_dir,%eax + movl %eax,%cr3 /* cr3 - page directory start */ + movl %cr0,%eax + orl $0x80000000,%eax + movl %eax,%cr0 /* set paging (PG) bit */ + ret /* this also flushes the prefetch-queue */ + +/* + * page 0 is made non-existent, so that kernel NULL pointer references get + * caught. Thus the swapper page directory has been moved to 0x1000 + * + * XXX Actually, the swapper page directory is at 0x1000 plus 1 megabyte, + * with the introduction of the compressed boot code. Theoretically, + * the original design of overlaying the startup code with the swapper + * page directory is still possible --- it would reduce the size of the kernel + * by 2-3k. This would be a good thing to do at some point..... + */ +.org 0x1000 +_swapper_pg_dir: +/* + * The page tables are initialized to only 4MB here - the final page + * tables are set up later depending on memory size. + */ +.org 0x2000 +_pg0: + +.org 0x3000 +_empty_bad_page: + +.org 0x4000 +_empty_bad_page_table: + +.org 0x5000 +_empty_zero_page: + +.org 0x6000 +/* + * floppy_track_buffer is used to buffer one track of floppy data: it + * has to be separate from the tmp_floppy area, as otherwise a single- + * sector read/write can mess it up. It can contain one full cylinder (sic) of + * data (36*2*512 bytes). + */ +_floppy_track_buffer: + .fill 512*2*MAX_BUFFER_SECTORS,1,0 + +/* This is the default interrupt "handler" :-) */ +int_msg: + .asciz "Unknown interrupt\n" +.align 2 +ignore_int: + cld + pushl %eax + pushl %ecx + pushl %edx + push %ds + push %es + push %fs + movl $(KERNEL_DS),%eax + mov %ax,%ds + mov %ax,%es + mov %ax,%fs + pushl $int_msg + call _printk + popl %eax + pop %fs + pop %es + pop %ds + popl %edx + popl %ecx + popl %eax + iret + +/* + * The interrupt descriptor table has room for 256 idt's + */ +.align 4 +.word 0 +idt_descr: + .word 256*8-1 # idt contains 256 entries + .long 0xc0000000+_idt + +.align 4 +_idt: + .fill 256,8,0 # idt is uninitialized + +.align 4 +.word 0 +gdt_descr: + .word (8+2*NR_TASKS)*8-1 + .long 0xc0000000+_gdt + +/* + * This gdt setup gives the kernel a 1GB address space at virtual + * address 0xC0000000 - space enough for expansion, I hope. + */ +.align 4 +_gdt: + .quad 0x0000000000000000 /* NULL descriptor */ + .quad 0x0000000000000000 /* not used */ + .quad 0xc0c39a000000ffff /* 0x10 kernel 1GB code at 0xC0000000 */ + .quad 0xc0c392000000ffff /* 0x18 kernel 1GB data at 0xC0000000 */ + .quad 0x00cbfa000000ffff /* 0x23 user 3GB code at 0x00000000 */ + .quad 0x00cbf2000000ffff /* 0x2b user 3GB data at 0x00000000 */ + .quad 0x0000000000000000 /* not used */ + .quad 0x0000000000000000 /* not used */ + .fill 2*NR_TASKS,8,0 /* space for LDT's and TSS's etc */ diff -u --recursive --new-file v1.1.44/linux/arch/i386/boot/setup.S linux/arch/i386/boot/setup.S --- v1.1.44/linux/arch/i386/boot/setup.S Thu Jan 1 02:00:00 1970 +++ linux/arch/i386/boot/setup.S Fri Aug 12 13:04:50 1994 @@ -0,0 +1,1005 @@ +! +! setup.S Copyright (C) 1991, 1992 Linus Torvalds +! +! setup.s is responsible for getting the system data from the BIOS, +! and putting them into the appropriate places in system memory. +! both setup.s and system has been loaded by the bootblock. +! +! This code asks the bios for memory/disk/other parameters, and +! puts them in a "safe" place: 0x90000-0x901FF, ie where the +! boot-block used to be. It is then up to the protected mode +! system to read them from there before the area is overwritten +! for buffer-blocks. +! +! Move PS/2 aux init code to psaux.c +! (troyer@saifr00.cfsat.Honeywell.COM) 03Oct92 +! +! some changes and additional features by Christoph Niemann, +! March 1993/June 1994 (Christoph.Niemann@linux.org) +! + +! NOTE! These had better be the same as in bootsect.s! +#include +#include + +#ifndef SVGA_MODE +#define SVGA_MODE ASK_VGA +#endif + +! Signature words to ensure LILO loaded us right +#define SIG1 0xAA55 +#define SIG2 0x5A5A + +INITSEG = DEF_INITSEG ! we move boot here - out of the way +SYSSEG = DEF_SYSSEG ! system loaded at 0x10000 (65536). +SETUPSEG = DEF_SETUPSEG ! this is the current segment + +.globl begtext, begdata, begbss, endtext, enddata, endbss +.text +begtext: +.data +begdata: +.bss +begbss: +.text + +entry start +start: +! Check signature at end of setup + mov ax,#SETUPSEG + mov ds,ax + cmp setup_sig1,#SIG1 + jne bad_sig + cmp setup_sig2,#SIG2 + jne bad_sig + jmp good_sig1 + +! Routine to print asciiz-string at DS:SI + +prtstr: lodsb + and al,al + jz fin + call prnt1 + jmp prtstr +fin: ret + +! Part of above routine, this one just prints ascii al + +prnt1: push ax + push cx + xor bh,bh + mov cx,#0x01 + mov ah,#0x0e + int 0x10 + pop cx + pop ax + ret + +beep: mov al,#0x07 + jmp prnt1 + +no_sig_mess: .ascii "No setup signature found ..." + db 0x00 +start_sys_seg: .word SYSSEG + +good_sig1: + jmp good_sig + +! We now have to find the rest of the setup code/data +bad_sig: + mov ax,#INITSEG + mov ds,ax + xor bh,bh + mov bl,[497] ! get setup sects from boot sector + sub bx,#4 ! LILO loads 4 sectors of setup + shl bx,#8 ! convert to words + mov cx,bx + shr bx,#3 ! convert to segment + add bx,#SYSSEG + seg cs + mov start_sys_seg,bx + +! Move rest of setup code/data to here + mov di,#2048 ! four sectors loaded by LILO + sub si,si + mov ax,#SETUPSEG + mov es,ax + mov ax,#SYSSEG + mov ds,ax + rep + movsw + + mov ax,#SETUPSEG + mov ds,ax + cmp setup_sig1,#SIG1 + jne no_sig + cmp setup_sig2,#SIG2 + jne no_sig + jmp good_sig + +no_sig: + lea si,no_sig_mess + call prtstr +no_sig_loop: + jmp no_sig_loop + +good_sig: + mov ax,#INITSEG + mov ds,ax + +! Get memory size (extended mem, kB) + + mov ah,#0x88 + int 0x15 + mov [2],ax + +! set the keyboard repeat rate to the max + + mov ax,#0x0305 + xor bx,bx ! clear bx + int 0x16 + +! check for EGA/VGA and some config parameters + + mov ah,#0x12 + mov bl,#0x10 + int 0x10 + mov [8],ax + mov [10],bx + mov [12],cx + mov ax,#0x5019 + cmp bl,#0x10 + je novga + mov ax,#0x1a00 ! Added check for EGA/VGA discrimination + int 0x10 + mov bx,ax + mov ax,#0x5019 + cmp bl,#0x1a ! 1a means VGA, anything else EGA or lower + jne novga + call chsvga +novga: mov [14],ax + mov ah,#0x03 ! read cursor pos + xor bh,bh ! clear bh + int 0x10 ! save it in known place, con_init fetches + mov [0],dx ! it from 0x90000. + +! Get video-card data: + + mov ah,#0x0f + int 0x10 + mov [4],bx ! bh = display page + mov [6],ax ! al = video mode, ah = window width + +! Get hd0 data + + xor ax,ax ! clear ax + mov ds,ax + lds si,[4*0x41] + mov ax,#INITSEG + push ax + mov es,ax + mov di,#0x0080 + mov cx,#0x10 + push cx + cld + rep + movsb + +! Get hd1 data + + xor ax,ax ! clear ax + mov ds,ax + lds si,[4*0x46] + pop cx + pop es + mov di,#0x0090 + rep + movsb + +! Check that there IS a hd1 :-) + + mov ax,#0x01500 + mov dl,#0x81 + int 0x13 + jc no_disk1 + cmp ah,#3 + je is_disk1 +no_disk1: + mov ax,#INITSEG + mov es,ax + mov di,#0x0090 + mov cx,#0x10 + xor ax,ax ! clear ax + cld + rep + stosb +is_disk1: + +! check for PS/2 pointing device + + mov ax,#INITSEG + mov ds,ax + mov [0x1ff],#0 ! default is no pointing device + int 0x11 ! int 0x11: equipment determination + test al,#0x04 ! check if pointing device installed + jz no_psmouse + mov [0x1ff],#0xaa ! device present +no_psmouse: +! now we want to move to protected mode ... + + cli ! no interrupts allowed ! + mov al,#0x80 ! disable NMI for the bootup sequence + out #0x70,al + +! first we move the system to its rightful place + + mov ax,#0x100 ! start of destination segment + seg cs + mov bx,start_sys_seg ! start of source segment + cld ! 'direction'=0, movs moves forward +do_move: + mov es,ax ! destination segment + inc ah ! instead of add ax,#0x100 + cmp ax,#0x9000 + jz end_move + mov ds,bx ! source segment + add bx,#0x100 + sub di,di + sub si,si + mov cx,#0x800 + rep + movsw + jmp do_move + +! then we load the segment descriptors + +end_move: + mov ax,#SETUPSEG ! right, forgot this at first. didn't work :-) + mov ds,ax + lidt idt_48 ! load idt with 0,0 + lgdt gdt_48 ! load gdt with whatever appropriate + +! that was painless, now we enable A20 + + call empty_8042 + mov al,#0xD1 ! command write + out #0x64,al + call empty_8042 + mov al,#0xDF ! A20 on + out #0x60,al + call empty_8042 + +! make sure any possible coprocessor is properly reset.. + + xor ax,ax + out #0xf0,al + call delay + out #0xf1,al + call delay + +! well, that went ok, I hope. Now we have to reprogram the interrupts :-( +! we put them right after the intel-reserved hardware interrupts, at +! int 0x20-0x2F. There they won't mess up anything. Sadly IBM really +! messed this up with the original PC, and they haven't been able to +! rectify it afterwards. Thus the bios puts interrupts at 0x08-0x0f, +! which is used for the internal hardware interrupts as well. We just +! have to reprogram the 8259's, and it isn't fun. + + mov al,#0x11 ! initialization sequence + out #0x20,al ! send it to 8259A-1 + call delay + out #0xA0,al ! and to 8259A-2 + call delay + mov al,#0x20 ! start of hardware int's (0x20) + out #0x21,al + call delay + mov al,#0x28 ! start of hardware int's 2 (0x28) + out #0xA1,al + call delay + mov al,#0x04 ! 8259-1 is master + out #0x21,al + call delay + mov al,#0x02 ! 8259-2 is slave + out #0xA1,al + call delay + mov al,#0x01 ! 8086 mode for both + out #0x21,al + call delay + out #0xA1,al + call delay + mov al,#0xFF ! mask off all interrupts for now + out #0xA1,al + call delay + mov al,#0xFB ! mask all irq's but irq2 which + out #0x21,al ! is cascaded + +! well, that certainly wasn't fun :-(. Hopefully it works, and we don't +! need no steenking BIOS anyway (except for the initial loading :-). +! The BIOS-routine wants lots of unnecessary data, and it's less +! "interesting" anyway. This is how REAL programmers do it. +! +! Well, now's the time to actually move into protected mode. To make +! things as simple as possible, we do no register set-up or anything, +! we let the gnu-compiled 32-bit programs do that. We just jump to +! absolute address 0x00000, in 32-bit protected mode. +! +! Note that the short jump isn't strictly needed, although there are +! reasons why it might be a good idea. It won't hurt in any case. +! + xor ax,ax + inc ax ! protected mode (PE) bit + lmsw ax ! This is it! + jmp flush_instr +flush_instr: + jmpi 0x1000,KERNEL_CS ! jmp offset 1000 of segment 0x10 (cs) + +! This routine checks that the keyboard command queue is empty +! (after emptying the output buffers) +! +! No timeout is used - if this hangs there is something wrong with +! the machine, and we probably couldn't proceed anyway. +empty_8042: + call delay + in al,#0x64 ! 8042 status port + test al,#1 ! output buffer? + jz no_output + call delay + in al,#0x60 ! read it + jmp empty_8042 +no_output: + test al,#2 ! is input buffer full? + jnz empty_8042 ! yes - loop + ret +! +! Read a key and return the (US-)ascii code in al, scan code in ah +! +getkey: + xor ah,ah + int 0x16 + ret + +! +! Read a key with a timeout of 30 seconds. The cmos clock is used to get +! the time. +! +getkt: + call gettime + add al,#30 ! wait 30 seconds + cmp al,#60 + jl lminute + sub al,#60 +lminute: + mov cl,al +again: mov ah,#0x01 + int 0x16 + jnz getkey ! key pressed, so get it + call gettime + cmp al,cl + jne again + mov al,#0x20 ! timeout, return default char `space' + ret + +! +! Flush the keyboard buffer +! +flush: mov ah,#0x01 + int 0x16 + jz empty + xor ah,ah + int 0x16 + jmp flush +empty: ret + +! +! Read the cmos clock. Return the seconds in al +! +gettime: + push cx + mov ah,#0x02 + int 0x1a + mov al,dh ! dh contains the seconds + and al,#0x0f + mov ah,dh + mov cl,#0x04 + shr ah,cl + aad + pop cx + ret + +! +! Delay is needed after doing i/o +! +delay: + .word 0x00eb ! jmp $+2 + ret + +! Routine trying to recognize type of SVGA-board present (if any) +! and if it recognize one gives the choices of resolution it offers. +! If one is found the resolution chosen is given by al,ah (rows,cols). + +chsvga: cld + push ds + push cs + mov ax,[0x01fa] + pop ds + mov modesave,ax + mov ax,#0xc000 + mov es,ax + mov ax,modesave + cmp ax,#NORMAL_VGA + je defvga + cmp ax,#EXTENDED_VGA + je vga50 + cmp ax,#ASK_VGA + jne svga + lea si,msg1 + call prtstr + call flush +nokey: call getkt + cmp al,#0x0d ! enter ? + je svga ! yes - svga selection + cmp al,#0x20 ! space ? + je defvga ! no - repeat + call beep + jmp nokey +defvga: mov ax,#0x5019 + pop ds + ret +/* extended vga mode: 80x50 */ +vga50: + mov ax,#0x1112 + xor bl,bl + int 0x10 ! use 8x8 font set (50 lines on VGA) + mov ax,#0x1200 + mov bl,#0x20 + int 0x10 ! use alternate print screen + mov ax,#0x1201 + mov bl,#0x34 + int 0x10 ! turn off cursor emulation + mov ah,#0x01 + mov cx,#0x0607 + int 0x10 ! turn on cursor (scan lines 6 to 7) + pop ds + mov ax,#0x5032 ! return 80x50 + ret +/* extended vga mode: 80x28 */ +vga28: + pop ax ! clean the stack + mov ax,#0x1111 + xor bl,bl + int 0x10 ! use 9x14 fontset (28 lines on VGA) + mov ah, #0x01 + mov cx,#0x0b0c + int 0x10 ! turn on cursor (scan lines 11 to 12) + pop ds + mov ax,#0x501c ! return 80x28 + ret +/* svga modes */ +! +! test for presence of an S3 VGA chip. The algorithm was taken +! from the SuperProbe package of XFree86 1.2.1 +! report bugs to Christoph.Niemann@linux.org +! +svga: cld + mov cx,#0x0f35 ! we store some constants in cl/ch + mov dx,#0x03d4 + movb al,#0x38 + call inidx + mov bh,al ! store current value of CRT-register 0x38 + mov ax,#0x0038 + call outidx ! disable writing to special regs + movb al,cl ! check whether we can write special reg 0x35 + call inidx + movb bl,al ! save the current value of CRT reg 0x35 + andb al,#0xf0 ! clear bits 0-3 + movb ah,al + movb al,cl ! and write it to CRT reg 0x35 + call outidx + call inidx ! now read it back + andb al,ch ! clear the upper 4 bits + jz s3_2 ! the first test failed. But we have a + movb ah,bl ! second chance + mov al,cl + call outidx + jmp s3_1 ! do the other tests +s3_2: mov ax,cx ! load ah with 0xf and al with 0x35 + orb ah,bl ! set the upper 4 bits of ah with the orig value + call outidx ! write ... + call inidx ! ... and reread + andb al,cl ! turn off the upper 4 bits + push ax + movb ah,bl ! restore old value in register 0x35 + movb al,cl + call outidx + pop ax + cmp al,ch ! setting lower 4 bits was successful => bad + je no_s3 ! writing is allowed => this is not an S3 +s3_1: mov ax,#0x4838 ! allow writing to special regs by putting + call outidx ! magic number into CRT-register 0x38 + movb al,cl ! check whether we can write special reg 0x35 + call inidx + movb bl,al + andb al,#0xf0 + movb ah,al + movb al,cl + call outidx + call inidx + andb al,ch + jnz no_s3 ! no, we can't write => no S3 + mov ax,cx + orb ah,bl + call outidx + call inidx + andb al,ch + push ax + movb ah,bl ! restore old value in register 0x35 + movb al,cl + call outidx + pop ax + cmp al,ch + jne no_s31 ! writing not possible => no S3 + movb al,#0x30 + call inidx ! now get the S3 id ... + lea di,idS3 + mov cx,#0x10 + repne + scasb + je no_s31 + lea si,dsc_S3 ! table of descriptions of video modes for BIOS + lea di,mo_S3 ! table of sizes of video modes for my BIOS + movb ah,bh + movb al,#0x38 + call outidx ! restore old value of CRT register 0x38 + br selmod ! go ask for video mode +no_s3: movb al,#0x35 ! restore CRT register 0x35 + movb ah,bl + call outidx +no_s31: movb ah,bh + movb al,#0x38 + call outidx ! restore old value of CRT register 0x38 + + lea si,idati ! Check ATI 'clues' + mov di,#0x31 + mov cx,#0x09 + repe + cmpsb + jne noati + lea si,dscati + lea di,moati + br selmod +noati: mov ax,#0x200f ! Check Ahead 'clues' + mov dx,#0x3ce + out dx,ax + inc dx + in al,dx + cmp al,#0x20 + je isahed + cmp al,#0x21 + jne noahed +isahed: lea si,dscahead + lea di,moahead + br selmod +noahed: mov dx,#0x3c3 ! Check Chips & Tech. 'clues' + in al,dx + or al,#0x10 + out dx,al + mov dx,#0x104 + in al,dx + mov bl,al + mov dx,#0x3c3 + in al,dx + and al,#0xef + out dx,al + cmp bl,[idcandt] + jne nocant + lea si,dsccandt + lea di,mocandt + br selmod +nocant: mov dx,#0x3d4 ! Check Cirrus 'clues' + mov al,#0x0c + out dx,al + inc dx + in al,dx + mov bl,al + xor al,al + out dx,al + dec dx + mov al,#0x1f + out dx,al + inc dx + in al,dx + mov bh,al + xor ah,ah + shl al,#4 + mov cx,ax + mov al,bh + shr al,#4 + add cx,ax + shl cx,#8 + add cx,#6 + mov ax,cx + mov dx,#0x3c4 + out dx,ax + inc dx + in al,dx + and al,al + jnz nocirr + mov al,bh + out dx,al + in al,dx + cmp al,#0x01 + jne nocirr + call rst3d4 + lea si,dsccirrus + lea di,mocirrus + br selmod +rst3d4: mov dx,#0x3d4 + mov al,bl + xor ah,ah + shl ax,#8 + add ax,#0x0c + out dx,ax + ret +nocirr: call rst3d4 ! Check Everex 'clues' + mov ax,#0x7000 + xor bx,bx + int 0x10 + cmp al,#0x70 + jne noevrx + shr dx,#4 + cmp dx,#0x678 + je istrid + cmp dx,#0x236 + je istrid + lea si,dsceverex + lea di,moeverex + br selmod +istrid: lea cx,ev2tri + jmp cx +noevrx: lea si,idgenoa ! Check Genoa 'clues' + xor ax,ax + seg es + mov al,[0x37] + mov di,ax + mov cx,#0x04 + dec si + dec di +l1: inc si + inc di + mov al,(si) + test al,al + jz l2 + seg es + cmp al,(di) +l2: loope l1 + cmp cx,#0x00 + jne nogen + lea si,dscgenoa + lea di,mogenoa + br selmod +nogen: cld + lea si,idoakvga + mov di,#0x08 + mov cx,#0x08 + repe + cmpsb + jne nooak + lea si,dscoakvga + lea di,mooakvga + br selmod +nooak: cld + lea si,idparadise ! Check Paradise 'clues' + mov di,#0x7d + mov cx,#0x04 + repe + cmpsb + jne nopara + lea si,dscparadise + lea di,moparadise + br selmod +nopara: mov dx,#0x3c4 ! Check Trident 'clues' + mov al,#0x0e + out dx,al + inc dx + in al,dx + xchg ah,al + xor al,al + out dx,al + in al,dx + xchg al,ah + mov bl,al ! Strange thing ... in the book this wasn't + and bl,#0x02 ! necessary but it worked on my card which + jz setb2 ! is a trident. Without it the screen goes + and al,#0xfd ! blurred ... + jmp clrb2 ! +setb2: or al,#0x02 ! +clrb2: out dx,al + and ah,#0x0f + cmp ah,#0x02 + jne notrid +ev2tri: lea si,dsctrident + lea di,motrident + jmp selmod +notrid: mov dx,#0x3cd ! Check Tseng 'clues' + in al,dx ! Could things be this simple ! :-) + mov bl,al + mov al,#0x55 + out dx,al + in al,dx + mov ah,al + mov al,bl + out dx,al + cmp ah,#0x55 + jne notsen + lea si,dsctseng + lea di,motseng + jmp selmod +notsen: mov dx,#0x3cc ! Check Video7 'clues' + in al,dx + mov dx,#0x3b4 + and al,#0x01 + jz even7 + mov dx,#0x3d4 +even7: mov al,#0x0c + out dx,al + inc dx + in al,dx + mov bl,al + mov al,#0x55 + out dx,al + in al,dx + dec dx + mov al,#0x1f + out dx,al + inc dx + in al,dx + mov bh,al + dec dx + mov al,#0x0c + out dx,al + inc dx + mov al,bl + out dx,al + mov al,#0x55 + xor al,#0xea + cmp al,bh + jne novid7 + lea si,dscvideo7 + lea di,movideo7 + jmp selmod +novid7: lea si,dsunknown + lea di,mounknown +selmod: xor cx,cx + mov cl,(di) + mov ax,modesave + cmp ax,#ASK_VGA + je askmod + cmp ax,#NORMAL_VGA + je askmod + cmp al,cl + jl gotmode + push si + lea si,msg4 + call prtstr + pop si +askmod: push si + lea si,msg2 + call prtstr + pop si + push si + push cx +tbl: pop bx + push bx + mov al,bl + sub al,cl + call modepr + lodsw + xchg al,ah + call dprnt + xchg ah,al + push ax + mov al,#0x78 + call prnt1 + pop ax + call dprnt + push si + lea si,crlf ! print CR+LF + call prtstr + pop si + loop tbl + pop cx + lea si,msg3 + call prtstr + pop si + add cl,#0x30 + jmp nonum +nonumb: call beep +nonum: call getkey + cmp al,#0x30 ! ascii `0' + jb nonumb + cmp al,#0x3a ! ascii `9' + jbe number + cmp al,#0x61 ! ascii `a' + jb nonumb + cmp al,#0x7a ! ascii `z' + ja nonumb + sub al,#0x27 + cmp al,cl + jae nonumb + sub al,#0x30 + jmp gotmode +number: cmp al,cl + jae nonumb + sub al,#0x30 +gotmode: xor ah,ah + or al,al + beq vga50 + push ax + dec ax + beq vga28 + add di,ax + mov al,(di) + int 0x10 + pop ax + shl ax,#1 + add si,ax + lodsw + pop ds + ret + +! Routine to write al into a VGA-register that is +! accessed via an index register +! +! dx contains the address of the index register +! al contains the index +! ah contains the value to write to the data register (dx + 1) +! +! no registers are changed + +outidx: out dx,al + push ax + mov al,ah + inc dx + out dx,al + dec dx + pop ax + ret +inidx: out dx,al + inc dx + in al,dx + dec dx + ret + +! Routine to print a decimal value on screen, the value to be +! printed is put in al (i.e 0-255). + +dprnt: push ax + push cx + xor ah,ah ! Clear ah + mov cl,#0x0a + idiv cl + cmp al,#0x09 + jbe lt100 + call dprnt + jmp skip10 +lt100: add al,#0x30 + call prnt1 +skip10: mov al,ah + add al,#0x30 + call prnt1 + pop cx + pop ax + ret + +! +! Routine to print the mode number key on screen. Mode numbers +! 0-9 print the ascii values `0' to '9', 10-35 are represented by +! the letters `a' to `z'. This routine prints some spaces around the +! mode no. +! + +modepr: push ax + cmp al,#0x0a + jb digit ! Here is no check for number > 35 + add al,#0x27 +digit: add al,#0x30 + mov modenr, al + push si + lea si, modestring + call prtstr + pop si + pop ax + ret + +gdt: + .word 0,0,0,0 ! dummy + + .word 0,0,0,0 ! unused + + .word 0x07FF ! 8Mb - limit=2047 (2048*4096=8Mb) + .word 0x0000 ! base address=0 + .word 0x9A00 ! code read/exec + .word 0x00C0 ! granularity=4096, 386 + + .word 0x07FF ! 8Mb - limit=2047 (2048*4096=8Mb) + .word 0x0000 ! base address=0 + .word 0x9200 ! data read/write + .word 0x00C0 ! granularity=4096, 386 + +idt_48: + .word 0 ! idt limit=0 + .word 0,0 ! idt base=0L + +gdt_48: + .word 0x800 ! gdt limit=2048, 256 GDT entries + .word 512+gdt,0x9 ! gdt base = 0X9xxxx + +msg1: .ascii "Press to see SVGA-modes available, to continue or wait 30 secs." + db 0x0d, 0x0a, 0x0a, 0x00 +msg2: .ascii "Mode: COLSxROWS:" + db 0x0d, 0x0a, 0x0a, 0x00 +msg3: db 0x0d, 0x0a + .ascii "Choose mode by pressing the corresponding number or letter." +crlf: db 0x0d, 0x0a, 0x00 +msg4: .ascii "You passed an undefined mode number to setup. Please choose a new mode." + db 0x0d, 0x0a, 0x0a, 0x07, 0x00 +modestring: .ascii " " +modenr: db 0x00 ! mode number + .ascii ": " + db 0x00 + +idati: .ascii "761295520" +idcandt: .byte 0xa5 +idgenoa: .byte 0x77, 0x00, 0x99, 0x66 +idparadise: .ascii "VGA=" +idoakvga: .ascii "OAK VGA " +idS3: .byte 0x81, 0x82, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95 + .byte 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa8, 0xb0 + +! Manufacturer: Numofmodes+2: Mode: +! Number of modes is the number of chip-specific svga modes plus the extended +! modes available on any vga (currently 2) + +moati: .byte 0x06, 0x23, 0x33, 0x22, 0x21 +moahead: .byte 0x07, 0x22, 0x23, 0x24, 0x2f, 0x34 +mocandt: .byte 0x04, 0x60, 0x61 +mocirrus: .byte 0x06, 0x1f, 0x20, 0x22, 0x31 +moeverex: .byte 0x0c, 0x03, 0x04, 0x07, 0x08, 0x0a, 0x0b, 0x16, 0x18, 0x21, 0x40 +mogenoa: .byte 0x0c, 0x58, 0x5a, 0x60, 0x61, 0x62, 0x63, 0x64, 0x72, 0x74, 0x78 +moparadise: .byte 0x04, 0x55, 0x54 +motrident: .byte 0x09, 0x50, 0x51, 0x52, 0x57, 0x58, 0x59, 0x5a +motseng: .byte 0x07, 0x26, 0x2a, 0x23, 0x24, 0x22 +movideo7: .byte 0x08, 0x40, 0x43, 0x44, 0x41, 0x42, 0x45 +mooakvga: .byte 0x08, 0x00, 0x07, 0x4e, 0x4f, 0x50, 0x51 +mo_S3: .byte 0x04, 0x54, 0x55 +mounknown: .byte 0x02 + +! msb = Cols lsb = Rows: +! The first two modes are standard vga modes available on any vga. +! mode 0 is 80x50 and mode 1 is 80x28 + +dscati: .word 0x5032, 0x501c, 0x8419, 0x842c, 0x641e, 0x6419 +dscahead: .word 0x5032, 0x501c, 0x842c, 0x8419, 0x841c, 0xa032, 0x5042 +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, 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 +dscoakvga: .word 0x5032, 0x501c, 0x2819, 0x5019, 0x503c, 0x843c, 0x8419, 0x842b +dsc_S3: .word 0x5032, 0x501c, 0x842b, 0x8419 +dsunknown: .word 0x5032, 0x501c +modesave: .word SVGA_MODE + +! This must be last +setup_sig1: .word SIG1 +setup_sig2: .word SIG2 + +.text +endtext: +.data +enddata: +.bss +endbss: diff -u --recursive --new-file v1.1.44/linux/arch/i386/config.in linux/arch/i386/config.in --- v1.1.44/linux/arch/i386/config.in Thu Jan 1 02:00:00 1970 +++ linux/arch/i386/config.in Thu Aug 11 23:06:39 1994 @@ -0,0 +1,207 @@ +# +# For a description of the syntax of this configuration file, +# see the Configure script. +# + +comment 'General setup' + +bool 'Kernel math emulation' CONFIG_MATH_EMULATION n +bool 'Normal harddisk support' CONFIG_BLK_DEV_HD y +bool 'XT harddisk support' CONFIG_BLK_DEV_XD n +bool 'Networking support' CONFIG_NET y +bool 'Limit memory to low 16MB' CONFIG_MAX_16M n +bool 'System V IPC' CONFIG_SYSVIPC y +bool 'Use -m486 flag for 486-specific optimizations' CONFIG_M486 y + +if [ "$CONFIG_NET" = "y" ]; then +comment 'Networking options' +bool 'TCP/IP networking' CONFIG_INET y +if [ "$CONFIG_INET" "=" "y" ]; then +bool 'IP forwarding/gatewaying' CONFIG_IP_FORWARD n +comment '(it is safe to leave these untouched)' +bool 'PC/TCP compatibility mode' CONFIG_INET_PCTCP n +bool 'Reverse ARP' CONFIG_INET_RARP n +bool 'Assume subnets are local' CONFIG_INET_SNARL y +bool 'Disable NAGLE algorithm (normally enabled)' CONFIG_TCP_NAGLE_OFF n +fi +bool 'The IPX protocol' CONFIG_IPX y +#bool 'Amateur Radio AX.25 Level 2' CONFIG_AX25 n +fi + +comment 'SCSI support' + +bool 'SCSI support?' CONFIG_SCSI n + +if [ "$CONFIG_SCSI" = "n" ]; then + +comment 'Skipping SCSI configuration options...' + +else + +comment 'SCSI support type (disk, tape, CDrom)' + +bool 'Scsi disk support' CONFIG_BLK_DEV_SD y +bool 'Scsi tape support' CONFIG_CHR_DEV_ST n +bool 'Scsi CDROM support' CONFIG_BLK_DEV_SR n +bool 'Scsi generic support' CONFIG_CHR_DEV_SG n + +comment 'SCSI low-level drivers' + +bool 'Adaptec AHA152X support' CONFIG_SCSI_AHA152X n +bool 'Adaptec AHA1542 support' CONFIG_SCSI_AHA1542 y +bool 'Adaptec AHA1740 support' CONFIG_SCSI_AHA1740 n +bool 'BusLogic SCSI support' CONFIG_SCSI_BUSLOGIC n +bool 'Future Domain 16xx SCSI support' CONFIG_SCSI_FUTURE_DOMAIN n +bool 'Generic NCR5380 SCSI support' CONFIG_SCSI_GENERIC_NCR5380 n +bool 'NCR53c7,8xx SCSI support' CONFIG_SCSI_NCR53C7xx n +#bool 'Always IN2000 SCSI support' CONFIG_SCSI_IN2000 n +bool 'PAS16 SCSI support' CONFIG_SCSI_PAS16 n +bool 'Seagate ST-02 and Future Domain TMC-8xx SCSI support' CONFIG_SCSI_SEAGATE n +bool 'Trantor T128/T128F/T228 SCSI support' CONFIG_SCSI_T128 n +bool 'UltraStor SCSI support' CONFIG_SCSI_ULTRASTOR n +bool '7000FASST SCSI support' CONFIG_SCSI_7000FASST n +#bool 'SCSI debugging host adapter' CONFIG_SCSI_DEBUG n +fi + + +if [ "$CONFIG_NET" = "y" ]; then + +comment 'Network device support' + +bool 'Network device support?' CONFIG_NETDEVICES y +if [ "$CONFIG_NETDEVICES" = "n" ]; then + +comment 'Skipping network driver configuration options...' + +else +bool 'Dummy net driver support' CONFIG_DUMMY n +bool 'SLIP (serial line) support' CONFIG_SLIP n +if [ "$CONFIG_SLIP" = "y" ]; then + bool ' CSLIP compressed headers' SL_COMPRESSED y +# bool ' SLIP debugging on' SL_DUMP y +fi +bool 'PPP (point-to-point) support' CONFIG_PPP n +bool 'PLIP (parallel port) support' CONFIG_PLIP n +bool 'Load balancing support (experimental)' CONFIG_SLAVE_BALANCING n +bool 'Do you want to be offered ALPHA test drivers' CONFIG_NET_ALPHA n +bool 'Western Digital/SMC cards' CONFIG_NET_VENDOR_SMC n +if [ "$CONFIG_NET_VENDOR_SMC" = "y" ]; then + bool 'WD80*3 support' CONFIG_WD80x3 n + bool 'SMC Ultra support' CONFIG_ULTRA n +fi +bool '3COM cards' CONFIG_NET_VENDOR_3COM y +if [ "$CONFIG_NET_VENDOR_3COM" = "y" ]; then + bool '3c501 support' CONFIG_EL1 n + bool '3c503 support' CONFIG_EL2 n + if [ "$CONFIG_NET_ALPHA" = "y" ]; then + bool '3c505 support' CONFIG_ELPLUS n + bool '3c507 support' CONFIG_EL16 n + fi + bool '3c509/3c579 support' CONFIG_EL3 y +fi +bool 'Other ISA cards' CONFIG_NET_ISA n +if [ "$CONFIG_NET_ISA" = "y" ]; then + bool 'AT1500 and NE2100 (LANCE and PCnet-ISA) support' CONFIG_LANCE n + bool 'Cabletron E21xx support (not recommended)' CONFIG_E2100 n + bool 'DEPCA support' CONFIG_DEPCA n + if [ "$CONFIG_NET_ALPHA" = "y" ]; then + bool 'EtherExpress support' CONFIG_EEXPRESS n + bool 'AT1700 support' CONFIG_AT1700 n + fi + bool 'HP PCLAN support' CONFIG_HPLAN n + bool 'NE2000/NE1000 support' CONFIG_NE2000 y + bool 'SK_G16 support' CONFIG_SK_G16 n +fi +bool 'EISA and on board controllers' CONFIG_NET_EISA n + if [ "$CONFIG_NET_ALPHA" = "y" ]; then + bool 'Ansel Communications EISA 3200 support' CONFIG_AC3200 n + fi + bool 'Apricot Xen-II on board ethernet' CONFIG_APRICOT n +#bool 'NI52EE support' CONFIG_NI52 n +#bool 'NI65EE support' CONFIG_NI65 n +bool 'Pocket and portable adaptors' CONFIG_NET_POCKET n +if [ "$CONFIG_NET_POCKET" = "y" ]; then + bool 'D-Link DE600 pocket adaptor support' CONFIG_DE600 n + bool 'D-Link DE620 pocket adaptor support' CONFIG_DE620 n + bool 'AT-LAN-TEC/RealTek pocket adaptor support' CONFIG_ATP n + bool 'Zenith Z-Note support' CONFIG_ZNET n +fi +fi +fi + +comment 'CD-ROM drivers' + +bool 'Sony CDU31A/CDU33A CDROM driver support' CONFIG_CDU31A n +bool 'Mitsumi CDROM driver support' CONFIG_MCD n +bool 'Matsushita/Panasonic CDROM driver support' CONFIG_SBPCD n +if [ "$CONFIG_SBPCD" = "y" ]; then + bool 'Matsushita/Panasonic second CDROM controller support' CONFIG_SBPCD2 n + if [ "$CONFIG_SBPCD2" = "y" ]; then + bool 'Matsushita/Panasonic third CDROM controller support' CONFIG_SBPCD3 n + if [ "$CONFIG_SBPCD3" = "y" ]; then + bool 'Matsushita/Panasonic fourth CDROM controller support' CONFIG_SBPCD4 n + fi + fi +fi + +comment 'Filesystems' + +bool 'Standard (minix) fs support' CONFIG_MINIX_FS y +bool 'Extended fs support' CONFIG_EXT_FS n +bool 'Second extended fs support' CONFIG_EXT2_FS y +bool 'xiafs filesystem support' CONFIG_XIA_FS n +bool 'msdos fs support' CONFIG_MSDOS_FS y +if [ "$CONFIG_MSDOS_FS" = "y" ]; then +bool 'umsdos: Unix like fs on top of std MSDOS FAT fs' CONFIG_UMSDOS_FS n +fi +bool '/proc filesystem support' CONFIG_PROC_FS y +if [ "$CONFIG_INET" = "y" ]; then +bool 'NFS filesystem support' CONFIG_NFS_FS y +fi +bool 'ISO9660 cdrom filesystem support' CONFIG_ISO9660_FS n +bool 'OS/2 HPFS filesystem support (read only)' CONFIG_HPFS_FS n +bool 'System V and Coherent filesystem support' CONFIG_SYSV_FS n + +comment 'character devices' + +bool 'Parallel printer support' CONFIG_PRINTER n +bool 'Logitech busmouse support' CONFIG_BUSMOUSE n +bool 'PS/2 mouse (aka "auxiliary device") support' CONFIG_PSMOUSE n +if [ "$CONFIG_PSMOUSE" = "y" ]; then +bool 'C&T 82C710 mouse port support (as on TI Travelmate)' CONFIG_82C710_MOUSE y +fi +bool 'Microsoft busmouse support' CONFIG_MS_BUSMOUSE n +bool 'ATIXL busmouse support' CONFIG_ATIXL_BUSMOUSE n +bool 'Selection (cut and paste for virtual consoles)' CONFIG_SELECTION n + +bool 'QIC-02 tape support' CONFIG_QIC02_TAPE n +if [ "$CONFIG_QIC02_TAPE" = "y" ]; then +bool 'Do you want runtime configuration for QIC-02' CONFIG_QIC02_DYNCONF y +if [ "$CONFIG_QIC02_DYNCONF" != "y" ]; then + +comment '>>> Edit configuration parameters in ./include/linux/tpqic02.h!' + +else + +comment '>>> Setting runtime QIC-02 configuration is done with qic02conf' +comment '>>> Which is available from ftp://ftp.funet.fi/pub/OS/Linux/BETA/QIC-02/' + +fi +fi + +bool 'QIC-117 tape support' CONFIG_FTAPE n +if [ "$CONFIG_FTAPE" = "y" ]; then +int ' number of ftape buffers' NR_FTAPE_BUFFERS 3 +fi + +comment 'Sound' + +bool 'Sound card support' CONFIG_SOUND n + +comment 'Kernel hacking' + +#bool 'Debug kmalloc/kfree' CONFIG_DEBUG_MALLOC n +bool 'Kernel profiling support' CONFIG_PROFILE n +if [ "$CONFIG_SCSI" = "y" ]; then +bool 'Verbose scsi error reporting (kernel size +=12K)' CONFIG_SCSI_CONSTANTS y +fi diff -u --recursive --new-file v1.1.44/linux/drivers/block/floppy.c linux/drivers/block/floppy.c --- v1.1.44/linux/drivers/block/floppy.c Mon Aug 15 11:47:05 1994 +++ linux/drivers/block/floppy.c Mon Aug 15 11:26:34 1994 @@ -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 @@ 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_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 @@ { 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 @@ 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; diff -u --recursive --new-file v1.1.44/linux/drivers/char/serial.c linux/drivers/char/serial.c --- v1.1.44/linux/drivers/char/serial.c Mon Aug 15 11:47:06 1994 +++ linux/drivers/char/serial.c Mon Aug 15 09:15:15 1994 @@ -1018,7 +1018,7 @@ !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" diff -u --recursive --new-file v1.1.44/linux/fs/msdos/namei.c linux/fs/msdos/namei.c --- v1.1.44/linux/fs/msdos/namei.c Mon Jul 25 17:56:40 1994 +++ linux/fs/msdos/namei.c Fri Aug 12 08:45:28 1994 @@ -177,6 +177,7 @@ 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); diff -u --recursive --new-file v1.1.44/linux/include/asm-generic/bitops.h linux/include/asm-generic/bitops.h --- v1.1.44/linux/include/asm-generic/bitops.h Thu Jan 1 02:00:00 1970 +++ linux/include/asm-generic/bitops.h Mon Aug 15 10:54:22 1994 @@ -0,0 +1,53 @@ +#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 */ diff -u --recursive --new-file v1.1.44/linux/include/asm-generic/string.h linux/include/asm-generic/string.h --- v1.1.44/linux/include/asm-generic/string.h Thu Jan 1 02:00:00 1970 +++ linux/include/asm-generic/string.h Mon Aug 15 10:54:22 1994 @@ -0,0 +1,211 @@ +/* + * 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_ */ diff -u --recursive --new-file v1.1.44/linux/include/asm-i386/bitops.h linux/include/asm-i386/bitops.h --- v1.1.44/linux/include/asm-i386/bitops.h Thu Jan 1 02:00:00 1970 +++ linux/include/asm-i386/bitops.h Mon Aug 15 15:15:50 1994 @@ -0,0 +1,66 @@ +#ifndef _I386_BITOPS_H +#define _I386_BITOPS_H + +/* + * Copyright 1992, Linus Torvalds. + */ + +/* + * 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 + * was cleared before the operation and != 0 if it was not. + * + * bit 0 is the LSB of addr; bit 32 is the LSB of (addr+1). + */ + +/* + * Some hacks to defeat gcc over-optimizations.. + */ +struct __dummy { unsigned long a[100]; }; +#define ADDR (*(struct __dummy *) addr) + +extern __inline__ int set_bit(int nr, void * addr) +{ + int oldbit; + + __asm__ __volatile__("btsl %2,%1\n\tsbbl %0,%0" + :"=r" (oldbit),"=m" (ADDR) + :"r" (nr)); + return oldbit; +} + +extern __inline__ int clear_bit(int nr, void * addr) +{ + int oldbit; + + __asm__ __volatile__("btrl %2,%1\n\tsbbl %0,%0" + :"=r" (oldbit),"=m" (ADDR) + :"r" (nr)); + return oldbit; +} + +extern __inline__ int change_bit(int nr, void * addr) +{ + int oldbit; + + __asm__ __volatile__("btcl %2,%1\n\tsbbl %0,%0" + :"=r" (oldbit),"=m" (ADDR) + :"r" (nr)); + return oldbit; +} + +/* + * This routine doesn't need to be atomic, but it's faster to code it + * this way. + */ +extern __inline__ int test_bit(int nr, void * addr) +{ + int oldbit; + + __asm__ __volatile__("btl %2,%1\n\tsbbl %0,%0" + :"=r" (oldbit) + :"m" (ADDR),"r" (nr)); + return oldbit; +} + +#endif /* _I386_BITOPS_H */ diff -u --recursive --new-file v1.1.44/linux/include/asm-i386/delay.h linux/include/asm-i386/delay.h --- v1.1.44/linux/include/asm-i386/delay.h Thu Jan 1 02:00:00 1970 +++ linux/include/asm-i386/delay.h Mon Aug 15 12:24:39 1994 @@ -0,0 +1,35 @@ +#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) */ diff -u --recursive --new-file v1.1.44/linux/include/asm-i386/dma.h linux/include/asm-i386/dma.h --- v1.1.44/linux/include/asm-i386/dma.h Thu Jan 1 02:00:00 1970 +++ linux/include/asm-i386/dma.h Mon Aug 15 10:56:19 1994 @@ -0,0 +1,264 @@ +/* $Id: dma.h,v 1.7 1992/12/14 00:29:34 root Exp root $ + * linux/include/asm/dma.h: Defines for using and allocating dma channels. + * Written by Hennus Bergman, 1992. + * High DMA channel support & info by Hannu Savolainen + * and John Boyd, Nov. 1992. + */ + +#ifndef _ASM_DMA_H +#define _ASM_DMA_H + +#include /* need byte IO */ + + +#ifdef HAVE_REALLY_SLOW_DMA_CONTROLLER +#define outb outb_p +#endif + +/* + * NOTES about DMA transfers: + * + * controller 1: channels 0-3, byte operations, ports 00-1F + * controller 2: channels 4-7, word operations, ports C0-DF + * + * - ALL registers are 8 bits only, regardless of transfer size + * - channel 4 is not used - cascades 1 into 2. + * - channels 0-3 are byte - addresses/counts are for physical bytes + * - channels 5-7 are word - addresses/counts are for physical words + * - transfers must not cross physical 64K (0-3) or 128K (5-7) boundaries + * - transfer count loaded to registers is 1 less than actual count + * - controller 2 offsets are all even (2x offsets for controller 1) + * - page registers for 5-7 don't use data bit 0, represent 128K pages + * - page registers for 0-3 use bit 0, represent 64K pages + * + * DMA transfers are limited to the lower 16MB of _physical_ memory. + * Note that addresses loaded into registers must be _physical_ addresses, + * not logical addresses (which may differ if paging is active). + * + * Address mapping for channels 0-3: + * + * A23 ... A16 A15 ... A8 A7 ... A0 (Physical addresses) + * | ... | | ... | | ... | + * | ... | | ... | | ... | + * | ... | | ... | | ... | + * P7 ... P0 A7 ... A0 A7 ... A0 + * | Page | Addr MSB | Addr LSB | (DMA registers) + * + * Address mapping for channels 5-7: + * + * A23 ... A17 A16 A15 ... A9 A8 A7 ... A1 A0 (Physical addresses) + * | ... | \ \ ... \ \ \ ... \ \ + * | ... | \ \ ... \ \ \ ... \ (not used) + * | ... | \ \ ... \ \ \ ... \ + * P7 ... P1 (0) A7 A6 ... A0 A7 A6 ... A0 + * | Page | Addr MSB | Addr LSB | (DMA registers) + * + * Again, channels 5-7 transfer _physical_ words (16 bits), so addresses + * and counts _must_ be word-aligned (the lowest address bit is _ignored_ at + * the hardware level, so odd-byte transfers aren't possible). + * + * Transfer count (_not # bytes_) is limited to 64K, represented as actual + * count - 1 : 64K => 0xFFFF, 1 => 0x0000. Thus, count is always 1 or more, + * and up to 128K bytes may be transferred on channels 5-7 in one operation. + * + */ + +#define MAX_DMA_CHANNELS 8 + +/* 8237 DMA controllers */ +#define IO_DMA1_BASE 0x00 /* 8 bit slave DMA, channels 0..3 */ +#define IO_DMA2_BASE 0xC0 /* 16 bit master DMA, ch 4(=slave input)..7 */ + +/* DMA controller registers */ +#define DMA1_CMD_REG 0x08 /* command register (w) */ +#define DMA1_STAT_REG 0x08 /* status register (r) */ +#define DMA1_REQ_REG 0x09 /* request register (w) */ +#define DMA1_MASK_REG 0x0A /* single-channel mask (w) */ +#define DMA1_MODE_REG 0x0B /* mode register (w) */ +#define DMA1_CLEAR_FF_REG 0x0C /* clear pointer flip-flop (w) */ +#define DMA1_TEMP_REG 0x0D /* Temporary Register (r) */ +#define DMA1_RESET_REG 0x0D /* Master Clear (w) */ +#define DMA1_CLR_MASK_REG 0x0E /* Clear Mask */ +#define DMA1_MASK_ALL_REG 0x0F /* all-channels mask (w) */ + +#define DMA2_CMD_REG 0xD0 /* command register (w) */ +#define DMA2_STAT_REG 0xD0 /* status register (r) */ +#define DMA2_REQ_REG 0xD2 /* request register (w) */ +#define DMA2_MASK_REG 0xD4 /* single-channel mask (w) */ +#define DMA2_MODE_REG 0xD6 /* mode register (w) */ +#define DMA2_CLEAR_FF_REG 0xD8 /* clear pointer flip-flop (w) */ +#define DMA2_TEMP_REG 0xDA /* Temporary Register (r) */ +#define DMA2_RESET_REG 0xDA /* Master Clear (w) */ +#define DMA2_CLR_MASK_REG 0xDC /* Clear Mask */ +#define DMA2_MASK_ALL_REG 0xDE /* all-channels mask (w) */ + +#define DMA_ADDR_0 0x00 /* DMA address registers */ +#define DMA_ADDR_1 0x02 +#define DMA_ADDR_2 0x04 +#define DMA_ADDR_3 0x06 +#define DMA_ADDR_4 0xC0 +#define DMA_ADDR_5 0xC4 +#define DMA_ADDR_6 0xC8 +#define DMA_ADDR_7 0xCC + +#define DMA_CNT_0 0x01 /* DMA count registers */ +#define DMA_CNT_1 0x03 +#define DMA_CNT_2 0x05 +#define DMA_CNT_3 0x07 +#define DMA_CNT_4 0xC2 +#define DMA_CNT_5 0xC6 +#define DMA_CNT_6 0xCA +#define DMA_CNT_7 0xCE + +#define DMA_PAGE_0 0x87 /* DMA page registers */ +#define DMA_PAGE_1 0x83 +#define DMA_PAGE_2 0x81 +#define DMA_PAGE_3 0x82 +#define DMA_PAGE_5 0x8B +#define DMA_PAGE_6 0x89 +#define DMA_PAGE_7 0x8A + +#define DMA_MODE_READ 0x44 /* I/O to memory, no autoinit, increment, single mode */ +#define DMA_MODE_WRITE 0x48 /* memory to I/O, no autoinit, increment, single mode */ +#define DMA_MODE_CASCADE 0xC0 /* pass thru DREQ->HRQ, DACK<-HLDA only */ + +/* enable/disable a specific DMA channel */ +static __inline__ void enable_dma(unsigned int dmanr) +{ + if (dmanr<=3) + outb(dmanr, DMA1_MASK_REG); + else + outb(dmanr & 3, DMA2_MASK_REG); +} + +static __inline__ void disable_dma(unsigned int dmanr) +{ + if (dmanr<=3) + outb(dmanr | 4, DMA1_MASK_REG); + else + outb((dmanr & 3) | 4, DMA2_MASK_REG); +} + +/* Clear the 'DMA Pointer Flip Flop'. + * Write 0 for LSB/MSB, 1 for MSB/LSB access. + * Use this once to initialize the FF to a known state. + * After that, keep track of it. :-) + * --- In order to do that, the DMA routines below should --- + * --- only be used while interrupts are disabled! --- + */ +static __inline__ void clear_dma_ff(unsigned int dmanr) +{ + if (dmanr<=3) + outb(0, DMA1_CLEAR_FF_REG); + else + outb(0, DMA2_CLEAR_FF_REG); +} + +/* set mode (above) for a specific DMA channel */ +static __inline__ void set_dma_mode(unsigned int dmanr, char mode) +{ + if (dmanr<=3) + outb(mode | dmanr, DMA1_MODE_REG); + else + outb(mode | (dmanr&3), DMA2_MODE_REG); +} + +/* Set only the page register bits of the transfer address. + * This is used for successive transfers when we know the contents of + * the lower 16 bits of the DMA current address register, but a 64k boundary + * may have been crossed. + */ +static __inline__ void set_dma_page(unsigned int dmanr, char pagenr) +{ + switch(dmanr) { + case 0: + outb(pagenr, DMA_PAGE_0); + break; + case 1: + outb(pagenr, DMA_PAGE_1); + break; + case 2: + outb(pagenr, DMA_PAGE_2); + break; + case 3: + outb(pagenr, DMA_PAGE_3); + break; + case 5: + outb(pagenr & 0xfe, DMA_PAGE_5); + break; + case 6: + outb(pagenr & 0xfe, DMA_PAGE_6); + break; + case 7: + outb(pagenr & 0xfe, DMA_PAGE_7); + break; + } +} + + +/* Set transfer address & page bits for specific DMA channel. + * Assumes dma flipflop is clear. + */ +static __inline__ void set_dma_addr(unsigned int dmanr, unsigned int a) +{ + set_dma_page(dmanr, a>>16); + if (dmanr <= 3) { + outb( a & 0xff, ((dmanr&3)<<1) + IO_DMA1_BASE ); + outb( (a>>8) & 0xff, ((dmanr&3)<<1) + IO_DMA1_BASE ); + } else { + outb( (a>>1) & 0xff, ((dmanr&3)<<2) + IO_DMA2_BASE ); + outb( (a>>9) & 0xff, ((dmanr&3)<<2) + IO_DMA2_BASE ); + } +} + + +/* Set transfer size (max 64k for DMA1..3, 128k for DMA5..7) for + * a specific DMA channel. + * You must ensure the parameters are valid. + * NOTE: from a manual: "the number of transfers is one more + * than the initial word count"! This is taken into account. + * Assumes dma flip-flop is clear. + * NOTE 2: "count" represents _bytes_ and must be even for channels 5-7. + */ +static __inline__ void set_dma_count(unsigned int dmanr, unsigned int count) +{ + count--; + if (dmanr <= 3) { + outb( count & 0xff, ((dmanr&3)<<1) + 1 + IO_DMA1_BASE ); + outb( (count>>8) & 0xff, ((dmanr&3)<<1) + 1 + IO_DMA1_BASE ); + } else { + outb( (count>>1) & 0xff, ((dmanr&3)<<2) + 2 + IO_DMA2_BASE ); + outb( (count>>9) & 0xff, ((dmanr&3)<<2) + 2 + IO_DMA2_BASE ); + } +} + + +/* Get DMA residue count. After a DMA transfer, this + * should return zero. Reading this while a DMA transfer is + * still in progress will return unpredictable results. + * If called before the channel has been used, it may return 1. + * Otherwise, it returns the number of _bytes_ left to transfer. + * + * Assumes DMA flip-flop is clear. + */ +static __inline__ int get_dma_residue(unsigned int dmanr) +{ + unsigned int io_port = (dmanr<=3)? ((dmanr&3)<<1) + 1 + IO_DMA1_BASE + : ((dmanr&3)<<2) + 2 + IO_DMA2_BASE; + + /* using short to get 16-bit wrap around */ + unsigned short count; + + count = 1 + inb(io_port); + count += inb(io_port) << 8; + + return (dmanr<=3)? count : (count<<1); +} + + +/* These are in kernel/dma.c: */ +extern int request_dma(unsigned int dmanr); /* reserve a DMA channel */ +extern void free_dma(unsigned int dmanr); /* release it again */ + + +#endif /* _ASM_DMA_H */ diff -u --recursive --new-file v1.1.44/linux/include/asm-i386/io.h linux/include/asm-i386/io.h --- v1.1.44/linux/include/asm-i386/io.h Thu Jan 1 02:00:00 1970 +++ linux/include/asm-i386/io.h Mon Aug 15 10:56:19 1994 @@ -0,0 +1,159 @@ +#ifndef _ASM_IO_H +#define _ASM_IO_H + +/* + * This file contains the definitions for the x86 IO instructions + * inb/inw/inl/outb/outw/outl and the "string versions" of the same + * (insb/insw/insl/outsb/outsw/outsl). You can also use "pausing" + * versions of the single-IO instructions (inb_p/inw_p/..). + * + * This file is not meant to be obfuscating: it's just complicated + * to (a) handle it all in a way that makes gcc able to optimize it + * as well as possible and (b) trying to avoid writing the same thing + * over and over again with slight variations and possibly making a + * mistake somewhere. + */ + +/* + * Thanks to James van Artsdalen for a better timing-fix than + * the two short jumps: using outb's to a nonexistent port seems + * to guarantee better timings even on fast machines. + * + * On the other hand, I'd like to be sure of a non-existent port: + * I feel a bit unsafe about using 0x80 (should be safe, though) + * + * Linus + */ + +#ifdef SLOW_IO_BY_JUMPING +#define __SLOW_DOWN_IO __asm__ __volatile__("jmp 1f\n1:\tjmp 1f\n1:") +#else +#define __SLOW_DOWN_IO __asm__ __volatile__("outb %al,$0x80") +#endif + +#ifdef REALLY_SLOW_IO +#define SLOW_DOWN_IO { __SLOW_DOWN_IO; __SLOW_DOWN_IO; __SLOW_DOWN_IO; __SLOW_DOWN_IO; } +#else +#define SLOW_DOWN_IO __SLOW_DOWN_IO +#endif + +/* + * Talk about misusing macros.. + */ + +#define __OUT1(s,x) \ +extern inline void __out##s(unsigned x value, unsigned short port) { + +#define __OUT2(s,s1,s2) \ +__asm__ __volatile__ ("out" #s " %" s1 "0,%" s2 "1" + +#define __OUT(s,s1,x) \ +__OUT1(s,x) __OUT2(s,s1,"w") : : "a" (value), "d" (port)); } \ +__OUT1(s##c,x) __OUT2(s,s1,"") : : "a" (value), "i" (port)); } \ +__OUT1(s##_p,x) __OUT2(s,s1,"w") : : "a" (value), "d" (port)); SLOW_DOWN_IO; } \ +__OUT1(s##c_p,x) __OUT2(s,s1,"") : : "a" (value), "i" (port)); SLOW_DOWN_IO; } + +#define __IN1(s) \ +extern inline unsigned int __in##s(unsigned short port) { unsigned int _v; + +#define __IN2(s,s1,s2) \ +__asm__ __volatile__ ("in" #s " %" s2 "1,%" s1 "0" + +#define __IN(s,s1,i...) \ +__IN1(s) __IN2(s,s1,"w") : "=a" (_v) : "d" (port) ,##i ); return _v; } \ +__IN1(s##c) __IN2(s,s1,"") : "=a" (_v) : "i" (port) ,##i ); return _v; } \ +__IN1(s##_p) __IN2(s,s1,"w") : "=a" (_v) : "d" (port) ,##i ); SLOW_DOWN_IO; return _v; } \ +__IN1(s##c_p) __IN2(s,s1,"") : "=a" (_v) : "i" (port) ,##i ); SLOW_DOWN_IO; return _v; } + +#define __INS(s) \ +extern inline void ins##s(unsigned short port, void * addr, unsigned long count) \ +{ __asm__ __volatile__ ("cld ; rep ; ins" #s \ +: "=D" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); } + +#define __OUTS(s) \ +extern inline void outs##s(unsigned short port, const void * addr, unsigned long count) \ +{ __asm__ __volatile__ ("cld ; rep ; outs" #s \ +: "=S" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); } + +__IN(b,"b","0" (0)) +__IN(w,"w","0" (0)) +__IN(l,"") + +__OUT(b,"b",char) +__OUT(w,"w",short) +__OUT(l,,int) + +__INS(b) +__INS(w) +__INS(l) + +__OUTS(b) +__OUTS(w) +__OUTS(l) + +/* + * Note that due to the way __builtin_constant_p() works, you + * - can't use it inside a inline function (it will never be true) + * - you don't have to worry about side effects within the __builtin.. + */ +#define outb(val,port) \ +((__builtin_constant_p((port)) && (port) < 256) ? \ + __outbc((val),(port)) : \ + __outb((val),(port))) + +#define inb(port) \ +((__builtin_constant_p((port)) && (port) < 256) ? \ + __inbc(port) : \ + __inb(port)) + +#define outb_p(val,port) \ +((__builtin_constant_p((port)) && (port) < 256) ? \ + __outbc_p((val),(port)) : \ + __outb_p((val),(port))) + +#define inb_p(port) \ +((__builtin_constant_p((port)) && (port) < 256) ? \ + __inbc_p(port) : \ + __inb_p(port)) + +#define outw(val,port) \ +((__builtin_constant_p((port)) && (port) < 256) ? \ + __outwc((val),(port)) : \ + __outw((val),(port))) + +#define inw(port) \ +((__builtin_constant_p((port)) && (port) < 256) ? \ + __inwc(port) : \ + __inw(port)) + +#define outw_p(val,port) \ +((__builtin_constant_p((port)) && (port) < 256) ? \ + __outwc_p((val),(port)) : \ + __outw_p((val),(port))) + +#define inw_p(port) \ +((__builtin_constant_p((port)) && (port) < 256) ? \ + __inwc_p(port) : \ + __inw_p(port)) + +#define outl(val,port) \ +((__builtin_constant_p((port)) && (port) < 256) ? \ + __outlc((val),(port)) : \ + __outl((val),(port))) + +#define inl(port) \ +((__builtin_constant_p((port)) && (port) < 256) ? \ + __inlc(port) : \ + __inl(port)) + +#define outl_p(val,port) \ +((__builtin_constant_p((port)) && (port) < 256) ? \ + __outlc_p((val),(port)) : \ + __outl_p((val),(port))) + +#define inl_p(port) \ +((__builtin_constant_p((port)) && (port) < 256) ? \ + __inlc_p(port) : \ + __inl_p(port)) + +#endif diff -u --recursive --new-file v1.1.44/linux/include/asm-i386/irq.h linux/include/asm-i386/irq.h --- v1.1.44/linux/include/asm-i386/irq.h Thu Jan 1 02:00:00 1970 +++ linux/include/asm-i386/irq.h Mon Aug 15 10:56:19 1994 @@ -0,0 +1,165 @@ +#ifndef _ASM_IRQ_H +#define _ASM_IRQ_H + +/* + * linux/include/asm/irq.h + * + * (C) 1992, 1993 Linus Torvalds + */ + +#include +#include + +extern void disable_irq(unsigned int); +extern void enable_irq(unsigned int); + +#define __STR(x) #x +#define STR(x) __STR(x) + +#define SAVE_ALL \ + "cld\n\t" \ + "push %gs\n\t" \ + "push %fs\n\t" \ + "push %es\n\t" \ + "push %ds\n\t" \ + "pushl %eax\n\t" \ + "pushl %ebp\n\t" \ + "pushl %edi\n\t" \ + "pushl %esi\n\t" \ + "pushl %edx\n\t" \ + "pushl %ecx\n\t" \ + "pushl %ebx\n\t" \ + "movl $" STR(KERNEL_DS) ",%edx\n\t" \ + "mov %dx,%ds\n\t" \ + "mov %dx,%es\n\t" \ + "movl $" STR(USER_DS) ",%edx\n\t" \ + "mov %dx,%fs\n\t" \ + "movl $0,%edx\n\t" \ + "movl %edx,%db7\n\t" + +/* + * SAVE_MOST/RESTORE_MOST is used for the faster version of IRQ handlers, + * installed by using the SA_INTERRUPT flag. These kinds of IRQ's don't + * call the routines that do signal handling etc on return, and can have + * more relaxed register-saving etc. They are also atomic, and are thus + * suited for small, fast interrupts like the serial lines or the harddisk + * drivers, which don't actually need signal handling etc. + * + * Also note that we actually save only those registers that are used in + * C subroutines (%eax, %edx and %ecx), so if you do something weird, + * you're on your own. The only segments that are saved (not counting the + * automatic stack and code segment handling) are %ds and %es, and they + * point to kernel space. No messing around with %fs here. + */ +#define SAVE_MOST \ + "cld\n\t" \ + "push %es\n\t" \ + "push %ds\n\t" \ + "pushl %eax\n\t" \ + "pushl %edx\n\t" \ + "pushl %ecx\n\t" \ + "movl $" STR(KERNEL_DS) ",%edx\n\t" \ + "mov %dx,%ds\n\t" \ + "mov %dx,%es\n\t" + +#define RESTORE_MOST \ + "popl %ecx\n\t" \ + "popl %edx\n\t" \ + "popl %eax\n\t" \ + "pop %ds\n\t" \ + "pop %es\n\t" \ + "iret" + +/* + * The "inb" instructions are not needed, but seem to change the timings + * a bit - without them it seems that the harddisk driver won't work on + * all hardware. Arghh. + */ +#define ACK_FIRST(mask) \ + "inb $0x21,%al\n\t" \ + "jmp 1f\n" \ + "1:\tjmp 1f\n" \ + "1:\torb $" #mask ",_cache_21\n\t" \ + "movb _cache_21,%al\n\t" \ + "outb %al,$0x21\n\t" \ + "jmp 1f\n" \ + "1:\tjmp 1f\n" \ + "1:\tmovb $0x20,%al\n\t" \ + "outb %al,$0x20\n\t" + +#define ACK_SECOND(mask) \ + "inb $0xA1,%al\n\t" \ + "jmp 1f\n" \ + "1:\tjmp 1f\n" \ + "1:\torb $" #mask ",_cache_A1\n\t" \ + "movb _cache_A1,%al\n\t" \ + "outb %al,$0xA1\n\t" \ + "jmp 1f\n" \ + "1:\tjmp 1f\n" \ + "1:\tmovb $0x20,%al\n\t" \ + "outb %al,$0xA0\n\t" \ + "jmp 1f\n" \ + "1:\tjmp 1f\n" \ + "1:\toutb %al,$0x20\n\t" + +#define UNBLK_FIRST(mask) \ + "inb $0x21,%al\n\t" \ + "jmp 1f\n" \ + "1:\tjmp 1f\n" \ + "1:\tandb $~(" #mask "),_cache_21\n\t" \ + "movb _cache_21,%al\n\t" \ + "outb %al,$0x21\n\t" + +#define UNBLK_SECOND(mask) \ + "inb $0xA1,%al\n\t" \ + "jmp 1f\n" \ + "1:\tjmp 1f\n" \ + "1:\tandb $~(" #mask "),_cache_A1\n\t" \ + "movb _cache_A1,%al\n\t" \ + "outb %al,$0xA1\n\t" + +#define IRQ_NAME2(nr) nr##_interrupt(void) +#define IRQ_NAME(nr) IRQ_NAME2(IRQ##nr) +#define FAST_IRQ_NAME(nr) IRQ_NAME2(fast_IRQ##nr) +#define BAD_IRQ_NAME(nr) IRQ_NAME2(bad_IRQ##nr) + +#define BUILD_IRQ(chip,nr,mask) \ +asmlinkage void IRQ_NAME(nr); \ +asmlinkage void FAST_IRQ_NAME(nr); \ +asmlinkage void BAD_IRQ_NAME(nr); \ +__asm__( \ +"\n.align 4\n" \ +"_IRQ" #nr "_interrupt:\n\t" \ + "pushl $-"#nr"-2\n\t" \ + SAVE_ALL \ + ACK_##chip(mask) \ + "incl _intr_count\n\t"\ + "sti\n\t" \ + "movl %esp,%ebx\n\t" \ + "pushl %ebx\n\t" \ + "pushl $" #nr "\n\t" \ + "call _do_IRQ\n\t" \ + "addl $8,%esp\n\t" \ + "cli\n\t" \ + UNBLK_##chip(mask) \ + "decl _intr_count\n\t" \ + "jmp ret_from_sys_call\n" \ +"\n.align 4\n" \ +"_fast_IRQ" #nr "_interrupt:\n\t" \ + SAVE_MOST \ + ACK_##chip(mask) \ + "incl _intr_count\n\t" \ + "pushl $" #nr "\n\t" \ + "call _do_fast_IRQ\n\t" \ + "addl $4,%esp\n\t" \ + "cli\n\t" \ + UNBLK_##chip(mask) \ + "decl _intr_count\n\t" \ + RESTORE_MOST \ +"\n\n.align 4\n" \ +"_bad_IRQ" #nr "_interrupt:\n\t" \ + SAVE_MOST \ + ACK_##chip(mask) \ + RESTORE_MOST); + +#endif diff -u --recursive --new-file v1.1.44/linux/include/asm-i386/segment.h linux/include/asm-i386/segment.h --- v1.1.44/linux/include/asm-i386/segment.h Thu Jan 1 02:00:00 1970 +++ linux/include/asm-i386/segment.h Mon Aug 15 10:56:19 1994 @@ -0,0 +1,219 @@ +#ifndef _ASM_SEGMENT_H +#define _ASM_SEGMENT_H + +static inline unsigned char get_user_byte(const char * addr) +{ + register unsigned char _v; + + __asm__ ("movb %%fs:%1,%0":"=q" (_v):"m" (*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__ ("movw %%fs:%1,%0":"=r" (_v):"m" (*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__ ("movl %%fs:%1,%0":"=r" (_v):"m" (*addr)); \ + return _v; +} + +#define get_fs_long(addr) get_user_long((int *)(addr)) + +static inline void put_user_byte(char val,char *addr) +{ +__asm__ ("movb %0,%%fs:%1": /* no outputs */ :"iq" (val),"m" (*addr)); +} + +#define put_fs_byte(x,addr) put_user_byte((x),(char *)(addr)) + +static inline void put_user_word(short val,short * addr) +{ +__asm__ ("movw %0,%%fs:%1": /* no outputs */ :"ir" (val),"m" (*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__ ("movl %0,%%fs:%1": /* no outputs */ :"ir" (val),"m" (*addr)); +} + +#define put_fs_long(x,addr) put_user_long((x),(int *)(addr)) + +static inline void __generic_memcpy_tofs(void * to, const void * from, unsigned long n) +{ +__asm__("cld\n\t" + "push %%es\n\t" + "push %%fs\n\t" + "pop %%es\n\t" + "testb $1,%%cl\n\t" + "je 1f\n\t" + "movsb\n" + "1:\ttestb $2,%%cl\n\t" + "je 2f\n\t" + "movsw\n" + "2:\tshrl $2,%%ecx\n\t" + "rep ; movsl\n\t" + "pop %%es" + : /* no outputs */ + :"c" (n),"D" ((long) to),"S" ((long) from) + :"cx","di","si"); +} + +static inline void __constant_memcpy_tofs(void * to, const void * from, unsigned long n) +{ + switch (n) { + case 0: + return; + case 1: + put_user_byte(*(const char *) from, (char *) to); + return; + case 2: + put_user_word(*(const short *) from, (short *) to); + return; + case 3: + put_user_word(*(const short *) from, (short *) to); + put_user_byte(*(2+(const char *) from), 2+(char *) to); + return; + case 4: + put_user_long(*(const int *) from, (int *) to); + return; + } +#define COMMON(x) \ +__asm__("cld\n\t" \ + "push %%es\n\t" \ + "push %%fs\n\t" \ + "pop %%es\n\t" \ + "rep ; movsl\n\t" \ + x \ + "pop %%es" \ + : /* no outputs */ \ + :"c" (n/4),"D" ((long) to),"S" ((long) from) \ + :"cx","di","si") + + switch (n % 4) { + case 0: + COMMON(""); + return; + case 1: + COMMON("movsb\n\t"); + return; + case 2: + COMMON("movsw\n\t"); + return; + case 3: + COMMON("movsw\n\tmovsb\n\t"); + return; + } +#undef COMMON +} + +static inline void __generic_memcpy_fromfs(void * to, const void * from, unsigned long n) +{ +__asm__("cld\n\t" + "testb $1,%%cl\n\t" + "je 1f\n\t" + "fs ; movsb\n" + "1:\ttestb $2,%%cl\n\t" + "je 2f\n\t" + "fs ; movsw\n" + "2:\tshrl $2,%%ecx\n\t" + "rep ; fs ; movsl" + : /* no outputs */ + :"c" (n),"D" ((long) to),"S" ((long) from) + :"cx","di","si","memory"); +} + +static inline void __constant_memcpy_fromfs(void * to, const void * from, unsigned long n) +{ + switch (n) { + case 0: + return; + case 1: + *(char *)to = get_user_byte((const char *) from); + return; + case 2: + *(short *)to = get_user_word((const short *) from); + return; + case 3: + *(short *) to = get_user_word((const short *) from); + *((char *) to + 2) = get_user_byte(2+(const char *) from); + return; + case 4: + *(int *) to = get_user_long((const int *) from); + return; + } +#define COMMON(x) \ +__asm__("cld\n\t" \ + "rep ; fs ; movsl\n\t" \ + x \ + : /* no outputs */ \ + :"c" (n/4),"D" ((long) to),"S" ((long) from) \ + :"cx","di","si","memory") + + switch (n % 4) { + case 0: + COMMON(""); + return; + case 1: + COMMON("fs ; movsb"); + return; + case 2: + COMMON("fs ; movsw"); + return; + case 3: + COMMON("fs ; movsw\n\tfs ; movsb"); + return; + } +#undef COMMON +} + +#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))) + +/* + * Someone who knows GNU asm better than I should double check the following. + * It seems to work, but I don't know if I'm doing something subtly wrong. + * --- TYT, 11/24/91 + * [ nothing wrong here, Linus: I just changed the ax to be any reg ] + */ + +static inline unsigned long get_fs(void) +{ + unsigned long _v; + __asm__("mov %%fs,%w0":"=r" (_v):"0" (0)); + return _v; +} + +static inline unsigned long get_ds(void) +{ + unsigned long _v; + __asm__("mov %%ds,%w0":"=r" (_v):"0" (0)); + return _v; +} + +static inline void set_fs(unsigned long val) +{ + __asm__ __volatile__("mov %w0,%%fs": /* no output */ :"r" (val)); +} + +#endif /* _ASM_SEGMENT_H */ diff -u --recursive --new-file v1.1.44/linux/include/asm-i386/string.h linux/include/asm-i386/string.h --- v1.1.44/linux/include/asm-i386/string.h Thu Jan 1 02:00:00 1970 +++ linux/include/asm-i386/string.h Mon Aug 15 10:56:19 1994 @@ -0,0 +1,429 @@ +#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 delimiter-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 + +#define move_to_user_mode() \ +__asm__ __volatile__ ("movl %%esp,%%eax\n\t" \ + "pushl %0\n\t" \ + "pushl %%eax\n\t" \ + "pushfl\n\t" \ + "pushl %1\n\t" \ + "pushl $1f\n\t" \ + "iret\n" \ + "1:\tmovl %0,%%eax\n\t" \ + "mov %%ax,%%ds\n\t" \ + "mov %%ax,%%es\n\t" \ + "mov %%ax,%%fs\n\t" \ + "mov %%ax,%%gs" \ + : /* no outputs */ :"i" (USER_DS), "i" (USER_CS):"ax") + +#define sti() __asm__ __volatile__ ("sti": : :"memory") +#define cli() __asm__ __volatile__ ("cli": : :"memory") +#define nop() __asm__ __volatile__ ("nop") + +/* + * Clear and set 'TS' bit respectively + */ +#define clts() __asm__ __volatile__ ("clts") +#define stts() \ +__asm__ __volatile__ ( \ + "movl %%cr0,%%eax\n\t" \ + "orl $8,%%eax\n\t" \ + "movl %%eax,%%cr0" \ + : /* no outputs */ \ + : /* no inputs */ \ + :"ax") + + +extern inline int tas(char * m) +{ + char res; + + __asm__("xchgb %0,%1":"=q" (res),"=m" (*m):"0" (0x1)); + return res; +} + +#define save_flags(x) \ +__asm__ __volatile__("pushfl ; popl %0":"=r" (x): /* no input */ :"memory") + +#define restore_flags(x) \ +__asm__ __volatile__("pushl %0 ; popfl": /* no output */ :"r" (x):"memory") + +#define iret() __asm__ __volatile__ ("iret": : :"memory") + +#define _set_gate(gate_addr,type,dpl,addr) \ +__asm__ __volatile__ ("movw %%dx,%%ax\n\t" \ + "movw %2,%%dx\n\t" \ + "movl %%eax,%0\n\t" \ + "movl %%edx,%1" \ + :"=m" (*((long *) (gate_addr))), \ + "=m" (*(1+(long *) (gate_addr))) \ + :"i" ((short) (0x8000+(dpl<<13)+(type<<8))), \ + "d" ((char *) (addr)),"a" (KERNEL_CS << 16) \ + :"ax","dx") + +#define set_intr_gate(n,addr) \ + _set_gate(&idt[n],14,0,addr) + +#define set_trap_gate(n,addr) \ + _set_gate(&idt[n],15,0,addr) + +#define set_system_gate(n,addr) \ + _set_gate(&idt[n],15,3,addr) + +#define set_call_gate(a,addr) \ + _set_gate(a,12,3,addr) + +#define _set_seg_desc(gate_addr,type,dpl,base,limit) {\ + *((gate_addr)+1) = ((base) & 0xff000000) | \ + (((base) & 0x00ff0000)>>16) | \ + ((limit) & 0xf0000) | \ + ((dpl)<<13) | \ + (0x00408000) | \ + ((type)<<8); \ + *(gate_addr) = (((base) & 0x0000ffff)<<16) | \ + ((limit) & 0x0ffff); } + +#define _set_tssldt_desc(n,addr,limit,type) \ +__asm__ __volatile__ ("movw $" #limit ",%1\n\t" \ + "movw %%ax,%2\n\t" \ + "rorl $16,%%eax\n\t" \ + "movb %%al,%3\n\t" \ + "movb $" type ",%4\n\t" \ + "movb $0x00,%5\n\t" \ + "movb %%ah,%6\n\t" \ + "rorl $16,%%eax" \ + : /* no output */ \ + :"a" (addr+0xc0000000), "m" (*(n)), "m" (*(n+2)), "m" (*(n+4)), \ + "m" (*(n+5)), "m" (*(n+6)), "m" (*(n+7)) \ + ) + +#define set_tss_desc(n,addr) _set_tssldt_desc(((char *) (n)),((int)(addr)),235,"0x89") +#define set_ldt_desc(n,addr,size) \ + _set_tssldt_desc(((char *) (n)),((int)(addr)),((size << 3) - 1),"0x82") + + +#endif diff -u --recursive --new-file v1.1.44/linux/include/asm-i386/unistd.h linux/include/asm-i386/unistd.h --- v1.1.44/linux/include/asm-i386/unistd.h Thu Jan 1 02:00:00 1970 +++ linux/include/asm-i386/unistd.h Mon Aug 15 10:54:23 1994 @@ -0,0 +1,85 @@ +#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_ */ diff -u --recursive --new-file v1.1.44/linux/include/asm-mips/bitops.h linux/include/asm-mips/bitops.h --- v1.1.44/linux/include/asm-mips/bitops.h Thu Jan 1 02:00:00 1970 +++ linux/include/asm-mips/bitops.h Mon Aug 15 10:54:23 1994 @@ -0,0 +1,20 @@ +/* + * 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 + +#endif /* _ASM_MIPS_BITOPS_H_ */ diff -u --recursive --new-file v1.1.44/linux/include/asm-mips/delay.h linux/include/asm-mips/delay.h --- v1.1.44/linux/include/asm-mips/delay.h Thu Jan 1 02:00:00 1970 +++ linux/include/asm-mips/delay.h Mon Aug 15 12:24:19 1994 @@ -0,0 +1,33 @@ +#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) */ diff -u --recursive --new-file v1.1.44/linux/include/asm-mips/mipsregs.h linux/include/asm-mips/mipsregs.h --- v1.1.44/linux/include/asm-mips/mipsregs.h Thu Jan 1 02:00:00 1970 +++ linux/include/asm-mips/mipsregs.h Mon Aug 15 10:54:23 1994 @@ -0,0 +1,83 @@ +/* + * 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_ */ diff -u --recursive --new-file v1.1.44/linux/include/asm-mips/segment.h linux/include/asm-mips/segment.h --- v1.1.44/linux/include/asm-mips/segment.h Thu Jan 1 02:00:00 1970 +++ linux/include/asm-mips/segment.h Mon Aug 15 10:54:23 1994 @@ -0,0 +1,219 @@ +/* + * 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 + +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_ */ diff -u --recursive --new-file v1.1.44/linux/include/asm-mips/string.h linux/include/asm-mips/string.h --- v1.1.44/linux/include/asm-mips/string.h Thu Jan 1 02:00:00 1970 +++ linux/include/asm-mips/string.h Mon Aug 15 10:54:23 1994 @@ -0,0 +1,209 @@ +/* + * 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_ */ diff -u --recursive --new-file v1.1.44/linux/include/asm-mips/system.h linux/include/asm-mips/system.h --- v1.1.44/linux/include/asm-mips/system.h Thu Jan 1 02:00:00 1970 +++ linux/include/asm-mips/system.h Mon Aug 15 10:54:23 1994 @@ -0,0 +1,70 @@ +/* + * 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 +#include + +/* + * 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_ */ diff -u --recursive --new-file v1.1.44/linux/include/asm-mips/unistd.h linux/include/asm-mips/unistd.h --- v1.1.44/linux/include/asm-mips/unistd.h Thu Jan 1 02:00:00 1970 +++ linux/include/asm-mips/unistd.h Mon Aug 15 10:54:24 1994 @@ -0,0 +1,134 @@ +#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_ */ diff -u --recursive --new-file v1.1.44/linux/include/linux/delay.h linux/include/linux/delay.h --- v1.1.44/linux/include/linux/delay.h Sat Dec 4 15:10:06 1993 +++ linux/include/linux/delay.h Mon Aug 15 12:23:23 1994 @@ -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 -/* - * 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) */ diff -u --recursive --new-file v1.1.44/linux/include/linux/fdreg.h linux/include/linux/fdreg.h --- v1.1.44/linux/include/linux/fdreg.h Thu Aug 11 20:43:31 1994 +++ linux/include/linux/fdreg.h Mon Aug 15 09:13:09 1994 @@ -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 diff -u --recursive --new-file v1.1.44/linux/include/linux/string.h linux/include/linux/string.h --- v1.1.44/linux/include/linux/string.h Mon Aug 15 11:47:12 1994 +++ linux/include/linux/string.h Mon Aug 15 10:54:24 1994 @@ -11,36 +11,21 @@ extern "C" { #endif -#ifdef i386 - -#include /* 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 + +#ifdef __USE_PORTABLE_STRINGS_H_ +/* + * include/generic/string.h imports all the string functions, + * for which no appropriate assembler replacements have been provided. + */ +#include #endif #ifdef __cplusplus } #endif -#endif +#endif /* _LINUX_STRING_H_ */ diff -u --recursive --new-file v1.1.44/linux/include/linux/unistd.h linux/include/linux/unistd.h --- v1.1.44/linux/include/linux/unistd.h Mon Aug 15 11:47:12 1994 +++ linux/include/linux/unistd.h Mon Aug 15 10:54:24 1994 @@ -1,9 +1,8 @@ -#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 -#endif /* _LINUX_UNISTD_H */ +#endif /* _LINUX_UNISTD_H_ */ diff -u --recursive --new-file v1.1.44/linux/init/main.c linux/init/main.c --- v1.1.44/linux/init/main.c Tue Aug 9 17:20:35 1994 +++ linux/init/main.c Fri Aug 12 08:49:08 1994 @@ -486,11 +486,6 @@ 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 @@ 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); diff -u --recursive --new-file v1.1.44/linux/kernel/bios32.c linux/kernel/bios32.c --- v1.1.44/linux/kernel/bios32.c Thu Aug 11 20:43:36 1994 +++ linux/kernel/bios32.c Fri Aug 12 11:25:27 1994 @@ -256,7 +256,7 @@ "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 @@ : "=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 @@ "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 @@ "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 @@ "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 @@ "jc 1f\n\t" "xor %%ah, %%ah\n" "1:" - : "=ax" (ret) + : "=a" (ret) : "0" (PCIBIOS_WRITE_CONFIG_DWORD), "c" (value), "b" (bx),