diff --git a/.gitignore b/.gitignore
index 035ad40..e6f25e6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,6 @@
-# ---> CraftCMS
-# Craft 2 Storage (https://craftcms.com/support/craft-storage-gitignore)
-# not necessary for Craft 3 (https://github.com/craftcms/craft/issues/26)
-/craft/storage/*
-!/craft/storage/rebrand
-
+# ---> CraftCMS
+# Craft 2 Storage (https://craftcms.com/support/craft-storage-gitignore)
+# not necessary for Craft 3 (https://github.com/craftcms/craft/issues/26)
+/craft/storage/*
+!/craft/storage/rebrand
+
diff --git a/LICENSE b/LICENSE
index 2172f86..3447cfb 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,35 +1,35 @@
-GCC RUNTIME LIBRARY EXCEPTION
-
-Version 3.1, 31 March 2009
-
-General information: http://www.gnu.org/licenses/gcc-exception.html
-
-Copyright (C) 2009 Free Software Foundation, Inc.
-
-Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
-
-This GCC Runtime Library Exception ("Exception") is an additional permission under section 7 of the GNU General Public License, version 3 ("GPLv3"). It applies to a given file (the "Runtime Library") that bears a notice placed by the copyright holder of the file stating that the file is governed by GPLv3 along with this Exception.
-
-When you use GCC to compile a program, GCC may combine portions of certain GCC header files and runtime libraries with the compiled program. The purpose of this Exception is to allow compilation of non-GPL (including proprietary) programs to use, in this way, the header files and runtime libraries covered by this Exception.
-
- 0. Definitions.
-
- A file is an "Independent Module" if it either requires the Runtime Library for execution after a Compilation Process, or makes use of an interface provided by the Runtime Library, but is not otherwise based on the Runtime Library.
-
- "GCC" means a version of the GNU Compiler Collection, with or without modifications, governed by version 3 (or a specified later version) of the GNU General Public License (GPL) with the option of using any subsequent versions published by the FSF.
-
- "GPL-compatible Software" is software whose conditions of propagation, modification and use would permit combination with GCC in accord with the license of GCC.
-
- "Target Code" refers to output from any compiler for a real or virtual target processor architecture, in executable form or suitable for input to an assembler, loader, linker and/or execution phase. Notwithstanding that, Target Code does not include data in any format that is used as a compiler intermediate representation, or used for producing a compiler intermediate representation.
-
- The "Compilation Process" transforms code entirely represented in non-intermediate languages designed for human-written code, and/or in Java Virtual Machine byte code, into Target Code. Thus, for example, use of source code generators and preprocessors need not be considered part of the Compilation Process, since the Compilation Process can be understood as starting with the output of the generators or preprocessors.
-
- A Compilation Process is "Eligible" if it is done using GCC, alone or with other GPL-compatible software, or if it is done without using any work based on GCC. For example, using non-GPL-compatible Software to optimize any GCC intermediate representations would not qualify as an Eligible Compilation Process.
-
- 1. Grant of Additional Permission.
-
- You have permission to propagate a work of Target Code formed by combining the Runtime Library with Independent Modules, even if such propagation would otherwise violate the terms of GPLv3, provided that all Target Code was generated by Eligible Compilation Processes. You may then convey such a combination under terms of your choice, consistent with the licensing of the Independent Modules.
-
- 2. No Weakening of GCC Copyleft.
-
-The availability of this Exception does not imply any general presumption that third-party software is unaffected by the copyleft requirements of the license of GCC.
+GCC RUNTIME LIBRARY EXCEPTION
+
+Version 3.1, 31 March 2009
+
+General information: http://www.gnu.org/licenses/gcc-exception.html
+
+Copyright (C) 2009 Free Software Foundation, Inc.
+
+Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
+
+This GCC Runtime Library Exception ("Exception") is an additional permission under section 7 of the GNU General Public License, version 3 ("GPLv3"). It applies to a given file (the "Runtime Library") that bears a notice placed by the copyright holder of the file stating that the file is governed by GPLv3 along with this Exception.
+
+When you use GCC to compile a program, GCC may combine portions of certain GCC header files and runtime libraries with the compiled program. The purpose of this Exception is to allow compilation of non-GPL (including proprietary) programs to use, in this way, the header files and runtime libraries covered by this Exception.
+
+ 0. Definitions.
+
+ A file is an "Independent Module" if it either requires the Runtime Library for execution after a Compilation Process, or makes use of an interface provided by the Runtime Library, but is not otherwise based on the Runtime Library.
+
+ "GCC" means a version of the GNU Compiler Collection, with or without modifications, governed by version 3 (or a specified later version) of the GNU General Public License (GPL) with the option of using any subsequent versions published by the FSF.
+
+ "GPL-compatible Software" is software whose conditions of propagation, modification and use would permit combination with GCC in accord with the license of GCC.
+
+ "Target Code" refers to output from any compiler for a real or virtual target processor architecture, in executable form or suitable for input to an assembler, loader, linker and/or execution phase. Notwithstanding that, Target Code does not include data in any format that is used as a compiler intermediate representation, or used for producing a compiler intermediate representation.
+
+ The "Compilation Process" transforms code entirely represented in non-intermediate languages designed for human-written code, and/or in Java Virtual Machine byte code, into Target Code. Thus, for example, use of source code generators and preprocessors need not be considered part of the Compilation Process, since the Compilation Process can be understood as starting with the output of the generators or preprocessors.
+
+ A Compilation Process is "Eligible" if it is done using GCC, alone or with other GPL-compatible software, or if it is done without using any work based on GCC. For example, using non-GPL-compatible Software to optimize any GCC intermediate representations would not qualify as an Eligible Compilation Process.
+
+ 1. Grant of Additional Permission.
+
+ You have permission to propagate a work of Target Code formed by combining the Runtime Library with Independent Modules, even if such propagation would otherwise violate the terms of GPLv3, provided that all Target Code was generated by Eligible Compilation Processes. You may then convey such a combination under terms of your choice, consistent with the licensing of the Independent Modules.
+
+ 2. No Weakening of GCC Copyleft.
+
+The availability of this Exception does not imply any general presumption that third-party software is unaffected by the copyleft requirements of the license of GCC.
diff --git a/README - 副本.md b/README - 副本.md
deleted file mode 100644
index 0dc5f47..0000000
--- a/README - 副本.md
+++ /dev/null
@@ -1,21 +0,0 @@
-# 使用3号内核进行调式
-#### 从命令行创建一个新的仓库
-
-```bash
-touch README.md
-git init
-git add README.md
-git commit -m "first commit"
-git remote add origin https://bdgit.educoder.net/p7px8vou9/system_call_expand.git
-git push -u origin master
-
-```
-
-#### 从命令行推送已经创建的仓库
-
-```bash
-git remote add origin https://bdgit.educoder.net/p7px8vou9/system_call_expand.git
-git push -u origin master
-
-```
-
diff --git a/README.md b/README.md
index 0dc5f47..7cee136 100644
--- a/README.md
+++ b/README.md
@@ -1,21 +1,21 @@
-# 使用3号内核进行调式
-#### 从命令行创建一个新的仓库
-
-```bash
-touch README.md
-git init
-git add README.md
-git commit -m "first commit"
-git remote add origin https://bdgit.educoder.net/p7px8vou9/system_call_expand.git
-git push -u origin master
-
-```
-
-#### 从命令行推送已经创建的仓库
-
-```bash
-git remote add origin https://bdgit.educoder.net/p7px8vou9/system_call_expand.git
-git push -u origin master
-
-```
-
+# 使用3号内核进行调式
+#### 从命令行创建一个新的仓库
+
+```bash
+touch README.md
+git init
+git add README.md
+git commit -m "first commit"
+git remote add origin https://bdgit.educoder.net/p7px8vou9/system_call_expand.git
+git push -u origin master
+
+```
+
+#### 从命令行推送已经创建的仓库
+
+```bash
+git remote add origin https://bdgit.educoder.net/p7px8vou9/system_call_expand.git
+git push -u origin master
+
+```
+
diff --git a/linux-0.11-lab - 副本/0.gdb b/linux-0.11-lab - 副本/0.gdb
index 6c2dbf1..f0d8766 100644
--- a/linux-0.11-lab - 副本/0.gdb
+++ b/linux-0.11-lab - 副本/0.gdb
@@ -1,5 +1,5 @@
-target remote localhost:1234
-handle SIGSEGV nostop noprint ignore
-b main
-display current->pid
-c
+target remote localhost:1234
+handle SIGSEGV nostop noprint ignore
+b main
+display current->pid
+c
diff --git a/linux-0.11-lab - 副本/0/README b/linux-0.11-lab - 副本/0/README
index 2e56a37..b324478 100644
--- a/linux-0.11-lab - 副本/0/README
+++ b/linux-0.11-lab - 副本/0/README
@@ -1,6 +1,6 @@
-revision history:
-
-版本0: 这是oldlinux.org网站上的linux-0.11-lab.rar中的版本。可能是赵博士在原始0.11版本的基础上修改而成。我做了如下改动:
- a) 对一些Makefile做了修改,生成调试信息;
- b) 将其移植到ubuntu和debian下,主要修改的地方用 "by wyj"标注。
-
+revision history:
+
+版本0: 这是oldlinux.org网站上的linux-0.11-lab.rar中的版本。可能是赵博士在原始0.11版本的基础上修改而成。我做了如下改动:
+ a) 对一些Makefile做了修改,生成调试信息;
+ b) 将其移植到ubuntu和debian下,主要修改的地方用 "by wyj"标注。
+
diff --git a/linux-0.11-lab - 副本/0/Source-Insight/Linux-0.11.SearchResults b/linux-0.11-lab - 副本/0/Source-Insight/Linux-0.11.SearchResults
index 2932b28..b6c0a0d 100644
--- a/linux-0.11-lab - 副本/0/Source-Insight/Linux-0.11.SearchResults
+++ b/linux-0.11-lab - 副本/0/Source-Insight/Linux-0.11.SearchResults
@@ -1,2 +1,2 @@
----- Partition table Matches (1 in 1 files) ----
-Hd.c (kernel\blk_drv): printk("Partition table%s ok.\n\r",(NR_HD>1)?"s":"");
+---- Partition table Matches (1 in 1 files) ----
+Hd.c (kernel\blk_drv): printk("Partition table%s ok.\n\r",(NR_HD>1)?"s":"");
diff --git a/linux-0.11-lab - 副本/0/linux/Makefile b/linux-0.11-lab - 副本/0/linux/Makefile
index ecbcf30..88fb82a 100644
--- a/linux-0.11-lab - 副本/0/linux/Makefile
+++ b/linux-0.11-lab - 副本/0/linux/Makefile
@@ -1,125 +1,125 @@
-#
-# if you want the ram-disk device, define this to be the
-# size in blocks.
-#
-RAMDISK = #-DRAMDISK=512
-
-AS86 =as86 -0 -a
-LD86 =ld86 -0
-
-AS =as
-LD =ld
-LDFLAGS =-m elf_i386 -Ttext 0 -e startup_32 -Map=System.map.2 -N
-CC =gcc -march=i386 $(RAMDISK)
-CFLAGS =-w -g -fstrength-reduce -fomit-frame-pointer -fno-stack-protector -mcld
-CPP =cpp -nostdinc -Iinclude
-
-#
-# ROOT_DEV specifies the default root-device when making the image.
-# This can be either FLOPPY, /dev/xxxx or empty, in which case the
-# default of /dev/hd6 is used by 'build'.
-#
-ROOT_DEV=
-
-ARCHIVES=kernel/kernel.o mm/mm.o fs/fs.o
-DRIVERS =kernel/blk_drv/blk_drv.a kernel/chr_drv/chr_drv.a
-MATH =kernel/math/math.a
-LIBS =lib/lib.a
-
-.c.s:
- $(CC) $(CFLAGS) \
- -nostdinc -Iinclude -S -o $*.s $<
-.s.o:
- $(AS) -o $*.o $<
-.c.o:
- $(CC) $(CFLAGS) \
- -nostdinc -Iinclude -c -o $*.o $<
-
-all: Image
-
-Image: boot/bootsect boot/setup tools/system tools/build
- cp -f tools/system system.tmp
- strip system.tmp
- tools/build boot/bootsect boot/setup system.tmp $(ROOT_DEV) > Image
- rm -f system.tmp
- sync
-
-disk: Image
- dd bs=8192 if=Image of=/dev/PS0
-
-tools/build: tools/build.c
- $(CC) $(CFLAGS) \
- -o tools/build tools/build.c
-
-boot/head.o: boot/head.s
-
-tools/system: boot/head.o init/main.o \
- $(ARCHIVES) $(DRIVERS) $(MATH) $(LIBS)
- $(LD) $(LDFLAGS) boot/head.o init/main.o \
- $(ARCHIVES) \
- $(DRIVERS) \
- $(MATH) \
- $(LIBS) \
- -o tools/system
- nm tools/system | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw]\)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort >System.map
-
-kernel/math/math.a: FORCE
- (cd kernel/math; make)
-
-kernel/blk_drv/blk_drv.a: FORCE
- (cd kernel/blk_drv; make)
-
-kernel/chr_drv/chr_drv.a: FORCE
- (cd kernel/chr_drv; make)
-
-kernel/kernel.o: FORCE
- (cd kernel; make)
-
-mm/mm.o: FORCE
- (cd mm; make)
-
-fs/fs.o: FORCE
- (cd fs; make)
-
-lib/lib.a: FORCE
- (cd lib; make)
-
-FORCE:
-
-boot/setup: boot/setup.s
- $(AS86) -o boot/setup.o boot/setup.s
- $(LD86) -s -o boot/setup boot/setup.o
-
-boot/bootsect: boot/bootsect.s
- $(AS86) -o boot/bootsect.o boot/bootsect.s
- $(LD86) -s -o boot/bootsect boot/bootsect.o
-
-tmp.s: boot/bootsect.s tools/system
- (echo -n "SYSSIZE = (";ls -l tools/system | grep system \
- | cut -c25-31 | tr '\012' ' '; echo "+ 15 ) / 16") > tmp.s
- cat boot/bootsect.s >> tmp.s
-
-clean:
- rm -f Image System.map tmp_make core System.map.2
- rm -f boot/bootsect boot/setup
- rm -f init/*.o tools/system tools/build boot/*.o
- (cd mm;make clean)
- (cd fs;make clean)
- (cd kernel;make clean)
- (cd lib;make clean)
-
-dep:
- sed '/\#\#\# Dependencies/q' < Makefile > tmp_make
- (for i in init/*.c;do echo -n "init/";$(CPP) -M $$i;done) >> tmp_make
- cp tmp_make Makefile
- (cd fs; make dep)
- (cd kernel; make dep)
- (cd mm; make dep)
-
-### Dependencies:
-init/main.o : init/main.c include/unistd.h include/sys/stat.h \
- include/sys/types.h include/sys/times.h include/sys/utsname.h \
- include/utime.h include/time.h include/linux/tty.h include/termios.h \
- include/linux/sched.h include/linux/head.h include/linux/fs.h \
- include/linux/mm.h include/signal.h include/asm/system.h include/asm/io.h \
- include/stddef.h include/stdarg.h include/fcntl.h
+#
+# if you want the ram-disk device, define this to be the
+# size in blocks.
+#
+RAMDISK = #-DRAMDISK=512
+
+AS86 =as86 -0 -a
+LD86 =ld86 -0
+
+AS =as
+LD =ld
+LDFLAGS =-m elf_i386 -Ttext 0 -e startup_32 -Map=System.map.2 -N
+CC =gcc -march=i386 $(RAMDISK)
+CFLAGS =-w -g -fstrength-reduce -fomit-frame-pointer -fno-stack-protector -mcld
+CPP =cpp -nostdinc -Iinclude
+
+#
+# ROOT_DEV specifies the default root-device when making the image.
+# This can be either FLOPPY, /dev/xxxx or empty, in which case the
+# default of /dev/hd6 is used by 'build'.
+#
+ROOT_DEV=
+
+ARCHIVES=kernel/kernel.o mm/mm.o fs/fs.o
+DRIVERS =kernel/blk_drv/blk_drv.a kernel/chr_drv/chr_drv.a
+MATH =kernel/math/math.a
+LIBS =lib/lib.a
+
+.c.s:
+ $(CC) $(CFLAGS) \
+ -nostdinc -Iinclude -S -o $*.s $<
+.s.o:
+ $(AS) -o $*.o $<
+.c.o:
+ $(CC) $(CFLAGS) \
+ -nostdinc -Iinclude -c -o $*.o $<
+
+all: Image
+
+Image: boot/bootsect boot/setup tools/system tools/build
+ cp -f tools/system system.tmp
+ strip system.tmp
+ tools/build boot/bootsect boot/setup system.tmp $(ROOT_DEV) > Image
+ rm -f system.tmp
+ sync
+
+disk: Image
+ dd bs=8192 if=Image of=/dev/PS0
+
+tools/build: tools/build.c
+ $(CC) $(CFLAGS) \
+ -o tools/build tools/build.c
+
+boot/head.o: boot/head.s
+
+tools/system: boot/head.o init/main.o \
+ $(ARCHIVES) $(DRIVERS) $(MATH) $(LIBS)
+ $(LD) $(LDFLAGS) boot/head.o init/main.o \
+ $(ARCHIVES) \
+ $(DRIVERS) \
+ $(MATH) \
+ $(LIBS) \
+ -o tools/system
+ nm tools/system | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw]\)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort >System.map
+
+kernel/math/math.a: FORCE
+ (cd kernel/math; make)
+
+kernel/blk_drv/blk_drv.a: FORCE
+ (cd kernel/blk_drv; make)
+
+kernel/chr_drv/chr_drv.a: FORCE
+ (cd kernel/chr_drv; make)
+
+kernel/kernel.o: FORCE
+ (cd kernel; make)
+
+mm/mm.o: FORCE
+ (cd mm; make)
+
+fs/fs.o: FORCE
+ (cd fs; make)
+
+lib/lib.a: FORCE
+ (cd lib; make)
+
+FORCE:
+
+boot/setup: boot/setup.s
+ $(AS86) -o boot/setup.o boot/setup.s
+ $(LD86) -s -o boot/setup boot/setup.o
+
+boot/bootsect: boot/bootsect.s
+ $(AS86) -o boot/bootsect.o boot/bootsect.s
+ $(LD86) -s -o boot/bootsect boot/bootsect.o
+
+tmp.s: boot/bootsect.s tools/system
+ (echo -n "SYSSIZE = (";ls -l tools/system | grep system \
+ | cut -c25-31 | tr '\012' ' '; echo "+ 15 ) / 16") > tmp.s
+ cat boot/bootsect.s >> tmp.s
+
+clean:
+ rm -f Image System.map tmp_make core System.map.2
+ rm -f boot/bootsect boot/setup
+ rm -f init/*.o tools/system tools/build boot/*.o
+ (cd mm;make clean)
+ (cd fs;make clean)
+ (cd kernel;make clean)
+ (cd lib;make clean)
+
+dep:
+ sed '/\#\#\# Dependencies/q' < Makefile > tmp_make
+ (for i in init/*.c;do echo -n "init/";$(CPP) -M $$i;done) >> tmp_make
+ cp tmp_make Makefile
+ (cd fs; make dep)
+ (cd kernel; make dep)
+ (cd mm; make dep)
+
+### Dependencies:
+init/main.o : init/main.c include/unistd.h include/sys/stat.h \
+ include/sys/types.h include/sys/times.h include/sys/utsname.h \
+ include/utime.h include/time.h include/linux/tty.h include/termios.h \
+ include/linux/sched.h include/linux/head.h include/linux/fs.h \
+ include/linux/mm.h include/signal.h include/asm/system.h include/asm/io.h \
+ include/stddef.h include/stdarg.h include/fcntl.h
diff --git a/linux-0.11-lab - 副本/0/linux/System.map b/linux-0.11-lab - 副本/0/linux/System.map
index 6e469c2..2e7eb75 100644
--- a/linux-0.11-lab - 副本/0/linux/System.map
+++ b/linux-0.11-lab - 副本/0/linux/System.map
@@ -1,576 +1,576 @@
-00000000 T pg_dir
-00000000 T startup_32
-0000005a t check_x87
-00000073 t setup_idt
-00000090 t rp_sidt
-000000a3 t setup_gdt
-00001000 t pg0
-00002000 t pg1
-00003000 t pg2
-00004000 t pg3
-00005000 T tmp_floppy_area
-00005412 t L6
-00005414 t int_msg
-00005428 t ignore_int
-00005450 t setup_paging
-000054ae t idt_descr
-000054b6 t gdt_descr
-000054c0 T idt
-00005cc0 T gdt
-000064c0 T fork
-000064ef T pause
-0000651e T setup
-00006555 T sync
-00006584 t time_init
-00006799 T main
-0000690c t printf
-0000695b T init
-00006bd4 T show_task
-00006c59 T show_stat
-00006c9f T math_state_restore
-00006cfd T schedule
-00006eaf T sys_pause
-00006ec5 T sleep_on
-00006f24 T interruptible_sleep_on
-00006fdf T ticks_to_floppy_on
-000070aa T floppy_on
-000070d9 T floppy_off
-000070e9 T do_floppy_timer
-000072e1 T do_timer
-000073d0 T sys_alarm
-0000744f T sys_getpid
-0000745b T sys_getppid
-00007467 T sys_getuid
-00007476 T sys_geteuid
-00007486 T sys_getgid
-00007496 T sys_getegid
-000074a5 T sys_nice
-000074d0 T sched_init
-00007660 t bad_sys_call
-00007668 t reschedule
-00007674 T system_call
-000076a8 t ret_from_sys_call
-000076f0 T coprocessor_error
-00007712 T device_not_available
-0000774c T timer_interrupt
-00007784 T sys_execve
-00007794 T sys_fork
-000077ac T hd_interrupt
-000077e8 T floppy_interrupt
-0000781e T parallel_interrupt
-00007825 t _get_base
-00007857 t die
-00007a39 T do_double_fault
-00007a5c T do_general_protection
-00007a7f T do_divide_error
-00007aa2 T do_int3
-00007b6a T do_nmi
-00007b8d T do_debug
-00007bb0 T do_overflow
-00007bd3 T do_bounds
-00007bf6 T do_invalid_op
-00007c19 T do_device_not_available
-00007c3c T do_coprocessor_segment_overrun
-00007c5f T do_invalid_TSS
-00007c82 T do_segment_not_present
-00007ca5 T do_stack_segment
-00007cc8 T do_coprocessor_error
-00007cfc T do_reserved
-00007d1f T trap_init
-00008003 T divide_error
-00008008 t no_error_code
-00008038 T debug
-0000803f T nmi
-00008046 T int3
-0000804d T overflow
-00008054 T bounds
-0000805b T invalid_op
-00008062 T coprocessor_segment_overrun
-00008069 T reserved
-00008070 T irq13
-00008085 T double_fault
-0000808a t error_code
-000080bc T invalid_TSS
-000080c3 T segment_not_present
-000080ca T stack_segment
-000080d1 T general_protection
-000080d8 t _get_base
-0000810a T verify_area
-00008171 T copy_mem
-000082cb T copy_process
-00008778 T find_empty_process
-0000880c T panic
-00008847 T printk
-00008898 t skip_atoi
-000088f3 t number
-00008b64 T vsprintf
-00008ff0 t get_fs_long
-00009006 t put_fs_byte
-0000901e t put_fs_long
-0000902a T sys_ftime
-00009030 T sys_break
-00009036 T sys_ptrace
-0000903c T sys_stty
-00009042 T sys_gtty
-00009048 T sys_rename
-0000904e T sys_prof
-00009054 T sys_setregid
-0000910d T sys_setgid
-000091a4 T sys_acct
-000091aa T sys_phys
-000091b0 T sys_lock
-000091b6 T sys_mpx
-000091bc T sys_ulimit
-000091c2 T sys_time
-0000921e T sys_setreuid
-00009300 T sys_setuid
-00009395 T sys_stime
-000093eb T sys_times
-0000948b T sys_brk
-000094cd T sys_setpgid
-000095a6 T sys_getpgrp
-000095b2 T sys_setsid
-0000962c T sys_getgroups
-00009632 T sys_setgroups
-00009638 T sys_uname
-000096a1 T sys_sethostname
-000096a7 T sys_getrlimit
-000096ad T sys_setrlimit
-000096b3 T sys_getrusage
-000096b9 T sys_gettimeofday
-000096bf T sys_settimeofday
-000096c5 T sys_umask
-000096f8 t _get_base
-0000972a t put_fs_long
-00009736 T release
-0000979a t send_sig
-00009819 t kill_session
-00009873 T sys_kill
-00009a23 t tell_father
-00009aad T do_exit
-00009ce1 T sys_exit
-00009cfa T sys_waitpid
-00009f20 t get_fs_byte
-00009f2e t put_fs_byte
-00009f46 t put_fs_long
-00009f52 T sys_sgetmask
-00009f5e T sys_ssetmask
-00009f8a T sys_sigpending
-00009f90 T sys_sigsuspend
-00009f96 t save_old
-00009fe9 t get_new
-0000a029 T sys_signal
-0000a0ad T sys_sigaction
-0000a1b7 T do_signal
-0000a3a3 T kernel_mktime
-0000a4e8 t oom
-0000a507 T get_free_page
-0000a543 T free_page
-0000a5b2 T free_page_tables
-0000a6b1 T copy_page_tables
-0000a832 T put_page
-0000a91e T un_wp_page
-0000a9d6 T do_wp_page
-0000aa61 T get_empty_page
-0000aaa1 t try_to_share
-0000ac33 t share_page
-0000ace7 T do_no_page
-0000ae49 T mem_init
-0000aebd T calc_mem
-0000afb2 T page_fault
-0000afe9 t get_fs_long
-0000afff T sys_ustat
-0000b005 T sys_utime
-0000b0b2 T sys_access
-0000b18e T sys_chdir
-0000b202 T sys_chroot
-0000b276 T sys_chmod
-0000b310 T sys_chown
-0000b38b T sys_open
-0000b62e T sys_creat
-0000b651 T sys_close
-0000b720 T sys_lseek
-0000b837 T sys_read
-0000ba2a T sys_write
-0000bbd8 t lock_inode
-0000bc05 t unlock_inode
-0000bc23 T invalidate_inodes
-0000bc92 T sync_inodes
-0000bce9 t _bmap
-0000c0d5 T bmap
-0000c0f8 T create_block
-0000c11b T iput
-0000c28a T get_empty_inode
-0000c3df T get_pipe_inode
-0000c454 T iget
-0000c619 t read_inode
-0000c84f T sys_sync
-0000c8b2 T sync_dev
-0000c9ab T invalidate_buffers
-0000ca1d T check_disk_change
-0000cac7 t remove_from_queues
-0000cbbe t insert_into_queues
-0000cc83 t find_buffer
-0000cceb T get_hash_table
-0000cd6d T getblk
-0000cf0b T brelse
-0000cf54 T bread
-0000cfd9 T bread_page
-0000d0fb T breada
-0000d1f0 T buffer_init
-0000d31f t lock_super
-0000d34c t free_super
-0000d391 T get_super
-0000d400 T put_super
-0000d4d3 t read_super
-0000d816 T sys_umount
-0000d977 T sys_mount
-0000dae8 T mount_root
-0000dcf6 t get_fs_byte
-0000dd04 t put_fs_byte
-0000dd1c T block_write
-0000de6e T block_read
-0000df99 t get_fs_byte
-0000dfa7 t put_fs_byte
-0000dfbf t rw_ttyx
-0000e007 t rw_tty
-0000e057 t rw_ram
-0000e05d t rw_mem
-0000e063 t rw_kmem
-0000e069 t rw_port
-0000e103 t rw_memory
-0000e1d9 T rw_char
-0000e243 t get_fs_byte
-0000e251 t put_fs_byte
-0000e269 T file_read
-0000e414 T file_write
-0000e60e t put_fs_byte
-0000e626 t cp_stat
-0000e6fd T sys_stat
-0000e747 T sys_lstat
-0000e762 T sys_fstat
-0000e7bf T sys_readlink
-0000e7c5 t _get_base
-0000e7f7 t get_fs_byte
-0000e805 t get_fs_long
-0000e81b t put_fs_byte
-0000e833 t put_fs_long
-0000e83f t get_fs
-0000e853 t get_ds
-0000e867 t set_fs
-0000e86e T sys_uselib
-0000e874 t create_tables
-0000e9bf t count
-0000e9fe t copy_strings
-0000ebba t change_ldt
-0000ed3d T do_execve
-0000f7bf t get_fs_byte
-0000f7cd t put_fs_byte
-0000f7e5 t put_fs_long
-0000f7f1 T read_pipe
-0000fac6 T sys_pipe
-0000fcc8 t get_fs_byte
-0000fcd6 t permission
-0000fd77 t match
-0000fddf t find_entry
-00010239 t get_dir
-00010426 t dir_namei
-000104a5 T namei
-000105bb T open_namei
-0001090e T sys_mknod
-00010b3e T sys_mkdir
-00010eef t empty_dir
-000110cd T sys_rmdir
-00011425 T sys_unlink
-000116c6 T sys_symlink
-000116cc T sys_link
-00011926 T free_block
-00011a98 T new_block
-00011c3c T free_inode
-00011da3 T new_inode
-00011f7d t dupfd
-00012057 T sys_dup2
-0001207e T sys_dup
-00012099 T sys_fcntl
-000121d8 T sys_ioctl
-000122a9 t free_ind
-00012348 t free_dind
-000123e7 T truncate
-0001251c T sys_select
-00012522 t lock_buffer
-0001254f t unlock_buffer
-00012741 t make_request
-000128e5 T ll_rw_block
-0001293e T blk_dev_init
-0001298c t unlock_buffer
-000129c1 t end_request
-00012a72 T floppy_deselect
-00012aa9 T floppy_change
-00012b2f t setup_DMA
-00012be5 t output_byte
-00012c5b t result
-00012d18 t bad_flp_intr
-00012d77 t rw_interrupt
-00012e66 T setup_rw_floppy
-00012f27 t seek_interrupt
-00012f80 t transfer
-000130b5 t recal_interrupt
-000130ff T unexpected_floppy_interrupt
-00013144 t recalibrate_floppy
-000131a6 t reset_interrupt
-000131eb t reset_floppy
-00013268 t floppy_on_interrupt
-000132d3 t do_fd_request
-000134d7 T floppy_init
-00013529 t unlock_buffer
-0001355e t end_request
-000135fd T sys_setup
-000139b0 t controller_ready
-00013a44 t hd_out
-00013b31 t drive_busy
-00013b97 t reset_controller
-00013c14 t reset_hd
-00013cac T unexpected_hd_interrupt
-00013cbf t bad_rw_intr
-00013cfd t read_intr
-00013e23 t recal_intr
-00013e3d t do_hd_request
-0001413e T hd_init
-000141b8 t unlock_buffer
-000141ed t end_request
-0001428c t do_rd_request
-000143c2 T rd_init
-00014418 T rd_load
-000146c4 t get_fs_byte
-000146d2 t put_fs_byte
-000146ea T tty_init
-000146fb T tty_intr
-0001476f t sleep_if_empty
-000147a7 t sleep_if_full
-0001481b T copy_to_cooked
-00014dd6 T tty_read
-00015144 T tty_write
-00015356 T do_tty_interrupt
-0001537e T chr_dev_init
-0001537f t gotoxy
-000153cd t set_origin
-00015433 t scrup
-00015623 t scrdown
-0001571a t lf
-00015750 t ri
-00015786 t cr
-000157a7 t del
-000157d9 t csi_J
-0001586a t csi_K
-0001591c T csi_m
-00015983 t set_cursor
-000159e9 t respond
-00015a41 t insert_char
-00015aa4 t insert_line
-00015ae8 t delete_char
-00015b46 t delete_line
-00015b8a t csi_at
-00015bc8 t csi_L
-00015c06 t csi_P
-00015c44 t csi_M
-00015c82 t save_cur
-00015c97 t restore_cur
-00015cb6 T con_write
-00016344 T con_init
-0001657b T sysbeepstop
-000165a4 t sysbeep
-00016602 t mode
-00016603 t leds
-00016604 t e0
-00016605 T keyboard_interrupt
-0001662e t e0_e1
-00016659 t set_e0
-00016662 t set_e1
-0001666b t put_queue
-000166a4 t ctrl
-000166bc t unctrl
-000166c0 t unalt
-000166d6 t lshift
-000166de t unlshift
-000166e6 t rshift
-000166ee t unrshift
-000166f6 t caps
-00016718 t set_leds
-0001672e t uncaps
-00016736 t scroll
-0001673f t num
-00016748 t cursor
-00016768 t cur2
-00016791 t cur
-0001679d t ok_cur
-000167ab t num_table
-000167b8 t cur_table
-000167c5 t func
-000167e2 t ok_func
-000167f5 t end_func
-000167f6 t func_table
-00016826 t key_map
-00016887 t shift_map
-00016949 t do_self
-000169b1 t none
-000169b2 t minus
-000169c7 t key_table
-00016dc7 t kb_wait
-00016dd0 t reboot
-00016de2 t die
-00016de4 t init
-00016e59 T rs_init
-00016edc T rs_write
-00016f2c T rs1_interrupt
-00016f34 T rs2_interrupt
-00016f39 t rs_int
-00016f50 t rep_int
-00016f6d t end
-00016f7b t jmp_table
-00016f8c t modem_status
-00016f94 t line_status
-00016f9c t read_char
-00017023 t get_fs_byte
-00017031 t get_fs_long
-00017047 t put_fs_byte
-0001705f t put_fs_long
-0001706b t change_speed
-000170e9 t flush
-000170fb t send_break
-000170fc t get_termios
-00017158 t set_termios
-000171a8 t get_termio
-00017270 t set_termio
-00017334 T tty_ioctl
-00017632 t get_fs_byte
-00017640 T math_emulate
-00017723 T math_error
-00017743 T _exit
-00017753 T open
-0001779c T close
-00017810 T dup
-00017847 T setsid
-00017876 T execve
-00017913 T strcpy
-0001792f T strncpy
-00017954 T strcat
-0001797f T strncat
-000179b4 T strcmp
-000179db T strncmp
-00017a09 T strchr
-00017a36 T strrchr
-00017a65 T strspn
-00017aa2 T strcspn
-00017adf T strpbrk
-00017b16 T strstr
-00017b4f T strlen
-00017b72 T strtok
-00017bf5 T memcpy
-00017c15 T memmove
-00017c69 T memcmp
-00017c93 T memchr
-00017ccb T memset
-0001bb48 d envp_rc
-0001bb5c d envp
-0001bb80 D sys_call_table
-0001bcdc D NR_syscalls
-0001bce0 d init_task
-0001cce0 D current
-0001cd00 D task
-0001ce00 D stack_start
-0001ce08 D current_DOR
-0001ce20 d thisname.1955
-0001ce60 d month
-0001cea0 d last_inode.1935
-0001cea4 D start_buffer
-0001cec0 d crw_table
-0001cee0 d ioctl_table
-0001cf00 d floppy_type
-0001cfc0 d cur_spec1
-0001cfc4 d cur_rate
-0001cfc8 d floppy
-0001cfcc d current_track
-0001cfd0 d callable.1844
-0001cfe0 D tty_table
-0001f500 D table_list
-0001f520 d quotient
-0001f540 D _ctype
-0001f641 B __bss_start
-0001f641 D _edata
-0001f660 b printbuf
-0001fa60 b memory_end
-0001fa64 b buffer_memory_end
-0001fa68 b main_memory_start
-0001fa80 B jiffies
-0001fa84 B startup_time
-0001fa88 B last_task_used_math
-0001fa9c b mon_timer
-0001faac b moff_timer
-0001fac0 b timer_list
-0001fdc0 b next_timer
-0001fdc4 B last_pid
-0001fde0 b buf
-000201e0 b HIGH_MEMORY
-00020200 b mem_map
-00021100 B inode_table
-00021800 B nr_buffers
-00021804 b free_list
-00021808 b buffer_wait
-0002180c B ROOT_DEV
-00021840 B blk_dev
-00021878 B do_floppy
-0002187c B selected
-00021884 b recalibrate
-00021888 b reset
-0002188c b seek
-00021890 b reply_buffer
-00021897 b current_drive
-00021898 b sector
-00021899 b head
-0002189a b track
-0002189b b seek_track
-0002189c b command
-000218a0 B do_hd
-000218c0 B hd_info
-000218f0 b recalibrate
-000218f4 b reset
-000218f8 b NR_HD
-00021900 b hd
-00021950 B rd_length
-00021954 b cr_flag.1923
-00021960 B beepcount
-00021964 b video_type
-00021968 b video_num_columns
-0002196c b video_size_row
-00021970 b video_num_lines
-00021974 b video_page
-00021978 b video_mem_start
-0002197c b video_mem_end
-00021980 b video_port_reg
-00021982 b video_port_val
-00021984 b video_erase_char
-00021988 b origin
-0002198c b scr_end
-00021990 b pos
-00021994 b x
-00021998 b y
-0002199c b top
-000219a0 b bottom
-000219a4 b state
-000219a8 b npar
-000219c0 b par
-00021a00 b ques
-00021a04 b saved_x
-00021a08 b saved_y
-00021a20 B drive_info
-00021a40 B user_stack
-00022a40 B hash_table
-00022f20 B super_block
-00023280 B file_table
-00023680 B request
-00023b00 B rd_start
-00023b04 B _ctmp
-00023b08 B errno
-00023b0c B ___strtok
-00023b10 B end
-00023b10 B _end
+00000000 T pg_dir
+00000000 T startup_32
+0000005a t check_x87
+00000073 t setup_idt
+00000090 t rp_sidt
+000000a3 t setup_gdt
+00001000 t pg0
+00002000 t pg1
+00003000 t pg2
+00004000 t pg3
+00005000 T tmp_floppy_area
+00005412 t L6
+00005414 t int_msg
+00005428 t ignore_int
+00005450 t setup_paging
+000054ae t idt_descr
+000054b6 t gdt_descr
+000054c0 T idt
+00005cc0 T gdt
+000064c0 T fork
+000064ef T pause
+0000651e T setup
+00006555 T sync
+00006584 t time_init
+00006799 T main
+0000690c t printf
+0000695b T init
+00006bd4 T show_task
+00006c59 T show_stat
+00006c9f T math_state_restore
+00006cfd T schedule
+00006eaf T sys_pause
+00006ec5 T sleep_on
+00006f24 T interruptible_sleep_on
+00006fdf T ticks_to_floppy_on
+000070aa T floppy_on
+000070d9 T floppy_off
+000070e9 T do_floppy_timer
+000072e1 T do_timer
+000073d0 T sys_alarm
+0000744f T sys_getpid
+0000745b T sys_getppid
+00007467 T sys_getuid
+00007476 T sys_geteuid
+00007486 T sys_getgid
+00007496 T sys_getegid
+000074a5 T sys_nice
+000074d0 T sched_init
+00007660 t bad_sys_call
+00007668 t reschedule
+00007674 T system_call
+000076a8 t ret_from_sys_call
+000076f0 T coprocessor_error
+00007712 T device_not_available
+0000774c T timer_interrupt
+00007784 T sys_execve
+00007794 T sys_fork
+000077ac T hd_interrupt
+000077e8 T floppy_interrupt
+0000781e T parallel_interrupt
+00007825 t _get_base
+00007857 t die
+00007a39 T do_double_fault
+00007a5c T do_general_protection
+00007a7f T do_divide_error
+00007aa2 T do_int3
+00007b6a T do_nmi
+00007b8d T do_debug
+00007bb0 T do_overflow
+00007bd3 T do_bounds
+00007bf6 T do_invalid_op
+00007c19 T do_device_not_available
+00007c3c T do_coprocessor_segment_overrun
+00007c5f T do_invalid_TSS
+00007c82 T do_segment_not_present
+00007ca5 T do_stack_segment
+00007cc8 T do_coprocessor_error
+00007cfc T do_reserved
+00007d1f T trap_init
+00008003 T divide_error
+00008008 t no_error_code
+00008038 T debug
+0000803f T nmi
+00008046 T int3
+0000804d T overflow
+00008054 T bounds
+0000805b T invalid_op
+00008062 T coprocessor_segment_overrun
+00008069 T reserved
+00008070 T irq13
+00008085 T double_fault
+0000808a t error_code
+000080bc T invalid_TSS
+000080c3 T segment_not_present
+000080ca T stack_segment
+000080d1 T general_protection
+000080d8 t _get_base
+0000810a T verify_area
+00008171 T copy_mem
+000082cb T copy_process
+00008778 T find_empty_process
+0000880c T panic
+00008847 T printk
+00008898 t skip_atoi
+000088f3 t number
+00008b64 T vsprintf
+00008ff0 t get_fs_long
+00009006 t put_fs_byte
+0000901e t put_fs_long
+0000902a T sys_ftime
+00009030 T sys_break
+00009036 T sys_ptrace
+0000903c T sys_stty
+00009042 T sys_gtty
+00009048 T sys_rename
+0000904e T sys_prof
+00009054 T sys_setregid
+0000910d T sys_setgid
+000091a4 T sys_acct
+000091aa T sys_phys
+000091b0 T sys_lock
+000091b6 T sys_mpx
+000091bc T sys_ulimit
+000091c2 T sys_time
+0000921e T sys_setreuid
+00009300 T sys_setuid
+00009395 T sys_stime
+000093eb T sys_times
+0000948b T sys_brk
+000094cd T sys_setpgid
+000095a6 T sys_getpgrp
+000095b2 T sys_setsid
+0000962c T sys_getgroups
+00009632 T sys_setgroups
+00009638 T sys_uname
+000096a1 T sys_sethostname
+000096a7 T sys_getrlimit
+000096ad T sys_setrlimit
+000096b3 T sys_getrusage
+000096b9 T sys_gettimeofday
+000096bf T sys_settimeofday
+000096c5 T sys_umask
+000096f8 t _get_base
+0000972a t put_fs_long
+00009736 T release
+0000979a t send_sig
+00009819 t kill_session
+00009873 T sys_kill
+00009a23 t tell_father
+00009aad T do_exit
+00009ce1 T sys_exit
+00009cfa T sys_waitpid
+00009f20 t get_fs_byte
+00009f2e t put_fs_byte
+00009f46 t put_fs_long
+00009f52 T sys_sgetmask
+00009f5e T sys_ssetmask
+00009f8a T sys_sigpending
+00009f90 T sys_sigsuspend
+00009f96 t save_old
+00009fe9 t get_new
+0000a029 T sys_signal
+0000a0ad T sys_sigaction
+0000a1b7 T do_signal
+0000a3a3 T kernel_mktime
+0000a4e8 t oom
+0000a507 T get_free_page
+0000a543 T free_page
+0000a5b2 T free_page_tables
+0000a6b1 T copy_page_tables
+0000a832 T put_page
+0000a91e T un_wp_page
+0000a9d6 T do_wp_page
+0000aa61 T get_empty_page
+0000aaa1 t try_to_share
+0000ac33 t share_page
+0000ace7 T do_no_page
+0000ae49 T mem_init
+0000aebd T calc_mem
+0000afb2 T page_fault
+0000afe9 t get_fs_long
+0000afff T sys_ustat
+0000b005 T sys_utime
+0000b0b2 T sys_access
+0000b18e T sys_chdir
+0000b202 T sys_chroot
+0000b276 T sys_chmod
+0000b310 T sys_chown
+0000b38b T sys_open
+0000b62e T sys_creat
+0000b651 T sys_close
+0000b720 T sys_lseek
+0000b837 T sys_read
+0000ba2a T sys_write
+0000bbd8 t lock_inode
+0000bc05 t unlock_inode
+0000bc23 T invalidate_inodes
+0000bc92 T sync_inodes
+0000bce9 t _bmap
+0000c0d5 T bmap
+0000c0f8 T create_block
+0000c11b T iput
+0000c28a T get_empty_inode
+0000c3df T get_pipe_inode
+0000c454 T iget
+0000c619 t read_inode
+0000c84f T sys_sync
+0000c8b2 T sync_dev
+0000c9ab T invalidate_buffers
+0000ca1d T check_disk_change
+0000cac7 t remove_from_queues
+0000cbbe t insert_into_queues
+0000cc83 t find_buffer
+0000cceb T get_hash_table
+0000cd6d T getblk
+0000cf0b T brelse
+0000cf54 T bread
+0000cfd9 T bread_page
+0000d0fb T breada
+0000d1f0 T buffer_init
+0000d31f t lock_super
+0000d34c t free_super
+0000d391 T get_super
+0000d400 T put_super
+0000d4d3 t read_super
+0000d816 T sys_umount
+0000d977 T sys_mount
+0000dae8 T mount_root
+0000dcf6 t get_fs_byte
+0000dd04 t put_fs_byte
+0000dd1c T block_write
+0000de6e T block_read
+0000df99 t get_fs_byte
+0000dfa7 t put_fs_byte
+0000dfbf t rw_ttyx
+0000e007 t rw_tty
+0000e057 t rw_ram
+0000e05d t rw_mem
+0000e063 t rw_kmem
+0000e069 t rw_port
+0000e103 t rw_memory
+0000e1d9 T rw_char
+0000e243 t get_fs_byte
+0000e251 t put_fs_byte
+0000e269 T file_read
+0000e414 T file_write
+0000e60e t put_fs_byte
+0000e626 t cp_stat
+0000e6fd T sys_stat
+0000e747 T sys_lstat
+0000e762 T sys_fstat
+0000e7bf T sys_readlink
+0000e7c5 t _get_base
+0000e7f7 t get_fs_byte
+0000e805 t get_fs_long
+0000e81b t put_fs_byte
+0000e833 t put_fs_long
+0000e83f t get_fs
+0000e853 t get_ds
+0000e867 t set_fs
+0000e86e T sys_uselib
+0000e874 t create_tables
+0000e9bf t count
+0000e9fe t copy_strings
+0000ebba t change_ldt
+0000ed3d T do_execve
+0000f7bf t get_fs_byte
+0000f7cd t put_fs_byte
+0000f7e5 t put_fs_long
+0000f7f1 T read_pipe
+0000fac6 T sys_pipe
+0000fcc8 t get_fs_byte
+0000fcd6 t permission
+0000fd77 t match
+0000fddf t find_entry
+00010239 t get_dir
+00010426 t dir_namei
+000104a5 T namei
+000105bb T open_namei
+0001090e T sys_mknod
+00010b3e T sys_mkdir
+00010eef t empty_dir
+000110cd T sys_rmdir
+00011425 T sys_unlink
+000116c6 T sys_symlink
+000116cc T sys_link
+00011926 T free_block
+00011a98 T new_block
+00011c3c T free_inode
+00011da3 T new_inode
+00011f7d t dupfd
+00012057 T sys_dup2
+0001207e T sys_dup
+00012099 T sys_fcntl
+000121d8 T sys_ioctl
+000122a9 t free_ind
+00012348 t free_dind
+000123e7 T truncate
+0001251c T sys_select
+00012522 t lock_buffer
+0001254f t unlock_buffer
+00012741 t make_request
+000128e5 T ll_rw_block
+0001293e T blk_dev_init
+0001298c t unlock_buffer
+000129c1 t end_request
+00012a72 T floppy_deselect
+00012aa9 T floppy_change
+00012b2f t setup_DMA
+00012be5 t output_byte
+00012c5b t result
+00012d18 t bad_flp_intr
+00012d77 t rw_interrupt
+00012e66 T setup_rw_floppy
+00012f27 t seek_interrupt
+00012f80 t transfer
+000130b5 t recal_interrupt
+000130ff T unexpected_floppy_interrupt
+00013144 t recalibrate_floppy
+000131a6 t reset_interrupt
+000131eb t reset_floppy
+00013268 t floppy_on_interrupt
+000132d3 t do_fd_request
+000134d7 T floppy_init
+00013529 t unlock_buffer
+0001355e t end_request
+000135fd T sys_setup
+000139b0 t controller_ready
+00013a44 t hd_out
+00013b31 t drive_busy
+00013b97 t reset_controller
+00013c14 t reset_hd
+00013cac T unexpected_hd_interrupt
+00013cbf t bad_rw_intr
+00013cfd t read_intr
+00013e23 t recal_intr
+00013e3d t do_hd_request
+0001413e T hd_init
+000141b8 t unlock_buffer
+000141ed t end_request
+0001428c t do_rd_request
+000143c2 T rd_init
+00014418 T rd_load
+000146c4 t get_fs_byte
+000146d2 t put_fs_byte
+000146ea T tty_init
+000146fb T tty_intr
+0001476f t sleep_if_empty
+000147a7 t sleep_if_full
+0001481b T copy_to_cooked
+00014dd6 T tty_read
+00015144 T tty_write
+00015356 T do_tty_interrupt
+0001537e T chr_dev_init
+0001537f t gotoxy
+000153cd t set_origin
+00015433 t scrup
+00015623 t scrdown
+0001571a t lf
+00015750 t ri
+00015786 t cr
+000157a7 t del
+000157d9 t csi_J
+0001586a t csi_K
+0001591c T csi_m
+00015983 t set_cursor
+000159e9 t respond
+00015a41 t insert_char
+00015aa4 t insert_line
+00015ae8 t delete_char
+00015b46 t delete_line
+00015b8a t csi_at
+00015bc8 t csi_L
+00015c06 t csi_P
+00015c44 t csi_M
+00015c82 t save_cur
+00015c97 t restore_cur
+00015cb6 T con_write
+00016344 T con_init
+0001657b T sysbeepstop
+000165a4 t sysbeep
+00016602 t mode
+00016603 t leds
+00016604 t e0
+00016605 T keyboard_interrupt
+0001662e t e0_e1
+00016659 t set_e0
+00016662 t set_e1
+0001666b t put_queue
+000166a4 t ctrl
+000166bc t unctrl
+000166c0 t unalt
+000166d6 t lshift
+000166de t unlshift
+000166e6 t rshift
+000166ee t unrshift
+000166f6 t caps
+00016718 t set_leds
+0001672e t uncaps
+00016736 t scroll
+0001673f t num
+00016748 t cursor
+00016768 t cur2
+00016791 t cur
+0001679d t ok_cur
+000167ab t num_table
+000167b8 t cur_table
+000167c5 t func
+000167e2 t ok_func
+000167f5 t end_func
+000167f6 t func_table
+00016826 t key_map
+00016887 t shift_map
+00016949 t do_self
+000169b1 t none
+000169b2 t minus
+000169c7 t key_table
+00016dc7 t kb_wait
+00016dd0 t reboot
+00016de2 t die
+00016de4 t init
+00016e59 T rs_init
+00016edc T rs_write
+00016f2c T rs1_interrupt
+00016f34 T rs2_interrupt
+00016f39 t rs_int
+00016f50 t rep_int
+00016f6d t end
+00016f7b t jmp_table
+00016f8c t modem_status
+00016f94 t line_status
+00016f9c t read_char
+00017023 t get_fs_byte
+00017031 t get_fs_long
+00017047 t put_fs_byte
+0001705f t put_fs_long
+0001706b t change_speed
+000170e9 t flush
+000170fb t send_break
+000170fc t get_termios
+00017158 t set_termios
+000171a8 t get_termio
+00017270 t set_termio
+00017334 T tty_ioctl
+00017632 t get_fs_byte
+00017640 T math_emulate
+00017723 T math_error
+00017743 T _exit
+00017753 T open
+0001779c T close
+00017810 T dup
+00017847 T setsid
+00017876 T execve
+00017913 T strcpy
+0001792f T strncpy
+00017954 T strcat
+0001797f T strncat
+000179b4 T strcmp
+000179db T strncmp
+00017a09 T strchr
+00017a36 T strrchr
+00017a65 T strspn
+00017aa2 T strcspn
+00017adf T strpbrk
+00017b16 T strstr
+00017b4f T strlen
+00017b72 T strtok
+00017bf5 T memcpy
+00017c15 T memmove
+00017c69 T memcmp
+00017c93 T memchr
+00017ccb T memset
+0001bb48 d envp_rc
+0001bb5c d envp
+0001bb80 D sys_call_table
+0001bcdc D NR_syscalls
+0001bce0 d init_task
+0001cce0 D current
+0001cd00 D task
+0001ce00 D stack_start
+0001ce08 D current_DOR
+0001ce20 d thisname.1955
+0001ce60 d month
+0001cea0 d last_inode.1935
+0001cea4 D start_buffer
+0001cec0 d crw_table
+0001cee0 d ioctl_table
+0001cf00 d floppy_type
+0001cfc0 d cur_spec1
+0001cfc4 d cur_rate
+0001cfc8 d floppy
+0001cfcc d current_track
+0001cfd0 d callable.1844
+0001cfe0 D tty_table
+0001f500 D table_list
+0001f520 d quotient
+0001f540 D _ctype
+0001f641 B __bss_start
+0001f641 D _edata
+0001f660 b printbuf
+0001fa60 b memory_end
+0001fa64 b buffer_memory_end
+0001fa68 b main_memory_start
+0001fa80 B jiffies
+0001fa84 B startup_time
+0001fa88 B last_task_used_math
+0001fa9c b mon_timer
+0001faac b moff_timer
+0001fac0 b timer_list
+0001fdc0 b next_timer
+0001fdc4 B last_pid
+0001fde0 b buf
+000201e0 b HIGH_MEMORY
+00020200 b mem_map
+00021100 B inode_table
+00021800 B nr_buffers
+00021804 b free_list
+00021808 b buffer_wait
+0002180c B ROOT_DEV
+00021840 B blk_dev
+00021878 B do_floppy
+0002187c B selected
+00021884 b recalibrate
+00021888 b reset
+0002188c b seek
+00021890 b reply_buffer
+00021897 b current_drive
+00021898 b sector
+00021899 b head
+0002189a b track
+0002189b b seek_track
+0002189c b command
+000218a0 B do_hd
+000218c0 B hd_info
+000218f0 b recalibrate
+000218f4 b reset
+000218f8 b NR_HD
+00021900 b hd
+00021950 B rd_length
+00021954 b cr_flag.1923
+00021960 B beepcount
+00021964 b video_type
+00021968 b video_num_columns
+0002196c b video_size_row
+00021970 b video_num_lines
+00021974 b video_page
+00021978 b video_mem_start
+0002197c b video_mem_end
+00021980 b video_port_reg
+00021982 b video_port_val
+00021984 b video_erase_char
+00021988 b origin
+0002198c b scr_end
+00021990 b pos
+00021994 b x
+00021998 b y
+0002199c b top
+000219a0 b bottom
+000219a4 b state
+000219a8 b npar
+000219c0 b par
+00021a00 b ques
+00021a04 b saved_x
+00021a08 b saved_y
+00021a20 B drive_info
+00021a40 B user_stack
+00022a40 B hash_table
+00022f20 B super_block
+00023280 B file_table
+00023680 B request
+00023b00 B rd_start
+00023b04 B _ctmp
+00023b08 B errno
+00023b0c B ___strtok
+00023b10 B end
+00023b10 B _end
diff --git a/linux-0.11-lab - 副本/0/linux/System.map.2 b/linux-0.11-lab - 副本/0/linux/System.map.2
index 44e841e..6ea2385 100644
--- a/linux-0.11-lab - 副本/0/linux/System.map.2
+++ b/linux-0.11-lab - 副本/0/linux/System.map.2
@@ -1,1075 +1,1075 @@
-Archive member included to satisfy reference by file (symbol)
-
-kernel/blk_drv/blk_drv.a(ll_rw_blk.o)
- fs/fs.o (ll_rw_block)
-kernel/blk_drv/blk_drv.a(floppy.o)
- kernel/kernel.o (do_floppy)
-kernel/blk_drv/blk_drv.a(hd.o)
- kernel/kernel.o (do_hd)
-kernel/blk_drv/blk_drv.a(ramdisk.o)
- kernel/blk_drv/blk_drv.a(hd.o) (rd_load)
-kernel/chr_drv/chr_drv.a(tty_io.o)
- kernel/kernel.o (tty_table)
-kernel/chr_drv/chr_drv.a(console.o)
- kernel/chr_drv/chr_drv.a(tty_io.o) (con_write)
-kernel/chr_drv/chr_drv.a(keyboard.2.o)
- kernel/chr_drv/chr_drv.a(console.o) (keyboard_interrupt)
-kernel/chr_drv/chr_drv.a(serial.o)
- kernel/chr_drv/chr_drv.a(tty_io.o) (rs_init)
-kernel/chr_drv/chr_drv.a(rs_io.o)
- kernel/chr_drv/chr_drv.a(serial.o) (rs1_interrupt)
-kernel/chr_drv/chr_drv.a(tty_ioctl.o)
- fs/fs.o (tty_ioctl)
-kernel/math/math.a(math_emulate.o)
- kernel/kernel.o (math_emulate)
-lib/lib.a(ctype.o) kernel/chr_drv/chr_drv.a(tty_io.o) (_ctmp)
-lib/lib.a(_exit.o) init/main.o (_exit)
-lib/lib.a(open.o) init/main.o (open)
-lib/lib.a(close.o) init/main.o (close)
-lib/lib.a(errno.o) init/main.o (errno)
-lib/lib.a(write.o) init/main.o (write)
-lib/lib.a(dup.o) init/main.o (dup)
-lib/lib.a(setsid.o) init/main.o (setsid)
-lib/lib.a(execve.o) init/main.o (execve)
-lib/lib.a(wait.o) init/main.o (wait)
-lib/lib.a(string.o) fs/fs.o (strncpy)
-
-分配公共符号
-公共符号 大小 文件
-
-errno 0x4 lib/lib.a(errno.o)
-hash_table 0x4cc fs/fs.o
-___strtok 0x4 lib/lib.a(string.o)
-rd_start 0x4 kernel/blk_drv/blk_drv.a(ramdisk.o)
-request 0x480 kernel/blk_drv/blk_drv.a(ll_rw_blk.o)
-user_stack 0x1000 kernel/kernel.o
-_ctmp 0x1 lib/lib.a(ctype.o)
-super_block 0x360 fs/fs.o
-drive_info 0x20 init/main.o
-file_table 0x400 fs/fs.o
-
-Discarded input sections
-
- .note.GNU-stack
- 0x0000000000000000 0x0 init/main.o
- .note.GNU-stack
- 0x0000000000000000 0x0 kernel/kernel.o
- .note.GNU-stack
- 0x0000000000000000 0x0 mm/mm.o
- .note.GNU-stack
- 0x0000000000000000 0x0 fs/fs.o
- .note.GNU-stack
- 0x0000000000000000 0x0 kernel/blk_drv/blk_drv.a(ll_rw_blk.o)
- .note.GNU-stack
- 0x0000000000000000 0x0 kernel/blk_drv/blk_drv.a(floppy.o)
- .note.GNU-stack
- 0x0000000000000000 0x0 kernel/blk_drv/blk_drv.a(hd.o)
- .note.GNU-stack
- 0x0000000000000000 0x0 kernel/blk_drv/blk_drv.a(ramdisk.o)
- .note.GNU-stack
- 0x0000000000000000 0x0 kernel/chr_drv/chr_drv.a(tty_io.o)
- .note.GNU-stack
- 0x0000000000000000 0x0 kernel/chr_drv/chr_drv.a(console.o)
- .note.GNU-stack
- 0x0000000000000000 0x0 kernel/chr_drv/chr_drv.a(serial.o)
- .note.GNU-stack
- 0x0000000000000000 0x0 kernel/chr_drv/chr_drv.a(tty_ioctl.o)
- .note.GNU-stack
- 0x0000000000000000 0x0 kernel/math/math.a(math_emulate.o)
- .note.GNU-stack
- 0x0000000000000000 0x0 lib/lib.a(ctype.o)
- .note.GNU-stack
- 0x0000000000000000 0x0 lib/lib.a(_exit.o)
- .note.GNU-stack
- 0x0000000000000000 0x0 lib/lib.a(open.o)
- .note.GNU-stack
- 0x0000000000000000 0x0 lib/lib.a(close.o)
- .note.GNU-stack
- 0x0000000000000000 0x0 lib/lib.a(errno.o)
- .note.GNU-stack
- 0x0000000000000000 0x0 lib/lib.a(write.o)
- .note.GNU-stack
- 0x0000000000000000 0x0 lib/lib.a(dup.o)
- .note.GNU-stack
- 0x0000000000000000 0x0 lib/lib.a(setsid.o)
- .note.GNU-stack
- 0x0000000000000000 0x0 lib/lib.a(execve.o)
- .note.GNU-stack
- 0x0000000000000000 0x0 lib/lib.a(wait.o)
- .note.GNU-stack
- 0x0000000000000000 0x0 lib/lib.a(string.o)
-
-内存配置
-
-名称 来源 长度 属性
-*default* 0x0000000000000000 0xffffffffffffffff
-
-Linker script and memory map
-
-段 .text 的地址设置为 0x0
-LOAD boot/head.o
-LOAD init/main.o
-LOAD kernel/kernel.o
-LOAD mm/mm.o
-LOAD fs/fs.o
-LOAD kernel/blk_drv/blk_drv.a
-LOAD kernel/chr_drv/chr_drv.a
-LOAD kernel/math/math.a
-LOAD lib/lib.a
- 0x0000000008048000 PROVIDE (__executable_start, 0x8048000)
- 0x0000000008048074 . = (0x8048000 + SIZEOF_HEADERS)
-
-.interp
- *(.interp)
-
-.note.gnu.build-id
- *(.note.gnu.build-id)
-
-.hash
- *(.hash)
-
-.gnu.hash
- *(.gnu.hash)
-
-.dynsym
- *(.dynsym)
-
-.dynstr
- *(.dynstr)
-
-.gnu.version
- *(.gnu.version)
-
-.gnu.version_d
- *(.gnu.version_d)
-
-.gnu.version_r
- *(.gnu.version_r)
-
-.rel.init
- *(.rel.init)
-
-.rel.text 0x0000000008048074 0x0
- *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
- .rel.text 0x0000000000000000 0x0 boot/head.o
-
-.rel.fini
- *(.rel.fini)
-
-.rel.rodata
- *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
-
-.rel.data.rel.ro
- *(.rel.data.rel.ro .rel.data.rel.ro.* .rel.gnu.linkonce.d.rel.ro.*)
-
-.rel.data 0x0000000008048074 0x0
- *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
- .rel.data 0x0000000000000000 0x0 boot/head.o
-
-.rel.tdata
- *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
-
-.rel.tbss
- *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
-
-.rel.ctors
- *(.rel.ctors)
-
-.rel.dtors
- *(.rel.dtors)
-
-.rel.got
- *(.rel.got)
-
-.rel.bss
- *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
-
-.rel.ifunc
- *(.rel.ifunc)
-
-.rel.plt 0x0000000008048074 0x0
- *(.rel.plt)
- 0x0000000008048074 PROVIDE (__rel_iplt_start, .)
- *(.rel.iplt)
- .rel.iplt 0x0000000000000000 0x0 boot/head.o
- 0x0000000008048074 PROVIDE (__rel_iplt_end, .)
-
-.init
- *(SORT(.init))
-
-.plt 0x0000000008048080 0x0
- *(.plt)
- *(.iplt)
- .iplt 0x0000000000000000 0x0 boot/head.o
-
-.text 0x0000000000000000 0x17cef
- *(.text.unlikely .text.*_unlikely .text.unlikely.*)
- *(.text.exit .text.exit.*)
- *(.text.startup .text.startup.*)
- *(.text.hot .text.hot.*)
- *(.text .stub .text.* .gnu.linkonce.t.*)
- .text 0x0000000000000000 0x64c0 boot/head.o
- 0x0000000000000000 startup_32
- 0x0000000000000000 pg_dir
- 0x0000000000005000 tmp_floppy_area
- 0x00000000000054c0 idt
- 0x0000000000005cc0 gdt
- .text 0x00000000000064c0 0x713 init/main.o
- 0x00000000000064c0 fork
- 0x00000000000064ef pause
- 0x000000000000651e setup
- 0x0000000000006555 sync
- 0x0000000000006799 main
- 0x000000000000695b init
- *fill* 0x0000000000006bd3 0x1
- .text 0x0000000000006bd4 0x3914 kernel/kernel.o
- 0x0000000000006bd4 show_task
- 0x0000000000006c59 show_stat
- 0x0000000000006c9f math_state_restore
- 0x0000000000006cfd schedule
- 0x0000000000006eaf sys_pause
- 0x0000000000006ec5 sleep_on
- 0x0000000000006f24 interruptible_sleep_on
- 0x0000000000006fb7 wake_up
- 0x0000000000006fdf ticks_to_floppy_on
- 0x00000000000070aa floppy_on
- 0x00000000000070d9 floppy_off
- 0x00000000000070e9 do_floppy_timer
- 0x00000000000071bd add_timer
- 0x00000000000072e1 do_timer
- 0x00000000000073d0 sys_alarm
- 0x000000000000744f sys_getpid
- 0x000000000000745b sys_getppid
- 0x0000000000007467 sys_getuid
- 0x0000000000007476 sys_geteuid
- 0x0000000000007486 sys_getgid
- 0x0000000000007496 sys_getegid
- 0x00000000000074a5 sys_nice
- 0x00000000000074d0 sched_init
- 0x0000000000007674 system_call
- 0x00000000000076f0 coprocessor_error
- 0x0000000000007712 device_not_available
- 0x000000000000774c timer_interrupt
- 0x0000000000007784 sys_execve
- 0x0000000000007794 sys_fork
- 0x00000000000077ac hd_interrupt
- 0x00000000000077e8 floppy_interrupt
- 0x000000000000781e parallel_interrupt
- 0x0000000000007a39 do_double_fault
- 0x0000000000007a5c do_general_protection
- 0x0000000000007a7f do_divide_error
- 0x0000000000007aa2 do_int3
- 0x0000000000007b6a do_nmi
- 0x0000000000007b8d do_debug
- 0x0000000000007bb0 do_overflow
- 0x0000000000007bd3 do_bounds
- 0x0000000000007bf6 do_invalid_op
- 0x0000000000007c19 do_device_not_available
- 0x0000000000007c3c do_coprocessor_segment_overrun
- 0x0000000000007c5f do_invalid_TSS
- 0x0000000000007c82 do_segment_not_present
- 0x0000000000007ca5 do_stack_segment
- 0x0000000000007cc8 do_coprocessor_error
- 0x0000000000007cfc do_reserved
- 0x0000000000007d1f trap_init
- 0x0000000000008003 divide_error
- 0x0000000000008038 debug
- 0x000000000000803f nmi
- 0x0000000000008046 int3
- 0x000000000000804d overflow
- 0x0000000000008054 bounds
- 0x000000000000805b invalid_op
- 0x0000000000008062 coprocessor_segment_overrun
- 0x0000000000008069 reserved
- 0x0000000000008070 irq13
- 0x0000000000008085 double_fault
- 0x00000000000080bc invalid_TSS
- 0x00000000000080c3 segment_not_present
- 0x00000000000080ca stack_segment
- 0x00000000000080d1 general_protection
- 0x000000000000810a verify_area
- 0x0000000000008171 copy_mem
- 0x00000000000082cb copy_process
- 0x0000000000008778 find_empty_process
- 0x000000000000880c panic
- 0x0000000000008847 printk
- 0x0000000000008b64 vsprintf
- 0x000000000000902a sys_ftime
- 0x0000000000009030 sys_break
- 0x0000000000009036 sys_ptrace
- 0x000000000000903c sys_stty
- 0x0000000000009042 sys_gtty
- 0x0000000000009048 sys_rename
- 0x000000000000904e sys_prof
- 0x0000000000009054 sys_setregid
- 0x000000000000910d sys_setgid
- 0x00000000000091a4 sys_acct
- 0x00000000000091aa sys_phys
- 0x00000000000091b0 sys_lock
- 0x00000000000091b6 sys_mpx
- 0x00000000000091bc sys_ulimit
- 0x00000000000091c2 sys_time
- 0x000000000000921e sys_setreuid
- 0x0000000000009300 sys_setuid
- 0x0000000000009395 sys_stime
- 0x00000000000093eb sys_times
- 0x000000000000948b sys_brk
- 0x00000000000094cd sys_setpgid
- 0x00000000000095a6 sys_getpgrp
- 0x00000000000095b2 sys_setsid
- 0x000000000000962c sys_getgroups
- 0x0000000000009632 sys_setgroups
- 0x0000000000009638 sys_uname
- 0x00000000000096a1 sys_sethostname
- 0x00000000000096a7 sys_getrlimit
- 0x00000000000096ad sys_setrlimit
- 0x00000000000096b3 sys_getrusage
- 0x00000000000096b9 sys_gettimeofday
- 0x00000000000096bf sys_settimeofday
- 0x00000000000096c5 sys_umask
- 0x0000000000009736 release
- 0x0000000000009873 sys_kill
- 0x0000000000009aad do_exit
- 0x0000000000009ce1 sys_exit
- 0x0000000000009cfa sys_waitpid
- 0x0000000000009f52 sys_sgetmask
- 0x0000000000009f5e sys_ssetmask
- 0x0000000000009f8a sys_sigpending
- 0x0000000000009f90 sys_sigsuspend
- 0x000000000000a029 sys_signal
- 0x000000000000a0ad sys_sigaction
- 0x000000000000a1b7 do_signal
- 0x000000000000a3a3 kernel_mktime
- .text 0x000000000000a4e8 0xb01 mm/mm.o
- 0x000000000000a507 get_free_page
- 0x000000000000a543 free_page
- 0x000000000000a5b2 free_page_tables
- 0x000000000000a6b1 copy_page_tables
- 0x000000000000a832 put_page
- 0x000000000000a91e un_wp_page
- 0x000000000000a9d6 do_wp_page
- 0x000000000000aa08 write_verify
- 0x000000000000aa61 get_empty_page
- 0x000000000000ace7 do_no_page
- 0x000000000000ae49 mem_init
- 0x000000000000aebd calc_mem
- 0x000000000000afb2 page_fault
- .text 0x000000000000afe9 0x7539 fs/fs.o
- 0x000000000000afff sys_ustat
- 0x000000000000b005 sys_utime
- 0x000000000000b0b2 sys_access
- 0x000000000000b18e sys_chdir
- 0x000000000000b202 sys_chroot
- 0x000000000000b276 sys_chmod
- 0x000000000000b310 sys_chown
- 0x000000000000b38b sys_open
- 0x000000000000b62e sys_creat
- 0x000000000000b651 sys_close
- 0x000000000000b720 sys_lseek
- 0x000000000000b837 sys_read
- 0x000000000000ba2a sys_write
- 0x000000000000bc23 invalidate_inodes
- 0x000000000000bc92 sync_inodes
- 0x000000000000c0d5 bmap
- 0x000000000000c0f8 create_block
- 0x000000000000c11b iput
- 0x000000000000c28a get_empty_inode
- 0x000000000000c3df get_pipe_inode
- 0x000000000000c454 iget
- 0x000000000000c84f sys_sync
- 0x000000000000c8b2 sync_dev
- 0x000000000000c9ab invalidate_buffers
- 0x000000000000ca1d check_disk_change
- 0x000000000000cceb get_hash_table
- 0x000000000000cd6d getblk
- 0x000000000000cf0b brelse
- 0x000000000000cf54 bread
- 0x000000000000cfd9 bread_page
- 0x000000000000d0fb breada
- 0x000000000000d1f0 buffer_init
- 0x000000000000d391 get_super
- 0x000000000000d400 put_super
- 0x000000000000d816 sys_umount
- 0x000000000000d977 sys_mount
- 0x000000000000dae8 mount_root
- 0x000000000000dd1c block_write
- 0x000000000000de6e block_read
- 0x000000000000e1d9 rw_char
- 0x000000000000e269 file_read
- 0x000000000000e414 file_write
- 0x000000000000e6fd sys_stat
- 0x000000000000e747 sys_lstat
- 0x000000000000e762 sys_fstat
- 0x000000000000e7bf sys_readlink
- 0x000000000000e86e sys_uselib
- 0x000000000000ed3d do_execve
- 0x000000000000f7f1 read_pipe
- 0x000000000000f947 write_pipe
- 0x000000000000fac6 sys_pipe
- 0x00000000000104a5 namei
- 0x00000000000105bb open_namei
- 0x000000000001090e sys_mknod
- 0x0000000000010b3e sys_mkdir
- 0x00000000000110cd sys_rmdir
- 0x0000000000011425 sys_unlink
- 0x00000000000116c6 sys_symlink
- 0x00000000000116cc sys_link
- 0x0000000000011926 free_block
- 0x0000000000011a98 new_block
- 0x0000000000011c3c free_inode
- 0x0000000000011da3 new_inode
- 0x0000000000012057 sys_dup2
- 0x000000000001207e sys_dup
- 0x0000000000012099 sys_fcntl
- 0x00000000000121d8 sys_ioctl
- 0x00000000000123e7 truncate
- 0x000000000001251c sys_select
- .text 0x0000000000012522 0x46a kernel/blk_drv/blk_drv.a(ll_rw_blk.o)
- 0x00000000000128e5 ll_rw_block
- 0x000000000001293e blk_dev_init
- .text 0x000000000001298c 0xb9d kernel/blk_drv/blk_drv.a(floppy.o)
- 0x0000000000012a72 floppy_deselect
- 0x0000000000012aa9 floppy_change
- 0x0000000000012e66 setup_rw_floppy
- 0x00000000000130ff unexpected_floppy_interrupt
- 0x00000000000134d7 floppy_init
- .text 0x0000000000013529 0xc8f kernel/blk_drv/blk_drv.a(hd.o)
- 0x00000000000135fd sys_setup
- 0x0000000000013cac unexpected_hd_interrupt
- 0x000000000001413e hd_init
- .text 0x00000000000141b8 0x50c kernel/blk_drv/blk_drv.a(ramdisk.o)
- 0x00000000000143c2 rd_init
- 0x0000000000014418 rd_load
- .text 0x00000000000146c4 0xcbb kernel/chr_drv/chr_drv.a(tty_io.o)
- 0x00000000000146ea tty_init
- 0x00000000000146fb tty_intr
- 0x0000000000014808 wait_for_keypress
- 0x000000000001481b copy_to_cooked
- 0x0000000000014dd6 tty_read
- 0x0000000000015144 tty_write
- 0x0000000000015356 do_tty_interrupt
- 0x000000000001537e chr_dev_init
- .text 0x000000000001537f 0x1283 kernel/chr_drv/chr_drv.a(console.o)
- 0x000000000001591c csi_m
- 0x0000000000015cb6 con_write
- 0x0000000000016344 con_init
- 0x000000000001657b sysbeepstop
- .text 0x0000000000016602 0x7e2 kernel/chr_drv/chr_drv.a(keyboard.2.o)
- 0x0000000000016605 keyboard_interrupt
- .text 0x0000000000016de4 0x145 kernel/chr_drv/chr_drv.a(serial.o)
- 0x0000000000016e59 rs_init
- 0x0000000000016edc rs_write
- *fill* 0x0000000000016f29 0x3
- .text 0x0000000000016f2c 0xf7 kernel/chr_drv/chr_drv.a(rs_io.o)
- 0x0000000000016f2c rs1_interrupt
- 0x0000000000016f34 rs2_interrupt
- .text 0x0000000000017023 0x60f kernel/chr_drv/chr_drv.a(tty_ioctl.o)
- 0x0000000000017334 tty_ioctl
- .text 0x0000000000017632 0x111 kernel/math/math.a(math_emulate.o)
- 0x0000000000017640 math_emulate
- 0x0000000000017723 math_error
- .text 0x0000000000017743 0x0 lib/lib.a(ctype.o)
- .text 0x0000000000017743 0x10 lib/lib.a(_exit.o)
- 0x0000000000017743 _exit
- .text 0x0000000000017753 0x49 lib/lib.a(open.o)
- 0x0000000000017753 open
- .text 0x000000000001779c 0x37 lib/lib.a(close.o)
- 0x000000000001779c close
- .text 0x00000000000177d3 0x0 lib/lib.a(errno.o)
- .text 0x00000000000177d3 0x3d lib/lib.a(write.o)
- 0x00000000000177d3 write
- .text 0x0000000000017810 0x37 lib/lib.a(dup.o)
- 0x0000000000017810 dup
- .text 0x0000000000017847 0x2f lib/lib.a(setsid.o)
- 0x0000000000017847 setsid
- .text 0x0000000000017876 0x3d lib/lib.a(execve.o)
- 0x0000000000017876 execve
- .text 0x00000000000178b3 0x60 lib/lib.a(wait.o)
- 0x00000000000178b3 waitpid
- 0x00000000000178f0 wait
- .text 0x0000000000017913 0x3dc lib/lib.a(string.o)
- 0x0000000000017913 strcpy
- 0x000000000001792f strncpy
- 0x0000000000017954 strcat
- 0x000000000001797f strncat
- 0x00000000000179b4 strcmp
- 0x00000000000179db strncmp
- 0x0000000000017a09 strchr
- 0x0000000000017a36 strrchr
- 0x0000000000017a65 strspn
- 0x0000000000017aa2 strcspn
- 0x0000000000017adf strpbrk
- 0x0000000000017b16 strstr
- 0x0000000000017b4f strlen
- 0x0000000000017b72 strtok
- 0x0000000000017bf5 memcpy
- 0x0000000000017c15 memmove
- 0x0000000000017c69 memcmp
- 0x0000000000017c93 memchr
- 0x0000000000017ccb memset
- *(.gnu.warning)
-
-.fini
- *(SORT(.fini))
- 0x0000000000017cef PROVIDE (__etext, .)
- 0x0000000000017cef PROVIDE (_etext, .)
- 0x0000000000017cef PROVIDE (etext, .)
-
-.rodata 0x0000000000017cf0 0x13ca
- *(.rodata .rodata.* .gnu.linkonce.r.*)
- .rodata 0x0000000000017cf0 0xad init/main.o
- *fill* 0x0000000000017d9d 0x3
- .rodata 0x0000000000017da0 0x438 kernel/kernel.o
- .rodata 0x00000000000181d8 0x18f mm/mm.o
- *fill* 0x0000000000018367 0x1
- .rodata 0x0000000000018368 0x62c fs/fs.o
- .rodata 0x0000000000018994 0x7a kernel/blk_drv/blk_drv.a(ll_rw_blk.o)
- *fill* 0x0000000000018a0e 0x2
- .rodata 0x0000000000018a10 0x133 kernel/blk_drv/blk_drv.a(floppy.o)
- *fill* 0x0000000000018b43 0x1
- .rodata 0x0000000000018b44 0x19b kernel/blk_drv/blk_drv.a(hd.o)
- *fill* 0x0000000000018cdf 0x1
- .rodata 0x0000000000018ce0 0x188 kernel/blk_drv/blk_drv.a(ramdisk.o)
- .rodata 0x0000000000018e68 0x17d kernel/chr_drv/chr_drv.a(console.o)
- *fill* 0x0000000000018fe5 0x3
- .rodata 0x0000000000018fe8 0x80 kernel/chr_drv/chr_drv.a(tty_ioctl.o)
- .rodata 0x0000000000019068 0x52 kernel/math/math.a(math_emulate.o)
-
-.rodata1
- *(.rodata1)
-
-.eh_frame_hdr
- *(.eh_frame_hdr)
-
-.eh_frame 0x00000000000190bc 0x2a6c
- *(.eh_frame)
- .eh_frame 0x00000000000190bc 0xf0 init/main.o
- .eh_frame 0x00000000000191ac 0xb04 kernel/kernel.o
- 0xbf4 (size before relaxing)
- .eh_frame 0x0000000000019cb0 0x194 mm/mm.o
- 0x1ac (size before relaxing)
- .eh_frame 0x0000000000019e44 0xdd8 fs/fs.o
- 0xf70 (size before relaxing)
- .eh_frame 0x000000000001ac1c 0x98 kernel/blk_drv/blk_drv.a(ll_rw_blk.o)
- 0xb0 (size before relaxing)
- .eh_frame 0x000000000001acb4 0x23c kernel/blk_drv/blk_drv.a(floppy.o)
- 0x254 (size before relaxing)
- .eh_frame 0x000000000001aef0 0x1e8 kernel/blk_drv/blk_drv.a(hd.o)
- 0x200 (size before relaxing)
- .eh_frame 0x000000000001b0d8 0xac kernel/blk_drv/blk_drv.a(ramdisk.o)
- 0xc4 (size before relaxing)
- .eh_frame 0x000000000001b184 0x12c kernel/chr_drv/chr_drv.a(tty_io.o)
- 0x144 (size before relaxing)
- .eh_frame 0x000000000001b2b0 0x2c0 kernel/chr_drv/chr_drv.a(console.o)
- 0x2d8 (size before relaxing)
- .eh_frame 0x000000000001b570 0x54 kernel/chr_drv/chr_drv.a(serial.o)
- 0x6c (size before relaxing)
- .eh_frame 0x000000000001b5c4 0x148 kernel/chr_drv/chr_drv.a(tty_ioctl.o)
- 0x160 (size before relaxing)
- .eh_frame 0x000000000001b70c 0x5c kernel/math/math.a(math_emulate.o)
- 0x74 (size before relaxing)
- .eh_frame 0x000000000001b768 0x1c lib/lib.a(_exit.o)
- 0x34 (size before relaxing)
- .eh_frame 0x000000000001b784 0x24 lib/lib.a(open.o)
- 0x3c (size before relaxing)
- .eh_frame 0x000000000001b7a8 0x20 lib/lib.a(close.o)
- 0x38 (size before relaxing)
- .eh_frame 0x000000000001b7c8 0x20 lib/lib.a(write.o)
- 0x38 (size before relaxing)
- .eh_frame 0x000000000001b7e8 0x20 lib/lib.a(dup.o)
- 0x38 (size before relaxing)
- .eh_frame 0x000000000001b808 0x18 lib/lib.a(setsid.o)
- 0x30 (size before relaxing)
- .eh_frame 0x000000000001b820 0x20 lib/lib.a(execve.o)
- 0x38 (size before relaxing)
- .eh_frame 0x000000000001b840 0x38 lib/lib.a(wait.o)
- 0x50 (size before relaxing)
- .eh_frame 0x000000000001b878 0x2b0 lib/lib.a(string.o)
- 0x2c8 (size before relaxing)
-
-.gcc_except_table
- *(.gcc_except_table .gcc_except_table.*)
-
-.exception_ranges
- *(.exception_ranges .exception_ranges*)
- 0x000000000001bb28 . = .
-
-.eh_frame
- *(.eh_frame)
-
-.gcc_except_table
- *(.gcc_except_table .gcc_except_table.*)
-
-.exception_ranges
- *(.exception_ranges .exception_ranges*)
-
-.tdata
- *(.tdata .tdata.* .gnu.linkonce.td.*)
-
-.tbss
- *(.tbss .tbss.* .gnu.linkonce.tb.*)
- *(.tcommon)
-
-.preinit_array 0x000000000001bb28 0x0
- 0x000000000001bb28 PROVIDE (__preinit_array_start, .)
- *(.preinit_array)
- 0x000000000001bb28 PROVIDE (__preinit_array_end, .)
-
-.init_array 0x000000000001bb28 0x0
- 0x000000000001bb28 PROVIDE (__init_array_start, .)
- *(SORT(.init_array.*) SORT(.ctors.*))
- *(.init_array EXCLUDE_FILE(*crtend?.o *crtend.o *crtbegin?.o *crtbegin.o) .ctors)
- 0x000000000001bb28 PROVIDE (__init_array_end, .)
-
-.fini_array 0x000000000001bb28 0x0
- 0x000000000001bb28 PROVIDE (__fini_array_start, .)
- *(SORT(.fini_array.*) SORT(.dtors.*))
- *(.fini_array EXCLUDE_FILE(*crtend?.o *crtend.o *crtbegin?.o *crtbegin.o) .dtors)
- 0x000000000001bb28 PROVIDE (__fini_array_end, .)
-
-.ctors
- *crtbegin.o(.ctors)
- *crtbegin?.o(.ctors)
- *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
- *(SORT(.ctors.*))
- *(.ctors)
-
-.dtors
- *crtbegin.o(.dtors)
- *crtbegin?.o(.dtors)
- *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
- *(SORT(.dtors.*))
- *(.dtors)
-
-.jcr
- *(.jcr)
-
-.data.rel.ro
- *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*)
- *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*)
-
-.dynamic
- *(.dynamic)
-
-.got
- *(.got)
- *(.igot)
-
-.got.plt 0x000000000001bb28 0x0
- *(.got.plt)
- *(.igot.plt)
- .igot.plt 0x0000000000000000 0x0 boot/head.o
-
-.data 0x000000000001bb40 0x3b01
- *(.data .data.* .gnu.linkonce.d.*)
- .data 0x000000000001bb40 0x0 boot/head.o
- .data 0x000000000001bb40 0x28 init/main.o
- *fill* 0x000000000001bb68 0x18
- .data 0x000000000001bb80 0x1310 kernel/kernel.o
- 0x000000000001bb80 sys_call_table
- 0x000000000001bcdc NR_syscalls
- 0x000000000001cce0 current
- 0x000000000001cd00 task
- 0x000000000001ce00 stack_start
- 0x000000000001ce08 current_DOR
- .data 0x000000000001ce90 0x0 mm/mm.o
- *fill* 0x000000000001ce90 0x10
- .data 0x000000000001cea0 0x60 fs/fs.o
- 0x000000000001cea4 start_buffer
- .data 0x000000000001cf00 0x0 kernel/blk_drv/blk_drv.a(ll_rw_blk.o)
- .data 0x000000000001cf00 0xcd kernel/blk_drv/blk_drv.a(floppy.o)
- *fill* 0x000000000001cfcd 0x3
- .data 0x000000000001cfd0 0x4 kernel/blk_drv/blk_drv.a(hd.o)
- .data 0x000000000001cfd4 0x0 kernel/blk_drv/blk_drv.a(ramdisk.o)
- *fill* 0x000000000001cfd4 0xc
- .data 0x000000000001cfe0 0x2538 kernel/chr_drv/chr_drv.a(tty_io.o)
- 0x000000000001cfe0 tty_table
- 0x000000000001f500 table_list
- .data 0x000000000001f518 0x1 kernel/chr_drv/chr_drv.a(console.o)
- .data 0x000000000001f519 0x0 kernel/chr_drv/chr_drv.a(keyboard.2.o)
- .data 0x000000000001f519 0x0 kernel/chr_drv/chr_drv.a(serial.o)
- .data 0x000000000001f519 0x0 kernel/chr_drv/chr_drv.a(rs_io.o)
- *fill* 0x000000000001f519 0x7
- .data 0x000000000001f520 0x20 kernel/chr_drv/chr_drv.a(tty_ioctl.o)
- .data 0x000000000001f540 0x0 kernel/math/math.a(math_emulate.o)
- .data 0x000000000001f540 0x101 lib/lib.a(ctype.o)
- 0x000000000001f540 _ctype
- .data 0x000000000001f641 0x0 lib/lib.a(_exit.o)
- .data 0x000000000001f641 0x0 lib/lib.a(open.o)
- .data 0x000000000001f641 0x0 lib/lib.a(close.o)
- .data 0x000000000001f641 0x0 lib/lib.a(errno.o)
- .data 0x000000000001f641 0x0 lib/lib.a(write.o)
- .data 0x000000000001f641 0x0 lib/lib.a(dup.o)
- .data 0x000000000001f641 0x0 lib/lib.a(setsid.o)
- .data 0x000000000001f641 0x0 lib/lib.a(execve.o)
- .data 0x000000000001f641 0x0 lib/lib.a(wait.o)
- .data 0x000000000001f641 0x0 lib/lib.a(string.o)
-
-.data1
- *(.data1)
- 0x000000000001f641 _edata = .
- 0x000000000001f641 PROVIDE (edata, .)
- 0x000000000001f641 . = .
- 0x000000000001f641 __bss_start = .
-
-.bss 0x000000000001f660 0x44b0
- *(.dynbss)
- *(.bss .bss.* .gnu.linkonce.b.*)
- .bss 0x000000000001f660 0x0 boot/head.o
- .bss 0x000000000001f660 0x40c init/main.o
- *fill* 0x000000000001fa6c 0x14
- .bss 0x000000000001fa80 0x760 kernel/kernel.o
- 0x000000000001fa80 jiffies
- 0x000000000001fa84 startup_time
- 0x000000000001fa88 last_task_used_math
- 0x000000000001fdc4 last_pid
- .bss 0x00000000000201e0 0xf20 mm/mm.o
- .bss 0x0000000000021100 0x710 fs/fs.o
- 0x0000000000021100 inode_table
- 0x0000000000021800 nr_buffers
- 0x000000000002180c ROOT_DEV
- *fill* 0x0000000000021810 0x10
- .bss 0x0000000000021820 0x58 kernel/blk_drv/blk_drv.a(ll_rw_blk.o)
- 0x0000000000021820 wait_for_request
- 0x0000000000021840 blk_dev
- .bss 0x0000000000021878 0x25 kernel/blk_drv/blk_drv.a(floppy.o)
- 0x0000000000021878 do_floppy
- 0x000000000002187c selected
- 0x0000000000021880 wait_on_floppy_select
- *fill* 0x000000000002189d 0x3
- .bss 0x00000000000218a0 0xb0 kernel/blk_drv/blk_drv.a(hd.o)
- 0x00000000000218a0 do_hd
- 0x00000000000218c0 hd_info
- .bss 0x0000000000021950 0x4 kernel/blk_drv/blk_drv.a(ramdisk.o)
- 0x0000000000021950 rd_length
- .bss 0x0000000000021954 0x4 kernel/chr_drv/chr_drv.a(tty_io.o)
- *fill* 0x0000000000021958 0x8
- .bss 0x0000000000021960 0xac kernel/chr_drv/chr_drv.a(console.o)
- 0x0000000000021960 beepcount
- .bss 0x0000000000021a0c 0x0 kernel/chr_drv/chr_drv.a(keyboard.2.o)
- .bss 0x0000000000021a0c 0x0 kernel/chr_drv/chr_drv.a(serial.o)
- .bss 0x0000000000021a0c 0x0 kernel/chr_drv/chr_drv.a(rs_io.o)
- .bss 0x0000000000021a0c 0x0 kernel/chr_drv/chr_drv.a(tty_ioctl.o)
- .bss 0x0000000000021a0c 0x0 kernel/math/math.a(math_emulate.o)
- .bss 0x0000000000021a0c 0x0 lib/lib.a(ctype.o)
- .bss 0x0000000000021a0c 0x0 lib/lib.a(_exit.o)
- .bss 0x0000000000021a0c 0x0 lib/lib.a(open.o)
- .bss 0x0000000000021a0c 0x0 lib/lib.a(close.o)
- .bss 0x0000000000021a0c 0x0 lib/lib.a(errno.o)
- .bss 0x0000000000021a0c 0x0 lib/lib.a(write.o)
- .bss 0x0000000000021a0c 0x0 lib/lib.a(dup.o)
- .bss 0x0000000000021a0c 0x0 lib/lib.a(setsid.o)
- .bss 0x0000000000021a0c 0x0 lib/lib.a(execve.o)
- .bss 0x0000000000021a0c 0x0 lib/lib.a(wait.o)
- .bss 0x0000000000021a0c 0x0 lib/lib.a(string.o)
- *(COMMON)
- *fill* 0x0000000000021a0c 0x14
- COMMON 0x0000000000021a20 0x20 init/main.o
- 0x0000000000021a20 drive_info
- COMMON 0x0000000000021a40 0x1000 kernel/kernel.o
- 0x0000000000021a40 user_stack
- COMMON 0x0000000000022a40 0xc40 fs/fs.o
- 0x0000000000022a40 hash_table
- 0x0000000000022f20 super_block
- 0x0000000000023280 file_table
- COMMON 0x0000000000023680 0x480 kernel/blk_drv/blk_drv.a(ll_rw_blk.o)
- 0x0000000000023680 request
- COMMON 0x0000000000023b00 0x4 kernel/blk_drv/blk_drv.a(ramdisk.o)
- 0x0000000000023b00 rd_start
- COMMON 0x0000000000023b04 0x1 lib/lib.a(ctype.o)
- 0x0000000000023b04 _ctmp
- *fill* 0x0000000000023b05 0x3
- COMMON 0x0000000000023b08 0x4 lib/lib.a(errno.o)
- 0x0000000000023b08 errno
- COMMON 0x0000000000023b0c 0x4 lib/lib.a(string.o)
- 0x0000000000023b0c ___strtok
- 0x0000000000023b10 . = ALIGN ((. != 0x0)?0x4:0x1)
- 0x0000000000023b10 . = ALIGN (0x4)
- 0x0000000000023b10 . = SEGMENT_START ("ldata-segment", .)
- 0x0000000000023b10 . = ALIGN (0x4)
- 0x0000000000023b10 _end = .
- 0x0000000000023b10 PROVIDE (end, .)
-
-.stab
- *(.stab)
-
-.stabstr
- *(.stabstr)
-
-.stab.excl
- *(.stab.excl)
-
-.stab.exclstr
- *(.stab.exclstr)
-
-.stab.index
- *(.stab.index)
-
-.stab.indexstr
- *(.stab.indexstr)
-
-.comment 0x0000000000000000 0x29
- *(.comment)
- .comment 0x0000000000000000 0x29 init/main.o
- 0x2a (size before relaxing)
- .comment 0x0000000000000000 0x1a4 kernel/kernel.o
- .comment 0x0000000000000000 0x2a mm/mm.o
- .comment 0x0000000000000000 0x2f4 fs/fs.o
- .comment 0x0000000000000000 0x2a kernel/blk_drv/blk_drv.a(ll_rw_blk.o)
- .comment 0x0000000000000000 0x2a kernel/blk_drv/blk_drv.a(floppy.o)
- .comment 0x0000000000000000 0x2a kernel/blk_drv/blk_drv.a(hd.o)
- .comment 0x0000000000000000 0x2a kernel/blk_drv/blk_drv.a(ramdisk.o)
- .comment 0x0000000000000000 0x2a kernel/chr_drv/chr_drv.a(tty_io.o)
- .comment 0x0000000000000000 0x2a kernel/chr_drv/chr_drv.a(console.o)
- .comment 0x0000000000000000 0x2a kernel/chr_drv/chr_drv.a(serial.o)
- .comment 0x0000000000000000 0x2a kernel/chr_drv/chr_drv.a(tty_ioctl.o)
- .comment 0x0000000000000000 0x2a kernel/math/math.a(math_emulate.o)
- .comment 0x0000000000000000 0x2a lib/lib.a(ctype.o)
- .comment 0x0000000000000000 0x2a lib/lib.a(_exit.o)
- .comment 0x0000000000000000 0x2a lib/lib.a(open.o)
- .comment 0x0000000000000000 0x2a lib/lib.a(close.o)
- .comment 0x0000000000000000 0x2a lib/lib.a(errno.o)
- .comment 0x0000000000000000 0x2a lib/lib.a(write.o)
- .comment 0x0000000000000000 0x2a lib/lib.a(dup.o)
- .comment 0x0000000000000000 0x2a lib/lib.a(setsid.o)
- .comment 0x0000000000000000 0x2a lib/lib.a(execve.o)
- .comment 0x0000000000000000 0x2a lib/lib.a(wait.o)
- .comment 0x0000000000000000 0x2a lib/lib.a(string.o)
-
-.debug
- *(.debug)
-
-.line
- *(.line)
-
-.debug_srcinfo
- *(.debug_srcinfo)
-
-.debug_sfnames
- *(.debug_sfnames)
-
-.debug_aranges 0x0000000000000000 0x628
- *(.debug_aranges)
- .debug_aranges
- 0x0000000000000000 0x20 init/main.o
- .debug_aranges
- 0x0000000000000020 0x140 kernel/kernel.o
- .debug_aranges
- 0x0000000000000160 0x20 mm/mm.o
- .debug_aranges
- 0x0000000000000180 0x238 fs/fs.o
- .debug_aranges
- 0x00000000000003b8 0x20 kernel/blk_drv/blk_drv.a(ll_rw_blk.o)
- .debug_aranges
- 0x00000000000003d8 0x20 kernel/blk_drv/blk_drv.a(floppy.o)
- .debug_aranges
- 0x00000000000003f8 0x20 kernel/blk_drv/blk_drv.a(hd.o)
- .debug_aranges
- 0x0000000000000418 0x20 kernel/blk_drv/blk_drv.a(ramdisk.o)
- .debug_aranges
- 0x0000000000000438 0x20 kernel/chr_drv/chr_drv.a(tty_io.o)
- .debug_aranges
- 0x0000000000000458 0x20 kernel/chr_drv/chr_drv.a(console.o)
- .debug_aranges
- 0x0000000000000478 0x20 kernel/chr_drv/chr_drv.a(serial.o)
- .debug_aranges
- 0x0000000000000498 0x20 kernel/chr_drv/chr_drv.a(tty_ioctl.o)
- .debug_aranges
- 0x00000000000004b8 0x20 kernel/math/math.a(math_emulate.o)
- .debug_aranges
- 0x00000000000004d8 0x18 lib/lib.a(ctype.o)
- .debug_aranges
- 0x00000000000004f0 0x20 lib/lib.a(_exit.o)
- .debug_aranges
- 0x0000000000000510 0x20 lib/lib.a(open.o)
- .debug_aranges
- 0x0000000000000530 0x20 lib/lib.a(close.o)
- .debug_aranges
- 0x0000000000000550 0x18 lib/lib.a(errno.o)
- .debug_aranges
- 0x0000000000000568 0x20 lib/lib.a(write.o)
- .debug_aranges
- 0x0000000000000588 0x20 lib/lib.a(dup.o)
- .debug_aranges
- 0x00000000000005a8 0x20 lib/lib.a(setsid.o)
- .debug_aranges
- 0x00000000000005c8 0x20 lib/lib.a(execve.o)
- .debug_aranges
- 0x00000000000005e8 0x20 lib/lib.a(wait.o)
- .debug_aranges
- 0x0000000000000608 0x20 lib/lib.a(string.o)
-
-.debug_pubnames
- *(.debug_pubnames)
-
-.debug_info 0x0000000000000000 0x16d23
- *(.debug_info .gnu.linkonce.wi.*)
- .debug_info 0x0000000000000000 0x553 init/main.o
- .debug_info 0x0000000000000553 0x4cb6 kernel/kernel.o
- .debug_info 0x0000000000005209 0xb2b mm/mm.o
- .debug_info 0x0000000000005d34 0xa290 fs/fs.o
- .debug_info 0x000000000000ffc4 0x932 kernel/blk_drv/blk_drv.a(ll_rw_blk.o)
- .debug_info 0x00000000000108f6 0xc9f kernel/blk_drv/blk_drv.a(floppy.o)
- .debug_info 0x0000000000011595 0xd5f kernel/blk_drv/blk_drv.a(hd.o)
- .debug_info 0x00000000000122f4 0xad5 kernel/blk_drv/blk_drv.a(ramdisk.o)
- .debug_info 0x0000000000012dc9 0xacd kernel/chr_drv/chr_drv.a(tty_io.o)
- .debug_info 0x0000000000013896 0xdb0 kernel/chr_drv/chr_drv.a(console.o)
- .debug_info 0x0000000000014646 0x85c kernel/chr_drv/chr_drv.a(serial.o)
- .debug_info 0x0000000000014ea2 0xb47 kernel/chr_drv/chr_drv.a(tty_ioctl.o)
- .debug_info 0x00000000000159e9 0x7b5 kernel/math/math.a(math_emulate.o)
- .debug_info 0x000000000001619e 0x66 lib/lib.a(ctype.o)
- .debug_info 0x0000000000016204 0x77 lib/lib.a(_exit.o)
- .debug_info 0x000000000001627b 0xd0 lib/lib.a(open.o)
- .debug_info 0x000000000001634b 0x97 lib/lib.a(close.o)
- .debug_info 0x00000000000163e2 0x36 lib/lib.a(errno.o)
- .debug_info 0x0000000000016418 0xc9 lib/lib.a(write.o)
- .debug_info 0x00000000000164e1 0x97 lib/lib.a(dup.o)
- .debug_info 0x0000000000016578 0x95 lib/lib.a(setsid.o)
- .debug_info 0x000000000001660d 0xcb lib/lib.a(execve.o)
- .debug_info 0x00000000000166d8 0xed lib/lib.a(wait.o)
- .debug_info 0x00000000000167c5 0x55e lib/lib.a(string.o)
-
-.debug_abbrev 0x0000000000000000 0x43b9
- *(.debug_abbrev)
- .debug_abbrev 0x0000000000000000 0x1d3 init/main.o
- .debug_abbrev 0x00000000000001d3 0xf63 kernel/kernel.o
- .debug_abbrev 0x0000000000001136 0x20b mm/mm.o
- .debug_abbrev 0x0000000000001341 0x19f1 fs/fs.o
- .debug_abbrev 0x0000000000002d32 0x169 kernel/blk_drv/blk_drv.a(ll_rw_blk.o)
- .debug_abbrev 0x0000000000002e9b 0x27d kernel/blk_drv/blk_drv.a(floppy.o)
- .debug_abbrev 0x0000000000003118 0x23c kernel/blk_drv/blk_drv.a(hd.o)
- .debug_abbrev 0x0000000000003354 0x1a8 kernel/blk_drv/blk_drv.a(ramdisk.o)
- .debug_abbrev 0x00000000000034fc 0x279 kernel/chr_drv/chr_drv.a(tty_io.o)
- .debug_abbrev 0x0000000000003775 0x26b kernel/chr_drv/chr_drv.a(console.o)
- .debug_abbrev 0x00000000000039e0 0x175 kernel/chr_drv/chr_drv.a(serial.o)
- .debug_abbrev 0x0000000000003b55 0x18d kernel/chr_drv/chr_drv.a(tty_ioctl.o)
- .debug_abbrev 0x0000000000003ce2 0x163 kernel/math/math.a(math_emulate.o)
- .debug_abbrev 0x0000000000003e45 0x3e lib/lib.a(ctype.o)
- .debug_abbrev 0x0000000000003e83 0x51 lib/lib.a(_exit.o)
- .debug_abbrev 0x0000000000003ed4 0x97 lib/lib.a(open.o)
- .debug_abbrev 0x0000000000003f6b 0x75 lib/lib.a(close.o)
- .debug_abbrev 0x0000000000003fe0 0x2c lib/lib.a(errno.o)
- .debug_abbrev 0x000000000000400c 0xa1 lib/lib.a(write.o)
- .debug_abbrev 0x00000000000040ad 0x75 lib/lib.a(dup.o)
- .debug_abbrev 0x0000000000004122 0x73 lib/lib.a(setsid.o)
- .debug_abbrev 0x0000000000004195 0x85 lib/lib.a(execve.o)
- .debug_abbrev 0x000000000000421a 0xb6 lib/lib.a(wait.o)
- .debug_abbrev 0x00000000000042d0 0xe9 lib/lib.a(string.o)
-
-.debug_line 0x0000000000000000 0x4599
- *(.debug_line .debug_line.* .debug_line_end)
- .debug_line 0x0000000000000000 0x1a7 init/main.o
- .debug_line 0x00000000000001a7 0xe86 kernel/kernel.o
- .debug_line 0x000000000000102d 0x274 mm/mm.o
- .debug_line 0x00000000000012a1 0x1c50 fs/fs.o
- .debug_line 0x0000000000002ef1 0x197 kernel/blk_drv/blk_drv.a(ll_rw_blk.o)
- .debug_line 0x0000000000003088 0x24c kernel/blk_drv/blk_drv.a(floppy.o)
- .debug_line 0x00000000000032d4 0x2bf kernel/blk_drv/blk_drv.a(hd.o)
- .debug_line 0x0000000000003593 0x160 kernel/blk_drv/blk_drv.a(ramdisk.o)
- .debug_line 0x00000000000036f3 0x33b kernel/chr_drv/chr_drv.a(tty_io.o)
- .debug_line 0x0000000000003a2e 0x3ab kernel/chr_drv/chr_drv.a(console.o)
- .debug_line 0x0000000000003dd9 0xd9 kernel/chr_drv/chr_drv.a(serial.o)
- .debug_line 0x0000000000003eb2 0x1db kernel/chr_drv/chr_drv.a(tty_ioctl.o)
- .debug_line 0x000000000000408d 0xe1 kernel/math/math.a(math_emulate.o)
- .debug_line 0x000000000000416e 0x28 lib/lib.a(ctype.o)
- .debug_line 0x0000000000004196 0x39 lib/lib.a(_exit.o)
- .debug_line 0x00000000000041cf 0x62 lib/lib.a(open.o)
- .debug_line 0x0000000000004231 0x5c lib/lib.a(close.o)
- .debug_line 0x000000000000428d 0x28 lib/lib.a(errno.o)
- .debug_line 0x00000000000042b5 0x76 lib/lib.a(write.o)
- .debug_line 0x000000000000432b 0x5a lib/lib.a(dup.o)
- .debug_line 0x0000000000004385 0x77 lib/lib.a(setsid.o)
- .debug_line 0x00000000000043fc 0x5d lib/lib.a(execve.o)
- .debug_line 0x0000000000004459 0x7a lib/lib.a(wait.o)
- .debug_line 0x00000000000044d3 0xc6 lib/lib.a(string.o)
-
-.debug_frame
- *(.debug_frame)
-
-.debug_str 0x0000000000000000 0x2093
- *(.debug_str)
- .debug_str 0x0000000000000000 0x1c0 init/main.o
- 0x1ff (size before relaxing)
- .debug_str 0x00000000000001c0 0xac0 kernel/kernel.o
- 0x2332 (size before relaxing)
- .debug_str 0x0000000000000c80 0x185 mm/mm.o
- 0x4e0 (size before relaxing)
- .debug_str 0x0000000000000e05 0x904 fs/fs.o
- 0x49ab (size before relaxing)
- .debug_str 0x0000000000001709 0xf0 kernel/blk_drv/blk_drv.a(ll_rw_blk.o)
- 0x491 (size before relaxing)
- .debug_str 0x00000000000017f9 0x1cf kernel/blk_drv/blk_drv.a(floppy.o)
- 0x673 (size before relaxing)
- .debug_str 0x00000000000019c8 0x15e kernel/blk_drv/blk_drv.a(hd.o)
- 0x5e8 (size before relaxing)
- .debug_str 0x0000000000001b26 0x43 kernel/blk_drv/blk_drv.a(ramdisk.o)
- 0x58a (size before relaxing)
- .debug_str 0x0000000000001b69 0xfb kernel/chr_drv/chr_drv.a(tty_io.o)
- 0x4e3 (size before relaxing)
- .debug_str 0x0000000000001c64 0x1b9 kernel/chr_drv/chr_drv.a(console.o)
- 0x5b7 (size before relaxing)
- .debug_str 0x0000000000001e1d 0x1a kernel/chr_drv/chr_drv.a(serial.o)
- 0x3fc (size before relaxing)
- .debug_str 0x0000000000001e37 0x8b kernel/chr_drv/chr_drv.a(tty_ioctl.o)
- 0x4a7 (size before relaxing)
- .debug_str 0x0000000000001ec2 0x70 kernel/math/math.a(math_emulate.o)
- 0x392 (size before relaxing)
- .debug_str 0x0000000000001f32 0x8d lib/lib.a(ctype.o)
- 0xb6 (size before relaxing)
- .debug_str 0x0000000000001fbf 0x8 lib/lib.a(_exit.o)
- 0xe2 (size before relaxing)
- .debug_str 0x0000000000000000 0x8 lib/lib.a(open.o)
- 0xf2 (size before relaxing)
- .debug_str 0x0000000000001fc7 0x8 lib/lib.a(close.o)
- 0xe4 (size before relaxing)
- .debug_str 0x0000000000001fcf 0x8 lib/lib.a(errno.o)
- 0x93 (size before relaxing)
- .debug_str 0x0000000000000000 0x8 lib/lib.a(write.o)
- 0xf0 (size before relaxing)
- .debug_str 0x0000000000001fd7 0x6 lib/lib.a(dup.o)
- 0xdc (size before relaxing)
- .debug_str 0x0000000000001fdd 0x9 lib/lib.a(setsid.o)
- 0xec (size before relaxing)
- .debug_str 0x0000000000001fe6 0x9 lib/lib.a(execve.o)
- 0xf5 (size before relaxing)
- .debug_str 0x0000000000001fef 0x11 lib/lib.a(wait.o)
- 0x102 (size before relaxing)
- .debug_str 0x0000000000002000 0x93 lib/lib.a(string.o)
- 0x147 (size before relaxing)
-
-.debug_loc
- *(.debug_loc)
-
-.debug_macinfo
- *(.debug_macinfo)
-
-.debug_weaknames
- *(.debug_weaknames)
-
-.debug_funcnames
- *(.debug_funcnames)
-
-.debug_typenames
- *(.debug_typenames)
-
-.debug_varnames
- *(.debug_varnames)
-
-.debug_pubtypes
- *(.debug_pubtypes)
-
-.debug_ranges 0x0000000000000000 0x18
- *(.debug_ranges)
- .debug_ranges 0x0000000000000000 0x18 init/main.o
-
-.debug_macro
- *(.debug_macro)
-
-.gnu.attributes
- *(.gnu.attributes)
-
-/DISCARD/
- *(.note.GNU-stack)
- *(.gnu_debuglink)
- *(.gnu.lto_*)
-OUTPUT(tools/system elf32-i386)
+Archive member included to satisfy reference by file (symbol)
+
+kernel/blk_drv/blk_drv.a(ll_rw_blk.o)
+ fs/fs.o (ll_rw_block)
+kernel/blk_drv/blk_drv.a(floppy.o)
+ kernel/kernel.o (do_floppy)
+kernel/blk_drv/blk_drv.a(hd.o)
+ kernel/kernel.o (do_hd)
+kernel/blk_drv/blk_drv.a(ramdisk.o)
+ kernel/blk_drv/blk_drv.a(hd.o) (rd_load)
+kernel/chr_drv/chr_drv.a(tty_io.o)
+ kernel/kernel.o (tty_table)
+kernel/chr_drv/chr_drv.a(console.o)
+ kernel/chr_drv/chr_drv.a(tty_io.o) (con_write)
+kernel/chr_drv/chr_drv.a(keyboard.2.o)
+ kernel/chr_drv/chr_drv.a(console.o) (keyboard_interrupt)
+kernel/chr_drv/chr_drv.a(serial.o)
+ kernel/chr_drv/chr_drv.a(tty_io.o) (rs_init)
+kernel/chr_drv/chr_drv.a(rs_io.o)
+ kernel/chr_drv/chr_drv.a(serial.o) (rs1_interrupt)
+kernel/chr_drv/chr_drv.a(tty_ioctl.o)
+ fs/fs.o (tty_ioctl)
+kernel/math/math.a(math_emulate.o)
+ kernel/kernel.o (math_emulate)
+lib/lib.a(ctype.o) kernel/chr_drv/chr_drv.a(tty_io.o) (_ctmp)
+lib/lib.a(_exit.o) init/main.o (_exit)
+lib/lib.a(open.o) init/main.o (open)
+lib/lib.a(close.o) init/main.o (close)
+lib/lib.a(errno.o) init/main.o (errno)
+lib/lib.a(write.o) init/main.o (write)
+lib/lib.a(dup.o) init/main.o (dup)
+lib/lib.a(setsid.o) init/main.o (setsid)
+lib/lib.a(execve.o) init/main.o (execve)
+lib/lib.a(wait.o) init/main.o (wait)
+lib/lib.a(string.o) fs/fs.o (strncpy)
+
+分配公共符号
+公共符号 大小 文件
+
+errno 0x4 lib/lib.a(errno.o)
+hash_table 0x4cc fs/fs.o
+___strtok 0x4 lib/lib.a(string.o)
+rd_start 0x4 kernel/blk_drv/blk_drv.a(ramdisk.o)
+request 0x480 kernel/blk_drv/blk_drv.a(ll_rw_blk.o)
+user_stack 0x1000 kernel/kernel.o
+_ctmp 0x1 lib/lib.a(ctype.o)
+super_block 0x360 fs/fs.o
+drive_info 0x20 init/main.o
+file_table 0x400 fs/fs.o
+
+Discarded input sections
+
+ .note.GNU-stack
+ 0x0000000000000000 0x0 init/main.o
+ .note.GNU-stack
+ 0x0000000000000000 0x0 kernel/kernel.o
+ .note.GNU-stack
+ 0x0000000000000000 0x0 mm/mm.o
+ .note.GNU-stack
+ 0x0000000000000000 0x0 fs/fs.o
+ .note.GNU-stack
+ 0x0000000000000000 0x0 kernel/blk_drv/blk_drv.a(ll_rw_blk.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 kernel/blk_drv/blk_drv.a(floppy.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 kernel/blk_drv/blk_drv.a(hd.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 kernel/blk_drv/blk_drv.a(ramdisk.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 kernel/chr_drv/chr_drv.a(tty_io.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 kernel/chr_drv/chr_drv.a(console.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 kernel/chr_drv/chr_drv.a(serial.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 kernel/chr_drv/chr_drv.a(tty_ioctl.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 kernel/math/math.a(math_emulate.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 lib/lib.a(ctype.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 lib/lib.a(_exit.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 lib/lib.a(open.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 lib/lib.a(close.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 lib/lib.a(errno.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 lib/lib.a(write.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 lib/lib.a(dup.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 lib/lib.a(setsid.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 lib/lib.a(execve.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 lib/lib.a(wait.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 lib/lib.a(string.o)
+
+内存配置
+
+名称 来源 长度 属性
+*default* 0x0000000000000000 0xffffffffffffffff
+
+Linker script and memory map
+
+段 .text 的地址设置为 0x0
+LOAD boot/head.o
+LOAD init/main.o
+LOAD kernel/kernel.o
+LOAD mm/mm.o
+LOAD fs/fs.o
+LOAD kernel/blk_drv/blk_drv.a
+LOAD kernel/chr_drv/chr_drv.a
+LOAD kernel/math/math.a
+LOAD lib/lib.a
+ 0x0000000008048000 PROVIDE (__executable_start, 0x8048000)
+ 0x0000000008048074 . = (0x8048000 + SIZEOF_HEADERS)
+
+.interp
+ *(.interp)
+
+.note.gnu.build-id
+ *(.note.gnu.build-id)
+
+.hash
+ *(.hash)
+
+.gnu.hash
+ *(.gnu.hash)
+
+.dynsym
+ *(.dynsym)
+
+.dynstr
+ *(.dynstr)
+
+.gnu.version
+ *(.gnu.version)
+
+.gnu.version_d
+ *(.gnu.version_d)
+
+.gnu.version_r
+ *(.gnu.version_r)
+
+.rel.init
+ *(.rel.init)
+
+.rel.text 0x0000000008048074 0x0
+ *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
+ .rel.text 0x0000000000000000 0x0 boot/head.o
+
+.rel.fini
+ *(.rel.fini)
+
+.rel.rodata
+ *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
+
+.rel.data.rel.ro
+ *(.rel.data.rel.ro .rel.data.rel.ro.* .rel.gnu.linkonce.d.rel.ro.*)
+
+.rel.data 0x0000000008048074 0x0
+ *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
+ .rel.data 0x0000000000000000 0x0 boot/head.o
+
+.rel.tdata
+ *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
+
+.rel.tbss
+ *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
+
+.rel.ctors
+ *(.rel.ctors)
+
+.rel.dtors
+ *(.rel.dtors)
+
+.rel.got
+ *(.rel.got)
+
+.rel.bss
+ *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
+
+.rel.ifunc
+ *(.rel.ifunc)
+
+.rel.plt 0x0000000008048074 0x0
+ *(.rel.plt)
+ 0x0000000008048074 PROVIDE (__rel_iplt_start, .)
+ *(.rel.iplt)
+ .rel.iplt 0x0000000000000000 0x0 boot/head.o
+ 0x0000000008048074 PROVIDE (__rel_iplt_end, .)
+
+.init
+ *(SORT(.init))
+
+.plt 0x0000000008048080 0x0
+ *(.plt)
+ *(.iplt)
+ .iplt 0x0000000000000000 0x0 boot/head.o
+
+.text 0x0000000000000000 0x17cef
+ *(.text.unlikely .text.*_unlikely .text.unlikely.*)
+ *(.text.exit .text.exit.*)
+ *(.text.startup .text.startup.*)
+ *(.text.hot .text.hot.*)
+ *(.text .stub .text.* .gnu.linkonce.t.*)
+ .text 0x0000000000000000 0x64c0 boot/head.o
+ 0x0000000000000000 startup_32
+ 0x0000000000000000 pg_dir
+ 0x0000000000005000 tmp_floppy_area
+ 0x00000000000054c0 idt
+ 0x0000000000005cc0 gdt
+ .text 0x00000000000064c0 0x713 init/main.o
+ 0x00000000000064c0 fork
+ 0x00000000000064ef pause
+ 0x000000000000651e setup
+ 0x0000000000006555 sync
+ 0x0000000000006799 main
+ 0x000000000000695b init
+ *fill* 0x0000000000006bd3 0x1
+ .text 0x0000000000006bd4 0x3914 kernel/kernel.o
+ 0x0000000000006bd4 show_task
+ 0x0000000000006c59 show_stat
+ 0x0000000000006c9f math_state_restore
+ 0x0000000000006cfd schedule
+ 0x0000000000006eaf sys_pause
+ 0x0000000000006ec5 sleep_on
+ 0x0000000000006f24 interruptible_sleep_on
+ 0x0000000000006fb7 wake_up
+ 0x0000000000006fdf ticks_to_floppy_on
+ 0x00000000000070aa floppy_on
+ 0x00000000000070d9 floppy_off
+ 0x00000000000070e9 do_floppy_timer
+ 0x00000000000071bd add_timer
+ 0x00000000000072e1 do_timer
+ 0x00000000000073d0 sys_alarm
+ 0x000000000000744f sys_getpid
+ 0x000000000000745b sys_getppid
+ 0x0000000000007467 sys_getuid
+ 0x0000000000007476 sys_geteuid
+ 0x0000000000007486 sys_getgid
+ 0x0000000000007496 sys_getegid
+ 0x00000000000074a5 sys_nice
+ 0x00000000000074d0 sched_init
+ 0x0000000000007674 system_call
+ 0x00000000000076f0 coprocessor_error
+ 0x0000000000007712 device_not_available
+ 0x000000000000774c timer_interrupt
+ 0x0000000000007784 sys_execve
+ 0x0000000000007794 sys_fork
+ 0x00000000000077ac hd_interrupt
+ 0x00000000000077e8 floppy_interrupt
+ 0x000000000000781e parallel_interrupt
+ 0x0000000000007a39 do_double_fault
+ 0x0000000000007a5c do_general_protection
+ 0x0000000000007a7f do_divide_error
+ 0x0000000000007aa2 do_int3
+ 0x0000000000007b6a do_nmi
+ 0x0000000000007b8d do_debug
+ 0x0000000000007bb0 do_overflow
+ 0x0000000000007bd3 do_bounds
+ 0x0000000000007bf6 do_invalid_op
+ 0x0000000000007c19 do_device_not_available
+ 0x0000000000007c3c do_coprocessor_segment_overrun
+ 0x0000000000007c5f do_invalid_TSS
+ 0x0000000000007c82 do_segment_not_present
+ 0x0000000000007ca5 do_stack_segment
+ 0x0000000000007cc8 do_coprocessor_error
+ 0x0000000000007cfc do_reserved
+ 0x0000000000007d1f trap_init
+ 0x0000000000008003 divide_error
+ 0x0000000000008038 debug
+ 0x000000000000803f nmi
+ 0x0000000000008046 int3
+ 0x000000000000804d overflow
+ 0x0000000000008054 bounds
+ 0x000000000000805b invalid_op
+ 0x0000000000008062 coprocessor_segment_overrun
+ 0x0000000000008069 reserved
+ 0x0000000000008070 irq13
+ 0x0000000000008085 double_fault
+ 0x00000000000080bc invalid_TSS
+ 0x00000000000080c3 segment_not_present
+ 0x00000000000080ca stack_segment
+ 0x00000000000080d1 general_protection
+ 0x000000000000810a verify_area
+ 0x0000000000008171 copy_mem
+ 0x00000000000082cb copy_process
+ 0x0000000000008778 find_empty_process
+ 0x000000000000880c panic
+ 0x0000000000008847 printk
+ 0x0000000000008b64 vsprintf
+ 0x000000000000902a sys_ftime
+ 0x0000000000009030 sys_break
+ 0x0000000000009036 sys_ptrace
+ 0x000000000000903c sys_stty
+ 0x0000000000009042 sys_gtty
+ 0x0000000000009048 sys_rename
+ 0x000000000000904e sys_prof
+ 0x0000000000009054 sys_setregid
+ 0x000000000000910d sys_setgid
+ 0x00000000000091a4 sys_acct
+ 0x00000000000091aa sys_phys
+ 0x00000000000091b0 sys_lock
+ 0x00000000000091b6 sys_mpx
+ 0x00000000000091bc sys_ulimit
+ 0x00000000000091c2 sys_time
+ 0x000000000000921e sys_setreuid
+ 0x0000000000009300 sys_setuid
+ 0x0000000000009395 sys_stime
+ 0x00000000000093eb sys_times
+ 0x000000000000948b sys_brk
+ 0x00000000000094cd sys_setpgid
+ 0x00000000000095a6 sys_getpgrp
+ 0x00000000000095b2 sys_setsid
+ 0x000000000000962c sys_getgroups
+ 0x0000000000009632 sys_setgroups
+ 0x0000000000009638 sys_uname
+ 0x00000000000096a1 sys_sethostname
+ 0x00000000000096a7 sys_getrlimit
+ 0x00000000000096ad sys_setrlimit
+ 0x00000000000096b3 sys_getrusage
+ 0x00000000000096b9 sys_gettimeofday
+ 0x00000000000096bf sys_settimeofday
+ 0x00000000000096c5 sys_umask
+ 0x0000000000009736 release
+ 0x0000000000009873 sys_kill
+ 0x0000000000009aad do_exit
+ 0x0000000000009ce1 sys_exit
+ 0x0000000000009cfa sys_waitpid
+ 0x0000000000009f52 sys_sgetmask
+ 0x0000000000009f5e sys_ssetmask
+ 0x0000000000009f8a sys_sigpending
+ 0x0000000000009f90 sys_sigsuspend
+ 0x000000000000a029 sys_signal
+ 0x000000000000a0ad sys_sigaction
+ 0x000000000000a1b7 do_signal
+ 0x000000000000a3a3 kernel_mktime
+ .text 0x000000000000a4e8 0xb01 mm/mm.o
+ 0x000000000000a507 get_free_page
+ 0x000000000000a543 free_page
+ 0x000000000000a5b2 free_page_tables
+ 0x000000000000a6b1 copy_page_tables
+ 0x000000000000a832 put_page
+ 0x000000000000a91e un_wp_page
+ 0x000000000000a9d6 do_wp_page
+ 0x000000000000aa08 write_verify
+ 0x000000000000aa61 get_empty_page
+ 0x000000000000ace7 do_no_page
+ 0x000000000000ae49 mem_init
+ 0x000000000000aebd calc_mem
+ 0x000000000000afb2 page_fault
+ .text 0x000000000000afe9 0x7539 fs/fs.o
+ 0x000000000000afff sys_ustat
+ 0x000000000000b005 sys_utime
+ 0x000000000000b0b2 sys_access
+ 0x000000000000b18e sys_chdir
+ 0x000000000000b202 sys_chroot
+ 0x000000000000b276 sys_chmod
+ 0x000000000000b310 sys_chown
+ 0x000000000000b38b sys_open
+ 0x000000000000b62e sys_creat
+ 0x000000000000b651 sys_close
+ 0x000000000000b720 sys_lseek
+ 0x000000000000b837 sys_read
+ 0x000000000000ba2a sys_write
+ 0x000000000000bc23 invalidate_inodes
+ 0x000000000000bc92 sync_inodes
+ 0x000000000000c0d5 bmap
+ 0x000000000000c0f8 create_block
+ 0x000000000000c11b iput
+ 0x000000000000c28a get_empty_inode
+ 0x000000000000c3df get_pipe_inode
+ 0x000000000000c454 iget
+ 0x000000000000c84f sys_sync
+ 0x000000000000c8b2 sync_dev
+ 0x000000000000c9ab invalidate_buffers
+ 0x000000000000ca1d check_disk_change
+ 0x000000000000cceb get_hash_table
+ 0x000000000000cd6d getblk
+ 0x000000000000cf0b brelse
+ 0x000000000000cf54 bread
+ 0x000000000000cfd9 bread_page
+ 0x000000000000d0fb breada
+ 0x000000000000d1f0 buffer_init
+ 0x000000000000d391 get_super
+ 0x000000000000d400 put_super
+ 0x000000000000d816 sys_umount
+ 0x000000000000d977 sys_mount
+ 0x000000000000dae8 mount_root
+ 0x000000000000dd1c block_write
+ 0x000000000000de6e block_read
+ 0x000000000000e1d9 rw_char
+ 0x000000000000e269 file_read
+ 0x000000000000e414 file_write
+ 0x000000000000e6fd sys_stat
+ 0x000000000000e747 sys_lstat
+ 0x000000000000e762 sys_fstat
+ 0x000000000000e7bf sys_readlink
+ 0x000000000000e86e sys_uselib
+ 0x000000000000ed3d do_execve
+ 0x000000000000f7f1 read_pipe
+ 0x000000000000f947 write_pipe
+ 0x000000000000fac6 sys_pipe
+ 0x00000000000104a5 namei
+ 0x00000000000105bb open_namei
+ 0x000000000001090e sys_mknod
+ 0x0000000000010b3e sys_mkdir
+ 0x00000000000110cd sys_rmdir
+ 0x0000000000011425 sys_unlink
+ 0x00000000000116c6 sys_symlink
+ 0x00000000000116cc sys_link
+ 0x0000000000011926 free_block
+ 0x0000000000011a98 new_block
+ 0x0000000000011c3c free_inode
+ 0x0000000000011da3 new_inode
+ 0x0000000000012057 sys_dup2
+ 0x000000000001207e sys_dup
+ 0x0000000000012099 sys_fcntl
+ 0x00000000000121d8 sys_ioctl
+ 0x00000000000123e7 truncate
+ 0x000000000001251c sys_select
+ .text 0x0000000000012522 0x46a kernel/blk_drv/blk_drv.a(ll_rw_blk.o)
+ 0x00000000000128e5 ll_rw_block
+ 0x000000000001293e blk_dev_init
+ .text 0x000000000001298c 0xb9d kernel/blk_drv/blk_drv.a(floppy.o)
+ 0x0000000000012a72 floppy_deselect
+ 0x0000000000012aa9 floppy_change
+ 0x0000000000012e66 setup_rw_floppy
+ 0x00000000000130ff unexpected_floppy_interrupt
+ 0x00000000000134d7 floppy_init
+ .text 0x0000000000013529 0xc8f kernel/blk_drv/blk_drv.a(hd.o)
+ 0x00000000000135fd sys_setup
+ 0x0000000000013cac unexpected_hd_interrupt
+ 0x000000000001413e hd_init
+ .text 0x00000000000141b8 0x50c kernel/blk_drv/blk_drv.a(ramdisk.o)
+ 0x00000000000143c2 rd_init
+ 0x0000000000014418 rd_load
+ .text 0x00000000000146c4 0xcbb kernel/chr_drv/chr_drv.a(tty_io.o)
+ 0x00000000000146ea tty_init
+ 0x00000000000146fb tty_intr
+ 0x0000000000014808 wait_for_keypress
+ 0x000000000001481b copy_to_cooked
+ 0x0000000000014dd6 tty_read
+ 0x0000000000015144 tty_write
+ 0x0000000000015356 do_tty_interrupt
+ 0x000000000001537e chr_dev_init
+ .text 0x000000000001537f 0x1283 kernel/chr_drv/chr_drv.a(console.o)
+ 0x000000000001591c csi_m
+ 0x0000000000015cb6 con_write
+ 0x0000000000016344 con_init
+ 0x000000000001657b sysbeepstop
+ .text 0x0000000000016602 0x7e2 kernel/chr_drv/chr_drv.a(keyboard.2.o)
+ 0x0000000000016605 keyboard_interrupt
+ .text 0x0000000000016de4 0x145 kernel/chr_drv/chr_drv.a(serial.o)
+ 0x0000000000016e59 rs_init
+ 0x0000000000016edc rs_write
+ *fill* 0x0000000000016f29 0x3
+ .text 0x0000000000016f2c 0xf7 kernel/chr_drv/chr_drv.a(rs_io.o)
+ 0x0000000000016f2c rs1_interrupt
+ 0x0000000000016f34 rs2_interrupt
+ .text 0x0000000000017023 0x60f kernel/chr_drv/chr_drv.a(tty_ioctl.o)
+ 0x0000000000017334 tty_ioctl
+ .text 0x0000000000017632 0x111 kernel/math/math.a(math_emulate.o)
+ 0x0000000000017640 math_emulate
+ 0x0000000000017723 math_error
+ .text 0x0000000000017743 0x0 lib/lib.a(ctype.o)
+ .text 0x0000000000017743 0x10 lib/lib.a(_exit.o)
+ 0x0000000000017743 _exit
+ .text 0x0000000000017753 0x49 lib/lib.a(open.o)
+ 0x0000000000017753 open
+ .text 0x000000000001779c 0x37 lib/lib.a(close.o)
+ 0x000000000001779c close
+ .text 0x00000000000177d3 0x0 lib/lib.a(errno.o)
+ .text 0x00000000000177d3 0x3d lib/lib.a(write.o)
+ 0x00000000000177d3 write
+ .text 0x0000000000017810 0x37 lib/lib.a(dup.o)
+ 0x0000000000017810 dup
+ .text 0x0000000000017847 0x2f lib/lib.a(setsid.o)
+ 0x0000000000017847 setsid
+ .text 0x0000000000017876 0x3d lib/lib.a(execve.o)
+ 0x0000000000017876 execve
+ .text 0x00000000000178b3 0x60 lib/lib.a(wait.o)
+ 0x00000000000178b3 waitpid
+ 0x00000000000178f0 wait
+ .text 0x0000000000017913 0x3dc lib/lib.a(string.o)
+ 0x0000000000017913 strcpy
+ 0x000000000001792f strncpy
+ 0x0000000000017954 strcat
+ 0x000000000001797f strncat
+ 0x00000000000179b4 strcmp
+ 0x00000000000179db strncmp
+ 0x0000000000017a09 strchr
+ 0x0000000000017a36 strrchr
+ 0x0000000000017a65 strspn
+ 0x0000000000017aa2 strcspn
+ 0x0000000000017adf strpbrk
+ 0x0000000000017b16 strstr
+ 0x0000000000017b4f strlen
+ 0x0000000000017b72 strtok
+ 0x0000000000017bf5 memcpy
+ 0x0000000000017c15 memmove
+ 0x0000000000017c69 memcmp
+ 0x0000000000017c93 memchr
+ 0x0000000000017ccb memset
+ *(.gnu.warning)
+
+.fini
+ *(SORT(.fini))
+ 0x0000000000017cef PROVIDE (__etext, .)
+ 0x0000000000017cef PROVIDE (_etext, .)
+ 0x0000000000017cef PROVIDE (etext, .)
+
+.rodata 0x0000000000017cf0 0x13ca
+ *(.rodata .rodata.* .gnu.linkonce.r.*)
+ .rodata 0x0000000000017cf0 0xad init/main.o
+ *fill* 0x0000000000017d9d 0x3
+ .rodata 0x0000000000017da0 0x438 kernel/kernel.o
+ .rodata 0x00000000000181d8 0x18f mm/mm.o
+ *fill* 0x0000000000018367 0x1
+ .rodata 0x0000000000018368 0x62c fs/fs.o
+ .rodata 0x0000000000018994 0x7a kernel/blk_drv/blk_drv.a(ll_rw_blk.o)
+ *fill* 0x0000000000018a0e 0x2
+ .rodata 0x0000000000018a10 0x133 kernel/blk_drv/blk_drv.a(floppy.o)
+ *fill* 0x0000000000018b43 0x1
+ .rodata 0x0000000000018b44 0x19b kernel/blk_drv/blk_drv.a(hd.o)
+ *fill* 0x0000000000018cdf 0x1
+ .rodata 0x0000000000018ce0 0x188 kernel/blk_drv/blk_drv.a(ramdisk.o)
+ .rodata 0x0000000000018e68 0x17d kernel/chr_drv/chr_drv.a(console.o)
+ *fill* 0x0000000000018fe5 0x3
+ .rodata 0x0000000000018fe8 0x80 kernel/chr_drv/chr_drv.a(tty_ioctl.o)
+ .rodata 0x0000000000019068 0x52 kernel/math/math.a(math_emulate.o)
+
+.rodata1
+ *(.rodata1)
+
+.eh_frame_hdr
+ *(.eh_frame_hdr)
+
+.eh_frame 0x00000000000190bc 0x2a6c
+ *(.eh_frame)
+ .eh_frame 0x00000000000190bc 0xf0 init/main.o
+ .eh_frame 0x00000000000191ac 0xb04 kernel/kernel.o
+ 0xbf4 (size before relaxing)
+ .eh_frame 0x0000000000019cb0 0x194 mm/mm.o
+ 0x1ac (size before relaxing)
+ .eh_frame 0x0000000000019e44 0xdd8 fs/fs.o
+ 0xf70 (size before relaxing)
+ .eh_frame 0x000000000001ac1c 0x98 kernel/blk_drv/blk_drv.a(ll_rw_blk.o)
+ 0xb0 (size before relaxing)
+ .eh_frame 0x000000000001acb4 0x23c kernel/blk_drv/blk_drv.a(floppy.o)
+ 0x254 (size before relaxing)
+ .eh_frame 0x000000000001aef0 0x1e8 kernel/blk_drv/blk_drv.a(hd.o)
+ 0x200 (size before relaxing)
+ .eh_frame 0x000000000001b0d8 0xac kernel/blk_drv/blk_drv.a(ramdisk.o)
+ 0xc4 (size before relaxing)
+ .eh_frame 0x000000000001b184 0x12c kernel/chr_drv/chr_drv.a(tty_io.o)
+ 0x144 (size before relaxing)
+ .eh_frame 0x000000000001b2b0 0x2c0 kernel/chr_drv/chr_drv.a(console.o)
+ 0x2d8 (size before relaxing)
+ .eh_frame 0x000000000001b570 0x54 kernel/chr_drv/chr_drv.a(serial.o)
+ 0x6c (size before relaxing)
+ .eh_frame 0x000000000001b5c4 0x148 kernel/chr_drv/chr_drv.a(tty_ioctl.o)
+ 0x160 (size before relaxing)
+ .eh_frame 0x000000000001b70c 0x5c kernel/math/math.a(math_emulate.o)
+ 0x74 (size before relaxing)
+ .eh_frame 0x000000000001b768 0x1c lib/lib.a(_exit.o)
+ 0x34 (size before relaxing)
+ .eh_frame 0x000000000001b784 0x24 lib/lib.a(open.o)
+ 0x3c (size before relaxing)
+ .eh_frame 0x000000000001b7a8 0x20 lib/lib.a(close.o)
+ 0x38 (size before relaxing)
+ .eh_frame 0x000000000001b7c8 0x20 lib/lib.a(write.o)
+ 0x38 (size before relaxing)
+ .eh_frame 0x000000000001b7e8 0x20 lib/lib.a(dup.o)
+ 0x38 (size before relaxing)
+ .eh_frame 0x000000000001b808 0x18 lib/lib.a(setsid.o)
+ 0x30 (size before relaxing)
+ .eh_frame 0x000000000001b820 0x20 lib/lib.a(execve.o)
+ 0x38 (size before relaxing)
+ .eh_frame 0x000000000001b840 0x38 lib/lib.a(wait.o)
+ 0x50 (size before relaxing)
+ .eh_frame 0x000000000001b878 0x2b0 lib/lib.a(string.o)
+ 0x2c8 (size before relaxing)
+
+.gcc_except_table
+ *(.gcc_except_table .gcc_except_table.*)
+
+.exception_ranges
+ *(.exception_ranges .exception_ranges*)
+ 0x000000000001bb28 . = .
+
+.eh_frame
+ *(.eh_frame)
+
+.gcc_except_table
+ *(.gcc_except_table .gcc_except_table.*)
+
+.exception_ranges
+ *(.exception_ranges .exception_ranges*)
+
+.tdata
+ *(.tdata .tdata.* .gnu.linkonce.td.*)
+
+.tbss
+ *(.tbss .tbss.* .gnu.linkonce.tb.*)
+ *(.tcommon)
+
+.preinit_array 0x000000000001bb28 0x0
+ 0x000000000001bb28 PROVIDE (__preinit_array_start, .)
+ *(.preinit_array)
+ 0x000000000001bb28 PROVIDE (__preinit_array_end, .)
+
+.init_array 0x000000000001bb28 0x0
+ 0x000000000001bb28 PROVIDE (__init_array_start, .)
+ *(SORT(.init_array.*) SORT(.ctors.*))
+ *(.init_array EXCLUDE_FILE(*crtend?.o *crtend.o *crtbegin?.o *crtbegin.o) .ctors)
+ 0x000000000001bb28 PROVIDE (__init_array_end, .)
+
+.fini_array 0x000000000001bb28 0x0
+ 0x000000000001bb28 PROVIDE (__fini_array_start, .)
+ *(SORT(.fini_array.*) SORT(.dtors.*))
+ *(.fini_array EXCLUDE_FILE(*crtend?.o *crtend.o *crtbegin?.o *crtbegin.o) .dtors)
+ 0x000000000001bb28 PROVIDE (__fini_array_end, .)
+
+.ctors
+ *crtbegin.o(.ctors)
+ *crtbegin?.o(.ctors)
+ *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
+ *(SORT(.ctors.*))
+ *(.ctors)
+
+.dtors
+ *crtbegin.o(.dtors)
+ *crtbegin?.o(.dtors)
+ *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
+ *(SORT(.dtors.*))
+ *(.dtors)
+
+.jcr
+ *(.jcr)
+
+.data.rel.ro
+ *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*)
+ *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*)
+
+.dynamic
+ *(.dynamic)
+
+.got
+ *(.got)
+ *(.igot)
+
+.got.plt 0x000000000001bb28 0x0
+ *(.got.plt)
+ *(.igot.plt)
+ .igot.plt 0x0000000000000000 0x0 boot/head.o
+
+.data 0x000000000001bb40 0x3b01
+ *(.data .data.* .gnu.linkonce.d.*)
+ .data 0x000000000001bb40 0x0 boot/head.o
+ .data 0x000000000001bb40 0x28 init/main.o
+ *fill* 0x000000000001bb68 0x18
+ .data 0x000000000001bb80 0x1310 kernel/kernel.o
+ 0x000000000001bb80 sys_call_table
+ 0x000000000001bcdc NR_syscalls
+ 0x000000000001cce0 current
+ 0x000000000001cd00 task
+ 0x000000000001ce00 stack_start
+ 0x000000000001ce08 current_DOR
+ .data 0x000000000001ce90 0x0 mm/mm.o
+ *fill* 0x000000000001ce90 0x10
+ .data 0x000000000001cea0 0x60 fs/fs.o
+ 0x000000000001cea4 start_buffer
+ .data 0x000000000001cf00 0x0 kernel/blk_drv/blk_drv.a(ll_rw_blk.o)
+ .data 0x000000000001cf00 0xcd kernel/blk_drv/blk_drv.a(floppy.o)
+ *fill* 0x000000000001cfcd 0x3
+ .data 0x000000000001cfd0 0x4 kernel/blk_drv/blk_drv.a(hd.o)
+ .data 0x000000000001cfd4 0x0 kernel/blk_drv/blk_drv.a(ramdisk.o)
+ *fill* 0x000000000001cfd4 0xc
+ .data 0x000000000001cfe0 0x2538 kernel/chr_drv/chr_drv.a(tty_io.o)
+ 0x000000000001cfe0 tty_table
+ 0x000000000001f500 table_list
+ .data 0x000000000001f518 0x1 kernel/chr_drv/chr_drv.a(console.o)
+ .data 0x000000000001f519 0x0 kernel/chr_drv/chr_drv.a(keyboard.2.o)
+ .data 0x000000000001f519 0x0 kernel/chr_drv/chr_drv.a(serial.o)
+ .data 0x000000000001f519 0x0 kernel/chr_drv/chr_drv.a(rs_io.o)
+ *fill* 0x000000000001f519 0x7
+ .data 0x000000000001f520 0x20 kernel/chr_drv/chr_drv.a(tty_ioctl.o)
+ .data 0x000000000001f540 0x0 kernel/math/math.a(math_emulate.o)
+ .data 0x000000000001f540 0x101 lib/lib.a(ctype.o)
+ 0x000000000001f540 _ctype
+ .data 0x000000000001f641 0x0 lib/lib.a(_exit.o)
+ .data 0x000000000001f641 0x0 lib/lib.a(open.o)
+ .data 0x000000000001f641 0x0 lib/lib.a(close.o)
+ .data 0x000000000001f641 0x0 lib/lib.a(errno.o)
+ .data 0x000000000001f641 0x0 lib/lib.a(write.o)
+ .data 0x000000000001f641 0x0 lib/lib.a(dup.o)
+ .data 0x000000000001f641 0x0 lib/lib.a(setsid.o)
+ .data 0x000000000001f641 0x0 lib/lib.a(execve.o)
+ .data 0x000000000001f641 0x0 lib/lib.a(wait.o)
+ .data 0x000000000001f641 0x0 lib/lib.a(string.o)
+
+.data1
+ *(.data1)
+ 0x000000000001f641 _edata = .
+ 0x000000000001f641 PROVIDE (edata, .)
+ 0x000000000001f641 . = .
+ 0x000000000001f641 __bss_start = .
+
+.bss 0x000000000001f660 0x44b0
+ *(.dynbss)
+ *(.bss .bss.* .gnu.linkonce.b.*)
+ .bss 0x000000000001f660 0x0 boot/head.o
+ .bss 0x000000000001f660 0x40c init/main.o
+ *fill* 0x000000000001fa6c 0x14
+ .bss 0x000000000001fa80 0x760 kernel/kernel.o
+ 0x000000000001fa80 jiffies
+ 0x000000000001fa84 startup_time
+ 0x000000000001fa88 last_task_used_math
+ 0x000000000001fdc4 last_pid
+ .bss 0x00000000000201e0 0xf20 mm/mm.o
+ .bss 0x0000000000021100 0x710 fs/fs.o
+ 0x0000000000021100 inode_table
+ 0x0000000000021800 nr_buffers
+ 0x000000000002180c ROOT_DEV
+ *fill* 0x0000000000021810 0x10
+ .bss 0x0000000000021820 0x58 kernel/blk_drv/blk_drv.a(ll_rw_blk.o)
+ 0x0000000000021820 wait_for_request
+ 0x0000000000021840 blk_dev
+ .bss 0x0000000000021878 0x25 kernel/blk_drv/blk_drv.a(floppy.o)
+ 0x0000000000021878 do_floppy
+ 0x000000000002187c selected
+ 0x0000000000021880 wait_on_floppy_select
+ *fill* 0x000000000002189d 0x3
+ .bss 0x00000000000218a0 0xb0 kernel/blk_drv/blk_drv.a(hd.o)
+ 0x00000000000218a0 do_hd
+ 0x00000000000218c0 hd_info
+ .bss 0x0000000000021950 0x4 kernel/blk_drv/blk_drv.a(ramdisk.o)
+ 0x0000000000021950 rd_length
+ .bss 0x0000000000021954 0x4 kernel/chr_drv/chr_drv.a(tty_io.o)
+ *fill* 0x0000000000021958 0x8
+ .bss 0x0000000000021960 0xac kernel/chr_drv/chr_drv.a(console.o)
+ 0x0000000000021960 beepcount
+ .bss 0x0000000000021a0c 0x0 kernel/chr_drv/chr_drv.a(keyboard.2.o)
+ .bss 0x0000000000021a0c 0x0 kernel/chr_drv/chr_drv.a(serial.o)
+ .bss 0x0000000000021a0c 0x0 kernel/chr_drv/chr_drv.a(rs_io.o)
+ .bss 0x0000000000021a0c 0x0 kernel/chr_drv/chr_drv.a(tty_ioctl.o)
+ .bss 0x0000000000021a0c 0x0 kernel/math/math.a(math_emulate.o)
+ .bss 0x0000000000021a0c 0x0 lib/lib.a(ctype.o)
+ .bss 0x0000000000021a0c 0x0 lib/lib.a(_exit.o)
+ .bss 0x0000000000021a0c 0x0 lib/lib.a(open.o)
+ .bss 0x0000000000021a0c 0x0 lib/lib.a(close.o)
+ .bss 0x0000000000021a0c 0x0 lib/lib.a(errno.o)
+ .bss 0x0000000000021a0c 0x0 lib/lib.a(write.o)
+ .bss 0x0000000000021a0c 0x0 lib/lib.a(dup.o)
+ .bss 0x0000000000021a0c 0x0 lib/lib.a(setsid.o)
+ .bss 0x0000000000021a0c 0x0 lib/lib.a(execve.o)
+ .bss 0x0000000000021a0c 0x0 lib/lib.a(wait.o)
+ .bss 0x0000000000021a0c 0x0 lib/lib.a(string.o)
+ *(COMMON)
+ *fill* 0x0000000000021a0c 0x14
+ COMMON 0x0000000000021a20 0x20 init/main.o
+ 0x0000000000021a20 drive_info
+ COMMON 0x0000000000021a40 0x1000 kernel/kernel.o
+ 0x0000000000021a40 user_stack
+ COMMON 0x0000000000022a40 0xc40 fs/fs.o
+ 0x0000000000022a40 hash_table
+ 0x0000000000022f20 super_block
+ 0x0000000000023280 file_table
+ COMMON 0x0000000000023680 0x480 kernel/blk_drv/blk_drv.a(ll_rw_blk.o)
+ 0x0000000000023680 request
+ COMMON 0x0000000000023b00 0x4 kernel/blk_drv/blk_drv.a(ramdisk.o)
+ 0x0000000000023b00 rd_start
+ COMMON 0x0000000000023b04 0x1 lib/lib.a(ctype.o)
+ 0x0000000000023b04 _ctmp
+ *fill* 0x0000000000023b05 0x3
+ COMMON 0x0000000000023b08 0x4 lib/lib.a(errno.o)
+ 0x0000000000023b08 errno
+ COMMON 0x0000000000023b0c 0x4 lib/lib.a(string.o)
+ 0x0000000000023b0c ___strtok
+ 0x0000000000023b10 . = ALIGN ((. != 0x0)?0x4:0x1)
+ 0x0000000000023b10 . = ALIGN (0x4)
+ 0x0000000000023b10 . = SEGMENT_START ("ldata-segment", .)
+ 0x0000000000023b10 . = ALIGN (0x4)
+ 0x0000000000023b10 _end = .
+ 0x0000000000023b10 PROVIDE (end, .)
+
+.stab
+ *(.stab)
+
+.stabstr
+ *(.stabstr)
+
+.stab.excl
+ *(.stab.excl)
+
+.stab.exclstr
+ *(.stab.exclstr)
+
+.stab.index
+ *(.stab.index)
+
+.stab.indexstr
+ *(.stab.indexstr)
+
+.comment 0x0000000000000000 0x29
+ *(.comment)
+ .comment 0x0000000000000000 0x29 init/main.o
+ 0x2a (size before relaxing)
+ .comment 0x0000000000000000 0x1a4 kernel/kernel.o
+ .comment 0x0000000000000000 0x2a mm/mm.o
+ .comment 0x0000000000000000 0x2f4 fs/fs.o
+ .comment 0x0000000000000000 0x2a kernel/blk_drv/blk_drv.a(ll_rw_blk.o)
+ .comment 0x0000000000000000 0x2a kernel/blk_drv/blk_drv.a(floppy.o)
+ .comment 0x0000000000000000 0x2a kernel/blk_drv/blk_drv.a(hd.o)
+ .comment 0x0000000000000000 0x2a kernel/blk_drv/blk_drv.a(ramdisk.o)
+ .comment 0x0000000000000000 0x2a kernel/chr_drv/chr_drv.a(tty_io.o)
+ .comment 0x0000000000000000 0x2a kernel/chr_drv/chr_drv.a(console.o)
+ .comment 0x0000000000000000 0x2a kernel/chr_drv/chr_drv.a(serial.o)
+ .comment 0x0000000000000000 0x2a kernel/chr_drv/chr_drv.a(tty_ioctl.o)
+ .comment 0x0000000000000000 0x2a kernel/math/math.a(math_emulate.o)
+ .comment 0x0000000000000000 0x2a lib/lib.a(ctype.o)
+ .comment 0x0000000000000000 0x2a lib/lib.a(_exit.o)
+ .comment 0x0000000000000000 0x2a lib/lib.a(open.o)
+ .comment 0x0000000000000000 0x2a lib/lib.a(close.o)
+ .comment 0x0000000000000000 0x2a lib/lib.a(errno.o)
+ .comment 0x0000000000000000 0x2a lib/lib.a(write.o)
+ .comment 0x0000000000000000 0x2a lib/lib.a(dup.o)
+ .comment 0x0000000000000000 0x2a lib/lib.a(setsid.o)
+ .comment 0x0000000000000000 0x2a lib/lib.a(execve.o)
+ .comment 0x0000000000000000 0x2a lib/lib.a(wait.o)
+ .comment 0x0000000000000000 0x2a lib/lib.a(string.o)
+
+.debug
+ *(.debug)
+
+.line
+ *(.line)
+
+.debug_srcinfo
+ *(.debug_srcinfo)
+
+.debug_sfnames
+ *(.debug_sfnames)
+
+.debug_aranges 0x0000000000000000 0x628
+ *(.debug_aranges)
+ .debug_aranges
+ 0x0000000000000000 0x20 init/main.o
+ .debug_aranges
+ 0x0000000000000020 0x140 kernel/kernel.o
+ .debug_aranges
+ 0x0000000000000160 0x20 mm/mm.o
+ .debug_aranges
+ 0x0000000000000180 0x238 fs/fs.o
+ .debug_aranges
+ 0x00000000000003b8 0x20 kernel/blk_drv/blk_drv.a(ll_rw_blk.o)
+ .debug_aranges
+ 0x00000000000003d8 0x20 kernel/blk_drv/blk_drv.a(floppy.o)
+ .debug_aranges
+ 0x00000000000003f8 0x20 kernel/blk_drv/blk_drv.a(hd.o)
+ .debug_aranges
+ 0x0000000000000418 0x20 kernel/blk_drv/blk_drv.a(ramdisk.o)
+ .debug_aranges
+ 0x0000000000000438 0x20 kernel/chr_drv/chr_drv.a(tty_io.o)
+ .debug_aranges
+ 0x0000000000000458 0x20 kernel/chr_drv/chr_drv.a(console.o)
+ .debug_aranges
+ 0x0000000000000478 0x20 kernel/chr_drv/chr_drv.a(serial.o)
+ .debug_aranges
+ 0x0000000000000498 0x20 kernel/chr_drv/chr_drv.a(tty_ioctl.o)
+ .debug_aranges
+ 0x00000000000004b8 0x20 kernel/math/math.a(math_emulate.o)
+ .debug_aranges
+ 0x00000000000004d8 0x18 lib/lib.a(ctype.o)
+ .debug_aranges
+ 0x00000000000004f0 0x20 lib/lib.a(_exit.o)
+ .debug_aranges
+ 0x0000000000000510 0x20 lib/lib.a(open.o)
+ .debug_aranges
+ 0x0000000000000530 0x20 lib/lib.a(close.o)
+ .debug_aranges
+ 0x0000000000000550 0x18 lib/lib.a(errno.o)
+ .debug_aranges
+ 0x0000000000000568 0x20 lib/lib.a(write.o)
+ .debug_aranges
+ 0x0000000000000588 0x20 lib/lib.a(dup.o)
+ .debug_aranges
+ 0x00000000000005a8 0x20 lib/lib.a(setsid.o)
+ .debug_aranges
+ 0x00000000000005c8 0x20 lib/lib.a(execve.o)
+ .debug_aranges
+ 0x00000000000005e8 0x20 lib/lib.a(wait.o)
+ .debug_aranges
+ 0x0000000000000608 0x20 lib/lib.a(string.o)
+
+.debug_pubnames
+ *(.debug_pubnames)
+
+.debug_info 0x0000000000000000 0x16d23
+ *(.debug_info .gnu.linkonce.wi.*)
+ .debug_info 0x0000000000000000 0x553 init/main.o
+ .debug_info 0x0000000000000553 0x4cb6 kernel/kernel.o
+ .debug_info 0x0000000000005209 0xb2b mm/mm.o
+ .debug_info 0x0000000000005d34 0xa290 fs/fs.o
+ .debug_info 0x000000000000ffc4 0x932 kernel/blk_drv/blk_drv.a(ll_rw_blk.o)
+ .debug_info 0x00000000000108f6 0xc9f kernel/blk_drv/blk_drv.a(floppy.o)
+ .debug_info 0x0000000000011595 0xd5f kernel/blk_drv/blk_drv.a(hd.o)
+ .debug_info 0x00000000000122f4 0xad5 kernel/blk_drv/blk_drv.a(ramdisk.o)
+ .debug_info 0x0000000000012dc9 0xacd kernel/chr_drv/chr_drv.a(tty_io.o)
+ .debug_info 0x0000000000013896 0xdb0 kernel/chr_drv/chr_drv.a(console.o)
+ .debug_info 0x0000000000014646 0x85c kernel/chr_drv/chr_drv.a(serial.o)
+ .debug_info 0x0000000000014ea2 0xb47 kernel/chr_drv/chr_drv.a(tty_ioctl.o)
+ .debug_info 0x00000000000159e9 0x7b5 kernel/math/math.a(math_emulate.o)
+ .debug_info 0x000000000001619e 0x66 lib/lib.a(ctype.o)
+ .debug_info 0x0000000000016204 0x77 lib/lib.a(_exit.o)
+ .debug_info 0x000000000001627b 0xd0 lib/lib.a(open.o)
+ .debug_info 0x000000000001634b 0x97 lib/lib.a(close.o)
+ .debug_info 0x00000000000163e2 0x36 lib/lib.a(errno.o)
+ .debug_info 0x0000000000016418 0xc9 lib/lib.a(write.o)
+ .debug_info 0x00000000000164e1 0x97 lib/lib.a(dup.o)
+ .debug_info 0x0000000000016578 0x95 lib/lib.a(setsid.o)
+ .debug_info 0x000000000001660d 0xcb lib/lib.a(execve.o)
+ .debug_info 0x00000000000166d8 0xed lib/lib.a(wait.o)
+ .debug_info 0x00000000000167c5 0x55e lib/lib.a(string.o)
+
+.debug_abbrev 0x0000000000000000 0x43b9
+ *(.debug_abbrev)
+ .debug_abbrev 0x0000000000000000 0x1d3 init/main.o
+ .debug_abbrev 0x00000000000001d3 0xf63 kernel/kernel.o
+ .debug_abbrev 0x0000000000001136 0x20b mm/mm.o
+ .debug_abbrev 0x0000000000001341 0x19f1 fs/fs.o
+ .debug_abbrev 0x0000000000002d32 0x169 kernel/blk_drv/blk_drv.a(ll_rw_blk.o)
+ .debug_abbrev 0x0000000000002e9b 0x27d kernel/blk_drv/blk_drv.a(floppy.o)
+ .debug_abbrev 0x0000000000003118 0x23c kernel/blk_drv/blk_drv.a(hd.o)
+ .debug_abbrev 0x0000000000003354 0x1a8 kernel/blk_drv/blk_drv.a(ramdisk.o)
+ .debug_abbrev 0x00000000000034fc 0x279 kernel/chr_drv/chr_drv.a(tty_io.o)
+ .debug_abbrev 0x0000000000003775 0x26b kernel/chr_drv/chr_drv.a(console.o)
+ .debug_abbrev 0x00000000000039e0 0x175 kernel/chr_drv/chr_drv.a(serial.o)
+ .debug_abbrev 0x0000000000003b55 0x18d kernel/chr_drv/chr_drv.a(tty_ioctl.o)
+ .debug_abbrev 0x0000000000003ce2 0x163 kernel/math/math.a(math_emulate.o)
+ .debug_abbrev 0x0000000000003e45 0x3e lib/lib.a(ctype.o)
+ .debug_abbrev 0x0000000000003e83 0x51 lib/lib.a(_exit.o)
+ .debug_abbrev 0x0000000000003ed4 0x97 lib/lib.a(open.o)
+ .debug_abbrev 0x0000000000003f6b 0x75 lib/lib.a(close.o)
+ .debug_abbrev 0x0000000000003fe0 0x2c lib/lib.a(errno.o)
+ .debug_abbrev 0x000000000000400c 0xa1 lib/lib.a(write.o)
+ .debug_abbrev 0x00000000000040ad 0x75 lib/lib.a(dup.o)
+ .debug_abbrev 0x0000000000004122 0x73 lib/lib.a(setsid.o)
+ .debug_abbrev 0x0000000000004195 0x85 lib/lib.a(execve.o)
+ .debug_abbrev 0x000000000000421a 0xb6 lib/lib.a(wait.o)
+ .debug_abbrev 0x00000000000042d0 0xe9 lib/lib.a(string.o)
+
+.debug_line 0x0000000000000000 0x4599
+ *(.debug_line .debug_line.* .debug_line_end)
+ .debug_line 0x0000000000000000 0x1a7 init/main.o
+ .debug_line 0x00000000000001a7 0xe86 kernel/kernel.o
+ .debug_line 0x000000000000102d 0x274 mm/mm.o
+ .debug_line 0x00000000000012a1 0x1c50 fs/fs.o
+ .debug_line 0x0000000000002ef1 0x197 kernel/blk_drv/blk_drv.a(ll_rw_blk.o)
+ .debug_line 0x0000000000003088 0x24c kernel/blk_drv/blk_drv.a(floppy.o)
+ .debug_line 0x00000000000032d4 0x2bf kernel/blk_drv/blk_drv.a(hd.o)
+ .debug_line 0x0000000000003593 0x160 kernel/blk_drv/blk_drv.a(ramdisk.o)
+ .debug_line 0x00000000000036f3 0x33b kernel/chr_drv/chr_drv.a(tty_io.o)
+ .debug_line 0x0000000000003a2e 0x3ab kernel/chr_drv/chr_drv.a(console.o)
+ .debug_line 0x0000000000003dd9 0xd9 kernel/chr_drv/chr_drv.a(serial.o)
+ .debug_line 0x0000000000003eb2 0x1db kernel/chr_drv/chr_drv.a(tty_ioctl.o)
+ .debug_line 0x000000000000408d 0xe1 kernel/math/math.a(math_emulate.o)
+ .debug_line 0x000000000000416e 0x28 lib/lib.a(ctype.o)
+ .debug_line 0x0000000000004196 0x39 lib/lib.a(_exit.o)
+ .debug_line 0x00000000000041cf 0x62 lib/lib.a(open.o)
+ .debug_line 0x0000000000004231 0x5c lib/lib.a(close.o)
+ .debug_line 0x000000000000428d 0x28 lib/lib.a(errno.o)
+ .debug_line 0x00000000000042b5 0x76 lib/lib.a(write.o)
+ .debug_line 0x000000000000432b 0x5a lib/lib.a(dup.o)
+ .debug_line 0x0000000000004385 0x77 lib/lib.a(setsid.o)
+ .debug_line 0x00000000000043fc 0x5d lib/lib.a(execve.o)
+ .debug_line 0x0000000000004459 0x7a lib/lib.a(wait.o)
+ .debug_line 0x00000000000044d3 0xc6 lib/lib.a(string.o)
+
+.debug_frame
+ *(.debug_frame)
+
+.debug_str 0x0000000000000000 0x2093
+ *(.debug_str)
+ .debug_str 0x0000000000000000 0x1c0 init/main.o
+ 0x1ff (size before relaxing)
+ .debug_str 0x00000000000001c0 0xac0 kernel/kernel.o
+ 0x2332 (size before relaxing)
+ .debug_str 0x0000000000000c80 0x185 mm/mm.o
+ 0x4e0 (size before relaxing)
+ .debug_str 0x0000000000000e05 0x904 fs/fs.o
+ 0x49ab (size before relaxing)
+ .debug_str 0x0000000000001709 0xf0 kernel/blk_drv/blk_drv.a(ll_rw_blk.o)
+ 0x491 (size before relaxing)
+ .debug_str 0x00000000000017f9 0x1cf kernel/blk_drv/blk_drv.a(floppy.o)
+ 0x673 (size before relaxing)
+ .debug_str 0x00000000000019c8 0x15e kernel/blk_drv/blk_drv.a(hd.o)
+ 0x5e8 (size before relaxing)
+ .debug_str 0x0000000000001b26 0x43 kernel/blk_drv/blk_drv.a(ramdisk.o)
+ 0x58a (size before relaxing)
+ .debug_str 0x0000000000001b69 0xfb kernel/chr_drv/chr_drv.a(tty_io.o)
+ 0x4e3 (size before relaxing)
+ .debug_str 0x0000000000001c64 0x1b9 kernel/chr_drv/chr_drv.a(console.o)
+ 0x5b7 (size before relaxing)
+ .debug_str 0x0000000000001e1d 0x1a kernel/chr_drv/chr_drv.a(serial.o)
+ 0x3fc (size before relaxing)
+ .debug_str 0x0000000000001e37 0x8b kernel/chr_drv/chr_drv.a(tty_ioctl.o)
+ 0x4a7 (size before relaxing)
+ .debug_str 0x0000000000001ec2 0x70 kernel/math/math.a(math_emulate.o)
+ 0x392 (size before relaxing)
+ .debug_str 0x0000000000001f32 0x8d lib/lib.a(ctype.o)
+ 0xb6 (size before relaxing)
+ .debug_str 0x0000000000001fbf 0x8 lib/lib.a(_exit.o)
+ 0xe2 (size before relaxing)
+ .debug_str 0x0000000000000000 0x8 lib/lib.a(open.o)
+ 0xf2 (size before relaxing)
+ .debug_str 0x0000000000001fc7 0x8 lib/lib.a(close.o)
+ 0xe4 (size before relaxing)
+ .debug_str 0x0000000000001fcf 0x8 lib/lib.a(errno.o)
+ 0x93 (size before relaxing)
+ .debug_str 0x0000000000000000 0x8 lib/lib.a(write.o)
+ 0xf0 (size before relaxing)
+ .debug_str 0x0000000000001fd7 0x6 lib/lib.a(dup.o)
+ 0xdc (size before relaxing)
+ .debug_str 0x0000000000001fdd 0x9 lib/lib.a(setsid.o)
+ 0xec (size before relaxing)
+ .debug_str 0x0000000000001fe6 0x9 lib/lib.a(execve.o)
+ 0xf5 (size before relaxing)
+ .debug_str 0x0000000000001fef 0x11 lib/lib.a(wait.o)
+ 0x102 (size before relaxing)
+ .debug_str 0x0000000000002000 0x93 lib/lib.a(string.o)
+ 0x147 (size before relaxing)
+
+.debug_loc
+ *(.debug_loc)
+
+.debug_macinfo
+ *(.debug_macinfo)
+
+.debug_weaknames
+ *(.debug_weaknames)
+
+.debug_funcnames
+ *(.debug_funcnames)
+
+.debug_typenames
+ *(.debug_typenames)
+
+.debug_varnames
+ *(.debug_varnames)
+
+.debug_pubtypes
+ *(.debug_pubtypes)
+
+.debug_ranges 0x0000000000000000 0x18
+ *(.debug_ranges)
+ .debug_ranges 0x0000000000000000 0x18 init/main.o
+
+.debug_macro
+ *(.debug_macro)
+
+.gnu.attributes
+ *(.gnu.attributes)
+
+/DISCARD/
+ *(.note.GNU-stack)
+ *(.gnu_debuglink)
+ *(.gnu.lto_*)
+OUTPUT(tools/system elf32-i386)
diff --git a/linux-0.11-lab - 副本/0/linux/boot/bootsect.s b/linux-0.11-lab - 副本/0/linux/boot/bootsect.s
index 711f103..289543c 100644
--- a/linux-0.11-lab - 副本/0/linux/boot/bootsect.s
+++ b/linux-0.11-lab - 副本/0/linux/boot/bootsect.s
@@ -1,260 +1,260 @@
-!
-! SYS_SIZE is the number of clicks (16 bytes) to be loaded.
-! 0x3000 is 0x30000 bytes = 196kB, more than enough for current
-! versions of linux
-!
-SYSSIZE = 0x3000
-!
-! bootsect.s (C) 1991 Linus Torvalds
-!
-! bootsect.s is loaded at 0x7c00 by the bios-startup routines, and moves
-! iself out of the way to address 0x90000, and jumps there.
-!
-! It then loads 'setup' directly after itself (0x90200), and the system
-! at 0x10000, using BIOS interrupts.
-!
-! NOTE! currently system is at most 8*65536 bytes long. This should be no
-! problem, even in the future. I want to keep it simple. This 512 kB
-! kernel size should be enough, especially as this doesn't contain the
-! buffer cache as in minix
-!
-! The loader has been made as simple as possible, and continuos
-! read errors will result in a unbreakable loop. Reboot by hand. It
-! loads pretty fast by getting whole sectors at a time whenever possible.
-
-.globl begtext, begdata, begbss, endtext, enddata, endbss
-.text
-begtext:
-.data
-begdata:
-.bss
-begbss:
-.text
-
-SETUPLEN = 4 ! nr of setup-sectors
-BOOTSEG = 0x07c0 ! original address of boot-sector
-INITSEG = 0x9000 ! we move boot here - out of the way
-SETUPSEG = 0x9020 ! setup starts here
-SYSSEG = 0x1000 ! system loaded at 0x10000 (65536).
-ENDSEG = SYSSEG + SYSSIZE ! where to stop loading
-
-! ROOT_DEV: 0x000 - same type of floppy as boot.
-! 0x301 - first partition on first drive etc
-ROOT_DEV = 0x306
-
-entry start
-start:
- mov ax,#BOOTSEG
- mov ds,ax
- mov ax,#INITSEG
- mov es,ax
- mov cx,#256
- sub si,si
- sub di,di
- rep
- movw
- jmpi go,INITSEG
-go: mov ax,cs
- mov ds,ax
- mov es,ax
-! put stack at 0x9ff00.
- mov ss,ax
- mov sp,#0xFF00 ! arbitrary value >>512
-
-! load the setup-sectors directly after the bootblock.
-! Note that 'es' is already set up.
-
-load_setup:
- mov dx,#0x0000 ! drive 0, head 0
- mov cx,#0x0002 ! sector 2, track 0
- mov bx,#0x0200 ! address = 512, in INITSEG
- mov ax,#0x0200+SETUPLEN ! service 2, nr of sectors
- int 0x13 ! read it
- jnc ok_load_setup ! ok - continue
- mov dx,#0x0000
- mov ax,#0x0000 ! reset the diskette
- int 0x13
- j load_setup
-
-ok_load_setup:
-
-! Get disk drive parameters, specifically nr of sectors/track
-
- mov dl,#0x00
- mov ax,#0x0800 ! AH=8 is get drive parameters
- int 0x13
- mov ch,#0x00
- seg cs
- mov sectors,cx
- mov ax,#INITSEG
- mov es,ax
-
-! Print some inane message
-
- mov ah,#0x03 ! read cursor pos
- xor bh,bh
- int 0x10
-
- mov cx,#24
- 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
-
-! 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, either /dev/PS0 (2,28) or /dev/at0 (2,8), depending
-! on the number of sectors that the BIOS reports currently.
-
- seg cs
- mov ax,root_dev
- cmp ax,#0
- jne root_defined
- seg cs
- mov bx,sectors
- mov ax,#0x0208 ! /dev/ps0 - 1.2Mb
- cmp bx,#15
- je root_defined
- mov ax,#0x021c ! /dev/PS0 - 1.44Mb
- cmp bx,#18
- je root_defined
-undef_root:
- jmp undef_root
-root_defined:
- seg cs
- mov root_dev,ax
-
-! after that (everyting 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 1+SETUPLEN ! sectors read of current track
-head: .word 0 ! current head
-track: .word 0 ! current track
-
-read_it:
- 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
- cmp ax,#ENDSEG ! have we loaded all yet?
- jb ok1_read
- ret
-ok1_read:
- seg cs
- 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
- seg cs
- 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 ax,#0x1000
- mov es,ax
- xor bx,bx
- jmp rp_read
-
-read_track:
- push ax
- push bx
- push cx
- push dx
- mov dx,track
- mov cx,sread
- inc cx
- mov ch,dl
- mov dx,head
- mov dh,dl
- mov dl,#0
- and dx,#0x0100
- mov ah,#2
- int 0x13
- jc bad_rt
- pop dx
- pop cx
- pop bx
- pop ax
- ret
-bad_rt: mov ax,#0
- mov dx,#0
- int 0x13
- pop dx
- pop cx
- pop bx
- pop ax
- jmp read_track
-
-/*
- * 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
- mov al,#0
- outb
- pop dx
- ret
-
-sectors:
- .word 0
-
-msg1:
- .byte 13,10
- .ascii "Loading system ..."
- .byte 13,10,13,10
-
-.org 508
-root_dev:
- .word ROOT_DEV
-boot_flag:
- .word 0xAA55
-
-.text
-endtext:
-.data
-enddata:
-.bss
-endbss:
+!
+! SYS_SIZE is the number of clicks (16 bytes) to be loaded.
+! 0x3000 is 0x30000 bytes = 196kB, more than enough for current
+! versions of linux
+!
+SYSSIZE = 0x3000
+!
+! bootsect.s (C) 1991 Linus Torvalds
+!
+! bootsect.s is loaded at 0x7c00 by the bios-startup routines, and moves
+! iself out of the way to address 0x90000, and jumps there.
+!
+! It then loads 'setup' directly after itself (0x90200), and the system
+! at 0x10000, using BIOS interrupts.
+!
+! NOTE! currently system is at most 8*65536 bytes long. This should be no
+! problem, even in the future. I want to keep it simple. This 512 kB
+! kernel size should be enough, especially as this doesn't contain the
+! buffer cache as in minix
+!
+! The loader has been made as simple as possible, and continuos
+! read errors will result in a unbreakable loop. Reboot by hand. It
+! loads pretty fast by getting whole sectors at a time whenever possible.
+
+.globl begtext, begdata, begbss, endtext, enddata, endbss
+.text
+begtext:
+.data
+begdata:
+.bss
+begbss:
+.text
+
+SETUPLEN = 4 ! nr of setup-sectors
+BOOTSEG = 0x07c0 ! original address of boot-sector
+INITSEG = 0x9000 ! we move boot here - out of the way
+SETUPSEG = 0x9020 ! setup starts here
+SYSSEG = 0x1000 ! system loaded at 0x10000 (65536).
+ENDSEG = SYSSEG + SYSSIZE ! where to stop loading
+
+! ROOT_DEV: 0x000 - same type of floppy as boot.
+! 0x301 - first partition on first drive etc
+ROOT_DEV = 0x306
+
+entry start
+start:
+ mov ax,#BOOTSEG
+ mov ds,ax
+ mov ax,#INITSEG
+ mov es,ax
+ mov cx,#256
+ sub si,si
+ sub di,di
+ rep
+ movw
+ jmpi go,INITSEG
+go: mov ax,cs
+ mov ds,ax
+ mov es,ax
+! put stack at 0x9ff00.
+ mov ss,ax
+ mov sp,#0xFF00 ! arbitrary value >>512
+
+! load the setup-sectors directly after the bootblock.
+! Note that 'es' is already set up.
+
+load_setup:
+ mov dx,#0x0000 ! drive 0, head 0
+ mov cx,#0x0002 ! sector 2, track 0
+ mov bx,#0x0200 ! address = 512, in INITSEG
+ mov ax,#0x0200+SETUPLEN ! service 2, nr of sectors
+ int 0x13 ! read it
+ jnc ok_load_setup ! ok - continue
+ mov dx,#0x0000
+ mov ax,#0x0000 ! reset the diskette
+ int 0x13
+ j load_setup
+
+ok_load_setup:
+
+! Get disk drive parameters, specifically nr of sectors/track
+
+ mov dl,#0x00
+ mov ax,#0x0800 ! AH=8 is get drive parameters
+ int 0x13
+ mov ch,#0x00
+ seg cs
+ mov sectors,cx
+ mov ax,#INITSEG
+ mov es,ax
+
+! Print some inane message
+
+ mov ah,#0x03 ! read cursor pos
+ xor bh,bh
+ int 0x10
+
+ mov cx,#24
+ 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
+
+! 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, either /dev/PS0 (2,28) or /dev/at0 (2,8), depending
+! on the number of sectors that the BIOS reports currently.
+
+ seg cs
+ mov ax,root_dev
+ cmp ax,#0
+ jne root_defined
+ seg cs
+ mov bx,sectors
+ mov ax,#0x0208 ! /dev/ps0 - 1.2Mb
+ cmp bx,#15
+ je root_defined
+ mov ax,#0x021c ! /dev/PS0 - 1.44Mb
+ cmp bx,#18
+ je root_defined
+undef_root:
+ jmp undef_root
+root_defined:
+ seg cs
+ mov root_dev,ax
+
+! after that (everyting 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 1+SETUPLEN ! sectors read of current track
+head: .word 0 ! current head
+track: .word 0 ! current track
+
+read_it:
+ 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
+ cmp ax,#ENDSEG ! have we loaded all yet?
+ jb ok1_read
+ ret
+ok1_read:
+ seg cs
+ 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
+ seg cs
+ 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 ax,#0x1000
+ mov es,ax
+ xor bx,bx
+ jmp rp_read
+
+read_track:
+ push ax
+ push bx
+ push cx
+ push dx
+ mov dx,track
+ mov cx,sread
+ inc cx
+ mov ch,dl
+ mov dx,head
+ mov dh,dl
+ mov dl,#0
+ and dx,#0x0100
+ mov ah,#2
+ int 0x13
+ jc bad_rt
+ pop dx
+ pop cx
+ pop bx
+ pop ax
+ ret
+bad_rt: mov ax,#0
+ mov dx,#0
+ int 0x13
+ pop dx
+ pop cx
+ pop bx
+ pop ax
+ jmp read_track
+
+/*
+ * 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
+ mov al,#0
+ outb
+ pop dx
+ ret
+
+sectors:
+ .word 0
+
+msg1:
+ .byte 13,10
+ .ascii "Loading system ..."
+ .byte 13,10,13,10
+
+.org 508
+root_dev:
+ .word ROOT_DEV
+boot_flag:
+ .word 0xAA55
+
+.text
+endtext:
+.data
+enddata:
+.bss
+endbss:
diff --git a/linux-0.11-lab - 副本/0/linux/boot/head.s b/linux-0.11-lab - 副本/0/linux/boot/head.s
index 651e95c..823e040 100644
--- a/linux-0.11-lab - 副本/0/linux/boot/head.s
+++ b/linux-0.11-lab - 副本/0/linux/boot/head.s
@@ -1,240 +1,240 @@
-/*
- * linux/boot/head.s
- *
- * (C) 1991 Linus Torvalds
- */
-
-/*
- * head.s contains the 32-bit startup code.
- *
- * NOTE!!! Startup happens at absolute address 0x00000000, which is also where
- * the page directory will exist. The startup code will be overwritten by
- * the page directory.
- */
-.text
-.globl idt,gdt,pg_dir,tmp_floppy_area
-pg_dir:
-.globl startup_32
-startup_32:
- movl $0x10,%eax
- mov %ax,%ds
- mov %ax,%es
- mov %ax,%fs
- mov %ax,%gs
- lss stack_start,%esp
- call setup_idt
- call setup_gdt
- movl $0x10,%eax # reload all the segment registers
- mov %ax,%ds # after changing gdt. CS was already
- mov %ax,%es # reloaded in 'setup_gdt'
- mov %ax,%fs
- mov %ax,%gs
- lss stack_start,%esp
- 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
-/*
- * NOTE! 486 should set bit 16, to check for write-protect in supervisor
- * mode. Then it would be unnecessary with the "verify_area()"-calls.
- * 486 users probably want to set the NE (#5) bit also, so as to use
- * int 16 for math errors.
- */
- movl %cr0,%eax # check math chip
- andl $0x80000011,%eax # Save PG,PE,ET
-/* "orl $0x10020,%eax" here for 486 might be good */
- orl $2,%eax # set MP
- movl %eax,%cr0
- call check_x87
- jmp after_page_tables
-
-/*
- * We depend on ET to be correct. This checks for 287/387.
- */
-check_x87:
- fninit
- fstsw %ax
- cmpb $0,%al
- je 1f /* no coprocessor: have to set bits */
- movl %cr0,%eax
- xorl $6,%eax /* reset MP, set EM */
- movl %eax,%cr0
- ret
-.align 4
-1: .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 then loads
- * idt. Everything that wants to install itself
- * in the idt-table may do so themselves. Interrupts
- * are enabled elsewhere, when we can be relatively
- * sure everything is ok. This routine will be over-
- * written by the page tables.
- */
-setup_idt:
- lea ignore_int,%edx
- movl $0x00080000,%eax
- movw %dx,%ax /* selector = 0x0008 = 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
- lidt idt_descr
- ret
-
-/*
- * setup_gdt
- *
- * This routines sets up a new gdt and loads it.
- * Only two entries are currently built, the same
- * ones that were built in init.s. The routine
- * is VERY complicated at two whole lines, so this
- * rather long comment is certainly needed :-).
- * This routine will beoverwritten by the page tables.
- */
-setup_gdt:
- lgdt gdt_descr
- ret
-
-/*
- * I put the kernel page tables right after the page directory,
- * using 4 of them to span 16 Mb of physical memory. People with
- * more than 16MB will have to expand this.
- */
-.org 0x1000
-pg0:
-
-.org 0x2000
-pg1:
-
-.org 0x3000
-pg2:
-
-.org 0x4000
-pg3:
-
-.org 0x5000
-/*
- * tmp_floppy_area is used by the floppy-driver when DMA cannot
- * reach to a buffer-block. It needs to be aligned, so that it isn't
- * on a 64kB border.
- */
-tmp_floppy_area:
- .fill 1024,1,0
-
-after_page_tables:
- pushl $0 # These are the parameters to main :-)
- pushl $0
- pushl $0
- pushl $L6 # return address for main, if it decides to.
- pushl $main
- jmp setup_paging
-L6:
- jmp L6 # main should never return here, but
- # just in case, we know what happens.
-
-/* This is the default interrupt "handler" :-) */
-int_msg:
- .asciz "Unknown interrupt\n\r"
-.align 4
-ignore_int:
- pushl %eax
- pushl %ecx
- pushl %edx
- push %ds
- push %es
- push %fs
- movl $0x10,%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
-
-
-/*
- * Setup_paging
- *
- * This routine sets up paging by setting the page bit
- * in cr0. The page tables are set up, identity-mapping
- * the first 16MB. The pager assumes that no illegal
- * addresses are produced (ie >4Mb on a 4Mb machine).
- *
- * NOTE! Although all physical memory should be identity
- * mapped by this routine, only the kernel page functions
- * use the >1Mb addresses directly. All "normal" functions
- * use just the lower 1Mb, or the local data space, which
- * will be mapped to some other place - mm keeps track of
- * that.
- *
- * For those with more memory than 16 Mb - tough luck. I've
- * not got it, why should you :-) The source is here. Change
- * it. (Seriously - it shouldn't be too difficult. Mostly
- * change some constants etc. I left it at 16Mb, as my machine
- * even cannot be extended past that (ok, but it was cheap :-)
- * I've tried to show which constants to change by having
- * some kind of marker at them (search for "16Mb"), but I
- * won't guarantee that's all :-( )
- */
-.align 4
-setup_paging:
- movl $1024*5,%ecx /* 5 pages - pg_dir+4 page tables */
- xorl %eax,%eax
- xorl %edi,%edi /* pg_dir is at 0x000 */
- cld;rep;stosl
- movl $pg0+7,pg_dir /* set present bit/user r/w */
- movl $pg1+7,pg_dir+4 /* --------- " " --------- */
- movl $pg2+7,pg_dir+8 /* --------- " " --------- */
- movl $pg3+7,pg_dir+12 /* --------- " " --------- */
- movl $pg3+4092,%edi
- movl $0xfff007,%eax /* 16Mb - 4096 + 7 (r/w user,p) */
- std
-1: stosl /* fill pages backwards - more efficient :-) */
- subl $0x1000,%eax
- jge 1b
- xorl %eax,%eax /* pg_dir is at 0x0000 */
- movl %eax,%cr3 /* cr3 - page directory start */
- movl %cr0,%eax
- orl $0x80000000,%eax
- movl %eax,%cr0 /* set paging (PG) bit */
- cld /* by wyj */
- ret /* this also flushes prefetch-queue */
-
-.align 4
-.word 0
-idt_descr:
- .word 256*8-1 # idt contains 256 entries
- .long idt
-.align 4
-.word 0
-gdt_descr:
- .word 256*8-1 # so does gdt (not that that's any
- .long gdt # magic number, but it works for me :^)
-
- .align 8
-idt: .fill 256,8,0 # idt is uninitialized
-
-gdt: .quad 0x0000000000000000 /* NULL descriptor */
- .quad 0x00c09a0000000fff /* 16Mb */
- .quad 0x00c0920000000fff /* 16Mb */
- .quad 0x0000000000000000 /* TEMPORARY - don't use */
- .fill 252,8,0 /* space for LDT's and TSS's etc */
+/*
+ * linux/boot/head.s
+ *
+ * (C) 1991 Linus Torvalds
+ */
+
+/*
+ * head.s contains the 32-bit startup code.
+ *
+ * NOTE!!! Startup happens at absolute address 0x00000000, which is also where
+ * the page directory will exist. The startup code will be overwritten by
+ * the page directory.
+ */
+.text
+.globl idt,gdt,pg_dir,tmp_floppy_area
+pg_dir:
+.globl startup_32
+startup_32:
+ movl $0x10,%eax
+ mov %ax,%ds
+ mov %ax,%es
+ mov %ax,%fs
+ mov %ax,%gs
+ lss stack_start,%esp
+ call setup_idt
+ call setup_gdt
+ movl $0x10,%eax # reload all the segment registers
+ mov %ax,%ds # after changing gdt. CS was already
+ mov %ax,%es # reloaded in 'setup_gdt'
+ mov %ax,%fs
+ mov %ax,%gs
+ lss stack_start,%esp
+ 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
+/*
+ * NOTE! 486 should set bit 16, to check for write-protect in supervisor
+ * mode. Then it would be unnecessary with the "verify_area()"-calls.
+ * 486 users probably want to set the NE (#5) bit also, so as to use
+ * int 16 for math errors.
+ */
+ movl %cr0,%eax # check math chip
+ andl $0x80000011,%eax # Save PG,PE,ET
+/* "orl $0x10020,%eax" here for 486 might be good */
+ orl $2,%eax # set MP
+ movl %eax,%cr0
+ call check_x87
+ jmp after_page_tables
+
+/*
+ * We depend on ET to be correct. This checks for 287/387.
+ */
+check_x87:
+ fninit
+ fstsw %ax
+ cmpb $0,%al
+ je 1f /* no coprocessor: have to set bits */
+ movl %cr0,%eax
+ xorl $6,%eax /* reset MP, set EM */
+ movl %eax,%cr0
+ ret
+.align 4
+1: .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 then loads
+ * idt. Everything that wants to install itself
+ * in the idt-table may do so themselves. Interrupts
+ * are enabled elsewhere, when we can be relatively
+ * sure everything is ok. This routine will be over-
+ * written by the page tables.
+ */
+setup_idt:
+ lea ignore_int,%edx
+ movl $0x00080000,%eax
+ movw %dx,%ax /* selector = 0x0008 = 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
+ lidt idt_descr
+ ret
+
+/*
+ * setup_gdt
+ *
+ * This routines sets up a new gdt and loads it.
+ * Only two entries are currently built, the same
+ * ones that were built in init.s. The routine
+ * is VERY complicated at two whole lines, so this
+ * rather long comment is certainly needed :-).
+ * This routine will beoverwritten by the page tables.
+ */
+setup_gdt:
+ lgdt gdt_descr
+ ret
+
+/*
+ * I put the kernel page tables right after the page directory,
+ * using 4 of them to span 16 Mb of physical memory. People with
+ * more than 16MB will have to expand this.
+ */
+.org 0x1000
+pg0:
+
+.org 0x2000
+pg1:
+
+.org 0x3000
+pg2:
+
+.org 0x4000
+pg3:
+
+.org 0x5000
+/*
+ * tmp_floppy_area is used by the floppy-driver when DMA cannot
+ * reach to a buffer-block. It needs to be aligned, so that it isn't
+ * on a 64kB border.
+ */
+tmp_floppy_area:
+ .fill 1024,1,0
+
+after_page_tables:
+ pushl $0 # These are the parameters to main :-)
+ pushl $0
+ pushl $0
+ pushl $L6 # return address for main, if it decides to.
+ pushl $main
+ jmp setup_paging
+L6:
+ jmp L6 # main should never return here, but
+ # just in case, we know what happens.
+
+/* This is the default interrupt "handler" :-) */
+int_msg:
+ .asciz "Unknown interrupt\n\r"
+.align 4
+ignore_int:
+ pushl %eax
+ pushl %ecx
+ pushl %edx
+ push %ds
+ push %es
+ push %fs
+ movl $0x10,%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
+
+
+/*
+ * Setup_paging
+ *
+ * This routine sets up paging by setting the page bit
+ * in cr0. The page tables are set up, identity-mapping
+ * the first 16MB. The pager assumes that no illegal
+ * addresses are produced (ie >4Mb on a 4Mb machine).
+ *
+ * NOTE! Although all physical memory should be identity
+ * mapped by this routine, only the kernel page functions
+ * use the >1Mb addresses directly. All "normal" functions
+ * use just the lower 1Mb, or the local data space, which
+ * will be mapped to some other place - mm keeps track of
+ * that.
+ *
+ * For those with more memory than 16 Mb - tough luck. I've
+ * not got it, why should you :-) The source is here. Change
+ * it. (Seriously - it shouldn't be too difficult. Mostly
+ * change some constants etc. I left it at 16Mb, as my machine
+ * even cannot be extended past that (ok, but it was cheap :-)
+ * I've tried to show which constants to change by having
+ * some kind of marker at them (search for "16Mb"), but I
+ * won't guarantee that's all :-( )
+ */
+.align 4
+setup_paging:
+ movl $1024*5,%ecx /* 5 pages - pg_dir+4 page tables */
+ xorl %eax,%eax
+ xorl %edi,%edi /* pg_dir is at 0x000 */
+ cld;rep;stosl
+ movl $pg0+7,pg_dir /* set present bit/user r/w */
+ movl $pg1+7,pg_dir+4 /* --------- " " --------- */
+ movl $pg2+7,pg_dir+8 /* --------- " " --------- */
+ movl $pg3+7,pg_dir+12 /* --------- " " --------- */
+ movl $pg3+4092,%edi
+ movl $0xfff007,%eax /* 16Mb - 4096 + 7 (r/w user,p) */
+ std
+1: stosl /* fill pages backwards - more efficient :-) */
+ subl $0x1000,%eax
+ jge 1b
+ xorl %eax,%eax /* pg_dir is at 0x0000 */
+ movl %eax,%cr3 /* cr3 - page directory start */
+ movl %cr0,%eax
+ orl $0x80000000,%eax
+ movl %eax,%cr0 /* set paging (PG) bit */
+ cld /* by wyj */
+ ret /* this also flushes prefetch-queue */
+
+.align 4
+.word 0
+idt_descr:
+ .word 256*8-1 # idt contains 256 entries
+ .long idt
+.align 4
+.word 0
+gdt_descr:
+ .word 256*8-1 # so does gdt (not that that's any
+ .long gdt # magic number, but it works for me :^)
+
+ .align 8
+idt: .fill 256,8,0 # idt is uninitialized
+
+gdt: .quad 0x0000000000000000 /* NULL descriptor */
+ .quad 0x00c09a0000000fff /* 16Mb */
+ .quad 0x00c0920000000fff /* 16Mb */
+ .quad 0x0000000000000000 /* TEMPORARY - don't use */
+ .fill 252,8,0 /* space for LDT's and TSS's etc */
diff --git a/linux-0.11-lab - 副本/0/linux/boot/setup.s b/linux-0.11-lab - 副本/0/linux/boot/setup.s
index 2329d00..7e4b630 100644
--- a/linux-0.11-lab - 副本/0/linux/boot/setup.s
+++ b/linux-0.11-lab - 副本/0/linux/boot/setup.s
@@ -1,231 +1,231 @@
-!
-! setup.s (C) 1991 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.
-!
-
-! NOTE! These had better be the same as in bootsect.s!
-
-INITSEG = 0x9000 ! we move boot here - out of the way
-SYSSEG = 0x1000 ! system loaded at 0x10000 (65536).
-SETUPSEG = 0x9020 ! this is the current segment
-
-.globl begtext, begdata, begbss, endtext, enddata, endbss
-.text
-begtext:
-.data
-begdata:
-.bss
-begbss:
-.text
-
-entry start
-start:
-
-! ok, the read went well so we get current cursor position and save it for
-! posterity.
-
- mov ax,#INITSEG ! this is done in bootsect already, but...
- mov ds,ax
- mov ah,#0x03 ! read cursor pos
- xor bh,bh
- int 0x10 ! save it in known place, con_init fetches
- mov [0],dx ! it from 0x90000.
-
-! Get memory size (extended mem, kB)
-
- mov ah,#0x88
- int 0x15
- mov [2],ax
-
-! Get video-card data:
-
- mov ah,#0x0f
- int 0x10
- mov [4],bx ! bh = display page
- mov [6],ax ! al = video mode, ah = window width
-
-! 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
-
-! Get hd0 data
-
- mov ax,#0x0000
- mov ds,ax
- lds si,[4*0x41]
- mov ax,#INITSEG
- mov es,ax
- mov di,#0x0080
- mov cx,#0x10
- rep
- movsb
-
-! Get hd1 data
-
- mov ax,#0x0000
- mov ds,ax
- lds si,[4*0x46]
- mov ax,#INITSEG
- mov es,ax
- mov di,#0x0090
- mov cx,#0x10
- 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
- mov ax,#0x00
- rep
- stosb
-is_disk1:
-
-! now we want to move to protected mode ...
-
- cli ! no interrupts allowed !
-
-! first we move the system to it's rightful place
-
- mov ax,#0x0000
- cld ! 'direction'=0, movs moves forward
-do_move:
- mov es,ax ! destination segment
- add ax,#0x1000
- cmp ax,#0x9000
- jz end_move
- mov ds,ax ! source segment
- sub di,di
- sub si,si
- mov cx,#0x8000
- 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
-
-! 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
- .word 0x00eb,0x00eb ! jmp $+2, jmp $+2
- out #0xA0,al ! and to 8259A-2
- .word 0x00eb,0x00eb
- mov al,#0x20 ! start of hardware int's (0x20)
- out #0x21,al
- .word 0x00eb,0x00eb
- mov al,#0x28 ! start of hardware int's 2 (0x28)
- out #0xA1,al
- .word 0x00eb,0x00eb
- mov al,#0x04 ! 8259-1 is master
- out #0x21,al
- .word 0x00eb,0x00eb
- mov al,#0x02 ! 8259-2 is slave
- out #0xA1,al
- .word 0x00eb,0x00eb
- mov al,#0x01 ! 8086 mode for both
- out #0x21,al
- .word 0x00eb,0x00eb
- out #0xA1,al
- .word 0x00eb,0x00eb
- mov al,#0xFF ! mask off all interrupts for now
- out #0x21,al
- .word 0x00eb,0x00eb
- out #0xA1,al
-
-! 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.
-
- mov ax,#0x0001 ! protected mode (PE) bit
- lmsw ax ! This is it!
- jmpi 0,8 ! jmp offset 0 of segment 8 (cs)
-
-! This routine checks that the keyboard command queue is empty
-! No timeout is used - if this hangs there is something wrong with
-! the machine, and we probably couldn't proceed anyway.
-empty_8042:
- .word 0x00eb,0x00eb
- in al,#0x64 ! 8042 status port
- test al,#2 ! is input buffer full?
- jnz empty_8042 ! yes - loop
- ret
-
-gdt:
- .word 0,0,0,0 ! dummy
-
- .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
-
-.text
-endtext:
-.data
-enddata:
-.bss
-endbss:
+!
+! setup.s (C) 1991 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.
+!
+
+! NOTE! These had better be the same as in bootsect.s!
+
+INITSEG = 0x9000 ! we move boot here - out of the way
+SYSSEG = 0x1000 ! system loaded at 0x10000 (65536).
+SETUPSEG = 0x9020 ! this is the current segment
+
+.globl begtext, begdata, begbss, endtext, enddata, endbss
+.text
+begtext:
+.data
+begdata:
+.bss
+begbss:
+.text
+
+entry start
+start:
+
+! ok, the read went well so we get current cursor position and save it for
+! posterity.
+
+ mov ax,#INITSEG ! this is done in bootsect already, but...
+ mov ds,ax
+ mov ah,#0x03 ! read cursor pos
+ xor bh,bh
+ int 0x10 ! save it in known place, con_init fetches
+ mov [0],dx ! it from 0x90000.
+
+! Get memory size (extended mem, kB)
+
+ mov ah,#0x88
+ int 0x15
+ mov [2],ax
+
+! Get video-card data:
+
+ mov ah,#0x0f
+ int 0x10
+ mov [4],bx ! bh = display page
+ mov [6],ax ! al = video mode, ah = window width
+
+! 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
+
+! Get hd0 data
+
+ mov ax,#0x0000
+ mov ds,ax
+ lds si,[4*0x41]
+ mov ax,#INITSEG
+ mov es,ax
+ mov di,#0x0080
+ mov cx,#0x10
+ rep
+ movsb
+
+! Get hd1 data
+
+ mov ax,#0x0000
+ mov ds,ax
+ lds si,[4*0x46]
+ mov ax,#INITSEG
+ mov es,ax
+ mov di,#0x0090
+ mov cx,#0x10
+ 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
+ mov ax,#0x00
+ rep
+ stosb
+is_disk1:
+
+! now we want to move to protected mode ...
+
+ cli ! no interrupts allowed !
+
+! first we move the system to it's rightful place
+
+ mov ax,#0x0000
+ cld ! 'direction'=0, movs moves forward
+do_move:
+ mov es,ax ! destination segment
+ add ax,#0x1000
+ cmp ax,#0x9000
+ jz end_move
+ mov ds,ax ! source segment
+ sub di,di
+ sub si,si
+ mov cx,#0x8000
+ 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
+
+! 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
+ .word 0x00eb,0x00eb ! jmp $+2, jmp $+2
+ out #0xA0,al ! and to 8259A-2
+ .word 0x00eb,0x00eb
+ mov al,#0x20 ! start of hardware int's (0x20)
+ out #0x21,al
+ .word 0x00eb,0x00eb
+ mov al,#0x28 ! start of hardware int's 2 (0x28)
+ out #0xA1,al
+ .word 0x00eb,0x00eb
+ mov al,#0x04 ! 8259-1 is master
+ out #0x21,al
+ .word 0x00eb,0x00eb
+ mov al,#0x02 ! 8259-2 is slave
+ out #0xA1,al
+ .word 0x00eb,0x00eb
+ mov al,#0x01 ! 8086 mode for both
+ out #0x21,al
+ .word 0x00eb,0x00eb
+ out #0xA1,al
+ .word 0x00eb,0x00eb
+ mov al,#0xFF ! mask off all interrupts for now
+ out #0x21,al
+ .word 0x00eb,0x00eb
+ out #0xA1,al
+
+! 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.
+
+ mov ax,#0x0001 ! protected mode (PE) bit
+ lmsw ax ! This is it!
+ jmpi 0,8 ! jmp offset 0 of segment 8 (cs)
+
+! This routine checks that the keyboard command queue is empty
+! No timeout is used - if this hangs there is something wrong with
+! the machine, and we probably couldn't proceed anyway.
+empty_8042:
+ .word 0x00eb,0x00eb
+ in al,#0x64 ! 8042 status port
+ test al,#2 ! is input buffer full?
+ jnz empty_8042 ! yes - loop
+ ret
+
+gdt:
+ .word 0,0,0,0 ! dummy
+
+ .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
+
+.text
+endtext:
+.data
+enddata:
+.bss
+endbss:
diff --git a/linux-0.11-lab - 副本/0/linux/fs/Makefile b/linux-0.11-lab - 副本/0/linux/fs/Makefile
index 970acd4..611b96d 100644
--- a/linux-0.11-lab - 副本/0/linux/fs/Makefile
+++ b/linux-0.11-lab - 副本/0/linux/fs/Makefile
@@ -1,101 +1,101 @@
-AR =ar
-AS =as
-LD =ld
-LDFLAGS =-s -x
-CC =gcc -march=i386
-CFLAGS =-w -g -fstrength-reduce -fomit-frame-pointer -mcld \
- -finline-functions -nostdinc -fno-stack-protector -I../include
-CPP =gcc -E -nostdinc -I../include
-
-.c.s:
- $(CC) $(CFLAGS) \
- -S -o $*.s $<
-.c.o:
- $(CC) $(CFLAGS) \
- -c -o $*.o $<
-.s.o:
- $(AS) -o $*.o $<
-
-OBJS= open.o read_write.o inode.o file_table.o buffer.o super.o \
- block_dev.o char_dev.o file_dev.o stat.o exec.o pipe.o namei.o \
- bitmap.o fcntl.o ioctl.o truncate.o select.o
-
-fs.o: $(OBJS)
- $(LD) -r -o fs.o $(OBJS)
-
-clean:
- rm -f core *.o *.a tmp_make
- for i in *.c;do rm -f `basename $$i .c`.s;done
-
-dep:
- sed '/\#\#\# Dependencies/q' < Makefile > tmp_make
- (for i in *.c;do $(CPP) -M $$i;done) >> tmp_make
- cp tmp_make Makefile
-
-### Dependencies:
-bitmap.o : bitmap.c ../include/string.h ../include/linux/sched.h \
- ../include/linux/head.h ../include/linux/fs.h ../include/sys/types.h \
- ../include/linux/mm.h ../include/signal.h ../include/linux/kernel.h
-block_dev.o : block_dev.c ../include/errno.h ../include/linux/sched.h \
- ../include/linux/head.h ../include/linux/fs.h ../include/sys/types.h \
- ../include/linux/mm.h ../include/signal.h ../include/linux/kernel.h \
- ../include/asm/segment.h ../include/asm/system.h
-buffer.o : buffer.c ../include/stdarg.h ../include/linux/config.h \
- ../include/linux/sched.h ../include/linux/head.h ../include/linux/fs.h \
- ../include/sys/types.h ../include/linux/mm.h ../include/signal.h \
- ../include/linux/kernel.h ../include/asm/system.h ../include/asm/io.h
-char_dev.o : char_dev.c ../include/errno.h ../include/sys/types.h \
- ../include/linux/sched.h ../include/linux/head.h ../include/linux/fs.h \
- ../include/linux/mm.h ../include/signal.h ../include/linux/kernel.h \
- ../include/asm/segment.h ../include/asm/io.h
-exec.o : exec.c ../include/errno.h ../include/string.h \
- ../include/sys/stat.h ../include/sys/types.h ../include/a.out.h \
- ../include/linux/fs.h ../include/linux/sched.h ../include/linux/head.h \
- ../include/linux/mm.h ../include/signal.h ../include/linux/kernel.h \
- ../include/asm/segment.h
-fcntl.o : fcntl.c ../include/string.h ../include/errno.h \
- ../include/linux/sched.h ../include/linux/head.h ../include/linux/fs.h \
- ../include/sys/types.h ../include/linux/mm.h ../include/signal.h \
- ../include/linux/kernel.h ../include/asm/segment.h ../include/fcntl.h \
- ../include/sys/stat.h
-file_dev.o : file_dev.c ../include/errno.h ../include/fcntl.h \
- ../include/sys/types.h ../include/linux/sched.h ../include/linux/head.h \
- ../include/linux/fs.h ../include/linux/mm.h ../include/signal.h \
- ../include/linux/kernel.h ../include/asm/segment.h
-file_table.o : file_table.c ../include/linux/fs.h ../include/sys/types.h
-inode.o : inode.c ../include/string.h ../include/sys/stat.h \
- ../include/sys/types.h ../include/linux/sched.h ../include/linux/head.h \
- ../include/linux/fs.h ../include/linux/mm.h ../include/signal.h \
- ../include/linux/kernel.h ../include/asm/system.h
-ioctl.o : ioctl.c ../include/string.h ../include/errno.h \
- ../include/sys/stat.h ../include/sys/types.h ../include/linux/sched.h \
- ../include/linux/head.h ../include/linux/fs.h ../include/linux/mm.h \
- ../include/signal.h
-namei.o : namei.c ../include/linux/sched.h ../include/linux/head.h \
- ../include/linux/fs.h ../include/sys/types.h ../include/linux/mm.h \
- ../include/signal.h ../include/linux/kernel.h ../include/asm/segment.h \
- ../include/string.h ../include/fcntl.h ../include/errno.h \
- ../include/const.h ../include/sys/stat.h
-open.o : open.c ../include/string.h ../include/errno.h ../include/fcntl.h \
- ../include/sys/types.h ../include/utime.h ../include/sys/stat.h \
- ../include/linux/sched.h ../include/linux/head.h ../include/linux/fs.h \
- ../include/linux/mm.h ../include/signal.h ../include/linux/tty.h \
- ../include/termios.h ../include/linux/kernel.h ../include/asm/segment.h
-pipe.o : pipe.c ../include/signal.h ../include/sys/types.h \
- ../include/linux/sched.h ../include/linux/head.h ../include/linux/fs.h \
- ../include/linux/mm.h ../include/asm/segment.h
-read_write.o : read_write.c ../include/sys/stat.h ../include/sys/types.h \
- ../include/errno.h ../include/linux/kernel.h ../include/linux/sched.h \
- ../include/linux/head.h ../include/linux/fs.h ../include/linux/mm.h \
- ../include/signal.h ../include/asm/segment.h
-stat.o : stat.c ../include/errno.h ../include/sys/stat.h \
- ../include/sys/types.h ../include/linux/fs.h ../include/linux/sched.h \
- ../include/linux/head.h ../include/linux/mm.h ../include/signal.h \
- ../include/linux/kernel.h ../include/asm/segment.h
-super.o : super.c ../include/linux/config.h ../include/linux/sched.h \
- ../include/linux/head.h ../include/linux/fs.h ../include/sys/types.h \
- ../include/linux/mm.h ../include/signal.h ../include/linux/kernel.h \
- ../include/asm/system.h ../include/errno.h ../include/sys/stat.h
-truncate.o : truncate.c ../include/linux/sched.h ../include/linux/head.h \
- ../include/linux/fs.h ../include/sys/types.h ../include/linux/mm.h \
- ../include/signal.h ../include/sys/stat.h
+AR =ar
+AS =as
+LD =ld
+LDFLAGS =-s -x
+CC =gcc -march=i386
+CFLAGS =-w -g -fstrength-reduce -fomit-frame-pointer -mcld \
+ -finline-functions -nostdinc -fno-stack-protector -I../include
+CPP =gcc -E -nostdinc -I../include
+
+.c.s:
+ $(CC) $(CFLAGS) \
+ -S -o $*.s $<
+.c.o:
+ $(CC) $(CFLAGS) \
+ -c -o $*.o $<
+.s.o:
+ $(AS) -o $*.o $<
+
+OBJS= open.o read_write.o inode.o file_table.o buffer.o super.o \
+ block_dev.o char_dev.o file_dev.o stat.o exec.o pipe.o namei.o \
+ bitmap.o fcntl.o ioctl.o truncate.o select.o
+
+fs.o: $(OBJS)
+ $(LD) -r -o fs.o $(OBJS)
+
+clean:
+ rm -f core *.o *.a tmp_make
+ for i in *.c;do rm -f `basename $$i .c`.s;done
+
+dep:
+ sed '/\#\#\# Dependencies/q' < Makefile > tmp_make
+ (for i in *.c;do $(CPP) -M $$i;done) >> tmp_make
+ cp tmp_make Makefile
+
+### Dependencies:
+bitmap.o : bitmap.c ../include/string.h ../include/linux/sched.h \
+ ../include/linux/head.h ../include/linux/fs.h ../include/sys/types.h \
+ ../include/linux/mm.h ../include/signal.h ../include/linux/kernel.h
+block_dev.o : block_dev.c ../include/errno.h ../include/linux/sched.h \
+ ../include/linux/head.h ../include/linux/fs.h ../include/sys/types.h \
+ ../include/linux/mm.h ../include/signal.h ../include/linux/kernel.h \
+ ../include/asm/segment.h ../include/asm/system.h
+buffer.o : buffer.c ../include/stdarg.h ../include/linux/config.h \
+ ../include/linux/sched.h ../include/linux/head.h ../include/linux/fs.h \
+ ../include/sys/types.h ../include/linux/mm.h ../include/signal.h \
+ ../include/linux/kernel.h ../include/asm/system.h ../include/asm/io.h
+char_dev.o : char_dev.c ../include/errno.h ../include/sys/types.h \
+ ../include/linux/sched.h ../include/linux/head.h ../include/linux/fs.h \
+ ../include/linux/mm.h ../include/signal.h ../include/linux/kernel.h \
+ ../include/asm/segment.h ../include/asm/io.h
+exec.o : exec.c ../include/errno.h ../include/string.h \
+ ../include/sys/stat.h ../include/sys/types.h ../include/a.out.h \
+ ../include/linux/fs.h ../include/linux/sched.h ../include/linux/head.h \
+ ../include/linux/mm.h ../include/signal.h ../include/linux/kernel.h \
+ ../include/asm/segment.h
+fcntl.o : fcntl.c ../include/string.h ../include/errno.h \
+ ../include/linux/sched.h ../include/linux/head.h ../include/linux/fs.h \
+ ../include/sys/types.h ../include/linux/mm.h ../include/signal.h \
+ ../include/linux/kernel.h ../include/asm/segment.h ../include/fcntl.h \
+ ../include/sys/stat.h
+file_dev.o : file_dev.c ../include/errno.h ../include/fcntl.h \
+ ../include/sys/types.h ../include/linux/sched.h ../include/linux/head.h \
+ ../include/linux/fs.h ../include/linux/mm.h ../include/signal.h \
+ ../include/linux/kernel.h ../include/asm/segment.h
+file_table.o : file_table.c ../include/linux/fs.h ../include/sys/types.h
+inode.o : inode.c ../include/string.h ../include/sys/stat.h \
+ ../include/sys/types.h ../include/linux/sched.h ../include/linux/head.h \
+ ../include/linux/fs.h ../include/linux/mm.h ../include/signal.h \
+ ../include/linux/kernel.h ../include/asm/system.h
+ioctl.o : ioctl.c ../include/string.h ../include/errno.h \
+ ../include/sys/stat.h ../include/sys/types.h ../include/linux/sched.h \
+ ../include/linux/head.h ../include/linux/fs.h ../include/linux/mm.h \
+ ../include/signal.h
+namei.o : namei.c ../include/linux/sched.h ../include/linux/head.h \
+ ../include/linux/fs.h ../include/sys/types.h ../include/linux/mm.h \
+ ../include/signal.h ../include/linux/kernel.h ../include/asm/segment.h \
+ ../include/string.h ../include/fcntl.h ../include/errno.h \
+ ../include/const.h ../include/sys/stat.h
+open.o : open.c ../include/string.h ../include/errno.h ../include/fcntl.h \
+ ../include/sys/types.h ../include/utime.h ../include/sys/stat.h \
+ ../include/linux/sched.h ../include/linux/head.h ../include/linux/fs.h \
+ ../include/linux/mm.h ../include/signal.h ../include/linux/tty.h \
+ ../include/termios.h ../include/linux/kernel.h ../include/asm/segment.h
+pipe.o : pipe.c ../include/signal.h ../include/sys/types.h \
+ ../include/linux/sched.h ../include/linux/head.h ../include/linux/fs.h \
+ ../include/linux/mm.h ../include/asm/segment.h
+read_write.o : read_write.c ../include/sys/stat.h ../include/sys/types.h \
+ ../include/errno.h ../include/linux/kernel.h ../include/linux/sched.h \
+ ../include/linux/head.h ../include/linux/fs.h ../include/linux/mm.h \
+ ../include/signal.h ../include/asm/segment.h
+stat.o : stat.c ../include/errno.h ../include/sys/stat.h \
+ ../include/sys/types.h ../include/linux/fs.h ../include/linux/sched.h \
+ ../include/linux/head.h ../include/linux/mm.h ../include/signal.h \
+ ../include/linux/kernel.h ../include/asm/segment.h
+super.o : super.c ../include/linux/config.h ../include/linux/sched.h \
+ ../include/linux/head.h ../include/linux/fs.h ../include/sys/types.h \
+ ../include/linux/mm.h ../include/signal.h ../include/linux/kernel.h \
+ ../include/asm/system.h ../include/errno.h ../include/sys/stat.h
+truncate.o : truncate.c ../include/linux/sched.h ../include/linux/head.h \
+ ../include/linux/fs.h ../include/sys/types.h ../include/linux/mm.h \
+ ../include/signal.h ../include/sys/stat.h
diff --git a/linux-0.11-lab - 副本/0/linux/fs/bitmap.c b/linux-0.11-lab - 副本/0/linux/fs/bitmap.c
index 73951a8..6fd33e7 100644
--- a/linux-0.11-lab - 副本/0/linux/fs/bitmap.c
+++ b/linux-0.11-lab - 副本/0/linux/fs/bitmap.c
@@ -1,168 +1,168 @@
-/*
- * linux/fs/bitmap.c
- *
- * (C) 1991 Linus Torvalds
- */
-
-/* bitmap.c contains the code that handles the inode and block bitmaps */
-#include
-
-#include
-#include
-
-#define clear_block(addr) \
-__asm__ __volatile__ ("cld\n\t" \
- "rep\n\t" \
- "stosl" \
- ::"a" (0),"c" (BLOCK_SIZE/4),"D" ((long) (addr)))
-
-#define set_bit(nr,addr) ({\
-register int res __asm__("ax"); \
-__asm__ __volatile__("btsl %2,%3\n\tsetb %%al": \
-"=a" (res):"0" (0),"r" (nr),"m" (*(addr))); \
-res;})
-
-#define clear_bit(nr,addr) ({\
-register int res __asm__("ax"); \
-__asm__ __volatile__("btrl %2,%3\n\tsetnb %%al": \
-"=a" (res):"0" (0),"r" (nr),"m" (*(addr))); \
-res;})
-
-#define find_first_zero(addr) ({ \
-int __res; \
-__asm__ __volatile__ ("cld\n" \
- "1:\tlodsl\n\t" \
- "notl %%eax\n\t" \
- "bsfl %%eax,%%edx\n\t" \
- "je 2f\n\t" \
- "addl %%edx,%%ecx\n\t" \
- "jmp 3f\n" \
- "2:\taddl $32,%%ecx\n\t" \
- "cmpl $8192,%%ecx\n\t" \
- "jl 1b\n" \
- "3:" \
- :"=c" (__res):"c" (0),"S" (addr)); \
-__res;})
-
-void free_block(int dev, int block)
-{
- struct super_block * sb;
- struct buffer_head * bh;
-
- if (!(sb = get_super(dev)))
- panic("trying to free block on nonexistent device");
- if (block < sb->s_firstdatazone || block >= sb->s_nzones)
- panic("trying to free block not in datazone");
- bh = get_hash_table(dev,block);
- if (bh) {
- if (bh->b_count != 1) {
- printk("trying to free block (%04x:%d), count=%d\n",
- dev,block,bh->b_count);
- return;
- }
- bh->b_dirt=0;
- bh->b_uptodate=0;
- brelse(bh);
- }
- block -= sb->s_firstdatazone - 1 ;
- if (clear_bit(block&8191,sb->s_zmap[block/8192]->b_data)) {
- printk("block (%04x:%d) ",dev,block+sb->s_firstdatazone-1);
- panic("free_block: bit already cleared");
- }
- sb->s_zmap[block/8192]->b_dirt = 1;
-}
-
-int new_block(int dev)
-{
- struct buffer_head * bh;
- struct super_block * sb;
- int i,j;
-
- if (!(sb = get_super(dev)))
- panic("trying to get new block from nonexistant device");
- j = 8192;
- for (i=0 ; i<8 ; i++)
- if (bh=sb->s_zmap[i])
- if ((j=find_first_zero(bh->b_data))<8192)
- break;
- if (i>=8 || !bh || j>=8192)
- return 0;
- if (set_bit(j,bh->b_data))
- panic("new_block: bit already set");
- bh->b_dirt = 1;
- j += i*8192 + sb->s_firstdatazone-1;
- if (j >= sb->s_nzones)
- return 0;
- if (!(bh=getblk(dev,j)))
- panic("new_block: cannot get block");
- if (bh->b_count != 1)
- panic("new block: count is != 1");
- clear_block(bh->b_data);
- bh->b_uptodate = 1;
- bh->b_dirt = 1;
- brelse(bh);
- return j;
-}
-
-void free_inode(struct m_inode * inode)
-{
- struct super_block * sb;
- struct buffer_head * bh;
-
- if (!inode)
- return;
- if (!inode->i_dev) {
- memset(inode,0,sizeof(*inode));
- return;
- }
- if (inode->i_count>1) {
- printk("trying to free inode with count=%d\n",inode->i_count);
- panic("free_inode");
- }
- if (inode->i_nlinks)
- panic("trying to free inode with links");
- if (!(sb = get_super(inode->i_dev)))
- panic("trying to free inode on nonexistent device");
- if (inode->i_num < 1 || inode->i_num > sb->s_ninodes)
- panic("trying to free inode 0 or nonexistant inode");
- if (!(bh=sb->s_imap[inode->i_num>>13]))
- panic("nonexistent imap in superblock");
- if (clear_bit(inode->i_num&8191,bh->b_data))
- printk("free_inode: bit already cleared.\n\r");
- bh->b_dirt = 1;
- memset(inode,0,sizeof(*inode));
-}
-
-struct m_inode * new_inode(int dev)
-{
- struct m_inode * inode;
- struct super_block * sb;
- struct buffer_head * bh;
- int i,j;
-
- if (!(inode=get_empty_inode()))
- return NULL;
- if (!(sb = get_super(dev)))
- panic("new_inode with unknown device");
- j = 8192;
- for (i=0 ; i<8 ; i++)
- if (bh=sb->s_imap[i])
- if ((j=find_first_zero(bh->b_data))<8192)
- break;
- if (!bh || j >= 8192 || j+i*8192 > sb->s_ninodes) {
- iput(inode);
- return NULL;
- }
- if (set_bit(j,bh->b_data))
- panic("new_inode: bit already set");
- bh->b_dirt = 1;
- inode->i_count=1;
- inode->i_nlinks=1;
- inode->i_dev=dev;
- inode->i_uid=current->euid;
- inode->i_gid=current->egid;
- inode->i_dirt=1;
- inode->i_num = j + i*8192;
- inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
- return inode;
-}
+/*
+ * linux/fs/bitmap.c
+ *
+ * (C) 1991 Linus Torvalds
+ */
+
+/* bitmap.c contains the code that handles the inode and block bitmaps */
+#include
+
+#include
+#include
+
+#define clear_block(addr) \
+__asm__ __volatile__ ("cld\n\t" \
+ "rep\n\t" \
+ "stosl" \
+ ::"a" (0),"c" (BLOCK_SIZE/4),"D" ((long) (addr)))
+
+#define set_bit(nr,addr) ({\
+register int res __asm__("ax"); \
+__asm__ __volatile__("btsl %2,%3\n\tsetb %%al": \
+"=a" (res):"0" (0),"r" (nr),"m" (*(addr))); \
+res;})
+
+#define clear_bit(nr,addr) ({\
+register int res __asm__("ax"); \
+__asm__ __volatile__("btrl %2,%3\n\tsetnb %%al": \
+"=a" (res):"0" (0),"r" (nr),"m" (*(addr))); \
+res;})
+
+#define find_first_zero(addr) ({ \
+int __res; \
+__asm__ __volatile__ ("cld\n" \
+ "1:\tlodsl\n\t" \
+ "notl %%eax\n\t" \
+ "bsfl %%eax,%%edx\n\t" \
+ "je 2f\n\t" \
+ "addl %%edx,%%ecx\n\t" \
+ "jmp 3f\n" \
+ "2:\taddl $32,%%ecx\n\t" \
+ "cmpl $8192,%%ecx\n\t" \
+ "jl 1b\n" \
+ "3:" \
+ :"=c" (__res):"c" (0),"S" (addr)); \
+__res;})
+
+void free_block(int dev, int block)
+{
+ struct super_block * sb;
+ struct buffer_head * bh;
+
+ if (!(sb = get_super(dev)))
+ panic("trying to free block on nonexistent device");
+ if (block < sb->s_firstdatazone || block >= sb->s_nzones)
+ panic("trying to free block not in datazone");
+ bh = get_hash_table(dev,block);
+ if (bh) {
+ if (bh->b_count != 1) {
+ printk("trying to free block (%04x:%d), count=%d\n",
+ dev,block,bh->b_count);
+ return;
+ }
+ bh->b_dirt=0;
+ bh->b_uptodate=0;
+ brelse(bh);
+ }
+ block -= sb->s_firstdatazone - 1 ;
+ if (clear_bit(block&8191,sb->s_zmap[block/8192]->b_data)) {
+ printk("block (%04x:%d) ",dev,block+sb->s_firstdatazone-1);
+ panic("free_block: bit already cleared");
+ }
+ sb->s_zmap[block/8192]->b_dirt = 1;
+}
+
+int new_block(int dev)
+{
+ struct buffer_head * bh;
+ struct super_block * sb;
+ int i,j;
+
+ if (!(sb = get_super(dev)))
+ panic("trying to get new block from nonexistant device");
+ j = 8192;
+ for (i=0 ; i<8 ; i++)
+ if (bh=sb->s_zmap[i])
+ if ((j=find_first_zero(bh->b_data))<8192)
+ break;
+ if (i>=8 || !bh || j>=8192)
+ return 0;
+ if (set_bit(j,bh->b_data))
+ panic("new_block: bit already set");
+ bh->b_dirt = 1;
+ j += i*8192 + sb->s_firstdatazone-1;
+ if (j >= sb->s_nzones)
+ return 0;
+ if (!(bh=getblk(dev,j)))
+ panic("new_block: cannot get block");
+ if (bh->b_count != 1)
+ panic("new block: count is != 1");
+ clear_block(bh->b_data);
+ bh->b_uptodate = 1;
+ bh->b_dirt = 1;
+ brelse(bh);
+ return j;
+}
+
+void free_inode(struct m_inode * inode)
+{
+ struct super_block * sb;
+ struct buffer_head * bh;
+
+ if (!inode)
+ return;
+ if (!inode->i_dev) {
+ memset(inode,0,sizeof(*inode));
+ return;
+ }
+ if (inode->i_count>1) {
+ printk("trying to free inode with count=%d\n",inode->i_count);
+ panic("free_inode");
+ }
+ if (inode->i_nlinks)
+ panic("trying to free inode with links");
+ if (!(sb = get_super(inode->i_dev)))
+ panic("trying to free inode on nonexistent device");
+ if (inode->i_num < 1 || inode->i_num > sb->s_ninodes)
+ panic("trying to free inode 0 or nonexistant inode");
+ if (!(bh=sb->s_imap[inode->i_num>>13]))
+ panic("nonexistent imap in superblock");
+ if (clear_bit(inode->i_num&8191,bh->b_data))
+ printk("free_inode: bit already cleared.\n\r");
+ bh->b_dirt = 1;
+ memset(inode,0,sizeof(*inode));
+}
+
+struct m_inode * new_inode(int dev)
+{
+ struct m_inode * inode;
+ struct super_block * sb;
+ struct buffer_head * bh;
+ int i,j;
+
+ if (!(inode=get_empty_inode()))
+ return NULL;
+ if (!(sb = get_super(dev)))
+ panic("new_inode with unknown device");
+ j = 8192;
+ for (i=0 ; i<8 ; i++)
+ if (bh=sb->s_imap[i])
+ if ((j=find_first_zero(bh->b_data))<8192)
+ break;
+ if (!bh || j >= 8192 || j+i*8192 > sb->s_ninodes) {
+ iput(inode);
+ return NULL;
+ }
+ if (set_bit(j,bh->b_data))
+ panic("new_inode: bit already set");
+ bh->b_dirt = 1;
+ inode->i_count=1;
+ inode->i_nlinks=1;
+ inode->i_dev=dev;
+ inode->i_uid=current->euid;
+ inode->i_gid=current->egid;
+ inode->i_dirt=1;
+ inode->i_num = j + i*8192;
+ inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
+ return inode;
+}
diff --git a/linux-0.11-lab - 副本/0/linux/fs/block_dev.c b/linux-0.11-lab - 副本/0/linux/fs/block_dev.c
index a50ae3f..5af8f40 100644
--- a/linux-0.11-lab - 副本/0/linux/fs/block_dev.c
+++ b/linux-0.11-lab - 副本/0/linux/fs/block_dev.c
@@ -1,73 +1,73 @@
-/*
- * linux/fs/block_dev.c
- *
- * (C) 1991 Linus Torvalds
- */
-
-#include
-
-#include
-#include
-#include
-#include
-
-int block_write(int dev, long * pos, char * buf, int count)
-{
- int block = *pos >> BLOCK_SIZE_BITS;
- int offset = *pos & (BLOCK_SIZE-1);
- int chars;
- int written = 0;
- struct buffer_head * bh;
- register char * p;
-
- while (count>0) {
- chars = BLOCK_SIZE - offset;
- if (chars > count)
- chars=count;
- if (chars == BLOCK_SIZE)
- bh = getblk(dev,block);
- else
- bh = breada(dev,block,block+1,block+2,-1);
- block++;
- if (!bh)
- return written?written:-EIO;
- p = offset + bh->b_data;
- offset = 0;
- *pos += chars;
- written += chars;
- count -= chars;
- while (chars-->0)
- *(p++) = get_fs_byte(buf++);
- bh->b_dirt = 1;
- brelse(bh);
- }
- return written;
-}
-
-int block_read(int dev, unsigned long * pos, char * buf, int count)
-{
- int block = *pos >> BLOCK_SIZE_BITS;
- int offset = *pos & (BLOCK_SIZE-1);
- int chars;
- int read = 0;
- struct buffer_head * bh;
- register char * p;
-
- while (count>0) {
- chars = BLOCK_SIZE-offset;
- if (chars > count)
- chars = count;
- if (!(bh = breada(dev,block,block+1,block+2,-1)))
- return read?read:-EIO;
- block++;
- p = offset + bh->b_data;
- offset = 0;
- *pos += chars;
- read += chars;
- count -= chars;
- while (chars-->0)
- put_fs_byte(*(p++),buf++);
- brelse(bh);
- }
- return read;
-}
+/*
+ * linux/fs/block_dev.c
+ *
+ * (C) 1991 Linus Torvalds
+ */
+
+#include
+
+#include
+#include
+#include
+#include
+
+int block_write(int dev, long * pos, char * buf, int count)
+{
+ int block = *pos >> BLOCK_SIZE_BITS;
+ int offset = *pos & (BLOCK_SIZE-1);
+ int chars;
+ int written = 0;
+ struct buffer_head * bh;
+ register char * p;
+
+ while (count>0) {
+ chars = BLOCK_SIZE - offset;
+ if (chars > count)
+ chars=count;
+ if (chars == BLOCK_SIZE)
+ bh = getblk(dev,block);
+ else
+ bh = breada(dev,block,block+1,block+2,-1);
+ block++;
+ if (!bh)
+ return written?written:-EIO;
+ p = offset + bh->b_data;
+ offset = 0;
+ *pos += chars;
+ written += chars;
+ count -= chars;
+ while (chars-->0)
+ *(p++) = get_fs_byte(buf++);
+ bh->b_dirt = 1;
+ brelse(bh);
+ }
+ return written;
+}
+
+int block_read(int dev, unsigned long * pos, char * buf, int count)
+{
+ int block = *pos >> BLOCK_SIZE_BITS;
+ int offset = *pos & (BLOCK_SIZE-1);
+ int chars;
+ int read = 0;
+ struct buffer_head * bh;
+ register char * p;
+
+ while (count>0) {
+ chars = BLOCK_SIZE-offset;
+ if (chars > count)
+ chars = count;
+ if (!(bh = breada(dev,block,block+1,block+2,-1)))
+ return read?read:-EIO;
+ block++;
+ p = offset + bh->b_data;
+ offset = 0;
+ *pos += chars;
+ read += chars;
+ count -= chars;
+ while (chars-->0)
+ put_fs_byte(*(p++),buf++);
+ brelse(bh);
+ }
+ return read;
+}
diff --git a/linux-0.11-lab - 副本/0/linux/fs/buffer.c b/linux-0.11-lab - 副本/0/linux/fs/buffer.c
index a6643aa..0880b68 100644
--- a/linux-0.11-lab - 副本/0/linux/fs/buffer.c
+++ b/linux-0.11-lab - 副本/0/linux/fs/buffer.c
@@ -1,384 +1,384 @@
-/*
- * linux/fs/buffer.c
- *
- * (C) 1991 Linus Torvalds
- */
-
-/*
- * 'buffer.c' implements the buffer-cache functions. Race-conditions have
- * been avoided by NEVER letting a interrupt change a buffer (except for the
- * data, of course), but instead letting the caller do it. NOTE! As interrupts
- * can wake up a caller, some cli-sti sequences are needed to check for
- * sleep-on-calls. These should be extremely quick, though (I hope).
- */
-
-/*
- * NOTE! There is one discordant note here: checking floppies for
- * disk change. This is where it fits best, I think, as it should
- * invalidate changed floppy-disk-caches.
- */
-
-#include
-
-#include
-#include
-#include
-#include
-#include
-
-extern void put_super(int dev);
-extern void invalidate_inodes(int dev);
-
-extern int end;
-struct buffer_head * start_buffer = (struct buffer_head *) &end;
-struct buffer_head * hash_table[NR_HASH];
-static struct buffer_head * free_list;
-static struct task_struct * buffer_wait = NULL;
-int NR_BUFFERS = 0;
-
-static inline void wait_on_buffer(struct buffer_head * bh)
-{
- cli();
- while (bh->b_lock)
- sleep_on(&bh->b_wait);
- sti();
-}
-
-int sys_sync(void)
-{
- int i;
- struct buffer_head * bh;
-
- sync_inodes(); /* write out inodes into buffers */
- bh = start_buffer;
- for (i=0 ; ib_dirt)
- ll_rw_block(WRITE,bh);
- }
- return 0;
-}
-
-int sync_dev(int dev)
-{
- int i;
- struct buffer_head * bh;
-
- bh = start_buffer;
- for (i=0 ; ib_dev != dev)
- continue;
- wait_on_buffer(bh);
- if (bh->b_dev == dev && bh->b_dirt)
- ll_rw_block(WRITE,bh);
- }
- sync_inodes();
- bh = start_buffer;
- for (i=0 ; ib_dev != dev)
- continue;
- wait_on_buffer(bh);
- if (bh->b_dev == dev && bh->b_dirt)
- ll_rw_block(WRITE,bh);
- }
- return 0;
-}
-
-void inline invalidate_buffers(int dev)
-{
- int i;
- struct buffer_head * bh;
-
- bh = start_buffer;
- for (i=0 ; ib_dev != dev)
- continue;
- wait_on_buffer(bh);
- if (bh->b_dev == dev)
- bh->b_uptodate = bh->b_dirt = 0;
- }
-}
-
-/*
- * This routine checks whether a floppy has been changed, and
- * invalidates all buffer-cache-entries in that case. This
- * is a relatively slow routine, so we have to try to minimize using
- * it. Thus it is called only upon a 'mount' or 'open'. This
- * is the best way of combining speed and utility, I think.
- * People changing diskettes in the middle of an operation deserve
- * to loose :-)
- *
- * NOTE! Although currently this is only for floppies, the idea is
- * that any additional removable block-device will use this routine,
- * and that mount/open needn't know that floppies/whatever are
- * special.
- */
-void check_disk_change(int dev)
-{
- int i;
-
- if (MAJOR(dev) != 2)
- return;
- if (!floppy_change(dev & 0x03))
- return;
- for (i=0 ; ib_next)
- bh->b_next->b_prev = bh->b_prev;
- if (bh->b_prev)
- bh->b_prev->b_next = bh->b_next;
- if (hash(bh->b_dev,bh->b_blocknr) == bh)
- hash(bh->b_dev,bh->b_blocknr) = bh->b_next;
-/* remove from free list */
- if (!(bh->b_prev_free) || !(bh->b_next_free))
- panic("Free block list corrupted");
- bh->b_prev_free->b_next_free = bh->b_next_free;
- bh->b_next_free->b_prev_free = bh->b_prev_free;
- if (free_list == bh)
- free_list = bh->b_next_free;
-}
-
-static inline void insert_into_queues(struct buffer_head * bh)
-{
-/* put at end of free list */
- bh->b_next_free = free_list;
- bh->b_prev_free = free_list->b_prev_free;
- free_list->b_prev_free->b_next_free = bh;
- free_list->b_prev_free = bh;
-/* put the buffer in new hash-queue if it has a device */
- bh->b_prev = NULL;
- bh->b_next = NULL;
- if (!bh->b_dev)
- return;
- bh->b_next = hash(bh->b_dev,bh->b_blocknr);
- hash(bh->b_dev,bh->b_blocknr) = bh;
- bh->b_next->b_prev = bh;
-}
-
-static struct buffer_head * find_buffer(int dev, int block)
-{
- struct buffer_head * tmp;
-
- for (tmp = hash(dev,block) ; tmp != NULL ; tmp = tmp->b_next)
- if (tmp->b_dev==dev && tmp->b_blocknr==block)
- return tmp;
- return NULL;
-}
-
-/*
- * Why like this, I hear you say... The reason is race-conditions.
- * As we don't lock buffers (unless we are readint them, that is),
- * something might happen to it while we sleep (ie a read-error
- * will force it bad). This shouldn't really happen currently, but
- * the code is ready.
- */
-struct buffer_head * get_hash_table(int dev, int block)
-{
- struct buffer_head * bh;
-
- for (;;) {
- if (!(bh=find_buffer(dev,block)))
- return NULL;
- bh->b_count++;
- wait_on_buffer(bh);
- if (bh->b_dev == dev && bh->b_blocknr == block)
- return bh;
- bh->b_count--;
- }
-}
-
-/*
- * Ok, this is getblk, and it isn't very clear, again to hinder
- * race-conditions. Most of the code is seldom used, (ie repeating),
- * so it should be much more efficient than it looks.
- *
- * The algoritm is changed: hopefully better, and an elusive bug removed.
- */
-#define BADNESS(bh) (((bh)->b_dirt<<1)+(bh)->b_lock)
-struct buffer_head * getblk(int dev,int block)
-{
- struct buffer_head * tmp, * bh;
-
-repeat:
- if (bh = get_hash_table(dev,block))
- return bh;
- tmp = free_list;
- do {
- if (tmp->b_count)
- continue;
- if (!bh || BADNESS(tmp)b_next_free) != free_list);
- if (!bh) {
- sleep_on(&buffer_wait);
- goto repeat;
- }
- wait_on_buffer(bh);
- if (bh->b_count)
- goto repeat;
- while (bh->b_dirt) {
- sync_dev(bh->b_dev);
- wait_on_buffer(bh);
- if (bh->b_count)
- goto repeat;
- }
-/* NOTE!! While we slept waiting for this block, somebody else might */
-/* already have added "this" block to the cache. check it */
- if (find_buffer(dev,block))
- goto repeat;
-/* OK, FINALLY we know that this buffer is the only one of it's kind, */
-/* and that it's unused (b_count=0), unlocked (b_lock=0), and clean */
- bh->b_count=1;
- bh->b_dirt=0;
- bh->b_uptodate=0;
- remove_from_queues(bh);
- bh->b_dev=dev;
- bh->b_blocknr=block;
- insert_into_queues(bh);
- return bh;
-}
-
-void brelse(struct buffer_head * buf)
-{
- if (!buf)
- return;
- wait_on_buffer(buf);
- if (!(buf->b_count--))
- panic("Trying to free free buffer");
- wake_up(&buffer_wait);
-}
-
-/*
- * bread() reads a specified block and returns the buffer that contains
- * it. It returns NULL if the block was unreadable.
- */
-struct buffer_head * bread(int dev,int block)
-{
- struct buffer_head * bh;
-
- if (!(bh=getblk(dev,block)))
- panic("bread: getblk returned NULL\n");
- if (bh->b_uptodate)
- return bh;
- ll_rw_block(READ,bh);
- wait_on_buffer(bh);
- if (bh->b_uptodate)
- return bh;
- brelse(bh);
- return NULL;
-}
-
-#define COPYBLK(from,to) \
-__asm__("cld\n\t" \
- "rep\n\t" \
- "movsl\n\t" \
- ::"c" (BLOCK_SIZE/4),"S" (from),"D" (to) \
- )
-
-/*
- * bread_page reads four buffers into memory at the desired address. It's
- * a function of its own, as there is some speed to be got by reading them
- * all at the same time, not waiting for one to be read, and then another
- * etc.
- */
-void bread_page(unsigned long address,int dev,int b[4])
-{
- struct buffer_head * bh[4];
- int i;
-
- for (i=0 ; i<4 ; i++)
- if (b[i]) {
- if (bh[i] = getblk(dev,b[i]))
- if (!bh[i]->b_uptodate)
- ll_rw_block(READ,bh[i]);
- } else
- bh[i] = NULL;
- for (i=0 ; i<4 ; i++,address += BLOCK_SIZE)
- if (bh[i]) {
- wait_on_buffer(bh[i]);
- if (bh[i]->b_uptodate)
- COPYBLK((unsigned long) bh[i]->b_data,address);
- brelse(bh[i]);
- }
-}
-
-/*
- * Ok, breada can be used as bread, but additionally to mark other
- * blocks for reading as well. End the argument list with a negative
- * number.
- */
-struct buffer_head * breada(int dev,int first, ...)
-{
- va_list args;
- struct buffer_head * bh, *tmp;
-
- va_start(args,first);
- if (!(bh=getblk(dev,first)))
- panic("bread: getblk returned NULL\n");
- if (!bh->b_uptodate)
- ll_rw_block(READ,bh);
- while ((first=va_arg(args,int))>=0) {
- tmp=getblk(dev,first);
- if (tmp) {
- if (!tmp->b_uptodate)
- ll_rw_block(READA,bh);
- tmp->b_count--;
- }
- }
- va_end(args);
- wait_on_buffer(bh);
- if (bh->b_uptodate)
- return bh;
- brelse(bh);
- return (NULL);
-}
-
-void buffer_init(long buffer_end)
-{
- struct buffer_head * h = start_buffer;
- void * b;
- int i;
-
- if (buffer_end == 1<<20)
- b = (void *) (640*1024);
- else
- b = (void *) buffer_end;
- while ( (b -= BLOCK_SIZE) >= ((void *) (h+1)) ) {
- h->b_dev = 0;
- h->b_dirt = 0;
- h->b_count = 0;
- h->b_lock = 0;
- h->b_uptodate = 0;
- h->b_wait = NULL;
- h->b_next = NULL;
- h->b_prev = NULL;
- h->b_data = (char *) b;
- h->b_prev_free = h-1;
- h->b_next_free = h+1;
- h++;
- NR_BUFFERS++;
- if (b == (void *) 0x100000)
- b = (void *) 0xA0000;
- }
- h--;
- free_list = start_buffer;
- free_list->b_prev_free = h;
- h->b_next_free = free_list;
- for (i=0;i
+
+#include
+#include
+#include
+#include
+#include
+
+extern void put_super(int dev);
+extern void invalidate_inodes(int dev);
+
+extern int end;
+struct buffer_head * start_buffer = (struct buffer_head *) &end;
+struct buffer_head * hash_table[NR_HASH];
+static struct buffer_head * free_list;
+static struct task_struct * buffer_wait = NULL;
+int NR_BUFFERS = 0;
+
+static inline void wait_on_buffer(struct buffer_head * bh)
+{
+ cli();
+ while (bh->b_lock)
+ sleep_on(&bh->b_wait);
+ sti();
+}
+
+int sys_sync(void)
+{
+ int i;
+ struct buffer_head * bh;
+
+ sync_inodes(); /* write out inodes into buffers */
+ bh = start_buffer;
+ for (i=0 ; ib_dirt)
+ ll_rw_block(WRITE,bh);
+ }
+ return 0;
+}
+
+int sync_dev(int dev)
+{
+ int i;
+ struct buffer_head * bh;
+
+ bh = start_buffer;
+ for (i=0 ; ib_dev != dev)
+ continue;
+ wait_on_buffer(bh);
+ if (bh->b_dev == dev && bh->b_dirt)
+ ll_rw_block(WRITE,bh);
+ }
+ sync_inodes();
+ bh = start_buffer;
+ for (i=0 ; ib_dev != dev)
+ continue;
+ wait_on_buffer(bh);
+ if (bh->b_dev == dev && bh->b_dirt)
+ ll_rw_block(WRITE,bh);
+ }
+ return 0;
+}
+
+void inline invalidate_buffers(int dev)
+{
+ int i;
+ struct buffer_head * bh;
+
+ bh = start_buffer;
+ for (i=0 ; ib_dev != dev)
+ continue;
+ wait_on_buffer(bh);
+ if (bh->b_dev == dev)
+ bh->b_uptodate = bh->b_dirt = 0;
+ }
+}
+
+/*
+ * This routine checks whether a floppy has been changed, and
+ * invalidates all buffer-cache-entries in that case. This
+ * is a relatively slow routine, so we have to try to minimize using
+ * it. Thus it is called only upon a 'mount' or 'open'. This
+ * is the best way of combining speed and utility, I think.
+ * People changing diskettes in the middle of an operation deserve
+ * to loose :-)
+ *
+ * NOTE! Although currently this is only for floppies, the idea is
+ * that any additional removable block-device will use this routine,
+ * and that mount/open needn't know that floppies/whatever are
+ * special.
+ */
+void check_disk_change(int dev)
+{
+ int i;
+
+ if (MAJOR(dev) != 2)
+ return;
+ if (!floppy_change(dev & 0x03))
+ return;
+ for (i=0 ; ib_next)
+ bh->b_next->b_prev = bh->b_prev;
+ if (bh->b_prev)
+ bh->b_prev->b_next = bh->b_next;
+ if (hash(bh->b_dev,bh->b_blocknr) == bh)
+ hash(bh->b_dev,bh->b_blocknr) = bh->b_next;
+/* remove from free list */
+ if (!(bh->b_prev_free) || !(bh->b_next_free))
+ panic("Free block list corrupted");
+ bh->b_prev_free->b_next_free = bh->b_next_free;
+ bh->b_next_free->b_prev_free = bh->b_prev_free;
+ if (free_list == bh)
+ free_list = bh->b_next_free;
+}
+
+static inline void insert_into_queues(struct buffer_head * bh)
+{
+/* put at end of free list */
+ bh->b_next_free = free_list;
+ bh->b_prev_free = free_list->b_prev_free;
+ free_list->b_prev_free->b_next_free = bh;
+ free_list->b_prev_free = bh;
+/* put the buffer in new hash-queue if it has a device */
+ bh->b_prev = NULL;
+ bh->b_next = NULL;
+ if (!bh->b_dev)
+ return;
+ bh->b_next = hash(bh->b_dev,bh->b_blocknr);
+ hash(bh->b_dev,bh->b_blocknr) = bh;
+ bh->b_next->b_prev = bh;
+}
+
+static struct buffer_head * find_buffer(int dev, int block)
+{
+ struct buffer_head * tmp;
+
+ for (tmp = hash(dev,block) ; tmp != NULL ; tmp = tmp->b_next)
+ if (tmp->b_dev==dev && tmp->b_blocknr==block)
+ return tmp;
+ return NULL;
+}
+
+/*
+ * Why like this, I hear you say... The reason is race-conditions.
+ * As we don't lock buffers (unless we are readint them, that is),
+ * something might happen to it while we sleep (ie a read-error
+ * will force it bad). This shouldn't really happen currently, but
+ * the code is ready.
+ */
+struct buffer_head * get_hash_table(int dev, int block)
+{
+ struct buffer_head * bh;
+
+ for (;;) {
+ if (!(bh=find_buffer(dev,block)))
+ return NULL;
+ bh->b_count++;
+ wait_on_buffer(bh);
+ if (bh->b_dev == dev && bh->b_blocknr == block)
+ return bh;
+ bh->b_count--;
+ }
+}
+
+/*
+ * Ok, this is getblk, and it isn't very clear, again to hinder
+ * race-conditions. Most of the code is seldom used, (ie repeating),
+ * so it should be much more efficient than it looks.
+ *
+ * The algoritm is changed: hopefully better, and an elusive bug removed.
+ */
+#define BADNESS(bh) (((bh)->b_dirt<<1)+(bh)->b_lock)
+struct buffer_head * getblk(int dev,int block)
+{
+ struct buffer_head * tmp, * bh;
+
+repeat:
+ if (bh = get_hash_table(dev,block))
+ return bh;
+ tmp = free_list;
+ do {
+ if (tmp->b_count)
+ continue;
+ if (!bh || BADNESS(tmp)b_next_free) != free_list);
+ if (!bh) {
+ sleep_on(&buffer_wait);
+ goto repeat;
+ }
+ wait_on_buffer(bh);
+ if (bh->b_count)
+ goto repeat;
+ while (bh->b_dirt) {
+ sync_dev(bh->b_dev);
+ wait_on_buffer(bh);
+ if (bh->b_count)
+ goto repeat;
+ }
+/* NOTE!! While we slept waiting for this block, somebody else might */
+/* already have added "this" block to the cache. check it */
+ if (find_buffer(dev,block))
+ goto repeat;
+/* OK, FINALLY we know that this buffer is the only one of it's kind, */
+/* and that it's unused (b_count=0), unlocked (b_lock=0), and clean */
+ bh->b_count=1;
+ bh->b_dirt=0;
+ bh->b_uptodate=0;
+ remove_from_queues(bh);
+ bh->b_dev=dev;
+ bh->b_blocknr=block;
+ insert_into_queues(bh);
+ return bh;
+}
+
+void brelse(struct buffer_head * buf)
+{
+ if (!buf)
+ return;
+ wait_on_buffer(buf);
+ if (!(buf->b_count--))
+ panic("Trying to free free buffer");
+ wake_up(&buffer_wait);
+}
+
+/*
+ * bread() reads a specified block and returns the buffer that contains
+ * it. It returns NULL if the block was unreadable.
+ */
+struct buffer_head * bread(int dev,int block)
+{
+ struct buffer_head * bh;
+
+ if (!(bh=getblk(dev,block)))
+ panic("bread: getblk returned NULL\n");
+ if (bh->b_uptodate)
+ return bh;
+ ll_rw_block(READ,bh);
+ wait_on_buffer(bh);
+ if (bh->b_uptodate)
+ return bh;
+ brelse(bh);
+ return NULL;
+}
+
+#define COPYBLK(from,to) \
+__asm__("cld\n\t" \
+ "rep\n\t" \
+ "movsl\n\t" \
+ ::"c" (BLOCK_SIZE/4),"S" (from),"D" (to) \
+ )
+
+/*
+ * bread_page reads four buffers into memory at the desired address. It's
+ * a function of its own, as there is some speed to be got by reading them
+ * all at the same time, not waiting for one to be read, and then another
+ * etc.
+ */
+void bread_page(unsigned long address,int dev,int b[4])
+{
+ struct buffer_head * bh[4];
+ int i;
+
+ for (i=0 ; i<4 ; i++)
+ if (b[i]) {
+ if (bh[i] = getblk(dev,b[i]))
+ if (!bh[i]->b_uptodate)
+ ll_rw_block(READ,bh[i]);
+ } else
+ bh[i] = NULL;
+ for (i=0 ; i<4 ; i++,address += BLOCK_SIZE)
+ if (bh[i]) {
+ wait_on_buffer(bh[i]);
+ if (bh[i]->b_uptodate)
+ COPYBLK((unsigned long) bh[i]->b_data,address);
+ brelse(bh[i]);
+ }
+}
+
+/*
+ * Ok, breada can be used as bread, but additionally to mark other
+ * blocks for reading as well. End the argument list with a negative
+ * number.
+ */
+struct buffer_head * breada(int dev,int first, ...)
+{
+ va_list args;
+ struct buffer_head * bh, *tmp;
+
+ va_start(args,first);
+ if (!(bh=getblk(dev,first)))
+ panic("bread: getblk returned NULL\n");
+ if (!bh->b_uptodate)
+ ll_rw_block(READ,bh);
+ while ((first=va_arg(args,int))>=0) {
+ tmp=getblk(dev,first);
+ if (tmp) {
+ if (!tmp->b_uptodate)
+ ll_rw_block(READA,bh);
+ tmp->b_count--;
+ }
+ }
+ va_end(args);
+ wait_on_buffer(bh);
+ if (bh->b_uptodate)
+ return bh;
+ brelse(bh);
+ return (NULL);
+}
+
+void buffer_init(long buffer_end)
+{
+ struct buffer_head * h = start_buffer;
+ void * b;
+ int i;
+
+ if (buffer_end == 1<<20)
+ b = (void *) (640*1024);
+ else
+ b = (void *) buffer_end;
+ while ( (b -= BLOCK_SIZE) >= ((void *) (h+1)) ) {
+ h->b_dev = 0;
+ h->b_dirt = 0;
+ h->b_count = 0;
+ h->b_lock = 0;
+ h->b_uptodate = 0;
+ h->b_wait = NULL;
+ h->b_next = NULL;
+ h->b_prev = NULL;
+ h->b_data = (char *) b;
+ h->b_prev_free = h-1;
+ h->b_next_free = h+1;
+ h++;
+ NR_BUFFERS++;
+ if (b == (void *) 0x100000)
+ b = (void *) 0xA0000;
+ }
+ h--;
+ free_list = start_buffer;
+ free_list->b_prev_free = h;
+ h->b_next_free = free_list;
+ for (i=0;i
-#include
-
-#include
-#include
-
-#include
-#include
-
-extern int tty_read(unsigned minor,char * buf,int count);
-extern int tty_write(unsigned minor,char * buf,int count);
-
-typedef (*crw_ptr)(int rw,unsigned minor,char * buf,int count,off_t * pos);
-
-static int rw_ttyx(int rw,unsigned minor,char * buf,int count,off_t * pos)
-{
- return ((rw==READ)?tty_read(minor,buf,count):
- tty_write(minor,buf,count));
-}
-
-static int rw_tty(int rw,unsigned minor,char * buf,int count, off_t * pos)
-{
- if (current->tty<0)
- return -EPERM;
- return rw_ttyx(rw,current->tty,buf,count,pos);
-}
-
-static int rw_ram(int rw,char * buf, int count, off_t *pos)
-{
- return -EIO;
-}
-
-static int rw_mem(int rw,char * buf, int count, off_t * pos)
-{
- return -EIO;
-}
-
-static int rw_kmem(int rw,char * buf, int count, off_t * pos)
-{
- return -EIO;
-}
-
-static int rw_port(int rw,char * buf, int count, off_t * pos)
-{
- int i=*pos;
-
- while (count-->0 && i<65536) {
- if (rw==READ)
- put_fs_byte(inb(i),buf++);
- else
- outb(get_fs_byte(buf++),i);
- i++;
- }
- i -= *pos;
- *pos += i;
- return i;
-}
-
-static int rw_memory(int rw, unsigned minor, char * buf, int count, off_t * pos)
-{
- switch(minor) {
- case 0:
- return rw_ram(rw,buf,count,pos);
- case 1:
- return rw_mem(rw,buf,count,pos);
- case 2:
- return rw_kmem(rw,buf,count,pos);
- case 3:
- return (rw==READ)?0:count; /* rw_null */
- case 4:
- return rw_port(rw,buf,count,pos);
- default:
- return -EIO;
- }
-}
-
-#define NRDEVS ((sizeof (crw_table))/(sizeof (crw_ptr)))
-
-static crw_ptr crw_table[]={
- NULL, /* nodev */
- rw_memory, /* /dev/mem etc */
- NULL, /* /dev/fd */
- NULL, /* /dev/hd */
- rw_ttyx, /* /dev/ttyx */
- rw_tty, /* /dev/tty */
- NULL, /* /dev/lp */
- NULL}; /* unnamed pipes */
-
-int rw_char(int rw,int dev, char * buf, int count, off_t * pos)
-{
- crw_ptr call_addr;
-
- if (MAJOR(dev)>=NRDEVS)
- return -ENODEV;
- if (!(call_addr=crw_table[MAJOR(dev)]))
- return -ENODEV;
- return call_addr(rw,MINOR(dev),buf,count,pos);
-}
+/*
+ * linux/fs/char_dev.c
+ *
+ * (C) 1991 Linus Torvalds
+ */
+
+#include
+#include
+
+#include
+#include
+
+#include
+#include
+
+extern int tty_read(unsigned minor,char * buf,int count);
+extern int tty_write(unsigned minor,char * buf,int count);
+
+typedef (*crw_ptr)(int rw,unsigned minor,char * buf,int count,off_t * pos);
+
+static int rw_ttyx(int rw,unsigned minor,char * buf,int count,off_t * pos)
+{
+ return ((rw==READ)?tty_read(minor,buf,count):
+ tty_write(minor,buf,count));
+}
+
+static int rw_tty(int rw,unsigned minor,char * buf,int count, off_t * pos)
+{
+ if (current->tty<0)
+ return -EPERM;
+ return rw_ttyx(rw,current->tty,buf,count,pos);
+}
+
+static int rw_ram(int rw,char * buf, int count, off_t *pos)
+{
+ return -EIO;
+}
+
+static int rw_mem(int rw,char * buf, int count, off_t * pos)
+{
+ return -EIO;
+}
+
+static int rw_kmem(int rw,char * buf, int count, off_t * pos)
+{
+ return -EIO;
+}
+
+static int rw_port(int rw,char * buf, int count, off_t * pos)
+{
+ int i=*pos;
+
+ while (count-->0 && i<65536) {
+ if (rw==READ)
+ put_fs_byte(inb(i),buf++);
+ else
+ outb(get_fs_byte(buf++),i);
+ i++;
+ }
+ i -= *pos;
+ *pos += i;
+ return i;
+}
+
+static int rw_memory(int rw, unsigned minor, char * buf, int count, off_t * pos)
+{
+ switch(minor) {
+ case 0:
+ return rw_ram(rw,buf,count,pos);
+ case 1:
+ return rw_mem(rw,buf,count,pos);
+ case 2:
+ return rw_kmem(rw,buf,count,pos);
+ case 3:
+ return (rw==READ)?0:count; /* rw_null */
+ case 4:
+ return rw_port(rw,buf,count,pos);
+ default:
+ return -EIO;
+ }
+}
+
+#define NRDEVS ((sizeof (crw_table))/(sizeof (crw_ptr)))
+
+static crw_ptr crw_table[]={
+ NULL, /* nodev */
+ rw_memory, /* /dev/mem etc */
+ NULL, /* /dev/fd */
+ NULL, /* /dev/hd */
+ rw_ttyx, /* /dev/ttyx */
+ rw_tty, /* /dev/tty */
+ NULL, /* /dev/lp */
+ NULL}; /* unnamed pipes */
+
+int rw_char(int rw,int dev, char * buf, int count, off_t * pos)
+{
+ crw_ptr call_addr;
+
+ if (MAJOR(dev)>=NRDEVS)
+ return -ENODEV;
+ if (!(call_addr=crw_table[MAJOR(dev)]))
+ return -ENODEV;
+ return call_addr(rw,MINOR(dev),buf,count,pos);
+}
diff --git a/linux-0.11-lab - 副本/0/linux/fs/exec.c b/linux-0.11-lab - 副本/0/linux/fs/exec.c
index 2ff220e..9bc28bc 100644
--- a/linux-0.11-lab - 副本/0/linux/fs/exec.c
+++ b/linux-0.11-lab - 副本/0/linux/fs/exec.c
@@ -1,359 +1,359 @@
-/*
- * linux/fs/exec.c
- *
- * (C) 1991 Linus Torvalds
- */
-
-/*
- * #!-checking implemented by tytso.
- */
-
-/*
- * Demand-loading implemented 01.12.91 - no need to read anything but
- * the header into memory. The inode of the executable is put into
- * "current->executable", and page faults do the actual loading. Clean.
- *
- * Once more I can proudly say that linux stood up to being changed: it
- * was less than 2 hours work to get demand-loading completely implemented.
- */
-
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-#include
-
-extern int sys_exit(int exit_code);
-extern int sys_close(int fd);
-
-/*
- * MAX_ARG_PAGES defines the number of pages allocated for arguments
- * and envelope for the new program. 32 should suffice, this gives
- * a maximum env+arg of 128kB !
- */
-#define MAX_ARG_PAGES 32
-
-
-int sys_uselib()
-{
- return -ENOSYS;
-}
-
-/*
- * create_tables() parses the env- and arg-strings in new user
- * memory and creates the pointer tables from them, and puts their
- * addresses on the "stack", returning the new stack pointer value.
- */
-static unsigned long * create_tables(char * p,int argc,int envc)
-{
- unsigned long *argv,*envp;
- unsigned long * sp;
-
- sp = (unsigned long *) (0xfffffffc & (unsigned long) p);
- sp -= envc+1;
- envp = sp;
- sp -= argc+1;
- argv = sp;
- put_fs_long((unsigned long)envp,--sp);
- put_fs_long((unsigned long)argv,--sp);
- put_fs_long((unsigned long)argc,--sp);
- while (argc-->0) {
- put_fs_long((unsigned long) p,argv++);
- while (get_fs_byte(p++)) /* nothing */ ;
- }
- put_fs_long(0,argv);
- while (envc-->0) {
- put_fs_long((unsigned long) p,envp++);
- while (get_fs_byte(p++)) /* nothing */ ;
- }
- put_fs_long(0,envp);
- return sp;
-}
-
-/*
- * count() counts the number of arguments/envelopes
- */
-static int count(char ** argv)
-{
- int i=0;
- char ** tmp;
-
- if (tmp = argv)
- while (get_fs_long((unsigned long *) (tmp++)))
- i++;
-
- return i;
-}
-
-/*
- * 'copy_string()' copies argument/envelope strings from user
- * memory to free pages in kernel mem. These are in a format ready
- * to be put directly into the top of new user memory.
- *
- * Modified by TYT, 11/24/91 to add the from_kmem argument, which specifies
- * whether the string and the string array are from user or kernel segments:
- *
- * from_kmem argv * argv **
- * 0 user space user space
- * 1 kernel space user space
- * 2 kernel space kernel space
- *
- * We do this by playing games with the fs segment register. Since it
- * it is expensive to load a segment register, we try to avoid calling
- * set_fs() unless we absolutely have to.
- */
-static unsigned long copy_strings(int argc,char ** argv,unsigned long *page,
- unsigned long p, int from_kmem)
-{
- char *tmp, *pag;
- int len, offset = 0;
- unsigned long old_fs, new_fs;
-
- if (!p)
- return 0; /* bullet-proofing */
- new_fs = get_ds();
- old_fs = get_fs();
- if (from_kmem==2)
- set_fs(new_fs);
- while (argc-- > 0) {
- if (from_kmem == 1)
- set_fs(new_fs);
- if (!(tmp = (char *)get_fs_long(((unsigned long *)argv)+argc)))
- panic("argc is wrong");
- if (from_kmem == 1)
- set_fs(old_fs);
- len=0; /* remember zero-padding */
- do {
- len++;
- } while (get_fs_byte(tmp++));
- if (p-len < 0) { /* this shouldn't happen - 128kB */
- set_fs(old_fs);
- return 0;
- }
- while (len) {
- --p; --tmp; --len;
- if (--offset < 0) {
- offset = p % PAGE_SIZE;
- if (from_kmem==2)
- set_fs(old_fs);
- if (!(pag = (char *) page[p/PAGE_SIZE]) &&
- !(pag = (char *) (page[p/PAGE_SIZE] =
- (unsigned long *) get_free_page())))
- return 0;
- if (from_kmem==2)
- set_fs(new_fs);
-
- }
- *(pag + offset) = get_fs_byte(tmp);
- }
- }
- if (from_kmem==2)
- set_fs(old_fs);
- return p;
-}
-
-static unsigned long change_ldt(unsigned long text_size,unsigned long * page)
-{
- unsigned long code_limit,data_limit,code_base,data_base;
- int i;
-
- code_limit = text_size+PAGE_SIZE -1;
- code_limit &= 0xFFFFF000;
- data_limit = 0x4000000;
- code_base = get_base(current->ldt[1]);
- data_base = code_base;
- set_base(current->ldt[1],code_base);
- set_limit(current->ldt[1],code_limit);
- set_base(current->ldt[2],data_base);
- set_limit(current->ldt[2],data_limit);
-/* make sure fs points to the NEW data segment */
- __asm__("pushl $0x17\n\tpop %%fs"::);
- data_base += data_limit;
- for (i=MAX_ARG_PAGES-1 ; i>=0 ; i--) {
- data_base -= PAGE_SIZE;
- if (page[i])
- put_page(page[i],data_base);
- }
- return data_limit;
-}
-
-/*
- * 'do_execve()' executes a new program.
- */
-int do_execve(unsigned long * eip,long tmp,char * filename,
- char ** argv, char ** envp)
-{
- struct m_inode * inode;
- struct buffer_head * bh;
- struct exec ex;
- unsigned long page[MAX_ARG_PAGES];
- int i,argc,envc;
- int e_uid, e_gid;
- int retval;
- int sh_bang = 0;
- unsigned long p=PAGE_SIZE*MAX_ARG_PAGES-4;
-
- if ((0xffff & eip[1]) != 0x000f)
- panic("execve called from supervisor mode");
- for (i=0 ; ii_mode)) { /* must be regular file */
- retval = -EACCES;
- goto exec_error2;
- }
- i = inode->i_mode;
- e_uid = (i & S_ISUID) ? inode->i_uid : current->euid;
- e_gid = (i & S_ISGID) ? inode->i_gid : current->egid;
- if (current->euid == inode->i_uid)
- i >>= 6;
- else if (current->egid == inode->i_gid)
- i >>= 3;
- if (!(i & 1) &&
- !((inode->i_mode & 0111) && suser())) {
- retval = -ENOEXEC;
- goto exec_error2;
- }
- if (!(bh = bread(inode->i_dev,inode->i_zone[0]))) {
- retval = -EACCES;
- goto exec_error2;
- }
- ex = *((struct exec *) bh->b_data); /* read exec-header */
- if ((bh->b_data[0] == '#') && (bh->b_data[1] == '!') && (!sh_bang)) {
- /*
- * This section does the #! interpretation.
- * Sorta complicated, but hopefully it will work. -TYT
- */
-
- char buf[1023], *cp, *interp, *i_name, *i_arg;
- unsigned long old_fs;
-
- strncpy(buf, bh->b_data+2, 1022);
- brelse(bh);
- iput(inode);
- buf[1022] = '\0';
- if (cp = strchr(buf, '\n')) {
- *cp = '\0';
- for (cp = buf; (*cp == ' ') || (*cp == '\t'); cp++);
- }
- if (!cp || *cp == '\0') {
- retval = -ENOEXEC; /* No interpreter name found */
- goto exec_error1;
- }
- interp = i_name = cp;
- i_arg = 0;
- for ( ; *cp && (*cp != ' ') && (*cp != '\t'); cp++) {
- if (*cp == '/')
- i_name = cp+1;
- }
- if (*cp) {
- *cp++ = '\0';
- i_arg = cp;
- }
- /*
- * OK, we've parsed out the interpreter name and
- * (optional) argument.
- */
- if (sh_bang++ == 0) {
- p = copy_strings(envc, envp, page, p, 0);
- p = copy_strings(--argc, argv+1, page, p, 0);
- }
- /*
- * Splice in (1) the interpreter's name for argv[0]
- * (2) (optional) argument to interpreter
- * (3) filename of shell script
- *
- * This is done in reverse order, because of how the
- * user environment and arguments are stored.
- */
- p = copy_strings(1, &filename, page, p, 1);
- argc++;
- if (i_arg) {
- p = copy_strings(1, &i_arg, page, p, 2);
- argc++;
- }
- p = copy_strings(1, &i_name, page, p, 2);
- argc++;
- if (!p) {
- retval = -ENOMEM;
- goto exec_error1;
- }
- /*
- * OK, now restart the process with the interpreter's inode.
- */
- old_fs = get_fs();
- set_fs(get_ds());
- if (!(inode=namei(interp))) { /* get executables inode */
- set_fs(old_fs);
- retval = -ENOENT;
- goto exec_error1;
- }
- set_fs(old_fs);
- goto restart_interp;
- }
- brelse(bh);
- if (N_MAGIC(ex) != ZMAGIC || ex.a_trsize || ex.a_drsize ||
- ex.a_text+ex.a_data+ex.a_bss>0x3000000 ||
- inode->i_size < ex.a_text+ex.a_data+ex.a_syms+N_TXTOFF(ex)) {
- retval = -ENOEXEC;
- goto exec_error2;
- }
- if (N_TXTOFF(ex) != BLOCK_SIZE) {
- printk("%s: N_TXTOFF != BLOCK_SIZE. See a.out.h.", filename);
- retval = -ENOEXEC;
- goto exec_error2;
- }
- if (!sh_bang) {
- p = copy_strings(envc,envp,page,p,0);
- p = copy_strings(argc,argv,page,p,0);
- if (!p) {
- retval = -ENOMEM;
- goto exec_error2;
- }
- }
-/* OK, This is the point of no return */
- if (current->executable)
- iput(current->executable);
- current->executable = inode;
- for (i=0 ; i<32 ; i++)
- current->sigaction[i].sa_handler = NULL;
- for (i=0 ; iclose_on_exec>>i)&1)
- sys_close(i);
- current->close_on_exec = 0;
- free_page_tables(get_base(current->ldt[1]),get_limit(0x0f));
- free_page_tables(get_base(current->ldt[2]),get_limit(0x17));
- if (last_task_used_math == current)
- last_task_used_math = NULL;
- current->used_math = 0;
- p += change_ldt(ex.a_text,page)-MAX_ARG_PAGES*PAGE_SIZE;
- p = (unsigned long) create_tables((char *)p,argc,envc);
- current->brk = ex.a_bss +
- (current->end_data = ex.a_data +
- (current->end_code = ex.a_text));
- current->start_stack = p & 0xfffff000;
- current->euid = e_uid;
- current->egid = e_gid;
- i = ex.a_text+ex.a_data;
- while (i&0xfff)
- put_fs_byte(0,(char *) (i++));
- eip[0] = ex.a_entry; /* eip, magic happens :-) */
- eip[3] = p; /* stack pointer */
- return 0;
-exec_error2:
- iput(inode);
-exec_error1:
- for (i=0 ; iexecutable", and page faults do the actual loading. Clean.
+ *
+ * Once more I can proudly say that linux stood up to being changed: it
+ * was less than 2 hours work to get demand-loading completely implemented.
+ */
+
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+
+extern int sys_exit(int exit_code);
+extern int sys_close(int fd);
+
+/*
+ * MAX_ARG_PAGES defines the number of pages allocated for arguments
+ * and envelope for the new program. 32 should suffice, this gives
+ * a maximum env+arg of 128kB !
+ */
+#define MAX_ARG_PAGES 32
+
+
+int sys_uselib()
+{
+ return -ENOSYS;
+}
+
+/*
+ * create_tables() parses the env- and arg-strings in new user
+ * memory and creates the pointer tables from them, and puts their
+ * addresses on the "stack", returning the new stack pointer value.
+ */
+static unsigned long * create_tables(char * p,int argc,int envc)
+{
+ unsigned long *argv,*envp;
+ unsigned long * sp;
+
+ sp = (unsigned long *) (0xfffffffc & (unsigned long) p);
+ sp -= envc+1;
+ envp = sp;
+ sp -= argc+1;
+ argv = sp;
+ put_fs_long((unsigned long)envp,--sp);
+ put_fs_long((unsigned long)argv,--sp);
+ put_fs_long((unsigned long)argc,--sp);
+ while (argc-->0) {
+ put_fs_long((unsigned long) p,argv++);
+ while (get_fs_byte(p++)) /* nothing */ ;
+ }
+ put_fs_long(0,argv);
+ while (envc-->0) {
+ put_fs_long((unsigned long) p,envp++);
+ while (get_fs_byte(p++)) /* nothing */ ;
+ }
+ put_fs_long(0,envp);
+ return sp;
+}
+
+/*
+ * count() counts the number of arguments/envelopes
+ */
+static int count(char ** argv)
+{
+ int i=0;
+ char ** tmp;
+
+ if (tmp = argv)
+ while (get_fs_long((unsigned long *) (tmp++)))
+ i++;
+
+ return i;
+}
+
+/*
+ * 'copy_string()' copies argument/envelope strings from user
+ * memory to free pages in kernel mem. These are in a format ready
+ * to be put directly into the top of new user memory.
+ *
+ * Modified by TYT, 11/24/91 to add the from_kmem argument, which specifies
+ * whether the string and the string array are from user or kernel segments:
+ *
+ * from_kmem argv * argv **
+ * 0 user space user space
+ * 1 kernel space user space
+ * 2 kernel space kernel space
+ *
+ * We do this by playing games with the fs segment register. Since it
+ * it is expensive to load a segment register, we try to avoid calling
+ * set_fs() unless we absolutely have to.
+ */
+static unsigned long copy_strings(int argc,char ** argv,unsigned long *page,
+ unsigned long p, int from_kmem)
+{
+ char *tmp, *pag;
+ int len, offset = 0;
+ unsigned long old_fs, new_fs;
+
+ if (!p)
+ return 0; /* bullet-proofing */
+ new_fs = get_ds();
+ old_fs = get_fs();
+ if (from_kmem==2)
+ set_fs(new_fs);
+ while (argc-- > 0) {
+ if (from_kmem == 1)
+ set_fs(new_fs);
+ if (!(tmp = (char *)get_fs_long(((unsigned long *)argv)+argc)))
+ panic("argc is wrong");
+ if (from_kmem == 1)
+ set_fs(old_fs);
+ len=0; /* remember zero-padding */
+ do {
+ len++;
+ } while (get_fs_byte(tmp++));
+ if (p-len < 0) { /* this shouldn't happen - 128kB */
+ set_fs(old_fs);
+ return 0;
+ }
+ while (len) {
+ --p; --tmp; --len;
+ if (--offset < 0) {
+ offset = p % PAGE_SIZE;
+ if (from_kmem==2)
+ set_fs(old_fs);
+ if (!(pag = (char *) page[p/PAGE_SIZE]) &&
+ !(pag = (char *) (page[p/PAGE_SIZE] =
+ (unsigned long *) get_free_page())))
+ return 0;
+ if (from_kmem==2)
+ set_fs(new_fs);
+
+ }
+ *(pag + offset) = get_fs_byte(tmp);
+ }
+ }
+ if (from_kmem==2)
+ set_fs(old_fs);
+ return p;
+}
+
+static unsigned long change_ldt(unsigned long text_size,unsigned long * page)
+{
+ unsigned long code_limit,data_limit,code_base,data_base;
+ int i;
+
+ code_limit = text_size+PAGE_SIZE -1;
+ code_limit &= 0xFFFFF000;
+ data_limit = 0x4000000;
+ code_base = get_base(current->ldt[1]);
+ data_base = code_base;
+ set_base(current->ldt[1],code_base);
+ set_limit(current->ldt[1],code_limit);
+ set_base(current->ldt[2],data_base);
+ set_limit(current->ldt[2],data_limit);
+/* make sure fs points to the NEW data segment */
+ __asm__("pushl $0x17\n\tpop %%fs"::);
+ data_base += data_limit;
+ for (i=MAX_ARG_PAGES-1 ; i>=0 ; i--) {
+ data_base -= PAGE_SIZE;
+ if (page[i])
+ put_page(page[i],data_base);
+ }
+ return data_limit;
+}
+
+/*
+ * 'do_execve()' executes a new program.
+ */
+int do_execve(unsigned long * eip,long tmp,char * filename,
+ char ** argv, char ** envp)
+{
+ struct m_inode * inode;
+ struct buffer_head * bh;
+ struct exec ex;
+ unsigned long page[MAX_ARG_PAGES];
+ int i,argc,envc;
+ int e_uid, e_gid;
+ int retval;
+ int sh_bang = 0;
+ unsigned long p=PAGE_SIZE*MAX_ARG_PAGES-4;
+
+ if ((0xffff & eip[1]) != 0x000f)
+ panic("execve called from supervisor mode");
+ for (i=0 ; ii_mode)) { /* must be regular file */
+ retval = -EACCES;
+ goto exec_error2;
+ }
+ i = inode->i_mode;
+ e_uid = (i & S_ISUID) ? inode->i_uid : current->euid;
+ e_gid = (i & S_ISGID) ? inode->i_gid : current->egid;
+ if (current->euid == inode->i_uid)
+ i >>= 6;
+ else if (current->egid == inode->i_gid)
+ i >>= 3;
+ if (!(i & 1) &&
+ !((inode->i_mode & 0111) && suser())) {
+ retval = -ENOEXEC;
+ goto exec_error2;
+ }
+ if (!(bh = bread(inode->i_dev,inode->i_zone[0]))) {
+ retval = -EACCES;
+ goto exec_error2;
+ }
+ ex = *((struct exec *) bh->b_data); /* read exec-header */
+ if ((bh->b_data[0] == '#') && (bh->b_data[1] == '!') && (!sh_bang)) {
+ /*
+ * This section does the #! interpretation.
+ * Sorta complicated, but hopefully it will work. -TYT
+ */
+
+ char buf[1023], *cp, *interp, *i_name, *i_arg;
+ unsigned long old_fs;
+
+ strncpy(buf, bh->b_data+2, 1022);
+ brelse(bh);
+ iput(inode);
+ buf[1022] = '\0';
+ if (cp = strchr(buf, '\n')) {
+ *cp = '\0';
+ for (cp = buf; (*cp == ' ') || (*cp == '\t'); cp++);
+ }
+ if (!cp || *cp == '\0') {
+ retval = -ENOEXEC; /* No interpreter name found */
+ goto exec_error1;
+ }
+ interp = i_name = cp;
+ i_arg = 0;
+ for ( ; *cp && (*cp != ' ') && (*cp != '\t'); cp++) {
+ if (*cp == '/')
+ i_name = cp+1;
+ }
+ if (*cp) {
+ *cp++ = '\0';
+ i_arg = cp;
+ }
+ /*
+ * OK, we've parsed out the interpreter name and
+ * (optional) argument.
+ */
+ if (sh_bang++ == 0) {
+ p = copy_strings(envc, envp, page, p, 0);
+ p = copy_strings(--argc, argv+1, page, p, 0);
+ }
+ /*
+ * Splice in (1) the interpreter's name for argv[0]
+ * (2) (optional) argument to interpreter
+ * (3) filename of shell script
+ *
+ * This is done in reverse order, because of how the
+ * user environment and arguments are stored.
+ */
+ p = copy_strings(1, &filename, page, p, 1);
+ argc++;
+ if (i_arg) {
+ p = copy_strings(1, &i_arg, page, p, 2);
+ argc++;
+ }
+ p = copy_strings(1, &i_name, page, p, 2);
+ argc++;
+ if (!p) {
+ retval = -ENOMEM;
+ goto exec_error1;
+ }
+ /*
+ * OK, now restart the process with the interpreter's inode.
+ */
+ old_fs = get_fs();
+ set_fs(get_ds());
+ if (!(inode=namei(interp))) { /* get executables inode */
+ set_fs(old_fs);
+ retval = -ENOENT;
+ goto exec_error1;
+ }
+ set_fs(old_fs);
+ goto restart_interp;
+ }
+ brelse(bh);
+ if (N_MAGIC(ex) != ZMAGIC || ex.a_trsize || ex.a_drsize ||
+ ex.a_text+ex.a_data+ex.a_bss>0x3000000 ||
+ inode->i_size < ex.a_text+ex.a_data+ex.a_syms+N_TXTOFF(ex)) {
+ retval = -ENOEXEC;
+ goto exec_error2;
+ }
+ if (N_TXTOFF(ex) != BLOCK_SIZE) {
+ printk("%s: N_TXTOFF != BLOCK_SIZE. See a.out.h.", filename);
+ retval = -ENOEXEC;
+ goto exec_error2;
+ }
+ if (!sh_bang) {
+ p = copy_strings(envc,envp,page,p,0);
+ p = copy_strings(argc,argv,page,p,0);
+ if (!p) {
+ retval = -ENOMEM;
+ goto exec_error2;
+ }
+ }
+/* OK, This is the point of no return */
+ if (current->executable)
+ iput(current->executable);
+ current->executable = inode;
+ for (i=0 ; i<32 ; i++)
+ current->sigaction[i].sa_handler = NULL;
+ for (i=0 ; iclose_on_exec>>i)&1)
+ sys_close(i);
+ current->close_on_exec = 0;
+ free_page_tables(get_base(current->ldt[1]),get_limit(0x0f));
+ free_page_tables(get_base(current->ldt[2]),get_limit(0x17));
+ if (last_task_used_math == current)
+ last_task_used_math = NULL;
+ current->used_math = 0;
+ p += change_ldt(ex.a_text,page)-MAX_ARG_PAGES*PAGE_SIZE;
+ p = (unsigned long) create_tables((char *)p,argc,envc);
+ current->brk = ex.a_bss +
+ (current->end_data = ex.a_data +
+ (current->end_code = ex.a_text));
+ current->start_stack = p & 0xfffff000;
+ current->euid = e_uid;
+ current->egid = e_gid;
+ i = ex.a_text+ex.a_data;
+ while (i&0xfff)
+ put_fs_byte(0,(char *) (i++));
+ eip[0] = ex.a_entry; /* eip, magic happens :-) */
+ eip[3] = p; /* stack pointer */
+ return 0;
+exec_error2:
+ iput(inode);
+exec_error1:
+ for (i=0 ; i
-#include
-#include
-#include
-#include
-
-#include
-#include
-
-extern int sys_close(int fd);
-
-static int dupfd(unsigned int fd, unsigned int arg)
-{
- if (fd >= NR_OPEN || !current->filp[fd])
- return -EBADF;
- if (arg >= NR_OPEN)
- return -EINVAL;
- while (arg < NR_OPEN)
- if (current->filp[arg])
- arg++;
- else
- break;
- if (arg >= NR_OPEN)
- return -EMFILE;
- current->close_on_exec &= ~(1<filp[arg] = current->filp[fd])->f_count++;
- return arg;
-}
-
-int sys_dup2(unsigned int oldfd, unsigned int newfd)
-{
- sys_close(newfd);
- return dupfd(oldfd,newfd);
-}
-
-int sys_dup(unsigned int fildes)
-{
- return dupfd(fildes,0);
-}
-
-int sys_fcntl(unsigned int fd, unsigned int cmd, unsigned long arg)
-{
- struct file * filp;
-
- if (fd >= NR_OPEN || !(filp = current->filp[fd]))
- return -EBADF;
- switch (cmd) {
- case F_DUPFD:
- return dupfd(fd,arg);
- case F_GETFD:
- return (current->close_on_exec>>fd)&1;
- case F_SETFD:
- if (arg&1)
- current->close_on_exec |= (1<close_on_exec &= ~(1<f_flags;
- case F_SETFL:
- filp->f_flags &= ~(O_APPEND | O_NONBLOCK);
- filp->f_flags |= arg & (O_APPEND | O_NONBLOCK);
- return 0;
- case F_GETLK: case F_SETLK: case F_SETLKW:
- return -1;
- default:
- return -1;
- }
-}
+/*
+ * linux/fs/fcntl.c
+ *
+ * (C) 1991 Linus Torvalds
+ */
+
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+
+extern int sys_close(int fd);
+
+static int dupfd(unsigned int fd, unsigned int arg)
+{
+ if (fd >= NR_OPEN || !current->filp[fd])
+ return -EBADF;
+ if (arg >= NR_OPEN)
+ return -EINVAL;
+ while (arg < NR_OPEN)
+ if (current->filp[arg])
+ arg++;
+ else
+ break;
+ if (arg >= NR_OPEN)
+ return -EMFILE;
+ current->close_on_exec &= ~(1<filp[arg] = current->filp[fd])->f_count++;
+ return arg;
+}
+
+int sys_dup2(unsigned int oldfd, unsigned int newfd)
+{
+ sys_close(newfd);
+ return dupfd(oldfd,newfd);
+}
+
+int sys_dup(unsigned int fildes)
+{
+ return dupfd(fildes,0);
+}
+
+int sys_fcntl(unsigned int fd, unsigned int cmd, unsigned long arg)
+{
+ struct file * filp;
+
+ if (fd >= NR_OPEN || !(filp = current->filp[fd]))
+ return -EBADF;
+ switch (cmd) {
+ case F_DUPFD:
+ return dupfd(fd,arg);
+ case F_GETFD:
+ return (current->close_on_exec>>fd)&1;
+ case F_SETFD:
+ if (arg&1)
+ current->close_on_exec |= (1<close_on_exec &= ~(1<f_flags;
+ case F_SETFL:
+ filp->f_flags &= ~(O_APPEND | O_NONBLOCK);
+ filp->f_flags |= arg & (O_APPEND | O_NONBLOCK);
+ return 0;
+ case F_GETLK: case F_SETLK: case F_SETLKW:
+ return -1;
+ default:
+ return -1;
+ }
+}
diff --git a/linux-0.11-lab - 副本/0/linux/fs/file_dev.c b/linux-0.11-lab - 副本/0/linux/fs/file_dev.c
index 0c50eaa..42eaf37 100644
--- a/linux-0.11-lab - 副本/0/linux/fs/file_dev.c
+++ b/linux-0.11-lab - 副本/0/linux/fs/file_dev.c
@@ -1,90 +1,90 @@
-/*
- * linux/fs/file_dev.c
- *
- * (C) 1991 Linus Torvalds
- */
-
-#include
-#include
-
-#include
-#include
-#include
-
-#define MIN(a,b) (((a)<(b))?(a):(b))
-#define MAX(a,b) (((a)>(b))?(a):(b))
-
-int file_read(struct m_inode * inode, struct file * filp, char * buf, int count)
-{
- int left,chars,nr;
- struct buffer_head * bh;
-
- if ((left=count)<=0)
- return 0;
- while (left) {
- if (nr = bmap(inode,(filp->f_pos)/BLOCK_SIZE)) {
- if (!(bh=bread(inode->i_dev,nr)))
- break;
- } else
- bh = NULL;
- nr = filp->f_pos % BLOCK_SIZE;
- chars = MIN( BLOCK_SIZE-nr , left );
- filp->f_pos += chars;
- left -= chars;
- if (bh) {
- char * p = nr + bh->b_data;
- while (chars-->0)
- put_fs_byte(*(p++),buf++);
- brelse(bh);
- } else {
- while (chars-->0)
- put_fs_byte(0,buf++);
- }
- }
- inode->i_atime = CURRENT_TIME;
- return (count-left)?(count-left):-ERROR;
-}
-
-int file_write(struct m_inode * inode, struct file * filp, char * buf, int count)
-{
- off_t pos;
- int block,c;
- struct buffer_head * bh;
- char * p;
- int i=0;
-
-/*
- * ok, append may not work when many processes are writing at the same time
- * but so what. That way leads to madness anyway.
- */
- if (filp->f_flags & O_APPEND)
- pos = inode->i_size;
- else
- pos = filp->f_pos;
- while (ii_dev,block)))
- break;
- c = pos % BLOCK_SIZE;
- p = c + bh->b_data;
- bh->b_dirt = 1;
- c = BLOCK_SIZE-c;
- if (c > count-i) c = count-i;
- pos += c;
- if (pos > inode->i_size) {
- inode->i_size = pos;
- inode->i_dirt = 1;
- }
- i += c;
- while (c-->0)
- *(p++) = get_fs_byte(buf++);
- brelse(bh);
- }
- inode->i_mtime = CURRENT_TIME;
- if (!(filp->f_flags & O_APPEND)) {
- filp->f_pos = pos;
- inode->i_ctime = CURRENT_TIME;
- }
- return (i?i:-1);
-}
+/*
+ * linux/fs/file_dev.c
+ *
+ * (C) 1991 Linus Torvalds
+ */
+
+#include
+#include
+
+#include
+#include
+#include
+
+#define MIN(a,b) (((a)<(b))?(a):(b))
+#define MAX(a,b) (((a)>(b))?(a):(b))
+
+int file_read(struct m_inode * inode, struct file * filp, char * buf, int count)
+{
+ int left,chars,nr;
+ struct buffer_head * bh;
+
+ if ((left=count)<=0)
+ return 0;
+ while (left) {
+ if (nr = bmap(inode,(filp->f_pos)/BLOCK_SIZE)) {
+ if (!(bh=bread(inode->i_dev,nr)))
+ break;
+ } else
+ bh = NULL;
+ nr = filp->f_pos % BLOCK_SIZE;
+ chars = MIN( BLOCK_SIZE-nr , left );
+ filp->f_pos += chars;
+ left -= chars;
+ if (bh) {
+ char * p = nr + bh->b_data;
+ while (chars-->0)
+ put_fs_byte(*(p++),buf++);
+ brelse(bh);
+ } else {
+ while (chars-->0)
+ put_fs_byte(0,buf++);
+ }
+ }
+ inode->i_atime = CURRENT_TIME;
+ return (count-left)?(count-left):-ERROR;
+}
+
+int file_write(struct m_inode * inode, struct file * filp, char * buf, int count)
+{
+ off_t pos;
+ int block,c;
+ struct buffer_head * bh;
+ char * p;
+ int i=0;
+
+/*
+ * ok, append may not work when many processes are writing at the same time
+ * but so what. That way leads to madness anyway.
+ */
+ if (filp->f_flags & O_APPEND)
+ pos = inode->i_size;
+ else
+ pos = filp->f_pos;
+ while (ii_dev,block)))
+ break;
+ c = pos % BLOCK_SIZE;
+ p = c + bh->b_data;
+ bh->b_dirt = 1;
+ c = BLOCK_SIZE-c;
+ if (c > count-i) c = count-i;
+ pos += c;
+ if (pos > inode->i_size) {
+ inode->i_size = pos;
+ inode->i_dirt = 1;
+ }
+ i += c;
+ while (c-->0)
+ *(p++) = get_fs_byte(buf++);
+ brelse(bh);
+ }
+ inode->i_mtime = CURRENT_TIME;
+ if (!(filp->f_flags & O_APPEND)) {
+ filp->f_pos = pos;
+ inode->i_ctime = CURRENT_TIME;
+ }
+ return (i?i:-1);
+}
diff --git a/linux-0.11-lab - 副本/0/linux/fs/file_table.c b/linux-0.11-lab - 副本/0/linux/fs/file_table.c
index e0589ac..0cf8b1b 100644
--- a/linux-0.11-lab - 副本/0/linux/fs/file_table.c
+++ b/linux-0.11-lab - 副本/0/linux/fs/file_table.c
@@ -1,9 +1,9 @@
-/*
- * linux/fs/file_table.c
- *
- * (C) 1991 Linus Torvalds
- */
-
-#include
-
-struct file file_table[NR_FILE];
+/*
+ * linux/fs/file_table.c
+ *
+ * (C) 1991 Linus Torvalds
+ */
+
+#include
+
+struct file file_table[NR_FILE];
diff --git a/linux-0.11-lab - 副本/0/linux/fs/inode.c b/linux-0.11-lab - 副本/0/linux/fs/inode.c
index 9bb10b3..bb02635 100644
--- a/linux-0.11-lab - 副本/0/linux/fs/inode.c
+++ b/linux-0.11-lab - 副本/0/linux/fs/inode.c
@@ -1,340 +1,340 @@
-/*
- * linux/fs/inode.c
- *
- * (C) 1991 Linus Torvalds
- */
-
-#include
-#include
-
-#include
-#include
-#include
-#include
-
-struct m_inode inode_table[NR_INODE]={{0,},};
-
-static void read_inode(struct m_inode * inode);
-static void write_inode(struct m_inode * inode);
-
-static inline void wait_on_inode(struct m_inode * inode)
-{
- cli();
- while (inode->i_lock)
- sleep_on(&inode->i_wait);
- sti();
-}
-
-static inline void lock_inode(struct m_inode * inode)
-{
- cli();
- while (inode->i_lock)
- sleep_on(&inode->i_wait);
- inode->i_lock=1;
- sti();
-}
-
-static inline void unlock_inode(struct m_inode * inode)
-{
- inode->i_lock=0;
- wake_up(&inode->i_wait);
-}
-
-void invalidate_inodes(int dev)
-{
- int i;
- struct m_inode * inode;
-
- inode = 0+inode_table;
- for(i=0 ; ii_dev == dev) {
- if (inode->i_count)
- printk("inode in use on removed disk\n\r");
- inode->i_dev = inode->i_dirt = 0;
- }
- }
-}
-
-void sync_inodes(void)
-{
- int i;
- struct m_inode * inode;
-
- inode = 0+inode_table;
- for(i=0 ; ii_dirt && !inode->i_pipe)
- write_inode(inode);
- }
-}
-
-static int _bmap(struct m_inode * inode,int block,int create)
-{
- struct buffer_head * bh;
- int i;
-
- if (block<0)
- panic("_bmap: block<0");
- if (block >= 7+512+512*512)
- panic("_bmap: block>big");
- if (block<7) {
- if (create && !inode->i_zone[block])
- if (inode->i_zone[block]=new_block(inode->i_dev)) {
- inode->i_ctime=CURRENT_TIME;
- inode->i_dirt=1;
- }
- return inode->i_zone[block];
- }
- block -= 7;
- if (block<512) {
- if (create && !inode->i_zone[7])
- if (inode->i_zone[7]=new_block(inode->i_dev)) {
- inode->i_dirt=1;
- inode->i_ctime=CURRENT_TIME;
- }
- if (!inode->i_zone[7])
- return 0;
- if (!(bh = bread(inode->i_dev,inode->i_zone[7])))
- return 0;
- i = ((unsigned short *) (bh->b_data))[block];
- if (create && !i)
- if (i=new_block(inode->i_dev)) {
- ((unsigned short *) (bh->b_data))[block]=i;
- bh->b_dirt=1;
- }
- brelse(bh);
- return i;
- }
- block -= 512;
- if (create && !inode->i_zone[8])
- if (inode->i_zone[8]=new_block(inode->i_dev)) {
- inode->i_dirt=1;
- inode->i_ctime=CURRENT_TIME;
- }
- if (!inode->i_zone[8])
- return 0;
- if (!(bh=bread(inode->i_dev,inode->i_zone[8])))
- return 0;
- i = ((unsigned short *)bh->b_data)[block>>9];
- if (create && !i)
- if (i=new_block(inode->i_dev)) {
- ((unsigned short *) (bh->b_data))[block>>9]=i;
- bh->b_dirt=1;
- }
- brelse(bh);
- if (!i)
- return 0;
- if (!(bh=bread(inode->i_dev,i)))
- return 0;
- i = ((unsigned short *)bh->b_data)[block&511];
- if (create && !i)
- if (i=new_block(inode->i_dev)) {
- ((unsigned short *) (bh->b_data))[block&511]=i;
- bh->b_dirt=1;
- }
- brelse(bh);
- return i;
-}
-
-int bmap(struct m_inode * inode,int block)
-{
- return _bmap(inode,block,0);
-}
-
-int create_block(struct m_inode * inode, int block)
-{
- return _bmap(inode,block,1);
-}
-
-void iput(struct m_inode * inode)
-{
- if (!inode)
- return;
- wait_on_inode(inode);
- if (!inode->i_count)
- panic("iput: trying to free free inode");
- if (inode->i_pipe) {
- wake_up(&inode->i_wait);
- if (--inode->i_count)
- return;
- free_page(inode->i_size);
- inode->i_count=0;
- inode->i_dirt=0;
- inode->i_pipe=0;
- return;
- }
- if (!inode->i_dev) {
- inode->i_count--;
- return;
- }
- if (S_ISBLK(inode->i_mode)) {
- sync_dev(inode->i_zone[0]);
- wait_on_inode(inode);
- }
-repeat:
- if (inode->i_count>1) {
- inode->i_count--;
- return;
- }
- if (!inode->i_nlinks) {
- truncate(inode);
- free_inode(inode);
- return;
- }
- if (inode->i_dirt) {
- write_inode(inode); /* we can sleep - so do again */
- wait_on_inode(inode);
- goto repeat;
- }
- inode->i_count--;
- return;
-}
-
-struct m_inode * get_empty_inode(void)
-{
- struct m_inode * inode;
- static struct m_inode * last_inode = inode_table;
- int i;
-
- do {
- inode = NULL;
- for (i = NR_INODE; i ; i--) {
- if (++last_inode >= inode_table + NR_INODE)
- last_inode = inode_table;
- if (!last_inode->i_count) {
- inode = last_inode;
- if (!inode->i_dirt && !inode->i_lock)
- break;
- }
- }
- if (!inode) {
- for (i=0 ; ii_dirt) {
- write_inode(inode);
- wait_on_inode(inode);
- }
- } while (inode->i_count);
- memset(inode,0,sizeof(*inode));
- inode->i_count = 1;
- return inode;
-}
-
-struct m_inode * get_pipe_inode(void)
-{
- struct m_inode * inode;
-
- if (!(inode = get_empty_inode()))
- return NULL;
- if (!(inode->i_size=get_free_page())) {
- inode->i_count = 0;
- return NULL;
- }
- inode->i_count = 2; /* sum of readers/writers */
- PIPE_HEAD(*inode) = PIPE_TAIL(*inode) = 0;
- inode->i_pipe = 1;
- return inode;
-}
-
-struct m_inode * iget(int dev,int nr)
-{
- struct m_inode * inode, * empty;
-
- if (!dev)
- panic("iget with dev==0");
- empty = get_empty_inode();
- inode = inode_table;
- while (inode < NR_INODE+inode_table) {
- if (inode->i_dev != dev || inode->i_num != nr) {
- inode++;
- continue;
- }
- wait_on_inode(inode);
- if (inode->i_dev != dev || inode->i_num != nr) {
- inode = inode_table;
- continue;
- }
- inode->i_count++;
- if (inode->i_mount) {
- int i;
-
- for (i = 0 ; i= NR_SUPER) {
- printk("Mounted inode hasn't got sb\n");
- if (empty)
- iput(empty);
- return inode;
- }
- iput(inode);
- dev = super_block[i].s_dev;
- nr = ROOT_INO;
- inode = inode_table;
- continue;
- }
- if (empty)
- iput(empty);
- return inode;
- }
- if (!empty)
- return (NULL);
- inode=empty;
- inode->i_dev = dev;
- inode->i_num = nr;
- read_inode(inode);
- return inode;
-}
-
-static void read_inode(struct m_inode * inode)
-{
- struct super_block * sb;
- struct buffer_head * bh;
- int block;
-
- lock_inode(inode);
- if (!(sb=get_super(inode->i_dev)))
- panic("trying to read inode without dev");
- block = 2 + sb->s_imap_blocks + sb->s_zmap_blocks +
- (inode->i_num-1)/INODES_PER_BLOCK;
- if (!(bh=bread(inode->i_dev,block)))
- panic("unable to read i-node block");
- __asm__ volatile ("cld"); /* by wyj */
- *(struct d_inode *)inode =
- ((struct d_inode *)bh->b_data)
- [(inode->i_num-1)%INODES_PER_BLOCK];
- brelse(bh);
- unlock_inode(inode);
-}
-
-static void write_inode(struct m_inode * inode)
-{
- struct super_block * sb;
- struct buffer_head * bh;
- int block;
-
- lock_inode(inode);
- if (!inode->i_dirt || !inode->i_dev) {
- unlock_inode(inode);
- return;
- }
- if (!(sb=get_super(inode->i_dev)))
- panic("trying to write inode without device");
- block = 2 + sb->s_imap_blocks + sb->s_zmap_blocks +
- (inode->i_num-1)/INODES_PER_BLOCK;
- if (!(bh=bread(inode->i_dev,block)))
- panic("unable to read i-node block");
- __asm__ volatile ("cld"); /* by wyj */
- ((struct d_inode *)bh->b_data)
- [(inode->i_num-1)%INODES_PER_BLOCK] =
- *(struct d_inode *)inode;
- bh->b_dirt=1;
- inode->i_dirt=0;
- brelse(bh);
- unlock_inode(inode);
-}
+/*
+ * linux/fs/inode.c
+ *
+ * (C) 1991 Linus Torvalds
+ */
+
+#include
+#include
+
+#include
+#include
+#include
+#include
+
+struct m_inode inode_table[NR_INODE]={{0,},};
+
+static void read_inode(struct m_inode * inode);
+static void write_inode(struct m_inode * inode);
+
+static inline void wait_on_inode(struct m_inode * inode)
+{
+ cli();
+ while (inode->i_lock)
+ sleep_on(&inode->i_wait);
+ sti();
+}
+
+static inline void lock_inode(struct m_inode * inode)
+{
+ cli();
+ while (inode->i_lock)
+ sleep_on(&inode->i_wait);
+ inode->i_lock=1;
+ sti();
+}
+
+static inline void unlock_inode(struct m_inode * inode)
+{
+ inode->i_lock=0;
+ wake_up(&inode->i_wait);
+}
+
+void invalidate_inodes(int dev)
+{
+ int i;
+ struct m_inode * inode;
+
+ inode = 0+inode_table;
+ for(i=0 ; ii_dev == dev) {
+ if (inode->i_count)
+ printk("inode in use on removed disk\n\r");
+ inode->i_dev = inode->i_dirt = 0;
+ }
+ }
+}
+
+void sync_inodes(void)
+{
+ int i;
+ struct m_inode * inode;
+
+ inode = 0+inode_table;
+ for(i=0 ; ii_dirt && !inode->i_pipe)
+ write_inode(inode);
+ }
+}
+
+static int _bmap(struct m_inode * inode,int block,int create)
+{
+ struct buffer_head * bh;
+ int i;
+
+ if (block<0)
+ panic("_bmap: block<0");
+ if (block >= 7+512+512*512)
+ panic("_bmap: block>big");
+ if (block<7) {
+ if (create && !inode->i_zone[block])
+ if (inode->i_zone[block]=new_block(inode->i_dev)) {
+ inode->i_ctime=CURRENT_TIME;
+ inode->i_dirt=1;
+ }
+ return inode->i_zone[block];
+ }
+ block -= 7;
+ if (block<512) {
+ if (create && !inode->i_zone[7])
+ if (inode->i_zone[7]=new_block(inode->i_dev)) {
+ inode->i_dirt=1;
+ inode->i_ctime=CURRENT_TIME;
+ }
+ if (!inode->i_zone[7])
+ return 0;
+ if (!(bh = bread(inode->i_dev,inode->i_zone[7])))
+ return 0;
+ i = ((unsigned short *) (bh->b_data))[block];
+ if (create && !i)
+ if (i=new_block(inode->i_dev)) {
+ ((unsigned short *) (bh->b_data))[block]=i;
+ bh->b_dirt=1;
+ }
+ brelse(bh);
+ return i;
+ }
+ block -= 512;
+ if (create && !inode->i_zone[8])
+ if (inode->i_zone[8]=new_block(inode->i_dev)) {
+ inode->i_dirt=1;
+ inode->i_ctime=CURRENT_TIME;
+ }
+ if (!inode->i_zone[8])
+ return 0;
+ if (!(bh=bread(inode->i_dev,inode->i_zone[8])))
+ return 0;
+ i = ((unsigned short *)bh->b_data)[block>>9];
+ if (create && !i)
+ if (i=new_block(inode->i_dev)) {
+ ((unsigned short *) (bh->b_data))[block>>9]=i;
+ bh->b_dirt=1;
+ }
+ brelse(bh);
+ if (!i)
+ return 0;
+ if (!(bh=bread(inode->i_dev,i)))
+ return 0;
+ i = ((unsigned short *)bh->b_data)[block&511];
+ if (create && !i)
+ if (i=new_block(inode->i_dev)) {
+ ((unsigned short *) (bh->b_data))[block&511]=i;
+ bh->b_dirt=1;
+ }
+ brelse(bh);
+ return i;
+}
+
+int bmap(struct m_inode * inode,int block)
+{
+ return _bmap(inode,block,0);
+}
+
+int create_block(struct m_inode * inode, int block)
+{
+ return _bmap(inode,block,1);
+}
+
+void iput(struct m_inode * inode)
+{
+ if (!inode)
+ return;
+ wait_on_inode(inode);
+ if (!inode->i_count)
+ panic("iput: trying to free free inode");
+ if (inode->i_pipe) {
+ wake_up(&inode->i_wait);
+ if (--inode->i_count)
+ return;
+ free_page(inode->i_size);
+ inode->i_count=0;
+ inode->i_dirt=0;
+ inode->i_pipe=0;
+ return;
+ }
+ if (!inode->i_dev) {
+ inode->i_count--;
+ return;
+ }
+ if (S_ISBLK(inode->i_mode)) {
+ sync_dev(inode->i_zone[0]);
+ wait_on_inode(inode);
+ }
+repeat:
+ if (inode->i_count>1) {
+ inode->i_count--;
+ return;
+ }
+ if (!inode->i_nlinks) {
+ truncate(inode);
+ free_inode(inode);
+ return;
+ }
+ if (inode->i_dirt) {
+ write_inode(inode); /* we can sleep - so do again */
+ wait_on_inode(inode);
+ goto repeat;
+ }
+ inode->i_count--;
+ return;
+}
+
+struct m_inode * get_empty_inode(void)
+{
+ struct m_inode * inode;
+ static struct m_inode * last_inode = inode_table;
+ int i;
+
+ do {
+ inode = NULL;
+ for (i = NR_INODE; i ; i--) {
+ if (++last_inode >= inode_table + NR_INODE)
+ last_inode = inode_table;
+ if (!last_inode->i_count) {
+ inode = last_inode;
+ if (!inode->i_dirt && !inode->i_lock)
+ break;
+ }
+ }
+ if (!inode) {
+ for (i=0 ; ii_dirt) {
+ write_inode(inode);
+ wait_on_inode(inode);
+ }
+ } while (inode->i_count);
+ memset(inode,0,sizeof(*inode));
+ inode->i_count = 1;
+ return inode;
+}
+
+struct m_inode * get_pipe_inode(void)
+{
+ struct m_inode * inode;
+
+ if (!(inode = get_empty_inode()))
+ return NULL;
+ if (!(inode->i_size=get_free_page())) {
+ inode->i_count = 0;
+ return NULL;
+ }
+ inode->i_count = 2; /* sum of readers/writers */
+ PIPE_HEAD(*inode) = PIPE_TAIL(*inode) = 0;
+ inode->i_pipe = 1;
+ return inode;
+}
+
+struct m_inode * iget(int dev,int nr)
+{
+ struct m_inode * inode, * empty;
+
+ if (!dev)
+ panic("iget with dev==0");
+ empty = get_empty_inode();
+ inode = inode_table;
+ while (inode < NR_INODE+inode_table) {
+ if (inode->i_dev != dev || inode->i_num != nr) {
+ inode++;
+ continue;
+ }
+ wait_on_inode(inode);
+ if (inode->i_dev != dev || inode->i_num != nr) {
+ inode = inode_table;
+ continue;
+ }
+ inode->i_count++;
+ if (inode->i_mount) {
+ int i;
+
+ for (i = 0 ; i= NR_SUPER) {
+ printk("Mounted inode hasn't got sb\n");
+ if (empty)
+ iput(empty);
+ return inode;
+ }
+ iput(inode);
+ dev = super_block[i].s_dev;
+ nr = ROOT_INO;
+ inode = inode_table;
+ continue;
+ }
+ if (empty)
+ iput(empty);
+ return inode;
+ }
+ if (!empty)
+ return (NULL);
+ inode=empty;
+ inode->i_dev = dev;
+ inode->i_num = nr;
+ read_inode(inode);
+ return inode;
+}
+
+static void read_inode(struct m_inode * inode)
+{
+ struct super_block * sb;
+ struct buffer_head * bh;
+ int block;
+
+ lock_inode(inode);
+ if (!(sb=get_super(inode->i_dev)))
+ panic("trying to read inode without dev");
+ block = 2 + sb->s_imap_blocks + sb->s_zmap_blocks +
+ (inode->i_num-1)/INODES_PER_BLOCK;
+ if (!(bh=bread(inode->i_dev,block)))
+ panic("unable to read i-node block");
+ __asm__ volatile ("cld"); /* by wyj */
+ *(struct d_inode *)inode =
+ ((struct d_inode *)bh->b_data)
+ [(inode->i_num-1)%INODES_PER_BLOCK];
+ brelse(bh);
+ unlock_inode(inode);
+}
+
+static void write_inode(struct m_inode * inode)
+{
+ struct super_block * sb;
+ struct buffer_head * bh;
+ int block;
+
+ lock_inode(inode);
+ if (!inode->i_dirt || !inode->i_dev) {
+ unlock_inode(inode);
+ return;
+ }
+ if (!(sb=get_super(inode->i_dev)))
+ panic("trying to write inode without device");
+ block = 2 + sb->s_imap_blocks + sb->s_zmap_blocks +
+ (inode->i_num-1)/INODES_PER_BLOCK;
+ if (!(bh=bread(inode->i_dev,block)))
+ panic("unable to read i-node block");
+ __asm__ volatile ("cld"); /* by wyj */
+ ((struct d_inode *)bh->b_data)
+ [(inode->i_num-1)%INODES_PER_BLOCK] =
+ *(struct d_inode *)inode;
+ bh->b_dirt=1;
+ inode->i_dirt=0;
+ brelse(bh);
+ unlock_inode(inode);
+}
diff --git a/linux-0.11-lab - 副本/0/linux/fs/ioctl.c b/linux-0.11-lab - 副本/0/linux/fs/ioctl.c
index 36fc976..b4b83d6 100644
--- a/linux-0.11-lab - 副本/0/linux/fs/ioctl.c
+++ b/linux-0.11-lab - 副本/0/linux/fs/ioctl.c
@@ -1,46 +1,46 @@
-/*
- * linux/fs/ioctl.c
- *
- * (C) 1991 Linus Torvalds
- */
-
-#include
-#include
-#include
-
-#include
-
-extern int tty_ioctl(int dev, int cmd, int arg);
-
-typedef int (*ioctl_ptr)(int dev,int cmd,int arg);
-
-#define NRDEVS ((sizeof (ioctl_table))/(sizeof (ioctl_ptr)))
-
-static ioctl_ptr ioctl_table[]={
- NULL, /* nodev */
- NULL, /* /dev/mem */
- NULL, /* /dev/fd */
- NULL, /* /dev/hd */
- tty_ioctl, /* /dev/ttyx */
- tty_ioctl, /* /dev/tty */
- NULL, /* /dev/lp */
- NULL}; /* named pipes */
-
-
-int sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
-{
- struct file * filp;
- int dev,mode;
-
- if (fd >= NR_OPEN || !(filp = current->filp[fd]))
- return -EBADF;
- mode=filp->f_inode->i_mode;
- if (!S_ISCHR(mode) && !S_ISBLK(mode))
- return -EINVAL;
- dev = filp->f_inode->i_zone[0];
- if (MAJOR(dev) >= NRDEVS)
- return -ENODEV;
- if (!ioctl_table[MAJOR(dev)])
- return -ENOTTY;
- return ioctl_table[MAJOR(dev)](dev,cmd,arg);
-}
+/*
+ * linux/fs/ioctl.c
+ *
+ * (C) 1991 Linus Torvalds
+ */
+
+#include
+#include
+#include
+
+#include
+
+extern int tty_ioctl(int dev, int cmd, int arg);
+
+typedef int (*ioctl_ptr)(int dev,int cmd,int arg);
+
+#define NRDEVS ((sizeof (ioctl_table))/(sizeof (ioctl_ptr)))
+
+static ioctl_ptr ioctl_table[]={
+ NULL, /* nodev */
+ NULL, /* /dev/mem */
+ NULL, /* /dev/fd */
+ NULL, /* /dev/hd */
+ tty_ioctl, /* /dev/ttyx */
+ tty_ioctl, /* /dev/tty */
+ NULL, /* /dev/lp */
+ NULL}; /* named pipes */
+
+
+int sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
+{
+ struct file * filp;
+ int dev,mode;
+
+ if (fd >= NR_OPEN || !(filp = current->filp[fd]))
+ return -EBADF;
+ mode=filp->f_inode->i_mode;
+ if (!S_ISCHR(mode) && !S_ISBLK(mode))
+ return -EINVAL;
+ dev = filp->f_inode->i_zone[0];
+ if (MAJOR(dev) >= NRDEVS)
+ return -ENODEV;
+ if (!ioctl_table[MAJOR(dev)])
+ return -ENOTTY;
+ return ioctl_table[MAJOR(dev)](dev,cmd,arg);
+}
diff --git a/linux-0.11-lab - 副本/0/linux/fs/namei.c b/linux-0.11-lab - 副本/0/linux/fs/namei.c
index f8a02b9..c7a10c7 100644
--- a/linux-0.11-lab - 副本/0/linux/fs/namei.c
+++ b/linux-0.11-lab - 副本/0/linux/fs/namei.c
@@ -1,783 +1,783 @@
-/*
- * linux/fs/namei.c
- *
- * (C) 1991 Linus Torvalds
- */
-
-/*
- * Some corrections by tytso.
- */
-
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-#include
-
-#define ACC_MODE(x) ("\004\002\006\377"[(x)&O_ACCMODE])
-
-/*
- * comment out this line if you want names > NAME_LEN chars to be
- * truncated. Else they will be disallowed.
- */
-/* #define NO_TRUNCATE */
-
-#define MAY_EXEC 1
-#define MAY_WRITE 2
-#define MAY_READ 4
-
-/*
- * permission()
- *
- * is used to check for read/write/execute permissions on a file.
- * I don't know if we should look at just the euid or both euid and
- * uid, but that should be easily changed.
- */
-static int permission(struct m_inode * inode,int mask)
-{
- int mode = inode->i_mode;
-
-/* special case: not even root can read/write a deleted file */
- if (inode->i_dev && !inode->i_nlinks)
- return 0;
- else if (current->euid==inode->i_uid)
- mode >>= 6;
- else if (current->egid==inode->i_gid)
- mode >>= 3;
- if (((mode & mask & 0007) == mask) || suser())
- return 1;
- return 0;
-}
-
-/*
- * ok, we cannot use strncmp, as the name is not in our data space.
- * Thus we'll have to use match. No big problem. Match also makes
- * some sanity tests.
- *
- * NOTE! unlike strncmp, match returns 1 for success, 0 for failure.
- */
-static int match(int len,const char * name,struct dir_entry * de)
-{
- register int same __asm__("ax");
-
- if (!de || !de->inode || len > NAME_LEN)
- return 0;
- if (len < NAME_LEN && de->name[len])
- return 0;
- __asm__("cld\n\t"
- "fs ; repe ; cmpsb\n\t"
- "setz %%al"
- :"=a" (same)
- :"0" (0),"S" ((long) name),"D" ((long) de->name),"c" (len)
- );
- return same;
-}
-
-/*
- * find_entry()
- *
- * finds an entry in the specified directory with the wanted name. It
- * returns the cache buffer in which the entry was found, and the entry
- * itself (as a parameter - res_dir). It does NOT read the inode of the
- * entry - you'll have to do that yourself if you want to.
- *
- * This also takes care of the few special cases due to '..'-traversal
- * over a pseudo-root and a mount point.
- */
-static struct buffer_head * find_entry(struct m_inode ** dir,
- const char * name, int namelen, struct dir_entry ** res_dir)
-{
- int entries;
- int block,i;
- struct buffer_head * bh;
- struct dir_entry * de;
- struct super_block * sb;
-
-#ifdef NO_TRUNCATE
- if (namelen > NAME_LEN)
- return NULL;
-#else
- if (namelen > NAME_LEN)
- namelen = NAME_LEN;
-#endif
- entries = (*dir)->i_size / (sizeof (struct dir_entry));
- *res_dir = NULL;
- if (!namelen)
- return NULL;
-/* check for '..', as we might have to do some "magic" for it */
- if (namelen==2 && get_fs_byte(name)=='.' && get_fs_byte(name+1)=='.') {
-/* '..' in a pseudo-root results in a faked '.' (just change namelen) */
- if ((*dir) == current->root)
- namelen=1;
- else if ((*dir)->i_num == ROOT_INO) {
-/* '..' over a mount-point results in 'dir' being exchanged for the mounted
- directory-inode. NOTE! We set mounted, so that we can iput the new dir */
- sb=get_super((*dir)->i_dev);
- if (sb->s_imount) {
- iput(*dir);
- (*dir)=sb->s_imount;
- (*dir)->i_count++;
- }
- }
- }
- if (!(block = (*dir)->i_zone[0]))
- return NULL;
- if (!(bh = bread((*dir)->i_dev,block)))
- return NULL;
- i = 0;
- de = (struct dir_entry *) bh->b_data;
- while (i < entries) {
- if ((char *)de >= BLOCK_SIZE+bh->b_data) {
- brelse(bh);
- bh = NULL;
- if (!(block = bmap(*dir,i/DIR_ENTRIES_PER_BLOCK)) ||
- !(bh = bread((*dir)->i_dev,block))) {
- i += DIR_ENTRIES_PER_BLOCK;
- continue;
- }
- de = (struct dir_entry *) bh->b_data;
- }
- if (match(namelen,name,de)) {
- *res_dir = de;
- return bh;
- }
- de++;
- i++;
- }
- brelse(bh);
- return NULL;
-}
-
-/*
- * add_entry()
- *
- * adds a file entry to the specified directory, using the same
- * semantics as find_entry(). It returns NULL if it failed.
- *
- * NOTE!! The inode part of 'de' is left at 0 - which means you
- * may not sleep between calling this and putting something into
- * the entry, as someone else might have used it while you slept.
- */
-static struct buffer_head * add_entry(struct m_inode * dir,
- const char * name, int namelen, struct dir_entry ** res_dir)
-{
- int block,i;
- struct buffer_head * bh;
- struct dir_entry * de;
-
- *res_dir = NULL;
-#ifdef NO_TRUNCATE
- if (namelen > NAME_LEN)
- return NULL;
-#else
- if (namelen > NAME_LEN)
- namelen = NAME_LEN;
-#endif
- if (!namelen)
- return NULL;
- if (!(block = dir->i_zone[0]))
- return NULL;
- if (!(bh = bread(dir->i_dev,block)))
- return NULL;
- i = 0;
- de = (struct dir_entry *) bh->b_data;
- while (1) {
- if ((char *)de >= BLOCK_SIZE+bh->b_data) {
- brelse(bh);
- bh = NULL;
- block = create_block(dir,i/DIR_ENTRIES_PER_BLOCK);
- if (!block)
- return NULL;
- if (!(bh = bread(dir->i_dev,block))) {
- i += DIR_ENTRIES_PER_BLOCK;
- continue;
- }
- de = (struct dir_entry *) bh->b_data;
- }
- if (i*sizeof(struct dir_entry) >= dir->i_size) {
- de->inode=0;
- dir->i_size = (i+1)*sizeof(struct dir_entry);
- dir->i_dirt = 1;
- dir->i_ctime = CURRENT_TIME;
- }
- if (!de->inode) {
- dir->i_mtime = CURRENT_TIME;
- for (i=0; i < NAME_LEN ; i++)
- de->name[i]=(ib_dirt = 1;
- *res_dir = de;
- return bh;
- }
- de++;
- i++;
- }
- brelse(bh);
- return NULL;
-}
-
-/*
- * get_dir()
- *
- * Getdir traverses the pathname until it hits the topmost directory.
- * It returns NULL on failure.
- */
-static struct m_inode * get_dir(const char * pathname)
-{
- char c;
- const char * thisname;
- struct m_inode * inode;
- struct buffer_head * bh;
- int namelen,inr,idev;
- struct dir_entry * de;
-
- if (!current->root || !current->root->i_count)
- panic("No root inode");
- if (!current->pwd || !current->pwd->i_count)
- panic("No cwd inode");
- if ((c=get_fs_byte(pathname))=='/') {
- inode = current->root;
- pathname++;
- } else if (c)
- inode = current->pwd;
- else
- return NULL; /* empty name is bad */
- inode->i_count++;
- while (1) {
- thisname = pathname;
- if (!S_ISDIR(inode->i_mode) || !permission(inode,MAY_EXEC)) {
- iput(inode);
- return NULL;
- }
- for(namelen=0;(c=get_fs_byte(pathname++))&&(c!='/');namelen++)
- /* nothing */ ;
- if (!c)
- return inode;
- if (!(bh = find_entry(&inode,thisname,namelen,&de))) {
- iput(inode);
- return NULL;
- }
- inr = de->inode;
- idev = inode->i_dev;
- brelse(bh);
- iput(inode);
- if (!(inode = iget(idev,inr)))
- return NULL;
- }
-}
-
-/*
- * dir_namei()
- *
- * dir_namei() returns the inode of the directory of the
- * specified name, and the name within that directory.
- */
-static struct m_inode * dir_namei(const char * pathname,
- int * namelen, const char ** name)
-{
- char c;
- const char * basename;
- struct m_inode * dir;
-
- if (!(dir = get_dir(pathname)))
- return NULL;
- basename = pathname;
- while (c=get_fs_byte(pathname++))
- if (c=='/')
- basename=pathname;
- *namelen = pathname-basename-1;
- *name = basename;
- return dir;
-}
-
-/*
- * namei()
- *
- * is used by most simple commands to get the inode of a specified name.
- * Open, link etc use their own routines, but this is enough for things
- * like 'chmod' etc.
- */
-struct m_inode * namei(const char * pathname)
-{
- const char * basename;
- int inr,dev,namelen;
- struct m_inode * dir;
- struct buffer_head * bh;
- struct dir_entry * de;
-
- if (!(dir = dir_namei(pathname,&namelen,&basename)))
- return NULL;
- if (!namelen) /* special case: '/usr/' etc */
- return dir;
- bh = find_entry(&dir,basename,namelen,&de);
- if (!bh) {
- iput(dir);
- return NULL;
- }
- inr = de->inode;
- dev = dir->i_dev;
- brelse(bh);
- iput(dir);
- dir=iget(dev,inr);
- if (dir) {
- dir->i_atime=CURRENT_TIME;
- dir->i_dirt=1;
- }
- return dir;
-}
-
-/*
- * open_namei()
- *
- * namei for open - this is in fact almost the whole open-routine.
- */
-int open_namei(const char * pathname, int flag, int mode,
- struct m_inode ** res_inode)
-{
- const char * basename;
- int inr,dev,namelen;
- struct m_inode * dir, *inode;
- struct buffer_head * bh;
- struct dir_entry * de;
-
- if ((flag & O_TRUNC) && !(flag & O_ACCMODE))
- flag |= O_WRONLY;
- mode &= 0777 & ~current->umask;
- mode |= I_REGULAR;
- if (!(dir = dir_namei(pathname,&namelen,&basename)))
- return -ENOENT;
- if (!namelen) { /* special case: '/usr/' etc */
- if (!(flag & (O_ACCMODE|O_CREAT|O_TRUNC))) {
- *res_inode=dir;
- return 0;
- }
- iput(dir);
- return -EISDIR;
- }
- bh = find_entry(&dir,basename,namelen,&de);
- if (!bh) {
- if (!(flag & O_CREAT)) {
- iput(dir);
- return -ENOENT;
- }
- if (!permission(dir,MAY_WRITE)) {
- iput(dir);
- return -EACCES;
- }
- inode = new_inode(dir->i_dev);
- if (!inode) {
- iput(dir);
- return -ENOSPC;
- }
- inode->i_uid = current->euid;
- inode->i_mode = mode;
- inode->i_dirt = 1;
- bh = add_entry(dir,basename,namelen,&de);
- if (!bh) {
- inode->i_nlinks--;
- iput(inode);
- iput(dir);
- return -ENOSPC;
- }
- de->inode = inode->i_num;
- bh->b_dirt = 1;
- brelse(bh);
- iput(dir);
- *res_inode = inode;
- return 0;
- }
- inr = de->inode;
- dev = dir->i_dev;
- brelse(bh);
- iput(dir);
- if (flag & O_EXCL)
- return -EEXIST;
- if (!(inode=iget(dev,inr)))
- return -EACCES;
- if ((S_ISDIR(inode->i_mode) && (flag & O_ACCMODE)) ||
- !permission(inode,ACC_MODE(flag))) {
- iput(inode);
- return -EPERM;
- }
- inode->i_atime = CURRENT_TIME;
- if (flag & O_TRUNC)
- truncate(inode);
- *res_inode = inode;
- return 0;
-}
-
-int sys_mknod(const char * filename, int mode, int dev)
-{
- const char * basename;
- int namelen;
- struct m_inode * dir, * inode;
- struct buffer_head * bh;
- struct dir_entry * de;
-
- if (!suser())
- return -EPERM;
- if (!(dir = dir_namei(filename,&namelen,&basename)))
- return -ENOENT;
- if (!namelen) {
- iput(dir);
- return -ENOENT;
- }
- if (!permission(dir,MAY_WRITE)) {
- iput(dir);
- return -EPERM;
- }
- bh = find_entry(&dir,basename,namelen,&de);
- if (bh) {
- brelse(bh);
- iput(dir);
- return -EEXIST;
- }
- inode = new_inode(dir->i_dev);
- if (!inode) {
- iput(dir);
- return -ENOSPC;
- }
- inode->i_mode = mode;
- if (S_ISBLK(mode) || S_ISCHR(mode))
- inode->i_zone[0] = dev;
- inode->i_mtime = inode->i_atime = CURRENT_TIME;
- inode->i_dirt = 1;
- bh = add_entry(dir,basename,namelen,&de);
- if (!bh) {
- iput(dir);
- inode->i_nlinks=0;
- iput(inode);
- return -ENOSPC;
- }
- de->inode = inode->i_num;
- bh->b_dirt = 1;
- iput(dir);
- iput(inode);
- brelse(bh);
- return 0;
-}
-
-int sys_mkdir(const char * pathname, int mode)
-{
- const char * basename;
- int namelen;
- struct m_inode * dir, * inode;
- struct buffer_head * bh, *dir_block;
- struct dir_entry * de;
-
- if (!suser())
- return -EPERM;
- if (!(dir = dir_namei(pathname,&namelen,&basename)))
- return -ENOENT;
- if (!namelen) {
- iput(dir);
- return -ENOENT;
- }
- if (!permission(dir,MAY_WRITE)) {
- iput(dir);
- return -EPERM;
- }
- bh = find_entry(&dir,basename,namelen,&de);
- if (bh) {
- brelse(bh);
- iput(dir);
- return -EEXIST;
- }
- inode = new_inode(dir->i_dev);
- if (!inode) {
- iput(dir);
- return -ENOSPC;
- }
- inode->i_size = 32;
- inode->i_dirt = 1;
- inode->i_mtime = inode->i_atime = CURRENT_TIME;
- if (!(inode->i_zone[0]=new_block(inode->i_dev))) {
- iput(dir);
- inode->i_nlinks--;
- iput(inode);
- return -ENOSPC;
- }
- inode->i_dirt = 1;
- if (!(dir_block=bread(inode->i_dev,inode->i_zone[0]))) {
- iput(dir);
- free_block(inode->i_dev,inode->i_zone[0]);
- inode->i_nlinks--;
- iput(inode);
- return -ERROR;
- }
- de = (struct dir_entry *) dir_block->b_data;
- de->inode=inode->i_num;
- strcpy(de->name,".");
- de++;
- de->inode = dir->i_num;
- strcpy(de->name,"..");
- inode->i_nlinks = 2;
- dir_block->b_dirt = 1;
- brelse(dir_block);
- inode->i_mode = I_DIRECTORY | (mode & 0777 & ~current->umask);
- inode->i_dirt = 1;
- bh = add_entry(dir,basename,namelen,&de);
- if (!bh) {
- iput(dir);
- free_block(inode->i_dev,inode->i_zone[0]);
- inode->i_nlinks=0;
- iput(inode);
- return -ENOSPC;
- }
- de->inode = inode->i_num;
- bh->b_dirt = 1;
- dir->i_nlinks++;
- dir->i_dirt = 1;
- iput(dir);
- iput(inode);
- brelse(bh);
- return 0;
-}
-
-/*
- * routine to check that the specified directory is empty (for rmdir)
- */
-static int empty_dir(struct m_inode * inode)
-{
- int nr,block;
- int len;
- struct buffer_head * bh;
- struct dir_entry * de;
-
- len = inode->i_size / sizeof (struct dir_entry);
- if (len<2 || !inode->i_zone[0] ||
- !(bh=bread(inode->i_dev,inode->i_zone[0]))) {
- printk("warning - bad directory on dev %04x\n",inode->i_dev);
- return 0;
- }
- de = (struct dir_entry *) bh->b_data;
- if (de[0].inode != inode->i_num || !de[1].inode ||
- strcmp(".",de[0].name) || strcmp("..",de[1].name)) {
- printk("warning - bad directory on dev %04x\n",inode->i_dev);
- return 0;
- }
- nr = 2;
- de += 2;
- while (nr= (void *) (bh->b_data+BLOCK_SIZE)) {
- brelse(bh);
- block=bmap(inode,nr/DIR_ENTRIES_PER_BLOCK);
- if (!block) {
- nr += DIR_ENTRIES_PER_BLOCK;
- continue;
- }
- if (!(bh=bread(inode->i_dev,block)))
- return 0;
- de = (struct dir_entry *) bh->b_data;
- }
- if (de->inode) {
- brelse(bh);
- return 0;
- }
- de++;
- nr++;
- }
- brelse(bh);
- return 1;
-}
-
-int sys_rmdir(const char * name)
-{
- const char * basename;
- int namelen;
- struct m_inode * dir, * inode;
- struct buffer_head * bh;
- struct dir_entry * de;
-
- if (!suser())
- return -EPERM;
- if (!(dir = dir_namei(name,&namelen,&basename)))
- return -ENOENT;
- if (!namelen) {
- iput(dir);
- return -ENOENT;
- }
- if (!permission(dir,MAY_WRITE)) {
- iput(dir);
- return -EPERM;
- }
- bh = find_entry(&dir,basename,namelen,&de);
- if (!bh) {
- iput(dir);
- return -ENOENT;
- }
- if (!(inode = iget(dir->i_dev, de->inode))) {
- iput(dir);
- brelse(bh);
- return -EPERM;
- }
- if ((dir->i_mode & S_ISVTX) && current->euid &&
- inode->i_uid != current->euid) {
- iput(dir);
- iput(inode);
- brelse(bh);
- return -EPERM;
- }
- if (inode->i_dev != dir->i_dev || inode->i_count>1) {
- iput(dir);
- iput(inode);
- brelse(bh);
- return -EPERM;
- }
- if (inode == dir) { /* we may not delete ".", but "../dir" is ok */
- iput(inode);
- iput(dir);
- brelse(bh);
- return -EPERM;
- }
- if (!S_ISDIR(inode->i_mode)) {
- iput(inode);
- iput(dir);
- brelse(bh);
- return -ENOTDIR;
- }
- if (!empty_dir(inode)) {
- iput(inode);
- iput(dir);
- brelse(bh);
- return -ENOTEMPTY;
- }
- if (inode->i_nlinks != 2)
- printk("empty directory has nlink!=2 (%d)",inode->i_nlinks);
- de->inode = 0;
- bh->b_dirt = 1;
- brelse(bh);
- inode->i_nlinks=0;
- inode->i_dirt=1;
- dir->i_nlinks--;
- dir->i_ctime = dir->i_mtime = CURRENT_TIME;
- dir->i_dirt=1;
- iput(dir);
- iput(inode);
- return 0;
-}
-
-int sys_unlink(const char * name)
-{
- const char * basename;
- int namelen;
- struct m_inode * dir, * inode;
- struct buffer_head * bh;
- struct dir_entry * de;
-
- if (!(dir = dir_namei(name,&namelen,&basename)))
- return -ENOENT;
- if (!namelen) {
- iput(dir);
- return -ENOENT;
- }
- if (!permission(dir,MAY_WRITE)) {
- iput(dir);
- return -EPERM;
- }
- bh = find_entry(&dir,basename,namelen,&de);
- if (!bh) {
- iput(dir);
- return -ENOENT;
- }
- if (!(inode = iget(dir->i_dev, de->inode))) {
- iput(dir);
- brelse(bh);
- return -ENOENT;
- }
- if ((dir->i_mode & S_ISVTX) && !suser() &&
- current->euid != inode->i_uid &&
- current->euid != dir->i_uid) {
- iput(dir);
- iput(inode);
- brelse(bh);
- return -EPERM;
- }
- if (S_ISDIR(inode->i_mode)) {
- iput(inode);
- iput(dir);
- brelse(bh);
- return -EPERM;
- }
- if (!inode->i_nlinks) {
- printk("Deleting nonexistent file (%04x:%d), %d\n",
- inode->i_dev,inode->i_num,inode->i_nlinks);
- inode->i_nlinks=1;
- }
- de->inode = 0;
- bh->b_dirt = 1;
- brelse(bh);
- inode->i_nlinks--;
- inode->i_dirt = 1;
- inode->i_ctime = CURRENT_TIME;
- iput(inode);
- iput(dir);
- return 0;
-}
-
-int sys_symlink()
-{
- return -ENOSYS;
-}
-
-int sys_link(const char * oldname, const char * newname)
-{
- struct dir_entry * de;
- struct m_inode * oldinode, * dir;
- struct buffer_head * bh;
- const char * basename;
- int namelen;
-
- oldinode=namei(oldname);
- if (!oldinode)
- return -ENOENT;
- if (S_ISDIR(oldinode->i_mode)) {
- iput(oldinode);
- return -EPERM;
- }
- dir = dir_namei(newname,&namelen,&basename);
- if (!dir) {
- iput(oldinode);
- return -EACCES;
- }
- if (!namelen) {
- iput(oldinode);
- iput(dir);
- return -EPERM;
- }
- if (dir->i_dev != oldinode->i_dev) {
- iput(dir);
- iput(oldinode);
- return -EXDEV;
- }
- if (!permission(dir,MAY_WRITE)) {
- iput(dir);
- iput(oldinode);
- return -EACCES;
- }
- bh = find_entry(&dir,basename,namelen,&de);
- if (bh) {
- brelse(bh);
- iput(dir);
- iput(oldinode);
- return -EEXIST;
- }
- bh = add_entry(dir,basename,namelen,&de);
- if (!bh) {
- iput(dir);
- iput(oldinode);
- return -ENOSPC;
- }
- de->inode = oldinode->i_num;
- bh->b_dirt = 1;
- brelse(bh);
- iput(dir);
- oldinode->i_nlinks++;
- oldinode->i_ctime = CURRENT_TIME;
- oldinode->i_dirt = 1;
- iput(oldinode);
- return 0;
-}
+/*
+ * linux/fs/namei.c
+ *
+ * (C) 1991 Linus Torvalds
+ */
+
+/*
+ * Some corrections by tytso.
+ */
+
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+
+#define ACC_MODE(x) ("\004\002\006\377"[(x)&O_ACCMODE])
+
+/*
+ * comment out this line if you want names > NAME_LEN chars to be
+ * truncated. Else they will be disallowed.
+ */
+/* #define NO_TRUNCATE */
+
+#define MAY_EXEC 1
+#define MAY_WRITE 2
+#define MAY_READ 4
+
+/*
+ * permission()
+ *
+ * is used to check for read/write/execute permissions on a file.
+ * I don't know if we should look at just the euid or both euid and
+ * uid, but that should be easily changed.
+ */
+static int permission(struct m_inode * inode,int mask)
+{
+ int mode = inode->i_mode;
+
+/* special case: not even root can read/write a deleted file */
+ if (inode->i_dev && !inode->i_nlinks)
+ return 0;
+ else if (current->euid==inode->i_uid)
+ mode >>= 6;
+ else if (current->egid==inode->i_gid)
+ mode >>= 3;
+ if (((mode & mask & 0007) == mask) || suser())
+ return 1;
+ return 0;
+}
+
+/*
+ * ok, we cannot use strncmp, as the name is not in our data space.
+ * Thus we'll have to use match. No big problem. Match also makes
+ * some sanity tests.
+ *
+ * NOTE! unlike strncmp, match returns 1 for success, 0 for failure.
+ */
+static int match(int len,const char * name,struct dir_entry * de)
+{
+ register int same __asm__("ax");
+
+ if (!de || !de->inode || len > NAME_LEN)
+ return 0;
+ if (len < NAME_LEN && de->name[len])
+ return 0;
+ __asm__("cld\n\t"
+ "fs ; repe ; cmpsb\n\t"
+ "setz %%al"
+ :"=a" (same)
+ :"0" (0),"S" ((long) name),"D" ((long) de->name),"c" (len)
+ );
+ return same;
+}
+
+/*
+ * find_entry()
+ *
+ * finds an entry in the specified directory with the wanted name. It
+ * returns the cache buffer in which the entry was found, and the entry
+ * itself (as a parameter - res_dir). It does NOT read the inode of the
+ * entry - you'll have to do that yourself if you want to.
+ *
+ * This also takes care of the few special cases due to '..'-traversal
+ * over a pseudo-root and a mount point.
+ */
+static struct buffer_head * find_entry(struct m_inode ** dir,
+ const char * name, int namelen, struct dir_entry ** res_dir)
+{
+ int entries;
+ int block,i;
+ struct buffer_head * bh;
+ struct dir_entry * de;
+ struct super_block * sb;
+
+#ifdef NO_TRUNCATE
+ if (namelen > NAME_LEN)
+ return NULL;
+#else
+ if (namelen > NAME_LEN)
+ namelen = NAME_LEN;
+#endif
+ entries = (*dir)->i_size / (sizeof (struct dir_entry));
+ *res_dir = NULL;
+ if (!namelen)
+ return NULL;
+/* check for '..', as we might have to do some "magic" for it */
+ if (namelen==2 && get_fs_byte(name)=='.' && get_fs_byte(name+1)=='.') {
+/* '..' in a pseudo-root results in a faked '.' (just change namelen) */
+ if ((*dir) == current->root)
+ namelen=1;
+ else if ((*dir)->i_num == ROOT_INO) {
+/* '..' over a mount-point results in 'dir' being exchanged for the mounted
+ directory-inode. NOTE! We set mounted, so that we can iput the new dir */
+ sb=get_super((*dir)->i_dev);
+ if (sb->s_imount) {
+ iput(*dir);
+ (*dir)=sb->s_imount;
+ (*dir)->i_count++;
+ }
+ }
+ }
+ if (!(block = (*dir)->i_zone[0]))
+ return NULL;
+ if (!(bh = bread((*dir)->i_dev,block)))
+ return NULL;
+ i = 0;
+ de = (struct dir_entry *) bh->b_data;
+ while (i < entries) {
+ if ((char *)de >= BLOCK_SIZE+bh->b_data) {
+ brelse(bh);
+ bh = NULL;
+ if (!(block = bmap(*dir,i/DIR_ENTRIES_PER_BLOCK)) ||
+ !(bh = bread((*dir)->i_dev,block))) {
+ i += DIR_ENTRIES_PER_BLOCK;
+ continue;
+ }
+ de = (struct dir_entry *) bh->b_data;
+ }
+ if (match(namelen,name,de)) {
+ *res_dir = de;
+ return bh;
+ }
+ de++;
+ i++;
+ }
+ brelse(bh);
+ return NULL;
+}
+
+/*
+ * add_entry()
+ *
+ * adds a file entry to the specified directory, using the same
+ * semantics as find_entry(). It returns NULL if it failed.
+ *
+ * NOTE!! The inode part of 'de' is left at 0 - which means you
+ * may not sleep between calling this and putting something into
+ * the entry, as someone else might have used it while you slept.
+ */
+static struct buffer_head * add_entry(struct m_inode * dir,
+ const char * name, int namelen, struct dir_entry ** res_dir)
+{
+ int block,i;
+ struct buffer_head * bh;
+ struct dir_entry * de;
+
+ *res_dir = NULL;
+#ifdef NO_TRUNCATE
+ if (namelen > NAME_LEN)
+ return NULL;
+#else
+ if (namelen > NAME_LEN)
+ namelen = NAME_LEN;
+#endif
+ if (!namelen)
+ return NULL;
+ if (!(block = dir->i_zone[0]))
+ return NULL;
+ if (!(bh = bread(dir->i_dev,block)))
+ return NULL;
+ i = 0;
+ de = (struct dir_entry *) bh->b_data;
+ while (1) {
+ if ((char *)de >= BLOCK_SIZE+bh->b_data) {
+ brelse(bh);
+ bh = NULL;
+ block = create_block(dir,i/DIR_ENTRIES_PER_BLOCK);
+ if (!block)
+ return NULL;
+ if (!(bh = bread(dir->i_dev,block))) {
+ i += DIR_ENTRIES_PER_BLOCK;
+ continue;
+ }
+ de = (struct dir_entry *) bh->b_data;
+ }
+ if (i*sizeof(struct dir_entry) >= dir->i_size) {
+ de->inode=0;
+ dir->i_size = (i+1)*sizeof(struct dir_entry);
+ dir->i_dirt = 1;
+ dir->i_ctime = CURRENT_TIME;
+ }
+ if (!de->inode) {
+ dir->i_mtime = CURRENT_TIME;
+ for (i=0; i < NAME_LEN ; i++)
+ de->name[i]=(ib_dirt = 1;
+ *res_dir = de;
+ return bh;
+ }
+ de++;
+ i++;
+ }
+ brelse(bh);
+ return NULL;
+}
+
+/*
+ * get_dir()
+ *
+ * Getdir traverses the pathname until it hits the topmost directory.
+ * It returns NULL on failure.
+ */
+static struct m_inode * get_dir(const char * pathname)
+{
+ char c;
+ const char * thisname;
+ struct m_inode * inode;
+ struct buffer_head * bh;
+ int namelen,inr,idev;
+ struct dir_entry * de;
+
+ if (!current->root || !current->root->i_count)
+ panic("No root inode");
+ if (!current->pwd || !current->pwd->i_count)
+ panic("No cwd inode");
+ if ((c=get_fs_byte(pathname))=='/') {
+ inode = current->root;
+ pathname++;
+ } else if (c)
+ inode = current->pwd;
+ else
+ return NULL; /* empty name is bad */
+ inode->i_count++;
+ while (1) {
+ thisname = pathname;
+ if (!S_ISDIR(inode->i_mode) || !permission(inode,MAY_EXEC)) {
+ iput(inode);
+ return NULL;
+ }
+ for(namelen=0;(c=get_fs_byte(pathname++))&&(c!='/');namelen++)
+ /* nothing */ ;
+ if (!c)
+ return inode;
+ if (!(bh = find_entry(&inode,thisname,namelen,&de))) {
+ iput(inode);
+ return NULL;
+ }
+ inr = de->inode;
+ idev = inode->i_dev;
+ brelse(bh);
+ iput(inode);
+ if (!(inode = iget(idev,inr)))
+ return NULL;
+ }
+}
+
+/*
+ * dir_namei()
+ *
+ * dir_namei() returns the inode of the directory of the
+ * specified name, and the name within that directory.
+ */
+static struct m_inode * dir_namei(const char * pathname,
+ int * namelen, const char ** name)
+{
+ char c;
+ const char * basename;
+ struct m_inode * dir;
+
+ if (!(dir = get_dir(pathname)))
+ return NULL;
+ basename = pathname;
+ while (c=get_fs_byte(pathname++))
+ if (c=='/')
+ basename=pathname;
+ *namelen = pathname-basename-1;
+ *name = basename;
+ return dir;
+}
+
+/*
+ * namei()
+ *
+ * is used by most simple commands to get the inode of a specified name.
+ * Open, link etc use their own routines, but this is enough for things
+ * like 'chmod' etc.
+ */
+struct m_inode * namei(const char * pathname)
+{
+ const char * basename;
+ int inr,dev,namelen;
+ struct m_inode * dir;
+ struct buffer_head * bh;
+ struct dir_entry * de;
+
+ if (!(dir = dir_namei(pathname,&namelen,&basename)))
+ return NULL;
+ if (!namelen) /* special case: '/usr/' etc */
+ return dir;
+ bh = find_entry(&dir,basename,namelen,&de);
+ if (!bh) {
+ iput(dir);
+ return NULL;
+ }
+ inr = de->inode;
+ dev = dir->i_dev;
+ brelse(bh);
+ iput(dir);
+ dir=iget(dev,inr);
+ if (dir) {
+ dir->i_atime=CURRENT_TIME;
+ dir->i_dirt=1;
+ }
+ return dir;
+}
+
+/*
+ * open_namei()
+ *
+ * namei for open - this is in fact almost the whole open-routine.
+ */
+int open_namei(const char * pathname, int flag, int mode,
+ struct m_inode ** res_inode)
+{
+ const char * basename;
+ int inr,dev,namelen;
+ struct m_inode * dir, *inode;
+ struct buffer_head * bh;
+ struct dir_entry * de;
+
+ if ((flag & O_TRUNC) && !(flag & O_ACCMODE))
+ flag |= O_WRONLY;
+ mode &= 0777 & ~current->umask;
+ mode |= I_REGULAR;
+ if (!(dir = dir_namei(pathname,&namelen,&basename)))
+ return -ENOENT;
+ if (!namelen) { /* special case: '/usr/' etc */
+ if (!(flag & (O_ACCMODE|O_CREAT|O_TRUNC))) {
+ *res_inode=dir;
+ return 0;
+ }
+ iput(dir);
+ return -EISDIR;
+ }
+ bh = find_entry(&dir,basename,namelen,&de);
+ if (!bh) {
+ if (!(flag & O_CREAT)) {
+ iput(dir);
+ return -ENOENT;
+ }
+ if (!permission(dir,MAY_WRITE)) {
+ iput(dir);
+ return -EACCES;
+ }
+ inode = new_inode(dir->i_dev);
+ if (!inode) {
+ iput(dir);
+ return -ENOSPC;
+ }
+ inode->i_uid = current->euid;
+ inode->i_mode = mode;
+ inode->i_dirt = 1;
+ bh = add_entry(dir,basename,namelen,&de);
+ if (!bh) {
+ inode->i_nlinks--;
+ iput(inode);
+ iput(dir);
+ return -ENOSPC;
+ }
+ de->inode = inode->i_num;
+ bh->b_dirt = 1;
+ brelse(bh);
+ iput(dir);
+ *res_inode = inode;
+ return 0;
+ }
+ inr = de->inode;
+ dev = dir->i_dev;
+ brelse(bh);
+ iput(dir);
+ if (flag & O_EXCL)
+ return -EEXIST;
+ if (!(inode=iget(dev,inr)))
+ return -EACCES;
+ if ((S_ISDIR(inode->i_mode) && (flag & O_ACCMODE)) ||
+ !permission(inode,ACC_MODE(flag))) {
+ iput(inode);
+ return -EPERM;
+ }
+ inode->i_atime = CURRENT_TIME;
+ if (flag & O_TRUNC)
+ truncate(inode);
+ *res_inode = inode;
+ return 0;
+}
+
+int sys_mknod(const char * filename, int mode, int dev)
+{
+ const char * basename;
+ int namelen;
+ struct m_inode * dir, * inode;
+ struct buffer_head * bh;
+ struct dir_entry * de;
+
+ if (!suser())
+ return -EPERM;
+ if (!(dir = dir_namei(filename,&namelen,&basename)))
+ return -ENOENT;
+ if (!namelen) {
+ iput(dir);
+ return -ENOENT;
+ }
+ if (!permission(dir,MAY_WRITE)) {
+ iput(dir);
+ return -EPERM;
+ }
+ bh = find_entry(&dir,basename,namelen,&de);
+ if (bh) {
+ brelse(bh);
+ iput(dir);
+ return -EEXIST;
+ }
+ inode = new_inode(dir->i_dev);
+ if (!inode) {
+ iput(dir);
+ return -ENOSPC;
+ }
+ inode->i_mode = mode;
+ if (S_ISBLK(mode) || S_ISCHR(mode))
+ inode->i_zone[0] = dev;
+ inode->i_mtime = inode->i_atime = CURRENT_TIME;
+ inode->i_dirt = 1;
+ bh = add_entry(dir,basename,namelen,&de);
+ if (!bh) {
+ iput(dir);
+ inode->i_nlinks=0;
+ iput(inode);
+ return -ENOSPC;
+ }
+ de->inode = inode->i_num;
+ bh->b_dirt = 1;
+ iput(dir);
+ iput(inode);
+ brelse(bh);
+ return 0;
+}
+
+int sys_mkdir(const char * pathname, int mode)
+{
+ const char * basename;
+ int namelen;
+ struct m_inode * dir, * inode;
+ struct buffer_head * bh, *dir_block;
+ struct dir_entry * de;
+
+ if (!suser())
+ return -EPERM;
+ if (!(dir = dir_namei(pathname,&namelen,&basename)))
+ return -ENOENT;
+ if (!namelen) {
+ iput(dir);
+ return -ENOENT;
+ }
+ if (!permission(dir,MAY_WRITE)) {
+ iput(dir);
+ return -EPERM;
+ }
+ bh = find_entry(&dir,basename,namelen,&de);
+ if (bh) {
+ brelse(bh);
+ iput(dir);
+ return -EEXIST;
+ }
+ inode = new_inode(dir->i_dev);
+ if (!inode) {
+ iput(dir);
+ return -ENOSPC;
+ }
+ inode->i_size = 32;
+ inode->i_dirt = 1;
+ inode->i_mtime = inode->i_atime = CURRENT_TIME;
+ if (!(inode->i_zone[0]=new_block(inode->i_dev))) {
+ iput(dir);
+ inode->i_nlinks--;
+ iput(inode);
+ return -ENOSPC;
+ }
+ inode->i_dirt = 1;
+ if (!(dir_block=bread(inode->i_dev,inode->i_zone[0]))) {
+ iput(dir);
+ free_block(inode->i_dev,inode->i_zone[0]);
+ inode->i_nlinks--;
+ iput(inode);
+ return -ERROR;
+ }
+ de = (struct dir_entry *) dir_block->b_data;
+ de->inode=inode->i_num;
+ strcpy(de->name,".");
+ de++;
+ de->inode = dir->i_num;
+ strcpy(de->name,"..");
+ inode->i_nlinks = 2;
+ dir_block->b_dirt = 1;
+ brelse(dir_block);
+ inode->i_mode = I_DIRECTORY | (mode & 0777 & ~current->umask);
+ inode->i_dirt = 1;
+ bh = add_entry(dir,basename,namelen,&de);
+ if (!bh) {
+ iput(dir);
+ free_block(inode->i_dev,inode->i_zone[0]);
+ inode->i_nlinks=0;
+ iput(inode);
+ return -ENOSPC;
+ }
+ de->inode = inode->i_num;
+ bh->b_dirt = 1;
+ dir->i_nlinks++;
+ dir->i_dirt = 1;
+ iput(dir);
+ iput(inode);
+ brelse(bh);
+ return 0;
+}
+
+/*
+ * routine to check that the specified directory is empty (for rmdir)
+ */
+static int empty_dir(struct m_inode * inode)
+{
+ int nr,block;
+ int len;
+ struct buffer_head * bh;
+ struct dir_entry * de;
+
+ len = inode->i_size / sizeof (struct dir_entry);
+ if (len<2 || !inode->i_zone[0] ||
+ !(bh=bread(inode->i_dev,inode->i_zone[0]))) {
+ printk("warning - bad directory on dev %04x\n",inode->i_dev);
+ return 0;
+ }
+ de = (struct dir_entry *) bh->b_data;
+ if (de[0].inode != inode->i_num || !de[1].inode ||
+ strcmp(".",de[0].name) || strcmp("..",de[1].name)) {
+ printk("warning - bad directory on dev %04x\n",inode->i_dev);
+ return 0;
+ }
+ nr = 2;
+ de += 2;
+ while (nr= (void *) (bh->b_data+BLOCK_SIZE)) {
+ brelse(bh);
+ block=bmap(inode,nr/DIR_ENTRIES_PER_BLOCK);
+ if (!block) {
+ nr += DIR_ENTRIES_PER_BLOCK;
+ continue;
+ }
+ if (!(bh=bread(inode->i_dev,block)))
+ return 0;
+ de = (struct dir_entry *) bh->b_data;
+ }
+ if (de->inode) {
+ brelse(bh);
+ return 0;
+ }
+ de++;
+ nr++;
+ }
+ brelse(bh);
+ return 1;
+}
+
+int sys_rmdir(const char * name)
+{
+ const char * basename;
+ int namelen;
+ struct m_inode * dir, * inode;
+ struct buffer_head * bh;
+ struct dir_entry * de;
+
+ if (!suser())
+ return -EPERM;
+ if (!(dir = dir_namei(name,&namelen,&basename)))
+ return -ENOENT;
+ if (!namelen) {
+ iput(dir);
+ return -ENOENT;
+ }
+ if (!permission(dir,MAY_WRITE)) {
+ iput(dir);
+ return -EPERM;
+ }
+ bh = find_entry(&dir,basename,namelen,&de);
+ if (!bh) {
+ iput(dir);
+ return -ENOENT;
+ }
+ if (!(inode = iget(dir->i_dev, de->inode))) {
+ iput(dir);
+ brelse(bh);
+ return -EPERM;
+ }
+ if ((dir->i_mode & S_ISVTX) && current->euid &&
+ inode->i_uid != current->euid) {
+ iput(dir);
+ iput(inode);
+ brelse(bh);
+ return -EPERM;
+ }
+ if (inode->i_dev != dir->i_dev || inode->i_count>1) {
+ iput(dir);
+ iput(inode);
+ brelse(bh);
+ return -EPERM;
+ }
+ if (inode == dir) { /* we may not delete ".", but "../dir" is ok */
+ iput(inode);
+ iput(dir);
+ brelse(bh);
+ return -EPERM;
+ }
+ if (!S_ISDIR(inode->i_mode)) {
+ iput(inode);
+ iput(dir);
+ brelse(bh);
+ return -ENOTDIR;
+ }
+ if (!empty_dir(inode)) {
+ iput(inode);
+ iput(dir);
+ brelse(bh);
+ return -ENOTEMPTY;
+ }
+ if (inode->i_nlinks != 2)
+ printk("empty directory has nlink!=2 (%d)",inode->i_nlinks);
+ de->inode = 0;
+ bh->b_dirt = 1;
+ brelse(bh);
+ inode->i_nlinks=0;
+ inode->i_dirt=1;
+ dir->i_nlinks--;
+ dir->i_ctime = dir->i_mtime = CURRENT_TIME;
+ dir->i_dirt=1;
+ iput(dir);
+ iput(inode);
+ return 0;
+}
+
+int sys_unlink(const char * name)
+{
+ const char * basename;
+ int namelen;
+ struct m_inode * dir, * inode;
+ struct buffer_head * bh;
+ struct dir_entry * de;
+
+ if (!(dir = dir_namei(name,&namelen,&basename)))
+ return -ENOENT;
+ if (!namelen) {
+ iput(dir);
+ return -ENOENT;
+ }
+ if (!permission(dir,MAY_WRITE)) {
+ iput(dir);
+ return -EPERM;
+ }
+ bh = find_entry(&dir,basename,namelen,&de);
+ if (!bh) {
+ iput(dir);
+ return -ENOENT;
+ }
+ if (!(inode = iget(dir->i_dev, de->inode))) {
+ iput(dir);
+ brelse(bh);
+ return -ENOENT;
+ }
+ if ((dir->i_mode & S_ISVTX) && !suser() &&
+ current->euid != inode->i_uid &&
+ current->euid != dir->i_uid) {
+ iput(dir);
+ iput(inode);
+ brelse(bh);
+ return -EPERM;
+ }
+ if (S_ISDIR(inode->i_mode)) {
+ iput(inode);
+ iput(dir);
+ brelse(bh);
+ return -EPERM;
+ }
+ if (!inode->i_nlinks) {
+ printk("Deleting nonexistent file (%04x:%d), %d\n",
+ inode->i_dev,inode->i_num,inode->i_nlinks);
+ inode->i_nlinks=1;
+ }
+ de->inode = 0;
+ bh->b_dirt = 1;
+ brelse(bh);
+ inode->i_nlinks--;
+ inode->i_dirt = 1;
+ inode->i_ctime = CURRENT_TIME;
+ iput(inode);
+ iput(dir);
+ return 0;
+}
+
+int sys_symlink()
+{
+ return -ENOSYS;
+}
+
+int sys_link(const char * oldname, const char * newname)
+{
+ struct dir_entry * de;
+ struct m_inode * oldinode, * dir;
+ struct buffer_head * bh;
+ const char * basename;
+ int namelen;
+
+ oldinode=namei(oldname);
+ if (!oldinode)
+ return -ENOENT;
+ if (S_ISDIR(oldinode->i_mode)) {
+ iput(oldinode);
+ return -EPERM;
+ }
+ dir = dir_namei(newname,&namelen,&basename);
+ if (!dir) {
+ iput(oldinode);
+ return -EACCES;
+ }
+ if (!namelen) {
+ iput(oldinode);
+ iput(dir);
+ return -EPERM;
+ }
+ if (dir->i_dev != oldinode->i_dev) {
+ iput(dir);
+ iput(oldinode);
+ return -EXDEV;
+ }
+ if (!permission(dir,MAY_WRITE)) {
+ iput(dir);
+ iput(oldinode);
+ return -EACCES;
+ }
+ bh = find_entry(&dir,basename,namelen,&de);
+ if (bh) {
+ brelse(bh);
+ iput(dir);
+ iput(oldinode);
+ return -EEXIST;
+ }
+ bh = add_entry(dir,basename,namelen,&de);
+ if (!bh) {
+ iput(dir);
+ iput(oldinode);
+ return -ENOSPC;
+ }
+ de->inode = oldinode->i_num;
+ bh->b_dirt = 1;
+ brelse(bh);
+ iput(dir);
+ oldinode->i_nlinks++;
+ oldinode->i_ctime = CURRENT_TIME;
+ oldinode->i_dirt = 1;
+ iput(oldinode);
+ return 0;
+}
diff --git a/linux-0.11-lab - 副本/0/linux/fs/open.c b/linux-0.11-lab - 副本/0/linux/fs/open.c
index 3695ff1..d043e94 100644
--- a/linux-0.11-lab - 副本/0/linux/fs/open.c
+++ b/linux-0.11-lab - 副本/0/linux/fs/open.c
@@ -1,208 +1,208 @@
-/*
- * linux/fs/open.c
- *
- * (C) 1991 Linus Torvalds
- */
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-
-int sys_ustat(int dev, struct ustat * ubuf)
-{
- return -ENOSYS;
-}
-
-int sys_utime(char * filename, struct utimbuf * times)
-{
- struct m_inode * inode;
- long actime,modtime;
-
- if (!(inode=namei(filename)))
- return -ENOENT;
- if (times) {
- actime = get_fs_long((unsigned long *) ×->actime);
- modtime = get_fs_long((unsigned long *) ×->modtime);
- } else
- actime = modtime = CURRENT_TIME;
- inode->i_atime = actime;
- inode->i_mtime = modtime;
- inode->i_dirt = 1;
- iput(inode);
- return 0;
-}
-
-/*
- * XXX should we use the real or effective uid? BSD uses the real uid,
- * so as to make this call useful to setuid programs.
- */
-int sys_access(const char * filename,int mode)
-{
- struct m_inode * inode;
- int res, i_mode;
-
- mode &= 0007;
- if (!(inode=namei(filename)))
- return -EACCES;
- i_mode = res = inode->i_mode & 0777;
- iput(inode);
- if (current->uid == inode->i_uid)
- res >>= 6;
- else if (current->gid == inode->i_gid)
- res >>= 6;
- if ((res & 0007 & mode) == mode)
- return 0;
- /*
- * XXX we are doing this test last because we really should be
- * swapping the effective with the real user id (temporarily),
- * and then calling suser() routine. If we do call the
- * suser() routine, it needs to be called last.
- */
- if ((!current->uid) &&
- (!(mode & 1) || (i_mode & 0111)))
- return 0;
- return -EACCES;
-}
-
-int sys_chdir(const char * filename)
-{
- struct m_inode * inode;
-
- if (!(inode = namei(filename)))
- return -ENOENT;
- if (!S_ISDIR(inode->i_mode)) {
- iput(inode);
- return -ENOTDIR;
- }
- iput(current->pwd);
- current->pwd = inode;
- return (0);
-}
-
-int sys_chroot(const char * filename)
-{
- struct m_inode * inode;
-
- if (!(inode=namei(filename)))
- return -ENOENT;
- if (!S_ISDIR(inode->i_mode)) {
- iput(inode);
- return -ENOTDIR;
- }
- iput(current->root);
- current->root = inode;
- return (0);
-}
-
-int sys_chmod(const char * filename,int mode)
-{
- struct m_inode * inode;
-
- if (!(inode=namei(filename)))
- return -ENOENT;
- if ((current->euid != inode->i_uid) && !suser()) {
- iput(inode);
- return -EACCES;
- }
- inode->i_mode = (mode & 07777) | (inode->i_mode & ~07777);
- inode->i_dirt = 1;
- iput(inode);
- return 0;
-}
-
-int sys_chown(const char * filename,int uid,int gid)
-{
- struct m_inode * inode;
-
- if (!(inode=namei(filename)))
- return -ENOENT;
- if (!suser()) {
- iput(inode);
- return -EACCES;
- }
- inode->i_uid=uid;
- inode->i_gid=gid;
- inode->i_dirt=1;
- iput(inode);
- return 0;
-}
-
-int sys_open(const char * filename,int flag,int mode)
-{
- struct m_inode * inode;
- struct file * f;
- int i,fd;
-
- mode &= 0777 & ~current->umask;
- for(fd=0 ; fdfilp[fd])
- break;
- if (fd>=NR_OPEN)
- return -EINVAL;
- current->close_on_exec &= ~(1<f_count) break;
- if (i>=NR_FILE)
- return -EINVAL;
- (current->filp[fd]=f)->f_count++;
- if ((i=open_namei(filename,flag,mode,&inode))<0) {
- current->filp[fd]=NULL;
- f->f_count=0;
- return i;
- }
-/* ttys are somewhat special (ttyxx major==4, tty major==5) */
- if (S_ISCHR(inode->i_mode))
- if (MAJOR(inode->i_zone[0])==4) {
- if (current->leader && current->tty<0) {
- current->tty = MINOR(inode->i_zone[0]);
- tty_table[current->tty].pgrp = current->pgrp;
- }
- } else if (MAJOR(inode->i_zone[0])==5)
- if (current->tty<0) {
- iput(inode);
- current->filp[fd]=NULL;
- f->f_count=0;
- return -EPERM;
- }
-/* Likewise with block-devices: check for floppy_change */
- if (S_ISBLK(inode->i_mode))
- check_disk_change(inode->i_zone[0]);
- f->f_mode = inode->i_mode;
- f->f_flags = flag;
- f->f_count = 1;
- f->f_inode = inode;
- f->f_pos = 0;
- return (fd);
-}
-
-int sys_creat(const char * pathname, int mode)
-{
- return sys_open(pathname, O_CREAT | O_TRUNC, mode);
-}
-
-int sys_close(unsigned int fd)
-{
- struct file * filp;
-
- if (fd >= NR_OPEN)
- return -EINVAL;
- current->close_on_exec &= ~(1<filp[fd]))
- return -EINVAL;
- current->filp[fd] = NULL;
- if (filp->f_count == 0)
- panic("Close: file count is 0");
- if (--filp->f_count)
- return (0);
- iput(filp->f_inode);
- return (0);
-}
+/*
+ * linux/fs/open.c
+ *
+ * (C) 1991 Linus Torvalds
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+
+int sys_ustat(int dev, struct ustat * ubuf)
+{
+ return -ENOSYS;
+}
+
+int sys_utime(char * filename, struct utimbuf * times)
+{
+ struct m_inode * inode;
+ long actime,modtime;
+
+ if (!(inode=namei(filename)))
+ return -ENOENT;
+ if (times) {
+ actime = get_fs_long((unsigned long *) ×->actime);
+ modtime = get_fs_long((unsigned long *) ×->modtime);
+ } else
+ actime = modtime = CURRENT_TIME;
+ inode->i_atime = actime;
+ inode->i_mtime = modtime;
+ inode->i_dirt = 1;
+ iput(inode);
+ return 0;
+}
+
+/*
+ * XXX should we use the real or effective uid? BSD uses the real uid,
+ * so as to make this call useful to setuid programs.
+ */
+int sys_access(const char * filename,int mode)
+{
+ struct m_inode * inode;
+ int res, i_mode;
+
+ mode &= 0007;
+ if (!(inode=namei(filename)))
+ return -EACCES;
+ i_mode = res = inode->i_mode & 0777;
+ iput(inode);
+ if (current->uid == inode->i_uid)
+ res >>= 6;
+ else if (current->gid == inode->i_gid)
+ res >>= 6;
+ if ((res & 0007 & mode) == mode)
+ return 0;
+ /*
+ * XXX we are doing this test last because we really should be
+ * swapping the effective with the real user id (temporarily),
+ * and then calling suser() routine. If we do call the
+ * suser() routine, it needs to be called last.
+ */
+ if ((!current->uid) &&
+ (!(mode & 1) || (i_mode & 0111)))
+ return 0;
+ return -EACCES;
+}
+
+int sys_chdir(const char * filename)
+{
+ struct m_inode * inode;
+
+ if (!(inode = namei(filename)))
+ return -ENOENT;
+ if (!S_ISDIR(inode->i_mode)) {
+ iput(inode);
+ return -ENOTDIR;
+ }
+ iput(current->pwd);
+ current->pwd = inode;
+ return (0);
+}
+
+int sys_chroot(const char * filename)
+{
+ struct m_inode * inode;
+
+ if (!(inode=namei(filename)))
+ return -ENOENT;
+ if (!S_ISDIR(inode->i_mode)) {
+ iput(inode);
+ return -ENOTDIR;
+ }
+ iput(current->root);
+ current->root = inode;
+ return (0);
+}
+
+int sys_chmod(const char * filename,int mode)
+{
+ struct m_inode * inode;
+
+ if (!(inode=namei(filename)))
+ return -ENOENT;
+ if ((current->euid != inode->i_uid) && !suser()) {
+ iput(inode);
+ return -EACCES;
+ }
+ inode->i_mode = (mode & 07777) | (inode->i_mode & ~07777);
+ inode->i_dirt = 1;
+ iput(inode);
+ return 0;
+}
+
+int sys_chown(const char * filename,int uid,int gid)
+{
+ struct m_inode * inode;
+
+ if (!(inode=namei(filename)))
+ return -ENOENT;
+ if (!suser()) {
+ iput(inode);
+ return -EACCES;
+ }
+ inode->i_uid=uid;
+ inode->i_gid=gid;
+ inode->i_dirt=1;
+ iput(inode);
+ return 0;
+}
+
+int sys_open(const char * filename,int flag,int mode)
+{
+ struct m_inode * inode;
+ struct file * f;
+ int i,fd;
+
+ mode &= 0777 & ~current->umask;
+ for(fd=0 ; fdfilp[fd])
+ break;
+ if (fd>=NR_OPEN)
+ return -EINVAL;
+ current->close_on_exec &= ~(1<f_count) break;
+ if (i>=NR_FILE)
+ return -EINVAL;
+ (current->filp[fd]=f)->f_count++;
+ if ((i=open_namei(filename,flag,mode,&inode))<0) {
+ current->filp[fd]=NULL;
+ f->f_count=0;
+ return i;
+ }
+/* ttys are somewhat special (ttyxx major==4, tty major==5) */
+ if (S_ISCHR(inode->i_mode))
+ if (MAJOR(inode->i_zone[0])==4) {
+ if (current->leader && current->tty<0) {
+ current->tty = MINOR(inode->i_zone[0]);
+ tty_table[current->tty].pgrp = current->pgrp;
+ }
+ } else if (MAJOR(inode->i_zone[0])==5)
+ if (current->tty<0) {
+ iput(inode);
+ current->filp[fd]=NULL;
+ f->f_count=0;
+ return -EPERM;
+ }
+/* Likewise with block-devices: check for floppy_change */
+ if (S_ISBLK(inode->i_mode))
+ check_disk_change(inode->i_zone[0]);
+ f->f_mode = inode->i_mode;
+ f->f_flags = flag;
+ f->f_count = 1;
+ f->f_inode = inode;
+ f->f_pos = 0;
+ return (fd);
+}
+
+int sys_creat(const char * pathname, int mode)
+{
+ return sys_open(pathname, O_CREAT | O_TRUNC, mode);
+}
+
+int sys_close(unsigned int fd)
+{
+ struct file * filp;
+
+ if (fd >= NR_OPEN)
+ return -EINVAL;
+ current->close_on_exec &= ~(1<filp[fd]))
+ return -EINVAL;
+ current->filp[fd] = NULL;
+ if (filp->f_count == 0)
+ panic("Close: file count is 0");
+ if (--filp->f_count)
+ return (0);
+ iput(filp->f_inode);
+ return (0);
+}
diff --git a/linux-0.11-lab - 副本/0/linux/fs/pipe.c b/linux-0.11-lab - 副本/0/linux/fs/pipe.c
index dfc4480..93c5d88 100644
--- a/linux-0.11-lab - 副本/0/linux/fs/pipe.c
+++ b/linux-0.11-lab - 副本/0/linux/fs/pipe.c
@@ -1,111 +1,111 @@
-/*
- * linux/fs/pipe.c
- *
- * (C) 1991 Linus Torvalds
- */
-
-#include
-
-#include
-#include /* for get_free_page */
-#include
-
-int read_pipe(struct m_inode * inode, char * buf, int count)
-{
- int chars, size, read = 0;
-
- while (count>0) {
- while (!(size=PIPE_SIZE(*inode))) {
- wake_up(&inode->i_wait);
- if (inode->i_count != 2) /* are there any writers? */
- return read;
- sleep_on(&inode->i_wait);
- }
- chars = PAGE_SIZE-PIPE_TAIL(*inode);
- if (chars > count)
- chars = count;
- if (chars > size)
- chars = size;
- count -= chars;
- read += chars;
- size = PIPE_TAIL(*inode);
- PIPE_TAIL(*inode) += chars;
- PIPE_TAIL(*inode) &= (PAGE_SIZE-1);
- while (chars-->0)
- put_fs_byte(((char *)inode->i_size)[size++],buf++);
- }
- wake_up(&inode->i_wait);
- return read;
-}
-
-int write_pipe(struct m_inode * inode, char * buf, int count)
-{
- int chars, size, written = 0;
-
- while (count>0) {
- while (!(size=(PAGE_SIZE-1)-PIPE_SIZE(*inode))) {
- wake_up(&inode->i_wait);
- if (inode->i_count != 2) { /* no readers */
- current->signal |= (1<<(SIGPIPE-1));
- return written?written:-1;
- }
- sleep_on(&inode->i_wait);
- }
- chars = PAGE_SIZE-PIPE_HEAD(*inode);
- if (chars > count)
- chars = count;
- if (chars > size)
- chars = size;
- count -= chars;
- written += chars;
- size = PIPE_HEAD(*inode);
- PIPE_HEAD(*inode) += chars;
- PIPE_HEAD(*inode) &= (PAGE_SIZE-1);
- while (chars-->0)
- ((char *)inode->i_size)[size++]=get_fs_byte(buf++);
- }
- wake_up(&inode->i_wait);
- return written;
-}
-
-int sys_pipe(unsigned long * fildes)
-{
- struct m_inode * inode;
- struct file * f[2];
- int fd[2];
- int i,j;
-
- j=0;
- for(i=0;j<2 && if_count++;
- if (j==1)
- f[0]->f_count=0;
- if (j<2)
- return -1;
- j=0;
- for(i=0;j<2 && ifilp[i]) {
- current->filp[ fd[j]=i ] = f[j];
- j++;
- }
- if (j==1)
- current->filp[fd[0]]=NULL;
- if (j<2) {
- f[0]->f_count=f[1]->f_count=0;
- return -1;
- }
- if (!(inode=get_pipe_inode())) {
- current->filp[fd[0]] =
- current->filp[fd[1]] = NULL;
- f[0]->f_count = f[1]->f_count = 0;
- return -1;
- }
- f[0]->f_inode = f[1]->f_inode = inode;
- f[0]->f_pos = f[1]->f_pos = 0;
- f[0]->f_mode = 1; /* read */
- f[1]->f_mode = 2; /* write */
- put_fs_long(fd[0],0+fildes);
- put_fs_long(fd[1],1+fildes);
- return 0;
-}
+/*
+ * linux/fs/pipe.c
+ *
+ * (C) 1991 Linus Torvalds
+ */
+
+#include
+
+#include
+#include /* for get_free_page */
+#include
+
+int read_pipe(struct m_inode * inode, char * buf, int count)
+{
+ int chars, size, read = 0;
+
+ while (count>0) {
+ while (!(size=PIPE_SIZE(*inode))) {
+ wake_up(&inode->i_wait);
+ if (inode->i_count != 2) /* are there any writers? */
+ return read;
+ sleep_on(&inode->i_wait);
+ }
+ chars = PAGE_SIZE-PIPE_TAIL(*inode);
+ if (chars > count)
+ chars = count;
+ if (chars > size)
+ chars = size;
+ count -= chars;
+ read += chars;
+ size = PIPE_TAIL(*inode);
+ PIPE_TAIL(*inode) += chars;
+ PIPE_TAIL(*inode) &= (PAGE_SIZE-1);
+ while (chars-->0)
+ put_fs_byte(((char *)inode->i_size)[size++],buf++);
+ }
+ wake_up(&inode->i_wait);
+ return read;
+}
+
+int write_pipe(struct m_inode * inode, char * buf, int count)
+{
+ int chars, size, written = 0;
+
+ while (count>0) {
+ while (!(size=(PAGE_SIZE-1)-PIPE_SIZE(*inode))) {
+ wake_up(&inode->i_wait);
+ if (inode->i_count != 2) { /* no readers */
+ current->signal |= (1<<(SIGPIPE-1));
+ return written?written:-1;
+ }
+ sleep_on(&inode->i_wait);
+ }
+ chars = PAGE_SIZE-PIPE_HEAD(*inode);
+ if (chars > count)
+ chars = count;
+ if (chars > size)
+ chars = size;
+ count -= chars;
+ written += chars;
+ size = PIPE_HEAD(*inode);
+ PIPE_HEAD(*inode) += chars;
+ PIPE_HEAD(*inode) &= (PAGE_SIZE-1);
+ while (chars-->0)
+ ((char *)inode->i_size)[size++]=get_fs_byte(buf++);
+ }
+ wake_up(&inode->i_wait);
+ return written;
+}
+
+int sys_pipe(unsigned long * fildes)
+{
+ struct m_inode * inode;
+ struct file * f[2];
+ int fd[2];
+ int i,j;
+
+ j=0;
+ for(i=0;j<2 && if_count++;
+ if (j==1)
+ f[0]->f_count=0;
+ if (j<2)
+ return -1;
+ j=0;
+ for(i=0;j<2 && ifilp[i]) {
+ current->filp[ fd[j]=i ] = f[j];
+ j++;
+ }
+ if (j==1)
+ current->filp[fd[0]]=NULL;
+ if (j<2) {
+ f[0]->f_count=f[1]->f_count=0;
+ return -1;
+ }
+ if (!(inode=get_pipe_inode())) {
+ current->filp[fd[0]] =
+ current->filp[fd[1]] = NULL;
+ f[0]->f_count = f[1]->f_count = 0;
+ return -1;
+ }
+ f[0]->f_inode = f[1]->f_inode = inode;
+ f[0]->f_pos = f[1]->f_pos = 0;
+ f[0]->f_mode = 1; /* read */
+ f[1]->f_mode = 2; /* write */
+ put_fs_long(fd[0],0+fildes);
+ put_fs_long(fd[1],1+fildes);
+ return 0;
+}
diff --git a/linux-0.11-lab - 副本/0/linux/fs/read_write.c b/linux-0.11-lab - 副本/0/linux/fs/read_write.c
index 341274a..b6c96fd 100644
--- a/linux-0.11-lab - 副本/0/linux/fs/read_write.c
+++ b/linux-0.11-lab - 副本/0/linux/fs/read_write.c
@@ -1,103 +1,103 @@
-/*
- * linux/fs/read_write.c
- *
- * (C) 1991 Linus Torvalds
- */
-
-#include
-#include
-#include
-
-#include
-#include
-#include
-
-extern int rw_char(int rw,int dev, char * buf, int count, off_t * pos);
-extern int read_pipe(struct m_inode * inode, char * buf, int count);
-extern int write_pipe(struct m_inode * inode, char * buf, int count);
-extern int block_read(int dev, off_t * pos, char * buf, int count);
-extern int block_write(int dev, off_t * pos, char * buf, int count);
-extern int file_read(struct m_inode * inode, struct file * filp,
- char * buf, int count);
-extern int file_write(struct m_inode * inode, struct file * filp,
- char * buf, int count);
-
-int sys_lseek(unsigned int fd,off_t offset, int origin)
-{
- struct file * file;
- int tmp;
-
- if (fd >= NR_OPEN || !(file=current->filp[fd]) || !(file->f_inode)
- || !IS_SEEKABLE(MAJOR(file->f_inode->i_dev)))
- return -EBADF;
- if (file->f_inode->i_pipe)
- return -ESPIPE;
- switch (origin) {
- case 0:
- if (offset<0) return -EINVAL;
- file->f_pos=offset;
- break;
- case 1:
- if (file->f_pos+offset<0) return -EINVAL;
- file->f_pos += offset;
- break;
- case 2:
- if ((tmp=file->f_inode->i_size+offset) < 0)
- return -EINVAL;
- file->f_pos = tmp;
- break;
- default:
- return -EINVAL;
- }
- return file->f_pos;
-}
-
-int sys_read(unsigned int fd,char * buf,int count)
-{
- struct file * file;
- struct m_inode * inode;
-
- if (fd>=NR_OPEN || count<0 || !(file=current->filp[fd]))
- return -EINVAL;
- if (!count)
- return 0;
- verify_area(buf,count);
- inode = file->f_inode;
- if (inode->i_pipe)
- return (file->f_mode&1)?read_pipe(inode,buf,count):-EIO;
- if (S_ISCHR(inode->i_mode))
- return rw_char(READ,inode->i_zone[0],buf,count,&file->f_pos);
- if (S_ISBLK(inode->i_mode))
- return block_read(inode->i_zone[0],&file->f_pos,buf,count);
- if (S_ISDIR(inode->i_mode) || S_ISREG(inode->i_mode)) {
- if (count+file->f_pos > inode->i_size)
- count = inode->i_size - file->f_pos;
- if (count<=0)
- return 0;
- return file_read(inode,file,buf,count);
- }
- printk("(Read)inode->i_mode=%06o\n\r",inode->i_mode);
- return -EINVAL;
-}
-
-int sys_write(unsigned int fd,char * buf,int count)
-{
- struct file * file;
- struct m_inode * inode;
-
- if (fd>=NR_OPEN || count <0 || !(file=current->filp[fd]))
- return -EINVAL;
- if (!count)
- return 0;
- inode=file->f_inode;
- if (inode->i_pipe)
- return (file->f_mode&2)?write_pipe(inode,buf,count):-EIO;
- if (S_ISCHR(inode->i_mode))
- return rw_char(WRITE,inode->i_zone[0],buf,count,&file->f_pos);
- if (S_ISBLK(inode->i_mode))
- return block_write(inode->i_zone[0],&file->f_pos,buf,count);
- if (S_ISREG(inode->i_mode))
- return file_write(inode,file,buf,count);
- printk("(Write)inode->i_mode=%06o\n\r",inode->i_mode);
- return -EINVAL;
-}
+/*
+ * linux/fs/read_write.c
+ *
+ * (C) 1991 Linus Torvalds
+ */
+
+#include
+#include
+#include
+
+#include
+#include
+#include
+
+extern int rw_char(int rw,int dev, char * buf, int count, off_t * pos);
+extern int read_pipe(struct m_inode * inode, char * buf, int count);
+extern int write_pipe(struct m_inode * inode, char * buf, int count);
+extern int block_read(int dev, off_t * pos, char * buf, int count);
+extern int block_write(int dev, off_t * pos, char * buf, int count);
+extern int file_read(struct m_inode * inode, struct file * filp,
+ char * buf, int count);
+extern int file_write(struct m_inode * inode, struct file * filp,
+ char * buf, int count);
+
+int sys_lseek(unsigned int fd,off_t offset, int origin)
+{
+ struct file * file;
+ int tmp;
+
+ if (fd >= NR_OPEN || !(file=current->filp[fd]) || !(file->f_inode)
+ || !IS_SEEKABLE(MAJOR(file->f_inode->i_dev)))
+ return -EBADF;
+ if (file->f_inode->i_pipe)
+ return -ESPIPE;
+ switch (origin) {
+ case 0:
+ if (offset<0) return -EINVAL;
+ file->f_pos=offset;
+ break;
+ case 1:
+ if (file->f_pos+offset<0) return -EINVAL;
+ file->f_pos += offset;
+ break;
+ case 2:
+ if ((tmp=file->f_inode->i_size+offset) < 0)
+ return -EINVAL;
+ file->f_pos = tmp;
+ break;
+ default:
+ return -EINVAL;
+ }
+ return file->f_pos;
+}
+
+int sys_read(unsigned int fd,char * buf,int count)
+{
+ struct file * file;
+ struct m_inode * inode;
+
+ if (fd>=NR_OPEN || count<0 || !(file=current->filp[fd]))
+ return -EINVAL;
+ if (!count)
+ return 0;
+ verify_area(buf,count);
+ inode = file->f_inode;
+ if (inode->i_pipe)
+ return (file->f_mode&1)?read_pipe(inode,buf,count):-EIO;
+ if (S_ISCHR(inode->i_mode))
+ return rw_char(READ,inode->i_zone[0],buf,count,&file->f_pos);
+ if (S_ISBLK(inode->i_mode))
+ return block_read(inode->i_zone[0],&file->f_pos,buf,count);
+ if (S_ISDIR(inode->i_mode) || S_ISREG(inode->i_mode)) {
+ if (count+file->f_pos > inode->i_size)
+ count = inode->i_size - file->f_pos;
+ if (count<=0)
+ return 0;
+ return file_read(inode,file,buf,count);
+ }
+ printk("(Read)inode->i_mode=%06o\n\r",inode->i_mode);
+ return -EINVAL;
+}
+
+int sys_write(unsigned int fd,char * buf,int count)
+{
+ struct file * file;
+ struct m_inode * inode;
+
+ if (fd>=NR_OPEN || count <0 || !(file=current->filp[fd]))
+ return -EINVAL;
+ if (!count)
+ return 0;
+ inode=file->f_inode;
+ if (inode->i_pipe)
+ return (file->f_mode&2)?write_pipe(inode,buf,count):-EIO;
+ if (S_ISCHR(inode->i_mode))
+ return rw_char(WRITE,inode->i_zone[0],buf,count,&file->f_pos);
+ if (S_ISBLK(inode->i_mode))
+ return block_write(inode->i_zone[0],&file->f_pos,buf,count);
+ if (S_ISREG(inode->i_mode))
+ return file_write(inode,file,buf,count);
+ printk("(Write)inode->i_mode=%06o\n\r",inode->i_mode);
+ return -EINVAL;
+}
diff --git a/linux-0.11-lab - 副本/0/linux/fs/select.c b/linux-0.11-lab - 副本/0/linux/fs/select.c
index cef8b43..0353f86 100644
--- a/linux-0.11-lab - 副本/0/linux/fs/select.c
+++ b/linux-0.11-lab - 副本/0/linux/fs/select.c
@@ -1,10 +1,10 @@
-/* nothing , only the stub */
-/* gohigh */
-
-#include
-
-int sys_select()
-{
- return -ENOSYS;
-}
-
+/* nothing , only the stub */
+/* gohigh */
+
+#include
+
+int sys_select()
+{
+ return -ENOSYS;
+}
+
diff --git a/linux-0.11-lab - 副本/0/linux/fs/stat.c b/linux-0.11-lab - 副本/0/linux/fs/stat.c
index ef09856..5b793c9 100644
--- a/linux-0.11-lab - 副本/0/linux/fs/stat.c
+++ b/linux-0.11-lab - 副本/0/linux/fs/stat.c
@@ -1,66 +1,66 @@
-/*
- * linux/fs/stat.c
- *
- * (C) 1991 Linus Torvalds
- */
-
-#include
-#include
-
-#include
-#include
-#include
-#include
-
-static void cp_stat(struct m_inode * inode, struct stat * statbuf)
-{
- struct stat tmp;
- int i;
-
- verify_area(statbuf,sizeof (* statbuf));
- tmp.st_dev = inode->i_dev;
- tmp.st_ino = inode->i_num;
- tmp.st_mode = inode->i_mode;
- tmp.st_nlink = inode->i_nlinks;
- tmp.st_uid = inode->i_uid;
- tmp.st_gid = inode->i_gid;
- tmp.st_rdev = inode->i_zone[0];
- tmp.st_size = inode->i_size;
- tmp.st_atime = inode->i_atime;
- tmp.st_mtime = inode->i_mtime;
- tmp.st_ctime = inode->i_ctime;
- for (i=0 ; i= NR_OPEN || !(f=current->filp[fd]) || !(inode=f->f_inode))
- return -EBADF;
- cp_stat(inode,statbuf);
- return 0;
-}
-
-int sys_readlink()
-{
- return -ENOSYS;
-}
+/*
+ * linux/fs/stat.c
+ *
+ * (C) 1991 Linus Torvalds
+ */
+
+#include
+#include
+
+#include
+#include
+#include
+#include
+
+static void cp_stat(struct m_inode * inode, struct stat * statbuf)
+{
+ struct stat tmp;
+ int i;
+
+ verify_area(statbuf,sizeof (* statbuf));
+ tmp.st_dev = inode->i_dev;
+ tmp.st_ino = inode->i_num;
+ tmp.st_mode = inode->i_mode;
+ tmp.st_nlink = inode->i_nlinks;
+ tmp.st_uid = inode->i_uid;
+ tmp.st_gid = inode->i_gid;
+ tmp.st_rdev = inode->i_zone[0];
+ tmp.st_size = inode->i_size;
+ tmp.st_atime = inode->i_atime;
+ tmp.st_mtime = inode->i_mtime;
+ tmp.st_ctime = inode->i_ctime;
+ for (i=0 ; i= NR_OPEN || !(f=current->filp[fd]) || !(inode=f->f_inode))
+ return -EBADF;
+ cp_stat(inode,statbuf);
+ return 0;
+}
+
+int sys_readlink()
+{
+ return -ENOSYS;
+}
diff --git a/linux-0.11-lab - 副本/0/linux/fs/super.c b/linux-0.11-lab - 副本/0/linux/fs/super.c
index 6a4ccb1..4d20f00 100644
--- a/linux-0.11-lab - 副本/0/linux/fs/super.c
+++ b/linux-0.11-lab - 副本/0/linux/fs/super.c
@@ -1,282 +1,282 @@
-/*
- * linux/fs/super.c
- *
- * (C) 1991 Linus Torvalds
- */
-
-/*
- * super.c contains code to handle the super-block tables.
- */
-#include
-#include
-#include
-#include
-
-#include
-#include
-
-int sync_dev(int dev);
-void wait_for_keypress(void);
-
-/* set_bit uses setb, as gas doesn't recognize setc */
-#define set_bit(bitnr,addr) ({ \
-register int __res __asm__("ax"); \
-__asm__("bt %2,%3;setb %%al":"=a" (__res):"a" (0),"r" (bitnr),"m" (*(addr))); \
-__res; })
-
-struct super_block super_block[NR_SUPER];
-/* this is initialized in init/main.c */
-int ROOT_DEV = 0;
-
-static void lock_super(struct super_block * sb)
-{
- cli();
- while (sb->s_lock)
- sleep_on(&(sb->s_wait));
- sb->s_lock = 1;
- sti();
-}
-
-static void free_super(struct super_block * sb)
-{
- cli();
- sb->s_lock = 0;
- wake_up(&(sb->s_wait));
- sti();
-}
-
-static void wait_on_super(struct super_block * sb)
-{
- cli();
- while (sb->s_lock)
- sleep_on(&(sb->s_wait));
- sti();
-}
-
-struct super_block * get_super(int dev)
-{
- struct super_block * s;
-
- if (!dev)
- return NULL;
- s = 0+super_block;
- while (s < NR_SUPER+super_block)
- if (s->s_dev == dev) {
- wait_on_super(s);
- if (s->s_dev == dev)
- return s;
- s = 0+super_block;
- } else
- s++;
- return NULL;
-}
-
-void put_super(int dev)
-{
- struct super_block * sb;
-/* struct m_inode * inode; */
- int i;
-
- if (dev == ROOT_DEV) {
- printk("root diskette changed: prepare for armageddon\n\r");
- return;
- }
- if (!(sb = get_super(dev)))
- return;
- if (sb->s_imount) {
- printk("Mounted disk changed - tssk, tssk\n\r");
- return;
- }
- lock_super(sb);
- sb->s_dev = 0;
- for(i=0;is_imap[i]);
- for(i=0;is_zmap[i]);
- free_super(sb);
- return;
-}
-
-static struct super_block * read_super(int dev)
-{
- struct super_block * s;
- struct buffer_head * bh;
- int i,block;
-
- if (!dev)
- return NULL;
- check_disk_change(dev);
- if (s = get_super(dev))
- return s;
- for (s = 0+super_block ;; s++) {
- if (s >= NR_SUPER+super_block)
- return NULL;
- if (!s->s_dev)
- break;
- }
- s->s_dev = dev;
- s->s_isup = NULL;
- s->s_imount = NULL;
- s->s_time = 0;
- s->s_rd_only = 0;
- s->s_dirt = 0;
- lock_super(s);
- if (!(bh = bread(dev,1))) {
- s->s_dev=0;
- free_super(s);
- return NULL;
- }
- __asm__ volatile ("cld"); /* by wyj */
- *((struct d_super_block *) s) =
- *((struct d_super_block *) bh->b_data);
- brelse(bh);
- if (s->s_magic != SUPER_MAGIC) {
- s->s_dev = 0;
- free_super(s);
- return NULL;
- }
- for (i=0;is_imap[i] = NULL;
- for (i=0;is_zmap[i] = NULL;
- block=2;
- for (i=0 ; i < s->s_imap_blocks ; i++)
- if (s->s_imap[i]=bread(dev,block))
- block++;
- else
- break;
- for (i=0 ; i < s->s_zmap_blocks ; i++)
- if (s->s_zmap[i]=bread(dev,block))
- block++;
- else
- break;
- if (block != 2+s->s_imap_blocks+s->s_zmap_blocks) {
- for(i=0;is_imap[i]);
- for(i=0;is_zmap[i]);
- s->s_dev=0;
- free_super(s);
- return NULL;
- }
- s->s_imap[0]->b_data[0] |= 1;
- s->s_zmap[0]->b_data[0] |= 1;
- free_super(s);
- return s;
-}
-
-int sys_umount(char * dev_name)
-{
- struct m_inode * inode;
- struct super_block * sb;
- int dev;
-
- if (!(inode=namei(dev_name)))
- return -ENOENT;
- dev = inode->i_zone[0];
- if (!S_ISBLK(inode->i_mode)) {
- iput(inode);
- return -ENOTBLK;
- }
- iput(inode);
- if (dev==ROOT_DEV)
- return -EBUSY;
- if (!(sb=get_super(dev)) || !(sb->s_imount))
- return -ENOENT;
- if (!sb->s_imount->i_mount)
- printk("Mounted inode has i_mount=0\n");
- for (inode=inode_table+0 ; inodei_dev==dev && inode->i_count)
- return -EBUSY;
- sb->s_imount->i_mount=0;
- iput(sb->s_imount);
- sb->s_imount = NULL;
- iput(sb->s_isup);
- sb->s_isup = NULL;
- put_super(dev);
- sync_dev(dev);
- return 0;
-}
-
-int sys_mount(char * dev_name, char * dir_name, int rw_flag)
-{
- struct m_inode * dev_i, * dir_i;
- struct super_block * sb;
- int dev;
-
- if (!(dev_i=namei(dev_name)))
- return -ENOENT;
- dev = dev_i->i_zone[0];
- if (!S_ISBLK(dev_i->i_mode)) {
- iput(dev_i);
- return -EPERM;
- }
- iput(dev_i);
- if (!(dir_i=namei(dir_name)))
- return -ENOENT;
- if (dir_i->i_count != 1 || dir_i->i_num == ROOT_INO) {
- iput(dir_i);
- return -EBUSY;
- }
- if (!S_ISDIR(dir_i->i_mode)) {
- iput(dir_i);
- return -EPERM;
- }
- if (!(sb=read_super(dev))) {
- iput(dir_i);
- return -EBUSY;
- }
- if (sb->s_imount) {
- iput(dir_i);
- return -EBUSY;
- }
- if (dir_i->i_mount) {
- iput(dir_i);
- return -EPERM;
- }
- sb->s_imount=dir_i;
- dir_i->i_mount=1;
- dir_i->i_dirt=1; /* NOTE! we don't iput(dir_i) */
- return 0; /* we do that in umount */
-}
-
-void mount_root(void)
-{
- int i,free;
- struct super_block * p;
- struct m_inode * mi;
-
- if (32 != sizeof (struct d_inode))
- panic("bad i-node size");
- for(i=0;is_dev = 0;
- p->s_lock = 0;
- p->s_wait = NULL;
- }
- if (!(p=read_super(ROOT_DEV)))
- panic("Unable to mount root");
- if (!(mi=iget(ROOT_DEV,ROOT_INO)))
- panic("Unable to read root i-node");
- mi->i_count += 3 ; /* NOTE! it is logically used 4 times, not 1 */
- p->s_isup = p->s_imount = mi;
- current->pwd = mi;
- current->root = mi;
- free=0;
- i=p->s_nzones;
- while (-- i >= 0)
- if (!set_bit(i&8191,p->s_zmap[i>>13]->b_data))
- free++;
- printk("%d/%d free blocks\n\r",free,p->s_nzones);
- free=0;
- i=p->s_ninodes+1;
- while (-- i >= 0)
- if (!set_bit(i&8191,p->s_imap[i>>13]->b_data))
- free++;
- printk("%d/%d free inodes\n\r",free,p->s_ninodes);
-}
+/*
+ * linux/fs/super.c
+ *
+ * (C) 1991 Linus Torvalds
+ */
+
+/*
+ * super.c contains code to handle the super-block tables.
+ */
+#include
+#include
+#include
+#include
+
+#include
+#include
+
+int sync_dev(int dev);
+void wait_for_keypress(void);
+
+/* set_bit uses setb, as gas doesn't recognize setc */
+#define set_bit(bitnr,addr) ({ \
+register int __res __asm__("ax"); \
+__asm__("bt %2,%3;setb %%al":"=a" (__res):"a" (0),"r" (bitnr),"m" (*(addr))); \
+__res; })
+
+struct super_block super_block[NR_SUPER];
+/* this is initialized in init/main.c */
+int ROOT_DEV = 0;
+
+static void lock_super(struct super_block * sb)
+{
+ cli();
+ while (sb->s_lock)
+ sleep_on(&(sb->s_wait));
+ sb->s_lock = 1;
+ sti();
+}
+
+static void free_super(struct super_block * sb)
+{
+ cli();
+ sb->s_lock = 0;
+ wake_up(&(sb->s_wait));
+ sti();
+}
+
+static void wait_on_super(struct super_block * sb)
+{
+ cli();
+ while (sb->s_lock)
+ sleep_on(&(sb->s_wait));
+ sti();
+}
+
+struct super_block * get_super(int dev)
+{
+ struct super_block * s;
+
+ if (!dev)
+ return NULL;
+ s = 0+super_block;
+ while (s < NR_SUPER+super_block)
+ if (s->s_dev == dev) {
+ wait_on_super(s);
+ if (s->s_dev == dev)
+ return s;
+ s = 0+super_block;
+ } else
+ s++;
+ return NULL;
+}
+
+void put_super(int dev)
+{
+ struct super_block * sb;
+/* struct m_inode * inode; */
+ int i;
+
+ if (dev == ROOT_DEV) {
+ printk("root diskette changed: prepare for armageddon\n\r");
+ return;
+ }
+ if (!(sb = get_super(dev)))
+ return;
+ if (sb->s_imount) {
+ printk("Mounted disk changed - tssk, tssk\n\r");
+ return;
+ }
+ lock_super(sb);
+ sb->s_dev = 0;
+ for(i=0;is_imap[i]);
+ for(i=0;is_zmap[i]);
+ free_super(sb);
+ return;
+}
+
+static struct super_block * read_super(int dev)
+{
+ struct super_block * s;
+ struct buffer_head * bh;
+ int i,block;
+
+ if (!dev)
+ return NULL;
+ check_disk_change(dev);
+ if (s = get_super(dev))
+ return s;
+ for (s = 0+super_block ;; s++) {
+ if (s >= NR_SUPER+super_block)
+ return NULL;
+ if (!s->s_dev)
+ break;
+ }
+ s->s_dev = dev;
+ s->s_isup = NULL;
+ s->s_imount = NULL;
+ s->s_time = 0;
+ s->s_rd_only = 0;
+ s->s_dirt = 0;
+ lock_super(s);
+ if (!(bh = bread(dev,1))) {
+ s->s_dev=0;
+ free_super(s);
+ return NULL;
+ }
+ __asm__ volatile ("cld"); /* by wyj */
+ *((struct d_super_block *) s) =
+ *((struct d_super_block *) bh->b_data);
+ brelse(bh);
+ if (s->s_magic != SUPER_MAGIC) {
+ s->s_dev = 0;
+ free_super(s);
+ return NULL;
+ }
+ for (i=0;is_imap[i] = NULL;
+ for (i=0;is_zmap[i] = NULL;
+ block=2;
+ for (i=0 ; i < s->s_imap_blocks ; i++)
+ if (s->s_imap[i]=bread(dev,block))
+ block++;
+ else
+ break;
+ for (i=0 ; i < s->s_zmap_blocks ; i++)
+ if (s->s_zmap[i]=bread(dev,block))
+ block++;
+ else
+ break;
+ if (block != 2+s->s_imap_blocks+s->s_zmap_blocks) {
+ for(i=0;is_imap[i]);
+ for(i=0;is_zmap[i]);
+ s->s_dev=0;
+ free_super(s);
+ return NULL;
+ }
+ s->s_imap[0]->b_data[0] |= 1;
+ s->s_zmap[0]->b_data[0] |= 1;
+ free_super(s);
+ return s;
+}
+
+int sys_umount(char * dev_name)
+{
+ struct m_inode * inode;
+ struct super_block * sb;
+ int dev;
+
+ if (!(inode=namei(dev_name)))
+ return -ENOENT;
+ dev = inode->i_zone[0];
+ if (!S_ISBLK(inode->i_mode)) {
+ iput(inode);
+ return -ENOTBLK;
+ }
+ iput(inode);
+ if (dev==ROOT_DEV)
+ return -EBUSY;
+ if (!(sb=get_super(dev)) || !(sb->s_imount))
+ return -ENOENT;
+ if (!sb->s_imount->i_mount)
+ printk("Mounted inode has i_mount=0\n");
+ for (inode=inode_table+0 ; inodei_dev==dev && inode->i_count)
+ return -EBUSY;
+ sb->s_imount->i_mount=0;
+ iput(sb->s_imount);
+ sb->s_imount = NULL;
+ iput(sb->s_isup);
+ sb->s_isup = NULL;
+ put_super(dev);
+ sync_dev(dev);
+ return 0;
+}
+
+int sys_mount(char * dev_name, char * dir_name, int rw_flag)
+{
+ struct m_inode * dev_i, * dir_i;
+ struct super_block * sb;
+ int dev;
+
+ if (!(dev_i=namei(dev_name)))
+ return -ENOENT;
+ dev = dev_i->i_zone[0];
+ if (!S_ISBLK(dev_i->i_mode)) {
+ iput(dev_i);
+ return -EPERM;
+ }
+ iput(dev_i);
+ if (!(dir_i=namei(dir_name)))
+ return -ENOENT;
+ if (dir_i->i_count != 1 || dir_i->i_num == ROOT_INO) {
+ iput(dir_i);
+ return -EBUSY;
+ }
+ if (!S_ISDIR(dir_i->i_mode)) {
+ iput(dir_i);
+ return -EPERM;
+ }
+ if (!(sb=read_super(dev))) {
+ iput(dir_i);
+ return -EBUSY;
+ }
+ if (sb->s_imount) {
+ iput(dir_i);
+ return -EBUSY;
+ }
+ if (dir_i->i_mount) {
+ iput(dir_i);
+ return -EPERM;
+ }
+ sb->s_imount=dir_i;
+ dir_i->i_mount=1;
+ dir_i->i_dirt=1; /* NOTE! we don't iput(dir_i) */
+ return 0; /* we do that in umount */
+}
+
+void mount_root(void)
+{
+ int i,free;
+ struct super_block * p;
+ struct m_inode * mi;
+
+ if (32 != sizeof (struct d_inode))
+ panic("bad i-node size");
+ for(i=0;is_dev = 0;
+ p->s_lock = 0;
+ p->s_wait = NULL;
+ }
+ if (!(p=read_super(ROOT_DEV)))
+ panic("Unable to mount root");
+ if (!(mi=iget(ROOT_DEV,ROOT_INO)))
+ panic("Unable to read root i-node");
+ mi->i_count += 3 ; /* NOTE! it is logically used 4 times, not 1 */
+ p->s_isup = p->s_imount = mi;
+ current->pwd = mi;
+ current->root = mi;
+ free=0;
+ i=p->s_nzones;
+ while (-- i >= 0)
+ if (!set_bit(i&8191,p->s_zmap[i>>13]->b_data))
+ free++;
+ printk("%d/%d free blocks\n\r",free,p->s_nzones);
+ free=0;
+ i=p->s_ninodes+1;
+ while (-- i >= 0)
+ if (!set_bit(i&8191,p->s_imap[i>>13]->b_data))
+ free++;
+ printk("%d/%d free inodes\n\r",free,p->s_ninodes);
+}
diff --git a/linux-0.11-lab - 副本/0/linux/fs/truncate.c b/linux-0.11-lab - 副本/0/linux/fs/truncate.c
index 36f3ea2..769e109 100644
--- a/linux-0.11-lab - 副本/0/linux/fs/truncate.c
+++ b/linux-0.11-lab - 副本/0/linux/fs/truncate.c
@@ -1,65 +1,65 @@
-/*
- * linux/fs/truncate.c
- *
- * (C) 1991 Linus Torvalds
- */
-
-#include
-
-#include
-
-static void free_ind(int dev,int block)
-{
- struct buffer_head * bh;
- unsigned short * p;
- int i;
-
- if (!block)
- return;
- if (bh=bread(dev,block)) {
- p = (unsigned short *) bh->b_data;
- for (i=0;i<512;i++,p++)
- if (*p)
- free_block(dev,*p);
- brelse(bh);
- }
- free_block(dev,block);
-}
-
-static void free_dind(int dev,int block)
-{
- struct buffer_head * bh;
- unsigned short * p;
- int i;
-
- if (!block)
- return;
- if (bh=bread(dev,block)) {
- p = (unsigned short *) bh->b_data;
- for (i=0;i<512;i++,p++)
- if (*p)
- free_ind(dev,*p);
- brelse(bh);
- }
- free_block(dev,block);
-}
-
-void truncate(struct m_inode * inode)
-{
- int i;
-
- if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode)))
- return;
- for (i=0;i<7;i++)
- if (inode->i_zone[i]) {
- free_block(inode->i_dev,inode->i_zone[i]);
- inode->i_zone[i]=0;
- }
- free_ind(inode->i_dev,inode->i_zone[7]);
- free_dind(inode->i_dev,inode->i_zone[8]);
- inode->i_zone[7] = inode->i_zone[8] = 0;
- inode->i_size = 0;
- inode->i_dirt = 1;
- inode->i_mtime = inode->i_ctime = CURRENT_TIME;
-}
-
+/*
+ * linux/fs/truncate.c
+ *
+ * (C) 1991 Linus Torvalds
+ */
+
+#include
+
+#include