Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1...
Transcript of Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1...
![Page 1: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/1.jpg)
![Page 2: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/2.jpg)
![Page 3: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/3.jpg)
Linux (v0.11)Linux Linux
LINUXLinux Linux
0.11(0.95)
Linux
. , ., , .
:[email protected], [email protected] : ( 1239 ,:200092).
© 2002 - 2007 by Zhao Jiong © 2002 - 2007 .
![Page 4: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/4.jpg)
![Page 5: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/5.jpg)
................................................................................ 1
........................................................ 1.................................................... 1
........................................ 2........................ 2
............................ 3.................................... 4
........................................ 4EXT2 MINIX ......................... 4
1 .................................................................. 7
1.1 LINUX ........................................... 71.2 ........................................................... 141.3 ........................................................... 17
2 LINUX .................................. 19
2.1 LINUX ................................................. 192.2 LINUX ................................. 202.3 LINUX ..................... 222.4 ........................................................... 352.5 LINUX ............................................. 382.6 ................................................ 402.7 LINUX ................................................. 422.8 LINUX ......................... 502.9 LINUX 0.11 ............................. 542.10 LINUX ....................... 552.11 .......................... 622.12 LINUX 0.11 ........................... 632.13 LINUX/MAKEFILE ...................................... 692.14 ......................................................... 78
3 BOOT ............................. 79
3.1 ................................................................... 793.2 ........................................................... 793.3 BOOTSECT.S ................................................ 813.4 SETUP.S ....................................................... 903.5 HEAD.S ...................................................... 1103.6 ......................................................... 126
4 (INIT)....................................... 127
4.1 ................................................................. 1274.2 MAIN.C ...................................................... 1274.3 .............................................. 1394.4 ......................................................... 140
5 (KERNEL)................................... 143
5.1 .................................................................. 1435.2 .................................................. 1435.3 MAKEFILE ................................................. 1465.4 ASM.S ........................................................ 1485.5 TRAPS.C ..................................................... 1545.6 SYSTEM_CALL.S ........................................ 1625.7 MKTIME.C .................................................. 1745.8 SCHED.C .................................................... 1765.9 SIGNAL.C ................................................... 1955.10 EXIT.C ..................................................... 2065.11 FORK.C .................................................... 2125.12 SYS.C ....................................................... 2205.13 VSPRINTF.C .............................................. 2275.14 PRINTK.C ................................................. 2355.15 PANIC.C ................................................... 2365.16 ........................................................ 237
6 (BLOCK DRIVER)......... 239
6.1 .................................................................. 2396.2 .......................................................... 2406.3 MAKEFILE ................................................. 2436.4 BLK.H ........................................................ 2466.5 HD.C .......................................................... 2506.6 LL_RW_BLK.C ........................................... 2726.7 RAMDISK.C ................................................ 2786.8 FLOPPY.C ................................................... 284
7 (CHAR DRIVER) ....... 313
7.1 .................................................................. 3137.2 .................................................. 3137.3 MAKEFILE ................................................. 3227.4 KEYBOARD.S ............................................. 3247.5 CONSOLE.C ................................................ 3427.6 SERIAL.C ................................................... 3677.7 RS_IO.S ...................................................... 3717.8 TTY_IO.C ................................................... 3757.9 TTY_IOCTL.C ............................................. 387
8 (MATH)................................ 395
8.1 .................................................................. 3958.2 MAKEFILE ................................................. 3958.3 MATH-EMULATION.C .................................. 397
9 (FS) ............................................... 399
9.1 .................................................................. 3999.2 .................................................. 3999.3 MAKEFILE ................................................. 415
![Page 6: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/6.jpg)
9.4 BUFFER.C .................................................. 4189.5 BITMAP.C ................................................... 4359.6 TRUNCATE.C .............................................. 4419.7 INODE.C .................................................... 4439.8 SUPER.C .................................................... 4559.9 NAMEI.C .................................................... 4659.10 FILE_TABLE.C .......................................... 4899.11 BLOCK_DEV.C .......................................... 4899.12 FILE_DEV.C ............................................. 4939.13 PIPE.C ...................................................... 4969.14 CHAR_DEV.C ........................................... 5009.15 READ_WRITE.C ........................................ 5039.16 OPEN.C .................................................... 5099.17 EXEC.C .................................................... 5159.18 STAT.C ..................................................... 5359.19 FCNTL.C .................................................. 5379.20 IOCTL.C ................................................... 540
10 (MM) .......................................... 543
10.1 ............................................................... 54310.2 ................................................ 54310.3 MAKEFILE ............................................... 54910.4 MEMORY.C ............................................... 55010.5 PAGE.S ..................................................... 568
11 (INCLUDE) ................................... 571
11.1 ................................................................ 57111.2 INCLUDE/ ................................. 57111.3 A.OUT.H ................................................... 57211.4 CONST.H .................................................. 58311.5 CTYPE.H .................................................. 58311.6 ERRNO.H ................................................. 58511.7 FCNTL.H .................................................. 58711.8 SIGNAL.H ................................................. 58911.9 STDARG.H ................................................ 59111.10 STDDEF.H ............................................... 59211.11 STRING.H ............................................... 59311.12 TERMIOS.H ............................................ 60311.13 TIME.H ................................................... 61011.14 UNISTD.H ............................................... 61211.15 UTIME.H ................................................ 61711.16 INCLUDE/ASM/ ....................... 61911.17 IO.H ....................................................... 61911.18 MEMORY.H ............................................. 62011.19 SEGMENT.H ........................................... 62111.20 SYSTEM.H .............................................. 62311.21 INCLUDE/LINUX/ .................... 62711.22 CONFIG.H ............................................... 62711.23 FDREG.H ............................................ 62911.24 FS.H ....................................................... 63211.25 HDREG.H ................................................ 63811.26 HEAD.H ................................................. 64011.27 KERNEL.H .............................................. 641
11.28 MM.H ..................................................... 64211.29 SCHED.H ................................................ 64211.30 SYS.H ..................................................... 65111.31 TTY.H ..................................................... 65311.32 INCLUDE/SYS/ ......................... 65611.33 STAT.H ................................................... 65611.34 TIMES.H ................................................. 65811.35 TYPES.H ................................................. 65811.36 UTSNAME.H ........................................... 65911.37 WAIT.H ................................................... 660
12 (LIB)............................................... 663
12.1 ................................................................ 66312.2 MAKEFILE ............................................... 66412.3 _EXIT.C ................................................... 66612.4 CLOSE.C .................................................. 66712.5 CTYPE.C .................................................. 66712.6 DUP.C ...................................................... 66812.7 ERRNO.C .................................................. 66912.8 EXECVE.C ................................................ 66912.9 MALLOC.C ............................................... 67012.10 OPEN.C .................................................. 67912.11 SETSID.C ................................................ 68012.12 STRING.C ............................................... 68112.13 WAIT.C ................................................... 68112.14 WRITE.C ................................................ 682
13 (TOOLS) .................................... 684
13.1 ................................................................ 68413.2 BUILD.C ................................................... 684
14 ........................ 691
14.1 ................................................................ 69114.2 BOCHS ............................................ 69114.3 BOCHS LINUX 0.11 ............... 69514.4 ........................ 70214.5 ........................ 70414.6 BOCHS ................................... 70614.7 ........................................ 71314.8 ............................................ 71614.9 LINUX 0.11 0.11 ........... 72314.10 REDHAT 9 LINUX 0.11 72414.11 + 72714.12 SHOELACE .... 73214.13 GDB BOCHS ....... 735
.................................................................... 741
............................................................................ 743
1 ............................................ 7432 ............................................ 7453 80X86 ................................. 7534 ASCII ................................................. 7635 1 ................................ 763
![Page 7: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/7.jpg)
............................................................................ 765
![Page 8: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/8.jpg)
Linux
Linuxlinux
linuxLinux
UNIXLinux
Linux Linux Redhat 7.0 2.2.16Linux 2.2.20 268Linux
Linux Scott Maxwell Linux Linux
Linux(*.h)
make
LinuxLinux
John Lions UNIX UNIXUNIX V6 PDP-11
A.S.TanenbaumMINIX Linux
LinuxLinux
Linux Linux
![Page 9: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/9.jpg)
Linux1991 10 Linux Linus Torvalds Linux 0.03
LINUX--a free unix-386 kernel 1 LinuxGNU Hurd
” Linux GNU Hurd
LinuxLinux
LinuxLinux
Linux DJJ x86Uclinux www.linux.org Linux
LinuxLinux Linux
Leland L. Beck(SIC)
Linux LelandLinux Linux
LinuxVFS a.out
Linux
LinuxRTFSC – Read The Fucking Source Code
M.J.Bach UNIX UNIX
AST
![Page 10: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/10.jpg)
I/O
LinuxLinux
0.11 Linux
Linux 2.6.0 5920.11 2
Linux 0.11 GNU gcc
VFS ext2 ext3
![Page 11: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/11.jpg)
C Intel CPU CBrain W. Kernighan Dennis M. Ritchie The C Programming Language
Intel CPUGNU gcc Internet
5.580x86
80x86 INTEL 80386 Programmer's Reference Manual 80x86
LinuxLinux M.J.Bach UNIX
Linus Linux MINIX LinuxMINIX 1.0 A.S.Tanenbaum
TanenbaumLinux
Linux Linux TanenbaumLinux is obsolete Linux
Ext2 MINIX
Linux Ext2 Ext3 1.xLinux Linux
Linux 0.11 MINIX 1.0Linux
Linux
![Page 12: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/12.jpg)
Linux
2007.6.
![Page 13: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/13.jpg)
![Page 14: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/14.jpg)
1
Linux LinuxLinux
1.1 Linux
Linux UNIX 1991 10 5Internet
UNIX Linux UNIX MINIX
GNU POSIX Internet LinuxLinux Linus
Torvalds Linux0.01 hacker 1.0
LinuxLinux 2.6.x Linux
2.6.11 2 Linux
1.1.1 UNIX Linux UNIX UNIXKen.Thompson Dennis Ritchie 1969 DEC PDP-7 Ken Thompson PDP-7 Space travel
1969 UNIXBCPL Dennis Ritchie 1972 C
UNIX
1.1.2 MINIX MINIX Andrew S. Tanenbaum AST AST Amsterdam Vrije
ACM IEEE ( )100 5
AST (1914 ) M.I.TBerkeley
Vrije AmsterdamAST
MINIX 1987 1991 1.51.5 2.0
![Page 15: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/15.jpg)
MINIX FTPLinux Linus Linux
MINIX MINIXLinus Linux Linus
MINIX Chacker
1.1.3 GNU GNU FSF(the Free Software Foundation) Richard M. Stallman 1984
UNIX GNU GNU "GNU's Not Unix" "guh-NEW" Linux GNU
"Linux" Stallman GNU/Linux
90 GNU emacsbash shell gcc gdb Linux
Linux LinuxGNU/Linux”
1.1.4 POSIX POSIX Portable Operating System Interface for Computing Systems IEEE ISO/IEC
UNIX1980 UNIX
(usr/group) UNIX AT&T System V Berkeley CSRG BSD 1984 /usr/group 1985 IEEE TCOS-SS ANSI IEEE
1986 4 IEEE1988 9 IEEE 1003.1-1988
POSIX.11989 POSIX ISO/IEC 15 ISO 1990
POSIX.1 C IEEE 1003.1-1990 ANSI ISO/IEC 9945-1:1990 POSIX.1 API
IEEE POSIX300 (POSIX.2)
POSIX.3 API POSIX.4 1990 25 16X/Open AT&T OSF
90 POSIX 1991-1993 LinuxUNIX Linux Linux
UNIX Linux 0.01 0.11Linux POSIX Linux 0.01 /include/unistd.h
POSXI Linus OK
![Page 16: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/16.jpg)
1991 7 3 comp.os.minix post POSIXPOSIX
1.1.5 Linux1981 IBM IBM PC 1981-1991 MS-DOS
Apple MACsUNIX UNIX
UNIX PC Bell LabsUNIX PC
MINIX AST
Linux Linus Benedict Torvalds(1991 ) Linus Benedict Torvaldshacker 21
GNU GNU CGNU MINIXGNU HURD
Linus386 MINIX MINIX Linus
Intel 80386 Modem80386 CPU
MINIX MINIXLinus
GNUGNU C GNU HURD
Linus1991 4
Intel 386 LinuxLinus comp.os.minix
MINIX Linux Linus 1 comp.os.minix 1991 3 29 gcc on minix-386 doesn't optimize”, gcc MINIX-386 MINIX-386 Bruce Evans Intel 386 32 MINIX Linus 1991
MINIX MINIX MINIXIntel 80386
MINIX “RTFSC (Read the F**ing Source Code :-)”
![Page 17: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/17.jpg)
1991 4 Linus MINIX-386 (Hacking the kernel)GNU (GNU gcc bash gdb ) 4 13 comp.os.minix
bash MINIX shellLinux 1991 7 3 comp.os.minix
Linux Linus FREAX FREAXLinux POSIX
Linus (1991 8 25 comp.os.minix) MINIXMINIX ”( What would you like to see in minix? )
( )386(486) GNUMINIX
MINIX MINIXbash(1.08 ) gcc(1.40 )
Linus MINIX 386AT Linux
Linus Linux1991 10 5 Linus comp.os.minix Linux
Free minix-like kernel sources for 386-AT Linux10 5 Linux Linux
RedHat
1.1.6 Linux Linux 1.0 1 1 Linus 2003
9 BitKeeper 1.0Linux 0.00 Linus 80386
Linux 0.01 1991 9 17 Linusinclude/string.h
8MB Linus 0.02 0.03
/
0.00 1991.2-4 ’AAA...’ ’BBB...’
0.01 1991.9.17 Linux
0.02 1991.10.5 0.03
0.10 1991.10 Ted Ts’o Linux boot
as86 gas
0.11 1991.12.8
0.12 1992.1.15 swapping
0.95.x
( 0.13)1992.3.8
MINIX
![Page 18: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/18.jpg)
MINIX Linux
CDROM
0.96.x 1992.5.12
UNIX Socket ext alpha SCSI
X-Windows
C 0.95
0.97.x 1992.8.1 SCSI msdos ext
3GB
0.98.x 1992.9.28
TCP/IP 0.8.1 extfs
mm 4GB 1GB 0.98.4
256 32
0.99.x 1992.12.13 4G
NFS
1.0 1994.3.14
0.10 Ted Ts'o LinusGNU gcc
/ mount/umount Linus"(C) 1991 Linus Torvalds" boot/boot.sboot/bootsect.s boot/setup.s 16MB
dev/port dev/nullkernel/signal.c sigaction()
0.10 Linux 0.11
/etc/rc Ted Ts'oGalen Hunt John T Kohl kernel/console.c
KILL Linux 0.12 Linus 1991
2MB gccLinus 1.0 0.13
0.95 Linus 1.0 0.950.95 Linux
Linus0.12
Ted Ts'oIO
Peter MacDonald Linux UNIXselect() Peter MacDonald MINIX
MINIX Linus
0.95 GNU GPL Linux 3 19923 8 1 0.95 10 3 170.95a 1 4 9 0.95c+
![Page 19: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/19.jpg)
VFS MINIXMINIX MINIX 0.95
Ross Biro ptraceCtrl-Alt-Del swapon()
4 James Wiegand
0.95 Linus2005
11 9 2.6.14 16000 gz 47MB1–2
( gz )
2.0.40 2004.2.8 7.2 MB
2.2.26 2004.2.25 19 MB
2.4.31 2005.6.1 37 MB
2.6.14 2005.11.9 47 MB
1.1.7 Linux Linux Linux Linus FREAX
ftp.funet.fi Ari LemkeLinus Linux
LinuxLinus Just for Fun Linus 2
LinuxFreax Makefile -
- Freax”
Ari Lemke ftp Freax(Linux)
1.1.8 LinuxLinux Linux Linus
Theodore Ts'o (Ted Ts'o) 1990 MITHacking on Linux
IBMIETF
Linux Linux
![Page 20: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/20.jpg)
linux Maillist Linux LinuxLinux Linux 0.10 ramdisk.c
kmalloc.c) Linux Linuxftp tsx-11.mit.edu Linux Linux
ext2 Linuxext3 97
2002 5 Linux Journal IBM LinuxLinux LSB(Linux Standard Base)
Linux Alan Cox (Swansea University College) MUD Multi-User Dungeon or Dimension
90 games.mud postsMUD (rec.games.mud 1992 3 9 A history of MUD)
MUD
MINIX Linux 0.11 386BSD386SX 386BSD Intel 386SX CPU
Linux Linux LinuxLinux
Linux (beautifully) Linux 0.95 Linux
Linus Linux TCP/IPLinux Linux Linux
Linus Microsoft 2001Linux 2.4.x Linus ( 2.5.x
)The Linux Kernel Hackers' Guide Michael K. Johnson
Linux ( 0.97 ) Linux Linux Document Project - LDPLinux Journal RedHat
Linux LinuxLinux CREDITS
Linux 400 email
Linux UNIX -- UNIX 1969 Bell Linux UNIX UNIX
MINIX -- MINIX UNIX 1987Andrew S. Tanenbaum MINIX ( )
UNIX Linux MINIX 1991 GNU -- Linux Linux GNU Linux
GNU ( bash shell) Linux POSIX -- Linux Linux
![Page 21: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/21.jpg)
INTERNET -- Intenet Linux0.13(0.95)
1.2
Linux 0.11 Linux-0.11 1991 12 8
bootimage.Z rootimage.Z Image bootimage ImagePC ROM BIOS
rootimage
Linux UNIXDOS
as86.tar.Z 16 linux-0.11.tar.Z Linux 0.11INSTALL-0.11 Linux 0.11
rootimage.Z InternetLinux 0.11 rootimage-0.11 0.11
gcc 1.40 oldlinux.org
http://oldlinux.org/Linux.old/images/ bootimagerootimage
http://oldlinux.org/Linux.old/kernels/ Linux 0.11http://oldlinux.org/Linux.old/bochs/ bochs
Linuxhttp://oldlinux.org/Linux.old/Linux-0.11/ Linux 0.11
linux-0.11Makefile
shell
![Page 22: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/22.jpg)
C GNU C/ Intel 8259A
Linux 0.11 Linux Linux-0.11325K Linux 2.6.XX
200Linux 0.01 240K 0.01
0.110.11
(bootimage) (rootimage)
Linux 0.11TCP/IPLinux Linux
Linux
Linux 1.1linux
1-1 Linux/
1 4 325 10 511 13
2 Linux
![Page 23: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/23.jpg)
LinuxLinux/
Makefile make3 boot/ bootsect.s BIOS
setup.s 32 head.s32
4 init/ main.cshell
main.cLinux
5 kenel/ schedule() sleep_on()
C 5.5
6 kernel/dev_blk/
7 kernel/dev_chr/0.11
8 kernel/math/
9 fs/Andrew S. Tanenbaum MINIX Linux
MINIX Linux 0.1110 mm/ Intel 80X86
80X86Intel 80386 (Intel 80386 Programmer's
Reference Manual)
Linux11 include/
12 Linux 0.11 lib/
0.1113 tools/ build.c (image)
kernel image
![Page 24: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/24.jpg)
14 BochsLinux Linux 0.11RedHat 9
Linux
PC
Linux LDP Linux Document ProjectHOWTO LDP
Linus Linux 3 M. J. Bach UNIXUNIX System V Linus
LinuxJohn H. Crawford Programming the 80386
80x86 Andrew S.Tanenbaum MINIX1 Linus MINIX 1.0 Linux
Tanenbaum
C
LinuxLinux Linux GURU
1.0Linux 2.5.44
patch
1.3
Linux UNIX LinuxRichard Stallman GNU Linux
POSIX Linux A.S.T MINIX LinuxInternet Linux
![Page 25: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/25.jpg)
![Page 26: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/26.jpg)
2 Linux
Linux Linux
Linux/ Makefile
80X86
42-1 Internet
LinuxX shell
Linux
Linux 0.11 LinuxLinux 0.11
2.1 Linux
Linux 0.11
(int x80) CPU User Mode Kernel Model
![Page 27: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/27.jpg)
CPU
2-2
2.2 Linux
Linux 5
CPUCPU
Linux
2-3Linux 0.11 Linux 0.95
0.96
![Page 28: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/28.jpg)
3
NFS ramdisk
Linux 0.112-4
![Page 29: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/29.jpg)
2.3 Linux
Linux 0.11CPU Linux 0.11
Intel 80X86 CPU
2.3.1Linux 0.11
2-5
![Page 30: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/30.jpg)
LinuxROM BIOS 640K--1MB
RAM
CPUIntel 80386 CPU
Segmentation System Paging SystemLinux
2.3.2 Linux 0.11 3a. b. CPU c.
Virtual Address
GDTLDT 13 GDT LDT 1
Intel 80X86 CPU 16384 4G16384 * 4G = 64T
Logical Address Intel
Linear Address
Intel 80386 4G
![Page 31: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/31.jpg)
Physical Address CPU
Virtual Memory
3
Linux 0.11 64MB0x0000000 0x4000000
2.3.34GB 232
CPU 2-6
CPU
CPU80386
CPU CR2
SwapperLinux 0.11 mm/memory.c
Intel CPU SegmentCPU
32
![Page 32: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/32.jpg)
ds64KB si
2-7 (a)
Segment Descriptor Table
Segment Selector
16 2-7 (b)CPU
2-8 8
4GB
3 GDT Global Descriptor Table IDT Interrupt
![Page 33: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/33.jpg)
Descriptor Table IDT 808680X86 CPU GDT IDT
LDT Local Descriptor TableLDT GDT LDT
CPUGDT IDT LDT CPU GDTR IDTR LDTR
32 -1CPU 16
2-9 80X86 CPU 313 8192 0--8191 2 TI
0 GDT LDT
15
Linux 0.11 CPUGDT LDT GDT LDT
2-10
LDT GDTLDT
24 TSS GDTTSS
idt Linux 0.11
![Page 34: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/34.jpg)
2-13 2-14 TSS Task State Segment CPU CPU
CPU TSS CPUTSS 2-25 Linux 0.11
TSS Linux 0.11 GDT4 syscall include/linux/sched.h 150
Linus
2.3.4
,
CPU 4096 1
80X86CR0 31
803864
1024 12-11 10
D Dirty
2-12 CR3CR3 PDBR 32
1 1024 1024 * 4KB = 4MB1024 1024 1024 * 4MB = 4GB
![Page 35: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/35.jpg)
Linux 0.1x
Intel 80386 CPU 4GCPU PDT
PTLinux 0.11
64MB ( )*64MB
10
Linux 0.11 GDT 256 22 (256-4)/2 =126
((256-4)/2)* 64MB 8G 0.11 NR_TASKS = 6464M ( )*64MB
64MB*64 =4G 2-13 416MB
1 00
0 640KBLinux 0.11 I Instruction D Data
I&D1 64MB 640KB2 3 128MB 192MB
64MB 4G CPU0 1 64MB
4GB 0.11
![Page 36: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/36.jpg)
2-144GB
2 3
Code Section Data Section CPUCPU
4GB
![Page 37: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/37.jpg)
2.3.5 CPU Intel 80X86 CPU 4 0 3 Linux 0.11
CPU 0 3
2-16CPU CPU 0 3
1 2
0
3
2.3.6CPU Linux 0.11
0 12.3.6.1
Linux 0.11 head.s16MB 0
0xFFFFFF 16MB GDT IDT TSS
![Page 38: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/38.jpg)
1 00--16MB 4
42-17
Linux 0.11 16MB 40964KB
GDT IDTsetup.s GDT
IDT 0x902000 0x90200
1 head.s GDTRIDTR GDT IDT
0
1
Linux 0.11 16MB4MB 2MB Linux 0.11 4MB
4MB--16MBCPU
4MB--16MB16MB init/main.c
16MB 0--16MB16MB
![Page 39: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/39.jpg)
init/main.c32MB 8
32MB
2.3.6.2 00 640KB
0 640KB
TSS0 0 sched.h113 TSS0 sched.c 104 2-26
0 2-18
0head.s
0b111 user_stack[]0
2.3.6.3 10 1 0
fork() 1 init 10 1
1 64MB--128MB 64MB--64MB+640KB0--640KB 1 640KB
11 PCB 1
TSS 2-19
![Page 40: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/40.jpg)
1 0--640KB 0user_stack[] kernel/sched.c 67--72 1
1 1 0user_stack[] 1 1 1 user_stack[]
1
2.3.6.42 init 1
Linux 0.11 64 2
2 nr nrnr*64MB 2 = nr*64MB = 2 * 64MB = 128MB
64MB 2 128MB--192MB 64MB/4MB = 16
2-20 22 execve() shell 1
2 128MB--128MB+640KB 21 2 init() execve()
shell 1shell 2-20 2 shell2 1 shell
execve()2 64MB 2
Load on demand
![Page 41: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/41.jpg)
Linux 0.99 4GLinux 2.x
2.3.7C malloc()
C malloc()0 1 CPU 4G 64MB
64MB
brkmalloc() brk()
malloc() brk
CPU
C malloc()
free() C
![Page 42: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/42.jpg)
malloc() free() lib/malloc.c
2.4
Linuxsetup.s
2.4.1
Interrupt IRQ - Interrupt Request ISR - Interrupt Service Routine
PIC - Programmable Interrupt ControllerIRQ
PIC PIC
PICPIC INT
PIC PIC32
intPC/AT 256
2.4.2 80X8680X86 8259A 8259A
8 8259A 64 PC/AT8259A 15 2-21
INT IR2 8259A 8259A IRQ28259A 0x20 0xA0 IRQ9 PC/XT IRQ2
PC/AT IRQ2 IRQ2 PIC IRQ9BIOS IRQ9 int 71 IRQ2 int 0x0A
IRQ2 PC/XT 8 PC/AT PC
![Page 43: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/43.jpg)
8259A CPU IN OUT8259A
IRQ0 – IRQ15CPU
INT CPU CPU D7-D0CPU
2.4.3CPU
CPU 3280X86 256
80X86 4 41024 80X86 ROM BIOS
0x0000:0x0000BIOS N
0x0000:N*40x0000:N*4
BIOS 8259A 16 BIOS0x10—0x1f
DOS0x20—0x2f Linux
BIOS setup.s 8259A
![Page 44: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/44.jpg)
head.s BIOS
Intel CPU 32 IDT Interrupt Descriptor TableIDT Intel 8086 -- 80186 CPU
Linux 80X86
2.4.4 LinuxLinux ( ) 0-255
int0--int31(0x00--0x1f) Intel, Intel CPU
(Fault) (traps) int32--int255 (0x20--0xff)CPU 2–1
CPU
Maskable CPU INTR eflags IF
Nonmaskable CPU NMI
Fault CPU
Trap CPU
Abort
Linux int32--int47 0x20--0x2f 8259AIRQ0--IRQ15 2–2 system call int128 0x80
IRQ0 0x20 32 8253 100HZ
IRQ1 0x21 33
IRQ2 0x22 34
IRQ3 0x23 35 2
IRQ4 0x24 36 1
IRQ5 0x25 37 2
IRQ6 0x26 38
IRQ7 0x27 39 1
IRQ8 0x28 40
IRQ9 0x29 41
IRQ10 0x2a 42
IRQ11 0x2b 43
IRQ12 0x2c 44 PS/2
IRQ13 0x2d 45
![Page 45: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/45.jpg)
IRQ14 0x2e 46
IRQ15 0x2f 47
head.sInterrupt Descriptor Table - IDT 256 boot/head.s 78
boot/head.s 150Unknown interrupt 256
A gerneal protection fault ( 13) IDT 256CPU
13 CPU1(0xff) IDT 256
init/main.cint0 --int 31 traps.c
kernl/traps.c 181 int128kernel/sched.c 385
IDT LinuxEFLAGS IF IF
iret IFIF 11 include/asm/system.h
2.4.5Linux 0.11 cli sti
cli CPU clisti CPU
clisti CPU
/ cli CPU sticli sti cli
2.5 Linux
2.5.1syscalls Linux 2-4
int 0x80 eax
C 2-22
![Page 46: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/46.jpg)
0errno perror()
Linuxinclude/unistd.h 60 write 4 __NR_write
include/linux/sys.h sys_call_table[]write() 4sys_call_table[]
'sys_' read() sys_read()
2.5.2int 0x80
eax ebx ecx edx Linux 0.11int 0x80
kernel/system_call.s system_callinclude/unistd.h 133—183
_syscalln() n 0 3 3read()
int read(int fd, char *buf, int n);
_syscall3() read() CC
include/unistd.h 2+2*n 12
C
![Page 47: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/47.jpg)
__NR_read 3 Linux 0x80 eax __res0 errno
-1kernel/system_call.s system_call eax
sys_call_table[]
call _sys_call_table(,%eax, 4) // kernel/system_call.s 94
_sys_call_table + %eax * 4 sys_call_table[]4 4
2.5.3 LinuxLinux Linux
ebx ecx edx
LinusIntel CPU System Call gate
2.6
2.6.1PC/AT
RT Real Time CMOS RAM
![Page 48: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/48.jpg)
RT/CMOS RAM PC/AT MotorolaMC146818
Linux 0.11 init/main.c time_init()kernel/mktime.c kernel_mktime() 1970 1 1 0
UNIXstartup_time time()
startup_time stime()jiffies
10include/linux/sched.h 142
HZ = 100 CURRENT_TIME startup_timejiffies/100 i
2.6.2Linux 0.11 PC Intel 8253 8254 0
3 LATCH 10 0OUT 8254 1.193180MHz
LATCH=1193180/100 11931 OUT 010 IRQ0
1 1timer_interrupt
timer_interrupt jiffiesjiffies 1 C do_timer()
CPL CSCPL do_timer() CPL=0
stime 11 floppy.c
01 CPU
0 do_timer()0 CPU
0 do_timer() schedule()do_timer() Linux
nonpreemptive 1 preemptiveLinux
![Page 49: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/49.jpg)
Dynamic TimerLinux 0.11 64 sched.c 264--336
2.7 Linux
process LinuxCPU
(time slice)CPU
15 =150Linux 0.11 64
fork child processparent process process ID pid
CPU
Linux kernel mode user mode
Linux task
2.7.1Linux
task_struct include/linux/sched.hPCB Process Control Block PD Processor Descriptor
![Page 50: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/50.jpg)
long state CPUstate TASK_RUNNING state
TASK_INTERRUPTIBLE TASK_UNINTERRUPTIBLETASK_INTERRUPTIBLE TASK_UNINTERRUPTIBLE
TASK_STOPPEDSIGSTOP SIGTTIN
SIGTTOU ptraceTASK_ZOMBIE
long counter counter
counter counterpriority
long priority counter Linux 0.11 15 15priority counter sched.c fork.c
prioritylong signal 32
= +1 Linux 32
struct sigaction sigaction[32]
![Page 51: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/51.jpg)
long blocked signal
int exit unsigned long start_code CPU Linux 0.1x
64MBunsigned long end_codeunsigned long end_data + unsigned long brk bss 10-6 brk
malloc() brk
unsigned long start_stack 10-6
long pid long father long pgrp long session long leader 4unsigned short uid idunsigned short euid unsigned short suid ID set-user-ID
suid uid suid euidunsigned short gid idunsigned short egid unsigned short sgid ID set-group-ID
sgid gid sgid egid 5sys.c
long alarm alarm() alarm()kernel/sched.c 338
alarmSIGALRM signal()
sigaction()long utime long stime long cutime long cstime long start_time unsigned short used_math int tty tty -1unsigned short umask struct m_inode * pwd i
chdirstruct m_inode * root i
chroot
![Page 52: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/52.jpg)
struct m_inode * executable ii
executable->i_count 1exec()
exec() i exit()i 1 memory.c
share_page() executable2
1 execve() executable 00 1 1 execve()
executable 0 0executable 0
fork() 1 executable 0 execve() executablei 0
unsigned long close_on_exec execve() include/fcntl.h
fork() execve()
close_on_exec execve()
struct file * filp[NR_OPEN] 32
struct desc_struct ldt[3] 0 1 2
struct tss_struct tss TSS Task State Segmenttss_struct CPU CPU
CPUswitch
Linux
2.7.22-23
stateLinux
![Page 53: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/53.jpg)
TASK_RUNNINGCPU
running CPU 2-23 0
TASK_RUNNING0
TASK_INTERRUPTIBLE
TASK_UNINTERRUPTIBLE
wake_up()
TASK_STOPPEDSIGSTOP SIGTSTP SIGTTIN SIGTTOU
SIGCONT Linux 0.11
TASK_ZOMBIEwait()
wait()
sleep_on() interruptible_sleep_on()
![Page 54: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/54.jpg)
CPUTASK_UNINTERRUPTIBLE TASK_INTERRUPTIBLE
2.7.3boot/
init/main.c
0 0 fork() 1 1shell 0 0 pause()
0 move_to_user_mode include/asm/system.h main.c0 3 0sched_init() 0
0 include/linux/sched.h 0TSS LDT tr
ldtr0 0
0 0 640KB0 16MB 0
main.c 0 00 main.c move_to_user_mode 03
0 move_to_user_modeCPU CPU 3
IRET
0 3 iret CPU0 3 2-24
031
![Page 55: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/55.jpg)
move_to_user_mode 00
iretiret CPU CS:EIP CPU
3 0 CPUSS:ESP DS ES FS GS
CPU iret3 0
PAGE_SIZE + (long)&init_task0 0
1 1
2.7.4 Linux fork() 0 0
64 fork()
TASK_UNINTERRUPTIBLE
15 150TSS 0 tss.eax = 0
tss.esp0 tss.ss0tss.ldt GDT
tss.i387
Copy On Write1 GDT
TSS LDT tss ldt
exec() exec()
CPU FaultCPU
2.7.5
CPULinux TASK_RUNNING CPU
![Page 56: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/56.jpg)
Linux 0.112.7.5.1 schedule() TASK_RUNNING
counter
TASK_RUNNINGpriority counter
prioritycountercounter2
counter schedule()TASK_RUNNING
switch_to()0 Linux 0.11 0 pause()
schedule() schedule() 00
2.7.5.2schedule() include/asm/system.h
switch_to() CPUswitch_to()
current TSSCPU CPU
TR TSS tsstss CPU
2-25
![Page 57: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/57.jpg)
2.7.6
exit() do_exit()
i initSIGHUP
TASK_ZOMBIESIGCHLD do_exit()
wait() waitpid()
2.8 Linux
Linux
Linux 0.11
![Page 58: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/58.jpg)
0
CPU CPU0 3TSS 0 tss.ss0 tss.esp0
2.8.1(bootsect.s setup.s)
bootsect ROM BIOS 0x7c00bootsect 0x9000:0 SS 0x9000
esp 0xff00 0x9000:0xff00 boot/bootsect.s 61 62 setup.sbootsect
(head.s)head.s 0x10esp user_stack head.s 31 1 4K
user_stack sched.c 67--72 10242-26
system.map
![Page 59: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/59.jpg)
(main.c)init/main.c move_to_user_mode() 0
move_to_user_mode() main.c 0fork() main.c init() 1 1 main() “ ”
0 0 0
2.8.2
CPU4096 – 3K
64MB
0 1 64MB64MB
2-27CPU Linux Copy
on Writepush
0 1
TSS ss0 esp0 ss0 esp0
task_structfork() tss (tss.esp0 tss.ss0)
kernel/fork.c 93
p tsstask_struct tss task_struct tss.ss0
0x10 tss.esp0 task_struct 2-28tss.esp0 Intel CPU
esp esp
![Page 60: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/60.jpg)
tss.ss0 0x10head.s
16MB Linux 0.11 head.s 110
CPU TSStss.ss0 tss.esp0 esp0 CPU
0 10 idle 1 init 0
1 640KB 00 1 64MB
0--640KBmove_to_user_mode() 0 1
0 sched.c user_stack[]1 0 0 1
1 1 user_stack[] 12 1
1 01 0
00
move_to_user_mode() iret 2-24
0 0IRET 0 3 0
esp user_stack ss0x17 LDT 0 0x0f
CS EIP IRET0
![Page 61: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/61.jpg)
2.8.3Linux 0.11
CPU 3 0 CPUCPU TSS
0 48 TSS ss0 esp0CPU ss esp
eflags cs eip
eflagsiret eflags
2-29
CPUCPU eflags
cs eip
2.9 Linux 0.11
LinuxLinux UNIX
etc/ dev/ bin/ sh mkfs fdiskusr/ usr/bin var/
![Page 62: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/62.jpg)
Windows2000 CWindows2000 NTFS FAT32
Linux 0.11 MINIX 1.0 Linuxext2 ext3
1 Linux 0.11 2 bootimagerootimage bootimage Image
rootimageDOS
Linux 509 510ROOT_DEV 0
2.10 Linux
Linux
Linux
tar linux-0.11.tar.gz linux/2-30
14 102
2.10.1 linux linux 14
![Page 63: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/63.jpg)
Makefile make make
make linux Makefile Makefile linux
makelinux make
2.10.2 boot boot 3 3
32bootsect.s setup.s as86 as86
head.s GNU as AT&T
bootsect.s 00 1 PC ROM BIOS BIOS 0x7C00 setup.s system head.s system
2.10.3 fs Linux 0.11 1.0 MINIX Linux MINIX
MINIX MINIX LinuxMINIX Linux MINIX MINIX
Linux LinuxLinux MINIX
Linuxsleep()
fs/ 17 C2-31 .c
![Page 64: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/64.jpg)
buffer.cfile_table.c ioctl.c
kernel/chr_drv/tty.c io exec.cdo_execve() exec() fcntl.c i/oread_write.c / stat.c
open.cchar_dev.c rw_char() pipe.c
file_dev.c i namei.cblock_dev.c inode.c
i truncate.cbitmap.c i super.c
buffer.c ll_rw_blockfs kernel/blk_drv/ll_rw_block.c
ll_rw_block()
![Page 65: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/65.jpg)
2.10.4 include32 .h 13 asm 4 linux
10 sys 5
<a.out.h> a.out a.out<const.h> i i_mode<ctype.h> <errno.h> (Linus minix )<fcntl.h> <signal.h> <stdarg.h> - va_list
va_start, va_arg va_end vsprintf vprintf vfprintf<stddef.h> NULL, offsetof(TYPE, MEMBER)<string.h> <termios.h> <time.h> tm<unistd.h> Linux__LIBRARY__ _syscall0()<utime.h> utime()2.10.4.1 include/asm
CPU 4<asm/io.h> io io<asm/memory.h> memcpy()<asm/segment.h> <asm/system.h> /2.10.4.2 Linux include/linux<linux/config.h> HD_TYPE<linux/fdreg.h> <linux/fs.h> file,buffer_head,m_inode<linux/hdreg.h> <linux/head.h> head<linux/kernel.h> <linux/mm.h> <linux/sched.h> task_struct 0 <linux/sys.h> 72 C , 'sys_'<linux/tty.h> tty tty_io2.10.4.3 include/sys <sys/stat.h> stat{}<sys/times.h> tms times()<sys/types.h> <sys/utsname.h> <sys/wait.h> wait() waitpid()
![Page 66: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/66.jpg)
2.10.5 initmain.c
shell
task 0fork()
init()shell
2.10.6 kernel linux/kernel 12 Makefile 3
kernel/ fork exitget_hd_block tty_write
2-32
asm.s traps.ctraps.c C
exit.c
![Page 67: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/67.jpg)
fork.c sys_fork() C find_empty_process()copy_process() mktime.c mktime() 1970 1 1 0
init/main.c panic.c panic() printk.c printk() sched.c (sleep_on wakeup schedule )
signal.c 4do_signal()
sys.c system_call.s Linux int 0x80
C Linux vsprintf.c2.10.6.1 kernel/blk_drv
blk_drv 4 c 1 blk.hC 2-33
blk.h 3 C hd.c/ do_hd__request() floppy.c
/ do_fd_request() ll_rw_blk.c /ll_rw_block()
fs/buffer.c2.10.6.2 kernel/chr_drv
4 C 2rs-232 2-34
![Page 68: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/68.jpg)
tty_io.c tty tty_read() tty_write()C do_tty_interrupt()
console.c con_write() ttycon_init()
rs_io.s0x3fa 0x2fa 4
do_tty_interrupt() serial.c UART
tty rs_write() tty_ioctl.c tty io tty_ioctl() termio(s) io
sys_ioctl() fs/ioctl.c keyboard.S keyboard_interrupt2.10.6.3 kernel/math
C math_emulate.c math_emulate() int7C CPU
SIGFPE
2.10.7 libC
C lib/init/main.c 0 1
libc lib/ 12 Ctytso malloc.c
_exit() close(fd) dup()open() write() execve() malloc()
wait() setsid() include/string.h
![Page 69: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/69.jpg)
2.10.8 mm2
Linux 386 4G 6464MB
fork
page.s int 14
memory.c mem_init() page.sdo_no_page() do_wp_page()
2.10.9 toolsbuild.c Linuximage
2.11
Linux 5int 0x80 12
0 1lib/
C libc2-4
libc API
ID
UNIX POSIX API Linux APIPOSIX API
APIPOSIX
APIinclude/unistd.h
Linux LSB Linux Standard BaseLinux 2
C /I/O fopen fclose open
![Page 70: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/70.jpg)
close
3
2.12 Linux 0.11
Linux 0.11 as86ld86 16
bootsect.s setup.s GNU gas C gcc gld
Linux 0.11Image Linux 0.11 a.out as86
ld86 MINIXMINIX a.out
John R. Levine Linkers & Loaders
2.12.1Linux 0.11 GNU gcc gasUNIX a.out Assembly & linker editor output
a.outText section Data section
2-35
![Page 71: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/71.jpg)
a.out 7(exec header) exec
ld
(text segment)
(data segment)
(text relocations)
(data relocations)(simbol table)
(string table)
Linux 0.11 Intel CPU64MB
2.12.1.132 exec
a.out include/a.out.h
a.out a.out Linux 0.11OMAGIC Old Magic a.out0x107 0407 ZMAGIC
a.out demang-paging load on demand0x10b 0413
32 ZMAGIC1024 32 0 1024
OMAGIC .o32
![Page 72: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/72.jpg)
a_text a_data a_bssbss Linux
bssbss bss
a_entry a_syms a_trsize a_drsize
02.12.1.2 Linux 0.11 a.out
8
4r_address 2
r_length 0 3 1 24 8 r_pcrel PC3
r_extern r_symbolnum0 r_symbolnum
1 r_symbolnum
2.12.1.3
![Page 73: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/73.jpg)
GNU gcc12 null
n_type1
n_type a.out.h
text data bbsabsundef 0
bssbss
Common block
2.12.2 Linux 0.11Linux 0.11 objdump
hello.o
![Page 74: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/74.jpg)
hello.o 0407 OMAGIC0x28 3 0x10
0 hello 0413 ZMAGIC1024 0x3000 0x1000 141
strip hellohello 0 hello
20591 17412
a.out 2-36 Linux 0.1164MB ZMAGIC a.out
Linux 0.11 Demand-pagingfs/execve()
![Page 75: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/75.jpg)
bss bss 10 heap
2.12.3
a.out a.out
2-37 text data bss
bssbss
![Page 76: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/76.jpg)
Linux 0.11 ZMAGIC a.out0 bss
Linux 0.11ZMAGIC
Linux 0.11 Makefile makemake tools/ build.c
build ROM BIOSbuild
bootsect setup systemImage
2.13 linux/Makefile
linux Makefile
2.13.1Makefile make
Makefile make Makefile
![Page 77: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/77.jpg)
makemake Makefile
Makefilemake make
Makefile (last-modification time)Makefile Makefile
'#' '='Makefile make tools/ build
image boot/bootsect.s setup.s 8086
GNU gcc/gas system buildimage build tools/build.c
/ 2-38
2.13.22-1 linux/Makefile
![Page 78: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/78.jpg)
![Page 79: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/79.jpg)
![Page 80: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/80.jpg)
![Page 81: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/81.jpg)
2.13.32.13.3.1 Makefile makefile make Make
makefilemakefile GNU make
make makefile make makefilemake makefile make
![Page 82: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/82.jpg)
make makefilemakefile
make
make CC
(object file)
makefile
(target)... : (prerequisites)... (command) ... ...
' '' '('clean') ' '
' ' make
make
’$^’’$<’ ’$@’
’$<’
foo.o : foo.c defs.h hack.h cc -c $(CFLAGS) $< -o $@
’$<’ foo.c $@ foo.o make
makemake
’$<’ *.c make *.c *.s
![Page 83: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/83.jpg)
(target)'clean' (delete)
make
makefile makefile
makefile makemake *.c
2.13.3.2 as86,ld86 as86 ld86 Bruce Evans Intel 8086 8086
386 32 Linux 16 (bootsector)setup GNU gas
GNUMASM Borland Turbo ASM NASM Intel
as86 MINIX MINIX PC/IXPC/IX Intel 8086 CPU UN*X Andrew S. Tanenbaum
PC/IX MINIX
Bruce Evans minix 32 Linux Linus TorvaldsLinus Bruce Evans UNIX minix
Linus Intel 386Linux Bruce Evans
FTP ftp.funet.fi (www.oldlinux.org)
![Page 84: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/84.jpg)
2.13.3.3 System.mapGNU gld ld -M nm
link map
System.maplinux/Makefile System.map
System.mapSystem.map
System.map
1 2sections 3
2 2–3
![Page 85: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/85.jpg)
include/a.out.h nlist{} n_type 110--185
A Absolute
B BSS section BSS
C Common
D Data
G Global
I Inderect
N Debugging
R Read only
S Small
T Text
U Undefined 0
- Stabs a.out stab
? Unknwon
System.map klogdklogd klogd
System.map klogd lsof psdosemu
2.14
Linux Linux 0.11
Linux 0.11 Linux makefile
Linux 0.11
![Page 86: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/86.jpg)
3 boot
3.1
boot/ 3-1bootsect.s setup.s 16
Intel Intel 8086 as86 ld86 head.sGNU GNU as gas
AT&T Linus Intel x86 Linus GNU
i386 CPU16 1994 GNU as 16 .code16
GNU Using as - The GNU Assembler 80386 162.4.X bootsect.s setup.s as
3-1 linux/boot/
8086 Intel 80X86PC 80386 32
PC 80386 32
3.2
Linux PC 80x86CPU 0xFFFF0 ROM-BIOS
PC BIOS 0512 0x7C00
Linux 8086 boot/bootsect.s BIOS0x7C00 31KB 0x90000 576KB2KB boot/setup.s 0x90200 system
![Page 87: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/87.jpg)
0x10000 64KB system 0x80000 512KB0x90000 576KB bootsect setup setup system
system3-1 Linux
"Loading..."boot/setup.s
VGA0x10000 0x0000 0x0000
32 : IDT GDT LDTinit/main.c main() boot/head.s
bootsect 0x0000 setupsetup ROM BIOS
BIOS0x400 (1KB) BIOS
Linux LinuxLinux 0.11 MINIX 1.0
bootsect.s 43509 510 0x1fc--0x1fd
![Page 88: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/88.jpg)
3.3 bootsect.s
3.3.1 bootsect.s 0 0
1 PC ROM BIOS ROM BIOS bootsect0x7C00 bootsect 0x90000
2 4 setup setup.sbootsect 0x90200 BIOS 0x13
Loading system...” setupsystem 0x10000
1.44M A root_dev(508 ) setup 0x90200 setup
setup system 3-2
Linux 0.11 1.44MB 1.44MB 28801 setup 4 0.11 system
240 2630
3.3.23-1 linux/boot/bootsect.s
![Page 89: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/89.jpg)
![Page 90: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/90.jpg)
![Page 91: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/91.jpg)
![Page 92: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/92.jpg)
![Page 93: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/93.jpg)
![Page 94: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/94.jpg)
![Page 95: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/95.jpg)
![Page 96: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/96.jpg)
3.3.3bootsect.s Alessandro Rubini
Linux (http://oldlinux.org/Linux.old/docs/)38680x86
[1] [16] Linux0.11
3.3.3.1 Linux 0.113 1- ,2-
,3- ,4- ,5- ,6- ,7- 1 1--4= *256 +
3–1
![Page 97: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/97.jpg)
3–1
0x300 /dev/hd0 10x301 /dev/hd1 1 10x304 /dev/hd4 1 40x305 /dev/hd5 20x306 /dev/hd6 2 10x309 /dev/hd9 2 4
Linux 0.95
3.3.3.2
Shoelace LILO Grub bootsect.sbootsect Image
Image
1 MBR - Master Boot Record BIOS 0x7c00 0x600
MBR 1 0x7c00
Image
Image 4bootsect.s Image
Image14
bochs
3.4 setup.s
3.4.1 setup.s ROM BIOS
0x90000 bootsect3 2 ttyio.c
( )
0x90000 2 0x00- 0x00-
0x90002 2 1MB KB
0x90004 2
0x90006 1
![Page 98: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/98.jpg)
0x90007 1
0x90008 2 ??
0x9000A 1 (0x00-64k,0x01-128k,0x02-192k,0x03=256k)
0x9000B 1 0x00- ,I/O=0x3dX 0x01- ,I/O=0x3bX
0x9000C 2
...
0x90080 16 1
0x90090 16 2
0x901FC 2 bootsec.s
setup system 0x10000-0x8ffff system512KB 0x00000 (idtr)
(gdtr) A20 8259A0x20 - 0x2f CPU CR0 32
system head.shead.s 32 IDT
GDT GDT head.s
Linux 3-3
BASE 4GB 32
LIMIT 20-1 Granularity
1 1MB4KB 4GB 12
Granularity 0 11 4KB
TYPE 4 11- 81 0
Descriptor Privilege Level – DPL 4 0–3 03
Segment-Present bit – P
![Page 99: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/99.jpg)
Accessed bit – A
Global descriptor table – GDT Local descriptor table – LDTGDTR LDTR GDT LDT
lgdt sgdt GDTR lldt sldt LDTRlgdt 6 GDTR
4 LDTR lldt 2GDT GDT
setup.s GDT 207--2160x00C09A00000007FF 8MB =(0x7FF + 1) * 4KB 1 0
0 0x9A0 32 4KB
0x00C09200000007FF 8MB 0 0x920 32
4KB
3-4
15
(Index) 8192 213
8( )(Table Indicator - TI) 0 GDT 1
LDT(Requestor's Privalege Level - RPL)
GDT ( 0) 0 0GDT (null) CS
SS
GDTlgdt CPU GDT gdtr
32
3.4.2 3-2 linux/boot/setup.s
![Page 100: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/100.jpg)
![Page 101: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/101.jpg)
![Page 102: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/102.jpg)
![Page 103: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/103.jpg)
![Page 104: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/104.jpg)
![Page 105: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/105.jpg)
![Page 106: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/106.jpg)
3.4.3BIOS
BIOS A20Intel 32
3.4.3.1setup.s system 0x0000 0x90000
![Page 107: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/107.jpg)
3-5
NULL0x0000 setup.s
'jmp 0,8 ' 193 head.s '8'gdt '0'
3.4.3.2 BIOS 0x10ROM BIOS
A.
/
ah =0x12
bl =0x10
bh0x00 – I/O 0x3DX
0x01 – I/O 0x3BX
X 0 – f
bl00 = 64K, 01 = 128K, 02 = 192K, 03 = 256K
ch
0 1 2
1 0 2
![Page 108: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/108.jpg)
2 1 1
3 0 1
4-7 ( 0)
cl
0 1
1 2
2 3
3 4
4-7
EGA/VGA :
0x00 MDA/HGC
0x01-0x03 MDA/HGC
0x04 CGA 40x25
0x05 CGA 80x25
0x06 EGA+ 40x25
0x07-0x09 EGA+ 80x25
0x0A EGA+ 80x25
0x0B EGA+ 80x25
3.4.3.3 INT 0x41int 0x41 4 * 0x41 =0x0000:0x0104
100% BIOSF000h:E401h int 0x46
0x00 cyl
0x02 head
0x03 ( PC XT 0)
0x05 wpcom 4
0x07 ECC XT 0
0x08 ctl
0
1 (0) ( IRQ)
2
3 8 1
4 (0)
5 +1 1
6 ECC
7
0x09 XT 0
0x0A XT 0
![Page 109: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/109.jpg)
0x0B XT 0
0x0C lzone ( )
0x0E sect
0x0F
3.4.3.4 A20 1981 8 IBM IBM PC CPU Intel 8088
20 (A0 – A19) RAM KB 1MB 200xffff:0xffff 0x10ffef 0x100000(1MB)
0x0ffef IBM 1985 AT Intel 80286 CPU 2416MB 8088 1MB
8088IBM 0x100000
8042 P2 P21A20 20
A20
A20 setup.s 138-144A20
A20A20
A20 (Fast Gate A20) I/O 0x92 A200x92
0xee A20 A20
3.4.3.5 8259A2 PC/AT
8259A 8259A Linux
1. 8259APC/AT 8259A PIC
15 2-20 INT IR2 8259A0x20 0xA0 8259A 3-6
![Page 110: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/110.jpg)
IRR Interrupt Request Register8 D7—D0 IR7—IR0 IMR Interrup Mask
Register 8 81 IMR IRR IRR
PR Priority ResolverIRR ISR In-Service
Register ISR CPU8259A ICW Initialization Command
Words OCW Operation Command Words 8259A A0 PC/AT
A0 0 0x20 0xA0 A0=1 0x21 0xA18259A IR0—IR7
IRRIMR
8259A CPU INT CPU8259A INTA 8259A
ISR ISRIRR
CPU 8259A 2 INTA 8259A8259A 8 CPUCPU 8259A AEOI Automatic End of Interrupt2 INTA ISR
8259A 8259AEOI ISR 2 8259A
EOI 8259A
![Page 111: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/111.jpg)
2.8259A 4
8259A 8259A8259A 8259A 4 ICW1—ICW4
8259A 3 OCW1—OCW38259A 8259A
3-7 ICW1 ICW28259A ICW3 ICW1
ICW4 ICW1
(1) ICW1 5 D4 =1 A0=0 ICW1 PC/AT8259A 0x20 0xA0 ICW1
3–5
D7 A7
D6 A6
D5 A5
A7—A5 MCS80/85
ICW2 A15—A8 8086/88
D4 1 1
D3 LTIM 1 - 0 –
D2 ADI MCS80/85 CALL 8086/88
D1 SNGL 1 – 8259A 0 –
D0 IC4 1 – ICW4 0 –
Linux 0.11 ICW1 0x11 8259A
![Page 112: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/112.jpg)
ICW4
(2) ICW2 5 ICW1 A0=1 ICW2PC/AT 8259A 0x21
0xA1 ICW2 3–6
D7—D0 MCS80/85 A15—A8 ICW1 A7-A58086/88 T7—T3 5 8259A 3
8 8259A 2 INTA CPU Linux 0.11 ICW2 0x20 0 —70x20—0x27 ICW2 0x28 8 —150x28—0x2f
(3) ICW3 8259A 8 Slave Register ICW33–7
S7—S0 1 IRIRID2—ID0
CAS2—CAS0 ID2—ID0
Linux 0.11 8259A ICW3 0x04 S2=1 0 IR2ICW3 0x02 2 IR2
0 8—15 3—7
(4) ICW4 ICW1 0 IC4 ICW4 A0=1 ICW43–8
D7 0 0
D6 0 0
D5 0 0
![Page 113: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/113.jpg)
D4 SFNM 1 – 0 –
D3 BUF 1 – 0 –
D2 M/S 1 – 0 –
D1 AEOI 1 – 0 –
D0 PM 1 – 8086/88 0 – MCS80/85
Linux 0.11 8259A ICW4 0x01 8259A8086
3.8259A 8259A
OCW1—OCW3 8259A8259A
(1) OCW1 8259A IMR / A0 1OCW1 3–9
D7—D0 8 7 —0 M7—M0 M=1M=0
Linux 0.11
0x21 8259A ~0x40 6kernel/blk_drv/floppy.c 461
(2) OCW2 EOI D4D3 = 00 A0=0OCW2 OCW2 3–10
D7 R
D6 SL
D5 EOI
D4 0 0
D3 0 0
D2 L2
D1 L1
D0 L0
L2—L0 3 IRQ0--IRQ7
IRQ8—IRQ15
D7—D5 3–11 * L2--L0ISR
![Page 114: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/114.jpg)
R(D7) SL(D6) EOI(D5)
0 0 1 EOI
0 1 1 * EOI
1 0 1 EOI
1 0 0 AEOI
0 0 0 AEOI
1 1 1 * EOI
1 1 0 *
0 1 0
Linux 0.11 8259A EOIOCW2 0x20 EOI
(3) OCW3 IRR ISR D4D3=01 A0=0OCW3 / Linux 0.11 OCW3 3–12
D7 0 0
D6 ESMM
D5 SMM D6—D5 11 – 10 –
D4 0 0
D3 1 1
D2 P 1 – POLL 0 –
D1 RR
D0 RIS
RD
D1—D0 11 – ISR 10 – IRR
4. 8259A8259A 8259A
8259A(1)
8259A0 7 0 CPU
ISREOI ICW4 AEOI ISR
CPU 2 INTA ISR
IMR 88259A IR0 IR7
![Page 115: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/115.jpg)
Linux 0.11 8259A(2) EOI
ISRICW4 AEOI CPU 2 INTA
AEOIEOI EOI
EOIEOI EOI EOI
EOI EOIEOI ISR EOI OCW2 3
011 3 Linux EOIEOI ISR
ISR OCW2 3001 Linux 0.11 EOI
(3)ICW4 D4=1
a. CPU
b. EOI ISR
0 0 EOI 0EOI(4) 8259A 864 3 3
8259AICW3 2 EOI
(5)OCW2 8259A
7(6)
IMR 8259AOCW1 IMR IMR D7--D0 IR7 -- IR0
EOI 8259A8259A
OCW3 D6 D5 OCW1
![Page 116: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/116.jpg)
(7) 8259A 3 IMR IRR ISR CPU IMR
OCW1 IRR ISR OCW3 IRR ISR
3.4.3.6 Intel CPU 32 Intel CPU Intel CPU 8088/8086
Intel 80386 324G
Linux
setup.s head.s 80x86
3.4.3.7 Intel 80386 CPU 4 GDTR Global Descriptor Table Register LDTR Local Descriptor Table Register
GDT LDT IDTR Interrupt Descriptor Table Register
IDT
TR Task Registertask{}
3.4.3.8 Intel 80386 4 CR0 CR1 CR2 CR3
MOV 3-8
CR0PE – Protection Enable 0
MP – Math Present 1 WAIT
![Page 117: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/117.jpg)
EM – Emulation 2TS – Task Switch 3
ET – Extention Type 4 8028780387
PG – Paging 3110
CR2 PG CPU CR3 PG CPU
3.5 head.s
3.5.1 head.s system system
(head) system setup6 Linux 0.11 system
120KB 240heads.s
AT&T GNU gas gld6
0idt 256
ignore_int 8 3-9
P DPL head.s0x0008 ignore_int head.s
head.s 00 P=1 DPL=00
5 4 0x8E00gdt GDT
setup.s GDT 8MB 16MBsetup.s 16MB
GDT GDT gdtGDT 0x902XX
31 23 15 7 0
(OFFSET) 31..16 P DPL 0 1 1 1 0 0 0 0
SELECTOR 0
![Page 118: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/118.jpg)
0 1MB A201MB CPU IP MOD 1Mb
PC 80287 80387CR0
016MB 4
3-10 P R/WU/S / A D 20
20
0x07 P=1 U/S=1 R/W=1CPU
U/S R/W PLPL CPU CPL < 3
0 CPU SupervisorCPL = 3 CPU User User
U/S=1 W/R = 1U/S=0 0 1
0x7
head.s /init/main.c main()
3.5.23-3 linux/boot/head.s
![Page 119: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/119.jpg)
![Page 120: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/120.jpg)
![Page 121: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/121.jpg)
![Page 122: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/122.jpg)
![Page 123: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/123.jpg)
![Page 124: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/124.jpg)
![Page 125: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/125.jpg)
![Page 126: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/126.jpg)
3.5.33.5.3.1 head.s
idt gdt 1KB system3-11
![Page 127: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/127.jpg)
3.5.3.2 Intel 32Intel 386 32
8086 CPU 80x86 CPU
gdtr idtr lgdt lidt CPU 0x9000
64KB8
eip32
GDT IDTLDT CPU GDT IDT GDTR
IDTR 0 8191 GDTLDT LDTR LDTR
GDT LDT GDTLDT
GDT LDT Linux 0.11 64GDT 64 LDT
IDT GDT Linux GDT 2568 GDT 0-1 6-7
2-3 4-53-12 Linux GDT
GDT LDT0 TSS0
![Page 128: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/128.jpg)
TSS LDTDS
DS:ESI
3.5.3.3 align .align
CPU
.align val1, val2, val3
1 val1 20 3 val3
val3 2 val23 val3
ELF Intel 80X86 CPU 1 val1 '.align 8' 8 8
a.out 1 val1 0 22^Val1 head.s '.align 3' 8
![Page 129: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/129.jpg)
8 GNU as gasgas
3.5.3.4 CC head.s init/main.c
C head.s C
Intel 80x86 CPU
(1)Intel CPU
Stack frame 3-13 ebpframe pointer esp stack pointer esp
ebp
A B B A A B AA B
ebp
![Page 130: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/130.jpg)
B CPU
C '&'Besp push pop
call ret callcall
retcall
eax
Intel CPU eax edx ecx
B A BA ebx esi edi
Aebp esp
(2)C exch.c
swap() C main()swap() 3-14 swap()
main() ebp
main() a b -4 -8
![Page 131: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/131.jpg)
gcc -Wall -S -oexch.s exch.c C exch.s
![Page 132: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/132.jpg)
swap() 3--55 esp 4 c
6--15 swap 6--8 1 &aecx -4(%ebp) 9--12
2 &b 1 13--15c 2 16--17 leave
swap() esp ebp ret19--21 main() main() a b
22--23 24-28 main() swap()leal b a swap()
1 call 29--30eax
(3) main()gcc 1.40 gcc
C main()crt0.s crt0.s stub
Linux 0.11 crt0.s_environ
gcc gcc'-v'
![Page 133: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/133.jpg)
stub crt0.old gld exch.o exch crt0.o head.s 136--140 init/main.c main() 139
140 main() head.s 218ret main() init/main.c
3.6
bootsect.s setup.s system setup.s0x90000 0x90200 setup system
head.s setup ROM BIOS 0x90000
system 0x00000 systemhead.s 0x00000 32
CR0system head.s CPU 32
Head.s 256 A20
system init/main.cinit/main.c
![Page 134: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/134.jpg)
4 (init)
4.1
init/ main.c boot/ head.smain.c
Linux
C CBrian W. Kernighan Dennis M. Ritchie C
C GNU gccgcc inline
C '//'*.h
4.2 main.c
4.2.1 main.c setup.s
RAMDISK 4-1
ROM BIOS1K 1024 mm
4Kmm
![Page 135: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/135.jpg)
ttytask 0
0
0 CPU 03 main.c 0 fork()
init() init 4-2
main.c
0 0fork() 1 init init()
shell 0 0idle 0 pause()
init() 4rc shell
setup()
init() tty0 stdin stdoutstderr
init() 2shell /bin/sh etc/rc rc
DOS AUTOEXEC.BAT 0
![Page 136: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/136.jpg)
/etc/rc stdin etc/rc/bin/sh /etc/rc
/bin/sh 2 init() shell/bin/sh 2 init 2
shell /bin/sh shellshell shell /bin/sh argv[]
shell 0 1 '-' /bin/shshell /bin/sh
Linux exit logoutshell shell
1 init() init
fork()init 0 0
1 0 main.c 00 fork() gcc
23
init 1 0 init1MB 640KB
init0 0 640KB
1 640KB 11
0 11 / 0 1
0 1 init0 1 0
0 fork() pause() 0 1
init 2 execve() 27 Copy on Write
![Page 137: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/137.jpg)
Linux shelllib/ string.c
4.2.24-1 linux/init/main.c
![Page 138: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/138.jpg)
![Page 139: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/139.jpg)
![Page 140: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/140.jpg)
![Page 141: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/141.jpg)
![Page 142: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/142.jpg)
![Page 143: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/143.jpg)
4.2.34.2.3.1 CMOS PC CMOS 64 128 RTC Real Time Chip 64 CMOS IBM PC-XT
BCD 14
CMOS 0x700x71 0x70 0x71 OUT
0x70 IN 0x710x70
![Page 144: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/144.jpg)
0x71 main.c 70 0x80 CMOS
128 0x80Linus CMOS CMOS
0x801.0 ( 1.0
drivers/block/hd.c 42 ) 4–1 CMOS
0x00 ( ) 0x11
0x01 0x12
0x02 ( ) 0x13
0x03 0x14
0x04 ( ) 0x15 ( )
0x05 0x16 ( )
0x06 ( ) 0x17 ( )
0x07 ( ) 0x18 ( )
0x08 ( ) 0x19-0x2d
0x09 ( ) 0x2e ( )
0x0a RTC A 0x2f ( )
0x0b RTC B 0x30 1Mb ( )
0x0c RTC C 0x31 1Mb ( )
0x0d RTC D 0x32
0x0e POST 0x33
0x0f 0x34-0x3f
0x10
4.2.3.2 fork()fork (
exec()fork fork()
PID fork() 0fork() 0
4-3
![Page 145: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/145.jpg)
init fork() 179 194execve() sh
186 202exit()
wait()
4.2.3.3 (session)2 process
pid(Porcess ID)fork() shell
[plinux root]# cat main.c | grep for | more
cat grep moregid Group
ID gid pidgid setpgid()
Ctrl-C
Sessionshell Session leader
Controlling Terminal Controlling process logout
setsid()4-4
Foreground process group
![Page 146: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/146.jpg)
Background process group/dev/tty
/dev/tty
4.3
183 200 init()shell /bin/sh
init.c/etc/
agetty getty getty login:getty login login
shell shell 4-5
init, getty, login, shell
init /etc/rc /etc/inittabfork()
agetty8 getty init wait()wait() pid
agetty
init agettyLinux
init
getty tty/etc/issue
fork()
exec()
exec()
1
![Page 147: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/147.jpg)
getty plinux login: login
login passwdgetpass() ”password:”
pw_passwdlogin 1
init wait() pidagetty
login Current Work Directory/
ID HOME= shell SHELL=USER= LOGNAME= PATH= /etc/motd
message-of-the-day loginID shell bash csh
/etc/passwd shell /bin/sh/ login
Linux man 8 login shell
shellshell shell
login shell argv[0] ’-’ shellshell shell shell
/etc/profile .profile shell ENVshell .profile shell
.profile shellENV
4.4
0.11 MINIX/etc/rc /bin/sh /dev/* /etc/ /dev/ /bin/ /home/ /home/root/
Linuxmain.c
1032
Intel 80x86
Linux
sched.cschedule() system_call.s _timer_interrupt
10 do_timer()
![Page 148: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/148.jpg)
sleep_on() schedule() CPUschedule()
do_timer()CPU
schedule()
![Page 149: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/149.jpg)
![Page 150: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/150.jpg)
5 (kernel)
5.1
linux/kernel/ 10 C 2 kernelMakefile 5-1
1312
5-1 linux/kernel/
5.2
5-1 2-17
![Page 151: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/151.jpg)
5.2.1asm.s traps.c asm.s
traps.c asm.s csystem_call.s mm/page.s PC 8259A2-5
CPU 12 EFLAGS CSEIP 5-2(a)
CPU80386
CPU
CPUEFLAGS 5-2(c) (d)
asm.s Intel int0--int16 int17-int31 IntelIRQ int32-int47 16
Linux int128(0x80)kernel/system_call.s
![Page 152: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/152.jpg)
CPU int 8 int10 - int 145-2 (b)
asm.s5-3
5.2.2 Linux int 0x80 eax
ebx ecx edxsystem_call.s fork.c signal.c sys.c exit.c
system_call.s asm.sfork.c signal.c traps.c
C fork.c C find_empty_process() copy_process() signal.cdo_signal() 4
sys_xxx() sys.c exit.c sys_xxx() sys_xxx()
sys_execve() Csignal.c 4
'do_' C'sys_'
do_signal()sys_pause() sys_execve() C
![Page 153: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/153.jpg)
5.2.3schedule.c mktime.c panic.c printk.c vsprintf.c
schedule.c schedule() sleep_on() wakeup()
mktime.c mktime() init/main.cpanic.c panic() printk.c vsprintf.c
printk() vsprintf()
5.3 Makefile
5.3.1linux/kernel/ make 2
Makefile 2-1
5.3.25-1 linux/kernel/Makefile
![Page 154: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/154.jpg)
![Page 155: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/155.jpg)
5.4 asm.s
5.4.1 asm.s CPU FPU
kernel/traps.ctraps.c C
5-44 5-4(a)
esp ( esp0 ) C do_divide_error()C esp1 , eax
eax esp2do_divide_error() eip esp0
esp3 8 esp2
![Page 156: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/156.jpg)
CPU 5-4(b)esp0 C do_double_fault() C
esp1 eax ebx esp0esp1 eax ebx
5-4(a)
do_divide_error() esp0 esp0C do_divide_error() traps.c
void do_divide_error(long esp, long error_code)
C
5.4.25-2 linux/kernel/asm.s
esp0esp1
esp3
esp2
esp0esp1
esp3
esp2
![Page 157: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/157.jpg)
![Page 158: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/158.jpg)
![Page 159: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/159.jpg)
![Page 160: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/160.jpg)
![Page 161: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/161.jpg)
5.4.35.4.3.1 Intel
Intel 5–1
5.5 traps.c
5.5.1 traps.c asm.s C
die()trap_init() init/main.c
asm.sC
![Page 162: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/162.jpg)
5.5.25-3 linux/kernel/traps.c
![Page 163: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/163.jpg)
![Page 164: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/164.jpg)
![Page 165: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/165.jpg)
![Page 166: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/166.jpg)
5.5.35.5.3.1
C C
GNU gcc 4 Extensions to the C Language FamilyUsing Inline Assembly with gcc
asm(“
![Page 167: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/167.jpg)
: : : );
CC
” gccgcc
/22
01 #define get_seg_byte(seg,addr) \ 02 ({ \ 03 register char __res; \ 04 __asm__("push %%fs; \ 05 mov %%ax,%%fs; \ 06 movb %%fs:%2,%%al; \ 07 pop %%fs" \ 08 :"=a" (__res) \ 09 :"0" (seg),"m" (*(addr))); \ 10 __res;})
10__res
10'\'
1 get_seg_byte(seg,addr)3 __res
eax “register char __res asm ("ax");” "asm""__asm__" 4 "__asm__" 4 7 4 AT&T
8 eax __res"=a" "a" "=" 9
seg eax "0" (*(addr))
"%0" %0 %1 …%9%0 ("0" (seg)) %1
%2 6 %2 (*(addr))4—7 fs eax
fs fs:(*(addr)) aleax __res
seg addr
![Page 168: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/168.jpg)
01 asm("cld\n\t" 02 "rep\n\t" 03 "stol" 04 : /* */ 05 : "c"(count-1), "a"(fill_value), "D"(dest) 06 : "%ecx", "%edi");
1-3 45 count-1 ecx "c" fill_value
eax dest edi gccgcc fill_value eax
gcc eaxmovl
gcc gccgcc 5–2
a eax m
b ebx o
c ecx I 0-31
d edx J 0-63
S esi K 0-255
D edi L 0-65535
qeax ebx ecx edx
M 0-3
r N 1 0-255
geax ebx ecx edx
O 0-31
A eax edx (64 )
gcc
01 asm("leal (%1, %1, 4), %0" 02 : "=r"(y) 03 : "0"(x));
”leal (r1, r2,4), r3” r1+r2*4 r3 x 5
![Page 169: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/169.jpg)
"%0","%1" gcc "%1" x "%0"0
gcc r eax
"leal (eax,eax,4), eax"
gcc asmvolatile asm volatile (……);
__asm__ __volatile__ (……);
include/string.h strncmp()"\n\t" gcc C
5.6 system_call.s
5.6.1Linux 0.11 int 0x80 eax
![Page 170: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/170.jpg)
libc forkfork() libc fork() int 0x80
include/linux/sys.h int 0x80
(system_call) int 0x80 80sys_execve sys_fork
(int 16) (int7) (int32) (int46) (int38)
(system_call coprocessor_error device_not_available)C 3 ebx
ecx edx CC linux
include/linux/sys.hIRQ 8259A
EOI C
(int 0x80) “ ”C “Bottom half”
eaxLinux ds,es fssys_call_table C C
Ccounter==0 schedule()
jmp _schedule "jmp _schedule" ret_from_sys_callschedule() ret_from_sys_call
ret_from_sys_call0
1
do_signal()
“ ” system_call5-5
![Page 171: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/171.jpg)
int 0x80 LinuxLinux 0.11 ebx ecx edx 3
eax
ds es fsLinux fs
CPU get_fs_byte() put_fs_byte()include/asm/segment.h
Linus
Y
Y
Y
N
Y
![Page 172: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/172.jpg)
5.6.25-4 linux/kernel/system_call.s
![Page 173: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/173.jpg)
![Page 174: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/174.jpg)
![Page 175: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/175.jpg)
![Page 176: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/176.jpg)
![Page 177: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/177.jpg)
![Page 178: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/178.jpg)
![Page 179: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/179.jpg)
5.6.35.6.3.1 GNU 32 GNU AT&T 32
AT&T: immed32(basepointer, indexpointer, indexscale) Intel: [basepointer + indexpointer*indexscal + immed32]
immed32 + basepointer + indexpointer * indexscale immed32 basepointer
o C AT&T: _booga Intel: [_booga]
C (booga) o AT&T: (%eax) Intel: [eax] o AT&T: _variable(%eax) Intel: [eax + _variable] o 4 AT&T: _array(,%eax,4) Intel: [eax*4 + _array] o
C *(p+1) p char *
![Page 180: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/180.jpg)
AT&T: AT&T 1(%eax) eax p Intel: [eax+1] o 8 eax ebx
AT&T: _array(%ebx,%eax,8) Intel: [ebx + eax*8 + _array]
5.6.3.2Linux
ioctl()
Linux 0.11
sys_sethostname()kernel/sys.c thisname
sys_uname() thisname 218-220
include/unistd.h 131251
include/linux/sys.h sys_call_table
![Page 181: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/181.jpg)
system_call.s 61 nr_system_calls 1lib/ libc sethostname()
5.6.3.3Linus as86 GNU as asm.s
Linux crt0.o
4 - sys_write() 1 - sys_exit()C sys_write(int fd, char *buf, int len) fs/read_write.c 83 3
3 ebx ecx edx
5.7 mktime.c
5.7.1kernel_mktime() 1970 1 1 0
![Page 182: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/182.jpg)
C mktime()tm UNIX
5.7.25-5 linux/kernel/mktime.c
![Page 183: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/183.jpg)
5.7.35.7.3.1
y 4 100 400 y
5.8 sched.c
5.8.1 sched.c (sleep_on()wakeup() schedule() ) getpid()
![Page 184: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/184.jpg)
do_timer() Linus
schedule() schedule()
alarmalarm (alarm<jiffies), SIGALRM alarm
jiffies 10ms/ sched.hTASK_INTERRUPTIBLE
TASK_RUNNING
counterswitch_to()
prioritycounter
sleep_on() wake_up()schedule() sleep_on()
tmp
*p tmp current *pi i_wait buffer_wait tmp
current 5-6
![Page 185: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/185.jpg)
*p*p
NULLtmp
CPU sleep_on() tmp
tmp5-7 sleep_on()
sleep_on() schedule()
wake_up()
sleep_on()
interruptible_sleep_on() sleep_on()
0.12
include/linux/sched.h
5.8.25-6 linux/kernel/sched.c
![Page 186: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/186.jpg)
![Page 187: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/187.jpg)
![Page 188: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/188.jpg)
![Page 189: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/189.jpg)
![Page 190: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/190.jpg)
“ ”
![Page 191: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/191.jpg)
![Page 192: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/192.jpg)
![Page 193: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/193.jpg)
![Page 194: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/194.jpg)
![Page 195: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/195.jpg)
![Page 196: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/196.jpg)
![Page 197: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/197.jpg)
5.8.35.8.3.1
6 floppy.c4
1.2M
I/O
![Page 198: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/198.jpg)
0x3f2
0x3f4
0x3f5 /
( )
FDC
FDC
0x3f7
0x3f7 ( )
8 /FDC / DMA
FDC 8 FDC FDDCPU FDC FDC
FDC FDC
0x3f5 DIO0 CPU FDC FDC
715
CPU FDC0--8
FDC CPU FDCCPU FDC FDC DMA
1 DMA DMA FDCDMA FDC FDC
CPUCPU FDC FDC
0--7 FDC
5.8.3.2 /1. Intel 8253 8254 Intel 8253 8254 / PIT - Programmable Interval Timer
316
8254 8253 8254 82538253 8254
8253 8253 82545-8
![Page 199: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/199.jpg)
3 8 Data Bus Buffer / Read/Write Logic A1 A0
/ 3 Control Word RegisterA0,A1 RD WR CS CPU 8253
CPU 8254Read-Back Command 3
CLK8253 2.6MHz 8254 10MHz GATE
OUT
5-8(b) Status RegisterNULL Null Count Flag
CE 16 OL Output Latch OLmOLl 8
CECPU CE CE
OL 5-8(b) CR Count Register 8 CPU
CECR CE GATE
CLK 1 0 OUT
2. 8253 82548253 8253
5–4
![Page 200: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/200.jpg)
7 SC1
6 SC0
SC1 SC0 0-2 SC - Select Counter
00 - 0 01 - 1 02 - 2 11 - 8254
5 RW1
4 RW0
RW1 RW0 RW - Read Write
00 - 01 - LSB
10 - MSB 11 -
3 M2
2 M1
1 M0
M2-M0 M - Method
000 - 0 001 - 1 010 - 2
011 - 3 100 - 4 101 - 5
0 BCD 0 - 16 1 - 4 BCD
CPU A1 A0 11 PC 0x43
A1 A0 00 01 10 PC 0x40 0x41 0x42 3
BCD
8254 31 GATE
2D5 D4 00
CEOL CPU OL OL
CPU OLCE 3 8254
NULL 2CPU OL CE
3. 8253/8254 3 6(1) 0 - Interrupt on terminal count
OUT 0 OUT0
GATE
(2) 1 - Hardware Retriggerable One-shotOUT CPU
GATE OUT 0OUT GATE
GATE(3) 2 - Rate Generator
![Page 201: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/201.jpg)
N OUT1 OUT CLK
N NGATE GATE
(4) 3 - Square Wave Mode2 OUT N
CLK N 1 1 N
(5) 4 - Software Triggered StrobeOUT OUT
“ ” GATE1 OUT
(6) 5 - Hardware Triggered StrobeOUT GATE OUT
CLKGATE CLK
PC/AT 8254 3 /DRAM 3
1.193180MHz PC/AT 8254 5-9 A1 A0A1 A0 A9--A2 0b0010000 8254 PC/AT
8254 IO 0x40--0x43 0x40--0x42 0--2 0x43
![Page 202: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/202.jpg)
0 GATE BIOS3 0 65536 0--65535 OUT0
18.2HZ 1.193180MHz/65536 OUT0 82590 54.9ms 1000ms/18.2
1 GATE 218 PC/XT DMA 2
PC/AT RAM 15 1.19318/18 = 66.288KHz
2 GATE TIME2GATE 8255A B D05-9 SPK DATA 8255A B 0x61 D1
8255A
Linux 0.11 8254 0 3LATCH 1193180/100 0 10
IRQ0 8254 0x36 0b00110110(LATCH & 0xff) (LATCH
>> 8) Linux 0.11
5.9 signal.c
5.9.1 signal.c UNIX
ctrl-C SIGINT SIGnal INTerrupt
SIGALRMkill()
UNIX UNIX
POSIX32
32 Linux 22 20 POSIX.12 Linux SIGUNUSED SIGSTKFLT
22include/signal.h
1. SIGKILL SIGSTOP
02.
![Page 203: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/203.jpg)
SIGTERMSIGTERM kill
3.
sys_ssetmask() sys_sgetmask()sys_signal() signal()
sys_sigaction()( sigaction())do_signal() send_sig() tell_father()
exit.c sig signal signal() sigaction() handler , signal()
include/signal.h 55 signal()
signal() signrvoid (*handler)(int)
signal()
signal()
signal() signr handlerSIG_IGN SIG_DFL
SIG_IGNSIG_DFL
signal()SIG_DFL
include/signal.h 45 SIG_DFL SIG_IGN
signal() 0 1signal()
SIGKILL SIGSTOP94—98
![Page 204: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/204.jpg)
SIG_DFL SIG_IGNfork()
signal()
signal()
sigaction() sigactionsignal()
include/signal.h 66
sig sigactionact NULL act oldact
sigaction
sa_handler SIG_DFLSIG_IGN sa_handler sa_mask
signal()signal() sigaction sa_flags
![Page 205: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/205.jpg)
include/signal.h 36-39 sigaction sys_signal() restorer
Libc eax
do_signal() (int 0x80)
5-10
do_signal()longs 106 5-11
do_signal() 104CPU 5-11
SS ESP CS EIPdo_signal() system_call.s 118
5-12 do_signal()
![Page 206: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/206.jpg)
do_signal() SIG_IGN SIG_DFLsa_handler 104 do_signal()
eip old_eip eipsa_handler eip sa_handler
esp longs 7 8
7 8 old_eip eipeflags edx ecx
eaxblocked signr
sa_restorersignal() signr handler
SIGINT Ctrl-CSIGINT
![Page 207: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/207.jpg)
handler() SIGINTSIGINT Ctrl-C SIG_DFL
sa_restorer Libc misc/
signrLibc sa_restorer()
![Page 208: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/208.jpg)
sa_restorer()
do_signel() system_call.s eipiret CPU cs:eip eflags ss:esp
eipret CPU sa_restorer
sa_restorersignr eax ecx edx eflags
CPU sa_restorer ret eipold_eip
5.9.25-7 linux/kernel/signal.c
![Page 209: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/209.jpg)
![Page 210: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/210.jpg)
![Page 211: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/211.jpg)
![Page 212: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/212.jpg)
5.9.35.9.3.1
18 SIGCHILD
Linux 0.11 5–5
1 SIGHUP
(Hangup)
Xterm modem
SIGHUP
(Abort)
2 SIGINT (Interrupt) ^C (Abort)
3 SIGQUIT (Quit) ^\(Dump)
dump core
4 SIGILL (Illegal Instruction) (Dump)
dump core
5 SIGTRAP (Breakpoint/Trace Trap)
6 SIGABRT (Abort)(Dump)
dump core
7 SIGIOT (IO Trap) SIGABRT (Dump)
dump core
8 SIGUNUSED (Unused)
9 SIGFPE (Floating Point Exception) (Dump)
dump core
10 SIGKILL (Kill)
9(Abort)
11 SIGUSR1 (User defined Signal 1) (Abort)
12 SIGSEGV (Segmentation Violation) (Dump)
![Page 213: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/213.jpg)
dump core
13 SIGUSR2 (User defined Signal 2) IPC (Abort)
14 SIGPIPE (Pipe)
(Abort)
15 SIGALRM (Alarm) alarm
(Abort)
16 SIGTERM
(Terminate) kill
SIGKILL (Abort)
17 SIGSTKFLT (Stack fault on coprocessor) (Abort)
18 SIGCHLD (Child)(Ignore)
19 SIGCONT (Continue) SIGSTOP (Continue)
20 SIGSTOP (Stop) (Stop)
21 SIGTSTP (Terminal Stop) (Stop)
22 SIGTTIN
(TTY Input on Background)
SIGCONT (Stop)
23 SIGTTOU
(TTY Output on Background)
SIGCONT (Stop)
5.10 exit.c
5.10.1
send_sig() tell_father()
release()
kill_session()sys_kill() pid
do_exit() exitfather 1
1 init ) 1SIGCHLD
SIGCHLD
![Page 214: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/214.jpg)
waitpid() pidpid
5.10.25-8 linux/kernel/exit.c
![Page 215: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/215.jpg)
![Page 216: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/216.jpg)
![Page 217: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/217.jpg)
![Page 218: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/218.jpg)
![Page 219: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/219.jpg)
5.11 fork.c
5.11.1 fork() Linux 0 0 sys_fork()
![Page 220: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/220.jpg)
kernel/system_call.s 208 sys_fork()C find_empty_process() copy_process()
verify_area() copy_mem() copy_process()
TSS0 tss.eax = 0 tss.esp0
tss.ss0 tss.ldtGDT
tss.i387
1 GDT TSS LDTtss ldt5-13 verify_area()
write_verify() 4096 write_verify()
fork.c fork()fork() PCB
copy_process() TSSnr * 64MB CPU
Linux 0.11Linux 0.11
fork()
![Page 221: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/221.jpg)
5.11.25-9 linux/kernel/fork.c
![Page 222: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/222.jpg)
![Page 223: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/223.jpg)
![Page 224: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/224.jpg)
![Page 225: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/225.jpg)
5.11.35.11.3.1 TSS
5-14 TSS Task State Segment TSStask_struct
31 23 15 7 0
I/O (MAP BASE)
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (LDT) 60
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 GS 5C
![Page 226: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/226.jpg)
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 FS 58
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 DS 54
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SS 50
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 CS 4C
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ES 48
EDI 44
ESI 40
EBP 3C
ESP 38
EBX 34
EDX 30
ECX 2C
EAX 28
EFLAGS 24
(EIP) 20
CR3 PDBR 1C
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SS2 18
ESP2 14
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SS1 10
ESP1 0C
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SS0 08
ESP0 04
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 TSS 00
CPU (task state segment - TSS)80386 TSS
TSS 1. CPU o EAX ECX EDX EBX ESP EBP ESI EDI o ES, CS, SS, DS, FS, GS o EFLAGS o EIP
TSS 2. CPU o LDT o PDBR o 0-2 o CPU (debug) T- o I/O TSS TSS
TSS TR LTR STR
![Page 227: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/227.jpg)
I/O 1 1 I/O 41 I/O +51 1 I/O (IN, INS, OUT, OUTS) CPU
IOPL I/O CPUTSS I/O I/O
I/O TSS TSS I/OCPL>IOPL I/O Linux 0.11 I/O
0x8000 TSS 104 Linux 0.11 I/OLinux 0.11 SS0:ESP0 SS1:ESP1 SS2:ESP2
1 2 LinuxSS:ESP
5.12 sys.c
5.12.1 sys.c -ENOSYS Linux
include/linux/sys.hID pid ID pgrp pgid ID uid ID gid
ID ruid ID euid ID session ID
ID uid ID gid ID passwd IDID ruid ID rgid i ID
ID3 ID ID 5–6
ID ID
uid - ID gid - ID
euid - ID egid - ID
suid - ID
ID set-user-ID suid
uid suid euid
sgid - ID ID
set-group-ID sgid
gid sgid egid
uid gid ID ID ID ruidID rgid set_uid() set_gid() ID ID
ID suid ID sgid set-user-ID set-group-IDeuid ID egid ID
set-user-ID
![Page 228: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/228.jpg)
ID IDID suid set-group-ID
set-user-IDID euid ID 0
Linux passwd set-user-Id/etc/passwd
passwd set-user-IDID pid ID pgrp pgid
ID session 3 ID ID ID
5.12.25-10 linux/kernel/sys.c
![Page 229: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/229.jpg)
![Page 230: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/230.jpg)
![Page 231: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/231.jpg)
![Page 232: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/232.jpg)
![Page 233: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/233.jpg)
![Page 234: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/234.jpg)
5.13 vsprintf.c
5.13.1vsprintf() C
vsprintf() C
5.13.25-11 linux/kernel/vsprintf.c
![Page 235: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/235.jpg)
![Page 236: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/236.jpg)
![Page 237: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/237.jpg)
![Page 238: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/238.jpg)
![Page 239: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/239.jpg)
![Page 240: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/240.jpg)
5.13.35.13.3.1 vsprintf()
int vsprintf(char *buf, const char *fmt, va_list args)
vsprintf() printf()fmt
printf stdout cprintf fprintfprintf 'v' ( vfprintf) va_arg va_list args printf 's'
null buf buf
1. printf
2.
%[flags][width][.prec][|h|l|L][type] (%)
[flags] [width] [.prec] (precision) [h|l|L] [type] ( )
flags27-33 # (o)
(x X) '0x' '0X' e,E,f,F,g Gg G
0 d,i,o,u,x,X,e,E,f,g G
![Page 241: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/241.jpg)
0 - 0 0
- -- n
' ' + + -
widthflags
'*'width
precision d,I,o,u,x Xe,E,f F g G
s S
d,i,o,u,xX hh h l ll L e,E,f,F,g G
type d,I (precision)
1 o,u,x,X (o) (u) (xX) x abcdef X ABCDEF
1 e,E [-]d.ddde+dd
6 0 E E2 0 00
f,F [-]ddd.ddd6 0
1 g,G f e G F E
6 0 1-4 e
c s null
![Page 242: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/242.jpg)
null p n
% % %%
5.13.41.2
5.14 printk.c
5.14.1 printk() C printf()
fsfs tty_write() fs
printk()ds printk() fs
printk() vsprintf() fstty_write()
5.14.25-12 linux/kernel/printk.c
![Page 243: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/243.jpg)
5.15 panic.c
5.15.1 panic()
panic()UNIX
panic Douglas Adams Hitch hikers Guide to the GalaxyDon't Panic!” linux
5.15.25-13 linux/kernel/panic.c
![Page 244: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/244.jpg)
5.16
linux/kernel 12
![Page 245: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/245.jpg)
![Page 246: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/246.jpg)
6 (block driver)
6.1
block device (character device)
Linux 0.117 7 0 6
6-1
0
1 / ram,
2 fd,
3 hd,
4 ttyx
5 tty
6 lp
Linux 0.11
6-1
6-1 linux/kernel/blk_drv
![Page 247: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/247.jpg)
: 1. hd.c 2. floppy.c 3. ramdisk.c
ll_rw_blk.c blk.hll_rw_blk.c
6.2
1024 512
ll_rw_block()
6.2.1ll_rw_block()
blk_dev[]blk.h
do_hd_request() do_floppy_request()NULL
init/main.cLinus Linux 0.11 7 6-2
1 2 3NULL
![Page 248: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/248.jpg)
0 NULL
1 / ram, do_rd_request()
2 fd, do_fd_request()
3 hd, do_hd_request()
4 ttyx NULL
5 tty NULL
6 lp NULL
ll_rw_block()do_XX_request()
'XX' 'rd' 'fd' 'hd'32
next 6-1
Elevator Algorithm 6-1 41
![Page 249: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/249.jpg)
ll_rw_block()current_request
ll_rw_block()
2/3 1/3
6.2.2
/
Linux 0.1x --
I/O Linux 0.1x I/OLinux 2.6.x I/O
6.2.3
IO6-2
/
C
![Page 250: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/250.jpg)
C /
hd_out()DRQ DRQ
C write_intr()
C
/
C read_intr()
0
do_rd_request()/
ll_rw_block()IO fs/buffer.c bread()
267 ll_rw_block() wait_on_buffer()IO end_request()
6.3 Makefile
6.3.1makefile
![Page 251: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/251.jpg)
6.3.26-1 linux/kernel/blk_drv/Makefile
![Page 252: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/252.jpg)
![Page 253: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/253.jpg)
6.4 blk.h
6.4.1
request
"extern inline" GNU CC 9
inline extern
inline extern macro
inline extern
6.4.26-2 linux/kernel/blk_drv/blk.h
![Page 254: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/254.jpg)
![Page 255: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/255.jpg)
![Page 256: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/256.jpg)
![Page 257: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/257.jpg)
6.5 hd.c
6.5.1 hd.c
5sys_setup() hd_init()
hd_out()do_hd_request()C read_intr() write_intr() bad_rw_intr() recal_intr()
do_hd_request() read_intr() write_intr()controler_ready() drive_busy() win_result() hd_out()
reset_controler() sys_setup() boot/setup.s
hd_init()
hd_out() Cdo_hd
read_intr() 0x1f0 0x1f7WIN_DIAGNOSE
WIN_SPECIFYCPU system_call.s 221 do_hd_request()
INIT_REQUEST
reset recalibrateWIN_SPECIFY
WIN_RESTOREC recal_intr() recal_intr()
![Page 258: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/258.jpg)
C write_intr()DRQ
bad_rw_intr()
C read_intr()
write_intr() CCPU
win_result()bad_rw_intr()
port_write() end_request()
do_hd_request() read_intr() C
write_intr() win_result()write_intr()
port_read()
end_request()
do_hd_request()
6-3 6-4
![Page 259: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/259.jpg)
4 hd_out() do_hd_request() read_intr()write_intr() 4
![Page 260: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/260.jpg)
hd_out() / hd_out()do_hd_request() do_hd_request()
add_request() ll_rw_block()fs/buffer.c bread() IO
6.5.26-3 linux/kernel/blk_drv/hd.c
![Page 261: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/261.jpg)
![Page 262: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/262.jpg)
![Page 263: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/263.jpg)
![Page 264: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/264.jpg)
![Page 265: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/265.jpg)
![Page 266: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/266.jpg)
![Page 267: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/267.jpg)
![Page 268: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/268.jpg)
![Page 269: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/269.jpg)
![Page 270: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/270.jpg)
![Page 271: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/271.jpg)
6.5.36.5.3.1 AT AT 6-3 include/linux/hdreg.h
0x1f0 HD_DATA --
0x1f1 HD_ERROR,HD_PRECOMP (HD_ERROR) (HD_PRECOMP)
0x1f2 HD_NSECTOR --
0x1f3 HD_SECTOR --
0x1f4 HD_LCYL --
0x1f5 HD_HCYL --
0x1f6 HD_CURRENT / -- / (101dhhhh, d= ,h= )
0x1f7 HD_STATUS,HD_COMMAND (HD_STATUS) (HD_COMMAND)
0x3f6 HD_CMD --- (HD_CMD)
0x3f7 1.2M ---
HD_DATA 0x1f016 PIO CPU
1 'rep outsw' 'rep insw' / cx=256/ HD_ERROR 0x1f1
8 (HD_STATUS 0x1f7) 0=16-4
0x05 4
![Page 272: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/272.jpg)
0x01
0x02 0
0x03
0x04 ECC
0x05
0x10 ID
0x40 ECC
0x80
0x05 4HD_NSECTOR 0x1f2
11 0 0 256
HD_SECTOR 0x1f3
1 1HD_LCYL HD_HCYL 0x1f4 0x1f5
8 2/ (HD_CURRENT 0x1f6)
101dhhhh101 ECC 512 d 0 1 hhhh
6-5
0 HS0 0
1 HS1 1
2 HS2 2
3 HS3 3
4 DRV 0 - 0 1 - 1
5 Reserved 1
6 Reserved 0
7 Reserved 1
![Page 273: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/273.jpg)
/ HD_STATUS/HD_COMMAND 0x1f7) 8
6-6
0 ERR_STAT 0x01
1 INDEX_STAT 0x02
2 ECC_STAT 0x04 ECC
3 DRQ_STAT 0x08
4 SEEK_STAT 0x10
5 WRERR_STAT 0x20
6 READY_STAT 0x40
7 BUSY_STAT 0x80 RESET SRST 400
30
400
512 5
CPU 86-7
4 D3 D2 D1 D0
WIN_RESTORE ( ) 0x1 R R R R 0x10
WIN_READ 0x2 0 0 L T 0x20
WIN_WRITE 0x3 0 0 L T 0x30
WIN_VERIFY 0x4 0 0 0 T 0x40
WIN_FORMAT 0x5 0 0 0 0 0x50
WIN_INIT 0x6 0 0 0 0 0x60
![Page 274: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/274.jpg)
WIN_SEEK 0x7 R R R R 0x70
WIN_DIAGNOSE 0x9 0 0 0 0 0x90
WIN_SPECIFY 0x9 0 0 0 1 0x91
4 R R=0 35us R=1 0.5ms R=0 L L=0 / 512 L=1 / 512 4 ECC
L=0 T T=0 T=1 T=0
(1) 0x1X -- WIN_RESTORE Recalibrate/ 0
BUSY_STAT 0BUSY_STAT(2) 0x20 -- WIN_READ 0x21 --
1 256 6-90 256 BUSY_STAT
ID
IDID ID
ID DataAddress Mark
DRQ_STAT DRQ_STAT
DRQ_STATBUSY_STAT DRQ_STATBUSY_STAT BUSY_STAT
(3) 0x30 -- WIN_WRITE 0x31 -- 1 256 6-9
0 256 DRQ_STAT
DRQ BUSY_STATDRQ_STAT
BUSY_STAT DRQ_STAT
![Page 275: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/275.jpg)
IDID ECC
BUSY_STAT
DRQ_STAT BUSY_STATDRQ BUSY BUSY_STAT
DRQ_STAT
(4) 0x40 -- WIN_VERIFY 0x41 -- DRQ_STAT
BUSY_STATBUSY_STAT
(5) 0x50 -- WIN_FORMATDRQ_STAT
DRQ_STAT BUSY_STAT
(6) 0x60 -- WIN_INIT(7) 0x7X -- WIN_SEEK
BUSYSEEK_STAT DSC -
BUSY_STAT
(8) 0x90 -- WIN_DIAGNOSE0 400ns
BUSY_STAT2 1 0
1 5 1 00x80 0 1
/ (0x1f6) 4 1 11 0
1 0 BUSY_STAT
(9) 0x91 -- WIN_SPECIFY
BUSY_STAT/ -1 4
![Page 276: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/276.jpg)
HD_CMD 0x3f60x08
6-8
0x08
0
1 (0) ( IRQ)
2
3 8 1
4 (0)
5 +1 1
6 ECC
7
6.5.3.2 AT6-9
6 1 70x1f1 -- 0x1f7
0x1f1
0x1f2
0x1f3
0x1f4
0x1f5
0x1f6 /
0x1f7
CPU (HD_CMD)0x3f6
1. CPU 7 BUSY_STAT 0hd.c 161
controller_ready()2. CPU 6 READY_STAT 1
1 hd.c 202 drive_busy()3. hd.c 180 hd_out()
4. CPU IRQ14 -- int46/ hd.c
![Page 277: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/277.jpg)
237--293 5 55. CPU 0 0
(HD_ERROR) hd.c 202 win_result()
6.5.3.3int 0x41 4 * 0x41 =0x0000:0x0104
6-10 100% BIOSF000h:E401h int 0x46
0x00
0x02
0x03 ( PC XT 0)
0x05 4
0x07 ECC XT 0
0x08
0
1 (0) ( IRQ)
2
3 8 1
4 (0)
5 +1 1
6 ECC
7
0x09 XT 0
0x0A XT 0
0x0B XT 0
0x0C ( )
0x0E
0x0F
6.5.3.43
1- ,2- ,3- ,4-ttyx,5-tty,6- ,7-1 1--4
= *256 + dev_no = (major<<8) + minor
6-11
![Page 278: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/278.jpg)
0x300 /dev/hd0 1
0x301 /dev/hd1 1 1
0x302 /dev/hd2 1 2
0x303 /dev/hd3 1 3
0x304 /dev/hd4 1 4
0x305 /dev/hd5 2
0x306 /dev/hd6 2 1
0x307 /dev/hd7 2 2
0x308 /dev/hd8 2 3
0x309 /dev/hd9 2 4
0x300 0x305linux 0.95
6.5.3.5PC ROM BIOS
1 0x7c00MBR Master Boot Record 6-12
0x000 MBR 446
0x1BE 1 16 1 16
0x1CE 2 16 2 16
0x1DE 3 16 3 16
0x1EE 4 16 4 16
0x1FE 2 0x55, 0xAA
446 MBR 41--4
166-13 0 0 1 0x1BE--0x1FD
0x00 boot_ind 4
0x00- 0x80-
0x01 head 0--255
0x02 sector ( 0-5) 1--63 2 ( 6-7)
0x03 cyl 8 0--1023
0x04 sys_ind 0x0b-DOS; 0x80-Old Minix; 0x83-Linux …
![Page 279: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/279.jpg)
0x05 end_head 0--255
0x06 end_sector ( 0-5) 1--63 2 ( 6-7)
0x07 end_cyl 8 0--1023
0x08-0x0b start_sect 0
0x0c-0x0f nr_sects
head sector cyl0--255 sector 6 1--63
sector 2 cyl 10 0--1023 end_headend_sector end_cyl H
S C CHS H = head; S = sector & 0x3f; C = (sector & 0xc0) << 2) + cyl;
start_sect 4 0CHS 0 0 1 0, 0, 1
0MAX_HD MAX_SECT CHS
phy_sector phy_sector = (C * MAX_HEAD + H) * MAX_SECT + S - 1
1 0 0 1boot 0x7c00 0x6000 0x7c00
10x7c00
1
6.5.3.6track_secs dev_heads sector
tracks cyl sec headsector
sector / track_secs = tracks sectracks / dev_heads = cyl head
1 sec 1cyl sec head
sector = (cyl * dev_heads + head) * track_secs + sec -1
6.6 ll_rw_blk.c
6.6.1/
![Page 280: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/280.jpg)
ll_rw_block()
request_fn() do_hd_request() do_fd_request()do_rd_request() ll_rw_block()
request_fn()
request_fn()request_fn() C read_intr()
write_intr() request_fn()
request_fn() request_fn()6-5
do_rd_request()
6.6.26-4 linux/kernel/blk_drv/ll_rw_blk.c
![Page 281: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/281.jpg)
![Page 282: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/282.jpg)
![Page 283: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/283.jpg)
![Page 284: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/284.jpg)
![Page 285: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/285.jpg)
6.7 ramdisk.c
6.7.1Ram Disk Theodore Ts'o
linux/Makefile RAMDISK
init/main.c 123 16MB4MB RAMDISK KB
RAMDISK=512 6-6
![Page 286: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/286.jpg)
3 rd_init() init/main.cdo_rd_request()
rd_load()
256Bootimage Rootiamge
DOS Linux14
rd_load() 257
ROOT_DEV 0x0101 rd_load()6-7
![Page 287: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/287.jpg)
Linux 0.11 linux/Makefile RAMDISKRAMDISK 256
1KB 2 257RAMDISK
shell256
1.44MB 2566-8
6.7.26-5 linux/kernel/blk_drv/ramdisk.c
![Page 288: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/288.jpg)
![Page 289: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/289.jpg)
![Page 290: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/290.jpg)
![Page 291: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/291.jpg)
6.8 floppy.c
6.8.1
do_fd_request()
0.5
3
Linus 100
kernel/sched.c 201-262
do_fd_request()
include/linux/fdreg.h
6.8.26-6 linux/kernel/blk_drv/floppy.c
![Page 292: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/292.jpg)
![Page 293: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/293.jpg)
![Page 294: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/294.jpg)
![Page 295: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/295.jpg)
![Page 296: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/296.jpg)
![Page 297: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/297.jpg)
![Page 298: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/298.jpg)
![Page 299: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/299.jpg)
![Page 300: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/300.jpg)
![Page 301: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/301.jpg)
![Page 302: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/302.jpg)
![Page 303: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/303.jpg)
![Page 304: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/304.jpg)
![Page 305: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/305.jpg)
![Page 306: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/306.jpg)
6.8.36.8.3.1
Linux 2 = TYPE*4 + DRIVE DRIVE 0-3A B C D TYPE 2 1.2M 7 1.44M floppy.c 85
floppy_type[] 6-14
0
1 360KB PC
2 1.2MB AT
3 360kB 720kB
4 3.5" 720kB
5 360kB 1.2MB
6 720kB 1.2MB
7 1.44MB
7 1.44MB 0 A 7*4 + 0 = 28 (2,28) 1.44M A , 0x021c /dev/fd0 /dev/PS0 2 1.22MB
2*4 + 0 = 8 (2,8) 1.2M A 0x0208 /dev/at0
6.8.3.2FDC 4
1.2M 6-15
I/O
0x3f2 DOR ( )
0x3f4 FDC (STATUS)
0x3f5 / FDC (DATA)
DIR0x3f7
(DCR)( )
DOR 8/ FDC / DMA 6-16
7 MOT_EN3 D 1- 0-
6 MOT_EN2 C 1- 0-
5 MOT_EN1 B 1- 0-
4 MOT_EN0 A 1- 0-
![Page 307: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/307.jpg)
3 DMA_INT DMA 0- DMA
2 RESET FDC 0- FDC
1 DRV_SEL1
0 DRV_SEL0 00-11 A-D
FDC 8 FDC FDDCPU FDC FDC
FDC 6-17
7 RQM FDC
6 DIO 1- FDC CPU 0- CPU FDC
5 NDM DMA 1- DMA 0- DMA
4 CB FDC
3 DDB D
2 DCB C
1 DBB B
0 DAB A
FDC0x3f5 DIO
0 CPU FDC FDC7
DIR 7 D7
(DCR) 2 D1D000 500kbps 01 300kbps 10 250kbps Linux 0.11 DMA
DMA 386 PCIR6 0x26 DMA 2 DMA
6.8.3.315
CPU FDC0--8
FDC CPU FDCCPU FDC FDC DMA
1 DMA DMA FDCDMA FDC FDC
![Page 308: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/308.jpg)
CPUCPU FDC FDC
0--7 FDC
Linux 0.11 6
1. FD_RECALIBRATE0
0x07 0—36-18
D7 D6 D5 D4 D3 D2 D1 D0
0 0 0 0 0 0 1 1 1 0x07
1 0 0 0 0 0 0 US1 US2
0
2. FD_SEEK1 0-1
2 26-19
D7 D6 D5 D4 D3 D2 D1 D0
0 0 0 0 0 1 1 1 1 0x0F
1 0 0 0 0 0 HD US1 US2
2 C
3. FD_READDMA
4 R 1 DMA6-20
C R R1 R EOT
1 R 1
D7 D6 D5 D4 D3 D2 D1 D0
0 MT MF SK 0 0 1 1 0 0xE6 MT=MF=SK=1
![Page 309: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/309.jpg)
1 0 0 0 0 0 0 US1 US2
2 C
3 H
4 R
5 N
6 EOT
7 GPL 3
8 DTL N=0
1 ST0 0
2 ST1 1
3 ST2 2
4 C
5 H
6 R
7 N
MT MF SK MT MT=1 MF MF=1 MFM FM SK SK=1
3 ST0 ST1 ST2 6-21 6-22 6-23
7
6ST0_INTR
00 – 01 –
10 – 11 –
5 ST0_SE Seek End
4 ST0_ECE Equip. Check Error
3 ST0_NR Not Ready
2 ST0_HA Head Address
1
0ST0_DS
Drive Select
00 – 11 0—3
7 ST1_EOC EOT End of Cylinder
6 0
5 ST1_CRC CRC
4 ST1_OR DMA Over Run
3 0
2 ST1_ND No Data - unreadable
1 ST1_WP Write Protect
![Page 310: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/310.jpg)
0 ST1_MAM ID AM Missing Address Mask
7 0
6 ST2_CM SK=0 Control Mark = deleted
5 ST2_CRC CRC
4 ST2_WC ID C Wrong Cylinder
3 ST2_SEH Scan Equal Hit
2 ST2_SNS Scan Not Satisfied
1 ST2_BC ID C=0xFF Bad Cylinder
0 ST2_MAM DATA AM Missing Address Mask
4. FD_WRITEDMA
1DMA 6-24
D7 D6 D5 D4 D3 D2 D1 D0
0 MT MF 0 0 0 1 0 1 0xC5 MT=MF=1
1 0 0 0 0 0 0 US1 US2
2 C
3 H
4 R
5 N
6 EOT
7 GPL 3
8 DTL N=0
1 ST0 0
2 ST1 1
3 ST2 2
4 C
5 H
6 R
7 N
5. FD_SENSEI1 2 ST0 PCN
CPUDMA
![Page 311: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/311.jpg)
6-25
D7 D6 D5 D4 D3 D2 D1 D0
0 0 0 0 0 1 0 0 0 0x08
1 ST0 0
2 C
6. FD_SPECIFY
SRT / HLT/HUT DMA6-26 500KB/S Linux 0.11
1 floppy.c 95 spec1 2 spec2315 spec2 6 HLT=3 ND=0
6 DMA
D7 D6 D5 D4 D3 D2 D1 D0
0 0 0 0 0 0 0 1 1 0x03
1 SRT 1ms HUT 16ms
2 HLT 2ms ND DMA
6.8.3.4PC NEC PD765 Intel 8287A Intel 82078
MSRoutput_byte(byte)
6-9RQM 1 DIO 0 CPU FDC
10000Linux 0.1x 0.9x
PC 16MHz -- 40MHzLinux
![Page 312: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/312.jpg)
FDC CPU result()reply_buffer[]
DOR 2 FDC 0 1SPECIFY floppy.c
reset_floppy() C reset_interrupt() DOR 2SPECIFY
transfer()DCR
250KpbsDOR
FD_RECALIBRATE (FD_SEEK)/
MSR
DOR DOR6-10
![Page 313: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/313.jpg)
/
DMA6-11
![Page 314: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/314.jpg)
3300ms 5 500ms floppy.c
500msDCR
FD_SEEK
15ms HLT500Kbps HLT=8
16msDMA DMA
TCEOT
DMA
![Page 315: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/315.jpg)
Linux 0.1110
500ms
ID DMA DMAC H R
9 2 512 1 7DMA 36 9 x 4 7,1,1,27,1,2,2 7,1,3,2 ... 7,1,9,2
SEEK
6.8.3.5 DMA DMA Direct Memory Access) “ ” DMA
Intel 8237DMA CPU
CPU DMA1 DMA
DMA DMADMA
PCDMA 2 Linux 0.11
Intel 8237 16 8 64KB1MB DMA 1MB 166-27 DMA
64KB
DMA 64KB
0x0 0x00000 - 0x0FFFF
0x1 0x10000 - 0x1FFFF
0x2 0x20000 - 0x2FFFF
0x3 0x30000 - 0x3FFFF
0x4 0x40000 - 0x4FFFF
0x5 0x50000 - 0x5FFFF
0x6 0x60000 - 0x6FFFF
0x7 0x70000 - 0x7FFFF
0x8 0x80000 - 0x8FFFF
0x9 0x90000 - 0x9FFFF
![Page 316: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/316.jpg)
0xA 0xA0000 - 0xAFFFF
0xB 0xB0000 - 0xBFFFF
0xC 0xC0000 - 0xCFFFF
0xD 0xD0000 - 0xDFFFF
0xE 0xE0000 - 0xEFFFF
0xF 0xF0000 - 0xFFFFF
2DMA DMA 2 DMA
3DMA EOP
CPU
PC/AT DMA 8 4 16DMA 2
DMA 816
6-28
DMA
0 0x87 0x00 0x01
1 0x83 0x02 0x03
2 0x81 0x04 0x05
3 0x82 0x06 0x07
4 0x8F 0xC0 0xC2
5 0x8B 0xC4 0xC6
6 0x89 0xC8 0xCA
7 0x8A 0xCC 0xCE
DMA 4 DMA6-29 Linux 0.11
3 0x0A, 0x0B, 0x0C
0-3 4-7
0x08 0xD0
0x09 0xD2
0x0A 0xD4
0x0B 0xD6
0x0C 0xD8
![Page 317: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/317.jpg)
DMA DMALinux 0.11 ROM BIOS
6-30 DMA
7 DMA DACK 0-DACK 1-DACK
6 DMA DREQ 0-DREQ 1-DREQ
5 0- 1- X- 3=1
4 DMA 0- 1-
3 DMA 0- 5 1- 3 X- 0=1
2 DMA 0- 1-
1 0 0- 0 1- 0 X- 0=0
0 0- 1-
DREQ DREQ1 DMA 0 DMA DREQ
DMA PC DMA2 DREQ Linux
6-31
7 -3
2 0 - 1 - 0
1
000-11 0-3
0x0A 16 0xD4DMA DREQ DMA DMA
6-32
7 -3
2 1 - 0 -
1
000-11 0-3
DMA Linux 0.11 0x460x4A 6-33
![Page 318: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/318.jpg)
7
6 00- 01- 10- 11-
5 0- 1-
4 0- 1-
3
200-DMA 01-DMA 10-DMA 11-
1
000-11 0-3
16
0x0C / DMA0 1
0x0C 0DMA DMA
1.2. 0x0A DMA
23. 0x0C4. 0x0B5. 0x04 DMA
6. 0x81 DMA7. 0x05 DMA -1
DMA 1024DMA 1023 0x3FF
8. 0x0A DMA9.
![Page 319: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/319.jpg)
![Page 320: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/320.jpg)
7 (char driver)
7.1
linux 0.11M.J.Bach UNIX
10 3
7-1 linux/kernel/chr_drv
7.2
RS-232 rs_io.s serial.ckeyboard.S console.c
tty_io.c tty_ioctl.c
7.2.1
Raw data
canonicalTAB 8
backspace (line discipline)(raw)
7-1
![Page 321: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/321.jpg)
7.2.2tty_struct
ID IO include/linux/tty.h
Linux tty_table[]tty_struct Linux 0.11
termios io pgrppgrp
stopped *write()
3 tty_queue
![Page 322: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/322.jpg)
1K read_qraw write_q
ICANON secondary read_q(cooked) backspace
tty_read()secondary
C copy_to_cooked()copy_to_cooked()
read_q read_qsecondary L_ECHO write_q
termios
tty_struct termios include/termios.h
c_iflag Linux 0.11 POSIX.1 11 termios.h
NL CRLinux 0.11 tty_io.c
copy_to_cooked() termios.h 83 -- 96 c_oflagtty_io.c tty_write() termios.h 99 -- 129 c_cflag
termios.h 132 -- 166 c_lflag Echo
copy_to_cooked() tty_read() ICANONISIG INTR QUIT
SUSP termios.h 169 -- 1834 unsigned long
32 termios.h
![Page 323: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/323.jpg)
c_cc[] ^CNCCS c_cc[] include/linux/tty.h
V VINTR VMINtermios.h 64 -- 80
ioctl (tcsetattr()) termios
read readtermios VTIME VMIN VMIN
VTIMEstty termios Linux 0.1x
stty
Linux ’stty -a’
7-2
![Page 324: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/324.jpg)
7.2.37.2.3.1
c_lflag ICANONNL
EOL EOL2 EOF EOF
ERASE KILL EOF EOL REPRINT WERASEEOL2
ERASE Backspace copy_to_cooked()NL
KILL EOF copy_to_cooked() EOL EOL2
EOF REPRINT WERASE REPRINTWERASE Linux 0.117.2.3.2
ICANONMIN
TIME c_cc[]
MIN TIME 1/10
1. MIN>0 TIME>0TIME
![Page 325: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/325.jpg)
MIN MINsecondary
2. MIN>0 TIME=0MIN
3. MIN=0 TIME>0TIME
04. MIN=0 TIME=0
0
MIN MINtty_io.c
tty_read()
7.2.4Linux 0.11
keyboard.s console.ctty_io.c
keyboard.s tty_io.crs_io.s tty_io.c
keyboard.s console.c Linux
ROMPC
keyboard.s console.c DEC VT100
7-3
![Page 326: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/326.jpg)
7.2.4.1Linux 0.11 keyboard.S console.c keyboard.S
read_q copy_to_cooked() read_qsecondary console.c
IRQ1,INT 33
tty read_q C do_tty_interrupt()copy_to_cooked() tty secondary
tty write_q con_write() echodo_tty_interrupt() copy_to_cooked() tty_io.c
7-4
![Page 327: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/327.jpg)
tty write_qwrite_q write_q
write_q tty_struct write_qcon_write() console.c
keyboard.Sread_q console.c write_q
7-5
7.2.4.2serial.c rs_io.s serial.c
rs_io.s4
a. modem b.c. d.
read_q copy_to_cooked()secondary
write_q
/read_q
11 1 tty read_q
C do_tty_interrupt() copy_to_cooked()
![Page 328: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/328.jpg)
tty secondary tty write_q1 rs_write() echo
tty_structrs_write()
write_q
write_qrs_write() serial.c rs_io.s
7-6
rs_io.sconsole.c keyboard.S
7.2.5
i i
tty_io.ctty_read() tty_write() copy_to_cooked() tty_ioctl.c
tty_ioctl()termios include/termios.h
Linux 0.11termios 'c_line' 0
![Page 329: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/329.jpg)
7.3 Makefile
7.3.1Make
7.3.27-1 linux/kernel/chr_drv/Makefile
![Page 330: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/330.jpg)
![Page 331: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/331.jpg)
7.4 keyboard.S
7.4.1make break
( )Alt Shift Ctrl Caps
moderead_q C do_tty_interrupt() tty_io.c
342 copy_to_cooked()read_q secondary
write_q
AT0xf0 2 AT
PC/XT PC/XT
gas '.S'as GNU C CPP C"#include" "#if"
7.4.27-2 linux/kernel/chr_drv/keyboard.S
![Page 332: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/332.jpg)
![Page 333: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/333.jpg)
![Page 334: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/334.jpg)
![Page 335: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/335.jpg)
![Page 336: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/336.jpg)
![Page 337: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/337.jpg)
![Page 338: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/338.jpg)
![Page 339: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/339.jpg)
![Page 340: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/340.jpg)
![Page 341: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/341.jpg)
![Page 342: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/342.jpg)
![Page 343: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/343.jpg)
![Page 344: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/344.jpg)
![Page 345: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/345.jpg)
7.4.37.4.3.1 PC/AT PC
Intel 80427-7 80428042 P2
0 P20 CPU 1 P21 A201 1 A20 0 A20
A20
![Page 346: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/346.jpg)
IO 0x60-0x6f IBM CP/AT 0x60 0x640x61 0x62 0x63 XT 7–1
4
/
0x60
8
0 = 1 IRQ1
0 = 1
0x60/
10 1=0
0x61 /
0x61 8255A B / 8255A PC
7=1 =0
6=0
5-0 (PPI)
0x64
8
7=1
6=1 ( IRQ1)
5=1 ( )
4=1 [?? =0 ]
3=1 ( 0x64)
=0 ( 0x60)
2 0 = 1 =
1=1 (0x60/64 8042 )
0=1 ( 0x60 )
0x640x60
12
7.4.3.20x60 1 20ms
7–20xfa (ACK)
0xed
/ 1 0
7-3 0
2 = caps-lock
1 = num-lock
0 = scroll-lock
0xee 0xee
![Page 347: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/347.jpg)
0xef
0xf0
/
0x00 -
0x01 - 1( PCs PS/2 30 )
0x02 - 2( AT PS/2 )
0x03 - 3
0xf1
0xf2 ( 2 ) AT 0xfa
0xf3
7 0
6-5 C= 6-5 =(1+C)*250ms
4-0 B= 4-3 A= 2-0
=1/((8+A)*2^B*0.00417)
0x2c
0xf4
0xf5
0xf6
0xf7-0xfd
0xfe
0xff
(BAT)
1. 0xfa
2.
3. BAT
4. 0xaa 0xfd
7.4.3.3( 0x64) 1 0x60
7–3
0x20 0x60
0x21-0x3f 5 RAM
0x60-0x7f
0x5d
7 0
6 IBM PC ( PC )
5 PC
4
3 (override)
2 1
1 0
0
0xaa 0x55 0xfc
![Page 348: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/348.jpg)
0xab
0x00
0x01 ( )
0x02
0x03
0x04
0xac 804x 16 RAM
0xad 4=1
0xae 4=0
0xc0 804x P1 0x60
0xd0 804x P2 0x60
0xd1804x P2 IBM PC 2 A20 0(
)
0xe0T0 T1
1 0
0xed
LED 1 0
7-3 0
2 = caps-lock
1 = num-lock
0 = scroll-lock
0xf0-0xff
P20-23
(6 ) 0 4
0xfe(P20 )
7.4.3.4 PC PC XT
AT(make) (break) XT
7–4
7 6-0 77=0 7=1 ESC
1 1 ESC 1+0x80=129
![Page 349: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/349.jpg)
PC PC/XT 83 1A 30 30 0x1e 0x80
0x9e AT 84/101/102 PC/XT
0xe0 PC/XTctrl 29 0x1d ctrl
0xe0 0x1d altPrtScn Pause/Break PrtScn
2 42 0x2a 55 0x37 0xe0 0x2a 0xe0 0x370xaa 0xe0 0x2a 0xe0 0x37 0xe0 0xaa
0x80 0xe0 0xb7 0xe0 0xaa prtscn shiftctrl 0xe0 0x37 0xe0 0xb7 alt
PrtScn 0x54Pause/Break ctrl 70
0x46 0xe1 0x1d 0x45 0xe1 0x9d 0xc5
0xe0 0xe1 2AT PC/XT
0xf0 2 8049AT AT PC/XT
AT (83 0xe0 )1 shift caps ctrl
alt 21 2 0xe0 0xe1 ctrl
0x1d( PC/XT) 0xe0 0x1d PC/XT0xe1 0xe0
7.5 console.c
7.5.1
con_write()con_write()
vt102telnet Linux TERM=vt102
TERM=console Linux vt102con_write()
tty_structwrite_q
con_init()con_write()
![Page 350: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/350.jpg)
include/linux/tty.htty_queue tty_struct
7-10
7.5.27-3 linux/kernel/chr_drv/console.c
![Page 351: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/351.jpg)
![Page 352: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/352.jpg)
![Page 353: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/353.jpg)
![Page 354: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/354.jpg)
![Page 355: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/355.jpg)
![Page 356: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/356.jpg)
![Page 357: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/357.jpg)
![Page 358: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/358.jpg)
![Page 359: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/359.jpg)
![Page 360: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/360.jpg)
![Page 361: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/361.jpg)
![Page 362: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/362.jpg)
![Page 363: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/363.jpg)
![Page 364: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/364.jpg)
![Page 365: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/365.jpg)
![Page 366: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/366.jpg)
![Page 367: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/367.jpg)
![Page 368: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/368.jpg)
![Page 369: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/369.jpg)
7.5.37.5.3.1
MDA CGA EGA VGACGA MC6845 7–5
CGA/EGA/VGA (0x3d0-0x3df) MDA 0x3b0 - 0x3bf0--17 0x3d4
(r0--r17) 0x3d5
7–6
/
0x3d4 CRT(6845) 0x3d5 (r0-r17)
0x3d5CRT(6845) r14-r17
7–6
0x3d8 /
7-6
5=1
4=1 640*200
3=1
2=1
![Page 370: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/370.jpg)
1=1 =0
0=1 80*25 =0 40*25
0x3d9 /
CGA
7-6
5=1 (cyan) (magenta) (white)
=0 (red) (green) (blue)
4=1
3=1 40*25 320*200 640*200
2=1 40*25 320*200 640*200
1=1 40*25 320*200 640*200
0=1 40*25 320*200 640*200
0x3da
CGA
7-4
3=1
2=1 =0
1=1
0=1 =0
0x3db
0x3dc /
/ 40*25 80*25
r0
r1
r2
r3
0x38
0x28
0x2d
0x0a
0x71
0x50
0x5a
0x0a
0x38
0x28
0x2d
0x0a
r4
r5
r6
r7
0x1f
0x06
0x19
0x1c
0x1f
0x06
0x19
0x1c
0x7f
0x06
0x64
0x70
r8 / 0x02 0x02 0x02
r9 0x07 0x07 0x01
r10
r11
0x06
0x07
0x06
0x07
0x06
0x07
r12
r13
( )
( )
0x00
0x00
0x00
0x00
0x00
0x00
r14
r15
( )
( )
/
/
r16
r17
( )
( )
7.5.3.2( scroll up) (
![Page 371: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/371.jpg)
scroll down)
origin
(video_mem_start) video_mem_end
(video_mem_end)
(video_mem_start)
origin(video_mem_end)
(video_mem_start) 7-8 (a)(b)
7.5.3.3( ) ( )
ANSI
![Page 372: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/372.jpg)
ASCII 32 (0x00 - 0x1f 0-31) DEL(0x7f 127)ASCII
VT100 7–7
8 16
NUL 000 0x00 ENQ 005 0x05 BEL 007 0x07 BS 010 0x08 HT 011 0x09 LF 012 0x0a VT 013 0x0b LFFF 014 0x0c LFCR 015 0x0d SO 016 0x0e SCS G1 G1 5SI 017 0x0f SCS G0 G0 5XON 021 0x11 XOFF 023 0x13 XOFF XONCAN 030 0x18 SUB 032 0x1a CANESC 033 0x1b DEL 177 0x7f
ANSI( American National Standards Institute)X3.64-1977
ANSI
(Control Sequence Introducer - CSI)CSI ESC [ ESC
0x1b = 033 = 27(Parameter)
(Numeric Parameter) n(Selective Parameter) s
CSI sa;sb;sc FCSI sa F CSI sb F CSI sc F
(Parameter String) ';'(Default) 0
(Final character)7-9 ESC [ 0;4;7m
![Page 373: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/373.jpg)
7–8 E 0x1b n 0 E[0J == E[J
E[nA n E[nK
E[nB n n = 0
E[nC n n = 1
E[nD n n = 2
E[n` n E[nX n
E[na n E[nS n
E[nd n E[nT n
E[ne n E[nm
E[nF n n = 0
E[nE n n = 1 bold
E[y;xH x,y n = 4 underscore
E[H n = 5 blink
E[y;xf x,y n = 7 reverse
E[nZ n n = 3X
E[nL n n = 4X
E[n@ n X = 0 black X = 1 red
E[nM n X = 2 green X = 3 brown
E[nP n X = 4 blue X = 5 magenta
E[nJ X = 6 cyan X = 7 white
n = 0
n = 1 E[0;1;33;40m
n = 2 E[s
E[u
![Page 374: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/374.jpg)
7.6 serial.c
7.6.1rs_init()
rs_write()
rs_write() /dev/tty64sys_write() fs/read_write.c
rw_char() fs/char_dev.crw_tty()
rs_write() rs_write() UART
rs_io.s
7.6.27-4 linux/kernel/chr_drv/serial.c
![Page 375: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/375.jpg)
![Page 376: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/376.jpg)
7.6.37.6.3.1 UART PC INS 8250 NS16450 UART
UART UARTUART 10 CPU IN/OUT
7–9 0x3f8-0x3fe COM10x2f8-0x2fe COM2 DLAB(Divisor Latch Access Bit)
7
/
0x3f8 (0x2f8) DLAB=0 THR
DLAB=0 RBR
/ DLAB=1 / LSB
0x3f9 (0x2f9) / DLAB=1 / MSB
/ DLAB=0
/ IER
7-4 0
3=1 modem
2=1
1=1
0=1
0x3fa (0x2fa)
IIR 4
7-3 0
2-1
= 11
= 10 2
= 01 3
= 00 MODEM 4 MODEM
![Page 377: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/377.jpg)
0=0 =1
0x3fb (0x2fb)
LCR
7=1 (DLAB)
0
6=1
5=1
4=1 =0
3=1 =0
2=1 5
1.5 6 7 8 2
= 0 1
1-0
= 00 5
= 01 6
= 10 7
= 11 8
0x3fc (0x2fc)
modem MCR
7-5 0
4=1
3=1 2 INTRPT
2=1 1 PC
1=1 RTS
0=1 DTR
0x3fd (0x2fd)
LSR
7=0
6=1
5=1
4=1
3=1
2=1
1=1
0=1
0x3fe (0x2fe)
MODEM MSR
7=1 (CD)
6=1 (RI)
5=1 (DSR)
4=1 CTS
3=1
2=1
1=1 (DSR)
0=1 (CTS)
![Page 378: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/378.jpg)
7.7 rs_io.s
7.7.1rs232
read_qwrite_q
4 a. modem b.c. d.
read_q copy_to_cooked()secondary
write_q
include/linux/tty.htty_queue tty_struct
7-10
7.7.27-5 linux/kernel/chr_drv/rs_io.s
![Page 379: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/379.jpg)
![Page 380: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/380.jpg)
![Page 381: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/381.jpg)
![Page 382: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/382.jpg)
7.8 tty_io.c
7.8.1tty 3 read_q write_q
secondary tty_struct include/linux/tty.htail
(head)7-10
/ tty_read() tty_write()copy_to_cooked()
tty_read() tty_write() /dev/ttysys_read() fs/read_write.crw_char() fs/char_dev.c
![Page 383: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/383.jpg)
rw_tty() tty_read() copy_to_cooked() do_tty_interrupt() termios
/ INLCR OUCLC read_qsecondary
tty_read() L_ECHOwrite_q rs_write()serial.c 53 rs_write()
copy_to_cooked()
1. 102. read_q3. CR NL termios ICRNL INLCR
INOCR ICRNL
4. IUCLC5. ICANON
a. ^U secondary
b. ^H secondaryc. ^S stopped=1d. ^Q
6. ISIG7. NL ^D secondary data 18. write_q
9. secondary 110.
include/linux/tty.h ttyASCII
7.8.27-6 linux/kernel/chr_drv/tty_io.c
![Page 384: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/384.jpg)
![Page 385: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/385.jpg)
![Page 386: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/386.jpg)
![Page 387: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/387.jpg)
![Page 388: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/388.jpg)
![Page 389: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/389.jpg)
![Page 390: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/390.jpg)
![Page 391: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/391.jpg)
![Page 392: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/392.jpg)
![Page 393: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/393.jpg)
7.8.37.8.3.1 VTIME VMIN
MINTIME
MIN MINMIN MIN
TIMEtermios.h
![Page 394: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/394.jpg)
7.9 tty_ioctl.c
7.9.1tty_ioctl()
termios tty_ioctl() fs/ioctl.c sys_ioctl()
7.9.27-7 linux/kernel/chr_drv/tty_ioctl.c
![Page 395: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/395.jpg)
![Page 396: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/396.jpg)
![Page 397: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/397.jpg)
![Page 398: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/398.jpg)
![Page 399: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/399.jpg)
![Page 400: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/400.jpg)
7.9.37.9.3.1
= 1.8432MHz /(16 X ) 7–10
MSB,LSB MSB,LSB
50 0x09,0x00 2304 1200 0x00,0x60 96
75 0x06,0x00 1536 1800 0x00,0x40 64
110 0x04,0x17 1047 2400 0x00,0x30 48
134.5 0x03,0x59 857 4800 0x00,0x18 24
150 0x03,0x00 768 9600 0x00,0x1c 12
200 0x02,0x40 576 19200 0x00,0x06 6
300 0x01,0x80 384 38400 0x00,0x03 3
600 0x00,0xc0 192
![Page 401: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/401.jpg)
![Page 402: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/402.jpg)
8 (math)
8.1
8-1
8-1 linux/kernel/math
8.2 Makefile
8.2.1 math
8.2.28-1 linux/kernel/math/Makefile
![Page 403: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/403.jpg)
![Page 404: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/404.jpg)
8.3 math-emulation.c
8.3.1
C math_emulate()
8.3.28-2 linux/kernel/math/math_emulate.c
![Page 405: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/405.jpg)
![Page 406: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/406.jpg)
9 (fs)
9.1
linux Linux 0.11Linus Andrew S.Tanenbaum MINIX
1.0 MINIX MINIXM.J.Bach UNIX
9-1 linux/fs
9.2
2 Linux 2-28 fs
buffer.c
![Page 407: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/407.jpg)
i
MINIX
9.2.1 MINIXMINIX 2.0 2.0 1.5
linux MINIX 1.0 1.0
MINIX UNIX 6 360K9-1
1KB 360MINIX 1.0
1KB 360KB 360
ROM BIOS
MINIX1
9-2 4 FAT32 NTFS MINIXEXT2
kernel/blk_drv/hd.c
![Page 408: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/408.jpg)
9-3s_ninodes i s_nzones s_imap_blocks
s_zmap_blocks i s_firstdatazones_log_zone_size 2
MINIX 1.0 0 1KB s_max_sizes_magic
MINIX 1.0 0x137fLinux 0.11 super_block[]
8 Linux 0.11 8 super.c mount_root()read_super() put_super()
1 01
00 1
8 s_zmap[8]1024 8192 8
65536 MINIX 1.0 64MB i i i 1K
8192 i ii 0 i 1 0 i
0 i 0 1i 8191 i
![Page 409: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/409.jpg)
i ii id(uid) id gid
32 9-4
i_mode 15-12 11-98-0 9-5 include/sys/stat.h
20—50 include/fcntl.h
![Page 410: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/410.jpg)
ii i_zone[] i_zone[] i
i_zone[0] i_zone[6] 77K i
i_zone[7] MINIX 512512 i_zone[8]
512*512 9-6/dev/
0 i izone[0]
i i 0 i i0 i 0 i 0
PC 512 MINIX2 1024
02 1 2 4 8
linux
9.2.29.2.2.1 UNIX 6 shell "ls -l"
9-7
![Page 411: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/411.jpg)
'-''-'
'd' UNIX
's'
'p''c' tty
'b' UNIX/dev
linux i i_mode 4S_ISBLK S_ISDIR include/sys/stat.h
'rwx''755'
/ / linux 0.11i i_mode 9 mode
include/fcntl.h' ' ' '
' '9.2.2.2 Linux 0.11 MINIX 1.0 UNIX
include/linux/fs.hroot/
root/ i 1 i
-rwxr-xr-x 1 ftpadm ftp 479 10 26 17:28 README
![Page 412: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/412.jpg)
14 2 i1024/16=64 i i
ii
i i9-8 /usr/bin/vi i
i 1 i 1 usr/usr i i /usr
bin /usr/bin i /usr/binvi /usr/bin/vi i
i i
9-9i
![Page 413: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/413.jpg)
i ii i
ii i_nlinks i
2 i 0i
ii
'.' '..' '.'i '..' i
../kernel/Makefile'..' i
i2 '..'
mydir9-10
![Page 414: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/414.jpg)
i 56 mydir i 123mydir '.' i 123 '..' i 56
i 2+
9.2.2.3Linux 0.11 bochs Linux 0.11
'.' '..' hexdump '.' '..'
'hexdump .' 1 ii 14 i 0
'.' '..' i 1
etc/ etc/ hexdump etc/
![Page 415: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/415.jpg)
etc/ i'.' i etc/ i 4 '..' i etc/ i 1
9.2.3
I/O CPUbuffer cache
linux2-5
Linux buffer.cbread() breada()
bread_page() 4
9.2.45
bitmap.c i i
![Page 416: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/416.jpg)
free_inode() new_inode() free_block() new_block()truncate.c 0 truncate() i
0inode.c i iget() i iput() i
bmap()namei.c namei() iget() iput() bmap()
isuper.c get_super() put_super() free_super()
/ sys_mount()9-11
9.2.55 9-12 block_dev.c file_dev.c
char_dev.c pipe.c read_write.c 4read_write.c read() write()
block_dev.c block_read() block_write()
file_dev.c file_read() file_write() i
pipe.c read_pipe() write_pipe()pipe()
openpipe() read() write() close() pipe
![Page 417: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/417.jpg)
i i
read() write() char_dev.c rw_char()tty (ttyx)
file file_table[] i inode_table[]include/linux/fs.h file
i i f_modei i_mode f_flags open()
flag include/fcntl.h
file f_count if_inode i ilinux 0.11 64 64
filp[NR_OPEN]NR_OPEN = 20 20
filp[0] 0
i inode_table[NR_INODE] i NR_INODE = 3232 i
i 9-13 01
![Page 418: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/418.jpg)
9.2.69-14 5
open.croot
exec.c shelldo_execve() (int 0x80) __NR_execve() C exec()
fcntl.c fcntl() dup() dup2() dup2()dup() /
ioctl.c / ioctl() tty_ioctl() I/O stat.c stat() fstat() stat() fstat()
( )
![Page 419: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/419.jpg)
9.2.7 360KB9-1 Linux 0.11 360KB
MINIX 1.0 hello.cbochs
2 mkfs MINIX120 i 360
8 1024 268966912mount MINIX /mnt
hello.cMINIX bochs 2 diskb.img
Linux 0.11 hexdumpbochs UltraEdit
/dev/fd1 hexdump
![Page 420: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/420.jpg)
9-1 MINIX 1.0 10 0x0000 - 0x03ff 1KB
mkfs
1 0x0400 - 0x07ff 1KB MINIX 9-39–1 18
ing 0 MINIX
s_ninodes i 0x0078 = 120
s_nzones 0x0168 = 360
s_imap_blocks i 0x0001
s_zmap_blocks 0x0001
s_firstdatazone 0x0008
s_log_zone_size Log2 / 0x0000
s_max_size 0x10081c00 = 268966912
s_magic 0x137f
2 0x0800 - 0x0bff 1KB i 120 i1 i 1KB 120/8 = 15
0 i 1mkfs 1
2 1 0x07 0b0000111 i 31 0 2 3
![Page 421: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/421.jpg)
1 i 2 i i 2 i1 i 2 i hello.c
i3 0x0c00 - 0x0fff 1KB 360KB
360 360/8 = 451 + 1 + 1i + 1 + 4i
= 8 360 - 8 = 352 440 353 45 0xfe 1
0nr
block nr + 8 -1 block = nr + s_firstdatazone - 1 blocknr nr = block - s_firstdatazone +1
i 1 3 1 0 23 2 11 1 i 2 2 2
i ii i i 4--7
4--7 0x1000 - 0x1fff 4KB 4 i 120i i 32 9-4 120 x 32 = 3840 4
32 1 i 322 i 9–2 9–3
i
i_mode 0x41ed drwxr-xr-x
i_uid id 0x0000
i_size 0x00000030 48
i_mtime 0x421cc200 Feb 23 17:48
i_gid id 0x00
i_nlinks 0x02
i_zone[9] zone[0] = 0x0008 0
i
i_mode 0x8180 -rw-------
i_uid id 0x0000
i_size 0x0000004a 74
i_mtime 0x421cc200 Feb 23 17:48
i_gid id 0x00
i_nlinks 0x01
i_zone[9] zone[0] = 0x0009 0
1 i 1 8 1
![Page 422: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/422.jpg)
30 16 0x10 3 0x302
2 i 1 2 974 hello.c
8 0x2000 - 0x23ff 1KB 1 i 48 39–4
1 0x0001 0x2e .
2 0x0001 0x2e,0x2e ..
3 0x0002 0x68,0x65,0x6c,0x6c,0x6f,0x2e,0x63 hello.c
9 0x2400 - 0x27ff 1KB hello.c 74
9.3 Makefile
9.3.1 makefile make
9.3.29-1 linux/fs/Makefile
![Page 423: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/423.jpg)
![Page 424: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/424.jpg)
![Page 425: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/425.jpg)
9.4 buffer.c
fs/ 241 buffer.c
9.4.1 buffer.c ( )
9-15
end end ldsystem ld end
data_start + datasize + bss_size bss 1etext edata 1
11024
hash9-16
1024 buffer_headinclude/linux/fs.h 68
buffer_head 9-17 free_list
b_prev_free
![Page 426: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/426.jpg)
b_lockblk_drv/ll_rw_block.c
b_count buffer
0 b_count = 0 b_count = 0free
hash b_count 1 b_count++b_count 1
b_count-- b_lockb_lock b_count 0
b_dirtb_uptodate
0 b_dirt = 1b_uptodate = 0 b_uptodate = 1
b_dirt b_uptodate 1
![Page 427: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/427.jpg)
devblock bread() bread_page() breada()
getblk()brelse()
9-18
buffer.c307 buffer_head hash Hash
hash ( ^ ) Mod 3079-17 b_prev b_next hash hash
Unix 3 hash9-19
![Page 428: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/428.jpg)
hashfree_list
LRU Least Recently Usedgetblk()
getblk()get_hash_table() hash
getblk()
hash hash hash
getblk()1
hash
LRUgetblk() 9-20
free_listhash
free_list
![Page 429: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/429.jpg)
hashfree_list
b_dirt b_lock 0b_dirt b_lock
b_dirtb_lock 0 getblk()
getblk()bread()
ll_rw_block()
![Page 430: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/430.jpg)
NULL 9-21 bread() breada()bread_page() bread()
brelse()
=0
bread() ll_rw_block()bread()
ll_rw_block()9-22
Synchronization
![Page 431: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/431.jpg)
sync_inodes i inode_table i
1. 2. sync_inodes()
sync_inodes() isync_indes()
inode
9.4.29-2 linux/fs/buffer.c
![Page 432: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/432.jpg)
![Page 433: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/433.jpg)
![Page 434: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/434.jpg)
![Page 435: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/435.jpg)
![Page 436: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/436.jpg)
![Page 437: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/437.jpg)
![Page 438: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/438.jpg)
![Page 439: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/439.jpg)
![Page 440: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/440.jpg)
![Page 441: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/441.jpg)
![Page 442: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/442.jpg)
9.5 bitmap.c
25 super.c bitmap.c truncate.c inode.c namei.c super.c bitmap.c
i truncate.c 0 truncate() inode.ci namei.c
i
super.c /inode.c
9.5.1i
i free_inode() new_inode() free_block()new_block()
free_block() dev block blockdev
blockblock
![Page 443: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/443.jpg)
1 ( )
new_block() dev blockdev 0
0 1 0 1
free_inode() i i new_inode()dev i i i i
i i
9.5.2 9-3 linux/fs/bitmap.c
![Page 444: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/444.jpg)
![Page 445: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/445.jpg)
![Page 446: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/446.jpg)
![Page 447: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/447.jpg)
![Page 448: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/448.jpg)
9.6 truncate.c
9.6.1i
0 i9-23
![Page 449: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/449.jpg)
9.6.29-4 linux/fs/truncate.c
![Page 450: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/450.jpg)
9.7 inode.c
9.7.1i iget() iput() bmap() iget()
iput() bmap() namei.c i namei() iget() dev nr i i_count 1
9-24 dev i ii nr i i i
i
![Page 451: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/451.jpg)
ii i 1 i
i ii
i i i 1i i
i i i
i i i ii i
iput() iget() i 1i i i i
0 i i i i_count1 i 1 i
i_count=0 iget()i iput() i
i_countiput()
i i_count 1namei() dir_namei() open_namei()iget() new_inode() get_empty_inode()
ipwd root executalbe
i i iiput()
i pwd i rootexecutable iput()
![Page 452: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/452.jpg)
_bmap() inode iblock create
create=0 bmap() create=1 create_block()i
i _bmap() ii_zone[] i_zone[]
9-6 i_zone[0] i_zone[6]i_zone[7] i_zone[8]
7K i 77K+512K i_zone[7]
i_zone[8] linux
![Page 453: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/453.jpg)
9.7.2 9-5 linux/fs/inode.c
![Page 454: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/454.jpg)
![Page 455: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/455.jpg)
![Page 456: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/456.jpg)
![Page 457: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/457.jpg)
![Page 458: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/458.jpg)
![Page 459: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/459.jpg)
![Page 460: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/460.jpg)
![Page 461: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/461.jpg)
![Page 462: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/462.jpg)
9.7.3
9.8 super.c
9.8.1
get_super() put_super() read_super() 2 /
![Page 463: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/463.jpg)
sys_umount() sys_mount() mount_root()buffer.c
9-3 get_super()
mountNULL
put_super() isuper_block[] umount()
read_super()i
sys_umount() sys_mount()
mount_root()9-25
file_table[]i
mount_root() main.c 0 1init() setup() setup()
/kernel/blk_drv/hd.c 71
9.8.2 9-6 linux/fs/super.c
![Page 464: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/464.jpg)
![Page 465: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/465.jpg)
![Page 466: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/466.jpg)
![Page 467: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/467.jpg)
![Page 468: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/468.jpg)
![Page 469: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/469.jpg)
![Page 470: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/470.jpg)
![Page 471: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/471.jpg)
![Page 472: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/472.jpg)
9.9 namei.c
9.9.1Linux 0.11 700
i namei()
Linux 0.11 MINIX 1.0 UNIXinclude/linux/fs.h
root/ root/i 1
14 2 ii i
i i
i/usr/bin/vi i i 1
i 1 usr /usr ii /usr bin/usr/bin i /usr/bin vi
/usr/bin/vi i i i
'.' '..' '.'i '..' i
![Page 473: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/473.jpg)
../kernel/Makefile'..' i
9.9.2 9-7 linux/fs/namei.c
![Page 474: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/474.jpg)
![Page 475: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/475.jpg)
![Page 476: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/476.jpg)
![Page 477: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/477.jpg)
![Page 478: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/478.jpg)
![Page 479: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/479.jpg)
![Page 480: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/480.jpg)
![Page 481: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/481.jpg)
![Page 482: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/482.jpg)
![Page 483: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/483.jpg)
![Page 484: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/484.jpg)
![Page 485: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/485.jpg)
![Page 486: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/486.jpg)
![Page 487: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/487.jpg)
![Page 488: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/488.jpg)
![Page 489: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/489.jpg)
![Page 490: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/490.jpg)
![Page 491: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/491.jpg)
![Page 492: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/492.jpg)
![Page 493: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/493.jpg)
![Page 494: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/494.jpg)
![Page 495: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/495.jpg)
![Page 496: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/496.jpg)
9.10 file_table.c
9.10.1
9.10.2 9-8 linux/fs/file_table.c
9.11 block_dev.c
3 5 block_dev.c char_dev.c pipe.c file_dev.cread_write.c 4 read_write.c read_write.c
sys_write() sys_read() 5” 9-26 sys_write()
sys_read()/
![Page 497: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/497.jpg)
9.11.1 block_dev.c block_read() block_write()
, read() write()
block_write()pos bread()
breada()chars
offset 0 9-27
block_read() block_write()
![Page 498: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/498.jpg)
9.11.2 9-9 linux/fs/block_dev.c
![Page 499: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/499.jpg)
![Page 500: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/500.jpg)
9.12 file_dev.c
9.12.1file_read() file_write() read() write()
block_dev.ci i
file
/dev/fd0
9.12.2 9-10 linux/fs/file_dev.c
![Page 501: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/501.jpg)
![Page 502: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/502.jpg)
![Page 503: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/503.jpg)
9.13 pipe.c
9.13.1read_pipe() write_pipe()
sys_pipe() read() write()read_write.c
i 4KBi i_size i_zone[0]
i_zone[1]
9-28
read_pipe()
write_pipe()
![Page 504: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/504.jpg)
sys_pipe()
i
PIPE_HEAD() PIPE_TAIL()include/linux/fs.h 57--64
9.13.29-11 linux/fs/pipe.c
![Page 505: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/505.jpg)
![Page 506: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/506.jpg)
![Page 507: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/507.jpg)
9.14 char_dev.c
9.14.1 char_dev.c rw_ttyx() rw_tty() rw_memory() rw_char()
rw_ttyx() 4 tty
rw_tty() 5 rw_ttyx()
rw_memory() 1 linux 0.110 1 2 0.96 1 2
rw_char()open() read()
9.14.2 9-12 linux/fs/char_dev.c
![Page 508: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/508.jpg)
![Page 509: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/509.jpg)
![Page 510: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/510.jpg)
9.15 read_write.c
9.15.1read() write() lseek() read() write()
4 4 lseek()
read() ipipe.c char_dev.c rw_char()
block_dev.cfile_dev.c file_read() write() read()
lseek()
9.15.2 9-13 linux/fs/read_write.c
![Page 511: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/511.jpg)
![Page 512: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/512.jpg)
![Page 513: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/513.jpg)
9.15.3
Linux System Calls libc.a
bsd
Linux
![Page 514: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/514.jpg)
Linux
open file
file escriptor MS-DOS file handle
read write read write
int read(int fd, char *buf, int n); int write(int fd, char *buf, int n);
0 -1
_syscall3() unistd.h 172
__NR_read 3 Linux 0x80 eax__res 0
errno -1Linux read_write.c
![Page 515: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/515.jpg)
read_write.c 55 sys_read() sys_read()
int sys_read(unsigned int fd, char *buf, int count)
0
buf buf
i
read_pipe() fs/pipe.crw_char() fs/char_dev.c
block_read() fs/block_dev.cfs/buffer.c bread()
ll_rw_block()file_read() fs/file_read.c
ll_rw_block() file_read()
read()0 errno
-1 read() 9-29
![Page 516: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/516.jpg)
9.16 open.c
45 open.c exec.c stat.c fcntl.c ioctl.c
open.c exec.c execve() stat.cfcntl.c ioctl.c
9.16.1
root
9.16.2 9-14 linux/fs/open.c
![Page 517: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/517.jpg)
![Page 518: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/518.jpg)
![Page 519: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/519.jpg)
![Page 520: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/520.jpg)
![Page 521: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/521.jpg)
![Page 522: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/522.jpg)
9.17 exec.c
9.17.1shell
do_execve() int 0x80 __NR_execve() C exec()5 exec
fork() exec()
execve() --
![Page 523: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/523.jpg)
(NULl) i
-- iShell #! Shell
Shell -- i
execve()
execve() fork()
Load on demandID
IDclose on exec linux/fs/fcntl.c
close_on_execclose_on_exec execve()
fcntl() execve
ls -l /home/john/
shell /bin/ls /bin/ls ls-l /home/john/ C main()
int main(int argc, char *argv[])
argc argument countargv -- argument vector argvargv[0] argc 1 argc=3
argv[0] argv[1] argv[2] 'ls' '-l' '/home/john/' argv[3] = NULL 9-30
![Page 524: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/524.jpg)
main() enviroment variableNULL
main()
int main(int argc, char *argv[], char *envp[])
VAR_NAME=somevalue
VAR_NAMEshell set
execve()MAX_ARG_PAGES 128kB
128kB(128kB-4 ) p 9-31
p copy_string()copy_string()
![Page 525: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/525.jpg)
copy_string() 333 p9-32 p'
64MB (128KB - p) p' create_tables()p'
sp
create_tables() p argcenvc sp
9-33
![Page 526: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/526.jpg)
do_execve() 344 345 eipesp
CPU 9-3464MB
start_code CPU
![Page 527: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/527.jpg)
9.17.2 9-15 linux/fs/exec.c
![Page 528: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/528.jpg)
![Page 529: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/529.jpg)
![Page 530: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/530.jpg)
![Page 531: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/531.jpg)
![Page 532: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/532.jpg)
![Page 533: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/533.jpg)
![Page 534: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/534.jpg)
![Page 535: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/535.jpg)
![Page 536: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/536.jpg)
![Page 537: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/537.jpg)
![Page 538: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/538.jpg)
![Page 539: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/539.jpg)
9.17.39.17.3.1 a.out Linux 0.11 a.out(Assembley & link editor output)
ELF Executable and Link Formata.out
<a.out.h>
(exec header)
(ld)(text segment)
(data segment)
(text relocations)
(data relocations)
(simbol table)
(string table)
exec structure
a_midmag - N_GETFLAG() N_GETMID N_GETMAGIC()N_GETMID() (machine-id)
N_GETMAGIC()
OMAGIC -
![Page 540: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/540.jpg)
NMAGIC - OMAGIC
ZMAGIC -
a_text - a_data - a_bss - bss break brk
a_syms - a_entry - a_trsize - a_drsize -
a.out.h exec
N_BADMAG(exec) a_magicN_TXTOFF(exec) N_DATOFF(exec) N_DRELOFF(exec) N_TRELOFF(exec) N_SYMOFF(exec) N_STROFF(exec)
(relocation_info)
r_address -
r_symbolnum - r_extern 0
r_pcrel - pc
r_length - 2 0 1 1 2 2 4 r_extern -
![Page 541: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/541.jpg)
0r_baserel r_symbolnum
n_type r_baserel - r_symbolnum (Global Offset Table) r_jmptable - r_symbolnum (Procedure Linkage Table) r_relative -
r_copy - r_address
nlist
n_un.n_strx - nlist()n_un.n_name
n_type - (bitmasks) n_typeN_EXT
N_TYPEN_UNDF -
n_typeBSS n_value
N_ABS - N_TEXT -
N_DATA - N_TEXT
N_BSS - BSSN_FN -
![Page 542: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/542.jpg)
N_STAB - ( gdb) stab() n_other - n_type n_other
4 AUX_FUNC AUX_OBJECT <link.h> AUX_FUNCAUX_OBJECT
ld n_desc -
n_value - BSS
u_int32_t null32 1 4
9.18 stat.c
9.18.1stat() fstat()
stat() fstat() ( )
9.18.2 9-16 linux/fs/stat.c
![Page 543: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/543.jpg)
![Page 544: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/544.jpg)
9.19 fcntl.c
9.19.1
fcntl.c fcntl() dup() dup2()dup2() dup() fcntl()
/include/fcntl.h
dup() dup2()dup() dup2() 3
9-35
dupfd() dup() dup2()close_on_exec exec() dup()
AT&T III fcntl()cmd 4
cmd = F_DUPFD fcntl() 3
dup(fd) fcntl(fd,F_DUPFD,0) dup2(fd,newfd)close(newfd); fcntl(fd,F_DUPFD,newfd);
cmd = F_GETFD F_SETFD close_on_exec3
cmd = F_GETFL F_SETFL RDONLYO_WRONLY O_RDWR O_APPEND O_NONBLOCK include/fcntl.h
3 O_APPENDO_NONBLOCK
![Page 545: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/545.jpg)
cmd = F_GETLK F_SETLK F_SETLKW Linux 0.11
9.19.2 9-17 linux/fs/fcntl.c
![Page 546: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/546.jpg)
![Page 547: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/547.jpg)
9.20 ioctl.c
9.20.1 ioctl.c / ioctl() ioctl() ioctl
IO ttytty_ioctl() I/O POSIX.1 termios
tty include/termios.h tcflow()libc.a ioctl()
9.20.2 9-18 linux/fs/ioctl.c
![Page 548: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/548.jpg)
![Page 549: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/549.jpg)
![Page 550: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/550.jpg)
10 (mm)
10.1
Intel 80x86 Linux
4KLinux 0.11 10-1
10-1
page.s int 14memory.c
10.2
Intel 80X86 CPU
—CPU 32Linux
10.2.1Intel 80x86 10-1
10-44 4
1024
![Page 551: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/551.jpg)
1024 80386 1024 X 1024 X 4096 = 4G Linux 0.11
16MB 4 4 4head.s 109--125
16MB 16MB
32
10-2
![Page 552: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/552.jpg)
31-22 10 21-1212
10-2
10-30 4
CPU CR3 Linux
10-1 4G
2-11
![Page 553: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/553.jpg)
(PAGE FRAME ADDRESS) 4K12 0 12
PRESENT – P P=1P=0
CPU P=0
Accessed – A Dirty – D
D DirtyCPU
/ Read/Write – R/W / User/Supervisor – U/SCPU
10.2.2 LinuxLinux Linux 0.11
Linux 0.11 16M 16MB80x86 Linux end
4M ROM BIOSRAM
10-5
![Page 554: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/554.jpg)
Linux head.s head.s0 4 4
0 0
fork()
page.s int 14memory.c do_no_page() do_wp_page() do_no_page()
do_wp_page() copy on write
10.2.3 Linux
2-15
nr*64MB nr64MB 128K
bss bss
10.2.4PG=1 CPU
int 14P 0
CPUerror code 32 3
U/S W/R P0 P P=0 P=1
1 W/R W/R=0 W/R=1
![Page 555: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/555.jpg)
2 U/S CPU U/S=0 CPUU/S=1 CPU
CR2 CPU CR2
page.smemory.c do_no_page() do_wp_page()
10.2.5 copy on write
A fock BB A
fork() B AA memory.c copy_page_tables()
A B(page_fault int14) CPU do_wp_page()
do_wp_page() un_wp_page() ,A B
( )CPU
-> -> ->
verify_area()write_verify()
Linux 0.11 <1MB fork()0 idle 1 init
1 1
fork() execve()
10.2.6 Load on demandexecve() CPU 4G
64MB
CPU
CPU
![Page 556: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/556.jpg)
CPU
Load on demanddemand-paging
execve()I/O
ZMAGIC
10.3 Makefile
10.3.1mm make
10.3.210-1 linux/mm/Makefile
![Page 557: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/557.jpg)
10.4 memory.c
10.4.1
1MB mem_map[]0
11MB
PAGING_PAGES mem_map[] 100 mem_map[]1MB
mem_map[]
![Page 558: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/558.jpg)
10-5 16MB 512KB mem_map[](16MB - 1MB)/4KB = 3840 3840 (16MB-4.5MB)/4KB = 2944 mem_map[] 2944 896 1MB
mem_map[] 896 1002944 0 10-7
get_free_page() free_page()
get_free_page()mem_map[] 0 0
0 1
free_page() <1M1M
: (addr - 1M)/4K mem_map[]0 0 1 “ ”
free_page_tables() copy_page_tables() 4M
free_page_tables()4M =0“ ”
sizesize
![Page 559: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/559.jpg)
copy_page_tables()
4Mbfrom_dir, to_dir
mem_map[]1
put_page()1M
P=1
do_wp_page() mm/page.sCopy
on Writedo_no_page()
+1
get_empty_page() get_free_page()put_page()
10.4.2 10-2 linux/mm/memory.c
![Page 560: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/560.jpg)
![Page 561: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/561.jpg)
![Page 562: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/562.jpg)
![Page 563: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/563.jpg)
![Page 564: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/564.jpg)
![Page 565: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/565.jpg)
![Page 566: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/566.jpg)
![Page 567: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/567.jpg)
![Page 568: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/568.jpg)
![Page 569: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/569.jpg)
![Page 570: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/570.jpg)
![Page 571: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/571.jpg)
![Page 572: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/572.jpg)
![Page 573: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/573.jpg)
![Page 574: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/574.jpg)
![Page 575: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/575.jpg)
10.5 page.s
10.5.114
do_no_page(error_code, address)do_wp_page(error_code, address) (error_code) CPU
CR2 CR2
10.5.2 10-3 linux/mm/page.s
![Page 576: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/576.jpg)
10.5.310.5.3.1
14 o CPU Present 0 o
CPU(1)
CPU 323
2(U/S) - 0 11(W/R) - 0 10(P) - 0 1
(2) CR2( 2) CPU CR2
CR2
![Page 577: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/577.jpg)
![Page 578: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/578.jpg)
11 (include)
11.1
header filemacros #include
filename # include <filename>
filename > " ' \ /* filename
# include "filename"filename
" ' \ /* >
/usr/include/libc.a
linker
C 15I/O Plauger
The Standard C Library
blk.h Linux 0.11 include/ Linux 0.11 /usr/include/ tools/build.c
0.95 /usr/include/linux
11.2 include/
include/ 11.1Linus C
CLinux
![Page 579: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/579.jpg)
Linus CLinux 11-1
asm/ linux/ sys/ C/usr/include
asm/ Intel CPU IO io.h system.h linux/ Linux
sched.h mm.htty.h sys/ 0.98
sys/ linux/ Linux 0.11 32 (*.h) asm/ 4 linux/ 10sys/ 5 include/ 13
11-1 linux/include/
11.3 a.out.h
11.3.1Linux a.out.h fs/exec.c
C Linux
![Page 580: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/580.jpg)
/usr/include/a.out Assembley out Linux 0.11 .o
a.out.h1—108109—185186—217
0.96 Linux GNU a.out.h Linux 0.9xLinux 0.1x a.out
0.9x 0.1x Linux 0.11 a.out.h GNU exec a_magicGNU a_info 3 Flags Machine Type Magic Number N_MACHTYPE N_FLAGS
11-1
Linux 0.9x4
0x0b, 0x01, 0x64, 0x00
Linux 0.1x a.out4
0x0b, 0x01, 0x00, 0x00
GNU a.out Linux 0.1xLinux 0.9x a.out 3
0.1x 0.1xLinux 0.1x
GNU a.out.h a.out.h
![Page 581: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/581.jpg)
11.3.2 11-1 linux/include/a.out.h
![Page 582: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/582.jpg)
![Page 583: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/583.jpg)
![Page 584: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/584.jpg)
![Page 585: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/585.jpg)
![Page 586: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/586.jpg)
11.3.311.3.3.1 a.out Linux 0.11 a.out(Assembley out)
ELF Executable and Link Formata.out
a.out.hLinux 0.11a.out 7
![Page 587: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/587.jpg)
a) exec header exec(ld)
b) text segment
c) data segmentd) text relocations
e) data relocations
f) simbol table
g) string tableexec structure
a_magic 11-1 Linux 0.11
N_MAGIC()
OMAGIC OMAGIC 0407
NMAGIC OMAGIC
ZMAGIC
ZMAGIC 0413 0x10ba_text a_data a_bss bss break brk
a_syms a_entry a_trsize
![Page 588: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/588.jpg)
a_drsize
a.out.h exec
N_BADMAG(exec) a_magic N_TXTOFF(exec) N_DATOFF(exec) N_DRELOFF(exec) N_TRELOFF(exec) N_SYMOFF(exec) N_STROFF(exec)
(relocation_info)
r_address
r_symbolnum r_extern
0r_pcrel pc
r_length 2 0 1 1 2 2 4
r_extern 0
r_symbolnumn_type
r_pad Linux 4 0
nlist
![Page 589: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/589.jpg)
n_un.n_strx nlist()n_un.n_name
n_type 146--154 bitmasks8 n_type 11-2 N_EXT
N_TYPEN_UNDF
n_typeBSS
n_value
N_ABS N_TEXT
N_DATA N_TEXT
N_BSS BSSN_FN
N_STAB ( gdb) stab()n_other n_typen_other 4 AUX_FUNC AUX_OBJECT<link.h> AUX_FUNC AUX_OBJECT
ldn_desc
n_value BSS
unsigned long null32 1 4
![Page 590: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/590.jpg)
11.4 const.h
11.4.1i i_mode
11.4.211-2 linux/include/const.h
11.5 ctype.h
11.5.1C
c isdigit(c) isspace(c)lib/ctype.c ASCII
_ctype[]
![Page 591: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/591.jpg)
__abc _SP
11.5.211-3 linux/include/ctype.h
![Page 592: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/592.jpg)
11.6 errno.h
11.6.1C errno C C
X3J11 errno errno.h”
/
null pid -1-1 C
errno CLinux C
lib/open.c unistd.h -1errno
Linux LinusPOSIX SCO
Linux 2003 1210 Linux Linus Alan Cox H.J.Lu Mitchell Blank Jr 2.4.x errno.h 0.96c
Linus H.J.Lu Libc 2.xSCO UNIX V6 V7
11.6.2 11-4 linux/include/errno.h
![Page 593: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/593.jpg)
![Page 594: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/594.jpg)
11.7 fcntl.h
11.7.1fcntl()
fcntl() linux/fs/fcntl.c 47cmd
11.7.2 11-5 linux/include/fcntl.h
![Page 595: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/595.jpg)
![Page 596: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/596.jpg)
11.8 signal.h
11.8.1
signal() sigaction()Linux POSIX.1 20 Linux
kernel/signal.c
11.8.2 11-6 linux/include/signal.h
![Page 597: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/597.jpg)
![Page 598: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/598.jpg)
11.9 stdarg.h
11.9.1 C
stdarg.h stdarg.h C BSD varargs.h
stdarg.h - (va_list)(va_start, va_arg va_end) vsprintf vprintf vfprintf
kernel/vsprintf.c
11.9.211-7 linux/include/stdarg.h
![Page 599: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/599.jpg)
11.10 stddef.h
11.10.1 stddef.h C X3J11 std (def)
stdlib.h stdlib.h
C CC C C
4 float.h limits.h stdarg.h stddef.h stddef.h
![Page 600: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/600.jpg)
float.hlimits.h stdarg.h
stddef.hNULL 4
stddef.h NULL undef 14C
Linux 0.11
11.10.2 11-8 linux/include/stddef.h
11.11 string.h
11.11.1
NULL SIZE_TC C
![Page 601: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/601.jpg)
string.h Linus'extern' 'inline'
lib/lib/string.c string.c 'extern' 'inline' string.h
string.c string.h
11.11.211-9 linux/include/string.h
![Page 602: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/602.jpg)
![Page 603: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/603.jpg)
![Page 604: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/604.jpg)
![Page 605: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/605.jpg)
![Page 606: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/606.jpg)
![Page 607: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/607.jpg)
![Page 608: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/608.jpg)
![Page 609: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/609.jpg)
![Page 610: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/610.jpg)
11.12 termios.h
11.12.1I/O termios
idLinux POSIX
termio termios UNIX termioAT&T V termios POSIX termio
termiossgtty
![Page 611: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/611.jpg)
11.12.211-10 linux/include/termios.h
![Page 612: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/612.jpg)
![Page 613: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/613.jpg)
![Page 614: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/614.jpg)
![Page 615: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/615.jpg)
![Page 616: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/616.jpg)
11.12.311.12.3.1 TIME MIN
MINTIMEDE MIN TIME 1/10
MIN > 0 TIME > 0TIME 1
MIN TIME
![Page 617: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/617.jpg)
MIN MINTIME
( ) (MIN > 0 TIME > 0) 1 MIN TIME
MIN > 0 TIME = 0TIME 0 MIN
MIN ( MIN )IO
MIN = 0 TIME > 0MIN=0 TIME
( )TIME*0.10 0
MIN = 0 TIME = 0
MINTIME
MIN TIMEMIN MIN TIME
11.13 time.h
11.13.1 time.h MINIX
GMT UTCUssher(1581-1656 ) 4004 10 12 9UNIX GMT 1970 1 1 ( )
C UNIXUNIX UNIX C
1 4Linux 0.11 init/main.c kernel/mktime.c tmCMOS
1970 1 1 0 startup_time
C
![Page 618: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/618.jpg)
11.13.211-11 linux/include/time.h
![Page 619: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/619.jpg)
11.14 unistd.h
11.14.1
__LIBRARY__ _syscall0()
11.14.211-12 linux/include/unistd.h
![Page 620: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/620.jpg)
![Page 621: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/621.jpg)
![Page 622: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/622.jpg)
![Page 623: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/623.jpg)
![Page 624: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/624.jpg)
11.15 utime.h
11.15.1utimbuf{} utime()
![Page 625: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/625.jpg)
11.15.211-13 linux/include/utime.h
![Page 626: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/626.jpg)
11.16 include/asm/
11-2 linux/include/asm/
11.17 io.h
11.17.1IO outb() inb() outb_p() inb_p()
jmp
11.17.211-14 linux/include/asm/io.h
![Page 627: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/627.jpg)
11.18 memory.h
11.18.1memcpy() string.h memcpy()
C
11.18.211-15 linux/include/asm/memory.h
![Page 628: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/628.jpg)
11.19 segment.h
11.19.1Intel CPU Linux
ds esGDT ( 0x10) ds es fs
LDT 0x17 fs system_call.s89--93
get_fs_byte() put_fs_byte()
11.19.211-16 linux/include/asm/segment.h
![Page 629: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/629.jpg)
![Page 630: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/630.jpg)
11.20 system.h
11.20.1/ move_to_user_mode()
0 03 iret
CPU 0 11-3
CPU CPU 3
IRET0
0 iret11.2 esp esp1 0 iret 0
0 3 ss:esp iret espesp0 iret CPU
NT sched_init() NT iret CPU0
031
![Page 631: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/631.jpg)
0 0640K SS ESP
IDT _set_gate()set_intr_gate() set_trap_gate() set_system_gate()
IDT Interrupt Gate Trap Gate 3-9
P DPL EFLAGSIF IF
IRET IFIF
_set_gate(gate_addr,type,dpl,addr) gate_addrtype 3-9 6 4
type=14 0x0E type=15 0x0F dplDPL addr 32
0x0008 eax system.h GDT
11.20.211-17 linux/include/asm/system.h
31 23 15 7 0
(OFFSET) 31..16 P DPL 0 1 1 1 0 0 0 0
SELECTOR 0
31 23 15 7 0
(OFFSET) 31..16 P DPL 0 1 1 1 1 0 0 0
SELECTOR 0
![Page 632: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/632.jpg)
![Page 633: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/633.jpg)
![Page 634: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/634.jpg)
11.21 include/linux/
11-3 linux/include/linux/
11.22 config.h
11.22.1HD_TYPE
11.22.211-18 linux/include/linux/config.h
![Page 635: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/635.jpg)
![Page 636: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/636.jpg)
11.23 fdreg.h
11.23.1I/O
(FDC)
4 1.2M 11–1
I/O
0x3f2
0x3f4
0x3f5 /
( )
FDC
FDC
0x3f7
0x3f7 ( )
8 /FDC / DMA
FDC 8 FDC FDDCPU FDC FDC
FDC FDC
0x3f5 DIO0 CPU FDC FDC
7
![Page 637: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/637.jpg)
15CPU FDC
0--8 FDC CPUFDC CPU FDC FDC
DMA 1 DMA DMA FDCDMA FDC
FDC CPU CPU FDCFDC 0--7
FDC
11.23.211-19 linux/include/linux/fdreg.h
![Page 638: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/638.jpg)
![Page 639: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/639.jpg)
11.24 fs.h
11.24.1 fs.hMINIX 1.0 i
11.24.211-20 linux/include/linux/fs.h
![Page 640: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/640.jpg)
![Page 641: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/641.jpg)
![Page 642: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/642.jpg)
![Page 643: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/643.jpg)
![Page 644: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/644.jpg)
![Page 645: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/645.jpg)
11.25 hdreg.h
11.25.1
11.25.211-21 linux/include/linux/hdreg.h
![Page 646: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/646.jpg)
11.25.311.25.3.1
1--44 16
![Page 647: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/647.jpg)
11–2 0 0 10x1BE--0x1FD
0x00 boot_ind 4
0x00- 0x80-
0x01 head
0x02 sector ( 0-5) 2 ( 6-7)
0x03 cyl 8
0x04 sys_ind 0x0b-DOS; 0x80-Old Minix; 0x83-Linux …
0x05 end_head
0x06 end_sector ( 0-5) 2 ( 6-7)
0x07 end_cyl 8
0x08--0x0b start_sect
0x0c--0x0f nr_sects
11.26 head.h
11.26.1 head Intel CPU
11.26.211-22 linux/include/linux/head.h
![Page 648: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/648.jpg)
11.27 kernel.h
11.27.1
11.27.211-23 linux/include/linux/kernel.h
![Page 649: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/649.jpg)
11.28 mm.h
11.28.1 mm.h
11.28.211-24 linux/include/linux/mm.h
11.29 sched.h
11.29.1task_struct 0
switch_to()switch_to(n) 171 'struct {long a,b;} __tmp'
8 TSSTSS
__tmp 4 __tmp
%ecx current currentecx
![Page 650: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/650.jpg)
__tmp ljmp TSS __tmp CPUTSS
__tmp 2 2-23ljmp TSS CPU
ljmp ecx
clts CR0 TS CPULinux TS
11.29.211-25 linux/include/linux/sched.h
![Page 651: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/651.jpg)
![Page 652: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/652.jpg)
![Page 653: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/653.jpg)
![Page 654: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/654.jpg)
![Page 655: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/655.jpg)
![Page 656: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/656.jpg)
11.29.311.29.3.1
31 23 15 7 0 I/O (MAP BASE) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (LDT) 60
![Page 657: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/657.jpg)
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 GS 5C 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 FS 58 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 DS 54 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SS 50 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 CS 4C 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ES 48 EDI 44 ESI 40 EBP 3C ESP 38 EBX 34 EDX 30 ECX 2C EAX 28 EFLAGS 24
(EIP) 20 CR3 PDBR 1C
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SS2 18 ESP2 14 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SS1 10 ESP1 0C 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SS0 08 ESP0 04 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 TSS 00
CPU (task state segment - TSS)80386 TSS
TSS 1. CPU o EAX ECX EDX EBX ESP EBP ESI EDI o ES, CS, SS, DS, FS, GS o EFLAGS o EIP
TSS 2. CPU o LDT o PDBR o 0-2 o CPU (debug) T- o I/O TSS TSS
![Page 658: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/658.jpg)
TSS TR LTR STR
I/O 1 1 I/O 41 I/O +51 1 I/O (IN, INS, OUT, OUTS) CPU
IOPL I/O CPUTSS I/O I/O
11.30 sys.h
11.30.1 sys.h
11.30.211-26 linux/include/linux/sys.h
![Page 659: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/659.jpg)
![Page 660: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/660.jpg)
11.31 tty.h
11.31.1
11.31.211-27 linux/include/linux/tty.h
![Page 661: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/661.jpg)
![Page 662: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/662.jpg)
![Page 663: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/663.jpg)
11.32 include/sys/
11-4 linux/include/sys/
11.33 stat.h
11.33.1stat()
11.33.211-28 linux/include/sys/stat.h
![Page 664: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/664.jpg)
![Page 665: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/665.jpg)
11.34 times.h
11.34.1tms times() time_t
sys/types.h times()
11.34.211-29 linux/include/sys/times.h
11.35 types.h
11.35.1 types.h size_t
off_t pid_t
11.35.211-30 linux/include/sys/types.h
![Page 666: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/666.jpg)
11.36 utsname.h
11.36.1 utsname.h utsname uname()utsname POSIX
null utsname9 utsname Unix Timesharing System name
![Page 667: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/667.jpg)
11.36.211-31 linux/include/sys/utsname.h
11.37 wait.h
11.37.1wait() waitpid()
11.37.211-32 linux/include/sys/wait.h
![Page 668: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/668.jpg)
![Page 669: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/669.jpg)
![Page 670: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/670.jpg)
12 (lib)
12.1
c library Linuxc
_exit() close() dup() open()write() execve() malloc() wait()
setsid() include/string.hTytso malloc.c
12-1 /linux/lib/
Makefile .o lib.alibc.a libufc.a
init/main.c init()
ar archive – 3 a.o b.o c.olibmine.a
ar -rc libmine.a a.o b.o c.o d.o dup.o
ar -rs dup.o
![Page 671: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/671.jpg)
12.2 Makefile
12.2.1Makefile
12.2.212-1 linux/lib/Makefile
![Page 672: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/672.jpg)
![Page 673: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/673.jpg)
12.3 _exit.c
12.3.1
12.3.212-2 linux/lib/_exit.c
![Page 674: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/674.jpg)
12.3.3include/unistd.h
12.4 close.c
12.4.1 close.c close()
12.4.212-3 linux/lib/close.c
12.5 ctype.c
12.5.1ctype.h
12.5.212-4 linux/lib/ctype.c
![Page 675: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/675.jpg)
12.6 dup.c
12.6.1dup()
lseek()(close-on-exec)
12.6.212-5 linux/lib/dup.c
![Page 676: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/676.jpg)
12.7 errno.c
12.7.1errno include/errno.h
12.7.212-6 linux/lib/errno.c
12.8 execve.c
12.8.1
12.8.212-7 linux/lib/execve.c
![Page 677: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/677.jpg)
12.9 malloc.c
12.9.1malloc() malloc()
0.98 kmalloc() free_s() kfree_s()
GCC libc.aget_free_page()
libc.a
brk() kernel/sys.c 168malloc() calloc()
brk()
malloc() (bucket)( ) ( ) 32 32
1612-1 4096
![Page 678: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/678.jpg)
malloc() ( )12-2
free_bucket_desc
free_bucket_desc NULL153
malloc()1.
2.
![Page 679: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/679.jpg)
freeptr NULL
a. NULL malloc()init_bucket_desc()
b. 0page
freeptrc.
NULLd.
3. freeptr freeptr1
free_s()( )
freeptr 1
12.9.212-8 linux/lib/malloc.c
![Page 680: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/680.jpg)
![Page 681: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/681.jpg)
![Page 682: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/682.jpg)
![Page 683: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/683.jpg)
![Page 684: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/684.jpg)
![Page 685: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/685.jpg)
![Page 686: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/686.jpg)
12.10 open.c
12.10.1 open()
exec
flag 0_RDONLY O_WRONLY O_RDWR( fs/open.c 138 )
12.10.212-9 linux/lib/open.c
![Page 687: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/687.jpg)
12.11 setsid.c
12.11.1setsid()
idid PID( )
12.11.212-10 linux/lib/setsid.c
![Page 688: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/688.jpg)
12.12 string.c
12.12.1string.h 'extern' 'inline'
string.h string.c include/string.h
12.12.212-11 linux/lib/string.c
12.13 wait.c
12.13.1waitpid() wait()
wait()
waitpid() pid
pid= -1 options=0 waitpid() wait() pid optionskernel/exit.c,142
12.13.212-12 linux/lib/wait.c
![Page 689: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/689.jpg)
12.14 write.c
12.14.1write() count
buf
12.14.212-13 linux/lib/write.c
![Page 690: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/690.jpg)
![Page 691: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/691.jpg)
13 (tools)
13.1
Linux tools build.clinux/ Makefile
Image boot/ bootsect.s setup.s 8086GNU gcc/gas
system build Image/ 13-1
13.2 build.c
13.2.1linux/Makefile 42 build
tools/build boot/bootsect boot/setup tools/system $(ROOT_DEV) > Image
build 4 bootsect setup systembootsect setup as86 ld86 MINIX
![Page 692: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/692.jpg)
system GNU a.outbuild bootsect setup MINIX
system a.outImage
statbootsect minix
512 0xAA55 508,509512 stdout Make Image
setup 4 0 4stdout
system GCC GCC linuxa.out 0 stdout
128KB Image1 bootsect 512
2 4 2 - 5 setup 46 system build.c 35
13.2.213-1 linux/tools/build.c
![Page 693: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/693.jpg)
![Page 694: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/694.jpg)
![Page 695: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/695.jpg)
![Page 696: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/696.jpg)
13.2.313.2.3.1 Minix a.out minix 2.0 01400
![Page 697: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/697.jpg)
MINIX a_magic[]
a_flags
MINIX exec Linux 0.11 a.out Linux a.outlinux/include/a.out.h
![Page 698: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/698.jpg)
14
14.1
Linux 0.11 PCLinux 0.11 PC
Linux 0.11RedHat 9 gcc 3.x
Windows
Bochs 2.1x PCUltraEdit WinImage DOS
Linux 0.11 PC PC 3VMware VMware Workstation Connectix Virtual PC
Bochs 'box' 3 Intel x86
3 Bochs x86
Virtual PC Bochs VMware Workstation x86 VMware Workstation
I/O x86VMware
VMware 3 3http://www.osnews.com/story.php?news_id=1054
VMware Workstation Virtual PC
Bochs Bochs
Bochs Bochs Linux 0.11 Bochshttp://sourceforge.net/projects/bochs/ Bochs
14.2 Bochs
Bochs Intel x86 386 486 PentiumCPU Bochs PC
![Page 699: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/699.jpg)
Bochs PCBochs
Bochs Kevin Lawton 1994 C++ Intel x86 PPCAlpha Sun MIPS Bochs x86 CPU
BochsBochs
Bochs
Bochs bochs.sourceforge.net BochsWindows C
'C:\Program Files\Bochs-2.1.1\' RedHat 9 Linux Bochs RPM
root Bochs Bochs X11X Windows Bochs Bochs
Linux dlx BochsLinux Bochs http://sourceforge.net/projects/bochs/ SLS Linux
sls-0.99pl.tar.bz2 Linux 0.11SLS Linux
www.oldlinux.org http://oldlinux.org/Linux.old/bochs/sls-1.0.zipbochsrc.bxrc 11 bochs SLS Linux
Bochs Bochs Bochs
14.2.1 BochsBochs
bochsbios 'BIOS-bochs-latest'vga bios 'VGABIOS-lgpl-latest'
CDROM
Bochs .bxrc Sample.bxrcWindows
![Page 700: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/700.jpg)
14.2.2 *.bxrc Bochs
Bochs2.1 Bochs '.bxrc'
Bochs 'bochsrc-0.11.bxrc' Bochs'bochsrc-sample.txt'
1. megs 32MB 128MB
2. floppya floppyb floppya floppyb floppya
BochsLinux Windows status ejected
inserted
3. ata0 ata1 ata2 ata3 4 4 ATA IO
ata0
4. ata0-master ata0-slave ata0-master 1 ATA 0 1 ATA CDROM
ata0-slave 1 2 ATA14–1
ata0-master: type=disk, path=hd.img, mode=flat, cylinders=306, heads=4, spt=17, translation=none
ata1-master: type=disk, path=2G.cow, mode=vmware3, cylinders=5242, heads=16, spt=50, translation=echs
ata1-slave: type=disk, path=3G.img, mode=sparse, cylinders=6541, heads=16, spt=63, translation=auto
![Page 701: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/701.jpg)
ata2-master: type=disk, path=7G.img, mode=undoable, cylinders=14563, heads=16, spt=63, translation=lba
ata2-slave: type=cdrom, path=iso.sample, status=inserted
ata0-master: type=disk, path="hdc-large.img", mode=flat, cylinders=487, heads=16, spt=63
ata0-slave: type=disk, path="..\hdc-0.11.img", mode=flat, cylinders=121, heads=16, spt=63
type [disk | cdrom]
path
mode disk[flat | concat | external | dll | sparse |
vmware3 | undoable | growing | volatile ]
cylinders disk
heads disk
spt disk
status cdrom [inserted | ejected]
biosdetect bios [none | auto], ata0 disk [cmos]
translation bios (int13), disk
[none | lba | large | rechs | auto]
model ATA
ATA type disk cdrompath CDROM iso CDROM
Linux Bochs windows
disk path cylinders heads spt cdrompath
int13 bios DOSnone 528MB 1032192large 4.2GB 8257536rechs 15 7.9GB 15482880
lba lba- 8.4GB 16450560auto
modeflatconcatexternal C++dll DLLsparsevmware3 vmware3undoablegrowingvolatile
![Page 702: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/702.jpg)
mode=flat, biosdetect=auto, translation=auto, model=”Generic 1234”
5. boot boot CDROM
'c' 'a'
6. ips ips Instructions Per Second Bochs IPS
IPS VGA14–2
IPS
650Mhz Athlon K-7 with Linux 2.4.x 2 to 2.5 million
400Mhz Pentium II with Linux 2.0.x 1 to 1.8 million
166Mhz 64bit Sparc with Solaris 2.x 0.75 million
200Mhz Pentium with Linux 2.x 0.5 million
7. loglog Bochs Bochs
log
14.3 Bochs Linux 0.11
Linux
Linux bootimage root fs
rootimage
![Page 703: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/703.jpg)
Bochs Linux 0.11Linux 0.11
http://oldlinux.org/Linux.old/bochs/linux-0.11-devel-050518.zip
6unzip winzip winrar 150MB
14.3.1linux-0.11-devel-050518.zip linux-0.11-devel-050518
20
2 Bochs 4 Bochs 5 ImageREADME
bochs-2.2.pre4-1.i586.rpm Linux BochsBochs-2.2.pre4.exe windows Bochs Linux 0.11
Bochs Bochshttp://sourceforge.net/projects/bochs/ bochsour.txt Bochs Bochs
Bochsbochsrc-fda.bxrc Bochs Bochs A /dev/fd0
![Page 704: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/704.jpg)
Linux 0.11 AA
rootimage-0.11 bootimage-0.11Linux 0.11
bochsrc-fdb.bxrc Bochs(rootimage-0.11) B /dev/fd1
bootimage-0.11-fdLinux 0.11
bochsrc-hd.bxrc A Chdc-0.11-new.img bootimage-0.11-hd
Linux 0.11bochsrc-hdboot.bxrc hdc-0.11-new.img Linux 0.11
/usr/src/linux/Imagebootimage-0.11 Image
Linux 0.11bootimage-0.11-fd Image bootimage-0.11
512 509 510 B/dev/fd1 0x021D bootimage-0.11
bootimage-0.11-hd 509 510C 1 /dev/hd1 0x0301
bootimage-0.12-fd Linux 0.12 bootimage-0.11bootimage-0.12-hd Linux 0.12 bootimage-0.11-hddebug.bat windows Bochs Bochs
Linux BochsLinux gdb Bochs
Bochsdiska.img diskb.img DOS Linux 0.11 mcopy
bochsrc-fda.bxrc bochsrc-hd.bxrc bochsrc-hdboot.bxrc Linux 0.11B diskb.img
gcclib-1.4.0.taz Linux 0.11 GNU gcc 1.40/ gcc
hdc-0.11-new.img 1 MINIX1.0 2 MINIX 1.0
mountrootimage-0.11 bochsrc-fda.bxrc bochsrc-fdb.bxrcLinux 0.11SYSTEM.MAP Linux 0.11
14.3.2 Bochsbochs-2.2.pre4-1.i586.rpm RedHat Linux Bochs
![Page 705: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/705.jpg)
Bochs-2.2.pre4.exe windows Bochs Bochs
http://sourceforge.net/projects/bochs/
Linux rpm X window 1Bochs
Windows Bochs-2.2.pre4.exe Bochsdebug.bat
Windows Bochs
14.3.3 Linux 0.11Bochs Linux 0.11 Bochs *.bxrc
PCnotepad.exe Linux 0.11
PC ROM BIOS VGA ROM 3 PC16MB Linux 0.11 16MB
floppya PC A 1.44MBbootimage-0.11 floppyb B
ata0-master PCata0-slave 2
boot: A C A(a)
1. bochsrc-fda.bxrc Linux 0.11Linux 0.11 Linux 0.11bootimage-0.11 rootimage-0.11 bochsrc-fda.bxrc
Linux 0.11 Bochs14-1 bochsrc-fda.bxrc Linux 0.11 A
bootimage-0.11 Abootiamge-0.11
A A bootimage-0.11rootimage-0.11 OK
![Page 706: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/706.jpg)
14-2
![Page 707: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/707.jpg)
2. bochsrc-fdb.bxrc Linux 0.11A bootimage-0.11-fd B
rootiamge-0.11 bootimage-0.11-fd 512B bootimage-0.11-fd 509 510
B 0x021D 0x1D,0x02 Bbochsrc-fdb.bxrc Linux 0.11 14-2
3. bochsrc-hd.bxrc Linux 0.11A Linux 0.11 bootimage-0.11-hd
hdc-0.11-new.img 1 bootimage-0.11-hd 509510 C 1 0x0301 0x01,0x03
C 1 bochsrc-hd.bxrc Linux 0.1114-2
4. bochsrc-hdboot.bxrc Linux 0.11bochsrc-hdboot.bxrc Linux 0.11 Linux LiLo Grub
Linux 0.11 MINIX shoelace
/usr/src/linux/Imagebochsrc-hdboot.bxrc Linux 0.11
14-3 4 '*'Bochs PC
1 Linux 0.111 Bochs Linux 0.11 14-4
Bochs /usr/src/linux/Imageshoelace /etc/config
![Page 708: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/708.jpg)
![Page 709: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/709.jpg)
14.4
BochsBochs
Bochs CDROMImage
Image ImageImage
ImageImage MINIX DOS
ImageLinux
Linux loopiso
14.4.1 WinImageImage DOS
mtools mtools UNIX MSDOSMSDOS copy dir cd format del md rd
m mtools1.44MB Image
diskb.img Linux 0.11 bochs.bxrc floppya
floppyb: 1_44="diskb.img", status=inserted
2 1.44MB Image diskb.imgLinux 0.11 Linux 0.11Linux 0.11 DOS mtools hello.c 2 ImageImage Bochs mformat b:
Bochs WinImage diskb.img WinImage hello.c
![Page 710: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/710.jpg)
WinImage DOSMINIX
14.4.2 LinuxLinux RedHat 9 loop
Image mount Imagerootimage-0.11
mount -t minix MINIX -o loop loopDOS Image mount minix
msdosImage Image
mount Image Image
Image ImageImage Image
fdiskImage hdc-0.11.img 1
http://oldlinux.org/Linux.old/bochs/linux-0.11-devel-040329.zip
loop losetuploop loop loop
hdc-0.11.img loop1 fdisk
![Page 711: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/711.jpg)
fdisk Image 1Start Image
losetup -d hdc-0.11.img loop1hdc-0.11.img 1 losetup -o
1 1 * 512 1loop1 mount
14.5
80386 Linux 0.003 A B
Bochs
http://oldlinux.org/Linux.old/bochs/linux-0.00-050613.zip http://oldlinux.org/Linux.old/bochs/linux-0.00-041217.zip
1 2head 0x10000
1 2linux-0.00-050613.zip linux-0.00
1. linux-0.00.tar.gz - 2. linux-0.00-rh9.tar.gz - 3. Image - 4. bochsrc-0.00.bxrc - Bochs5. rawrite.exe - Windows Image6. README -
![Page 712: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/712.jpg)
1 linux-0.00.tar.gz Linux 0.1xImage 2 RedHat 9 Linux
3 Image 1.44MB 4bochsrc-0.00.bxrc Bochs Bochs PC Bochs
PC Bochsbochsrc-0.00.bxrc Image 5 DOS Windows
RAWRITE.EXEImage 1.44MB
linux-0.00-tar.gzboot.s head.s Makefile as86/ld86
boot 32 MINIX as/ld head1024 a.out Image dd
Imagemake Image make
'make clean' make
Image A 'make disk' Bochs Linux 0.11
bootimage-0.11-hd Linux 0.11
![Page 713: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/713.jpg)
Bochs RESET14-5 Linux 0.11
14.6 Bochs
Bochs BochsBochs 14.2 Linux 0.11 Windows
Bochs
14.6.1 BochsBochs C:\Program Files\Bochs-2.1.1\ Linux 0.11
Bochs bochsrc-hd.bxrc Imagerun.bat
bochsdbg Bochs Bochs
![Page 714: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/714.jpg)
Bochs CPU ROM BIOS 0x000fffff0'<bochs:1>' '<bochs:1>'
'help' 'help'help 'vbreak'”
Bochs htmlinternal-debugger.html help
1.
![Page 715: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/715.jpg)
2. seg off addr '0x' '0'
3.
4. CPU
![Page 716: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/716.jpg)
"dump_cpu" "set_cpu"
s Selectordl Descriptor Low-dword 4dh Descriptor High-dword 4valid inhibit_int CPU
STI MOV SS"set_cpu" Error: ...”
done” "set_cpu"
![Page 717: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/717.jpg)
OK
4.
Bochs windowsrecord filename filename %s%d %x 1 2 3playback filename filename
print-stack [num words] num 16 num 160
load-symbols [global] filename [offset] filenameglobal offset 0
filename%x %s 1 2
Bochs Linux 0x7c000x7c00
CPU boot.s 1 Bochs Boot From floppy...”'s' 'n'
Bochs
![Page 718: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/718.jpg)
![Page 719: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/719.jpg)
Linux 0.11 32 0 32head.s 0x0000 'c'
'help'
14.6.2system.map Image (bootimage)
system.map windows system.map 2.10.3system.map Bochs
Linux 0.11 32 0 system.mapCPU
buffer_init() system.map
![Page 720: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/720.jpg)
0xd1ec 'c' CPU
14.7
Disk Image File
0 /
1.2MB 1.44MB
Cylinder Head
256 -- 1024512 14-6
![Page 721: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/721.jpg)
4
= X X
PCROM BIOS
BIOSBochs
TranslationLinux 0.11 Image MINIX
1.5 64MB 64MB Linux 0.11Image 4 Linux 0.11
Image 64 x 4 = 256MB 460MB Image
spt - Sectors Per Track 1.44MB 80 2 18
512 2880 80 x 2 x 18 x 512 = 1474560
Image
14.7.1 Bochs Image Bochs Image Disk Image Creation Tool bximage.exe
Image Image Imagehd fd Image mode
flat ImageImage Image
Bochs256MB Image
![Page 722: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/722.jpg)
Image ImageImage
Image
14.7.2 Linux dd ImageImage 0
Image dd Image520 16 63 Image
520 * 16 * 63 = 524160
14.7.3 WinImage DOS Image WinImage DOS Image DOS Image
CDROM iso WinImageImage DOS Image
a) WinImage “Options->Settings” Image Compression“None”
b) Image File->New 1.44MB
c) Image->Boot Sector properties MS-DOSd)
All files (*.*)” Image
![Page 723: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/723.jpg)
WinImage Image BochsImage 1.44MB 1474560 Image
UltraEdit
UltraEdit Image 511 512 55,AA512 MSDOS5.0
“EB 3C 90 4D ...”img “...F6 F6 F6”
0x168000 “F6 F6 F6...”Image
14.8
oldlinux.orgImage
Linus INSTALL-0.11 rootimage-0.11bootimage-0.11
http://oldlinux.org/Linux.old/images/bootimage-0.11-20040305 http://oldlinux.org/Linux.old/images/rootimage-0.11-20040305
bootimage-0.11 rootimage-0.11Linux-0.11 rootimage-0.11bootimage-0.11
Image Linux
14.8.1 Linux
etc/ dev/ bin/ sh mkfs fdiskusr/ usr/bin var/
Windows2000 CWindows2000 NTFS FAT32
Linux 0.11 MINIX 1.0Linux 509 510
ROOT_DEV 0
Linux 0.11 14–3
![Page 724: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/724.jpg)
Linux 0.1114–4 6 floppy.c
0x300 /dev/hd0 1
0x301 /dev/hd1 1 1
0x302 /dev/hd2 1 2
0x303 /dev/hd3 1 3
0x304 /dev/hd4 1 4
0x305 /dev/hd5 2
0x306 /dev/hd6 2 1
0x307 /dev/hd7 2 2
0x308 /dev/hd8 2 3
0x309 /dev/hd9 2 4
0x0208 /dev/at0 1.2MB A
0x0209 /dev/at1 1.2MB B
0x021c /dev/fd0 1.44MB A
0x021d /dev/fd1 1.44MB B
14.8.2Image
Image Bochs SLS LinuxImage SLS Linux
SLS-Linux 256MB Image hdc.imgMINIX Image 1 MINIX
1. SLS-Linux Linux-0.11 hdc.img2. SLS-Linux SLS Linux Bochs bochsrc.bxrc ata0-master
Image ata0-slave:type=disk, path=..\Linux-0.11\hdc.img, cylinders=520, heads=16, spt=63
3. bochsrc.bxrc SLS Linux Login 'root'Bochs
4. fdisk hdc.img 1 1 3SLS Linux MINIX2.0 81
Linux/MINIX fdisk t 80 Old MINIX
![Page 725: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/725.jpg)
hdc.img SLS Linux 2 Linux 0.11/dev/hd5 Linux 0.95
SLS Linux 2 /dev/hdb
5. 65015SLS Linux
6. SLS Linux mkfs 1 MINIX64000 1KB
![Page 726: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/726.jpg)
hdc.img 1Linux 0.11
14.8.3 Linux-0.11 BochsBochs Linux 0.11 bochsrc.bxrc
SLS Linux Bochs bochsrc.bxrc Linux-0.11floppya ata0-master boot 3
Bochs 14-7
![Page 727: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/727.jpg)
A: A rootimage-0.11Bochs 'CONFIG' Bochs
14-8
1 rootimage-0.11'Continuing simulation' Bochs
Linux 0.11 14-9
![Page 728: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/728.jpg)
14.8.4 hdc.imgLinux 0.11 Image
256MB Image hdc.imgBochs
“ata0 master: Generic 1234 ATA-2 Hard-Disk (255 Mbytes)”
Linux 0.11 bochsrc.bxrcBochs
hdc.img 1 MINIX64MB
[/usr/root]# mkfs /dev/hd1 64000
/mnt
[/usr/root]# cd / [/]# mount /dev/hd1 /mnt [/]#
![Page 729: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/729.jpg)
[/]# cd /mnt[/mnt]# for i in bin dev etc usr tmp> do> cp +recursive +verbose /$i $i> done
'logout' 'exit' Linux 0.11
[/mnt]# cd /[/]# umount /dev/hd1[/]# logout
child 4 died with code 0000 [/usr/root]#
14.8.5 ImageImage Linux 0.11
bootimage-0.11 509 510 0x1fc 0x1fd
1. bootimage-0.11 bochsrc.bxrc bootimage-0.11-hd bochsrc-hd.bxrc2. bochsrc-hd.bxrc 'floppya:' 'bootimage-0.11-hd'3. UltraEdit winhex bootimage-0.11-hd
509 510 0x1fc 0x1fd 00 00 01 03Image 1
1
![Page 730: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/730.jpg)
000001f0h: 00 00 00 00 00 00 00 00 00 00 00 00 01 03 55 AA ; ..............U?
bochsrc-hd.bxrc Bochs Linux 0.1114-10
14.9 Linux 0.11 0.11
gcc 1.40 Linux 0.11Bochs bochs
http://oldlinux.org/Linux.old/bochs/linux-0.11-devel-040817.zip http://oldlinux.org/Linux.old/bochs/linux-0.11-devel-040923.zip
READMEbochs bochs-hd.bxrc Image
Linux 0.11 /usr/src/linux 'make' Linux 0.11Image Image bootimage-0.11-hdbootimage-0.11-hd Bochs
bootimage-0.11-hd
![Page 731: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/731.jpg)
[/usr/src/linux]# make [/usr/src/linux]# dd bs=8192 if=Image of=/dev/fd0 [/usr/src/linux]#
mtools Image 2 diskb.imgWinImage diskb.img 'Image'
Image rootimage-0.11Makefile # 'ROOT_DEV='
gcc '-mstring-ins'Linus gcc 1.40 gcc
Makefilegar /usr/local/bin/ ar / gar
14.10 Redhat 9 Linux 0.11
Linux Minix 1.5.10 Minix-i386Minix 1.5.10 A.S. Tanenbaum Minix 1 Prentice Hall
Minix 80386 80386 3232 Linus Bruce Evans MINIX-386
GNU gcc gld emacs bash Minix-386 LinusLinux 0.01 0.03 0.11 Linux
Linus Linux http://oldlinux.org
Minix 1.5.10Linux 0.11 RedHat 9
bootimage PC Bochsdiff
linux linux-mdf
diff -r linux linux-mdf > dif.out
![Page 732: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/732.jpg)
dif.out RedHat 9 Linux 0.11
http://oldlinux.org/Linux.old/kernel/linux-0.11-040327-rh9.tar.gz http://oldlinux.org/Linux.old/kernel/linux-0.11-040327-rh9.diff.gz
Booting from Floppy... Loading system ...
Insert root floppy and press ENTER
Loding system...”PC vmware bochs
linux 0.11 oldlinux.org
http://oldlinux.org/Linux.old/images/rootimage-0.11-for-orig
14.10.1 makefileLinux 0.11 makefile
a. gas =>as, gld=>ld gas gld as ldb. as( gas) -c -c Linux Makefile
34c. gcc -fcombine-regs -mstring-insns Makefile
94 gcc -fcombine-regs -mstring-insns Linusgcc gcc
d. gcc -m386 RedHat 980486 CPU 80386
14.10.2 as86 c ! boot/bootsect.s C
14.10.3 alignboot align align
.align 3 (2 3 2^3=8)
.align 8
![Page 733: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/733.jpg)
14.10.4as
CPU __asm__("ax") fs/bitmap.c 20 26fs/namei.c 65
include/string.h 84:"si","di","ax","cx");
: ); gcc
gccinclude/string.h memcpy() 342
14.10.5 cLinux 0.11 C '_'
gcc cc boot/head.s 15
.globl _idt,_gdt,_pg_dir,_tmp_floppy_area
.globl idt,gdt,pg_dir,tmp_floppy_area 31
lss _stack_start,%esp
lss stack_start,%esp
14.10.6, ROM BIOS int 0x10
check_data32()12 printk() , tty_write(),check_data32() ,
4M0 0 4M
linus
5.4.3.1
![Page 734: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/734.jpg)
14.11 +
Linux 0.11kernel/blk_drv/ramdisk.c
http://oldlinux.org/Linux.old/bochs/linux-0.11-devel-040923.zip http://oldlinux.org/Linux.old/images/rootimage-0.11-for-orig
linux-0.11-devel Bochs Linux 0.11 rootimage-0.11 1.44MBLinux 0.11 'for-orig' Linux 0.11
Makefile
![Page 735: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/735.jpg)
14.11.1Linux 0.11 “ ” Image
Linux
Linux 0.11
RAMDISK
mount 1.44MB
14.11.1.1 Linux 0.11 Makefile RAMDISK
RAMDISK 0 ROOT_DEV
Linux 0.11 linux/Makefile RAMDISKRAMDISK 256
1KB 2 257RAMDISK
shell256
14-11
14.11.1.2Linux 0.1x 120KB Linux
![Page 736: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/736.jpg)
Linus 256KB 1.44MB256
14-12
RAMDISKLinus ramdisk.c 256
Linux 0.11 Image Image 120KB256
1440 - 256 = 1184 KBramdisk.c 75 block 130
14.11.2ramdisk.c
1024KB 1184KB1.44MB Image RAMDISK Image
1024KB 256
14.11.2.1RAMDISK Image RAMDISK 2048KB
Bochs linux-0.11-devel /usr/src/linux/Makefile
Image
14.11.2.21024KB Image rootram.img
Image Bochs bochsrc-hd.bxrc Bochs(1) 1024KB Image
![Page 737: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/737.jpg)
rootram.img Linux
(2) Bochs linux-0.11-devel Bochs Arootimage-0.11-orign B rootram.img(3) rootram.img 1024KB A B/mnt /mnt1 /mnt1
(4) cp /mnt rootimage-0.11-orign /mnt1 /mnt11024KB
/mnt/ 1024KB /bin /usr/bindf
/mnt/etc/fstab /mnt/etc/rcfd1 /mnt1/ 1024KB
![Page 738: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/738.jpg)
(5) umount /dev/fd0 /dev/fd1 dd /dev/fd1Linux-0.11-devel rootram-0.11 Image
Linux-0.11-devel Image /usr/src/linux/Image1024KB rootram-0.11
14.11.2.3Bochs A 1.44MB
bootroot-0.11
bs=1024 1KB seek=256 256Bochs
bootroot-0.11
14.11.3Bochs bootroot-0.11.bxrc
Bochs 14-13
![Page 739: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/739.jpg)
http://oldlinux.org/Linux.old/bochs/bootroot-0.11-040928.zip
14.12 shoelace
Image Linux 0.11shoelace Image shoelace Linux LILO Grub
MINIX 1992 1 Linux shoelacegrub Lilo boot-HOWTO shoelace.tar.z Linux.old/bin-src/
14.12.1 shoelaceshoelace
![Page 740: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/740.jpg)
/etc/config config boot: bootimage Image
/usr/src/linux/Image
14.12.21 shoelace
1 shoelace
"-w 1" 1 .
14.12.3fdisk Image MINIX MINIX-1.5
) hd imageLinux 0.11 fdisk MINIX fdisk
Linux-0.11-devel-XXXX.zip 2004 923 hd image MINIX
hd
127MB Image MINIX
Linux 0.11 fdisk
![Page 741: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/741.jpg)
Linux hd image hdc.img
dd if=/dev/zero of=hdc.img bs=512 count=248280
count (=410 * 16 * 38) Image mount Linux 0.11 cp -a / Image /mnt/
0x55,0xAA 511 512UltraEdit hdc.img Image
http://oldlinux.org/Linux.old/bochs/linux-0.11-devel-040923.zip
14-14
![Page 742: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/742.jpg)
14.13 GDB Bochs
Linux RedHat 9 Bochs gdb Linux 0.11 Linux X window Bochs
RPM Bochs gdb gdbstubBochs
gdbstub Bochs 1234 gdb gdbgdb Linux 0.11 C Linux 0.11
-g
14.13.1 gdbstub Bochs Bochs Bochs gdbstub Bochs
Bochs bochs-2.2.tar.gz
http://sourceforge.net/projects/bochs/
tar bochs-2.2--enable-gdb-stub configure make make install
![Page 743: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/743.jpg)
./configure MakefileX window
14.13.2 Linux 0.11Bochs gdb Linux 0.11
RedHat 9 0.110.11 Makefile -g
-s
find Makefile
systemSYSSIZE = 0x3000 boot/bootsect.s 6
Makefile Image systemImage system gdb
TAB
boot/bootsect.s tools/build.c SYSSIZE 0x8000
![Page 744: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/744.jpg)
14.13.3Linux RedHat 9 Bochs Linux 0.11
14.13.3.1 Linux Linux 0.11Linux 0.11 linux-rh9-gdb/
Makefile linux-rh9-gdb/ bochs
http://oldlinux.org/Linux.old/bochs/linux-0.11-gdb-rh9-050619.tar.gz
tar zxvf linux-gdb-rh9-050619.tar.gz
1 bochsrc-fd1-gdb.bxrc Bochs rootimage-0.11-for-orig2 bochs Linux 0.11
bochs 1234gdb
2 linux/ Linux 0.11 Makefile3 rootimage-0.11-for-orig 4
bochs bochs -q -f bochsrc-fd1-gdb.bxrc
1. X window2. linux-gdb-rh9/ ./run
gdb Wait for gdb connection on localhost:1234Bochs
3. linux-gdb-rh9/linux/gdb tools/system”
4. gdb break main target remote localhost:1234 gdbBochs
5. gdb cont gdb init/main.c main()gdb list
help break print/set /next/step quit gdb gdb gdb
![Page 745: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/745.jpg)
gdb
gdb gdbmemory.c: No such file or directory mm/ memory.c Makefile
ld mm/ mm.o linux/ld linux/
14.13.3.2 Linux 0.11 0.11RedHat 9 Linux Linux 0.11
Image 0.11 Redhat 9linux-0.11-devel Image
![Page 746: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/746.jpg)
mcopy Bochs 2WinImage mount
1. Bochs Linux-0.11-devel /usr/src/ linux-gdb2. 0.11 cp -a linux linux-gdb/ linux-gdb/linux/
Makefile3. /usr/src/ tar linux-gdb/ linux-gdb.tgz4. 2 b ) mcopy linux-gdb.tgz b: b
mdel b: ” b5. windows WinImage b
FTP Redhat 9 Redhat 9Linux mount b
6. Linux 0.11 linux-gdb/linux-gdb/ bochs bochsrc-fd1-gdb.bxrc
linux-0.11-devel bochsrc-fdb.bxrc gdbstuboldlinux.org rootimage-0.11 linux-gdb/
Redhat 9 Bochs Linux 0.11
Bochs b LINUX-GD.TGZ Redhat 9 Linux
![Page 747: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/747.jpg)
linux-gdb/ Bochs bochsrc-fd1-gdb.bxrcrootimage-0.11 bochs -q -f bochsrc-fd1-gdb.bxrc
run oldlinux.orgRedhat 9
http://oldlinux.org/Linux.old/bochs/linux-0.11-gdb-050619.tar.gz
![Page 748: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/748.jpg)
Intel Co. INTEL 80386 Programmer's Reference Manual 1986, INTEL CORPORATION,1987. James L. Turley. Advanced 80386 Programming Technigues. Osborne McGraw-Hill,1988. Brian W. Kernighan, Dennis M. Ritchie. The C programming Language. Prentice-Hall 1988. Leland L. Beck. System Software: An Introduction to Systems Programming,3nd. Addison-Wesley,1997. Richard Stallman, Using and Porting the GNU Compiler Collection,the Free Software Foundation, 1998. The Open Group Base Specifications Issue 6 IEEE Std 1003.1-2001, The IEEE and The Open Group. David A Rusling, The Linux Kernel, 1999. http://www.tldp.org/ Linux Kernel Source Code http://www.kernel.org/ Digital co.ltd. VT100 User Guide, http://www.vt100.net/ Clark L. Coleman. Using Inline Assembly with gcc. http://oldlinux.org/Linux.old/ John H. Crawford, Patrick P. Gelsinger. Programming the 80386. Sybex, 1988. FreeBSD Online Manual, http://www.freebsd.org/cgi/man.cgi Andrew S.Tanenbaum MINIX .
1990.4 Maurice J. Bach UNIX . 2000.4 John Lions UNIX 2000.7 Andrew S. Tanenbaum 2 ,
1998.8 Alessandro Rubini Jonathan Linux
2002.11 Daniel P. Bovet, Marco Cesati , LINUX ,
2001. . (PC ) , 1992.
. MS-DOS 5.0 . 1992. RedHat 7.3 . http://www.plinux.org/cgi-bin/man.cgi W.Richard Stevens UNIX . 2000.2 Linux Weekly Edition News. http://lwn.net/ P.J. Plauger. The Standard C Library. Prentice Hall, 1992 Free Software Foundation. The GNU C Library. http://www.gnu.org/ 2001 Chuck Allison. The Standard C Library. C/C++ Users Journal CD-ROM, Release 6. 2003 Bochs simulation system. http://bochs.sourceforge.net/ Brennan "Bas" Underwood. Brennan's Guide to Inline Assembly. http://www.rt66.com/~brennan/ John R. Levine. Linkers & Loaders. http://www.iecc.com/linker/ Randal E. Bryant, David R. O'Hallaron . , . .
2004 Randal E. Bryant, David R. O'Hallaron. Computer Systems A programmer's Perspective.
. 2004.3 Intel. Data Sheet: 8254 Programmable Interval Timer. 1993.9 Intel. Data Sheet: 8259A Programmable Interrupt Controller. 1988.12
![Page 749: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/749.jpg)
Intel. Data Sheet: 82077A CHMOS Single-chip Floppy Disk Controller. 1994.5 Robert Love Linux 2004.11 Adam Chapweske. The PS/2 Keyboard Interface. http://www.computer-engineering.org/ Dean Elsner, Jay Fenlason & friends. Using as: The GNU Assembler. http://www.gnu.org/ 1998 Steve Chamberlain. Using ld: The GNU linker. http://www.gnu.org/ 1998 Michael K. Johnson. The Linux Kernel Hackers' Guide. http://www.tldp.org/ 1995
![Page 750: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/750.jpg)
1
1.64
2.
3.
4.PAGE_SIZE = 4096 5.BLOCK_SIZE = 1024 6.NR_FILE = 64 7.NR_OPEN = 20 8.
Minix minix
9.1 1--4
= *256 + dev_no = (major<<8) + minor
0x300 /dev/hd0 1
![Page 751: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/751.jpg)
0x301 /dev/hd1 1 10x302 /dev/hd2 1 20x303 /dev/hd3 1 30x304 /dev/hd4 1 40x305 /dev/hd5 20x306 /dev/hd6 2 10x307 /dev/hd7 2 20x308 /dev/hd8 2 30x309 /dev/hd9 2 4
0x300 0x305linux 0.95
![Page 752: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/752.jpg)
2
1. a.out include/a.out.h 6a.out Assembly out
2. flock include/fcntl.h 43
3. sigaction include/signal.h 48 sigaction
sa_handler SIG_DFL SIG_IGN
sa_maskSA_NOMASK
sa_flagssa_restorer Libc
4. include/termios.h 36(Window size) ioctls TIOCGWINSZ
TIOCSWINSZ
![Page 753: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/753.jpg)
5. termio(s) include/termios.h 44 AT&T V termio NCC = 8
POSIX termios 54 NCC = 17
termio termios UNIX termio AT&TV termios POSIX termio
termiossgtty
6. include/time.h 18
7. / include/utime.h 6
![Page 754: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/754.jpg)
8. buffer_head include/linux/fs.h 68 bh buffer_head
9. include/linux/fs.h 93 i d_inode 7
10. include/linux/fs.h 116 i
![Page 755: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/755.jpg)
11. include/linux/fs.h 124 d_super_block 8
12. include/linux/fs.h 157
13. include/linux/hdreg.h 52
![Page 756: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/756.jpg)
1--44 16
0 0 1 0x1BE--0x1FD4
14. include/linux/head.h 4 CPU
15. i387 include/linux/sched.h 40 i387
16. include/linux/sched.h 51
![Page 757: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/757.jpg)
17. task include/linux/sched.h 78
18. tty include/linux/tty.h 16
![Page 758: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/758.jpg)
tty
19. tty include/linux/tty.h 45
tty
20. include/sys/stat.h 6
21. include/sys/times.h 6
22. ustat include/sys/types.h 39
ustat()
![Page 759: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/759.jpg)
NULL
23. include/sys/utsname.h 6
24. kernel/blk_drv/blk.h 23
dev=-1
![Page 760: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/760.jpg)
3 80x86
1. 80386 80386 3232 32 4GB
64TB 246
80386
EFALGS
EFLAGS I/O8086 1
VM – 8086 RF – NT – IO PL – I/OIF –
4GDTR – (Global Descriptor Table Register)LDTR – (Local Descriptor Table Register)IDTR – (Interrupt Descriptor Table Register)TR –
(GDTR,LDTR) GDT LDT IDTRTR
80386 4 CR0 CR1 CR2 CR3 2
![Page 761: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/761.jpg)
CR0PE – Protection Enable 0
MP – Math Present 1 WAIT
EM – Emulation 2TS – Task Switch 3
ET – Extention Type 4 8028780387
PG – Paging 31
80x86
3 CPU
Segment DescriptorsDescriptor tables
SelectorsSegment Registers
![Page 762: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/762.jpg)
CPU
4
BASE 4GB 32
LIMIT 20Granularity
1 1MB4KB 4GB 12
Granularity 0 11 4KB
TYPE 4 11- 81 0
Descriptor Privilege Level – DPL 4 0–3 03
Segment-Present bit – P
Accessed bit – A
Global descriptor table – GDTLocal descriptor table – LDT
8 5
![Page 763: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/763.jpg)
8192 213 GDT 0
GDTR LDTR GDT LDTlgdt sgdt GDTR lldt sldt
LDTR lgdt 6 GDTR4 LDTR lldt
2 GDTGDT 7
31 23 15 7 0
0
(Index) 8192 8()(Table Indicator - TI) 0 GDT 1LDT
(Requestor's Privalege Level - RPL)
15
![Page 764: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/764.jpg)
GDT ( 0) 0 0GDT (null) CS
SS
816
1. MOV POP LDS LSS LGS LFS
2. CALL JMP CSCS
16
CS
SS
DS
ES
FS
GS
2.CPU
CR0 PG8086
4K
9
31 22 21 12 11 0
![Page 765: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/765.jpg)
10(DIR) (PAGE) (OFFSET)
32 4K1K 32
1K1K 1M 220
4K 212 80386220 * 212 = 232
CPU CR3page directory base register – PDBR
11
(PAGE FRAME ADDRESS) 4K12 0
PRESENT – P P=1
31 12 11 0
![Page 766: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/766.jpg)
P=0
CPU P=0(page-not-present)
Accessed – A Dirty – D
/ Read/Write – R/W / User/Supervisor – U/S
1. MOV CR32.
3. Multitasking80x86
Task State Segment Task registerCPU
TSS 12TSS
SS0:ESP0 SS1:ESP1 SS2:ESP21 2 Linux
SS:ESP
31 23 15 7 0
I/O (MAP BASE)
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (LDT) 60
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 GS 5C
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 FS 58
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 DS 54
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SS 50
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 CS 4C
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ES 48
EDI 44
![Page 767: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/767.jpg)
ESI 40
EBP 3C
ESP 38
EBX 34
EDX 30
ECX 2C
EAX 28
EFLAGS 24
(EIP) 20
CR3 PDBR 1C
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SS2 18
ESP2 14
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SS1 10
ESP1 0C
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SS0 08
ESP0 04
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 TSS 00
TSS TSSTSS DPL
0 TSSGDT
Task Register – TR TSS16 GDT TSS
LTR STR16
TSS Task Gete Descriptor15..0 ( 3 4 ) TSS
(DPL) IDT
4 CPU1. TSS JMP CALL2. JMP CALL3. IDT4. NT IRET
4.
![Page 768: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/768.jpg)
CPUCPU
CPU INTR NMICPU INT 3
NMI0 31 0x00-0x1f
Intel8259A CPU
CPU 8259A 32 2550x20-0xff Linux 32-47 48-255 Linux
128 0x80
Interrupt Descriptor Table – IDTGDT LDT IDT 8 1
8 IDT IDTIDT IDTR IDT IDT LIDT SIDT
GDT IDT 64
IDTTask gatesInterrupt gatesTrap gates
13
31 23 15 7 0
P DPL 0 0 1 0 1
TSS SELECTOR 0
31 23 15 7 0
(OFFSET) 31..16 P DPL 0 1 1 1 0 0 0 0
SELECTOR 0
31 23 15 7 0
(OFFSET) 31..16 P DPL 0 1 1 1 1 0 0 0
SELECTOR 0
![Page 769: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/769.jpg)
CALLCPU IDT
CPU
GDT LDT
80X86 CALLEFLAGS
CPU
IRET RET IRETEFLAGS ESP 4
IF IFIRET IF
IFIDT TSS GDT
TSS IDTLinux
![Page 770: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/770.jpg)
4 ASCII
5 1
![Page 771: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/771.jpg)
12 KP -- KeyPad3
![Page 772: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/772.jpg)
/ /
___strtok include/string.h, 275, __GNU_EXEC_MACROS__ include/a.out.h, 4, __LIBRARY__ init/main.c, 7, lib/close.c, 7, lib/dup.c, 7, lib/_exit.c, 7, lib/open.c, 7, lib/execve.c, 7, lib/setsid.c, 7, lib/string.c, 13, lib/wait.c, 7, lib/write.c, 7, __NR_access include/unistd.h, 93, __NR_acctinclude/unistd.h, 111, __NR_alarm include/unistd.h, 87, __NR_break include/unistd.h, 77, __NR_brk include/unistd.h, 105, __NR_chdir include/unistd.h, 72, __NR_chmod include/unistd.h, 75, __NR_chown include/unistd.h, 76, __NR_chroot include/unistd.h, 121, __NR_close include/unistd.h, 66, __NR_creatinclude/unistd.h, 68, __NR_dup include/unistd.h, 101, __NR_dup2 include/unistd.h, 123, __NR_execve include/unistd.h, 71, __NR_exit include/unistd.h, 61, __NR_fcntl include/unistd.h, 115,
__NR_fork include/unistd.h, 62, __NR_fstat include/unistd.h, 88, __NR_ftime include/unistd.h, 95, __NR_getegid include/unistd.h, 110, __NR_geteuid include/unistd.h, 109, __NR_getgid include/unistd.h, 107, __NR_getpgrp include/unistd.h, 125, __NR_getpid include/unistd.h, 80, __NR_getppid include/unistd.h, 124, __NR_getuid include/unistd.h, 84, __NR_gtty include/unistd.h, 92, __NR_ioctl include/unistd.h, 114, __NR_kill include/unistd.h, 97, __NR_link include/unistd.h, 69, __NR_lock include/unistd.h, 113, __NR_lseek include/unistd.h, 79, __NR_mkdir include/unistd.h, 99, __NR_mknod include/unistd.h, 74, __NR_mount include/unistd.h, 81, __NR_mpx include/unistd.h, 116, __NR_niceinclude/unistd.h, 94, __NR_open include/unistd.h, 65, __NR_pause include/unistd.h, 89, __NR_phys include/unistd.h, 112,
![Page 773: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/773.jpg)
__NR_pipe include/unistd.h, 102, __NR_prof include/unistd.h, 104, __NR_ptrace include/unistd.h, 86, __NR_read include/unistd.h, 63, __NR_rename include/unistd.h, 98, __NR_rmdir include/unistd.h, 100, __NR_setgid include/unistd.h, 106, __NR_setpgid include/unistd.h, 117, __NR_setregid include/unistd.h, 131, __NR_setreuid include/unistd.h, 130, __NR_setsid include/unistd.h, 126, __NR_setuid include/unistd.h, 83, __NR_setup include/unistd.h, 60, __NR_sgetmask include/unistd.h, 128, __NR_sigaction include/unistd.h, 127, __NR_signal include/unistd.h, 108, __NR_ssetmask include/unistd.h, 129, __NR_stat include/unistd.h, 78, __NR_stime include/unistd.h, 85, __NR_stty include/unistd.h, 91, __NR_sync include/unistd.h, 96, __NR_time include/unistd.h, 73, __NR_times include/unistd.h, 103, __NR_ulimit include/unistd.h, 118, __NR_umask include/unistd.h, 120, __NR_umount include/unistd.h, 82, __NR_uname include/unistd.h, 119, __NR_unlink include/unistd.h, 70, __NR_ustat
include/unistd.h, 122, __NR_utime include/unistd.h, 90, __NR_waitpid include/unistd.h, 67, __NR_write include/unistd.h, 64, __va_rounded_size include/stdarg.h, 9, _A_OUT_H include/a.out.h, 2, _BLK_H kernel/blk_drv/blk.h, 2, _BLOCKABLE kernel/sched.c, 24, _bmap fs/inode.c, 72, _bucket_dir lib/malloc.c, 60, struct_C include/ctype.h, 7, _CONFIG_H include/config.h, 2, _CONST_H include/const.h, 2, _ctmp include/ctype.h, 14, lib/ctype.c, 9, _ctype include/ctype.h, 13, lib/ctype.c, 10, _CTYPE_H include/ctype.h, 2, _Dinclude/ctype.h, 6, _ERRNO_H include/errno.h, 2, _exit include/unistd.h, 208, lib/_exit.c, 10, _FCNTL_H include/fcntl.h, 2, _FDREG_H include/fdreg.h, 7, _fskernel/traps.c, 34, _FS_H include/fs.h, 7, _get_base include/sched.h, 214, _hashfn fs/buffer.c, 128, _HDREG_H include/hdreg.h, 7, _HEAD_H include/head.h, 2,
![Page 774: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/774.jpg)
_HIGH include/sys/wait.h, 7, _I_FLAG kernel/chr_drv/tty_io.c, 29, _Linclude/ctype.h, 5, _L_FLAG kernel/chr_drv/tty_io.c, 28, _LDT include/sched.h, 156, _LOW include/sys/wait.h, 6, _MM_H include/mm.h, 2, _N_BADMAG include/a.out.h, 36, _N_HDROFF include/a.out.h, 40, _N_SEGMENT_ROUND include/a.out.h, 95, _N_TXTENDADDR include/a.out.h, 97, _NSIG include/signal.h, 9, _O_FLAG kernel/chr_drv/tty_io.c, 30, _Pinclude/ctype.h, 8, _PC_CHOWN_RESTRICTED include/unistd.h, 51, _PC_LINK_MAX include/unistd.h, 43, _PC_MAX_CANON include/unistd.h, 44, _PC_MAX_INPUT include/unistd.h, 45, _PC_NAME_MAX include/unistd.h, 46, _PC_NO_TRUNC include/unistd.h, 49, _PC_PATH_MAX include/unistd.h, 47, _PC_PIPE_BUF include/unistd.h, 48, _PC_VDISABLE include/unistd.h, 50, _POSIX_CHOWN_RESTRICTED include/unistd.h, 7, _POSIX_NO_TRUNC include/unistd.h, 8, _POSIX_VDISABLE include/unistd.h, 9, _POSIX_VERSION include/unistd.h, 5, _PTRDIFF_T include/sys/types.h, 15,
include/stddef.h, 5, _Sinclude/ctype.h, 9, kernel/sched.c, 23, _SC_ARG_MAX include/unistd.h, 33, _SC_CHILD_MAX include/unistd.h, 34, _SC_CLOCKS_PER_SEC include/unistd.h, 35, _SC_JOB_CONTROL include/unistd.h, 38, _SC_NGROUPS_MAX include/unistd.h, 36, _SC_OPEN_MAX include/unistd.h, 37, _SC_SAVED_IDS include/unistd.h, 39, _SC_VERSION include/unistd.h, 40, _SCHED_H include/sched.h, 2, _set_baseinclude/sched.h, 188, _set_gateinclude/asm/system.h, 22, _set_limit include/sched.h, 199, _set_seg_desc include/asm/system.h, 42, _set_tssldt_desc include/asm/system.h, 52, _SIGNAL_H include/signal.h, 2, _SIZE_T include/sys/types.h, 5, include/time.h, 10, include/stddef.h, 10, include/string.h, 9, _SPinclude/ctype.h, 11, _STDARG_H include/stdarg.h, 2, _STDDEF_H include/stddef.h, 2, _STRING_H_ include/string.h, 2, _SYS_STAT_H include/sys/stat.h, 2, _SYS_TYPES_H include/sys/types.h, 2, _SYS_UTSNAME_H include/sys/utsname.h, 2, _SYS_WAIT_H include/sys/wait.h, 2, _syscall0
![Page 775: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/775.jpg)
include/unistd.h, 133, _syscall1 include/unistd.h, 146, _syscall2 include/unistd.h, 159, _syscall3 include/unistd.h, 172, _TERMIOS_H include/termios.h, 2, _TIME_H include/time.h, 2, _TIME_T include/sys/types.h, 10, include/time.h, 5, _TIMES_H include/sys/times.h, 2, _TSSinclude/sched.h, 155, _TTY_H include/tty.h, 10, _Uinclude/ctype.h, 4, _UNISTD_H include/unistd.h, 2, _UTIME_H include/utime.h, 2, _Xinclude/ctype.h, 10, ABRT_ERR include/hdreg.h, 47, ACC_MODE fs/namei.c, 21, accessinclude/unistd.h, 189, acctinclude/unistd.h, 190, add_entry fs/namei.c, 165, add_requestkernel/blk_drv/ll_rw_blk.c, 64, add_timer include/sched.h, 144, kernel/sched.c, 272, alarm include/unistd.h, 191, ALRMMASK kernel/chr_drv/tty_io.c, 17, argvinit/main.c, 165, argv_rc init/main.c, 162, asctime include/time.h, 35, attrkernel/chr_drv/console.c, 77, B0
include/termios.h, 133, B110 include/termios.h, 136, B1200 include/termios.h, 142, B134 include/termios.h, 137, B150 include/termios.h, 138, B1800 include/termios.h, 143, B19200 include/termios.h, 147, B200 include/termios.h, 139, B2400 include/termios.h, 144, B300 include/termios.h, 140, B38400 include/termios.h, 148, B4800 include/termios.h, 145, B50 include/termios.h, 134, B600 include/termios.h, 141, B75 include/termios.h, 135, B9600 include/termios.h, 146, bad_flp_intr kernel/blk_drv/floppy.c, 233, bad_rw_intr kernel/blk_drv/hd.c, 242, BADNESSfs/buffer.c, 205, BBD_ERR include/hdreg.h, 50, BCD_TO_BIN init/main.c, 74, beepcount kernel/chr_drv/console.c, 697, blk_dev kernel/blk_drv/ll_rw_blk.c, 32, structkernel/blk_drv/blk.h, 50, structblk_dev_init init/main.c, 46, kernel/blk_drv/ll_rw_blk.c, 157, blk_dev_struct kernel/blk_drv/blk.h, 45, structblock_read fs/read_write.c, 18, fs/block_dev.c, 47, BLOCK_SIZE include/fs.h, 49,
![Page 776: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/776.jpg)
BLOCK_SIZE_BITS include/fs.h, 50, block_write fs/read_write.c, 19, fs/block_dev.c, 14, bmap fs/inode.c, 140, include/fs.h, 176, bottom kernel/chr_drv/console.c, 73, bounds kernel/traps.c, 48, bread fs/buffer.c, 267, include/fs.h, 189, bread_page fs/buffer.c, 296, include/fs.h, 190, breada fs/buffer.c, 322, include/fs.h, 191, brelse fs/buffer.c, 253, include/fs.h, 188, brk include/unistd.h, 192, BRKINTinclude/termios.h, 84, BS0 include/termios.h, 122, BS1 include/termios.h, 123, BSDLY include/termios.h, 121, bucket_desc lib/malloc.c, 52, structbucket_dir lib/malloc.c, 77, buffer_block include/fs.h, 66, BUFFER_END include/const.h, 4, buffer_head include/fs.h, 68, structbuffer_init fs/buffer.c, 348, include/fs.h, 31, buffer_memory_end init/main.c, 99, buffer_wait fs/buffer.c, 33, BUSY_STAT include/hdreg.h, 31, calc_mem mm/memory.c, 413, CBAUD
include/termios.h, 132, cfgetispeed include/termios.h, 216, cfgetospeed include/termios.h, 217, cfsetispeed include/termios.h, 218, cfsetospeed include/termios.h, 219, change_ldt fs/exec.c, 154, change_speed kernel/chr_drv/tty_ioctl.c, 24, CHARSinclude/tty.h, 30, chdir include/unistd.h, 194, check_disk_change fs/buffer.c, 113, include/fs.h, 168, chmod include/sys/stat.h, 51, include/unistd.h, 195, chowninclude/unistd.h, 196, chr_dev_init init/main.c, 47, kernel/chr_drv/tty_io.c, 347, chrootinclude/unistd.h, 197, CIBAUDinclude/termios.h, 162, clear_bitfs/bitmap.c, 25, clear_block fs/bitmap.c, 13, cliinclude/asm/system.h, 17, CLOCALinclude/termios.h, 161, clock include/time.h, 30, clock_tinclude/time.h, 16, CLOCKS_PER_SEC include/time.h, 14, closeinclude/unistd.h, 198, CMOS_READ init/main.c, 69, kernel/blk_drv/hd.c, 28, CODE_SPACE mm/memory.c, 49, command kernel/blk_drv/floppy.c, 121, con_init
![Page 777: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/777.jpg)
include/tty.h, 66, kernel/chr_drv/console.c, 617, con_write include/tty.h, 73, kernel/chr_drv/console.c, 445, controller_ready kernel/blk_drv/hd.c, 161, coprocessor_error kernel/traps.c, 58, coprocessor_segment_overrun kernel/traps.c, 52, copy_buffer kernel/blk_drv/floppy.c, 155, copy_mem kernel/fork.c, 39, copy_page mm/memory.c, 54, copy_page_tables include/sched.h, 29, mm/memory.c, 150, copy_process kernel/fork.c, 68, copy_strings fs/exec.c, 104, copy_to_cooked include/tty.h, 75, kernel/chr_drv/tty_io.c, 145, COPYBLKfs/buffer.c, 283, cp_stat fs/stat.c, 15, CPARENBinclude/termios.h, 158, CPARODD include/termios.h, 159, crkernel/chr_drv/console.c, 224, CR0 include/termios.h, 111, CR1 include/termios.h, 112, CR2 include/termios.h, 113, CR3 include/termios.h, 114, CRDLYinclude/termios.h, 110, CREADinclude/termios.h, 157, creatinclude/unistd.h, 199, include/fcntl.h, 51, create_block fs/inode.c, 145, include/fs.h, 177, create_tables
fs/exec.c, 46, CRTSCTSinclude/termios.h, 163, crw_ptrfs/char_dev.c, 19, crw_tablefs/char_dev.c, 85, CS5 include/termios.h, 152, CS6 include/termios.h, 153, CS7 include/termios.h, 154, CS8 include/termios.h, 155, csi_atkernel/chr_drv/console.c, 391, csi_Jkernel/chr_drv/console.c, 239, csi_Kkernel/chr_drv/console.c, 268, csi_Lkernel/chr_drv/console.c, 401, csi_m kernel/chr_drv/console.c, 299, csi_Mkernel/chr_drv/console.c, 421, csi_Pkernel/chr_drv/console.c, 411, CSIZEinclude/termios.h, 151, CSTOPBinclude/termios.h, 156, ctime include/time.h, 36, cur_ratekernel/blk_drv/floppy.c, 113, cur_spec1 kernel/blk_drv/floppy.c, 112, CURRENTkernel/blk_drv/blk.h, 93, CURRENT_DEVkernel/blk_drv/blk.h, 94, current_DOR kernel/sched.c, 204, kernel/blk_drv/floppy.c, 48, current_drive kernel/blk_drv/floppy.c, 115, CURRENT_TIME include/sched.h, 142, current_track kernel/blk_drv/floppy.c, 120, d_inode include/fs.h, 83, structd_super_block include/fs.h, 146, struct
![Page 778: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/778.jpg)
daddr_t include/sys/types.h, 31, DAY kernel/mktime.c, 22, debug kernel/traps.c, 44, DECinclude/tty.h, 25, DEFAULT_MAJOR_ROOT tools/build.c, 37, DEFAULT_MINOR_ROOT tools/build.c, 38, del kernel/chr_drv/console.c, 230, delete_char kernel/chr_drv/console.c, 363, delete_line kernel/chr_drv/console.c, 378, desc_struct include/head.h, 4, structdesc_table include/head.h, 6, dev_t include/sys/types.h, 26, DEVICE_INTR kernel/blk_drv/blk.h, 72, kernel/blk_drv/blk.h, 81, kernel/blk_drv/blk.h, 97, DEVICE_NAME kernel/blk_drv/blk.h, 63, kernel/blk_drv/blk.h, 71, kernel/blk_drv/blk.h, 80, device_not_available kernel/traps.c, 50, DEVICE_NR kernel/blk_drv/blk.h, 65, kernel/blk_drv/blk.h, 74, kernel/blk_drv/blk.h, 83, DEVICE_OFF kernel/blk_drv/blk.h, 67, kernel/blk_drv/blk.h, 76, kernel/blk_drv/blk.h, 85, DEVICE_ON kernel/blk_drv/blk.h, 66, kernel/blk_drv/blk.h, 75, kernel/blk_drv/blk.h, 84, DEVICE_REQUEST kernel/blk_drv/blk.h, 64, kernel/blk_drv/blk.h, 73, kernel/blk_drv/blk.h, 82, kernel/blk_drv/blk.h, 99, die kernel/traps.c, 63, tools/build.c, 46, difftime include/time.h, 32,
DIR_ENTRIES_PER_BLOCK include/fs.h, 56, dir_entry include/fs.h, 157, structdir_namei fs/namei.c, 278, div_t include/sys/types.h, 36, divide_error kernel/traps.c, 43, DMA_READ include/fdreg.h, 68, DMA_WRITE include/fdreg.h, 69, do_bounds kernel/traps.c, 134, do_coprocessor_error kernel/traps.c, 169, do_coprocessor_segment_overrun kernel/traps.c, 149, do_debug kernel/traps.c, 124, do_device_not_available kernel/traps.c, 144, do_div kernel/vsprintf.c, 35, do_divide_error kernel/traps.c, 97, do_double_fault kernel/traps.c, 87, do_execve fs/exec.c, 182, do_exit kernel/exit.c, 102, kernel/traps.c, 39, kernel/signal.c, 13, mm/memory.c, 31, do_fd_request kernel/blk_drv/floppy.c, 417, do_floppy_timer kernel/sched.c, 245, do_general_protection kernel/traps.c, 92, do_hd_request kernel/blk_drv/hd.c, 294, do_int3 kernel/traps.c, 102, do_invalid_op kernel/traps.c, 139, do_invalid_TSS kernel/traps.c, 154, do_nmi kernel/traps.c, 119, do_no_page mm/memory.c, 365, do_overflow
![Page 779: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/779.jpg)
kernel/traps.c, 129, do_rd_request kernel/blk_drv/ramdisk.c, 23, do_reserved kernel/traps.c, 176, do_segment_not_present kernel/traps.c, 159, do_signal kernel/signal.c, 82, do_stack_segment kernel/traps.c, 164, do_timer kernel/sched.c, 305, do_tty_interrupt kernel/chr_drv/tty_io.c, 342, do_wp_page mm/memory.c, 247, double_fault kernel/traps.c, 51, DRIVE kernel/blk_drv/floppy.c, 54, drive_busy kernel/blk_drv/hd.c, 202, DRIVE_INFO init/main.c, 59, drive_info init/main.c, 102, structDRQ_STAT include/hdreg.h, 27, dup include/unistd.h, 200, dup2 include/unistd.h, 248, dupfd fs/fcntl.c, 18, E2BIGinclude/errno.h, 26, EACCESinclude/errno.h, 32, EAGAIN include/errno.h, 30, EBADFinclude/errno.h, 28, EBUSY include/errno.h, 35, ECC_ERR include/hdreg.h, 49, ECC_STAT include/hdreg.h, 26, ECHILD include/errno.h, 29, ECHOinclude/termios.h, 172, ECHOCTL include/termios.h, 178, ECHOE
include/termios.h, 173, ECHOK include/termios.h, 174, ECHOKE include/termios.h, 180, ECHONL include/termios.h, 175, ECHOPRTinclude/termios.h, 179, EDEADLK include/errno.h, 54, EDOM include/errno.h, 52, EEXISTinclude/errno.h, 36, EFAULTinclude/errno.h, 33, EFBIGinclude/errno.h, 46, EINTRinclude/errno.h, 23, EINVALinclude/errno.h, 41, EIOinclude/errno.h, 24, EISDIR include/errno.h, 40, EMFILEinclude/errno.h, 43, EMLINKinclude/errno.h, 50, EMPTYinclude/tty.h, 26, empty_dir fs/namei.c, 543, ENAMETOOLONG include/errno.h, 55, endfs/buffer.c, 29, end_requestkernel/blk_drv/blk.h, 109, ENFILE include/errno.h, 42, ENODEV include/errno.h, 38, ENOENT include/errno.h, 21, ENOEXEC include/errno.h, 27, ENOLCKinclude/errno.h, 56, ENOMEM include/errno.h, 31, ENOSPCinclude/errno.h, 47, ENOSYS
![Page 780: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/780.jpg)
include/errno.h, 57, ENOTBLKinclude/errno.h, 34, ENOTDIR include/errno.h, 39, ENOTEMPTY include/errno.h, 58, ENOTTY include/errno.h, 44, envpinit/main.c, 166, envp_rc init/main.c, 163, ENXIOinclude/errno.h, 25, EOF_CHAR include/tty.h, 40, EPERMinclude/errno.h, 20, EPIPE include/errno.h, 51, ERANGE include/errno.h, 53, ERASE_CHAR include/tty.h, 38, EROFSinclude/errno.h, 49, ERR_STAT include/hdreg.h, 24, errno include/unistd.h, 187, include/errno.h, 17, lib/errno.c, 7, ERRORinclude/errno.h, 19, ESPIPEinclude/errno.h, 48, ESRCHinclude/errno.h, 22, ETXTBSY include/errno.h, 45, EXDEVinclude/errno.h, 37, execinclude/a.out.h, 6, structexeclinclude/unistd.h, 204, execleinclude/unistd.h, 206, execlpinclude/unistd.h, 205, execvinclude/unistd.h, 202, execveinclude/unistd.h, 201, execvp
include/unistd.h, 203, exit include/unistd.h, 207, EXT_MEM_K init/main.c, 58, EXTA include/termios.h, 149, EXTBinclude/termios.h, 150, F_DUPFD include/fcntl.h, 23, F_GETFD include/fcntl.h, 24, F_GETFL include/fcntl.h, 26, F_GETLK include/fcntl.h, 28, F_OK include/unistd.h, 22, F_RDLCKinclude/fcntl.h, 38, F_SETFD include/fcntl.h, 25, F_SETFL include/fcntl.h, 27, F_SETLK include/fcntl.h, 29, F_SETLKW include/fcntl.h, 30, F_UNLCK include/fcntl.h, 40, F_WRLCKinclude/fcntl.h, 39, fcntl include/unistd.h, 209, include/fcntl.h, 52, FD_CLOEXEC include/fcntl.h, 33, FD_DATA include/fdreg.h, 17, FD_DCR include/fdreg.h, 20, FD_DIRinclude/fdreg.h, 19, FD_DORinclude/fdreg.h, 18, FD_READinclude/fdreg.h, 62, FD_RECALIBRATE include/fdreg.h, 60, FD_SEEK include/fdreg.h, 61, FD_SENSEI include/fdreg.h, 64, FD_SPECIFY include/fdreg.h, 65,
![Page 781: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/781.jpg)
FD_STATUS include/fdreg.h, 16, FD_WRITE include/fdreg.h, 63, FF0include/termios.h, 128, FF1include/termios.h, 129, FFDLY include/termios.h, 127, fileinclude/fs.h, 116, structfile_read fs/read_write.c, 20, fs/file_dev.c, 17, file_table fs/file_table.c, 9, include/fs.h, 163, file_write fs/read_write.c, 22, fs/file_dev.c, 48, find_buffer fs/buffer.c, 166, find_empty_process kernel/fork.c, 135, find_entry fs/namei.c, 91, find_first_zero fs/bitmap.c, 31, FIRST_LDT_ENTRY include/sched.h, 154, FIRST_TASK include/sched.h, 7, FIRST_TSS_ENTRY include/sched.h, 153, flock include/fcntl.h, 43, structfloppy kernel/blk_drv/floppy.c, 114, floppy_change include/fs.h, 169, kernel/blk_drv/floppy.c, 139, floppy_deselect include/fdreg.h, 13, kernel/blk_drv/floppy.c, 125, floppy_init init/main.c, 49, kernel/blk_drv/floppy.c, 457, floppy_interrupt kernel/blk_drv/floppy.c, 104, floppy_off include/fs.h, 172, include/fdreg.h, 11, kernel/sched.c, 240, floppy_on include/fs.h, 171,
include/fdreg.h, 10, kernel/sched.c, 232, floppy_on_interrupt kernel/blk_drv/floppy.c, 404, floppy_select include/fdreg.h, 12, floppy_struct kernel/blk_drv/floppy.c, 82, structfloppy_type kernel/blk_drv/floppy.c, 85, flush kernel/chr_drv/tty_ioctl.c, 39, FLUSHO include/termios.h, 181, fn_ptr include/sched.h, 38, fork include/unistd.h, 210, freeinclude/kernel.h, 12, free_block fs/bitmap.c, 47, include/fs.h, 193, free_bucket_desc lib/malloc.c, 92, free_dind fs/truncate.c, 29, free_ind fs/truncate.c, 11, free_inode fs/bitmap.c, 107, include/fs.h, 195, free_list fs/buffer.c, 32, free_page include/mm.h, 8, mm/memory.c, 89, free_page_tables include/sched.h, 30, mm/memory.c, 105, free_s include/kernel.h, 10, lib/malloc.c, 182, free_super fs/super.c, 40, fstatinclude/sys/stat.h, 52, include/unistd.h, 233, FULLinclude/tty.h, 29, GCC_HEADERtools/build.c, 33, gdt include/head.h, 9, GDT_CODE include/head.h, 12,
![Page 782: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/782.jpg)
GDT_DATA include/head.h, 13, GDT_NUL include/head.h, 11, GDT_TMP include/head.h, 14, general_protection kernel/traps.c, 56, get_base include/sched.h, 226, get_dir fs/namei.c, 228, get_ds include/asm/segment.h, 54, get_empty_inode fs/inode.c, 194, include/fs.h, 183, get_empty_page mm/memory.c, 274, get_free_page include/mm.h, 6, mm/memory.c, 63, get_fs include/asm/segment.h, 47, get_fs_byte include/asm/segment.h, 1, get_fs_long include/asm/segment.h, 17, get_fs_word include/asm/segment.h, 9, get_hash_table fs/buffer.c, 183, include/fs.h, 185, get_limit include/sched.h, 228, get_new kernel/signal.c, 40, get_pipe_inode fs/inode.c, 228, include/fs.h, 184, get_seg_byte kernel/traps.c, 22, get_seg_long kernel/traps.c, 28, get_super fs/super.c, 56, include/fs.h, 197, get_termio kernel/chr_drv/tty_ioctl.c, 76, get_termios kernel/chr_drv/tty_ioctl.c, 56, getblk fs/buffer.c, 206, include/fs.h, 186, GETCH include/tty.h, 31,
getegid include/unistd.h, 215, geteuid include/unistd.h, 213, getgid include/unistd.h, 214, getpgrp include/unistd.h, 250, getpid include/unistd.h, 211, getppid include/unistd.h, 249, getuid include/unistd.h, 212, gid_t include/sys/types.h, 25, gmtime include/time.h, 37, gotoxy kernel/chr_drv/console.c, 88, hash fs/buffer.c, 129, hash_table fs/buffer.c, 31, hdkernel/blk_drv/hd.c, 59, HD_CMD include/hdreg.h, 21, HD_COMMAND include/hdreg.h, 19, HD_CURRENT include/hdreg.h, 16, HD_DATA include/hdreg.h, 10, HD_ERROR include/hdreg.h, 11, HD_HCYL include/hdreg.h, 15, hd_i_struct kernel/blk_drv/hd.c, 45, structhd_info kernel/blk_drv/hd.c, 49, structkernel/blk_drv/hd.c, 52, structhd_init init/main.c, 48, kernel/blk_drv/hd.c, 343, hd_interrupt kernel/blk_drv/hd.c, 67, HD_LCYL include/hdreg.h, 14, HD_NSECTOR include/hdreg.h, 12, hd_out kernel/blk_drv/hd.c, 180, HD_PRECOMP include/hdreg.h, 18,
![Page 783: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/783.jpg)
HD_SECTOR include/hdreg.h, 13, HD_STATUS include/hdreg.h, 17, hd_struct kernel/blk_drv/hd.c, 56, structheadkernel/blk_drv/floppy.c, 117, HIGH_MEMORY mm/memory.c, 52, HOUR kernel/mktime.c, 21, HUPCL include/termios.h, 160, HZinclude/sched.h, 5, I_BLOCK_SPECIAL include/const.h, 9, I_CHAR_SPECIAL include/const.h, 10, I_CRNL kernel/chr_drv/tty_io.c, 42, I_DIRECTORY include/const.h, 7, I_MAP_SLOTS include/fs.h, 39, I_NAMED_PIPE include/const.h, 11, I_NLCRkernel/chr_drv/tty_io.c, 41, I_NOCRkernel/chr_drv/tty_io.c, 43, I_REGULAR include/const.h, 8, I_SET_GID_BIT include/const.h, 13, I_SET_UID_BIT include/const.h, 12, I_TYPE include/const.h, 6, I_UCLC kernel/chr_drv/tty_io.c, 40, i387_struct include/sched.h, 40, structICANON include/termios.h, 170, ICRNLinclude/termios.h, 91, ID_ERR include/hdreg.h, 48, idt include/head.h, 9, IEXTENinclude/termios.h, 183, iget fs/inode.c, 244,
include/fs.h, 182, IGNBRKinclude/termios.h, 83, IGNCRinclude/termios.h, 90, IGNPAR include/termios.h, 85, IMAXBELinclude/termios.h, 96, immoutb_p kernel/blk_drv/floppy.c, 50, IN_ORDER kernel/blk_drv/blk.h, 40, inb include/asm/io.h, 5, inb_p include/asm/io.h, 17, INCinclude/tty.h, 24, INC_PIPE include/fs.h, 63, INDEX_STAT include/hdreg.h, 25, init init/main.c, 45, init/main.c, 168, kernel/chr_drv/serial.c, 26, init_bucket_desc lib/malloc.c, 97, INIT_C_CC include/tty.h, 63, INIT_REQUEST kernel/blk_drv/blk.h, 127, INIT_TASK include/sched.h, 113, init_task kernel/sched.c, 58, unionINLCRinclude/termios.h, 89, ino_t include/sys/types.h, 27, inode_table fs/inode.c, 15, include/fs.h, 162, INODES_PER_BLOCK include/fs.h, 55, INPCK include/termios.h, 87, insert_char kernel/chr_drv/console.c, 336, insert_into_queues fs/buffer.c, 149, insert_line kernel/chr_drv/console.c, 350, int3 kernel/traps.c, 46,
![Page 784: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/784.jpg)
interruptible_sleep_on include/sched.h, 146, kernel/sched.c, 167, INTMASK kernel/chr_drv/tty_io.c, 19, INTR_CHAR include/tty.h, 36, invalid_op kernel/traps.c, 49, invalid_TSS kernel/traps.c, 53, invalidate mm/memory.c, 39, invalidate_buffers fs/buffer.c, 84, invalidate_inodes fs/inode.c, 43, ioctl include/unistd.h, 216, ioctl_ptr fs/ioctl.c, 15, ioctl_table fs/ioctl.c, 19, iput fs/inode.c, 150, include/fs.h, 181, iretinclude/asm/system.h, 20, irq13 kernel/traps.c, 61, is_digit kernel/vsprintf.c, 16, IS_SEEKABLE include/fs.h, 24, isalnum include/ctype.h, 16, isalpha include/ctype.h, 17, isasciiinclude/ctype.h, 28, iscntrl include/ctype.h, 18, isdigit include/ctype.h, 19, isgraph include/ctype.h, 20, ISIG include/termios.h, 169, islower include/ctype.h, 21, isprint include/ctype.h, 22, ispunct include/ctype.h, 23, isspaceinclude/ctype.h, 24,
ISTRIP include/termios.h, 88, isupper include/ctype.h, 25, isxdigit include/ctype.h, 26, IUCLCinclude/termios.h, 92, IXANY include/termios.h, 94, IXOFFinclude/termios.h, 95, IXON include/termios.h, 93, jiffiesinclude/sched.h, 139, kernel/sched.c, 60, KBD_FINNISH include/config.h, 19, kernel_mktime init/main.c, 52, kernel/mktime.c, 41, keyboard_interrupt kernel/chr_drv/console.c, 56, kill include/unistd.h, 217, include/signal.h, 57, KILL_CHAR include/tty.h, 39, kill_session kernel/exit.c, 46, KILLMASK kernel/chr_drv/tty_io.c, 18, L_CANON kernel/chr_drv/tty_io.c, 32, L_ECHO kernel/chr_drv/tty_io.c, 34, L_ECHOCTL kernel/chr_drv/tty_io.c, 37, L_ECHOE kernel/chr_drv/tty_io.c, 35, L_ECHOK kernel/chr_drv/tty_io.c, 36, L_ECHOKE kernel/chr_drv/tty_io.c, 38, L_ISIG kernel/chr_drv/tty_io.c, 33, LASTinclude/tty.h, 28, last_pid kernel/fork.c, 22, LAST_TASK include/sched.h, 8, last_task_used_math include/sched.h, 137, kernel/sched.c, 63,
![Page 785: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/785.jpg)
LATCH kernel/sched.c, 46, ldiv_t include/sys/types.h, 37, LDT_CODE include/head.h, 17, LDT_DATA include/head.h, 18, LDT_NUL include/head.h, 16, LEFTinclude/tty.h, 27, kernel/vsprintf.c, 31, lfkernel/chr_drv/console.c, 204, link include/unistd.h, 218, ll_rw_block include/fs.h, 187, kernel/blk_drv/ll_rw_blk.c, 145, lldt include/sched.h, 158, localtime include/time.h, 38, lock_buffer kernel/blk_drv/ll_rw_blk.c, 42, lock_inode fs/inode.c, 28, lock_super fs/super.c, 31, LOW_MEM mm/memory.c, 43, lseekinclude/unistd.h, 219, ltrinclude/sched.h, 157, m_inode include/fs.h, 93, structmain init/main.c, 104, tools/build.c, 57, main_memory_start init/main.c, 100, MAJOR include/fs.h, 33, MAJOR_NR kernel/blk_drv/hd.c, 25, kernel/blk_drv/floppy.c, 41, kernel/blk_drv/ramdisk.c, 17, make_request kernel/blk_drv/ll_rw_blk.c, 88, malloc include/kernel.h, 9, lib/malloc.c, 117, MAP_NR mm/memory.c, 46,
MARK_ERR include/hdreg.h, 45, match fs/namei.c, 63, math_emulate kernel/math/math_emulate.c, 18, math_error kernel/math/math_emulate.c, 37, math_state_restore kernel/sched.c, 77, MAX fs/file_dev.c, 15, MAX_ARG_PAGES fs/exec.c, 39, MAX_ERRORS kernel/blk_drv/hd.c, 34, kernel/blk_drv/floppy.c, 60, MAX_HD kernel/blk_drv/hd.c, 35, MAX_REPLIES kernel/blk_drv/floppy.c, 65, MAY_EXEC fs/namei.c, 29, MAY_READ fs/namei.c, 31, MAY_WRITE fs/namei.c, 30, mem_init init/main.c, 50, mm/memory.c, 399, mem_map mm/memory.c, 57, mem_use kernel/sched.c, 48, memchr include/string.h, 379, memcmp include/string.h, 363, memcpy include/string.h, 336, include/asm/memory.h, 8, memmove include/string.h, 346, memory_end init/main.c, 98, memset include/string.h, 395, MIN fs/file_dev.c, 14, MINIX_HEADER tools/build.c, 32, MINOR include/fs.h, 34, MINUTEkernel/mktime.c, 20, mkdir
![Page 786: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/786.jpg)
include/sys/stat.h, 53, mkfifo include/sys/stat.h, 54, mknod include/unistd.h, 220, mktime include/time.h, 33, mode_t include/sys/types.h, 28, moff_timer kernel/sched.c, 203, mon_timer kernel/sched.c, 202, month kernel/mktime.c, 26, mount include/unistd.h, 221, mount_root fs/super.c, 242, include/fs.h, 200, move_to_user_mode include/asm/system.h, 1, N_ABS include/a.out.h, 128, N_BADMAG include/a.out.h, 31, N_BSS include/a.out.h, 137, N_BSSADDR include/a.out.h, 107, N_COMM include/a.out.h, 140, N_DATA include/a.out.h, 134, N_DATADDR include/a.out.h, 100, N_DATOFFinclude/a.out.h, 48, N_DRELOFF include/a.out.h, 56, N_EXTinclude/a.out.h, 147, N_FN include/a.out.h, 143, N_INDR include/a.out.h, 164, N_MAGIC include/a.out.h, 18, N_SETA include/a.out.h, 178, N_SETBinclude/a.out.h, 181, N_SETD include/a.out.h, 180, N_SETTinclude/a.out.h, 179,
N_SETV include/a.out.h, 184, N_STAB include/a.out.h, 153, N_STROFFinclude/a.out.h, 64, N_SYMOFF include/a.out.h, 60, N_TEXTinclude/a.out.h, 131, N_TRELOFF include/a.out.h, 52, N_TXTADDR include/a.out.h, 69, N_TXTOFF include/a.out.h, 43, N_TYPE include/a.out.h, 150, N_UNDF include/a.out.h, 125, NAME_LEN include/fs.h, 36, namei fs/namei.c, 303, include/fs.h, 178, NCCinclude/termios.h, 43, NCCSinclude/termios.h, 53, new_block fs/bitmap.c, 75, include/fs.h, 192, new_inode fs/bitmap.c, 136, include/fs.h, 194, next_timer kernel/sched.c, 270, niceinclude/unistd.h, 222, NL0 include/termios.h, 108, NL1 include/termios.h, 109, NLDLY include/termios.h, 107, nlink_t include/sys/types.h, 30, nlist include/a.out.h, 111, structNMAGIC include/a.out.h, 25, nmi kernel/traps.c, 45, NOFLSH include/termios.h, 176, nop
![Page 787: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/787.jpg)
include/asm/system.h, 18, NPAR kernel/chr_drv/console.c, 54, npar kernel/chr_drv/console.c, 75, NR_BLK_DEV kernel/blk_drv/blk.h, 4, NR_BUFFERS fs/buffer.c, 34, include/fs.h, 48, nr_buffers include/fs.h, 166, NR_FILE include/fs.h, 45, NR_HASH include/fs.h, 47, NR_HD kernel/blk_drv/hd.c, 50, kernel/blk_drv/hd.c, 53, NR_INODE include/fs.h, 44, NR_OPEN include/fs.h, 43, NR_REQUEST kernel/blk_drv/blk.h, 15, NR_SUPER include/fs.h, 46, NR_TASKS include/sched.h, 4, NRDEVS fs/char_dev.c, 83, fs/ioctl.c, 17, NSIG include/signal.h, 10, NULL include/sys/types.h, 20, include/unistd.h, 18, include/stddef.h, 14, include/stddef.h, 15, include/string.h, 5, include/sched.h, 26, include/fs.h, 52, number kernel/vsprintf.c, 40, O_ACCMODE include/fcntl.h, 7, O_APPEND include/fcntl.h, 15, O_CREAT include/fcntl.h, 11, O_CRNL kernel/chr_drv/tty_io.c, 47, O_EXCL include/fcntl.h, 12, O_LCUC kernel/chr_drv/tty_io.c, 49,
O_NDELAY include/fcntl.h, 17, O_NLCR kernel/chr_drv/tty_io.c, 46, O_NLRET kernel/chr_drv/tty_io.c, 48, O_NOCTTYinclude/fcntl.h, 13, O_NONBLOCK include/fcntl.h, 16, O_POSTkernel/chr_drv/tty_io.c, 45, O_RDONLY include/fcntl.h, 8, O_RDWR include/fcntl.h, 10, O_TRUNC include/fcntl.h, 14, O_WRONLY include/fcntl.h, 9, OCRNLinclude/termios.h, 102, OFDEL include/termios.h, 106, off_t include/sys/types.h, 32, offsetof include/stddef.h, 17, OFILLinclude/termios.h, 105, OLCUCinclude/termios.h, 100, OMAGIC include/a.out.h, 23, ONLCRinclude/termios.h, 101, ONLRET include/termios.h, 104, ONOCR include/termios.h, 103, oom mm/memory.c, 33, open include/unistd.h, 223, include/fcntl.h, 53, lib/open.c, 11, open_namei fs/namei.c, 337, include/fs.h, 179, OPOST include/termios.h, 99, ORIG_ROOT_DEV init/main.c, 60, ORIG_VIDEO_COLS kernel/chr_drv/console.c, 43, ORIG_VIDEO_EGA_AX
![Page 788: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/788.jpg)
kernel/chr_drv/console.c, 45, ORIG_VIDEO_EGA_BX kernel/chr_drv/console.c, 46, ORIG_VIDEO_EGA_CX kernel/chr_drv/console.c, 47, ORIG_VIDEO_LINES kernel/chr_drv/console.c, 44, ORIG_VIDEO_MODE kernel/chr_drv/console.c, 42, ORIG_VIDEO_PAGE kernel/chr_drv/console.c, 41, ORIG_X kernel/chr_drv/console.c, 39, ORIG_Y kernel/chr_drv/console.c, 40, origin kernel/chr_drv/console.c, 69, outb include/asm/io.h, 1, outb_p include/asm/io.h, 11, output_byte kernel/blk_drv/floppy.c, 194, overflow kernel/traps.c, 47, PAGE_ALIGN include/sched.h, 186, page_exception kernel/traps.c, 41, page_fault kernel/traps.c, 57, PAGE_SIZE include/a.out.h, 79, include/a.out.h, 88, include/a.out.h, 92, include/mm.h, 4, PAGING_MEMORY mm/memory.c, 44, PAGING_PAGES mm/memory.c, 45, panic include/kernel.h, 5, include/sched.h, 35, kernel/panic.c, 16, parkernel/chr_drv/console.c, 75, parallel_interrupt kernel/traps.c, 60, PARENB include/termios.h, 165, PARMRKinclude/termios.h, 86, PARODD include/termios.h, 166, partition include/hdreg.h, 52, struct
pause include/unistd.h, 224, PENDINinclude/termios.h, 182, permission fs/namei.c, 40, pg_dir include/head.h, 8, pid_t include/sys/types.h, 23, pipe include/unistd.h, 225, PIPE_EMPTY include/fs.h, 61, PIPE_FULL include/fs.h, 62, PIPE_HEAD include/fs.h, 58, PIPE_SIZE include/fs.h, 60, PIPE_TAIL include/fs.h, 59, PLUSkernel/vsprintf.c, 29, port_readkernel/blk_drv/hd.c, 61, port_write kernel/blk_drv/hd.c, 64, poskernel/chr_drv/console.c, 71, printbuf init/main.c, 42, printf include/kernel.h, 6, init/main.c, 151, printk include/kernel.h, 7, kernel/printk.c, 21, ptrdiff_t include/sys/types.h, 16, include/stddef.h, 6, put_fs_byte include/asm/segment.h, 25, put_fs_long include/asm/segment.h, 35, put_fs_word include/asm/segment.h, 30, put_page include/mm.h, 7, mm/memory.c, 197, put_super fs/super.c, 74, PUTCH include/tty.h, 33, ques kernel/chr_drv/console.c, 76,
![Page 789: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/789.jpg)
QUIT_CHAR include/tty.h, 37, QUITMASK kernel/chr_drv/tty_io.c, 20, quotient kernel/chr_drv/tty_ioctl.c, 18, R_OK include/unistd.h, 25, raiseinclude/signal.h, 56, rd_init init/main.c, 51, kernel/blk_drv/ramdisk.c, 52, rd_length kernel/blk_drv/ramdisk.c, 21, rd_load kernel/blk_drv/hd.c, 68, kernel/blk_drv/ramdisk.c, 71, rd_start kernel/blk_drv/ramdisk.c, 20, readinclude/unistd.h, 226, READinclude/fs.h, 26, read_inodefs/inode.c, 17, fs/inode.c, 294, read_intr kernel/blk_drv/hd.c, 250, read_pipefs/read_write.c, 16, fs/pipe.c, 13, read_super fs/super.c, 100, READA include/fs.h, 28, READY_STAT include/hdreg.h, 30, recal_interrupt kernel/blk_drv/floppy.c, 343, recal_intr kernel/blk_drv/hd.c, 37, kernel/blk_drv/hd.c, 287, recalibrate kernel/blk_drv/hd.c, 39, kernel/blk_drv/floppy.c, 44, recalibrate_floppy kernel/blk_drv/floppy.c, 362, releasekernel/exit.c, 19, relocation_info include/a.out.h, 193, structremove_from_queues fs/buffer.c, 131, reply_buffer kernel/blk_drv/floppy.c, 66,
request kernel/blk_drv/ll_rw_blk.c, 21, kernel/blk_drv/blk.h, 23, structkernel/blk_drv/blk.h, 51, reserved kernel/traps.c, 59, resetkernel/blk_drv/hd.c, 40, kernel/blk_drv/floppy.c, 45, reset_controller kernel/blk_drv/hd.c, 217, reset_floppy kernel/blk_drv/floppy.c, 386, reset_hd kernel/blk_drv/hd.c, 230, reset_interrupt kernel/blk_drv/floppy.c, 373, respond kernel/chr_drv/console.c, 323, RESPONSEkernel/chr_drv/console.c, 85, restore_cur kernel/chr_drv/console.c, 440, result kernel/blk_drv/floppy.c, 212, rikernel/chr_drv/console.c, 214, ROOT_DEV fs/super.c, 29, include/fs.h, 198, ROOT_INO include/fs.h, 37, rs_init include/tty.h, 65, kernel/chr_drv/serial.c, 37, rs_write include/tty.h, 72, kernel/chr_drv/serial.c, 53, rs1_interrupt kernel/chr_drv/serial.c, 23, rs2_interrupt kernel/chr_drv/serial.c, 24, rw_char fs/read_write.c, 15, fs/char_dev.c, 95, rw_interrupt kernel/blk_drv/floppy.c, 250, rw_kmem fs/char_dev.c, 44, rw_mem fs/char_dev.c, 39, rw_memory fs/char_dev.c, 65, rw_port fs/char_dev.c, 49, rw_ram
![Page 790: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/790.jpg)
fs/char_dev.c, 34, rw_tty fs/char_dev.c, 27, rw_ttyx fs/char_dev.c, 21, S_IFBLKinclude/sys/stat.h, 22, S_IFCHR include/sys/stat.h, 24, S_IFDIRinclude/sys/stat.h, 23, S_IFIFO include/sys/stat.h, 25, S_IFMTinclude/sys/stat.h, 20, S_IFREGinclude/sys/stat.h, 21, S_IRGRP include/sys/stat.h, 42, S_IROTH include/sys/stat.h, 47, S_IRUSR include/sys/stat.h, 37, S_IRWXG include/sys/stat.h, 41, S_IRWXO include/sys/stat.h, 46, S_IRWXU include/sys/stat.h, 36, S_ISBLKinclude/sys/stat.h, 33, S_ISCHR include/sys/stat.h, 32, S_ISDIRinclude/sys/stat.h, 31, S_ISFIFO include/sys/stat.h, 34, S_ISGIDinclude/sys/stat.h, 27, S_ISREGinclude/sys/stat.h, 30, S_ISUIDinclude/sys/stat.h, 26, S_ISVTXinclude/sys/stat.h, 28, S_IWGRPinclude/sys/stat.h, 43, S_IWOTH include/sys/stat.h, 48, S_IWUSRinclude/sys/stat.h, 38, S_IXGRPinclude/sys/stat.h, 44, S_IXOTH include/sys/stat.h, 49, S_IXUSR
include/sys/stat.h, 39, SA_NOCLDSTOP include/signal.h, 37, SA_NOMASK include/signal.h, 38, SA_ONESHOT include/signal.h, 39, save_cur kernel/chr_drv/console.c, 434, save_old kernel/signal.c, 28, saved_x kernel/chr_drv/console.c, 431, saved_y kernel/chr_drv/console.c, 432, sbrkinclude/unistd.h, 193, sched_init include/sched.h, 32, kernel/sched.c, 385, schedule include/sched.h, 33, kernel/sched.c, 104, scr_end kernel/chr_drv/console.c, 70, scrdown kernel/chr_drv/console.c, 170, scrupkernel/chr_drv/console.c, 107, sectorkernel/blk_drv/floppy.c, 116, seekkernel/blk_drv/floppy.c, 46, SEEK_CUR include/unistd.h, 29, SEEK_END include/unistd.h, 30, seek_interrupt kernel/blk_drv/floppy.c, 291, SEEK_SET include/unistd.h, 28, SEEK_STAT include/hdreg.h, 28, seek_trackkernel/blk_drv/floppy.c, 119, segment_not_present kernel/traps.c, 54, SEGMENT_SIZE include/a.out.h, 76, include/a.out.h, 82, include/a.out.h, 85, include/a.out.h, 89, include/a.out.h, 93, selectedkernel/blk_drv/floppy.c, 122, send_break
![Page 791: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/791.jpg)
kernel/chr_drv/tty_ioctl.c, 51, send_sig kernel/exit.c, 35, set_baseinclude/sched.h, 211, set_bit fs/super.c, 22, fs/bitmap.c, 19, set_cursor kernel/chr_drv/console.c, 313, set_fsinclude/asm/segment.h, 61, set_intr_gate include/asm/system.h, 33, set_ldt_desc include/asm/system.h, 66, set_limit include/sched.h, 212, set_origin kernel/chr_drv/console.c, 97, set_system_gate include/asm/system.h, 39, set_termio kernel/chr_drv/tty_ioctl.c, 97, set_termios kernel/chr_drv/tty_ioctl.c, 66, set_trap_gate include/asm/system.h, 36, set_tss_descinclude/asm/system.h, 65, setgid include/unistd.h, 230, setpgid include/unistd.h, 228, setpgrpinclude/unistd.h, 227, setsid include/unistd.h, 251, setuid include/unistd.h, 229, setup_DMA kernel/blk_drv/floppy.c, 160, setup_rw_floppy kernel/blk_drv/floppy.c, 269, SETUP_SECTS tools/build.c, 42, share_page mm/memory.c, 344, show_stat kernel/sched.c, 37, show_task kernel/sched.c, 26, sig_atomic_t include/signal.h, 6, SIG_BLOCK include/signal.h, 41,
SIG_DFLinclude/signal.h, 45, SIG_IGNinclude/signal.h, 46, SIG_SETMASK include/signal.h, 43, SIG_UNBLOCK include/signal.h, 42, SIGABRTinclude/signal.h, 17, sigaction include/signal.h, 48, structinclude/signal.h, 66, sigaddsetinclude/signal.h, 58, SIGALRMinclude/signal.h, 26, SIGCHLD include/signal.h, 29, SIGCONT include/signal.h, 30, sigdelset include/signal.h, 59, sigemptyset include/signal.h, 60, sigfillset include/signal.h, 61, SIGFPEinclude/signal.h, 20, SIGHUPinclude/signal.h, 12, SIGILLinclude/signal.h, 15, SIGINTinclude/signal.h, 13, SIGIOTinclude/signal.h, 18, sigismember include/signal.h, 62, SIGKILL include/signal.h, 21, SIGNkernel/vsprintf.c, 28, sigpending include/signal.h, 63, SIGPIPEinclude/signal.h, 25, sigprocmask include/signal.h, 64, SIGQUIT include/signal.h, 14, SIGSEGV include/signal.h, 23, sigset_t include/signal.h, 7, SIGSTKFLT
![Page 792: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/792.jpg)
include/signal.h, 28, SIGSTOP include/signal.h, 31, sigsuspend include/signal.h, 65, SIGTERMinclude/signal.h, 27, SIGTRAPinclude/signal.h, 16, SIGTSTPinclude/signal.h, 32, SIGTTINinclude/signal.h, 33, SIGTTOUinclude/signal.h, 34, SIGUNUSED include/signal.h, 19, SIGUSR1 include/signal.h, 22, SIGUSR2 include/signal.h, 24, size_tinclude/sys/types.h, 6, include/time.h, 11, include/stddef.h, 11, include/string.h, 10, skip_atoi kernel/vsprintf.c, 18, sleep_if_empty kernel/chr_drv/tty_io.c, 122, sleep_if_full kernel/chr_drv/tty_io.c, 130, sleep_oninclude/sched.h, 145, kernel/sched.c, 151, SMALLkernel/vsprintf.c, 33, SPACEkernel/vsprintf.c, 30, SPECIALkernel/vsprintf.c, 32, speed_t include/termios.h, 214, ST0kernel/blk_drv/floppy.c, 67, ST0_DSinclude/fdreg.h, 30, ST0_ECEinclude/fdreg.h, 33, ST0_HAinclude/fdreg.h, 31, ST0_INTRinclude/fdreg.h, 35, ST0_NRinclude/fdreg.h, 32, ST0_SE
include/fdreg.h, 34, ST1kernel/blk_drv/floppy.c, 68, ST1_CRC include/fdreg.h, 42, ST1_EOC include/fdreg.h, 43, ST1_MAM include/fdreg.h, 38, ST1_NDinclude/fdreg.h, 40, ST1_ORinclude/fdreg.h, 41, ST1_WPinclude/fdreg.h, 39, ST2kernel/blk_drv/floppy.c, 69, ST2_BC include/fdreg.h, 47, ST2_CMinclude/fdreg.h, 52, ST2_CRC include/fdreg.h, 51, ST2_MAM include/fdreg.h, 46, ST2_SEH include/fdreg.h, 49, ST2_SNS include/fdreg.h, 48, ST2_WC include/fdreg.h, 50, ST3kernel/blk_drv/floppy.c, 70, ST3_HAinclude/fdreg.h, 55, ST3_TZinclude/fdreg.h, 56, ST3_WPinclude/fdreg.h, 57, stack_segment kernel/traps.c, 55, start_buffer fs/buffer.c, 30, include/fs.h, 165, START_CHAR include/tty.h, 41, startup_time include/sched.h, 140, init/main.c, 53, kernel/sched.c, 61, statinclude/sys/stat.h, 6, structinclude/sys/stat.h, 55, include/unistd.h, 232, statekernel/chr_drv/console.c, 74,
![Page 793: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/793.jpg)
STATUS_BUSY include/fdreg.h, 24, STATUS_BUSYMASK include/fdreg.h, 23, STATUS_DIR include/fdreg.h, 26, STATUS_DMA include/fdreg.h, 25, STATUS_READY include/fdreg.h, 27, STDERR_FILENO include/unistd.h, 15, STDIN_FILENO include/unistd.h, 13, STDOUT_FILENO include/unistd.h, 14, stiinclude/asm/system.h, 16, stime include/unistd.h, 234, STOP_CHAR include/tty.h, 42, strinclude/sched.h, 159, strcatinclude/string.h, 54, strchrinclude/string.h, 128, strcmp include/string.h, 88, strcpyinclude/string.h, 27, strcspninclude/string.h, 185, strerror include/string.h, 13, strftime include/time.h, 39, STRINGIFY tools/build.c, 44, strleninclude/string.h, 263, strncatinclude/string.h, 68, strncmp include/string.h, 107, strncpy include/string.h, 38, strpbrk include/string.h, 209, strrchr include/string.h, 145, strspninclude/string.h, 161, strstrinclude/string.h, 236, strtok
include/string.h, 277, super_block fs/super.c, 27, include/fs.h, 124, structinclude/fs.h, 164, SUPER_MAGIC include/fs.h, 41, suserinclude/kernel.h, 21, SUSPEND_CHAR include/tty.h, 43, switch_to include/sched.h, 171, syncinclude/unistd.h, 235, sync_dev fs/buffer.c, 59, fs/super.c, 18, include/fs.h, 196, sync_inodes fs/inode.c, 59, include/fs.h, 174, sys_accessfs/open.c, 47, include/sys.h, 34, sys_acctinclude/sys.h, 52, kernel/sys.c, 77, sys_alarm include/sys.h, 28, kernel/sched.c, 338, sys_break include/sys.h, 18, kernel/sys.c, 21, sys_brkinclude/sys.h, 46, kernel/sys.c, 168, sys_call_table include/sys.h, 74, sys_chdirfs/open.c, 75, include/sys.h, 13, sys_chmod fs/open.c, 105, include/sys.h, 16, sys_chownfs/open.c, 121, include/sys.h, 17, sys_chrootfs/open.c, 90, include/sys.h, 62, sys_closefs/open.c, 192, fs/exec.c, 32, fs/fcntl.c, 16,
![Page 794: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/794.jpg)
include/sys.h, 7, kernel/exit.c, 17, sys_creatfs/open.c, 187, include/sys.h, 9, sys_dupfs/fcntl.c, 42, include/sys.h, 42, sys_dup2fs/fcntl.c, 36, include/sys.h, 64, sys_execve include/sys.h, 12, sys_exitfs/exec.c, 31, include/sys.h, 2, kernel/exit.c, 137, sys_fcntl fs/fcntl.c, 47, include/sys.h, 56, sys_forkinclude/sys.h, 3, sys_fstatfs/stat.c, 47, include/sys.h, 29, sys_ftime include/sys.h, 36, kernel/sys.c, 16, sys_getegid include/sys.h, 51, kernel/sched.c, 373, sys_geteuid include/sys.h, 50, kernel/sched.c, 363, sys_getgid include/sys.h, 48, kernel/sched.c, 368, sys_getpgrp include/sys.h, 66, kernel/sys.c, 201, sys_getpid include/sys.h, 21, kernel/sched.c, 348, sys_getppid include/sys.h, 65, kernel/sched.c, 353, sys_getuid include/sys.h, 25, kernel/sched.c, 358, sys_gttyinclude/sys.h, 33, kernel/sys.c, 36, sys_ioctl fs/ioctl.c, 30, include/sys.h, 55,
sys_kill include/sys.h, 38, kernel/exit.c, 60, sys_linkfs/namei.c, 721, include/sys.h, 10, sys_lock include/sys.h, 54, kernel/sys.c, 87, sys_lseekfs/read_write.c, 25, include/sys.h, 20, sys_mkdir fs/namei.c, 463, include/sys.h, 40, sys_mknod fs/namei.c, 412, include/sys.h, 15, sys_mount fs/super.c, 200, include/sys.h, 22, sys_mpx include/sys.h, 57, kernel/sys.c, 92, sys_niceinclude/sys.h, 35, kernel/sched.c, 378, sys_open fs/open.c, 138, include/sys.h, 6, sys_pause include/sys.h, 30, kernel/sched.c, 144, kernel/exit.c, 16, sys_physinclude/sys.h, 53, kernel/sys.c, 82, sys_pipe fs/pipe.c, 71, include/sys.h, 43, sys_profinclude/sys.h, 45, kernel/sys.c, 46, sys_ptraceinclude/sys.h, 27, kernel/sys.c, 26, sys_read fs/read_write.c, 55, include/sys.h, 4, sys_rename include/sys.h, 39, kernel/sys.c, 41, sys_rmdir fs/namei.c, 587, include/sys.h, 41,
![Page 795: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/795.jpg)
sys_setgid include/sys.h, 47, kernel/sys.c, 72, sys_setpgidinclude/sys.h, 58, kernel/sys.c, 181, sys_setregid include/sys.h, 72, kernel/sys.c, 51, sys_setreuid include/sys.h, 71, kernel/sys.c, 118, sys_setsidinclude/sys.h, 67, kernel/sys.c, 206, sys_setuid include/sys.h, 24, kernel/sys.c, 143, sys_setupinclude/sys.h, 1, kernel/blk_drv/hd.c, 71, sys_sgetmask include/sys.h, 69, kernel/signal.c, 15, sys_sigactioninclude/sys.h, 68, kernel/signal.c, 63, sys_signalinclude/sys.h, 49, kernel/signal.c, 48, SYS_SIZE tools/build.c, 35, sys_ssetmask include/sys.h, 70, kernel/signal.c, 20, sys_statfs/stat.c, 36, include/sys.h, 19, sys_stime include/sys.h, 26, kernel/sys.c, 148, sys_sttyinclude/sys.h, 32, kernel/sys.c, 31, sys_syncfs/buffer.c, 44, include/sys.h, 37, kernel/panic.c, 14, sys_time include/sys.h, 14, kernel/sys.c, 102, sys_times include/sys.h, 44, kernel/sys.c, 156, sys_ulimit
include/sys.h, 59, kernel/sys.c, 97, sys_umask include/sys.h, 61, kernel/sys.c, 230, sys_umount fs/super.c, 167, include/sys.h, 23, sys_uname include/sys.h, 60, kernel/sys.c, 216, sys_unlinkfs/namei.c, 663, include/sys.h, 11, sys_ustat fs/open.c, 19, include/sys.h, 63, sys_utime fs/open.c, 24, include/sys.h, 31, sys_waitpid include/sys.h, 8, kernel/exit.c, 142, sys_writefs/read_write.c, 83, include/sys.h, 5, sysbeepkernel/chr_drv/console.c, 79, kernel/chr_drv/console.c, 699, sysbeepstop kernel/chr_drv/console.c, 691, system_call kernel/sched.c, 51, TAB0include/termios.h, 116, TAB1include/termios.h, 117, TAB2include/termios.h, 118, TAB3include/termios.h, 119, TABDLYinclude/termios.h, 115, table_list kernel/chr_drv/tty_io.c, 99, task include/sched.h, 136, kernel/sched.c, 65, TASK_INTERRUPTIBLE include/sched.h, 20, TASK_RUNNING include/sched.h, 19, TASK_STOPPED include/sched.h, 23, task_struct include/sched.h, 78, struct
![Page 796: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/796.jpg)
TASK_UNINTERRUPTIBLE include/sched.h, 21, task_union kernel/sched.c, 53, unionTASK_ZOMBIE include/sched.h, 22, tcdrain include/termios.h, 220, tcflow include/termios.h, 221, TCFLSH include/termios.h, 18, tcflush include/termios.h, 222, TCGETA include/termios.h, 12, tcgetattr include/termios.h, 223, TCGETSinclude/termios.h, 8, TCIFLUSH include/termios.h, 205, TCIOFF include/termios.h, 201, TCIOFLUSH include/termios.h, 207, TCIONinclude/termios.h, 202, TCOFLUSH include/termios.h, 206, TCOOFFinclude/termios.h, 199, TCOON include/termios.h, 200, TCSADRAIN include/termios.h, 211, TCSAFLUSH include/termios.h, 212, TCSANOWinclude/termios.h, 210, TCSBRKinclude/termios.h, 16, tcsendbreak include/termios.h, 224, TCSETAinclude/termios.h, 13, TCSETAFinclude/termios.h, 15, tcsetattrinclude/termios.h, 225, TCSETAWinclude/termios.h, 14, TCSETSinclude/termios.h, 9, TCSETSFinclude/termios.h, 11, TCSETSW
include/termios.h, 10, TCXONC include/termios.h, 17, tell_father kernel/exit.c, 83, termio include/termios.h, 44, structtermios include/termios.h, 54, structticks_to_floppy_on include/fs.h, 170, include/fdreg.h, 9, kernel/sched.c, 206, time include/unistd.h, 236, include/time.h, 31, time_init init/main.c, 76, TIME_REQUESTS kernel/sched.c, 264, time_t include/sys/types.h, 11, include/time.h, 6, timer_interrupt kernel/sched.c, 50, timer_list kernel/sched.c, 266, structkernel/sched.c, 270, times include/sys/times.h, 13, include/unistd.h, 237, TIOCEXCL include/termios.h, 19, TIOCGPGRP include/termios.h, 22, TIOCGSOFTCAR include/termios.h, 32, TIOCGWINSZ include/termios.h, 26, TIOCINQ include/termios.h, 34, TIOCM_CAR include/termios.h, 192, TIOCM_CD include/termios.h, 195, TIOCM_CTS include/termios.h, 191, TIOCM_DSR include/termios.h, 194, TIOCM_DTR include/termios.h, 187, TIOCM_LE include/termios.h, 186, TIOCM_RI include/termios.h, 196, TIOCM_RNG
![Page 797: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/797.jpg)
include/termios.h, 193, TIOCM_RTS include/termios.h, 188, TIOCM_SR include/termios.h, 190, TIOCM_ST include/termios.h, 189, TIOCMBICinclude/termios.h, 30, TIOCMBISinclude/termios.h, 29, TIOCMGET include/termios.h, 28, TIOCMSET include/termios.h, 31, TIOCNXCL include/termios.h, 20, TIOCOUTQ include/termios.h, 24, TIOCSCTTY include/termios.h, 21, TIOCSPGRP include/termios.h, 23, TIOCSSOFTCAR include/termios.h, 33, TIOCSTI include/termios.h, 25, TIOCSWINSZ include/termios.h, 27, tm include/time.h, 18, structtmp_floppy_area kernel/blk_drv/floppy.c, 105, tms include/sys/times.h, 6, structtoascii include/ctype.h, 29, tolower include/ctype.h, 31, top kernel/chr_drv/console.c, 73, TOSTOP include/termios.h, 177, toupper include/ctype.h, 32, trackkernel/blk_drv/floppy.c, 118, transfer kernel/blk_drv/floppy.c, 309, trap_init include/sched.h, 34, kernel/traps.c, 181, TRK0_ERR include/hdreg.h, 46, truncatefs/truncate.c, 47,
include/fs.h, 173, try_to_share mm/memory.c, 292, tss_structinclude/sched.h, 51, structTSTPMASKkernel/chr_drv/tty_io.c, 21, TTY_BUF_SIZE include/termios.h, 4, include/tty.h, 14, tty_init include/tty.h, 67, kernel/chr_drv/tty_io.c, 105, tty_intr kernel/chr_drv/tty_io.c, 111, tty_ioctl fs/ioctl.c, 13, kernel/chr_drv/tty_ioctl.c, 115, tty_queue include/tty.h, 16, structtty_read fs/char_dev.c, 16, include/tty.h, 69, kernel/chr_drv/tty_io.c, 230, tty_struct include/tty.h, 45, structtty_table include/tty.h, 55, structkernel/chr_drv/tty_io.c, 51, structtty_write fs/char_dev.c, 17, include/kernel.h, 8, include/sched.h, 36, include/tty.h, 70, kernel/chr_drv/tty_io.c, 290, TYPEkernel/blk_drv/floppy.c, 53, tzsetinclude/time.h, 40, u_char include/sys/types.h, 33, uid_t include/sys/types.h, 24, ulimit include/unistd.h, 238, umask include/sys/stat.h, 56, include/unistd.h, 239, umode_t include/sys/types.h, 29, umount include/unistd.h, 240, un_wp_page mm/memory.c, 221, uname include/sys/utsname.h, 14,
![Page 798: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/798.jpg)
include/unistd.h, 241, unexpected_floppy_interrupt kernel/blk_drv/floppy.c, 353, unexpected_hd_interrupt kernel/blk_drv/hd.c, 237, unlink include/unistd.h, 242, unlock_buffer kernel/blk_drv/ll_rw_blk.c, 51, kernel/blk_drv/blk.h, 101, unlock_inode fs/inode.c, 37, usage tools/build.c, 52, USED mm/memory.c, 47, user_stack kernel/sched.c, 67, ushort include/sys/types.h, 34, ustat include/sys/types.h, 39, structinclude/unistd.h, 243, utimbuf include/utime.h, 6, structutime include/unistd.h, 244, include/utime.h, 11, utsname include/sys/utsname.h, 6, structva_arg include/stdarg.h, 24, va_end include/stdarg.h, 22, include/stdarg.h, 21, va_list include/stdarg.h, 4, va_start include/stdarg.h, 13, include/stdarg.h, 16, VDISCARD include/termios.h, 77, VEOF include/termios.h, 68, VEOL include/termios.h, 75, VEOL2 include/termios.h, 80, VERASE include/termios.h, 66, verify_area include/kernel.h, 4, kernel/fork.c, 24, video_erase_char kernel/chr_drv/console.c, 67, video_mem_end
kernel/chr_drv/console.c, 64, video_mem_start kernel/chr_drv/console.c, 63, video_num_columns kernel/chr_drv/console.c, 59, video_num_lines kernel/chr_drv/console.c, 61, video_page kernel/chr_drv/console.c, 62, video_port_reg kernel/chr_drv/console.c, 65, video_port_val kernel/chr_drv/console.c, 66, video_size_row kernel/chr_drv/console.c, 60, video_type kernel/chr_drv/console.c, 58, VIDEO_TYPE_CGA kernel/chr_drv/console.c, 50, VIDEO_TYPE_EGAC kernel/chr_drv/console.c, 52, VIDEO_TYPE_EGAM kernel/chr_drv/console.c, 51, VIDEO_TYPE_MDA kernel/chr_drv/console.c, 49, VINTR include/termios.h, 64, VKILLinclude/termios.h, 67, VLNEXT include/termios.h, 79, VMIN include/termios.h, 70, VQUIT include/termios.h, 65, VREPRINT include/termios.h, 76, vsprintf init/main.c, 44, kernel/printk.c, 19, kernel/vsprintf.c, 92, VSTART include/termios.h, 72, VSTOP include/termios.h, 73, VSUSP include/termios.h, 74, VSWTC include/termios.h, 71, VT0 include/termios.h, 125, VT1 include/termios.h, 126, VTDLY include/termios.h, 124, VTIME
![Page 799: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/799.jpg)
include/termios.h, 69, VWERASE include/termios.h, 78, W_OK include/unistd.h, 24, waitinclude/sys/wait.h, 20, include/unistd.h, 246, lib/wait.c, 13, wait_for_keypress fs/super.c, 19, kernel/chr_drv/tty_io.c, 140, wait_for_request kernel/blk_drv/ll_rw_blk.c, 26, kernel/blk_drv/blk.h, 52, wait_motor kernel/sched.c, 201, wait_on include/fs.h, 175, wait_on_buffer fs/buffer.c, 36, wait_on_floppy_select kernel/blk_drv/floppy.c, 123, wait_on_inode fs/inode.c, 20, wait_on_super fs/super.c, 48, wait_until_sent kernel/chr_drv/tty_ioctl.c, 46, waitpid include/sys/wait.h, 21, include/unistd.h, 245, wake_up include/sched.h, 147, kernel/sched.c, 188, WAKEUP_CHARS kernel/chr_drv/serial.c, 21, WEXITSTATUS include/sys/wait.h, 15, WIFEXITED include/sys/wait.h, 13, WIFSIGNALED include/sys/wait.h, 18, WIFSTOPPED include/sys/wait.h, 14, WIN_DIAGNOSE include/hdreg.h, 41, WIN_FORMAT include/hdreg.h, 38, WIN_INIT include/hdreg.h, 39, WIN_READ include/hdreg.h, 35, WIN_RESTORE include/hdreg.h, 34, win_result
kernel/blk_drv/hd.c, 169, WIN_SEEK include/hdreg.h, 40, WIN_SPECIFY include/hdreg.h, 42, WIN_VERIFY include/hdreg.h, 37, WIN_WRITE include/hdreg.h, 36, winsizeinclude/termios.h, 36, structWNOHANG include/sys/wait.h, 10, WRERR_STAT include/hdreg.h, 29, writeinclude/unistd.h, 247, WRITEinclude/fs.h, 27, write_inode fs/inode.c, 18, fs/inode.c, 314, write_intr kernel/blk_drv/hd.c, 269, write_pipe fs/read_write.c, 17, fs/pipe.c, 41, write_verify kernel/fork.c, 20, mm/memory.c, 261, WRITEA include/fs.h, 29, WSTOPSIG include/sys/wait.h, 17, WTERMSIG include/sys/wait.h, 16, WUNTRACED include/sys/wait.h, 11, X_OK include/unistd.h, 23, XCASE include/termios.h, 171, XTABS include/termios.h, 120, ykernel/chr_drv/console.c, 72, YEARkernel/mktime.c, 23, Z_MAP_SLOTSinclude/fs.h, 40, ZEROPAD kernel/vsprintf.c, 27, ZMAGICinclude/a.out.h, 27,
![Page 800: Linux plinux - /LQX[oldlinux.org/download/clk011c-2.0.1.pdf · \ )Linux O ý 3+5 µ h(v0.11) G .1 · &F >| B 4ö M ,´# G ú ¼B$ > È X ¯B+657- O X mGÿ. ,´ &L$ µ )Linux](https://reader031.fdocuments.co/reader031/viewer/2022013023/5fcbee1076bfee2c3f64e436/html5/thumbnails/800.jpg)