Linux内核分析


  ZZZROGOLQX[RUJ ZZZSOLQX[RUJ     JRKLJK#JPDLOFRP JRKLJK#VKQHW  =KDR-LRQJ 䎥⛟ ˄5HYLVLRQ˅  ؞↓⡸   /LQX[9HUVLRQ $+HDYLO\&RPPHQWHG/LQX[.HUQHO6RXUFH&RGH 䠀⌞ޞLQX[ ޻Ṯ  ᇂ/ .© 2002 - 2007 䎥⛟ ⡸ᵳᡰᴹ © 2002 - 2007 by Zhao Jiong ᆖ䲒䇑㇇ᵪ㌫˄⊏ᔪភᮉᦸ᭦˅ˈᡆᵪỠ⭥ᆀᐕ〻⹄ウᡰ˄䎥⛟᭦˅˄к⎧ഋᒣ䐟 1239 ਧ,䛞㕆:200092˅DŽ ৽侸ؑ᚟ਟԕ䙊䗷⭥ᆀ䛞Ԧਁ㔉ᡁ˖ gohigh@sh163.net ᡆ gohigh@gmail.comˈҏਟⴤ᧕ᶕؑ㠣˖к⎧਼⍾བྷᆖ ⭥ؑᐕ〻 ҾⴞࡽᵜҖӽ❦༴Ҿнᯝ᭩䘋䱦⇥ˈഐ↔ަѝ㛟ᇊ䘈ᆈ൘аӋ䭉䈟઼н䏣ѻ༴DŽᐼᵋ䈫㘵㜭䐺䏳㔉Ҹᢩ䇴ᤷ↓ᡆ㢟ྭᔪ䇞DŽ 䜘઼䜘࠶ㄐ㢲Ⲵ޵ᇩ,ն䴰㾱⌘᰾ࠪ༴.⭡ޘ⮉ᵜ⭥ᆀҖ㉽Ⲵ؞᭩઼↓ᔿࠪ⡸Ⲵᡰᴹᵳ࡙.䈫㘵ਟԕ㠚⭡Ր᫝ᵜҖ؍֌㘵 ⡸ᵳ䈤᰾ ᔿ㌫㔏Ⲵ৲㘳Җ֯⭘DŽޕⲴ㠚ᆖ৲㘳Җ㉽ˈ䘈ਟ׋а㡜ᢰᵟӪઈ֌Ѫᔰਁ፼ ᵜҖ䘲ਸ֌Ѫ儈ṑ䇑㇇ᵪуъᆖ⭏ᆖҐ᫽֌㌫㔏䈮〻Ⲵ䖵઼ࣙᇎ䐥ᮉᶀˈҏ䘲ਸ Linux ⡡ྭ㘵֌ѪᆖҐ޵Ṩᐕ֌৏⨶ 〻ᒿ൷ਟӾᵜҖ䝽྇㖁ㄉ˄www.oldlinux.org˅кл䖭DŽޣ֯⭘Ⲵ⴨ 㓽ㅹ䜘࠶䙀↕ኅᔰDŽѪҶ࣐␡䈫㘵ሩ޵Ṩᐕ֌৏⨶Ⲵ⨶䀓ˈҖѝᴰਾаㄐ㔉ࠪҶത㔅 Linux 0.11 ㌫㔏Ⲵཊњ䈅傼DŽ䈅傼ѝᡰ 䍴ᯉӻޣԓ⸱⌘䟺Ⲵㄐ㢲ᆹᧂสᵜк䜭࠶Ѫާփ⹄ウሩ䊑Ⲵᾲ䘠ǃ⇿њ᮷ԦⲴ࣏㜭ӻ㓽ǃԓ⸱޵⌘䟺ǃԓ⸱ѝ䳮⛩৺⴨ޣᴹ ᧕⵰ᡁԜ䈖㓶ӻ㓽Ҷ Linux ޵ṨⓀԓ⸱ⴞᖅṁ㓴㓷㔃ᶴˈᒦ׍ᦞ䈕㓴㓷㔃ᶴሩᡰᴹ޵Ṩ〻ᒿ઼᮷Ԧ䘋㹼Ҷ⌘䟺઼䈖㓶䈤᰾DŽ ᣔ⁑ᔿл䘀㹼Ⲵ㕆〻ᯩ⌅DŽ؍⺜Ԧ㓴ᡀ㔃ᶴǃ㕆ࡦ޵Ṩ֯⭘Ⲵ≷㕆䈝䀰઼ C 䈝䀰ᢙኅ䜘࠶ˈᒦф䟽⛩䈤᰾Ҷ 80X86 ༴⨶ಘ൘ ˄0.95˅⡸޵ṨⓀԓ⸱֌Ѫ⹄ウሩ䊑Ⲵ৏ഐDŽ❦ਾ൘↓ᔿᔰ࿻᧿䘠޵ṨⓀԓ⸱ѻࡽˈᾲ㾱ӻ㓽Ҷ䘀㹼 Linux ㌫㔏Ⲵ PC ᵪⲴ ᾲ㾱㘼ᴹ䏓ൠӻ㓽Ҷ Linux ㌫㔏Ⲵਁኅশਢˈ਼ᰦ⵰䟽䈤᰾Ҷ਴њ޵Ṩ⡸ᵜѻ䰤Ⲵѫ㾱४઼࡛᭩䘋ᯩ䶒ˈ㔉ࠪҶ䘹ᤙ 0.11 ն䈕޵Ṩᐢ㜭ཏ↓ᑨ㕆䈁䘀㹼ˈᒦфަѝᐢवᤜҶ LINUX ᐕ֌৏⨶Ⲵ㋮儃DŽҖѝ俆ݸԕ Linux Ⓚԓ⸱⡸ᵜⲴਈ䗱Ѫѫ㓯ˈ 䶒㘼␡࡫Ⲵ⨶䀓ˈѪ䘋а↕ᆖҐ઼⹄ウ Linux ㌫㔏ᢃлඊᇎⲴส⹰DŽ㲭❦ᡰ䘹ᤙⲴ⡸ᵜ䖳վˈޘ䰤޵ሩ Linux Ⲵᐕ֌ᵪ⨶㧧ᗇ 䶒Ⲵ⌘䟺઼䈤᰾ˈᰘ൘䇙䈫㘵㜭ཏ൘ቭ䟿⸝Ⲵᰦޘ䜘ԓ⸱᮷Ԧ䘋㹼Ҷ䈖㓶ޘ˅ᵜҖሩᰙᵏ Linux ᫽֌㌫㔏޵Ṩ˄v0.11 ޵ᇩㆰӻ  Ā57)6&̢5HDG7KH) NLQJ6RXUFH&RGH-ā  ̢/LQXV%HQHGLFW7RUYDOGV  9.7 FLOPPY.C 〻ᒿ................................................... 390 9.6 RAMDISK.C 〻ᒿ................................................ 384 9.5 LL_RW_BLK.C 〻ᒿ ........................................... 378 9.4 HD.C 〻ᒿ.......................................................... 355 9.3 BLK.H ᮷Ԧ........................................................ 351 9.2 MAKEFILE ᮷Ԧ................................................. 349 9.1 ᙫփ࣏㜭.......................................................... 346 ㅜ 9 ㄐ ඇ䇮༷傡ࣘ〻ᒿ(BLOCK DRIVER)......... 345 8.15 ᵜㄐሿ㔃........................................................ 343 8.14 PANIC.C 〻ᒿ ................................................... 342 8.13 PRINTK.C 〻ᒿ................................................. 341 8.12 VSPRINTF.C 〻ᒿ.............................................. 333 8.11 SYS.C 〻ᒿ....................................................... 326 8.10 FORK.C 〻ᒿ.................................................... 318 8.9 EXIT.C 〻ᒿ ....................................................... 311 8.8 SIGNAL.C 〻ᒿ................................................... 300 8.7 SCHED.C 〻ᒿ.................................................... 281 8.6 MKTIME.C 〻ᒿ.................................................. 279 8.5 SYSTEM_CALL.S 〻ᒿ........................................ 267 8.4 TRAPS.C 〻ᒿ..................................................... 262 8.3 ASM.S 〻ᒿ........................................................ 256 8.2 MAKEFILE ᮷Ԧ................................................. 254 8.1 ᙫփ࣏㜭.......................................................... 251 ㅜ 8 ㄐ ޵Ṩԓ⸱(KERNEL)................................... 251 7.3 ᵜㄐሿ㔃.......................................................... 249 7.2 ⧟ຳࡍ࿻ॆᐕ֌.............................................. 247 7.1 MAIN.C 〻ᒿ...................................................... 235 ㅜ 7 ㄐ ࡍ࿻ॆ〻ᒿ(INIT) ....................................... 235 6.5 ᵜㄐሿ㔃.......................................................... 234 6.4 HEAD.S 〻ᒿ...................................................... 221 6.3 SETUP.S 〻ᒿ ..................................................... 203 6.2 BOOTSECT.S 〻ᒿ............................................... 193 6.1 ᙫփ࣏㜭.......................................................... 191 ㅜ 6 ㄐ ᕅሬ੟ࣘ〻ᒿ˄BOOT˅........................... 191 5.13 ᵜㄐሿ㔃........................................................ 189 5.12 LINUX/MAKEFILE ᮷Ԧ.................................... 184 ㌫........................ 184ޣ5.11 ޵Ṩ㌫㔏оᓄ⭘〻ᒿⲴ 5.10 LINUX ޵ṨⓀԓ⸱Ⲵⴞᖅ㔃ᶴ ..................... 177 5.9 LINUX 0.11 䟷⭘Ⲵ᮷Ԧ㌫㔏............................ 176 5.8 LINUX ㌫㔏ѝึḸⲴ֯⭘ᯩ⌅ ....................... 172 5.7 LINUX 䘋〻᧗ࡦ ............................................... 164 5.6 ㌫㔏ᰦ䰤઼ᇊᰦ.............................................. 162 5.5 LINUX Ⲵ㌫㔏䈳⭘ ........................................... 160 5.4 ѝᯝᵪࡦ ......................................................... 157 5.3 LINUX ޵Ṩሩ޵ᆈⲴ㇑⨶઼֯⭘ ................... 144 5.2 LINUX ޵Ṩ㌫㔏փ㌫㔃ᶴ ............................... 142 5.1 LINUX ޵Ṩ⁑ᔿ............................................... 141 ㅜ 5 ㄐ LINUX ޵Ṩփ㌫㔃ᶴ ................................ 141 4.9 ањㆰঅⲴཊԫ࣑޵Ṩᇎֻ.......................... 131 ᣔ⁑ᔿ㕆〻ࡍ࿻ॆ...................................... 128؍ 4.8 4.7 ԫ࣑㇑⨶ ......................................................... 120 4.6 ѝᯝ઼ᔲᑨ༴⨶.............................................. 110 ᣔ ................................................................... 99؍ 4.5 4.4 ࠶亥ᵪࡦ ........................................................... 96 4.3 ࠶⇥ᵪࡦ ........................................................... 85 ᣔ⁑ᔿ޵ᆈ㇑⨶............................................ 81؍ 4.2 4.1 80X86 ㌫㔏ᇴᆈಘ઼㌫㔏ᤷԔ........................ 75 ᣔ⁑ᔿ৺ަ㕆〻 ............................ 75؍ ㅜ 4 ㄐ 80X86 3.6 MAKE 〻ᒿ઼ MAKEFILE ᮷Ԧ........................... 72 3.5 LINUX 0.11 ⴞḷ᮷ԦṬᔿ ................................. 63 3.4 C о≷㕆〻ᒿⲴ⴨ӂ䈳⭘................................. 55 3.3 C 䈝䀰〻ᒿ......................................................... 48 3.2 GNU AS ≷㕆...................................................... 38 3.1 AS86 ≷㕆ಘ ....................................................... 32 ㅜ 3 ㄐ ޵Ṩ㕆〻䈝䀰઼⧟ຳ .................................... 32 2.5 ᵜㄐሿ㔃 ........................................................... 31 2.4 ᧗ࡦಘ઼᧗ࡦ঑................................................ 23 2.3 ѫᆈۘಘǃBIOS ઼ CMOS ᆈۘಘ ................ 21 2.2 I/O ㄟਓራ൰઼䇯䰞᧗ࡦᯩᔿ .......................... 19 2.1 ᗞර䇑㇇ᵪ㓴ᡀ৏⨶........................................ 17 ㅜ 2 ㄐ ᗞර䇑㇇ᵪ㓴ᡀ㔃ᶴ .................................... 17 1.3 ᵜㄐሿ㔃 ........................................................... 16 1.2 ޵ᇩ㔬䘠 ........................................................... 12 1.1 LINUX Ⲵ䈎⭏઼ਁኅ........................................... 5 ㅜ 1 ㄐ ᾲ䘠.................................................................. 5 EXT2 ᮷Ԧ㌫㔏о MINIX ᮷Ԧ㌫㔏......................... 4 ֯⭘ᰙᵏ⡸ᵜᱟ੖䗷ᰦ˛ ........................................ 4 䰵䈫ᵜҖ䴰ާ༷Ⲵส⹰⸕䇶 .................................... 3 ྲօ䘹ᤙ㾱䰵䈫Ⲵ޵Ṩԓ⸱⡸ᵜ ............................ 3 䰵䈫ᆼᮤⓀԓ⸱Ⲵ䟽㾱ᙗ઼ᗵ㾱ᙗ ........................ 2 䰵䈫ᰙᵏ޵ṨⲴަԆྭ༴ ........................................ 2 ⧠ᴹҖ㉽н䏣ѻ༴.................................................... 1 ᵜҖⲴѫ㾱ⴞḷ........................................................ 1 ᒿ䀰................................................................................ 1 ⴞᖅ , ⴞᖅ 17.9 ൘ REDHAT 9 ㌫㔏л㕆䈁 LINUX 0.11 ޵Ṩ.. 835 17.8 ൘ LINUX 0.11 ㌫㔏к㕆䈁 0.11 ޵Ṩ........... 834 17.7 ࡦ֌ṩ᮷Ԧ㌫㔏............................................ 827 ᮷Ԧ........................................ 824ۿ17.6 ࡋᔪ⻱ⴈ᱐ 17.5 ࡙⭘ BOCHS 䈳䈅޵Ṩ................................... 817 17.4 㕆䈁䘀㹼ㆰঅ޵Ṩ⽪ֻ〻ᒿ........................ 815 ᮷ԦѝⲴؑ᚟........................ 813ۿ17.3 䇯䰞⻱ⴈ᱐ 17.2 ൘ BOCHS ѝ䘀㹼 LINUX 0.11 ㌫㔏............... 806 17.1 BOCHS ԯⵏ㌫㔏 ............................................ 802 ㅜ 17 ㄐ ᇎ傼⧟ຳ䇮㖞о֯⭘ᯩ⌅ ........................ 802 16.1 BUILD.C 〻ᒿ................................................... 795 ㅜ 16 ㄐ ᔪ䙐ᐕާ(TOOLS) .................................... 795 15.13 WRITE.C 〻ᒿ ................................................ 792 15.12 WAIT.C 〻ᒿ................................................... 791 15.11 STRING.C 〻ᒿ................................................ 791 15.10 SETSID.C 〻ᒿ................................................ 790 15.9 OPEN.C 〻ᒿ .................................................... 789 15.8 MALLOC.C 〻ᒿ............................................... 780 15.7 EXECVE.C 〻ᒿ................................................ 779 15.6 ERRNO.C 〻ᒿ.................................................. 779 15.5 DUP.C 〻ᒿ ...................................................... 778 15.4 CTYPE.C 〻ᒿ .................................................. 777 15.3 CLOSE.C 〻ᒿ .................................................. 777 15.2 _EXIT.C 〻ᒿ ................................................... 776 15.1 MAKEFILE ᮷Ԧ............................................... 774 ㅜ 15 ㄐ ᓃ᮷Ԧ(LIB)............................................... 773 14.36 WAIT.H ᮷Ԧ................................................... 770 14.35 UTSNAME.H ᮷Ԧ........................................... 769 14.34 TYPES.H ᮷Ԧ................................................. 768 14.33 TIMES.H ᮷Ԧ................................................. 767 14.32 STAT.H ᮷Ԧ ................................................... 766 14.31 INCLUDE/SYS/ⴞᖅѝⲴ᮷Ԧ......................... 766 14.30 TTY.H ᮷Ԧ..................................................... 763 14.29 SYS.H ᮷Ԧ .................................................... 761 14.28 SCHED.H ᮷Ԧ................................................ 754 14.27 MM.H ᮷Ԧ..................................................... 754 14.26 KERNEL.H ᮷Ԧ.............................................. 753 14.25 HEAD.H ᮷Ԧ ................................................. 752 14.24 HDREG.H ᮷Ԧ................................................ 749 14.23 FS.H ᮷Ԧ....................................................... 744 14.22 FDREG.H ཤ᮷Ԧ ............................................ 741 14.21 CONFIG.H ᮷Ԧ............................................... 739 14.20 INCLUDE/LINUX/ⴞᖅлⲴ᮷Ԧ .................... 739 14.19 SYSTEM.H ᮷Ԧ.............................................. 735 14.18 SEGMENT.H ᮷Ԧ............................................ 733 14.17 MEMORY.H ᮷Ԧ............................................. 732 14.16 IO.H ᮷Ԧ....................................................... 731 14.15 INCLUDE/ASM/ⴞᖅлⲴ᮷Ԧ ....................... 731 14.14 UTIME.H ᮷Ԧ ................................................ 729 14.13 UNISTD.H ᮷Ԧ............................................... 724 14.12 TIME.H ᮷Ԧ................................................... 722 14.11 TERMIOS.H ᮷Ԧ ............................................ 715 14.10 STRING.H ᮷Ԧ............................................... 705 14.9 STDDEF.H ᮷Ԧ ................................................ 704 14.8 STDARG.H ᮷Ԧ................................................ 703 14.7 SIGNAL.H ᮷Ԧ ................................................ 701 14.6 FCNTL.H ᮷Ԧ.................................................. 699 14.5 ERRNO.H ᮷Ԧ ................................................. 697 14.4 CTYPE.H ᮷Ԧ.................................................. 695 14.3 CONST.H ᮷Ԧ.................................................. 695 14.2 A.OUT.H ᮷Ԧ................................................... 684 14.1 INCLUDE/ⴞᖅлⲴ᮷Ԧ ................................. 683 ㅜ 14 ㄐ ཤ᮷Ԧ(INCLUDE) ................................... 683 13.4 PAGE.S 〻ᒿ..................................................... 679 13.3 MEMORY.C 〻ᒿ............................................... 662 13.2 MAKEFILE ᮷Ԧ............................................... 661 13.1 ᙫփ࣏㜭 ....................................................... 655 ㅜ 13 ㄐ ޵ᆈ㇑⨶(MM).......................................... 655 12.19 IOCTL.C 〻ᒿ................................................. 652 12.18 FCNTL.C 〻ᒿ ................................................ 649 12.17 STAT.C 〻ᒿ ................................................... 647 12.16 EXEC.C 〻ᒿ.................................................. 627 12.15 OPEN.C 〻ᒿ.................................................. 621 12.14 READ_WRITE.C 〻ᒿ...................................... 615 12.13 CHAR_DEV.C 〻ᒿ ......................................... 612 12.12 PIPE.C 〻ᒿ.................................................... 608 12.11 FILE_DEV.C 〻ᒿ............................................ 605 12.10 BLOCK_DEV.C 〻ᒿ ....................................... 601 12.9 FILE_TABLE.C 〻ᒿ.......................................... 601 12.8 NAMEI.C 〻ᒿ.................................................. 577 12.7 SUPER.C 〻ᒿ .................................................. 567 12.6 INODE.C 〻ᒿ .................................................. 555 12.5 TRUNCTE.C 〻ᒿ.............................................. 553 12.4 BITMAP.C 〻ᒿ................................................. 547 12.3 BUFFER.C 〻ᒿ ................................................ 530 12.2 MAKEFILE ᮷Ԧ............................................... 527 12.1 ᙫփ࣏㜭 ....................................................... 511 ㅜ 12 ㄐ ᮷Ԧ㌫㔏(FS)............................................. 511 11.2 MATH-EMULATION.C 〻ᒿ................................ 509 11.1 MAKEFILE ᮷Ԧ............................................... 507 ㅜ 11 ㄐ ᮠᆖॿ༴⨶ಘ(MATH).............................. 507 10.8 TTY_IOCTL.C 〻ᒿ........................................... 499 10.7 TTY_IO.C 〻ᒿ................................................. 487 10.6 RS_IO.S 〻ᒿ ................................................... 483 10.5 SERIAL.C 〻ᒿ ................................................. 474 10.4 CONSOLE.C 〻ᒿ.............................................. 448 10.3 KEYBOARD.S 〻ᒿ .......................................... 429 10.2 MAKEFILE ᮷Ԧ............................................... 427 10.1 ᙫփ࣏㜭 ....................................................... 417 ㅜ 10 ㄐ ᆇㅖ䇮༷傡ࣘ〻ᒿ(CHAR DRIVER) ..... 417 ,, ⴞᖅ ⴞᖅ ,,, 17.10 ޵Ṩᕅሬ੟ࣘ+ṩ᮷Ԧ㌫㔏㓴ᡀⲴ䳶ᡀⴈ 838 17.11 Ӿ⺜ⴈ੟ࣘ˖࡙⭘ SHOELACE ᕅሬ䖟Ԧ.... 843 17.12 ࡙⭘ GDB ઼ BOCHS 䈳䈅޵ṨⓀԓ⸱ ...... 846 ৲㘳᮷⥞.................................................................... 853 䱴ᖅ............................................................................ 855 䱴ᖅ 1 ޵Ṩᮠᦞ㔃ᶴ............................................ 855 䱴ᖅ 2 ASCII ⸱㺘 ................................................. 863 䱴ᖅ 3 ᑨ⭘ C0ǃC1 ᧗ࡦᆇㅖ㺘......................... 864 䱴ᖅ 4 ᑨ⭘䖜ѹᒿࡇ઼᧗ࡦᒿࡇ........................ 865 䱴ᖅ 5 ㅜ 1 ྇䭞ⴈᢛ᧿⸱䳶................................ 868 ㍒ᕅ ............................................................................ 869 ␡৏⨶ᰦˈ޵ṨⲴᮤփ䘀֌㔃ᶴᒦн㜭␵Რൠ൘㝁⎧ѝᖒᡀDŽ䘉൘ᵜӪཊᒤⲴ Linux ޵ṨᆖҐ䗷〻ѝҏ Ⲵᮤփᾲᘥˈቔަᱟሩ䛓Ӌ Linux ㌫㔏ࡍᆖ㘵ᡆࡊᆖՊྲօ֯⭘ Linux ㌫㔏ⲴӪ൘֯⭘䛓ӋҖᆖҐ޵Ṩ ൘֯⭘䘉ӋҖ㉽䘋㹼ᆖҐᰦՊᴹа⿽ĀⴢӪ᪨䊑āⲴᝏ㿹ˈн㜭ⵏ↓⨶䀓 Linux ޵Ṩ㌫㔏ާփᇎ⧠ ᆖҐ䈕Җѻਾˈᒦн㜭ᖸ亪࡙ൠণ࡫⵰᡻䘋а↕ᆖҐ䖳ᯠⲴ Linux ޵ṨⓀԓ⸱ᇎ⧠DŽ 䈕Җᡰਉ䘠Ⲵ MINIX ㌫㔏ᱟа⿽สҾ⎸᚟Ր䙂Ⲵ޵Ṩᇎ⧠ᵪࡦˈо Linux ޵ṨⲴᇎ⧠ᴹᡰ४࡛DŽഐ↔൘ 䰘Җ㉽ˈնޕ᫽֌㌫㔏޵Ṩᇎ⧠ᖸྭⲴޣ A.S.Tanenbaum ⲴҖlj᫽֌㌫㔏˖䇮䇑оᇎ⧠NJᱟаᵜᴹ ⲴⓀԓ⸱ᰦቡՊ䙷ࡠ䖳བྷⲴഠ䳮DŽޣⲴ≷㕆䈝䀰㕆ࡦⲴˈഐ↔൘䰵䈫઼⨶䀓о⺜Ԧ䜘࠶⴨ ྭⲴҖ㉽ˈնᱟ⭡Ҿަ䟷⭘Ⲵᱟ UNIX V6 ⡸ˈަѝ㌫㔏䈳⭘ㅹ䜘࠶ԓ⸱ᱟ⭘ᰙᐢᓏᔳⲴ PDP-11 ㌫ࡇᵪ John Lions 㪇Ⲵlj㧡ᰲ∿ UNIX Ⓚԓ⸱࠶᷀NJаҖ㲭❦ᱟаᵜᆖҐ UNIX ㊫᫽֌㌫㔏޵ṨⓀԓ⸱ᖸ ᮠӪ䜭᭮ᔳҶDŽ ࣍䈤ᆖ⭏䍝ѻ䰵䈫ˈ㘼൘Ҽњᴸਾ䈳ḕ䰵䈫ᆖҐᛵߥᰦˈสᵜ䜭ᆈ൘ⴻнл৫ᡆн㜭⨶䀓ㅹ䰞仈ˈབྷཊ ⸱ˈҏн㜭ⵏ↓ਲ਼䘿޵ṨⲴᇎ䱵ᇎ⧠ᯩᔿˈഐ㘼ᖰᖰࡊᔰ࿻䰵䈫ቡ᭮ᔳҶDŽ䈕Җࡊ䶒ᐲᰦˈᵜӪᴮᶱ࣋ 䖳儈 Linux ㌫㔏ᓄ⭘≤ᒣⲴ䇑㇇ᵪᵜ、儈ᒤ㓗ᆖ⭏ˈ⭡Ҿ䈕Җㇷᑵ䰞仈ԕ৺ӵӵ䘹ᤙᙗൠ䇢䀓޵ṨⓀԓ ⎉⊏བྷᆖࠪ⡸ⲴljLinux ޵ṨⓀԓ⸱ᛵᲟ࠶᷀NJаҖˈҏสᵜᴹ䘉Ӌн䏣ѻ༴DŽ⭊㠣ሩҾаӋާᴹ 䈤䰵䈫䈕ҖᴹӋഠ䳮DŽ ᮷ԦⲴᐕާ〻ᒿǃ਴њ make ᮷ԦⲴ֌⭘઼ᇎ⧠ㅹ൷⋑ᴹ⎹৺DŽഐ↔ሩҾ༴Ҿࡍѝ㓗≤ᒣѻ䰤Ⲵ䈫㘵ᶕ ۿԓ⸱䘋㹼⌘䟺ˈ⮕৫Ҷᖸཊ޵Ṩᇎ⧠㓶㢲ˈֻྲަѝ޵Ṩѝ֯⭘Ⲵ਴њཤ᮷Ԧ(*.h)ǃ⭏ᡀ޵Ṩԓ⸱᱐ 䀓DŽ㘼фਟ㜭ᱟ⭡Ҿㇷᑵᡰ䲀ˈ䈕Җᒦ⋑ᴹሩᡰᴹ Linux ޵Ṩ⨶ޘ䶒Ⲵส⹰⸕䇶᡽㜭ᆼޘ㘵ˈ䴰㾱䖳Ѫ Scott Maxwell 㪇ⲴаҖljLinux ޵ṨⓀԓ⸱࠶᷀NJ˄䱶ѭ၌ㅹ䈁˅สᵜкᱟ䶒ሩ Linux ѝ㓗≤ᒣⲴ䈫 ᙗൠ䈤᰾ˈ䇨ཊ㌫㔏ᇎ⧠㓶㢲㻛ᘭ⮕DŽഐ↔ᒦн㜭㔉Ҹ䈫㘵ሩᇎ䱵 Linux ޵Ṩᴹ␵Რ㘼ᆼᮤⲴ⨶䀓DŽ ˄ֻྲ 2.2.20 ⡸ቡᐢާᴹ 268 з㹼ԓ⸱ʽ˅ˈഐ↔䘉ӋҖ㉽ӵ㜭ሩ Linux ޵ṨⓀԓ⸱䘋㹼䘹ᤙᙗൠᡆ৏⨶ Fedora Core 4 ֯⭘ 2.6.11 っᇊ⡸ㅹ˅䘋㹼᧿䘠ˈն⭡Ҿⴞࡽ Linux ޵ṨᮤњⓀԓ⸱Ⲵབྷሿᐢ㓿䶎ᑨᗇབྷ ⴞࡽᐢᴹⲴ᧿䘠 Linux ޵ṨⲴҖ㉽ˈ൷ቭ䟿䘹⭘ᴰᯠ Linux ޵Ṩ⡸ᵜ˄ֻྲ Redhat 7.0 ֯⭘ 2.2.16ǃ ⧦ᴿҜ㊃у䏩ҁ༺ ྭ㘵ѝᡰঐⲴ∄ֻᱟᖸ儈Ⲵˈ㘼䶒ੁ䘉䜘࠶䈫㘵ԕ∄䖳᱃៲઼ᴹ᭸Ⲵ᡻⇥䇢䀓޵ṨⲴҖ㉽䍴ᯉнཊDŽ ⸱ᇎ⧠Ⲵ⡡ྭ㘵DŽ䘉䜘࠶䈫㘵Ⲵ≤ᒣᓄ䈕⭼Ҿࡍ㓗оѝ㓗≤ᒣѻ䰤DŽⴞࡽˈ䘉䜘࠶䈫㘵Ӫᮠ൘ Linux ⡡ ⴞࡽᴰᯠ޵ṨⓀԓ⸱Ⲵส⹰⸕䇶ˈ৸ᙕ࠷ᐼᵋ㜭ཏ䘋а↕⨶䀓 UNIX ㊫᫽֌㌫㔏޵Ṩᐕ֌৏⨶઼ᇎ䱵ԓ ᵜҖ䈫㘵㗔ⲴᇊսᱟаӋ⸕ᲃ Linux ㌫㔏Ⲵа㡜֯⭘ᯩ⌅ᡆާᴹаᇊⲴ㕆〻ส⹰ˈն∄䖳㕪ѿ䰵䈫 䰘DŽޕ䀓ˈሩ linux ᫽֌㌫㔏Ⲵสᵜᐕ֌৏⨶ⵏ↓⨶䀓઼ ࡠሩ linux ޵Ṩᴹањᆼᮤ㘼␡࡫Ⲵ⨶ڊᯩսⲴ⨶䀓DŽޘᵏሩ᫽֌㌫㔏Ⲵสᵜ࣏㜭઼ᇎ䱵ᇎ⧠ᯩᔿ㧧ᗇ ᵜҖⲴѫ㾱ⴞḷᱟ֯⭘ቭ䟿ቁⲴㇷᑵᡆ൘ᴹ䲀Ⲵㇷᑵ޵ˈሩᆼᮤⲴ Linux ޵ṨⓀԓ⸱䘋㹼䀓ࢆˈԕ ᵢҜⲺѱ㾷ⴤḽ 䰘䈫⢙DŽޕLinux ᫽֌㌫㔏޵Ṩสᵜᐕ֌৏⨶Ⲵ ޣᵜҖᱟаᵜᴹ ᒿ䀰  ᒿ䀰 ROGOLQX[RUJ/LQXV৏᮷ਟ৲㿱˖KWWS ᘭ⮕ I/Oˈަᇎˈࡽ㘵䙊ᑨн䏣а亥ԓ⸱ˈ㘼ਾ㘵ᖰᖰ㾱ঐࡠᮤњޘᓖ㇇⌅㙇䍩བྷ䟿Ⲵᰦ䰤઼ㇷᑵ㘼ᆼ 䀓ӽнᱟᖸ␵ᲠDŽ↓ྲ AST ᡰ䈤ⲴˈĀ䇨ཊ᫽֌㌫㔏ᮉᶀ䜭ᱟ䟽⨶䇪㘼䖫ᇎ䐥āˈĀཊᮠҖ㉽઼䈮〻Ѫ䈳 ㌫ᇎ⧠Ⲵ⨶ޣ㊫᫽֌㌫㔏Ⲵᐕ֌৏⨶ᴹаӋ⨶䇪кⲴᤷሬ֌⭘ˈնᇎ䱵кሩ᫽֌㌫㔏Ⲵⵏ↓㓴ᡀ઼޵䜘 㲭❦䙊䗷䰵䈫аӋ᫽֌㌫㔏৏⨶㓿ިҖ㉽˄ֻྲ M.J.Bach ⲴljUNIX ᫽֌㌫㔏䇮䇑NJ˅㜭ཏሩ UNIX 䱵㌫㔏Ⲵᇎ⧠ᯩ⌅઼᡻⇥DŽ н䟽㾱Ⲵ㓶㢲ᆈ൘ˈնᱟ㤕ᘭ⮕䘉Ӌ㓶㢲ˈቡՊሩᮤњ㌫㔏Ⲵ⨶䀓ᑖᶕഠ䳮ˈᒦфн㜭ⵏ↓Ҷ䀓ањᇎ 㾱䰵䈫ަⓀԓ⸱˄RTFSC – Read The Fucking Source Code˅DŽ㌫㔏ᵜ䓛ᱟањᆼᮤⲴᮤփˈާᴹᖸཊⴻլ ↓ྲ Linux ㌫㔏Ⲵࡋ࿻Ӫ൘аㇷᯠ䰫㓴ᣅはкᡰ䈤Ⲵˈ㾱⨶䀓ањ䖟Ԧ㌫㔏Ⲵⵏ↓䘀㹼ᵪࡦˈаᇊ 䰻䈱ᇂ᮪Ⓠԙ⸷Ⲻ䠃㾷ᙝૂᗻ㾷ᙝ ѻаDŽ䙊䗷ᆖҐᵜҖˈਟԕѪ䘋а↕ᆖҐ䘉Ӌ儈㓗޵ᇩᢃл᡾ᇎⲴส⹰DŽ 䰘ᮉᶀˈഐ↔䘉ҏ↓ᱟ䘹ᤙᰙᵏ޵Ṩ⡸ᵜⲴՈ⛩ޕ䈤᰾DŽն⭡ҾᵜҖᱟ֌Ѫ Linux ޵Ṩᐕ֌ᵪ⨶ᇎ⧠Ⲵ Ԧ㌫㔏 VFS Ⲵ᭟ᤱǃሩ㖁㔌㌫㔏Ⲵ᭟ᤱǃӵ᭟ᤱ a.out ᢗ㹼᮷Ԧ઼ሩަԆаӋ⧠ᴹ޵Ṩѝ༽ᵲᆀ㌫㔏Ⲵ ᖃ❦ˈ֯⭘ᰙᵏ޵Ṩ֌ѪᆖҐⲴሩ䊑ҏᴹн䏣ѻ༴DŽᡰ䘹⭘Ⲵ Linux ᰙᵏ޵Ṩ⡸ᵜнवਜ਼ሩ㲊ᤏ᮷ ⭏а⿽オѝᾬ䰱Ⲵᝏ㿹ˈഐ↔ҏᴹᗵ㾱䰵䈫޵ṨⓀԓ⸱DŽ ሩҾ䛓Ӌᐢ㓿∄䖳⟏ᚹ޵Ṩᐕ֌৏⨶ⲴӪˈѪҶ㜭䇙㠚ᐡ൘ᇎ䱵ᐕ֌ѝሩ㌫㔏Ⲵᇎ䱵䘀䖜ᵪࡦнӗ ṨⲴสᵜᐕ֌৏⨶DŽ 䀓 Linux ޵⨶ޕ␡䰘㘵ᶕ䈤ˈᱟᴰ⨶ᜣⲴ䘹ᤙѻаDŽ㜭ཏ൘ቭਟ㜭⸝Ⲵᰦ䰤޵ޕ䘉ሩ Linux ޵ṨᆖҐⲴ ᙗˈ৸㜭䘿ᖫൠ䈤᰾䰞仈DŽ䘉䟼䘹ᤙ Linux Ⲵᰙᵏ޵Ṩ⡸ᵜ֌ѪᆖҐሩ䊑ˈަᤷሬᙍᜣо Leland Ⲵа㠤DŽ অᤷԔ䇑㇇ᵪ(SIC)㌫㔏ᶕ䈤᰾ᡰᴹ㌫㔏〻ᒿⲴ䇮䇑઼ᇎ⧠৏⨶ˈӾ㘼ᰒ䚯ݽҶᇎ䱵䇑㇇ᵪ㌫㔏Ⲵ༽ᵲ Ҷа⿽ᶱަㆰॆⲴㆰޕ㕆〻ሬ䇪NJаҖⲴ֌㘵 Leland L. Beck ൘ӻ㓽㌫㔏〻ᒿԕ৺᫽֌㌫㔏䇮䇑ᰦˈᕅ ањ㋮ㆰ⡸ᵜDŽަѝᐢ㓿वᤜҶⴞࡽᯠ⡸ᵜѝࠐѾᡰᴹⲴสᵜ࣏㜭৏⨶Ⲵ޵ᇩDŽ↓ྲlj㌫㔏䖟Ԧ˖㌫㔏 ൘ሩᰙᵏ޵ṨⓀԓ⸱Ⲵ⌘䟺䗷〻ѝˈ֌㘵ਁ⧠ˈᰙᵏ޵ṨⓀԓ⸱ࠐѾቡᱟⴞࡽᡰ֯⭘Ⲵ䖳ᯠ޵ṨⲴ ᔿ㌫㔏ҏᴹᖸབྷⲴᑞࣙDŽ ޕᰙᵏ޵Ṩ⡸ᵜⲴⓀԓ⸱ˈⲴ⺞ᱟᆖҐ Linux ㌫㔏Ⲵа⿽㹼ѻᴹ᭸Ⲵ䙄ᖴˈᒦфሩ⹄ウ઼ᓄ⭘ Linux ፼ Ⓚԓ⸱ᆖҐⲴྭ༴ˈⴞࡽഭ޵ҏᐢ㓿ᴹӪ↓൘㓴㓷Ӫ࣋⌘䟺ࠪ⡸㊫լᵜ᮷ⲴҖ㉽DŽഐ↔ˈ䙊䗷䰵䈫 Linux ᫽֌㌫㔏ǃUclinux ㅹ˄൘ www.linux.org кᴹу䰘ⴞᖅ˅ˈц⭼кҏᴹ䇨ཊӪ䇔䇶ࡠ䙊䗷ᰙᵏ Linux ޵Ṩ ᔿ㌫㔏Ⲵ޵Ṩ⡸ᵜˈྲ DJJ Ⲵ x86ޕⴞࡽˈᐢ㓿ࠪ⧠нቁสҾ Linux ᰙᵏ޵Ṩ㘼ᔰਁⲴу䰘⭘Ҿ፼ 䰻䈱ᰟᵕ޻ṮⲺެԌླ༺ 䰘DŽޕṨᴹањᆼᮤ㘼␡࡫Ⲵ⨶䀓ˈሩ Linux ᫽֌㌫㔏Ⲵสᵜᐕ֌৏⨶ⵏ↓⨶䀓઼ ࡠሩ Linux ޵ڊᯩսⲴ⨶䀓DŽޘ䶒䀓ࢆˈԕᵏሩ᫽֌㌫㔏Ⲵสᵜ࣏㜭઼ᇎ䱵ᇎ⧠ᯩᔿ㧧ᗇޘⓀԓ⸱䘋㹼 ѪҶປ㺕䘉њオ㕪ˈᵜҖⲴѫ㾱ⴞḷᱟ֯⭘ቭ䟿ቁⲴㇷᑵᡆ൘ᴹ䲀Ⲵㇷᑵ޵ˈሩᆼᮤⲴ Linux ޵Ṩ Linux ᰙᵏ޵Ṩ⡸ᵜ߉֌ᵜҖⲴࣘᵪѻаDŽ 䰘ᆖҐ䎧⛩DŽ䘉ҏᱟ֌㘵สҾޕ㌫㔏ᴤѪᓎབྷ઼༽ᵲˈഐ↔਼ṧҏᐢ㓿н䘲ਸ֌Ѫ᫽֌㌫㔏ࡍᆖ㘵Ⲵ ᷌ᔰਁࠪᶕቡᐢ㓿ᱮᗇཚᓎབྷ㘼н䘲ਸᆖҐ઼⨶䀓DŽ”㘼⧠Ӻ⍱㹼Ⲵ Linux ㌫㔏㾱∄ᖃᒤ GNU Ⲵ Hurd 䛓Ӌ᫽֌㌫㔏⡡ྭ㘵઼䇑㇇ᵪ、ᆖ㌫Ⲵᆖ⭏֯⭘ǃᆖҐ઼ၡҀāDŽĀ㠚⭡䖟Ԧส䠁ՊⲴ GNU Hurd ㌫㔏ྲ ᨀࡠҶ਼ṧⲴ䰞仈DŽ൘䘉ㇷ仈ѪĀLINUX--a free unix-386 kernelā1Ⲵ᮷ㄐѝˈԆ䈤˖Āᔰਁ Linux ᱟѪҶ ᴹփՊDŽ൘ 1991 ᒤ 10 ᴸԭˈLinux Ⲵࡋ࿻Ӫ Linus Torvalds ൘ᔰਁࠪ Linux 0.03 ⡸ਾ߉Ⲵаㇷ᮷ㄐѝҏ  ᒿ䀰 ᔿ≷㕆Ⲵᵳေؑ᚟䜭वਜ਼൘ GNU gcc 㕆䈁ಘ᡻޼ѝDŽᡁԜҏਟԕӾ Internetޕ፼ޣ≷㕆䈝䀰Ⲵ䍴ᯉDŽᴹ ᔿޕⲴ≷㕆䈝䀰ᮉᶀDŽਖཆ䘈䴰㾱аӋ፼ޣ㘼≷㕆䈝䀰Ⲵ䍴ᯉࡉਟԕ৲㘳ԫ᜿аᵜ䇢䀓о Intel CPU ⴨ Ⲵ৲㘳䍴ᯉӽ❦ᱟ Brain W. Kernighan ઼ Dennis M. Ritchie 㕆߉ⲴljThe C Programming LanguageNJа Җ DŽ C 䈝䀰ᴰ֣ ޣ൘䰵䈫ᵜҖᰦˈ䈫㘵ᗵ享ާ༷аӋสᵜⲴ C 䈝䀰⸕䇶઼ Intel CPU ≷㕆䈝䀰⸕䇶DŽᴹ 䰻䈱ᵢҜ䴶ޭ༽Ⲻะ⹶⸛䇼 㲊ᤏ᮷Ԧ㌫㔏 VFSǃext2 ᡆ ext3 ᮷Ԧ㌫㔏ǃ㖁㔌ᆀ㌫㔏ǃᯠⲴ༽ᵲⲴ޵ᆈ㇑⨶ᵪࡦㅹ˅DŽ ਖཆˈ֯⭘䈕⡸ᵜਟԕ䚯ݽ֯⭘⧠ᴹ䖳ᯠ޵Ṩ⡸ᵜѝᐢ㓿ਈᗇ䎺ᶕ䎺༽ᵲᗇ਴ᆀ㌫㔏䜘࠶Ⲵ⹄ウ˄ྲ аӋㆰঅⲴᔰਁᐕ֌DŽڊ㕆䈁⧟ຳˈഐ↔֯⭘䈕㌫㔏ҏ㜭 ࣐␡ሩ৏⨶Ⲵ⨶䀓ˈ֌㘵䘈у䰘䟽ᔪҶสҾ䈕޵ṨⲴਟ䘀㹼Ⲵ Linux 0.11 ㌫㔏DŽ⭡Ҿަѝਜ਼ᴹ GNU gcc DŽѪҶሩᡰ⹄ウⲴ㌫㔏ᴹᝏᙗⲴҶ䀓ˈᒦ㜭࡙⭘ᇎ傼ᶕޘءаᵜҖѝ䀓䟺઼⌘䟺␵ᾊDŽ哫䳰㲭ሿˈӄ㜿 ਟԕ൘ޘ䟺઼䈤᰾ࠐѾᱟнਟ㜭ⲴDŽ㘼 0.11 ⡸޵Ṩн䎵䗷 2 з㹼ԓ⸱䟿ˈഐ↔ᆼ⌘ޘሩ䘉Ӌ⡸ᵜ䘋㹼ᆼ ⴞࡽⲴ Linux ޵ṨⓀԓ⸱䟿䜭൘ࠐⲮз㹼Ⲵᮠ䟿кˈ2.6.0 ⡸޵Ṩԓ⸱㹼ᮠ㓖Ѫ 592 з㹼ˈᶱަᓎབྷˈ з㹼অս 㹼ᮠ ޵Ṩ⡸ᵜਧ  9 9 9 9 9 9 9 9 9 9D 9 99 9 9 9     /LQX[޵Ṩ਴⡸ᵜⓀԓ⸱㹼ᮠ ޵Ṩ⡸ᵜ㹼ᮠⲴ㔏䇑DŽ 䰘ᆖҐⲴᴰ֣⡸ᵜDŽлമᱟሩаӋѫ㾱 Linuxޕ޵Ṩสᵜ࣏㜭䖳Ѫ⴨䘁ˈ৸䶎ᑨ⸝ሿⲴ 0.11 ⡸޵Ṩ֌Ѫ ᵜ䘋㹼ᆖҐˈᨀ儈ᆖҐⲴ᭸⦷઒˛֌㘵䙊䗷ሩབྷ䟿޵Ṩ⡸ᵜ䘋㹼∄䖳઼䘹ᤙਾˈᴰ㓸䘹ᤙҶоⴞࡽ Linux 䛓Ѹˈྲօ䘹ᤙᰒ㜭䗮ࡠк䘠㾱≲ˈ৸н㻛ཚཊⲴ޵ᇩ㘼ᩎҡཤ㝁ˈ䘹ᤙањ䘲ਸⲴ Linux ޵Ṩ⡸ ྸ֋䘿᤟㾷䰻䈱Ⲻ޻Ṯԙ⸷⡾ᵢ 仈ˈสᵜк䜭㜭亪࡙ൠ⨶䀓ᯠԓ⸱Ⲵ޵ᇩDŽ ᮤњ㌫㔏Ⲵ䘀֌䗷〻ᴹ␡࡫Ⲵ⨶䀓DŽԕਾ޽䘹ᤙᴰᯠⲴᡆ䖳ᯠ޵ṨⓀԓ⸱䘋㹼ᆖҐᰦˈҏнՊ⻠ࡠབྷ䰞 㔏ᇎ⧠Ⲵྕ࿉ᡰ൘DŽਚᴹ൘䈖㓶䰵䈫䗷ᆼᮤⲴ޵ṨⓀԓ⸱ѻਾˈ᡽Պሩ㌫㔏ᴹа⿽䉱❦ᔰᵇⲴᝏ㿹ˈሩ ㌫㔏й࠶ѻаⲴԓ⸱ᙫ䟿DŽā޵Ṩѝབྷ䟿Ⲵ䟽㾱㓶㢲൷ᵚᨀࡠDŽഐ↔ᒦн㜭䇙䈫㘵⨶䀓ањⵏ↓Ⲵ᫽֌㌫  ᒿ䀰 . 2007.6 䎥⛟ ঊ༛ ਼⍾བྷᆖ ↔ᰦˈᛘᓄ䈕ᴹॱ࠶Ⲵᢺᨑ৫䘋а↕ᆖҐᴰᯠ Linux ޵Ṩѝ਴䜘࠶Ⲵᐕ֌৏⨶઼䗷〻ҶDŽ 䰘ҶʽāDŽޕ൘ᆼᮤ䰵䈫ᆼᵜҖѻਾˈ⴨ؑᛘᇊՊਁࠪ䘉ṧⲴᝏ਩˖ĀሩҾ Linux ޵Ṩ㌫㔏ˈᡁ⧠൘㓸Ҿ 㔏Ⲵᇎ䱵㓴ᡀ઼ᐕ֌৏⨶ᐢ㓿䏣ཏDŽ䘉ҏᱟ䘹ᤙ Linux ᰙᵏ޵Ṩ⡸ᵜ䘋㹼ᆖҐⲴѫ㾱৏ഐѻаDŽ Linux ޵Ṩ 0.11 ⡸кᖃᰦӵवਜ਼ᴰѪㆰঅⲴ MINIX 1.0 ᮷Ԧ㌫㔏ˈሩҾ⨶䀓ањ᫽֌㌫㔏ѝ᮷Ԧ㌫ ㌫㔏Ⲵ䜘࠶ԓ⸱޵ᇩ㜭䈤᰾ᇎ䱵ᐕ֌৏⨶ˈቡ䎺ㆰঅ䎺ྭDŽ 䀓ˈᒦф㜭н㻛ަѝ਴ᆀ㌫㔏ѝ༽ᵲ઼䗷ཊⲴ㓶㢲ᡰௗᇮཪѫˈ൘䘹ᤙᆖҐࢆ᷀⭘Ⲵ޵Ṩ⡸ᵜᰦˈਚ㾱 䰘ᆖҐᡰ֯⭘Ⲵ䜘࠶ˈ৏ࡉкᱟ䎺㋮ㆰ䎺ྭDŽѪҶ䗮ࡠሩањ᫽֌㌫㔏ᴹᆼᮤⲴ⨶ޕ⨶㌫㔏ᆼᮤᐕ֌৏ ᒦфᙗ㜭ҏ䶎ᑨᆼᮤ઼っപˈᱟⴞࡽ Linux ᫽֌㌫㔏к唈䇔Ⲵḷ߶᮷Ԧ㌫㔏DŽնᱟˈ֌Ѫሩ Linux ᫽֌ ⴞࡽ Linux ㌫㔏кᡰ֯⭘Ⲵ Ext2˄ᡆᴰᯠⲴ Ext3˅᮷Ԧ㌫㔏ᱟ൘޵Ṩ 1.x ѻਾᔰਁⲴDŽަ࣏㜭䈖ቭ Ext2 ᮽԬ㌱㔕ф MINIX ᮽԬ㌱㔕 䜘࠶ˈ㘼н䴰㾱޽৫୳䈫ԓ⸱䟿ᐘབྷⲴᯠ޵ṨѝᆼᮤⲴⓀԓ⸱DŽ ᴹањ䶎ᑨᆼᮤ㘼ᇎ䱵Ⲵᾲᘥˈ䘉⿽ᆼᮤᾲᘥ㜭֯Ӫᖸᇩ᱃ൠ䘋а↕䘹ᤙ઼ᆖҐᯠ޵ṨⓀԓ⸱ѝⲴԫօ 㔗㔝䘋а↕䘹ᤙᯠ޵Ṩ䜘࠶Ⓚԓ⸱ⲴᆖҐᢃлඊᇎⲴส⹰DŽ൘ᆖҐᆼᵜҖѻਾˈ֐ሶሩ㌫㔏Ⲵ䘀֌৏⨶ 䰘DŽᒦфሩޕࡠһॺ࣏ؽˈᘛ䙏ڊṨˈ⭡Ҿ޵ṨⓀԓ⸱䟿⸝ሿ㘼㋮ᒢˈഐ↔Պᴹᶱ儈ⲴᆖҐ᭸⦷ˈ㜭ཏ ᐢ㓿䗷ᰦⲴ˄Linux is obsolete˅ᜣ⌅аṧˈն䙊䗷ᆖҐᵜҖ޵ᇩˈ֐ቡՊਁ⧠ˈ࡙⭘ᵜҖᆖҐ Linux ޵ ᐳᰦ Tanenbaum ቡ䇔Ѫަޜ㺘䶒ⴻᶕᵜҖሩ Linux ᰙᵏ޵Ṩ⡸ᵜ⌘䟺Ⲵ޵ᇩ⣩ྲ Linux ᫽֌㌫㔏ࡊ ֵ⭞ᰟᵕ⡾ᵢᱥੜ䗽ᰬϋ ㌫㔏ᇎ⧠Ⲵ޵ᇩDŽ а㡜᫽֌㌫㔏ᐕ֌৏⨶ㄐ㢲઼᮷ԦޣӔᦒ˅ˈ䘉 о Linux ޵ṨⲴᐕ֌ᵪࡦнаṧDŽഐ↔ਟԕӵ৲㘳ަѝᴹ ާᴹ䖳བྷⲴ৲㘳ԧ٬DŽն Tanenbaum ⲴҖ᧿䘠Ⲵᱟа⿽สҾ⎸᚟Ր䙂൘޵Ṩ਴⁑ඇѻ䰤䘋㹼䙊ؑ˄ؑ᚟ ➗ᩜҶ MINIX 1.0 ᮷Ԧ㌫㔏DŽഐ↔ˈ൘䰵䈫ᵜҖᰦˈA.S.Tanenbaum ⲴҖlj᫽֌㌫㔏˖䇮䇑оᇎ⧠NJҏ ޘ Linus ൘ᴰࡍᔰਁ Linux ᫽֌㌫㔏ᰦˈ৲➗Ҷ MINIX ᫽֌㌫㔏DŽֻྲˈᴰࡍⲴ Linux ޵Ṩ⡸ᵜᆼ 䀓޵ṨⓀԓ⸱DŽ ਁⲴˈⓀԓ⸱ѝ䇨ཊਈ䟿ᡆ࠭ᮠⲴ਽〠䜭ᶕ㠚䈕Җˈഐ↔൘䰵䈫ᵜҖᰦ㤕㜭䘲ᖃ৲㘳䈕ҖˈՊᴤ᱃Ҿ⨶ ਖཆˈ⭡Ҿ Linux ㌫㔏޵Ṩᇎ⧠ᴰᰙᱟṩᦞ M.J.Bach ⲴljUNIX ᫽֌㌫㔏䇮䇑NJаҖⲴสᵜ৏⨶ᔰ ަй䘈ᓄާ༷ࡍ㓗֯⭘ Linux ㌫㔏Ⲵㆰঅᢰ㜭DŽ 䘉ᯩ䶒Ⲵ䍴ᯉᖸཊ˗ޣ80x86 ⺜Ԧփ㌫㔃ᶴ઼᧕ਓ㕆〻Ⲵ⸕䇶ᡆ䍴ᯉDŽᴹ ޣReference Manual˅˗ަҼᱟᴹ ⨶ಘ㔃ᶴ઼㕆〻Ⲵ⸕䇶ᡆ䍴ᯉDŽֻྲਟԕӾ㖁кл䖭Ⲵ 80x86 㕆〻᡻޼˄INTEL 80386 Programmer's 80x86 ༴ ޣⲴ৲㘳Җ㉽൘䓛䗩DŽަаᱟᴹޣ䲔↔ѻཆˈ䘈ᐼᵋ䈫㘵ާ༷ԕлаӋส⹰⸕䇶ᡆ㘵ᴹ⴨ 5.5 㢲〻ᒿࡇ㺘ਾ˅DŽ 㕆สᵜⲴ䈝⌅䈤᰾˄ㅜ≶ޕᔿ≷㕆∄䖳ᴹԧ٬Ⲵ⸝᮷DŽᵜҖѝҏवਜ਼ҶаӋ፼ޕ፼ޣ㖁кᩌ㍒ࡠаӋᴹ  ᒿ䀰 ᴹєњ⡸ᵜ൘֯⭘˖1.5 ⡸઼ 2.0 ⡸DŽᖃᰦ䈕᫽֌㌫㔏൘བྷᆖ֯⭘ᱟݽ䍩ⲴˈնަԆ⭘䙄ࡉнᱟDŽᖃ❦ⴞ MINIX ᱟԆ 1987 ᒤ㕆ࡦⲴˈѫ㾱⭘Ҿᆖ⭏ᆖҐ᫽֌㌫㔏৏⨶DŽࡠ 1991 ᒤᰦ⡸ᵜᱟ 1.5DŽⴞࡽѫ㾱 ෾ᐲˈնሩҾ AST ᶕ䈤ˈ䘉ᴰྭн䗷ҶˈഐѪ൘䘉ṧⲴ⧟ຳлԆቡਟԕ㓿ᑨᖵ൘ᇦѝ᩶ᔴԆⲴ䇑㇇ᵪҶDŽ 俆䜭 Amsterdam ᱟњᑨᒤ䱤䴘㔥㔥ⲴޠᇦґаⴤᴹᶕᖰDŽਾᶕቡ൘ Vrije བྷᆖᔰ࿻ᮉҖǃᑖ⹄ウ⭏DŽ㦧 DŽӾ↔ቡоޠкⲴབྷᆖǃ࣐⍢བྷᆖ Berkeley ࠶ṑᘥⲴঊ༛ᆖսDŽ⭡Ҿ䈫ঊ༛ਾⲴ㕈᭵ˈԆᶕࡠҶᇦґ㦧 ᒤԆⲴ⾆䖸ᶕࡠ㖾ഭ)DŽԆ൘㓭㓖кⲴѝᆖǃM.I.T 1914)≁טޠ AST 㲭ࠪ⭏൘㖾ഭ㓭㓖ˈնতᱟ㦧 Ҷ 100 ཊㇷ᮷ㄐˈ5 ᵜ䇑㇇ᵪҖ㉽DŽ 㺘ਁޡц⭼ҏਚᴹᖸቁӪᱟєՊⲴ䍴␡Պઈ)DŽޘ)о䇑㇇ᵪ、ᆖ㌫㔏ᐕ֌ˈᱟ ACM ઼ IEEE Ⲵ䍴␡Պઈ Amsterdam Ⲵ Vrije བྷᆖᮠᆖ ޠ MINIX ㌫㔏ᱟ⭡ Andrew S. Tanenbaum˄AST˅ᔰਁⲴDŽAST ᱟ൘㦧 1.1.2 MINIX ᬃ֒㌱㔕 䈝䀰䘋㹼Ҷ᭩߉ˈ֯ᗇ UNIX ㌫㔏൘བྷу䲒ṑᗇࡠҶ᧘ᒯDŽ රDŽᖃᰦ֯⭘Ⲵᱟ BCPL 䈝䀰˄สᵜ㓴ਸ㕆〻䈝䀰˅ˈਾ㓿 Dennis Ritchie Ҿ 1972 ᒤ⭘〫ἽᙗᖸᕪⲴ C ᵏ䰤ˈ൘ањᴸ޵ᔰਁࠪҶ UNIX ᫽֌㌫㔏Ⲵ৏ٷᠿˈҾᱟ൘ 1969 ᒤ༿ཙ҈ԆཛӪഎᇦґ࣐࡙⾿ቬӊ⑑ Ken Thompson ѪҶ㜭൘䰢㖞н⭘Ⲵ PDP-7 䇑㇇ᵪк䘀㹼Ԇ䶎ᑨௌ⅒Ⲵᱏ䱵᯵㹼˄Space travel˅⑨ Ken.Thompson ઼ Dennis Ritchie Ҿ 1969 ᒤ༿൘ DEC PDP-7 ሿර䇑㇇ᵪкᔰਁⲴањ࠶ᰦ᫽֌㌫㔏DŽ Linux ᫽֌㌫㔏ᱟ UNIX ᫽֌㌫㔏Ⲵањݻ䲶⡸ᵜDŽUNIX ᫽֌㌫㔏ᱟ㖾ഭ䍍ቄᇎ傼ᇔⲴ 1.1.1 UNIX ᬃ֒㌱㔕Ⲻ䈔⭕ Ⲵа㡜ਁኅਢˈ䇨ཊ᮷ㄐ઼Җ㉽䜭ᴹӻ㓽ˈ䘉䟼ቡн䟽༽DŽ 䇱㌫㔏Ⲵっᇊᙗ˅DŽሩҾ Linux؍2.6.12 ⡸޵Ṩ˄ަѝㅜ 2 њᮠᆇ㤕ᱟཷᮠࡉ㺘⽪ᱟ↓൘ᔰਁⲴ⡸ᵜˈн㜭 ᖃ❦ˈⴞࡽ Linux ޵Ṩ⡸ᵜᐢ㓿ᔰਁࡠҶ 2.6.x ⡸DŽ㘼བྷཊᮠ Linux ㌫㔏ѝᡰ⭘ࡠⲴ޵ṨᱟっᇊⲴ ⡸ᵜ䘉⇥ᰦ䰤Ⲵਁኅ㓿䗷ˈҏণሩ Linux Ⲵᰙᵏਁኅশਢ䘋㹼䈖㓶ӻ㓽DŽ ц⭼ hacker Ⲵᑞࣙлᴰਾ᧘ࠪ∄䖳ᆼழⲴ 1.0ޘᐳԕ৺Ӿ↔ྲօ㢠䳮ൠа↕ањ㝊ঠൠ൘ޜ⡸ ޵Ṩ 0.01 䏓㘼㠚ᆖ䇑㇇ᵪ⸕䇶ǃࡠᗳ䟼ᔰ࿻䞍䞯㕆ࡦањ㠚ᐡⲴ᫽֌㌫㔏ǃࡠᴰࡍ LinuxޤTorvalds Ӿሩ䇑㇇ᵪᝏ ᆳⲴ䞍䞯䗷〻ԕ৺ᴰࡍⲴਁኅ㓿শDŽ俆ݸ࠶࡛ӻ㓽ަѝⲴഋњสᵜ㾱㍐ˈ❦ਾṩᦞ Linux Ⲵࡋ࿻Ӫ Linus ㌫㔏ǃGNU 䇑ࡂǃPOSIX ḷ߶઼ Internet 㖁㔌DŽл䶒ṩᦞ䘉ӄњสᵜ㓯㍒ᶕ䘭ራал Linux Ⲵᔰਁশ〻ǃ Linux ᫽֌㌫㔏Ⲵ䈎⭏ǃਁኅ઼ᡀ䮯䗷〻׍䎆Ҿԕлӄњ䟽㾱᭟ḡ˖UNIX ᫽֌㌫㔏ǃMINIX ᫽֌ Ӻц⭼к֯⭘ᴰཊⲴа⿽ UNIX ㊫᫽֌㌫㔏ˈᒦф֯⭘Ӫᮠ䘈൘䗵⥋໎䮯DŽ ࣚ࣋ˈ⧠ᐢᡀѪᖃ਼ޡц⭼਴ൠ䇑㇇ᵪ⡡ྭ㘵ⲴޘᐳⲴᰦ䰤˅DŽ↔ਾُࣙҾ Internet 㖁㔌ˈ㓿䗷ޜᔿੁཆ Linux ᫽֌㌫㔏ᱟ UNIX ᫽֌㌫㔏Ⲵа⿽ݻ䲶㌫㔏DŽᆳ䈎⭏Ҿ 1991 ᒤⲴ 10 ᴸ 5 ᰕ˄䘉ᱟㅜа⅑↓ 1.1 Linux Ⲻ䈔⭕ૂਇኋ 䏣ѻ༴ԕ৺ྲօᔰ࿻䘋а↕ᆖҐDŽᴰਾሩ਴ㄐⲴ޵ᇩ䘋㹼Ҷㆰ㾱ӻ㓽DŽ ㌫㔏ᰙᵏ⡸ᵜ֌ѪᆖҐሩ䊑ⲴаӋ৏ഐDŽ❦ਾާփ䈤᰾Ҷ䘹ᤙᰙᵏ Linux ޵Ṩ⡸ᵜ䘋㹼ᆖҐⲴՈ⛩઼н ᵜㄐ俆ݸഎ亮Ҷ Linux ᫽֌㌫㔏䈎⭏ǃᔰਁ઼ᡀ䮯Ⲵ䗷〻ˈ⭡↔ਟԕ⨶䀓ᵜҖѪӰѸՊ䘹ᤙ Linux ㅜ1ㄐᾲ䘠  LQX[ Ⲵ䈎⭏઼ਁኅ/ ㅁˈնᡁ↓൘⵰᡻⹄ウᆳ઒āDŽ POSXI ḷ߶㾱≲Ⲵㅖਧᑨᮠˈ㘼ф Linus ൘⌘䟺ѝᐢ߉䚃˖ĀOKˈ䘉ҏ䇨ᱟњ⧙ ޣቡᐢ㓿ᇊѹҶࠐњᴹ Ҷ߶༷ᐕ֌DŽ൘ Linux 0.01 ⡸޵ṨⲴ/include/unistd.h ᮷Ԧѝྭڊᐢ㓿Ѫ Linux ㌫㔏о POSIX ḷ߶Ⲵެᇩ 㹼ᔰਁˈᒦ㜭ཏо㔍བྷཊᮠ UNIX ᫽֌㌫㔏ެᇩDŽ൘ᴰࡍⲴ Linux ޵ṨⓀԓ⸱ѝ˄0.01 ⡸ǃ0.11 ⡸˅ቡ 䘉њ UNIX ḷ߶Ѫ Linux ᨀ׋ҶᶱѪ䟽㾱Ⲵؑ᚟ˈ֯ᗇ Linux 㜭ཏ൘ḷ߶Ⲵᤷሬл䘋ˈىࡊࡊ䎧↕Ⲵᰦ 䛓ᱟ 1991-1993 ᒤ䰤DŽ↔ᰦ↓ᱟ Linuxˈى൘ 90 ᒤԓࡍˈPOSIX ḷ߶Ⲵࡦᇊ↓༴൘ᴰਾᣅ⾘ᮢᇊⲴᰦ њᐕ֌㓴৲оҶ䘋ᶕDŽо↔਼ᰦˈ䘈ᴹаӋ㓴㓷ҏ൘ࡦᇊ㊫լⲴḷ߶ˈྲ X/OpenˈAT&TˈOSF ㅹDŽ ⌅ḷ߶˄POSIX.3˅ǃᇎᰦ API˄POSIX.4˅ㅹDŽࡠҶ 1990 ᒤкॺᒤᐢ㓿ᴹ 25 њ䇑ࡂ൘䘋㹼ˈᒦфᴹ 16 ࡂ൘䘋㹼ˈᴹ䘁 300 ཊӪ৲࣐⇿ᆓᓖѪᵏаઘⲴՊ䇞DŽ⵰᡻Ⲵᐕ֌ᴹભԔоᐕާḷ߶(POSIX.2)ǃ⍻䈅ᯩ ᵏᵋሩ㌫㔏ⲴަԆ࣏㜭ҏࡦᇊࠪḷ߶DŽ䘉ṧ IEEE POSIX Ⲵᐕ֌ቡᔰ࿻ኅᔰҶDŽࡊᔰ࿻ᴹॱњᢩ߶Ⲵ䇑 POSIX.1 ӵ㿴ᇊҶ㌫㔏ᴽ࣑ᓄ⭘〻ᒿ㕆〻᧕ਓ˄API˅ˈӵᾲᤜҶสᵜⲴ㌫㔏ᴽ࣑ḷ߶DŽഐ↔ᐕ֌㓴 9945-1:1990 ḷ߶DŽ ᒤˈPOSIX.1 оᐢ㓿䙊䗷Ⲵ C 䈝䀰ḷ߶㚄ਸˈ↓ᔿᢩ߶Ѫ IEEE 1003.1-1990˄ҏᱟ ANSI ḷ߶˅઼ ISO/IEC ࡠ 1989 ᒤˈPOSIX Ⲵᐕ֌㻛䖜〫㠣 ISO/IEC ⽮ഒˈᒦ⭡ 15 ᐕ֌㓴㔗㔝ሶަࡦᇊᡀ ISO ḷ߶DŽࡠ 1990 POSIX.1 ḷ߶DŽ Ҷ䈅⭘ḷ߶DŽㅜањ↓ᔿḷ߶ᱟ൘ 1988 ᒤ 9 ᴸԭᢩ߶Ⲵ˄IEEE 1003.1-1988˅ˈҏᰒԕਾ㓿ᑨᨀࡠⲴ 〻ᒿⓀԓ⸱ਟ〫Ἵᙗ᫽֌㌫㔏ᴽ࣑᧕ਓ↓ᔿḷ߶DŽࡠҶ 1986 ᒤ 4 ᴸˈIEEE ࡦᇊࠪޣḷ߶ငઈՊࡦᇊᴹ 1985 ᒤˈIEEE ᫽֌㌫㔏ᢰᵟငઈՊḷ߶ሿ㓴ငઈՊ˄TCOS-SS˅ᔰ࿻൘ ANSI Ⲵ᭟ᤱл䍓ᡀ IEEE CSRG Ⲵ BSD ᫽֌㌫㔏Ⲵ䈳⭘᧕ਓѻ䰤Ⲵ४࡛䟽ᯠ䈳઼䳶ᡀDŽᒦҾ 1984 ᒤᇊࡦࠪҶ/usr/group ḷ߶DŽ (usr/group)Ⲵᰙᵏᐕ֌ส⹰кਆᗇⲴDŽ䈕 UNIX ⭘ᡧ㓴৏ᶕ䈅മሶ AT&T Ⲵ System V ᫽֌㌫㔏઼ Berkeley ⭘〻ᒿਟԕ൘Ⓚԓ⸱а㓗к൘ཊ⿽᫽֌㌫㔏к〫Ἵ઼䘀㹼DŽᆳᱟ൘ 1980 ᒤᰙᵏањ UNIX ⭘ᡧ㓴 䇱㕆ࡦⲴᓄ؍㈷ḷ߶DŽ䈕ḷ߶ᱟสҾ⧠ᴹⲴ UNIX ᇎ䐥઼㓿傼ˈ᧿䘠Ҷ᫽֌㌫㔏Ⲵ䈳⭘ᴽ࣑᧕ਓDŽ⭘Ҿ POSIX˄Portable Operating System Interface for Computing Systems˅ᱟ⭡ IEEE ઼ ISO/IEC ᔰਁⲴа 1.1.4 POSIX ḽ߼ ĀGNU/Linux”᫽֌㌫㔏DŽ њਸ䘲Ⲵ⧟ຳDŽ䘉ᱟ Linux 㜭ཏ䈎⭏Ⲵส⹰ѻаˈԕ㠣Ҿⴞࡽ䇨ཊӪ䜭ሶ Linux ᫽֌㌫㔏〠Ѫ 㔏ǃbash shell 〻ᒿǃgcc ㌫ࡇ㕆䈁〻ᒿǃgdb 䈳䈅〻ᒿㅹㅹDŽ䘉Ӌ䖟ԦѪ Linux ᫽֌㌫㔏Ⲵᔰਁࡋ䙐Ҷа ࡠкц㓚 90 ᒤԓࡍˈGNU 亩ⴞᐢ㓿ᔰਁࠪ䇨ཊ儈䍘䟿Ⲵݽ䍩䖟Ԧˈަѝवᤜᴹ਽Ⲵ emacs 㕆䗁㌫ 㔏DŽ ⭘DŽ㲭❦䘉Ӌ㌫㔏䙊ᑨ㻛〠֌"Linux"ˈնᱟ Stallman 䇔ѪˈѕṬൠ䈤ˈᆳԜᓄ䈕㻛〠Ѫ GNU/Linux ㌫ Unix"Ⲵ䙂ᖂ㕙߉ˈᆳⲴਁ丣Ѫ"guh-NEW"˅DŽ਴⿽֯⭘ Linux ֌ѪṨᗳⲴ GNU ᫽֌㌫㔏↓൘㻛ᒯ⌋Ⲵ֯ ᡻ࡋ࣎ⲴDŽᰘ൘ᔰਁањ㊫լ UNIX ᒦфᱟ㠚⭡䖟ԦⲴᆼᮤ᫽֌㌫㔏˖GNU ㌫㔏˄GNU ᱟ"GNU's Not GNU 䇑ࡂ઼㠚⭡䖟Ԧส䠁Պ FSF(the Free Software Foundation)ᱟ⭡ Richard M. Stallman Ҿ 1984 ᒤа 1.1.3 GNU 䇗ࡈ аⴤሿᗳᆸᣔ⵰Ⲵ〈ᇶDŽ 䘉ᱟㅜа⅑֯ᗇᴹᣡ䍏Ⲵ〻ᒿઈᡆ hacker 㜭ཏ䰵䈫᫽֌㌫㔏ⲴⓀԓ⸱DŽ൘ᖃᰦˈ䘉⿽Ⓚԓ⸱ᱟ䖟Ԧ୶Ԝ ֌Ѫањ᫽֌㌫㔏ˈMINIX ᒦнᱟՈ⿰㘵ˈնᆳ਼ᰦᨀ׋Ҷ⭘ C 䈝䀰઼≷㕆䈝䀰㕆߉Ⲵ㌫㔏Ⓚԓ⸱DŽ Ⲵᢙኅ㾱≲DŽഐ↔൘䘉ṧⲴࡽᨀл◰ਁҶ Linus 㕆߉ Linux ㌫㔏DŽᖃ❦ Linus ҏ↓ྭᣃտҶ䘉њྭᰦᵪDŽ ц⭼䇨ཊӪሩ MINIXޘᤱ MINIX Ⲵሿරॆˈ㜭䇙ᆖ⭏൘ањᆖᵏ޵ቡ㜭ᆖᆼˈഐ㘼⋑ᴹ᧕㓣؍ԆѪҶ ሩҾ Linux ㌫㔏ˈԆਾᶕᴮ㺘⽪ሩަᔰਁ㘵 Linus Ⲵ〠䎎DŽնԆ䇔Ѫ Linux Ⲵਁኅᖸབྷ৏ഐᱟ⭡Ҿ ࡽ MINIX ㌫㔏ᐢ㓿ᱟݽ䍩ⲴˈਟԕӾ䇨ཊ FTP кл䖭DŽ  LQX[ Ⲵ䈎⭏઼ਁኅ/ 哫䳰䓛кⲴаṩ㗭∋DŽ ѝⴱ⮕Ҷ䇨ཊ᷍㢲ˈ㘼䘉Ӌ᷍㢲䰞仈㲭❦⋑ᴹཚཊⲴ⨶䇪ਜ਼䟿ˈնতᱟањ㌫㔏ᗵ㾱Ⲵ㓴ᡀ䜘࠶ˈቡ䊑 ៲ᗇ㌫㔏Ⲵᐕ֌สᵜ৏⨶ˈ䘈䴰㾱㔃ਸᇎ䱵㌫㔏ˈᆖҐᇎ䱵㌫㔏Ⲵᇎ⧠ᯩ⌅DŽഐѪ⨶䇪∅ㄏᱟ⨶䇪ˈަ F**ing Source Code :-)”˅DŽԆ䇔ѪㆄṸቡ൘Ⓚ〻ᒿѝDŽ䘉ҏ䈤᰾ҶሩҾᆖҐ㌫㔏䖟Ԧᶕ䈤ˈᡁԜнݹ䴰㾱 Ԇ൘എㆄᴹӪᨀࠪ MINIX кⲴањ䰞仈ᰦˈᡰ䈤Ⲵㅜаਕ䈍ቡᱟĀ䰵䈫Ⓚԓ⸱ā˄“RTFSC (Read the 䘉њᜣ⌅䙀↕╄ਈᡀᜣ䟽ᯠ䇮䇑ањสҾ Intel 80386 փ㌫㔃ᶴⲴᯠ᫽֌㌫㔏ⲴᶴᙍDŽ ⹄ウҶ MINIX ㌫㔏ˈᒦ൘䘉⇥ᰦ䰤ᴹҶ᭩䘋 MINIX ᫽֌㌫㔏ⲴᙍᜣDŽ൘䘋а↕ᆖҐ MINIX ㌫㔏ѻਾˈ ޕ␡Evans ᭩䘋Ⲵ࡙⭘ Intel 386 ⢩ᙗⲴ 32 ս MINIX ㌫㔏˅DŽ⭡↔ਟ⸕ˈLinus ൘ 1991 ᒤࡍᵏቡᐢ㓿ᔰ࿻ gcc 㕆䈁ಘ൘ MINIX-386 ㌫㔏к䘀㹼ՈॆⲴ䰞仈˄MINIX-386 ᱟањ⭡ Bruce ޣdoesn't optimize”,ᱟᴹ Linus ㅜ 1 ⅑ੁ comp.os.minix ᣅ䙂⎸᚟ᱟ൘ 1991 ᒤ 3 ᴸ 29 ᰕDŽᡰਁᑆᆀⲴ仈ⴞᱟĀgcc on minix-386 Ґ MINIX ㌫㔏䱦⇥ਁኅࡠᔰਁ㠚ᐡⲴ Linux ㌫㔏Ⲵ䗷〻DŽ ᭩ਈҶࡍ㺧DŽṩᦞ Linus ൘ comp.os.minix ᯠ䰫㓴кਁᐳⲴ⎸᚟ˈᡁԜਟԕ⸕䚃Ԇ䙀↕ӾᆖޘⲴਁኅতᆼ ᣔ⁑ᔿ䘀㹼ᯩᔿлⲴ㕆〻ᢰᵟDŽնਾᶕ Linux؍ᔰ࿻ˈԆⲴⴞⲴᖸㆰঅˈਚᱟѪҶᆖҐ Intel 386 փ㌫㔃ᶴ Ӿ 1991 ᒤ 4 ᴸԭ䎧ˈԆ䙊䗷؞᭩㓸ㄟԯⵏ〻ᒿ઼⺜Ԧ傡ࣘ〻ᒿˈᔰ࿻㕆ࡦ䎧㠚ᐡⲴ᫽֌㌫㔏ᶕDŽࡊ ↓൘ᔰਁѝDŽն Linus ᐢ㓿ㅹнᙕҶDŽ ࡂᐢ㓿ᔰਁࠪ䇨ཊᐕާ䖟Ԧˈަѝᴰਇᵏ⴬Ⲵ GNU C 㕆䈁ಘᐢ㓿ࠪ⧠DŽ㲭❦ GNU Ⲵݽ䍩᫽֌㌫㔏 HURD ㊫լҾ᫽֌㌫㔏⺜Ԧ䇮༷傡ࣘ〻ᒿⲴԓ⸱ˈҾᱟԆᔰ࿻ᴹҶ㕆ࡦањᯠ᫽֌㌫㔏Ⲵᜣ⌅DŽ↔ᰦ GNU 䇑 ҾᮉᆖⴞⲴㆰঅ᫽֌㌫㔏ˈ㘼нᱟањᕪᴹ࣋Ⲵᇎ⭘᫽֌㌫㔏˅ˈ㘼ф䙊䗷к䘠ᇎ䐥 Linus ᐢ㓿ᴹҶаӋ 䙊䗷㕆〻ᇎ䐥ˈᒦ൘ᆖҐ䗷〻ѝ䇔䇶ࡠ MINIX ㌫㔏Ⲵ䈨ཊ䲀ࡦ˄MINIX 㲭❦ᖸྭˈնਚᱟањ⭘ ⭥㝁кˈԆ䘈Ѫ䖟ⴈ傡ࣘಘǃ䭞ⴈㅹ⺜Ԧ䇮༷㕆ࡦࠪ⴨ᓄⲴ傡ࣘ〻ᒿDŽ ⭘ 80386 CPU Ⲵཊԫ࣑⢩ᙗ㕆ࡦࠪањ㓸ㄟԯⵏ〻ᒿDŽ↔ਾѪҶሶ㠚ᐡаਠ㘱ᔿ⭥㝁кⲴ䖟Ԧ༽ࡦࡠᯠ Intel 80386 Ⲵ⺜Ԧ⸕䇶DŽѪҶ㜭䙊䗷 Modem ᤘਧ䘎᧕ࡠᆖṑⲴѫᵪкˈԆ֯⭘≷㕆䈝䀰ᒦ࡙ ޣҐҶᴹ аਠ 386 ެᇩ⭥㝁ˈᒦӾ㖾ഭ䛞䍝Ҷа྇ MINIX ㌫㔏䖟ԦDŽቡ൘ㅹᖵ MINIX 䖟Ԧᵏ䰤ˈLinus 䇔ⵏᆖ 䏓-˅ˈLinus ֯⭘൓䈎㢲Ⲵ঻኱䫡઼䍧Ⅾ䍝ҠҶޤѪҶ㜭ᴤྭൠᆖҐ䇑㇇ᵪ⸕䇶˄ᡆ䇨ҏਚᱟѪҶ 㜭ᗇࡠⓀԓ⸱DŽ㲭❦ GNU Ⲵ᫽֌㌫㔏 HURD аⴤ൘ᔰਁѻѝˈն൘ᖃᰦⴻᶕн㜭൘ࠐᒤ޵ᆼᡀDŽ 䘈⋑ᴹᔰਁࠪݽ䍩Ⲵ GNU ᫽֌㌫㔏DŽণ֯ᱟᮉᆖ֯⭘Ⲵ MINIX ᫽֌㌫㔏ҏᔰ࿻ᴹҶ⡸ᵳˈ䴰㾱䍝Ҡ᡽ ൘਼аᒤ䰤ˈGNU 䇑ࡂᐢ㓿ᔰਁࠪҶ䇨ཊᐕާ䖟ԦDŽަѝᴰਇᵏ⴬Ⲵ GNU C 㕆䈁ಘᐢ㓿ࠪ⧠ˈն 㕪ѿⲴቡᱟањуъ㓗Ⲵ᫽֌㌫㔏DŽ ᒤ䖫Ӫௌ⅒啃ᦓԆⲴ䇑㇇ᵪˈ⍻䈅䇑㇇ᵪⲴᙗ㜭઼䲀ࡦDŽնᖃᰦԆᡰޠⲴ䇑㇇ᵪ hackerDŽ䘉 њ 21 ኱Ⲵ㣜 ᖃᰦ(1991 ᒤ)ˈLinus Benedict Torvalds ᱟ䎛ቄ䗋สབྷᆖ䇑㇇ᵪ、ᆖ㌫ⲴҼᒤ㓗ᆖ⭏ˈҏᱟањ㠚ᆖ ⨶䀓᫽֌㌫㔏Ⲵᐕ֌৏⨶DŽަѝҏवᤜ Linux ㌫㔏Ⲵࡋ࿻㘵 Linus Benedict TorvaldsDŽ ц⭼Ⲵ䇑㇇ᵪ⡡ྭ㘵䜭ᔰ࿻ⴻ䘉ᵜҖˈԕᵏ㜭ޘ䘉ᵜҖ߉Ⲵ䶎ᑨ䈖㓶ˈᒦфਉ䘠ᗇᴹᶑᴹ⨶ˈҾᱟࠐѾ ↓൘↔ᰦˈࠪ⧠Ҷ MINIX ᫽֌㌫㔏ˈᒦфᴹаᵜ᧿䘠ަ䇮䇑ᇎ⧠৏⨶ⲴҖ਼ᰦਁ㹼DŽ⭡Ҿ AST Ⲵ Ԧ㹼ъⲴབྷර׋ᓄ୶Ԝ࿻㓸⋑ᴹ㔉ࠪᴹ᭸Ⲵ䀓ߣ䘉њ䰞仈Ⲵ᡻⇥DŽ ᔰDŽሩҾᒯབྷⲴ PC ⭘ᡧˈ䖟ޜ䇨ਟ㘼㜭൘བྷᆖѝ⭘ҾᮉᆖⲴ UNIX Ⓚԓ⸱ҏаⴤ㻛ሿᗳൠᆸছ⵰н䇨 ѪҶራ≲儈࡙⏖⦷ˈUNIX 㓿䬰୶ԜᢺԧṬᣜᗇᶱ儈ˈPC ሿ⭘ᡧṩᵜн㜭䶐䘁ᆳDŽᴮ㓿аᓖ᭦ࡠ Bell Labs ᖃᰦⲴਖањ䇑㇇ᵪᢰᵟ䱥㩕ቡᱟ UNIX ц⭼DŽնᱟ UNIX ᫽֌㌫㔏ቡнӵᱟԧṬᰲ䍥Ⲵ䰞仈ҶDŽ ᖃᰦ Apple Ⲵ MACs ᫽֌㌫㔏ਟԕ䈤ᱟᙗ㜭ᴰྭⲴˈնᱟަཙԧ֯ᗇ⋑Ӫ㜭ཏ䖫᱃䶐䘁DŽ 㔏аⴤᱟᗞර䇑㇇ᵪ᫽֌㌫㔏ⲴѫᇠDŽ↔ᰦ䇑㇇ᵪ⺜ԦԧṬ㲭❦䙀ᒤл䱽ˈն䖟ԦԧṬӽ❦ት儈нлDŽ Ⲵᗞර䇑㇇ᵪ IBM PCDŽ൘ 1981-1991 ᒤ䰤ˈMS-DOS ᫽֌㌫⨳ޘਨ᧘ࠪҶӛ䂹ޜ ൘ 1981 ᒤˈIBM 1.1.5 Linux ᬃ֒㌱㔕Ⲻ䈔⭕ ҶԆ↓൘⵰᡻ањ᫽֌㌫㔏Ⲵᔰਁˈᒦф൘ᔰਁѻࡍᐢ㓿ᜣࡠ㾱ᇎ⧠о POSIX ⴨ެᇩⲴ䰞仈ҶDŽ 1991 ᒤ 7 ᴸ 3 ᰕ൘ comp.os.minix кਁᐳⲴ post кቡᐢ㓿ᨀࡠҶ↓൘ᩌ䳶 POSIX Ⲵ䍴ᯉDŽަѝ䘿䵢  LQX[ Ⲵ䈎⭏઼ਁኅ/ 㜭DŽ᭩ழҶ䖟ⴈ傡ࣘ〻ᒿ઼᮷Ԧ㌫㔏Ⲵᙗ㜭DŽ᭩ਈҶ⺜ⴈભ਽઼㕆ਧᯩᔿDŽ৏ 㲊ᤏ᮷Ԧ㌫㔏᭟ᤱˈն䘈ᱟਚवਜ਼ањ MINIX ᮷Ԧ㌫㔏DŽ໎࣐Ҷⲫᖅ࣏ޕ1992.3.8 ࣐ (ণ 0.13) 0.95.x Ԧㅖਧ䬮᧕઼㲊ᤏ޵ᆈሩᦒ˄swapping˅࣏㜭DŽ 0.12 1992.1.15 ѫ㾱໎࣐Ҷᮠᆖॿ༴⨶ಘⲴ䖟Ԧ⁑ᤏ〻ᒿDŽ໎࣐Ҷ֌ъ᧗ࡦǃ㲊ᤏ᧗ࡦਠǃ᮷ 0.11 1991.12.8 สᵜਟԕ↓ᑨ䘀㹼Ⲵ޵Ṩ⡸ᵜDŽ᭟ᤱ⺜ⴈ઼䖟傡䇮༷ԕ৺Ѣ㹼䙊ؑDŽ ᴹањᢺ as86 ≷㕆䈝⌅䖜ᦒᡀ gas ≷㕆䈝⌅Ⲵ㝊ᵜ〻ᒿDŽ 0.10 1991.10 ⭡ Ted Ts’o ਁᐳⲴ Linux ޵Ṩ⡸ᵜDŽ໎࣐Ҷ޵ᆈ࠶䝽ᓃ࠭ᮠDŽ൘ boot ⴞᖅѝਜ਼ 0.02 1991.10.5 䈕⡸ᵜԕ৺ 0.03 ⡸ᱟ޵䜘⡸ᵜˈⴞࡽᐢ㓿ᰐ⌅᢮ࡠDŽ⢩⛩਼кDŽ ⨶DŽ䘈нवਜ਼䖟ⴈ傡ࣘ〻ᒿDŽ ᐳⲴ Linux ޵Ṩ⡸ᵜDŽཊ㓯〻᮷Ԧ㌫㔏ǃ࠶⇥઼࠶亥޵ᆈ㇑ޜ0.01 1991.9.17 ㅜањ↓ᔿੁཆ 0.00 1991.2-4 єњ䘋〻ˈ࠶࡛൘ቿᒅкᱮ⽪’AAA...’઼’BBB...’DŽ ˄⌘˖⋑ᴹਁᐳ˅ ⡸ᵜਧ ਁᐳ/㕆ࡦᰕᵏ 䈤᰾ 㺞 ā ޻ṮⲺѱ㾷⡾ᵢ ޵ṨⓀԓ⸱㻛⹤ൿђཡDŽ 䭞ⴈDŽҏਚ᭟ᤱ 8MB ⢙⨶޵ᆈDŽ⭡Ҿ Linus а⅑᫽֌ཡ䈟ˈሬ㠤䲿ਾⲴ 0.02ǃ0.03 ⡸ޠഐ↔ҏਚ᭟ᤱ㣜 䈝ԓ⸱ˈޠⲴ include/string.h ᮷Ԧѝࠪ⧠а⅑⡸ᵳᡰᴹؑ᚟DŽ䈕⡸ᵜ޵ṨⲴ䭞ⴈ傡ࣘ〻ᒿӵ⺜㕆⸱䘋㣜 ᵜDŽLinux 0.01 ⡸޵ṨᱟҾ 1991 ᒤ 9 ᴸ 17 ᰕ㕆ࡦᆼᡀDŽնᱟ Linus 䘈ṩᵜ⋑ᴹ⡸ᵳ᜿䇶ˈᡰԕӵ൘䈕⡸ єњԫ࣑⴨ӂ࠷ᦒ䘀㹼ᰦˈ൘Ḁ⿽〻ᓖкᴤ໎ᕪҶԆᔰਁ㠚ᐡ᫽֌㌫㔏Ⲵᜣ⌅DŽഐ↔ᡁԜҏࡇѪањ⡸ Linux ㌫㔏ᒦ⋑ᴹ 0.00 䘉њ⡸ᵜˈնᱟ㠚Ӿ Linus ൘㠚ᐡⲴ 80386 ެᇩᵪкᇎ傼ᡀ࣏൘ᰦ䫏ѝᯝ᧗ࡦл ᒤ 9 ᴸԭᔰ࿻ᆖҐ֯⭘⡸ᵜ㇑⨶ᐕާ BitKeeper ᰦ৸ᢺԕк䘉Ӌ 1.0 ѻࡽⲴᡰᴹ⡸ᵜ⍿㿸Ҷа䗩DŽᇎ䱵кˈ ᐳҶ㺘 1̢1 ѝᡰ⽪ⲴаӋѫ㾱⡸ᵜDŽLinus ൘ 2003ਁޡˈ⧠ Linux ᫽֌㌫㔏Ӿ䈎⭏ࡠ 1.0 ⡸↓ᔿࠪ 1.1.6 Linux ᬃ֒㌱㔕⡾ᵢⲺ਎䗷 ⲴDŽ❦ڦਨ䘹ᤙ䘉њᰕᆀਁᐳᆳⲴᯠ㌫㔏ҏнᱟޜ 䘉њᰕᆀDŽᡰԕ RedHat Ѫ⍱ՐDŽഐ↔ 10 ᴸ 5 ᰕሩ Linux ⽮४ᶕ䈤ᱟањ⢩↺Ⲵᰕᆀˈ䇨ཊਾᶕ Linux Ⲵᯠ⡸ᵜਁᐳᰦ䜭䘹ᤙҶ 㔏Ⲵ䈎⭏˄Free minix-like kernel sources for 386-AT˅DŽ䘉⇥⎸᚟ਟԕ〠Ѫ Linux Ⲵ䈎⭏ᇓ䀰ˈᒦфаⴤᒯ ࡠҶ 1991 ᒤⲴ 10 ᴸ 5 ᰕˈLinus ൘ comp.os.minix ᯠ䰫㓴кਁᐳ⎸᚟ˈ↓ᔿੁཆᇓᐳ Linux ޵Ṩ㌫ Linus ᖃᰦᒦ⋑ᴹ㘳㲁DŽնᱟⴞࡽ Linux ࠐѾਟԕ䘀㹼൘ԫօа⿽⺜Ԧփ㌫㔃ᶴкDŽ ᦒ⢩ᙗˈᡰԕ䈕᫽֌㌫㔏нྭ〫Ἵ˄⋑ᴹਟ〫Ἵᙗ˅ˈᒦфਚ㜭֯⭘ AT ⺜ⴈDŽሩҾ Linux Ⲵ〫Ἵᙗ䰞仈ˈ ᴰਾˈLinus ༠᰾ԆᔰਁⲴ᫽֌㌫㔏⋑ᴹ֯⭘а㹼 MINIX ⲴⓀԓ⸱˗㘼ф⭡Ҿ֯⭘Ҷ 386 Ⲵԫ࣑࠷ bash(1.08 ⡸)઼ gcc(1.40 ⡸)〫ἽࡠҶᯠ㌫㔏кˈ㘼ф൘䗷ࠐњᴸቡਟԕᇎ⭘ҶDŽ Ӌ৏ഐˈᯠᔰਁⲴ㌫㔏ࡊᔰ࿻о MINIX ᖸ䊑˄ᒦф֯⭘Ҷ MINIX Ⲵ᮷Ԧ㌫㔏˅DŽᒦфᐢ㓿ᡀ࣏ൠሶ ъDŽᐼᵋབྷᇦ৽侸аӋሩҾ MINIX ㌫㔏ѝௌ⅒ଚӋ⢩㢢нௌ⅒ӰѸㅹؑ᚟ˈᒦф䈤᰾⭡Ҿᇎ䱵઼ަԆа 䏓㘼ᐢˈԓ⸱нՊᖸབྷˈҏнՊ䊑 GNU Ⲵ䛓ṧуޤ൘ᔰਁањ(ݽ䍩Ⲵ)386(486)᫽֌㌫㔏ˈᒦф䈤ਚᱟ ᜣ൘ MINIX ㌫㔏ѝ㿱ࡠӰѸ˛”(ĀWhat would you like to see in minix?ā)ˈ൘䈕⎸᚟ѝԆ俆⅑䘿䵢ࠪ↓ ൘ Linus ਖањਁᐳⲴ⎸᚟ѝ(1991 ᒤ 8 ᴸ 25 ᰕ comp.os.minix)ˈԆੁᡰᴹ MINIX ⭘ᡧ䈒䰞Ā֐ᴰ ᔲᜣཙᔰㅹ˅DŽަѝ䘿䵢ҶԆ↓൘䘋㹼 Linux ㌫㔏Ⲵᔰਁˈᒦфᐢ㓿ᜣࡠ㾱ᇎ⧠о POSIX ެᇩⲴ䰞仈ҶDŽ Linux 䘉њ਽〠ˈᖃᰦ Linus 㝁ᆀ䟼ᜣⲴ਽〠ਟ㜭ᱟ FREAX -ˈFREAX Ⲵ㤡᮷ਜ਼ѹᱟᙚ䈎Ⲵǃᙚ⢙ǃ Ⲵ⎸᚟ᱟ൘ 1991 ᒤ 7 ᴸ 3 ᰕ൘ comp.os.minix кਁᐳⲴ˄ᖃ❦ˈ䛓ᰦ䘈нᆈ൘ޣㅜањо Linux ᴹ 䈤㠚ᐡᐢ㓿ᡀ࣏ൠሶ bash 〫ἽࡠҶ MINIX кˈ㘼фᐢ㓿⡡н䟺᡻ǃн㜭⿫ᔰ䘉њ shell 䖟ԦҶDŽ ቍ䈅⵰〫Ἵ GNU Ⲵ䖟Ԧࡠ䈕㌫㔏к(GNU gccǃbashǃgdb ㅹ)DŽᒦҾ 4 ᴸ 13 ᰕ൘ comp.os.minix кਁᐳ 䜘ᰦ䰤⹄ウ MINIX-386 ㌫㔏(Hacking the kernel)ˈᒦфޘӾ 1991 ᒤ 4 ᴸԭᔰ࿻ˈLinus ࠐѾ㣡䍩Ҷ  LQX[ Ⲵ䈎⭏઼ਁኅ/ 0.95a ⡸ˈᒦ൘ 1 њᴸਾ˄4 ᴸ 9 ᰕ˅৸ਁᐳҶ 0.95c+⡸ᵜDŽ䈕⡸ᵜⲴᴰབྷ᭩䘋ѻ༴ᱟᔰ࿻䟷⭘㲊ᤏ᮷Ԧ 3 ᴸ 8 ᰕਁᐳㅜ 1 њ 0.95 ⡸ᰦ䙷ࡠҶаӋ䰞仈ˈഐ↔↔ਾнࡠ 10 ཙ˄3 ᴸ 17 ᰕ˅ቡ・࡫ਁᐳҶਖањ 0.95 ⡸ᱟㅜањ֯⭘ GNU GPL ⡸ᵳⲴ Linux ޵Ṩ⡸ᵜDŽ䈕⡸ᵜᇎ䱵кᴹ 3 њᆀ⡸ᵜˈ⭡Ҿ 1992 ᒤ ԯⵏԓ⸱ㅹDŽ ᡀˈնᱟ MINIX ত⋑ᴹ䟷㓣䘉Ӌ㺕б〻ᒿ˗Ŀਟ䟽ᯠᢗ㹼Ⲵ㌫㔏䈳⭘˗ŀLinus 㕆ࡦᆼᡀᮠᆖॿ༴⨶ಘ 㜌аㆩ˗ľᇎ⧠ሩ select()࠭ᮠ᭟ᤱˈ䘉ᱟ Peter MacDonald ṩᦞаӋӪѪ MINIX ᨀ׋Ⲵ㺕б〻ᒿ؞᭩㘼 ᖅ㌫㔏䈳⭘˗ĽPeter MacDonald ᇎ⧠Ҷ㲊ᤏ㓸ㄟ᭟ᤱˈ֯ᗇ Linux 㾱∄ᖃᰦⲴḀӋ୶ъ⡸ UNIX 䘈㾱ᴤ ӛᓃⲴ᭟ᤱˈ㢲ⴱҶ޵ᆈ֯⭘䟿˗Ļㅖਧ䘎᧕༴⨶˗ļࡐ䲔ⴞޡ᮷Ԧ IO ᕅ䎧ⲴㄎҹᶑԦ˗ĺ໎࣐Ҷሩ Ĺ᭩↓Ҷањ˗ѻ༴ᴹ˖ķTed Ts'o ␫࣐Ҷሩ㓸ㄟؑਧ༴⨶᭟ᤱ˗ĸ੟ࣘᰦਟԕ᭩ਈ֯⭘Ⲵቿᒅ㹼ࡇ٬ ᐳࠪᶕDŽ0.12 ⡸޵ṨⲴѫ㾱ਈॆޜᰦˈԆ䜭Պ㓿䗷ᴤઘᇶⲴ⍻䈅ˈᒦф䇙ࠐњྭᴻ৻ݸ䈅⭘ਾ᡽Պ↓ᔿ ᖃᰦ Linus 㿹ᗇቡྭ䊑䙷ࡠҶањབྷ⚮䳮DŽн䗷↔ਾԆ᧕ਇҶ䘉⅑Ⲵᮉ䇝ˈԕਾ⇿⅑ਁᐳᯠⲴ޵Ṩ⡸ᵜ ѝ䘈वਜ਼䖳ཊ䭉䈟ˈഐ↔ 0.95 ⡸ࡊਁᐳᰦᴮᴹ䖳ཊ Linux ⡡ྭ㘵൘֯⭘ѝ䙷ࡠ䰞仈DŽަˈ׳ਁᐳᗇཚԃ Ⲵਖањ᜿ᙍᱟ䇙བྷᇦн㾱㿹ᗇ⿫ 1.0 ⡸䘈ᖸ䚕䘌DŽնᱟ⭡Ҿ 0.95 ⡸ڊ⡸˅ᨀॷѪ 0.95 ⡸DŽLinus 䘉ṧ њ⡸ᵜ䇙 Linus 㿹ᗇਁᐳ 1.0 ޵Ṩ⡸ᵜᐢ㓿нᱟӰѸ䚕䚕ᰐᵏⲴһҶˈഐ↔Ԇ・࡫ᢺлањ⡸ᵜ˄0.13 ࡦᆼᡀҶ㲊ᤏ޵ᆈ㇑⨶ԓ⸱ˈӾ㘼ਟԕ൘ਚᴹ 2MB ޵ᆈⲴᵪಘкҏ㜭֯⭘䊑 gcc 䘉⿽Āབྷරā䖟ԦDŽ䘉 Linux 0.12 ᱟ Linus ∄䖳┑᜿Ⲵ޵Ṩ⡸ᵜˈҏᱟањᴤっᇊⲴ޵ṨDŽ൘ 1991 ᒤⲴ൓䈎㢲ᵏ䰤ˈԆ㕆 呓ਛ࣏㜭઼ KILL ᆇㅖ˗Ľᨀ׋Ҷሩཊ⿽䈝䀰䭞ⴈⲴ᭟ᤱDŽ ⸱˗ĻGalen Hunt ␫࣐Ҷሩཊ⿽ᱮ⽪঑᭟ᤱ˗ļJohn T Kohl ؞᭩Ҷ kernel/console.c 〻ᒿˈ֯᧗ࡦਠ᭟ᤱ /etc/rc ࡍ࿻᮷Ԧ˗Ĺᔪ・䎧ᮠᆖॿ༴⨶ಘԯⵏ〻ᒿṶᷦ〻ᒿ㔃ᶴ˗ĺTed Ts'o ໎࣐Ҷሩ㝊ᵜ〻ᒿⲴ༴⨶ԓ ަԆӪઈᔰ࿻৲о޵ṨᔰਁDŽ䘉њ⡸ᵜѝѫ㾱໎␫Ⲵ࣏㜭ᴹ˖ķᢗ㹼〻ᒿⲴ䴰≲࣐䖭˗ĸ੟ࣘᰦਟᢗ㹼 ⴨ሩ 0.10 ⡸ᶕ䈤ˈLinux 0.11 ⡸Ⲵ᭩ࣘ䖳ሿDŽն䘉њ⡸ᵜҏᱟㅜањ∄䖳っᇊⲴ⡸ᵜˈᒦфᔰ࿻ᴹ ༷˗ļ䟽߉Ҷ kernel/signal.c ԓ⸱ˈ␫࣐Ҷሩ sigaction()Ⲵ᭟ᤱㅹDŽ ࡛ᔪ・Ҷ㠚ᐡⲴᆀⴞᖅ˗Ĺ໎࣐Ҷ䖟ⴈ傡ࣘ〻ᒿ˗ĺ᭟ᤱ᮷Ԧ亴䈫᫽֌˗Ļ᭟ᤱ dev/port ઼ dev/null 䇮 boot/bootsect.s ઼ boot/setup.s єњ〻ᒿ˗ķᴰཊ᭟ᤱ 16MB ⢙⨶޵ᆈ˗ĸѪ傡ࣘ〻ᒿ઼޵ᆈ㇑⨶〻ᒿ࠶ "(C) 1991 Linus Torvalds"DŽ䈕⡸ᵜⲴަԆаӋਈॆ䘈वᤜ˖ᢺ৏ᶕᕅሬ〻ᒿ boot/boot.s ࠶ࢢᡀ 䖭/ন䖭˄mount/umount˅᮷Ԧ㌫㔏Ⲵ᫽֌DŽӾ䘉њ޵Ṩ⡸ᵜᔰ࿻ˈLinus Ѫ⇿њ᮷Ԧ䜭␫࣐Ҷ⡸ᵳؑ᚟˖ ࡽࠐњ⡸ᵜᴹᖸབྷⲴ䘋↕ˈ൘䘉њ⡸ᵜ޵ṨⲴ㌫㔏кᐢ㓿㜭ཏ֯⭘ GNU gcc 㕆䈁޵Ṩˈᒦфᔰ࿻᭟ᤱ࣐ ᆈлᶕⲴ⡸ᵜˈLinus 㠚ᐡⲴҏᐢ㓿ђཡDŽ䘉њ⡸ᵜ㾱∄؍⧠ᆈⲴ 0.10 ⡸޵Ṩԓ⸱ᱟ Ted Ts'o ᖃᰦ 1.0 1994.3.14 ᧘ࠪㅜањ↓ᔿ⡸DŽ 㔌ԓ⸱DŽNFS ᭟ᤱDŽ 0.99.x 1992.12.13 䟽ᯠ䇮䇑䘋〻ሩ޵ᆈⲴ֯⭘࠶䝽ˈ⇿њ䘋〻ᴹ 4G 㓯ᙗオ䰤DŽнᯝൠ൘᭩䘋㖁 ањ޵ᆈ亥䶒DŽ њ䘋〻ਟ਼ᰦᢃᔰ 256 њ᮷Ԧ˄৏ᶕᱟ 32 њ˅ˈᒦф䘋〻Ⲵ޵ṨึḸ⤜・֯⭘ ࠶˄mm˅ˈ⇿њ䘋〻ᴹ 4GB 䙫䗁ൠ൰オ䰤˄޵Ṩঐ⭘ 1GB˅DŽӾ 0.98.4 ᔰ࿻⇿ ᭩ழሩ TCP/IP˄0.8.1˅㖁㔌Ⲵ᭟ᤱˈ㓐↓Ҷ extfs Ⲵ䭉䈟DŽ䟽߉Ҷ޵ᆈ㇑⨶䜘 0.98.x 1992.9.28 㔏᭟ᤱ˗ᙫ㓯啐ḷ傡ࣘ〻ᒿDŽ޵Ṩ㻛᱐ሴࡠ㓯ᙗൠ൰ 3GB ᔰ࿻༴DŽ 0.97.x 1992.8.1 ໎࣐ҶሩᯠⲴ SCSI 傡ࣘ〻ᒿⲴ᭟ᤱ˗ࣘᘱ儈䙏㕃ߢ࣏㜭˗msdos ઼ ext ᮷Ԧ㌫ ࡦⲴ䭞ⴈ傡ࣘ〻ᒿᐢ⭘䟽ᯠ C 䟽߉DŽо 0.95 ޵Ṩԓ⸱∄䖳ᴹᖸབྷⲴ؞᭩DŽ ㇑⨶Ⲵᙗ㜭ˈ᭟ᤱࣘᘱ䬮᧕ᓃˈᒦᔰ࿻㜭䘀㹼 X-Windows 〻ᒿDŽ৏≷㕆䈝䀰㕆 ޵ṨDŽ䖟ⴈ㊫ර㠚ࣘ䇶࡛DŽ᭩ழҶѢ㹼傡ࣘǃ儈䙏㕃ߢǃ޵ᆈޕ〻ᒿ㻛↓ᔿ࣐ UNIX Socket ᭟ᤱDŽ໎࣐Ҷ ext ᮷Ԧ㌫㔏 alpha ⍻䈅〻ᒿDŽSCSI 傡ࣘ ޕᔰ࿻࣐ 0.96.x 1992.5.12 CDROMDŽ ભ਽ᯩᔿо MINIX ㌫㔏Ⲵ⴨਼ˈ↔ᰦ᭩ᡀо⧠൘ Linux ㌫㔏Ⲵ⴨਼DŽ᭟ᤱ  LQX[ Ⲵ䈎⭏઼ਁኅ/ /LQXV7RUYDOGVlj-XVWIRUIXQNJㅜ  亥DŽ Linux ൘ц⭼㤳ത޵Ⲵ⍱㹼ҏᴹԆᖸབྷⲴ࣏ࣣDŽᰙ൘ Linux ᫽֌㌫㔏ࡊ䰞цᰦˈԆቡᘰ⵰ᶱབྷⲴ✝ ֌ǃ䬰୞઼⹄ウ㘵ᔰ᭮ഒփ IETF ᡀઈDŽ ௌ⅒䎧ъ։ᰐ㓯⭥ᣕ䘀ࣘDŽⴞࡽԆ൘ IBM ᐕ֌Ӿһ㌫㔏㕆〻৺ަԆ䟽㾱һ࣑DŽԆ䘈ᱟഭ䱵㖁㔌䇮䇑ǃ᫽ ࣐ᆖṑѝѮ࣎Ⲵ਴⿽ᆖ⭏⍫ࣘDŽԆௌ⅒✩侚ǃ僁㠚㹼䖖ˈᖃ❦䘈ᴹቡᱟ Hacking on LinuxDŽਾᶕԆᔰ࿻ ઈѻаቡᱟ Theodore Ts'o (Ted Ts'o)DŽԆҾ 1990 ᒤ∅ъҾ MIT 䇑㇇ᵪ、ᆖуъDŽ൘བྷᆖᰦԓԆቡ〟ᶱ৲ Ӿ Linux ᰙᵏⓀԓ⸱ѝਟԕⴻࠪˈLinux ㌫㔏Ⲵᰙᵏѫ㾱ᔰਁӪઈ䲔Ҷ Linus ᵜӪԕཆˈᴰ㪇਽ⲴӪ 1.1.8 ᰟᵕ Linux ㌱㔕ᔶਇⲺѱ㾷䍗⥤㘻 Ⲵ䘉ṧDŽāڊᆇˈ㘼фԕਾѪ䘉һᡁᙫ㜭䈤ᴽ࡛Ӫˈቡ䊑ᡁ⧠൘ ਟԕݹ᰾↓བྷൠ䈤ᡁᒦн㠚䍏ˈᡆ㘵䜘࠶ඖⲭൠ䈤ᡁᒦ⋑ᴹᵜսѫѹᙍᜣDŽնᡁᜣྭ੗ˈ䘉ҏᱟњྭ਽ ᆇDŽԆඊᤱ㾱⭘⧠൘䘉њ਽ᆇ(Linux)ˈᡁ᢯䇔ᖃᰦᡁᒦ⋑ᴹ䐏Ԇཊҹ䇪DŽն䘉䜭ᱟԆਆⲴ਽ᆇDŽᡰԕᡁ Ā㘼 Ari LemkeˈԆඊᤱ㾱⭘㠚ᐡⲴᯩᔿሶ޵Ṩԓ⸱᭮ࡠ ftp ㄉ⛩кˈᒦф䶎ᑨнௌ⅒ Freax 䘉њ਽ ㌫ˈ൘ᖃᰦ䘈н䴰㾱ањ਽ᆇˈഐѪᡁ䘈⋑ᴹੁԫօӪਁᐳ䗷޵Ṩԓ⸱DŽāޣ䘉ҏ⋑ӰѸ ᧿䘠ྲօ㕆䈁Ⓚԓ⸱Ⲵ᮷Ԧ - ᮷Ԧѝቡᐢ㓿वਜ਼ᴹĀFreax”䘉њ਽ᆇҶˈབྷ㓖ᆈ൘ҶॺᒤᐖਣDŽնަᇎ 䍏ҶDŽ㘼ᡁѪᴰ㓸ਁᐳ⡸߶༷ⲴᱟӰѸ਽ᆇ઒˛FreaxDŽᇎ䱵кˈ޵Ṩԓ⸱ѝḀӋᰙᵏⲴ Makefile - ⭘Ҿ Āඖⲭൠ䈤ˈᡁӾᶕ⋑ᴹᜣࡠ䗷㾱⭘ Linux 䘉њ਽〠ᶕਁᐳ䘉њ᫽֌㌫㔏ˈഐѪ䘉њ਽ᆇᴹӋཚ㠚 ൘ Linus Ⲵ㠚ՐljJust for FunNJаҖѝˈLinus 䀓䟺䈤2˖ Linux 䘉њ਽〠ቡᔰ࿻⍱ՐлᶕDŽ ᖸнௌ⅒䘉њ਽〠DŽԆ䇔Ѫᰒ❦ᱟ Linus Ⲵ᫽֌㌫㔏ቡਆަ䉀丣 Linux ֌Ѫ䈕᫽֌㌫㔏Ⲵⴞᖅ੗ˈҾᱟ ᙚ䈎Ⲵǃᙚ⢙ǃᔲᜣཙᔰㅹ᜿ᙍDŽ൘ԆሶᯠⲴ᫽֌㌫㔏к䖭ࡠ ftp.funet.fi ᴽ࣑ಘкᰦˈ㇑⨶ઈ Ari Lemke Linux ᫽֌㌫㔏ࡊᔰ࿻ᰦᒦ⋑ᴹ㻛〠֌ LinuxˈLinus 㔉ԆⲴ᫽֌㌫㔏ਆ਽Ѫ FREAXˈަ㤡᮷ਜ਼ѹᱟ 1.1.7 Linux ੃〦Ⲻ⭧ᶛ 2.6.14 2005.11.9 47 MB 2.4.31 2005.6.1 37 MB 2.2.26 2004.2.25 19 MB 2.0.40 2004.2.8 7.2 MB ޵Ṩ⡸ᵜਧ ਁᐳᰕᵏ Ⓚԓ⸱བྷሿ(㓿 gz ঻㕙ਾ) 㺞 ̢ ᯦޻ṮⓆԙ⸷ᆍ㢸ᮦ ਴њѫ㾱っᇊ⡸ᵜⲴᴰᯠ⡸㿱㺘 1–2 ᡰ⽪DŽ ᐳⲴ 2.6.14 ⡸DŽަѝवᤜབྷ㓖 16000 њ᮷Ԧˈ֯⭘ gz ঻㕙ਾⓀԓ⸱䖟Ԧवҏᴹ 47MB ᐖਣʽޜ11 ᴸ 9 ᰕ 㾱ԫ࣑ᔰ࿻ਈᡀሩ޵ṨⲴ㔤ᣔ઼ߣᇊᱟ੖䟷⭘Ḁњ㺕б〻ᒿDŽࡠ⧠൘Ѫ→ˈᴰᯠⲴ޵Ṩ⡸ᵜᱟ 2005 ᒤ ਖཆˈӾ 0.95 ⡸ᔰ࿻ˈሩ޵ṨⲴ䇨ཊ᭩䘋ᐕ֌˄ᨀ׋㺕б〻ᒿ˅൷ԕަԆӪѪѫҶˈ㘼 Linus Ⲵѫ ҶᴰࡍⲴᒦ㹼ਓ傡ࣘ〻ᒿㅹDŽ ᤱ䙂ᖂㅖਧ䬮᧕˗Ľ᭟ᤱ 4 њѢ㹼ㄟਓ˗ľ᭟ᤱ⺜ⴈ࠶४˗Ŀ᭟ᤱᴤཊ⿽㊫䭞ⴈ˗ŀJames Wiegand 㕆ࡦ 䱫ຎ㇑䚃᮷Ԧ᫽֌˗Ļ㌫㔏䟽੟˄Ctrl-Alt-Del˅˗swapon()㌫㔏䈳⭘ˈӾ㘼ਟԕᇎᰦ䘹ᤙӔᦒ䇮༷˗ļ᭟ ਈॆ䜘࠶ᴹ˖ķ໎࣐Ҷⲫᖅ⭼䶒˗ĸRoss Biro ␫࣐Ҷ䈳䈅ԓ⸱˄ptrace˅˗Ĺ䖟ⴈ傡ࣘಘ⻱䚃㕃ߢ˗ĺ䶎 MINIX ᮷Ԧ㌫㔏Ⲵԓ⸱㻛᭮䘋Ҷঅ⤜ањ MINIX ᆀⴞᖅѝDŽ0.95 ⡸޵ṨⲴަԆаӋ ޣབྷ㤳ത䈳ᮤDŽᴹ ㌫㔏 VFS 㔃ᶴDŽ㲭❦ᖃᰦӽ❦ਚ᭟ᤱ MINIX ᮷Ԧ㌫㔏ˈնᱟ〻ᒿ㔃ᶴᐢ㓿Ѫ᭟ᤱཊ⿽᮷Ԧ㌫㔏䘋㹼Ҷ  LQX[ Ⲵ䈎⭏઼ਁኅ/ POSIX ḷ߶ -- 䈕ḷ߶൘᧘ࣘ Linux ᫽֌㌫㔏ԕਾᵍ⵰↓㿴䐟кਁኅ䎧⵰䟽㾱Ⲵ֌⭘DŽᱟ Linux ࡽ ਚᱟ᫽֌㌫㔏Ⲵањ޵Ṩˈ⋑ᴹ GNU 䖟Ԧ⧟ຳ(∄ྲ䈤 bash shell)ˈࡉ Linux ሶረ↕䳮㹼DŽ GNU 䇑ࡂ-- ᔰਁ Linux ᫽֌㌫㔏ˈԕ৺ Linux кᡰ⭘བྷཊᮠ䖟Ԧสᵜк䜭ࠪ㠚 GNU 䇑ࡂDŽLinux ⭼Ⲵབྷᆖѝ࡞䎧ҶᆖҐ UNIX ㌫㔏᯻仾DŽLinux ࡊᔰ࿻ቡᱟ৲➗ MINIX ㌫㔏Ҿ 1991 ᒤ᡽ᔰ࿻ᔰਁDŽ цޘAndrew S. Tanenbaum ᔰਁᆼᡀDŽ⭡Ҿ MINIX ㌫㔏Ⲵࠪ⧠ᒦфᨀ׋Ⓚԓ⸱(ਚ㜭ݽ䍩⭘Ҿབྷᆖ޵)൘ MINIX ᫽֌㌫㔏 -- MINIX ᫽֌㌫㔏ҏᱟ UNIX Ⲵа⿽ݻ䲶㌫㔏ˈᆳҾ 1987 ᒤ⭡㪇਽䇑㇇ᵪᮉᦸ Ⲵ䟽㾱ᙗቡн⭘ཊ䈤ҶDŽ UNIX ᫽֌㌫㔏 -- UNIX Ҿ 1969 ᒤ䈎⭏൘ Bell ᇎ傼ᇔDŽLinux ቡᱟ UNIX Ⲵа⿽ݻ䲶㌫㔏DŽUNIX 䙊䗷к䘠䈤᰾ˈᡁԜਟԕሩк䘠 Linux Ⲵӄབྷ᭟ḡᖂ㓣ྲл˖ ൰ǃѫ亥ԕ৺ѫ㾱䍑⥞һ䘩ㅹؑ᚟DŽ ࠪ䖳བྷ䍑⥞Ⲵ䘁 400 ӪⲴ਽অࡇ㺘ˈवᤜԆԜⲴ email ൠ൰઼䙊ؑൠڊ ަѝԕᆇ⇽亪ᒿࡇࠪҶሩ Linux ࠪҶᶱབྷⲴ䍑⥞ˈ䘉䟼ቡнааࡇѮҶDŽѫ㾱䍑⥞㘵Ⲵާփ਽অਟ৲㿱 Linux ޵ṨѝⲴ CREDITS ᮷Ԧˈ ڊ Linux ㌫㔏ᒦнᱟӵᴹ䘉Ӌѝඊ࣋䟿ቡ㜭ਁኅᡀӺཙ䘉њṧᆀⲴˈ䘈ᴹ䇨ཊ䇑㇇ᵪ儈᡻ሩ Linux ਨᐕ֌DŽޜ 䎧㘵ѻаDŽᴮ㓿൘ Linux Journal ᵲᘇ⽮ᐕ֌ˈ⧠൘ RedHat Linux ᫽֌㌫㔏ⲴӪѻа(Ӿ 0.97 ⡸)DŽԆ䘈ᱟ㪇਽ Linux ᮷ẓ䇑ࡂ˄Linux Document Project - LDP˅Ⲵਁ lj޵Ṩ唁ᇒ᡻޼NJ˄The Linux Kernel Hackers' Guide˅аҖⲴ֌㘵 Michael K. Johnson ҏᱟᴰᰙ᧕䀖 ⡸)DŽ Ԇ䍏䍓㔤ᣔ Linux ޵Ṩ 2.4.x Ⲵԓ⸱DŽ㘼 Linus ѫ㾱䍏䍓ᔰਁᴰᯠᔰਁ⡸޵ṨⲴ⹄ࡦ(ཷᮠ⡸ˈ∄ྲ 2.5.x ਨᴮ㓿䚰䈧Ԇ࣐ⴏˈնԆতᒢ㜶ൠᤂ㔍ҶDŽӾ 2001 ᒤᔰ࿻ˈޜ Linus ѻਾᴰѪ䟽㾱ⲴӪ⢙DŽԕਾ Microsoft Ҷ Linux Ⲵᔰਁ䱏ԽˈᒦᡀѪ㔤ᣔ Linux ޵ṨⓀԓ⸱Ⲵѫ㾱䍏䍓Ӫѻаˈҏਟԕ䈤ᡀѪ Linux ⽮ഒѝ㔗 ޕᒿˈ䜭⋑ᴹ㻛 Linus 䟷㓣˅ˈᒦᡀѪ Linux ㌫㔏к TCP/IP 㖁㔌ԓ⸱Ⲵᴰᰙ֯⭘ӪѻаDŽਾᶕԆ䙀⑀࣐ Linux 0.95 ⡸ਁᐳѻਾˈԆᔰ࿻Ѫ Linux ㌫㔏㕆߉㺕б〻ᒿ˄؞᭩〻ᒿ˅˄䇠ᗇԆᴰᰙⲴєњ㺕б〻 ਩ Linux ᇎ⧠ᗇᐗ࿉(beautifully)DŽ Ҿ Linux অ⭘ᡧ䘀㹼⁑ᔿ䰞仈Ⲵ䇘䇪ѝˈԆ⭊㠣䎎ޣ㖁㔌ᯩ䶒Ⲵᇎ⧠DŽ൘ޣ䏓ˈቔަᱟᴹޤ㌫㔏ӗ⭏Ҷ ᮠᆖॿ༴⨶ಘⲴˈᡰԕԆᆹ㻵Ҷ Linux ㌫㔏DŽҾᱟԆᔰ࿻ᆖҐᑖᴹݽ䍩Ⓚԓ⸱Ⲵ Linuxˈᒦᔰ࿻ሩ Linux 䍝㖞Ҷаਠ 386SX ⭥㝁DŽ⭡Ҿ 386BSD 䴰㾱ᮠᆖॿ༴⨶ಘ᭟ᤱˈ㘼䟷⭘ Intel 386SX CPU Ⲵ⭥㝁ᱟнᑖ ֌㌫㔏DŽ⭡Ҿ⋑䫡ˈণ֯ᱟ MINIX ㌫㔏ԆҏҠн䎧DŽᖃ Linux 0.11 ઼ 386BSD ਁᐳᰦˈԆ㘳㲁㢟ѵᙫ㇇ 㹼⑨ᠿⲴ䙏ᓖԕ৺㖁㔌Ր䗃䙏ᓖˈԆ䴰㾱䘹ᤙањᴰѪ┑᜿Ⲵ᫽֌ᒣਠDŽҾᱟԆᔰ࿻᧕䀖਴⿽㊫රⲴ᫽ ធធൠԆᔰ࿻ሩ䇑㇇ᵪ㖁㔌⵰䘧䎧ᶕDŽѪҶ⧙⑨ᠿᒦᨀ儈⭥㝁䘀ˈޣ⭡Ҿ MUD ⑨ᠿо㖁㔌ᇶ࠷⴨ аㇷ MUD Ⲵਁኅਢ(rec.games.mud ᯠ䰫㓴ˈ1992 ᒤ 3 ᴸ 9 ᰕˈA history of MUD)DŽ ⑨ᠿ˅DŽ൘ 90 ᒤԓᰙᵏ games.mud ᯠ䰫㓴Ⲵ posts ѝ֐ਟԕ᢮ࡠԆਁ㺘Ⲵབྷ䟿ᑆᆀDŽԆ⭊㠣Ѫ↔䘈߉Ҷ College)DŽࡊᔰ࿻Ԇ⢩࡛ௌ⅒⧙⭥㝁⑨ᠿˈቔަᱟ MUD˄Multi-User Dungeon or Dimensionˈཊ⭘ᡧ㖁㔌 Linux ⽮४ѝਖаս㪇਽Ӫ⢙ᱟ Alan CoxDŽԆ৏ᐕ֌Ҿ㤡ഭေቄ༛ᯟᰪ㾯བྷᆖ(Swansea University Linux ḷ߶㿴㤳 LSB(Linux Standard Base)ㅹᯩ䶒Ⲵᐕ֌DŽ ޣᢰᵟѝᗳᐕ֌ˈᒦӾһ⵰ᴹ ˄2002 ᒤ 5 ᴸ˅Ⲵ Linux Journal ᵏ࠺ሶԆ֌ѪҶሱ䶒Ӫ⢙ˈᒦሩԆ䘋㹼Ҷ䟷䇯DŽⴞࡽˈԆѪ IBM Linux ৸᧘ࠪҶ ext3 ᮷Ԧ㌫㔏DŽ䈕㌫㔏བྷབྷᨀ儈Ҷ᮷Ԧ㌫㔏Ⲵっᇊᙗ઼䇯䰞᭸⦷DŽ֌ѪሩԆⲴ᧘ጷˈㅜ 97 ᵏ ѻаᱟᨀࠪᒦᇎ⧠Ҷ ext2 ᮷Ԧ㌫㔏DŽ䈕᮷Ԧ㌫㔏⧠ᐢᡀѪ Linux ц⭼ѝһᇎкⲴ᮷Ԧ㌫㔏ḷ߶DŽᴰ䘁Ԇ ftp ㄉ⛩˄tsx-11.mit.edu˅ˈ㘼ф䈕ㄉ⛩㠣Ӻӽ❦Ѫᒯབྷ Linux ⭘ᡧᨀ׋ᴽ࣑DŽԆሩ Linux ֌ࠪⲴᴰབྷ䍑⥞ Ⲵᐕ֌DŽ൘े㖾⍢ൠ४Ԇᴰᰙ䇮・Ҷ Linux Ⲵޣ〻ᒿ kmalloc.c)DŽⴤࡠⴞࡽѪ→Ԇӽ❦Ӿһ⵰о Linux ᴹ ҏᱟᴰᰙੁ Linux ޵Ṩ␫࣐〻ᒿⲴӪ˄Linux ޵Ṩ 0.10 ⡸ѝⲴ㲊ᤏⴈ傡ࣘ〻ᒿ ramdisk.c ઼޵Ṩ޵ᆈ࠶䝽 ࠪ䍑⥞DŽԆڊ ᛵѪ linux Ⲵਁኅᨀ׋Ҷ MaillistˈࠐѾᱟ൘ Linux ࡊᔰ࿻ਁᐳᰦ䎧ˈԆቡаⴤ൘Ѫ Linux  LQX[ Ⲵ䈎⭏઼ਁኅ/ ᐡⲴ䴰㾱䘋㹼䰵䈫DŽն൘࠶᷀ᰦ䘈ᱟᨀ׋ҶаӋᓄ⭘ᇎֻDŽ ᶏ޵Ṩᔰ࿻䈳⭘ shell 〻ᒿѪ→DŽަ։Ⲵ਴њ〻ᒿ൷䪸ሩަ㠚䓛䘋㹼࠶᷀ˈ⋑ᴹ䘎䍟ᙗˈഐ↔ਟԕṩᦞ㠚 ᤜሩ Makefile ᮷ԦⲴ⌘䟺DŽ࠶᷀䗷〻ѫ㾱ᱟ᤹➗䇑㇇ᵪ੟ࣘ䗷〻䘋㹼ⲴDŽഐ↔࠶᷀Ⲵ䘎䍟ᙗࡠࡍ࿻ॆ㔃 ᵜ᮷ѫ㾱䈖㓶࠶᷀ linux-0.11 ޵ṨѝⲴᡰᴹⓀԓ⸱〻ᒿˈሩ⇿њⓀ〻ᒿ᮷Ԧ䜭䘋㹼Ҷ䈖㓶⌘䟺ˈव ᐕާ〻ᒿ઼৏ᶕਁᐳⲴаӋᆹ㻵䈤᰾䈤᰾᮷ẓDŽ „ http://oldlinux.org/Linux.old/Linux-0.11/ 䈕ⴞᖅѝਜ਼ᴹਟԕ൘ Linux 0.11 ㌫㔏ѝ֯⭘ⲴަԆаӋ Ⲵ Linux ㌫㔏DŽ „ http://oldlinux.org/Linux.old/bochs/ 䈕ⴞᖅѝਜ਼ᴹᐢ㓿䇮㖞ྭⲴ䘀㹼൘䇑㇇ᵪԯⵏ㌫㔏 bochs л 0.11 ޵ṨⓀԓ⸱〻ᒿDŽ „ http://oldlinux.org/Linux.old/kernels/ 䈕ⴞᖅѝਜ਼ᴹ޵ṨⓀԓ⸱〻ᒿˈवᤜᵜҖᡰ᧿䘠Ⲵ Linux ᮷Ԧ rootimageDŽۿԦ㌫㔏᱐ ᮷Ԧ bootimage ઼ṩ᮷ۿ„ http://oldlinux.org/Linux.old/images/ 䈕ⴞᖅѝਜ਼ᴹᐢ㓿ࡦ֌ྭⲴ޵Ṩ᱐ кл䖭DŽާփл䖭ⴞᖅս㖞ᱟ˖ ⧟ຳл֯⭘Ⲵ gcc 1.40 㕆䈁ಘˈ䝽㖞ࠪਟ⭘Ⲵᇎ傼ᔰਁ⧟ຳDŽⴞࡽˈ䘉Ӌ᮷Ԧ൷ਟԕӾ oldlinux.org 㖁ㄉ ਟԕ֯⭘Ⲵ rootimage-0.11 ṩ᮷Ԧ㌫㔏DŽᒦ䟽ᯠѪަ㕆䈁ࠪ㜭൘ 0.11ޘLinux 0.11 䟽ᯠࡦ֌ࠪҶањᆼ ⴞࡽ䲔Ҷ৏ᶕⲴ rootimage.Z ᮷ԦˈަԆഋњ᮷Ԧ൷㜭᢮ࡠDŽн䗷֌㘵ᐢ㓿࡙⭘ Internet кⲴ䍴ⓀѪ INSTALL-0.11 ᱟ Linux 0.11 ㌫㔏Ⲵㆰঅᆹ㻵䈤᰾᮷ẓDŽ as86.tar.Z ᱟ 16 ս≷㕆ಘ䬮᧕〻ᒿ䖟ԦवDŽlinux-0.11.tar.Z ᱟ঻㕙Ⲵ Linux 0.11 ޵ṨⓀԓ⸱DŽ ⴈDŽ ᔰਁ〻ᒿԕ৺ᡰᴹަԆ⭘ᡧᮠᦞᡆ᮷ᵜ᮷ԦㅹDŽ䘉єњⴈਸ䎧ᶕቡ⴨ᖃҾаᕐਟ੟ࣘⲴ DOS ᫽֌㌫㔏 Ҿ Linux ㌫㔏ѝ֯⭘Ⲵ UNIX ㊫᮷Ԧ㌫㔏ˈަѝѫ㾱वᤜаӋ㿴ᇊⲴⴞᖅǃ䝽㖞᮷Ԧǃ䇮༷傡ࣘ〻ᒿǃ Ҿੁ޵Ṩᨀ׋ᴰสᵜ᭟ᤱⲴṩ᮷Ԧ㌫㔏ˈަѝवᤜ᫽֌㌫㔏ᴰ䎧⸱ⲴаӋ䝽㖞᮷Ԧ઼ભԔᢗ㹼〻ᒿDŽሩ 㓸࣐䖭〻ᒿՊᢺ᧗ࡦᵳӔ㔉޵Ṩԓ⸱DŽ޵Ṩԓ⸱㤕㾱↓ᑨ䘀㹼ቡ䴰㾱᮷Ԧ㌫㔏Ⲵ᭟ᤱDŽrootimage ቡᱟ⭘ ޵ᆈѝˈ❦ਾᢺ᧗ࡦᵳӔ㔉᫽֌㌫㔏࣐䖭〻ᒿ৫䘋а↕߶༷޵ṨⲴࡍ࿻ॆ᫽֌ˈᴰޕ઼޵Ṩᢗ㹼ԓ⸱䈫 ޵ᆈˈ㘼ᕅሬᡷ४ԓ⸱ࡉ䍏䍓ᢺ᫽֌㌫㔏࣐䖭〻ᒿޕᒿՊᢺ唈䇔੟ࣘ傡ࣘಘкⲴᕅሬᡷ४ԓ⸱઼ᮠᦞ䈫 ަѝѫ㾱वᤜ⻱ⴈᕅሬᡷ४ԓ⸱ǃ᫽֌㌫㔏࣐䖭〻ᒿ઼޵Ṩᢗ㹼ԓ⸱DŽPC ᵪ੟ࣘᰦ ROM BIOS ѝⲴ〻 Image˅᮷ԦDŽbootimage ᱟᕅሬ੟ࣘ Image ᮷Ԧˈ˄ۿ bootimage.Z ઼ rootimage.Z ᱟ঻㕙Ⲵ䖟ⴈ᱐ ,167$//ᴤᯠ䗷Ⲵᆹ㻵ؑ᚟᮷ԦDŽ 〻ᒿ˗ޕҼ䘋ࡦᢗ㹼᮷ԦDŽᱟ  սⲴ≷㕆〻ᒿ઼㻵 DVWDU=%UXFH(YDQV .%ˈኅᔰਾҏӵᴹ .%˗ OLQX[WDU=޵ṨⓀԓ⸱᮷ԦDŽབྷሿѪ ᮷Ԧ˗ۿURRWLPDJH=ԕ N% ঻㕙Ⲵṩ᮷Ԧ㌫㔏᱐ ᮷Ԧ˗ۿERRWLPDJH=ާᴹ㖾ഭ䭞ⴈԓ⸱Ⲵ঻㕙੟ࣘ᱐ ᰕਁᐳⲴDŽ൘ਁᐳᰦवᤜԕл᮷Ԧ˖ ᵜ᮷ሶѫ㾱ሩ Linux Ⲵᰙᵏ޵Ṩ 0.11 ⡸䘋㹼䈖㓶᧿䘠઼⌘䟺DŽLinux-0.11 ⡸ᵜᱟ൘ 1991 ᒤ 12 ᴸ 8 1.2 ޻ᇯ㔲䘦 ਚ㜭ਁኅࡠ 0.13(0.95)⡸Ⲵ≤ᒣDŽ ц⭼Ⲵᰐᮠ䇑㇇ᵪ唁ᇒⲴᰐ⿱ཹ⥞ˈ䛓Ѹ Linux ᴰཊޘ INTERNET -- ྲ᷌⋑ᴹ Intenet 㖁ˈ⋑ᴹ䙽ᐳ 䘋Ⲵ⚟ຄDŽ  ޵ᇩ㔬䘠 䜘䘋㹼䰵䈫˗ㅜй䜘࠶Ӿㅜ 8 ㄐࡠㅜ 13 ㄐᱟ޵Ṩԓ⸱Ⲵѫ㾱䜘ޘ߶༷䱦⇥ˈ֌ѪᆖҐ޵ṨⲴࡍᆖ㘵ᓄ䈕 ᣔ⁑ᔿлⲴ㕆〻৏⨶˗ㅜҼ䜘࠶वᤜㅜ 5 ㄐ㠣ㅜ 7 ㄐˈ᧿䘠޵Ṩᕅሬ੟઼ࣘ 32 ս䘀㹼ᯩᔿⲴ؍ 80X86 䘀㹼ᵪࡦDŽ䘉䜘࠶䖳Ѫ䈖㓶ൠӻ㓽Ҷᗞර䇑㇇ᵪ⺜Ԧ㓴ᡀǃ㕆ࡦ Linux ޵Ṩ〻ᒿ֯⭘Ⲵ㕆〻䈝䀰ԕ৺ Intel 䗷〻ˈ䛓Ѹቡ䴰㾱Ҷ䀓ᆳⲴ⺜Ԧ䘀㹼⧟ຳˈቔަᱟ༴⨶ಘཊԫ࣑ޘDŽྲ᷌ᜣᖫᓅ⨶䀓᫽֌㌫㔏䘀㹼ޣ⴨ ᵜҖ޵ᇩਟԕ࠶Ѫӄњ䜘࠶DŽㅜ 1 ㄐ㠣ㅜ 4 ㄐᱟส⹰⸕䇶䜘࠶DŽ᫽֌㌫㔏оᡰ䘀㹼Ⲵ⺜Ԧ⧟ຳᇶ࠷    0DNHILOH E\WHV    WRROV    PP    OLE    NHUQHO    LQLW    LQFOXGH    IV    ERRW *07  䈤᰾  ਽〠 བྷሿ ᴰਾ؞᭩ᰕᵏ  ࡍ㺞 1-1 Linux/ⴤᖋ ᶴ൷ᱟԕ linux ѪᖃࡽⴞᖅDŽ Ⲵ⅑ᒿਟ৲㿱ࡽ䶒Ⲵ᮷Ԧࡇ㺘㍒ᕅDŽᮤњ Linux ޵ṨⓀԓ⸱Ⲵⴞᖅ㔃ᶴྲлࡇ㺘 1.1 ᡰ⽪DŽᡰᴹⴞᖅ㔃 Ⓚԓ⸱Ⲵ㓴ᡀ㔃ᶴᶕ䘋㹼Ⲵˈสᵜкᱟԕ⇿њⓀԓ⸱ѝⲴⴞᖅѪаㄐ޵ᇩ䘋㹼ӻ㓽DŽӻ㓽ⲴⓀ〻ᒿ᮷Ԧ ᤱ㔃ᶴⲴᆼᮤᙗˈሩԓ⸱Ⲵ䈤᰾ᱟԕ޵Ṩѝ؍ᵜ᮷ሩ Linux ޵ṨѝᡰᴹⲴԓ⸱䜭䘋㹼Ҷ䈤᰾DŽѪҶ Ⲵสᵜ৏⨶ѻਾ޽৫࠶᷀䘉Ӌԓ⸱DŽ ㌫нᱟ䶎ᑨབྷˈഐ↔ਟԕ൘Ҷ䀓Ҷ Linux ᐕ֌ޣLinux ѝⲴ㖁㔌ԓ⸱สᵜкᱟ㠚ᡀаփⲴˈо޵Ṩᵪࡦ TCP/IP 㖁㔌ㅹᯩ䶒ⲴаӋᖃࡽ䶎ᑨ䟽㾱Ⲵԓ⸱ˈሩ޵ᆈⲴ࠶䝽઼֯⭘о⧠ӺⲴ޵Ṩҏᴹᡰ४࡛DŽնྭ൘ у䰘Ⲵ䘋〻ㅹᖵ䱏ࡇǃޣ᤯ Linux 0.11 ⡸䘋㹼ᆖҐҏᴹн䏣ѻ༴DŽ∄ྲ䈕޵Ṩ⡸ᵜѝቊнवᤜᴹ ቡਟԕ䘋㹼↓ᑨⲴ䘀㹼ҶDŽ ᮷Ԧ(rootimage)ˈ䛓Ѹᆳۿ᮷Ԧ(bootimage)ˈਟԕ⭘ᶕ䘋㹼ᕅሬ╄⽪DŽྲ᷌޽䝽кㆰঅⲴṩ᮷Ԧ㌫㔏᱐ ۿᒿ㔃ᶴࡉо⧠൘ⲴสᵜкᱟаṧⲴDŽਖཆањ৏ഐᱟਟԕ᢮ࡠ 0.11 ⡸ᰙᵏⲴᐢ㓿㕆䈁ࡦ֌ྭⲴ޵Ṩ᱐ ԕ৺ሩⲫ䱶〻ᒿⲴ䈤᰾DŽᒦфަᕅሬ੟ࣘ〻ᒿⲴ㔃ᶴҏоⴞࡽⲴ⡸ᵜнཚаṧˈ㘼 0.11 ⡸Ⲵᕅሬ੟ࣘ〻 Ṩԓ⸱ᴹཚཊⲴн䏣ѻ༴ˈ⭊㠣䘈⋑ᴹवᤜሩ䖟ⴈⲴ傡ࣘ〻ᒿˈҏ⋑ᴹᖸྭൠ⎹৺ᮠᆖॿ༴⨶ಘⲴ֯⭘ ѪӰѸн࠶᷀ᴤሿⲴ Linux 0.01 ⡸޵ṨⓀԓ⸱઒˛ᆳਚᴹ 240K ᆇ㢲ᐖਣāѫ㾱৏ഐᱟഐѪ 0.01 ⡸Ⲵ޵ ᡻ˈޕ䜘䜭ⴻᆼDŽҏ䇨֐㾱䰞Āᰒ❦㾱Ӿㆰޘᑨབྷˈᴹ 200 ݶᆇ㢲ˈণ֯֐㣡а⭏Ⲵ㓿শᶕ䰵䈫ҏᵚᗵ㜭 Ⓚԓ⸱ਚᴹ 325K ᆇ㢲ᐖਣˈަѝवᤜⲴ޵ᇩสᵜк䜭ᱟ Linux Ⲵ㋮儃DŽ㘼ⴞࡽᴰᯠⲴ 2.6.XX ⡸޵Ṩ䶎 ᤯ Linux 0.11 ⡸޵ṨᶕĀᔰ࠰āᱟѪҶᨀ儈ᡁԜ䇔䇶 Linux 䘀㹼ᵪ⨶Ⲵ᭸⦷DŽLinux-0.11 ⡸ᮤњ޵Ṩ 㘵䇔Ѫ䘉⿽䀓䈫ᯩ⌅㾱∄অ⤜ࡇࠪаㄐ޵ᇩᶕᙫփӻ㓽⺜ԦᡆަԆ⸕䇶㾱᭸⦷儈ᗇཊDŽ ᴹࣙҾ࣐␡ሩԓ⸱Ⲵ⨶䀓ˈ৸㜭ᴤྭⲴҶ䀓ᡰ⭘⺜ԦⲴ֯⭘ᯩ⌅ˈ֌ڊᒦࡇࠪ֯⭘ⲴભԔ઼ᯩ⌅DŽ䘉ṧ 䗃ࠪ᫽֌ᰦˈሶሩ Intel ѝᯝ᧗ࡦಘ˄8259A˅㣟⡷㔉ࠪ䈖㓶Ⲵ䈤᰾ˈ/ޕ㓽˗൘䙷ࡠሩѝᯝ᧗ࡦಘ䘋㹼䗃 ྲˈ൘䰵䈫ԓ⸱ཤа⅑䙷ࡠ C 䈝䀰޵፼≷㕆⸱ᰦˈሶሩ GNU C 䈝䀰Ⲵ޵፼≷㕆䈝䀰䘋㹼䖳Ѫ䈖㓶Ⲵӻ ⸕䇶Ⲵ䈖㓶ӻ㓽DŽ∄ޣᡰᴹⲴ〻ᒿ൘࠶᷀䗷〻ѝྲ᷌䙷ࡠ֌㘵䇔Ѫᱟ䖳䳮⨶䀓Ⲵ䈝ਕᰦˈሶ㔉ࠪ⴨  ޵ᇩ㔬䘠 ᣔ⁑ᔿ䘀㹼ᯩᔿᴹ䏣ཏⲴ⨶䀓ˈഐ↔൘䰵䈫ᵜㄐ〻ᒿᰦˈ䲔Ҷਟԕ৲㘳ᵜㄐ൘䘲ᖃൠᯩव؍ᗞ༴⨶ಘⲴ ㅜ 13 ㄐ䀓䈤 mm/ⴞᖅѝⲴ޵ᆈ㇑⨶〻ᒿDŽ㾱䘿ᖫൠ⨶䀓䘉ᯩ䶒Ⲵ޵ᇩˈᡁԜቡ䴰㾱ሩ Intel 80X86 ㌫㔏ᱟਚ᭟ᤱ MINIX а⿽᮷Ԧ㌫㔏ˈLinux 0.11 ⡸ҏнֻཆDŽ MINIX ᮷Ԧ㌫㔏Ⲵㄐ㢲ˈഐѪᴰࡍⲴ Linux ޣAndrew S. Tanenbaum Ⲵlj᫽֌㌫㔏䇮䇑оᇎ⧠NJаҖѝᴹ ал㘼৫䰵䈫ڌㅜ 12 ㄐӻ㓽޵ṨⓀԓ⸱ fs/ⴞᖅѝⲴ᮷Ԧ㌫㔏〻ᒿˈ൘ⴻ䘉ㄐ޵ᇩᰦᔪ䇞֐㜭ཏᲲ ⵏ↓ᔰ࿻᭟ᤱॿ༴⨶ಘˈഐ↔ᵜㄐⲴ޵ᇩ䖳ቁˈҏ∄䖳ㆰঅDŽਚ䴰ᴹа㡜ᙗⲴҶ䀓ণਟDŽ ㅜ 11 ㄐӻ㓽 kernel/math/ⴞᖅѝⲴᮠᆖॿ༴⨶ಘⲴԯⵏ〻ᒿDŽ⭡ҾᵜҖᡰ⌘䟺Ⲵ޵Ṩ⡸ᵜˈ䘈⋑ᴹ ԦⲴҖ㉽DŽ⺜ޣⲴ޵ᇩDŽ൘䰵䈫ᰦ䴰㾱৲㘳ал⴨ޣ䇮༷DŽഐ↔ᵜㄐҏਜ਼ᴹ䖳ཊо⺜Ԧᴹ ࣘ〻ᒿǃ䭞ⴈ傡ࣘ〻ᒿ઼ᱮ⽪ಘ傡ࣘ〻ᒿDŽ䘉Ӌ傡ࣘ〻ᒿᶴᡀҶ 0.11 ޵Ṩ᭟ᤱⲴѢ㹼㓸ㄟ઼᧗ࡦਠ㓸ㄟ ㅜ 10 ㄐሩ kernel/chr_drv/ⴞᖅѝⲴᆇㅖ䇮༷傡ࣘ〻ᒿ䘋㹼⌘䟺䈤᰾DŽ䘉аㄐѝѫ㾱⎹৺Ѣ㹼㓯䐟傡 ޵ᇩᰦ䴰৲㘳аӋ⺜Ԧ䍴ᯉDŽᴰྭ㜭俆ݸ⍿㿸ал᮷Ԧ㌫㔏Ⲵㄐ㢲DŽ Ⲵ޵ᇩDŽഐ↔ˈ൘䰵䈫䘉ㄐޣ傡ࣘ〻ᒿˈѫ㾱⭘ᶕо᮷Ԧ㌫㔏઼儈䙏㕃ߢ४ᢃӔ䚃ˈਜ਼ᴹ䖳ཊо⺜Ԧ⴨ ㅜ 9 ㄐሩ kernel/blk_drv/ⴞᖅѝⲴඇ䇮༷〻ᒿ䘋㹼Ҷ⌘䟺䈤᰾DŽ䈕ㄐѫ㾱ਜ਼ᴹ⺜ⴈǃ䖟ⴈㅹඇ䇮༷Ⲵ ᔿ≷㕆䈝ਕⲴสᵜ䈝⌅䈧৲㿱ㅜ 3 ㄐⲴ䈤᰾DŽޕ፼ޣⲴ≷㕆䈝ਕDŽᴹޕՊ䙷ࡠᖸཊ C 䈝䀰〻ᒿѝ፼ ㌫㔏䈳⭘Ⲵ〻ᒿDŽ↔ᰦ֐ᓄ䈕ᐢ㓿ሩަѝⲴаӋ䟽㾱〻ᒿᴹᡰҶ䀓DŽӾᵜㄐ޵ᇩᔰ࿻ˈᡁԜޣ࠭ᮠ઼ᴹ ㅜ 8 ㄐѫ㾱ӻ㓽 kenel/ⴞᖅѝⲴᡰᴹ〻ᒿDŽަѝᴰ䟽㾱Ⲵ䜘࠶ᱟ䘋〻䈳ᓖ࠭ᮠ schedule()ǃsleep_on() 㔏ǃ㌫㔏䈳⭘ǃ਴⿽傡ࣘ〻ᒿㅹ䘋㹼ᴤ␡а↕Ⲵ䰵䈫DŽ 䰘Ҷ-ˈն֐䘈䴰㾱ሩ᮷Ԧ㌫ޕ〻ᒿᰦˈ֐ᓄ䈕ᐢ㓿ሩ Linux ޵ṨᴹҶаᇊⲴҶ䀓ˈਟԕ䈤ᐢ㓿ᴹаॺ Ⲵ࠭ᮠ൘޵Ṩѝ㻛ᒯ⌋֯⭘ˈഐ↔䈕ㄐ޵ᇩᓄ䈕ᴰݸ䘹䈫DŽᖃ֐㜭ⵏ↓ⴻ៲ⴤࡠ main.c 〻ᒿѪ→Ⲵᡰᴹ 㾱ḕⴻަᡰ䈳⭘ⲴަԆ〻ᒿˈഐ↔ሩਾ㔝ㄐ㢲Ⲵ䰵䈫ਟԕ᤹➗䘉䟼䈳⭘Ⲵ亪ᒿ䘋㹼DŽ⭡Ҿ޵ᆈ㇑⨶〻ᒿ 䭞ൠᯩDŽ൘ᆼᡀҶ㌫㔏ᡰᴹⲴࡍ࿻ॆᐕ֌ਾˈࡋᔪҶ⭘Ҿ shell Ⲵ䘋〻DŽ൘ӻ㓽䈕〻ᒿᰦሶ䴰ޣᑨ䘀㹼Ⲵ ↓ޕㅜ 7 ㄐѫ㾱ӻ㓽 init/ⴞᖅѝ޵Ṩ㌫㔏Ⲵࡍ࿻ॆ〻ᒿ main.cDŽᆳᱟ޵Ṩᆼᡀᡰᴹࡍ࿻ॆᐕ֌ᒦ䘋 Ҷ߶༷DŽྭڊṨ㌫㔏ᢗ㹼䘋а↕Ⲵࡍ࿻ॆᐕ֌ ᣔ⁑ᔿ䘀㹼ѻࡽⲴᡰᴹᐕ֌DŽѪ޵؍ս 32 ޕ࣐䖭ࡠ޵ᆈⲴᐕ֌ˈᒦሩ㌫㔏䝽㖞৲ᮠ䘋㹼᧒⍻ˈᆼᡀҶ䘋 ᮠⲴ setup.s ≷㕆〻ᒿ઼ 32 ս䘀㹼੟ࣘԓ⸱〻ᒿ head.sDŽ䘉йњ≷㕆〻ᒿᆼᡀҶᢺ޵ṨӾඇ䇮༷кᕅሬ ㅜ 6 ㄐሶ䈖㓶⌘䟺 boot/ⴞᖅлⲴйњ≷㕆〻ᒿˈަѝवᤜ⻱ⴈᕅሬ〻ᒿ bootsect.sǃ㧧 ਆ BIOS ѝ৲ Makefile ᮷ԦⲴ޵ᇩDŽ䈕᮷Ԧᱟᡰᴹ޵ṨⓀ〻ᒿⲴ㕆䈁㇑⨶䝽㖞᮷Ԧˈ׋㕆䈁㇑⨶ᐕާ䖟Ԧ make ֯⭘DŽ ֯⭘࠶䝽DŽᴰਾᔰ࿻⌘䟺޵Ṩ〻ᒿवѝ Linux/ⴞᖅлⲴᡰⴻࡠⲴㅜањ᮷Ԧˈҏণ޵Ṩԓ⸱Ⲵᙫփ 㠤࣏㜭DŽ䘈ӻ㓽Ҷ Linux ሩ⢙⨶޵ᆈⲴ֯⭘࠶䝽ᯩᔿǃ޵ṨⲴࠐ⿽ึḸ৺ަ֯⭘ᯩᔿ઼㲊ᤏ㓯ᙗൠ൰Ⲵ ㅜ 5 ㄐᾲ㾱ൠ᧿䘠Ҷ Linux ᫽֌㌫㔏Ⲵփ㌫㔃ᶴǃ޵ṨⓀԓ⸱᮷Ԧ᭮㖞Ⲵ㓴㓷㔃ᶴԕ৺⇿њ᮷Ԧབྷ ѝᯝ઼ᔲᑨ༴⨶ǃԫ࣑㇑⨶ԕ৺ањㆰঅⲴཊԫ࣑޵Ṩ⽪ֻDŽ ᣔ⁑ᔿ޵ᆈ㇑⨶ǃ؍80X86 CPU Ⲵ Linux ޵ṨⓀԓ⸱ᢃл᡾ᇎส⹰DŽަѝѫ㾱वᤜ˖80X86 ส⹰⸕䇶ǃ ᣔ⁑ᔿл㕆〻ⲴаӋส⹰⸕䇶ˈѪ߶༷䰵䈫สҾ؍ㅜ 4 ㄐѫ㾱ᾲ㾱᧿䘠 80X86 CPU Ⲵփ㌫㔃ᶴԕ৺ Ҷ Makefile ᮷ԦⲴ֯⭘ᯩ⌅DŽ ᮠㅹᑨ⭘ C 䈝䀰ᢙኅ޵ᇩ䘋㹼䈤᰾ˈ਼ᰦ䈖㓶᧿䘠Ҷ C ઼≷㕆࠭ᮠѻ䰤Ⲵ⴨ӂ䈳⭘ᵪࡦDŽᴰਾㆰঅ᧿䘠 ≷㕆〻ᒿⲴ䈝⌅઼֯⭘ᯩ⌅ˈ❦ਾሩ GNU C 䈝䀰ѝⲴ޵㚄≷㕆ǃ䈝ਕ㺘䗮ᔿǃᇴᆈಘਈ䟿ԕ৺޵㚄࠭ 0.11 ޵ṨⓀԓ⸱ᡰ䴰㾱Ⲵ≷㕆䈝䀰઼ GNU C 䈝䀰ᢙኅ⸕䇶DŽᵜㄐ俆ݸ∄䖳䈖㓶ൠӻ㓽Ҷ as86 ઼ GNU as ㅜ 3 ㄐӻ㓽 Linux 0.11 ޵Ṩѝ֯⭘Ⲵ㕆〻䈝䀰ǃⴞḷ᮷ԦṬᔿ઼㕆䈁⧟ຳˈѫ㾱ⴞḷᱟᨀ׋䰵䈫 Linux ᚟DŽؑޣ䘉ṧ㜭ཏѪ䛓Ӌ⋑ᴹᆖ䗷䇑㇇ᵪ㓴ᡀ৏⨶Ⲵ䈫㘵ᨀ׋䏣ཏⲴᴹ ㌫DŽ਼ᰦҏоⴞࡽᴰᯠᗞᵪⲴ㓴ᡀṶമ֌ㆰঅ∄䖳DŽޣᵪⲴ㓴ᡀ䜘࠶DŽӻ㓽਴њѫ㾱䜘࠶Ⲵ࣏㜭઼⴨ӂ ㅜ 2 ㄐ俆ݸสҾՐ㔏ᗞᵪ㌫㔏Ⲵ⺜Ԧ㓴ᡀṶമˈѫ㾱ӻ㓽 Linux ޵Ṩ䘀㹼ѻкⲴ IBM PC/AT386 ᗞ PC ᵪ⁑ᤏ䖟Ԧ㌫㔏 Bochs 䪸ሩ Linux 0.11 ޵Ṩ䘋㹼਴⿽ᇎ傼⍫ࣘDŽ ᇩˈਟԕ֌Ѫ䰵䈫ㅜй䜘࠶Ⓚԓ⸱Ⲵ৲㘳ؑ᚟DŽᴰਾа䜘࠶ӵवᤜㅜ 17 ㄐ޵ᇩˈަѝӻ㓽Ҷྲօ֯⭘ ࠶DŽަѝㅜ 8 ㄐ޵ᇩਟԕ֌Ѫ䰵䈫䘉䜘࠶ਾ㔝ㄐ㢲Ⲵѫ㾱㓯㍒ᶕ䘋㹼DŽㅜ 14 ㄐࡠㅜ 16 ㄐᱟㅜഋ䜘࠶޵  ޵ᇩ㔬䘠 ᵜҖᰦᴰᯠⲴ Linux ޵Ṩᱟ 2.6.12 ⡸DŽᖃ֐㜭ᘛ䙏⨶䀓䘉ӋᔰਁѝⲴᴰᯠ⡸ᵜ⭊㠣㜭ᨀࠪ㠚ᐡⲴᔪ䇞઼ ᴤཊⲴⓀԓ⸱ˈᴰྭᱟᗚᒿ⑀䘋ൠӾ 1.0 ⡸ᵜᔰ࿻ⴤࡠᴰᯠⲴ↓൘ᔰਁѝⲴཷᮠ㕆ਧⲴ⡸ᵜDŽ൘᫠߉䘉 ֐ਚᱟࡊࡊ䐿к Linux Ⲵᖱ䙄ˈާᴹҶаᇊⲴᡀѪањ Linux ޵Ṩ儈᡻Ⲵࡍ↕⸕䇶DŽ䘉ᰦ֐ᓄ䈕৫䰵䈫 䀓Ҷᵜ᮷ᡰ䀓䈤Ⲵа࠷ᰦˈᒦнԓ㺘֐ᐢ㓿ᡀѪањ Linux 㹼ᇦҶˈ⨶ޘᴰਾ㾱䈤᰾Ⲵᱟᖃ֐ᐢ㓿ᆼ 㜭ཏᯩׯⲴ᢮ࡠˈ㘼ф൘㔃ਸⓀԓ⸱䰵䈫ᰦˈሩаӋสᵜᾲᘥ㜭ᴹᴤ␡Ⲵ⨶䀓DŽ ѫ㾱ᱟѪҶڊሩҾ䰵䈫ᵜҖᡰ䴰㾱ⲴаӋสᵜᾲᘥ⸕䇶Ⲵӻ㓽䜭ᮓᐳ൘਴њㄐ㢲⴨ᓄⲴൠᯩˈ䘉ṧ ⸕䇶䘋㹼䈤᰾DŽྲ᷌൘ⴻᆼ䘉Ӌؑ᚟ਾഎཤ޽⍿㿸а䙽〻ᒿˈ֐Պᴹᴤ␡аቲⲴփՊDŽޣᯩ䶒Ⲵ⴨ Ⲵ䀓ࢆˈᒦሩԓ⸱ѝࠪ⧠ⲴаӋ䈝䀰ᡆ⺜Ԧޕ␡ㅹҏᨀ׋Ҷнቁᴹ⭘Ⲵؑ᚟DŽ൘ԓ⸱ѻਾᱟሩ〻ᒿᴤѪ օᯩ䶒Ⲵ᭩ࣘᡆࡐ䲔ˈഐѪ C 䈝䀰ᱟа⿽㤡䈝㊫䈝䀰ˈ〻ᒿѝ৏ᴹⲴቁ䟿㤡᮷⌘䟺ሩᑨᮠㅖਧǃਈ䟿਽ ㌫ˈ❦ਾࡇࠪ〻ᒿⲴᆼᮤԓ⸱ᒦ൘ަѝሩԓ⸱䘋㹼䈖㓶⌘䟺ˈ⌘䟺ᰦሩ৏〻ᒿԓ⸱ᡆ᮷ᆇн֌ԫޣᒿⲴ 䗃ࠪ৲ᮠԕ৺оަԆ〻ޕ൘ሩ⇿њ〻ᒿ䘋㹼䀓䈤ᰦˈᡁԜ俆ݸㆰঅ䈤᰾〻ᒿⲴѫ㾱⭘䙄઼ⴞⲴǃ䗃 ਟԕӾ Tanenbaum ⲴҖѝ㧧ᗇDŽޘ ᮷Ԧ㌫㔏аㄐ޵ᇩᰦˈ᮷Ԧ㌫㔏Ⲵᐕ֌৏⨶ᯩ䶒Ⲵ⸕䇶ᆼޣѝҏӵ᭟ᤱ䈕᮷Ԧ㌫㔏ˈᡰԕ൘䰵䈫ᵜҖᴹ ⧠NJаҖⲴㅜ 1 ⡸DŽLinus ѫ㾱֯⭘Ҷ䈕Җѝ᧿䘠Ⲵ MINIX ᮷Ԧ㌫㔏 1.0 ⡸ˈ㘼ф൘ᰙᵏⲴ Linux ޵Ṩ ᣔ⁑ᔿ㕆〻ᯩ⌅ⲴྭҖDŽ䘈ᴹаᵜቡᱟ Andrew S.Tanenbaum 㪇ⲴljMINIX ᫽֌㌫㔏䇮䇑оᇎ؍80x86 л ޵Ṩᐕ֌৏⨶ᯩ䶒Ⲵ৲㘳Җ㉽DŽਖаᵜᱟ John H. Crawford ㅹ㕆㪇ⲴljProgramming the 80386NJˈᱟ䇢䀓 ⌅ˈLinux ޵ṨⓀԓ⸱ѝᖸཊ䟽㾱࠭ᮠⲴ਽〠䜭ਆ㠚䈕ҖDŽഐ↔ˈ൘䰵䈫ᵜҖᰦˈ䘉ᱟаᵜᗵнਟቁⲴ ㌫㔏䇮䇑NJˈ䈕Җ᧿䘠Ҷ UNIX System V ޵ṨⲴᐕ֌৏⨶઼ᮠᦞ㔃ᶴDŽLinus ֯⭘Ҷ䈕Җѝᖸཊ࠭ᮠⲴ㇇ Linus ൘ᴰࡍᔰਁ Linux ᫽֌㌫㔏޵Ṩᰦˈѫ㾱৲㘳Ҷ 3 ᵜҖDŽаᵜᱟ M. J. Bach 㪇ⲴljUNIX ᫽֌ ᰾⺞ൠࡇࠪާփ䴰㾱৲㘳ଚаㇷ HOWTO ᮷ㄐˈ㘼ᒦнᱟӵӵ㔉ࠪ LDP Ⲵ㖁ㄉൠ൰ҶһDŽ 㑱ᵲ߼ҡⲴ᮷⥞ࡇ㺘DŽ∄ྲ൘ᕅ⭘ Linux ᮷ẓ亩ⴞ LDP˄Linux Document Project˅ѝⲴ᮷ԦᰦˈᡁԜՊ ᮷⥞ѝˈᡁԜӵ㔉ࠪҶ൘䰵䈫Ⓚԓ⸱ᰦਟԕ৲㘳ⲴҖ㉽ǃ᮷ㄐㅹؑ᚟ˈᒦ⋑ᴹव㖇з䊑ൠ㔉ࠪаབྷึⲴ PC ᵪ⺜Ԧᯩ䶒Ⲵؑ᚟DŽ൘৲㘳 ޣѪҶׯҾḕ䰵ˈ൘ᵜҖⲴ䱴ᖅѝ䘈অ⤜ࡇࠪҶ޵Ṩѝ㾱⭘ࡠⲴᴹ ᔿ䘀㹼ᵪࡦⲴㆰ᰾᧿䘠DŽ ᣔ⁑؍ᴰਾᱟ䱴ᖅ઼㍒ᕅDŽ䱴ᖅѝ㔉ࠪҶ Linux ޵ṨѝⲴаӋᑨᮠᇊѹ઼สᵜᮠᦞ㔃ᶴᇊѹˈԕ৺ Ⓚԓ⸱Ⲵ䈝⌅֯ަ㜭൘ RedHat 9 ㌫㔏л亪࡙㕆䈁ࠪ↓⺞Ⲵ޵ṨᶕDŽ ԯⵏ㌫㔏л֯⭘઼㕆䈁 Linux ޵ṨⲴᯩ⌅ԕ৺⻱ⴈ䮌䊑᮷ԦⲴࡦ֌ᯩ⌅DŽ䘈䈤᰾Ҷྲօ؞᭩ Linux 0.11 ㅜ 17 ㄐӻ㓽ҶᆖҐ޵ṨⓀԓ⸱ᰦⲴᇎ傼⧟ຳԕ৺ࣘ᡻ᇎᯭ਴⿽ᇎ傼Ⲵᯩ⌅DŽѫ㾱ӻ㓽Ҷ൘ Bochs image˅᮷ԦDŽ kernel˄ۿԦѝˈᆳӵ⭘Ҿሶ޵ṨѝⲴ⻱ⴈᕅሬ〻ᒿඇоަԆѫ㾱޵Ṩ⁑ඇ䘎᧕ᡀањᆼᮤⲴ޵Ṩ᱐ Image˅᮷˄ۿㅜ 16 ㄐӻ㓽 tools/ⴞᖅлⲴ build.c 〻ᒿDŽ䘉њ〻ᒿᒦнՊवᤜ൘㕆䈁⭏ᡀⲴ޵Ṩ᱐ ᒦнᱟᖸཊˈഐ↔ᡁԜਟԕᖸᘛൠⴻᆼDŽ䘉ҏᱟᡁԜѪӰѸ䘹ᤙ 0.11 ⡸Ⲵ৏ഐѻаDŽ ㌫㔏〻ᒿᨀ׋Ҷ᧕ਓ࠭ᮠˈሩԕਾ⨶䀓㌫㔏䖟ԦՊᴹ䖳བྷⲴᑞࣙDŽ⭡Ҿ䘉њ⡸ᵜ䖳վˈᡰԕ䘉䟼Ⲵ޵ᇩ ㅜ 15 ㄐӻ㓽Ҷ Linux 0.11 ⡸޵ṨⓀԓ⸱ lib/ⴞᖅѝⲴᡰᴹ᮷ԦDŽ䘉Ӌᓃ࠭ᮠ᮷Ԧѫ㾱ੁ㕆䈁㌫㔏ㅹ ӽ❦䴰㾱Ҷ䀓䘉Ӌཤ᮷ԦѝⲴ䇨ཊ㓶㢲DŽ ࡠDŽ㲭❦䈕ㄐ޵ᇩѫ㾱ᱟѪ䰵䈫ަԆㄐ㢲ѝⲴ〻ᒿ֌৲㘳֯⭘Ⲵˈնᱟ㤕ᜣᖫᓅ⨶䀓޵ṨⲴ䘀㹼ᵪࡦˈ Ӌ㓿ᑨ㾱⭘ࡠⲴ䟽㾱Ⲵᮠᦞ㔃ᶴ઼ਈ䟿䘋㹼Ҷᖂ㓣⌘䟺ˈն䘉Ӌ޵ᇩᇎ䱵к䜭㜭൘䘉аㄐⲴཤ᮷Ԧѝ᢮ њᇊѹǃ⇿ањᑨ䟿ᡆᮠᦞ㔃ᶴ䜭䘋㹼Ҷ䈖㓶⌘䟺DŽѪҶׯҾ൘䰵䈫ᰦ৲㘳ḕ䰵ˈᵜҖ൘䱴ᖅѝ䘈ሩа Ṩ〻ᒿᰦՊ⻠ࡠ䇨ཊ䳌⺽DŽᵜҖㅜ 14 ㄐሩ include/ⴞᖅѝⲴᡰᴹཤ᮷Ԧ䘋㹼Ҷ䈖㓶䈤᰾ˈสᵜкሩ⇿а ⧠ᴹⲴ Linux ޵Ṩ࠶᷀Җ㉽а㡜䜭㕪ѿሩ޵Ṩཤ᮷ԦⲴ᧿䘠ˈഐ↔ሩҾањࡍᆖ㘵ᶕ䇢ˈ൘䰵䈫޵ ᇎֻ֌Ѫሩ䊑䘋㹼䀓䈤ˈഐ↔ਟԕᴤྭൠ⨶䀓޵ᆈ㇑⨶Ⲵᐕ֌৏⨶DŽ ᣔ⁑ᔿ䘀㹼ᯩᔿᾲ㾱䈤᰾ԕཆˈ䘈ᓄ䈕਼ᰦ৲㘳ㅜ 4 ㄐ޵ᇩDŽ⭡ҾᵜㄐԕⓀԓ⸱ѝⲴ䘀⭘؍ ਜ਼Ⲵ 80X86  ޵ᇩ㔬䘠 ᇩDŽ Ⲵ䈎⭏䎧ࡠҶнਟᘭ㕪Ⲵ৲㘳ǃInternet ᱟ Linux ᡀ䮯઼༞བྷⲴᗵ㾱⧟ຳDŽᴰਾᵜㄐᾲ䘠ҶҖѝⲴสᵜ޵ POSIX ḷ߶Ⲵࠪ⧠Ѫ Linux ᨀ׋Ҷᇎ⧠оḷ߶ެᇩ㌫㔏Ⲵ৲㘳ᤷইǃA.S.T Ⲵ MINIX ᫽֌㌫㔏Ѫ Linux ᇎ⧠Ⲵสᵜ৏⨶઼㇇⌅ǃRichard Stallman Ⲵ GNU 䇑ࡂѪ Linux ㌫㔏ᨀ׋ҶѠᇼфݽ䍩Ⲵ਴⿽ᇎ⭘ᐕާǃ 俆ݸ䱀䘠Ҷ Linux 䈎⭏઼ਁኅнਟ㕪ቁⲴӄњ᭟ḡ˖UNIX ᴰࡍⲴᔰ᭮৏ԓ⸱⡸ᵜѪ Linux ᨀ׋Ҷ 1.3 ᵢㄖቅ㔉 㺕б˄patch˅〻ᒿᰦˈᡁҏ⭈ᤌл仾Ҷ-DŽ  ᵜㄐሿ㔃 E  D 㜭Ⓚ 䗃ࠪ䜘࠶ޕ䜘࠶ 䗃ࠪ䜘࠶ ༴⨶ѝᗳ 䗃ޕ༴⨶ѝᗳ䗃 㜭Ⓚ 䐟㣟⡷Ѫѫ㓴ᡀⲴ࣏㜭⭥䐟DŽֻྲˈѝᯝ᧗ࡦಘ⭡ Intel 8259A ᡆަެᇩ㣟⡷ᶴᡀ˗DMA ᧗ࡦಘ䙊ᑨ䟷⭘ മѝк䜘᧗ࡦಘ઼ᆈۘಘ᧕ਓ䙊ᑨ䜭䳶ᡀ൘䇑㇇ᵪѫᶯкˈ䘉Ӌ᧗ࡦಘ࠶࡛䜭ᱟԕаඇབྷ㿴⁑䳶ᡀ⭥ ൰オ䰤㤳തᴹ 232 ᆇ㢲ˈӾ 0 ࡠ 4GBDŽ ֌DŽሩҾ֯⭘ 80386 CPU Ⲵ PC ᵪˈަ޵䜘ൠ൰㓯઼ᮠᦞ㓯䜭࠶࡛ᴹ 32 ṩˈণ䜭ᱟ 32 սⲴDŽഐ↔ൠ൰ራ ᮠᦞ㓯⭘Ҿ൘ CPU ઼޵ᆈᡆ I/O 䇮༷ѻ䰤ᨀ׋ᮠᦞՐ䗃Ⲵ䙊䚃ˈ㘼᧗ࡦ㓯ࡉ䍏䍓ᤷᥕᢗ㹼Ⲵާփ䈫/߉᫽ о㌫㔏ަԆ䜘࠶䘋㹼ᮠᦞ䙊ؑDŽൠ൰㓯⭘Ҿᨀ׋޵ᆈᡆ I/O 䇮༷Ⲵൠ൰ˈণᤷ᰾䴰㾱䈫/߉ᮠᦞⲴާփս㖞DŽ ᡀ㔃ᶴ㿱മ 2-2 ᡰ⽪DŽަѝˈCPU 䙊䗷ൠ൰㓯ǃᮠᦞ㓯઼᧗ࡦؑਧ㓯㓴ᡀⲴᵜൠᙫ㓯˄ᡆ〠Ѫ޵䜘ᙫ㓯˅ ⷠⲴ䀂ᓖᶕ䈤᰾䟷⭘ 80386 ᡆԕк CPU Ⲵ PC ᵪ㌫㔏㓴ᡀ㔃ᶴDŽањՐ㔏ᗞර䇑㇇ᵪ⺜Ԧ㓴؟ᡁԜӾ 2.1 ᗤශ䇗㇍ᵰ㓺ᡆ৕⨼ ᡆԕк CPU Ⲵ IBM PC ৺ަެᇩᗞᵪˈ㘼 PC ࡉ⭘ᶕ⌋ᤷᡰᴹᗞᵪˈवᤜ IBM PC/XT ৺ަެᇩᗞᵪDŽ ޵ᇩᐢสᵜ㜭ཏᔪ・䎧䰵䈫 Linux 0.11 ޵ṨⲴ⺜Ԧส⹰DŽѪҶׯҾ䈤᰾ˈᵟ䈝 PC/AT ሶ⭘ᶕᤷ⽪ާᴹ 80386 䀓ᆳⲴ䘀㹼⺜Ԧ⧟ຳDŽᵜㄐสҾՐ㔏ᗞᵪ㌫㔏Ⲵ⺜Ԧ㓴ᡀṶമˈӻ㓽Ҷᗞᵪѝ਴њѫ㾱䜘࠶Ⲵ࣏㜭DŽ䘉Ӌ 䗷〻ˈ䛓Ѹቡ䴰㾱ҶޘDŽྲ᷌ᜣᖫᓅ⨶䀓᫽֌㌫㔏䘀㹼ޣਟ㿱ˈ᫽֌㌫㔏оᡰ䘀㹼Ⲵ⺜Ԧ⧟ຳᇶ࠷⴨ ਓоަԆ䜘࠶⴨䘎˗㘼ሩҾ䘀㹼൘ަкⲴ䖟Ԧᯩ䶒ˈᡁԜࡉу䰘䈖㓶᧿䘠 Linux ᫽֌㌫㔏޵ṨⲴᇎ⧠DŽ ᗞර䇑㇇ᵪ৺ަެᇩᵪⲴ⺜Ԧ㌫㔏ˈ䇑㇇ᵪⲴ CPU 㣟⡷ਟԕⴤ᧕ⴻ֌ᱟ㌫㔏Ⲵ༴⨶ѝᗳˈᆳ䙊䗷ᙫ㓯᧕ ⧠DŽ൘⺜Ԧᯩ䶒ˈᡁԜᾲ㾱䈤᰾สҾ Intel 80X86 ѝཞ༴⨶ಘ˄CPU -- Central Processing Unit˅Ⲵ IBM PC 䗃ࠪ䜘࠶Ⲵ⺜Ԧ㓴ᡀ৏⨶઼䖟Ԧ᧗ࡦⲴᇎ/ޕањ䇑㇇ᵪ㌫㔏Ⲵ䘀㹼ᵪࡦˈѫ㾱䈤᰾㌫㔏Ⲵ༴⨶ѝᗳ઼䗃 㔤᧗ࡦ⵰ӪփⲴᙍᜣ઼ࣘ֌аṧˈ䖟Ԧਟԕⴻ֌ᱟ䇑㇇ᵪĀབྷ㝁āѝⲴؑ᚟઼ᙍ㔤DŽᵜҖ᧿䘠Ⲵѫ仈ቡᱟ ᱟ䖟Ԧ䘀㹼઼ᆈۘⲴᒣਠDŽ䖟Ԧᱟа⿽᧗ࡦ⺜Ԧ᫽֌઼ࣘ֌ⲴᤷԔ⍱DŽ⣩ྲᆈۘҾӪ㊫བྷ㝁ѝⲴؑ᚟઼ᙍ 䇑㇇ᵪ㌫㔏ਟ࠶Ѫ⺜Ԧ䜘࠶઼䖟Ԧ䜘࠶ˈնє㘵ѻ䰤ӂ⴨׍ᆈDŽ⺜Ԧ䜘࠶ᱟ䇑㇇ᵪ㌫㔏Ⲵਟ㿱䜘࠶ˈ ഴ ㌱㔕ะᵢ㓺ᡆ  ⁑රᶕ᧿䘠ˈ㘼ањᆼᮤⲴ䇑㇇ᵪ㌫㔏ᮤփࡉ⭡䘉Ӌᆀ㌫㔏ᶴᡀDŽ 䊑䇑㇇ᵪᡆᖸཊ༽ᵲ㌫㔏ᶕ䈤ˈަѝ਴њᆀ䜘࠶䜭ਟԕ⤜・ൠⴻ֌ањᆼᮤⲴᆀ㌫㔏ˈᒦфҏ㜭֯⭘䘉њ ӛ֯⭘Ⲵˈഐ↔മ 2-1 ѝ(b)ᓄ䈕ᴤ㜭ᚠᖃൠᣭ䊑㺘⽪ањ䇑㇇ᵪ㌫㔏DŽᖃ❦ˈޡ࠶ѻ䰤Ⲵ䙊䚃ᡆ᧕ਓ䜭ᱟ 䗃ࠪ䜘/ޕ䇑㇇ᵪ㌫㔏ҏнֻཆˈᆳҏѫ㾱⭡䘉ഋ䜘࠶㓴ᡀDŽн䗷൘޵䜘ˈ䇑㇇ᵪ㌫㔏Ⲵ༴⨶ѝᗳо䗃 䗃ࠪ䜘࠶᫽֌ᡰ䴰㾱Ⲵ㜭䟿DŽ઼ޕवᤜ䗃 Ⲵؑ᚟ᡆᮠᦞ˗㓿䗷༴⨶ѝᗳ࣐ᐕਾ޽⭡䗃ࠪ䜘࠶䘱ࠪDŽ㜭Ⓚ䜘࠶Ѫᮤњ㌫㔏ᨀ׋᫽֌䘀㹼Ⲵ㜭Ⓚ׋㔉ˈ ㌫㔏ޕ䜘࠶⭘Ҿ᧕᭦䘋ޕԫօањ㌫㔏䜭ਟ䇔Ѫ⭡ഋњสᵜ䜘࠶㓴ᡀˈ㿱മ 2-1 ᡰ⽪Ⲵ⁑රDŽަѝ䗃 ㅜ2ㄐᗞර䇑㇇ᵪ㓴ᡀ㔃ᶴ   ᗞර䇑㇇ᵪ㓴ᡀ৏⨶ ᙫ㓯 ᆈۘಘ &026 ᧗ࡦಘ 䭞ⴈ 䇑ᮠಘ ᇊᰦ ᧗ࡦಘ '0$ ᧗ࡦಘ ѝᯝ ᧗ࡦ㓯 ᮠᦞ㓯 ൠ൰㓯 ᧗ࡦ঑ ⺜ⴈ ᧗ࡦ঑ 䖟傡 ᧗ࡦ঑ Ѣ㹼ਓ ᧗ࡦ঑ ᢃঠᵪ ᧗ࡦ঑ ᱮ⽪ಘ ᧕ਓ ᆈۘಘ &38  кㄟ˄ণൠമкⲴই䜘઼े䜘˅ս㖞ˈᒦ䎧⵰о CPU 䘋㹼䙊䚃ẕ᧕Ⲵ֌⭘DŽ ᐳⲴިර PC ᵪѫᶯкˈᆳԜ࠶࡛սҾѫ⡸Ⲵлㄟ઼ޜਨޜ ेāẕᶕ࠶࡛㔏〠䘉єњ㣟⡷ˈᱟ⭡Ҿ൘ Intel PCI ᙫ㓯ǃIDE ⺜ⴈ᧕ਓǃUSB ㄟਓㅹˈഐ↔ইẕ㣟⡷Ⲵ਽〠Ѫ ICH˄I/O Controller Hub˅DŽѻᡰԕ⭘Āইǃ Intel ᢺ䈕㣟⡷ḷਧѪ MCH˄Memory Controller Hub˅㣟⡷DŽইẕ㣟⡷⭘ᶕ㇑⨶վǃѝ䙏Ⲵ㓴Ԧˈֻྲˈ о CPUǃ޵ᆈ઼ AGP 㿶仁᧕ਓˈ䘉Ӌ᧕ਓާᴹᖸ儈ⲴՐ䗃䙏⦷DŽेẕ㣟⡷䘈䎧⵰ᆈۘಘ᧗ࡦ֌⭘ˈഐ↔ Ⲵ㣟⡷㓴ᡆ㣟⡷䳶˄Chipsets˅㓴ᡀ˖ेẕ˄Northbridge˅㣟⡷઼ইẕ˄Southbridge˅㣟⡷DŽेẕ㣟⡷⭘Ҿ Ⲵ㓴ᡀ㔃ᶴ䙊ᑨਟԕ֯⭘മ 2-3 ᶕ᧿䘠DŽ䲔Ҷ CPU ԕཆˈ⧠ԓ PC ᵪѫᶯѫ㾱֯⭘ 2 њ䎵བྷ㿴⁑㣟⡷ᶴᡀ ઼࣏㜭ˈᒦфѪҶ䇙㌫㔏Ⲵн਼䜘࠶䜭㜭䗮ࡠަᴰ儈Ր䗃䙏⦷ˈᙫ㓯㔃ᶴҏਁ⭏ҶᖸབྷਈॆDŽ⧠ԓ PC ᵪ ㇇ᵪѫᵪᶯкቁᮠࠐњ䎵བྷ㿴⁑䳶ᡀ⭥䐟㣟⡷ѝˈࠐњ⭊㠣ᱟањ䘉ṧⲴ㣟⡷ቡ⺞ᇊҶѫᵪᶯⲴѫ㾱⢩ᙗ 䲿⵰䇑㇇ᵪᢰᵟⲴਁኅˈᖸཊ৏ᶕ֯⭘᧗ࡦ঑ᶕᆼᡀⲴ࣏㜭˄ֻྲ⺜ⴈ᧗ࡦಘ࣏㜭˅䜭ᐢ㓿䳶ᡀ൘䇑 ᴰࡍⲴ 80386 ᵪಘкਚᴹ ISA ᙫ㓯ˈഐ↔㌫㔏оཆ䜘 I/O 䇮༷ᴰཊਚ㜭֯⭘ 16 սᮠᦞ㓯䘋㹼ᮠᦞՐ䗃DŽ 儈ǃ᧗ࡦᴤ⚥⍫Ⲵᙫ㓯᧕ਓ䘈൘нᯝ᧘ࠪˈֻྲ䟷⭘Ѣ㹼䙊ؑ⛩ሩ⛩ᢰᵟⲴ儈䙏 PCIE˄PCI Express˅ᙫ㓯DŽ ㅹDŽ䘉Ӌᙫ㓯᧕ਓⲴѫ㾱४࡛൘ҾᮠᦞՐ䗃䙏⦷઼᧗ࡦ⚥⍫ᙗᯩ䶒DŽ䲿⵰䇑㇇ᵪ⺜ԦⲴਁኅˈՐ䗃䙏⦷ᴤ PCI˄Peripheral Component Interconnect˅ᙫ㓯ǃ࣐䙏മᖒㄟਓ AGP˄Accelerated Graphics Port˅㿶仁ᙫ㓯 ISA˄Industry Standard Architecture˅ᙫ㓯ǃᢙኅᐕъḷ߶㔃ᶴᙫ㓯 EISA˄Extented ISA˅ǃཆത㓴Ԧӂ䘎 ൰ᙫ㓯ǃᮠᦞᙫ㓯઼᧗ࡦ㓯Ⲵоᢙኅ䇮༷᧗ࡦಘⲴḷ߶䘎᧕᧕ਓDŽ䘉Ӌᙫ㓯᧕ਓḷ߶䙊ᑨᴹᐕъḷ߶㔃ᶴ മѝлᯩⲴ᧗ࡦ঑˄ᡆ㘵〠Ѫ䘲䝽ಘ˅ࡉᱟ䙊䗷ᢙኅᨂоѫᶯк㌫㔏ᙫ㓯䘎᧕DŽᙫ㓯ᨂᱟ㌫㔏ൠ മ Ր㔏 ,%03& ৺ަެᇩ䇑㇇ᵪⲴ㓴ᡀṶമ  㣟⡷ᶕо䭞ⴈѝⲴᢛ᧿⭥䐟䘋㹼䙊ؑDŽ Intel 8237A 㣟⡷ᶴᡀ˗ᇊᰦ䇑ᮠಘⲴṨᗳࡉᱟ Intel 8253/8254 ᇊᰦ㣟⡷˗䭞ⴈ᧗ࡦಘ֯⭘Ⲵᱟ Intel 8042   ᗞර䇑㇇ᵪ㓴ᡀ৏⨶ $*3 ᙫ㓯 ㌫㔏ᙫ㓯 ᆈۘಘᙫ㓯 %,26 )ODVK ᧕ਓ 㖁㔌 䙊䚃 $7$ 䙊䚃 ༠仁  ,&+ ,2 ইẕ㣟⡷ ᧗ࡦಘ $*3 ᧕ਓ ᆈۘಘ  0&+ ,2 ेẕ㣟⡷ ᧕ਓ 86% &38 3&, ᢙኅ 3&, ᙫ㓯 0x000 -- 0x01F 8237A DMA ᧗ࡦಘ 1 ㄟਓൠ൰㤳ത ࠶䝽䈤᰾ 㺞 ,2 ㄥਙ൦൶࠼䞃 ᖰ䘉њ޵ᆈ४ฏᢗ㹼߉᫽֌DŽ ᆈۘಘൠ൰オ䰤 0xB800 -- 0xBC00 㤳തDŽഐ↔㤕㾱䇙ањᆇㅖᱮ⽪൘ቿᒅкˈਟԕⴤ᧕֯⭘޵ᆈ᫽֌ᤷԔ ਖཆˈIBM PC ᵪҏ䜘࠶ൠ֯⭘Ҷ㔏а㕆൰ᯩᔿDŽֻྲˈCGA ᱮ⽪঑кᱮ⽪޵ᆈⲴൠ൰ቡⴤ᧕ঐ⭘Ҷ Ԧᰦ޽䈖㓶䘋㹼䈤᰾DŽ⺜ޣ֯⭘઼㕆〻ᯩ⌅ሶ൘ਾ䶒ާփ⎹৺⴨ Ҿ䘉ӋㄟਓⲴޣㄟਓൠ൰ਟ׋֯⭘DŽ਴њ᧗ࡦಘ઼᧗ࡦ঑ᡰ唈䇔࠶䝽֯⭘Ⲵㄟਓൠ൰㤳ത㿱㺘 2-1 ᡰ⽪DŽ ಘ䘋㹼ራ൰઼䇯䰞DŽ֯⭘ ISA ᙫ㓯㔃ᶴⲴՐ㔏 PC ᵪަ I/O ൠ൰オ䰤㤳തᱟ 0x000 -- 0x3FFˈᴹ 1024 њ I/O IBM PC ৺ަެᇩᗞᵪѫ㾱֯⭘⤜・㕆൰ᯩᔿˈ䟷⭘Ҷањ⤜・Ⲵ I/O ൠ൰オ䰤ሩ᧗ࡦ䇮༷ѝⲴᇴᆈ オ䰤DŽ⇿њㄟਓᴹањ I/O ൠ൰оѻሩᓄˈᒦф֯⭘у䰘Ⲵ I/O ᤷԔᶕ䇯䰞ㄟਓDŽ ਓ⤜・㕆൰Ⲵᯩ⌅ᱟᢺ I/O ᧗ࡦಘ઼᧗ࡦ঑Ⲵራ൰オ䰤অ⤜֌Ѫањ⤜・Ⲵൠ൰オ䰤ሩᖵˈ〠Ѫ I/O ൠ൰ 㕆൰DŽCPU 䇯䰞ањㄟਓⲴ᫽֌о䇯䰞޵ᆈⲴ᫽֌аṧˈҏ֯⭘䇯䰞޵ᆈⲴᤷԔDŽㄟۿᔿҏᡀѪᆈۘಘ᱐ ᆈۘಘራ൰ൠ൰オ䰤㤳ത޵DŽഐ↔䘉⿽㕆൰ᯩޕㄟਓ㔏а㕆൰Ⲵ৏⨶ᱟᢺ I/O ᧗ࡦಘѝⲴㄟਓൠ൰ᖂ 䇯䰞᧗ࡦಘᢗ㹼⣦ᘱⲴ⣦ᘱㄟਓDŽㄟਓൠ൰Ⲵ䇮㖞ᯩ⌅а㡜ᴹє⿽˖㔏а㕆൰઼⤜・㕆൰DŽ 〠Ѫ I/O ㄟਓൠ൰ᡆ㘵ㆰ〠ㄟਓDŽ䙊ᑨањ I/O ᧗ࡦಘवਜ਼䇯䰞ᮠᦞⲴᮠᦞㄟਓǃ䗃ࠪભԔⲴભԔㄟਓ઼ CPU ѪҶ䇯䰞 I/O ᧕ਓ᧗ࡦಘᡆ᧗ࡦ঑кⲴᮠᦞ઼⣦ᘱؑ᚟ˈ䴰㾱俆ݸᤷᇊᆳԜⲴൠ൰DŽ䘉⿽ൠ൰ቡ 2.2.1 I/O ㄥਙૂሱ൶ 2.2 I/O ㄥਙሱ൶ૂ䇵䰤᧝࡬ᯯᕅ ᰦ޽֌䈖㓶ӻ㓽DŽ 䈤᰾മ 2-2 ѝ਴њѫ㾱᧗ࡦಘ઼᧗ࡦ঑Ⲵᐕ֌৏⨶ˈ㘼ᆳԜⲴᇎ䱵㕆〻ᯩ⌅ࡉ᧘䘏ࡠ䰵䈫޵Ṩ⴨ᓄⓀԓ⸱ ᶴѪṶᷦᶕ䇘䇪઼ᆖҐ PC Ⲵ㓴ᡀ઼㕆〻ᯩ⌅ˈᖃ❦䘉Ӌᯩ⌅ӽ❦䘲ਸҾ⧠ԓ PC ᵪ㔃ᶴDŽл䶒ᡁԜᾲ㾱 䰘ᆖҐˈᡁԜӽ❦ԕՐ㔏 PC ᵪ㔃ޕPC ᵪкDŽ䘉Ӿ Intel Ⲵᔰਁ᡻޼кਟԕ䇱ᇎ䘉њ㔃䇪DŽᡰԕѪҶׯҾ 䈤ˈ䘉Ӌਈॆӽ❦оՐ㔏Ⲵ PC ᵪ㔃ᶴެᇩDŽഐ↔ѪՐ㔏 PC ᵪ⺜Ԧ㔃ᶴ㕆ࡦⲴ〻ᒿӽ❦㜭䘀㹼Ҿ⧠൘Ⲵ 㲭❦ᙫ㓯᧕ਓਁ⭏Ҷᖸབྷਈॆˈ⭊㠣Ӻਾेẕ઼ইẕ㣟⡷䜭ሶՊਸҼѪаˈնᱟሩҾᡁԜ㕆〻Ӫઈᶕ ഴ ⧦ԙ 3& ᵰ㣥⡽䳼Ṽഴ    ㄟਓራ൰઼䇯䰞᧗ࡦᯩᔿ 2,  ,QWHO&RUS GH3&,GHYLFHHHI XVEXKFLHHI  ,QWHO&RUS G3&,GHYLFHHHI XVEXKFLHHI  ,QWHO&RUS G3&,GHYLFHHHI YLDUKLQHGDGDII 9,$7HFKQRORJLHV,QF97>5KLQH,,@GDGDII 3&,FRQIFIFII  ,QWHO&RUS G3&,GHYLFHI  DXWR VHULDOIII LGHII YJDFGI LGH  DXWR VHULDOIII LGHII LGH ISXIII GPDFGI SLFDEI GPDSDJHUHJI UWFI NH\ERDUGI WLPHUI SLFI GPDI [root@plinux root]# cat /proc/ioports ᧗ࡦಘᡆ䇮㖞֯⭘Ⲵ I/O ൠ൰㤳തˈ㿱ྲлᡰ⽪DŽޣ㔏л䙊䗷ḕⴻ/proc/ioports ᮷Ԧਟԕᗇࡠ⴨ ሩҾ֯⭘ EISA ᡆ PCI ㅹᙫ㓯㔃ᶴⲴ⧠ԓ PC ᵪˈᴹ 64KB Ⲵ I/O ൠ൰オ䰤ਟ׋֯⭘DŽ൘Პ䙊 Linux ㌫ 0x3F8 -- 0x3FF Ѣ㹼᧗ࡦಘ 1 0x3F0 -- 0x3F7 䖟ⴈ᧗ࡦಘ 0x3D0 -- 0x3DF ᖙ㢢 EGA/VGA ᱮ⽪᧗ࡦಘ 0x3C0 -- 0x3CF ᖙ㢢 CGA ᱮ⽪᧗ࡦಘ 0x3B0 -- 0x3BF অ㢢 MDA ᱮ⽪᧗ࡦಘ 0x378 -- 0x37F ᒦ㹼ᢃঠᵪㄟਓ 1 0x2F8 -- 0x2FF Ѣ㹼᧗ࡦಘ 2 0x278 -- 0x27F ᒦ㹼ᢃঠᵪㄟਓ 2 0x1F0 -- 0x1F7 IDE ⺜ⴈ᧗ࡦಘ 0 0x170 -- 0x177 IDE ⺜ⴈ᧗ࡦಘ 1 0x0F0 -- 0x0FF ॿ༴⨶ಘ䇯䰞ㄟਓ 0x0C0 -- 0x0DF 8237A DMA ᧗ࡦಘ 2 0x0A0 -- 0x0BF 8259A ਟ㕆〻ѝᯝ᧗ࡦಘ 2 0x080 -- 0x09F DMA 亥䶒ᇴᆈಘ䇯䰞ㄟਓ 0x070 -- 0x07F 䇯䰞 CMOS RAM/ᇎᰦᰦ䫏 RTC˄Real Time Clock˅ㄟਓ 0x060 -- 0x06F 8042 䭞ⴈ᧗ࡦಘ 0x040 -- 0x05F 8253/8254A ᇊᰦ䇑ᮠಘ 0x020 -- 0x03F 8259A ਟ㕆〻ѝᯝ᧗ࡦಘ 1   ㄟਓራ൰઼䇯䰞᧗ࡦᯩᔿ 2, ߢ४઼޵ᆈ㲊ᤏⴈҏՊঐ⭘޵Ṩԓ⸱઼ᮠᦞਾ䶒Ⲵа䜘࠶޵ᆈ४ฏˈ䈕४ฏ䙊ᑨՊ䐘䎺 640K -- 1M Ⲵ४ 1M 㤳ത⭘Ҿ儈ㄟ㌫㔏 ROM BIOS Ⲵ᱐ሴ४DŽ1M--16M ሶ㻛޵Ṩ⭘Ҿ֌Ѫਟ࠶䝽Ⲵѫ޵ᆈ४DŽਖཆ儈䙏㕃 ᔰ࿻Ⲵ 128K ⭘֌ᱮ⽪޵ᆈ㕃ߢ४ˈ䲿ਾ䜘࠶⭘ҾަԆ᧗ࡦ঑Ⲵ ROM BIOS ᡆަ᱐ሴ४ฏˈ㘼 0xF0000 ࡠ ⮉⭘֌മѝᤷ᰾Ⲵ⭘䙄DŽަѝൠ൰ 0xA0000؍❦⭘ BIOS 䇮㖞Ⲵѝᯝੁ䟿㺘DŽ640K-- 1M ѻ䰤Ⲵ 384K ӽ 䛓Ѹ൘ Linux 0.1x ㌫㔏ѝˈ0--640K ሶ㻛⭘֌ᆈ᭮޵Ṩԓ⸱઼ᮠᦞDŽLinux ޵Ṩн֯⭘ BIOS ࣏㜭ˈҏн֯ ᡁԜⲴ䇑㇇ᵪѝᴹ 16MB Ⲵ⢙⨶޵ᆈˈྲٷ⭘֌㌫㔏޵ᆈDŽ䘉єњ⢩ᇊ㤳ത㻛⭘Ҿ I/O 䇮઼༷ BIOS 〻ᒿDŽ 384K˅઼ 0xFFFE0000 ࡠ 0xFFFFFFFF˄4G ༴Ⲵᴰਾа 64K˅㤳തԕཆⲴᡰᴹ޵ᆈ䜭ਟ ޡ ˄640K ࡠ 1M ᖃ䇑㇇ᵪк⭥ࡍ࿻ॆᰦˈ⢙⨶޵ᆈ㻛䇮㖞ᡀӾൠ൰ 0 ᔰ࿻Ⲵ䘎㔝४ฏDŽ䲔Ҷൠ൰Ӿ 0xA0000 ࡠ 0xFFFFF ԓ⸱ӽ❦Պ㻛༽ࡦࡠ䘉њ४ฏѝDŽ㿱മ 2-4 ᡰ⽪DŽ ս㖞༴ˈ㘼 BIOS ৏ᶕᡰ൘Ⲵս㖞ሶ൘䇑㇇ᵪᔰᵪࡍ࿻ॆᰦ㻛⭘֌ BIOS Ⲵᖡᆀ˄Shadow˅४ฏˈণ BIOS 䗃ࠪ〻ᒿ BIOS аⴤ༴Ҿ CPU 㜭ራ൰Ⲵ޵ᆈᴰ儈ㄟޕⲴ PC ᵪสᵜа㠤ˈਚᱟ৏ᶕ㌫㔏 ROM ѝⲴสᵜ䗃 ᤱо৏ᶕ؍❦޵ᆈᇩ䟿˅DŽնᱟѪҶо৏ᶕⲴ PC ᵪ൘䖟Ԧкެᇩˈ㌫㔏 1MB ԕл⢙⨶޵ᆈ֯⭘࠶䝽кӽ ഐ↔ CPU Ⲵ⢙⨶޵ᆈራ൰㤳തᐢ㓿儈䗮 4GB˄䙊䗷䟷⭘ CPU Ⲵᯠ⢩ᙗˈ㌫㔏⭊㠣ਟԕራ൰ 64GB Ⲵ⢙⨶ ㇇ᵪ䙊ᑨ䜭䝽㖞ᴹ 512MB ᡆ㘵ᴤཊⲴ⢙⨶޵ᆈᇩ䟿ˈᒦф䜭䟷⭘ Intel 32 ս CPUˈণ䜭ᱟ PC/AT 䇑㇇ᵪDŽ ᡆ 1MB ޵ᆈᇩ䟿สᵜк㜭┑䏣Პ䙊ᓄ⭘〻ᒿⲴ䘀㹼DŽ䲿⵰䇑㇇ᵪ䖟Ԧ઼⺜ԦᢰᵟⲴ儈䙏ਁኅˈⴞࡽⲴ䇑 CPU ਚᴹ 20 ṩൠ൰㓯ˈഐ↔޵ᆈራ൰㤳തᴰ儈Ѫ 1024KB˄1MB˅DŽ൘ᖃᰦ DOS ᫽֌㌫㔏⍱㹼ᒤԓˈ640K 1981 ᒤ IBM PC ᵪࡊ᧘ࠪᰦ㌫㔏ਚᑖᴹ 640KB Ⲵ RAM ѫᆈۘಘ˄ㆰ〠޵ᆈ˅DŽ⭡Ҿᡰ䟷⭘Ⲵ 8088/8086 2.3.1 ѱᆎ۞ಞ 2.3 ѱᆎ۞ಞȽBIOS ૂ CMOS ᆎ۞ಞ ↔᫽֌᭸⦷ᖸ儈DŽ൘ Linux ᫽֌㌫㔏ѝˈ䖟ⴈ傡ࣘ〻ᒿ֯⭘ѝᯝ઼ DMA ᯩᔿ䝽ਸᶕᇎ⧠ᮠᦞⲴՐ䗃ᐕ֌DŽ ഐˈޕᮤњ᫽֌䗷〻䴰㾱֯⭘у䰘Ⲵ DMA ᧗ࡦಘᶕ䘋㹼㘼ᰐ䴰 CPU ᨂ᡻DŽ⭡Ҿ൘Ր䗃䗷〻ѝᰐ享䖟Ԧӻ ⴤ᧕ᆈۘಘ䇯䰞 DMA˄Direct Memory Access˅ᯩᔿ⭘Ҿ I/O 䇮༷о㌫㔏޵ᆈѻ䰤䘋㹼ᢩ䟿ᮠᦞՐ䘱ˈ ᧗ࡦ䜭䟷⭘ѝᯝ༴⨶ᯩᔿDŽ ᯩᔿᰦ䴰㾱俆ݸ䇮㖞ྭѝᯝੁ䟿㺘ˈᒦ㕆ࡦྭ⴨ᓄⲴѝᯝ༴⨶ᴽ࣑䗷〻DŽLinux ᫽֌㌫㔏ѝབྷཊᮠ䇮༷ I/O ਓൠ൰DŽഐ↔䟷⭘ѝᯝ᧗ࡦޕ䙊䗷֯⭘ѝᯝੁ䟿㺘˄ᡆѝᯝ᧿䘠ㅖ㺘˅ᶕራ൰⴨ᓄⲴѝᯝ༴⨶ᴽ࣑䗷〻Ⲵ ѝᯝ༴⨶ᴽ࣑䗷〻ਾˈCPU ৸Պ㔗㔝ᢗ㹼ࡊ᡽㻛ѝᯝⲴ〻ᒿDŽ൘ I/O ᧗ࡦಘᡆ䇮༷ਁࠪѝᯝ䈧≲ᰦˈCPU ࠪ༴⨶䈧≲ᰦˈCPU ᡽ՊᲲᰦѝᯝᖃࡽᢗ㹼Ⲵ〻ᒿ䖜㘼৫ᢗ㹼⴨ᓄⲴ I/O ѝᯝ༴⨶ᴽ࣑䗷〻DŽᖃᢗ㹼ᆼ䈕 ѝᯝ༴⨶᧗ࡦᯩᔿ䴰㾱ᴹѝᯝ᧗ࡦಘⲴ᭟ᤱDŽ൘䘉⿽᧗ࡦᯩᔿлˈਚᴹᖃ I/O 䇮༷䙊䗷ѝᯝੁ CPU ᨀ ਚᴹ൘䇮༷ᡆ᧗ࡦಘ㜭ཏ・࡫䘄എؑ᚟ᰦ᡽Պ൘ᖸቁⲴࠐњൠᯩ䟷⭘䘉⿽ᯩᔿDŽ ഐ↔൘ཊԫ࣑᫽֌㌫㔏ѝ䲔䶎ㅹᖵᰦ䰤ᶱ⸝ᡆᗵ享ˈ੖ࡉቡнᓄ䈕֯⭘䘉⿽ᯩᔿDŽ൘ Linux ᫽֌㌫㔏ѝˈ 䘋㹼ᮠᦞӔᦒDŽ䘉⿽ᯩᔿн䴰㾱䗷ཊ⺜Ԧ᭟ᤱˈ֯⭘઼㕆〻䜭∄䖳ㆰঅˈնᱟ⢩࡛㙇䍩 CPU ᇍ䍥ᰦ䰤DŽ ਽ᙍѹˈᗚ⧟ḕ䈒ᯩᔿᱟᤷ CPU 䙊䗷൘〻ᒿѝᗚ⧟ḕ䈒ᤷᇊ䇮༷᧗ࡦಘѝⲴ⣦ᘱᶕࡔᯝᱟ੖ਟԕо䇮༷ PC ᵪ I/O ᧕ਓᮠᦞՐ䗃᧗ࡦᯩᔿа㡜ਟ䟷⭘〻ᒿᗚ⧟ḕ䈒ᯩᔿǃѝᯝ༴⨶ᯩᔿ઼ DMA Ր䗃ᯩᔿDŽ亮 2.2.2 ᧛ਙ䇵䰤᧝࡬ >URRW#SOLQX[URRW@ LGHIII LGHII  ,QWHO&RUS GE3&,GHYLFHIII XVEXKFLHHI  ,QWHO&RUS G3&,GHYLFHHHI XVEXKFLHHI   ѫᆈۘಘǃ%,26 ઼ &026 ᆈۘಘ )]ަԆ঑ 520%,26  ަԆ %,26 ᱐ሴ४ 9*$520%,26 520%,26  520%,26᱐ሴ४ ᱮ⽪㕃ߢ४  %,26 ᮠᦞ४ ѝᯝੁ䟿㺘 [ [ [&))) [& [) [$ [ [ [)))))))) 0 * 0  . . ⺜ⴈᡆަԆඇ䇮༷ᢺ᫽֌㌫㔏ᕅሬ〻ᒿ࣐䖭ࡠ޵ᆈ 0x7c00 ༴ˈᒦ䐣䖜ࡠ䘉њൠᯩ㔗㔝ᢗ㹼ᕅሬ〻ᒿDŽ ⵏ↓Ⲵᇎൠ൰⁑ᔿᐕ֌ˈ㿱മ 2-5 ᡰ⽪DŽᴰਾ BIOS ቡՊӾޕ64K ༴ˈ❦ਾ䐣䖜ࡠ䘉њൠᯩᒦф䇙 CPU 䘋 ԦỰ⍻઼ࡍ࿻ॆ᫽֌ѻਾˈቡՊᢺо৏ᶕ PC ᵪެᇩⲴ 64KB BIOS ԓ⸱઼ᮠᦞ༽ࡦࡠ޵ᆈվㄟ 1M ᵛㄟⲴ ᡀ 4G˄㘼䶎৏ᶕⲴ 64K˅ˈ䘉ṧቡਟԕ൘ 0 ࡠ 4G 㤳ത޵ᢗ㹼઼᫽֌ᮠᦞDŽ↔ਾˈBIOS ൘ᢗ㹼ҶаӋࡇ⺜ ⸱ᡆᮠᦞˈBIOS 〻ᒿՊ俆ݸ֯⭘а⿽〠Ѫ 32 սབྷ⁑ᔿ˄Big Mode˅ᢰᵟᢺᮠᦞ⇥ᇴᆈಘⲴ䇯䰞㤳ത䇮㖞 ѝˈഐ↔ѪҶ㜭ཏᢗ㹼ᡆ䇯䰞 BIOS ѝ䎵䗷 64KB 㤳തᒦф৸䘌䘌н൘ 0--1M ൠ൰オ䰤ѝⲴަԆ BIOS ԓ ᔰ࿻ᢗ㹼DŽ⭡Ҿⴞࡽ PC/AT ᗞᵪѝ BIOS ᇩ䟿བྷཊᴹ 1MB ࡠ 2MBˈᒦᆈۘ൘䰚ᆈ˄Flash Memory˅ROM ᆈ᭮Ⲵս㖞DŽᒦф BIOS Պ൘䘉䟼ᆈ᭮аᶑ䐣䖜ᤷԔ JMP 䐣䖜ࡠ BIOS ԓ⸱ѝ 64KB 㤳ത޵ⲴḀаᶑᤷԔ 䪸ᤷੁ 0xFFFFFFF0 ༴ˈণ 4G オ䰤ᴰਾањ 64K Ⲵᴰਾ 16 ᆇ㢲༴DŽ⭡кമਟ⸕ˈ䘉䟼↓ᱟ㌫㔏 ROM BIOS ަ⇥สൠ൰ࡉ㻛䇮㖞Ѫ 0xFFFF0000ˈ⇥䮯ᓖ䇮㖞Ѫ 64KBDŽ㘼 IP 㻛䇮㖞Ѫ 0xFFF0ˈഐ↔↔ᰦ CPU ԓ⸱ᤷ ᖃ䇑㇇ᵪ㌫㔏к⭥ᔰᵪᡆ㘵᤹Ҷᵪ㇡кⲴ༽ս᤹䫞ᰦˈCPU Պ㠚ࣘᢺԓ⸱⇥ᇴᆈಘ CS 䇮㖞Ѫ 0xF000ˈ ԕཆˈLinux ᫽֌㌫㔏൘䘀㹼ᰦᒦн֯⭘ BIOS ѝⲴ࣏㜭DŽ ަѝ〻ᒿнਟᒦਁ䘀㹼˅ˈᒦфӾ䇯䰞᭸⦷ᯩ䶒㘳㲁ˈഐ↔䲔Ҷ൘ࡍ࿻ॆᰦՊ࡙⭘ BIOS ᨀ׋аӋ㌫㔏৲ᮠ ᙗ˄ণޕᘱˈ㘼ф䘈Ѫ DOS ㅹ᫽֌㌫㔏ᨀ׋⺜Ԧ䇮༷᧕ਓᴽ࣑DŽնᱟ⭡Ҿ BIOS ᨀ׋Ⲵ䘉Ӌᴽ࣑нާ༷ਟ䟽 㾱֯⭘Ⲵ਴⿽䝽㖞㺘ˈֻྲѝᯝੁ䟿㺘ǃ⺜ⴈ৲ᮠ㺘DŽᒦфᢺ༴⨶ಘ઼㌫㔏ަ։䜘࠶ࡍ࿻ॆࡠањᐢ⸕⣦ ᆈ᭮൘ ROM ѝⲴ㌫㔏 BIOS 〻ᒿѫ㾱⭘Ҿ䇑㇇ᵪᔰᵪᰦᢗ㹼㌫㔏਴䜘࠶Ⲵ㠚Ựˈᔪ・䎧᫽֌㌫㔏䴰 䗉࠰ぁᓅ BIOS/ޛ2.3.2 ะᵢ䗉 ഴ 3&$7 ᵰ޻ᆎֵ⭞॰ตഴ  ฏDŽ   ѫᆈۘಘǃ%,26 ઼ &026 ᆈۘಘ (] . . %,266KDGRZ ༽ࡦⲴ %,26  䮯ᓖ˖.%0%DŽ )ODVK520%,26 〻ᒿˈ . [))))))) -PS ᤷԔ * 0  ༽ࡦ 䐣䖜 ৏⨶઼㕆〻ᯩ⌅Ⲵ䈖㓶䈤᰾䈧৲㿱ਾ㔝ㄐ㢲DŽ ѝᯝ᧗ࡦಘᐕ֌ޣՊ䈖㓶䈤᰾˅ˈഐ↔ Linux ᫽֌㌫㔏൘޵Ṩࡍ࿻ॆᵏ䰤৸䟽ᯠሩ 8259A 䘋㹼Ҷ䇮㖞DŽᴹ ਨⲴ㾱≲˄ਾ䶒ㄐ㢲ሶޜ ᔰ࿻༴ 0x000-0xFFF ४ฏ޵ᔪ・ањѝᯝੁ䟿㺘DŽնᱟ⭡Ҿ䘉Ӌ䇮㖞䘍㛼Ҷ Intel 䝽㔉ᰦ䫏ᇊᰦಘǃ䭞ⴈǃѢ㹼ਓǃᢃঠਓǃ䖟ⴈ᧗ࡦǃॿ༴⨶ಘ઼⺜ⴈㅹ䇮༷ᡆ᧗ࡦಘ֯⭘DŽ਼ᰦ൘޵ᆈ ㇇ᵪࡊᔰᵪࡍ࿻ॆᵏ䰤ˈROM BIOS Պ࠶࡛ሩє⡷ 8259A 㣟⡷䘋㹼ࡍ࿻ॆˈᒦ࠶࡛ᢺ 15 㓗ѝᯝՈݸ㓗࠶ ⧠ I/O 䇮༷Ⲵѝᯝ᧗ࡦᮠᦞᆈਆᯩᔿˈᒦф㜭Ѫ 15 њ䇮༷ᨀ׋⤜・Ⲵѝᯝ᧗ࡦ࣏㜭ˈ㿱മ 2-6 ᡰ⽪DŽ൘䇑 IBM PC/AT 80X86 ެᇩᗞᵪ֯⭘є⡷㓗㚄Ⲵ 8259A ਟ㕆〻ѝᯝ᧗ࡦ㣟⡷㓴ᡀањѝᯝ᧗ࡦಘˈ⭘Ҿᇎ 2.4.1 ѣᯣ᧝࡬ಞ 2.4 ᧝࡬ಞૂ᧝࡬গ CMOS ޵ᆈⲴൠ൰オ䰤൘สᵜ޵ᆈൠ൰オ䰤ѻཆˈ䴰㾱֯⭘ I/O ᤷԔᶕ䇯䰞DŽ ൘аඇ䳶ᡀඇѝDŽڊ˅ᇎᰦᰦ䫏ؑ᚟઼㌫㔏⺜Ԧ䝽㖞ؑ᚟DŽ䘉䜘࠶޵ᆈ䙊ᑨ઼ᇎᰦᰦ䫏㣟⡷˄Real Time Chip 㢲˅CMOS˄Complementary Metal Oxide Semiconductorˈӂ㺕䠁኎≗ॆ⢙ॺሬփ˅ᆈۘಘᶕᆈ᭮䇑㇇ᵪⲴ ൘ PC/AT ᵪѝˈ䲔䴰㾱֯⭘޵ᆈ઼ ROM BIOS ԕཆˈ䘈֯⭘ਚᴹᖸቁᆈۘᇩ䟿Ⲵ˄ਚᴹ 64 ᡆ 128 ᆇ 2.3.3 CMOS ᆎ۞ಞ ഴ )ODVK520%,26 փ㖤ૂགྷ࡬᱖ሺ॰ต    ᧗ࡦಘ઼᧗ࡦ঑ ''ᮠᦞ &38  ,175 ൠ൰ [$[EI  ⮉,54؍ ⺜ⴈ,54 ॿ༴⨶ಘ,54 36 啐ḷ,54 ⮉,54؍ ⮉,54؍ ,17$+,54 ᇎᰦ䫏 ,54 &6 $  ,5 ,5 ,5 ,5Ӿ⡷ $,5 ,5 ,5,17 ,5 &$6 ൠ൰ [[I  ᒦ㹼ਓ ,54 䖟ⴈ,54 ᒦ㹼ਓ ,54 Ѣ㹼ਓ ,54 Ѣ㹼ਓ ,54 ᧕㚄LQW,54 䭞ⴈ,54 ᰦ䫏,54 &$6 &6 $  ,5 ,5 ,5 ,5ѫ⡷ $,5 ,5 ,5,17 ,5 ⮉؍˅IRQ15 0x77 ˄119 IRQ14 0x76 ˄118˅ ⺜ⴈѝᯝ IRQ13 0x75 ˄117˅ ᮠᆖॿ༴⨶ಘѝᯝ IRQ12 0x74 ˄116˅ PS/2 啐ḷਓѝᯝ ⮉˄㖁㔌᧕ਓ˅؍ ˅IRQ11 0x73 ˄115 ⮉؍˅IRQ10 0x72 ˄114 IRQ9 0x71 ˄113˅ ᭩ੁ㠣 INT 0x0A IRQ8 0x70 ˄112˅ ᇎᰦ䫏ѝᯝ IRQ7 0x0F ˄15˅ ᒦ㹼ਓ 1 IRQ6 0x0E ˄14˅ 䖟ⴈ傡ࣘಘ IRQ5 0x0D ˄13˅ ᒦ㹼ਓ 2 IRQ4 0x0C ˄12˅ Ѣ㹼ਓ 1 IRQ3 0x0B ˄11˅ Ѣ㹼ਓ 2 IRQ2 0x0A ˄10˅ ᧕䘎Ӿ㣟⡷ IRQ1 0x09 ˄9˅ 䭞ⴈѝᯝ IRQ0 0x08 ˄8˅ 8253 ਁࠪⲴ 100HZ ᰦ䫏ѝᯝ ѝᯝ䈧≲ਧ BIOS 䇮㖞Ⲵѝᯝਧ ⭘䙄 㺞 ᔶᵰᰬ 520%,26 䇴㖤Ⲻ⺢Ԭ䈭≸༺⨼ѣᯣਭ ㌫DŽޣॆ᫽֌ᰦˈᆳՊ䟽ᯠ䇮㖞ѝᯝ䈧≲ਧоѝᯝੁ䟿ਧⲴሩᓄ ᓄѝᯝੁ䟿ਧDŽLinux ᫽֌㌫㔏ᒦнⴤ᧕֯⭘䘉Ӌ PC ᵪ唈䇔䇮㖞ྭⲴѝᯝੁ䟿ਧˈᖃ Linux ㌫㔏ᢗ㹼ࡍ࿻ ᖃаਠ PC 䇑㇇ᵪࡊк⭥ᔰᵪᰦˈкമѝⲴ⺜Ԧѝᯝ䈧≲ਧՊ㻛 ROM BIOS 䇮㖞ᡀ㺘 2-2 ѝࡇࠪⲴሩ  ᧝࡬㌱㔕 ഴ 3&$7 ᗤᵰ㓝䘔ᕅ    ᧗ࡦಘ઼᧗ࡦ঑ ⸱䳶Ⲵ৏ഐDŽ ಘ䘋㹼㕆〻ᰦ䙊ᑨਚ䴰㾱Ҷ䀓ㅜа྇ᢛ᧿⸱䳶ণਟDŽ䘉ҏᱟਾ䶒⎹৺䭞ⴈ㕆〻޵ᇩᰦਚ㔉ࠪ XT 䭞ⴈᢛ᧿ ӽ❦Պᢺᡰᴹ᧕᭦ࡠⲴㅜҼ྇䭞ⴈᢛ᧿⸱䖜ᦒᡀㅜа྇ᢛ᧿⸱ˈ㿱മ 2-7 ᡰ⽪DŽഐ↔ˈᡁԜ൘Ѫ䭞ⴈ᧗ࡦ AT 䭞ⴈ唈䇔ਁ䘱ⲴᱟㅜҼ྇ᢛ᧿⸱䳶DŽ㲭❦ྲ↔ˈѫᵪ䭞ⴈ᧗ࡦಘѪҶо PC/XT ᵪⲴ䖟Ԧެᇩ䎧㿱ˈ „ ㅜй྇ᢛ᧿⸱䳶 -- PS/2 䭞ⴈᢛ᧿⸱䳶DŽ৏ IBM ᧘ࠪ PS/2 ᗞᵪᰦ֯⭘Ⲵᢛ᧿⸱䳶ˈᐢᖸቁ֯⭘DŽ „ ㅜҼ྇ᢛ᧿⸱䳶 -- ⧠ԓ䭞ⴈ唈䇔֯⭘Ⲵᢛ᧿⸱䳶ˈ䙊ᑨ〠Ѫ AT 䭞ⴈᢛ᧿⸱䳶˗ „ ㅜа྇ᢛ᧿⸱䳶 -- ৏࿻ XT 䭞ⴈᢛ᧿⸱䳶DŽⴞࡽⲴ䭞ⴈᐢ㓿ᖸቁਁ䘱䘉㊫ᢛ᧿⸱˗ ᵪⲴਁኅˈⴞࡽᐢᴹй྇ᢛ᧿⸱䳶ਟ׋֯⭘ˈᆳԜ࠶࡛ᱟ˖ ֌ଚњ䭞DŽᮤњ䭞ⴈкᡰᴹ᤹䭞Ⲵ᧕䙊઼ᯝᔰ⸱ቡ㓴ᡀҶ䭞ⴈⲴањᢛ᧿⸱䳶˄Scan Code Set˅DŽṩᦞ䇑㇇ ᮠᦞ䱏ࡇѝDŽഐѪ⇿њ᤹䭞Ⲵ᧕䙊઼ᯝᔰ⸱䜭ᱟн਼Ⲵˈᡰԕ䭞ⴈ᧗ࡦಘṩᦞᢛ᧿⸱ቡਟԕ⺞ᇊ⭘ᡧ൘᫽ ѫᵪ䭞ⴈ᧗ࡦಘу䰘⭘ᶕሩ᧕᭦ࡠⲴ䭞ⴈᢛ᧿⸱䘋㹼䀓⸱ˈᒦᢺ䀓⸱ਾⲴᮠᦞਁ䘱ࡠ᫽֌㌫㔏Ⲵ䭞ⴈ ⸱㻛〠Ѫᯝᔰᢛ᧿⸱˄Break code˅ˈᡆㆰ〠Ѫᯝᔰ⸱DŽ 䭞ⴈਁ䘱Ⲵᢛ᧿⸱〠Ѫ᧕䙊ᢛ᧿⸱˄Make code˅ˈᡆㆰ〠Ѫ᧕䙊⸱˗ᖃањ㻛᤹лⲴ䭞᭮ᔰᰦਁ䘱Ⲵᢛ᧿ ᡰᴹ᤹䭞᤹л઼ᶮᔰⲴ⣦ᘱؑ᚟˄ণᢛ᧿⸱˅ˈᒦਁ䘱ࡠѫᵪѫᶯк䭞ⴈ᧗ࡦಘѝDŽᖃањ䭞㻛᤹лᰦˈ ᴹ 101 ࡠ 104 њ᤹䭞DŽ䭞ⴈкᴹањ〠Ѫ䭞ⴈ㕆⸱ಘⲴ༴⨶ಘ˄Intel 8048 ᡆެᇩ㣟⡷˅у䰘⭘ᶕᢛ᧿᭦䳶 ਨҾ 1984 ᒤ PC/AT ᗞᵪⲴެᇩ䭞ⴈˈ䙊ᑨ〠Ѫ AT-PS/2 ެᇩ䭞ⴈᒦާޜ ᡁԜ⧠൘֯⭘Ⲵ䭞ⴈᱟ IBM 2.4.4 䭤ⴎ᧝࡬ಞ ԫ࣑֯⭘Ⲵ㌫㔏䍴Ⓚ䟿˄ᰦ䰤˅DŽ њ䰤䳄ᇊᰦӗ⭏Ⲵѝᯝ䈧≲ቡᱟ Linux 0.11 ޵Ṩᐕ֌Ⲵ㜹ᨿˈᆳ⭘Ҿᇊᰦ࠷ᦒᖃࡽᢗ㹼Ⲵԫ઼࣑㔏䇑⇿њ 䇮㖞ˈ֯ᗇ䈕䇑ᮠಘᐕ֌൘ᯩᔿ 3 лˈᒦф⇿䰤䳄 10 ∛。ਁࠪањؑਧԕӗ⭏ѝᯝ䈧≲ؑਧ˄IRQ0˅DŽ䘉 ؑਧǃࣘᘱ޵ᆈ DRAM ࡧᯠᇊᰦ⭥䐟઼ѫᵪᢜ༠ಘ丣䈳ਸᡀDŽLinux 0.11 ᫽֌㌫㔏ਚሩ䙊䚃 0 䘋㹼Ҷ䟽ᯠ ሩҾ PC/AT ৺ަެᇩᗞᵪ㌫㔏䟷⭘Ⲵᱟ 8254 㣟⡷DŽ3 њᇊᰦ/䇑ᮠಘ䙊䚃㻛࠶࡛⭘Ҿᰕᰦ䫏䇑ᰦѝᯝ ⭘ަѝањ䇑ᮠಘ䙊䚃䗮ࡠᡰᵏᵋⲴᔦᰦDŽ൘ᔦᰦࡠਾˈ8253/8254 ሶՊੁ CPU ਁ䘱ањѝᯝؑਧDŽ ᖸ㙇 CPU ᰦ䰤DŽ㤕ᵪಘѝ䟷⭘Ҷ 8253/8254 㣟⡷ˈ䛓Ѹ〻ᒿઈቡਟԕ䝽㖞 8253 ԕ┑䏣㠚ᐡⲴ㾱≲ᒦф֯ ڊᒦф䘉Ӌᐕ֌ᯩᔿ൷ਟԕ֯⭘䖟Ԧᶕ䇮㖞DŽ൘䖟Ԧѝ䘋㹼ᔦᰦⲴа⿽ᯩ⌅ᱟᢗ㹼ᗚ⧟᫽֌䈝ਕˈն䘉ṧ ѝⲴ㋮⺞ᰦ䰤ᔦ䘏DŽ䈕㣟⡷ᨀ׋Ҷ 3 њ⤜・Ⲵ 16 ս䇑ᮠಘ䙊䚃DŽ⇿њ䙊䚃ਟᐕ֌൘н਼Ⲵᐕ֌ᯩᔿлˈ Intel 8253/8254 ᱟањਟ㕆〻ᇊᰦ/䇑ᮠಘ˄PIT - Programmable Interval Timer˅㣟⡷ˈ⭘Ҿ༴⨶䇑㇇ᵪ 2.4.3 ᇐᰬ/䇗ᮦಞ ഐ↔਴㠚䴰㾱ਁ䘱є⅑DŽˈᇴᆈಘᱟ 8 սⲴˈ㘼ൠ൰઼䇑ᮠ٬ᱟ 16 ս٬ ൠ൰ᇴᆈಘㄟਓ઼ᮠᦞ䇑ᮠᇴᆈಘㄟਓDŽ⭡Ҿ DMA˅〫ٿ˄ሩйњㄟਓⲴ᫽֌ˈ࠶࡛ᱟ亥䶒ᇴᆈಘㄟਓǃ 16 ս䙊䚃DŽ䖟ⴈ᧗ࡦಘ㻛у䰘ᤷᇊ֯⭘ DMA 䙊䚃 2DŽ൘֯⭘ањ䙊䚃ѻࡽᗵ享俆ݸሩަ䇮㖞DŽ䘉⢥⎹ࡠ ൘ PC/AT ᵪѝˈ֯⭘Ҷє⡷ 8237 㣟⡷ˈഐ↔ DMA ᧗ࡦಘᴹ 8 њ⤜・Ⲵ䙊䚃ਟ֯⭘DŽަѝਾ 4 њᱟ ԆһᛵDŽަڊՐ䗃㜭൘нਇ CPU ᧗ࡦⲴᶑԦл䘋㹼DŽഐ↔൘ᮠᦞՐ䗃ᵏ䰤ˈCPU ਟԕ ᆳ⭡ᵪಘкⲴ Intel 8237 㣟⡷ᡆަެᇩ㣟⡷ᇎ⧠DŽ䙊䗷ሩ DMA ᧗ࡦಘ䘋㹼㕆〻ˈཆ䇮о޵ᆈѻ䰤Ⲵᮠᦞ ྲࡽᡰ䘠ˈDMA ᧗ࡦಘⲴѫ㾱࣏㜭ᱟ䙊䗷䇙ཆ䜘䇮༷ⴤ᧕о޵ᆈՐ䗃ᮠᦞᶕ໎ᕪ㌫㔏Ⲵᙗ㜭DŽ䙊ᑨ 2.4.2 DMA ᧝࡬ಞ   ᧗ࡦಘ઼᧗ࡦ঑ 㕆〻ㄟਓ ㅜҼ྇ᢛ᧿⸱ㅜа྇ᢛ᧿⸱ 䭞ⴈ᧗ࡦಘ ѫᵪк 䈟Ự⍻᫽֌ˈ䲔Ҷᗵ㾱Ⲵᮠᦞԕཆˈ൘Ր䗃Ⲵаᑗؑ᚟ѝ䘈वਜ਼䎧਼↕઼䭉䈟Ự⍻֌⭘Ⲵަᆳؑ᚟ˈֻྲ অսⲴṬᔿDŽ䙊ᑨᡁԜ֯⭘ᵟ䈝Āᑗāᶕᖒᇩ䘉⿽ṬᔿDŽѪҶ㜭䇙䙊ؑৼᯩ⺞ᇊ᭦/ਁⲴ亪ᒿ઼䘋㹼аӋ䭉 ᡁԜᢺ䇑㇇ᵪ/䇮༷о䇑㇇ᵪ/䇮༷ѻ䰤ⲴĀ䈝䀰ā〠Ѫ䙊ؑॿ䇞DŽ䙊ؑॿ䇞㿴ᇊҶՐ䘱ањᴹ᭸ᮠᦞ䮯ᓖ єਠ䇑㇇ᵪ/䇮༷䘋㹼ᮠᦞӔᦒˈণ䙊ؑˈᗵ享䊑ӪԜሩ䈍аṧ֯⭘਼а⿽䈝䀰DŽ൘䇑㇇ᵪ䙊ؑᵟ䈝ѝˈ 1. ᔲ↕Ѣ㹼䙊ؑ৏⨶ 2.4.5 Ѩ㺂᧝࡬গ ެᇩⴞⲴ㘼⁑ᤏ 8042 㣟⡷Ⲵ࣏㜭DŽഐ↔⧠൘䭞ⴈⲴ㕆〻ӽ❦䟷⭘ 8042 Ⲵ㕆〻ᯩ⌅DŽ Ѫ 0 ࡉ⾱→ A20 ؑਧ㓯DŽ⧠ӺⲴѫᶯкᐢ㓿н޽वᤜ⤜・Ⲵ 8042 㣟⡷ҶˈնᱟѫᶯкަԆ䳶ᡀ⭥䐟ՊѪ ᕅ㝊⭘Ҿ᧗ࡦ A20 ؑਧ㓯Ⲵᔰ੟о੖DŽᖃ䈕䗃ࠪㄟਓս 1˄P21˅Ѫ 1 ᰦቡᔰ੟˄䘹䙊˅Ҷ A20 ؑਧ㓯ˈ ਖཆˈ䭞ⴈ᧗ࡦಘ 8042 Ⲵ䗃ࠪㄟਓ P2 ⭘ҾަԆⴞⲴDŽަ P20 ᕅ㝊⭘Ҿᇎ⧠ CPU Ⲵ༽ս᫽֌ˈP21 ᐖ Shift 䭞 + G 䭞 0x2A, 0x22 0xAA, 0xA2 ݸ᤹ᒦфਾ䟺᭮ Shift 䭞 ਣ䗩 Ctrl 䭞 0xe0, 0x1D 0xe0, 0x9D ᢙኅ䭞 ᯩੁ䭞ੁਣ䭞 0xe0, 0x4D 0xe0, 0xCD ᢙኅ䭞 ࣏㜭䭞 F9 0x43 0xC3 䶎ᢙኅⲴᲞ䙊䭞 9 0x0A 0x8A 䶎ᢙኅⲴᲞ䙊䭞 A 0x1E 0x9E 䶎ᢙኅⲴᲞ䙊䭞 ᤹䭞 ᧕䙊ᢛ᧿⸱ ᯝᔰᢛ᧿⸱ 䈤᰾ 㺞 䭤ⴎ᧝࡬ಞ㕌ぁㄥਙ᧛᭬ࡦⲺㅢжྍᢡᨅ⸷䳼᧛䙐ૂᯣᔶᢡᨅ⸷⽰ׁ ѝ䘈㔉ࠪҶᆼᮤⲴㅜа྇ᢛ᧿⸱䳶DŽ 䙊⸱ 0xE0ǃ0x1DDŽሩᓄⲴᯝᔰ⸱ᱟ 0xE0ǃ0x9DDŽ㺘 2-3 ѝᱟࠐњ᧕䙊઼ᯝᔰᢛ᧿⸱ⲴֻᆀDŽਖཆˈ䱴ᖅ ᤹лᐖ䗩Ⲵ䶎ᢙኅ Ctrl 䭞ᰦՊӗ⭏ 1 ᆇ㢲᧕䙊⸱ 0x1Dˈ㘼᤹лਣ䗩Ⲵ Ctrl 䭞ᰦቡՊӗ⭏ᢙኅⲴ 2 ᆇ㢲᧕ 䭞઼ਣ䗩Ⲵ Alt 䭞ㅹ˅ˈࡉަ᧕䙊઼ᯝᔰᢛ᧿⸱䙊ᑨᴹ 2 ࡠ 4 њᆇ㢲ˈᒦфㅜ 1 њᆇ㢲аᇊᱟ 0xE0DŽֻྲˈ նᱟሩҾ䛓Ӌ PC/XT ḷ߶ 83 䭞䭞ⴈԕਾᯠ␫࣐Ⲵ˄ĀᢙኅⲴā˅AT 䭞ⴈкⲴ᤹䭞˄ֻྲਣ䗩Ⲵ Ctrl 㖞սᰦⲴ᧕䙊⸱DŽֻྲˈк䘠ĀAā䭞Ⲵᯝᔰ⸱ቡᱟ 0x80 + 0x1E = 0x9EDŽ ሩҾ XT 䭞ⴈ˄ণ䭞ⴈ᧗ࡦಘ㕆〻ㄟਓ᭦ࡠⲴᢛ᧿⸱˅ˈᯝᔰ⸱ᱟަ᧕䙊⸱࣐к 0x80ˈণᴰ儈ᴹ᭸ս˄ս 7˅ 䭞ĀAāⲴ᧕䙊⸱ᱟ 30˄0x1E˅DŽᖃањ᤹лⲴ䭞㻛ᶮᔰᰦˈӾ䭞ⴈ᧗ࡦಘㄟਓ᭦ࡠⲴቡᱟањᯝᔰ⸱DŽ кḀњս㖞༴Ⲵ䭞㻛᤹лˈն䘈⋑ᴹሩᓄࡠḀњᆇㅖԓ⸱кDŽ᧕䙊⸱䙊ᑨ䜭ᱟањᆇ㢲ᇭᓖDŽֻྲˈ᤹л ᖃањ䭞㻛᤹лᰦˈᡁԜਟԕӾ䭞ⴈ᧗ࡦಘㄟਓ᧕᭦ࡠањ XT 䭞ⴈ᧕䙊⸱DŽ䘉њᢛ᧿⸱ӵ㺘⽪䭞ⴈ 䈕ѝᯝ䈧≲ਾˈቡՊ䈳⭘䭞ⴈѝᯝ༴⨶〻ᒿᶕ䈫ਆ᧗ࡦಘѝⲴ XT 䭞ⴈᢛ᧿⸱DŽ PC/XT ḷ߶䭞ⴈެᇩⲴ㌫㔏ᢛ᧿⸱ˈ❦ਾ䙊䗷ѝᯝ᧗ࡦಘ IRQ1 ᕅ㝊ੁ CPU ਁ䘱ѝᯝ䈧≲DŽᖃ CPU ૽ᓄ սDŽ৲㿱л㢲ሩѢ㹼᧗ࡦ঑Ⲵ䈤᰾DŽ䭞ⴈ᧗ࡦಘ൘᭦ࡠ 11 սⲴѢ㹼ᮠᦞਾቡሶ䭞ⴈᢛ᧿⸱䖜ᦒᡀ→ڌ Ѣ㹼ṬᔿᮠᦞDŽަѝㅜ 1 սᱟ䎧࿻սˈㅜ 2--9 սᱟ 8 ս䭞ⴈᢛ᧿⸱ˈㅜ 10 սᱟཷṑ傼ṑ傼սˈㅜ 11 սᱟ ᡀ൘ѫᶯ㣟⡷㓴ѝˈնᱟ࣏㜭ӽ❦о֯⭘ 8042 㣟⡷Ⲵ᧗ࡦಘ⴨ެᇩDŽ䭞ⴈ᧗ࡦಘ᧕᭦䭞ⴈਁ䘱ᶕⲴ 11 ս 䭞ⴈ᧗ࡦಘ䙊ᑨ䟷⭘ Intel 8042 অ⡷ᗞ༴⨶ಘ㣟⡷ᡆަެᇩ⭥䐟DŽ⧠൘Ⲵ PC ᵪ䜭ᐢ㓿ሶ䭞ⴈ᧗ࡦಘ䳶 ഴ 䭤ⴎ᧝࡬ಞሯᢡᨅ⸷䳼Ⲻ䖢ᦘ    ᧗ࡦಘ઼᧗ࡦ঑ սڦཷ 䎧࿻ս  0$5. Րਧ    ' ' ' ' ' ' ' '              63$&( オਧ ањᆇㅖᑗ սᮠᦞս→ڌ 䎧࿻਼↕ؑ᚟ Ր䗃Ⲵᇎ䱵ᮠᦞ ṑ傼ㅹؑ᚟ սᰦত᭦ࡠҶオਧDŽ䙊ᑨ䙐ᡀ䘉⿽䭉䈟Ⲵᛵߥ䲔Ҷ㓯䐟ᒢᢠԕཆˈᖸਟ㜭ᱟ䙊ؑৼᯩⲴᑗṬᔿ䇮㖞Ⲵн਼DŽ →ڌ࣐ᘛਆᆇㅖ仁⦷˗ĹᑗṬᔿ䭉䈟DŽ൘㾱≲᧕᭦ⲴṬᔿؑ᚟н↓⺞ᰦՊਁ⭏䘉⿽䭉䈟DŽֻྲ൘ᓄ䈕᭦ࡠ ᯠਁ䘱䈕ᆇㅖ˗ĸ䗷䙏䭉䈟DŽ⭡Ҿ〻ᒿਆᆇㅖ䙏ᓖធҾ᧕᭦䙏ᓖˈቡՊਁ⭏䘉⿽䭉䈟DŽ↔ᰦᓄ䈕؞᭩〻ᒿ ṑ傼䭉䈟DŽ↔ᰦ〻ᒿᓄ䈕㾱≲ሩᯩ䟽ڦ൘᧕᭦аᆇㅖᑗᰦˈ᧕᭦ᯩਟ㜭ՊỰ⍻ࡠй⿽䭉䈟ѻа˖ķཷ ᆇㅖᑗਁ䘱ᆼਾਟԕ・࡫ਁ䘱лањᆇㅖᑗˈҏਟԕᲲᰦਁ䘱ՐਧˈㅹаՊ޽ਁ䘱ᆇㅖᑗDŽ սDŽ൘ањ→ڌṑ傼սDŽᴰਾᱟڦṑ傼սˈ䛓Ѹ൘ᮠᦞՐ䗃ᆼѻਾ䘈䴰㾱᧕᭦ཷڦᦞDŽ㤕〻ᒿѝ䇮㖞Ҷཷ ݸਁ䘱ањ∄⢩ս䰤䳄ᰦ䰤Ⲵオਧ䎧࿻սDŽ᧕᭦ᯩ᭦ࡠオਧਾˈቡᔰ࿻оਁ䘱ᯩ਼↕ˈ❦ਾ᧕᭦䲿ਾⲴᮠ ᖃᰐᮠᦞՐ䗃ᰦˈਁ䘱ᯩ༴ҾՐਧ˄MARK˅⣦ᘱˈᤱ㔝ਁ䘱 1DŽ㤕䴰㾱ਁ䘱ᮠᦞˈࡉਁ䘱ᯩ䴰㾱俆 ᔸ↛Ѩ㺂䙐ؗᆍㅜՖ䗉Ṳᕅ ഴ  ᵟ䈝DŽ 㿴㤳ѝˈᢺՐ䘱 1 〠ѪՐਧ˄MARK˅ˈՐ䘱 0 〠Ѫオਧ˄SPACE˅DŽഐ↔൘л䶒᧿䘠ѝᡁԜቡ֯⭘䘉єњ սDŽ൘ᔲ↕䙊ؑ→ڌؑᔰ࿻ਁ䘱ؑ᚟ѻࡽˈৼᯩᗵ享䇮㖞ᡀ⴨਼ⲴṬᔿDŽྲާᴹ⴨਼ᮠ䟿Ⲵᮠᦞ∄⢩ս઼ սᚂѪ 1ˈਟ⭡〻ᒿ䇮ᇊѪ 1ǃ1.5 ᡆ 2 њ∄⢩սDŽ൘䙊→ڌṑ傼սਟᴹਟᰐˈ⭡〻ᒿ䇮ᇊDŽڦњ∄⢩DŽཷ ٬ᚂѪ 0DŽᮠᦞսᱟՐ䗃Ⲵᇎ䱵ᮠᦞˈণањᆇㅖⲴԓ⸱DŽަ䮯ᓖਟԕᱟ 5--8ˈᡀDŽަѝ䎧࿻ս䎧਼↕֌⭘ սᶴ→ڌṑ傼ս઼ڦᔲ↕Ѣ㹼䙊ؑՐ䗃ⲴᑗṬᔿ㿱മ 2-9 ᡰ⽪DŽՐ䗃ањᆇㅖ⭡䎧࿻սǃᮠᦞսǃཷ 2. ᔲ↕Ѣ㹼Ր䗃Ṭᔿ ࠶ѫ㾱ᱟа⿽ҐᜟᡆᜟֻкⲴࡂ࠶DŽ 䛓Ѹԕањᆇㅖ䘋㹼Ր䗃Ⲵᔲ↕Ѣ㹼䙊ؑҏਟԕⴻ֌ᱟа⿽਼↕Ր䗃䙊ؑᯩᔿDŽഐ↔ᔲ↕઼਼↕䙊ؑⲴ४ Ⲵаਕ䈍֌Ѫሩ䈍অսDŽਟԕⴻࠪˈᇎ䱵кྲ᷌ᡁԜᢺՐ䗃অս㕙ሿࡠањ∄⢩սᰦ˄ሩ䈍ᰦ⭘ᆇ⇽ʽ˅ˈ 亯ԫ᜿䮯ᰦ䰤DŽ㘼਼↕䙊ؑࡉྲ਼䙊ؑৼᯩԕ䘎䍟ڌ˄word˅ањᆇൠĀ䒖āࠪᶕˈ൘䈤ࠪ⇿њᆇਾਟԕ ᦞ䘋㹼Ր䗃DŽ㤕޽ԕӪԜѻ䰤Ⲵሩ䈍֌∄௫ˈ䛓Ѹᔲ↕䙊ؑྲ਼ሩ䈍ৼᯩ䇢䈍䙏ᓖᖸធˈ䈤䈍ᰦањᆇ ањᆇㅖ֌Ѫањ䙊ؑঅսᡆаᑗ䘋㹼Ր䗃ˈ㘼਼↕Ѣ㹼䙊ؑࡉԕཊњᆇㅖᡆᆇ㢲㓴ᡀⲴᒿࡇ֌Ѫаᑗᮠ ↕Ѣ㹼䙊ؑє⿽㊫රDŽᆳԜѻ䰤Ⲵѫ㾱४࡛൘ҾՐ䗃ᰦ਼↕Ⲵ䙊ؑঅսᡆᑗⲴ䮯ᓖн਼DŽᔲ↕Ѣ㹼䙊ؑԕ Ѣ㹼䙊ؑᱟᤷ൘㓯䐟кԕ∄⢩սᮠᦞ⍱а⅑ањ∄⢩䘋㹼Ր䗃Ⲵ䙊ؑᯩᔿDŽѢ㹼䙊ؑਟ࠶Ѫᔲ↕઼਼ ഴ 䙐ؗᑝⲺж㡢㔉ᶺ  ṑ傼ؑ᚟ㅹˈ㿱മ 2-8 ᡰ⽪DŽ ൘ᔰ࿻Ր䗃ᮠᦞؑ᚟ѻࡽݸਁ䘱䎧࿻/਼↕ᡆ䙊ؑ᧗ࡦؑ᚟ˈᒦф൘ਁ䘱ᆼ䴰㾱Ⲵᮠᦞؑ᚟ѻਾ޽Ր䗃аӋ   ᧗ࡦಘ઼᧗ࡦ঑ $*&൘  ࡇ; ࡇⲴ᮷ᵜᆇㅖᱮ⽪ᯩᔿлˈᴹঅ㢢઼  㢢ᖙ㢢є⿽ᱮ⽪ᯩᔿ˄%,26 ᱮ⽪ᯩᔿ ˅DŽ  ᖙ㢢മᖒ䘲䝽ಘ &*$˄&RORU*UDSKLFV$GDSWHU˅᭟ᤱ  ⿽ᖙ㢢઼മᖒᱮ⽪ᯩᔿ˄%,26 ᱮ⽪ᯩᔿ ˅DŽ  &*$ ᱮ⽪ḷ߶ 1 1 1 1 1 1 0x77 ᱮ⽪ⲭ㢢ᯩඇDŽ Ƶ 1 1 1 0 0 0 0x70 ⲭ㢢㛼Ჟкᱮ⽪唁㢢ᆇㅖ˄৽ᱮ˅DŽ Reverse 0 0 0 0 0 1 0x01 唁㢢㛼Ჟкᱮ⽪ⲭ㢢ᑖлࡂ㓯ᆇㅖDŽ Underline 0 0 0 1 1 1 0x07 唁㢢㛼Ჟкᱮ⽪ⲭ㢢ᆇㅖ˄↓ᑨᱮ⽪˅DŽ Normal 0 0 0 0 0 0 0x00 ᆇㅖнਟ㿱DŽ ᱮ⽪᭸᷌ ⽪ֻ ᰐ䰚վӞ ኎ᙗ٬ D2D1D0 ࡽᲟ㢢 D6D5D4 㛼Ჟ㢢 㺞 ঋ㢨ᱴ⽰ᆍㅜኔᙝᆍ㢸䇴㖤  ˄[˅઼唁㢢˄[˅DŽᆳԜⲴ㓴ਸ᭸᷌㿱㺘ᡰ⽪DŽ ' 㖞  ֯ᆇㅖ儈Ӟᓖᱮ⽪DŽᆳоമ 2-10 ѝⲴᖙ㢢᮷ᵜᆇㅖⲴ኎ᙗᆇ㢲สᵜа㠤ˈնਚᴹє⿽仌㢢˖ⲭ㢢  ൘ 0'$ অ㢢᮷ᵜᱮ⽪ᯩᔿѝˈ⇿њᆇㅖⲴ኎ᙗᆇ㢲Ṭᔿ㿱㺘 2-4 ᡰ⽪DŽަѝˈ' 㖞  Պ֯ᆇㅖ䰚⛱˗  ኎ᙗᆇ㢲ս㖞 ᆇㅖᆇ㢲ս㖞˗ ˗ \[   ᆇㅖᆇ㢲ս㖞 [EYLGHRBQXPBFROXPV ǃ\ ༴Ⲵᆇㅖ઼኎ᙗ൘޵ᆈѝⲴս㖞ᱟ˖] ࡇᮠᱟ YLGHRBQXPBFROXPV ˈ䛓ѸսҾቿᒅࡇ㹼٬ തѝঐ⭘Ӿ [E ᔰ࿻Ⲵ .% オ䰤˄[E[E˅DŽྲ᷌ᱮ⽪ቿ㹼ᮠᱟ YLGHRBQXPBOLQHV ˗ ൠ൰ᆇ㢲ᆈ᭮ᆇㅖԓ⸱ˈཷൠ൰ᆇ㢲ᆈ᭮ᱮ⽪኎ᙗDŽ0'$ ঑䝽㖞ᴹ .% ᱮ⽪޵ᆈDŽ൘ 3& ᵪ޵ᆈራ൰㤳ڦѝ ਟᱮ⽪  њᆇㅖDŽ⇿њᆇㅖ䘈ᑖᴹ  њ኎ᙗᆇ㢲ˈഐ↔ᱮ⽪аቿ˄аᑗ˅޵ᇩ䴰㾱ঐ .% ᆇ㢲DŽަޡ ˈ˅ \ ˗㹼ਧ ᆇㅖᱮ⽪ᯩᔿ˄%,26 ᱮ⽪ᯩᔿ ˅DŽަቿᒅᱮ⽪㿴Ṭᱟ  ࡇ ; 㹼˄ࡇਧ [  অ㢢ᱮ⽪䘲䝽ಘ 0'$˄0RQRFKURPH'LVSOD\$GDSWHU˅ӵ᭟ᤱ唁ⲭє㢢ᱮ⽪DŽᒦфਚ᭟ᤱ⤜ᴹⲴ᮷ᵜ  0'$ ᱮ⽪ḷ߶ ᫽֌㌫㔏ӵ֯⭘Ҷ䘉ࠐ⿽ḷ߶䜭᭟ᤱⲴ᮷ᵜᱮ⽪ᯩᔿDŽ ⽪঑˅㲭❦䜭ާᴹᶱ儈Ⲵമᖒ༴⨶䙏ᓖ઼Ც㜭࣐䙏༴⨶࣏㜭ˈնᆳԜ䘈ᱟ䜭᭟ᤱ䘉ࠐ⿽ḷ߶DŽ/LQX[[ ߶ᴹঅ㢢 0'$ ḷ߶઼ᖙ㢢 &*$ ḷ߶ԕ৺ (*$ ઼ 9*$ ḷ߶DŽԕਾ᧘ࠪⲴᡰᴹ儈㓗ᱮ⽪঑˄वᤜ⧠൘Ⲵ $*3 ᱮ ሩҾ ,%03&$7 ৺ަެᇩ䇑㇇ᵪ㘼䀰ˈਟԕ֯⭘ᖙ㢢઼অ㢢ᱮ⽪঑DŽ,%0 ᴰᰙ᧘ࠪⲴ 3& ᵪ㿶仁㌫㔏ḷ 2.4.6 ᱴ⽰᧝࡬ UART Ⲵᐕ֌⌒⢩⦷ǃᮠᦞսᮠԕ৺ᐕ֌ᯩᔿㅹDŽ ֯ᗇ UART ޵䜘ᇴᆈಘ઼᧗ࡦ䙫䗁༽սDŽ↔ਾ㤕㾱֯⭘ UART ቡ䴰㾱ሩަ䘋㹼ࡍ࿻ॆ㕆〻᫽֌ˈԕ䇮㖞 ᯝˈӾ㘼ਟԕ߿䖫㌫㔏઼ CPU Ⲵ䍏ᣵDŽᖃ PC ᵪк⭥੟ࣘᰦˈ㌫㔏 RESET ؑਧ䙊䗷 NS8250 Ⲵ MR ᕅ㝊 ⡷䘈ਖཆ᭟ᤱ FIFO Ր䗃ᯩᔿDŽ൘䘉⿽ᯩᔿлˈUART ਟԕ൘᧕᭦ᡆਁ䘱Ҷᴰཊ 16 њᆇㅖਾ᡽ᕅਁа⅑ѝ ৺ަެᇩ㣟⡷ˈն䜭о NS8250/16450 㣟⡷ެᇩDŽNS8250/16450 о 16650A 㣟⡷Ⲵѫ㾱४࡛൘Ҿ 16650A 㣟 ਨⲴ NS8250 ᡆ NS16450 UART 㣟⡷ˈ⧠൘Ⲵ PC ᵪࡉ֯⭘Ҷ 16650AޜԕࡽⲴ PC ᵪ䜭֯⭘ഭᇦॺሬփ 㹼ᐕ֌ˈഐ↔ RS-232C ḷ߶㿴ᇊҶᖸཊ MODEM у⭘᧕ਓᕅ㓯DŽ ᐕ֌DŽPC ᵪкⲴѢ㹼᧕ਓ䙊ᑨ֯⭘ 25 㣟ᡆ 9 㣟Ⲵ DB-25 ᡆ DB-9 䘎᧕ಘˈѫ㾱⭘ᶕ䘎᧕ MODEM 䇮༷䘋 ಘ᧗ࡦ㣟⡷ UART˄Universal Asyncronous Receiver/Transmitter˅㓴ᡀⲴѢ㹼᧗ࡦಘᶕ༴⨶Ѣ㹼ᮠᦞⲴ᭦ਁ Ѫᇎ⧠Ѣ㹼䙊ؑˈPC ᵪк䙊ᑨ䜭ᑖᴹ 2 њㅖਸ RS-232C ḷ߶ⲴѢ㹼᧕ਓˈᒦ֯⭘䙊⭘ᔲ↕᧕᭦/ਁ䘱 3. Ѣ㹼᧗ࡦಘ   ᧗ࡦಘ઼᧗ࡦ঑ ᱮ⽪Ѫлࡂ㓯 ሩঅ㢢ᱮ⽪঑ˈ ᆇㅖ኎ᙗᆇ㢲 儈Ӟᓖ䰚⛱ 㛼Ჟ㢢 ࡽᲟ㢢 %/ 5 * % , 5 * % ' ' ' ' ' ' ' ' лєњ⻱ཤ൘ⴈ⡷є䶒䈫߉ᮠᦞˈⴈ⡷᯻䖜䙏⦷བྷ㓖൘ 300 䖜/࠶䫏DŽ⺜ⴈѝ䙊ᑨ䎧⸱वᤜ 2 ᕐᡆ㘵ᴤཊᕐ 㚊䞟㮴㟌֌ส⡷ˈ㘼⺜ⴈ⡷ࡉ䙊ᑨ֯⭘䠁኎䬍ਸ䠁֌ส⡷DŽаᕐ䖟ⴈѝਜ਼ᴹаᕐ㚊䞟㮴㟌ശⴈ⡷ˈ֯⭘к ൘ⴈ⡷кᆈۘᮠᦞⲴสᵜᯩᔿᱟ࡙⭘ⴈ⡷㺘䶒кⲴаቲ⻱ᙗӻ䍘൘⻱ॆਾⲴ࢙⻱⣦ᘱDŽ䖟ⴈ䙊ᑨ֯⭘ ᆈۘᐕ֌ᯩᔿDŽഐ↔䘉䟼ᡁԜԕ⺜ⴈѪֻᶕㆰ㾱䈤᰾ᆳԜⲴᐕ֌৏⨶DŽ ᆈؑ᚟ˈާᴹ㊫լⲴ؍ᵪѝᴰབྷᇩ䟿Ⲵཆ䜘ᆈۘ䇮༷ˈ䙊ᑨҏ㻛〠ѪཆᆈDŽ䖟ⴈ઼⺜ⴈ䜭ᱟ࡙⭘⻱ᙗӻ䍘 Ⲵ䠁኎ⴈ⡷പᇊ൘傡ࣘಘѝˈнਟ᣶নDŽ⭡Ҿ⺜ⴈާᴹᖸབྷⲴᆈۘᇩ䟿ˈᒦф䈫߉䙏ᓖᖸᘛˈഐ↔ᆳᱟ PC ഐ↔䮯ᵏԕᶕ䖟ⴈ傡ࣘಘᱟ PC ᵪкⲴḷ߶䝽㖞䇮༷ѻаDŽ ⺜ⴈҏᱟ⭡ⴈ⡷઼傡ࣘಘ㓴ᡀˈնᱟ䙊ᑨ⺜ⴈ PC ᵪⲴ䖟ⴈ᧗ࡦᆀ㌫㔏⭡䖟ⴈ⡷઼䖟ⴈ傡ࣘಘ㓴ᡀDŽ⭡Ҿ䖟ⴈਟԕᆈۘ〻ᒿ઼ᮠᦞᒦфᩪᑖᯩׯˈ 2.4.7 䖥ⴎૂ⺢ⴎ᧝࡬ಞ ޵ᆈDŽ൘മᖒᯩᔿлঐ⭘Ӿ [D ᔰ࿻Ⲵ⢙⨶޵ᆈൠ൰オ䰤DŽ ެᇩⲴᱮ⽪ᯩᔿлˈঐ⭘Ⲵ޵ᆈൠ൰䎧࿻ս㖞઼㤳ത䜭࠶࡛⴨਼DŽն (*$9*$ 䜭ḷ䝽ᴹ䎧⸱ .% Ⲵᱮ⽪ 䲔ެᇩᡆ᭟ᤱ 0'$ ઼ &*$ Ⲵᱮ⽪ᯩᔿԕཆˈ䘈᭟ᤱަԆ൘മᖒᱮ⽪ᯩ䶒Ⲵ໎ᕪᱮ⽪ᯩᔿDŽ൘о 0'$ ઼ &*$  ໎ᕪරമᖒ䘲䝽ಘ (*$˄(QKDQFHG*USDKLFV$GDSWHU˅઼㿶仁മᖒ䱥ࡇ 9*$˄9LGHR*UDSKLFV$GDSWHU˅  (*$9*$ ᱮ⽪ḷ߶ 0 1 1 1 0x07 ⚠ⲭ˄Light grey˅ 1 1 1 1 0x0f ⲭ㢢˄White˅ 0 1 1 0 0x05 ἅ㢢˄Brown˅ 1 1 1 0 0x0e 哴㢢˄Yellow˅ 0 1 0 1 0x05 ૱㓒˄Magenta˅ 1 1 0 1 0x0d ␑૱㓒˄Light magenta˅ 0 1 0 0 0x04 㓒㢢˄Red˅ 1 1 0 0 0x0c ␑㓒˄Light red˅ 0 0 1 1 0x03 䶂㢢˄Cyan˅ 1 0 1 1 0x0b ␑䶂˄Light cyan˅ 0 0 1 0 0x02 㔯㢢˄Green˅ 1 0 1 0 0x0a ␑㔯˄Light green˅ 0 0 0 1 0x01 㬍㢢˄Blue˅ 1 0 0 1 0x09 ␑㬍˄Light blue˅ 0 0 0 0 0x00 唁㢢˄Black˅ 1 0 0 0 0x08 ␡⚠˄Dark grey˅ 仌㢢਽〠 ٬ 仌㢢਽〠 I R G B ٬ I R G B 㺞 ࢃᲥ㢨ૂ㜂Ქ㢨δᐜঀ䜞࠼ε  㓴ਸⲴ仌㢢㿱㺘 2-5 ᡰ⽪DŽ ઼ 'ǃ'ǃ' ਟԕ࠶࡛㓴ਸࠪ  ⿽仌㢢DŽࡽᲟ㢢о儈Ӟᓖ∄⢩ս㓴ਸਟԕᱮ⽪ਖཆ  ⿽ᆇㅖ仌㢢DŽ䘉Ӌ  оঅ㢢ᱮ⽪аṧˈമѝ ' 㖞  ⭘Ҿ䇙ᱮ⽪ᆇㅖ䰚⛱˗' 㖞  䇙ᆇㅖ儈Ӟᓖᱮ⽪˗∄⢩ս 'ǃ'ǃ'  ഴ ᆍㅜኔᙝṲᕅᇐѿ   Ⲵ኎ᙗᆇ㢲Ṭᔿᇊѹ㿱മ 2-10 ᡰ⽪DŽ 〻ᒿѝਚ֯⭘Ҷަѝ .% ᱮ⽪޵ᆈ˄[E[ED˅DŽ൘ &*$ ᖙ㢢᮷ᵜᱮ⽪ᯩᔿѝˈ⇿њᱮ⽪ᆇㅖ ൠ൰ᆇ㢲ᆈ᭮ᆇㅖԓ⸱ˈཷൠ൰ᆇ㢲ᆈ᭮ᆇㅖᱮ⽪኎ᙗDŽն൘FRQVROHFڦˈṧˈ൘⇿аᑗ.% ᱮ⽪޵ᆈѝ ਟᆈ᭮  ᑗᱮ⽪ؑ᚟DŽ਼ޡ঑ḷ䝽ᴹ .% ᱮ⽪޵ᆈ˄ঐ⭘޵ᆈൠ൰㤳ത [E[EF˅ˈഐ↔ަѝ   ᧗ࡦಘ઼᧗ࡦ঑ ˅аᶑ⻱䚃˄᯻䖜аസ ൠ൰൪ ᮠᦞ൪ *$3 ਼↕  ᆇ㢲ᮠᦞ ṑ傼 *$3਼↕ ṑ傼 *$3ᡷ४  ᡷ४  ᡷ४ Qᡷ४ Q ൠ൰  *$3 ᡷ४ ⻱ཤ ⻱䚃  њᡷ४ 㿶؟ 㹼䈫/߉᫽֌ᰦˈᆳ䴰㾱ᆼᡀᮠᦞⲴ䖜ᦒ˄Ѣ--ᒦ˅ǃ㕆⸱઼ṑ傼᫽֌ˈᒦфᰦ࡫ⴁ㿶傡ࣘಘⲴ䘀㹼⣦ᘱDŽ ѫ㾱⭘Ҿ᧕᭦ CPU ਁࠪⲴભԔˈᒦṩᦞભԔ㾱≲ੁ傡ࣘಘ䗃ࠪ਴⿽⺜Ԧ᧗ࡦؑਧˈ㿱മ 2-13 ᡰ⽪DŽ൘ᢗ PC/AT ᵪѝ䖟ⴈ傡ࣘ᧗ࡦಘ FDC˄Floppy Disk Controller˅䟷⭘Ⲵᱟ NEC ­PD765 ᡆަެᇩ㣟⡷DŽᆳ Ѣ㹼∄⢩ᮠᦞ⍱ˈഐ↔᧗ࡦಘ䴰㾱൘ᒦ㹼ᆇ㢲ᮠᦞ઼Ѣ㹼∄⢩⍱ᮠᦞѻ䰤䘋㹼䖜ᦒDŽ Ӿᇎ䱵䈫/߉ᮠᦞѝ࠶⿫ࠪ䘉Ӌൠ൰ؑ᚟઼аӋ㕆⸱ǃ䀓⸱ㅹ᧗ࡦؑ᚟DŽਖཆˈо傡ࣘಘѻ䰤ⲴᮠᦞՐ䗃ᱟ ⍱ᖒᔿDŽ᧗ࡦಘо傡ࣘಘѻ䰤Ր䗃Ⲵᮠᦞवᤜമ 2-12 ѝⲴᡷ४ൠ൰ؑ᚟ԕ৺ᇊᰦ઼ᰦ䫏ؑ᚟DŽ᧗ࡦಘᗵ享 Ⲵ䙫䗁᧕ਓ⭥䐟ˈᆳӾ CPU ᧕᭦䈧≲ભԔˈੁ傡ࣘಘਁ䘱ራ䚃ǃ䈫/߉઼᧗ࡦؑਧˈᒦф᧗ࡦ઼䖜ᦒᮠᦞ ѪҶ䈫߉⻱ⴈ˄䖟ⴈ઼⺜ⴈ˅кⲴᮠᦞˈቡᗵ享֯⭘⻱ⴈ᧗ࡦಘDŽ⻱ⴈ᧗ࡦಘᱟ CPU о傡ࣘಘѻ䰤 ഴ ⴎ⡽⻷䚉Ṳᕅ⽰ᝅഴ  䗷䈫ਆൠ൰൪ѝⲴൠ൰ؑ᚟ቡਟԕୟаൠ⺞ᇊањᡷ४DŽ ᡷ४Ⲵḡ䶒ਧǃ⻱ཤਧ˄䶒ਧ˅઼ᡷ४ਧˈഐ↔䙊ޣᱟ 12 ᆇ㢲Ⲵ 0DŽ⇿њᡷ४ൠ൰൪Ⲵൠ൰ᆇ⇥ᆈ᭮⵰⴨ ࠶ᒦ䈫ਆ⻱䚃к਴ᡷ४ѝⲴᮠᦞˈ㿱മ 2-12 ᡰ⽪DŽަѝˈGAP ᱟ䰤䳄ᆇ⇥ˈ⭘Ҿ䎧䳄⿫֌⭘DŽ䙊ᑨ GAP 䈫ਆⲴ⇿њ⻱䚃к䜭ᴹᆈ᭮ؑ᚟Ⲵ⢩ᇊṬᔿˈഐ↔䙊䗷䇶࡛ᡰ䈫∄⢩ᮠᦞ⍱ѝⲴṬᔿˈ⻱ⴈ⭥䐟ቡਟԕ४ ᯩੁҏн਼ˈഐ↔⻱ⴈк䇠ᖅ⵰Ⲵ 0 ઼ 1 ᮠᦞቡ㻛䈫ࠪˈӾ㘼ਟӾ⻱ⴈк亪ᒿ䈫ࠪ∄⢩ᮠᦞ⍱DŽ⭡Ҿ⻱ཤ ࣋㓯DŽӾ㘼൘䈫㓯സѝഐᝏᓄ㘼ӗ⭏⭥⍱DŽṩᦞ⻱ⴈ㺘䶒࢙⻱⣦ᘱᯩੁⲴн਼ˈ൘㓯സѝᝏᓄӗ⭏Ⲵ⭥⍱ Ⲵ⻱ⴈḀњս㖞кDŽ⭡Ҿ⻱ⴈ൘᯻䖜ˈ⻱ӻ䍘⴨ሩ⻱ཤ֌र䙏䘀ࣘˈഐ↔⻱ཤᇎ䱵к൘࠷ࢢ⻱ӻ䍘кⲴ⻱ սҾ⻱ⴈ㺘䶒Ⲵ⻱ཤкᴹ࠶࡛ᴹањ䈫㓯സ઼߉㓯സDŽ൘䈫ᮠᦞ᫽֌䗷〻ѝˈ⻱ཤ俆ݸ〫ࣘࡠ᯻䖜⵰ ഴ ޭᴿ  ᕖⴎ⡽Ⲻޮශ⺢ⴎ޻䜞㔉ᶺ  ↔⺜ⴈᮠᦞⲴՐ䗃䙏ᓖ䙊ᑨਟ䗮ࠐॱݶ∄⢩/。DŽ ⡷Ⲵ⺜ⴈѝᴹ 8 њ䈫߉⻱ཤDŽ㿱മ 2-11 ᡰ⽪DŽ⺜ⴈ᯻䖜䙏⦷ᖸᘛ䙊ᑨ൘ 4500 䖜/࠶䫏ࡠ 10000 䖜/࠶䫏ˈഐ 䠁኎ⴈ⡷ˈഐ↔ާᴹཊњ䈫߉⻱ཤDŽֻྲˈሩҾवਜ਼ 2 њⴈ⡷Ⲵ⺜ⴈѝቡާᴹ 4 њ⢙⨶⻱ཤˈਜ਼ᴹ 4 њⴈ   ᧗ࡦಘ઼᧗ࡦ঑ 㠣㌫㔏ᙫ㓯 ޵䜘ᙫ㓯  ᧗ࡦ ᧕ਓ 傡ࣘಘ  ᧗ࡦ䙫䗁 䈫߉ ᮠᦞ㕃ߢ ᧗ࡦᇴᆈಘ ᮠᦞᇴᆈಘ ৲ᮠᇴᆈಘ ભԔᇴᆈಘ ѫ⣦ᘱᇴᆈಘ ⌅ᢙኅ䜘࠶Ⲵ޵ᇩDŽ 㕆䈁ಘˈ਼ᰦҏӻ㓽Ҷ㕆ࡦ޵Ṩ֯⭘Ⲵ GNU gcc 䈝ޣӻ㓽㕆ࡦ Linux ޵Ṩᡰ֯⭘Ⲵє⿽≷㕆䈝䀰䈝⌅઼⴨ ᶑԦDŽᵜㄐṩᦞՐ㔏ᗞᵪⲴ⺜Ԧ㓴ᡀ㔃ᶴˈㆰঅӻ㓽Ҷᗞᵪѝ਴њѫ㾱䜘࠶DŽлаㄐᡁԜӾ䖟Ԧ䀂ᓖࠪਁ 䀓䘀㹼ަк᫽֌㌫㔏Ⲵᗵ㾱⨶ޕ␡⺜Ԧᱟ᫽֌㌫㔏䘀㹼Ⲵส⹰ᒣਠDŽҶ䀓᫽֌㌫㔏䘀㹼Ⲵ⺜Ԧ⧟ຳᱟ 2.5 ᵢㄖቅ㔉 䎧㘼ԓѻⲴᱟ֯⭘ᇩ䟿䖳བྷᒦфᴤᇩ᱃ᩪᑖⲴ U ⴈᆈۘಘDŽ ⭡Ҿ䖟ⴈ⡷∄䖳ᇩ᱃䚝ࡠᦏൿ˄ਁ䴹ᡆࡂՔ˅ˈഐ↔ⴞࡽ䇑㇇ᵪѝᐢ㓿䙀⑀ᔰ࿻н䝽㖞䖟ⴈ傡ࣘಘˈ DŽޕ᧗ࡦಘⲴӻ ؑਧˈഐ↔䴰㾱֯⭘ DMA ᧗ࡦಘᇎᯭᮠᦞՐ䗃DŽ㘼 AT ⺜ⴈ᧗ࡦಘ䟷⭘儈䙏ᮠᦞඇ䘋㹼Ր䗃ˈн䴰㾱 DMA Ⲵ㔃᷌ؑ᚟DŽ㠣Ҿᡷ४ᮠᦞⲴՐ䗃ˈࡉ䖟ⴈ᧗ࡦಘо PC/AT ⺜ⴈ᧗ࡦಘн਼DŽ䖟ⴈ᧗ࡦಘ⭥䐟䟷⭘ DMA ᇴᆈಘ޵ᇩˈᒦ䙊䗷ᇴᆈಘ㧧ਆ᫽֌ޣሩ⻱ⴈ᧗ࡦಘⲴ㕆〻䗷〻ቡᱟ䙊䗷 I/O ㄟਓ䇮㖞᧗ࡦಘѝⲴ⴨ ഴ ⻷ⴎ᧝࡬ಞ޻䜞⽰ᝅഴ    ᵜㄐሿ㔃 䘉єњ〻ᒿѝ⭘ࡠⲴаӋ≷㕆〻ᒿ䈝⌅઼≷㕆ભԔ˄≷㕆ᤷ⽪ㅖ˅Ⲵ֌⭘઼⭘䙄DŽ ㌫㔏ӵ֯⭘ as86 ઼ ld86 㕆䈁઼䬮᧕к䶒ᨀࡠⲴєњ 16 ս≷㕆〻ᒿ bootsect.s ઼ setup.sˈഐ↔䘉䟼ӵӻ㓽 ⧠ԓ Linux ㌫㔏кਟԕⴤ᧕ᆹ㻵वਜ਼ as86/ld86 Ⲵ RPM 䖟Ԧवˈֻྲ dev86-0.16.3-8.i386.rpmDŽ⭡Ҿ Linux 䘉њ㕆䈁ಘ઼䘎᧕ಘⲴⓀԓ⸱ਟԕӾ FTP ᴽ࣑ಘ ftp.funet.fi кᡆӾ㖁ㄉ www.oldlinux.org л䖭DŽޣᴹ ㌫DŽޣਟԕ䈤 Linux ᫽֌㌫㔏Ⲵ䈎⭏о Bruce Evans ҏᴹ⵰ᇶ࠷Ⲵ ᯠᾲᘥ᫽֌㌫㔏Ⲵѫ㾱ࣘ࣋ѻаDŽLinus ᴮ㓿䈤䗷˖ĀBruce ᱟᡁⲴ㤡䳴āˈഐ↔ᡁԜޘփ㌫㔃ᶴкᔰਁањ ᫽֌㌫㔏Ⲵн䏣ѻ༴ҏᱟєњྭᴻ৻ӂ⴨᧒䇘ᗇࠪⲴ㔃᷌DŽMINIXⲴ䘉Ӌ㕪⛩↓ᱟ◰ਁLinus൘Intel 80386 UNIX ㊫᫽֌㌫㔏Ⲵ⸕䇶DŽMINIX ޣᱟྭ৻DŽ൘ Linux ޵ṨᔰਁࡍᵏˈLinus Ӿ Bruce Evans 䛓䟼ᆖࡠҶнቁᴹ Bruce Evans ᱟ MINIX ᫽֌㌫㔏 32 ս⡸ᵜⲴѫ㾱؞᭩㕆ࡦ㘵ѻаˈԆо Linux Ⲵࡋ࿻Ӫ Linus Torvalds ൘ PC/IX ㌫㔏к䘋㹼 MINIX ㌫㔏ᔰਁᐕ֌ⲴDŽ 㕆ಘ䈝⌅DŽPC/IX ᱟᖸᰙԕࡽ Intel 8086 CPU к䘀㹼Ⲵањ UN*X ㊫᫽֌㌫㔏ˈAndrew S. Tanenbaum ቡᱟ as86 Ⲵ䈝⌅ᱟสҾ MINIX ㌫㔏Ⲵ≷㕆䈝䀰䈝⌅ˈ㘼 MINIX ㌫㔏Ⲵ≷㕆䈝⌅ࡉᱟสҾ PC/IX ㌫㔏Ⲵ≷ 䀰䈝⌅˄ྲ᫽֌ᮠⲴ⅑ᒿо GNU as Ⲵ⴨৽ㅹ˅DŽ ਨⲴ Turbo ASM ઼ NASM ㅹ≷㕆ಘⲴ䈝⌅DŽ䘉Ӌ≷㕆ಘ䜭֯⭘Ҷ Intel Ⲵ≷㕆䈝ޜ 䖟Ⲵ MASMǃBorland ֻྲᆿԕ৺ᴤཊⲴ䭉䈟Ự⍻᡻⇥DŽн䗷䈕㕆䈁ಘⲴ䈝⌅о GNU as ≷㕆㕆䈁ಘⲴ䈝⌅нެᇩ㘼ᴤ䘁լҾᗞ ࡍ࿻䇮㖞〻ᒿ boot/setup.s ⲴҼ䘋ࡦᢗ㹼ԓ⸱DŽ䈕㕆䈁ಘᘛ䙏ሿᐗˈᒦާᴹаӋ GNU gas ᡰ⋑ᴹⲴ⢩ᙗˈ ⨶ಘ㕆ࡦ 32 սԓ⸱ˈնᱟ Linux ㌫㔏ӵ⭘ᆳᶕࡋᔪ 16 սⲴ੟ࣘᕅሬᡷ४〻ᒿ boot/bootsect.s ઼ᇎ⁑ᔿл 䬮᧕〻ᒿDŽ൘ࡊᔰ࿻ᔰਁ Linux ޵Ṩᰦ Linus ቡᐢ㓿ᢺᆳ〫ἽࡠҶ Linux ㌫㔏кDŽᆳ㲭❦ਟԕѪ 80386 ༴ as86 ઼ ld86 ᱟ⭡ MINIX-386 Ⲵѫ㾱ᔰਁ㘵ѻа Bruce Evans 㕆߉Ⲵ Intel 8086ǃ80386 ≷㕆㕆䈁〻ᒿ઼ 䟼ᡁԜ俆ݸ䈤᰾ as86 ≷㕆ಘⲴ֯⭘ᯩ⌅ˈas ≷㕆ಘⲴ֯⭘ᯩ⌅᭮൘ла㢲ѝ䘋㹼䈤᰾DŽ 䝽྇Ⲵ ld86 䬮᧕ಘ˗ਖа⿽ᱟ GNU Ⲵ≷㕆ಘ gas˄as˅ˈ֯⭘ GNU ld 䬮᧕ಘᶕ䬮᧕ӗ⭏Ⲵⴞḷ᮷ԦDŽ䘉 ൘ Linux 0.1x ㌫㔏ѝ֯⭘Ҷє⿽≷㕆ಘ˄Assembler˅DŽа⿽ᱟ㜭ӗ⭏ 16 սԓ⸱Ⲵ as86 ≷㕆ಘˈ֯⭘ 3.1 as86 ≽㕌ಞ ਾㄐ㢲ˈ൘䙷ࡠ䰞仈ᰦ޽എ䗷ཤᶕ৲㘳ᵜㄐ޵ᇩDŽ ᵜㄐ޵ᇩᱟ䰵䈫 Linux ޵ṨⓀԓ⸱ᰦⲴ৲㘳ؑ᚟DŽഐ↔ਟԕݸབྷ㠤⍿㿸алᵜㄐ޵ᇩˈ❦ਾቡ䰵䈫䲿 ṬᔿDŽᴰਾㆰঅ᧿䘠Ҷ Makefile ᮷ԦⲴ֯⭘ᯩ⌅DŽ 㓽алⴞḷ᮷ԦⲴสᵜṬᔿˈᒦ൘ᵜㄐ〽ਾ䜘࠶޽∄䖳䈖㓶ൠ㔉ࠪ Linux 0.11 ㌫㔏ѝ֯⭘Ⲵ a.out ⴞḷ᮷Ԧ ഐѪ⨶䀓ⴞḷ᮷ԦṬᔿᱟҶ䀓≷㕆ಘྲօᐕ֌Ⲵ䟽㾱ࡽᨀѻаˈᡰԕ൘ӻ㓽є⿽≷㕆䈝䀰ᰦՊ俆ݸㆰঅӻ ㅹ޵ṨⓀԓ⸱ѝᑨ⭘Ⲵ C 䈝䀰ᢙኅ޵ᇩ䘋㹼Ҷӻ㓽ˈ਼ᰦ䈖㓶᧿䘠Ҷ C ઼≷㕆࠭ᮠѻ䰤Ⲵ⴨ӂ䈳⭘ᵪࡦDŽ ≷㕆〻ᒿⲴ䈝⌅઼֯⭘ᯩ⌅ˈ❦ਾሩ GNU C 䈝䀰ѝⲴ޵㚄≷㕆ǃ䈝ਕ㺘䗮ᔿǃᇴᆈಘਈ䟿ԕ৺޵㚄࠭ᮠ Linux 0.11 ޵ṨⓀԓ⸱ᡰ䴰㾱Ⲵ≷㕆䈝䀰઼ GNU C 䈝䀰ᢙኅ⸕䇶DŽ俆ݸ∄䖳䈖㓶ൠӻ㓽Ҷ as86 ઼ GNU as ༴⨶DŽᵜㄐѫ㾱᧿䘠 Linux 0.11 ޵Ṩѝ֯⭘Ⲵ㕆〻䈝䀰ǃⴞḷ᮷ԦṬᔿ઼㕆䈁⧟ຳˈѫ㾱ⴞḷᱟᨀ׋䰵䈫 ࠶ԓ⸱䙊ᑨቡՊⴤ᧕֯⭘վ㓗≷㕆䈝䀰ᶕ㕆߉ˈᡆ㘵ሩ儈㓗䈝䀰㕆䈁ӗ⭏Ⲵ≷㕆〻ᒿ޽䘋㹼Ӫᐕ؞᭩Ոॆ 〻DŽ䘉⿽䖜ᦒ䗷〻䙊ᑨՊӗ⭏аӋ᭸⦷нᱟᖸ儈Ⲵԓ⸱ˈᡰԕሩаӋ䘀㹼᭸⦷㾱≲儈ᡆᙗ㜭ᖡ૽䖳བྷⲴ䜘 䈝䀰㕆䈁䗷〻ቡᱟᢺӪ㊫㜭⨶䀓Ⲵ儈㓗䈝䀰䖜ᦒᡀ䇑㇇ᵪ⺜Ԧ㜭⨶䀓઼ᢗ㹼ⲴҼ䘋ࡦᵪಘᤷԔⲴ䗷 ㅜ3ㄐ ޵Ṩ㕆〻䈝䀰઼⧟ຳ   DV ≷㕆ಘ ⭘Ā४ā䘉њ਽〠DŽ ฏāㅹࠐ⿽DŽᵜҖ൘н㠣Ҿ␧⏶༴⨶ಘ⇥ᾲᘥࡽᨀлՊṩᦞᡰ䘠޵ᇩᢺĀVHFWLRQā〠ѪĀ⇥āǃĀ४āᡆĀ䜘࠶āˈնѫ㾱䟷 ⲴĀVHJPHQWāભ਽DŽ䘉ҏਟԕӾ *18 ֯⭘᡻޼Ⲵ਴њ⡸ᵜਈ䗱ѝ㿲ሏࡠDŽVHFWLRQ Ⲵѝ᮷䈁⌅ᴹĀ⇥ǃ४ǃ㢲ǃ䜘࠶઼४ ㌫ˈᒦфᇩ᱃ᢺ䘉є㘵␧⏶䎧ᶕˈഐ↔⧠൘㤡᮷᮷⥞ѝ൷֯⭘ĀVHFWLRQāਆԓⴞḷ᮷ԦѝޣಘѝⲴ⇥ᇴᆈಘ⋑ᴹⴤ᧕ሩᓄ 䘉ᱟഐѪᰙᵏⴞḷ᮷ԦѝⲴ⇥ਟԕⴤ᧕ሩᓄࡠ䇑㇇ᵪ༴⨶ಘѝ⇥ⲴᾲᘥкDŽնᱟ⭡Ҿ⧠൘ⴞḷ᮷ԦѝⲴ⇥Ⲵᾲᘥᐢ㓿о༴⨶ ⴞḷ᮷Ԧѝᵟ䈝ĀVHFWLRQāሩᓄⲴѝ᮷਽〠ᴹཊ⿽DŽ൘ 81,; ᫽֌㌫㔏ᰙᵏ䱦⇥ˈ䈕ᵟ䈝൘ⴞḷ᮷Ԧѝ൷〠ѪĀVHJPHQWāDŽޣᴹ WH[W↓᮷⇥˗ ተḷ䇶ㅖˈ׋ OG 䬮᧕֯⭘˗ޘJOREOEHJWH[WEHJGDWDEHJEVVHQGWH[WHQGGDWDHQGEVV  ERRWVERRWVHFWV ⲴṶᷦ〻ᒿDŽ⭘ԓ⸱ [ ᴯᦒѢ PVJ ѝ  ᆇㅖˈ❦ਾ൘ቿᒅㅜ  㹼кᱮ⽪DŽ  Ҷᰐ᜿ѹⲴㅜ 20 㹼䈝ਕDŽޕ⌅ˈ᭵᜿࣐ 䘉њ⽪ֻᱟ bootsect.s ⲴањṶᷦ〻ᒿˈ㜭㕆䈁⭏ᡀᕅሬᡷ४ԓ⸱DŽަѝѪҶ╄⽪䈤᰾ḀӋ䈝ਕⲴ֯⭘ᯩ 㔉ࠪ㕆䈁䬮᧕઼䘀㹼ᯩ⌅ˈᴰਾ޽࠶࡛ࡇࠪ as86 ઼ ld86 Ⲵ֯⭘ᯩ⌅઼㕆ࡦ䘹亩DŽ⽪ֻ〻ᒿ㿱ྲлᡰ⽪DŽ л䶒ᡁԜԕањㆰঅⲴṶᷦ⽪ֻ〻ᒿ boot.s ᶕ䈤᰾ as86 ≷㕆〻ᒿⲴ㔃ᶴԕ৺〻ᒿѝ䈝ਕⲴ䈝⌅ˈ❦ਾ 3.1.2 as86 ≽㕌䈣䀶ぁᓅ ѝ࣐ԕ䈖㓶䈤᰾DŽ Ⲵ⇥DŽⴞḷ᮷ԦṬᔿሶ൘ਾ䶒Ā/LQX[ⴞḷ᮷ԦṬᔿāа㢲ޕᡁԜਟԕ֯⭘⇥᧗ࡦ՚᫽֌ㅖᶕᴤ᭩߉ ⇥ᔰ࿻ᆈ᭮DŽ WH[W ⸱ᡆᮠᦞⲴ䈝ਕˈ䜭Պ൘䘉йњѝⲴањ⇥ѝ⭏ᡀԓ⸱ᡆᮠᦞDŽ㕆䈁ӗ⭏Ⲵᆇ㢲ՊӾ 䜘ࡍ࿻ॆѪ DŽ൘㕆䈁䗷〻ѝˈ≷㕆䈝䀰〻ᒿѝՊӗ⭏ԓޘᡀᢗ㹼〻ᒿ㻛࣐䖭ᰦ᫽֌㌫㔏Պᢺ䈕⇥Ⲵ޵ᇩ ⮉オ䰤ˈն൘ⴞḷ᮷Ԧ䬮᧕؍⇥ᮠᦞ⇥ᱟањᵚࡍ࿻ॆⲴ⇥DŽ䙊ᑨ≷㕆ಘӗ⭏Ⲵ䗃ࠪⴞḷ᮷ԦѝнՊѪ䈕 〻ᒿⲴᢗ㹼ԓ⸱઼ਚ䈫ᮠᦞDŽᮠᦞ⇥ҏᱟањᐢࡍ࿻ॆ䗷Ⲵ⇥ˈަѝवਜ਼ᴹਟ䈫߉ⲴᮠᦞDŽ㘼ᵚࡍ࿻ॆ ⇥˄GDWD˅઼ᵚࡍ࿻ॆᮠᦞ⇥˄EVV˅DŽ↓᮷⇥˄ᡆ〠Ѫԓ⸱⇥˅ᱟањᐢࡍ࿻ॆ䗷Ⲵ⇥ˈ䙊ᑨަѝवਜ਼  ≷㕆ಘ㕆䈁ӗ⭏Ⲵⴞḷ᮷Ԧ REMILOH 䙊ᑨ䎧⸱वਜ਼йњ⇥ᡆ४˄VHFWLRQ˅ˈণ↓᮷⇥˄WH[W˅ǃᮠᦞ њ䐣䖜ᤷԔⲴⴞḷս㖞DŽᴰਾ䘈ਟԕ䐏䲿⭘⌘䟺ㅖᔰ࿻Ⲵ⌘䟺䜘࠶DŽ Ԕ਽˅઼᫽֌ᮠйњᆇ⇥㓴ᡀˈḷਧսҾаᶑᤷԔⲴㅜањᆇ⇥DŽᆳԓ㺘ަᡰ൘ս㖞Ⲵൠ൰ˈ䙊ᑨᤷ᰾а 䛓Ѹᖃࡽս㖞䇑ᮠಘⲴ٬ቡՊ䍻٬㔉䘉њḷਧDŽഐ↔аᶑ≷㕆䈝ਕ䙊ᑨ⭡ḷਧ˄ਟ䘹˅ǃᤷԔࣙ䇠ㅖ˄ᤷ 㓴ᡀDŽ൘㕆䈁䗷〻ѝˈᖃ≷㕆ಘ䙷ࡠањḷਧˈ  ࡽ䜭ਟԕᴹḷਧDŽḷਧᱟ⭡ањḷ䇶ㅖਾ䐏ањ߂ਧ ᵪಘᤷԔ䈝ਕᱟਟᢗ㹼ᵪಘᤷԔⲴࣙ䇠ㅖˈᆳ⭡᫽֌⸱઼ 0 њᡆཊњ᫽֌ᮠᶴᡀDŽਖཆˈԫօ䈝ਕѻ Ⲵㅖਧˈᆳ㺘⽪㕆䈁䗷〻ѝⲴս㖞䇑ᮠಘDŽަ٬ᱟ⛩ㅖਧࠪ⧠༴ᵪಘᤷԔㅜ 1 њᆇ㢲Ⲵൠ൰DŽ ᵜ䓛ᱟањ⢩↺  ᔰ࿻DŽ⛩ᆇㅖ  ᆳ⭡՚᫽֌⸱઼ 0 њᡆཊњ᫽֌ᮠ㓴ᡀDŽ⇿њ᫽֌⸱䜭⭡ањ⛩ᆇㅖ 㓴ᡀˈֻྲ˖Ā%2276(* [&āDŽ՚᫽֌ㅖ䈝ਕᱟ≷㕆ಘ֯⭘Ⲵᤷ⽪ㅖˈᆳ䙊ᑨᒦнՊӗ⭏ԫօԓ⸱DŽ ઼ᵪಘᤷԔ䈝ਕDŽ䍻٬䈝ਕ⭘Ҿ㔉ањㅖਧᡆḷ䇶ㅖ䍻٬DŽᆳ⭡ḷ䇶ㅖਾ䐏ањㅹҾਧˈ޽䐏ањ㺘䗮ᔿ  䈝ਕਟԕᱟਚवਜ਼オṬǃࡦ㺘ㅖ઼ᦒ㹼ㅖⲴオ㹼ˈҏਟԕᱟ䍻٬䈝ਕ˄ᡆᇊѹ䈝ਕ˅ǃ՚᫽֌ㅖ䈝ਕ њ䈝ਕˈն䙊ᑨ൘㕆ࡦ≷㕆䈝䀰〻ᒿᰦ⇿㹼ਚवਜ਼аᶑ䈝ਕDŽ ᮷ԦDŽ䈕᮷Ԧ޵ᇩᗵ享ᱟ⭡ᦒ㹼ᆇㅖ㔃ቮⲴа㌫ࡇ᮷ᵜ㹼㓴ᡀDŽ㲭❦ *18DV ਟ֯⭘࠶ਧ൘а㹼кवਜ਼ཊ Ⲵ≷㕆䈝䀰〻ᒿ VUFILOHᱟањ᮷ᵜޕަѝ䘹亩⭘ᶕ᧗ࡦ㕆䈁䗷〻ԕӗ⭏ᤷᇊṬᔿ઼䇮㖞Ⲵⴞḷ᮷ԦDŽ䗃  DV>䘹亩@RREMILOHVUFILOH њ≷㕆䈝䀰〻ᒿ˄ֻྲ VUFILOH˅㕆䈁ᡀⴞḷ᮷Ԧ˄REMILOH˅DŽ≷㕆ⲴભԔ㹼สᵜṬᔿᱟ˖ Ⲵаޕ≷㕆ಘу䰘⭘ᶕᢺվ㓗≷㕆䈝䀰〻ᒿ㕆䈁ᡀਜ਼ᵪಘ⸱ⲴҼ䘋ࡦ〻ᒿᡆⴞḷ᮷ԦDŽ≷㕆ಘՊᢺ䗃 3.1.1 as86 ≽㕌䈣䀶䈣⌋   DV ≷㕆ಘ њ⇥ѝᇊѹањḷਧˈᴰਾ޽࠷ᦒࡠ WH[W ⇥ᔰ࿻㕆߉䲿ਾⲴԓ⸱DŽ䘉䟼ᢺйњ⇥䜭ᇊѹ൘਼а䟽ਐൠ൰ ࡉ⭘Ҿḷ䇶ањᵚࡍ࿻ॆᮠᦞ⇥Ⲵᔰ࿻ˈᒦᢺᖃࡽ⇥᭩ਈᡀ EEV ⇥DŽഐ↔㹼  ⭘Ҿ൘⇿ EEV ⇥˗㘼 ⭘Ҿḷ䇶ᮠᦞ⇥Ⲵᔰ࿻ս㖞ˈᒦᢺᖃࡽ⇥࠷ᦒࡠ GDWD GDWD ḷ䇶↓᮷⇥Ⲵᔰ࿻ս㖞ˈᒦᢺ࠷ᦒࡠ WH[W ⇥˗ ⭘Ҿ WH[W Ԝ࠶࡛ሩᓄ≷㕆〻ᒿ㕆䈁ӗ⭏ⴞḷ᮷ԦѝⲴ  њ⇥ˈণ↓᮷⇥ǃᮠᦞ⇥઼ᵚࡍ࿻ॆᮠᦞ⇥DŽ DŽᆳ EEV ǃ GDWD ǃ WH[W ㅜ 5 㹼ࡠㅜ 11 㹼к䲔ᇊѹҶ 3 њḷਧཆˈ䘈ᇊѹҶ 3 њ՚᫽֌ㅖ˖ DŽޕተⲴˈᒦфণ֯н֯⭘ҏᕪࡦᕅޘ՚᫽֌ㅖ⭘Ҿᇊѹ䲿ਾⲴḷਧḷ䇶ㅖᱟཆ䜘Ⲵᡆ JOREO 䈝䀰〻ᒿ⭘ࡠⲴ઼аӋᑨ⭘Ⲵ DV ՚᫽֌ㅖDŽ 䙊ᑨањ≷㕆ಘ䜭᭟ᤱᖸཊн਼Ⲵ՚᫽֌ㅖˈնᱟл䶒ӵ䈤᰾ Linux ㌫㔏 ERRWVHFWV ઼ VHWXSV ≷㕆 DŽնᱟ൘ᕅ⭘ањḷਧᰦᰐ享ᑖ߂ਧDŽ EHJWH[W ֌ᮠDŽḷਧᱟਾ䶒ᑖ߂ਧⲴḷ䇶ㅖˈֻྲㅜ 6 㹼кⲴ ㅹḷਧቡᱟᆳⲴ᫽ EHJWH[WEHJGDWDEHJEVV ᱟањ՚᫽֌⸱ˈ㘼ަਾ䶒Ⲵḷਧ JOREO ㅜ 4 㹼кⲴ ᔰ࿻ˈᒦфнՊ൘㕆䈁ᰦӗ⭏ԫօԓ⸱DŽ≷㕆ᤷ⽪ㅖ⭡ањ՚᫽֌⸱ˈਾ䐏 0 њᡆཊњ᫽֌ᮠ㓴ᡀDŽֻྲ  ᱟ≷㕆ᤷ⽪ㅖ˄ᡆ〠Ѫ≷㕆՚ᤷԔǃ՚᫽֌ㅖ˅DŽ≷㕆ᤷ⽪ㅖ൷ԕањᆇㅖ JOREO ㅜ 4 㹼кⲴ 䶒൷Ѫ⌘䟺᮷ᆇDŽ⌘䟺䈝ਕਟԕ᭮൘ԫօ䈝ਕⲴਾ䶒ˈҏਟԕӾањᯠ㹼ᔰ࿻DŽ ᔰ࿻Ⲵ䈝ਕަਾ  ᡆ࠶ਧ  䈕〻ᒿᔰ࿻Ⲵ 3 㹼ᱟ⌘䟺䈝ਕDŽ൘ as86 ≷㕆䈝䀰〻ᒿѝˈࠑᱟԕᝏ਩ਧ ㅜ 5 ࡇ༴ᱮ⽪ࠪ㓒㢢ᆇㅖѢ"/RDGLQJV\VWHP"ˈᒦфݹḷл〫а㹼DŽ❦ਾ〻ᒿቡ൘ㅜ 27 㹼к↫ᗚ⧟DŽ 䖟ⴈㅜ 1 њᡷ४ⴤ᧕⭘ᶕᕅሬ䇑㇇ᵪ੟ࣘDŽ੟ࣘਾՊ൘ቿᒅㅜ 17 㹼ǃޕ㕆䈁䬮᧕ӗ⭏Ⲵᢗ㹼〻ᒿਟԕ᭮ ᡁԜ俆ݸӻ㓽䈕〻ᒿⲴ࣏㜭ˈ❦ਾ޽䈖㓶䈤᰾਴䈝ਕⲴ֌⭘DŽ䈕〻ᒿᱟањㆰঅⲴᕅሬᡷ४੟ࣘ〻ᒿDŽ HQGEVV EVV HQGGDWD GDWD HQGWH[W WH[W ZRUG[$$ᴹ᭸ᕅሬᡷ४ḷᘇˈ׋ %,26 ࣐䖭ᕅሬᡷ४֯⭘DŽ [)( ᔰ࿻ᆈ᭮DŽ  RUJ㺘⽪ԕਾ䈝ਕӾൠ൰ E\WH њ $6&,, ⸱ᆇㅖDŽ  ޡDVFLL/RDGLQJV\VWHP䈳⭘ %,26 ѝᯝᱮ⽪Ⲵؑ᚟DŽPVJ MPSORRS↫ᗚ⧟DŽORRS LQW[%,26 ѝᯝ䈳⭘ [ˈ࣏㜭 [ˈᆀ࣏㜭 DŽ PRYD[[߉ᆇㅖѢᒦ〫ࣘݹḷࡠѢ㔃ቮ༴DŽ PRYESPVJᤷੁ㾱ᱮ⽪ⲴᆇㅖѢ˄ѝᯝ䈳⭘㾱≲˅DŽ PRYE[[Fᆇㅖᱮ⽪኎ᙗ˄㓒㢢˅DŽ PRYG[[ᆇㅖѢሶᱮ⽪൘ቿᒅㅜ  㹼ǃㅜ  ࡇ༴DŽ ᱮ⽪  њᆇㅖˈवᤜഎ䖖ᦒ㹼ㅖDŽޡ]PRYF PRY>PVJ@DK[!ᴯᦒᆇㅖѢѝ  њ⛩ㅖਧˈஷਝሶՊ呓а༠DŽ PRYHVD[ PRYGVD[ D[ˈ⭘Ҿࡍ࿻ॆᮠᦞ⇥ᇴᆈಘ GV઼HVDŽ!٬ PRYD[FV⇥ᇴᆈಘ FVJR ൠ൰DŽ〫ٿMPSLJR%2276(*⇥䰤䐣䖜DŽ,1,76(* ᤷࠪ䐣䖜⇥ൠ൰ˈḷਧ JR ᱟ VWDUW HQWU\VWDUW੺⸕䬮᧕〻ᒿˈ〻ᒿӾ VWDUW ḷਧ༴ᔰ࿻ᢗ㹼DŽ  %2276(* [F%,26 ࣐䖭 ERRWVHFW ԓ⸱Ⲵ৏࿻⇥ൠ൰˗ WH[W↓᮷⇥˗ EHJEVV EVVᵚࡍ࿻ॆᮠᦞ⇥˗ EHJGDWD GDWDᮠᦞ⇥˗ EHJWH[W   DV ≷㕆ಘ āDŽᖃ❦ᡁԜҏਟԕ䊑⽪ֻѝⲴаṧⴤ᧕߉ࠪᆇㅖⲴ $6&,, ⸱DŽ ' Ā ˈᒦф䴰㾱֯⭘অᕅਧᢺᆇㅖᤜտDŽֻྲ˖ E\WH ઼ᦒ㹼˄˅єњᆇㅖDŽᇊѹᆇㅖ䴰㾱֯⭘՚᫽֌ㅖ 㹼кᇊѹҶഎ䖖 䘈Պ㠚ࣘ൘ᆇㅖѢਾ␫࣐ањ 18//˄˅ᆇㅖDŽਖཆˈㅜ DVFLL] ᆇㅖѢDŽ՚᫽֌ㅖ ˈᒦф䴰㾱֯⭘ৼᕅਧᤜտ DVFLL 㹼ᇊѹҶᆇㅖѢ PVJDŽᇊѹᆇㅖѢ䴰㾱֯⭘՚᫽֌ㅖ  ㅜ ⮉൘ቿᒅк㘼н㻛ࡐ䲔DŽ↫ᗚ⧟䈝ਕᱟ䈳䈅≷㕆〻ᒿᰦᑨ⭘Ⲵᯩ⌅DŽڌҶ䇙ᱮ⽪Ⲵ޵ᇩ㜭ཏ  ㅜ  㹼ᱟањ䐣䖜䈝ਕˈ䐣䖜ࡠᖃࡽᤷԔ༴DŽഐ↔䘉ᱟањ↫ᗚ⧟䈝ਕDŽ䘉䟼䟷⭘↫ᗚ⧟䈝ਕᱟѪ ES ᤷੁᆇㅖѢDŽⲴᆇㅖ኎ᙗˈHV E[ ѝᱟᱮ⽪֯⭘ˈG[ ѝᱟᱮ⽪ս㖞٬ˈㅖѢ˄PVJ˅߉ࡠቿᒅᤷᇊս㖞༴DŽᇴᆈಘ F[ ѝᱟᆇㅖѢ䮯ᓖ٬ ǃᆀ࣏㜭 DŽ䈕ѝᯝⲴ֌⭘ᱟᢺаᆇ  ㅜ  㹼ᱟ %,26 ቿᒅᱮ⽪ѝᯝ䈳⭘ LQW[DŽ䘉䟼֯⭘ަ࣏㜭 ˈ੖ࡉՊਈᡀᢺ PVJ ൠ൰༴Ⲵ޵ᇩ᭮ࡠҶᇴᆈಘѝʽ  ᇴᆈಘѝᰦҏаᇊ㾱൘ࡽ䶒࣐ ޕ޵ᆈൠ൰֯⭘㘼֯䈝ਕਈᡀ㔍ሩራ൰䈝ਕˈ㿱к䶒⽪ֻDŽਖཆˈᢺањḷਧ˄ֻྲ msg1˅Ⲵൠ൰٬᭮ ˈ੖ࡉሶ֌Ѫ  ㅜ 21--25 㹼Ⲵ䈝ਕ࠶࡛⭘Ҿᢺ・ণᮠ᭮ࡠ⴨ᓄⲴᇴᆈಘѝDŽ・ণᮠࡽаᇊ㾱࣐Ӆਧ VL@ PRYD[PJV>E[ PRYD[PVJ>E[@ D[ ѝDŽ ޕ㍒ᕅራ൰DŽᢺㅜ  њ᫽֌ᮠᡰᤷ޵ᆈս㖞༴Ⲵ٬᭮ PRYD[>PVJ@ PRYD[PVJ PRYD[ D[ ѝDŽ ޕ㔍ሩራ൰DŽᢺ޵ᆈൠ൰ ˄PVJ˅༴Ⲵ޵ᇩ᭮ PRYD[PVJ PRYD[ ᢺ・ণᮠ  ᭮ࡠ D[ ѝDŽᢺ PVJ ൠ൰٬᭮ࡠ D[ ѝDŽ MPS>E[@ PRY>E[@D[ ٬ᤷᇊ޵ᆈս㖞༴Ⲵ޵ᇩ֌Ѫ䐣䖜Ⲵൠ൰DŽ ]䰤᧕ᇴᆈಘራ൰DŽE MPSE[ PRYE[D[ ٬ᤷᇊⲴൠ൰༴ˈণᢺ E[ Ⲵ٬ᤧ䍍ࡠ ,3 ѝDŽ ]ⴤ᧕ᇴᆈಘራ൰DŽ䐣䖜ࡠ E  䰤᧕᫽֌ᮠⲴ⭘⌅DŽ൘ DV ѝˈ䰤᧕᫽֌ᮠ䴰㾱֯⭘ᯩᤜਧሩDŽਖཆаӋራ൰ᯩᔿᴹԕлаӋ˖ ս㖞༴DŽ䘉њᆇㅖሶሬ㠤 %,26 ѝᯝ൘ᱮ⽪ᆇㅖѢᰦ呓ਛа༠DŽ֯⭘䘉ᶑ䈝ਕѫ㾱ᱟѪҶ䈤᰾  ᴰਾањ ٬Ⲵ儈ᆇ㢲˄0x07˅ᆈ᭮ࡠ޵ᆈѝᆇㅖѢ msg1⇥ ㅜ 20 㹼кⲴ MOV ᤷԔ⭘Ҿᢺ ah ᇴᆈಘѝ 0x7c0 ᒿѝⲴᮠᦞ˄ᆇㅖѢ˅䘋㹼ራ൰DŽ 䇙ᆳԜ䜭ᤷੁ 0x7c0 ⇥DŽ䘉ṧׯҾሩ〻ˈ0x07C0:0x0005DŽ䲿ਾⲴєᶑ䈝ਕ࠶࡛㔉 DS ઼ ES ⇥ᇴᆈಘ䍻٬ 0x7c0DŽ䈕䈝ਕᢗ㹼ਾ CS:IP = ٬⇥CS:IP=0x0000:0x7c00DŽഐ↔䘉䟼֯⭘⇥䰤䐣䖜䈝ਕቡᱟѪҶ㔉 CS 䍻 䖭ࡠ⢙⨶޵ᆈ 0x7c00 ༴ᒦ䐣䖜ࡠ䈕༴ᰦˈᡰᴹ⇥ᇴᆈಘ˄वᤜ CS˅唈䇔٬൷Ѫ 0ˈণ↔ᰦ  ㅜ  㹼кᱟањ⇥䰤˄,QWHUVHJPHQW˅䘌䐣䖜䈝ਕˈቡ䐣䖜ࡠлаᶑᤷԔDŽ⭡Ҿᖃ BIOS ᢺ〻ᒿ࣐ ԫօㅖਧؑ᚟DŽ 䭞䇽ˈഐѪᡁԜᒦнᐼᵋ൘⭏ᡀⲴ㓟Ҽ䘋ࡦᢗ㹼᮷Ԧѝवᤜޣਟԕⴱ⮕䘉њޘERRWVHWXSV ≷㕆〻ᒿѝᆼ ਓḷਧˈԕׯҾ䈳䈅DŽնᱟ൘ᡁԜ䘉њ⽪ֻѝԕ৺ /LQX[ ޵Ṩ ERRWERRWVHFWV ઼ޕ䇽 HQWU\ ᤷᇊањ 䭞ޣDŽ䙊ᑨ൘䬮᧕ཊњⴞḷ᮷Ԧ⭏ᡀањਟᢗ㹼᮷Ԧᰦᓄ䈕൘ަѝањ≷㕆〻ᒿѝ⭘ VWDUW ᤷᇊⲴḷਧ 䭞ᆇˈ⭘Ҿ䘛֯䬮᧕ಘ OG ൘⭏ᡀⲴਟᢗ㹼᮷Ԧѝवᤜ䘋ަਾޣ⮉؍ᱟ HQWU\ ㅜ 14 㹼кⲴḷ䇶ㅖ 䘋ࡦDŽޝ઼ॱ 䘋ࡦޛഐ↔䘉њḷ䇶ㅖਟ〠Ѫㅖਧᑨ䟿DŽ䘉њ٬о C 䈝䀰ѝⲴ߉⌅аṧˈਟԕ֯⭘ॱ䘋ࡦǃˈᡰԓ㺘Ⲵ٬ ˅⭘Ҿᇊѹḷ䇶ㅖ %2276(* (48 ˄ᡆㅖਧ  ㅜ  㹼ᇊѹҶањ䍻٬䈝ਕĀ%2276(* [FāDŽㅹਧ 㤳തѝˈഐ↔ᵜ⽪ֻ〻ᒿᇎ䱵кн࠶⇥DŽ   DV ≷㕆ಘ Bochs ⁑ᤏ㌫㔏ѝ䘀㹼䈕〻ᒿˈᡁԜਟᗇࡠྲമ 3-1 ᡰ⽪⭫䶒DŽ Bochs PC ᵪ⁑ᤏ㌫㔏Ⲵ֯⭘ᯩ⌅䈧৲㘳ᴰਾаㄐ޵ᇩ˅DŽ㤕൘ ޣ᮷Ԧѝ˄ᴹۿBochs ⁑ᤏ㌫㔏Ⲵ䖟ⴈ᱐ к䶒ࡇࠪⲴㅜ 3 ᶑભԔቡᱟ࡙⭘ dd ભԔᶕ৫䲔 boot ѝⲴࡽ 32 ᆇ㢲ˈᒦᢺ䗃ࠪ㔃᷌ⴤ᧕߉ࡠ䖟ⴈᡆ „ ࡙⭘ Linux ㌫㔏Ⲵ dd ભԔDŽ ㌫㔏Ⲵ൘㓯֯⭘᡻޼亥˄man as86˅DŽޣ㔃ᶴⲴ㓟Ҽ䘋ࡦᢗ㹼᮷ԦⲴ䘹亩ˈ䈧৲㘳⴨ „ ֯⭘⧠൘ Linux ㌫㔏˄ֻྲ RedHat 9˅кⲴ as86 㕆䈁䬮᧕〻ᒿˈᆳԜާᴹਟ⭏ᡀнᑖ MINIX ཤ „ ֯⭘Ҽ䘋ࡦ㕆䗁〻ᒿࡐ䲔 boot 〻ᒿࡽ 32 ᆇ㢲ˈᒦᆈⴈ˗ ⿽˖ аㄐ޵ᇩ˅DŽѪҶ㜭֯⭘䘉њ〻ᒿᕅሬ੟ࣘᵪಘˈᡁԜ䴰㾱Ӫᐕ৫ᦹ䘉 32 ᆇ㢲DŽ৫ᦹ䈕ཤ㔃ᶴⲴᯩ⌅ᴹࠐ ᱟ䮯Ҷ 32 ᆇ㢲DŽ䘉 32 ᆇ㢲ቡᱟ MINIX ਟᢗ㹼᮷ԦⲴཤ㔃ᶴ˄ަ䈖㓶㔃ᶴ䈤᰾䈧৲㿱Ā޵Ṩ㓴ᔪᐕާā Ӿк䶒 OV ભԔࡇࠪⲴ᮷Ԧ਽ѝਟԕⴻࠪˈᴰਾ⭏ᡀⲴ boot 〻ᒿᒦнᱟࡽ䶒ᡰ䈤Ⲵ↓ྭ 512 ᆇ㢲ˈ㘼 ᤷᇊ⭏ᡀⲴਟᢗ㹼᮷Ԧ਽〠DŽ -o ᡀⲴਟᢗ㹼᮷ԦѝⲴㅖਧؑ᚟DŽ 䘹亩⭘Ҿ੺䇹䬮᧕ಘ㾱৫䲔ᴰਾ⭏ -s ⭘Ҿᤷᇊ⭏ᡀо GNU as ઼ ld 䜘࠶ެᇩⲴԓ⸱DŽ -a սⴞḷ〻ᒿ˗ ⭘Ҿ⭏ᡀ 8086 Ⲵ 16 -0 ሩⴞḷ᮷Ԧᢗ㹼䬮᧕᫽֌ˈᴰਾ⭏ᡀ MINIX 㔃ᶴⲴਟᢗ㹼᮷Ԧ bootDŽަѝ䘹亩 ަѝㅜ 1 ᶑભԔ࡙⭘ as86 ≷㕆ಘሩ boot.s 〻ᒿ䘋㹼㕆䈁ˈ⭏ᡀ boot.o ⴞḷ᮷ԦDŽㅜ 2 ᶑભԔ֯⭘䬮᧕ಘ ld86 >URRW@ UHFRUGVRXW UHFRUGVLQ 䖟ⴈᡆ ,PDJH ⴈ᮷ԦѝDŽޕ>URRW@GGGEV LI ERRWRI GHYIGVNLS ߉ ERRWVUZURRWURRW0D\ ERRWR0D\UZURRWURRW ERRWUZ[[[URRWURRW0D\  >URRW@OOVOERRW >URRW@OOGVRERRWERRWR䬮᧕DŽ৫ᦹㅖਧؑ᚟DŽ >URRW@DDVDRERRWRERRWV㕆䈁DŽ⭏ᡀо DV 䜘࠶ެᇩⲴⴞḷ᮷ԦDŽ 〻ᒿ䴰㾱ᢗ㹼ԕлࡽєᶑભԔ˖ ⧠൘ᡁԜ䈤᰾ྲօ㕆䈁䬮᧕⽪ֻ〻ᒿ boot.s ᶕ⭏ᡀᡁԜ䴰㾱ᕅሬᡷ४〻ᒿ bootDŽ㕆䈁઼䬮᧕к䶒⽪ֻ 3.1.3 as86 ≽㕌䈣䀶ぁᓅⲺ㕌䈇ૂ䬴᧛ 䜘ࡐ䲔ҏ㜭㕆䈁䬮᧕ӗ⭏ࠪ↓⺞Ⲵ㔃᷌DŽޘ32--37 㹼ਟԕ ਟԕⴱ⮕ᦹˈণ〻ᒿѝㅜ 4--11 㹼઼ޘ↔⽪ֻ〻ᒿѝ༠᰾਴њ⇥Ⲵ՚᫽֌ㅖ˄WH[WǃGDWD ઼EVV˅䜭ᆼ 䜭ᱟঅ⤜㕆䈁䬮᧕Ⲵ〻ᒿˈ਴㠚ᵏᵋ⭏ᡀⲴ䜭ᱟ㓟Ҽ䘋ࡦ᮷Ԧ㘼ᒦ⋑ᴹоަԆⴞḷ⁑ඇ᮷Ԧ䘋㹼䬮᧕ˈഐ ᶕ൘䬮᧕ཊњⴞḷ⁑ඇᰦ४࠶਴њ⁑ඇѝ਴⇥Ⲵᔰ࿻઼㔃ᶏս㖞DŽ⭡Ҿ޵ṨѝⲴ bootsec.s ઼ setup.s 〻ᒿ  ㅜ  㹼৸൘йњ⇥ѝ࠶࡛᭮㖞ҶйњḷਧDŽ࠶࡛⭘ᶕ㺘⽪йњ⇥Ⲵ㔃ᶏս㖞DŽ䘉ṧ䇮㖞ਟԕ⭘ ԕᦞ↔⺞ᇊ ERRWV 㕆䈁ࠪᶕⲴᢗ㹼〻ᒿᓄ䈕↓ྭѪ  ᆇ㢲DŽ ᆇ㢲޵ᆈሩ䊑˄ਈ䟿˅ˈަਾਟԕᱟањᮠᡆ㘵ᱟањ㺘䗮ᔿDŽ⭡Ҿਾ䶒⋑ᴹԓ⸱ᡆᮠᦞҶˈഐ↔ᡁԜਟ ⭘Ҿ൘ᖃࡽս㖞ᇊѹањৼ ZRUG ᒦ൘↔༴˄ㅜ  㹼˅᭮㖞Ҷᴹ᭸ᕅሬᡷ४ḷᘇᆇ [$$DŽ՚᫽֌ㅖ Ⲵս㖞䇑ᮠಘ٬䈳ᮤѪ䈕՚᫽֌ㅖ䈝ਕк㔉ࠪⲴ٬DŽሩҾᵜ⽪ֻ〻ᒿˈ䈕䈝ਕᢺս㖞䇑ᮠಘ䇮㖞Ѫ ˈ ᇊѹҶᖃࡽ≷㕆Ⲵս㖞DŽ䘉ᶑ䈝ਕՊᢺ≷㕆ಘ㕆䈁䗷〻ѝᖃࡽ⇥ RUJ  ㅜ  㹼кⲴ՚᫽֌ㅖ䈝ਕ   DV ≷㕆ಘ ˗Zнᱮ⽪䆖੺ؑ᚟ Ⲵᵚᤷᇊ⇥Ⲵㅖਧ˗ޕXሶᵚᇊѹㅖਧ֌Ѫ䗃 Vӗ⭏ㅖਧ᮷Ԧˈਾ䐏ㅖਧ᮷Ԧ਽˗ Rӗ⭏ⴞḷ᮷Ԧˈਾ䐏ⴞḷ᮷Ԧ਽˄REMILOH˅˗ ⴞḷ᮷Ԧѝ˅˗ޕQਾ䶒䐏䲿⁑ඇ਽〠˄ਆԓⓀ᮷Ԧ਽〠᭮ P൘ࡇ㺘ѝᢙኅᆿᇊѹ˗ Oӗ⭏ࡇ㺘᮷Ԧˈਾ䶒ਟԕ䐏䲿ࡇ㺘᮷Ԧ਽˗ M֯ᡰᴹ䐣䖜䈝ਕ൷Ѫ䮯䐣䖜˗ ተㅖਧ˗ޘޕJ൘ⴞḷ᮷Ԧѝӵᆈ Eӗ⭏Ҽ䘋ࡦ᮷Ԧˈਾ䶒ਟԕ䐏᮷Ԧ਽˗ Dᔰ੟о *18DVǃOG Ⲵ䜘࠶ެᇩᙗ䘹亩˗ ֯⭘  ∄⢩ԓ⸱⇥˗ ֯⭘  ∄⢩ԓ⸱⇥˗ ਴䘹亩ਜ਼ѹ˖  ਾⲴᢙኅ਽˅˗  QDPHⓀ᮷ԦⲴสᵜ਽〠˄ণнवᤜ OLVW൘ḷ߶䗃ࠪкᱮ⽪˗ ֯⭘  Ⲵ  ս䗃ࠪ˗  䰝ᡆᰐ˗㤕⋑ᴹ᰾⺞䈤᰾ D ḷᘇˈࡉнՊᴹ䗃ࠪޣ䲔Ҷԕл唈䇔٬ԕཆˈަԆ䘹亩唈䇔Ѫ 唈䇔䇮㖞  DV>DJMXZ@>E>ELQ@@>OP>OLVW@@>QQDPH@>RREMILOH@>VV\P@VUFILOH DV Ⲵ֯⭘ᯩ⌅઼䘹亩˖ as86 ઼ ld86 Ⲵ֯⭘ᯩ⌅઼䘹亩ྲл˖ 3.1.4 as86 ૂ ld86 ֵ⭞ᯯ⌋ૂ䘿亯 ഴ ൞ %RFKV ⁗ᤕ㌱㔕ѣ䘆㺂 ERRW ᕋሲぁᓅⲺᱴ⽰㔉᷒    DV ≷㕆ಘ 㕆䈝䀰〻ᒿ਽DŽྲ᷌⋑ᴹ֯⭘䗃ࠪ≶ޕަѝ REMILOH ᱟ as 㕆䈁䗃ࠪⲴⴞḷ᮷Ԧ਽ˈVUFILOHV ᱟ as Ⲵ䗃 DV>䘹亩@>RREMILOH@>VUFILOHV@ ֯⭘ as ≷㕆ಘ㕆䈁ањ as ≷㕆䈝䀰〻ᒿⲴสᵜભԔ㹼Ṭᔿྲлᡰ⽪˖ 3.2.1 㕌䈇 as ≽㕌䈣䀶ぁᓅ 䶒ӻ㓽ѝ㤕ᴹ⎹৺ⴞḷ᮷ԦṬᔿᰦˈᡁԜሶത㔅 Linux 0.11 ㌫㔏䟷⭘Ⲵ DRXW ⴞḷ᮷ԦṬᔿ䘋㹼䈤᰾DŽ ㌫нབྷˈնᱟ൘лޣṬᔿⲴⴞḷ᮷ԦDŽ㲭❦㕆ࡦⲴ as ≷㕆䈝䀰〻ᒿоާփ䟷⭘ᡆ⭏ᡀӰѸṬᔿⲴⴞḷ᮷Ԧ GNU as ≷㕆ಘᴰࡍᱟԯ➗ BSD 4.2 Ⲵ≷㕆ಘ䘋㹼ᔰਁⲴDŽ⧠൘Ⲵ as ≷㕆ಘ㜭ཏ䝽㖞ᡀӗ⭏ᖸཊн਼ 䘉वᤜᆇㅖǃᮠᆇ઼ᑨᮠ㺘⽪ᯩ⌅ԕ৺㺘䗮ᔿᖒᔿㅹᯩ䶒DŽ ӗ⭏Ⲵѝ䰤≷㕆䈝䀰〻ᒿⲴˈ㘼䶎֌Ѫањ⤜・Ⲵ≷㕆ಘ֯⭘DŽഐ↔ˈas ≷㕆ಘҏ᭟ᤱᖸཊ C 䈝䀰⢩ᙗˈ Պ䈳⭘ as ≷㕆ಘᢺ䘉њѤᰦ≷㕆䈝䀰〻ᒿ㕆䈁ᡀⴞḷ᮷ԦDŽণᇎ䱵к as ≷㕆ಘᴰࡍᱟу䰘⭘Ҿ≷㕆 gcc ൘㕆䈁 C 䈝䀰〻ᒿᰦˈGNU gcc 㕆䈁ಘՊ俆ݸ䗃ࠪањ֌Ѫѝ䰤㔃᷌Ⲵ as ≷㕆䈝䀰᮷Ԧˈ❦ਾ gcc 䭞⛩ѻаDŽޣཏ⨶䀓䘉Ӌ≷㕆䈝䀰〻ᒿⲴ࣏㜭ҏቡᰐ⯁ᡀѪ⨶䀓ањ᫽֌㌫㔏ާփᇎ⧠Ⲵ 㕆䈝ਕDŽᱟ੖㜭≶ޕѝᯝ઼ᔲᑨ༴⨶䗷〻᧕ਓ〻ᒿǃԕ৺ᖸཊᆿᇊѹ䜭֯⭘Ҷ as ≷㕆䈝䀰〻ᒿᡆᢙኅⲴ፼ 䭞֌⭘Ⲵ≷㕆䈝䀰〻ᒿ䟿DŽLinux ᫽֌㌫㔏ҏнֻཆˈᆳⲴ 32 սࡍ࿻ॆԓ⸱ǃᡰᴹޣਜ਼བྷ㓖 10%ᐖਣⲴ䎧 䭞ԓ⸱㾱≲ᴹᖸ儈Ⲵᢗ㹼䙏ᓖ઼᭸⦷ˈഐ↔൘ањ᫽֌㌫㔏Ⓚԓ⸱ѝ䙊ᑨቡՊवޣ⭡Ҿ᫽֌㌫㔏䇨ཊ ՚ᤷԔ˄ᤷ⽪ㅖ˅Ⲵਜ਼ѹ઼֯⭘ᯩ⌅DŽᑖᴹ䈖㓶䈤᰾ؑ᚟Ⲵ as ≷㕆䈝䀰〻ᒿᇎֻሶ൘лаㄐᴰਾ㔉ࠪDŽ GNU as ≷㕆ಘ˄ㆰ〠 as ≷㕆ಘ˅Ⲵ֯⭘ᯩ⌅DŽᡁԜ俆ݸӻ㓽 as ≷㕆䈝䀰〻ᒿⲴ䈝⌅ˈ❦ਾ㔉ࠪᑨ⭘≷㕆 䈝䀰〻ᒿ㕆䈁ӗ⭏Ⲵ⁑ඇ䬮᧕DŽᵜ㢲ԕ 80X86 CPU ⺜ԦᒣਠѪส⹰ӻ㓽 Linux ޵Ṩѝ֯⭘≷㕆〻ᒿ䈝⌅઼ ERRWVHWXSVDŽ޵Ṩѝަ։ᡰᴹ≷㕆䈝䀰〻ᒿ˄वᤜ C 䈝䀰ӗ⭏Ⲵ≷㕆〻ᒿ˅൷֯⭘ gas ᶕ㕆䈁ˈᒦо C к㢲ӻ㓽Ⲵ DV ≷㕆ಘӵ⭘Ҿ㕆䈁޵ṨѝⲴ ERRWERRWVHFWV ᕅሬᡷ४〻ᒿ઼ᇎ⁑ᔿлⲴ䇮㖞〻ᒿ 3.2 GNU as ≽㕌 V൘ⴞḷ᮷Ԧѝࡐ䲔ᡰᴹㅖਧDŽ Uӗ⭏䘲ਸҾ䘋а↕䟽ᇊսⲴ䗃ࠪ˗ Rᤷᇊ䗃ࠪ᮷Ԧ਽ˈਾ䐏䗃ࠪ᮷Ԧ਽˗ P൘ḷ߶䗃ࠪ䇮༷кᱮ⽪ᐢ䬮᧕Ⲵ⁑ඇ˗ 䬮᧕Ⲵ᮷Ԧࡇ㺘ѝ˗ޕO[ሶᓃORFDOOLEVXEGLUOLE[D ࣐ '˅䗃ࠪ˗ L࠶⿫ⲴᤷԔоᮠᦞ⇥˄, ֯⭘䘲ਸҾ VWUWRXO ⲴṬᔿ ˗ 7ਾ䶒䐏䲿↓᮷สൠ൰ 0൘ḷ߶䗃ࠪ䇮༷кᱮ⽪ᐢ䬮᧕Ⲵㅖਧ˗ ӗ⭏ާᴹ  ∄⢩冄ᮠⲴཤ㔃ᶴˈᒦфሩO[ 䘹亩֯⭘ L ᆀⴞᖅ˗ ӗ⭏ާᴹ  ∄⢩冄ᮠⲴཤ㔃ᶴˈᒦфሩO[ 䘹亩֯⭘ L ᆀⴞᖅ˗  RXWILOH  DRXW Ṭᔿ䗃ࠪ˗   ս䗃ࠪ˗  䰝ᡆᰐޣ䲔Ҷԕл唈䇔٬ԕཆˈަԆ䘹亩唈䇔Ѫ 唈䇔䇮㖞  OG>0LPUV>@@>7WH[WDGGU@>OOLEBH[WHQVLRQ@>RRXWILOH@LQILOH ሩҾ⭏ᡀ *180LQL[ Ⲵ DRXW ṬᔿⲴ⡸ᵜ˖  OG>0LPV>@@>7WH[WDGGU@>OOLEBH[WHQVLRQ@>RRXWILOH@LQILOH ሩҾ⭏ᡀ 0LQL[DRXW ṬᔿⲴ⡸ᵜ˖ OG 䘎᧕ಘⲴ֯⭘䈝⌅઼䘹亩˖   18DV ≷㕆* 䇙 as ֯⭘ gcc Ⲵ CPP 亴༴⨶࣏㜭DŽ 6 䇙≷㕆䈝䀰〻ᒿ֯⭘བྷ߉Ⲵਾ㔰 ᱟ䈕亴༴⨶࣏㜭нՊሩᆿᇊѹ䘋㹼༴⨶ˈҏ⋑ᴹ༴⨶वਜ਼᮷ԦⲴ࣏㜭DŽྲ᷌䴰㾱䘉ᯩ䶒Ⲵ࣏㜭ˈ䛓Ѹਟԕ ࡦ㺘ㅖ˗ࡐ䲔ᡰᴹ⌘䟺䈝ਕᒦф֯⭘অњオṬᡆаӋᦒ㹼ㅖᴯᦒᆳԜ˗ᢺᆇㅖᑨᮠ䖜ᦒᡀሩᓄⲴᮠ٬DŽն as ≷㕆ಘާᴹሩ≷㕆䈝䀰〻ᒿ޵㖞Ⲵㆰঅ亴༴⨶࣏㜭DŽ䈕亴༴⨶࣏㜭Պ䈳ᮤᒦࡐ䲔ཊ։ⲴオṬᆇㅖ઼ 3.2.2.1 ≽㕌ぁᓅ人༺⨼ 7 ≷㕆ಘнᨀ׋ሩཊԓ⸱⇥〻ᒿⲴ᭟ᤱˈ81,; ㊫᫽֌㌫㔏㾱≲ᡰᴹԓ⸱൘ањ⇥ѝDŽ „ $7 DŽ UHWIDUVWDFNDGMXVW Ⲵ ሩᓄ ,QWHO OUHWVWDFNDGMXVW 7 䈝⌅ѝ䘌䘄എᤷԔ DŽ਼ṧˈ$7 RIIVHWMPSFDOOIDUVHFWLRQ ˈ㘼 ,QWHO Ⲵᱟ OMPSOFDOOVHFWLRQRIIVHW 7 䈝⌅ѝ・ণᖒᔿⲴ䘌䐣䖜઼䘌䈳⭘Ѫ „ $7 DŽ PRYEIRRDO 7 Ⲵ䈝ਕ ሩᓄҾ $7 PRYDOE\WHSWUIRR ,QWHO Ⲵ䈝ਕ ᶕ䗮ࡠ਼ṧⴞⲴDŽഐ↔ˈ GZRUGSWU ઼ ZRUGSWU ǃ E\WHSUW ࡉ䙊䗷൘޵ᆈ᫽֌ᮠࡽ֯⭘ࡽ㔰 ࠶࡛ᤷ⽪޵ᆈᕅ⭘ᇭᓖѪ  սᆇ㢲˄E\WH˅ǃ սᆇ˄ZRUG˅઼  ս䮯ᆇ˄ORQJ˅DŽ,QWHO 䈝⌅ O ઼ Z ǃ E 7 䈝⌅ѝ޵ᆈ᫽֌ᮠⲴ䮯ᓖ˄ᇭᓖ˅⭡᫽֌⸱ᴰਾањᆇㅖᶕ⺞ᇊDŽ᫽֌⸱ਾ㔰 „ $7 DŽ DGGOHD[ 7 Ⲵ ሩᓄ $7 DGGHD[ DŽֻྲ ,QWHO Ⲵ䈝ਕ ⓀⴞⲴ ਣ 7 ⲴⓀ઼ⴞⲴ᫽֌ᮠᱟӾᐖࡠ 7 䈝⌅о ,QWHO 䈝⌅֯⭘ⲴⓀ઼ⴞⲴ᫽֌ᮠ⅑ᒿ↓ྭ⴨৽DŽ$7 „ $7 ⋑ᴹ䘉Ӌ䲀ࡦDŽ DŽ㘼 ,QWHO ≷㕆䈝⌅൷ Ⲵ䐣䖜䈳⭘˅᫽֌ᮠࡽ䶒㾱࣐ᱏਧޣ䈳⭘˄⴨ሩҾо〻ᒿ䇑ᮠಘᴹ ˗㔍ሩ䐣䖜  ˗ᇴᆈಘ᫽֌ᮠ਽ࡽ㾱࣐ᆇㅖⲮ࠶ਧ  7 䈝⌅ѝ・ণ᫽֌ᮠࡽ䶒㾱࣐ањᆇㅖ „ $7 ࠐ⛩˖ ⌅˅DŽ䘉⿽䈝⌅о ,QWHO ≷㕆〻ᒿ֯⭘Ⲵ䈝⌅˄ㆰ〠 ,QWHO 䈝⌅˅ᖸнаṧˈᆳԜѻ䰤Ⲵѫ㾱४࡛ᴹаӋ 7 䈝 7 ㌫㔏 9 Ⲵ≷㕆䈝⌅˄л䶒ㆰ〠Ѫ $7  ѪҶ㔤ᤱо JFF 䗃ࠪ≷㕆〻ᒿⲴެᇩᙗˈDV ≷㕆ಘ֯⭘ $7 3.2.2 as ≽㕌䈣⌋ >XVUVUFOLQX[ERRW@ KHDGV1RYUZUZ[U[URRWURRW KHDGR0D\UZUZ[U[URRWURRW  >XVUVUFOLQX[ERRW@OOVOKHDG >XVUVUFOLQX[ERRW@DDVRKHDGRKHDGV лᖒᔿⲴભԔ˖ྲޕᡁԜᜣঅ⤜㕆䈁 ERRWKHDGV ≷㕆〻ᒿˈ䛓Ѹਟԕ൘ભԔ㹼к䭞ྲٷ ㅖਧؑ᚟DŽ/LQX[ ㌫㔏ѝ֯⭘Ⲵ DRXW ⴞḷ᮷ԦṬᔿሶ൘ᵜㄐਾ䶒䘋㹼䈤᰾DŽ ᮷ԦDŽⴞḷ᮷Ԧѝवਜ਼ᴹᐢ≷㕆䗷Ⲵ〻ᒿԓ⸱ǃॿࣙ OG ӗ⭏ਟᢗ㹼〻ᒿⲴؑ᚟ǃԕ৺ਟ㜭䘈वਜ਼䈳䈅ޕ ᤷᇊ䗃ࠪ᮷ԦⲴ਽〠ˈ੖ࡉ DV ሶӗ⭏਽Ѫ DRXW Ⲵ䗃ࠪ᮷ԦDŽⴞḷ᮷Ԧѫ㾱⭘Ҿ֌Ѫ䬮᧕ಘ OG Ⲵ䗃 R Ⲵ≷㕆䈝䀰〻ᒿ㕆䈁⭏ᡀⲴҼ䘋ࡦᮠᦞ᮷Ԧˈণⴞḷ᮷ԦDŽ䲔䶎ᡁԜ֯⭘䘹亩ޕ as Ⲵ䗃ࠪ᮷Ԧᱟ䗃 DŽ  ᮷Ԧˈ䛓Ѹቡ䴰㾱֯⭘৲ᮠޕ֌Ѫ䗃ޕ䗃 Ctrl-D 㓴ਸ䭞ᶕ੺⸕ as ≷㕆ಘDŽ㤕ᜣ൘ભԔ㹼к᰾⺞ᤷ᰾ᢺḷ߶ ޕᰦቡ䴰㾱᡻ᐕ䭞ޕ㤕ᐢ⋑ᴹ޵ᇩ㾱䗃 ᮷Ԧ޵ᇩDŽ൘䘉⿽ᛵߥлˈޕѝ䈫ਆ䗃ޕ㹼к⋑ᴹ㔉ࠪԫօ᮷Ԧ਽ˈ䛓Ѹ as ሶՊ䈅മӾ㓸ㄟᡆ᧗ࡦਠḷ߶䗃 ᮷Ԧ਽ⴻᖵDŽྲ᷌൘ભԔޕ޵ᇩDŽ൘ભԔ㹼кԫօս㖞༴Ⲵ৲ᮠ㤕⋑ᴹ⢩ᇊਜ਼ѹⲴ䈍ˈሶՊ㻛֌Ѫањ䗃 ᮷ԦⲴޕ᮷Ԧ਽DŽas ሶՊ᤹ӾᐖࡠਣⲴ亪ᒿ䈫ਆ䘉Ӌ䗃ޕᡁԜਟԕ൘ as ભԔ㹼к㔉ࠪ䴦њᡆཊњ䗃 ҏᱟањ᮷Ԧ˅DŽޕⓀ〻ᒿDŽնањⓀ〻ᒿਟ⭡ཊњ᮷ᵜ᮷Ԧ㓴ᡀ˄㓸ㄟⲴḷ߶䗃 Պ᭩ਈ〻ᒿⲴ䈝ѹDŽ〻ᒿⲴⓀԓ⸱ᱟᡰᴹ䘉Ӌ᮷Ԧ᤹⅑ᒿⲴ㓴ਸ㔃᷌DŽ⇿⅑䘀㹼 as 㕆䈁ಘˈᆳਚ㕆䈁ањ ањ〻ᒿⲴⓀ〻ᒿਟԕ㻛᭮㖞൘ањᡆཊњ᮷Ԧѝˈ〻ᒿⲴⓀԓ⸱ᱟྲօ࠶ࢢ᭮㖞൘ࠐњ᮷Ԧѝᒦн DŽޣ઼᮷Ԧ਽DŽᡰᴹ䘹亩ਟ䲿᜿᭮㖞ˈնᱟ᮷Ԧ਽Ⲵ᭮㖞⅑ᒿ㕆䈁㔃᷌ᇶ࠷⴨ ᮷Ԧ਽ˈ䛓Ѹ as Պ㕆䈁䗃ࠪ਽〠Ѫ DRXW Ⲵ唈䇔ⴞḷ᮷ԦDŽ൘ as 〻ᒿ਽ѻਾˈભԔ㹼кਟवਜ਼㕆䈁䘹亩   18DV ≷㕆*  Ⲵ㺘⽪ᯩ⌅о & 䈝䀰ѝⲴสᵜаṧDŽ⭡Ҿ޵Ṩԓ⸱ѝࠐѾн⭘⎞⛩ᮠˈഐ↔䘉䟼н޽ሩަ䘋㹼䈤᰾DŽ  བྷᮠ˄%LJQXP˅ᱟսᮠ䎵䗷  սҼ䘋ࡦսⲴᮠˈަ㺘⽪ᯩ⌅оᮤᮠⲴ⴨਼DŽ≷㕆〻ᒿѝሩ⎞⛩ᑨᮠ DŽ  㤕㾱㺘⽪䍏ᮠˈਚ䴰൘ࡽ䶒␫࣐䍏ਧ ˅DŽ DI$) 䘋ࡦᮠ˄ޝᔰཤⲴॱ ; ᡆ [ ˅઼֯⭘  ᮠᆇᔰ࿻Ⲵॱ䘋ࡦᮠ˄  ˅˗ԕ䶎  ˄ 䘋ࡦᮠޛᔰ࿻Ⲵ  ˅˗ԕ  ᔰ࿻ⲴҼ䘋ࡦᮠ˄ % ᡆ E  ᮤᮠᮠᆇᑨᮠᴹ  ⿽㺘⽪ᯩ⌅ˈণ֯⭘ \" 㺘⽪ᆇㅖѢѝⲴањৼᕅਧ'"' \\ 㺘⽪ањ৽ᯌᶐᆇㅖ \xNN... 16 䘋ࡦᮠ㺘⽪Ⲵᆇㅖԓ⸱ 䘋ࡦᮠ㺘⽪Ⲵᆇㅖԓ⸱ޛ\NNN 3 њ ٬Ѫ 0x0Dˈ˅\r എ䖖ㅖ˄Carriage-Return ٬Ѫ 0x0Aˈ˅\n ᦒ㹼ㅖ˄Newline ٬Ѫ 0x0Cˈ˅\f ᦒ亥ㅖ˄FormFeed ٬Ѫ 0x08ˈ˅\b 䘰Ṭㅖ˄Backspace 䖜ѹ⸱ 䈤᰾ 㺞 DV ≽㕌ಞ᭥ᤷⲺ䖢ѿᆍㅜᓅࡍ  ??ā㺘⽪ᱟањᲞ䙊৽ᯌᶐᆇㅖᑨᮠDŽ DŽ㺘 3-1 ѝⲴ䖜ѹ⸱ҏ਼ṧਟԕ⭘ҾঅњᆇㅖᑨᮠDŽֻྲĀ ٬⽪ &ā㺘 ǃĀ ٬⽪$ā㺘 ≷㕆〻ᒿѝ֯⭘অњᆇㅖᑨᮠᰦਟԕ߉ᡀ൘䈕ᆇㅖࡽ࣐ањঅᕅਧˈֻྲĀ ᒿࡇ㿱㺘 3-1 ᡰ⽪DŽ৽ᯌᶐਾ㤕ᱟަԆᆇㅖˈ䛓Ѹ䈕৽ᯌᶐሶн䎧֌⭘ᒦф DV ≷㕆ಘሶՊਁࠪ䆖੺ؑ᚟DŽ ᯌᶐᆇㅖDŽަѝㅜ  њ৽ᯌᶐᱟ䖜ѹᤷ⽪ᆇㅖˈ䈤᰾ᢺㅜ  њᆇㅖⴻ֌ањᲞ䙊৽ᯌᶐᆇㅖDŽᑨ⭘䖜ѹㅖ 㺘⽪ањ৽ ?? ᶕ䖜ѹवਜ਼⢩↺ᆇㅖDŽֻྲ ?  ᆇㅖѢᗵ享⭘ৼᕅਧᤜտˈᒦфަѝਟԕ֯⭘৽ᯌᶐ ᮠਟ࠶Ѫᮤᮠǃབྷᮠ઼⎞⛩ᮠDŽ  ᑨᮠᱟањᮠᆇˈਟ࠶Ѫᆇㅖᑨᮠ઼ᮠᆇᑨᮠє㊫DŽᆇㅖᑨᮠ䘈ਟ࠶ѪᆇㅖѢ઼অњᆇㅖ˗㘼ᮠᆇᑨ  ᤷԔࣙ䇠ㅖ᫽֌ᮠ ᫽֌ᮠ ⌘䟺䜘࠶˄ਟ䘹˅ḷਧ ᡆ ≷㕆ભԔ⌘䟺䜘࠶˄ਟ䘹˅ḷਧ  ቡᱟаᶑ≷㕆䈝䀰ᤷԔ䈝ਕDŽഐ↔аᶑ䈝ਕⲴ䙊⭘ṬᔿѪ˖ 䭞ㅖਧԕањᆇ⇽ᔰ࿻ˈ䛓Ѹᖃࡽ䈝ਕޣѸᖃࡽ䈝ਕቡᱟањ≷㕆ભԔ˄ᡆ〠Ѫ՚ᤷԔǃᤷ⽪ㅖ˅DŽྲ᷌ ᔰ࿻ˈ䛓  䭞ㅖਧԕањޣ䭞ㅖਧ⺞ᇊҶ䈝ਕ։л䜘࠶Ⲵ䈝ѹDŽྲ᷌䈕ޣ˅ᶴᡀDŽ  䶒䐏䲿ањ߂ਧ˄ 䭞ㅖਧDŽḷਧ⭡ㅖਧਾޣ 䈝ਕ⭡䴦њᡆཊњḷਧ˄/DEHO˅ᔰ࿻ˈਾ䶒ਟԕ䐏䲿ањ⺞ᇊ䈝ਕ㊫රⲴ ᶐ࣐ᦒ㹼ㅖᰦˈቡՊᘭ⮕ᦹ䘉єњᆇㅖDŽ ˄൘ᦒ㹼ㅖࡽ˅ˈ䛓Ѹቡਟԕ䇙аᶑ䈝ਕ֯⭘ཊ㹼DŽᖃ DV 䈫ਆࡠ৽ᯌ ? 㤕൘а㹼Ⲵᴰਾ֯⭘৽ᯌᶐᆇㅖ ˅֌Ѫ㔃ᶏDŽ᮷Ԧᴰਾ䈝ਕᗵ享ԕᦒ㹼ㅖ֌Ѫ㔃ᶏDŽ   䈝ਕ˄6WDWHPHQW˅ԕᦒ㹼ㅖᡆ㘵㹼࠶ࢢᆇㅖ˄ ਧѝᡰᴹᆇㅖ䜭ᱟᴹ᭸ⲴDŽㅖਧ֯⭘ަԆᆇㅖ˄ֻྲオṬǃᦒ㹼ㅖ˅ᡆ㘵᮷ԦⲴᔰ࿻ᶕ⭼ᇊᔰ࿻઼㔃ᶏ༴DŽ DŽㅖਧнݱ䇨⭘ᮠᆇᆇㅖᔰ࿻ˈᒦфབྷሿ߉ਜ਼ѹн਼DŽ൘ DV ≷㕆〻ᒿѝㅖਧ䮯ᓖ⋑ᴹ䲀ࡦˈᒦфㅖ B  ㅖਧ˄6\PERO˅ᱟ⭡ᆇㅖ㓴ᡀⲴḷ䇶ㅖˈ㓴ᡀㅖਧⲴᴹ᭸ᆇㅖਆ㠚Ҿབྷሿ߉ᆇㅖ䳶ǃᮠᆇ઼йњᆇㅖ 3.2.2.2 ㅜਭȽ䈣ਛૂᑮᮦ Ԕ൷Պ㻛ᖃ֌⌘䟺䜘࠶DŽ ᔰ࿻Ⲵᤷ⽪ㅖᡆભ  ᔰ࿻ᆇㅖˈഐ↔㤕൘≷㕆ѻࡽнሩ〻ᒿᢗ㹼亴༴⨶ˈ䛓Ѹ〻ᒿѝवਜ਼ⲴᡰᴹԕӅਧ ֌Ѫঅ㹼⌘䟺  ˅ԕཆˈ䘈֯⭘Ӆਧ  ઼  ⭡Ҿ as ≷㕆䈝䀰〻ᒿ䲔Ҷ֯⭘ C 䈝䀰⌘䟺䈝ਕ˄ণ   18DV ≷㕆*  HGL DO UHSQHVFDVHV  ֯⭘ࡽ㔰ᢗ㹼䟽༽᫽֌˖ VFDV ᤷԔѻࡽˈնᱟᴰྭоᆳ؞侠ⲴᤷԔ᭮൘਼а㹼кDŽֻྲˈѢᢛ᧿ᤷԔ ᤷᇊ᫽֌ᮠ઼ൠ൰ᇭᓖDŽ䙊ᑨ᫽֌⸱ࡽ㔰ਟ֌Ѫаᶑ⋑ᴹ᫽֌ᮠⲴᤷԔ⤜ঐа㹼ᒦфᗵ享ⴤ᧕սҾᡰᖡ૽  ᫽֌⸱ࡽ㔰⭘Ҿ؞侠䲿ਾⲴ᫽֌⸱DŽᆳԜ⭘Ҿ䟽༽ᆇㅖѢᤷԔǃᨀ׋४㾶ⴆǃᢗ㹼ᙫ㓯䬱ᇊ᫽֌ǃᡆ 3.2.3.2 ᤽Ԛᬃ֒⸷ࢃ㔶  cltd cdq ᢺ%eax ㅖਧᢙኅࡠ%edx:%eax ѝ cwtd cwd ᢺ%ax ㅖਧᢙኅࡠ%dx:%ax ѝ cwtl cwde ᢺ%ax ㅖਧᢙኅࡠ%eax ѝ cbtw cbw ᢺ%al ѝⲴᆇ㢲٬ㅖਧᢙኅࡠ%ax ѝ AT&T Intel 䈤᰾ 7 䈣⌋ф ,QWHO 䈣⌋ѣ䖢ᦘ᤽ԚⲺሯᓊީ㌱ 㺞 $7  ㌫㿱㺘 3-2 ᡰ⽪DŽޣ䈝⌅ѝ䖜ᦒᤷԔⲴሩᓄ 7 䈝⌅о ,QWHO ˈণӾ E\WH ࡠ ORQJ ᱟ EOǃӾ E\WH ࡠ ZRUG ᱟ EZǃӾ ZRUG ࡠ ORQJ ᱟ ZODŽ$7 DOHG[ PRYVEO 7 䈝ਕᱟ DŽєњਾ㔰ቡ䱴൘᫽֌⸱สᵜ਽кDŽֻྲĀ֯⭘ㅖਧᢙኅӾDO 〫ࣘࡠHG[āⲴ $7 PRY][ ઼ PRYV[ ˈ,QWHO ѝ࠶࡛ᱟ PRY] ઼ PRYV 7 䈝⌅ѝㅖਧᢙኅ઼䴦ᢙኅⲴสᵜ᫽֌⸱਽〠࠶࡛ᱟ $7 ࡠDŽڊ7 䈝⌅ѝᱟ䙊䗷֯⭘єњ᫽֌⸱ਾ㔰ᶕ 䴰㾱  њᇭᓖᶕᤷ᰾ˈণ䴰㾱ѪⓀ઼ⴞⲴ᫽֌ᮠᤷ᰾ᇭᓖDŽ$7 7 о ,QWHO 䈝⌅ѝࠐѾᡰᴹᤷԔ᫽֌⸱Ⲵ਽〠䜭⴨਼ˈնӽᴹࠐњֻཆDŽㅖਧᢙኅ઼䴦ᢙኅᤷԔ䜭  $7 DŽ PRYZE[ ㅹ਼Ҿ PRYE[ DŽ਼ṧˈ䈝ਕ PRYZD[E[ ㅹ਼Ҿ E[ PRYD[ ѝнਜ਼޵ᆈ᫽֌ᮠˈ䛓Ѹ DV ቡՊṩᦞⴞⲴᇴᆈಘ᫽֌ᮠᶕቍ䈅⺞ᇊ᫽֌ᮠᇭᓖDŽֻྲᤷԔ䈝ਕ ࠶࡛ᤷᇊ E\WHǃZRUG ઼ ORQJ ㊫රⲴ᫽֌ᮠDŽྲ᷌ᤷԔ਽〠⋑ᴹᑖ䘉ṧⲴᆇㅖਾ㔰ˈᒦфᤷԔ䈝ਕ O ઼ Z ǃ E AT&T 䈝⌅ѝᤷԔ᫽֌⸱਽〠˄ণᤷԔࣙ䇠ㅖ˅ᴰਾањᆇㅖ⭘ᶕᤷ᰾᫽֌ᮠⲴᇭᓖDŽᆇㅖ 3.2.3.1 ᤽Ԛᬃ֒⸷Ⲻળ੃ ⽪ &38 ᕅ⭘䈕ൠ൰༴޵ᆈⲴ޵ᇩDŽ „ ޵ᆈ᫽֌ᮠ⭡ਈ䟿਽ᡆ㘵ਜ਼ᴹਈ䟿ൠ൰ⲴањᇴᆈಘᤷᇊDŽਈ䟿਽䳀ਜ਼ᤷࠪҶਈ䟿Ⲵൠ൰ˈᒦᤷ ᆇㅖࡽ㔰˗  „ ᇴᆈಘ਽ࡽ䴰㾱࣐ањ ᆇㅖࡽ㔰˗  „ ・ণ᫽֌ᮠࡽ䴰㾱࣐ањ ᆇㅖᶕᤷᇊањ䰤᧕᫽֌ᮠDŽਚᴹ䈳䖜䈳⭘ᤷԔ᡽㜭֯⭘䰤᧕᫽֌ᮠDŽ㿱л䶒ሩ䐣䖜ᤷԔⲴ䈤᰾DŽ њ 7 䈝⌅䙊䗷൘᫽֌ᮠࡽ࣐а ѝ˅DŽањ䰤᧕᫽֌ᮠ˄,QGLUHFWRSHUDQG˅ਜ਼ᴹᇎ䱵᫽֌ᮠ٬Ⲵൠ൰٬DŽ$7 ٬൘޵ᆈ˄٬൘ &38 Ⲵᇴᆈಘѝ˅ᡆ޵ᆈ˄ ᫽֌ᮠਟԕᱟ・ণᮠ˄ণ٬ᱟᑨᮠ٬Ⲵ㺘䗮ᔿ˅ǃᇴᆈಘ ᆈ൘ㅜ  њ᫽֌ᮠѝDŽ؍њᱟⓀ᫽֌ᮠˈㅜ  њᱟⴞⲴ᫽֌ᮠˈণᤷԔ᫽֌㔃᷌   аᶑᤷԔ䈝ਕਟԕਜ਼ᴹ  њᡆᴰཊ  њ⭘䙇ਧ࠶ᔰⲴ᫽֌ᮠDŽሩҾާᴹєњ᫽֌ᮠⲴᤷԔ䈝ਕˈㅜ „ ⌘䟺 „ ᫽֌ᮠ˄⭡ާփᤷԔᤷᇊ˅˗ „ ᫽֌⸱˄ᤷԔࣙ䇠ㅖ˅˗ „ ḷਧ˄ਟ䘹˅˗ 䈝ਕˈᆳ䙊ᑨਟवਜ਼  њ㓴ᡀ䜘࠶˖ ᤷԔ᫽֌Ⲵሩ䊑˗㘼ൠ൰˄$GGUHVV˅ᱟᤷᇊᮠᦞ൘޵ᆈѝⲴս㖞DŽᤷԔ䈝ਕᱟ〻ᒿ䘀㹼ᰦ࡫ᢗ㹼Ⲵаᶑ  ᤷԔ˄,QVWUXFWLRQV˅ᱟ &38 ᢗ㹼Ⲵ᫽֌ˈ䙊ᑨᤷԔҏ〠֌᫽֌⸱˄2SFRGH˅˗᫽֌ᮠ˄2SHUDQG˅ᱟ 3.2.3 ᤽Ԛ䈣ਛȽᬃ֒ᮦૂሱ൶   18DV ≷㕆* MPS1HZ/RFⴤ᧕䐣䖜DŽᰐᶑԦⴤ᧕䐣䖜ࡠḷਧ 1HZ/RF ༴㔗㔝ᢗ㹼DŽ  ᆇㅖˈᒦф䈕᫽֌ᤷ⽪ㅖ֯⭘ PRYO ᤷԔ⴨਼Ⲵ䈝⌅DŽл䶒ᱟⴤ᧕઼䰤᧕䐣䖜ⲴࠐњֻᆀDŽ ֌Ѫ᫽֌ᤷ⽪ㅖⲴࡽ㔰 Ⲵ߉⌅ᱟ㔉ࠪ䐣䖜ⴞḷ༴Ⲵḷਧ˗䰤᧕䐣䖜䈝ਕⲴ߉⌅ᱟᗵ享֯⭘ањᱏᆇㅖ 䘋䐣䖜ᤷԔѝ˗ሩҾ䰤᧕䐣䖜ᤷԔˈ䐣䖜ⲴⴞⲴս㖞ਆ㠚ҾḀњᇴᆈಘᡆḀњ޵ᆈս㖞ѝDŽⴤ᧕䐣䖜䈝ਕ Ԕਚᴹⴤ᧕䐣䖜ⲴᖒᔿDŽሩҾⴤ᧕䐣䖜ᤷԔˈ䐣䖜ࡠⲴⴞḷᤷԔⲴൠ൰ᱟ֌Ѫ䐣䖜ᤷԔⲴа䜘ԭⴤ᧕㕆⸱  -03 ᱟᰐᶑԦ䐣䖜ᤷԔˈᒦਟ࠶Ѫⴤ᧕˄GLUHFW˅䐣䖜઼䰤᧕˄LQGLUHFW˅䐣䖜є㊫ˈ㘼ᶑԦ䐣䖜ᤷ ḷᘇⲴ⣦ᘱᶕ⺞ᇊᱟ੖䘋㹼䐣䖜ˈ㘼ᰐᶑԦ䐣䖜ࡉн׍䎆Ҿ䘉ӋḷᘇDŽޣḷᘇᇴᆈಘѝḀњ⴨ ൰㕆⸱ࡠ䐣䖜ᤷԔѝDŽ䐣䖜ᤷԔਟ࠶ѪᰐᶑԦ䐣䖜઼ᶑԦ䐣䖜єབྷ㊫DŽᶑԦ䐣䖜ᤷԔሶ׍䎆Ҿᢗ㹼ᤷԔᰦ ਧᶕ㺘⽪DŽ൘⭏ᡀⴞḷԓ⸱᮷Ԧᰦˈ≷㕆ಘՊ⺞ᇊᡰᴹᑖᴹḷਧⲴᤷԔⲴൠ൰ˈᒦфᢺ䐣䖜ࡠⲴᤷԔⲴൠ  䐣䖜ᤷԔ⭘Ҿᢺᢗ㹼⛩䖜〫ࡠ〻ᒿਖањս㖞༴㔗㔝ᢗ㹼л৫DŽ䘉Ӌ䐣䖜ⲴⴞⲴս㖞䙊ᑨ֯⭘ањḷ 3.2.3.4 䐩䖢᤽Ԛ  HD[ ѝˈ֯⭘唈䇔⇥GVDŽޕ༴޵ᇩ᭮ HD[ HD[ᢺ޵ᆈൠ൰IRRHD[ PRYOIRR HD[ ѝˈ֯⭘唈䇔⇥VVDŽޕHES HD[ᢺHES޵ᆈൠ൰༴Ⲵ޵ᇩ᭮ PRYO HD[ ѝDŽޕ⺞ᇊⲴ޵ᆈൠ൰༴Ⲵ޵ᇩ᭮ HE[HVL HD[ᢺ DUUD\HE[HVL PRYODUUD\ HD[ ѝDŽޕ⺞ᇊⲴ޵ᆈൠ൰༴Ⲵ޵ᇩ᭮ HE[HVL HD[ᢺHE[HVL PRYO HD[ ѝDŽޕHVL HD[ᢺ DUUD\HVL ⺞ᇊⲴ޵ᆈൠ൰༴Ⲵ޵ᇩ᭮ PRYODUUD\ HD[ ѝDŽޕPRYOYDUHD[ᢺ YDU Ⲵൠ൰᭮ ༴DŽ〫ٿᆈࡠ HV ⇥ⲴHE[ ᤷᇊⲴ؍ D] HE[ ᢺᆇ㢲٬ PRYE[DHV HD[ ѝDŽޕYDUHD[ᢺԓ⸱⇥ѝ޵ᆈൠ൰ YDU ༴Ⲵ޵ᇩ᭮PRYOFV ᇴᆈಘHD[ ѝDŽޕPRYOYDUHD[ᢺ޵ᆈൠ൰ YDU ༴Ⲵ޵ᇩ᭮  7 ઼ ,QWHO 䈝⌅ᖒᔿⲴ޵ᆈᕅ⭘ֻᆀ˖ ࡽ㔰DŽԕлᱟࠐњ $7 ⌘᜿ˈྲ᷌ᤷᇊⲴ⇥㾶ⴆᇴᆈಘо唈䇔᫽֌Ⲵ⇥ᇴᆈಘ⴨਼ˈࡉ DV ቡнՊѪ≷㕆ⲴᤷԔ޽䗃ࠪ⴨਼Ⲵ⇥ DŽVHFWLRQ Ѫ޵ᆈ᫽֌ᮠᤷᇊਟ䘹Ⲵ⇥ᇴᆈಘˈᒦфՊ㾶ⴆ᫽֌ᮠ֯⭘Ⲵᖃࡽ唈䇔⇥ᇴᆈಘDŽ䈧 唈䇔٬ ٬㤳തᱟ ǃǃ ઼ DŽVFDOH ަ҈к㍒ᕅ LQGH[ ⭘ᶕ䇑㇇᫽֌ᮠൠ൰DŽྲ᷌⋑ᴹᤷᇊ VFDOHˈࡉ VFDOH ਆ ٬DŽVFDOH ᱟ∄ֻഐᆀˈਆ〫ٿަѝ EDVH ઼ LQGH[ ᱟਟ䘹Ⲵ  սสᇴᆈಘ઼㍒ᕅᇴᆈಘˈGLVS ᱟਟ䘹Ⲵ  EDVHLQGH[VFDOH GLVS7 䈝⌅ᖒᔿ˖VHFWLRQ  ሩᓄҾྲл $7 VFDOHGLVS@ >EDVHLQGH[ ,QWHO 䈝⌅Ⲵ䰤᧕޵ᆈᕅ⭘ᖒᔿ˖VHFWLRQ 3.2.3.3 ޻ᆎᕋ⭞  rep, repe, repne ѢᤷԔ᫽֌ࡽ㔰ˈ֯ѢᤷԔ䟽༽ᢗ㹼%ecx ѝᤷᇊⲴ⅑ᮠDŽ 80386/80387 㓴ਸ⭘н⵰䘉њࡽ㔰DŽ wait ॿ༴⨶ಘᤷԔࡽ㔰DŽㅹᖵॿ༴⨶ಘᆼᡀᖃࡽᤷԔⲴᢗ㹼DŽሩҾ 䈧৲㿱 80X86 ᡻޼˅DŽ lock ᙫ㓯䬱ᆈࡽ㔰DŽ⭘Ҿ൘ᤷԔᢗ㹼ᵏ䰤⾱→ѝᯝ˄ӵሩḀӋᤷԔᴹ᭸ˈ 16 սⲴ᫽֌ᮠ/ൠ൰DŽն䈧⌘᜿ˈas ᒦн᭟ᤱ 16 սራ൰ᯩᔿDŽ data16, addr16 ᫽֌ᮠ/ൠ൰ᇭᓖࡽ㔰DŽ䘉єњࡽ㔰Պᢺ 32 ս᫽֌ᮠ/ൠ൰᭩ਈᡀ 㠚ࣘ␫࣐䘉⿽ࡽ㔰DŽ cs, ds, ss, es, fs, gs ४㾶ⴆ᫽֌⸱ࡽ㔰DŽ䙊䗷ᤷᇊ֯⭘ ४:޵ᆈ᫽֌ᮠ ޵ᆈᕅ⭘ᖒᔿՊ ᫽֌⸱ࡽ㔰 䈤᰾ 㺞 ᬃ֒⸷ࢃ㔶ࡍ㺞   ᫽֌⸱ࡽ㔰ᴹ㺘 3-3 ѝࡇࠪⲴаӋDŽ   18DV ≷㕆* 䘉䟼ㅖਧ 3& ᱟᤷ &38 Ⲵ〻ᒿᤷԔᤷ䪸䇑ᮠಘ˄3URJUDP&RXQWHU˅DŽ ฏDŽሩ〻ᒿѝ GDWD ઼ EVV ४Ⲵ⨶䀓ҏ਼ṧྲ↔DŽ 䛫Ⲵൠ൰༴DŽᡁԜҐᜟкᡰ䈤Ⲵ〻ᒿⲴ WH[W ४ᇎ䱵кᱟᤷަᡰᴹⴞḷ᮷Ԧ WH[W ४㓴ਸᶴᡀⲴᮤњൠ൰४  ㊫լൠˈ४਽ҏ⭘Ҿ᧿䘠ᐢ䬮᧕〻ᒿѝ४Ⲵ㓴DŽ䬮᧕ಘ OG Պᢺ〻ᒿᡰᴹⴞḷ᮷ԦѝⲴ WH[W ४᭮൘⴨ ᵚ⸕ˈഐ↔ᆳ൘ XQGHILQHG ४ѝDŽ ඇ˄FRPPRQEORFN˅Ⲵᕅ⭘ቡᱟ䘉ṧа⿽ㅖਧ˖൘≷㕆ᰦᆳⲴ٬ޡޜᖴӵ⎹৺ᵚᇊѹⲴㅖਧDŽሩањ〠Ѫ 䇮㖞ᡀ^XQGHILQHG8`ˈަѝ 8 ሶՊ൘ԕਾປкDŽഐѪᮠ٬ᙫᱟᴹᇊѹⲴˈᡰԕࠪ⧠ᵚᇊѹൠ൰Ⲵୟа䙄  ਖཆ䘈ᴹа⿽਽ѪĀᵚᇊѹⲴā४˄8QGHILQHGVHFWLRQ˅DŽ൘≷㕆ᰦн㜭⺞ᇊᡰ൘४Ⲵԫօൠ൰䜭㻛 DEVROXWH ४ᗵՊ䟽ਐ㘼㾶ⴆDŽ ൰  ༴DŽቭ㇑䬮᧕ಘ൘䬮᧕ਾߣнՊᢺєњⴞḷ᮷ԦѝⲴ GDWD ४ᆹᧂᡀ䟽ਐൠ൰༴ˈնᱟⴞḷ᮷ԦѝⲴ ਸ൘а䎧ᰦˈDEVROXWH ४ѝⲴൠ൰ሶ࿻㓸нਈDŽֻྲˈld Պᢺൠ൰^DEVROXWH`Ā䟽ᇊսāࡠ䘀㹼ᰦ࡫ൠ  䲔Ҷ WH[WǃGDWD ઼ EVV ४ˈᡁԜ䘈䴰㾱Ҷ䀓㔍ሩൠ൰४˄DEVROXWH ४˅DŽᖃ䬮᧕ಘᢺ਴њⴞḷ᮷Ԧ㓴 1DŽ 〫ٿⲴ⢩ᙗDŽ൘л䶒䈤᰾ѝˈᡁԜ֯⭘䇠ਧĀ^VHFQDPH1`āᶕ㺘⽪४ VHFQDPH ѝޣо४⴨ DŽਖཆˈDV 䇑㇇Ⲵབྷཊᮠ㺘䗮ᔿ䜭ᴹ䘉⿽ 〫ٿ४ѝ  ४ ᇎ䱵кˈDV ֯⭘Ⲵᡰᴹൠ൰䜭ਟ㺘⽪Ѫ˖  ˛ੇޣ„ ሩൠ൰Ⲵᕅ⭘о〻ᒿ䇑ᮠಘ 3&˄3URJUDP&RXQWHU˅⴨ ४Ⲵᔰ࿻ൠ൰ Ⲵ٬ㅹҾཊቁ˛  ൠ൰ „ 䈕ൠ൰ᕅ⭘Ⲵᱟଚњ४˛ „ 䈕ᕅ⭘Ⲵᆇ㢲䮯ᓖᱟཊቁ˛ „ ⴞḷ᮷Ԧѝሩањൠ൰Ⲵᕅ⭘ᱟӾӰѸൠᯩ㇇䎧Ⲵ˛ OG ᗵ享⸕䚃˖ ᡰ䴰㾱Ⲵ䟽ᇊսؑ᚟DŽѪҶᢗ㹼䟽ᇊս᫽֌ˈ൘⇿⅑⎹৺ⴞḷ᮷ԦѝⲴањൠ൰ᰦˈޕҏՊᖰⴞḷ᮷Ԧѝ߉  ᖃањ४㻛䟽ᇊսᰦˈѪҶ䇙䬮᧕ಘ OG ⸕䚃ଚӋᮠᦞՊਁ⭏ਈॆԕ৺ྲօ؞᭩䘉ӋᮠᦞˈDV ≷㕆ಘ ն޵ᇩᱟオⲴDŽ൘ањⴞḷ᮷Ԧѝˈަ WH[W ४Ӿൠ൰ˌᔰ࿻ˈ䲿ਾᱟ GDWD ४ˈ޽ਾ䶒ᱟ EVV ४DŽ ४ѝˈ䘉Ӌ४Պӽ❦ᆈ൘ˈ GDWD ᡆ WH[W ⇿њ४䜭ਟ㜭ᱟオⲴDŽྲ᷌⋑ᴹ֯⭘≷㕆ભԔᢺ䗃ࠪ᭮㖞൘  DV ≷㕆ಘ䗃ࠪӗ⭏Ⲵⴞḷ᮷Ԧѝ㠣ቁާᴹˏњ४ˈ࠶࡛㻛〠Ѫ↓᮷˄WH[W˅ǃᮠᦞ˄GDWD˅઼ EVV ४DŽ ᮷Ԧѝ䇠ᖅⲴൠ൰ˈӾ㘼䇙ᆳԜሩᓄࡠᚠᖃⲴ䘀㹼ᰦ࡫ൠ൰кDŽ ⇥ǃ䜘࠶˅DŽ㘼Ѫ४࠶䝽䘀㹼ᰦ࡫Ⲵൠ൰Ⲵ᫽֌ቡ㻛〠Ѫ䟽ᇊս˄5HORFDWLRQ˅᫽֌ˈަѝवᤜ䈳ᮤⴞḷ ᱟ֌Ѫപᇊঅݳ䘋㹼〫ࣘⲴDŽᆳԜⲴ䮯ᓖԕ৺ᆇ㢲⅑ᒿ䜭нՊ㻛᭩ਈDŽ䘉ṧⲴപᇊঅݳቡ㻛〠֌ᱟ४˄ᡆ ᮷ԦѝⲴ਴њ䜘࠶࠶䝽н਼Ⲵᴰ㓸ൠ൰ս㖞DŽOG Պᢺ〻ᒿѝⲴᆇ㢲ඇ〫ࣘࡠ〻ᒿ䘀㹼ᰦⲴൠ൰༴DŽ䘉Ӌඇ њⴞḷ᮷Ԧᰦˈ䈕ⴞḷ᮷ԦѝⲴԓ⸱㻛唈䇔䇮㖞ᡀӾൠ൰  ᔰ࿻DŽ↔ਾ OG ሶՊ൘䬮᧕䗷〻ѝѪн਼ⴞḷ Ⲵⴞḷ᮷ԦѝⲴ޵ᇩ᤹➗аᇊ㿴ᖻ㓴ਸ⭏ᡀањਟᢗ㹼〻ᒿDŽᖃ DV ≷㕆ಘ䗃ࠪаޕ 䬮᧕ಘ OG Պᢺ䗃 ሩ४Ⲵสᵜᾲᘥ֌аㆰঅӻ㓽ˈԕ⨶䀓 DV ≷㕆ಘӗ⭏Ⲵⴞḷ᮷Ԧสᵜ㔃ᶴDŽ LQX[ ޵Ṩ֯⭘Ⲵ DRXW Ṭᔿⴞḷ᮷ԦṬᔿⲴ䈖㓶䈤᰾ሶ൘ᵜㄐਾ䶒㔉ࠪˈ䘉䟼俆ݸ/ ޣᔿᆹᧂDŽᴹ ᮷४ᡆᮠᦞ४DŽ㤕㾱↓⺞⨶䀓઼㕆ࡦањ DV ≷㕆䈝䀰〻ᒿˈᡁԜቡ䴰㾱Ҷ䀓 DV ӗ⭏Ⲵ䗃ࠪⴞḷ᮷ԦⲴṬ ४Ⲵᾲᘥѫ㾱⭘ᶕ㺘⽪㕆䈁ಘ⭏ᡀⲴⴞḷ᮷Ԧ˄ᡆਟᢗ㹼〻ᒿ˅ѝн਼Ⲵؑ᚟४ฏˈֻྲⴞḷ᮷ԦѝⲴ↓ DŽޕ⨶൘䈕ൠ൰㤳തѝⲴᮠᦞؑ᚟DŽֻྲˈਟԕᴹањĀਚ䈫āⲴ४ˈᡁԜਚ㜭Ӿ䈕४ѝ䈫ਆᮠᦞ㘼н㜭߉  ४˄6HFWLRQ˅˄ҏ〠Ѫ⇥ǃ㢲ᡆ䜘࠶˅⭘Ҿ㺘⽪ањൠ൰㤳തˈ᫽֌㌫㔏ሶՊԕ⴨਼Ⲵᯩᔿሩᖵ઼༴ 3.2.4 ॰ф䠃ᇐփ ˅ᤷ᰾᫽֌ᮠⲴབྷሿ˄E\WHǃZRUG ᡆ ORQJ˅DŽ O ᡆ Z ǃ E 享֯⭘᫽֌⸱ਾ㔰˄ Ⲵ䐣䖜ḷਧDŽ䘈ᴹˈަԆԫօާᴹ޵ᆈ᫽֌ᮠⲴᤷԔ䜭ᗵޣㅖˈ䛓Ѹ DV ≷㕆ಘቡՊ䘹ᤙоᤷԔ䇑ᮠ 3& ⴨ ᆇ ֌Ѫࡽ㔰ᆇㅖDŽ㤕⋑ᴹ֯⭘ Ⲵ䰤᧕䈳⭘Ⲵ᫽֌ᮠҏᗵ享ᴹањޣ ਼ṧˈоᤷԔ䇑ᮠಘ 3&ᰐ  HD[ 䰤᧕䐣䖜DŽӾHD[ ᤷ᰾Ⲵൠ൰༴䈫ਆ䐣䖜Ⲵⴞḷս㖞DŽ MPS HD[䰤᧕䐣䖜DŽᇴᆈಘHD[ Ⲵ٬ᱟ䐣䖜Ⲵⴞḷս㖞DŽ MPS   18DV ≷㕆* ४ሩ喀ӗ⭏Ⲵ䰤䳉 WH[W EVVGDWD 䬮᧕㔃᷌  ⴞḷ᮷Ԧ  ⴞḷ᮷Ԧ WWWWW GGGG777 '''' ཤ  777 ''''  WWWWW GGGG WH[WGDWDEVV WH[WGDWDEVV ४ӵ׋ DV ≷㕆ಘ֯⭘ᯩׯ㘼䇮㖞Ⲵˈഐ↔ᒦнᆈ൘ᆀ४䇑ᮠಘDŽ㲭❦⋑ᴹӰѸⴤ᧕᫽֌ањս㖞䇑ᮠಘ  ⇿њ४䜭ᴹањս㖞䇑ᮠಘ˄/RFDWLRQ&RXQWHU˅ˈᆳՊሩ⇿њ≷㕆䘋䈕४Ⲵᆇ㢲䘋㹼䇑ᮠDŽ⭡Ҿᆀ DŽ GDWD 㺘⽪֯⭘ GDWD DŽ਼ṧൠˈ WH[W ˈ䛓ѸቡՊ唈䇔֯⭘ WH[W ᮠDŽ㺘䗮ᔿ㔃᷌ᓄ䈕ᱟ㔍ሩ٬DŽྲ᷌ਚᤷᇊҶ ৲ѝ֯⭘ᮠ٬ GDWD㺘䗮ᔿ ᡆ WH[W㺘䗮ᔿ GDWD ४DŽѪҶᤷᇊ䲿ਾⲴ䈝ਕ㻛≷㕆ࡠଚњᆀ४ѝˈਟ൘ Ԇ〻ᒿᒦнՊⴻࡠᆀ४Ⲵ䑚䘩ˈᆳԜਚՊⴻࡠ⭡ᡰᴹ WH[W ᆀ४㓴ᡀⲴ WH[W ४˗⭡ᡰᴹ GDWD ᆀ४㓴ᡀⲴ 㕆ਧ亪ᒿࠪ⧠൘ⴞḷ᮷Ԧѝˈնᱟⴞḷ᮷Ԧѝᒦнवਜ਼㺘⽪ᆀ४Ⲵԫօؑ᚟DŽ༴⨶ⴞḷ᮷ԦⲴ OG ԕ৺ަ  ֯⭘ᆀ४ᱟਟ䘹ⲴDŽྲ᷌⋑ᴹ֯⭘ᆀ४ˈ䛓Ѹᡰᴹሩ䊑䜭Պ㻛᭮൘ᆀ४  ѝDŽᆀ४ՊԕަӾሿࡠབྷⲴ ᆀ४DŽ WH[W ᒦф൘⇿㓴Պ䗃ࠪⲴᑨᮠѻࡽ֯⭘ ᆀ४ˈ WH[W ൘㻛≷㕆Ⲵᮤњ〻ᒿѝDŽ൘䘉⿽ᛵߥлˈ㕆䈁ಘቡਟԕ൘⇿њՊ䗃ࠪⲴԓ⸱४ѻࡽ֯⭘ ѝо䈕ᆀ४ѝަԆሩ䊑᭮൘а䎧DŽֻྲˈ㕆䈁ಘਟ㜭ᜣᢺᑨᮠᆈ᭮൘ text ४ѝˈնᱟнᜣ䇙䘉Ӌᑨᮠᮓᐳ ࡠ䘉њⴞⲴDŽ൘⇿њ४ѝˈਟԕᴹ㕆ਧѪ 0--8192 Ⲵᆀ४ᆈ൘DŽ㕆ࡦ൘਼ањᆀ४ѝⲴሩ䊑Պ൘ⴞḷ᮷Ԧ Ⲵᮠᦞ㓴ˈնᱟ֐ਟԕՊᜣ䇙ᆳԜ൘≷㕆ਾ㚊䳶൘а䎧ᆈ᭮DŽas ≷㕆ಘݱ䇨֐࡙⭘ᆀ४˄subsection˅ᶕ䗮 ൘≷㕆Ⓚ〻ᒿḀњ४ѝਟ㜭࠶ᐳ⵰аӋн⴨䛫ى≷㕆ਆᗇⲴᆇ㢲ᮠᦞ䙊ᑨսҾ text ᡆ data ४ѝDŽᴹᰦ 3.2.4.2 ᆆ॰ ഴ 䬴᧛њѠⴤḽᮽԬӝ⭕ᐨ䬴᧛ぁᓅⲺׁᆆ   ≤ᒣ䖤㺘⽪޵ᆈൠ൰DŽਾ䶒ሿ㢲ѝሶՊ䈖㓶䈤᰾ OG 䬮᧕ಘⲴާփ᫽֌䗷〻DŽ DŽަѝ GDWD ઼ WH[W മ3-2 ѝᱟ  њ⨶ᜣॆⲴਟ䟽ᇊս४ⲴֻᆀDŽ䘉њֻᆀ֯⭘Ր㔏Ⲵ४਽〠˖ „ XQGHILQHG ४ሩн൘ݸࡽᡰ䘠਴њ४ѝሩ䊑Ⲵൠ൰ᕅ⭘䜭኎Ҿᵜ४DŽ Āнਟ䟽ᇊսⲴā˖൘䟽ᇊս᫽֌ᵏ䰤ᆳԜнՊ᭩ਈDŽ ᫽֌ᰦ᭩ਈ֐ᡰᕅ⭘Ⲵൠ൰ˈ䛓Ѹቡ֯⭘䘉њ४DŽӾ䘉⿽㿲⛩ᶕⴻˈᡁԜਟԕᢺ㔍ሩൠ൰〠֌ᱟ „ DEVROXWH ४䈕४Ⲵൠ൰  ᙫᱟĀ䟽ᇊսāࡠ䘀㹼ᰦ࡫ൠ൰  ༴DŽྲ᷌֐нᜣ䇙 OG ൘䟽ᇊս ٬ᆇ㢲DŽ  ᆈ EVV ४DŽ䇮㖞 EVV ४ⲴⴞⲴቡᱟѪҶӾⴞḷ᮷Ԧѝ᰾⺞ൠᧂ䲔؍ᆇ㢲ˈഐ↔ᰐ享൘ⴞḷ᮷Ԧѝ ٬  ਈ䟿ᆈۘオ䰤DŽ㲭❦〻ᒿ⇿њⴞḷ᮷Ԧ EVV ४Ⲵ䮯ᓖؑ᚟ᖸ䟽㾱ˈնᱟ⭡Ҿ䈕४ѝᆈ᭮Ⲵᱟ ޡޜ٬ᆇ㢲DŽ䈕४⭘Ҿᆈ᭮ᵚࡍ࿻ॆⲴਈ䟿ᡆ֌Ѫ  „ EVV ४൘〻ᒿᔰ࿻䘀㹼ᰦ䘉њ४ѝਜ਼ᴹ ॆⲴˈֻྲˈ& ਈ䟿а㡜ቡᆈ᭮൘ GDWD ४ѝDŽ ӛˈަѝਜ਼ᴹᤷԔԓ⸱઼ᑨᮠㅹ޵ᇩDŽ〻ᒿ䘀㹼ᰦ GDWD ४Ⲵ޵ᇩ䙊ᑨᱟՊਈޡ४䙊ᑨՊ㻛䘋〻 WH[W ४Ⲵ᧿䘠ҏ਼ṧ䘲ਸҾ GDWD ४DŽ❦㘼ᖃ〻ᒿ൘䘀㹼ᰦˈࡉ䙊ᑨ WH[W ४ᱟнՊ᭩ਈⲴDŽWH[W ᆈ〻ᒿDŽDV ઼ OG Պ࠶࡛⤜・㘼਼ㅹൠሩᖵᆳԜDŽሩަѝ؍„ WH[W ४ǃGDWD ४䘉єњ४⭘Ҿ  䬮᧕ಘ OG ਚ⎹৺ྲл  ㊫४˖ 3.2.4.1 䬴᧛ಞ⎿਀Ⲻ॰   18DV ≷㕆* 䛓Ѹቡᰐ䴰᭩ਈDŽնᱟሩҾ֯⭘ (/) ṬᔿⲴ ; ㌫㔏ˈ䈕㺘䗮ᔿ٬ⴤ᧕ቡᱟ㾱≲ሩަⲴᆇ㢲ᮠDŽֻྲ 㺘⽪ᢺս㖞䇑ᮠಘ٬໎࣐ࡠ  ⲴؽᮠкDŽྲ᷌ս㖞䇑ᮠಘ٬ᵜ䓛ቡᱟ  Ⲵؽᮠˈ DOLJQ ⅑ᯩ٬DŽֻྲˈ ٬սⲴњᮠˈণᱟ  Ⲵ  ᔿⴞḷ᮷ԦⲴ ; ㌫㔏ˈ䈕㺘䗮ᔿ٬ᱟս㖞䇑ᮠಘ٬໎࣐ਾަҼ䘋ࡦ٬ᴰਣ䶒 ༴DŽㅜ  њ㔍ሩ٬㺘䗮ᔿ DEVH[SU˄DEVROXWHH[SUHVVLRQ˅ᤷᇊ㾱≲Ⲵ䗩⭼ሩ喀٬DŽሩҾ֯⭘ DRXW Ṭ  DOLJQ ᱟᆈۘሩ喀≷㕆ભԔˈ⭘Ҿ൘ᖃࡽᆀ४ѝᢺս㖞䇑ᮠಘ٬䇮㖞˄໎࣐˅ࡠлањᤷᇊᆈۘ䗩⭼ 3.2.6.1 .align abs-expr1, abs-expr2, abs-expr3 DŽնᱟ䙊ᑨ䜭֯⭘ሿ߉ᆇㅖDŽл䶒ᡁԜ㔉ࠪаӋᑨ⭘≷㕆ભԔⲴ䈤᰾DŽޣབྷሿ߉ᰐ ᔰ࿻ˈަ։ᱟᆇㅖˈᒦф  ൠ൰ǃᤷᇊᖃࡽ≷㕆Ⲵ४ǃ؞᭩ս㖞䇑ᮠಘ٬ㅹDŽᡰᴹ≷㕆ભԔⲴ਽〠䜭ԕ ≷㕆ભԔᱟᤷ⽪≷㕆ಘ᫽֌ᯩᔿⲴ՚ᤷԔDŽ≷㕆ભԔ⭘Ҿ㾱≲≷㕆ಘѪਈ䟿࠶䝽オ䰤ǃ⺞ᇊ〻ᒿᔰ࿻ 3.2.6 as ≽㕌ળԚ LQFOXGHDRXWK ᮷ԦⲴ䈤᰾DŽ ޣᴹ ᚟DŽሩҾ DRXW ṬᔿⲴⴞḷ᮷ԦˈㅖਧⲴ㊫ර኎ᙗᆈ᭮൘ањ  սᆇ⇥ѝ˄QBW\SH ᆇ㢲˅DŽަਜ਼ѹ䈧৲㿱  ㅖਧⲴ㊫ර኎ᙗਜ਼ᴹ⭘Ҿ䬮᧕ಘ઼䈳䈅ಘⲴ䟽ᇊսؑ᚟ǃᤷ⽪ㅖਧᱟཆ䜘Ⲵḷᘇԕ৺аӋަԆਟ䘹ؑ ᆈۘオ䰤ᆇ㢲䮯ᓖDŽㅖਧᤷੁ䈕ᆈۘオ䰤Ⲵㅜањൠ൰༴DŽ ޡޜ⮉Ⲵ؍༠᰾Ⲵ䴰㾱ޡޜ Պӗ⭏䘉ṧⲴㅖਧDŽ㤕ᵚᇊѹㅖਧⲴ٬нѪ ˈ䛓Ѹ䈕ㅖਧ٬ቡ㺘⽪ᱟFRPP ᴹᇊѹˈOG Պቍ䈅ṩᦞަԆ䬮᧕Ⲵ᮷Ԧᶕ⺞ᇊᆳⲴ٬DŽ൘〻ᒿ֯⭘Ҷањㅖਧն⋑ᴹሩㅖਧ䘋㹼ᇊѹˈቡ  OG ՊሩᵚᇊѹㅖਧⲴ٬䘋㹼⢩↺༴⨶DŽྲ᷌ᵚᇊѹㅖਧⲴ٬ᱟ ˈࡉ㺘⽪䈕ㅖਧ൘ᵜ≷㕆Ⓚ〻ᒿѝ⋑ สൠ൰㘼ਈॆˈDEVROXWH ४ѝㅖਧⲴ٬нՊ᭩ਈDŽ䘉ҏᱟѪօ〠ᆳԜᱟ㔍ሩㅖਧⲴ৏ഐDŽ ᔰ࿻ࡠḷਧ༴Ⲵൠ൰٬DŽሩҾ WH[WǃGDWD ઼ EVV ४ˈањㅖਧⲴ٬䙊ᑨՊ൘䬮᧕䗷〻ѝ⭡Ҿ OG ᭩ਈ४Ⲵ ٬ᱟӾ४ަˈ ㅖਧⲴ٬䙊ᑨᱟ  սⲴDŽሩҾḷࠪ WH[WǃGDWDǃEVV ᡆ DEVROXWH ४ѝањս㖞Ⲵㅖਧ 䇮ަᡰᴹ኎ᙗ൷Ѫ DŽ䘉ᤷ⽪䈕ㅖਧᱟањཆ䜘ᇊѹⲴㅖਧDŽٷᙗDŽྲ᷌нᇊѹቡ֯⭘ањㅖਧˈDV ቡՊ  䲔Ҷ਽ᆇԕཆˈ⇿њㅖਧ䜭ᴹĀ٬ā઼Ā㊫රā኎ᙗDŽṩᦞ䗃ࠪⲴṬᔿн਼ˈㅖਧҏਟԕާᴹ䖵ࣙ኎ 3.2.5.2 ㅜਭኔᙝ ⴨਼DŽޘᆼ VSDFH о   Ⲵ֌⭘DŽഐ↔㺘䗮ᔿ RUJ 䍻٬ቡྲ਼≷㕆ભԔ  ᐡᡰ༴Ⲵൠ൰٬DŽ㔉 ቡՊᢺ P\ODE ᇊѹѪवਜ਼ᆳ㠚 ORQJP\ODE 㺘⽪ DV ≷㕆Ⲵᖃࡽൠ൰DŽഐ↔㺘䗮ᔿ  ⢩↺ㅖਧ 3.2.5.1 ⢯⇀⛯ㅜਭ ᡁԜਚ㜭ੁࡽੁਾᕅ⭘ᴰ䘌  њተ䜘ḷਧDŽى֯⭘ᯩ䶒⋑ᴹ䲀ࡦˈնᱟ൘ԫօᰦ 㺘⽪ੁࡽ˄IRUZDUGV˅DŽተ䜘ḷਧ൘ I ᜿ᙍᱟੁਾ˄EDFNZDUGV˅ˈ E DŽަѝ 1I ተ䜘ḷਧˈࡉ䴰㾱߉ᡀ ˗㤕䴰ᕅ⭘лањᇊѹⲴ 1E ਧ˄ަѝ 1 ԓ㺘ԫօᮠᆇ˅DŽ㤕ᱟᕅ⭘ࡽ䶒ᴰ䘁ᇊѹⲴ䘉њㅖਧˈ䴰㾱߉ᡀ Ⲵḷ 1 ˅ਟ׋䟽༽֯⭘DŽѪҶᇊѹањተ䜘ㅖਧˈਚ㾱߉ࠪᖒྲ    ᴹ  њተ䜘ㅖਧ਽˄ޡᒿѝ ᆇㅖѻаᔰ࿻DŽተ䜘ㅖਧ⭘Ҿॿࣙ㕆䈁ಘ઼〻ᒿઈѤᰦ֯⭘਽〠DŽ൘ањ〻 B ㅖਧ਽ԕањᆇ⇽ᡆ 㔉ањㅖਧ䍻Ҹԫ᜿ᮠ٬DŽ ਟ֌ѪᤷԔⲴ᫽֌ᮠ֯⭘DŽᡁԜਟԕ֯⭘ㅹਧ ᒦфˈֻྲˈˈḷਧ˄Label˅ᱟਾ䶒㍗䲿ањ߂ਧⲴㅖਧDŽ↔ᰦ䈕ㅖਧԓ㺘⍫ࣘս㖞䇑ᮠಘⲴᖃࡽ٬ ᧕ಘ֯⭘ㅖਧ䘋㹼䬮᧕᫽֌ˈ㘼䈳䈅ಘ࡙⭘ㅖਧ䘋㹼䈳䈅DŽ ൘〻ᒿ㕆䈁઼䬮᧕䗷〻ѝˈㅖਧ˄Symbol˅ᱟањ∄䖳䟽㾱ⲴᾲᘥDŽ〻ᒿઈ֯⭘ㅖਧᶕભ਽ሩ䊑ˈ䬮 3.2.5 ㅜਭ ㅖਧDŽޡޜਟ⭘Ҿ൘ EVV ४ѝ༠᰾ањ FRPP њㅖਧ˗ ≷㕆ભԔ⭘Ҿ൘ EVV ४ѝᇊѹа OFRPP ഐѪᖃ〻ᒿࡊᔰ࿻ᢗ㹼ᰦˈbss ४ѝᡰᴹᆇ㢲޵ᇩ䜭ሶ㻛␵䴦DŽ ਈ䟿DŽ֐ਟԕ൘ bss ४ѝ࠶䝽オ䰤ˈնᱟ൘〻ᒿ䘀㹼ѻࡽн㜭൘ަѝ᭮㖞ᮠᦞDŽޡޜ bss ४⭘Ҿᆈۘተ䜘 3.2.4.3 bss ॰ 㹼䈝ਕ≷㕆༴⨶Ⲵ४Ⲵս㖞䇑ᮠಘ㻛〠Ѫᖃࡽ⍫ࣘ䇑ᮠಘDŽ ᒦфԫօḷਧᇊѹ䜭Պਆ⭘ս㖞䇑ᮠಘⲴᖃࡽ٬DŽ↓൘ᢗˈਟԕ᭩ਈަ٬ DOLJQ Ⲵᯩ⌅ˈնᱟ≷㕆ભԔ   18DV ≷㕆*  ਜ਼ѹоLQW ⴨਼DŽ 3.2.6.12 .long expressions ተⲴˈഐ↔䬮᧕ಘ OG ⴻн㿱DŽޘᴹ㻛༠᰾Ѫ ඇⲴ٬DŽ࠶䝽Ⲵൠ൰൘ EVV ४ѝˈഐ↔൘䘀㹼ᰦ࡫䘉Ӌᆇ㢲٬㻛␵䴦DŽ⭡Ҿㅖਧ V\PERO ⋑ޡޜᯠⲴተ䜘 ⮉䮯ᓖѪ OHQJWK ᆇ㢲Ⲵオ䰤DŽᡰ൘Ⲵ४઼ㅖਧ V\PERO Ⲵ٬ᱟ؍४ฏޡޜ Ѫㅖਧ V\PERO ᤷᇊⲴተ䜘 3.2.6.11 .lcomm symbol, length $%DŽ㺘䗮ᔿⲴ٬ቡᱟ䘀㹼ᰦ࡫Ⲵ٬DŽֻྲLQW[ ㌫㔏Ѫ  ᆇ㢲ˈ਼ORQJ˅DŽ⇿њ⭘䙇ਧ࠶ᔰⲴ ˄ 䈕≷㕆ભԔ൘Ḁњ४ѝ䇮㖞  њᡆཊњᮤᮠ٬ 3.2.6.10 .int expressions ৲㿱 LQFOXGHDRXWK ᮷ԦѝⲴ䈤᰾DŽ ࡠⲴDŽڊ〻ѝަԆⴞḷ᮷ԦⲴ਼਽ㅖਧѝ㧧ᗇDŽ䘉ᱟ䙊䗷䇮㖞ㅖਧ V\PERO ㊫රᆇ⇥ѝⲴཆ䜘ս 1B(;7 ᶕ ᆳⲴ٬ሶ㜭㻛䬮᧕䗷〻ѝⲴަԆⴞḷ᮷Ԧ֯⭘DŽ㤕ⴞḷ᮷Ԧѝ⋑ᴹᇊѹ䈕ㅖਧˈ䛓ѸᆳⲴ኎ᙗሶӾ䬮᧕䗷  䈕≷㕆ભԔՊ֯ᗇ䬮᧕ಘ OG 㜭ⴻ㿱ㅖਧ V\PERODŽྲ᷌൘ᡁԜⲴⴞḷ᮷ԦѝᇊѹҶㅖਧ V\PEROˈ䛓Ѹ 3.2.6.9 .global symbol δᡌ㘻.globl symbolε ᷌ਾєњ৲ᮠ䜭ⴱ⮕Ⲵ䈍ˈࡉ VL]H 唈䇔Ѫ DŽྲ˗٬  Ѫ VL]H ઼ YDOXH ᱟਟ䘹ⲴDŽྲ᷌ㅜ  њ䙇ਧ઼ YDOXH ⴱ⮕ˈYDOXH 唈䇔ˈYDOXHDŽ䘉  њ৲ᮠ٬䜭ᱟ㔍ሩ٬ նᱟ㤕 VL]H བྷҾ ˈࡉ䲀ᇊѪ DŽ⇿њ䟽༽ᆇ㢲޵ᇩਆ㠚ањ  ᆇ㢲ᮠDŽ儈  ᆇ㢲Ѫ ˈվ  ᆇ㢲ᱟᮠ٬ ˈVL]H ਟԕѪ  ᡆḀњ٬  䈕≷㕆ભԔՊӗ⭏ᮠњ˄UHSHDW њ˅བྷሿѪ VL]H ᆇ㢲Ⲵ䟽༽ᤧ䍍DŽབྷሿ٬ 3.2.6.8 .fill repeat, size, value LQFOXGHDRXWK ᮷ԦⲴ䈤᰾DŽ ޣ৲㿱ᴹ  ⭘㔍ሩ㺘䗮ᔿⲴ٬䇮㖞ㅖਧ V\PERO Ⲵ᧿䘠ㅖᆇ⇥ QBGHVF Ⲵ  ս٬DŽӵ⭘Ҿ DRXW ṬᔿⲴⴞḷ᮷ԦDŽ 3.2.6.7 .desc symbol, abs-expr ֯⭘㕆ਧ DŽ㕆ਧᗵ享ᱟ㔍ሩ٬㺘䗮ᔿDŽ  䈕≷㕆ભԔ䙊⸕ DV ᢺ䲿ਾⲴ䈝ਕ≷㕆ࡠ㕆ਧѪ VXEVHFWLRQ Ⲵ GDWD ᆀ४ѝDŽྲ᷌ⴱ⮕㕆ਧˈࡉ唈䇔 3.2.6.6 .data subsection ㅖਧˈOG ቡՊ࠶䝽䮯ᓖᴰབྷⲴオ䰤DŽޡޜ䮯ᓖн਼ն਼਽Ⲵ OG ቡՊ࠶䝽ᤷᇊ䮯ᓖ OHQJWK ᆇ㢲Ⲵᵚࡍ࿻ॆ޵ᆈDŽOHQJWK ᗵ享ᱟањ㔍ሩ٬㺘䗮ᔿˈྲ᷌ OG ᢮ࡠཊњ ㅖਧˈ䛓ѸޡޜㅖਧਸᒦDŽྲ᷌ OG ⋑ᴹ᢮ࡠањㅖਧⲴᇊѹˈ㘼ਚᱟањᡆཊњޡޜⴞḷ᮷Ԧѝ਼਽Ⲵ ㅖਧՊоަԆޡޜ४ฏDŽ൘ OG 䬮᧕䗷〻ѝˈḀњⴞḷ᮷ԦѝⲴањޡޜ ൘ EVV ४ѝ༠᰾ањભ਽Ⲵ 3.2.6.5 .comm symbol, length  䈕≷㕆ભԔᇊѹ  њᡆཊњ⭘䙇ਧ࠶ᔰⲴᆇ㢲٬DŽ⇿њ㺘䗮ᔿⲴ٬ᱟањᆇ㢲DŽ 3.2.6.4 .byte expressions ㊫լˈնᱟ⇿њᆇㅖѢਾ䶒Պ㠚ࣘ␫࣐ 18// ᆇㅖDŽ DVFLL  䈕≷㕆ભԔо 3.2.6.3 .asciz "string"... ༴ˈ⇿њᆇㅖѢਾ䶒нՊ㠚ࣘ␫࣐ ˄18//˅ᆇ㢲DŽ DŽ䈕≷㕆ભԔՊ䇙 DV ᢺ䘉ӋᆇㅖѢ≷㕆൘䘎㔝Ⲵൠ൰ս㖞 DVFLL+HOORZZRUOG0\DVVHPEOHU  Ӿս㖞䇑ᮠಘᡰ٬ᖃࡽս㖞ѪᆇㅖѢ࠶䝽オ䰤ᒦᆈۘᆇㅖѢDŽਟ֯⭘䙇ਧ࠶ᔰ߉ࠪཊњᆇㅖѢDŽֻྲˈ 3.2.6.2 .ascii "string"... ৲ᮠѻ䰤֯⭘єњ䙇ਧDŽ 䛓Ѹ䈕ሩ喀᫽֌ቡ㻛ਆ⎸DŽ㤕ᜣⴱ⮕ㅜ  њ৲ᮠˈਟԕ൘ㅜ  ઼ㅜ  њˈ≲䐣䗷Ⲵᆇ㢲ᮠབྷҾ䘉њᴰབྷ٬ 㢲٬ᱟ DŽㅜ  њਟ䘹㺘䗮ᔿ DEVH[SU ⭘Ҿᤷ⽪ሩ喀᫽֌ݱ䇨ປݵ䐣䗷Ⲵᴰབྷᆇ㢲ᮠDŽྲ᷌ሩ喀᫽֌㾱  ㅜ  њ㺘䗮ᔿ㔉ࠪ⭘Ҿሩ喀㘼ປݵⲴᆇ㢲٬DŽ䈕㺘䗮ᔿоަࡽ䶒Ⲵ䙇ਧਟԕⴱ⮕DŽ㤕ⴱ⮕ˈࡉປݵᆇ ቡᱟᢺս㖞䇑ᮠಘ٬໎࣐ࡠ  ⲴؽᮠкDŽ DOLJQ   18DV ≷㕆* Rᤷᇊ䗃ࠪⲴⴞḷ᮷Ԧ਽ Iᘛ䙏᫽֌ Dᔰ੟〻ᒿࡇ㺘 3.2.8 AS ≽㕌ಞળԚ㺂䘿亯 ᇎ⁑ᔿлⲴᕅሬ੟ࣘԓ⸱઼ࡍ࿻ॆ≷㕆〻ᒿᰦ֯⭘Ҷࡽ䶒ӻ㓽Ⲵ DV ≷㕆ಘDŽ  ᒤᔰਁ /LQX[޵Ṩ ᰦ DV ≷㕆ಘ䘈н᭟ᤱ  սԓ⸱ˈഐ↔൘㕆߉઼≷㕆  ޵Ṩ  ⭡Ҿ൘ 䮯ᓖ઼ᙗ㜭кሶՊਇࡠᖡ૽DŽ 㹼൘  ս⁑ᔿDŽ䈧⌘᜿ˈഐѪ DV ѪᡰᴹᤷԔ␫࣐Ҷ仍ཆⲴൠ൰઼᫽֌ᮠᇭᓖࡽ㔰ˈᡰԕ≷㕆ӗ⭏Ⲵԓ⸱ 䇙 DV ༴Ҿ  ս⁑ᔿлˈ䛓Ѹ DV Պ㠚ࣘѪᡰᴹᤷԔ࣐кањᗵ㾱Ⲵ᫽֌ᮠᇭᓖࡽ㔰㘼䇙ᤷԔ䘀 FRGH ᙫᱟѪ≷㕆䈝ਕӗ⭏  սⲴᤷԔԓ⸱㘼н㇑ᤷԔሶ䘀㹼൘  ս䘈ᱟ  ս⁑ᔿлDŽྲ᷌֯⭘≷㕆ભԔ DŽDVޣаṧ㘼о⁑ᔿᰐޘ DV н४࠶  ս઼  ս≷㕆䈝ਕˈ൘  ս઼  ս⁑ᔿл⇿ᶑᤷԔⲴ࣏㜭ᆼ 䇙 DV ≷㕆ಘ࠷ᦒഎ  սԓ⸱≷㕆ᯩᔿDŽ FRGH ˈᒦф֯⭘≷㕆ભԔ FRGH ࣐≷㕆ભԔ Ⲵԓ⸱ҏᨀ׋ᴹ䲀Ⲵ᭟ᤱDŽѪҶ䇙 DV ≷㕆ᰦӗ⭏  սԓ⸱ˈ䴰㾱൘䘀㹼Ҿ  ս⁑ᔿⲴᤷԔ䈝ਕѻࡽ␫ ᣔ⁑ᔿ؍ ᒤਾᆳሩ㕆߉䘀㹼Ҿᇎ⁑ᔿᡆ  ս  㲭❦ DV 䙊ᑨ⭘ᶕ㕆߉㓟  սⲴ ;ԓ⸱ˈնᱟ 3.2.7 㕌ߏ 16 փԙ⸷   ሩҾ  սᵪಘˈ䈕≷㕆ભԔਜ਼ѹоVKRUW ⴨਼DŽ 3.2.6.20 .word expressions DŽ 㕆ਧ٬  䙊⸕ DV ᢺ䲿ਾⲴ䈝ਕ≷㕆䘋㕆ਧѪ VXEVHFWLRQ Ⲵᆀ४ѝDŽྲ᷌ⴱ⮕Ҷ㕆ਧ VXEVHFWLRQˈࡉ֯⭘唈䇔 3.2.6.19 .text subsection 18// ᆇㅖ㔃ቮDŽֻྲˈVWULQJ?Q?Q6WDUWLQJRWKHUVWULQJVDŽ  ᇊѹањᡆཊњ⭘䙇ਧ࠶ᔰⲴᆇㅖѢDŽ൘ᆇㅖѢѝਟԕ֯⭘䖜ѹᆇㅖDŽ⇿њᆇㅖѢ䜭㠚ࣘ䱴࣐ањ 3.2.6.18 .string "string" 䛓Ѹ ILOO Ⲵ唈䇔٬ቡᱟ DŽ ILOODŽ䘉њ৲ᮠ൷Ѫ㔍ሩ٬DŽྲ᷌ⴱ⮕Ҷ䙇ਧ઼ ILOOˈ  䈕≷㕆ભԔӗ⭏ VL]H њᆇ㢲ˈ⇿њᆇ㢲ປ٬ 3.2.6.17 .space size, fill ⭏ањ  սⲴ٬DŽ  䘉њ≷㕆ભԔᤷᇊḀњ४ѝ  њᡆཊњ⭘䙇ਧ࠶ᔰⲴ  ᆇ㢲ᮠDŽሩҾ⇿њ㺘䗮ᔿˈ൘䘀㹼ᰦ࡫䜭Պӗ 3.2.6.16 .short expressions δੂ.word expressionsε  њᆇ㢲DŽ  䘉њ≷㕆ભԔᤷᇊ  њᡆཊњ⭘䙇ਧ࠶ᔰⲴ  ᆇ㢲བྷᮠ ELJQXPDŽྲ᷌བྷᮠ᭮н䘋  њᆇ㢲ѝˈࡉਆվ 3.2.6.15 .quad bignums ٬DŽ  ILOOˈࡉ ILOO 唈䇔Ѫ ILOODŽ䈕٬ᗵ享ᱟ㔍ሩ٬DŽྲ᷌ⴱ⮕Ҷ䙇ਧ઼ ٬ޕ ᖃս㖞䇑ᮠಘ٬໎䮯ᰦˈᡰ䐣䏳䗷Ⲵᆇ㢲ሶ㻛ປ ⭘DŽ䈧⌘᜿ˈս㖞䇑ᮠಘᱟสҾ४Ⲵˈণԕ⇿њ४֌Ѫ䇑ᮠ䎧⛩DŽ ᴹ⴨਼४֌Ѫᆀ४Ⲵ㺘䗮ᔿˈҏণн㜭֯⭘RUJ 䐘䎺਴४DŽྲ᷌ QHZBOF Ⲵ४нሩˈ䛓ѸRUJ ቡнՊ䎧֌ 㺘䗮ᔿ˅ˈᡆ㘵ᱟާ˄QHZBOFDŽQHZBOF ᱟањ㔍ሩ٬  䘉њ≷㕆ભԔՊᢺᖃࡽ४Ⲵս㖞䇑ᮠಘ䇮㖞Ѫ٬ 3.2.6.14 .org new_lc, fill ࡛ሩᓄ ǃǃǃ ઼  ᆇ㢲ᮠ˅DŽ  䘉њ≷㕆ભԔᤷᇊ  њᡆཊњ⭘䙇ਧ࠶ᔰⲴ  ᆇ㢲བྷᮠ˄E\WHZRUGORQJTXDGRFWD࠶ 3.2.6.13 .octa bignums   18DV ≷㕆* ਟᢗ㹼᮷Ԧ ᓃ᮷Ԧ ≷㕆ಘⴞḷ᮷Ԧ䬮᧕ಘ ≷㕆〻ᒿ Ⓚ᮷Ԧ 亴༴⨶ 㓟& 㕆䈁ಘ D DVROG V F FSS F FF Ⲵ㕆䈁䗷〻䘋㹼㠚ࣘ㇑⨶ˈ䈖㿱ਾ䶒䈤᰾DŽ ൘㕆䈁䊑 Linux ޵Ṩ䘉ṧⲴवਜ਼ᖸཊⓀ〻ᒿ᮷ԦⲴབྷර〻ᒿᰦˈ䙊ᑨ֯⭘ make ᐕާ䖟Ԧሩᮤњ〻ᒿ JFFFRKHOORRKHOORF㕆䈁 KHOORF 〻ᒿˈ⭏ᡀሩᓄⴞḷ᮷Ԧ KHOORR 㘼н䬮᧕DŽ JFF6RKHOORVKHOORF㕆䈁 KHOORF 〻ᒿˈ⭏ᡀሩᓄ≷㕆〻ᒿ KHOORVDŽ JFFRKHOORKHOORF㕆䈁 KHOORF 〻ᒿˈ⭏ᡀᢗ㹼᮷Ԧ KHOORDŽ  ⴞḷ᮷Ԧ㘼нᢗ㹼䬮᧕༴⨶ˈ㿱ྲлᡰ⽪DŽ 䘹亩ਟԕ䇙 JFF ਚ⭏ᡀ F 䘀㹼˗֯⭘→ڌ䘹亩ਟԕ䇙 JFF ൘䗃ࠪҶ & 〻ᒿሩᓄⲴ≷㕆䈝䀰〻ᒿѻਾቡ 6 ᢗ㹼DŽֻྲˈ֯⭘→ڌ䜘ᢗ㹼䘉ഋњ䱦⇥ˈ֯⭘ભԔ㹼䘹亩ਟԕԔ JFF 㕆䈁䗷〻൘Ḁњ༴⨶䱦⇥ਾቡ ޘⲴ C 䈝䀰᮷Ԧ˗RXWILOH ᱟ㕆䈁ӗ⭏Ⲵ䗃ࠪ᮷ԦDŽሩҾḀ⅑㕆䈁䗷〻ˈᒦ䶎аᇊ㾱ޕަѝ LQILOH ᱟ䗃 JFF>䘹亩@>RRXWILOH@LQILOH 㕆䈁≷㕆䈝䀰ⲴṬᔿ㊫լ˖ ᮷ԦDŽ䈳⭘ JFF ⲴભԔ㹼Ṭᔿоۿⴞḷ᮷Ԧ㓴ਸ䬮᧕൘а䎧ˈ⭏ᡀ〻ᒿⲴਟᢗ㹼᱐ޣOG 䬮᧕ಘᢺ〻ᒿⲴ⴨ ᆈ൘ⴞḷ᮷Ԧѝ˗ᴰਾ *18؍㕆䱦⇥ˈDV ≷㕆ಘՊᢺ≷㕆ԓ⸱䖜ᦒᡀᵪಘᤷԔˈᒦԕ⢩ᇊҼ䘋ࡦṬᔿ䗃ࠪ Ⲵ DV ≷㕆䈝䀰ԓ⸱˗൘≷ޣ䗃ࠪ㓟 & 䈝䀰ԓ⸱˗൘㕆䈁䱦⇥ˈJFF ᢺ & 䈝䀰〻ᒿ㕆䈁⭏ᡀሩᓄⲴоᵪಘ⴨ ൘ࡽ༴⨶䱦⇥ѝˈgcc Պᢺ C 〻ᒿՐ䙂㔉 C ࡽ༴⨶ಘ CPPˈሩ C 䈝䀰〻ᒿѝᤷ⽪ㅖ઼ᆿ䘋㹼ᴯᦒ༴⨶ˈ ഴ & ぁᓅ㕌䈇䗽ぁ  䬮᧕䱦⇥ˈ㿱മ 3-3 ᡰ⽪DŽ ֯⭘ gcc ≷㕆ಘ㕆䈁 C 䈝䀰〻ᒿᰦ䙊ᑨՊ㓿䗷ഋњ༴⨶䱦⇥ˈণ亴༴⨶䱦⇥ǃ㕆䈁䱦⇥ǃ≷㕆䱦⇥઼ 3.3.1 C ぁᓅ㕌䈇ૂ䬴᧛ ኅ䈝ਕ㔉ࠪㆰঅⲴ䈤᰾DŽ ߶ѝDŽᵜ㢲㔉ࠪ޵Ṩѝ㓿ᑨ⭘ࡠⲴаӋ gcc ᢙݵ䈝ਕⲴ䈤᰾DŽ൘ਾ䶒ㄐ㢲〻ᒿ⌘䟺ѝҏՊ䲿ᰦሩ䙷ࡠⲴᢙ GNU gcc ሩ ISO ḷ߶ C89 ᧿䘠Ⲵ C 䈝䀰䘋㹼ҶаӋᢙኅˈަѝаӋᢙኅ䜘࠶ᐢ㓿वᤜ䘋 ISO C99 ḷ 3.3 C 䈣䀶ぁᓅ :ਆ⎸䆖੺ؑ᚟ 5㓴ਸᮠᦞ४઼ԓ⸱४   䈝䀰〻ᒿ & ≶ޕ፼ˈൠ൰٬DŽѪҶ൘к䶒≷㕆䈝ਕѝ֯⭘䈕ൠ൰٬〫ٿ䗃ࠪ⴨਼ⲴᇴᆈಘDŽ㘼(*(addr))㺘⽪ањ޵ᆈ 䗃ࠪ٬ᴯԓDŽㅜ 9 㹼㺘⽪൘䘉⇥ԓ⸱ᔰ࿻䘀㹼ᰦሶ seg ᭮ࡠ eax ᇴᆈಘѝˈ"0"㺘⽪֯⭘ок䶒਼њս㖞Ⲵ a"ѝⲴ"a"〠Ѫ࣐䖭ԓ⸱ˈ"="㺘⽪䘉ᱟ䗃ࠪᇴᆈಘˈᒦфަѝⲴ٬ሶ㻛="ˈਈ䟿ѝˈ֌Ѫᵜ࠭ᮠⲴ䗃ࠪ٬ res__ޕㅜ 8 㹼ণᱟ䗃ࠪᇴᆈಘˈ䘉ਕⲴਜ਼ѹᱟ൘䘉⇥ԓ⸱䘀㹼㔃ᶏਾሶ eax ᡰԓ㺘ⲴᇴᆈಘⲴ٬᭮ ਕᇴᆈಘ਽〠ࡽቡᗵ享߉кєњⲮ࠶ਧDŽ 㕆䈝≶ޕⲴ≷㕆䈝ਕDŽਖཆˈѪҶ䇙 gcc 㕆䈁ӗ⭏Ⲵ≷㕆䈝䀰〻ᒿѝᇴᆈಘ਽〠ࡽᴹањⲮ࠶ਧˈ൘፼ 㕆䈝ਕⲴᔰ࿻DŽӾㅜ 4 㹼ࡠㅜ 7 㹼Ⲵ 4 ᶑ䈝ਕᱟ AT&T Ṭᔿ≶ޕ"__asm__"DŽㅜ 4 㹼кⲴ"__asm__"㺘⽪፼ ”ˈަѝ"asm"ҏਟԕ߉ᡀ D[ ಘ˄ֻྲ eax˅ˈ䛓ѸᡁԜਟԕᢺ䈕ਕ߉ᡀ“UHJLVWHUFKDUBBUHVDVP ᆈ൘ањᇴᆈಘѝˈԕׯҾᘛ䙏䇯䰞઼᫽֌DŽྲ᷌ᜣᤷᇊᇴᆈ؍ᇊѹҶањᇴᆈಘਈ䟿__resDŽ䈕ਈ䟿ሶ㻛 〻ᒿѝᕅ⭘䈕ᆿ਽〠ⲴൠᯩDŽㅜ 1 㹼ᇊѹҶᆿⲴ਽〠ˈҏণᱟᆿ࠭ᮠ਽〠 get_seg_byte(seg,addr)DŽㅜ 3 㹼 ഐѪᆿ䈝ਕ䴰㾱ᇊѹ൘а㹼кˈഐ↔䘉䟼֯⭘৽ᯌᶐ'\'ሶ䘉Ӌ䈝ਕ䘎ᡀа㹼DŽ䘉ᶑᆿᇊѹሶ㻛ᴯᦒࡠ 㿱ла㢲䈤᰾DŽˈ䟿__res˄ㅜ 10 㹼˅ᱟ䈕㺘䗮ᔿⲴ䗃ࠪ٬ ^` āਟԕ֌Ѫ㺘䗮ᔿ֯⭘ˈަѝᴰਾа㹼кⲴਈ ᆿ޵DŽ⭘ശᤜਧᤜտⲴ㓴ਸ䈝ਕ˄㣡ᤜਧѝⲴ䈝ਕ˅˖Ā 㕆䈝䀰ᆿ࠭ᮠDŽ䙊ᑨ֯⭘≷㕆䈝ਕᴰᯩׯⲴᯩᔿᱟᢺᆳԜ᭮൘ањ≶ޕ䘉⇥ 10 㹼ԓ⸱ᇊѹҶањ፼  `BBUHV ᇴᆈಘࡇ㺘DŽޕ?䗃 DGGU VHJ P  BBUHV ?䗃ࠪᇴᆈಘࡇ㺘DŽ  D SRSIV?ᚒ༽ IV ᇴᆈಘ৏޵ᇩDŽ DGGU ༴  ᆇ㢲޵ᇩࡠ DO ᇴᆈಘѝDŽ?ਆ VHJDOPRYEIV ?❦ਾ⭘ VHJ 䇮㖞 IVDŽPRYD[IV 䘹ᤙㅖ˅DŽ⇥˄ᆈ IV ᇴᆈಘ৏٬؍?俆ݸSXVKIV BBDVPBB ?ᇊѹҶањᇴᆈಘਈ䟿BBUHVDŽUHJLVWHUFKDUBBUHV ^?  VHJDGGU ? GHILQHJHWBVHJBE\WH а⇥ԓ⸱֌Ѫֻᆀᶕ䈖㓶䀓䈤DŽѪҶ㜭ⴻᗇᴤ␵ᾊаӋˈᡁԜሩ䘉⇥ԓ⸱䘋㹼Ҷ䟽ᯠᧂࡇ઼㕆ਧDŽ 㕆䈝ਕⲴ֯⭘ᯩ⌅DŽ䘉䟼ࡇࠪҶ NHUQHOWUDSVF ᮷Ԧѝㅜ 22 㹼ᔰ࿻Ⲵ≶ޕл䶒ᡁԜ⭘ֻᆀᶕ䈤᰾፼ ᆈಘ䜘࠶ࡇࠪˈնᱟ൘≷㕆䈝ਕѝ᰾⺞֯⭘ࡠᡆ䳀ਜ਼֯⭘ࡠⲴᇴᆈಘ਽ࡇ൘䘉њ䜘࠶ѝDŽ ᇴޕᇴᆈಘ࣐䖭Ⲵ٬DŽྲ᷌ᗵ㾱Ⲵ䈍ˈgcc 䴰㾱䟽ᯠ࣐䖭䘉ӋᇴᆈಘDŽഐ↔ᡁԜ䴰㾱ᢺ䛓Ӌ⋑ᴹ൘䗃ࠪ/䗃 㻛؞᭩Ⲵᇴᆈಘ”㺘⽪֐ᐢሩަѝࡇࠪⲴᇴᆈಘѝⲴ٬䘋㹼Ҷ᭩ࣘˈgcc 㕆䈁ಘн㜭޽׍䎆Ҿᆳ৏ݸሩ䘉Ӌ ᆳԜҏ࠶࡛ሩᓄ⵰а C ਈ䟿ᡆᑨᮠ٬DŽĀՊˈ٬ޕᢗ㹼≷㕆ԓ⸱ᰦˈ䘉䟼ᤷᇊⲴаӋᇴᆈಘѝᓄᆈ᭮Ⲵ䗃 ᇴᆈಘā㺘⽪൘ᔰ࿻ޕ䗃ࠪᮠᦞDŽ↔ൠˈ䘉ӋᇴᆈಘՊ࠶࡛ሩᓄа C 䈝䀰㺘䗮ᔿ٬ᡆањ޵ᆈൠ൰˗Ā䗃 㕆ᢗ㹼ᆼѻਾˈଚӋᇴᆈಘ⭘Ҿᆈ᭮≶ޕ㕆䈝ਕāᱟ֐߉≷㕆ᤷԔⲴൠᯩ˗Ā䗃ࠪᇴᆈಘā㺘⽪ᖃ䘉⇥፼ 䭞䇽˗Ā≷ޣ䲔ㅜ 1 㹼ԕཆˈਾ䶒ᑖ߂ਧⲴ㹼㤕н֯⭘ቡ䜭ਟԕⴱ⮕DŽަѝˈĀasmāᱟ޵㚄≷㕆䈝ਕ  Պ㻛؞᭩Ⲵᇴᆈಘ ᇴᆈಘޕ䗃 䗃ࠪᇴᆈಘ Ā≷㕆䈝ਕā DVP 㕆䈝ਕⲴสᵜṬᔿѪ˖≶ޕⲴ፼ 䗃ࠪ৲ᮠ઼ޕᔿ≷㕆ԓ⸱ˈഐ↔䘉䟼ᴹᗵ㾱ሩަสᵜṬᔿ઼֯⭘ᯩ⌅䘋㹼䈤᰾DŽާᴹ䗃ޕа㡜ᖸቁ⭘ࡠ፼ ᔿ≷㕆˄޵㚄≷㕆˅䈝ਕDŽ⭡ҾᡁԜ䙊ᑨ㕆ࡦ C 〻ᒿ䗷〻ѝޕᵜ㢲ӻ㓽޵Ṩ C 䈝䀰〻ᒿѝ᧕䀖ࡠⲴ፼ 㕌≼ޛ3.3.2 ᎂ   䈝䀰〻ᒿ & O ֯⭘ᑨᮠ 0-31 ˄eaxǃebxǃecxǃedx ᡆ޵ᆈਈ䟿˅ g ֯⭘䙊⭘ᴹ᭸Ⲵൠ൰ণਟ r ֯⭘ԫ᜿ࣘᘱ࠶䝽Ⲵᇴᆈಘ N ֯⭘ 1 ᆇ㢲ᑨᮠ˄0-255˅ M ֯⭘ᑨᮠ 0-3 ˄eaxǃebxǃecx ᡆ edx˅ q ֯⭘ࣘᘱ࠶䝽ᆇ㢲ਟራ൰ᇴᆈಘ D ֯⭘ edi L ֯⭘ᑨᮠ 0-65535 S ֯⭘ esi K ֯⭘ᑨᮠ 0-255 d ֯⭘ᇴᆈಘ edx J ֯⭘ᑨᮠ 0-63 c ֯⭘ᇴᆈಘ ecx I ֯⭘ᑨᮠ 0-31 ٬〫ٿb ֯⭘ᇴᆈಘ ebx o ֯⭘޵ᆈൠ൰ᒦਟԕ࣐ a ֯⭘ᇴᆈಘ eax m ֯⭘޵ᆈൠ൰ ԓ⸱ 䈤᰾ ԓ⸱ 䈤᰾ 㺞 ᑮ⭞ᇺᆎಞࣖ䖳ԙ⸷䈪᱄ 㜭ཏሩ gcc ⲴՈॆ᫽֌ᴹᡰᑞࣙDŽ㺘 3-4 ѝᱟаӋ֐ਟ㜭Պ⭘ࡠⲴᇴᆈಘ࣐䖭ԓ⸱৺ަާփⲴਜ਼ѹDŽ ӋӰѸਾˈڊᴰਾа㹼Ⲵ֌⭘ᱟ੺䇹 gcc 䘉ӋᇴᆈಘѝⲴ٬ᐢ㓿᭩ਈҶDŽ൘ gcc ⸕䚃֐᤯䘉Ӌᇴᆈಘ ṧቡਟԕ൘⇿⅑ᗚ⧟ѝቁ⭘ањ movl 䈝ਕDŽ ⮉ eaxˈ䘉؍٬ਟ㜭ᐢ㓿൘ eax ѝDŽྲ᷌ᱟ൘ањᗚ⧟䈝ਕѝⲴ䈍ˈgcc ቡਟ㜭൘ᮤњᗚ⧟᫽֌ѝ fill_value ઒˛ഐѪ gcc ൘ᆳ䘋㹼ᇴᆈಘ࠶䝽ᰦਟԕ䘋㹼ḀӋՈॆᐕ֌DŽֻྲڊᇴᆈಘ٬Ⲵ࣐䖭ˈ㘼н䇙ᡁԜ㠚ᐡ 䘉ṧⲴڊᆈಘѝ˄࣐䖭ԓ⸱ᱟ"c"˅ˈfill_value ࣐䖭ࡠ eax ѝˈdest ᭮ࡠ edi ѝDŽѪӰѸ㾱䇙 gcc 㕆䈁〻ᒿ৫ 㕆〻ᒿ⋑ᴹ⭘ࡠ䗃ࠪᇴᆈಘDŽㅜ 5 㹼Ⲵਜ਼ѹᱟ˖ሶ count-1 Ⲵ٬࣐䖭ࡠ ecx ᇴ≶ޕㅜ 4 㹼䈤᰾䘉⇥፼ DŽѪҶ亴༴⨶䗃ࠪⲴ≷㕆〻ᒿṬᔿᮤ喀ˈቡਟԕ֯⭘"\n\t"䘉єњṬᔿㅖਧDŽ(⌅ڊᰦᑨ⭘Ⲵ ᜣⴻⴻ C ሩᓄⲴ≷㕆〻ᒿˈ䛓Ѹቡ䴰㾱ᗇࡠ亴༴⨶〻ᒿ䗃ࠪⲴ≷㕆〻ᒿ㔃᷌(䘉൘㕆߉઼䈳䈅儈᭸Ⲵԓ⸱ ӗ⭏о C 〻ᒿሩᓄⲴ≷㕆〻ᒿˈ❦ਾ䈳⭘≷㕆ಘሩަ䘋㹼㕆䈁ӗ⭏ⴞḷԓ⸱ˈྲ᷌൘߉〻ᒿ઼䈳䈅〻ᒿᰦ 亴༴⨶〻ᒿ䗃ࠪ〻ᒿࡇ㺘ᰦ㜭ᧂⲴᮤ喀㘼䇮㖞ⲴˈᆇㅖⲴਜ਼ѹо C 䈝䀰ѝⲴ⴨਼DŽণ gcc Ⲵ䘀֌ᯩᔿᱟݸ ᆈ٬DŽަѝཤє㹼ѝⲴᆇㅖ"\n\t"ᱟ⭘Ҿ gcc؍༽ 1-3 㹼䘉йਕᱟ䙊ᑨⲴ≷㕆䈝ਕˈ⭘ԕ␵ᯩੁսˈ䟽  HF[HGL  GHVW ILOOBYDOXH ' FRXQW D F  ⋑ᴹ䗃ࠪᇴᆈಘ  VWRO UHS?Q?W FOG?Q?W DVP ањᆇ㢲DŽ޽൘ⴻлањֻᆀDŽ ٬Ⲵ޵ᆈൠ൰༴ਆ〫ٿ઼⇥ࡠ⧠൘Ѫ→ˈᡁԜᓄ䈕ᖸ␵ᾊ䘉⇥〻ᒿⲴ࣏㜭Ҷ੗ʽ䈕ᆿ࠭ᮠⲴ࣏㜭ᱟӾᤷᇊ ൠ൰䟿DŽ〫ٿ㘼 addr 㺘⽪а޵ᆈˈ٬⇥䙊䗷к䶒࠶᷀ˈᡁԜ⸕䚃ˈᆿ਽〠ѝⲴ seg ԓ㺘аᤷᇊⲴ޵ᆈ resˈ֌Ѫ䈕ᆿ࠭ᮠ˄ඇ㔃ᶴ㺘䗮ᔿ˅Ⲵ䘄എ٬DŽᖸㆰঅˈнᱟੇ˛__ޕಘ eax Ⲵ٬ሶ㻛᭮ al ᇴᆈಘѝDŽᖃᢗ㹼ᆼ≷㕆䈝ਕਾˈ䗃ࠪᇴᆈ ޕ䍻㔉 fs ⇥ᇴᆈಘ˗ㅜйਕᱟᢺ fs:(*(addr))ᡰᤷᇊⲴᆇ㢲᭮ ٬⇥Ḹ˗ㅜҼਕሶ eax ѝⲴޕ⧠൘ᡁԜᶕ⹄ウ 4—7 㹼кⲴԓ⸱Ⲵ֌⭘DŽㅜаਕሶ fs ⇥ᇴᆈಘⲴ޵ᇩ 䟿DŽ 〫ٿࡽа䜘࠶("0" (seg))Ⲵ㕆ਧᱟ%1ˈ㘼ਾ䜘࠶Ⲵ㕆ਧᱟ%2DŽк䶒ㅜ 6 㹼кⲴ%2 ণԓ㺘(*(addr))䘉њ޵ᆈ ᇴᆈಘޕ࿻ˈ࠶࡛䇠Ѫ%0ǃ%1ǃ…%9DŽഐ↔ˈ䗃ࠪᇴᆈಘⲴ㕆ਧᱟ%0˄䘉䟼ਚᴹањ䗃ࠪᇴᆈಘ˅ˈ䗃 ᇴᆈಘ㔏а᤹亪ᒿ㕆ਧˈ亪ᒿᱟӾ䗃ࠪᇴᆈಘᒿࡇӾᐖࡠਣӾкࡠлԕ"%0"ᔰޕ㕆〻ᒿ㿴ᇊᢺ䗃઼ࠪ䗃   䈝䀰〻ᒿ &  FWLQWFRXQW FVFRQVWFKDU FRQVWFKDU H[WHUQLQOLQHLQWVWUQFPS Ѣ ˈࡉ䘄എDŽ 䘄എ˖ྲ᷌Ѣ !Ѣ ˈࡉ䘄എ ˗Ѣ  Ѣ ˈࡉ䘄എ ˗Ѣ FRXQW DŽ FW Ѣ  ᤷ䪸ˈHF[ FV Ѣ  ᤷ䪸ˈHVL HGLˈBBUHV 䘄എ٬ HD[ ৲ᮠ˖FVᆇㅖѢ ˈFWᆇㅖѢ ˈFRXQW∄䖳ⲴᆇㅖᮠDŽ ᆇㅖѢ  оᆇㅖѢ  Ⲵࡽ FRXQW њᆇㅖ䘋㹼∄䖳DŽ ᱟ⭘Ҿ gcc 亴༴⨶〻ᒿ䗃ࠪࡇ㺘ྭⴻ㘼䇮㖞ⲴDŽ ⸱ᱟӾ include/string.h ᮷Ԧѝ᪈ਆⲴˈᱟ strncmp()ᆇㅖѢ∄䖳࠭ᮠⲴа⿽ᇎ⧠DŽ਼ṧˈަѝ⇿㹼ѝⲴ"\n\t" 㕆ԓ⸱ሩ֐ᶕ䈤สᵜ⋑䰞仈ҶDŽ䘉⇥ԓ≶ޕл䶒޽ֻѮањ䖳䮯Ⲵֻᆀˈྲ᷌㜭ⴻᗇ៲ˈ䛓ቡ䈤᰾፼ `  6,*6(*9 GRBH[LW  RXWRIPHPRU\?Q?U SULQWN ^  YRLG VWDWLFLQOLQHYRODWLOHYRLGRRP   ORQJFRGH YRODWLOHYRLGGRBH[LW нՊ޽䘄എࡠ䈳⭘㘵ԓ⸱ѝ˖ ઼ RRP ᚟DŽֻྲ mm/memory.c ѝⲴྲл䈝ਕ䈤᰾࠭ᮠ GRBH[LW 䆖੺ؑٷ䭞䇽ҏਟԕ⭘ᶕ䚯ݽ gcc ӗ⭏ޣ䇙 gcc ӗ⭏ᴤྭаӋⲴԓ⸱DŽਖཆˈሩҾнՊ䘄എⲴ࠭ᮠˈ䘉њ 䭞䇽 YRODWLOH ҏਟԕ᭮൘࠭ᮠ਽ࡽᶕ؞侠࠭ᮠˈ⭘ᶕ䙊⸕ gcc 㕆䈁ಘ䈕࠭ᮠнՊ䘄എDŽ䘉ṧቡਟԕޣ  ĂĂ  BBDVPBBBBYRODWLOHBB ᡆ㘵ᴤ䈖㓶Ⲵ䈤᰾Ѫ˖  ĂĂ  DVPYRODWLOH 䇽 YRODWLOHˈ㿱л䶒ᡰ⽪DŽ䘉є⿽༠᰾Ⲵ४࡛൘Ҿ〻ᒿެᇩᙗᯩ䶒DŽᔪ䇞֯⭘ਾа⿽༠᰾ᯩᔿDŽ 䭞ޣ⌘᜿˖൘ᢗ㹼ԓ⸱ᰦˈྲ᷌нᐼᵋ≷㕆䈝ਕ㻛 GCC Ոॆ㘼֌؞᭩ˈቡ䴰㾱൘ asm ㅖਧਾ䶒␫࣐ HD[HD[ HD[ OHDO ᇊѪ eax Ⲵ䈍ˈ䛓Ѹк䶒≷㕆䈝ਕⲴਜ਼ѹণѪ˖ ᇴᆈಘⲴԓ⸱ᱟ 0 ᡆѪオᰦˈࡉ䈤᰾֯⭘о⴨ᓄ䗃ࠪаṧⲴᇴᆈಘDŽᡰԕˈྲ᷌ gcc ሶ r ᤷޕਧDŽྲ᷌䗃 Ⲵᇴᆈಘˈ"%0"㺘⽪䗃ࠪ٬ᇴᆈಘDŽ䗃ࠪᇴᆈಘԓ⸱ࡽаᇊ㾱࣐ㅹҾޕx 㾱᭮ ٬ޕᆈಘDŽ䘉䟼"%1"ԓ㺘䗃 ÎUDŽ䘉њֻᆀਟԕ䶎ᑨᘛൠሶ x ҈ 5DŽަѝ"%0"ǃ"%1"ᱟᤷ gcc 㠚ࣘ࠶䝽Ⲵᇴ U”䈝ਕ㺘⽪ UU  UU ᤷԔ”OHDO”⭘Ҿ䇑㇇ᴹ᭸ൠ൰ˈն䘉䟼⭘ᆳᶕ䘋㹼аӋㆰঅ䇑㇇DŽㅜ 1 ᶑਕ≷㕆䈝ਕ”OHDO  [     \  U     OHDO  DVP л䶒Ⲵֻᆀнᱟ䇙֐㠚ᐡᤷᇊଚњਈ䟿֯⭘ଚњᇴᆈಘˈ㘼ᱟ䇙 gcc Ѫ֐䘹ᤙDŽ ᆼ᫽֌ᮠѻࡽˈ޵ᇩՊ㻛؞᭩ 㺘⽪᫽֌ᮠਟ䈫ਟ߉ & ᰙᵏՊਈⲴ˄earlyclobber˅᫽֌ᮠDŽ㺘⽪൘֯⭘ + A ֯⭘ eax о edx 㚄ਸ(64 ս) = 䗃ࠪ᫽֌ᮠDŽ䗃ࠪ٬ሶᴯᦒࡽ٬   䈝䀰〻ᒿ & ޽ⴻањ include/asm/io.h ཤ᮷ԦѝⲴ䈫 I/O ㄟਓ port Ⲵᆿᇊѹˈަѝᴰਾਈ䟿 _v Ⲵ٬ቡᱟ inb()Ⲵ䘄  ` 䈕ս㖞༴Ⲵ٬֌Ѫ䘄എ٬DŽޕ?❦ਾӾㄟਓ [ 䈫 [ LQEBS ?俆ݸੁ ,2 ㄟਓ [ 䗃ࠪⅢ䈫ਆⲴս㖞 DGGUDŽ [_DGGU[ RXWEBS ^?ᴰਾ৽ᯌᶐ䎧䘎᧕є㹼䈝ਕⲴ֌⭘DŽ  DGGU GHILQH&026B5($' init/main.c 〻ᒿѝ䈫ਆ CMOS ᰦ䫏ؑ᚟Ⲵᆿᇊѹ˖ ᖃ❦ˈӪԜ䙊ᑨнՊ䊑к䶒䘉ṧ߉䈝ਕˈ䘉⿽䈝ਕ㺘䗮ᔿ䙊ᑨ䜭⭘ᶕᇊѹᆿDŽֻྲ޵ṨⓀԓ⸱ ^⮕` E UHV [ Ⲵ䍻٬䈝ਕᶕ֯⭘˖ ਖཆˈ䘉⿽㺘䗮ᔿѝ䈝ਕ༠᰾Ⲵԫօተ䜘ਈ䟿䜭Պ൘ᮤඇ䈝ਕ㔃ᶏਾཡ᭸DŽ䘉њ⽪ֻ䈝ਕਟԕ䊑ྲлᖒᔿ ശᤜਧᤜտ䈝ਕⲴ٬DŽྲ᷌ᴰਾаᶑ䈝ਕнᱟ㺘䗮ᔿˈ䛓Ѹᮤњ䈝ਕ㺘䗮ᔿቡާᴹ void ㊫රˈഐ↔⋑ᴹ٬DŽ ަѝ㓴ਸ䈝ਕѝᴰਾаᶑ䈝ਕᗵ享ᱟਾ䶒䐏䲿ањ࠶ਧⲴ㺘䗮ᔿDŽ䘉њ㺘䗮ᔿ˄”3 + z”˅Ⲵ٬ণ⭘֌ᮤњ  `] HOVH] \ \! ] \ LI LQW] ^LQW\ IRR  ઼ተ䜘ਈ䟿ˈഐ↔䘉⿽ᖒᔿⲴ䈝ਕ䙊ᑨ〠Ѫ䈝ਕ㺘䗮ᔿDŽ䈝ਕ㺘䗮ᔿާᴹྲл⽪ֻⲴᖒᔿ˖ ྲ”({...})”Ⲵ䈝ਕˈਟԕ൘ GNU C ѝ⭘֌ањ㺘䗮ᔿ֯⭘DŽ䘉ṧቡਟԕ൘㺘䗮ᔿѝ֯⭘ loopǃswitch 䈝ਕ ѹк䘉Ӌ䈝ਕቡㅹ਼Ҿаᶑ䈝ਕDŽ㓴ਸ䈝ਕⲴਣ㣡ᤜਧਾ䶒н䴰㾱֯⭘࠶ਧDŽശᤜਧѝⲴ㓴ਸ䈝ਕˈণᖒ 㣡ᤜਧሩ ”{...}” ⭘Ҿᢺਈ䟿༠᰾઼䈝ਕ㓴ਸᡀањ༽ਸ䈝ਕ˄㓴ਸ䈝ਕ˅ᡆањ䈝ਕඇˈ䘉ṧ൘䈝 3.3.3 ഼ᤢਭѣⲺ㓺ਾ䈣ਛ ` 䘄എ∄䖳㔃᷌DŽUHWXUQBBUHV  VLGLF[ FRXQW FW F FV 6 ' BBUHV  D  㔃ᶏDŽˈQHJOHD[?Q੖ࡉ HD[ HD[ˈ䘄എ䍏٬ Ѣ  ᆇㅖˈࡉ䘄എ ˈ㔃ᶏDŽMOI?Q?Wྲ᷌ࡽ䶒∄䖳ѝѢ  ᆇㅖ ?WPRYOHD[?Q?WHD[ ѝ㖞 DŽ MPSI?Qੁࡽ䐣䖜ࡠḷਧ ˈ㔃ᶏDŽ DŽ˅?W[RUOHD[HD[?Q?Wᱟ 18// ᆇㅖˈࡉ HD[ ␵䴦˄䘄എ٬ MQHE?Qнᱟˈࡉੁਾ䐣䖜ࡠḷਧ ˈ㔗㔝∄䖳DŽ WHVWEDODO?Q?W䈕ᆇㅖᱟ 18// ᆇㅖੇ˛ MQHI?Q?Wྲ᷌н⴨ㅹˈࡉੁࡽ䐣䖜ࡠḷਧ DŽ >HGL@ˈᒦф HGLDŽVFDVE?Q?W∄䖳 DO оѢ  Ⲵᆇㅖ HV >HVL@ÎDOˈᒦф HVLDŽORGVE?Q?WਆѢ  Ⲵᆇㅖ GV ˈࡉੁࡽ䐣䖜ࡠḷਧ DŽMVI?Q?Wྲ᷌ FRXQW ?WGHFO?Q?WFRXQWDŽ FOG?Q␵ᯩੁսDŽ BBDVPBB BBUHV ᱟᇴᆈಘਈ䟿DŽUHJLVWHULQWBBUHV ^   䈝䀰〻ᒿ &  D  ^  D LQW LQOLQHLQWLQF ֻྲ޵Ṩ᮷Ԧ fs/inode.c ѝⲴྲл࠭ᮠ˖ 䭞䇽”LQOLQH”ˈޣᱟਚ֌ѪᲞ䙊࠭ᮠ䈳⭘ᶕ༴⨶DŽᢺањ࠭ᮠ༠᰾Ѫ޵㚄࠭ᮠⲴᯩ⌅ᱟ൘࠭ᮠ༠᰾ѝ֯⭘ ࡠ䈳⭘㘵ԓ⸱ѝˈ㘼ޕ⨶DŽ㤕㕆䈁䗷〻ѝ⋑ᴹ֯⭘Ոॆ䘹亩”2”ˈ䛓Ѹ޵㚄࠭ᮠⲴԓ⸱ቡнՊ㻛ⵏ↓ൠ፼ ༴ޕ䈳⭘㘵ԓ⸱ѝⲴ᫽֌ᱟа⿽Ոॆ᫽֌ˈഐ↔ਚᴹ䘋㹼Ոॆ㕆䈁ᰦ᡽Պᢗ㹼ԓ⸱፼ޕ޵㚄࠭ᮠ፼ Պ⸝аӋˈ䘉䴰㾱ṩᦞާփᛵߥᶕᇊDŽ ࠭ᮠᯩ⌅ሩ〻ᒿԓ⸱Ⲵ䮯ᓖᖡ૽ᒦн᰾ᱮDŽ֯⭘޵㚄࠭ᮠⲴ〻ᒿ㕆䈁ӗ⭏Ⲵⴞḷԓ⸱ਟ㜭Պ䮯аӋҏਟ㜭 䘋৫DŽ޵㚄ޕѸ൘㕆䈁ᵏ䰤 gcc ቡਟ㜭⭘ᆳᶕ䘋㹼аӋㆰॆ᫽֌ˈഐ↔ᒦ䶎ᡰᴹ޵㚄࠭ᮠⲴԓ⸱䜭Պ㻛፼ 䛓ˈњ࠭ᮠ༠᰾Ѫ޵㚄࠭ᮠⲴѫ㾱ⴞⲴቡᱟ㜭ཏቭ䟿ᘛ䙏Ⲵᢗ㹼࠭ᮠփDŽਖཆˈྲ᷌޵㚄࠭ᮠѝᴹᑨᮠ٬ 䘰ࠪᰦ䰤ᔰ䬰ˈӾ㘼㛟ᇊ㜭ཏ࣐ᘛᢗ㹼䙏ᓖDŽഐ↔ᢺа/ޕᮠⲴԓ⸱ѝ৫DŽ䘉ṧ༴⨶ਟԕ৫ᦹ࠭ᮠ䈳⭘ᰦ䘋 ൘〻ᒿѝˈ䙊䗷ᢺањ࠭ᮠ༠᰾Ѫ޵㚄˄LQOLQH˅࠭ᮠˈቡਟԕ䇙 gcc ᢺ࠭ᮠⲴԓ⸱䳶ᡀࡠ䈳⭘䈕࠭ 3.3.5 ޻㚊࠳ᮦ 䇱ᤷᇊⲴᇴᆈಘ㻛⭘֌䈕᫽֌ᮠDŽ؍Ⲵᱟ䈕ਈ䟿٬DŽ❦㘼ᢺ䈕ਈ䟿⭘֌Ѫ asm Ⲵ᫽֌ᮠ䘈ᱟ㜭ཏ 䇮䈕ᇴᆈಘ㛟ᇊᕅ⭘ٷ㕆ⲴᤷԔ䜘࠶ᴰྭн㾱᰾⺞ൠᕅ⭘䈕ᇴᆈಘᒦф≶ޕ൘ᤷᇊⲴᇴᆈಘѝDŽഐ↔൘፼ 䇱ᡰ㕆䈁ࠪⲴԓ⸱Պᢺਈ䟿аⴤ᭮؍䙄ˈ㘼фሩᆳⲴᕅ⭘ਟ㜭Պ㻛ࡐ䲔ǃ〫ࣘᡆ㻛ㆰॆDŽਖཆˈgcc ᒦн ަԆ⭘䙄DŽ൘〻ᒿ㕆䈁䗷〻ѝˈᖃ gcc ᮠᦞ⍱᧗ࡦ⺞ᇊਈ䟿Ⲵ٬ᐢ㓿н⭘ᰦቡਟ㜭ሶ䈕ᇴᆈಘ⍮֌ަԆ⭘ ⮉䘉њᇴᆈಘн⍮؍䘉䟼 ax ᱟਈ䟿 res ᡰᐼᵋ֯⭘ⲴᇴᆈಘDŽᇊѹ䘉ṧањᇴᆈಘਈ䟿ᒦнՊу䰘  D[ UHJLVWHULQWUHVBBDVPBB 䘋㹼䇘䇪DŽ൘ GNU C 〻ᒿѝᡁԜਟԕ൘࠭ᮠѝ⭘ྲлᖒᔿᇊѹањተ䜘ᇴᆈಘਈ䟿˖ ቡᖸᯩׯDŽ⭡Ҿ Linux ޵Ṩѝ䙊ᑨਚ֯⭘ተ䜘ᇴᆈಘਈ䟿ˈഐ↔䘉䟼ᡁԜਚሩተ䜘ᇴᆈಘਈ䟿Ⲵ֯⭘ᯩ⌅ 㕆䈝ਕѝᢺ≷㕆ᤷԔⲴ䗃ࠪⴤ᧕߉ࡠᤷᇊⲴᇴᆈಘѝˈ䛓Ѹ↔ᰦ֯⭘ተ䜘ᇴᆈಘਈ䟿≶ޕྲ᷌ᜣ൘፼ 䇽DŽ 䭞ޣ ҏਟ㜭㻛ࡐ䲔ǃ〫ࣘᡆㆰॆDŽഐ↔ˈ㤕нᜣ䇙 gcc ֌䘉ӋՈॆ᭩ࣘˈᴰྭ൘ asm 䈝ਕѝ࣐к volatile ᮠᦞ⍱࠶࣏᷀㜭䇔Ѫᆈۘ൘Ḁњተ䜘ᇴᆈಘਈ䟿٬ᰐ⭘ᰦቡਟ㜭Պࡐ䲔ѻˈᒦфሩተ䜘ᇴᆈಘਈ䟿Ⲵᕅ⭘ օᰦਟ⍮ަԆ⭘൪DŽᖃ gccˈ㕆䈁ಘⲴᮠᦞ⍱࠶࣏᷀㜭ᵜ䓛ᴹ㜭࣋⺞ᇊᤷᇊⲴᇴᆈಘօᰦਜ਼ᴹ↓൘֯⭘Ⲵ٬ ᡆ䗃ࠪ᫽֌ᮠᰦ֯⭘у䰘ⲴᇴᆈಘDŽgccޕ⮉ᤷᇊⲴᇴᆈಘˈ㘼ӵ൘޵፼ asm ≷㕆䈝ਕѝ֌Ѫ䗃؍ਈ䟿нՊ ተਈ䟿DŽ⴨৽ˈተ䜘ᇴᆈಘޘ⮉ᇴᆈಘу䰘⭘Ҿࠐњ؍ተᇴᆈಘਈ䟿Պ൘〻ᒿⲴᮤњ䘀㹼䗷〻ѝޘਈ䟿DŽ ተᇴᆈಘਈ䟿઼ተ䜘ᇴᆈಘޘ˖CPU ቡн⭘㓿ᑨ㣡䍩䖳䮯ᰦ䰤䇯䰞޵ᆈ৫ਆ٬DŽᇴᆈಘਈ䟿ਟԕ࠶Ѫ 2 ⿽ GNU ሩ C 䈝䀰Ⲵਖањᢙݵᱟݱ䇨ᡁԜᢺаӋਈ䟿٬᭮ࡠ CPU ᇴᆈಘѝˈণᡰ䉃ᇴᆈಘਈ䟿DŽ䘉ṧ 3.3.4 ᇺᆎಞ਎䠅  ` ?BY ? SRUW G BY  DLQEG[DO BBDVPBBYRODWLOH ?XQVLJQHGFKDUBY ^?  SRUW GHILQHLQE എ٬DŽ   䈝䀰〻ᒿ & FOG?Q␵ᯩੁսDŽ BBDVPBB ^  VUF GHVWFRQVWFKDU FKDU VWUFS\ H[WHUQLQOLQHFKDU GHVW DŽ VUF ˈHGL ৲ᮠ˖GHVWⴞⲴᆇㅖѢᤷ䪸ˈVUFⓀᆇㅖѢᤷ䪸DŽHVL DŽ→ڌGHVW ˈⴤࡠ䙷ࡠ 18// ᆇㅖਾ VUF ᤧ䍍ࡠਖаᆇㅖѢ ሶᆇㅖѢ OLEVWULQJVF ቡᱟ䘉⿽֯⭘ᯩᔿⲴањֻᆀDŽֻྲ VWULQJK ѝᇊѹҶྲл࠭ᮠ˖ 䛓ѸቡՊ֯⭘˄ᕅ⭘˅〻ᒿ᮷ԦѝᡆᓃѝⲴᤧ䍍DŽLinux 0.1x ޵ṨⓀԓ⸱ѝ᮷Ԧ LQFOXGHVWULQJKǃ DŽྲ᷌䘈ᴹ⋑ᴹ㻛ᴯᦒⲴሩ䈕࠭ᮠⲴ䈳⭘ˈޕ↔ᰦཤ᮷ԦѝⲴᇊѹՊ䇙㔍བྷཊᮠሩ䈕࠭ᮠⲴ䈳⭘㻛ᴯᦒ፼ 䭞䇽Ⲵਖањ⴨਼࠭ᮠᇊѹ᭮൘ањᓃ᮷ԦѝDŽޣ䭞䇽Ⲵањ࠭ᮠᇊѹ᭮൘.h ཤ᮷Ԧѝˈᒦфᢺнਜ਼ޣਸ 䭞䇽 LQOLQH ઼ H[WHUQ 㓴ਸ൘а䎧Ⲵ֌⭘ࠐѾ㊫਼ањᆿᇊѹDŽ֯⭘䘉⿽㓴ਸᯩᔿቡᱟᢺᑖᴹ㓴ޣ ֐ӵӵ༠᰾Ҷ࠭ᮠ㘼⋑ᴹᇊѹ࠭ᮠаṧDŽۿⲴањൠ൰Պਈᡀањཆ䜘ᕅ⭘ˈቡྭ ф൘ԫօᛵߥл䜭нՊঅ⤜ӗ⭏䈕࠭ᮠ㠚䓛Ⲵ≷㕆ԓ⸱ˈণ֯᰾⺞ᕅ⭘Ҷ䈕࠭ᮠⲴൠ൰ҏнՊӗ⭏DŽ䘉ṧ 䭞䇽ˈ䛓Ѹ䈕࠭ᮠᇊѹӵ⭘Ҿ޵㚄䳶ᡀˈᒦޣ ྲ᷌൘ᇊѹањ࠭ᮠᰦ਼ᰦᤷᇊҶ LQOLQH ઼ H[WHUQ 䭞䇽ⲴᇊѹDŽޣ 䭞䇽Ⲵ޵㚄࠭ᮠᇊѹㅹ਼Ҿ䘉䟼֯⭘ staticޣ 䶒ˈISO ḷ߶ C99 ሩн֯⭘ static ࠭ᮠⲴ䈳⭘ቡн㜭㻛ᴯᦒ䳶ᡀDŽഐ↔ˈањ䶎䶉ᘱⲴ޵㚄࠭ᮠᙫᱟՊ㻛㕆䈁ࠪ㠚ᐡⲴ≷㕆ԓ⸱ᶕDŽ൘䘉ᯩ ተㅖਧਚ㜭㻛ᇊѹа⅑ˈᡰԕ䈕࠭ᮠቡн㜭޽൘ަԆⓀ᮷Ԧѝ䘋㹼ᇊѹDŽഐ↔䘉䟼ሩ޵㚄ޘ⭘DŽഐѪањ 䇮ަԆ〻ᒿ᮷Ԧѝҏሩ䘉њ࠭ᮠᴹ䈳ٷ䭞䇽 VWDWLFˈ䛓Ѹ gcc ቡՊޣ㤕ањ޵㚄࠭ᮠⲴᇊѹ⋑ᴹ֯⭘ ᶕᤷᇊDŽѹˈ൘ᐼᵋӽ❦֯⭘䘉䟼ᇊѹⲴ䈝ѹᰦˈቡ䴰㾱֯⭘䘹亩 VWG JQX 䗷ѪҶެᇩ䎧㿱ˈ൘䘉⿽ᛵߥл䘈ᱟᴰྭ֯⭘ inline ઼ static 㓴ਸDŽԕਾ gcc ሶᴰ㓸唈䇔֯⭘ C99 Ⲵᇊ DŽн䭞䇽 VWDWLFDŽ㤕൘〻ᒿѝ䴰㾱֯⭘ C99 ḷ߶Ⲵ䈝ѹˈ䛓Ѹቡ䴰㾱֯⭘㕆䈁䘹亩 VWG JQXޣ⮕āҶ 䭞䇽 LQOLQH ઼ VWDWLF ⲴᇊѹˈণĀⴱޣབྷ४࡛DŽISO ḷ߶ C99 Ⲵ޵㚄࠭ᮠ䈝ѹᇊѹㅹ਼Ҿ䘉䟼֯⭘㓴ਸ 䈧⌘᜿ˈ޵㚄࠭ᮠ࣏㜭ᐢ㓿㻛वᤜ൘ ISO ḷ߶ C99 ѝˈնᱟ䈕ḷ߶ᇊѹⲴ޵㚄࠭ᮠо gcc ᇊѹⲴᴹ䖳 `  VWL  LQRGH!LBZDLW VOHHSBRQ  LQRGH!LBORFN ZKLOH  FOL ^  LQRGH VWUXFWPBLQRGH VWDWLFLQOLQHYRLGZDLWBRQBLQRGH Պ䊑ᒣᑨаṧ㻛㕆䈁ᡀ≷㕆ԓ⸱DŽഐѪሩ޵㚄࠭ᮠൠ൰Ⲵᕅ⭘ᱟн㜭㻛ᴯᦒⲴDŽ ࠭ᮠቡՊ䊑ᒣᑨаṧ㻛㕆䈁ᡀ≷㕆ԓ⸱DŽᖃ❦ˈྲ᷌〻ᒿѝᴹᕅ⭘޵㚄࠭ᮠൠ൰Ⲵ䈝ਕˈ䛓Ѹ޵㚄࠭ᮠҏ ᱟнՊ㻛ᴯᦒ䳶ᡀⲴˈᒦфҏ䜭н㜭ᱟ䙂ᖂᇊѹⲴ࠭ᮠDŽྲ᷌ᆈ൘ањн㜭㻛ᴯᦒ䳶ᡀⲴ䈳⭘ˈ䛓Ѹ޵㚄 ⭡ҾḀӋ৏ഐˈаӋሩ޵㚄࠭ᮠⲴ䈳⭘ᒦн㜭㻛䳶ᡀࡠ࠭ᮠѝ৫DŽ⢩࡛ᱟ൘޵㚄࠭ᮠᇊѹѻࡽⲴ䈳⭘䈝ਕ 䈁䗷〻ѝ֯⭘䘹亩 INHHSLQOLQHIXQFWLRQVˈ੖ࡉ gcc ቡнՊ޽Ѫ䈕޵㚄࠭ᮠ㠚䓛⭏ᡀᇎ䱵≷㕆ԓ⸱DŽ ᕅ⭘䗷䈕޵㚄࠭ᮠⲴൠ൰ˈࡉ䈕޵㚄࠭ᮠ㠚䓛Ⲵ≷㕆ԓ⸱ቡнՊ㻛ᕅ⭘䗷DŽ൘䘉⿽ᛵߥлˈ䲔䶎ᡁԜ൘㕆 ޵㚄࠭ᮠᇊѹаṧˈ䛓Ѹྲ᷌ᡰᴹሩ䈕޵㚄࠭ᮠⲴ䈳⭘䜭㻛ᴯᦒ㘼䳶ᡀ൘䈳⭘㘵ԓ⸱ѝˈᒦф〻ᒿѝ⋑ᴹ л䶒᮷Ԧ IVLQRGHF ѝⲴۿ䭞䇽ˈণޣ 䭞䇽ǃ৸֯⭘ VWDWLFޣ ᖃ൘ањ࠭ᮠᇊѹѝᰒ֯⭘ LQOLQH Ⲵ৏ഐDŽ 㕆䈁ᰦਟԕ֯⭘䘹亩 :LQOLQH䇙 gcc ሩḷᘇᡀ LQOLQH նн㜭㻛ᴯᦒⲴ࠭ᮠ㔉ࠪ䆖੺ؑ᚟ԕ৺н㜭ᴯᦒ ྲ֯⭘Ҷਟਈ৲ᮠǃ޵ᆈ࠶䝽࠭ᮠ malloca()ǃਟਈ䮯ᓖᮠᦞ㊫රਈ䟿ǃ䶎ተ䜘 goto 䈝ਕǃԕ৺䙂ᖂ࠭ᮠDŽ ࠭ᮠѝⲴḀӋ䈝ਕ⭘⌅ਟ㜭Պ֯ᗇ޵㚄࠭ᮠⲴᴯᦒ᫽֌ᰐ⌅↓ᑨ䘋㹼ˈᡆ㘵н䘲ਸ䘋㹼ᴯᦒ᫽֌DŽֻ `   䈝䀰〻ᒿ & ࠶䝽оഎ᭦ࡉ䙊䗷Ḹ᫽֌ᶕᇎ⧠DŽ ᰦ᭦എ䘉䜘࠶オ䰤DŽIntel 80x86 CPU Ѫ᧗ࡦՐ䙂ᨀ׋ҶㆰঅⲴᤷԔˈ㘼ᮠᦞⲴՐ䙂઼ተ䜘ਈ䟿ᆈۘオ䰤Ⲵ ࠭ᮠᰦѪ࠭ᮠⲴተ䜘ਈ䟿࠶䝽ᆈۘオ䰤ˈᒦф൘䘰ࠪ࠭ᮠޕ৲ᮠ઼䘄എ٬ᶕ䘋㹼DŽਖཆˈᡁԜ䘈䴰㾱൘䘋 ࠭ᮠ䈳⭘᫽֌वᤜӾаඇԓ⸱ࡠਖаඇԓ⸱ѻ䰤ⲴৼੁᮠᦞՐ䙂઼ᢗ㹼᧗ࡦ䖜〫DŽᮠᦞՐ䙂䙊䗷࠭ᮠ ᯩ⌅DŽ Ⲵ˛䘉䟼ᡁԜ俆ݸ᧿䘠ал C ࠭ᮠⲴ䈳⭘ᵪࡦǃ᧗ࡦᵳՐ䙂ᯩᔿˈ❦ਾ䈤᰾ KHDGV 〻ᒿ䐣䖜ࡠ C 〻ᒿⲴ Ѹ KHDGV 〻ᒿᱟྲօᢺᢗ㹼᧗ࡦ䖜Ӕ㔉 LQLWPDLQF 〻ᒿⲴ઒˛ণ≷㕆〻ᒿᱟྲօ䈳⭘ᢗ㹼 C 䈝䀰〻ᒿ ൘ Linux ޵Ṩ〻ᒿ ERRWKHDGV ᢗ㹼ᆼสᵜࡍ࿻ॆ᫽֌ѻਾˈቡՊ䐣䖜৫ᢗ㹼 LQLWPDLQF 〻ᒿDŽ䛓 3.4.1 C ࠳ᮦ䈹⭞ᵰ࡬ Ⲵ䈳⭘ᯩ⌅DŽ ࡦⲴ〻ᒿѻ䰤Ⲵ⴨ӂ䈳⭘䰞仈DŽᵜ㢲俆ݸ䈤᰾ C 䈝䀰࠭ᮠⲴ䈳⭘ᵪࡦˈ❦ਾ֯⭘⽪ֻᶕ䈤᰾є㘵࠭ᮠѻ䰤 ѪҶᨀ儈ԓ⸱ᢗ㹼᭸⦷ˈ޵ṨⓀԓ⸱ѝᴹൠᯩⴤ᧕֯⭘Ҷ≷㕆䈝䀰㕆ࡦDŽ䘉ቡՊ⎹৺ࡠ൘є⿽䈝䀰㕆 3.4 C ф≽㕌ぁᓅⲺ⴮ӈ䈹⭞ ` 䘄എⴞⲴᆇㅖѢᤷ䪸DŽUHWXUQGHVW  VLGLD[ GHVW VUF ' 6 MQHEнᱟࡉੁਾ䐣䖜ࡠḷਧ  ༴ˈ੖ࡉ㔃ᶏDŽ WHVWEDODO?Q?WࡊᆈۘⲴᆇ㢲ᱟ ˛ >HGL@ˈᒦᴤᯠ HGLDŽVWRVE?Q?Wᆈۘᆇ㢲 DOÎ(6 >HVL@༴  ᆇ㢲ÎDOˈᒦᴤᯠ HVLDŽ?WORGVE?Q?W࣐䖭 '6 FOG?Q␵ᯩੁսDŽ BBDVPBB ^ 䭞䇽LQOLQH઼H[WHUQDŽޣVUF ৫ᦹҶ GHVWFRQVWFKDU FKDU VWUFS\ FKDU ↔ᰦᓃ࠭ᮠѝ䟽ᯠᇊѹⲴк䘠 strcpy()࠭ᮠਈᡀྲлᖒᔿ˖  VWULQJK!LQFOXGH GHILQHBB/,%5$5HGL@ˈᒦᴤᯠ HGLDŽVWRVE?Q?Wᆈۘᆇ㢲 DOÎ(6 >HVL@༴  ᆇ㢲ÎDOˈᒦᴤᯠ HVLDŽ?WORGVE?Q?W࣐䖭 '6   о≷㕆〻ᒿⲴ⴨ӂ䈳⭘ & ੁ ᯩ བྷ ໎ ൰ ൠ Ḹᤷ䪸 HVS ᑗᤷ䪸 HES ࡽ䶒ⲴḸᑗ 䜘ਈ䟿ԕ৺Ѥᰦ٬ ᆈⲴᇴᆈಘǃተ؍  ᆈⲴ HES؍ 䘄എൠ൰  ৲ᮠ  ৲ᮠ ৲ᮠ Q ৲ᮠᔪ・४ฏ 䈳⭘ަᆳ࠭ᮠᰦ Ḹ亦 䈳⭘㘵ⲴḸᑗ 㻛䈳⭘㘵ⲴḸᑗ ᖃࡽḸᑗ HES HES  Q HES HES HES ᆈⲴ䘄എൠ൰DŽ؍ᤷԔѻࡽˈᓄ䈕ݸ↓⺞༴⨶Ḹѝ޵ᇩˈ֯ᗇᖃࡽḸᤷ䪸ᡰᤷս㖞޵ᇩ↓ᱟݸࡽ CALL ᤷԔ 䈳࠭ᮠ䘄എᰦቡՊӾ䈕ս㖞㔗㔝ᢗ㹼DŽ䘄എᤷԔ RET ⭘ҾᕩࠪḸ亦༴Ⲵൠ൰ᒦ䐣䖜ࡠ䈕ൠ൰༴DŽ൘֯⭘䈕 ф䐣䖜ࡠ㻛䈳⭘࠭ᮠᔰ࿻༴ᢗ㹼DŽ䘄എൠ൰ᱟ〻ᒿѝ㍗䲿䈳⭘ᤷԔ CALL ਾ䶒аᶑᤷԔⲴൠ൰DŽഐ↔ᖃ㻛 ḸѝᒦޕᤷԔ CALL ઼ RET ⭘Ҿ༴⨶࠭ᮠ䈳⭘઼䘄എ᫽֌DŽ䈳⭘ᤷԔ CALL Ⲵ֌⭘ᱟᢺ䘄എൠ൰঻ ࡠDŽ㊫լൠˈ䙊䗷໎࣐Ḹᤷ䪸٬ᡁԜਟԕഎ᭦Ḹѝᐢ࠶䝽Ⲵオ䰤DŽڊ߿䘲ᖃⲴ٬ᶕ ḸѝᡆӾḸѝᕩࠪDŽሩҾ⋑ᴹᤷᇊࡍ࿻٬Ⲵᮠᦞᡰ䴰㾱Ⲵᆈۘオ䰤ˈᡁԜਟԕ䙊䗷ᢺḸᤷ䪸䙂ޕᢺᮠᦞ঻ Ḹᱟᖰվ˄ሿ˅ൠ൰ᯩੁᢙኅⲴˈ㘼 esp ᤷੁᖃࡽḸ亦༴Ⲵݳ㍐DŽ䙊䗷֯⭘ push ઼ pop ᤷԔᡁԜਟԕ ᆈ䈳⭘ԫօަᆳ࠭ᮠⲴ৲ᮠDŽ؍䟿Ⲵൠ൰ᤷ䪸࠶䝽аオ䰤DŽᴰਾˈB ࠭ᮠՊ֯⭘Ḹᶕ 䘈ᴹቡᱟ C 䈝䀰Ⲵൠ൰᫽֌ㅖ'&'㻛ᓄ⭘ࡠањተ䜘ਈ䟿кᰦˈᡁԜቡ䴰㾱Ѫ䈕ਈ䟿⭏ᡀањൠ൰ˈণѪਈ н㜭ཏᆈ᭮࠭ᮠⲴᡰᴹተ䜘ᮠᦞˈᡆ㘵ᴹӋተ䜘ਈ䟿ᱟᮠ㓴ᡆ㔃ᶴˈഐ↔ᗵ享֯⭘ᮠ㓴ᡆ㔃ᶴᕅ⭘ᶕ䇯䰞DŽ ᆈн㜭᭮൘ᇴᆈಘѝⲴተ䜘ਈ䟿٬DŽֻྲ⭡Ҿ䙊ᑨ CPU Ⲵᇴᆈಘᮠ䟿ᴹ䲀㘼؍ B࠭ᮠ਼ṧҏ֯⭘Ḹᶕ ᆈಘ٬ԕ৺࠭ᮠⲴѤᰦ٬DŽ ᆈⲴᇴ؍ᆈᑗᤷ䪸˄ebp˅Ⲵൠᯩᔰ࿻DŽ޽䲿ਾࡉ⭘Ҿᆈ᭮ԫօ؍ⲴḸᑗࡉӾ䲿ਾⲴḸ䜘࠶ᔰ࿻ˈণമѝ ḸѝˈḸѝ䈕ս㖞ҏ᰾⺞ᤷ᰾Ҷ A ḸᑗⲴ㔃ᶏ༴DŽ㘼 Bޕൠ൰˄䈳⭘䘄എਾ㔗㔝ᢗ㹼ⲴᤷԔൠ൰˅㻛঻ ሩҾ࠭ᮠ A 䈳⭘࠭ᮠ B ⲴᛵߥˈՐ䙂㔉 B Ⲵ৲ᮠवਜ਼൘ A ⲴḸᑗѝDŽᖃ A 䈳⭘ B ᰦˈ࠭ᮠ A Ⲵ䘄എ ഴ Ḿѣᑝ㔉ᶺ⽰ᝅഴ  Ḹ઼ࠪḸ㘼〫ࣘˈഐ↔࠭ᮠѝሩབྷ䜘࠶ᮠᦞⲴ䇯䰞䜭สҾᑗᤷ䪸 ebp 䘋㹼DŽޕᦞⲴ ֌ᑗᤷ䪸˄frame pointer˅ˈ㘼 esp ࡉ⭘֌Ḹᤷ䪸˄stack pointer˅DŽ൘࠭ᮠᢗ㹼䗷〻ѝˈḸᤷ䪸 esp Պ䲿⵰ᮠ ˄Stack frame˅㔃ᶴˈަ䙊ᑨ㔃ᶴ㿱മ 3-4 ᡰ⽪DŽḸᑗ㔃ᶴⲴєㄟ⭡єњᤷ䪸ᶕᤷᇊDŽᇴᆈಘ ebp 䙊ᑨ⭘ ᆈᇴᆈಘ৏ᴹ٬ԕ༷ᚒ༽ԕ৺⭘ᶕᆈۘተ䜘ᮠᦞDŽঅњ࠭ᮠ䈳⭘᫽֌ᡰ֯⭘ⲴḸ䜘࠶㻛〠ѪḸᑗ؍ᰦ བྷཊᮠ CPU кⲴ〻ᒿᇎ⧠֯⭘Ḹᶕ᭟ᤱ࠭ᮠ䈳⭘᫽֌DŽḸ㻛⭘ᶕՐ䙂࠭ᮠ৲ᮠǃᆈۘ䘄എؑ᚟ǃѤ 3.4.1.1 Ḿᑝ㔉ᶺૂ᧝࡬䖢〱ᵹᯯᕅ   о≷㕆〻ᒿⲴ⴨ӂ䈳⭘ & ᆈ൘Ḹѝ㘼䶎ㆰঅൠᆈ᭮൘ᇴᆈಘѝDŽ؍ᡁԜ䴰㾱Ѫ䘉єњተ䜘ਈ䟿⭏ᡀൠ൰ˈഐ↔ᆳԜᗵ享 ༴DŽ⭡Ҿ〫ٿ ⲴḸᑗ㔃ᶴѝवᤜተ䜘ਈ䟿 a ઼ b Ⲵᆈۘオ䰤ˈ⴨ሩҾᑗᤷ䪸սҾ-4 ઼-8 䈳⭘㘵 PDLQ DŽ [))))))) Պ㻛㺘⽪ᡀ  ˈ [)))))))& ⽪ᡀ 㻛㺘  ٬DŽ൘䊑 gdb 䘉ṧⲴ䈳䈅ಘѝˈ䘉Ӌᮠ٬䜭⭘ 2 Ⲵ㺕⸱㺘⽪DŽֻྲ〫ٿࠪҶ⴨ሩҾᑗᤷ䪸Ⲵൠ൰ ˅ⲴḸᑗѝ㧧ਆަ৲ᮠDŽമѝⲴս㖞ؑ᚟⴨ሩҾᇴᆈಘ ebp ѝⲴᑗᤷ䪸DŽḸᑗᐖ䗩Ⲵᮠᆇᤷ ⭘㘵˄PDLQ Ӿ䈳 ѻਾ䘄എӔᦒਾⲴ㔃᷌DŽ䘉єњ࠭ᮠⲴḸᑗ㔃ᶴ㿱മ 3-5 ᡰ⽪DŽਟԕⴻࠪˈ࠭ᮠ VZDS 䈳⭘Ҷ VZDS ҏᱟањ࠭ᮠ˄ሶ൘л䶒䈤᰾˅ˈᆳ൘ ⭘ҾӔᦒєњਈ䟿Ⲵ٬DŽC 〻ᒿѝⲴѫ〻ᒿ PDLQ ަѝ࠭ᮠ VZDS `  DE UHWXUQ  E D VZDS  E D LQWDE ^  LQWPDLQ  ` E F E  D D  F LQWF ^  E DLQW LQW YRLGVZDS ᒦ䘄എᆳԜⲴᐞ٬DŽ ˈ֌ѪањֻᆀˈᡁԜᶕ㿲ሏл䶒 C 〻ᒿ H[FKF ѝ࠭ᮠ䈳⭘Ⲵ༴⨶䗷〻DŽ䈕〻ᒿӔᦒєњਈ䟿ѝⲴ٬ 3.4.1.2 ࠳ᮦ䈹⭞Ѵׁ Ⲵ٬DŽ䘈ᴹᇴᆈಘ ebp ઼ esp ҏᗵ享䚥ᆸㅜҼњᜟֻ⭘⌅DŽ ᆈ䘉Ӌᇴᆈಘ޵ᇩˈնਟ㜭൘ԕਾⲴ᫽֌ѝ䘈䴰㾱⭘ࡠ৏ݸ؍⭘㘵 A˄ᡆ㘵аӋᴤ儈ቲⲴ࠭ᮠ˅ᒦн䍏䍓 ᆈަ޵ᇩˈᒦ൘䘰ࠪᰦᚒ༽䘉ӋᇴᆈಘⲴ޵ᇩDŽഐѪ䈳؍⭘䘉ӋᇴᆈಘѝⲴԫ᜿ањᰦˈᗵ享俆ݸ൘Ḹѝ ᣔDŽᖃ㻛䈳⭘㘵䴰㾱֯؍ᡰ䴰㾱ⲴԫօᮠᦞDŽਖཆˈᇴᆈಘ ebxǃesi ઼ edi Ⲵ޵ᇩࡉᗵ享⭡㻛䈳⭘㘵 B ᶕ ᆈ䘉Ӌᇴᆈಘ޵ᇩⲴᛵߥлԫ᜿֯⭘ᆳԜ㘼нՊ⇱ൿ࠭ᮠ A؍ᖃ࠭ᮠ B 㻛 A 䈳⭘ᰦˈ࠭ᮠ B ਟԕ൘н⭘ ᆈDŽ؍ᗵ享䚥ᆸⲴᇴᆈಘ⭘⌅㔏аᜟֻDŽ䈕ᜟֻᤷ᰾ˈᇴᆈಘ eaxǃedx ઼ ecx Ⲵ޵ᇩᗵ享⭡䈳⭘㘵㠚ᐡ䍏䍓 ⭘㘵˅ᰦˈ㻛䈳⭘㘵нՊ؞᭩ᡆ㾶ⴆᦹ䈳⭘㘵Ӻਾ㾱⭘ࡠⲴᇴᆈಘ޵ᇩDŽഐ↔ Intel CPU 䟷⭘Ҷᡰᴹ࠭ᮠ ቭ㇑Ḁаᰦ࡫ਚᴹањ࠭ᮠ൘ᢗ㹼ˈնᡁԜ䘈ᱟ䴰㾱⺞ᇊ൘ањ࠭ᮠ˄䈳⭘㘵˅䈳⭘ަԆ࠭ᮠ˄㻛䈳 ਖཆˈ㤕䘄എ٬ᱟањᮤᮠᡆањᤷ䪸ˈ䛓Ѹᇴᆈಘ eax ሶ㻛唈䇔⭘ᶕՐ䙂䘄എ٬DŽ   о≷㕆〻ᒿⲴ⴨ӂ䈳⭘ & ᑗᤷ䪸 HES Ḹᤷ䪸 HVS Ḹᑗ PDLQ Ⲵ VZDS ⲴḸᑗ VZDS ਾ൘䈳⭘ VZDS ѻࡽ ޕ䘋 F ᆈⲴ HES؍ 䘄എൠ൰      D D E E ᆈⲴ HES؍     Ḹᤷ䪸 HVS ᑗᤷ䪸 HES D D E E ᆈⲴ HES؍  UHW ˅DŽSRSOHESণ PRYOHESHVS˄٬ OHDYHᚒ༽৏ HESǃHVS HES HD[ VXEO ߿৫ㅜ  њਈ䟿 E Ⲵ٬DŽˈHES HD[ਆㅜ  њተ䜘ਈ䟿 D Ⲵ٬ PRYO  DŽ FDOOBVZDS䈳⭘࠭ᮠ VZDS SXVKOHD[ ḸDŽޕHES HD[޽ਆተ䜘ਈ䟿 D Ⲵൠ൰ˈ֌Ѫㅜ  њ৲ᮠ OHDO ㅜ  њ৲ᮠDŽޕḸѝDŽণݸ঻ޕSXVKOHD[֌Ѫ䈳⭘Ⲵ৲ᮠᒦ঻  ࠭ᮠ֌߶༷ˈਆተ䜘ਈ䟿 E Ⲵൠ൰ˈ HES HD[Ѫ䈳⭘ VZDS OHDO  HES PRYO D ˈE ˅DŽ˄HES Ѫተ䜘ਈ䟿䍻ࡍ٬ PRYO VXEOHVSѪᮤරተ䜘ਈ䟿 D ઼ E ൘Ḹѝ࠶䝽オ䰤DŽ PRYOHVSHES 䇮㖞ᖃࡽ࠭ᮠⲴᑗᤷ䪸DŽˈ٬ ᆈ৏ HES؍SXVKOHES BPDLQ UHW ˅DŽSRSOHESণ PRYOHESHVS˄٬ OHDYHᚒ༽৏ HESǃHVS  HD[ PRYOHF[ HES HF[❦ਾᢺተ䜘ਈ䟿 F ѝⲴ޵ᇩ᭮ࡠ䘉њᤷ䪸ᡰᤷս㖞༴DŽ PRYO HES HD[޽⅑ਆㅜ  њ৲ᮠDŽ PRYO  HD[ PRYOHF[ HG[ HF[ᢺㅜ  њ৲ᮠᡰᤷ޵ᇩ᭮ࡠㅜ  њ৲ᮠᡰᤷⲴս㖞DŽ PRYO HES HG[ PRYO HES HD[޽⅑ਆㅜ  њ৲ᮠˈ❦ਾਆㅜ  њ৲ᮠDŽ PRYO  HES PRYOHF[ ᆈࡠተ䜘ਈ䟿 F ѝDŽ؍HD[ HF[ਆ䈕ᤷ䪸ᡰᤷս㖞Ⲵ޵ᇩˈᒦ PRYO HES HD[ਆ࠭ᮠㅜ  њ৲ᮠˈ䈕৲ᮠᱟањᮤᮠ㊫ර٬Ⲵᤷ䪸DŽ PRYO VXEOHVSѪተ䜘ਈ䟿 F ൘Ḹ޵࠶䝽オ䰤DŽ PRYOHVSHES 䇮㖞ᖃࡽ࠭ᮠⲴᑗᤷ䪸DŽˈ٬ ᆈ৏ HES؍SXVKOHES BVZDS WH[W Ⲵ՚ᤷԔ˅DŽޣлᡰ⽪˄ࡐ䲔Ҷࠐ㹼о䇘䇪ᰐ ֯⭘ભԔĀJFF:DOO6RH[FKVH[FKFāਟԕ⭏ᡀ䈕 C 䈝䀰〻ᒿⲴ≷㕆〻ᒿ H[FKV ԓ⸱ˈ㿱ྲ ഴ 䈹⭞࠳ᮦ PDLQ ૂ VZDS ⲺḾᑝ㔉ᶺ    о≷㕆〻ᒿⲴ⴨ӂ䈳⭘ & ˖൘㕆䈁ᰦ֯⭘ᱮ⽪䈖㓶ؑ᚟䘹亩'-v'ቡਟԕ᰾ᱮൠⴻࠪ䘉њ䬮᧕᫽֌䗷〻 䙊ᑨ֯⭘ gcc 㕆䈁䬮᧕⭏ᡀᢗ㹼᮷Ԧᰦˈgcc Պ㠚ࣘᢺ䈕᮷ԦⲴԓ⸱֌Ѫㅜањ⁑ඇ䬮᧕൘ਟᢗ㹼〻ᒿѝDŽ ORQJ ᇊѹਈ䟿BHQYLURQˈѪަ࠶䝽ањ䮯ᆇオ䰤DŽBHQYLURQ GDWD  DŽ MPSE᧗ࡦᓄ䈕нՊࡠ䗮䘉䟼DŽ㤕ࡠ䗮䘉䟼ࡉ㔗㔝ᢗ㹼 H[LW FDOOBH[LW  ࠭ᮠⲴ৲ᮠᒦ䈳⭘䈕࠭ᮠDŽ 䘄എ٬֌Ѫ H[LWޕSXVKOHD[঻ FDOOBPDLQ䈳⭘ᡁԜⲴѫ〻ᒿDŽަ䘄എ⣦ᘱ٬൘ HD[ ᇴᆈಘѝDŽ  ࠭ᮠ൘࣐䖭ᢗ㹼᮷Ԧᰦ䇮㖞ⲴDŽ PRYOHD[BHQYLURQHQYS ᱟ H[HFYH ᆈ൘BHQYLURQ ѝDŽ؍HVS HD[ਆ〻ᒿⲴ⧟ຳਈ䟿ᤷ䪸 HQYS ᒦ PRYO ਓḷਧDŽޕԓ⸱BBHQWU\  ተਈ䟿BHQYLURQ˄ሩᓄ & 〻ᒿѝⲴ HQYLURQ ਈ䟿˅DŽޘJOREOBHQYLURQ༠᰾ WH[W ተਈ䟿_environ ׋〻ᒿѝަᆳ⁑ඇ֯⭘DŽޘ〻ᒿ㿱ྲлᡰ⽪DŽަѝᔪ・ᒦࡍ࿻ॆ ተਈ䟿ㅹDŽLinux 0.11 ѝ crt0.s ≷㕆ޘሶ㻛䬮᧕൘⇿њ⭘ᡧᢗ㹼〻ᒿⲴᔰ࿻䜘࠶ˈѫ㾱⭘Ҿ䇮㖞аӋࡍ࿻ॆ ࠭ᮠ㻛䈳⭘DŽcrt0.s ᱟањẙ˄stub˅〻ᒿˈ਽〠ѝⲴĀcrtāᱟĀC run-timeāⲴ㕙߉DŽ䈕〻ᒿⲴⴞḷ᮷Ԧ ཆˈк䶒ᨀࡠ C 〻ᒿⲴѫ〻ᒿ main()ҏᱟањ࠭ᮠDŽ䘉ᱟഐѪ൘㕆䈁䬮᧕ᰦᆳሶՊ֌Ѫ crt0.s ≷㕆〻ᒿⲴ 䭞ԓ⸱䴰㾱ⴤ᧕֯⭘≷㕆䈝䀰㕆ࡦⲴ৏ഐѻаDŽਖޣ䈁ಘ䘈н㜭ӗ⭏ᴰ儈᭸⦷Ⲵԓ⸱ˈ䘉ҏᱟѪӰѸḀӋ к䶒䘉⇥≷㕆〻ᒿᱟ֯⭘ gcc 1.40 㕆䈁ӗ⭏Ⲵˈਟԕⴻࠪަѝᴹࠐ㹼ཊ։Ⲵԓ⸱DŽਟ㿱ᖃᰦⲴ gcc 㕆 3.4.1.3 main()ҕᱥжѠ࠳ᮦ Ր䙂ਈ䟿Ⲵᤷ䪸˄ণਈ䟿Ⲵൠ൰˅DŽ 䀰ˈ⋑ᴹⴤ᧕Ⲵᯩ⌅ਟ⭘ᶕ൘㻛䈳⭘࠭ᮠѝ؞᭩䈳⭘㘵ਈ䟿Ⲵ٬DŽഐ↔ѪҶ䗮ࡠ؞᭩ⲴⴞⲴቡ䴰㾱ੁ࠭ᮠ ণ C 䈝䀰ᱟՐ٬㊫䈝ˈӾԕк࠶᷀ਟ⸕ˈC 䈝䀰൘䈳⭘࠭ᮠᰦᱟ൘ึḸкѤᰦᆈ᭮㻛䈳࠭ᮠ৲ᮠⲴ٬ ߿ˈᒦ᭮൘ eax ᇴᆈಘѝ֌Ѫ䘄എ٬DŽ ḸѝⲴDŽㅜ 29--30 є㹼ሶєњᐢ㓿Ӕᦒ䗷Ⲵᮠᆇ⴨ޕㅜ 1 њ৲ᮠࡉᱟᴰਾањ൘䈳⭘࠭ᮠᤷԔ call ѻࡽ঻ Ḹѝˈ㘼࠭ᮠⲴޕḸѝⲴ亪ᒿ↓ྭо࠭ᮠ⭣᰾Ⲵ৲ᮠ亪ᒿ⴨৽DŽণ࠭ᮠᴰਾањ৲ᮠ俆ݸ঻ޕਈ䟿ൠ൰঻ Ḹѝˈ❦ਾ䈳⭘ swap()࠭ᮠDŽޕⲴDŽަѝ俆ݸ֯⭘ leal ᤷԔ˄ਆᴹ᭸ൠ൰˅㧧ᗇਈ䟿 b ઼ a Ⲵൠ൰ᒦ࠶࡛঻ ѝ࠶䝽Ҷオ䰤DŽㅜ 22--23 㹼Ѫ䘉єњተ䜘ਈ䟿䍻٬DŽӾ 24-28 㹼ਟԕⴻࠪ main()ѝᱟྲօ䈳⭘ swap()࠭ᮠ ᆈ઼䟽ᯠ䇮㖞ᑗᤷ䪸ѻਾˈmain()Ѫተ䜘ਈ䟿 a ઼ b ൘Ḹ؍ㅜ 19--21 㹼ᱟ main()࠭ᮠⲴ䇮㖞䜘࠶ˈ൘ ᒦᢗ㹼䘄എᤷԔ retDŽˈswap()࠭ᮠᰦᇴᆈಘ esp ઼ ebp Ⲵ৏ᴹ٬ ޕ䘉䜘࠶ԓ⸱ᚒ༽Ҷ൘䘋 䙊ᑨᱟ䈳⭘㘵Ⲵᑗᤷ䪸˅DŽ˄SRSOHESᚒ༽৏ HES Ⲵ٬ ᤷੁḸᑗᔰ࿻༴˅DŽ˄PRYOHESHVSᚒ༽৏ HVS Ⲵ٬ എˈᆳⲴ֌⭘ㅹԧҾл䶒єњᤷԔ˖ ٬ᆈ᭮ࡠㅜ 2 њ৲ᮠᤷᇊⲴൠ൰༴DŽᴰਾ 16--17 㹼ᱟ࠭ᮠ㔃ᶏ䜘࠶DŽleave ᤷԔ⭘Ҿ༴⨶Ḹ޵ᇩԕ߶༷䘄 ᆈ൘Ѥᰦተ䜘ਈ䟿 c ѝⲴ؍ᒦԕ䈕৲ᮠ٬֌Ѫൠ൰ਆަ޵ᇩ᭮ࡠㅜ 1 њ৲ᮠᤷᇊⲴൠ൰༴DŽㅜ 13--15 㹼ᢺ HES ˅DŽㅜ 9--12 㹼⭘Ҿਆㅜ 2 њ৲ᮠ&bˈ ᆈࡠѪተ䜘ਈ䟿࠶䝽Ⲵオ䰤ѝ˄؍޵ᇩࡠ ecx ᇴᆈಘѝˈ❦ਾ 㹼 6--15 ᱟ swap ࠭ᮠⲴѫփ䜘࠶DŽㅜ 6--8 㹼⭘Ҿਆ䈳⭘㘵Ⲵㅜ 1 њ৲ᮠ&aˈᒦԕ䈕৲ᮠ֌Ѫൠ൰ਆᡰᆈ ᆈ䈳⭘㘵Ⲵᑗᤷ䪸઼䇮㖞ᵜ࠭ᮠⲴḸᑗᤷ䪸ˈㅜ 5 㹼䙊䗷ᢺḸᤷ䪸 esp л〫 4 ᆇ㢲Ѫተ䜘ਈ䟿 c ࠶䝽オ䰤DŽ ؍ ࠭ᮠˈަ䇮㖞䜘࠶ԓ⸱ᱟ 3--5 㹼DŽࡽє㹼⭘ᶕ䇮㖞 Ā㔃ᶏāˈᚒ༽Ḹ⣦ᘱᒦӾ࠭ᮠѝ䘄എDŽሩҾ VZDS 䘉єњ࠭ᮠ൷ਟԕࡂ࠶ᡀйњ䜘࠶˖Ā䇮㖞āˈࡍ࿻ॆḸᑗ㔃ᶴ˗Āѫփāˈᢗ㹼࠭ᮠⲴᇎ䱵䇑㇇᫽֌˗   о≷㕆〻ᒿⲴ⴨ӂ䈳⭘ & 䈳⭘㘵ⲴḸ亦䜘࠶޵ᇩ ᢗ㹼 &$// ᤷԔਾ  SSS IXQF  (,3 S S S  ฼ḾⲺ৸ᮦޛഴ 䈹⭞࠳ᮦᰬু  ḸѝⲴ࠭ᮠ৲ᮠ␵䲔ᦹDŽޕᤷԔ৫ᢗ㹼㻛䈳⭘Ⲵ࠭ᮠDŽ൘䈳⭘࠭ᮠ䘄എਾˈ〻ᒿ䴰㾱޽ᢺݸࡽ঻ Ḹˈ㿱മ 3-6 ᡰ⽪DŽ❦ਾᢗ㹼 CALLޕḸˈ㘼ᴰᐖ䗩Ⲵㅜ 1 њ৲ᮠ൘ᴰਾ䈳⭘ᤷԔѻࡽޕ䗩Ⲵ˅ањ৲ᮠݸ Ḹѝˈণ࠭ᮠᴰਾ˄ᴰਣޕ൘≷㕆〻ᒿ䈳⭘ањ C ࠭ᮠᰦˈ〻ᒿ䴰㾱俆ݸ᤹➗䘶ੁ亪ᒿᢺ࠭ᮠ৲ᮠ঻ ѝˈᡁԜਟԕⴻࠪ≷㕆〻ᒿ䈝ਕᱟྲօ䈳⭘ swap()࠭ᮠⲴDŽ⧠൘ᡁԜሩ䈳⭘ᯩ⌅֌аᙫ㔃DŽ Ӿ≷㕆〻ᒿѝ䈳⭘ C 䈝䀰࠭ᮠⲴᯩ⌅ᇎ䱵к൘к䶒ᐢ㓿㔉ࠪDŽ൘к䶒 C 䈝䀰ֻᆀሩᓄⲴ≷㕆〻ᒿԓ⸱ 3.4.2 ൞≽㕌ぁᓅѣ䈹⭞ C ࠳ᮦ кᢗ㹼 ret ᤷԔᰦቡՊᕩࠪ main()Ⲵൠ൰ˈᒦᢺ᧗ࡦᵳ䖜〫ࡠ init/main.c 〻ᒿѝDŽ Ҷ main()࠭ᮠԓ⸱Ⲵൠ൰DŽᖃ head.s ᴰਾ൘ㅜ 218 㹼ޕҶ䘄എൠ൰ˈ㘼ㅜ 140 㹼ࡉ঻ޕкⲴᤷԔ൘Ḹѝ঻ boot/head.s 〻ᒿѝㅜ 136--140 㹼ቡᱟ⭘ҾѪ䐣䖜ࡠ init/main.c ѝⲴ main()࠭ᮠ֌߶༷ᐕ֌DŽㅜ 139 㹼  䘄എѻਾ˅ˈ㌫㔏Պᆹᧂᢗ㹼ILQL ѝⲴԓ⸱DŽ ࠭ᮠˈণᖃ〻ᒿ↓ᑨ䘰ࠪᰦ˄PDLQ ѻࡽݸᢗ㹼LQLW ѝⲴԓ⸱DŽcrtn.o ࡉ⭘Ҿ൘ILQL ४ѝᢗ㹼䘋〻㓸→䘰ࠪ༴⨶࠭ᮠ ILQL ൘䈳⭘ PDLQ DŽLQLW ४ѝवਜ਼䘋〻Ⲵࡍ࿻ॆԓ⸱ˈণᖃ〻ᒿᔰ࿻ᢗ㹼ᰦˈ㌫㔏Պ ൘LQLW ४ѝᢗ㹼ࡍ࿻ॆ࠭ᮠ LQLW ӛ⁑ඇѝDŽcrti.o ⭘Ҿޡಘ˄destructor˅࠭ᮠDŽcrtbeginS.o ઼ crtendS.o Ⲵ֌⭘оࡽє㘵㊫լˈն⭘Ҿࡋᔪ ተᶴ䙐ಘ˄constructor˅઼᷀ᶴޘ crtbegin.o ઼ crtend.o ѫ㾱⭘Ҿ C++䈝䀰൘FWRUV ઼GWRUV ४ѝᢗ㹼 ተㅖਧBVWDUW ቡᇊѹ൘䘉њ⁑ඇѝDŽޘˈаӋࡍ࿻ॆᐕ֌ڊࡽ ᱟ C++䈝䀰Ⲵ੟ࣘ⁑ඇˈ⭡㕆䈁ಘ gcc ᨀ׋˗㘼 crt1.o ࡉо crt0.o Ⲵ֌⭘㊫լˈѫ㾱⭘Ҿ൘䈳⭘ main()ѻ Ҷ䘉⿽䬮᧕亪ᒿDŽަѝ ctr1.oǃcrti.o ઼ crtn.o ⭡ C ᓃᨀ׋ˈᱟ C 〻ᒿⲴĀ੟ࣘā⁑ඇ˗crtbegin.o ઼ crtend.o ˄crtbeginS.o˅ǃᡰᴹ〻ᒿ⁑ඇǃcrtend.o˄crtendS.o˅ǃcrtn.oǃᓃ⁑ඇ᮷ԦāDŽgcc Ⲵ䝽㖞᮷Ԧ specfile ᤷᇊ ᢙኅᡀࠐњ⁑ඇ˖crt1.oǃcrti.oǃcrtbegin.oǃcrtend.o ઼ crtn.oDŽ䘉Ӌ⁑ඇⲴ䬮᧕亪ᒿѪĀcrt1.oǃcrti.oǃcrtbegin.o ӛᓃ⁑ඇ᮷Ԧˈ⧠൘Ⲵ gcc 㕆䈁ಘ˄2.x˅ᐢ㓿ᢺ䘉њ crt0ޡ・ѪҶ֯⭘ ELF ṬᔿⲴⴞḷ᮷Ԧԕ৺ᔪ ф䬮᧕Ⲵ亪ᒿᓄ䈕ᱟĀcrt0.oǃᡰᴹ〻ᒿ⁑ඇǃᓃ᮷ԦāDŽ ˄gld˅Ӿ exch.o ⁑ඇ䬮᧕ӗ⭏ਟᢗ㹼᮷Ԧ exchˈ䛓ѸᡁԜቡ䴰㾱൘ભԔ㹼к⢩࡛ᤷ᰾ crt0.o 䘉њ⁑ඇˈᒦ ഐ↔൘䙊ᑨⲴ㕆䈁䗷〻ѝᡁԜᰐ䴰⢩࡛ᤷᇊ stub ⁑ඇ crt0.oˈնᱟ㤕ᜣӾк䶒㔉ࠪⲴ≷㕆〻ᒿ᡻ᐕ֯⭘ ld >XVUURRW@ XVUORFDOOLEJQXOLE XVUORFDOOLEJFFOGRH[FKXVUORFDOOLEFUWRH[FKRXVUORFDOOLEJQXOLEOF XVUORFDOOLEJFFDVRH[FKRH[FKV JFFYHUVLRQ >XVUURRW@JFFYRH[FKH[FKV   о≷㕆〻ᒿⲴ⴨ӂ䈳⭘ & 䈳⭘ᯩ⌅ˈֻྲ NHUQHODVPV 〻ᒿㅜ 62 㹼䈳⭘ᢗ㹼 WUDSVF ѝⲴ do_int3()࠭ᮠⲴᛵߥDŽ ḸѝⲴлаᶑᤷԔൠ൰ᕩࠪˈ֌Ѫ࠭ᮠ䘄എⲴൠ൰DŽLinux ޵Ṩѝҏᴹཊ༴⭘ࡠҶ䘉⿽࠭ᮠޕᡁԜӪᐕ঻ ᧕֯⭘ JMP ᤷԔ䐣䖜ࡠ㻛䈳⭘࠭ᮠᔰ࿻ൠ൰༴৫ᢗ㹼࠭ᮠDŽ↔ਾᖃ࠭ᮠᢗ㹼ᆼᡀᰦቡՊᢗ㹼 RET ᤷԔᢺ Ḹѝˈ❦ਾⴤޕḸਾӪᐕᢺлаᶑ㾱ᢗ㹼ⲴᤷԔൠ൰঻ޕᤷԔᶕ਼ṧ䗮ࡠ䈳⭘࠭ᮠⲴⴞⲴDŽᯩ⌅ᱟ൘৲ᮠ ਖཆˈᡁԜ䈤≷㕆〻ᒿ䈳⭘ C ࠭ᮠ∄䖳㠚⭡Ⲵਖањ৏ഐᱟᡁԜਟԕṩᵜн⭘ CALL ᤷԔ㘼䟷⭘ JMP ㅹˈ䈧㠚ᐡ࣐ԕ࠶᷀DŽ ǃIVH[HFF ѝⲴ GRBH[HFYH ᴹ NHUQHOVLJQDOF ѝⲴ GRBVLJQDO ᆈ⵰DŽަԆ䟷⭘к䘠⭘⌅Ⲵ࠭ᮠ䘈؍Ⲵ 5 њ৲ᮠђᔳᦹˈḸѝަԆ䘈൷ޕഎਾˈBV\VBIRUN ҏਚᢺ㠚ᐡ঻ 䘄 ҶึḸDŽ൘䈳⭘ C ࠭ᮠ FRS\BSURFHVVޕ⢩ᵳ㓗ਈॆˈᡰԕ CPU Պᢺḷᘇᇴᆈಘ٬઼⭘ᡧḸൠ൰ҏ঻ 䘄എൠ൰ eip ઼ csǃḷᘇᇴᆈಘ eflagsǃ⭘ᡧḸൠ൰ esp ઼ ssDŽഐѪ㌫㔏䈳⭘⎹৺ࡠ〻ᒿޕᢗ㹼ѝᯝᤷԔ঻ ḸⲴᇴᆈಘ ebxǃecxǃedx ઼⇥ᇴᆈಘ fsǃesǃdsDŽᴰਾ 5 њ৲ᮠᱟ CPUޕV\VWHPBFDOO ᰦ൘ 83--88 㹼঻ ޕLQFOXGHOLQX[V\VKˈ74 㹼˅䈳⭘BV\VBIRUN ᰦⲴлаᶑᤷԔⲴ䘄എൠ൰٬DŽ䲿ਾⲴ৲ᮠᱟࡊ䘋 ৲ᮠ none ᱟ V\VWHPBFDOOV 〻 ᒿ ㅜ 94 㹼к࡙⭘ൠ൰䐣䖜㺘 V\VBFDOOBWDEOH>@˄ᇊѹ൘ ḸⲴ਴ᇴᆈಘⲴ٬DŽޕ↕㌫㔏䈳⭘ѝᯝ༴⨶䗷〻ᔰ࿻ˈⴤࡠ䈳⭘ᵜ㌫㔏䈳⭘༴⨶䗷〻ᰦ䙀 ޕebpǃediǃesi ઼ᇴᆈಘ gs Ⲵ٬DŽ㘼䲿ਾⲴަ։৲ᮠᇎ䱵кⴤ᧕ሩᓄึḸкᐢᴹⲴ޵ᇩDŽ䘉Ӌ޵ᇩᱟ䘋 ḸⲴ eax˄nr˅ǃޕḸ 5 њᇴᆈಘ٬ቡᱟ copy_process()࠭ᮠⲴᴰᐖ䶒Ⲵ 5 њ৲ᮠDŽ᤹亪ᒿᆳԜ࠶࡛ሩᓄѪޕ DŽഐ↔ᇎ䱵к䈳⭘ copy_process()࠭ᮠѻࡽחḸˈᆳ䎺ᱟ䶐䘁 C ࠭ᮠ৲ᮠᐖޕᡁԜ⸕䚃৲ᮠ䎺ᱟᴰਾ  ORQJHLSORQJFVORQJHIODJVORQJHVSORQJVV ORQJIVORQJHVORQJGV ORQJHE[ORQJHF[ORQJHG[ LQWQUORQJHESORQJHGLORQJHVLORQJJVORQJQRQH LQWFRS\BSURFHVV NHUQHOIRUNF 〻ᒿDŽ UHW DGGOHVSђᔳ䘉䟼ᡰᴹ঻Ḹ޵ᇩDŽ NHUQHOIRUNF DŽ FDOOBFRS\BSURFHVV䈳⭘ & ࠭ᮠ FRS\BSURFHVV SXVKOHD[ SXVKOHES SXVKOHGL SXVKOHVL SXVKJV NHUQHOV\VWHPBFDOOV ≷㕆〻ᒿBV\VBIRUN 䜘࠶DŽ ᑖᴹཊ䗮 17 њ৲ᮠˈ㿱л䶒ᡰ⽪˖ޡ ত ҶḸѝˈնᱟ FRS\BSURFHVVޕѝ㲭❦ਚᢺ 5 њ৲ᮠ঻ ࠭ᮠ˄NHUQHOIRUNF ѝㅜ 68 㹼˅ⲴᛵߥDŽ൘≷㕆〻ᒿ࠭ᮠBV\VBIRUN ѝㅜ 217 㹼к䈳⭘ FRS\BSURFHVV ⲴḸѝ޵ᇩDŽ൘ Linux 0.1x ޵Ṩԓ⸱ѝቡᴹࠐ༴֯⭘Ҷ䘉⿽ᯩᔿDŽֻྲ൘NHUQHOV\VWHPBFDOOV ≷㕆〻ᒿ ࠭ᮠⲴㅜ 3 њ৲ᮠ p3 ቡՊⴤ᧕֯⭘ p2 ࡽ Ҷㅜ 1ǃㅜ 2 њ৲ᮠˈ䛓Ѹ IXQFޕ 㘼ӵӵ᰾⺞ൠ঻ 䈳⭘ IXQF ࠭ᮠӽ❦Պᢺᆈ᭮ EIP ս㖞ԕкⲴḸѝަԆ޵ᇩ֌Ѫ㠚ᐡⲴ৲ᮠ֯⭘DŽྲ᷌ᡁԜѪ ⭘ᆳⲴ䈍ˈ䛓Ѹ IXQF ᮠቡⴤ᧕䈳৲ޕ ঻ 䟼ӽ❦ԕമ 3-6 ѝާᴹ 3 њ৲ᮠⲴ࠭ᮠ䈳⭘Ѫֻˈྲ᷌ᡁԜ⋑ᴹу䰘Ѫ䈳⭘࠭ᮠIXQF ≷㕆ѝ䈳⭘ C ࠭ᮠ∄䖳Ā㠚⭡āDŽਚ㾱ᱟ൘Ḹѝ䘲ᖃս㖞Ⲵ޵ᇩቡ䜭ਟԕ֌Ѫ৲ᮠ׋ C ࠭ᮠ֯⭘DŽ䘉 ᤷԔᶕ༴⨶⢩ᵳ㓗ਈॆⲴᛵߥˈഐ↔䘉䟼ሩ⢩ᵳ㓗ਈॆᰦⲴ CALL ᤷԔ֯⭘ᯩᔿн޽䘋㹼䈤᰾DŽ ᯠึḸѝDŽ⭡Ҿ Linux ޵Ṩѝਚ֯⭘ѝᯝ䰘઼䲧䱡䰘ᯩᔿ༴⨶⢩ᵳ㓗ਈॆᰦⲴ䈳⭘ᛵߥˈᒦ⋑ᴹ֯⭘ CALL ޕ⎹৺ࡠԓ⸱⢩ᵳ㓗ਈॆˈ䛓Ѹ CPU 䘈Պ䘋㹼ึḸ࠷ᦒˈᒦфᢺᖃࡽึḸᤷ䪸ǃ⇥᧿䘠ㅖ઼䈳⭘৲ᮠ঻ Ḹѝ˄㿱മѝ EIP˅DŽྲ᷌䈳⭘䘈ޕ൘ᢗ㹼 CALL ᤷԔᰦˈCPU Պᢺ CALL ᤷԔлаᶑᤷԔⲴൠ൰঻   о≷㕆〻ᒿⲴ⴨ӂ䈳⭘ & UHV ᢗ㹼࣐⌅䘀㇇DŽަѝ৲ᮠ res ᱟ䘀㇇Ⲵ㔃᷌DŽ࠭ᮠ䘄എ LQWDLQWELQW ㅜ 2 њ࠭ᮠ P\DGG аṧDŽޘњᮠ઼⭘䙄о sys_write()ᆼ ਧ˄4˅ˈᇴᆈಘ%ebxǃ%ecx ઼%edx 㾱᤹䈳⭘㿴ᇊ࠶࡛ᆈ᭮ fdǃbuf ઼ countDŽ࠭ᮠ mywrite()Ⲵ䈳⭘৲ᮠ 䈳⭘࣏㜭ޕ࡛Ѫ᮷Ԧ᧿䘠ㅖǃᱮ⽪㕃ߢ४ᤷ䪸઼ᱮ⽪ᆇㅖᮠDŽ൘ᢗ㹼 int 0x80 ѻࡽˈᇴᆈಘ%eax ѝ䴰㾱᭮ LQWFRXQW ᇎ⧠൘ቿᒅкᱮ⽪ؑ᚟DŽሩᓄⲴ㌫㔏䈳⭘࣏㜭ਧᱟ 4˄৲㿱 LQFOXGHXQLVWGK˅ˈйњ৲ᮠ࠶ EXI LQWIGFKDU ࡙⭘㌫㔏ѝᯝ 0x80 䈳⭘㌫㔏䈳⭘ V\VBZULWH 䈕≷㕆᮷ԦѝⲴㅜ 1 њ࠭ᮠ P\ZULWH UHW SRSOHES PRYOHESHVS PRYOHF[HD[HD[ ѝᱟ࠭ᮠ䘄എ٬DŽ LQFOHF[⋑ᴹਁ⭏ⓒࠪˈҾᱟ䇮㖞ᰐⓒࠪ䘄എ٬DŽ ᤷ䪸ᡰᤷս㖞༴DŽޕHD[ ᢺ䇑㇇㔃᷌᭮ PRYOHG[ HES HD[ਆㅜ  њ৲ᮠⲴᤷ䪸DŽ PRYO MRI㤕ⓒࠪࡉ䐣䖜DŽ DGGOHD[HG[ᢗ㹼࣐⌅䘀㇇DŽ [RUOHF[HF[HF[ Ѫ  㺘⽪䇑㇇ⓒࠪDŽ HES HG[ਆㅜ  њ৲ᮠ EDŽ PRYO HES HD[ਆㅜ  њ৲ᮠ DDŽ PRYO PRYOHVSHES SXVKOHES BP\DGG UHW SRSOHES PRYOHESHVS SRSOHE[ LQW[ᢗ㹼㌫㔏䈳⭘DŽ ㌫㔏䈳⭘ਧ DŽޕPRYO6<6:5,7(HD[HD[ ѝ᭮ HES HG[ਆㅜ  њ৲ᮠ˖ᱮ⽪ᆇㅖᮠDŽ PRYO HES HF[ਆㅜ  њ৲ᮠ˖㕃ߢ४ᤷ䪸DŽ PRYO HES HE[ਆ䈳⭘㘵ㅜ  њ৲ᮠ˖᮷Ԧ᧿䘠ㅖ IGDŽ PRYO SXVKOHE[ PRYOHVSHES SXVKOHES BP\ZULWH WH[W JOREDOBP\ZULWHBP\DGG  ㌫㔏䈳⭘ਧDŽ 6<6:5,7( V\VBZULWH  DŽ B ˅л㕆䈁ˈࡉ䈧৫ᦹ࠭ᮠ਽ࡽⲴлࡂ㓯⌘᜿˖ྲ᷌൘⧠൘Ⲵ /LQX[ ㌫㔏˄ֻྲ 5HG+DW UHV ⭘Ҿᢗ㹼 DE UHV 䘀㇇DŽ㤕࠭ᮠ䘄എ ˈࡉ䈤᰾ⓒࠪDŽ LQWDLQWELQW ࠭ᮠ LQWP\DGG EXILQWFRXQW DŽ LQWIGFKDU ᇎ⧠ᱮ⽪࠭ᮠ LQWP\ZULWH ᵜ≷㕆〻ᒿ࡙⭘㌫㔏䈳⭘ V\VBZULWH   〻ᒿⲴᯩ⌅DŽवਜ਼єњ࠭ᮠⲴ≷㕆〻ᒿ FDOOHHV 㿱ྲлᡰ⽪DŽ ⸝ˈ䛓Ѹਟԕⴤ᧕൘ C 〻ᒿѝ֯⭘к䶒ӻ㓽Ⲵ޵㚄≷㕆䈝ਕᶕᇎ⧠DŽл䶒ᡁԜԕањ⽪ֻᶕ䈤᰾㕆ࡦ䘉㊫ ᑨ֯⭘DŽ䈳⭘ᯩ⌅Ⲵ⵰䟽⛩ӽ❦ᱟሩ࠭ᮠ৲ᮠ൘Ḹѝս㖞Ⲵ⺞ᇊкDŽᖃ❦ˈྲ᷌䈳⭘Ⲵ≷㕆䈝䀰〻ᒿ∄䖳 Ӿ C 〻ᒿѝ䈳⭘≷㕆〻ᒿ࠭ᮠⲴᯩ⌅о≷㕆〻ᒿѝ䈳⭘ C ࠭ᮠⲴ৏⨶⴨਼ˈն Linux ޵Ṩ〻ᒿѝн 3.4.3 ൞ C ぁᓅѣ䈹⭞≽㕌࠳ᮦ   о≷㕆〻ᒿⲴ⴨ӂ䈳⭘ & ᮷ԦᡆањབྷⲴ⁑ඇ᮷ԦDŽᴰਾ䈤᰾ Linux 0.11 ޵ṨҼ䘋ࡦԓ⸱ۿඇ㓴ਸ൘а䎧ˈԕ⭏ᡀҼ䘋ࡦਟᢗ㹼᱐ ᵜ㢲俆ݸㆰঅ䈤᰾㕆䈁ಘӗ⭏Ⲵⴞḷ᮷Ԧ㔃ᶴˈ❦ਾ᧿䘠䬮᧕ಘྲօᢺ䴰㾱䬮᧕൘а䎧Ⲵⴞḷ᮷Ԧ⁑ ⴞḷ᮷Ԧ䘋㹼㓴ਸ༴⨶ˈᖒᡀањਟ㻛޵Ṩ࣐䖭ᢗ㹼Ⲵⴞḷ᮷Ԧˈণਟᢗ㹼᮷ԦDŽ Ⲵᡰᴹޣ〻ᒿ gldDŽ㕆䈁ಘ⭘ҾѪⓀ〻ᒿ᮷Ԧӗ⭏ሩᓄⲴҼ䘋ࡦԓ⸱઼ᮠᦞⴞḷ᮷ԦDŽ䬮᧕〻ᒿ⭘Ҿሩ⴨ ERRWVHFWV ઼䇮㖞〻ᒿ VHWXSVDŽㅜҼ⿽ᱟ GNU Ⲵ≷㕆ಘ as˄gas˅઼ C 䈝䀰㕆䈁ಘ gcc ԕ৺⴨ᓄⲴ䬮᧕ ˄ᡆ〠Ѫ䬮᧕ಘ˅ld86DŽᆳԜу䰘⭘Ҿ㕆䈁઼䬮᧕䘀㹼൘ᇎൠ൰⁑ᔿлⲴ 16 ս޵Ṩᕅሬᡷ४〻ᒿ ѪҶ⭏ᡀ޵Ṩԓ⸱᮷ԦˈLinux 0.11 ֯⭘Ҷє⿽㕆䈁ಘDŽㅜа⿽ᱟ≷㕆㕆䈁ಘ as86 ઼⴨ᓄⲴ䬮᧕〻ᒿ 3.5 Linux 0.11 ⴤḽᮽԬṲᕅ >XVUURRW@ 7KHUHVXOWLV &DOFXODWLQJ >XVUURRW@FDOOHU >XVUURRW@JFFRFDOOHUFDOOHUFFDOOHHR >XVUURRW@DVRFDOOHHRFDOOHHV ᷌ᰐ᭸DŽ䘉єњ᮷ԦⲴ㕆䈁઼䘀㹼㔃᷌㿱ྲлᡰ⽪˖ ᮠᢺṬᔿॆ䗷Ⲵ㔃᷌ؑ᚟ᆇㅖѢᱮ⽪൘ቿᒅкDŽྲ᷌࠭ᮠ myadd()䘄എ 0ˈࡉ㺘⽪࣐࠭ᮠਁ⭏ⓒࠪˈ䇑㇇㔃 㕆࠭ᮠ myadd()ሩ a ઼ b єњᮠ䘋㹼䘀㇇ˈᒦ൘ㅜ 3 њ৲ᮠ res ѝ䘄എ䇑㇇㔃᷌DŽᴰਾ޽࡙⭘ mywrite()࠭ 䈕࠭ᮠ俆ݸ࡙⭘≷㕆࠭ᮠ mywrite()൘ቿᒅкᱮ⽪ᔰ࿻䇑㇇Ⲵؑ᚟&DOFXODWLQJˈ❦ਾ䈳⭘࣐⌅䇑㇇≷ ` UHWXUQ `  HPVJ HPVJVWUOHQ P\ZULWH `HOVH^  EXI EXIVWUOHQ P\ZULWH  EXI7KHUHVXOWLVG?QUHV VSULQWI UHV ^ DE P\DGG LI  P\VWU P\VWUVWUOHQ P\ZULWH  E D  HPVJ (UURULQDGGLQJ?Q FKDU P\VWU &DOFXODWLQJ?Q FKDU LQWDEUHV FKDUEXI>@ ^  LQWPDLQ    䘄എ ˈࡉ㺘⽪࣐࠭ᮠਁ⭏ⓒࠪDŽ俆ݸᱮ⽪ᔰ࿻䇑㇇ؑ᚟ˈ❦ਾᱮ⽪䘀㇇㔃᷌DŽ ྲ᷌ P\DGG DEUHVXOW ᢗ㹼࣐䘀㇇DŽ IGEXIFRXQW ᱮ⽪ؑ᚟˗䈳⭘ P\DGG 䈳⭘≷㕆࠭ᮠ P\ZULWH   㓯'_'DŽ䈳⭘䘉єњ࠭ᮠⲴ C 〻ᒿ FDOOHUF 㿱ྲлᡰ⽪DŽ ⌘᜿˖ྲ᷌൘⧠൘Ⲵ Linux ㌫㔏˄ֻྲ RedHat 9˅л㕆䈁 FDOOHHV 〻ᒿˈࡉ䈧৫ᦹ࠭ᮠ਽ࡽⲴлࡂ res 䘄എ㔉䈳⭘㘵DŽ ٬⭘Ҿࡔᯝᱟ੖ਁ⭏ⓒࠪDŽྲ᷌䘄എ٬Ѫ 0 㺘⽪䇑㇇ᐢਁ⭏ⓒࠪˈ㔃᷌нਟ⭘DŽ੖ࡉ䇑㇇㔃᷌ሶ䙊䗷৲ᮠ   LQX[ ⴞḷ᮷ԦṬᔿ/ 6WULQJ7DEOH ᆇㅖѢ㺘 6\PERO7DEOH ㅖਧ㺘 'DWDUHORFDWLRQ ᮠᦞ䟽ᇊսؑ᚟ 7H[WUHORFDWLRQ ԓ⸱䟽ᇊսؑ᚟ 'DWDVHFWLRQ ᮠᦞ䜘࠶ 7H[WVHFWLRQ ԓ⸱䜘࠶ DRXW ᮷Ԧཤ ᯩDŽ ⭘Ҿᇊսԓ⸱⇥ѝⲴᤷ䪸ᡆൠ൰DŽᖃ䬮᧕〻ᒿ䴰㾱᭩ਈⴞḷԓ⸱Ⲵൠ൰ᰦቡ䴰㾱؞↓઼㔤ᣔ䘉Ӌൠ „ ԓ⸱䟽ᇊս䜘࠶˄text relocations˅DŽ䘉䜘࠶ਜ਼ᴹ׋䬮᧕〻ᒿ֯⭘Ⲵ䇠ᖅᮠᦞDŽ൘㓴ਸⴞḷ⁑ඇ᮷Ԧᰦ ॆ䗷Ⲵᮠᦞˈᙫᱟ㻛࣐䖭ࡠਟ䈫߉Ⲵ޵ᆈѝDŽ „ ᮠᦞ४˄data segment˅DŽ⭡㕆䈁ಘᡆ≷㕆ಘ⭏ᡀⲴҼ䘋ࡦᤷԔԓ⸱઼ᮠᦞؑ᚟ˈ䘉䜘࠶ਜ਼ᴹᐢ㓿ࡍ࿻ ᮠᦞDŽਟԕԕਚ䈫ᖒᔿ㻛࣐䖭DŽޣ䖭ࡠ޵ᆈѝⲴᤷԔԓ⸱઼⴨ „ ԓ⸱४˄text segment˅DŽ⭡㕆䈁ಘᡆ≷㕆ಘ⭏ᡀⲴҼ䘋ࡦᤷԔԓ⸱઼ᮠᦞؑ᚟ˈਜ਼ᴹ〻ᒿᢗ㹼ᰦ㻛࣐ ሶаӋ⁑ඇ᮷Ԧ㓴ਸᡀањਟᢗ㹼᮷ԦDŽ䘉ᱟⴞḷ᮷Ԧୟаᗵ㾱Ⲵ㓴ᡀ䜘࠶DŽ Ԧࡋᔪᰦ䰤ㅹDŽ޵Ṩ֯⭘䘉Ӌ৲ᮠᢺᢗ㹼᮷Ԧ࣐䖭ࡠ޵ᆈѝᒦᢗ㹼ˈ㘼䬮᧕〻ᒿ˄ld˅֯⭘䘉Ӌ৲ᮠ Ⲵᮤփ㔃ᶴؑ᚟DŽֻྲԓ⸱઼ᮠᦞ४Ⲵ䮯ᓖǃᵚࡍ࿻ॆᮠᦞ४Ⲵ䮯ᓖǃሩᓄⓀ〻ᒿ᮷Ԧ਽ԕ৺ⴞḷ᮷ ⴞḷ᮷Ԧޣ„ ᢗ㹼ཤ䜘࠶˄exec header˅DŽᢗ㹼᮷Ԧཤ䜘࠶DŽ䈕䜘࠶ѝਜ਼ᴹаӋ৲ᮠ˄exec 㔃ᶴ˅ˈᱟᴹ a.out Ṭᔿ 7 њ४Ⲵสᵜᇊѹ઼⭘䙄ᱟ˖ ഴ DRXW ṲᕅⲺⴤḽᮽԬ  ᮷⇥˄ԓ⸱⇥˅઼ᮠᦞ⇥DŽ 䟽ᇊսؑ᚟४ǃㅖਧ㺘ԕ৺ㅖਧ਽ᆇㅖѢᶴᡀˈ㿱മ 3-7 ᡰ⽪DŽަѝԓ⸱४઼ᮠᦞ४䙊ᑨҏ㻛࠶࡛〠Ѫ↓ ᮷Ԧཤ઼䲿ਾⲴԓ⸱४˄Text sectionˈҏ〠Ѫ↓᮷⇥˅ǃᐢࡍ࿻ॆᮠᦞ४˄Data sectionˈҏ〠Ѫᮠᦞ⇥˅ǃ ᮷ԦṬᔿDŽሩҾާᴹ޵ᆈ࠶亥ᵪࡦⲴ㌫㔏ᶕ䈤ˈ䘉ᱟа⿽ㆰঅᴹ᭸Ⲵⴞḷ᮷ԦṬᔿDŽa.out Ṭᔿ᮷Ԧ⭡ањ ⭘Ҷ UNIX Ր㔏Ⲵ a.out ṬᔿDŽ䘉ᱟа⿽㻛〠Ѫ≷㕆о䬮᧕䗃ࠪ˄Assembly & linker editor output˅Ⲵⴞḷ ൘ Linux 0.11 ㌫㔏ѝˈGNU gcc ᡆ gas 㕆䈁䗃ࠪⲴⴞḷ⁑ඇ᮷Ԧ઼䬮᧕〻ᒿᡰ⭏ᡀⲴਟᢗ㹼᮷Ԧ䜭֯ 3.5.1 ⴤḽᮽԬṲᕅ ӗ⭏Ⲵਟᢗ㹼ⴞḷ᮷Ԧ〠Ѫਟᢗ㹼᮷ԦDŽᒦфᢺᆳԜ䜭㔏〠Ѫⴞḷ᮷ԦDŽ ѪׯҾ᧿䘠ˈ䘉䟼ᢺ㕆䈁ಘ⭏ᡀⲴⴞḷ᮷Ԧ〠Ѫⴞḷ⁑ඇ᮷Ԧ˄ㆰ〠⁑ඇ᮷Ԧ˅ˈ㘼ᢺ䬮᧕〻ᒿ䗃ࠪ สᵜᐕ֌৏⨶ਟ৲㿱 John R. Levine 㪇ⲴljLinkers & LoadersNJаҖDŽ ⴞḷ᮷Ԧ઼䬮᧕〻ᒿⲴޣMINIX ⴞḷ᮷Ԧ㔃ᶴо a.out ⴞḷ᮷ԦṬᔿ㊫լˈᡰԕ䘉䟼нሩަ䘋㹼䈤᰾DŽᴹ ld86 ⭏ᡀⲴᱟ MINIX у䰘Ⲵⴞḷ᮷ԦṬᔿˈᡁԜሶ൘⎹৺䘉⿽ṬᔿⲴ޵Ṩࡋᔪᐕާаㄐѝ㔉ࠪDŽഐѪ ᮷Ԧ Image Ⲵ⭏ᡀ৏⨶઼䗷〻DŽ䘉䟼㔉ࠪҶ Linux 0.11 ޵Ṩᡰ᭟ᤱⲴ a.out ⴞḷ᮷ԦṬᔿⲴؑ᚟DŽas86 ઼   LQX[ ⴞḷ᮷ԦṬᔿ/ 䮯ᓖѪ 8 ᆇ㢲ˈަ㔃ᶴྲлᡰ⽪DŽ वਜ਼⭘Ҿ䬮᧕〻ᒿⲴ䟽ᇊսؑ᚟DŽԓ⸱⇥઼ᮠᦞ⇥Ⲵ䟽ᇊսؑ᚟൷ᴹ䟽ᇊս䇠ᖅ˄亩˅ᶴᡀˈ⇿њ䇠ᖅⲴ Linux 0.11 ㌫㔏Ⲵ⁑ඇ᮷Ԧ઼ᢗ㹼᮷Ԧ䜭ᱟ a.out ṬᔿⲴⴞḷ᮷Ԧˈնᱟਚᴹ㕆䈁ಘ⭏ᡀⲴ⁑ඇ᮷Ԧѝ 3.5.1.2 䠃ᇐփؗᚥ䜞࠼ 䲔䶎䬮᧕〻ᒿѪҶ䈳䈅ⴞⲴ㘼वᤜҶㅖਧؑ᚟ˈᢗ㹼᮷ԦѝⲴ䘉ࠐњᆇ⇥Ⲵ٬䙊ᑨѪ 0DŽ ⇥ਾㅖਧ㺘ǃԓ⸱઼ᮠᦞ⇥䟽ᇊսؑ᚟ⲴབྷሿDŽሩҾਟᢗ㹼᮷Ԧᶕ䈤ᒦн䴰㾱ㅖਧ㺘઼䟽ᇊսؑ᚟ˈഐ↔ a_entry ᆇ⇥ᤷᇊҶ〻ᒿԓ⸱ᔰ࿻ᢗ㹼Ⲵൠ൰ˈ㘼 a_symsǃa_trsize ઼ a_drsize ᆇ⇥ࡉ࠶࡛䈤᰾Ҷᮠᦞ ൠާᴹањ bss ⇥ˈ൘ਾ䶒മ⽪ѝሶ֯⭘㲊㓯Ṷᶕ㺘⽪ⴞḷ᮷ԦѝⲴ bss ⇥DŽ ᰦՊ㠚ࣘሩ޵ᆈ␵䴦ˈഐ↔ bss ⇥н䴰㾱㻛वᤜ൘⁑ඇ᮷Ԧᡆᢗ㹼᮷ԦѝDŽѪҶᖒ䊑ൠ㺘⽪ⴞḷ᮷Ԧ䙫䗁 ᆇ⇥ᤷ᰾޵Ṩ൘࣐䖭ⴞḷ᮷Ԧᰦᮠᦞ⇥ਾ䶒ᵚࡍ࿻ॆᮠᦞ४ฏ˄bss ⇥˅Ⲵ䮯ᓖDŽ⭡Ҿ Linux ൘࠶䝽޵ᆈ ᢗ㹼ཤ㔃ᶴѝⲴ a_text ઼ a_data ᆇ⇥࠶࡛ᤷ᰾ਾ䶒ਚ䈫Ⲵԓ⸱⇥઼ਟ䈫߉ᮠᦞ⇥Ⲵᆇ㢲䮯ᓖDŽa_bss 㢲ཤ㔃ᶴਾ䶒㍗᧕⵰ቡᱟԓ⸱४઼ᮠᦞ४DŽ ᭮㖞〻ᒿⲴ↓᮷⇥઼ᮠᦞ⇥ㅹؑ᚟DŽ㘼ሩҾањ OMAGIC ㊫රⲴ.o ⁑ඇ᮷Ԧᶕ䈤ˈ᮷Ԧᔰ࿻䜘࠶Ⲵ 32 ᆇ ᆇ㢲Ⲵオ䰤㔉ཤ㔃ᶴ֯⭘DŽ䲔㻛ཤ㔃ᶴঐ⭘Ⲵ 32 њᆇ㢲ԕཆˈަ։䜘࠶൷Ѫ 0DŽӾ 1024 ᆇ㢲ѻਾ᡽ᔰ࿻ ᙫ䮯ᓖਚᴹ 32 ᆇ㢲ˈնᱟሩҾањ ZMAGIC ㊫රⲴᢗ㹼᮷Ԧᶕ䈤ˈަ᮷Ԧᔰ࿻䜘࠶ত䴰㾱у䰘⮉ࠪ 1024 䘋ࡦ 0413˅DŽ䘉є⿽ṬᔿⲴѫ㾱४࡛൘ҾᆳԜሩ਴њ䜘࠶Ⲵᆈۘ࠶䝽ᯩᔿкDŽ㲭❦䈕㔃ᶴⲴޛ˄ᱟ 0x10b Ṭᔿˈᆳᤷ᰾᮷ԦѪ䴰≲࠶亥༴⨶˄demang-pagingˈণ䴰≲࣐䖭 load on demand˅Ⲵਟᢗ㹼᮷ԦDŽަ冄ᮠ 䘋ࡦ 0407˅DŽ㘼ᢗ㹼᮷Ԧࡉ֯⭘Ҷ ZMAGIC ㊫රⲴ a.outޛ˄᮷Ԧᡆ㘵ᱟн㓟Ⲵਟᢗ㹼᮷ԦDŽަ冄ᮠᱟ 0x107 ֯⭘Ҷަѝє⿽㊫ර˖⁑ඇⴞḷ᮷Ԧ֯⭘Ҷ OMAGIC˄Old Magic˅㊫රⲴ a.out Ṭᔿˈᆳᤷ᰾᮷Ԧᱟⴞḷ ᡁԜ৸ਟᢺ a.out ṬᔿⲴ᮷Ԧ࠶ᡀࠐ⿽㊫රDŽLinux 0.11 ㌫㔏ˈṩᦞ a.out ᮷Ԧѝཤ㔃ᶴ冄ᮠᆇ⇥Ⲵ٬ ` XQVLJQHGDBGUVL]Hᮠᦞ䟽ᇊսؑ᚟䮯ᓖˈᆇ㢲ᮠDŽ XQVLJQHGDBWUVL]Hԓ⸱䟽ᇊսؑ᚟䮯ᓖˈᆇ㢲ᮠDŽ XQVLJQHGDBHQWU\ᢗ㹼ᔰ࿻ൠ൰DŽ XQVLJQHGDBV\PV᮷ԦѝⲴㅖਧ㺘䮯ᓖˈᆇ㢲ᮠDŽ XQVLJQHGDBEVV᮷ԦѝⲴᵚࡍ࿻ॆᮠᦞ४䮯ᓖˈᆇ㢲ᮠDŽ XQVLJQHGDBGDWDᮠᦞ䮯ᓖˈᆇ㢲ᮠDŽ XQVLJQHGDBWH[Wԓ⸱䮯ᓖˈᆇ㢲ᮠDŽ XQVLJQHGORQJDBPDJLFᢗ㹼᮷Ԧ冄ᮠDŽ֯⭘ 1B0$*,& ㅹᆿ䇯䰞DŽ VWUXFWH[HF^ a.out 㔃ᶴⲴ䈖㓶ؑ᚟䈧৲㿱 include/a.out.h ᮷ԦਾⲴӻ㓽DŽ ޣަᇊѹྲлᡰ⽪DŽᴹ ⴞḷ᮷ԦⲴ᮷Ԧཤѝਜ਼ᴹањ䮯ᓖѪ 32 ᆇ㢲Ⲵ exec ᮠᦞ㔃ᶴˈ䙊ᑨ〠Ѫ᮷Ԧཤ㔃ᶴᡆᢗ㹼ཤ㔃ᶴDŽ 3.5.1.1 ᢝ㺂ཪ䜞࠼ սؑ᚟DŽл䶒ᡁԜሩަѝࠐњ䟽㾱४ᡆ䜘࠶䘋㹼䈤᰾DŽ Ⲵਟᢗ㹼᮷Ԧѝቡн޽䴰㾱䟽ᇊޣлഐѪ䬮᧕ಘᐢ㓿ᢺᢗ㹼᮷Ԧ༴⨶ᡀӾањപᇊൠ൰ᔰ࿻䘀㹼ˈᡰԕ⴨ ㇑⨶࣏㜭ˈഐ↔ᆳՊѪ⇿њᢗ㹼〻ᒿঅ⤜࠶䝽ањ 64MB Ⲵൠ൰オ䰤˄䙫䗁ൠ൰オ䰤˅֯⭘DŽ൘䘉⿽ᛵߥ ሩҾањᤷᇊⲴⴞḷ᮷Ԧᒦ䶎аᇊՊवਜ਼ᡰᴹԕкؑ᚟DŽ⭡Ҿ Linux 0.11 ㌫㔏֯⭘Ҷ Intel CPU Ⲵ޵ᆈ DŽ䘉Ӌؑ᚟ਟवਜ਼Ⓚ〻ᒿԓ⸱઼㹼ਧǃተ䜘ㅖਧԕ৺ᮠᦞ㔃ᶴ᧿䘠ؑ᚟ㅹDŽޣ䬮᧕䗷〻ᰐ „ ᆇㅖѢ㺘䜘࠶˄string table˅DŽ䈕䜘࠶ਜ਼ᴹоㅖਧ਽⴨ሩᓄⲴᆇㅖѢDŽ⭘Ҿ䈳䈅〻ᒿ䈳䈅ⴞḷԓ⸱ˈо ⁑ඇ᮷Ԧѻ䰤ሩભ਽Ⲵਈ䟿઼࠭ᮠ˄ㅖਧ˅䘋㹼Ӕ৹ᕅ⭘DŽ Ⲵㅖਧˈᡆ㘵ᱟ⭡䬮᧕ಘᇊѹⲴㅖਧˈ⭘Ҿ൘ޕተㅖਧԕ৺䴰㾱ӾަԆ⁑ඇ᮷Ԧѝ䗃ޘ᮷ԦѝᇊѹⲴ ᆈ⵰⁑ඇ؍„ ㅖਧ㺘䜘࠶˄symbol table˅DŽ䘉䜘࠶਼ṧਜ਼ᴹ׋䬮᧕〻ᒿ֯⭘Ⲵ䇠ᖅᮠᦞDŽ䘉Ӌ䇠ᖅᮠᦞ „ ᮠᦞ䟽ᇊս䜘࠶˄data relocations˅DŽ㊫լҾԓ⸱䟽ᇊս䜘࠶Ⲵ֌⭘ˈնᱟ⭘Ҿᮠᦞ⇥ѝᤷ䪸Ⲵ䟽ᇊսDŽ   LQX[ ⴞḷ᮷ԦṬᔿ/ 䛓Ѹሩ䬮᧕〻ᒿ㘼䀰䈕٬ቡᱟ〻ᒿᐼᵋᤷᇊㅖˈተ˅ㅖਧާᴹ䶎䴦٬ޘ˄ۘオ䰤DŽྲ᷌ањᵚᇊѹⲴཆ䜘 ⮉аඇᆈ؍ն֌Ѫа⿽⢩↺ᛵߥˈ㕆䈁ಘ㜭ཏ֯⭘ањᵚᇊѹⲴㅖਧᶕ㾱≲䬮᧕〻ᒿѪᤷᇊⲴㅖਧ਽ undef ᤷ᰾ᱟањᵜ⁑ඇ᮷ԦѝᵚᇊѹⲴㅖਧDŽ↔ᰦㅖਧⲴ٬䙊ᑨᱟ 0DŽ abs ᤷ᰾ㅖਧᱟањ㔍ሩⲴ˄പᇊⲴ˅нਟ䟽ᇊսⲴㅖਧDŽㅖਧⲴ٬ቡᱟ䈕പᇊ٬DŽ textǃdata ᡆ bbs ᤷ᰾ᱟᵜ⁑ඇ᮷ԦѝᇊѹⲴㅖਧDŽ↔ᰦㅖਧⲴ٬ᱟ⁑ඇѝ䈕ㅖਧⲴਟ䟽ᇊսൠ൰DŽ ѫ㾱Ⲵ㊫රवᤜ˖ ֯⭘DŽn_type ᆇ⇥Ⲵަ։∄⢩ս⭘ᶕᤷ᰾ㅖਧ㊫රDŽa.out.h ཤ᮷ԦѝᇊѹҶ䘉Ӌ㊫ර٬ᑨ䟿ㅖਧDŽㅖਧⲴ ተㅖਧDŽ䬮᧕〻ᒿᒦн䴰㾱ተ䜘ㅖਧؑ᚟ˈնਟ׋䈳䈅〻ᒿޘྲ᷌䈕սѪ 1 Ⲵ䈍ˈ䛓Ѹ䈤᰾䈕ㅖਧᱟањ ተⲴ˅DŽޘ˄ս㖞DŽ㊫රᆇ⇥ n_type ᤷ᰾ҶㅖਧⲴ㊫රDŽ䈕ᆇ⇥Ⲵᴰਾањ∄⢩ս⭘Ҿᤷ᰾ㅖਧᱟ੖ᱟཆ䜘Ⲵ 〫ٿㅖਧ㺘䇠ᖅ亩䮯ᓖѪ 12 ᆇ㢲ˈަѝㅜањᆇ⇥㔉ࠪҶㅖਧ਽ᆇㅖѢ˄ԕ null 㔃ቮ˅൘ᆇㅖѢ㺘ѝⲴ ⭡Ҿ GNU gcc 㕆䈁ಘݱ䇨ԫ᜿䮯ᓖⲴḷ䇶ㅖˈഐ↔ḷ䇶ㅖᆇㅖѢ䜭սҾㅖਧ㺘ਾⲴᆇㅖѢ㺘ѝDŽ⇿њ ` ㅖਧⲴ٬DŽXQVLJQHGORQJQBYDOXH VKRUWQBGHVF 䙊ᑨн⭘DŽFKDUQBRWKHU 䈕ᆇ㢲࠶ᡀ  њᆇ⇥ˈ৲㿱 DRXWK ᮷Ԧ  㹼DŽXQVLJQHGFKDUQBW\SH `QBXQ ٬DŽ〫ٿᡆ㘵ᱟㅖਧ਽〠൘ᆇㅖѢ㺘ѝⲴᆇ㢲ORQJQBVWU[ ᡆ㘵ᱟᤷੁਖањㅖਧ亩㔃ᶴⲴᤷ䪸ˈQBQH[W VWUXFWQOLVW ᆇㅖѢᤷ䪸ˈQBQDPH FKDU XQLRQ^ VWUXFWQOLVW^ ⲴᆇㅖѢ㺘DŽㅖਧ㺘䇠ᖅ亩Ⲵ㔃ᶴྲлᡰ⽪DŽޣⴞḷ᮷ԦⲴᴰਾ䜘࠶ᱟㅖਧ㺘઼⴨ 3.5.1.3 ㅜਭ㺞ૂᆍㅜѨ䜞࠼ 䴰㾱֯⭘ㅖਧⲴ٬䘋㹼䟽ᇊսDŽ ᱟ 1ˈ䛓Ѹ䈕䟽ᇊս亩ᱟሩањཆ䜘ㅖਧⲴᕅ⭘ˈ↔ᰦ r_symbolnum ᤷᇊⴞḷ᮷Ԧѝㅖਧ㺘ѝⲴањㅖਧˈ 䛓Ѹ䈕䟽ᇊս亩ᱟањᲞ䙊Ⲵ䟽ᇊս亩ˈ↔ᰦ r_symbolnum ᆇ⇥ᤷᇊᱟ൘ଚњ⇥ѝራ൰ᇊսDŽྲ᷌䈕ḷᘇ ḷᘇս r_extern ᧗ࡦ⵰ r_symbolnum Ⲵਜ਼ѹˈᤷ᰾䟽ᇊս亩৲㘳Ⲵᱟ⇥䘈ᱟањㅖਧDŽྲ᷌䈕ḷᘇ٬ᱟ 0ˈ ⲴāⲴ亩ˈণᆳ֌Ѫањ⴨ሩൠ൰㻛⭘ҾᤷԔᖃѝDŽཆ䜘ޣḷᘇս r_pcrel ᤷࠪ㻛䟽ᇊս亩ᱟањĀPC ⴨ r_length ᤷࠪ㻛䟽ᇊս亩Ⲵ䮯ᓖˈ0 ࡠ 3 ࠶࡛㺘⽪㻛䟽ᇊս亩Ⲵᇭᓖᱟ 1 ᆇ㢲ǃ2 ᆇ㢲ǃ4 ᆇ㢲ᡆ 8 ᆇ㢲DŽ ٬DŽ2 ∄⢩Ⲵ䮯ᓖᆇ⇥〫ٿ᫽֌Ⲵؑ᚟DŽൠ൰ᆇ⇥ r_address ᱟᤷਟ䟽ᇊս亩Ӿԓ⸱⇥ᡆᮠᦞ⇥ᔰ࿻㇇䎧Ⲵ ԓ⸱४˄ԓ⸱⇥˅઼ᮠᦞ४˄ᮠᦞ⇥˅ѝ䴰㾱䟽ᇊս༴䮯ᓖѪ 4 ᆇ㢲Ⲵൠ൰ԕ৺㿴ᇊྲօާփ䘋㹼䟽ᇊս ֯⭘⴨ᓄ䟽ᇊս亩ሩㅖਧⲴ٬䘋㹼؞↓DŽ⭡к䶒䟽ᇊս䇠ᖅ亩Ⲵ㔃ᶴਟԕⴻࠪˈ⇿њ䇠ᖅ亩ਜ਼ᴹ⁑ඇ᮷Ԧ ؞᭩ⲴൠᯩDŽҼᱟ൘⁑ඇ᮷Ԧѝᆈ൘ሩᵚᇊѹㅖਧᕅ⭘ᰦˈᖃ↔ᵚᇊѹㅖਧᴰ㓸㻛ᇊѹᰦ䬮᧕〻ᒿቡਟԕ 䟽ᇊս亩Ⲵ࣏㜭ᴹєњDŽаᱟᖃԓ⸱⇥㻛䟽ᇊսࡠањн਼Ⲵสൠ൰༴ᰦˈ䟽ᇊս亩ࡉ⭘Ҿᤷࠪ䴰㾱 ` ⋑ᴹ֯⭘Ⲵ  њ∄⢩սˈնᴰྭሶᆳԜ༽սᦹDŽXQVLJQHGLQWUBSDG ཆ䜘ḷᘇսDŽԕㅖਧⲴ٬䟽ᇊսDŽԕ⇥Ⲵൠ൰䟽ᇊսDŽXQVLJQHGLQWUBH[WHUQ  ∄⢩DŽᤷᇊ㾱㻛䟽ᇊսᆇ⇥䮯ᓖ˄ Ⲵ⅑ᯩ˅DŽXQVLJQHGLQWUBOHQJWK ḷᘇDŽޣ ∄⢩DŽ3& ⴨XQVLJQHGLQWUBSFUHO DŽᤷᇊㅖਧ㺘ѝањㅖਧᡆ㘵ањ⇥DŽޣਜ਼ѹо UBH[WHUQ ᴹXQVLJQHGLQWUBV\PEROQXP ⇥޵䴰㾱䟽ᇊսⲴൠ൰DŽLQWUBDGGUHVV ^ VWUXFWUHORFDWLRQBLQIR   LQX[ ⴞḷ᮷ԦṬᔿ/ 㖞 1024 ᆇ㢲ᔰ࿻ᆈ᭮DŽԓ⸱⇥઼ᮠᦞ⇥Ⲵ䮯ᓖ࠶࡛Ѫ 0x3000 ઼ 0x1000 ᆇ㢲ˈᒦᑖᴹवਜ਼ 141 њ亩Ⲵㅖ ս〫ٿսؑ᚟DŽަ։਴⇥Ⲵ䮯ᓖ൷Ѫ 0DŽሩᓄⲴᢗ㹼᮷Ԧ hello Ⲵ冄ᮠᱟ 0413˄ZMAGIC˅ˈԓ⸱⇥Ӿ᮷Ԧ 䘈वᤜањ䮯ᓖѪ 0x28 ᆇ㢲Ⲵԓ⸱⇥઼ањާᴹ 3 њㅖਧ亩Ⲵㅖਧ㺘ԕ৺䮯ᓖѪ 0x10 ᆇ㢲Ⲵԓ⸱⇥䟽ᇊ ਟԕⴻࠪˈhello.o ⁑ඇ᮷ԦⲴ冄ᮠᱟ 0407˄OMAGIC˅ˈԓ⸱⇥㍗䐏൘ཤ㔃ᶴѻਾDŽ䲔Ҷ᮷Ԧཤ㔃ᶴԕཆˈ >XVUURRW@ QV\PVHQWU\[WUVL]H[GUVL]H[ [WH[W[GDWD[EVV[IODJV PDFKLQHW\SH [EPDJLF KHOOR >XVUURRW@RREMGXPSKKHOOR >XVUURRW@ 0RUHT  HIFD FFFIGEHGHEI EDHDD   F E >XVUURRW@KKH[GXPS[KHOOR_PRUH >XVUURRW@ QV\PVHQWU\[WUVL]H[GUVL]H[ [WH[W[GDWD[EVV[IODJV PDFKLQHW\SH [PDJLF KHOORR >XVUURRW@RREMGXPSKKHOORR F HHI HGIIIGF    GFF HHHIIIIIIHEF FFFIIFD   >XVUURRW@KKH[GXPS[KHOORR >XVUURRW@ >XVUURRW@JJFFRKHOORKHOORR >XVUURRW@JJFFFRKHOORRKHOORF ֻྲˈл䶒ࡇࠪҶ hello.o ⴞḷ᮷Ԧ৺ަᢗ㹼᮷Ԧѝ᮷ԦཤⲴާփ٬DŽ ൘ Linux 0.11 ㌫㔏ѝˈᡁԜਟԕ֯⭘ objdump ભԔᶕḕⴻ⁑ඇ᮷Ԧᡆᢗ㹼᮷Ԧѝ᮷Ԧཤ㔃ᶴⲴާփ٬DŽ 3.5.2 Linux 0.11 ѣⲺⴤḽᮽԬṲᕅ ࡍ࿻ॆⲴᮠ㓴DŽྲ᷌䈕ㅖਧ൘ԫ᜿ањ⁑ඇѝᐢ㓿㻛ᇊѹҶˈ䛓Ѹ䬮᧕〻ᒿቡՊ֯⭘䈕ᇊѹ㘼ᘭ⮕䈕٬DŽ ተ˅ᮠᦞDŽֻྲ〻ᒿѝᇊѹⲴᵚޘ˄ඇ˄Common block˅ᇊѹˈѫ㾱⭘Ҿ᭟ᤱᵚࡍ࿻ॆⲴཆ䜘ޡޜᡰ䉃Ⲵ Ѫ䈕ㅖਧ਽ᔪ・аඇᆈۘオ䰤ˈオ䰤Ⲵབྷሿᱟᡰᴹ㻛䬮᧕⁑ඇѝ䈕ㅖਧ٬ᴰབྷⲴањDŽ䘉њቡᱟ bss ⇥ѝ ਧራ൰Ⲵᆈۘオ䰤Ⲵབྷሿ٬DŽ൘䬮᧕᫽֌ᵏ䰤ˈྲ᷌䈕ㅖਧ⺞ᇎ⋑ᴹᇊѹˈ䛓Ѹ䬮᧕〻ᒿቡՊ൘ bss ⇥ѝ   LQX[ ⴞḷ᮷ԦṬᔿ/ 䘋〻䙫䗁ൠ൰オ䰤 0%  ԓ⸱ WH[W ึḸ VWDFN ึ KHDS  ᮠᦞ GDWD ᮠᦞ EVV ᵚࡍ࿻ॆ ަԆ GDWD ᮠᦞ WH[W ԓ⸱ KHDGHU DRXW ᢗ㹼᮷Ԧ ᤷᇊ䮯ᓖ ᮷Ԧᡆ㘵ᱟањᡰᴹ⁑ඇ㓴ਸ㘼ᡀⲴབྷ⁑ඇ᮷ԦDŽ൘䘉њ䗷〻ѝˈ䬮᧕〻ᒿⲴ俆㾱ԫ࣑ᱟ㔉ᢗ㹼᮷Ԧ˄ᡆ Ⲵᓃ࠭ᮠ⁑ඇ䘋㹼༴⨶ˈᴰ㓸⭏ᡀ⴨ᓄⲴҼ䘋ࡦᢗ㹼ޣⲴањᡆཊњ⁑ඇ᮷Ԧԕ৺⴨ޕ䬮᧕〻ᒿሩ䗃 3.5.3 䬴᧛ぁᓅ䗉࠰ 0DŽമѝ heap ᱟึオ䰤४ˈ⭘Ҿ࠶䝽䘋〻൘ᢗ㹼䗷〻ѝࣘᘱ⭣䈧Ⲵ޵ᆈオ䰤DŽ ޘ޵ᆈՊ㻛䇮㖞Ѫ മѝ bss ᱟ䘋〻Ⲵᵚࡍ࿻ॆᮠᦞ४ˈ⭘Ҿᆈ᭮䶉ᘱⲴᵚࡍ࿻ॆᮠᦞDŽ൘ᔰ࿻ᢗ㹼〻ᒿᰦ bss Ⲵㅜ 1 亥 ഴ DRXW ᢝ㺂ᮽԬ᱖ሺࡦ䘑ぁ䙱䗇൦൶グ䰪  䴰≲亥ᢰᵟਟԕ࣐ᘛ〻ᒿⲴ࣐䖭Ⲵ䙏ᓖDŽ ޵ᆈ亥䶒ѝˈ㘼൘䘋㹼࣐䖭᫽֌Ⲵ fs/execve()࠭ᮠѝӵӵѪަ䇮㖞Ҷ࠶亥ᵪࡦⲴ亥ⴞᖅ亩઼亥㺘亩ˈഐ↔ ᡽㻛࣐䖭ࡠ⢙⨶ى⭡Ҿ Linux 0.11 ޵Ṩ֯⭘䴰≲亥˄Demand-paging˅ᢰᵟˈণ൘а亥ԓ⸱ᇎ䱵㾱֯⭘Ⲵᰦ Ⲵ䙫䗁オ䰤བྷሿᱟ 64MBDŽሩ Ҿ ZMAGIC ㊫රⲴ a.out ᢗ㹼᮷ԦˈᆳⲴԓ⸱४Ⲵ䮯ᓖᱟ޵ᆈ亥䶒ⲴᮤᮠؽDŽ ㌫㿱മ 3-8 ᡰ⽪DŽLinux 0.11 ㌫㔏ѝ䘋〻ޣ⻱ⴈк a.out ᢗ㹼᮷ԦⲴ਴४൘䘋〻䙫䗁ൠ൰オ䰤ѝⲴሩᓄ >XVUURRW@ QV\PVHQWU\[WUVL]H[GUVL]H[ [WH[W[GDWD[EVV[IODJV PDFKLQHW\SH [EPDJLF KHOOR >XVUURRW@RREMGXPSKKHOOR KHOOR1RYUZ[[[URRW >XVUURRW@OOOKHOOR >XVUURRW@VVWULSKHOOR  QV\PVHQWU\[WUVL]H[GUVL]H[ [WH[W[GDWD[EVV[IODJV PDFKLQHW\SH [EPDJLF KHOOR >XVUURRW@RREMGXPSKKHOOR KHOOR1RYUZ[[[URRW >XVUURRW@OOOKHOOR ሿࡠ 17412 ᆇ㢲DŽ ਧؑ᚟DŽਟԕⴻࠪ hello ᢗ㹼᮷ԦⲴㅖਧ㺘䮯ᓖਈᡀҶ 0ˈᒦф hello ᮷ԦⲴ䮯ᓖҏӾ৏ᶕⲴ 20591 ᆇ㢲߿ ਧ㺘DŽᡁԜਟԕ֯⭘ભԔ strip ࡐ䲔ᢗ㹼᮷ԦѝⲴㅖਧ㺘ؑ᚟DŽֻྲл䶒ᡁԜࡐ䲔Ҷ hello ᢗ㹼᮷ԦѝⲴㅖ   LQX[ ⴞḷ᮷ԦṬᔿ/ 'DWD 'DWD 'DWD GDWD  7H[W 7H[W 7H[W ⁑ඇ᮷Ԧ  ཤ䜘  ⁑ඇ᮷Ԧ 'DWD ԓ⸱⇥ EVV ⇥ ᮠᦞ⇥ ᢗ㹼᮷Ԧ 䗃ࠪ᮷Ԧ FRPPRQ EVV WH[W  EVV 'DWD 7H[W EVV 'DWD 7H[W EVV 7H[W ᓃ⁑ඇ 亥䗩⭼ሩ喀 ᧕〻ᒿ᫽֌㘼ᆼᡀⲴDŽ൘ᔪ・䗷〻ѝ make 䘈࡙⭘޵ṨⓀԓ⸱ tools/ⴞᖅлⲴ build.c 〻ᒿ㕆䈁⭏ᡀҶањ⭘ ሩҾ Linux 0.11 ޵ṨⲴ㕆䈁䗷〻ˈᆳᱟṩᦞ޵ṨⲴ䝽㖞᮷Ԧ Makefile ֯⭘ make ભԔᤷᥕ㕆䈁ಘ઼䬮 on demand˅ࣘᘱ࣐䖭ࡠ޵ᆈѝDŽ ᮷ԦѝⲴԓ⸱઼ᮠᦞሶՊ൘ᇎ䱵ᢗ㹼ࡠᡆ⭘ࡠᰦ࡙⭘䴰≲࣐䖭ᢰᵟ˄Loadۿᢰᵟ৫ᢗ㹼〻ᒿDŽᢗ㹼〻ᒿ᱐ ᇴᆈಘ٬ਾ࡙⭘ึḸ䘄എޣⲴ৲ᮠؑ᚟ඇᒦѪަᶴᔪањԫ࣑ᮠᦞ㔃ᶴDŽ᧕⵰൘䇮㖞ҶаӋ⴨ޕԔ㹼к䗃 ਸ䘲Ⲵਟᢗ㹼᮷Ԧˈণަ冄ᮠ㊫රᱟ੖Ѫ ZMAGICˈ❦ਾ㌫㔏൘⭘ᡧᘱึḸ亦䜘Ѫ〻ᒿ䇮㖞⧟ຳ৲ᮠ઼ભ ᖃ Linux 0.11 ޵Ṩ࣐䖭ањਟᢗ㹼᮷ԦᰦˈᆳՊṩᦞ᮷Ԧཤ䜘㔃ᶴѝⲴؑ᚟俆ݸࡔᯝ᮷Ԧᱟ੖ᱟањ 喀DŽ ඇ᮷ԦѝⲴ਼㊫ර⇥亪ᒿᆈ᭮ˈᒦ᤹ᆇ䘋㹼䗩⭼ሩ⁑ޕ䲿ᮠᦞ⇥ᔰ࿻᭮㖞DŽ൘⇿њ⇥޵ˈ䬮᧕〻ᒿՊᢺ䗃 䗃ࠪ᮷ԦѝⲴԓ⸱⇥㻛䇮㖞ᡀӾപᇊൠ൰ 0 ᔰ࿻DŽᮠᦞ⇥ࡉӾԓ⸱⇥ਾлањ亥䶒䗩⭼ᔰ࿻DŽbss ⇥ࡉ㍗ ↔ਾ䬮᧕〻ᒿቡਟԕѪᡰᴹ⇥࠶䝽ൠ൰DŽሩҾ Linux 0.11 ㌫㔏ѝ֯⭘Ⲵ ZMAGIC ㊫රⲴ a.out Ṭᔿˈ ⴤḽᮽԬⲺ䬴᧛ᬃ֒ ഴ  ⴻᖵˈᒦфᢺᆳԜ࠶䝽ᆈۘ൘ bss ⇥Ⲵᵛቮ༴DŽ ඇᶕޡޜᒦ༴⨶Ҷᡰᴹ⁑ඇѻਾˈԫօާᴹ䶎䴦٬Ⲵᵚ䀓᷀Ⲵཆ䜘ㅖਧ䜭ሶ֌Ѫޕ઼ bss ⇥ⲴབྷሿDŽ൘䈫 ඇDŽ䬮᧕〻ᒿՊ᭦䳶⇿њ⁑ඇ᮷Ԧवᤜԫօᓃ࠭ᮠ⁑ඇѝⲴԓ⸱⇥ǃᮠᦞ⇥ޡޜተ˅ㅖਧⲴޘ˄ⴻլཆ䜘 ᛵߥ㿱മ 3-9 ᡰ⽪DŽ⇿њ⁑ඇ᮷Ԧ䜭ᴹањԓ⸱⇥˄text˅ǃᮠᦞ⇥˄data˅઼ањ bss ⇥ˈҏ䇨䘈ՊᴹаӋ ඇ᮷Ԧ઼䴰㾱䘎᧕ањᓃ࠭ᮠ⁑ඇⲴᛵߥˈަᆈۘ࠶䝽⁑ޕ㹼ᆈۘ࠶䝽∄䖳ᇩ᱃DŽֻྲˈሩҾާᴹєњ䗃 ሩҾ a.out ṬᔿⲴ⁑ඇ᮷Ԧᶕ䈤ˈ⭡Ҿ⇥㊫රᱟ亴ݸ⸕䚃Ⲵˈഐ↔䬮᧕〻ᒿሩ a.out ṬᔿⲴ⁑ඇ᮷Ԧ䘋 ⇥ਸᒦᡀањ⇥᭮൘䗃ࠪⲴᢗ㹼᮷ԦѝDŽ ඇ᮷ԦѝⲴԓ⸱⁑ޕ൘а䎧ˈ൘䗃ࠪ᮷ԦѝѪᤷᇊ⇥㊫රᖒᡀঅаањ⇥DŽֻྲˈ䬮᧕〻ᒿ䴰㾱ᢺᡰᴹ䗃 ⇿њ⁑ඇ᮷Ԧѝवᤜࠐ⿽㊫රⲴ⇥ˈ䬮᧕〻ᒿⲴㅜҼњԫ࣑ቡᱟᢺᡰᴹ⁑ඇѝ⴨਼㊫රⲴ⇥㓴ਸ䘎᧕ ᴹ⺞ᇊлᶕѻࡽㅖਧᱟ⋑ᴹ࣎⌅䀓᷀ⲴDŽ ᡰԕ൘ㅖਧሩᓄⲴս㖞⋑ˈޣ઼ԓ⸱؞↓᫽֌DŽഐѪ⁑ඇ᮷ԦѝᇊѹⲴབྷཊᮠㅖਧо᮷ԦѝⲴᆈۘս㖞ᴹ 㘵䗃ࠪⲴ⁑ඇ᮷Ԧ˅䘋㹼ᆈۘオ䰤࠶䝽᫽֌DŽаᰖᆈۘս㖞⺞ᇊˈ䬮᧕〻ᒿቡਟԕ㔗㔝ᢗ㹼ㅖਧ䛖ᇊ᫽֌   LQX[ ⴞḷ᮷ԦṬᔿ/ @>XVUURRW BHQG G BHGDWD F  BHWH[W HQG G HGDWD F  HWH[W >XVUURRW@SUHGHI >XVUURRW@JJFFRSUHGHISUHGHIF ൰ˈণӾᢗ㹼〻ᒿ㻛࣐䖭ࡠ޵ᆈս㖞ᔰ࿻㇇䎧Ⲵൠ൰DŽ ൘ Linux 0.1X ㌫㔏л䘀㹼䈕〻ᒿਟԕᗇࡠԕл㔃᷌DŽ䈧⌘᜿ˈ䘉Ӌൠ൰䜭ᱟ〻ᒿൠ൰オ䰤ѝⲴ䙫䗁ൠ ` UHWXUQ  BHQG BHGDWD BHWH[W  BHQG S?Q BHGDWD S BHWH[W S  SULQWI  HQG HGDWD HWH[W  HQG S?Q HGDWD S HWH[W S  SULQWI ^  LQWPDLQ H[WHUQLQWBHWH[WBHGDWDBHQG H[WHUQLQWHQGHWH[WHGDWD  3ULQWWKHV\PEROVSUHGHILQHGE\OLQNHU    ਼ⲴDŽ ㅖਧⲴൠ൰٬ᱟ⴨ B  л䶒〻ᒿ SUHGHIF ਟ⭘Ҿᱮ⽪ࠪ䘉ࠐњਈ䟿Ⲵൠ൰DŽਟԕⴻࠪᑖонᑖлࡂ㓯  ↔ᰦ HW ਜ਼ᴹ↓᮷⇥㔃ᶏ༴ਾ䶒Ⲵൠ൰DŽBHWH[W   HW LQW   LQWHW H[WHUQLQWBHWH[W  HQG ㅹDŽֻྲ˖ ˈֻྲ 䘉Ӌਈ䟿਽ᗵ享ⴻ֌ᱟൠ൰DŽഐ↔൘䇯䰞ᆳԜᰦ䴰㾱֯⭘ਆൠ൰ࡽ㔰 䗃ࠪㅹ᫽֌Պ᭩ਈ䘉њս㖞DŽഐ↔〻ᒿᖃࡽⲴ brk ս㖞䴰㾱֯⭘ sbrk()ᶕਆᗇDŽ⌘᜿ˈ/ޕmalloc()ԕ৺ḷ߶䗃 ᖃ〻ᒿࡊᔰ࿻ᢗ㹼ᰦˈަ brk ᡰᤷս㖞о_end ༴Ҿ⴨਼ս㖞DŽնᱟ㌫㔏䈳⭘ sys_brk()ǃ޵ᆈ࠶䝽࠭ᮠ HWH[WǃHGDWD ઼ HQGDŽ 㔰Ⲵ਽〠ㅹ਼Ҿнᑖлࡂ㓯Ⲵሩᓄ਽〠ˈᆳԜѻ䰤Ⲵୟа४࡛൘Ҿ $16,ǃ326,; ㅹḷ߶ѝ⋑ᴹᇊѹㅖਧ ࡽ B ४ਾ䶒Ⲵㅜ 1 њൠ൰˗_end ઼ end Ⲵൠ൰ᱟᵚࡍ࿻ॆᮠᦞ४˄bss˅ਾⲴㅜ 1 њൠ൰ս㖞DŽᑖлࡂ㓯 ਈ䟿਽_etext ઼ etext Ⲵൠ൰ᱟ〻ᒿ↓᮷⇥㔃ᶏਾⲴㅜ 1 њൠ൰˗_edata ઼ edata Ⲵൠ൰ᱟࡍ࿻ॆᮠᦞ edataǃ_edataǃend ઼_endDŽ ԕ䙊䗷䇯䰞䘉ࠐњཆ䜘ਈ䟿ᶕ㧧ᗇ〻ᒿѝ⇥Ⲵս㖞DŽ䬮᧕ಘ亴ᇊѹⲴཆ䜘ਈ䟿䙊ᑨ㠣ቁᴹ etextǃ_etextǃ ൘䬮᧕䗷〻ѝˈ䬮᧕ಘ ld ઼ ld86 Պ֯⭘ਈ䟿䇠ᖅлᢗ㹼〻ᒿѝ⇿њ⇥Ⲵ䙫䗁ൠ൰DŽഐ↔൘〻ᒿѝਟ 3.5.4 䬴᧛ぁᓅ人ᇐѿ਎䠅 䊑᮷ԦDŽ bootsectǃsetup ઼ system ᮷ԦѝⲴᢗ㹼ཤ㔃ᶴˈ❦ਾᢺᆳԜ亪ᒿ㓴ਸ൘а䎧ӗ⭏ањ਽Ѫ Image Ⲵ޵Ṩ᱐ ѝˈഐ↔㕆䈁ӗ⭏Ⲵ޵Ṩ਴⁑ඇѝⲴᢗ㹼ཤ㔃ᶴ䜘࠶䴰㾱৫ᦹDŽᐕާ〻ᒿ build ѫ㾱࣏㜭ቡᱟ࠶࡛৫ᦹ Ҿ㓴ਸᡰᴹ⁑ඇⲴѤᰦᐕާ〻ᒿ buildDŽ⭡Ҿ޵Ṩᱟ⭡ᕅሬ੟ࣘ〻ᒿ࡙⭘ ROM BIOS ѝᯝ䈳⭘࣐䖭ࡠ޵ᆈ   LQX[ ⴞḷ᮷ԦṬᔿ/ ㅖਧ㻛ⴻ֌ᱟᵚᇊѹⲴᕅ⭘DŽޡޜᴹ਼а਽〠DŽྲ᷌䈕ㅖਧᇊѹ൘ަԆൠᯩˈࡉ ㅖਧਟ㜭ާޡޜㅖਧᱟᵚࡍ࿻ॆⲴᮠᦞDŽ൘䬮᧕ᰦˈཊњޡޜⲴDŽޡޜC Common ㅖਧᱟ B BSS ㅖਧ൘ᵚࡍ࿻ॆᮠᦞ४ᡆ४˄section˅ѝˈণ൘ BSS ⇥ѝDŽ ᒦф൘䘋а↕䬮᧕䗷〻ѝнՊ㻛᭩ਈDŽˈA Absolute ㅖਧⲴ٬ᱟ㔍ሩ٬ ㅖਧ㊫ර ਽〠 䈤᰾ 㺞 ⴤḽᮽԬㅜਭࡍ㺞ᮽԬѣⲺㅜਭ㊱ශ ᮷Ԧ LQFOXGHDRXWK ѝ QOLVW^`㔃ᶴ QBW\SH ᆇ⇥Ⲵᇊѹ˄ㅜ 110--185 㹼˅DŽ ተⲴ˄ཆ䜘Ⲵ˅DŽ৲㿱ޘ᷌ㅖਧ㊫රᱟሿ߉ᆇㅖˈࡉ䈤᰾ㅖਧᱟተ䜘Ⲵ˗ྲ᷌ᱟབྷ߉ᆇㅖˈࡉ䈤᰾ㅖਧᱟ DŽྲޣㅜ 2 ḿѝⲴㅖਧ㊫රᤷ⽪ㅖ䙊ᑨᴹ㺘 3-5 ᡰ⽪Ⲵࠐ⿽ˈਖཆ䘈ᴹаӋо䟷⭘Ⲵⴞḷ᮷ԦṬᔿ⴨ ଚњ४˄sections˅ᡆަ኎ᙗ˗ㅜ 3 ḿᱟሩᓄⲴㅖਧ਽〠DŽ ൠ൰˅˗ㅜ 2 ḿᱟㅖਧ㊫රˈᤷ᰾ㅖਧսҾⴞḷ᮷ԦⲴ˄ަѝ⇿㹼䈤᰾ањㅖਧˈㅜ 1 ḿᤷ᰾ㅖਧ٬ FESLUTBWDEOH FESFLBELRVBSUHVHQW FFEGPLBLGHQW FD%LVBVRQ\BYDLRBODSWRS FD%GPLBEURNHQ ਧ㺘Ⲵṧֻྲлᡰ⽪˖ 〻ᒿࠪ䭉ᰦˈቡਟԕ㧧ᗇᡁԜ∄䖳ᇩ᱃䇶࡛Ⲵؑ᚟DŽㅖޣ࡙⭘ System.map ㅖਧ㺘᮷Ԧˈ൘޵Ṩᡆ⴨ ਧ㺘䀓᷀ˈቡਟԕḕࡠањൠ൰٬ሩᓄⲴਈ䟿਽ˈᡆ৽ѻDŽ ޵ṨⲴ㕆䈁ˈቡՊӗ⭏ањᯠⲴሩᓄ 6\VWHPPDS ᮷ԦDŽᖃ޵Ṩ䘀㹼ࠪ䭉ᰦˈ䙊䗷 6\VWHPPDS ᮷ԦѝⲴㅖ ਧ৺ަሩᓄൠ൰Ⲵањࡇ㺘ˈᖃ❦ҏवᤜк䶒䈤᰾Ⲵ_etextǃ_edata ઼_end ㅹㅖਧⲴൠ൰ؑ᚟DŽ䲿⵰⇿⅑ ޵ṨᰦˈOLQX[0DNHILOH ᮷Ԧӗ⭏Ⲵ System.map ᮷Ԧቡ⭘Ҿᆈ᭮޵Ṩㅖਧ㺘ؑ᚟DŽㅖਧ㺘ᱟᡰᴹ޵Ṩㅖ ᚟䟽ᇊੁࡠањ᮷Ԧѝ˄ֻྲ 6\VWHPPDS˅DŽ൘㕆䈁ؑۿ䙊ᑨᡁԜՊᢺਁ䘱ࡠḷ߶䗃ࠪ䇮༷Ⲵ䬮᧕᱐ „ 䬮᧕ѝवਜ਼Ⲵᡰᴹ᮷Ԧᡀઈ৺ަᕅ⭘ⲴㅖਧDŽ ㅖਧྲօ᭮㖞˗ޡޜ „ ˗„ ⴞḷ᮷Ԧ৺ㅖਧؑ᚟᱐ሴࡠ޵ᆈѝⲴս㖞 ࡠ޵ᆈѝⲴս㖞ؑ᚟DŽާփᶕ䇢ᴹྲлؑ᚟˖ޕѝࡇࠪҶ〻ᒿ⇥㻵 ᚟DŽަؑۿlink map˅ؑ᚟ˈণᱟᤷ⭡䘎᧕〻ᒿӗ⭏Ⲵⴞḷ〻ᒿ޵ᆈൠ൰᱐˄ۿᱟቿᒅ˅кᢃঠࠪ䬮᧕᱐ 䘹亩ˈᡆ㘵֯⭘ QP ભԔˈࡉՊ൘ḷ߶䗃ࠪ䇮༷˄䙊ᑨ 0 ᖃ䘀㹼 GNU 䬮᧕ಘ gld˄ld˅ᰦ㤕֯⭘Ҷ 3.5.5 System.map ᮽԬ Ԧ Image ൘޵ᆈѝⲴᵛㄟਾⲴս㖞ˈᒦӾ䘉њս㖞䎧ᔰ࿻䇮㖞儈䙏㕃ߢ४DŽ ᮷ۿ Linux 0.1x ޵Ṩ൘ࡍ࿻ॆඇ䇮༷儈䙏㕃ߢ४ᰦ˄fs/buffer.c˅ˈቡ֯⭘Ҷਈ䟿਽_end ᶕ㧧ਆ޵Ṩ᱐ >URRW#SOLQX[@ DFBHQG [ DBHGDWD [ BHWH[W [E DFHQG [ DHGDWD [ HWH[W [E >URRW#SOLQX[@SUHGHI ㌫㔏ѝ〻ᒿԓ⸱Ӿަ䙫䗁ൠ൰ 0x08048000 ༴ᔰ࿻ᆈ᭮ˈഐ↔ਟ⸕䘉њ〻ᒿⲴԓ⸱⇥䮯ᓖᱟ 0x41b ᆇ㢲DŽ ྲ᷌൘⧠൘Ⲵ Linux ㌫㔏˄ֻྲ RedHat 9˅ѝ䘀㹼䘉њ〻ᒿˈቡਟᗇࡠԕл㔃᷌DŽᡁԜ⸕䚃⧠൘ Linux    LQX[ ⴞḷ᮷ԦṬᔿ/  FRPPDQG ભԔ  SUHUHTXLVLWHV ݸߣᶑԦ WDUJHW ⴞḷ ㆰঅⲴ Makefile ᮷Ԧਜ਼ᴹаӋ㿴ࡉˈ䘉Ӌ㿴ࡉާᴹྲлⲴᖒᔿ˖ ԕࡽቡ㕆䈁ྭⲴᗵ享䘎᧕൘а䎧ԕ⭏ᡀᯠⲴਟᢗ㹼᮷ԦDŽ ᒿሩᓄⲴⴞḷ᮷ԦDŽᴰ㓸ˈྲ᷌ԫօⓀԓ⸱᮷Ԧ㻛㕆䈁䗷Ҷˈ䛓ѸᡰᴹⲴⴞḷ᮷Ԧн㇑ᱟࡊ㕆䈁ᆼⲴ䘈ᱟ ањवਜ਼䈕ཤ᮷ԦⲴ C ԓ⸱〻ᒿ䜭ሶ㻛䟽ᯠ㕆䈁DŽ⇿⅑㕆䈁᫽֌䜭ӗ⭏ањоⓀ〻⇿ˈ⺞↓؍⺞䛓ѸѪҶ ᖃ make 䟽ᯠ㕆䈁〻ᒿᰦˈ⇿њ؞᭩䗷Ⲵ C ԓ⸱᮷Ԧᗵ享㻛䟽ᯠ㕆䈁DŽྲ᷌ањཤ᮷Ԧ㻛؞᭩䗷Ҷˈ ᶕ᫽֌DŽ മDŽ൘ㅜҼ䱦⇥ᵏ䰤ˈmake ቡ֯⭘䘉Ӌ޵䜘㔃ᶴᶕ⺞ᇊଚњⴞḷሩ䊑䴰㾱㻛䟽ᔪˈᒦф֯⭘⴨ᓄⲴ㿴ࡉ Ჟޘ᮷Ԧㅹˈ䇠ᖅᡰᴹⲴਈ䟿৺ަ٬ǃ䳀ᔿⲴᡆᱮᔿⲴ㿴ࡉˈᒦᶴ䙐ࠪᡰᴹⴞḷሩ䊑৺ަݸߣᶑԦⲴаᑵ makeⲴᢗ㹼䗷〻࠶Ѫєњн਼Ⲵ䱦⇥DŽ൘ㅜањ䱦⇥ˈᆳ䈫ਆᡰᴹⲴMakefile᮷Ԧԕ৺वਜ਼ⲴMakefile ␵⨶᫽֌㘼ࡐ䲔ḀӋ᮷Ԧ˅DŽ 䇹 make ྲօ㕆䈁઼䘎᧕ањ᮷ԦDŽᖃ᰾⺞ᤷࠪᰦˈMakefile 䘈ਟԕ੺䇹 make 䘀㹼਴⿽ભԔ˄ֻྲˈ֌Ѫ ӋӰѸᐕ֌DŽ䙊ᑨˈMakefile ᮷ԦՊ੺ڊѪҶ֯⭘ make 〻ᒿˈ֐ቡ䴰㾱 Makefile ᮷Ԧᶕ੺䇹 make 㾱 ṩᦞк䶒Ⲵ Makefile ᮷Ԧ֌ӋㆰঅⲴӻ㓽DŽ䈖㓶䈤᰾䈧৲㘳 GNU make ֯⭘᡻޼DŽ ᇊањਜ਼ᴹᖸཊⓀ〻ᒿ᮷ԦⲴབྷර〻ᒿѝଚњ᮷Ԧ䴰㾱㻛䟽ᯠ㕆䈁DŽMakefile Ⲵ֯⭘∄䖳༽ᵲˈ䘉䟼ਚᱟ Makefile˄ᡆ makefile˅᮷Ԧᱟ make ᐕާ〻ᒿⲴ䝽㖞᮷ԦDŽMake ᐕާ〻ᒿⲴѫ㾱⭘䙄ᱟ㜭㠚ࣘൠߣ 3.6 Make ぁᓅૂ Makefile ᮽԬ ᓄⲴ޵Ṩਈ䟿਽〠ˈׯҾሩ޵ṨⲴ䈳䈅ᐕ֌DŽ ཊ䖟Ԧ䜭䴰㾱ᴹањ↓⺞Ⲵ 6\VWHPPDS ᮷ԦDŽ࡙⭘䈕᮷Ԧˈ䘉Ӌ〻ᒿቡਟԕṩᦞᐢ⸕Ⲵ޵ᆈൠ൰ḕ᢮ࠪሩ ቭ㇑޵Ṩᵜ䓛ᇎ䱵кн֯⭘ 6\VWHPPDSˈնަԆ〻ᒿˈ䊑 NORJGǃOVRIǃSV ԕ৺ަԆ䊑 GRVHPX ㅹ䇨 XVUVUFOLQX[6\VWHPPDS 6\VWHPPDS ERRW6\VWHPPDS ׍⅑Ѫ˖ ᰦˈྲ᷌⋑ᴹԕањ৲ᮠⲴᖒᔿѪ klogd 㔉ࠪ 6\VWHPPDS Ⲵս㖞ˈࡉ klogd ሶՊ൘йњൠᯩᩌራ 6\VWHPPDSDŽ 6\VWHPPDS սҾ֯⭘ᆳⲴ䖟Ԧ˄ֻྲ޵Ṩᰕᘇ䇠ᖅਾਠ〻ᒿ klogd˅㜭ཏራ᢮ࡠⲴൠᯩDŽ൘㌫㔏੟ࣘ ਟԕⴻࠪ਽〠Ѫ GPLBEURNHQ Ⲵਈ䟿սҾ޵Ṩൠ൰ [FD ༴DŽ DŽޣ? Unknwon ㅖਧⲴ㊫රᵚ⸕ˈᡆ㘵ᱟоާփ᮷ԦṬᔿᴹ ᆈ䈳䈅ؑ᚟DŽ؍- Stabs ㅖਧᱟ a.out ⴞḷ᮷ԦѝⲴањ stab ㅖਧˈ⭘Ҿ U Undefined ㅖਧᱟཆ䜘Ⲵˈᒦфަ٬Ѫ 0˄ᵚᇊѹ˅DŽ T Text ㅖਧᱟԓ⸱४ѝⲴㅖਧDŽ S Small ㅖਧᱟሿሩ䊑ᵚࡍ࿻ॆᮠᦞ४ѝⲴㅖਧDŽ R Read only ㅖਧ൘ањਚ䈫ᮠᦞ४ѝDŽ N Debugging ㅖਧᱟањ䈳䈅ㅖਧDŽ I Inderect ㅖਧᱟሩਖањㅖਧⲴ䰤᧕ᕅ⭘DŽ ተᮤරਈ䟿˅ਟ䘋㹼ᴤᴹ᭸Ⲵ䇯䰞DŽޘሩ䊑˄ֻྲањ G Global ㅖਧᱟ൘ሿሩ䊑ᐢࡍ࿻ॆᮠᦞ४ѝⲴㅖਧDŽḀӋⴞḷ᮷ԦⲴṬᔿݱ䇨ሩሿᮠᦞ D Data ㅖਧ൘ᐢࡍ࿻ॆᮠᦞ४ѝDŽ   0DNH 〻ᒿ઼ 0DNHILOH ᮷Ԧ Ⲵⴞḷ᮷Ԧ㔃ᶴᴹ⵰䶎ᑨ䟽㾱Ⲵ֌⭘ˈഐ↔ᵜㄐሩ Linux 0.11 ѝ֯⭘Ⲵ a.out ⴞḷ᮷ԦṬᔿ֌Ҷ䈖㓶ӻ㓽DŽ ֯⭘ᯩ⌅DŽ਼ᰦሩ Linux ޵Ṩ֯⭘Ⲵ C 䈝䀰ᢙኅ䈝ਕ䘋㹼Ҷ䈖㓶ӻ㓽DŽሩҾᆖҐ᫽֌㌫㔏ᶕ䈤ˈ㌫㔏᭟ᤱ ᵜㄐԕࠐњਟ䘀㹼Ⲵ≷㕆䈝䀰〻ᒿ֌Ѫ᧿䘠ሩ䊑ˈ䈖㓶䈤᰾Ҷ as86 ઼ GNU as ≷㕆䈝䀰Ⲵสᵜ䈝䀰઼ 3.7 ᵢㄖቅ㔉 ᮷ԦDŽ F Ⲵᡰᴹޣ㌫ˈ䟽ᯠ㕆䈁о䈕ཤ᮷Ԧᴹޣ᮷Ԧ㻛᭩ࣘ䗷ਾˈmake ቡ䙊䗷䘉Ӌ׍䎆 ㌫ᱟ⭘Ҿ䇙 make ᶕ⺞ᇊᱟ੖䴰㾱䟽ᔪањⴞḷሩ䊑DŽ∄ྲᖃḀњཤޣ Makefile ᮷Ԧᴰਾ⭏ᡀⲴ׍䎆 㿴ࡉDŽ㿴ࡉਟ㜭ⴻк৫㾱∄к䶒⽪ࠪⲴ⁑ᶯ༽ᵲᗇཊˈնสᵜк䜭ᱟㅖਸⲴDŽ ањ Makefile ᮷Ԧҏਟԕਜ਼ᴹ䲔㿴ࡉԕཆⲴަԆ᮷ᆇˈնањㆰঅⲴ Makefile ᮷Ԧਚ䴰㾱ਜ਼ᴹ䘲ᖃⲴ ᢗ㹼ањ᫽֌DŽ ᱟ⢩ᇊ㿴ࡉⲴⴞḷDŽmake ṩᦞݸߣᶑԦᶕᢗ㹼ભԔԕࡋᔪᡆᴤᯠⴞḷDŽањ㿴ࡉҏਟԕ䈤᰾ྲօ৺օᰦ ભԔⲴ㿴ࡉᒦн䴰㾱ᴹݸߣᶑԦDŽ↔ᰦˈањ㿴ࡉ䈤᰾Ҷྲօԕ৺օᰦᶕ䟽ᯠࡦ֌ḀӋ᮷Ԧˈ㘼䘉Ӌ᮷Ԧ Ⲵਜ਼ᴹࡐ䲔˄delete˅ޣ❦㘼ˈѪⴞḷ㘼ᤷᇊભԔⲴ㿴ࡉҏᒦнаᇊ㾱ᴹݸߣᶑԦDŽֻྲˈоⴞḷ'clean'⴨ 䙊ᑨભԔᱟ኎ҾањާᴹݸߣᶑԦⲴ㿴ࡉˈᒦ൘ԫօݸߣᶑԦ᭩ਈᰦ⭘Ҿ⭏ᡀањⴞḷ˄target˅᮷ԦDŽ  V QRVWGLQF,LQFOXGH6R &)/$*6 ?  &&  FV ԓ⸱DŽ V 〻ᒿ㕆䈁ᡀ F ᮷Ԧ਽DŽ㘼↓ᶑ make 㿴ࡉⲴਜ਼ѹᱟሶ F ٬ᱟ  ઼ⴞḷਾ㔰DŽ⴨ᓄⲴ䳀ᔿݸߣᶑԦᱟ䙊䗷֯⭘᮷Ԧ਽ѝⲴⓀਾ㔰ᴯᦒⴞḷਾ㔰ਾᗇࡠDŽഐ↔ˈ↔ᰦл䶒Ⲵ 䙊⭘ᴤ␵ᲠⲴ⁑ᔿ३䝽㿴ࡉ˅DŽл䶒ֻᆀቡᱟа⿽ৼਾ㔰㿴ࡉDŽৼਾ㔰㿴ࡉᱟ⭘аሩਾ㔰ᇊѹⲴ˖Ⓚਾ㔰 ਾ㔰㿴ࡉᱟѪ make 〻ᒿᇊѹ䳀ᔿ㿴ࡉⲴ㘱ᔿᯩ⌅˄⧠൘䘉⿽㿴ࡉᐢ㓿н⭘Ҷˈਆ㘼ԓѻⲴᱟ֯⭘ᴤ н߉㿴ࡉDŽ↔ᰦ make 〻ᒿሶՊṩᦞⓀ〻ᒿ᮷ԦⲴ㊫ර˄〻ᒿⲴਾ㔰˅ᶕࡔᯝ㾱֯⭘ଚњ䳀ᔿ㿴ࡉDŽ ѪҶ䇙 make 㜭֯⭘Ґᜟ⭘⌅ᶕᴤᯠањⴞḷሩ䊑ˈ֐ਟԕнᤷᇊભԔˈ߉ањнᑖભԔⲴ㿴ࡉᡆ㘵 ަѝⲴ’$<’ቡՊ㻛㠚ࣘൠᴯᦒᡀ foo.cˈ㘼$@ࡉՊ㻛ᴯᦒѪ foo.o R# &)/$*6 FFF IRRFGHIVKKDFNKIRRR  ݸߣᶑԦDŽֻྲ˖ ↓ᱟㅜањ  ᴹᰦˈݸߣᶑԦ䘈ᑨवਜ਼ཤ᮷Ԧˈ㘼䘉Ӌཤ᮷Ԧᒦнᝯ൘ભԔѝ䈤᰾DŽ↔ᰦ㠚ࣘਈ䟿 аӋ㠚ࣘਈ䟿䘉䟼ቡнᨀҶDŽ 㺘⽪ⴞḷሩ䊑˗ਖཆ䘈ᴹ # Ⲵ٬㺘⽪㿴ࡉѝⲴㅜањݸߣᶑԦ˗  ᶑԦˈवᤜᆳԜᡰ༴ⴞᖅⲴ਽〠˗ Ⲵ٬㺘⽪㿴ࡉⲴᡰᴹݸߣ A 㠚ࣘਈ䟿Ⲵ٬ᱟสҾⴞḷሩ䊑৺ަݸߣᶑԦ㘼൘ભԔᢗ㹼ࡽ䇮㖞ⲴDŽֻྲˈ ࡠDŽ㠚ࣘਈ䟿ᱟа⿽൘ભԔ㹼кṩᦞާփᛵߥ㜭㻛㠚ࣘᴯᦒⲴਈ䟿DŽڊԦDŽ䘉ቡ䴰㾱䙊䗷֯⭘㠚ࣘਈ䟿ᶕ ᵏᢗ㹼DŽഐ↔ˈ֐ᗵ享ሿᗳൠ䇮㖞ભԔˈ֯ᗇભԔ㜭ཏ൘ make ਁ⧠ݸߣᶑԦⲴⴞᖅѝ᢮ࡠ䴰㾱Ⲵݸߣᶑ ྲ᷌ањݸߣᶑԦ䙊䗷ⴞᖅᩌራ㘼൘ਖཆањⴞᖅѝ㻛᢮ࡠˈ䘉ᒦнՊ᭩ਈ㿴ࡉⲴભԔ˗ᆳԜሶ㻛ྲ ањࡦ㺘ㅖʽ䘉ᱟ㋇ᗳ㘵ᑨᑨᘭ⮕ⲴൠᯩDŽޕањભԔ㠚ᡀа㹼DŽ䈧⌘᜿ˈ֐䴰㾱൘⇿њભԔ㹼ѻࡽ䭞 ᱟ make 䴰㾱ᢗ㹼Ⲵ᫽֌DŽањ㿴ࡉਟԕᴹཊњભԔˈ⇿ ભԔ ᶑԦDŽ䙊ᑨањⴞḷ׍䎆ࠐњ᮷ԦDŽ㘼ޕ ᱟањᡆཊњ᮷Ԧ਽ˈᱟ⭘֌ӗ⭏ⴞḷⲴ䗃 ݸߣᶑԦ ˅DŽ FOHDQ ˄ ␵䲔 ᱟᡰ㾱䟷ਆ⍫ࣘⲴ਽ᆇˈ∄ྲ ሩ䊑䙊ᑨᱟ〻ᒿ⭏ᡀⲴањ᮷ԦⲴ਽〠˗ֻྲᱟањਟᢗ㹼᮷Ԧᡆⴞḷ᮷ԦDŽⴞḷҏਟԕ ⴞḷ ަѝ     ᵜㄐሿ㔃 Ѫ㔗㔝䰵䈫ᆼᮤⲴ Linux 0.11 ޵ṨⓀԓ⸱ᢃлඊᇎส⹰DŽ ᔿཊԫ࣑〻ᒿ⽪ֻˈ䙊䗷䰵䈫䘉њ⽪ֻˈᡁԜਟԕሩ᫽֌㌫㔏ᴰࡍྲօĀ᯻䖜ā䎧ᶕᴹањสᵜҶ䀓ˈᒦ ᣔ⁑؍ᣔ⁑ᔿлⲴᐕ֌৏⨶DŽᒦ㔉ࠪањ؍лаㄐᡁԜሶത㔅 Intel 80X86 ༴⨶ಘˈ䈖㓶ൠ䈤᰾ަ䘀㹼൘   ᵜㄐሿ㔃 䟼ᡁԜӵ䱏 EFLAGS ѝⲴ㌫㔏ḷᘇ䘋㹼䈤᰾DŽ PFǃ䖵ࣙ䘋ս AFǃ䴦ḷᘇ ZFǃ䍏ਧ SFǃᯩੁ DFǃⓒࠪ OF˅DŽ䘉 ڦḷᘇᱟаӋ䙊⭘ḷᘇ˄䘋ս CFǃཷ ᦒԕ৺㲊ᤏ-8086 ⁑ᔿˈ㿱മ 4-1 ᡰ⽪DŽ䙊ᑨਚݱ䇨᫽֌㌫㔏ԓ⸱ᴹᵳ؞᭩䘉ӋḷᘇDŽEFLAGS ѝⲴަԆ ḷᘇᇴᆈಘ EFLAGS ѝⲴ㌫㔏ḷᘇ઼ IOPL ᆇ⇥⭘Ҿ᧗ࡦ I/O 䇯䰞ǃਟቿ㭭⺜Ԧѝᯝǃ䈳䈅ǃԫ࣑࠷ 4.1.1 ḽᘍᇺᆎಞ 㔏㺘Ⲵสൠ൰ǃ᧗ࡦ༴⨶ಘ᫽֌Ⲵ∄⢩ḷᘇսDŽ ༴⨶ǃᤷԔ䐏䑚ԕ৺䇯䰞ᵳ䲀DŽ㌫㔏ᇴᆈಘ⭘Ҿ޵ᆈ㇑⨶઼᧗ࡦ༴⨶ಘ᫽֌ˈਜ਼ᴹ࠶⇥઼࠶亥༴⨶ᵪࡦ㌫ ಘˈ䲔ҶаӋ䙊⭘⣦ᘱḷᘇཆˈEFLAGS ѝ䘈वਜ਼ࠐњ㌫㔏ḷᘇDŽ䘉Ӌ㌫㔏ḷᘇ⭘Ҿ᧗ࡦԫ࣑࠷ᦒǃѝᯝ ѪҶॿࣙ༴⨶ಘᢗ㹼ࡍ࿻ॆ઼᧗ࡦ㌫㔏᫽֌ˈ80X86 ᨀ׋Ҷањḷᘇᇴᆈಘ EFLAGS ઼ࠐњ㌫㔏ᇴᆈ 4.1 80X86 ㌱㔕ᇺᆎಞૂ㌱㔕᤽Ԛ ᡽ᔰ࿻䰵䈫ਾ㔝ㄐ㢲ѝⲴ Linux ޵Ṩԓ⸱DŽ 䀓ᵜㄐ޵ᇩѻਾ⨶ޘ൘䰵䈫޵ṨⓀԓ⸱ᰦ䈫㘵ਟԕ䲿ᰦഎ䗷ཤᶕ৲㘳ᵜㄐ޵ᇩDŽഐ↔ᒦнࣹᕪ䈫㘵䴰㾱ᆼ 㤕䈫㘵ሩ䘉䜘࠶޵ᇩᐢ㓿∄䖳⟏ᚹˈ䛓Ѹਟԕⴤ᧕䰵䈫ᵜㄐᴰਾ㔉ࠪⲴањਟ䘀㹼Ⲵ޵ṨᇎֻDŽᖃ❦ˈ ൘䲿ਾ䰵䈫 Linux ޵ṨⓀԓ⸱ᰦቡнᓄ䈕޽Պ⻠ࡠӰѸབྷ䰞仈ҶDŽ ᆈ࠶⇥㇑⨶઼ԫ࣑㇑⨶Ⲵᇎ⧠ᯩ⌅ˈ⋑ᴹवᤜ࠶亥ᵪࡦ޵ᇩDŽն㤕㜭ᖫᓅ⨶䀓䘉њᇎֻⲴ䘀֌ᵪࡦˈ䛓Ѹ ᵜㄐᴰਾ䜘࠶ӻ㓽Ⲵањㆰঅཊԫ࣑޵ṨᱟสҾ Linux 0.11 ޵ṨⲴањㆰॆᇎֻDŽ䈕ᇎֻ⭘Ҿ╄⽪޵ ᣔ⁑ᔿ㕆〻Ⲵࡍ࿻ॆ˗7. ањㆰঅⲴཊԫ࣑޵ṨֻᆀDŽ؍ .઼ᔲᑨ༴⨶˗5. ԫ࣑㇑⨶˗6 ᣔ᧚ᯭ˗4. ѝᯝ؍ᣔ⁑ᔿ޵ᆈ㇑⨶˗3. ਴⿽؍ .Ⓚԓ⸱ᢃл᡾ᇎส⹰DŽѫ㾱वᤜ˖1. 80X86 ส⹰⸕䇶˗2 ᣔ⁑ᔿл㕆〻ⲴаӋส⹰⸕䇶ˈѪ߶༷䰵䈫สҾ 80X86 CPU Ⲵ Linux ޵Ṩ؍80X86 CPU Ⲵփ㌫㔃ᶴԕ৺ ਨⲴ㖁ㄉкݽ䍩л䖭DŽᵜㄐѫ㾱ᾲ㾱᧿䘠ޜ Ⲵ৲㘳䍴ᯉˈᵜㄐ޵ᇩѫ㾱ਆ㠚Ҿ䈕ҖDŽ䘉Ӌ䍴ᯉਟԕӾ Intel ަᱟަѝㅜ 3 ধ˖lj㌫㔏㕆〻ᤷইNJᱟ⨶䀓֯⭘ 80X86 CPU Ⲵ᫽֌㌫㔏ᐕ֌৏⨶ᡆ䘋㹼㌫㔏㕆〻ᗵнਟቁ ਨਁ㹼Ⲵа྇йধⲴljIA-32 Intel փ㌫㔃ᶴ䖟Ԧᔰਁ㘵᡻޼NJˈቔޜ ㌫㔏㕆〻Ⲵᴰ֣৲㘳Җ㉽ᖃ❦ᱟ Intel 80X86 CPU ޣཆത⺜Ԧ㓴ᡀⲴ PC ᵪ㌫㔏DŽᴹޣਨ 80X86 ৺⴨ޜ ᵜҖӻ㓽Ⲵ Linux ᫽֌㌫㔏สҾ Intel ᣔ⁑ᔿ৺ަ㕆〻؍ ㅜ4ㄐ80X86  ㌫㔏ᇴᆈಘ઼㌫㔏ᤷԔ; 2)ⓒࠪḷᘇ ')ᯩੁḷᘇ 6)䍏ਧḷᘇ =)䴦ḷᘇ $)䖵ࣙ䘋ս 3)ᚒ༽ḷᘇ &)䘋սḷᘇ 7)䐏䑚ḷᘇ ,)ѝᯝݱ䇨ḷᘇ ,23/,2⢩ᵳ㓗 17፼྇ԫ࣑ḷᘇ 5)ᚒ༽ḷᘇ 90㲊ᤏ ⁑ᔿ 0 9 ) 75 1 3/ ,2 ) ) = 2 ) ' ) , ) 7 ) )$ )3 & ) ⮉˄䇮㖞Ѫ ˅ 6؍               ᣔ⁑ᔿ޵ᆈ㇑⨶āѝⲴ䈖㓶䈤᰾DŽ؍⭘䈧৲㿱ла㢲Ā ㌫㔏㺘Ⲵ֌ޣᆈᨀ׋Ҷ⢩ᇊⲴᤷԔDŽᴹ؍㌫㔏㺘Ⲵสൠ൰ˈ㿱മ 4-2 ᡰ⽪DŽ༴⨶ಘѪ䘉ӋᇴᆈಘⲴ࣐䖭઼ ༴⨶ಘᨀ׋Ҷ 4 њ޵ᆈ㇑⨶ᇴᆈಘ˄GDTRǃLDTRǃIDTR ઼ TR˅ˈ⭘Ҿᤷᇊ࠶⇥޵ᆈ㇑⨶ᡰ֯⭘Ⲵ 4.1.2 ޻ᆎ㇗⨼ᇺᆎಞ ᣔ⁑ᔿDŽ؍༽ս䈕ḷᘇᰦˈࡉഎࡠ VM ս 17 ᱟ㲊ᤏ-8086 ᯩᔿ˄Virtual-8086 Mode˅ḷᘇDŽᖃ䇮㖞䈕ḷᘇᰦˈቡᔰ੟㲊ᤏ-8086 ᯩᔿ˗ᖃ ಘՊ൘ᤷԔ䘄എѻਾ㠚ࣘൠ␵䲔䈕ḷᘇˈӾ㘼޽⅑ݱ䇨ᤷԔᯝ⛩ᔲᑨDŽ 〻ᒿѻࡽˈ䴰㾱䇮㖞ึḸк EFLAGS ޵ᇩѝⲴ RF ḷᘇˈԕ䱢→ᤷԔᯝ⛩䙐ᡀਖањᔲᑨDŽ༴⨶ Ⲵѫ㾱࣏㜭ᱟݱ䇨൘䈳䈅ᔲᑨѻਾ䟽ᯠᢗ㹼аᶑᤷԔDŽᖃ䈳䈅䖟Ԧ֯⭘ IRETD ᤷԔ䘄എ㻛ѝᯝ ᘇՊѤᰦ⾱→ᯝ⛩ᤷԔӗ⭏Ⲵ䈳䈅ᔲᑨ˗ᖃ䈕ḷᘇ༽սᰦˈࡉᯝ⛩ᤷԔሶՊӗ⭏ᔲᑨDŽRF ḷᘇ RF ս 16 ᱟᚒ༽ḷᘇ˄Resume Flag˅DŽ䈕ḷᘇ⭘Ҿ᧗ࡦ༴⨶ಘሩᯝ⛩ᤷԔⲴ૽ᓄDŽᖃ䇮㖞ᰦˈ䘉њḷ նᱟ൘ᓄ⭘〻ᒿѝ᭩ਈ䘉њḷᘇⲴ⣦ᘱՊӗ⭏нਟ᜿ᯉⲴᔲᑨDŽ ԫ࣑䘄എᰦˈ༴⨶ಘՊỰḕᒦ؞᭩䘉њ NT ḷᘇDŽ֯⭘ POPF/POPFD ᤷԔҏਟԕ؞ా䘉њḷᘇˈ CALL ᤷԔǃѝᯝᡆᔲᑨᢗ㹼ԫ࣑䈳⭘ᰦˈ༴⨶ಘՊ䇮㖞䈕ḷᘇDŽ൘䙊䗷֯⭘ IRET ᤷԔӾањ ㌫DŽ൘֯⭘ޣNT ս 14 ᱟ፼྇ԫ࣑ḷᘇ˄Nested Task˅DŽᆳ᧗ࡦ⵰㻛ѝᯝԫ઼࣑䈳⭘ԫ࣑ѻ䰤Ⲵ䬮᧕ ᭩ⲴᵪࡦѻаDŽ Ѫ⢩ᵳ㓗 0 ᰦˈ〻ᒿ᡽ਟԕ֯⭘ POPF ᡆ IRET ᤷԔ؞᭩䘉њᆇ⇥DŽIOPL ҏᱟ᧗ࡦሩ IF ḷᘇ؞ IOPLDŽᖃࡽ䘀㹼〻ᒿᡆԫ࣑Ⲵ CPL ᗵ享ሿҾㅹҾ䘉њ IOPL ᡽㜭䇯䰞 I/O ൠ൰オ䰤DŽਚᴹᖃ CPL IOPL ս 13-12 ᱟ I/O ⢩ᵳ㓗˄I/O Privilege Level˅ᆇ⇥DŽ䈕ᆇ⇥ᤷ᰾ᖃࡽ䘀㹼〻ᒿᡆԫ࣑Ⲵ I/O ⢩ᵳ㓗 䛓Ѹ൘䲿ਾᤷԔѻਾ༴⨶ಘቡՊӗ⭏ањ䈳䈅ᔲᑨDŽ ሏᢗ㹼〻ᒿ൘ᢗ㹼⇿ᶑᤷԔਾⲴ⣦ᘱDŽྲ᷌〻ᒿ֯⭘ POPFǃPOPFD ᡆ IRET ᤷԔ䇮㖞Ҷ TF ḷᘇˈ ᢗ㹼DŽ൘অ↕ᢗ㹼ᯩᔿлˈ༴⨶ಘՊ൘⇿њᤷԔᢗ㹼ѻਾӗ⭏ањ䈳䈅ᔲᑨˈ䘉ṧᡁԜቡਟԕ㿲 TF ս 8 ᱟ䐏䑚ḷᘇ˄Trap Flag˅DŽᖃ䇮㖞䈕սᰦਟѪ䈳䈅᫽֌੟ࣘঅ↕ᢗ㹼ᯩᔿ˗༽սᰦࡉ⾱→অ↕ ഴ ḽᘍᇺᆎಞ ()/$*6 ѣⲺ㌱㔕ḽᘍ   ㌫㔏ᇴᆈಘ઼㌫㔏ᤷԔ;  ս㺘䮯ᓖ ⇥䮯ᓖ ⇥䮯ᓖ ⇥䮯ᓖ  ս㓯ᙗสൠ൰  ս㓯ᙗสൠ൰ ⇥䘹ᤙㅖ ⇥䮯ᓖ ⇥䘹ᤙㅖ /'75 75  ս㓯ᙗสൠ൰,'75 ⇥᧿䘠ㅖᇴᆈಘ˄㠚࣐ࣘ䖭˅㌫㔏⇥ᇴᆈಘ  ս㓯ᙗสൠ൰*'75  ս㺘䮯ᓖ  ኎ᙗ ˄Page-Directory Base address Register˅DŽ 䭉䈟Ⲵ㓯ᙗൠ൰DŽCR3 ѝਜ਼ᴹ亥ⴞᖅ㺘⢙⨶޵ᆈสൠ൰ˈഐ↔䈕ᇴᆈಘҏ㻛〠Ѫ亥ⴞᖅสൠ൰ᇴᆈಘ PDBR ⮉н⭘˗CR2 ਜ਼ᴹሬ㠤亥؍ 㿱മ 4-3 ᡰ⽪DŽCR0 ѝਜ਼ᴹ᧗ࡦ༴⨶ಘ᫽֌⁑ᔿ઼⣦ᘱⲴ㌫㔏᧗ࡦḷᘇ˗CR1 ᧗ࡦᇴᆈಘ˄CR0ǃCR1ǃCR2 ઼ CR3˅⭘Ҿ᧗ࡦ઼⺞ᇊ༴⨶ಘⲴ᫽֌⁑ᔿԕ৺ᖃࡽᢗ㹼ԫ࣑Ⲵ⢩ᙗˈ 4.1.3 ᧝࡬ᇺᆎಞ ࣘൠ࣐䖭䘋ԫ࣑ᇴᆈಘ TR ѝDŽ ᙗՊ㻛㠚ࣘൠ࣐䖭ࡠԫ࣑ᇴᆈಘѝDŽᖃᢗ㹼ԫ࣑࠷ᦒᰦˈ༴⨶ಘՊᢺᯠԫ࣑ TSS Ⲵ⇥䘹ᤙㅖ઼⇥᧿䘠ㅖ㠚 䜘࠶DŽᖃ֯⭘ LTR ᤷԔᢺ䘹ᤙㅖ࣐䖭䘋ԫ࣑ᇴᆈಘᰦˈTSS ᧿䘠ㅖѝⲴ⇥สൠ൰ǃ⇥䲀䮯ᓖԕ৺᧿䘠ㅖ኎ ᆈ TR ᇴᆈಘⲴ⇥䘹ᤙㅖ؍ᆳᕅ⭘ GDT 㺘ѝⲴањ TSS ㊫රⲴ᧿䘠ㅖDŽᤷԔ LTR ઼ STR ࠶࡛⭘Ҿ࣐䖭઼ TR ᇴᆈಘ⭘Ҿᆈ᭮ᖃࡽԫ࣑ TSS ⇥Ⲵ 16 ս⇥䘹ᤙㅖǃ32 սสൠ൰ǃ16 ս⇥䮯ᓖ઼᧿䘠ㅖ኎ᙗ٬DŽ 4. ԫ࣑ᇴᆈಘ TR 䇮㖞Ѫ 0ˈ㘼⇥䮯ᓖ㻛䇮㖞ᡀ 0xFFFFDŽ Ⲵ⇥䘹ᤙㅖ઼⇥᧿䘠ㅖ㠚ࣘൠ࣐䖭䘋 LDTR ѝDŽ൘ᵪಘ࣐⭥ᡆ༴⨶ಘ༽սਾˈ⇥䘹ᤙㅖ઼สൠ൰㻛唈䇔ൠ ൰ǃ⇥䲀䮯ᓖԕ৺᧿䘠ㅖ኎ᙗՊ㻛㠚ࣘൠ࣐䖭ࡠ LDTR ѝDŽᖃ䘋㹼ԫ࣑࠷ᦒᰦˈ༴⨶ಘՊᢺᯠԫ࣑ LDT ањ⇥᧿䘠ㅖ亩DŽᖃ֯⭘ LLDT ᤷԔᢺਜ਼ᴹ LDT 㺘⇥Ⲵ䘹ᤙㅖ࣐䖭䘋 LDTR ᰦˈLDT ⇥᧿䘠ㅖⲴ⇥สൠ ᆈ LDTR ᇴᆈಘⲴ⇥᧿䘠ㅖ䜘࠶DŽवਜ਼ LDT 㺘Ⲵ⇥ᗵ享൘ GDT 㺘ѝᴹ؍LLDT ઼ SLDT ࠶࡛⭘Ҿ࣐䖭઼ LDTR ᇴᆈಘѝ⭘Ҿᆈ᭮ተ䜘᧿䘠ㅖ㺘 LDT Ⲵ 32 ս㓯ᙗสൠ൰ǃ16 ս⇥䲀䮯઼᧿䘠ㅖ኎ᙗ٬DŽᤷԔ 3. ተ䜘᧿䘠ㅖ㺘ᇴᆈಘ LDTR 䇔ൠ䇮㖞Ѫ 0ˈ㘼䮯ᓖ٬㻛䇮㖞ᡀ 0xFFFFDŽ ᆈ IDTR ᇴᆈಘⲴ޵ᇩDŽ൘ᵪಘࡊ࣐⭥ᡆ༴⨶ಘ༽սਾˈสൠ൰㻛唈؍ᤷԔ LIDT ઼ SIDT ࠶࡛⭘Ҿ࣐䖭઼ о GDTR Ⲵ֌⭘㊫լˈIDTR ᇴᆈಘ⭘Ҿᆈ᭮ѝᯝ᧿䘠ㅖ㺘 IDT Ⲵ 32 ս㓯ᙗสൠ൰઼ 16 ս㺘䮯ᓖ٬DŽ 2. ѝᯝ᧿䘠ㅖ㺘ᇴᆈಘ IDTR ᣔ⁑ᔿࡍ࿻ॆ䗷〻ѝᗵ享㔉 GDTR ࣐䖭ањᯠ٬DŽ؍䇮㖞ᡀ 0xFFFFDŽ൘ ᆈ GDTR ᇴᆈಘⲴ޵ᇩDŽ൘ᵪಘࡊ࣐⭥ᡆ༴⨶ಘ༽սਾˈสൠ൰㻛唈䇔ൠ䇮㖞Ѫ 0ˈ㘼䮯ᓖ٬㻛؍࣐䖭઼ 㺘ѝᆇ㢲 0 ൘㓯ᙗൠ൰オ䰤ѝⲴൠ൰ˈ㺘䮯ᓖᤷ᰾ GDT 㺘Ⲵᆇ㢲䮯ᓖ٬DŽᤷԔ LGDT ઼ SGDT ࠶࡛⭘Ҿ ተ᧿䘠ㅖ㺘 GDT Ⲵ 32 ս㓯ᙗสൠ൰઼ 16 ս㺘䮯ᓖ٬DŽสൠ൰ᤷᇊ GDTޘ GDTR ᇴᆈಘѝ⭘Ҿᆈ᭮ ተ᧿䘠ㅖ㺘ᇴᆈಘ GDTRޘ .1 ⇥ѝवਜ਼⵰ᖃࡽᢗ㹼ԫ࣑Ⲵ䟽㾱ؑ᚟DŽ ઼ LDTR ⭘Ҿራ൰ᆈ᭮᧿䘠ㅖ㺘Ⲵ⇥DŽTR ⭘Ҿራ൰ањ⢩↺Ⲵԫ࣑⣦ᘱ⇥ TSS˄Task State Segment˅DŽTSS GDTRǃLDTRǃIDTR ઼ TR 䜭ᱟ⇥ส൰ᇴᆈಘˈ䘉Ӌ⇥ѝਜ਼ᴹ࠶⇥ᵪࡦⲴ䟽㾱ؑ᚟㺘DŽGDTRǃIDTR ഴ ޻ᆎ㇗⨼ᇺᆎಞ   ㌫㔏ᇴᆈಘ઼㌫㔏ᤷԔ; &5 &5 &5 &5   0 $ 3 : ( 1 ˄5HVHUYHG˅ ⮉؍ ˅˄3DJH)DXOW/LQHDU$GGUHVV 亥䭉䈟㓯ᙗൠ൰ ˄5HVHUYHG˅ ⮉؍ * 3 7 ( 0 ( 6 7 ( 3 3 0 ˄5HVHUYHG˅ ⮉؍ ˅˄5HVHUYHG ⮉؍ ˅˄3DJH'LUHFWRU\%DVH 亥ⴞᖅ㺘สൠ൰                ᑨ˗ྲ᷌ MP=0ˈࡉ TS ḷᘇнՊᖡ૽ WAIT Ⲵᢗ㹼DŽ ᤷԔо TS ḷᘇⲴӔӂ֌⭘DŽྲ᷌ MP=1ǃTS=1ˈ䛓Ѹᢗ㹼 WAIT ᤷԔሶӗ⭏ањ䇮༷нᆈ൘ᔲ MP CR0 Ⲵս 1 ᱟⴁ᧗ॿ༴⨶ಘ˄Monitor Coprocessor ᡆ Math Present˅ḷᘇDŽ⭘Ҿ᧗ࡦ WAIT/FWAIT 䘛֯ᡰᴹ⎞⛩ᤷԔ֯⭘䖟Ԧᶕ⁑ᤏDŽ 㹼ॿ༴⨶ಘᤷԔᰦՊᕅ䎧䇮༷нᆈ൘ᔲᑨ˗ᖃ␵䲔ᰦˈ㺘⽪㌫㔏ᴹॿ༴⨶ಘDŽ䇮㖞䘉њḷᘇਟԕ EM CR0 Ⲵս 2 ᱟԯⵏ˄EMulation˅ḷᘇDŽᖃ䈕ս䇮㖞ᰦˈ㺘⽪༴⨶ಘ⋑ᴹ޵䜘ᡆཆ䜘ॿ༴⨶ಘˈᢗ ᆈDŽ؍Ӿ⋑ᴹ֯⭘䗷ॿ༴⨶ಘˈ䛓Ѹ⴨ᓄॿ༴⨶ಘкл᮷ቡн⭘ ᆈॿ༴⨶ಘⲴкл᮷DŽྲ᷌ԫ࣑؍нᆈ൘ᔲᑨⲴ༴⨶〻ᒿਟ֯⭘ CLTS ᤷԔ␵䲔 TS ḷᘇˈᒦф 䙷ࡠаᶑॿ༴⨶ಘᤷԔᰦӗ⭏䇮༷нᆈ൘ᔲᑨDŽ䇮༷ى֯ᗇ༴⨶ಘ൘ᢗ㹼ᯠԫ࣑ᤷԔ⍱Ⲵԫօᰦ ᆈॿ༴⨶ಘⲴкл᮷ˈ㘼ᱟՊ䇮㖞 TS ḷᘇDŽ䘉њḷᘇՊ؍൘ԫ࣑࠷ᦒᰦˈ༴⨶ಘᒦн㠚ࣘ EM ḷᘇˈ䛓Ѹ TS ḷᘇሩॿ༴⨶ಘᤷԔⲴᢗ㹼ᰐᖡ૽DŽ㿱㺘 4-1 ᡰ⽪DŽ EM ḷᘇˈ䛓Ѹ൘ᢗ㹼ॿ༴⨶ಘᤷԔ WAIT/FWAIT ѻࡽнՊӗ⭏䇮༷нᆈ൘ᔲᑨDŽྲ᷌䇮㖞Ҷ њ䇮༷нᆈ൘ DNA˄Device Not Available˅ᔲᑨDŽྲ᷌䇮㖞Ҷ TS ḷᘇն⋑ᴹ䇮㖞 CR0 Ⲵ MP ઼ ྲ᷌䇮㖞Ҷ TS ḷᘇᒦф CR0 Ⲵ EM ḷᘇѪ 0ˈ䛓Ѹ൘ᢗ㹼ԫօॿ༴⨶ಘᤷԔѻࡽՊӗ⭏а ᢗ㹼ॿ༴⨶ಘᤷԔᰦ⍻䈅䈕ḷᘇDŽ ᇩˈⴤࡠᯠԫ࣑ᔰ࿻ᇎ䱵ᢗ㹼ॿ༴⨶ಘᤷԔDŽ༴⨶ಘ൘⇿⅑ԫ࣑࠷ᦒᰦ䜭Պ䇮㖞䈕ḷᘇˈᒦф൘ ᆈԫ࣑࠷ᦒᰦⲴॿ༴⨶ಘ޵؍TS CR0 Ⲵս 3 ᱟԫ࣑ᐢ࠷ᦒ˄Task Switched˅ḷᘇDŽ䈕ḷᘇ⭘Ҿ᧘䘏 㔏ѝᴹ 80387ˈࡉ ET 㻛䇮㖞ᡀ 1ˈ੖ࡉ㤕ᴹањ 80287 ᡆ㘵⋑ᴹॿ༴⨶ಘˈࡉ ET 㻛䇮㖞ᡀ 0DŽ սሶ㻛ᘭ⮕DŽ൘༴⨶ಘ༽ս᫽֌ᰦˈET սՊ㻛ࡍ࿻ॆᤷ᰾㌫㔏ѝ֯⭘Ⲵॿ༴⨶ಘ㊫රDŽྲ᷌㌫ ಘᆈ൘ˈᒦ֯⭘ 32 սॿ༴⨶ಘॿ䇞DŽET=0 ᤷ᰾֯⭘ 80287 ॿ༴⨶ಘDŽྲ᷌ԯⵏս EM=1ˈࡉ䈕 ET CR0 Ⲵս 4 ᱟᢙኅ㊫ර˄Extension Type˅ḷᘇDŽᖃ䈕ḷᘇѪ 1 ᰦˈ㺘⽪ᤷ᰾㌫㔏ᴹ 80387 ॿ༴⨶ ਟԕ࣐ᘛᆳԜѻ䰤Ⲵ࠷ᦒ᫽֌DŽ ڊᆈ઼ᚒ༽⎞⛩ᇴᆈಘDŽሩҾ⋑ᴹ֯⭘⎞⛩䘀㇇Ⲵԫ࣑ˈ䘉ṧ؍䘉њᔲᑨਟ⭘ᶕӵѪ֯⭘⎞⛩䘀㇇Ⲵԫ࣑ EM ս⭘Ҿ⺞ᇊ⎞⛩ᤷԔᡆ WAIT ᤷԔᱟ੖ᓄ䈕ӗ⭏ањ䇮༷нᆈ൘ DNA˄Device Not Available˅ᔲᑨDŽ 䘹ᤙоॿ༴⨶ಘ䘋㹼䙊ؑᡰ֯⭘Ⲵॿ䇞ˈণᤷ᰾㌫㔏ѝ֯⭘Ⲵᱟ 80387 䘈ᱟ 80287 ॿ༴⨶ಘDŽTSǃMP ઼ ॿ༴⨶ಘⲴ䈖㓶䈤᰾䈧৲㿱ㅜ 11 ㄐ޵ᇩDŽCR0 Ⲵ ET ս˄ḷᘇ˅⭘Ҿޣ⎞⛩˄ᮠᆖ˅ॿ༴⨶ಘⲴ᫽֌DŽᴹ CR0 Ⲵ 4 њ∄⢩ս˖ᢙኅ㊫රս ETǃԫ࣑࠷ᦒս TSǃԯⵏս EM ઼ᮠᆖᆈ൘ս MP ⭘Ҿ᧗ࡦ 80X86 1. CR0 ѝॿ༴⨶ಘ᧗ࡦս ഴ ᧝࡬ᇺᆎಞ &5&5   ㌫㔏ᇴᆈಘ઼㌫㔏ᤷԔ; 亥˄PG=1˅ѻࡽᗵ享ݸࡧᯠ CPU ѝⲴ亥儈䙏㕃ߢ˄ᡆ〠Ѫ䖜ᦒḕ᢮㕃ߢ४ TLB - Translation Lookaside ࠶亥ц⭼ѻ䰤䎧⵰ẕằⲴ֌⭘DŽᰐ䇪ᱟ੖ᔰ੟࠶亥ᵪࡦˈ䘉䜘࠶ԓ⸱䜭ާᴹ⴨਼Ⲵൠ൰DŽਖཆˈ൘ᔰ੟࠶ ⨶ൠ൰オ䰤ѝާᴹ⴨਼ൠ൰ᰦˈᡁԜ᡽㜭᭩ਈ PG սⲴ䇮㖞DŽ↔ᰦ䘉䜘࠶ާᴹ⴨਼ൠ൰Ⲵԓ⸱൘࠶亥઼ᵚ ᖃ᭩ਈ PE ઼ PG սᰦˈᡁԜᗵ享ሿᗳDŽਚᴹᖃᢗ㹼〻ᒿ䎧⸱ᴹ䜘࠶ԓ⸱઼ᮠᦞ൘㓯ᙗൠ൰オ䰤઼⢙ лDŽ ᣔ⁑ᔿ؍ᣔᔲᑨˈণ䘉⿽ḷᘇ㓴ਸᰐ᭸˗ྲ᷌ PG=1ǃPE=1ˈࡉ༴⨶ಘᐕ֌൘ᔰ੟Ҷ࠶亥ᵪࡦⲴ؍ња㡜 ᣔ⁑ᔿлн㜭੟⭘࠶亥ᵪࡦˈഐ↔༴⨶ಘՊӗ⭏а؍ᣔ⁑ᔿл˗ྲ᷌ PG=1ǃPE=0ˈ↔ᰦ⭡Ҿн൘؍ࡦⲴ ྲ᷌ PE=0ǃPG=0ˈ༴⨶ಘᐕ֌൘ᇎൠ൰⁑ᔿл˗ྲ᷌ PG=0ǃPE=1ˈ༴⨶ಘᐕ֌൘⋑ᴹᔰ੟࠶亥ᵪ ൰֯⭘DŽ ᵪࡦDŽྲ᷌ PG=1ˈࡉᔰ੟Ҷ࠶亥ᵪࡦDŽྲ᷌ PG=-0ˈ࠶亥ᵪࡦ㻛⾱→ˈ↔ᰦ㓯ᙗൠ൰㻛ⴤ᧕֌Ѫ⢙⨶ൠ 䰝Ҷ࠶⇥ᵪࡦˈᒦྲ਼ 8086 ᐕ֌Ҿᇎൠ൰⁑ᔿлDŽPG ⭘Ҿ᧗ࡦ࠶亥ޣᣔ⁑ᔿлDŽྲ᷌ PE=0ˈࡉ༴⨶ಘ ؍࠶⇥઼࠶亥ᵪࡦDŽPE ⭘Ҿ᧗ࡦ࠶⇥ᵪࡦDŽྲ᷌ PE=1ˈ༴⨶ಘቡᐕ֌൘ᔰ੟࠶⇥ᵪࡦ⧟ຳлˈণ䘀㹼൘ ᣔ⁑ᔿ PE˄Protected Enable˅ս˄ս 0˅઼ᔰ੟࠶亥 PG˄Paging˅ս˄ս 31˅࠶࡛⭘Ҿ᧗ࡦ؍੟⭘ ᘇǃIGNNE ᕅ㝊઼ FERR ᕅ㝊⭘Ҿ࡙⭘ཆ䜘䙫䗁ᶕᇎ⧠ PC ᵪᖒᔿⲴཆ䜘䭉䈟ᣕ੺ᵪࡦDŽ 䈧≲ᕅ㝊кDŽNE ḷޕԯⵏཆ䜘ॿ༴⨶ಘ 80387 Ⲵ ERROR ᕅ㝊ˈഐ↔䙊ᑨ䘎᧕ࡠѝᯝ᧗ࡦಘ䗃 ᤷԔᢗ㹼DŽCPU Ⲵ FERR ᕅ㝊⭘Ҿ→ڌлањㅹᖵᖒᔿ⎞⛩ᤷԔᡆ WAIT/FWAIT ᤷԔѻࡽ・࡫ 䶎ቿ㭭Ⲵᮠᆖॿ༴⨶ಘ X87 䭉䈟ሶሬ㠤༴⨶ಘ䙊䗷 FERR ᕅ㝊൘ཆ䜘ӗ⭏ањѝᯝˈᒦф൘ᢗ㹼 ᕅ㝊ᰐؑਧᰦˈ䛓Ѹޕᆖॿ༴⨶ಘ X87 䭉䈟ሶ㻛ᘭ⮕DŽᖃ NE Ѫ༽ս⣦ᘱᒦф CPU Ⲵ IGNNE 䗃 ᕅ㝊ᴹؑਧᰦˈ䛓ѸᮠޕX87 ॿ༴⨶ಘ䭉䈟ᣕ੺ᵪࡦDŽᖃ NE Ѫ༽ս⣦ᘱᒦф CPU Ⲵ IGNNE 䗃 ᘇᰦˈቡ੟⭘Ҷ X87 ॿ༴⨶ಘ䭉䈟Ⲵ޵䜘ᣕ੺ᵪࡦ˗㤕༽ս䈕ḷᘇˈ䛓Ѹቡ֯⭘ PC ᵪᖒᔿⲴ NE ሩҾ Intel 80486 ᡆԕкⲴ CPUˈCR0 Ⲵս 5 ᱟॿ༴⨶ಘ䭉䈟˄Numeric Error˅ḷᘇDŽᖃ䇮㖞䈕ḷ ᰦࡉ৽ѻDŽ䈕ḷᘇᴹ࡙Ҿ UNIX ㊫᫽֌㌫㔏൘ࡋᔪ䘋〻ᰦᇎ⧠߉ᰦ༽ࡦ˄Copy on Write˅ᢰᵟDŽ ༴⨶ಘՊ⾱→䎵㓗⭘ᡧ〻ᒿ˄ֻྲ⢩ᵳ㓗 0 Ⲵ〻ᒿ˅ੁ⭘ᡧ㓗ਚ䈫亥䶒ᢗ㹼߉᫽֌˗ᖃ䈕ս༽ս ᣔ˄Write Proctect˅ḷᘇDŽᖃ䇮㖞䈕ḷᘇᰦˈ؍WP ሩҾ Intel 80486 ᡆԕкⲴ CPUˈCR0 Ⲵս 16 ᱟ߉ 㾱੟⭘࠶亥ᵪࡦˈ䛓Ѹ PE ઼ PG ḷᘇ䜭㾱㖞սDŽ ↔ᰦᡰᴹ㓯ᙗൠ൰ㅹ਼Ҿ⢙⨶ൠ൰DŽ൘ᔰ੟䘉њḷᘇѻࡽᗵ享ᐢ㓿ᡆ㘵਼ᰦᔰ੟ PE ḷᘇDŽণ㤕 PG CR0 Ⲵս 31 ᱟ࠶亥˄Paging˅ḷᘇDŽᖃ䇮㖞䈕սᰦণᔰ੟Ҷ࠶亥ᵪࡦ˗ᖃ༽սᰦࡉ⾱→࠶亥ᵪࡦˈ PE ઼ PG ḷᘇ䜭㾱㖞սDŽ ᣔˈ㘼ᒦ⋑ᴹ੟⭘࠶亥ᵪࡦDŽ㤕㾱੟⭘࠶亥ᵪࡦˈ䛓Ѹ؍ᇎൠ൰⁑ᔿDŽ䘉њḷᘇӵᔰ੟⇥㓗ޕ䘋 ᣔ⁑ᔿ˗ᖃ༽սᰦণ؍ᣔ˄Protection Enable˅ḷᘇDŽᖃ䇮㖞䈕սᰦণᔰ੟Ҷ؍PE CR0 Ⲵս 0 ᱟ੟⭘ ᣔ᧗ࡦս؍2. CR0 ѝ 1 1 1 DNA ᔲᑨ DNA ᔲᑨ 1 1 0 DNA ᔲᑨ ᢗ㹼 1 0 1 DNA ᔲᑨ ᢗ㹼 1 0 0 DNA ᔲᑨ ᢗ㹼 0 1 1 DNA ᔲᑨ DNA ᔲᑨ 0 1 0 ᢗ㹼 ᢗ㹼 0 0 1 䇮༷нᆈ൘˄DNA˅ᔲᑨ ᢗ㹼 0 0 0 ᢗ㹼 ᢗ㹼 EM MP TS ⎞⛩ WAIT/FWAIT CR0 ѝⲴḷᘇ ᤷԔ㊫ර 㺞 &5 ѣḽᘍ (0Ƚ03 ૂ 76 Ⲻуੂ㓺ਾሯঅ༺⨼ಞ᤽Ԛࣞ֒Ⲻᖧଃ  ㌫㔏ᇴᆈಘ઼㌫㔏ᤷԔ; ᆈࡠ޵ᆈѝDŽ؍઼䮯ᓖ ᆈѝᯝ᧿䘠ㅖ㺘ᇴᆈಘ IDTRDŽᢺ IDTR ѝ IDT 㺘Ⲵสൠ൰؍ SIDT Store IDT Register ੖ ޵ᆈ࣐䖭ࡠ IDTR ѝDŽ ࣐䖭ѝᯝ᧿䘠ㅖ㺘ᇴᆈಘ IDTRDŽᢺ IDT 㺘Ⲵสൠ൰઼䮯ᓖӾ LIDT Load IDT Register ᱟ ޵ᆈᡆ䙊⭘ᇴᆈަѝDŽ ᆈࡠ؍ᆈԫ࣑ᇴᆈಘ TRDŽᢺ TR ѝᖃࡽԫ࣑ TSS ⇥䘹ᤙㅖ؍ STR Store Task Register ੖ ԫ࣑ᇴᆈಘѝDŽ ࣐䖭ԫ࣑ᇴᆈಘ TRDŽᢺ TSS ⇥䘹ᤙㅖ˄઼⇥᧿䘠ㅖ˅࣐䖭ࡠ LTR Load Task Register ᱟ ᆈࡠ޵ᆈѝDŽ؍൰઼䮯ᓖ ተ᧿䘠ㅖ㺘ᇴᆈಘ GDTRDŽᢺ GDTR ѝ IDT 㺘Ⲵสൠޘᆈ؍ SGDT Store GDT Register ੖ Ӿ޵ᆈ࣐䖭ࡠ GDTR ѝDŽ ተ᧿䘠ㅖ㺘ᇴᆈಘ GDTRDŽᢺ GDT 㺘Ⲵสൠ൰઼䮯ᓖޘ࣐䖭 LGDT Load GDT Register ᱟ ㅖࡠ޵ᆈѝᡆ䙊⭘ᇴᆈಘѝDŽ ᆈተ䜘᧿䘠ㅖ㺘ᇴᆈಘ LDTRDŽᢺ LDTR ѝⲴ LDT ⇥䘹ᤙ؍ SLDT Store LDT Regiter ੖ ઼⇥᧿䘠ㅖࡠ LDTR ᇴᆈಘѝDŽ ࣐䖭ተ䜘᧿䘠ㅖ㺘ᇴᆈಘ LDTRDŽӾ޵ᆈ࣐䖭 LDT ⇥䘹ᤙㅖ LLDT Load LDT Register ᱟ ᣔ 䈤᰾؍਽ ਇޘᤷԔ ᤷԔ 㺞 ᑮ⭞㌱㔕᤽Ԛࡍ㺞 ᣔDŽ؍ࠪҶᡁԜሶ⭘ࡠⲴаӋ㌫㔏ᤷԔDŽަѝ䘈ᤷࠪҶᆳԜᱟ੖ਇࡠ 㓗 0 Ⲵ᫽֌㌫㔏䖟Ԧᢗ㹼ˈަ։аӋᤷԔਟԕ൘ԫօ⢩ᵳ㓗кᢗ㹼ˈഐ↔ᓄ⭘〻ᒿҏ㜭֯⭘DŽ㺘 4-2 ѝࡇ ㌫㔏ᤷԔ⭘Ҿ༴⨶㌫㔏㓗࣏㜭ˈֻྲ࣐䖭㌫㔏ᇴᆈಘǃ㇑⨶ѝᯝㅹDŽབྷཊᮠ㌫㔏ᤷԔਚ㜭⭡༴Ҿ⢩ᵳ 4.1.4 ㌱㔕᤽Ԛ ᔲᑨDŽ ѝDŽഐ↔᫽֌㌫㔏ѝⲴ亥ᔲᑨ༴⨶〻ᒿਟԕ䙊䗷Ựḕ CR2 Ⲵ޵ᇩᶕ⺞ᇊ㓯ᙗൠ൰オ䰤ѝଚањ亥䶒ᕅਁҶ CR2 ⭘Ҿࠪ⧠亥ᔲᑨᰦᣕ੺ࠪ䭉ؑ᚟DŽ൘ᣕ੺亥ᔲᑨᰦˈ༴⨶ಘՊᢺᕅ䎧ᔲᑨⲴ㓯ᙗൠ൰ᆈ᭮൘ CR2 ӛ亥㺘Ⲵԫ࣑ਟԕᢗ㹼ᗇᴤᘛDŽޡᯠ亥儈䙏㕃ߢDŽ䘉ṧ ٬о৏ԫ࣑Ⲵаṧˈ༴⨶ಘቡᰐ䴰ࡧ ᖃ࠷ᦒԫ࣑ᰦˈCR3 Ⲵ޵ᇩҏՊ䲿ѻ᭩ਈDŽնᱟྲ᷌ᯠԫ࣑Ⲵ CR3 ণ֯ CR0 ѝⲴ PG ս༴Ҿ༽ս⣦ᘱ˄PG=0˅ˈᡁԜҏ㜭ݸ࣐䖭 CR3DŽԕݱ䇨ሩ࠶亥ᵪࡦ䘋㹼ࡍ࿻ॆDŽ ᆈѝ䈫ਆ亥㺘亩DŽ TLB˄Translation Lookaside Buffer˅DŽਚᴹᖃ TLB ѝнवਜ਼㾱≲Ⲵ亥㺘亩ᰦ᡽Պ֯⭘仍ཆⲴᙫ㓯ઘᵏӾ޵ 䟿ˈᴰ䘁䇯䰞Ⲵ亥ⴞᖅ઼亥㺘Պ㻛ᆈ᭮൘༴⨶ಘⲴ亥儈䙏㕃ߢಘԦѝˈ䈕㕃ߢಘԦ㻛〠Ѫ䖜ᦒḕ᢮㕃ߢ४ ֯⭘ MOV ᤷԔ࣐䖭 CR3 ᰦާᴹ䇙亥儈䙏㕃ߢᰐ᭸Ⲵ࢟֌⭘DŽѪҶ߿ቁൠ൰䖜ᦒᡰ㾱≲Ⲵᙫ㓯ઘᵏᮠ ഐ↔൘ᖰ CR3 ѝ࣐䖭ањᯠ٬ᰦվ 12 սᗵ享䇮㖞Ѫ 0DŽ ⮉׋ᴤ儈㓗༴⨶ಘ֯⭘ˈ؍Ѫ亥ⴞᖅ㺘亥䶒ᱟ亥ሩ喀Ⲵˈᡰԕ䈕ᇴᆈಘਚᴹ儈 20 սᱟᴹ᭸ⲴDŽ㘼վ 12 ս CR2 ઼ CR3 ⭘Ҿ࠶亥ᵪࡦDŽCR3 ਜ਼ᴹᆈ᭮亥ⴞᖅ㺘亥䶒Ⲵ⢙⨶ൠ൰ˈഐ↔ CR3 ҏ㻛〠Ѫ PDBRDŽഐ 3. CR2 ઼ CR3 ᆈಘ઼ᮠᦞ㔃ᶴDŽ ಘ㻛༽սᡀ PE=0ǃPG=0˄ণᇎ⁑ᔿ⣦ᘱ˅ˈԕݱ䇨ᕅሬԓ⸱൘੟⭘࠶⇥઼࠶亥ᵪࡦѻࡽ㜭ཏࡍ࿻ॆ䘉Ӌᇴ ᔿлⲴԫօᤷԔDŽ൘䇮㖞 PE սѻࡽˈ〻ᒿᗵ享ࡍ࿻ॆࠐњ㌫㔏⇥઼᧗ࡦᇴᆈಘDŽ൘㌫㔏ࡊк⭥ᰦˈ༴⨶ ൘؞᭩䈕Ҷ PE սѻਾ〻ᒿᗵ享・࡫֯⭘аᶑ䐣䖜ᤷԔˈԕࡧᯠ༴⨶ಘᢗ㹼㇑䚃ѝᐢ㓿㧧ਆⲴн਼⁑ Buffers˅DŽ  ㌫㔏ᇴᆈಘ઼㌫㔏ᤷԔ; 䟿〫ٿ + ˅ൠ൰ = สൠ൰ + ˄ਈ൰ x ∄ֻഐᆀ〫ٿ ˖ᑨ䟿DŽণ〫ٿ䟿⭡й䜘࠶⴨࣐㓴ᡀ˖สൠ൰ᇴᆈಘǃਈ൰ᇴᆈಘ઼ањ〫ٿᤷԔⲴ 䟿Ⲵᖸཊᯩᔿˈ〠ѪᤷԔራ൰ᯩᔿDŽ〫ٿൠ൰ˈ80X86 ᤷԔ㿴ᇊҶ䇑㇇〫ٿѪҶᤷᇊ޵ᆈ᫽֌ᮠⲴ⇥޵ ᆈಘDŽ ਖཆ 4 њ⇥ᇴᆈಘᱟ䙊⭘⇥ᇴᆈಘDŽᖃᤷԔѝ⋑ᴹᤷᇊᡰ᫽֌ᮠᦞⲴ⇥ᰦˈ䛓Ѹ DS ሶᱟ唈䇔Ⲵᮠᦞ⇥ᇴ ⭡⇥ᇴᆈಘ SSራ൰Ⲵ⇥〠ѪᖃࡽึḸ⇥DŽḸ亦⭡ ESP ᇴᆈಘ޵ᇩᤷᇊDŽഐ↔ึḸ亦༴ൠ൰ᱟ SS:[ESP]DŽ ަԆⲴԓ⸱⇥ѝˈ䘉ṧቡᇎ⧠Ҷ൘н਼⇥ѝ〻ᒿⲴ᧗ࡦՐ䙂DŽ Ӿ㘼ਟԕᢺᢗ㹼ս㖞᭩ਈࡠˈCS:[EIP]DŽਾ䶒ሶ䈤᰾Ⲵ⇥䰤᧗ࡦ䖜〫ᤷԔਟԕ㻛⭘ᶕѪ CS ઼ EIP 䍻Ҹᯠ٬ ൠ൰DŽഐ↔㾱ᢗ㹼ᤷԔⲴൠ൰ਟ㺘⽪ᡀ〫ٿEIP ᇴᆈಘѝवਜ਼Ҷᖃࡽԓ⸱⇥޵лаᶑ㾱ᢗ㹼ᤷԔⲴ⇥޵ Ҿራ൰ԓ⸱⇥ˈ㘼ึḸ⇥ࡉу䰘֯⭘ SS ⇥ᇴᆈಘDŽ൘ԫօᤷᇊᰦ࡫⭡ CS ራ൰Ⲵ⇥〠Ѫᖃࡽԓ⸱⇥DŽ↔ᰦ 80X86 Ѫ⇥䜘࠶ᨀ׋Ҷ 6 њᆈ᭮⇥䘹ᤙㅖⲴ⇥ᇴᆈಘ˖CSǃDSǃESǃSSǃFS ઼ GSDŽަѝ CS ᙫᱟ⭘ ൠ൰DŽ ൠ൰ᡆᤷ䪸ᤷᇊⲴൠ൰ᱟสҾᖃࡽ⇥Ⲵሩ䊑〫ٿൠ൰DŽ㘼ӵ⭡ 32 ս〫ٿҶањᮠᦞሩ䊑Ⲵ⇥ൠ൰઼⇥޵ ᶴᡀⲴ 48 սൠ൰ᡆ䮯ᤷ䪸〠Ѫањ䙫䗁ൠ൰˄㲊ᤏൠ൰˅DŽᆳୟа⺞ᇊ〫ٿ〻ᒿѝ⭡ 16 սⲴ⇥઼ 32 սⲴ ൠ൰䜘࠶֯⭘ 32 սⲴ٬ᶕᤷᇊˈഐ↔⇥޵ൠ൰ਟԕᱟ 0 ࡠ 4GDŽণањ⇥Ⲵᴰབྷ䮯ᓖਟ䗮 4GDŽ〫ٿ⇥޵ ൠ൰є䜘࠶ᶴᡀDŽ⇥ൠ൰䜘࠶֯⭘ 16 սⲴ⇥䘹ᤙㅖᤷᇊˈަѝ 14 սਟԕ䘹ᤙ 2^14 ⅑ᯩণ 16384 њ⇥DŽ〫 ٿⲴ㓯ᙗ४ฏˈӾ㘼ሩ޵ᆈѝањᮠᦞሩ䊑Ⲵራ൰ቡ䴰㾱֯⭘ањ⇥Ⲵ䎧࿻ൠ൰˄ণ⇥ൠ൰˅઼ањ⇥޵ 80X86 ֯⭘Ҷа⿽〠Ѫ⇥˄Segment˅Ⲵራ൰ᢰᵟDŽ䘉⿽ራ൰ᢰᵟᢺ޵ᆈオ䰤࠶ᡀањᡆཊњ〠Ѫ⇥ Ҷ䘋㹼޵ᆈራ൰ˈ ԔⲴ᫽֌ᮠ⎹৺޵ᆈራ൰ˈᒦф䪸ሩᡰራ൰ሩ䊑ᮠᦞ㊫රⲴн਼ˈҏᴹᖸཊн਼Ⲵራ൰ᯩṸਟ׋䘹ᤙDŽѪ ԕսҾањᇴᆈಘѝˈҏਟԕ൘޵ᆈѝDŽ㤕㾱ᇊս޵ᆈѝⲴ᫽֌ᮠˈቡ㾱䘋㹼޵ᆈራ൰DŽ80X86 ᴹ䇨ཊᤷ ሩҾ 80X86 CPUˈаᶑᤷԔѫ㾱⭡᫽֌⸱˄Opcode˅઼᫽֌ሩ䊑ণ᫽֌ᮠ˄Oprand˅ᶴᡀDŽ᫽֌ᮠਟ Ⲵ༴⨶ಘDŽ Little Endium˅˄80X86 俆ݸᆈ᭮վ٬ᆇ㢲ˈ䲿ਾൠ൰༴ᆈ᭮儈٬ᆇ㢲DŽഐ↔ 80X86 CPU ᱟа⿽ݸᆈሿ٬ ራ൰ 4G ᆇ㢲Ⲵ⢙⨶޵ᆈDŽሩҾཊᆇ㢲ᮠᦞ㊫ර˄ֻྲ 2 ᆇ㢲ᮤᮠᮠᦞ㊫ර˅ˈ൘޵ᆈѝ䘉Ӌᆇ㢲⴨䛫ᆈ᭮DŽ ਟԕޡᴹ 2^32 њн਼⢙⨶ൠ൰DŽণ޵ᆈ⢙⨶ൠ൰オ䰤ᴹ 4Gˈᙫޡ䈤ˈަൠ൰ᙫ㓯ᇭᓖѪ 32 սˈഐ↔а ᦞ㊫රⲴራ൰ᱟሩ 1 ᆇ㢲ᮠᦞ˄ᮠ٬ᡆᆇㅖ˅ⲴᇊսDŽ䙊ᑨ޵ᆈൠ൰Ӿ 0 ᔰ࿻㕆൰ˈሩҾ 80X86 CPU ᶕ ਧᮤරᮠˈԕ৺ཊᆇ㢲ᆇㅖѢㅹDŽ䙊ᑨᆇ㢲ѝḀа∄⢩սⲴᇊսᡆራ൰ਟԕสҾᆇ㢲ᶕራ൰ˈഐ↔ᴰሿᮠ ѢDŽ80X86 ᭟ᤱཊ⿽ᮠᦞ㊫ර˖1 ᆇ㢲ǃ2 ᆇ㢲˄1 њᆇ˅ᡆ 4 ᆇ㢲˄ৼᆇᡆ䮯ᆇ˅Ⲵᰐㅖਧᮤරᮠᡆᑖㅖ Ḁњᤷᇊᮠᦞሩ䊑Ⲵൠ൰䘋㹼ᇊսDŽ䘉䟼ˈᮠᦞሩ䊑ᱟᤷᆈۘ൘޵ᆈѝⲴањᤷᇊᮠᦞ㊫රⲴᮠ٬ᡆᆇㅖ ޵ᆈᱟᤷа㓴ᴹᒿᆇ㢲㓴ᡀⲴᮠ㓴ˈ⇿њᆇ㢲ᴹୟаⲴ޵ᆈൠ൰DŽ޵ᆈራ൰ࡉᱟᤷሩᆈۘ൘޵ᆈѝⲴ 4.2.1 ޻ᆎሱ൶ 4.2 ؓᣚ⁗ᕅ޻ᆎ㇗⨼ ༴⨶ಘᢗ㹼DŽ→ڌ HLT Halt Processor ੖ LSL Load Segment Limit ੖ ࣐䖭⇥䲀䮯DŽ нᆈ൘ᔲᑨDŽ ␵䲔 CR0 ѝⲴԫ࣑ᐢ࠷ᦒḷᘇ TSDŽ⭘Ҿ༴⨶䇮༷˄ॿ༴⨶ಘ˅ CLTS Clear TS flag ᱟ ᆈᵪಘ⣦ᘱᆇDŽ䈕ᤷԔ⭘Ҿެᇩ 80286 ༴⨶ಘDŽ؍ SMSW Store Machine State Word ੖ ᇩ 80286 ༴⨶ಘDŽ ࣐䖭ᵪಘ⣦ᘱᆇ˄ሩᓄ CR0 ᇴᆈಘս 15--0˅DŽ䈕ᤷԔ⭘Ҿެ LMSW Load Machine State Word ᱟ ᆈ᧗ࡦᇴᆈಘ CR0ǃCR1ǃCR2 ᡆ CR3DŽ؍MOV CRn Move Control Registers ᱟ ࣐䖭઼  ᣔ⁑ᔿ޵ᆈ㇑⨶؍    ⢙⨶ൠ൰ ᵪࡦ ࠶亥 ᔰ੟"  ࠶亥   㓯ᙗൠ൰ ᵪࡦ ࠶⇥ 䙫䗁ൠ൰ 㲊ᤏൠ൰ ٬〫ٿ 䘹ᤙㅖ    䙫䗁ൠ൰ ੖ ᱟ 䟿ቡᖒᡀҶ༴⨶ಘ㓯ᙗൠ൰オ䰤ѝⲴൠ൰DŽ〫ٿ㢲Ⲵս㖞DŽഐ↔สൠ൰࣐к 䟿䜘࠶࣐ࡠ⇥Ⲵสൠ൰кቡਟԕᇊս⇥ѝḀњᆇ〫ٿൠ൰オ䰤ѝⲴս㖞˄〠Ѫ⇥Ⲵสൠ൰˅DŽ䙫䗁ൠ൰Ⲵ 䜭ᴹањ⇥᧿䘠ㅖDŽ⇥᧿䘠ㅖᤷ᰾⇥Ⲵབྷሿǃ䇯䰞ᵳ䲀઼⇥Ⲵ⢩ᵳ㓗ǃ⇥㊫රԕ৺⇥Ⲵㅜ 1 њᆇ㢲൘㓯ᙗ 䟿DŽ⇿њ⇥〫ٿተ᧿䘠ㅖ㺘 GDT˅ѝањᮠᦞ㔃ᶴ˄〠Ѫ⇥᧿䘠ㅖ˅Ⲵޘྲֻ˄䘹ᤙㅖᨀ׋Ҷ⇥᧿䘠ㅖ㺘 䟿DŽ⇥䘹ᤙㅖᱟањ⇥Ⲵୟаḷ䇶DŽਖཆˈ⇥〫ٿᨀ׋ањ䙫䗁ൠ൰DŽ䙫䗁ൠ൰वᤜањ⇥䘹ᤙㅖ઼ањ ањ㌫㔏ѝᡰᴹ֯⭘Ⲵ⇥䜭वਜ਼൘༴⨶ಘ㓯ᙗൠ൰オ䰤ѝDŽѪҶᇊսᤷᇊ⇥ѝⲴањᆇ㢲ˈ〻ᒿᗵ享 䘈ݱ䇨ሩ⇥䘋㹼࠶㊫DŽ䘉ṧˈሩ⢩ᇊ㊫ර⇥Ⲵ᫽֌㜭ཏਇࡠ䲀ࡦDŽ ањ〻ᒿнՊ䙊䗷䇯䰞ਖањ〻ᒿⲴ⇥㘼ᒢᢠ〻ᒿⲴᢗ㹼DŽ࠶⇥ᵪࡦ؍⺞ԕ࣐ᕪ䘉Ӌ⇥ѻ䰤Ⲵ⭼䲀ˈᒦф ᡆ LDT˅DŽྲ᷌༴⨶ಘѝᴹཊњ〻ᒿᡆԫ࣑൘䘀㹼ˈ䛓Ѹ⇿њ〻ᒿਟ࠶䝽਴㠚Ⲵа྇⇥DŽ↔ᰦ༴⨶ಘቡਟ ᣔൠ൰オ䰤४ฏDŽ⇥ਟԕ⭘ᶕᆈ᭮〻ᒿⲴԓ⸱ǃᮠᦞ઼ึḸˈᡆ㘵⭘ᶕᆈ᭮㌫㔏ᮠᦞ㔃ᶴ˄ֻྲ TSS؍Ⲵਇ ྲമ 4-5 ᡰ⽪ˈ࠶⇥ᨀ׋Ҷа⿽ᵪࡦˈ⭘Ҿᢺ༴⨶ಘਟራ൰Ⲵ㓯ᙗൠ൰オ䰤ࡂ࠶ᡀаӋ䖳ሿⲴ〠Ѫ⇥ ⧠〻ᒿԓ⸱᤹㾱≲㻛᱐ሴࡠ⢙⨶޵ᆈѝDŽ࠶亥ᵪࡦᖃ❦ҏ㜭⭘Ҿᨀ׋ཊԫ࣑ѻ䰤Ⲵ䳄⿫᧚ᯭDŽ ಘк㘼нՊӂ⴨ᒢᢠDŽ࠶亥ᵪࡦѪՐ㔏䴰≲亥ǃ㲊ᤏ޵ᆈ㌫㔏ᨀ׋Ҷᇎ⧠ᵪࡦDŽަѝ㲊ᤏ޵ᆈ㌫㔏⭘Ҿᇎ ࠶⇥ᨀ׋Ҷ䳄㔍਴њԓ⸱ǃᮠᦞ઼ึḸ४ฏⲴᵪࡦˈഐ↔ཊњ〻ᒿ˄ᡆԫ࣑˅ਟԕ䘀㹼൘਼ањ༴⨶ 1. ࠶⇥ᵪࡦ ഴ 㲐ᤕ൦൶δ䙱䗇൦൶εࡦ⢟⨼൦൶Ⲻ਎ᦘ䗽ぁ  ࡠ༴⨶ಘⲴ⢙⨶ൠ൰オ䰤кDŽ⢙⨶ൠ൰オ䰤ᇊѹѪ༴⨶ಘ൘ަൠ൰ᙫ㓯к㜭ཏӗ⭏Ⲵൠ൰㤳തDŽ Ҽ䱦⇥Ⲵ࠶亥ᵪࡦࡉᱟ׋䘹⭘ⲴDŽྲ᷌⋑ᴹ੟⭘࠶亥ᵪࡦˈ䛓Ѹ࠶⇥ᵪࡦӗ⭏Ⲵ㓯ᙗൠ൰オ䰤ቡⴤ᧕᱐ሴ ⭘࠶亥ᵪࡦᢺ㓯ᙗൠ൰䖜ᦒѪ⢙⨶ൠ൰DŽ൘ൠ൰ਈᦒ䗷〻ѝˈㅜа䱦⇥Ⲵ࠶⇥ਈᦒᵪࡦᙫᱟ֯⭘Ⲵˈ㘼ㅜ ⭘࠶⇥ᵪࡦᢺ〻ᒿⲴ䙫䗁ൠ൰ਈᦒᡀ༴⨶ಘਟራ൰޵ᆈオ䰤˄〠Ѫ㓯ᙗൠ൰オ䰤˅ѝⲴൠ൰DŽㅜҼ䱦⇥֯ 80X86 ൘Ӿ䙫䗁ൠ൰ࡠ⢙⨶ൠ൰ਈᦒ䗷〻ѝ֯⭘Ҷ࠶⇥઼࠶亥є⿽ᵪࡦˈ㿱മ 4-4 ᡰ⽪DŽㅜа䱦⇥֯ ᚟DŽ䘉Ӌ㺘ਚ㜭⭡᫽֌㌫㔏䇯䰞ˈԕ䱢→ᓄ⭘〻ᒿ᫵㠚؞᭩DŽ ྲօᤷᇊԕ৺㕆〻Ӫઈྲօ䘋㹼᫽֌DŽ࠶⇥઼࠶亥᫽֌䜭֯⭘傫⮉൘޵ᆈѝⲴ㺘ᶕᤷᇊᆳԜ਴㠚Ⲵਈᦒؑ ᱟє⿽ᒯ⌋֯⭘Ⲵൠ൰ਈᦒᢰᵟDŽᆳԜⲴн਼ѻ༴൘Ҿ䙫䗁ൠ൰ᱟྲօ㓴㓷ᡀ㻛᱐ሴⲴ޵ᆈඇǃਈᦒؑ᚟ ѪҶ߿ቁ⺞ᇊൠ൰ਈᦒᡰ䴰㾱Ⲵؑ᚟ˈਈᦒᡆ᱐ሴ䙊ᑨԕ޵ᆈඇ֌Ѫ᫽֌অսDŽ࠶⇥ᵪࡦ઼࠶亥ᵪࡦ ᵪࡦሶᆳਈᦒᡆ᱐ሴࡠ⢙⨶޵ᆈൠ൰кDŽ޵ᆈ㇑⨶ᵪࡦণ⭘Ҿሶ䘉⿽䙫䗁ൠ൰䖜ᦒᡀ⢙⨶޵ᆈൠ൰DŽ ѝⲴൠ൰ᱟ⭡є䜘࠶ᶴᡀⲴ䙫䗁ൠࡦDŽ䘉⿽䙫䗁ൠ൰ᒦн㜭ⴤ᧕⭘Ҿ䇯䰞⢙⨶޵ᆈˈ㘼䴰㾱֯⭘ൠ൰ਈᦒ ↓ྲк䶒ᨀࡠⲴˈ䇑㇇ᵪѝⲴ⢙⨶޵ᆈᱟᆇ㢲Ⲵ㓯ᙗᮠ㓴ˈ⇿њᆇ㢲ާᴹањୟаⲴ⢙⨶ൠ൰˗〻ᒿ 㜭DŽ ᣔ࣏؍ഐѪᡁԜਟԕ䇙ḀӋ⢙⨶ൠ൰н㻛ԫօ䙫䗁ൠ൰ᡰ᱐ሴˈᡰԕ൘ൠ൰ਈᦒ䗷〻ѝ਼ᰦҏᨀ׋Ҷ޵ᆈ 䇯䰞ਖањԫ࣑ᡆ᫽֌㌫㔏Ⲵ޵ᆈ४ฏDŽൠ൰ਈᦒ㜭ཏ䇙᫽֌㌫㔏൘㔉ԫ࣑࠶䝽޵ᆈᰦާᴹ⚥⍫ᙗˈᒦф ᣔ᧚ᯭᱟਟԕ䱢→ањԫ࣑؍ᣔ઼ൠ൰ਈᦒDŽᨀ׋؍˖䭞䜘࠶ޣԫօᆼᮤⲴ޵ᆈ㇑⨶㌫㔏䜭वਜ਼єњ 4.2.2 ൦൶਎ᦘ  ᣔ⁑ᔿ޵ᆈ㇑⨶؍ 亥ᑗ〫ٿ亥޵ * *   亥䮯. 〫ٿ⇥޵ ⇥ 亥สൠ൰ 〫ٿ亥޵ ⇥สൠ൰ ⇥䲀䮯  ⢙⨶ൠ൰ 亥ⴞᖅ 亥㺘 *'75 &5 ⢙⨶ൠ൰オ䰤 㓯ᙗൠ൰ 亥㺘亩 ⴞᖅ亩 ⴞᖅ〫ٿ亥䶒 亥޵ ⇥⇥ ⇥  ⇥ н⭘  ⇥ ⇥  ⇥ њ⇥ˈ⇿⇥ᴰ䮯 *  ޡˈњ⇥ˈ⇿⇥ᴰ䮯 * ተ䜘ൠ൰オ䰤  ޡˈተൠ൰オ䰤ޘ  ⇥᧿䘠ㅖ㺘 ⇥᧿䘠ㅖ 䟿˄ᴹ᭸ൠ൰˅〫ٿ ⇥䘹ᤙㅖ   䙫䗁ൠ൰  㓯ᙗൠ൰オ䰤 ޵ᆈ˄RAM ᡆ ROM˅ԕ৺ḀӋཆ䜘ᆈۘオ䰤˄ֻྲབྷᇩ䟿⺜ⴈ˅ᶕ⁑ᤏDŽᖃ֯⭘࠶亥ᰦˈ⇿њ⇥㻛ࡂ࠶ ࠶亥ᵪࡦ᭟ᤱ㲊ᤏᆈۘᢰᵟDŽ൘֯⭘㲊ᤏᆈۘⲴ⧟ຳѝˈབྷᇩ䟿Ⲵ㓯ᙗൠ൰オ䰤䴰㾱֯⭘ሿඇⲴ⢙⨶ ࡦབྷර〻ᒿ㘼ᰐ䴰㘳㲁ᇎ䱵⢙⨶޵ᆈウㄏᴹཊቁDŽ 䇙㕆〻Ӫઈӗ⭏޵ᆈオ䰤㾱∄䇑㇇ᵪѝᇎ䱵⢙⨶޵ᆈᇩ䟿བྷᖸཊⲴ䭉㿹DŽ࡙⭘䘉⿽䭉㿹ˈᡁԜਟԕ䲿᜿㕆 Ā㲊ᤏॆā㓯ᙗൠ൰オ䰤Ⲵᯩ⌅ˈণ֯⭘㲊ᤏᆈۘᢰᵟDŽ㲊ᤏᆈۘᱟа⿽޵ᆈ㇑⨶ᢰᵟˈ֯⭘䘉⿽ᢰᵟਟ ഐѪཊԫ࣑㌫㔏䙊ᑨᇊѹⲴ㓯ᙗൠ൰オ䰤䜭㾱∄ަਜ਼ᴹⲴ⢙⨶޵ᆈᇩ䟿བྷᗇཊˈᡰԕ䴰㾱֯⭘Ḁ⿽ 2. ࠶亥ᵪࡦ ഴ 䙱䗇൦൶Ƚ㓵ᙝ൦൶ૂ⢟⨼൦൶ҁ䰪Ⲻ਎ᦘ  㓯ᙗൠ൰オ䰤ቡᱟ⢙⨶ൠ൰オ䰤DŽ ᇩ䟿䗮ࡠ 64TB˄246˅DŽ㓯ᙗൠ൰オ䰤઼⢙⨶ൠ൰オ䰤䜭ᱟ 4GB˄232˅DŽᇎ䱵кˈྲ᷌⾱⭘࠶亥ᵪࡦˈ䛓Ѹ ൠ൰オ䰤DŽ㲊ᤏൠ൰˄䙫䗁ൠ൰˅オ䰤ਟवਜ਼ᴰཊ 16K Ⲵ⇥ˈ㘼⇿њ⇥ᴰ䮯ਟ䗮 4GBˈ֯ᗇ㲊ᤏൠ൰オ䰤 㓯ᙗൠ൰オ䰤о⢙⨶ൠ൰オ䰤ާᴹ⴨਼Ⲵ㔃ᶴDŽ⴨ሩҾє㔤Ⲵ䙫䗁ൠ൰オ䰤ᶕ䈤ˈᆳԜє㘵䜭ᱟа㔤  ᣔ⁑ᔿ޵ᆈ㇑⨶؍ ⢩ᵳ㓗⭘ᮠᆇ 0 ࡠ 3 㺘⽪ˈ0 ާᴹᴰ儈⢩ᵳ㓗ˈ㘼 3 ࡉᱟᴰվ⢩ᵳ㓗DŽ⇿њ޵ᆈ⇥䜭оањ⢩ᵳ㓗⴨ ⸱䇯䰞DŽ 㻛ԫ࣑ѝᴰਇؑԫⲴ䜘࠶䇯䰞DŽнཚ᭿ᝏⲴᮠᦞ㻛䍻Ҹ䖳վⲴ⢩ᵳ㓗ˈᆳԜਟԕ㻛ԫ࣑ѝ䖳վ⢩ᵳ㓗Ⲵԓ ѝн਼〻ᒿ䜘࠶Ⲵਇؑ〻ᓖˈᶕ䲀ࡦሩԫ࣑ѝ਴⇥Ⲵ䇯䰞DŽᴰ᭿ᝏⲴᮠᦞ㻛䍻ҸҶᴰ儈⢩ᵳ㓗ˈᆳԜਚ㜭 ൘ањԫ࣑ѝˈᇊѹҶ 4 њᢗ㹼⢩ᵳ㓗˄Privilege Levels˅ˈ⭘Ҿ׍ᦞ⇥ѝਜ਼ᴹᮠᦞⲴ᭿ᝏᓖԕ৺ԫ࣑ ᣔ؍2. ⢩ᵳ㓗 ӛᨀ׋Ҷ᭟ᤱDŽޡԓ⸱઼ᮠᦞ˄ֻྲ᫽֌㌫㔏˅Ⲵޡޜሶ㻛䖜ᦒࡠ਼ањ⢙⨶ൠ൰༴DŽ䘉㔉 ተൠ൰オ䰤ѝሩ⴨਼㲊ᤏൠ൰Ⲵᕅ⭘ޘ⴨਼Ⲵ㲊ᤏൠ൰ˈնӽ❦㜭䳄㔍⇿њԫ࣑DŽਖаᯩ䶒ˈᡰᴹԫ࣑൘ ਼ԫ࣑ѝሩ⴨਼㲊ᤏൠ൰༴Ⲵᕅ⭘ሶ䖜ᦒࡠн਼Ⲵ⢙⨶ൠ൰༴DŽ䘉֯ᗇ᫽֌㌫㔏ਟԕ㔉о⇿њԫ࣑Ⲵ޵ᆈ 㾱о㌫㔏ѝަԆԫ࣑४࡛ᔰⲴ⿱ᴹⲴԓ⸱઼ᮠᦞDŽ⭡Ҿ⇿њԫ࣑ѝާᴹн਼Ⲵተ䜘ൠ൰オ䰤ˈഐ↔єњн ⇿њԫ࣑ୟаⲴ㲊ᤏൠ൰オ䰤䜘࠶㻛〠Ѫተ䜘ൠ൰オ䰤˄Local address space˅DŽተ䜘ൠ൰オ䰤ਜ਼ᴹ䴰 ൠ൰オ䰤˄Global address space˅DŽ䘉ҏ↓ᱟ⧠ԓ Linux ᫽֌㌫㔏֯⭘㲊ᤏൠ൰オ䰤ⲴᯩᔿDŽ ተޘӛDŽ䘉њᡰᴹԫ࣑䜭ާᴹⲴ⴨਼㲊ᤏൠ൰オ䰤䜘࠶㻛〠Ѫޡൠ൰オ䰤䜘࠶ˈ᫽֌㌫㔏ਟԕ㻛ᡰᴹԫ࣑ Ⲵ㲊ᤏޡޜ䙊䗷൘ᡰᴹԫ࣑ѝᆹᧂާᴹ⴨਼Ⲵ㲊ᤏࡠ⢙⨶ൠ൰᱐ሴ䜘࠶ˈᒦфᢺ᫽֌㌫㔏ᆈۘ൘䘉њ 䭞䜘࠶ቡᱟ࠷ᦒࡠᯠԫ࣑Ⲵਈᦒ㺘DŽޣᦒⲴ ൰ਈᦒ࠭ᮠDŽ൘ 80X86 ѝˈ⇿њԫ࣑䜭ᴹ㠚ᐡⲴ⇥㺘઼亥㺘DŽᖃ༴⨶ಘ࠷ᦒ৫ᢗ㹼ањᯠԫ࣑ᰦˈԫ࣑࠷ ⨶޵ᆈ䜘࠶ˈᡰԕᡰᴹԫ࣑䜭㻛䳄㔍ᔰҶDŽਚ䴰㔉⇿њԫ࣑਴㠚⤜・Ⲵ᱐ሴ㺘ˈ⇿њԫ࣑ቡՊᴹн਼Ⲵൠ ࡠ⢙⨶޵ᆈѝⲴн਼४ฏѝDŽ䘉ṧˈഐѪањԫ࣑нਟ㜭⭏ᡀ㜭ཏ᱐ሴࡠަԆԫ࣑䙫䗁ൠ൰ሩᓄ֯⭘Ⲵ⢙ ਈᦒ࣏㜭㻛ᇊѹᡀањԫ࣑ѝⲴ䙫䗁ൠ൰᱐ሴࡠ⢙⨶޵ᆈⲴа䜘࠶४ฏˈ㘼ਖањԫ࣑ѝⲴ䙫䗁ൠ൰᱐ሴ 㖞൘н਼Ⲵ㲊ᤏൠ൰オ䰤ѝˈᒦ㔉Ҹ⇿њԫ࣑н਼Ⲵ䙫䗁ൠ൰ࡠ⢙⨶ൠ൰Ⲵਈᦒ᱐ሴDŽ⇿њԫ࣑ѝⲴൠ൰ ᣔ㜭࣋DŽ80X86 ֯⭘Ⲵᯩ⌅ᱟ䙊䗷ᢺ⇿њԫ࣑᭮؍ᣔⲴањ䟽㾱ᯩ䶒ᱟᨀ׋ᓄ⭘〻ᒿ਴ԫ࣑ѻ䰤Ⲵ؍ ᣔ؍1. ԫ࣑ѻ䰤Ⲵ ᣔ᫽֌㌫㔏޵ᆈ⇥઼༴⨶ಘ⢩↺㌫㔏ᇴᆈಘн㻛ᓄ⭘〻ᒿ䇯䰞DŽ ؍ᣔᵪࡦሩԫ࣑䘋㹼᫽֌ˈԕ؍ࡠDŽਖањڊ䘉ᱟ䙊䗷㔉⇿њԫ࣑䙫䗁ൠ൰ࡠ⢙⨶ൠ൰н਼Ⲵਈᦒ᱐ሴᶕ 䳄⿫਴њԫ࣑DŽޘᣔDŽަаᱟ䙊䗷㔉⇿њԫ࣑н਼Ⲵ㲊ᤏൠ൰˄䙫䗁ൠ൰˅オ䰤ᶕᆼ؍ 80X86 ᭟ᤱє㊫ 4.2.3 ؓᣚ ਚᱟㆰঅൠᢺ㓯ᙗൠ൰䖜ᦒᡀ⢙⨶ൠ൰ˈᒦф൘⢙⨶޵ᆈѝ䇯䰞㠚ᐡⲴ䖜ᦒ㺘DŽ Ӌ㓯ᙗൠ൰䖜ᦒࡠ⢙⨶ൠ൰Ⲵ䗷〻DŽ㊫լൠˈ࠶亥ᵪࡦҏн⸕䚃〻ᒿӗ⭏ൠ൰Ⲵ㲊ᤏൠ൰オ䰤DŽ࠶亥ᵪࡦ ᤏൠ൰˄䙫䗁ൠ൰˅ਈᦒᡀ㓯ᙗൠ൰ˈᒦф൘㓯ᙗൠ൰オ䰤ѝ䇯䰞㠚ᐡⲴ㺘ˈնᱟᒦн⸕ᲃ࠶亥ᵪࡦᢺ䘉 ᆈ൘⢙⨶ൠ൰オ䰤DŽഐ㘼⇥ਈᦒ㺘ਟ⭡࠶亥ᵪࡦ䟽ᯠᇊս㘼ᰐ䴰⇥ᵪࡦⲴؑ᚟ᡆਸ֌DŽ⇥ਈᦒᵪࡦᢺ㲊؍ ᵪࡦ䜭֯⭘ᆈۘ൘޵ᆈѝⲴਈᦒ㺘ˈնᡰ⭘Ⲵ㺘㔃ᶴн਼DŽᇎ䱵кˈ⇥㺘ᆈۘ൘㓯ᙗൠ൰オ䰤ˈ㘼亥㺘ࡉ ࠶⇥઼࠶亥ᱟє⿽н਼Ⲵൠ൰ਈᦒᵪࡦˈᆳԜ䜭ሩᮤњൠ൰ਈᦒ᫽֌ᨀ׋⤜・Ⲵ༴⨶䱦⇥DŽቭ㇑є⿽ ӛ᫽֌DŽޡ ᣔ઼؍Ⲵ޵ᆈঅݳ㘼ᰐ䴰ਇࡠപᇊབྷሿ亥䶒Ⲵ䲀ࡦDŽ⇿њ⇥䜭ਟԕ֌Ѫањঅݳᶕ༴⨶ˈӾ㘼ㆰॆҶ⇥Ⲵ ᆈDŽਖаᯩ䶒ˈ࠶⇥ᵪࡦ֯⭘བྷሿਟਈⲴඇᴤ䘲ਸ༴⨶༽ᵲ㌫㔏Ⲵ䙫䗁࠶४DŽਟԕᇊѹо䙫䗁ඇབྷሿ䘲ਸ བྷሿਟਈⲴඇᶕ㇑⨶޵ᆈDŽᰐ䇪൘⢙⨶޵ᆈѝ䘈ᱟ൘⺜ⴈкˈ࠶亥֯⭘പᇊབྷሿⲴඇᴤѪ䘲ਸ㇑⨶⢙⨶޵ 80X86 ࠶亥ᵪࡦᴰ䘲ਸ᭟ᤱ㲊ᤏᆈۘᢰᵟDŽ࠶亥ᵪࡦՊ֯⭘བྷሿപᇊⲴ޵ᆈඇˈ㘼࠶⇥㇑⨶ࡉ֯⭘Ҷ ᇎ⧠Ҷ࠶亥ᵪࡦᰦˈ䛓ѸሩҾ↓⺞ᢗ㹼Ⲵ〻ᒿᶕ䈤亥䶒൘⢙⨶޵ᆈ઼⺜ⴈѻ䰤ⲴӔᦒቡᱟ䘿᰾ⲴDŽ ޵ᆈѝˈᒦ㔗㔝ᢗ㹼ࡊ᡽㻛ѝᯝⲴ〻ᒿDŽᖃ᫽֌㌫㔏ѕṬ⨶⢙ޕ❦ਾ᫽֌㌫㔏ቡਟԕӾ⺜ⴈкᢺ䈕亥䶒䈫 ྲ᷌ᖃࡽ㻛䇯䰞Ⲵ亥䶒н൘⢙⨶޵ᆈѝˈ༴⨶ಘቡՊѝᯝ〻ᒿⲴᢗ㹼˄䙊䗷ӗ⭏ањ亥䭉䈟ᔲᑨ˅DŽ ⭘亥ⴞᖅ઼亥㺘ᢺ㓯ᙗൠ൰䖜ᦒᡀањ⢙⨶ൠ൰ˈ❦ਾ൘䈕޵ᆈս㖞кᢗ㹼ᡰ㾱≲Ⲵ᫽֌˄䈫ᡆ߉˅DŽ аӋ亥㺘ᶕ⮉᜿䘉Ӌ亥䶒DŽᖃ〻ᒿ˄ᡆԫ࣑˅䈅മ䇯䰞㓯ᙗൠ൰オ䰤ѝⲴањൠ൰ս㖞ᰦˈ༴⨶ಘቡՊ֯ ᡀ亥䶒˄䙊ᑨ⇿亥Ѫ 4KB བྷሿ˅ˈ亥䶒Պ㻛ᆈۘҾ⢙⨶޵ᆈѝᡆ⺜ⴈкDŽ᫽֌㌫㔏䙊䗷㔤ᣔањ亥ⴞᖅ઼  ᣔ⁑ᔿ޵ᆈ㇑⨶؍ ⴨਼㘼䟽ਐⲴ४ฏкDŽޘ⇥Ⲵ⇥䲀䮯⴨਼ˈᒦ㻛᱐ሴࡠ㓯ᙗൠ൰ᆼ 䟽ਐˈ㿱മ 4-6 ᡰ⽪DŽ൘ᵜҖӻ㓽Ⲵ Linux 0.1x ㌫㔏ѝˈањԫ࣑Ⲵԓ⸱⇥઼ᮠᦞޘ䟽ਐᡆ㾶ⴆˈ⭊㠣ᆼ ֐䈅മ߉ањਚ䈫Ⲵ⇥ˈ䛓Ѹ 80386 ቡՊӗ⭏ањᔲᑨDŽਖཆˈཊњ⇥᱐ሴࡠ㓯ᙗൠ൰ѝⲴ㤳തਟԕ䜘࠶ ѹⲴˈྲ᷌֯⭘ࡉՊሬ㠤ᔲᑨDŽਖཆˈ㤕䇯䰞ањ⇥ᒦ⋑ᴹᗇࡠ⇥኎ᙗ䇨ਟࡉҏՊሬ㠤ᔲᑨDŽֻྲˈྲ᷌ 䟿བྷҾ⇥䲀䮯Ⲵ㲊ᤏൠ൰ᱟᰐ᜿〫ٿ⇥޵ 0 ࡠ limit Ⲵൠ൰㤳തሩᓄ㓯ᙗൠ൰ѝ㤳ത base ࡠ base + limitDŽ ⇥䲀䮯ᇊѹҶ൘㲊ᤏൠ൰オ䰤ѝ⇥ⲴབྷሿDŽ⇥ส൰઼⇥䲀䮯ᇊѹҶ⇥ᡰ᱐ሴⲴ㓯ᙗൠ൰㤳തᡆ४ฏDŽ 㓗ㅹDŽ 3. ⇥኎ᙗ˄Attributes˅ˈᤷᇊ⇥Ⲵ⢩ᙗDŽֻྲ䈕⇥ᱟ੖ਟ䈫ǃਟ߉ᡆਟ֌Ѫањ〻ᒿᢗ㹼˗⇥Ⲵ⢩ᵳ ս㖞DŽᆳᇊѹҶ⇥Ⲵ䮯ᓖDŽ〫ٿ2. ⇥䲀䮯˄limit˅ˈᱟ㲊ᤏൠ൰オ䰤ѝ⇥޵ᴰབྷਟ⭘ ༴DŽ 0 〫ٿѝ 1. ⇥สൠ൰˄Base address˅ˈᤷᇊ⇥൘㓯ᙗൠ൰オ䰤ѝⲴᔰ࿻ൠ൰DŽสൠ൰ᱟ㓯ᙗൠ൰ˈሩᓄҾ⇥ 䜘࠶ᶴᡀDŽ⇥ᱟ㲊ᤏൠ൰ࡠ㓯ᙗൠ൰䖜ᦒᵪࡦⲴส⹰DŽ⇿њ⇥⭡йњ৲ᮠᇊѹ˖〫ٿ Ӌ䮯ᓖਟਈⲴ〠Ѫ⇥Ⲵ޵ᆈඇঅݳDŽ80386 㲊ᤏൠ൰オ䰤ѝⲴ㲊ᤏൠ൰˄䙫䗁ൠ൰˅⭡ањ⇥䜘࠶઼ањ ԕ᱐ሴࡠ䈫߉޵ᆈǃਚ䈫޵ᆈԕ৺޵ᆈ᱐ሴ I/O ѝDŽ࠶⇥ᵪࡦቡᱟᢺ㲊ᤏൠ൰オ䰤ѝⲴ㲊ᤏ޵ᆈ㓴㓷ᡀа 㓯кਟԕራ൰Ⲵൠ൰オ䰤DŽ䘉њൠ൰オ䰤ᱟᒣඖⲴˈൠ൰㤳തӾ 0 ࡠ 0xFFFFFFFFDŽ䘉њ⢙⨶ൠ൰オ䰤ਟ ᣔ⁑ᔿѝ 80X86 ᨀ׋Ҷ 4GB Ⲵ⢙⨶ൠ൰オ䰤DŽ䘉ᱟ༴⨶ಘ൘ަൠ൰ᙫ؍ˈ൘ка㢲ᾲ䘠ѝᐢ㓿ᨀࡠ 4.3.1 ⇫Ⲻᇐѿ ᣔ᫽֌㌫㔏〻ᒿнਇᓄ⭘〻ᒿ䶎⌅䇯䰞DŽ؍ᣔ㓗࡛ਟ⭘Ҿ؍ᣔ⧟ᡆ㓗࡛DŽ؍䰞ᵳ䲀ؑ᚟ҏਟԕ⭘ᶕ䇮㖞 ֌DŽֻྲˈഐѪԓ⸱⇥㻛䇮䇑ᡀᱟਚ䈫ᖒᔿⲴ⇥ˈഐ↔ਟԕ⭘⺜Ԧᶕ䱢→ሩԓ⸱⇥ᢗ㹼߉᫽֌DŽ⇥ѝⲴ䇯 ᣔሩ⇥⭼䲀ԕཆൠ൰Ⲵᕅ⭘ˈ㘼фҏ㜭⭘ᶕ൘ḀӋ⇥ѝ䱢→ᢗ㹼нݱ䇨Ⲵ᫽؍䇯䰞Ựḕнӵ㜭ཏ⭘ᶕ ӛⲴDŽሩᡰᴹ⇥ԕ৺㌫㔏к䘀㹼〻ᒿ਴㠚ᢗ㹼⧟ຳⲴ䇯䰞䜭⭡⺜Ԧ᧗ࡦDŽޡᱟ〻ᒿѻ䰤 ᱟ⿱ᴹⲴˈᡆ㘵ޘᑨˈ⇿њ〻ᒿ˄ᡆԫ࣑˅䜭֯⭘㠚ᐡⲴ⇥᧿䘠ㅖ㺘ԕ৺㠚ᐡⲴ⇥DŽሩ〻ᒿᶕ䈤⇥㜭ཏᆼ ᣔ᧚ᯭDŽ䙊؍䜘࣏㜭ᨀ׋⭡⺜Ԧ໎ᕪⲴԓ⸱ǃᮠᦞ㔃ᶴǃ〻ᒿ઼ԫ࣑Ⲵޘཊ⇥⁑ර㜭ཏ࡙⭘࠶⇥ᵪࡦ රˈࡠ֯⭘࠶⇥ᵪࡦࡋᔪањਟ਼ᰦਟ䶐ൠ䘀㹼ཊњ〻ᒿ˄ᡆԫ࣑˅Ⲵާᴹっപ᫽֌⧟ຳⲴཊ⇥⁑රDŽ ᣔ〻ᒿⲴᒣඖ⁑؍࠶⇥ᵪࡦਟ⭘Ҿᇎ⧠ཊ⿽㌫㔏䇮䇑DŽ䘉Ӌ䇮䇑㤳തӾ֯⭘࠶⇥ᵪࡦⲴᴰሿ࣏㜭ᶕ 4.3 ࠼⇫ᵰ࡬ њ⢩ᵳ㓗кᢗ㹼ᰦˈึḸ⇥ҏ䲿ѻ᭩ᦒࡠᯠ㓗࡛ⲴึḸѝDŽ ᣔ䰞仈DŽᖃ〻ᒿӾањ⢩ᵳ㓗࠷ᦒࡠਖа؍ӛḸᑖᶕⲴޡ⇿њ⢩ᵳ㓗䜭ᴹ㠚ᐡⲴ〻ᒿḸˈԕ䚯ݽ֯⭘ ᕅਁањᔲᑨᶕ䙊⸕᫽֌㌫㔏DŽ ᇊ CPL 㓗࡛кᢗ㹼Ⲵ〻ᒿݱ䇨䇯䰞਼㓗࡛ᡆվ㓗࡛Ⲵᮠᦞ⇥DŽԫօሩ儈㓗࡛⇥Ⲵᕅ⭘䜭ᱟ䶎⌅ⲴˈᒦфՊ ⇿ᖃ〻ᒿԱമ䇯䰞ањ⇥ᰦˈᖃࡽ⢩ᵳ㓗ቡՊо⇥Ⲵ⢩ᵳ㓗䘋㹼∄䖳ˈԕ⺞ᇊᱟ੖ᴹ䇯䰞䇨ਟDŽ൘㔉 ѹҶᖃࡽᡰᢗ㹼〻ᒿⲴ⢩ᵳ㓗࡛DŽCPL ⺞ᇊҶଚӋ⇥㜭ཏ㻛〻ᒿ䇯䰞DŽ ਆᗇ઼ᢗ㹼ᤷԔˈᖃࡽ⢩ᵳ㓗˄Current Privilege Level˅ˈণ CPL ቡᱟᖃࡽ⍫ࣘԓ⸱⇥Ⲵ⢩ᵳ㓗ˈᒦфᆳᇊ 㚄DŽ䘉њ⢩ᵳ㓗䲀ࡦާᴹ䏣ཏ⢩ᵳ㓗Ⲵ〻ᒿᶕ䇯䰞ањ⇥DŽᡁԜ⸕䚃ˈ༴⨶ಘӾ CS ᇴᆈಘᤷᇊⲴ⇥ѝޣ  ࠶⇥ᵪࡦ 㓯ᙗൠ൰ ⇥᧿䘠ㅖ㺘 ⇥᧿䘠ㅖ 䟿˄ᴹ᭸ൠ൰˅〫ٿ ⇥䘹ᤙㅖ   䙫䗁ൠ൰  %DVH/LPLW 㲊ᤏൠ൰オ䰤 㓯ᙗൠ൰オ䰤 ⇥& ⇥% ⇥$  䲀䮯 /LPLW ⇥ส൰ %DVH  䟿кˈᴰਾᖒᡀањ㓯ᙗൠ൰DŽ〫ٿ3. ᢺ⇥᧿䘠ㅖѝਆᗇⲴ⇥สൠ൰࣐ࡠ 䟿սҾ⇥⭼䲀޵DŽ〫ٿ䈕⇥ᱟਟ䇯䰞Ⲵᒦф؍⺞2. ࡙⭘⇥᧿䘠ㅖỰ傼⇥Ⲵ䇯䰞ᵳ䲀઼㤳തˈԕ 䘹ᤙㅖ࣐䖭ࡠ⇥ᇴᆈಘѝᰦ᡽䴰㾱䘉а↕DŽ˅ ㍒ᕅ˅൘ GDT ᡆ LDT 㺘ѝᇊս⴨ᓄⲴ⇥᧿䘠ㅖDŽ˄ӵᖃањᯠⲴ⇥⇥˄٬〫ٿ1. ֯⭘⇥䘹ᤙㅖѝⲴ ѪҶᢺ䙫䗁ൠ൰䖜ᦒᡀањ㓯ᙗൠ൰ˈ༴⨶ಘՊᢗ㹼ԕл᫽֌˖ 㓯ᙗൠ൰オ䰤ѝਜ਼ᴹѪ㌫㔏ᇊѹⲴᡰᴹ⇥઼㌫㔏㺘DŽ 32 սൠ൰DŽо⢙⨶ൠ൰オ䰤㊫լˈ㓯ᙗൠ൰オ䰤ҏᱟᒣඖⲴ 4GB ൠ൰オ䰤ˈൠ൰㤳തӾ 0 ࡠ 0xFFFFFFFFDŽ ⴨ሩҾ⇥สൠ൰Ⲵս㖞DŽ༴⨶ಘՊᢺ⇿њ䙫䗁ൠ൰䖜ᦒᡀ㓯ᙗൠ൰DŽ㓯ᙗൠ൰ᱟ༴⨶ಘ㓯ᙗൠ൰オ䰤ѝⲴ 䟿ᤷᇊ䈕ᆇ㢲൘⇥ѝ〫ٿ䟿㓴ᡀˈ㿱മ 4-7 ᡰ⽪DŽ⇥䘹ᤙㅖᤷᇊᆇ㢲ᡰ൘Ⲵ⇥ˈ㘼〫ٿ⇥䘹ᤙㅖ઼ 32 սⲴ ণ࡙֯⭘⇥Ⲵᴰሿ࣏㜭ˈ֯⭘䙫䗁ൠ൰ҏ㜭䇯䰞༴⨶ಘൠ൰オ䰤ѝⲴ⇿њᆇ㢲DŽ䙫䗁ൠ൰⭡ 16 սⲴ ᤷᇊ㺘ѝањ⇥᧿䘠ㅖⲴս㖞ᶕᤷᇊ⴨ᓄⲴ⇥DŽ ˄Descriptor table˅ѝDŽ⇥᧿䘠ㅖ㺘ᱟवਜ਼⇥᧿䘠ㅖ亩Ⲵањㆰঅᮠ㓴DŽࡽ䶒ӻ㓽Ⲵ⇥䘹ᤙㅖণ⭘Ҿ䙊䗷 ᆈ൘޵ᆈѝⲴ⇥᧿䘠ㅖ㺘؍൘䙫䗁ൠ൰ࡠ㓯ᙗൠ൰Ⲵ䖜ᦒ᱐ሴ䗷〻ѝՊ֯⭘䘉њ⇥᧿䘠ㅖDŽ⇥᧿䘠ㅖ ᣔ኎ᙗᆈۘ൘ањ〠Ѫ⇥᧿䘠ㅖ˄Segment Descriptor˅Ⲵ㔃ᶴ亩ѝDŽ؍⇥Ⲵสൠ൰ǃ⇥䲀䮯ԕ৺⇥Ⲵ ഴ 㲐ᤕδ䙱䗇ε൦൶グ䰪ѣⲺ⇫᱖ሺࡦ㓵ᙝ൦൶グ䰪   ࠶⇥ᵪࡦ ,7 /LPLW 6HO /LPLW %DVH$GGUHVV *'75 ᇴᆈಘ ተ᧿䘠ㅖ㺘 *'7ޘ⇥䘹ᤙㅖ ተ䜘᧿䘠ㅖ㺘 /'7  7,  7,               %DVH$GGUHVV /'75 ᇴᆈಘ ӛDŽєњ LDT ⇥˖LDTA ઼ LDTB ҏ֯⭘ GDT ᶕ᱐ሴDŽޡᆳԜਟԕ㻛єњԫ࣑ᡰ ⭘ LDTB ᶕ᱐ሴ CodeB ઼ DataB ⇥DŽवਜ਼᫽֌㌫㔏޵ṨⲴєњ⇥ CodeOS ઼ DataOS ֯⭘ GDT ᶕ᱐ሴˈ䘉ṧ A ൘ԫ࣑ A ѝ䘀㹼ˈᤕᴹ LDTAˈ⭘ᶕ᱐ሴ⇥ CodeA ઼ DataADŽ㊫լൠˈᓄ⭘〻ᒿ B ൘ԫ࣑ B ѝ䘀㹼ˈ֯ ᒿ˄A ઼ B˅ԕ৺᫽֌㌫㔏DŽ㌫㔏ѝ⇿њᓄ⭘〻ᒿሩᓄањԫ࣑ˈᒦф⇿њԫ࣑ᴹ㠚ᐡⲴ LDTDŽᓄ⭘〻ᒿ ᴹ 6 њ⇥ˈ࠶࡛⭘Ҿєњᓄ⭘〻ޡമ 4-9 ⽪ࠪањԫ࣑ѝⲴ⇥ྲօ㜭൘ GDT ઼ LDT ѻ䰤࠶ᔰDŽമѝ ⇥DŽLDT ⇥ਟԕᜣ䊑ᡀ኎Ҿ᫽֌㌫㔏ⲴᮠᦞDŽ ӛⲴ⇥⭡ GDT ᶕ᱐ሴDŽ䘉ṧⲴ⇥䙊ᑨवᤜਜ਼ᴹ᫽֌㌫㔏Ⲵ⇥ԕ৺ᡰᴹԫ࣑਴㠚Ⲵवਜ਼ LDT Ⲵ⢩↺ޡԫ࣑ ᴹⲴˈնᱟ LDT ᡰ᱐ሴⲴਖаॺࡉ൘ԫ࣑࠷ᦒᰦ㻛᭩ਈDŽ㌫㔏ѝᡰᴹޡ㲊ᤏൠ൰オ䰤ᱟ㌫㔏ѝᡰᴹԫ࣑ ᖃਁ⭏ԫ࣑࠷ᦒᰦˈLDT Պᴤᦒᡀᯠԫ࣑Ⲵ LDTˈնᱟ GDT ᒦнՊ᭩ਈDŽഐ↔ˈGDT ᡰ᱐ሴⲴаॺ Ԝቡਟԕᇊսањ᧿䘠ㅖDŽ аॺᱟ⭡ LDT ᱐ሴⲴተ䜘㲊ᤏൠ൰オ䰤DŽ䙊䗷ᤷᇊањ᧿䘠ㅖ㺘˄GDT ᡆ LDT˅ԕ৺㺘ѝ᧿䘠ㅖਧˈᡁ ተ㲊ᤏൠ൰オ䰤ˈਖޘਜ਼ᴹ 214 њ⇥˖аॺオ䰤˄ণ 213 њ⇥˅ᱟ⭡ GDT ᱐ሴⲴޡሴDŽᮤњ㲊ᤏൠ൰オ䰤 ᚟DŽ㲊ᤏൠ൰オ䰤㻛࠶ࢢᡀབྷሿ⴨ㅹⲴєॺDŽаॺ⭡ GDT ᶕ᱐ሴਈᦒࡠ㓯ᙗൠ൰ˈਖаॺࡉ⭡ LDT ᶕ᱐ ᣔⲴ޵ᆈ४ฏѝˈԕ䱢→ᓄ⭘〻ᒿ؞᭩ަѝⲴൠ൰䖜ᦒؑ؍ᆈ൘ӵ⭡᫽֌㌫㔏䖟Ԧ䇯䰞Ⲵਇ؍↺㔃ᶴᓄ䈕 ᧿䘠ㅖ㺘ᆈۘ൘⭡᫽֌㌫㔏㔤ᣔ⵰Ⲵ⢩↺ᮠᦞ㔃ᶴѝˈᒦф⭡༴⨶ಘⲴ޵ᆈ㇑⨶⺜Ԧᶕᕅ⭘DŽ䘉Ӌ⢩ ഴ ⇫ᨅ䘦ㅜ㺞㔉ᶺ  descriptor table˅DŽ ተ᧿䘠ㅖ㺘 GDT˄Global descriptor table˅˗ተ䜘᧿䘠ㅖ㺘 LDT˄Localޘ˖ᆇ㢲᧿䘠ㅖDŽᴹє⿽᧿䘠ㅖ㺘 ⇥᧿䘠ㅖ㺘ᱟ⇥᧿䘠ㅖⲴањᮠ㓴ˈ㿱മ 4-8 ᡰ⽪DŽ᧿䘠ㅖ㺘Ⲵ䮯ᓖਟਈˈᴰཊਟԕवਜ਼ 8192 њ 8 4.3.2 ⇫ᨅ䘦ㅜ㺞 䖜ᦒሶ൘〽ਾ䘋㹼䈤᰾DŽ к˅DŽྲ᷌ሩ㓯ᙗൠ൰オ䰤䘋㹼Ҷ࠶亥༴⨶ˈ䛓ѸቡՊ֯⭘Ҽ㓗ൠ൰䖜ᦒᢺ㓯ᙗൠ൰䖜ᦒᡀ⢙⨶ൠ൰DŽ亥 ྲ᷌⋑ᴹᔰ੟࠶亥ˈ䛓Ѹ༴⨶ಘⴤ᧕ᢺ㓯ᙗൠ൰᱐ሴࡠ⢙⨶ൠ൰˄ণ㓯ᙗൠ൰㻛䘱ࡠ༴⨶ಘൠ൰ᙫ㓯 ഴ 䙱䗇൦൶ࡦ㓵ᙝ൦൶Ⲻ਎ᦘ䗽ぁ  ࠶⇥ᵪࡦ % ԫ࣑ /'7% &RGH%  'DWD%  ԫ࣑ $ /'7$ &RGH$  *'7 'DWD$  'DWD26  &RGH26  ᡆ STR ᤷԔ˅ᰦˈ՚᧿䘠ㅖᓄ䈕ᆈ᭮൘ৼᆇሩ喀Ⲵൠ൰༴˄ণ ൠ൰ MOD 4 = 0˅DŽ ᆈ LDTR ᡆԫ࣑ᇴᆈಘ˄࠶࡛֯⭘ SLTR؍ᆈ IDTR ᇴᆈಘ޵ᇩᰦҏ䴰㾱֯⭘਼ṧⲴሩ喀ᯩᔿDŽ❦㘼ˈᖃ ؍՚᧿䘠ㅖˈնᱟਟԕ䙊䗷֯⭘䘉⿽ሩ喀ᯩᔿᶕ䚯ݽӗ⭏ањሩ喀Ựḕࠪ䭉Ⲵਟ㜭ᙗDŽᖃ֯⭘ SIDT ᤷԔ ᆈ؍䘉Պ䇙༴⨶ಘݸᆈ᭮ањሩ喀Ⲵᆇˈ䲿ਾᱟањሩ喀Ⲵৼᆇ˄4 ᆇ㢲ሩ喀༴˅DŽ⭘ᡧ⁑ᔿ〻ᒿ䙊ᑨнՊ ⭘ᡧ⁑ᔿ˄⢩ᵳ㓗 3˅䚯ݽሩ喀Ựḕࠪ䭉ˈ՚᧿䘠ㅖᓄ䈕ᆈ᭮൘ањཷᆇൠ൰༴˄ণ ൠ൰ MOD 4 = 2˅DŽ ᆈ GDTR ᇴᆈಘ޵ᇩᰦ˄֯⭘ SGDT ᤷԔ˅ˈањ 48 սⲴĀ՚᧿䘠ㅖā㻛ᆈۘ൘޵ᆈѝDŽѪҶ൘؍ᖃ 䲀䮯ԕ৺䇯䰞ᵳ䲀䴰㾱ᆈ᭮൘ LDTR ᇴᆈಘѝDŽ 䇯䰞 LDT 䴰֯⭘ަ⇥䘹ᤙㅖDŽѪҶ൘䇯䰞 LDT ᰦ߿ቁൠ൰䖜ᦒ⅑ᮠˈLDT Ⲵ⇥䘹ᤙㅖǃสൠ൰ǃ⇥ 㺘ⲴԫօൠᯩDŽ 䈍ˈ䛓Ѹ⇿њ LDT 䜭ᗵ享൘ GDT ѝᴹањ⇥᧿䘠ㅖ઼⇥䘹ᤙㅖDŽањ LDT Ⲵ⇥᧿䘠ㅖਟԕᆈ᭮൘ GDT LDT 㺘ᆈ᭮൘ LDT ㊫රⲴ㌫㔏⇥ѝDŽ↔ᰦ GDT ᗵ享ਜ਼ᴹ LDT Ⲵ⇥᧿䘠ㅖDŽྲ᷌㌫㔏᭟ᤱཊ LDT Ⲵ Պӗ⭏ањᔲᑨDŽ ᣔᙗᔲᑨDŽ䙊䗷֯⭘䘉њ⇥䘹ᤙㅖࡍ࿻ॆ⇥ᇴᆈಘˈ䛓Ѹ᜿ཆᕅ⭘ᵚ֯⭘Ⲵ⇥ᇴᆈಘ㛟ᇊ؍ᇊՊӗ⭏а㡜 ˄DSǃESǃFS ᡆ GS˅ᒦнՊӗ⭏ањᔲᑨˈնᱟ㤕֯⭘䘉Ӌ࣐䖭Ҷオ᧿䘠ㅖⲴ⇥䘹ᤙㅖ䇯䰞޵ᆈᰦቡ㛟 ༴⨶ಘᒦн֯⭘ GDT ѝⲴㅜ 1 њ᧿䘠ㅖDŽᢺ䘉њĀオ᧿䘠ㅖāⲴ⇥䘹ᤙㅖ࣐䖭䘋ањᮠᦞ⇥ᇴᆈಘ њᴹ᭸ᆇ㢲DŽഐѪ⇥᧿䘠ㅖᙫᱟ 8 ᆇ㢲䮯ˈഐ↔ GDT Ⲵ䲀䮯٬ᓄ䈕䇮㖞ᡀᙫᱟ 8 Ⲵؽᮠ߿ 1˄ণ 8N-1˅DŽ ᆇ㢲ѪঅսDŽо⇥㊫լˈ䲀䮯٬࣐кสൠ൰ਟᗇࡠᴰਾ㺘ѝᴰਾањᆇ㢲Ⲵᴹ᭸ൠ൰DŽ䲀䮯Ѫ 0 㺘⽪ᴹ 1 䖭䘋 GDTR ᇴᆈಘѝDŽGDT Ⲵสൠ൰ᓄ䈕䘋㹼޵ᆈ 8 ᆇ㢲ሩ喀ˈԕᗇࡠᴰ֣༴⨶ಘᙗ㜭DŽGDT Ⲵ䲀䮯ԕ GDT ᵜ䓛ᒦнᱟањ⇥ˈ㘼ᱟ㓯ᙗൠ൰オ䰤ѝⲴањᮠᦞ㔃ᶴDŽGDT Ⲵส㓯ᙗൠ൰઼䮯ᓖ٬ᗵ享࣐ ӛањ LDTDŽޡֻྲˈਟԕѪ⇿њ䘀㹼ԫ࣑ᇊѹањ LDTˈᡆ㘵ḀӋᡆᡰᴹԫ࣑ ⇿њ㌫㔏ᗵ享ᇊѹањ GDTˈᒦਟ⭘Ҿ㌫㔏ѝᡰᴹ〻ᒿᡆԫ࣑DŽਖཆˈਟ䘹ᇊѹањᡆཊњ LDTDŽ ᣔ䴰≲ѻаDŽ؍䭞ޣ ൠˈᖃԫ࣑ B 䘀㹼ᰦˈԫ࣑ A Ⲵ⇥ҏн㜭㻛ራ൰DŽ䘉⿽֯⭘ LDT ᶕ䳄⿫⇿њᓄ⭘〻ᒿԫ࣑Ⲵᯩ⌅ˈ↓ᱟ ԫ࣑ A ൘䘀㹼ᰦˈԫ࣑ B Ⲵ⇥нᱟ㲊ᤏൠ൰オ䰤Ⲵ䜘࠶ˈഐ↔ԫ࣑ A ⋑ᴹ࣎⌅䇯䰞ԫ࣑ B Ⲵ޵ᆈDŽ਼ṧ 䘉њֻᆀ䙊䗷䇙⇿њԫ࣑֯⭘н਼Ⲵ LDTˈ╄⽪Ҷ㲊ᤏൠ൰オ䰤ྲօ㜭ཏ㻛㓴㓷ᡀ䳄⿫⇿њԫ࣑DŽᖃ ሴⲴ⇥DŽ ⇥ CodeOS ઼ DataOSDŽᖃԫ࣑ B ൘䘀㹼ᰦˈਟ䇯䰞Ⲵ⇥वᤜ LDTB ᱐ሴⲴ CodeB ઼ DataB ⇥ˈ࣐к GDT ᱐ ᖃԫ࣑ A ൘䘀㹼ᰦˈਟ䇯䰞Ⲵ⇥वᤜ LDTA ᱐ሴⲴ CodeA ઼ DataA ⇥ˈ࣐к GDT ᱐ሴⲴ᫽֌㌫㔏Ⲵ Աࣗᡶ⭞Ⲻ⇫㊱ශ ഴ   ࠶⇥ᵪࡦ ] I 䘹ᤙㅖ H 䘹ᤙㅖ [IIII G 䘹ᤙㅖ [    ㍒ᕅ7,53/    ㍒ᕅ7,53/    ㍒ᕅ7,53/ F 䘹ᤙㅖ [I E 䘹ᤙㅖ [ D 䘹ᤙㅖ [    ㍒ᕅ7,53/    ㍒ᕅ7,53/    ㍒ᕅ7,53/ 7, 53/᧿䘠ㅖ㍒ᕅ  ሩᓄ⭘〻ᒿᶕ䈤⇥䘹ᤙㅖᱟ֌Ѫᤷ䪸ਈ䟿Ⲵа䜘࠶㘼ਟ㿱ˈն䘹ᤙㅖⲴ٬䙊ᑨᱟ⭡䬮᧕㕆䗁ಘᡆ䬮᧕ 䘹ᤙㅖ࣐䖭ࡠ CS ᡆ SS ⇥ᇴᆈಘѝᰦሶՊሬ㠤ањᔲᑨDŽ ѝᰦˈ༴⨶ಘᒦнӗ⭏ᔲᑨDŽնᱟᖃ֯⭘ਜ਼ᴹオ䘹ᤙㅖⲴ⇥ᇴᆈಘ⭘Ҿ䇯䰞޵ᆈᰦቡՊӗ⭏ᔲᑨDŽᖃᢺオ ᤙㅖ˅⭘֌ѪĀオ䘹ᤙㅖāˈ㿱മ 4-11(f)ᡰ⽪DŽᖃᢺオ䘹ᤙㅖ࣐䖭ࡠањ⇥ᇴᆈಘ˄䲔Ҷ CS ઼ SS ԕཆ˅ ਖཆˈ༴⨶ಘн֯⭘ GDT 㺘ѝⲴㅜ 1 亩DŽᤷੁ GDT 䈕亩Ⲵ䘹ᤙㅖ˄ণ㍒ᕅ٬Ѫ 0ˈTI ḷᘇѪ 0 Ⲵ䘹 ഴ ⇫䘿᤟ㅜ⽰ׁ  ٬ᱟ 0b1111111111111˄ণ 8191˅ˈTI սㅹҾ 1ˈᤷᇊ LDT 㺘DŽ⇥ᇊ LDT 㺘ѝ RPL=3 Ⲵ⇥ 8191DŽަ㍒ᕅᆇ ޵ṨⲴ޵Ṩԓ⸱⇥ǃ޵Ṩᮠᦞ⇥ǃԫ࣑ԓ⸱⇥઼ԫ࣑ᮠᦞ⇥Ⲵ䘹ᤙㅖDŽമ 4-11(e)ѝⲴ䘹ᤙㅖ˄0xffff˅ᤷ 2ˈTI սᱟ 1ˈᤷᇊ LDT 㺘DŽᇎ䱵кˈമ 4-11 ѝⲴࡽ 4 њ䘹ᤙㅖ˖(a)ǃ(b)ǃ(c)઼(d)࠶࡛ቡᱟ Linux 0.1x ٬ᱟ⇥TI սᱟ 1ˈᤷᇊ LDT 㺘DŽമ 4-11(d)ѝ䘹ᤙㅖ˄0x17˅ᤷᇊҶ LDT ѝާᴹ RPL=3 Ⲵ⇥ 2ˈަ㍒ᕅᆇ ٬ᱟ 1ˈ⇥ᱟ 0ˈᤷᇊ GDT 㺘DŽമ 4-11(c)ѝ䘹ᤙㅖ˄0x0f˅ᤷᇊҶ LDT ѝާᴹ RPL=3 Ⲵ⇥ 1ˈަ㍒ᕅᆇ ٬ᱟ 2ˈTI ս⇥ᤷᇊ GDT 㺘DŽമ 4-11(b)ѝ䘹ᤙㅖ˄0x10˅ᤷᇊҶ GDT ѝާᴹ RPL=0 Ⲵ⇥ 2ˈަ㍒ᕅᆇ ٬ᱟ 1ˈTI սᱟ 0ˈ⇥ֻྲˈമ 4-11(a)ѝ䘹ᤙㅖ˄0x08˅ᤷᇊҶ GDT ѝާᴹ RPL=0 Ⲵ⇥ 1ˈަ㍒ᕅᆇ ᒦф᧿䘠ㅖѝवਜ਼ᴹ䇯䰞ањ⇥Ⲵᡰᴹؑ᚟ˈֻྲ⇥Ⲵสൠ൰ǃ⇥䮯ᓖ઼⇥኎ᙗDŽ ࠪҶ᧿䘠ㅖ൘ GDT ᡆ LDT 㺘ѝⲴ㍒ᕅ亩ਧDŽਟ㿱ˈ䘹ᤙㅖ䙊䗷ᇊս⇥㺘ѝⲴањ᧿䘠ㅖᶕᤷᇊањ⇥ˈ ᧿䘠ㅖⲴ⇥᧿䘠ㅖ㺘 GDT ᡆ LDTDŽTI=0 㺘⽪᧿䘠ㅖ൘ GDT ѝ˗TI=1 㺘⽪᧿䘠ㅖ൘ LDT ѝDŽ㍒ᕅᆇ⇥㔉 ᣔؑ᚟ˈሶ൘ਾ䶒֌䈖㓶䈤᰾DŽ㺘㍒ᕅᆇ⇥ TI ⭘ᶕᤷࠪवਜ਼ᤷᇊ⇥؍⇥䈧≲⢩ᵳ㓗ᆇ⇥ RPL ᨀ׋Ҷ ഴ ⇫䘿᤟ㅜ㔉ᶺ  Index˅DŽ˄„ ㍒ᕅ٬ „ 㺘ᤷ⽪ḷᘇ TI˄Table Index˅˗ „ 䈧≲⢩ᵳ㓗 RPL˄Requested Privilege Level˅˗ ᱟᤷੁ⇥᧿䘠ㅖ㺘ѝᇊѹ⇥Ⲵ⇥᧿䘠ㅖDŽ⇥䘹ᤙㅖ 3 њᆇ⇥޵ᇩ˖ ⇥䘹ᤙㅖ˄ᡆ〠⇥䘹ᤙᆀ˅ᱟ⇥Ⲵањ 16 սḷ䇶ㅖˈ㿱മ 4-10 ᡰ⽪DŽ⇥䘹ᤙㅖᒦнⴤ᧕ᤷੁ⇥ˈ㘼 4.3.3 ⇫䘿᤟ㅜ  ࠶⇥ᵪࡦ ⇥䘹ᤙㅖ ⇥สൠ൰ǃ䲀䮯઼኎ᙗؑ᚟ ਟ㿱䜘࠶ 䳀㯿䜘࠶ *6 )6 (6 '6 66 &6 䖭ಘᡆ㘵᫽֌㌫㔏ᶕࡋᔪˈն㔍нᱟᓄ⭘〻ᒿDŽമ 4-13 ⽪ࠪҶᡰᴹ㊫ර⇥᧿䘠ㅖⲴа㡜ṬᔿDŽ ㅖ䮯ᓖᱟ 8 ᆇ㢲ˈਜ਼ᴹйњѫ㾱ᆇ⇥˖⇥สൠ൰ǃ⇥䲀䮯઼⇥኎ᙗDŽ⇥᧿䘠ㅖ䙊ᑨ⭡㕆䈁ಘǃ䬮᧕ಘǃ࣐ ањ⇥Ⲵս㖞઼བྷሿؑ᚟ԕ৺䇯䰞᧗ࡦⲴ⣦ᘱؑ᚟DŽ⇿њ⇥᧿䘠ޣањᮠᦞ㔃ᶴ亩ˈ⭘Ҿੁ༴⨶ಘᨀ׋ᴹ ࡽ䶒ᡁԜᐢ㓿䈤᰾Ҷ֯⭘⇥䘹ᤙㅖᶕᇊս᧿䘠ㅖ㺘ѝⲴањ᧿䘠ㅖDŽ⇥᧿䘠ㅖᱟ GDT ઼ LDT 㺘ѝⲴ 4.3.4 ⇫ᨅ䘦ㅜ MOV ᤷԔᖃ❦ҏਟԕ⭘Ҿᢺ⇥ᇴᆈಘਟ㿱䜘࠶޵ᇩᆈۘࡠањ䙊⭘ᇴᆈಘѝDŽ ԔDŽ䘉ӋᤷԔ൘᫽֌䗷〻ѝՊ䱴ᑖ᭩ਈ CS ᇴᆈಘ˄઼ḀӋަԆ⇥ᇴᆈಘ˅Ⲵ޵ᇩDŽ 2. 䳀ᔿ࣐䖭ᤷԔˈֻྲ֯⭘䮯ᤷ䪸Ⲵ CALLǃJMP ઼ RET ᤷԔǃIRETǃINTnǃINTO ઼ INT3 ㅹᤷ 1. 䊑 MOVǃPOPǃLDSǃLESǃLSSǃLGS ԕ৺ LFS ᤷԔDŽ䘉ӋᤷԔᱮᔿൠⴤ᧕ᕅ⭘⇥ᇴᆈಘ˗ Ѫ࣐䖭⇥ᇴᆈಘˈᨀ׋Ҷє㊫࣐䖭ᤷԔ˖ 䘠ㅖ㺘ѝⲴ⴨ᓄ⇥ؑ᚟䟽ᯠ࣐䖭ࡠᖡᆀᇴᆈಘѝDŽ ⿽䰞仈ᴰㆰᦧⲴᯩ⌅ᱟ൘ሩ᧿䘠ㅖ㺘ѝ᧿䘠ㅖ֌䗷ԫօ᭩ࣘѻਾቡ・࡫䟽ᯠ࣐䖭 6 њ⇥ᇴᆈಘDŽ䘉ሶᢺ᧿ ᇴᆈಘѝDŽ੖ࡉ᧿䘠ㅖ㺘ѝањ⇥Ⲵสൠ൰ᡆ䲀䮯㻛؞᭩䗷ˈն᭩ࣘত⋑ᴹ৽᱐ࡠᖡᆀᇴᆈಘѝDŽ༴⨶䘉 ሩ᧿䘠ㅖ㺘Ⲵ᭩ࣘᓄ৽᱐൘ᖡᆀ؍⺞⭡Ҿᖡᆀᇴᆈಘਜ਼ᴹ᧿䘠ㅖؑ᚟Ⲵањᤧ䍍ˈഐ↔᫽֌㌫㔏ᗵ享 ಘਟԕ൘䘋㹼ൠ൰䖜ᦒᰦн޽䴰㾱㣡䍩ᰦ䰤Ӿ⇥᧿䘠ㅖѝ䈫ਆสൠ൰઼䲀䮯٬DŽ ԕ৺䇯䰞᧗ࡦؑ᚟࣐䖭ࡠ⇥ᇴᆈಘⲴ䳀㯿䜘࠶ѝDŽ㕃ߢ൘⇥ᇴᆈಘ˄ਟ㿱઼䳀㯿䜘࠶˅ѝⲴؑ᚟֯ᗇ༴⨶ ᤙㅖ㻛࣐䖭ࡠањ⇥ᇴᆈಘਟ㿱䜘࠶ѝᰦˈ༴⨶ಘҏ਼ᰦᢺ⇥䘹ᤙㅖᤷੁⲴ⇥᧿䘠ㅖѝⲴ⇥ൠ൰ǃ⇥䲀䮯 њĀਟ㿱ā䜘࠶઼ањĀ䳀㯿ā䜘࠶˄䳀㯿䜘࠶ҏ㻛〠ѪĀ᧿䘠ㅖ㕃ߢāᡆĀᖡᆀᇴᆈಘā˅DŽᖃањ⇥䘹 ਖཆˈѪҶ䚯ݽ⇿⅑䇯䰞޵ᆈᰦ䜭৫ᕅ⭘᧿䘠ㅖ㺘ˈ৫䈫઼䀓⸱ањ⇥᧿䘠ㅖˈ⇿њ⇥ᇴᆈಘ䜭ᴹа ᖸཊⲴ⇥ˈն਼ᰦਚᴹ 6 њ⇥ਟ׋・ণ䇯䰞DŽ㤕㾱䇯䰞ަԆ⇥ቡ䴰㾱࣐䖭䘉Ӌ⇥Ⲵ䘹ᤙㅖDŽ ሩҾ䇯䰞Ḁњ⇥Ⲵ〻ᒿˈᗵ享ᐢ㓿ᢺ⇥䘹ᤙㅖ࣐䖭ࡠањ⇥ᇴᆈಘѝDŽഐ↔ˈቭ㇑ањ㌫㔏ਟԕᇊѹ ഴ ⇫ᇺᆎಞ㔉ᶺ  ⇥DŽ йњ䖵ࣙⲴᮠᦞ⇥ᇴᆈಘ˄ESǃFS ઼ GS˅ˈਟ㻛⭘Ҿ䇙ᖃࡽᢗ㹼〻ᒿ˄ᡆԫ࣑˅㜭ཏ䇯䰞ަԆࠐњᮠᦞ 䴰㾱ᢺᴹ᭸Ⲵ⇥䘹ᤙㅖ࣐䖭ࡠԓ⸱⇥˄CS˅ǃᮠᦞ⇥˄DS˅઼ึḸ⇥˄SS˅ᇴᆈಘѝDŽ༴⨶ಘ䘈ਖཆᨀ׋ ণ⇥ᇴᆈಘDŽ⇿њ⇥ᇴᆈಘ᭟ᤱ⢩ᇊ㊫රⲴ޵ᆈᕅ⭘˄ԓ⸱ǃᮠᦞᡆึḸ˅DŽ৏ࡉкᢗ㹼⇿њ〻ᒿ䜭䎧⸱ Ѫ߿ቁൠ൰䖜ᦒᰦ䰤઼㕆〻༽ᵲᙗˈ༴⨶ಘᨀ׋ਟᆈ᭮ᴰཊ 6 њ⇥䘹ᤙㅖⲴᇴᆈಘ˄㿱മ 4-12 ᡰ⽪˅ˈ ࣐䖭〻ᒿ䘋㹼䇮㖞ᡆ؞᭩ˈ㘼䶎ᓄ⭘〻ᒿDŽ  ࠶⇥ᵪࡦ * 仇㋂ᓖ 7<3(  ⇥㊫ර'3/ ᧿䘠ㅖ⢩ᵳ㓗  ԓ⸱ᡆᮠᦞ㌫㔏 6  ᧿䘠ㅖ㊫ර 3⇥ᆈ൘ /,0,7  ⇥䲀䮯  ս⇥ ս %' 唈䇔བྷሿ %$6( ⇥สൠ൰ $9/ ㌫㔏䖟Ԧਟ⭘ս   %DVH$GGUHVV สൠ൰ 6HJPHQW/LPLW ⇥䲀䮯 '3/ 6   ⇥䲀䮯 / 9 $ 3 %  ' *         7<3(  %DVH สൠ൰ %DVH สൠ൰          ⇥ᆈ൘ḷᘇ P ᤷࠪањ⇥ᱟ൘޵ᆈѝ˄P=1˅䘈ᱟн൘޵ᆈѝ˄P=0˅DŽᖃањ⇥᧿䘠ㅖⲴ P ḷᘇ ƹ⇥ᆈ൘ḷᘇ P˄Segment present˅ ࡦሩ⇥Ⲵ䇯䰞DŽ DPL ᆇ⇥ᤷ᰾᧿䘠ㅖⲴ⢩ᵳ㓗DŽ⢩ᵳ㓗㤳തӾ 0 ࡠ 3DŽ0 㓗⢩ᵳ㓗ᴰ儈ˈ3 㓗ᴰվDŽDPL ⭘Ҿ᧗ ƹ᧿䘠ㅖ⢩ᵳ㓗ᆇ⇥ DPL˄Descriptor privilege level˅ ᧿䘠ㅖ㊫රḷᘇSᤷ᰾ањ⇥᧿䘠ㅖᱟ㌫㔏⇥᧿䘠ㅖ˄ᖃS=0˅䘈ᱟԓ⸱ᡆᮠᦞ⇥᧿䘠ㅖ˄ᖃS=1˅DŽ ƹ᧿䘠ㅖ㊫රḷᘇ S˄Descriptor type flag˅ 㕆⸱ሩԓ⸱ǃᮠᦞᡆ㌫㔏᧿䘠ㅖ䜭н਼ˈ㿱മ 4-14 ᡰ⽪DŽ Ҿ᧿䘠ㅖ㊫රḷᘇ S ᤷ᰾ᱟањᓄ⭘˄ԓ⸱ᡆᮠᦞ˅᧿䘠ㅖ䘈ᱟањ㌫㔏᧿䘠ㅖDŽTYPE ᆇ⇥Ⲵ ㊫රᆇ⇥ᤷᇊ⇥ᡆ䰘˄Gate˅Ⲵ㊫රǃ䈤᰾⇥Ⲵ䇯䰞⿽㊫ԕ৺⇥ⲴᢙኅᯩੁDŽ䈕ᆇ⇥Ⲵ䀓䟺׍䎆 ƹ⇥㊫රᆇ⇥ TYPE˄Type field˅ ԓ⸱઼ᮠᦞ⇥ሩ喀൘ 16 ᆇ㢲䗩⭼кˈਟԕ䇙〻ᒿާᴹᴰ֣ᙗ㜭DŽ 㓴ਸᖒᡀањ 32 սⲴ٬DŽ⇥สൠ൰ᓄ䈕ሩ喀 16 ᆇ㢲䗩⭼DŽ㲭❦䘉нᱟ㾱≲Ⲵˈն䙊䗷ᢺ〻ᒿⲴ 䈕ᆇ⇥ᇊѹ൘ 4GB 㓯ᙗൠ൰オ䰤ѝањ⇥ᆇ㢲 0 ᡰ༴Ⲵս㖞DŽ༴⨶ಘՊᢺ 3 њ࠶・Ⲵสൠ൰ᆇ⇥ ƹสൠ൰ᆇ⇥ BASE˄Base address field˅ 䘲ਸᢙኅึḸDŽ オ䰤ᓅ䜘࠶䝽ᯠⲴ޵ᆈˈ㘼нᱟ൘亦䜘࠶䝽DŽ80X86 ⲴḸᙫᱟੁлᢙኅⲴˈഐ↔䘉⿽ᇎ⧠ᯩᔿᖸ ᣔᙗᔲᑨDŽሩҾлᢙ⇥ˈ߿ሿ⇥䲀䮯ᆇ⇥ѝⲴ٬Պ൘䈕⇥ൠ൰؍٬ሶӗ⭏а㡜〫ٿ䲀䮯 Limit Ⲵ ٬㤳തਟӾ⇥䲀䮯 Limit ࡠ 0xFFFFFFFF ᡆ 0xFFFFDŽ㘼ሿҾ⇥〫ٿˈ䇔Ḹᤷ䪸བྷሿḷᘇ B Ⲵ䇮㖞 ᣔᙗᔲᑨDŽሩҾੁлᢙኅⲴ⇥˄ㆰ〠лᢙ⇥˅ˈ⇥䲀䮯 Limit Ⲵਜ਼ѹ⴨৽DŽṩᦞ唈؍٬ሶӗ⭏а㡜 〫ٿLimitDŽབྷҾ⇥䲀䮯 Limit Ⲵ ٬㤳തਟԕӾ 0 ࡠ⇥䲀䮯٬〫ٿ˄ㆰ〠кᢙ⇥˅ˈ䙫䗁ൠ൰ѝⲴ ṩᦞ⇥㊫රѝⲴ⇥ᢙኅᯩੁḷᘇ Eˈ༴⨶ಘԕє⿽н਼ᯩᔿ֯⭘⇥䲀䮯 LimitDŽሩҾੁкᢙኅⲴ⇥ 4KBDŽ Ӿ 1 ᆇ㢲ࡠ 1MB ᆇ㢲ˈঅսᱟᆇ㢲DŽྲ᷌ G=1ˈࡉ⇥䮯ᓖ Limit 㤳തਟӾ 4KB ࡠ 4GBˈঅսᱟ ٬Ⲵᇎ䱵ਜ਼ѹDŽྲ᷌ G=0ˈࡉ⇥䮯ᓖ Limit 㤳തਟ ᒦṩᦞ仇㋂ᓖḷᘇ G ᶕᤷᇊ⇥䲀䮯 Limitˈ٬ ⇥䲀䮯 Limit ᆇ⇥⭘Ҿᤷᇊ⇥Ⲵ䮯ᓖDŽ༴⨶ಘՊᢺ⇥᧿䘠ㅖѝєњ⇥䲀䮯ᆇ⇥㓴ਸᡀањ 20 սⲴ ƹ⇥䲀䮯ᆇ⇥ LIMIT˄Segment limit field˅ ањ⇥᧿䘠ㅖѝ਴ᆇ⇥઼ḷᘇⲴਜ਼ѹྲл˖ ഴ ⇫ᨅ䘦ㅜ䙐⭞Ṳᕅ   ࠶⇥ᵪࡦ ⮉սᒦᓄ䈕ᙫᱟ䇮㖞Ѫ 0DŽ؍⇥᧿䘠ㅖㅜ 2 њৼᆇⲴս 20 ਟ׋㌫㔏䖟Ԧ֯⭘˗ս 21 ᱟ ⮉∄⢩ս˄Available and reserved bits˅؍ƹਟ⭘઼ ٬Ѫ 0 ࡠ 4095DŽ〫ٿ٬Ⲵ 12 սᴰվᴹ᭸սDŽֻྲˈᖃ G=1 ᰦˈ⇥䲀䮯Ѫ 0 㺘᰾ᴹ᭸〫ٿḕ ٬ᰦˈᒦнՊ৫Ự〫ٿ൰Ⲵ仇㋂ᓖᙫᱟᆇ㢲অսDŽ˅㤕䇮㖞Ҷ G ḷᘇˈ䛓Ѹᖃ֯⭘⇥䲀䮯ᶕỰḕ ྲ᷌䇮㖞Ҷ仇㋂ᓖḷᘇˈࡉ⇥䲀䮯٬֯⭘ 4KB অսDŽ˄䘉њḷᘇнᖡ૽⇥สൠ൰Ⲵ仇㋂ᓖˈสൠ ٬ⲴঅսDŽྲ᷌仇㋂ᓖḷᘇѪ 0ˈࡉ⇥䲀䮯٬Ⲵঅսᱟᆇ㢲˗ 䈕ᆇ⇥⭘Ҿ⺞ᇊ⇥䲀䮯ᆇ⇥ Limit ƹ仇㋂ᓖḷᘇ G˄Granularity˅ ˄64KB˅DŽ Ḹ⇥Ⲵк⭼䲀ᱟ 0xFFFFFFFF˄4GB˅˗ྲ᷌⋑ᴹ䇮㖞䈕ḷᘇˈࡉึḸ⇥Ⲵк⭼䲀ᱟ 0xFFFF „ лᢙᮠᦞ⇥DŽ↔ᰦ䈕ḷᘇ〠Ѫ B ḷᘇˈ⭘Ҿᤷ᰾ึḸ⇥Ⲵк⭼䲀DŽྲ᷌䇮㖞Ҷ䈕ḷᘇˈࡉึ Ḹ⇥㻛䇮㖞ᡀањлᢙᮠᦞ⇥ˈ䘉њ B ḷᘇҏ਼ᰦᤷᇊҶึḸ⇥Ⲵк⭼䲀DŽ ᆈ᭮൘ ESP ᇴᆈಘѝ˗ྲ᷌䈕ḷᘇѪ 0ˈࡉ֯⭘ 16 սḸᤷ䪸ᒦᆈ᭮൘ SP ᇴᆈಘѝDŽྲ᷌ึ ֌˄ֻྲ PUSHǃPOP ᡆ CALL˅ᰦⲴḸᤷ䪸བྷሿDŽྲ᷌䈕ḷᘇ㖞սˈࡉ֯⭘ 32 սḸᤷ䪸ᒦ „ Ḹ⇥˄⭡ SS ᇴᆈಘᤷੁⲴᮠᦞ⇥˅DŽ↔ᰦ䈕ḷᘇ〠Ѫ B˄Big˅ḷᘇˈ⭘Ҿᤷ᰾䳀ਜ਼ึḸ᫽ ᫽֌ᮠབྷሿ˗ࡽ㔰 0x67 ਟ⭘ᶕ䘹ᤙ䶎唈䇔٬Ⲵൠ൰བྷሿDŽ 0ˈࡉ唈䇔٬ᱟ 16 սൠ൰઼ 16 սᡆ 8 սⲴ᫽֌ᮠDŽᤷԔࡽ㔰 0x66 ਟԕ⭘ᶕ䘹ᤙ䶎唈䇔٬Ⲵ 唈䇔䮯ᓖDŽྲ᷌䈕ḷᘇ㖞սˈࡉ唈䇔٬ᱟ 32 սൠ൰઼ 32 սᡆ 8 սⲴ᫽֌ᮠ˗ྲ᷌䈕ḷᘇѪ „ ਟᢗ㹼ԓ⸱⇥DŽ↔ᰦ䘉њḷᘇ〠Ѫ D ḷᘇᒦ⭘Ҿᤷࠪ䈕⇥ѝⲴᤷԔᕅ⭘ᴹ᭸ൠ൰઼᫽֌ᮠⲴ 㻛䇮㖞Ѫ 0DŽ˅ 㜭DŽ˄ሩҾ 32 սԓ⸱઼ᮠᦞ⇥ˈ䘉њḷᘇᓄ䈕ᙫᱟ䇮㖞Ѫ 1˗ሩҾ 16 սԓ⸱઼ᮠᦞ⇥ˈ䘉њḷᘇ ṩᦞ⇥᧿䘠ㅖ᧿䘠Ⲵᱟањਟᢗ㹼ԓ⸱⇥ǃлᢙᮠᦞ⇥䘈ᱟањึḸ⇥ˈ䘉њḷᘇާᴹн਼Ⲵ࣏ ˄Default operation size/default stack pointer size and/or upper bound˅ ƹ D/B˄唈䇔᫽֌བྷሿ/唈䇔Ḹᤷ䪸བྷሿ઼/ᡆк⭼䲀˅ḷᘇ нᆈ൘⇥ᇎ䱵൘ӰѸൠᯩⲴؑ᚟DŽޣᴹ ᆈ㠚ᐡⲴᮠᦞˈֻྲ؍ᰦˈ᫽֌㌫㔏ਟԕ㠚⭡֯⭘Ṭᔿѝḷ⌘Ѫਟ⭘˄Avaliable˅Ⲵᆇ⇥ս㖞ᶕ 㲊ᤏᆈۘᨀ׋Ҷ䲔࠶亥ᵪࡦԕཆⲴ᧗ࡦDŽമ 4-15 㔉ࠪҶᖃ P=0 ᰦⲴ⇥᧿䘠ㅖṬᔿDŽᖃ P ḷᘇѪ 0 ㇑⨶䖟Ԧਟԕ֯⭘䘉њḷᘇᶕ᧗ࡦ൘Ḁа㔉ᇊᰦ䰤ᇎ䱵䴰㾱ᢺ䛓њ⇥࣐䖭䘋޵ᆈѝDŽ䘉њ࣏㜭Ѫ Ѫ 0 ᰦˈ䛓Ѹᢺᤷੁ䘉њ⇥᧿䘠ㅖⲴ䘹ᤙㅖ࣐䖭䘋⇥ᇴᆈಘሶሬ㠤ӗ⭏ањ⇥нᆈ൘ᔲᑨDŽ޵ᆈ  ࠶⇥ᵪࡦ 3  ᆈ൘ :  ਟ߉ /,0,7  ⇥䲀䮯 5  ਟ䈫 *  仇㋂ᓖ (  ᢙኅᯩੁ 3/  ᧿䘠ㅖ⢩ᵳ㓗' '  唈䇔٬ 5& $ :( $ ㌫㔏⇥᧿䘠ㅖ ԓ⸱⇥᧿䘠ㅖ ᮠᦞ⇥᧿䘠ㅖ   %DVH$GGUHVV สൠ൰ 6HJPHQW/LPLW ⇥䲀䮯  '3/   ⇥䲀䮯 / 9 $ ' 3  *         7<3( %DVH สൠ൰ %DVH สൠ൰            %DVH$GGUHVV สൠ൰ 6HJPHQW/LPLW ⇥䲀䮯  '3/   ⇥䲀䮯 / 9 $ % 3  *         7<3( %DVH สൠ൰ %DVH สൠ൰          & а㠤ԓ⸱⇥ % 唈䇔བྷሿ $9/ 䖟Ԧਟ⭘ս $ ᐢ䇯䰞   %DVH$GGUHVV สൠ൰ 6HJPHQW/LPLW ⇥䲀䮯  '3/    ⇥䲀䮯 3  *         7<3(  %DVH สൠ൰ %DVH สൠ൰            $YDLODEOH ਟ⭘ '3/ 6        7<3(  $YDLODEOH ਟ⭘ $YDLODEOH ਟ⭘          ഴ ᖉᆎ൞փ 3  ᰬⲺ⇫ᨅ䘦ㅜṲᕅ  ഴ ԙ⸷⇫Ƚᮦᦤ⇫ૂ㌱㔕⇫ᨅ䘦ㅜṲᕅ   ࠶⇥ᵪࡦ ԓ⸱⇥ਟԕᱟа㠤ᙗⲴᡆ䶎а㠤ᙗⲴDŽੁᴤ儈⢩ᵳ㓗а㠤ᙗԓ⸱⇥Ⲵᢗ㹼᧗ࡦ䖜〫ˈݱ䇨〻ᒿԕᖃࡽ ᣔ⁑ᔿлˈԓ⸱⇥ᱟнਟ߉ⲴDŽ؍൘ Ԕᡆ㘵ᢺԓ⸱⇥䘹ᤙㅖ࣐䖭䘋ањᮠᦞ⇥ᇴᆈಘ˄DSǃESǃFS ᡆ GS˅ˈᡁԜਟԕ䈫ਆԓ⸱⇥ѝⲴᮠᦞDŽ ԕ৺ᤷԔ⸱㻛᭮൘Ҷањ ROM ѝᰦቡਟԕ֯⭘ањਟᢗ㹼/ਟ䈫ԓ⸱⇥DŽ䘉䟼ˈ䙊䗷֯⭘ᑖ CS ࡽ㔰Ⲵᤷ ˄Conforming˅DŽṩᦞਟ䈫 R ḷᘇⲴ䇮㖞ˈԓ⸱⇥ਟԕᱟਚ㜭ᢗ㹼ǃਟᢗ㹼/ਟ䈫DŽᖃᑨᮠᡆަԆ䶉ᘱᮠᦞ ሩҾԓ⸱⇥ˈ㊫රᆇ⇥Ⲵվ 3 ս㻛䀓䟺ᡀᐢ䇯䰞 A˄Accessed˅ǃਟ䈫 R˄Read-enable˅઼а㠤Ⲵ C ޵ᆈ㇑⨶઼䈳䈅DŽ ᤱ㖞ս⣦ᘱDŽ䈕սਟ⭘Ҿ㲊ᤏ؍ᤙㅖ࣐䖭䘋⇥ᇴᆈಘˈᆳቡՊ䇮㖞䈕սDŽ䈕ս䴰㾱᰾⺞ൠ␵䲔ˈ੖ࡉаⴤ ᐢ䇯䰞∄⢩սᤷ᰾㠚Ӿк⅑᫽֌㌫㔏༽ս䈕սѻਾањ⇥ᱟ੖㻛䇯䰞䗷DŽ⇿ᖃ༴⨶ಘᢺањ⇥Ⲵ⇥䘹 㖞ս˅DŽ䘉䟼ˈࣘᘱ᭩ਈ⇥䲀䮯ሶሬ㠤Ḹオ䰤㻛␫࣐ࡠḸᓅ䜘DŽ ᣔᔲᑨDŽྲ᷌ึḸ⇥Ⲵ䮯ᓖ䴰㾱ࣘᘱൠ᭩ਈˈ䛓ѸึḸ⇥ਟԕᱟањੁлᢙኅⲴᮠᦞ⇥˄ᢙኅᯩੁḷᘇ؍ ึḸ⇥ᗵ享ᱟਟ䈫/߉Ⲵᮠᦞ⇥DŽ㤕֯⭘нਟ߉ᮠᦞ⇥Ⲵ䘹ᤙㅖ࣐䖭ࡠ SS ᇴᆈಘѝˈሶሬ㠤ања㡜 15 1 1 1 1 ԓ⸱ а㠤ᙗ⇥ˈᢗ㹼/ਟ䈫ˈᐢ䇯䰞 14 1 1 1 0 ԓ⸱ а㠤ᙗ⇥ˈᢗ㹼/ਟ䈫 13 1 1 0 1 ԓ⸱ а㠤ᙗ⇥ˈӵᢗ㹼ˈᐢ䇯䰞 12 1 1 0 0 ԓ⸱ а㠤ᙗ⇥ˈӵᢗ㹼 11 1 0 1 1 ԓ⸱ ᢗ㹼/ਟ䈫ˈᐢ䇯䰞 10 1 0 1 0 ԓ⸱ ᢗ㹼/ਟ䈫 9 1 0 0 1 ԓ⸱ ӵᢗ㹼ˈᐢ䇯䰞 8 1 0 0 0 ԓ⸱ ӵᢗ㹼 C R A 7 0 1 1 1 ᮠᦞ ੁлᢙኅˈਟ䈫/߉ˈᐢ䇯䰞 6 0 1 1 0 ᮠᦞ ੁлᢙኅˈਟ䈫/߉ 5 0 1 0 1 ᮠᦞ ੁлᢙኅˈਚ䈫ˈᐢ䇯䰞 4 0 1 0 0 ᮠᦞ ੁлᢙኅˈਚ䈫 3 0 0 1 1 ᮠᦞ ਟ䈫/߉ˈᐢ䇯䰞 2 0 0 1 0 ᮠᦞ ਟ䈫/߉ 1 0 0 0 1 ᮠᦞ ਚ䈫ˈᐢ䇯䰞 0 0 0 0 0 ᮠᦞ ਚ䈫 E W A 䈤᰾ ㊫ර ᧿䘠ㅖ ॱ䘋ࡦ ս 11 ս 10 ս 9 ս 8 ㊫ර˄TYPE˅ᆇ⇥ 㺞 ԙ⸷⇫ૂᮦᦤ⇫ᨅ䘦ㅜ㊱ශ սⲴ䈤᰾DŽṩᦞਟ߉∄⢩ս W Ⲵ䇮㖞ˈањᮠᦞ⇥ਟԕᱟਚ䈫Ⲵˈҏਟԕᱟਟ䈫ਟ߉ⲴDŽ ԓ⸱઼ᮠᦞ⇥㊫රᆇ⇥∄⢩ޣ߉ W˄Write-enable˅઼ᢙኅᯩੁ E˄Expansion-direction˅ˈ৲㿱㺘 4-3 ѝᴹ ሩҾᮠᦞ⇥Ⲵ᧿䘠ㅖˈ㊫රᆇ⇥Ⲵվ 3 ս˄ս 8ǃ9ǃ10˅㻛࠶࡛⭘Ҿ㺘⽪ᐢ䇯䰞 A˄Accessed˅ǃਟ ⢩ս˄ㅜ 2 њৼᆇⲴս 11˅⭘Ҿ⺞ᇊᱟᮠᦞ⇥Ⲵ᧿䘠ㅖ˄༽ս˅䘈ᱟԓ⸱⇥Ⲵ᧿䘠ㅖ˄㖞ս˅DŽ ᖃ⇥᧿䘠ㅖѝ S˄᧿䘠ㅖ㊫ර˅ḷᘇ㻛㖞սˈࡉ䈕᧿䘠ㅖ⭘Ҿԓ⸱ᡆᮠᦞ⇥DŽ↔ᰦ㊫රᆇ⇥ѝᴰ儈∄ 4.3.5 ԙ⸷ૂᮦᦤ⇫ᨅ䘦ㅜ㊱ශ  ࠶⇥ᵪࡦ 15 1 1 1 1 32-Bit Trap Gate 32 ս䲧䱡䰘 14 1 1 1 0 32-Bit Interrupt Gate 32 սѝᯝ䰘 ⮉؍ 13 1 1 0 1 Reserved 12 1 1 0 0 32-Bit Call gate 32 ս䈳⭘䰘 11 1 0 1 1 32-Bit TSS (Busy) 32 ս TSS˄ᘉ˅ ⮉؍ 10 1 0 1 0 Reserved 9 1 0 0 1 32-Bit TSS (Available) 32 ս TSS˄ਟ⭘˅ ⮉؍ 8 1 0 0 0 Reserved 7 0 1 1 1 16-Bit Trap Gate 16 ս䲧䱡䰘 6 0 1 1 0 16-Bit Interrupt Gate 16 սѝᯝ䰘 5 0 1 0 1 Task Gate ԫ࣑䰘 4 0 1 0 0 16-Bit Call Gate 16 ս䈳⭘䰘 3 0 0 1 1 16-Bit TSS (Busy) 16 ս TSS˄ᘉ˅ 2 0 0 1 0 LDT LDT 1 0 0 0 1 16-Bit TSS (Available) 16 ս TSS˄ਟ⭘˅ ⮉؍ 0 0 0 0 0 Reserved 䈤᰾ ॱ䘋ࡦ ս 11 ս 10 ս 9 ս 8 ㊫ර˄TYPE˅ᆇ⇥ 㺞 ㌱㔕⇫ૂ䰞ᨅ䘦ㅜ㊱ශ ᤷ䪸˗ሩҾԫ࣑䰘ˈަѝਜ਼ᴹ TSS Ⲵ⇥䘹ᤙㅖDŽ㺘 4-4 㔉ࠪҶ㌫㔏⇥᧿䘠ㅖ઼䰘᧿䘠ㅖ㊫රᆇ⇥Ⲵ㕆⸱DŽ ਓ⛩Ⲵޕ⇥˅ˈ䰘᧿䘠ㅖቡᱟањĀ䰘āˈሩҾ䈳⭘ǃѝᯝᡆ䲧䱡䰘ˈަѝਜ਼ᴹԓ⸱⇥Ⲵ䘹ᤙㅖ઼⇥ѝ〻ᒿ 䘉Ӌ᧿䘠ㅖ㊫රਟ࠶Ѫєབྷ㊫˖㌫㔏⇥᧿䘠ㅖ઼䰘᧿䘠ㅖDŽ㌫㔏⇥᧿䘠ㅖᤷੁ㌫㔏⇥˄ྲ LDT ઼ TSS „ ԫ࣑䰘᧿䘠ㅖDŽ „ 䲧䱡䰘᧿䘠ㅖ˗ „ ѝᯝ䰘᧿䘠ㅖ˗ „ 䈳⭘䰘᧿䘠ㅖ˗ „ ԫ࣑⣦ᘱ⇥˄TSS˅᧿䘠ㅖ˗ „ ተ䜘᧿䘠ㅖ㺘˄LDT˅Ⲵ⇥᧿䘠ㅖ˗ ⨶ಘ㜭ཏ䇶࡛ԕлаӋ㊫රⲴ㌫㔏⇥᧿䘠ㅖ˖ ᖃ⇥᧿䘠ㅖѝⲴ S ḷᘇ˄᧿䘠ㅖ㊫ර˅ᱟ༽ս⣦ᘱ˄0˅Ⲵ䈍ˈ䛓Ѹ䈕᧿䘠ㅖᱟањ㌫㔏᧿䘠ㅖDŽ༴ 4.3.6 ㌱㔕ᨅ䘦ㅜ㊱ශ Ⲵᐢ䇯䰞սᓄ䈕亴ݸ䇮㖞ᡀ㖞ս⣦ᘱDŽ਼ᰦˈࡐ䲔᫽֌㌫㔏ѝԫօ䈅മ؞᭩ ROM ѝ⇥᧿䘠ㅖⲴԓ⸱DŽ ањᰐ䲀ᗚ⧟DŽѪҶ䱢→䘉њ䰞仈ˈ䴰㾱ᆈ᭮൘ ROM ѝⲴᡰᴹ᧿䘠ㅖޕѝⲴ⇥᧿䘠ㅖᰦˈ༴⨶ಘቡՊ䘋 ྲ᷌ GDT ᡆ LDT ѝањ⇥᧿䘠ㅖ㻛ᆈ᭮൘ ROM ѝˈ䛓Ѹ㤕䖟Ԧᡆ༴⨶ಘ䈅മᴤᯠ˄߉˅൘ ROM ᮠᦞ⇥ਟԕ㻛ᴤ儈⢩ᵳ㓗Ⲵ〻ᒿᡆ䗷〻䇯䰞ˈ㘼ᰐ享֯⭘⢩↺Ⲵ䇯䰞䰘DŽ ᡰᴹᮠᦞ⇥䜭ᱟ䶎а㠤ᙗⲴˈণ᜿ણ⵰ᆳԜн㜭㻛վ⢩ᵳ㓗Ⲵ〻ᒿᡆ䗷〻䇯䰞DŽ❦㘼ˈоԓ⸱⇥н਼ˈ →վ⢩ᵳ㓗〻ᒿᡆ䗷〻䇯䰞Ⲵᐕާᓄ䈕ᆈ᭮൘䶎а㠤ᙗԓ⸱⇥ѝDŽ 䇮ᯭⲴ㌫㔏ᐕާԕ৺ḀӋᔲᑨ㊫ර˄ֻྲ䲔ࠪ䭉ǃⓒࠪ˅Ⲵ༴⨶䗷〻ਟԕᆈ᭮൘а㠤ᙗԓ⸱⇥ѝDŽ䴰㾱䱢 ᣔ؍а㠤ᙗ઼䶎а㠤ᙗԓ⸱⇥Ⲵ䈖㓶ؑ᚟䈧৲㿱Āⴤ᧕䈳⭘ᡆ䐣䖜ࡠԓ⸱⇥ā˅DŽн䇯䰞ޣ䰘ᡆԫ࣑䰘˄ᴹ ᣔᔲᑨˈ䲔䶎֯⭘Ҷањ䈳⭘؍⢩ᵳ㓗㔗㔝ᢗ㹼DŽੁањн਼⢩ᵳ㓗Ⲵ䶎а㠤ᙗԓ⸱⇥Ⲵ䖜〫ሶሬ㠤а㡜  ࠶⇥ᵪࡦ 㓯ᙗൠ൰オ䰤 ⢙⨶ൠ൰オ䰤 ㌫㔏ѝⲴ亥䶒൘⻱ⴈк㘼䶎൘⢙⨶޵ᆈѝDŽ൘ㅜа⿽ᛵߥлˈӗ⭏ᰐ᭸ൠ൰Ⲵ〻ᒿᗵ享㻛㓸→DŽ൘ㅜҼ⿽ ⨶ൠ൰DŽ൘є⿽ᛵߥлањ亥䶒ਟԕ㻛ḷ⌘Ѫᰐ᭸Ⲵ˖ķ᫽֌㌫㔏н᭟ᤱⲴ㓯ᙗൠ൰˗ĸሩᓄ൘㲊ᤏ޵ᆈ ਖཆˈ㓯ᙗࡠ⢙⨶ൠ൰Ⲵ䖜ᦒ࣏㜭㻛ᢙኅᡀݱ䇨ањ㓯ᙗൠ൰㻛ḷ⌘Ѫᰐ᭸Ⲵˈ㘼䶎䇙ަӗ⭏ањ⢙ ࡦᢗ㹼Ⲵ䟽ᇊս࣏㜭ਟԕⴻ֌ᱟᢺ㓯ᙗൠ൰Ⲵ儈 20 ս䖜ᦒࡠሩᓄ⢙⨶ൠ൰Ⲵ儈 20 սDŽ 䟿ⴤ᧕֌Ѫ⢙⨶ൠ൰Ⲵվ 12 սDŽ࠶亥ᵪ〫ٿфሩ喀Ҿ 4K 䗩⭼ˈഐ↔㓯ᙗൠ൰Ⲵվ 12 ∄⢩սਟ֌Ѫ亥޵ ൠ൰オ䰤ѝⲴ亥䶒䟽ᯠᇊսࡠ⢙⨶ൠ൰オ䰤ѝ䘋㹼᫽֌DŽ⭡Ҿ 4K བྷሿⲴ亥䶒֌Ѫањঅݳ䘋㹼᱐ሴˈᒦ ⽪࠶亥ᵪࡦᢺ 232 ᆇ㢲˄4GB˅Ⲵ㓯ᙗൠ൰オ䰤ࡂ࠶ᡀ 220˄1M = 1048576˅њ亥䶒DŽ࠶亥ᵪࡦ䙊䗷ᢺ㓯ᙗ 80X86 ֯⭘ 4K˄212˅ᆇ㢲പᇊབྷሿⲴ亥䶒DŽ⇿њ亥䶒൷ᱟ 4KBˈᒦфሩ喀Ҿ 4K ൠ൰䗩⭼༴DŽ䘉㺘 ഴ 㓵ᙝ൦൶グ䰪享䶘ࡦ⢟⨼൦൶グ䰪享䶘ሯᓊ⽰ᝅഴ  Ⲵ亥䶒ሩᓄҶ䎧ᶕDŽ ਴њ亥䶒ˈᒦ൘䘉єњオ䰤ѻ䰤ᨀ׋Ҷԫ᜿᱐ሴDŽമѝⲴ㇝ཤᢺ㓯ᙗൠ൰オ䰤ѝⲴ亥䶒о⢙⨶ൠ൰オ䰤ѝ ਟԕ㻛᱐ሴࡠ⢙⨶ൠ൰オ䰤Ⲵԫօ亥䶒кDŽമ 4-16 ⽪ࠪҶ࠶亥ᵪࡦᱟྲօᢺ㓯ᙗ઼⢙⨶ൠ൰オ䰤䜭ࡂ࠶ᡀ ᆈඇ˄〠Ѫ亥䶒˅䘋㹼᫽֌DŽ࠶亥ᵪࡦᢺ㓯ᙗ઼⢙⨶ൠ൰オ䰤䜭ࡂ࠶ᡀ亥䶒DŽ㓯ᙗൠ൰オ䰤ѝⲴԫօ亥䶒 ࡽ䶒ӻ㓽Ⲵ࠶⇥ᵪࡦ൘਴⿽ਟਈ䮯ᓖⲴ޵ᆈ४ฏк᫽֌DŽо࠶⇥ᵪࡦн਼ˈ࠶亥ᵪࡦሩപᇊབྷሿⲴ޵ ᙗൠ൰㻛ⴤ᧕⭘֌⢙⨶ൠ൰DŽ ֯⭘ᵜ㢲᧿䘠Ⲵᵪࡦሶ㓯ᙗൠ൰䖜ᦒᡀ⢙⨶ൠ൰DŽྲ᷌ PG=0ˈࡉ⾱⭘࠶亥ᵪࡦˈ↔ᰦ࠶⇥ᵪࡦӗ⭏Ⲵ㓯 ᡁԜ䙊䗷䇮㖞᧗ࡦᇴᆈಘ CR0 Ⲵ PG սਟԕ੟⭘࠶亥ᵪࡦDŽྲ᷌ PG=1ˈࡉ੟⭘࠶亥᫽֌ˈ༴⨶ಘՊ ᣔDŽ؍亥ᵪࡦ䘈ᨀ׋Ҷ⭘ᡧ - 䎵㓗⭘ᡧє㓗 ᣔDŽਖཆˈ൘亥䶒অݳкˈ࠶؍ᣔ᧚ᯭDŽֻྲˈ൘สҾ亥䶒Ⲵส⹰кਟԕ࣐ᕪ䈫/߉؍⭘ᡆᴯԓ࠶⇥ᵪࡦⲴ ᣔᵪࡦਸ؍ᣔ᧚ᯭˈਟ઼࠶⇥ᵪࡦ؍ൠ൰オ䰤亥䶒㻛᱐ሴࡠ⢙⨶ൠ൰オ䰤Ⲵ亥䶒кDŽ࠶亥ᵪࡦࠐ⿽亥䶒㓗 Ҿԫօа⿽࠶⇥⁑රDŽ༴⨶ಘ࠶亥ᵪࡦՊᢺ㓯ᙗൠ൰オ䰤˄⇥ᐢ᱐ሴࡠަѝ˅ࡂ࠶ᡀ亥䶒ˈ❦ਾ䘉Ӌ㓯ᙗ ൰䖜ᦒⲴ䗷〻DŽ࠶⇥ᵪࡦᢺ䙫䗁ൠ൰䖜ᦒᡀ㓯ᙗൠ൰ˈ㘼࠶亥ࡉᢺ㓯ᙗൠ൰䖜ᦒᡀ⢙⨶ൠ൰DŽ࠶亥ਟԕ⭘ ࠶亥ᵪࡦᱟ 80X86 ޵ᆈ㇑⨶ᵪࡦⲴㅜҼ䜘࠶DŽᆳ൘࠶⇥ᵪࡦⲴส⹰кᆼᡀ㲊ᤏ˄䙫䗁˅ൠ൰ࡠ⢙⨶ൠ 4.4 ࠼享ᵰ࡬ 㢲ѝ䈤᰾ˈѝᯝ઼䲧䱡䰘Ⲵ֯⭘ᯩ⌅ሶ൘ѝᯝ઼ᔲᑨ༴⨶а㢲ѝ㔉Ҹ䈤᰾DŽ ᣔа؍TSS ⣦ᘱ⇥઼ԫ࣑䰘Ⲵ֯⭘ᯩ⌅ሶ൘ԫ࣑㇑⨶а㢲ѝ䘋㹼䈤᰾ˈ䈳⭘䰘Ⲵ֯⭘ᯩ⌅ሶ᭮൘ ޣᴹ  ࠶亥ᵪࡦ ˅〫ٿԕ㧧ਆਜ਼ᴹ亥䶒 20 ս⢙⨶สൠ൰Ⲵ㺘亩DŽ䈕 20 ս亥䶒⢙⨶สൠ൰઼㓯ᙗൠ൰ѝⲴվ 12 ս˄亥޵ ˈ亥䶒Ⲵ 20 ս⢙⨶สൠ൰DŽҼ㓗亥㺘֯⭘㓯ᙗൠ൰ѝ䰤 10 ս˄ս 21--12˅֌Ѫ㺘亩㍒ᕅ٬ޣ㺘亩ਜ਼ᴹ⴨ ㅜҼ㓗㺘〠Ѫ亥㺘˄page table˅ˈᆳⲴ䮯ᓖҏᱟ 1 њ亥䶒ˈᴰཊਜ਼ᴹ 1K њ 4 ᆇ㢲Ⲵ㺘亩DŽ⇿њ 4 ᆇ㢲 ٬ᶕ䘹ᤙ 210 њҼ㓗㺘ѻаDŽ 㺘亩DŽ䘉Ӌ㺘亩ᤷੁሩᓄⲴҼ㓗㺘DŽ㓯ᙗൠ൰Ⲵᴰ儈 10 ս˄ս 31--22˅⭘֌а㓗㺘˄亥ⴞᖅ˅ѝⲴ㍒ᕅ ㅜа㓗㺘〠Ѫ亥ⴞᖅ˄page directory˅DŽᆳ㻛ᆈ᭮൘ 1 亥 4K 亥䶒ѝˈާᴹ 210˄1K˅њ 4 ᆇ㢲䮯ᓖⲴ 㻛࠶ᡀє↕ᶕ䘋㹼ˈ⇿↕֯⭘˄䖜ᦒ˅ަѝ 10 њ∄⢩DŽ Ⲵ޵ᆈDŽഐ↔ѪҶ߿ቁ޵ᆈঐ⭘䟿ˈ80X86 ֯⭘Ҷє㓗㺘DŽ⭡↔ˈ儈 20 ս㓯ᙗൠ൰ࡠ⢙⨶ൠ൰Ⲵ䖜ᦒҏ 亥㺘ਜ਼ᴹ 220˄1M˅њ㺘亩ˈ㘼⇿亩ঐ⭘ 4 ᆇ㢲DŽྲ᷌֌Ѫањ㺘ᶕᆈ᭮Ⲵ䈍ˈᆳԜᴰཊሶঐ⭘ 4MB 4.4.1.1 њ㓝享㺞㔉ᶺ ањᔲᑨDŽ ণᴹ᭸ˈᡁԜਟԕӾѝਆᗇ亥䶒Ⲵ⢙⨶ൠ൰DŽྲ᷌亩ѝ㺘᰾нᆈ൘ˈ䛓Ѹᖃ䇯䰞ሩᓄ⢙⨶亥䶒ᰦቡՊӗ⭏ սਟ⭘Ҿᆈ᭮䈨ྲ亥䶒ᱟ੖ᆈ൘ㅹⲴ኎ᙗؑ᚟DŽྲ᷌㓯ᙗൠ൰㍒ᕅⲴ亥㺘亩㻛ḷ⌘Ѫᆈ൘Ⲵˈࡉ㺘⽪䈕亩 亥㺘ѝ⇿њ亥㺘亩བྷሿѪ 32 սDŽ⭡Ҿਚ䴰㾱ަѝⲴ 20 սᶕᆈ᭮亥䶒Ⲵ⢙⨶สൠ൰ˈഐ↔࢙лⲴ 12 ሩᓄⲴ⢙⨶ൠ൰DŽ 䟿䘎᧕㓴ਸ൘а䎧ቡ㜭ᗇࡠ〫ٿ↔亥䶒สൠ൰Ⲵվ 12 ս㛟ᇊᱟ 0DŽ䘉᜿ણ⵰儈 20 սⲴ亥䶒สൠ൰઼ 12 ս 䟿ˈ࣐к亥䶒Ⲵสൠ൰ᴰ㓸ᖒᡀሩᓄⲴ⢙⨶ൠ൰DŽ⭡Ҿ亥䶒สൠ൰ሩ喀൘ 4K 䗩⭼кˈഐ〫ٿҶ亥䶒ѝⲴ ⭘Ҿ䘹ᤙሩᓄ亥䶒Ⲵ⢙⨶˄ส˅ൠ൰DŽ㓯ᙗൠ൰Ⲵվ 12 ս㔉ࠪˈᙗൠ൰Ⲵ儈 20 սᶴᡀ䘉њᮠ㓴Ⲵ㍒ᕅ٬ 㺘ਟԕⴻ֌ᱟㆰঅⲴ 220 ⢙⨶ൠ൰ᮠ㓴DŽ㓯ᙗࡠ⢙⨶ൠ൰Ⲵ᱐ሴ࣏㜭ਟԕㆰঅൠⴻ֌ᱟ䘋㹼ᮠ㓴ḕ᢮DŽ㓯 ࠶亥䖜ᦒ࣏㜭⭡傫⮉൘޵ᆈѝⲴ㺘ᶕ᧿䘠ˈ䈕㺘〠Ѫ亥㺘˄page table˅ˈᆈ᭮൘⢙⨶ൠ൰オ䰤ѝDŽ亥 4.4.1 享㺞㔉ᶺ ઘᵏӾ޵ᆈѝ䈫ਆ亥㺘亩ˈ䘉䙊ᑨ൘ањ亥㺘亩ᖸ䮯ᰦ䰤⋑ᴹ䇯䰞䗷ᰦ᡽Պࠪ⧠䘉⿽ᛵߥDŽ ᮠ䈫亥ⴞᖅ઼亥㺘Ⲵ䈧≲㘼ᰐ䴰֯⭘ᙫ㓯ઘᵏDŽਚᴹᖃ TLB ѝнवਜ਼㾱≲Ⲵ亥㺘亩ᰦ᡽Պ֯⭘仍ཆⲴᙫ㓯 㕃ߢಘԦѝˈ䈕㕃ߢಘԦ㻛〠Ѫ䖜ᦒḕ᢮㕃ߢ४ TLB˄Translation Lookaside Buffer˅DŽTLB ਟԕ┑䏣བྷཊ ↓ྲࡽ䘠ˈѪҶ߿ቁൠ൰䖜ᦒᡰ㾱≲Ⲵᙫ㓯ઘᵏᮠ䟿ˈᴰ䘁䇯䰞Ⲵ亥ⴞᖅ઼亥㺘Պ㻛ᆈ᭮൘༴⨶ಘⲴ ᆈ൘⻱ⴈѝDŽ؍޵ᆈѝˈ㘼ਖа䜘࠶ ѝⲴањᮠᦞ㔃ᶴሶवਜ਼ަᡰᴹⲴ䜘࠶DŽնྲ᷌֯⭘Ҷ࠶亥ˈ䛓Ѹањᮠᦞ㔃ᶴቡਟԕа䜘࠶ᆈۘҾ⢙⨶ ᦞ㔃ᶴާᴹ⴨਼Ⲵ䮯ᓖDŽо⇥н਼ˈ亥䶒ᴹപᇊⲴ䮯ᓖDŽྲ᷌ӵ֯⭘࠶⇥ൠ൰䖜ᦒˈ䛓Ѹᆈۘ൘⢙⨶޵ᆈ ࠶亥о࠶⇥ᴰབྷⲴн਼ѻ༴൘Ҿ࠶亥֯⭘Ҷപᇊ䮯ᓖⲴ亥䶒DŽ⇥Ⲵ䮯ᓖ䙊ᑨоᆈ᭮൘ަѝⲴԓ⸱ᡆᮠ ᆈۘҾ޵ᆈѝⲴ亥ⴞᖅ઼亥㺘ѝDŽ 㻛䟽ᯠᢗ㹼DŽ༴⨶ಘ⭘Ҿᢺ㓯ᙗൠ൰䖜ᦒᡀ⢙⨶ൠ൰઼⭘Ҿӗ⭏亥䭉䈟ᔲᑨ˄㤕ᗵ㾱Ⲵ䈍˅Ⲵؑ᚟वਜ਼൘ Ⲵ亥䶒߉ࡠ⻱ⴈк˅DŽᖃ亥䶒࣐䖭ࡠ⢙⨶޵ᆈѝѻਾˈӾᔲᑨ༴⨶䗷〻Ⲵ䘄എ᫽֌Պ֯ᗇሬ㠤ᔲᑨⲴᤷԔ 〻ᒿ䙊ᑨቡՊ䇙᫽֌㌫㔏Ӿ⻱ⴈѝᢺ⴨ᓄ亥䶒࣐䖭ࡠ⢙⨶޵ᆈѝ˄᫽֌䗷〻ѝਟ㜭䘈Պᢺ⢙⨶޵ᆈѝн਼ ྲ᷌वਜ਼㓯ᙗൠ൰Ⲵ亥䶒ᖃࡽн൘⢙⨶޵ᆈѝˈ༴⨶ಘቡՊӗ⭏ањ亥䭉䈟ᔲᑨDŽ亥䭉䈟ᔲᑨⲴ༴⨶ ൰䖜ᦒᡀањ㓯ᙗൠ൰ˈ❦ਾ֯⭘࠶亥ᵪࡦᢺ䈕㓯ᙗൠ൰䖜ᦒᡀሩᓄⲴ⢙⨶ൠ൰DŽ ⢙⨶޵ᆈѝ઼/ᡆ⻱ⴈᆈۘオ䰤ѝDŽᖃањ〻ᒿ˄ᡆԫ࣑˅ᕅ⭘޵ᆈѝⲴ䙫䗁ൠ൰ᰦˈ༴⨶ಘՊᢺ䈕䙫䗁ൠ ᖃ֯⭘࠶亥ᰦˈ༴⨶ಘՊᢺ㓯ᙗൠ൰オ䰤ࡂ࠶ᡀപᇊབྷሿⲴ亥䶒˄䮯ᓖ 4KB˅ˈ䘉Ӌ亥䶒ਟԕ᱐ሴࡠ 㻛〠Ѫ㲊ᤏᆈۘᡆ㘵䴰≲亥˄Demand-paged˅㲊ᤏᆈۘDŽ 㘵˄֯⭘࠶亥˅䰤᧕ൠ᱐ሴࡠ䖳ሿᇩ䟿Ⲵ⢙⨶޵ᆈ઼⻱ⴈᆈۘオ䰤ѝDŽ䘉ਾа⿽᱐ሴ㓯ᙗൠ൰オ䰤Ⲵᯩ⌅ ᣔ⁑ᔿѝˈ80X86 ݱ䇨㓯ᙗൠ൰オ䰤ⴤ᧕᱐ሴࡠབྷᇩ䟿Ⲵ⢙⨶޵ᆈ˄ֻྲ 4GB Ⲵ RAM˅кˈᡆ؍൘ ൘˄present˅Ⲵ኎ᙗᶕ⺞ᇊDŽ ഐ↔ᆳԜ㻛〠Ѫнᆈ൘Ⲵ亥䶒ˈᒦф⭡亥㺘ѝ〠Ѫᆈˈޣ〻ᒿ䇯䰞DŽഐѪᰐ᭸亥䶒䙊ᑨо㲊ᤏᆈۘ㌫㔏⴨ ᛵߥлˈ䈕ᰐ᭸ൠ൰ᇎ䱵кᱟ䈧≲᫽֌㌫㔏㲊ᤏ޵ᆈ㇑⨶ಘᢺሩᓄ亥䶒Ӿ⻱ⴈк࣐䖭ࡠ⢙⨶޵ᆈѝˈԕ׋  ࠶亥ᵪࡦ 亥ᑗ〫ٿ亥޵ *  亥䮯 . 亥สൠ൰ 〫ٿ亥޵  ⢙⨶ൠ൰ 亥ⴞᖅ 亥㺘 &5 ⢙⨶ൠ൰オ䰤 㓯ᙗൠ൰ 亥㺘亩 ⴞᖅ亩 ⴞᖅ〫ٿ亥䶒 亥޵  ᙗˈ䘉䟼ㆰ㾱䈤᰾ަ։኎ᙗⲴ࣏㜭઼⭘䙄DŽ オ䰤ѝањ亥䶒˄ҏ〠Ѫ亥ᑗ˅Ⲵ⢙⨶สൠ൰DŽ㺘亩Ⲵվ 12 սਜ਼ᴹ亥኎ᙗؑ᚟DŽᡁԜᐢ㓿䇘䇪䗷ᆈ൘኎ 亥ⴞᖅ઼亥㺘Ⲵ㺘亩Ṭᔿ㿱മ 4-18 ᡰ⽪DŽަѝս 31--12 ਜ਼ᴹ⢙⨶ൠ൰Ⲵ儈 20 սˈ⭘Ҿᇊս⢙⨶ൠ൰ 4.4.2 享㺞亯Ṳᕅ ᆈ࠶亥䖜ᦒ㺘ᡰ䴰㾱Ⲵ⢙⨶޵ᆈ䟿DŽ؍ ൘㘼ᕅਁⲴᔲᑨՊ䙊⸕᫽֌㌫㔏ᢺ㕪ቁⲴ亥㺘Ӿ⻱ⴈк࣐䖭䘋⢙⨶޵ᆈDŽᢺ亥㺘ᆈۘ൘㲊ᤏ޵ᆈѝ߿ቁҶ ԕ㺘᰾ਟ⭘ᆳԜ䘋㹼࠶亥䖜ᦒDŽ༴Ҿ⻱ⴈкⲴ亥㺘ሩᓄⲴ亥ⴞᖅ亩ሶ㻛ḷ⌘Ѫнᆈ൘DŽ⭡ҾҼ㓗亥㺘нᆈ ᆈ൘⻱ⴈкDŽ༴Ҿ⢙⨶޵ᆈѝ亥㺘ሩᓄⲴ亥ⴞᖅ亩ሶ㻛ḷ⌘Ѫᆈ൘ˈ؍䴰㾱ᆈ᭮൘⢙⨶޵ᆈѝˈ㘼ަ։Ⲵਟ ਚᴹ䜘࠶Ҽ㓗亥㺘ىⴞᖅ㺘亩ѝⲴᆈ൘ս䘈ਟԕ⭘Ҿ൘㲊ᤏ޵ᆈѝᆈ᭮Ҽ㓗亥㺘DŽ䘉᜿ણ⵰൘ԫօᰦ 亥䶒DŽ 䙊⸕᫽֌㌫㔏DŽ亥ⴞᖅ㺘亩ѝⲴᆈ൘኎ᙗ֯ᗇ᫽֌㌫㔏ਟԕṩᦞᇎ䱵֯⭘Ⲵ㓯ᙗൠ൰㤳തᶕ࠶䝽Ҽ㓗亥㺘 〻ㅜ 2 ↕ሶ਼ྲк᧿䘠㔗㔝л৫DŽྲ᷌ᆈ൘ս㺘᰾ሩᓄⲴҼ㓗㺘нᆈ൘ˈ䛓Ѹ༴⨶ಘቡՊӗ⭏ањᔲᑨᶕ ᤷ᰾ሩᓄⲴҼ㓗亥㺘ᱟ੖ᆈ൘DŽྲ᷌ⴞᖅ㺘亩ᤷ᰾ሩᓄⲴҼ㓗亥㺘ᆈ൘ˈ䛓Ѹ䙊䗷䇯䰞Ҽ㓗㺘ˈ㺘ḕ᢮䗷 亥ⴞᖅ㺘ѝ⇿њ㺘亩ҏᴹањᆈ൘˄present˅኎ᙗˈ㊫լҾ亥㺘ѝⲴ㺘亩DŽ亥ⴞᖅ㺘亩ѝⲴᆈ൘኎ᙗ ᗇ亥㺘㔃ᶴⲴབྷሿሩᓄҾᇎ䱵֯⭘Ⲵ㓯ᙗൠ൰オ䰤བྷሿDŽ ࠶࠶䝽Ҽ㓗亥㺘DŽ㲭❦ⴞᖅ㺘亥䶒ᗵ享ᙫᱟᆈ൘Ҿ⢙⨶޵ᆈѝˈնᱟҼ㓗亥㺘ਟԕ൘䴰㾱ᰦ޽࠶䝽DŽ䘉֯ ᆈ൘䘎㔝Ⲵ 4MB ޵ᆈඇѝDŽਖཆˈᒦн䴰㾱Ѫнᆈ൘Ⲵᡆ㓯ᙗൠ൰オ䰤ᵚ֯⭘䜘؍њ亥䶒ѝˈ㘼н䴰㾱 ᩎᗇᴹӋ༽ᵲҶDŽഐѪᡁԜ䴰㾱ਖ໎ањ亥䶒ᶕᆈ᭮ⴞᖅ㺘DŽ❦㘼ˈҼ㓗㺘㔃ᶴݱ䇨亥㺘㻛࠶ᮓ൘޵ᆈ਴ 䙊䗷֯⭘Ҽ㓗㺘㔃ᶴˈᡁԜ䘈⋑ᴹ䀓ߣ䴰㾱֯⭘ 4MB ޵ᆈᶕᆈ᭮亥㺘Ⲵ䰞仈DŽᇎ䱵кˈᡁԜᢺ䰞仈 4.4.1.2 уᆎ൞Ⲻ享㺞 ഴ 㓵ᙝ൦൶ૂ⢟⨼൦൶ҁ䰪Ⲻ਎ᦘ  ⢙⨶ൠ൰Ⲵ儈 20 սDŽ㓯ᙗൠ൰Ⲵվ 12 սⴤ᧕֌Ѫ⢙⨶ൠ൰վ 12 սˈӾ㘼㓴ᡀањᆼᮤⲴ 32 ս⢙⨶ൠ൰DŽ ㅜҼ㓗亥㺘Ⲵᤷ䪸DŽ㓯ᙗൠ൰ѝ䰤 10 ս⭘Ҿ㍒ᕅҼ㓗亥㺘ˈԕ㧧ᗇޣ㍒ᕅ䘉њ亥ⴞᖅ㺘ˈԕ㧧ᗇᤷੁ⴨ മ 4-17 ⽪ࠪҶҼ㓗㺘Ⲵḕ᢮䗷〻DŽަѝ CR3 ᇴᆈಘᤷᇊ亥ⴞᖅ㺘Ⲵสൠ൰DŽ㓯ᙗൠ൰Ⲵ儈 10 ս⭘Ҿ ণሩᓄⲴᴰ㓸⢙⨶ൠ൰DŽˈ㓴ਸ൘а䎧ቡᗇࡠҶ࠶亥䖜ᦒ䗷〻Ⲵ䗃ࠪ٬  ࠶亥ᵪࡦ E нᆈ൘Ⲵ亥ⴞᖅ઼亥㺘Ⲵ㺘亩Ṭᔿ D 亥ⴞᖅ઼亥㺘Ⲵ㺘亩Ṭᔿ 〻ᒿਟ⭘  $9/     ս $'亥ᑗൠ൰˄3DJH)UDP$GGUHVV˅ :  5 6  8   3     ᣔᶕॿࣙራ᢮઼Ự⍻䇮䇑䰞仈઼䭉䈟DŽᖃ〻ᒿሩ䭉䈟޵ᆈオ䰤ᢗ㹼؍ਁⲴԫօ䱦⇥䜭ਟԕ֯⭘⇥㓗઼亥㓗 ᣔ਴њԫ࣑ݽਇ⴨ӂѻ䰤ⲴᒢᢠDŽ൘䖟Ԧᔰ؍ᣔᵪࡦᱟਟ䶐Ⲵཊԫ࣑䘀㹼⧟ຳᡰᗵ享ⲴDŽᆳਟ⭘Ҿ؍ 4.5 ؓᣚ ⴈѝDŽ㤕↔ᰦ D=1ˈࡉ䈤᰾亥䶒޵ᇩᐢ㻛؞᭩䗷ˈҾᱟቡᗵ享ሶ䈕亥䶒߉ࡠ⻱ⴈкDŽ⻱ޕ亥䶒ቡᰐ䴰㻛߉ ޵ᆈᰦˈަ㜿ḷᘇ D=0ˈ䛓Ѹᖃ亥䶒޽⅑㻛〫ࠪࡠ⻱ⴈкᰦˈ㤕 D ḷᘇ䘈ᱟѪ 0ˈࡉ䈕ޕ亥䶒Ӿ⻱ⴈк䈫 䇮ᖃаٷ䘹㘵DŽىḷᘇˈ᫽֌㌫㔏㜭ཏ⺞ᇊଚӋ亥䶒ᴰ䘁⋑ᴹ䇯䰞䗷DŽ䘉Ӌ亥䶒ਟԕᡀѪ〫ࠪࡠ⻱ⴈкⲴ ᐢ䇯䰞ḷᘇ A ઼ᐢ؞᭩ḷᘇ D ਟԕ⭘Ҿᴹ᭸ൠᇎ⧠㲊ᤏᆈۘᢰᵟDŽ䙊䗷ઘᵏᙗൠỰḕ઼༽սᡰᴹ A 亩ѝDŽᴰਾ൘䘄എ〻ᒿ䟽ᯠᢗ㹼ᕅ䎧ᔲᑨⲴᤷԔѻࡽ䇮㖞ḷᘇ P=1DŽ ޵ᆈѝˈᒦᢺ⴨ᓄ⢙⨶ൠ൰ᆈ᭮൘㺘⨶⢙ޕ֌㌫㔏ቡਟԕ࡙⭘䘉њᔲᑨ༴⨶䗷〻ᢺ㕪ቁⲴ亥䶒Ӿ⻱ⴈк䈳 ᆈѝⲴ㺘亩ަḷᘇ P = 0DŽྲ᷌〻ᒿ䇯䰞⢙⨶޵ᆈѝнᆈ൘Ⲵ亥䶒ˈ༴⨶ಘቡՊӗ⭏ањ㕪亥ᔲᑨDŽ↔ᰦ᫽ Ⲵ亥䶒ᆈ൘Ҿ⢙⨶޵ᆈѝˈࡉሩᓄ㺘亩ѝⲴḷᘇ P=1ˈᒦф䈕㺘亩ѝਜ਼ᴹ⴨ᓄ⢙⨶ൠ൰DŽ亥䶒н൘⢙⨶޵ 亥ⴞᖅ઼亥㺘㺘亩ѝⲴᆈ൘ḷᘇ P Ѫ֯⭘࠶亥ᢰᵟⲴ㲊ᤏᆈۘᨀ׋Ҷᗵ㾱Ⲵ᭟ᤱDŽ㤕㓯ᙗൠ൰オ䰤ѝ 4.4.3 㲐ᤕᆎ۞ ⮉у׋〻ᒿ֯⭘DŽ༴⨶ಘнՊ؞᭩䘉ࠐսˈԕਾⲴॷ㓗༴⨶ಘҏнՊDŽ؍⇥„ AVL -- 䈕ᆇ Ⲵ D ḷᘇDŽ༴⨶ಘᒦнՊ؞᭩亥ⴞᖅ亩ѝⲴ D ḷᘇDŽ „ D -- ս 6 ᱟ亥䶒ᐢ㻛؞᭩˄Dirty˅ḷᘇDŽᖃ༴⨶ಘሩањ亥䶒ᢗ㹼߉᫽֌ᰦˈቡՊ䇮㖞ሩᓄ亥㺘㺘亩 ಘਚ䍏䍓䇮㖞䈕ḷᘇˈ᫽֌㌫㔏ਟ䙊䗷ᇊᵏൠ༽ս䈕ḷᘇᶕ㔏䇑亥䶒Ⲵ֯⭘ᛵߥDŽ 㻛㖞Ѫ 1DŽᖃ༴⨶ಘ䇯䰞亥ⴞᖅ㺘亩᱐ሴⲴԫօ亥䶒ᰦˈ亥ⴞᖅ㺘亩Ⲵ䘉њḷᘇቡՊ㻛㖞Ѫ 1DŽ༴⨶ „ A -- ս 5 ᱟᐢ䇯䰞˄Accessed˅ḷᘇDŽᖃ༴⨶ಘ䇯䰞亥㺘亩᱐ሴⲴ亥䶒ᰦˈ亥㺘㺘亩Ⲵ䘉њḷᘇቡՊ ⴞᖅ亩ѝⲴ U/S սሩަᡰ᱐ሴⲴᡰᴹ亥䶒䎧֌⭘DŽ ਟԕ䇯䰞䈕亥䶒DŽྲ᷌Ѫ 0ˈ䛓Ѹ亥䶒ਚ㜭㻛䘀㹼൘䎵㓗⭘ᡧ⢩ᵳ㓗˄0ǃ1 ᡆ 2˅кⲴ〻ᒿ䇯䰞DŽ亥 „ U/S -- ս 2 ᱟ⭘ᡧ/䎵㓗⭘ᡧ˄User/Supervisor˅ḷᘇDŽྲ᷌Ѫ 1ˈ䛓Ѹ䘀㹼൘ԫօ⢩ᵳ㓗кⲴ〻ᒿ䜭 亥ⴞᖅ亩ѝⲴ R/W սሩަᡰ᱐ሴⲴᡰᴹ亥䶒䎧֌⭘DŽ ⽪亥䶒ਚ䈫ᡆਟᢗ㹼DŽᖃ༴⨶ಘ䘀㹼൘䎵㓗⭘ᡧ⢩ᵳ㓗˄㓗࡛ 0ǃ1 ᡆ 2˅ᰦˈࡉ R/W սн䎧֌⭘DŽ „ R/W -- ս 1 ᱟ䈫/߉˄Read/Write˅ḷᘇDŽྲ᷌ㅹҾ 1ˈ㺘⽪亥䶒ਟԕ㻛䈫ǃ߉ᡆᢗ㹼DŽྲ᷌Ѫ 0ˈ㺘 ᆈᐢᆈۘ൘⻱ⴈкⲴ亥䶒ⲴᒿਧDŽ؍ ⽪㺘亩ᰐ᭸ཆˈަ։∄⢩սਟ׋〻ᒿ㠚⭡֯⭘ˈ㿱മ 4-18(b)ᡰ⽪DŽֻྲˈ᫽֌㌫㔏ਟԕ֯⭘䘉Ӌսᶕ ൘亥䖜ᦒ䗷〻ѝˈྲ᷌䈤⎹৺Ⲵ亥ⴞᖅᡆ亥㺘Ⲵ㺘亩ᰐ᭸ˈࡉՊሬ㠤ањᔲᑨDŽྲ᷌ P=0ˈ䛓Ѹ䲔㺘 „ P -- ս 0 ᱟᆈ൘˄Present˅ḷᘇˈ⭘Ҿᤷ᰾㺘亩ሩൠ൰䖜ᦒᱟ੖ᴹ᭸DŽP=1 㺘⽪ᴹ᭸˗P=0 㺘⽪ᰐ᭸DŽ ഴ 享ⴤᖋૂ享㺞Ⲻ㺞亯Ṳᕅ   ᣔ؍ ༴⨶ಘ⭘ᆳᶕ䱢→〻ᒿ൘᧿䘠ㅖ㺘Ⲵཆ䶒䘹ᤙ᧿䘠ㅖDŽ᧿䘠ㅖ㺘Ⲵ䲀䮯٬ᤷ᰾Ҷ㺘ѝᴰਾˈ16 սⲴ䲀䮯٬ 䲔Ҷሩ⇥䲀䮯䘋㹼Ựḕˈ༴⨶ಘҏՊỰḕ᧿䘠ㅖ㺘Ⲵ䮯ᓖDŽGDTRǃIDTR ઼ LDTR ᇴᆈಘѝवਜ਼ᴹ ࡠ 0xFFFFDŽᖃлᢙ⇥Ⲵ⇥䲀䮯Ѫ 0 ᰦˈ⇥Պᴹᴰབྷ䮯ᓖDŽ˅1+〫ٿ⇥٬㤳തᱟӾ˄ᴹ᭸〫ٿ␵䴦ᰦˈᴹ᭸ ࡠ 0xFFFF FFFF˗ᖃ B˅1+〫ٿ⇥㤳തᱟӾ˄ᴹ᭸〫ٿ䇯䰞Ⲵൠ൰ˈഐ↔൘䇮㖞Ҷ B ḷᘇⲴᛵߥлˈᴹ᭸ ሩҾлᢙᮠᦞ⇥ˈ⇥䲀䮯ާᴹ਼ṧⲴ࣏㜭ˈնަਜ਼ѹн਼DŽ䘉䟼ˈ⇥䲀䮯ᤷᇊҶ⇥ѝᴰਾањнݱ䇨 ᣔᔲᑨDŽ؍1 њᆇ㢲DŽԫօ䎵ࠪ⇥䲀䮯ᆇ⇥ᤷᇊⲴᴹ᭸ൠ൰㤳ത䜭ሶሬ㠤ӗ⭏ања㡜 䲔Ҷлᢙ⇥ԕཆⲴᡰᴹ⇥㊫රˈᴹ᭸ Limit Ⲵ٬ᱟ⇥ѝݱ䇨㻛䇯䰞Ⲵᴰਾањൠ൰ˈᆳ㾱∄⇥䮯ᓖሿ ࡠ 0xFFF ӽ❦ᱟᴹ᭸ⲴDŽ 0 ٬〫ٿˈᰦ ൠ൰˅Ⲵվ 12 սнՊо Limit 䘋㹼ሩ➗ỰḕDŽֻྲˈᖃ⇥䲀䮯 Limit ㅹҾ 0˄〫ٿ⇥ˈᖃ䇮㖞Ҷ G ḷᘇᰦ Ⲵ٬҈кањഐᆀ 4KDŽ൘䘉⿽ᛵߥлˈᴹ᭸Ⲵ Limit 㤳തᱟӾ 0xFFF ࡠ 0xFFFFFFFF˄4GB˅DŽ䈧⌘᜿ˈ ᛵߥлˈLimit Ⲵ㤳തӾ 0 ࡠ 0xFFFFF˄1MB˅DŽᖃ G ḷᘇ㖞սᰦ˄4KB 亥仇㋂ᓖ˅ˈ༴⨶ಘᢺ Limit ᆇ⇥ ᖃ G ḷᘇ␵䴦ᰦ˄ᆇ㢲仇㋂ᓖ˅ˈᴹ᭸Ⲵ⇥䮯ᓖᱟ 20 սⲴ⇥᧿䘠ㅖѝ⇥䲀䮯ᆇ⇥ Limit Ⲵ٬DŽ൘䘉⿽ DŽE ḷᘇᱟᮠᦞ⇥㊫රⲴ⇥᧿䘠ㅖѝ㊫රᆇ⇥Ⲵањ∄⢩սDŽޣ઼/ᡆк⭼䲀˅ᴹ 䎆Ҿ仇㋂ᓖ G ḷᘇⲴ䇮㖞⣦ᘱDŽሩҾᮠᦞ⇥ˈ⇥䲀䮯䘈оḷᘇ E˄ᢙኅᯩੁ˅઼ḷᘇ B˄唈䇔Ḹᤷ䪸བྷሿ ⇥᧿䘠ㅖⲴ⇥䲀䮯˄ᡆ〠⇥⭼䲀˅ᆇ⇥⭘Ҿ䱢→〻ᒿᡆ䗷〻ራ൰ࡠ⇥ཆ޵ᆈս㖞DŽ⇥䲀䮯Ⲵᴹ᭸٬׍ 4.5.1.1 ⇫䲆䮵 Limit Ỷḛ ᣔᵪࡦDŽ؍ᣔ⁑ᔿлⲴ؍ᣔⲴ᫽֌䜭ሶሬ㠤ӗ⭏ањᔲᑨDŽл䶒਴㢲᧿䘠؍ᡰᴹ䘍৽ „ ᤷԔ䳶䲀ࡦDŽ ਓ⛩䲀ࡦ˗ޕ„ 䗷〻 „ ਟራ൰㤳ത䲀ࡦ˗ „ ⢩ᵳ㓗Ựḕ˗ „ ⇥㊫රỰḕ˗ „ ⇥⭼䲀Ựḕ˗ ᣔỰḕਟ࠶Ѫԕлࠐ㊫˖؍оൠ൰ਈᦒ਼ᰦᒦ㹼᫽֌ˈᡰԕ༴⨶ಘᙗ㜭ᒦ⋑ᴹਇࡠᖡ૽DŽᡰ䘋㹼Ⲵ ᣔ㾱≲DŽഐѪỰḕ᫽֌ᱟ؍ᣔᵪࡦᰦˈ⇿њ޵ᆈᕅ⭘䜭ሶਇࡠỰሏԕ傼䇱޵ᆈᕅ⭘ㅖਸ਴⿽؍ᖃ֯⭘ Ⲵԓ⸱઼ᮠᦞDŽ ᣔᵪࡦሶՊ䲀ࡦᓄ⭘〻ᒿਚ㜭᤹➗ਇ᧗ࡦⲴ઼㿴ᇊⲴᯩᔿ䇯䰞᫽֌㌫㔏؍儈⢩ᵳ㓗Ⲵ⇥ѝDŽ↔ਾ༴⨶ಘⲴ ᣔ˅ᨀ׋ҶሩḀӋ⇥઼亥䶒Ⲵ䇯䰞䲀ࡦ㜭࣋DŽֻྲˈ᫽֌㌫㔏ԓ⸱઼ᮠᦞᆈ᭮൘㾱∄Პ䙊ᓄ⭘〻ᒿާᴹ؍ ᣔ઼ 2 㓗亥؍⇥ᣔᵪࡦṩᦞ⢩ᵳ㓗˄4 㓗؍ᣔᵪࡦDŽ䘉⿽؍ᣔ⁑ᔿлˈ80X86 ᨀ׋Ҷ⇥㓗઼亥㓗؍൘ 4.5.1 ⇫㓝ؓᣚ ᣔ᫽֌DŽ؍⧠傼䇱DŽሩҾ࠶亥ᵪࡦˈࡉѫ㾱࡙⭘亥ⴞᖅ઼亥㺘亩ѝⲴ R/W ઼ U/S ḷᘇᶕᇎ ᣔ؍ᣔᵪࡦˈ༴⨶ಘ֯⭘⇥ᇴᆈಘѝ䘹ᤙㅖ˄RPL ઼ CPL˅઼⇥᧿䘠ㅖѝ਴њᆇ⇥ᢗ㹼؍ሩҾ࠶⇥㓗 ᣔDŽ؍ਟԕ֯ᗇ⇿њ亥䶒䜭ਟԕ㻛ԫ᜿䈫/߉ˈഐ↔ᇎ䱵кҏቡ⾱→Ҷ亥㓗 ᣔᵪࡦDŽ䇮㖞䘉єњḷᘇ؍亥㺘亩Ⲵ䈫/߉˄R/W˅ḷᘇ઼⭘ᡧ/䎵㓗⭘ᡧ˄U/S˅ḷᘇˈᡁԜਟԕ⾱→亥㓗 ᣔᵪࡦDŽնᱟ䙊䗷䇮㖞⇿њ亥ⴞᖅ亩઼؍Ⲵḷᘇ⭘ᶕ൘࠶亥ᔰ੟ᶑԦл⾱→ᡆᔰ੟亥㓗ޣ⨶ಘѝҏ⋑ᴹ⴨ ᣔᵪࡦDŽ਼ṧˈ༴؍䇮㖞᧗ࡦᇴᆈಘ CR0 Ⲵ PG ḷᘇ˄ս 31˅ਟԕᔰ੟࠶亥ᵪࡦˈ਼ᰦҏᔰ੟Ҷ࠶亥 ᣔᵪࡦӽ❦䎧֌⭘DŽ؍ᣔ໱ෂˈնᱟަԆ⇥䮯ᓖ઼⇥㊫රỰḕㅹ؍ᔿਟԕ൘⇥ѻ䰤⾱→⢩ᵳ㓗 䰝DŽ䘉⿽༴⨶ᯩޣᣔᵪࡦ䜘࠶ਟԕ䙊䗷ᢺᡰᴹ⇥䘹ᤙㅖ઼⇥᧿䘠ㅖⲴ⢩ᵳ㓗䜭䇮㖞Ѫ 0 㓗ᶕ䳀ਜ਼ൠ؍㓗Ⲵ ᣔᵪࡦDŽн䗷สҾ⢩ᵳ؍ᡆ੟⭘→ڌᣔ⁑ᔿˈ༴⨶ಘѝᒦнᆈ൘᰾⺞Ⲵ᧗ࡦḷᘇᶕ؍ޕᣔᵪࡦDŽаᰖ䘋؍ ⇥ᣔ⁑ᔿлˈӾ㘼ҏቡᔰ੟Ҷ࠶؍䙊䗷䇮㖞᧗ࡦᇴᆈಘ CR0 Ⲵ PE ḷᘇ˄ս 0˅ਟԕ䇙༴⨶ಘᐕ֌൘ Ѫᖃࡽ⢩ᵳ㓗 CPL˄Current Privilege Level˅DŽ൘࠶⇥઼࠶亥ൠ൰䖜ᦒ䗷〻ѝˈ༴⨶ಘሶሩ CPL 䘋㹼傼䇱DŽ ᣔᵪࡦਟԕ㻛⭘Ҿ࠶⇥઼࠶亥ᵪࡦDŽ༴⨶ಘᇴᆈಘⲴ 2 њ∄⢩սᇊѹҶᖃࡽᢗ㹼〻ᒿⲴ⢩ᵳ㓗ˈ〠؍ ᣔᵪࡦਟԕ䱫→䘉⿽᫽֌ᒦфᣕ੺↔㊫һԦDŽ؍ˈҶа⅑䶎ᵏᵋⲴᕅ⭘  ᣔ؍ ᫽֌㌫㔏Ṩᗳ ᫽֌㌫㔏ᴽ࣑ 㓗ᓄ⭘ቲ 㓗 㓗 㓗 ᣔ⧟؍ „ ᖃࡽ⢩ᵳ㓗 CPL˄Current Privilege Level˅DŽCPL ᱟᖃࡽ↓൘ᢗ㹼〻ᒿᡆԫ࣑Ⲵ⢩ᵳ㓗DŽᆳᆈ᭮൘ ѪҶ൘਴њԓ⸱⇥઼ᮠᦞ⇥ѻ䰤䘋㹼⢩ᵳ㓗Ự⍻༴⨶ˈ༴⨶ಘਟԕ䇶࡛ԕлй⿽㊫රⲴ⢩ᵳ㓗˖ ᣔᙗᔲᑨDŽ؍᧗ⲴᶑԦлDŽᖃ༴⨶ಘỰ⍻ࡠањ䘍৽⢩ᵳ㓗Ⲵ᫽֌ᰦˈᆳቡՊӗ⭏ања㡜 ༴⨶ಘ࡙⭘⢩ᵳ㓗ᶕ䱢→䘀㹼൘䖳վ⢩ᵳ㓗Ⲵ〻ᒿᡆԫ࣑䇯䰞ާᴹ䖳儈⢩ᵳ㓗Ⲵањ⇥ˈ䲔䶎ᱟ൘ਇ ༺⨼ಞ⢯ᵹ㓝⽰ᝅഴ ഴ  ᓄ䈕֯⭘⢩ᵳ㓗 0 ઼ 3DŽ ㍗㾱䖟ԦⲴ⇥ˈ䙊ᑨ⭘Ҿ᫽֌㌫㔏Ṩᗳ䜘࠶DŽѝ䰤єњ⧟⭘Ҿ䖳Ѫ㍗㾱Ⲵ䖟ԦDŽਚ֯⭘ 2 њ⢩ᵳ㓗Ⲵ㌫㔏 ⮉㔉ᴰ儈㓗Ⲵԓ⸱ǃᮠᦞ઼ึḸ˅⭘Ҿਜ਼ᴹᴰ؍˄ᣔ⧟ᖒᔿDŽ⧟ѝᗳ؍⽪ࠪҶ䘉Ӌ⢩ᵳ㓗ྲօ㜭㻛䀓䟺ᡀ ᣔᵪࡦਟԕ䇶࡛ 4 њ⢩ᵳ㓗˄ᡆ⢩ᵳቲ˅ˈ0 㓗ࡠ 3 㓗DŽᮠ٬䎺བྷˈ⢩ᵳ䎺ሿDŽമ 4-19؍⇥༴⨶ಘⲴ 4.5.1.3 ⢯ᵹ㓝 „ ԫօᤷԔн㜭䈫ањਟᢗ㹼⇥ˈ䲔䶎ਟᢗ㹼⇥䇮㖞Ҷਟ䈫ḷᘇDŽ „ ԫօᤷԔн㜭߉ањਟ߉ս⋑ᴹ㖞սⲴᮠᦞ⇥˗ „ ԫօᤷԔн㜭߉ањਟᢗ㹼⇥˗ 䇯䰞ḀӋ⇥DŽ 2. ᖃᤷԔ䇯䰞ањ⇥ˈ㘼䈕⇥Ⲵ᧿䘠ㅖᐢ㓿࣐䖭䘋⇥ᇴᆈಘѝDŽᤷԔਚ㜭֯⭘ḀӋ亴ᇊѹⲴᯩ⌅ᶕ „ ਚᴹਟ߉ᮠᦞ⇥Ⲵ䘹ᤙㅖ᡽㜭㻛࣐䖭䘋 SS ᇴᆈಘѝDŽ „ нਟ䈫ਟᢗ㹼⇥Ⲵ䘹ᤙㅖн㜭㻛࣐䖭䘋ᮠᦞ⇥ᇴᆈಘѝ˗ „ CS ᇴᆈಘѝਚ㜭㻛࣐䖭䘋ањਟᢗ㹼⇥Ⲵ䘹ᤙㅖ˗ ֻྲ˖ 1. ᖃањ᧿䘠ㅖⲴ䘹ᤙㅖ࣐䖭䘋ањ⇥ᇴᆈಘѝDŽ↔ᰦḀӋ⇥ᇴᆈಘਚ㜭ᆈ᭮⢩ᇊ㊫රⲴ᧿䘠ㅖˈ ᖃ᫽֌⇥䘹ᤙㅖ઼⇥᧿䘠ㅖᰦˈ༴⨶ಘՊ䲿ᰦỰḕ㊫රؑ᚟DŽѫ㾱൘ԕлє⿽ᛵߥлỰḕ㊫රؑ᚟˖ ਖањ㺘㔉ࠪҶ㌫㔏᧿䘠ㅖ TYPE ᆇ⇥Ⲵ㕆⸱DŽ ⭘Ҿᇊѹԓ⸱ǃᮠᦞ઼㌫㔏᧿䘠ㅖⲴ਴⿽㊫රDŽка㢲Ⲵ㺘㔉ࠪҶԓ⸱઼ᮠᦞ᧿䘠ㅖ TYPE ᆇ⇥Ⲵ㕆⸱˗ Sḷᘇ⭘Ҿᤷࠪањ᧿䘠ㅖᱟ㌫㔏㊫රⲴ䘈ᱟԓ⸱ᡆᮠᦞ㊫රⲴDŽTYPE ᆇ⇥ਖཆᨀ׋Ҷ 4 њ∄⢩ս 䘉Ӌؑ᚟ሩ⭡Ҿ䶎⌅֯⭘⇥ᡆ䰘ሬ㠤Ⲵ㕆〻䭉䈟䘋㹼Ự⍻DŽ ਓ⛩Ⲵᤷ䪸DŽ⇥᧿䘠ㅖ൘єњൠᯩਜ਼ᴹ㊫රؑ᚟ˈণ᧿䘠ㅖѝⲴ S ḷᘇ઼㊫රᆇ⇥ TYPEDŽ༴⨶ಘ࡙⭘ޕ Ҿ㇑⨶ԫ࣑ԕ৺ᔲᑨ઼ѝᯝDŽ䈧⌘᜿ˈᒦ䶎ᡰᴹⲴ᧿䘠ㅖ䜭ᇊѹањ⇥ˈ䰘᧿䘠ㅖѝᆈ᭮ᴹᤷੁањ䗷〻 䲔Ҷᓄ⭘〻ᒿԓ⸱઼ᮠᦞ⇥ᴹ᧿䘠ㅖԕཆˈ༴⨶ಘ䘈ᴹ㌫㔏⇥઼䰘є⿽᧿䘠ㅖ㊫රDŽ䘉Ӌᮠᦞ㔃ᶴ⭘ 4.5.1.2 ⇫㊱ශ TYPE Ỷḛ ᣔᙗᔲᑨDŽ؍ԕ㻛࣐䖭䘋ањ⇥ᇴᆈಘѝˈնᱟԫօ֯⭘䘉⿽᧿䘠ㅖᕅ⭘޵ᆈⲴԱമ䜭ሶӗ⭏ања㡜 ٬DŽ䘉ṧⲴ䘹ᤙㅖᤷੁ GDT 㺘ѝⲴㅜањн⭘Ⲵ᧿䘠ㅖ亩DŽቭ㇑䘉њオ䘹ᤙㅖਟ 䘹ᤙㅖਟԕާᴹ 0 8N-1DŽ ањᴹ᭸ᆇ㢲DŽഐѪ⇿њ᧿䘠ㅖᱟ 8 ᆇ㢲䮯ˈഐ↔ਜ਼ᴹ N њ᧿䘠ㅖ亩Ⲵ㺘ᓄ䈕ާᴹ䲀䮯٬  ᣔ؍ 䘹ᤙㅖDŽ ᣔᔲᑨˈᒦфн࣐䖭⇥؍઼ RPL є㘵ᰦˈ༴⨶ಘ᡽Պᢺ䘹ᤙㅖ࣐䖭䘋⇥ᇴᆈಘѝDŽ੖ࡉቡՊӗ⭏ања㡜 ᒿᡆԫ࣑Ⲵ CPLǃ⇥䘹ᤙㅖⲴ RPL ઼⇥᧿䘠ㅖⲴ DPL 䘋㹼∄䖳DŽਚᴹᖃ⇥Ⲵ DPL ᮠ٬བྷҾᡆㅹҾ CPL ൘ᢺањ⇥䘹ᤙㅖ࣐䖭䘋⇥ᇴᆈಘѝѻࡽˈ༴⨶ಘՊ䘋㹼⢩ᵳ㓗Ựḕˈ㿱മ 4-20 ᡰ⽪DŽᆳՊᢺᖃࡽ䘀㹼〻 ึḸ⇥ᇴᆈಘ˄SS˅ѝDŽ˄ਟԕ֯⭘ᤷԔ MOVǃPOPǃLDSǃLESǃLFSǃLGS ઼ LSS ᶕ࣐䖭⇥ᇴᆈಘ˅DŽ ѪҶ䇯䰞ᮠᦞ⇥ѝⲴ᫽֌ᮠˈᮠᦞ⇥Ⲵ⇥䘹ᤙㅖᗵ享㻛࣐䖭䘋ᮠᦞ⇥ᇴᆈಘ˄DSǃESǃFS ᡆ GS˅ᡆ 4.5.2 䇵䰤ᮦᦤ⇫ᰬⲺ⢯ᵹ㓝Ỷḛ ᔿ઼䛓Ӌ⭘Ҿ൘ԓ⸱⇥ѻ䰤䘋㹼〻ᒿ᧗ࡦ䖜〫ⲴỰḕᯩᔿнаṧDŽഐ↔л䶒࠶є⿽䇯䰞ᛵߥᶕ㘳㲁DŽ ᖃ⇥᧿䘠ㅖⲴ⇥䘹ᤙㅖ㻛࣐䖭䘋ањ⇥ᇴᆈಘᰦቡՊ䘋㹼⢩ᵳ㓗Ựḕ᫽֌ˈն⭘Ҿᮠᦞ䇯䰞ⲴỰḕᯩ ާᴹ䇯䰞䘉њ⇥Ⲵᵳ䲀DŽ 儈⢩ᵳ㓗Ⲵԓ⸱нՊԓ㺘ᓄ⭘〻ᒿ৫䇯䰞ањ⇥ˈ䲔䶎ᓄ⭘〻ᒿ㠚ᐡ؍⺞䊑DŽഐ↔ˈRPL ਟ⭘ᶕ ḕ∄䖳Ⲵ⢩ᵳ㓗˅ˈ৽ѻҏ❦DŽণ࿻㓸ਆ RPL ઼ CPL ѝᮠ٬ᴰབྷⲴ⢩ᵳ㓗֌Ѫ䇯䰞⇥ᰦⲴ∄䖳ሩ 㻛ᤂ㔍DŽҏণྲ᷌⇥䘹ᤙㅖⲴ RPL ަᮠ٬བྷҾ CPLˈ䛓Ѹ RPL ሶ㾶ⴆ CPL˄㘼֯⭘ RPL ֌ѪỰ ᡆԫ࣑ާᴹ䏣ཏⲴ⢩ᵳ㓗˄CPL˅ᶕ䇯䰞ањ⇥ˈնᱟྲ᷌ᨀ׋Ⲵ RPL ⢩ᵳ㓗н䏣Ⲵ䈍䇯䰞ҏሶ ᤙㅖⲴս 0 ઼ս 1 ѝDŽ༴⨶ಘՊ਼ᰦỰḕ RPL ઼ CPLˈԕ⺞ᇊᱟ੖ݱ䇨䇯䰞ањ⇥DŽণ֯〻ᒿ „ 䈧≲⢩ᵳ㓗 RPL˄Request Privilege Level˅DŽRPL ᱟа⿽䍻Ҹ⇥䘹ᤙㅖⲴ䎵䎺⢩ᵳ㓗ˈᆳᆈ᭮൘䘹 оᮠᦞ⇥Ⲵ䇯䰞㿴ࡉ⴨਼DŽ˅ ‹ ԫ࣑⣦ᘱ⇥ TSSDŽަ DPL ᤷࠪ䇯䰞 TSS Ⲵᖃࡽᢗ㹼〻ᒿᡆԫ࣑ਟ༴ҾⲴᴰབྷ⢩ᵳ㓗ᮠ٬DŽ˄䘉 н㜭䇯䰞䘉њԓ⸱⇥DŽ ᴹⲴᴰሿ⢩ᵳ㓗ᮠ٬DŽֻྲˈྲ᷌а㠤ԓ⸱⇥Ⲵ DPL ᱟ 2ˈ䛓Ѹ䘀㹼൘ CPL Ѫ 0 Ⲵ〻ᒿቡ ‹ а㠤઼䶎а㠤ԓ⸱⇥˄䙊䗷䈳⭘䰘䇯䰞˅DŽަ DPL ᤷࠪݱ䇨䇯䰞ᵜԓ⸱⇥Ⲵ〻ᒿᡆԫ࣑ᓄާ ٬DŽ˄䘉оᮠᦞ⇥Ⲵ䇯䰞㿴ࡉ⴨਼DŽ˅ ‹ 䈳⭘䰘˄Call Gate˅DŽަ DPL ᤷࠪ䇯䰞䈳⭘䰘Ⲵᖃࡽᢗ㹼〻ᒿᡆԫ࣑ਟ༴ҾⲴᴰབྷ⢩ᵳ㓗ᮠ Ѫ 0 Ⲵ〻ᒿ㜭ཏ䇯䰞䘉њ⇥DŽ 䰞䈕⇥ᗵ享ާᴹⲴ⢩ᵳ㓗DŽֻྲˈྲ᷌Ḁњ䶎а㠤ԓ⸱⇥Ⲵ DPL ᱟ 0ˈ䛓Ѹਚᴹ䘀㹼൘ CPL ‹ 䶎а㠤ԓ⸱⇥˄Nonconforming code segment˅˄н֯⭘䈳⭘䰘˅DŽަ DPL ᤷࠪ〻ᒿᡆԫ࣑䇯 䰞䘉њ⇥DŽ ᮠ٬DŽֻྲˈྲ᷌ᮠᦞ⇥Ⲵ⢩ᵳ㓗 DPL ᱟ 1ˈ䛓Ѹਚᴹ䘀㹼൘ CPL Ѫ 0 ᡆ 1 Ⲵ〻ᒿਟԕ䇯 ‹ ᮠᦞ⇥˄Data Segment˅DŽަ DPL ᤷࠪݱ䇨䇯䰞ᵜᮠᦞ⇥Ⲵ〻ᒿᡆԫ࣑ᓄާᴹⲴᴰབྷ⢩ᵳ㓗 ਼Ⲵਜ਼ѹ˖ ৺⇥ᡆ䰘䘹ᤙㅖѝⲴ RPL˄㿱л䶒䈤᰾˅֌∄䖳DŽṩᦞ㻛䇯䰞Ⲵ⇥ᡆ䰘Ⲵ㊫රн਼ˈDPL ҏᴹн 䘠ㅖⲴ DPL ᆇ⇥ѝDŽ൘ᖃࡽᢗ㹼ԓ⸱⇥䈅മ䇯䰞ањ⇥ᡆ䰘ᰦˈ⇥ᡆ䰘Ⲵ DPL Պ⭘ᶕо CPL ԕ „ ᧿䘠ㅖ⢩ᵳ㓗 DPL˄Descriptor Privilege Level˅DŽDPL ᱟањ⇥ᡆ䰘Ⲵ⢩ᵳ㓗DŽᆳᆈ᭮൘⇥ᡆ䰘᧿ ᰦˈCPL ᒦнՊ㻛؞᭩ᡀа㠤ԓ⸱⇥Ⲵ DPLDŽ DPL Ⲵԫօ⇥䜭ਟԕ䇯䰞а㠤ԓ⸱⇥DŽᒦфᖃ༴⨶ಘ䇯䰞ањ⢩ᵳ㓗н਼Ҿ CPL Ⲵа㠤ԓ⸱⇥ ԓ⸱⇥ᰦˈࡉ༴⨶ಘሩ CPL Ⲵ䇮㖞ᴹӋн਼DŽ⢩ᵳ㓗٬儈Ҿ˄ণվ⢩ᵳ㓗˅ᡆㅹҾа㠤ԓ⸱⇥ ਖањާᴹн਼⢩ᵳ㓗Ⲵԓ⸱⇥ѝᰦˈ༴⨶ಘቡՊ᭩ਈ CPLDŽᖃ䇯䰞ања㠤ᙗ˄conforming˅ CS ઼ SS ⇥ᇴᆈಘⲴս 0 ઼ս 1 ѝDŽ䙊ᑨˈCPL ㅹҾᖃࡽԓ⸱⇥Ⲵ⢩ᵳ㓗DŽᖃ〻ᒿᢺ᧗ࡦ䖜〫ࡠ  ᣔ؍  Ựḕ ⢩ᵳ㓗  '3/ ᮠᦞ⇥᧿䘠ㅖ 53/ ᮠᦞ⇥䘹ᤙㅖ &3/ &6ᇴᆈಘ ᖃн䙊䗷䈳⭘䰘ᢺ〻ᒿ᧗ࡦᵳ䖜〫ࡠਖањԓ⸱⇥ᰦˈ༴⨶ಘՊ傼䇱 4 ⿽⢩ᵳ㓗઼㊫රؑ᚟ˈ㿱മ 4-21 ⢩ᵳ㓗ỰḕDŽ ỰḕDŽJMPǃCALL ᡆ RET ᤷԔⲴ䘌䖜〫ᖒᔿՊᢺ᧗ࡦ䖜〫ࡠਖཆањԓ⸱⇥ѝˈഐ↔༴⨶ಘаᇊՊѻ䟂 JMPǃCALL ઼ RET ᤷԔⲴ䘁䖜〫ᖒᔿਚᱟ൘ᖃࡽԓ⸱⇥ѝᢗ㹼〻ᒿ᧗ࡦ䖜〫ˈഐ↔нՊᢗ㹼⢩ᵳ㓗 4.5.3.1 ⴪᧛䈹⭞ᡌ䐩䖢ࡦԙ⸷⇫ ԫ࣑㇑⨶а㢲ѝ䘋㹼䈤᰾DŽޣл䶒᧿䘠ࡽє⿽ᕅ⭘㊫රˈਾє⿽ሶ᭮൘ᴹ „ ⴞḷ᫽֌ᮠᤷੁањԫ࣑䰘ˈ䈕ԫ࣑䰘ᤷੁањ TSSˈ㘼䈕 TSS ѝਜ਼ᴹⴞḷԓ⸱⇥Ⲵ䘹ᤙㅖ˗ „ ⴞḷ᫽֌ᮠᤷੁањ TSSˈ㘼䈕 TSS ѝਜ਼ᴹⴞḷԓ⸱⇥Ⲵ䘹ᤙㅖ˗ „ ⴞḷ᫽֌ᮠᤷੁањ䈳⭘䰘᧿䘠ㅖˈ㘼䈕᧿䘠ㅖѝਜ਼ᴹⴞḷԓ⸱⇥Ⲵ䘹ᤙㅖ˗ „ ⴞḷ᫽֌ᮠਜ਼ᴹⴞḷԓ⸱⇥Ⲵ⇥䘹ᤙㅖ˗ ࡙⭘алഋ⿽ᯩ⌅ѻаᶕᕅ⭘ਖཆањԓ⸱⇥˖ ⢩↺ᇎ⧠ˈሶ൘ਾ䶒᧿䘠ˈᵜ㢲ѫ㾱䈤᰾ JMPǃCALL ઼ RET ᤷԔⲴᇎ⧠ᯩ⌅DŽJMP ᡆ CALL ᤷԔਟԕ 〻ᒿⲴ᧗ࡦ䖜〫֯⭘ᤷԔ JMPǃRETǃINT ઼ IRET ԕ৺ᔲᑨ઼ѝᯝᵪࡦᶕᇎ⧠DŽᔲᑨ઼ѝᯝᱟаӋ 㻛䖜〫ࡠᯠԓ⸱⇥ѝˈ〻ᒿሶӾ EIP ᇴᆈಘᤷੁⲴᤷԔ༴ᔰ࿻ᢗ㹼DŽ ⢩ᵳ㓗ỰḕDŽྲ᷌䘉ӋỰḕ䜭䙊䗷Ҷˈࡉⴞḷԓ⸱⇥䘹ᤙㅖቡՊ࣐䖭䘋 CS ᇴᆈಘˈҾᱟ〻ᒿⲴ᧗ࡦᵳቡ ಘ˄CS˅ѝDŽ֌Ѫ䘉њ࣐䖭䗷〻Ⲵа䜘࠶ˈ༴⨶ಘՊỰ⍻ⴞḷԓ⸱⇥Ⲵ⇥᧿䘠ㅖᒦᢗ㹼਴⿽䲀䮯ǃ㊫ර઼ ሩҾሶ〻ᒿ᧗ࡦᵳӾањԓ⸱⇥䖜〫ࡠਖањԓ⸱⇥ˈⴞḷԓ⸱⇥Ⲵ⇥䘹ᤙㅖᗵ享࣐䖭䘋ԓ⸱⇥ᇴᆈ 4.5.3 ԙ⸷⇫ҁ䰪䖢〱᧝࡬ᰬⲺ⢯ᵹ㓝Ỷḛ ᣔᙗᔲᑨDŽ؍о CPL н਼ˈ༴⨶ಘቡՊӗ⭏ања㡜 о CPL ३䝽DŽҏণˈCPLǃึḸ⇥䘹ᤙㅖⲴ RPL ԕ৺ึḸ⇥᧿䘠ㅖⲴ DPL 䜭ᗵ享⴨਼DŽྲ᷌ RPL ᡆ DPL Ⲵᡰᴹ⢩ᵳ㓗ᗵ享ޣᖃ֯⭘ึḸ⇥䘹ᤙㅖ࣐䖭 SS ⇥ᇴᆈಘᰦҏՊᢗ㹼⢩ᵳ㓗ỰḕDŽ䘉䟼оึḸ⇥⴨ 㘼н㇑ԓ⸱⇥Ⲵ DPLDŽᯩ⌅ 3 ҏᙫᱟᴹ᭸ⲴˈഐѪ CS ᇴᆈಘ䘹ᤙⲴԓ⸱⇥Ⲵ DPL о CPL ⴨਼DŽ 䇯䰞ᮠᦞ⇥Ⲵ⴨਼㿴ࡉҏ䘲⭘ᯩ⌅ 1DŽᯩ ⌅ 2 ࡉᱟᙫᱟᴹ᭸ⲴˈഐѪа㠤ԓ⸱⇥Ⲵ⢩ᵳ㓗ㅹ਼Ҿ CPLˈ 3. ֯⭘ԓ⸱⇥㾶ⴆࡽ㔰˄CS˅ᶕ䈫ਆањ䘹ᤙㅖᐢ㓿൘ CS ᇴᆈಘѝⲴਟ䈫ԓ⸱⇥DŽ 2. ᢺа㠤ਟ䈫ԓ⸱⇥Ⲵ䘹ᤙㅖ࣐䖭䘋ањᮠᦞ⇥ᇴᆈಘѝDŽ 1. ᢺ䶎а㠤ਟ䈫ԓ⸱⇥Ⲵ䘹ᤙㅖ࣐䖭䘋ањᮠᦞ⇥ᇴᆈಘѝDŽ Պ䴰㾱䇯䰞ԓ⸱⇥ѝⲴᮠᦞDŽ↔ᰦਟԕ֯⭘ԕлᯩ⌅ᶕ䇯䰞ԓ⸱⇥ѝⲴᮠᦞ˖ ᡁԜىᆈ൘ԓ⸱⇥ѝDŽֻྲˈᖃԓ⸱઼ᮠᦞᱟ൘ ROM ѝᰦDŽഐ↔ˈᴹӋᰦ؍ਖཆˈᴹਟ㜭Պᢺᮠᦞ ᵳ㓗 3 Ⲵᮠᦞ⇥ਟ㻛䇯䰞DŽ ᦞ⇥䜭ਟ㻛䇯䰞˗ᖃ CPL ᱟ 1 ᰦˈਚᴹ൘⢩ᵳ㓗 1 ࡠ 3 Ⲵᮠᦞ⇥ਟ㻛䇯䰞˗ᖃ CPL ᱟ 3 ᰦˈਚᴹ༴Ҿ⢩ ਟ⸕ањ〻ᒿᡆԫ࣑ਟራ൰Ⲵ४ฏ䲿⵰ަ CPL ᭩ਈ㘼ਈॆDŽᖃ CPL ᱟ 0 ᰦˈ↔ᰦᡰᴹ⢩ᵳ㓗кⲴᮠ ഴ 䇵䰤ᮦᦤ⇫ᰬⲺ⢯ᵹ㓝Ỷḛ   ᣔ؍ &   /'3 ⴞⲴԓ⸱⇥᧿䘠ㅖ   Ựḕ ⢩ᵳ㓗   53/ ԓ⸱⇥䘹ᤙㅖ &3/ &6ᇴᆈಘ ᣔᵪࡦⲴ᫽֌؍䈳⭘䰘⭘Ҿ൘н਼⢩ᵳ㓗ѻ䰤ᇎ⧠ਇ᧗Ⲵ〻ᒿ᧗ࡦ䖜〫DŽᆳԜ䙊ᑨӵ⭘Ҿ֯⭘⢩ᵳ㓗 ⭘ᔲᑨ઼ѝᯝⲴ༴⨶〻ᒿˈ䘉ሶ൘ла㢲䘋㹼䈤᰾DŽᵜ㢲ӵ䈤᰾䈳⭘䰘Ⲵ֯⭘ᯩ⌅DŽ ԫ࣑䰘⭘Ҿԫ࣑࠷ᦒˈሶ൘ਾ䶒ԫ࣑㇑⨶а㢲䈤᰾DŽ䲧䱡䰘઼ѝᯝ䰘ᱟ䈳⭘䰘Ⲵ⢩↺㊫ˈу䰘⭘Ҿ䈳 „ ԫ࣑䰘˄Task Gate˅ˈ㊫ර TYPE=5DŽ „ ѝᯝ䰘˄Interrupt Gate˅ˈ㊫ර TYPE=14˗ „ 䲧䱡䰘˄Trap Gate˅ˈ㊫ර TYPE=15˗ „ 䈳⭘䰘˄Call Gate˅ˈ㊫ර TYPE=12˗ 4 ⿽䰘᧿䘠ㅖ˖ ᴹޡѪҶሩާᴹн਼⢩ᵳ㓗Ⲵԓ⸱⇥ᨀ׋ਇ᧗Ⲵ䇯䰞ˈ༴⨶ಘᨀ׋Ҷ〠Ѫ䰘᧿䘠ㅖⲴ⢩↺᧿䘠ㅖ䳶DŽ 4.5.3.2 䰞ᨅ䘦ㅜ 䲔䶎䖜〫ᱟ䙊䗷ањ䈳⭘䰘䘋㹼ˈ㿱л䶒䈤᰾DŽ བྷཊᮠԓ⸱⇥䜭ᱟ䶎а㠤ԓ⸱⇥DŽሩҾ䘉Ӌ⇥ˈ〻ᒿⲴ᧗ࡦᵳਚ㜭䖜〫ࡠާᴹ⴨਼⢩ᵳ㓗Ⲵԓ⸱⇥ѝˈ ࠷ᦒDŽ 䘉ᱟ CPL оਟ㜭оᖃࡽԓ⸱⇥ DPL н⴨਼Ⲵୟаа⿽ᛵߥDŽ਼ṧˈ⭡Ҿ CPL ⋑ᴹ᭩ਈˈഐ↔ึḸҏнՊ ᖃ〻ᒿ᧗ࡦ㻛䖜〫ࡠања㠤ԓ⸱⇥ѝˈCPL ᒦн᭩ਈˈণ֯ⴞⲴԓ⸱⇥Ⲵ DPL ൘ᮠ٬кሿҾ CPLDŽ ᵳ㓗DŽ⢩⸱⇥ˈDPL 㺘⽪䈳⭘㘵ሩԓ⸱⇥䘋㹼ᡀ࣏䈳⭘ਟԕ༴ҾⲴᴰվᮠ٬ ᣔᔲᑨDŽሩҾ䇯䰞а㠤ԓ⸱⇥ˈ༴⨶ಘᘭ⮕ሩ RPL ⲴỰḕDŽሩҾа㠤ԓ؍DPL ᰦˈ༴⨶ಘ᡽Պӗ⭏а㡜 ᖃ䇯䰞а㠤ԓ⸱⇥ᰦ˄C=1˅ˈ䈳⭘㘵Ⲵ CPL ਟԕ൘ᮠ٬кབྷҾᡆㅹҾⴞⲴԓ⸱⇥Ⲵ DPLDŽӵ ᖃ CPL < 㘵Ⲵ CPLDŽণ֯⇥䘹ᤙㅖⲴ RPL о CPL н਼ˈ䘉ҏᱟ↓⺞ⲴDŽ ᡀ࣏ᆼᡀDŽᖃ䶎а㠤ԓ⸱⇥Ⲵ⇥䘹ᤙㅖ㻛࣐䖭䘋 CS ᇴᆈಘѝᰦˈ⢩ᵳ㓗ᆇ⇥нՊ᭩ਈˈণᆳӽ❦ᱟ䈳⭘ ⇥䘹ᤙㅖⲴ RPL ሩỰḕᡰ䎧Ⲵ֌⭘ᴹ䲀DŽRPL ൘ᮠ٬кᗵ享ሿҾᡆㅹҾ䈳⭘㘵Ⲵ CPL ᡽㜭֯ᗇ᧗ࡦ䖜〫 ᣔᔲᑨDŽᤷੁ䶎а㠤ԓ⸱⇥Ⲵ؍䈳⭘㘵˄〻ᒿ˅Ⲵ CPL ᗵ享ㅹҾⴞⲴԓ⸱⇥Ⲵ DPLˈ੖ࡉሶՊӗ⭏а㡜 ༴⨶ಘỰḕ CPLǃRPL ઼ DPL Ⲵ㿴ࡉ׍䎆Ҿа㠤ḷᘇ C Ⲵ䇮㖞⣦ᘱDŽᖃ䇯䰞䶎а㠤ԓ⸱⇥ᰦ˄C=0˅ˈ „ ⴞⲴԓ⸱⇥᧿䘠ㅖѝⲴа㠤ᙗḷᘇ CDŽᆳ⺞ᇊҶањԓ⸱⇥ᱟ䶎а㠤ԓ⸱⇥䘈ᱟа㠤ԓ⸱⇥DŽ „ ⴞⲴԓ⸱⇥Ⲵ⇥䘹ᤙㅖѝⲴ䈧≲⢩ᵳ㓗 RPLDŽ „ ਜ਼ᴹ㻛䈳⭘䗷〻ⲴⴞⲴԓ⸱⇥⇥᧿䘠ㅖѝⲴ᧿䘠ㅖ⢩ᵳ㓗 DPLDŽ ⸱⇥Ⲵ CPLDŽ˅ „ ᖃࡽ⢩ᵳ㓗 CPLDŽ˄䘉䟼ˈCPL ᱟᢗ㹼䈳⭘Ⲵԓ⸱⇥Ⲵ⢩ᵳ㓗ˈণਜ਼ᴹᢗ㹼䈳⭘ᡆ䐣䖜〻ᒿⲴԓ ഴ ⴪᧛䈹⭞ᡌ䐩䖢ࡦԙ⸷⇫ᰬⲺ⢯ᵹ㓝Ỷḛ  ᡰ⽪˖  ᣔ؍       6HJPHQW6HOHFWRU ⇥䘹ᤙㅖ 2IIVHWLQ6HJPHQW ٬〫ٿ⇥ѝ  '3/  3     7<3( 2IIVHWLQ6HJPHQW ٬〫ٿ⇥ѝ 3DUDP&RXQW ৲ᮠњᮠ          ਓ⛩Ⲵ㓯ᙗൠ൰DŽޕ٬䘋㹼㓴ਸˈᖒᡀԓ⸱⇥ѝᤷᇊ〻ᒿ〫ٿᢺԓ⸱⇥᧿䘠ㅖⲴสൠ൰о䈳⭘䰘ѝⲴ ᖃ༴⨶ಘ䇯䰞䈳⭘䰘ᰦˈᆳՊ֯⭘䈳⭘䰘ѝⲴ⇥䘹ᤙㅖᶕᇊսⴞⲴԓ⸱⇥Ⲵ⇥᧿䘠ㅖDŽ❦ਾ CPU Պ ⽪DŽ ٬ਟԕ䇮㖞Ѫԫ᜿٬DŽ㿱മ 4-23 ᡰ〫ٿ٬㲭❦䴰㾱ն CPU ᒦнՊ⭘ᆳDŽ䈕〫ٿҾᤷᇊ䈳⭘䰘ˈ㘼ᤷ䪸Ⲵ ѪҶ䇯䰞䈳⭘䰘ˈᡁԜ䴰㾱Ѫ CALL ᡆ JMP ᤷԔⲴ᫽֌ᮠᨀ׋ањ䘌ᤷ䪸DŽ䈕ᤷ䪸ѝⲴ⇥䘹ᤙㅖ⭘ 4.5.3.3 䙐䗽䈹⭞䰞䇵䰤ԙ⸷⇫ ѝᯝ઼ᔲᑨ䰘䘋㹼༴⨶֌߶༷DŽ ࡦࡠᯠึḸѝⲴ৲ᮠњᮠDŽLinux ޵Ṩѝᒦ⋑ᴹ⭘ࡠ䈳⭘䰘DŽ䘉䟼ሩ䈳⭘䰘䘋㹼䈤᰾ᱟѪла㢲ӻ㓽࡙⭘ ḷᘇ P ᤷ᰾䈳⭘䰘᧿䘠ㅖᱟ੖ᴹ᭸DŽ৲ᮠњᮠᆇ⇥˄Param Count˅ᤷ᰾൘ਁ⭏ึḸ࠷ᦒᰦӾ䈳⭘㘵ึḸ༽ 䗷〻ⲴㅜаᶑᤷԔDŽDPL ᆇ⇥ᤷᇊ䈳⭘䰘Ⲵ⢩ᵳ㓗ˈӾ㘼ᤷᇊ䙊䗷䈳⭘䰘䇯䰞⢩ᇊ䗷〻ᡰ㾱≲Ⲵ⢩ᵳ㓗DŽ ਓ⛩䙊ᑨᱟᤷᇊޕਓ⛩DŽ䘉њޕ٬ᆇ⇥ᤷᇊ⇥ѝ〫ٿ䈳⭘䰘ѝⲴ⇥䘹ᤙㅖᆇ⇥ᤷᇊ㾱䇯䰞Ⲵԓ⸱⇥DŽ ഴ 䈹⭞䰞ᨅ䘦ㅜṲᕅ  „ ᤷ᰾䈳⭘䰘᧿䘠ㅖᱟ੖ᴹ᭸DŽ „ 㤕Պਁ⭏ึḸ࠷ᦒˈᆳՊᤷᇊ൘ึḸѻ䰤䴰㾱༽ࡦⲴਟ䘹৲ᮠњᮠ˗ „ ᤷᇊ䇯䰞䗷〻Ⲵ䈳⭘㘵䴰ާ༷Ⲵ⢩ᵳ㓗˗ ਓ⛩˗ޕ„ ൘ᤷᇊԓ⸱⇥ѝᇊѹ䗷〻˄〻ᒿ˅Ⲵањ „ ᤷᇊ㾱䇯䰞Ⲵԓ⸱⇥˗ ᯝ᧿䘠ㅖ㺘 IDT ѝDŽањ䈳⭘䰘ѫ㾱ާᴹалࠐњ࣏㜭˖ ㌫㔏ѝDŽമ 4-22 㔉ࠪҶ䈳⭘䰘᧿䘠ㅖⲴṬᔿDŽ䈳⭘䰘᧿䘠ㅖਟԕᆈ᭮൘ GDT ᡆ LDT ѝˈնᱟн㜭᭮൘ѝ  ᣔ؍ 䘹ᤙㅖ ٬〫ٿ //$& ԓ⸱⇥᧿䘠ㅖ 䰘᧿䘠ㅖ ⇥ส൰ ኎ᙗ ⇥䲀䮯 ⇥䲀䮯 н⭘ ਓ⛩ޕ䗷〻 ⴞḷԓ⸱⇥ 䈳⭘ᤷԔ ٬〫ٿ 䘹ᤙㅖ ኎ᙗ &   '3/ ⴞⲴԓ⸱⇥᧿䘠ㅖ   Ựḕ ⢩ᵳ㓗   '3/ 䈳⭘䰘᧿䘠ㅖ 53/ 䈳⭘䰘䘹ᤙㅖ &3/ &6ᇴᆈಘ 㿴ࡉˈণ RPL ҏᗵ享ሿҾᡆㅹҾ䈳⭘䰘Ⲵ DPLDŽ ᒿⲴ⢩ᵳ㓗 CPL ᗵ享ሿҾᡆㅹҾ䈳⭘䰘Ⲵ DPLDŽ䈳⭘䰘⇥䘹ᤙㅖⲴ RPL ҏ䴰਼䈳⭘䘉Ⲵ CPL 䚥ᆸ਼ṧⲴ ᆇ⇥ᤷ᰾Ҷ䈳⭘〻ᒿ㜭ཏ䇯䰞䈳⭘䰘Ⲵᮠ٬ᴰབྷⲴ⢩ᵳ㓗˄ᴰሿ⢩ᵳ㓗˅ˈণѪҶ䇯䰞䈳⭘䰘ˈ䈳⭘㘵〻 ֯⭘ CALL ᤷԔ઼ JMP ᤷԔ࠶࡛ާᴹн਼Ⲵ⢩ᵳ㓗Ự⍻㿴ࡉˈ㿱㺘 4-5 ᡰ⽪DŽ䈳⭘䰘᧿䘠ㅖⲴ DPL ഴ 䙐䗽䈹⭞䘑㺂᧝࡬䖢〱Ⲻ⢯ᵹ㓝Ỷḛ  ਖཆˈⴞⲴԓ⸱⇥᧿䘠ㅖѝⲴа㠤ᙗḷᘇ C ҏሶਇࡠỰḕDŽ „ ⴞⲴԓ⸱⇥᧿䘠ㅖѝⲴ DPL˗ „ 䈳⭘䰘᧿䘠ㅖѝⲴ᧿䘠ㅖ⢩ᵳ㓗 DPL˗ „ 䈳⭘䰘䘹ᤙㅖѝⲴ䈧≲⢩ᵳ㓗 RPL˗ „ ᖃࡽ⢩ᵳ㓗 CPL˗ 㿱മ 4-24 ᡰ⽪DŽ 䙊䗷䈳⭘䰘䘋㹼〻ᒿ᧗ࡦ䖜〫ᰦˈCPU Պሩ 4 ѝн਼Ⲵ⢩ᵳ㓗䘋㹼Ựḕˈԕ⺞ᇊ᧗ࡦ䖜〫Ⲵᴹ᭸ᙗˈ ഴ 䰞䈹⭞ᬃ֒䗽ぁ   ᣔ؍ ᤙㅖ઼Ḹᤷ䪸DŽ൘䈫ਆḸ⇥䘹ᤙㅖǃḸᤷ䪸ᡆḸ⇥᧿䘠ㅖ䗷〻ѝˈԫօ䘍৽⇥⭼䲀Ⲵ䭉䈟䜭ሶሬ 1. ֯⭘ⴞⲴԓ⸱⇥Ⲵ DPL˄ণᯠⲴ CPL˅Ӿ TSS ѝ䘹ᤙᯠḸⲴᤷ䪸DŽӾᖃࡽ TSS ѝ䈫ਆᯠḸⲴ⇥䘹 ⢩ᵳ㓗кᢗ㹼㻛䈳⭘䗷〻˄㿱മ 4-25 ᡰ⽪˅˖ ᖃ䙊䗷䈳⭘䰘ᢗ㹼ањ䗷〻䈳⭘㘼䙐ᡀ⢩ᵳ㓗᭩ਈᰦˈCPU ቡՊᢗ㹼ԕл↕僔࠷ᦒึḸᒦᔰ࿻൘ᯠⲴ ⭡Ҿањ䗷〻ਟ䈳⭘ަᆳ䗷〻ˈഐ↔⇿њḸᗵ享ᴹ䏣ཏབྷⲴオ䰤ᶕᇩ㓣ཊᑗ˄ཊ྇˅к䘠ؑ᚟DŽ „ ᖃ䳀ਜ਼䈳⭘ањᔲᑨᡆѝᯝ䗷〻ᰦḷᘇᇴᆈಘ EFLAGS ઼ࠪ䭉⸱֯⭘Ⲵオ䰤DŽ „ 㻛䈳⭘䗷〻Ⲵ৲ᮠ઼Ѥᰦਈ䟿ᡰ䴰֯⭘Ⲵオ䰤DŽ „ 䈳⭘䗷〻Ⲵ SSǃESPǃCS ઼ EIP ᇴᆈಘ޵ᇩ˗ ٬DŽ⇿њḸᗵ享ਟ䈫ਟ߉ˈᒦфާᴹ䏣ཏⲴオ䰤ᶕᆈ᭮ԕлаӋؑ᚟˖ ᫽֌㌫㔏䴰㾱䍏䍓Ѫᡰᴹ⭘ࡠⲴ⢩ᵳ㓗ᔪ・ึḸ઼ึḸ⇥᧿䘠ㅖˈᒦф൘ԫ࣑Ⲵ TSS ѝ䇮㖞ࡍ࿻ᤷ䪸 ・ањᯠḸDŽ Ӿ䈳⭘䗷〻䘄എᰦˈ⴨ᓄḸቡнᆈ൘ҶDŽла⅑޽䈳⭘䈕䗷〻ᰦˈቡ৸Պ޽⅑֯⭘ TSS ѝⲴࡍ࿻ᤷ䪸٬ᔪ 䈫٬DŽ൘ԫ࣑䘀㹼ᰦ CPU ᒦнՊ؞᭩ᆳԜDŽᖃ䈳⭘ᴤ儈⢩ᵳ㓗〻ᒿᰦˈCPU ᡽⭘ᆳԜᶕᔪ・ᯠึḸDŽᖃ ⢩ᵳ㓗 0ǃ1 ઼ 2 ⲴึḸⲴࡍ࿻ᤷ䪸٬䜭ᆈ᭮൘ᖃࡽ䘀㹼ԫ࣑Ⲵ TSS ⇥ѝDŽTSS ⇥ѝ䘉Ӌᤷ䪸䜭ᱟਚ ᆈ൘㻛䈳⭘䗷〻ⲴึḸкDŽ؍ф൘ਁ⭏ึḸ࠷ᦒᰦ㻛 ᖃ⢩ᵳ㓗 3 Ⲵ〻ᒿ൘ᢗ㹼ᰦˈ⢩ᵳ㓗 3 ⲴึḸⲴ⇥䘹ᤙㅖ઼Ḹᤷ䪸Պ㻛࠶࡛ᆈ᭮൘ SS ઼ ESP ѝˈᒦ ٬ᤷᇊDŽ〫ٿҾн਼Ⲵ⇥ѝˈᒦф֯⭘⇥䘹ᤙㅖ઼⇥ѝ 㓗 2ǃ1 ઼ 0DŽྲ᷌ањ㌫㔏ѝਚ֯⭘Ҷ 3 ઼ 0 єњ⢩ᵳ㓗ˈ䛓Ѹ⇿њԫ࣑ቡਚ䴰䇮㖞єњḸDŽ⇿њḸ䜭ս ⇿њԫ࣑ᗵ享ᇊѹᴰཊ 4 њḸDŽањ⭘Ҿ䘀㹼൘⢩ᵳ㓗 3 Ⲵᓄ⭘〻ᒿԓ⸱ˈަԆ࠶࡛⭘Ҿ⭘ࡠⲴ⢩ᵳ ӛⲴึḸᴹ᜿ᡆᰐ᜿ൠᒢᢠ儈⢩ᵳ㓗Ⲵ〻ᒿDŽޡҶ䱢→վ⢩ᵳ㓗〻ᒿ䙊䗷 ⢩ᵳ㓗ⲴึḸ৫DŽᢗ㹼Ḹ࠷ᦒ᫽֌ⲴⴞⲴᱟѪҶ䱢→儈⢩ᵳ㓗〻ᒿ⭡ҾḸオ䰤н䏣㘼ᕅ䎧ፙ⒳ˈ਼ᰦҏѪ ⇿ᖃ䈳⭘䰘⭘Ҿᢺ〻ᒿ᧗ࡦ䖜〫ࡠањᴤ儈㓗࡛Ⲵ䶎а㠤ᙗԓ⸱⇥ᰦˈCPU Պ㠚ࣘ࠷ᦒࡠⴞⲴԓ⸱⇥ 4.5.3.4 ฼Ḿ࠽ᦘ Ⲵ䈳⭘䰘DŽ 䇮㖞ањᡰᴹ⢩ᵳ㓗ԓ⸱䜭㜭䇯䰞Ⲵ䈳⭘䰘DŽਖཆਟԕу䰘Ѫӵ⭘Ҿ᫽֌㌫㔏Ⲵԓ⸱䇮㖞аӋᴤ儈⢩ᵳ㓗 ⸱ਟ㜭ਜ਼ᴹ᫽֌㌫㔏㠚䓛઼ᓄ⭘䖟Ԧ䜭ݱ䇨䇯䰞Ⲵԓ⸱˄∄ྲ༴⨶ᆇㅖ I/O Ⲵԓ⸱˅DŽഐ↔ਟԕѪ䘉Ӌ䗷〻 䈳⭘䰘ਟԕ䇙ањԓ⸱⇥ѝⲴ䗷〻㻛н਼⢩ᵳ㓗Ⲵ〻ᒿ䇯䰞DŽֻྲˈսҾањԓ⸱⇥ѝⲴ᫽֌㌫㔏ԓ CPL ᒦнՊ᭩ਈˈᒦфҏнՊᕅ䎧ึḸ࠷ᦒDŽ ᒦфՊᕅ䎧ึḸ࠷ᦒDŽնᱟྲ᷌ањ䈳⭘ᡆ䐣䖜ᢺ᧗ࡦ䖜〫ࡠᴤ儈㓗࡛Ⲵа㠤ᙗԓ⸱⇥кˈ䛓Ѹˈ٬ DPL ྲ᷌ањ䈳⭘ᢺ᧗ࡦ䖜〫ࡠҶᴤ儈⢩ᵳ㓗Ⲵ䶎а㠤ᙗԓ⸱⇥ѝˈ䛓Ѹ CPL ቡՊ㻛䇮㖞ѪⴞⲴԓ⸱⇥Ⲵ ᙗԓ⸱⇥ѝDŽ Ԕ઼ JMP ᤷԔ䜭ਟԕᢺ᧗ࡦ䖜〫ࡠᴤ儈⢩ᵳ㓗Ⲵа㠤ᙗԓ⸱⇥ѝˈণ䖜〫ࡠ DPL ሿҾᡆㅹҾ CPL Ⲵа㠤 ⇥ѝ৫ᢗ㹼DŽ㘼 JMP ᤷԔਚ㜭䙊䗷䈳⭘䰘ᢺ᧗ࡦ䖜〫ࡠ DPL ㅹҾ CPL Ⲵ䶎а㠤ᙗԓ⸱⇥ѝDŽն CALL ᤷ 䈳⭘䰘ᢺ〻ᒿ᧗ࡦ䖜〫ࡠ⢩ᵳ㓗ᴤ儈Ⲵ䶎а㠤ᙗԓ⸱⇥ѝˈণਟԕ䖜〫ࡠ DPL ሿҾ CPL Ⲵ䶎а㠤ᙗԓ⸱ DPL 䘋㹼∄䖳ỰḕDŽ൘䘉ᯩ䶒ˈCALL ᤷԔ઼ JMP ᤷԔⲴỰḕ㿴ࡉቡн਼ҶDŽਚᴹ CALL ᤷԔਟԕ䙊䗷 ྲ᷌䈳⭘䘉о䈳⭘䰘ѻ䰤Ⲵ⢩ᵳ㓗Ựḕᡀ࣏䙊䗷ˈCPU ቡՊ᧕⵰ᢺ䈳⭘㘵Ⲵ CPL оԓ⸱⇥᧿䘠ㅖⲴ ሩҾа㠤ᙗԓ⸱⇥㾱≲ DPL<=CPL˗ሩҾ䶎а㠤ᙗԓ⸱⇥ਚ㾱≲ DPL=CPL CPL<=䈳⭘䰘Ⲵ DPL˗RPL<=䈳⭘䰘Ⲵ DPLDŽ JMP ሩҾа㠤ᙗ઼䶎а㠤ᙗԓ⸱⇥䜭ਚ㾱≲ DPL<=CPL CPL<=䈳⭘䰘Ⲵ DPL˗RPL<=䈳⭘䰘Ⲵ DPLDŽ CALL ᤷԔ ⢩ᵳ㓗Ựḕ㿴ࡉ 㺞 &$// ᤽Ԛૂ -03 ᤽ԚⲺ⢯ᵹ㓝Ỷḛ㿺ࡏ  ᣔ؍ 㻛䈳⭘䗷〻ᯠḸ 䈳⭘㘵৏ึḸ 66 (63 ৏66  ৲ᮠ  ৏ (63  ৲ᮠ  ৲ᮠ   ৏&6 ৏66  ৏ (,3  ৲ᮠ  ৲ᮠ  ৲ᮠ ৏ (63    ཆ˅ˈ䛓Ѹ CPU ቡՊ⭘ NULL 䘹ᤙㅖ࣐䖭࣐䖭䘉њ⇥ᇴᆈಘDŽ 6. Ựḕ⇥ᇴᆈಘ DSǃESǃFS ઼ GS Ⲵ޵ᇩDŽྲ᷌ަѝᴹᤷੁ DPL ሿҾᯠ CPL Ⲵ⇥˄а㠤ԓ⸱⇥䲔 䈳⭘㘵ḸкⲴ৲ᮠDŽ 5. ྲ᷌ RET ᤷԔवਜ਼ањ৲ᮠњᮠ᫽֌ᮠˈࡉᢺ৲ᮠњᮠ٬࣐ࡠ ESP ᇴᆈಘ٬ѝˈԕ䐣䗷˄ђᔳ˅ ٬㻛ᣋᔳDŽ ḸⲴ SS ઼ ESP ٬࣐䖭ࡠ SS ઼ ESP ᇴᆈಘѝˈӾ㘼࠷ᦒഎ䈳⭘㘵ⲴึḸDŽ㘼↔ᰦ㻛䈳⭘㘵ึ ᆈⲴ SS ઼ ESP؍4. ᢺ ᆈⲴ䈳⭘㘵ึḸⲴᤷ䪸 SS ઼ ESPDŽ؍ಘᤷੁ৏ᶕ ٬ѻਾᢺ৲ᮠњᮠ٬࣐ࡠ ESP ᇴᆈಘ٬ѝˈԕ䐣䗷˄ђᔳ˅㻛䈳⭘㘵ḸкⲴ৲ᮠDŽ↔ᰦ ESP ᇴᆈ 3. ྲ᷌ RET ᤷԔवਜ਼ањ৲ᮠњᮠ᫽֌ᮠᒦф䘄എ᫽֌Պ᭩ਈ⢩ᵳ㓗ˈ䛓Ѹቡ൘ᕩࠪḸѝ CS ઼ EIP ⇥䘹ᤙㅖⲴ RPL 䘋㹼⢩ᵳ㓗о㊫රỰḕDŽ 2. ᕩࠪᒦ֯⭘㻛䈳⭘䗷〻ึḸкⲴ٬࣐䖭 CS ઼ EIP ᇴᆈಘDŽ൘↔䗷〻ѝՊሩԓ⸱⇥᧿䘠ㅖ઼ԓ⸱ ԕ⺞ᇊ൘䘄എᰦ⢩ᵳ㓗ᱟ੖䴰㾱᭩ਈDŽˈ٬⇥ᆈⲴ CS ᇴᆈಘѝ RPL ᆇ؍1. Ựḕ ∄ CPL བྷˈቡՊᢗ㹼⢩ᵳ㓗ѻ䰤Ⲵ䘄എ᫽֌DŽᖃᢗ㹼䘌䘄എࡠањ䈳⭘䗷〻ᰦˈCPU Պᢗ㹼ԕл↕僔˖ CPLDŽCPU Պ֯⭘ CS ᇴᆈಘѝ䘹ᤙㅖⲴ RPL ᆇ⇥ᶕ⺞ᇊᱟ੖㾱≲䘄എࡠվ⢩ᵳ㓗DŽྲ᷌ RPL Ⲵᮠ٬㾱 Պਁ⭏⢩ᵳ㓗᭩ਈⲴ䘌䘄എӵݱ䇨䘄എࡠվ⢩ᵳ㓗〻ᒿѝˈণ䘄എࡠⲴԓ⸱⇥ DPL ൘ᮠ٬к㾱བྷҾ 㓗ỰḕԕᓄԈᖃࡽ䗷〻ਟ㜭؞᭩ᤷ䪸٬ᡆ㘵ึḸࠪ⧠䰞仈ᰦⲴᛵߥDŽ ḸѝⲴˈഐ↔ᆳԜഐ䈕ᱟᴹ᭸ⲴDŽնᱟ CPU 䘈ᱟՊᢗ㹼⢩ᵳޕҾ䙊ᑨᛵߥл䘉єњᤷ䪸ᱟ CALL ᤷԔ঻ 㹼⭼䲀ỰḕDŽሩҾ⴨਼⢩ᵳ㓗Ⲵ䘌䘄എˈCPU ਼ᰦӾึḸѝᕩࠪ䘄എԓ⸱⇥Ⲵ䘹ᤙㅖ઼䘄എᤷԔᤷ䪸DŽ⭡ Ԕ⭘ҾӾ֯⭘ CALL ᤷԔ䈳⭘Ⲵ䗷〻ѝ䘄എDŽ䘁䘄എӵ൘ᖃࡽԓ⸱⇥ѝ䖜〫〻ᒿ᧗ࡦᵳˈഐ↔ CPU ӵ䘋 ᤷԔ RET ⭘Ҿᢗ㹼䘁䘄എ˄near return˅ǃ਼⢩ᵳ㓗䘌䘄എ˄far return˅઼н਼⢩ᵳ㓗Ⲵ䘌䘄എDŽ䈕ᤷ 4.5.3.5 Ԅ㻡䈹⭞䗽ぁ䘊ഔ ഴ уੂ⢯ᵹ㓝ҁ䰪䈹⭞ᰬⲺḾ࠽ᦘ  ᯠᤷԔᤷ䪸˅࣐䖭ࡠ EIP ѝDŽᴰਾᔰ࿻ᢗ㹼㻛䈳⭘䗷〻DŽ˄٬〫ٿ਼ᰦᢺ䈳⭘䰘ѝ ᯠḸDŽᢺᯠ˄ⴞⲴ˅ԓ⸱⇥䘹ᤙㅖ࣐䖭ࡠ CS ѝˈޕ5. ᢺ䘄എᤷԔᤷ䪸˄ণᖃࡽ CS ઼ EIP ޵ᇩ˅঻ 31ˈྲ᷌њᮠѪ 0ˈࡉ㺘⽪ᰐ৲ᮠˈн䴰༽ࡦDŽ 4. ᢺ䈳⭘䰘᧿䘠ㅖѝᤷᇊ৲ᮠњᮠⲴ৲ᮠӾ䈳⭘䗷〻Ḹ༽ࡦࡠᯠḸѝDŽ䈳⭘䰘ѝ৲ᮠњᮠ٬ᴰབྷѪ ᯠḸѝDŽޕᆈⲴ SS ઼ ESP ޵ᇩ঻؍ᰦ ᢺᯠḸⲴ⇥䘹ᤙㅖ઼Ḹᤷ䪸࣐䖭ࡠ SS ઼ ESP ѝDŽ❦ਾᢺѤˈᆈ SS ઼ ESP ᇴᆈಘⲴᖃࡽ٬؍3. Ѥᰦ 2. ỰḕḸ⇥᧿䘠ㅖ⢩ᵳ㓗઼㊫රᱟ੖ᴹ᭸ˈ㤕ᰐ᭸㘵਼ṧӗ⭏ањᰐ᭸ TSS ᔲᑨDŽ 㠤ӗ⭏ањᰐ᭸ TSS ᔲᑨ˗  ᣔ؍ ᆳԜ؍⺞ᙗˈնᱟ䴰㾱᫽֌㌫㔏䖟Ԧᶕޣ 80X86 ༴⨶ಘᒦ⋑ᴹ㔤ᣔ亥䖜ᦒ儈䙏㕃ߢ઼亥㺘ѝᮠᦞⲴ⴨ Ѫ䖜ᦒḕ᢮㕃ߢ TLB˄Translation Lookaside Buffer˅DŽ 㕃ߢ֌⭘㊫լҾࡽ䶒᧿䘠Ⲵ࣐䙏⇥䖜ᦒⲴ⇥ᇴᆈಘⲴᖡᆀ᧿䘠ㅖᇴᆈಘDŽ亥䖜ᦒ儈䙏㕃ߢⲴਖањᵟ䈝〠 Ⲵؑ᚟DŽਚᴹᖃᗵ㾱Ⲵ䖜ᦒؑ᚟н൘儈䙏㕃ߢѝᰦˈ༴⨶ಘ᡽Պᩌራ޵ᆈѝⲴ亥ⴞᖅ઼亥㺘DŽ亥䖜ᦒ儈䙏 ᆈ൘༴⨶ಘ޵Ⲵ亥䖜ᦒ儈䙏㕃ߢѝDŽ༴⨶ಘ൘䇯䰞޵ᆈѝⲴ亥㺘ѻࡽՊ俆ݸ࡙⭘㕃ߢѝ؍൰Ⲵ䖜ᦒؑ᚟㻛 ᆸ䘉Ӌ㿴ࡉDŽѪҶ䚯ݽ⇿⅑޵ᆈᓄ⭘䜭㾱䇯䰞傫⮉޵ᆈⲴ亥㺘ˈӾ㘼࣐ᘛ䙏ᓖˈᴰ䘁֯⭘Ⲵ㓯ᙗࡠ⢙⨶ൠ ᫽֌㌫㔏䖟Ԧ؞᭩亥㺘亩޵ᇩᡰ䴰䚥ᆸⲴ㿴ࡉDŽ࠶亥䖜ᦒ㕃ߢ㾱≲ᡰᴹ㌫㔏䜭享䚥ޣᵜ㢲ᨀ׋аӋᴹ ᭯享㺞亯Ⲻ䖥Ԭ䰤从ؤ 4.5.4.1 1 1 1 1 1 1 1 0 0 1 0 0 0 1 0 0 1 0 0 0 0 0 0 0 亥ⴞᖅ亩 U/S 亥㺘亩 U/S 㓴ਸⲴ U/S 亥ⴞᖅ亩 R/W 亥㺘亩 R/W 㓴ਸⲴ R/W 㺞 享ⴤᖋ亯ૂ享㺞亯ሯ享䶘ⲺćѨ㺂Ĉؓᣚ ᣔ᧚ᯭ䶎ᑨѕṬDŽ؍↔ഐ ᣔ኎ᙗ⭡є㘵኎ᙗⲴĀоā˄AND˅᫽֌ᶴᡀˈ؍ⴞᖅ亩ᡰ᱐ሴⲴᡰᴹ亥䶒䎧֌⭘DŽ亥ⴞᖅ઼亥㺘Ⲵ㓴ਸ 亥㺘㺘亩ѝⲴ U/S ḷᘇ઼ R/W ḷᘇᓄ⭘Ҿ䈕㺘亩᱐ሴⲴঅњ亥䶒DŽ亥ⴞᖅ亩ѝⲴ U/S ઼ R/W ḷᘇࡉሩ䈕 ᣔ኎ᙗ⭡亥ⴞᖅ઼亥㺘ѝ㺘亩ⲴĀѢ㹼āᡆĀо᫽֌āᶴᡀˈ㿱㺘 4-7 ᡰ⽪DŽ؍㊫լൠˈањ亥䶒Ⲵ ᴹਸк㓯䐟䜭нՊ䙊DŽ⋐ޣ⭥ᆀ㓯䐟ѝⲴѢ㹼㓯䐟ˈަѝ䛓њᔰۿᣔᵪࡦቡ؍઼࠶亥Ⲵ ᣔ኎ᙗˈ亥䶒࿻㓸ᱟ⋑ᴹ߉ᵳ䲀ⲴDŽਟ㿱࠶⇥؍ྲ᷌⇥Ⲵ㊫රᱟਚ䈫/ਟᢗ㹼ˈ䛓Ѹн㇑ሩᓄ亥䶒㻛䍻Ҹօ ⇥ᱟ䈫/߉㊫රⲴ⇥ˈնᱟൠ൰ሩᓄⲴ⴨ᓄ亥䶒㻛ḷ⌘Ѫਚ䈫/ਟᢗ㹼ˈ䛓Ѹ䘈ᱟн㜭ሩ亥䶒ᢗ㹼߉᫽֌DŽ ᆈѝⲴᆇ㢲᡽ਟ㻛㓗࡛ 3 кⲴ〻ᒿ䇯䰞DŽӵᖃ࠶⇥઼࠶亥䜭ݱ䇨߉ᰦˈ᡽㜭ሩ亥䶒ᢗ㹼߉᫽֌DŽྲ᷌ањ ḕDŽֻྲˈӵᖃањᆇ㢲սҾ㓗࡛ 3 ᢗ㹼Ⲵ〻ᒿਟ䇯䰞Ⲵ⇥ѝˈᒦф༴ҾḷᘇѪ⭘ᡧ㓗亥䶒ѝᰦˈ䘉њ޵ ᣔỰ؍ᣔ㻛Ựḕ઼⍻䈅DŽྲ᷌䙊䗷ỰḕˈቡՊ޽䘋㹼亥㓗؍ᣔ᧚ᯭѻਾਁᥕ֌⭘DŽ俆ݸˈᡰᴹ⇥㓗؍׋Ⲵ ᣔҏᱟ൘࠶⇥ᵪࡦᨀ؍↓ྲ൘ᮤњ 80X86 ൠ൰䖜ᦒᵪࡦѝ࠶亥ᵪࡦᱟ൘࠶⇥ᵪࡦѻਾᇎᯭаṧˈ亥㓗 1 1 䈫/߉/ᢗ㹼 䈫/߉/ᢗ㹼 1 0 䈫/ᢗ㹼 䈫/߉/ᢗ㹼 0 1 ᰐ䈫/߉/ᢗ㹼 0 0 ᰐ䈫/߉/ᢗ㹼 U/S R/W ⭘ᡧݱ䇨Ⲵ䇯䰞 䎵㓗⭘ᡧݱ䇨Ⲵ䇯䰞 㺞 Ფ䙐⭞ᡭૂ䎻㓝⭞ᡭሯ享䶘Ⲻ䇵䰤䲆࡬ /ਟᢗ㹼ᵳ䲀ˈवᤜ䛓Ӌ൘⭘ᡧ㓗ḷ⌘Ѫਚ䈫/ਟᢗ㹼Ⲵ亥䶒DŽ 䇯䰞䎵㓗⭘ᡧቲⲴ亥䶒DŽо࠶⇥ᵪࡦн਼Ⲵᱟˈ൘޵ቲ䎵㓗⭘ᡧ㓗ᢗ㹼Ⲵ〻ᒿሩԫօ亥䶒䜭ާᴹਟ䈫/ਟ߉ 䇯䰞⭘ᡧ㓗Ⲵ亥䶒ˈնᱟ൘ԫօ䎵㓗⭘ᡧቲ˄0ǃ1ǃ2˅ᢗ㹼Ⲵ〻ᒿнӵਟԕ䇯䰞⭘ᡧቲⲴ亥䶒ˈҏਟԕ 䈫/ਟ߉/ਟᢗ㹼ⲴˈնᲞ䙊⭘ᡧнਟ䇯䰞ˈ㿱㺘 4-6 ᡰ⽪DŽሩҾ࠶⇥ᵪࡦˈ൘ᴰཆቲ⭘ᡧ㓗ᢗ㹼Ⲵ〻ᒿਚ㜭 ⭘ᡧ㓗Ⲵ亥䶒ਟԕ㻛ḷᘇᡀਚ䈫/ਟᢗ㹼ᡆਟ䈫/ਟ߉/ਟᢗ㹼DŽ䎵㓗⭘ᡧ㓗Ⲵ亥䶒ሩҾ䎵㓗⭘ᡧᶕ䇢ᙫᱟਟ ࠶亥ᵪࡦਚ䇶࡛є㓗ᵳ䲀DŽ⢩ᵳ㓗 0ǃ1 ઼ 2 㻛ᖂ㊫Ѫ䎵㓗⭘ᡧ㓗ˈ㘼⢩ᵳ㓗 3 㻛֌ѪᲞ䙊⭘ᡧ㓗DŽᲞ䙊 ᣔ኎ᙗⲴањᆀ䳶DŽ؍亥ⴞᖅ઼亥㺘㺘亩ѝⲴ䈫߉ḷᘇ R/W ઼⭘ᡧ/䎵㓗⭘ᡧḷᘇ U/S ᨀ׋Ҷ࠶⇥ᵪࡦ 4.5.4 享㓝ؓᣚ  ᣔ؍ ੁ䟿ਧ ࣙ䇠ㅖ 䈤᰾ ㊫ර 䭉䈟ਧ ӗ⭏Ⓚ 㺞 ؓᣚ⁗ᕅсⲺᔸᑮૂѣᯣ ᇊѹྭⲴᔲᑨ઼ NMI ѝᯝⓀDŽ ᆈ൘ึḸкDŽ਼ᰦ䘈㔉ࠪҶ⇿њ亴ݸ؍ሩҾ⇿њᔲᑨˈ䈕㺘㔉ࠪҶᔲᑨ㊫රԕ৺ᱟ੖Պӗ⭏ањ䭉䈟⸱ᒦ 䙊䗷ཆ䜘⺜Ԧѝᯝᵪࡦੁ༴⨶ಘਁ䘱ѝᯝDŽ㺘 4-8 ѝ㔉ࠪҶѪ 80X86 ᇊѹⲴᔲᑨ઼ NMI ѝᯝ࠶䝽Ⲵੁ䟿DŽ 㤳ത൘ 32 ࡠ 255 Ⲵੁ䟿ਧ⭘Ҿ⭘ᡧᇊѹⲴѝᯝDŽ䘉Ӌѝᯝ䙊ᑨ⭘Ҿཆ䜘 I/O 䇮༷ˈ֯ᗇ䘉Ӌ䇮༷ਟԕ 㤳ത޵Ⲵੁ䟿ਧᒦ䶎⇿њ䜭ᐢᇊѹҶ࣏㜭ˈᵚᇊѹ࣏㜭Ⲵੁ䟿ਧሶ⮉֌Ӻਾ֯⭘DŽ ⮉⭘֌ 80X86 ༴⨶ಘᇊѹⲴᔲᑨ઼ѝᯝˈн䗷ⴞࡽ䈕؍ ݱ䇨Ⲵੁ䟿ਧ㤳തᱟ 0 ࡠ 255DŽަѝ 0 ࡠ 31 ਓ⛩ս㖞DŽޕDescriptor Table˅ѝⲴањ㍒ᕅਧˈᶕᇊսањᔲᑨᡆѝᯝⲴ༴⨶〻ᒿ ҸҶањḷ䇶ਧˈ〠Ѫੁ䟿˄vector˅DŽ༴⨶ಘᢺ䍻ҸᔲᑨᡆѝᯝⲴੁ䟿⭘֌ѝᯝ᧿䘠ㅖ㺘 IDT˄Interrupt ѪҶᴹࣙҾ༴⨶ᔲᑨ઼ѝᯝˈ⇿њ䴰㾱㻛༴⨶ಘ䘋㹼⢩↺༴⨶Ⲵ༴⨶ಘᇊѹⲴᔲᑨ઼ѝᯝᶑԦ䜭㻛䍻 4.6.1 ᔸᑮૂѣᯣੇ䠅 ᣔ⁑ᔿѝ༴⨶ಘѝᯝ઼ᔲᑨⲴ༴⨶ᵪࡦDŽ؍→DŽᵜ㢲᧿䘠 Ⲵᚒ༽䗷〻ᒦнՊཡ৫〻ᒿᢗ㹼Ⲵ䘎䍟ᙗˈ䲔䶎Ӿᔲᑨѝᚒ༽ᱟнਟ㜭Ⲵᡆ㘵ѝᯝሬ㠤ᖃࡽ䘀㹼〻ᒿ㻛㓸 ᯝᡆᔲᑨ༴⨶〻ᒿDŽᖃ༴⨶〻ᒿᢗ㹼ᆼ∅ˈ༴⨶ಘቡՊᚒ༽ᒦ㔗㔝ᢗ㹼㻛ѝᯝⲴ〻ᒿᡆԫ࣑DŽ㻛ѝᯝ〻ᒿ ᖃ᭦ࡠањѝᯝᡆỰ⍻ࡠањᔲᑨᰦˈ༴⨶ಘՊ㠚ࣘൠᢺᖃࡽ↓൘ᢗ㹼Ⲵ〻ᒿᡆԫ࣑ᤲ䎧ˈᒦᔰ࿻䘀㹼ѝ ሩᓄ⭘〻ᒿ઼᫽֌㌫㔏ᶕ䈤ˈ80X86 Ⲵѝᯝ઼ᔲᑨ༴⨶ᵪࡦਟԕ䘿᰾ൠ༴⨶ਁ⭏Ⲵѝᯝ઼ᔲᑨһԦDŽ ᣔᵪࡦǃ亥䭉䈟ԕ৺ᵪಘ޵䜘䭉䈟DŽ؍Ự⍻ࡠ਴⿽ࠪ䭉ᶑԦˈवᤜ䘍৽ ᔲᑨਁ⭏൘༴⨶ಘᢗ㹼аᶑᤷԔᰦˈỰ⍻ࡠањࠪ䭉ᶑԦᰦਁ⭏ˈֻྲ㻛 0 䲔ࠪ䭉ᶑԦDŽ༴⨶ಘਟԕ ֻྲ㾱≲Ѫཆ䜘䇮༷ᨀ׋ᴽ࣑DŽᖃ❦ˈ䖟Ԧҏ㜭䙊䗷ᢗ㹼 INT n ᤷԔӗ⭏ѝᯝDŽ 䙊ᑨˈѝᯝਁ⭏൘〻ᒿᢗ㹼Ⲵ䲿ᵪᰦ࡫ˈԕ૽ᓄ⺜ԦਁࠪⲴؑਧDŽ㌫㔏⺜Ԧ֯⭘ѝᯝᶕ༴⨶ཆ䜘һԦˈ ಘ૽ᓄѝᯝᡆᔲᑨᡰ䟷ਆⲴ㹼ࣘ㻛〠Ѫѝᯝ/ᔲᑨᴽ࣑˄༴⨶˅DŽ Ѫѝᯝ༴⨶〻ᒿ˄interrupt handler˅ᡆᔲᑨ༴⨶〻ᒿ˄exception handler˅Ⲵ⢩↺䖟Ԧ࠭ᮠᡆԫ࣑ѝDŽ༴⨶ њһԦˈ䈕һԦ䴰㾱༴⨶ಘ䘋㹼༴⨶DŽ䙊ᑨˈ䘉⿽һԦՊሬ㠤ᢗ㹼᧗ࡦ㻛ᕪ䘛Ӿᖃࡽ䘀㹼〻ᒿ䖜〫ࡠ㻛〠 ѝᯝ˄Interrupt˅઼ᔲᑨ˄Exception˅ᱟᤷ᰾㌫㔏ǃ༴⨶ಘᡆᖃࡽᢗ㹼〻ᒿ˄ᡆԫ࣑˅ⲴḀ༴ࠪ⧠а 4.6 ѣᯣૂᔸᑮ༺⨼ ᣔDŽ؍ሩњ࡛亥䶒䘋㹼߉ ᣔᵪࡦਟ⭘ᶕ؍ᣔDŽֻྲˈྲ᷌ањਟ䈫ਟ߉ᮠᦞ⇥㻛࠶亥ˈ䛓Ѹ亥㓗؍ᣔਟ㻛⭘ᶕ໎ᕪ⇥㓗؍മDŽ亥㓗 ᣔỰḕՊ䱫→ԫօሩ亥䶒Ⲵ߉᫽֌Ա؍֯亥䶒Ⲵ R/W ḷᘇ㻛䇮㖞ᡀਟ䈫ਟ߉ҏнՊ䇙亥䶒ਟ߉DŽ↔ᰦ⇥㓗 ᣔDŽֻྲˈ㤕ањԓ⸱⇥㻛䇮ᇊѪнਟ߉ˈ䛓Ѹԓ⸱⇥㻛࠶亥ਾˈণ؍ᣔн㜭ᴯԓᡆᘭ⮕⇥㓗؍亥㓗 њ亥ᔲᑨDŽ ᣔ䘍㿴䭉䈟ˈࡉՊ᭮ᔳ޵ᆈ䇯䰞ᒦӗ⭏ањᔲᑨDŽྲ᷌ᱟ⇥ᵪࡦӗ⭏Ⲵᔲᑨˈ䛓ѸቡнՊ޽ӗ⭏а؍ањ ᣔDŽྲ᷌ CPU ൘ԫօа㓗Ự⍻ࡠ؍ᣔˈ❦ਾ޽༴⨶亥㓗؍ᖃ੟⭘Ҷ࠶亥ᵪࡦˈCPU Պ俆ݸᢗ㹼⇥㓗 4.5.5 㓺ਾ享㓝ૂ⇫㓝ؓᣚ 㕃ߢDŽ ޵ᆈԕ֯亥䶒ᆈ൘ᰦˈᡁԜн䴰㾱ࡧᯠ亥䖜ᦒ儈䙏ޕ儈䙏㕃ߢѝDŽᡰԕ൘ᢺањ亥䶒Ӿ⻱ⴈ䈳ޕнՊ㻛ᆈ ؞᭩ᰦˈণ֯ᱟᢺ P ḷᘇӾ 0 ᭩ᡀ 1 ᶕḷ⌘㺘亩ሩ亥䖜ᦒᴹ᭸ˈҏн䴰㾱ࡧᯠ儈䙏㕃ߢDŽഐѪᰐ᭸Ⲵ㺘亩 ᴹа⿽⢩↺ᛵߥˈ൘䘉⿽ᛵߥл؞᭩亥㺘亩н䴰㾱ࡧᯠ亥䖜ᦒ儈䙏㕃ߢDŽҏণᖃнᆈ൘亥䶒Ⲵ㺘亩㻛 є㘵а㠤DŽ䙊䗷ㆰঅൠ䟽ᯠ࣐䖭ᇴᆈಘ CR3ˈᡁԜቡਟԕᆼᡀሩ儈䙏㕃ߢⲴࡧᯠ᫽֌DŽ؍⺞ߢԕ 亥㺘㻛䖟Ԧ؞᭩䗷ҶDŽഐ↔᫽֌㌫㔏ᗵ享൘᭩ࣘ䗷亥㺘ѻਾࡧᯠ儈䙏㕃ىа㠤DŽণ༴⨶ಘᒦн⸕䚃ӰѸᰦ  ѝᯝ઼ᔲᑨ༴⨶ NMI ༴⨶⺜ԦDŽ ྲ᷌ NMI Ⲵੁ䟿ਧ 2 ⭘Ҿ䈕 INT ᤷԔˈቡՊ䈳⭘ NMI Ⲵѝᯝ༴⨶ಘ〻ᒿˈնᱟ↔ᰦᒦнՊ◰⍫༴⨶ಘⲴ ྲ᷌֯⭘Ҷ༴⨶ಘ亴ݸᇊѹⲴ NMI ੁ䟿ˈ䛓Ѹ༴⨶ಘሩᆳⲴ૽ᓄሶоᲞ䙊ᯩᔿӗ⭏Ⲵ䈕 NMI ѝᯝн਼DŽ ᢗ㹼 Linux Ⲵ㌫㔏ѝᯝ䈳⭘ѝᯝ 0x80DŽੁ䟿 0 ࡠ 255 ѝⲴԫօањ䜭ਟԕ⭘֌ INT ᤷԔⲴѝᯝਧDŽ❦㘼ˈ 䙊䗷൘ᤷԔ᫽֌ᮠѝᨀ׋ѝᯝੁ䟿ਧˈINT n ᤷԔਟ⭘ҾӾ䖟Ԧѝӗ⭏ѝᯝDŽֻྲˈᤷԔ INT 0x80 Պ 㭭ᡰᴹ䘉Ӌ⺜ԦѝᯝDŽ 䜘ѝᯝ䜭㻛〠Ѫਟቿ㭭⺜Ԧѝᯝˈवᤜѝᯝੁ䟿ਧ 0 ࡠ 255DŽḷᘇᇴᆈಘ EFLAGS ѝⲴ IF ḷᘇਟ⭘ᶕቿ ᭦ࡠؑਧᰦˈቡӗ⭏ањ䶎ቿ㭭ѝᯝDŽᆳ֯⭘പᇊⲴѝᯝੁ䟿ਧ 2DŽԫօ䙊䗷༴⨶ಘ INTR ᕅ㝊᧕᭦Ⲵཆ ਧᰦˈ༴⨶ಘቡՊӾ㌫㔏ᙫ㓯к䈫ਆཆ䜘ѝ⇥᧗ࡦಘ˄ֻྲ 8259A˅ᨀ׋Ⲵѝᯝੁ䟿ਧDŽᖃᕅ㝊 NMI ᧕ ཆ䜘ѝᯝ䙊䗷༴⨶ಘ㣟⡷кєњᕅ㝊˄INTR ઼ NMI˅᧕᭦DŽᖃᕅ㝊 INTR ᧕᭦ࡠཆ䜘ਁ⭏Ⲵѝᯝؑ „ 䖟Ԧӗ⭏ⲴѝᯝDŽ „ ཆ䜘˄⺜Ԧӗ⭏˅Ⲵѝᯝ˗ ༴⨶ಘӾє⿽ൠᯩ᧕᭦ѝᯝ˖ 4.6.2.1 ѣᯣⓆ 4.6.2 ѣᯣⓆૂᔸᑮⓆ ⮉˅ѝᯝ ѝᯝ ཆ䜘ѝᯝᡆ㘵 INT n ᤷԔDŽ؍32-255 -- ⭘ᡧᇊѹ˄䶎 ⮉ˈ䈧य֯⭘˅؍ 20-31 -- ˄Intel 䘋˅DŽ SSE ઼ SSE2 ⎞⛩ᤷԔ˄PIII ༴⨶ಘᕅ 19 #XF SIMD ⎞⛩ᔲᑨ ᭵䳌 ᰐ 㞮༴⨶ಘᕅ䘋˅DŽ྄˄ޣ 䭉䈟⸱˄㤕ᴹ˅઼ӗ⭏Ⓚо CPU ㊫රᴹ 18 #MC ᵪಘỰḕ ᔲᑨ㓸→ ᰐ 17 #AC ሩ䎧Ựḕ ᭵䳌 ᴹ˄0˅ ሩ޵ᆈѝԫօᮠᦞⲴᕅ⭘DŽ 16 #MF x87 FPU ⎞⛩䭉䈟˄ᮠᆖ䭉䈟˅ ᭵䳌 ᰐ x87 FPU ⎞⛩ᡆ WAIT/FWAIT ᤷԔDŽ ⮉ˈ䈧य֯⭘˅ ᰐ؍ 15 -- ˄Intel 14 #PF 亥䶒䭉䈟 ᭵䳌 ᴹ ԫօ޵ᆈᕅ⭘DŽ ᣔỰḕDŽ؍ᣔ䭉䈟 ᭵䳌 ᴹ ԫօ޵ᆈᕅ⭘઼ަԆ؍13 #GP а㡜 12 #SS ึḸ⇥䭉䈟 ᭵䳌 ᴹ ึḸ᫽֌઼ SS ᇴᆈಘ࣐䖭DŽ 11 #NP ⇥нᆈ൘ ᭵䳌 ᴹ ࣐䖭⇥ᇴᆈಘᡆ䇯䰞㌫㔏⇥DŽ 10 #TS ᰐ᭸Ⲵԫ࣑⣦ᘱ⇥ TSS ᭵䳌 ᴹ ԫ࣑Ӕᦒᡆ䇯䰞 TSSDŽ ᑨ˅DŽ ⎞⛩ᤷԔ˄386 ԕਾⲴ CPU нӗ⭏䈕ᔲ ⮉˅ ᭵䳌 ᰐ؍˄9 -- ॿ༴⨶ಘ⇥䎵䎺 8 #DF ৼ䟽䭉䈟 ᔲᑨ㓸→ ᴹ˄0˅ ԫօਟӗ⭏ᔲᑨǃNMI ᡆ INTR ⲴᤷԔDŽ 7 #NM 䇮༷нᆈ൘˄ᰐᮠᆖॿ༴⨶ಘ˅ ᭵䳌 ᰐ ⎞⛩ᡆ WAIT/FWAIT ᤷԔDŽ ⲴᯠᤷԔ˅ޕѝ࣐ ⮉Ⲵ᫽֌⸱DŽ˄྄㞮 Pro؍UD2 ᤷԔᡆ 6 #UD ᰐ᭸᫽֌⸱˄ᵚᇊѹ᫽֌⸱˅ ᭵䳌 ᰐ 5 #BR 䗩⭼㤳ത䎵ࠪ ᭵䳌 ᰐ BOUND ᤷԔDŽ 4 #OF ⓒࠪ 䲧䱡 ᰐ INTO ᤷԔDŽ 3 #BP ᯝ⛩ 䲧䱡 ᰐ INT 3 ᤷԔDŽ 2 -- NMI ѝᯝ ѝᯝ ᰐ 䶎ቿ㭭ཆ䜘ѝᯝDŽ 1 #DB 䈳䈅 ᭵䳌/䲧䱡 ᰐ ԫօԓ⸱ᡆᮠᦞᕅ⭘ˈᡆᱟ INT 1 ᤷԔDŽ 0 #DE 䲔ࠪ䭉 ᭵䳌 ᰐ DIV ᡆ IDIV ᤷԔDŽ  ѝᯝ઼ᔲᑨ༴⨶ ᆈⲴ䘄എᤷԔᤷ䪸ᤷੁ༴؍ѝᯝՊѕṬൠ᭟ᤱ㻛ѝᯝ〻ᒿⲴ䟽ᯠᢗ㹼㘼нՊђཡԫօ䘎䍟ᙗDŽѝᯝᡰ 䰝〻ᒿ઼㌫㔏DŽޣ༴⨶ಘ⣦ᘱⲴ䇺ᯝؑ᚟ˈᒦфቭਟ㜭ᚠᖃൠޣᴹ ѝ→ Abort ㊫ᔲᑨн᭟ᤱਟ䶐ൠ䟽ᯠᢗ㹼〻ᒿᡆԫ࣑DŽѝ→ᔲᑨⲴ༴⨶〻ᒿ䙊ᑨ⭘ᶕ᭦䳶ᔲᑨਁ⭏ᰦ ᤷԔ䲿ਾⲴаᶑᤷԔDŽ ൘ᢗ㹼 JMP ᤷԔᰦỰ⍻ࡠањ Trap ᔲᑨˈ䛓Ѹ䘄എᤷԔᤷ䪸Պᤷੁ JMP ᤷԔⲴⴞḷս㖞ˈ㘼䶎ᤷੁ JMP ᶑᢗ㹼᧗ࡦ䖜〫ⲴᤷԔᢗ㹼ᵏ䰤Ự⍻ࡠањ Trapˈࡉ䘄എᤷԔᤷ䪸Պ৽᱐ࠪ᧗ࡦⲴ䖜〫ᛵߥDŽֻྲˈྲ᷌ ᆈⲴ䘄എᤷ䪸ᤷੁᕅ䎧䲧䱡᫽֌ⲴਾаᶑᤷԔDŽྲ᷌൘а؍ሩҾ䲧䱡 Trap ㊫ᔲᑨˈ༴⨶ಘӗ⭏ᔲᑨᰦ ᗵ㾱Ⲵᇴᆈಘ઼ึḸᤷ䪸ؑ᚟ˈԕ֯ᗇ㠚ᐡ㜭ཏ䘄എࡠᢗ㹼ࠪ䭉ᤷԔѻࡽⲴ⣦ᘱDŽ ᆈ؍䟽ᯠᢗ㹼ሩҾᖃࡽᢗ㹼〻ᒿާᴹ䘿᰾ᙗˈ༴⨶ಘՊ؍⺞䙊䗷䟽ᯠᢗ㹼ࠪ䭉ᤷԔᶕᚒ༽〻ᒿᢗ㹼DŽѪҶ кⲴањ᫽֌ᮠᰦቡՊࠪ⧠䘉⿽ᔲᑨDŽᖃ亥᭵䳌ᔲᑨਁ⭏ᰦˈᔲᑨ༴⨶〻ᒿਟԕᢺ䈕亥䶒࣐䖭ࡠ޵ᆈѝᒦ ᫽֌ᮠਇ䱫ⲴᛵߥDŽFault ᴰᑨ㿱Ⲵањֻᆀᱟ亥䶒᭵䳌˄Page-fault˅ᔲᑨDŽᖃ〻ᒿᕅ⭘н൘޵ᆈѝ亥䶒 〻ᒿ䘄എਾ䟽ᯠᔰ࿻ᢗ㹼ᰦˈ৏ࠪ䭉ᤷԔՊ㻛䟽ᯠᢗ㹼DŽ䟽ᯠᢗ㹼ᕅਁࠪ䭉ⲴᤷԔ䙊ᑨ⭘Ҿ༴⨶䇯䰞ᤷԔ ᆈⲴ䘄എᤷ䪸ᤷੁࠪ䭉ᤷԔDŽഐѪˈᖃ〻ᒿᡆԫ࣑൘᭵䳌༴⨶؍ሩҾ᭵䳌㊫ᔲᑨˈ༴⨶ಘӗ⭏ᔲᑨᰦ 䇱ᱟ൘ᤷԔ䗩⭼кਁ⭏DŽ؍䜭㜭ᣕ੺㋮⺞ⲴᤷԔս㖞ˈᒦфᡰᴹѝᯝ ѪҶ䇙〻ᒿᡆԫ࣑൘ањᔲᑨᡆѝᯝ༴⨶ᆼѻਾ㜭䟽ᯠᚒ༽ᢗ㹼ˈ䲔Ҷѝ→˄Abort˅ѻཆⲴᡰᴹᔲᑨ 4.6.4 ぁᓅᡌԱࣗⲺ䠃᯦ᢝ㺂 ٬DŽ⌅㔗㔝ᢗ㹼DŽAbort ⭘Ҿᣕ੺ѕ䟽䭉䈟ˈֻྲ⺜Ԧ䭉䈟ԕ৺㌫㔏㺘ѝᆈ൘на㠤ᙗᡆ䶎 „ Abort ᱟа⿽нՊᙫᱟᣕ੺ሬ㠤ᔲᑨⲴᤷԔⲴ㋮⺞ս㖞Ⲵᔲᑨˈᒦфнݱ䇨ሬ㠤ᔲᑨⲴ〻ᒿ䟽ᯠ Trap ༴⨶〻ᒿⲴ䘄എൠ൰ᤷੁᕅ䎧䲧䱡ᤷԔⲴ䲿ਾаᶑᤷԔˈഐ↔൘䘄എਾՊᢗ㹼лаᶑᤷԔDŽ „ Trap ᱟањᕅ䎧䲧䱡ⲴᤷԔ㻛ᢗ㹼ਾ・࡫Պᣕ੺ⲴᔲᑨDŽTrap ҏ㜭ཏ䇙〻ᒿᡆԫ࣑䘎䍟ൠᢗ㹼DŽ ӗ⭏ Fault ⲴᤷԔˈ㘼нᱟަਾ䶒аᶑᤷԔDŽഐ↔൘䘄എਾӗ⭏ Fault ⲴᤷԔሶ㻛䟽ᯠᢗ㹼DŽ ༴⨶ಘՊᢺᵪಘ⣦ᘱᚒ༽ࡠӗ⭏ Fault ⲴᤷԔѻࡽⲴ⣦ᘱDŽ↔ᰦᔲᑨ༴⨶〻ᒿⲴ䘄എൠ൰Պᤷੁ „ Fault ᱟа⿽䙊ᑨਟԕ㻛㓐↓Ⲵᔲᑨˈᒦфаᰖ㻛㓐↓〻ᒿቡਟԕ㔗㔝䘀㹼DŽᖃࠪ⧠ањ Faultˈ 䱡˄Trap˅઼ѝ→˄Abort˅DŽ ṩᦞᔲᑨ㻛ᣕ੺Ⲵᯩᔿԕ৺ሬ㠤ᔲᑨⲴᤷԔᱟ੖㜭ཏ㻛䟽ᯠᢗ㹼ˈᔲᑨਟ㻛㓶࠶ᡀ᭵䳌˄Fault˅ǃ䲧 4.6.3 ᔸᑮ࠼㊱ 㖞༴˅ᕩࠪึḸˈӾ㘼Պ䙐ᡀ䘄എս㖞䭉䈟DŽ 䭉䈟⸱DŽഐ↔ˈྲ᷌֯⭘ INT ᤷԔᶕ⁑ᤏӗ⭏ањᔲᑨˈ༴⨶〻ᒿࡉՊᢺ EIP˄↓ྭ༴Ҿ㕪ቁⲴ䭉䈟⸱ս Ⲵѝᯝ䙊ᑨՊӗ⭏ањ䭉䈟⸱DŽሩҾ䛓ӋՊӗ⭏䭉䈟⸱ⲴᔲᑨˈᔲᑨⲴ༴⨶〻ᒿՊ䈅മӾึḸкᕩࠪޣ⴨ Ḹˈণ֯⺜Ԧӗ⭏Ⲵ䈕ੁ䟿ึޕᒿDŽնᱟˈഐѪ䘉ᇎ䱵кᱟањѝᯝˈഐ↔༴⨶ಘᒦнՊᢺањ䭉䈟ਧ঻ Ⲵᔲᑨ༴⨶〻ޣᑨⲴੁ䟿ਧѻаˈ䛓Ѹ༴⨶ಘሶѪ䈕ੁ䟿ਧӗ⭏ањѝᯝˈ䈕ѝᯝቡՊ৫ᢗ㹼о䈕ੁ䟿ᴹ INT n ᤷԔਟ⭘Ҿ൘䖟Ԧѝ⁑ᤏᤷᇊⲴᔲᑨˈնᴹањ䲀ࡦDŽྲ᷌ INT ᤷԔѝⲴ᫽֌ᮠ n ᱟ 80X86 ᔲ ⢩↺ᔲᑨᶑԦ䘋㹼ỰḕDŽֻྲˈINT 3 ᤷԔՊӗ⭏ањᯝ⛩ᔲᑨDŽ ᤷԔ INTOǃINT 3 ઼ BOUND ᤷԔਟԕ⭘ᶕӾ䖟Ԧѝӗ⭏ᔲᑨDŽ䘉ӋᤷԔਟሩᤷԔ⍱ѝᤷᇊ⛩ᢗ㹼Ⲵ 㿱ਾ䶒䈤᰾DŽ ⨶ಘѪަỰ⍻ࡠⲴ⇿њᔲᑨᇊѹҶањੁ䟿DŽᔲᑨਟԕ㻛㓶࠶Ѫ᭵䳌˄faults˅ǃ䲧䱡˄traps˅઼ѝ→˄aborts˅ˈ ൘ᓄ⭘〻ᒿᡆ᫽֌㌫㔏ᢗ㹼ᵏ䰤ˈྲ᷌༴⨶ಘỰ⍻ࡠ〻ᒿ䭉䈟ˈቡՊӗ⭏ањᡆཊњᔲᑨDŽ80X86 ༴ „ 䖟Ԧӗ⭏ⲴᔲᑨDŽ „ ༴⨶ಘỰ⍻ࡠⲴ〻ᒿ䭉䈟ᔲᑨ˗ ༴⨶ಘ᧕᭦ⲴᔲᑨҏᴹєњᶕⓀ˖ 4.6.2.2 ᔸᑮⓆ ⌘᜿ˈEFLAGS ѝⲴ IF ḷᘇн㜭ቿ㭭֯⭘ INT ᤷԔӾ䖟Ԧѝӗ⭏ⲴѝᯝDŽ  ѝᯝ઼ᔲᑨ༴⨶ IDT 㺘ਟԕ傫⮉൘㓯ᙗൠ൰オ䰤Ⲵԫօൠᯩˈ༴⨶ಘ֯⭘ IDTR ᇴᆈಘᶕᇊս IDT 㺘Ⲵս㖞DŽ䘉њᇴ 㜭ਁ⭏Ⲵᔲᑨᡆѝᯝ᡽䴰㾱᧿䘠ㅖDŽн䗷 IDT ѝᡰᴹオ᧿䘠ㅖ亩ᓄ䈕䇮㖞ަᆈ൘ս˄ḷᘇ˅Ѫ 0DŽ ѝᯝᡆᔲᑨੁ䟿ˈᡰԕ IDT ᰐ䴰वਜ਼ཊҾ 256 њ᧿䘠ㅖDŽIDT ѝਟԕਜ਼ᴹቁҾ 256 њ᧿䘠ㅖˈഐѪਚᴹਟ ༴⨶ಘᢺᔲᑨᡆѝᯝⲴੁ䟿ਧ*8DŽഐѪᴰཊਚᴹ 256 њˈԕवਜ਼᧿䘠ㅖDŽѪҶᶴᡀ IDT 㺘ѝⲴањ㍒ᕅ٬ о GDT ઼ LDT 㺘㊫լˈIDT ҏᱟ⭡ 8 ᆇ㢲䮯᧿䘠ㅖ㓴ᡀⲴањᮠ㓴DŽо GDT н਼Ⲵᱟˈ㺘ѝㅜ 1 亩ਟ ѝᯝ᧿䘠ㅖ㺘 IDT˄Interrupt Descriptor Table˅ሶ⇿њᔲᑨᡆѝᯝੁ䟿࠶࡛оᆳԜⲴ༴⨶䗷〻㚄㌫䎧ᶕDŽ 4.6.7 ѣᯣᨅ䘦ㅜ㺞 ᣔǃᮠᦞ亥ǃሩ喀Ựḕǃ⎞⛩ᔲᑨ؍а㡜 ᢗ㹼ᤷԔ䭉䈟˖ⓒࠪǃ䗩⭼Ựḕǃᰐ᭸ TSSǃ⇥нᆈ൘ǃึḸ䭉ǃ 9˄ᴰվ˅ 8 лаᶑᤷԔ䈁⸱䭉䈟˖ᤷԔ䮯ᓖ>15 ᆇ㢲ǃᰐ᭸᫽֌⸱ǃॿ༴⨶ಘнᆈ൘ 7 ਆлаᶑᤷԔ䭉䈟˖䘍৽ԓ⸱⇥䲀䮯ǃԓ⸱亥䭉䈟 6 ԓ⸱ᯝ⛩䭉䈟 5 ཆ䜘ѝᯝ˖NMI ѝᯝǃਟቿ㭭⺜Ԧѝᯝ ࡽаᤷԔ䲧䱡˖ᯝ⛩ǃ䈳䈅䲧䱡ᔲᑨ 4 ޕ3 ཆ䜘⺜Ԧӻ 2 ԫ࣑࠷ᦒ䲧䱡˖TSS ѝ䇮㖞Ҷ T ḷᘇ 1˄ᴰ儈˅ ⺜Ԧ༽ս˖RESET Ոݸ㓗 䈤᰾ ᔸᑮૂѣᯣⲺՎݾ㓝 㺞 ᔳⲴᔲᑨՊ䟽ᯠਁ⭏DŽ ᤱㅹᖵDŽᖃѝᯝ༴⨶〻ᒿ䘄എࡠӗ⭏ᔲᑨ઼/ᡆѝᯝⲴ〻ᒿᡆԫ࣑ᰦˈ㻛ђ؍ђᔳˈ㘼վՈݸ㓗ⲴѝᯝࡉՊ 㔉ࠪҶᔲᑨ઼ѝᯝⓀ㊫ⲴՈݸ㓗DŽ༴⨶ಘՊ俆ݸ༴⨶ᴰ儈Ոݸ㓗㊫ѝⲴᔲᑨᡆѝᯝDŽվՈݸ㓗ⲴᔲᑨՊ㻛 ྲ᷌൘аᶑᤷԔ䗩⭼ᴹཊњᔲᑨᡆѝᯝㅹᖵ༴⨶ᰦˈ༴⨶ಘՊ᤹㿴ᇊⲴ⅑ᒿሩᆳԜ䘋㹼༴⨶DŽ㺘 4-9 4.6.6 ᔸᑮૂѣᯣⲺՎݾ㓝 ྲ᷌ᱟ䙊䗷䲧䱡䰘ᶕ༴⨶ањѝᯝˈࡉ IF ḷᘇнՊ㻛༽սDŽ „ ᖃ䙊䗷ѝᯝ䰘༴⨶ањѝᯝᰦˈIF ḷᘇՊ㻛㠚ࣘ␵䲔˄༽ս˅ˈӾ㘼Պ⾱→ਟቿ㭭⺜ԦѝᯝDŽն „ ԫ࣑࠷ᦒǃPOPF ઼ IRET ᤷԔՊ࣐䖭 EFLAGS ᇴᆈಘDŽഐ↔ˈᆳԜਟ⭘ᶕ؞᭩ IF ḷᘇDŽ EFLAGS ᇴᆈಘѝDŽ ޕ㻛؞᭩䗷Ⲵḷᘇ޵ᇩ᭮ Ḹѝˈᒦфਟԕ൘䛓䟼㻛؞᭩DŽ㘼 POPF ᤷԔਟ⭘Ҿᢺᐢึޕ„ PUSHF ᤷԔՊᢺ EFLAGS ޵ᇩᆈ ᣔᙗᔲᑨDŽIF ḷᘇҏՊਇал᫽֌ᖡ૽˖؍੖ࡉሶᕅਁа㡜 IF ḷᘇਟԕ֯⭘ᤷԔ STI ઼ CLI ᶕ䇮㖞ᡆ␵䲔DŽਚᴹᖃ〻ᒿⲴ CPL<=IOPL ᰦ᡽ਟᢗ㹼䘉єᶑᤷԔˈ Ԇḷᘇаṧˈ༴⨶ಘ൘૽ᓄ⺜Ԧ༽ս᫽֌ᰦՊ␵䲔 IF ḷᘇ˄IF=0˅DŽ IF ḷᘇᒦнᖡ૽ਁ䘱ࡠ NMI ᕅ㝊Ⲵ䶎ቿ㭭ѝᯝˈҏнᖡ૽༴⨶ಘӗ⭏ⲴᔲᑨDŽྲ਼ EFLAGS ѝⲴަ ᕅ㝊ⲴѝᯝؑਧՊ㻛༴⨶ಘ䘋㹼༴⨶DŽ Ⲵਟቿ㭭⺜Ԧѝᯝᨀ׋ᴽ࣑DŽᖃ IF=0 ᰦˈ༴⨶ಘ⾱→ਁ䘱ࡠ INTR ᕅ㝊Ⲵѝᯝ˗ᖃ IF=1 ᰦˈࡉਁ䘱ࡠ INTR ḷᘇᇴᆈಘ EFLAGS Ⲵѝᯝݱ䇨ḷᘇ IF˄Interrupt enable Flag˅㜭ཏ⾱→Ѫ༴⨶ಘ INTR ᕅ㝊к᭦ࡠ 4.6.5 ᔶ੥ૂ⾷↘ѣᯣ 㔃ᶏᒦфᇴᆈಘᐢѪла⅑䟽༽᫽֌䇮㖞ྭᰦਁ⭏DŽ ⨶ಘ㧧ਆѝᯝᰦሶ㾱ᢗ㹼ⲴлаᶑᤷԔ䗩⭼༴DŽྲ᷌ࡊᢗ㹼ⲴᤷԔᴹањ䟽༽ࡽ㔰ˈࡉѝᯝՊ൘ᖃࡽ䟽༽  ѝᯝ઼ᔲᑨ༴⨶   1    䰘᧿䘠ㅖ 䰘᧿䘠ㅖ 1  䰘᧿䘠ㅖ  䰘᧿䘠ㅖ ,'7 สൠ൰ ,'7 䲀䮯٬  ѝᯝ᧿䘠ㅖ㺘 ,'7 ,'75 ᇴᆈಘ ԫ࣑䰘᧿䘠ㅖѝਜ਼ᴹањԫ࣑ TSS ⇥Ⲵ䘹ᤙㅖˈ䈕ԫ࣑⭘Ҿ༴⨶ᔲᑨ઼/ᡆѝᯝDŽ ⨶ಘ᫽֌ EFLAGS ᇴᆈಘ IF ḷᘇкDŽIDT ѝԫ࣑䰘᧿䘠ㅖⲴṬᔿо GDT ઼ LDT ѝԫ࣑䰘ⲴṬᔿ⴨਼DŽ ⨶ಘ֯⭘䘉њ䮯ᤷ䪸ᢺ〻ᒿᢗ㹼ᵳ䖜〫ࡠԓ⸱⇥ѝᔲᑨᡆѝᯝⲴ༴⨶䗷〻ѝDŽ䘉єњ⇥Ⲵѫ㾱४࡛൘Ҿ༴ ༴ˈ˅٬〫ٿമ 4-27 㔉ࠪҶ䘉й⿽䰘᧿䘠ㅖⲴṬᔿDŽѝᯝ䰘઼䲧䱡䰘ਜ਼ᴹањ䮯ᤷ䪸˄ণ⇥䘹ᤙㅖ઼ „ ԫ࣑䰘˄Task gate˅᧿䘠ㅖ „ 䲧䱡䰘˄Trap gate˅᧿䘠ㅖ „ ѝᯝ䰘˄Interrupt gate˅᧿䘠ㅖ IDT 㺘ѝਟԕᆈ᭮й⿽㊫රⲴ䰘᧿䘠ㅖ˖ 4.6.8 IDT ᨅ䘦ㅜ ᣔᙗᔲᑨDŽ؍ྲ᷌ѝᯝᡆᔲᑨੁ䟿ᕅ⭘Ⲵ᧿䘠ㅖ䎵䗷Ҷ IDT Ⲵ⭼䲀ˈ༴⨶ಘՊӗ⭏ања㡜 օ⢩ᵳ㓗кᢗ㹼DŽ ᰦⲴ᫽֌㌫㔏ࡍ࿻ॆԓ⸱ѝDŽSIDT ᤷԔ⭘Ҿᢺ IDTR ѝⲴสൠ൰઼䲀䮯޵ᇩ༽ࡦࡠ޵ᆈѝDŽ䈕ᤷԔਟ൘ԫ สൠ൰᫽֌ᮠ࣐䖭ࡠ IDTR ᇴᆈಘѝDŽ䈕ᤷԔӵ㜭⭡ᖃࡽ⢩ᵳ㓗 CPL ᱟ 0 Ⲵԓ⸱ᢗ㹼ˈ䙊ᑨ㻛⭘Ҿࡋᔪ IDT ᆈ IDTR ᇴᆈಘⲴ޵ᇩDŽLIDT ᤷԔᢺ൘޵ᆈѝⲴ䲀䮯٬઼؍ᤷԔ LIDT ઼ SIDT ᤷԔ࠶࡛⭘Ҿ࣐䖭઼ ഴ ѣᯣᨅ䘦ㅜ㺞 ,'7 ૂᇺᆎಞ ,'75  ᆇ㢲䗩⭼кԕᨀ儈༴⨶ಘⲴ䇯䰞᭸⦷DŽ䲀䮯٬ᱟԕᆇ㢲ѪঅսⲴ IDT 㺘Ⲵ䮯ᓖDŽ 㿱മ 4-26 ᡰ⽪DŽIDT 㺘สൠ൰ᓄ䈕ሩ喀൘ 8ˈ٬˅ᆈಘѝਜ਼ᴹ IDT 㺘 32 սⲴสൠ൰઼ 16 սⲴ䮯ᓖ˄䲀䮯  ѝᯝ઼ᔲᑨ༴⨶ 3⇥ᆈ൘ḷᘇ '3/᧿䘠ㅖ⢩ᵳ㓗   ⇥䘹ᤙㅖ   '3/    3          ԫ࣑䰘˄7DVN*DWH˅        䘹ᤙㅖ⇥  ٬〫ٿਓ⛩ޕ䗷〻   /3'   3  ٬〫ٿਓ⛩ޕ䗷〻          䲧䱡䰘˄7UDS*DWH˅        䘹ᤙㅖ⇥  ٬〫ٿਓ⛩ޕ䗷〻   /3'   3  ٬〫ٿਓ⛩ޕ䗷〻              ѝᯝ䰘˄,QWHUUXSW*DWH˅   ༴DŽ ᆇ⇥ᤷੁᔲᑨᡆѝᯝ༴⨶䗷〻Ⲵᔰ࿻〫ٿᤷੁ GDT ᡆᖃࡽ LDT ѝⲴਟᢗ㹼ԓ⸱⇥᧿䘠ㅖDŽ䰘᧿䘠ㅖѝⲴ ᔲᑨᡆѝᯝ䰘ᕅ⭘䘀㹼൘ᖃࡽԫ࣑кл᮷ѝⲴᔲᑨᡆѝᯝ༴⨶䗷〻ˈ㿱മ 4-28 ᡰ⽪DŽ䰘ѝⲴ⇥䘹ᤙㅖ 䰘ˈࡉ༴⨶ಘ֯⭘о CALL ᤷԔ᫽֌ԫ࣑䰘㊫լⲴᯩ⌅䘋㹼ԫ࣑࠷ᦒˈᢗ㹼ᔲᑨᡆѝᯝⲴ༴⨶ԫ࣑DŽ 䱡䰘ˈࡉ༴⨶ಘ֯⭘о CALL ᤷԔ᫽֌䈳⭘䰘㊫լⲴᯩ⌅䈳⭘ᔲᑨᡆѝᯝ༴⨶䗷〻DŽྲ᷌㍒ᕅ٬ᤷੁԫ࣑ ૽ᓄањᔲᑨᡆѝᯝᰦˈ༴⨶ಘ֯⭘ᔲᑨᡆѝᯝⲴੁ䟿֌Ѫ IDT 㺘ѝⲴ㍒ᕅDŽྲ᷌㍒ᕅ٬ᤷੁѝᯝ䰘ᡆ䲧 ༴⨶ಘሩᔲᑨ઼ѝᯝ༴⨶䗷〻Ⲵ䈳⭘᫽֌ᯩ⌅о֯⭘ CALL ᤷԔ䈳⭘〻ᒿ䗷〻઼ԫ࣑Ⲵᯩ⌅㊫լDŽᖃ 4.6.9 ᔸᑮфѣᯣ༺⨼ ഴ ѣᯣ䰞Ƚ䲭䱧䰞ૂԱࣗ䰞ᨅ䘦ㅜṲᕅ   ѝᯝ઼ᔲᑨ༴⨶ ⇥᧿䘠ㅖ 䰘᧿䘠ㅖ ⇥ส൰ ኎ᙗ ⇥䲀䮯 ⇥䲀䮯 ᧿䘠ㅖ㺘 *'7 ᡆ /'7 ༴⨶䗷〻 ᔲᑨᡆѝᯝ  ѝᯝ᧿䘠ㅖ㺘 ,'7 ԓ⸱⇥ ٬ѝᯝੁ䟿〫ٿ 䘹ᤙㅖ ኎ᙗ ᯠḸѝDŽޕ‹ ྲ᷌ᔲᑨՊӗ⭏ањ䭉䈟ਧˈ䛓Ѹ䈕䭉䈟ਧҏՊ㻛ᴰਾ঻ ᆈ൘ᖃࡽึḸкDŽ؍‹ ༴⨶ಘᢺ EFLAGSǃCS ઼ EIP ᇴᆈಘⲴᖃࡽ٬ „ ྲ᷌༴⨶䗷〻ሶ൘㻛ѝᯝԫ਼࣑ањ⢩ᵳ㓗к䘀㹼ˈ䛓Ѹ˖ ᯠḸѝDŽޕ‹ ྲ᷌ᔲᑨՊӗ⭏ањ䭉䈟ਧˈ䛓Ѹ䈕䭉䈟ਧҏՊ㻛ᴰਾ঻ ᯠḸѝDŽޕ‹ ᧕⵰༴⨶ಘՊᢺ EFLAGSǃCS ઼ EIP ᇴᆈಘⲴᖃࡽ٬ҏ঻ ᯠḸѝˈ㿱മ 4-29 ᡰ⽪DŽޕ 䪸˄ֻྲ tss.ss0ǃtss.esp0˅DŽ❦ਾ༴⨶ಘՊᢺ㻛ѝᯝ〻ᒿ˄ᡆԫ࣑˅ⲴḸ䘹ᤙㅖ઼Ḹᤷ䪸঻ ‹ ༴⨶ಘӾᖃࡽᢗ㹼ԫ࣑Ⲵ TSS ⇥ѝᗇࡠѝᯝᡆᔲᑨ༴⨶䗷〻֯⭘ⲴึḸⲴ⇥䘹ᤙㅖ઼Ḹᤷ „ ྲ᷌༴⨶䗷〻ሶ൘儈⢩ᵳ㓗˄ֻྲ 0 㓗˅кᢗ㹼ᰦቡՊਁ⭏ึḸ࠷ᦒ᫽֌DŽึḸ࠷ᦒ䗷〻ྲл˖ ᖃ༴⨶ಘᢗ㹼ᔲᑨᡆѝᯝ༴⨶䗷〻䈳⭘ᰦՊ䘋㹼ԕл᫽֌˖ ഴ ѣᯣ䗽ぁ䈹⭞   ѝᯝ઼ᔲᑨ༴⨶ ৏ 66 &6 ࠪ䭉⸱ (,3 ()/$*6 ৏ (63 ⢩ᵳ㓗ਁ⭏ਈॆᰦѝᯝ䗷〻֯⭘ᯠⲴึḸ 䖜〫ࡠ༴⨶䗷〻ѻਾ(63 (63䖜〫ࡠ༴⨶䗷〻ѻࡽ    㻛ѝᯝ〻ᒿⲴึḸ ⢩ᵳ㓗нਁ⭏ਈॆᰦѝᯝ䗷〻֯⭘ᖃࡽ㻛ѝᯝ〻ᒿⲴึḸ (63䖜〫ࡠ༴⨶䗷〻ѻਾ (63䖜〫ࡠ༴⨶䗷〻ѻࡽ &6 ࠪ䭉⸱ (,3 ()/$*6 㻛ѝᯝ〻ᒿⲴึḸ ѝᯝ༴⨶䗷〻ⲴึḸ 2. ᔲᑨᡆѝᯝ༴⨶䗷〻Ⲵḷᘇ֯⭘ᯩᔿ ᯝ〻ᒿᡆԫ࣑Ⲵᖃࡽ⢩ᵳ㓗 CPLDŽ „ ༴⨶䗷〻ਟԕ᭮൘ާᴹ⢩ᵳ㓗 0 Ⲵ䶎а㠤ԓ⸱⇥ѝDŽ䘉⿽༴⨶䗷〻ᙫᱟਟԕᢗ㹼Ⲵˈ㘼н㇑㻛ѝ ᣔਟ䀰ҶDŽ؍䰞䘉њᮠᦞ⇥DŽն䘉ṧаᶕቡ⋑ᴹ ༴⨶䗷〻˄ֻྲˈ䲔ࠪ䭉ᔲᑨ˅DŽྲ᷌༴⨶〻ᒿ䴰㾱ᮠᦞ⇥ѝⲴᮠᦞˈ䛓Ѹ⢩ᵳ㓗 3 ᗵ享㜭ཏ䇯 „ ᔲᑨᡆѝᯝ༴⨶〻ᒿਟԕᆈ᭮൘ања㠤ᙗԓ⸱⇥ѝDŽ䘉њᢰᵟਟԕ⭘Ҿਚ䴰䇯䰞ึḸкᮠᦞⲴ ᣔ˖؍ཏ䘀㹼Ⲵ⢩ᵳ㓗䲀ࡦDŽᡁԜਟԕ࡙⭘ԕлᢰᵟѻаᶕ䚯ݽ䘍৽⢩ᵳ㓗 ᵳ㓗Ⲵ㿴ࡉᴹ᭸ൠ໎ᕪҶᔲᑨ઼ѝᯝ༴⨶䗷〻㜭⢩ޣഐѪᔲᑨ઼ѝᯝ䙊ᑨнՊᇊᵏਁ⭏ˈഐ↔䘉Ӌᴹ 䱡䰘ѝⲴ DPLDŽ ᴤ儈⢩ᵳ㓗Ⲵԓ⸱⇥ѝDŽሩҾ⺜Ԧӗ⭏Ⲵѝᯝ઼༴⨶ಘỰ⍻ࡠⲴᔲᑨˈ༴⨶ಘՊᘭ⮕ѝᯝ䰘઼䲧 䇮䘉Ӌ༴⨶䗷〻ᐢ㻛ᆈ᭮൘ٷˈᒿ֯⭘䖟Ԧѝᯝ䇯䰞䟽㾱Ⲵᔲᑨ༴⨶䗷〻ˈֻྲ亥䭉䈟༴⨶䗷〻 䱡䰘ѝⲴ DPLDŽ↔ᰦ CPL ᗵ享ሿҾㅹҾ䰘Ⲵ DPLDŽ䘉њ䲀ࡦਟԕ䱢→䘀㹼൘⢩ᵳ㓗 3 Ⲵᓄ⭘〻 „ ਚᴹᖃањᔲᑨᡆѝᯝᱟ࡙⭘֯⭘ INT nǃINT 3 ᡆ INTO ᤷԔӗ⭏ᰦˈ༴⨶ಘ᡽ՊỰḕѝᯝᡆ䲧 „ ഐѪѝᯝ઼ᔲᑨੁ䟿⋑ᴹ RPLˈഐ↔൘䳀ᔿ䈳⭘ᔲᑨ઼ѝᯝ༴⨶䗷〻ᰦнՊỰḕ RPLDŽ ᵪࡦ൘ԕлᯩ䶒оа㡜䈳⭘䰘䗷〻н਼˖ ᣔ؍ᣔᙗᔲᑨDŽਖཆˈѝᯝ઼ᔲᑨⲴ؍∄ CPL ᴤվ⢩ᵳ㓗ԓ⸱⇥Ⲵѝᯝ༴⨶䗷〻ѝˈ੖ࡉሶӗ⭏ања㡜 ᣔᵪࡦо䙊䗷䈳⭘䰘䈳⭘Პ䙊䗷〻㊫լDŽ༴⨶ಘнݱ䇨ᢺ᧗ࡦ䖜〫ࡠ؍ᔲᑨ઼ѝᯝ༴⨶䗷〻Ⲵ⢩ᵳ㓗 ᣔ؍1. ᔲᑨ઼ѝᯝ༴⨶䗷〻Ⲵ എᰦ IRET ᤷԔՊ࠷ᦒഎࡠ৏ᶕⲴึḸDŽ ᒦфਚᴹᖃ CPL<=IOPL ᰦˈIF ḷᘇ᡽Պ㻛᭩ਈDŽ ྲ᷌ᖃ䈳⭘ѝᯝ༴⨶䗷〻ᰦਁ⭏ҶึḸ࠷ᦒˈ䛓Ѹ൘䘄 ᆈⲴᇴᆈಘ޵ᇩᚒ༽ࡠ EFLAGS ѝDŽн䗷ਚᴹᖃ CPL ᱟ 0 ᰦ᡽Պᚒ༽ EFLAGS ѝⲴ IOPL ᆇ⇥ˈ؍Պᢺ ѪҶӾѝᯝ༴⨶䗷〻ѝ䘄എˈ༴⨶䗷〻ᗵ享֯⭘ IRET ᤷԔDŽIRET ᤷԔо RET ᤷԔ㊫լˈն IRET 䘈 䖢〱ࡦѣᯣ༺⨼䗽ぁᰬ฼Ḿֵ⭞ᯯ⌋ ഴ   ѝᯝ઼ᔲᑨ༴⨶ 766 ⇥᧿䘠ㅖ ԫ࣑䰘 ⇥ส൰ ኎ᙗ ⇥䲀䮯 766 สൠ൰ ᧿䘠ㅖ㺘 *'7 ѝᯝ᧿䘠ㅖ㺘 ,'7 ѝᯝ༴⨶ԫ࣑Ⲵ 766 ⇥ 䘹ᤙㅖ ኎ᙗ ѝᯝੁ䟿 ഴ ѣᯣ༺⨼Աࣗ࠽ᦘ  ༴⨶ಘѝᯝᵪࡦⲴ⺜Ԧ䈳ᓖDŽ֯⭘䖟Ԧ䈳ᓖᯩ⌅ᰦ䴰㾱㘳㲁ࡠѝᯝᔰ੟ᰦ䟷⭘ѝᯝ༴⨶ԫ࣑DŽ ᖃᔲᑨᡆѝᯝਕᷴԫ࣑⭘Ҿ᫽֌㌫㔏ѝᰦˈᇎ䱵кᴹє⿽࠶⍮䈳ᓖԫ࣑Ⲵᵪࡦ˖᫽֌㌫㔏䖟Ԧ䈳ᓖ઼ ⭏ањࠪ䭉⸱ˈࡉ䈕ࠪ䭉⸱Պ㻛༽ࡦࡠᯠԫ࣑ึḸкDŽ ᆈ൘ਕᷴԫ࣑ TSS Ⲵࡽаԫ࣑䬮᧕ᆇ⇥ѝDŽྲ᷌ањᔲᑨՊӗ؍䗷〻⴨਼DŽࡠ㻛ѝᯝԫ࣑Ⲵ৽ੁ䬮᧕Պ㻛 IDT ѝⲴԫ࣑䰘Պᕅ⭘ GDT ѝⲴ TSS ᧿䘠ㅖˈമ 4-30 ᡰ⽪DŽ࠷ᦒࡠਕᷴԫ࣑Ⲵ䗷〻оᲞ䙊ԫ࣑࠷ᦒ ֯⭘ѝᯝ䰘Ⲵ૽ᓄ䙏ᓖ㾱ធˈሬ㠤ѝᯝᔦᰦ໎࣐DŽ ᆈˈ֯ᗇᆳ∄؍֯⭘⤜・ԫ࣑༴⨶ᔲᑨᡆѝᯝⲴн䏣ѻ༴ᱟ˖൘ԫ࣑࠷ᦒᰦᗵ享ሩབྷ䟿ᵪಘ⣦ᘱ䘋㹼 „ 䙊䗷֯⭘অ⤜Ⲵ LDT 㔉ѝᯝᡆᔲᑨ༴⨶ԫ࣑⤜・Ⲵൠ൰オ䰤ˈਟԕᢺᆳоަԆԫ࣑䳄⿫ᔰᶕDŽ 䙊䗷ԫ࣑䰘䇯䰞ѝᯝ༴⨶䗷〻㜭ཏ䱢→㌫㔏ፙ⒳˗ Ḹᐢ⇱ൿᰦྲ᷌ਁ⭏Ҷањᔲᑨᡆѝᯝˈ䛓Ѹ൘Ѫѝᯝ䗷〻ᨀ׋ањᯠ⢩ᵳ㓗 0 ⲴึḸᶑԦлˈ „ ൘༴⨶ᔲᑨᡆѝᯝᰦˈᯠⲴ TSS ਟԕݱ䇨༴⨶䗷〻֯⭘ᯠ⢩ᵳ㓗 0 ⲴึḸDŽ൘ᖃࡽ⢩ᵳ㓗 0 Ⲵึ ᆈ˗؍„ 㻛ѝᯝ〻ᒿᡆԫ࣑Ⲵᆼᮤкл᮷Պ㻛㠚ࣘ ѝᯝᴹྲлྭ༴˖ ᖃ䙊䗷 IDT ѝԫ࣑䰘ᶕ䇯䰞ᔲᑨᡆѝᯝ༴⨶䗷〻ᰦቡՊሬ㠤ԫ࣑࠷ᦒDŽ֯⭘অ⤜Ⲵԫ࣑ᶕ༴⨶ᔲᑨᡆ 4.6.10 ѣᯣ༺⨼Աࣗ Პ䙊ԫ࣑࠷ᦒаṧDŽ⭡ҾᵜҖ䇘䇪Ⲵ Linux ᫽֌㌫㔏⋑ᴹ֯⭘䘉⿽ѝᯝ༴⨶ᯩᔿˈഐ↔䘉䟼н޽䎈䘠DŽ ᢗ㹼ѝᯝᡆᔲᑨ༴⨶䗷〻DŽIDT 㺘ѝⲴԫ࣑䰘ᕅ⭘ GDT ѝⲴ TSS ᧿䘠ㅖDŽ࠷ᦒࡠ༴⨶䗷〻ԫ࣑Ⲵᯩ⌅о ᖃ䙊䗷 IDT 㺘ѝԫ࣑䰘䇯䰞ᔲᑨᡆѝᯝ༴⨶䗷〻ᰦˈቡՊሬ㠤ԫ࣑࠷ᦒDŽӾ㘼ਟԕ൘ању⭘ԫ࣑ѝ 3. ᢗ㹼ѝᯝ༴⨶䗷〻Ⲵԫ࣑ ᘇDŽ ᆈ൘ึḸкⲴ޵ᇩᚒ༽ EFLAGS ᇴᆈಘⲴ IF ḷᘇDŽ㘼䙊䗷䲧䱡䰘䇯䰞༴⨶䗷〻ᒦнՊᖡ૽ IF ḷ؍ࡉՊ⭘ ᔲᑨᡆѝᯝ༴⨶䗷〻ᰦˈ༴⨶ಘՊ༽ս IF ḷᘇԕ䱢→ަԆѝᯝᒢᢠᖃࡽѝᯝ༴⨶䗷〻DŽ䲿ਾⲴ IRET ᤷԔ ѝᯝ䰘о䲧䱡䰘ୟаⲴ४࡛൘Ҿ༴⨶ಘ᫽֌ EFLAGS ᇴᆈಘ IF ḷᘇⲴᯩ⌅DŽᖃ䙊䗷ѝᯝ䰘䇯䰞ањ Պ⭘ึḸкⲴ޵ᇩᚒ༽ EFLAGS Ⲵ৏ TF ḷᘇDŽ Ḹкѻਾ␵䲔 EFLAGS ѝⲴ TF ḷᘇDŽ␵䲔 TF ḷᘇਟԕ䱢→ᤷԔ䐏䑚ᖡ૽ѝᯝ૽ᓄDŽ㘼䲿ਾⲴ IRET ᤷԔ ᆈࡠึ؍ᖃ䙊䗷ѝᯝ䰘ᡆ䲧䱡䰘䇯䰞ањᔲᑨᡆѝᯝ༴⨶䗷〻ᰦˈ༴⨶ಘՊ൘ᢺ EFLAGS ᇴᆈಘ޵ᇩ  ѝᯝ઼ᔲᑨ༴⨶ 7 ' , ⇥䘹ᤙㅖ㍒ᕅ  , ⮉ 7؍    7 ; (     :  5 6  8 ⮉؍  3      ⌘᜿ˈ䭉䈟нՊ㻛 IRET ᤷԔ㠚ࣘൠᕩࠪึḸˈഐ↔ѝᯝ༴⨶〻ᒿ൘䘄എѻࡽᗵ享␵䲔ึḸкⲴ䭉䈟 ഴ 享䶘᭻䳒䭏䈥⸷Ṳᕅ  Ⲵ亥ⴞᖅ઼亥㺘亩DŽޣ֯⭘䘉њൠ൰ᶕᇊս⴨ ਖཆˈ༴⨶ಘ䘈Պᢺᕅ䎧亥䶒᭵䳌ᔲᑨᡰ䇯䰞⭘Ⲵ㓯ᙗൠ൰ᆈ᭮൘ CR2 ѝDŽ亥ࠪ䭉ᔲᑨ༴⨶〻ᒿਟԕ 㺘⽪ CPU ↓൘ᢗ㹼а㡜⭘ᡧԓ⸱DŽ „ ս 2˄U/S˅ˈਁ⭏ᔲᑨᰦ CPU ᢗ㹼Ⲵԓ⸱㓗࡛DŽU/S=0ˈ㺘⽪ CPU ↓൘ᢗ㹼䎵㓗⭘ᡧԓ⸱˗U/S=1ˈ ᫽֌ᕅ䎧DŽ „ ս 1˄W/R˅ˈᔲᑨᱟ⭡Ҿ޵ᆈ䈫ᡆ߉᫽֌ᕅ䎧DŽW/R=0ˈ㺘⽪⭡䈫᫽֌ᕅ䎧˗W/R=1ˈ㺘⽪⭡߉ ᣔᵳ䲀DŽ؍㓗 „ ս 0˄P˅ˈᔲᑨᱟ⭡Ҿ亥䶒нᆈ൘ᡆ䘍৽䇯䰞⢩ᵳ㘼ᕅਁDŽP=0ˈ㺘⽪亥нᆈ൘˗P=1 㺘⽪䘍৽亥 ᆳԜⲴ਽〠о亥㺘亩ѝⲴᴰਾйս⴨਼˄U/SǃW/RǃP˅DŽਜ਼ѹ઼֌⭘࠶࡛ᱟ˖ 亥᭵䳌˄Page-fault˅ᔲᑨⲴ䭉䈟⸱Ṭᔿок䶒Ⲵн਼ˈ㿱മ 4-32 ᡰ⽪DŽਚᴹᴰվ 3 њ∄⢩սᴹ⭘ˈ ᕅ⭘Ҷањオ⇥᧿䘠ㅖDŽ DŽオ䭉䈟⸱㺘⽪䭉䈟нᱟ⭡Ҿᕅ⭘Ḁњ⢩ᇊ⇥䙐ᡀˈᡆ㘵ᱟ൘᫽֌ѝ˅0 ޘߥл䭉䈟⸱ᱟオⲴ˄ণվ 16 ս ⇥䘹ᤙ㍒ᕅᆇ⇥ᨀ׋Ҷ䭉䈟⸱ᕅ⭘Ⲵ IDTǃGDT ᡆ㘵ᖃࡽ LDT ѝ⇥ᡆ䰘᧿䘠ㅖⲴ㍒ᕅ٬DŽ൘ḀӋᛵ ഴ 䭏䈥⸷Ṳᕅ  ᧿䘠ㅖDŽ ᕅ䜘࠶ᤷੁ LDT ѝⲴањ᧿䘠ㅖDŽᖃ TI=0 ᰦˈ䈤᰾䭉䈟⸱ѝⲴ㍒ᕅ䜘࠶ᤷੁ GDT 㺘ѝⲴањ „ ս 2 ᱟ GDT/LDT 㺘䘹ᤙḷᘇ TIDŽਚᴹᖃս 1 Ⲵ IDT=0 ᡽ᴹ⭘DŽᖃ䈕 TI=1 ᰦˈ㺘⽪䭉䈟⸱Ⲵ㍒ IDT ѝⲴањ䰘᧿䘠ㅖDŽᖃ䈕ս༽սᰦˈ㺘⽪㍒ᕅ䜘࠶ᤷੁ GDT ᡆ LDT ѝⲴањ⇥᧿䘠ㅖDŽ „ ս 1 ᱟ᧿䘠ㅖս㖞 IDT˄Descriptor location˅ḷᘇDŽᖃ䈕ս㖞սᰦˈ㺘⽪䭉䈟⸱Ⲵ㍒ᕅ䜘࠶ᤷੁ ֻྲ⺜ԦѝᯝDŽ „ ս 0 ᱟཆ䜘һԦ EXT˄External event˅ḷᘇDŽᖃ㖞սᰦˈ㺘⽪ᢗ㹼〻ᒿԕཆⲴһԦ䙐ᡀҶᔲᑨˈ ᔿ㿱മ 4-31 ᡰ⽪DŽ䭉䈟⸱ᖸ䊑ањ⇥䘹ᤙㅖˈնᱟᴰվ 3 ∄⢩нᱟ TI ઼ RPL ᆇ⇥ˈ㘼ᱟԕл 3 њḷᘇ˖ ᔲᑨ༴⨶䗷〻ⲴึḸкDŽࠪ䭉⸱ⲴṬޕᰦˈ༴⨶ಘՊᢺањ䭉䈟⸱঻ޣᖃᔲᑨᶑԦоањ⢩ᇊⲴ⇥⴨ 4.6.11 䭏䈥⸷  ѝᯝ઼ᔲᑨ༴⨶ &5 ԫ࣑ᇴᆈಘ ึḸ⇥  ⢩ᵳ㓗 ึḸ⇥  ⢩ᵳ㓗 ึḸ⇥  ⢩ᵳ㓗 ᖃࡽ⢩ᵳ㓗 ึḸ⇥ ᮠᦞ⇥ ԓ⸱⇥  766 ᇴᆈಘ ԫ࣑⣦ᘱ  ⭡༴⨶ಘѝⲴԕлᡰᴹ޵ᇩ㓴ᡀ˖ ֯⭘Ҷ࠶亥ᵪࡦˈ䛓Ѹԫ࣑֯⭘Ⲵ亥ⴞᖅ㺘สൠ൰ቡՊ㻛࣐䖭䘋᧗ࡦᇴᆈಘ CR3 ѝDŽᖃࡽᢗ㹼ԫ࣑Ⲵ⣦ᘱ ⇥䘹ᤙㅖǃสൠ൰ǃ⇥䲀䮯ԕ৺ TSS ⇥᧿䘠ㅖ኎ᙗቡՊ㻛࣐䖭䘋ԫ࣑ᇴᆈಘ TR˄Task Register˅ѝDŽྲ᷌ ањԫ࣑֯⭘ᤷੁަ TSS Ⲵ⇥䘹ᤙㅖᶕᤷᇊDŽ ᖃањԫ࣑㻛࣐䖭䘋༴⨶ಘѝᢗ㹼ᰦˈ䛓Ѹ䈕ԫ࣑Ⲵ ഴ ԱࣗⲺ㔉ᶺૂ⣬ᘷ  фѪԫ࣑⣦ᘱؑ᚟ᨀ׋ᆈۘオ䰤DŽ൘ཊԫ࣑⧟ຳѝˈTSS ҏѪԫ࣑ѻ䰤Ⲵ䬮᧕ᨀ׋Ҷ༴⨶ᯩ⌅DŽ ԫ࣑ᢗ㹼オ䰤ቡ䴰㾱Ѫ⇿њ⢩ᵳ㓗ᨀ׋ањ⤜・ⲴึḸオ䰤DŽTSS ᤷᇊҶᶴᡀԫ࣑ᢗ㹼オ䰤Ⲵ਴њ⇥ˈᒦ ᣔᵪࡦˈ䛓Ѹ؍⸱⇥ǃึḸ⇥઼ањᡆཊњᮠᦞ⇥ˈ㿱മ 4-33 ᡰ⽪DŽྲ᷌᫽֌㌫㔏֯⭘Ҷ༴⨶ಘⲴ⢩ᵳ㓗 ањԫ࣑⭡є䜘࠶ᶴᡀ˖ԫ࣑ᢗ㹼オ䰤઼ԫ࣑⣦ᘱ⇥ TSS˄Task-state segment˅DŽԫ࣑ᢗ㹼オ䰤वᤜԓ 4.7.1 ԱࣗⲺ㔉ᶺૂ⣬ᘷ ᆈ൘޵ᆈѝ〠Ѫԫ࣑⣦ᘱ⇥˄Task state segment˅Ⲵᮠᦞ㔃ᶴѝDŽ؍Ḹѝˈ༴⨶ಘⲴ⣦ᘱؑ᚟䜭㻛 ึޕDŽԫ࣑࠷ᦒнՊᢺԫօؑ᚟঻ޕवᤜḷᘇᇴᆈಘ EFLAGS ઼ᡰᴹ⇥ᇴᆈಘDŽо䗷〻н䗷ˈԫ࣑нਟ䟽 ᆈ༴⨶ಘѝࠐѾᡰᴹᇴᆈಘⲴᖃࡽ޵ᇩˈ؍≳ањᯠⲴᢗ㹼⧟ຳˈণᯠԫ࣑Ⲵᢗ㹼⧟ຳDŽ䘉⿽䖜〫᫽֌㾱 䖜〫ࡠޘᆈᴤཊⲴ༴⨶ಘ⣦ᘱؑ᚟DŽԫ࣑࠷ᦒՊᢺ᧗ࡦᵳᆼ؍ԫ࣑࠷ᦒᖸ䊑䗷〻䈳⭘ˈնԫ࣑࠷ᦒՊ ㅖᴹє㊫˖ԫ࣑⣦ᘱ⇥᧿䘠ㅖ઼ԫ࣑䰘DŽᖃᢗ㹼ᵳՐ㔉䘉ԫօа㊫᧿䘠ㅖᰦˈ䜭Պ䙐ᡀԫ࣑࠷ᦒDŽ Ⲵ᧿䘠ޣⲴ޵ᇩа䎧֯⭘ᰦˈ䛓Ѹ䘉њ᧿䘠ㅖᱟа㊫ሬ㠤ᯠԫ࣑ᔰ࿻ᢗ㹼Ⲵ᧿䘠ㅖDŽ᧿䘠ㅖ㺘ѝоԫ࣑⴨ 䗷ѝᯝǃᔲᑨǃ䐣䖜ᡆ䈳⭘ˈᡁԜਟԕᢗ㹼ањԫ࣑DŽᖃ䘉Ӌ᧗ࡦ䖜〫ᖒᔿѻа઼Ḁњ᧿䘠ㅖ㺘ѝᤷᇊ亩 80X86 ᨀ׋Ҷཊԫ࣑Ⲵ⺜Ԧ᭟ᤱDŽԫ࣑ᱟањ↓൘䘀㹼Ⲵ〻ᒿˈᡆ㘵ᱟањㅹᖵ߶༷䘀㹼Ⲵ〻ᒿDŽ䙊 ᴤѪ༽ᵲⲴ㌫㔏ਟԕ֯⭘༴⨶ಘⲴԫ࣑㇑⨶࣏㜭ᶕ᭟ᤱཊԫ࣑ᓄ⭘DŽ ᣔ⁑ᔿлˈ༴⨶ಘᡰᴹ䘀㹼䜭൘ԫ࣑ѝDŽণ֯ᱟㆰঅ㌫㔏ҏᗵ享䎧⸱ᇊѹањԫ࣑DŽ؍њԫ࣑DŽᖃᐕ֌൘ ᆈԫ࣑Ⲵ⣦ᘱǃ࠶⍮ԫ࣑ᢗ㹼ԕ৺Ӿањԫ࣑࠷ᦒࡠਖа؍ 80X86 ᨀ׋Ҷа⿽ᵪࡦˈ䘉⿽ᵪࡦਟ⭘ᶕ ᫽֌㌫㔏ᴽ࣑ǃѝᯝᡆᔲᑨ༴⨶䗷〻઼޵Ṩԓ⸱DŽ ԫ࣑˄Task˅ᱟ༴⨶ಘਟԕ࠶䝽䈳ᓖǃᢗ㹼઼ᤲ䎧Ⲵањᐕ֌অݳDŽᆳਟ⭘Ҿᢗ㹼〻ᒿǃԫ࣑ᡆ䘋〻ǃ 4.7 Աࣗ㇗⨼ ḸѝDŽึޕᯝᡆ㘵〻ᒿᢗ㹼 INT n ᤷԔӗ⭏ⲴᔲᑨᒦнՊᢺ䭉䈟⸱঻ ᆈࡠ༴⨶䗷〻ⲴึḸѝˈնᱟཆ䜘⺜Ԧѝ؍⸱DŽਖཆˈ㲭❦༴⨶ӗ⭏ⲴḀӋᔲᑨՊӗ⭏䭉䈟⸱ᒦՊ㠚ࣘൠ  ԫ࣑㇑⨶ മ 4-34 㔉ࠪҶ 32 ս CPU ֯⭘Ⲵ TSS ⲴṬᔿDŽTSS ⇥ѝ਴ᆇ⇥ਟ࠶ᡀєབྷ㊫˖ࣘᘱᆇ⇥઼䶉ᘱᆇ⇥DŽ ᆈ൘〠Ѫԫ࣑⣦ᘱ⇥ TSS˄Task state segment˅Ⲵ⇥ѝDŽ؍⭘Ҿᚒ༽ањԫ࣑ᢗ㹼Ⲵ༴⨶ಘ⣦ᘱؑ᚟㻛 4.7.3.1 Աࣗ⣬ᘷ⇫ ࣑䟽ᯠᢗ㹼DŽ ᆈ৏ԫ࣑Ⲵкл᮷ˈԕݱ䇨ԫ؍֯⭘䘉Ӌᮠᦞ㔃ᶴˈ༴⨶ಘਟԕӾањԫ࣑࠷ᦒࡠਖањԫ࣑ˈ਼ᰦ „ ḷᘇᇴᆈಘ EFLAGS ѝⲴ NT ḷᘇDŽ „ ԫ࣑䰘᧿䘠ㅖ˗ „ ԫ࣑ᇴᆈಘ TR˗ „ TSS ᧿䘠ㅖ˗ „ ԫ࣑⣦ᘱ⇥ TSS˗ ༴⨶ಘᇊѹҶалаӋ᭟ᤱཊԫ࣑Ⲵᇴᆈಘ઼ᮠᦞ㔃ᶴ˖ 4.7.3 Աࣗ㇗⨼ᮦᦤ㔉ᶺ њ䖟ԦᇊѹⲴԫ࣑൘ањ 80X86 փ㌫㔃ᶴⲴԫ࣑кл᮷ѝᢗ㹼DŽ ֯⭘༴⨶ಘⲴԫ࣑㇑⨶࣏㜭ᶕ༴⨶ཊԫ࣑ᓄ⭘ᱟԫ䘹ⲴDŽᡁԜҏਟԕ֯⭘䖟Ԧᶕᇎ⧠ཊԫ࣑ˈ֯ᗇ⇿ ᣔ᧚ᯭ㜭ཏ⭘ᶕ䳄㔍਴њԫ࣑ᒦф䱢→ᆳԜ⴨ӂᒢᢠDŽ؍㠚ᐡⲴа྇亥㺘DŽ䘉Ӌ ᴹн਼䙫䗁ࡠ⢙⨶ൠ൰Ⲵ᱐ሴDŽ਼ᰦˈ亥ⴞᖅᇴᆈಘ CR3 ҏՊ൘࠷ᦒᰦ㻛䟽ᯠ࣐䖭ˈഐ↔⇿њԫ࣑ਟԕᴹ ֌Ѫԫ࣑࠷ᦒ᫽֌Ⲵа䜘ԭˈ༴⨶ಘҏՊ࠷ᦒࡠਖањ LDTˈӾ㘼ݱ䇨⇿њԫ࣑ሩสҾ LDT Ⲵ⇥ާ ԕ༴⨶൘ѝᯝԫ࣑ᢗ㹼ᰦਁ⭏ⲴѝᯝDŽ ⨶ѝᯝᡆᔲᑨˈ㘼фҏՊ൘ѝᯝᡆᔲᑨ༴⨶ԫ࣑䘄എᰦ㠚ࣘൠ࠷ᦒഎ㻛ѝᯝⲴԫ࣑ѝ৫DŽ䘉⿽᫽֌ᯩᔿਟ ѝᯝᡆᔲᑨਟԕ䙊䗷࠷ᦒࡠањԫ࣑ᶕ䘋㹼༴⨶DŽ൘䘉⿽ᛵߥлˈ༴⨶ಘнӵ㜭ཏᢗ㹼ԫ࣑࠷ᦒᶕ༴ 䈳⭘Ⲵˈণԫ࣑н㜭䈳⭘ᡆ䐣䖜ࡠ㠚ᐡDŽ ᆈ൘㻛䈳⭘㘵 TSS ѝˈӾ㘼ᨀ׋Ҷањ䘄എ䈳⭘㘵Ⲵ䬮᧕DŽሩҾᡰᴹ 80X86 ༴⨶ಘˈԫ࣑ᱟнਟ䙂ᖂ؍ ྲ᷌ᖃࡽᢗ㹼ԫ࣑˄䈳⭘㘵˅䈳⭘Ҷ㻛䈳ᓖⲴᯠԫ࣑˄㻛䈳⭘㘵˅ˈ䛓Ѹ䈳⭘㘵Ⲵ TSS ⇥䘹ᤙㅖՊ㻛 㹼DŽ↔ਾᯠ䈳ᓖԫ࣑Ⲵкл᮷Պ㻛࣐䖭䘋༴⨶ಘѝˈᒦфӾ࣐䖭Ⲵ EIP ᤷੁⲴᤷԔ༴ᔰ࿻ᢗ㹼ᯠԫ࣑DŽ 䈕ԫ࣑ⲴᢗڌᆈࡠᆳⲴ TSS ѝᒦфᲲ؍ᵏ䰤ˈᖃࡽ䘀㹼ԫ࣑Ⲵᢗ㹼⧟ຳ˄〠Ѫԫ࣑Ⲵ⣦ᘱᡆкл᮷˅Պ㻛 ᖃ䈳ᓖањԫ࣑ᢗ㹼ᰦˈᖃࡽ↓൘䘀㹼ԫ઼࣑䈳ᓖԫ࣑ѻ䰤Պ㠚ࣘൠਁ⭏ԫ࣑࠷ᦒ᫽֌DŽ൘ԫ࣑࠷ᦒ њԫ࣑䰘ˈᒦфަѝਜ਼ᴹѝᯝᡆᔲᑨ༴⨶ԫ࣑Ⲵ TSS 䘹ᤙㅖDŽ TSS 䘹ᤙㅖⲴԫ࣑䰘DŽᖃ䈳ᓖањԫ࣑ᶕ༴⨶ањѝᯝᡆᔲᑨᰦˈ䛓Ѹ IDT ѝ䈕ѝᯝᡆᔲᑨ㺘亩ᗵ享ᱟа ⭘ CALL ᡆ JMP ᤷԔ䈳ᓖањԫ࣑ᰦˈᤷԔѝⲴ䘹ᤙㅖᰒਟԕⴤ᧕䘹ᤙԫ࣑Ⲵ TSSˈҏਟԕ䘹ᤙᆈ᭮ᴹ ᡰᴹ䘉Ӌ䈳ᓖԫ࣑ᢗ㹼Ⲵᯩ⌅䜭Պ֯⭘ањᤷੁԫ࣑䰘ᡆԫ࣑ TSS ⇥Ⲵ䘹ᤙㅖᶕ⺞ᇊањԫ࣑DŽᖃ֯ „ 䳀ਜ਼ൠ䈳⭘ањᔲᑨਕᷴ༴⨶ԫ࣑˗ „ ˄⭡༴⨶ಘ˅䳀ਜ਼ൠ䈳⭘ањѝᯝਕᷴ༴⨶ԫ࣑˗ „ ֯⭘ JMP ᤷԔ᰾⺞ൠ䐣䖜ࡠањԫ࣑˄Linux ޵Ṩ֯⭘Ⲵᯩᔿ˅˗ „ ֯⭘ CALL ᤷԔ᰾⺞ൠ䈳⭘ањԫ࣑˗ 䖟Ԧᡆ༴⨶ಘਟԕ֯⭘ԕлᯩ⌅ѻаᶕ䈳ᓖᢗ㹼ањԫ࣑˖ 4.7.2 ԱࣗⲺᢝ㺂 „ 䬮᧕㠣ࡽањԫ࣑Ⲵ䬮ᤷ䪸˄൘ TSS ѝ˅DŽ „ ⢩ᵳ㓗 0ǃ1 ઼ 2 ⲴึḸᤷ䪸˄൘ TSS ѝ˅˗ „ I/O ᱐ሴսമสൠ൰઼ I/O սമؑ᚟˄൘ TSS ѝ˅˗ „ ⇥ᇴᆈಘᤷᇊⲴԫ࣑ᖃࡽᢗ㹼オ䰤˗ „ ḷᘇᇴᆈಘ EFLAGSǃ〻ᒿᤷ䪸 EIPǃ᧗ࡦᇴᆈಘ CR3ǃԫ࣑ᇴᆈಘ઼ LDTR ᇴᆈಘ˗ „ ᡰᴹ䙊⭘ᇴᆈಘ઼⇥ᇴᆈಘؑ᚟˗  ԫ࣑㇑⨶ ⮉սˈ䇮㖞Ѫ DŽ؍  ˅ࡽаԫ࣑䬮᧕˄766 䘹ᤙㅖ (63 66 (63 66 (63 66  3'%5 亥ⴞᖅสൠ൰ᇴᆈಘ &5 (,3 ()/$*6 ($; (&; ('; (%; (63 (%3 (6, (', (6 &6 66 '6 )6 *6 /'7 ⇥䘹ᤙㅖ սമสൠ൰ 7 2,    ] ] ] &] ] ] ] &] ] ] ] &] ] ] ] &] ] ] ] &] ] ] ] &] ] ] ٿ„ ⢩ᵳ㓗 0ǃ1 ઼ 2 ⲴึḸᤷ䪸ᆇ⇥DŽ䘉ӋึḸᤷ䪸⭡ึḸ⇥䘹ᤙㅖ˄SS0ǃSS1 ઼ SS2˅઼Ḹѝ ᖅสൠ൰ᇴᆈಘ PDBR˄Page directory base register˅DŽ „ CR3 ᧗ࡦᇴᆈಘᆇ⇥DŽਜ਼ᴹԫ࣑֯⭘Ⲵ亥ⴞᖅ⢙⨶สൠ൰DŽ᧗ࡦᇴᆈಘ CR3 䙊ᑨҏ㻛〠Ѫ亥ⴞ „ LDT ⇥䘹ᤙㅖᆇ⇥DŽਜ਼ᴹԫ࣑Ⲵ LDT ⇥Ⲵ䘹ᤙㅖDŽ 㖞ⲴDŽ䘉Ӌᆇ⇥ᴹ˖ 2. 䶉ᘱᆇ⇥DŽ༴⨶ಘՊ䈫ਆ䶉ᘱᆇ⇥Ⲵ޵ᇩˈն䙊ᑨнՊ᭩ਈᆳԜDŽ䘉Ӌᆇ⇥޵ᇩᱟ൘ԫ࣑㻛ࡋᔪᰦ䇮 䈕ᆇ⇥˄䙊ᑨҏ〠Ѫਾ䘎᧕ᆇ⇥˄Back link field˅˅ݱ䇨ԫ࣑֯⭘ IRET ᤷԔ࠷ᦒࡠࡽањԫ࣑DŽ „ ݸࡽԫ࣑䘎᧕ᆇ⇥DŽਜ਼ᴹࡽањԫ࣑ TSS ⇥䘹ᤙㅖ˄൘䈳⭘ǃѝᯝᡆᔲᑨ◰ਁⲴԫ࣑࠷ᦒᰦᴤᯠ˅DŽ ᆈ EIP ᇴᆈಘ޵ᇩDŽ؍„ ᤷԔᤷ䪸 EIP ᆇ⇥DŽ൘࠷ᦒѻࡽ ᆈ EFLAGSDŽ؍„ ḷᘇᇴᆈಘ EFLAGS ᆇ⇥DŽ൘࠷ᦒѻࡽ ᆈ ESǃCSǃSSǃDSǃFS ઼ GS ⇥ᇴᆈಘⲴ޵ᇩDŽ؍„ ⇥䘹ᤙㅖᆇ⇥DŽ⭘Ҿ ᆈ EAXǃECXǃEDXǃEBXǃESPǃEBPǃESI ઼ EDI ᇴᆈಘⲴ޵ᇩDŽ؍„ 䙊⭘ᇴᆈಘᆇ⇥DŽ⭘Ҿ 1. ࣘᘱᆇ⇥DŽᖃԫ࣑࠷ᦒ㘼㻛ᤲ䎧ᰦˈ༴⨶ಘՊᴤᯠࣘᘱᆇ⇥Ⲵ޵ᇩDŽ䘉Ӌᆇ⇥वᤜ˖ ഴ  փԱࣗ⣬ᘷ⇫ 766 Ṳᕅ   ԫ࣑㇑⨶   %  %DVH$GGUHVV สൠ൰ 6HJPHQW/LPLW ⇥䲀䮯  '3/   ⇥䲀䮯 / 9 $  3  *   7<3( %DVH สൠ൰ %DVH สൠ൰              㿱䜘࠶ᶕ㕃ߢ TSS ⇥᧿䘠ㅖ޵ᇩDŽ 㿱䜘࠶˅DŽ䘉Ӌؑ᚟ᱟӾ GDT ѝᖃࡽԫ࣑Ⲵ TSS ᧿䘠ㅖѝ༽ࡦ䗷ᶕⲴDŽ༴⨶ಘ֯⭘ԫ࣑ᇴᆈಘ TR Ⲵнਟ ԫ࣑ᇴᆈಘ TR˄Task Register˅ѝᆈ᭮⵰ 16 սⲴ⇥䘹ᤙㅖԕ৺ᖃࡽԫ࣑ TSS ⇥Ⲵᮤњ᧿䘠ㅖ˄нਟ 4.7.3.3 Աࣗᇺᆎಞ ሶሬ㠤ањᔲᑨDŽԱമ֯⭘ TI ḷᘇ㖞սⲴ䘹ᤙㅖ˄ণᖃࡽ LDT ѝⲴ䘹ᤙㅖ˅ᶕ䇯䰞 TSS ⇥ҏሶሬ㠤ᔲᑨDŽ ԕ֯⭘᱐ሴࡠ޵ᆈ⴨਼ս㖞Ⲵᮠᦞ⇥᧿䘠ㅖ˄ণ࡛਽᧿䘠ㅖ˅ᶕ᫽֌DŽᢺ TSS ᧿䘠ㅖ࣐䖭䘋ԫօ⇥ᇴᆈಘ ਟ䇯䰞ањ TSS ⇥᧿䘠ㅖᒦ⋑ᴹ㔉〻ᒿ䈫߉䈕᧿䘠ㅖⲴ㜭࣋DŽ㤕ᜣ䈫ᡆ؞᭩ањ TSS ⇥᧿䘠ㅖˈਟ DPL ਟԕ䇮㖞ᡀ 3ˈԕ֯ᗇ൘⭘ᡧ⢩ᵳ㓗кҏ㜭䘋㹼ԫ࣑࠷ᦒ᫽֌DŽ 䇮㖞ᡀሿҾ 3DŽ䘉ṧˈਚᴹާᴹ⢩ᵳ㓗Ⲵ䖟Ԧਟԕᢗ㹼ԫ࣑࠷ᦒ᫽֌DŽ❦㘼൘ཊԫ࣑ᓄ⭘ѝˈḀӋ TSS Ⲵ ٬ᓄ䈕⇥Ⲵ〻ᒿަ CPL ᮠ٬ᗵ享ሿҾᡆㅹҾ TSS ᧿䘠ㅖⲴ DPLDŽ൘བྷཊᮠ㌫㔏ѝˈTSS ᧿䘠ㅖⲴ DPL ᆇ ֯⭘䈳⭘ᡆ䐣䖜ᤷԔˈԫօਟԕ䇯䰞 TSS ᧿䘠ㅖⲴ〻ᒿ䜭㜭ཏ䙐ᡀԫ࣑࠷ᦒDŽਟԕ䇯䰞 TSS ᧿䘠ㅖ ⇥ѝᆈ᭮ަԆаӋؑ᚟ˈ䛓Ѹ TSS ⇥ቡ䴰㾱ᴤབྷⲴ䮯ᓖDŽ 㢲DŽྲ᷌ TSS ⇥ѝ䘈वਜ਼ I/O 䇨ਟսമˈ䛓Ѹ TSS ⇥䮯ᓖ䴰㾱བྷаӋDŽਖཆˈྲ᷌᫽֌㌫㔏䘈ᜣ൘ TSS ণ TSS ⇥Ⲵᴰሿ䮯ᓖнᗇሿҾ 104 ᆇˈ࣏㜭DŽᖃ G=0 ᰦˈ䲀䮯ᆇ⇥ᗵ享ާᴹㅹҾᡆབྷҾ 103˄0x67˅Ⲵ٬ ަѝสൠ൰ǃ⇥䲀䮯ǃ᧿䘠ㅖ⢩ᵳ㓗 DPLǃ仇㋂ᓖ G ઼ᆈ൘սާᴹоᮠᦞ⇥᧿䘠ㅖѝ⴨ᓄᆇ⇥਼ṧⲴ Ⲵ䈳⭘DŽ ⇥㺘⽪ԫ࣑↓ᘉDŽԫ࣑ᱟнਟԕ䙂ᖂᢗ㹼Ⲵˈഐ↔༴⨶ಘ֯⭘ᘉḷᘇ B ᶕỰ⍻ԫօԱമሩ㻛ѝᯝᢗ㹼ԫ࣑ ㅹᖵᢗ㹼˄㻛ᤲ䎧˅Ⲵԫ࣑DŽ٬Ѫ 0b1001 Ⲵ㊫රᆇ⇥㺘᰾ԫ࣑༴Ҿ䶎⍫ࣘ⣦ᘱ˗㘼٬Ѫ 0b1011 Ⲵ㊫රᆇ ㊫රᆇ⇥ TYPE ѝⲴᘉḷᘇ B ⭘Ҿᤷ᰾ԫ࣑ᱟ੖༴Ҿᘉ⣦ᘱDŽᘉ⣦ᘱⲴԫ࣑ᱟᖃࡽ↓൘ᢗ㹼Ⲵԫ࣑ᡆ ഴ 766 ⇫ᨅ䘦ㅜṲᕅ  ᧿䘠ㅖਚ㜭ᆈ᭮൘ GDT ѝDŽ оަԆ⇥аṧˈԫ࣑⣦ᘱ⇥ TSS ҏᱟ֯⭘⇥᧿䘠ㅖᶕᇊѹDŽമ 4-35 㔉ࠪҶ TSS ᧿䘠ㅖⲴṬᔿDŽTSS 4.7.3.2 TSS ᨅ䘦ㅜ 䈕ᱟਟ䈫߉ⲴDŽ Ⲵ亥䶒ˈԕ৺ሩᓄⲴ᧿䘠ㅖ㺘㺘亩ᓄޣਖཆˈྲ᷌֯⭘Ҷ࠶亥ᵪࡦˈ䛓Ѹо৏ԫ࣑ TSS ઼ᯠԫ࣑ TSS ⴨ ᆈ亥䗩⭼DŽྲ᷌ TSS 䘉䜘࠶वਜ਼޵ᆈ亥䗩⭼ˈ䛓Ѹ䈕䗩⭼༴є䗩Ⲵ亥䶒䜭ᗵ享਼ᰦᒦф䘎㔝ᆈ൘Ҿ޵ᆈѝDŽ ྲ᷌֯⭘Ҷ࠶亥ᵪࡦˈ䛓Ѹ൘ԫ࣑࠷ᦒᵏ䰤ᓄ䈕䚯ݽ༴⨶ಘ᫽֌Ⲵ TSS ⇥ѝ˄ࡽ 104 ᆇ㢲ѝ˅ਜ਼ᴹ޵ ٬DŽ〫ٿ„ I/O սമสൠ൰ᆇ⇥DŽ䈕ᆇ⇥ਜ਼ᴹӾ TSS ⇥ᔰ࿻༴ࡠ I/O 䇨ਟսമ༴Ⲵ 16 ս ࠷ᦒࡠ䈕ԫ࣑Ⲵ᫽֌ሶӗ⭏ањ䈳䈅ᔲᑨDŽ „ 䈳䈅䲧䱡˄Debug Trap˅T ḷᘇᆇ⇥DŽ䈕ᆇ⇥սҾᆇ㢲 0x64 ∄⢩ 0 ༴DŽᖃ䇮㖞Ҷ䈕սᰦˈ༴⨶ಘ ഐ↔ˈྲ᷌ԫ࣑ѝਁ⭏ึḸ࠷ᦒˈᇴᆈಘ SS ઼ ESP Ⲵ޵ᇩሶՊ᭩ਈDŽ 〫䟿ᤷ䪸˄ESP0ǃESP1 ઼ ESP2˅㓴ᡀDŽ⌘᜿ˈሩҾᤷᇊⲴањԫ࣑ˈ䘉Ӌᆇ⇥Ⲵ٬ᱟнਈⲴDŽ  ԫ࣑㇑⨶ ԫ࣑ᇴᆈಘ 75 䰘䘹ᤙㅖ 䰘䘹ᤙㅖ ѝᯝੁ䟿 ԫ࣑ 766 ⇥ 766 ᧿䘠ㅖ ԫ࣑䰘 ԫ࣑䰘 ԫ࣑䰘 ተ䜘㺘᧿䘠ㅖ /'7 ѝᯝ᧿䘠ㅖ㺘 ,'7 ተ᧿䘠ㅖ㺘 *'7ޘ ѝᯝᴽ࣑䗷〻ᙫᱟᢺᢗ㹼ᵳ䘄എࡠ㻛ѝᯝⲴ䗷〻ѝˈ㻛ѝᯝⲴ䗷〻ਟ㜭൘ਖањԫ࣑ѝDŽྲ᷌ NT ḷ ㍒ᕅⲴᱟ IDT ѝⲴањѝᯝᡆ䲧䱡䰘ˈࡉнՊ䙐ᡀԫ࣑࠷ᦒDŽ ᖃѝᯝᡆᔲᑨⲴੁ䟿㍒ᕅⲴᱟ IDT ѝⲴањԫ࣑䰘ᰦˈањѝᯝᡆᔲᑨቡՊ䙐ᡀԫ࣑࠷ᦒDŽྲ᷌ੁ䟿 Ⲵ֌⭘⴨਼ˈ䜭Պሬ㠤༴⨶ಘᢺ᧗ࡦ䖜〫ࡠᤷᇊⲴԫ࣑ѝˈ㿱മ 4-37 ᡰ⽪DŽ ѪҶ䘋㹼ԫ࣑࠷ᦒˈJMP ᡆ CALL ᤷԔ㜭ཏᢺ᧗ࡦ䖜〫ࡠ TSS ᧿䘠ㅖᡆԫ࣑䰘кDŽ֯⭘䘉є⿽ᯩᔿ ⺞ᇊҶᱟ੖Պਁ⭏ԫ࣑࠷ᦒDŽ ሩҾ TSS ᧿䘠ㅖᡆԫ࣑䰘Ⲵᕅ⭘˄ᖃ䈳⭘ᡆ䐣䖜ࡠањԫ࣑˅ˈᡆ㘵 NT ḷᘇⲴ⣦ᘱ˄ᖃᢗ㹼 IRET ᤷԔᰦ˅ JMPǃCALL ઼ IRET ᤷԔԕ৺ѝᯝ઼ᔲᑨ䜭ᱟ༴⨶ಘⲴᲞ䙊ᵪࡦˈਟ⭘Ҿнਁ⭏ԫ࣑࠷ᦒⲴ⧟ຳѝDŽ 4. ᖃ EFLAGS ѝⲴ NT ḷᘇ㖞սᰦᖃࡽԫ࣑ᢗ㹼 IRET ᤷԔDŽ 3. ѝᯝᡆᔲᑨੁ䟿ᤷੁ IDT 㺘ѝⲴԫ࣑䰘᧿䘠ㅖ˗ 2. ᖃࡽԫ࣑ሩ GDT ᡆ LDT ѝⲴԫ࣑䰘᧿䘠ㅖᢗ㹼 JMP ᡆ CALL ᤷԔ˗ 1. ᖃࡽԫ࣑ሩ GDT ѝⲴ TSS ᧿䘠ㅖᢗ㹼 JMP ᡆ CALL ᤷԔ˗ ༴⨶ಘਟ֯⭘ал 4 ⿽ᯩᔿѻаᢗ㹼ԫ࣑࠷ᦒ᫽֌˖ 4.7.4 Աࣗ࠽ᦘ ഴ ᕋ⭞ੂжԱࣗⲺԱࣗ䰞  ѝⲴԫ࣑䰘ྲօ䜭ᤷੁ਼ањԫ࣑DŽ 〻ᒿਟԕ䙊䗷ԫ࣑䰘᧿䘠ㅖᡆ㘵 TSS ⇥᧿䘠ㅖᶕ䇯䰞ањԫ࣑DŽമ 4-36 ⽪ࠪҶ LDTǃGDT ઼ IDT 㺘 䈧⌘᜿ˈᖃ֯⭘ԫ࣑䰘ᰦˈⴞḷ TSS ⇥᧿䘠ㅖⲴ DPL ᘭ⮕н⭘DŽ ٬ᗵ享ሿҾᡆㅹҾԫ࣑䰘᧿䘠ㅖѝⲴ DPLDŽ ࡠањԫ࣑ᰦˈ〻ᒿⲴ CPL ԕ৺ᤷੁԫ࣑䰘Ⲵ䰘䘹ᤙㅖⲴ RPL ฏн⭘DŽԫ࣑䰘᧿䘠ㅖѝⲴ DPL ⭘Ҿ൘ԫ࣑࠷ᦒᰦ᧗ࡦሩ TSS ⇥Ⲵ䇯䰞DŽᖃ〻ᒿ䙊䗷ԫ࣑䰘䈳⭘ᡆ䐣䖜 ԫ࣑䰘᧿䘠ㅖѝⲴ TSS 䘹ᤙㅖᆇ⇥ᤷੁ GDT ѝⲴањ TSS ⇥᧿䘠ㅖDŽ䘉њ TSS 䘹ᤙㅖᆇ⇥ѝⲴ RPL 䰘᧿䘠ㅖਟԕ㻛ᆈ᭮൘ GDTǃLDT ᡆ IDT 㺘ѝDŽ ᣔൠⲴᕅ⭘ˈަṬᔿ㿱മᡰ⽪DŽԫ࣑؍ԫ࣑䰘᧿䘠ㅖ˄Task gate descriptor˅ᨀ׋ሩањԫ࣑䰤᧕ǃਇ 4.7.3.4 Աࣗ䰞ᨅ䘦ㅜ 䘹ᤙㅖ˅ˈ䲿ਾ൘㌫㔏䘀㹼ᵏ䰤ˈTR Ⲵ޵ᇩՊ൘ԫ࣑࠷ᦒᰦ㠚ࣘൠ㻛᭩ਈDŽ ԫ࣑ 0 Ⲵ TSS ⇥ˈྲֻ˄⢩ᵳ㓗 0 Ⲵ〻ᒿᢗ㹼DŽLTR ᤷԔ䙊ᑨ⭘Ҿ㌫㔏ࡍ࿻ॆᵏ䰤㔉 TR ᇴᆈಘ࣐䖭ࡍ٬ ᆈԫ࣑ᇴᆈಘⲴਟ㿱䜘࠶ˈণ TSS ⇥Ⲵ䘹ᤙㅖDŽLTR ᤷԔਚ㜭㻛؍ᤷԔ LTR ઼ STR ࠶࡛⭘Ҿ࣐䖭઼  ԫ࣑㇑⨶ 䮯䐣䖜㠣 766 ⇥䘹ᤙㅖ䙐ᡀ &38 ᢗ㹼ԫ࣑࠷ᦒ᫽֌ 75 ᰐ⭘ˈᘭ⮕ ٬OMPS 䘹ᤙㅖ〫ٿ ս /'75 66 *6 )6 (6 '6 &6 ()/$*6 (,3 (63 (%3 (', (6, ('; (&; (%; ($;    ᯠ 766 ᧿䘠ㅖ ৏ 766 ᧿䘠ㅖ &5 ᯠ WVV *'7 㺘 &38৏ WVV ൰ˈᒦфᢺалᇴᆈಘ޵ᇩ༽ࡦࡠᖃࡽ TSS ѝ˖ᡰᴹ䙊⭘ᇴᆈಘǃ⇥ᇴᆈಘѝⲴ⇥䘹ᤙㅖǃḷᘇ ᆈࡠᖃࡽԫ࣑Ⲵ TSS ѝDŽ༴⨶ಘՊӾԫ࣑ᇴᆈಘѝਆᗇᖃࡽԫ࣑ TSS Ⲵสൠ؍6. ᢺᖃࡽԫ࣑Ⲵ⣦ᘱ ࣑࠷ᦒ⭡ CALLǃJMP ᤷԔᡆ㘵ᔲᑨᡆѝᯝӗ⭏ˈࡉн⭘᭩ࣘк䘠 NT ḷᘇDŽ ѝⲴ NT ḷᘇ༽ս˗ྲ᷌ԫۿᆈⲴ EFLAGS ᱐؍5. ྲ᷌ԫ࣑࠷ᦒ⭡ IRET ӗ⭏ˈࡉ༴⨶ಘՊᢺѤᰦ ᘇ B ༽ս˗ྲ᷌ԫ࣑࠷ᦒᱟ⭡ CALL ᤷԔǃᔲᑨᡆѝᯝӗ⭏ˈࡉᘉḷᘇ B нࣘDŽ 4. ྲ᷌ԫ࣑࠷ᦒӗ⭏㠚 JMP ᡆ IRET ᤷԔˈ༴⨶ಘቡՊᢺᖃࡽԫ࣑˄㘱ԫ࣑˅TSS ᧿䘠ㅖѝⲴᘉḷ 䘿᰾ⲴDŽޘ༴⨶ሩᓄ⭘〻ᒿᶕ䈤ᱟᆼޕԫ࣑DŽᔲᑨ༴⨶䗷〻Ⲵӻ ੁࠪ䭉ᤷԔˈ㘼䶎ࠪ䭉ᤷԔ䲿ਾⲴаᶑᤷԔDŽഐ↔ᔲᑨ༴⨶䗷〻ਟԕ༴⨶ࠪ䭉ᶑԦᒦф䟽ᯠᢗ㹼 㹼Պӗ⭏䭉䈟ⲴᤷԔᰦˈ䜭Պᚒ༽ሩ༴⨶ಘ⣦ᘱⲴԫօ᭩ਈDŽ䘉֯ᗇᔲᑨ༴⨶䗷〻Ⲵ䘄എൠ൰ᤷ 3. Ựḕᯠԫ࣑Ⲵ TSS ᧿䘠ㅖᱟḷ⌘Ѫᆈ൘Ⲵ˄P=1˅ˈᒦф TSS ⇥䮯ᓖᴹ᭸˄བྷҾ 0x67˅DŽᖃ䈅മᢗ Ⲵѝᯝ˅઼ IRET ᤷԔ䜭ݱ䇨ᢗ㹼ԫ࣑࠷ᦒDŽሩҾ INT n ᤷԔӗ⭏ⲴѝᯝሶỰḕ DPLDŽ ᔲᑨǃѝᯝ˄䲔Ҷ֯⭘ INT n ᤷԔӗ⭏ˈԫ࣑䰘DŽᰐ䇪ⴞḷԫ࣑䰘ᡆ TSS ⇥᧿䘠ㅖⲴ DPL ᱟօ٬ ԫ࣑Ⲵ CPL ઼ᯠԫ࣑⇥䘹ᤙㅖⲴ RPL ᗵ享ሿҾᡆㅹҾ TSS ⇥᧿䘠ㅖⲴ DPLˈᡆ㘵ᕅ⭘Ⲵᱟањ 2. Ựḕᖃࡽԫ࣑ᱟ੖ݱ䇨࠷ᦒࡠᯠԫ࣑DŽᢺᮠᦞ䇯䰞⢩ᵳ㓗㿴ࡉᓄ⭘ࡠ JMP ઼ CALL ᤷԔкDŽᖃࡽ Ҿ⭡ IRET ᕅ䎧Ⲵԫ࣑࠷ᦒ˅ѝਆᗇᯠԫ࣑Ⲵ TSS ⇥䘹ᤙㅖDŽ 1. Ӿ֌Ѫ JMP ᡆ CALL ᤷԔ᫽֌ᮠѝˈᡆ㘵Ӿԫ࣑䰘ѝˈᡆ㘵Ӿᖃࡽ TSS Ⲵࡽаԫ࣑䬮᧕ᆇ⇥˄ሩ ᖃ࠷ᦒࡠањᯠԫ࣑ᰦˈ༴⨶ಘՊᢗ㹼ал᫽֌˖ ഴ Աࣗ࠽ᦘᬃ֒⽰ᝅഴ  Ⲵᯠԫ࣑⭡ѝᯝᴽ࣑䗷〻 TSS ѝⲴ TSS 䘹ᤙㅖ˄ࡽаԫ࣑䬮᧕ᆇ⇥˅ᤷᇊDŽ ᘇ༴Ҿ༽ս⣦ᘱˈࡉᢗ㹼а㡜䘄എ༴⨶DŽྲ᷌ NT ḷᘇᱟ㖞ս⣦ᘱˈࡉ䘄എ᫽֌Պӗ⭏ԫ࣑࠷ᦒDŽ࠷ᦒࡠ  ԫ࣑㇑⨶ ԫ࣑ᇴᆈಘ 75  17 ()/$*6 ࡽԫ࣑䬮  17   ᴤ␡፼྇ԫ࣑ 766 ⇥ ࡽԫ࣑䬮  17   ፼྇Ⲵԫ࣑ 766 ⇥ ࡽԫ࣑䬮  17   亦ቲԫ࣑ 766 ⇥ ᖃࡽᢗ㹼ԫ࣑ 㺘 4-10 ᙫ㔃Ҷԫ࣑࠷ᦒᵏ䰤ˈᘉḷᘇ B˄൘ TSS ⇥᧿䘠ㅖѝ˅ǃNT ḷᘇǃࡽаԫ࣑䬮᧕ᆇ⇥઼ TS ḷ ᒦфн֯⭘ࡽаԫ࣑䬮᧕ᆇ⇥DŽJMP ᤷԔ⭘Ҿнᐼᵋࠪ⧠፼྇Ⲵԫ࣑࠷ᦒѝDŽ ⌘᜿ˈᖃԫ࣑࠷ᦒᱟ⭡ JMP ᤷԔ䙐ᡀˈ䛓Ѹᯠԫ࣑ቡнՊᱟ፼྇ⲴDŽҏণˈNT ḷᘇՊ㻛䇮㖞Ѫ 0ˈ ᢗ㹼DŽ ḷᘇ䘄എࡠࡽањԫ࣑DŽҏণྲ᷌ NT ḷᘇᱟ㖞սⲴ䈍ˈ༴⨶ಘՊ࠷ᦒࡠࡽаԫ࣑䬮᧕ᆇ⇥ᤷᇊⲴԫ࣑৫ NT ᆈⲴ TSS ⇥䘹ᤙㅖDŽྲ᷌䖟Ԧ֯⭘ IRET ᤷԔᤲ䎧ᯠԫ࣑ˈ༴⨶ಘቡՊ֯⭘ࡽаԫ࣑䬮᧕ᆇ⇥ѝ٬઼ ؍аԫ࣑䬮᧕ᆇ⇥ѝˈ❦ਾ൘ EFLAGS ѝ䇮㖞 NT ḷᘇDŽNT ḷᘇᤷ᰾ TSS Ⲵࡽаԫ࣑䬮᧕ᆇ⇥ѝᆈ᭮ᴹ ᖃ CALL ᤷԔǃѝᯝᡆᔲᑨ䙐ᡀԫ࣑࠷ᦒˈ༴⨶ಘᢺᖃࡽ TSS ⇥Ⲵ䘹ᤙㅖ༽ࡦࡠᯠԫ࣑ TSS ⇥Ⲵࡽ ഴ Աࣗ䬴⽰ᝅഴ  ፼྇ቲѝᴤ儈ቲԫ࣑Ⲵ TSS 䘹ᤙㅖˈ㤕ᴹⲴ䈍˄㿱മ 4-38 ᡰ⽪˅DŽ ḷᘇᤷࠪҶᖃࡽᢗ㹼Ⲵԫ࣑ᱟ੖ᱟ፼྇൘ਖањԫ࣑ѝᢗ㹼ˈᒦфᖃࡽԫ࣑Ⲵࡽаԫ࣑䘎᧕ᆇ⇥ѝᆈ᭮⵰ TSS Ⲵࡽаԫ࣑䘎᧕˄Backlink˅ᆇ⇥ԕ৺ EFLAGS ѝⲴ NT ḷᘇ⭘Ҿ䘄എࡠࡽањԫ࣑᫽֌ѝDŽNT 4.7.5 Աࣗ䬴 ࡽ↓൘ᢗ㹼ԫ࣑Ⲵна㠤DŽ Ԧਟ⭘ TS ḷᘇᶕॿ䈳༴⨶ಘ઼⎞⛩ॿ༴⨶ಘѻ䰤Ⲵ᫽֌DŽTS ḷᘇ㺘᰾ॿ༴⨶ಘѝⲴкл᮷޵ᇩਟ㜭оᖃ ⇿⅑ԫ࣑࠷ᦒ䜭Պ䇮㖞᧗ࡦᇴᆈಘ CR0 ѝⲴԫ࣑࠷ᦒḷᘇ TSDŽ䈕ḷᘇሩ㌫㔏䖟Ԧ䶎ᑨᴹ⭘DŽ㌫㔏䖟 ᐢ㓿᧗ࡦሩ TSS Ⲵ䇯䰞ˈᡰԕ൘ԫ࣑࠷ᦒᰦ䖟Ԧн䴰㾱޽䘋㹼⢩ᵳ㓗ỰḕDŽ ⇥ᤷᇊⲴ⢩ᵳ㓗кᔰ࿻䘀㹼DŽഐѪ਴њԫ࣑䙊䗷ᆳԜ⤜・Ⲵൠ൰オ䰤઼ TSS ⇥⴨ӂ䳄㔍ˈᒦф⢩ᵳ㓗㿴ࡉ ㌫DŽᯠԫ࣑൘ CS ᇴᆈಘⲴ CPL ᆇޣᖃᢗ㹼ԫ࣑࠷ᦒᰦˈᯠԫ࣑Ⲵ⢩ᵳ㓗о৏ԫ࣑Ⲵ⢩ᵳ㓗⋑ᴹԫօ ᆈⲴ EIP ᤷੁⲴᤷԔ༴ᔰ࿻ᢗ㹼ˈᒦфᡰᴹᇴᆈಘ䜭ᚒ༽ࡠԫ࣑ᤲ䎧ᰦⲴ٬DŽ؍Ӿ ᆈ䎧ᶕDŽᖃԫ࣑ᚒ༽ᢗ㹼ᰦˈԫ࣑ሶ؍ᖃᡀ࣏ൠ䘋㹼Ҷԫ࣑࠷ᦒ᫽֌ˈᖃࡽᢗ㹼ԫ࣑Ⲵ⣦ᘱᙫᱟՊ㻛 11. ᔰ࿻ᢗ㹼ᯠԫ࣑˄ሩҾᔲᑨ༴⨶䗷〻ˈᯠԫ࣑ⲴㅜаᶑᤷԔᱮ⧠ࠪ䘈⋑ᴹᢗ㹼˅DŽ кл᮷ѝDŽ ᆈಘǃEIP ᇴᆈಘԕ৺䙊⭘ᇴᆈಘ઼⇥䘹ᤙㅖDŽ൘↔ᵏ䰤Ự⍻ࡠⲴԫօ䭉䈟䜭ሶࠪ⧠൘ᯠԫ࣑Ⲵ 10. ᢺᯠԫ࣑Ⲵ TSS ⣦ᘱ࣐䖭䘋༴⨶ಘDŽ䘉वᤜ LDTR ᇴᆈಘǃPDBR˄CR3˅ᇴᆈಘǃEFLAGS ᇴ TS ḷᘇDŽ 9. ֯⭘ᯠԫ࣑ TSS Ⲵ⇥䘹ᤙㅖ઼᧿䘠ㅖ࣐䖭ԫ࣑ᇴᆈಘ TR˄वᤜ䳀㯿䜘࠶˅DŽ䇮㖞 CR0 ᇴᆈಘⲴ ᘉḷᘇ BDŽྲ᷌ԫ࣑࠷ᦒ⭡ IRET ӗ⭏ˈࡉн৫᭩ࣘ B ḷᘇDŽ 8. ྲ᷌ԫ࣑࠷ᦒ⭡ CALLǃJMP ᤷԔᡆ㘵ᔲᑨᡆѝᯝӗ⭏ˈ༴⨶ಘቡՊ䇮㖞ᯠԫ࣑ TSS ᧿䘠ㅖѝⲴ Ⲵ NT ḷᘇ㖞սDŽྲ᷌ԫ࣑࠷ᦒӗ⭏㠚 JMP ᡆ IRET ᤷԔˈቡн᭩ࣘᯠ࣐䖭 EFLAGS ѝⲴḷᘇDŽ 7. ྲ᷌ԫ࣑࠷ᦒᱟ⭡ CALL ᤷԔǃᔲᑨᡆѝᯝӗ⭏ˈࡉ༴⨶ಘቡՊᢺӾᯠԫ࣑ѝ࣐䖭Ⲵ EFLAGS ѝ ᇴᆈಘ EFLAGS ԕ৺ᤷԔᤷ䪸 EIPDŽ  ԫ࣑㇑⨶ ᧿⇥䙊䗷֯⭘ GDT ѝⲴ⇥᧿䘠ㅖDŽᡰᴹԫ࣑ᗵ享㜭ཏ䇯䰞 GDT ѝⲴ⇥᧿䘠ㅖDŽྲ᷌ GDT ѝⲴḀӋ ӛⲴ䙫䗁ࡠ⢙⨶ൠ൰オ䰤Ⲵ᱐ሴ˖ޡ・ӛᮠᦞˈਟ֯⭘лࡇᯩ⌅ѻаᶕѪᮠᦞ⇥ᔪޡѪҶ൘ԫ࣑ѻ䰤 4.7.6.2 Աࣗ䙱䗇൦൶グ䰪 ੖ࡉቡїཡҶ GDT Ⲵ֌⭘DŽ ӛⲴ⢙⨶ൠ൰オ䰤ѝDŽޡнՊ᭩ਈˈቡ䴰㾱֯⭘䘉⿽᱐ሴᯩᔿDŽGDT ᡰ᱐ሴⲴ㓯ᙗൠ൰オ䰤ҏᓄ䈕᱐ሴࡠ ѝˈᒦфᡰᴹԫ࣑䜭㜭䇯䰞䘉њ४ฏDŽѪҶ䇙༴⨶ಘᢗ㹼ԫ࣑࠷ᦒ㘼䈫ਆᡆᴤᯠ TSS ᰦˈTSS ൠ൰Ⲵ᱐ሴ ӛⲴ⢙⨶ൠ൰オ䰤४ฏޡሩҾ᱐ሴԫ࣑㓯ᙗൠ൰オ䰤Ⲵ䘉є⿽ᯩ⌅ˈᡰᴹԫ࣑Ⲵ TSS 䜭ᗵ享ᆈ᭮൘ ӛԫօ⢙⨶ൠ൰DŽޡ਼Ⲵ亥㺘ˈ㘼ф亥㺘ҏᤷੁ⢙⨶ൠ൰ѝн਼Ⲵ亥䶒кˈ䛓Ѹ਴њԫ࣑ቡнՊ н਼Ⲵ⢙⨶ൠ൰кDŽྲ᷌н਼亥ⴞᖅⲴᶑⴞ˄㺘亩˅ᤷੁнޘн਼ԫ࣑Ⲵ㓯ᙗൠ൰オ䰤ਟԕ᱐ሴࡠᆼ њԫ࣑ਟԕᴹн਼Ⲵ亥ⴞᖅDŽ ᡁԜቡਟԕ֯⭘䘉⿽᱐ሴᖒᔿDŽഐѪ⇿⅑ԫ࣑࠷ᦒ䜭Պ࣐䖭 PDBR˄᧗ࡦᇴᆈಘ CR3˅ˈᡰԕ⇿ „ ⇿њԫ࣑ᴹ㠚ᐡⲴ㓯ᙗൠ൰オ䰤ˈᒦ᱐ሴࡠ⢙⨶ൠ൰オ䰤DŽ䙊䗷䇙⇿њԫ࣑֯⭘н਼Ⲵ亥ⴞᖅˈ ᤏᆈۘᢰᵟˈࡉ㓯ᙗൠ൰オ䰤ਟԕ䎵䗷⧠ᴹ⢙⨶ൠ൰オ䰤ⲴབྷሿDŽ ࣑֯⭘ањ亥ⴞᖅˈᡁԜቡਟԕ֯⭘䘉⿽Ӿ㓯ᙗࡠ⢙⨶ൠ൰オ䰤Ⲵ᱐ሴᖒᔿDŽྲ᷌᭟ᤱ䴰≲亥㲊 нᔰ੟࠶亥ᰦˈᡰᴹ㓯ᙗൠ൰᱐ሴࡠ⴨਼Ⲵ⢙⨶ൠ൰кDŽᖃᔰ੟Ҷ࠶亥ᵪࡦˈ䛓Ѹ䙊䗷䇙ᡰᴹԫ ӛањ㓯ᙗࡠ⢙⨶ൠ൰オ䰤Ⲵ᱐ሴDŽᖃ⋑ᴹᔰ੟࠶亥ᵪࡦᰦˈቡਚ㜭֯⭘䘉њ࣎⌅DŽޡ„ ᡰᴹԫ࣑ ᴹє⿽ᯩ⌅ਟԕᢺԫ࣑᱐ሴࡠ㓯ᙗൠ൰オ䰤઼⢙⨶ൠ൰オ䰤˖ 4.7.6.1 ᣀԱࣗ᱖ሺࡦ㓵ᙝૂ⢟⨼൦൶グ䰪 ӛ⴨਼亥㺘䳶DŽޡ࣑㜭ཏ ྲ᷌ᔰ੟Ҷ࠶亥ᵪࡦˈࡉ TSS ѝⲴ CR3 ᇴᆈಘᆇ⇥ਟԕ䇙⇿њԫ࣑ᴹᆳ㠚ᐡⲴ亥㺘DŽᡆ㘵ˈࠐњԫ ӛ⇥DŽޡഐѪᡰᴹԫ࣑䜭ਟԕ䇯䰞 GDTˈᡰԕҏ਼ṧਟԕࡋᔪ䙊䗷↔㺘䇯䰞Ⲵ ᣔቿ䳌DŽ؍㘼ᰐ享ᣋᔳᮤњ㌫㔏Ⲵ ᖃ❦ˈࠐњԫ࣑ҏਟԕ֯⭘਼ањ LDTDŽ䘉ᱟа⿽ㆰঅ㘼ᴹ᭸Ⲵݱ䇨ḀӋԫ࣑ӂ⴨䙊ؑᡆ᧗ࡦⲴᯩ⌅ˈ LDT ѝˈԫ࣑Ⲵൠ൰オ䰤ቡਟԕоަԆԫ࣑Ⲵ䳄㔍ᔰᶕDŽ ޕᡰᴹ⇥᧿䘠ㅖ᭮ Ⲵޣ TSS ѝⲴ LDT ᆇ⇥ਟԕ⭘Ҿ㔉ࠪ⇿њԫ࣑㠚ᐡⲴ LDTDŽሩҾањ㔉ᇊⲴԫ࣑ˈ䙊䗷ᢺоԫ࣑⴨ ᡆ㘵䙊䗷࠶亥ᵪࡦ᱐ሴࡠ༴⨶ಘⲴ⢙⨶ൠ൰オ䰤ѝDŽ ⇥ԕ৺ԫ࣑ԓ⸱㜭ཏ䇯䰞ⲴԫօަԆ⇥DŽ䘉Ӌ⇥䜭㻛᱐ሴࡠ༴⨶ಘⲴ㓯ᙗൠ൰オ䰤ѝˈᒦф䲿ਾ㻛ⴤ᧕ൠ ԫ࣑Ⲵൠ൰オ䰤⭡ԫ࣑㜭ཏ䇯䰞Ⲵ⇥ᶴᡀDŽ䘉Ӌ⇥वᤜԓ⸱⇥ǃᮠᦞ⇥ǃึḸ⇥ǃTSS ѝᕅ⭘Ⲵ㌫㔏 4.7.6 Աࣗ൦൶グ䰪 CR0 ѝ TS ḷᘇ 䇮㖞ḷᘇ 䇮㖞ḷᘇ 䇮㖞ḷᘇ 㘱Ӫ⢙䬮᧕ᆇ⇥ нਈ нਈ нਈ ᯠԫ࣑䬮᧕ᆇ⇥ нਈ ᆈ᭮㘱ԫ࣑ TSS ⇥䘹ᤙㅖ нਈ 㘱ԫ࣑ NT ḷᘇ нਈ нਈ ␵䲔ḷᘇ ᯠԫ࣑ NT ḷᘇ 䇮㖞ᡀᯠԫ࣑ TSS ѝⲴ٬DŽ 䇮㖞ḷᘇ 䇮㖞ᡀᯠԫ࣑ TSS ѝⲴ٬DŽ 㘱ԫ࣑ᘉḷᘇ B 㻛␵䲔DŽ нਈDŽᖃࡽ༴Ҿ䇮㖞⣦ᘱDŽ 䇮㖞ḷᘇDŽ ᯠԫ࣑ᘉḷᘇ B 䇮㖞ḷᘇDŽԕࡽ享ᐢ㻛␵䲔 䇮㖞ḷᘇDŽԕࡽ享ᐢ㻛␵䲔 нਈDŽᗵ享ᐢ㻛䇮㖞DŽ ḷᘇᡆᆇ⇥ JMP ᤷԔⲴᖡ૽ CALL ᤷԔᡆѝᯝⲴᖡ૽ IRET ᤷԔⲴᖡ૽ 㺞 Աࣗ࠽ᦘሯᘏḽᘍȽ17 ḽᘍȽࢃжԱࣗ䬴ᆍ⇫ૂ 76 ḽᘍⲺᖧଃ ѪҶ䚯ݽ䘉⿽՚䙐Ⲵԫ࣑࠷ᦒᢗ㹼ᡀ࣏ˈ᫽֌㌫㔏ᓄ䈕ᢺ⇿њ TSS Ⲵ䈕ᆇ⇥ࡍ࿻ॆѪ 0DŽ Պ䇙༴⨶ಘ৫ᢗ㹼ᖃࡽԫ࣑ TSS Ⲵࡽаԫ࣑䬮᧕ᆇ⇥ᤷᇊⲴԫ࣑DŽ⌅ڊ㖞 NT ḷᘇᒦᢗ㹼 IRET ᤷԔDŽ䘉⿽ ᘇ˄൘ CR0 ѝ˅Ⲵ⭘⌅DŽ⌘᜿ˈ䘀㹼Ҿԫօ⢩ᵳ㓗кⲴ〻ᒿ䜭ਟԕ؞᭩ NT ḷᘇˈഐ↔ԫօ〻ᒿ䜭ਟԕ䇮  ԫ࣑㇑⨶ 㺘DŽᖃ❦ GDT 㺘ㅜ 1 亩䘈䴰㾱᭮㖞ањオ᧿䘠ㅖDŽึḸਟԕ᭮㖞൘Პ䙊ਟ䈫߉ᮠᦞ⇥ѝˈഐ↔ᒦн䴰㾱 ѪҶᇎ⧠ᰐ࠶亥Ⲵᒣඖ޵ᆈ⁑රˈ䖟Ԧࡍ࿻ॆԓ⸱ᗵ享䎧⸱䇮㖞ާᴹањԓ⸱⇥઼ањᮠᦞ⇥Ⲵ GDT Ⲵǃᒣඖᒦ᭟ᤱ࠶亥Ⲵǃ࠶⇥Ⲵᡆ㘵࠶⇥ᒦ᭟ᤱ࠶亥ⲴDŽ ᣔ⁑ᔿ㌫㔏㺘ѫ㾱׍䎆Ҿ᫽֌㌫㔏ሶ㾱᭟ᤱⲴ޵ᆈ㇑⨶㊫ර˖ᒣඖ؍䖟Ԧࡍ࿻ॆᵏ䰤൘޵ᆈѝ䇮㖞Ⲵ 4.8.1.1 ؓᣚ⁗ᕅ㌱㔕㔉ᶺ㺞 ᣔ⁑ᔿл䘀㹼DŽ؍0˅ˈ༴⨶ಘቡਟԕ࠷ᦒࡠ ᣔ⁑ᔿḷᘇ PE˄ս؍൘ࡍ࿻ॆҶ䘉Ӌᮠᦞ㔃ᶴǃԓ⸱⁑ඇ઼㌫㔏ᇴᆈಘѻਾˈ䙊䗷䇮㖞 CR0 ᇴᆈಘⲴ „ ᧗ࡦᇴᆈಘ CR1--CR3˗ „ ѝᯝ᧿䘠ㅖ㺘สൠ൰ᇴᆈಘ IDTR˗ ተ᧿䘠ㅖ㺘สൠ൰ᇴᆈಘ GDTR˗ޘ „ ˖ᣔ⁑ᔿѻࡽˈ䖟Ԧࡍ࿻ॆԓ⸱䘈ᗵ享䇮㖞ԕл㌫㔏ᇴᆈಘ؍൘㜭ཏ࠷ᦒࡠ „ ਜ਼ᴹѝᯝ઼ᔲᑨ༴⨶〻ᒿⲴԓ⸱⁑ඇDŽ ᣔ⁑ᔿл䘀㹼Ⲵԓ⸱⇥˗؍„ ༴⨶ಘ࠷ᦒࡠ „ 㤕֯⭘࠶亥ᵪࡦˈࡉ䎧⸱䴰㾱䇮㖞ањ亥ⴞᖅ઼ањ亥㺘˗ „ ተ䜘᧿䘠ㅖ㺘 LDT˗ „ ԫ࣑⣦ᘱ⇥ TSS˗ ተ᧿䘠ㅖ㺘 GDT˗ޘ „ ˗ᣔ⁑ᔿѝᯝ᧿䘠ㅖ㺘 IDT؍ „ ˖䘉Ӌᮠᦞ㔃ᶴवᤜԕлࠐ⿽ ᣔ⁑ᔿл֯⭘Ⲵᮠᦞ㔃ᶴⲴสᵜؑ᚟DŽ؍࿻ॆ䖟Ԧ˄bootsect.sǃsetup.s ઼ head.s˅ᗵ享൘޵ᆈѝݸ䇮㖞ྭ ᣔ⁑ᔿл䘀㹼ѻࡽˈ᫽֌㌫㔏࣐䖭઼ࡍ؍ᆈ㇑⨶⺜Ԧ䇮㖞ᡰ㾱≲Ⲵᮠᦞ㔃ᶴDŽഐ↔൘༴⨶ಘ㜭ཏ㻛࠷ᦒࡠ ⭘ᶕ䜘࠶൘޵ᆈǃ䜘࠶൘⻱ⴈкⲴབྷරᮠᦞ㔃ᶴؑ᚟DŽ䘉є⿽ൠ൰䖜ᦒᖒᔿ䜭䴰㾱᫽֌㌫㔏൘޵ᆈѝѪ޵ ᣔൠ൰オ䰤Ⲵ儈ᓖ㔃ᶴॆⲴཊ⇥⁑රDŽ࠶亥ᵪࡦ㜭ཏ؍㔏аⲴൠ൰オ䰤ᒣඖ⁑රࡠ⇿њԫ࣑䜭ާᴹࠐњਇ ᣔ⁑ᔿᡰ䴰㾱ⲴаӋᮠᦞ㔃ᶴ⭡༴⨶ಘ޵ᆈ㇑⨶࣏㜭⺞ᇊDŽ༴⨶ಘ᭟ᤱ࠶⇥⁑රˈਟԕ֯⭘Ӿঅњǃ؍ ᣚ⁗ᕅᰬⲺࡓခौᬃ֒ؓޛ4.8.1 䘑 ᣔ⁑ᔿDŽ؍ᣔ⁑ᔿ᫽֌ᗵ㾱Ⲵᮠᦞ㔃ᶴؑ᚟ˈ❦ਾ࠷ᦒࡠ؍ ᣔ⁑ᔿлˈ䛓Ѹ᫽֌㌫㔏䖟Ԧቡᗵ享࣐䖭؍䇨ᓄ⭘〻ᒿ㜭൘ᇎ⁑ᔿлਟ䶐ൠ䘀㹼DŽྲ᷌༴⨶ಘሶ㾱ᐕ֌൘ ˄ণѝᯝੁ䟿㺘˅DŽྲ᷌༴⨶ಘሶӽ❦ᐕ֌൘ᇎ⁑ᔿлˈ䛓Ѹ䖟Ԧᗵ享࣐䖭᫽֌㌫㔏⁑ඇ઼⴨ᓄᮠᦞԕݱ ࡍ࿻ॆԓ⸱俆ݸᗵ享䇮㖞สᵜ㌫㔏࣏㜭᫽֌ᗵ㾱Ⲵᮠᦞ㔃ᶴؑ᚟ˈֻྲ༴⨶ѝᯝ઼ᔲᑨⲴᇎ⁑ᔿ IDT 㺘 ᇩⲴᇎൠ൰⁑ᔿлˈᒦфӾ⢙⨶ൠ൰ 0xFFFFFFF0 ༴ᔰ࿻ᢗ㹼䖟Ԧࡍ࿻ॆԓ⸱˄䙊ᑨ൘ EPROM ѝ˅DŽ䖟 Ԧ ᡁԜ⸕䚃ˈ80X86 ਟԕᐕ֌൘ࠐ⿽⁑ᔿлDŽᖃᵪಘк⭥ᡆ⺜Ԧ༽սᰦˈ༴⨶ಘᐕ֌൘ 8086 ༴⨶ಘެ 4.8 ؓᣚ⁗ᕅ㕌ぁࡓခौ ӛ㓯ᙗൠ൰४ฏDŽޡᤷੁ⤜・Ⲵᵚ ӛᯩᔿ㾱∄к䶒㔉ࠪⲴᯩᔿᶕᗇᴤྭˈഐѪ LDT ѝⲴަԆ⇥᧿䘠ㅖਟԕޡ᧿䘠ㅖ䙊ᑨ〠Ѫ࡛਽⇥DŽ䘉њ ӛ䘉Ӌ⇥DŽ䘉ṧⲴ⇥ޡ४ฏሩ⇿њԫ࣑䜭᱐ሴࡠ⢙⨶ൠ൰オ䰤Ⲵ⴨਼४ฏˈ䛓Ѹ䘉Ӌ⇥᧿䘠ㅖቡݱ䇨ԫ࣑ ޡޜൠ൰४ฏⲴн਼ LDT ѝⲴ⇥᧿䘠ㅖDŽྲ᷌㓯ᙗൠ൰オ䰤ѝⲴ䘉њޡޜ䙊䗷᱐ሴࡠ㓯ᙗൠ൰オ䰤 ӛ⇥Ⲵᵳ࡙DŽޡ䲀ҾᤷᇊⲴаӋԫ࣑ѝDŽ㌫㔏ѝᴹо↔н਼ LDT ⲴަԆԫ࣑⋑ᴹ䇯䰞䘉Ӌ ӛተޡਟԕᢺڊӛྭˈഐѪ䘉ṧޡӛᯩᔿ㾱∄䙊䗷 GDT ᶕޡӛ䘉Ӌ⇥ѝⲴᡰᴹԓ⸱઼ᮠᦞDŽ䘉⿽ޡਟԕ ӛ LDT Ⲵᡰᴹԫ࣑ޡ४ฏⲴ⇥ˈ䛓ѸޡޜӛⲴ LDT ѝḀӋ⇥᧿䘠ㅖᤷੁ᱐ሴࡠ⢙⨶ൠ൰オ䰤ޡྲ᷌ањ ӛⲴ LDTDŽєњᡆཊњԫ࣑ਟԕ֯⭘⴨਼Ⲵ LDTˈྲ᷌ᆳԜ TSS ѝ LDT ᆇ⇥ᤷੁ਼ањ LDTDŽޡ䙊䗷 ӛ䘉Ӌ⇥ѝⲴԓ⸱઼ᮠᦞDŽޡ䜭ਟԕ ӛⲴ⢙⨶ൠ൰オ䰤ѝˈ䛓Ѹᡰᴹԫ࣑ޡ䘠ㅖᤷੁ㓯ᙗൠ൰オ䰤ѝⲴаӋ⇥ˈᒦф䘉Ӌ⇥㻛᱐ሴࡠᡰᴹԫ࣑  ᣔ⁑ᔿ㕆〻ࡍ࿻ॆ؍ ∄޽࠷ᦒഎᇎ⁑ᔿл䘀㹼ᴤѪᯩׯDŽ 䙊ᑨнՊ޽䴰㾱എࡠᇎൠ൰⁑ᔿDŽѪҶ䘈㜭䘀㹼Ѫᇎൠ൰⁑ᔿ㕆ࡦⲴ〻ᒿˈ䙊ᑨ൘㲊ᤏ-8086 ⁑ᔿѝ䘀㹼 ᣔ⁑ᔿˈ䖟Ԧ؍ޕᣔ⁑ᔿлˈᗵ享Ӿᇎൠ൰⁑ᔿл䘋㹼⁑ᔿ࠷ᦒ᫽֌DŽаᰖ䘋؍ѪҶ䇙༴⨶ಘᐕ֌൘ 4.8.2 ⁗ᕅ࠽ᦘ ઼ TSS ⇥᧿䘠ㅖਟԕ亴ݸ䇮㖞ྭˈҏਟԕ൘䴰㾱ᰦ䘋㹼䇮㖞DŽ ൘ LTR ᤷԔᢗ㹼ѻਾˈ䲿ਾሩԫ࣑ᇴᆈಘⲴ᫽֌⭡ԫ࣑࠷ᦒ䘋㹼DŽоަԆⲴ⇥઼ LDT ㊫լˈTSS ⇥ ㅖˈഐѪԫ࣑࠷ᦒՊᢺᖃࡽԫ࣑⣦ᘱ༽ࡦࡠ䈕 TSS ѝDŽ ᣔ⁑ᔿѝˈ䖟Ԧ䘋㹼ㅜа⅑ԫ࣑࠷ᦒѻࡽᗵ享俆ݸ࣐䖭 TSS ⇥Ⲵ䘹ᤙ؍ᇊս⢩ᵳ㓗 0ǃ1 ઼ 2 ⲴึḸDŽ൘ 䘉њᤷԔՊᢺ TSS ḷ䇠ᡀᘉ⣦ᘱ˄B=1˅ˈնᱟᒦнᢗ㹼ԫ࣑࠷ᦒ᫽֌DŽ❦ਾ༴⨶ಘਟԕ֯⭘䘉њ TSS ᶕ ᣔ⁑ᔿѻਾˈਟԕ⭘ LTR ᤷԔᢺ TSS ⇥᧿䘠ㅖⲴ䘹ᤙㅖ࣐䖭ࡠԫ࣑ᇴᆈಘ TR ѝDŽ؍൘༴⨶ಘ࠷ᦒࡠ TSS Ⲵ᧿䘠ㅖҏᆈ᭮൘ GDT ѝDŽ н㾱ሶަḷ⌘Ѫᘉ˄н㾱䇮㖞ᘉḷᘇ˅ˈ䈕ḷᘇӵ⭡༴⨶ಘ൘ᢗ㹼ԫ࣑࠷ᦒᰦ䇮㖞DŽо LDT ⇥᧿䘠ㅖ⴨਼ˈ ৺⴨ᓄⲴ TSS ⇥᧿䘠ㅖ˄ഐѪ⢩ᵳ㓗 0ǃ1 ઼ 2 Ⲵ਴Ḹ⇥ᤷ䪸䴰㾱Ӿ TSS ѝਆᗇ˅DŽ൘ࡋᔪ TSS ᧿䘠ㅖᰦ ྲ᷌ሶ㾱֯⭘ཊԫ࣑ᵪࡦˈᒦф/ᡆ㘵ݱ䇨᭩ਈ⢩ᵳ㓗ˈ䛓Ѹ䖟Ԧࡍ࿻ॆԓ⸱ᗵ享㠣ቁ䇮㖞ањ TSS 4.8.1.4 ཐԱࣗࡓခौ ਾⲴ⢙⨶ൠ൰⴨਼˅Ⲵањ亥䶒кDŽ „ 䇮㖞 PG ḷᘇࡠ䐣䖜ᤷԔ JMP ѻ䰤Ⲵԓ⸱ᗵ享ᶕ㠚ሩㅹ᱐ሴ˄ণ䐣䖜ѻࡽⲴ㓯ᙗൠ൰оᔰ੟࠶亥 㾱DŽ ⴞḷ㕃ߢಘ BTB˄Branch Target Buffer˅Ѫ࠶᭟ԓ⸱ᇊੁˈഐ↔߿৫ҶѪ࠶᭟ᤷԔࡧᯠ䱏ࡇⲴ䴰 ᡰԕᆳՊ␵オ 80X86 ༴⨶ಘᐢ㓿ਆᗇᡆᐢ䈁⸱ⲴᤷԔDŽ❦㘼ˈPentium ৺ԕк༴⨶ಘ֯⭘Ҷ࠶᭟ „ 䇮㖞 PG ḷᘇⲴᤷԔᓄ䈕・࡫䐏䲿аᶑ JMP ᤷԔDŽMOV CR0 ᤷԔਾ䶒Ⲵ JMP ᤷԔՊ᭩ਈᢗ㹼⍱ˈ ᤱެᇩᙗˈ䇮㖞 PG ḷᘇ˄ԕ৺ PE ḷᘇ˅ᰦᗵ享䚥ᆸԕл㿴ࡉ˖؍Ѫ ᣔ⁑ᔿлDŽྲ᷌┑䏣ᡰᴹަԆ䲀ࡦˈࡉ PG ઼ PE ḷᘇਟԕ਼ᰦ䇮㖞DŽ؍„ ༴⨶ಘ༴Ҿ „ ᢺ亥ⴞᖅ㺘Ⲵ⢙⨶สൠ൰࣐䖭ࡠ CR3 ᇴᆈಘѝ˄ҏ〠Ѫ PDBR ᇴᆈಘ˅DŽ ᰦˈਟԕн֯⭘亥㺘DŽ↔ᰦ亥ⴞᖅ㺘઼亥㺘㻛ᆈ᭮൘਼а亥䶒ѝDŽ „ 䖟Ԧᗵ享൘⢙⨶޵ᆈѝᔪ・㠣ቁањ亥ⴞᖅ઼ањ亥㺘DŽྲ᷌亥ⴞᖅ㺘ѝਜ਼ᴹᤷੁ㠚䓛Ⲵⴞᖅ亩 ᇴᆈಘ˖ 䰝˗ᖃ䇮㖞Ҷ PG ḷᘇˈቡᔰ੟࠶亥ᵪࡦDŽ൘䇮㖞 PG ḷᘇѻࡽˈᗵ享ݸࡍ࿻ॆԕлᮠᦞ㔃ᶴ઼ޣᵪࡦ㻛 ࠶亥ᵪࡦ⭡᧗ࡦᇴᆈಘ CR0 ѝⲴ PG ḷᘇ䇮㖞DŽᖃ䘉њḷᘇ㻛␵ 0 ᰦ˄ণ⺜Ԧ༽սᰦⲴ⣦ᘱ˅ˈ࠶亥 4.8.1.3 ࠼享ᵰ࡬ࡓခौ ൘ਟԕ֯⭘ IDT ѻࡽˈᗵ享֯⭘ LIDT ᤷԔᢺ IDT 㺘สൠ൰઼䮯ᓖ࣐䖭ࡠ IDTR ᇴᆈಘѝDŽ ⇥DŽྲ᷌ݱ䇨⺜Ԧӗ⭏ѝᯝˈ䛓Ѹᗵ享൘ IDT ѝѪањᡆཊњѝᯝ༴⨶䗷〻䇮㖞䰘᧿䘠ㅖDŽ Ⲵԓ⸱ǃᮠᦞ઼ึḸޣ⇥DŽ㤕֯⭘Ҷԫ࣑䰘ˈ䛓Ѹ⇿њ֯⭘ԫ࣑䰘Ⲵᔲᑨ༴⨶䗷〻䜭䴰㾱ањ TSS ԕ৺⴨ Ⲵ䰘᧿䘠ㅖDŽྲ᷌֯⭘Ҷѝᯝᡆ䲧䱡䰘ˈ䛓Ѹ䰘᧿䘠ㅖਟԕ䜭ᤷੁवਜ਼ѝᯝ઼ᔲᑨ༴⨶䗷〻Ⲵ਼ањԓ⸱ ᣔ⁑ᔿ IDTˈަѝᴰቁ䴰㾱ਜ਼ᴹ༴⨶ಘਟ㜭ӗ⭏Ⲵ⇿њᔲᑨੁ䟿ሩᓄ؍䖟Ԧࡍ࿻ॆԓ⸱ᗵ享䇮㖞ањ 4.8.1.2 ؓᣚ⁗ᕅᔸᑮૂѣᯣࡓခौ ᭸Ⲵᯩ⌅DŽ ԕ亴ݸѪപᇊᮠ䟿Ⲵᓄ⭘〻ᒿ࠶䝽പᇊᮠ䟿Ⲵ⇥઼ LDTˈ䘉ᱟᇎ⧠ᇎᰦ㌫㔏䖟Ԧ⧟ຳ㔃ᶴⲴа⿽ㆰঅ㘼ᴹ ᔿ㌫㔏ਟޕ㕆〻⧟ຳᨀ׋Ҷᴰབྷ⚥⍫ᙗˈֻྲ Linux ᫽֌㌫㔏ቡ֯⭘Ҷ䘉⿽ᯩᔿDŽ䊑䗷〻᧗ࡦಘ䛓ṧⲴ፼ Ѫࣘᘱ⌅ڊ᧿䘠ㅖ㾱≲ᆈ᭮൘ GDT 㺘ѝDŽḀӋ᫽֌㌫㔏ՊѪᓄ⭘〻ᒿਖ㹼࠶䝽ᯠ⇥઼ᯠⲴ LDT ⇥DŽ䘉⿽ 㘼ཊ⇥⁑රࡉ䘈䴰㾱⭘Ҿ᫽֌㌫㔏ⲴަԆ⇥ˈԕ৺⭘Ҿ⇿њᓄ⭘〻ᒿⲴ⇥઼ LDT 㺘⇥DŽLDT 㺘Ⲵ⇥ 㺘ѻࡽˈᗵ享֯⭘ LGDT ᤷԔᢺ GDT 㺘Ⲵสൠ൰઼䮯ᓖ٬࣐䖭ࡠ GDTR ᇴᆈಘѝDŽ у䰘ⲴึḸ᧿䘠ㅖDŽ᭟ᤱ࠶亥ᵪࡦⲴᒣඖ޵ᆈ⁑ර䘈䴰㾱ањ亥ⴞᖅ઼㠣ቁањ亥㺘DŽ൘ਟԕ֯⭘ GDT  ᣔ⁑ᔿ㕆〻ࡍ࿻ॆ؍ ਸ䘲Ⲵสൠ൰઼䇯䰞ᵳ䲀٬DŽ 7. ᢗ㹼ањ䘌䐣䖜ᤷԔ䐣䖜ࡠањᇎ⁑ᔿ〻ᒿѝDŽ䘉↕᫽֌ՊࡧᯠᤷԔ䱏ࡇᒦфѪ CS ᇴᆈಘ࣐䖭 6. ␵䲔 CR0 ѝⲴ PE ḷᘇᶕ࠷ᦒࡠᇎൠ൰⁑ᔿDŽ 5. ᢗ㹼 LIDT ᤷԔᶕᤷੁ൘ 1MB ᇎ⁑ᔿൠ൰㤳ത޵Ⲵᇎൠ൰⁑ᔿѝᯝ㺘DŽ „ ᆈ൘˄P=1˅DŽ „ ਟ߉˄W=1˅DŽ „ ੁкᢙኅ˄E=0˅DŽ „ ᆇ㢲仇㋂ᓖ˄G=0˅DŽ „ ⇥䲀䮯 Limit = 64KB 4. ֯⭘ᤷੁਜ਼ᴹԕл䇮㖞٬Ⲵ᧿䘠ㅖⲴ䘹ᤙㅖᶕ࣐䖭 SSǃDSǃESǃFS ઼ GS ⇥ᇴᆈಘDŽ 䖭 CS ᇴᆈಘDŽ 3. ᢺ〻ᒿⲴ᧗ࡦ䖜〫ࡠ䮯ᓖѪ 64KB˄0xFFFF˅Ⲵਟ䈫⇥ѝDŽ䘉↕᫽֌֯⭘ᇎ⁑ᔿ㾱≲Ⲵ⇥䮯ᓖ࣐ „ CR3 ᇴᆈಘ㖞Ѫ 0x00ˈ⭘Ҿࡧᯠ TLB 㕃ߢDŽ „ ␵䲔 CR0 ѝⲴ PG ḷᘇDŽ GDT ઼ IDT ൘ሩㅹ᱐ሴⲴ亥䶒кDŽ ؍⺞ „ „ ᢺ〻ᒿⲴ᧗ࡦ䖜〫ࡠሩㅹ᱐ሴⲴ㓯ᙗൠ൰༴˄ণ㓯ᙗൠ൰ㅹҾ⢙⨶ൠ൰˅DŽ 2. ྲ᷌ᐢᔰ੟࠶亥ᵪࡦˈ䛓Ѹ䴰㾱ᢗ㹼˖ ൘⁑ᔿ࠷ᦒ᫽֌ᵏ䰤нӗ⭏ᔲᑨ઼ѝᯝDŽ؍ ⺞1. ⾱→ѝᯝDŽ֯⭘ CLI ᤷԔਟԕ⾱→ਟቿ㭭⺜ԦѝᯝDŽNMI Պ⭡⺜Ԧ⭥䐟ᶕ⾱→DŽ਼ᰦ䖟Ԧᓄ䈕 ᇎൠ൰⁑ᔿⲴ䗷〻ᓄ䈕᤹➗ԕл↕僔䘋㹼˖ ޕ㤕ᜣ࠷ᦒഎᇎൠ൰⁑ᔿˈࡉਟԕ֯⭘ MOV CR0 ᤷԔᢺ᧗ࡦᇴᆈಘ CR0 ѝⲴ PE ḷᘇ␵ 0DŽ䟽ᯠ䘋 4.8.2.2 ࠽ᦘഔᇔ൦൶⁗ᕅ Ⲵ⢙⨶ൠ൰⴨਼˅Ⲵањ亥䶒кDŽ㘼 JMP ᡆ CALL ᤷԔ䐣䖜ࡠⲴⴞḷᤷԔᒦн䴰㾱༴Ҿሩㅹ᱐ሴ亥䶒кDŽ MOV CR0 ᤷԔࡠ JMP ᡆ CALL ᤷԔѻ䰤Ⲵԓ⸱ᗵ享ᶕ㠚ሩㅹ᱐ሴ˄ণ䐣䖜ѻࡽⲴ㓯ᙗൠ൰оᔰ੟࠶亥ਾ ਖཆˈMOV CR0 ᤷԔѻਾ㍗᧕⵰Ⲵ JMP ᡆ CALL ᤷԔՊ᭩ਈᢗ㹼⍱DŽྲ᷌ᔰ੟Ҷ࠶亥ᵪࡦˈ䛓Ѹ 9. ᢗ㹼 STI ᤷԔᔰ੟ਟቿ㭭⺜Ԧѝᯝˈᒦфᢗ㹼ᗵ㾱Ⲵ⺜Ԧ᫽֌ᔰ੟ NMI ѝᯝDŽ ᣔ⁑ᔿ IDT 㺘Ⲵสൠ൰઼䮯ᓖ࣐䖭ࡠ IDTR ᇴᆈಘѝDŽ؍8. ᢗ㹼 LIDT ᤷԔᢺ 䟽ᯠ࣐䖭ᡆ࠷ᦒࡠањᯠԫ࣑ᶕᴤᯠDŽ 䟽㖞 CS ᇴᆈಘDŽᢗ㹼ԕл᫽֌ѻаਟԕᴤᯠަ։⇥ᇴᆈಘⲴ޵ᇩ˖ަ։⇥ᇴᆈಘⲴ޵ᇩਟ䙊䗷 ᣔ⁑ᔿਾˈ⇥ᇴᆈಘӽ❦ਜ਼ᴹ൘ᇎൠ൰⁑ᔿᰦⲴ޵ᇩDŽㅜ 4 ↕ѝⲴ JMP ᡆ CALL ᤷԔՊ؍ޕ7. ൘䘋 TRDŽ䘉њਟ߉޵ᆈ४ฏ⭘Ҿ൘ԫ࣑࠷ᦒᰦᆈ᭮ԫ࣑Ⲵ TSS ؑ᚟DŽ ᣔ⁑ᔿԫ࣑Ⲵ⇥䘹ᤙㅖᡆ㘵ਟ߉޵ᆈ४ฏⲴ⇥᧿䘠ㅖ࣐䖭ԫ࣑ᇴᆈಘ؍6. ᢗ㹼 LTR ᤷԔˈ⭘ࡍ࿻ 5. 㤕㾱֯⭘ተ䜘᧿䘠ㅖ㺘ˈࡉᢗ㹼 LLDT ᤷԔᢺ LDT ⇥Ⲵ䘹ᤙㅖ࣐䖭ࡠ LDTR ᇴᆈಘѝDŽ ᡆ䘌䈳⭘ᤷԔ⍱ѝⲴлаᶑᤷԔDŽ 4. ൘ MOV CR0 ᤷԔѻਾ・࡫ᢗ㹼ањ䘌䐣䖜 JMP ᡆ䘌䈳⭘ CALL ᤷԔDŽ䘉њ᫽֌䙊ᑨᱟ䘌䐣䖜ࡠ 3. ᢗ㹼൘᧗ࡦᇴᆈಘ CR0 ѝ䇮㖞 PE ḷᘇ˄ਟ䘹਼ᰦ䇮㖞 PG ḷᘇ˅Ⲵ MOV CR0 ᤷԔDŽ 2. ᢗ㹼 LGDT ᤷԔᢺ GDT 㺘Ⲵสൠ൰࣐䖭䘋 GDTR ᇴᆈಘDŽ ൘⁑ᔿ࠷ᦒ᫽֌ᵏ䰤нӗ⭏ᔲᑨ઼ѝᯝDŽ؍ ⺞1. ⾱→ѝᯝDŽ֯⭘ CLI ᤷԔਟԕ⾱→ਟቿ㭭⺜ԦѝᯝDŽNMI Պ⭡⺜Ԧ⭥䐟ᶕ⾱→DŽ਼ᰦ䖟Ԧᓄ䈕 䇱〻ᒿⲴެᇩᙗˈ࠷ᦒ᫽֌ᓄ䈕᤹➗ԕл↕僔䘋㹼˖؍㹼ᰦˈ⢩ᵳ㓗ᱟ 0DŽѪҶ ᣔ⁑ᔿѝ䘀؍ޕᣔ⁑ᔿDŽ˄൘਼ањᤷԔѝˈCR0 Ⲵ PG ḷᘇਟ⭘Ҿᔰ੟࠶亥ᵪࡦDŽ˅ࡊ䘋؍Ԝቡਟԕ䘋㹼 ᣔ⁑ᔿѝDŽ䙊䗷ᢗ㹼൘ CR0 ᇴᆈಘѝ䇮㖞 PE ḷᘇⲴ MOV CR0 ᤷԔˈᡁ؍䖟Ԧࡍ࿻ॆԓ⸱ቡਟԕ࠷ᦒࡠ ᣔ⁑ᔿѻࡽˈᗵ享俆ݸ࣐䖭аӋ䎧⸱Ⲵ㌫㔏ᮠᦞ㔃ᶴ઼ԓ⸱⁑ඇDŽаᰖᔪ・Ҷ䘉Ӌ㌫㔏㺘ˈ؍൘࠷ᦒࡠ 4.8.2.1 ࠽ᦘࡦؓᣚ⁗ᕅ  ᣔ⁑ᔿ㕆〻ࡍ࿻ॆ؍ KHDG ԓ⸱ERRW ԓ⸱ ᕅሬᡷ४  4-40 ᡰ⽪DŽ ⁑ᔿḷᘇˈᒦ䐣䖜ࡠ޵ᆈ  ༴ᔰ࿻ᢗ㹼 KHDG ԓ⸱DŽERRW 〻ᒿԓ⸱൘޵ᆈѝ〫ࣘ KHDG ԓ⸱Ⲵ⽪᜿മ㿱മ ᣔ䘀㹼؍ս㖞ᔰ࿻༴ˈ❦ਾ޽ᢺ䘉⇥ KHDG ԓ⸱〫ࣘࡠ޵ᆈ  ᔰ࿻༴DŽᴰਾ䇮㖞᧗ࡦᇴᆈಘ &5 ѝⲴᔰ੟ ࡠ޵ᆈ [˄.%˅ޕᇎ䱵кˈERRWV 〻ᒿՊ俆ݸ࡙⭘ 520%,26 ѝᯝ LQW[ ᢺ䖟ⴈѝⲴ KHDG ԓ⸱䈫 ᣔ⁑ᔿлˈ❦ਾ䐣䖜ࡠ KHDG ԓ⸱༴৫䘀㹼޵Ṩԓ⸱DŽ؍ྭѤᰦ *'7 㺘ㅹؑ᚟ਾˈᢺ༴⨶ಘ䇮㖞ᡀ䘀㹼൘ ᮷ԦѝⲴ KHDG ޵Ṩԓ⸱࣐䖭ࡠ޵ᆈḀњᤷᇊս㖞༴ˈᒦ൘䇮㖞ۿ ERRW 〻ᒿⲴѫ㾱࣏㜭ᱟᢺ䖟ⴈᡆ᱐  ᮽԬ⽰ᝅഴ܅䖥ⴎ᱖ ഴ   ࿻༴ˈᒦᢺᢗ㹼ᵳ䖜〫ࡠ [F ༴ᔰ࿻䘀㹼 ERRW 〻ᒿԓ⸱DŽ 3& ᵪ൘࣐⭥੟ࣘᰦˈ520%,26 ѝⲴ〻ᒿՊᢺ੟ࣘⴈкㅜањᡷ४࣐䖭ࡠ⢙⨶޵ᆈ [F˄.%˅ս㖞ᔰ ᮷ԦⲴㅜањᡷ४ѝˈ㿱മ 4-39 ᡰ⽪DŽۿᆇ㢲ˈሶ㻛ᆈ᭮൘䖟ⴈ᱐  ޡ ERRWV 〻ᒿ㕆䈁ࠪⲴԓ⸱ 䰝䘀㹼Ⲵ⁑ᤏ 3& 䘀㹼⧟ຳ䖟ԦDŽޣࡉ䴰㾱䟽ᯠ੟ࣘᵪಘˈᡆ㘵 DŽ㤕㾱㓸→䘉њ޵Ṩᇎֻ〻ᒿˈ % ˗ԫ࣑ % ࡉаⴤᱮ⽪ᆇㅖ $ 㔝ᗚ⧟ൠ䈳⭘㌫㔏䈳⭘൘ቿᒅкᱮ⽪ᆇㅖ ˈⴤࡠ⇿њ  ∛。࠷ᦒࡠਖањԫ࣑DŽԫ࣑ $ 䘎 % ઼ $ ⭘䘉њᱮ⽪㌫㔏䈳⭘൘ቿᒅк࠶࡛ᱮ⽪ࠪᆇㅖ кᱮ⽪ᆇㅖⲴањ㌫㔏䈳⭘DŽᡁԜᢺ䘉єњԫ࣑࠶࡛〠Ѫԫ࣑ A ઼ԫ࣑ B˄ᡆԫ࣑ 0 ઼ԫ࣑ 1˅ˈᆳԜՊ䈳 head.sˈަѝᇎ⧠Ҷєњ䘀㹼൘⢩ᵳ㓗 3 кⲴԫ࣑൘ᰦ䫏ѝᯝ᧗ࡦл⴨ӂ࠷ᦒ䘀㹼ˈᒦф䘈ᇎ⧠Ҷ൘ቿᒅ ᵪ㌫㔏࣐⭥ᰦӾ੟ࣘⴈкᢺ޵Ṩԓ⸱࣐䖭ࡠ޵ᆈѝ˗ਖањᱟ֯⭘ GNU as ≷㕆䈝䀰㕆ࡦⲴ޵Ṩ〻ᒿ ᵜ㢲㔉ࠪⲴ޵Ṩᇎֻ⭡ 2 њ᮷ԦᶴᡀDŽањᱟ֯⭘ as86 䈝䀰㕆ࡦⲴᕅሬ੟ࣘ〻ᒿ boot.sˈ⭘Ҿ൘䇑㇇ 4.9.1 ཐԱࣗぁᓅ㔉ᶺૂᐛ֒৕⨼ ᣔ⁑ᔿཊԫ࣑޵Ṩ〻ᒿ head.sDŽ؍઼ ᴰਾᡁԜ㔉ࠪᇎ⧠䘉њㆰঅ޵ṨⲴⓀ〻ᒿ˖੟ࣘᕅሬ〻ᒿ boot.s ࣐䖭䘀㹼Ⲵสᵜ৏⨶ˈ❦ਾ᧿䘠ᆳᱟྲօ㻛࣐䖭䘋ᵪಘ RAM ޵ᆈѝԕ৺єњԫ࣑ᱟྲօ䘋㹼࠷ᦒ䘀㹼ⲴDŽ ⽪ֻѝवਜ਼єњ⢩ᵳ㓗 3 Ⲵ⭘ᡧԫ઼࣑ањ㌫㔏䈳⭘ѝᯝ䗷〻DŽᡁԜ俆ݸ䈤᰾䘉њㆰঅ޵ṨⲴสᵜ㔃ᶴ઼ ֌Ѫሩᵜㄐ઼ࡽࠐㄐ޵ᇩⲴᙫ㔃ˈᵜ㢲ᆼᮤ᧿䘠Ҷањㆰঅཊԫ࣑޵ṨⲴ䇮䇑઼ᇎ⧠ᯩ⌅DŽ䘉њ޵Ṩ 4.9 жѠㆶঋⲺཐԱࣗ޻Ṯᇔׁ 9. ᢗ㹼 STI ᤷԔᔰ੟ਟቿ㭭⺜Ԧѝᯝˈᒦфᢗ㹼ᗵ㾱Ⲵ⺜Ԧ᫽֌ᔰ੟ NMI ѝᯝDŽ 8. ࣐䖭ᇎൠ൰⁑ᔿ〻ᒿԓ⸱Պ֯⭘Ⲵ SSǃDSǃESǃFS ઼ GS ᇴᆈಘDŽ  ањㆰঅⲴཊԫ࣑޵Ṩᇎֻ ⇥ᮠᦞ ޵Ṩ ԓ⸱⇥  ԫ࣑ ᮠᦞ⇥  ԫ࣑ ⣦ᘱ⇥ WVV ⣦ᘱ⇥ WVV ተ䜘㺘 OGW 18// 18// ተൠ൰オ䰤 ተ䜘ൠ൰オ䰤ޘ /'7 *'7 18// ԓ⸱⇥ &RGH ᮠᦞ⇥ 'DWD ᱮ⽪⇥ ተ䜘㺘 OGW  ԓ⸱⇥  ԫ࣑ ԓ⸱⇥ &RGH ᮠᦞ⇥ 'DWD ԫ࣑ 766 ԓ⸱⇥  ԫ࣑ ԓ⸱⇥ &RGH ᮠᦞ⇥ 'DWD ԫ࣑ 766 ԓ⸱⇥ ޵Ṩ   ԓ⸱ᢗ㹼ս㖞㓯䐟 KHDGV 〻ᒿԓ⸱ ERRWV 〻ᒿԓ⸱  . [ [  . [F    ࡠᱮ⽪޵ᆈ४ฏкDŽ ተᱮ⽪ᮠᦞ⇥㻛䇮㖞ᡀ˖สൠ൰Ѫ [E˗⇥䲀䮯٬Ѫ [ˈᡰԕᇎ䱵⇥䮯ᓖѪ .%ˈሩᓄޘ0%DŽ㘼 ᦞ⇥᧿䘠ㅖⲴ޵ᇩ䜭䇮㖞Ѫ˖สൠ൰Ѫ [˗⇥䲀䮯٬Ѫ [IIDŽഐѪ仇㋂ᓖѪ ˈᡰԕᇎ䱵⇥䮯ᓖѪ ተԓ⸱⇥઼ᮠޘᡰᴹԓ⸱઼ᮠᦞ⇥䜭ሩᓄࡠ⢙⨶޵ᆈ਼ањ४ฏкˈণӾ⢙⨶޵ᆈ  ᔰ࿻Ⲵ४ฏDŽ*'7 ѝ  ൘㲊ᤏൠ൰オ䰤ѝ KHDGV 〻ᒿⲴ޵Ṩԓ⸱઼ԫ࣑ԓ⸱࠶䝽മྲമ 4-41 ᡰ⽪DŽᇎ䱵кˈᵜ޵Ṩ⽪ֻѝ ࡠԫ࣑ $ ѝᢗ㹼DŽ ķ䟽ᯠ䇮㖞 *'7 㺘˗ĸ䇮㖞㌫㔏ᇊᰦಘ㣟⡷˗Ĺ䟽ᯠ䇮㖞 ,'7 㺘ᒦф䇮㖞ᰦ䫏઼㌫㔏䈳⭘ѝᯝ䰘˗ĺ〫ࣘ ㌫㔏䈳⭘ѝᯝ LQW[ Ⲵ䗷〻ԓ⸱ԕ৺ԫ࣑ $ ઼ԫ࣑ % ㅹⲴԓ⸱઼ᮠᦞDŽަѝࡍ࿻䇮㖞ᐕ֌ѫ㾱वᤜ˖ ᣔ⁑ᔿлˈަѝѫ㾱वᤜࡍ࿻䇮㖞Ⲵԓ⸱ǃᰦ䫏ѝᯝ LQW[ Ⲵ䗷〻ԓ⸱ǃ؍ KHDGV 〻ᒿ䘀㹼൘  ս ԓ⸱ˈ֯⭘䘉⿽ᯩᔿⲴⓀ〻ᒿਟӾ ROGOLQX[RUJ 㖁ㄉл䖭ˈ㿱л䶒䈤᰾DŽ ѝᯝ䗷〻н㜭↓ᑨ䘀㹼DŽᖃ❦ᡁԜҏਟԕᢺ KHDG ԓ⸱࣐䖭ࡠ޵ᆈ [ ༴ਾቡⴤ᧕䐣䖜ࡠ䈕༴䘀㹼 KHDG ᯩˈᒦф൘޵ᆈ .% ᔰ࿻༴ᱟ %,26 〻ᒿ֯⭘Ⲵᮠᦞ४ˈᡰԕ㤕ⴤ᧕ᢺ KHDG ԓ⸱࣐䖭ࡠ޵ᆈ  ༴ሶ֯ᗇ %,26 ༴DŽഐѪ࣐䖭᫽֌䴰㾱֯⭘ 520%,26 ᨀ׋Ⲵѝᯝ䗷〻ˈ㘼 %,26 ֯⭘Ⲵѝᯝੁ䟿㺘↓༴Ҿ޵ᆈ  ᔰ࿻Ⲵൠ  ᮷Ԧѝⴤ᧕࣐䖭ࡠ޵ᆈۿ䇙 KHDGV 〻ᒿቭ䟿⸝аӋDŽնᱟᡁԜн㜭䇙 ERRW 〻ᒿᢺ KHDG ԓ⸱Ӿ䖟ⴈᡆ᱐  ᢺ KHDG ޵Ṩԓ⸱〫ࣘࡠ⢙⨶޵ᆈ  ᔰ࿻༴Ⲵѫ㾱৏ഐᱟѪҶ䇮㖞 *'7 㺘ᰦਟԕㆰঅаӋˈഐ㘼ҏ㜭  ഴ ޻Ṯԙ⸷൞⢟⨼޻ᆎѣⲺ〱ࣞૂ࠼ᐹ᛻߫   ањㆰঅⲴཊԫ࣑޵Ṩᇎֻ ԫ࣑  Ⲵ޵ṨḸ ԫ࣑  Ⲵ޵ṨḸ 8VHUBVWN 7DVN&RGH 7DVN&RGH NUQBVWN /'7 ⇥ 766 ⇥ NUQBVWN ࡍ࿻䇮㖞ԓ⸱  LQLWBVWDFN /'7 ⇥ ,'7 ተ᧿䘠ㅖ㺘 *'7ޘѝᯝ઼ 766 ⇥ ԫ࣑  ઼ԫ࣑  ԓ⸱ [ ࡍ࿻ึḸˈҏᱟԫ࣑  Ⲵ⭘ᡧḸ ԫ࣑㔃ᶴᮠᦞ䜘࠶ ⴨ᖃҾ /LQX[ ޵Ṩ ԫ࣑  Ⲵ⭘ᡧḸ  䰤䳄ൠ䘎㔝нᯝൠᱮ⽪൘ቿᒅкˈ㿱മ 4-43 ᡰ⽪DŽ $ ઼а䘎ѢⲴᆇㅖ $ DŽഐ↔൘〻ᒿ䘀㹼ᰦᡁԜሶⴻࡠа䘎ѢⲴᆇㅖ % 㘼ԫ࣑ % 䘀㹼ᰦ $/ ѝ࿻㓸ᆈ᭮ᆇㅖ ˈ $ ਁ⭏ҶᇊᰦѝᯝˈӾ㘼ԓ⸱Պ࠷ᦒࡠਖањԫ࣑৫䘀㹼DŽሩҾԫ࣑ $ˈᇴᆈಘ $/ ѝሶ࿻㓸ᆈ᭮ᆇㅖ ԓ⸱Պ֯⭘ᗚ⧟䈝ਕᔦ䘏а⇥ᰦ䰤ˈ❦ਾ৸䐣䖜ࡠԫ࣑ԓ⸱ᔰ࿻༴㔗㔝ᗚ⧟ᢗ㹼ˈⴤࡠ䘀㹼Ҷ  ∛。㘼 ᢺᆇㅖᱮ⽪ⲴቿᒅⲴлањս㖞䇠ᖅлᶕˈ֌Ѫла⅑ᱮ⽪ᆇㅖⲴቿᒅս㖞DŽ൘ᱮ⽪䗷ањᆇㅖਾˈԫ࣑ 㘼䈕㌫㔏䈳⭘༴⨶䗷〻ࡉՊ䈳⭘ањㆰঅⲴᆇㅖ߉ቿᆀ〻ᒿˈᢺᇴᆈಘ $/ ѝⲴᆇㅖᱮ⽪൘ቿᒅкˈ਼ᰦ ᇴᆈಘ $/ ѝˈ❦ਾ䈳⭘㌫㔏ѝᯝ䈳⭘ LQW[ˈޕ ⇿њԫ࣑൘ᢗ㹼ᰦˈՊ俆ݸᢺањᆇㅖⲴ $6&,, ⸱᭮ ֌ᮠᢗ㹼䘌䐣䖜ᤷԔˈӾ㘼࠷ᦒࡠԫ࣑  ѝᢗ㹼ˈ੖ࡉ৽ѻDŽ ᯩ⌅ᱟḕⴻ FXUUHQW ਈ䟿ѝᖃࡽ䘀㹼ԫ࣑ਧDŽྲ᷌ FXUUHQW ᖃࡽᱟ ˈቡ࡙⭘ԫ࣑  Ⲵ 766 䘹ᤙㅖ֌Ѫ᫽ ᯝ䈧≲ؑਧ䇮㖞ᡀѝᯝੁ䟿 ˈഐ↔ᡁԜ䴰㾱൘ѝᯝ  Ⲵ༴⨶䗷〻ѝᢗ㹼ԫ࣑࠷ᦒ᫽֌DŽԫ࣑࠷ᦒⲴᇎ⧠ $ ѝᢺᰦ䫏ѝ $ ਁ䘱ањᰦ䫏ѝᯝ䈧≲ؑਧDŽ3& ᵪⲴ 520%,26 ᔰᵪᰦᐢ㓿൘ ቡੁѝᯝ᧗ࡦ㣟⡷  ѪҶ⇿䳄  ∛。࠷ᦒ䘀㹼Ⲵԫ࣑ˈKHDGV 〻ᒿѝᢺᇊᰦಘ㣟⡷  Ⲵ䙊䚃  䇮㖞ᡀ⇿㓿䗷  ∛。 ᆈಘѝˈӾ㘼ᔰ࿻ᢗ㹼ԫ࣑  Ⲵԓ⸱ˈᆼᡀҶӾ⢩ᵳ㓗  ࡠ⢩ᵳ㓗  ԓ⸱Ⲵ᧗ࡦ䖜〫DŽ ᇴ 3,)6& ޕ䇮Ⲵԫ࣑  Ⲵḷᘇᇴᆈಘ޵ᇩˈᒦфᕩࠪḸѝԓ⸱ᤷ䪸᭮ٷ༽䪸֌Ѫԫ࣑  ⭘ᡧḸᤷ䪸ˈᚒ Ḹѝˈ❦ਾᢗ㹼ѝᯝ䘄എᤷԔ ,5(7DŽ䈕ᤷԔՊᕩࠪึḸкⲴึḸᤷޕWDVN˅ԕ৺ḷᘇᇴᆈಘ٬঻˄[I LQLWBVWDFN˅઼ԓ⸱ᤷ䪸ᆈಘ /75 ѝǃ/'7 ⇥䘹ᤙㅖ࣐䖭ࡠ /'75 ѝԕਾˈᢺԫ࣑  Ⲵ⭘ᡧḸᤷ䪸˄[ ᇎ⧠ᯩ⌅ᱟ൘ࡍ࿻ึḸ LQLWBVWDFN ѝӪᐕ䇮㖞ањ䘄എ⧟ຳDŽণᢺԫ࣑  Ⲵ 766 ⇥䘹ᤙㅖ࣐䖭ࡠԫ࣑ᇴ ഐ↔ᖃࡍ࿻ॆ *'7ǃ,'7 ઼ᇊᰦ㣟⡷㔃ᶏਾˈᡁԜቡ࡙⭘ѝᯝ䘄എᤷԔ ,5(7 ᶕ੟ࣘ䘀㹼ㅜ  њԫ࣑DŽާփ  ⭡Ҿ༴Ҿ⢩ᵳ㓗  Ⲵԓ⸱н㜭ⴤ᧕ᢺ᧗ࡦᵳ䖜〫ࡠ⢩ᵳ㓗  Ⲵԓ⸱ѝᢗ㹼ˈնѝᯝ䘄എ᫽֌ᱟਟԕⲴˈ  ᮽԬૂ޻ᆎѣ KHDG ԙ⸷ૂᮦᦤ࠼ᐹ⽰ᝅഴ܅ഴ ޻Ṯ᱖   ᮷Ԧѝˈԓ⸱઼ᮠᦞⲴ㓴㓷ᖒᔿ㿱മ 4-42 ᡰ⽪DŽۿⴞḷ᮷Ԧѝԕ৺ᴰ㓸ᗇࡠⲴ䖟ⴈ᱐ ൠ൰  ᔰ࿻ᒦф⭡Ҿ⋑ᴹ䟷⭘࠶亥ᵪࡦˈᡰԕᆳԜ䜭ⴤ᧕ሩᓄ⢙⨶ൠ൰  ᔰ࿻༴DŽ൘ KHDG 〻ᒿ㕆䈁ࠪⲴ ᇎ䱵⇥䮯ᓖѪ 0%DŽഐ↔൘㓯ᙗൠ൰オ䰤ѝ䘉њĀ޵ṨāⲴԓ⸱઼ᮠᦞ⇥оԫ࣑Ⲵԓ⸱઼ᮠᦞ⇥䜭Ӿ㓯ᙗ  єњԫ࣑Ⲵ൘ /'7 ѝԓ⸱⇥઼ᮠᦞ⇥᧿䘠ㅖⲴ޵ᇩҏ䜭䇮㖞Ѫ˖สൠ൰Ѫ [˗⇥䲀䮯٬Ѫ [IIˈ  ഴ ޻ṮૂԱࣗ൞㲐ᤕ൦൶グ䰪ѣⲺ࠼䞃⽰ᝅഴ  ањㆰঅⲴཊԫ࣑޵Ṩᇎֻ PRYGVD[䇙 '6 ઼ 66 䜭ᤷੁ [F ⇥DŽ PRYD[FV൷Ѫ DŽ䈕䐣䖜䈝ਕՊᢺ &6 ᇴᆈಘ࣐䖭Ѫ [F˄৏Ѫ ˅DŽJR JR ༴DŽᖃᵜ〻ᒿࡊ䘀㹼ᰦᡰᴹ⇥ᇴᆈಘ٬MPSLJR%2276(*⇥䰤䐣䖜㠣 [F VWDUW HQWU\VWDUW 6<6/(1 ޵Ṩঐ⭘Ⲵᴰབྷ⻱ⴈᡷ४ᮠDŽ 6<66(* [޵Ṩ˄KHDG˅ݸ࣐䖭ࡠ [ ༴ˈ❦ਾ〫ࣘࡠ [ ༴DŽ %2276(* [Fᕅሬᡷ४˄ᵜ〻ᒿ˅㻛 %,26 ࣐䖭ࡠ޵ᆈ [F ༴DŽ ᣔ⁑ᔿˈᒦ䐣䖜ࡠ޵ᆈ ˄KHDG ԓ⸱˅ᔰ࿻༴㔗㔝䘀㹼DŽ؍ޕᴰਾ䘋 俆ݸ࡙⭘ %,26 ѝᯝᢺ޵Ṩԓ⸱˄KHDG ԓ⸱˅࣐䖭ࡠ޵ᆈ [ ༴ˈ❦ਾ〫ࣘࡠ޵ᆈ  ༴DŽ ERRWV〻ᒿ  ѝᯝ 0x20 кˈ䈖㓶䈤᰾৲㿱Ā޵Ṩᕅሬ੟ࣘ〻ᒿāаㄐ޵ᇩDŽ ֯⭘Ⲵн਼DŽLinux ㌫㔏Պ൘޵Ṩࡍ࿻ॆᰦ䟽ᯠ䇮㖞 8259A ѝᯝ᧗ࡦ㣟⡷ˈᒦᢺᰦ䫏ѝᯝ䈧≲ؑਧሩᓄࡠ ᧕֯⭘Ҷ ROM BIOS 唈䇔䇮㖞Ⲵѝᯝੁ䟿ਧˈণᇊᰦѝᯝ䈧≲༴⨶Ⲵѝᯝਧӽ❦ᱟ 8DŽ䘉о Linux ㌫㔏ѝ ѪҶቭ䟿䇙〻ᒿㆰঅˈ䘉њᕅሬ੟ࣘᡷ४〻ᒿӵ㜭ཏ࣐䖭䮯ᓖн䎵䗷 16 њᡷ४Ⲵ head ԓ⸱ˈᒦфⴤ 4.9.2 ᕋሲ੥ࣞぁᓅ boot.s ਾаㄐѝĀ㕆䈁䘀㹼ㆰঅ޵Ṩ⽪ֻ〻ᒿāа㢲޵ᇩDŽ 䘉њㆰঅ޵Ṩ⽪ֻⲴ㕆䈁઼䘀㹼ᯩ⌅䈧৲㘳ᵜҖᴰޣ л䶒㔉ࠪ ERRWV ઼ KHDGV 〻ᒿⲴ䈖㓶⌘䟺DŽᴹ ˈ❦ਾ䘰ࠪѝᯝDŽ & 䘀㹼䘉њ唈䇔ѝᯝ༴⨶〻ᒿˈҾᱟቡՊ൘ቿᒅкᱮ⽪ањᆇㅖ ഐѪᡁԜᐢ㓿൘〻ᒿѝ㔉ᡰᴹަԆѝᯝᆹ㻵Ҷањ唈䇔ѝᯝ༴⨶〻ᒿDŽᖃࠪ⧠ањަԆѝᯝᰦˈ㌫㔏ቡՊ ӗ⭏Ҷањнᱟᰦ䫏ѝᯝ઼㌫㔏䈳⭘ѝᯝⲴަԆѝᯝDŽ❦ڦDŽ䘉ᱟ⭡Ҿ 3& ᵪ & ㄟа㹼кᱮ⽪ࠪањᆇㅖ മ4-43 ᱟᡁԜ൘ %RFKV ⁑ᤏ䖟Ԧѝ䘀㹼䘉њ޵Ṩ⽪ֻⲴቿᒅᱮ⽪ᛵߥDŽ㓶ᗳⲴ䈫㘵Պਁ⧠ˈ൘മѝᓅ  ഴ ㆶঋ޻Ṯ䘆㺂Ⲻኅᒋᱴ⽰᛻߫   ањㆰঅⲴཊԫ࣑޵Ṩᇎֻ ZRUG[II*'7 㺘䮯ᓖᱟ  ᆇ㢲ˈਟᇩ㓣  њ᧿䘠ㅖ亩DŽJGWB ZRUG,'7 㺘Ⲵ㓯ᙗสൠ൰ҏᱟ DŽ ZRUG,'7 㺘䮯ᓖᱟ DŽLGWB л䶒࠶࡛ᱟ /,'7 ઼ /*'7 ᤷԔⲴ  ᆇ㢲᫽֌ᮠDŽ ZRUG[&⇥኎ᙗ仇㋂ᓖ .%ˈDŽ ᱟᮠᦞ⇥ˈਟ䈫߉DŽZRUG[ ZRUG[⇥สൠ൰ [DŽ 0% DŽ    ZRUG[))⇥᧿䘠ㅖ DŽ0E⇥䲀䮯٬  ZRUG[&⇥኎ᙗ仇㋂ᓖ .%ˈDŽ $ᱟԓ⸱⇥ˈਟ䈫ᢗ㹼DŽZRUG[ ZRUG[⇥สൠ൰ [DŽ 0% DŽ    ZRUG[))⇥᧿䘠ㅖ DŽ0E⇥䲀䮯٬  ZRUG⇥᧿䘠ㅖ ˈн⭘DŽ⇿њ᧿䘠ㅖ亩ঐ  ᆇ㢲DŽJGW ተ᧿䘠ㅖ㺘 *'7 Ⲵ޵ᇩDŽަѝवਜ਼  њ⇥᧿䘠ㅖDŽㅜ  њн⭘ˈਖ  њᱟԓ⸱઼ᮠᦞ⇥᧿䘠ㅖDŽޘл䶒ᱟ  ٬ᐢᱟ⇥䘹ᤙㅖDŽ䈕⇥Ⲵ㓯ᙗสൠ൰ᱟ DŽ⇥MPSL⌘᜿↔ᰦ ༴DŽ  〫ٿˈOPVZD[❦ਾ䐣䖜㠣⇥䘹ᤙㅖ٬ᤷᇊⲴ⇥ѝ ᣔ⁑ᔿḷᘇ 3(˄ս ˅DŽ؍PRYD[[൘ &5 ѝ䇮㖞 ሩᓄ *'7 㺘ѝㅜ  њ⇥᧿䘠ㅖDŽ  ᣔ⁑ᔿDŽ⇥䘹ᤙㅖ٬؍ޕ䇮㖞᧗ࡦᇴᆈಘ &5˄ণᵪಘ⣦ᘱᆇ˅ˈ䘋  OJGWJGWB࣐䖭 *'75DŽ ᆇ㢲᫽֌ᮠ˖ ᆇ㢲㺘䮯ᓖˈ ᆇ㢲㓯ᙗสൠ൰DŽ OLGWLGWB࣐䖭 ,'75DŽ ᆇ㢲᫽֌ᮠ˖ ᆇ㢲㺘䮯ᓖˈ ᆇ㢲㓯ᙗสൠ൰DŽ PRYGVD[䇙 '6 䟽ᯠᤷੁ [F ⇥DŽ PRYD[%2276(* ࣐䖭 ,'7 ઼ *'7 สൠ൰ᇴᆈಘ ,'75 ઼ *'75DŽ UHSPRYZᢗ㹼䟽༽〫ࣘᤷԔDŽ VXEGLGL VXEVLVL ࣘ . ⅑ˈ⇿⅑〫ࣘањᆇ˄ZRUG˅DŽ〫ޡPRYF[[䇮㖞 PRYHVD[ [RUD[D[ PRYGVD[ DŽ ',˗ⴞⲴս㖞 (66, [PRYD[6<66(*〫ࣘᔰ࿻ս㖞 '6 ѝᯝDŽޣFOL RNBORDG ࣘ .% ᆇ㢲˄޵Ṩ䮯ᓖн䎵䗷 .%˅DŽ〫ޡᢺ޵Ṩԓ⸱〫ࣘࡠ޵ᆈ  ᔰ࿻༴DŽ  MPSGLHGLH MQFRNBORDG㤕⋑ᴹਁ⭏䭉䈟ࡉ䐣䖜㔗㔝䘀㹼ˈ੖ࡉ↫ᗚ⧟DŽ LQW[ PRYD[[6<6/(1 [RUE[E[$+䈫ᡷ४࣏㜭ਧ˗$/䴰䈫Ⲵᡷ४ᮠ˄˅DŽ [˅DŽ㕃ߢ४ս㖞˄[ޕ%;䈫PRYHVD[(6 PRYD[6<66(*&/սǃᱟ⻱䚃ਧ儈  սˈս 䎧࿻ᡷ४ਧ˄Ӿ  䇑˅DŽ PRYF[['+⻱ཤਧ˗'/傡ࣘಘਧ˗&+ ս⻱䚃ਧվ  ս˗ PRYG[[࡙⭘ %,26 ѝᯝ LQW[ ࣏㜭  Ӿ੟ࣘⴈ䈫ਆ KHDG ԓ⸱DŽ ORDGBV\VWHP ࣐䖭޵Ṩԓ⸱ࡠ޵ᆈ [ ᔰ࿻༴DŽ  PRYVS[䇮㖞ѤᰦḸᤷ䪸DŽަ٬䴰བྷҾ〻ᒿᵛㄟᒦᴹаᇊオ䰤ণਟDŽ PRYVVD[  ањㆰঅⲴཊԫ࣑޵Ṩᇎֻ PRYZV\VWHPBLQWHUUXSWD[䇮㖞㌫㔏䈳⭘䲧䱡䰘᧿䘠ㅖDŽਆ㌫㔏䈳⭘༴⨶〻ᒿൠ൰DŽ  HVL PRYOHG[  HVL PRYOHD[ ѝˈ❦ਾ䇮㖞䈕᧿䘠ㅖDŽ ,6) ޕHF[ HVLᢺ ,'7 ᧿䘠ㅖ [ ൠ൰᭮ OHDLGW PRYO[HF[ᔰᵪᰦ %,26 䇮㖞Ⲵᰦ䫏ѝᯝੁ䟿ਧ DŽ䘉䟼ⴤ᧕֯⭘ᆳDŽ PRYZ[(G[ѝᯝ䰘㊫රᱟ ˄ቿ㭭ѝᯝ˅ˈ⢩ᵳ㓗  ᡆ⺜Ԧ֯⭘DŽ PRYZWLPHUBLQWHUUXSWD[䇮㖞ᇊᰦѝᯝ䰘᧿䘠ㅖDŽਆᇊᰦѝᯝ༴⨶〻ᒿൠ൰DŽ PRYO[HD[ѝᯝ〻ᒿ኎޵Ṩˈণ ($; 儈ᆇᱟ޵Ṩԓ⸱⇥䘹ᤙㅖ [DŽ ൘ ,'7 㺘ㅜ  ઼ㅜ ˄[˅亩༴࠶࡛䇮㖞ᇊᰦѝᯝ䰘᧿䘠ㅖ઼㌫㔏䈳⭘䲧䱡䰘᧿䘠ㅖDŽ RXWEDOG[ PRYEDKDO 䙊䚃 DŽޕRXWEDOG[࠶є⅑ᢺࡍ࿻䇑ᮠ٬߉ PRYO[HG[䙊䚃  ⲴㄟਓDŽ ˅ˈণ仁⦷ +=DŽPRYO/$7&+HD[ࡍ࿻䇑ᮠ٬䇮㖞Ѫ /$7&+˄ RXWEDOG[ PRYO[HG[ 㣟⡷᧗ࡦᆇᇴᆈಘ߉ㄟਓDŽ PRYE[DO᧗ࡦᆇ˖䇮㖞䙊䚃  ᐕ֌൘ᯩᔿ ǃ䇑ᮠࡍ٬䟷⭘Ҽ䘋ࡦDŽ 䇮㖞  ᇊᰦ㣟⡷DŽᢺ䇑ᮠಘ䙊䚃  䇮㖞ᡀ⇿䳄  ∛。ੁѝᯝ᧗ࡦಘਁ䘱ањѝᯝ䈧≲ؑਧDŽ OVVLQLWBVWDFNHVS PRYD[JV PRYD[IV PRYD[HV PRYD[GV PRYO[HD[൘᭩ਈҶ *'7 ѻਾ䟽ᯠ࣐䖭ᡰᴹ⇥ᇴᆈಘDŽ FDOOVHWXSBJGW䇮㖞 *'7DŽ FDOOVHWXSBLGW䇮㖞 ,'7DŽݸᢺ  њѝᯝ䰘䜭ປ唈䇔༴⨶䗷〻Ⲵ᧿䘠ㅖDŽ ൘ᯠⲴս㖞䟽ᯠ䇮㖞 ,'7 ઼ *'7 㺘DŽ OVVLQLWBVWDFNHVS PRYD[GV PRYO[HD[[ ᱟ *'7 ѝᮠᦞ⇥䘹ᤙㅖDŽ 俆ݸ࣐䖭ᮠᦞ⇥ᇴᆈಘ '6ǃึḸ⇥ᇴᆈಘ 66 ઼ึḸᤷ䪸 (63DŽᡰᴹ⇥Ⲵ㓯ᙗสൠ൰䜭ᱟ DŽ VWDUWXSB WH[W /'7B6(/ [ԫ࣑  Ⲵ /'7 ⇥䘹ᤙㅖDŽ 766B6(/ ;ԫ࣑  Ⲵ 766 ⇥䘹ᤙㅖDŽ /'7B6(/ [ԫ࣑  Ⲵ /'7 ⇥䘹ᤙㅖDŽ 766B6(/ [ԫ࣑  Ⲵ 766 ⇥䘹ᤙㅖDŽ 6&51B6(/ [ቿᒅᱮ⽪޵ᆈ⇥䘹ᤙㅖDŽ ণ⇿䳄  ∛。ਁ䘱а⅑ѝᯝ䈧≲DŽˈᇊᰦಘࡍ࿻䇑ᮠ٬ /$7&+ ൘ࡍ࿻ॆᆼᡀѻਾ〻ᒿ〫ࣘࡠԫ࣑  ᔰ࿻ᢗ㹼ˈᒦ൘ᰦ䫏ѝᯝ᧗ࡦл䘋㹼ԫ࣑  ઼  ѻ䰤Ⲵ࠷ᦒ᫽֌DŽ ᣔ⁑ᔿࡍ࿻ॆ䇮㖞ԓ⸱ǃᰦ䫏ѝᯝԓ⸱ǃ㌫㔏䈳⭘ѝᯝԓ⸱઼єњԫ࣑Ⲵԓ⸱DŽ؍KHDGVवਜ਼  ս  䘲ᖃⲴ᧿䘠ㅖ亩ণਟDŽޕਟԕⴤ᧕֯⭘ boot.s ѝ䇮㖞Ⲵ IDT ઼ GDT 㺘ս㖞ˈປޘ ᤱа㠤DŽᖃ❦ˈቡᵜ〻ᒿᶕ䈤ᡁԜᆼ؍␵ᲠˈҏѪҶоਾ䶒 Linux 0.11 ޵ṨⓀԓ⸱ѝ䘉єњ㺘Ⲵ䇮㖞ᯩᔿ ᣔ⁑ᔿਾˈhead.s 〻ᒿ䟽ᯠᔪ・઼䇮㖞 IDTǃGDT 㺘Ⲵѫ㾱৏ഐᱟѪҶ䇙〻ᒿ൘㔃ᶴк∄䖳؍ޕ൘䘋 4.9.3 ཐԱࣗ޻Ṯぁᓅ head.s  ZRUG[$$ᕅሬᡷ४ᴹ᭸ḷᘇDŽᗵ享༴Ҿᕅሬᡷ४ᴰਾ  ᆇ㢲༴DŽ RUJ JGW ༴DŽ 〫ٿZRUG[FJGW*'7 㺘Ⲵ㓯ᙗสൠ൰൘ [F ⇥Ⲵ  ањㆰঅⲴཊԫ࣑޵Ṩᇎֻ ൠ൰㾱҈DŽ〫ٿHE[ ᇎ䱵ᱮ⽪ս㖞ሩᓄⲴᱮ⽪޵ᆈ PRYEDOJV VKOHE[ഐѪ൘ቿᒅк⇿њᆇㅖ䘈ᴹањ኎ᙗᆇ㢲ˈഐ↔ᆇㅖ PRYOVFUBORFE[޽Ӿਈ䟿 VFUBORF ѝਆⴞࡽᆇㅖᱮ⽪ս㖞٬DŽ PRYE[JV PRY6&51B6(/HE[❦ਾ䇙 *6 ᤷੁᱮ⽪޵ᆈ⇥˄[E˅DŽ SXVKOHE[ ᆈDŽ؍ᆈ㾱⭘ࡠⲴᇴᆈಘˈ($; ⭡䈳⭘㘵䍏䍓؍SXVKJV俆ݸ ZULWHBFKDU ᱮ⽪ᆇㅖᆀ〻ᒿDŽਆᖃࡽݹḷս㖞ᒦᢺ $/ ѝⲴᆇㅖᱮ⽪൘ቿᒅкDŽᮤቿਟᱮ⽪ ; њᆇㅖDŽ  UHW OLGWOLGWBRSFRGHᴰਾ⭘  ᆇ㢲᫽֌ᮠ࣐䖭 ,'75 ᇴᆈಘDŽ MQHUSBLGW GHFHF[ DGGOHGL  HGL PRYOHG[  HGL PRYOHD[USBLGW PRYHF[ᗚ⧟䇮㖞ᡰᴹ  њ䰘᧿䘠ㅖ亩DŽ OHDLGWHGL PRYZ[(G[ѝᯝ䰘㊫රˈ⢩ᵳ㓗Ѫ DŽ PRYZG[D[ PRYO[HD[䘹ᤙㅖѪ [DŽ OHDLJQRUHBLQWHG[䇮㖞ᯩ⌅о䇮㖞ᇊᰦѝᯝ䰘᧿䘠ㅖⲴᯩ⌅аṧDŽ ᢺᡰᴹ  њѝᯝ䰘᧿䘠ㅖ䇮㖞Ѫ֯⭘唈䇔༴⨶䗷〻DŽVHWXSBLGW ᆇ㢲઼  ᆇ㢲Ⲵ޵ᇩˈ❦ਾ࡙⭘䈕ᇴᆈಘሩᗚ⧟ᖰ ,'7 㺘ѝປݵ唈䇔ѝᯝ䰘᧿䘠ㅖ޵ᇩDŽ  LJQRUHBLQWDŽ䇮㖞Ⲵާփᯩ⌅ᱟ˖俆ݸ൘ HD[ ઼ HG[ ᇴᆈಘሩѝ࠶࡛䇮㖞ྭ唈䇔ѝᯝ䰘᧿䘠ㅖⲴ ൷֯⭘唈䇔Ⲵѝᯝ༴⨶䗷〻ˈ䘉⇥ԓ⸱Ჲᰦ䇮㖞 ,'7 㺘ѝᡰᴹ  њѝᯝ䰘᧿䘠ㅖ䜭Ѫ਼ањ唈䇔٬ UHW OJGWOJGWBRSFRGH ֯⭘  ᆇ㢲᫽֌ᮠ OJGWBRSFRGH 䇮㖞 *'7 㺘ս㖞઼䮯ᓖDŽVHWXSBJGW ԕлᱟ䇮㖞 *'7 ઼ ,'7 ѝ᧿䘠ㅖ亩Ⲵᆀ〻ᒿDŽ  LUHWᢗ㹼ѝᯝ䘄എᤷԔˈӾ㘼࠷ᦒࡠ⢩ᵳ㓗  Ⲵԫ࣑  ѝᢗ㹼DŽ ḸDŽޕSXVKOWDVNᢺԓ⸱ᤷ䪸 ḸDŽޕSXVKO[Iᢺᖃࡽተ䜘オ䰤ԓ⸱⇥䘹ᤙㅖ ḸDŽޕSXVKIOᢺḷᘇᇴᆈಘ٬ Ḹ˅DŽޕ Ḹ˄ҏਟԕⴤ᧕ᢺ (63ޕSXVKOLQLWBVWDFNᢺึḸᤷ䪸 ḸDŽޕSXVKO[ᢺԫ࣑  ᖃࡽተ䜘オ䰤ᮠᦞ⇥˄ึḸ⇥˅䘹ᤙㅖ VWL⧠൘ᔰ੟ѝᯝˈᒦ൘Ḹѝ㩕䙐ѝᯝ䘄എᰦⲴ൪ᲟDŽ ᆈ൘ FXUUHQW ਈ䟿ѝDŽ؍  PRYOFXUUHQWᢺᖃࡽԫ࣑ਧ OOGWD[75 ઼ /'75 ਚ䴰Ӫᐕ࣐䖭а⅑ˈԕਾ &38 Պ㠚ࣘ༴⨶DŽ PRYO/'7B6(/HD[ᢺԫ࣑  Ⲵ /'7 ⇥䘹ᤙㅖ࣐䖭ࡠተ䜘᧿䘠ㅖ㺘ᇴᆈಘ /'75DŽ OWUD[ PRYO766B6(/HD[ᢺԫ࣑  Ⲵ 766 ⇥䘹ᤙㅖ࣐䖭ࡠԫ࣑ᇴᆈಘ 75DŽ SRSIO  HVS DQGO[IIIIEIII SXVKIO༽սḷᘇᇴᆈಘ ()/$*6 ѝⲴ፼྇ԫ࣑ḷᘇDŽ ྭҶˈ⧠൘ᡁԜѪ〫ࣘࡠԫ࣑ ˄ԫ࣑ $˅ѝᢗ㹼ᶕ᫽֌ึḸ޵ᇩˈ൘ึḸѝӪᐕᔪ・ѝᯝ䘄എᰦⲴ൪ᲟDŽ  HVL PRYOHG[  HVL PRYOHD[ ѝˈ❦ਾ䇮㖞䈕᧿䘠ㅖDŽ ,6) ޕHF[ HVLᢺ ,'7 ᧿䘠ㅖ亩 [ ൠ൰᭮ OHDLGW PRYO[HF[㌫㔏䈳⭘ੁ䟿ਧᱟ [DŽ PRYZ[HIG[䲧䱡䰘㊫රᱟ ˈ⢩ᵳ㓗  Ⲵ〻ᒿਟᢗ㹼DŽ  ањㆰঅⲴཊԫ࣑޵Ṩᇎֻ ]SXVKOHD SXVKOHE[ SXVKOHF[ SXVKOHG[ SXVKGV V\VWHPBLQWHUUXSW DOLJQ ㌫㔏䈳⭘ѝᯝ LQW[ ༴⨶〻ᒿDŽ䈕⽪ֻਚᴹањᱮ⽪ᆇㅖ࣏㜭DŽ  LUHW SRSGV SRSOHD[ OMPS766B6(/৫ᢗ㹼DŽ  FXUUHQWˈᒦ䐣䖜ࡠԫ࣑ ޕPRYOFXUUHQW㤕ᖃࡽԫ࣑ᱟ ˈࡉᢺ  ᆈ MPSI ٬ᰐ⭘ˈն䴰㾱߉кDŽ〫ٿOMPS766B6(/৫ᢗ㹼DŽ⌘᜿䐣䖜Ⲵ  FXUUHQWˈᒦ䐣䖜ࡠԫ࣑ ޕPRYOHD[FXUUHQW㤕ᖃࡽԫ࣑ᱟ ˈࡉᢺ  ᆈ MHI FPSOHD[FXUUHQW PRYOHD[᧕⵰ࡔᯝᖃࡽԫ࣑ˈ㤕ᱟԫ࣑  ࡉ৫ᢗ㹼ԫ࣑ ˈᡆ৽ѻDŽ RXWEDO[ $ ਁ䘱 (2, ભԔDŽ PRYE[DO❦ਾ・࡫ݱ䇨ަԆ⺜Ԧѝᯝˈণੁ PRYD[GV PRYO[HD[俆ݸ䇙 '6 ᤷੁ޵Ṩᮠᦞ⇥DŽ SXVKOHD[ SXVKGV WLPHUBLQWHUUXSW DOLJQ 䘉ᱟᇊᰦѝᯝ༴⨶〻ᒿDŽަѝѫ㾱ᢗ㹼ԫ࣑࠷ᦒ᫽֌DŽ  LUHW SRSGV SRSOHD[ FDOOZULWHBFKDU Ⲵԓ⸱ˈ䈳⭘ᱮ⽪〻ᒿᱮ⽪൘ቿᒅкDŽ & PRYOHD[൘ $/ ѝᆈ᭮ᆇㅖ PRYD[GV PRYO[HD[俆ݸ䇙 '6 ᤷੁ޵Ṩᮠᦞ⇥ˈഐѪѝᯝ〻ᒿ኎Ҿ޵ṨDŽ SXVKOHD[ SXVKGV LJQRUHBLQW DOLJQ DŽ & LJQRUHBLQW ᱟ唈䇔Ⲵѝᯝ༴⨶〻ᒿˈ㤕㌫㔏ӗ⭏ҶަԆѝᯝˈࡉՊ൘ቿᒅкᱮ⽪ањᆇㅖ ԕлᱟ  њѝᯝ༴⨶〻ᒿ˖唈䇔ѝᯝǃᇊᰦѝᯝ઼㌫㔏䈳⭘ѝᯝDŽ  UHW SRSJV ᆈⲴᇴᆈಘ޵ᇩˈ䘄എDŽ؍SRSOHE[ᒦᕩࠪ ᆈ䎧ᶕ˄VFUBORF˅ˈ؍PRYOHE[VFUBORFᴰਾᢺ䘉њս㖞٬ PRYOHE[ MEI FPSOHE[ LQFOHE[ᓄлањᱮ⽪ս㖞DŽྲ᷌䈕ս㖞བྷҾ ˈࡉ༽սᡀ DŽ VKUHE[ᢺᆇㅖ᭮ࡠᱮ⽪޵ᆈਾᢺս㖞٬䲔  ࣐ ˈ↔ᰦս㖞٬ሩ  ањㆰঅⲴཊԫ࣑޵Ṩᇎֻ   OGWWUDFHELWPDS ORQJ/'7B6(/[  HVFVVVGVIVJV ORQJ  HE[HVSHESHVLHGL ORQJ  HLSHIODJVHD[HF[HG[ ORQJ  HVSVVHVSVVFU ORQJ  HVSVV ORQJNUQBVWN[  EDFNOLQN ORQJWVV л䶒ᱟԫ࣑  Ⲵ 766 ⇥Ⲵ޵ᇩDŽ⌘᜿ަѝḷਧㅹᆇ⇥൘ԫ࣑࠷ᦒᰦнՊ᭩ਈDŽ TXDG[FIIIㅜ  њተ䜘ᮠᦞ⇥᧿䘠ㅖˈሩᓄ䘹ᤙㅖᱟ [DŽ TXDG[FIDIIㅜ  њተ䜘ԓ⸱⇥᧿䘠ㅖˈሩᓄ䘹ᤙㅖᱟ [IDŽ TXDG[ㅜ  њ᧿䘠ㅖˈн⭘DŽOGW DOLJQ л䶒ᱟԫ࣑  Ⲵ /'7 㺘⇥ѝⲴተ䜘⇥᧿䘠ㅖDŽ  ZRUG[ึḸ⇥਼޵Ṩᮠᦞ⇥DŽ ս㖞DŽ〫ٿ⇥ORQJLQLWBVWDFNึḸ (63 ึḸᤷ䪸٬DŽᣔ⁑ᔿᰦ⭘Ҿ࣐䖭 66؍ޕࡊ䘋LQLWBVWDFN ILOOࡍ࿻޵ṨึḸオ䰤DŽ HQGBJGW ZRUG[OGW[H[ㅜ  њᱟ /'7 ⇥Ⲵ᧿䘠ㅖDŽަ䘹ᤙㅖᱟ [ [ㅜ  њᱟ 766 ⇥Ⲵ᧿䘠ㅖDŽަ䘹ᤙㅖᱟ [ZRUG[WVV[H ZRUG[OGW[H[ㅜ  њᱟ /'7 ⇥Ⲵ᧿䘠ㅖDŽަ䘹ᤙㅖᱟ [ [ㅜ  њᱟ 766 ⇥Ⲵ᧿䘠ㅖDŽަ䘹ᤙㅖᱟ [ZRUG[WVV[H Eㅜ  њᱟᱮ⽪޵ᆈ⇥᧿䘠ㅖDŽަ䘹ᤙㅖᱟ [DŽTXDG[F IIㅜ  њᱟ޵Ṩᮠᦞ⇥᧿䘠ㅖDŽަ䘹ᤙㅖᱟ [DŽTXDG[F DIIㅜ  њᱟ޵Ṩԓ⸱⇥᧿䘠ㅖDŽަ䘹ᤙㅖᱟ [DŽTXDG[F TXDG[*'7 㺘DŽㅜ  њ᧿䘠ㅖн⭘DŽJGW  ঐ⭘ .%DŽޡˈњ䰘᧿䘠ㅖˈ⇿њ  ᆇ㢲  ޡILOO,'7 オ䰤DŽLGW DOLJQ  ORQJJGW HQGBJGWJGW ࣐䖭 *'75 ᇴᆈಘⲴ  ᆇ㢲᫽֌ᮠ˖㺘䮯ᓖ઼สൠ൰DŽ ZRUG OJGWBRSFRGH ORQJLGW ࣐䖭 ,'75 ᇴᆈಘⲴ  ᆇ㢲᫽֌ᮠ˖㺘䮯ᓖ઼สൠ൰DŽ ZRUG OLGWBRSFRGH DOLJQ  ORQJቿᒅᖃࡽᱮ⽪ս㖞DŽ᤹Ӿᐖк䀂ࡠਣл䀂亪ᒿᱮ⽪DŽVFUBORF ORQJᖃࡽԫ࣑ਧ˄ ᡆ ˅DŽFXUUHQW    LUHW SRSGV SRSOHG[ SRSOHF[ SRSOHE[ SRSOHD[ FDOOZULWHBFKDU❦ਾ䈳⭘ᱮ⽪ᆇㅖᆀ〻ᒿ ZULWHBFKDUˈᱮ⽪ $/ ѝⲴᆇㅖDŽ PRYG[GV PRYO[HG[俆ݸ䇙 '6 ᤷੁ޵Ṩᮠᦞ⇥DŽ  ањㆰঅⲴཊԫ࣑޵Ṩᇎֻ  XVUBVWN ILOO䘉ᱟԫ࣑  Ⲵ⭘ᡧḸオ䰤DŽ  MPSWDVN ORRSE PRYO[IIIHF[ᔦᰦа⇥ᰦ䰤ˈᒦ䐣䖜ࡠᔰ࿻༴㔗㔝ᗚ⧟ᱮ⽪DŽ LQW[ᢗ㹼㌫㔏䈳⭘ˈᱮ⽪ᆇㅖDŽ ᇴᆈಘѝDŽ /$ ޕ᭮ % PRYODOᢺ䴰㾱ᱮ⽪Ⲵᆇㅖ WDVN MPSWDVN䐣䖜ࡠԫ࣑ԓ⸱ᔰ࿻༴㔗㔝ᱮ⽪ᆇㅖDŽ ORRSE PRYO[IIIHF[ᢗ㹼ᗚ⧟ˈ䎧ᔦᰦ֌⭘DŽ LQW[ᢗ㹼㌫㔏䈳⭘ˈᱮ⽪ᆇㅖDŽ ᇴᆈಘѝDŽ /$ ޕ᭮ $ PRYODOᢺ䴰㾱ᱮ⽪Ⲵᆇㅖ PRYZD[GVഐѪԫ࣑⋑ᴹ֯⭘ተ䜘ᮠᦞˈᡰԕ䘉єਕਟⴱ⮕DŽ PRYO[HD[俆ݸ䇙 '6 ᤷੁԫ࣑Ⲵተ䜘ᮠᦞ⇥DŽ WDVN DŽ % ઼ $ л䶒ᱟԫ࣑  ઼ԫ࣑  Ⲵ〻ᒿˈᆳԜ࠶࡛ᗚ⧟ᱮ⽪ᆇㅖ  NUQBVWN ILOO䘉ᱟԫ࣑  Ⲵ޵ṨḸオ䰤DŽަ⭘ᡧḸⴤ᧕֯⭘ࡍ࿻Ḹオ䰤DŽ   OGWWUDFHELWPDS ORQJ/'7B6(/[  HVFVVVGVIVJV ORQJ[[I[[[[  HVSHESHVLHGL ORQJXVUBVWN  HD[HF[HG[HE[ ORQJ  HLSHIODJV ORQJWDVN[  HVSVVHVSVVFU ORQJ  HVSVV ORQJNUQBVWN[  EDFNOLQN ORQJWVV  TXDG[FIII䘹ᤙㅖᱟ [ˈสൠ൰ [DŽ TXDG[FIDII䘹ᤙㅖᱟ [Iˈสൠ൰ [DŽ TXDG[ㅜ  њ᧿䘠ㅖˈн⭘DŽOGW DOLJQ л䶒ᱟԫ࣑  Ⲵ /'7 㺘⇥޵ᇩ઼ 766 ⇥޵ᇩDŽ  NUQBVWN ILOO䘉ᱟԫ࣑  Ⲵ޵ṨḸオ䰤DŽ  ањㆰঅⲴཊԫ࣑޵Ṩᇎֻ ⺜Ԧ㌫㔏 ᫽֌㌫㔏޵Ṩ ᫽֌㌫㔏ᴽ࣑ ⭘ᡧᓄ⭘〻ᒿ ⢩ᇊⲴ࣏㜭DŽ൘ᆼᡀҶᓄ⭘〻ᒿᡰ㾱≲Ⲵᴽ࣑ਾˈ᫽֌㌫㔏৸֯ CPU ӾṨᗳᘱ࠷ᦒഎ⭘ᡧᘱˈӾ㘼䘄എ Ⲵ৲ᮠ٬䈳⭘⢩ᇊⲴ㌫㔏䈳⭘ᴽ࣑〻ᒿˈ㘼䘉Ӌᴽ࣑〻ᒿࡉṩᦞ䴰㾱޽䈳⭘ᓅቲⲴаӋ᭟ᤱ࠭ᮠԕᆼᡀ ⭘ᤷԔ(int x80)ˈ֯ CPU Ӿ⭘ᡧᘱ˄User Mode˅࠷ᦒࡠṨᗳᘱ˄Kernel Model˅ˈ❦ਾ᫽֌㌫㔏ṩᦞާփ ൘অ޵Ṩ⁑ᔿⲴ㌫㔏ѝˈ᫽֌㌫㔏ᡰᨀ׋ᴽ࣑Ⲵ⍱〻Ѫ˖ᓄ⭘ѫ〻ᒿ֯⭘ᤷᇊⲴ৲ᮠ٬ᢗ㹼㌫㔏䈳 ᓖᘛˈн䏣ѻ༴ѫ㾱ᱟቲ⅑㔃ᶴᙗнᕪDŽ ⌘䟺Ⲵ Linux 0.11 ޵Ṩˈࡉᱟ䟷⭘Ҷঅ޵Ṩ⁑ᔿDŽঅ޵Ṩ⁑ᔿⲴѫ㾱Ո⛩ᱟ޵Ṩԓ⸱㔃ᶴ㍗ࠁǃᢗ㹼䙏 ⴞࡽˈ᫽֌㌫㔏޵ṨⲴ㔃ᶴ⁑ᔿѫ㾱ਟ࠶ѪᮤփᔿⲴঅ޵Ṩ⁑ᔿ઼ቲ⅑ᔿⲴᗞ޵Ṩ⁑ᔿDŽ㘼ᵜҖᡰ 5.1 Linux ޻Ṯ⁗ᕅ ᇎ傼⧟ຳⲴᯩ⌅DŽ 㾱ᶴᡀ⁑ඇDŽ❦ਾሩⓀԓ⸱ѝࠪ⧠Ⲵࠐњ䟽㾱ᮠᦞ㔃ᶴ䘋㹼䈤᰾DŽᴰਾ᧿䘠Ҷᶴᔪ Linux 0.11 ޵Ṩ㕆䈁 ൘ᵜㄐ޵ᇩѝˈᡁԜ俆ݸสҾ Linux 0.11 ⡸Ⲵ޵ṨⓀԓ⸱ˈㆰ᰾ൠ᧿䘠 Linux ޵ṨⲴสᵜփ㌫㔃ᶴǃѫ 䈳ᓖሩ⺜Ԧ䍴ⓀⲴ䇯䰞ˈᒦѪ䇑㇇ᵪкⲴ⭘ᡧ〻ᒿᨀ׋ањ儈㓗Ⲵᢗ㹼⧟ຳ઼ሩ⺜ԦⲴ㲊ᤏ᧕ਓDŽ Linux ޵ṨⲴѫ㾱⭘䙄ቡᱟѪҶо䇑㇇ᵪ⺜Ԧ䘋㹼Ӕӂˈᇎ⧠ሩ⺜Ԧ䜘ԦⲴ㕆〻᧗ࡦ઼᧕ਓ᫽֌ˈ ഴ  ᬃ֒㌱㔕㓺ᡆ䜞࠼Ⱦ  䏓Ⲵ䜘࠶ˈᆳѫ㾱⭘Ҿሩ⺜Ԧ䍴ⓀⲴᣭ䊑઼䇯䰞䈳ᓖDŽޤᱟᵜҖᡰᝏ 䘉Ӌ〻ᒿवᤜ X デਓ㌫㔏ǃshell ભԔ䀓䟺㌫㔏ԕ৺䛓Ӌ޵Ṩ㕆〻᧕ਓㅹ㌫㔏〻ᒿ˗᫽֌㌫㔏޵Ṩ〻ᒿণ ᫽֌㌫㔏ᴽ࣑〻ᒿᱟᤷ䛓Ӌੁ⭘ᡧᨀ׋Ⲵᴽ࣑㻛ⴻ֌ᱟ᫽֌㌫㔏䜘࠶࣏㜭Ⲵ〻ᒿDŽ൘ Linux ᫽֌㌫㔏кˈ 㿱മ 5-1 ᡰ⽪DŽ⭘ᡧᓄ⭘〻ᒿᱟᤷ䛓Ӌᆇ༴⨶〻ᒿǃInternet ⍿㿸ಘ〻ᒿᡆ⭘ᡧ㠚㹼㕆ࡦⲴ਴⿽ᓄ⭘〻ᒿ˗ ањᆼᮤਟ⭘Ⲵ᫽֌㌫㔏ѫ㾱⭡ 4 䜘࠶㓴ᡀ˖⺜Ԧǃ᫽֌㌫㔏޵Ṩǃ᫽֌㌫㔏ᴽ઼࣑⭘ᡧᓄ⭘〻ᒿˈ ⁑ᔿ䘀㹼ᯩᔿᐕ֌৏⨶DŽ ᣔ؍ 80X86 ޣ޵ᇩᰦ޽䘄എᶕ৲㘳ᵜㄐ޵ᇩDŽ൘䰵䈫ᵜㄐѻࡽ䈧ݸ༽ҐᡆᆖҐᴹޣ䗷ˈᖵ䰵䈫ࡠਾ䶒⴨ ⴻ֌ᱟሩ޵ṨⓀԓ⸱Ⲵᙫ㔃ᾲ䘠ˈҏਟԕ֌Ѫ䰵䈫ਾ㔝ㄐ㢲Ⲵ৲㘳ؑ᚟DŽሩҾ䖳䳮⨶䀓Ⲵൠᯩਟԕݸ䐣 ޵ṨⓀ᮷Ԧ Linux/ⴞᖅлⲴㅜањ᮷Ԧ Makefile ᔰ࿻ˈሩ⇿а㹼ԓ⸱䘋㹼䈖㓶⌘䟺䈤᰾DŽᵜㄐ޵ᇩਟԕ 仈ˈӾ↓ޕ㌫DŽ᧕лᶕቡⴤ᧕࠷ޣ㓴㓷ᖒᔿԕ৺ᆀⴞᖅѝ਴њԓ⸱᮷ԦⲴѫ㾱࣏㜭ԕ৺สᵜ䈳⭘Ⲵቲ⅑ ᵜㄐ俆ݸᾲ㾱ӻ㓽Ҷ Linux ޵ṨⲴ㕆ࡦ⁑ᔿ઼փ㌫㔃ᶴˈ❦ਾ䈖㓶᧿䘠Ҷ Linux ޵ṨⓀԓ⸱ⴞᖅѝ ㅜ5ㄐLinux ޵Ṩփ㌫㔃ᶴ  LQX[ ޵Ṩ⁑ᔿ/ ᭟ᤱ࠭ᮠ ㌫㔏ᴽ࣑ ѫ〻ᒿ ࡠ 0.96 ⡸᡽ᴹ˅DŽ 㺘⽪ Linux 0.11 ѝ䘈ᵚᇎ⧠Ⲵ䜘࠶˄Ӿ Linux 0.95 ⡸᡽ᔰ࿻䙀↕ᇎ⧠㲊ᤏ᮷Ԧ㌫㔏ˈ㘼㖁㔌᧕ਓⲴ᭟ᤱ ㌫ˈ㲊㓯઼㲊Ṷ䜘࠶ޣ㌫㿱മ 5-3 ᡰ⽪DŽަѝⲴ䘎㓯ԓ㺘ᆳԜѻ䰤Ⲵ׍䎆ޣ䘉ࠐњ⁑ඇѻ䰤Ⲵ׍䎆 ⿽㖁㔌䙊ؑḷ߶Ⲵ䇯䰞ᒦ᭟ᤱ䇨ཊ㖁㔌⺜ԦDŽ ⿽᮷Ԧ㌫㔏ṬᔿDŽ䘋〻䰤䙊ؑ⁑ඇᆀ㌫㔏⭘Ҿ᭟ᤱཊ⿽䘋〻䰤Ⲵؑ᚟ӔᦒᯩᔿDŽ㖁㔌᧕ਓ⁑ඇᨀ׋ሩཊ ᨀ׋ањ䙊⭘Ⲵ᮷Ԧ᧕ਓˈ䳀㯿Ҷ਴⿽⺜Ԧ䇮༷Ⲵн਼㓶㢲DŽӾ㘼ᨀ׋ᒦ᭟ᤱоަԆ᫽֌㌫㔏ެᇩⲴཊ എᶕDŽ᮷Ԧ㌫㔏⁑ඇ⭘Ҿ᭟ᤱሩཆ䜘䇮༷Ⲵ傡઼ࣘᆈۘDŽ㲊ᤏ᮷Ԧ㌫㔏⁑ඇ䙊䗷ੁᡰᴹⲴཆ䜘ᆈۘ䇮༷ Ⲵ޵ᆈᇩ䟿DŽᒦਟԕ࡙⭘᮷Ԧ㌫㔏ᢺᲲᰦн⭘Ⲵ޵ᆈᮠᦞඇӔᦒࡠཆ䜘ᆈۘ䇮༷к৫ˈᖃ䴰㾱ᰦ޽Ӕᦒ ޵ᆈ४ˈ਼ᰦˈ޵ᆈ㇑⨶⁑ඇ䘈᭟ᤱ㲊ᤏ޵ᆈ㇑⨶ᯩᔿˈ֯ᗇ Linux ᭟ᤱ䘋〻֯⭘∄ᇎ䱵޵ᆈオ䰤ᴤཊ ӛᵪಘѫޡൠޘᡰᴹ䘋〻㜭ཏᆹ؍⺞䇱޵Ṩ㜭৺ᰦൠᢗ㹼⺜Ԧ᫽֌DŽ޵ᆈ㇑⨶⁑ඇ⭘Ҿ؍䰞 CPUˈ਼ᰦ ᒣਸ⨶ൠ䇯ޜ䘋〻䈳ᓖ⁑ඇ⭘ᶕ䍏䍓᧗ࡦ䘋〻ሩ CPU 䍴ⓀⲴ֯⭘DŽᡰ䟷ਆⲴ䈳ᓖㆆ⮕ᱟ਴䘋〻㜭ཏ 〻䰤䙊ؑ⁑ඇ઼㖁㔌᧕ਓ⁑ඇDŽ Linux ޵Ṩѫ㾱⭡ 5 њ⁑ඇᶴᡀˈᆳԜ࠶࡛ᱟ˖䘋〻䈳ᓖ⁑ඇǃ޵ᆈ㇑⨶⁑ඇǃ᮷Ԧ㌫㔏⁑ඇǃ䘋 5.2 Linux ޻Ṯ㌱㔕։㌱㔉ᶺ ഴ  ঋ޻Ṯ⁗ᕅⲺㆶঋ㔉ᶺ⁗ශ  ᴽ࣑Ⲵѫ〻ᒿቲǃᢗ㹼㌫㔏䈳⭘Ⲵᴽ࣑ቲ઼᭟ᤱ㌫㔏䈳⭘Ⲵᓅቲ࠭ᮠDŽ㿱മ 5-2 ᡰ⽪DŽ ࡠᓄ⭘〻ᒿѝ㔗㔝ᢗ㹼ਾ䶒ⲴᤷԔDŽഐ↔ᾲ㾱ൠ䇢ˈঅ޵Ṩ⁑ᔿⲴ޵Ṩҏਟ㋇⮕ൠ࠶Ѫйњቲ⅑˖䈳⭘  LQX[ ޵Ṩ㌫㔏փ㌫㔃ᶴ/ 㖁㔌᧕ਓ ᮷Ԧ㌫㔏 㲊ᤏ᮷Ԧ㌫㔏 ޵ᆈ㇑⨶ 䘋〻䈳ᓖ 䘋〻䰤䙊ؑ ᡀമ 5-4 ᡰ⽪ⲴṶമ㔃ᶴDŽ 㤕Ӿঅ޵Ṩ⁑ᔿ㔃ᶴ⁑රࠪਁˈᡁԜ䘈ਟԕṩᦞ Linux 0.11 ޵ṨⓀԓ⸱Ⲵ㔃ᶴሶ޵Ṩѫ㾱⁑ඇ㔈ࡦ ༷DŽ㘼޵ᆈ㇑⨶ᆀ㌫㔏ҏՊ֯⭘᮷Ԧ㌫㔏ᶕ᭟ᤱ޵ᆈᮠᦞඇⲴӔᦒ᫽֌DŽ ⭘㖁㔌᧕ਓᶕ᭟ᤱ㖁㔌᮷Ԧ㌫㔏˄NFS˅ˈ਼ṧҏ㜭֯⭘޵ᆈ㇑⨶ᆀ㌫㔏ᨀ׋޵ᆈ㲊ᤏⴈ˄ramdisk˅䇮 ࡦDŽ䘉⿽䙊ؑᵪࡦݱ䇨єњ䘋〻䇯䰞޵ᆈⲴ਼ањ४ฏԕ䘋㹼䘋〻䰤ؑ᚟ⲴӔᦒDŽ㲊ᤏ᮷Ԧ㌫㔏ҏՊ֯ ӛ޵ᆈ䙊ؑᵪޡᮤа⢩ᇊ䘋〻ᡰ֯⭘Ⲵ⢙⨶޵ᆈオ䰤DŽ䘋〻䰤䙊ؑᆀ㌫㔏ࡉ䴰㾱׍䶐޵ᆈ㇑⨶ಘᶕ᭟ᤱ ㌫ᴹӋнཚ᰾ᱮˈն਼ṧҏᖸ䟽㾱DŽ䘋〻䈳ᓖᆀ㌫㔏䴰㾱֯⭘޵ᆈ㇑⨶ᶕ䈳ޣަԆࠐњ⁑ඇⲴ׍䎆 ㌫DŽޣඇҏᱟ⭡Ҿ㊫լⲴ৏ഐ㘼о䘋〻䈳ᓖ⁑ඇᆈ൘׍䎆 ࡠ↓ᑨ䖜䙏ਾ޽֯ᗇ䈕䘋〻㜭㔗㔝䘀㹼DŽਖཆ 3 њ⁑ޕ䖜ᵏ䰤ሶ䈕䘋〻㖞Ѫᤲ䎧ㅹᖵ⣦ᘱˈ㘼൘䖟ⴈ䘋 ᡽ਟ㔗㔝䘀㹼DŽֻྲˈᖃањ䘋〻䈅മሶаᮠᦞඇ߉ࡠ䖟ⴈк৫ᰦˈ䖟ⴈ傡ࣘ〻ᒿቡਟ㜭൘੟ࣘ䖟ⴈ᯻ ᡆ䟽ᯠ䘀㹼ᆳԜⲴ䘋〻DŽ䙊ᑨˈањ⁑ඇՊ൘ㅹᖵ⺜Ԧ᫽֌ᵏ䰤㻛ᤲ䎧ˈ㘼൘᫽֌ᆼᡀਾ˅ڌᤲ䎧˄Ჲ ㌫DŽഐѪᆳԜ䜭䴰㾱׍䶐䘋〻䈳ᓖ〻ᒿᶕޣ⭡മਟԕⴻࠪˈᡰᴹⲴ⁑ඇ䜭о䘋〻䈳ᓖ⁑ඇᆈ൘׍䎆 䎌ީ㌱דഴ /LQX[ ޻Ṯ㌱㔕⁗ඍ㔉ᶺ਀⴮ӈ   LQX[ ޵Ṩ㌫㔏փ㌫㔃ᶴ/ 䈳ᓖ〻ᒿ 䘋〻䰤䙊ؑ ޵ᆈ㇑⨶ ⭘ᡧ〻ᒿ ࠭ ᮠ ᓃ ⺜Ԧ ⺜ Ԧ ᧗ ࡦ ᆀ㌫㔏 䘋〻᧗ࡦ   䇮༷傡ࣘ〻ᒿ ᆇㅖ䇮༷ ඇ䇮༷ 儈䙏㕃ߢ ᮷Ԧᆀ㌫㔏  ㌫㔏䈳⭘᧕ਓ ⺜Ԧ㓗 ޵Ṩ㓗 ޵Ṩ㓗 ⭘ᡧ㓗 㜭४ฏˈ㿱മ 5-5 ᡰ⽪DŽ ൘ Linux 0.11 ޵ṨѝˈѪҶᴹ᭸ൠ֯⭘ᵪಘѝⲴ⢙⨶޵ᆈˈ൘㌫㔏ࡍ࿻ॆ䱦⇥޵ᆈ㻛ࡂ࠶ᡀࠐњ࣏ 5.3.1 ⢟⨼޻ᆎ ㌫DŽޣⲴሩᓄ ᰾ Linux 0.11 ㌫㔏ѝ޵Ṩԓ⸱઼ᮠᦞԕ৺਴њԫ࣑Ⲵԓ⸱઼ᮠᦞ൘㲊ᤏൠ൰ǃ㓯ᙗൠ൰઼⢙⨶ൠ൰ѻ䰤 ᣔᯩᔿDŽᴰਾᡁԜ޽㔬ਸ䈤؍ᛵߥˈ޽࠶࡛ᾲ㾱᧿䘠޵ᆈⲴ࠶⇥઼࠶亥㇑⨶ᵪࡦԕ৺ CPU ཊԫ࣑᫽֌઼ ᵜ㢲俆ݸ䈤᰾ Linux 0.11 ㌫㔏ѝ∄䖳ⴤ㿲Ⲵ⢙⨶޵ᆈ֯⭘ᛵߥˈ❦ਾ㔃ਸ Linux 0.11 ޵ṨѝⲴᓄ⭘ 5.3 Linux ޻Ṯሯ޻ᆎⲺ㇗⨼ૂֵ⭞ ᤜ޵Ṩᡰᴹᆀ㌫㔏䜭Պ䈳⭘Ⲵ޵ᆈ࠶䝽઼᭦എ࠭ᮠǃᢃঠ䆖੺ᡆࠪ䭉ؑ᚟࠭ᮠԕ৺аӋ㌫㔏䈳䈅࠭ᮠDŽ ㌫ԕཆˈᡰᴹ䘉Ӌ⁑ඇ䘈Պ׍䎆Ҿ޵ṨѝⲴ䙊⭘䍴ⓀDŽ䘉Ӌ䍴Ⓚवޣ䲔Ҷ䘉Ӌമѝᐢ㓿㔉ࠪⲴ׍䎆 㔃ᶴDŽ ަѝ޵Ṩ㓗ѝⲴࠐњᯩṶˈ䲔Ҷ⺜Ԧ᧗ࡦᯩṶԕཆˈަԆ㋇㓯ᯩṶ࠶࡛ሩᓄ޵ṨⓀԓ⸱Ⲵⴞᖅ㓴㓷 ഴ  ޻Ṯ㔉ᶺṼഴ   LQX[ ޵Ṩሩ޵ᆈⲴ㇑⨶઼֯⭘/ ᱮᆈ઼ %,26520 㲊ᤏⴈ ѫ޵ᆈ४   ޵Ṩ⁑ඇ 儈䙏㕃ߢ४  0. 㤕⋑ᴹ੟⭘࠶亥ᵪࡦˈ䛓Ѹ㓯ᙗൠ൰ⴤ᧕ቡᱟ⢙⨶ൠ൰DŽIntel 80386 Ⲵ㓯ᙗൠ൰オ䰤ᇩ䟿Ѫ 4GDŽ สൠ൰ቡ⭏ᡀҶањ㓯ᙗൠ൰DŽྲ᷌੟⭘Ҷ࠶亥ᵪࡦˈ䛓Ѹ㓯ᙗൠ൰ਟԕ޽㓿ਈᦒԕӗ⭏ањ⢙⨶ൠ൰DŽ ൠ൰ˈ࣐к⴨ᓄ⇥Ⲵ〫ٿ˄〠Ѫ㓯ᙗൠ൰オ䰤˅ѝⲴൠ൰DŽ〻ᒿԓ⸱Պӗ⭏䙫䗁ൠ൰ˈᡆ㘵䈤ᱟ⇥ѝⲴ 㓯ᙗൠ൰˄Linear Address˅ᱟ㲊ᤏൠ൰ࡠ⢙⨶ൠ൰ਈᦒѻ䰤Ⲵѝ䰤ቲˈᱟ༴⨶ಘਟራ൰Ⲵ޵ᆈオ䰤 ൠ൰઼㲊ᤏൠ൰Ⲵᾲᘥˈ㘼ᱟሶᆳԜ㔏〠Ѫ䙫䗁ൠ൰DŽ 䘿᰾Ⲵˈӵ⭡㌫㔏㕆〻Ӫઈ⎹৺DŽн䗷ᴹӋ䍴ᯉᒦн४࠶䙫䗁ޘӔ䚃ˈ㘼࠶⇥઼࠶亥ᵪࡦሩԆᶕ䈤ᱟᆼ аṧ˅DŽᓄ⭘〻ᒿઈӵ䴰о䙫䗁ൠ൰ᢃޘᇊԓ⸱⇥ǃᮠᦞ⇥ᆼٷ˄ൠ൰〫ٿᤷ〻ᒿᢗ㹼ԓ⸱⇥䲀䮯޵Ⲵ ᣔ⁑ᔿлণᱟ؍ ൠ൰䜘࠶DŽ൘ Intel〫ٿⲴޣ䙫䗁ൠ൰˄Logical Address˅ᱟᤷ⭡〻ᒿӗ⭏Ⲵо⇥⴨ 㲊ᤏൠ൰オ䰤㤳തᱟ 16384 * 4G = 64TDŽ 4Gˈࡉᴰབྷ ਟԕ㍒ᕅ 16384 њ䘹ᤙㅖDŽ㤕⇿њ⇥Ⲵ䮯ᓖ䜭ਆᴰབྷ٬ޡ њ∄⢩սˈഐ↔ Intel 80X86 CPU ⭡ LDT ᱐ሴⲴተ䜘ൠ൰オ䰤㓴ᡀDŽ䘹ᤙㅖⲴ㍒ᕅ䜘࠶⭡ 13 њ∄⢩ս㺘⽪ˈ࣐к४࠶ GDT ઼ LDT Ⲵ 1 ተൠ൰オ䰤઼ޘሩᓄࡠ⢙⨶޵ᆈൠ൰кˈഐ↔䘉⿽ൠ൰㻛〠Ѫ㲊ᤏൠ൰DŽ㲊ᤏൠ൰オ䰤⭡ GDT ᱐ሴⲴ Ѫ䘉є䜘࠶㓴ᡀⲴൠ൰ᒦ⋑ᴹⴤ᧕⭘ᶕ䇯䰞⢙⨶޵ᆈˈ㘼ᱟ䴰㾱䙊䗷࠶⇥ൠ൰ਈᦒᵪࡦ༴⨶ᡆ᱐ሴਾ᡽ ൠ൰єњ䜘࠶㓴ᡀⲴൠ൰DŽഐ〫ٿ㲊ᤏൠ൰˄Virtual Address˅ᱟᤷ⭡〻ᒿӗ⭏Ⲵ⭡⇥䘹ᤙㅖ઼⇥޵ a. 〻ᒿ˄䘋〻˅Ⲵ㲊ᤏ઼䙫䗁ൠ൰˗b. CPU Ⲵ㓯ᙗൠ൰˗c. ᇎ䱵⢙⨶޵ᆈൠ൰DŽ Linux 0.11 ޵Ṩѝˈ൘䘋㹼ൠ൰᱐ሴ᫽֌ᰦˈᡁԜ䴰㾱俆ݸ࠶␵ 3 ⿽ൠ൰ԕ৺ᆳԜѻ䰤Ⲵਈᦒᾲᘥ˖ 5.3.2 ޻ᆎ൦൶グ䰪Ᾰᘫ ㇑⨶ᵪࡦDŽ 〻ᒿઈ䙊䗷㕆〻ᶕ⺞ᇊᱟ੖䟷⭘DŽѪҶ㜭ᴹ᭸ൠ֯⭘⢙⨶޵ᆈˈLinux ㌫㔏਼ᰦ䟷⭘Ҷ޵ᆈ࠶⇥઼࠶亥 ࠶⇥㌫㔏˄Segmentation System˅઼࠶亥㌫㔏˄Paging System˅DŽަѝ࠶亥㇑⨶㌫㔏ᱟਟ䘹ᤙⲴˈ⭡㌫㔏 Ⲵ޵ᆈ䘋㹼ᴹ᭸Ⲵ㇑⨶DŽ൘ Intel 80386 ৺ԕਾⲴ CPU ѝᨀ׋Ҷє⿽޵ᆈ㇑⨶˄ൠ൰ਈᦒ˅㌫㔏˖޵ᆈ ⭡Ҿ䇑㇇ᵪ㌫㔏ѝᡰਜ਼Ⲵᇎ䱵⢙⨶޵ᆈᇩ䟿ᴹ䲀ˈഐ↔ CPU ѝ䙊ᑨ䜭ᨀ׋Ҷ޵ᆈ㇑⨶ᵪࡦሩ㌫㔏ѝ ׋㲊ᤏⴈᆈ᭮ᮠᦞDŽ ᨀࠪ⭣䈧ˈᒦ൘⭣䈧ᡀ࣏ਾᯩ㜭֯⭘DŽሩҾਜ਼ᴹ RAM 㲊ᤏⴈⲴ㌫㔏ˈѫ޵ᆈ४ཤ䜘䘈㾱ࡂ৫а䜘࠶ˈ 〻ᒿਟԕ䲿ᰦ⭣䈧઼֯⭘Ⲵѫ޵ᆈ४DŽ޵Ṩ〻ᒿ൘֯⭘ѫ޵ᆈ४ᰦˈҏ਼ṧ俆ݸ㾱ੁ޵Ṩ޵ᆈ㇑⨶⁑ඇ ҏᱟݸሶᮠᦞ᭮ࡠ儈䙏㕃ߢ४ѝˈ❦ਾ⭡ඇ䇮༷傡ࣘ〻ᒿ߉ࡠ⴨ᓄⲴ䇮༷кDŽ޵ᆈⲴᴰਾ䜘࠶ᱟ׋ᡰᴹ 䈫ਆඇ䇮༷ѝⲴᮠᦞᰦˈ㌫㔏Պ俆ݸᢺᮠᦞ䈫ࡠ儈䙏㕃ߢ४ѝ˗ᖃᴹᮠᦞ䴰㾱߉ࡠඇ䇮༷к৫ᰦˈ㌫㔏 ߢ४䜘࠶˄ަѝ㾱ᢓ䲔ᱮ⽪঑޵ᆈ઼ ROM BIOS ᡰঐ⭘Ⲵ޵ᆈൠ൰㤳ത 640K--1MB˅DŽᖃањ䘋〻䴰㾱 ަѝˈLinux ޵Ṩ〻ᒿঐᦞ൘⢙⨶޵ᆈⲴᔰ࿻䜘࠶ˈ᧕лᶕᱟ׋⺜ⴈᡆ䖟ⴈㅹඇ䇮༷֯⭘Ⲵ儈䙏㕃 ഴ  ⢟⨼޻ᆎֵ⭞Ⲻࣕ㜳࠼ᐹഴ   LQX[ ޵Ṩሩ޵ᆈⲴ㇑⨶઼֯⭘/    ⢙⨶ൠ൰ ࠶亥ᵪࡦ ᔰ੟"  ࠶亥   㓯ᙗൠ൰ ࠶⇥ᵪࡦ  䙫䗁ൠ൰ 㲊ᤏൠ൰ ٬〫ٿ 䘹ᤙㅖ    䙫䗁ൠ൰ ੖ ᱟ ٬㻛ᆈ᭮൘⇥ᇴᆈಘѝ˄ֻྲ ds˅ˈᒦ⇥ˈ٬〫ٿ઼⇥൘ᇎ⁑ᔿлˈራ൰ањ޵ᆈൠ൰ѫ㾱ᱟ֯⭘ ᣔ⁑ᔿ䘀㹼ᵪࡦл޵ᆈራ൰Ⲵѫ㾱⢩⛩DŽ؍ᯩᔿⲴн਼ˈ⭘∄䖳Ⲵᯩ⌅ᶕㆰঅ䈤᰾ 32 ս ᣔ⁑ᔿлራ൰؍ᇊབྷᇦ⸕ᲃᇎ⁑ᔿл޵ᆈራ൰৏⨶ˈ⧠൘ᡁԜṩᦞ CPU ൘ᇎ⁑ᔿ઼ٷⲴՈݸ㓗ㅹؑ᚟DŽ Intel CPU ֯⭘⇥˄Segment˅Ⲵᾲᘥᶕሩ〻ᒿ䘋㹼ራ൰DŽ⇿њ⇥ᇊѹҶ޵ᆈѝⲴḀњ४ฏԕ৺䇯䰞 ޵ᆈѝDŽ䘉ҏቡᱟ޵ᆈ㇑⨶Ⲵ㕪亥࣐䖭ᵪࡦˈ൘ Linux 0.11 ޵Ṩѝᱟ൘〻ᒿ mm/memory.c ѝᇎ⧠DŽ ޕ࠶֌ѪӔᦒ㕃ߢ४˄Swapper˅ᢺ޵ᆈѝᲲᰦн֯⭘Ⲵ亥䶒ӔᦒࡠҼ㓗㕃ߢ४ѝˈ❦ਾᢺ㾱≲Ⲵ亥䶒䈳 䜘ঐ⭘ˈ䛓ѸਟԕُࣙҼ㓗ᆈۘオ䰤Ⲵа䜘ޘྲ⺜ⴈк˅࣐䖭ࡠ⢙⨶޵ᆈѝDŽྲ᷌↔ᰦ⢙⨶޵ᆈᐢ㓿㻛 ༴⨶䈕ѝᯝⲴ䗷〻ቡਟԕ⸕䚃ਁ⭏亥ᔲᑨⲴ⺞࠷ൠ൰ˈӾ㘼ਟԕᢺ䘋〻㾱≲Ⲵ亥䶒ӾҼ㓗ᆈۘオ䰤˄∄ ൠ൰ᰦˈቡՊ䀖ਁ CPU ӗ⭏亥ࠪ䭉ᔲᑨѝᯝˈᒦᢺᕅ䎧ѝᯝⲴ㓯ᙗൠ൰᭮ࡠ CR2 ᧗ࡦᇴᆈಘѝDŽഐ↔ ᗇ⸕䘉њᛵߥDŽ䘉ᱟ䙊䗷 80386 Ⲵ亥䭉䈟ᔲᑨѝᯝᶕᇎ⧠ⲴDŽᖃањ䘋〻ᕅ⭘ањнᆈ൘亥䶒ѝⲴ޵ᆈ аඇнᆈ൘Ⲵ޵ᆈᰦ˄ҏণ൘޵ᆈ亥㺘亩ѝᐢḷࠪ⴨ᓄ޵ᆈ亥䶒н൘޵ᆈѝ˅ˈCPU ቡ䴰㾱а⿽ᯩ⌅ᶕ 䛓Ѹ㲊ᤏᆈۘ㇑⨶ᱟᘾṧᇎ⧠Ⲵ઒˛৏⨶ок䘠ࡇ䖖䘀㹼Ⲵ∄௫㊫լDŽ俆ݸˈᖃањ〻ᒿ䴰㾱֯⭘ ⿽ᯩ⌅DŽ䙊ᑨ㲊ᤏ޵ᆈオ䰤㾱∄ᇎ䱵⢙⨶޵ᆈ䟿བྷᗇཊDŽ ޵ᆈオ䰤Ⲵਜ਼ѹᱟᤷа⿽࡙⭘Ҽ㓗ᡆཆ䜘ᆈۘオ䰤ˈ֯〻ᒿ㜭нਇᇎ䱵⢙⨶޵ᆈ䟿䲀ࡦ㘼֯⭘޵ᆈⲴа CPU 䘋㹼ൠ൰ਈᦒ˄᱐ሴ˅Ⲵѫ㾱ⴞⲴᱟѪҶ䀓ߣ㲊ᤏ޵ᆈオ䰤ࡠ⢙⨶޵ᆈオ䰤Ⲵ᱐ሴ䰞仈DŽ㲊ᤏ ഴ 㲐ᤕ൦൶δ䙱䗇൦൶εࡦ⢟⨼൦൶Ⲻ਎ᦘ䗽ぁ  ᵪࡦˈࡉ䈕㓯ᙗൠ൰ቡ㻛䘱ࡠ CPU Ⲵཆ䜘ൠ൰ᙫ㓯кˈ⭘Ҿⴤ᧕ራ൰ሩᓄⲴ⢙⨶޵ᆈDŽ㿱മ 4-4 ᡰ⽪DŽ 䗷ᢺ⴨ᓄⲴ⇥ส൰࣐ࡠ〻ᒿઈⴻᗇ㿱Ⲵ䙫䗁ൠ൰кቡᖒᡀҶањሩᓄⲴ㓯ᙗൠ൰DŽ↔ᰦ㤕⋑ᴹ੟⭘࠶亥 㓯ᙗൠ൰オ䰤ѝDŽ〻ᒿ⇿⅑ሩ޵ᆈⲴᕅ⭘䜭ᱟሩ޵ᆈ⇥ѝ޵ᆈⲴᕅ⭘DŽᖃ〻ᒿᕅ⭘ањ޵ᆈൠ൰ᰦˈ䙊 ൘޵ᆈ࠶⇥㌫㔏ѝˈањ〻ᒿⲴ䙫䗁ൠ൰䙊䗷࠶⇥ᵪࡦ㠚ࣘൠ᱐ሴ˄ਈᦒ˅ࡠѝ䰤ቲⲴ 4GB˄232˅ 5.3.3 ޻ᆎ࠼⇫ᵰ࡬ DŽޣҏᱟоᇎ䱵⢙⨶޵ᆈᇩ䟿ᰐ ྲкᡰ䘠ˈᴹᰦᡁԜҏᢺ䙫䗁ൠ൰〠Ѫ㲊ᤏൠ൰DŽഐѪ䙫䗁ൠ൰о㲊ᤏ޵ᆈオ䰤Ⲵᾲᘥ㊫լˈᒦф Ⲵ㲊ᤏ޵ᆈオ䰤DŽഐ↔〻ᒿⲴ䙫䗁ൠ൰㤳തᱟ 0x0000000 ࡠ 0x4000000DŽ ቡᱟ㲊ᤏ޵ᆈ㇑⨶䴰㾱ᆼᡀⲴԫ࣑DŽ൘ Linux 0.11 ޵Ṩѝˈ㔉⇿њ〻ᒿ˄䘋〻˅䜭ࡂ࠶Ҷᙫᇩ䟿Ѫ 64MB ・࡫䬪ࡠ⚛䖖Ⲵࡽ䶒ˈਚ㾱֐Ⲵ᫽֌䏣ཏᘛᒦ㜭┑䏣㾱≲ˈࡇ䖖ቡ㜭䊑൘аᶑᆼᮤⲴ䖘䚃к䘀㹼DŽ䘉ҏ 䟼˅ቡਟԕᆼᡀ䘉њԫ࣑DŽ䟷ਆⲴᯩ⌅ᱟᢺਾ䶒Ⲵ䫱䖘ޜ ᔰࡠेӜDŽ֐ਚ䴰㾱䏣ཏ䮯Ⲵ䫱䖘˄∄ྲ䈤 3 ާᴹᴹ䲀޵ᆈ䍴ⓀⲴ㌫㔏кᇎ⧠DŽањᖸᚠᖃⲴ∄௫ᱟ˖֐н䴰㾱ᖸ䮯Ⲵ䖘䚃ቡਟԕ䇙аࡇ⚛䖖Ӿк⎧ 䟿DŽഐ↔ᆳݱ䇨〻ᒿઈ㕆ࡦᒦ䘀㹼∄ᇎ䱵㌫㔏ᤕᴹⲴ޵ᆈབྷᗇཊⲴ〻ᒿDŽ䘉֯ᗇ䇨ཊབྷර亩ⴞҏ㜭ཏ൘ 㲊ᤏᆈۘ˄ᡆ㲊ᤏ޵ᆈ˅˄Virtual Memory˅ᱟᤷ䇑㇇ᵪ੸⧠ࠪ㾱∄ᇎ䱵ᤕᴹⲴ޵ᆈབྷᗇཊⲴ޵ᆈ ྲ᷌⋑ᴹ੟⭘࠶亥ᵪࡦˈ䛓Ѹ㓯ᙗൠ൰ቡⴤ᧕ᡀѪ⢙⨶ൠ൰ҶDŽ ਈᦒⲴᴰ㓸㔃᷌ൠ൰DŽྲ᷌੟⭘Ҷ࠶亥ᵪࡦˈ䛓Ѹ㓯ᙗൠ൰Պ֯⭘亥ⴞᖅ઼亥㺘ѝⲴ亩ਈᦒᡀ⢙⨶ൠ൰DŽ ⢙⨶ൠ൰˄Physical Address˅ᱟᤷࠪ⧠൘ CPU ཆ䜘ൠ൰ᙫ㓯кⲴራ൰⢙⨶޵ᆈⲴൠ൰ؑਧˈᱟൠ൰  LQX[ ޵Ṩሩ޵ᆈⲴ㇑⨶઼֯⭘/ ᇴᆈಘ ᇴᆈಘ ᣔ⁑ᔿлራ൰؍ E D ᇎ⁑ᔿлራ൰ ᧿䘠ㅖ㺘 NE ਟਈ JGWU HVL GV VL GV ⇿њ〻ᒿ䜭ਟᴹ㤕ᒢњ޵ᆈ⇥㓴ᡀDŽ〻ᒿⲴ䙫䗁ൠ൰˄ᡆ〠Ѫ㲊ᤏൠ൰˅ণᱟ⭘Ҿራ൰䘉Ӌ⇥઼⇥ 㺘ѝⲴ᧿䘠ㅖˈ੖ࡉᱟ LDT 㺘ѝⲴ᧿䘠ㅖDŽ ˄0--8191˅њⲴ᧿䘠ㅖ亩DŽ䘹ᤙㅖѝս 2˄TI˅⭘ᶕᤷᇊ֯⭘ଚњ㺘DŽ㤕䈕սᱟ 0 ࡉ䘹ᤙㅖᤷᇊⲴᱟ GDT ѝˈ⇥ᇴᆈಘѝⲴ٬ਣ〫 3 սণᱟ᧿䘠ㅖ㺘ѝањ᧿䘠ㅖⲴ㍒ᕅ٬DŽ13 սⲴ㍒ᕅ٬ᴰཊਟᇊս 8192 ᖃ CPU 㾱ራ൰ањ⇥ᰦˈቡՊ֯⭘ 16 սⲴ⇥ᇴᆈಘѝⲴ䘹ᤙㅖᶕᇊսањ⇥᧿䘠ㅖDŽ൘ 80X86 CPU 䘉Ӌᇴᆈಘѝሶᆈۘሩᓄ㺘Ⲵ 32 ս㓯ᙗสൠ൰઼㺘Ⲵ䲀䮯ᆇ㢲٬DŽ㺘䲀䮯٬ᱟ㺘Ⲵ䮯ᓖ٬-1DŽ ս GDT 㺘ǃIDT 㺘઼ᖃࡽⲴ LDT 㺘ˈ䴰㾱Ѫ CPU ࠶࡛䇮㖞 GDTRǃIDTR ઼ LDTR йњ⢩↺ᇴᆈಘDŽ ᆈ൘㓯ᙗൠ൰オ䰤ⲴԫօൠᯩDŽѪҶ䇙 CPU 㜭ᇊ؍⇿њԫ࣑ᨀ׋Ҷਟራ൰޵ᆈオ䰤Ⲵ㤳തDŽ䘉Ӌ㺘ਟԕ ⭘ањ LDT 㺘DŽ֌Ѫሩ GDT 㺘Ⲵᢙݵˈ⇿њ LDT 㺘Ѫሩᓄԫ࣑ᨀ׋ҶᴤཊⲴਟ⭘᧿䘠ㅖ亩ˈഐ㘼ҏѪ ⿽㊫රⲴ㺘ᱟተ䜘᧿䘠ㅖ㺘 LDT˄Local Descriptor Table˅DŽ䈕㺘ᓄ⭘Ҿཊԫ࣑㌫㔏ѝˈ䙊ᑨ⇿њԫ࣑֯ ᣔ⁑ᔿл↓ᑨ䘀㹼ˈᡁԜᗵ享Ѫ CPU ᇊѹањ GDT 㺘઼ањ IDT 㺘DŽᴰਾа؍ 䟿㺘DŽѪҶ㜭൘ 80X86 ᆈᴹᇊѹѝᯝᡆᔲᑨ༴⨶䗷〻Ⲵ⇥᧿䘠ㅖDŽIDT 㺘ⴤ᧕ᴯԓҶ 8086 ㌫㔏ѝⲴѝᯝੁ؍˅Descriptor Table Table˅ᱟѫ㾱Ⲵสᵜ᧿䘠ㅖ㺘ˈ䈕㺘ਟ㻛ᡰᴹ〻ᒿ⭘Ҿᕅ⭘䇯䰞ањ޵ᆈ⇥DŽѝᯝ᧿䘠ㅖ㺘 IDT˄Interrupt ተ᧿䘠ㅖ㺘 GDT˄Global Descriptorޘᆈ᧿䘠ㅖ亩Ⲵ᧿䘠ㅖ㺘ᴹ 3 ⿽㊫රˈ⇿⿽⭘Ҿн਼ⴞⲴDŽ؍ Ⲵ㊫ර˄ֻྲԓ⸱⇥઼ᮠᦞ⇥˅ǃ⇥Ⲵ⢩ᵳ㓗઼࡛ަԆаӋؑ᚟DŽањ⇥ਟԕᇊѹⲴᴰབྷ䮯ᓖᱟ 4GBDŽ ⇿њ᧿䘠ㅖঐ⭘ 8 њᆇ㢲ˈަѝਜ਼ᴹᡰ᧿䘠⇥൘㓯ᙗൠ൰オ䰤ѝⲴ䎧࿻ൠ൰˄ส൰˅ǃ⇥Ⲵ䮯ᓖǃ⇥ ഴ ᇔ⁗ᕅфؓᣚ⁗ᕅсሱ൶ᯯᕅⲺ∊䖹  㔍䇯䰞䈕ൠ൰४ฏDŽ н㜭㻛ራ൰ˈCPU ሶᤂޘ֐н൘ањ⇥᧿䘠ㅖѝᇊѹањ޵ᆈ㓯ᙗൠ൰オ䰤४ฏˈ䛓Ѹ䈕ൠ൰४ฏቡᆼ ⇥䴰㾱Ⲵؑ᚟∄䖳ཊˈ㘼ањ 16 սⲴ⇥ᇴᆈಘ᭮нл䘉Ѹཊ޵ᇩDŽ⽪᜿മ㿱മ 5-7 (b)ᡰ⽪DŽ⌘᜿ˈྲ᷌ ᣔ⁑ᔿл䇯䰞ањ޵ᆈ؍ᆈൠ൰ቡ䴰㾱∄ᇎ⁑ᔿлཊа䚃᡻㔝ˈҏণ䴰㾱֯⭘⇥᧿䘠ㅖ㺘DŽ䘉ᱟ⭡Ҿ൘ ᣔ⁑ᔿлራ൰ањ޵؍٬䘈ᱟ֯⭘Ҷ৏ᇎ⁑ᔿлⲴᾲᘥDŽ䘉ṧˈ൘〫ٿ䘹ᤙㅖ˄Segment Selector˅ˈն Ⲵራ൰⴨∄ˈ⇥ᇴᆈಘ٬ᦒᡀҶ⇥᧿䘠ㅖ㺘ѝ⴨ᓄ⇥᧿䘠ㅖⲴ㍒ᕅ٬ԕ৺⇥㺘䘹ᤙս઼⢩ᵳ㓗ˈ〠Ѫ⇥ ٬㓴ਸ㘼ᡀDŽ⇥Ⲵ䮯ᓖਟਈˈ⭡᧿䘠ㅖѝⲴ޵ᇩᤷᇊDŽਟ㿱ˈ઼ᇎ⁑ᔿл〫ٿⲴ⇥สൠ൰٬оањ⇥޵ Ⲵ䇯䰞⢩ᵳ㓗࡛ㅹؑ᚟DŽራ൰Ⲵ޵ᆈս㖞ᱟ⭡䈕⇥᧿䘠ㅖ亩ѝᤷᇊ⇥Ⲵ޵ᆈ⇥Ⲵสൠ൰ǃ⇥Ⲵ䮯ᓖ٬઼ ˄Segment Descriptor Table˅ѝḀа᧿䘠ㅖ亩൘㺘ѝⲴ㍒ᕅ٬DŽ㍒ᕅ٬ᤷᇊⲴ⇥᧿䘠ㅖ亩ѝਜ਼ᴹ䴰㾱ራ൰ ᣔ⁑ᔿ䘀㹼ᯩᔿлˈ⇥ᇴᆈಘѝᆈ᭮Ⲵн޽ᱟ㻛ራ൰⇥Ⲵสൠ൰ˈ㘼ᱟањ⇥᧿䘠ㅖ㺘؍㘼൘ ቡਟԕ㇇ࠪᇎ䱵ᤷੁⲴ޵ᆈൠ൰ˈ㿱മ 5-7 (a)ᡰ⽪DŽˈᇴᆈಘѝⲴ٬〫ٿᦞ⇥ᇴᆈಘ઼ ൠ൰ᆈ᭮൘ԫ᜿ањਟ⭘Ҿራ൰Ⲵᇴᆈಘѝ˄ֻྲ si˅DŽഐ↔ˈṩ〫ٿф⇥Ⲵ䮯ᓖ㻛പᇊѪ 64KBDŽ⇥޵  LQX[ ޵Ṩሩ޵ᆈⲴ㇑⨶઼֯⭘/ //18 18// ተൠ൰オ䰤 ተ䜘ൠ൰オ䰤ޘ ተ䜘᧿䘠ㅖ㺘 /'7 ተ᧿䘠ㅖ㺘 *'7 ተ䜘᧿䘠ㅖ㺘 /'7ޘ //18 ԓ⸱⇥ &RGH ᮠᦞ⇥ 'DWD V\VFDOO ᵚ⭘ ⣦ᘱ⇥ WVV ተ䜘㺘 OGW ⣦ᘱ⇥ WVV ተ䜘㺘 OGW  ⭘ᡧԓ⸱  ԫ࣑ ⭘ᡧᮠᦞ  ԫ࣑ ԓ⸱⇥ &RGH ᮠᦞ⇥ 'DWD ԫ࣑⣦ᘱ⇥  ԫ࣑ ⭘ᡧԓ⸱  ԫ࣑ ⭘ᡧᮠᦞ  ԫ࣑ ԓ⸱⇥ &RGH ᮠᦞ⇥ 'DWD ԫ࣑⣦ᘱ⇥  ԫ࣑ ޵Ṩᮠᦞ⇥ ޵Ṩԓ⸱⇥ ⣦ᘱ⇥ WVV1 ተ䜘㺘 OGW1 ᓄᡁԜⲴ⢩↺㾱≲DŽ֯⭘࠶亥ᵪࡦᴰᲞ䙽Ⲵ൪ਸᱟᖃ㌫㔏޵ᆈᇎ䱵к㻛࠶ᡀᖸཊ߼ҡⲴඇᰦ,ᆳਟԕᔪ・ ሴࡠᇎ䱵⢙⨶޵ᆈൠ൰кDŽо࠶⇥ᵪࡦ㊫լˈ࠶亥ᵪࡦݱ䇨ᡁԜ䟽ᯠᇊੁ˄ਈᦒ˅⇿⅑޵ᆈᕅ⭘ˈԕ䘲 㤕䟷⭘Ҷ࠶亥ᵪࡦˈࡉ↔ᰦ㓯ᙗൠ൰ਚᱟањѝ䰤㔃᷌ˈ䘈䴰㾱֯⭘࠶亥ᵪࡦ䘋㹼ਈᦒˈ޽ᴰ㓸᱐ 5.3.4 ޻ᆎ࠼享㇗⨼   766/'7766HWF  (QWU\LQWRJGWZKHUHWRILQGILUVW766QXOFVGVV\VFDOO    лᡰ⽪˅ਟԕ⥌ᜣࡠˈLinus ᖃᰦ䇮䇑޵Ṩᰦᴮ㓿ᜣᢺ㌫㔏䈳⭘Ⲵԓ⸱᭮൘䘉њу䰘⤜・Ⲵ⇥ѝDŽ 㺘ѝㅜ 4 њ᧿䘠ㅖ˄മѝ syscall ᧿䘠ㅖ亩˅DŽӾ include/linux/sched.h ᮷Ԧѝㅜ 150 㹼кⲴ৏㤡᮷⌘䟺˄ྲ ᆈ൘䈕ԫ࣑Ⲵԫ࣑ᮠᦞ㔃ᶴѝDŽਖཆˈLinux 0.11 ޵Ṩѝ⋑ᴹ֯⭘ࡠ GDT؍ѝˈ⇿њԫ࣑Ⲵ TSS ⇥޵ᇩ㻛 ԫ࣑Ⲵ TSS ⇥ѝⲴؑ᚟ᶕ䇮㖞਴ᇴᆈಘˈԕᚒ༽䈕ԫ࣑Ⲵᢗ㹼⧟ຳˈ৲㿱മ 4-37 ᡰ⽪DŽ൘ Linux 0.11 ᆈ൘䈕ԫ࣑Ⲵ TSS ⇥ѝˈ਼ᰦ CPU ֯⭘ᯠ࠷ᦒ䘋؍ֻྲሩҾ࠷ᦒࠪⲴԫ࣑ˈCPU ቡᢺަᇴᆈಘㅹؑ᚟ ԫ࣑Ⲵᖃࡽᢗ㹼кл᮷˄CPU ᖃࡽ⣦ᘱ˅DŽޣᆈᡆᚒ༽⴨؍State Segment˅⭘Ҿ൘ԫ࣑࠷ᦒᰦ CPU 㠚ࣘ 䟽ਐⲴˈ਴ԫ࣑Ⲵԓ⸱⇥઼ᮠᦞ⇥࠶࡛ҏᱟ䟽ਐⲴˈ৲㿱മ 5-10 ᡆമ 5-11 ᡰ⽪DŽԫ࣑⣦ᘱ⇥ TSS˄Task ઼ᮠᦞ⇥䜭࠶࡛㻛᱐ሴࡠ㓯ᙗൠ൰オ䰤ѝ⴨਼ส൰༴ˈф⇥䲀䮯ҏаṧˈഐ↔޵ṨⲴԓ⸱⇥઼ᮠᦞ⇥ᱟ ᆈ൘޵Ṩԓ⸱⇥ѝDŽ⭡Ҿ൘ Linux 0.11 ޵Ṩѝˈ޵Ṩ઼਴ԫ࣑Ⲵԓ⸱⇥؍ሩҾѝᯝ᧿䘠ㅖ㺘 idtˈᆳ ᆈ⇥ˈަ⇥䲀䮯ҏਚ㾱┑䏣㜭ཏᆈ᭮ањ TSS ᮠᦞ㔃ᶴቡཏҶDŽ 䲀䮯䙊ᑨਚ㾱བྷҾ 24 ᆇ㢲ণਟDŽ਼ṧˈ⇿њԫ࣑Ⲵԫ࣑⣦ᘱ⇥ TSS ҏᱟ⭡ GDT ѝ᧿䘠ㅖᇊѹⲴањ޵ ᧿䘠ㅖᇊѹⲴањ޵ᆈ⇥ˈ൘䈕⇥ѝᆈ᭮⵰ሩᓄԫ࣑Ⲵԓ⸱⇥઼ᮠᦞ⇥᧿䘠ㅖˈഐ↔ LDT ⇥ᖸ⸝ˈަ⇥ മѝ⭫ࠪҶާᴹєњԫ࣑ᰦⲴᛵߥDŽਟԕⴻࠪˈ⇿њԫ࣑Ⲵተ䜘᧿䘠ㅖ㺘 LDT ᵜ䓛ҏᱟ⭡ GDT ѝ ഴ /LQX[ ㌱㔕ѣ㲐ᤕ൦൶グ䰪࠼䞃ഴ  Ѫተ䜘ൠ൰オ䰤ˈ㘼䘉є㘵ᶴᡀҶ㲊ᤏൠ൰Ⲵオ䰤DŽާփⲴ֯⭘ᯩᔿ㿱മ 5-8 ᡰ⽪DŽ ተൠ൰オ䰤ˈ⭡ LDT ᱐ሴⲴൠ൰オ䰤ࡉ〠ޘGDT ઼ተ䜘⇥᧿䘠ㅖ㺘 LDTDŽ⭡ GDT ᱐ሴⲴൠ൰オ䰤〠Ѫ ተ⇥᧿䘠ㅖ㺘ޘѝާփൠ൰ս㖞DŽ൘ Linux 0.11 ѝˈ〻ᒿ䙫䗁ൠ൰ࡠ㓯ᙗൠ൰Ⲵਈᦒ䗷〻֯⭘Ҷ CPU Ⲵ  LQX[ ޵Ṩሩ޵ᆈⲴ㇑⨶઼֯⭘/ ⢙⨶ൠ൰   &5 亥㺘亩 ٬〫ٿ 亥ⴞᖅ亩 亥㺘亩 亥޵㓯ᙗൠ൰ 亥ⴞᖅ亩 亥㺘 亥Ṷ亥ⴞᖅ㺘  ተ᧿䘠ㅖ㺘 GDT ѝⲴ⇥᧿䘠ㅖ亩ᮠᴰབྷѪ 256ˈަѝ 2 亩オ䰢ǃޘሩҾ Linux 0.11 ㌫㔏ˈ޵Ṩ䇮㖞 ൰DŽ ൰DŽн䗷൘⌘䟺ѝˈ൘н㠣Ҿᩎ␧ⲴᛵߥлᡁԜᴹᰦሶ䘋〻ѝⲴ↔㊫ൠ൰ㆰঅൠ〠Ѫ䙫䗁ൠ൰ᡆ㓯ᙗൠ ᆈオ䰤ᇊѹѪ 64MBˈഐ↔⇿њ䘋〻Ⲵ䙫䗁ൠ൰䙊䗷࣐к(ԫ࣑ਧ)*64MBˈণਟ䖜ᦒѪ㓯ᙗオ䰤ѝⲴൠ ޵ᆈ亥㺘ࣘᘱൠ᱐ሴࡠѫ޵ᆈ४ฏⲴн਼⢙⨶޵ᆈ亥кDŽ⭡Ҿ Linux 0.11 ѝᢺ⇿њ䘋〻ᴰབྷਟ⭘㲊ᤏ޵ 亥㺘 PT˄Ҽ㓗亥㺘˅᱐ሴࡠᇎ䱵⢙⨶ൠ൰亥кDŽѪҶ֯⭘ᇎ䱵⢙⨶޵ᆈˈ⇿њ䘋〻Ⲵ㓯ᙗൠ൰䙊䗷Ҽ㓗 䗷ަተ䜘⇥᧿䘠ㅖਈᦒѪ CPU ᮤњ㓯ᙗൠ൰オ䰤ѝⲴൠ൰ˈ❦ਾ޽֯⭘亥ⴞᖅ㺘 PDT˄а㓗亥㺘˅઼ ሩҾ Intel 80386 ㌫㔏ˈަ CPU ਟԕᨀ׋ཊ䗮 4G Ⲵ㓯ᙗൠ൰オ䰤DŽањԫ࣑Ⲵ㲊ᤏൠ൰䴰㾱俆ݸ䙊 㓵ᙝ൦൶ࡦ⢟⨼൦൶Ⲻ਎ᦘ⽰ᝅഴ ഴ  ᤏൠ൰オ䰤᱐ሴࡠ㓯ᙗൠ൰オ䰤Ⲵн਼ս㖞ˈণঐ⭘н਼Ⲵ㓯ᙗൠ൰オ䰤㤳തDŽ ࡠ⢙⨶ൠ൰オ䰤Ⲵ᱐ሴ࠭ᮠ䜭аṧDŽഐ↔ѪҶ䇙޵Ṩ઼ᡰᴹԫ࣑䜭нӂ⴨䟽ਐ઼ᒢᢠˈᆳԜ䜭ᗵ享Ӿ㲊 ⭘਼ањ亥ⴞᖅ㺘ˈ֯ᗇԫօᰦ࡫༴⨶ಘ㓯ᙗൠ൰オ䰤ޡ⭡Ҿ Linux 0.1x ㌫㔏ѝ޵Ṩ઼ᡰᴹԫ࣑䜭 ᇩ䟿Ⲵ޵ᆈDŽণањ亥ⴞᖅ㺘ቡਟԕ᱐ሴᮤњ㓯ᙗൠ൰オ䰤㤳തDŽ њ亥ⴞᖅ㺘ᴰཊᴹ 1024 亩ˈሩᓄ 1024 њҼ㓗亥㺘ˈഐ↔ањ亥ⴞᖅ㺘ᴰཊਟԕ᱐ሴ 1024 * 4MB = 4GB ս㖞DŽഐѪ 1 њ亥㺘ਟᴹ 1024 亩ˈഐ↔ањ亥㺘ᴰཊਟԕ᱐ሴ 1024 * 4KB = 4MB ޵ᆈ˗৸ഐѪа〫ٿ ࠶࡛⭘ᶕ൘亥ⴞᖅ㺘઼亥㺘ѝᇊսሩᓄⲴ亥ⴞᖅ亩઼亥㺘亩ԕ৺൘ሩᓄⲴ⢙⨶޵ᆈ亥䶒ѝᤷᇊ亥䶒޵Ⲵ ޵ᆈѝⲴสൠ൰˄ഐ↔ CR3 ҏ㻛〠Ѫ亥ⴞᖅสൠ൰ᇴᆈಘ PDBR˅DŽ32 սⲴ㓯ᙗൠ൰㻛࠶ᡀйњ䜘࠶ˈ ᆈ⵰ᱟᖃࡽ亥ⴞᖅ㺘൘⢙⨶؍ 㓯ᙗൠ൰ࡠ⢙⨶ൠ൰Ⲵਈᦒ䗷〻㿱മ 5-9 ᡰ⽪DŽമѝ᧗ࡦᇴᆈಘ CR3 Ⲵሿ४࡛൘Ҿ亥㺘亩ᴹњᐢ߉ս D˄Dirty˅ˈ㘼亥ⴞᖅ亩ࡉ⋑ᴹDŽ ঐ⭘ 1 亥޵ᆈDŽ亥ⴞᖅ亩઼亥㺘亩ޡ㺘ᗵ享ਚ㜭वਜ਼ 1024 њ亥㺘亩DŽഐ↔ањ亥ⴞᖅ㺘ᡆањ亥㺘࠶࡛ ֯⭘Ҷ亥ⴞᖅ㺘઼亥㺘DŽ亥ⴞᖅ㺘亩о亥㺘亩Ṭᔿสᵜ⴨਼ˈ䜭ঐ⭘ 4 њᆇ㢲ˈᒦф⇿њ亥ⴞᖅ㺘ᡆ亥 㔝ൠ൰オ䰤DŽѪҶ൘֯⭘࠶亥ᵪࡦⲴᶑԦлᢺ㓯ᙗൠ൰᱐ሴࡠᇩ䟿⴨ሩᖸሿⲴ⢙⨶޵ᆈオ䰤кˈ80386 ൘֯⭘䘉⿽޵ᆈ࠶亥㇑⨶ᯩ⌅ᰦˈ⇿њᢗ㹼ѝⲴ䘋〻˄ԫ࣑˅ਟԕ֯⭘∄ᇎ䱵޵ᆈᇩ䟿བྷᗇཊⲴ䘎 亥ᵪࡦˈ䴰㾱ᢺ᧗ࡦᇴᆈಘ CR0 Ⲵᴰ儈∄⢩ս˄ս 31˅㖞սDŽ ᣔ⁑ᔿл֯⭘࠶؍ ᣔᵪࡦDŽѪҶ൘ 80X86؍ᣔкᴤ໎࣐Ҷ࠶亥؍⚥⍫Ⲵ᧗ࡦᵳˈᒦф൘࠶⇥ᵪࡦⲴ޵ᆈ ᒦнྲ࠶⇥ᵪࡦ䛓ѸᆼழDŽഐѪ࠶亥ᵪࡦᱟ൘࠶⇥ᵪࡦѻкᇎ⧠Ⲵˈᡰԕަ㔃᷌ᱟሩ㌫㔏޵ᆈާᴹ䶎ᑨ ᒿ⭣䈧֯⭘޵ᆈᰦˈ㌫㔏ቡԕ޵ᆈ亥Ѫঅս䘋㹼࠶䝽DŽ޵ᆈ࠶亥ᵪࡦⲴᇎ⧠ᯩᔿо࠶⇥ᵪࡦᖸ⴨լˈն ޵ᆈ࠶亥㇑⨶ᵪࡦⲴสᵜ৏⨶ᱟሶ CPU ᮤњ㓯ᙗ޵ᆈ४ฏࡂ࠶ᡀ 4096 ᆇ㢲Ѫ 1 亥Ⲵ޵ᆈ亥䶒DŽ〻 ᧚ᯭ㘼ਚᱟ䘋㹼ᴤ䘋а↕ⲴỰḕ᫽֌DŽ ᣔ؍ᣔ᧚ᯭᒦнՊਆԓ⇥ਈᦒⲴ؍Ⲵᙗ㜭DŽਖཆˈ亥ൠ൰ਈᦒᔪ・൘⇥ਈᦒส⹰ѻкˈԫօ࠶亥ᵪࡦⲴ 䇙〻ᒿн⭘᫽ᗳ઼㇑⨶䘉Ӌ࠶ᮓⲴ޵ᆈඇDŽ࠶亥ᵪࡦ໎ᕪҶ࠶⇥ᵪࡦྭˈۿањབྷ㘼䘎㔝Ⲵ޵ᆈオ䰤᱐  LQX[ ޵Ṩሩ޵ᆈⲴ㇑⨶઼֯⭘/ 0 *. 0 0  ԫ࣑  ԫ࣑ 0 0 ޵Ṩ४  ԫ࣑ ԫ࣑ 7 ᢗ㹼ԓ⸱ ᮠᦞԓ⸱઼ᮠᦞ 0 *. 0 0  ԫ࣑ 䘋〻 0 0  䘋〻 䘋〻 䘋〻 ৲ᮠ઼ึḸ४ 䈧䘈䴰⌘᜿ˈ䘋〻䙫䗁ൠ൰オ䰤ѝԓ⸱⇥˄Code Section˅઼ᮠᦞ⇥˄Data Section˅Ⲵᾲᘥо CPU ഴ /LQX[ ㌱㔕Աࣗ൞㲐ᤕグ䰪ѣ亰ᓅᧈࡍᡶখⲺグ䰪㤹പ  ԓ⸱⇥઼ᮠᦞ⇥˄वᤜᮠᦞ઼ึḸ޵ᇩ˅Ⲵս㖞⽪᜿മDŽ ⸱઼ᮠᦞ൘㲊ᤏオ䰤ѝᡰঐ⭘Ⲵ㤳തDŽਖཆˈ൘മѝሩҾ䘋〻 2 ઼䘋〻 3 䘈࠶࡛㔉ࠪҶ਴㠚䙫䗁オ䰤ѝ ਼ᰦਟᤕᴹᡰᴹԫ࣑൘㲊ᤏൠ൰オ䰤ѝⲴ⽪᜿മˈᡰঐ⭘㲊ᤏオ䰤㤳തҏᱟ 4GBDŽަѝ⋑ᴹ㘳㲁޵Ṩԓ ྲ᷌ҏ᤹➗㓯ᙗオ䰤ѝԫ࣑Ⲵᧂࡇ亪ᒿᧂࡇ㲊ᤏオ䰤ѝⲴԫ࣑ˈ䛓ѸᡁԜਟԕᴹമ 5-11 ᡰ⽪Ⲵ㌫㔏 ഴ /LQX[ 㓵ᙝ൦൶グ䰪Ⲻֵ⭞⽰ᝅഴ  4GBˈഐ↔൘ 0.11 ޵Ṩѝ∄䖳ᇩ᱃␧⏶й⿽ൠ൰ᾲᘥDŽ ф൘ᢺԫ࣑ 0 ઼ԫ࣑ 1 Ⲵ䙫䗁ൠ൰㤳തⴻ֌ 64MB ᰦˈ㌫㔏ѝ਼ᰦਟᴹԫ࣑Ⲵ䙫䗁ൠ൰㤳തᙫ઼ҏᱟ 64MBDŽ⭡Ҿ 4G ൠ൰オ䰤㤳ത↓ྭᱟ CPU Ⲵ㓯ᙗൠ൰オ䰤㤳ത઼ਟራ൰Ⲵᴰབྷ⢙⨶ൠ൰オ䰤㤳തˈ㘼 ᰾DŽԫ࣑ 2 ઼ԫ࣑ 3 ࠶࡛㻛᱐ሴ㓯ᙗൠ൰ 128MB ઼ 192MB ᔰ࿻ⲴൠᯩˈᒦфᆳԜⲴ䙫䗁ൠ൰㤳ത൷ᱟ ㌫㿱ਾ䶒䈤ޣԫ࣑ 1 Ⲵ㓯ᙗൠ൰オ䰤㤳തҏਚᴹӾ 64MB ᔰ࿻Ⲵ 640KB 䮯ᓖDŽᆳԜѻ䰤Ⲵ䈖㓶ሩᓄ ণањ䘋〻Ⲵᡰᴹԓ⸱ǃᮠᦞ઼ึḸ䜘࠶䜭༴Ҿ਼а޵ᆈ⇥ѝˈҏণᱟ I&D н࠶⿫Ⲵа⿽֯⭘ᯩᔿDŽ ࠶DŽᇎ䱵кˈLinux 0.11 ѝᡰᴹԫ࣑ⲴᤷԔオ䰤 I˄Instruction˅઼ᮠᦞオ䰤 D˄Data˅䜭ਸ⭘аඇ޵ᆈˈ 䟽ਐˈᒦфо޵Ṩԓ⸱⇥઼ᮠᦞ⇥ᴹ䟽ਐⲴ䜘ޘӾ㓯ᙗൠ൰ 0 ᔰ࿻Ⲵ 640KB 㤳തˈަԓ⸱઼ᮠᦞ⇥ҏᆼ Ṩԓ⸱઼ᮠᦞѝˈഐ↔䈕ԫ࣑ᡰঐ⭘Ⲵ㓯ᙗൠ൰オ䰤㤳ത∄䖳⢩↺DŽԫ࣑ 0 Ⲵԓ⸱⇥઼ᮠᦞ⇥Ⲵ䮯ᓖᱟ ӂ⴨䟽ਐDŽ㘼ㅜ 1 њԫ࣑˄ԫ࣑ 0˅ᱟ⭡޵ṨĀӪᐕā੟ࣘ䘀㹼Ⲵˈަԓ⸱઼ᮠᦞवਜ਼൘޵ޘ४ฏˈᆼ ߥDŽ޵Ṩԓ⸱⇥઼ᮠᦞ⇥㻛᱐ሴࡠ㓯ᙗൠ൰オ䰤Ⲵᔰ࿻ 16MB 䜘࠶ˈᒦфԓ⸱઼ᮠᦞ⇥䜭᱐ሴࡠ਼ањ ᡰ֯⭘Ⲵ㓯ᙗൠ൰オ䰤㤳തᱟ 64MB*64 =4Gˈ㿱മ 5-10 ᡰ⽪DŽമѝ⽪ࠪҶᖃ㌫㔏ާᴹ 4 њԫ࣑ᰦⲴᛵ 䜘ԫ࣑ޘ↔࣑䙫䗁ൠ൰㤳തᱟ 64Mˈᒦф਴њԫ࣑൘㓯ᙗൠ൰オ䰤ѝⲴ䎧࿻ս㖞ᱟ (ԫ࣑ਧ)*64MBDŽഐ 㤳തᱟ ((256-4)/2)* 64MB 㓖ㅹҾ 8GDŽն 0.11 ޵ṨѝӪᐕᇊѹᴰབྷԫ࣑ᮠ NR_TASKS = 64 њˈ⇿њԫ 2 亩㌫㔏֯⭘ˈ⇿њ䘋〻֯⭘є亩DŽഐ↔ˈ↔ᰦ㌫㔏ਟԕᴰཊᇩ㓣(256-4)/2 =126 њԫ࣑ˈᒦф㲊ᤏൠ൰  LQX[ ޵Ṩሩ޵ᆈⲴ㇑⨶઼֯⭘/ ⧟ຳ৲ᮠඇ ަѝ QU ᱟԫ࣑ਧ 䮯ᓖ EUN EVV VWDUWBFRGH 䮯ᓖ HQGBGDWD ึḸᤷ䪸 0䮯ᓖ HQGBFRGH QU 0 QU ԓ⸱ ᮠᦞ ৲ᮠ 䘋〻䘀㹼⣦ᘱа㢲ѝ֌ᴤ䈖㓶Ⲵ䈤᰾DŽޣᴹ ᒿሶ֯⭘ᖃࡽ䘋〻Ⲵ޵ṨḸDŽ䘉о༴Ҿ޵ṨᘱⲴ䘋〻Ⲵ⣦ᘱᴹӋ㊫լDŽ䘋〻Ⲵ޵Ṩᘱ઼⭘ᡧᘱሶ൘ਾ䶒 〻ᒿ㘼ケ❦㻛ѝᯝ〻ᒿѝᯝᰦˈ↔ᰦ⭘ᡧ〻ᒿҏਟԕ䊑ᖱᙗൠ〠Ѫ༴Ҿ䘋〻Ⲵ޵ṨᘱDŽഐѪѝᯝ༴⨶〻 ަ༴Ҿ⭘ᡧ䘀㹼ᘱ˄⭘ᡧᘱ˅DŽণ↔ᰦ༴⨶ಘ൘⢩ᵳ㓗ᴰվⲴ˄3 㓗˅⭘ᡧԓ⸱ѝ䘀㹼DŽᖃ↓൘ᢗ㹼⭘ᡧ Ṩԓ⸱Պ֯⭘ᖃࡽ䘋〻Ⲵ޵ṨḸDŽ⇿њ䘋〻䜭ᴹ㠚ᐡⲴ޵ṨḸDŽᖃ䘋〻൘ᢗ㹼⭘ᡧ㠚ᐡⲴԓ⸱ᰦˈࡉ〠 〠Ѫ޵Ṩᘱ˅DŽ↔ᰦ༴⨶ಘ༴Ҿ⢩ᵳ㓗ᴰ儈Ⲵ˄0 㓗˅޵Ṩԓ⸱ѝᢗ㹼DŽᖃ䘋〻༴Ҿ޵Ṩᘱᰦˈᢗ㹼Ⲵ޵ ޵Ṩԓ⸱ѝᢗ㹼ᰦˈᡁԜቡ〠䘋〻༴Ҿ޵Ṩ䘀㹼ᘱ˄ᡆㆰޕᖃањԫ࣑˄䘋〻˅ᢗ㹼㌫㔏䈳⭘㘼䲧 ⲴDŽޣԫ࣑ 1 ѝⲴൠ൰оԫ࣑ 2 ѝ⴨਼ൠ൰༴ᱟᰐ ተൠ൰४ฏˈޘ㌫㔏ѝⲴ਴њԫ࣑DŽ⇿ᶑᖴੁሴ㓯ᤷࠪҶ਴ԫ࣑Ⲵ䗩⭼DŽ䲔Ҷ⇿њԫ࣑㲊ᤏൠ൰オ䰤Ⲵ ᣔቲ˅ˈ䘉䟼ӵ֯⭘Ҷ CPU Ⲵ 0 㓗઼ 3 㓗DŽ㘼ᖴੁሴ㓯ࡉ⭘ᶕ४࠶؍˄ᣔ㓗࡛؍മѝ਼ᗳശԓ㺘 CPU Ⲵ ተൠ൰オ䰤ѝDŽമ 5-13 㔉ࠪҶ䘉⿽㔃ᶴⲴ⽪᜿മDŽޘᆈ൘؍ӛⲴˈഐ↔ᆳޡ޵Ṩԓ⸱઼ᮠᦞᱟ⭡ᡰᴹԫ࣑ ᆈҾተ䜘ൠ൰オ䰤ˈഐ↔㌫㔏ѝⲴަԆԫ࣑ᱟⴻн㿱Ⲵ˄н㜭䇯䰞Ⲵ˅DŽ㘼؍ԓ⸱઼ᮠᦞ४ˈ䘉єњ४ฏ ӛDŽ㘼⇿њԫ࣑ࡉ䜭ᴹ㠚ᐡⲴޡᣔ㓗DŽ޵Ṩԓ⸱ᵜ䓛Պ⭡㌫㔏ѝⲴᡰᴹԫ࣑؍֯⭘Ҷ CPU Ⲵ 0 ઼ 3 єњ ᣔ㓗ˈ0 㓗ާᴹᴰ儈Ոݸ㓗ˈ㘼 3 㓗Ոݸ㓗ᴰվDŽLinux 0.11 ᫽֌㌫㔏؍࠶ 4 њޡ Intel 80X86 CPU 5.3.5 CPU ཐԱࣗૂؓᣚᯯᕅ ഴ 䘑ぁԙ⸷ૂᮦᦤ൞ެ䙱䗇൦൶グ䰪ѣⲺ࠼ᐹ 䰤Ⲵ䈤᰾䈧৲㿱޵ᆈ㇑⨶аㄐ޵ᇩDŽ 䙫䗁ൠ൰オޣⲴᮠᦞ४ฏԕ৺ึḸ४ฏDŽ䘋〻䙫䗁ൠ൰オ䰤ѝԓ⸱⇥઼ᮠᦞ⇥ㅹ㔃ᶴᖒᔿ㿱മᡰ⽪DŽᴹ ൘㕆䈁〻ᒿ઼᫽֌㌫㔏൘࣐䖭〻ᒿᰦ㿴ᇊⲴ൘䘋〻䙫䗁オ䰤ѝ亪ᒿᧂࡇⲴԓ⸱४ฏǃࡍ࿻ॆ઼ᵚࡍ࿻ॆ 䟽ਐᡆ䜘࠶䟽ਐDŽ㘼䘋〻൘ަ䙫䗁ൠ൰オ䰤ѝⲴԓ⸱⇥઼ᮠᦞ⇥ࡉᱟᤷ⭡㕆䈁ಘޘԕ⴨ӂ⤜・ҏਟԕᆼ ⇥Ⲵ⭘䙄ԕ৺㻛ᢗ㹼ᡆ䇯䰞Ⲵ㓖ᶏ઼䲀ࡦˈ⇿њ⇥ਟԕ䇮㖞൘ 4GB 㓯ᙗൠ൰オ䰤ѝⲴԫօൠᯩˈᆳԜਟ ࠶⇥ᵪࡦѝⲴԓ⸱⇥઼ᮠᦞ⇥нᱟ਼ањᾲᘥDŽCPU ࠶⇥ᵪࡦѝ⇥Ⲵᾲᘥ⺞ᇊҶ൘㓯ᙗൠ൰オ䰤ѝањ  LQX[ ޵Ṩሩ޵ᆈⲴ㇑⨶઼֯⭘/ ᮠᦞึḸ ᮠᦞ ⭘ᡧԓ⸱઼  *'7,'73',5 ઼ᮠᦞ ޵Ṩԓ⸱  ԫ࣑ ԫ࣑  ԫ࣑ Q ԫ࣑ ㌫ਟ⭘മ 5-14 ᶕ㺘⽪DŽޣ↔ᰦ޵ṨⲴ㲊ᤏൠ൰オ䰤ǃ㓯ᙗൠ൰オ䰤઼⢙⨶ൠ൰オ䰤й㘵ѻ䰤Ⲵ ণ 4 њҼ㓗亥㺘DŽഐ↔ሩҾ޵Ṩԓ⸱ᡆᮠᦞⲴൠ൰ᶕ䈤ˈᡁԜਟԕⴤ᧕ᢺᆳԜⴻ֌ᱟ⢙⨶޵ᆈѝⲴൠ൰DŽ ަ亥ⴞᖅ㺘઼Ҽ㓗亥㺘ᐢ䇮㖞ᡀᢺ 0--16MB Ⲵ㓯ᙗൠ൰オ䰤ааሩᓄࡠ⢙⨶ൠ൰кˈঐ⭘Ҷ 4 њⴞᖅ亩ˈ ᖅ㺘઼޵ṨⲴҼ㓗亥㺘ǃ޵Ṩተ䜘ᮠᦞԕ৺޵ṨѤᰦึḸ˄ሶ㻛⭘֌ㅜ 1 њԫ࣑ণԫ࣑ 0 Ⲵ⭘ᡧึḸ˅DŽ 16MB ൠ൰㤳തDŽ൘䈕㤳തѝਜ਼ᴹ޵ṨᡰᴹⲴԓ⸱ǃ޵Ṩ⇥㺘˄GDTǃIDTǃTSS˅ǃ亥ⴞ ޡ 0xFFFFFF 䇮㖞ᡀѪ䮯ᓖѪ 16MB Ⲵ⇥DŽ൘㓯ᙗൠ൰オ䰤ѝ䘉єњ⇥Ⲵ㤳ത䟽ਐˈ䜭ᱟӾ㓯ᙗൠ൰ 0 ᔰ࿻ࡠൠ൰ ሩҾ Linux 0.11 ޵Ṩԓ⸱઼ᮠᦞᶕ䈤ˈ൘ head.s 〻ᒿⲴࡍ࿻ॆ᫽֌ѝᐢ㓿ᢺ޵Ṩԓ⸱⇥઼ᮠᦞ⇥䜭 ޻Ṯԙ⸷ૂᮦᦤⲺ൦൶ ㌫DŽ⭡Ҿԫ࣑ 0 ઼ԫ࣑ 1 Ⲵ⭏ᡀᡆࡋᔪ䗷〻∄䖳⢩↺ˈᡁԜሶሩᆳԜ࠶࡛䘋㹼᧿䘠DŽޣѝⲴሩᓄ ֻˈ䈖㓶䈤᰾޵Ṩԓ⸱઼ᮠᦞԕ৺਴ԫ࣑Ⲵԓ⸱઼ᮠᦞ൘㲊ᤏൠ൰オ䰤ǃ㓯ᙗൠ൰オ䰤઼⢙⨶ൠ൰オ䰤 ࡽ䶒ᡁԜṩᦞ޵ᆈ࠶⇥઼࠶亥ᵪࡦ䈖㓶䈤᰾Ҷ CPU Ⲵ޵ᆈ㇑⨶ᯩᔿDŽ⧠൘ᡁԜԕ Linux 0.11 ㌫㔏Ѫ 5.3.6 㲐ᤕ൦൶Ƚ㓵ᙝ൦൶ૂ⢟⨼൦൶ҁ䰪Ⲻީ㌱ ഴ ཐԱࣗ㌱㔕   LQX[ ޵Ṩሩ޵ᆈⲴ㇑⨶઼֯⭘/ %.   *'7 㺘  㲊ᤏൠ൰ 㓯ᙗൠ൰ ⢙⨶ൠ൰   ԓ⸱⇥ ޵Ṩ ᮠᦞ⇥ ޵Ṩ ㌫㔏⇥ 18// ԓ⸱⇥ &RGH ᮠᦞ⇥ 'DWD  0%  *% 32MB Ⲵ㓯ᙗൠ൰㤳ത᱐ሴࡠ⢙⨶޵ᆈкDŽ ֻྲ൘㌫㔏ѝᴹ 32MB ⢙⨶޵ᆈⲴᛵߥлˈᡁԜቡ䴰㾱Ѫ޵Ṩԓ⸱઼ᮠᦞ⇥ᔪ・ 8 њҼ㓗亥㺘亩ᶕᢺ 䙊䗷൘䘉䟼Ѫ޵Ṩ໎࣐аӋ亥㺘ˈᒦфሩ init/main.c 〻ᒿ〽֌؞᭩ˈᡁԜਟԕሩ↔䲀ࡦ䘋㹼ᢙኅDŽ ൘ 16MB ѻкⲴ⢙⨶޵ᆈሶнՊ⭘ࡠDŽ 〻ᒿѝࡍ࿻ॆᰦ䲀ࡦҶሩ 16MB ԕк޵ᆈⲴ֯⭘ˈᒦф䘉䟼޵Ṩҏӵ᱐ሴҶ 0--16MB Ⲵ޵ᆈ㤳തˈഐ↔ ᢙኅˈᇎ䱵ᒦнՊ⭘ࡠнᆈ൘Ⲵ⢙⨶޵ᆈ४ฏDŽྲ᷌㌫㔏ᴹཊҾ 16MB Ⲵ⢙⨶޵ᆈˈ⭡Ҿ൘ init/main.c ᙗൠ൰亥䶒᱐ሴࡠнᆈ൘Ⲵ 4MB--16MB ѝ৫DŽ޵Ṩѝ䘉ṧⲴ唈䇔䇮㖞ѫ㾱ᱟѪҶׯҾ㌫㔏⢙⨶޵ᆈⲴ ൘ࡍ࿻ॆᰦ޵Ṩ޵ᆈ㇑⨶〻ᒿՊ⸕䚃ᵪಘѝᡰਜ਼⢙⨶޵ᆈ䟿Ⲵ⺞࠷བྷሿˈഐ㘼нՊ䇙 CPU ࠶亥ᵪࡦᢺ㓯 ↔ᰦ޵Ṩ 4MB--16MB ൠ൰㤳തቡՊ᱐ሴࡠнᆈ൘Ⲵ⢙⨶޵ᆈൠ൰кDŽն䘉ᒦн࿘⺽㌫㔏Ⲵ䘀㹼DŽഐѪ ਟԕ䘀㹼 Linux 0.11 ㌫㔏ҶDŽ㤕ᵪಘਚᴹ 4MB ⢙⨶޵ᆈˈ䛓Ѹޘ㾱ᴹ 4MB˄⭊㠣 2MB˅⢙⨶޵ᆈቡᆼ 㲭❦ Linux 0.11 唈䇔ਟ㇑⨶ 16MB ⢙⨶޵ᆈˈնᱟ㌫㔏ѝᒦнᱟаᇊ㾱ᴹ䘉Ӌ⢙⨶޵ᆈDŽᵪಘѝਚ ᱐ሴ㺘亩DŽ ઼亥㺘亩DŽ㲭❦ԫ࣑ 1 Ⲵԓ⸱઼ᮠᦞҏ൘޵Ṩѝˈն⭡ҾԆ䴰㾱ਖ㹼࠶䝽㧧ᗇ޵ᆈˈഐ↔ҏ䴰㾱㠚ᐡⲴ ൠ൰ѝⲴн਼ᡆ䜘࠶н਼ˈഐ↔޵Ṩ䴰㾱ࣘᘱൠ൘ѫ޵ᆈ४ѝѪᆳԜ֌᱐ሴ᫽֌ˈࣘᘱൠᔪ・亥ⴞᖅ亩 ࣘˈഐ↔ᰐ享޽䟽ᯠᔪ・ᡆ〫ࣘ㺘ս㖞DŽĹ䲔ԫ࣑ 0 ԕཆˈᡰᴹަԆԫ࣑ᡰ䴰㾱Ⲵ⢙⨶޵ᆈ亥䶒о㓯ᙗ ઼ IDTR ᤷੁᯠⲴ GDT ઼ IDTˈ᧿䘠ㅖҏ䴰㾱䟽ᯠ࣐䖭DŽն⭡Ҿᔰ੟࠶亥ᵪࡦᰦ䘉єњ㺘Ⲵս㖞⋑ᴹਈ ᣔ⁑ᔿਾˈ൘䘀㹼Ⲵㅜ 1 њ〻ᒿ head.s ѝᡁԜ䴰㾱䟽ᯠ䇮㖞䘉єњ㺘DŽণ䇮㖞 GDTR؍ޕߢ˅ˈഐ↔൘䘋 ᣔ⁑ᔿਾ޵Ṩ㌫㔏⁑ඇ༴Ҿ⢙⨶޵ᆈ 0 ᔰ࿻ս㖞ˈᒦф 0x90200 ༴Ⲵオ䰤ሶ㻛ᥚ֌Ԇ⭘˄⭘Ҿ儈䙏㕃؍ ޕᣔ⁑ᔿѻࡽᗵ享䇮㖞ⲴDŽ⭡Ҿ䘉єњ㺘ᖃᰦ༴Ҿ⢙⨶޵ᆈབྷ㓖 0x90200 ༴ˈ㘼䘋؍ޕ઼ IDTˈ䘉ᱟ䘋 ൠ൰ҏ਼ṧㅹҾᆳԜⲴ⢙⨶ൠ൰DŽ൘ᇎ⁑ᔿлⲴ setup.s 〻ᒿࡍ࿻ॆ᫽֌ѝˈᡁԜᴮ㓿䇮㖞䗷ѤᰦⲴ GDT ᱟаṧⲴDŽ䘉ṧ䇮㖞ਟԕབྷབྷㆰॆ޵ṨⲴࡍ࿻ॆ᫽֌DŽĸGDT ઼ IDT ൘޵Ṩᮠᦞ⇥ѝˈഐ↔ᆳԜⲴ㓯ᙗ ⇿њ亥䶒 4KBDŽ䙊䗷к䘠࠶᷀ਟԕⴻࠪ˖ķ޵Ṩԓ⸱⇥઼ᮠᦞ⇥४ฏ൘㓯ᙗൠ൰オ䰤઼⢙⨶ൠ൰オ䰤ѝ ᴹ 4096 њ⢙⨶亥䶒˄亥ᑗ˅ˈޡˈഐ↔ˈ唈䇔ᛵߥл Linux 0.11 ޵Ṩᴰཊਟ㇑⨶ 16MB Ⲵ⢙⨶޵ᆈ ഴ ޻Ṯԙ⸷ૂᮦᦤ⇫൞п〃൦൶グ䰪ѣⲺީ㌱   LQX[ ޵Ṩሩ޵ᆈⲴ㇑⨶઼֯⭘/ %.  %.  /'7 㺘 766 ⇥ ԓ⸱⇥ &RGH ᮠᦞ⇥ 'DWD ⣦ᘱ⇥ 766 ተ䜘㺘 /'7 *'7 㺘  㲊ᤏൠ൰ 㓯ᙗൠ൰ ⢙⨶ൠ൰   ԓ⸱⇥  ԫ࣑ ᮠᦞ⇥  ԫ࣑ ㌫㔏⇥ 18// ԓ⸱⇥ &RGH ᮠᦞ⇥ 'DWD  0%  *%  Ⲵ TSS ⇥㔃ᶴؑ᚟DŽ㿱മ 5-16 ᡰ⽪DŽ ԫ࣑ᮠᦞ㔃ᶴ઼⭘֌ԫ࣑ 1 Ⲵ޵ṨึḸオ䰤DŽԫ࣑ᮠᦞ㔃ᶴ˄ҏ〠䘋〻᧗ࡦඇ PCB˅ؑ᚟ѝवᤜԫ࣑ 1 ⭘ањ亥ⴞᖅ亩઼ањҼ㓗亥㺘DŽਖཆˈ㌫㔏䘈ՊѪԫ࣑ 1 ൘ѫ޵ᆈ४ฏѝ⭣䈧а亥޵ᆈ⭘ᶕᆈ᭮ᆳⲴ ᱐ሴࡠҶ⢙⨶ൠ൰ 0--640KB ༴DŽ↔ᰦԫ࣑ 1 Ⲵ䮯ᓖҏᱟ 640KBˈᒦфަԓ⸱⇥઼ᮠᦞ⇥⴨䟽ਐˈਚঐ ઼亥㺘㺘亩ˈᆳᢺԫ࣑ 1 ঐ⭘Ⲵ㓯ᙗオ䰤㤳ത 64MB--128MB˄ᇎ䱵кᱟ 64MB--64MB+640KB˅ҏ਼ṧ 䈧Ҷа亥޵ᆈᶕᆈ᭮ˈᒦ༽ࡦҶ⡦䘋〻˄ԫ࣑ 0˅Ⲵ亥ⴞᖅ઼Ҽ㓗亥㺘亩DŽഐ↔ԫ࣑ 1 ᴹ㠚ᐡⲴ亥ⴞᖅ 㓯ᙗൠ൰オ䰤ѝˈ㌫㔏൘֯⭘ fork()ࡋᔪԫ࣑ 1˄init 䘋〻˅ᰦѪᆈ᭮ԫ࣑ 1 ⲴҼ㓗亥㺘㘼൘ѫ޵ᆈ४⭣ оԫ࣑ 0 ㊫լˈԫ࣑ 1 ҏᱟањ⢩↺Ⲵԫ࣑DŽᆳⲴԓ⸱ҏ൘޵Ṩԓ⸱४ฏѝDŽоԫ࣑ 0 н਼Ⲵᱟ൘ Աࣗ 1 Ⲻ൦൶ሯᓊީ㌱ 䰤㲭❦൘޵Ṩオ䰤ѝˈնԫ࣑ 0 ӽ❦㜭ሩަ䘋㹼䈫߉᫽֌DŽ 㺘亩ѝⲴ኎ᙗ䜭ᐢ㓿㻛䇮㖞ᡀҶ 0b111ˈণሩᓄ亥䶒⭘ᡧਟ䈫߉ᒦфᆈ൘ˈഐ↔⭘ᡧึḸ user_stack[]オ ᘱึḸ઼⭘ᡧᘱึḸオ䰤ҏ䜭൘޵Ṩԓ⸱४ѝˈᒦф⭡Ҿ൘޵Ṩࡍ࿻ॆᰦ˄head.s˅䘉Ӌ޵Ṩ亥䶒൘亥 ⭡Ҿԫ࣑ 0 ⴤ᧕㻛वਜ਼൘޵Ṩԓ⸱ѝˈഐ↔н䴰㾱Ѫަ޽ਖཆ࠶䝽޵ᆈ亥DŽᆳ䘀㹼ᰦᡰ䴰㾱Ⲵ޵Ṩ ഴ Աࣗ  ൞пѠ൦൶グ䰪ѣⲺ⴮ӈީ㌱  ㌫㿱മ 5-15 ᡰ⽪DŽޣѝĀԫ࣑ 0 㔃ᶴؑ᚟āа亩ᡰ⽪DŽйњൠ൰オ䰤ѝⲴ᱐ሴሩᓄ ㅜ 113 㹼ᔰ࿻ⲴᮠᦞDŽTSS0 ⇥սҾ޵Ṩ sched.c 〻ᒿⲴԓ⸱ѝˈ䮯ᓖѪ 104 ᆇ㢲ˈާփս㖞ਟ৲㿱മ 5-23 䟽ਐⲴDŽሩᓄⲴԫ࣑⣦ᘱ⇥ TSS0 ҏᱟ᡻ᐕ亴䇮㖞ྭⲴˈᒦфսҾԫ࣑ 0 ᮠᦞ㔃ᶴؑ᚟ѝˈ৲㿱 sched.h Ṩԓ⸱ᐢ㓿䇮㖞ྭⲴ亥ⴞᖅ઼亥㺘䘋㹼࠶亥ൠ൰ਈᦒDŽ਼ṧˈᆳⲴԓ⸱઼ᮠᦞ⇥൘㓯ᙗൠ൰オ䰤ѝҏᱟ ԓ⸱઼ᮠᦞⴤ᧕वਜ਼൘޵Ṩԓ⸱઼ᮠᦞѝˈᱟӾ㓯ᙗൠ൰ 0 ᔰ࿻Ⲵ 640KB ޵ᇩˈഐ↔ਟԕᆳⴤ᧕֯⭘޵ ԫ࣑ 0 ᱟ㌫㔏ѝањӪᐕ੟ࣘⲴㅜањԫ࣑DŽᆳⲴԓ⸱⇥઼ᮠᦞ⇥䮯ᓖ㻛䇮㖞Ѫ 640KBDŽ䈕ԫ࣑Ⲵ Աࣗ 0 Ⲻ൦൶ሯᓊީ㌱  LQX[ ޵Ṩሩ޵ᆈⲴ㇑⨶઼֯⭘/  ⣦ᘱ⇥ 766 ተ䜘㺘 /'7 0% .% ⸱ᮠᦞ ޵Ṩԓ .%  /'7 㺘 766 ⇥ ԓ⸱⇥ &RGH ᮠᦞ⇥ 'DWD ⣦ᘱ⇥ 766 ተ䜘㺘 /'7 *'7 㺘  㲊ᤏൠ൰ 㓯ᙗൠ൰ ⢙⨶ൠ൰   ԓ⸱⇥  ԫ࣑ ᮠᦞ⇥  ԫ࣑ ㌫㔏⇥ 18// ԓ⸱⇥ &RGH ᮠᦞ⇥ 'DWD  0%  *%  0%.% ަ㓯ᙗൠ൰オ䰤ѝDŽ䘉⿽࠶䝽઼᱐ሴ⢙⨶޵ᆈ亥䶒Ⲵᯩ⌅〠Ѫ䴰≲࣐䖭˄Load on demand˅DŽ৲㿱޵ᆈ㇑ ࿻ᢗ㹼ᰦ⭡Ҿਁ⭏㕪亥㘼ᕅ䎧ᔲᑨᰦ᡽Պ⭡޵ᆈ㇑⨶〻ᒿѪަ൘ѫ޵ᆈ४ѝ࠶䝽ᒦ᱐ሴа亥⢙⨶޵ᆈࡠ ԫ࣑ 2 ࠶䝽Ҷ 64MB Ⲵオ䰤㤳തˈնᱟ޵ṨᒦнՊ・࡫Ѫަ࠶䝽઼᱐ሴ⢙⨶޵ᆈ亥䶒DŽਚᴹᖃԫ࣑ 2 ᔰ 㓿᱐ሴҶа亥⢙⨶޵ᆈ亥䶒ⲴᛵߥDŽ䘉䟼䈧⌘᜿ˈ൘ᢗ㹼 execve()࠭ᮠᰦˈ㌫㔏㲭❦൘㓯ᙗൠ൰オ䰤Ѫ ߥˈণԫ࣑ 2 ৏ݸ༽ࡦԫ࣑ 1 Ⲵԓ⸱઼ᮠᦞ㻛 shell 〻ᒿⲴԓ⸱⇥઼ᮠᦞ⇥ᴯᦒਾⲴᛵߥDŽമѝᱮ⽪ࠪᐢ 亥ⴞᖅ઼亥㺘㺘亩DŽമ 5-17 㔉ࠪⲴᱟԫ࣑ 2 ѝᔰ࿻ᢗ㹼 shell 〻ᒿᰦⲴᛵޣⲴᢗ㹼〻ᒿ shell 䟽ᯠ䇮㖞⴨ ᒦᢗ㹼 shell 〻ᒿᰦˈ䈕㌫㔏䈳⭘Պ䟺᭮ᦹӾԫ࣑ 1 ༽ࡦⲴ亥ⴞᖅ઼亥㺘㺘亩৺⴨ᓄ޵ᆈ亥䶒ˈ❦ਾѪᯠ ㌫оԫ࣑ 1 Ⲵ㊫լDŽᖃԫ࣑ 2 Ⲵԓ⸱˄init()˅䈳⭘ execve()㌫㔏䈳⭘ᔰ࿻࣐䖭ޣᦞ൘й⿽ൠ൰オ䰤ѝⲴ ࡋᔪԫ࣑ 2 ᰦˈ䲔Ҷঐ⭘㓯ᙗൠ൰オ䰤㤳തн਼ཆ˄128MB--128MB+640KB˅ˈ↔ᰦԫ࣑ 2 Ⲵԓ⸱઼ᮠ ൘ԫ࣑ 2 㻛ࡋᔪࠪᶕѻਾˈሶ൘ަѝ䘀㹼 execve()࠭ᮠᶕᢗ㹼 shell 〻ᒿDŽᖃ޵Ṩ䙊䗷༽ࡦԫ࣑ 1 ࡊ ㌫DŽޣമ 5-17 ᱮ⽪ࠪҶԫ࣑ 2 Ⲵԓ⸱⇥઼ᮠᦞ⇥൘й⿽ൠ൰オ䰤ѝⲴሩᓄ 䟽ਐDŽޘⴞᖅ亩DŽ㲊ᤏオ䰤ѝԫ࣑ԓ⸱⇥઼ᮠᦞ⇥䜭㻛᱐ሴࡠ㓯ᙗൠ൰オ䰤⴨਼Ⲵ㤳തˈഐ↔ᆳԜҏᆼ ঐ⭘ 64MB/4MB = 16 њ亥ޡˈ㻛䇮㖞Ѫ 64MBˈഐ↔ԫ࣑ 2 ঐᴹⲴ㓯ᙗൠ൰オ䰤㤳തᱟ 128MB--192MB nr*64MB ༴DŽֻྲԫ࣑ 2 Ⲵᔰ࿻ս㖞= nr*64MB = 2 * 64MB = 128MBDŽԫ࣑ԓ⸱⇥઼ᮠᦞ⇥Ⲵᴰབྷ䮯ᓖ Ӿԫ࣑ 2 ᔰ࿻ˈྲ᷌ԫ࣑ਧԕ nr ᶕ㺘⽪ˈ䛓Ѹԫ࣑ nr ൘㓯ᙗൠ൰オ䰤ѝⲴ䎧࿻ս㖞ሶ㻛䇮ᇊ൘ Ⲵ֯⭘ᛵߥDŽ ਟԕᴹ 64 њ䘋〻਼ᰦᆈ൘DŽл䶒ᡁԜԕԫ࣑ 2 Ѫֻᶕ䈤᰾ަԆԫօԫ࣑ሩൠ൰オ䰤ޡLinux 0.11 ㌫㔏ѝ ሩҾ㻛ࡋᔪⲴӾԫ࣑ 2 ᔰ࿻ⲴަԆԫ࣑ˈᆳԜⲴ⡦䘋〻䜭ᱟ init˄ԫ࣑ 1˅䘋〻DŽᡁԜᐢ㓿⸕䚃ˈ൘ ެԌԱࣗⲺ൦൶ሯᓊީ㌱ ޵ᆈ४亥䶒֌ѪึḸオ䰤֯⭘DŽ ༴Ⲵ亥㺘亩㻛䇮㖞ᡀਚ䈫ˈ֯ᗇԫ࣑ 1 ൘ᢗ㹼ึḸ᫽֌ᰦሶՊᕅ䎧߉亥䶒ᔲᑨˈӾ㘼⭡޵Ṩਖ㹼࠶䝽ѫ ӛ֯⭘ˈնᖃԫ࣑ 1 ᔰ࿻䘀㹼ᰦˈ⭡Ҿԫ࣑ 1 ᱐ሴࡠ user_stack[]ޡ Ⲵ⭘ᡧᘱึḸ user_stack[]оԫ࣑ 1 㻛༽ࡦ⭘Ҿԫ࣑ 1 ⲴึḸнਜ਼ᴹᰐ⭘ᮠᦞDŽ൘ࡊᔰ࿻ࡋᔪԫ࣑ 1 ᰦˈԫ࣑ 0؍⺞ᤱĀᒢ߰āˈԕ؍⭘ѻࡽ Ⲵ⭘ᡧᘱึḸオ䰤 user_stack[]˄৲㿱 kernel/sched.cˈㅜ 67--72 㹼˅ˈഐ↔䘉њึḸ䴰㾱൘ԫ࣑ 1 ᇎ䱵֯ ӛ֯⭘༴Ҿ޵Ṩԓ⸱઼ᮠᦞ४ฏ˄㓯ᙗൠ൰ 0--640KB˅ѝԫ࣑ 0ޡԫ࣑ 1 Ⲵ⭘ᡧᘱึḸオ䰤ሶⴤ᧕ ഴ Աࣗ  ൞п〃൦൶グ䰪ѣⲺީ㌱  LQX[ ޵Ṩሩ޵ᆈⲴ㇑⨶઼֯⭘/  亥޵ᆈ ⣦ᘱ⇥ 766 ተ䜘㺘 /'7  ⣦ᘱ⇥ 766 ተ䜘㺘 /'7 0% 0% .% ⸱ᮠᦞ ޵Ṩԓ .%  /'7 㺘 766 ⇥ ԓ⸱⇥ &RGH ᮠᦞ⇥ 'DWD ⣦ᘱ⇥ 766 ተ䜘㺘 /'7 *'7 㺘  㲊ᤏൠ൰ 㓯ᙗൠ൰ ⢙⨶ൠ൰   ԓ⸱⇥  ԫ࣑ ᮠᦞ⇥  ԫ࣑ ㌫㔏⇥ 18// ԓ⸱⇥ &RGH ᮠᦞ⇥ 'DWD  0%  *%  ᖃ⭘ᡧ֯⭘޵ᆈ䟺᭮࠭ᮠ free()ࣘᘱ䟺᭮ᐢ⭣䈧Ⲵ޵ᆈඇᰦˈC ᓃѝⲴ޵ᆈ㇑⨶࠭ᮠቡՊᢺᡰ䟺᭮Ⲵ ⮉㔉〻ᒿ޽⭣䈧޵ᆈᰦ֯⭘DŽ؍࠭ᮠࡉާփ䇠ᖅ⭘ᡧ〻ᒿ֯⭘Ҷа亥޵ᆈⲴཊቁᆇ㢲DŽ࢙։Ⲵᇩ䟿ሶ ާփս㖞ˈࡉ൷⭡ C ᓃѝ޵ᆈ࠶䝽࠭ᮠ malloc()䍏䍓㇑⨶DŽ޵Ṩԕ亥䶒Ѫঅս࠶䝽઼᱐ሴ⢙⨶޵ᆈˈ䈕 亥䶒࠶䝽ᒦ᱐ሴа亥⢙⨶޵ᆈ亥䶒DŽ㠣Ҿ⭘ᡧ〻ᒿ↔⅑⭣䈧޵ᆈⲴᆇ㢲䮯ᓖᮠ䟿઼൘ሩᓄ⢙⨶亥䶒ѝⲴ ᮷ԦሩᓄⲴ޵ᆈ㤳തѝˈ䛓Ѹ CPU ቡՊӗ⭏ањ㕪亥ᔲᑨˈᒦ൘ᔲᑨ༴⨶〻ᒿѝѪᤷᇊⲴۿᢗ㹼᮷Ԧ᱐ 㤕䘋〻ԓ⸱ራ൰ⲴḀњᮠᦞᡰ൘Ⲵ亥䶒нᆈ൘ˈᒦф䈕亥䶒ᡰ༴ս㖞኎Ҿ䘋〻ึ㤳തˈণн኎Ҿަ ޵ᆈ亥䶒Ⲵ᱐ሴ᫽֌DŽ⨶⢙ޣṨ᡽Պ䘋㹼⴨ ↔ᰦᒦнѪᯠ⭣䈧Ⲵオ䰤᱐ሴ⢙⨶޵ᆈ亥䶒DŽਚᴹᖃ〻ᒿራ൰ࡠḀњнᆈ൘ሩᓄ⢙⨶亥䶒Ⲵൠ൰ᰦˈ޵ նᒦˈ〻ᒿ㾱≲ᯠ໎Ⲵオ䰤䮯ᓖ䙊⸕޵Ṩˈ޵Ṩԓ⸱Ӿ㘼ਟԕṩᦞ malloc()ᡰᨀ׋Ⲵؑ᚟ᶕᴤᯠ brk Ⲵ٬ ᦞオ䰤˅൘䘋〻ൠ൰オ䰤ѝⲴᵛㄟս㖞DŽᖃ malloc()࠭ᮠѪ〻ᒿ࠶䝽޵ᆈᰦˈᆳՊ䙊䗷㌫㔏䈳⭘ brk()ᢺ ᆈ൘⇿њ䘋〻Ⲵᮠᦞ㔃ᶴѝDŽᆳᤷࠪҶ䘋〻ԓ⸱઼ᮠᦞ˄वᤜࣘᘱ࠶䝽Ⲵᮠ؍brkˈ䘉њ٬ ᖃࡽս㖞٬ ራ൰ሩᓄⲴ亥䶒࠶䝽⢙⨶޵ᆈ亥䶒ᒦ䘋㹼᱐ሴ᫽֌DŽնᱟ޵ṨՊѪ䘋〻֯⭘Ⲵԓ⸱઼ᮠᦞオ䰤㔤ᣔањ 䰤ˈᡰԕਚ㾱䘋〻ᢗ㹼ᰦራ൰Ⲵ㤳ത൘ᆳⲴ 64MB 㤳ത޵ˈ޵Ṩҏ਼ṧՊ䙊䗷޵ᆈ㕪亥㇑⨶ᵪࡦ㠚ࣘѪ ˄䲔Ҷԫ࣑ 0 ઼ 1ˈᆳԜо޵Ṩԓ⸱а䎧ᑨ傫޵ᆈѝ˅൘ CPU Ⲵ 4G 㓯ᙗൠ൰オ䰤ѝ࠶䝽Ҷ 64MB Ⲵオ བྷሿ൷⭡儈ቲ⅑Ⲵ C ᓃ࠭ᮠ malloc()ᶕ䘋㹼㇑⨶ˈ޵Ṩᵜ䓛ᒦнՊᨂ᡻㇑⨶DŽഐѪ޵Ṩᐢ㓿Ѫ⇿њ䘋〻 ᖃ⭘ᡧᓄ⭘〻ᒿ֯⭘ C ࠭ᮠᓃѝⲴ޵ᆈ࠶䝽࠭ᮠ malloc()⭣䈧޵ᆈᰦˈ䘉Ӌࣘᘱ⭣䈧Ⲵ޵ᆈᇩ䟿ᡆ 5.3.7 ⭞ᡭ⭩䈭޻ᆎⲺࣞᘷ࠼䞃 ֯⭘Ⲵ޵ᆈ㇑⨶৏⨶ҏ㜭・࡫᰾ⲭDŽ⭡Ҿㇷᑵᡰ䲀ˈ䘉䟼ሩ↔н޽䈤᰾DŽ ൠ൰オ䰤㤳തDŽྲ᷌ᡁԜ㜭⨶䀓ᵜ㢲䈤᧿䘠Ⲵ޵ᆈ㇑⨶ᾲᘥˈ䛓ѸሩҾ⧠൘ᡰ֯⭘Ⲵ Linux 2.x ޵Ṩѝᡰ Ӿ Linux ޵Ṩ 0.99 ⡸ԕਾˈሩ޵ᆈオ䰤Ⲵ֯⭘ᯩᔿਁ⭏ҶਈॆDŽ⇿њ䘋〻ਟԕঅ⤜ӛ⭘ᮤњ 4G Ⲵ ഴ ެԌԱࣗ൦൶グ䰪ѣⲺሯᓊީ㌱  䘠DŽ᧿ޣ⨶аㄐѝⲴ⴨  LQX[ ޵Ṩሩ޵ᆈⲴ㇑⨶઼֯⭘/ ࡠҶ PC ᵪ㌫ࡇⲴੁлڊ֯ᗇԫօ֯⭘ IRQ2 Ⲵ PC/XT Ⲵ 8 ս䇮䝽঑൘ PC/AT ᵪл䶒ӽ❦㜭↓ᑨ֯⭘DŽ BIOS ѝⲴ䖟Ԧᢺ IRQ9 Ⲵѝᯝ int 71 䟽ᯠᇊੁࡠҶ IRQ2 Ⲵѝᯝ int 0x0A Ⲵѝᯝ༴⨶䗷〻DŽ䘉ṧаᶕਟ ণ PC/AT ᵪ࡙⭘⺜Ԧ⭥䐟ᢺ֯⭘ IRQ2 Ⲵ䇮༷Ⲵ IRQ2 ᕅ㝊䟽ᯠᇊੁࡠҶ PIC Ⲵ IRQ9 ᕅ㝊кˈᒦ࡙⭘ ਧDŽѫ 8259A 㣟⡷Ⲵㄟਓสൠ൰ᱟ 0x20ˈӾ㣟⡷ᱟ 0xA0DŽIRQ9 ᕅ㝊Ⲵ֌⭘о PC/XT Ⲵ IRQ2 ⴨਼ˈؑޕ INT ᕅ㝊䘎᧕ࡠѫ㣟⡷Ⲵ IR2 ᕅ㝊кˈণ 8259A Ӿ㣟⡷ਁࠪⲴѝᯝؑਧሶ֌Ѫ 8259A ѫ㣟⡷Ⲵ IRQ2 䗃 ਟ㇑⨶ 15 㓗ѝᯝੁ䟿DŽަ㓗䘎⽪᜿മ㿱മ 5-18 ᡰ⽪DŽަѝӾ㣟⡷Ⲵޡˈ⡷ᵪѝˈ֯⭘Ҷє⡷ 8259A 㣟 ⨶ 8 њѝᯝⓀDŽ䙊䗷ཊ⡷㓗㚄ᯩᔿˈ8259A 㜭ᶴᡀᴰཊ㇑⨶ 64 њѝᯝੁ䟿Ⲵ㌫㔏DŽ൘ PC/AT ㌫ࡇެᇩ ൘֯⭘ 80X86 㓴ᡀⲴᗞᵪᵪ㌫㔏ѝ䟷⭘Ҷ 8259A ਟ㕆〻ѝᯝ᧗ࡦಘ㣟⡷DŽ⇿њ 8259A 㣟⡷ਟԕ㇑ 5.4.2 80X86 ᗤᵰⲺѣᯣᆆ㌱㔕 ⨶䗷〻ѝỰ⍻ࡠ䭉䈟㘼ӗ⭏Ⲵѝᯝ᫽֌DŽਚᴹл䶒ᨀ৺ⲴаӋѝᯝ㻛⭘Ҿ䇮༷кDŽ ᨀ׋Ҷሩ 256 њѝᯝⲴ᭟ᤱˈަѝབྷ䜘࠶䜭⭘Ҿ䖟Ԧѝᯝᡆᔲᑨˈᔲᑨᱟ༴⨶ಘ൘༴ޡPC/AT ㌫ࡇᗞᵪ Ҿ䖟ԦѝDŽ䙊䗷֯⭘ int ᤷԔᒦ֯⭘ަ᫽֌ᮠᤷ᰾ѝᯝਧˈቡਟԕ䇙༴⨶ಘ৫ᢗ㹼⴨ᓄⲴѝᯝ༴⨶䗷〻DŽ ᆳҏਟԕ⭘ˈޣ䗃ࠪ䇮༷Ⲵѝᯝᴽ࣑༴⨶䗷〻DŽնᱟѝᯝᯩ⌅ᒦ䶎аᇊо⺜Ԧ⴨ޕԕк᧿䘠Ⲵᱟ䗃 ࣑〻ᒿDŽᖃѝᯝᴽ࣑〻ᒿᢗ㹼㔃ᶏˈ༴⨶ಘቡ㔗㔝ᢗ㹼㻛ѝᯝؑਧᢃᯝⲴ〻ᒿDŽ 䇮༷Ⲵѝᯝੁ䟿˄ণѝᯝᴽ࣑〻ᒿⲴൠ൰˅ᒦᔰ࿻ᢗ㹼ѝᯝᴽޣᣔ⁑ᔿлⲴѝᯝ᧿䘠ㅖ㺘˅ਆᗇ⴨؍ս ᯝਧᶕ੺⸕༴⨶ಘ㾱ᢗ㹼ଚњѝᯝᴽ࣑䗷〻DŽ༴⨶ಘࡉṩᦞ䈫ਆⲴѝᯝਧ䙊䗷ḕ䈒ѝᯝੁ䟿㺘˄ᡆ 32 Ⲵһᛵᒦ䈒䰞 PIC 䴰㾱ᢗ㹼ଚњѝᯝᴽ࣑䈧≲DŽPIC ࡉ䙊䗷ੁᮠᦞᙫ㓯ਁ䘱ࠪоѝᯝ䈧≲ሩᓄⲴѝڊᡰ лᖃᰦڌੁ༴⨶ಘਁࠪањѝᯝؑਧDŽᖃ PIC ੁ༴⨶ಘⲴ INT ᕅ㝊ਁࠪањѝᯝؑਧᰦˈ༴⨶ಘՊ・࡫ PIC 䘈䴰㾱ᢺ䘹ࠪⲴѝᯝ䈧≲о↓൘༴⨶Ⲵѝᯝ䈧≲ⲴՈݸ㓗䘋㹼∄䖳ˈᒦสҾ䈕∄䖳㔃᷌ᶕ⺞ᇊᱟ੖ ∄䖳ᒦ䘹ࠪᴰ儈Ոݸ㓗Ⲵѝᯝ䈧≲䘋㹼༴⨶DŽྲ᷌↔ᰦ༴⨶ಘ↓൘ᢗ㹼ањ䇮༷Ⲵѝᯝᴽ࣑䗷〻ˈ䛓Ѹ ؑਧᰦˈPIC ・࡫ՊỰ⍻ࡠDŽ൘਼ᰦ᭦ࡠࠐњ䇮༷Ⲵѝᯝᴽ࣑䈧≲ⲴᛵߥлˈPIC ՊሩᆳԜ䘋㹼Ոݸ㓗 㘵DŽᆳ䙊䗷䘎᧕ࡠ䇮༷Ⲵѝᯝ䈧≲ᕅ㝊᧕ਇ䇮༷ਁࠪⲴ㓸ㄟᴽ࣑䈧≲ؑਧDŽᖃ䇮༷◰⍫ަѝᯝ䈧≲ IRQ ਟ㕆〻ѝᯝ᧗ࡦಘ˄PIC - Programmable Interrupt Controller˅ᱟᗞᵪ㌫㔏ѝ㇑⨶䇮༷ѝᯝ䈧≲Ⲵ㇑⨶ Service Routine˅DŽ 〻ᒿࡉ㻛〠Ѫѝᯝᴽ࣑〻ᒿᡆѝᯝᴽ࣑䗷〻˄ISR - InterruptޣRequest˅DŽ༴⨶ಘ૽ᓄ䈧≲㘼ᢗ㹼Ⲵ䇮༷⴨ ѝᯝ˄Interrupt˅ᯩ⌅ˈ㘼䇮༷ੁ༴⨶ಘਁࠪⲴᴽ࣑䈧≲ࡉ〠Ѫѝᯝ䈧≲˄IRQ - Interruptڊ⨶ᯩᔿቡਛ ࡊ᡽㻛ѝᯝⲴ〻ᒿDŽ䘉⿽༴ڊᴽ࣑〻ᒿDŽᖃᴽ࣑〻ᒿᢗ㹼ᆼᡀਾˈ༴⨶ಘՊ᧕⵰৫ޣ㘼ᢗ㹼䈕䇮༷Ⲵ⴨ ᖃ䇮༷ੁ༴⨶ಘᨀࠪᴽ࣑䈧≲ᰦˈ༴⨶ಘՊ൘ᢗ㹼ᆼᖃࡽⲴаᶑᤷԔਾ・࡫ᓄㆄ䇮༷Ⲵ䈧≲ˈᒦ䖜 ᰦ㠚ᐡੁ༴⨶ಘᨀࠪ䈧≲DŽ༴⨶ಘҏਚᴹ൘䇮༷ᨀࠪ䈧≲ᰦ᡽Ѫަᨀ׋ᴽ࣑DŽ 㕆〻ㆰঅˈն㕪⛩ᱟཚ㙇༴⨶ಘ䍴Ⓚˈᖡ૽㌫㔏ᙗ㜭DŽੁ䇮༷ᨀ׋ᴽ࣑Ⲵਖа⿽ᯩ⌅ᱟ൘䇮༷䴰㾱ᴽ࣑ ൘䘉⿽ᯩ⌅ѝ༴⨶ಘ亪ᒿൠḕ䈒㌫㔏ѝⲴ⇿њ䇮༷ˈĀ䈒䰞āᆳԜᱟ੖䴰㾱ᴽ࣑DŽ䘉⿽ᯩ⌅ⲴՈ⛩ᱟ䖟Ԧ 䗃ࠪ䇮༷DŽ༴⨶ಘੁ䘉Ӌ䇮༷ᨀ׋ᴽ࣑Ⲵа⿽ᯩ⌅ᱟ֯⭘䖞䈒ᯩᔿDŽޕᗞර䇑㇇ᵪ㌫㔏䙊ᑨवᤜ䗃 5.4.1 ѣᯣᬃ֒৕⨼ ਟ㕆〻᧗ࡦಘⲴާփ㕆〻ᯩ⌅䈧৲㿱лаㄐ setup.s 〻ᒿਾⲴ䈤᰾DŽޣ Ⲵਟ㕆〻᧗ࡦಘ⺜Ԧ䙫䗁ԕ৺ Linux ㌫㔏ѝ֯⭘ѝᯝⲴᯩ⌅DŽᴹޣᵜ㢲ӻ㓽ѝᯝᵪࡦสᵜ৏⨶઼⴨ 5.4 Linux ㌱㔕Ⲻѣᯣᵰ࡬ ᓃ࠭ᮠ malloc()઼ free()Ⲵާփԓ⸱ᇎ⧠䈧৲㿱޵ṨᓃѝⲴ lib/malloc.c 〻ᒿDŽޣᴹ ⢙⨶޵ᆈ亥䶒DŽ 䶒᭦എᐢ࠶䝽઼᱐ሴࡠ䈕䘋〻ൠ൰オ䰤㤳തⲴᡰᴹޘᒦнՊ㻛䟺᭮ᦹDŽਚᴹᖃ䘋〻ᴰ㓸㔃ᶏᰦ޵Ṩ᡽Պ ޵ᆈඇḷ䇠Ѫオ䰢ˈԕ༷〻ᒿ޽⅑⭣䈧޵ᆈᰦ֯⭘DŽ൘䘉њ䗷〻ѝ޵ṨѪ䈕䘋〻ᡰ࠶䝽Ⲵ䘉њ⢙⨶亥䶒  LQX[ ㌫㔏Ⲵѝᯝᵪࡦ/ ''ᮠᦞ &38  ,175 ൠ൰ [$[EI  ⮉,54؍ ⺜ⴈ,54 ॿ༴⨶ಘ,54 36 啐ḷ,54 ⮉,54؍ ⮉,54؍ ,17$+,54 ᇎᰦ䫏 ,54 &6 $  ,5 ,5 ,5 ,5Ӿ⡷ $,5 ,5 ,5,17 ,5 &$6 ൠ൰ [[I  ᒦ㹼ਓ ,54 䖟ⴈ,54 ᒦ㹼ਓ ,54 Ѣ㹼ਓ ,54 Ѣ㹼ਓ ,54 ᧕㚄LQW,54 䭞ⴈ,54 ᰦ䫏,54 &$6 &6 $  ,5 ,5 ,5 ,5ѫ⡷ $,5 ,5 ,5,17 ,5 BIOS ᨀ׋Ⲵᱮ⽪઼⻱ⴈ䈫᫽֌ѝᯝ࣏㜭ˈ൘޵Ṩ↓ᑨ䘀㹼ѻࡽࡉՊ൘ setup.s 〻ᒿѝ䟽ᯠࡍ࿻ॆ 8259A ᆳՊ䟽ᯠ䇮㖞ѝᯝ 0x20—0x2f Ⲵѝᯝੁ䟿٬DŽ㘼ሩҾ Linux ㌫㔏ˈ䲔Ҷ൘ࡊᔰ࿻࣐䖭޵Ṩᰦ䴰㾱⭘ࡠ ൰DŽԕਾ൘㌫㔏ᕅሬ࣐䖭᫽֌㌫㔏ᰦՊṩᦞᇎ䱵䴰㾱؞᭩ḀӋѝᯝੁ䟿Ⲵ٬DŽֻྲˈሩҾ DOS ᫽֌㌫㔏ˈ ѤᰦⲴଁѝᯝᴽ࣑〻ᒿⲴൠޕᯝਧѪ 0x10—0x1f Ⲵѝᯝ䈳⭘࣏㜭ੁ䟿ㅹDŽሩҾᇎ䱵⋑ᴹ֯⭘Ⲵੁ䟿ࡉປ ൘ BIOS ᢗ㹼ࡍ࿻ॆ᫽֌ᰦˈᆳ䇮㖞Ҷєњ 8259A 㣟⡷᭟ᤱⲴ 16 њ⺜Ԧѝᯝੁ䟿઼ BIOS ᨀ׋Ⲵѝ 0x0000:N*4 ս㖞༴DŽ ᆈ൘⢙⨶޵ᆈ؍ਓൠ൰ޕᆳሩᓄⲴѝᯝੁ䟿൘޵ᆈѝⲴս㖞ቡᱟ 0x0000:N*4ˈণሩᓄⲴѝᯝᴽ࣑〻ᒿ 〻ᒿࡉ൘ BIOS ѝ㔉ࠪDŽ⭡Ҿѝᯝੁ䟿㺘ѝⲴੁ䟿ᱟ᤹ѝᯝਧ亪ᒿᧂࡇˈഐ↔㔉ᇊањѝᯝਧ Nˈ䛓Ѹ ѝⲴ〻ᒿՊ൘⢙⨶޵ᆈᔰ࿻ൠ൰ 0x0000:0x0000 ༴ࡍ࿻ॆᒦ䇮㖞ѝᯝੁ䟿㺘ˈ㘼਴ѝᯝⲴ唈䇔ѝᯝᴽ࣑ ٬DŽഐ↔ᮤњੁ䟿㺘Ⲵ䮯ᓖѪ 1024 ᆇ㢲DŽᖃ 80X86 ᗞᵪ੟ࣘᰦˈROM BIOS〫ٿ޵⇥٬઼⇥ᯝᴽ࣑〻ᒿⲴ ѝᯝᴽ࣑〻ᒿDŽ൘ 80X86 ᇎ⁑ᔿ䘀㹼ᯩᔿлˈ⇿њѝᯝੁ䟿⭡ 4 њᆇ㢲㓴ᡀDŽ䘉 4 њᆇ㢲ᤷ᰾Ҷањѝ ⁑ᔿл䈕㺘〠Ѫѝᯝ᧿䘠ㅖ㺘ˈ㿱л䶒䈤᰾˅DŽ80X86 ᗞᵪ᭟ᤱ 256 њѝᯝˈሩᓄ⇿њѝᯝ䴰㾱ᆹᧂањ ᣔ؍CPU ⭡ѝᯝਧḕ᢮ࡠሩᓄᗇѝᯝੁ䟿ˈቡ䴰㾱൘޵ᆈѝᔪ・аᕐḕ䈒㺘ˈণѝᯝੁ䟿㺘˄൘ 32 ս ਓൠ൰٬DŽഐ↔ѪҶ䇙ޕণሩᓄѝᯝᴽ࣑〻ᒿⲴˈк㢲ᐢᤷࠪ CPU ᱟṩᦞѝᯝਧ㧧ਆѝᯝੁ䟿٬ 5.4.3 ѣᯣੇ䠅㺞 ᒦᢗ㹼ѝᯝᴽ࣑〻ᒿDŽˈ䊑Ⲵѝᯝਧ䘱ࠪˈCPU ⭡↔㧧ਆሩᓄⲴѝᯝੁ䟿٬ ᕅ㝊 INT 䙊⸕ CPU ཆѝᯝ䈧≲ⲴࡠᶕˈCPU ૽ᓄਾˈ㣟⡷Ӿᮠᦞᙫ㓯 D7-D0 ሶ㕆〻䇮ᇊⲴᖃࡽᴽ࣑ሩ ༴⨶ᯩᔿDŽ䙊䗷ѝᯝࡔՈ䘹ᤙˈ㣟⡷ሶ䘹ѝᖃࡽᴰ儈Ոݸ㓗Ⲵѝᯝ䈧≲֌Ѫѝᯝᴽ࣑ሩ䊑ˈᒦ䙊䗷 CPU ਟ䲿ᰦ૽ᓄཆ䜘䇮༷ᨀࠪⲴѝᯝ䈧≲˄IRQ0 – IRQ15˅ˈ਼ᰦ㌫㔏䘈ਟԕ֯⭘᫽֌ભԔᆇ䲿ᰦ؞᭩ަѝᯝ ᫽֌⣦ᘱˈ↔ᰦ㣟⡷ণޕᤷԔሩ 8259A 㣟⡷䘋㹼ࡍ࿻ॆ㕆〻Ⲵ⣦ᘱDŽаᰖᆼᡀҶࡍ࿻ॆ㕆〻ˈ㣟⡷ণ䘋 ൘ᙫ㓯᧗ࡦಘ᧗ࡦлˈ8259A 㣟⡷ਟԕ༴Ҿ㕆〻⣦ᘱ઼᫽֌⣦ᘱDŽ㕆〻⣦ᘱᱟ CPU ֯⭘ IN ᡆ OUT  ᧝࡬㌱㔕 ഴ 3&$7 ᗤᵰ㓝䘔ᕅ  ެᇩᙗDŽ  LQX[ ㌫㔏Ⲵѝᯝᵪࡦ/ IRQ13 0x2d ˄45˅ ᮠᆖॿ༴⨶ಘѝᯝ IRQ12 0x2c ˄44˅ PS/2 啐ḷਓѝᯝ ⮉˄㖁㔌᧕ਓ˅؍ ˅IRQ11 0x2b ˄43 ⮉؍˅IRQ10 0x2a ˄42 ⮉؍˅IRQ9 0x29 ˄41 IRQ8 0x28 ˄40˅ ᇎᰦ䫏ѝᯝ IRQ7 0x27 ˄39˅ ᒦ㹼ਓ 1 IRQ6 0x26 ˄38˅ 䖟ⴈ傡ࣘಘ IRQ5 0x25 ˄37˅ ᒦ㹼ਓ 2 IRQ4 0x24 ˄36˅ Ѣ㹼ਓ 1 IRQ3 0x23 ˄35˅ Ѣ㹼ਓ 2 IRQ2 0x22 ˄34˅ ᧕䘎Ӿ㣟⡷ IRQ1 0x21 ˄33˅ 䭞ⴈѝᯝ IRQ0 0x20 ˄32˅ 8253 ਁࠪⲴ 100HZ ᰦ䫏ѝᯝ ѝᯝ䈧≲ਧ ѝᯝਧ ⭘䙄 $ 㣥⡽ѣᯣ䈭≸ਇ࠰Ⲻѣᯣਭࡍ㺞 㺞 ̢/LQX[ ㌱㔕ѣ ㌫㔏䈳⭘ѝᯝᱟ⭘ᡧ〻ᒿ֯⭘᫽֌㌫㔏䍴ⓀⲴୟа⭼䶒᧕ਓDŽ ؑਧ IRQ0--IRQ15˄㿱㺘 5–2 ᡰ⽪˅ˈᒦᢺ〻ᒿ㕆〻ਁࠪⲴ㌫㔏䈳⭘˄system call˅ѝᯝ䇮㖞Ѫ int128˄0x80˅DŽ ൘ Linux ㌫㔏ѝˈࡉሶ int32--int47˄0x20--0x2f˅ሩᓄҾ 8259A ѝᯝ᧗ࡦ㣟⡷ਁࠪⲴ⺜Ԧѝᯝ䈧≲ Abort ᭮ᔳ˄㓸→˅ ൘䭉䈟ਁ⭏ѻਾỰ⍻ࡠ ᕅ䎧䘉⿽䭉䈟Ⲵ〻ᒿᓄ䈕㻛㓸→DŽ Trap 䲧䱡 ൘䭉䈟ਁ⭏ѻਾỰ⍻ࡠ CPU 㔗㔝ᢗ㹼ਾ䶒ⲴᤷԔDŽ䖟Ԧ Fault 䭉䈟 ൘䭉䈟ਁ⭏ѻࡽỰ⍻ࡠ CPU 䟽ᯠᢗ㹼ᕅ䎧䭉䈟ⲴᤷԔDŽ Nonmaskable нਟቿ㭭ѝᯝ CPU ᕅ㝊 NMI нਟቿ㭭ѝᯝDŽ ⺜Ԧ Maskable ਟቿ㭭ѝᯝ CPU ᕅ㝊 INTR ␵ḷᘇᇴᆈಘ eflags Ⲵ IF ḷᘇਟቿ㭭ѝᯝDŽ ѝᯝ 㤡᮷਽〠 ਽〠 CPU Ự⍻ᯩᔿ ༴⨶ᯩᔿ 㺞 ̢ѣᯣ࠼㊱ԛ਀ѣᯣ䘶࠰੄ &38 Ⲻ༺⨼ᯯᕅ ᡰᴹѝᯝⲴ࠶㊫ԕ৺ᢗ㹼ਾ CPU Ⲵࣘ֌ᯩᔿ㿱㺘 5–1 ᡰ⽪DŽ 䎧ⲴDŽ䙊ᑨ䘈ਟ࠶Ѫ᭵䳌(Fault)઼䲧䱡(traps)є㊫DŽѝᯝ int32--int255 (0x20--0xff)ਟԕ⭡⭘ᡧ㠚ᐡ䇮ᇊDŽ ਨ〠ѻѪᔲᑨDŽഐѪ䘉Ӌѝᯝᱟ൘ CPU ᢗ㹼ᤷԔᰦ᧒⍻ࡠᔲᑨᛵߥ㘼ᕅޜ ⭘, ኎Ҿ䖟Ԧѝᯝˈն Intel ⮉؍ਨപᇊ䇮ᇊᡆޜ ѻ䰤Ⲵањᮠᆇᶕḷ䇶DŽሩҾѝᯝ int0--int31(0x00--0x1f)ˈ⇿њѝᯝⲴ࣏㜭⭡ Intel ሩҾ Linux ޵Ṩᶕ䈤ˈѝᯝؑਧ䙊ᑨ࠶Ѫє㊫˖⺜Ԧѝᯝ઼䖟Ԧѝᯝ(ᔲᑨ)DŽ⇿њѝᯝᱟ⭡ 0-255 5.4.4 Linux ޻ṮⲺѣᯣ༺⨼ ᯝⲴĀੁ䟿āؑ᚟DŽ ᆈ਴ѝ؍ᣔ⁑ᔿлˈഐ↔ᆳ֯⭘ѝᯝ᧿䘠ㅖ㺘ᶕ䇮㖞઼؍㊫࡛ㅹؑ᚟DŽLinux ᫽֌㌫㔏ᐕ֌Ҿ 80X86 Ⲵ ᵳ㓗઼᧿䘠ㅖ⢩ޣᯝੁ䟿㺘ˈਚᱟަѝ⇿њѝᯝ᧿䘠ㅖ亩ѝ䲔Ҷਜ਼ᴹѝᯝᴽ࣑〻ᒿൠ൰ԕཆˈ䘈वਜ਼ᴹ ㇑⨶ѝᯝᡆᔲᑨDŽIDT ᱟ Intel 8086 -- 80186 CPU ѝ֯⭘Ⲵѝᯝੁ䟿㺘Ⲵⴤ᧕ᴯԓ⢙DŽަ֌⭘ҏ㊫լҾѝ ᣔ⁑ᔿлᰦˈ䴰㾱֯⭘ѝᯝ᧿䘠ㅖ㺘 IDT˄Interrupt Descriptor Table˅ᶕ؍ᖃ Intel CPU 䘀㹼൘ 32 ս ࣑࣏㜭DŽ ᣋᔳҶ BIOS ᡰᨀ׋Ⲵѝᯝᴽޘ㣟⡷ᒦф൘ head.s 〻ᒿѝ䟽ᯠ䇮㖞аᕐѝᯝੁ䟿㺘˄ѝᯝ᧿䘠ㅖ㺘˅DŽᆼ  LQX[ ㌫㔏Ⲵѝᯝᵪࡦ/ ᴹḷ߶᧕ਓᇊѹⲴ C ࠭ᮠᓃѝⲴ࠭ᮠ䰤᧕ൠ֯⭘޵ṨⲴ㌫㔏䈳⭘ˈ㿱മ 5-19 ᡰ⽪DŽ ᇴᆈಘѝᤷᇊ㌫㔏䈳⭘࣏㜭ਧˈণਟ֯⭘޵Ṩ䍴Ⓚˈवᤜ㌫㔏⺜Ԧ䍴ⓀDŽн䗷䙊ᑨᓄ⭘〻ᒿ䜭ᱟ֯⭘ާ ᡰ⽪DŽӾሩѝᯝᵪࡦⲴ䈤᰾ਟ⸕ˈ⭘ᡧ〻ᒿ䙊䗷ⴤ᧕ᡆ䰤᧕˄䙊䗷ᓃ࠭ᮠ˅䈳⭘ѝᯝ int 0x80ˈᒦ൘ eax ㌫㔏䈳⭘˄䙊ᑨ〠Ѫ syscalls˅ᱟ Linux ޵Ṩокቲᓄ⭘〻ᒿ䘋㹼Ӕӂ䙊ؑⲴୟа᧕ਓˈ৲㿱മ 5-4 5.5.1 ㌱㔕䈹⭞᧛ਙ 5.5 Linux Ⲻ㌱㔕䈹⭞ ४Ⲵ਼ᰦཊ䟽᫽֌ˈᕅ䎧䎵㓗ඇᮠᦞⲴна㠤ᙗˈѕ䟽ᰦՊሬ㠤޵Ṩ㌫㔏ፙ⒳DŽ ↔ᰦ䈕ԫ࣑нՊ޽৫ࡔᯝ䬱ᇊḷᘇቡՊ㔗㔝ᢗ㹼䇮㖞䎵㓗ඇⲴ䬱ᇊḷᘇˈӾ㘼䙐ᡀєњԫ࣑ሩѤ⭼ԓ⸱ ᰦ䘉њަԆԫ࣑Պݸ䇮㖞䎵㓗ඇⲴ䬱ᇊḷᘇᒦфሩ䎵㓗ඇ䘋㹼؞᭩᫽֌DŽᖃ㌫㔏৸࠷ᦒഎ৏ᶕⲴԫ࣑ᰦˈ ᰦ↓ྭਁ⭏㌫㔏ᰦ䫏ѝᯝ㘼࠷ᦒࡠަԆԫ࣑৫䘀㹼ˈᒦф⻠ᐗަԆԫ࣑ҏ䴰㾱؞᭩䘉њ䎵㓗ඇˈ䛓Ѹ↔ 䰝ሩཆ䜘ѝᯝⲴ૽ᓄˈ䛓Ѹ൘؞᭩ѻࡽࡔᯝࠪ䈕䎵㓗ඇ䬱ᇊḷᘇ⋑ᴹ㖞ս㘼ᜣ䇮㖞䘉њḷᘇᰦˈ㤕↔ޣ ᤷԔᔰ੟ሩཆ䜘ѝᯝⲴ૽ᓄDŽྲ᷌н֯⭘ cliǃsti ᤷԔሩˈণ൘䴰㾱؞᭩ањ᮷Ԧ䎵㓗ඇᰦн֯⭘ cli ᶕ 䰝 CPU ሩཆ䜘ѝᯝⲴ૽ᓄˈ൘᫽֌ᆼᡀѻਾ޽֯⭘ stiޣ䘰ࠪㅹᖵ䱏ࡇ᫽֌ᰦ䜭䴰㾱俆ݸ֯⭘ cli ᤷԔ/ޕ ᰦ޵ṨቡՊᢗ㹼 sti ᤷԔԕ䟽ᯠݱ䇨 CPU ૽ᓄཆ䜘ѝᯝDŽֻྲˈ൘؞᭩᮷Ԧ䎵㓗ඇⲴ䬱ᇊḷᘇ઼ԫ࣑䘋 䰝ሩཆ䜘ѝᯝⲴ૽ᓄˈ㘼൘ᢗ㹼ᆼㄎҹԓ⸱४ޣ㜭ᕅ䎧ㄎҹᶑԦⲴԓ⸱४ᰦˈ޵ṨѝቡՊ֯⭘ cli ᤷԔᶕ ਟޕsti ᤷԔ⭘ᶕ䇮㖞ḷᘇᇴᆈಘѝⲴѝᯝḷᘇˈԕݱ䇨 CPU 㜭䇶࡛ᒦ૽ᓄཆ䜘䇮༷ਁࠪⲴѝᯝDŽᖃ䘋 ᤷԔDŽcli ᤷԔ⭘ᶕ༽ս CPU ḷᘇᇴᆈಘѝⲴѝᯝḷᘇˈ֯ᗇ㌫㔏൘ᢗ㹼 cli ᤷԔਾнՊ૽ᓄཆ䜘ѝᯝDŽ ѪҶ䚯ݽㄎҹᶑԦ઼ѝᯝሩѤ⭼ԓ⸱४Ⲵᒢᢠˈ൘ Linux 0.11 ޵Ṩԓ⸱ѝ䇨ཊൠᯩ֯⭘Ҷ cli ઼ sti 5.4.5 ḽᘍᇺᆎಞⲺѣᯣḽᘍ 㘼䙊䗷䲧䱡䰘ᢗ㹼ⲴѝᯝࡉнՊᖡ૽ IF ḷᘇDŽ৲㿱ㅜ 11 ㄐѝሩ include/asm/system.h ᮷ԦⲴ䈤᰾DŽ ˗ഐ↔ਟԕ䚯ݽަᆳѝᯝᒢᢠᖃࡽѝᯝⲴ༴⨶ˈ䲿ਾⲴѝᯝ㔃ᶏᤷԔ iret ՊӾึḸкᚒ༽ IF ḷᘇⲴ৏٬ ൘Ҿሩḷᘇᇴᆈಘ EFLAGS ѝⲴѝᯝݱ䇨ḷᘇ IF Ⲵᖡ૽DŽ⭡ѝᯝ䰘᧿䘠ㅖᢗ㹼ⲴѝᯝՊ༽ս IF ḷᘇˈ ਖཆˈ൘䇮㖞ѝᯝ᧿䘠ㅖ㺘 IDT ᰦ Linux ޵Ṩ֯⭘Ҷѝᯝ䰘઼䲧䱡䰘є⿽᧿䘠ㅖDŽᆳԜѻ䰤Ⲵ४࡛ 㹼Ҷ䟽ᯠ䇮㖞˄kernel/sched.cˈ385˅DŽ ࿻ॆ࠭ᮠѝ䘋㹼Ҷ䟽ᯠ䇮㖞˄kernl/traps.cˈ181˅ˈ㘼㌫㔏䈳⭘ѝᯝ int128 ࡉ൘䈳ᓖ〻ᒿࡍ࿻ॆ࠭ᮠѝ䘋 ᧿䘠ㅖ亩ˈ䇙ᆳԜᤷੁሩᓄⲴᇎ䱵༴⨶䗷〻DŽ䙊ᑨˈᔲᑨѝᯝ༴⨶䗷〻˄int0 --int 31˅䜭൘ traps.c Ⲵࡍ 㔏ѝ䴰㾱֯⭘ⲴаӋѝᯝˈ޵ṨՊ൘ަ㔗㔝ࡍ࿻ॆⲴ༴⨶䗷〻ѝ˄init/main.c˅䟽ᯠ䇮㖞䘉ӋѝᯝⲴѝᯝ ᣔࠪ䭉DŽሩҾ㌫؍0xff)֌Ѫੁ䟿ˈഐ↔Պ৫䈫ਆ IDT 㺘ѝⲴㅜ 256 亩ˈഐ↔ҏՊ䙐ᡀа㡜)1 ޘޕ㓯к䈫 ˄ᔲᑨ 13˅DŽਖཆˈྲ᷌⺜Ԧࠪ⧠䰞仈㘼⋑ᴹᢺ䇮༷Ⲵੁ䟿᭮ࡠᮠᦞᙫ㓯кˈ↔ᰦ CPU 䙊ᑨՊӾᮠᦞᙫ ᣔࠪ䭉؍䛓Ѹ൘ањ㾱≲ⲴѝᯝᡰᤷᇊⲴ᧿䘠ㅖ亩བྷҾ䇮㖞Ⲵᴰབྷ᧿䘠ㅖ亩ᰦˈCPU ቡՊӗ⭏ања㡜 ᣔᙗ䭉䈟˄A gerneal protection fault˅(ᔲᑨ 13)DŽ੖ࡉⲴ䈍ˈྲ᷌䇮㖞Ⲵ IDT ቁҾ 256 亩ˈ؍䱢→ࠪ⧠а㡜 䈕ѝᯝੁ䟿ᰦቡՊᱮ⽪ؑ᚟Āᵚ⸕ѝᯝ˄Unknown interrupt˅āDŽ䘉䟼ሩᡰᴹ 256 亩䜭䘋㹼䇮㖞ਟԕᴹ᭸ ੁ䟿ᤷੁањ唈䇔ⲴĀᰐѝᯝā༴⨶䗷〻˄boot/head.sˈ150˅DŽᖃਁ⭏Ҷањѝᯝ㘼৸⋑ᴹ䟽ᯠ䇮㖞䗷 ˄Interrupt Descriptor Table - IDT˅ѝᡰᴹ 256 њ᧿䘠ㅖ䘋㹼Ҷ唈䇔䇮㖞˄boot/head.sˈ78˅DŽ䘉њଁѝᯝ ൘㌫㔏ࡍ࿻ॆᰦˈ޵Ṩ൘ head.s 〻ᒿѝ俆ݸ֯⭘ањଁѝᯝੁ䟿˄ѝᯝ᧿䘠ㅖ˅ሩѝᯝ᧿䘠ㅖ㺘 ⮉؍˅IRQ15 0x2f ˄47 IRQ14 0x2e ˄46˅ ⺜ⴈѝᯝ  LQX[ Ⲵ㌫㔏䈳⭘/ ޵Ṩ & ࠭ᮠᓃ ᓄ⭘〻ᒿ ㌫㔏䈳⭘ ZULWH  ᓃ࠭ᮠ ZULWH ᓃ࠭ᮠ SULQWI  䈳⭘ SULQWI ᢙኅᡀवਜ਼޵፼≷㕆䈝ਕⲴ C ࠭ᮠˈ㿱ྲлᡰ⽪DŽ 䘄എ٬Ⲵ㊫ර˗ㅜ 2 њ৲ᮠᱟ㌫㔏䈳⭘Ⲵ਽〠˗䲿ਾᱟ㌫㔏䈳⭘ᡰᩪᑖ৲ᮠⲴ㊫ර઼਽〠DŽ䘉њᆿՊ㻛 ሩҾ include/unistd.h ѝ㔉ࠪⲴ⇿њ㌫㔏䈳⭘ᆿˈ䜭ᴹ 2+2*n њ৲ᮠDŽަѝㅜ 1 њ৲ᮠሩᓄ㌫㔏䈳⭘ аṧDŽޘᮠᓃ֌ѝӻDŽᇎ䱵к C ࠭ᮠᓃѝ࠭ᮠᴰ㓸䈳⭘㌫㔏䈳⭘Ⲵᖒᔿ઼䘉䟼㔉ࠪⲴᆼ ഐ↔ᡁԜਟԕ൘⭘ᡧ〻ᒿѝⴤ᧕֯⭘к䶒Ⲵ_syscall3()ᶕᢗ㹼ањ㌫㔏䈳⭘ read()ˈ㘼н⭘䙊䗷 C ࠭  EXILQWQ LQWUHDGLQWIGFKDU BV\VFDOO  XQLVWGK!LQFOXGH GHILQHBB/,%5$5@ ٬DŽ〫ٿս ؑਧDŽᱟսമˈ⇿њ∄⢩սԓ㺘а⿽ؑਧˈؑਧ٬ORQJVLJQDO 䘀㹼ՈݸᮠDŽԫ࣑ᔰ࿻䘀㹼ᰦ FRXQWHU SULRULW\ˈ䎺བྷ䘀㹼䎺䮯DŽORQJSULRULW\ 䙂߿ ˄┤ㆄᮠ˅ˈ䘀㹼ᰦ䰤⡷DŽ ԫ࣑䘀㹼ᰦ䰤䇑ᮠORQJFRXQWHU DŽ˅→ڌቡ㔚 ˈ! ᐢ ԫ࣑Ⲵ䘀㹼⣦ᘱ˄ нਟ䘀㹼ˈ ਟ䘀㹼ORQJVWDWH VWUXFWWDVNBVWUXFW^ ⽪DŽ 䇑٬ǃ↓൘֯⭘Ⲵ᮷Ԧ઼ᵜԫ࣑Ⲵተ䜘᧿䘠ㅖԕ৺ԫ࣑⣦ᘱ⇥ؑ᚟DŽ䈕㔃ᶴ⇿њᆇ⇥Ⲵާփਜ਼ѹྲлᡰ ࡦ઼㇑⨶䘋〻Ⲵᡰᴹؑ᚟DŽѫ㾱वᤜ䘋〻ᖃࡽ䘀㹼Ⲵ⣦ᘱؑ᚟ǃؑਧǃ䘋〻ਧǃ⡦䘋〻ਧǃ䘀㹼ᰦ䰤㍟ ᆈ⵰⭘Ҿ᧗؍䘋〻᧗ࡦඇ PCB˄Process Control Block˅ᡆ䘋〻᧿䘠ㅖ PD˄Processor Descriptor˅DŽަѝ ᱟањ task_struct ԫ࣑㔃ᶴᤷ䪸DŽԫ࣑ᮠᦞ㔃ᶴᇊѹ൘ཤ᮷Ԧ include/linux/sched.h ѝDŽᴹӋҖк〠ަѪ ޵Ṩ〻ᒿ䙊䗷䘋〻㺘ሩ䘋〻䘋㹼㇑⨶ˈ⇿њ䘋〻൘䘋〻㺘ѝঐᴹа亩DŽ൘ Linux ㌫㔏ѝˈ䘋〻㺘亩 5.7.1 Աࣗᮦᦤ㔉ᶺ ൘ቭ䟿䚥ᆸ䘉њ唈䇔㿴ࡉⲴ਼ᰦ␧⭘䘉єњᵟ䈝DŽ ਖཆ൘ Linux ޵Ṩѝˈ䘋〻䙊ᑨ㻛〠֌ԫ࣑˄task˅ˈ㘼ᢺ䘀㹼൘⭘ᡧオ䰤Ⲵ〻ᒿ〠֌䘋〻DŽᵜҖሶ ৲ᮠǃተ䜘ਈ䟿ㅹᮠᦞ˗޵ṨึḸࡉਜ਼ᴹ޵Ṩ〻ᒿᢗ㹼࠭ᮠ䈳⭘ᰦⲴؑ᚟DŽ ᆈ䈳⭘࠭ᮠⲴ؍ᒦф࠶࡛֯⭘਴㠚⤜・Ⲵ޵ṨᘱึḸ઼⭘ᡧᘱึḸDŽ⭘ᡧึḸ⭘Ҿ䘋〻൘⭘ᡧᘱлѤᰦ ᡁԜᐢ㓿⸕䚃ˈLinux ㌫㔏ѝањ䘋〻ਟԕ൘޵Ṩᘱ˄kernel mode˅ᡆ⭘ᡧᘱ˄user mode˅лᢗ㹼ˈ 䈳ᓖ਴њ䘋〻䘀㹼DŽ 䈳⭘ᶕ䘋㹼DŽሩҾਚᴹањ CPU Ⲵ㌫㔏ˈ൘Ḁаᰦ࡫ਚ㜭ᴹањ䘋〻↓൘䘀㹼DŽ޵Ṩ䙊䗷䈳ᓖ〻ᒿ࠶ᰦ ⇥ǃᮠᦞ⇥DŽ⇿њ䘋〻ਚ㜭ᢗ㹼㠚ᐡⲴԓ⸱઼䇯䰞㠚ᐡⲴᮠᦞ৺ึḸ४DŽ䘋〻ѻ䰤Ⲵ䙊ؑ䴰㾱䙊䗷㌫㔏 〻⭡ਟᢗ㹼ⲴᤷԔԓ⸱ǃᮠᦞ઼ึḸ४㓴ᡀDŽ䘋〻ѝⲴԓ⸱઼ᮠᦞ䜘࠶࠶࡛ሩᓄањᢗ㹼᮷ԦѝⲴԓ⸱ 㘵ˈࡉ〠Ѫ⡦䘋〻˄parent process˅DŽ޵Ṩ〻ᒿ֯⭘䘋〻ḷ䇶ਧ˄process IDˈpid˅ᶕḷ䇶⇿њ䘋〻DŽ䘋 ަ։Ⲵ䜭ᱟ⧠ᴹ䘋〻֯⭘㌫㔏䈳⭘ fork ࡋᔪⲴᯠ䘋〻ˈ㻛ࡋᔪⲴ䘋〻〠Ѫᆀ䘋〻˄child process˅ˈࡋᔪ ሩҾ Linux 0.11 ޵Ṩᶕ䇢ˈ㌫㔏ᴰཊਟᴹ 64 њ䘋〻਼ᰦᆈ൘DŽ䲔Ҷㅜањ䘋〻⭘Ā᡻ᐕāᔪ・ԕཆˈ њ䘋〻䘀㹼Ⲵᰦ䰤⡷ᖸ⸝˄ֻྲ 15 њ㌫㔏┤ㆄ=150 ∛。˅ˈᡰԕ㺘䶒ⴻᶕྭ䊑ᡰᴹ䘋〻൘਼ᰦ䘀㹼⵰DŽ ࡠਖањ䘋〻৫䘀㹼DŽഐ↔ᇎ䱵кሩҾާᴹঅњ CPU Ⲵᵪಘᶕ䈤Ḁаᰦ࡫ਚ㜭䘀㹼ањ䘋〻DŽն⭡Ҿ⇿ ᰦ䰤⡷(time slice)ˈ䇙⇿њ䘋〻൘ањᰦ䰤⡷޵䘀㹼DŽᖃ䘋〻Ⲵᰦ䰤⡷⭘ᆼᰦ㌫㔏ቡ࡙⭘䈳ᓖ〻ᒿ࠷ᦒ ᫽֌㌫㔏к਼ᰦਟԕ䘀㹼ཊњ䘋〻DŽ࠶ᰦᢰᵟⲴสᵜ৏⨶ᱟᢺ CPU Ⲵ䘀㹼ᰦ䰤ࡂ࠶ᡀањњ㿴ᇊ䮯ᓖⲴ 〻ᒿᱟањਟᢗ㹼Ⲵ᮷Ԧˈ㘼䘋〻˄process˅ᱟањᢗ㹼ѝⲴ〻ᒿᇎֻDŽ࡙⭘࠶ᰦᢰᵟˈ൘ Linux 5.7 Linux 䘑ぁ᧝࡬ 㹼DŽ ᘱൠ᫔䬰DŽ൘ Linux 0.11 ޵Ṩѝᇊᰦಘ਼ᰦᴰཊਟԕᴹ 64 њDŽᇊᰦಘⲴ༴⨶ԓ⸱൘ sched.c 〻ᒿ 264--336 ᘱᇊᰦಘ˄Dynamic Timer˅ˈӵ׋޵Ṩ֯⭘DŽ䘉⿽ᇊᰦಘਟԕ൘䴰㾱ᰦࣘᘱൠࡋᔪˈ㘼൘ᇊᰦࡠᵏᰦࣘ  LQX[ 䘋〻᧗ࡦ/ ᓄањؑਧDŽ ᆈ༴⨶਴ؑਧᡰ֯⭘Ⲵ᫽֌઼኎ᙗDŽᮠ㓴Ⲵ⇿а亩ሩ؍ƹstruct sigaction sigaction[32] 㔃ᶴᮠ㓴⭘ᶕ ਧսമሩؑਧ䘋㹼亴༴⨶DŽ 1DŽഐ↔ Linux ޵Ṩᴰཊᴹ 32 њؑਧDŽ൘⇿њ㌫㔏䈳⭘༴⨶䗷〻Ⲵᴰਾˈ㌫㔏Պ֯⭘䈕ؑ+٬〫ٿս=٬ њ∄⢩սˈ⇿њ∄⢩սԓ㺘а⿽ؑਧˈؑਧ 32 ޡˈƹlong signal ᆇ⇥ᱟ䘋〻ᖃࡽᡰ᭦ࡠؑਧⲴսമ ᖃ❦ˈpriority Ⲵঅսҏᱟᰦ䰤┤ㆄᮠDŽ 㿱 sched.c 〻ᒿ઼ fork.c 〻ᒿDŽ৲ˈరం˅DŽᖃ䴰㾱ᰦ䈳ᓖ〻ᒿՊ֯⭘ priority Ⲵ٬Ѫ counter 䍻ањࡍ٬ ƹlong priority ⭘Ҿ㔉 counter 䍻ࡍ٬DŽ൘ Linux 0.11 ѝ䘉њࡍ٬Ѫ 15 њ㌫㔏ᰦ䫏ઘᵏᰦ䰤˄15 њ priorityDŽ ᢗ㹼Ⲵ䘋〻ˈഐ↔ counter ਟԕⴻ֌ᱟањ䘋〻Ⲵࣘᘱ⢩ᙗDŽ൘ањ䘋〻ࡊ㻛ࡋᔪᰦ counter Ⲵࡍ٬ㅹҾ ٬ᶕ䘹ᤙлањ㾱 л䘈䴰㾱㓿䗷ࠐњ㌫㔏ᰦ䫏ઘᵏ᡽࠷ᦒࡠਖањ䘋〻DŽ䈳ᓖ〻ᒿՊ֯⭘䘋〻Ⲵ counter ᵜ⅑䘀㹼ѻࡽ䘈㜭ᢗ㹼Ⲵᰦ䰤┤ㆄᮠˈণ൘↓ᑨᛵߥ→ڌᆈ⵰䘋〻൘㻛Ჲᰦ؍⇥ƹlong counter ᆇ њ䘋〻൘䘉Ӌ⣦ᘱѻ䰤Ⲵ䖜ᦒ䗷〻㿱л㢲䈤᰾DŽ TASK_ZOMBIE ⣦ᘱ⭘Ҿ᧿䘠ањ䘋〻ᐢ㓿㻛㓸→ˈնަԫ࣑ᮠᦞ㔃ᶴ亩ӽ❦ᆈ൘Ҿԫ࣑㔃ᶴ㺘ѝDŽа SIGTTOU ㅹ˅ᡆ㘵ᖃ䘋〻㻛ਖањ䘋〻֯⭘ ptrace ㌫㔏䈳⭘ⴁ᧗ᒦф᧗ࡦᵳ൘ⴁ᧗䘋〻ѝᰦDŽ ਧᰦ˄ֻྲ SIGSTOPǃSIGTTIN ᡆؑޣᘱDŽֻྲ䘋〻൘᭦ࡠањ⴨⣦→ڌҾ䈤᰾ањ䘋〻↓༴Ҿ Ⲵ䘋〻ࡉ䙊ᑨᱟ൘ⴤ᧕ᡆ䰤᧕ൠㅹᖵ⺜ԦᶑԦⲴ┑䏣ഐ㘼нՊ᧕ਇԫօؑਧDŽTASK_STOPPED ⣦ᘱ⭘ TASK_INTERRUPTIBLE ⣦ᘱⲴ䘋〻㜭ཏ㻛ؑਧ୔䟂ᒦ◰⍫ˈ㘼༴Ҿ TASK_UNINTERRUPTIBLE ⣦ᘱ ᱟ TASK_INTERRUPTIBLE ᡆ㘵 TASK_UNINTERRUPTIBLE DŽ䘉єњ٬ਜ਼ѹⲴ४࡛൘Ҿ༴Ҿ state Ⲵ٬ᱟ TASK_RUNNINGDŽྲ᷌䘋〻↓൘ㅹᖵḀаһԦⲴਁ⭏ഐ㘼༴Ҿオ䰢⣦ᘱˈ䛓Ѹ state Ⲵ٬ቡ ƹlong state ᆇ⇥ਜ਼ᴹ䘋〻Ⲵᖃࡽ⣦ᘱԓਧDŽྲ᷌䘋〻↓൘ㅹᖵ֯⭘ CPU ᡆ㘵䘋〻↓㻛䘀㹼ˈ䛓Ѹ ` 䘋〻Ⲵԫ࣑⣦ᘱ⇥ؑ᚟㔃ᶴDŽVWUXFWWVVBVWUXFWWVV VVDŽ ተ䜘᧿䘠ㅖ㺘DŽオˈԓ⸱⇥ FVˈᮠᦞ઼ึḸ⇥ GVVWUXFWGHVFBVWUXFWOGW>@ ᮷Ԧ㔃ᶴᤷ䪸㺘ˈᴰཊ  亩DŽ㺘亩ਧণᱟ᮷Ԧ᧿䘠ㅖⲴ٬DŽILOS>15B23(1@ VWUXFWILOH 䰝᮷ԦਕᷴսമḷᘇDŽ˄৲㿱 LQFOXGHIFQWOK˅ޣᢗ㹼ᰦXQVLJQHGORQJFORVHBRQBH[HF ᢗ㹼᮷Ԧ L 㢲⛩㔃ᶴᤷ䪸DŽH[HFXWDEOH VWUXFWPBLQRGH ṩⴞᖅ L 㢲⛩㔃ᶴᤷ䪸DŽURRW VWUXFWPBLQRGH ᖃࡽᐕ֌ⴞᖅ L 㢲⛩㔃ᶴᤷ䪸DŽSZG VWUXFWPBLQRGH ᮷Ԧࡋᔪ኎ᙗቿ㭭սDŽXQVLJQHGVKRUWXPDVN 䘋〻֯⭘ WW\ 㓸ㄟⲴᆀ䇮༷ਧDŽ 㺘⽪⋑ᴹ֯⭘DŽLQWWW\ ḷᘇ˖ᱟ੖֯⭘Ҷॿ༴⨶ಘDŽXQVLJQHGVKRUWXVHGBPDWK 䘋〻ᔰ࿻䘀㹼ᰦ࡫DŽORQJVWDUWBWLPH ᆀ䘋〻㌫㔏ᘱ䘀㹼ᰦ䰤DŽORQJFVWLPH ᆀ䘋〻⭘ᡧᘱ䘀㹼ᰦ䰤DŽORQJFXWLPH ㌫㔏ᘱ䘀㹼ᰦ䰤˄┤ㆄᮠ˅DŽORQJVWLPH ⭘ᡧᘱ䘀㹼ᰦ䰤˄┤ㆄᮠ˅DŽORQJXWLPH ㆄᮠ˅DŽ┤˄ᣕ䆖ᇊᰦ٬ORQJDODUP ᆈⲴ㓴 LGDŽ؍XQVLJQHGVKRUWVJLG ᴹ᭸㓴 LGDŽXQVLJQHGVKRUWHJLG 㓴ḷ䇶ਧ˄㓴 LG˅DŽXQVLJQHGVKRUWJLG ᆈⲴ⭘ᡧ LGDŽ؍XQVLJQHGVKRUWVXLG ᴹ᭸⭘ᡧ LGDŽXQVLJQHGVKRUWHXLG ⭘ᡧḷ䇶ਧ˄⭘ᡧ LG˅DŽXQVLJQHGVKRUWXLG Պ䈍俆亶DŽORQJOHDGHU Պ䈍ਧDŽORQJVHVVLRQ 䘋〻㓴ਧDŽORQJSJUS ⡦䘋〻ਧDŽORQJIDWKHU  LQX[ 䘋〻᧗ࡦ/ 䀓᷀㔍ሩ䐟ᖴ਽DŽਚᴹ䎵㓗⭘ᡧ㜭䙊䗷㌫㔏䈳⭘ chroot ᶕ؞᭩䘉њṩⴞᖅDŽ ƹstruct m_inode * root ᱟ䘋〻㠚ᐡⲴṩⴞᖅ i 㢲⛩㔃ᶴDŽ⇿њ䘋〻䜭ਟᴹ㠚ᐡᤷᇊⲴṩⴞᖅˈ⭘Ҿ 䀓᷀⴨ሩ䐟ᖴ਽ˈᒦфਟԕ֯⭘㌫㔏䈳⭘ chdir ᶕ᭩ਈѻDŽ ƹstruct m_inode * pwd ᱟ䘋〻Ⲵᖃࡽᐕ֌ⴞᖅ i 㢲⛩㔃ᶴDŽ⇿њ䘋〻䜭ᴹањᖃࡽᐕ֌ⴞᖅˈ⭘Ҿ ƹunsigned short umask ᱟ䘋〻ࡋᔪᯠ᮷Ԧᰦᡰ֯⭘Ⲵ኎ᙗቿ㭭սˈণᯠᔪ᮷Ԧᡰ䇮㖞Ⲵ䇯䰞኎ᙗDŽ ƹint tty ᱟ䘋〻֯⭘ tty 㓸ㄟⲴᆀ䇮༷ਧDŽ-1 㺘⽪⋑ᴹ֯⭘DŽ ƹunsigned short used_math ᱟањḷᘇˈᤷ᰾ᵜ䘋〻ᱟ੖֯⭘Ҷॿ༴⨶ಘDŽ ƹlong start_time ᱟ䘋〻⭏ᡀᒦᔰ࿻䘀㹼Ⲵᰦ࡫DŽ ƹlong cstime ᱟ㍟䇑䘋〻Ⲵᆀ䘋〻޵Ṩᘱ䘀㹼Ⲵᰦ䰤˄┤ㆄᮠ˅DŽ ƹlong cutime ᱟ㍟䇑䘋〻Ⲵᆀ䘋〻൘⭘ᡧᘱ䘀㹼Ⲵᰦ䰤˄┤ㆄᮠ˅DŽ ƹlong stime ᱟ㍟䇑䘋〻൘㌫㔏ᘱ˄޵Ṩᘱ˅䘀㹼Ⲵᰦ䰤˄┤ㆄᮠ˅DŽ ƹlong utime ᱟ㍟䇑䘋〻൘⭘ᡧᘱ䘀㹼Ⲵᰦ䰤˄┤ㆄᮠ˅DŽ ᡆ sigaction()˅ᶕᦅ᥹䈕ؑਧ䘋㹼ᤷᇊⲴ᫽֌DŽ ਁ䘱ањ SIGALRM ؑਧDŽ唈䇔ᰦ䈕ؑਧՊ㓸→〻ᒿⲴᢗ㹼DŽᖃ❦ᡁԜҏਟԕ֯⭘ؑਧᦅ᥹࠭ᮠ˄signal() ٬ᰦˈ޵ṨቡՊੁ䈕䘋〻⇥ᆈ൘䈕ᆇ⇥ѝ˅ˈ䛓Ѹ↔ਾᖃ㌫㔏ᰦ䰤┤ㆄ٬䎵䗷Ҷ alarm ᆇ؍䰤┤ㆄ٬ѻਾ ࣐к㌫㔏ᖃࡽᰦˈ൘ kernel/sched.c ㅜ 338 㹼ᔰ࿻༴DŽ޵ṨՊᢺ䈕࠭ᮠԕ。ѪঅսⲴ৲ᮠ٬䖜ᦒᡀ┤ㆄ٬ alarm()˄٬⇥ㆄᮠ˅DŽྲ᷌䘋〻֯⭘㌫㔏䈳⭘ alarm()䇮㖞䗷䈕ᆇ┤˄ƹlong alarm ᱟ䘋〻Ⲵᣕ䆖ᇊᰦ٬ sys.c 〻ᒿࡽⲴᾲ䘠DŽ 䘉Ӌ⭘ᡧਧ઼㓴ਧⲴ᧿䘠䈧৲㿱ㅜ 5 ㄐޣᆈ⵰ᢗ㹼᮷ԦⲴ gidDŽ੖ࡉ sgid ㅹҾ䘋〻Ⲵ egidDŽᴹ؍sgid ѝ ᆈⲴ⭘ᡧ㓴ḷ䇶ਧDŽᖃᢗ㹼᮷ԦⲴ䇮㖞㓴 ID ḷᘇ˄set-group-ID˅㖞սᰦˈ؍ƹunsigned short sgid ᱟ ƹunsigned short egid ᱟᴹ᭸㓴ḷ䇶ਧˈ⭘Ҿᤷ᰾䈕㓴⭘ᡧ䇯䰞᮷ԦⲴᵳ䲀DŽ ƹunsigned short gid ᱟ⭘ᡧᡰ኎㓴ḷ䇶ਧ˄㓴 id˅DŽᤷ᰾Ҷᤕᴹ䈕䘋〻Ⲵ⭘ᡧ㓴DŽ ᆈ⵰ᢗ㹼᮷ԦⲴ uidDŽ੖ࡉ suid ㅹҾ䘋〻Ⲵ euidDŽ؍suid ѝ ᆈⲴ⭘ᡧḷ䇶ਧDŽᖃᢗ㹼᮷ԦⲴ䇮㖞⭘ᡧ ID ḷᘇ˄set-user-ID˅㖞սᰦˈ؍ƹunsigned short suid ᱟ ƹunsigned short euid ᱟᴹ᭸⭘ᡧḷ䇶ਧˈ⭘Ҿᤷ᰾䇯䰞᮷ԦⲴᵳ࣋DŽ ƹunsigned short uid ᱟᤕᴹ䈕䘋〻Ⲵ⭘ᡧḷ䇶ਧ˄⭘ᡧ id˅DŽ 䘋〻㓴઼Պ䈍Ⲵᾲᘥ䈧৲㿱ㅜ 4 ㄐ〻ᒿࡇ㺘ਾⲴ䈤᰾DŽޣƹlong leader ᱟՊ䈍俆䘋〻ਧDŽᴹ ƹlong session ᱟ䘋〻ⲴՊ䈍ਧˈণᡰ኎Պ䈍Ⲵ䘋〻ਧDŽ ƹlong pgrp ᱟᤷ䘋〻ᡰ኎䘋〻㓴ਧDŽ ƹlong father ᱟࡋᔪᵜ䘋〻Ⲵ⡦䘋〻Ⲵ䘋〻ਧDŽ ƹlong pid ᱟ䘋〻ḷ䇶ਧˈণ䘋〻ਧDŽᆳ㻛⭘ᶕୟаൠḷ䇶䘋〻DŽ ึḸᤷ䪸ս㖞DŽ ٬ᤷੁ䘋〻䙫䗁ൠ൰オ䰤ѝึḸⲴ䎧࿻༴DŽ਼ṧ䈧৲㿱മ 10-6 ѝⲴ⇥ƹunsigned long start_stack ᆇ ֌DŽ Ѫ䘋〻␫઼࣐䟺᭮ࣘᘱ࠶䝽Ⲵ޵ᆈDŽ䘉䙊ᑨᱟ䙊䗷䈳⭘ malloc()࠭ᮠᒦ䙊䗷 brk ㌫㔏䈳⭘⭡޵Ṩ䘋㹼᫽ ᮠᦞ४ bssˈ৲㿱മ 10-6 ᡰ⽪DŽ䘉ᱟ brk ൘ањ䘋〻ᔰ࿻ᢗ㹼ᰦⲴࡍ٬DŽ䙊䗷؞᭩䘉њᤷ䪸ˈ޵Ṩਟԕ նᱟ䘈वᤜᵚࡍ࿻ॆⲴⲴˈ˅ᤷ䪸٬˄ƹunsigned long brk ᆇ⇥ҏᱟ䘋〻ԓ⸱઼ᮠᦞⲴᙫᆇ㢲䮯ᓖ٬ ᆈ⵰䘋〻Ⲵԓ⸱䮯ᓖ + ᮠᦞ䮯ᓖⲴᙫᆇ㢲䮯ᓖ٬DŽ؍⇥ƹunsigned long end_data ᆇ ᆈ⵰䘋〻ԓ⸱Ⲵᆇ㢲䮯ᓖ٬DŽ؍⇥ƹunsigned long end_code ᆇ ѝަ٬ᱟ 64MB ⲴᮤᮠؽDŽ ƹunsigned long start_code ᆇ⇥ᱟ䘋〻ԓ⸱൘ CPU 㓯ᙗൠ൰オ䰤ѝⲴᔰ࿻ൠ൰ˈ൘ Linux 0.1x ޵Ṩ ᆈ〻ᒿ㓸→ᰦⲴ䘰ࠪ⸱DŽ൘ᆀ䘋〻㔃ᶏਾ⡦䘋〻ਟԕḕ䈒ᆳⲴ䘉њ䘰ࠪ⸱DŽ؍ƹint exit ᆇ⇥ᱟ⭘ᶕ 㺘а⿽㻛䱫ຎⲴؑਧDŽ ƹlong blocked ᆇ⇥ᱟ䘋〻ᖃࡽнᜣ༴⨶ⲴؑਧⲴ䱫ຎսമDŽо signal ᆇ⇥㊫լˈަ⇿а∄⢩սԓ  LQX[ 䘋〻᧗ࡦ/ ⣦ᘱDŽ൘ Linux ㌫㔏ѝˈⶑⵐㅹᖵ⣦ᘱ㻛࠶ѪਟѝᯝⲴ઼нਟѝᯝⲴㅹᖵ⣦ᘱDŽ ൘䘋〻ԫ࣑㔃ᶴⲴ state ᆇ⇥ѝDŽᖃ䘋〻↓൘ㅹᖵ㌫㔏ѝⲴ䍴Ⓚ㘼༴Ҿㅹᖵ⣦ᘱᰦˈࡉ〠ަ༴Ҿⶑⵐㅹᖵ ᆈ؍ањ䘋〻൘ަ⭏ᆈᵏ޵ˈਟ༴Ҿа㓴н਼Ⲵ⣦ᘱлˈ〠Ѫ䘋〻⣦ᘱDŽ㿱മ 5-20 ᡰ⽪DŽ䘋〻⣦ᘱ 5.7.2 䘑ぁ䘆㺂⣬ᘷ ⮉ᡰᴹ䴰㾱⭘ࡠⲴ䍴Ⓚˈԕׯѝᯝᴽ࣑㔃ᶏᰦ㜭ᚒ༽㻛ѝᯝ䘋〻Ⲵᢗ㹼DŽ؍ᢗ㹼ѝᯝᴽֻ࣑〻DŽն਼ᰦՊ ᆈ൘䘋〻Ⲵԫ࣑ᮠᦞ㔃ᶴѝDŽ൘ਁ⭏ѝᯝᰦˈ޵Ṩቡ൘㻛ѝᯝ䘋〻Ⲵкл᮷ѝˈ൘޵Ṩᘱл؍кл᮷൷ 䘋〻Ⲵкл᮷ˈԕׯ൘޽⅑ᢗ㹼䈕䘋〻ᰦˈ㜭ཏᚒ༽ࡠ࠷ᦒᰦⲴ⣦ᘱᢗ㹼л৫DŽ൘ Linux ѝˈᖃࡽ䘋〻 ᆈᖃࡽ؍ᆈᖃࡽ䘋〻Ⲵᡰᴹ⣦ᘱˈҏণ؍л᮷DŽᖃ޵Ṩ䴰㾱࠷ᦒ˄switch˅㠣ਖањ䘋〻ᰦˈᆳቡ䴰㾱 ᖃањ䘋〻൘ᢗ㹼ᰦˈCPU ⲴᡰᴹᇴᆈಘѝⲴ٬ǃ䘋〻Ⲵ⣦ᘱԕ৺ึḸѝⲴ޵ᇩ㻛〠Ѫ䈕䘋〻Ⲵк ⭘䘉Ӌ٬ᚒ༽ࡠԫ࣑㻛࠷ᦒࠪᰦⲴ⣦ᘱˈᒦᔰ࿻ᢗ㹼DŽ ᆈҶᖃࡽ༴⨶ಘⲴᡰᴹᇴᆈಘ٬DŽᖃԫ࣑৸㻛 CPU 䟽ᯠᢗ㹼ᰦˈCPU ቡՊ࡙؍࠷ᦒࠪᰦ tss_struct 㔃ᶴ ƹstruct tss_struct tss ᱟ䘋〻Ⲵԫ࣑⣦ᘱ⇥ TSS˄Task State Segment˅ؑ᚟㔃ᶴDŽ൘ԫ࣑Ӿᢗ㹼ѝ㻛 ᮠᦞ⇥DŽަѝᮠ㓴亩 0 ᱟオ亩ˈ亩 1 ᱟԓ⸱⇥᧿䘠ㅖˈ亩 2 ᱟᮠᦞ⇥˄वਜ਼ᮠᦞ઼ึḸ˅᧿䘠ㅖDŽ ƹstruct desc_struct ldt[3] ᱟ䈕䘋〻ተ䜘᧿䘠ㅖ㺘㔃ᶴDŽᇊѹҶ䈕ԫ࣑൘㲊ᤏൠ൰オ䰤ѝⲴԓ⸱⇥઼ ㅖⲴ٬ণᱟ䈕㔃ᶴѝⲴ㍒ᕅ٬DŽަѝ⇿а亩⭘Ҿ᮷Ԧ᧿䘠ㅖᇊս᮷Ԧᤷ䪸઼䇯䰞᮷ԦDŽ ƹstruct file * filp[NR_OPEN] ᱟ䘋〻֯⭘Ⲵᡰᴹᢃᔰ᮷ԦⲴ᮷Ԧ㔃ᶴᤷ䪸㺘ˈᴰཊ 32 亩DŽ᮷Ԧ᧿䘠 䰝DŽ੖ࡉ䈕᮷Ԧ᧿䘠ㅖሶ࿻㓸༴Ҿᢃᔰ⣦ᘱDŽޣ䰝ˈণ൘ᯠ〻ᒿѝ䈕᮷Ԧ᧿䘠ㅖ㻛ޣሶ㻛 close_on_exec ѝⲴሩᓄ∄⢩սᱟ㖞ս⣦ᘱˈ䛓Ѹ൘ᆀ䘋〻ᢗ㹼 execve()䈳⭘ᰦሩᓄᢃᔰ⵰Ⲵ᮷Ԧ᧿䘠ㅖ 㻛ᯠ〻ᒿᴯᦒᦹˈᒦ൘ᆀ䘋〻ѝᔰ࿻ᢗ㹼ᯠ〻ᒿDŽ㤕ањ᮷Ԧ᧿䘠ㅖ൘ޘᒿDŽ↔ᰦᆀ䘋〻ሶᆼ 〻ᒿ֯⭘ fork()࠭ᮠࡋᔪҶањᆀ䘋〻ᰦˈ䙊ᑨՊ൘䈕ᆀ䘋〻ѝ䈳⭘ execve()࠭ᮠ࣐䖭ᢗ㹼ਖањᯠ〻 䰝Ⲵ᮷Ԧ᧿䘠ㅖ˄৲㿱 include/fcntl.h˅DŽᖃањޣ᮷Ԧ᧿䘠ㅖˈ⭘Ҿ⺞ᇊ൘䈳⭘㌫㔏䈳⭘ execve()ᰦ䴰㾱 ƹunsigned long close_on_exec ᱟањ䘋〻᮷Ԧ᧿䘠ㅖ˄᮷Ԧਕᷴ˅սമḷᘇDŽ⇿њ∄⢩սԓ㺘ањ ቡ㻛䍻ҸҶ㻛ᢗ㹼᮷ԦⲴ޵ᆈ i 㢲⛩Ⲵᤷ䪸DŽ↔ਾᡰᴹԫ࣑Ⲵ䈕٬ቡ൷нՊѪ 0 ҶDŽ fork()Պ༽ࡦ⡦䘋〻Ⲵԫ࣑ᮠᦞ㔃ᶴˈഐ↔ԫ࣑ 1 Ⲵ executable ҏᱟ 0DŽն൘ᢗ㹼Ҷ execve()ѻਾˈexecutable ٬Ѫ 0DŽਖཆˈࡋᔪᯠ䘋〻ᰦˈ Ԧ㌫㔏к࣐䖭䘀㹼Ⲵᢗ㹼᮷Ԧˈഐ↔޵Ṩԓ⸱ѝപᇊ䇮㖞ᆳⲴ executable ޵Ṩԓ⸱ѝⲴᡰᴹԫ࣑Ⲵ executable 䜭ᱟ 0DŽഐѪԫ࣑ 0 Ⲵԓ⸱वਜ਼൘޵Ṩԓ⸱ѝˈᆳнᱟ⭡㌫㔏Ӿ᮷ 䘉Ӌԫ࣑वᤜԫ࣑ 0ǃԫ ࣑ 1 ԕ৺ԫ࣑ 1 ⴤ᧕ࡋᔪⲴ⋑ᴹᢗ㹼䗷 execve()Ⲵᡰᴹԫ࣑ˈণԓ⸱ⴤ᧕वਜ਼൘ ൘㌫㔏ࡍ࿻ॆᰦˈ൘ㅜ 1 ⅑䈳⭘ᢗ㹼 execve()࠭ᮠѻࡽˈ㌫㔏ࡋᔪⲴᡰᴹԫ࣑Ⲵ executable 䜭ᱟ 0DŽ ӛ᫽֌DŽޡᒿᱟ੖ᴹཊњᤧ䍍ᆈ൘˄䎧⸱ 2 њ˅DŽ㤕ᱟⲴ䈍ࡉ൘ԆԜѻ䰤ቍ䈅亥䶒 share_page()࠭ᮠѝDŽ䈕࠭ᮠԓ⸱ṩᦞ䘋〻Ⲵ executable ᡰᤷ㢲⛩Ⲵᕅ⭘䇑ᮠਟࡔᯝ㌫㔏ѝᖃࡽ䘀㹼Ⲵ〻 ᤷ޵ᆈ i 㢲⛩Ⲵᕅ⭘䇑ᮠՊ㻛߿ 1ˈᒦф䈕ᆇ⇥ሶ㻛㖞オDŽ䈕ᆇ⇥Ⲵѫ㾱֌⭘փ⧠൘ memory.c 〻ᒿⲴ Պ㻛ᴯᦒᡀ exec()࠭ᮠᡰᢗ㹼〻ᒿⲴ޵ᆈ i 㢲⛩ᤷ䪸DŽᖃ䘋〻䈳⭘ exit()࠭ᮠ㘼ᢗ㹼䘰ࠪ༴⨶ᰦ䈕ᆇ⇥ᡰ ٬ቡ⇥о⡦䘋〻䘀㹼਼ањ〻ᒿDŽᖃ൘䘋〻ѝ䈳⭘ exec()㊫࠭ᮠ㘼৫ᢗ㹼ањᤷᇊⲴᢗ㹼᮷Ԧᰦˈ䈕ᆇ ণ㺘⽪↓൘ˈexecutable->i_count ՊབྷҾ 1DŽ൘䘋〻㻛ࡋᔪᰦ䈕ᆇ⇥㻛䍻Ҹ઼⡦䘋〻਼аᆇ⇥⴨਼Ⲵ٬ ٬ ᶕࡔᯝ㌫㔏ѝᱟ੖䘈ᴹਖањ䘋〻൘䘀㹼਼ањᢗ㹼᮷ԦDŽྲ᷌ᴹⲴ䈍䛓Ѹ䘉њ޵ᆈѝ i 㢲⛩ᕅ⭘䇑ᮠ ƹstruct m_inode * executable ᱟ䘋〻䘀㹼Ⲵᢗ㹼᮷Ԧ൘޵ᆈѝ i 㢲⛩㔃ᶴᤷ䪸DŽ㌫㔏ਟṩᦞ䈕ᆇ⇥  LQX[ 䘋〻᧗ࡦ/ 㔗㔝 UXQQLQJ ޵Ṩ䘀㹼ᘱ       XQLQWHUUXSWLEOH нਟѝᯝⶑⵐ⣦ᘱ LQWHUUXSWLEOH ਟѝᯝⶑⵐ⣦ᘱ VWRSSHG ᘱ⣦ڌᲲ ]RPELH ᘱ⣦↫ܥ ୔䟂 ⶑⵐ ⶑⵐ ୔䟂 䈳ᓖ 㓸→ ڌᲲ UXQQLQJ ⭘ᡧ䘀㹼ᘱ ㌫㔏䈳⭘ᡆѝᯝ ѝᯝѝᯝ䘄എ䘄എ UXQQLQJ ቡ㔚ᘱ 䘋〻൘޵Ṩᘱᢗ㹼ᰦ䴰㾱ㅹᖵ㌫㔏ⲴḀњ䍴Ⓚˈ↔ᰦ䈕䘋〻ቡՊ䈳⭘ sleep_on()ᡆ interruptible_sleep_on() ᖃањ䘋〻Ⲵ䘀㹼ᰦ䰤⡷⭘ᆼˈ㌫㔏ቡՊ֯⭘䈳ᓖ〻ᒿᕪࡦ࠷ᦒࡠަԆⲴ䘋〻৫ᢗ㹼DŽਖཆˈྲ᷌ 〻䈳⭘ wait()ਆᗇҶᆀ䘋〻Ⲵؑ᚟ˈࡉ༴Ҿ䈕⣦ᘱ䘋〻Ⲵԫ࣑ᮠᦞ㔃ᶴቡՊ㻛䟺᭮ᦹDŽ ⮉⵰DŽаᰖ⡦䘋؍䘀㹼Ⲵؑ᚟ˈ↔ᰦᆀ䘋〻Ⲵԫ࣑ᮠᦞ㔃ᶴؑ᚟䘈䴰㾱→ڌҶ䇙⡦䘋〻㜭ཏ㧧ਆަ ᘱDŽѪҶ⣦↫ܥ䘀㹼ˈնަ⡦䘋〻䘈⋑ᴹ䈳⭘ wait()䈒䰞ަ⣦ᘱᰦˈࡉ〠䈕䘋〻༴Ҿ→ڌᖃ䘋〻ᐢ ᘱ˄TASK_ZOMBIE˅⣦↫ܥƹ 0.11 ѝˈ䘈ᵚᇎ⧠ሩ䈕⣦ᘱⲴ䖜ᦒ༴⨶DŽ༴Ҿ䈕⣦ᘱⲴ䘋〻ሶ㻛֌Ѫ䘋〻㓸→ᶕ༴⨶DŽ 䈕⣦ᘱDŽ൘LinuxޕSIGCONTؑਧ䇙䘋〻䖜ᦒࡠਟ䘀㹼⣦ᘱDŽ䘋〻൘䈳䈅ᵏ䰤᧕᭦ࡠԫօؑਧ൷Պ䘋 ᘱDŽਟੁަਁ䘱⣦ڌᲲޕᖃ䘋〻᭦ࡠؑਧ SIGSTOPǃSIGTSTPǃSIGTTIN ᡆ SIGTTOU ᰦቡՊ䘋 ᘱ˄TASK_STOPPED˅⣦ڌƹᲲ 㘵ᡰㅹᖵһԦՊᖸᘛਁ⭏ᰦ֯⭘DŽ wake_up()࠭ᮠ᰾⺞୔䟂ᰦ᡽㜭䖜ᦒࡠਟ䘀㹼Ⲵቡ㔚⣦ᘱDŽ䈕⣦ᘱ䙊ᑨ൘䘋〻䴰㾱нਇᒢᢠൠㅹᖵᡆ 䲔ҶнՊഐѪ᭦ࡠؑਧ㘼㻛୔䟂ˈ䈕⣦ᘱоਟѝᯝⶑⵐ⣦ᘱ㊫լDŽն༴Ҿ䈕⣦ᘱⲴ䘋〻ਚᴹ㻛֯⭘ ƹнਟѝᯝⶑⵐ⣦ᘱ˄TASK_UNINTERRUPTIBLE˅ Ҷ䘋〻↓൘ㅹᖵⲴ䍴Ⓚˈᡆ㘵䘋〻᭦ࡠањؑਧˈ䜭ਟԕ୔䟂䘋〻䖜ᦒࡠቡ㔚⣦ᘱ˄ਟ䘀㹼⣦ᘱ˅DŽ ᖃ䘋〻༴Ҿਟѝᯝㅹᖵ˄ⶑⵐ˅⣦ᘱᰦˈ㌫㔏нՊ䈳ᓖ䈕䘋〻ᢗ㹼DŽᖃ㌫㔏ӗ⭏ањѝᯝᡆ㘵䟺᭮ ƹਟѝᯝⶑⵐ⣦ᘱ˄TASK_INTERRUPTIBLE˅ ᖃањᯠ䘋〻ࡊ㻛ࡋᔪࠪਾቡ༴Ҿᵜ⣦ᘱѝ˄ᴰлањ 0 ༴˅DŽ 㔚ᘱDŽ䘉Ӌ⣦ᘱ˄മѝѝ䰤аࡇ˅൘޵Ṩѝ㺘⽪ᯩ⌅⴨਼ˈ䜭㻛ᡀѪ༴Ҿ TASK_RUNNING ⣦ᘱDŽ ߶༷䘀㹼⣦ᘱˈ䈕⣦ᘱ〠Ѫቡޕᡧ䘀㹼ᘱ˄⭘ᡧᘱ˅DŽᖃ㌫㔏䍴Ⓚᐢ㓿ਟ⭘ᰦˈ䘋〻ቡ㻛୔䟂㘼䘋 ަ༴Ҿ޵Ṩ䘀㹼ᘱˈᡆㆰ〠Ѫ޵Ṩᘱ˗ᖃањ䘋〻↓൘ᢗ㹼⭘ᡧ㠚ᐡⲴԓ⸱ᰦˈᡁԜ〠ަѪ༴Ҿ⭘ Ⲵ⣦ᘱDŽ䘋〻ਟԕ൘޵Ṩᘱ䘀㹼ˈҏਟԕ൘⭘ᡧᘱ䘀㹼DŽᖃањ䘋〻൘޵Ṩԓ⸱ѝ䘀㹼ᰦˈᡁԜ〠 ˄running˅DŽ㤕↔ᰦ䘋〻⋑ᴹ㻛 CPU ᢗ㹼ˈࡉ〠ަ༴Ҿቡ㔚䘀㹼⣦ᘱDŽ㿱മ 5-20 ѝйњḷਧѪ 0 ᖃ䘋〻↓൘㻛 CPU ᢗ㹼ˈᡆᐢ㓿߶༷ቡ㔚䲿ᰦਟ⭡䈳ᓖ〻ᒿᢗ㹼ˈࡉ〠䈕䘋〻Ѫ༴Ҿ䘀㹼⣦ᘱ ƹ䘀㹼⣦ᘱ˄TASK_RUNNING˅ ഴ  䘑ぁ⣬ᘷ਀䖢ᦘީ㌱   LQX[ 䘋〻᧗ࡦ/ ึḸᢙኅᯩੁ (6363LUHW ᤷԔᢗ㹼ࡽᯠⲴ 66 (63766 ѝⲴ 66 63 ৏(,3 ৏ ()/$*6 ৏ (63 ৏&6  ৏66 031 ഴ  ⢯ᵹ㓝ਇ⭕਎ौᰬѣᯣ䘊ഔ฼Ḿ㔉ᶺ⽰ᝅഴ  㓗 0 䐣䖜ࡠཆቲⲴ⢩ᵳ㓗 3 к䘀㹼DŽ৲㿱മ 5-21 ᡰ⽪Ⲵ⢩ᵳ㓗ਁ⭏ਈॆᰦѝᯝ䘄എึḸ㔃ᶴ⽪᜿മDŽ ᤙㅖ䇮㖞ᡀԫ࣑ 0 ԓ⸱⇥䘹ᤙㅖˈަ⢩ᵳ㓗Ѫ 3DŽ↔ਾᢗ㹼ѝᯝ䘄എᤷԔ iret ᰦሶሬ㠤㌫㔏 CPU Ӿ⢩ᵳ എվ㓗࡛ԓ⸱Ⲵᯩ⌅DŽ䈕ᯩ⌅Ⲵѫ㾱ᙍᜣᱟ൘ึḸѝᶴㆁѝᯝ䘄എᤷԔ䴰㾱Ⲵ޵ᇩˈᢺ䘄എൠ൰Ⲵ⇥䘹 ᡆѝᯝǃ䲧䱡䰘ᶕ䈳⭘ᡆ䖜〫ࡠ儈㓗࡛ԓ⸱ѝ䘀㹼ˈն৽ѻࡉн㹼DŽഐ↔޵Ṩ䟷⭘Ҷ䘉⿽⁑ᤏ IRET 䘄 ᣔᵪࡦ䙐ᡀⲴDŽCPU ݱ䇨վ㓗࡛˄ྲ⢩ᵳ㓗 3˅ԓ⸱䙊䗷䈳⭘䰘؍ ⭘䘉⿽ᯩ⌅䘋㹼᧗ࡦᵳ䖜〫ᱟ⭡ CPU ൘〫ࣘࡠԫ࣑ 0 Ⲵ䗷〻ѝˈᆿ move_to_user_mode ֯⭘Ҷѝᯝ䘄എᤷԔ䙐ᡀ⢩ᵳ㓗᭩ਈⲴᯩ⌅DŽ֯ 3 㓗ˈնᱟӽ❦㔗㔝ᢗ㹼৏ᶕⲴԓ⸱ᤷԔ⍱DŽ 0 䘀㹼⵰ main.c 〻ᒿDŽᆿ move_to_user_mode Ⲵ࣏㜭ቡᱟᢺ䘀㹼⢩ᵳ㓗Ӿ޵ṨᘱⲴ 0 㓗ਈᦒࡠ⭘ᡧᘱⲴ ⇥ѝDŽ޵Ṩࡍ࿻ॆ〻ᒿ main.c ҏণᱟԫ࣑ 0 ѝⲴԓ⸱ˈਚᱟ൘〫ࣘࡠԫ࣑ 0 ѻࡽ㌫㔏↓ԕ޵Ṩᘱ⢩ᵳ㓗 ⇥઼ᮠᦞ⇥Ⲵส൰ᱟ 0ǃ⇥䲀䮯ᱟ 16MBˈഐ↔ԫ࣑ 0 Ⲵԓ⸱⇥઼ᮠᦞ⇥࠶࡛वਜ਼൘޵Ṩԓ⸱⇥઼ᮠᦞ ᮠᦞ㔃ᶴѝ䇮㖞Ⲵࡍ࿻ᮠᦞਟ⸕ˈԫ࣑ 0 Ⲵԓ⸱⇥઼ᮠᦞ⇥Ⲵส൰ᱟ 0ǃ⇥䲀䮯ᱟ 640KBDŽ㘼޵Ṩԓ⸱ 䘉䟼䴰㾱ᕪ䈳Ⲵᱟˈ޵Ṩࡍ࿻ॆᱟањ⢩↺䗷〻ˈ޵Ṩࡍ࿻ॆԓ⸱ҏণᱟԫ࣑ 0 Ⲵԓ⸱DŽӾԫ࣑ 0 㺘ᇴᆈಘ ldtr ѝDŽ ˄TSS˅᧿䘠ㅖ઼ተ䜘᧿䘠ㅖ㺘˄LDT˅Ⲵ⇥᧿䘠ㅖˈᒦᢺᆳԜ࠶࡛࣐䖭ࡠԫ࣑ᇴᆈಘ tr ઼ተ䜘᧿䘠ㅖ ԫ࣑ 0 Ⲵԫ࣑⣦ᘱ⇥ޕተ᧿䘠ㅖ㺘ѝ␫ޘinclude/linux/sched.h˅ǃ൘˄䇮㖞ྭԫ࣑ 0 ᮠᦞ㔃ᶴ਴ᆇ⇥Ⲵ٬ ൘ሩ䈳ᓖ〻ᒿⲴࡍ࿻ॆ䗷〻˄sched_init()˅ѝˈ俆ݸሩԫ࣑ 0 Ⲵ䘀㹼⧟ຳ䘋㹼Ҷ䇮㖞DŽ䘉वᤜӪᐕ亴ݸ 〻ᒿᢗ㹼⍱Ӿ޵Ṩᘱ˄⢩ᵳ㓗 0˅〫ࣘࡠҶ⭘ᡧᘱ˄⢩ᵳ㓗 3˅Ⲵԫ࣑ 0 ѝ㔗㔝䘀㹼DŽ൘〫ࣘѻࡽˈ㌫㔏 Ā〫ࣘࡠԫ࣑ 0 ѝᢗ㹼ā䘉њ䗷〻⭡ᆿ move_to_user_mode˄include/asm/system.h˅ᆼᡀDŽᆳᢺ main.c ⭘ˈަѝ৸Պ৫ᢗ㹼䈳ᓖ࠭ᮠDŽ ॆᒦᢗ㹼 shell ⲫᖅ〻ᒿDŽ㘼৏䘋〻 0 ࡉՊ൘㌫㔏オ䰢ᰦ㻛䈳ᓖᢗ㹼ˈ↔ᰦԫ࣑ 0 ӵᢗ㹼 pause()㌫㔏䈳 0˄䘋〻 0˅ѝ䘀㹼ˈᒦ֯⭘ fork()䈳⭘俆⅑ࡋᔪࠪ䘋〻 1DŽ൘䘋〻 1 ѝ〻ᒿሶ㔗㔝䘋㹼ᓄ⭘⧟ຳⲴࡍ࿻ ༴⨶DŽ൘ᆼᡀҶ䘉Ӌ᫽֌ѻਾˈ㌫㔏਴䜘࠶ᐢ㓿༴Ҿਟ䘀㹼⣦ᘱDŽ↔ਾ〻ᒿᢺ㠚ᐡĀ᡻ᐕā〫ࣘࡠԫ࣑ ࡍ࿻ॆ࠭ᮠ࠶࡛ሩ޵ᆈ㇑⨶ǃѝᯝ༴⨶ǃඇ䇮઼༷ᆇㅖ䇮༷ǃ䘋〻㇑⨶ԕ৺⺜ⴈ઼䖟ⴈ⺜Ԧ䘋㹼ࡍ࿻ॆ ᢗ㹼㌫㔏ࡍ࿻ॆ〻ᒿ init/main.cDŽ䈕〻ᒿ俆ݸ⺞ᇊྲօ࠶䝽֯⭘㌫㔏⢙⨶޵ᆈˈ❦ਾ䈳⭘޵Ṩ਴䜘࠶Ⲵ ᣔ⁑ᔿл䘀㹼ਾˈቡᔰ࿻؍ޕ൘ boot/ⴞᖅѝˈᕅሬ〻ᒿᢺ޵ṨӾ⻱ⴈк࣐䖭ࡠ޵ᆈѝˈᒦ䇙㌫㔏䘋 5.7.3 䘑ぁࡓခौ Ṩᮠᦞ䭉䈟ˈ޵Ṩ൘ᢗ㹼Ѥ⭼४ԓ⸱ᰦՊ⾱→а࠷ѝᯝDŽ 㹼Ⲵ䘋〻н㜭㻛ަԆ䘋〻ᣒঐˈ㘼фањ䘋〻н㜭᭩ਈਖањ䘋〻Ⲵ⣦ᘱDŽѪҶ䚯ݽ䘋〻࠷ᦒᰦ䙐ᡀ޵ ਚᴹᖃ䘋〻ӾĀ޵Ṩ䘀㹼ᘱā䖜〫ࡠĀⶑⵐ⣦ᘱāᰦˈ޵Ṩ᡽Պ䘋㹼䘋〻࠷ᦒ᫽֌DŽ൘޵Ṩᘱл䘀 ˄TASK_UNINTERRUPTIBLE ᡆ TASK_INTERRUPTIBLE˅DŽ ⶑⵐ⣦ᘱޕ㠚ᝯൠ᭮ᔳ CPU Ⲵ֯⭘ᵳˈ㘼䇙䈳ᓖ〻ᒿ৫ᢗ㹼ަԆ䘋〻DŽ䘋〻ࡉ䘋  LQX[ 䘋〻᧗ࡦ/ ⸕ˈLinux 䘋〻ᱟᣒঐᔿⲴˈն㻛ᣒঐⲴ䘋〻ӽ❦༴Ҿ TASK_RUNNING ⣦ᘱˈਚᱟᲲᰦ⋑ᴹ㻛 CPU 䘀 ⹰DŽ䈳ᓖ〻ᒿਟԕⴻ֌Ѫ൘ᡰᴹ༴Ҿ䘀㹼⣦ᘱⲴ䘋〻ѻ䰤࠶䝽 CPU 䘀㹼ᰦ䰤Ⲵ㇑⨶ԓ⸱DŽ⭡ࡽ䶒᧿䘠ਟ ޵ṨѝⲴ䈳ᓖ〻ᒿ⭘Ҿ䘹ᤙ㌫㔏ѝлањ㾱䘀㹼Ⲵ䘋〻DŽ䘉⿽䘹ᤙ䘀㹼ᵪࡦᱟཊԫ࣑᫽֌㌫㔏Ⲵส 5.7.5 䘑ぁ䈹ᓜ 亥䶒ˈ❦ਾ CPU ৸䟽ᯠᢗ㹼ᕅ䎧ᔲᑨⲴᤷԔDŽࡠ↔ᰦᯠ〻ᒿⲴԓ⸱᡽ⵏ↓ᔰ࿻㻛ᢗ㹼DŽ CPU ቡՊ・࡫ӗ⭏ԓ⸱亥䶒нᆈ൘Ⲵᔲᑨ˄Fault˅ˈ↔ᰦ޵ᆈ㇑⨶〻ᒿቡՊӾඇ䇮༷к࣐䖭⴨ᓄⲴԓ⸱ ቡՊ㻛␵ᦹ˄䟺᭮˅DŽᖵ䈕ᆀ䘋〻ᔰ࿻䘀㹼ᯠ〻ᒿᰦˈ⭡Ҿ↔ᰦ޵Ṩ䘈⋑ᴹӾඇ䇮༷к࣐䖭䈕〻ᒿⲴԓ⸱ˈ exec()ਾˈᆀ䘋〻৏ᶕⲴԓ⸱઼ᮠᦞ४ ޕ〻ᒿᰦˈа㡜ᱟ൘ᆀ䘋〻ѝ䘀㹼 exec()㌫㔏䈳⭘ᶕ᫽֌ⲴDŽ൘䘋 ࡦҶ⡦䘋〻Ⲵԓ⸱઼ᮠᦞ४ˈᒦՊ൘ަѝᢗ㹼ᆀ䘋〻䜘࠶Ⲵԓ⸱DŽ㘼ᢗ㹼ඇ䇮༷кⲴањ༽ޘᰦˈᆳᆼ ਖཆ䈧⌘᜿ˈࡋᔪањᯠⲴᆀ䘋〻઼࣐䖭䘀㹼ањᢗ㹼〻ᒿ᮷Ԧᱟєњн਼ⲴᾲᘥDŽᖃࡋᔪᆀ䘋〻 ਟ䘀㹼⣦ᘱᒦ䘄എᯠ䘋〻ਧDŽ Ⲵ TSS ઼ LDT ᧿䘠ㅖ亩ˈަѝสൠ൰ؑ᚟ᤷੁᯠ䘋〻ԫ࣑㔃ᶴѝⲴ tss ઼ ldtDŽᴰਾ޽ሶᯠԫ࣑䇮㖞ᡀ 䲿ਾˈྲ᷌⡦䘋〻ѝᴹ᮷ԦᱟᢃᔰⲴˈࡉᓄሶሩᓄ᮷ԦⲴᢃᔰ⅑ᮠ໎ 1DŽ᧕⵰൘ GDT ѝ䇮㖞ᯠԫ࣑ ⿽༴⨶ᯩᔿ〠Ѫ߉ᰦ༽ࡦ˄Copy On Write˅ᢰᵟDŽ Ⲵ⤜㠚֯⭘Ⲵ޵ᆈ亥䶒DŽ䘉ޣᯠ䘋〻ѝԫ᜿ањᴹ߉޵ᆈ᫽֌ᰦˈ㌫㔏᡽ՊѪᢗ㹼߉᫽֌Ⲵ䘋〻࠶䝽⴨ ӛަ⡦䘋〻Ⲵ޵ᆈ亥䶒DŽਚᴹᖃ⡦䘋〻ᡆޡᰦ㌫㔏ᒦнѪᯠⲴ䘋〻࠶䝽ᇎ䱵Ⲵ⢙⨶޵ᆈ亥䶒ˈ㘼ᱟ䇙ᆳ ↔ਾ㌫㔏䇮㖞ᯠԫ࣑Ⲵԓ⸱઼ᮠᦞ⇥ส൰ǃ䲀䮯ˈᒦ༽ࡦᖃࡽ䘋〻޵ᆈ࠶亥㇑⨶Ⲵ亥㺘DŽ⌘᜿ˈ↔ ᆈࡠᯠ䘋〻Ⲵ tss.i387 㔃ᶴѝDŽ؍ಘˈࡉ䘈䴰㾱ᢺॿ༴⨶ಘⲴᆼᮤ⣦ᘱ 㖞ᡀ޵Ṩᮠᦞ⇥䘹ᤙㅖDŽtss.ldt 㻛䇮㖞Ѫተ䜘㺘᧿䘠ㅖ൘ GDT ѝⲴ㍒ᕅ٬DŽྲ᷌ᖃࡽ䘋〻֯⭘Ҷॿ༴⨶ 䘋〻޵ṨᘱึḸᤷ䪸 tss.esp0 㻛䇮㖞ᡀᯠ䘋〻ԫ࣑ᮠᦞ㔃ᶴᡰ൘޵ᆈ亥䶒Ⲵ亦ㄟˈ㘼ึḸ⇥ tss.ss0 㻛䇮 ⣦ᘱ⇥˄TSS˅ѝ਴ᇴᆈಘⲴ٬DŽ⭡Ҿࡋᔪ䘋〻ᰦᯠ䘋〻䘄എ٬ᓄѪ 0ˈᡰԕ䴰㾱䇮㖞 tss.eax = 0DŽᯠᔪ ٬Ѫ 15 њ㌫㔏┤ㆄᮠ˄150 ∛。˅DŽ᧕⵰ṩᦞᖃࡽ䘋〻䇮㖞ԫ࣑⡷ᒦ䇮㖞ࡍ࿻䘀㹼ᰦ䰤ˈ䘋〻਴㔏䇑٬ 䲿ਾሩ༽ࡦⲴԫ࣑ᮠᦞ㔃ᶴ䘋㹼؞᭩DŽᢺᖃࡽ䘋〻䇮㖞Ѫᯠ䘋〻Ⲵ⡦䘋〻ˈ␵䲔ؑਧսമᒦ༽սᯠ ↔ᰦᓄ䈕・࡫ሶᯠ䘋〻⣦ᘱ㖞ѪнਟѝᯝⲴㅹᖵ⣦ᘱ˄TASK_UNINTERRUPTIBLE˅DŽ ѝⲴᡰᴹ޵ᇩ֌Ѫᯠ䘋〻ԫ࣑ᮠᦞ㔃ᶴⲴ⁑ᶯDŽѪҶ䱢→䘉њ䘈ᵚ༴⨶ᆼᡀⲴᯠᔪ䘋〻㻛䈳ᓖ࠭ᮠᢗ㹼ˈ ㌫㔏Ѫᯠᔪ䘋〻൘ѫ޵ᆈ४ѝ⭣䈧а亥޵ᆈᶕᆈ᭮ަԫ࣑ᮠᦞ㔃ᶴؑ᚟ˈᒦ༽ࡦᖃࡽ䘋〻ԫ࣑ᮠᦞ㔃ᶴ ᷌㌫㔏ᐢ㓿ᴹ 64 њ䘋〻൘䘀㹼ˈࡉ fork()㌫㔏䈳⭘ՊഐѪԫ࣑ᮠ㓴㺘ѝ⋑ᴹਟ⭘オ亩㘼ࠪ䭉䘄എDŽ❦ਾ ൘ࡋᔪᯠ䘋〻Ⲵ䗷〻ѝˈ㌫㔏俆ݸ൘ԫ࣑ᮠ㓴ѝ᢮ࠪањ䘈⋑ᴹ㻛ԫօ䘋〻֯⭘Ⲵオ亩˄オ˅DŽྲ Ⲵᆀ䘋〻DŽ Linux ㌫㔏ѝࡋᔪᯠ䘋〻֯⭘ fork()㌫㔏䈳⭘DŽᡰᴹ䘋〻䜭ᱟ䙊䗷༽ࡦ䘋〻 0 㘼ᗇࡠⲴˈ䜭ᱟ䘋〻 0 5.7.4 ࡑᔰ᯦䘑ぁ ᤱĀᒢ߰ā⣦ᘱDŽ؍ᔪԫ࣑ 1˄䘋〻 1˅ѻࡽ ᯠ䘋〻ᰦˈ䴰㾱༽ࡦԫ࣑ 0 Ⲵԫ࣑ᮠᦞ㔃ᶴˈवᤜަ⭘ᡧึḸᤷ䪸ˈഐ↔㾱≲ԫ࣑ 0 Ⲵ⭘ᡧᘱึḸ൘ࡋ ึḸࡉ㻛ᤷᇊѪަԫ࣑ᮠᦞ㔃ᶴᡰ൘亥䶒Ⲵ亦ㄟᔰ࿻˄PAGE_SIZE + (long)&init_task˅DŽ⭡Ҿԕਾ൘ࡋᔪ ԕ⢩ᵳ㓗 3 䘀㹼൘ԫ࣑ 0 Ⲵԓ⸱кDŽᡰ֯⭘Ⲵ⭘ᡧᘱึḸ䘈ᱟ৏ᶕ൘〫ࣘѻࡽ֯⭘ⲴึḸDŽ㘼ަ޵Ṩᘱ CPU Պᢺ䘉Ӌ⇥ᇴᆈಘ␵䴦DŽഐ↔൘ᢗ㹼Ҷ iret ᤷԔਾ䴰㾱䟽ᯠ࣐䖭䘉Ӌ⇥ᇴᆈಘDŽ↔ਾˈ㌫㔏ቡᔰ࿻ Ḹᤷ䪸ᕩࠪࡠ SS:ESP ѝDŽ⭡Ҿ⢩ᵳ㓗ਁкҶਈॆˈ⇥ᇴᆈಘ DSǃESǃFS ઼ GS Ⲵ٬ਈᗇᰐ᭸ˈ↔ᰦ ࡔᯝࠪⴞⲴԓ⸱⇥Ⲵ⢩ᵳ㓗ᱟ 3ˈоᖃࡽ޵ṨᘱⲴ 0 㓗н਼DŽҾᱟ CPU ՊᢺึḸѝⲴึḸ⇥䘹ᤙㅖ઼ึ CS:EIP ѝˈ਼ᰦᕩࠪึḸѝḷᘇᇴᆈಘ޵ᇩDŽ⭡Ҿ CPU ޕᖃᢗ㹼 iret ᤷԔᰦˈCPU ᢺ䘄എൠ൰䘱 ս㖞ᱟ iret ਾⲴаᶑᤷԔ༴DŽ〫ٿս㖞DŽ䈕〫 ٿԫ࣑ 0 ԓ⸱⇥䘹ᤙㅖ઼ᢗ㹼ѝᯝ䘄എਾ䴰㾱ᢗ㹼ⲴлаᶑᤷԔⲴޕḷᘇᇴᆈಘ޵ᇩDŽᴰਾ঻ޕ❦ਾ঻ ԫ࣑ 0 ึḸ⇥˄ণᮠᦞ⇥˅䘹ᤙㅖ઼޵ṨึḸᤷ䪸DŽޕᆿ move_to_user_mode 俆ݸᖰ޵ṨึḸѝ঻  LQX[ 䘋〻᧗ࡦ/ 䘉њ䗷〻ਟ৲㿱മ 5-22 ᡰ⽪DŽ ੁⲴᯠԫ࣑ᮠᦞ㔃ᶴѝ tss 㔃ᶴѝⲴᇴᆈಘؑ᚟ᚒ༽ࡠ CPU ѝˈ㌫㔏ቡ↓ᔿᔰ࿻䘀㹼ᯠ࠷ᦒⲴԫ࣑ҶDŽ ಘ TR ѝ TSS ⇥䘹ᤙㅖᡰᤷੁⲴᖃࡽ䘋〻ԫ࣑ᮠᦞ㔃ᶴⲴ tss 㔃ᶴѝˈ❦ਾᢺᯠԫ࣑⣦ᘱ⇥䘹ᤙㅖᡰᤷ ᆈࡠᖃࡽԫ࣑ᇴᆈ؍㓴ᡀⲴൠ൰༴ˈ䙐ᡀ CPU ᢗ㹼ԫ࣑࠷ᦒ᫽֌DŽ↔ᰦ CPU ՊᢺަᡰᴹᇴᆈಘⲴ⣦ᘱ ተਈ䟿 current 㖞Ѫᯠԫ࣑Ⲵᤷ䪸ˈ❦ਾ䮯䐣䖜ࡠᯠԫ࣑Ⲵԫ࣑⣦ᘱ⇥ TSSޘ䘰ࠪDŽ੖ࡉቡ俆ݸᢺ޵Ṩ ⴤ᧕ˈڊ൘䘋㹼࠷ᦒѻࡽˈswitch_to()俆ݸỰḕ㾱࠷ᦒࡠⲴ䘋〻ᱟ੖ቡᱟᖃࡽ䘋〻ˈྲ᷌ᱟࡉӰѸҏн switch_to()ᆿᢗ㹼ᇎ䱵䘋〻࠷ᦒ᫽֌DŽ䈕ᆿՊᢺ CPU Ⲵᖃࡽ䘋〻⣦ᘱ˄кл᮷˅ᴯᦒᡀᯠ䘋〻Ⲵ⣦ᘱDŽ ⇿ᖃ䘹ᤙࠪањᯠⲴਟ䘀㹼䘋〻ᰦˈschedule()࠭ᮠቡՊ䈳⭘ᇊѹ൘ include/asm/system.h ѝⲴ 䘑ぁ࠽ᦘ ༴ҾӰѸ⣦ᘱDŽਚ㾱㌫㔏オ䰢ቡ䈳ᓖ䘋〻 0 䘀㹼DŽ ᢺ㠚ᐡ㖞ѪਟѝᯝⲴⶑⵐ⣦ᘱᒦ޽⅑䈳⭘ schedule()DŽн䗷൘䈳ᓖ䘋〻䘀㹼ᰦˈschedule()ᒦн൘᜿䘋〻 0 ྲ᷌↔ᰦ⋑ᴹަԆ䘋〻ਟ䘀㹼ˈ㌫㔏ቡՊ䘹ᤙ䘋〻 0 䘀㹼DŽሩҾ Linux 0.11 ᶕ䈤ˈ䘋〻 0 Պ䈳⭘ pause() 䈳⭘ switch_to()ᢗ㹼ᇎ䱵Ⲵ䘋〻࠷ᦒ᫽֌DŽ ԫ࣑ᮠ㓴ѝᡰᴹ༴Ҿ TASK_RUNNING ⣦ᘱⲴ䘋〻ˈᒦ䟽༽к䘠䗷〻ˈⴤࡠ䘹ᤙࠪањ䘋〻Ѫ→DŽᴰਾ ٬DŽ❦ਾ schedule()࠭ᮠ䟽ᯠᢛ᧿ 䘉ṧሩҾ↓൘ⶑⵐⲴ䘋〻ᖃᆳԜ㻛୔䟂ᰦቡާᴹ䖳儈Ⲵᰦ䰤⡷ counter prioritycountercounter  2 ᔿᱟ˖ޜ䇑㇇Ⲵ counterDŽ ٬⡷priorityˈሩ㌫㔏ѝᡰᴹ䘋〻˄वᤜ↓൘ⶑⵐⲴ䘋〻˅䟽ᯠ䇑㇇⇿њԫ࣑䴰㾱䘀㹼Ⲵᰦ䰤 ᵳ٬ ྲ᷌↔ᰦᡰᴹ༴Ҿ TASK_RUNNING ⣦ᘱ䘋〻Ⲵᰦ䰤⡷䜭ᐢ㓿⭘ᆼˈ㌫㔏ቡՊṩᦞ⇿њ䘋〻ⲴՈݸ ᱟቡ䘹ѝ䈕䘋〻ˈᒦ֯⭘ԫ࣑࠷ᦒᆿ࠭ᮠ࠷ᦒࡠ䈕䘋〻䘀㹼DŽ ┤ㆄ䇑ᮠ counter Ⲵ٬ᶕ⺞ᇊᖃࡽଚњ䘋〻䘀㹼Ⲵᰦ䰤ᴰቁDŽଚањⲴ٬བྷˈቡ㺘⽪䘀㹼ᰦ䰤䘈н䮯ˈҾ schedule()࠭ᮠ俆ݸᢛ᧿ԫ࣑ᮠ㓴DŽ䙊䗷∄䖳⇿њቡ㔚ᘱ˄TASK_RUNNING˅ԫ࣑Ⲵ䘀㹼ᰦ䰤䙂߿ 䈹ᓜぁᓅ аᇊⲴ䈳ᓖㆆ⮕DŽ൘ Linux 0.11 ѝ䟷⭘ҶสҾՈݸ㓗ᧂ䱏Ⲵ䈳ᓖㆆ⮕DŽ ѪҶ㜭䇙䘋〻ᴹ᭸ൠ֯⭘㌫㔏䍴Ⓚˈ৸㜭֯䘋〻ᴹ䖳ᘛⲴ૽ᓄᰦ䰤ˈቡ䴰㾱ሩ䘋〻Ⲵ࠷ᦒ䈳ᓖ䟷⭘ 㹼DŽ䘋〻Ⲵᣒঐਁ⭏൘䘋〻༴Ҿ⭘ᡧᘱᢗ㹼䱦⇥ˈ൘޵Ṩᘱᢗ㹼ᰦᱟн㜭㻛ᣒঐⲴDŽ  LQX[ 䘋〻᧗ࡦ/ 䮯䐣䖜㠣 766 ⇥䘹ᤙㅖ䙐ᡀ &38 ᢗ㹼ԫ࣑࠷ᦒ᫽֌ 75 ᰐ⭘ˈᘭ⮕ ٬䘹ᤙㅖ〫ٿ ս /'75 66 *6 )6 (6 '6 &6 ()/$*6 (,3 (63 (%3 (', (6, ('; (&; (%; ($;    ᯠ 766 ᧿䘠ㅖ ৏ 766 ᧿䘠ㅖ &5 ᯠ WVV *'7 㺘 &38৏ WVV OMPS ᣔ؍ޕ⭘Ҷഋ⿽ึḸDŽа⿽ᱟ㌫㔏ᕅሬࡍ࿻ॆᰦѤᰦ֯⭘ⲴึḸ˗а⿽ᱟ䘋֯ޡ Linux 0.11 ㌫㔏ѝ ㌫∄䖳ᇶ࠷ˈਟԕݸ䐣䗷DŽ൘ᔰ࿻䰵䈫⴨ᓄԓ⸱ᰦ޽എᶕԄ㓶⹄ウDŽޣⲴ䈤᰾о޵Ṩԓ⸱ ᵜ㢲޵ᇩᾲ㾱᧿䘠Ҷ Linux ޵ṨӾᔰᵪᕅሬࡠ㌫㔏↓ᑨ䘀㹼䗷〻ѝሩึḸⲴ֯⭘ᯩᔿDŽ䘉䜘࠶޵ᇩ 5.8 Linux ㌱㔕ѣ฼ḾⲺֵ⭞ᯯ⌋ 㓸→ᆀ䘋〻ԫ࣑ᮠᦞ㔃ᶴᡰঐ⭘Ⲵ޵ᆈ亥䶒ˈᒦ㖞オᆀ䘋〻൘ԫ࣑ᮠ㓴ѝঐ⭘Ⲵᤷ䪸亩DŽ ᘱᰦˈ⡦䘋〻ቡՊᢺᆀ䘋〻䘀㹼ᡰ֯⭘Ⲵᰦ䰤㍟࣐ࡠ㠚ᐡ䘋〻ѝDŽᴰ㓸䟺᭮ᐢ⣦↫ܥ䘋〻㻛㓸→ᒦ༴Ҿ ൘ᆀ䘋〻൘ᢗ㹼ᵏ䰤ˈ⡦䘋〻䙊ᑨ֯⭘ wait()ᡆ waitpid()࠭ᮠㅹᖵަḀњᆀ䘋〻㓸→DŽᖃㅹᖵⲴᆀ ⮉⵰DŽഐѪަ⡦䘋〻䘈䴰㾱֯⭘ަѝⲴؑ᚟DŽ؍❦㿱൘䘋〻㻛㓸→ᰦˈᆳⲴԫ࣑ᮠᦞ㔃ᶴӽ 䘱 SIGCHLD ؑਧˈ䙊⸕ަḀњᆀ䘋〻ᐢ㓿㓸→DŽᴰਾ do_exit()䈳⭘䈳ᓖ࠭ᮠ৫ᢗ㹼ަԆ䘋〻DŽ⭡↔ਟ ᘱ TASK_ZOMBIEDŽᒦੁަ৏⡦䘋〻ਁ⣦↫ܥ䘉䙊ᑨՊ㓸→䈕Պ䈍ѝⲴᡰᴹ䘋〻DŽ❦ਾᢺ䘋〻⣦ᘱ㖞Ѫ ањՊ䈍ཤ䘋〻ᒦфᴹ᧗ࡦ㓸ㄟˈࡉ䟺᭮᧗ࡦ㓸ㄟˈᒦੁ኎Ҿ䈕Պ䈍Ⲵᡰᴹ䘋〻ਁ䘱ᤲᯝؑਧ SIGHUPˈ ᒿⲴ i 㢲⛩䘋㹼਼↕᫽֌DŽྲ᷌䘋〻ᴹᆀ䘋〻ˈࡉ䇙 init 䘋〻֌Ѫަᡰᴹᆀ䘋〻Ⲵ⡦䘋〻DŽྲ᷌䘋〻ᱟ 䰝䘋〻ᢃᔰ⵰Ⲵᡰᴹ᮷Ԧˈሩ䘋〻֯⭘Ⲵᖃࡽᐕ֌ⴞᖅǃṩⴞᖅ઼䘀㹼〻ޣˈ઼ᮠᦞ⇥ঐ⭘Ⲵ޵ᆈ亥䶒 ᖃањ⭘ᡧ〻ᒿ䈳⭘ exit()㌫㔏䈳⭘ᰦˈቡՊᢗ㹼޵Ṩ࠭ᮠ do_exit()DŽ䈕࠭ᮠՊ俆ݸ䟺᭮䘋〻ԓ⸱⇥ वᤜ䘋〻䘀㹼ᰦᢃᔰⲴ᮷Ԧǃ⭣䈧Ⲵ޵ᆈㅹDŽ ᖃањ䘋〻㔃ᶏҶ䘀㹼ᡆ൘ॺ䙄ѝ㓸→Ҷ䘀㹼ˈ䛓Ѹ޵Ṩቡ䴰㾱䟺᭮䈕䘋〻ᡰঐ⭘Ⲵ㌫㔏䍴ⓀDŽ䘉 5.7.6 㓾↘䘑ぁ ഴ  Աࣗ࠽ᦘᬃ֒⽰ᝅഴ   LQX[ ㌫㔏ѝึḸⲴ֯⭘ᯩ⌅/ GUY ㅹ⁑ඇᮠᦞ NHUQHOPPIV N ޵ᆈ亥ⴞᖅ㺘 N; ޵ᆈ亥㺘 ަԆ䜘࠶ N ѝᯝ᧿䘠ㅖ㺘 LGW N ተ᧿䘠ㅖ㺘 JGWޘ ަԆ䜘࠶ ԫ࣑  㔃ᶴؑ᚟ KHDG ԓ⸱઼ᮠᦞ WDVN>@ᤷ䪸ᮠ㓴 XVHUBVWDFN>N@ 亥  ަԆ䜘࠶   ⁑ඇԓ⸱   ަԆ䜘࠶ ึḸᤷ䪸 HVS ึḸ⇥ VV [ [ [F GUY ㅹ⁑ඇԓ⸱ NHUQHOPPIV HQG [HH V\VWHP ⁑ඇ ᣚ⁗ᕅᰬ޻Ṯֵ⭞Ⲻ฼Ḿ⽰ᝅഴؓޛഴ ࡐ䘑  DŽ䘉Ӌൠ൰ս㖞ᱟӾ㕆䈁޵Ṩᰦ⭏ᡀⲴ system.map ᮷ԦѝḕࡠⲴDŽޣ䈁ᰦⲴᇎ䱵䇮㖞৲ᮠᴹ ᆳԜо㕆ˈമਟ৲㿱лമ 5-23 ᡰ⽪DŽ↔ᰦ䈕ึḸᱟ޵Ṩ〻ᒿ㠚ᐡ֯⭘ⲴึḸDŽަѝⲴ㔉ࠪൠ൰ᱟབྷ㓖٬ ਜ਼ᴹ 1024 њ䮯ᆇDŽᆳ൘⢙⨶޵ᆈѝⲴս㖞⽪᜿ޡˈḸ֯⭘DŽuser_stack ᮠ㓴ᇊѹ൘ sched.c Ⲵ 67--72 㹼 ⮉Ҷ 1 亥޵ᆈ˄4K˅֌Ѫึ؍ˈ˅Ḹᤷ䪸 esp 䇮㖞ᡀᤷੁ user_stack ᮠ㓴Ⲵ亦ㄟ˄৲㿱 head.sˈㅜ 31 㹼 ᣔ⁑ᔿл䘀㹼DŽ↔ᰦึḸ⇥㻛䇮㖞Ѫ޵Ṩᮠᦞ⇥˄0x10˅ˈึ؍Ӿ head.s 〻ᒿ䎧ˈ㌫㔏ᔰ࿻↓ᔿ൘ ᣚ⁗ᕅᰬ(head.s)ؓޛ䘑 〻ᒿѝҏ⋯⭘Ҷ bootsect ѝ䇮㖞ⲴึḸ⇥DŽ䘉ቡᱟ㌫㔏ࡍ࿻ॆᰦѤᰦ֯⭘ⲴึḸDŽ esp ᇴᆈಘ䇮㖞Ѫ 0xff00ˈҏণึḸ亦ㄟ൘ 0x9000:0xff00 ༴ˈ৲㿱 boot/bootsect.s ㅜ 61ǃ62 㹼DŽsetup.s ⋑ᴹ֯⭘ึḸDŽⴤࡠ bootsect 㻛〫ࣘࡠ 0x9000:0 ༴ᰦˈ᡽ᢺึḸ⇥ᇴᆈಘ SS 䇮㖞Ѫ 0x9000ˈึḸᤷ䪸 ᖃ bootsect ԓ⸱㻛 ROM BIOS ᕅሬ࣐䖭ࡠ⢙⨶޵ᆈ 0x7c00 ༴ᰦˈᒦ⋑ᴹ䇮㖞ึḸ⇥ˈᖃ❦〻ᒿҏ ᔶᵰࡓခौᰬ(bootsect.sθsetup.s) 5.8.1 ࡓခौ䱬⇫ 䶒࠶࡛ሩᆳԜ䘋㹼䈤᰾DŽ ᆈ൘޵ṨḸѝDŽ㘼ᖃӾ޵Ṩᘱ䘄എ⭘ᡧᘱᰦˈቡՊᚒ༽֯⭘⭘ᡧᘱⲴึḸDŽл؍ḸDŽ৏⭘ᡧḸᤷ䪸Պ㻛 ޵Ṩᘱ䘀㹼ᰦˈቡՊ֯⭘ަ TSS ⇥ѝ㔉ࠪⲴ⢩ᵳ㓗 0 ⲴึḸᤷ䪸 tss.ss0ǃtss.esp0ˈণ޵Ṩޕањԫ࣑䘋 ᣔ䰞仈ˈᢗ㹼 0 㓗Ⲵ޵Ṩԓ⸱઼ᢗ㹼 3 㓗Ⲵ⭘ᡧԓ⸱䴰㾱֯⭘н਼ⲴḸDŽᖃ؍ӛ֯⭘ึḸᑖᶕⲴޡᵳ㓗 ᗇ CPU ሩ޵ᆈራ൰䇯䰞ᯩᔿਁ⭏Ҷਈॆˈഐ↔䴰㾱䟽ᯠ䈳ᮤ䇮㖞Ḹ४ฏDŽਖཆˈѪҶ䀓ߣн਼ CPU ⢩ ᣔ⁑ᔿˈ֯؍ޕ֯⭘ཊњḸᡆ൘н਼ᛵߥл֯⭘н਼ḸⲴѫ㾱৏ഐᴹєњDŽ俆ݸᱟ⭡ҾӾᇎ⁑ᔿ䘋 〻˅䙫䗁ൠ൰オ䰤䘁ᵛㄟ༴DŽ ޵ṨᘱึḸDŽ⇿њԫ࣑䜭ᴹ㠚ᐡ⤜・Ⲵ޵ṨᘱึḸ˗ᴰਾа⿽ᱟԫ࣑൘⭘ᡧᘱᢗ㹼ⲴึḸˈսҾԫ࣑˄䘋 ֯⭘Ⲵ⭘ᡧᘱึḸ˗ਖа⿽ᱟ⇿њԫ࣑䙊䗷㌫㔏䈳⭘ˈᢗ㹼޵Ṩ〻ᒿᰦ֯⭘ⲴึḸˈᡁԜ〠ѻѪԫ࣑Ⲵ ⁑ᔿѻਾᨀ׋޵Ṩ〻ᒿࡍ࿻ॆ֯⭘ⲴึḸˈսҾ޵Ṩԓ⸱ൠ൰オ䰤പᇊս㖞༴DŽ䈕ึḸҏᱟਾᶕԫ࣑ 0  LQX[ ㌫㔏ѝึḸⲴ֯⭘ᯩ⌅/  0% Ḹᖃࡽᤷ䪸 Ḹᓅ ⧟ຳ৲ᮠભԔ㹼৲ᮠԓ⸱઼ᮠᦞ Ḹ޵ᇩDŽޕᆈ؍ਾ൘ esp ᤷ䪸༴❦ˈ٬ 㹼ึḸ᫽֌ᰦᱟݸ䙂߿ึḸᤷ䪸 esp ᡰ⽪DŽᇎ䱵к tss.esp0 㻛䇮㖞ᡀᤷੁ䈕亥䶒˄ཆ˅каᆇ㢲༴˄മѝึḸᓅ༴˅DŽ䘉ᱟഐѪ Intel CPU ᢗ ᆈ task_struct 㔃ᶴ亥䶒ⲴᵛㄟDŽ㿱മ 5-25؍䇮㖞ᡀѪ 0x10˄ণ޵Ṩᮠᦞ⇥䘹ᤙㅖ˅ˈ㘼 tss.esp0 ࡉᤷੁ tss.ss0 ҏ㻛 ٬⇥task_struct 㔃ᶴᮠᦞˈ㘼 tss 㔃ᶴ˄⇥˅ᱟ task_struct ѝⲴањᆇ⇥DŽ䈕ԫ࣑Ⲵ޵ṨึḸ ᆈަ؍ަѝ p ᱟᯠԫ࣑Ⲵԫ࣑ᮠᦞ㔃ᶴᤷ䪸ˈtss ᱟԫ࣑⣦ᘱ⇥㔃ᶴDŽ޵ṨѪᯠԫ࣑⭣䈧޵ᆈ⭘֌ S!WVVVV [ ORQJ S S!WVVHVS 3$*(B6,=( kernel/fork.cˈ93 㹼˖ ൘ᔪ・ᯠԫ࣑ᰦˈfork()〻ᒿ൘ԫ࣑ tss ⇥Ⲵ޵Ṩ㓗ึḸᆇ⇥(tss.esp0 ઼ tss.ss0)ѝ䇮㖞Ⲵˈ৲㿱 ൘սҾަԫ࣑ᮠᦞ㔃ᶴᡰ൘亥䶒Ⲵᵛㄟˈণоԫ࣑Ⲵԫ࣑ᮠᦞ㔃ᶴ˄task_struct˅᭮൘਼а亥䶒޵DŽ䘉ᱟ ޵Ṩԓ⸱ѝᢗ㹼ᰦˈԫ࣑Ⲵ޵ṨᘱḸᙫᱟオⲴDŽԫ࣑޵ṨᘱึḸ㻛䇮㖞ޕ↔⇿ᖃԫ࣑Ӿ⭘ᡧԓ⸱䖜〫䘋 ԫ࣑ TSS ⇥ѝ ss0 ઼ esp0 єњᆇ⇥ᤷᇊDŽss0 ᱟԫ࣑޵ṨᘱึḸⲴ⇥䘹ᤙㅖˈesp0 ᱟึḸḸվᤷ䪸DŽഐ ⇿њԫ࣑ᴹަ㠚ᐡⲴ޵ṨᘱึḸˈ⭘Ҿԫ࣑൘޵Ṩԓ⸱ѝᢗ㹼ᵏ䰤DŽަᡰ൘㓯ᙗൠ൰ѝⲴս㖞⭡䈕 ൞޻Ṯᘷ䘆㺂ᰬ ഴ 䙱䗇グ䰪ѣⲺ⭞ᡭᘷ฼Ḿ  ֌䘋〻࠶䝽ᯠⲴ޵ᆈ亥䶒DŽ㘼䘋〻 0 ઼䘋〻 1 Ⲵ⭘ᡧึḸ∄䖳⢩↺ˈ㿱ਾ䶒䈤᰾DŽ ⢙⨶޵ᆈ亥䶒DŽਚᴹᖃަѝањ䘋〻ᢗ㹼ึḸ߉᫽֌˄ֻྲ push ᫽֌˅ᰦ޵Ṩ޵ᆈ㇑⨶〻ᒿ᡽ՊѪ߉᫽ ӛ਼аึḸሩᓄⲴޡon Write˅ˈഐ↔൘䘋〻㻛ࡋᔪਾˈ㤕䈕䘋〻৺ަ⡦䘋〻䜭⋑ᴹ֯⭘ึḸˈࡉє㘵 ⭘䘉њึḸDŽึḸᇎ䱵֯⭘Ⲵ⢙⨶޵ᆈࡉ⭡ CPU ࠶亥ᵪࡦ⺞ᇊDŽ⭡Ҿ Linux ᇎ⧠Ҷ߉ᰦ༽ࡦ࣏㜭˄Copy 〻ᒿⲴ৲ᮠ઼⧟ຳਈ䟿ˈ❦ਾ᡽ᱟ⭘ᡧึḸオ䰤ˈ㿱മ 5-24 ᡰ⽪DŽᓄ⭘〻ᒿ൘⭘ᡧᘱл䘀㹼ᰦቡаⴤ֯ Ⲵ⭘ᡧᘱึḸᤷ䪸㻛䇮㖞൘ަൠ൰オ䰤Ⲵ䶐䘁ᵛㄟ˄64MB 亦ㄟ˅䜘࠶DŽᇎ䱵кᵛㄟ䜘࠶䘈㾱वᤜᢗ㹼 ⇿њԫ࣑˄䲔Ҷԫ࣑ 0 ઼ԫ࣑ 1˅ᴹ㠚ᐡⲴ 64MB ൠ൰オ䰤DŽᖃањԫ࣑˄䘋〻˅ࡊ㻛ࡋᔪᰦˈᆳ ൞⭞ᡭᘷ䘆㺂ᰬ ൘⭘ᡧⲴ 64MB オ䰤޵ᔦըDŽ ᮠᦞ䟿ᴰཊн㜭䎵䗷˄4096 – ԫ࣑ᮠᦞ㔃ᶴඇ˅њᆇ㢲ˈབྷ㓖Ѫ 3K ᆇ㢲DŽ㘼ԫ࣑Ⲵ⭘ᡧᘱึḸতਟԕ ᆈⲴ؍ึḸDŽ䲔Ҷ༴Ҿн਼ CPU ⢩ᵳ㓗ѝˈ䘉єњึḸѻ䰤Ⲵѫ㾱४࡛൘Ҿԫ࣑Ⲵ޵ṨᘱึḸᖸሿˈᡰ ⇿њԫ࣑䜭ᴹєњึḸˈ࠶࡛⭘Ҿ⭘ᡧᘱ઼޵Ṩᘱ〻ᒿⲴᢗ㹼ˈᒦф࠶࡛〠Ѫ⭘ᡧᘱึḸ઼޵Ṩᘱ 5.8.2 ԱࣗⲺ฼Ḿ ḸⲴ䈖㓶᧿䘠㿱ਾ䶒䈤᰾DŽ Ҿԫ࣑ 0 ᡰ֯⭘ึޣᡀѪԫ࣑ 0 ਾˈӽ❦㔗㔝֯⭘к䘠޵Ṩ〻ᒿ㠚ᐡⲴึḸ֌Ѫԫ࣑ 0 Ⲵ⭘ᡧᘱึḸDŽ fork()㌫㔏䈳⭘ˈmain.c ѝⲴ init()ሶ൘ԫ࣑ 1 ѝᢗ㹼ˈᒦ֯⭘ԫ࣑ 1 ⲴึḸDŽ㘼 main()ᵜ䓛ࡉ൘㻛“࠷ᦒ” к䘠ึḸDŽ㘼൘ᢗ㹼䗷 move_to_user_mode()ѻਾˈmain.c Ⲵԓ⸱㻛Ā࠷ᦒāᡀԫ࣑ 0 ѝᢗ㹼DŽ䙊䗷ᢗ㹼 ൘ init/main.c 〻ᒿѝˈ൘ᢗ㹼 move_to_user_mode()ԓ⸱ᢺ᧗ࡦᵳ〫Ӕ㔉ԫ࣑ 0 ѻࡽˈ㌫㔏аⴤ֯⭘ ࡓခौᰬ(main.c)  LQX[ ㌫㔏ѝึḸⲴ֯⭘ᯩ⌅/   ᆇ㢲  亥޵ᆈ  HVS ึḸᓅ  HVS ึḸᤷ䪸  FXUUHQW 䘋〻ᤷ䪸 ޵ṨᘱึḸ ԫ࣑ᮠᦞ㔃ᶴ  Ҿ߉ᰦ༽ࡦ˄&RS\RQ:ULWH˅ᢰᵟⲴ䈤᰾䈧৲㿱ㅜ  ㄐ޵ᆈ㇑⨶ˈ 㢲DŽޣ Ā䘄എāࡠԫ࣑ 0 Ⲵԓ⸱ѝ㔗㔝ᢗ㹼ҶDŽ ḸDŽ䘉ṧˈ䙊䗷ᢗ㹼 IRET ᤷԔণਟึޕ֌ѪḸѝ৏ CS ⇥Ⲵ䘹ᤙㅖˈᢺлаᶑᤷԔⲴᤷ䪸֌Ѫ৏ EIP ঻ Ḹึޕ㖞ᡀ 0x17ˈণ䇮㖞ᡀ⭘ᡧᘱተ䜘㺘 LDT ѝⲴᮠᦞ⇥䘹ᤙㅖDŽ❦ਾᢺԫ࣑ 0 ԓ⸱⇥䘹ᤙㅖ 0x0f ঻ 㘼৏ ss ⇥䘹ᤙㅖ㻛䇮ˈ٬㻛䇮㖞ᡀӽ❦ᱟ user_stack ѝ৏ᶕⲴս㖞٬ њӪᐕ䇮㖞޵ᇩⲴึḸѝˈ৏ esp Ḹˈ❦ਾᢗ㹼 IRET ᤷԔণਟᇎ⧠ᢺ᧗ࡦᵳӾ⢩ᵳ㓗 0 Ⲵԓ⸱䖜〫ࡠ⢩ᵳ㓗 3 Ⲵԫ࣑ 0 ԓ⸱ѝDŽ൘䘉ึ ޕᖃࡽ༴Ҿ⢩ᵳ㓗 0 ⲴึḸѝˈ਼ᰦᢺԓ⸱ᤷ䪸ҏ঻ޕᯠึḸѝDŽഐ↔䘉䟼ݸᢺԫ࣑ 0 ⭘ᡧึḸᤷ䪸঻ ⮉൘؍ᵳ㓗Պਁ⭏ਈॆⲴ᧗ࡦᵳ䖜〫ᰦˈⴞⲴԓ⸱Պ֯⭘ᯠ⢩ᵳ㓗ⲴึḸˈ㘼৏⢩ᵳ㓗ԓ⸱ึḸᤷ䪸ሶ move_to_user_mode()ᰦˈ൘⁑ᤏ iret 䘄എѻࡽⲴึḸѝ䇮㖞Ⲵˈ৲㿱മ 5-21 ᡰ⽪DŽᡁԜ⸕䚃ˈᖃ䘋㹼⢩ ԫ࣑ 0 Ⲵ޵ṨᘱึḸᱟ൘ަӪᐕ䇮㖞Ⲵࡍ࿻ॆԫ࣑ᮠᦞ㔃ᶴѝᤷᇊⲴˈ㘼ᆳⲴ⭘ᡧᘱึḸᱟ൘ᢗ㹼 ਜ਼ᴹԫ࣑ 0 ⲴᮠᦞDŽ ࡦⲴึḸ亥䶒ѝн༽؍⺞ᤱĀᒢ߰āˈণԫ࣑ 0 ↔ᰦн㜭֯⭘ึḸˈԕ؍䴰㾱൘ԫ࣑ 1 ᇎ䱵ᔰ࿻֯⭘ѻࡽ ֌ѪึḸオ䰤֯⭘DŽਚᴹࡠ↔ᰦˈԫ࣑ 1 ᡽ᔰ࿻֯⭘㠚ᐡ⤜・Ⲵ⭘ᡧึḸ޵ᆈ亥䶒DŽഐ↔ԫ࣑ 0 ⲴึḸ ൘ᢗ㹼ึḸ᫽֌ᰦሶՊᕅ䎧߉亥䶒ᔲᑨˈӾ㘼޵ṨՊ֯⭘߉ᰦ༽ࡦᵪࡦ2Ѫԫ࣑ 1 ਖ㹼࠶䝽ѫ޵ᆈ४亥䶒 オ䰤DŽնᱟᖃԫ࣑ 1 ᔰ࿻䘀㹼ᰦˈ⭡Ҿԫ࣑ 1 ᱐ሴࡠ user_stack[]༴Ⲵ亥㺘亩㻛䇮㖞ᡀਚ䈫ˈ֯ᗇԫ࣑ 1 ӛ֯⭘਼ањ⭘ᡧึḸޡ ⭡Ҿԫ࣑ 1 ൘ࡋᔪᰦ༽ࡦҶԫ࣑ 0 Ⲵ⭘ᡧึḸˈഐ↔ࡊᔰ࿻ᰦԫ࣑ 0 ઼ԫ࣑ 1 ᣔ⁑ᔿਾᡰ֯⭘ⲴึḸˈণ sched.c Ⲵ user_stack[]ᮠ㓴Ⲵս㖞DŽ؍ޕ㘼ԫ࣑ 0 Ⲵ⭘ᡧᘱึḸቡᱟࡽ䶒䘋 move_to_user_mode()ѻਾˈԫ࣑ 0 ઼ԫ࣑ 1 Ⲵ޵ṨᘱึḸ࠶࡛սҾ਴㠚ԫ࣑ᮠᦞ㔃ᶴᡰ൘亥䶒Ⲵᵛㄟˈ 0--640KB 㤳തѝDŽ䘉њൠ൰㤳തҏቡᱟ޵Ṩԓ⸱઼สᵜᮠᦞᡰᆈ᭮ⲴൠᯩDŽ൘ᢗ㹼Ҷ 䜭᱐ሴࡠ⢙⨶ൠ൰ޘⲴ⇥สൠ൰Ӿ㓯ᙗൠ൰ 0 ᔰ࿻ˈ㘼ԫ࣑ 1 Ⲵ⇥สൠ൰Ӿ 64MB ᔰ࿻DŽնᱟᆳԜ ઼ԫ࣑ 1 Ⲵԓ⸱⇥઼ᮠᦞ⇥⴨਼ˈ䲀䮯ҏ䜭ᱟ 640KBˈնᆳԜ㻛᱐ሴࡠн਼Ⲵ㓯ᙗൠ൰㤳തѝDŽԫ࣑ 0 ԫ࣑ 0˄オ䰢䘋〻 idle˅઼ԫ࣑ 1˄ࡍ࿻ॆ䘋〻 init˅ⲴึḸ∄䖳⢩↺ˈ䴰㾱⢩࡛Ҹԕ䈤᰾DŽԫ࣑ 0 Աࣗ 0 ૂԱࣗ 1 Ⲻ฼Ḿ ޵Ṩᘱᢗ㹼ᰦˈަ޵ṨᘱึḸᙫᱟオⲴDŽޕ䘉єњ٬ᱟਚ䈫ⲴDŽഐ↔⇿ᖃањԫ࣑䘋 ᆈDŽሩ CPU ᶕ䇢ˈ؍tss.ss0 ઼ tss.esp0 䘉єњ٬ᶴᡀDŽ൘ԫ࣑࠷ᦒᰦˈ㘱ԫ࣑Ⲵ޵ṨḸᤷ䪸 esp0 нՊ㻛 ⇿ᖃԫ࣑ᢗ㹼޵Ṩ〻ᒿ㘼䴰㾱֯⭘ަ޵ṨḸᰦˈCPU ቡՊ࡙⭘ TSS 㔃ᶴᢺᆳⲴ޵ṨᘱึḸ䇮㖞ᡀ⭡ 㹼ᔰ࿻Ⲵ⌘䟺˅DŽഐ↔ˈ޵Ṩԓ⸱ਟԕራ൰ࡠᮤњ⢙⨶޵ᆈ㤳തѝⲴԫօս㖞ˈᖃ❦ҏवᤜѫ޵ᆈ४DŽ 䮯ᓖ䜭㻛䇮㖞ᡀҶ 16MBDŽ䘉њ䮯ᓖ٬ᱟ Linux 0.11 ޵Ṩᡰ㜭᭟ᤱⲴᴰབྷ⢙⨶޵ᆈ䮯ᓖ˄৲㿱 head.sˈ110 Ӿ޵Ṩԓ⸱⇥Ⲵ䮯ᓖ㤳തᶕ䈤᰾DŽ൘ head.s 〻ᒿⲴᵛㄟˈ࠶࡛䇮㖞Ҷ޵Ṩԓ⸱⇥઼ᮠᦞ⇥Ⲵ᧿䘠ㅖˈ⇥ ઒ˈҏণ tss.ss0 ѪӰѸ㜭㻛䇮㖞ᡀ 0x10 ઒˛䘉ᱟഐѪ⭘ᡧ޵ṨᘱḸӽ❦኎Ҿ޵Ṩᮠᦞオ䰤DŽᡁԜਟԕ ᆈԫ࣑ᮠᦞ㔃ᶴⲴа亥޵ᆈҏ㜭㻛䇮㖞ᡀ޵Ṩᮠᦞ⇥ѝⲴᮠᦞ؍ѪӰѸӾѫ޵ᆈ४⭣䈧ᗇᶕⲴ⭘Ҿ ഴ 䘑ぁⲺ޻Ṯᘷ฼Ḿ⽰ᝅഴ   LQX[ ㌫㔏ѝึḸⲴ֯⭘ᯩ⌅/ ,17 ,5(7   ޵ṨᘱึḸ ⭘ᡧᘱึḸ (,3  &6 ()/$*6 ৏ (63  ৏66 ᯩੁޕ঻ var/ ⭘Ҿᆈ᭮㌫㔏䘀㹼ᰦਟਈⲴᮠᦞᡆ㘵ᱟᰕᘇㅹؑ᚟DŽ usr/bin ᆈ᭮⭘ᡧᑨ⭘ⲴᲞ䙊ભԔ˗ usr/ ᆈ᭮ᓃ࠭ᮠǃ᡻޼઼ަԆаӋ᮷Ԧ˗ bin/ ᆈ᭮㌫㔏ᢗ㹼〻ᒿDŽֻྲ shǃmkfsǃfdisk ㅹ˗ dev/ ਜ਼ᴹ䇮༷⢩↺᮷Ԧˈ⭘Ҿ֯⭘᮷Ԧ᫽֌䈝ਕ᫽֌䇮༷˗ etc/ ⴞᖅѫ㾱ਜ਼ᴹаӋ㌫㔏䝽㖞᮷Ԧ˗ ઼᮷Ԧ˖ ᮷Ԧǃ䇮༷傡ࣘ〻ᒿǃᔰਁ〻ᒿԕ৺ᡰᴹަԆ⭘ᡧᮠᦞᡆ᮷ᵜ᮷ԦㅹDŽަѝа㡜䜭वᤜԕлаӋᆀⴞᖅ Ԧ઼ભԔᢗ㹼〻ᒿDŽሩҾ Linux ㌫㔏ѝ֯⭘Ⲵ UNIX ㊫᮷Ԧ㌫㔏ˈަѝѫ㾱वᤜаӋ㿴ᇊⲴⴞᖅǃ䝽㖞 ণ Linux ㌫㔏ᕅሬ੟ࣘᰦˈ唈䇔֯⭘Ⲵ᮷Ԧ㌫㔏ᱟṩ᮷Ԧ㌫㔏DŽަѝवᤜ᫽֌㌫㔏ᴰ䎧⸱ⲴаӋ䝽㖞᮷ ޵Ṩԓ⸱㤕㾱↓ᑨ䘀㹼ቡ䴰㾱᮷Ԧ㌫㔏Ⲵ᭟ᤱDŽ⭘Ҿੁ޵Ṩᨀ׋ᴰสᵜؑ᚟઼᭟ᤱⲴᱟṩ᮷Ԧ㌫㔏ˈ 5.9 Linux 0.11 䟽⭞ⲺᮽԬ㌱㔕 ᖃࡽ޵ṨᘱึḸˈ❦ਾᢗ㹼ѝᯝᴽ࣑䗷〻DŽޕ䘄എᤷ䪸 csǃeip ঻ ԫ࣑䘀㹼Ⲵ޵Ṩԓ⸱ᐢ㓿൘֯⭘޵ṨᘱึḸˈᒦфн⎹৺Ոݸ㓗࡛Ⲵਈॆˈᡰԕ CPU ӵᢺ eflags ઼ѝᯝ ྲ᷌ањԫ࣑↓൘޵Ṩᘱѝ䘀㹼ˈ䛓Ѹ㤕 CPU ૽ᓄѝᯝቡн޽䴰㾱䘋㹼ึḸ࠷ᦒ᫽֌ˈഐѪ↔ᰦ䈕 ഴ ޻Ṯᘷૂ⭞ᡭᘷ฼ḾⲺ࠽ᦘ  5-26 ᡰ⽪DŽ ᘱึḸѝDŽ㘼൘ᢗ㹼 iret 䘰ࠪ޵Ṩ〻ᒿ䘄എࡠ⭘ᡧ〻ᒿᰦˈሶᚒ༽⭘ᡧᘱⲴึḸ઼ eflagsDŽ䘉њ䗷〻㿱മ ᆈ൘ԫ࣑Ⲵ޵Ṩ؍ਁ⭏Ҷ᭩ਈ˄Ӿ⭘ᡧᘱ䖜ࡠ޵Ṩᘱ˅ˈ⭘ᡧᘱึḸⲴึḸ⇥઼ึḸᤷ䪸ԕ৺ eflags Պ㻛 ޵Ṩ〻ᒿᰦˈ⭡Ҿ⢩ᵳ㓗࡛ޕԓ⸱DŽ↔ᰦ޵Ṩԓ⸱ቡՊ֯⭘䈕ԫ࣑Ⲵ޵ṨᘱึḸ䘋㹼᫽֌DŽ਼ṧˈᖃ䘋 ޵Ṩᒦᢗ㹼޵ṨѝⲴѝᯝᴽ࣑ޕ޵ṨⲴ㌫㔏䈳⭘ᱟањ䖟Ԧѝᯝˈഐ↔ԫ࣑䈳⭘㌫㔏䈳⭘ᰦቡՊ䘋 ޵ṨᘱึḸDŽޕึḸˈ䲿ਾᢺḷᘇᇴᆈಘ eflags Ⲵ޵ᇩ઼䘄എս㖞 csǃeip ঻ ޵Ṩᘱޕѝ㧧ᗇDŽ൘ᇊսҶᯠึḸ˄޵ṨᘱึḸ˅ѻਾˈCPU ቡՊ俆ݸᢺ৏⭘ᡧᘱึḸᤷ䪸 ss ઼ esp ঻ ᴽ࣑〻ᒿ൘޵Ṩѝˈ኎Ҿ 0 㓗⢩ᵳ㓗ԓ⸱ˈᡰԕ 48 ∄⢩Ⲵ޵ṨᘱึḸᤷ䪸ՊӾ TSS Ⲵ ss0 ઼ esp0 ᆇ⇥ ٬DŽഐѪѝᯝ〫ٿᘱึḸⲴ࠷ᦒ᫽֌DŽCPU ՊӾᖃࡽԫ࣑Ⲵԫ࣑⣦ᘱ⇥ TSS ѝਆᗇᯠึḸⲴ⇥䘹ᤙㅖ઼ ѝᢗ㹼ˈ䛓Ѹ䈕ѝᯝቡՊᕅ䎧 CPU ⢩ᵳ㓗Ӿ 3 㓗ࡠ 0 㓗Ⲵਈॆˈ↔ᰦ CPU ቡՊ䘋㹼⭘ᡧᘱึḸࡠ޵Ṩ ൘ Linux 0.11 ㌫㔏ѝˈᡰᴹѝᯝᴽ࣑〻ᒿ䜭኎Ҿ޵Ṩԓ⸱DŽྲ᷌ањѝᯝӗ⭏ᰦԫ࣑↓൘⭘ᡧԓ⸱ 5.8.3 Աࣗ޻Ṯᘷ฼Ḿф⭞ᡭᘷ฼Ḿҁ䰪Ⲻ࠽ᦘ  LQX[ 䟷⭘Ⲵ᮷Ԧ㌫㔏/ ŽũWRROV   ⭏ᡀ޵Ṩ ,PDJH ᮷ԦⲴᐕާ〻ᒿ ƅũPP    ޵ᆈ㇑⨶〻ᒿ ƅũOLE    ޵Ṩᓃ࠭ᮠ ū ŽũPDWK  ᮠᆖॿ༴⨶ಘԯⵏ༴⨶〻ᒿ ū ƅũFKUBGUY  ᆇㅖ䇮༷傡ࣘ〻ᒿ ū ƅũEONBGUY  ඇ䇮༷傡ࣘ〻ᒿ ƅũNHUQHO   ޵Ṩ䘋〻䈳ᓖǃؑਧ༴⨶ǃ㌫㔏䈳⭘ㅹ〻ᒿ ƅũLQLW   ޵Ṩࡍ࿻ॆ〻ᒿ ū ŽũV\V  ㌫㔏ᮠᦞ㔃ᶴ䜘࠶ ū ƅũOLQX[  /LQX[ ޵Ṩу⭘䜘࠶ Ⲵ䜘࠶ޣū ƅũDVP  о &38 փ㌫㔃ᶴ⴨  K ƅũLQFOXGH   ཤ᮷Ԧ ƅũIV    ᮷Ԧ㌫㔏 ƅũERRW   ㌫㔏ᕅሬ≷㕆〻ᒿ OLQX[ linux ⴞᖅᱟⓀԓ⸱Ⲵѫⴞᖅˈ൘䈕ѫⴞᖅѝ䲔ҶवᤜᡰᴹⲴ 14 њᆀⴞᖅԕཆˈ䘈ਜ਼ᴹୟаⲴањ 5.10.1 ޻Ṯѱⴤᖋ linux Ⲵ޵ᇩ䘋㹼᧿䘠DŽ वᤜ 102 њԓ⸱᮷ԦDŽл䶒䙀њሩ䘉Ӌᆀⴞᖅѝޡ䈕޵Ṩ⡸ᵜⲴⓀԓ⸱ⴞᖅѝਜ਼ᴹ 14 њᆀⴞᖅˈᙫ ഴ /LQX[ ޻ṮⓆԙ⸷ⴤᖋ㔉ᶺ  㔃ᶴ㿱മ 5-27 ᡰ⽪˖ ᖃᡁԜ֯⭘ tar ભԔሶ linux-0.11.tar.gz 䀓ᔰᰦˈ޵ṨⓀԓ⸱᮷Ԧ㻛᭮ࡠҶ linux/ⴞᖅѝDŽަѝⲴⴞᖅ Ҿлаㄐᔰ࿻ⲴⓀԓ⸱䰵䈫ᐕ֌DŽ वਜ਼〻ᒿⲴѫ㾱࣏㜭ˈ֯ᗇᮤњ޵ṨⓀԓ⸱Ⲵᆹᧂᖒᔿ㜭൘ᡁԜⲴཤ㝁ѝᔪ・䎧ањབྷᾲⲴṶᷦˈԕׯ 䘉䟼ᡁԜ俆ݸࡇࠪ Linux ޵ṨᆼᮤⲴⓀԓ⸱ⴞᖅˈवᤜަѝⲴᆀⴞᖅDŽ❦ਾ䙀аӻ㓽਴њⴞᖅѝᡰ 㾱൘ᔰ࿻䰵䈫޵ṨⓀԓ⸱ѻࡽˈݸ⟏ᚹалⓀԓ⸱᮷ԦⲴⴞᖅ㔃ᶴ઼ᆹᧂDŽ Ⲵ᮷ԦDŽഐ↔ᴹᗵޣ㌫䶎ᑨᇶ࠷DŽᡰԕ൘䰵䈫ањⓀԓ⸱᮷Ԧᰦᖰᖰ䴰㾱৲䰵ަԆ⴨ޣ䰤Ⲵ׍䎆઼䈳⭘ ⭡Ҿ Linux ޵Ṩᱟа⿽অ޵Ṩ⁑ᔿⲴ㌫㔏ˈഐ↔ˈ޵ṨѝᡰᴹⲴ〻ᒿࠐѾ䜭ᴹ㍗ᇶⲴ㚄㌫ˈᆳԜѻ 5.10 Linux ޻ṮⓆԙ⸷Ⲻⴤᖋ㔉ᶺ 䈕ᤷᇊ⺜ⴈ࠶४ѝ࣐䖭ṩ᮷Ԧ㌫㔏DŽ 㺘⽪䴰㾱Ӿᕅሬⴈᡰ൘ᖃࡽ傡ࣘಘѝ࣐䖭ṩ᮷Ԧ㌫㔏DŽ㤕䈕䇮༷ਧᱟањ⺜ⴈ࠶४䇮༷ਧⲴ䈍ˈቡՊӾ ˄ROOT_DEV˅ѝⲴṩ᮷Ԧ㌫㔏䇮༷ਧӾᤷᇊⲴ䇮༷ѝ࣐䖭ṩ᮷Ԧ㌫㔏DŽྲ᷌䘉њ䇮༷ਧᱟ 0 Ⲵ䈍ˈࡉ ᖃ Linux ੟ࣘⴈ࣐䖭ṩ᮷Ԧ㌫㔏ᰦˈՊṩᦞ੟ࣘⴈкᕅሬᡷ४ㅜ 509ǃ510 ᆇ㢲༴ањᆇ ᕐਟ੟ࣘⲴ DOS ᫽֌㌫㔏ⴈDŽ ઼޵Ṩᢗ㹼ԓ⸱DŽrootimage ቡᱟ⭘Ҿੁ޵Ṩᨀ׋ᴰสᵜ᭟ᤱⲴṩ᮷Ԧ㌫㔏DŽ䘉єњⴈਸ䎧ᶕቡ⴨ᖃҾа rootimage ⴈDŽbootimage ᱟᕅሬ੟ࣘ Image ᮷Ԧˈަѝѫ㾱वᤜ⻱ⴈᕅሬᡷ४ԓ⸱ǃ᫽֌㌫㔏࣐䖭〻ᒿ ሩҾㅜ 1 ㄐѝӻ㓽Ⲵ൘䖟ⴈк䘀㹼Ⲵ Linux 0.11 ㌫㔏ˈᆳ⭡ㆰঅⲴ 2 ᕐ䖟ⴈ㓴ᡀ˖bootimage ⴈ઼ ⌋Ⲵࡉᱟ ext2 ᡆ ext3 ᮷Ԧ㌫㔏DŽ ㅹ᮷Ԧ㌫㔏DŽ㘼 Linux 0.11 ޵Ṩᡰ᭟ᤱⲴ᮷Ԧ㌫㔏ᱟ MINIX 1.0 ᮷Ԧ㌫㔏DŽⴞࡽ Linux ㌫㔏к֯⭘ᴰᒯ ቡᱟ᮷Ԧ㌫㔏䇮༷ˈ㘼⺜ⴈк᤹аᇊ㿴ࡉᆈ᭮Ⲵ᮷Ԧቡ㓴ᡀ᮷Ԧ㌫㔏ˈWindows2000 ᴹ NTFS ᡆ FAT32 ᆈ᭮᮷Ԧ㌫㔏Ⲵ䇮༷ቡᱟ᮷Ԧ㌫㔏䇮༷DŽ∄ྲˈሩҾа㡜֯⭘Ⲵ Windows2000 ᫽֌㌫㔏ˈ⺜ⴈ C ⴈ  LQX[ ޵ṨⓀԓ⸱Ⲵⴞᖅ㔃ᶴ/ ㌫DŽޣ㌫ˈ㋇㓯ᶑ㺘⽪ᴹ⴨ӂᕅ⭘ޣ㲊ṶѝᱟⲴ〻ᒿ᮷Ԧн኎Ҿ᮷Ԧ㌫㔏ˈᑖ㇝ཤⲴ㓯ᶑ㺘⽪ᕅ⭘ ㌫᭮㖞DŽަѝ਴᮷Ԧ਽൷⮕৫Ҷਾ㔰.cˈޣ5-28 ᡰ⽪DŽമѝ⇿њᯩṶԓ㺘ањ᮷ԦˈӾкࡠл᤹สᵜᕅ⭘ ㌫㿱മޣवਜ਼ 17 њ C 䈝䀰〻ᒿDŽ䘉Ӌ〻ᒿѻ䰤Ⲵѫ㾱ᕅ⭘ޡˈ fs/ⴞᖅᱟ᮷Ԧ㌫㔏ᇎ⧠〻ᒿⲴⴞᖅ ѫࣘⶑⵐ˄䈳⭘ sleep()˅ˈቡн䇙޵Ṩ࠷ᦒԫ࣑DŽ ㄎҹᶑԦⲴਁ⭏ˈLinux ㌫㔏ሩ䍴Ⓚ࠶䝽䘋㹼ҶѕṬൠỰḕˈᒦф൘޵Ṩ⁑ᔿл䘀㹼ᰦˈྲ᷌ԫ࣑⋑ᴹ ཊ㓯〻ᑖᶕⲴㄎҹᶑԦǃ↫䬱ㅹ䰞仈ˈഐ↔ Linux ᮷Ԧ㌫㔏ԓ⸱㾱∄ MINIX ㌫㔏Ⲵ༽ᵲᗇཊDŽѪҶ䚯ݽ অ㓯〻༴⨶ᯩᔿˈ㘼 Linux ࡉ䟷⭘Ҷཊ㓯〻ᯩᔿDŽ⭡Ҿ䟷⭘Ҷཊ㓯〻༴⨶ᯩᔿˈLinux 〻ᒿቡᗵ享༴⨶ MINIX ᮷Ԧ㌫㔏ˈն Linux ሩަ༴⨶ᯩᔿо MINIX ㌫㔏н਼DŽѫ㾱Ⲵ४࡛൘Ҿ MINIX ሩ᮷Ԧ㌫㔏䟷⭘ ਁⲴˈ䟷⭘ MINIX ᮷Ԧ㌫㔏ׯҾ䘋㹼Ӕ৹㕆䈁ˈᒦфਟԕӾ MINIX ѝ࣐䖭 Linux ࠶४DŽ㲭❦֯⭘Ⲵᱟ Linux 0.11 ޵ṨⲴ᮷Ԧ㌫㔏䟷⭘Ҷ 1.0 ⡸Ⲵ MINIX ᮷Ԧ㌫㔏ˈ䘉ᱟ⭡Ҿ Linux ᱟ൘ MINIX ㌫㔏кᔰ 5.10.3 ᮽԬ㌱㔕ⴤᖋ fs Ⲵࡍ࿻䇮㖞ᐕ֌DŽ head.s 〻ᒿՊ㻛㕆䈁䘎᧕൘ system ⁑ඇⲴᴰࡽ䜘࠶ˈѫ㾱䘋㹼⺜Ԧ䇮༷Ⲵ᧒⍻䇮㖞઼޵ᆈ㇑⨶亥䶒 setup.s 〻ᒿѫ㾱⭘Ҿ䈫ਆᵪಘⲴ⺜Ԧ䝽㖞৲ᮠˈᒦᢺ޵Ṩ⁑ඇ system 〫ࣘࡠ䘲ᖃⲴ޵ᆈս㖞༴DŽ 0 ⻱ཤˈㅜ 1 њᡷ४˅DŽ൘ PC ᵪ࣐⭥ ROM BIOS 㠚Ựਾˈሶ㻛 BIOS ࣐䖭ࡠ޵ᆈ 0x7C00 ༴䘋㹼ᢗ㹼DŽ bootsect.s 〻ᒿᱟ⻱ⴈᕅሬඇ〻ᒿˈ㕆䈁ਾՊ傫⮉൘⻱ⴈⲴㅜањᡷ४ѝ˄ᕅሬᡷ४ˈ0 ⻱䚃˄ḡ䶒˅ˈ 䈝䀰൘лаㄐⲴԓ⸱⌘䟺䟼ԕ৺ԓ⸱ࡇ㺘ਾ䶒Ⲵ䈤᰾ѝՊᴹㆰঅⲴӻ㓽DŽ Ṭᔿ˄оᗞ䖟Ⲵ㊫լ˅ˈ㘼 head.s 䴰㾱⭘ GNU as ᶕ㕆䈁ˈ֯⭘Ⲵᱟ AT&T ṬᔿⲴ≷㕆䈝䀰DŽ䘉є⿽≷㕆 Ⲵ㌫㔏ࡍ࿻ॆᐕ֌DŽަѝ bootsect.s ઼ setup.s 〻ᒿ䴰㾱֯⭘ as86 䖟Ԧᶕ㕆䈁ˈ֯⭘Ⲵᱟ as86 Ⲵ≷㕆䈝䀰 ᣔ䘀㹼ᯩᔿࡽ؍ս 32 ޕаӋ䘋ڊ㾱࣏㜭ᱟᖃ䇑㇇ᵪ࣐⭥ᰦᕅሬ޵Ṩ੟ࣘˈሶ޵Ṩԓ⸱࣐䖭ࡠ޵ᆈѝˈᒦ boot ⴞᖅѝਜ਼ᴹ 3 њ≷㕆䈝䀰᮷Ԧˈᱟ޵ṨⓀԓ⸱᮷Ԧѝᴰݸ㻛㕆䈁Ⲵ〻ᒿDŽ䘉 3 њ〻ᒿᆼᡀⲴѫ 5.10.2 ᕋሲ੥ࣞぁᓅⴤᖋ boot ᴹⲴⓀԓ⸱᮷Ԧˈਚ㾱൘ linux ⴞᖅл䘀㹼а⅑ make 䖟ԦণਟDŽ ⴞᖅ˄वᤜᆀⴞᖅ˅лⲴԫօ᮷Ԧ㻛؞᭩䗷ᰦˈmake 䜭Պሩަ䘋㹼䟽ᯠ㕆䈁DŽഐ↔ѪҶ㕆䈁ᮤњ޵Ṩᡰ linux ⴞᖅлⲴ䘉њ Makefile ᮷Ԧ䘈፼྇ൠ䈳⭘Ҷᡰᴹᆀⴞᖅѝवਜ਼Ⲵ Makefile ᮷Ԧˈ䘉ṧˈᖃ linux 㕆䈁DŽഐ↔ˈmake ᐕާ䖟Ԧᱟ〻ᒿ亩ⴞⲴ㇑⨶䖟ԦDŽ ࡛ଚӋ᮷Ԧᐢ㻛؞᭩䗷ˈӾ㘼㠚ࣘൠߣᇊ൘ањਜ਼ᴹཊњⓀ〻ᒿ᮷ԦⲴ〻ᒿ㌫㔏ѝଚӋ᮷Ԧ䴰㾱㻛䟽ᯠ Makefile ᮷ԦDŽ䈕᮷Ԧᱟ㕆䈁䖵ࣙᐕާ䖟Ԧ make Ⲵ৲ᮠ䝽㖞᮷ԦDŽmake ᐕާ䖟ԦⲴѫ㾱⭘䙄ᱟ䙊䗷䇶  LQX[ ޵ṨⓀԓ⸱Ⲵⴞᖅ㔃ᶴ/ IFQWO VWDW ILOHBWDEOH LRFWO OOBUZBEORFN RSHQ QDPHL WUXQFDWH H[HF VXSHU LQRGH ILOHBGHYSLSH EXIIHU ELWPDS EORFNBGHYFKDUBGHY UHDGBZULWH 儈䙏㕃ߢ㇑⨶ վቲ᫽֌࠭ᮠ 儈ቲ䇯䰞᧗ࡦ࠭ᮠ ᮠᦞ䇯䰞 ㌫DŽޣ൘ሩ〻ᒿ䘋㹼⌘䟺䗷〻ѝˈᡁԜሶਖཆ㔉ࠪ䘉Ӌ᮷Ԧѝ਴њѫ㾱࠭ᮠѻ䰤Ⲵ䈳⭘ቲ⅑ ˄ll_rw_block()˅ᶕ᫽֌ᶕ䘋㹼ˈ᮷Ԧ㌫㔏〻ᒿ䳶ᵜ䓛ᒦнⴤ᧕оඇ䇮༷Ⲵ傡ࣘ〻ᒿᢃӔ䚃DŽ ᡁԜ␵ᾊⲴⴻࡠˈ᮷Ԧ㌫㔏ሩҾඇ䇮༷ѝᮠᦞⲴ䈫߉ˈ䜭䴰㾱䙊䗷儈䙏㕃ߢ४оඇ䇮༷Ⲵ傡ࣘ〻ᒿ ࠭ᮠˈᆳᒦн൘ fs ⴞᖅѝˈ㘼ᱟ kernel/blk_drv/ll_rw_block.c ѝⲴඇ䇮༷䈫߉傡ࣘ࠭ᮠDŽ᭮൘䘉䟼ਚᱟ䇙 ༴⨶࠭ᮠDŽbuffer.c 〻ᒿѫ㾱⭘Ҿሩ޵ᆈ儈䙏㕃ߢ४䘋㹼༴⨶DŽ㲊ṶѝⲴ ll_rw_block ᱟඇ䇮༷Ⲵᓅቲ䈫 bitmap.c 〻ᒿ⭘Ҿ༴⨶᮷Ԧ㌫㔏ѝ i 㢲⛩઼䙫䗁ᮠᦞඇⲴսമDŽsuper.c 〻ᒿѝवਜ਼ሩ᮷Ԧ㌫㔏䎵㓗ඇⲴ ਜ਼䪸ሩ᮷Ԧ㌫㔏 i 㢲⛩᫽֌Ⲵ࠭ᮠDŽtruncate.c 〻ᒿ⭘Ҿ൘ࡐ䲔᮷Ԧᰦ䟺᭮᮷Ԧᡰঐ⭘Ⲵ䇮༷ᮠᦞオ䰤DŽ ⴞᖅ਽઼᮷Ԧ਽Ⲵ᫽֌࠭ᮠ઼㌫㔏䈳⭘࠭ᮠDŽblock_dev.c 〻ᒿवਜ਼ඇᮠᦞ䈫઼߉࠭ᮠDŽinode.c 〻ᒿѝव 䈳⭘DŽfile_dev.c 〻ᒿѝवਜ਼สҾ i 㢲⛩઼᧿䘠ㅖ㔃ᶴⲴ᮷Ԧ䈫߉࠭ᮠDŽnamei.c 〻ᒿѫ㾱वᤜ᮷Ԧ㌫㔏ѝ char_dev.c ѫ㾱वਜ਼ᆇㅖ䇮༷䈫߉࠭ᮠ rw_char()DŽpipe.c 〻ᒿѝवਜ਼㇑䚃䈫߉࠭ᮠ઼ࡋᔪ㇑䚃Ⲵ㌫㔏 䰝᮷ԦⲴ㌫㔏䈳⭘࠭ᮠDŽޣ㌫㔏䈳⭘࠭ᮠDŽopen.c 〻ᒿѫ㾱वਜ਼ᇎ⧠؞᭩᮷Ԧ኎ᙗ઼ࡋᔪо read_write.c 〻ᒿ⭘Ҿᇎ⧠᮷Ԧ䈫/߉઼ᇊսйњ㌫㔏䈳⭘࠭ᮠDŽstat.c 〻ᒿѝᇎ⧠Ҷєњ㧧ਆ᮷Ԧ⣦ᘱⲴ do_execve()ˈᆳᱟᡰᴹ exec()࠭ᮠ㈷ѝⲴѫ㾱࠭ᮠDŽfcntl.c 〻ᒿ⭘Ҿᇎ⧠᮷Ԧ i/o ᧗ࡦⲴ㌫㔏䈳⭘࠭ᮠDŽ kernel/chr_drv/tty.c ѝⲴ࠭ᮠˈᇎ⧠ᆇㅖ䇮༷Ⲵ io ᧗ࡦ࣏㜭DŽexec.c 〻ᒿѫ㾱वਜ਼ањᢗ㹼〻ᒿ࠭ᮠ ൘ file_table.c ᮷ԦѝˈⴞࡽӵᇊѹҶањ᮷Ԧਕᷴ˄᧿䘠ㅖ˅㔃ᶴᮠ㓴DŽioctl.c ᮷Ԧሶᕅ⭘ ༷кⲴ᮷Ԧ㌫㔏DŽ㇑⨶儈䙏㕃ߢ४Ⲵ〻ᒿᱟ buffer.cˈ㘼ަԆ〻ᒿࡉѫ㾱䜭ᱟ⭘Ҿ᮷Ԧ㌫㔏㇑⨶DŽ 䜭䴰㾱俆ݸ䈫ਆࡠ儈䙏㕃ߢ४ѝDŽᵜⴞᖅѝⲴ〻ᒿѫ㾱⭘ᶕ㇑⨶儈䙏㕃ߢ४ѝ㕃ߢඇⲴ֯⭘࠶䝽઼ඇ䇮 ሩҾ᮷Ԧ㌫㔏ˈᡁԜਟԕሶᆳⴻᡀᱟ޵ᆈ儈䙏㕃ߢ४Ⲵᢙኅ䜘࠶DŽᡰᴹሩ᮷Ԧ㌫㔏ѝᮠᦞⲴ䇯䰞ˈ 䇯䰞઼᮷Ԧ儈ቲ࠭ᮠˈ൘ሩᵜⴞᖅѝ᮷Ԧ䘋㹼⌘䟺䈤᰾ᰦˈᡁԜҏሶ࠶ᡀ䘉ഋњ䜘࠶ᶕ᧿䘠DŽ ⭡മਟԕⴻࠪˈ䈕ⴞᖅѝⲴ〻ᒿਟԕࡂ࠶ᡀഋњ䜘࠶˖儈䙏㕃ߢ४㇑⨶ǃվቲ᮷Ԧ᫽֌ǃ᮷Ԧᮠᦞ ഴ IV ⴤᖋѣ਺ぁᓅѣ࠳ᮦҁ䰪Ⲻᕋ⭞ީ㌱Ⱦ   LQX[ ޵ṨⓀԓ⸱Ⲵⴞᖅ㔃ᶴ/ ᑨᮠㅖਧDŽޣ ㅹᖵ䈳⭘ཤ᮷ԦDŽᇊѹ㌫㔏䈳⭘ wait()Ṩ waitpid()৺⴨ ㌫㔏਽〠㔃ᶴཤ᮷ԦDŽ ㊫රཤ᮷ԦDŽᇊѹҶสᵜⲴ㌫㔏ᮠᦞ㊫රDŽ ᇊѹҶ䘋〻ѝ䘀㹼ᰦ䰤㔃ᶴ tms ԕ৺ times()࠭ᮠ৏රDŽ ᮷Ԧ⣦ᘱཤ᮷ԦDŽਜ਼ᴹ᮷Ԧᡆ᮷Ԧ㌫㔏⣦ᘱ㔃ᶴ stat{}઼ᑨ䟿DŽ ㌱㔕щ⭞ᮦᦤ㔉ᶺᆆⴤᖋ include/sys tty_ioˈѢ㹼䙊ؑᯩ䶒Ⲵ৲ᮠǃᑨᮠDŽ ޣ tty ཤ᮷ԦˈᇊѹҶᴹ ㌫㔏䈳⭘ཤ᮷ԦDŽਜ਼ᴹ 72 њ㌫㔏䈳⭘ C ࠭ᮠ༴⨶〻ᒿ,ԕ'sys_'ᔰཤDŽ ᔿ≷㕆࠭ᮠᆿ䈝ਕDŽޕ䘠ㅖ৲ᮠ䇮㖞઼㧧ਆⲴ፼᧿ޣ 䘈ᴹаӋᴹ 䈳ᓖ〻ᒿཤ᮷ԦˈᇊѹҶԫ࣑㔃ᶴ task_structǃࡍ࿻ԫ࣑ 0 Ⲵᮠᦞˈ ޵ᆈ㇑⨶ཤ᮷ԦDŽਜ਼ᴹ亥䶒བྷሿᇊѹ઼аӋ亥䶒䟺᭮࠭ᮠ৏රDŽ ޵Ṩཤ᮷ԦDŽਜ਼ᴹаӋ޵Ṩᑨ⭘࠭ᮠⲴ৏ᖒᇊѹDŽ head ཤ᮷ԦˈᇊѹҶ⇥᧿䘠ㅖⲴㆰঅ㔃ᶴˈ઼ࠐњ䘹ᤙㅖᑨ䟿DŽ ⺜ⴈ৲ᮠཤ᮷ԦDŽᇊѹ䇯䰞⺜ⴈᇴᆈಘㄟਓˈ⣦ᘱ⸱ˈ࠶४㺘ㅹؑ᚟DŽ ᮷Ԧ㌫㔏ཤ᮷ԦDŽᇊѹ᮷Ԧ㺘㔃ᶴ˄file,buffer_head,m_inode ㅹ˅DŽ 䖟傡ཤ᮷ԦDŽਜ਼ᴹ䖟ⴈ᧗ࡦಘ৲ᮠⲴаӋᇊѹDŽ ޵Ṩ䝽㖞ཤ᮷ԦDŽᇊѹ䭞ⴈ䈝䀰઼⺜ⴈ㊫ර˄HD_TYPE˅ਟ䘹亩DŽ Linux ޻Ṯщ⭞ཪᮽԬᆆⴤᖋ include/linux ᔿ≷㕆ᆿDŽޕ ㌫㔏ཤ᮷ԦDŽᇊѹҶ䇮㖞ᡆ؞᭩᧿䘠ㅖ/ѝᯝ䰘ㅹⲴ፼ ᔿ≷㕆࠭ᮠDŽޕᇴᆈಘ᫽֌Ⲵ፼⇥ޣ ⇥᫽֌ཤ᮷ԦDŽᇊѹҶᴹ ᔿ≷㕆ᆿ࠭ᮠDŽޕ ޵ᆈᤧ䍍ཤ᮷ԦDŽਜ਼ᴹ memcpy()፼ 㕆〻ᒿᖒᔿᇊѹሩ io ㄟਓ᫽֌Ⲵ࠭ᮠDŽ≶ޕ io ཤ᮷ԦDŽԕᆿⲴ፼ њ᮷ԦDŽ 4 ޡⲴᮠᦞ㔃ᶴǃᆿ࠭ᮠ઼ਈ䟿DŽޣ䘉Ӌཤ᮷Ԧѫ㾱ᇊѹҶаӋо CPU փ㌫㔃ᶴᇶ࠷⴨ ։㌱㔉ᶺ⴮ީཪᮽԬᆆⴤᖋ include/asm ⭘ᡧᰦ䰤ཤ᮷ԦDŽᇊѹҶ䇯䰞઼؞᭩ᰦ䰤㔃ᶴԕ৺ utime()৏රDŽ __LIBRARY__ˈࡉ䘈वᤜ㌫㔏䈳⭘ਧ઼޵፼≷㕆_syscall0()ㅹDŽ Linux ḷ߶ཤ᮷ԦDŽᇊѹҶ਴⿽ㅖਧᑨᮠ઼㊫රˈᒦ༠᰾Ҷ਴⿽࠭ᮠDŽྲᇊѹҶ ᰦ䰤Ⲵ࠭ᮠ৏ᖒDŽޣ ᰦ䰤㊫රཤ᮷ԦDŽަѝᴰѫ㾱ᇊѹҶ tm 㔃ᶴ઼аӋᴹ 䗃ࠪ࠭ᮠཤ᮷ԦDŽѫ㾱ᇊѹ᧗ࡦᔲ↕䙊ؑਓⲴ㓸ㄟ᧕ਓDŽޕ 㓸ㄟ䗃 ࠭ᮠDŽޕᆇㅖѢ᫽֌Ⲵ፼ޣ ᆇㅖѢཤ᮷ԦDŽѫ㾱ᇊѹҶаӋᴹ ḷ߶ᇊѹཤ᮷ԦDŽᇊѹҶ NULL, offsetof(TYPE, MEMBER)DŽ њᆿ˄va_start, va_arg ઼ va_end˅ˈ⭘Ҿ vsprintfǃvprintfǃvfprintf ࠭ᮠDŽ ḷ߶৲ᮠཤ᮷ԦDŽԕᆿⲴᖒᔿᇊѹਈ䟿৲ᮠࡇ㺘DŽѫ㾱䈤᰾Ҷ-њ㊫ර˄va_list˅઼й ؑਧཤ᮷ԦDŽᇊѹؑਧㅖਧᑨ䟿ˈؑਧ㔃ᶴԕ৺ؑਧ᫽֌࠭ᮠ৏රDŽ ᮷Ԧ᧗ࡦཤ᮷ԦDŽ⭘Ҿ᮷Ԧ৺ަ᧿䘠ㅖⲴ᫽֌᧗ࡦᑨᮠㅖਧⲴᇊѹDŽ 䭉䈟ਧཤ᮷ԦDŽवਜ਼㌫㔏ѝ਴⿽ࠪ䭉ਧDŽ(Linus Ӿ minix ѝᕅ䘋Ⲵ)DŽ ᆇㅖ㊫රࡔᯝ઼䖜ᦒⲴᆿDŽޣ ᆇㅖ㊫රཤ᮷ԦDŽᇊѹҶаӋᴹ ᑨᮠㅖਧཤ᮷ԦˈⴞࡽӵᇊѹҶ i 㢲⛩ѝ i_mode ᆇ⇥Ⲵ਴ḷᘇսDŽ a.out ཤ᮷ԦˈᇊѹҶ a.out ᢗ㹼᮷ԦṬᔿ઼аӋᆿDŽ ሩཤ᮷ԦⲴ⌘䟺аㄐDŽ ᴹ 10 њˈsys ᆀⴞᖅѝᴹ 5 њDŽ䘉Ӌཤ᮷Ԧ਴㠚Ⲵ࣏㜭㿱ྲлㆰ䘠ˈާփⲴ֌⭘઼ᡰवਜ਼Ⲵؑ᚟䈧৲㿱 ᴹ 32 њ.h ཤ᮷ԦDŽަѝѫⴞᖅлᴹ 13 њˈasm ᆀⴞᖅѝᴹ 4 њˈlinux ᆀⴞᖅѝޡཤ᮷Ԧⴞᖅѝᙫ 5.10.4 ཪᮽԬѱⴤᖋ include  LQX[ ޵ṨⓀԓ⸱Ⲵⴞᖅ㔃ᶴ/ 䙊⭘〻ᒿ ⺜Ԧѝᯝ〻ᒿ ㌫㔏䈳⭘〻ᒿ PDNWLPHF SULQWNF YVSULQWIF VFKHGF SDQLFF IRUNF V\VF VLJQDOF H[LWF V\VWHPBFDOOV WUDSVF DVPV ਧ༴⨶Ⲵ4њ㌫㔏䈳⭘ԕ৺ањ൘ሩᓄⲴѝᯝ༴⨶〻ᒿѝ༴⨶ؑਧⲴ࠭ؑޣ signal.c〻ᒿѝवᤜҶᴹ Ⲵ䖟ⴈ᫽֌࠭ᮠDŽޣᮠDŽਖཆ䘈ᴹࠐњоᇊᰦ⴨ 䈳ᓖⲴสᵜ࠭ᮠ(sleep_onǃwakeupǃschedule ㅹ)ԕ৺аӋㆰঅⲴ㌫㔏䈳⭘࠭ޣ sched.c 〻ᒿѝवᤜᴹ printk.c 〻ᒿवਜ਼ањ޵Ṩу⭘ؑ᚟ᱮ⽪࠭ᮠ printk()DŽ ᵪⲴ࠭ᮠ panic()DŽڌ panic.c 〻ᒿवਜ਼ањᱮ⽪޵Ṩࠪ䭉ؑ᚟ᒦ ᰕⲴ。ᮠˈ֌Ѫᔰᵪ。ᰦ䰤DŽӵ൘ init/main.c ѝ㻛䈳⭘а⅑DŽ mktime.c 〻ᒿवਜ਼ањ޵Ṩ֯⭘Ⲵᰦ䰤࠭ᮠ mktime()ˈ⭘Ҿ䇑㇇Ӿ 1970 ᒤ 1 ᴸ 1 ᰕ 0 ᰦ䎧ࡠᔰᵪᖃ copy_process()DŽ fork.c 〻ᒿ㔉ࠪҶ sys_fork() ㌫㔏䈳⭘ѝ֯⭘Ҷєњ C 䈝䀰࠭ᮠ˖find_empty_process() ઼ ༴⨶࠭ᮠԕ৺ᵰ↫䘋〻ǃ㓸→䘋〻ǃᤲ䎧䘋〻ㅹ㌫㔏䈳⭘࠭ᮠDŽ exit.c 〻ᒿѫ㾱वᤜ⭘Ҿ༴⨶䘋〻㓸→Ⲵ㌫㔏䈳⭘DŽवਜ਼䘋〻䟺᭮ǃՊ䈍˄䘋〻㓴˅㓸→઼〻ᒿ䘰ࠪ Ԧѝˈ൘਴њѝᯝ༴⨶䗷〻ѝˈሶ࠶࡛䈳⭘ traps.c ѝ⴨ᓄⲴ C 䈝䀰༴⨶࠭ᮠDŽ asm.s 〻ᒿᱟ⭘Ҿ༴⨶㌫㔏⺜Ԧᔲᑨᡰᕅ䎧Ⲵѝᯝˈሩ਴⺜ԦᔲᑨⲴᇎ䱵༴⨶〻ᒿࡉᱟ൘ traps.c ᮷ ਺ᮽԬⲺ䈹⭞ቸ⅗ީ㌱ ഴ  䘋㹼བྷᾲ࠶㊫ˈ㿱മ 5-29 ᡰ⽪DŽ ㌫മˈնӽ❦ਟԕޣ㌫༽ᵲˈഐ↔䘉䟼ቡн䈖㓶ࡇࠪ਴᮷Ԧѻ䰤Ⲵᕅ⭘ޣ⭡Ҿ䘉Ӌ᮷Ԧѝԓ⸱ѻ䰤䈳⭘ ⨶ѝᯝᔲᑨ઼䲧䱡Ⲵ༴⨶䗷〻DŽᆀⴞᖅѝवᤜҶվቲⲴ䇮༷傡ࣘ〻ᒿˈྲ get_hd_block ઼ tty_write ㅹDŽ ᆈ൘ kernel/ⴞᖅѝˈަѝवᤜ䊑 forkǃexitǃ䈳ᓖ〻ᒿԕ৺аӋ㌫㔏䈳⭘〻ᒿㅹDŽ䘈वᤜ༴؍࣑Ⲵ〻ᒿ䜭 वਜ਼ 12 њԓ⸱᮷Ԧ઼ањ Makefile ᮷Ԧˈਖཆ䘈ᴹ 3 њᆀⴞᖅDŽᡰᴹ༴⨶ԫޡ linux/kernel ⴞᖅѝ 5.10.6 ޻Ṯぁᓅѱⴤᖋ kernel 䘀㹼 shell 〻ᒿDŽ ࠪањ⭘Ҿ䘀㹼 init()Ⲵ䘋〻ˈ൘䈕ᆀ䘋〻ѝˈ㌫㔏ሶ䘋㹼᧗ࡦਠ⧟ຳ䇮㖞ˈᒦф൘⭏ᡀањᆀ䘋〻⭘ᶕ ᒦ䇮㖞Ҷѝᯝݱ䇨ḷᘇDŽ൘ᢗ㹼ӾṨᗳᘱ〫ࡠ⭘ᡧᘱѻਾˈ㌫㔏ㅜа⅑䈳⭘ࡋᔪ䘋〻࠭ᮠ fork()ˈࡋᔪ ४޵ᆈਾ䶒ҏѪᆳ⮉лオ䰤DŽѻਾቡ䘋㹼ᡰᴹ⺜ԦⲴࡍ࿻ॆᐕ֌ˈवᤜӪᐕࡋᔪㅜањԫ࣑˄task 0˅ˈ 〻ᒿ俆ݸṩᦞᵪಘ޵ᆈⲴཊቁሩ㕃ߢ४޵ᆈᇩ䟿䘋㹼࠶䝽ˈྲ᷌䘈䇮㖞Ҷ㾱֯⭘㲊ᤏⴈˈࡉ൘㕃ߢ ᒦ൘᧗ࡦਠ䇮༷к䘀㹼 shell 〻ᒿDŽ 䈕ⴞᖅѝӵवਜ਼ањ᮷Ԧ main.cDŽ⭘Ҿᢗ㹼޵ṨᡰᴹⲴࡍ࿻ॆᐕ֌ˈ❦ਾ〫ࡠ⭘ᡧ⁑ᔿࡋᔪᯠ䘋〻ˈ 5.10.5 ޻Ṯࡓခौぁᓅⴤᖋ init  LQX[ ޵ṨⓀԓ⸱Ⲵⴞᖅ㔃ᶴ/ FRQVROHFVHULDOF NH\ERDUG6 WW\BLRFWOF UVBLRV WW\BLRF Ѣ㹼㓸ㄟ傡ࣘ〻ᒿ ᧗ࡦਠ㓸ㄟ〻ᒿ кቲ᧕ਓ〻ᒿ UDPGLVNF EONK KGF IORSS\F OOBUZBEONF ᧕ਓDŽਖཆ䘈वᤜ൘Ѣ㹼ѝᯝ༴⨶䗷〻ѝ䈳⭘Ⲵ C ࠭ᮠ do_tty_interrupt()ˈ䈕࠭ᮠሶՊ൘ѝᯝ㊫රѪ䈫 tty_io.c 〻ᒿѝवਜ਼ tty ᆇㅖ䇮༷䈫࠭ᮠ tty_read()઼߉࠭ᮠ tty_write()ˈѪ᮷Ԧ㌫㔏ᨀ׋Ҷкቲ䇯䰞 ഴ ᆍㅜ䇴༽ぁᓅҁ䰪Ⲻީ㌱⽰ᝅഴ  ㌫DŽޣrs-232ǃѢ㹼㓸ㄟǃ䭞ⴈ઼᧗ࡦਠ㓸ㄟ䇮༷Ⲵ傡ࣘDŽമ 5-31 ᱟ䘉Ӌ᮷Ԧѻ䰤Ⲵབྷ㠤䈳⭘ቲ⅑ ਜ਼ᴹ 4 њ C 䈝䀰〻ᒿ઼ 2 њ≷㕆〻ᒿ᮷ԦDŽ䘉Ӌ᮷Ԧᇎ⧠ҶሩѢ㹼ㄟਓޡᆇㅖ䇮༷〻ᒿᆀⴞᖅ ᆍㅜ䇴༽傧ࣞぁᓅᆆⴤᖋ kernel/chr_drv 䇯䰞ඇ䇮༷ᮠᦞⲴൠᯩ㻛䈳⭘ˈቔަᱟ൘儈䙏㕃ߢ४༴⨶᮷Ԧ fs/buffer.c ѝDŽ ll_rw_block()ˈ޵ṨѝᡰᴹަԆ〻ᒿ䜭ᱟ䙊䗷䈕࠭ᮠሩඇ䇮༷䘋㹼ᮠᦞ䈫߉᫽֌DŽ֐ሶⴻࡠ䈕࠭ᮠ൘䇨ཊ /߉傡ࣘ࠭ᮠˈѫ㾱ᱟ do_fd_request()࠭ᮠDŽll_rw_blk.c ѝ〻ᒿᇎ⧠Ҷվቲඇ䇮༷ᮠᦞ䈫/߉࠭ᮠ 䘋㹼䈫/߉Ⲵᓅቲ傡ࣘ࠭ᮠˈѫ㾱ᱟ do_hd__request()࠭ᮠ˗floppy.c 〻ᒿѝѫ㾱ᇎ⧠Ҷሩ䖟ⴈᮠᦞඇⲴ䈫 ⭘Ⲵඇ䇮༷㔃ᶴ઼ᮠᦞඇ䈧≲㔃ᶴDŽhd.c 〻ᒿѫ㾱ᇎ⧠ሩ⺜ⴈᮠᦞඇޡ blk.h ѝᇊѹҶ 3 њ C 〻ᒿѝ ഴ EONBGUY ⴤᖋѣᮽԬⲺቸ⅗ީ㌱Ⱦ  ㌫ˈ㿱മ 5-30 ᡰ⽪DŽޣҾᱟඇ䇮༷〻ᒿу⭘Ⲵˈᡰԕо C ᮷Ԧ᭮൘а䎧DŽ䘉ࠐњ᮷Ԧѻ䰤Ⲵབྷ㠤 वਜ਼ 4 њ c ᮷Ԧ઼ 1 њཤ᮷ԦDŽཤ᮷Ԧ blk.h ⭡ޡࡠ儈䙏㕃ߢ४ѝˈ❦ਾ޽ᨀ׋㔉⭘ᡧDŽblk_drv ᆀⴞᖅ ޕѻ䰤֯⭘Ҷ儈䙏㕃ߢᵪࡦDŽ൘䇯䰞ඇ䇮༷кⲴᮠᦞᰦˈ㌫㔏俆ݸԕᮠᦞඇⲴᖒᔿᢺඇ䇮༷кⲴᮠᦞ䈫 ൘֯⭘ඇ䇮༷ᰦˈ⭡Ҿަᮠᦞ੎ੀ䟿བྷˈѪҶ㜭ཏ儈᭸⦷ൠ֯⭘ඇ䇮༷кⲴᮠᦞˈ൘⭘ᡧ䘋〻оඇ䇮༷ 䙊ᑨᛵߥлˈ⭘ᡧᱟ䙊䗷᮷Ԧ㌫㔏ᶕ䇯䰞䇮༷Ⲵˈഐ↔䇮༷傡ࣘ〻ᒿѪ᮷Ԧ㌫㔏ᇎ⧠Ҷ䈳⭘᧕ਓDŽ ඍ䇴༽傧ࣞぁᓅᆆⴤᖋ kernel/blk_drv ḷ߶ᓃ࠭ᮠѝⲴᆇㅖѢṬᔿॆ࠭ᮠDŽޕ vsprintf.c 〻ᒿᇎ⧠Ҷ⧠൘ᐢ㓿ᖂ ㌫㔏䈳⭘⴨ᓄⲴ C 䈝䀰༴⨶࠭ᮠѝˈ䘉Ӌ༴⨶࠭ᮠ࠶ᐳ൘ᮤњ Linux ޵Ṩԓ⸱ѝDŽ system_call.s 〻ᒿᇎ⧠Ҷ Linux ㌫㔏䈳⭘˄int 0x80˅Ⲵ᧕ਓ༴⨶䗷〻ˈᇎ䱵Ⲵ༴⨶䗷〻ࡉवਜ਼൘਴ sys.c 〻ᒿवᤜᖸཊ㌫㔏䈳⭘࠭ᮠˈަѝᴹӋ䘈⋑ᴹᇎ⧠DŽ ᮠ do_signal()DŽ  LQX[ ޵ṨⓀԓ⸱Ⲵⴞᖅ㔃ᶴ/ ࠭ᮠᶕ࠶䝽㇑⨶޵ᆈオ䰤DŽ do_no_page()઼ do_wp_page()࠭ᮠDŽ൘ࡋᔪᯠ䘋〻㘼ᢗ㹼༽ࡦ䘋〻᫽֌ᰦˈণ֯⭘䈕᮷ԦѝⲴ޵ᆈ༴⨶ memory.c 〻ᒿवᤜሩ޵ᆈ䘋㹼ࡍ࿻ॆⲴ࠭ᮠ mem_init()ˈ⭡ page.s Ⲵ޵ᆈ༴⨶ѝᯝ䗷〻䈳⭘Ⲵ ᣔDŽ؍ѝᯝ઼䇯䰞䶎⌅ൠ൰㘼ᕅ䎧Ⲵ亥 page.s ᮷Ԧवᤜ޵ᆈ亥䶒ᔲᑨѝᯝ˄int 14˅༴⨶〻ᒿˈѫ㾱⭘Ҿ༴⨶〻ᒿ⭡Ҿ㕪亥㘼ᕅ䎧Ⲵ亥ᔲᑨ 䍍ˈᒦᢗ㹼߉ᰦ༽ࡦᵪࡦDŽ ԫ࣑࠶䝽ањ⇥֯⭘DŽ࠶亥ᵪࡦ⭘ҾᢺᤷᇊⲴ⢙⨶޵ᆈ亥䶒᱐ሴࡠ⇥޵ˈỰ⍻ fork ࡋᔪⲴԫօ䟽༽Ⲵᤧ њ⇥ˈ⇿њ⇥ 64MBDŽᡰᴹ޵Ṩ〻ᒿঐ⭘ަѝㅜањ⇥ˈᒦф⢙⨶ൠ൰о䈕⇥㓯ᙗൠ൰⴨਼DŽ❦ਾ⇿њ Linux ޵Ṩሩ޵ᆈⲴ༴⨶֯⭘Ҷ࠶亥઼࠶⇥є⿽ᯩᔿDŽ俆ݸᱟሶ 386 Ⲵ 4G 㲊ᤏൠ൰オ䰤࠶ࢢᡀ 64 ㌫DŽޣ޵ᆈ४Ⲵ⢙⨶޵ᆈ亥ѻ䰤ᔪ・Ҷሩᓄ ԕ৺㓯ᙗൠ൰ࡠѫ޵ᆈ४ѝ⢙⨶޵ᆈൠ൰Ⲵ᱐ሴˈ䙊䗷޵ᆈⲴ࠶亥㇑⨶ᵪࡦˈ൘䘋〻Ⲵ㲊ᤏ޵ᆈ亥оѫ 䈕ⴞᖅवᤜ 2 њԓ⸱᮷ԦDŽѫ㾱⭘Ҿ㇑⨶〻ᒿሩѫ޵ᆈ४Ⲵ֯⭘ˈᇎ⧠Ҷ䘋〻䙫䗁ൠ൰ࡠ㓯ᙗൠ൰ 5.10.8 ޻ᆎ㇗⨼ぁᓅⴤᖋ mm ࠭ᮠ wait()ǃࡋᔪՊ䈍㌫㔏䈳⭘ setsid()ԕ৺൘ include/string.h ѝᇎ⧠ⲴᡰᴹᆇㅖѢ᫽֌࠭ᮠDŽ ᢃᔰ࠭ᮠ open()ǃ߉᮷Ԧ࠭ᮠ write()ǃᢗ㹼〻ᒿ࠭ᮠ execve()ǃ޵ᆈ࠶䝽࠭ᮠ malloc()ǃㅹᖵᆀ䘋〻⣦ᘱ 䰝᮷Ԧ࠭ᮠ close(fd)ǃ༽ࡦ᮷Ԧ᧿䘠ㅖ࠭ᮠ dup()ǃ᮷Ԧޣ䘉Ӌ᮷Ԧѝѫ㾱वᤜᴹ䘰ࠪ࠭ᮠ_exit()ǃ 㔏䈳⭘Ⲵ᧕ਓ࠭ᮠDŽ 䲔Ҷањ⭡ tytso 㕆ࡦⲴ malloc.c 〻ᒿ䖳䮯ԕཆˈަԆⲴ〻ᒿᖸ⸝ˈᴹⲴਚᴹаҼ㹼ԓ⸱ˈᇎ⧠ҶаӋ㌫ ᴹ 12 њ C 䈝䀰᮷ԦˈޡаṧDŽ䈫㘵ਟӾѝҶ䀓а㡜 libc ࠭ᮠᓃⲴสᵜ㓴ᡀ৏⨶DŽ൘ lib/ⴞᖅѝޘᯩ⌅ᆼ Ѫ޵Ṩࡍ࿻ॆ〻ᒿ init/main.c 䘀㹼൘⭘ᡧᘱⲴ䘋〻˄䘋〻 0ǃ1˅ᨀ׋䈳⭘᭟ᤱDŽᆳоᲞ䙊䶉ᘱᓃⲴᇎ⧠ C ࠭ᮠᓃᖸབྷDŽഐ↔൘޵ṨⓀԓ⸱ѝᴹу䰘ањ lib/ⴞᖅᨀ׋޵Ṩ䴰㾱⭘ࡠⲴаӋ࠭ᮠDŽ޵Ṩ࠭ᮠᓃ⭘Ҿ оᲞ䙊⭘ᡧ〻ᒿн਼ˈ޵Ṩԓ⸱н㜭֯⭘ḷ߶ C ࠭ᮠᓃ৺ަԆаӋ࠭ᮠᓃDŽѫ㾱৏ഐᱟ⭡ҾᆼᮤⲴ 5.10.7 ޻Ṯᓉ࠳ᮦⴤᖋ lib SIGFPEDŽ ॿ༴⨶ಘⲴԯⵏԓ⸱DŽᵜ〻ᒿѝਚᱟᢃঠаᶑࠪ䭉ؑ᚟ˈᒦੁ⭘ᡧ〻ᒿਁ䘱ањॿ༴⨶ಘ䭉䈟ؑਧ ޣѝᯝDŽഐ↔ˈ֯⭘䈕ѝᯝቡਟԕ⭘䖟Ԧᶕԯⵏॿ༴⨶ಘⲴ࣏㜭DŽᵜҖᡰ䇘䇪Ⲵ޵Ṩ⡸ᵜ䘈⋑ᴹवਜ਼ᴹ 〻ᒿ䈳⭘Ⲵ C ࠭ᮠDŽᖃᵪಘѝ⋑ᴹᮠᆖॿ༴⨶ಘˈ㘼 CPU ত৸ᢗ㹼Ҷॿ༴⨶ಘⲴᤷԔᰦˈቡՊᕅਁ䈕 䈕ᆀⴞᖅѝⴞࡽӵᴹањ C 〻ᒿ math_emulate.cDŽަѝⲴ math_emulate()࠭ᮠᱟѝᯝ int7 Ⲵѝᯝ༴⨶ অ༺⨼ಞԵⵕૂᬃ֒ぁᓅᆆⴤᖋ kernel/math keyboard.S 〻ᒿѫ㾱ᇎ⧠Ҷ䭞ⴈѝᯝ༴⨶䗷〻 keyboard_interruptDŽ Պ൘ᇎ⧠㌫㔏䈳⭘ sys_ioctl()Ⲵ fs/ioctl.c 〻ᒿѝ㻛䈳⭘DŽ tty_ioctl.c 〻ᒿᇎ⧠Ҷ tty Ⲵ io ᧗ࡦ᧕ਓ࠭ᮠ tty_ioctl()ԕ৺ሩ termio(s)㓸ㄟ io 㔃ᶴⲴ䈫߉࠭ᮠˈᒦ वᤜ tty ⭘ҾᖰѢਓ䗃ࠪⲴ rs_write()࠭ᮠDŽ serial.c ⭘Ҿሩᔲ↕Ѣ㹼䙊ؑ㣟⡷ UART 䘋㹼ࡍ࿻ॆ᫽֌ˈᒦ䇮㖞єњ䙊ؑㄟਓⲴѝᯝੁ䟿DŽਖཆ䘈 do_tty_interrupt()DŽ ˄ㄟਓ 0x3fa ᡆ 0x2fa˅ѝਆᗇⲴ 4 ⿽ѝᯝ㊫ර࠶࡛䘋㹼༴⨶ˈᒦ൘༴⨶ѝᯝ㊫රѪ䈫ᆇㅖⲴԓ⸱ѝ䈳⭘ rs_io.s ≷㕆〻ᒿ⭘Ҿᇎ⧠єњѢ㹼᧕ਓⲴѝᯝ༴⨶〻ᒿDŽ䈕ѝᯝ༴⨶〻ᒿՊṩᦞӾѝᯝḷ䇶ᇴᆈಘ ሩᱮ⽪ಘ઼䭞ⴈѝᯝⲴࡍ࿻ॆ䇮㖞〻ᒿ con_init()DŽ console.c ᮷Ԧѫ㾱वਜ਼᧗ࡦਠࡍ࿻ॆ〻ᒿ઼᧗ࡦਠ߉࠭ᮠ con_write()ˈ⭘Ҿ㻛 tty 䇮༷䈳⭘DŽ䘈वਜ਼ ᆇㅖⲴ༴⨶ѝ㻛䈳⭘DŽ  LQX[ ޵ṨⓀԓ⸱Ⲵⴞᖅ㔃ᶴ/ ⸱᮷Ԧ䘋㹼㕆䈁ǃ䘎᧕ᡆ䘋㹼ᆹ㻵ㅹ⍫ࣘDŽ make ભԔˈᆳቡՊ׍ᦞ Makefile ᮷ԦѝⲴ䇮㖞ሩⓀ〻ᒿᡆⴞḷԓ ޕ㾱൘ਜ਼ᴹ Makefile Ⲵᖃࡽⴞᖅѝ䭞 ᮠᦞ᮷ԦDŽਚޕMakefile ᮷Ԧ⴨ᖃҾ〻ᒿ㕆䈁䗷〻ѝⲴᢩ༴⨶᮷ԦDŽᱟᐕާ〻ᒿ make 䘀㹼ᰦⲴ䗃 5.12.1 ࣕ㜳ᨅ䘦 ਾ㔝ㄐ㢲ሶ᤹➗䘉䟼㊫լⲴ᧿䘠㔃ᶴ䘋㹼⌘䟺DŽ Ӿᵜ㢲䎧ˈᡁԜᔰ࿻ሩ޵ṨⓀԓ⸱᮷Ԧ䘋㹼⌘䟺DŽ俆ݸ⌘䟺 linux ⴞᖅл䙷ࡠⲴㅜањ᮷Ԧ MakefileDŽ 5.12 linux/Makefile ᮽԬ ֌㌫㔏Ⲵ൘㓯᡻޼ㅜ 3 䜘࠶DŽ ᮷ẓਟ৲㿱᫽ޣӋⲴᙗ㜭ˈնᱟᓃ࠭ᮠত㜭ᨀ׋ᴤཊⲴ࣏㜭ˈ㘼фᴤާỰ䭉㜭࣋DŽ㌫㔏ᨀ׋Ⲵᓃ࠭ᮠᴹ ઼ close ㊫լⲴ࣏㜭ˈնতᱟ൘ᴤ儈Ⲵቲ⅑кDŽ൘䘉⿽ᛵߥлˈ㌫㔏䈳⭘䙊ᑨ㜭ᨀ׋∄ᓃ࠭ᮠ⮕ᗞྭа ḀӋᓃ࠭ᮠਚᱟ㌫㔏䈳⭘Ⲵ໎ᕪ࣏㜭⡸DŽֻྲˈḷ߶ I/O ᓃ࠭ᮠ fopen ઼ fclose ᨀ׋Ҷо㌫㔏䈳⭘ open 䗃઼ࠪᆇㅖѢ༴⨶࠭ᮠDŽ/ޕᓃ࠭ᮠа㡜वᤜ C 䈝䀰⋑ᴹᨀ׋Ⲵᢗ㹼儈㓗࣏㜭Ⲵ⭘ᡧ㓗࠭ᮠˈֻྲ䗃 ᮷ẓਟ৲㿱 Linux ᫽֌㌫㔏Ⲵ൘㓯᡻޼Ⲵㅜ 2 䜘࠶DŽޣ᧕䇯䰞㌫㔏䈳⭘ᆿDŽ㌫㔏䈳⭘Ⲵᴹ ἽᙗቡнྭҶDŽഐ↔ⴞࡽ Linux ḷ߶ᓃ LSB˄Linux Standard Base˅઼䇨ཊަԆḷ߶䜭нݱ䇨ᓄ⭘〻ᒿⴤ ཤ᮷Ԧѝᇊѹ˅ˈᒦфᑨԕᆿⲴᖒᔿᇎ⧠DŽᓄ⭘〻ᒿнᓄ䈕ⴤ᧕֯⭘㌫㔏䈳⭘ˈഐѪ䘉ṧⲴ䈍ˈ〻ᒿⲴ〫 ㌫㔏䈳⭘ᱟ޵Ṩоཆ⭼᧕ਓⲴᴰ儈ቲDŽ൘޵Ṩѝˈ⇿њ㌫㔏䈳⭘䜭ᴹањᒿࡇਧ˄൘ include/unistd.h ḷ߶ˈ䛓Ѹᓄ⭘〻ᒿቡਟԕ൘䘉Ӌ᫽֌㌫㔏ѻ䰤ާᴹਟ〫ἽᙗDŽ ㌫DŽᰐ䇪ањ᫽֌㌫㔏ᨀ׋Ⲵ㌫㔏䈳⭘ᱟཊѸᗇн਼ˈնਚ㾱ᆳ䚥ᗚ਼ањ APIޣ⭘ѻ䰤ࡠᓅᆈ൘ӰѸ ণн֯⭘޵Ṩ࣏㜭DŽഐ↔࠭ᮠᓃਟԕⴻ֌ᱟᇎ⧠䊑 POSIX ḷ߶Ⲵѫփ⭼䶒ˈᓄ⭘〻ᒿн⭘㇑ᆳо㌫㔏䈳 ᇎ⧠DŽᖃ❦ḀӋ API ࠭ᮠਟ㜭ṩᵜቡн䴰㾱֯⭘㌫㔏䈳⭘ˈ਼ޡ⭘ሩᓄˈҏਟ㜭⭡ࠐњ㌫㔏䈳⭘Ⲵ࣏㜭 о㌫㔏䈳⭘Ⲵ४࡛൘Ҿ˖ѪҶᇎ⧠Ḁаᓄ⭘〻ᒿ᧕ਓḷ߶ˈֻྲ POSIXˈަѝⲴ API ਟԕоањ㌫㔏䈳 ൘ UNIX ㊫᫽֌㌫㔏ѝˈᴰѪᲞ䙽֯⭘ⲴᱟสҾ POSIX ḷ߶Ⲵ API ᧕ਓDŽLinux ᖃ❦ҏнֻཆDŽAPI ㌫㔏ؑ᚟DŽ 䰝ሩ᮷Ԧᡆ䇮༷Ⲵ䇯䰞ǃ䘋㹼、ᆖ䇑㇇ǃࠪ䭉༴⨶ԕ৺䇯䰞㓴઼⭘ᡧḷ䇶ਧ ID ㅹޣ֌ˈֻྲˈᢃᔰ઼ ѹҶᓄ⭘〻ᒿ֯⭘Ⲵа㓴ḷ߶㕆ᡀ᧕ਓDŽ䙊䗷䈳⭘䘉ӋᓃѝⲴ〻ᒿˈᓄ⭘〻ᒿԓ⸱㜭ཏᆼᡀ਴⿽ᑨ⭘ᐕ libc ㅹᓃѝ࠭ᮠᶕ䇯䰞޵Ṩ䍴ⓀDŽ䘉ӋᓃѝⲴ࠭ᮠᡆ䍴Ⓚ䙊ᑨ㻛〠Ѫᓄ⭘〻ᒿ㕆ᡀ᧕ਓ˄API˅DŽަѝᇊ ㌫㔏䈳⭘ѫ㾱ᨀ׋㔉㌫㔏䖟Ԧ㕆〻ᡆ㘵⭘Ҿᓃ࠭ᮠⲴᇎ⧠DŽ㘼а㡜⭘ᡧᔰਁⲴ〻ᒿࡉᱟ䙊䗷䈳⭘䊑 ԓ⸱䈳⭘Ҷ޵Ṩ㌫㔏䈳⭘࣏㜭ˈ৲㿱മ 5-4 ᡰ⽪DŽ ᯩ⌅оสᵜ C ࠭ᮠᓃ libc ѝ㊫լ࠭ᮠⲴᇎ⧠ᯩ⌅สᵜ⴨਼ˈѪҶ֯⭘޵Ṩ䍴Ⓚˈᴰ㓸䜭ᱟ䙊䗷޵፼≷㕆 ޵Ṩሩᡰᴹ⭘ᡧ〻ᒿᡆ䘋〻ᇎ䱵кਚᨀ׋㌫㔏䈳⭘䘉а⿽㔏аⲴ᧕ਓDŽlib/ⴞᖅл޵Ṩᓃ࠭ᮠԓ⸱Ⲵᇎ⧠ ؑ᚟Ӕ⍱DŽн䗷޵Ṩᓃ࠭ᮠӵ׋޵ṨࡋᔪⲴԫ࣑ 0 ઼ԫ࣑ 1 ֯⭘ˈᆳԜᴰ㓸䘈ᱟ৫䈳⭘㌫㔏䈳⭘DŽഐ↔ ҏণѝᯝ䈳⭘ int 0x80˗ਖаᯩ䶒ᱟ䙊䗷ᔰਁ⧟ຳᓃ࠭ᮠᡆ޵Ṩᓃ࠭ᮠ˄൘ㅜ 12 ㄐѝ䈤᰾˅о޵Ṩ䘋㹼 ൘ Linux ㌫㔏ѝˈ޵ṨѪ⭘ᡧ〻ᒿᨀ׋Ҷєᯩ䶒Ⲵ᭟ᤱDŽަаᱟ㌫㔏䈳⭘᧕ਓ˄൘ㅜ 5 ㄐѝ䈤᰾˅ˈ 5.11 ޻Ṯ㌱㔕фᓊ⭞ぁᓅⲺީ㌱ ᮷Ԧ imageDŽަާփⲴ࣏㜭ਟ৲㿱лаㄐ޵ᇩDŽۿⲴ޵Ṩ᱐ 䈕ⴞᖅлⲴ build.c 〻ᒿ⭘Ҿሶ Linux ਴њⴞᖅѝ㻛࠶࡛㕆䈁⭏ᡀⲴⴞḷԓ⸱䘎᧕ਸᒦᡀањਟ䘀㹼 5.10.9 㕌䈇޻Ṯᐛޭぁᓅⴤᖋ tools  ㌫ޣ޵Ṩ㌫㔏оᓄ⭘〻ᒿⲴ ,PDJH ᮷Ԧۿ޵Ṩ᱐ %XLOG ᐕާ ERRWVHFW VHWXS V\VWHP KHDG PDLQ NHUQHO PP IV OLE $6 JDV*18 ≷㕆㕆䈁ಘ઼䘎᧕ಘˈ㿱ࡇ㺘ਾⲴӻ㓽DŽ  /' OGᱟ˖⭏ᡀ  ⴞḷ〻ᒿ˗D⭏ᡀо JDV ઼ JOG 䜘࠶ެᇩⲴԓ⸱DŽ $6 DVD ≷㕆㕆䈁ಘ઼䘎᧕ಘˈ㿱ࡇ㺘ਾⲴӻ㓽DŽਾᑖⲴ৲ᮠਜ਼ѹ࠶࡛   5$0',6. '5$0',6. ˈ৲㿱ㅜ  㹼DŽ  '5$0',6. ੖ࡉ JFF 㕆䈁ᰦՊᑖᴹ䘹亩 5$0',6. 䇮༷Ⲵ䈍ቡᇊѹඇⲴབྷሿDŽ䘉䟼唈䇔 5$0',6. ⋑ᴹᇊѹ˄⌘䟺ᦹҶ˅ˈ ྲ᷌֐㾱֯⭘ 5$0 ⴈ  VL]HLQEORFNV LI\RXZDQWWKHUDPGLVNGHYLFHGHILQHWKLVWREHWKH   ぁᓅ 5-1 linux/Makefile ᮽԬ 5.12.2 ԙ⸷⌞䠀 ഴ ޻Ṯ㕌䈇䘔᧛㓺ਾ㔉ᶺ  䬮᧕ࡠ޵Ṩԓ⸱ѝDŽสᵜ㕆䈁䘎᧕/㓴ਸ㔃ᶴྲമ 5-32 ᡰ⽪DŽ ᮷Ԧ imageDŽbuild ᱟ⭡ tools/build.c Ⓚ〻ᒿ㕆䈁㘼ᡀⲴањ⤜・Ⲵᢗ㹼〻ᒿˈᆳᵜ䓛ᒦ⋑ᴹ㻛㕆䈁ۿṨ᱐ ֯⭘ GNU Ⲵ㕆䈁ಘ gcc/gas 䘋㹼㕆䈁ˈᒦ䬮᧕⁑ඇ systemDŽᴰਾ޽⭘ build ᐕާሶ䘉йඇ㓴ਸᡀањ޵ bootsect.sǃsetup.s ֯⭘ 8086 ≷㕆ಘ䘋㹼㕆䈁ˈ࠶࡛⭏ᡀ਴㠚Ⲵᢗ㹼⁑ඇDŽ޽ሩⓀԓ⸱ѝⲴަԆᡰᴹ〻ᒿ ᮷Ԧ imageDŽާփᱟሩ boot/ѝⲴۿ㹼〻ᒿሶᡰᴹ޵Ṩ㕆䈁ԓ⸱䘎᧕઼ਸᒦᡀањਟ䘀㹼Ⲵ޵Ṩ᱐ 䘉њ Makefile ᮷ԦⲴѫ㾱֌⭘ᱟᤷ⽪ make 〻ᒿᴰ㓸֯⭘⤜・㕆䈁䘎᧕ᡀⲴ tools/ⴞᖅѝⲴ build ᢗ Ѫ'#'Ⲵ㹼ᱟ⌘䟺㹼DŽ᮷Ԧᔰཤ䜘࠶Ⲵ'='䍻٬䈝ਕᇊѹҶаӋ৲ᮠᡆભԔⲴ㕙߉DŽ ᯠˈሩҾ⇿ањ䴰㾱ᴤᯠⲴ᮷ԦᆳՊṩᦞ Makefile ѝⲴؑ᚟ਁࠪ⴨ᓄⲴભԔDŽ൘ Makefile ᮷Ԧѝˈᔰཤ ᱟ֯⭘ Makefile ᮠᦞ᮷Ԧ઼ԓ⸱᮷ԦⲴᴰਾ؞᭩ᰦ䰤(last-modification time)ᶕ⺞ᇊ䛓Ӌ᮷Ԧ䴰㾱䘋㹼ᴤ ؞᭩䗷〻ᒿ㌫㔏ѝⲴḀӋⓀԓ⸱᮷Ԧਾˈᢗ㹼 make ભԔቡ㜭䘋㹼ᡰᴹᗵ㾱Ⲵ䟽ᯠ㕆䈁ᐕ֌DŽmake 〻ᒿ ᴤᯠⲴˈ㘼䘉Ӌⴞḷ᮷Ԧࡉᱟ⭡㕆䈁〻ᒿࡋᔪⲴDŽаᰖ㕆߉ྭањਸ䘲Ⲵ Makefile ᮷Ԧˈ䛓Ѹ൘֐⇿⅑ ㌫ˈᒦ䪸ሩ⇿њ䴰㾱ᴤᯠⲴ᮷Ԧ㔉ࠪާփⲴ᧗ࡦભԔDŽ䙊ᑨˈᢗ㹼〻ᒿᱟṩᦞަⴞḷ᮷Ԧ䘋㹼ޣѻ䰤Ⲵ ᒿ᮷Ԧ䘋㹼㕆䈁DŽ൘֯⭘ make ѻࡽˈ䴰㾱㕆߉ Makefile ؑ᚟᮷Ԧˈ䈕᮷Ԧ᧿䘠Ҷᮤњ〻ᒿवѝ਴〻ᒿ make ᐕާ〻ᒿ㜭㠚ࣘൠ⺞ᇊањབྷ〻ᒿ㌫㔏ѝ䛓Ӌ〻ᒿ᮷Ԧ䴰㾱㻛䟽ᯠ㕆䈁ˈᒦਁࠪભԔሩ䘉Ӌ〻  OLQX[0DNHILOH ᮷Ԧ '5,9(56 NHUQHOEONBGUYEONBGUYDNHUQHOFKUBGUYFKUBGUYD ԕ৺Ӿᖂẓ᮷Ԧѝᣭਆ᮷ԦDŽ 䳶ਸⲴᓃ᮷Ԧˈ䙊ᑨᱟ⭘ *18 Ⲵ DU 〻ᒿ⭏ᡀDŽDU ᱟ *18 ⲴҼ䘋ࡦ᮷Ԧ༴⨶〻ᒿˈ⭘Ҿࡋᔪǃ؞᭩ 㺘⽪䈕᮷Ԧᱟњᖂẓ᮷Ԧˈҏণवਜ਼ᴹ䇨ཊਟᢗ㹼Ҽ䘋ࡦԓ⸱ᆀ〻ᒿ D ඇ઼ᆇㅖ䇮༷ᓃ᮷ԦDŽ  $5&+,9(6 NHUQHONHUQHORPPPPRIVIVR $5&+,9(6˄ᖂẓ᮷Ԧ˅ḷ䇶ㅖ㺘⽪DŽ л䶒ᱟ NHUQHO ⴞᖅǃPP ⴞᖅ઼ IV ⴞᖅᡰӗ⭏Ⲵⴞḷԓ⸱᮷ԦDŽѪҶᯩׯᕅ⭘൘䘉䟼ሶᆳԜ⭘  5227B'(9 GHYKG ᮷Ԧ㌫㔏ᡰ൘Ⲵ࠶४ս㖞DŽ 䘉䟼GHYKG ሩᓄㅜ  њ⺜ⴈⲴㅜ  њ࠶४DŽ䘉ᱟ /LQXV ᔰਁ /LQX[ ޵Ṩᰦ㠚ᐡⲴᵪಘкṩ  EXLOG 〻ᒿ˄൘ WRROVⴞᖅѝ˅ቡ֯⭘唈䇔٬GHYKGDŽ )/233< ǃGHY[[[[ ᡆ㘵ᒢ㜶オ⵰ˈオ⵰ᰦ ൘Ⲵ䇮༷ˈ䘉ਟԕᱟ䖟ⴈ LPDJH ᮷Ԧᰦᡰ֯⭘Ⲵ唈䇔ṩ᮷Ԧ㌫㔏ᡰ ۿ5227B'(9 ᤷᇊ൘ࡋᔪ޵Ṩ᱐   EXLOG GHIDXOWRIGHYKGLVXVHGE\ 7KLVFDQEHHLWKHU)/233<GHY[[[[RUHPSW\LQZKLFKFDVHWKH 5227B'(9VSHFLILHVWKHGHIDXOWURRWGHYLFHZKHQPDNLQJWKHLPDJH   &33 FSSQRVWGLQF,LQFOXGH 䘹亩ᤷᇊⲴⴞᖅᡆ㘵ᱟ൘ᖃࡽⴞᖅ䟼ᩌ㍒ཤ᮷ԦDŽ , лⲴཤ᮷Ԧˈ㘼ᱟ֯⭘ ਜ਼ѹᱟн㾱ᩌ㍒ḷ߶ཤ᮷ԦⴞᖅѝⲴ᮷Ԧˈণн⭘㌫㔏XVULQFOXGHⴞᖅ QRVWGLQF,LQFOXGH  Ⲵ䈝ਕDŽ ㅹᶑԦࡔ࡛㹼⭘Ҿ⺞ᇊᱟ੖वਜ਼ަᤷᇊ㤳തѝ HQGLI ઼ LIQGHI ǃ LIGHI ǃ LI 〻ᒿѝᡰᴹ ᇊѹⲴᆿ䜭Պ֯⭘ަᇊѹ䜘࠶ᴯᦒᦹDŽ GHILQH ᔰ࿻Ⲵ㹼൷䴰㾱⭡ࡽ༴⨶ಘ䘋㹼༴⨶DŽ〻ᒿѝᡰᴹ   ᤷᇊⲴ᮷Ԧवਜ਼䘋ᶕDŽⓀ〻ᒿ᮷Ԧѝᡰᴹԕㅖਧ LQFOXGH वਜ਼䘋ᤷᇊ᮷ԦⲴ޵ᇩˈণᢺ֯⭘ 亴 ༴⨶ಘ〻ᒿDŽࡽ༴⨶ಘ⭘Ҿ䘋㹼〻ᒿѝⲴᆿᴯᦒ༴⨶ǃᶑԦ㕆䈁༴⨶ԕ৺ л䶒 FSS ᱟ JFF Ⲵࡽ  IFRPELQHUHJVPVWULQJLQVQV &)/$*6 :DOO2IVWUHQJWKUHGXFHIRPLWIUDPHSRLQWHU? ᆇㅖѢᤷԔˈਟԕ৫ᦹDŽ /LQXV ൘ᆖҐ JFF 㕆䈁ಘᰦѪ JFF ໎࣐Ⲵ䘹亩ˈ⭘Ҿ JFF ൘༽ࡦ㔃ᶴㅹ᫽֌ᰦ֯⭘ &38 Ⲵ ⮉൘ᇴᆈಘѝDŽ䘉ṧ൘࠭ᮠѝਟԕ䚯ݽሩᑗᤷ䪸Ⲵ᫽֌઼㔤ᣔDŽPVWULQJLQVQVᱟ؍ᢺᑗᤷ䪸 ಘⲴᤷԔ㓴ਸ൘а䎧DŽIRPLWIUDPHSRLQWHUᤷ᰾ሩҾᰐ䴰ᑗᤷ䪸˄)UDPHSRLQWHU˅Ⲵ࠭ᮠн㾱 ҾՈॆᗚ⧟䈝ਕ˗IFRPELQHUHJV ⭘Ҿᤷ᰾㕆䈁ಘ൘㓴ਸ㕆䈁䱦⇥ᢺ༽ࡦањᇴᆈಘࡠਖањᇴᆈ Ⲵ㕆䈁ḷᘇDŽަѝIVWUHQJWKUHGXFH ⭘ޣᤷᇊоᵪಘᰐ I ḷᘇ 䆖੺ؑ᚟˗2ሩԓ⸱䘋㹼ՈॆDŽ ㅖਧ㺘⽪ла㹼ᱟ㔝㹼DŽ䘹亩ਜ਼ѹѪ˖:DOOᢃঠᡰᴹ ? л䶒ᤷᇊ JFF ֯⭘Ⲵ䘹亩DŽࡽа㹼ᴰਾⲴ   5$0',6. && JFF 䶒࣐кㅖਧᒦ⭘ᤜਧᤜտḷ䇶ㅖDŽ VFULSW 〻ᒿ㘼䀰ˈ൘ᕅ⭘ᇊѹⲴḷ䇶ㅖᰦˈ䴰൘ࡽ JFF ᱟ *18& 〻ᒿ㕆䈁ಘDŽሩҾ 81,; ㊫Ⲵ㝊ᵜ  /')/$*6 V[0 Ь䘎᧕ѝवਜ਼Ⲵᡰᴹ᮷Ԧᡀઈ৺ަᕅ⭘ⲴㅖਧDŽ ㅖਧྲօ᭮㖞˗ޡޜЬ Ьⴞḷ᮷Ԧ৺ㅖਧؑ᚟᱐ሴࡠ޵ᆈѝⲴս㖞˗ ࡠ޵ᆈѝⲴս㖞ؑ᚟DŽާփᶕ䇢ᴹྲлؑ᚟˖ޕѝࡇࠪҶ〻ᒿ⇥㻵ަˈۿӗ⭏Ⲵа⿽޵ᆈൠ൰᱐ OLQNPDS ˈᱟᤷ⭡䘎᧕〻ᒿ ۿᱮ⽪ಘ кᢃঠ䘎᧕᱐ ᡰᴹተ䜘ㅖਧ˗0㺘⽪䴰㾱൘ḷ߶䗃ࠪ䇮༷ л䶒ᱟ *18 䬮᧕ಘ JOG 䘀㹼ᰦ⭘ࡠⲴ䘹亩DŽਜ਼ѹᱟ˖V䗃ࠪ᮷Ԧѝⴱ⮕ᡰᴹⲴㅖਧؑ᚟˗[ࡐ䲔 /' JOG  OLQX[0DNHILOH ᮷Ԧ 㺘⽪ WRROV ⴞᖅѝⲴ V\VWHP ᮷Ԧ㾱⭡߂ਧਣ䗩ᡰࡇⲴݳ㍐⭏ᡀDŽ 㹼ᱟ⭏ᡀ V\VWHP ⲴભԔDŽ  ERRWKHDGV࡙⭘к䶒㔉ࠪⲴVR 㿴ࡉ⭏ᡀ KHDGR ⴞḷ᮷ԦDŽERRWKHDGR  RWRROVEXLOGWRROVEXLOGF㕆䈁⭏ᡀᢗ㹼〻ᒿ EXLOG ⲴભԔDŽ &)/$*6 ?  &&  WRROVEXLOGF⭡ WRROV ⴞᖅлⲴ EXLOGF 〻ᒿ⭏ᡀᢗ㹼〻ᒿ EXLOGDŽWRROVEXLOG  LI ,PDJHRI GHY36 GGEV ,PDJHGLVN 䇮༷᮷Ԧ DŽ൘ /LQX[ ㌫㔏л֯⭘GHYIGDŽ ᤷㅜањ䖟ⴈ傡ࣘಘ Ⲵ᮷ԦˈRI 㺘⽪䗃ࠪࡠⲴ᮷ԦDŽ䘉䟼GHY36 ᱟޕᔿॆDŽEV 㺘⽪а⅑䈫߉Ⲵᆇ㢲ᮠDŽLI 㺘⽪䗃 㺘⽪ GLVN 䘉њⴞḷ㾱⭡ ,PDJH ӗ⭏DŽGG Ѫ 81,; ḷ߶ભԔ˖༽ࡦањ᮷Ԧˈṩᦞ䘹亩䘋㹼䖜ᦒ઼Ṭ  V\QF 5227B'(9 !,PDJH WRROVEXLOGERRWERRWVHFWERRWVHWXSWRROVV\VWHP ERRWERRWVHFWERRWVHWXSWRROVV\VWHPWRROVEXLOG,PDJH ᒦᴤᯠ䎵㓗ඇDŽ ᮷Ԧ ,PDJHDŽㅜ  㹼Ⲵ V\QF ਼↕ભԔᱟ䘛֯㕃ߢඇᮠᦞ・ণ߉ⴈۿѪṩ᮷Ԧ㌫㔏䇮༷㓴㻵ᡀ޵Ṩ᱐  5227B'(9 ᖅлⲴ EXLOG ᐕާ〻ᒿ˄л䶒Պ䈤᰾ྲօ⭏ᡀ˅ሶ ERRWVHFWǃVHWXS ઼ V\VWHP ᮷Ԧԕ ᮷ԦǃWRROVⴞᖅѝⲴ V\VWHP ઼ EXLOG ᮷ԦDŽ 㹼䘉ᱟᢗ㹼ⲴભԔDŽ 㹼㺘⽪֯⭘ WRROV ⴞ 䈤᰾ⴞḷ˄,PDJH ᮷Ԧ˅ᱟ⭡߂ਧਾ䶒Ⲵ  њݳ㍐ӗ⭏ˈ࠶࡛ᱟ ERRWⴞᖅѝⲴ ERRWVHFW ઼ VHWXS  ,PDJHDOO 䖟ⴈⲴભԔ৲㿱  㹼DŽ'26 ㌫㔏лਟԕ֯⭘䖟Ԧ UDZULWHH[HDŽޕ/LQX[ лሶ ,PDJH ߉ 䖟ⴈቡਟԕ֯⭘䈕䖟ⴈᕅሬ /LQX[ ㌫㔏ҶDŽ൘ޕ᮷Ԧ ERRWLPDJHDŽ㤕ሶަ߉ۿণᱟᕅሬ੟ࣘⴈ᱐ 㺘⽪ࡋᔪ 0DNHILOH ᡰ⸕Ⲵᴰ亦ቲⲴⴞḷDŽ䘉䟼ণᱟ ,PDJH ᮷ԦDŽ䘉䟼⭏ᡀⲴ ,PDJH ᮷Ԧ DOO л䶒   R QRVWGLQF,LQFOXGHFR &)/$*6 ?  &&  FR R ⴞḷ᮷ԦDŽᮤਕ㺘⽪֯⭘ JFF ሶ & 䈝䀰᮷Ԧ㕆䈁ᡀⴞḷ᮷Ԧնн䘎᧕DŽ F ᮷ԦÆ ㊫լк䶒ˈ R $6 FR  VR ⴞḷ᮷ԦDŽF㺘⽪ਚ㕆䈁ᡆ≷㕆ˈնн䘋㹼䘎᧕᫽֌DŽ 㺘⽪ሶᡰᴹV ≷㕆〻ᒿ᮷Ԧ㕆䈁ᡀR ⴞḷ᮷ԦDŽᮤਕ㺘⽪֯⭘ JDV 㕆䈁ಘሶ≷㕆〻ᒿ㕆䈁ᡀR  V QRVWGLQF,LQFOXGH6R &)/$*6 ?  &&  FV ᱟ F ᮷Ԧˈࡉਟⴤ᧕֯⭘ㅜ  њ㿴ࡉDŽ ⭘ㅜањ㿴ࡉ˗㤕ⴞᖅᱟRˈ㘼৏᮷ԦᱟVˈࡉ֯⭘ㅜ  њ㿴ࡉ˗㤕ⴞḷᱟR ᮷Ԧ㘼৏᮷Ԧ л䶒䘉  њн਼㿴ࡉ࠶࡛⭘Ҿн਼Ⲵ᫽֌㾱≲DŽ㤕ⴞḷᱟV ᮷Ԧˈ㘼Ⓚ᮷ԦᱟF ᮷ԦࡉՊ֯ Ⲵ᮷ԦDŽ F ԓ㺘ㅜањݸߣᶑԦˈ䘉䟼ণᱟㅖਸᶑԦ   ˅ᱟ㠚ࣘⴞḷਈ䟿ˈ # ˄ᡆ V  㺘⽪ަਾᱟ䗃ࠪ᮷ԦⲴᖒᔿDŽަѝ R ਾ㔰DŽ V ޽࣐к ਾ F ᮷ԦሩᓄⲴ≷㕆䈝䀰ᖒᔿⲴԓ⸱᮷ԦDŽ唈䇔ᛵߥлᡰӗ⭏Ⲵ≷㕆〻ᒿ᮷Ԧᱟ৏ & ᮷Ԧ਽৫ᦹ Ⲵ਴њ &ޕӾ㘼ӗ⭏о䗃ˈ˅6˄→ڌ⭘ LQFOXGHⴞᖅѝⲴཤ᮷Ԧˈ൘䘲ᖃൠ㕆䈁ਾн䘋㹼≷㕆ቡ 㺘⽪л䶒ᱟ䈕㿴ࡉⲴભԔDŽᮤਕ㺘⽪䇙 JFF 䟷⭘ࡽ䶒 &)/$*6 ᡰᤷᇊⲴ䘹亩ԕ৺ӵ֯  ≷㕆〻ᒿDŽ  V ᮷Ԧ㕆䈁⭏ᡀ F л䶒ᱟ PDNH 㘱ᔿⲴ䳀ᔿਾ㔰㿴ࡉDŽ䈕㹼ᤷ⽪ PDNH ࡙⭘л䶒ⲴભԔሶᡰᴹⲴ  /,%6 OLEOLED⭡ OLEⴞᖅѝⲴ᮷Ԧᡰ㕆䈁⭏ᡀⲴ䙊⭘ᓃ᮷ԦDŽ 0$7+ NHUQHOPDWKPDWKDᮠᆖ䘀㇇ᓃ᮷ԦDŽ  OLQX[0DNHILOH ᮷Ԧ ?OVOWRROVV\VWHP_JUHSV\VWHP  HFKRQ6<66,=(  ERRWERRWVHFWVWRROVV\VWHPWPSV ࠪҶ V\VWHP ⁑ඇⲴањᴰབྷ唈䇔䮯ᓖ٬DŽഐ↔䘉њ㿴ࡉ⧠൘ᐢ㓿н䎧֌⭘DŽ 〻ᒿѝ֯⭘Ⲵᯩ⌅DŽӾ  ⡸޵Ṩᔰ࿻ᐢн֯⭘䘉њᯩ⌅ˈ㘼ᱟⴤ᧕൘ ERRWVHFWV 〻ᒿᔰ࿻༴㔉 ⌘᜿˖䘉ᱟ /LQX[ ѻࡽⲴ޵Ṩ⡸ᵜ˄˅㧧ਆ V\VWHP ⁑ඇ䮯ᓖᒦ␫࣐ࡠ ERRWVHFWV  㢲  ᆇ㢲DŽ ᇎ䱵䮯ᓖ ⭘Ҿ㧧ᗇ⭘þ㢲ÿ㺘⽪Ⲵ䮯ᓖؑ᚟ˈ ᆇㅖѢˈWU ⭘Ҿ৫䲔㹼ቮⲴഎ䖖ㅖDŽަѝ˖ ᆈ൘ WPSV Ѥᰦ᮷ԦѝDŽFXW ભԔ⭘Ҿ࢚࠷؍JUHS ભԔਆᗇࡇ㺘㹼к᮷Ԧᆇ㢲ᮠᆇ⇥ؑ᚟ˈᒦᇊੁ ਆᗇ V\VWHP 䮯ᓖⲴᯩ⌅ᱟ˖俆ݸ࡙⭘ભԔ OV ሩ㕆䈁⭏ᡀⲴ V\VWHP ⁑ඇ᮷Ԧ䘋㹼䮯ࡇ㺘ᱮ⽪ˈ⭘ ᴹĀ6<66,=( V\VWHP ᮷Ԧᇎ䱵䮯ᓖāа㹼ؑ᚟Ⲵ WPSV ᮷Ԧˈ❦ਾሶ ERRWVHFWV ᮷Ԧ␫࣐൘ަਾDŽ ൘ᢺ V\VWHP ⁑ඇ࣐䖭ࡠ޵ᆈᵏ䰤⭘Ҿᤷ᰾㌫㔏⁑ඇⲴ䮯ᓖDŽ␫࣐䈕㹼ؑ᚟Ⲵᯩ⌅ᱟ俆ݸ⭏ᡀਚਜ਼ V\VWHP ⁑ඇ᮷Ԧ䮯ᓖؑ᚟ˈ ޣ 㹼Ⲵ֌⭘ᱟ൘ ERRWVHFWV ᮷ᵜ〻ᒿᔰ࿻༴␫࣐а㹼ᴹ л䶒  /' VRERRWERRWVHFWERRWERRWVHFWR  $6 RERRWERRWVHFWRERRWERRWVHFWV  ERRWERRWVHFWV਼кDŽ⭏ᡀ ERRWVHFWR ⻱ⴈᕅሬඇDŽERRWERRWVHFW  /' VRERRWVHWXSERRWVHWXSRV䘹亩㺘⽪㾱৫䲔ⴞḷ᮷ԦѝⲴㅖਧؑ᚟DŽ  $6 RERRWVHWXSRERRWVHWXSVሩ VHWXSV ᮷Ԧ䘋㹼㕆䈁⭏ᡀ VHWXS ᮷ԦDŽ  ERRWVHWXSV䘉䟼ᔰ࿻Ⲵй㹼ᱟ֯⭘  ≷㕆઼䘎᧕ಘERRWVHWXS   PDNHFGOLE  ᓃ࠭ᮠ OLEDOLEOLED   PDNHFGIV  ᮷Ԧ㌫㔏ⴞḷ⁑ඇ IVRIVIVR   PDNHFGPP  ޵ᆈ㇑⨶⁑ඇ PPRPPPPR   PDNHFGNHUQHO  ޵Ṩⴞḷ⁑ඇ NHUQHORNHUQHONHUQHOR   PDNHFGNHUQHOFKUBGUY  ⭏ᡀᆇㅖ䇮༷࠭ᮠ᮷Ԧ FKUBGUYDDŽNHUQHOFKUBGUYFKUBGUYD   PDNHFGNHUQHOEONBGUY  ⭏ᡀඇ䇮༷ᓃ᮷Ԧ EONBGUYDˈަѝਜ਼ᴹਟ䟽ᇊսⴞḷ᮷ԦDŽNHUQHOEONBGUYEONBGUYD   PDNHFGNHUQHOPDWK  NHUQHOPDWKPDWKD NHUQHOPDWKⴞᖅ˗䘀㹼 PDNH ᐕާ〻ᒿDŽ ޕᮠᆖॿ༴⨶࠭ᮠ᮷Ԧ PDWKD ⭡  㹼кⲴભԔᇎ⧠˖䘋  RWRROVV\VWHP!6\VWHPPDS /,%6 ?  0$7+ ?  '5,9(56 ?  $5&+,9(6 ?  /')/$*6 ERRWKHDGRLQLWPDLQR?  /'   /,%6  0$7+  '5,9(56  $5&+,9(6  ERRWKHDGRLQLWPDLQR?WRROVV\VWHP Ҿ 6\VWHPPDS ᮷ԦⲴ⭘䙄৲㿱⌘䟺ਾⲴ䈤᰾DŽޣ 䟽ᇊੁᆈ᭮൘ 6\VWHPPDS ᮷ԦѝDŽۿᴰਾⲴ!6\VWHPPDS㺘⽪ JOG 䴰㾱ሶ䘎᧕᱐  OLQX[0DNHILOH ᮷Ԧ ᆈⲴᯩ⌅ǃ޵ṨᘱḸ઼⭘ᡧᘱḸⲴ䇮㖞઼֯⭘ᯩ⌅ǃѝᯝᵪࡦǃ㌫㔏ᰦ䫏ᇊᰦԕ৺䘋〻ࡋᔪǃ䈳ᓖ઼㓸 ᵜㄐᾲ䘠Ҷ Linux ᰙᵏ᫽֌㌫㔏Ⲵ޵Ṩ⁑ᔿ઼փ㌫㔃ᶴDŽ俆ݸ㔉ࠪҶ Linux 0.11 ޵Ṩ֯⭘઼㇑⨶޵ 5.13 ᵢㄖቅ㔉  LQFOXGHVWGGHIKLQFOXGHVWGDUJKLQFOXGHIFQWOK LQFOXGHOLQX[PPKLQFOXGHVLJQDOKLQFOXGHDVPV\VWHPKLQFOXGHDVPLRK? LQFOXGHOLQX[VFKHGKLQFOXGHOLQX[KHDGKLQFOXGHOLQX[IVK? LQFOXGHXWLPHKLQFOXGHWLPHKLQFOXGHOLQX[WW\KLQFOXGHWHUPLRVK? LQFOXGHV\VW\SHVKLQFOXGHV\VWLPHVKLQFOXGHV\VXWVQDPHK? LQLWPDLQFLQFOXGHXQLVWGKLQFOXGHV\VVWDWK?LQLWPDLQR 'HSHQGHQFLHV   PDNHGHSFGPP   PDNHGHSFGNHUQHO  PDNHGHS ሩ IVⴞᖅлⲴ 0DNHILOH ᮷Ԧҏ֌਼ṧⲴ༴⨶DŽFGIV  FSWPSBPDNH0DNHILOH GRQH !!WPSBPDNH&33 0L GRHFKRQLQLWF IRULLQLQLW  0DNHILOH!WPSBPDNH ???'HSHQGHQFLHVT VHG Ⲵ٬DŽ L ᱟ䘉ਕࡽ䶒Ⲵ VKHOO ਈ䟿 L DŽ䘉䟼  L  ᇎ䱵кᱟ L  㹼кⲴ ❦ਾᢺ亴༴⨶㔃᷌䜭␫࣐ࡠѤᰦ᮷Ԧ WPSBPDNH ѝˈᴰਾሶ䈕Ѥᰦ᮷Ԧ༽ࡦᡀᯠⲴ 0DNHILOH ᮷ԦDŽ ㌫ˈণ䈕Ⓚ᮷Ԧѝवਜ਼Ⲵᡰᴹཤ᮷Ԧࡇ㺘DŽޣ㔃᷌ᖒᔿቡᱟ⴨ᓄⓀ〻ᒿ᮷ԦⲴⴞḷ᮷Ԧ਽࣐кަ׍䎆 ᙗⲴ㿴ࡉˈᒦф䘉Ӌ㿴ࡉㅖਸ PDNH 䈝⌅DŽሩҾ⇿ањⓀ᮷Ԧˈ亴༴⨶〻ᒿՊ䗃ࠪањ㿴ࡉˈަޣ⴨ ੺䇹亴༴⨶〻ᒿ FSS 䗃ࠪ᧿䘠⇿њⴞḷ᮷Ԧ 0 ਚᴹањ᮷Ԧ PDLQF˅ᢗ㹼 JFF 亴༴⨶᫽֌DŽḷᘇ ањѤᰦ᮷Ԧ WPSBPDNH˄ҏণ  㹼Ⲵ֌⭘˅DŽ❦ਾሩᤷᇊⴞᖅл˄LQLW˅Ⲵ⇿ањ & ᮷Ԧ˄ަᇎ 㹼ਾ䶒Ⲵᡰᴹ㹼ˈণࡐ䲔Ҷл䶒Ӿ  ᔰ࿻ࡠ᮷ԦᵛⲴᡰᴹ㹼ˈᒦ⭏ᡀ 'HSHQGHQFLHV ᮷Ԧѝ ֯⭘ᆇㅖѢ㕆䗁〻ᒿ VHG ሩ 0DNHILOH ᮷Ԧ˄䘉䟼ণᱟᵜ᮷Ԧ˅䘋㹼༴⨶ˈ䗃ࠪѪࡐ䲔Ҷ 0DNHILOH F ᮷ԦDŽާփᯩ⌅ྲл˖ Ⲵᡰᴹޣ㕆䈁о䈕ཤ᮷Ԧᴹ ㌫ˈ䟽ᯠޣᱟ੖䴰㾱䟽ᔪањⴞḷሩ䊑DŽ∄ྲᖃḀњཤ᮷Ԧ㻛᭩ࣘ䗷ਾˈPDNH ቡ㜭䙊䗷⭏ᡀⲴ׍䎆 ㌫ᱟѪҶ䇙 PDNH ભԔ⭘ᆳԜᶕ⺞ᇊޣ㌫DŽࡋᔪ䘉Ӌ׍䎆ޣ䈕ⴞḷᡆ㿴ࡉ⭘Ҿӗ⭏਴᮷Ԧѻ䰤Ⲵ׍䎆 GHS  V\QF䘛֯㕃ߢඇᮠᦞ・ণ߉ⴈᒦᴤᯠ⻱ⴈ䎵㓗ඇDŽ  WDUFIOLQX[_FRPSUHVV!EDFNXS=FG  FOHDQEDFNXS Ր䙂㔉঻㕙〻ᒿ FRPSUHVVˈᒦሶ঻㕙〻ᒿⲴ䗃ࠪᆈᡀ EDFNXS= ᮷ԦDŽ  _ 㺘⽪ሶ WDU 〻ᒿⲴᢗ㹼䙊䗷㇑䚃᫽֌ _FRPSUHVV 㺘⽪䴰㾱ࡋᔪᯠⲴᖂẓ᮷Ԧ FI 〻ᒿDŽ 㺘⽪ሩ OLQX[ⴞᖅᢗ㹼 WDU ᖂẓ WDUFIOLQX[ 㺘⽪䘰ࡠ OLQX[Ⲵка㓗˄⡦˅ⴞᖅ˗ FG  ঻㕙᮷ԦDŽ EDFNXS= 䈕㿴ࡉሶ俆ݸᢗ㹼к䶒Ⲵ FOHDQ 㿴ࡉˈ❦ਾሩ OLQX[ⴞᖅ䘋㹼঻㕙ˈ⭏ᡀ   PDNHFOHDQFGOLE   PDNHFOHDQFGNHUQHO   PDNHFOHDQFGIV  PPⴞᖅ˗ᢗ㹼䈕ⴞᖅ 0DNHILOH ᮷ԦѝⲴ FOHDQ 㿴ࡉDŽ ޕPDNHFOHDQ 䘋FGPP  R RWRROVV\VWHPWRROVEXLOGERRW UPILQLW UPI,PDJH6\VWHPPDSWPSBPDNHFRUHERRWERRWVHFWERRWVHWXS ᱟ᮷Ԧࡐ䲔ભԔˈ䘹亩I ਜ਼ѹᱟᘭ⮕нᆈ൘Ⲵ᮷Ԧˈᒦфнᱮ⽪ࡐ䲔ؑ᚟DŽ UP   㹼кⲴભԔˈ৫䲔ᡰᴹ㕆䈁䘎᧕⭏ᡀⲴ᮷ԦDŽ ᰦˈቡՊᢗ㹼 PDNHFOHDQ ᖃᢗ㹼FOHDQ  FDWERRWERRWVHFWV!!WPSV HFKR  !WPSV   ? _FXWF_WU  ᵜㄐሿ㔃 ᵜㄐ޵ᇩਟԕⴻ֌ᱟሩ Linux 0.11 ޵Ṩ䟽㾱ؑ᚟Ⲵᖂ㓣䈤᰾ˈഐ↔ਟ֌Ѫ䰵䈫ਾ㔝ㄐ㢲Ⲵ৲㘳޵ᇩDŽ ሩ޵ṨⓀԓ⸱䘋㹼⌘䟺DŽ ਼ᰦ䈤᰾Ҷ Linux 0.11 ᡰ֯⭘Ⲵⴞḷ᮷ԦṬᔿDŽᴰਾӾ Linux ޵ṨѫⴞᖅлⲴ makefile ᮷Ԧ⵰᡻ˈᔰ࿻ ㌫DŽޣ→ᯩ⌅DŽ❦ਾṩᦞⓀԓ⸱Ⲵⴞᖅ㔃ᶴᖒᔿˈ䈖㓶ൠӻ㓽Ҷ਴њᆀⴞᖅѝԓ⸱᮷ԦⲴสᵜ࣏㜭઼ቲ⅑  ᵜㄐሿ㔃 ࡠӾ޵ᆈൠ൰ 0x10000˄64KB˅ᔰ࿻༴ˈഐ↔Ӿᵪಘ࣐⭥ᔰ࿻亪ᒿᢗ㹼Ⲵ〻ᒿ㿱മ 6-1 ᡰ⽪DŽޕ䈫 ࡠ޵ᆈ 0x90200 ༴ˈ㘼޵ṨⲴަԆ䜘࠶˄system ⁑ඇ˅ࡉ㻛ޕ䇮༷ѝਾ 2KB ᆇ㢲ԓ⸱˄boot/setup.s˅䈫 ൰ 0x7C00˄31KB˅༴ˈᖃᆳ㻛ᢗ㹼ᰦቡՊᢺ㠚ᐡ〫ࣘࡠ޵ᆈ㔍ሩൠ൰ 0x90000˄576KB˅༴ˈᒦᢺ੟ࣘ ࡠ޵ᆈ㔍ሩൠޕ Linux Ⲵᴰᴰࡽ䶒䜘࠶ᱟ⭘ 8086 ≷㕆䈝䀰㕆߉Ⲵ˄boot/bootsect.s˅ˈᆳሶ⭡ BIOS 䈫 ࣘ䇮༷䙊ᑨᱟ䖟傡ᡆᱟ⺜ⴈDŽ䘉䟼Ⲵਉ䘠ᱟ䶎ᑨㆰঅⲴˈն䘉ᐢ㓿䏣ཏ⨶䀓޵Ṩࡍ࿻ॆⲴᐕ֌䗷〻ҶDŽ ޵ᆈ㔍ሩൠ൰ 0x7C00 ༴ˈᒦ䐣䖜ࡠ䘉њൠᯩDŽ੟ޕࣘ䇮༷Ⲵㅜањᡷ४˄⻱ⴈᕅሬᡷ४ˈ512 ᆇ㢲˅䈫 ൠ൰DŽPC ᵪⲴ BIOS ሶᢗ㹼ḀӋ㌫㔏ⲴỰ⍻ˈᒦ൘⢙⨶ൠ൰ 0 ༴ᔰ࿻ࡍ࿻ॆѝᯝੁ䟿DŽ↔ਾˈᆳሶਟ੟ ᇎ⁑ᔿˈᒦӾൠ൰ 0xFFFF0 ᔰ࿻㠚ࣘᢗ㹼〻ᒿԓ⸱ˈ䘉њൠ൰䙊ᑨᱟ ROM-BIOS ѝⲴޕCPU ሶ㠚ࣘ䘋 䘉䟼ݸᙫփ䈤᰾ал Linux ᫽֌㌫㔏੟ࣘ䜘࠶Ⲵѫ㾱ᢗ㹼⍱〻DŽᖃ PC Ⲵ⭥Ⓚᢃᔰਾˈ80x86 㔃ᶴⲴ 6.1 ᙱ։ࣕ㜳 㓿⨶䀓ࡽ䶒ࠐㄐⲴ޵ᇩˈ൘䰵䈫ԓ⸱ᰦᡁԜ޽ቡһ䇪һൠ䪸ሩާփ䰞仈䘋㹼䈖㓶䈤᰾DŽ ᣔ⁑ᔿлⲴ㕆〻৏⨶DŽᡰԕ൘ᔰ࿻䰵䈫Ⓚԓ⸱ѻࡽᓄ䈕ᐢ؍༴⨶ಘⲴ PC ᵪⲴփ㌫㔃ᶴԕ৺ 80386 32 ս 䰵䈫䘉Ӌԓ⸱䲔Ҷ䴰㾱⸕䚃аӋа㡜 8086 ≷㕆䈝䀰Ⲵ⸕䇶ԕཆˈ䘈㾱Ҷ䀓аӋ䟷⭘ Intel 80X86 ᗞ     VHWXSV E\WHV   E\WHV  KHDGV    ERRWVHFWVE\WHV *07  䈤᰾ ᆇ㢲  ᴰਾ؞᭩ᰦ䰤  ᮷Ԧ਽ 䮯ᓖ  ࡍ㺞 6-1 linux/boot/ⴤᖋ ⭘㔏аⲴ as ᶕ㕆߉DŽ֯ޘԓ⸱āሿ㢲DŽնⴤࡠ޵Ṩ⡸ᵜ 2.4.X 䎧ˈbootsect.s ઼ setup.s 〻ᒿ᡽ᆼ ᙗāа㢲ѝĀ㕆߉ 16 ս⢩ޣԔDŽ৲㿱 GNU ≷㕆ಘ᡻޼ljUsing as - The GNU AssemblerNJѝĀ80386 ⴨ лⲴ 16 սԓ⸱〻ᒿDŽⴤࡠ 1994 ᒤԕਾਁᐳⲴ GNU as ≷㕆ಘ᡽ᔰ࿻᭟ᤱ㕆䈁 16 սԓ⸱Ⲵ.code16 ՚ᤷ ≷㕆㕆䈁ಘӵ㜭᭟ᤱ i386 ৺ԕਾࠪⲴ CPU ԓ⸱ᤷԔˈ㤕н䟷⭘⢩↺ᯩ⌅ቡн㜭᭟ᤱ⭏ᡀ䘀㹼൘ᇎ⁑ᔿ Linus ᖃᰦ֯⭘є⿽≷㕆㕆䈁ಘⲴѫ㾱৏ഐ൘ҾሩҾ Intel x86 ༴⨶ಘ㌫ࡇᶕ䇢ˈLinus 䛓ᰦⲴ GNU AT&T 䈝⌅Ⲵ≷㕆䈝䀰〻ᒿDŽ ᣔ⁑ᔿлˈ䴰㾱⭘ GNU Ⲵ as˄gas˅䘋㹼㕆䈁DŽ䘉ᱟа⿽؍ࡉ֯⭘ GNU Ⲵ≷㕆〻ᒿṬᔿˈᒦф䘀㹼൘ ᒿˈ䟷⭘䘁լҾ Intel Ⲵ≷㕆䈝䀰䈝⌅ᒦф䴰㾱֯⭘ Intel 8086 ≷㕆㕆䈁ಘ઼䘎᧕ಘ as86 ઼ ld86ˈ㘼 head.s ᮷Ԧ㲭❦䜭ᱟ≷㕆〻ᒿˈնত֯⭘Ҷє⿽䈝⌅ṬᔿDŽbootsect.s ઼ setup.s ᱟᇎ⁑ᔿл䘀㹼Ⲵ 16 սԓ⸱〻 ᵜㄐѫ㾱᧿䘠 boot/ⴞᖅѝⲴйњ≷㕆ԓ⸱᮷Ԧˈ㿱ࡇ㺘 6-1 ᡰ⽪DŽ↓ྲ൘ࡽаㄐѝᨀࡠⲴˈ䘉йњ ㅜ6ㄐᕅሬ੟ࣘ〻ᒿ˄boot˅  ᙫփ࣏㜭 . ] ԓ⸱ᢗ㹼ս㖞㓯䐟 V\VWHP ⁑ඇѝⲴ KHDGV 〻ᒿ V\VWHP ⁑ඇ VHWXSV 〻ᒿ ERRWVHFWV 〻ᒿ  . [$  . [  . [ [  . [F       V\VWHP ⁑ඇ 520%,26 ERRWVHFW6 VHWXSV KHDGV PDLQF bootsect Ⲵԓ⸱ѪӰѸнᢺ㌫㔏⁑ඇⴤ᧕࣐䖭ࡠ⢙⨶ൠ൰ 0x0000 ᔰ࿻༴㘼㾱൘ setup 〻ᒿѝ޽䘋㹼 䘀䖜ѻࡽᱟ༴⨶нҶࠪ䭉ⲴDŽޘ൘᫽֌㌫㔏䘈⋑ᴹᆼ ѝⲴˈ䘉ਟ㜭ᱟᮤњ޵Ṩѝᴰᴹ䇰ソⲴԓ⸱ҶDŽ⌘᜿ྲ᷌൘ࡽ䘠ԫօа↕ѝࠪҶ䭉ˈ䇑㇇ᵪቡՊ↫䬱DŽ ⺞䇔ˈ࠶亥ᐕ֌ҏ䇮㖞ྭҶ˗ᴰ㓸䈳⭘ init/main.c ѝⲴ main()〻ᒿDŽк䘠᫽֌ⲴⓀԓ⸱ᱟ൘ boot/head.s ༴˅DŽ↔ᰦᡰᴹ 32 ս䘀㹼ᯩᔿⲴ䇮㖞੟ࣘ㻛ᆼᡀ: IDTǃGDT ԕ৺ LDT 㻛࣐䖭ˈ༴⨶ಘ઼ॿ༴⨶ಘҏᐢ ᣔ⁑ᔿᒦ䐣䖜㠣㌫㔏Ⲵ։л䜘࠶˄൘ 0x0000؍ޕᔿDŽ❦ਾሶᮤњ㌫㔏Ӿൠ൰ 0x10000 〫㠣 0x0000 ༴ˈ䘋 ੟ࣘ䜘࠶䇶࡛ѫᵪⲴḀӋ⢩ᙗԕ৺ VGA ঑Ⲵ㊫රDŽྲ᷌䴰㾱ˈᆳՊ㾱≲⭘ᡧѪ᧗ࡦਠ䘹ᤙᱮ⽪⁑ ഴ ੥ࣞᕋሲᰬ޻Ṯ൞޻ᆎѣⲺփ㖤ૂ〱ࣞ੄Ⲻփ㖤᛻߫  䀰〻ᒿDŽ ࣐䖭ᵏ䰤ሶᱮ⽪ؑ᚟"Loading..."DŽ❦ਾ᧗ࡦᵳሶՐ䙂㔉 boot/setup.s ѝⲴԓ⸱ˈ䘉ᱟਖањᇎ⁑ᔿ≷㕆䈝 ս㖞മDŽ൘㌫㔏ۿ〻ᒿᡆ⁑ඇ൘޵ᆈѝⲴࣘᘱս㖞DŽަѝˈ⇿аㄆᶑṶԓ㺘Ḁаᰦ࡫޵ᆈѝ਴〻ᒿⲴ᱐ ㅹҾᇎ䱵Ⲵ⢙⨶ൠ൰ˈׯҾሩ޵Ṩԓ⸱઼ᮠᦞ䘋㹼᫽֌DŽമ 6-2 ␵Რൠᱮ⽪ࠪ Linux ㌫㔏੟ࣘᰦ䘉ࠐњ ඇDŽਾ䶒 setup 〻ᒿሶՊᢺ system ⁑ඇ〫ࣘࡠ⢙⨶޵ᆈ䎧࿻ս㖞༴ˈ䘉ṧ system ⁑ඇѝԓ⸱Ⲵൠ൰ҏণ ൠ൰ 0x10000 ᔰ࿻ս㖞༴ᰦᒦнՊ㾶ⴆ൘ 0x90000˄576KB˅༴ᔰ࿻Ⲵ bootsect ઼ setup ⁑⨶⢙ޕ⁑ඇ䈫 ഐѪᖃᰦ system ⁑ඇⲴ䮯ᓖнՊ䎵䗷 0x80000 ᆇ㢲བྷሿ˄ণ 512KB˅ˈᡰԕ bootsect 〻ᒿᢺ system ഴ Ԅ㌱㔕ࣖ⭫䎭ᡶᢝ㺂ぁᓅⲺ亰ᓅ   ᙫփ࣏㜭 VHWXS ⁑ඇ ERRW ᡷ४  V\VWHP ⁑ඇ ぁᓅ 6-1 linux/boot/bootsect.s 6.2.2 ԙ⸷⌞䠀 ޽֌䈖㓶ӻ㓽DŽ Ԧ㌫㔏ˈӾ㘼ਟԕࡋᔪࠪ֯⭘অᕐ⻱ⴈቡ㜭䇙㌫㔏䘀䖜䎧ᶕⲴ䳶ᡀⴈᶕDŽ䘉ሶ൘ඇ䇮༷傡ࣘ〻ᒿаㄐѝ ਾⲴ 240 њᡷ४DŽ䘈࢙л 2630 ཊњᡷ४ᵚ㻛֯⭘DŽ䘉Ӌ࢙։Ⲵᵚ⭘オ䰤ਟ㻛࡙⭘ᶕᆈ᭮ањสᵜⲴṩ᮷ ަѝᕅሬ〻ᒿԓ⸱ঐ⭘ㅜ 1 њᡷ४ˈsetup ⁑ඇঐ⭘䲿ਾⲴ 4 њᡷ४ˈ㘼 0.11 ޵Ṩ system ⁑ඇབྷ㓖ঐ䲿 ᴹ 2880 њᡷ४ˈޡമѝ⽪ࠪҶ Linux 0.11 ޵Ṩ൘ 1.44MB ⻱ⴈкᡰঐᡷ४Ⲵ࠶ᐳᛵߥDŽ1.44MB ⻱ⴈ ഴ /LQX[ ޻Ṯ൞ 0% ⻷ⴎрⲺ࠼ᐹ᛻߫  setup ⁑ඇ઼ system ⁑ඇⲴᡷ४ս㖞઼བྷሿ⽪᜿മ㿱മ 6-3 ᡰ⽪DŽ ሬඇⲴ 508 ൠ൰༴)ˈᴰਾ䮯䐣䖜ࡠ setup 〻ᒿⲴᔰ࿻༴˄0x90200˅ᢗ㹼 setup 〻ᒿDŽ൘⻱ⴈкˈᕅሬඇǃ ᆈަ䇮༷ਧҾ root_dev(ᕅ؍ᆈⲴᕅሬⴈⲴ⇿⻱䚃ᡷ४ᮠࡔ࡛ࠪⴈⲴ㊫ර઼⿽㊫˄ᱟ 1.44M A ⴈੇ˛˅ᒦ ؍system ⁑ඇ࣐䖭ࡠ޵ᆈ 0x10000 ᔰ࿻ⲴൠᯩDŽ䲿ਾ⺞ᇊṩ᮷Ԧ㌫㔏Ⲵ䇮༷ਧˈ㤕⋑ᴹᤷᇊˈࡉṩᦞᡰ ࡽ੟ࣘᕅሬⴈⲴ৲ᮠˈ᧕⵰൘ቿᒅкᱮ⽪ĀLoading system...”ᆇㅖѢDŽ޽㘵ᢺ⻱ⴈк setup ⁑ඇਾ䶒Ⲵ 㘼ᡀ˅࣐䖭ࡠ޵ᆈ㍗᧕⵰ bootsect ਾ䶒ս㖞༴˄0x90200˅ˈ❦ਾ࡙⭘ BIOS ѝᯝ 0x13 ਆ⻱ⴈ৲ᮠ㺘ѝᖃ 㔗㔝ᢗ㹼DŽ䈕〻ᒿⲴѫ㾱֌⭘ᱟ俆ݸᢺӾ⻱ⴈㅜ 2 њᡷ४ᔰ࿻Ⲵ 4 њᡷ४Ⲵ setup ⁑ඇ˄⭡ setup.s 㕆䈁 0x7C00 ᔰ࿻༴ᒦᢗ㹼ѻDŽ൘ bootsect ԓ⸱ᢗ㹼ᵏ䰤ˈᆳՊሶ㠚ᐡ〫ࣘࡠ޵ᆈ㔍ሩൠ൰ 0x90000 ᔰ࿻༴ᒦ ㅜ 1 њᡷ४˅DŽ൘ PC ᵪ࣐⭥ ROM BIOS 㠚ỰਾˈROM BIOS Պᢺᕅሬᡷ४ԓ⸱ bootsect ࣐䖭ࡠ޵ᆈൠ൰ bootsect.s ԓ⸱ᱟ⻱ⴈᕅሬඇ〻ᒿˈ傫⮉൘⻱ⴈⲴㅜањᡷ४ѝ˄ᕅሬᡷ४ˈ0 ⻱䚃˄ḡ䶒˅ˈ0 ⻱ཤˈ 6.2.1 ࣕ㜳ᨅ䘦 6.2 bootsect.s ぁᓅ ༷ਧDŽ Ⲵ⌘䟺DŽ൘޵Ṩࡍ࿻ॆᰦՊ֯⭘㕆䈁޵Ṩᰦ᭮൘ᕅሬᡷ४ㅜ 509ǃ510˄0x1fc--0x1fd˅ᆇ㢲ѝⲴᤷᇊ䇮 ᯩˈbootsect.s 〻ᒿⲴㅜ 43 㹼к㔉ࠪҶṩ᮷Ԧ㌫㔏ᡰ൘Ⲵ唈䇔ඇ䇮༷ਧDŽඇ䇮༷ਧⲴਜ਼ѹ䈧৲㿱〻ᒿѝ ṩ᮷Ԧ㌫㔏䙊ᑨᱟ൘ਖањ䖟ⴈкᡆ㘵൘ањ⺜ⴈ࠶४ѝDŽѪҶ䙊⸕޵Ṩᡰ䴰㾱Ⲵṩ᮷Ԧ㌫㔏൘ӰѸൠ ㌫㔏䘈䴰㾱ᴹањสᵜⲴ᮷Ԧ㌫㔏᭟ᤱˈণṩ᮷Ԧ㌫㔏DŽLinux 0.11 ޵Ṩӵ᭟ᤱ MINIX Ⲵ 1.0 ᮷Ԧ㌫㔏DŽ ਖཆˈӵ൘޵ᆈѝ࣐䖭Ҷк䘠޵Ṩԓ⸱⁑ඇᒦн㜭䇙 Linux ㌫㔏䘀㹼䎧ᶕDŽ֌Ѫᆼᮤਟ䘀㹼Ⲵ Linux 0x400 ᆇ㢲(1KB)Ⲵѝᯝੁ䟿㺘ˈഐ↔䴰㾱൘֯⭘ᆼ BIOS Ⲵѝᯝ䈳⭘ਾ᡽㜭ሶ䘉њ४ฏ㾶ⴆᦹDŽ аӋ৲ᮠ˄ֻྲᱮ⽪঑⁑ᔿǃ⺜ⴈ৲ᮠ㺘ㅹ˅DŽᖃ BIOS ࡍ࿻ॆᰦՊ൘⢙⨶޵ᆈᔰ࿻༴᭮㖞ањབྷሿѪ 〫ࣘ઒˛䘉ᱟഐѪ൘䲿ਾᢗ㹼Ⲵ setup ԓ⸱ᔰ࿻䜘࠶䘈䴰㾱࡙⭘ ROM BIOS ѝⲴѝᯝ䈳⭘ᶕ㧧ਆᵪಘⲴ  ERRWVHFWV 〻ᒿ DŽаᶑ≷㕆䈝ਕ䙊ᑨ⭡ḷਧ˄ਟ䘹˅ǃ EHJWH[W ਖཆˈਾ䶒ᑖ߂ਧⲴᆇㅖѢᱟḷਧˈֻྲл䶒Ⲵ ൘а䎧DŽ䘉䟼ᢺйњ⇥䜭ᇊѹ൘਼а䟽ਐൠ൰㤳തѝˈഐ↔ᵜ〻ᒿᇎ䱵кн࠶⇥DŽ ཊњⴞḷ⁑ඇᰦˈ䬮᧕〻ᒿ˄OG˅ՊṩᦞᆳԜⲴ㊫࡛ᢺ਴њⴞḷ⁑ඇѝⲴ⴨ᓄ⇥࠶࡛㓴ਸ˄ਸᒦ˅ DŽWH[WǃGDWD ઼EVV ⭘Ҿ࠶࡛ᇊѹᖃࡽԓ⸱⇥ǃᮠᦞ⇥઼ᵚࡍ࿻ॆᮠᦞ⇥DŽ൘䬮᧕ޕҏᕪࡦᕅ ተⲴˈᒦфণ֯н֯⭘ޘ՚ᤷԔ˄՚᫽֌ㅖ˅JOREO ᡆJOREDO ⭘Ҿᇊѹ䲿ਾⲴḷ䇶ㅖᱟཆ䜘Ⲵᡆ  ᗇᖸᘛDŽڊਚ㾱ਟ㜭ˈ䙊䗷а⅑䈫ਆᡰᴹⲴᡷ४ˈ࣐䖭䗷〻ਟԕ ᗇཏㆰঅҶˈᡰԕᤱ㔝Ⲵ䈫ࠪ䭉ሶሬ㠤↫ᗚ⧟DŽਚ㜭᡻ᐕ䟽੟DŽڊ࣐䖭〻ᒿᐢ㓿  䏣ཏҶˈቔަᱟ䘉䟼⋑ᴹ䊑 PLQL[ ѝаṧवਜ਼㕃ߢ४儈䙏㕃ߢDŽ ᤱㆰঅ᰾ҶDŽ䘉ṧ .% Ⲵᴰབྷ޵Ṩ䮯ᓖᓄ䈕؍ሶᶕ䘉ҏᓄ䈕⋑ᴹ䰞仈ⲴDŽᡁᜣ䇙ᆳ .% ᆇ㢲ˈণ֯ᱟ൘   ⌘᜿ⴞࡽⲴ޵Ṩ㌫㔏ᴰབྷ䮯ᓖ䲀ࡦѪ  ᒦሶ V\VWHP ࣐䖭ࡠൠ൰ [ ༴DŽ .% ˈ [ ⴤ᧕࣐䖭ࡠ㠚ᐡⲴਾ䶒 VHWXS ᆳ❦ਾ֯⭘ %,26 ѝᯝሶ  .% ༴ˈᒦ䐣䖜㠣䛓䟼DŽ 〫ࡠҶൠ൰ [ .% ༴ˈᒦሶ㠚ᐡ ERRWVHFWV㻛 ELRV੟ࣘᆀ〻ᒿ࣐䖭㠣 [F  /LQXV7RUYDOGV⡸ᵳᡰᴹ & ERRWVHFWV ԕлᱟࡽ䶒䘉Ӌ᮷ᆇⲴ㘫䈁˖  ORDGVSUHWW\IDVWE\JHWWLQJZKROHVHFWRUVDWDWLPHZKHQHYHUSRVVLEOH UHDGHUURUVZLOOUHVXOWLQDXQEUHDNDEOHORRS5HERRWE\KDQG,W 7KHORDGHUKDVEHHQPDGHDVVLPSOHDVSRVVLEOHDQGFRQWLQXRV  EXIIHUFDFKHDVLQPLQL[ WFRQWDLQWKH NHUQHOVL]HVKRXOGEHHQRXJKHVSHFLDOO\DVWKLVGRHVQ SUREOHPHYHQLQWKHIXWXUH,ZDQWWRNHHSLWVLPSOH7KLVN% E\WHVORQJ7KLVVKRXOGEHQR 127(FXUUHQWO\V\VWHPLVDWPRVW  DW[XVLQJ%,26LQWHUUXSWV  DQGWKHV\VWHP[ GLUHFWO\DIWHULWVHOI VHWXS ,WWKHQORDGV  DQGMXPSVWKHUHLVHOIRXWRIWKHZD\WRDGGUHVV[ ERRWVHFWVLVORDGHGDW[FE\WKHELRVVWDUWXSURXWLQHVDQGPRYHV  /LQXV7RUYDOGV & ERRWVHFWV  6<66,=( [ ᰦˈ㺘⽪޵ṨᴰབྷѪ .%DŽ  㹼Ⲵ䈤᰾DŽᖃ䈕٬Ѫ [ ٬DŽ৏ᶕ৲㿱Ⲵ㠚ࣘӗ⭏䈝ਕ䘈⋑ᴹ㻛ࡐ䲔ˈ৲㿱〻ᒿ  ѝㅜ  㹼кⲴ䈝ਕࣘᘱ㠚ࣘӗ⭏DŽնӾ /LQX[ ⡸ᵜᔰ࿻ቡⴤ᧕൘䘉䟼㔉ࠪҶањᴰབྷ唈䇔 ㅜ 㕆䈁䘎᧕ਾ V\VWHP ⁑ඇⲴབྷሿDŽ䘉њㅹᔿĀ6<66,=( [ā৏ᶕᱟ⭡ OLQX[0DNHILOH ѝ ਟ〠Ѫㅖਧᑨ䟿DŽ䘉њᑨ䟿ᤷ᰾ˈ⭘Ҿᇊѹḷ䇶ㅖᡆḷਧᡰԓ㺘Ⲵ٬ (48 ᡆㅖਧ л䶒ㅹਧ  㺘⽪〻ᒿ⌘䟺䈝ਕⲴᔰ࿻DŽ  ᡆ࠶ਧ  䘉䟼ᝏ਩ਧ .%˅ˈሩҾᖃࡽⲴ⡸ᵜオ䰤ᐢ䏣ཏҶDŽ N%˄㤕ԕ  ᆇ㢲Ѫ .% 䇑ˈࡉᓄ䈕ᱟ [ ᆇ㢲 Ѫޡ ]6<6B6,=( ᱟ㾱࣐䖭Ⲵ㌫㔏⁑ඇ䮯ᓖˈঅսᱟ㢲ˈ ᆇ㢲Ѫ  㢲DŽ YHUVLRQVRIOLQX[ N%PRUHWKDQHQRXJKIRUFXUUHQW [LV[E\WHV E\WHV WREHORDGHG 6<6B6,=(LVWKHQXPEHURIFOLFNV    ERRWVHFWV 〻ᒿ ˗] PRYD[,1,76(*ሶ HV ⇥ᇴᆈಘ㖞Ѫ PRYGVD[ PRYD[%2276(*ሶ GV ⇥ᇴᆈಘ㖞Ѫ [&˗ VWDUW HQWU\VWDUW੺⸕䬮᧕〻ᒿˈ〻ᒿӾ VWDUW ḷਧᔰ࿻ᢗ㹼DŽ ˄ ᆇ㢲˅ˈ❦ਾ䐣䖜ࡠ〫ࣘਾԓ⸱Ⲵ JR ḷਧ༴ˈҏণᵜ〻ᒿⲴла䈝ਕ༴DŽ ᆇ  ޡˈ.% ༴ .% 〫ࣘࡠ [ ERRWVHFW Ӿⴞࡽ⇥ս㖞 [F  㹼֌⭘ᱟሶ㠚䓛 ՚ᤷԔ HQWU\ 䘛֯䬮᧕〻ᒿ൘⭏ᡀⲴᢗ㹼〻ᒿ˄DRXW˅ѝवਜ਼ᤷᇊⲴḷ䇶ㅖᡆḷਧDŽ   ⡸ਾቡᐢ㓿֯⭘о⧠൘޵Ṩ⴨਼Ⲵભ਽ᯩ⌅ҶDŽ Ӿ /LQX[ ޵Ṩ ㅜ  њⴈⲴㅜ  њ࠶४˗GHYKG[ Ă [GHYKGㅜ  њⴈⲴㅜ  њ࠶४˗ [GHYKGԓ㺘ᮤњㅜ  њ⺜ⴈ˗ [GHYKGㅜ  њⴈⲴㅜ  њ࠶४˗ Ă [GHYKGㅜ  њⴈⲴㅜ  њ࠶४˗ [GHYKGԓ㺘ᮤњㅜ  њ⺜ⴈ˗ ˄ѫ䇮༷ਧ˖޵ᆈ⻱ⴈ⺜ⴈWW\[WW\ᒦ㹼ਓ䶎ભ਽㇑䚃˅  PLQRU˅PDMRU  ⅑䇮༷ਧ˄ҏণ GHYBQR 䇮༷ਧ ѫ䇮༷ਧ ਧާփ٬Ⲵਜ਼ѹྲл˖ ㌫㔏ᡰ൘䇮༷ս㖞؞᭩䘉њ䇮༷ਧDŽ䘉њ䇮༷ਧᱟ /LQX[ ㌫㔏㘱ᔿⲴ⺜ⴈ䇮༷ਧભ਽ᯩᔿˈ⺜ⴈ䇮༷ Ҷ /LQX[ ㌫㔏ˈᡰԕ䘉䟼 5227B'(9 㻛䇮㖞Ѫ [DŽ൘㕆䈁䘉њ޵Ṩᰦ֐ਟԕṩᦞ㠚ᐡṩ᮷Ԧ 䇮༷ਧ [ ᤷᇊṩ᮷Ԧ㌫㔏䇮༷ᱟㅜ  њ⺜ⴈⲴㅜ  њ࠶४DŽᖃᒤ /LQXV ᱟ൘ㅜ  њ⺜ⴈкᆹ㻵 5227B'(9 [ ṩ᮷Ԧ㌫㔏䇮༷൘ㅜањ⺜ⴈⲴㅜањ࠶४кˈㅹㅹ˗ [ILUVWSDUWLWLRQRQILUVWGULYHHWF ṩ᮷Ԧ㌫㔏䇮༷֯⭘оᕅሬᰦ਼ṧⲴ䖟傡䇮༷˗ [VDPHW\SHRIIORSS\DVERRW5227B'(9  ࣐䖭Ⲵ⇥ൠ൰˗→ڌ (1'6(* 6<66(*6<66,=(ZKHUHWRVWRSORDGLQJ V\VWHP ⁑ඇ࣐䖭ࡠ [˄.%˅༴˗   6<66(* [V\VWHPORDGHGDW[ VHWXS 〻ᒿӾ䘉䟼ᔰ࿻˗ VHWXSVWDUWVKHUH6(7836(* [ ሶ ERRWVHFW 〫ࡠ䘉䟼䚯ᔰ˗ ZHPRYHERRWKHUHRXWRIWKHZD\,1,76(* [ ERRWVHFW Ⲵ৏࿻ൠ൰˄ᱟ⇥ൠ൰ˈԕл਼˅˗ %2276(* [FRULJLQDODGGUHVVRIERRWVHFWRU ˗٬ VHWXSVHFWRUV VHWXS 〻ᒿⲴᡷ४ᮠ 6(783/(1 QURIVHWXSVHFWRUV  WH[W᮷ᵜ⇥˗ EHJEVV %ORFN6WDUWHGE\6\PERO ˗ EVVᵚࡍ࿻ॆᮠᦞ⇥ EHJGDWD GDWDᮠᦞ⇥˗ EHJWH[W WH[W᮷ᵜ⇥˗ ተḷ䇶ㅖ˗ޘJOREOEHJWH[WEHJGDWDEHJEVVHQGWH[WHQGGDWDHQGEVVᇊѹҶ  њ 㖞Ⲵൠ൰ˈ䙊ᑨᤷ᰾ањ䐣䖜ᤷԔⲴⴞḷս㖞DŽ ᤷԔࣙ䇠ㅖ˄ᤷԔ਽˅઼᫽֌ᮠйњᆇ⇥㓴ᡀDŽḷਧսҾаᶑᤷԔⲴㅜањᆇ⇥DŽᆳԓ㺘ަᡰ൘ս  ERRWVHFWV 〻ᒿ ˖䘄എؑ᚟ DK [GO 傡ࣘಘਧ˄ྲ᷌ᱟ⺜ⴈࡉ㾱㖞ս  Ѫ ˅DŽ ਆ⻱ⴈ傡ࣘಘ৲ᮠ ,17[ 䈳⭘Ṭᔿ઼䘄എؑ᚟ྲл˖ ਆ⻱ⴈ傡ࣘಘⲴ৲ᮠˈ⢩࡛ᱟ⇿䚃Ⲵᡷ४ᮠ䟿DŽ *HWGLVNGULYHSDUDPHWHUVVSHFLILFDOO\QURIVHFWRUVWUDFN  RNBORDGBVHWXS  MORDGBVHWXSণ MPS ᤷԔDŽ LQW[ PRYD[[UHVHWWKHGLVNHWWH PRYG[[ሩ傡ࣘಘ  䘋㹼䈫᫽֌DŽ MQFRNBORDGBVHWXSRNFRQWLQXH LQW[UHDGLW PRYD[[6(783/(1VHUYLFHQURIVHFWRUV PRYE[[DGGUHVV LQ,1,76(* PRYF[[VHFWRUWUDFN PRYG[[GULYHKHDG ORDGBVHWXS E[Æᤷੁᮠᦞ㕃ߢ४˗ྲ᷌ࠪ䭉ࡉ &) ḷᘇ㖞սˈDK ѝᱟࠪ䭉⸱DŽHV GK ⻱ཤਧ˗GO 傡ࣘಘਧ˄ྲ᷌ᱟ⺜ⴈࡉս  㾱㖞ս˅˗ ս  ˗ ս  ˈ⻱䚃ਧ儈  ս ḡ䶒 ਧⲴվ  ս˗FO ᔰ࿻ᡷ४ FK ⻱䚃 DK [䈫⻱ⴈᡷ४ࡠ޵ᆈ˗DO 䴰㾱䈫ࠪⲴᡷ४ᮠ䟿˗ 䈫ᡷ४˖ 䟽䈅ˈ⋑ᴹ䘰䐟DŽ,17[ Ⲵ֯⭘ᯩ⌅ྲл˖ 䈫  њᡷ४DŽྲ᷌䈫ࠪ䭉ˈࡉ༽ս傡ࣘಘˈᒦޡˈ ᔰ࿻༴ᔰ࿻䈫ࡠ [  㹼Ⲵ⭘䙄ᱟ࡙⭘ %,26 ѝᯝ ,17[ ሶ VHWXS ⁑ඇӾ⻱ⴈㅜ  њᡷ४  ˅DŽ⌘᜿ HV ᐢ㓿䇮㖞ྭҶDŽ˄൘〫ࣘԓ⸱ᰦ HV ᐢ㓿ᤷੁⴞⲴ⇥ൠ൰༴ [ ൘ ERRWVHFW 〻ᒿඇਾ㍗ṩ⵰࣐䖭 VHWXS ⁑ඇⲴԓ⸱ᮠᦞDŽ LVDOUHDG\VHWXS HV 1RWHWKDW ORDGWKHVHWXSVHFWRUVGLUHFWO\DIWHUWKHERRWEORFN  PRYVS[))DUELWUDU\YDOXH!! PRYVVD[ [II˅༴DŽII˄ণ [IIሶึḸᤷ䪸 VS ᤷੁ [SXWVWDFNDW[ PRYHVD[ SXVKSRSFDOO ˈഐ↔ᗵ享䇮㖞ึḸDŽ PRYGVD[ʽ⭡Ҿ〻ᒿѝᴹḸ᫽֌  DŽ[ PRYD[FVሶ GVǃHV ઼ VV 䜭㖞ᡀ〫ࣘਾԓ⸱ᡰ൘Ⲵ⇥༴JR ᇎ䱵к %,26 ᢺᕅሬᡷ४࣐䖭ࡠ [F ༴ᒦᢺᢗ㹼ᵳӔ㔉ᕅሬ〻ᒿᰦˈVV [ˈVS [IIIHDŽ ึḸབྷሿ˅༴DŽ Ѫ  њᡷ४ˈഐ↔ VS 㾱ᤷੁབྷҾ˄[[  ൠ൰ᔰ࿻༴䘈㾱᭮㖞 VHWXS 〻ᒿˈ㘼↔ᰦ VHWXS 〻ᒿབྷ㓖˅༴䜭ਟԕDŽഐѪӾ [ൠ൰ [ ণ˄〫ٿ䘉⇥ԓ⸱䇮㖞ࠐњ⇥ᇴᆈಘˈवᤜḸᇴᆈಘ VV ઼ VSDŽḸᤷ䪸 VS ਚ㾱ᤷੁ䘌བྷҾ  ᆇ㢲  ս㖞༴Ⲵԓ⸱ѝᢗ㹼DŽӾл䶒ᔰ࿻ˈ&38 ൘ᐢ〫ࣘࡠ [  ൠ൰DŽ〫ٿ䖜ࡠⲴ⇥ൠ൰ˈḷਧ JR ᱟ⇥޵ MPSLJR,1,76(*⇥䰤䐣䖜˄-XPS,QWHUVHJPHQW˅DŽ䘉䟼 ,1,76(* ᤷࠪ䐣 PRYZণ PRYV ᤷԔDŽ䘉䟼Ӿ޵ᆈ>VL@༴〫ࣘ F[ њᆇࡠ>GL@༴DŽ ⴤࡠ F[  Ѫ→DŽˈUHS䟽༽ᢗ㹼ᒦ䙂߿ F[ Ⲵ٬ [GL [VXEGLGLⴞⲴൠ൰HV [VL [&VXEVLVLⓀൠ൰GV ᆇ˗  PRYF[䇮㖞〫ࣘ䇑ᮠ٬ PRYHVD[  ERRWVHFWV 〻ᒿ  GHSHQGLQJ  RUGHYDW 2WKHUZLVHHLWKHUGHY36   QRWKLQJLVGRQHDQGWKHJLYHQGHYLFHLVXVHG GHILQHG $IWHUWKDWZHFKHFNZKLFKURRWGHYLFHWRXVH,IWKHGHYLFHLV  䰝傡ࣘಘ傜䗮ˈ䘉ṧቡਟԕ⸕䚃傡ࣘಘⲴ⣦ᘱҶDŽޣFDOONLOOBPRWRU ᮠDŽ৲ޕFDOOUHDGBLW䈫⻱ⴈк V\VWHP ⁑ඇˈHV Ѫ䗃 PRYHVD[VHJPHQWRI[HV ᆈ᭮ V\VWHP Ⲵ⇥ൠ൰DŽ PRYD[6<66(*  ⧠൘ᔰ࿻ሶ V\VWHP ⁑ඇ࣐䖭ࡠ [˄.%˅ᔰ࿻༴DŽ  DW[ ZHZDQWWRORDGWKHV\VWHP YHZULWWHQWKHPHVVDJHQRZ RNZH  LQW[߉ᆇㅖѢᒦ〫ࣘݹḷࡠѢ㔃ቮ༴DŽ PRYD[[ZULWHVWULQJPRYHFXUVRU ES ᇴᆈಘሩᤷੁ㾱ᱮ⽪ⲴᆇㅖѢDŽPRYESPVJHV  QRUPDO PRYE[[SDJHDWWULEXWH ᱮ⽪  њᆇㅖDŽޡ]PRYF   DŽ׋ᱮ⽪Ѣ⭘DŽ LQW[GK 㹼˄˅˗GO ࡇ [RUEKEK俆ݸ䈫ݹḷս㖞DŽ䘄എݹḷս㖞٬൘ G[ ѝDŽ PRYDK[UHDGFXUVRUSRV  EO ᆇㅖ኎ᙗDŽGK 㹼ਧ˗GO ࡇਧDŽ ES↔ᇴᆈಘሩᤷੁ㾱ᱮ⽪ⲴᆇㅖѢ䎧࿻ս㖞༴DŽF[ ᱮ⽪ⲴᆇㅖѢᆇㅖᮠDŽEK ᱮ⽪亥䶒ਧ˗HV ൘ᆇㅖѢ㔃ቮ༴DŽڌݹḷˈDO ᭮㖞ݹḷⲴᯩᔿ৺㿴ᇊ኎ᙗDŽ[㺘⽪֯⭘ EO ѝⲴ኎ᙗ٬˖ޕ䗃 %,26 ѝᯝ [ ࣏㜭ਧDK [ˈᱮ⽪ᆇㅖѢDŽ  [ ᴰᐖ䗩 DŽ [ 亦ㄟ ˗GO ࡇਧ 䘄എ˖FK ᢛ᧿ᔰ࿻㓯˗FO ᢛ᧿㔃ᶏ㓯˗GK 㹼ਧ EK 亥ਧ˖ޕ䗃 %,26 ѝᯝ [ ࣏㜭ਧDK [ˈ䈫ݹḷս㖞DŽ ᱮ⽪वᤜഎ䖖઼ᦒ㹼᧗ࡦᆇㅖ൘޵Ⲵ  њᆇㅖDŽޡˈഎ䖖ᦒ㹼ā /RDGLQJV\VWHP ᱮ⽪ؑ᚟˖Ā 3ULQWVRPHLQDQHPHVVDJH  䘉䟼䟽ᯠ᭩എDŽˈPRYHVD[ഐѪк䶒ਆ⻱ⴈ৲ᮠѝᯝ᭩ᦹҶ HV Ⲵ٬ PRYD[,1,76(* PRYVHFWRUVF[ ഐ↔ FO Ⲵս  㛟ᇊѪ DŽ৸  㹼ᐢ㖞 FK ˈഐ↔↔ᰦ F[ ѝᱟ⇿⻱䚃ᡷ४ᮠDŽ ᆈ⇿⻱䚃ᡷ४ᮠDŽሩҾ䖟ⴈᶕ䈤˄GO ˅ˈަᴰབྷ⻱䚃ਧнՊ䎵䗷 ˈFK ᐢ㓿䏣ཏ㺘⽪ᆳˈ؍лਕ VHJFV ѝ↔༴ਟԕн֯⭘䈕ᤷԔDŽ ⭡Ҿᵜ〻ᒿԓ⸱઼ᮠᦞ䜭㻛䇮㖞༴Ҿ਼ањ⇥ѝˈণ⇥ᇴᆈಘ FV ઼ GVǃHV Ⲵ٬⴨਼ˈഐ↔ᵜ〻ᒿ л䶒ᤷԔ㺘⽪лаᶑ䈝ਕⲴ᫽֌ᮠ൘ FV ⇥ᇴᆈಘᡰᤷⲴ⇥ѝDŽᆳਚᖡ૽ަлаᶑ䈝ਕDŽᇎ䱵кˈ PRYFK[ LQW[ PRYD[[$+ LVJHWGULYHSDUDPHWHUV PRYGO[  GLÆ䖟傡⻱ⴈ৲ᮠ㺘DŽHV GK ᴰབྷ⻱ཤᮠˈGO 傡ࣘಘᮠ䟿ˈ   ս ս  ˈᴰབྷ⻱䚃ਧ儈  ս FK ᴰབྷ⻱䚃ਧⲴվ  սˈFO ⇿⻱䚃ᴰབྷᡷ४ᮠ DK ˈDO ˈEO 傡ࣘಘ㊫ර˄$736˅ ྲ᷌ࠪ䭉ࡉ &) 㖞սˈᒦф DK ⣦ᘱ⸱DŽ  ERRWVHFWV 〻ᒿ   ]\QRUPDOO HVVWDUWLQJDGGUHVVVHJPHQWLQ  SRVVLEOHORDGLQJZKROHWUDFNVZKHQHYHUZHFDQ QRN%ERXQGDULHVDUHFURVVHG:HWU\WRORDGLWDVIDVWDV 7KLVURXWLQHORDGVWKHV\VWHPDWDGGUHVV[PDNLQJVXUH  䰝䖟傡Ⲵ傜䗮DŽޣл䶒ᱟєњᆀ〻ᒿDŽUHDGBLW ⭘Ҿ䈫ਆ⻱ⴈкⲴ V\VWHP ⁑ඇDŽNLOOBPRWHU ⭘Ҿ  MPSL6(7836(*ࡠ↔ᵜ〻ᒿቡ㔃ᶏҶDŽ  VHWXSV 〻ᒿᔰ࿻༴ ৫ᢗ㹼DŽ ⇥䰤䐣䖜ᤷԔ˄-XPS,QWHUVHJPHQW˅DŽ䐣䖜ࡠ [ ࡠ↔ˈᡰᴹ〻ᒿ䜭࣐䖭ᆼ∅ˈᡁԜቡ䐣䖜ࡠ㻛࣐䖭൘ ERRWVHFW ਾ䶒Ⲵ VHWXS 〻ᒿ৫DŽ WKHERRWEORFN WKHVHWXSURXWLQHORDGHGGLUHFWO\DIWHU HYHU\WLQJORDGHG ZHMXPSWR DIWHUWKDW  ᆈࡠ URRWBGHY ѝDŽ؍PRYURRWBGHYD[ሶỰḕ䗷Ⲵ䇮༷ਧ VHJFV URRWBGHILQHG MPSXQGHIBURRW ྲ᷌䜭наṧˈࡉ↫ᗚ⧟˄↫ᵪ˅DŽXQGHIBURRW MHURRWBGHILQHG FPSE[ PRYD[[FGHY360% MHURRWBGHILQHGྲ᷌ㅹҾˈࡉ D[ ѝቡᱟᕅሬ傡ࣘಘⲴ䇮༷ਧDŽ  FPSE[ࡔᯝ⇿⻱䚃ᡷ४ᮠᱟ੖ PRYD[[GHYSV0% PRYE[VHFWRUV VHJFV VHFWRUV ˈࡉ䈤᰾ᱟ 0% 䖟傡DŽഐѪᱟਟᕅሬⲴ傡ࣘಘˈᡰԕ㛟ᇊᱟ $ 傡DŽ ᆈⲴ⇿⻱䚃ᡷ४ᮠDŽྲ᷌ VHFWRUV  ࡉ䈤᰾ᱟ 0% Ⲵ傡ࣘಘ˗ྲ᷌؍ਆк䶒ㅜ  㹼 MQHURRWBGHILQHG FPSD[  ᆇ㢲༴Ⲵṩ䇮༷ਧᒦࡔᯝᱟ੖ᐢ㻛ᇊѹDŽ PRYD[URRWBGHYਆ VHJFV  ᮷Ԧ ,PDJH Ⲵࡋᔪ〻ᒿ WRROVEXLOG Պ֯⭘֐ᤷᇊⲴ٬ᶕ䇮㖞֐Ⲵṩ᮷Ԧ㌫㔏ᡰ൘䇮༷ਧDŽ ۿ޵Ṩ᱐ˈ˄['[˅DŽᖃ㕆䈁޵Ṩᰦˈ֐ਟԕ൘ 0DNHILOH ᮷Ԧѝਖ㹼ᤷᇊ֐㠚ᐡⲴ٬ ˄[[˅DŽྲ᷌ṩ᮷Ԧ㌫㔏ᱟ൘ㅜ  њ %RFKV 䖟ⴈкˈ䛓Ѹ䈕٬ᓄ䈕Ѫ ['ˈণ ᭩DŽֻྲˈྲ᷌֐Ⲵṩ᮷Ԧ㌫㔏൘ㅜ  њ⺜ⴈⲴㅜ  њ࠶४кˈ䛓Ѹ䈕٬ᓄ䈕Ѫ [ˈণ ⴈㅜ  њ࠶४ѝᆈ᭮ṩ᮷Ԧ㌫㔏DŽ䘉њ٬䴰㾱ṩᦞ֐㠚ᐡṩ᮷Ԧ㌫㔏ᡰ൘⺜ⴈ઼࠶४䘋㹼؞ њ⺜ⴈㅜ  њ࠶४DŽ䘉䟼唈䇔Ѫ [ ᱟഐѪᖃᰦ/LQXVᔰਁ /LQX[ ㌫㔏ᰦᱟ൘ㅜ  њ⺜  ᆇ㢲༴ˈᤷṩ᮷Ԧ㌫㔏ᡰ൘䇮༷ਧDŽ[ ᤷㅜл䶒 URRWBGHY ᇊѹ൘ᕅሬᡷ४ ˈ  ᤷⲴᱟ 0%$ 傡ࣘಘˈަ䇮༷ਧᱟ [DŽ ਼⨶GHYDW  ᤷⲴᱟ 0%$ 傡ࣘಘަ䇮༷ਧᱟ [F  ˈᡰԕGHY36  ഐѪ QU Ѫ  ࠶࡛ሩᓄ䖟傡 $ǃ%ǃ& ᡆ '˗W\SH ᱟ䖟傡Ⲵ㊫ර˄Æ0% ᡆ Æ0% ㅹ˅DŽ QUˈަѝ ৲㿱ㅜ  㹼Ⲵ⌘䟺 ˈ⅑䇮༷ਧ W\SH  ൘ /LQX[ ѝ䖟傡Ⲵѫ䇮༷ਧᱟ к䶒а㹼ѝєњ䇮༷᮷ԦⲴਜ਼ѹ˖  DŽ  䘈ᱟGHYDW ⺞ᇊࡠᓅ֯⭘GHY36 ቡⴤ᧕֯⭘㔉ᇊⲴ䇮༷DŽ੖ࡉቡ䴰㾱ṩᦞ %,26 ᣕ੺Ⲵ⇿⻱䚃ᡷ४ᮠᶕ    ↔ਾˈᡁԜỰḕ㾱֯⭘ଚњṩ᮷Ԧ㌫㔏䇮༷˄ㆰ〠ṩ䇮༷˅DŽྲ᷌ᐢ㓿ᤷᇊҶ䇮༷ RQWKHQXPEHURIVHFWRUVWKDWWKH%,26UHSRUWVFXUUHQWO\  ERRWVHFWV 〻ᒿ DGGD[VUHDG࣐кᖃࡽ⻱䚃кᐢ㓿䈫ਆⲴᡷ४ᮠDŽ PRYF[D[F[ 䈕⅑᫽֌ᐢ䈫ਆⲴᡷ४ᮠDŽ FDOOUHDGBWUDFN䈫ᖃࡽ⻱䚃кᤷᇊᔰ࿻ᡷ४઼䴰䈫ᡷ४ᮠⲴᮠᦞDŽ ᴹᡷ४ᵚ䈫DŽҾᱟ䐣䖜ࡠ RNBUHDG ༴㔗㔝᫽֌DŽ кᐢ㓿䈫ਆⲴᡷ४ᮠᒦо⻱䚃ᴰབྷᡷ४ᮠ VHFWRUV ֌∄䖳DŽྲ᷌ሿҾ VHFWRUV 䈤᰾ᖃࡽ⻱䚃кⲴ䘈 E[ ᔰ࿻༴DŽ❦ਾ㔏䇑ᖃࡽ⻱䚃䈫ᖃࡽ⻱䚃кᤷᇊᔰ࿻ᡷ४˄FO˅઼䴰䈫ᡷ४ᮠ˄DO˅Ⲵᮠᦞࡠ HV RNBUHDG VKUD[ VXED[E[ [RUD[D[ ս㖞 ˈ޽䖜ᦒᡀ䴰䈫ਆⲴᡷ४ᮠDŽަѝ  ߿Ḁᮠቡᱟਆ䈕ᮠ .% Ⲵ㺕٬DŽ〫ٿ.%̢⇥޵䈫  Ⲵᆇ㢲ᮠ˖ޕ㤕࣐к↔⅑ሶ䈫⻱䚃кᡰᴹᵚ䈫ᡷ४ᰦՊ䎵䗷 .%ˈࡉ䇑㇇↔ᰦᴰཊ㜭䈫 MHRNBUHDG MQFRNBUHDG㤕⋑ᴹ䎵䗷 .% ᆇ㢲ˈࡉ䐣䖜㠣 RNBUHDG ༴ᢗ㹼DŽ Ⲵᆇ㢲ᮠDŽޕ䈫ޡDGGF[E[ ↔⅑䈫᫽֌ਾˈ⇥޵ E[ DŽ ٬〫ٿᆇ㢲⇥޵ᖃࡽ F[ F[VKOF[ PRYF[D[F[ D[ ᖃࡽ⻱䚃ᵚ䈫ᡷ४ᮠDŽ VXED[VUHDG߿৫ᖃࡽ⻱䚃ᐢ䈫ᡷ४ᮠDŽ PRYD[VHFWRUVਆ⇿⻱䚃ᡷ४ᮠDŽ VHJFV ս㖞 ˈ৽㇇ࠪ↔⅑䴰㾱䈫ਆⲴᡷ४ᮠDŽ〫ٿ⇥޵ .%̢ Ⲵᆇ㢲ᮠޕᡰ䈫ᙫᆇ㢲ᮠᱟ੖Պ䎵䗷 .% ⇥䮯ᓖⲴ䲀ࡦDŽ㤕Պ䎵䗷ˈࡉṩᦞ↔⅑ᴰཊ㜭䈫 䜘䈫ਆ䘉Ӌᵚ䈫ᡷ४ˈޘս㖞ˈ䇑㇇ྲ〫᷌ٿṩᦞᖃࡽ⻱䚃䘈ᵚ䈫ਆⲴᡷ४ᮠԕ৺⇥޵ᮠᦞᆇ㢲ᔰ࿻ 䇑㇇઼傼䇱ᖃࡽ⻱䚃䴰㾱䈫ਆⲴᡷ४ᮠˈ᭮൘ D[ ᇴᆈಘѝDŽ RNBUHDG UHW MERNBUHDG 䜘ᮠᦞ˛ޘFPSD[(1'6(*KDYHZHORDGHGDOO\HW"ᱟ੖ᐢ㓿࣐䖭Ҷ PRYD[HV нᱟቡ䐣䖜㠣л䶒 RNBUHDG ḷਧ༴㔗㔝䈫ᮠᦞDŽ੖ࡉ䘰ࠪᆀ〻ᒿ䘄എDŽ (1'6(* ˈྲ᷌ 䜘ᮠᦞDŽ∄䖳ᖃࡽᡰ䈫⇥ᱟ੖ቡᱟ㌫㔏ᮠᦞᵛㄟᡰ༴Ⲵ⇥ޘޕ᧕⵰ࡔᯝᱟ੖ᐢ㓿䈫 USBUHDG DŽ〫ٿ[RUE[E[E[LVVWDUWLQJDGGUHVVZLWKLQVHJPHQWE[Ѫ⇥޵ ٬ᗵ享սҾ .% ൠ൰䗩⭼ MQHGLHHVPXVWEHDWN%ERXQGDU\HVGLH WHVWD[[III PRYD[HV ᶑԦнᡀ・DŽ [III  [ˈҾᱟ =) ḷᘇ㖞սDŽ↔ᰦণлаᶑᤷԔ MQH [ WHVW ᤷԔⲴᢗ㹼㔃᷌ᱟ ሩᓄ∄⢩սѪ ˈ੖ࡉѪ DŽ䈕᫽֌㔃᷌ਚᖡ૽ḷᘇ˄䴦ḷᘇ =) ㅹ˅DŽֻྲˈ㤕 $; [ˈ䛓Ѹ  㹼кⲴᤷԔ WHVW ԕ∄⢩ս䙫䗁оєњ᫽֌ᮠDŽ㤕єњ᫽֌ᮠሩᓄⲴ∄⢩ս䜭Ѫ ˈࡉ㔃᷌٬Ⲵ ᗚ⧟DŽ␵ E[ ᇴᆈಘˈ⭘Ҿ㺘⽪ᖃࡽ⇥޵ᆈ᭮ᮠᦞⲴᔰ࿻ս㖞DŽ ↫ޕⲴᮠᦞᗵ享ᆈ᭮൘սҾ޵ᆈൠ൰ .% Ⲵ䗩⭼ᔰ࿻༴ˈ੖ࡉ䘋ޕ٬DŽӾⴈк䈫⇥Ⲵޕ俆ݸ⍻䈅䗃 UHDGBLW  ZRUGFXUUHQWWUDFNᖃࡽ⻱䚃ਧDŽWUDFN ZRUGFXUUHQWKHDGᖃࡽ⻱ཤਧDŽKHDG ZRUG6(783/(1VHFWRUVUHDGRIFXUUHQWWUDFNᖃࡽ⻱䚃ѝᐢ䈫ᡷ४ᮠDŽVUHDG 㺘⽪ᔰ࿻ᰦᐢ㓿䈫䘋  њᕅሬᡷ४઼ VHWXS 〻ᒿᡰঐⲴᡷ४ᮠ 6(783/(1DŽ 6(783/(1  л䶒՚᫽֌ㅖZRUG ᇊѹањ  ᆇ㢲ⴞḷDŽ⴨ᖃҾ & 䈝䀰〻ᒿѝᇊѹⲴਈ䟿઼ᡰঐ޵ᆈオ䰤བྷሿDŽ  䙊ᑨᱟ [˅˄٬⇥HV̢ᔰ࿻޵ᆈൠ൰˖ޕ䗃 ᡁԜ䈅മቭᘛൠ䘋㹼࣐䖭ˈਚ㾱ਟ㜭ˈቡ⇿⅑࣐䖭ᮤᶑ⻱䚃ⲴᮠᦞDŽ 䈕ᆀ〻ᒿሶ㌫㔏⁑ඇ࣐䖭ࡠ޵ᆈൠ൰ [ ༴ˈᒦ⺞ᇊ⋑ᴹ䐘䎺 .% Ⲵ޵ᆈ䗩⭼DŽ  ERRWVHFWV 〻ᒿ ]PRYDEDGBUW 䈫⻱ⴈ᫽֌ࠪ䭉DŽࡉᢗ㹼傡ࣘಘ༽ս᫽֌˄⻱ⴈѝᯝ࣏㜭ਧ ˅ˈ޽䐣䖜ࡠ UHDGBWUDFN ༴䟽䈅DŽ UHW SRSD[ SRSE[ SRSF[ SRSG[ MFEDGBUW㤕ࠪ䭉ˈࡉ䐣䖜㠣 EDGBUWDŽ LQW[ PRYDKDK ˈ䈫⻱ⴈᡷ४࣏㜭ਧDŽ DQGG[[⻱ཤਧнབྷҾ DŽ Ѫ  㺘⽪ᖃࡽ $ 傡ࣘಘ DŽ PRYGOGO 傡ࣘಘਧ PRYGKGOGK ⻱ཤਧDŽ PRYG[KHDGਆᖃࡽ⻱ཤਧDŽ PRYFKGOFK ᖃࡽ⻱䚃ਧDŽ LQFF[FO ᔰ࿻䈫ᡷ४DŽ PRYF[VUHDGਆᖃࡽ⻱䚃кᐢ䈫ᡷ४ᮠDŽ PRYG[WUDFNਆᖃࡽ⻱䚃ਧDŽ SXVKG[ SXVKF[ SXVKE[ SXVKD[ UHDGBWUDFN E[̢㕃ߢ४ᔰ࿻ս㖞DŽDO̢䴰䈫ᡷ४ᮠ˗HV LQW[ˈDK  Ⲵ䈤᰾DŽ E[ ᔰ࿻༴DŽ৲㿱ㅜ  㹼лሩ %,26 ⻱ⴈ䈫ѝᯝ䈫ᖃࡽ⻱䚃кᤷᇊᔰ࿻ᡷ४઼䴰䈫ᡷ४ᮠⲴᮠᦞࡠ HV UHDGBWUDFN ᆀ〻ᒿDŽ   㹼 ༴ˈ㔗㔝䈫ᮠᦞDŽ MPSUSBUHDG䐣䖜㠣 USBUHDG ٬DŽ〫ٿ[RUE[E[␵⇥޵ᮠᦞᔰ࿻ PRYHVD[ DGGD[[ሶ⇥ส൰䈳ᮤѪᤷੁлањ .% ޵ᆈᔰ࿻༴DŽ PRYD[HV ੖ࡉ䈤᰾ᐢ㓿䈫ਆ .% ᮠᦞDŽ↔ᰦ䈳ᮤᖃࡽ⇥ˈѪ䈫ла⇥ᮠᦞ֌߶༷DŽ MQFUSBUHDG DGGE[F[䈳ᮤᖃࡽ⇥޵ᮠᦞᔰ࿻ս㖞DŽ  ᆇ㢲DŽ к⅑ᐢ䈫ᡷ४ᮠVKOF[ ᆈᖃࡽ⻱䚃ᐢ䈫ᡷ४ᮠDŽ؍]PRYVUHDGD  㹼 ༴ˈ㔗㔝䈫ᮠᦞDŽ ࡉ䐣䖜ࡠ USBUHDGˈս㖞DŽ㤕ሿҾ .% 䗩⭼٬ ᆈᖃࡽ⻱䚃ᐢ䈫ᡷ४ᮠˈ❦ਾ䈳ᮤᆈ᭮ᮠᦞ༴Ⲵᔰ࿻؍ྲ᷌ᖃࡽ⻱䚃кⲴ䘈ᴹᵚ䈫ᡷ४ˈࡉ俆ݸ RNBUHDG [RUD[D[␵ᖃࡽ⻱䚃ᐢ䈫ᡷ४ᮠDŽ ᆈᖃࡽ⻱ཤਧDŽ؍]PRYKHDGD RNBUHDG LQFWUDFN੖ࡉ৫䈫ла⻱䚃DŽ MQHRNBUHDGྲ᷌ᱟ  ⻱ཤˈࡉ޽৫䈫  ⻱ཤ䶒кⲴᡷ४ᮠᦞDŽ VXED[KHDGࡔᯝᖃࡽ⻱ཤਧDŽ PRYD[ ᆼᡀˈࡉ৫䈫ла⻱䚃DŽ  ਧ⻱ཤ кⲴᮠᦞDŽྲ᷌ᐢ㓿 㤕䈕⻱䚃Ⲵᖃࡽ⻱ཤ䶒ᡰᴹᡷ४ᐢ㓿䈫ਆˈࡉ䈫䈕⻱䚃Ⲵла⻱ཤ䶒 MQHRNBUHDG FPSD[VHFWRUVྲ᷌ᖃࡽ⻱䚃кⲴ䘈ᴹᡷ४ᵚ䈫ˈࡉ䐣䖜ࡠ RNBUHDG ༴DŽ VHJFV  ERRWVHFWV 〻ᒿ  HQGEVV EVV HQGGDWD GDWD HQGWH[W WH[W  ZRUG[$$ ERRWBIODJ ᕅሬᡷ४Ⲵᴰਾєњᆇ㢲ѝDŽ л䶒ᱟ੟ࣘⴈާᴹᴹ᭸ᕅሬᡷ४ⲴḷᘇDŽӵ׋ %,26 ѝⲴ〻ᒿ࣐䖭ᕅሬᡷ४ᰦ䇶࡛֯⭘DŽᆳᗵ享սҾ  LQLWPDLQF ѝՊ⭘ DŽ ZRUG5227B'(9䘉䟼ᆈ᭮ṩ᮷Ԧ㌫㔏ᡰ൘䇮༷ਧ URRWBGHY RUJ [)& ᔰ࿻ˈᡰԕ URRWBGHY ൘੟ࣘᡷ४Ⲵㅜ  ᔰ࿻Ⲵ  њᆇ㢲ѝDŽ  㺘⽪л䶒䈝ਕӾൠ൰  њ $6&,, ⸱ᆇㅖDŽ  ޡE\WH DVFLL/RDGLQJV\VWHP E\WHഎ䖖ǃᦒ㹼Ⲵ $6&,, ⸱DŽ 䈳⭘ %,26 ѝᯝᱮ⽪Ⲵؑ᚟DŽPVJ  ZRUGᆈ᭮ᖃࡽ੟ࣘ䖟ⴈ⇿⻱䚃Ⲵᡷ४ᮠDŽ VHFWRUV  UHW SRSG[ RXWEሶ DO ѝⲴ޵ᇩ䗃ࠪࡠ G[ ᤷᇊⲴㄟਓ৫DŽ 䰝傜䗮DŽޣˈ≳䰝 )'&ˈ⾱→ '0$ ઼ѝᯝ䈧ޣˈPRYDO$ 傡ࣘಘ PRYG[[I䖟傡᧗ࡦ঑Ⲵᮠᆇ䗃ࠪᇴᆈಘ˄'25˅ㄟਓˈਚ߉DŽ SXVKG[ NLOOBPRWRU 䖟傡᧗ࡦ঑㕆〻Ⲵ䈖㓶ؑ᚟䈧৲㿱 NHUQHOEONBGUYIORSS\F 〻ᒿਾ䶒Ⲵ䈤᰾DŽޣ䰝傜䗮DŽᴹޣ ˈ≳䰝 )'&ˈ⾱→ '0$ ઼ѝᯝ䈧ޣˈቡᱟ⭘Ҿ䘹ᤙ $ 傡ࣘಘˈ٬  ㅜ  㹼к൘ DO ѝ䇮㖞ᒦ䗃ࠪⲴ ݱ䇨⾱→ '0$ ઼ѝᯝ䈧≲ԕ৺੟ࣘ༽ս䖟ⴈ᧗ࡦಘ )'&DŽս ս  ⭘Ҿ䘹ᤙ䘹ᤙ᫽֌Ⲵ䖟傡DŽ 䰝DŽս ս  ⭘Ҿޣањ  սⲴᇴᆈಘˈަս ս  ࠶࡛⭘Ҿ᧗ࡦ  њ䖟傡˄'$˅Ⲵ੟઼ࣘ I ᱟ䖟ⴈ᧗ࡦಘⲴањㄟਓˈ㻛〠Ѫᮠᆇ䗃ࠪᇴᆈಘ˄'25˅ㄟਓDŽᆳᱟ] л䶒ㅜ  㹼кⲴ٬   ⸕䚃ᆳᡰ༴Ⲵ⣦ᘱˈԕਾҏቡᰐ享ᣵᗳᆳҶDŽ  ޵Ṩਾቡ㜭ޕ䰝䖟傡Ⲵ傜䗮ˈ䘉ṧᡁԜ䘋ޣ䘉њᆀ〻ᒿ⭘Ҿ    WKDYHWRZRUU\DERXWLWODWHU GRQ  WKDWZHHQWHUWKHNHUQHOLQDNQRZQVWDWHDQG  7KLVSURFHGXUHWXUQVRIIWKHIORSS\GULYHPRWRUVR     MPSUHDGBWUDFN SRSD[ SRSE[ SRSF[ SRSG[ LQW[ PRYG[  ERRWVHFWV 〻ᒿ аӋᇎ傼DŽڊ⭘ bochs ⁑ᤏ㌫㔏Ӣ᡻ Ӿ䲿ਾḀаᤷᇊᡷ४ᔰ࿻ᆈ᭮DŽ䘉є⿽ᯩ⌅൷䴰㾱ሩԓ⸱䘋㹼аӋ؞᭩DŽ䈫㘵ਟԕ৲㘳ᴰਾаㄐ޵ᇩ֯ ᮷Ԧ Image ᭮൘࠶४ᔰ࿻ⲴаӋᡷ४ѝˈ㘼ṩ᮷Ԧ㌫㔏ࡉۿ᮷Ԧ㌫㔏㓴ਸᆈ᭮൘ањ࠶४ѝˈণ޵Ṩ᱐ ᮷Ԧ Image оṩۿࡠӾ⺜ⴈ੟ࣘ㌫㔏DŽਖањ࣎⌅ᱟᢺ޵Ṩ᱐ڊ൘ሩ bootsect.s 〻ᒿ֌ᴰቁ؞᭩Ⲵࡽᨀл ImageDŽ㘼⴨ᓄⲴṩ᮷Ԧ㌫㔏ࡉ᭮൘ਖཆањ࠶४ѝDŽ䘉ṧ㲭❦⎚䍩Ҷ⺜ⴈⲴ 4 њѫ࠶४ѻаˈնᓄ䈕㜭 ᮷ԦۿᡁᡰᜣࡠⲴ䀓ߣ࣎⌅ᴹєњDŽа⿽࣎⌅ᱟу䰘䇮㖞ањሿᇩ䟿Ⲵ⍫ࣘ࠶४ᶕᆈ᭮޵Ṩ᱐ ᆈDŽޡ ᮷Ԧ Image ۿᔰ࿻ᢗ㹼ѻDŽྲ᷌ⴤ᧕֯⭘䘉⿽ᯩᔿᶕᕅሬ㌫㔏ቡՊ⻠ࡠ䘉ṧањ䰞仈ˈণṩ᮷Ԧ㌫㔏н㜭о޵Ṩ᱐ ❦ਾṩᦞ MBR ѝ࠶४㺘ؑ᚟ᡰᤷ᰾⍫ࣘ࠶४ѝⲴㅜ 1 њᡷ४˄ᕅሬᡷ४˅࣐䖭ࡠ޵ᆈ 0x7c00 ༴ˈ❦ਾ Record˅Պ㻛 BIOS ࣐䖭ࡠ޵ᆈ 0x7c00 ༴ᒦᔰ࿻ᢗ㹼DŽ䈕〻ᒿՊ俆ݸᢺ㠚ᐡੁл〫ࣘࡠ޵ᆈ 0x600 ༴ˈ Ӿ⺜ⴈ੟ࣘⲴสᵜ⍱〻ᱟ˖㌫㔏к⭥ਾˈਟ੟ࣘ⺜ⴈⲴㅜ 1 њᡷ४˄ѫᕅሬ䇠ᖅ MBR - Master Boot ᮷ԦDŽۿ㔏DŽণ֐Ⲵᕅሬᡷ४〻ᒿ䴰㾱㜭ཏ䇶࡛ᒦ䇯䰞᮷Ԧ㌫㔏ˈᒦӾѝ䈫ਆ޵Ṩ᱐ ᮷Ԧ Image ༴Ҿ᮷Ԧ㌫㔏ѝⲴս㖞ԕ৺ᱟӰѸ᮷Ԧ㌫ۿ࠶४Ⲵṩ᮷Ԧ㌫㔏ѝDŽഐ↔֐ቡ䴰㾱⸕䚃޵Ṩ᱐ ᮷Ԧ Image Պᆈ᭮൘⍫ࣘۿbootsect 〻ᒿቡнՊ㻛ᢗ㹼ҶDŽഐѪྲ᷌Ӿ⺜ⴈ੟ࣘ㌫㔏ˈ䛓Ѹ䙊ᑨ޵Ṩ᱐ ShoelaceǃLILO ᡆ Grub ㅹཊ᫽֌㌫㔏ᕅሬ〻ᒿDŽ↔ᰦ bootsect.s ᡰᆼᡀⲴԫ࣑Պ⭡䘉Ӌ〻ᒿᶕᆼᡀDŽ 㤕䴰㾱Ӿ⺜ⴈ䇮༷੟ࣘ㌫㔏ˈ䛓Ѹ䙊ᑨ䴰㾱֯⭘ަԆཊ᫽֌㌫㔏ᕅሬ〻ᒿᶕᕅሬ㌫㔏࣐䖭DŽֻྲ 6.2.3.2 Ԅ⺢ⴎ੥ࣞ㌱㔕 䘉⿽✖⩀Ⲵભ਽ᯩᔿˈ㘼ᱟ֯⭘о⧠൘⴨਼Ⲵભ਽ᯩ⌅ҶDŽ ަѝ [ ઼ [ ᒦноଚњ࠶४ሩᓄˈ㘼ᱟԓ㺘ᮤњ⺜ⴈDŽӾ Linux ޵Ṩ 0.95 ⡸ਾᐢ㓿н֯⭘ 0x309 /dev/hd9 㺘⽪ㅜ 2 њ⺜ⴈⲴㅜ 4 њ࠶४ 0x306 /dev/hd6 㺘⽪ㅜ 2 њ⺜ⴈⲴㅜ 1 њ࠶४ 0x305 /dev/hd5 ԓ㺘ᮤњㅜ 2 њ⺜ⴈ 0x304 /dev/hd4 㺘⽪ㅜ 1 њ⺜ⴈⲴㅜ 4 њ࠶४ 0x301 /dev/hd1 㺘⽪ㅜ 1 њ⺜ⴈⲴㅜ 1 њ࠶४ 0x300 /dev/hd0 ԓ㺘ᮤњㅜ 1 њ⺜ⴈ 䙫䗁䇮༷ਧ ሩᓄ䇮༷᮷Ԧ 䈤᰾ 㺞 6–1 ⺢ⴎ䙱䗇䇴༽ਭ 䇮༷ਧ*256 + ⅑䇮༷ਧDŽєњ⺜ⴈⲴᡰᴹ䙫䗁䇮༷ਧ㿱㺘 6–1 ᡰ⽪DŽ ⺜ⴈ䘈׍ᦞ࠶४Ⲵн਼⭘⅑䇮༷ਧ䘋㹼ᤷᇊ࠶४DŽഐ↔⺜ⴈⲴ䙫䗁䇮༷ਧ⭡ԕлᯩᔿᶴᡀ˖䇮༷ਧ=ѫ 2-⻱ⴈǃ3-⺜ⴈǃ4-WW\[ǃ5-WW\ǃ6-ᒦ㹼ਓǃ7-䶎ભ਽㇑䚃DŽ⭡Ҿ 1 њ⺜ⴈѝਟԕᴹ 1--4 њ࠶४ˈഐ↔ 〻ᒿѝ⎹৺Ⲵ⺜ⴈ䇮༷ભ਽ᯩᔿྲл˖⺜ⴈⲴѫ䇮༷ਧᱟ 3DŽަᆳ䇮༷Ⲵѫ䇮༷ਧ࠶࡛Ѫ˖1-޵ᆈǃ 6.2.3.1 Linux 0.11 ⺢ⴎ䇴༽ਭ ṧDŽ ᤱ 0.11 ⡸ bootsect 〻ᒿⲴ⁑؍㔝䰵䈫ᵜҖDŽሩҾᴰᯠᔰਁⲴ Linux ޵Ṩˈ䘉⇥〻ᒿⲴ᭩ࣘҏᖸሿˈสᵜ ⸕䇶ˈ❦ਾ޽㔗ޣ᱃⨶䀓DŽ㤕↔ᰦ䰵䈫ӽᴹഠ䳮ˈ䛓Ѹᔪ䇞֐俆ݸ޽༽Ґал 80x86 ≷㕆৺ަ⺜ԦⲴ⴨ Ҷ޵Ṩ੟ࣘⲴ䈖㓶䗷〻ˈᖸᴹ৲㘳ԧ٬DŽ⭡Ҿ䘉⇥〻ᒿᱟ൘ 386 ᇎ⁑ᔿл䘀㹼Ⲵˈഐ↔⴨ሩᶕሶ∄䖳ᇩ 㪇㘼⭡ᵜӪ㘫䈁ⲴljLinux ޵ṨⓀԓ⸱╛⑨NJаㇷ᮷ㄐ(http://oldlinux.org/Linux.old/docs/)∄䖳䈖㓶ൠ᧿䘠 ሩ bootsect.s 䘉⇥〻ᒿⲴ䈤᰾઼᧿䘠ˈ൘ӂ䘎㖁кਟԕᩌ㍒ࡠབྷ䟿Ⲵ䍴ᯉDŽަѝ Alessandro Rubini 6.2.3 ެԌؗᚥ  ERRWVHFWV 〻ᒿ 4 ㄐѝⲴ䈤᰾DŽ ṬᔿDŽLinux ޵Ṩԓ⸱ѝ⭘ࡠⲴԓ⸱⇥ǃᮠᦞ⇥᧿䘠ㅖⲴṬᔿ㿱മ 6-4 ᡰ⽪DŽަѝ਴ᆇ⇥Ⲵਜ਼ѹ䈧৲㿱ㅜ л䶒俆ݸㆰঅӻ㓽ал⇥᧿䘠ㅖⲴṬᔿǃ᧿䘠ㅖ㺘Ⲵ㔃ᶴ઼⇥䘹ᤙㅖ˄ᴹӋҖѝ〠ѻս䘹ᤙᆀ˅Ⲵ ṩᦞ޵ṨⲴ䴰㾱䟽ᯠ䇮㖞䘉Ӌ᧿䘠ㅖ㺘DŽ ㅖ㺘˄GDT˅ˈᒦ൘ GDT ѝ䇮㖞Ҷᖃࡽ޵Ṩԓ⸱⇥Ⲵ᧿䘠ㅖ઼ᮠᦞ⇥Ⲵ᧿䘠ㅖDŽл䶒൘ head.s 〻ᒿѝՊ ተ᧿䘠ޘ઼˅ᣔ⁑ᔿл䘀㹼ˈ൘ᵜ〻ᒿѝѤᰦ䇮㖞Ҷѝᯝ᧿䘠ㅖ㺘˄IDT؍ѪҶ㜭䇙 head.s ൘ 32 ս 䖜ࡠսҾ system ⁑ඇᴰࡽ䶒䜘࠶Ⲵ head.s 〻ᒿ㔗㔝䘀㹼DŽ ᣔ⁑ᔿ䘀㹼ˈᒦ䐣؍ս 32 ޕ0x20 - 0x2fDŽᴰਾ䇮㖞 CPU Ⲵ᧗ࡦᇴᆈಘ CR0˄ҏ〠ᵪಘ⣦ᘱᆇ˅ˈӾ㘼䘋 䘠ㅖ㺘ᇴᆈಘ(gdtr)ˈᔰ੟ A20 ൠ൰㓯ˈ䟽ᯠ䇮㖞єњѝᯝ᧗ࡦ㣟⡷ 8259Aˈሶ⺜Ԧѝᯝਧ䟽ᯠ䇮㖞Ѫ ተ᧿ޘ઼(512KB˅ᮤඇੁл〫ࣘࡠ޵ᆈ㔍ሩൠ൰ 0x00000 ༴DŽ᧕лᶕ࣐䖭ѝᯝ᧿䘠ㅖ㺘ᇴᆈಘ(idtr˖٬ ↔❦ਾ setup 〻ᒿሶ system ⁑ඇӾ 0x10000-0x8ffff˄ᖃᰦ䇔Ѫ޵Ṩ㌫㔏⁑ඇ system Ⲵ䮯ᓖнՊ䎵䗷 0x901FC 2 ṩ䇮༷ਧ ṩ᮷Ԧ㌫㔏ᡰ൘Ⲵ䇮༷ਧ˄bootsec.s ѝ䇮㖞˅ 0x90090 16 ⺜ⴈ৲ᮠ㺘 ㅜ 2 њ⺜ⴈⲴ৲ᮠ㺘˄ྲ᷌⋑ᴹˈࡉ␵䴦˅ 0x90080 16 ⺜ⴈ৲ᮠ㺘 ㅜ 1 њ⺜ⴈⲴ৲ᮠ㺘 ... 0x9000C 2 ⢩ᙗ৲ᮠ ᱮ⽪঑⢩ᙗ৲ᮠ 0x9000B 1 ᱮ⽪⣦ᘱ 0x00-ᖙ㢢,I/O=0x3dX˗0x01-অ㢢,I/O=0x3bX 0x9000A 1 ᱮ⽪޵ᆈ ᱮ⽪޵ᆈ(0x00-64k,0x01-128k,0x02-192k,0x03=256k) 0x90008 2 ?? 0x90007 1 ᆇㅖࡇᮠ 0x90006 1 ᱮ⽪⁑ᔿ 0x90004 2 ᱮ⽪亥䶒 ᖃࡽᱮ⽪亥䶒 KB˅DŽ˄0x90002 2 ᢙኅ޵ᆈᮠ ㌫㔏Ӿ 1MB ᔰ࿻Ⲵᢙኅ޵ᆈᮠ٬ 0x90000 2 ݹḷս㖞 ࡇਧ˄0x00-ᴰᐖㄟ˅ˈ㹼ਧ˄0x00-ᴰ亦ㄟ˅ ޵ᆈൠ൰ 䮯ᓖ(ᆇ㢲) ਽〠 ᧿䘠 㺞 āVHWXS ぁᓅ䈱਌ᒬؓ⮏Ⲻ৸ᮦ 〻ᒿㅹDŽ 〻ᒿ֯⭘ˈֻྲᆇㅖ䇮༷傡ࣘ〻ᒿ䳶ѝⲴ console.c ઼ tty_io.cޣ㖞㿱㺘 6̢2 ᡰ⽪DŽ䘉Ӌ৲ᮠሶ㻛޵Ṩѝ⴨ ⮉Ⲵ޵ᆈս؍ᆈࡠ 0x90000 ᔰ࿻Ⲵս㖞˄㾶ⴆᦹҶ bootsect 〻ᒿᡰ൘Ⲵൠᯩ˅ˈᡰਆᗇⲴ৲ᮠ઼؍Ӌᮠᦞ setup.s ᱟањ᫽֌㌫㔏࣐䖭〻ᒿˈᆳⲴѫ㾱֌⭘ᱟ࡙⭘ ROM BIOS ѝᯝ䈫ਆᵪಘ㌫㔏ᮠᦞˈᒦሶ䘉 6.3.1 ࣕ㜳ᨅ䘦 6.3 setup.s ぁᓅ  VHWXSV 〻ᒿ 3  ᆈ൘ :  ਟ߉ /,0,7  ⇥䲀䮯 5  ਟ䈫 *  仇㋂ᓖ (  ᢙኅᯩੁ 3/  ᧿䘠ㅖ⢩ᵳ㓗' '  唈䇔٬ 5& $ :( $ ԓ⸱⇥᧿䘠ㅖ ᮠᦞ⇥᧿䘠ㅖ   %DVH$GGUHVV สൠ൰ 6HJPHQW/LPLW ⇥䲀䮯  '3/   ⇥䲀䮯 / 9 $ ' 3  *         7<3( %DVH สൠ൰ %DVH สൠ൰            %DVH$GGUHVV สൠ൰ 6HJPHQW/LPLW ⇥䲀䮯  '3/   ⇥䲀䮯 / 9 $ % 3  *         7<3( %DVH สൠ൰ %DVH สൠ൰          & а㠤ԓ⸱⇥ % 唈䇔བྷሿ $9/ 䖟Ԧਟ⭘ս $ ᐢ䇯䰞 㺘ᒦф㍒ᕅަѝⲴањ᧿䘠ㅖ亩ᆼᡀⲴDŽമ 6-5 ⽪ࠪҶ䘹ᤙㅖⲴṬᔿDŽ 䘉䟼޽ሩ䘹ᤙㅖ䘋㹼аӋ䈤᰾DŽ䙫䗁ൠ൰Ⲵ䘹ᤙㅖ䜘࠶⭘Ҿᤷᇊа᧿䘠ㅖˈᆳᱟ䙊䗷ᤷᇊа᧿䘠ㅖ ᓖᱟ 4KBDŽ ⽪䈕⇥ᆈ൘Ҿ޵ᆈѝǃ⇥Ⲵ⢩ᵳ㓗࡛Ѫ 0ǃ⇥㊫රᱟਟ䈫ਟ߉Ⲵᮠᦞ⇥ˈ⇥ԓ⸱ᱟ 32 սⲴᒦф⇥Ⲵ仇㋂ 0x92 㺘 0x00C09200000007FFˈ㺘⽪ᮠᦞ⇥Ⲵ䲀䮯ᱟ 8MBˈ⇥൘㓯ᙗൠ൰オ䰤ѝⲴส൰ᱟ 0ˈ⇥㊫ර٬ Ѫ 0ǃ⇥㊫රᱟਟ䈫ਟᢗ㹼Ⲵԓ⸱⇥ˈ⇥ԓ⸱ᱟ 32 սⲴᒦф⇥Ⲵ仇㋂ᓖᱟ 4KBDŽᮠᦞ⇥᧿䘠ㅖⲴ٬ᱟ 0x9A 㺘⽪䈕⇥ᆈ൘Ҿ޵ᆈѝǃ⇥Ⲵ⢩ᵳ㓗࡛ ᔰ࿻㇇䎧Ⲵ˅ˈ⇥൘㓯ᙗൠ൰オ䰤ѝⲴส൰ᱟ 0ˈ⇥㊫ර٬ 0x00C09A00000007FFˈ㺘⽪ԓ⸱⇥Ⲵ䲀䮯ᱟ 8MB˄=(0x7FF + 1) * 4KBˈ䘉䟼࣐ 1 ᱟഐѪ䲀䮯٬ᱟӾ 0 ֻྲˈsetup.s 〻ᒿ䇮㖞Ⲵ GDT ᧿䘠ㅖ亩˄㿱〻ᒿㅜ 207--216 㹼˅ˈԓ⸱⇥᧿䘠ㅖⲴ٬ᱟ ㅖ亩ᓄ䈕ሩᓄањተ䜘᧿䘠ㅖ㺘DŽ ተ᧿䘠ㅖ㺘 GDT ѝањ᧿䘠ㅖ亩Ⲵ䘹ᤙㅖDŽ䈕䘹ᤙㅖᡰሩᓄⲴ GDT 㺘ѝⲴ᧿䘠ޘ⽪ᆇ㢲Ⲵ᫽֌ᮠˈ㺘 4 њᆇ㢲ᱟ᧿䘠ㅖ㺘Ⲵสൠ൰DŽ❦㘼䈧⌘᜿ˈ䇯䰞 LDTR ᇴᆈಘⲴᤷԔ lldt ᡰ֯⭘Ⲵ᫽֌ᮠতᱟањ 2 ᇴᆈಘDŽlgdt ֯⭘޵ᆈѝањ 6 ᆇ㢲᫽֌ᮠᶕ࣐䖭 GDTR ᇴᆈಘDŽཤєњᆇ㢲ԓ㺘᧿䘠ㅖ㺘Ⲵ䮯ᓖˈਾ ᧿䘠ㅖ㺘Ⲵสൠ൰઼㺘Ⲵ䮯ᓖDŽᤷԔ lgdt ઼ sgdt ⭘Ҿ䇯䰞 GDTR ᇴᆈಘ˗ᤷԔ lldt ઼ sldt ⭘Ҿ䇯䰞 LDTR ᆈҶ؍䗷֯⭘ GDTR ઼ LDTR ᇴᆈಘᶕᇊս GDT 㺘઼ᖃࡽⲴ LDT 㺘DŽ䘉єњᇴᆈಘԕ㓯ᙗൠ൰Ⲵᯩᔿ ተ᧿䘠ㅖ㺘˄Global descriptor table – GDT˅઼ተ䜘᧿䘠ㅖ㺘˄Local descriptor table – LDT˅DŽ༴⨶ಘᱟ䙊 ޘ˖⇥᧿䘠ㅖᆈ᭮൘᧿䘠ㅖ㺘ѝDŽ᧿䘠ㅖ㺘ަᇎቡᱟ޵ᆈѝ᧿䘠ㅖ亩Ⲵањ䱥ࡇDŽ᧿䘠ㅖ㺘ᴹє㊫ ഴ ぁᓅԙ⸷⇫ૂᮦᦤ⇫Ⲻᨅ䘦ㅜṲᕅ   VHWXSV 〻ᒿ 7, 53/᧿䘠ㅖ㍒ᕅ  WKLVLVWKHFXUUHQWVHJPHQWᵜ〻ᒿᡰ൘Ⲵ⇥ൠ൰DŽ6(7836(* [ .% ༴DŽ  V\VWHP ൘ [ 6<66(* [V\VWHPORDGHGDW[ ZHPRYHERRWKHUHRXWRIWKHZD\৏ᶕ ERRWVHFW ᡰ༴Ⲵ⇥DŽ,1,76(* [  ԕл䘉Ӌ৲ᮠᴰྭ઼ ERRWVHFWV ѝⲴ⴨਼ʽ 127(7KHVHKDGEHWWHUEHWKHVDPHDVLQERRWVHFWV  ᣔ⁑ᔿⲴ V\VWHP 䈫ਆDŽ؍Ⲵൠᯩˈ❦ਾ൘㻛㕃ߢඇ㾶ⴆᦹѻࡽ⭡ ))ˈҏণ৏ᶕ ERRWVHFW ԓ⸱ඇᴮ㓿൘[Ⲵāൠᯩ˖[ޘĀᆹ ޵ᆈ⻱ⴈަԆ৲ᮠˈᒦሶ䘉Ӌ৲ᮠ᭮ࡠањޣ䘉⇥ԓ⸱䈒䰞 ELRV ᴹ  ൠᯩDŽ↔ᰦ VHWXSV ઼ V\VWHP ᐢ㓿⭡ ERRWVHFW ᕅሬඇ࣐䖭ࡠ޵ᆈѝDŽ VHWXSV 䍏䍓Ӿ %,26 ѝ㧧ਆ㌫㔏ᮠᦞˈᒦሶ䘉Ӌᮠᦞ᭮ࡠ㌫㔏޵ᆈⲴ䘲ᖃ  IRUEXIIHUEORFNV V\VWHPWRUHDGWKHPIURPWKHUHEHIRUHWKHDUHDLVRYHUZULWWHQ ERRWEORFNXVHGWREH,WLVWKHQXSWRWKHSURWHFWHGPRGH ))LHZKHUHWKH[[SXWVWKHPLQDVDIHSODFH 7KLVFRGHDVNVWKHELRVIRUPHPRU\GLVNRWKHUSDUDPHWHUVDQG  ERWKVHWXSVDQGV\VWHPKDVEHHQORDGHGE\WKHERRWEORFN DQGSXWWLQJWKHPLQWRWKHDSSURSULDWHSODFHVLQV\VWHPPHPRU\ VHWXSVLVUHVSRQVLEOHIRUJHWWLQJWKHV\VWHPGDWDIURPWKH%,26  /LQXV7RUYDOGV & VHWXSV   ぁᓅ 6-2 linux/boot/setup.s 6.3.2 ԙ⸷⌞䠀 ᣔ䘀㹼⁑ᔿDŽ؍ս 32 ޕᣔ⁑ᔿḷᘇ㖞սণਟ䘋 ؍gdtr ᇴᆈಘ˅DŽ޽ሶᵪಘ⣦ᘱᆇⲴ ޕ֯⭘ᤷԔ lgdt ᢺ᧿䘠ㅖ㺘Ⲵสൠ൰੺⸕ CPU˄GDT 㺘Ⲵสൠ൰ᆈ ተ᧿䘠ㅖ㺘 GDTDŽ❦ਾޘྲֻˈᣔ⁑ᔿѻࡽˈᡁԜᗵ享俆ݸ䇮㖞ྭሶ㾱⭘ࡠⲴ⇥᧿䘠ㅖ㺘؍ޕ൘䘋 ᜿ཆⲴᕅ⭘ᶕ䈤ˈ䘉њ⢩ᙗᱟᖸᴹ⭘ⲴDŽޕӗ⭏ањᔲᑨDŽሩҾࡍ࿻ॆ䘈ᵚ֯⭘Ⲵ⇥ᇴᆈಘԕ䲧 ᡆ SS˅࣐䖭Ҷањオ䘹ᤙㅖᰦˈ༴⨶ಘᒦнՊӗ⭏ањᔲᑨDŽնᱟ㤕֯⭘䘉њ⇥ᇴᆈಘ䇯䰞޵ᆈᰦቡՊ ㅖ˄ҏণᤷੁ GDT Ⲵㅜа亩Ⲵ䘹ᤙㅖ˅ਟԕ⭘֌Ѫањオ(null)䘹ᤙㅖDŽᖃањ⇥ᇴᆈಘ˄н㜭ᱟ CS 0 ઼㺘ᤷ⽪ಘ٬ҏѪ 0 Ⲵ䘹ᤙ ⭡Ҿ GDT 㺘Ⲵㅜа亩(㍒ᕅ٬Ѫ 0)⋑ᴹ㻛֯⭘ˈഐ↔ањާᴹ㍒ᕅ٬ ᣔᵪࡦDŽ؍Privalege Level - RPL˅⭘Ҿ ٬Ѫ 1 㺘⽪ᤷᇊᖃࡽⲴ LDT 㺘DŽ䈧≲㘵⢩ᵳ㓗˄Requestor'sˈㅖᡰᕅ⭘Ⲵ᧿䘠ㅖ㺘DŽ٬Ѫ 0 㺘⽪ᤷᇊ GDT 㺘 ᒦ࣐к᧿䘠ㅖ㺘Ⲵสൠ൰ণਟ䇯䰞㺘ѝᤷᇊⲴ⇥᧿䘠ㅖDŽ㺘ᤷ⽪ಘ˄Table Indicator - TI˅⭘Ҿᤷᇊ䘹ᤙ Index˅⭘Ҿ䘹ᤙᤷᇊ᧿䘠ㅖ㺘ѝ 8192˄213˅њ᧿䘠ㅖѝⲴањDŽ༴⨶ಘሶ䈕㍒ᕅ٬҈к 8ˈ˄ަѝ㍒ᕅ٬ ഴ ⇫䘿᤟ㅜṲᕅ   VHWXSV 〻ᒿ FKHFNIRU(*$9*$DQGVRPHFRQILJSDUDPHWHUV  PRY>@D[DO YLGHRPRGHDK ZLQGRZZLGWK PRY>@E[EK GLVSOD\SDJH LQW[ PRYDK[I   ᆈ᭮ᆇㅖࡇᮠDŽ ᆈ᭮ᱮ⽪⁑ᔿ˗[ ᆇ ᆈ᭮ᖃࡽ亥˗[ [ 䘄എ˖DK ᆇㅖࡇᮠ˗DO ᱮ⽪⁑ᔿ˗EK ᖃࡽᱮ⽪亥DŽ 䈳⭘ %,26 ѝᯝ [ˈ࣏㜭ਧDK [I л䶒䘉⇥⭘Ҿਆᱮ⽪঑ᖃࡽᱮ⽪⁑ᔿDŽ *HWYLGHRFDUGGDWD   ༴˄ њᆇ˅DŽPRY>@D[ሶᢙኅ޵ᆈᮠ٬ᆈ൘ [ LQW[ PRYDK[  .% DŽ㤕ࠪ䭉ࡉ &) 㖞սˈD[ ࠪ䭉⸱DŽ 䘄എ˖D[ Ӿ [˄0˅༴ᔰ࿻Ⲵᢙኅ޵ᆈབྷሿ  ༴DŽᆈ൘޵ᆈ [؍࡙⭘ %,26 ѝᯝ [࣏㜭ਧ DK [ਆ㌫㔏ᡰਜ਼ᢙኅ޵ᆈབྷሿᒦ DŽ˅%.˄ਆᢙኅ޵ᆈⲴབྷሿ٬  H[WHQGHGPHPN% *HWPHPRU\VL]H  PRY>@G[LWIURP[ LQW[VDYHLWLQNQRZQSODFHFRQBLQLWIHWFKHV [RUEKEK PRYDK[UHDGFXUVRUSRV PRYGVD[ PRYD[,1,76(*WKLVLVGRQHLQERRWVHFWDOUHDG\EXW /LQXV 㿹ᗇ䴰㾱޽䟽ᯠ䇮㖞алDŽ  DŽ䘉ᐢ㓿൘ ERRWVHFW 〻ᒿѝ䇮㖞䗷ˈնᱟ⧠൘ᱟ VHWXS 〻ᒿˈ[ лਕሶ GV 㖞ᡀ ,1,76(*  [ ᴰᐖ䗩 DŽ [ 亦ㄟ ˗GO ࡇਧ 䘄എ˖FK ᢛ᧿ᔰ࿻㓯˗FO ᢛ᧿㔃ᶏ㓯˗GK 㹼ਧ EK 亥ਧ˖ޕ䗃 %,26 ѝᯝ [ ࣏㜭ਧDK [ˈ䈫ݹḷս㖞DŽ ᧗ࡦਠࡍ࿻ॆ〻ᒿՊࡠ↔༴䈫ਆ䈕٬DŽ  ༴˄ ᆇ㢲˅DŽᆈ൘޵ᆈ [؍䘉⇥ԓ⸱֯⭘ %,26 ѝᯝਆቿᒅᖃࡽݹḷս㖞˄ࡇǃ㹼˅ˈᒦ  ᆈݹḷս㖞ԕ༷Ӻਾ֯⭘DŽ؍RNˈᮤњ䈫⻱ⴈ䗷〻䜭ᖸ↓ᑨˈ⧠൘ SRVWHULW\ RNWKHUHDGZHQWZHOOVRZHJHWFXUUHQWFXUVRUSRVLWLRQDQGVDYHLWIRU  VWDUW HQWU\VWDUW  WH[W EHJEVV EVV EHJGDWD GDWD EHJWH[W WH[W JOREOEHJWH[WEHJGDWDEHJEVVHQGWH[WHQGGDWDHQGEVV   VHWXSV 〻ᒿ ]PRYGO PRYD[[  ᡆަԆਟ〫ࣘ䇮༷ ˈᴹ FKDQJHOLQH ᭟ᤱ˗ᱟ⺜ⴈDŽ ᱟ䖟傡 䗃ࠪ˖DK ㊫ර⸱˗⋑ᴹ䘉њⴈˈ&) 㖞ս˗ᱟ䖟傡ˈ⋑ᴹ FKDQJHOLQH ᭟ᤱ˗ GO 傡ࣘಘਧ˄[; ᱟ⺜ⴈ˖[ ᤷㅜ  њ⺜ⴈˈ[ ㅜ  њ⺜ⴈ˅˖ޕ䗃 ࡙⭘ %,26 ѝᯝ䈳⭘ [ Ⲵਆⴈ㊫ර࣏㜭ˈ࣏㜭ਧDK [˗ Ựḕ㌫㔏ᱟ੖ᴹㅜ  њ⺜ⴈDŽྲ᷌⋑ᴹࡉᢺㅜ  њ㺘␵䴦DŽ  &KHFNWKDWWKHUH,6DKG  PRYVE UHS PRYF[[ GLÎHV[[Ր䗃ⲴⴞⲴൠ൰PRYGL[ PRYHVD[ PRYD[,1,76(* VLҏণ KG ৲ᮠ㺘Ⲵൠ൰ÎGVˈ[@ਆѝᯝੁ䟿 [ Ⲵ٬ OGVVL> PRYGVD[ PRYD[[  *HWKGGDWD  PRYVE UHS Ր䗃  ᆇ㢲DŽޡ]]PRYF GL[ÎHV[PRYGL[Ր䗃ⲴⴞⲴൠ൰ PRYHVD[ PRYD[,1,76(* VLҏণ KG ৲ᮠ㺘Ⲵൠ൰ÎGVˈ[@ਆѝᯝੁ䟿 [ Ⲵ٬ OGVVL> PRYGVD[ PRYD[[ 䈫ࠪDŽ˅٬〫ٿ઼⇥˄ᆈⲴ  њᆇ㢲؍[˄ [˅༴  ൠ൰DŽ䘉䟼ᱟᢺ޵ᆈൠ൰〫ٿ⇥޵ GV ઼ VL ᇴᆈಘѝDŽGV ѝ᭮⇥ൠ൰ˈVL ᱟ ޕ 㹼䈝ਕӾ޵ᆈᤷᇊս㖞༴䈫ਆањ䮯ᤷ䪸٬ᒦ᭮ ㅜ  ᆈ᭮ㅜ  њ⺜ⴈⲴ㺘DŽ  ༴ ༴ᆈ᭮ㅜ  њ⺜ⴈⲴ㺘ˈ[єњ⺜ⴈⲴ৲ᮠ㺘ˈ[ޣл䶒є⇥〻ᒿ࠶࡛༽ࡦ %,26 ᴹ [ DŽ Ⲵਾ䶒ˈѝᯝੁ䟿 [ Ⲵੁ䟿٬ҏᤷੁㅜ  њ⺜ⴈⲴ৲ᮠ㺘俆൰DŽ㺘Ⲵ䮯ᓖᱟ  њᆇ㢲 ㅜ  њ⺜ⴈ৲ᮠ㺘Ⲵ俆ൠ൰ㄏ❦ᱟѝᯝੁ䟿 [ Ⲵੁ䟿٬ʽ㘼ㅜ  њ⺜ⴈ৲ᮠ㺘㍗᧕൘ㅜ  њ㺘 ਆㅜањ⺜ⴈⲴؑ᚟˄༽ࡦ⺜ⴈ৲ᮠ㺘˅DŽ *HWKGGDWD  & ᱮ⽪঑⢩ᙗ৲ᮠDŽPRY>@F[[  ᖙ㢢অ㢢 % ᱮ⽪⣦ᘱ$ ᆹ㻵Ⲵᱮ⽪޵ᆈˈ[PRY>@E[[  ""PRY>@D[[ LQW[ PRYEO[ PRYDK[  ৲㿱〻ᒿਾሩ %,26 㿶仁ѝᯝ [ Ⲵ䈤᰾ DŽ F[ ᱮ⽪঑⢩ᙗ৲ᮠ N˗[ NDŽEO ᆹ㻵Ⲵᱮ⽪޵ᆈDŽ[N˗[N˗[ 䘄എ˖EK ᱮ⽪⣦ᘱDŽ[ᖙ㢢⁑ᔿˈ,2 ㄟਓ [G;˗[অ㢢⁑ᔿˈ,2 ㄟਓ [E;DŽ 䈳⭘ %,26 ѝᯝ [ˈ䱴࣐࣏㜭䘹ᤙᯩᔿؑ᚟DŽ࣏㜭ਧ˖DK [ˈEO [ Ựḕᱮ⽪ᯩᔿ˄(*$9*$˅ᒦਆ৲ᮠDŽ  VHWXSV 〻ᒿ 䴰㾱䈳⭘Ⲵԓ⸱ؑ᚟DŽоѝᯝੁ䟿ᴹӋ⴨լˈն㾱वਜ਼ᴤཊⲴؑ᚟DŽ ᖒᔿ৲㿱л䶒  㹼઼  㹼䈤᰾DŽѝᯝ᧿䘠ㅖ㺘ѝⲴ⇿ањ  ᆇ㢲㺘亩ᤷࠪਁ⭏ѝᯝᰦ ਾ  ᆇ㢲˄ᆇ㢲 ˅ᱟ᧿䘠ㅖ㺘Ⲵ  ս㓯ᙗสൠ൰ˈަ˗˄ᆇ㢲 ˅ᱟ᧿䘠ㅖ㺘Ⲵᆇ㢲䮯ᓖ٬ л䶒ᤷԔ OLGW ⭘Ҿ࣐䖭ѝᯝ᧿䘠ㅖ㺘˄,'7˅ᇴᆈಘDŽᆳⲴ᫽֌ᮠ˄LGWB˅ᴹ  ᆇ㢲DŽࡽ  ᆇ㢲  ㅖ㺘DŽ ተ᧿䘠ㅖ㺘઼ѝᯝ᧿䘠ޘѝ䘀㹼ѻࡽˈᡁԜ䴰㾱俆ݸ䇮㖞ྭ䴰㾱֯⭘Ⲵ⇥᧿䘠ㅖ㺘DŽ䘉䟼䴰㾱䇮㖞 ᣔ⁑ᔿ؍ޕ䘉ᯩ䶒Ⲵؑ᚟䈧ḕ䰵ࡇ㺘ਾⲴㆰঅӻ㓽ᡆ䱴ᖅѝⲴ䈖㓶䈤᰾DŽ䘉䟼ӵ֌ᾲ㾱䈤᰾DŽ൘䘋 ޣᣔ⁑ᔿ㕆〻ᯩ䶒Ⲵ⸕䇶Ҷˈᴹ؍ᣔ⁑ᔿⲴ᫽֌ˈഐ↔䴰㾱 ,QWHO ս؍Ӿ䘉䟼ᔰ࿻Պ䙷ࡠ  ս ↔ਾˈᡁԜ࣐䖭⇥᧿䘠ㅖDŽ WKHQZHORDGWKHVHJPHQWGHVFULSWRUV  MPSGRBPRYH PRYVZ UHS PRYF[[〫ࣘ [ ᆇ˄.% ᆇ㢲˅DŽ VXEVLVL VXEGLGL  [ࡍ࿻Ѫ [ VL ᱟⓀൠ൰PRYGVD[VRXUFHVHJPHQWGV M]HQGBPRYHᱟˈࡉ䐣䖜DŽ ᐢ㓿ᢺᴰਾа⇥˄Ӿ [ ⇥ᔰ࿻Ⲵ .%˅ԓ⸱〫ࣘᆼ˛FPSD[[ DGGD[[  [ࡍ࿻Ѫ [ GL ᱟⴞⲴൠ൰PRYHVD[GHVWLQDWLRQVHJPHQWHV GRBPRYH  PRYVPRYHVIRUZDUG GLUHFWLRQ FOG PRYD[[  ੁ޵ᆈվㄟ〫ࣘҶ [˄.%˅Ⲵս㖞DŽ .% ᮤඇൠ ᮤњ V\VWHP ⁑ඇ〫ࣘࡠ [ ս㖞ˈণᢺӾ [ ࡠ [IIII Ⲵ޵ᆈᮠᦞඇ  ᔰ࿻Ⲵൠᯩˈᒦᢺ VHWXS ࣐䖭ࡠᆳⲴਾ䶒DŽл䶒䘉⇥〻ᒿⲴ⭘䙄ᱟ޽ᢺՊᢺ㠚ᐡ〫ࣘࡠ [ ˈᡰԕ ERRWVHFW⁑ඇᴰབྷ䮯ᓖнՊ䎵䗷 [˄.%˅ˈণަᵛㄟнՊ䎵䗷޵ᆈൠ൰ [ 䇮 V\VWHPٷࡠ [˄.%˅ᔰ࿻Ⲵս㖞DŽ⭡ҾᖃᰦޕERRWVHFW ᕅሬ〻ᒿᱟሶ V\VWHP ⁑ඇ䈫 俆ݸᡁԜሶ V\VWHP ⁑ඇ〫ࡠ↓⺞Ⲵս㖞DŽ VULJKWIXOSODFH ILUVWZHPRYHWKHV\VWHPWRLW  FOLQRLQWHUUXSWVDOORZHGӾ↔ᔰ࿻нݱ䇨ѝᯝDŽ  ᣔ⁑ᔿѝҶ؍ޕ⧠൘ᡁԜ㾱䘋 QRZZHZDQWWRPRYHWRSURWHFWHGPRGH  LVBGLVN VWRVE UHS PRYD[[ PRYF[[ PRYGL[ PRYHVD[ PRYD[,1,76(*ㅜ  њ⺜ⴈнᆈ൘ˈࡉሩㅜ  њ⺜ⴈ㺘␵䴦DŽ QRBGLVN MHLVBGLVN ㊫ර ˛ DŽ FPSDKᱟ⺜ⴈੇ˛ MFQRBGLVN LQW[  VHWXSV 〻ᒿ  䴰㾱  㠣  њ 123 ᤷԔDŽ ⽪䘉⿽ᤷԔDŽਖཆˈ⇿њオ᫽֌ᤷԔ 123 Ⲵᰦ䫏ઘᵏᮠᱟ  њˈഐ↔㤕㾱䗮ࡠ⴨਼Ⲵᔦ䘏᭸᷌ቡ ѝ⋑ᴹ㺘⽪⴨ᓄᤷԔⲴࣙ䇠ㅖˈഐ↔ /LQXV ൘ VHWXSV ㅹаӋ≷㕆〻ᒿѝቡⴤ᧕֯⭘ᵪಘ⸱ᶕ㺘 ਟᨀ׋  њ &38 ᰦ䫏ઘᵏⲴᔦ䘏ᰦ䰤DŽ൘ DVޡ↔䘈ᱟⴤ᧕ᢗ㹼лаᶑᤷԔDŽ䘉єᶑᤷԔ ⲴᤷԔDŽᢗ㹼ᰦᡰ㣡䍩Ⲵ &38 ᰦ䫏ઘᵏᮠᱟ  㠣  њDŽ[HE㺘⽪䐣䖜٬ᱟ  ⲴаᶑᤷԔˈഐ 䙊䗷ᢺ䘉њ⴨ሩս〫٬࣐ࡠ (,3 ᇴᆈಘѝቡᖒᡀањᯠⲴᴹ᭸ൠ൰DŽ↔ᰦ (,3 ᤷੁлаᶑ㻛ᢗ㹼 [HE ᱟⴤ᧕䘁䐣䖜ᤷԔⲴ᫽֌⸱ˈᑖ  њᆇ㢲Ⲵ⴨ሩս〫٬DŽഐ↔䐣䖜㤳തᱟ ࡠ DŽ&38 ㅜ  㹼кᇊѹⲴєњᆇ˄[HE˅ᱟⴤ᧕֯⭘ᵪಘ⸱㺘⽪Ⲵєᶑ⴨ሩ䐣䖜ᤷԔˈ䎧ᔦᰦ֌⭘DŽ $ 㣟⡷Ⲵ㕆〻ᯩ⌅䈧৲㿱ᵜ〻ᒿਾⲴӻ㓽DŽ Ҿሩਟ㕆〻᧗ࡦಘޣˈ⡷$ 㣟 3& ᵪ֯⭘  њ  ѝᯝ᧗ࡦಘ䘋㹼㕆〻ˈ䘉а⛩䜭⋑᜿ᙍDŽ  ᭮൘Ҷ [[Iˈ䘉Ӌѝᯝҏ㻛⭘Ҿ޵䜘⺜ԦѝᯝDŽᡰԕᡁԜቡᗵ享䟽ᯠሩ нᒨⲴᱟ ,%0 ൘৏ 3& ᵪѝᩎ㌏Ҷˈԕਾҏ⋑ᴹ㓐↓䗷ᶕDŽᡰԕ 3& ᵪ %,26 ᢺѝᯝ ⮉Ⲵ⺜Ԧѝᯝਾ䶒ˈণ LQW[[)DŽ൘䛓䟼ᆳԜнՊᕅ䎧ߢケDŽ؍ ༴Ҿ ,QWHO ᡁԜሶᆳԜ᭮൘↓ྭ ᐼᵋԕка࠷↓ᑨDŽ⧠൘ᡁԜᗵ享䟽ᯠሩѝᯝ䘋㹼㕆〻  WIXQ VDQGLWLVQ KDYHWRUHSURJUDPWKH ZKLFKLVXVHGIRUWKHLQWHUQDOKDUGZDUHLQWHUUXSWVDVZHOO:HMXVW UHFWLI\LWDIWHUZDUGV7KXVWKHELRVSXWVLQWHUUXSWVDW[[I WEHHQDEOHWR PHVVHGWKLVXSZLWKWKHRULJLQDO3&DQGWKH\KDYHQ WPHVVXSDQ\WKLQJ6DGO\,%0UHDOO\ LQW[[)7KHUHWKH\ZRQ ZHSXWWKHPULJKWDIWHUWKHLQWHOUHVHUYHGKDUGZDUHLQWHUUXSWVDW  ZHOOWKDWZHQWRN,KRSH1RZZHKDYHWRUHSURJUDPWKHLQWHUUXSWV  㕃ߢಘѪオˈࡉ㺘⽪ $ 㓯ᐢ㓿䘹䙊DŽޕFDOOHPSW\B㤕↔ᰦ䗃 RXW[DO PRYDO[')$RQ䘹䙊 $ ൠ൰㓯Ⲵ৲ᮠDŽ 㕃ߢಘオˈⴻભԔᱟ੖㻛᧕ਇDŽޕFDOOHPSW\Bㅹᖵ䗃 ᮠᦞ㾱߉ࡠ [ ਓDŽ RXW[DO Ⲵ 3 ㄟਓDŽ3 ㄟਓⲴս  ⭘Ҿ $ 㓯Ⲵ䘹䙊DŽ PRYDO['FRPPDQGZULWH[' ભԔ⸱㺘⽪㾱߉ᮠᦞࡠ 㕃ߢಘѪオᰦ᡽ਟԕሩަᢗ㹼߉ભԔDŽޕਚᴹᖃ䗃 㕃ߢಘオDŽޕFDOOHPSW\B⍻䈅  ⣦ᘱᇴᆈಘˈㅹᖵ䗃  ѻਾ˄㜭䇯䰞 0% ԕк޵ᆈѻਾ˅൘⍻䈅алDŽ䘉њᐕ֌᭮൘Ҷ KHDG6 〻ᒿѝ˄ 㹼˅DŽ ᣔ⁑ᔿ؍ޕ〻ᒿਾሩ䭞ⴈ᧕ਓⲴ䈤᰾DŽ㠣Ҿᵪಘᱟ੖ⵏ↓ᔰ੟Ҷ $ ൠ൰㓯ˈᡁԜ䘈䴰㾱൘䘋 Ҿᡰ⎹৺ⲴаӋㄟਓ઼ભԔˈਟ৲㘳 NHUQHOFKUBGUYNH\ERDUG6ޣਧ㓯Ⲵ䈤᰾DŽؑ $ ޣᴹ ѪҶ㜭ཏ䇯䰞઼֯⭘ 0% ԕкⲴ⢙⨶޵ᆈˈᡁԜ䴰㾱俆ݸᔰ੟ $ ൠ൰㓯DŽ৲㿱ᵜ〻ᒿࡇ㺘ਾ ԕкⲴ᫽֌ᖸㆰঅˈ⧠൘ᡁԜᔰ੟ $ ൠ൰㓯DŽ WKDWZDVSDLQOHVVQRZZHHQDEOH$  OJGWJGWBORDGJGWZLWKZKDWHYHUDSSURSULDWH࣐䖭 *'7 ᇴᆈಘDŽ OLGWLGWBORDGLGWZLWK࣐䖭 ,'7 ᇴᆈಘDŽ VHWXS ⇥DŽ PRYGVD[GV ᤷੁᵜ〻ᒿ  WZRUN PRYD[6(7836(*ULJKWIRUJRWWKLVDWILUVWGLGQ HQGBPRYH  ᣔ⁑ᔿ䘀㹼ⲴḷᘇDŽ৲㿱ਾ䶒  㹼DŽ؍ԕ৺ަԆаӋ ᴰབྷ䮯ᓖ䲀ࡦ˄ ս˅ǃ⇥Ⲵ㓯ᙗൠ൰ส൰˄ ս˅ǃ⇥Ⲵ⢩ᵳ㓗ǃ⇥ᱟ੖൘޵ᆈǃ䈫߉䇨ਟᵳ ᣔ⁑ᔿлᮠᦞ⇥઼ԓ⸱⇥˄ඇ˅Ⲵؑ᚟DŽަѝवᤜ⇥Ⲵ؍㺘ѝⲴ⇿њ᧿䘠ㅖ亩˄ ᆇ㢲˅᧿䘠Ҷ ተ᧿䘠ㅖޘተ᧿䘠ㅖ㺘˄*'7˅ᇴᆈಘˈަ᫽֌ᮠṬᔿо OLGW ᤷԔⲴ⴨਼DŽޘOJGW ᤷԔ⭘Ҿ࣐䖭   VHWXSV 〻ᒿ ᣔ⁑ᔿˈᒦф䘀㹼൘⢩ᵳ㓗  ѝˈণ؍ҏ〠᧗ࡦᇴᆈಘ &5ˈަ∄⢩ս  㖞  ሶሬ㠤 &38 ࠷ᦒࡠ OPVZ/RDG0DFKLQH6WDWXV:RUG ˈ ᣔ⁑ᔿ䘀㹼DŽ俆ݸ࣐䖭ᵪಘ⣦ᘱᆇ؍ս  ޕл䶒䇮㖞ᒦ䘋  ᣔ⁑ᔿᰦᡁԜӵᱟㆰঅൠ䐣䖜ࡠ㔍ሩൠ൰ [ ༴DŽ ؍ս  ޕᇴᆈಘ޵ᇩ䘋㹼ԫօ䇮㖞DŽᡁԜ䇙 JQX 㕆䈁Ⲵ  ս〻ᒿ৫༴⨶䘉ӋһDŽ൘䘋 ᗇቭ䟿ㆰঅˈᡁԜᒦнሩڊҶDŽѪҶᢺһᛵىᣔ⁑ᔿⲴᰦ؍ޕྭҶˈ⧠൘ᱟⵏ↓ᔰ࿻䘋  ⲴһDŽڊĀⵏ↓āⲴ〻ᒿઈᡰ  DŽ%,26 ᆀ〻ᒿ㾱≲ᖸཊнᗵ㾱Ⲵᮠᦞˈ㘼фᆳа⛩䜭⋑䏓DŽ䛓ᱟҶ˄䲔Ҷࡍ࿻࣐䖭 ˈնᐼᵋ䘉ṧ㜭ᐕ֌ˈ㘼фᡁԜҏн޽䴰㾱ѿણⲴ %,26 ବˈк䶒䘉⇥㕆〻ᖃ❦⋑࣢  DEVROXWHDGGUHVV[LQELWSURWHFWHGPRGH ZHOHWWKHJQXFRPSLOHGELWSURJUDPVGRWKDW:HMXVWMXPSWR WKLQJVDVVLPSOHDVSRVVLEOHZHGRQRUHJLVWHUVHWXSRUDQ\WKLQJ VWKHWLPHWRDFWXDOO\PRYHLQWRSURWHFWHGPRGH7RPDNH :HOOQRZ  LQWHUHVWLQJDQ\ZD\7KLVLVKRZ5($/SURJUDPPHUVGRLW VOHVV 7KH%,26URXWLQHZDQWVORWVRIXQQHFHVVDU\GDWDDQGLW  H[FHSWIRUWKHLQLWLDOORDGLQJ QHHGQRVWHHQNLQJ%,26DQ\ZD\ W +RSHIXOO\LWZRUNVDQGZHGRQ WIXQ ZHOOWKDWFHUWDLQO\ZDVQ  RXW[$DOʽቿ㭭Ӿ㣟⡷ᡰᴹѝᯝ䈧≲DŽ ZRUG[HE[HE RXW[DOቿ㭭ѫ㣟⡷ᡰᴹѝᯝ䈧≲DŽ PRYDO[))PDVNRIIDOOLQWHUUXSWVIRUQRZ ZRUG[HE[HE RXW[$DOʽ䘱Ӿ㣟⡷ ,&: ભԔᆇˈ޵ᇩ਼кDŽ ZRUG[HE[HE ᯩᔿDŽ䴰ਁ䘱ᤷԔᶕ༽սDŽࡍ࿻ॆ㔃ᶏˈ㣟⡷ቡ㔚DŽ RXW[DO䘱ѫ⡷ ,&: ભԔᆇDŽ ⁑ᔿ˗Პ䙊 (2,ǃ䶎㕃ߢ PRYDO[PRGHIRUERWK ZRUG[HE[HE ⡷Ⲵ ,5 ᕅ㝊кDŽ RXW[$DO䘱Ӿ㣟⡷ ,&: ભԔᆇˈ㺘⽪Ӿ㣟⡷Ⲵ ,17 䘎ࡠѫ㣟 LVVODYHPRYDO[ ZRUG[HE[HE ʽ৲㿱ԓ⸱ࡇ㺘ਾⲴ䈤᰾DŽ RXW[DO䘱ѫ㣟⡷ ,&: ભԔᆇˈѫ㣟⡷Ⲵ ,5 䘎Ӿ㣟⡷ ,17DŽ LVPDVWHUPRYDO[ ZRUG[HE[HE RXW[$DO䘱Ӿ㣟⡷ ,&: ભԔᆇˈӾ㣟⡷Ⲵ䎧࿻ѝᯝਧDŽ  [ V PRYDO[VWDUWRIKDUGZDUHLQW ZRUG[HE[HE RXW[DO䘱ѫ㣟⡷ ,&: ભԔᆇˈ䇮㖞䎧࿻ѝᯝਧˈ㾱䘱ཷㄟਓDŽ  [ V PRYDO[VWDUWRIKDUGZDUHLQW /LQX[ ㌫㔏⺜Ԧѝᯝਧ㻛䇮㖞ᡀӾ [ ᔰ࿻DŽ৲㿱㺘 ˖⺜Ԧѝᯝ䈧≲ؑਧоѝᯝਧሩᓄ㺘DŽ ZRUG[HE[HE $ Ӿ㣟⡷DŽ $޽ਁ䘱ࡠRXW[$DODQGWR 㺘⽪ᖃࡽᤷԔⲴൠ൰ˈ  ZRUG[HE[HEMPSMPS $ ѫ㣟⡷DŽ $ਁ䘱ࡠRXW[DOVHQGLWWR PRYDO[LQLWLDOL]DWLRQVHTXHQFH  㓗䘎ǃᴰਾ㾱ਁ䘱 ,&: ભԔᆇDŽ ᱟ ,&: ભԔᆇˈ㺘⽪䗩⋯䀖ਁǃཊ⡷ 㺘⽪ࡍ࿻ॆભԔᔰ࿻ˈᆳ ] 㣟⡷ѫ⡷ㄟਓᱟ [[ˈӾ⡷ㄟਓᱟ [$[$DŽ䗃ࠪ٬  VHWXSV 〻ᒿ ˈл䶒ᱟ࣐䖭ѝᯝ᧿䘠ㅖ㺘ᇴᆈಘ LGWU ⲴᤷԔ OLGW 㾱≲Ⲵ  ᆇ㢲᫽֌ᮠDŽࡽ  ᆇ㢲ᱟ ,'7 㺘Ⲵ䲀䮯  ˈ ս⁑ᔿDŽ 仇㋂ᓖѪ ZRUG[&JUDQXODULW\ GDWDUHDGZULWHᮠᦞ⇥Ѫਟ䈫ਟ߉DŽZRUG[  ZRUG[EDVHDGGUHVV   0E  ˈഐ↔ᱟ  ZRUG[))0EOLPLW 䟿ᱟ [DŽᆳᱟ޵Ṩᮠᦞ⇥䘹ᤙㅖⲴ٬DŽ〫ٿ൘ *'7 㺘ѝ䘉䟼Ⲵ  ˈ ս⁑ᔿDŽ 仇㋂ᓖѪ ZRUG[&JUDQXODULW\ $FRGHUHDGH[HFԓ⸱⇥Ѫਚ䈫ǃਟᢗ㹼DŽZRUG[  ZRUG[EDVHDGGUHVV   0E  ˈഐ↔ᱟ  ZRUG[))0EOLPLW 䟿ᱟ [DŽᆳᱟ޵Ṩԓ⸱⇥䘹ᤙㅖⲴ٬DŽ〫ٿ൘ *'7 㺘ѝ䘉䟼Ⲵ  ZRUGGXPP\ㅜ  њ᧿䘠ㅖˈн⭘DŽ JGW  㹼 DŽ 㔏ᮠᦞ⇥᧿䘠ㅖ ㅜ  亩ᰐ⭘˄ 㹼˅ˈն享ᆈ൘DŽㅜ  亩ᱟ㌫㔏ԓ⸱⇥᧿䘠ㅖ˄ 㹼˅ˈㅜ  亩ᱟ㌫ ተ᧿䘠ㅖ㺘ᔰ࿻༴DŽ᧿䘠ㅖ㺘⭡ཊњ  ᆇ㢲䮯Ⲵ᧿䘠ㅖ亩㓴ᡀDŽ䘉䟼㔉ࠪҶ  њ᧿䘠ㅖ亩DŽޘ  UHW MQ]HPSW\B\HVORRS 㕃ߢಘ┑˛ޕWHVWDOLVLQSXWEXIIHUIXOO"⍻䈅ս ˈ䗃 LQDO[VWDWXVSRUW䈫 $7 䭞ⴈ᧗ࡦಘ⣦ᘱᇴᆈಘDŽ 䐣ࡠлаਕ ˈ⴨ᖃҾᔦᰦ᫽֌DŽ ZRUG[HE[HE䘉ᱟєњ䐣䖜ᤷԔⲴᵪಘ⸱ HPSW\B 㕃ߢಘѪオᰦ˄䭞ⴈ᧗ࡦಘ⣦ᘱᇴᆈಘս  ˅᡽ਟԕሩަ䘋㹼߉ભԔDŽޕਚᴹᖃ䗃  ྲ᷌䘉䟼↫ᵪˈࡉ䈤᰾ 3& ᵪᴹ䰞仈ˈᡁԜቡ⋑ᴹ࣎⌅޽༴⨶л৫ҶDŽ л䶒䘉њᆀ〻ᒿỰḕ䭞ⴈભԔ䱏ࡇᱟ੖ѪオDŽ䘉䟼н֯⭘䎵ᰦᯩ⌅ WSURFHHGDQ\ZD\ WKHPDFKLQHDQGZHSUREDEO\FRXOGQ 1RWLPHRXWLVXVHGLIWKLVKDQJVWKHUHLVVRPHWKLQJZURQJZLWK 7KLVURXWLQHFKHFNVWKDWWKHNH\ERDUGFRPPDQGTXHXHLVHPSW\  ഐ↔䘉䟼Ⲵ䐣䖜ᤷԔቡՊ৫ᢗ㹼 V\VWHP ѝⲴԓ⸱DŽ  㹼˅ˈ ተ᧿䘠ㅖ㺘 *'7 ѝㅜ  њ⇥᧿䘠ㅖ亩ˈ䈕亩ᤷࠪԓ⸱Ⲵสൠ൰ᱟ ˄৲㿱ޘᵳ㓗 ǃ֯⭘ ㅖ㺘亩Ⲵ㍒ᕅˈᤷࠪ䘹ᤙㅜࠐ亩᧿䘠ㅖDŽᡰԕ⇥䘹ᤙㅖ ˄E˅㺘⽪䈧≲⢩  ˗ս  ᱟ᧿䘠 ተ᧿䘠ㅖ㺘˄˅䘈ᱟተ䜘᧿䘠ㅖ㺘ޘ㓗˅઼  㓗˄⭘ᡧ㓗˅˗ս  ⭘Ҿ䘹ᤙ ᓖѪ  ս˄ ᆇ㢲˅˗ս  㺘⽪䈧≲Ⲵ⢩ᵳ㓗 ˈ/LQX[ ᫽֌㌫㔏ਚ⭘ࡠє㓗˖ 㓗˄޵Ṩ ᣔ⁑ᔿлⲴ⇥䘹ᤙㅖҶˈ⭘Ҿ䘹ᤙ᧿䘠ㅖ㺘઼᧿䘠ㅖ㺘亩ԕ৺ᡰ㾱≲Ⲵ⢩ᵳ㓗DŽ⇥䘹ᤙㅖ䮯؍ᱟ ᐢ㓿  ٬⇥ൠ൰ᱟ DŽ㘼〫ٿᡁԜᐢ㓿ሶ V\VWHP ⁑ඇ〫ࣘࡠ [ ᔰ࿻ⲴൠᯩˈᡰԕкਕѝⲴ  ༴DŽ  〫ٿ⇥ FV 䐣䖜㠣 FV MPSLMPSRIIVHWRIVHJPHQW OPVZD[7KLVLVLWቡ䘉ṧ࣐䖭ᵪಘ⣦ᘱᆇ 3( DŽ ᣔ⁑ᔿ∄⢩ս؍3( ELW PRYD[[SURWHFWHGPRGH  ࡽⲴ &38DŽ ᣔ⁑ᔿDŽOPVZ ᤷԔӵ⭘Ҿެᇩԕ؍кᔪ䇞  ᡆԕк &38 ᓄ䈕֯⭘ᤷԔĀPRYFUD[ā࠷ᦒࡠ ਨⲴ᡻޼ޜ ⇥䰤䐣䖜ᤷԔቡՊࡧᯠ &38 ⲴᖃࡽᤷԔ䱏ࡇˈণђᔳ䘉Ӌᰐ᭸ؑ᚟DŽਖཆˈ൘ ,QWHO ᣔ⁑ᔿԕਾ䛓Ӌ኎Ҿᇎ⁑ᔿⲴ亴ݸਆᗇⲴᤷԔؑ᚟ቡਈᗇн޽ᴹ᭸DŽ㘼аᶑ؍ޕ䀓⸱DŽ❦㘼൘䘋 ⭘Ҿࡧᯠ &38 ᖃࡽᤷԔ䱏ࡇDŽഐѪ &38 ᱟ൘ᢗ㹼аᶑᤷԔѻࡽቡᐢӾ޵ᆈ䈫ਆ䈕ᤷԔᒦሩަ䘋㹼 㓯ᙗൠ൰о⢙⨶޵ᆈൠ൰⴨਼˅DŽ൘䇮㖞䈕∄⢩սਾˈ䲿ਾаᶑᤷԔᗵ享ᱟаᶑ⇥䰤䐣䖜ᤷԔԕ ᖃࡽ⢩ᵳ㓗 &3/ DŽ↔ᰦ⇥ᇴᆈಘӽ❦ᤷੁоᇎൠ൰⁑ᔿѝ⴨਼Ⲵ㓯ᙗൠ൰༴˄൘ᇎൠ൰⁑ᔿл  VHWXSV 〻ᒿ 〻ᒿ㻛㾶ⴆᦹҶ ৏ᶕⲴ ERRWVHFWV ᮠᦞ⇥᧿䘠ㅖ ԓ⸱⇥᧿䘠ㅖ VHWXSV ԓ⸱ PDLQF 〻ᒿ NHUQHO ޵Ṩ⁑ඇ PP ޵ᆈ㇑⨶⁑ඇ  OLE ᓃ⁑ඇ ㌫㔏৲ᮠ KHDGV 〻ᒿ [ VHWXSV 〻ᒿ V\VWHP ⁑ඇ  JGW ተ᧿䘠ㅖ㺘ޘѤᰦ [ [  ᔰ࿻༴ࡉᆈ᭮Ҷ޵ṨሶՊ֯⭘ⲴаӋ㌫㔏สᵜ৲ᮠˈ⽪᜿മྲമ 6-6 ᡰ⽪DŽ ൘ setup.s 〻ᒿᢗ㹼㔃ᶏਾˈ㌫㔏⁑ඇ system 㻛〫ࣘࡠ⢙⨶ൠ൰ 0x0000 ᔰ࿻༴ˈ㘼Ӿս㖞 0x90000 ܅6.3.3.1 ᖉࢃ޻ᆎ᱖ ᣔ⁑ᔿ䘀㹼Ⲵ䰞仈DŽ؍Ҿ Intel 32 սޣ ֌DŽл䶒ㆰ㾱ൠ᧿䘠〻ᒿѝ֯⭘ࡠⲴ BIOS ѝᯝ䈳⭘ˈᒦሩ A20 ൠ൰㓯䰞仈Ⲵ㕈⭡䘋㹼䀓䟺ˈᴰਾᨀ৺ ѪҶ㧧ਆᵪಘⲴสᵜ৲ᮠˈ䘉⇥〻ᒿཊ⅑䈳⭘Ҷ BIOS ѝⲴѝᯝˈᒦᔰ࿻⎹৺аӋሩ⺜ԦㄟਓⲴ᫽ 6.3.3 ެԌؗᚥ  HQGEVV EVV HQGGDWD GDWD HQGWH[W WH[W  [[[[JGWEDVH ;ZRUGJGW[ ZRUG[JGWOLPLW *'7HQWULHV JGWB  ൠ൰ˈ㿱  㹼DŽ〫ٿተ㺘൘ᵜ〻ᒿ⇥ѝⲴޘㅖਧ JGW ᱟ JGWDŽণ [ [JGWˈਟᴹ  亩DŽ ᆇ㢲Ⲵ㓯ᙗสൠ൰Ѫ [ޡањ⇥᧿䘠ㅖ亩ˈᡰԕ㺘ѝ ተ㺘䮯ᓖ䇮㖞Ѫ .%˄[II ণਟ˅ˈഐѪ⇿  ᆇ㢲㓴ᡀޘਾ  ᆇ㢲ᱟ JGW 㺘Ⲵ㓯ᙗสൠ൰DŽ䘉䟼 ተ᧿䘠ㅖ㺘ᇴᆈಘ JGWU ⲴᤷԔ OJGW 㾱≲Ⲵ  ᆇ㢲᫽֌ᮠDŽࡽ  ᆇ㢲ᱟ JGW 㺘Ⲵ䲀䮯ˈޘ䘉ᱟ࣐䖭  ZRUGLGWEDVH /  ZRUGLGWOLPLW LGWB ഐ↔䘉䟼ݸ䇮㖞ањ䮯ᓖѪ  Ⲵオ㺘DŽ ᣔ⁑ᔿѻࡽ䴰䇮㖞 ,'7 㺘ˈ؍ޕਾ  ᆇ㢲ᱟ LGW 㺘൘㓯ᙗൠ൰オ䰤ѝⲴ  սสൠ൰DŽ&38 㾱≲൘䘋  VHWXSV 〻ᒿ 0x0B EGA+ 80x25 অ㢢DŽ 0x0A EGA+ 80x25 অ㢢˗ 0x07-0x09 EGA+ 80x25˗ 0x06 EGA+ 40x25˗ 0x05 CGA 80x25˗ 0x04 CGA 40x25˗ 0x01-0x03 MDA/HGC˗ 0x00 MDA/HGC˗ :䇮㖞٬ޣ৏࿻ EGA/VGA ᔰ 4-7 ᵚ֯⭘DŽ 䰝˗ޣ 4 ޣ3 ᔰ 䰝˗ޣ 3 ޣ2 ᔰ 䰝˗ޣ 2 ޣ1 ᔰ 䰝˗ޣ 1 ޣ0 ᔰ ∄⢩ս 䈤᰾ 䇮㖞ؑ᚟˖ޣ㿶仁ᔰ cl 䘄എؑ᚟ 4-7 ᵚ֯⭘(Ѫ 0) 3 ⢩ᙗ㓯 0ˈ⣦ᘱ 1˗ 2 ⢩ᙗ㓯 1ˈ⣦ᘱ 1˗ 1 ⢩ᙗ㓯 0ˈ⣦ᘱ 2˗ 0 ⢩ᙗ㓯 1ˈ⣦ᘱ 2˗ ∄⢩ս 䈤᰾ ⢩ᙗ䘎᧕ಘ∄⢩սؑ᚟˖ ch 00 = 64K, 01 = 128K, 02 = 192K, 03 = 256K bl ᐢᆹ㻵Ⲵᱮ⽪޵ᆈབྷሿ˖ ٬ਟѪ 0 – fDŽ ⌘˖ަѝㄟਓൠ൰ѝⲴ X 0x01 – অ㢢⁑ᔿ˄↔ᰦ㿶仁⺜Ԧ I/O ㄟਓสൠ൰Ѫ 0x3BX˅˗ 0x00 – ᖙ㢢⁑ᔿ˄↔ᰦ㿶仁⺜Ԧ I/O ㄟਓสൠ൰Ѫ 0x3DX˅˗ 㿶仁⣦ᘱ˖ bh bl ᆀ࣏㜭ਧ=0x10DŽ ᚟ؑޕ䗃 ah ࣏㜭ਧ=0x12ˈ㧧ਆᱮ⽪঑ؑ᚟ 䘄എؑ᚟ ᇴᆈಘ ޵ᇩ䈤᰾/ޕ䗃 㺞 ā㧭਌ᱴ⽰গؗᚥδࣕ㜳ਭφDK [θEO [ε 㧧ਆᱮ⽪঑ؑ᚟˄ަԆ䖵࣏ࣙ㜭䘹ᤙ˅˖ 䘉䟼䈤᰾к䶒〻ᒿѝ⭘ࡠⲴ ROM BIOS ѝ㿶仁ѝᯝ䈳⭘Ⲵࠐњᆀ࣏㜭DŽ 6.3.3.2 BIOS 㿼仇ѣᯣ 0x10 ٬DŽ〫ٿᶕᤷᇊᡰ䴰֯⭘Ⲵ᧿䘠ㅖ亩ˈ↔༴ᱟᤷ gdt ѝⲴԓ⸱⇥᧿䘠ㅖDŽ'0'ᱟ᧿䘠ㅖ亩ᤷᇊⲴԓ⸱⇥ѝⲴ 'jmp 0,8 '˄ㅜ 193 㹼˅ᰦˈቡՊ䐣ࡠ head.s 〻ᒿᔰ࿻༴㔗㔝ᢗ㹼л৫DŽ䘉ᶑᤷԔѝⲴ'8'ᱟ⇥䘹ᤙㅖˈ⭘ ᧿䘠ㅖDŽᆳԜ䜭ᤷੁ㌫㔏⁑ඇⲴ䎧࿻༴ˈҏণ⢙⨶ൠ൰ 0x0000 ༴DŽ䘉ṧᖃ setup.s ѝᢗ㹼ᴰਾаᶑᤷԔ ተ㺘ѝᴹйњ᧿䘠ㅖˈㅜањᱟ NULL н֯⭘ˈਖཆєњ࠶࡛ᱟԓ⸱⇥᧿䘠ㅖ઼ᮠᦞ⇥ޘ↔ᰦѤᰦ ഴ VHWXSV ぁᓅ㔉ᶕ੄޻ᆎѣぁᓅ⽰ᝅഴ  VHWXSV 〻ᒿ ࡠሩ A20 㓯Ⲵ᧗ࡦDŽڊ㹼˅ণ֯⭘Ҷ䘉⿽ިරⲴ᧗ࡦᯩᔿDŽሩҾަԆаӋެᇩᗞᵪ䘈ਟԕ֯⭘ަԆᯩᔿᶕ ሩ A20 ؑਧ㓯䘋㹼᧗ࡦⲴᑨ⭘ᯩ⌅ᱟ䙊䗷䇮㖞䭞ⴈ᧗ࡦಘⲴㄟਓ٬DŽ䘉䟼Ⲵ setup.s 〻ᒿ˄138-144 ᯩ⌅ѝ䘹ᤙDŽ ࡠ䘉а⛩তᱟ䶎ᑨⲴ哫✖DŽഐ↔䙊ᑨ㾱൘ࠐ⿽᧗ࡦڊᆳDŽնᱟ⭡Ҿ਴⿽ެᇩᵪᡰ֯⭘Ⲵ㣟⡷䳶н਼ˈ㾱 ⭡Ҿ൘ᵪಘ੟ࣘᰦˈ唈䇔ᶑԦлˈA20 ൠ൰㓯ᱟ⾱→Ⲵˈᡰԕ᫽֌㌫㔏ᗵ享֯⭘䘲ᖃⲴᯩ⌅ᶕᔰ੟ Ӿ㘼ᇎ⧠ҶެᇩᙗDŽ ᶕ֌Ѫо䰘᧗ࡦ䘉њൠ൰∄⢩սDŽ䈕ؑਧণ㻛〠Ѫ A20DŽྲ᷌ᆳѪ䴦ˈࡉ∄⢩ 20 ৺ԕкൠ൰䜭㻛␵䲔DŽ Ҿ൘ᖃᰦⲴ 8042 䭞ⴈ᧗ࡦಘкᚠྭᴹオ䰢Ⲵㄟਓᕅ㝊˄䗃ࠪㄟਓ P2ˈᕅ㝊 P21˅ˈҾᱟׯ֯⭘Ҷ䈕ᕅ㝊 ᶕᔰ੟ᡆ⾱→ 0x100000 ൠ൰∄⢩սDŽ⭡ޣਨਁ᰾Ҷ֯⭘ањᔰޜ ⲴެᇩᙗˈIBMޘ֌ⲴDŽѪҶᇎ⧠ᆼ ᰦᆳতн㜭䊑 8088 䛓ṧᇎ⧠ൠ൰ራ൰Ⲵ⧟㔅DŽնᱟᖃᰦᐢ㓿ᴹаӋ〻ᒿᱟ࡙⭘䘉⿽ൠ൰⧟㔅ᵪࡦ䘋㹼ᐕ ᇩⲴᇎ⁑ᔿ䘀㹼ᯩᔿDŽ❦㘼ˈ൘ራ൰٬䎵䗷 1MBެޘ൰㓯ˈᴰ儈ਟራ൰ 16MBˈᒦфᴹањо 8088 ᆼ AT ᵪᰦˈ֯⭘Ⲵᱟ Intel 80286 CPUˈާᴹ 24 ṩൠ ޕਨҾ 1985 ᒤᕅޜ ሶ唈䇔ൠ⧟㔅ࡠ 0x0ffefDŽᖃ IBM 䘉Ӌ޵ᆈDŽަᡰ㜭ራ൰Ⲵᴰ儈ൠ൰ᱟ 0xffff:0xffffˈҏণ 0x10ffefDŽሩҾ䎵ࠪ 0x100000(1MB)Ⲵራ൰ൠ൰ 㓯ਚᴹ 20 ṩ(A0 – A19)DŽ൘ᖃᰦ޵ᆈ RAM ਚᴹࠐⲮ KB ᡆнࡠ 1MB ᰦˈ20 ṩൠ൰㓯ᐢ䏣ཏ⭘ᶕራ൰ ਨᴰࡍ᧘ࠪⲴњӪ䇑㇇ᵪ IBM PC ֯⭘Ⲵ CPU ᱟ Intel 8088DŽ൘䈕ᗞᵪѝൠ൰ޜ 1981 ᒤ 8 ᴸˈIBM 6.3.3.4 A20 ൦൶㓵䰤从 ⮉DŽ؍ 0x0F ᆇ㢲 0x0E ᆇ㢲 sect ⇿⻱䚃ᡷ४ᮠ ḡ䶒ਧ(→ڌ)0x0C ᆇ lzone ⻱ཤ⵰䱶 ӵ XT ֯⭘ˈަԆѪ 0˅˄0x0B ᆇ㢲 Ự⍻傡ࣘಘ䎵ᰦ٬ ӵ XT ֯⭘ˈަԆѪ 0˅˄0x0A ᆇ㢲 Ṭᔿॆ䎵ᰦ٬ ӵ XT ֯⭘ˈަԆѪ 0˅˄0x09 ᆇ㢲 ḷ߶䎵ᰦ٬ ս 7 ⾱→䇯䰞䟽䈅DŽ ս 6 ⾱→ ECC 䟽䈅 ս 5 㤕൘ḡ䶒ᮠ+1 ༴ᴹ⭏ӗ୶Ⲵൿ४മˈࡉ㖞 1 ս 4 ᵚ⭘(0) ս 3 㤕⻱ཤᮠབྷҾ 8 ࡉ㖞 1 ս 2 ݱ䇨༽ս 䰝 IRQ)ޣ) (⮉(0؍ ս 1 ս 0 ᵚ⭘ ᧗ࡦᆇ㢲˄傡ࣘಘ↕䘋䘹ᤙ˅ 0x08 ᆇ㢲 ctl 0x07 ᆇ㢲 ᴰབྷ ECC ⥍ਁ䮯ᓖ˄ӵ XT ֯⭘ˈަԆѪ 0˅ ḡ䶒ਧ˄҈ 4˅گ0x05 ᆇ wpcom ᔰ࿻߉ࡽ亴㺕 0x03 ᆇ ᔰ࿻߿ሿ߉⭥⍱Ⲵḡ䶒(ӵ PC XT ֯⭘ˈަԆѪ 0) 0x02 ᆇ㢲 head ⻱ཤᮠ 0x00 ᆇ cyl ḡ䶒ᮠ ս〫 བྷሿ 㤡᮷਽〠 䈤᰾ 㺞 ā⺢ⴎะᵢ৸ᮦؗᚥ㺞 ਓൠ൰ᆈҾ int 0x46 ѝᯝੁ䟿ս㖞༴DŽޕF000h:E401hDŽㅜҼњ⺜ⴈⲴสᵜ৲ᮠ㺘 㘼ᱟㅜањ⺜ⴈⲴสᵜ৲ᮠ㺘DŽሩҾ 100%ެᇩⲴ BIOS ᶕ䈤ˈ䘉䟼ᆈ᭮⵰⺜ⴈ৲ᮠ㺘䱥ࡇⲴ俆ൠ൰ ѝᯝੁ䟿㺘ѝˈint 0x41 Ⲵѝᯝੁ䟿ս㖞˄4 * 0x41 =0x0000:0x0104˅ᆈ᭮Ⲵᒦнᱟѝᯝ〻ᒿⲴൠ൰ˈ 6.3.3.3 ⺢ⴎะᵢ৸ᮦ㺞δćINT 0x41Ĉε  VHWXSV 〻ᒿ $  ,05 ѝᯝቿ㭭ᇴᆈಘ 㕃ߢ'̢' ᮠᦞᙫ㓯 ,17 ᇴᆈಘ㓴2&:V,17$ ᫽֌ભԔᆇ ᇴᆈಘ㓴,&:V ࡍ࿻ॆભԔᆇ ,5 ,5 ,5 ,5 ,5 ,5 ,5 ,5  ,65 ᇴᆈಘ ↓൘ᴽ࣑  ,55 ᇴᆈಘ ѝᯝ䈧≲  35 䀓᷀ಘ Ոݸ㓗 ᧗ࡦ䙫䗁ㅹ 㔏ѝˈᖃ A0 㓯Ѫ 0 ᰦ㣟⡷Ⲵㄟਓൠ൰ᱟ 0x20 ઼ 0xA0˄Ӿ㣟⡷˅ˈᖃ A0=1 ᰦㄟਓቡᱟ 0x21 ઼ 0xA1DŽ Words˅ᇴᆈಘ㓴ᶕ䲿ᰦ䇮㖞઼㇑⨶ 8259A Ⲵᐕ֌ᯩᔿDŽA0 㓯⭘Ҿ䘹ᤙ᫽֌ⲴᇴᆈಘDŽ൘ PC/AT ᗞᵪ㌫ ᫽֌ભԔᆇ OCW˄Operation CommandޕWords˅ᇴᆈಘ㓴Ⲵ޵ᇩDŽ㘼൘ަᐕ֌䗷〻ѝˈࡉਟԕ֯⭘߉ Ⲵє㊫ભԔDŽ൘ 8259A ਟԕ↓ᑨ᫽֌ѻࡽˈᗵ享俆ݸ䇮㖞ࡍ࿻ॆભԔᆇ ICW˄Initialization Command ᆈ⵰↓൘᧕ਇᴽ࣑Ⲵѝᯝ䈧≲DŽ᧗ࡦ䙫䗁ᯩṶѝⲴᇴᆈಘ㓴⭘Ҿ᧕ਇ CPU ӗ⭏؍Register˅ѝDŽISR ѝ ⭘Ҿ⺞ᇊ IRR ѝᡰ䇮㖞∄⢩սⲴՈݸ㓗ˈ䘹䙊ᴰ儈Ոݸ㓗Ⲵѝᯝ䈧≲ࡠ↓൘ᴽ࣑ᇴᆈಘ ISR˄In-Service DŽՈݸ㓗䀓᷀ಘ PR˄Priority Resolver˅ޕ㓯Ⲵቿ㭭ᒦнՊᖡ૽վՈݸ㓗ѝᯝ䈧≲㓯Ⲵ䗃ޕሩ儈Ոݸ㓗䗃 㻛㖞 1 ቡቿ㭭ଚа㓗ѝᯝ䈧≲DŽণ IMR ሩ IRR 䘋㹼༴⨶ˈަ⇿њ∄⢩սሩᓄ IRR Ⲵ⇿њ䈧≲∄⢩սDŽ ᆈ㻛ቿ㭭Ⲵѝᯝ䈧≲㓯ሩᓄⲴ∄⢩սˈᇴᆈಘⲴ 8 սҏᱟሩᓄ 8 њѝᯝ㓗DŽଚњ∄⢩ս؍Register˅⭘Ҿ ѝᯝ㓗ˈᇴᆈಘⲴ 8 њ∄⢩ս˄D7—D0˅࠶࡛ሩᓄᕅ㝊 IR7—IR0DŽѝᯝቿ㭭ᇴᆈಘ IMR˄Interrup Mask ᕅ㝊кᡰᴹ䈧≲ᴽ࣑ޕᆈѝᯝ䈧≲䗃؍മѝˈѝᯝ䈧≲ᇴᆈಘ IRR˄Interrupt Request Register˅⭘ᶕ $ 㣥⡽Ṽഴ ഴ ਥ㕌ぁѣᯣ᧝࡬ಞ  㣟⡷Ⲵㄟਓสൠ൰ᱟ 0x20ˈӾ㣟⡷ᱟ 0xA0DŽањ 8259A 㣟⡷Ⲵ䙫䗁Ṷമ㿱മ 6-7 ᡰ⽪DŽ ㇑⨶ 15 㓗ѝᯝੁ䟿ˈ৲㿱മ 2-20 ᡰ⽪DŽަѝӾ㣟⡷Ⲵ INT ᕅ㝊䘎᧕ࡠѫ㣟⡷Ⲵ IR2 ᕅ㝊кDŽѫ 8259A ਟޡˈ⡷ࡽ䶒ᐢ㓿䈤䗷ˈ൘ PC/AT ㌫ࡇެᇩᵪѝ֯⭘Ҷ㓗㚄Ⲵє⡷ 8259A ਟ㕆〻᧗ࡦಘ˄PIC˅㣟 1. 8259A 㣟⡷ᐕ֌৏⨶ 㖞Ⲵᐕ֌ᯩᔿDŽ 䘉䟼ᡁԜ俆ݸӻ㓽 8259A 㣟⡷Ⲵᐕ֌৏⨶ˈ❦ਾ䈖㓶䈤᰾ 8259A 㣟⡷Ⲵ㕆〻ᯩ⌅ԕ৺ Linux ޵Ṩሩަ䇮 ൘ㅜ 2 ㄐѝᡁԜᐢ㓿ᾲ㾱ӻ㓽ҶѝᯝᵪࡦⲴสᵜ৏⨶઼ PC/AT ެᇩᗞᵪѝ֯⭘Ⲵ⺜Ԧѝᯝᆀ㌫㔏DŽ 6.3.3.5 8259A ѣᯣ᧝࡬ಞⲺ㕌ぁᯯ⌋ 䘈ᴹа⿽ᯩᔿᱟ䙊䗷䈫 0xee ㄟਓᶕᔰ੟ A20 ؑਧ㓯ˈ߉䈕ㄟਓࡉՊ⾱→ A20 ؑਧ㓯DŽ ᗞᵪкⲴ䇮༷˄ྲᱮ⽪㣟⡷˅ᡰ֯⭘ˈӾ㘼䙐ᡀ㌫㔏䭉䈟Ⲵ᫽֌DŽ ಘ᫽֌ᯩᔿDŽሩҾнਜ਼䭞ⴈ᧗ࡦಘⲴ㌫㔏ቡਚ㜭֯⭘ 0x92 ㄟਓᶕ᧗ࡦˈնᱟ䈕ㄟਓҏᴹਟ㜭㻛ަԆެᇩ A20 ᘛ䙏䰘䘹亩(Fast Gate A20)ˈᆳ֯⭘ I/O ㄟਓ 0x92 ᶕ༴⨶ A20 ؑਧ㓯ˈ䚯ݽҶ֯⭘ធ䙏Ⲵ䭞ⴈ᧗ࡦ ࠶DŽ⭡Ҿ䭞ⴈⲴ᧗ࡦಘ䙏ᓖᖸធˈഐ↔ቡн㜭֯⭘䭞ⴈ᧗ࡦಘሩ A20 㓯ᶕ䘋㹼᫽֌DŽѪ↔ᕅ䘋Ҷањ ᣔ䘀㹼⁑ᔿѻ䰤䘋㹼䖜ᦒⲴḷ߶䗷〻ѝⲴа䜘؍ᴹӋ᫽֌㌫㔏ሶ A20 Ⲵᔰ੟઼⾱→֌Ѫᇎ⁑ᔿо  VHWXSV 〻ᒿ ":&, 䴰㾱 ፼྇ᯩᔿ" 䇮㖞 ,&: 䇮㖞 ,&: 䇮㖞 ,&: ቡ㔚ˈਟ᧕ਇѝᯝ 䇮㖞 ,&: ᇴᆈಘ㓴 䇮㖞 ,&:  61*/ <   61*/ 1  ,& <   ,& 1 (1) ICW1 ᖃਁ䘱Ⲵᆇ㢲ㅜ 5 ∄⢩ս˄D4˅=1 ᒦфൠ൰㓯 A0=0 ᰦˈ㺘⽪ᱟሩ ICW1 㕆〻DŽ↔ᰦሩҾ PC/AT $ ࡓခौળԚᆍ䇴㖤亰ᓅ ഴ  ਖཆˈᱟ੖䴰㾱ሩ ICW4 䘋㹼䇮㖞ҏ䴰㾱൘ ICW1 ѝᤷ᰾DŽ वᤜཊ⡷ 8259A 㣟⡷ᒦфᱟ᧕䘎Ⲵᛵߥл᡽䴰㾱ሩ ICW3 䘋㹼䇮㖞DŽ䘉䴰㾱൘ ICW1 Ⲵ䇮㖞ѝ᰾⺞ᤷࠪDŽ ᆇⲴ㕆〻᫽֌⍱〻㿱മ 6-8 ᡰ⽪DŽ⭡മਟԕⴻࠪˈሩ ICW1 ઼ ICW2 Ⲵ䇮㖞ᱟᗵ䴰ⲴDŽ㘼ਚᴹᖃ㌫㔏ѝ 8259ADŽл䶒ᡁԜݸ䈤᰾ሩ 8259A ࡍ࿻ॆભԔᆇⲴ㕆〻᫽֌DŽࡍ࿻ॆભԔ ޕ߉ىᆇⲴ޵ᇩਟԕ൘ԫօᰦ ൘ᐕ֌䗷〻ѝ䲿ᰦሩ 8259A Ⲵ 3 њ᫽֌ભԔᆇ˄OCW1—OCW3˅䘋㹼㕆〻DŽ൘ࡍ࿻ॆѻਾˈ᫽֌ભԔ 㕆〻˗Ҽᱟޕаᱟ൘ 8259A ᐕ֌ѻࡽሩ⇿њ 8259A 㣟⡷ 4 њࡍ࿻ॆભԔᆇ˄ICW1—ICW4˅ᇴᆈಘⲴ߉ ĺ〻ᒿḕ䈒ᯩᔿDŽ䙊䗷ሩ 8259A 䘋㹼㕆〻ˈᡁԜਟԕ䘹ᇊ 8259A Ⲵᖃࡽᐕ֌ᯩᔿDŽ㕆〻ᰦ࠶єњ䱦⇥DŽ ፼྇ᯩᔿ˗ĸᗚ⧟Ոݸ㓗ᯩᔿ˗Ĺ⢩↺ቿ㭭ᯩᔿ઼ޘਟ㕆〻᧗ࡦಘ 8259A ѫ㾱ᴹ 4 ⿽ᐕ֌ᯩᔿ˖ķ 2. ࡍ࿻ॆભԔᆇ㕆〻 ᰾DŽ л䶒ᡁԜݸ㔉ࠪࡍ࿻ॆભԔᆇ઼᫽֌ભԔᆇⲴ㕆〻ᯩ⌅ˈ❦ਾ޽ሩަѝ⭘ࡠⲴаӋ᫽֌ᯩᔿ֌䘋а↕䈤 ੁєњ㣟⡷䜭ਁ䘱 EOI ભԔDŽ↔ਾ 8259A ቡՊ৫ࡔᯝлањᴰ儈Ոݸ㓗Ⲵѝᯝˈᒦ䟽༽к䘠༴⨶䗷〻DŽ ᶏѝᯝ˄EOI˅ભԔԕ༽ս ISR ѝⲴ∄⢩սDŽྲ᷌ѝᯝ䈧≲ᶕ㠚᧕㚄Ⲵㅜ 2 њ 8259A 㣟⡷ˈ䛓Ѹቡ䴰㾱 ੖ࡉⲴ䈍ˈ㤕 8259A ༴Ҿ䶎㠚ࣘ㔃ᶏᯩᔿˈ䛓Ѹ൘ѝᯝᴽ࣑〻ᒿ㔃ᶏᰦ〻ᒿቡ䴰㾱ੁ 8259A ਁ䘱ањ㔃 ᯩᔿˈ䛓Ѹ൘ㅜ 2 њ INTA 㜹ߢؑਧⲴ㔃ቮ༴↓൘ᴽ࣑ᇴᆈಘ ISR ѝⲴᖃࡽᴽ࣑ѝᯝ∄⢩սቡՊ㻛༽սDŽ ࡠ↔Ѫ→ˈCPU ѝᯝઘᵏ㔃ᶏDŽྲ᷌ 8259A ֯⭘Ⲵᱟ㠚ࣘ㔃ᶏѝᯝ AEOI˄Automatic End of Interrupt˅ 㜹ߢؑਧᵏ䰤 8259A ቡՊᢺањԓ㺘ѝᯝਧⲴ 8 սᮠᦞਁ䘱ࡠᮠᦞᙫ㓯к׋ CPU 䈫ਆDŽ ↔ਾˈCPU Պੁ 8259A ਁࠪㅜ 2 њ INTA 㜹ߢؑਧˈ䈕ؑਧ⭘Ҿ䙊⸕ 8259A 䘱ࠪѝᯝਧDŽഐ↔൘䈕 ⢩ս㻛㖞սDŽо↔਼ᰦˈѝᯝ䈧≲ᇴᆈಘ IRR ѝⲴሩᓄ∄⢩ս㻛༽սˈ㺘⽪䈕ѝᯝ䈧≲ᔰ࿻↓㻛༴⨶ѝDŽ ᆈࡠ↓൘ᴽ࣑ᇴᆈಘ ISR ѝˈণ ISR ѝሩᓄѝᯝ䈧≲㓗Ⲵ∄؍≳ѻਾቡՊᢺᡰ䘹ࠪⲴᴰ儈Ոݸ㓗ѝᯝ䈧 Պ൘ᢗ㹼ᆼᖃࡽⲴаᶑᤷԔѻਾੁ 8259A ਁ䘱ањ INTA ᶕ૽ᓄѝᯝؑਧDŽ8259A ൘᭦ࡠ䘉њ૽ᓄؑਧ ݸ㓗䀓᷀ಘѻਾˈՈݸ㓗ᴰ儈Ⲵѝᯝ䈧≲Պ㻛䘹ࠪDŽ↔ᰦ 8259A ቡՊੁ CPU ањ INT ؑਧˈ㘼 CPU ࡉ IMR ѝሩᓄս㻛㖞սˈࡉ⴨ᓄⲴѝᯝ䈧≲ቡнՊ䘱ࡠՈݸ㓗䀓᷀ಘѝDŽሩҾᵚቿ㭭Ⲵѝᯝ䈧≲㻛䘱ࡠՈ ᡆཊњѝᯝ䈧≲ؑਧࡠᶕᰦˈѝᯝ䈧≲ᇴᆈಘ IRR ѝ⴨ᓄⲴ∄⢩ս㻛㖞ս䬱ᆈDŽ↔ᰦ㤕ѝᯝቿ㭭ᇴᆈಘ ᶕ㠚਴њ䇮༷Ⲵѝᯝ䈧≲㓯࠶࡛䘎᧕ࡠ 8259A Ⲵ IR0—IR7 ѝᯝ䈧≲ᕅ㝊кDŽᖃ䘉Ӌᕅ㝊кᴹањ  VHWXSV 〻ᒿ ˈ⡷ѫ⡷ S7—S0 ਴∄⢩սሩᓄ㓗㚄ⲴӾ⡷DŽଚսѪ 1 ࡉ㺘⽪ѫ⡷Ⲵ䈕ѝᯝ䈧≲ᕅ㝊 IR кؑਧᶕ㠚Ӿ Ӿ⡷˖        ,' ,' ,'  $  ' ' ' ' ' ' ' ' ѫ⡷˖   6 6 6 6 6 6 6 6  $  ' ' ' ' ' ' ' ' 㺞 ̢ѣᯣࡓခौળԚᆍ ,&: Ṳᕅ Ṭᔿ㿱㺘 6–7 ᡰ⽪DŽ (3) ICW3 ⭘Ҿާᴹཊњ 8259A 㣟⡷㓗㚄ᰦˈ࣐䖭 8 սⲴӾᇴᆈಘ˄Slave Register˅DŽㄟਓൠ൰਼кDŽICW3 0x28—0x2fDŽ 0x20—0x27DŽ㘼Ӿ⡷Ⲵ ICW2 㻛䇮㖞ᡀ 0x28ˈ㺘⽪Ӿ⡷ѝᯝ䈧≲ 8 㓗—15 㓗ሩᓄⲴѝᯝਧ㤳തᱟ Linux 0.11 ㌫㔏ᢺѫ⡷Ⲵ ICW2 䇮㖞Ѫ 0x20ˈ㺘⽪ѫ⡷ѝᯝ䈧≲ 0 㓗—7 㓗ሩᓄⲴѝᯝਧ㤳തᱟ 䈫ਆDŽ վ 3 ս㓴ᡀањ 8 սⲴѝᯝਧDŽ8259A ൘᭦ࡠㅜ 2 њѝᯝ૽ᓄ㜹ߢ INTA ᰦՊ䘱ࡠᮠᦞᙫ㓯кˈԕ׋ CPU ൰DŽ൘֯⭘ 8086/88 ༴⨶ಘⲴ㌫㔏ᡆެᇩ㌫㔏ѝ T7—T3 ᱟѝᯝਧⲴ儈 5 սˈо 8259A 㣟⡷㠚ࣘ䇮㖞Ⲵ ൘ MCS80/85 ㌫㔏ѝˈս D7—D0 㺘⽪Ⲵ A15—A8 о ICW1 䇮㖞Ⲵ A7-A5 㓴ᡀѝᯝᴽ࣑〻ᒿ亥䶒ൠ  $  $7 $7 $7 $7 $7 $ $ $  ' ' ' ' ' ' ' ' 㺞 ̢ѣᯣࡓခौળԚᆍ ,&: Ṳᕅ ਓൠ൰ᱟ 0xA1DŽICW2 Ṭᔿ㿱㺘 6–6 ᡰ⽪DŽ 䘋㹼䇮㖞DŽ↔ᰦሩҾ PC/AT ᗞᵪ㌫㔏Ⲵཊ⡷㓗㚄ᛵߥлˈ8259A ѫ㣟⡷Ⲵㄟਓൠ൰ᱟ 0x21ˈӾ㣟⡷Ⲵㄟ (2) ICW2 ⭘Ҿ䇮㖞㣟⡷䘱ࠪⲴѝᯝਧⲴ儈 5 սDŽѝᯝਧ൘䇮㖞Ҷ ICW1 ѻਾˈᖃ A0=1 ᰦ㺘⽪ሩ ICW2 䴰㾱ਁ䘱 ICW4DŽ ൘ Linux 0.11 ޵ṨѝˈICW1 㻛䇮㖞Ѫ 0x11DŽ㺘⽪ѝᯝ䈧≲ᱟ䗩⋯䀖ਁǃཊ⡷ 8259A 㓗㚄ᒦфᴰਾ D0 IC4 1 – 䴰㾱 ICW4˗ 0 – н䴰㾱DŽ D1 SNGL 1 – অ⡷ 8259A˗ 0 – ཊ⡷DŽ D2 ADI MCS80/85 ㌫㔏⭘Ҿ CALL ᤷԔൠ൰䰤䳄DŽሩ 8086/88 ༴⨶ಘᰐ⭘DŽ D3 LTIM 1 - ⭥ᒣ䀖ਁѝᯝᯩᔿ˗0 – 䗩⋯䀖ਁᯩᔿDŽ D4 1 ᚂѪ 1 㓴ᡀDŽ䘉ࠐսሩ 8086/88 ༴⨶ಘᰐ⭘DŽ਼ޡ о ICW2 ѝⲴ A15—A8 A7—A5 㺘⽪൘ MCS80/85 ѝ⭘Ҿѝᯝᴽ࣑䗷〻Ⲵ亥䶒䎧࿻ൠ൰DŽ D5 A5 D6 A6 D7 A7 ս਽〠ਜ਼ѹ 㺞 ̢ѣᯣࡓခौળԚᆍ ,&: Ṳᕅ ᔿྲ㺘 6–5 ᡰ⽪˖ ᗞᵪ㌫㔏Ⲵཊ⡷㓗㚄ᛵߥлˈ8259A ѫ㣟⡷Ⲵㄟਓൠ൰ᱟ 0x20ˈӾ㣟⡷Ⲵㄟਓൠ൰ᱟ 0xA0DŽICW1 ⲴṬ  VHWXSV 〻ᒿ (2) OCW2 ⭘Ҿਁ䘱 EOI ભԔᡆ䇮㖞ѝᯝՈݸ㓗Ⲵ㠚ࣘᗚ⧟ᯩᔿDŽᖃ∄⢩ս D4D3 = 00ˈൠ൰㓯 A0=0 Ⲵቿ㭭սˈᴰਾ޽߉എѝᯝቿ㭭ᇴᆈಘѝDŽ৲㿱 kernel/blk_drv/floppy.c 〻ᒿㅜ 461 㹼DŽ ㄟਓ 0x21 ԕਆᗇ 8259A 㣟⡷Ⲵᖃࡽቿ㭭ᆇ㢲ˈ❦ਾок~0x40 ᶕ༽սሩᓄ䖟ⴈ᧗ࡦಘ䘎᧕Ⲵѝᯝ䈧≲ 6 ѝᯝ䈧≲ቿ㭭սDŽֻྲ൘䖟ⴈ傡ࣘ〻ᒿࡍ࿻ॆ㔃ᶏᰦˈѪҶݱ䇨䖟傡䇮༷ਁࠪѝᯝ䈧≲ˈቡՊ䈫ޣ᭩⴨ Ⲵ䇮༷傡ࣘ〻ᒿਾቡՊ࡙⭘䈕᫽֌ભԔᆇᶕ؞ޣ൘ Linux 0.11 ޵Ṩࡍ࿻ॆ䗷〻ѝˈԓ⸱൘䇮㖞ྭ⴨ M=0ˈࡉݱ䇨ሩᓄⲴѝᯝ䈧≲㓗DŽਖཆˈቿ㭭儈Ոݸ㓗ᒦнՊᖡ૽ަԆվՈݸ㓗Ⲵѝᯝ䈧≲DŽ ս D7—D0 ሩᓄ 8 њѝᯝ䈧≲ 7 㓗—0 㓗Ⲵቿ㭭ս M7—M0DŽ㤕 M=1ˈࡉቿ㭭ሩᓄѝᯝ䈧≲㓗˗㤕   0 0 0 0 0 0 0 0 $  ' ' ' ' ' ' ' ' ѣᯣᬃ֒ળԚᆍ 2&: Ṳᕅ㺞 ̢ OCW1 Ṭᔿ㿱㺘 6–9 ᡰ⽪DŽ (1) OCW1 ⭘Ҿሩ 8259A ѝѝᯝቿ㭭ᇴᆈಘ IMR 䘋㹼䈫/߉᫽֌DŽൠ൰㓯 A0 䴰Ѫ 1DŽㄟਓൠ൰䈤᰾਼кDŽ ᰦ䇮ᇊⲴ 8259A Ⲵᐕ֌ᯩᔿDŽ ᐕ֌ᵏ䰤ˈᡁԜҏਟԕ࡙⭘᫽֌ભԔᆇ OCW1—OCW3 ᶕⴁ⍻ 8259A Ⲵᐕ֌⣦ߥˈᡆ㘵䲿ᰦ᭩ਈࡍ࿻ॆ ൘ሩ 8259A 䇮㖞Ҷࡍ࿻ॆભԔᆇᇴᆈಘਾˈ㣟⡷ቡᐢ߶༷ྭ᧕᭦䇮༷Ⲵѝᯝ䈧≲ؑਧҶDŽն൘ 8259A 3. ᫽֌ભԔᆇ㕆〻 ፼྇ǃ䶎㕃ߢǃ䶎㠚ࣘ㔃ᶏѝᯝᯩᔿˈᒦф⭘Ҿ 8086 ৺ަެᇩ㌫㔏DŽޘᡀᲞ䙊 Linux 0.11 ޵Ṩ䘱ᖰ 8259A ѫ㣟⡷઼Ӿ㣟⡷Ⲵ ICW4 ભԔᆇⲴ٬൷Ѫ 0x01DŽ㺘 ⽪ 8259A 㣟⡷㻛䇮㖞 D0 ­PM 1 – 8086/88 ༴⨶ಘ㌫㔏˗ 0 – MCS80/85 ㌫㔏DŽ D1 AEOI 1 – 㠚ࣘ㔃ᶏѝᯝᯩᔿ˗ 0 – 䶎㠚ࣘ㔃ᶏᯩᔿDŽ D2 M/S 1 – 㕃ߢᯩᔿлѫ⡷˗ 0 – 㕃ߢᯩᔿлӾ⡷DŽ D3 BUF 1 – 㕃ߢᯩᔿ˗ 0 – 䶎㕃ߢᯩᔿDŽ ፼྇ᯩᔿDŽޘ፼྇ᯩᔿ˗ 0 – Პ䙊ޘ↺⢩D4 SFNM 1 – 䘹ᤙ D5 0 ᚂѪ 0 D6 0 ᚂѪ 0 D7 0 ᚂѪ 0 ս਽〠ਜ਼ѹ 㺞 ̢ѣᯣࡓခौળԚᆍ ,&: Ṳᕅ Ṭᔿ㿱㺘 6–8 ᡰ⽪DŽ (4) ICW4 ᖃ ICW1 Ⲵս 0˄IC4˅㖞սᰦˈ㺘⽪䴰㾱 ICW4DŽൠ൰㓯 A0=1DŽㄟਓൠ൰਼к䈤᰾DŽICW4 ഐ↔ˈѝᯝՈݸ㓗Ⲵᧂࡇ⅑ᒿѪ 0 㓗ᴰ儈ˈ᧕лᶕᱟӾ⡷кⲴ 8—15 㓗ˈᴰਾᱟ 3—7 㓗DŽ 㝊䘎᧕ањӾ㣟⡷DŽӾ㣟⡷Ⲵ ICW3 㻛䇮㖞Ѫ 0x02ˈণަḷ䇶ਧѪ 2DŽ㺘⽪Ӿ⡷䘎᧕ࡠѫ⡷Ⲵ IR2 ᕅ㝊DŽ Linux 0.11 ޵Ṩᢺ 8259A ѫ⡷Ⲵ ICW3 䇮㖞Ѫ 0x04ˈণ S2=1ˈަ։਴սѪ 0DŽ㺘⽪ѫ㣟⡷Ⲵ IR2 ᕅ ᦞᙫ㓯ਁ䘱Ӿ⡷ᖃࡽ䘹ѝѝᯝ䈧≲ⲴѝᯝਧDŽ Ⲵ٬о㠚ᐡⲴ ID2—ID0 ⴨ㅹᰦˈࡉ㺘⽪↔Ӿ⡷㻛䘹ѝDŽ↔ᰦ䈕Ӿ⡷ᓄ䈕ੁᮠޕ㚄㓯˄CAS2—CAS0˅䗃 Ӿ⡷Ⲵ ID2—ID0 йњ∄⢩սሩᓄ਴Ӿ⡷Ⲵḷ䇶ਧˈণ䘎᧕ࡠѫ⡷Ⲵѝᯝ㓗DŽᖃḀњӾ⡷᧕᭦ࡠ㓗 ੖ࡉሩᓄⲴ IR ᕅ㝊⋑ᴹ䘎Ӿ⡷DŽ  VHWXSV 〻ᒿ D1 RR ൘лањ RD 㜹ߢᰦ䈫ᇴᆈಘ⣦ᘱDŽ D2 P 1 – ḕ䈒˄POLL˅ભԔ˗ 0 – ᰐḕ䈒ભԔDŽ D3 1 ᚂѪ 1DŽ D4 0 ᚂѪ 0DŽ D6—D5 Ѫ 11 – 䇮㖞⢩↺ቿ㭭˗ 10 – ༽ս⢩↺ቿ㭭DŽ ሩ⢩↺ቿ㭭ᯩᔿ᫽֌DŽ D5 SMM D6 ESMM D7 0 ᚂѪ 0DŽ ս਽〠ਜ਼ѹ 㺞 ̢ѣᯣᬃ֒ળԚᆍ 2&: Ṳᕅ ᡰ⽪DŽ ⽪ሩ OCW3 䘋㹼㕆〻˄䈫/߉˅DŽն൘ Linux 0.11 ޵Ṩѝᒦ⋑ᴹ⭘ࡠ䈕᫽֌ભԔᆇDŽOCW3 ⲴṬᔿ㿱㺘 6–12 (3) OCW3 ⭘Ҿ䇮㖞⢩↺ቿ㭭ᯩᔿ઼䈫ਆᇴᆈಘ⣦ᘱ˄IRR ઼ ISR˅DŽᖃ D4D3=01ǃൠ൰㓯 A0=0 ᰦˈ㺘 ፼྇ᯩᔿлⲴ䶎⢩↺㔃ᶏѝᯝ EOI ભԔDŽޘ⽪٬Ѫ 0x20ˈ㺘 ֯⭘Ⲵ OCW2 Linux 0.11 ޵Ṩӵ֯⭘䈕᫽֌ભԔᆇ൘ѝᯝ༴⨶䗷〻㔃ᶏѻࡽੁ 8259A ਁ䘱㔃ᶏѝᯝ EOI ભԔDŽᡰ 0 1 0 ᰐ᫽֌DŽ ⢩↺ᗚ⧟ 1 1 0 *䇮㖞Ոݸ㓗ભԔDŽ 1 1 1 *⢩↺㔃ᶏѝᯝ EOI ભԔᰦᗚ⧟DŽ Ոݸ㓗㠚ࣘᗚ⧟ 0 0 0 㠚ࣘ㔃ᶏѝᯝ AEOI ᯩᔿᰦᗚ⧟˄␵䲔˅DŽ 1 0 0 㠚ࣘ㔃ᶏѝᯝ AEOI ᯩᔿᰦᗚ⧟˄䇮㖞˅DŽ 1 0 1 䶎⢩↺㔃ᶏѝᯝ EOI ભԔᰦᗚ⧟DŽ 㔃ᶏѝᯝ ፼྇ᯩᔿ˅DŽޘ0 1 1 *⢩↺㔃ᶏѝᯝ EOI ભԔ˄䶎 ፼྇ᯩᔿ˅DŽޘ˄0 0 1 䶎⢩↺㔃ᶏѝᯝ EOI ભԔ R(D7) SL(D6) EOI(D5) ਜ਼ѹ ㊫ර 㺞 ̢ᬃ֒ળԚᆍ 2&: Ⲻփ '' 㓺ਾ੡ѿ ISR ༽սˈᡆ㘵䘹ᤙ⢩↺ᗚ⧟Ոݸ㓗ᡀѪᖃࡽᴰվՈݸ㓗DŽ ަѝս D7—D5 Ⲵ㓴ਸⲴ֌⭘઼ਜ਼ѹ㿱㺘 6–11 ᡰ⽪DŽަѝᑖᴹ*ਧ㘵ਟ䙊䗷䇮㖞 L2--L0 ᶕᤷᇊՈݸ㓗֯ IRQ8—IRQ15˅DŽ L2—L0 3 ս㓴ᡀ㓗࡛ਧˈ࠶࡛ሩᓄѝᯝ䈧≲㓗࡛ IRQ0--IRQ7˄ᡆ D0 L0 D1 L1 D2 L2 D3 0 ᚂѪ 0DŽ D4 0 ᚂѪ 0DŽ D5 EOI 䶎㠚ࣘ㔃ᶏḷᘇDŽ D6 SL Ոݸ㓗䇮ᇊḷᘇDŽ D7 R Ոݸ㓗ᗚ⧟⣦ᘱDŽ ս਽〠ਜ਼ѹ 㺞 ̢ѣᯣᬃ֒ળԚᆍ 2&: Ṳᕅ ᰦ㺘⽪ሩ OCW2 䘋㹼㕆〻䇮㖞DŽ᫽֌ભԔᆇ OCW2 ⲴṬᔿ㿱㺘 6–10 ᡰ⽪DŽ  VHWXSV 〻ᒿ ᕅ㝊кDŽᖃӾ⡷Ⲵањѝᯝ䈧≲㓯㻛༴⨶ᒦ㻛૽ᓄޕѝˈӾ⡷Ⲵѝᯝ䗃ࠪㄟ㻛䘎᧕ࡠѫ⡷Ⲵѝᯝ䈧≲䗃 64 њѝᯝՈݸ㓗DŽѫ⡷䙊䗷 3 ṩ㓗㚄㓯ᶕ᧗ࡦӾ⡷DŽ䘉 3 ṩ㓗㚄㓯⴨ᖃҾӾ⡷Ⲵ䘹⡷ؑਧDŽ൘㓗㚄ᯩᔿ 8259A ਟԕ㻛ᖸᇩ᱃ൠ䘎᧕ᡀањѫ⡷઼㤕ᒢњӾ⡷㓴ᡀⲴ㌫㔏DŽ㤕֯⭘ 8 њӾ⡷䛓Ѹᴰཊਟ᧗ࡦ (4) ཊ⡷㓗㚄ᯩᔿ EOI ભԔDŽ 䈕٬ᱟ੖Ѫ 0DŽྲ᷌ᱟ 0ˈࡉ㺘⽪ਟԕ޽ੁѫ⡷ਁ䘱ањ䶎⢩↺ EOI ભԔDŽ㤕нѪ 0ˈࡉᰐ䴰ੁѫ⡷ਁ䘱 Ⲵᯩ⌅ᱟݸੁӾ⡷ਁࠪањ䶎⢩↺ѝᯝ㔃ᶏ EOI ભԔˈ❦ਾ䈫ਆަ↓൘ᴽ࣑ᇴᆈಘ ISR Ⲵ٬DŽỰḕ↔ᰦ b. ᖃ䘰ࠪѝᯝᴽ࣑〻ᒿᰦˈ〻ᒿᗵ享Ựḕᖃࡽѝᯝᴽ࣑ᱟ੖ᱟӾ⡷ਁࠪⲴୟаањѝᯝ䈧≲DŽỰḕ ቡн㜭㻛༴⨶DŽ ᖃањӾ⡷ѝᯝ䈧≲↓൘㻛ᴽ࣑ᰦˈ䈕Ӿ⡷Պ㻛ѫ⡷ቿ㭭ᦹDŽഐ↔Ӿ䈕Ӿ⡷ਁࠪⲴᴤ儈Ոݸ㓗ѝᯝ䈧≲ ፼྇ᯩᔿѝˈޘⲴަԆᴤ儈Ոݸ㓗ѝᯝ䈧≲ሶ㻛ѫ⡷䇶࡛ˈѫ⡷Պ・࡫ੁ CPU ਁࠪѝᯝDŽ㘼൘к䘠Პ䙊 a. ᖃӾḀњӾ⡷ਁࠪⲴѝᯝ䈧≲↓㻛ᴽ࣑ᰦˈ䈕Ӿ⡷ᒦнՊ㻛ѫ⡷ⲴՈݸ㓗ᧂ䲔DŽഐ↔䈕Ӿ⡷ਁࠪ ፼྇ᯩᔿ⴨լˈնᴹԕлє⛩ֻཆ˖ޘᆈDŽ䘉⿽ᯩᔿок䘠Პ䙊؍㾱 ፼྇ᯩᔿ˄D4=1˅ѫ㾱⭘Ҿ᧕䘎Ⲵབྷ㌫㔏ѝˈᒦф⇿њӾ⡷ѝⲴՈݸ㓗䴰ޘ↺⢩൘ ICW4 ѝ䇮㖞Ⲵ ፼྇ᯩᔿޘ↺⢩ ((3 䴰㾱Ѫ 001DŽᵜҖ䇘䇪Ⲵ Linux 0.11 ㌫㔏ѝࡉ֯⭘Ҷ䘉⿽䶎⢩↺ EOI ભԔDŽ л ISR ѝᴰ儈Ոݸ㓗∄⢩ս㛟ᇊᱟᴰਾ૽ᓄ઼ᴽ࣑ⲴՈݸ㓗DŽᆳҏ֯⭘ OCW2 ᶕਁࠪˈնᴰ儈 3 ∄⢩ս ፼྇ᯩᔿޘᔿⲴ䶎⢩↺ EOI ભԔՊ㠚ࣘൠᢺᖃࡽ↓൘ᴽ࣑ᇴᆈಘ ISR ѝᴰ儈Ոݸ㓗∄⢩ս༽սDŽഐѪ൘ ፼྇ᯩޘᱟ 011ˈᴰվ 3 ս⭘ᶕᤷᇊՈݸ㓗DŽ൘ⴞࡽⲴ Linux ㌫㔏ѝቡ֯⭘Ҷ䘉⿽⢩↺ EOI ભԔDŽ⭘Ҿ EOI ભԔᰦ䴰㾱ᤷᇊ㻛༽սⲴ ISR ѝⲴՈݸ㓗DŽ⢩↺ EOI ભԔ֯⭘᫽֌ભԔᆇ OCW2 ਁ䘱ˈ儈 3 ∄⢩ս ፼྇ᯩᔿлˈਟ⭘Ҿᤷᇊ EOI ભԔާփ༽սⲴѝᯝ㓗∄⢩սDŽণ൘ੁ㣟⡷ਁ䘱⢩↺ޘⲴ EOI ભԔ⭘Ҿ䶎 〻ᒿਁࠪ EOI ભԔⲴᯩ⌅ᴹє⿽ṬᔿDŽа⿽〠Ѫ⢩↺ EOI ભԔˈਖа⿽〠Ѫ䶎⢩↺ EOI ભԔDŽ⢩↺ 䘱єњ EOI ભԔˈањ⭘ҾӾ⡷ˈਖањ⭘Ҿѫ⡷DŽ EOI ભԔᶕ༽սDŽ䘉⿽ᯩ⌅〠Ѫ〻ᒿѝᯝ㔃ᶏ˄EOI˅ᯩ⌅DŽ൘᧕㚄㌫㔏ѝˈӾ⡷ѝᯝᴽ࣑〻ᒿ䴰㾱ਁ ⋯㻛༽սDŽ䘉⿽ᯩ⌅〠Ѫ㠚ࣘѝᯝ㔃ᶏ˄AEOI˅ᯩ⌅DŽަҼᱟ൘Ӿѝᯝᴽ࣑䗷〻䘄എѻࡽਁ䘱㔃ᶏѝᯝ ICW4 ѝⲴ㠚ࣘѝᯝ㔃ᶏ AEOI ∄⢩ս㖞սᰦˈ䙊䗷൘ CPU ਁࠪⲴㅜ 2 њѝᯝ૽ᓄ㜹ߢ INTA Ⲵ㔃ᶏ䗩 ྲкᡰ䘠ˈ↓൘ᴽ࣑ᇴᆈಘ ISR ѝ㻛༴⨶ѝᯝ䈧≲ሩᓄⲴ∄⢩սਟ֯⭘є⿽ᯩᔿᶕ༽սDŽަаᱟᖃ (2) ѝᯝ㔃ᶏ˄EOI˅ᯩ⌅ Ոݸ㓗ᴰվDŽLinux 0.11 ޵Ṩԓ⸱ণᢺ㌫㔏Ⲵ 8259A 㣟⡷䇮㖞ᐕ֌൘䘉њᯩᔿлDŽ ૽ަԆѝᯝ䈧≲Ⲵ᫽֌DŽᴰਾˈ൘ࡍ࿻ॆભԔᆇ㕆〻ѻਾˈ8259A ᕅ㝊 IR0 ާᴹᴰ儈Ոݸ㓗ˈ㘼 IR7 Ⲵ 㘵ˈѝᯝቿ㭭ᇴᆈಘ IMR Ⲵ⴨ᓄ∄⢩սਟԕ࠶࡛ቿ㭭 8 㓗ѝᯝ䈧≲ˈնቿ㭭ԫ᜿ањѝᯝ䈧≲ᒦнՊᖡ ᡰᴹ⴨਼Ոݸ㓗઼վՈݸ㓗Ⲵѝᯝ䈧≲ሶ㻛Ჲᰦ⾱→ˈնݱ䇨ᴤ儈Ոݸ㓗ѝᯝ䈧≲ᗇࡠ૽ᓄ઼༴⨶DŽ޽ ѝⲴ∄⢩սሶՊ൘ CPU ਁࠪㅜ 2 њѝᯝ૽ᓄ㜹ߢ INTA Ⲵ㔃ᶏ䗩⋯㻛༽սDŽ൘ ISR ᴹ㖞ս∄⢩սᵏ䰤ˈ എѻࡽਁ䘱㔃ᶏѝᯝ EOI ભԔѪ→DŽྲ᷌൘ ICW4 ભԔᆇѝ䇮㖞Ҷ㠚ࣘѝᯝ㔃ᶏ AEOI ∄⢩սˈ䛓Ѹ ISR ᤱࡠӾѝᯝᴽ࣑䗷〻䘄؍↓൘ᴽ࣑ᇴᆈಘ ISR Ⲵ⴨ᓄ∄⢩սՊ㻛㖞սˈᒦф䈕∄⢩սⲴ㖞ս⣦ᘱሶаⴤ ањѝᯝˈ䛓Ѹᴰ儈Ոݸ㓗ѝᯝ䈧≲ቡ㻛⺞ᇊˈᒦф䈕ѝᯝ䈧≲ⲴѝᯝਧՊ㻛᭮ࡠᮠᦞᙫ㓯кDŽਖཆˈ ֌ᯩᔿDŽ൘䘉⿽ᐕ֌ᯩᔿлˈѝᯝ䈧≲Ոݸ㓗Ⲵ〙ᒿᱟӾ 0 㓗ࡠ 7 㓗˄0 㓗Ոݸ㓗ᴰ儈˅DŽᖃ CPU ૽ᓄ ፼྇ᐕޘ䘉⿽ޕ൘ࡍ࿻ॆѻਾˈ䲔䶎֯⭘Ҷ᫽֌ભԔᆇ᭩ਈ䗷 8259A Ⲵᐕ֌ᯩᔿˈ੖ࡉᆳՊ㠚ࣘ䘋 ፼྇ᯩᔿޘ ((1 ⿽ᑨ㿱Ⲵᯩᔿ㔉ࠪ䈖㓶䈤᰾ˈԕׯ㜭ᴤྭൠ⨶䀓 8259A 㣟⡷Ⲵ䘀㹼ᯩᔿDŽ ൘䈤᰾ 8259A ࡍ࿻ॆભԔᆇ઼᫽֌ભԔᆇⲴ㕆〻䗷〻ѝˈᨀ৺Ҷ 8259A ⲴаӋᐕ֌ᯩᔿDŽл䶒ሩࠐ 4. 8259A ᫽֌ᯩᔿ䈤᰾ D0 RIS D1—D0 Ѫ 11 – 䈫↓൘ᴽ࣑ᇴᆈಘ ISR˗ 10 – 䈫ѝᯝ䈧≲ᇴᆈಘ IRRDŽ  VHWXSV 〻ᒿ ൘ᖃࡽⲴ /LQX[ ᫽֌㌫㔏ѝˈJDV ઼ JOG ᐢ㓿࠶࡛ᴤ਽Ѫ DV ઼ OGDŽ ignore_intDŽѝᯝ᧿䘠ㅖ㺘ѝ⇿њ᧿䘠ㅖ亩ҏঐ 8 ᆇ㢲ˈަṬᔿ㿱മ 6-9 ᡰ⽪DŽ 亩ˈᒦ֯਴њ㺘亩൷ᤷੁањਚᣕ䭉䈟Ⲵଁѝᯝᆀ〻ᒿ 256 ޡˈᦞ⇥ᇴᆈಘˈ䟽ᯠ䇮㖞ѝᯝ᧿䘠ㅖ㺘 idt 䘉⇥〻ᒿᇎ䱵к༴Ҿ޵ᆈ㔍ሩൠ൰ 0 ༴ᔰ࿻ⲴൠᯩDŽ䘉њ〻ᒿⲴ࣏㜭∄䖳অаDŽ俆ݸᱟ࣐䖭਴њᮠ ᯩੁᱟӾᐖࡠਣDŽ Ⲵᱟ AT&T Ⲵ≷㕆䈝䀰Ṭᔿˈᒦф䴰㾱֯⭘ GNU Ⲵ gas ઼ gld7䘋㹼㕆䈁䘎᧕DŽഐ↔䈧⌘᜿ԓ⸱ѝ䍻٬Ⲵ ᣔ⁑ᔿл䘀㹼ҶDŽheads.s ≷㕆〻ᒿоࡽ䶒Ⲵ䈝⌅Ṭᔿн਼ˈᆳ䟷⭘؍䜭ᱟ൘ޘӾ䘉䟼ᔰ࿻ˈ޵Ṩᆼ 㓖ᴹ 120KB ᐖਣˈഐ↔൘⻱ⴈкབྷ㓖ঐ 240 њᡷ४DŽ ⁑ඇѻਾᔰ࿻Ⲵᡷ४ѝˈণӾ⻱ⴈкㅜ 6 њᡷ४ᔰ࿻᭮㖞DŽа㡜ᛵߥл Linux 0.11 ޵ṨⲴ system ⁑ඇབྷ Ⲵᴰࡽ䶒ᔰ࿻䜘࠶ˈ䘉ҏቡᱟѪӰѸ〠ަѪཤ䜘(head)〻ᒿⲴ৏ഐDŽsystem ⁑ඇሶ㻛᭮㖞൘⻱ⴈк setup head.s 〻ᒿ൘㻛㕆䈁⭏ᡀⴞḷ᮷ԦਾՊо޵ṨަԆ〻ᒿа䎧㻛䬮᧕ᡀ system ⁑ඇˈսҾ system ⁑ඇ 6.4.1 ࣕ㜳ᨅ䘦 6.4 head.s ぁᓅ ❦ਾ᡽ਟԕ䘋㹼䈫᫽֌DŽ 䗷ⴤ᧕䈫ਆ OCW1 ᶕᗇࡠDŽ൘䈫 IRR ᡆ ISR ѻࡽࡉ䴰㾱俆ݸ֯⭘ OCW3 䗃ࠪ䈫ਆ IRR ᡆ ISR ⲴભԔˈ 8259A ѝᴹ 3 њᇴᆈಘ˄IMRǃIRR ઼ ISR˅ਟ䇙 CPU 䈫ਆަ⣦ᘱDŽIMR ѝⲴᖃࡽቿ㭭ؑ᚟ਟԕ䙊 (7) 䈫ᇴᆈಘ⣦ᘱ 㭭ؑ᚟Պ֯ᡰᴹᵚ㻛ቿ㭭ⲴՈݸ㓗ѝᯝ൷ਟԕ൘Ḁњѝᯝ䗷〻ѝ㻛૽ᓄDŽ ᡁԜ䴰㾱֯⭘ OCW3 俆ݸ䇮㖞䘉⿽ᯩᔿ˄D6ǃD5 ∄⢩ս˅DŽ൘䘉⿽⢩↺ቿ㭭ᯩᔿлˈOCW1 䇮㖞Ⲵቿ 㜭䴰㾱ѝᯝᴽ࣑䗷〻㜭ࣘᘱൠ᭩ਈ㌫㔏ⲴՈݸ㓗DŽѪҶ䀓ߣ䘉њ䰞仈ˈ8259A ѝᕅ䘋Ҷ⢩↺ቿ㭭ᯩᔿDŽ 䘱 EOI ભԔѻࡽ˅ˈ䘉⿽Პ䙊ቿ㭭ᯩᔿՊ֯ᗇ 8259A ቿ㭭ᡰᴹվՈݸ㓗Ⲵѝᯝ䈧≲DŽնᴹӋᓄ⭘൪ਸਟ ቿ㭭ањѝᯝ䈧≲ᒦнՊᖡ૽ަԆՈݸ㓗Ⲵѝᯝ䈧≲DŽሩҾањѝᯝ䈧≲൘૽ᓄᒦ㻛ᴽ࣑ᵏ䰤˄⋑ᴹਁ ቿ㭭ᯩᔿˈ֯⭘ OCW1 ᶕ䇮㖞 IMRDŽIMR Ⲵ਴∄⢩ս˄D7--D0˅࠶࡛֌⭘Ҿ਴њѝᯝ䈧≲ᕅ㝊 IR7 -- IR0DŽ ѝᯝቿ㭭ᇴᆈಘ IMR ਟԕ᧗ࡦሩ⇿њѝᯝ䈧≲Ⲵቿ㭭DŽ8259A ਟ䇮㖞є⿽ቿ㭭ᯩᔿDŽሩҾа㡜Პ䙊 (6) ѝᯝቿ㭭ᯩᔿ ᯝ䈧≲ᶕࡠᰦ䴰㾱ㅹᖵᆳѻࡽⲴ 7 њ䇮༷䜭᧕ਇҶᴽ࣑ѻਾ᡽㜭ᗇࡠᴽ࣑DŽ ণ൘ањ䇮༷᧕ਇᴽ࣑ਾˈަՈݸ㓗㠚ࣘਈᡀᴰվⲴDŽՈݸ㓗׍⅑ᗚ⧟ਈॆDŽᴰн࡙Ⲵᛵߥᱟᖃањѝ ᖃᡁԜ൘㇑⨶Ոݸ㓗⴨਼Ⲵ䇮༷ᰦˈቡਟԕ֯⭘ OCW2 ᢺ 8259A 㣟⡷䇮㖞ᡀ㠚ࣘᗚ⧟Ոݸ㓗ᯩᔿDŽ (5) 㠚ࣘᗚ⧟Ոݸ㓗ᯩᔿ њ⭘Ҿѫ⡷ˈਖањ⭘ҾӾ⡷DŽ ࡛ሩѫ⡷઼Ӿ⡷Ⲵࡍ࿻ॆભԔᆇ ICW3 䘋㹼㕆〻DŽ൘᫽֌䗷〻ѝҏ䴰㾱ਁ䘱 2 њѝᯝ㔃ᶏ EOI ભԔDŽа ൘㓗㚄㌫㔏ѝˈ⇿њ 8259A 㣟⡷ᗵ享⤜・ൠ䘋㹼ࡍ࿻ॆˈᒦфਟԕᐕ֌൘н਼ᯩᔿлDŽਖཆˈ㾱࠶ ᰦˈѫ⡷Պ䘹ᤙ䈕Ӿ⡷ᢺ⴨ᓄⲴѝᯝਧ᭮ࡠᮠᦞᙫ㓯кDŽ  KHDGV 〻ᒿ /$9     ս $'亥ᑗൠ൰˄3DJH)UDP$GGUHVV˅ :  5 6  8   3                     䘹ᤙㅖ⇥  ٬〫ٿਓ⛩ޕ䗷〻   /3'   3  ٬〫ٿਓ⛩ޕ䗷〻       ѝᯝ䰘˄,QWHUUXSW*DWH˅   ᣔᵪࡦа䎧㓴ਸ֯⭘DŽն⇥؍˅ᣔḷᘇ˄U/SǃR/W˅䴰㾱о⇥᧿䘠ㅖѝⲴ⢩ᵳ㓗˄PL؍㺘亩ѝ䇮㖞Ⲵ ᣔᯩ⌅DŽ࠶亥ᵪࡦѝ亥ⴞᖅ㺘઼亥؍䘉ṧ䇮㖞޵Ṩ亥㺘኎ᙗⲴ৏ഐᱟ˖CPU Ⲵ࠶⇥ᵪࡦ઼࠶亥㇑⨶䜭ᴹ 䘉䟼⇿њ㺘亩Ⲵ኎ᙗḷᘇ䜭㻛䇮㖞ᡀ 0x07˄P=1ǃU/S=1ǃR/W=1˅ˈ㺘⽪䈕亥ᆈ൘ǃ⭘ᡧਟ䈫߉DŽ ഴ 享ⴤᖋ㺞亯ૂ享㺞亯㔉ᶺ   亩ሩᓄ亥䶒൘⢙⨶޵ᆈѝ亥䶒ൠ൰Ⲵ儈 20 ∄⢩սDŽ ᘇ˗U/S ᱟ⭘ᡧ/䎵㓗⭘ᡧḷᘇ˗A ᱟ亥䶒ᐢ䇯䰞ḷᘇ˗D ᱟ亥䶒޵ᇩᐢ؞᭩ḷᘇ˗ᴰᐖ䗩 20 ∄⢩ᱟ㺘 ᆳԜⲴ㺘亩DŽ亥ⴞᖅ㺘亩઼亥㺘亩Ṭᔿ㿱മ 6-10 ᡰ⽪DŽަѝ P ᱟ亥䶒ᆈ൘Ҿ޵ᆈḷᘇ˗R/W ᱟ䈫߉ḷ ਟራ൰ 16MB ޵ᆈⲴ 4 њ亥㺘ˈᒦ࠶࡛䇮㖞ޡ⨶޵ᆈս㖞ˈഐ↔䘉⇥〻ᒿሶ㻛㾶ⴆᦹ˅ˈ㍗䲿ਾ䶒᭮㖞 ᧕⵰䇮㖞㇑⨶޵ᆈⲴ࠶亥༴⨶ᵪࡦˈሶ亥ⴞᖅ㺘᭮൘㔍ሩ⢙⨶ൠ൰ 0 ᔰ࿻༴˄ҏᱟᵜ〻ᒿᡰ༴Ⲵ⢙ ѝ䇮㖞⴨ᓄⲴḷᘇսDŽ ❦ਾ〻ᒿ⍻䈅 PC ᵪᱟ੖ਜ਼ᴹᮠᆖॿ༴⨶ಘ㣟⡷˄80287ǃ80387 ᡆަެᇩ㣟⡷˅ˈᒦ൘᧗ࡦᇴᆈಘ CR0 ᗚ⧟DŽ↫ޕ޵ᇩˈҏণо䇯䰞Ӿ 0 ൠ൰ᔰ࿻ሩᓄᆇ㢲Ⲵ޵ᇩ䜭⴨਼DŽྲ᷌Ự⍻лᶕਁ⧠⋑ᴹᔰ੟ˈࡉ䘋 ྲ᷌⋑ᴹᔰ੟ˈࡉ൘䇯䰞儈Ҿ 1MB ⢙⨶޵ᆈൠ൰ᰦ CPU ᇎ䱵ਚՊᗚ⧟䇯䰞˄IP MOD 1Mb˅ൠ൰༴Ⲵ ᧕⵰֯⭘⢙⨶ൠ൰ 0 о 1MB ᔰ࿻༴Ⲵᆇ㢲޵ᇩ⴨∄䖳Ⲵᯩ⌅ˈỰ⍻ A20 ൠ൰㓯ᱟ੖ᐢⵏⲴᔰ੟DŽ 䙏㕃ߢ४Ⲵа䜘࠶DŽ ⸱∄䖳ਸ⨶ⲴൠᯩDŽࡽ䶒䇮㖞Ⲵ GDT 㺘༴Ҿ޵ᆈ 0x902XX ༴DŽ䘉њൠᯩሶ൘޵Ṩࡍ࿻ॆਾ⭘֌޵ᆈ儈 ৏ GDT 㺘〫ࣘࡠ޵ᆈ䘲ᖃս㖞༴DŽഐ↔䘉䟼䟽ᯠ䇮㖞 GDT Ⲵѫ㾱৏ഐᱟѪҶᢺ gdt 㺘᭮൘޵ᆈ޵Ṩԓ аṧDŽᖃ❦ᡁԜҏਟԕ൘ setup.s 〻ᒿѝቡᢺ᧿䘠ㅖⲴ⇥䲀䮯ⴤ᧕䇮㖞ᡀ 16MBˈ❦ਾⴤ᧕ᢺޘԆ޵ᇩᆼ ৏ᶕ൘ setup.s 〻ᒿѝ䇮㖞Ⲵ GDT 㺘᧿䘠ㅖ䲔Ҷ൘⇥䲀䮯кᴹӋ४࡛ԕཆ˄৏Ѫ 8MBˈ⧠ Ѫ 16MB˅ˈަ ተ⇥᧿䘠ㅖ㺘 gdtDŽᇎ䱵кᯠ䇮㖞Ⲵ GDT 㺘оޘ൘䇮㖞ྭѝᯝ᧿䘠ㅖ㺘ѻਾˈᵜ〻ᒿ৸䟽ᯠ䇮㖞Ҷ ↔ѝᯝ䰘᧿䘠ㅖⲴᆇ㢲 5 ઼ᆇ㢲 4 Ⲵ٬ᓄ䈕ᱟ 0x8E00DŽ ٬DŽ⭡Ҿ޵Ṩԓ⸱⇥аⴤᆈ൘Ҿ޵ᆈѝˈᒦф⢩ᵳ㓗Ѫ 0ˈণ P=1ˈDPL=00DŽഐ〫ٿ൘޵Ṩԓ⸱⇥ѝⲴ ٬ҏቡᱟѝᯝ༴⨶ᆀ〻ᒿ〫ٿ٬DŽ⭡Ҿ head.s 〻ᒿ㻛〫ࣘࡠӾ޵ᆈൠ൰ 0 ᔰ࿻༴ˈഐ↔䈕〫ٿ〻ᒿѝⲴ ٬㻛䇮㖞Ѫ ignore_int ѝᯝ༴⨶ᆀ〻ᒿ൘ head.s〫ٿ0x0008ˈ㺘⽪䈕ଁѝᯝ༴⨶ᆀ〻ᒿ൘޵Ṩԓ⸱ѝDŽ ަѝˈP ᱟ⇥ᆈ൘ḷᘇ˗DPL ᱟ᧿䘠ㅖⲴՈݸ㓗DŽ൘ head.s 〻ᒿѝˈѝᯝ䰘᧿䘠ㅖѝ⇥䘹ᤙㅖ䇮㖞Ѫ ѣᯣᨅ䘦ㅜ㺞 ,'7 ѣⲺѣᯣ䰞ᨅ䘦ㅜṲᕅ ഴ   KHDGV 〻ᒿ ᔰཤˈHD[ 㺘⽪ᱟ  սⲴ D[ ᇴᆈಘDŽ  ⇿њᇴᆈಘ਽䜭㾱ԕ ᔰ࿻ˈ੖ࡉ㺘⽪ൠ൰DŽ  PRYO[HD[ሩҾ *18 ≷㕆ˈ⇿њⴤ᧕᫽֌ᮠ㾱ԕ  㹼䇮㖞਴њᮠᦞ⇥ᇴᆈಘDŽVWDUWXSB  ⭘Ⲵ⭘ᡧḸҶDŽ਼֯ޡ  ԫ࣑  ᢗ㹼˄LQLWPDLQF ѝ  㹼˅ԕਾ䈕Ḹቡ㻛⭘֌ԫ࣑  ઼ԫ࣑ XVHUBVWDFN ᮠ㓴ᵛㄟⲴањ䮯ᤷ䪸DŽㅜ  㹼䇮㖞䘉䟼֯⭘ⲴḸˈခф〠Ѫ㌫㔏ḸDŽն൘〫ࣘࡠ  㹼DŽᆳᱟᤷੁаṧˈӵ⇥䲀䮯Ӿ 0% ؞᭩ᡀҶ 0%DŽVWDFNBVWDUW ᇊѹ൘ NHUQHOVFKHGFˈ ተ⇥᧿䘠㺘ѝࡍ࿻޵ᇩо VHWXSV ѝⲴสᵜޘተ⇥᧿䘠㺘DŽᯠޘਾ䶒ᇊѹⲴᯠѝᯝ᧿䘠ㅖ㺘઼ Ⲵ䘹ᤙㅖ [ˈᒦሶึḸ᭮㖞൘ VWDFNBVWDUW ᤷੁⲴ XVHUBVWDFN ᮠ㓴४ˈ❦ਾ֯⭘ᵜ〻ᒿ ተ⇥᧿䘠ㅖ㺘ㅜ  亩˅ޘ˄⇥л䶒ԓ⸱Ⲵਜ਼ѹᱟ˖䇮㖞 GVHVIVJV Ѫ VHWXSVѝᶴ䙐Ⲵᮠᦞ 㿱ࡽ䶒 VHWXSV ѝ ˈ 㹼˅৲ੁ㺘ѝⲴᮠᦞ⇥᧿䘠ㅖ亩DŽ˄᧿䘠ㅖⲴާփᮠ٬ ս   DŽᆳ↓ྭᤷ ս   ǃ䘹ᤙ㺘ѝㅜ  亩 ተ᧿䘠ㅖ㺘ޘս   ǃ䘹ᤙ  ⢩ᵳ㓗  㹼лⲴ䈤᰾DŽ䘉䟼[ Ⲵਜ਼ѹᱟ䈧≲ 䘹ᤙㅖⲴ䈤᰾䈧৲㿱 VHWXSV ѝޣⲴ䘹ᤙㅖDŽᴹ ᡆ㘵ᴤ߶⺞ൠ䈤ᱟањ᧿䘠ㅖ㺘亩ˈ٬〫ٿተ⇥᧿䘠ㅖ㺘ѝⲴޘ⇥ᇴᆈಘˈᆳ⧠൘ަᇎᱟ ਴њޕ޽⅑⌘᜿䘉䟼ᐢ㓿༴Ҿ  ս䘀㹼⁑ᔿˈഐ↔䘉䟼Ⲵ[ ᒦнᱟᢺൠ൰ [ 㻵  亥ⴞᖅሶՊᆈ᭮൘䘉䟼DŽBSJBGLU JOREOBLGWBJGWBSJBGLUBWPSBIORSS\BDUHD WH[W   ഐ↔䘉䟼Ⲵ੟ࣘԓ⸱ሶ㻛亥ⴞᖅ㾶ⴆᦹDŽ  ⌘᜿ ս੟ࣘԓ⸱ᱟӾ㔍ሩൠ൰ [ ᔰ࿻Ⲵˈ䘉䟼ҏ਼ṧᱟ亥ⴞᖅሶᆈ൘Ⲵൠᯩˈ  KHDGV ਜ਼ᴹ  ս੟ࣘԓ⸱DŽ      WKHSDJHGLUHFWRU\  WKHSDJHGLUHFWRU\ZLOOH[LVW7KHVWDUWXSFRGHZLOOEHRYHUZULWWHQE\  127(6WDUWXSKDSSHQVDWDEVROXWHDGGUHVV[ZKLFKLVDOVRZKHUH    KHDGVFRQWDLQVWKHELWVWDUWXSFRGH       /LQXV7RUYDOGV &     OLQX[ERRWKHDGV     ぁᓅ 6-3 linux/boot/head.s 6.4.2 ԙ⸷⌞䠀 〻ᒿDŽ ਓൠ൰ᕩࠪˈ৫䘀㹼 main()ޕᴰਾˈhead.s 〻ᒿ࡙⭘䘄എᤷԔሶ亴ݸ᭮㖞൘ึḸѝⲴ/init/main.c 〻ᒿⲴ н㜭䲿᜿䇯䰞޵Ṩ䍴ⓀDŽ 䇱䘉єњԫ࣑ԓ⸱нӵਟԕ൘⭘ᡧᘱлᢗ㹼ˈ㘼ф৸؍⸱઼ᮠᦞDŽഐ↔䘉䟼ᢺ亥䶒኎ᙗ䇮㖞Ѫ 0x7 ቡਟ ˄U/S=0˅ࡉᰒнਟ߉ǃҏнਟԕ䈫DŽ⭡Ҿ޵Ṩԓ⸱ᴹӋ⢩࡛ѻ༴ˈণަѝवਜ਼ᴹԫ࣑ 0 ઼ԫ࣑ 1 Ⲵԓ ˄U/S=1˅ਟԕ䇯䰞ˈᒦфਚᴹḷ䇠Ѫਟ䈫߉Ⲵ亥䶒˄W/R = 1˅ᱟਟ߉ⲴDŽ㘼↔ᰦ኎Ҿ䎵㓗⭘ᡧⲴ亥䶒 ޵ᆈ䈫߉᫽֌DŽྲ᷌ CPL = 3ˈࡉ䈤᰾ CPU ↓൘ԕ⭘ᡧ˄User˅䓛ԭ䘀㹼DŽ↔ᰦਚᴹ኎Ҿ User Ⲵ亥䶒 ྲ 0˅ˈࡉ䈤᰾ CPU ↓൘ԕ䎵㓗⭘ᡧ˄Supervisor˅䓛ԭ䘀㹼DŽ ↔ᰦᡰᴹ亥䶒䜭㜭䇯䰞ˈᒦਟ䲿᜿䘋㹼 ᣔDŽྲ᷌ᖃࡽ⢩ᵳ㓗 CPL < 3˄ֻ؍ᣔˈ❦ਾ޽Ựḕ亥؍⇥᧿䘠ㅖѝⲴ PL 䎧ѫ㾱֌⭘DŽCPU Պ俆ݸỰḕ  KHDGV 〻ᒿ ᣔ؍⌘᜿൘л䶒䘉⇥〻ᒿѝˈ ᓄ䈕ሶս  㖞սˈԕỰḕ൘䎵㓗⭘ᡧ⁑ᔿлⲴ߉      LQWIRUPDWKHUURUV   ELWDOVRVRDVWRXVH XVHUVSUREDEO\ZDQWWRVHWWKH1(   FDOOV PRGH7KHQLWZRXOGEHXQQHFHVVDU\ZLWKWKHYHULI\BDUHD  127(VKRXOGVHWELWWRFKHFNIRUZULWHSURWHFWLQVXSHUYLVRU    IRUZDUG 䐣䖜ࡠḷਧ  ৫DŽ ࡉ㺘⽪ੁࡽ I 㤕ᱟ EDFNZDUG 䐣䖜ࡠḷਧ  ৫˄ 㹼˅DŽ 㺘⽪ੁਾ E MHE FPSOHD[[ W PRYOHD[[ORRSIRUHYHULILWLVQ LQFOHD[FKHFNWKDW$UHDOO\,6HQDEOHG [RUOHD[HD[  ਟԕੁਾੁࡽᕅ⭘  њḷਧ˄ᴰ䘌ㅜ  њ˅DŽ 㺘⽪Āੁࡽ˄IRUZDUGV˅āDŽ൘≷㕆〻ᒿⲴḀа༴ˈᡁԜᴰབྷ I 㺘⽪Āੁਾ˄EDFNZDUGV˅āˈ E  ˈ䘉䟼 1 ᱟ  њࡽੁᕅ⭘ѻаDŽк䶒 1I ᮠᆇDŽѪҶᕅ⭘ањተ䜘ḷਧⲴлањᇊѹˈ䴰㾱߉ᡀ ˈަѝ 1 ᱟᇊѹḷਧᰦ֯⭘Ⲵ 1E 㺘⽪ањᮠᆇ˅DŽѪҶᕅ⭘ݸࡽᴰ䘁ᇊѹⲴ䘉њㅖਧˈ䴰㾱߉ᡀ ᖒᔿ˄ަѝ 1 1 ᶕᕅ⭘DŽѪҶᇊѹањተ䜘ㅖਧˈ䴰ᢺḷਧ߉ᡀ  ǃǃ  ǃ  ਽֯⭘਽〠 ᴹ  њተ䜘ㅖਧ਽ˈਟ൘ᮤњ〻ᒿѝ䟽༽֯⭘DŽ䘉Ӌㅖਧޡ㕆䈁ಘ઼㕆〻ӪઈѤᰦ֯⭘аӋ਽〠DŽ ᒦਟԕ֌ѪᤷԔⲴ᫽֌ᮠDŽተ䜘ㅖਧ⭘Ҿᑞࣙˈս㖞䇑ᮠ˄$FWLYHORFDWLRQFRXQWHU˅Ⲵᖃࡽ٬ ᱟањተ䜘ㅖਧᶴᡀⲴḷਧDŽḷਧ⭡ㅖਧਾ䐏ањ߂ਧ㓴ᡀDŽ↔ᰦ䈕ㅖਧ㺘⽪⍫ࣘ   㹼кⲴ  ∄䖳л৫ˈҏণ↫ᗚ⧟ǃ↫ᵪDŽ㺘⽪ൠ൰ $ 㓯⋑ᴹ䘹䙊ˈ㔃᷌޵Ṩቡн㜭֯⭘ 0% ԕк޵ᆈDŽ 0 ༴ᱟ੖ҏᱟ䘉њᮠ٬DŽྲ᷌аⴤ⴨਼Ⲵ䈍ˈቡаⴤ ਾⴻ޵ᆈൠ൰ [❦ˈањᮠ٬ ԫ᜿ޕ 㹼⭘Ҿ⍻䈅 $ ൠ൰㓯ᱟ੖ᐢ㓿ᔰ੟DŽ䟷⭘Ⲵᯩ⌅ᱟੁ޵ᆈൠ൰ [ ༴߉  OVVBVWDFNBVWDUWHVS  ᇎ৸㻛䟽ᯠ࣐䖭DŽ⺞ 6& ؍⺞䐣䖜ࡠㅜ  㹼ᶕ ˈ BB.(51(/B&6 I OMPS 䪸ሩ䈕䰞仈ˈⴞࡽ޵Ṩѝቡ൘ㅜ  㹼ѻਾ␫࣐Ҷаᶑ䮯䐣䖜ᤷԔ˖ ࠪ䭉DŽ 䰞仈ˈ㘼ф൘ԕਾ޵Ṩᢗ㹼䗷〻ѝ⇥䰤䐣䖜ᰦՊ䟽ᯠ࣐䖭 &6DŽഐ↔䘉䟼⋑ᴹ࣐䖭ᆳᒦ⋑ᴹ䇙〻ᒿ аṧˈ0% Ⲵ䲀䮯൘޵Ṩࡍ࿻ॆ䱦⇥нՊᴹޘ䟽ᯠ䇮㖞Ⲵԓ⸱⇥᧿䘠ㅖ䲔Ҷ⇥䲀䮯ԕཆަ։䜘࠶ᆼ Ⲵ䲀䮯䘈ᱟ 0%DŽ䘉ṧⴻᶕᓄ䈕䟽ᯠ࣐䖭 &6DŽնᱟ⭡Ҿ VHWXSV ѝⲴ޵Ṩԓ⸱⇥᧿䘠ㅖоᵜ〻ᒿѝ ֯⭘ ERFKV 䐏䑚㿲ሏˈྲ᷌нሩ &6 ޽⅑ᢗ㹼࣐䖭ˈ䛓Ѹ൘ᢗ㹼ࡠ  㹼ᰦ &6 ԓ⸱⇥нਟ㿱䜘࠶ѝ ઼ᵜ〻ᒿਾ䶒Ⲵ  㹼˅ˈഐ↔䘉䟼޽⅑ሩᡰᴹ⇥ᇴᆈಘᢗ㹼࣐䖭᫽֌ᱟᗵ享ⲴDŽਖཆˈ䙊䗷  ⭡Ҿ⇥᧿䘠ㅖѝⲴ⇥䲀䮯Ӿ VHWXSV ѝⲴ 0% ᭩ᡀҶᵜ〻ᒿ䇮㖞Ⲵ 0%˄㿱 VHWXSV 㹼  PRYD[JV&6 ԓ⸱⇥ᇴᆈಘᐢ㓿൘ VHWXSBJGW ѝ䟽ᯠ࣐䖭䗷ҶDŽ PRYD[IVഐѪ؞᭩Ҷ JGWˈᡰԕ䴰㾱䟽ᯠ㻵䖭ᡰᴹⲴ⇥ᇴᆈಘDŽ  VHWXSBJGW PRYD[HVUHORDGHGLQ PRYD[GVDIWHUFKDQJLQJJGW&6ZDVDOUHDG\ PRYO[HD[UHORDGDOOWKHVHJPHQWUHJLVWHUV ተ᧿䘠ㅖ㺘ᆀ〻ᒿDŽޘFDOOVHWXSBJGW䈳⭘䇮㖞 FDOOVHWXSBLGW䈳⭘䇮㖞ѝᯝ᧿䘠ㅖ㺘ᆀ〻ᒿDŽ  㹼DŽVWDFNBVWDUW ᇊѹ൘ NHUQHOVFKHGFˈ HVSˈ䇮㖞㌫㔏ึḸDŽOVVBVWDFNBVWDUWHVS㺘⽪BVWDFNBVWDUWÎVV PRYD[JV PRYD[IV PRYD[HV PRYD[GV  KHDGV 〻ᒿ VHWXSBLGW     UHW  ॿ༴⨶ಘ⸱DŽ IVHWSPIRULJQRUHGE\ E\WH['%[( DOLJQ   ᰐ䴰䈕ᤷԔˈᒦфሶՊᢺ䈕ᤷԔⴻ֌ᱟオ᫽֌DŽ ᣔ⁑ᔿDŽ؍л䶒Ⲵєњᆇ㢲٬ᱟ  ॿ༴⨶ಘᤷԔ IVHWSP Ⲵᵪಘ⸱DŽަ֌⭘ᱟᢺ  䇮㖞Ѫ ᡆᮠᦞⲴ䙏ᓖ઼᭸⦷DŽ৲㿱〻ᒿਾⲴ䈖㓶䈤᰾DŽ ⴤ᧕ᰦ߉ࠪሩ喀Ⲵ٬㘼䶎  Ⲵ⅑ᯩ٬ҶDŽ֯⭘䈕ᤷ⽪ㅖⲴⴞⲴᱟѪҶᨀ儈  ս &38 䇯䰞޵ᆈѝԓ⸱ 䈳ᮤࡠൠ൰٬ᴰਾ  ∄⢩սѪ䴦Ⲵս㖞˄A˅ˈণ᤹  ᆇ㢲ᯩᔿሩ喀޵ᆈൠ൰DŽн䗷⧠൘ *18DV ս㖞〫ٿл䶒ᱟа≷㕆䈝䀰ᤷ⽪ㅖDŽަਜ਼ѹᱟᤷᆈۘ䗩⭼ሩ喀䈳ᮤDŽ㺘⽪ᢺ䲿ਾⲴԓ⸱ᡆᮠᦞⲴ  UHW PRYOHD[FU  UHVHW03VHW(0 [RUOHD[ PRYOFUHD[ྲ᷌ᆈ൘ࡉੁࡽ䐣䖜ࡠḷਧ  ༴ˈ੖ࡉ᭩߉ FUDŽ  KDYHWRVHWELWVQRFRSURFHVVRU MHI FPSEDOࡍ࿻ॆਾ⣦ᘱᆇᓄ䈕Ѫ ˈ੖ࡉ䈤᰾ॿ༴⨶ಘнᆈ൘DŽ IVWVZD[ਆॿ༴⨶ಘ⣦ᘱᆇࡠ D[ ᇴᆈಘѝDŽ IQLQLWੁॿ༴⨶ಘਁࠪࡍ࿻ॆભԔDŽ FKHFNB[  㔏ѝᆈ൘ॿ༴⨶ಘⲴ䈍ˈ䛓Ѹ൘ᢗ㹼Ҷ IQLQLW ᤷԔਾަ⣦ᘱᆇվᆇ㢲㛟ᇊѪ DŽ ॿ༴⨶ಘ㓸→ᢗ㹼ᖃࡽ↓൘ᢗ㹼ⲴԫօݸࡽⲴ㇇ᵟ᫽֌DŽIVWVZᤷԔਆॿ༴⨶ಘⲴ⣦ᘱᆇDŽྲ᷌㌫ ަ᧗ࡦᆇѪ唈䇔٬ǃ␵䲔⣦ᘱᆇ઼ᡰᴹ⎞⛩ḸᔿᇴᆈಘDŽ䶎ㅹᖵᖒᔿⲴ䘉ᶑᤷԔ˄IQLQLW˅䘈Պ䇙 ILQLWੁॿ༴⨶ಘਁࠪࡍ࿻ॆભԔˈᆳՊᢺॿ༴⨶ಘ㖞Ҿањᵚਇԕࡽ᫽֌ᖡ૽Ⲵᐢ⸕⣦ᘱˈ䇮㖞 л䶒 IQLQLW ઼ IVWVZ ᱟᮠᆖॿ༴⨶ಘ˄˅ⲴᤷԔDŽ   ᡁԜ׍䎆Ҿ (7 ḷᘇⲴ↓⺞ᙗᶕỰ⍻  ᆈ൘о੖DŽ      :HGHSHQGRQ(7WREHFRUUHFW7KLVFKHFNVIRU     MPSDIWHUBSDJHBWDEOHV䐣䖜ࡠ  㹼DŽ FDOOFKHFNB[ PRYOHD[FU RUOHD[VHW03  RUO[HD[KHUHIRUPLJKWEHJRRG  DQGO[HD[6DYH3*3((7 PRYOFUHD[FKHFNPDWKFKLS  䴰㾱䇮㖞 &5 ѝⲴॿ༴⨶ಘԯⵏս (0˄ս ˅ˈᒦ༽սॿ༴⨶ಘᆈ൘ḷᘇ 03˄ս ˅DŽ 䇮ᆈ൘ॿ༴⨶ಘⲴᛵߥлᢗ㹼ањॿ༴⨶ಘᤷԔˈྲ᷌ࠪ䭉Ⲵ䈍ࡉ䈤᰾ॿ༴⨶ಘ㣟⡷нᆈ൘ˈٷ л䶒䘉⇥〻ᒿ˄˅⭘ҾỰḕᮠᆖॿ༴⨶ಘ㣟⡷ᱟ੖ᆈ൘DŽᯩ⌅ᱟ؞᭩᧗ࡦᇴᆈಘ &5ˈ൘ ᯠ䘋〻ᰦᇎ⧠߉ᰦ༽ࡦ˄FRS\RQZULWH˅ᯩ⌅DŽ ⭘Ҿ⾱→䎵㓗⭘ᡧ㓗Ⲵ〻ᒿੁа㡜⭘ᡧਚ䈫亥䶒ѝ䘋㹼߉᫽֌DŽ䈕ḷᘇѫ㾱⭘Ҿ᫽֌㌫㔏൘ࡋᔪ ᣔḷᘇ :3˄:ULWH3URWHFW˅ˈ؍к䶒৏⌘䟺ѝᨀࡠⲴ &38 ѝ &5 ᧗ࡦᇴᆈಘⲴս  ᱟ߉   ሩᮠᆖॿ༴⨶ಘⲴࠪ䭉֯⭘ LQWDŽ   㖞սˈԕׯ 䈳⭘ቡн䴰㾱ҶDŽ Ⲵ⭘ᡧ䙊ᑨҏՊᜣሶ 1( ↔ਾYHULI\BDUHD   KHDGV 〻ᒿ ተ᧿䘠ㅖ㺘亩VHWXSBJGWޘ䇮㖞      7KLVURXWLQHZLOOEHRYHUZULWWHQE\WKHSDJHWDEOHV   UDWKHUORQJFRPPHQWLVFHUWDLQO\QHHGHG  LV9(5<FRPSOLFDWHGDWWZRZKROHOLQHVVRWKLV  RQHVWKDWZHUHEXLOWLQLQLWV7KHURXWLQH  2QO\WZRHQWULHVDUHFXUUHQWO\EXLOWWKHVDPH  7KLVURXWLQHVVHWVXSDQHZJGWDQGORDGVLW    VHWXSBJGW     UHW OLGWLGWBGHVFU࣐䖭ѝᯝ᧿䘠ㅖ㺘ᇴᆈಘ٬DŽ MQHUSBVLGW GHFHF[ DGGOHGLHGL ᤷੁ㺘ѝла亩DŽ HGL HD[ ޵ᇩ᭮ࡠHGLᡰᤷ޵ᆈս㖞༴DŽ PRYOHG[ 㺘ѝDŽޕHGL ሶଁѝᯝ䰘᧿䘠ㅖᆈ PRYOHD[ USBVLGW PRYHF[ OHDBLGWHGLBLGW ᱟѝᯝ᧿䘠ㅖ㺘Ⲵൠ൰DŽ ↔ᰦ HG[ ਜ਼ᴹ䰘᧿䘠ㅖ儈  ᆇ㢲Ⲵ٬DŽ  LQWHUUXSWJDWHGSO SUHVHQW PRYZ[(G[ 䰘᧿䘠ㅖվ  ᆇ㢲Ⲵ٬DŽ HD[ Ⲵվ  սѝDŽ↔ᰦ HD[ ਜ਼ᴹ ޕ٬Ⲵվ  ս㖞〫ٿ  VHOHFWRU [ FV PRYZG[D[ HD[ Ⲵ儈  սѝDŽ ޕPRYO[HD[ሶ䘹ᤙㅖ [ 㖞 ٬ÎHG[ ᇴᆈಘ˅٬〫ٿ˄OHDLJQRUHBLQWHG[ሶ LJQRUHBLQW Ⲵᴹ᭸ൠ൰ VHWXSBLGW  ॆ䗷〻ѝՊᴯᦒᆹ㻵䛓Ӌⵏ↓ᇎ⭘Ⲵѝᯝ᧿䘠ㅖ亩DŽ 亩DŽHD[ ਜ਼ᴹ᧿䘠ㅖվ  ᆇ㢲ˈHG[ ਜ਼ᴹ儈  ᆇ㢲DŽ޵Ṩ൘䲿ਾⲴࡍ࿻  ޡˈ䜭᭮㖞䈕᧿䘠ㅖ ਾ൘ LGW 㺘⇿а亩ѝ❦ˈ䘉⇥ԓ⸱俆ݸ൘ HG[ǃHD[ ѝ㓴ਸ䇮㖞ࠪ  ᆇ㢲唈䇔Ⲵѝᯝ᧿䘠ㅖ٬ 䟿ˈ ᆇ㢲ᱟ䘹ᤙㅖˈ ᆇ㢲ᱟаӋḷᘇDŽ〫ٿ*DWH'HVFULSWRU DŽᆳⲴ  ᆇ㢲ᱟ  ተ㺘ѝⲴн਼ˈ㻛〠Ѫ䰘᧿䘠ㅖޘѝᯝ᧿䘠ㅖ㺘ѝⲴ亩㲭❦ҏᱟ  ᆇ㢲㓴ᡀˈնަṬᔿо   䜭↓ᑨᰦ޽ᔰ੟ѝᯝDŽ䈕ᆀ〻ᒿሶՊ㻛亥㺘㾶ⴆᦹDŽ  ⭘ OLGW ᤷԔ DŽⵏ↓ᇎ⭘Ⲵѝᯝ䰘ԕਾ޽ᆹ㻵DŽᖃᡁԜ൘ަԆൠᯩ䇔Ѫа࠷ ᧿䘠ㅖ㺘ᇴᆈಘ  ሶѝᯝ᧿䘠ㅖ㺘 LGW 䇮㖞ᡀާᴹ  њ亩ˈᒦ䜭ᤷੁ LJQRUHBLQW ѝᯝ䰘DŽ❦ਾ࣐䖭ѝᯝ    л䶒䘉⇥ᱟ䇮㖞ѝᯝ᧿䘠ㅖ㺘ᆀ〻ᒿVHWXSBLGW      ZULWWHQE\WKHSDJHWDEOHV  VXUHHYHU\WKLQJLVRN7KLVURXWLQHZLOOEHRYHU  DUHHQDEOHGHOVHZKHUHZKHQZHFDQEHUHODWLYHO\  LQWKHLGWWDEOHPD\GRVRWKHPVHOYHV,QWHUUXSWV  LGW(YHU\WKLQJWKDWZDQWVWRLQVWDOOLWVHOI  LJQRUHBLQWLQWHUUXSWJDWHV,WWKHQORDGV  VHWVXSDLGWZLWKHQWULHVSRLQWLQJWR     KHDGV 〻ᒿ PDLQF 〻ᒿⵏⲴ䘰ࠪᰦˈቡՊ䘄എࡠ䘉䟼Ⲵḷਧ / ༴㔗㔝ᢗ㹼л৫ˈҏণ↫ᗚ⧟DŽ ḸⲴ᫽֌ˈᡰԕྲ᷌ޕḸ᫽֌ᱟ⁑ᤏ䈳⭘ PDLQF 〻ᒿᰦ俆ݸሶ䘄എൠ൰ޕ 㹼Ⲵ  ⋑ᴹ⭘ࡠDŽ ն PDLQˈ٬ᓄ䈕࠶࡛㺘⽪ HQYSǃDUJY ᤷ䪸઼ DUJF Ⲵ٬  Ḹޕࡽ䶒  њ ࠭ᮠ䈳⭘ᵪࡦⲴ䈤᰾DŽ & ޣ〻ᒿѝDŽ৲㿱ㅜ  ㄐѝᴹ  Ⲵൠ൰ˈᒦᢺ᧗ࡦᵳ䖜〫ࡠ LQLWPDLQF ᴰਾ൘ㅜ  㹼ᢗ㹼 UHW ᤷԔᰦቡՊᕩࠪ PDLQ  ࠭ᮠԓ⸱Ⲵൠ൰DŽᖃ KHDGV Ҷ PDLQޕҶ䘄എൠ൰ˈ㘼ㅜ  㹼ࡉ঻ޕⲴᤷԔ൘Ḹѝ঻  㹼к ࠭ᮠ֌߶༷ᐕ֌DŽㅜ Ḹ᫽֌⭘ҾѪ䐣䖜ࡠ LQLWPDLQF ѝⲴ PDLQޕл䶒䘉ࠐњ  DŽ ⮉  亩ˈ⇿亩  ᆇ㢲ˈປݵᮠ٬؍ޡILOO BWPSBIORSS\BDUHD   ቡਟ׋䖟ⴈ傡ࣘ〻ᒿ֯⭘DŽަൠ൰䴰㾱ሩ喀䈳ᮤˈ䘉ṧቡнՊ䐘䎺 .% 䗩⭼DŽ  ᖃ '0$˄ⴤ᧕ᆈۘಘ䇯䰞˅н㜭䇯䰞㕃ߢඇᰦˈл䶒Ⲵ WPSBIORSS\BDUHD ޵ᆈඇ    RQDN%ERUGHU  W UHDFKWRDEXIIHUEORFN,WQHHGVWREHDOLJQHGVRWKDWLWLVQ  WPSBIORSS\BDUHDLVXVHGE\WKHIORSS\GULYHUZKHQ'0$FDQQRW    ༴ᔰ࿻DŽ ] 〫ٿRUJ[ᇊѹл䶒Ⲵ޵ᆈᮠᦞඇӾ  SJ RUJ[  SJ RUJ[  SJ RUJ[  SJ ᔰ࿻༴ሶᆈ᭮亥㺘ⴞᖅ˅DŽ  〫ٿ˄༴ᔰ࿻ᱟㅜ  њ亥㺘 ] 〫ٿRUJ[Ӿ  亥Ṷൠ൰ˈ⭘Ҿᤷࠪа亥޵ᆈⲴ⢙⨶䎧࿻ൠ൰DŽ ' ս  ㅹ˗㺘亩Ⲵս  ᱟ ᱟ੖㜿Ҷ 86 ս  ǃᱟ੖؞᭩䗷 Პ䙊⭘ᡧ䘈ᱟ䎵㓗⭘ᡧ֯⭘ 5: ս  ǃ 3 ս  ǃ䈫߉䇨ਟ 亥㺘亩ⲴṬᔿѪ˖亩Ⲵࡽ  սᆈ᭮аӋḷᘇˈֻྲᱟ੖൘޵ᆈѝ  њ㺘亩DŽྲ᷌ањ亥㺘亩ራ൰ .% Ⲵൠ൰オ䰤ˈࡉањ亥㺘ቡਟԕራ൰ 0% Ⲵ⢙⨶޵ᆈDŽ ਟԕᆈ᭮ޡ⇿њ亥㺘䮯Ѫ .E ᆇ㢲˄ 亥޵ᆈ亥䶒˅ˈ㘼⇿њ亥㺘亩䴰㾱  њᆇ㢲ˈഐ↔ањ亥㺘   ྲ᷌֐ᴹཊҾ 0E Ⲵ޵ᆈˈቡ䴰㾱൘䘉䟼䘋㹼ᢙݵ؞᭩DŽ  /LQXV ሶ޵ṨⲴ޵ᆈ亥㺘ⴤ᧕᭮൘亥ⴞᖅѻਾˈ֯⭘Ҷ  њ㺘ᶕራ൰ 0% Ⲵ⢙⨶޵ᆈDŽ    PRUHWKDQ0%ZLOOKDYHWRH[SDQGWKLV  XVLQJRIWKHPWRVSDQ0ERISK\VLFDOPHPRU\3HRSOHZLWK  ,SXWWKHNHUQHOSDJHWDEOHVULJKWDIWHUWKHSDJHGLUHFWRU\     UHW ޵ᇩᐢ䇮㖞ྭˈ㿱  㹼 DŽ ተ᧿䘠ㅖ㺘ᇴᆈಘޘOJGWJGWBGHVFU࣐䖭 VHWXSBJGW   䈕ᆀ〻ᒿሶ㻛亥㺘㾶ⴆᦹDŽ  䶒ⲴаṧDŽ䈕ᆀ〻ᒿਚᴹє㹼ˈĀ䶎ᑨⲴā༽ᵲˈᡰԕᖃ❦䴰㾱䘉Ѹ䮯Ⲵ⌘䟺Ҷ-DŽ  ተ᧿䘠ㅖ㺘 JGWˈᒦ࣐䖭DŽ↔ᰦӵࡋᔪҶєњ㺘亩ˈоࡽޘ䘉њᆀ〻ᒿ䇮㖞ањᯠⲴ   KHDGV 〻ᒿ WKHILUVW0%7KHSDJHUDVVXPHVWKDWQRLOOHJDO  LQFU7KHSDJHWDEOHVDUHVHWXSLGHQWLW\PDSSLQJ  7KLVURXWLQHVHWVXSSDJLQJE\VHWWLQJWKHSDJHELW    6HWXSBSDJLQJ      ٬ҏᕩࠪ˅DŽ˅ḸⲴ &38 ḷᘇᇴᆈಘ˄ սޕLUHWѝᯝ䘄എ˄ᢺѝᯝ䈳⭘ᰦ঻ SRSOHD[ SRSOHF[ SRSOHG[ SRSGV SRSHV SRSIV SRSOHD[ ᱟ SULQWN 㕆䈁ਾ⁑ඇѝⲴ޵䜘㺘⽪⌅DŽ BSULQWN  FDOOBSULQWN䈕࠭ᮠ൘NHUQHOSULQWNF ѝDŽ Ḹ-DŽޕ˅ 8QNQ ˈࡉ㺘⽪ᢺ LQWBPVJ ㅖਧ༴Ⲵ䮯ᆇ˄  ࡽн࣐ ḸDŽ⌘᜿ʽ㤕ㅖਧ LQWBPVJޕ˅SXVKOLQWBPVJᢺ䈳⭘ SULQWN ࠭ᮠⲴ৲ᮠᤷ䪸˄ൠ൰ PRYD[IV PRYD[HV PRYD[GV PRYO[HD[㖞⇥䘹ᤙㅖ˄֯ GVHVIV ᤷੁ JGW 㺘ѝⲴᮠᦞ⇥˅DŽ SXVKIV SXVKHV Ḹˈҏণ䴰㾱ঐ⭘  њᆇ㢲ⲴึḸオ䰤DŽޕӽ❦Պԕ  սⲴᖒᔿ ḸਾޕSXVKGV䘉䟼䈧⌘᜿ʽʽGVHVIVJV ㅹ㲭❦ᱟ  սⲴᇴᆈಘˈն SXVKOHG[ SXVKOHF[ SXVKOHD[ LJQRUHBLQW DOLJQ᤹  ᆇ㢲ᯩᔿሩ喀޵ᆈൠ൰DŽ എ䖖ᦒ㹼 āDŽ DVFL]8QNQRZQLQWHUUXSW?Q?UᇊѹᆇㅖѢĀᵚ⸕ѝᯝ LQWBPVJ  л䶒ᱟ唈䇔ⲴѝᯝĀੁ䟿ਕᷴā-    7KLVLVWKHGHIDXOWLQWHUUXSWKDQGOHU   ᡰԕ␫࣐Ҷ䈕䈝ਕDŽ䘉ṧᡁԜቡ⸕䚃ਁ⭏ӰѸ䰞仈ҶDŽ PDLQ 〻ᒿ㔍ሩнᓄ䈕䘄എࡠ䘉䟼DŽн䗷ѪҶԕ䱢заˈ MXVWLQFDVHZHNQRZZKDWKDSSHQV MPS/PDLQVKRXOGQHYHUUHWXUQKHUHEXW /  㹼DŽ MPSVHWXSBSDJLQJ䐣䖜㠣ㅜ ᱟ㕆䈁〻ᒿሩ PDLQ Ⲵ޵䜘㺘⽪ᯩ⌅DŽ BPDLQ SXVKOBPDLQ SXVKO/UHWXUQDGGUHVVIRUPDLQLILWGHFLGHVWR ㅖਧ㺘⽪䘉ᱟањ・ণ᫽֌ᮠDŽ  SXVKOަѝⲴ SXVKO䘉Ӌᱟ䈳⭘ PDLQ 〻ᒿⲴ৲ᮠ˄ᤷ LQLWPDLQF˅DŽ  SXVKO7KHVHDUHWKHSDUDPHWHUVWRPDLQ DIWHUBSDJHBWDEOHV ࠭ᮠ䈳⭘ᵪࡦ䈧৲㿱〻ᒿਾⲴ䈤᰾DŽ & ޣᴹ 䘄എᤷԔᰦቡՊሶ PDLQF 〻ᒿⲴൠ൰ᕩࠪึḸˈᒦ৫ᢗ㹼 PDLQF 〻ᒿҶDŽ UHW ᢗ㹼 Ḹˈ䘉ṧˈ൘䇮㖞࠶亥༴⨶˄VHWXSBSDJLQJ˅㔃ᶏਾึޕ 㹼ሶ PDLQF Ⲵൠ൰঻  KHDGV 〻ᒿ ֻྲSJ㺘⽪˖[ˈᱟ亥ⴞᖅ㺘ѝⲴㅜ  亩DŽ 亥ⴞᖅ亩Ⲵ㔃ᶴо亥㺘ѝ亩Ⲵ㔃ᶴаṧˈ њᆇ㢲Ѫ  亩DŽ৲㿱к䶒  㹼лⲴ䈤᰾DŽ ᴹ  њ亥㺘ᡰԕਚ䴰䇮㖞  亩DŽޡ˅л䶒  ਕ䇮㖞亥ⴞᖅ㺘ѝⲴ亩ˈഐѪᡁԜ˄޵Ṩ  HGL ᡰᤷ޵ᆈս㖞༴ˈф HGL ໎DŽVWRVOHD[ ޵ᇩᆈࡠ HVUHSFOG 亥ⴞᖅӾ [ ൠ൰ᔰ࿻DŽ  SJBGLULVDW[ [RUOHGLHGL [RUOHD[HD[  SDJHVSJBGLUSDJHWDEOHV HF[ PRYO 俆ݸሩ  亥޵ᆈ˄ 亥ⴞᖅ 亥亥㺘˅␵䴦DŽVHWXSBSDJLQJ DOLJQ᤹  ᆇ㢲ᯩᔿሩ喀޵ᆈൠ൰䗩⭼DŽ   ᆇ㢲DŽ ᯠⲴ䘋〻ˈ㌫㔏Պ൘ѫ޵ᆈ४Ѫަ⭣䈧亥䶒ᆈ᭮亥㺘DŽਖཆˈ 亥޵ᆈ䮯ᓖᱟ 䘉䟼Ⲵ  亥亥㺘ࡉ኎Ҿ޵Ṩу⭘ˈᆳԜаа᱐ሴ㓯ᙗൠ൰䎧࿻ 0% オ䰤㤳തࡠ⢙⨶޵ᆈкDŽሩҾ ⭘Ⲵˈ㘼ޜ൘޵ᆈ⢙⨶ൠ൰ [ ༴ᔰ࿻ᆈ᭮  亥亥ⴞᖅ㺘઼  亥亥㺘DŽ亥ⴞᖅ㺘ᱟ㌫㔏ᡰᴹ䘋〻  ӛ䍴Ⓚˈᗵ享ᴹ〻ᒿ䘋㹼㔏а㇑⨶ԕ䚯ݽ䍴Ⓚҹ⭘઼ㄎҹDŽޡᆈ४ѝ޵ᆈ亥䶒ᱟ  ㅹ࠭ᮠ㧧ਆDŽഐѪѫ޵ ˄Პ䙊˅࠭ᮠDŽ㤕㾱֯⭘ѫ޵ᆈ४Ⲵ亥䶒ˈቡ䴰㾱֯⭘ JHWBIUHHBSDJH ѫ޵ᆈ४オ䰤⭡ PP ⁑ඇ㇑⨶DŽᆳ⎹৺ࡠ亥䶒᱐ሴ᫽֌DŽ޵ṨѝᡰᴹަԆ࠭ᮠቡᱟ䘉䟼ᤷⲴа㡜 к䶒㤡᮷⌘䟺ㅜ  ⇥Ⲵਜ਼ѹᱟᤷ൘ᵪಘ⢙⨶޵ᆈѝབྷҾ 0% Ⲵ޵ᆈオ䰤ѫ㾱㻛⭘Ҿѫ޵ᆈ४DŽ   ᭩ࣘቡ㹼Ҷ/˅DŽ  䇱֌䘉Ӌ؍ᡁᐢ㓿䙊䗷䇮㖞Ḁ㊫ḷᘇᶕ㔉ࠪ䴰㾱᭩ࣘⲴൠᯩ˄ᩌ㍒Ā0Eā˅ˈնᡁн㜭  Ѫ 0EˈഐѪᡁⲴᵪಘ޽ᘾѸᢙݵ⭊㠣н㜭䎵䗷䘉њ⭼䲀˄ᖃ❦ˈᡁⲴᵪಘᱟᖸׯᇌⲴ-˅DŽ  䘉䟼ˈሩᆳ䘋㹼؞᭩੗DŽ˄ᇎ䱵кˈ䘉ᒦнཚഠ䳮ⲴDŽ䙊ᑨਚ䴰؞᭩аӋᑨᮠㅹDŽᡁᢺᆳ䇮㖞  ሩҾ䛓ӋᴹཊҾ 0E ޵ᆈⲴᇦՉ̢ⵏᱟཚᒨ䘀Ҷˈᡁ䘈⋑ᴹˈѪӰѸ֐Պᴹ-DŽԓ⸱ቡ൘    オ䰤ˈ䈕ൠ൰オ䰤ሶ㻛᱐ሴࡠަԆаӋൠᯩ৫PP˄޵ᆈ㇑⨶〻ᒿ˅Պ㇑⨶䘉ӋһⲴDŽ  ⴤ᧕֯⭘!0E Ⲵൠ൰DŽᡰᴹĀᲞ䙊ā࠭ᮠӵ֯⭘վҾ 0E Ⲵൠ൰オ䰤ˈᡆ㘵ᱟ֯⭘ተ䜘ᮠᦞ  ⌘᜿ʽቭ㇑ᡰᴹⲴ⢙⨶ൠ൰䜭ᓄ䈕⭡䘉њᆀ〻ᒿ䘋㹼ᚂㅹ᱐ሴˈնਚᴹ޵Ṩ亥䶒㇑⨶࠭ᮠ㜭    ൠ൰᱐ሴ˄ҏণ൘ਚᴹ 0E Ⲵᵪಘк䇮㖞ࠪབྷҾ 0E Ⲵ޵ᆈൠ൰˅DŽ  ᇊнՊӗ⭏䶎⌅Ⲵٷᒦ䇮㖞਴њ亥㺘亩Ⲵ޵ᇩˈԕᚂㅹ᱐ሴࡽ 0% Ⲵ⢙⨶޵ᆈDŽ࠶亥ಘ  䘉њᆀ〻ᒿ䙊䗷䇮㖞᧗ࡦᇴᆈಘ FU Ⲵḷᘇ˄3*ս ˅ᶕ੟ࣘሩ޵ᆈⲴ࠶亥༴⨶࣏㜭ˈ        VDOO WJXDUDQWHHWKDW ZRQ  VHDUFKIRU0E EXW, VRPHNLQGRIPDUNHUDWWKHP  YHWULHGWRVKRZZKLFKFRQVWDQWVWRFKDQJHE\KDYLQJ ,   RNEXWLWZDVFKHDS HYHQFDQQRWEHH[WHQGHGSDVWWKDW  FKDQJHVRPHFRQVWDQWVHWF,OHIWLWDW0EDVP\PDFKLQH  WEHWRRGLIILFXOW0RVWO\ 6HULRXVO\LWVKRXOGQ LW   7KHVRXUFHLVKHUH&KDQJHQRWJRWLWZK\VKRXOG\RX  YH )RUWKRVHZLWKPRUHPHPRU\WKDQ0EWRXJKOXFN,    WKDW  ZLOOEHPDSSHGWRVRPHRWKHUSODFHPPNHHSVWUDFNRI  XVHMXVWWKHORZHU0ERUWKHORFDOGDWDVSDFHZKLFK  XVHWKH!0EDGGUHVVHVGLUHFWO\$OOQRUPDOIXQFWLRQV  PDSSHGE\WKLVURXWLQHRQO\WKHNHUQHOSDJHIXQFWLRQV  127($OWKRXJKDOOSK\VLFDOPHPRU\VKRXOGEHLGHQWLW\     LH!0ERQD0EPDFKLQH DGGUHVVHVDUHSURGXFHG   KHDGV 〻ᒿ   AORQJBJGWPDJLFQXPEHUEXWLWZRUNVIRUPH VDQ\⌘˖QRWÆQRWH QRWWKDWWKDW VRGRHVJGW ZRUG JGWBGHVFU ս㖞ˈ㿱  㹼DŽ〫ٿተ㺘൘ᵜ〻ᒿѝⲴޘਟᴹ  亩DŽㅖਧBJGW ᱟޡ㓴ᡀањ᧿䘠ㅖ亩ˈᡰԕ㺘ѝ ተ㺘䮯ᓖ䇮㖞Ѫ .% ᆇ㢲˄[II ণਟ˅ˈഐѪ⇿  ᆇ㢲ޘਾ  ᆇ㢲ᱟ JGW 㺘Ⲵ㓯ᙗสൠ൰DŽ䘉䟼 ተ᧿䘠ㅖ㺘ᇴᆈಘ JGWU ⲴᤷԔ OJGW 㾱≲Ⲵ  ᆇ㢲᫽֌ᮠDŽࡽ  ᆇ㢲ᱟ JGW 㺘Ⲵ䲀䮯ˈޘл䶒࣐䖭  ZRUG DOLJQ ORQJBLGW 亩ˈ䲀䮯 䮯ᓖDŽ  ޡLGWFRQWDLQVHQWULHV ZRUG LGWBGHVFU ਾ  ᆇ㢲ᱟ LGW 㺘൘㓯ᙗൠ൰オ䰤ѝⲴ  սสൠ൰DŽ л䶒ᱟ࣐䖭ѝᯝ᧿䘠ㅖ㺘ᇴᆈಘ LGWU ⲴᤷԔ OLGW 㾱≲Ⲵ  ᆇ㢲᫽֌ᮠDŽࡽ  ᆇ㢲ᱟ LGW 㺘Ⲵ䲀䮯ˈ  ZRUG䘉䟼ݸオࠪ  ᆇ㢲ˈ䘉ṧ  㹼кⲴ䮯ᆇᱟ  ᆇ㢲ሩ喀ⲴDŽ DOLJQ᤹  ᆇ㢲ᯩᔿሩ喀޵ᆈൠ൰䗩⭼DŽ   〻ᒿ৫䘀㹼DŽᵜ〻ᒿࡠ↔ቡⵏ↓㔃ᶏҶDŽ ḸѝⲴ PDLQ 〻ᒿⲴൠ൰ᕩࠪˈᒦ䐣䖜ࡠLQLWPDLQFึޕ䈕䘄എᤷԔⲴਖањ֌⭘ᱟሶ  㹼঻ ൘᭩ਈ࠶亥༴⨶ḷᘇਾ㾱≲֯⭘䖜〫ᤷԔࡧᯠ亴ਆᤷԔ䱏ࡇˈ䘉䟼⭘Ⲵᱟ䘄എᤷԔ UHWDŽ   WKLVDOVRIOXVKHVSUHIHWFKTXHXH UHW  3* ELW VHWSDJLQJ PRYOHD[FU RUO[HD[␫к 3* ḷᘇDŽ PRYOFUHD[ 䇮㖞੟ࣘ֯⭘࠶亥༴⨶˄FU Ⲵ 3* ḷᘇˈս ˅  FUSDJHGLUHFWRU\VWDUW PRYOHD[FU 亥ⴞᖅ㺘൘ [ ༴DŽ SJBGLULVDW[ [RUOHD[HD[ ᆈⲴᱟ亥ⴞᖅ㺘Ⲵ⢙⨶ൠ൰DŽ؍ᤷੁ亥ⴞᖅ㺘DŽFU ѝˈ䇮㖞亥ⴞᖅ㺘ส൰ᇴᆈಘ FU Ⲵ٬ ␫߉ྭҶDŽޘMJHEྲ᷌ሿҾ  ࡉ䈤᰾ VXEO[HD[⇿ປ߉ྭа亩ˈ⢙⨶ൠ൰٬߿ [DŽ   ILOOSDJHVEDFNZDUGVPRUHHIILFLHQW VWRVO  ᆇ㢲 DŽ ٬䙂߿ VWGᯩੁս㖞սˈHGL ࣐к኎ᙗḷᘇ ˈণѪ [IIIDŽ ᴰਾ  亩ሩᓄ⢙⨶޵ᆈ亥䶒Ⲵൠ൰ᱟ [IIIˈ   UZXVHUS 0E PRYO[IIIHD[ HGLHGLÎᴰਾа亥Ⲵᴰਾа亩DŽPRYOSJ  DŽDŽഐ↔ᴰਾа亥Ⲵᴰਾа亩Ⲵս㖞ቡᱟSJ   ս㖞ᱟ 䘰亪ᒿປ߉DŽањ亥㺘Ⲵᴰਾа亩൘亥㺘ѝⲴق֯⭘Ⲵᯩ⌅ᱟӾᴰਾањ亥㺘Ⲵᴰਾа亩ᔰ࿻᤹ ⇿亩Ⲵ޵ᇩᱟ˖ᖃࡽ亩ᡰ᱐ሴⲴ⢙⨶޵ᆈൠ൰䈕亥Ⲵḷᘇ˄䘉䟼൷Ѫ ˅DŽ .E 0EDŽ ҏণ㜭᱐ሴ⢙⨶޵ᆈ [III ˈ  亩 亩亥㺘  亥㺘 ᴹ˖ޡˈл䶒  㹼ປ߉  њ亥㺘ѝᡰᴹ亩Ⲵ޵ᇩ    PRYOSJBSJBGLU   PRYOSJBSJBGLU   PRYOSJBSJBGLU  VHWSUHVHQWELWXVHUUZ PRYOSJBSJBGLU [III [ˈ㺘⽪䈕亥ᆈ൘ǃ⭘ᡧਟ䈫߉DŽ ㅜ  њ亥㺘Ⲵ኎ᙗḷᘇ [ [IIIII [˗ ࡉㅜ  њ亥㺘ᡰ൘Ⲵൠ൰ [  KHDGV 〻ᒿ KHDGV ԓ⸱ N ޵ᆈ亥ⴞᖅ㺘  N ޵ᆈ亥㺘 SJ  N ޵ᆈ亥㺘 SJ  N ޵ᆈ亥㺘 SJ  N ޵ᆈ亥㺘 SJ  N 䖟ⴈ㕃ߢ४ KHDGV 䜘࠶ԓ⸱ N ѝᯝ᧿䘠ㅖ㺘 LGW N ተ᧿䘠ㅖ㺘 JGWޘ PDLQF 〻ᒿԓ⸱ NHUQHO ⁑ඇԓ⸱ PP ⁑ඇԓ⸱ IV ⁑ඇԓ⸱ OLE ⁑ඇԓ⸱ V\VWHP ⁑ඇ [ [ [ [ [ [ ᣔ⁑ᔿ䘀㹼ᯩᔿᰦˈ↔ᰦ⇥ᇴᆈಘѝ᭮㖞Ⲵᒦнᱟ޵ᆈѝⲴḀњൠ൰؍ޕԕራ൰ 64KB Ⲵ޵ᆈDŽնᖃ䘋 CPU ൘ᇎ⁑ᔿ䘀㹼ᯩᔿᰦˈ⇥ᇴᆈಘ⭘ᶕ᭮㖞ањ޵ᆈ⇥ൠ൰˄ֻྲ 0x9000˅ˈ㘼↔ᰦ൘䈕⇥޵ਟ ಘ gdtrǃѝᯝ䰘᧿䘠ㅖ㺘ᇴᆈಘ idtrˈ࣐䖭䘉Ӌ㺘ᇴᆈಘ享֯⭘у⭘ᤷԔ lgdt ᡆ lidtDŽ ተ᧿䘠ㅖ㺘ᇴᆈޘྲˈᆈ൘᧿䘠ㅖ㺘ᇴᆈಘѝ؍ൠ൰٬DŽ㘼ᖃࡽ᧿䘠ㅖ㺘Ⲵสൠ൰ࡉ〫ٿ᧿䘠ㅖ㺘ѝⲴ ᣔ⁑ᔿл⇥᧿䘠ㅖⲴᤷ䪸֯⭘ˈ↔ᰦ⇥ᇴᆈಘѝᆈ᭮Ⲵᱟањ᧿䘠ㅖ൘؍ᆳቡሶᇎ⁑ᔿлⲴ⇥ൠ൰ᖃ֌ ᣔ⁑ᔿлᰦˈ؍ᣔ⁑ᔿ㻛༴⨶Ⲵ䖳Ѫ༽ᵲDŽᖃ CPU 䘀㹼൘؍ᗵ䴰ⲴDŽѪҶо 8086 CPU ެᇩˈ80x86 Ⲵ ᣔ⁑ᔿⲴ䘀㹼ᵪࡦˈҏᱟ㔗㔝䰵䈫ԕлަ։〻ᒿᡰ؍䭞ᱟⵏ↓Ҷ䀓 Intel 386 32 սޣ⨶䀓䘉⇥〻ᒿⲴ 6.4.3.2 Intel 32 փؓᣚ䘆㺂ᵰ࡬ ᝅഴ⽰܅ഴ V\VWHP ⁗ඍ൞޻ᆎѣⲺ᱖  㿱മ 6-11 ᡰ⽪DŽۿ⁑ඇ൘޵ᆈѝⲴ䈖㓶᱐ ተ᧿䘠ㅖ㺘 gdtDŽਖཆ䘈Ѫ䖟ⴈ傡ࣘ〻ᒿᔰ䗏Ҷ 1KB ᆇ㢲Ⲵ㕃ߢ४DŽ↔ᰦ systemޘ઼ ѝᯝ᧿䘠ㅖ㺘 idt head.s 〻ᒿᢗ㹼㔃ᶏਾˈᐢ㓿↓ᔿᆼᡀҶ޵ᆈ亥ⴞᖅ઼亥㺘Ⲵ䇮㖞ˈᒦ䟽ᯠ䇮㖞Ҷ޵Ṩᇎ䱵֯⭘Ⲵ ܅6.4.3.1 ぁᓅᢝ㺂㔉ᶕ੄Ⲻ޻ᆎ᱖ 6.4.3 ެԌؗᚥ  亴⮉オ䰤DŽ VHWF VDQG766 VSDFHIRU/'7 ILOO  WXVH 7(0325$5<GRQ TXDG[ [ˈ޵Ṩᮠᦞ⇥ᴰབྷ䮯ᓖ 0%DŽ 0E IIITXDG[F [ˈ޵Ṩԓ⸱⇥ᴰབྷ䮯ᓖ 0%DŽ 0E DIIITXDG[F  18//GHVFULSWRU TXDG[BJGW  QXOFVGVV\VFDOO766/'7766/'7766HWF  Ⲵ᧿䘠ㅖDŽ /'7 ઼ሩᓄⲴԫ࣑⣦ᘱ⇥ 766 ਾ䶒䘈亴⮉Ҷ  亩Ⲵオ䰤ˈ⭘Ҿ᭮㖞ᡰࡋᔪԫ࣑Ⲵተ䜘᧿䘠ㅖ ㌫㔏䈳⭘⇥᧿䘠ㅖᒦ⋑ᴹ⍮⭘༴ˈ/LQXV ᖃᰦਟ㜭ᴮᜣᢺ㌫㔏䈳⭘ԓ⸱у䰘᭮൘䘉њ⤜・Ⲵ⇥ѝDŽ ተ㺘DŽࡽ  亩࠶࡛ᱟオ亩˄н⭘˅ǃԓ⸱⇥᧿䘠ㅖǃᮠᦞ⇥᧿䘠ㅖǃ㌫㔏䈳⭘⇥᧿䘠ㅖˈަѝޘ  ILOOLGWLVXQLQLWLDOL]HG 亩ˈ⇿亩  ᆇ㢲ˈປ DŽBLGW DOLJQ᤹ ˄A˅ᆇ㢲ᯩᔿሩ喀޵ᆈൠ൰䗩⭼DŽ  KHDGV 〻ᒿ ᤙㅖᰦˈDS:ESI ণᤷੁ䈕ԫ࣑ᮠᦞ⇥ѝⲴḀњᮠᦞDŽ ԓ⸱⇥Ⲵ᧿䘠ㅖˈㅜйњᱟԫ࣑ᮠᦞ⇥઼ึḸ⇥Ⲵ᧿䘠ㅖDŽᖃ DS ⇥ᇴᆈಘѝᱟㅜањԫ࣑Ⲵᮠᦞ⇥䘹 њԫ࣑Ⲵԫ࣑⣦ᘱ⇥˄TSS˅Ⲵ᧿䘠ㅖDŽ⇿њ LDT ѝਜ਼ᴹйњ᧿䘠ㅖˈަѝㅜањн⭘ˈㅜҼњᱟԫ࣑ ᧿䘠ㅖ亩DŽGDT 㺘ѝⲴ LDT0 ᧿䘠ㅖ亩ᱟㅜањԫ࣑˄䘋〻˅Ⲵተ䜘᧿䘠ㅖ㺘Ⲵ᧿䘠ㅖˈTSS0 ᱟㅜа മ 6-12 ᱟ Linux ޵Ṩѝᡰ֯⭘Ⲵ᧿䘠ㅖ㺘൘޵ᆈѝⲴ⽪᜿മDŽമѝˈ⇿њԫ࣑൘ GDT ѝঐᴹєњ 2-3 ᆇ㢲˅઼аӋḷᘇ˄4-5 ᆇ㢲˅DŽ˄ᆇ㢲˅ǃᡰ༴⇥Ⲵ䘹ᤙㅖ٬ 7-6ˈ1-0˄٬〫ٿ8 ᆇ㢲Ⲵ᧿䘠ㅖDŽն⇿њ᧿䘠ㅖ亩ⲴṬᔿо GDT Ⲵн਼ˈަѝᆈ᭮⵰⴨ᓄѝᯝ䗷〻Ⲵ ਜ਼ᴹ 256 亩ޡѝᯝ᧿䘠ㅖ㺘 IDT Ⲵ㔃ᶴо GDT ㊫լˈ൘ Linux ޵Ṩѝᆳ↓ྭսҾ GDT 㺘Ⲵࡽ䶒DŽ GDT 㺘ѝᴰཊᴹ 64 њ LDT 㺘Ⲵ᧿䘠ㅖ亩ᆈ൘DŽ ᧿䘠ㅖԕ৺ᖃࡽԫ࣑Ⲵ LDT ѝⲴ᧿䘠ㅖDŽሩҾ Linux 0.11 ޵Ṩᶕ䈤਼ᰦਟԕᴹ 64 њԫ࣑൘ᢗ㹼ˈഐ↔ ањ㻛䇔Ѫᱟ⍫ࣘⲴDŽа㡜ሩҾ⇿њԫ࣑˄䘋〻˅֯⭘ањ LDTDŽ൘䘀㹼ᰦˈ〻ᒿਟԕ֯⭘ GDT ѝⲴ GDT ѝḀњ᧿䘠ㅖᶕ࣐䖭ˈণ LDT ҏᱟ⭡ GDT ѝⲴ᧿䘠ㅖᶕᤷᇊDŽնᱟ൘Ḁаᰦ࡫਼ṧҏਚᴹަѝⲴ փ㌫㔏⺞ᇊDŽ൘Ḁањᰦ࡫ˈᖃࡽ LDT 㺘Ⲵส൰⭡ LDTR ᇴᆈಘⲴ޵ᇩᤷᇊˈᒦф LDTR Ⲵ޵ᇩ֯⭘ ઼ IDTR ᤷᇊᆳԜⲴ㺘ส൰DŽተ䜘㺘ਟԕᴹ 0 њᡆᴰཊ 8191 њˈ䘉⭡ GDT 㺘ѝᵚ⭘亩ᮠ઼ᡰ䇮䇑Ⲵާ ᣔ⁑ᔿлˈḀаᰦ࡫ GDT ઼ IDT ࠶࡛ਚ㜭ᴹањˈ࠶࡛⭡ᇴᆈಘ GDTR؍䘠ㅖ㺘˄LDT˅DŽᖃ CPU 䘀㹼൘ ተ᧿䘠ㅖ㺘˄GDT˅ǃѝᯝ᧿䘠ㅖ㺘˄IDT˅઼ተ䜘᧿ޘ˖䪸ሩн਼Ⲵ֯⭘ᯩ䶒ˈ᧿䘠ㅖ㺘࠶Ѫй⿽ 㓿䗷᧿䘠ㅖ㺘ѝⲴ᧿䘠ㅖ઼޵ᆈ亥㇑⨶ᶕ⺞ᇊDŽ ᣔ⁑ᔿлⲴ޵ᆈራ൰䴰㾱ᤀњᕟˈ؍㾱㓿䗷޵ᆈ亥䶒༴⨶㇑⨶ᵪࡦ䘋㹼ਈᦒਾ᡽㜭ᗇࡠDŽㆰ㘼䀰ѻˈ32 ս ޵ᆈս㖞ᱟ䘉њ⇥ส൰࣐кᖃࡽᢗ㹼ԓ⸱ᤷ䪸 eip Ⲵ٬DŽᖃ❦ˈ↔ᰦᡰራ൰Ⲵᇎ䱵⢙⨶޵ᆈൠ൰ˈ䘈䴰 ਜ਼ᴹ䈕⇥㓯ᙗൠ൰Ⲵþ⇥ÿส൰઼⇥Ⲵ䮯ᓖˈԕ৺ަԆаӋ᧿䘠䈕⇥⢩ᖱⲴ∄⢩սDŽഐ↔↔ᰦᡰራ൰Ⲵ 䟿DŽ൘䘉њ 8 ᆇ㢲Ⲵ᧿䘠ㅖѝ〫ٿ㘼ᱟᤷᇊ᧿䘠ㅖ㺘ѝḀњ᧿䘠ㅖ亩⴨ሩҾ䈕᧿䘠ㅖ㺘ส൰Ⲵањˈ٬  KHDGV 〻ᒿ '6 ⇥ᇴᆈಘ (6, ᇴᆈಘ &6 ⇥ᇴᆈಘ *'75 ᇴᆈಘ /'75 ᇴᆈಘ (6,'6  18// ᧿䘠ㅖ ԫ࣑ԓ⸱⇥᧿䘠ㅖ ึḸ⇥᧿䘠ㅖ ᮠᦞ ᮠᦞ亩 766Q ᧿䘠ㅖ /'7Q ᧿䘠ㅖ /'7 ᧿䘠ㅖ  18// ᧿䘠ㅖ ޵Ṩԓ⸱⇥᧿䘠ㅖ ޵Ṩᮠᦞ⇥᧿䘠ㅖ ᵚ⭘ ㌫㔏⇥᧿䘠ㅖ 766 ᧿䘠ㅖ /'7 ᧿䘠ㅖ 766 ᧿䘠ㅖ /'7 ᧿䘠ㅖ 766 ᧿䘠ㅖ њ᧿䘠ㅖ  ޡ ተ᧿䘠ㅖ㺘 *'7ޘ ተ䜘᧿䘠ㅖ㺘 /'7 ᮠᦞ⇥ '6 ⇥䲀䮯'6   ༴⨶ᯩ⌅ᱟ⭡Ҿ gas ѪҶ⁑ԯ਴⿽փ㌫㔃ᶴ㌫㔏к㠚ᑖⲴ≷㕆ಘⲴ㹼Ѫ㘼ᖒᡀⲴDŽ DŽGNU as˄gas˅ሩ䘉єњⴞḷṬᔿⲴн਼ڊṧˈྲ᷌ᐢ㓿൘ 8 Ⲵؽᮠ䗩⭼кˈ䛓Ѹ䈕՚ᤷԔӰѸҏн Ⲵ⅑ᯩᮠ˄2^Val1˅DŽֻྲࡽ䶒〻ᒿ head.s ѝⲴ'.align 3'ቡ㺘⽪ս㖞䇑ᮠಘ䴰㾱սҾ 8 Ⲵؽᮠ䗩⭼кDŽ਼ ਈҶDŽնሩҾᡁԜ䘉䟼֯⭘ a.out ⴞḷṬᔿⲴ㌫㔏ᶕ䈤ˈㅜ 1 њ৲ᮠ val1 ᱟᤷᇊվս 0 ∄⢩Ⲵњᮠˈণ 2 8'㺘⽪䈳ᮤս㖞䇑ᮠಘⴤࡠᆳᤷ൘ 8 Ⲵؽᮠ䗩⭼кDŽྲ᷌ᐢ㓿൘ 8 Ⲵؽᮠ䗩⭼кˈ䛓Ѹ㕆䈁ಘቡн⭘᭩ ሩҾ⧠൘֯⭘ ELF ⴞḷṬᔿⲴ Intel 80X86 CPUˈㅜ 1 њ৲ᮠ val1 ᱟ䴰㾱ሩ喀Ⲵᆇ㢲ᮠDŽֻྲˈ'.align ֯⭘ㅜ 3 њ৲ᮠ val3ˈ䛓Ѹਚ䴰㾱᭮㖞єњ䙇ਧণਟDŽ Պ䎵䗷 val3 ᤷᇊⲴᴰབྷᆇ㢲ᮠˈ䛓Ѹቡṩᵜн䘋㹼ሩ喀᫽֌DŽྲ᷌䴰㾱ⴱ⮕ㅜ 2 њ৲ᮠ val2 ն䘈ᱟ䴰㾱 val3 ⭘ᶕᤷ᰾ᴰབྷ⭘Ҿປݵᡆ䐣䗷Ⲵⴤ᧕ᮠDŽྲ᷌䘋㹼䗩⭼ሩ喀 ٬ປݵDŽㅜ 3 њਟ䘹৲ᮠ٬ 䈁ಘ֯⭘ 0 ㅜ 2 њᱟປݵᆇ㢲ᤷᇊⲴ٬DŽປݵ٬ਟԕⴱ⮕DŽ㤕ⴱ⮕ࡉ㕆˗val1 ᱟᡰ䴰㾱Ⲵሩ喀٬ ަѝㅜ 1 њ৲ᮠ٬ .align val1, val2, val3 Ҷᨀ儈 CPU 䇯䰞޵ᆈѝԓ⸱ᡆᮠᦞⲴ䙏ᓖ઼᭸⦷DŽަᆼᮤṬᔿѪ˖ Ⲵ֌⭘ᱟ൘㕆䈁ᰦᤷ⽪㕆䈁ಘປݵս㖞䇑ᮠಘ˄㊫լᤷԔ䇑ᮠಘ˅ࡠањᤷᇊⲴ޵ᆈ䗩⭼༴DŽⴞⲴᱟѪ ൘ㅜ 3 ㄐӻ㓽≷㕆ಘᰦᡁԜᐢ㓿ሩ align ՚ᤷԔ䘋㹼Ҷ䈤᰾DŽ䘉䟼ᡁԜ޽ᙫ㔃алDŽ֯⭘՚ᤷԔ.align 6.4.3.3 ࢃሲㅜδՠ᤽Ԛεalign ഴ /LQX[ ޻Ṯֵ⭞ᨅ䘦ㅜ㺞Ⲻ⽰ᝅഴȾ   KHDGV 〻ᒿ лаㄐⲴѫ㾱޵ᇩቡᱟ䈖㓶᧿䘠 init/main.c 〻ᒿⲴ࣏㜭઼֌⭘DŽ ᴰਾ䐣䖜ࡠ system ⁑ඇѝⲴࡍ࿻ॆ〻ᒿ init/main.c ѝ㔗㔝ᢗ㹼DŽ ᢃᔰˈ⍻䈅㌫㔏ᱟ੖ਜ਼ᴹᮠᆖॿ༴⨶ಘDŽ❦ਾࡍ࿻ॆ޵ᆈ亥ⴞᖅ㺘ˈѪ޵ᆈⲴ࠶亥㇑⨶֌ྭ߶༷ᐕ֌DŽ Head.s ԓ⸱Ⲵѫ㾱֌⭘ᱟࡍ↕ࡍ࿻ॆѝᯝ᧿䘠ㅖ㺘ѝⲴ 256 亩䰘᧿䘠ㅖˈỰḕ A20 ൠ൰㓯ᱟ੖ᐢ㓿 ᣔ⁑ᔿл䘀㹼DŽ؍ս 32 ޕᒦ䐣䖜ࡠ system ⁑ඇⲴ head.s ԓ⸱ᔰ࿻༴ˈ֯ CPU 䘋 ᣔ⁑ᔿлⲴ䘀㹼֌ྭ߶༷DŽ᧕лᶕሩѝᯝ᧗ࡦ⺜Ԧ䘋㹼䟽ᯠ䇮㖞ˈᴰਾ䙊䗷䇮㖞ᵪಘ᧗ࡦᇴᆈಘ CR0؍ս ѝⲴ head.s ԓ⸱ቡ༴൘ 0x00000 ᔰ࿻༴ҶDŽ❦ਾ࣐䖭᧿䘠ㅖ㺘สൠ൰ࡠ᧿䘠ㅖ㺘ᇴᆈಘѝˈѪ䘋㹼 32 ᔰ࿻Ⲵ޵ᆈඇѝˈ׋ਾ䶒〻ᒿ֯⭘DŽ਼ᰦᢺ system ⁑ඇᖰл〫ࣘࡠ⢙⨶ൠ൰ 0x00000 ᔰ࿻༴ˈ䘉ṧˈsystem ᆈ൘ 0x90000؍ setup 〻ᒿⲴѫ㾱֌⭘ᱟ࡙⭘ ROM BIOS Ⲵѝᯝ〻ᒿ㧧ਆᵪಘⲴаӋสᵜ৲ᮠˈᒦ ᴹ head.s ԓ⸱DŽ 〫ࣘࡠ⢙⨶޵ᆈ 0x90000 ઼ 0x90200 ༴ਾˈቡᢺᢗ㹼ᵳӔ㔉Ҷ setup 〻ᒿDŽަѝ system ⁑ඇⲴ俆䜘वਜ਼ ᕅሬ࣐䖭〻ᒿ bootsect.s ሶ setup.s ԓ⸱઼ system ⁑ඇ࣐䖭ࡠ޵ᆈѝˈᒦф࠶࡛ᢺ㠚ᐡ઼ setup.s ԓ⸱ 6.5 ᵢㄖቅ㔉  ᵜㄐሿ㔃 ޵Ṩ〻ᒿ 儈䙏㕃ߢ 㲊ᤏⴈ ѫ޵ᆈ४ ࡠҶㅜ 3 ⢩ᵳ㓗DŽ↔ᰦ main.c Ⲵѫ〻ᒿቡᐕ֌൘ԫ࣑ 0 ѝDŽ❦ਾ㌫㔏ㅜа⅑䈳⭘䘋〻ࡋᔪ࠭ᮠ fork()ˈ ൘ᮤњ޵Ṩᆼᡀࡍ࿻ॆਾˈ޵Ṩሶᢗ㹼ᵳ࠷ᦒࡠҶ⭘ᡧ⁑ᔿ˄ԫ࣑ 0˅ˈҏণ CPU Ӿ 0 ⢩ᵳ㓗࠷ᦒ ቡᲲᰦݸ᭮а᭮ˈ㔗㔝ⴻлањࡍ࿻ॆ䈳⭘DŽ൘ᴹӋ⨶䀓ѻਾ޽㔗㔝⹄ウ⋑ᴹⴻᆼⲴൠᯩDŽ 䘋৫ⴻˈྲ᷌ᇎ൘ⴻнл৫Ҷˈޕ␡0 ѝ䘀㹼DŽ൘䰵䈫䘉Ӌࡍ࿻ॆᆀ〻ᒿᰦˈᴰྭᱟ䐏⵰㻛䈳⭘Ⲵ〻ᒿ 㖞ㅜањԫ࣑˄task 0˅DŽᖵᡰᴹࡍ࿻ॆᐕ֌ᆼᡀਾ〻ᒿቡ䇮㖞ѝᯝݱ䇨ḷᘇԕᔰ੟ѝᯝˈᒦ࠷ᦒࡠԫ࣑ ❦ਾˈ޵Ṩ䘋㹼ᡰᴹᯩ䶒Ⲵ⺜Ԧࡍ࿻ॆᐕ֌DŽवᤜ䲧䱡䰘ǃඇ䇮༷ǃᆇㅖ䇮઼༷ ttyˈ䘈वᤜӪᐕ䇮 ն䴰㾱䙊䗷 mm ᡽㜭֯⭘࠶䝽ࡠⲴ޵ᆈ亥䶒DŽ 䗷࠶亥ᵪࡦ䘋㹼㇑⨶࠶䝽ˈԕ 4K ᆇ㢲Ѫањ޵ᆈ亥অսDŽ޵Ṩ〻ᒿਟԕ㠚⭡䇯䰞儈䙏㕃ߢѝⲴᮠᦞˈ ᰦᆈ᭮ᮠᦞⲴൠᯩˈԕ 1K˄1024˅ᆇ㢲ѪањᮠᦞඇঅսDŽѫ޵ᆈ४ฏⲴ޵ᆈ⭡޵ᆈ㇑⨶⁑ඇ mm 䙊 മѝˈ儈䙏㕃ߢ䜘࠶䘈㾱ᢓ䲔㻛ᱮᆈ઼ ROM BIOS ঐ⭘Ⲵ䜘࠶DŽ儈䙏㕃ߢ४ᱟ⭘Ҿ⻱ⴈㅹඇ䇮༷Ѥ ഴ ㌱㔕ѣ޻ᆎࣕ㜳ࡈ࠼⽰ᝅഴȾ ᜿മ㿱മ 7-1 ᡰ⽪DŽ⽪ۿྲ᷌䘈ᇊѹҶ㲊ᤏⴈ˄RAMDISK˅ˈࡉѫ޵ᆈሶ䘲ᖃ߿ቁDŽᮤњ޵ᆈⲴ᱐ 䟿DŽ䘉Ӌ޵ᆈਈ䟿ᤷ᰾Ҷѫ޵ᆈⲴᔰ࿻ൠ൰ǃ㌫㔏ᡰᤕᴹⲴ޵ᆈᇩ䟿઼֌Ѫ儈䙏㕃ߢ४޵ᆈⲴᵛㄟൠ൰DŽ ተਈޘ main.c 〻ᒿ俆ݸ࡙⭘ࡽ䶒 setup.s 〻ᒿਆᗇⲴ㌫㔏৲ᮠ䇮㖞㌫㔏Ⲵṩ᮷Ԧ䇮༷ਧԕ৺аӋ޵ᆈ 7.1.1 ࣕ㜳ᨅ䘦 7.1 main.c ぁᓅ փ䈖㓶⌘䟺޵ᇩሶ൘⌘䟺⴨ᓄཤ᮷ԦⲴㄐ㢲ѝ㔉ࠪDŽ ᴹ⌘䟺Ⲵ㘫䈁ࡉ䟷⭘оަаṧⲴ⌘䟺ḷᘇDŽሩҾ〻ᒿѝवਜ਼Ⲵཤ᮷Ԧ˄*.h˅ˈӵ֌ᾲ㾱ਜ਼ѹⲴ䀓䟺ˈާ ৏ޣ൘⌘䟺 C 䈝䀰〻ᒿᰦˈѪҶо〻ᒿѝ৏ᴹⲴ⌘䟺⴨४࡛ˈᡁԜ֯⭘'//'֌Ѫ⌘䟺䈝ਕⲴᔰ࿻DŽᴹ ⸱ѝᖸཊൠᯩ֯⭘Ҷ gcc Ⲵᢙኅ⢩ᙗDŽֻྲ޵㚄˄inline˅࠭ᮠǃ޵㚄˄޵፼˅≷㕆䈝ਕㅹDŽ 䭞DŽਖཆ䘈䴰㾱 GNU gcc ᡻޼൘䓛䗩֌Ѫ৲㘳ˈഐѪ൘޵Ṩԓޣ઼ᮠ㓴Ⲵ⨶䀓ˈਟԕ䈤ᱟᔴ៲ C 䈝䀰Ⲵ Ҿᤷ䪸ޣ৲㘳Җ䘈ᱟ Brian W. Kernighan ઼ Dennis M. Ritchie 㕆㪇ⲴljC 〻ᒿ䇮䇑䈝䀰NJDŽሩ䈕Җㅜӄㄐ Ӿ䘉аㄐᔰ࿻ˈᡁԜሶ᧕䀖བྷ䟿Ⲵ C 〻ᒿԓ⸱ˈഐ↔䈫㘵ᴰྭާᴹаᇊⲴ C 䈝䀰⸕䇶DŽᴰྭⲴаᵜ ᓄ䈕ሩ Linux ޵ṨᴹҶབྷ㠤ⲴҶ䀓DŽ 䀓䘉䟼䈳⭘Ⲵᡰᴹ〻ᒿˈ䛓Ѹⴻᆼ䘉ㄐ޵ᇩਾ֐⨶ޘ䴰㾱৲➗ᖸཊަԆ〻ᒿѝⲴࡍ࿻ॆ䜘࠶DŽྲ᷌㜭ᆼ ᢗ㹼ᵳӔ㔉 main.cDŽ䈕〻ᒿ㲭❦н䮯ˈնতवᤜҶ޵Ṩࡍ࿻ॆⲴᡰᴹᐕ֌DŽഐ↔൘䰵䈫䈕〻ᒿⲴԓ⸱ᰦ ൘޵ṨⓀԓ⸱Ⲵ init/ⴞᖅѝਚᴹањ main.c ᮷ԦDŽ㌫㔏൘ᢗ㹼ᆼ boot/ⴞᖅѝⲴ head.s 〻ᒿਾቡՊሶ ㅜ7ㄐࡍ࿻ॆ〻ᒿ(init)   PDLQF 〻ᒿ 䘋〻 Q  䘋〻 LQLW 䘋〻  䘋〻   ԫ࣑  䘋〻 ࡋᔪ䘋〻 ˄LQLW˅ ᇊੁࡠ UF ᮷Ԧޕ䗃 䘰ࠪ 䘰ࠪ ࣐䖭ṩ᮷Ԧ㌫㔏 ᢗ㹼 VKHOOᗚ⧟ㅹᖵ䘋〻䘰ࠪ ࡋᔪᆀ䘋〻 䇮㖞㓸ㄟḷ߶ ,2 ᗚ⧟ㅹᖵ䘋〻  䘰ࠪ ࡋᔪ䘋〻  ᢗ㹼 VKHOO ༴⨶ UF 䇮㖞㓸ㄟḷ߶ ,2  オ䰢ᰦᢗ㹼 SDXVH 〫ࡠԫ࣑  ѝᢗ㹼 वᤜሩԫ࣑  ࡍ࿻ॆ ㌫㔏਴䜘࠶ࡍ࿻ॆ ㌫㔏ࡍ࿻ॆ 㹼࣏㜭ࡂ࠶о࠶䝽 ሩ⢙⨶޵ᆈ਴䜘࠶䘋 њᯠⲴՊ䈍ˈᒦԕⲫᖅ shell ᯩᔿ޽⅑ᢗ㹼〻ᒿ/bin/shˈԕࡋᔪ⭘ᡧӔӂ shell ⧟ຳDŽ❦ਾ⡦䘋〻㔗㔝ㅹᖵ ࡠањᰐ䲀ᗚ⧟ѝDŽ൘䈕ᗚ⧟ѝˈ⡦䘋〻Պ޽⅑⭏ᡀањᯠ䘋〻ˈ❦ਾ൘䈕䘋〻ѝࡋᔪаޕ⡦䘋〻ቡ䘋 /bin/shDŽ൘㌫㔏ᢗ㹼䘋〻 2 ѝⲴ〻ᒿᰦˈ⡦䘋〻˄init 䘋〻˅аⴤㅹᖵ⵰ᆳⲴ㔃ᶏDŽ䲿⵰䘋〻 2 Ⲵ䘰ࠪˈ init()࠭ᮠⲴᴰਾа䜘ԭ⭘Ҿ൘ᯠᔪ䘋〻ѝѪ⭘ᡧᔪ・ањᯠⲴՊ䈍ˈᒦ䘀㹼⭘ᡧⲫᖅ shell 〻ᒿ Ԕᢗ㹼ᆼ∅ਾˈ/bin/sh ቡՊ・࡫䘰ࠪDŽഐ↔䘋〻 2 ҏቡ䲿ѻ㔃ᶏDŽ 䈕᮷Ԧѝ䈫ਆDŽ❦ਾ޵Ṩԕ䶎Ӕӂᖒᔿᢗ㹼/bin/shˈӾ㘼ᇎ⧠ᢗ㹼/etc/rc ᮷ԦѝⲴભԔDŽᖃ䈕᮷ԦѝⲴભ ᮠᦞ䜭ሶӾޕstdin ᇊੁࡠ etc/rc ᮷ԦкDŽ䘉ṧˈᡰᴹⲴḷ߶䗃 ޕᒦ・࡫ᢃᔰ᮷Ԧ/etc/rcˈӾ㘼ᢺḷ߶䗃 䰝᮷Ԧ᧿䘠ㅖ 0ˈޣ᮷ԦⲴ֌⭘о DOS ㌫㔏ṩⴞᖅкⲴ AUTOEXEC.BAT ᮷Ԧ㊫լDŽ䘉⇥ԓ⸱俆ݸ䙊䗷 ণ൘⭘ᡧਟԕ֯⭘ shell ભԔ㹼⧟ຳѻࡽˈ޵Ṩ䈳⭘/bin/sh 〻ᒿ䘀㹼Ҷ䝽㖞᮷Ԧ etc/rc ѝ䇮㖞ⲴભԔDŽrc ᧕⵰ init()৸ᯠᔪҶањ䘋〻˄䘋〻 2˅ˈᒦ൘ަѝѪᔪ・⭘ᡧӔӂ֯⭘⧟ຳ㘼ᢗ㹼аӋࡍ࿻䝽㖞᫽֌ˈ ᮠǃѫ޵ᆈ४オ䰢޵ᆈᙫᆇ㢲ᮠㅹDŽ 䈟䗃ࠪ stderr 䇮༷DŽ޵Ṩ䲿ਾ࡙⭘䘉Ӌ᧿䘠ㅖ൘㓸ㄟкᱮ⽪аӋ㌫㔏ؑ᚟ˈֻྲ儈䙏㕃ߢ४ѝ㕃ߢඇᙫ stdinǃḷ߶䗃ࠪ stdout ઼䭉 ޕ❦ਾ init()ᢃᔰањ㓸ㄟ䇮༷ tty0ˈᒦ༽ࡦަ᮷Ԧ᧿䘠ㅖԕӗ⭏ḷ߶䗃 ॆ䗷〻ѝᐢ㓿ᔰ䗏Ҷаඇ޵ᆈ⭘֌㲊ᤏⴈˈࡉ޵ṨቡՊ俆ݸቍ䈅ᢺṩ᮷Ԧ㌫㔏࣐䖭ࡠ޵ᆈⲴ㲊ᤏⴈ४ѝDŽ 㔏ѻࡽˈ㌫㔏Պݸࡔᯝᱟ੖䴰㾱ݸᔪ・㲊ᤏⴈDŽ㤕㕆䈁޵Ṩᰦ䇮㖞Ҷ㲊ᤏⴈⲴབྷሿˈᒦ൘ࡽ䶒޵Ṩࡍ࿻ ԓ⸱俆ݸ䈳⭘㌫㔏䈳⭘ setup()ˈ⭘ᶕ᭦䳶⺜ⴈ䇮༷࠶४㺘ؑ᚟ᒦᆹ㻵ṩ᮷Ԧ㌫㔏DŽ൘ᆹ㻵ṩ᮷Ԧ㌫ ᮷Ԧ rc ѝⲴભԔ˗ĺᢗ㹼⭘ᡧⲫᖅ shell 〻ᒿDŽ init()࠭ᮠⲴ࣏㜭ਟ࠶Ѫ 4 њ䜘࠶˖ķᆹ㻵ṩ᮷Ԧ㌫㔏˗ĸᱮ⽪㌫㔏ؑ᚟˗Ĺ䘀㹼㌫㔏ࡍ࿻䍴Ⓚ䝽㖞 Ѫ idle 䘋〻DŽ↔ᰦ䘋〻 0 ӵᢗ㹼 pause()㌫㔏䈳⭘ˈᒦ৸Պ䈳⭘䈳ᓖ࠭ᮠDŽ ⧟ຳⲴࡍ࿻ॆᒦᢗ㹼 shell ⲫᖅ〻ᒿDŽ㘼৏䘋〻 0 ࡉՊ൘㌫㔏オ䰢ᰦ㻛䈳ᓖᢗ㹼ˈഐ↔䘋〻 0 䙊ᑨҏ㻛〠 ⭘ fork()䈳⭘俆⅑ࡋᔪࠪ䘋〻 1˄init 䘋〻˅ˈᒦ൘ަѝ䈳⭘ init()࠭ᮠDŽ൘䈕࠭ᮠѝ〻ᒿሶ㔗㔝䘋㹼ᓄ⭘ ѻਾˈ㌫㔏਴䜘࠶ᐢ㓿༴Ҿਟ䘀㹼⣦ᘱDŽ↔ਾ〻ᒿᢺ㠚ᐡĀ᡻ᐕā〫ࣘࡠԫ࣑ 0˄䘋〻 0˅ѝ䘀㹼ˈᒦ֯ ⨶ǃѝᯝ༴⨶ǃඇ䇮઼༷ᆇㅖ䇮༷ǃ䘋〻㇑⨶ԕ৺⺜ⴈ઼䖟ⴈ⺜Ԧ䘋㹼ࡍ࿻ॆ༴⨶DŽ൘ᆼᡀҶ䘉Ӌ᫽֌ main.c 〻ᒿ俆ݸ⺞ᇊྲօ࠶䝽֯⭘㌫㔏⢙⨶޵ᆈˈ❦ਾ䈳⭘޵Ṩ਴䜘࠶Ⲵࡍ࿻ॆ࠭ᮠ࠶࡛ሩ޵ᆈ㇑ ഴ ޻Ṯࡓခौぁᓅ⍷ぁ⽰ᝅഴ  ࡋᔪࠪањ⭘Ҿ䘀㹼 init()Ⲵᆀ䘋〻˄䙊ᑨ㻛〠Ѫ init 䘋〻˅DŽ㌫㔏ᮤњࡍ࿻ॆ䗷〻㿱മ 7-2 ᡰ⽪DŽ   PDLQF 〻ᒿ  UHWXUQ  HUUQR BBUHV LQW BBUHV UHWXUQ   BBUHV!  LI  BB15BIRUN  BBUHV  DLQW[  BBDVPBBYRODWLOH  ORQJBBUHV ^  YRLG VWDWLFLQOLQHLQWIRUN LQWIRUN ኅᔰԓ䘋ㅜ  㹼ਾᡁԜਟԕᗇࡠྲл䈝ਕ˖ ṩᦞк䶒ᇊѹᢺBV\VFDOO  ` ?UHWXUQ ?੖ࡉ㖞ࠪ䭉ਧˈᒦ䘄എDŽHUUQR BBUHV ?W\SH BBUHV UHWXUQ ࡉⴤ᧕䘄എ䈕٬DŽˈ !BBUHV!  ?ྲ᷌䘄എ٬ LI Ѫ㌫㔏ѝᯝ䈳⭘ਧBB15BQDPHDŽޕ?䗃 BB15BQDPH  BBUHV DŽ BBUHV ?䘄എ٬ÎHD[  D LQW[?䈳⭘㌫㔏ѝᯝ [DŽ BBDVPBBYRODWLOH ?ORQJBBUHV ^? YRLG ? W\SHQDPH W\SHQDPH ? GHILQHBV\VFDOO YRLG DŽ ⲴᇊѹDŽণѪнᑖ৲ᮠⲴ㌫㔏䈳⭘ᆿ࠭ᮠ˖W\SHQDPH XQLVWGK ᮷ԦѝBV\VFDOO 䈝ਕᇎ䱵кᱟ int fork()ࡋᔪ䘋〻㌫㔏䈳⭘ˈ㿱ྲлᡰ⽪DŽ ṩᦞ include/unistd.h ᮷Ԧㅜ 133 㹼кⲴᆿᇊѹˈᡁԜᢺ䘉њᆿኅᔰᒦᴯԓ䘋к䶒а㹼ѝቡਟԕⴻࠪ䘉ᶑ 㕆Ⲵᖒᔿ䈳⭘LinuxⲴ㌫㔏䈳⭘ѝᯝint 0x80DŽ≶ޕަѝ_syscall0()ᱟunistd.hѝⲴ޵፼ᆿԓ⸱ˈᆳԕ፼  LQWIRUN VWDWLFLQOLQHBV\VFDOO 䈤᰾DŽޣਟ㜭֯ᗇᰐ䴰ᢺ޵፼࠭ᮠⲴᡰᴹԓ⸱䜭वᤜ䘋ᶕ㘼䇙ԓ⸱ҏᗇࡠㆰॆDŽ৲㿱ㅜ  ㄐѝⲴ⴨ Ⲵ䙏ᓖˈഐѪⴱ৫Ҷ࠭ᮠ䈳⭘Ⲵᔰ䬰DŽਖཆˈྲ᷌ԫօањᇎ䱵৲ᮠᱟањᑨ䟿ˈ䛓Ѹ൘㕆䈁ᰦ䘉Ӌᐢ⸕٬ቡ  䙊䗷༠᰾ањ޵㚄˄LQOLQH˅࠭ᮠˈਟԕ䇙 JFF ᢺ࠭ᮠⲴԓ⸱䳶ᡀࡠ䈳⭘ᆳⲴԓ⸱ѝDŽ䘉Պᨀ儈ԓ⸱ᢗ㹼 ޵፼˄޵㚄˅ᖒᔿᶕᢗ㹼䘉њ㌫㔏䈳⭘˄৲㿱〻ᒿㅜ 23 㹼˅˖ ᢗ㹼ਾˈԫ࣑ 0 ѝⲴԓ⸱ fork()н㜭ԕ࠭ᮠᖒᔿ䘋㹼䈳⭘DŽ〻ᒿѝᇎ⧠Ⲵᯩ⌅ᱟ䟷⭘ྲлᡰ⽪Ⲵ gcc ࠭ᮠ ˄䘋〻 1˅ѻࡽн㾱֯⭘ަ⭘ᡧᘱḸˈণ㾱≲ԫ࣑ 0 н㾱䈳⭘࠭ᮠDŽഐ↔൘ main.c ѫ〻ᒿ〫ࣘࡠԫ࣑ 0 ᯠ䘋〻⭘ᡧᘱḸѝ⋑ᴹ䘋〻 0 Ⲵཊ։ؑ᚟ˈ㾱≲䘋〻 0 ൘ࡋᔪ俆њᯠ䘋〻؍⺞ࡋᔪᯠ䘋〻 init ᰦˈѪҶ ࡦ⡦䘋〻ԓ⸱⇥઼ᮠᦞ⇥Ⲵᯩᔿᇎ⧠ˈഐ↔൘俆⅑֯⭘ fork()༽ޘ⭡Ҿࡋᔪᯠ䘋〻Ⲵ䗷〻ᱟ䙊䗷ᆼ ࡇ㺘ਾሩ䘉ᯩ䶒Ⲵ䈤᰾DŽ ԫ࣑ 1 ѝ䘀㹼Ⲵ init()࠭ᮠⲴਾє䜘࠶ᇎ䱵кᓄ䈕ᱟ⤜・Ⲵ⧟ຳࡍ࿻ॆ〻ᒿ init ㅹⲴ࣏㜭DŽ৲㿱〻ᒿ 䘋〻Ⲵ䗷〻DŽ 䛓Ѹ൘ᱮ⽪аᶑᖃࡽⲫᖅ shell 䘰ࠪⲴؑ᚟ਾˈ㌫㔏ቡՊ൘䘉њᰐ䲀ᗚ⧟ѝ޽⅑䟽༽ԕкࡋᔪⲫᖅ shell ㅹᖵ⣦ᘱDŽ↔ਾ㤕⭘ᡧ൘ભԔ㹼кᢗ㹼Ҷ exit ᡆ logout ભԔˈޕLinux ભԔ㹼⧟ຳҶˈ㘼⡦䘋〻䲿ѻ৸䘋 ᰦ䙊⸕ᆳ䘉нᱟа⅑Პ䙊Ⲵ䘀㹼ˈ㘼ᱟ֌Ѫⲫᖅ shell 䘀㹼/bin/sh ⲴDŽӾ䘉ᰦᔰ࿻ˈ⭘ᡧቡਟԕ↓ᑨ֯⭘ н਼DŽⲫᖅ shell Ⲵㅜ 0 њભԔ㹼৲ᮠⲴㅜ 1 њᆇㅖаᇊᱟањ߿ਧ'-'DŽ䘉њ⢩ᇊⲴḷᘇՊ൘/bin/sh ᢗ㹼 䈕ᆀ䘋〻DŽⲫᖅ shell 㲭❦оࡽ䶒Ⲵ䶎Ӕӂᔿ shell ᱟ਼ањ〻ᒿ/bin/shˈնᱟᡰ֯⭘ⲴભԔ㹼৲ᮠ˄argv[]˅   PDLQF 〻ᒿ ৲㿱޵ᆈ㇑⨶аㄐ˖߉ᰦ༽ࡦᵪࡦDŽ    ᰦ䰤Ⲵ࠭ᮠ৏ᖒDŽޣWLPHK!ᰦ䰤㊫රཤ᮷ԦDŽަѝᴰѫ㾱ᇊѹҶ WP 㔃ᶴ઼аӋᴹLQFOXGH XQLVWGK!LQFOXGH  ㅹDŽ वਜ਼㌫㔏䈳⭘ਧ઼޵፼≷㕆ԓ⸱ V\VFDOO ަѝᇊѹҶ਴⿽ㅖਧᑨᮠ઼㊫රˈᒦ༠᰾Ҷ਴⿽࠭ᮠDŽྲ᷌䘈ᇊѹҶㅖਧBB/,%5$5@  OLQX[IVK!᮷Ԧ㌫㔏ཤ᮷ԦDŽᇊѹ᮷Ԧ㺘㔃ᶴ˄ILOHEXIIHUBKHDGPBLQRGH ㅹ˅DŽLQFOXGH  V\VW\SHVK!㊫රཤ᮷ԦDŽᇊѹҶสᵜⲴ㌫㔏ᮠᦞ㊫රDŽLQFOXGH IFQWOK!᮷Ԧ᧗ࡦཤ᮷ԦDŽ⭘Ҿ᮷Ԧ৺ަ᧿䘠ㅖⲴ᫽֌᧗ࡦᑨᮠㅖਧⲴᇊѹDŽLQFOXGH XQLVWGK!LQFOXGH YSULQWIǃYISULQWIDŽ   PDLQF 〻ᒿ ˗ᵪಘ޵ᆈᮠÎPHPRU\BHQG˗ѫ޵ᆈᔰ࿻ൠ൰ÎPDLQBPHPRU\BVWDUW ṩ䇮༷ਧÎ5227B'(9˗儈䙏㕃ᆈᵛㄟൠ൰ÎEXIIHUBPHPRU\BHQG˗ ᆈ˖؍л䶒䘉⇥ԓ⸱⭘Ҿ   ᆼᗵ㾱Ⲵ䇮㖞ਾቡሶަᔰ੟DŽڊˈ↔ᰦѝᯝӽ㻛⾱→⵰      HQDEOHWKHP  ,QWHUUXSWVDUHVWLOOGLVDEOHG'RQHFHVVDU\VHWXSVWKHQ    ৲㿱 KHDGV 〻ᒿㅜ  㹼ᔰ࿻Ⲵࠐ㹼ԓ⸱DŽ  䇮ⲴٷKHDGV ѝቡᱟ䘉ṧ 䘉䟼⺞ᇎᱟ YRLGˈ⋑䭉DŽ൘ VWDUWXS 〻ᒿ   ZHOO WKLV 7KHVWDUWXSURXWLQHDVVXPHV ^  7KLVUHDOO\,6YRLGQRHUURUKHUH  YRLG YRLGPDLQ ޵Ṩࡍ࿻ॆѫ〻ᒿDŽࡍ࿻ॆ㔃ᶏਾሶԕԫ࣑ ˄LGOH ԫ࣑ণオ䰢ԫ࣑˅Ⲵ䓛ԭ䘀㹼DŽ  ⭘Ҿᆈ᭮⺜ⴈ৲ᮠ㺘ؑ᚟DŽ`GULYHBLQIRVWUXFWGULYHBLQIR^FKDUGXPP\>@  ѫ޵ᆈ˄ሶ⭘Ҿ࠶亥˅ᔰ࿻Ⲵս㖞DŽ VWDWLFORQJPDLQBPHPRU\BVWDUW 儈䙏㕃ߢ४ᵛㄟൠ൰DŽ VWDWLFORQJEXIIHUBPHPRU\BHQG ᵪಘާᴹⲴ⢙⨶޵ᆈᇩ䟿˄ᆇ㢲ᮠ˅DŽ VWDWLFORQJPHPRU\BHQG л䶒ᇊѹаӋተ䜘ਈ䟿DŽ  ` 䇑㇇ᔰᵪᰦ䰤DŽNHUQHOPNWLPHF 㹼DŽ WLPH VWDUWXSBWLPH NHUQHOBPNWLPH WPBPRQ ѝᴸԭ㤳തᱟ üDŽWLPHWPBPRQ  WLPHWPB\HDU %&'B72B%,1  WLPHWPBPRQ %&'B72B%,1  WLPHWPBPGD\ %&'B72B%,1  WLPHWPBKRXU %&'B72B%,1  WLPHWPBPLQ %&'B72B%,1 䖜ᦒᡀҼ䘋ࡦᮠ٬DŽ WLPHWPBVHF %&'B72B%,1   WLPHWPBVHF &026B5($' `ZKLOH ᖃࡽᒤԭDŽ  WLPHWPB\HDU &026B5($' ᖃࡽᴸԭ˄ü˅DŽ  WLPHWPBPRQ &026B5($' аᴸѝⲴᖃཙᰕᵏDŽ  WLPHWPBPGD\ &026B5($' ᖃࡽሿᰦ٬DŽ  WLPHWPBKRXU &026B5($' ᖃࡽ࠶䫏٬DŽ  WLPHWPBPLQ &026B5($' DŽ˅൷ᱟ %&' ⸱٬˄٬。ᖃࡽᰦ䰤  WLPHWPBVHF &026B5($' GR^ ٬ਁ⭏Ҷਈॆˈ䛓Ѹቡ䟽ᯠ䈫ਆᡰᴹ٬DŽ䘉ṧ޵Ṩቡ㜭ᢺо &026 ᰦ䰤䈟ᐞ᧗ࡦ൘  。ѻ޵DŽ。 &026 Ⲵ䇯䰞䙏ᓖᖸធDŽѪҶ߿ሿᰦ䰤䈟ᐞˈ൘䈫ਆҶл䶒ᗚ⧟ѝᡰᴹᮠ٬ਾˈ㤕↔ᰦ &026 ѝ  ᰦ䰤㔃ᶴ WP ᇊѹ൘ LQFOXGHWLPHK ѝDŽVWUXFWWPWLPH ^  YRLG VWDWLFYRLGWLPHBLQLW ᔰᵪᖃᰕ㓿䗷Ⲵ。ᮠˈ֌Ѫᔰᵪᰦ䰤˄NHUQHOPNWLPHF 㹼˅DŽ  ᒤ  ᴸ  ᰕ  ᰦ䎧ࡠ ⭘Ҿ䇑㇇Ӿ &026 ޵ᆈࡇ㺘䈤᰾DŽަѝ䈳⭘Ⲵ࠭ᮠ NHUQHOBPNWLPH 。 ѝDŽ৲㿱ਾ䶒 ተਈ䟿 VWDUWXSBWLPHޘᆈࡠ؍䈕࠭ᮠਆ &026 ᇎᰦ䫏ؑ᚟֌Ѫᔰᵪᰦ䰤ˈᒦ    YDO !!   YDO YDO  YDO GHILQH%&'B72B%,1 Ⲵ  䘋ࡦॱսᮠˈ޽҈ԕ DŽഐ↔ᴰਾє㘵⴨࣐ቡᱟањᆇ㢲 %&' ⸱Ⲵᇎ䱵Ҽ䘋ࡦᮠ٬DŽ YDO !! ਆ %&' 㺘⽪  ਆ %&' 㺘⽪Ⲵ  䘋ࡦњսᮠˈ㘼 YDO ањᆇ㢲㺘⽪  њ  䘋ࡦᮠDŽ   PDLQF 〻ᒿ DŽ SDXVH ⋑ᴹⲴ䈍ᡁԜቡഎࡠ䘉䟼ˈаⴤᗚ⧟ᢗ㹼  ӵ᜿ણ⵰ᡁԜ䘄എᶕḕⴻᱟ੖ᴹަԆԫ࣑ਟԕ䘀㹼ˈྲ᷌ SDXVH  ሩҾԫ࣑  ഐѪԫ࣑  ൘ԫօオ䰢ᰦ䰤䟼䜭Պ㻛◰⍫˄ᖃ⋑ᴹަԆԫ࣑൘䘀㹼ᰦ˅ˈഐ↔  ˅ˈ VFKHGXOH ᡽Պ䘄എቡ㔚ᘱˈնԫ࣑ ˄WDVN˅ᱟୟаֻཆᛵߥ˄৲㿱  ሶ᜿ણ⵰ᡁԜᗵ享ㅹᖵ᭦ࡠањؑਧ SDXVH ⌘᜿ሩҾԫօަԆⲴԫ࣑ˈ    WDVNFDQUXQDQGLIQRWZHUHWXUQKHUH  MXVWPHDQVZHJRFKHFNLIVRPHRWKHU SDXVH FDQUXQ )RUWDVN  ZKHQQRRWKHUWDVNV DVWDVNJHWVDFWLYDWHGDWHYHU\LGOHPRPHQW   VFKHGXOH VHH VLJQDOWRDZDNHQEXWWDVNLVWKHVROHH[FHSWLRQ  ZRXOGPHDQZHKDYHWRJHWD SDXVH 127()RUDQ\RWKHUWDVN    л䶒ԓ⸱ᔰ࿻ԕԫ࣑  Ⲵ䓛ԭ䘀㹼DŽ  ` ൘ᯠᔪⲴᆀ䘋〻˄ԫ࣑ ˅ѝᢗ㹼DŽ LQLW  ZHFRXQWRQWKLVJRLQJRN  ^ IRUN LI 〫ࡠ⭘ᡧ⁑ᔿлᢗ㹼DŽ˄LQFOXGHDVPV\VWHPKˈㅜ  㹼˅ PRYHBWRBXVHUBPRGH л䶒䗷〻䙊䗷൘ึḸѝ䇮㖞Ⲵ৲ᮠˈ࡙⭘ѝᯝ䘄എᤷԔ੟ࣘԫ࣑  ᢗ㹼DŽ  ᆼҶˈᔰ੟ѝᯝDŽڊᡰᴹࡍ࿻ॆᐕ֌䜭 VWL 䖟傡ࡍ࿻ॆDŽ˄NHUQHOEONBGUYIORSS\Fˈ˅ IORSS\BLQLW ⺜ⴈࡍ࿻ॆDŽ˄NHUQHOEONBGUYKGFˈ˅ KGBLQLW 㕃ߢ㇑⨶ࡍ࿻ॆˈᔪ޵ᆈ䬮㺘ㅹDŽ˄IVEXIIHUFˈ˅ EXIIHUBPHPRU\BHQG EXIIHUBLQLW ࣐䖭ԫ࣑  Ⲵ WUOGWU ˄NHUQHOVFKHGFˈ˅ 䈳ᓖ〻ᒿࡍ࿻ॆ VFKHGBLQLW 䇮㖞ᔰᵪ੟ࣘᰦ䰤ÎVWDUWXSBWLPH˄㿱  㹼˅DŽ WLPHBLQLW WW\ ࡍ࿻ॆDŽ˄NHUQHOFKUBGUYWW\BLRFˈ˅ WW\BLQLW ᆇㅖ䇮༷ࡍ࿻ॆDŽ˄NHUQHOFKUBGUYWW\BLRFˈ˅ FKUBGHYBLQLW ඇ䇮༷ࡍ࿻ॆDŽ˄NHUQHOEONBGUYOOBUZBEONFˈ˅ EONBGHYBLQLW 䲧䱡䰘˄⺜Ԧѝᯝੁ䟿˅ࡍ࿻ॆDŽ˄NHUQHOWUDSVFˈ˅ WUDSBLQLW ˅ѫ޵ᆈ४ࡍ࿻ॆDŽ˄PPPHPRU\Fˈ PDLQBPHPRU\BVWDUWPHPRU\BHQG PHPBLQLW нл৫Ҷˈቡݸ᭮а᭮ˈ㔗㔝ⴻлањࡍ࿻ॆ䈳⭘䘉ᱟ㓿傼ѻ䈸-DŽ 䘋৫ⴻˈ㤕ᇎ൘ⴻޕ␡ԕлᱟ޵Ṩ䘋㹼ᡰᴹᯩ䶒Ⲵࡍ࿻ॆᐕ֌DŽ䰵䈫ᰦᴰྭ䐏⵰䈳⭘Ⲵ〻ᒿ HQGLI   PDLQBPHPRU\BVWDUW5$0',6. PDLQBPHPRU\BVWDUW UGBLQLW LIGHI5$0',6. ৲㿱 NHUQHOEONBGUYUDPGLVNFDŽ ྲ᷌൘ 0DNHILOH ᮷ԦѝᇊѹҶ޵ᆈ㲊ᤏⴈㅖਧ 5$0',6.ˈࡉࡍ࿻ॆ㲊ᤏⴈDŽ↔ᰦѫ޵ᆈሶ߿ቁDŽ  ѫ޵ᆈ䎧࿻ս㖞 㕃ߢ४ᵛㄟDŽPDLQBPHPRU\BVWDUW EXIIHUBPHPRU\BHQG ੖ࡉࡉ䇮㖞㕃ߢ४ᵛㄟ 0E   EXIIHUBPHPRU\BHQG HOVH    EXIIHUBPHPRU\BHQG  ੖ࡉ㤕޵ᆈ!0Eˈࡉ䇮㖞㕃ߢ४ᵛㄟ 0E  PHPRU\BHQG! HOVHLI    EXIIHUBPHPRU\BHQG  ྲ᷌޵ᆈ!0Eˈࡉ䇮㖞㕃ߢ४ᵛㄟ 0E  PHPRU\BHQG! LI    PHPRU\BHQG  ྲ᷌޵ᆈ䟿䎵䗷 0Eˈࡉ᤹ 0E 䇑DŽ  PHPRU\BHQG! LI ᘭ⮕нࡠ .E˄ 亥˅Ⲵ޵ᆈᮠDŽ [IIIII PHPRU\BHQG  ᆇ㢲DŽ N ޵ᆈབྷሿ 0Eᢙኅ޵ᆈ (;7B0(0B.    PHPRU\BHQG  ༴Ⲵ⺜ⴈ৲ᮠ㺘DŽ༽ࡦ [GULYHBLQIR '5,9(B,1)2  㹼DŽ5227B'(9 ᇊѹ൘ IVVXSHUF5227B'(9 25,*B5227B'(9  㹼к㻛༠᰾Ѫ H[WHUQLQWDŽ ަѝ 5227B'(9ᐢ൘ࡽ䶒वਜ਼䘋Ⲵ LQFOXGHOLQX[IVK ᮷Ԧㅜ   PDLQF 〻ᒿ ༽ࡦਕᷴˈӗ⭏ਕᷴ  ਧVWGHUU ḷ߶ࠪ䭉䗃ࠪ䇮༷DŽ  YRLG GXS  ༽ࡦਕᷴˈӗ⭏ਕᷴ  ਧVWGRXW ḷ߶䗃ࠪ䇮༷DŽ  YRLG GXS   GHYWW\2B5':5 YRLG RSHQ  䘄എ٬DŽ YRLG āࡽ㔰⭘Ҿ㺘⽪ᕪࡦ࠭ᮠᰐ䴰 ਕᷴ VWGRXW ઼ḷ߶ࠪ䭉䗃ࠪਕᷴ VWGHUUDŽ࠭ᮠࡽ䶒ⲴĀ ਕᷴ VWGLQDŽ䘉䟼޽ᢺᆳԕ䈫઼߉Ⲵᯩᔿ࠶࡛ᢃᔰᱟѪҶ༽ࡦӗ⭏ḷ߶䗃ࠪ˄߉˅ޕࡦਠḷ߶䗃 ᫽֌ˈഐ↔ӗ⭏Ⲵ᮷Ԧਕᷴਧ˄᮷Ԧ᧿䘠ㅖ˅㛟ᇊᱟ DŽ䈕ਕᷴᱟ 81,; ㊫᫽֌㌫㔏唈䇔Ⲵ᧗ л䶒ԕ䈫߉䇯䰞ᯩᔿᢃᔰ䇮༷ĀGHYWW\āˈᆳሩᓄ㓸ㄟ᧗ࡦਠDŽ⭡Ҿ䘉ᱟㅜа⅑ᢃᔰ᮷Ԧ  GULYHBLQIR 㔃ᶴѝᱟ  њ⺜ⴈ৲ᮠ㺘DŽ GULYHBLQIR  YRLG VHWXS NHUQHOEONBGUYKGFˈ 㹼DŽ  ˈ൘ඇ䇮༷ᆀⴞᖅ ᆹ㻵ṩ᮷Ԧ㌫㔏䇮༷DŽ䈕࠭ᮠ⭘  㹼кⲴᆿᇊѹˈሩᓄ࠭ᮠᱟ V\VBVHWXS  ᱟањ㌫㔏䈳⭘DŽ⭘Ҿ䈫ਆ⺜ⴈ৲ᮠवᤜ࠶४㺘ؑ᚟ᒦ࣐䖭㲊ᤏⴈ˄㤕ᆈ൘Ⲵ䈍˅઼ VHWXS  LQWSLGL ^  YRLG YRLGLQLW Ⲵ⧟ຳ䘋㹼ࡍ࿻ॆˈ❦ਾԕⲫᖅ VKHOO ᯩᔿ࣐䖭䈕〻ᒿᒦᢗ㹼ѻDŽ 䘀㹼൘ԫ࣑  ㅜ  ⅑ࡋᔪⲴᆀ䘋〻˄ԫ࣑ ˅ѝDŽᆳ俆ݸሩㅜањሶ㾱ᢗ㹼Ⲵ〻ᒿ˄VKHOO˅  ࠭ᮠ ѝᐢ㓿䘋㹼Ҷ㌫㔏ࡍ࿻ॆˈवᤜ޵ᆈ㇑⨶ǃ਴⿽⺜Ԧ䇮઼༷傡ࣘ〻ᒿDŽLQLW ൘ PDLQ   HQYS>@ ^+20( XVUURRW18//` VWDWLFFKDU ਼кDŽDUJY>@ ^ELQVK18//` VWDWLFFKDU VK 〻ᒿՊ֌Ѫⲫᖅ VKHOO ᢗ㹼DŽަᢗ㹼䗷〻о൘ VKHOO ᨀ⽪ㅖлᢗ㹼 VK наṧDŽ ㅜ  㹼ѝ DUJY>@ѝⲴᆇㅖĀāᱟՐ䙂㔉 VKHOO 〻ᒿ VK ⲴањḷᘇDŽ䙊䗷䇶࡛䈕ḷᘇˈ 䘀㹼ⲫᖅ VKHOO ᰦᡰ֯⭘ⲴભԔ㹼৲ᮠ઼⧟ຳ৲ᮠDŽ  䈳⭘ᢗ㹼〻ᒿᰦⲴ⧟ຳᆇㅖѢᮠ㓴DŽHQYSBUF>@ ^+20( 18//` VWDWLFFKDU 䈳⭘ᢗ㹼〻ᒿᰦ৲ᮠⲴᆇㅖѢᮠ㓴DŽDUJYBUF>@ ^ELQVK18//` VWDWLFFKDU 䈫ਆᒦᢗ㹼HWFUF ᮷Ԧᰦᡰ֯⭘ⲴભԔ㹼৲ᮠ઼⧟ຳ৲ᮠDŽ  ` UHWXUQL  DUJV YDBHQG  SULQWEXIIPWDUJV SULQWEXIL YVSULQWI ZULWH  DUJVIPW YDBVWDUW  LQWL YDBOLVWDUJV ^  IPW FRQVWFKDU VWDWLFLQWSULQWI  ࠭ᮠⲴᇎ⧠㿱 NHUQHOYVSULQWIFDŽ ४Ⲵ޵ᇩ䗃ࠪࡠḷ߶䇮༷˄VWGRXW˅DŽYVSULQWI  ሶ㕃ߢ SULQWEXI 㕃ߢ४ˈ❦ਾ⭘ ZULWH ޕ ሶṬᔿॆⲴᆇㅖѢ᭮ ֻᆀDŽ䈕〻ᒿ֯⭘ YVSULQWI ᤷᇊ䗃ࠪሶ䟷⭘ⲴṬᔿˈ৲㿱ḷ߶ & 䈝䀰Җ㉽DŽ䈕ᆀ〻ᒿ↓ྭᱟ YVSULQWI ྲօ֯⭘Ⲵањㆰঅ  IPW  ˈ䘉䟼ᱟᤷቿᒅкᱮ⽪DŽ৲ᮠ л䶒࠭ᮠӗ⭏Ṭᔿॆؑ᚟ᒦ䗃ࠪࡠḷ߶䗃ࠪ䇮༷ VWGRXW  `  SDXVH IRU ⣦ᘱDŽ նᱟ䈳ᓖ࠭ᮠਚ㾱ਁ⧠㌫㔏ѝ⋑ᴹަԆԫ࣑ਟԕ䘀㹼ᰦቡՊ࠷ᦒࡠԫ࣑ ˈ㘼н׍䎆Ҿԫ࣑  Ⲵ  ㌫㔏䈳⭘˄NHUQHOVFKHGF˅Պᢺԫ࣑  䖜ᦒᡀਟѝᯝㅹᖵ⣦ᘱˈ޽ᢗ㹼䈳ᓖ࠭ᮠDŽ SDXVH     PDLQF 〻ᒿ   YRLG GXS   GHYWW\2B5':5 YRLG RSHQ  ࡋᔪаᯠⲴՊ䈍ᵏˈ㿱ਾ䶒䈤᰾DŽ VHWVLG   FORVH  FORVH  FORVH SLG ^ᯠⲴᆀ䘋〻DŽ LI ` FRQWLQXH  )RUNIDLOHGLQLQLW?U?Q SULQWI  ^ SLG IRUN LI  ^ ZKLOH  ᦞ㔃ᶴㅹ䍴ⓀDŽ ቡՊ㻛䇮㖞Ѫ䘉䟼Ⲵ LQLW 䘋〻˄䘋〻 ˅ˈᒦ⭡ LQLW 䘋〻䍏䍓䟺᭮ањᐢ㓸→䘋〻Ⲵԫ࣑ᮠ Ⲵਖཆањ࣏㜭ᱟ༴⨶ᆔݯ䘋〻DŽྲ᷌ањ䘋〻Ⲵ⡦䘋〻ݸ㓸→Ҷˈ䛓Ѹ䘉њ䘋〻Ⲵ⡦䘋〻  Ҷ䘀㹼ˈ䘄എ⸱ᱟ Lāˈ❦ਾ㔗㔝䟽䈅л৫ĂˈᖒᡀањĀབྷāᗚ⧟DŽ↔ཆˈZDLW→ڌ SLG Ҷᢗ㹼ˈࡉ൘ḷ߶䗃ࠪкᱮ⽪ࠪ䭉ؑ᚟Āᆀ䘋〻→ڌ ㅹᖵDŽྲ᷌ᆀ䘋〻৸ 〻޽⅑䘀㹼ZDLW ELQVKDŽն䘉⅑ᢗ㹼ᡰ䘹⭘Ⲵ৲ᮠ઼⧟ຳᮠ㓴ਖ䘹Ҷа྇˄㿱к䶒  㹼˅DŽ❦ਾ⡦䘋 ❦ਾ䟽ᯠᢃᔰGHYWW\֌ѪVWGLQˈᒦ༽ࡦᡀVWGRXW ઼VWGHUUDŽ޽⅑ᢗ㹼㌫㔏䀓䟺〻ᒿ VWGLQVWGRXWVWGHUU ˈᯠࡋᔪањՊ䈍ᒦ䇮㖞䘋〻㓴ਧˈ 䰝ᡰᴹԕࡽ䘈䚇⮉Ⲵਕᷴޣ〻ሶ 䘋〻ˈྲ᷌ࠪ䭉ˈࡉᱮ⽪Āࡍ࿻ॆ〻ᒿࡋᔪᆀ䘋〻ཡ䍕āؑ᚟ᒦ㔗㔝ᢗ㹼DŽሩҾᡰࡋᔪⲴᆀ䘋 ᡆ㓸→ҶDŽл䶒ᗚ⧟ѝ俆ݸ޽ࡋᔪањᆀ→ڌྲ᷌ᢗ㹼ࡠ䘉䟼ˈ䈤᰾ࡊࡋᔪⲴᆀ䘋〻Ⲵᢗ㹼ᐢ   オᗚ⧟  QRWKLQJ   L SLG ZDLW ZKLOH  SLG! LI  䘄എ٬нㅹҾᆀ䘋〻ਧˈࡉ㔗㔝ㅹᖵDŽ  L ᱟᆈ᭮䘄എ⣦ᘱؑ᚟Ⲵս㖞DŽྲ᷌ ZDLW SLG DŽ䘉йਕⲴ֌⭘ᱟ⡦䘋〻ㅹᖵᆀ䘋〻Ⲵ㔃ᶏDŽ  ᡆ㓸→ˈ䘄എ٬ᓄᱟᆀ䘋〻Ⲵ䘋〻ਧ→ڌ ㅹᖵᆀ䘋〻 л䶒䘈ᱟ⡦䘋〻˄˅ᢗ㹼Ⲵ䈝ਕDŽZDLW  `  ᢗ㹼ཡ䍕ࡉ䘰ࠪDŽ 㤕 H[HFYH  BH[LW ᴯᦒᡀELQVK 〻ᒿᒦᢗ㹼DŽ ELQVKDUJYBUFHQYSBUF H[HFYH OLEBH[LWF DŽ ྲ᷌ᢃᔰ᮷Ԧཡ䍕ˈࡉ䘰ࠪ  BH[LW  HWFUF2B5'21/< RSHQ LI   FORVH  ^ SLG IRUN  LI   䘰ࠪᰦⲴࠪ䭉⸱ ̢᫽֌ᵚ䇨ਟ˗᮷Ԧᡆⴞᖅнᆈ൘DŽ ࠭ᮠBH[LW  ࠭ᮠ䈤᰾䈧৲㿱 IVH[HFF 〻ᒿˈ 㹼DŽ Ҿ H[HFYHޣҏ䲿ѻ㔃ᶏDŽ  Ҿ䘉䟼 VK Ⲵ䘀㹼ᯩᔿᱟ䶎ӔӂᔿⲴˈഐ↔൘ᢗ㹼ᆼ UF ᮷ԦѝⲴભԔਾቡՊ・࡫䘰ࠪˈ䘋〻 VWGLQ 䟽ᇊੁࡠHWFUF ᮷ԦDŽ䘉ṧ VKHOO 〻ᒿELQVK ቡਟԕ䘀㹼 UF ᮷Ԧѝ䇮㖞ⲴભԔDŽ⭡ ޕ䰝ਕᷴ  ᒦ・࡫ᢃᔰHWFUF ᮷ԦⲴ֌⭘ᱟᢺḷ߶䗃ޣ࡛⭡ DUJYBUF ઼ HQYSBUF ᮠ㓴㔉ࠪDŽ ᴯᦒᡀELQVK 〻ᒿ˄ণ VKHOO 〻ᒿ˅ˈ❦ਾᢗ㹼ELQVK 〻ᒿDŽᡰᩪᑖⲴ৲ᮠ઼⧟ຳਈ䟿࠶  ࠭ᮠሶ䘋〻㠚䓛 䰝Ҷਕᷴ ˄VWGLQ˅ǃԕਚ䈫ᯩᔿᢃᔰHWFUF ᮷Ԧˈᒦ֯⭘ H[HFYHޣ䘋〻 ৏䘋〻˄⡦䘋〻˅ࡉ䘄എᆀ䘋〻Ⲵ䘋〻ਧ SLGDŽᡰԕㅜ  㹼ᱟᆀ䘋〻ᢗ㹼Ⲵ޵ᇩDŽ䈕ᆀ ሩҾˈ٬  ሶ䘄എ ⭘Ҿࡋᔪањᆀ䘋〻˄ԫ࣑ ˅DŽሩҾ㻛ࡋᔪⲴᆀ䘋〻ˈIRUN л䶒 IRUN   GE\WHV?Q?UPHPRU\BHQGPDLQBPHPRU\BVWDUW)UHHPHP SULQWI  %/2&.B6,=( 15B%8))(56 GEXIIHUV GE\WHVEXIIHUVSDFH?Q?U15B%8))(56 SULQWI л䶒ᢃঠ㕃ߢ४ඇᮠ઼ᙫᆇ㢲ᮠˈ⇿ඇ  ᆇ㢲ˈԕ৺ѫ޵ᆈ४オ䰢޵ᆈᆇ㢲ᮠDŽ    PDLQF 〻ᒿ (0x09 ᖃࡽᒤԭ (ᇎᰦ䫏) 0x2e ṑ傼઼ (վᆇ㢲 ⮉؍ 0x08 ᖃࡽᴸԭ (ᇎᰦ䫏) 0x19-0x2d 0x07 аᴸѝⲴᖃᰕᰕᵏ (ᇎᰦ䫏) 0x18 ᢙኅ޵ᆈ (儈ᆇ㢲) 0x06 аઘѝⲴᖃࡽཙ (ᇎᰦ䫏) 0x17 ᢙኅ޵ᆈ (վᆇ㢲) 0x16 สᵜ޵ᆈ (儈ᆇ㢲) 0x05 ᣕ䆖ሿᰦ٬ ᇎᰦ䫏) 0x15 สᵜ޵ᆈ (վᆇ㢲)) 0x04 ᖃࡽሿᰦ٬ 0x14 䇮༷ᆇ㢲 0x03 ᣕ䆖࠶䫏٬ ⮉؍ 0x02 ᖃࡽ࠶䫏 (ᇎᰦ䫏) 0x13 0x12 ⺜ⴈ傡ࣘಘ㊫ර ٬。0x01 ᣕ䆖 ⮉؍ ᇎᰦ䫏) 0x11) ٬。0x00 ᖃࡽ ޵ᇩ䈤᰾ ٬〫ٿ޵ᇩ䈤᰾ ൠ൰ ٬〫ٿൠ൰ 㺞 ̢&026 ᆍ㢸ؗᚥㆶ㺞 Ṩ〻ᒿ drivers/block/hd.c ㅜ 42 㹼䎧Ⲵԓ⸱)DŽ㺘 7–1 ᱟ CMOS ޵ᆈؑ᚟Ⲵаᕐㆰ㺘DŽ ഐ↔ԆⲴԓ⸱ѝҏቡᴹҶ䘉↕нᗵ㾱Ⲵ᫽֌DŽн䗷Ӿ 1.0 ⡸ᵜѻਾˈ䈕᫽֌ቡ㻛৫䲔Ҷ(ਟ৲㿱 1.0 ⡸޵ ൠ൰о 0x80 䘋㹼ᡆ᫽֌˄ᒦф䘈؞᭩ҶަԆൠᯩ˅ਾ↓ྭਆᗇҶᡰᴹ↓⺞Ⲵ㔃᷌ˈ〫ٿҏ䇨൘Ԇᇎ傼ѝሶ ൠ൰䜭ᱟԆ䙀↕ᇎ傼ࠪᶕⲴˈ〫ٿCMOS ᯩ䶒Ⲵ䍴ᯉˈCMOS ѝᰦ䫏઼ᰕᵏⲴ ޣѪᖃᰦ Linus ᡻ཤ㕪ѿᴹ ޵ᆈᇩ䟿䘈⋑ᴹ䎵䗷 128 ᆇ㢲ˈഐ↔о 0x80 䘋㹼ᡆ᫽֌ᱟ⋑ᴹԫօ֌⭘ⲴDŽѻᡰԕՊᴹ䘉ṧⲴ᫽֌ᱟഐ main.c 〻ᒿㅜ 70 㹼䈝ਕᢺⅢ䈫ਆⲴᆇ㢲ൠ൰о 0x80 䘋㹼ᡆ᫽֌ᱟ⋑ᴹᗵ㾱ⲴDŽഐѪ䛓ᰦⲴ CMOS 0x71 ѝ৫DŽ ਾᢺᮠᦞ߉ࡠᮠᦞㄟਓ❦ˈ٬〫ٿ᚟DŽ਼ṧˈሩҾ߉᫽֌ҏ䴰㾱俆ݸੁൠ൰ㄟਓ 0x70 ਁ䘱ᤷᇊᆇ㢲Ⲵ ਾ֯⭘ IN ᤷԔӾᮠᦞㄟਓ 0x71 䈫ਆᤷᇊⲴᆇ㢲ؑ❦ˈս㖞٬〫ٿԔੁൠ൰ㄟਓ 0x70 ਁ䘱ᤷᇊᆇ㢲Ⲵ ս㖞Ⲵᆇ㢲ˈᗵ享俆ݸ֯⭘ OUT ᤷ〫ٿ0x71 䘋㹼DŽ0x70 ᱟൠ൰ㄟਓˈ0x71 ᱟᮠᦞㄟਓDŽѪҶ䈫ਆᤷᇊ CMOS Ⲵൠ൰オ䰤൘สᵜൠ൰オ䰤ѻཆˈഐ↔ަѝнवᤜਟᢗ㹼ԓ⸱DŽ㾱䇯䰞ᆳ䴰㾱䙊䗷ㄟਓ 0x70ǃ ᭮аӋ㌫㔏䝽㖞ᮠᦞDŽ ᆈᰦ䫏઼ᰕᵏؑ᚟ˈᆈ᭮ⲴṬᔿᱟ BCD ⸱DŽ⭡Ҿ䘉Ӌؑ᚟ӵ⭘৫ 14 ᆇ㢲ˈഐ↔࢙։Ⲵᆇ㢲ቡਟ⭘ᶕᆈ ؍Chip˅Ⲵа䜘࠶DŽᴹӋᵪಘ䘈ᴹᴤབྷⲴ޵ᆈᇩ䟿DŽ䈕 64 ᆇ㢲Ⲵ CMOS ৏ݸ൘ IBM PC-XT ᵪಘк⭘Ҿ PC ᵪⲴ CMOS ޵ᆈᱟ⭡⭥⊐׋⭥Ⲵ 64 ᡆ 128 ᆇ㢲޵ᆈඇˈ䙊ᑨᱟ㌫㔏ᇎᰦ䫏㣟⡷ RTC˄Real Time 7.1.3.1 CMOS ؗᚥ 7.1.3 ެԌؗᚥ   ` 䰝ᡰᴹḷ߶ ,2 ㅹˈ❦ਾ䈳⭘ V\VBH[LWDŽޣ༴⨶〻ᒿǃ  ࡉ䙊ᑨᱟᲞ䙊࠭ᮠᓃѝⲴањ࠭ᮠDŽᆳՊݸᢗ㹼аӋ␵䲔᫽֌ˈֻྲ䈳⭘ᢗ㹼਴㓸→ H[LW  ⴤ᧕ᱟањ V\VBH[LW ㌫㔏䈳⭘ˈ㘼 䜭⭘Ҿ↓ᑨ㓸→ањ࠭ᮠDŽնBH[LW ઼ H[LW BH[LW   ˈ䶎 H[LW ⌘᜿ʽᱟBH[LW   127(BH[LWQRWH[LW   BH[LW ` ਼↕᫽֌ˈࡧᯠ㕃ߢ४DŽ V\QF  ?Q?UFKLOGGGLHGZLWKFRGH[?Q?USLGL SULQWI EUHDN  L SLG ZDLW LI   ZKLOH `  ELQVKDUJYHQYS H[HFYH BH[LW   YRLG GXS    PDLQF 〻ᒿ  SLG  SLG ৏䘋〻 ᯠ䘋〻 ৏䘋〻 SLG IRUN ㅹҾ䘋〻㓴ਧ gid Ⲵ䘋〻DŽањ䘋〻ਟԕ䙊䗷䈳⭘ setpgid()ᶕ৲࣐ањ⧠ᴹⲴ䘋〻㓴ᡆ㘵ࡋᔪањᯠⲴ ID˅DŽ䘋〻㓴ਧ gid ҏᱟањ↓ᮤᮠDŽ⇿ањ䘋〻㓴ᴹањ〠Ѫ㓴䮯Ⲵ䘋〻ˈ㓴䮯䘋〻ቡᱟަ䘋〻ਧ pid 䘋〻㓴ᱟањᡆཊњ䘋〻Ⲵ䳶ਸDŽо䘋〻㊫լˈ⇿њ䘋〻㓴䜭ᴹањୟаⲴ䘋〻㓴ḷ䇶ਧ gid˄Group ަѝⲴ⇿њભԔ˖catǃgrep ઼ more ቡ䜭኎Ҿањ䘋〻㓴DŽ [plinux root]# cat main.c | grep for | more Ⲵањ㇑䚃ભԔˈޕભԔ㹼к䭞 〻ਟԕ䙊䗷 fork()䈳⭘ࡋᔪањᡆཊњᆀ䘋〻ˈ䘉Ӌ䘋〻ቡਟԕᶴᡀањ䘋〻㓴DŽֻྲˈሩҾл䶒൘ shell Ṩѝˈ⇿њ䘋〻䜭֯⭘ањн਼ⲴབྷҾ䴦Ⲵ↓ᮤᮠᶕḷ䇶ˈ〠Ѫ䘋〻ḷ䇶ਧ pid(Porcess ID)DŽ㘼ањ䘋 ൘ㅜ 2 ㄐᡁԜ䈤䗷ˈ〻ᒿᱟањਟᢗ㹼Ⲵ᮷Ԧˈ㘼䘋〻˄process˅ᱟањᢗ㹼ѝⲴ〻ᒿᇎֻDŽ൘޵ 7.1.3.3 ީӄՐ䈓ᵕ(session)ⲺᾸᘫ ᘱؑ᚟DŽ Ⲵ޵Ṩ䍴ⓀDŽ㘼⡦䘋〻ࡉਟԕ֯⭘ wait()䈳⭘ᶕḕⴻᡆㅹᖵᆀ䘋〻Ⲵ䘰ࠪˈᒦ㧧ਆ㻛㓸→䘋〻Ⲵ䘰ࠪ⣦ ᖃ〻ᒿᢗ㹼ᆼᡆᴹᗵ㾱㓸→ᰦቡਟԕ䈳⭘ exit()ᶕ䘰ࠪ〻ᒿⲴᢗ㹼DŽ䈕࠭ᮠՊ㓸→䘋〻ᒦ䟺᭮ަঐ⭘ 186 ઼ 202 㹼ᱟ⡦䘋〻ᢗ㹼Ⲵԓ⸱ඇDŽ 䘋〻Ⲵࡔᯝᒦᔰ࿻ᆀ䘋〻ԓ⸱ඇⲴᢗ㹼˄࡙⭘ execve()㌫㔏䈳⭘ᢗ㹼ަԆ〻ᒿˈ䘉䟼ᢗ㹼Ⲵᱟ sh˅ˈㅜ init 〻ᒿণᱟ⭘ fork()䈳⭘Ⲵ䘄എ٬ᶕ४࠶઼ᢗ㹼н਼Ⲵԓ⸱⇥ⲴDŽк䶒ԓ⸱ѝㅜ 179 ઼ 194 㹼ᱟᆀ  ࡑᔰ᯦䘑ぁ ഴ 䈹⭞ IRUN ᜿മ 7-3 ᡰ⽪DŽ ѝᢗ㹼ˈնᐢᔰ࿻৹ᔰˈ਴㠚ᢗ㹼㠚ᐡⲴ䛓⇥ԓ⸱DŽྲ᷌ fork()䈳⭘ཡ䍕ˈࡉՊ䘄എሿҾ 0 Ⲵ٬DŽྲ⽪ 䘉ṧˈ㲭❦↔ᰦ䘈ᱟ൘਼ṧа〻ᒿˈ٬ Ⲵᱟᆀ䘋〻Ⲵ䘋〻ḷ䇶ਧ PIDˈ㘼൘ᆀ䘋〻ѝ fork()䘄എⲴሶᱟ 0 ൘ fork 䈳⭘䘄എս㖞༴ˈ⡦䘋〻ሶᚒ༽ᢗ㹼ˈ㘼ᆀ䘋〻ࡉᔰ࿻ᢗ㹼DŽ൘⡦䘋〻ѝˈ䈳⭘ fork()䘄എ 䰤઼⧟ຳ৲ᮠDŽࡋᔪᯠ䘋〻Ⲵѫ㾱⭘䙄൘Ҿ൘ᯠ䘋〻ѝ֯⭘ exec()㈷࠭ᮠ৫ᢗ㹼ަԆн਼Ⲵ〻ᒿDŽ аṧⲴᯠ㺘亩ˈᒦᢗ㹼਼ṧⲴԓ⸱ˈն䈕ᯠ䘋〻˄䘉䟼㻛〠Ѫᆀ䘋〻˅ᤕᴹ㠚ᐡⲴᮠᦞオޘ〻˅ࠐѾᆼ fork ᱟањ㌫㔏䈳⭘࠭ᮠDŽ䈕㌫㔏䈳⭘༽ࡦᖃࡽ䘋〻ˈᒦ൘䘋〻㺘ѝࡋᔪањо৏䘋〻(㻛〠Ѫ⡦䘋 7.1.3.2 䈹⭞ fork()ࡑᔰ᯦䘑ぁ 0x10 ⻱ⴈ傡ࣘಘ㊫ර ⮉؍ ᵪ⣦ᘱᆇ㢲 0x34-0x3fڌ 0x0f 0x0e POST 䇺ᯝ⣦ᘱᆇ㢲 0x33 ؑ᚟ḷᘇ 0x0d RTC ⣦ᘱᇴᆈಘ D 0x32 ᖃࡽᡰ༴ц㓚٬ 0x0c RTC ⣦ᘱᇴᆈಘ C 0x31 1Mb ԕкⲴᢙኅ޵ᆈ (儈ᆇ㢲) 0x0b RTC ⣦ᘱᇴᆈಘ B 0x30 1Mb ԕкⲴᢙኅ޵ᆈ (վᆇ㢲) 0x0a RTC ⣦ᘱᇴᆈಘ A 0x2f ṑ傼઼ (儈ᆇ㢲)   PDLQF 〻ᒿ 䘋〻㓴 䘋〻㓴 䘋〻㓴 䘋〻䘋〻 Պ䈍ᵏ   䘋〻  䘋〻䘋〻 䘋〻    ㌫㿱മ 7-5 ᡰ⽪DŽޣshell Ӕӂᐕ֌⭼䶒DŽᆳԜѻ䰤Ⲵᢗ㹼 ޕ㓸䈳⭘ shell 〻ᒿˈᒦ䘋 ਓԔⲴ↓⺞ᙗԕਾˈᴰޕҶ⭘ᡧ਽ਾˈgetty 㻛ᴯᦒᡀ login 〻ᒿDŽlogin 〻ᒿ൘傼䇱Ҷ⭘ᡧ䗃ޕᖃ⭘ᡧ䭞 ㄟࡍ࿻ॆ䇮㖞〻ᒿ agetty˄㔏〠 getty 〻ᒿ˅ˈgetty 〻ᒿࡉՊ൘㓸ㄟкᱮ⽪⭘ᡧⲫᖅᨀ⽪ؑ᚟Ālogin:āDŽ ㌫㔏/etc/ⴞᖅѝ䝽㖞᮷ԦⲴ䇮㖞ؑ᚟ˈሩ㌫㔏ѝ᭟ᤱⲴ⇿њ㓸ㄟ䇮༷ࡋᔪᆀ䘋〻ˈᒦ൘ᆀ䘋〻ѝ䘀㹼㓸 ਼ᰦ֯⭘㌫㔏Ⲵ㜭࣋ˈ䙊ᑨⲴ㌫㔏ᱟ൘䘉䟼ᡆ㊫լൠᯩᢗ㹼㌫㔏⧟ຳࡍ࿻ॆ〻ᒿ init.cˈ㘼↔〻ᒿՊṩᦞ 䀓䟺〻ᒿ˄shell 〻ᒿ˅/bin/shˈ㘼൘ᇎ䱵ਟ⭘Ⲵ㌫㔏ѝতᒦ䶎ྲ↔DŽѪҶ㜭ާᴹⲫᖅ㌫㔏Ⲵ࣏㜭઼ཊӪ ༷ањᑨ⭘㌫㔏ᡰާ༷ⲴаӋᐕ֌⧟ຳDŽ൘ࡽ䶒Ⲵㅜ 183 㹼઼ 200 㹼кˈinit()࠭ᮠⴤ᧕ᔰ࿻ᢗ㹼ҶભԔ ൘޵Ṩ㌫㔏ࡍ࿻ॆᆼ∅ѻਾˈ㌫㔏䘈䴰㾱ṩᦞާփ䝽㖞ᢗ㹼䘋а↕Ⲵ⧟ຳࡍ࿻ॆᐕ֌ˈ᡽㜭ⵏ↓ާ 7.2 ⧥ູࡓခौᐛ֒ ᮷Ԧˈഐ↔㤕ањ䘋〻䴰㾱䇯䰞᧗ࡦ㓸ㄟˈਟԕⴤ᧕ሩ/dev/tty ᮷Ԧ䘋㹼䈫߉᫽֌DŽ ᤕᴹ᧗ࡦ㓸ㄟⲴањ䘋〻㓴ˈ㘼Պ䈍ᵏѝⲴަᆳ䘋〻㓴ࡉᡀѪਾਠ䘋〻㓴DŽ᧗ࡦ㓸ㄟሩᓄҾ/dev/tty 䇮༷ 〻㓴˄Background process group˅DŽањ㓸ㄟਚ㜭֌ѪањՊ䈍ᵏⲴ᧗ࡦ㓸ㄟˈࡽਠ䘋〻㓴ቡᱟՊ䈍ᵏѝ ањՊ䈍ᵏѝⲴࠐњ䘋〻㓴㻛࠶Ѫањࡽਠ䘋〻㓴˄Foreground process group˅઼ањᡆࠐњਾਠ䘋 ഴ 䘑ぁȽ䘑ぁ㓺ૂՐ䈓ᵕҁ䰪Ⲻީ㌱  ㌫㿱മ 7-4 ᡰ⽪DŽޣ㿱л㢲䈤᰾DŽ䘋〻ǃ䘋〻㓴઼Պ䈍ᵏѻ䰤Ⲵ ᘥⲴѫ㾱⭘䙄ѻаDŽsetsid()࠭ᮠቡᱟ⭘Ҿᔪ・ањᯠⲴՊ䈍ᵏDŽ䙊ᑨ䈕࠭ᮠ⭡⧟ຳࡍ࿻ॆ〻ᒿ䘋㹼䈳⭘ˈ process˅DŽᖃᡁԜ䘰ࠪⲫᖅ˄logout˅ᰦˈᡰᴹ኎ҾᡁԜ䘉њՊ䈍ᵏⲴ䘋〻䜭ሶ㻛㓸→DŽ䘉ҏᱟՊ䈍ᵏᾲ ㄟቡᱟՊ䈍ᵏⲴ᧗ࡦ㓸ㄟ˄Controlling Terminal˅ˈഐ↔Պ䈍ᵏ俆䘋〻䙊ᑨҏ㻛〠Ѫ᧗ࡦ䘋〻˄Controlling Ⲵᡰᴹ〻ᒿ䜭኎ҾањՊ䈍ᵏˈ㘼ަⲫᖅ shell ࡉᱟՊ䈍ᵏ俆䘋〻˄Session leader˅ˈᒦфᆳᡰ֯⭘Ⲵ㓸 㘼Պ䈍ᵏ˄Sessionˈᡆ〠ѪՊ䈍˅ࡉᱟањᡆཊњ䘋〻㓴Ⲵ䳶ਸDŽ䙊ᑨᛵߥлˈ⭘ᡧⲫᖅਾᡰᢗ㹼 ؑਧˈࡉйњભԔሶ਼ᰦ㓸→ᢗ㹼DŽ ᑨᱟ᤹ Ctrl-C 㓴ਸ䭞˅ˈ਼ᰦ㓸→ᮤњ䘋〻㓴ѝⲴᡰᴹ䘋〻DŽֻྲˈྲ᷌ᡁԜੁк䘠㇑䚃ભԔਁࠪ㓸→ 䘋〻㓴DŽ䘋〻㓴Ⲵᾲᘥᴹᖸཊ⭘䙄ˈնަѝᴰᑨ㿱ⲴᱟᡁԜ൘㓸ㄟкੁࡽਠᢗ㹼〻ᒿਁࠪ㓸→ؑਧ˄䙊   ຳࡍ࿻ॆᐕ֌⧟ VKHOO ORJLQ DJHWW\ 䘋〻 1 LQLW exec() exec() fork() DJHWW\̢DOWHUQDWLYH/LQX[JHWW\DŽ login ޣᒿDŽྲ᷌ਓԔ᮷Ԧѝҏ⋑ᴹѪ䈕⭘ᡧᤷᇊ⭘ᡧ䎧࿻ⴞᖅⲴ䈍ˈ㌫㔏ቡՊ֯⭘唈䇔Ⲵṩⴞᖅ/DŽᴹ ྲ᷌ਓԔ᮷Ԧ/etc/passwd ѝ䈕⭘ᡧ亩ѝ⋑ᴹᤷᇊ֯⭘ଚњ shell 〻ᒿˈ㌫㔏ࡉՊ֯⭘唈䇔Ⲵ/bin/sh 〻 ᖅ⭘ᡧⲴ⭘ᡧ ID ᒦᢗ㹼ਓԔ᮷Ԧѝ䈕⭘ᡧ亩ѝᤷᇊⲴ shell 〻ᒿˈྲ bash ᡆ csh ㅹDŽ ˄message-of-the-day˅ѝⲴ᮷ᵜؑ᚟ˈᒦỰḕᒦᱮ⽪䈕⭘ᡧᱟ੖ᴹ䛞ԦⲴؑ᚟DŽᴰਾ login 〻ᒿ᭩ਈᡀⲫ ⭘ᡧ਽˄USER=઼ LOGNAME=˅઼㌫㔏ᢗ㹼〻ᒿⲴ唈䇔䐟ᖴᒿࡇ˄PATH=˅DŽ᧕⵰ᱮ⽪/etc/motd ᮷Ԧ IDDŽ❦ਾ࡙⭘ᡰᗇࡠⲴؑ᚟ࡍ࿻ॆ⧟ຳਈ䟿ؑ᚟ˈֻྲ䎧࿻ⴞᖅ˄HOME=˅ǃ֯⭘Ⲵ shell 〻ᒿ˄SHELL=˅ǃ ѝᤷᇊⲴ䈕⭘ᡧⲴ䎧࿻ᐕ֌ⴞᖅDŽᒦᢺሩ䈕㓸ㄟ䇮༷Ⲵ䇯䰞ᵳ䲀؞᭩ᡀ⭘ᡧ䈫/߉઼㓴߉ˈ䇮㖞䘋〻Ⲵ㓴 Ⲵᇶ⸱↓⺞ˈࡉ login ቡՊᢺᖃࡽᐕ֌ⴞᖅ˄Current Work Directory˅؞᭩ᡀਓԔ᮷Ԧޕྲ᷌⭘ᡧ䭞 䘋〻ѝ䪸ሩ䈕㓸ㄟ䇮༷޽⅑ᢗ㹼 agetty 〻ᒿˈ䟽༽к䘠䗷〻DŽ 〻 init˅Ⲵ wait()Պ䘄എ䈕䘰ࠪ䘋〻Ⲵ pidˈഐ↔Պṩᦞ䇠ᖅлᶕⲴؑ᚟޽⅑ࡋᔪањᆀ䘋〻ˈᒦ൘䈕ᆀ Ⲵᇶ⸱൷ᰐ᭸ˈࡉ login 〻ᒿՊԕࠪ䭉⸱ 1 䘰ࠪᢗ㹼ˈ㺘⽪↔⅑ⲫᖅ䗷〻ཡ䍕DŽ↔ᰦ⡦䘋〻˄䘋ޕ⅑䭞 Ⲵᇶ⸱䘋㹼࣐ᇶ༴⨶ˈᒦоਓԔ᮷Ԧѝ䈕⭘ᡧ亩ѝ pw_passwd ᆇ⇥֌∄䖳DŽྲ᷌⭘ᡧࠐޕ࣐ᇶ㇇⌅ሩ䭞 Ⲵᇶ⸱ˈ❦ਾ֯⭘ޕᗇሩᓄ⭘ᡧⲴⲫᖅ亩ˈ❦ਾ䈳⭘ getpass()ԕᱮ⽪”password:”ᨀ⽪ؑ᚟ˈ䈫ਆ⭘ᡧ䭞 Ⲵ⭘ᡧ਽ˈᆳӾਓԔ᮷Ԧ passwd ѝਆޕᇶ⸱DŽṩᦞ⭘ᡧ䗃ޕ login 〻ᒿࡉѫ㾱⭘Ҿ㾱≲ⲫᖅ⭘ᡧ䗃 ⲫᖅ਽ˈᒦᢗ㹼 login 〻ᒿDŽ Ⲵޕࡉ getty Պ俆ݸᱮ⽪ަѝⲴ᮷ᵜؑ᚟ˈ❦ਾᱮ⽪ⲫᖅᨀ⽪ؑ᚟˄ֻྲ˖plinux login: ˅ˈ䈫ਆ⭘ᡧ䭞 ⭘ᡧ਽DŽ䈕〻ᒿਚ㜭⭡䎵㓗⭘ᡧᢗ㹼DŽ䙊ᑨˈ㤕/etc/issue ᮷ᵜ᮷Ԧᆈ൘ˈޕ⽪ᨀ⽪ؑ᚟ˈᒦㅹᖵ⭘ᡧ䭞 getty 〻ᒿⲴѫ㾱ԫ࣑ᱟ䇮㖞㓸ㄟ㊫රǃ኎ᙗǃ䙏ᓖ઼㓯䐟㿴〻DŽᆳᢃᔰᒦࡍ࿻ॆањ tty ㄟਓˈᱮ Ⲵᐕ֌DŽڊᆳ㻛䝽㖞ᡀ㾱 ༴⨶ಘⲴᐕ֌ˈԕ৺ԫօ→ڌ䰝ᰦˈinit 䍏䍓ᵰ↫ᡰᴹަԆⲴ䘋〻ˈন䖭ᡰᴹⲴ᮷Ԧ㌫㔏ԕ৺ޣᖃ㌫㔏 Ӌަ⡦䖸䘋〻ᐢ㔃ᶏⲴ䘋〻˗൘ Linux ѝᡰᴹⲴ䘋〻ᗵ享኎Ҿঅἥ䘋〻ṁˈᡰԕᆔ・䘋〻ᗵ享㻛᭦ਆDŽ ൘↓ᑨ᫽֌лˈinit ⺞ᇊ agetty ↓൘ᐕ֌⵰ԕݱ䇨⭘ᡧⲫᖅˈᒦф᭦ਆᆔ・䘋〻DŽᆔ・䘋〻ᱟᤷ䛓 њሩᓄⲴ䘋〻Ѫަㅹᖵ༴⨶DŽ ࡋᔪањᯠⲴᆀ䘋〻ˈᒦ൘䈕ᆀ䘋〻ѝ䟽ᯠᢗ㹼 agetty 〻ᒿDŽ䘉ṧˈ⇿њ㻛ݱ䇨Ⲵ㓸ㄟ䇮༷䜭࿻㓸ᴹа 䘰ࠪˈᆳቡՊṩᦞ wait()䘄എⲴ pid ਧ⸕䚃ᱟଚњሩᓄ㓸ㄟⲴᆀ䘋〻㔃ᶏҶˈഐ↔ቡՊѪ⴨ᓄ㓸ㄟ䇮༷޽ ㅹᖵᆀ䘋〻㔃ᶏ⣦ᘱDŽ⇿ᖃᆳⲴањᆀ䘋〻㔃ᶏޕ㹼 agetty9˄getty˅〻ᒿDŽ㘼 init 䘋〻ࡉ䈳⭘ wait()ˈ䘋 ԦѝⲴؑ᚟ˈѪ⇿ањݱ䇨ⲫᖅⲴ㓸ㄟ䇮༷֯⭘ fork()ࡋᔪањᆀ䘋〻ˈᒦ൘⇿њᯠࡋᔪⲴᆀ䘋〻ѝ䘀 init 䘋〻Ⲵѫ㾱ԫ࣑ᱟṩᦞ/etc/rc ᮷Ԧѝ䇮㖞Ⲵؑ᚟ˈᢗ㹼ަѝ䇮㖞ⲴભԔˈ❦ਾṩᦞ/etc/inittab ᮷ 䘋ሩ޵ṨѪӰѸᨀ׋䛓Ѹཊ࣏㜭Ⲵ⨶䀓DŽ׳䀓Պ 㲭❦䘉ࠐњ〻ᒿ˄init, getty, login, shell˅ᒦн኎Ҿ޵Ṩ㤳⮤ˈնሩ䘉ࠐњ〻ᒿⲴ֌⭘ᴹаӋสᵜҶ ഴ ᴿީ⧥ູࡓခौⲺぁᓅ    ຳࡍ࿻ॆᐕ֌⧟ 䈳ᓖ࠭ᮠ schedule()઼ᰦ䫏ѝᯝ䗷〻ণᱟлаㄐѝⲴѫ仈ѻаDŽ 䈕䘋〻Ⲵ CPU ֯⭘ᵳቡՊ㻛нᛵᝯൠ࢕ཪˈ䇙㔉࡛Ⲵ䘋〻֯⭘DŽ ᘱⲴ䘋〻ˈᖃᰦ䫏ѝᯝ䗷〻ࡔᯝࠪᆳ䘀㹼Ⲵᰦ䰤⡷ᐢ㻛⭘ᆼᰦˈቡՊ൘ do_timer()ѝᢗ㹼䘋〻࠷ᦒ᫽֌ˈ ⭡ schedule()ṩᦞᡰᴹ䘋〻Ⲵᖃࡽ⣦ᘱ઼ՈݸᵳߣᇊDŽሩҾаⴤ൘ਟ䘀㹼⣦ޘлᶕՊ䘀㹼ଚњ䘋〻ˈࡉᆼ sleep_on()㊫࠭ᮠ䰤᧕ൠ䈳⭘ schedule()࠭ᮠˈሶ CPU Ⲵ֯⭘ᵳ㠚ᝯൠ〫Ӕ㔉࡛Ⲵ䘋〻֯⭘DŽ㠣Ҿ㌫㔏᧕ ሩҾ䘋〻൘ᢗ㹼䗷〻ѝ⭡Ҿᜣ⭘Ⲵ䍴ⓀᲲᰦ㕪ѿ㘼Ѥᰦ䴰㾱ㅹᖵаՊᰦˈᆳቡՊ൘㌫㔏䈳⭘ѝ䙊䗷 ߥᶕ⺞ᇊ䘋〻Ⲵла↕⣦ᘱDŽ ⇿ 10 ∛。ਁࠪа⅑ᰦ䫏ѝᯝˈᒦ൘䈕ѝᯝ䗷〻ѝˈ䙊䗷䈳⭘ do_timer()࠭ᮠỰḕᡰᴹ䘋〻Ⲵᖃࡽᢗ㹼ᛵ 〻ᒿѝⲴ䈳ᓖ࠭ᮠ schedule()઼ system_call.s ѝⲴᇊᰦᰦ䫏ѝᯝ䗷〻_timer_interrupt ᶕ᫽֌ⲴDŽ޵Ṩ䇮ᇊ ྲօ䈳ᓖ䘉Ӌ䘋〻䘀㹼Ⲵ઒˛ҏণþ䖞ᆀÿᱟᘾṧ䖜䎧ᶕⲴ઒˛āDŽㆄṸᒦн༽ᵲ˖޵Ṩᱟ䙊䗷ᢗ㹼 sched.c Ҷ䀓DŽնᛘਟ㜭䘈Պᨀࠪ䘉ṧⲴ䰞仈˖Ā൘⭏ᡀҶа㌫ࡇ䘋〻ѻਾˈ㌫㔏ᱟྲօ࠶ᰦ䘀㹼䘉Ӌ䘋〻ᡆ㘵䈤 ྲ᷌ᛘ᤹ㄐ㢲亪ᒿ亪࡙ൠ䰵䈫ࡠ䘉䟼ˈ䛓Ѹᛘሩ Linux ㌫㔏޵ṨⲴࡍ࿻ॆ䗷〻ᓄ䈕ᐢ㓿ᴹҶབྷ㠤Ⲵ ࡦᖫᓅᔴ␵ᾊˈ❦ਾ޽㔗㔝䰵䈫DŽ ᣔ⁑ᔿлⲴ䘀㹼ᵪ؍Җ㉽ˈᢺޣ޵ᇩˈᡆ㘵৲㘳 Intel 80x86 Ⲵᴹޣࡦˈ䈖㓶䰵䈫ал䱴ᖅѝᡰᨀ׋Ⲵᴹ ᣔ⁑ᔿ䘀㹼Ⲵᵪ؍ѪҶ㜭∄䖳亪࡙ൠ⨶䀓ԕл਴ㄐ޵ᇩˈ֌㘵ᕪ࣋ᐼᵋ䈫㘵↔ᰦ㜭޽⅑༽Ґ 32 ս 䈫DŽ㤕䈫㘵ሩ޵ᆈ࠶亥㇑⨶ᵪࡦнҶ䀓ˈࡉᔪ䇞俆ݸ䰵䈫ㅜ 10 ㄐ޵ᆈ㇑⨶Ⲵ޵ᇩDŽ Ӿ䘉䟼ᔰ࿻ˈሩҾਾ㔝ㄐ㢲Ⲵ䰵䈫ˈਟԕሶ main.c 〻ᒿ֌Ѫаᶑѫ㓯䘋㹼ˈᒦн䴰㾱᤹ㄐ㢲亪ᒿ䰵 њᴰㆰঅⲴṩ᮷Ԧ㌫㔏ˈ䇙 Linux 䘀㹼䎧ᶕDŽ 㾱वਜ਼᮷Ԧ/etc/rcǃ/bin/shǃ/dev/* ԕ৺аӋⴞᖅ/etc/ǃ/dev/ǃ/bin/ǃ/home/ǃ/home/root/ ቡਟԕᶴᡀа ሩҾ 0.11 ⡸޵Ṩˈ䙊䗷к䶒ԓ⸱࠶᷀ਟ⸕ˈਚ㾱ṩ᮷Ԧ㌫㔏ᱟањ MINIX ᮷Ԧ㌫㔏ˈᒦфަѝਚ 7.3 ᵢㄖቅ㔉 sh Ⲵ൘㓯᡻޼亥ѝⲴ䈤᰾DŽ ޣ൘ᢗ㹼 shell 〻ᒿᰦਟԕᴹᖸཊ䘹亩ˈ䈧৲㿱 Linux ㌫㔏ѝⲴᴹ ѝ䈫ਆભԔDŽޕࡉ shell 〻ᒿሶӾަḷ߶䗃 ⴻ֌ᱟањ㝊ᵜ᮷Ԧ਽ᒦᢗ㹼ަѝⲴભԔˈ㘼ަ։Ⲵ৲ᮠࡉ㻛ⴻ֌ᱟ shell Ⲵս㖞৲ᮠ˄$1ǃ$2 ㅹ˅DŽ੖ ൘ᢗ㹼 shell ᰦˈ䲔ҶаӋᤷᇊⲴਟ䘹亩ԕཆˈྲ᷌䘈ᤷᇊҶભԔ㹼৲ᮠˈࡉ shell Պᢺㅜањ৲ᮠ ENV=$HOME/.anyfilename; export ENV Ⲵ.profile ᮷Ԧѝ˖ 㾱ᢗ㹼ⲴભԔ᭮൘ ENV ਈ䟿ᤷᇊⲴ᮷ԦѝDŽ䇮㖞 ENV ⧟ຳਈ䟿Ⲵᯩ⌅ᱟᢺлࡇ䈝ਕ᭮൘֐䎧࿻ⴞᖅ ਆભԔᒦᢗ㹼DŽഐ↔⭘ᡧᓄ䈕ᢺ⇿⅑ⲫᖅᰦ䜭㾱ᢗ㹼ⲴભԔ᭮൘.profile ᮷Ԧѝˈ㘼ᢺ⇿⅑䘀㹼 shell 䜭 ⧟ຳਈ䟿ˈᡆ㘵൘ⲫᖅ shell Ⲵ.profile ᮷Ԧѝ䇮㖞Ҷ䈕ਈ䟿ˈࡉ shell ла↕ՊӾ䈕ਈ䟿ભ਽Ⲵ᮷Ԧѝ䈫 shell ᰦ䇮㖞Ҷ ENV ޕݸӾ/etc/profile ᮷Ԧԕ৺.profile ᮷Ԧ˄㤕ᆈ൘Ⲵ䈍˅䈫ਆભԔᒦᢗ㹼DŽྲ᷌൘䘋 њⲫᖅ shell 㻛ᢗ㹼DŽ↔ᰦ䈕 shell 〻ᒿՊṩᦞ䈕ᆇㅖˈᢗ㹼ḀӋоⲫᖅ䗷〻⴨ᓄⲴ᫽֌DŽⲫᖅ shell Պ俆 ൘ⲫᖅ䗷〻ѝ login ᔰ࿻ᢗ㹼 shell ᰦˈᡰᑖ৲ᮠ argv[0]Ⲵㅜањᆇㅖᱟ’-’ˈ㺘⽪䈕 shell ᱟ֌Ѫа DŽޕҏਟԕ֯⭘ shell 㝊ᵜ᮷Ԧੁ shell 䀓䟺〻ᒿ䗃ˈޕ䘋㹼Ӕӂ䗃 Ⲵؑ᚟ˈ❦ਾᢗ㹼ભԔDŽ⭘ᡧਟԕ൘㓸ㄟкੁ shell ⴤ᧕ޕо䇑㇇ᵪ䘋㹼Ӕӂ᫽֌ⲴൠᯩDŽᆳ㧧ਆ⭘ᡧ䗃 shell 〻ᒿᱟањ༽ᵲⲴભԔ㹼䀓䟺〻ᒿˈᱟᖃ⭘ᡧⲫᖅ㌫㔏䘋㹼Ӕӂ᫽֌ᰦᢗ㹼Ⲵ〻ᒿDŽᆳᱟ⭘ᡧ 〻ᒿⲴаӋᢗ㹼䘹亩઼⢩↺䇯䰞䲀ࡦⲴ䈤᰾ˈ䈧৲㿱 Linux ㌫㔏ѝⲴ൘㓯᡻޼亥˄man 8 login˅DŽ   ᵜㄐሿ㔃 ㊫ᯩᔿˈӾᇎ⧠Ⲵ࣏㜭к䘋㹼ᴤ䈖㓶Ⲵ䈤᰾DŽ 䈳⭘ᴽ࣑༴⨶〻ᒿ᮷Ԧˈਖа㊫ᱟ䘋〻䈳ᓖㅹ䙊⭘࣏㜭᮷Ԧˈ৲㿱മ 8-1 മ 2-17DŽᡁԜ⧠൘ṩᦞ䘉њ࠶ 䈕ⴞᖅлⲴԓ⸱᮷ԦӾ࣏㜭кਟԕ࠶Ѫй㊫ˈа㊫ᱟ⺜Ԧ˄ᔲᑨ˅ѝᯝ༴⨶〻ᒿ᮷Ԧˈа㊫ᱟ㌫㔏 8.1 ᙱ։ࣕ㜳   P  YVSULQWIF E\WHV  P E\WHV  WUDSVF  P  V\VWHPBFDOOV E\WHV  P  V\VF E\WHV  P  VLJQDOF E\WHV  P  VFKHGF E\WHV  P  SULQWNF E\WHV  P  SDQLFF E\WHV  P  PNWLPHF E\WHV  P E\WHV  IRUNF  P  H[LWF E\WHV  P  DVPV E\WHV  P E\WHV  0DNHILOH     PDWK     FKUBGUY     EONBGUY *07  䈤᰾  ᮷Ԧ਽ བྷሿ ᴰਾ؞᭩ᰦ䰤  ࡍ㺞 8-1 linux/kernel/ⴤᖋ ㌫ᴹњབྷ㠤ⲴҶ䀓ˈ❦ਾ䙀аሩԓ⸱䘋㹼䈖㓶⌘䟺DŽޣ䘉 12 њ᮷Ԧᡰᇎ⧠Ⲵ࣏㜭઼ᆳԜѻ䰤Ⲵ⴨ӂ䈳⭘ ሩ䘉 13 њԓ⸱᮷Ԧ䘋㹼⌘䟺DŽ俆ݸᡁԜሩᡰᴹ〻ᒿⲴสᵜ࣏㜭䘋㹼ᾲᤜᙗⲴᙫփӻ㓽ˈԕׯаᔰ࿻ቡሩ 䝽㖞᮷Ԧ MakefileDŽ㿱ࡇ㺘 8-1 ᡰ⽪DŽሩަѝйњᆀⴞᖅѝԓ⸱Ⲵ⌘䟺ሶ൘ਾ㔝ㄐ㢲ѝ䘋㹼DŽᵜㄐѫ㾱 वᤜ 10 њ C 䈝䀰᮷Ԧ઼ 2 њ≷㕆䈝䀰᮷Ԧԕ৺ањ kernel л㕆䈁᮷ԦⲴ㇑⨶ޡ linux/kernel/ⴞᖅл ㅜ8ㄐ ޵Ṩԓ⸱(kernel)   ᙫփ࣏㜭 E ᑖࠪ䭉⸱ D нᑖࠪ䭉⸱ Ոݸ㓗ᰐਈॆᰦⲴᛵߥ Ոݸ㓗᭩ਈᰦⲴᛵߥ (,3  &6 ()/$*6 ࠪ䭉⸱ (,3  &6 ()/$*6 (,3  &6 ()/$*6 ৏ (63  ৏66 G ᑖࠪ䭉⸱ F нᑖࠪ䭉⸱ ࠪ䭉⸱ ੁ ᯩ ޕ ঻ (,3  &6 ()/$*6 ৏ (63  ৏ 66 ㌫ޣ䈳⭘ IRUNFV\VFH[LWFVLJQDOF V\VWHPBFDOOV ㌫㔏䈳⭘〻ᒿ WUDSVF DVPV ⺜Ԧѝᯝ〻ᒿ SLQWNYVSULQWI SDQLFF VFKHGXOHF PNWLPH 䙊⭘〻ᒿ Ḹ˄ᔲᑨѝᯝ int 8 ઼ int10 - int 14˅ˈึޕ⭡ҾᴹӋᔲᑨᕅ䎧ѝᯝᰦˈCPU ޵䜘Պӗ⭏ањࠪ䭉ԓ⸱঻ Ⲵ༴⨶ࡉሶ൘ kernel/system_call.s ѝ㔉ࠪDŽ਴њѝᯝⲴާփᇊѹ㿱ԓ⸱⌘䟺ਾަԆؑ᚟а㢲ѝⲴ䈤᰾DŽ ⺜Ԧ˄ྲᰦ䫏ǃ䭞ⴈǃ䖟ⴈǃᮠᆖॿ༴⨶ಘǃ⺜ⴈㅹ˅ࡍ࿻ॆ〻ᒿѝ༴⨶DŽLinux ㌫㔏䈳⭘ѝᯝ int128(0x80) ਨ⮉֌Ӻਾᢙݵ֯⭘DŽሩᓄҾѝᯝ᧗ࡦಘ㣟⡷਴ IRQ ਁࠪⲴ int32-int47 Ⲵ 16 њ༴⨶〻ᒿሶ࠶࡛൘਴⿽ ޜ ⮉Ⲵѝᯝ int17-int31 ⭡ Intel؍⮉ѝᯝ int0--int16 Ⲵ༴⨶ˈަ։؍ asm.s ԓ⸱᮷Ԧѫ㾱⎹৺ሩ Intel ഴ ਇ⭕ѣᯣᰬ฼ḾѣⲺ޻ᇯ ḸDŽሩҾާᴹՈݸ㓗᭩ਈᰦึḸⲴ޵ᇩ⽪᜿മ㿱മ 8-2(c)઼(d)ᡰ⽪DŽึޕᘇᇴᆈಘ EFLAGS Ⲵ޵ᇩ঻ ⭘ᡧᘱึḸҶDŽᡰԕᖃਁ⭏ѝᯝᰦˈѝᯝ༴⨶〻ᒿ֯⭘Ⲵᱟ䘋〻Ⲵ޵ṨᘱึḸDŽਖཆˈCPU 䘈ᙫᱟሶḷ ṨᘱḸDŽഐ↔䘉䟼ⴞⲴԓ⸱ⲴึḸণᱟᤷ䘋〻Ⲵ޵ṨᘱึḸˈ㘼㻛ѝᯝԓ⸱ⲴึḸᖃ❦ҏቡᱟᤷ䘋〻Ⲵ ѝᯝ〻ᒿⲴึḸѝDŽն൘޵Ṩࡍ࿻ॆᆼᡀਾˈ޵Ṩԓ⸱ᢗ㹼ᰦ֯⭘Ⲵᱟ䘋〻Ⲵ޵ޕ٬઼ึḸᤷ䪸঻⇥Ḹ ᯝԓ⸱ⲴึḸѝDŽྲ᷌Ոݸ㓗࡛ਁ⭏ҶਈॆˈֻྲӾ⭘ᡧ㓗᭩ਈࡠ޵Ṩ㌫㔏㓗ˈCPU 䘈Պሶ৏ԓ⸱Ⲵึ ࡠҶⴞⲴԓ⸱˄ѝᯝ༴⨶〻ᒿԓ⸱˅ⲴึḸкˈ㘼нᱟ㻛ѝޕ䰤䈳⭘∄䖳⴨䊑Ⲵൠᯩᱟ 80386 ሶؑ᚟঻ ḸDŽਖањо⇥ึޕ٬঻〫ٿDŽCPU Պሶԓ⸱⇥䘹ᤙㅖ઼䘄എൠ൰Ⲵۿ䈳⭘˄⇥䰤ᆀ〻ᒿ䈳⭘˅∄䖳⴨ ѝᯝ༴⨶〻ᒿⲴึḸѝˈণ䘋〻Ⲵ޵ṨᘱḸѝˈ㿱മ 8-2(a)ᡰ⽪DŽ䘉⿽ᛵߥоањ䘌ޕ઼ EIP˅Ⲵؑ᚟঻ ൘⭘ᡧ〻ᒿ˄䘋〻˅ሶ᧗ࡦᵳӔ㔉ѝᯝ༴⨶〻ᒿѻࡽˈCPU Պ俆ݸሶ㠣ቁ 12 ᆇ㢲˄EFLAGSǃCS 㜭䈧৲㿱മ 5-21DŽ PC ᵪѝ 8259A ਟ㕆〻ѝᯝ᧗ࡦ㣟⡷Ⲵ䘎᧕৺ަ࣏ ޣ〻ᒿ൘᮷Ԧ system_call.s ઼ mm/page.s ѝᇎ⧠DŽᴹ 䈝䀰༴⨶䗷〻DŽ㘼 traps.c 〻ᒿࡉᇎ⧠Ҷ asm.s Ⲵѝᯝ༴⨶䗷〻ѝ䈳⭘Ⲵ c ࠭ᮠDŽਖཆࠐњ⺜Ԧѝᯝ༴⨶ ѫ㾱वᤜєњԓ⸱᮷Ԧ˖asm.s ઼ traps.c ᮷ԦDŽasm.s ⭘Ҿᇎ⧠བྷ䜘࠶⺜Ԧᔲᑨᡰᕅ䎧ⲴѝᯝⲴ≷㕆 8.1.1 ѣᯣ༺⨼ぁᓅ ഴ ޻Ṯⴤᖋѣ਺ᮽԬѣ࠳ᮦⲺ䈹⭞ቸ⅗ީ㌱    ᙫփ࣏㜭  ᮠⲴ৲ᮠDŽ ᯝ䘄എൠ൰ᱟ⭘֌ & ࠭ ḸⲴࠪ䭉ԓ⸱઼ѝึ ޕWUDSVF ѝᇎ⧠DŽ঻ ⌘ ˖䈳⭘Ⲵ & ࠭ᮠ൘  ֯⭘ ⌘ ˖ᰐࠪ䭉ԓ⸱ᰦቡ ㅖ٬Ѫ [ ⌘ ˖޵Ṩԓ⸱⇥䘹ᤙ ѝᯝ䘄എ Ḹᇴᆈಘޕᕩࠪᡰᴹ ḸⲴѝᯝ䘄എൠ൰ޕᶕ ḸⲴࠪ䭉⸱઼ਾޕᕩࠪ ༴⨶࠭ᮠ & ޣ䈳⭘⴨ ԓ⸱⇥Ⲵ䘹ᤙㅖ٬ ᡰᴹ⇥ᇴᆈಘ㖞Ѫ޵Ṩ Ḹޕ!ѝᯝ䘄എൠ൰ Ḹޕ!ࠪ䭉ԓ⸱ ḸDŽޕᡰᴹᇴᆈಘ 䘉Ӌ〻ᒿवᤜ schedule.cǃmktime.cǃpanic.cǃprintk.c ઼ vsprintf.cDŽ 8.1.3 ެԌ䙐⭞㊱ぁᓅ 㘼 sys_pause()ǃsys_execve()ࡉᱟḀњ㌫㔏䈳⭘у⭘Ⲵ C ༴⨶࠭ᮠDŽ ᮠࡉᱟᤷᇊⲴ㌫㔏䈳⭘Ⲵу⭘༴⨶࠭ᮠDŽֻྲˈdo_signal()࠭ᮠสᵜкᱟᡰᴹ㌫㔏䈳⭘䜭㾱ᢗ㹼Ⲵ࠭ᮠˈ ᮠˈ㾱Ѹᱟ㌫㔏䈳⭘༴⨶䗷〻ѝ䙊⭘Ⲵ࠭ᮠˈ㾱ѸᱟḀњ㌫㔏䈳⭘у⭘Ⲵ˗㘼ԕ'sys_'ᔰཤⲴ㌫㔏䈳⭘࠭ ᡁԜਟԕṩᦞ䘉Ӌ࠭ᮠⲴㆰঅભ਽㿴ࡉ䘉ṧᶕ⨶䀓˖䙊ᑨԕ'do_'ᔰཤⲴѝᯝ༴⨶䗷〻ѝ䈳⭘Ⲵ C ࠭ signal.c ѝⲴ 4 њ㌫㔏䈳⭘࠭ᮠ˅DŽ 䴰䈳⭘Ⲵ༴⨶࠭ᮠˈᴹӋᱟ֯⭘≷㕆䈝䀰ᇎ⧠Ⲵˈྲ sys_execve()˗㘼ਖཆаӋࡉ⭘ C 䈝䀰ᇎ⧠˄ֻྲ sys.c ઼ exit.c 〻ᒿᇎ⧠ҶަԆаӋ sys_xxx()㌫㔏䈳⭘࠭ᮠDŽ䘉Ӌ sys_xxx()࠭ᮠ䜭ᱟ⴨ᓄ㌫㔏䈳⭘ᡰ 㔏䈳⭘ sys_xxx()࠭ᮠDŽ 䘋〻ؑਧⲴ࠭ᮠ do_signal()ˈ൘㌫㔏䈳⭘ѝᯝ༴⨶䗷〻ѝ㻛䈳⭘DŽਖཆ䘈वᤜ 4 њ㌫ޣᨀ׋ањ༴⨶ᴹ ׋ C ༴⨶࠭ᮠDŽfork.c 〻ᒿᨀ׋єњ C ༴⨶࠭ᮠ˖find_empty_process()઼ copy_process()DŽsignal.c 〻ᒿ䘈 ѝᯝ䘋㹼༴⨶DŽ㘼 fork.c ઼ signal.c ѝⲴањ࠭ᮠࡉ㊫լҾ traps.c 〻ᒿⲴ֌⭘ˈᆳԜѪ㌫㔏ѝᯝ䈳⭘ᨀ system_call.s 〻ᒿⲴ֌⭘㊫լҾ⺜Ԧѝᯝ༴⨶ѝ asm.s 〻ᒿⲴ֌⭘ˈਖཆ䘈ሩᰦ䫏ѝᯝ઼⺜ⴈǃ䖟ⴈ ᮷Ԧवᤜ system_call.sǃfork.cǃsignal.cǃsys.c ઼ exit.c ᮷ԦDŽޣ 㾱ᑖ৲ᮠˈࡉ ebxǃecx ઼ edx ⭘Ҿᆈ᭮䈳⭘৲ᮠDŽഐ↔䈕ѝᯝ䈳⭘㻛〠Ѫ㌫㔏䈳⭘DŽᇎ⧠㌫㔏䈳⭘Ⲵ⴨ Linux ѝᓄ⭘〻ᒿ䈳⭘޵ṨⲴ࣏㜭ᱟ䙊䗷ѝᯝ䈳⭘ int 0x80 䘋㹼Ⲵˈᇴᆈಘ eax ѝ᭮䈳⭘ਧˈྲ᷌䴰 8.1.2 ㌱㔕䈹⭞༺⨼⴮ީぁᓅ ഴ ⺢Ԭᔸᑮδ᭻䳒Ƚ䲭䱧εᡶᕋ䎭Ⲻѣᯣ༺⨼⍷ぁ ሩањ⺜Ԧᔲᑨᡰᕅ䎧ⲴѝᯝⲴ༴⨶䗷〻㿱മ 8-3 ᡰ⽪DŽ asm.s 〻ᒿѝՊṩᦞᱟ੖ᩪᑖࠪ䭉ԓ⸱㘼ᢺѝᯝ࠶ᡀє㊫࠶࡛䘋㹼༴⨶DŽն༴⨶⍱〻䘈ᱟаṧⲴDŽ 㿱മ 8-2 (b)ᡰ⽪ˈ㘼ަԆⲴѝᯝতᒦнᑖᴹ䘉њࠪ䭉ԓ⸱˄ֻྲ㻛䴦䲔ࠪ䭉઼䗩⭼Ựḕࠪ䭉ㅹ˅ˈഐ↔ˈ   ᙫփ࣏㜭 ˈV˄ᡆ#˅ᱟ㠚ࣘⴞḷਈ䟿 ৫ᦹF 㘼࣐кV ਾ㔰DŽR㺘⽪ަਾᱟ䗃ࠪ᮷ԦⲴ਽〠DŽަѝ Ⲵ਴њ & ᮷ԦሩᓄⲴ≷㕆ԓ⸱᮷ԦDŽ唈䇔ᛵߥлᡰӗ⭏Ⲵ≷㕆〻ᒿ᮷Ԧ਽ᱟ৏ & ᮷Ԧ਽ޕ䗃 Ӿ㘼ӗ⭏оˈ˅6˄→ڌᤷ֯ JFF 䟷⭘ &)/$*6 ᡰᤷᇊⲴ䘹亩ሩ & ԓ⸱㕆䈁ਾн䘋㹼≷㕆ቡ л䶒Ⲵ㿴ࡉᤷ⽪ PDNH ࡙⭘л䶒ⲴભԔሶᡰᴹⲴF ᮷Ԧ㕆䈁⭏ᡀV ≷㕆〻ᒿDŽ䈕㿴ࡉⲴભԔ  ࠪ䇮༷ᡆᤷᇊⲴ䗃ࠪ᮷Ԧѝ˗QRVWGLQF,LQFOXGH ਼ࡽDŽ & ࡽ༴⨶䘹亩DŽ( ਚ䘀㹼 & ࡽ༴⨶ˈሩᡰᴹᤷᇊⲴ & 〻ᒿ䘋㹼亴༴⨶ᒦሶ༴⨶㔃᷌䗃ࠪࡠḷ߶䗃 &33 JFF(QRVWGLQF,LQFOXGH LQFOXGH DŽ QRVWGLQF,LQFOXGH н֯⭘唈䇔䐟ᖴѝⲴवਜ਼᮷Ԧˈ㘼֯⭘䘉䟼ᤷᇊⴞᖅѝⲴ 䈳⭘〻ᒿѝ˗PVWULQJLQVQV/LQXV 㠚ᐡປ࣐ⲴՈॆ䘹亩ˈԕਾн޽֯⭘˗ޕঅ⸝ሿⲴ࠭ᮠԓ⸱፼ ⲴṶᷦᤷ䪸˗IFRPELQHUHJV ਸᒦᇴᆈಘˈ߿ቁᇴᆈಘ㊫Ⲵ֯⭘˗ILQOLQHIXQFWLRQV ሶᡰᴹㆰ ᆈнᗵ㾱؍IVWUHQJWKUHGXFH Ոॆᗚ⧟ᢗ㹼ԓ⸱ˈᧂ䲔䟽༽ਈ䟿˗IRPLWIUDPHSRLQWHU ⴱ⮕ & 㕆䈁〻ᒿ䘹亩DŽ:DOO ᱮ⽪ᡰᴹⲴ䆖੺ؑ᚟˗2 Ոॆ䘹亩ˈՈॆԓ⸱䮯ᓖ઼ᢗ㹼ᰦ䰤˗ ILQOLQHIXQFWLRQVPVWULQJLQVQVQRVWGLQF,LQFOXGH &)/$*6 :DOO2IVWUHQJWKUHGXFHIRPLWIUDPHSRLQWHUIFRPELQHUHJV? && JFF*18& 䈝䀰㕆䈁ಘDŽ /')/$*6 V[䘎᧕〻ᒿᡰᴹⲴ৲ᮠˈV 䗃ࠪ᮷Ԧѝⴱ⮕ᡰᴹㅖਧؑ᚟DŽ[ ࡐ䲔ᡰᴹተ䜘ㅖਧDŽ /' JOG*18 Ⲵ䘎᧕〻ᒿDŽ $6 JDV*18 Ⲵ≷㕆〻ᒿDŽ $5 JDU*18 ⲴҼ䘋ࡦ᮷Ԧ༴⨶〻ᒿˈ⭘Ҿࡋᔪǃ؞᭩ԕ৺Ӿᖂẓ᮷Ԧѝᣭਆ᮷ԦDŽ   /LQX[ ᴰࡍⲴ਽ᆇਛ )5($;ˈਾᶕ㻛 IWSIXQHWIL Ⲵ㇑⨶ઈ᭩ᡀ /LQX[ 䘉њ਽ᆇ  ㌫ؑ᚟᭮൘䘉䟼ˈ䲔䶎ᱟ⢩࡛᮷ԦⲴ˄ҏণнᱟањF ᮷ԦⲴؑ᚟˅DŽޣ׍䎆 㠚ࣘ䘋㹼ⲴˈᆳҏՊ㠚ࣘ৫䲔৏ᶕⲴ׍䎆ؑ᚟DŽн㾱ᢺ֐㠚ᐡⲴ PDNHGHS ㌫ᱟ⭡ޣ⌘᜿ʽ׍䎆  )5($; ޵ṨⲴ 0DNHILOH ᮷ԦDŽ   LHQRWDFILOH VVRPHWKLQJVSHFLDO XQOHVVLW 7SXW\RXURZQGHSHQGHQFLHVKHUH UHPRYHVDQ\ROGGHSHQGHQFLHV'21 ZKLFKDOVR PDNHGHS 1RWH'HSHQGHQFLHVDUHGRQHDXWRPDJLFDOO\E\  0DNHILOHIRUWKH)5($;NHUQHO   ぁᓅ 8-1 linux/kernel/Makefile 8.2.2 ᮽԬ⌞䠀 䟺DŽ⌘ޣ䈕᮷ԦⲴ㓴ᡀṬᔿоㅜ 5 ㄐѝࡇࠪⲴ Makefile Ⲵสᵜ⴨਼ˈ൘䰵䈫ᰦਟԕ৲㘳〻ᒿ 5-1 ѝⲴᴹ 䈕᮷Ԧᱟ㕆䈁 linux/kernel/ⴞᖅл〻ᒿⲴ make 䝽㖞᮷Ԧˈнवᤜ㕆䈁ަѝйњᆀⴞᖅ〻ᒿⲴ䝽㖞DŽ 8.2.1 ࣕ㜳ㆶԁ 8.2 Makefile ᮽԬ ᱟ޵Ṩᱮ⽪ؑ᚟Ⲵ᭟ᤱ〻ᒿˈᇎ⧠Ҷ޵Ṩу⭘ᱮ⽪࠭ᮠ printk()઼ᆇㅖѢṬᔿॆ䗃ࠪ࠭ᮠ vsprintf()DŽ ᵪDŽprintk.c ઼ vsprintf.cڌpanic.c ѝवਜ਼ањ panic()࠭ᮠˈ⭘Ҿ൘޵Ṩ䘀㹼ࠪ⧠䭉䈟ᰦᱮ⽪ࠪ䭉ؑ᚟ᒦ ᰦⲴ࠭ᮠDŽmktime.c 〻ᒿѝӵवਜ਼ањ޵Ṩ֯⭘Ⲵᰦ䰤࠭ᮠ mktime()ˈӵ൘ init/main.c ѝ㻛䈳⭘а⅑DŽ ㌫㔏ᰦ䫏ѝᯝ઼䖟ⴈ傡ࣘಘᇊޣᒿˈ⭘Ҿሩ䘋〻Ⲵᢗ㹼䘋㹼࠷ᦒᡆ᭩ਈ䘋〻Ⲵᢗ㹼⣦ᘱDŽਖཆ䘈वᤜᴹ schedule.c 〻ᒿवᤜ޵Ṩ䈳⭘ᴰ仁㑱Ⲵ schedule()ǃsleep_on()઼ wakeup()࠭ᮠˈᱟ޵ṨⲴṨᗳ䈳ᓖ〻   0DNHILOH ᮷Ԧ ?LQFOXGHOLQX[KHDGKLQFOXGHOLQX[IVKLQFOXGHOLQX[PPK LQFOXGHV\VW\SHVKLQFOXGHV\VZDLWKLQFOXGHOLQX[VFKHGK? H[LWFLQFOXGHHUUQRKLQFOXGHVLJQDOK?H[LWVH[LWR 'HSHQGHQFLHV   PDNHGHSFGEONBGUY  PDNHGHS ሩ FKUBGUYⴞᖅлⲴ 0DNHILOH ᮷Ԧҏ֌਼ṧⲴ༴⨶DŽFGFKUBGUY  FSWPSBPDNH0DNHILOH GRQH !!WPSBPDNH&33 0L  ?C V?F?V GRHFKRQCHFKRL_VHGF IRULLQ  0DNHILOH!WPSBPDNH ???'HSHQGHQFLHVT VHG GHS ᮷Ԧ WPSBPDNH ѝˈ❦ਾሶ䈕Ѥᰦ᮷Ԧ༽ࡦᡀᯠⲴ 0DNHILOH ᮷ԦDŽ ㌫䈕Ⓚ᮷Ԧѝवਜ਼Ⲵᡰᴹཤ᮷Ԧࡇ㺘DŽᢺ亴༴⨶㔃᷌䜭␫࣐ࡠѤᰦޣ᮷Ԧ਽࣐кަ׍䎆 ሩҾ⇿ањⓀ᮷Ԧˈ亴༴⨶〻ᒿ䗃ࠪањ PDNH 㿴ࡉˈަ㔃᷌ᖒᔿᱟ⴨ᓄⓀ〻ᒿ᮷ԦⲴⴞḷ ᙗⲴ㿴ࡉˈᒦф䘉Ӌ㿴ࡉㅖਸ PDNH 䈝⌅DŽޣ0 ḷᘇ੺䇹亴༴⨶〻ᒿ䗃ࠪ᧿䘠⇿њⴞḷ᮷Ԧ⴨ Ѥᰦ᮷Ԧ˄ 㹼Ⲵ֌⭘˅DŽ❦ਾሩ NHUQHOⴞᖅлⲴ⇿ањ & ᮷Ԧᢗ㹼 JFF 亴༴⨶᫽֌ 㹼ਾ䶒Ⲵᡰᴹ㹼˄л䶒Ӿ  ᔰ࿻Ⲵ㹼˅ˈᒦ⭏ᡀ WPSBPDNH 'HSHQGHQFLHV ᮷Ԧѝ ֯⭘ᆇㅖѢ㕆䗁〻ᒿ VHG ሩ 0DNHILOH ᮷Ԧ˄䘉䟼ণᱟ㠚ᐡ˅䘋㹼༴⨶ˈ䗃ࠪѪࡐ䲔 0DNHILOH ㌫DŽᯩ⌅ྲл˖ޣл䶒Ⲵⴞḷᡆ㿴ࡉ⭘ҾỰḕ਴᮷Ԧѻ䰤Ⲵ׍䎆   PDNHFOHDQFGPDWK   PDNHFOHDQFGEONBGUY  FKUBGUYⴞᖅ˗ᢗ㹼䈕ⴞᖅ 0DNHILOH ѝⲴ FOHDQ 㿴ࡉDŽ ޕPDNHFOHDQ 䘋FGFKUBGUY  GRQHGRUPICEDVHQDPHLFCVF IRULLQ DWPSBPDNHNH\ERDUGV R UPIFRUH FOHDQ ᱟ᮷Ԧࡐ䲔ભԔˈ䘹亩I ਜ਼ѹᱟᘭ⮕нᆈ൘Ⲵ᮷Ԧˈᒦфнᱮ⽪ࡐ䲔ؑ᚟DŽ UP 䘎᧕⭏ᡀⲴ᮷ԦDŽ ᰦˈቡՊᢗ㹼  㹼кⲴભԔˈ৫䲔ᡰᴹ㕆䈁 PDNHFOHDQ л䶒Ⲵ㿴ࡉ⭘Ҿ␵⨶ᐕ֌DŽᖃᢗ㹼  V\QF  2%-6 /' URNHUQHOR   2%-6 NHUQHOR Ⲵⴞḷ᮷ԦDŽޕ⭘Ҿᤷ⽪⭏ᡀਟ䟽ᇊսⲴ䗃ࠪˈণӗ⭏ਟԕ֌Ѫ䬮᧕ಘ OG 䗃 U 䘹亩 ൘ᴹҶݸߣᶑԦ 2%-6 ਾ֯⭘л䶒ⲴભԔ䘎᧕ᡀⴞḷ NHUQHORDŽ  VLJQDORPNWLPHR SDQLFRSULQWNRYVSULQWIRV\VRH[LWR? 2%-6 VFKHGRV\VWHPBFDOORWUDSVRDVPRIRUNR?ᇊѹⴞḷ᮷Ԧਈ䟿 2%-6DŽ  R FR &)/$*6 ?  &&  R ⴞḷ᮷ԦDŽн䘋㹼䘎᧕DŽ F ᮷ԦÆ ㊫լк䶒ˈFR R $6 FR  VR л䶒㿴ࡉ㺘⽪ሶᡰᴹV ≷㕆〻ᒿ᮷Ԧ㕆䈁ᡀR ⴞḷ᮷ԦDŽ 㹼ᱟᇎ⧠䈕᫽֌ⲴާփભԔDŽ V 6R &)/$*6 ?  &&  FV ᱟ F ᮷Ԧˈࡉਟⴤ᧕֯⭘ㅜ  њ㿴ࡉDŽ ⭘ㅜањ㿴ࡉ˗㤕ⴞᖅᱟRˈ㘼৏᮷ԦᱟVˈࡉ֯⭘ㅜ  њ㿴ࡉ˗㤕ⴞḷᱟR ᮷Ԧ㘼৏᮷Ԧ л䶒䘉  њн਼㿴ࡉ࠶࡛⭘Ҿн਼Ⲵ᫽֌㾱≲DŽ㤕ⴞḷᱟV ᮷Ԧˈ㘼Ⓚ᮷ԦᱟF ᮷ԦࡉՊ֯ F Ⲵ᮷ԦDŽ ԓ㺘ㅜањݸߣᶑԦˈ䘉䟼ণᱟㅖਸᶑԦ   0DNHILOH ᮷Ԧ ᆈ൘ esp0ǃ؍ḸਾˈḸᤷ䪸ս㖞ᱟ esp1 ༴DŽ↔ᰦ〻ᒿ䙊䗷֯⭘єњӔᦒᤷԔ࠶࡛ᢺ eaxǃebx ᇴᆈಘⲴ٬ ޕ࣑〻ᒿѻࡽˈึḸᤷ䪸ᤷੁമѝ esp0 ༴DŽ൘ᢺሶ㾱䈳⭘Ⲵ C ࠭ᮠ do_double_fault()ᡆަԆ C ࠭ᮠൠ൰ ሩҾ CPU Պӗ⭏䭉䈟ਧⲴѝᯝ䗷〻ˈึḸᤷ䪸ս㖞ਈॆᛵߥ䈧৲➗മ 8-4(b)DŽ൘ࡊᔰ࿻ᢗ㹼ѝᯝᴽ ḸⲴᇴᆈಘѻࡽᤷ䪸䙊䗷࣐к 8 ৸എࡠ esp2 ༴DŽޕḸˈ᭮ࡠ esp3 ս㖞༴ˈᒦ൘ѝᯝ䘄എᕩࠪึޕ঻˅٬ ᆈս㖞˄ণึḸᤷ䪸 esp0؍ ᖃ↓ᔿ䈳⭘ do_divide_error()ѻࡽˈ〻ᒿՊሶᔰ࿻ᢗ㹼ѝᯝ〻ᒿᰦⲴ৏ eip ḸਾˈึḸᤷ䪸ս㖞༴Ҿ esp2 ༴DŽޕᆈࡠึḸкDŽ↔ਾ〻ᒿ൘ᢺаӋᇴᆈಘ؍ѝˈ㘼৏ᶕ eax Ⲵ٬ࡉ㻛 eax ᇴᆈಘ ޕḸਾˈᤷ䪸ս㖞ᱟ esp1 ༴,↔ᰦ〻ᒿ֯⭘ӔᦒᤷԔᢺ䈕࠭ᮠⲴൠ൰᭮ޕᡆަԆ C ࠭ᮠൠ൰ ࣑〻ᒿѻࡽˈึḸᤷ䪸 esp ᤷ൘ѝᯝ䘄എൠ൰аḿ(മѝ esp0 ༴)DŽᖃᢺሶ㾱䈳⭘Ⲵ C ࠭ᮠ do_divide_error() 4 њᆇ㢲DŽሩҾнᑖࠪ䭉ਧⲴѝᯝ䗷〻ˈึḸᤷ䪸ս㖞ਈॆᛵߥ䈧৲➗മ 8-4(a)DŽ൘ᔰ࿻ᢗ㹼⴨ᓄѝᯝᴽ ൘䰵䈫䘉⇥ԓ⸱ᰦ৲➗മ 8-4 ѝᖃࡽԫ࣑Ⲵ޵ṨึḸਈॆ⽪᜿മሶᱟᖸᴹᑞࣙⲴˈമѝ⇿њ㹼ԓ㺘 䈳⭘ traps.c ѝ⴨ᓄⲴ C ࠭ᮠ〻ᒿˈᱮ⽪ࠪ䭉ս㖞઼ࠪ䭉ਧˈ❦ਾ䘰ࠪѝᯝDŽ ㌫DŽ䈕〻ᒿⲴѫ㾱༴⨶ᯩᔿᱟ൘ѝᯝ༴⨶〻ᒿѝޣⲴᔲᑨ༴⨶DŽ䈕〻ᒿо kernel/traps.c 〻ᒿᴹ⵰ᇶ࠷Ⲵ asm.s ≷㕆〻ᒿѝवᤜབྷ䜘࠶ CPU ᧒⍻ࡠⲴᔲᑨ᭵䳌༴⨶Ⲵᓅቲԓ⸱ˈҏवᤜᮠᆖॿ༴⨶ಘ˄FPU˅ 8.3.1 ࣕ㜳ᨅ䘦 8.3 asm.s ぁᓅ  YVSULQWIFLQFOXGHVWGDUJKLQFOXGHVWULQJKYVSULQWIVYVSULQWIR LQFOXGHDVPV\VWHPKLQFOXGHDVPVHJPHQWKLQFOXGHDVPLRK LQFOXGHOLQX[PPKLQFOXGHVLJQDOKLQFOXGHOLQX[NHUQHOK? LQFOXGHOLQX[VFKHGKLQFOXGHOLQX[IVKLQFOXGHV\VW\SHVK? WUDSVFLQFOXGHVWULQJKLQFOXGHOLQX[KHDGK?WUDSVVWUDSVR LQFOXGHV\VWLPHVKLQFOXGHV\VXWVQDPHK LQFOXGHWHUPLRVKLQFOXGHOLQX[NHUQHOKLQFOXGHDVPVHJPHQWK? LQFOXGHOLQX[PPKLQFOXGHVLJQDOKLQFOXGHOLQX[WW\K? LQFOXGHOLQX[KHDGKLQFOXGHOLQX[IVKLQFOXGHV\VW\SHVK? V\VFLQFOXGHHUUQRKLQFOXGHOLQX[VFKHGK?V\VVV\VR LQFOXGHVLJQDOKLQFOXGHOLQX[NHUQHOKLQFOXGHDVPVHJPHQWK LQFOXGHOLQX[IVKLQFOXGHV\VW\SHVKLQFOXGHOLQX[PPK? VLJQDOFLQFOXGHOLQX[VFKHGKLQFOXGHOLQX[KHDGK?VLJQDOVVLJQDOR LQFOXGHDVPVHJPHQWK LQFOXGHOLQX[IGUHJKLQFOXGHDVPV\VWHPKLQFOXGHDVPLRK? LQFOXGHVLJQDOKLQFOXGHOLQX[NHUQHOKLQFOXGHOLQX[V\VK? LQFOXGHOLQX[IVKLQFOXGHV\VW\SHVKLQFOXGHOLQX[PPK? VFKHGFLQFOXGHOLQX[VFKHGKLQFOXGHOLQX[KHDGK?VFKHGVVFKHGR LQFOXGHOLQX[NHUQHOK SULQWNFLQFOXGHVWGDUJKLQFOXGHVWGGHIK?SULQWNVSULQWNR LQFOXGHOLQX[PPKLQFOXGHVLJQDOK LQFOXGHOLQX[KHDGKLQFOXGHOLQX[IVKLQFOXGHV\VW\SHVK? SDQLFFLQFOXGHOLQX[NHUQHOKLQFOXGHOLQX[VFKHGK?SDQLFVSDQLFR PNWLPHFLQFOXGHWLPHKPNWLPHVPNWLPHR LQFOXGHDVPVHJPHQWKLQFOXGHDVPV\VWHPK LQFOXGHOLQX[PPKLQFOXGHVLJQDOKLQFOXGHOLQX[NHUQHOK? LQFOXGHOLQX[KHDGKLQFOXGHOLQX[IVKLQFOXGHV\VW\SHVK? IRUNFLQFOXGHHUUQRKLQFOXGHOLQX[VFKHGK?IRUNVIRUNR LQFOXGHDVPVHJPHQWK LQFOXGHOLQX[NHUQHOKLQFOXGHOLQX[WW\KLQFOXGHWHUPLRVK?   DVPV 〻ᒿ ᆈս㖞؍ HLS HUURUBFRGH IV HV GV HES HVL HGL HG[ HF[  HE[ & ࠭ᮠൠ൰  HD[ HUURUBFRGH HLS FV ৏ HIODJV ৏HVS ৏ VV esp2  esp3 esp1 esp0 ḸⲴᛵߥޕE ѝᯝ䈳⭘ሶࠪ䭉ਧ঻ HVS   HUURUBFRGH IV HV GV HES HVL HGL HG[ HF[ ৏ HIODJV ৏HVS ৏ VV esp2  esp3 esp1 esp0 HE[  HD[ & ࠭ᮠൠ൰ HLS FV ѝᯝ䘄എൠ൰ D ѝᯝ䈳⭘⋑ᴹࠪ䭉ਧⲴᛵߥ    /LQXV7RUYDOGV &     OLQX[NHUQHODVPV     ぁᓅ 8-2 linux/kernel/asm.s 8.3.2 ԙ⸷⌞䠀 䘠Ⲵ䗷〻สᵜ㊫լDŽ ഐ↔൘䘉њ C ࠭ᮠѝቡਟԕᢃঠࠪࠪ䭉Ⲵս㖞઼䭉䈟ਧDŽ〻ᒿѝަ։ᔲᑨࠪ䭉Ⲵ༴⨶䗷〻о䘉䟼᧿ void do_divide_error(long esp, long error_code)DŽ C ࠭ᮠ do_divide_error()Ⲵ৲ᮠDŽ൘ traps.c ѝˈ䈕࠭ᮠⲴ৏ᖒѪ˖ ḸⲴ৏ഐᱟѪҶᢺࠪ䭉ԓ⸱઼ esp0 ֌Ѫ䈳⭘ޕ ↓ᔿ䈳⭘ do_divide_error()ѻࡽᢺࠪ䭉ԓ⸱ԕ৺ esp0 ഴ ࠰䭏༺⨼฼Ḿ਎ौ⽰ᝅഴ  к䘠മ 8-4(a)ѝⲴаṧDŽ esp1 ս㖞༴ˈ㘼ᢺࠪ䭉ਧӔᦒࡠ eax ᇴᆈಘѝ˗࠭ᮠൠ൰ӔᦒࡠҶ ebx ᇴᆈಘѝDŽ䲿ਾⲴ༴⨶䗷〻ࡉ઼   DVPV 〻ᒿ SRSHV SRSIV DGGOHVS HD[ FDOO Ḹ༴DŽޕ ᤷੁᇴᆈಘ IV 䇙ึḸᤷ䪸䟽ᯠˈ˅ḸⲴ٬ޕḸⲴєњ & ࠭ᮠ৲ᮠ˄ 㹼઼  㹼ึޕ᫽֌ˈᕩࠪ˄ђᔳ˅ᴰਾ  ㅹDŽㅜ  㹼ᱟሶึḸᤷ䪸࣐  ⴨ᖃҾᢗ㹼є⅑ SRS ᔲᑨⲴ & ༴⨶࠭ᮠˈֻྲ GRBGLYLGHBHUURU ਧ㺘⽪䈳⭘᫽֌ᮠᤷᇊൠ൰༴Ⲵ࠭ᮠˈ〠Ѫ䰤᧕䈳⭘DŽ䘉ਕⲴਜ਼ѹᱟ䈳⭘ᕅ䎧ᵜ⅑ л㹼кⲴ PRYG[IV PRYG[HV PRYG[GV PRYO[HG[ࡍ࿻ॆ⇥ᇴᆈಘ GVǃHV ઼ IVˈ࣐䖭޵Ṩᮠᦞ⇥䘹ᤙㅖDŽ SXVKOHG[ ḸDŽึޕHVS HG[ਆึḸѝ৏䈳⭘䘄എൠ൰༴ึḸᤷ䪸ս㖞ˈᒦ঻ OHD ḸDŽޕ֌Ѫࠪ䭉⸱  SXVKOHUURUFRGHሶᮠ٬ SXVKIV SXVKHV Ḹਾҏ㾱ঐ⭘  њᆇ㢲DŽޕSXVKGVʽʽ սⲴ⇥ᇴᆈಘ SXVKOHES SXVKOHVL SXVKOHGL SXVKOHG[ SXVKOHF[ SXVKOHE[ ḸDŽޕHVS BGRBGLYLGHBHUURU Ⲵൠ൰ÎHD[ˈHD[ 㻛Ӕᦒ [FKJOHD[ ਓ༴ˈ㿱л䶒ㅜ  㹼ㅹDŽޕ䘉䟼ᱟᰐࠪ䭉ਧ༴⨶ⲴQRBHUURUBFRGH ḸDŽޕSXVKOBGRBGLYLGHBHUURU俆ݸᢺሶ㾱䈳⭘Ⲵ࠭ᮠൠ൰ BGLYLGHBHUURU  㹼ᔰ࿻˅DŽ WUDSVF ѝᇎ⧠˄ㅜ ൘ GRBGLYLGHBHUURU 㕆䈁ਾᡰ⭏ᡀ⁑ඇѝሩᓄⲴ਽〠DŽ࠭ᮠ & 䈝䀰࠭ᮠ GRBGLYLGHBHUURU ᇎ䱵кᱟ BGRBGLYLGHBHUURU нҶањਸ⌅䲔᫽֌Ⲵ㔃᷌ᰦҏՊӗ⭏䘉њᔲᑨDŽ 㹼кḷਧ ൘ᢗ㹼 ',9 ᡆ ,',9 ᤷԔᰦˈ㤕䲔ᮠᱟ ˈ&38 ቡՊӗ⭏䘉њᔲᑨDŽᖃ ($;˄ᡆ $;ǃ$/˅ᇩ㓣 LQW༴⨶㻛䴦䲔ࠪ䭉ⲴᛵߥDŽ㊫ර˖䭉䈟˄)DXOW˅˗䭉䈟ਧ˖ᰐDŽ D DŽ  л䶒䘉⇥〻ᒿ༴⨶ᰐࠪ䭉ਧⲴᛵߥDŽ৲㿱മ  JOREOBJHQHUDOBSURWHFWLRQBFRSURFHVVRUBHUURUBLUTBUHVHUYHG JOREOBLQYDOLGB766BVHJPHQWBQRWBSUHVHQWBVWDFNBVHJPHQW JOREOBGRXEOHBIDXOWBFRSURFHVVRUBVHJPHQWBRYHUUXQ JOREOBGLYLGHBHUURUBGHEXJBQPLBLQWBRYHUIORZBERXQGVBLQYDOLGBRS ተ࠭ᮠ਽Ⲵ༠᰾ˈަ৏ᖒ൘ WUDSVF ѝ䈤᰾DŽޘԕлᱟаӋ ⮉ѝᯝ LQWLQW Ⲵ༴⨶˄LQWLQW ⮉֌Ӻਾ֯⭘˅DŽ؍ ᵜԓ⸱᮷Ԧѫ㾱⎹৺ሩ ,QWHO    ᆈᚒ༽༴⨶ˈ䘉Ӌ䘈⋑ᴹ⍻䈅䗷DŽ؍ISX ᗵ享↓⺞ൠ䘋㹼  PP ༴⨶ˈᡰԕн൘䘉䟼DŽ↔〻ᒿ䘈༴⨶˄ᐼᵋᱟ䘉ṧ˅⭡Ҿ 76ս㘼䙐ᡀⲴ ISX ᔲᑨˈഐѪ  DVPV 〻ᒿѝवᤜབྷ䜘࠶Ⲵ⺜Ԧ᭵䳌˄ᡆࠪ䭉˅༴⨶Ⲵᓅቲ⅑ԓ⸱DŽ亥ᔲᑨ⭡޵ᆈ㇑⨶〻ᒿ      WEHHQWHVWHG WKHISXPXVWEHSURSHUO\VDYHGUHVRUHG7KLVKDVQ  KRSHIXOO\ ISXH[FHSWLRQVGXHWR76ELWDV ILOHDOVRKDQGOHV  WKHUH7KLV SDJHBH[FHSWLRQLVKDQGOHGE\WKHPPVRWKDWLVQ  DVPVFRQWDLQVWKHORZOHYHOFRGHIRUPRVWKDUGZDUHIDXOWV      DVPV 〻ᒿ ᣔDŽഐѪ൘⎞⛩ᤷԔ᫽֌ᮠཚབྷᰦˈᡁԜቡᴹ䘉њᵪՊᶕ؍䈕ᔲᑨสᵜкㅹ਼Ҿॿ༴⨶ಘࠪ䭉 ਓ⛩DŽ㊫ර˖᭮ᔳ˗ᰐ䭉䈟ਧDŽޕॿ༴⨶ಘ⇥䎵ࠪࠪ䭉ѝᯝLQW  MPSQRBHUURUBFRGH SXVKOBGRBLQYDOLGBRS BLQYDOLGBRS &38ᢗ㹼ᵪᶴỰ⍻ࡠањᰐ᭸Ⲵ᫽֌⸱㘼ᕅ䎧ⲴѝᯝDŽ ਓ⛩DŽ㊫ර˖䭉䈟˗ᰐ䭉䈟ਧDŽޕLQWᰐ᭸᫽֌ᤷԔࠪ䭉ѝᯝ  MPSQRBHUURUBFRGH SXVKOBGRBERXQGV BERXQGV  њ᫽֌ᮠˈྲ᷌ㅜ  њн൘ਖཆєњѻ䰤ˈቡӗ⭏ᔲᑨ DŽ ᖃ᫽֌ᮠ൘ᴹ᭸㤳തԕཆᰦᕅਁⲴѝᯝDŽᖃ %281' ᤷԔ⍻䈅ཡ䍕ቡՊӗ⭏䈕ѝᯝDŽ%281' ᤷԔᴹ ਓ⛩DŽ㊫ර˖䭉䈟˗ᰐ䭉䈟ਧDŽޕLQW䗩⭼Ựḕࠪ䭉ѝᯝ  MPSQRBHUURUBFRGH SXVKOBGRBRYHUIORZ BRYHUIORZ ()/$*6 ѝ 2) ḷᘇ㖞սᰦ &38 ᢗ㹼 ,172 ᤷԔቡՊᕅਁ䈕ѝᯝDŽ䙊ᑨ⭘Ҿ㕆䈁ಘ䐏䑚㇇ᵟ䇑㇇ⓒࠪDŽ ਓ⛩DŽ㊫ර˖䲧䱡˗ᰐ䭉䈟ਧDŽޕLQWⓒࠪࠪ䭉༴⨶ѝᯝ  MPSQRBHUURUBFRGH SXVKOBGRBLQW BLQW ༴⨶䗷〻਼BGHEXJDŽ 㻛䈳ᔿ〻ᒿⲴԓ⸱ѝDŽޕDŽ䈕ᤷԔ䙊ᑨ⭡䈳ᔿಘᨂޣ⭡ LQWᤷԔᕅਁⲴѝᯝˈо⺜Ԧѝᯝᰐ ਓ⛩DŽ㊫ර˖䲧䱡˗ᰐ䭉䈟ਧDŽޕLQWᯝ⛩ᤷԔᕅ䎧ѝᯝⲴ  MPSQRBHUURUBFRGH SXVKOBGRBQPL BQPL ᖃ &38 ᭦ࡠањ10,ؑਧᒦфᔰ࿻ᢗ㹼ަѝᯝ༴⨶䗷〻ᰦˈ䲿ਾᡰᴹⲴ⺜Ԧѝᯝ䜭ሶ㻛ᘭ⮕DŽ ⮉ѪᶱѪ䟽㾱Ⲵ⺜ԦһԦ֯⭘DŽ؍ੁ䟿 ˈᒦᢗ㹼ḷ߶ѝᯝᓄㆄઘᵏˈഐ↔ᖸ㢲ⴱᰦ䰤DŽ10, 䙊ᑨ 䘉ᱟӵᴹⲴ㻛䍻Ҹപᇊѝᯝੁ䟿Ⲵ⺜ԦѝᯝDŽ⇿ᖃ᧕᭦ࡠањ 10, ؑਧˈ&38 ޵䜘ቡՊӗ⭏ѝᯝ ਓ⛩DŽ㊫ර˖䲧䱡˗ᰐ䭉䈟ਧDŽޕLQW䶎ቿ㭭ѝᯝ䈳⭘  MPSQRBHUURUBFRGH ḸDŽԕл਼DŽޕSXVKOBGRBLQWBGRBGHEXJ& ࠭ᮠᤷ䪸 BGHEXJ ᔰ੟ҶᤷԔ䐏䑚䲧䱡ᡆԫ࣑Ӕᦒ䲧䱡ˈᡆ㘵䈳䈅ᇴᆈಘ䇯䰞ᰐ᭸˄䭉䈟˅ˈ&38 ቡՊӗ⭏䈕ᔲᑨDŽ ᖃ ()/$*6 ѝ 7) ḷᘇ㖞սᰦ㘼ᕅਁⲴѝᯝDŽᖃਁ⧠⺜Ԧᯝ⛩˄ᮠᦞ˖䲧䱡ˈԓ⸱˖䭉䈟˅˗ᡆ㘵 ਓ⛩DŽ༴⨶䗷〻਼кDŽ㊫ර˖䭉䈟䲧䱡˄)DXOW7UDS˅˗䭉䈟ਧ˖ᰐDŽޕLQWGHEXJ 䈳䈅ѝᯝ  LUHW SRSOHD[ᕩࠪ৏ᶕ HD[ ѝⲴ޵ᇩDŽ SRSOHE[ SRSOHF[ SRSOHG[ SRSOHGL SRSOHVL SRSOHES SRSGV   DVPV 〻ᒿ PRYD[IV PRYD[HV PRYD[GV PRYO[HD[㖞޵Ṩᮠᦞ⇥䘹ᤙㅖDŽ SXVKOHD[ ḸDŽޕHVS HD[RIIVHW〻ᒿ䘄എൠ൰༴ึḸᤷ䪸ս㖞٬ OHD ḸDŽޕSXVKOHD[HUURUFRGHࠪ䭉ਧ SXVKIV SXVKHV SXVKGV SXVKOHES SXVKOHVL SXVKOHGL SXVKOHG[ SXVKOHF[ ᆈ൘ึḸкDŽ؍!HE[ˈHE[ ৏ᶕⲴ٬㻛IXQFWLRQ  HVS [FKJOHE[ ᆈ൘ึḸкDŽ؍!HD[ˈHD[ ৏ᶕⲴ٬㻛HVS HUURUFRGH [FKJOHD[ HUURUBFRGH ḸDŽޕSXVKOBGRBGRXEOHBIDXOW& ࠭ᮠൠ൰ BGRXEOHBIDXOW ༴⨶ˈնҏՊ⻠ࡠᖸቁⲴᛵߥˈ&38 н㜭䘋㹼䘉ṧⲴѢ㹼༴⨶᫽֌ˈ↔ᰦቡՊᕅਁ䈕ѝᯝDŽ 䙊ᑨᖃ &38 ൘䈳⭘ࡽањᔲᑨⲴ༴⨶〻ᒿ㘼৸Ự⍻ࡠањᯠⲴᔲᑨᰦˈ䘉єњᔲᑨՊ㻛Ѣ㹼ൠ䘋㹼 LQWৼࠪ䭉᭵䳌DŽ㊫ර˖᭮ᔳ˗ᴹ䭉䈟⸱DŽ  E ˅DŽ  ᕩࠪ˄৲㿱മ Ḹˈഐ↔䘄എᰦҏ䴰㾱ሶࠪ䭉ਧึޕԕлѝᯝ൘䈳⭘ᰦ &38 Պ൘ѝᯝ䘄എൠ൰ѻਾሶࠪ䭉ਧ঻  MPSBFRSURFHVVRUBHUURUFRSURFHVVRUBHUURU ৏൘ᵜ〻ᒿѝˈ⧠ᐢ᭮ࡠ V\VWHPBFDOOV ѝDŽ SRSOHD[  Ӿѝᯝ᧗ࡦ㣟⡷ਁ䘱 (2,˄ѝᯝ㔃ᶏ˅ؑਧDŽ RXWEDO[$޽ੁ MPSI MPSI䘉єњ䐣䖜ᤷԔ䎧ᔦᰦ֌⭘DŽ  ѫѝᯝ᧗ࡦ㣟⡷ਁ䘱 (2,˄ѝᯝ㔃ᶏ˅ؑਧDŽ RXWEDO[ੁ PRYE[DO RXWEDO[) [RUEDODO SXVKOHD[ BLUT ൘㔗㔝ᢗ㹼  ⲴԫօᤷԔѻࡽˈ&38 ૽ᓄᵜѝᯝDŽ؍⺞䈕᫽֌ѫ㾱ᱟѪҶ 䈕ㄟਓˈᵜѝᯝሶ⎸䲔 &38 Ⲵ %86< ᔦ㔝ؑਧˈᒦ䟽ᯠ◰⍫  Ⲵ༴⨶ಘᢙኅ䈧≲ᕅ㝊 3(5(4DŽ 䇑㇇ᰦˈ&38 Պㅹᖵަ᫽֌ᆼᡀDŽл䶒  㹼к [) ᱟॿ༴⨶ㄟਓˈ⭘Ҿ␵ᘉ䬱ᆈಘDŽ䙊䗷߉ ᖃॿ༴⨶ಘᢗ㹼ᆼањ᫽֌ᰦቡՊਁࠪ ,54 ѝᯝؑਧˈԕ䙊⸕ &38 ᫽֌ᆼᡀDŽ ൘ᢗ㹼  [ /LQX[ 䇮㖞Ⲵᮠᆖॿ༴⨶ಘ⺜ԦѝᯝDŽ LQW  MPSQRBHUURUBFRGH SXVKOBGRBUHVHUYHG BUHVHUYHG ਓ⛩DŽޕ⮉ѝᯝⲴ؍ LQW̢ަԆ ,QWHO  MPSQRBHUURUBFRGH SXVKOBGRBFRSURFHVVRUBVHJPHQWBRYHUUXQ BFRSURFHVVRUBVHJPHQWBRYHUUXQ ᆈ䎵ࠪᮠᦞ⇥Ⲵ⎞⛩٬DŽ؍࣐䖭ᡆ   DVPV 〻ᒿ ⮉ѝᯝੁ䟿ާփਜ਼ѹⲴ䈤᰾ˈ㿱㺘 8–1 ᡰ⽪DŽ؍ 䘉䟼㔉ࠪҶ Intel 8.3.3.1 Intel ؓ⮏ѣᯣੇ䠅Ⲻᇐѿ 8.3.3 ެԌؗᚥ  ㌫㔏䈳⭘ LQW[˄BV\VWHPBFDOO˅൘ NHUQHOV\VWHPBFDOOVˈ 㹼DŽ ᰦ䫏ѝᯝ LQW[˄BWLPHUBLQWHUUXSW˅൘ NHUQHOV\VWHPBFDOOVˈ 㹼DŽ LQWॿ༴⨶ಘ䭉䈟˄BFRSURFHVVRUBHUURU˅൘ NHUQHOV\VWHPBFDOOVˈ 㹼DŽ LQW亥䭉䈟˄BSDJHBIDXOW˅൘ PPSDJHVˈ 㹼DŽ LQW䇮༷нᆈ൘˄BGHYLFHBQRWBDYDLODEOH˅൘ NHUQHOV\VWHPBFDOOVˈ 㹼DŽ  MPSHUURUBFRGH SXVKOBGRBJHQHUDOBSURWHFWLRQ BJHQHUDOBSURWHFWLRQ Պᖂࡠ↔㊫DŽ 㺘᰾ᱟн኎ҾԫօަԆ㊫Ⲵ䭉䈟DŽ㤕ањᔲᑨӗ⭏ᰦ⋑ᴹሩᓄⲴ༴⨶ੁ䟿˄˅ˈ䙊ᑨቡ ᣔᙗࠪ䭉DŽ㊫ර˖䭉䈟˗ᴹࠪ䭉⸱DŽ؍LQWа㡜  MPSHUURUBFRGH SXVKOBGRBVWDFNBVHJPHQW BVWDFNBVHJPHQW ᓄ䈕Ѫ〻ᒿ࠶䝽ᴤཊⲴḸオ䰤DŽى㌫㔏ਟԕ࡙⭘䘉њᔲᑨᶕ⺞ᇊӰѸᰦ ᤷԔ᫽֌䈅മ䎵ࠪึḸ⇥㤳തˈᡆ㘵ึḸ⇥н൘޵ᆈѝDŽ䘉ᱟᔲᑨ  ઼  Ⲵ⢩ֻDŽᴹӋ᫽֌ LQWึḸ⇥䭉䈟DŽ㊫ර˖䭉䈟˗ᴹࠪ䭉⸱DŽ  MPSHUURUBFRGH SXVKOBGRBVHJPHQWBQRWBSUHVHQW BVHJPHQWBQRWBSUHVHQW 㻛ᕅ⭘Ⲵ⇥н൘޵ᆈѝDŽ⇥᧿䘠ㅖѝḷᘇ⵰⇥н൘޵ᆈѝDŽ LQW⇥нᆈ൘DŽ㊫ර˖䭉䈟˗ᴹࠪ䭉⸱DŽ  MPSHUURUBFRGH SXVKOBGRBLQYDOLGB766 BLQYDOLGB766 ਾⲴᯠԫ࣑ѝӗ⭏ᵜᔲᑨDŽ 䮯ᓖ䎵䗷  ᆇ㢲ᰦˈ䘉њᔲᑨ൘ᖃࡽԫ࣑ѝӗ⭏ˈഐ㘼࠷ᦒ㻛㓸→DŽަԆ䰞仈ࡉՊሬ㠤൘࠷ᦒ &38 Աമ࠷ᦒࡠањ䘋〻ˈ㘼䈕䘋〻Ⲵ 766 ᰐ᭸DŽṩᦞ 766 ѝଚа䜘࠶ᕅ䎧Ҷᔲᑨˈᖃ⭡Ҿ 766 766 DŽ㊫ර˖䭉䈟˗ᴹࠪ䭉⸱DŽ LQWᰐ᭸Ⲵԫ࣑⣦ᘱ⇥  LUHW SRSOHD[ SRSOHE[ SRSOHF[ SRSOHG[ SRSOHGL SRSOHVL SRSOHES SRSGV SRSHV SRSIV ḸⲴ  њ⭘֌ & ࠭ᮠⲴ৲ᮠDŽޕDGGOHVSђᔳ ḸDŽޕHE[䰤᧕䈳⭘ˈ䈳⭘⴨ᓄⲴ & ࠭ᮠˈަ৲ᮠᐢ FDOO   DVPV 〻ᒿ OLQX[NHUQHOWUDSVF     ぁᓅ 8-3 linux/kernel/traps.c 8.4.2 ԙ⸷⌞䠀 㿱ᵜ〻ᒿࡇ㺘ਾⲴ䈤᰾DŽ ᔿ≷㕆䈝ਕⲴสᵜ䈝⌅䈧ޕ፼ޣⲴ≷㕆䈝ਕDŽᴹޕӾᵜ〻ᒿᔰ࿻ˈᡁԜՊ䙷ࡠᖸཊ C 䈝䀰〻ᒿѝ፼ 䱡䰘˅ˈᒦ䇮㖞ݱ䇨ѝᯝ䈧≲ؑਧⲴࡠᶕDŽ൘䰵䈫ᵜ〻ᒿᰦ䴰㾱৲㘳 asm.s 〻ᒿDŽ 㘼ԓ⸱ᴰਾⲴࡍ࿻ॆ࠭ᮠ trap_init()ᱟ൘ࡽ䶒 init/main.c ѝ㻛䈳⭘ˈ⭘Ҿࡍ࿻ॆ⺜Ԧᔲᑨ༴⨶ѝᯝੁ䟿˄䲧 ⭘Ҿᱮ⽪ࠪ䭉ս㖞઼ࠪ䭉ਧㅹ䈳䈅ؑ᚟DŽަѝⲴ die()䙊⭘࠭ᮠ⭘Ҿ൘ѝᯝ༴⨶ѝᱮ⽪䈖㓶Ⲵࠪ䭉ؑ᚟ˈ traps.c 〻ᒿѫ㾱वᤜаӋ൘༴⨶ᔲᑨ᭵䳌˄⺜Ԧѝᯝ˅ᓅቲԓ⸱ asm.s ᮷Ԧѝ䈳⭘Ⲵ⴨ᓄ C ࠭ᮠDŽ 8.4.1 ࣕ㜳ᨅ䘦 8.4 traps.c ぁᓅ  &RSURFHVVRUHUURU ᭵䳌 6,*)3( ॿ༴⨶ಘਁࠪⲴࠪ䭉ؑਧᕅ䎧DŽ     5HVHUYHG  3DJHIDXOW ᭵䳌 6,*6(*9 亥н൘޵ᆈDŽ ᣔᵪࡦ˄⢩ᵳ㓗˅Ⲵ᫽֌ᕅ䎧DŽ؍   *HQHUDOSURWHFWLRQ ᭵䳌 6,*6(*9 ⋑ᴹㅖਸ  6WDFNVHJPHQW ᭵䳌 6,*%86 ึḸ⇥нᆈ൘ᡆራ൰䎺ࠪึḸ⇥DŽ  6HJPHQWQRWSUHVHQW ᭵䳌 6,*%86 ᧿䘠ㅖᡰᤷⲴ⇥нᆈ൘DŽ  ,QYDOLG766 ᭵䳌 6,*6(*9 &38 ࠷ᦒᰦਁ㿹 766 ᰐ᭸DŽ ᔲᑨѝ→ 6,*)3( ॿ༴⨶ಘ⇥䎵ࠪDŽ RYHUUXQ  &RSURFHVVRUVHJPHQW  'RXEOHIDXOW ᔲᑨѝ→ 6,*6(*9 ৼ᭵䳌ࠪ䭉DŽ ⨶ಘⲴ⣦ᘱDŽ ԔDŽ൘䘉⿽ᛵߥлˈ༴⨶〻ᒿ൘ᗵ㾱ᰦᓄ䈕ᴤᯠॿ༴ ઼ 76 䜭൘㖞ս⣦ᘱᰦˈ&38 䙷ࡠ :$,7 ᡆањ䖜᜿ᤷ E 03 ⿽ᛵߥл༴⨶〻ᒿᓄ䈕⁑ᤏሬ㠤ᔲᑨⲴᤷԔDŽ D &38 䙷ࡠањ䖜᜿ᤷԔᒦф (0 㖞սᰦDŽ൘䘉 ᯝ˖  'HYLFHQRWDYDLODEOH ᭵䳌 6,*6(*9 䇮༷нᆈ൘ˈᤷॿ༴⨶ಘDŽ൘є⿽ᛵߥлՊӗ⭏䈕ѝ  ,QYDOLG2SFRGH ᭵䳌 6,*,// &38 ᢗ㹼ᰦਁ⧠ањᰐ᭸ⲴᤷԔ᫽֌⸱DŽ  %RXQGVFKHFN ᭵䳌 6,*6(*9 ራ൰ࡠᴹ᭸ൠ൰ԕཆᰦᕅ䎧DŽ  2YHUIORZ 䲧䱡 6,*6(*9 HIODJV Ⲵⓒࠪḷᘇ 2) ᕅ䎧DŽ  %UHDNSRLQW 䲧䱡 6,*75$3 ⭡ᯝ⛩ᤷԔ LQW ӗ⭏ˈо GHEXJ ༴⨶⴨਼DŽ  QPL ⺜Ԧ  ⭡нਟቿ㭭ѝᯝ 10, ӗ⭏DŽ HIODJVⲴ7ḷᘇᰦӗ⭏䘉њѝᯝDŽ 6,*75$3 ᖃ䘋㹼〻ᒿঅ↕䐏䑚䈳䈅ᰦˈ䇮㖞Ҷḷᘇᇴᆈಘ ᭵䳌  'HEXJ 䲧䱡  'HYLGHHUURU ᭵䳌 6,*)3( ᖃ䘋㹼䲔ԕ䴦Ⲵ᫽֌ᰦӗ⭏DŽ ѝᯝਧ ਽〠 ㊫ර ؑਧ 䈤᰾ 㺞 ̢,QWHO ؓ⮏Ⲻѣᯣਭ੡ѿ   WUDSVF 〻ᒿ   `BBUHV ?  BBUHV  DPRYIVD[ BBDVPBB ?UHJLVWHUXQVLJQHGVKRUWBBUHV ^?  GHILQHBIV BBUHV DŽ 䗃ࠪ˖HD[ 䘹ᤙㅖ˅DŽ˄ਆ IV ⇥ᇴᆈಘⲴ٬   `BBUHV ? DGGU VHJ P  BBUHV  D SRSIV?HD[PRYOIVPRYD[IVSXVKIV BBDVPBB ?UHJLVWHUXQVLJQHGORQJBBUHV ^?  VHJDGGU GHILQHJHWBVHJBORQJ DGGU DŽ VHJ ˗޵ᆈൠ൰ HD[˖ޕBBUHV ˗䗃 䗃ࠪ˖HD[ ৲ᮠ˖VHJ⇥䘹ᤙㅖ˗DGGU⇥޵ᤷᇊൠ൰DŽ ਆ⇥ VHJ ѝൠ൰ DGGU ༴Ⲵањ䮯ᆇ˄ ᆇ㢲˅DŽ   `BBUHV ? DGGU VHJ P  BBUHV  D SRSIV?DOPRYEIVPRYD[IVSXVKIV BBDVPBB ?UHJLVWHUFKDUBBUHV ^?  VHJDGGU GHILQHJHWBVHJBE\WH DGGU DŽ VHJ ˗޵ᆈൠ൰ HD[˖ޕBBUHV ˗䗃 䗃ࠪ˖HD[ ৲ᮠ˖VHJ⇥䘹ᤙㅖ˗DGGU⇥޵ᤷᇊൠ൰DŽ ਆ⇥ VHJ ѝൠ൰ DGGU ༴Ⲵањᆇ㢲DŽ āDŽ D[ ྲ᷌ᜣᤷᇊᇴᆈಘ˄ֻྲ HD[˅ˈ䛓ѸᡁԜਟԕᢺ䈕ਕ߉ᡀĀUHJLVWHUFKDUBBUHVDVP ᆈ൘ањᇴᆈಘѝˈԕׯҾᘛ䙏䇯䰞઼᫽֌DŽ؍ㅜ  㹼ᇊѹҶањᇴᆈಘਈ䟿BBUHVDŽ䈕ਈ䟿ሶ㻛 ⭘ശᤜਧᤜտⲴ㓴ਸ䈝ਕ˄㣡ᤜਧѝⲴ䈝ਕ˅ਟԕ֌Ѫ㺘䗮ᔿ֯⭘ˈަѝᴰਾⲴBBUHV ᱟަ䗃ࠪ٬DŽ ᔿ≷㕆Ⲵสᵜ䈝⌅㿱ᵜ〻ᒿࡇ㺘ਾⲴ䈤᰾DŽޕ፼ޣᔿ≷㕆ᆿ䈝ਕ࠭ᮠDŽᴹޕԕл䈝ਕᇊѹҶйњ፼  䗃ࠪᆿ≷㕆䈝ਕDŽޕ䗃ࠪཤ᮷ԦDŽᇊѹ⺜Ԧㄟਓ䗃ޕDVPLRK!䗃LQFOXGH ᔿ≷㕆࠭ᮠDŽޕᇴᆈಘ᫽֌Ⲵ፼⇥ޣDVPVHJPHQWK!⇥᫽֌ཤ᮷ԦDŽᇊѹҶᴹLQFOXGH ᔿ≷㕆ᆿDŽޕDVPV\VWHPK!㌫㔏ཤ᮷ԦDŽᇊѹҶ䇮㖞ᡆ؞᭩᧿䘠ㅖѝᯝ䰘ㅹⲴ፼LQFOXGH OLQX[NHUQHOK!޵Ṩཤ᮷ԦDŽਜ਼ᴹаӋ޵Ṩᑨ⭘࠭ᮠⲴ৏ᖒᇊѹDŽLQFOXGH ᔿ≷㕆࠭ᮠᆿ䈝ਕDŽޕ䘠ㅖ৲ᮠ䇮㖞઼㧧ਆⲴ፼᧿ޣ䘈ᴹаӋᴹ OLQX[VFKHGK!䈳ᓖ〻ᒿཤ᮷ԦˈᇊѹҶԫ࣑㔃ᶴ WDVNBVWUXFWǃࡍ࿻ԫ࣑  ⲴᮠᦞˈLQFOXGH OLQX[KHDGK!KHDG ཤ᮷ԦˈᇊѹҶ⇥᧿䘠ㅖⲴㆰঅ㔃ᶴˈ઼ࠐњ䘹ᤙㅖᑨ䟿DŽLQFOXGH  ࠭ᮠDŽޕ޵ᆈᡆᆇㅖѢ᫽֌Ⲵ፼ޣVWULQJK!ᆇㅖѢཤ᮷ԦDŽѫ㾱ᇊѹҶаӋᴹLQFOXGH   ԕਾሶᢙኅ⭘ᶕᵰ↫䚝ᦏൿⲴ䘋〻˄ѫ㾱ᱟ䙊䗷ਁ䘱ањؑਧˈնྲ᷌ᗵ㾱ҏՊⴤ᧕ᵰ↫˅DŽ  ᆈҶаӋ⣦ᘱਾˈᵜ〻ᒿ⭘ᶕ༴⨶⺜Ԧ䲧䱡઼᭵䳌DŽⴞࡽѫ㾱⭘Ҿ䈳䈅ⴞⲴˈ؍൘〻ᒿ DVPV ѝ       EXWSRVVLEO\E\NLOOLQJLWRXWULJKWLIQHFHVVDU\  SUREDEO\E\JLYLQJLWDVLJQDO WRPDLQO\NLOOWKHRIIHQGLQJSURFHVV  &XUUHQWO\PRVWO\DGHEXJJLQJDLGZLOOEHH[WHQGHG DVPV VWDWHLQ  KDQGOHVKDUGZDUHWUDSVDQGIDXOWVDIWHUZHKDYHVDYHGVRPH 7UDSVF        /LQXV7RUYDOGV &       WUDSVF 〻ᒿ  L G?Q?UFXUUHQW!SLG[IIIIGSURFHVVQU3LG SULQWN ˅DŽਆᖃࡽ䘀㹼ԫ࣑Ⲵԫ࣑ਧ˄LQFOXGHOLQX[VFKHGK L VWU `  ?Q SULQWN  HVS>@ ORQJ [L SJHWBVHJBORQJ SULQWN  LL L IRU  6WDFN SULQWN HVS>@ [ ^ LI  [ FXUUHQW!OGW>@ JHWBOLPLW S?QJHWBEDVHSOLPLWEDVH SULQWN  [?QBIVIV SULQWN  HVS>@HVS>@HVS>@HVS>@HVS>@ S?Q?W[?WS?Q(63S?Q()/$*6?W[(,3 SULQWN S?QHVS>@ᱟ৏ VVˈHVS>@ᱟ৏ HVS?W[ (63  ?WSHVS>@ᱟ HIODJV ()/$*6  S?QHVS>@ᱟ⇥䘹ᤙㅖ˄FV˅ˈHVS>@ᱟ HLS?W[ (,3  ণѪമѝⲴ HVS ս㖞DŽഐ↔ᡁԜᢺ䘉ਕ᣶࠶ᔰᶕⴻѪ˖ (63 Ⲵ٬DŽ৲➗മ ˈ䘉䟼 HVS>@(,3ǃ()/$*6 ઼ 66л㹼ᢃঠ䈝ਕᱮ⽪ᖃࡽ䈳⭘䘋〻Ⲵ &6  [IIII [?Q?UVWUQUV SULQWN  LQWL  HVSBSWU ORQJ  HVS ORQJ ^  VWUORQJHVSBSWUORQJQU FKDU VWDWLFYRLGGLH ᢃঠ  ᆇ㢲ⲴึḸ޵ᇩDŽ ⇥Ⲵส൰ǃ⇥Ⲵ䮯ᓖǃ䘋〻ਧ SLGǃԫ࣑ਧǃ ᆇ㢲ᤷԔ⸱DŽྲ᷌ึḸ൘⭘ᡧᮠᦞ⇥ˈࡉ䘈 䈕ᆀ〻ᒿ⭘ᶕᢃঠࠪ䭉ѝᯝⲴ਽〠ǃࠪ䭉ਧǃ䈳⭘〻ᒿⲴ (,3ǃ()/$*6ǃ(63ǃIV ⇥ᇴᆈಘ٬ǃ  NHUQHODVPV DŽ LQWॿ༴⨶ಘѝᯝ༴⨶ YRLG YRLGLUT NHUQHOV\VWHPBFDOOV DŽ LQW YRLG YRLGSDUDOOHOBLQWHUUXSW NHUQHODVPV DŽ LQW YRLG YRLGUHVHUYHG NHUQHOV\VWHPBFDOOV DŽ LQW YRLG YRLGFRSURFHVVRUBHUURU PPSDJHV DŽ LQW YRLG YRLGSDJHBIDXOW NHUQHODVPV DŽ LQW YRLG YRLGJHQHUDOBSURWHFWLRQ  DŽNHUQHODVPV LQW YRLG YRLGVWDFNBVHJPHQW NHUQHODVPV DŽ LQW YRLG YRLGVHJPHQWBQRWBSUHVHQW NHUQHODVPV DŽ LQW YRLG YRLGLQYDOLGB766 NHUQHODVPV DŽ LQW YRLG YRLGFRSURFHVVRUBVHJPHQWBRYHUUXQ  DŽNHUQHODVPV LQW YRLG YRLGGRXEOHBIDXOW NHUQHOV\VWHPBFDOOV DŽ LQW YRLG YRLGGHYLFHBQRWBDYDLODEOH NHUQHODVPV DŽ LQW YRLG YRLGLQYDOLGBRS  DŽNHUQHODVPV LQW YRLG YRLGERXQGV NHUQHODVPV DŽ LQW YRLG YRLGRYHUIORZ NHUQHODVPV DŽ LQW YRLG YRLGLQW NHUQHODVPV DŽ LQW YRLG YRLGQPL NHUQHODVPV DŽ LQW YRLG YRLGGHEXJ  DŽNHUQHODVPV LQW YRLG YRLGGLYLGHBHUURU 䘉Ӌ࠭ᮠⲴԓ⸱൘˄NHUQHODVPV ᡆ V\VWHPBFDOOV˅ѝDŽ  ѝ䇮㖞⴨ᓄѝᯝ䰘᧿䘠ㅖDŽ ԕлᇊѹҶаӋѝᯝ༴⨶〻ᒿ৏රˈ⭘Ҿ൘࠭ᮠ WUDSBLQLW   PPSDJHV 亥ᔲᑨDŽᇎ䱵ᱟ SDJHBIDXOW YRLG YRLGSDJHBH[FHSWLRQ   NHUQHOH[LWF 〻ᒿ䘰ࠪ༴⨶DŽ ORQJFRGH LQWGRBH[LW ԕлᇊѹҶаӋ࠭ᮠ৏රDŽ   WUDSVF 〻ᒿ  RYHUIORZHVSHUURUBFRGH GLH ^  ORQJHVSORQJHUURUBFRGH YRLGGRBRYHUIORZ  `  GHEXJHVSHUURUBFRGH GLH ^  ORQJHVSORQJHUURUBFRGH YRLGGRBGHEXJ  `  QPLHVSHUURUBFRGH GLH ^  ORQJHVSORQJHUURUBFRGH YRLGGRBQPL  `  [?Q?UHVS>@HVS>@HVS>@[()/$*6[&6(,3 SULQWN  GVHVIVWU ?Q?UGV?WHV?WIV?WWU?Q?U[?W[?W[?W[?Q?U SULQWN  ORQJ HVS HVLHGLHES HVL?W?WHGL?W?WHES?W?WHVS?Q?U[?W[?W[?W[?Q?U SULQWN  HD[HE[HF[HG[ HD[?W?WHE[?W?WHF[?W?WHG[?Q?U[?W[?W[?W[?Q?U SULQWN ਆԫ࣑ᇴᆈಘ٬ÎWUDŽ   WU  DVWUD[ BBDVPBB  LQWWU ^  ORQJHG[ORQJHF[ORQJHE[ORQJHD[ ORQJHESORQJHVLORQJHGL ORQJIVORQJHVORQJGV HVSORQJHUURUBFRGH ORQJ YRLGGRBLQW ḸⲴᇴᆈಘ٬DŽ৲㿱 DVPV 〻ᒿㅜ  㹼DŽึޕѝᯝਾ㻛亪ᒿ঻ޕ৲ᮠᱟ䘋  `  GLYLGHHUURUHVSHUURUBFRGH GLH ^  ORQJHVSORQJHUURUBFRGH YRLGGRBGLYLGHBHUURU  `  JHQHUDOSURWHFWLRQHVSHUURUBFRGH GLH ^  ORQJHVSORQJHUURUBFRGH YRLGGRBJHQHUDOBSURWHFWLRQ  `  GRXEOHIDXOWHVSHUURUBFRGH GLH ^  ORQJHVSORQJHUURUBFRGH YRLGGRBGRXEOHBIDXOW ԕл䘉Ӌԕ GRBᔰཤⲴ࠭ᮠᱟ DVPV ѝሩᓄѝᯝ༴⨶〻ᒿ䈳⭘Ⲵ & ࠭ᮠDŽ  `  SOD\VHJPHQWH[FHSWLRQ   GRBH[LW  ?Q?U SULQWN  HVS>@ FKDU L HVS>@ JHWBVHJBE\WH [[II SULQWN  LL L IRU   WUDSVF 〻ᒿ RYHUIORZ ઼䗩⭼ࠪ䭉ѝᯝ ERXQGV ਟԕ⭡ԫօ〻ᒿӗ⭏DŽ ᆳԜѻ䰤Ⲵѫ㾱४࡛൘Ҿࡽ㘵䇮㖞Ⲵ⢩ᵳ㓗Ѫ ˈਾ㘵ᱟ DŽഐ↔ᯝ⛩䲧䱡ѝᯝ LQWǃⓒࠪѝᯝ  䜭֯⭘Ҷѝᯝ᧿䘠ㅖ㺘 ,'7 ѝⲴ䲧䱡䰘˄7UDS*DWH˅ˈ о VHWBV\VWHPBJDWH VHWBWUDSBJDWH л䶒ᱟᔲᑨ˄䲧䱡˅ѝᯝ〻ᒿࡍ࿻ॆᆀ〻ᒿDŽ䇮㖞ᆳԜⲴѝᯝ䈳⭘䰘˄ѝᯝੁ䟿˅DŽ  `   HUURUHVSHUURUBFRGH UHVHUYHG GLH ^  ORQJHVSORQJHUURUBFRGH YRLGGRBUHVHUYHG  `  FRSURFHVVRUHUURUHVSHUURUBFRGH GLH UHWXUQ  ODVWBWDVNBXVHGBPDWK FXUUHQW LI ^  ORQJHVSORQJHUURUBFRGH YRLGGRBFRSURFHVVRUBHUURU  `  VWDFNVHJPHQWHVSHUURUBFRGH GLH ^  ORQJHVSORQJHUURUBFRGH YRLGGRBVWDFNBVHJPHQW  `  VHJPHQWQRWSUHVHQWHVSHUURUBFRGH GLH ^  ORQJHVSORQJHUURUBFRGH YRLGGRBVHJPHQWBQRWBSUHVHQW  `  LQYDOLG766HVSHUURUBFRGH GLH ^  ORQJHVSORQJHUURUBFRGH YRLGGRBLQYDOLGB766  `  FRSURFHVVRUVHJPHQWRYHUUXQHVSHUURUBFRGH GLH ^  ORQJHVSORQJHUURUBFRGH YRLGGRBFRSURFHVVRUBVHJPHQWBRYHUUXQ  `  GHYLFHQRWDYDLODEOHHVSHUURUBFRGH GLH ^  ORQJHVSORQJHUURUBFRGH YRLGGRBGHYLFHBQRWBDYDLODEOH  `  LQYDOLGRSHUDQGHVSHUURUBFRGH GLH ^  ORQJHVSORQJHUURUBFRGH YRLGGRBLQYDOLGBRS  `  ERXQGVHVSHUURUBFRGH GLH ^  ORQJHVSORQJHUURUBFRGH YRLGGRBERXQGV  `   WUDSVF 〻ᒿ 㹼ᔰ࿻˅ˈ਼ᰦ㔉ࠪҶєњ㌫㔏࣏㜭Ⲵᓅቲ᧕ਓˈ࠶࡛ᱟ sys_execve ઼ sys_forkDŽ䘈ࡇࠪҶ༴⨶䗷〻㊫լ ਓ༴⨶䗷〻ԕ৺ؑਧỰ⍻༴⨶˄Ӿԓ⸱ㅜ 80ޕᵜ〻ᒿѫ㾱ᇎ⧠㌫㔏䈳⭘(system_call)ѝᯝ int 0x80 Ⲵ 㔏䈳⭘࠭ᮠ䘋㹼༴⨶DŽ 㺘˄ ൘ include/linux/sys.h ᮷Ԧѝ˅DŽ❦ਾ൘ѝᯝ int 0x80 Ⲵ༴⨶䗷〻ѝṩᦞ⭘ᡧᨀ׋Ⲵ࣏㜭ਧ䈳⭘ሩᓄ㌫ ሩҾᡰᴹ㌫㔏䈳⭘Ⲵᇎ⧠࠭ᮠˈ޵ṨᢺᆳԜ᤹➗㌫㔏䈳⭘࣏㜭ਧ亪ᒿᧂࡇᡀаᕐ࠭ᮠᤷ䪸˄ൠ൰˅ ᒿDŽ ᮠ fork()ণਟDŽ࠭ᮠᓃ libc ѝⲴ fork()࠭ᮠՊᇎ⧠ሩѝᯝ int 0x80 Ⲵ䈳⭘䗷〻ᒦᢺ䈳⭘㔃᷌䘄എ㔉⭘ᡧ〻 㘼ᱟ䙊䗷࠭ᮠᓃ˄ֻྲ libc˅ѝᨀ׋Ⲵ᧕ਓ࠭ᮠᶕ䈳⭘ⲴDŽֻྲࡋᔪ䘋〻Ⲵ㌫㔏䈳⭘ fork ਟⴤ᧕֯⭘࠭ ࣏㜭ᴽ࣑ˈ䘉Ӌ᫽֌㌫㔏ᨀ׋Ⲵ࣏㜭㻛〠ѻѪ㌫㔏䈳⭘࣏㜭DŽ䙊ᑨ⭘ᡧᒦнᱟⴤ᧕֯⭘㌫㔏䈳⭘ѝᯝˈ ൘ Linux 0.11 ѝˈ⭘ᡧ֯⭘ѝᯝ䈳⭘ int 0x80 ઼᭮൘ᇴᆈಘ eax ѝⲴ࣏㜭ਧᶕ֯⭘޵Ṩᨀ׋Ⲵ਴⿽ 8.5.1 ࣕ㜳ᨅ䘦 8.5 system_call.s ぁᓅ   ` 䇮㖞ᒦ㹼ਓ  Ⲵѝᯝ [ 䲧䱡䰘᧿䘠ㅖDŽ SDUDOOHOBLQWHUUXSW  VHWBWUDSBJDWH $ Ӿ㣟⡷Ⲵ ,54 ѝᯝ䈧≲DŽ ݱ䇨 [GI[$ [$ LQEBS RXWE $ ѫ㣟⡷Ⲵ ,54 ѝᯝ䈧≲DŽ ݱ䇨 [IE[ [ LQEBS RXWEBS  LUT  VHWBWUDSBJDWH 䇮㖞ॿ༴⨶ಘѝᯝ [G˄˅䲧䱡䰘᧿䘠ㅖˈᒦݱ䇨ަӗ⭏ѝᯝ䈧≲DŽ䇮㖞ᒦ㹼ਓѝᯝ᧿䘠ㅖDŽ  UHVHUYHG L VHWBWUDSBJDWH  LL L IRU л䶒ᢺ LQW Ⲵ䲧䱡䰘ݸ൷䇮㖞Ѫ UHVHUYHGˈԕਾ਴⺜Ԧࡍ࿻ॆᰦՊ䟽ᯠ䇮㖞㠚ᐡⲴ䲧䱡䰘DŽ  FRSURFHVVRUBHUURU  VHWBWUDSBJDWH  UHVHUYHG  VHWBWUDSBJDWH  SDJHBIDXOW  VHWBWUDSBJDWH  JHQHUDOBSURWHFWLRQ  VHWBWUDSBJDWH  VWDFNBVHJPHQW  VHWBWUDSBJDWH  VHJPHQWBQRWBSUHVHQW  VHWBWUDSBJDWH  LQYDOLGB766  VHWBWUDSBJDWH  FRSURFHVVRUBVHJPHQWBRYHUUXQ  VHWBWUDSBJDWH  GRXEOHBIDXOW  VHWBWUDSBJDWH  GHYLFHBQRWBDYDLODEOH  VHWBWUDSBJDWH  LQYDOLGBRS  VHWBWUDSBJDWH  ERXQGV  VHWBV\VWHPBJDWH  LQWਟԕ㻛ᡰᴹ〻ᒿᢗ㹼  RYHUIORZ  VHWBV\VWHPBJDWH  LQWFDQEHFDOOHGIURPDOO  LQW  VHWBV\VWHPBJDWH  QPL  VHWBWUDSBJDWH  GHEXJ  VHWBWUDSBJDWH 䇮㖞䲔᫽֌ࠪ䭉Ⲵѝᯝੁ䟿٬DŽԕл䴧਼DŽ GLYLGHBHUURU  VHWBWUDSBJDWH  LQWL ^  YRLG YRLGWUDSBLQLW  㹼 DŽLQFOXGHDVPV\VWHPKㅜ  㹼ǃ ᔿ≷㕆ᆿ〻ᒿޕ䘉єњ࠭ᮠ൷ᱟ፼   V\VWHPBFDOOV 〻ᒿ ㌫㔏䈳⭘༴⨶䗷〻Ⲵᮤњ⍱〻㿱മ 8-5 ᡰ⽪DŽ Պ俆ݸ“䘄എ”ࡠ⴨ᓄؑਧ༴⨶࠭ᮠѝ৫ᢗ㹼ˈ❦ਾ䘄എ䈳⭘ system_call Ⲵ〻ᒿDŽ ᆈⲴᇴᆈಘ޵ᇩˈ䘰ࠪ↔⅑ѝᯝ༴⨶䗷〻ᒦ䘄എ䈳⭘〻ᒿDŽ㤕ᴹؑਧᰦࡉ〻ᒿ؍༽ᴰਾˈ䈕〻ᒿᚒ ᶴⲴؑਧսമ㺘᰾䈕䘋〻ᴹ᧕᭦ࡠؑਧˈࡉ䈳⭘ؑਧ༴⨶࠭ᮠ do_signal()DŽ ҏ・࡫ᕩࠪึḸ޵ᇩ䘰ࠪ㌫㔏䈳⭘ѝᯝDŽᵛㄟⲴаඇԓ⸱⭘ᶕ༴⨶䈳⭘㌫㔏䈳⭘䘋〻ⲴؑਧDŽ㤕䘋〻㔃 ࡔᯝᵜ⅑㔏䈳⭘Ⲵ䘋〻ᱟ੖ᱟањᲞ䙊䘋〻ˈ㤕нᱟࡉ䈤᰾ᱟ޵Ṩ䘋〻˄ֻྲࡍ࿻䘋〻 1˅ᡆަԆDŽࡉ ࡍ࿻䘋〻 0ˈྲ᷌ᱟቡⴤ᧕䘰ࠪ↔⅑㌫㔏䈳⭘ˈѝᯝ䘄എDŽ੖ࡉ޽ṩᦞԓ⸱⇥᧿䘠ㅖ઼ᡰ֯⭘ⲴึḸᶕ Ӿ ret_from_sys_call ḷਧ༴ᔰ࿻Ⲵԓ⸱ᢗ㹼аӋ㌫㔏䈳⭘Ⲵਾ༴⨶ᐕ֌DŽѫ㾱ࡔᯝᖃࡽ䘋〻ᱟ੖ᱟ ᆼ schedule()ਾᴰ㓸Պ䘄എࡠ ret_from_sys_call ༴㔗㔝ᢗ㹼DŽ Ḹˈഐ↔൘ᢗ㹼ޕ ˄jmp _schedule˅DŽ⭡Ҿ൘ᢗ㹼"jmp _schedule"ѻࡽᐢ㓿ᢺ䘄എൠ൰ ret_from_sys_call ⣦ᘱӾᢗ㹼ᘱਈᡀҶަԆ⣦ᘱˈᡆ㘵⭡Ҿᰦ䰤⡷ᐢ㓿⭘ᆼ˄counter==0˅ˈࡉ䈳⭘䘋〻䈳ᓖ࠭ᮠ schedule() ᧕лᶕˈ䈕〻ᒿḕⴻᢗ㹼ᵜ⅑䈳⭘䘋〻Ⲵ⣦ᘱDŽྲ᷌⭡Ҿк䶒 C ࠭ᮠⲴ᫽֌ᡆަԆᛵߥ㘼֯䘋〻Ⲵ ᆈ䎧ᶕDŽ؍Ḹึޕ঻ 䙊䗷ањൠ൰䐣䖜㺘˄sys_call_table˅䈳⭘⴨ᓄ㌫㔏䈳⭘Ⲵ C ࠭ᮠDŽ൘ C ࠭ᮠ䘄എਾˈ〻ᒿቡᢺ䘄എ٬ ࡠⲴᇴᆈಘࡠึḸкDŽLinux ޵Ṩ唈䇔ൠᢺ⇥ᇴᆈಘ ds,es ⭘Ҿ޵Ṩᮠᦞ⇥ˈ㘼 fs ⭘Ҿ⭘ᡧᮠᦞ⇥DŽ᧕⵰ ᆈаӋՊ⭘؍ᰦՊ俆ݸỰḕ eax ѝⲴ࣏㜭ਧᱟ੖ᴹ᭸˄൘㔉ᇊⲴ㤳ത޵˅ˈ❦ਾޕ䘉њ〻ᒿ൘ࡊ䘋 㜭Ⲵ༴⨶䗷〻สᵜк䜭ᱟ䙊䗷䈳⭘⴨ᓄⲴ C ࠭ᮠ䘋㹼ⲴDŽণᡰ䉃Ⲵ“Bottom half”࠭ᮠDŽ ሩҾ㌫㔏䈳⭘(int 0x80)Ⲵѝᯝ༴⨶䗷〻ˈਟԕᢺᆳⴻ֌ᱟањ“᧕ਓ”〻ᒿDŽᇎ䱵к⇿њ㌫㔏䈳⭘࣏ ⍻༴⨶DŽ ᯝ᧗ࡦᆇᤷԔ EOIˈ❦ਾ䈳⭘⴨ᓄⲴ C ࠭ᮠ༴⨶〻ᒿDŽሩҾᰦ䫏ѝᯝҏ㾱ሩᖃࡽԫ࣑Ⲵؑਧսമ䘋㹼Ự ሩҾ⺜Ԧѝᯝ䈧≲ؑਧ IRQ ਁᶕⲴѝᯝˈަ༴⨶䗷〻俆ݸᱟੁѝᯝ᧗ࡦ㣟⡷ 8259A ਁ䘱㔃ᶏ⺜Ԧѝ ޵Ṩԓ⸱ѝˈ⭡ include/linux/sys.h ཤ᮷ԦѝⲴ㌫㔏࠭ᮠᤷ䪸ᮠ㓴㺘ᶕ३䝽DŽ ٬ᴰሿⲴањؑਧ䘋㹼༴⨶ᒦ༽սؑਧսമѝⲴ䈕ؑਧDŽ㌫㔏䈳⭘Ⲵ C 䈝䀰༴⨶࠭ᮠ࠶ᐳ൘ᮤњ linux DŽ❦ਾ䈳⭘ C ࠭ᮠ䘋㹼⴨ᓄ࣏㜭Ⲵ༴⨶ˈ༴⨶䘄എਾ޽৫Ự⍻ᖃࡽԫ࣑Ⲵؑਧսമˈሩޕecx ઼ edx Ր ḸDŽ㌫㔏䈳⭘ᴰཊਟԕᑖ 3 њ৲ᮠˈ࠶࡛䙊䗷ᇴᆈಘ ebxǃึޕ⴨ᓄ C ࠭ᮠ༴⨶〻ᒿ֌߶༷ˈሶаӋ৲ᮠ঻ ሩҾ䖟ѝᯝ(system_callǃcoprocessor_errorǃdevice_not_available)ˈަ༴⨶䗷〻สᵜкᱟ俆ݸѪ䈳⭘ ⨶〻ᒿDŽ Ⲵॿ༴⨶ಘࠪ䭉(int 16)ǃ䇮༷нᆈ൘(int7)ǃᰦ䫏ѝᯝ(int32)ǃ⺜ⴈѝᯝ(int46)ǃ䖟ⴈѝᯝ(int38)Ⲵѝᯝ༴   V\VWHPBFDOOV 〻ᒿ ѝᯝ䘄എ ᭮ᴹ䈳⭘৲ᮠ HE[HF[HG[ ѝ HD[ 䈳⭘ਧ Y ሿؑਧ䟿ˈ䈳⭘ GRBVLJQDO ṩᦞ䘋〻ؑਧսമਆ䘋〻Ⲵᴰ ⭘ᡧึḸ" 䎵㓗⭘ᡧ〻ᒿ" ḸⲴᇴᆈಘޕᕩࠪ ࡍ࿻ԫ࣑˛  ᰦ䰤⡷ ˛ ᒦ䐣䖜ࡠ VFKHGXOH Ḹޕ UHWBIURPBV\VBFDOO ԫ࣑ቡ㔚" 䈳⭘ሩᓄⲴ & ༴⨶࠭ᮠ ⭘ᡧᮠᦞ IV ᤷੁተ䜘ᮠᦞ⇥ GVHV ᤷੁ޵Ṩԓ⸱⇥ Ḹޕᇴᆈಘ ѝᯝ䘄എ 䈳⭘ਧ䎵㤳ത" BV\VWHPBFDOO ਓޕ㌫㔏ѝᯝ䈳⭘  HD[ N Y Y Y 1 UHWBIURPBV\VBFDOO Ր䙂ᯩ⌅DŽ ࠪ޵ṨᘱึḸˈഐ↔޵Ṩн⭘ሩᆳԜ䘋㹼⢩↺༴⨶DŽ䘉⿽ᯩ⌅ᱟ Linus ᖃᰦᡰ⸕Ⲵᴰㆰঅᴰᘛ䙏Ⲵ৲ᮠ ಘ٬ᰦˈ䘉ӋՐ䙂৲ᮠⲴᇴᆈಘҏ㻛㠚ࣘൠ᭮൘Ҷ޵ṨᘱึḸкDŽ㘼ᖃ䘋〻Ӿѝᯝ䈳⭘ѝ䘰ࠪᰦቡ㻛ᕩ ᆈᇴᆈ؍㌫㔏ѝᯝᴽ࣑〻ᒿ㘼ޕ䘉⿽֯⭘ᇴᆈಘՐ䙂৲ᮠⲴᯩ⌅ާᴹањ᰾ᱮⲴՈ⛩ˈ䛓ቡᱟᖃ䘋 ㅹ࠭ᮠᶕ䘋㹼ˈ৲㿱 include/asm/segment.h ᮷Ԧѝ䘉Ӌ࠭ᮠⲴᇎ⧠ԓ⸱DŽ 䗩⭼Ựḕᐕ֌Պ⭡ CPU 㠚ࣘᆼᡀDŽ޵Ṩ〻ᒿѝⲴᇎ䱵ᮠᦞՐ䙂ᐕ֌ਟԕ֯⭘ get_fs_byte()઼ put_fs_byte() ᡧᮠᦞオ䰤ѻ䰤Ⲵᮠᦞ༽ࡦᐕ֌ˈᒦф൘༽ࡦ䗷〻ѝ޵Ṩ〻ᒿн䴰㾱ሩᮠᦞ䗩⭼㤳ത֌ԫօỰḕ᫽֌DŽ ᮠᦞオ䰤DŽഐ↔൘ᇎ䱵ᮠᦞඇؑ᚟Ր䙂䗷〻ѝ Linux ޵Ṩቡਟԕ࡙⭘ fs ᇴᆈಘᶕᢗ㹼޵Ṩᮠᦞオ䰤о⭘ ྲкᡰ䘠ˈ൘㌫㔏䈳⭘䘀㹼䗷〻ѝˈ⇥ᇴᆈಘ ds ઼ es ᤷੁ޵Ṩᮠᦞオ䰤ˈ㘼 fs 㻛䇮㖞Ѫᤷੁ⭘ᡧ ੁ㌫㔏䈳⭘䗷〻Ր䙂ᴤཊⲴᮠᦞؑ᚟DŽ њ৲ᮠ˄нवᤜ᭮൘ eax ᇴᆈಘѝⲴ㌫㔏䈳⭘ਧ˅DŽ㤕֯⭘ᤷੁ⭘ᡧオ䰤ᮠᦞඇⲴᤷ䪸ˈࡉ⭘ᡧ〻ᒿਟԕ ൘ Linux 0.11 ㌫㔏ѝˈ〻ᒿ֯⭘ᇴᆈಘ ebxǃecx ઼ edx Ր䙂৲ᮠˈਟԕⴤ᧕ੁ㌫㔏䈳⭘ᴽ࣑䗷〻Ր䙂 3 Ҿ㌫㔏䈳⭘ int 0x80 ѝⲴ৲ᮠՐ䙂䰞仈ˈLinux ޵Ṩ֯⭘Ҷࠐњ䙊⭘ᇴᆈಘ֌Ѫ৲ᮠՐ䙂Ⲵ⑐䚃DŽޣ ഴ ㌱㔕ѣᯣ䈹⭞༺⨼⍷ぁ    V\VWHPBFDOOV 〻ᒿ ] ;%) ս㖞DŽ〫ٿ($; [ึḸѝ਴њᇴᆈಘⲴ  ᡆ㔃ᶏ˅DŽ→ڌ6,*B&+/' ᇊѹ 6,*B&+/' ؑਧ˄ᆀ䘋〻  DŽڊ䶎ᣒঐ৏ࡉDŽഐ↔㌫㔏ᰒᰐᗵ㾱൘䘉ӋĀަԆāѝᯝѝ༴⨶ؑਧˈҏнݱ䇨䘉ṧ 䈍ˈቡᴹਟ㜭о㌫㔏䈳⭘ѝᯝ઼ᰦ䫏ѝᯝ䗷〻ѝሩؑਧⲴ䇶࡛༴⨶䗷〻⴨ߢケˈˈ䘍৽Ҷ޵Ṩԓ⸱ ԕཆⲴަԆѝᯝDŽ䘉ӋѝᯝՊ൘޵Ṩᘱᡆ⭘ᡧᘱ䲿ᵪਁ⭏ˈ㤕൘䘉Ӌѝᯝ䗷〻ѝҏ༴⨶ؑਧ䇶࡛Ⲵ к䶒 /LQXV ৏⌘䟺ѝⲴа㡜ѝᯝ䗷〻ᱟᤷ䲔Ҷ㌫㔏䈳⭘ѝᯝ˄LQW[˅઼ᰦ䫏ѝᯝ˄LQW[˅    㹼DŽ ˅ᰦึḸⲴ޵ᇩ㿱к䶒 UHWBIURPBV\VWHPBFDOO Ӿ㌫㔏䈳⭘䘄എ˄    ѝᯝ䗷〻ᒦн༴⨶ؑਧ䇶࡛ˈഐѪՊ㔉㌫㔏䙐ᡀ␧ҡDŽ  VLJQDO 䇶࡛ˈ൘⇿⅑ᰦ䫏ѝᯝ઼㌫㔏䈳⭘ѻਾ䜭Պ䘋㹼䇶࡛DŽа㡜 ⌘᜿˖䘉⇥ԓ⸱༴⨶ؑਧ    WLPHULQWHUUXSW ਕᷴDŽ⺜ⴈ઼䖟ⴈⲴѝᯝ༴⨶〻ᒿҏ൘䘉䟼DŽ ਼ᰦҏवᤜᰦ䫏ѝᯝ༴⨶  V\VWHPFDOO ᓅቲ༴⨶ᆀ〻ᒿDŽ⭡ҾᴹӋԓ⸱∄䖳㊫լˈᡰԕ V\VWHPBFDOOV ᮷Ԧवਜ਼㌫㔏䈳⭘      HVS ROGVV &  HVS ROGHVS   HVS HIODJV   HVS FV   HVS HLS &  HVS GV   HVS HV   HVS IV   HVS HG[ &  HVS HF[   HVS HE[   HVS HD[      UHWBIURPBV\VWHPBFDOO 6WDFNOD\RXWLQ    XQQHFHVVDULO\  WKDQGOHVLJQDOUHFRJQLWLRQDVWKDWZRXOGFOXWWHUWKHPXSWRWDOO\ GRQ  DIWHUDWLPHULQWHUUXSWDQGDIWHUHDFKV\VWHPFDOO2UGLQDU\LQWHUUXSWV  7KLVFRGHKDQGOHVVLJQDOUHFRJQLWLRQZKLFKKDSSHQVHYHU\WLPH127(    WKHVDPH7KHKGDQGIORSSS\LQWHUUXSWVDUHDOVRKHUH  7KLVDOVRFRQWDLQVWKHWLPHULQWHUUXSWKDQGOHUDVVRPHRIWKHFRGHLV  V\VWHPBFDOOVFRQWDLQVWKHV\VWHPFDOOORZOHYHOKDQGOLQJURXWLQHV       /LQXV7RUYDOGV &     OLQX[NHUQHOV\VWHPBFDOOV     ぁᓅ 8-4 linux/kernel/system_call.s 8.5.2 ԙ⸷⌞䠀   V\VWHPBFDOOV 〻ᒿ MPSBVFKHGXOH Ḹ˄ 㹼˅DŽޕSXVKOUHWBIURPBV\VBFDOOሶ UHWBIURPBV\VBFDOO Ⲵൠ൰ UHVFKHGXOH DOLJQ  䘄എᰦቡӾ UHWBIURPBV\VBFDOO ༴˄ 㹼˅㔗㔝ᢗ㹼DŽ ᖃ䈳ᓖ〻ᒿ VFKHGXOH NHUQHOVFKHGF DŽ ਓDŽ䈳ᓖ〻ᒿ VFKHGXOH ൘ޕ䟽ᯠᢗ㹼䈳ᓖ〻ᒿ LUHW PRYOHD[HD[ ѝ㖞ˈ䘰ࠪѝᯝDŽ EDGBV\VBFDOO DOLJQ޵ᆈ  ᆇ㢲ሩ喀DŽ 䭉䈟Ⲵ㌫㔏䈳⭘ਧDŽ  JOREOBGHYLFHBQRWBDYDLODEOHBFRSURFHVVRUBHUURU JOREOBKGBLQWHUUXSWBIORSS\BLQWHUUXSWBSDUDOOHOBLQWHUUXSW JOREOBV\VWHPBFDOOBV\VBIRUNBWLPHUBLQWHUUXSWBV\VBH[HFYH ਓ⛩DŽޕᇊѹ 㤡᮷⌘䟺ѝⲴĀ8UJHOāᱟ⪎ި䈝ˈሩᓄ㤡᮷অ䇽Ā8JKāDŽ䘉њঅ䇽൘ᴰᯠ޵Ṩѝ䘈ᑨࠪ⧠DŽ   ྭҶˈ൘֯⭘䖟傡ᰦᡁ᭦ࡠҶᒦ㹼ᢃঠᵪѝᯝˈᖸཷᙚDŽବˈ⧠൘н㇑ᆳDŽ      VWUDQJHUHDVRQ8UJHO1RZ,MXVWLJQRUHWKHP  2N,JHWSDUDOOHOSULQWHULQWHUUXSWVZKLOHXVLQJWKHIORSS\IRUVRPH     QUBV\VWHPBFDOOV /LQX[ ⡸޵ṨѝⲴ㌫㔏䈳⭘ᙫᮠDŽ  VDBUHVWRUHU ᚒ༽࠭ᮠᤷ䪸ˈ৲㿱 NHUQHOVLJQDOFDŽ VDBIODJV ؑਧ䳶DŽ VDBPDVN ؑਧቿ㭭⸱DŽ VDBKDQGOHU ؑਧ༴⨶䗷〻Ⲵਕᷴ˄᧿䘠ㅖ˅DŽ RIIVHWVZLWKLQVLJDFWLRQ 䟿ˈ৲㿱 LQFOXGHVLJQDOKˈㅜ  㹼ᔰ࿻DŽ〫ٿԕлᇊѹ൘ VLJDFWLRQ 㔃ᶴѝⲴ  䟿DŽ〫ٿ ਇ䱫ຎؑਧսമⲴ   EORFNHG ሩᓄؑਧሶ㾱ᢗ㹼Ⲵ᫽֌઼ḷᘇؑ᚟DŽˈ٬〫ٿؑਧᢗ㹼኎ᙗ㔃ᶴᮠ㓴Ⲵ  OHQRIVLJDFWLRQ VLJDFWLRQ 㔃ᶴ䮯ᓖᗵ享ᱟ  ᆇ㢲DŽ VLJDFWLRQ 0867EH ٬DŽ〫ٿս VLJQDO ᱟؑਧսമˈ⇿њ∄⢩սԓ㺘а⿽ؑਧˈؑਧ٬ SULRULW\ 䘀㹼ՈݸᮠDŽԫ࣑ᔰ࿻䘀㹼ᰦ FRXQWHU SULRULW\ˈ䎺བྷࡉ䘀㹼ᰦ䰤䎺䮯DŽ 䙂߿ ˄┤ㆄᮠ˅ˈ䘀㹼ᰦ䰤⡷DŽ FRXQWHU ԫ࣑䘀㹼ᰦ䰤䇑ᮠ VWDWH WKHVHDUHRIIVHWVLQWRWKHWDVNVWUXFW䘋〻⣦ᘱ⸱DŽ 㿱 LQFOXGHOLQX[VFKHGKˈ 㹼ᔰ࿻DŽ৲ˈ٬〫ٿWDVNBVWUXFW ѝਈ䟿Ⲵ ԕл䘉Ӌᱟԫ࣑㔃ᶴ  2/'66 [& ᆈ൘޵ṨᘱḸѝDŽ؍2/'(63 [ᖃ⢩ᵳ㓗ਈॆᰦḸՊ࠷ᦒˈ⭘ᡧḸᤷ䪸㻛 ()/$*6 [ &6 [ (,3 [& '6 [ (6 [ )6 [ ('; [& (&; [   V\VWHPBFDOOV 〻ᒿ "HVS ZDVROGFRGHVHJPHQWVXSHUYLVRU FPSZ[I&6 ㅖнѪ [˄ণ৏ึḸн൘⭘ᡧ⇥ѝ˅ˈҏ䈤᰾ᵜ⅑㌫㔏䈳⭘Ⲵ䈳⭘㘵нᱟ⭘ᡧԫ࣑ˈࡉҏ䘰ࠪDŽ ᷌нᱟࡉ䈤᰾ᱟḀњѝᯝᴽ࣑〻ᒿ䐣䖜ࡠㅜ  㹼ⲴˈҾᱟ䐣䖜䘰ࠪѝᯝ〻ᒿDŽྲ᷌৏ึḸ⇥䘹ᤙ ԓ⸱⇥ ˅ᶕࡔᯝᱟ੖Ѫ⭘ᡧԫ࣑DŽྲ Ѫ⭘ᡧԓ⸱⇥Ⲵ䘹ᤙㅖ [I˄53/ ˈተ䜘㺘ˈㅜ  њ⇥ 䘉ᱟഐѪԫ࣑൘޵Ṩᘱᢗ㹼ᰦнਟᣒঐDŽ੖ࡉሩԫ࣑䘋㹼ؑਧ䟿Ⲵ䇶࡛༴⨶DŽ䘉䟼∄䖳䘹ᤙㅖᱟ੖ 䙊䗷ሩ৏䈳⭘〻ᒿԓ⸱䘹ᤙㅖⲴỰḕᶕࡔᯝ䈳⭘〻ᒿᱟ੖ᱟ⭘ᡧԫ࣑DŽྲ᷌нᱟࡉⴤ᧕䘰ࠪѝᯝDŽ IRUZDUG 䐣䖜ࡠḷਧ  ༴䘰ࠪѝᯝ༴⨶DŽDŽ MHIੁࡽ FPSOBWDVNHD[ PRYOBFXUUHQWHD[WDVN>@FDQQRWKDYHVLJQDOV  㹼кⲴBWDVN ሩᓄ & 〻ᒿѝⲴ WDVN>@ᮠ㓴ˈⴤ᧕ᕅ⭘ WDVN ⴨ᖃҾᕅ⭘ WDVN>@DŽ 俆ݸࡔ࡛ᖃࡽԫ࣑ᱟ੖ᱟࡍ࿻ԫ࣑ WDVNˈྲ᷌ᱟࡉнᗵሩަ䘋㹼ؑਧ䟿ᯩ䶒Ⲵ༴⨶ˈⴤ᧕䘄എDŽ UHWBIURPBV\VBFDOO ሶ䐣䖜ࡠ䘉䟼䘋㹼༴⨶ਾ᡽䘰ࠪѝᯝ䗷〻ˈֻྲਾ䶒  㹼кⲴ༴⨶ಘࠪ䭉ѝᯝ LQWDŽ ԕл䘉⇥ԓ⸱ᢗ㹼Ӿ㌫㔏䈳⭘ & ࠭ᮠ䘄എਾˈሩؑਧ䘋㹼䇶࡛༴⨶DŽަԆѝᯝᴽ࣑〻ᒿ䘰ࠪᰦҏ  MHUHVFKHGXOH HD[ FRXQWHU FPSOFRXQWHU MQHUHVFKHGXOH HD[ VWDWH FPSOVWDWH PRYOBFXUUHQWHD[ਆᖃࡽԫ࣑˄䘋〻˅ᮠᦞ㔃ᶴൠ൰ÎHD[DŽ 䘄എDŽ ᘱDŽ㘼ᖃࡽ䘋〻ࡉՊ・࡫⣦→ڌՊ᭦ࡠ 6,*77,1 ᡆ 6,*7728 ؑਧˈሬ㠤䘋〻㓴ѝᡰᴹ䘋〻༴Ҿ ֻྲᖃਾਠ䘋〻㓴ѝⲴ䘋〻ᢗ㹼᧗ࡦ㓸ㄟ䈫߉᫽֌ᰦˈ䛓Ѹ唈䇔ᶑԦл䈕ਾਠ䘋〻㓴ᡰᴹ䘋〻 〻ᒿDŽྲ᷌䈕ԫ࣑൘ቡ㔚⣦ᘱˈնަᰦ䰤⡷ᐢ⭘ᆼ˄FRXQWHU ˅ˈࡉҏ৫ᢗ㹼䈳ᓖ〻ᒿDŽ  㹼ḕⴻᖃࡽԫ࣑Ⲵ䘀㹼⣦ᘱDŽྲ᷌н൘ቡ㔚⣦ᘱ˄VWDWH нㅹҾ ˅ቡ৫ᢗ㹼䈳ᓖ л䶒 ḸDŽޕSXVKOHD[ᢺ㌫㔏䈳⭘䘄എ٬ HD[ 䰤᧕䈳⭘ᤷᇊ࣏㜭 & ࠭ᮠDŽ FDOOBV\VBFDOOBWDEOH ᡰᴹ  њ㌫㔏䈳⭘ & ༴⨶࠭ᮠⲴൠ൰DŽ V\VBFDOOBWDEOH>@ᱟањᤷ䪸ᮠ㓴ˈᇊѹ൘ LQFOXGHOLQX[V\VK ѝDŽ䈕ᤷ䪸ᮠ㓴ѝ䇮㖞Ҷ @DŽ৲㿱〻ᒿਾⲴ䈤᰾DŽ л䶒䘉ਕ᫽֌ᮠⲴਜ਼ѹᱟ˖䈳⭘ൠ൰ >BV\VBFDOOBWDEOHHD[ PRYG[IV PRYO[HG[IVSRLQWVWRORFDOGDWDVSDFH  ࠭ᮠDŽ ৲㿱 IRUNF 〻ᒿѝ FRS\BPHP ⌘᜿ˈ൘ /LQX[ ѝ޵Ṩ㔉ԫ࣑࠶䝽Ⲵԓ⸱઼ᮠᦞ޵ᆈ⇥ᱟ䟽ਐⲴˈᆳԜⲴ⇥ส൰઼⇥䲀䮯⴨਼DŽ ተ䜘᧿䘠ㅖ㺘ѝᮠᦞ⇥᧿䘠ㅖ ˈণᤷੁᢗ㹼ᵜ⅑㌫㔏䈳⭘Ⲵ⭘ᡧ〻ᒿⲴᮠᦞ⇥DŽ IV ᤷੁተ䜘ᮠᦞ⇥ PRYG[HV ተ᧿䘠ㅖ㺘ѝᮠᦞ⇥᧿䘠ㅖ DŽޘ ⇥PRYG[GVGVHV ᤷੁ޵Ṩᮠᦞ PRYO[HG[VHWXSGVHVWRNHUQHOVSDFH SXVKOHE[WRWKHV\VWHPFDOO SXVKOHF[SXVKHE[HF[HG[DVSDUDPHWHUV SXVKOHG[ ㌫㔏䈳⭘䈝ਕਟ৲㿱ཤ᮷Ԧ LQFOXGHXQLVWGK ѝㅜ  ࡠ  㹼Ⲵ㌫㔏䈳⭘ᆿDŽ HE[ ѝਟᆈ᭮ㅜ  њ৲ᮠˈHF[ ѝᆈ᭮ㅜ  њ৲ᮠˈHG[ ѝᆈ᭮ㅜ  њ৲ᮠDŽ ḸⲴ亪ᒿᱟ⭡ *18*&& 㿴ᇊⲴˈޕ 㹼˅Ⲵ䈳⭘৲ᮠDŽ䘉ࠐњᇴᆈಘ 䈳⭘⴨ᓄ & 䈝䀰࠭ᮠ˄㿱ㅜ ḸⲴ HE[ǃHF[ ઼ HG[ ѝ᭮⵰㌫㔏ޕањ㌫㔏䈳⭘ᴰཊਟᑖᴹ  њ৲ᮠˈҏਟԕнᑖ৲ᮠDŽл䶒 SXVKIV SXVKHV ᆈ৏⇥ᇴᆈಘ٬DŽ؍SXVKGV MDEDGBV\VBFDOO FPSOQUBV\VWHPBFDOOVHD[䈳⭘ਧྲ᷌䎵ࠪ㤳തⲴ䈍ቡ൘ HD[ ѝ㖞 ᒦ䘰ࠪDŽ BV\VWHPBFDOO DOLJQ 䈳⭘ѝᯝ LQW[ˈHD[ ѝᱟ䈳⭘ਧ DŽ ਓ⛩ޕLQW[OLQX[ ㌫㔏䈳⭘   V\VWHPBFDOOV 〻ᒿ  㹼˅DŽѝᯝˈ䘉ṧ &38 ቡਟԕᴹᵪՊ䇙䘉њѝᯝ༴⨶〻ᒿ⁑ᤏॿ༴⨶ಘᤷԔ˄ ྲ᷌᧗ࡦᇴᆈಘ&5ѝ (0˄⁑ᤏ˅ḷᘇ㖞սˈࡉᖃ &38ᢗ㹼ањॿ༴⨶ಘᤷԔᰦቡՊᕅਁ䈕 LQW䇮༷нᆈ൘ᡆॿ༴⨶ಘнᆈ൘DŽ㊫ර˖䭉䈟˗ᰐ䭉䈟⸱DŽ   PDWKPDWKBHPXODWHF MPSBPDWKBHUURUᢗ㹼 & ࠭ᮠ PDWKBHUURU ḸDŽޕSXVKOUHWBIURPBV\VBFDOOᢺл䶒䈳⭘䘄എⲴൠ൰ PRYD[IV PRYO[HD[IV 㖞Ѫᤷੁተ䜘ᮠᦞ⇥˄ࠪ䭉〻ᒿⲴᮠᦞ⇥˅DŽ PRYD[HV PRYD[GV PRYO[HD[GVHV 㖞Ѫᤷੁ޵Ṩᮠᦞ⇥DŽ SXVKOHD[ SXVKOHE[ SXVKOHF[ SXVKOHG[ SXVKIV SXVKHV SXVKGV BFRSURFHVVRUBHUURU DOLJQ ˄NHUQHOPDWKPDWKBHPXODWHF˅DŽ䘄എਾ䐣䖜ࡠḷਧ UHWBIURPBV\VBFDOO ༴㔗㔝ᢗ㹼DŽ  䙊⸕ &38DŽл䶒ԓ⸱⭘Ҿ༴⨶ॿ༴⨶ಘਁࠪⲴࠪ䭉ؑਧDŽᒦ䐣䖜৫ᢗ㹼 & ࠭ᮠ PDWKBHUURU 䘉ᱟањཆ䜘ⲴสҾ⺜ԦⲴᔲᑨDŽᖃॿ༴⨶ಘỰ⍻ࡠ㠚ᐡਁ⭏䭉䈟ᰦˈቡՊ䙊䗷 (5525 ᕅ㝊 LQW༴⨶ಘ䭉䈟ѝᯝDŽ㊫ර˖䭉䈟˗ᰐ䭉䈟⸱DŽ  LUHW SRSGV SRSHV SRSIV SRSOHG[ SRSOHF[ SRSOHE[ ḸⲴ㌫㔏䈳⭘䘄എ٬DŽޕ 㹼 SRSOHD[HD[ ѝਜ਼ᴹㅜ ḸⲴؑਧ٬DŽޕSRSOHD[ᕩࠪ  NHUQHOVLJQDOF FDOOBGRBVLJQDO䈳⭘ & ࠭ᮠؑਧ༴⨶〻ᒿ Ḹ֌Ѫ䈳⭘ GRBVLJQDO Ⲵ৲ᮠѻаDŽޕSXVKOHF[ؑਧ٬  DŽ LQFOHF[ሶؑਧ䈳ᮤѪӾ  ᔰ࿻Ⲵᮠ ᆈ VLJQDO սമؑ᚟ÎFXUUHQW!VLJQDODŽ؍HD[ 䟽ᯠ PRYOHE[VLJQDO EWUOHF[HE[༽ս䈕ؑਧ˄HE[ ਜ਼ᴹ৏ VLJQDO սമ˅DŽ MHIྲ᷌⋑ᴹؑਧࡉੁࡽ䐣䖜䘰ࠪDŽ ণㅜࠐս ˅DŽ˄٬〫ٿ⮉䈕սⲴ؍ ]㤕ᴹˈࡉ HF EVIOHF[HF[Ӿվս˄ս ˅ᔰ࿻ᢛ᧿սമˈⴻᱟ੖ᴹ  Ⲵսˈ DQGOHE[HF[㧧ᗇ䇨ਟⲴؑਧսമDŽ QRWOHF[⇿սਆ৽DŽ HD[ HF[ਆ䱫ຎ˄ቿ㭭˅ؑਧսമÎHF[DŽ PRYOEORFNHG њؑਧDŽ  ޡˈHD[ HE[ਆؑਧսമÎHE[ˈ⇿  սԓ㺘  ⿽ؑਧ PRYOVLJQDO ḸⲴؑ᚟DŽޕ ൘˄NHUQHOVLJQDOF˅ѝˈަ৲ᮠवᤜ  њ DŽGRBVLJQDO ⭘ GRBVLJQDO ޽ᢺ৏ؑਧսമѝ䈕ؑਧሩᓄⲴս༽ս˄㖞 ˅ˈᴰਾሶ䈕ؑਧ٬֌Ѫ৲ᮠѻа䈳ˈᴰሿⲴؑਧ٬ ⇿սԓ㺘  ⿽ؑਧ˅ˈ❦ਾ⭘ԫ࣑㔃ᶴѝⲴؑਧ䱫ຎ˄ቿ㭭˅⸱ˈ䱫ຎнݱ䇨Ⲵؑਧսˈਆᗇᮠ٬ ˅⭘Ҿ༴⨶ᖃࡽԫ࣑ѝⲴؑਧDŽ俆ݸਆᖃࡽԫ࣑㔃ᶴѝⲴؑਧսമ˄ սˈл䶒䘉⇥ԓ⸱˄ MQHI HVS ZDVVWDFNVHJPHQW [" FPSZ[2/'66 MQHI   V\VWHPBFDOOV 〻ᒿ PRYD[GV PRYO[HD[GVHV 㖞Ѫᤷੁ޵Ṩᮠᦞ⇥DŽ SXVKOHD[ SXVKOHE[LVVDYHGDVZHXVHWKDWLQUHWBV\VBFDOO SXVKOHF[VDYHWKRVHDFURVVIXQFWLRQFDOOVHE[ W SXVKOHG[ZHVDYHHD[HF[HG[DVJFFGRHVQ SXVKIV SXVKHVLQWRWKHPIVLVXVHGE\BV\VWHPBFDOO SXVKGVVDYHGVHVDQGSXWNHUQHOGDWDVSDFH BWLPHUBLQWHUUXSW DOLJQ ORQJ&3/ DŽᖃ䈳⭘䘄എᰦ䖜৫Ự⍻ᒦ༴⨶ؑਧDŽ & ࠭ᮠ GRBWLPHU  ᧗ࡦಘˈ❦ਾ⭘ᖃࡽ⢩ᵳ㓗֌Ѫ৲ᮠ䈳⭘ 䘉⇥ԓ⸱ሶ MLIILHV ໎ ˈਁ䘱㔃ᶏѝᯝᤷԔ㔉 NHUQHOVFKHGF ༴ࡍ࿻ॆⲴDŽഐ↔䘉䟼 MLIILHV ⇿  ∛。࣐DŽ ᇊᰦ㣟⡷  ᱟ൘ LQFOXGHOLQX[VFKHGK ˈ LQW[ ᰦ䫏ѝᯝ༴⨶〻ᒿDŽѝᯝ仁⦷㻛䇮㖞Ѫ +] LQW   㹼 DŽ UHW䘉䟼Ⲵ UHW ሶ䐣䖜ࡠ UHWBIURPBV\VBFDOO SRSOHES SRSOHVL SRSOHGL FDOOBPDWKBHPXODWH䈳⭘ & ࠭ᮠ PDWKBHPXODWH˄PDWKPDWKBHPXODWHFˈ˅DŽ SXVKOHGL SXVKOHVL SXVKOHES  DŽ 㤕 (0 ḷᘇᱟ㖞սⲴˈࡉ৫ᢗ㹼ᮠᆖԯⵏ〻ᒿ PDWKBHPXODWH  NHUQHOVFKHGF DŽ MHBPDWKBVWDWHBUHVWRUHᢗ㹼 & ࠭ᮠ PDWKBVWDWHBUHVWRUH  PDWKHPXODWLRQELW WHVWO[HD[(0 PRYOFUHD[ FOWVFOHDU76VRWKDWZHFDQXVHPDWK ḸDŽޕSXVKOUHWBIURPBV\VBFDOOᢺл䶒䐣䖜ᡆ䈳⭘Ⲵ䘄എൠ൰ UHWBIURPBV\VBFDOO ༴Ⲵԓ⸱DŽ  ˈᒦ൘䘄എᰦ৫ᢗ㹼 ᕅ䎧Ⲵѝᯝˈࡉᚒ༽ԫ࣑ॿ༴⨶ಘ⣦ᘱˈᢗ㹼 & ࠭ᮠ PDWKBVWDWHBUHVWRUH ٬DŽ㤕ަѝॿ༴⨶ಘԯⵏḷᘇ (0 ⋑ᴹ㖞սˈ䈤᰾нᱟ (0 ␵ &5 ѝԫ࣑ᐢӔᦒḷᘇ 76ˈᒦਆ &5 PRYD[IV PRYO[HD[IV 㖞Ѫᤷੁተ䜘ᮠᦞ⇥˄ࠪ䭉〻ᒿⲴᮠᦞ⇥˅DŽ PRYD[HV PRYD[GV PRYO[HD[GVHV 㖞Ѫᤷੁ޵Ṩᮠᦞ⇥DŽ SXVKOHD[ SXVKOHE[ SXVKOHF[ SXVKOHG[ SXVKIV SXVKHV SXVKGV BGHYLFHBQRWBDYDLODEOH DOLJQ ༴ᢗ㹼л৫˄Ự⍻ᒦ༴⨶ؑਧ˅DŽ  㹼DŽ䈕ѝᯝᴰਾሶ䖜〫ࡠḷਧ UHWBIURPBV\VBFDOO⣦ᘱ˄ 㹼˅DŽ৲㿱 NHUQHOVFKHGFˈ ᆈࡽањԫ࣑Ⲵॿ༴⨶ಘ޵ᇩˈᒦᚒ༽ᯠԫ࣑Ⲵॿ༴⨶ಘᢗ㹼؍ቡՊᕅਁ䈕ѝᯝDŽ↔ᰦቡਟԕ ޵ᇩо &38↓൘ᢗ㹼Ⲵԫ࣑н३䝽ҶDŽᖃ &38൘䘀㹼ањॿ༴⨶ಘ䖜ѹᤷԔᰦਁ⧠ 76 㖞սᰦˈ ॿ༴⨶ಘѝⲴى&5 ⲴӔᦒḷᘇ 76 ᱟ൘&38 ᢗ㹼ԫ࣑䖜ᦒᰦ䇮㖞ⲴDŽ76ਟԕ⭘ᶕ⺞ᇊӰѸᰦ   V\VWHPBFDOOV 〻ᒿ ]SXVKOHF SXVKOHD[ BKGBLQWHUUXSW  DŽ ᡆ XQH[SHFWHGBKGBLQWHUUXSW ǃZULWHBLQWU UHDGBLQWUᤷ䪸ᤷੁⲴ࠭ᮠ $ ѫ㣟⡷䘱 (2, ᤷԔˈᒦ䈳⭘ HG[ ѝ ˈ⭘Ҿᱮ⽪ࠪ䭉ؑ᚟DŽ䲿ਾੁ XQH[SHFWHGBKGBLQWHUUXSW ᇴᆈಘѝˈᒦ㖞 GRBKG Ѫ 18//ˈ᧕⵰ࡔᯝ HG[ ࠭ᮠᤷ䪸ᱟ੖ѪオDŽྲ᷌Ѫオˈࡉ㔉 HG[ 䍻٬ᤷੁ HG[ ޕ(2, ˈ❦ਾਆਈ䟿 GRBKG ѝⲴ࠭ᮠᤷ䪸᭮ $ ѝᯝ᧗ࡦӾ㣟⡷ਁ䘱㔃ᶏ⺜ԦѝᯝᤷԔ 俆ݸੁ ৲㿱 NHUQHOEONBGUYKGF DŽ ᖃ䈧≲Ⲵ⺜ⴈ᫽֌ᆼᡀᡆࠪ䭉ቡՊਁࠪ↔ѝᯝؑਧDŽ LQW[( ⺜ⴈѝᯝ༴⨶〻ᒿˈ૽ᓄ⺜Ԧѝᯝ䈧≲ ,54DŽ LQW  UHW DGGOHVSђᔳ䘉䟼ᡰᴹ঻Ḹ޵ᇩDŽ NHUQHOIRUNF DŽ FDOOBFRS\BSURFHVV䈳⭘ & ࠭ᮠ FRS\BSURFHVV SXVKOHD[ SXVKOHES SXVKOHGL SXVKOHVL SXVKJV MVI WHVWOHD[HD[൘ HD[ ѝ䘄എ䘋〻ਧ SLGDŽ㤕䘄എ䍏ᮠࡉ䘰ࠪDŽ NHUQHOIRUNF DŽ FDOOBILQGBHPSW\BSURFHVV䈳⭘ ILQGBHPSW\BSURFHVV BV\VBIRUN DOLJQ  ༽ࡦ䘋〻DŽ ᐢ┑DŽ❦ਾ䈳⭘ FRS\BSURFHVV  ˈਆᗇањ䘋〻ਧ SLGDŽ㤕䘄എ䍏ᮠࡉ䈤᰾ⴞࡽԫ࣑ᮠ㓴 俆ݸ䈳⭘ & ࠭ᮠ ILQGBHPSW\BSURFHVV  䈳⭘ˈ⭘Ҿࡋᔪᆀ䘋〻ˈᱟ V\VWHPBFDOO ࣏㜭 DŽ৏ᖒ൘ LQFOXGHOLQX[V\VK ѝDŽ V\VBIRUN  UHW ٬DŽ ḸⲴ (,3ޕDGGOHVSђᔳ䈳⭘ᰦ঻ FDOOBGRBH[HFYH SXVKOHD[ ᆈ⭘ᡧ〻ᒿ HLS ᤷ䪸༴˄(,3HVS˅DŽ؍HVS HD[HD[ ᤷੁึḸѝ OHD(,3 BV\VBH[HFYH DOLJQ IVH[HFF DŽ ൘ GRBH[HFYH  DŽ ㌫㔏䈳⭘DŽਆѝᯝ䈳⭘〻ᒿⲴԓ⸱ᤷ䪸֌Ѫ৲ᮠ䈳⭘ & ࠭ᮠ GRBH[HFYH 䘉ᱟ V\VBH[HFYH  MPSUHWBIURPBV\VBFDOO DGGOHVSWDVNVZLWFKLQJWRDFFRXQWLQJ GRHVHYHU\WKLQJIURP ORQJ&3/ GRBWLPHU FDOOBGRBWLPHU SXVKOHD[  RU VXSHUYLVRU DQGOHD[HD[LV&3/ HVS HD[ PRYO&6  㹼ᇎ⧠DŽ  ࠭ᮠᢗ㹼ԫ࣑࠷ᦒǃ䇑ᰦㅹᐕ֌ˈ൘ NHUQHOVFKHGFˈ Ḹˈ֌Ѫ GRBWLPHU Ⲵ৲ᮠDŽGRBWLPHUึ ޕ ᡆ  ᒦ঻ ѝⲴᖃࡽ⢩ᵳ㓗࡛˅л䶒ӾึḸѝਆࠪᢗ㹼㌫㔏䈳⭘ԓ⸱Ⲵ䘹ᤙㅖ˄&6 ⇥ᇴᆈಘ٬ RXWEDO[᫽֌ભԔᆇ 2&: 䘱 [ ㄟਓDŽ PRYE[DO(2,WRLQWHUUXSWFRQWUROOHU ⭡Ҿࡍ࿻ॆѝᯝ᧗ࡦ㣟⡷ᰦ⋑ᴹ䟷⭘㠚ࣘ (2,ˈᡰԕ䘉䟼䴰㾱ਁᤷԔ㔃ᶏ䈕⺜ԦѝᯝDŽ LQFOBMLIILHV PRYD[IV PRYO[HD[IV 㖞Ѫᤷੁተ䜘ᮠᦞ⇥˄〻ᒿⲴᮠᦞ⇥˅DŽ PRYD[HV   V\VWHPBFDOOV 〻ᒿ GRBIORSS\ Ѫа࠭ᮠᤷ䪸ˈሶ㻛䍻٬ᇎ䱵༴⨶ & ࠭ᮠᤷ䪸DŽ䈕ᤷ䪸൘㻛Ӕᦒ᭮ࡠ HD[ ᇴᆈಘਾቡሶ RXWEDO[(2,WRLQWHUUXSWFRQWUROOHU $ ѝᯝ᧗ࡦಘ (2, ᤷԔ˄㔃ᶏ⺜Ԧѝᯝ˅DŽ PRYE[DO䘱ѫ PRYD[IV PRYO[HD[IV 㖞Ѫ䈳⭘〻ᒿⲴተ䜘ᮠᦞ⇥DŽ PRYD[HV PRYD[GV PRYO[HD[GVHV 㖞Ѫ޵Ṩᮠᦞ⇥DŽ SXVKIV SXVKHV SXVKGV SXVKOHG[ SXVKOHF[ SXVKOHD[ BIORSS\BLQWHUUXSW VHHNBLQWHUUXSWUHFDOBLQWHUUXSWUHVHWBLQWHUUXSW ᡆ XQH[SHFWHGBIORSS\BLQWHUUXSWDŽ UZBLQWHUUXSW ˈ⭘Ҿᱮ⽪ࠪ䭉ؑ᚟DŽ䲿ਾ䈳⭘ HD[ ᤷੁⲴ࠭ᮠ XQH[SHFWHGBIORSS\BLQWHUUXSW ᇴᆈಘѝˈᒦ㖞 GRBIORSS\ Ѫ 18//ˈ᧕⵰ࡔᯝ HD[ ࠭ᮠᤷ䪸ᱟ੖ѪオDŽྲѪオˈࡉ㔉 HD[ 䍻٬ᤷੁ HD[ ޕ$ ѝᯝ᧗ࡦಘѫ㣟⡷ਁ䘱 (2, ᤷԔˈ❦ਾਆਈ䟿 GRBIORSS\ ѝⲴ࠭ᮠᤷ䪸᭮ 俆ݸੁ NHUQHOEONBGUYIORSS\F DŽ ަ༴⨶䗷〻ок䶒ሩ⺜ⴈⲴ༴⨶สᵜаṧDŽ LQW[ 䖟ⴈ傡ࣘಘѝᯝ༴⨶〻ᒿˈ૽ᓄ⺜Ԧѝᯝ䈧≲ ,54DŽ LQW  LUHW SRSOHD[ SRSOHF[ SRSOHG[ SRSGV SRSHV SRSIVкਕ䈳⭘ GRBKG ᤷੁⲴ & ࠭ᮠDŽ HG[LQWHUHVWLQJZD\RIKDQGOLQJLQWU FDOO $ ѝᯝ᧗ࡦಘ (2, ᤷԔ˄㔃ᶏ⺜Ԧѝᯝ˅DŽ RXWEDO[䘱ѫ NHUQHOEONBGUYKGF DŽ PRYOBXQH[SHFWHGBKGBLQWHUUXSWHG[  DŽ MQHI㤕オˈࡉ֯ᤷ䪸ᤷੁ & ࠭ᮠ XQH[SHFWHGBKGBLQWHUUXSW WHVWOHG[HG[⍻䈅࠭ᮠᤷ䪸ᱟ੖Ѫ 1XOODŽ [FKJOBGRBKGHG[ [RUOHG[HG[  ˈԕ༴⨶ᵚ⸕⺜ⴈѝᯝDŽ ࠭ᮠ XQH[SHFWHGBKGBLQWHUUXSW ቡሶ GRBKG ᤷ䪸ਈ䟿㖞Ѫ 18//DŽ❦ਾ⍻䈅ᗇࡠⲴ࠭ᮠᤷ䪸ˈ㤕䈕ᤷ䪸Ѫオˈࡉ䍻Ҹ䈕ᤷ䪸ᤷੁ &  ࠭ᮠൠ൰DŽ᭮ࡠ HG[ ᇴᆈಘਾ ᡆ ZULWHBLQWU UHDGBLQWU GRBKG ᇊѹѪањ࠭ᮠᤷ䪸ˈሶ㻛䍻٬ MPSI MPSIJLYHSRUWFKDQFHWREUHDWKHMPS 䎧ᔦᰦ֌⭘DŽ $DŽ RXWEDO[$(2,WRLQWHUUXSWFRQWUROOHU䘱Ӿ PRYE[DO ⭡Ҿࡍ࿻ॆѝᯝ᧗ࡦ㣟⡷ᰦ⋑ᴹ䟷⭘㠚ࣘ (2,ˈᡰԕ䘉䟼䴰㾱ਁᤷԔ㔃ᶏ䈕⺜ԦѝᯝDŽ PRYD[IV PRYO[HD[IV 㖞Ѫ䈳⭘〻ᒿⲴተ䜘ᮠᦞ⇥DŽ PRYD[HV PRYD[GV PRYO[HD[GVHV 㖞Ѫ޵Ṩᮠᦞ⇥DŽ SXVKIV SXVKHV SXVKGV SXVKOHG[   V\VWHPBFDOOV 〻ᒿ [ AT&T: ࡉ AT&T Ṭᔿ˖1(%eax) ަѝ eax ѝᱟ p Ⲵ٬DŽ Intel: [eax+1 ሩҾ C 䈝䀰˖*(p+1) ަѝ p ᱟᆇㅖⲴᤷ䪸 char * 䟿˖〫ٿ o֯⭘ⴤ᧕ᮠራ൰ AT&T: _array(,%eax,4) Intel: [eax*4 + _array] ٬Ѫ 4˅˖ֻ∄˄ o൘ањᮤᮠᮠ㓴ѝራ൰ањ٬ AT&T: _variable(%eax) Intel: [eax + _variable] o䙊䗷ᇴᆈಘѝⲴ޵ᇩ֌Ѫส൰ራ൰ањਈ䟿˖ AT&T: (%eax) Intel: [eax] oሩᇴᆈಘ޵ᇩᤷੁⲴս㖞ራ൰˖ ተ˅C ਈ䟿(booga)Ⲵᯩ⌅DŽޘ˄⌘᜿˖ਈ䟿ࡽⲴлࡂ㓯ᱟӾ≷㕆〻ᒿѝᗇࡠ䶉ᘱ AT&T: _booga Intel: [_booga] oሩањᤷᇊⲴ C 䈝䀰ਈ䟿ራ൰˖ ӋֻᆀDŽ ൘ᓄ⭘ᰦˈᒦн䴰㾱߉ࠪᡰᴹ䘉Ӌᆇ⇥ˈն immed32 ઼ basepointer ѻѝᗵ享ᴹањᆈ൘DŽԕлᱟа 䈕Ṭᔿራ൰ս㖞Ⲵ䇑㇇ᯩᔿѪ˖immed32 + basepointer + indexpointer * indexscale Intel: [basepointer + indexpointer*indexscal + immed32] AT&T: immed32(basepointer, indexpointer, indexscale) GNU ≷㕆䈝䀰䟷⭘Ⲵᱟ AT&T Ⲵ≷㕆䈝䀰䈝⌅DŽ32 սራ൰Ⲵ↓㿴ṬᔿѪ˖ 8.5.3.1 GNU ≽㕌䈣䀶Ⲻ 32 փሱ൶ᯯᕅ 8.5.3 ެԌؗᚥ   LUHW SRSOHD[ RXWEDO[ PRYE[DO SXVKOHD[ BSDUDOOHOBLQWHUUXSW ᵜ⡸ᵜ޵Ṩ䘈ᵚᇎ⧠DŽ䘉䟼ਚᱟਁ䘱 (2, ᤷԔDŽ LQW[ ᒦ㹼ਓѝᯝ༴⨶〻ᒿˈሩᓄ⺜Ԧѝᯝ䈧≲ؑਧ ,54DŽ LQW  LUHW SRSOHD[ SRSOHF[ SRSOHG[ SRSGV SRSHV SRSIVкਕ䈳⭘ GRBIORSS\ ᤷੁⲴ࠭ᮠDŽ HD[LQWHUHVWLQJZD\RIKDQGOLQJLQWU䰤᧕䈳⭘DŽ FDOO PRYOBXQH[SHFWHGBIORSS\BLQWHUUXSWHD[  DŽ MQHI㤕オˈࡉ֯ᤷ䪸ᤷੁ & ࠭ᮠ XQH[SHFWHGBIORSS\BLQWHUUXSW WHVWOHD[HD[⍻䈅࠭ᮠᤷ䪸ᱟ੖ 18//" [FKJOBGRBIORSS\HD[ [RUOHD[HD[  DŽ XQH[SHFWHGBIORSS\BLQWHUUXSW GRBIORSS\ ਈ䟿㖞オDŽ❦ਾ⍻䈅 HD[ ѝ৏ᤷ䪸ᱟ੖Ѫオˈ㤕ᱟࡉ֯ᤷ䪸ᤷੁ & ࠭ᮠ   V\VWHPBFDOOV 〻ᒿ  IQBSWUV\VBFDOOBWDEOH>@ ^V\VBVHWXSV\VBH[LWV\VBIRUNV\VBUHDG ࠭ᮠᤷ䪸ᮠ㓴㺘DŽ  H[WHUQLQWV\VBVHWKRVWQDPH ⭘༴⨶࠭ᮠⲴ਽〠ˈ㿱ྲлᡰ⽪DŽ⌘᜿ˈаᇊ㾱ѕṬ᤹➗࣏㜭ਧ亪ᒿᧂࡇ࠭ᮠ਽DŽ ᯠ㌫㔏䈳ޕཆ䜘࠭ᮠ༠᰾ᒦ൘࠭ᮠᤷ䪸㺘 sys_call_table ᵛㄟᨂޕ᧕⵰൘ include/linux/sys.h ᮷Ԧѝ࣐  QDPHLQWOHQ FKDU LQWVHWKRVWQDPH ᯠ㌫㔏䈳⭘࠭ᮠ৏රDŽ GHILQHBB15BVHWKRVWQDPH ᯠ㌫㔏䈳⭘࣏㜭ਧDŽ 㜭ਧˈ൘ 251 㹼ਾ䶒␫࣐৏රᇊѹ˖ ࣏ޕ❦ਾ൘ include/unistd.h ᮷Ԧѝ໎࣐ᯠ㌫㔏䈳⭘࣏㜭ਧ઼৏රᇊѹDŽֻྲਟԕ൘ㅜ 131 㹼ਾ䶒࣐ ` UHWXUQ `  L@WKLVQDPHQRGHQDPH>L!0$;+2671$0(/(1"0$;+2671$0(/(1 WKLVQDPHQRGHQDPH>L@ ^ LI ` EUHDN    QDPHL WKLVQDPHQRGHQDPH>L@ JHWBIVBE\WH LI L ^OHQL L IRU UHWXUQ(,19$/  OHQ!0$;+2671$0(/(1 LI UHWXUQ(3(50  VXVHU LI  LQWL ^  QDPHLQWOHQ FKDU LQWV\VBVHWKRVWQDPH GHILQH0$;+2671$0(/(1 㔃ᶴˈഐ↔䘈䴰㾱ᢺ sys_uname()ѝⲴ thisname 㔃ᶴ˄218-220 㹼˅〫ࣘࡠ䈕࠭ᮠཆ䜘DŽ Ҿ؞᭩㌫㔏Ⲵ䇑㇇ᵪ਽〠DŽ䙊ᑨ䘉њ༴⨶࠭ᮠਟԕ᭮㖞൘ kernel/sys.c 〻ᒿѝDŽਖཆˈ⭡Ҿ֯⭘Ҷ thisname 〻ᒿѝ㕆ࡦࠪᯠ㌫㔏䈳⭘Ⲵ༴⨶࠭ᮠˈֻྲ਽〠Ѫ sys_sethostname()Ⲵ࠭ᮠDŽ䈕࠭ᮠ⭘ޣ俆ݸ൘⴨ ԕлаӋһᛵDŽڊ㾱 ҏᓄ䈕㘳㲁ࡠ㌫㔏䈳⭘Ⲵ䙊⭘ᙗ઼ਟ〫ἽᙗDŽྲ᷌ᡁԜᜣѪ Linux 0.11 ໎࣐ᯠⲴ㌫㔏䈳⭘࣏㜭ˈ䛓Ѹ䴰 ⭘Ⲵ৲ᮠǃ䘄എ٬઼䭉䈟⸱DŽ㌫㔏䈳⭘Ⲵ᧕ਓᓄ䈕ቭ䟿ㆰ⌱ˈഐ↔৲ᮠᓄቭਟ㜭ൠቁDŽ䘈ᴹˈ൘䇮䇑ᰦ ㌫㔏нᨀّањ㌫㔏䈳⭘⭘ᶕᇎ⧠ཊ⿽⭘䙄˄䲔Ҷ ioctl()㌫㔏䈳⭘˅DŽਖཆˈᡁԜ䘈䴰㾱⺞ᇊᯠⲴ㌫㔏䈳 㤕㾱Ѫ㠚ᐡⲴ޵Ṩᇎ⧠ањᯠⲴ㌫㔏䈳⭘࣏㜭ˈ䛓ѸᡁԜ俆ݸᓄ䈕ߣᇊᆳⲴ⺞࠷⭘䙄ᱟӰѸDŽLinux 8.5.3.2 ໔ࣖ㌱㔕䈹⭞ࣕ㜳 AT&T: _array(%ebx,%eax,8) Intel: [ebx + eax*8 + _array] ൰˖〫ٿㅖ൘䇠ᖅѝⲴ o൘ањ 8 ᆇ㢲Ѫањ䇠ᖅⲴᮠ㓴ѝራ൰ᤷᇊⲴᆇㅖDŽަѝ eax ѝᱟᤷᇊⲴ䇠ᖅਧˈebx ѝᱟᤷᇊᆇ   V\VWHPBFDOOV 〻ᒿ ˈаṧޘ㓿䗷Ⲵ。ᮠ˄ᰕশᰦ䰤˅ˈ֌Ѫᔰᵪᰦ䰤DŽ䈕࠭ᮠоḷ߶ C ᓃѝᨀ׋Ⲵ mktime()࠭ᮠⲴ࣏㜭ᆼ 䈕䈕〻ᒿਚᴹањ࠭ᮠ kernel_mktime()ˈӵ׋޵Ṩ֯⭘DŽ䇑㇇Ӿ 1970 ᒤ 1 ᴸ 1 ᰕ 0 ᰦ䎧ࡠᔰᵪᖃᰕ 8.6.1 ࣕ㜳ᨅ䘦 8.6 mktime.c ぁᓅ >XVUURRW@ +HOOR:RUOG >XVUURRW@DVP >XVUURRW@OGRDVPDVPR >XVUURRW@DVRDVPRDVPV 僔ྲл˖ ৲ᮠDŽ൘䈳⭘㌫㔏䈳⭘ѻࡽ䘉 3 њ৲ᮠ࠶࡛㻛ᆈ᭮൘ᇴᆈಘ ebxǃecx ઼ edx ѝDŽ䈕〻ᒿ㕆䈁઼ᢗ㹼Ⲵ↕ Ⲵ C ࠭ᮠ⭣᰾Ѫ sys_write(int fd, char *buf, int len)ˈ৲㿱〻ᒿ fs/read_write.cˈӾ 83 㹼ᔰ࿻DŽᆳᑖᴹ 3 њ ަѝ֯⭘Ҷєњ㌫㔏䈳⭘˖4 - ߉᮷Ԧ᫽֌ sys_write()઼ 1 - 䘰ࠪ〻ᒿ sys_exit()DŽ߉᮷Ԧ㌫㔏䈳⭘ᡰᢗ㹼  DVFLL+HOOR:RUOG?QⅢ߉ⲴᮠᦞDŽ PHVVDJH   LQW[  PRYOHD[㌫㔏䈳⭘ਧˈ䘰ࠪ〻ᒿDŽ  LQW[ ᮠᮠл䶒ᆇㅖѢⲴ䮯ᓖ-˅DŽ˄ PRYOHG[৲ᮠˈ߉ᮠᦞ䮯ᓖ٬  PRYOPHVVDJHHF[৲ᮠˈ㕃ߢ४ᤷ䪸DŽ ሩᓄḷ߶䗃ࠪ VWGRXWDŽ   PRYOHE[߉䈳⭘Ⲵ৲ᮠˈᱟ᮷Ԧ᧿䘠ㅖDŽᮠ٬  PRYOHD[㌫㔏䈳⭘ਧˈ߉᫽֌DŽ BHQWU\ WH[W Ⲵ࠭ᮠDŽ䈕〻ᒿྲл˖ ൘ Linux ㌫㔏ѝ⭘≷㕆䈝䀰㕆ࡦࠪањ⤜・Ⲵ〻ᒿᶕˈণн֯⭘䎧࿻ԓ⸱⁑ඇ˄ֻྲ crt0.o˅઼ᓃ᮷Ԧѝ ㌫઼४࡛ᱟ㔉ࠪⲴањㆰঅֻᆀ asm.sDŽ䈕ֻᆀ䈤᰾Ҷྲօޣл䶒ᱟ Linus ൘䈤᰾ as86 о GNU as Ⲵ 8.5.3.3 ൞≽㕌ぁᓅѣ⴪᧛ֵ⭞㌱㔕䈹⭞   QDPHLQWOHQ LQWVHWKRVWQDPHFKDU BV\VFDOO  XQLVWGK!LQFOXGH GHILQHBB/,%5$5$'   >$'   >$'   >$'   >$'   >$'   >$'   >$'   >$'   >$'  ^ @<VWDWLFLQWPRQWK л䶒ԕᒤѪ⭼䲀ˈᇊѹҶ⇿њᴸᔰ࿻ᰦⲴ。ᮠᰦ䰤DŽ  ᴹ䏓ⲴᱟᡁԜ㘳㲁䘋Ҷ䰠ᒤ   LQWHUHVWLQJO\ZHDVVXPHOHDS\HDUV   '$<  ᒤⲴ。ᮠDŽ  GHILQH<($5 +285  ཙⲴ。ᮠDŽ  GHILQH'$< 0,187(  ሿᰦⲴ。ᮠDŽ  GHILQH+285 GHILQH0,187( ࠶䫏Ⲵ。ᮠDŽ   㖇傜ᮉⲷǃѫᮉˈᡁӰѸ䜭н൘ѾDŽᡁᱟњ㝮≄᳤䒱ⲴӪDŽ   ᒤᔰ࿻ⲴӪ䳮䚃ԆԜቡн㜭䘹ᤙӾањ䰠ᒤᔰ࿻˛ᡁᚘṬ䟼儈࡙শǃ ਖཆˈᡁᚘ䛓њ䇮㖞  ᔰⲴ˅DŽޜ˄ቭ㇑ᡁ䇔Ѫ PLQL[ Ⲵᰦ䰤࠭ᮠᱟ  ᔰⲴᓃ࠭ᮠޜ਼ṧˈᰦ䰤४ฏ 7= 䰞仈ҏݸᘭ⮕DŽᡁԜਚᱟቭਟ㜭ㆰঅൠ༴⨶䰞仈DŽᴰྭ㜭᢮ࡠаӋ  ᇊа࠷൷ᖸ↓ᑨDŽٷ ᒤⲴᒤԭㅹˈն ᗳሿҾޣ䘉нᱟᓃ࠭ᮠˈᆳӵ׋޵Ṩ֯⭘DŽഐ↔ᡁԜн      PJUXPS\ DOHDS\HDULQVWHDG",DOVRKDWH*UHJRULXVSRSHRUQR,  WWKH\KDYHJRWWHQ FRXOGQ36,KDWHZKRHYHUWKRXJKXSWKH\HDU       DOWKRXJK,WKLQNPLQL[WLPHVLVSXEOLF URXWLQHV  VILQGVRPHWKLQJSXEOLFIRUWKHOLEUDU\ DVHDVLO\DVSRVVLEOH/HW  LVRN6LPLODUO\7=HWFLVKDSSLO\LJQRUHG:HMXVWGRHYHU\WKLQJ  HWFEXWDVVXPHHYHU\WKLQJWFDUHDERXW\HDUV DVVXFKZHGRQ  WWKHOLEUDU\URXWLQHLWLVRQO\XVHGLQWKHNHUQHO 7KLVLVQ     WLPHK!ᰦ䰤ཤ᮷ԦˈᇊѹҶḷ߶ᰦ䰤ᮠᦞ㔃ᶴ WP ઼аӋ༴⨶ᰦ䰤࠭ᮠ৏රDŽLQFOXGH    /LQXV7RUYDOGV &     OLQX[NHUQHOPNWLPHF     ぁᓅ 8-5 linux/kernel/mktime.c ぁᓅ 8.6.2 ԙ⸷⌞䠀 ѝⲴ࠭ᮠˈഐ↔䘉䟼ቡᗵ享㠚ᐡу䰘㕆߉ањҶDŽ 䜭ᱟሶ tm 㔃ᶴ㺘⽪Ⲵᰦ䰤䖜ᦒᡀ UNIX ᰕশᰦ䰤DŽնᱟ⭡Ҿ޵ṨнᱟᲞ䙊〻ᒿˈн㜭䈳⭘ᔰਁ⧟ຳᓃ   PNWLPHF 〻ᒿ 䖟ⴈᇊᰦ᫽֌Ⲵࠐњ࠭ᮠ᭮ࡠҶ䘉䟼DŽ ޣᇊᰦ࠭ᮠ do_timer()ҏ㻛᭮㖞൘ᵜ〻ᒿѝDŽਖཆˈѪҶׯҾ䖟ⴈ傡ࣘಘᇊᰦ༴⨶Ⲵ㕆〻ˈLinus ҏሶᴹ wakeup()ǃschedule()ㅹ)ԕ৺аӋㆰঅⲴ㌫㔏䈳⭘࠭ᮠ˄∄ྲ getpid()˅DŽ㌫㔏ᰦ䫏ѝᯝ༴⨶䗷〻ѝ䈳⭘Ⲵ 䈳ᓖⲴสᵜ࠭ᮠ(sleep_on()ǃޣԫ࣑˄䘋〻˅䈳ᓖ㇑⨶Ⲵ〻ᒿˈަѝवᤜᴹޣ sched.c ᱟ޵Ṩѝᴹ 8.7.1 ࣕ㜳ᨅ䘦 8.7 sched.c ぁᓅ ྲ᷌ y 㜭㻛 4 ᮤ䲔фн㜭㻛 100 䲔ቭˈᡆ㘵㜭㻛 400 ᮤ䲔ˈࡉ y ᱟ䰠ᒤDŽ 䰠ᒤⲴสᵜ䇑㇇ᯩ⌅ᱟ˖ 8.6.3.1 䰦ᒪᰬ䰪Ⲻ䇗㇍ᯯ⌋ 8.6.3 ެԌؗᚥ   `  ᒤԕᶕ㓿䗷Ⲵ。ᮠᰦ䰤DŽ ণㅹҾӾUHWXUQUHV ޽࣐к  ࠶䫏޵ᐢ䗷Ⲵ。ᮠDŽUHV WP!WPBVHF ޽࣐к  ሿᰦ޵䗷৫Ⲵ࠶䫏ᮠⲴ。ᮠᰦ䰤DŽWP!WPBPLQ UHV 0,187( ޽࣐кᖃཙ䗷৫ⲴሿᰦᮠⲴ。ᮠᰦ䰤DŽWP!WPBKRXU UHV +285 ޽࣐кᵜᴸ䗷৫ⲴཙᮠⲴ。ᮠᰦ䰤DŽ WP!WPBPGD\ UHV '$< UHV '$<   \HDU  WP!WPBPRQ! LI  ߿৫аཙⲴ。ᮠᰦ䰤 DŽ \ нᱟ䰠ᒤˈ䛓ѸᡁԜቡᗵ享䘋㹼䈳ᮤ \ DŽྲ᷌ ԕ৺   WDOHDS\HDUZHKDYHWRDGMXVW \ KHUH,ILWZDVQ DQG  UHV PRQWK>WP!WPBPRQ@   \HDU \HDU'$< UHV <($5   \ ѪҶ㧧ᗇ↓⺞Ⲵ䰠ᒤᮠˈ䘉䟼䴰㾱䘉ṧањ冄ᒫ٬   \ QHHGHGWRJHWOHDS\HDUVULJKW PDJLFRIIVHWV  \HDU WP!WPB\HDU ᮠ˅ቡнᱟ䰠ᒤDŽ \ 㜭㻛  䲔ቭDŽ㤕н㜭䲔ቭ˄ᴹ։ ѪӾ  ᒤᔰ࿻㇇䎧ˈᡰԕᖃᒤᱟ䰠ᒤⲴࡔᯝᯩ⌅ᱟ ཊ㇇Ҷ ཙDŽഐ↔ˈ㤕ᖃᒤнᱟ䰠ᒤᒦфᖃࡽᴸԭབྷҾ ᴸԭⲴ䈍ˈᡁԜቡ㾱߿৫䘉ཙDŽഐ Ⲵ。ᮠDŽਖཆˈPRQWK>@ᮠ㓴ѝᐢ㓿൘  ᴸԭⲴཙᮠѝवਜ਼䘋Ҷ䰠ᒤᰦⲴཙᮠˈণ  ᴸԭཙᮠ \ DŽUHV 䘉Ӌᒤ㓿䗷Ⲵ。ᮠᰦ䰤⇿њ䰠ᒤᰦཊ  ཙⲴ。ᮠᰦ䰤ᖃᒤࡠᖃᴸᰦ  \ ˈণѪ   ᒤᔰ࿻Ⲵ䰠ᒤᮠ䇑㇇ᯩ⌅ቡᓄ䈕ᱟѪ ቡᱟㅜ  њ䰠ᒤˈ䘉ṧӾ  ᒤቡᱟањ䰠ᒤˈഐ↔䗷  ᒤ˄ˈˈ˅  ᒤ㇇䎧DŽࡠ ⭡Ҿ 81,; 䇑ᒤԭ \ ᱟӾ   WP!WPB\HDUWP!WPB\HDU ㆰঅൠ൘ᴰࡽ䶒␫࣐аᶑ䈝ਕᶕ䀓ߣ䘉њ䰞仈˖LI 俆ݸ䇑㇇  ᒤࡠ⧠൘㓿䗷ⲴᒤᮠDŽഐѪᱟ  ս㺘⽪ᯩᔿˈᡰԕՊᴹ  ᒤ䰞仈DŽᡁԜਟԕ  LQW\HDU ORQJUHV ^  WP VWUXFWWP ORQJNHUQHOBPNWLPH ᚟ਆ㠚 &026DŽؑˈ৲ᮠ WP ѝ਴ᆇ⇥ᐢ㓿൘ LQLWPDLQF ѝ㻛䍻٬  ᒤ  ᴸ  ᰕ  ᰦ䎧ࡠᔰᵪᖃᰕ㓿䗷Ⲵ。ᮠˈ֌Ѫᔰᵪᰦ䰤DŽ 䈕࠭ᮠ䇑㇇Ӿ  `   '$<   VFKHGF 〻ᒿ S S ᯠᖃࡽԫ࣑ ਾᒦ൘㻛୔䟂䘄എѻࡽ 䈳⭘ VFKHGXOH ⧠Ѫᯠㅹᖵԫ࣑ ৏ᖃࡽԫ࣑ S WPS  ᰦ 䈳⭘ VFKHGXOH ࠭ᮠᰦޕ䘋 ᖃࡽԫ࣑ WPS ৏ㅹᖵԫ࣑ ᖃࡽԫ࣑ S FXUUHQW WPS FXUUHQW ৏ㅹᖵԫ࣑ FXUUHQW ৏ㅹᖵԫ࣑ S S 䈕࠭ᮠᰦˈ䱏ࡇཤᤷ䪸*p ᤷੁᐢ㓿൘ㅹᖵ䱏ࡇѝㅹᖵⲴԫ࣑㔃ᶴ˄䘋〻᧿䘠ㅖ˅DŽᖃ❦ˈޕᖃࡊ䘋  ࠳ᮦѣ᤽䪾਎ौ⽰ᝅഴȾ ഴ VOHHSBRQ  Ⲵ⽪᜿മ䈤᰾DŽമѝⲴ䮯ᶑ㺘⽪޵ᆈᆇ㢲ᒿࡇDŽ ൘ᖃࡽԫ࣑޵ṨᘱึḸк˗current ᱟᖃࡽԫ࣑ᤷ䪸DŽሩҾ䘉Ӌᤷ䪸൘޵ᆈѝⲴਈॆᛵߥᡁԜਟԕ⭘മ 8-6 i 㢲⛩Ⲵ i_wait ᤷ䪸ǃ޵ᆈ㕃ߢ᫽֌ѝⲴ buffer_wait ᤷ䪸ㅹ˗tmp ᱟ൘࠭ᮠึḸкᔪ・ⲴѤᰦᤷ䪸ˈᆈۘ ࡠሩйњԫ࣑ᤷ䪸᫽֌˖*pǃtmp ઼ currentˈ*p ᱟㅹᖵ䱏ࡇཤᤷ䪸ˈྲ᮷Ԧ㌫㔏޵ᆈ⎹⢥ޡ࠭ᮠѝ ㌫DŽ ㅹᖵ䱏ࡇⲴᯩᔿᱟ࡙⭘Ҷ࠭ᮠѝⲴ tmp ᤷ䪸֌Ѫ਴њ↓൘ㅹᖵԫ࣑Ⲵ㚄ޕᖃ࠷ᦒഎᶕਾ޽㔗㔝䘀㹼DŽ᭮ ањ䘋〻˄ᡆԫ࣑˅ᡰ䈧≲Ⲵ䍴Ⓚ↓ᘉᡆн൘޵ᆈѝᰦᲲᰦ࠷ᦒࠪ৫ˈ᭮൘ㅹᖵ䱏ࡇѝㅹᖵа⇥ᰦ䰤DŽ ত㾱∄ schedule()࠭ᮠ䳮⨶䀓DŽ䘉䟼⭘മ⽪Ⲵᯩ⌅࣐ԕ䀓䟺DŽㆰঅൠ䈤ˈsleep_on()࠭ᮠⲴѫ㾱࣏㜭ᱟᖃ ⶑⵐ࠭ᮠ sleep_on()઼୔䟂࠭ᮠ wake_up()ˈ䘉єњ࠭ᮠ㲭❦ᖸ⸝ˈޕਖєњ٬ᗇаᨀⲴ࠭ᮠᱟ㠚ࣘ䘋 ٬DŽ⡷counterˈ޽䟽ᯠᢗ㹼ᗚ⧟Ựḕᡰᴹԫ࣑Ⲵᢗ㹼ᰦ䰤 ٬⡷䰤 priorityˈ䟽㖞⇿њԫ࣑Ⲵ䘀㹼ᰦ 㺘⽪↔࡫ᡰᴹԫ࣑Ⲵᰦ䰤⡷䜭ᐢ㓿䘀㹼ᆼˈҾᱟቡṩᦞԫ࣑ⲴՈݸᵳ٬ 䘹ਆ䈕٬ᴰབྷⲴањԫ࣑ˈᒦ࡙⭘ switch_to()࠭ᮠ࠷ᦒࡠ䈕ԫ࣑DŽ㤕ᡰᴹቡ㔚ᘱԫ࣑Ⲵ䈕٬䜭ㅹҾ䴦ˈ counterˈ ᢗ㹼Ⲵԫ࣑DŽᆳ俆ݸᗚ⧟Ựḕԫ࣑ᮠ㓴ѝⲴᡰᴹԫ࣑ˈṩᦞ⇿њቡ㔚ᘱԫ࣑࢙։ᢗ㹼ᰦ䰤Ⲵ٬ 䲿ਾᱟ䈳ᓖ࠭ᮠⲴṨᗳ༴⨶䜘࠶DŽ䘉䜘࠶ԓ⸱ṩᦞ䘋〻Ⲵᰦ䰤⡷઼Ոݸᵳ䈳ᓖᵪࡦˈᶕ䘹ᤙ䲿ਾ㾱 Ѫቡ㔚⣦ᘱ˄TASK_RUNNING˅DŽ 㻛䱫ຎⲴؑਧཆ䘈ᴹަԆؑਧˈᒦфԫ࣑༴Ҿਟѝᯝⶑⵐ⣦ᘱ˄TASK_INTERRUPTIBLE˅ˈࡉ㖞ԫ࣑ jiffies ᱟ㌫㔏Ӿᔰᵪᔰ࿻㇇䎧Ⲵ┤ㆄᮠ˄10ms/┤ㆄ˅DŽ൘ sched.h ѝᇊѹDŽྲ᷌䘋〻Ⲵؑਧսമѝ䲔৫ ٬DŽ ԫ࣑Ⲵ alarm ᰦ䰤ᐢ㓿䗷ᵏ(alarmL@ VKRZBWDVN  WDVN>L@ LI  L15B7$6.6L L IRU  LQWL ^  YRLG YRLGVKRZBVWDW  њ ˈᇊѹ൘ LQFOXGHNHUQHOVFKHGKㅜ  㹼DŽ ԫ࣑ ᮠ䟿 15B7$6.6 ᱟ㌫㔏㜭ᇩ㓣Ⲵᴰབྷ䘋〻 ᱮ⽪ᡰᴹԫ࣑Ⲵԫ࣑ਧǃ䘋〻ਧǃ䘋〻⣦ᘱ઼޵ṨึḸオ䰢ᆇ㢲ᮠ˄བྷ㓖˅DŽ  `  RIG FKDUVIUHHLQNHUQHOVWDFN?Q?ULM G SULQWN L S >L@ Ự⍻ᤷᇊԫ࣑ᮠᦞ㔃ᶴԕਾㅹҾ  Ⲵᆇ㢲ᮠDŽ FKDU  ML ZKLOH  L  SLG GVWDWH GQUS!SLGS!VWDWHG SULQWN   VWUXFWWDVNBVWUXFW VL]HRI LQWLM ^  S LQWQUVWUXFWWDVNBVWUXFW YRLGVKRZBWDVN ޵Ṩ䈳䈅࠭ᮠDŽᱮ⽪ԫ࣑ਧ QU Ⲵ䘋〻ਧǃ䘋〻⣦ᘱ઼޵ṨึḸオ䰢ᆇ㢲ᮠ˄བྷ㓖˅DŽ   6,*6723 6,*.,// _B6 B6 a GHILQHB%/2&.$%/( ĂE DŽ 䲔Ҷ 6,*.,// ઼ 6,*6723 ؑਧԕཆަԆؑਧ䜭ᱟਟ䱫ຎⲴ   QU   QU GHILQHB6    EDŽ  䈕ᆿਆؑਧ QU ൘ؑਧսമѝሩᓄսⲴҼ䘋ࡦᮠ٬DŽؑਧ㕆ਧ DŽ∄ྲؑਧ  Ⲵսമᮠ٬ㅹҾ  VLJQDOK!ؑਧཤ᮷ԦDŽᇊѹؑਧㅖਧᑨ䟿ˈVLJDFWLRQ 㔃ᶴˈ᫽֌࠭ᮠ৏රDŽLQFOXGH  ᔿ≷㕆࠭ᮠDŽޕᇴᆈಘ᫽֌Ⲵ፼⇥ޣDVPVHJPHQWK!⇥᫽֌ཤ᮷ԦDŽᇊѹҶᴹLQFOXGH 䗃ࠪᆿ≷㕆䈝ਕDŽޕDVPLRK!LR ཤ᮷ԦDŽᇊѹ⺜Ԧㄟਓ䗃LQFOXGH ᔿ≷㕆ᆿDŽޕDVPV\VWHPK!㌫㔏ཤ᮷ԦDŽᇊѹҶ䇮㖞ᡆ؞᭩᧿䘠ㅖѝᯝ䰘ㅹⲴ፼LQFOXGH OLQX[IGUHJK!䖟傡ཤ᮷ԦDŽਜ਼ᴹ䖟ⴈ᧗ࡦಘ৲ᮠⲴаӋᇊѹDŽLQFOXGH ᔰཤDŽ V\VB OLQX[V\VK!㌫㔏䈳⭘ཤ᮷ԦDŽਜ਼ᴹ  њ㌫㔏䈳⭘ & ࠭ᮠ༴⨶〻ᒿԕLQFOXGH OLQX[NHUQHOK!޵Ṩཤ᮷ԦDŽਜ਼ᴹаӋ޵Ṩᑨ⭘࠭ᮠⲴ৏ᖒᇊѹDŽLQFOXGH OLQX[VFKHGK!LQFOXGH ᔿ≷㕆࠭ᮠ〻ᒿDŽޕ䘠ㅖ৲ᮠ䇮㖞઼㧧ਆⲴ፼᧿ޣⲴᖒᔿᇊѹⲴᴹ л䶒ᱟ䈳ᓖ〻ᒿཤ᮷ԦDŽᇊѹҶԫ࣑㔃ᶴ WDVNBVWUXFWǃㅜ  њࡍ࿻ԫ࣑ⲴᮠᦞDŽ䘈ᴹаӋԕᆿ    ˈӵӾᖃࡽԫ࣑ѝ㧧ਆањᆇ⇥˅DŽ ԕ৺аӋㆰঅⲴ㌫㔏䈳⭘࠭ᮠ˄∄ྲ JHWSLG   VOHHSBRQǃZDNHXSǃVFKHGXOH ㅹ 䈳ᓖⲴสᵜ࠭ᮠޣᱟѫ㾱Ⲵ޵Ṩ᮷ԦDŽަѝवᤜᴹ VFKHGF       FXUUHQWWDVN   ZKLFKMXVWH[WUDFWVDILHOGIURP W\SHJHWSLG FDOOIXQFWLRQV  VOHHSBRQZDNHXSVFKHGXOHHWF DVZHOODVDQXPEHURIVLPSOHV\VWHP   LVWKHPDLQNHUQHOILOH,WFRQWDLQVVFKHGXOLQJSULPLWLYHV VFKHGF     VFKHGF 〻ᒿ ^  YRLGPDWKBVWDWHBUHVWRUH ᶕⲴᖃࡽԫ࣑Ⲵॿ༴⨶ಘᢗ㹼⣦ᘱDŽ ᆈ৏ԫ࣑Ⲵॿ༴⨶ಘ⣦ᘱ˄кл᮷˅ᒦᚒ༽ᯠ䈳ᓖ䘋؍ᖃԫ࣑㻛䈳ᓖӔᦒ䗷ԕਾˈ䈕࠭ᮠ⭘ԕ   ޵ᇩ࣐䖭䘋ॿ༴⨶ಘDŽ  ᆈࡠ㘱ॿ༴⨶ಘ⣦ᘱᮠ㓴ѝˈᒦሶᖃࡽԫ࣑Ⲵॿ༴⨶ಘ؍ሶᖃࡽॿ༴⨶ಘ޵ᇩ      ROGPDWKVWDWHDUUD\DQGJHWVWKHQHZRQHVIURPWKHFXUUHQWWDVN  VDYHVWKHFXUUHQWPDWKLQIRUPDWLRQLQWKH PDWKBVWDWHBUHVWRUH     XVHUBVWDFN>3$*(B6,=(!!@[` `VWDFNBVWDUW ^ VKRUWE D ORQJ VWUXFW^  ORQJXVHUBVWDFN>3$*(B6,=(!!@ Ḹ޵ᇩDŽޕᆈ؍ਾ൘ VS ᤷ䪸༴❦ˈ٬ ഐѪ ,QWHO&38 ᢗ㹼ึḸ᫽֌ᰦᱟݸ䙂߿ึḸᤷ䪸 VS VV 㻛䇮㖞Ѫ޵Ṩᮠᦞ⇥䘹ᤙㅖ˄[˅ˈᤷ䪸 HVS ᤷ൘ XVHUBVWDFN ᮠ㓴ᴰਾа亩ਾ䶒DŽ䘉ᱟ HVS˄ᮠᦞ⇥䘹ᤙㅖˈᤷ䪸˅ˈ㿱 KHDGVˈㅜ  㹼DŽᡧᘱḸDŽл䶒㔃ᶴ⭘Ҿ䇮㖞ึḸ VV ԕਾሶ㻛⭘֌ԫ࣑  Ⲵ⭘ᡧᘱึḸDŽ൘䘀㹼ԫ࣑  ѻࡽᆳᱟ޵ṨḸˈԕਾ⭘֌ԫ࣑  ઼  Ⲵ⭘ 亩ˈᇩ䟿 . ᆇ㢲DŽ൘޵Ṩࡍ࿻ॆ᫽֌䗷〻ѝ㻛⭘֌޵ṨḸˈࡍ࿻ॆᆼᡀ . ޡˈᇊѹ⭘ᡧึḸ  ᇊѹԫ࣑ᤷ䪸ᮠ㓴DŽLQLWBWDVNWDVN ` WDVN>15B7$6.6@ ^ VWUXFWWDVNBVWUXFW  ֯⭘䗷ॿ༴⨶ಘԫ࣑Ⲵᤷ䪸DŽODVWBWDVNBXVHGBPDWK 18// VWUXFWWDVNBVWUXFW ᖃࡽԫ࣑ᤷ䪸˄ࡍ࿻ॆᤷੁԫ࣑ ˅DŽ LQLWBWDVNWDVN  FXUUHQW VWUXFWWDVNBVWUXFW  ᔰ࿻䇑ᰦⲴ。ᮠDŽ ᔰᵪᰦ䰤DŽӾ ORQJVWDUWXSBWLPH  ORQJYRODWLOHMLIILHV ㅹ〻ᒿՊ؞᭩ᆳⲴ٬DŽ MLIILHV䘋㹼Ոॆ༴⨶ˈҏн㾱ᥚࣘս㖞ˈᒦф䴰㾱Ӿ޵ᆈѝਆަ٬DŽഐѪᰦ䫏ѝᯝ༴⨶䗷〻 䲀ᇊㅖˈ䇙ԓ⸱൘ᕅ⭘䈕ਈ䟿ᰦаᇊ㾱Ӿᤷᇊ޵ᆈս㖞ѝਆᗇަ٬DŽ䘉䟼ণᱟ㾱≲JFF н㾱ሩ HE[ ѝⲴ٬ᒦнՊ䲿ѻᴤᯠDŽѪҶ䀓ߣ䘉⿽ᛵߥቡࡋᔪҶ YRODWLOHˈ؞᭩Ҷ޵ᆈѝ䈕ਈ䟿Ⲵ٬ ᗳ䈕ਈ䟿ሩᓄ޵ᆈս㖞ѝⲴ޵ᇩDŽ㤕↔ᰦަԆ〻ᒿ˄ֻྲ޵Ṩ〻ᒿᡆањѝᯝ䗷〻˅ޣቡнՊ޽ ቭ䟿ᢺᆳᆈ᭮൘䙊⭘ᇴᆈಘѝˈֻྲHE[ˈԕᨀ儈䇯䰞᭸⦷DŽᖃ &38 ᢺަ٬᭮ࡠHE[ ѝਾа㡜 ᤷ᰾ਈ䟿Ⲵ޵ᇩਟ㜭Պ⭡Ҿ㻛ަԆ〻ᒿ؞᭩㘼ਈॆDŽ䙊ᑨ൘〻ᒿѝ⭣᰾ањਈ䟿ᰦˈ㕆䈁ಘՊ ࡽ䶒Ⲵ䲀ᇊㅖYRODWLOHˈ㤡᮷䀓䟺ᱟ᱃᭩ਈⲴǃнっᇊⲴ᜿ᙍDŽ䘉њ䲀ᇊ䇽Ⲵਜ਼ѹᱟੁ㕆䈁ಘ ተਈ䟿˄PV┤ㆄ˅DŽ㌫㔏ᰦ䫏ѝᯝ⇿ਁ⭏а⅑ণањ┤ㆄDŽޘӾᔰᵪᔰ࿻㇇䎧Ⲵ┤ㆄᮠᰦ䰤٬  VFKHGKˈ DŽ ᇊѹࡍ࿻ԫ࣑ⲴᮠᦞVWDWLFXQLRQWDVNBXQLRQLQLWBWDVN ^,1,7B7$6.`  ` ѝˈᡰԕӾึḸ⇥ᇴᆈಘ VV ਟԕ㧧ᗇަᮠᦞ⇥䘹ᤙㅖDŽFKDUVWDFN>3$*(B6,=(@ ഐѪањԫ࣑Ⲵᮠᦞ㔃ᶴоަ޵ṨᘱึḸ൘਼а޵ᆈ亥VWUXFWWDVNBVWUXFWWDVN XQLRQWDVNBXQLRQ^ᇊѹԫ࣑㚄ਸ˄ԫ࣑㔃ᶴᡀઈ઼ VWDFN ᆇㅖᮠ㓴ᡀઈ˅DŽ ⇿њԫ࣑˄䘋〻˅൘޵Ṩᘱ䘀㹼ᰦ䜭ᴹ㠚ᐡⲴ޵ṨᘱึḸDŽ䘉䟼ᇊѹҶԫ࣑Ⲵ޵ṨᘱึḸ㔃ᶴDŽ  ㌫㔏䈳⭘ѝᯝ༴⨶〻ᒿ˄NHUQHOV\VWHPBFDOOVˈ˅DŽ YRLG H[WHUQLQWV\VWHPBFDOO ᰦ䫏ѝᯝ༴⨶〻ᒿ˄NHUQHOV\VWHPBFDOOVˈ˅DŽ YRLG H[WHUQLQWWLPHUBLQWHUUXSW  >""@⋑ᴹԫօൠᯩᇊѹ઼ᕅ⭘䈕࠭ᮠDŽ YRLG H[WHUQYRLGPHPBXVH    VFKHGF 〻ᒿ ^ MLIILHVS !DODUP  S !DODUP LI  㹼DŽ ᱟ㌫㔏Ӿᔰᵪᔰ࿻㇇䎧Ⲵ┤ㆄᮠ˄PV┤ㆄ˅DŽᇊѹ൘ VFKHGK ㅜ ؑਧˈণੁԫ࣑ਁ䘱 6,*$/$50 ؑਧDŽ❦ਾ␵ DODUPDŽ䈕ؑਧⲴ唈䇔᫽֌ᱟ㓸→䘋〻DŽMLIILHV MLIILHV ࡉ൘ؑਧսമѝ㖞 6,*$/50DODUP DODUPˈᒦфᐢ㓿䗷ᵏ ྲ᷌䇮㖞䗷ԫ࣑Ⲵᇊᰦ٬ S ^ LI  S),567B7$6. S!/$67B7$6.  S IRU Ӿԫ࣑ᮠ㓴ѝᴰਾањԫ࣑ᔰ࿻ᗚ⧟Ự⍻ DODUPDŽ൘ᗚ⧟ᰦ䐣䗷オᤷ䪸亩DŽ   ୔䟂ԫօᐢᗇࡠؑਧⲴਟѝᯝԫ࣑ˈ˅Ự⍻ DODUP˄䘋〻Ⲵᣕ䆖ᇊᰦ٬   FKHFNDODUPZDNHXSDQ\LQWHUUXSWLEOHWDVNVWKDWKDYHJRWDVLJQDO   ԫ࣑㔃ᶴᤷ䪸Ⲵᤷ䪸DŽS VWUXFWWDVNBVWUXFW LQWLQH[WF ^  YRLG YRLGVFKHGXOH   ᱟӾᶕн⭘ⲴDŽ VWDWH ᆳDŽᆳн㜭㻛ᵰ↫ˈҏн㜭ⶑⵐDŽԫ࣑  ѝⲴ⣦ᘱؑ᚟   ԫ࣑ˈਚᴹᖃ⋑ᴹަԆԫ࣑ਟԕ䘀㹼ᰦ᡽䈳⭘ LGOH ⌘᜿ʽʽԫ࣑  ᱟњ䰢㖞    һ٬ᗇ⮉᜿ˈ䛓ቡᱟ䘉䟼Ⲵؑਧ༴⨶ԓ⸱DŽ  ᆳਟԕ൘ᡰᴹⲴ⧟ຳлᐕ֌˄∄ྲ㜭ཏሩ ,2䗩⭼༴⨶ᖸྭⲴ૽ᓄㅹ˅DŽਚᴹаԦ  ᱟ䈳ᓖ࠭ᮠDŽ䘉ᱟњᖸྭⲴԓ⸱ʽ⋑ᴹԫօ⨶⭡ሩᆳ䘋㹼؞᭩ˈഐѪ VFKHGXOH       LQIRUPDWLRQLQWDVN>@LVQHYHUXVHG   VWDWH WDVNVFDQUXQ,WFDQQRWEHNLOOHGDQGLWFDQQRWVOHHS7KH  WDVNZKLFKJHWVFDOOHGZKHQQRRWKHU LGOH 127(7DVNLVWKH    7KHRQHWKLQJ\RXPLJKWWDNHDORRNDWLVWKHVLJQDOKDQGOHUFRGHKHUH   LHJLYHV,2ERXQGSURFHVVHVJRRGUHVSRQVHHWF LQDOOFLUFXPVWDQFHV  WEHDQ\UHDVRQWRFKDQJHWKLVDVLWVKRXOGZRUNZHOO SUREDEO\ZRQ  LVWKHVFKHGXOHUIXQFWLRQ7KLVLV*22'&2'(7KHUH VFKHGXOH      ` ` 䇮㖞֯⭘ᐢॿ༴⨶ಘḷᘇDŽ FXUUHQW!XVHGBPDWK ੁॿ༴⨶ಘਁࡍ࿻ॆભԔDŽ IQLQLW BBDVPBB `HOVH^  FXUUHQW!WVVL PIUVWRU BBDVPBB FXUUHQW!XVHGBPDWK ^ LI ODVWBWDVNBXVHGBPDWK FXUUHQW ભԔˈᒦ䇮㖞֯⭘Ҷॿ༴⨶ಘḷᘇDŽ ԫ࣑⭘䗷ॿ༴⨶ಘˈࡉᚒ༽ަ⣦ᘱDŽ੖ࡉⲴ䈍䈤᰾ᱟㅜа⅑֯⭘ˈҾᱟቡੁॿ༴⨶ಘਁࡍ࿻ॆ ⧠൘ˈODVWBWDVNBXVHGBPDWK ᤷੁᖃࡽԫ࣑ˈԕ༷ᖃࡽԫ࣑㻛Ӕᦒࠪ৫ᰦ֯⭘DŽ↔ᰦྲ᷌ᖃࡽ `  ODVWBWDVNBXVHGBPDWK!WVVL PIQVDYH BBDVPBB ODVWBWDVNBXVHGBPDWK ^ LI  IZDLW BBDVPBB ᆈަ⣦ᘱDŽ؍൘ਁ䘱ॿ༴⨶ಘભԔѻࡽ㾱ݸਁ :$,7 ᤷԔDŽྲ᷌књԫ࣑֯⭘Ҷॿ༴⨶ಘˈࡉ UHWXUQ  ODVWBWDVNBXVHGBPDWK FXUUHQW LI кањԫ࣑ቡᱟᖃࡽԫ࣑ DŽ䘉䟼кањԫ࣑ᱟᤷࡊ㻛Ӕᦒࠪ৫Ⲵԫ࣑DŽ ྲ᷌ԫ࣑⋑ਈࡉ䘄എ   VFKHGF 〻ᒿ )/%,FXUUHQW!VWDWH 7$6.B,17(55837 ^  YRLG LQWV\VBSDXVH  ⡸˅DŽ ˄ⴤࡠ ᇎ⧠ޘ 䘄എ٬ᓄ䈕ᱟˈᒦфHUUQR 㻛㖞Ѫ(,175DŽ䘉䟼䘈⋑ᴹᆼ Պ䘄എDŽ↔ᰦSDXVH  ᡽ 䈳⭘ањؑਧᦅ㧧࠭ᮠDŽਚᴹᖃᦅ㧧Ҷањؑਧˈᒦфؑਧᦅ㧧༴⨶࠭ᮠ䘄എˈSDXVH ⶑⵐ⣦ᘱˈⴤࡠ᭦ࡠањؑਧDŽ䈕ؑਧ⭘Ҿ㓸→䘋〻ᡆ㘵֯䘋〻ޕ䈕㌫㔏䈳⭘ሶሬ㠤䘋〻䘋  ㌫㔏䈳⭘DŽ䖜ᦒᖃࡽԫ࣑Ⲵ⣦ᘱѪਟѝᯝⲴㅹᖵ⣦ᘱˈᒦ䟽ᯠ䈳ᓖDŽ SDXVH  ` ࠷ᦒࡠԫ࣑ਧѪ QH[W Ⲵԫ࣑ˈᒦ䘀㹼ѻDŽ QH[W VZLWFKBWR ㌫㔏䈳⭘ˈᒦ৸Պ䈳⭘ᵜ࠭ᮠDŽ  ࡉQH[W ࿻㓸Ѫ DŽഐ↔䈳ᓖ࠭ᮠՊ൘㌫㔏オ䰢ᰦ৫ᢗ㹼ԫ࣑ DŽ↔ᰦԫ࣑  ӵᢗ㹼 SDXVH ࡠ䈕ԫ࣑ѝ䘀㹼DŽ൘  㹼QH[W 㻛ࡍ࿻ॆѪ DŽഐ↔㤕㌫㔏ѝ⋑ᴹԫօަԆԫ࣑ਟ䘀㹼ᰦˈ ⭘л䶒ᆿ˄ᇊѹ൘ VFKHGK ѝ˅ᢺᖃࡽԫ࣑ᤷ䪸 FXUUHQW ᤷੁԫ࣑ਧѪ QH[W Ⲵԫ࣑ˈᒦ࠷ᦒ ` S !SULRULW\   S !FRXQWHU!!  S !FRXQWHU   S LI  S),567B7$6. S!/$67B7$6.  S IRU F EUHDN LI Ⲵ䇑㇇ᯩᔿѪFRXQWHU FRXQWHUSULRULW\DŽ⌘᜿ˈ䘉䟼䇑㇇䗷〻н㘳㲁䘋〻Ⲵ⣦ᘱDŽ ਾഎࡠ  㹼䟽ᯠ∄䖳DŽFRXQWHU٬❦ˈ٬ ᴤᯠ⇿ањԫ࣑Ⲵ FRXQWHUˈ⇿њԫ࣑ⲴՈݸᵳ٬ ӽ❦ѪˈQH[W ˅ˈࡉ䘰ࠪ  㹼ᔰ࿻Ⲵᗚ⧟ˈᢗ㹼  㹼кⲴԫ࣑࠷ᦒ᫽֌DŽ੖ࡉቡṩᦞ ٬нㅹҾ  Ⲵ㔃᷌ˈᡆ㘵㌫㔏ѝ⋑ᴹањਟ䘀㹼Ⲵԫ࣑ᆈ൘˄↔ᰦ F ྲ᷌∄䖳ᗇࠪᴹ FRXQWHU ` S !FRXQWHUQH[W L  F  S !FRXQWHU!F  S !VWDWH 7$6.B5811,1* LI FRQWLQXH  S  LI L ^ ZKLOH QH[W ቡᤷੁଚњⲴԫ࣑ਧDŽ ଚањ٬བྷˈ䘀㹼ᰦ䰤䘈н䮯ˈˈ٬˅ቡ㔚⣦ᘱԫ࣑Ⲵ FRXQWHU˄ԫ࣑䘀㹼ᰦ䰤Ⲵ䙂߿┤ㆄ䇑ᮠ 䘉⇥ԓ⸱ҏᱟӾԫ࣑ᮠ㓴Ⲵᴰਾањԫ࣑ᔰ࿻ᗚ⧟༴⨶ˈᒦ䐣䗷нਜ਼ԫ࣑Ⲵᮠ㓴DŽ∄䖳⇿њ WDVN>15B7$6.6@  S L 15B7$6.6  QH[W  F  ^ ZKLOH   䘉䟼ᱟ䈳ᓖ〻ᒿⲴѫ㾱䜘࠶   WKLVLVWKHVFKHGXOHUSURSHU   ` 㖞Ѫቡ㔚˄ਟᢗ㹼˅⣦ᘱDŽS !VWDWH 7$6.B5811,1*   S !VWDWH 7$6.B,17(55837,%/(    S !EORFNHG  B%/2&.$%/( a S !VLJQDO LI н㜭㻛䱫ຎDŽ ⭘Ҿᘭ⮕㻛䱫ຎⲴؑਧˈն 6,*.,// ઼ 6,*6723 S !EORFNHG  B%/2&.$%/( a ⣦ᘱDŽަѝ ྲ᷌ؑਧսമѝ䲔㻛䱫ຎⲴؑਧཆ䘈ᴹަԆؑਧˈᒦфԫ࣑༴Ҿਟѝᯝ⣦ᘱˈࡉ㖞ԫ࣑Ѫቡ㔚 `  S !DODUP   6,*$/50   S !VLJQDO_    VFKHGF 〻ᒿ  LQLWBWDVNWDVN  FXUUHQW LI UHWXUQ  S LI LPSRVVLEOH DŽ ᱟԫ࣑ ˈࡉ↫ᵪ 㤕ᤷ䪸ᰐ᭸ˈࡉ䘰ࠪDŽ˄ᤷ䪸ᡰᤷⲴሩ䊑ਟԕᱟ 18//ˈնᤷ䪸ᵜ䓛нՊѪ  DŽྲ᷌ᖃࡽԫ࣑  WPS VWUXFWWDVNBVWUXFW ^  S VWUXFWWDVNBVWUXFW YRLGLQWHUUXSWLEOHBVOHHSBRQ S ᤷᇊⲴㅹᖵ䱏ࡇѝDŽ ޕሶᖃࡽԫ࣑㖞ѪਟѝᯝⲴㅹᖵ⣦ᘱˈᒦ᭮  `  WPS!VWDWH WPS 㤕൘ަࡽ䘈ᆈ൘ㅹᖵⲴԫ࣑ˈࡉҏሶަ㖞Ѫቡ㔚⣦ᘱ˄୔䟂˅DŽ LI 㿱  㹼кⲴ䀓䟺DŽS WPS аᶑ䈝ਕ˖  㹼DŽ㤕ᆳਾ䶒䘈ᴹㅹᖵⲴ䘋〻 &ˈ䛓ѸᆳҏՊᢺ & ୔䟂ㅹDŽ䘉䟼൘  㹼ࡽ䘈ᓄ䈕␫࣐ 䱏ࡇਾањ䘋〻%㖞սቡ㔚⣦ᘱ˄୔䟂˅DŽ㘼ᖃ䖞ࡠ % 䘋〻ᢗ㹼ᰦˈᆳҏ᡽ਟ㜭㔗㔝ᢗ㹼 Ҷ䈕䱏ࡇˈ䛓Ѹᖃ㌫㔏࠷ᦒ৫ᢗ㹼ཤᤷ䪸ᡰᤷⲴ䘋〻 $ ᰦˈ䈕䘋〻᡽Պ㔗㔝ᢗ㹼  㹼ˈᢺ 䈕࠭ᮠ㘼нՊ䘄എDŽਚᴹᖃ޵ṨḀ༴ԓ⸱ԕ䱏ࡇཤᤷ䪸֌Ѫ৲ᮠ ZDNHBXS”ޕᮠˈᒦфҏՊ“䲧  ࠭ 䘋〻ҏ䴰㾱֯⭘਼а䍴Ⓚˈ䛓ѸҏՊ֯⭘਼ањㅹᖵ䱏ࡇཤᤷ䪸֌Ѫ৲ᮠ䈳⭘ VOHHSBRQ  ਾቡՊ൘䈕࠭ᮠѝ㻛࠷ᦒᦹˈ᧗ࡦᵳ㻛䖜〫ࡠަԆ䘋〻ѝDŽ↔ᰦ㤕ᴹ 䘋〻䈳⭘Ҷ VOHHSBRQ Ⲵ䘋〻DŽ䈕࠭ᮠ፼྇䈳⭘ˈҏՊ፼྇୔䟂ᡰᴹㅹᖵ䈕䍴ⓀⲴ䘋〻DŽ䘉䟼፼྇䈳⭘ᱟᤷᖃањ 㔚ᘱ˅DŽᰒ❦བྷᇦ䜭൘ㅹᖵ਼ṧⲴ䍴Ⓚˈ䛓Ѹ൘䍴Ⓚਟ⭘ᰦˈቡᴹᗵ㾱୔䟂ᡰᴹㅹᖵ䈕䍴Ⓚ ਚᴹᖃ䘉њㅹᖵԫ࣑㻛୔䟂ᰦˈ䈳ᓖ〻ᒿ᡽৸䘄എࡠ䘉䟼ˈ㺘⽪ᵜ䘋〻ᐢ㻛᰾⺞ൠ୔䟂˄ቡ  VFKHGXOH FXUUHQW!VWDWH 7$6.B81,17(55837,%/( S FXUUHQW  S  WPS ѪнਟѝᯝⲴㅹᖵ⣦ᘱˈᒦᢗ㹼䟽ᯠ䈳ᓖDŽ S Ⲵㅹᖵ䱏ࡇѝDŽ❦ਾሶᖃࡽԫ࣑㖞 ࡠҶޕⲴㅹᖵᤷ䪸ᤷੁᖃࡽԫ࣑DŽ䘉ṧቡᢺᖃࡽԫ࣑ᨂ ྲ᷌ᴹⲴ䈍 ˈֻྲ LQRGH!LBZDLWDŽᒦфሶⶑⵐ䱏ࡇཤ 䇙 WPS ᤷੁᐢ㓿൘ㅹᖵ䱏ࡇкⲴԫ࣑  WDVN>@WU\LQJWRVOHHS SDQLF  LQLWBWDVNWDVN  FXUUHQW LI UHWXUQ  S LI Ѫⶑⵐ⣦ᘱ∛ᰐ᜿ѹDŽ ᖃࡽԫ࣑ᱟԫ࣑ ˈࡉ↫ᵪDŽഐѪԫ࣑  Ⲵ䘀㹼н׍䎆㠚ᐡⲴ⣦ᘱˈᡰԕ޵Ṩԓ⸱ᢺԫ࣑  㖞 㤕ᤷ䪸ᰐ᭸ˈࡉ䘰ࠪDŽ˄ᤷ䪸ᡰᤷⲴሩ䊑ਟԕᱟ 18//ˈնᤷ䪸ᵜ䓛нᓄ䈕Ѫ  DŽਖཆˈྲ᷌  WPS VWUXFWWDVNBVWUXFW ^  S VWUXFWWDVNBVWUXFW YRLGVOHHSBRQ Ⲵ֯⭘ᛵߥDŽ DŽ৲㿱മ  ѝ S ᤷ䪸 S Ⲵᤷ䪸ˈণ S ቡ䴰㾱Ր䙂ᤷ䪸ˈ࠭ᮠ〻ᒿѝ৏ᶕቡᱟᤷ䪸ਈ䟿Ⲵ٬ ᤷੁⲴⴞḷ˄䘉䟼ᱟԫ࣑㔃ᶴ˅Պ᭩ਈˈഐ↔ѪҶ㜭؞᭩䈳⭘䈕 S 〻ᒿѝਈ䟿Ⲵ٬DŽնᱟᤷ䪸 ᴹⴤ᧕Ⲵᯩᔿ䇙㻛䈳⭘࠭ᮠ᭩ਈ䈳⭘䈕࠭ᮠ⋐ˈˈ䘉ᱟഐѪ & ࠭ᮠ৲ᮠਚ㜭Ր٬ S ᤷ䪸ᖒᔿ ࠭ᮠ৲ᮠ S ᱟㅹᖵԫ࣑䱏ࡇཤᤷ䪸DŽᤷ䪸ᱟਜ਼ᴹањਈ䟿ൠ൰Ⲵਈ䟿DŽ䘉䟼৲ᮠ S ֯⭘Ҷᤷ䪸Ⲵ ਚᴹ᰾⺞ൠ୔䟂ᰦ᡽Պ䘄എDŽ䈕࠭ᮠᨀ׋Ҷ䘋〻оѝᯝ༴⨶〻ᒿѻ䰤Ⲵ਼↕ᵪࡦDŽ ᢺᖃࡽԫ࣑㖞ѪнਟѝᯝⲴㅹᖵ⣦ᘱˈᒦ䇙ⶑⵐ䱏ࡇཤᤷ䪸ᤷੁᖃࡽԫ࣑DŽ  ` UHWXUQ  VFKHGXOH   VFKHGF 〻ᒿ `^ @<VWDWLFLQWPRIIBWLPHU 䖜ѻࡽ䴰㔤ᤱⲴᰦ䰤DŽ〻ᒿѝ䇮ᇊѪ  њ┤ㆄ˄ 。˅DŽڌл䶒ᮠ㓴࠶࡛ᆈ᭮਴䖟傡൘傜䗮 VWDWLFLQWPRQBWLPHU>@ ^` л䶒ᮠ㓴࠶࡛ᆈ᭮਴䖟傡傜䗮੟ࣘᡰ䴰㾱Ⲵ┤ㆄᮠDŽ〻ᒿѝ唈䇔੟ࣘᰦ䰤Ѫ  њ┤ㆄ˄ 。˅DŽ ZDLWBPRWRU>@ ^18//18//18//18//` VWDWLFVWUXFWWDVNBVWUXFW л䶒ᮠ㓴ᆈ᭮ㅹᖵ䖟傡傜䗮੟ࣘࡠ↓ᑨ䖜䙏Ⲵ䘋〻ᤷ䪸DŽᮠ㓴㍒ᕅ  ࠶࡛ሩᓄ䖟傡 $'DŽ ⴻ䘉⇥ԓ⸱DŽަѝᰦ䰤অս˖ њ┤ㆄ  。DŽ 䖟ⴈ傡ࣘ〻ᒿ˄IORSS\F˅ਾ䶒Ⲵ䈤᰾ˈᡆ㘵ࡠ䰵䈫䖟ⴈඇ䇮༷傡ࣘ〻ᒿᰦ൘ᶕޣѝᴹ л䶒ㅜ ̢ 㹼ԓ⸱⭘Ҿ༴⨶䖟傡ᇊᰦDŽ൘䰵䈫䘉⇥ԓ⸱ѻࡽ䈧ݸⴻалඇ䇮༷аㄐ   ѝⲴDŽሶᆳԜ᭮൘䘉䟼ᱟഐѪ䖟傡䴰㾱ᇊᰦ༴⨶ˈ㘼᭮൘䘉䟼ᱟᴰᯩׯⲴDŽ  䖟ⴈⲴᆀ〻ᒿˈᵜнᓄ䈕᭮൘޵ṨⲴѫ㾱䜘࠶ޣྭҶˈӾ䘉䟼ᔰ࿻ᱟаӋᴹ      ZDVWKHHDVLHVWZD\RIGRLQJLW  SURSHU7KH\DUHKHUHEHFDXVHWKHIORSS\QHHGVDWLPHUDQGWKLV  WEHLQWKHNHUQHO 2.KHUHDUHVRPHIORSS\WKLQJVWKDWVKRXOGQ     ` ` S 18//  㖞Ѫቡ㔚˄ਟ䘀㹼˅⣦ᘱ 7$6.B5811,1*DŽ S VWDWH  S ^  S LI ^  S VWUXFWWDVNBVWUXFW YRLGZDNHBXS ㅹᖵ䱏ࡇⲴԫ࣑DŽޕ༴Ⲵˈഐ↔୔䟂Ⲵᱟᴰਾ䘋 ൘ㅹᖵ䱏ࡇཤᤷ䪸ޕS ᱟԫ࣑ㅹᖵ䱏ࡇཤᤷ䪸DŽ⭡Ҿᯠㅹᖵԫ࣑ᱟᨂ S ᤷੁⲴԫ࣑DŽ ୔䟂  `  WPS!VWDWH  WPS LI S 18//   㹼кⲴ䈝ਕDŽ ㅹᖵ䱏ࡇⲴԫ࣑൷㻛ᣩᦹҶDŽᖃ❦ˈ਼ᰦҏ䴰ࡐ䲔ޕࡽᨂ S WPSˈ䇙䱏ࡇཤᤷ䪸ᤷੁަ։ㅹᖵԫ࣑ˈ੖ࡉ൘ᖃࡽԫ࣑ѻ л䶒аਕԓ⸱ᴹ䈟ˈᓄ䈕ᱟ ` JRWRUHSHDW  S VWDWH  S FXUUHQW ^  S LI ᯠ䈳ᓖDŽ 䱏ࡇⲴԫ࣑㻛୔䟂ᢗ㹼ᰦᶕ୔䟂ᵜԫ࣑DŽҾᱟ৫ᢗ㹼䟽ޕ䇙㠚ᐡӽ❦ㅹᖵDŽㅹᖵ䘉Ӌਾ㔝䘋 ㅹᖵ䱏ࡇࡽ䜘DŽഐ↔ᡁԜݸ୔䟂ᆳԜˈ㘼ޕ䱏ࡇਾˈ৸ᴹᯠⲴԫ࣑㻛ᨂޕ⽪൘ᖃࡽԫ࣑㻛᭮ S ᡰᤷੁⲴнᱟᖃࡽԫ࣑ᰦˈ㺘 ԫ࣑㖞Ѫਟ䘀㹼Ⲵቡ㔚⣦ᘱˈᒦ䟽ᯠᢗ㹼䈳ᓖ〻ᒿDŽᖃᤷ䪸 ྲ᷌ㅹᖵ䱏ࡇѝ䘈ᴹㅹᖵԫ࣑ˈᒦф䱏ࡇཤᤷ䪸ᡰᤷੁⲴԫ࣑нᱟᖃࡽԫ࣑ᰦˈࡉሶ䈕ㅹᖵ ਚᴹᖃ䘉њㅹᖵԫ࣑㻛୔䟂ᰦˈ〻ᒿ᡽৸Պ䘄എࡠ䘉䟼ˈ㺘⽪䘋〻ᐢ㻛᰾⺞ൠ୔䟂ᒦᢗ㹼DŽ  VFKHGXOH FXUUHQW!VWDWH 7$6.B,17(55837,%/(UHSHDW S FXUUHQW  S WPS ѪਟѝᯝⲴㅹᖵ⣦ᘱˈᒦᢗ㹼䟽ᯠ䈳ᓖDŽ S Ⲵㅹᖵ䱏ࡇѝDŽ❦ਾሶᖃࡽԫ࣑㖞 ࡠҶޕⲴㅹᖵᤷ䪸ᤷੁᖃࡽԫ࣑DŽ䘉ṧቡᢺᖃࡽԫ࣑ᨂ ྲ᷌ᴹⲴ䈍 ˈֻྲ LQRGH!LBZDLWDŽᒦфሶⶑⵐ䱏ࡇཤ 䇙 WPS ᤷੁᐢ㓿൘ㅹᖵ䱏ࡇкⲴԫ࣑  WDVN>@WU\LQJWRVOHHS SDQLF   VFKHGF 〻ᒿ  QU WLFNVBWRBIORSS\BRQ ZKLOH 䱏ࡇѝDŽ ㅹᖵ傜䗮䘀㹼Ⲵޕྲ᷌傜䗮੟ࣘᇊᰦ䘈⋑ࡠˈቡаⴤᢺᖃࡽ䘋〻㖞Ѫнਟѝᯝⶑⵐ⣦ᘱᒦ᭮ ѝᯝDŽޣ FOL ^  XQVLJQHGLQWQU YRLGIORSS\BRQ 䙂߿ࡔᯝ䘉䟼䇮ᇊⲴᔦᰦ٬DŽᖃᔦᰦࡠᵏˈቡՊ୔䟂䘉䟼Ⲵㅹᖵ䘋〻DŽ 䇮㖞ᤷᇊ䖟傡Ⲵ傜䗮੟ࣘࡠ↓ᑨ䖜䙏ᡰ䴰Ⲵᔦᰦˈ❦ਾⶑⵐㅹᖵDŽ൘ᇊᰦѝᯝ䗷〻ѝՊаⴤ ㅹᖵᤷᇊ䖟傡傜䗮੟ࣘᡰ䴰Ⲵа⇥ᰦ䰤ˈ❦ਾ䘄എDŽ  ` ᴰਾ䘄എ੟ࣘ傜䗮ᡰ䴰Ⲵᰦ䰤٬DŽUHWXUQPRQBWLPHU>QU@ ᔰѝᯝDŽ VWL ` FXUUHQWB'25 PDVN  PRQBWLPHU>QU@  PRQBWLPHU>QU@ HOVHLI PRQBWLPHU>QU@ +=  [I  PDVNAFXUUHQWB'25 LI  PDVN)'B'25 RXWE PDVN FXUUHQWB'25 ^ LI ߿ਾࡔᯝⲴ㾱≲DŽᢗ㹼ᵜ⅑ᇊᰦԓ⸱Ⲵ㾱≲ণਟDŽ↔ਾᴤᯠᖃࡽᮠᆇ䗃ࠪᇴᆈಘ FXUUHQWB'25DŽ  ѝݸ䙂 ┤ㆄ˅DŽ㤕ᐢ㓿੟ࣘˈࡉ޽䇮㖞੟ࣘᇊᰦѪ  њ┤ㆄˈ㜭┑䏣л䶒GRBIORSS\BWLPHU ᡆ њ。  =+˄ྲ᷌㾱≲੟ࣘⲴ傜䗮䘈⋑ᴹ੟ࣘˈࡉ㖞⴨ᓄ䖟傡Ⲵ傜䗮੟ࣘᇊᰦಘ٬ PDVN ˈᒦф ྲ᷌ᮠᆇ䗃ࠪᇴᆈಘⲴᖃࡽ٬о㾱≲Ⲵ٬н਼ˈࡉੁ )'& ᮠᆇ䗃ࠪㄟਓ䗃ࠪᯠ٬ ` PDVN_ QU  [)& PDVN VHOHFWHG ^ LI ྲ᷌ᖃࡽ⋑ᴹ䘹ᤙ䖟傡ˈࡉ俆ݸ༽սަԆ䖟傡Ⲵ䘹ᤙսˈ❦ਾ㖞ᤷᇊ䖟傡䘹ᤙսDŽ PDVN_ FXUUHQWB'25  XVHIORSS\BRIIWRWXUQLWRII ѝᯝDŽޣ FOL 䖜㔤ᤱᰦ䰤DŽڌ  V YHU\ELJ  PRIIBWLPHU>QU@  QU!IORSS\BRQ SDQLF  QU! LI ਆᖃࡽ '25 ᇴᆈಘ٬ࡠѤᰦਈ䟿 PDVN ѝˈᒦᢺᤷᇊ䖟傡Ⲵ傜䗮੟ࣘḷᘇ㖞սDŽ 䖜ѻࡽ䴰㾱㓿䗷Ⲵᰦ䰤˄ 。˅DŽ❦ਾڌ ㌫㔏ᴰཊᴹ  њ䖟傡DŽ俆ݸ亴ݸ䇮㖞ྭᤷᇊ䖟傡 QU  QUXQVLJQHGFKDUPDVN [ H[WHUQXQVLJQHGFKDUVHOHFWHG ^  XQVLJQHGLQWQU LQWWLFNVBWRBIORSS\BRQ ᮠᆇ䗃ࠪᇴᆈಘѝ੟ࣘ傜䗮∄⢩սDŽPDVN 儈  սᱟ਴䖟傡੟ࣘ傜䗮ḷᘇDŽ ተ䜘ਈ䟿 VHOHFWHG ᱟ䘹ѝ䖟傡ḷᘇ˄EONBGUYIORSS\Fˈ˅DŽPDVN ᱟᡰ䘹䖟傡ሩᓄⲴ  ˈ䘄എ٬Ѫ┤ㆄᮠDŽ ৲ᮠ QU䖟傡ਧ ᤷᇊ䖟傡੟ࣘࡠ↓ᑨ䘀䖜⣦ᘱᡰ䴰ㅹᖵᰦ䰤DŽ  䘉䟼䇮㖞ࡍ٬Ѫ˖ݱ䇨 '0$ ઼ѝᯝ䈧≲ǃ੟ࣘ )'&DŽXQVLJQHGFKDUFXUUHQWB'25 [& ս ˖ˈ⭘Ҿ䘹ᤙ᧗ࡦⲴ䖟傡 $'DŽ ս ˖੟ࣘ䖟ⴈ᧗ࡦಘ˗༽ս䖟ⴈ᧗ࡦಘDŽ ս ˖ݱ䇨 '0$ ઼ѝᯝ䈧≲˗⾱→ '0$ ઼ѝᯝ䈧≲DŽ 䰝DŽޣ˗ս ˖࠶࡛᧗ࡦ傡ࣘಘ '$ 傜䗮Ⲵ੟ࣘDŽ੟ࣘ ሩᓄ䖟傡᧗ࡦಘѝᖃࡽᮠᆇ䗃ࠪᇴᆈಘDŽ䈕ᇴᆈಘ⇿սⲴᇊѹྲл˖   VFKHGF 〻ᒿ  IQ LI ྲ᷌ᇊᰦ༴⨶〻ᒿᤷ䪸Ѫオˈࡉ䘰ࠪDŽ  S VWUXFWWLPHUBOLVW ^  YRLG IQ ORQJMLIILHVYRLG YRLGDGGBWLPHU  ᇊᰦᰦ䰤ࡠᰦᢗ㹼Ⲵ࠭ᮠDŽ IQ ৲ᮠ MLIILHV̢ԕ  ∛。䇑Ⲵ┤ㆄᮠ˗ 䰝傜䗮Ⲵᔦᰦ᫽֌DŽޣ䖟ⴈ傡ࣘ〻ᒿ˄IORSS\F˅࡙⭘䈕࠭ᮠᢗ㹼੟ࣘᡆ ㆄᮠ ઼⴨ᓄⲴ༴⨶〻ᒿᤷ䪸DŽ┤ ᮠѪᤷᇊⲴᇊᰦ٬৲ޕ␫࣐ᇊᰦಘDŽ䗃  QH[WBWLPHU ᱟᇊᰦಘ䱏ࡇཤᤷ䪸DŽQH[WBWLPHU 18// `WLPHUBOLVW>7,0(B5(48(676@ 䬮᧕ᤷੁлањᇊᰦಘDŽQH[W VWUXFWWLPHUBOLVW ᇊᰦ༴⨶〻ᒿDŽ IQ YRLG ᇊᰦ┤ㆄᮠDŽORQJMLIILHV VWDWLFVWUXFWWLPHUBOLVW^ ㊫රᇊᰦಘ㊫լ⧠ԓ /LQX[ ㌫㔏ѝⲴࣘᘱᇊᰦಘ˄'\QDPLF7LPHU˅ˈӵ׋޵Ṩ֯⭘DŽ 䰝傜䗮઼੟ࣘ傜䗮ᇊᰦ᫽֌DŽ䘉⿽ޣᇊᰦಘ䬮㺘㔃ᶴ઼ᇊᰦಘᮠ㓴DŽ䈕ᇊᰦಘ䬮㺘у⭘Ҿ׋䖟傡  GHILQH7,0(B5(48(676 ҾᇊᰦಘⲴԓ⸱DŽᴰཊਟᴹ  њᇊᰦಘDŽޣл䶒ᱟ  ` ` 䖜䇑ᰦ䙂߿DŽڌ੖ࡉ傜䗮PRIIBWLPHU>L@ `HOVH ᴤᯠᮠᆇ䗃ࠪᇴᆈಘDŽ FXUUHQWB'25)'B'25 RXWE ༽ս⴨ᓄ傜䗮੟ࣘսˈᒦф aPDVN FXUUHQWB'25 䖜ᇊᰦࡠࡉڌPRIIBWLPHU>L@ ^ྲ᷌傜䗮 `HOVHLI  LZDLWBPRWRU ZDNHBXS  PRQBWLPHU>L@ LI PRQBWLPHU>L@ ^ྲ᷌傜䗮੟ࣘᇊᰦࡠࡉ୔䟂䘋〻DŽ LI FRQWLQXH FXUUHQWB'25 ྲ᷌нᱟ '25 ᤷᇊⲴ傜䗮ࡉ䐣䗷DŽ PDVN  LI   ^LPDVNL L IRU  XQVLJQHGFKDUPDVN [ LQWL ^  YRLG YRLGGRBIORSS\BWLPHU 䖜ᇊᰦࡠˈࡉሶᮠᆇ䗃ࠪᇴᆈಘ傜䗮੟ࣘս༽սDŽڌ䖜ᇊᰦಘⲴ٬DŽྲ᷌Ḁањ傜䗮ڌ PV ቡՊ㻛䈳⭘а⅑ˈ䲿ᰦᴤᯠ傜䗮ᔰ੟ᡆ ѝᯝ䗷〻ѝ㻛䈳⭘ˈഐ↔㌫㔏⇿㓿䗷ањ┤ㆄ 䖜䇑ᰦ٬DŽ䈕ᆀ〻ᒿՊ൘ᰦ䫏ᇊᰦڌ䰝ޣ䖟ⴈᇊᰦ༴⨶ᆀ〻ᒿDŽᴤᯠ傜䗮੟ࣘᇊᰦ٬઼傜䗮  ` +=  PRIIBWLPHU>QU@ ^  XQVLJQHGLQWQU YRLGIORSS\BRII 䰝DŽޣ䰝ᤷᇊⲴ䖟傡傜䗮ˈࡉ൘傜䗮ᔰ੟  。ѻਾҏՊ㻛ޣ⺞㤕н֯⭘䈕࠭ᮠ᰾ 䖜ᇊᰦಘ˄ 。˅DŽڌ䰝⴨ᓄ䖟傡傜䗮ޣ㖞  ` ᔰѝᯝDŽ VWL  QUZDLWBPRWRU VOHHSBRQ   VFKHGF 〻ᒿ FSO Ѫ ˄ᴰ儈ˈ㺘⽪ᱟ޵Ṩ〻ᒿ൘ᐕ֌˅ˈࡉሶ޵Ṩԓ⸱䘀㹼ᰦ䰤 VWLPH ྲ᷌ᖃࡽ⢩ᵳ㓗   V\VEHHSVWRS  EHHSFRXQW LI  EHHSFRXQW LI 䇑ᮠಘ  Ⲵᐕ֌ˈս  ᧗ࡦᢜ༠ಘ DŽ  ੁ [ ਓਁ䘱ભԔˈ༽սս  ઼ DŽս  ᧗ࡦ 䰝ਁ༠DŽޣྲ᷌ਁ༠䇑ᮠ⅑ᮠࡠˈࡉ   NHUQHOFKUBGUYFRQVROHF 䰝ᢜ༠ಘޣ YRLG H[WHUQYRLGV\VEHHSVWRS  FKUBGUYFRQVROHF ᢜ༠ಘਁ༠ᰦ䰤┤ㆄᮠH[WHUQLQWEHHSFRXQW ^  ORQJFSO YRLGGRBWLPHU ሩҾањ䘋〻⭡Ҿᢗ㹼ᰦ䰤⡷⭘ᆼᰦˈࡉ䘋㹼ԫ࣑࠷ᦒDŽᒦᢗ㹼ањ䇑ᰦᴤᯠᐕ֌DŽ FSO  ᰦ㺘⽪ѝᯝਁ⭏ᰦ↓൘ᢗ㹼޵Ṩԓ⸱˗FSO  ᰦ㺘⽪ѝᯝਁ⭏ᰦ↓൘ᢗ㹼⭘ᡧԓ⸱DŽ ৲ᮠ FSO ᱟᖃࡽ⢩ᵳ㓗  ᡆ ˈᱟᰦ䫏ѝᯝਁ⭏ᰦ↓㻛ᢗ㹼Ⲵԓ⸱䘹ᤙㅖѝⲴ⢩ᵳ㓗DŽ ᰦ䫏ѝᯝ & ࠭ᮠ༴⨶〻ᒿˈ൘ V\VWHPBFDOOV ѝⲴBWLPHUBLQWHUUXSW˄ 㹼˅㻛䈳⭘DŽ  `  VWL ` ` S S!QH[W S!QH[W!MLIILHV MLIILHV S!MLIILHV S!QH[W!MLIILHV MLIILHV S!MLIILHV S!QH[W!IQ IQ S!IQ S!QH[W!IQ IQ S!IQ S!MLIILHV S!QH[W!MLIILHV S!MLIILHV ^S!QH[W!MLIILHV S!QH[W ZKLOH л䶒ᗚ⧟ѝ䘋㹼༴⨶DŽ@@ޕᇊᰦ٬ᢓ䲔ㅜ  њⲴ٬ণਟˈ੖ࡉ䘋 ㅜ  њˈࡉㅜ  њ ަਾ䶒Ⲵањᇊᰦಘ٬߿৫ᯠⲴㅜ  њⲴᇊᰦ٬DŽণྲ᷌ㅜ  њᇊᰦ٬ ᗚ⧟ѝˈն↔ᰦ䘈ᱟᓄ䈕ሶ㍗䲿ޕⲴᇊᰦಘ٬ሿҾ৏ᶕཤањᇊᰦಘ٬ᰦࡉṩᵜнՊ䘋ޕᨂ DŽྲ᷌ᯠޘਚ㾱ḕⴻ䬮㺘ཤⲴㅜа亩Ⲵᇊᰦᱟ੖ࡠᵏণਟDŽ>>""䘉⇥〻ᒿྭ䊑⋑ᴹ㘳㲁ઘ 䬮㺘亩᤹ᇊᰦ٬ӾሿࡠབྷᧂᒿDŽ൘ᧂᒿᰦ߿৫ᧂ൘ࡽ䶒䴰㾱Ⲵ┤ㆄᮠˈ䘉ṧ൘༴⨶ᇊᰦಘᰦ QH[WBWLPHU S S!QH[W QH[WBWLPHU S!MLIILHV MLIILHV S!IQ IQ  1RPRUHWLPHUHTXHVWVIUHH SDQLF  S! WLPHUBOLVW7,0(B5(48(676 LI 䬮㺘ཤDŽ ޕ⴨ᓄؑ᚟ˈᒦ䬮ޕྲ᷌ᐢ㓿⭘ᆼҶᇊᰦಘᮠ㓴ˈࡉ㌫㔏ፙ⒳-DŽ੖ࡉੁᇊᰦಘᮠᦞ㔃ᶴປ EUHDN  S!IQ LI  SWLPHUBOLVW7,0(B5(48(676SS WLPHUBOLVW IRU ੖ࡉӾᇊᰦಘᮠ㓴ѝˈ᢮ањオ䰢亩DŽ HOVH^  IQ    MLIILHV LI 䬮㺘ѝDŽޕࡉ・࡫䈳⭘ަ༴⨶〻ᒿDŽᒦф䈕ᇊᰦಘн࣐ˈ ྲ᷌ᇊᰦ٬  FOL UHWXUQ   VFKHGF 〻ᒿ ` UHWXUQFXUUHQW!SLG ^  YRLG LQWV\VBJHWSLG ਆᖃࡽ䘋〻ਧ SLGDŽ  `  ROG UHWXUQ  VHFRQGV MLIILHV+= VHFRQGV! "  FXUUHQW!DODUP ROGMLIILHV +=  ROG  ROG LI  LQWROG FXUUHQW!DODUP ^  ORQJVHFRQGV LQWV\VBDODUP অսᱟ。DŽˈ৲ᮠ VHFRQGV ᱟᯠⲴᇊᰦᰦ䰤٬ ަѝᑨᮠ += ˈᱟ޵Ṩ㌫㔏䘀㹼仁⦷DŽᇊѹ൘ LQFOXGHVFKHGK ㅜ  㹼кDŽ ഐ↔ᵜ࠭ᮠⲴѫ㾱᫽֌ᱟ䘋㹼є⿽অսⲴ䖜ᦒDŽˈDŽ㘼৲ᮠ㔉ࠪⲴᱟԕ。ѪঅսⲴᇊᰦ٬ ٬。 ᇊᰦ MLIILHV+= MLIILHV ઼䖜ᦒᡀ┤ㆄঅսⲴᇊᰦ٬ѻ઼ˈণ 䇮㖞ᇊᰦ᫽֌ᰦ㌫㔏┤ㆄ٬ DODUP Ⲵঅսᱟ㌫㔏┤ㆄ˄ ┤ㆄѪ  ∛。˅ˈᆳᱟ㌫㔏ᔰᵪ䎧ࡠ 䘋〻ᮠᦞ㔃ᶴѝᣕ䆖ᇊᰦ٬ ᒦ䘄എ৏ᇊᰦᰦ࡫䘈࢙։Ⲵ䰤䳄ᰦ䰤DŽ੖ࡉ䘄എ DŽˈྲ᷌৲ᮠ VHFRQGV བྷҾ ˈࡉ䇮㖞ᯠᇊᰦ٬ DŽ 。 ㌫㔏䈳⭘࣏㜭䇮㖞ᣕ䆖ᇊᰦᰦ䰤٬  `  VFKHGXOH ٬䘋㹼䈳ᓖDŽ ሩҾ޵Ṩᘱ〻ᒿˈн׍䎆 FRXQWHUFSO UHWXUQ LI  FXUUHQW!FRXQWHU FXUUHQW!FRXQWHU ! UHWXUQ LI ޵Ṩԓ⸱ѝ䘀㹼ࡉ䘄എˈ੖ࡉ䈳⭘ᢗ㹼䈳ᓖ࠭ᮠDŽ ྲ᷌䘋〻䘀㹼ᰦ䰤䘈⋑ᆼˈࡉ䘰ࠪDŽ੖ࡉ㖞ᖃࡽԫ࣑䘀㹼䇑ᮠ٬Ѫ DŽᒦф㤕ਁ⭏ᰦ䫏ѝᯝᰦ↓൘  GRBIORSS\BWLPHU  [I FXUUHQWB'25 LI  㹼 DŽ ྲ᷌ᖃࡽ䖟ⴈ᧗ࡦಘ )'& Ⲵᮠᆇ䗃ࠪᇴᆈಘѝ傜䗮੟ࣘսᴹ㖞սⲴˈࡉᢗ㹼䖟ⴈᇊᰦ〻ᒿ ` ` 䈳⭘༴⨶࠭ᮠDŽ IQ  QH[WBWLPHU QH[WBWLPHU!QH[W QH[WBWLPHU!IQ 18// IQ QH[WBWLPHU!IQ  Ҷањ࠭ᮠᤷ䪸ᇊѹʽʽʽ/ޕ䘉䟼ᨂ YRLG IQ YRLG   ^QH[WBWLPHU!MLIILHV QH[WBWLPHU ZKLOH QH[WBWLPHU!MLIILHV QH[WBWLPHU ^ LI ᒦሶ䈕༴⨶〻ᒿᤷ䪸㖞ѪオDŽ❦ਾ৫ᦹ䈕亩ᇊᰦಘDŽQH[WBWLPHU ᱟᇊᰦಘ䬮㺘Ⲵཤᤷ䪸DŽ ྲ᷌ᴹᇊᰦಘᆈ൘ˈࡉሶ䬮㺘ㅜ  њᇊᰦಘⲴ٬߿ DŽྲ᷌ᐢㅹҾ ˈࡉ䈳⭘⴨ᓄⲴ༴⨶〻ᒿˈ  FXUUHQW!VWLPH HOVH FXUUHQW!XWLPH  FSO LI кⲴ㤡᮷⌘䟺@DŽྲ᷌ FSO!ˈࡉ㺘⽪ᱟа㡜⭘ᡧ〻ᒿ൘ᐕ֌ˈ໎࣐ XWLPHDŽ  㹼VXSHUYLVRU Ⲵ〻ᒿˈ㿱 V\VWHPBFDOOV 䙂໎˗>/LQXV ᢺ޵Ṩ〻ᒿ㔏〠Ѫ䎵㓗⭘ᡧ   VFKHGF 〻ᒿ ),567B766B(175< ઼ ),567B/'7B(175< Ⲵ٬࠶࡛ᱟ  ઼ ˈᇊѹ൘ LQFOXGHOLQX[VFKHGK ተ᧿䘠ㅖ㺘ѝ䇮㖞ࡍ࿻ԫ࣑˄ԫ࣑ ˅Ⲵԫ࣑⣦ᘱ⇥᧿䘠ㅖ઼ተ䜘ᮠᦞ㺘᧿䘠ㅖDŽޘ൘  6WUXFWVLJDFWLRQ0867EHE\WHV SDQLF ਧ⣦ᘱⲴ㔃ᶴDŽؑޣVWUXFWVLJDFWLRQ   VLJDFWLRQ ᱟᆈ᭮ᴹ VL]HRI LI ᱟѪҶᨀ䟂㠚ᐡԕ৺ަԆ؞᭩޵Ṩԓ⸱ⲴӪDŽ л䶒䘉њࡔᯝ䈝ਕᒦᰐᗵ㾱ˈ㓟㋩ޕ䭞ᙗⲴᮠᦞ㔃ᶴˈ䙐ᡀо 326,; ḷ߶ⲴнެᇩDŽ䘉䟼࣐ޣ /LQX[ ㌫㔏ᔰਁѻࡍˈ޵Ṩнᡀ⟏DŽ޵Ṩԓ⸱Պ㻛㓿ᑨ؞᭩DŽ/LQXV ᙅ㠚ᐡᰐ᜿ѝ؞᭩Ҷ䘉Ӌ  ᧿䘠ㅖ㺘㔃ᶴᤷ䪸DŽS VWUXFWGHVFBVWUXFW LQWL ^  YRLG YRLGVFKHGBLQLW ޵Ṩ䈳ᓖ〻ᒿⲴࡍ࿻ॆᆀ〻ᒿDŽ  ` UHWXUQ FXUUHQW!SULRULW\ LQFUHPHQW  FXUUHQW!SULRULW\LQFUHPHQW! LI ^  ORQJLQFUHPHQW LQWV\VBQLFH ੖ࡉਟ֯Ոݸᵳ໎བྷʽʽˈᓄ䈕䲀ࡦ LQFUHPHQW ѪབྷҾ  Ⲵ٬ ㌫㔏䈳⭘࣏㜭䱽վሩ &38 Ⲵ֯⭘Ոݸᵳ˄ᴹӪՊ⭘ੇ˛-˅DŽ  ` UHWXUQFXUUHQW!HJLG ^  YRLG LQWV\VBJHWHJLG ਆᴹ᭸Ⲵ㓴ਧ HJLGDŽ  ` UHWXUQFXUUHQW!JLG ^  YRLG LQWV\VBJHWJLG ਆ㓴ਧ JLGDŽ  ` UHWXUQFXUUHQW!HXLG ^  YRLG LQWV\VBJHWHXLG ਆᴹ᭸Ⲵ⭘ᡧਧ HXLGDŽ  ` UHWXUQFXUUHQW!XLG ^  YRLG LQWV\VBJHWXLG ਆ⭘ᡧਧ XLGDŽ  ` UHWXUQFXUUHQW!IDWKHU ^  YRLG LQWV\VBJHWSSLG ਆ⡦䘋〻ਧ SSLGDŽ    VFKHGF 〻ᒿ (0x3f2 ਚ߉ ᮠᆇ䗃ࠪᇴᆈಘ(ᮠᆇ᧗ࡦᇴᆈಘ I/O ㄟਓ 䈫߉ᙗ ᇴᆈಘ਽〠 㺞 ̢䖥ⴎ᧝࡬ಞㄥਙ ሩҾ 1.2M Ⲵ䖟ⴈ᧗ࡦಘᴹԕлаӋㄟਓDŽ অӻ㓽DŽ൘ሩ䖟ⴈ᧗ࡦಘ䘋㹼㕆〻ᰦ䴰㾱䇯䰞 4 њㄟਓDŽ䘉Ӌㄟਓ࠶࡛ሩᓄ᧗ࡦಘкањᡆཊњᇴᆈಘDŽ ሩ䖟ⴈ᧗ࡦಘ䘋㹼㕆〻Ⲵ䈖㓶䈤᰾䈧৲㿱ㅜ 6 ㄐ〻ᒿ floppy.c ਾ䶒Ⲵ䀓䈤ˈ䘉䟼ӵሩަ֌аㆰޣᴹ 8.7.3.1 䖥ⴎ傧ࣞಞ᧝࡬ಞ 8.7.3 ެԌؗᚥ   `  V\VWHPBFDOO [ VHWBV\VWHPBJDWH  a[[ [ LQEBS RXWE  WLPHUBLQWHUUXSW [ VHWBLQWUBJDWH  㹼༴DŽє㘵Ⲵ४࡛৲㿱 V\VWHPK ᮷Ԧᔰ࿻༴Ⲵ䈤᰾DŽLQFOXGHDVPV\VWHPK ѝㅜ ǃ ❦ਾ䇮㖞㌫㔏䈳⭘ѝᯝ䰘DŽ䘉єњ䇮㖞ѝᯝ᧿䘠ㅖ㺘 ,'7 ѝ᧿䘠ㅖⲴᆿᇊѹ൘᮷Ԧ 䇮㖞ᰦ䫏ѝᯝ༴⨶〻ᒿਕᷴ˄䇮㖞ᰦ䫏ѝᯝ䰘˅DŽ؞᭩ѝᯝ᧗ࡦಘቿ㭭⸱ˈݱ䇨ᰦ䫏ѝᯝDŽ ᇊᰦ٬儈ᆇ㢲DŽ 06%  /$7&+!![ RXWE ᇊᰦ٬վᆇ㢲DŽ /6%  [II[ /$7&+ RXWEBS  ELQDU\PRGH/6%06%FK  [[ RXWEBS ᇊᰦ䇑ᮠ٬DŽ 䗃ࠪᕅ㝊᧕൘ѝᯝ᧗ࡦѫ㣟⡷Ⲵ ,54 кˈᆳ⇿  ∛。ਁࠪањ ,54 䈧≲DŽ/$7&+ ᱟࡍ࿻ л䶒ԓ⸱⭘Ҿࡍ࿻ॆ  ᇊᰦಘDŽ䙊䚃 ˈ䘹ᤙᐕ֌ᯩᔿ ˈҼ䘋ࡦ䇑ᮠᯩᔿDŽ䙊䚃  Ⲵ   OOGW   OWU 䘉а⅑ˈԕਾᯠԫ࣑ /'7 Ⲵ࣐䖭ˈᱟ &38 ṩᦞ 766 ѝⲴ /'7 亩㠚࣐ࣘ䖭DŽ ㅖ㺘ᇴᆈಘ OGWU ѝDŽ⌘᜿ʽʽᱟሶ *'7 ѝ⴨ᓄ /'7 ᧿䘠ㅖⲴ䘹ᤙㅖ࣐䖭ࡠ OGWUDŽਚ᰾⺞࣐ ሶԫ࣑  Ⲵ 766 ⇥䘹ᤙㅖ࣐䖭ࡠԫ࣑ᇴᆈಘ WUDŽሶተ䜘᧿䘠ㅖ㺘⇥䘹ᤙㅖ࣐䖭ࡠተ䜘᧿䘠 ༽ս 17 ḷᘇDŽ SRSIO HVS DQGO[IIIIEIIISXVKIO BBDVPBB LUHW ᤷԔᰦቡՊᕅ䎧ԫ࣑࠷ᦒDŽ17 ᤷࠪ 766 ѝⲴ EDFNBOLQN ᆇ⇥ᱟ੖ᴹ᭸DŽ 1HVWHG7DVN DŽᖃ 17 㖞սᰦˈ䛓Ѹᖃࡽѝᯝԫ࣑ᢗ㹼 17 ḷᘇ⭘Ҿ᧗ࡦ〻ᒿⲴ䙂ᖂ䈳⭘  ␵䲔ḷᘇᇴᆈಘѝⲴս 17ˈ䘉ṧԕਾቡнՊᴹ哫✖   WKDYHWURXEOHVZLWKWKDWODWHURQ &OHDU17VRWKDWZHZRQ  ` S  S!D S!E S  S!D S!E WDVN>L@ 18// L ^15B7$6.6L L IRU S JGW),567B766B(175< ൘᮷Ԧ LQFOXGHOLQX[KHDGK ѝDŽ ␵ԫ࣑ᮠ㓴઼᧿䘠ㅖ㺘亩˄⌘᜿ L  ᔰ࿻ˈᡰԕࡍ࿻ԫ࣑Ⲵ᧿䘠ㅖ䘈൘˅DŽ᧿䘠ㅖ亩㔃ᶴᇊѹ  LQLWBWDVNWDVNOGW JGW),567B/'7B(175< VHWBOGWBGHVF  LQLWBWDVNWDVNWVV JGW),567B766B(175< VHWBWVVBGHVF LQFOXGHDVPV\VWHPKㅜ  㹼ᔰ࿻DŽ JGW>),567B766B(175<@˄ণѪ JGW>@˅ˈҏণJGWᮠ㓴ㅜ  亩Ⲵൠ൰DŽ৲㿱 ተ᧿䘠ㅖ㺘ส൰˄BJGW˅DŽഐ↔ JGW),567B766B(175<ণѪޘㅜ  㹼кⲴ ѝ˗JGWᱟањ᧿䘠ㅖ㺘ᮠ㓴˄LQFOXGHOLQX[KHDGK˅ˈᇎ䱵кሩᓄ〻ᒿKHDGVѝ   VFKHGF 〻ᒿ 㣟⡷Ⲵ㔃ᶴṶമ㿱മ 8-8 ᡰ⽪DŽ 8253 㣟⡷Ⲵ㕆〻⴨ሩᶕ䈤∄䖳ㆰঅˈᒦф㜭ཏӗ⭏ᡰᐼᵋⲴ਴⿽н਼ᰦ䰤䮯ᓖⲴᔦᰦDŽањ 8253˄8254˅ ᶕԓ〠 8253 ઼ 8254 є⿽㣟⡷ˈӵ൘ᆳԜ࣏㜭ᴹ४࡛༴޽⢩࡛࣐ԕᤷࠪDŽ 8254 ᱟ 8253 Ⲵᴤᯠӗ૱ˈѫ㾱࣏㜭สᵜаṧˈਚᱟ 8254 㣟⡷໎࣐Ҷഎ䈫ભԔDŽ൘л䶒᧿䘠ѝᡁԜ⭘ 8253 Ⲵ 16 ս䇑ᮠಘ䙊䚃DŽ⇿њ䙊䚃ਟᐕ֌൘н਼Ⲵᐕ֌ᯩᔿлˈᒦф䘉Ӌᐕ֌ᯩᔿ൷ਟԕ֯⭘䖟Ԧᶕ䇮㖞DŽ ߣ䇑㇇ᵪѝ䙊ᑨ⻠ࡠⲴᰦ䰤᧗ࡦ䰞仈ˈণ൘䖟ԦⲴ᧗ࡦлӗ⭏㋮⺞Ⲵᰦ䰤ᔦ䘏DŽ䈕㣟⡷ᨀ׋Ҷ 3 њ⤜・ Intel 8253˄ᡆ 8254˅ᱟањਟ㕆〻ᇊᰦ/䇑ᮠಘ˄PIT - Programmable Interval Timer˅㣟⡷ˈ⭘Ҿ䀓 1. Intel 8253˄8254˅㣟⡷࣏㜭 8.7.3.2 ਥ㕌ぁᇐᰬ/䇗ᮦ᧝࡬ಞ 䮯ᓖѪ 0--7 ᆇ㢲DŽሩҾ⋑ᴹ䘄എ㔃᷌ᮠᦞⲴભԔˈࡉᓄੁ FDC ਁ䘱Ự⍻ѝᯝ⣦ᘱભԔ㧧ᗇ᫽֌Ⲵ⣦ᘱDŽ Ӿ㘼㧧ᗇ FDC ભԔᢗ㹼Ⲵ㔃᷌DŽ䘄എ㔃᷌ᮠᦞⲴˈ㔃᷌䱦⇥ᱟ⭡ CPU 䈫ਆ FDC ᮠᦞᇴᆈಘ䘄എ٬ ≲ؑਧ੺⸕ CPU ᢗ㹼䱦⇥㔃ᶏDŽ 䜘ᮠᦞՐ䘱ᆼDŽ↔ᰦ DMA ᧗ࡦಘՊሶՐ䗃ᆇ㢲䇑ᮠ㓸→ؑਧ䙊⸕ FDCˈᴰਾ⭡ FDC ਁࠪѝᯝ䈧ޘⴤ㠣 ᔿ䘋㹼DŽѝᯝᯩᔿ⇿⅑Ր䘱 1 ᆇ㢲DŽDMA ᯩᔿᱟ൘ DMA ᧗ࡦಘ㇑⨶лˈFDC о޵ᆈ䘋㹼ᮠᦞⲴՐ䗃 䈧≲㧧⸕ભԔᢗ㹼Ⲵ㔃ᶏDŽྲ᷌ CPU ਁࠪⲴ FDC ભԔᱟՐ䘱ᮠᦞˈࡉ FDC ਟԕԕѝᯝᯩᔿᡆ DMA ᯩ ᢗ㹼䱦⇥ᱟ FDC ᢗ㹼ભԔ㿴ᇊⲴ᫽֌DŽ൘ᢗ㹼䱦⇥ CPU ᱟн࣐ᒢ亴Ⲵˈа㡜ᱟ䙊䗷 FDC ਁࠪѝᯝ ަਾ䐏⵰ 0--8 ᆇ㢲Ⲵ৲ᮠDŽ ભԔ䱦⇥ᱟ CPU ੁ FDC ਁ䘱ભԔᆇ㢲઼৲ᮠᆇ㢲DŽ⇿ᶑભԔⲴㅜањᆇ㢲ᙫᱟભԔᆇ㢲˄ભԔ⸱˅DŽ ਟԕ᧕ਇ 15 ᶑભԔDŽ⇿њભԔ൷㓿শйњ䱦⇥˖ભԔ䱦⇥ǃᢗ㹼䱦⇥઼㔃᷌䱦⇥DŽޡ䖟ⴈ᧗ࡦಘ 䙊ᑨ㔃᷌ᮠᦞᴰཊᴹ 7 њᆇ㢲DŽ Ѫ 0˄CPU Æ FDC˅ˈ䇯䰞ਚ䈫රᇴᆈಘᰦࡉ৽ѻDŽ൘䈫ਆ㔃᷌ᰦਚᴹ൘ FDC нᘉѻਾ᡽㇇䈫ᆼ㔃᷌ˈ ᰦ࡫ਚ㜭ᴹањᇴᆈಘࠪ⧠൘ᮠᦞㄟਓ 0x3f5DŽ൘䇯䰞ਚ߉රᇴᆈಘᰦˈѫ⣦ᘱ᧗ࡦⲴ DIO ᯩੁսᗵ享 FDC Ⲵᮠᦞㄟਓሩᓄཊњᇴᆈಘ˄ਚ߉රભԔᇴᆈಘ઼৲ᮠᇴᆈಘǃਚ䈫ර㔃᷌ᇴᆈಘ˅ˈնԫа ԕࡔ࡛ᖃࡽ FDC ᮠᦞᇴᆈಘᱟ੖ቡ㔚ˈԕ৺⺞ᇊᮠᦞՐ䘱ⲴᯩੁDŽ ᘱDŽ䙊ᑨˈ൘ CPU ੁ FDC ਁ䘱ભԔѻࡽᡆӾ FDC 㧧ਆ᫽֌㔃᷌ѻࡽˈ䜭㾱䈫ਆѫ⣦ᘱᇴᆈಘⲴ⣦ᘱսˈ FDC Ⲵѫ⣦ᘱᇴᆈಘҏᱟањ 8 սᇴᆈಘˈ⭘Ҿ৽᱐䖟ⴈ᧗ࡦಘ FDC ઼䖟ⴈ傡ࣘಘ FDD Ⲵสᵜ⣦ ༽ս FDC ԕ৺ݱ䇨/⾱→ DMA ৺ѝᯝ䈧≲DŽ ᮠᆇ䗃ࠪㄟਓ˄ᮠᆇ᧗ࡦㄟਓ˅ᱟањ 8 սᇴᆈಘˈᆳ᧗ࡦ傡ࣘಘ傜䗮ᔰ੟ǃ傡ࣘಘ䘹ᤙǃ੟ࣘ/ 0x3f7 ਚ߉ ⻱ⴈ᧗ࡦᇴᆈಘ(Ր䗃⦷᧗ࡦ) ᇴᆈಘޕ0x3f7 ਚ䈫 ᮠᆇ䗃 FDC ᮠᦞᇴᆈಘ FDC ѫ⣦ᘱᇴᆈಘ 䈫/߉ ਚ䈫 0x3f5 0x3f4   VFKHGF 〻ᒿ &5 䇑ᮠᇴᆈಘ 2/ 䗃ࠪ䬱ᆈ 287 *$7( &/. ᇴᆈಘ ⣦ᘱ 䙫䗁 ᧗ࡦ ⣦ᘱ䬱ᆈ &( 䇑ᮠঅݳ E 䙊䚃  䇑ᮠಘ޵䜘㔃ᶴ D ᮤփṶമ 䇑ᮠಘ  䙊䚃 䇑ᮠಘ  䙊䚃 䇑ᮠಘ  䙊䚃 ᇴᆈಘ ᧗ࡦᆇ 䙫䗁 䈫߉ 㕃ߢಘ ᮠᦞ 287 *$7( &/. 287 *$7( &/. 287 *$7( &/. $$ &6 5':5 '' ਟԕሩᜣ㾱֯⭘Ⲵањ䇑ᮠಘ䘋㹼㕆〻DŽሩҾн֯⭘Ⲵ䇑ᮠಘᡁԜਟԕнᗵሩަ㕆〻DŽ㺘 8–3 ᱟ᧗ࡦᇴ ᡁԜቡˈањ᧗ࡦᆇ઼ањࡍ࿻䇑ᮠ٬ޕᖃ㌫㔏ࡊк⭥ᰦˈ8253 Ⲵ⣦ᘱᱟᵚ⸕ⲴDŽ䙊䗷ੁ 8253 ߉ 2. 8253˄8254˅㣟⡷Ⲵ㕆〻 㝊ਁࠪؑਧDŽ ݳՊ൘ᰦ䫏㜹ߢ CLK Ⲵ֌⭘лᢗ㹼䙂߿䇑ᮠ᫽֌DŽ⇿⅑߿ 1ˈⴤࡠ䇑ᮠ٬䙂߿Ѫ 0 ᰦˈቡՊੁ OUT ᕅ ᆈࡠ䇑ᮠᇴᆈಘ CR ѝѻਾˈቡՊ㻛䘱ࡠ䇑ᮠঅݳ CE ѝDŽᖃ GATE ᔰ੟ᰦˈ䇑ᮠঅ؍൘ࡍ࿻䇑ᮠ٬㻛 ѝˈ❦ਾՊ㻛༽ࡦࡠ䇑ᮠঅݳ CE ѝDŽ൘ᔰ࿻ሩ䇑ᮠಘ䘋㹼㕆〻᫽֌ᰦˈ䘉єњᇴᆈಘሶ㻛␵䴦DŽഐ↔ ᆈ൘䘉єњᇴᆈಘ؍䇑ᮠಘ䙊䚃ᰦˈࡍ࿻䇑ᮠ٬ቡޕRegister˅Ⲵ 8 սᇴᆈಘDŽᖃ CPU ᢺᯠⲴ䇑ᮠ٬߉ 㾱䈫ਆ䇑ᮠ٬ᰦˈ䈫ਆⲴᙫᱟ䗃ࠪ䬱ᆈ OL ѝⲴ޵ᇩDŽമ 8-8(b)ѝਖཆєњᱟ〠Ѫ䇑ᮠᇴᆈಘ CR˄Count ࡠ CPU 䈫ਆᆳԜⲴ޵ᇩਾˈᆳԜ᡽Պ㔗㔝䐏䲿 CE Ⲵ޵ᇩਈॆDŽ⌘᜿ˈCE Ⲵ٬ᱟнਟ䈫Ⲵˈ⇿ᖃ֐䴰 ݳ CE Ⲵ޵ᇩਈॆ㘼ਈॆˈնᱟྲ᷌㣟⡷᧕᭦ࡠањ䇑ᮠಘ䬱ᆈભԔᰦˈ䛓ѸᆳԜⲴ޵ᇩሶ㻛䬱ᇊDŽⴤ OLl єњ 8 ս䬱ᆈಘ㓴ᡀˈ࠶࡛㺘⽪䬱ᆈⲴ儈ᆇ㢲઼վᆇ㢲DŽ䙊ᑨ䘉єњ䗃ࠪ䬱ᆈಘⲴ޵ᇩ䐏䲿䇑ᮠঅ Ⲵ CE˄䇑ᮠঅݳ˅DŽᆳᱟањ 16 սਟ亴㖞਼↕䙂߿䇑ᮠಘDŽ䗃ࠪ䬱ᆈ OL˄Output Latch˅ᱟ⭡ OLm ઼ ᴹ᧗ࡦᆇᇴᆈಘⲴᖃࡽ޵ᇩԕ৺䗃ࠪㄟⲴ⣦ᘱ઼ NULL 䇑ᮠḷᘇ˄Null Count Flag˅DŽᇎ䱵䇑ᮠಘᱟമѝ മ 8-8(b)ᱟަѝањ䇑ᮠಘ䙊䚃Ⲵ޵䜘䙫䗁ṶമDŽަѝ⣦ᘱᇴᆈಘ˄Status Register˅൘䬱ᇊᰦሶਜ਼ ؑਧㄟDŽ ԕ৺䇑ᮠಘⲴ䗃ࠪ⣦ᘱDŽᕅ㝊 OUT ᱟ䇑ᮠಘⲴ䗃ࠪڌㄟˈᆳ⭘Ҿ᧗ࡦ䇑ᮠಘⲴ䎧ޕ䇑ᮠಘⲴ䰘᧗ࡦ䗃 仁⦷ᴰ儈Ѫ 2.6MHzˈ㘼 8254 ࡉਟ儈䗮 10MHzDŽᕅ㝊 GATE ᱟޕ䫏仁⦷ਁ⭏ಘ˄Ღᥟ˅DŽ8253 Ⲵᰦ䫏䗃 ԕᐕ֌൘н਼ⲴᯩᔿлDŽ᧗ࡦᆇᇴᆈಘሶ⺞ᇊ⇿њ䇑ᮠಘⲴᐕ֌ᯩᔿDŽ⇿њ䇑ᮠಘⲴ CLK ᕅ㝊䘎᧕ࡠᰦ ⴨਼ˈԆԜ⇿њ䜭ਟޘ˄Read-Back Command˅ᶕ䈫ਆަѝⲴ⣦ᘱؑ᚟DŽ3 њ⤜・Ⲵ䇑ᮠಘ䙊䚃֌⭘ᆼ ᆈಘ⭘Ҿ CPU 䇮㖞ᤷᇊ䇑ᮠಘⲴᐕ֌ᯩᔿˈᱟਚ߉ᇴᆈಘDŽնሩҾ 8254 㣟⡷ࡉਟԕ֯⭘എ䈫ભԔ Ⲵ A0,A1 ൠ൰㓯кDŽ䈫߉ᕅ㝊 RDǃWR ઼⡷䘹ᕅ㝊 CS ⭘Ҿ CPU ᧗ࡦ 8253 㣟⡷Ⲵ䈫߉᫽֌DŽ᧗ࡦᆇᇴ 䘹ᤙ䴰㾱䈫/߉Ⲵ 3 њ䇑ᮠಘ䙊䚃ᡆ᧗ࡦᆇᇴᆈಘ˄Control Word Register˅ѻаDŽ䙊ᑨᆳԜ㻛䘎᧕ࡠ㌫㔏 ࡠަԆ䜘࠶৫Ⲵ᧗ࡦؑਧDŽൠ൰㓯 A1ǃA0 ⭘ᶕޕਧˈᒦф⭏ᡀ䗃ؑޕLogic˅⭘ҾӾ㌫㔏ᙫ㓯к᧕᭦䗃 ަѝ 3 ᘱǃৼੁ 8 սⲴᮠᦞᙫ㓯㕃ߢಘ˄Data Bus Buffer˅⭘Ҿо㌫㔏ᮠᦞᙫ㓯᧕ਓDŽ䈫/߉䙫䗁˄Read/Write ഴ δε㣥⡽Ⲻ޻䜞㔉ᶺ    VFKHGF 〻ᒿ ˅(3) ᯩᔿ 2 - 仁⦷ਁ⭏ಘᯩ⌅˄Rate Generator ᯠᔰ࿻䇑ᮠ᫽֌DŽሩҾ䘉⿽ᐕ֌ᯩᔿˈGATE ؑਧн䎧֌⭘DŽ ࡍ࿻䇑ᮠ٬ᒦ䟽ޕOUT ਈѪ儈⭥ᒣDŽ൘䇑ᮠᵏ䰤ᡆ䇑ᮠ㔃ᶏਾˈGATE 䟽ᯠਈ儈⭥ᒣ৸Պ䀖ਁ䇑ᮠಘ㻵 ༷ቡ㔚DŽ↔ᰦਟ֯⭘ GATE ᕅ㝊кॷ⋯䀖ਁ䇑ᮠಘᔰ࿻ᐕ֌ˈ㘼 OUT ࡉਈѪվ⭥ᒣDŽⴤࡠ䇑ᮠ㔃ᶏ˄0˅ˈ Ҷ᧗ࡦᆇ઼ࡍ࿻䇑ᮠ٬ਾˈ䇑ᮠಘ߶ޕᐕ֌൘䘉⿽ᯩᔿлᰦˈOUT ࡊᔰ࿻༴Ҿ儈⭥ᒣDŽ൘ CPU ߉ (2) ᯩᔿ 1 - ⺜Ԧਟ䀖ਁঅ⅑䇑ᮠᯩᔿ˄Hardware Retriggerable One-shot˅ ᒦф൘᧕᭦ࡠ䇑ᮠ儈ᆇ㢲ਾ䟽ᯠᢗ㹼䇑ᮠᐕ֌DŽˈࡍ࿻䇑ᮠ٬ޕਧ˗൘䇑ᮠᵏ䰤ਟԕ䟽ᯠ㻵 䇑ᮠ㔃ᶏᰦ䗃ࠪਈ儈⭥ᒣਟ֌Ѫѝᯝؑ˗ڌԦ䇑ᮠDŽ䘉⿽ᯩᔿⲴ⢩⛩ᱟݱ䇨֯⭘ GATE ᕅ㝊᧗ࡦ䇑ᮠᲲ ањᯠⲴ䇑ᮠ٬ᡆ৸䟽ᯠ䇮㖞᧗ࡦᆇѪᯩᔿ 0DŽ䘉⿽ᯩᔿ䙊ᑨ⭘ҾһޕᤱѪ儈⭥ᒣⴤࡠ߉؍Ѫ儈⭥ᒣᒦ ᤱѪվ⭥ᒣⴤࡠ䇑ᮠ䙂߿Ѫ 0DŽ↔ᰦ OUT ਈ؍䈕ᯩᔿ䇮ᇊਾˈ䗃ࠪᕅ㝊 OUT Ѫվ⭥ᒣDŽᒦф࿻㓸 (1) ᯩᔿ 0 - 䇑ᮠ㔃ᶏѝᯝᯩᔿ˄Interrupt on terminal count˅ 8253/8254 Ⲵ 3 њ䇑ᮠಘ䙊䚃ਟԕᴹ਴㠚⤜・Ⲵᐕ֌ᯩᔿˈᴹԕл 6 ⿽ᯩᔿਟ׋䘹ᤙDŽ 3. 䇑ᮠಘᐕ֌ᯩᔿ ਚᴹ൘ CPU ᢗ㹼Ҷ䈫ਆ䈕䇑ᮠಘ᫽֌ਾˈOL Ⲵ޵ᇩ᡽৸Պ㠚ࣘൠ䐏䲿䇑ᮠঅݳ CE 䘋㹼ਈॆDŽ ٬ǃ䇑ᮠಘ䘀㹼Ⲵᯩᔿˈԕ৺ᖃࡽ䗃ࠪ⣦ᘱ઼ NULL 䇑ᮠḷᘇDŽоㅜ 2 ѝᯩ⌅㊫լˈ൘䬱ᇊ䇑ᮠ٬ਾˈ ݳ CE 䘋㹼ਈॆDŽㅜ 3 ⿽ᯩ⌅ᱟ֯⭘എ䈫ભԔDŽնਚᴹ 8254 ᴹ↔࣏㜭DŽ䘉њભԔݱ䇨〻ᒿỰ⍻ᖃࡽ䇑ᮠ ཆаᶑ䇑ᮠಘ䬱ᆈભԔDŽਚᴹ൘ CPU ᢗ㹼Ҷ䈫ਆ䈕䇑ᮠಘ᫽֌ਾˈOL Ⲵ޵ᇩ᡽৸Պ㠚ࣘൠ䐏䲿䇑ᮠঅ ᤱнਈˈণ֯֐৸ਁ䘱Ҷਖ؍ᆈᇴᆈಘ OL ѝDŽ↔ᰦ CPU 㤕н䈫ਆ OL ѝⲴ޵ᇩˈ䛓Ѹ OL ѝⲴᮠ٬ሶ ಘ䬱ᆈભԔ㘼䶎᧗ࡦᆇભԔDŽᖃ䇑ᮠಘ᧕᭦ࡠ䈕ભԔᰦˈᆳՊᢺ䇑ᮠঅݳ CE ѝⲴ䇑ᮠ٬䬱ᆈࡠ䗃ࠪ䬱 ԔDŽ䈕ભԔᱟ൘䈫᫽֌ࡽ俆ݸਁ䘱ࡠ᧗ࡦᆇᇴᆈಘˈᒦ⭡ D5ˈD4 єњ∄⢩ս˄00˅ᤷ᰾ਁ䘱Ⲵᱟ䇑ᮠ DŽ੖ࡉ䇑ᮠ᫽֌ਟ㜭↓൘䘋㹼ˈӾ㘼䙐ᡀ䈫ਆⲴ㔃᷌ᴹ䈟DŽㅜ 2 ⿽ᯩ⌅ᱟ֯⭘䇑ᮠಘ䬱ᆈભޕⲴᰦ䫏䗃 䇑ᮠಘ→ڌಘ䬱ᆈભԔ˗Ĺ֯⭘എ䈫ભԔDŽㅜ 1 ⿽ᯩ⌅൘䈫ᰦᗵ享֯⭘ GATE ᕅ㝊ᡆ⴨ᓄ䙫䗁⭥䐟Ჲᰦ ķㆰঅ䈫᫽֌˗ĸ֯⭘䇑ᮠ˖൘䈫᫽֌ᰦˈሩҾ 8254 㣟⡷ਟᴹ 3 ⿽ᯩ⌅ᶕ䈫ਆ䇑ᮠಘⲴᖃࡽ䇑ᮠ٬ ᯠⲴࡍ࿻٬DŽ䘉ᒦнՊᖡ૽ᐢ䇮㖞Ⲵ䇑ᮠಘⲴᐕ֌ᯩᔿDŽޕ߉ Ҽ䘋ࡦⲴᡆ BCD ⸱Ṭᔿ˅DŽ൘䇑ᮠಘᔰ࿻ᐕ֌ᰦˈᡁԜӽ❦㜭䲿ᰦੁᤷᇊ䇑ᮠಘ䟽ᯠ˄ޕ䇮ᇊⲴṬᔿ߉ ࡍ࿻䇑ᮠ٬DŽࡍ࿻䇑ᮠ٬ᗵ享ṩᦞ᧗ࡦᆇѝޕ᧗ࡦᆇˈ❦ਾ޽߉ޕ᫽֌ᰦˈᗵ享俆ݸ߉ޕಘѻаDŽ൘߉ ಘѝDŽᖃ A1ˈA0 Ѫ 00ǃ01ǃ10˄࠶࡛ሩᓄ PC ᵪㄟਓ 0x40ǃ0x41 ઼ 0x42˅ᰦቡՊ࠶࡛䘹ᤙ 3 њ䇑ᮠ ᤷᇊⲴ䇑ᮠޕ᧗ࡦᆇᇴᆈಘѝDŽ㘼᧗ࡦᆇⲴ޵ᇩՊᤷᇊ↓൘㕆〻Ⲵ䇑ᮠಘ䙊䚃DŽࡍ࿻䇑ᮠ٬ࡉՊ㻛߉ޕ ൘ CPU ᢗ㹼߉᫽֌ᰦˈ㤕 A1ˈA0 㓯Ѫ 11˄↔ᰦ൘ PC ᗞᵪкሩᓄㄟਓ 0x43˅ˈ䛓Ѹ᧗ࡦᆇՊ㻛߉ 0 BCD 䇑ᮠ٬Ṭᔿ䘹ᤙDŽ 0 - 16 ∄⢩Ҽ䘋ࡦ䇑ᮠ˗ 1 - 4 њ BCD ⸱䇑ᮠDŽ 011 - ᯩᔿ 3˗ 100 - ᯩᔿ 4˗ 101 - ᯩᔿ 5DŽ 000 - ᯩᔿ 0˗ 001 - ᯩᔿ 1˗ 010 - ᯩᔿ 2˗ M2-M0 ⭘Ҿ䘹ᤙᤷᇊ䙊䚃Ⲵᐕ֌ᯩᔿDŽ˄M - Method˅ 1 M0 2 M1 3 M2 10 - 䈫߉儈ᆇ㢲˄MSB˅˗ 11 - ݸ䈫߉վᆇ㢲ˈ޽䈫߉儈ᆇ㢲DŽ 00 - 㺘⽪ᱟᇴᆈಘ䬱ᆈભԔ˗01 - 䈫߉վᆇ㢲˄LSB˅˗ RW1ǃRW0 ⭘Ҿ䇑ᮠಘ䈫߉᫽֌䘹ᤙDŽ˄RW - Read Write˅ 4 RW0 5 RW1 00 - 䙊䚃 0˗ 01 - 䙊䚃 1˗ 02 - 䙊䚃 2˗ 11 - എ䈫ભԔ˄ӵ 8254 ᴹ˅DŽ SC1ǃSC0 ⭘Ҿ䘹ᤙ䇑ᮠಘ䙊䚃 0-2ˈᡆ㘵എ䈫ભԔDŽ˄SC - Select Counter˅ 6 SC0 7 SC1 ս਽〠䈤᰾ 㺞 ̢δε㣥⡽᧝࡬ᆍṲᕅ ᆈಘ޵ᇩⲴṬᔿDŽ   VFKHGF 〻ᒿ 63.'$7$ ֌傡ࣘ о䶎⭥䐟 ࡧᯠ⭥䐟  ѝᯝ᧗ࡦಘ $ 0+] ᰦ䫏仁⦷ ᮠᦞᙫ㓯 &6 $ $ :5 5'287  ''  *$7( *$7(287 *$7(  &/. &/. &/.287  ൠ൰ [[ 7,0(*$7( 9 ,54 3& ᗤᵰѣᇐᰬ䇗ᮦ㣥⡽䘔᧛⽰ᝅഴ ഴ  ᧗ࡦᆇᇴᆈಘ߉ㄟਓDŽ 8254 㣟⡷Ⲵ IO ㄟਓൠ൰㤳തᱟ 0x40--0x43DŽަѝ 0x40--0x42 ࠶࡛ሩᓄ䘹ᤙ䇑ᮠಘ䙊䚃 0--2ˈ0x43 ሩᓄ 㓯 A1ˈA0 кDŽᒦфᖃ㌫㔏ൠ൰㓯 A9--A2 ؑਧᱟ 0b0010000 ᰦՊ䘹ᤙ 8254 㣟⡷ˈഐ↔ PC/AT ㌫㔏ѝ 1.193180MHzDŽPC/AT ᗞᵪѝ 8254 㣟⡷䘎᧕⽪᜿മ㿱മ 8-9 ᡰ⽪DŽަѝ A1ˈA0 ᕅ㓯㻛䘎᧕ࡠ㌫㔏ൠ൰ ᰦ䫏仁⦷䜭ᱟޕѝᯝؑਧǃࣘᘱ޵ᆈ DRAM ࡧᯠᇊᰦ⭥䐟઼ѫᵪᢜ༠ಘ丣䈳ਸᡀDŽ3 њ䇑ᮠಘⲴ䗃 ሩҾ PC/AT ৺ަެᇩᗞᵪ㌫㔏ˈ䟷⭘Ⲵᱟ 8254 㣟⡷DŽ3 њᇊᰦ/䇑ᮠಘ䙊䚃㻛࠶࡛⭘Ҿᰕᰦ䫏䇑ᰦ 㘼ᔰ࿻ᐕ֌DŽਚᴹᖃ GATE ᕅ㝊ਈѪ儈⭥ᒣਾⲴањ CLK ᰦ䫏㜹ߢਾ᡽Պ㻛䀖ਁᔰ࿻ᐕ֌DŽ ᧗ࡦᆇ઼ࡍ࿻٬ਾˈ䇑ᮠಘᒦнՊ・࡫࣐䖭ࡍ࿻䇑ᮠ٬ޕᰦ䫏 CLK 㜹ߢᇭᓖⲴվ⭥ᒣˈ❦ਾਈ儈DŽ൘߉ ࡍ࿻⣦ᘱл OUT Ѫ儈⭥ᒣDŽ䇑ᮠ᫽֌ሶ⭡ GATE ᕅ㝊кॷ⋯䀖ਁDŽᖃ䇑ᮠ㔃ᶏˈOUT ሶ䗃ࠪањ (6) ᯩᔿ 5 - ⺜Ԧ䀖ਁ䘹䙊ᯩᔿ˄Hardware Triggered Strobe˅ њᰦ䫏㜹ߢਾ֯⭘ᯠ٬ᶕ䟽ᯠ䘋㹼䇑ᮠ᫽֌DŽ 䛓Ѹ䇑ᮠಘՊ൘аˈҶањᯠⲴࡍ࿻٬ޕݱ䇨䇑ᮠ˅ˈնнᖡ૽ OUT Ⲵ⣦ᘱDŽྲ᷌൘䇑ᮠ䗷〻ѝ߉ 1˄ ڌࡍ࿻䇑ᮠ٬㘼“䀖ਁ”ⲴDŽ൘䈕ᐕ֌ᯩᔿлˈGATE ᕅ㝊ਟԕ᧗ࡦ䇑ᮠᲲޕ⭥ᒣ䘹䙊˅DŽ䇑ᮠ᫽֌ᱟ⭡߉ ࡍ࿻⣦ᘱл OUT Ѫ儈⭥ᒣDŽᖃ䇑ᮠ㔃ᶏᰦ OUT ሶ䗃ࠪањᰦ䫏㜹ߢᇭᓖⲴվ⭥ᒣˈ❦ਾਈ儈˄վ (5) ᯩᔿ 4 - 䖟Ԧ䀖ਁ䘹䙊ᯩᔿ˄Software Triggered Strobe˅ ⭘DŽ 䘉њࡍ࿻٬㾱ࡠࡽањ䇑ᮠᆼᡀਾ᡽䎧֌ˈ⮕ᴹᐞᔲ˅ˈᒦф൘䇑ᮠಘ䙂߿䗷〻ѝ㤕䟽ᯠ䇮㖞ᯠⲴࡍ࿻٬ ᰦ䫏 CLK Ⲵ N ࠶ѻаDŽ䈕ᯩᔿⲴ⢩⛩ᱟᯩ⌒ঐオ∄㓖Ѫ 1 ∄ 1˄ᖃ N Ѫཷᮠᰦޕ䛓Ѹᯩ⌒Ⲵ仁⦷ᱟ䗃 䈕ᯩᔿ䙊ᑨ⭘Ҿ⌒⢩⦷ਁ⭏ಘDŽ䈕ᯩᔿоᯩᔿ 2 ㊫լˈն OUT 䗃ࠪⲴᱟᯩ⌒DŽྲ᷌ࡍ࿻䇑ᮠ٬ᱟ Nˈ (4) ᯩᔿ 3 - ᯩ⌒ਁ⭏ಘᯩᔿ˄Square Wave Mode˅ ࿻٬ᒦᔰ࿻䟽ᯠ䇑ᮠDŽ 㔗㔝DŽᖃ GATE ਈ儈ᰦՊ䇙䇑ᮠಘ䟽ᯠ࣐䖭ࡍ઼ڌ⭥ᒣ㜹ߢؑਧDŽ൘䘉⿽ᯩᔿл GATE ਟ᧗ࡦ䇑ᮠⲴᲲ 䟽ᯠ࣐䖭ࡍ࿻٬ᒦ䟽༽к䘠䗷〻DŽഐ↔ሩҾࡍ࿻䇑ᮠ٬Ѫ N ⲴᛵߥˈՊ൘⇿ N њᰦ䫏㜹ߢᰦ䗃ࠪањվ 䇑ᮠ٬䙂߿Ѫ 1 ᰦˈOUT ਈѪվ⭥ᒣਾ޽ਈᡀ儈⭥ᒣDŽ䰤䳄ᰦ䰤Ѫањ CLK 㜹ߢᇭᓖDŽ↔ᰦ䇑ᮠಘՊ 䈕ᯩᔿⲴ࣏㜭㊫լҾањ N ࠶仁ಘDŽ䙊ᑨ⭘Ҿӗ⭏ᇎᰦᰦ䫏ѝᯝDŽࡍ࿻⣦ᘱл OUT Ѫ儈⭥ᒣDŽᖃ   VFKHGF 〻ᒿ 䎧ࡠᘭ⮕䈕ؑਧⲴ਼ṧˈڊԫօ᫽֌ˈᖃ❦ҏਟԕӰѸнڊ༴⨶࠭ᮠDŽ൘䈕༴⨶࠭ᮠѝˈᡁԜਟԕ 2. ᦅ㧧䈕ؑਧDŽѪҶ䘋㹼䈕᫽֌ˈᡁԜᗵ享俆ݸ੺䇹޵Ṩ൘ᤷᇊⲴؑਧਁ⭏ᰦ䈳⭘ᡁԜ㠚ᇊѹⲴؑਧ ᔲᑨ㘼ӗ⭏Ⲵؑਧ˄ֻྲ㻛 0 䲔˅ˈࡉ䘋〻Ⲵ㹼Ѫᡆ⣦ᘱቡਟ㜭ਈᗇнਟ⸕ҶDŽ ᤷᇊⲴԫօ䘋〻DŽਖཆˈ㤕ᘭ⮕ᦹḀӋ⺜Ԧ→ڌഐᱟѪҶੁ䎵㓗⭘ᡧᨀ׋ањ⺞ᇊⲴᯩ⌅ᶕ㓸→ᡆ 1. ᘭ⮕䈕ؑਧDŽབྷཊᮠؑਧ䜭ਟԕ㻛䘋〻ᘭ⮕DŽնᴹєњؑਧᘭ⮕нᦹ˖SIGKILL ઼ SIGSTOPDŽަ৏ ሩҾ䘋〻ᶕ䈤ˈᖃ᭦ࡠањؑਧᰦˈਟԕ⭡й⿽н਼Ⲵ༴⨶ᡆ᫽֌ᯩᔿDŽ ࡇ㺘ˈҏਟ৲䰵 include/signal.h ཤ᮷ԦDŽ ࡽ㘵ਟ㺘⽪㌫㔏ⴞࡽ䘈н᭟ᤱⲴᡰᴹަԆؑਧ⿽㊫DŽ䘉 22 ⿽ؑਧⲴާփ਽〠઼ᇊѹਟ৲㘳〻ᒿਾⲴؑਧ ѝ㿴ᇊⲴᡰᴹؑਧˈਖཆ 2 ⿽ᱟ Linux Ⲵу⭘ؑਧ˖SIGUNUSED˄ᵚᇊѹ˅઼ SIGSTKFLT˄ึḸ䭉˅ˈ ⽪ 32 њн਼ⲴؑਧDŽ൘ᵜ⡸ Linux ޵ṨѝˈᇊѹҶ 22 ⿽н਼ⲴؑਧDŽަѝ 20 ⿽ؑਧᱟ POSIX.1 ḷ߶ ൘޵Ṩԓ⸱ѝ䙊ᑨ֯⭘ањᰐㅖਧ䮯ᮤᮠ˄32 ս˅ѝⲴ∄⢩սᶕ㺘⽪਴⿽н਼ؑਧDŽഐ↔ᴰཊਟ㺘 ᤱެᇩᙗˈᵜ〻ᒿѝ䘈ᱟᨀ׋Ҷє⿽༴⨶ؑਧⲴᯩ⌅DŽ؍POSIX ᨀ׋Ҷа⿽ਟ䶐༴⨶ؑਧⲴᯩ⌅DŽѪҶ 䰝ањᤷᇊⲴؑਧˈਾᶕޣ䛓Ѹਟ䶐DŽؑਧਟ㜭Պ㻛ђཡˈ㘼ф൘༴⨶㍗㾱४ฏԓ⸱ᰦ䘋〻ᴹᰦᖸ䳮 ؑਧ༴⨶ᵪࡦ൘ᖸᰙⲴ UNIX ㌫㔏ѝቡᐢ㓿ᴹҶˈն䛓Ӌᰙᵏ UNIX ޵Ṩѝؑਧ༴⨶Ⲵᯩ⌅ᒦнᱟ ҏਟԕੁਖањ䘋〻ਁ䘱ؑਧDŽֻྲ֯⭘ kill()࠭ᮠੁ਼㓴Ⲵᆀ䘋〻ਁ䘱㓸→ᢗ㹼ؑਧDŽ њ SIGALRM ؑਧ˗ᖃਁ⭏⺜Ԧᔲᑨᰦˈ㌫㔏ҏՊੁ↓൘ᢗ㹼Ⲵ䘋〻ਁ䘱⴨ᓄⲴؑਧDŽਖཆˈањ䘋〻 ؑਧˈᒦ㻛ਁ䘱ࡠᖃࡽࡽਠᢗ㹼Ⲵ䘋〻ѝ˗ᖃ䘋〻䇮㖞Ⲵањᣕ䆖ᰦ䫏ࡠᵏᰦˈ㌫㔏ቡՊੁ䘋〻ਁ䘱а ctrl-C 㓴ਸ䭞ᶕ㓸→ањ〻ᒿⲴᢗ㹼DŽ䈕᫽֌ቡՊӗ⭏ањ SIGINT˄SIGnal INTerrupt˅ ޕ㓸ㄟ䭞ⴈк䭞 ᵪࡦDŽᴹ䇨ཊ䖳Ѫ༽ᵲⲴ〻ᒿՊ֯⭘ࡠؑਧDŽؑਧᵪࡦᨀ׋Ҷа⿽༴⨶ᔲ↕һԦⲴᯩ⌅DŽֻྲˈ⭘ᡧ൘ ਧ༴⨶Ⲵ࠭ᮠDŽ൘ UNIX ㌫㔏ѝˈؑਧᱟа⿽Ā䖟Ԧѝᯝā༴⨶ؑޣ signal.c 〻ᒿ⎹৺޵Ṩѝᡰᴹᴹ 8.8.1 ࣕ㜳ᨅ䘦 8.8 signal.c ぁᓅ ઼㔏䇑⇿њԫ࣑֯⭘Ⲵ㌫㔏䍴Ⓚ䟿˄ᰦ䰤˅DŽ >> 8)DŽ䘉њ䰤䳄ᇊᰦӗ⭏Ⲵѝᯝ䈧≲ቡᱟ Linux 0.11 ޵Ṩᐕ֌Ⲵ㜹ᨿˈᆳ⭘Ҿᇊᰦ࠷ᦒᖃࡽᢗ㹼Ⲵԫ࣑ ࡍ࿻䇑ᮠ٬Ⲵվᆇ㢲઼儈ᆇ㢲DŽࡍ࿻䇑ᮠ٬վᆇ㢲઼儈ᆇ㢲٬࠶࡛Ѫ(LATCH & 0xff)઼(LATCHޕ䲿ਾ߉ Ⲵ᧗ࡦᆇᱟ 0x36˄0b00110110˅ˈޕਁࠪањᯩ⌒кॷ⋯ؑਧԕӗ⭏ѝᯝ䈧≲ؑਧ˄IRQ0˅DŽഐ↔ੁ 8254 ߉ ᮠࡍ࿻٬䟷⭘Ҽ䘋ࡦˈᒦфࡍ࿻䇑ᮠ٬㻛䇮㖞Ѫ LATCH˄1193180/100˅DŽণ䇙䇑ᮠಘ 0 ⇿䰤䳄 10 ∛。 Linux 0.11 ᫽֌㌫㔏ਚሩ 8254 Ⲵ䇑ᮠಘ䙊䚃 0 䘋㹼Ҷ䟽ᯠ䇮㖞ˈ֯ᗇ䈕䇑ᮠಘᐕ֌൘ᯩᔿ 3 лǃ䇑 ಘ֯⭘DŽ ᮠಘ䙊䚃⭘Ҿ䇙ѫᵪᢜ༠ಘਁࠪ丣䈳ˈնҏਟԕо 8255A 㣟⡷˄ᡆަㅹ᭸⭥䐟˅䝽ਸ֌ѪањᲞ䙊ᇊᰦ 䐟ѝDŽമ 8-9 ѝⲴ SPK DATA 㻛䘎᧕㠣 8255A 㣟⡷ㄟਓ B˄0x61˅Ⲵ D1 ᕅ㝊ᡆㅹ᭸䙫䗁⭥䐟ѝDŽ䈕䇑 䇑ᮠಘ䙊䚃 2 Ⲵ GATE ᕅ㝊˄TIME2GATE˅㻛䘎᧕㠣 8255A 㣟⡷ㄟਓ B Ⲵ D0 ᕅ㝊ᡆㅹ᭸䙫䗁⭥ 66.288KHzDŽ PC/AT ㌫㔏Ⲵࡧᯠ⭥䐟ਁࠪ RAM ࡧᯠؑਧDŽབྷ㓖⇿ 15 ᗞ。䗃ࠪањؑਧˈ䗃ࠪ仁⦷Ѫ 1.19318/18 = ⦷ਁ⭏ಘᯩᔿ˅лˈࡍ࿻٬䙊ᑨ㻛䇮㖞Ѫ 18DŽ䈕䇑ᮠಘ㻛⭘ᶕੁ PC/XT ㌫㔏Ⲵ DMA ᧗ࡦಘ䙊䚃 2 ᡆ 䇑ᮠಘ䙊䚃 1 Ⲵ GATE ᕅ㝊ҏⴤ᧕䘎᧕ࡠ儈⭥ᒣкˈഐ↔༴Ҿݱ䇨䇑ᮠ⣦ᘱDŽަᐕ֌൘ᯩᔿ 2˄仁 ਁࠪањѝᯝ䈧≲DŽ ⡷Ⲵ 0 㓗ѝᯝ䈧≲ㄟDŽഐ↔࡙⭘ᯩ⌒кॷ⋯ਟ䀖ਁѝᯝ䈧≲ˈ֯ᗇ㌫㔏⇿䰤䳄 54.9ms˄1000ms/18.2˅ቡ 㝊Պਁࠪ仁⦷Ѫ 18.2HZ˄1.193180MHz/65536˅Ⲵᯩ⌒ؑਧDŽOUT0 㻛䘎᧕㠣ਟ㕆〻ѝᯝ᧗ࡦಘ 8259 㣟 ᯩᔿ 3 л˄ᯩ⌒ਁ⭏ಘᯩᔿ˅ˈࡍ࿻䇑ᮠ٬㻛唈䇔䇮㖞Ѫ 0ˈণ 65536˄0--65535˅DŽഐ↔⇿。䫏 OUT0 ᕅ ሩҾ䇑ᮠಘ䙊䚃 0ˈަ GATE ᕅ㝊പᇊ䘎൘儈⭥ᒣкDŽ㌫㔏ࡊк⭥ᰦᆳ㻛 BIOS 〻ᒿ䇮㖞ᡀᐕ֌൘   VLJQDOF 〻ᒿ   LQW YRLG  GHILQH6,*B,*1   LQW YRLG  GHILQH6,*B')/ ൘ include/signal.h ᮷Ԧѝ˄ㅜ 45 㹼䎧˅ˈ唈䇔ਕᷴ SIG_DFL ઼ᘭ⮕༴⨶ਕᷴ SIG_IGN Ⲵᇊѹᱟ˖ SIG_DFLDŽ ᤷ䪸DŽᒦф൘ᯠਕᷴ㻛䈳⭘ᢗ㹼䗷а⅑ਾˈؑਧ༴⨶ਕᷴ৸Պ㻛ᚒ༽ᡀ唈䇔༴⨶ਕᷴ٬ signal()࠭ᮠՊ䘄എ৏ؑਧ༴⨶ਕᷴˈ䘉њ䘄എⲴਕᷴҏᱟањᰐ䘄എ٬фާᴹањᮤර৲ᮠⲴ࠭ᮠ ֌ˈ❦ਾՊ䈳⭘ᢗ㹼ᤷᇊⲴؑਧ༴⨶࠭ᮠDŽ Ⲵؑਧ䱫ຎ᫽ޣਧ༴⨶࠭ᮠˈ䛓Ѹ޵Ṩ俆ݸՊᢺ䈕ؑਧਕᷴ㻛༽սᡀަ唈䇔ਕᷴˈᡆ㘵Պᢗ㹼оᇎ⧠⴨ ᷌ؑਧਕᷴᱟ SIG_DFLˈ䛓ѸቡՊᢗ㹼䈕ؑਧⲴ唈䇔᫽֌DŽ੖ࡉˈྲ᷌ؑਧਕᷴ㻛䇮㖞ᡀ⭘ᡧⲴањؑ Ⲵؑਧ༴⨶ਕᷴ㻛䇮㖞ᡀ SIG_IGNˈ䛓Ѹ䈕ؑਧቡՊ㻛ᘭ⮕ᦹDŽྲޣᖃᤷᇊⲴؑਧࡠᶕᰦˈྲ᷌⴨ ⭘ᡧᤷᇊⲴањؑਧ༴⨶࠭ᮠˈҏਟԕᱟ޵Ṩᨀ׋Ⲵ⢩ᇊⲴ࠭ᮠᤷ䪸 SIG_IGN ᡆ SIG_DFLDŽ signal()࠭ᮠՊ㔉ؑਧ٬ᱟ signr Ⲵؑਧᆹ㻵ањᯠⲴؑਧ༴⨶࠭ᮠਕᷴ handlerˈ䈕ؑਧਕᷴਟԕᱟ  KDQGOHU LQWVLJQUVLJIXQF VLJQDO VLJIXQF 䛓ѸᡁԜਟԕᢺ signal()࠭ᮠⲴ৏ර᭩߉ᡀл䶒Ⲵㆰঅṧᆀ˖  LQW W\SHGHIYRLGVLJIXQF signal()࠭ᮠⲴ৏ර༠᰾ⴻк৫∄䖳༽ᵲˈնᱟ㤕ᡁԜᇊѹањྲл㊫ර˖ ᮠᤷ䪸ˈ䈕ᮤර৲ᮠ⭘Ҿᖃᤷᇊؑਧਁ⭏ᰦ޵ṨሶަՐ䙂㔉༴⨶ਕᷴDŽ ˄ᯠⲴؑਧ༴⨶ਕᷴ˅void (*handler)(int)DŽᯠⲴؑਧ༴⨶ਕᷴᱟањᰐ䘄എ٬фާᴹањᮤර৲ᮠⲴ࠭ 䘉њ signal()࠭ᮠᴹєњ৲ᮠDŽањᤷᇊ䴰㾱ᦅ㧧Ⲵؑਧ signr˗ਖཆањᱟᯠⲴؑਧ༴⨶࠭ᮠᤷ䪸  LQW LQW KDQGOHU LQWVLJQUYRLG VLJQDO YRLG ൘ include/signal.h ཤ᮷Ԧㅜ 55 㹼кˈsignal()࠭ᮠ৏ර༠᰾ྲл˖ ᴽ࣑〻ᒿDŽ ؑਧˈ޵ṨቡՊṩᦞ䘋〻ԫ࣑ᮠᦞ㔃ᶴѝ sigaction[]ѝሩᓄؑਧⲴ㔃ᶴ亩ᢗ㹼⭘ᡧ㠚ᐡᇊѹⲴؑਧ༴⨶ ᖃ޵Ṩ൘䘰ࠪањ㌫㔏䈳⭘઼ḀӋѝᯝ䗷〻ᰦՊỰ⍻ᖃࡽ䘋〻ᱟ੖᭦ࡠؑਧDŽ㤕᭦ࡠҶ⭘ᡧᤷᇊⲴ⢩ᇊ ᮠᦞ㔃ᶴѝ䇮㖞 sigaction[]㔃ᶴᮠ㓴亩ˈᢺ㠚䓛ؑਧ༴⨶〻ᒿⲴᤷ䪸઼аӋ኎ᙗĀ䇠ᖅā൘䈕㔃ᶴ亩ѝDŽ ⭘㠚ᐡⲴؑਧ༴⨶〻ᒿ˄ؑਧਕᷴ˅ᰦˈ䴰㾱֯⭘ signal()ᡆ sigaction()㌫㔏䈳⭘俆ݸ൘䘋〻㠚ᐡⲴԫ࣑ ቡᱟ޵Ṩ᫽֌к䘠Ր㔏ؑਧ༴⨶Ⲵᯩᔿˈ൘ḀӋ⢩↺ᰦ࡫ਟ㜭Պ䙐ᡀؑਧђཡDŽᖃ⭘ᡧᜣሩ⢩ᇊؑਧ֯ signal()઼ sigaction()Ⲵ࣏㜭∄䖳㊫լˈ䜭ᱟᴤ᭩ؑਧ৏༴⨶ਕᷴ˄handler ,ᡆ〠Ѫ༴⨶〻ᒿ˅DŽն signal() ањ〻ᒿ˄exit.c˅ѝDŽ〻ᒿѝⲴ਽〠ࡽ㔰 sig ൷ᱟؑਧ signal Ⲵㆰ〠DŽ ਧ᫽֌Ⲵਁ䘱ؑਧ࠭ᮠ send_sig()઼䙊⸕⡦䘋〻࠭ᮠ tell_father()ࡉ㻛वਜ਼൘ਖؑޣⲴ࠭ᮠ do_signal()DŽᴹ ࣘⲴ㌫㔏䈳⭘ sys_sigaction()(ᰒਟ䶐ؑਧ༴⨶࠭ᮠ sigaction())ԕ৺൘㌫㔏䈳⭘ѝᯝ༴⨶〻ᒿѝ༴⨶ؑਧ ؑਧ༴⨶㌫㔏䈳⭘ sys_signal()˄ণՐ㔏ؑਧ༴⨶࠭ᮠ signal()˅ǃ؞᭩䘋〻൘᭦ࡠ⢩ᇊؑਧᰦᡰ䟷ਆⲴ㹼 ᵜ〻ᒿ㔉ࠪҶ䇮㖞઼㧧ਆ䘋〻ؑਧ䱫ຎ⸱˄ቿ㭭⸱˅㌫㔏䈳⭘࠭ᮠ sys_ssetmask()઼ sys_sgetmask()ǃ 㿱〻ᒿਾؑਧࡇ㺘ѝⲴ䈤᰾DŽ 3. ᢗ㹼唈䇔᫽֌DŽ޵ṨѪ⇿⿽ؑਧ䜭ᨀ׋а⿽唈䇔᫽֌DŽ䙊ᑨ䘉Ӌ唈䇔᫽֌ቡᱟ㓸→䘋〻Ⲵᢗ㹼DŽ৲ Ѥᰦ᮷ԦⲴᐕ֌DŽSIGTERM ؑਧᱟ kill ભԔਁ䘱Ⲵ唈䇔ؑਧDŽ аӋ␵⨶ڊ᮷Ԧˈ䛓ѸᡁԜቡਟԕᇊѹањ࠭ᮠᶕᦅ㧧 SIGTERM˄㓸→ᢗ㹼˅ؑਧˈᒦ൘䈕࠭ᮠѝ ֌⭘DŽ㠚ᇊѹؑਧ༴⨶࠭ᮠᶕᦅ㧧ؑਧⲴањֻᆀᱟ˖ྲ᷌ᡁԜ൘〻ᒿᢗ㹼䗷〻ѝࡋᔪҶаӋѤᰦ   VLJQDOF 〻ᒿ 䱫ຎ਼а؍⺞ᢺᖃࡽਁ䘱Ⲵؑਧवᤜ䘋৫ˈ䱫ຎ䈕ؑਧⲴ㔗㔝ਁ䘱DŽӾ㘼൘ᡁԜ༴⨶аᤷᇊؑਧᵏ䰤㜭 ਧਕᷴ㻛䈳⭘ᰦˈᡁԜቡਟԕ䱫ຎᤷᇊⲴаӋؑਧDŽᖃؑਧਕᷴ㻛䈳⭘ᰦˈᯠⲴؑਧቿ㭭սമՊ㠚ࣘൠ սമѝⲴањؑਧ䳶DŽྲ᷌ؑਧ༴⨶ਕᷴ䘄എˈ㌫㔏ቡՊᚒ༽䘋〻৏ᶕⲴؑਧቿ㭭սമDŽ䘉ṧ൘ањؑ ࡠ䘋〻ؑਧቿ㭭ޕᷴ SIG_IGNˈ䛓Ѹ൘ sa_handler ༴⨶ਕᷴਟ㻛䈳⭘ࡽˈsa_mask ᆇ⇥ቡᤷᇊҶ䴰㾱࣐ ᖃ؞᭩ањؑਧⲴ༴⨶ᯩ⌅ᰦˈྲ᷌༴⨶ਕᷴ sa_handler нᱟ唈䇔༴⨶ਕᷴ SIG_DFL ᡆᘭ⮕༴⨶ਕ ` ؑਧᚒ༽࠭ᮠᤷ䪸˄㌫㔏޵䜘֯⭘˅DŽ YRLG VDBUHVWRUHU YRLG ؑਧ䘹亩ḷᘇDŽLQWVDBIODJV ؑਧⲴቿ㭭⸱ˈਟԕ䱫ຎᤷᇊⲴؑਧ䳶DŽVLJVHWBWVDBPDVN ؑਧ༴⨶ਕᷴDŽ LQW VDBKDQGOHU YRLG VWUXFWVLJDFWLRQ^ ቡՊ൘䈕㔃ᶴѝ䘄എؑਧ৏ᶕⲴ䇮㖞ؑ᚟DŽsigaction 㔃ᶴ㿱ྲлᡰ⽪˖ ᮠ act ᤷ䪸нᱟ NULL ᰦˈቡਟԕṩᦞ act 㔃ᶴѝⲴؑ᚟؞᭩ᤷᇊؑਧⲴ㹼ѪDŽᖃ oldact нѪオᰦˈ޵Ṩ ަѝ৲ᮠ sig ᱟᡁԜ䴰㾱ḕⴻᡆ؞᭩ަؑਧ༴⨶ਕᷴⲴؑਧˈਾєњ৲ᮠᱟ sigaction 㔃ᶴⲴᤷ䪸DŽᖃ৲  ROGDFW DFWVWUXFWVLJDFWLRQ LQWVLJVWUXFWVLJDFWLRQ LQWVLJDFWLRQ include/signal.h ཤ᮷Ԧ˄ㅜ 66 㹼˅ѝⲴ༠᰾Ѫ˖ ࡦˈᆳਟԕ䇙ᡁԜᯩׯൠḕⴻᡆ؞᭩ᤷᇊؑਧⲴ༴⨶ਕᷴDŽ䈕࠭ᮠᱟ signal()࠭ᮠⲴањ䎵䳶DŽ䈕࠭ᮠ൘ ᆈᤷᇊؑਧⲴؑ᚟ˈᆳᱟа⿽ਟ䶐Ⲵ޵Ṩ༴⨶ؑਧⲴᵪ؍ sigaction()࠭ᮠ䟷⭘Ҷ sigaction ᮠᦞ㔃ᶴᶕ ᡀ唈䇔٬DŽഐ↔ቡᴹਟ㜭䙐ᡀؑਧђཡDŽ 䇮㖞㠚ᐡⲴ༴⨶ਕᷴѻࡽˈ൘䘉⇥ᰦ䰤޵ᴹਟ㜭৸ᴹањؑਧਁ⭏DŽնᱟ↔ᰦ㌫㔏ᐢ㓿ᢺ༴⨶ਕᷴ䇮㖞 㠚ᐡ䇮㖞Ⲵؑਧ༴⨶࠭ᮠѝˈն൘䟽ᯠ޽а⅑ޕ signal()࠭ᮠнਟ䶐Ⲵ৏ഐ൘Ҿᖃؑਧᐢ㓿ਁ⭏㘼䘋 `  ѫ〻ᒿѝ䇮㖞㠚ᐡⲴؑਧ༴⨶ਕᷴDŽ 6,*,17VLJBKDQGOHU  VLJQDO ^  PDLQ  `  Ѫ༴⨶ла⅑ؑਧਁ⭏㘼䟽ᯠ䇮㖞㠚ᐡⲴ༴⨶ਕᷴDŽ 6,*,17VLJBKDQGOHU  VLJQDO ^ LQWVLJQU ؑਧਕᷴDŽ YRLGVLJBKDQGOHU ѪҶ㜭䘎㔝ൠᦅ㧧ањᤷᇊⲴؑਧˈsignal()࠭ᮠⲴ䙊ᑨ֯⭘ᯩᔿֻᆀྲлDŽ ༴⨶ᯩᔿ൘ᆀ䘋〻ѝ਼ṧᴹ᭸DŽ fork()ањᆀ䘋〻ᰦˈᆀ䘋〻Պ㔗᢯⡦䘋〻Ⲵؑਧ༴⨶ᯩᔿ˄ؑਧቿ㭭⸱˅DŽഐ↔⡦䘋〻ሩؑਧⲴ䇮㖞઼ ᖃањ〻ᒿ㻛ᢗ㹼ᰦˈ㌫㔏Պ䇮㖞ަ༴⨶ᡰᴹؑਧⲴᯩᔿѪ SIG_DFL ᡆ SIG_IGNDŽਖཆˈᖃ〻ᒿ ᘭ⮕Ⲵ˅DŽ৲㿱л䶒〻ᒿࡇ㺘ѝㅜ 94—98 㹼Ⲵ༴⨶䗷〻DŽ Ⲵᤷ䪸٬ᶕࡔᯝᱟ੖֯⭘唈䇔ؑਧ༴⨶ਕᷴᡆᘭ⮕ሩؑਧⲴ༴⨶˄ᖃ❦ SIGKILL ઼ SIGSTOP ᱟн㜭㻛 њᤷ䪸٬䙫䗁к䇢ᱟᇎ䱵〻ᒿѝнਟ㜭ࠪ⧠Ⲵ࠭ᮠൠ൰٬DŽഐ↔൘ signal()࠭ᮠѝቡਟԕṩᦞ䘉єњ⢩↺ 䜭࠶࡛㺘⽪ᰐ䘄എ٬Ⲵ࠭ᮠᤷ䪸ˈо signal()࠭ᮠѝㅜҼњ৲ᮠⲴ㾱≲⴨਼DŽᤷ䪸٬࠶࡛ᱟ 0 ઼ 1DŽ䘉є   VLJQDOF 〻ᒿ ⭘ᡧ〻ᒿ   ؑਧ༴⨶〻ᒿ ла䈝ਕ ㌫㔏䈳⭘ LQW[  ޵Ṩ㌫㔏䈳⭘ѝᯝ༴⨶〻ᒿ ,5(7 ᡧึḸѝDŽ ࡠ⭘ޕ〻ᒿਕᷴᨂ ࠭ᮠDŽሶؑਧ༴⨶ 䈳⭘ GRBVLJQDO ༴⨶DŽ ሩؑਧ䘋㹼䇶࡛亴  ࠭ᮠ༴⨶〻ᒿDŽ 䈳⭘⴨ᓄ࣏㜭Ⲵ & Ⲵ޵ᇩ㿱മ 8-12 ѝᐖ䗩ᡰ⽪DŽഐ↔ do_signal()Ⲵ৲ᮠণᱟ䘉Ӌ൘޵ṨᘱึḸкⲴ޵ᇩDŽ ↔⅑ᤷᇊⲴ㌫㔏䈳⭘࣏㜭ᒦ߶༷䈳⭘ do_signal()ᰦ˄ҏণ system_call.s 〻ᒿ 118 㹼ѻਾ˅ˈ޵ṨᘱึḸѝ ⽪Ⲵ޵ᇩˈҏণ˖⭘ᡧ〻ᒿⲴ SS ઼ ESP ԕ৺⭘ᡧ〻ᒿѝлаᶑᤷԔⲴᢗ㹼⛩ս㖞 CS ઼ EIPDŽ൘༴⨶ᆼ മ 8-11 ѝᡰྲޕ޵Ṩᰦˈ䈕䘋〻Ⲵ޵ṨᘱึḸкՊ⭡ CPU 㠚ࣘ঻ޕ൘⭘ᡧ〻ᒿ䈳⭘㌫㔏䈳⭘ࡊ䘋 do_signal()࠭ᮠӾ 104 㹼ᔰ࿻Ⲵԓ⸱∄䖳䳮ԕ⨶䀓ˈл䶒ᡁԜሶሩަ䘋㹼䈖㓶᧿䘠DŽ ѝˈ৲㿱മ 8-11 ᡰ⽪DŽ⭡ҾަޕⲴ৲ᮠ␫ޣᢙኅ longs њ䮯ᆇ˄৲㿱л䶒〻ᒿѝ 106 㹼˅ˈ❦ਾሶ⴨ ࡠ⭘ᡧึḸѝѻࡽˈdo_signal()࠭ᮠ俆ݸՊᢺ⭘ᡧ〻ᒿึḸᤷ䪸ੁлޕ൘ᢺؑਧ༴⨶〻ᒿⲴ৲ᮠᨂ ഴ ؗਭ༺⨼ぁᓅⲺ䈹⭞ᯯᕅȾ ޽㔗㔝ᢗ㹼⭘ᡧⲴ〻ᒿˈ㿱മ 8-10 ᡰ⽪DŽ ࡠ⭘ᡧ〻ᒿึḸѝDŽ䘉ṧˈ൘ᖃࡽ㌫㔏䈳⭘㔃ᶏ䘄എਾቡՊ・࡫ᢗ㹼ؑਧਕᷴ〻ᒿˈ❦ਾޕ⨶࠭ᮠ˅ᨂ 㔏䈳⭘ᡆ㘵ਁ⭏ᰦ䫏ㅹѝᯝᰦˈ㤕䘋〻ᐢ᭦ࡠؑਧˈࡉ䈕࠭ᮠቡՊᢺؑਧⲴ༴⨶ਕᷴ˄ণሩᓄⲴؑਧ༴ do_signal()࠭ᮠᱟ޵Ṩ㌫㔏䈳⭘(int 0x80)ѝᯝ༴⨶〻ᒿѝሩؑਧⲴ亴༴⨶〻ᒿDŽ൘䘋〻⇿⅑䈳⭘㌫ 㿱л䶒䈖㓶䈤᰾DŽˈഎ٬ ᰦ⭡ Libc ࠭ᮠᓃᨀ׋ˈ⭘Ҿ൘ؑਧ༴⨶〻ᒿ㔃ᶏਾ␵⨶⭘ᡧᘱึḸˈᒦᚒ༽㌫㔏䈳⭘ᆈ᭮൘ eax ѝⲴ䘄 sigaction 㔃ᶴѝⲴᴰਾањᆇ⇥઼ sys_signal()࠭ᮠⲴ৲ᮠ restorer ᱟа࠭ᮠᤷ䪸DŽᆳ൘㕆䈁䘎᧕〻ᒿ include/signal.h ᮷Ԧѝ˄ㅜ 36-39 㹼˅Ⲵ䈤᰾DŽ sigaction 㔃ᶴѝⲴ sa_flags ⭘ҾᤷᇊަԆаӋ༴⨶ؑਧⲴ䘹亩ˈ䘉Ӌ䘹亩Ⲵᇊѹ䈧৲㿱 signal()࠭ᮠՊ൘а༴⨶ਕᷴ㔃ᶏਾሶަᚒ༽ᡀؑਧⲴ唈䇔༴⨶ਕᷴDŽ њؑਧⲴ༴⨶ਕᷴѻਾˈ䲔䶎޽⅑ᴤ᭩ˈ੖ࡉቡаⴤ֯⭘䈕༴⨶ਕᷴDŽ䘉оՐ㔏Ⲵ signal()࠭ᮠнаṧDŽ ањṧֻˈҏণ൘䱫ຎ䀓䲔ᰦሩҾ䱫ຎⲴཊњ਼аؑਧਚՊ޽䈳⭘а⅑ؑਧ༴⨶ਕᷴDŽ൘ᡁԜ؞᭩Ҷа ᆈަ؍њؑਧ㘼н䇙ަђཡˈⴤࡠ↔⅑༴⨶ᆼ∅DŽਖཆˈ൘ањؑਧ㻛䱫ຎᵏ䰤㘼৸ཊ⅑ਁ⭏ᰦ䙊ᑨਚ   VLJQDOF 〻ᒿ LUHW ѻࡽ HVS ণሶᢗ㹼ԓ⸱ 䈳⭘ GRBVLJQDO ѻਾⲴᤷੁ 䈳⭘ GRBVLJQDO ѻࡽⲴᤷੁ ᐢᢗ㹼ԓ⸱ ؑਧ༴⨶〻ᒿ  ⭘ᡧ〻ᒿ VDBUHVWRUHU ؑਧ VLJQU EORFNHG@<  䈳⭘䘄എ٬ HD[ HF[ HG[ HIODJV ROGBHLS ⭘ᡧᘱึḸ  ؑਧ VLJQU  HD[ HE[ HF[ HG[  IV  HV  GV ޵ṨᘱึḸ HLS  FV HIODJV ৏ HVS  ৏ VV ᯩੁޕ঻ / ؞᭩Ҷ䘉䟼৏ (63 Ⲵ٬ ؞᭩ਾᇎ䱵 HVS ORQJV    ޵ṨᘱึḸ ⭘ᡧᘱึḸ (,3  &6 ()/$*6 ৏ (63  ৏66 ᯩੁޕ঻ ٬DŽ 䘈ݱ䇨᭦ࡠᵜ䓛ˈࡉึḸк䘈ᆈ᭮ᴹ䈕䘋〻Ⲵ䱫ຎ⸱ blockedDŽлањᱟؑਧ signr ᆈᴹ㌫㔏䈳⭘Ⲵ䘄എ٬DŽྲ᷌ᡰ༴⨶Ⲵؑਧ؍⭘䘄എਾӽ❦䴰㾱ᚒ༽䘉Ӌ⭘ᡧ〻ᒿⲴᇴᆈಘ٬DŽeax ѝ สᵜкҏᱟ䈳⭘㌫㔏䈳⭘Ⲵ৲ᮠˈ൘㌫㔏䈳ˈeflagsǃedx ઼ ecx ᱟ৏⭘ᡧ〻ᒿ൘䈳⭘㌫㔏䈳⭘ѻࡽⲴ٬ ⮉лᶕⲴDŽ؍ old_eip ণᱟ৏⭘ᡧ〻ᒿⲴ䘄എൠ൰ˈᆳᱟ൘޵ṨึḸк eip 㻛ᴯᦒᡀؑਧਕᷴൠ൰ѻࡽ ᡁԜ⧠൘ᶕ䈤᰾䘉Ӌ٬Ⲵਜ਼ѹԕ৺᭮㖞䘉Ӌ٬Ⲵ৏ഐDŽˈᖰ⭘ᡧᘱึḸк᭮㖞Ҷ 7 ࡠ 8 њ٬ޡᙫ ༽ࡦࡠҶ䘉њオ䰤ѝˈ㿱മѝਣ䗩ᡰ⽪DŽ ᢺ⭘ᡧᘱึḸੁлᢙኅҶ 7 ᡆ 8 њ䮯ᆇオ䰤DŽᴰਾᢺ޵ṨึḸкⲴаӋᇴᆈಘ޵ᇩˈ٬ espā߿৫ longs ᆈⲴĀ৏؍ѹਕᷴ sa_handlerˈҏণ䇙മѝ޵ṨᘱึḸѝⲴ eip ᤷੁ sa_handlerDŽ᧕лᶕ䙊䗷ᢺ޵Ṩᘱѝ ᆈѪ old_eipˈ❦ਾሶ䈕 eip ᴯᦒᡀᤷੁ㠚ᇊ؍ ᆳ俆ݸᢺ޵ṨᘱึḸѝ৏⭘ᡧ〻ᒿⲴ䘄എᢗ㹼⛩ᤷ䪸 eip ⭘ᡧᘱึḸѝDŽޕᒿ˄ؑਧਕᷴ sa_handler˅ˈࡉӾ 104 㹼䎧 do_signal()ᔰ࿻߶༷ᢺ⭘ᡧ㠚ᇊѹⲴਕᷴᨂ ൘ do_signal()༴⨶ᆼєњ唈䇔ؑਧਕᷴ˄SIG_IGN ઼ SIG_DFL˅ѻਾˈ㤕⭘ᡧ㠚ᇊѹҶؑਧ༴⨶〻 ᭯⭞ᡭᘷ฼ḾⲺޭ։䗽ぁؤ ࠳ᮦ ഴ GRBVLJQDO  ᭯ؤ ࠳ᮦሯ⭞ᡭ฼ḾⲺ ഴ GRBVLJQDO    VLJQDOF 〻ᒿ  UHW SRSIO SRSOHG[ SRSOHF[ SRSOHD[ ٬DŽ DGGOHVSђᔳ EORFNHG FDOOBBBBVVHWPDVN䇮㖞ؑਧቿ㭭⸱ROGEORFNLQJ VLJQU DGGOHVSђᔳؑਧ٬ BBBBPDVNVLJBUHVWRUH 㤕ᴹ EORFNHG ࡉ֯⭘л䶒䘉њ UHVWRUHU ࠭ᮠˈEORFNHG ׋ VVHWPDVN ֯⭘DŽ UHW SRSIOᚒ༽⭘ᡧ〻ᒿᰦⲴḷᘇᇴᆈಘDŽ SRSOHG[ SRSOHF[ᚒ༽৏⭘ᡧ〻ᒿᇴᆈಘ٬DŽ SRSOHD[ᚒ༽㌫㔏䈳⭘䘄എ٬DŽ VLJQU DGGOHVSђᔳؑਧ٬ BBBBVLJBUHVWRUH 㤕⋑ᴹ EORFNHG ࡉ֯⭘䘉њ UHVWRUHU ࠭ᮠ JOREOBBBBPDVNVLJBUHVWRUH JOREOBBBBVLJBUHVWRUH  ᮷Ԧ˄misc/ᆀⴞᖅ˅ѝᴹᆳⲴ࠭ᮠˈᇊѹྲл˖ 䛓Ѹ sa_restorer 䘉њ࠭ᮠᱟӾଚ䟼ᶕⲴ઒˛ަᇎᆳᱟ⭡࠭ᮠᓃᨀ׋ⲴDŽ൘ Linux Ⲵ Libc 2.2.2 ࠭ᮠᓃ Պ䇙䈕〻ᒿ㔃ᶏ䘀㹼DŽ ਾՊᢺ SIGINT ؑਧⲴ༴⨶䗷〻䇮㖞ᡀ唈䇔ؑਧ༴⨶ਕᷴDŽഐ↔൘ㅜҼ⅑᤹л Ctrl-C 㓴ਸ䭞ᰦˈSIG_DFL ަѝˈؑਧ༴⨶࠭ᮠ handler()Պ൘ؑਧ SIGINT ࠪ⧠ᰦ㻛䈳⭘ᢗ㹼DŽ䈕࠭ᮠ俆ݸ䗃ࠪаᶑؑ᚟ˈ❦ ` ` ㅹᖵ  。䫏DŽ  VOHHS  6LJQDOWHVW?Q SULQWI  ^ ZKLOH 䇮㖞 6,*,17 Ⲵ⭘ᡧ㠚ᇊѹؑਧ༴⨶ਕᷴDŽ 6,*,17KDQGOHU YRLG VLJQDO  ^  LQWPDLQ  նሩҾަԆ㌫㔏ᵚᗵྲ↔˅ˈ`㠚ࣘᚒ༽唈䇔٬ ᚒ༽ 6,*,17 ؑਧⲴ唈䇔༴⨶ਕᷴDŽ˄ᇎ䱵к޵ṨՊ 6,*,176,*B')/ YRLG VLJQDO   7KHVLJQDOLVG?QVLJ SULQWI ^ LQWVLJ ؑਧ༴⨶ਕᷴDŽ YRLGKDQGOHU  XQLVWGK!LQFOXGH VWGLRK!LQFOXGH VLJQDOK!LQFOXGH Պӗ⭏ SIGINT ؑਧDŽ л䶒ᱟѪ SIGINT ؑਧ䇮㖞㠚ᇊѹؑਧ༴⨶ਕᷴⲴањㆰঅֻᆀˈ唈䇔ᛵߥлˈ᤹л Ctrl-C 㓴ਸ䭞 signr ઼ањؑਧ༴⨶ਕᷴ handlerDŽ ѹ signal()࠭ᮠᰦਚᨀ׋Ҷањؑਧ٬ ᴰਾањᱟؑਧ⍫ࣘᚒ༽࠭ᮠⲴᤷ䪸 sa_restorerDŽ䘉њᚒ༽࠭ᮠнᱟ⭡⭘ᡧ䇮ᇊⲴˈഐѪ൘⭘ᡧᇊ   VLJQDOF 〻ᒿ old_eip˅ˈ䘄എ৫ᢗ㹼⭘ᡧ〻ᒿDŽ ⭘ਾ਴ᇴᆈಘ઼ CPU Ⲵ⣦ᘱDŽᴰਾ䙊䗷 sa_restorer Ⲵ ret ᤷԔᕩࠪ৏⭘ᡧ〻ᒿⲴ eip˄ҏণึḸкⲴ ᚒ༽Ҷ㌫㔏䈳ޘeax ઼ᇴᆈಘ ecxǃedx ԕ৺ḷᘇᇴᆈಘ eflags ᕩࠪˈᆼ signrˈᒦᢺ㌫㔏䈳⭘ਾⲴ䘄എ٬ аӋ⭘ᡧᘱึḸⲴ␵⨶ᐕ֌ˈҏণՊ䐣䗷ึḸкⲴؑਧ٬ڊੁⲴᚒ༽〻ᒿ৫ᢗ㹼DŽ㘼 sa_restorer 〻ᒿՊ Ⲵؑਧ༴⨶〻ᒿDŽ൘䈕ؑਧ༴⨶〻ᒿᢗ㹼ᆼਾˈ䙊䗷 ret ᤷԔˈCPU Պᢺ᧗ࡦᵳ〫Ӕ㔉 sa_restorer ᡰᤷ ᚒ༽ࡠ⭘ᡧᘱ৫ᢗ㹼〻ᒿDŽ⭡Ҿ eip ᐢ㓿㻛ᴯᦒѪᤷੁؑਧਕᷴˈഐ↔ˈ↔࡫ণՊ・ণᢗ㹼⭘ᡧ㠚ᇊѹ Ⲵᡰᴹ٬ᕩࠪึḸDŽ൘ᢗ㹼Ҷ iret ᤷԔѻਾˈCPU ሶᢺ޵ṨᘱึḸкⲴ cs:eipǃeflags ԕ৺ ss:esp ᕩࠪˈ ᴰਾ䈤᰾алᢗ㹼Ⲵ⍱〻DŽ൘ do_signel()ᢗ㹼ᆼਾˈsystem_call.s ሶՊᢺ䘋〻޵ṨᘱึḸк eip ԕл ྭ䊑⋑ᴹ䘀㹼䗷ؑਧ༴⨶〻ᒿˈ㘼ᱟⴤ᧕Ӿ㌫㔏䈳⭘ѝ䘄എⲴDŽ ቡˈ sa_restorer()࠭ᮠ䍏䍓␵⨶൘ؑਧ༴⨶〻ᒿᢗ㹼ᆼਾᚒ༽⭘ᡧ〻ᒿⲴᇴᆈಘ٬઼㌫㔏䈳⭘䘄എ٬ ` UHWXUQ HUUQR VLJ UHWXUQ   VLJ! LI  ROG VD G BBIRRHE[ F BB15BVLJDFWLRQ U   VLJ  DLQW[ BBDVPBB VD!VDBUHVWRUHU BBBPDVNVLJBUHVWRUH HOVH VD!VDBUHVWRUHU BBBVLJBUHVWRUH  6$B120$6. VD!VDBIODJV LI E[  VLJ UHJLVWHULQWBBIRRHE[BBDVPBB ^  ROG VDVWUXFWVLJDFWLRQ LQWVLJVWUXFWVLJDFWLRQ LQWVLJDFWLRQ  ࠭ᮠDŽ ⭘ᡧ䈳⭘Ⲵ VLJDFWLRQ  ` UHWXUQUHV  ORQJ BBBVLJBUHVWRUH IXQF G BBIRRHE[ F BB15BVLJQDO U   UHV  DLQW[ BBDVPBB E[  VLJ UHJLVWHULQWBBIRRHE[BBDVPBB  UHV YRLG ^  LQW LQWVLJBBVLJKDQGOHUBWIXQF VLJQDO YRLG  व㼩࠭ᮠDŽ ᓃ࠭ᮠѝ⭘ᡧ䈳⭘Ⲵ VLJQDO   H[WHUQYRLGBBBPDVNVLJBUHVWRUH  H[WHUQYRLGBBBVLJBUHVWRUH  XQLVWGK!LQFOXGH GHILQHBB/,%5$5VLJQXP@ ᆈࡠ ROGDFWLRQ ᡰᤷⲴս㖞DŽ؍৏᫽֌ᤷ䪸 ൘ؑਧⲴ VLJDFWLRQ 㔃ᶴѝ䇮㖞ᯠⲴ᫽֌˄ࣘ֌˅DŽྲ᷌ ROGDFWLRQ ᤷ䪸нѪオⲴ䈍ˈࡉሶ UHWXUQ  __VLJQXP!__VLJQXP 6,*.,//VLJQXP LI ؑਧ٬㾱൘˄˅㤳ത޵ˈᒦфؑਧ 6,*.,// Ⲵ༴⨶ਕᷴн㜭㻛᭩ਈDŽ  VWUXFWVLJDFWLRQWPS ^  ROGDFWLRQ VWUXFWVLJDFWLRQ DFWLRQ LQWVLJQXPFRQVWVWUXFWVLJDFWLRQ LQWV\VBVLJDFWLRQ ⮉ࡠ ROGDFWLRQDŽᡀ࣏ࡉ䘄എ ˈ੖ࡉѪDŽ؍ࡉ৏᫽֌㻛 ԫօؑਧDŽ>ྲ᷌ᯠ᫽֌˄DFWLRQ˅нѪオ@ࡉᯠ᫽֌㻛ᆹ㻵DŽྲ᷌ROGDFWLRQ ᤷ䪸нѪオˈ  ㌫㔏䈳⭘DŽ᭩ਈ䘋〻൘᭦ࡠањؑਧᰦⲴ᫽֌DŽVLJQXP ᱟ䲔Ҷ 6,*.,// ԕཆⲴ VLJDFWLRQ  ` UHWXUQKDQGOHU FXUUHQW!VLJDFWLRQ>VLJQXP@ WPS ORQJ FXUUHQW!VLJDFWLRQ>VLJQXP@VDBKDQGOHU  KDQGOHU ᧕⵰ਆ䈕ؑਧ৏ᶕⲴ༴⨶ਕᷴˈᒦ䇮㖞䈕ؑਧⲴ VLJDFWLRQ 㔃ᶴDŽᴰਾ䘄എ৏ؑਧਕᷴDŽ ᆈᚒ༽༴⨶࠭ᮠᤷ䪸DŽ؍YRLG UHVWRUHU YRLG  WPSVDBUHVWRUHU WPSVDBIODJV 6$B21(6+27_6$B120$6.  WPSVDBPDVN LQW KDQGOHU YRLG  WPSVDBKDQGOHU ᒦݱ䇨ؑਧ൘㠚ᐡⲴ༴⨶ਕᷴѝ᭦ࡠDŽˈ䈕ؑਧ༴⨶ਕᷴਚ֯⭘  ⅑ਾቡᚒ༽ࡠ唈䇔٬ VDBPDVN ᱟᢗ㹼ؑਧ༴⨶ਕᷴᰦⲴؑਧቿ㭭⸱DŽVDBIODJV ᱟᢗ㹼ᰦⲴаӋḷᘇ㓴ਸDŽ䘉䟼䇮ᇊ ❦ਾṩᦞᨀ׋Ⲵ৲ᮠ㓴ᔪ VLJDFWLRQ 㔃ᶴ޵ᇩDŽVDBKDQGOHU ᱟᤷᇊⲴؑਧ༴⨶ਕᷴ˄࠭ᮠ˅DŽ UHWXUQ  __VLJQXP!__VLJQXP 6,*.,//VLJQXP LI єњؑਧн㜭㻛䘋〻ᦅ㧧DŽ 俆ݸ傼䇱ؑਧ٬൘ᴹ᭸㤳ത˄˅޵ˈᒦфнᗇᱟؑਧ 6,*.,//˄઼ 6,*6723˅DŽഐѪ䘉  VWUXFWVLJDFWLRQWPS ^  LQWVLJQXPORQJKDQGOHUORQJUHVWRUHU LQWV\VBVLJQDO ࠭ᮠ䘄എ৏ؑਧਕᷴDŽ ቡྭ䊑㌫㔏䈳⭘⋑ᴹᢗ㹼䗷ؑਧ༴⨶〻ᒿ㘼ⴤ᧕䘄എࡠ⭘ᡧ〻ᒿаṧDŽˈ䈳⭘Ⲵ䘄എ٬ /LEFᓃᨀ׋DŽ⭘Ҿ൘ؑਧ༴⨶〻ᒿ㔃ᶏਾᚒ༽㌫㔏䈳⭘䘄എᰦࠐњᇴᆈಘⲴ৏ᴹ٬ԕ৺㌫㔏 ৲ᮠ VLJQXPᤷᇊⲴؑਧ˗KDQGOHUᤷᇊⲴਕᷴ˗UHVWRUHU̢ᚒ༽࠭ᮠᤷ䪸ˈ䈕࠭ᮠ⭡ ؑਧਕᷴਟԕᱟ⭘ᡧᤷᇊⲴ࠭ᮠˈҏਟԕᱟ 6,*B')/˄唈䇔ਕᷴ˅ᡆ 6,*B,*1˄ᘭ⮕˅DŽ ؑਧ༴⨶〻ᒿ DŽ DŽѪᤷᇊⲴؑਧᆹ㻵ᯠⲴؑਧਕᷴ ㌫㔏䈳⭘DŽ㊫լҾ VLJDFWLRQ VLJQDO  `  IURP WR  JHWBIVBE\WH   L VWUXFWVLJDFWLRQ VL]HRIL L IRU  LQWL ^  WR IURPFKDU FKDU VWDWLFLQOLQHYRLGJHWBQHZ   VLJQDOF 〻ᒿ //VD!VDBKDQGOHU 18  6$B21(6+27 VD!VDBIODJV LI 䘄എ⭘ᡧ〻ᒿᰦՊ俆ݸᢗ㹼⭘ᡧⲴؑਧਕᷴ〻ᒿˈ❦ਾ޽㔗㔝ᢗ㹼⭘ᡧ〻ᒿDŽ ⭘ᡧึḸDŽഐ↔൘ᵜ⅑㌫㔏䈳⭘ѝᯝޕ৏䈳⭘㌫㔏䈳⭘Ⲵ〻ᒿ䘄എᤷ䪸৺ḷᘇᇴᆈಘ٬঻ ྲ᷌ 6$B120$6. ⋑㖞ս ǃHD[ǃHF[ǃHG[ ֌Ѫ৲ᮠԕ৺ VDBUHVWRUHUǃVLJQUǃ䘋〻ቿ㭭⸱ ⸱؞᭩޵ṨᘱึḸк⭘ᡧ䈳⭘㌫㔏䈳⭘ᰦⲴԓ⸱ᤷ䪸HLSѪᤷੁؑਧ༴⨶ਕᷴˈ਼ᰦҏሶ ᆈ൘޵ṨᘱḸѝDŽл䶒䘉⇥ԓ؍޵Ṩᰦˈ⭘ᡧ〻ᒿ䘄എൠ൰˄HLSǃFV˅㻛ޕ൘㌫㔏䈳⭘䘋 ᆈ൘ VDBKDQGOHU ᤷ䪸ѝDŽ؍⌘᜿ˈ䈕ؑਧਕᷴᐢ㓿 2.ˈԕл߶༷ሩؑਧਕᷴⲴ䈳⭘䇮㖞DŽྲ᷌䈕ؑਧਕᷴਚ䴰֯⭘а⅑ˈࡉሶ䈕ਕᷴ㖞オDŽ ` н޽䘄എࡠ䘉䟼DŽ VLJQU  GRBH[LW HOVH UHWXUQ  VLJQU 6,*&+/' LI VDBKDQGOHU ^ LI UHWXUQ   VDBKDQGOHU LI XQVLJQHGORQJ VD!VDBKDQGOHU  VDBKDQGOHU 䘋〻Ⲵ䘰ࠪ⣦ᘱ⸱ᡆᆀ䘋〻㓸→Ⲵ৏ഐ˄ؑਧ˅DŽ  ࡙⭘䘉Ӌᆿቡਟԕਆᗇᆀ ᡆ ZDLWSLG Ⲵ⣦ᘱؑ᚟DŽ৲㿱V\VZDLWK ᮷Ԧㅜ  㹼DŽZDLW  ࠭ᮠ ᡆ ZDLWSLG Ⲵ৲ᮠᱟ䘄എ⸱઼〻ᒿᨀ׋Ⲵ䘰ࠪ⣦ᘱؑ᚟DŽਟ֌Ѫ ZDLW ㅜ  㹼 GRBH[LW ਕᷴ 6,*B,*1 㻛ᇊѹѪ ˈ6,*B')/ 㻛ᇊѹѪ DŽ৲㿱 LQFOXGHVLJQDOKㅜ ǃ 㹼DŽ 6,*B')/˄ˈ唈䇔༴⨶˅ˈࡉྲ᷌ؑਧᱟ 6,*&+/' ҏⴤ᧕䘄എˈ੖ࡉ㓸→䘋〻Ⲵᢗ㹼DŽ ྲ᷌ؑਧਕᷴѪ 6,*B,*1˄ˈ唈䇔ᘭ⮕ਕᷴ˅ࡉнሩؑਧ䘋㹼༴⨶㘼ⴤ᧕䘄എ˗ྲ᷌ਕᷴѪ  WPSBHVS XQVLJQHGORQJ ণFXUUHQW!VLJDFWLRQ>VLJQU@DŽLQWORQJV VD FXUUHQW!VLJDFWLRQVLJQU VWUXFWVLJDFWLRQ ORQJROGBHLS HLS XQVLJQHGORQJVDBKDQGOHU ^  HVSORQJVV XQVLJQHGORQJ ORQJHLSORQJFVORQJHIODJV ORQJIVORQJHVORQJGV ORQJVLJQUORQJHD[ORQJHE[ORQJHF[ORQJHG[ YRLGGRBVLJQDO VLJQU˅DŽ˄ḸѝⲴᖃࡽ༴⨶Ⲵؑਧ٬ޕĺㅜ  㹼঻ HD[˅DŽ˄ḸѝⲴ⴨ᓄ㌫㔏䈳⭘༴⨶࠭ᮠⲴ䘄എ٬ޕ 㹼䈳⭘ V\VBFDOOBWDEOH ਾ঻ Ĺㅜ ḸⲴᇴᆈಘ GVǃHVǃIV ઼ HG[ǃHF[ǃHE[˗ޕV\VWHPBFDOO ᰦ঻ ޕĸㅜ  㹼൘ࡊ䘋 Ⲵ⭘ᡧḸൠ൰ VV ઼ HVSǃḷᘇᇴᆈಘ HIODJV ઼䘄എൠ൰ FV ઼ HLS˗ޕķ&38 ᢗ㹼ѝᯝᤷԔ঻ ḸⲴ٬DŽ䘉Ӌ٬वᤜ˄൘ V\VWHPBFDOOV ѝⲴԓ⸱㹼˅˖ึޕ 㹼˅ࡽ䙀↕঻ ㅜ ㌫㔏䈳⭘༴⨶〻ᒿ V\VWHPBFDOOV ᔰ࿻ˈⴤࡠ䈳⭘ᵜ࠭ᮠ˄V\VWHPBFDOOVޕ࠭ᮠⲴ৲ᮠᱟ䘋 ㅹؑਧDŽ 6723*,6 ڌ⨶䘋〻Ჲ ਾ・࡫ᢗ㹼ؑਧਕᷴ〻ᒿˈ❦ਾ㔗㔝ᢗ㹼⭘ᡧⲴ〻ᒿDŽ䘉њ࠭ᮠ༴⨶∄䖳㋇⮕ˈቊн㜭༴ ࡠ⭘ᡧ〻ᒿึḸѝˈᒦ൘ᵜ㌫㔏䈳⭘㔃ᶏ䘄എޕ䈕⇥ԓ⸱Ⲵѫ㾱֌⭘ᱟሶؑਧ༴⨶ਕᷴᨂ  㹼˅DŽ㌫㔏䈳⭘Ⲵѝᯝ༴⨶〻ᒿѝⵏ↓Ⲵؑਧ亴༴⨶〻ᒿ˄൘ NHUQHOV\VWHPBFDOOV  ` UHWXUQ  VLJQXP   FXUUHQW!VLJDFWLRQ>VLJQXP@VDBPDVN_ HOVH  FXUUHQW!VLJDFWLRQ>VLJQXP@VDBPDVN  6$B120$6. FXUUHQW!VLJDFWLRQ>VLJQXP@VDBIODJV LI ྲ᷌ݱ䇨ؑਧ൘㠚ᐡⲴؑਧਕᷴѝ᭦ࡠˈࡉԔቿ㭭⸱Ѫ ˈ੖ࡉ䇮㖞ቿ㭭ᵜؑਧDŽ   VLJQDOF 〻ᒿ 3 SIGQUIT (Quit) ᶕ㠚䭞ⴈⲴ䘰ࠪѝᯝDŽ䙊ᑨ㓸ㄟ傡ࣘ〻ᒿՊሶަо^\㔁ᇊDŽ (Dump) 〻ᒿ㻛㓸→ᒦ 2 SIGINT (Interrupt) ᶕ㠚䭞ⴈⲴѝᯝDŽ䙊ᑨ㓸ㄟ傡ࣘ〻ᒿՊሶަо^C 㔁ᇊDŽ (Abort) 㓸→〻ᒿDŽ 䘋〻DŽ (Abort) ᤲᯝ᧗ࡦ㓸ㄟᡆ ⭘ SIGHUP ᶕਁࠪ䴰㾱䟽ᯠ䈫ਆަ䝽㖞᮷ԦⲴؑਧDŽ Xterm ᡆᯝᔰ modemDŽ⭡Ҿਾਠ〻ᒿ⋑ᴹ᧗ࡦⲴ㓸ㄟˈഐ㘼ᆳԜᑨ 䰝ޣ(Hangup) ᖃ֐н޽ᴹ᧗ࡦ㓸ㄟᰦ޵ṨՊӗ⭏䈕ؑਧˈᡆ㘵ᖃ֐ 1 SIGHUP ḷਧ ਽〠 䈤᰾ 唈䇔᫽֌ 㺞 ̢䘑ぁؗਭ 0.11 ޵Ṩᡰ᭟ᤱⲴؑਧ㿱㺘 8–4 ᡰ⽪DŽ ᱟ䘋〻֯⭘㠚ᐡⲴؑਧ༴⨶〻ᒿᶕ༴⨶ؑਧDŽLinux⌅ڊ㌫㔏⴨ᓄⲴ唈䇔ؑਧ༴⨶〻ᒿ䘋㹼༴⨶˗ㅜҼ⿽ аᱟ〻ᒿⲴ䘋〻н৫༴⨶ˈ↔ᰦ䈕ؑਧՊ⭡˖⌅ڊҾањ䘋〻ྲօ༴⨶᭦ࡠⲴؑਧˈа㡜ᴹє⿽ޣ ᆀ䘋〻Ⲵᖃࡽ⣦ᘱDŽޣ䘋〻ˈԕ䙊⸕⡦䘋〻ᴹ օަԆⲴؑ᚟DŽֻྲᖃањᆀ䘋〻㓸→ᡆ㔃ᶏᰦˈቡՊӗ⭏ањḷਧѪ 18 Ⲵ SIGCHILD ؑਧਁ䘱㔉⡦ ᒦфнᩪᑖԫˈ䘋〻ѝⲴؑਧᱟ⭘Ҿ䘋〻ѻ䰤䙊ؑⲴа⿽ㆰঅ⎸᚟ˈ䙊ᑨᱟл㺘ѝⲴањḷਧᮠ٬ 8.8.3.1 䘑ぁؗਭ䈪᱄ 8.8.3 ެԌؗᚥ   ` ቿ㭭⸱ ␫к VDBPDVN ѝⲴ⸱սDŽ 䘋〻䱫ຎ⸱FXUUHQW!EORFNHG_ VD!VDBPDVN  ROGBHLSWPSBHVS SXWBIVBORQJ  HIODJVWPSBHVS SXWBIVBORQJ  HG[WPSBHVS SXWBIVBORQJ  HF[WPSBHVS SXWBIVBORQJ  HD[WPSBHVS SXWBIVBORQJ  FXUUHQW!EORFNHGWPSBHVS SXWBIVBORQJ  6$B120$6. VD!VDBIODJV  LI  VLJQUWPSBHVS SXWBIVBORQJ  ORQJ VD!VDBUHVWRUHUWPSBHVS SXWBIVBORQJ WPSBHVS HVS 㖞ս˅ǃHD[ǃHF[ǃHG[ǃHIODJV ઼⭘ᡧ〻ᒿ৏ԓ⸱ᤷ䪸DŽ ൘⭘ᡧึḸѝӾлࡠкᆈ᭮ VDBUHVWRUHUǃؑਧ VLJQUǃቿ㭭⸱ EORFNHG˄ྲ᷌ 6$B120$6.   HVSORQJV YHULI\BDUHD HVS  ORQJV  ᒦỰḕ޵ᆈ֯⭘ᛵߥ˄ֻྲྲ᷌޵ᆈ䎵⭼ࡉ࠶䝽ᯠ亥ㅹ˅DŽ ሶ৏䈳⭘〻ᒿⲴ⭘ᡧึḸᤷ䪸ੁлᢙኅ ˄ᡆ ˅њ䮯ᆇ˄⭘ᶕᆈ᭮䈳⭘ؑਧਕᷴⲴ৲ᮠㅹ˅ˈ 6$B120$6. " VD!VDBIODJV  ORQJV HLS  VDBKDQGOHU  ḸDŽึޕ⨶ਕᷴ〻ᒿ᭦ࡠؑਧ㠚ᐡˈࡉҏ䴰㾱ሶ䘋〻Ⲵؑਧ䱫ຎ⸱঻ 6$B120$6. ḷᘇˈ䛓Ѹᕅ䎧ᵜؑਧਕᷴᢗ㹼ⲴؑਧሶнՊ㻛ቿ㭭ᦹDŽྲ᷌ݱ䇨ؑਧ㠚ᐡⲴ༴ ቿ㭭Ⲵؑਧ䳶DŽ਼ᰦˈᕅ䎧ᵜؑਧਕᷴᢗ㹼ⲴؑਧҏՊ㻛ቿ㭭DŽн䗷㤕 VDBIODJV ѝ֯⭘Ҷ VLJDFWLRQ 㔃ᶴⲴ VDBPDVN ᆇ⇥㔉ࠪҶ൘ᖃࡽؑਧਕᷴ˄ؑਧ᧿䘠ㅖ˅〻ᒿᢗ㹼ᵏ䰤ᓄ䈕㻛 ৲ᮠ䜭ђᔳDŽHLS ㅹӽ❦൘ึḸѝDŽ  ᰦⲴᡰᴹ ᱟӾ≷㕆〻ᒿѝ㻛䈳⭘Ⲵˈᒦф൘࠭ᮠ䘄എਾ≷㕆〻ᒿᒦ⋑ᴹᢺ䈳⭘ GRBVLJQDO ࠭ᮠ䘄എᰦึḸкⲴ৲ᮠሶՊ㻛䈳⭘㘵ђᔳDŽ䘉䟼ѻᡰԕਟԕ֯⭘䘉⿽ᯩᔿˈᱟഐѪ䈕࠭ᮠ 䘉䟼䈧⌘᜿ˈ֯⭘ྲлᯩᔿ˄ㅜ  㹼˅ሩᲞ䙊 & ࠭ᮠ৲ᮠ䘋㹼؞᭩ᱟн䎧֌⭘ⲴDŽഐѪᖃ ḸDŽึޕ༴⨶ਕᷴ᭦ࡠؑਧ㠚ᐡˈࡉҏ䴰㾱ሶ䘋〻Ⲵ䱫ຎ⸱঻ HLS ⲴᖒᔿDŽਖཆˈྲ᷌ݱ䇨ؑਧ㠚ᐡⲴ ᱟՐ٬࠭ᮠˈഐ↔㔉 HLS 䍻٬ᰦ䴰㾱֯⭘ ሶ޵ṨᘱḸк⭘ᡧ䈳⭘㌫㔏䈳⭘лаᶑԓ⸱ᤷԔᤷ䪸 HLS ᤷੁ䈕ؑਧ༴⨶ਕᷴDŽ⭡Ҿ & ࠭ᮠ   VLJQDOF 〻ᒿ 䘋〻䘀㹼DŽ→ڌ ((Stop 䈕ؑਧਟ㻛ᦅ㧧ᡆᘭ⮕DŽ ⴤࡠ᭦ࡠ SIGCONT ؑਧDŽˈ→ڌㄟк䗃ࠪᮠᦞˈ↔ᰦ䈕䘋〻ሶ㻛 (TTY Output on Background) ਾਠ䘋〻䈅മੁањн޽㻛᧗ࡦⲴ㓸 23 SIGTTOU 䘋〻䘀㹼DŽ→ڌ ((Stop ؑਧਟԕ㻛ᦅ㧧ᡆᘭ⮕DŽ ⴤࡠ᭦ࡠ SIGCONT ؑਧDŽ䈕ˈ→ڌк䈫ਆᮠᦞˈ↔ᰦ䈕䘋〻ሶ㻛 (TTY Input on Background) ਾਠ䘋〻䈅മӾањн޽㻛᧗ࡦⲴ㓸ㄟ 22 SIGTTIN 䘋〻䘀㹼DŽ→ڌ (䭞ᒿࡇDŽ䈕ؑਧਟԕ㻛ᦅ㧧ᡆᘭ⮕DŽ (Stop→ڌ21 SIGTSTP (Terminal Stop) ੁ㓸ㄟਁ䘱 䘋〻䘀㹼DŽ→ڌ (䘋〻Ⲵ䘀㹼DŽ䈕ؑਧнਟ㻛ᦅ㧧ᡆᘭ⮕DŽ (Stop→ڌ (20 SIGSTOP (Stop ᢗ㹼DŽ (Continue) ᚒ༽䘋〻Ⲵ 㧧DŽ Ⲵ䘋〻ᚒ༽䘀㹼DŽਟԕ㻛ᦅ→ڌ (Continue) 䈕ؑਧ㠤֯㻛 SIGSTOP 19 SIGCONT 㔃ᶏDŽ ᡆ→ڌ(Ignore) ᆀ䘋〻 ᡆ㓸→DŽਟ᭩ਈަਜ਼ѹᥚ֌ᆳ⭘DŽ→ڌ18 SIGCHLD (Child) ᆀ䘋〻ਁࠪDŽᆀ䘋〻ᐢ 17 SIGSTKFLT (Stack fault on coprocessor) ॿ༴⨶ಘึḸ䭉䈟DŽ (Abort) 䘋〻㻛㓸→DŽ (Abort) 䘋〻㻛㓸→DŽ ᐕ֌DŽ ␵⨶ڊо SIGKILL н਼ˈ䈕ؑਧ㜭㻛ᦅ㧧ˈ䘉ṧቡ㜭൘䘰ࠪ䘀㹼ࡽ (Terminate) ⭘Ҿ઼ழൠ㾱≲ањ〻ᒿ㓸→DŽᆳᱟ kill Ⲵ唈䇔ؑਧDŽ 16 SIGTERM (Abort) 䘋〻㻛㓸→DŽ ਾӗ⭏DŽ䈕ؑਧᑨ⭘Ҿࡔ࡛㌫㔏䈳⭘䎵ᰦDŽ (Alarm) 䈕ؑਧՊ൘⭘ᡧ䈳⭘ alarm ㌫㔏䈳⭘ᡰ䇮㖞Ⲵᔦ䘏ᰦ䰤ࡠ 15 SIGALRM (Abort) 䘋〻㻛㓸→DŽ ਧDŽ (Pipe) ᖃ〻ᒿੁањ྇᧕ᆇᡆ㇑䚃߉ᰦ⭡Ҿ⋑ᴹ䈫㘵㘼ӗ⭏䈕ؑ 14 SIGPIPE ⮉㔉⭘ᡧ〻ᒿ⭘Ҿ IPC ᡆަԆⴞⲴDŽ (Abort) 䘋〻㻛㓸→DŽ؍ (13 SIGUSR2 (User defined Signal 2 ӗ⭏ dump core ᮷ԦDŽ (Dump) 〻ᒿ㻛㓸→ᒦ ∄ྲ˖ራ൰⋑ᴹ᱐ሴⲴ޵ᆈ˗ራ൰ᵚ䇨ਟⲴ޵ᆈDŽ (Segmentation Violation) ᖃ〻ᒿᕅ⭘ᰐ᭸Ⲵ޵ᆈᰦՊӗ⭏↔ؑਧDŽ 12 SIGSEGV 11 SIGUSR1 (User defined Signal 1) ⭘ᡧᇊѹⲴؑਧDŽ (Abort) 䘋〻㻛㓸→DŽ (Abort) 〻ᒿ㻛㓸→DŽ ␵⨶ᐕ֌DŽڊњ䘋〻ˈቡਁ䘱ؑਧ 9DŽ⌘᜿〻ᒿሶ⋑ᴹԫօᵪՊ (Kill) 〻ᒿ㻛㓸→DŽ䈕ؑਧн㜭㻛ᦅ㧧ᡆ㘵㻛ᘭ⮕DŽᜣ・࡫㓸→а 10 SIGKILL ӗ⭏ dump core ᮷ԦDŽ (Dump) 〻ᒿ㻛㓸→ᒦ 9 SIGFPE (Floating Point Exception) ⎞⛩ᔲᑨDŽ 8 SIGUNUSED (Unused) ⋑ᴹ֯⭘DŽ ӗ⭏ dump core ᮷ԦDŽ (Dump) 〻ᒿ㻛㓸→ᒦ 7 SIGIOT (IO Trap) ਼ SIGABRT ӗ⭏ dump core ᮷ԦDŽ (Dump) 〻ᒿ㻛㓸→ᒦ 6 SIGABRT (Abort) ᭮ᔳᢗ㹼ˈᔲᑨ㔃ᶏDŽ 5 SIGTRAP (Breakpoint/Trace Trap) 䈳䈅⭘ˈ䐏䑚ᯝ⛩DŽ ӗ⭏ dump core ᮷ԦDŽ (Dump) 〻ᒿ㻛㓸→ᒦ 4 SIGILL (Illegal Instruction) 〻ᒿࠪ䭉ᡆ㘵ᢗ㹼Ҷаᶑ䶎⌅᫽֌ᤷԔDŽ ӗ⭏ dump core ᮷ԦDŽ   VLJQDOF 〻ᒿ   㹼˅DŽ䰝ᤷᇊ᮷ԦⲴ㌫㔏䈳⭘˄IVRSHQFˈޣ LQWIG LQWV\VBFORVH ᢺ䘋〻㖞Ѫⶑⵐ⣦ᘱˈⴤࡠ᭦ࡠؑਧ˄NHUQHOVFKHGFˈ 㹼˅DŽ YRLG LQWV\VBSDXVH  ᔿ≷㕆࠭ᮠDŽޕᇴᆈಘ᫽֌Ⲵ፼⇥ޣDVPVHJPHQWK!⇥᫽֌ཤ᮷ԦDŽᇊѹҶᴹLQFOXGH WW\BLRˈѢ㹼䙊ؑᯩ䶒Ⲵ৲ᮠǃᑨᮠDŽ ޣOLQX[WW\K!WW\ ཤ᮷ԦˈᇊѹҶᴹLQFOXGH OLQX[NHUQHOK!޵Ṩཤ᮷ԦDŽਜ਼ᴹаӋ޵Ṩᑨ⭘࠭ᮠⲴ৏ᖒᇊѹDŽLQFOXGH ᔿ≷㕆࠭ᮠᆿ䈝ਕDŽޕ䘠ㅖ৲ᮠ䇮㖞઼㧧ਆⲴ፼᧿ޣ䘈ᴹаӋᴹ OLQX[VFKHGK!䈳ᓖ〻ᒿཤ᮷ԦˈᇊѹҶԫ࣑㔃ᶴ WDVNBVWUXFWǃࡍ࿻ԫ࣑  ⲴᮠᦞˈLQFOXGH  ᑨᮠㅖਧDŽޣ ৺⴨ ઼ ZDLWSLG V\VZDLWK!ㅹᖵ䈳⭘ཤ᮷ԦDŽᇊѹ㌫㔏䈳⭘ ZDLWLQFOXGH VLJQDOK!ؑਧཤ᮷ԦDŽᇊѹؑਧㅖਧᑨ䟿ˈؑਧ㔃ᶴԕ৺ؑਧ᫽֌࠭ᮠ৏රDŽLQFOXGH  /LQXV Ӿ PLQL[ ѝᕅ䘋Ⲵ HUUQRK!䭉䈟ਧཤ᮷ԦDŽवਜ਼㌫㔏ѝ਴⿽ࠪ䭉ਧDŽLQFOXGH    /LQXV7RUYDOGV &     OLQX[NHUQHOH[LWF     ぁᓅ 8-8 linux/kernel/exit.c 8.9.2 ԙ⸷⌞䠀 䟺DŽ⌘ޣ䘋㹼н਼Ⲵ༴⨶DŽ䈖㿱ԓ⸱ѝⲴ⴨ 䘋〻˅ˈࡉᵜ䈳⭘ሶ・࡫䘄എDŽᆀ䘋〻֯⭘Ⲵᡰᴹ䍴Ⓚሶ䟺᭮DŽ䈕࠭ᮠⲴާփ᫽֌ҏ㾱ṩᦞަ৲ᮠ↫ܥⲴ 〻Ⲵؑਧˈᡆ㘵ᱟ䴰㾱䈳⭘ањؑਧਕᷴ˄ؑਧ༴⨶〻ᒿ˅DŽྲ᷌ pid ᡰᤷⲴᆀ䘋〻ᰙᐢ䘰ࠪ˄ᐢᡀᡰ䉃 ㌫㔏䈳⭘ waitpid()⭘Ҿᤲ䎧ᖃࡽ䘋〻ˈⴤࡠ pid ᤷᇊⲴᆀ䘋〻䘰ࠪ˄㓸→˅ᡆ㘵᭦ࡠ㾱≲㓸→䈕䘋 䘋〻ਁ䘱ᆀ䘋〻㓸→ؑਧ SIGCHLDDŽᴰਾ䇙޵Ṩ䟽ᯠ䈳ᓖԫ࣑Ⲵ䘀㹼DŽ ᘱˈ䇮㖞䘰ࠪ⸱ˈᒦੁަ⡦⣦↫ܥ䘋〻DŽ䲿ਾᢺᖃࡽ䘋〻㖞Ѫޣ〻㓴Ⲵ亶ཤ䘋〻ˈࡉ䘈䴰㾱㓸→ᡰᴹ⴨ 䰝ᖃࡽ䘋〻ᢃᔰⲴᡰᴹ᮷Ԧǃ䟺᭮֯⭘Ⲵ㓸ㄟ䇮༷ǃॿ༴⨶ಘ䇮༷ˈ㤕ᖃࡽ䘋〻ᱟ䘋ޣSIGCHLDDŽ᧕⵰ ᘱˈࡉੁ䘋〻 1 ਁ䘱ᆀ䘋〻㓸→ؑਧ⣦↫ܥ⡦䘋〻᭩Ѫ䘋〻 1˄init 䘋〻)DŽྲ᷌䈕ᆀ䘋〻ᐢ㓿༴Ҿ ԓ⸱⇥઼ᮠᦞ⇥ᡰঐⲴ޵ᆈ亥䶒DŽྲ᷌ᖃࡽ䘋〻ᴹᆀ䘋〻ˈቡሶᆀ䘋〻Ⲵ father 㖞Ѫ 1ˈণᢺᆀ䘋〻Ⲵ 〻ᒿ䘰ࠪ༴⨶࠭ᮠ do_exit()ᱟ൘ exit ㌫㔏䈳⭘Ⲵѝᯝ༴⨶〻ᒿѝ㻛䈳⭘DŽᆳ俆ݸՊ䟺᭮ᖃࡽ䘋〻Ⲵ ㌫㔏䈳⭘Պੁн਼Ⲵ䘋〻ᡆ䘋〻㓴ਁ䘱ؑਧDŽ〻ᒿ⌘䟺ѝᐢ㓿ࡇࠪҶ਴⿽н਼ᛵߥⲴ༴⨶ᯩᔿDŽ 䈕ˈ㌫㔏䈳⭘ sys_kill()⭘Ҿੁ䘋〻ਁ䘱ԫօᤷᇊⲴؑਧDŽṩᦞ৲ᮠ pid˄䘋〻ḷ䇶ਧ˅н਼Ⲵᮠ٬ 䘋〻㓴㓸→࠭ᮠ kill_session()䙊䗷ੁՊ䈍ਧоᖃࡽ䘋〻⴨਼Ⲵ䘋〻ਁ䘱ᤲᯝ䘋〻ⲴؑਧDŽ ޵ᆈ亥ˈᒦ・࡫䇙޵Ṩ䟽ᯠ䈳ᓖԫ࣑Ⲵ䘀㹼DŽޣᇊⲴ䘋〻ᤷ䪸ǃ䟺᭮⴨ 䟺᭮䘋〻Ⲵ࠭ᮠ release()ѫ㾱ṩᦞᤷᇊⲴԫ࣑ᮠᦞ㔃ᶴ˄ԫ࣑᧿䘠ㅖ˅ᤷ䪸ˈ൘ԫ࣑ᮠ㓴ѝࡐ䲔ᤷ ᮠ send_sig()઼䙊⸕⡦䘋〻ᆀ䘋〻㓸→Ⲵ࠭ᮠ tell_father()DŽ 㓸→઼〻ᒿ䘰ࠪ༴⨶࠭ᮠԕ৺ᵰ↫䘋〻ǃ㓸→䘋〻ǃᤲ䎧䘋〻ㅹ㌫㔏䈳⭘࠭ᮠDŽ䘈वᤜ䘋〻ؑਧਁ䘱࠭ ༴⨶һᇌDŽѫ㾱वਜ਼䘋〻䟺᭮ǃՊ䈍˄䘋〻㓴˅ޣ䈕〻ᒿѫ㾱᧿䘠Ҷ䘋〻˄ԫ࣑˅㓸→઼䘰ࠪⲴᴹ 8.9.1 ࣕ㜳ᨅ䘦 8.9 exit.c ぁᓅ   H[LWF 〻ᒿ ` ` ਁ䘱ᤲᯝ䘋〻ؑਧDŽ 6,*+83  S !VLJQDO_   S !VHVVLRQ FXUUHQW!VHVVLRQ  S LI ),567B7$6. ^ S! ZKLOH Պ䈍ਧቡੁᆳਁ䘱ᤲᯝ䘋〻ؑਧ 6,*+83DŽ ᢛ᧿ԫ࣑ᤷ䪸ᮠ㓴ˈሩҾᡰᴹⲴԫ࣑˄䲔ԫ࣑  ԕཆ˅ˈྲ᷌ަՊ䈍ਧ VHVVLRQ ㅹҾᖃࡽ䘋〻Ⲵ  S 俆ݸᤷੁԫ࣑ᮠ㓴ᴰᵛㄟDŽ ᤷ䪸S 15B7$6.6WDVN VWUXFWWDVNBVWUXFW ^  YRLG VWDWLFYRLGNLOOBVHVVLRQ 䘋〻㓴઼Պ䈍Ⲵ䈤᰾DŽޣ䘋〻Պ䈍Ⲵᾲᘥ䈧৲㿱ㅜ  ㄐѝᴹ VHVVLRQ DŽ 㓸→Պ䈍  ` UHWXUQ UHWXUQ(3(50 HOVH  VLJ   S!VLJQDO_  FXUUHQW!HXLG S!HXLG __VXVHU SULY__ LI FXUUHQW!HXLG  ˈ⭘Ҿࡔᯝᱟ੖ᱟ䎵㓗⭘ᡧDŽ ᇊѹѪ ަѝ VXVHU ᡆ㘵ᖃࡽ䘋〻ᱟ䎵㓗⭘ᡧˈࡉੁ䘋〻 S ਁ䘱ؑਧ VLJˈণ൘䘋〻 S սമѝ␫࣐䈕ؑਧˈ੖ࡉࠪ䭉䘰ࠪDŽ HXLG ቡᱟᤷᇊ䘋〻Ⲵ HXLG˄ҏণᱟ㠚ᐡ˅ˈ ྲ᷌ᕪࡦਁ䘱ḷᘇ㖞սˈᡆ㘵ᖃࡽ䘋〻Ⲵᴹ᭸⭘ᡧḷ䇶ㅖ UHWXUQ(,19$/  __VLJ!S__VLJ LI 㤕ؑਧн↓⺞ᡆԫ࣑ᤷ䪸Ѫオࡉࠪ䭉䘰ࠪDŽ ^  SLQWSULY ORQJVLJVWUXFWWDVNBVWUXFW VWDWLFLQOLQHLQWVHQGBVLJ ྲ᷌┑䏣ቡੁᤷᇊ䘋〻ਁ䘱ؑਧ VLJ ᒦ䘰ࠪˈ੖ࡉ䘄എᵚ䇨ਟ䭉䈟ਧDŽ ⭘ᡧ኎ᙗᡆ㓗࡛㘼㜭ਁ䘱ؑਧⲴᵳ࡙DŽ䈕࠭ᮠ俆ݸࡔᯝ৲ᮠⲴ↓⺞ᙗˈ❦ਾࡔᯝᶑԦᱟ੖┑䏣DŽ Sᤷᇊԫ࣑Ⲵᤷ䪸˗SULYᕪࡦਁ䘱ؑਧⲴḷᘇDŽণн䴰㾱㘳㲁䘋〻˗৲ᮠ˖VLJؑਧ٬ ੁᤷᇊԫ࣑ S ਁ䘱ؑਧ VLJˈᵳ䲀Ѫ SULYDŽ  ` ᤷᇊԫ࣑㤕нᆈ൘ࡉ↫ᵪDŽ WU\LQJWRUHOHDVHQRQH[LVWHQWWDVN SDQLF ` UHWXUQ 䟽ᯠ䈳ᓖ˄լѾ⋑ᴹᗵ㾱˅DŽ VFKHGXOH  ORQJ S IUHHBSDJH ޵ᆈ亥DŽޣ㖞オ䈕ԫ࣑亩ᒦ䟺᭮⴨WDVN>L@ 18// WDVN>L@ S ^ LI L ᢛ᧿ԫ࣑ᮠ㓴ˈራ᢮ᤷᇊԫ࣑DŽ15B7$6.6L L IRU UHWXUQ 䘰ࠪDŽˈڊS ྲ᷌䘋〻ᮠᦞ㔃ᶴᤷ䪸ᱟ 18//ˈࡉӰѸҏн LI  LQWL ^  S VWUXFWWDVNBVWUXFW YRLGUHOHDVH 㺘ѝ⋑ᴹ᢮ࡠᤷᇊԫ࣑ሩᓄⲴ亩ˈࡉ޵Ṩ SDQLF-DŽ 䈕ԫ࣑ᮠᦞ㔃ᶴᡰঐ⭘Ⲵ޵ᆈ亥䶒ˈᴰਾᢗ㹼䈳ᓖ࠭ᮠᒦ൘䘄എᰦ・ণ䘰ࠪDŽྲ᷌൘ԫ࣑ᮠ㓴 ᢛ᧿ԫ࣑ᤷ䪸ᮠ㓴㺘WDVN>@ԕራ᢮ᤷᇊⲴԫ࣑DŽྲ᷌᢮ࡠˈࡉ俆ݸ␵オ䈕ԫ࣑ˈ❦ਾ䟺᭮  ࠭ᮠѝ㻛䈳⭘DŽ ઼V\VBZDLWSLG ৲ᮠ Sᱟԫ࣑ᮠᦞ㔃ᶴᤷ䪸DŽ䈕࠭ᮠ൘ਾ䶒ⲴV\VBNLOO 䟺᭮ᤷᇊ䘋〻ঐ⭘Ⲵԫ࣑৺ަԫ࣑ᮠᦞ㔃ᶴঐ⭘Ⲵ޵ᆈ亥䶒DŽ   H[LWF 〻ᒿ  WDVN>L@!SLG SLG LI FRQWLQXH  WDVN>L@ LI L ^15B7$6.6L L IRU ᡆ㓸→ؑਧ 6,*&+/'DŽ→ڌᢛ᧿䘋〻ᮠ㓴㺘ˈራ᢮ᤷᇊ䘋〻 SLGˈᒦੁަਁ䘱ᆀ䘋〻ሶ  SLG LI  LQWL ^  LQWSLG VWDWLFYRLGWHOOBIDWKHU 㻛ࡍ࿻䘋〻  ᭦ᇩDŽ ྲ᷌⋑ᴹ᢮ࡠ⡦䘋〻ˈࡉ㠚ᐡ䟺᭮DŽնṩᦞ 326,; 㾱≲ˈ㤕⡦䘋〻ᐢݸ㹼㓸→ˈࡉᆀ䘋〻ᓄ䈕 ᡆ㓸→DŽ→ڌ䙊⸕⡦䘋〻ੁ䘋〻 SLG ਁ䘱ؑਧ 6,*&+/'˖唈䇔ᛵߥлᆀ䘋〻ሶ  ` UHWXUQUHWYDO UHWYDO HUU  S VLJ HUU VHQGBVLJ LI  S !SJUS SLG  S LI  ),567B7$6. S! HOVHZKLOH UHWYDO HUU  S VLJ HUU VHQGBVLJ LI  ),567B7$6. S! SLG  ZKLOH `HOVHLI UHWYDO HUU  S VLJ HUU VHQGBVLJ LI  S !SLG SLG  S LI ),567B7$6. ^ S! SLG! ZKLOH `HOVHLI UHWYDO HUU S ᕪࡦਁ䘱ؑਧDŽ VLJ HUU VHQGBVLJ LI  S !SJUS FXUUHQW!SLG  S LI ),567B7$6. ^ S! SLG ZKLOH LI   LQWHUUUHWYDO S 15B7$6.6WDVN VWUXFWWDVNBVWUXFW ^  LQWSLGLQWVLJ LQWV\VBNLOO 㺘᰾ᖃࡽ䘋〻ᱟ䘋〻㓴㓴䮯ˈഐ↔䴰㾱ੁᡰᴹ㓴޵Ⲵ䘋〻ᕪࡦਁ䘱ؑਧ VLJDŽ 䈕࠭ᮠᢛ᧿ԫ࣑ᮠ㓴㺘ˈᒦṩᦞ SLG Ⲵ٬ሩ┑䏣ᶑԦⲴ䘋〻ਁ䘱ᤷᇊⲴؑਧ VLJDŽ㤕 SLG ㅹҾ ˈ ྲ᷌ؑਧ VLJ Ѫ ˈࡉнਁ䘱ؑਧˈնӽՊ䘋㹼䭉䈟ỰḕDŽྲ᷌ᡀ࣏ࡉ䘄എ DŽ ˈࡉؑਧ VLJ ሶਁ䘱㔉䘋〻㓴SLG Ⲵᡰᴹ䘋〻DŽྲ᷌ SLG ྲ᷌ SLG ˈࡉؑਧ VLJ ቡՊਁ䘱㔉䲔ㅜањ䘋〻˄ࡍ࿻䘋〻 LQLW˅ཆⲴᡰᴹ䘋〻DŽ ྲ᷌ SLG ˈ䛓ѸؑਧቡՊ㻛ਁ䘱㔉ᖃࡽ䘋〻Ⲵ䘋〻㓴ѝⲴᡰᴹ䘋〻DŽ ࡉؑਧ㻛ਁ䘱㔉䘋〻ਧᱟ SLG Ⲵ䘋〻DŽˈ!٬ ྲ᷌ SLG ৲ᮠ SLG ᱟ䘋〻ਧ˗VLJ ᱟ䴰㾱ਁ䘱ⲴؑਧDŽ  ਟ⭘Ҿੁԫօ䘋〻ᡆ䘋〻㓴ਁ䘱ԫօؑਧˈ㘼ᒦ䶎ਚᱟᵰ↫䘋〻-DŽ ㌫㔏䈳⭘ NLOO    Ⲵ䇨ਟᵪࡦ䶎ᑨᐗ࿉ ѪҶੁ䘋〻㓴ㅹਁ䘱ؑਧˈ;;; 䴰㾱Ựḕ䇨ਟDŽNLOO       SHUPLVVLRQVVHPDQWLFVDUHWULFN\ JURXSVHWFHWFNLOO  ;;;QHHGWRFKHFNSHUPLVVLRQVQHHGHGWRVHQGVLJQDOVWRSURFHVV       H[LWF 〻ᒿ  ODVWBWDVNBXVHGBPDWK FXUUHQW LI ྲ᷌ᖃࡽ䘋〻к⅑֯⭘䗷ॿ༴⨶ಘˈࡉሶ ODVWBWDVNBXVHGBPDWK 㖞オDŽ  WW\BWDEOH>FXUUHQW!WW\@SJUS   FXUUHQW!WW\! FXUUHQW!OHDGHU LI OHDGHU 䘋〻ᒦфަᴹ᧗ࡦ㓸ㄟˈࡉ䟺᭮䈕㓸ㄟDŽ ྲ᷌ᖃࡽ䘋〻ᱟՊ䈍ཤ亶 FXUUHQW!H[HFXWDEOH 18//  FXUUHQW!H[HFXWDEOH LSXW FXUUHQW!URRW 18//  FXUUHQW!URRW LSXW FXUUHQW!SZG 18//  FXUUHQW!SZG LSXW L 㢲⛩ᒦ࠶࡛㖞オ˄䟺᭮˅DŽ ሩᖃࡽ䘋〻Ⲵᐕ֌ⴞᖅ SZGǃṩⴞᖅ URRW ԕ৺ᢗ㹼〻ᒿ᮷ԦⲴ L 㢲⛩䘋㹼਼↕᫽֌ˈ᭮എ਴њ  L V\VBFORVH  FXUUHQW!ILOS>L@ LI  L15B23(1L L IRU 䰝ᖃࡽ䘋〻ᢃᔰ⵰Ⲵᡰᴹ᮷ԦDŽޣ `  @<6,*&+/'WDVN YRLG VHQGBVLJ   䇮 WDVN>@㛟ᇊᱟ䘋〻 LQLWٷ䘉䟼  DVVXPSWLRQWDVN>@LVDOZD\VLQLW   WDVN>L@!VWDWH 7$6.B=20%,( LI  WDVN>L@!IDWKHU WDVN>L@!IDWKHU FXUUHQW!SLG ^ WDVN>L@ LI  L15B7$6.6L L IRU ᘱˈࡉੁ䘋〻  ਁ䘱ᆀ䘋〻㓸→ؑਧ 6,*&+/'DŽ⣦ ),%20= ↫ܥྲ᷌䈕ᆀ䘋〻ᐢ㓿༴Ҿ ަ⡦䘋〻᭩Ѫ䘋〻 ˈণ LQLW 䘋〻 DŽ  ྲ᷌ᖃࡽ䘋〻ᴹᆀ䘋〻ˈቡሶᆀ䘋〻Ⲵ IDWKHU 㖞Ѫ  [ FXUUHQW!OGW>@ JHWBOLPLW JHWBEDVH IUHHBSDJHBWDEOHV  [I FXUUHQW!OGW>@ JHWBOLPLW JHWBEDVH IUHHBSDJHBWDEOHV  ᆿսҾ LQFOXGHOLQX[VFKHGK ཤ᮷ԦⲴ  㹼༴DŽ ઼ JHWBOLPLW ᮷ԦⲴ  㹼ˈJHWBEDVH  ࠭ᮠսҾ PPPHPRU\F ৲ᮠˈਆ⇥䮯ᓖᰦ֯⭘䈕⇥Ⲵ䘹ᤙㅖ֌Ѫ৲ᮠDŽIUHHBSDJHBWDEOHV 䘹ᤙㅖ˄[ ᱟ䘋〻ᮠᦞ⇥Ⲵ䘹ᤙㅖ˅DŽণ൘ਆ⇥สൠ൰ᰦ֯⭘䈕⇥Ⲵ᧿䘠ㅖᡰ༴ൠ൰֌Ѫ  ѝⲴ [I ᱟ䘋〻ԓ⸱⇥Ⲵ ˄FXUUHQW!OGW>@㔉ࠪ䘋〻ԓ⸱⇥᧿䘠ㅖⲴս㖞˅˗JHWBOLPLW  ᆿѝⲴ FXUUHQW!OGW>@㔉ࠪ䘋〻ԓ⸱⇥᧿䘠ㅖⲴս㖞 䈤᰾Ⅲ䟺᭮Ⲵᆇ㢲䮯ᓖ٬DŽJHWBEDVH ˅ 䘄എ٬ ᤷ᰾൘ &38 㓯ᙗൠ൰オ䰤ѝ䎧࿻สൠ൰ˈㅜ  њ˄JHWBOLPLW˅ 䘄എ٬ ˄JHWBEDVH  Ⲵㅜ  њ৲ᮠ 俆ݸ䟺᭮ᖃࡽ䘋〻ԓ⸱⇥઼ᮠᦞ⇥ᡰঐⲴ޵ᆈ亥DŽ࠭ᮠ IUHHBSDJHBWDEOHV  LQWL ^  ORQJFRGH LQWGRBH[LW ৲ᮠ FRGH ᱟ䘰ࠪ⣦ᘱ⸱ˈᡆ〠Ѫ䭉䈟⸱DŽ  ˈн޽䘄എDŽ 䈕࠭ᮠሶᢺᖃࡽ䘋〻㖞Ѫ 7$6.B=20%,( ⣦ᘱˈ❦ਾ৫ᢗ㹼䈳ᓖ࠭ᮠ VFKHGXOH  ѝ㻛䈳⭘DŽ 〻ᒿ䘰ࠪ༴⨶࠭ᮠDŽ൘л䶒  㹼༴Ⲵ㌫㔏䈳⭘༴⨶࠭ᮠ V\VBH[LW  ` ྲ᷌⋑ᴹ᢮ࡠ⡦䘋〻ˈࡉ㠚ᐡ䟺᭮DŽ FXUUHQW UHOHDVH  %$'%$'QRIDWKHUIRXQG?Q?U SULQWN  ᒦнྭˈᗵ享᭩ᡀ⭡䘋〻  ݵᖃަ⡦䘋〻DŽڊྲ᷌⋑ᴹ᢮ࡠ⡦䘋〻ˈࡉ䘋〻ቡ㠚ᐡ䟺᭮DŽ䘉ṧ   7KLVLVQRWUHDOO\2.0XVWFKDQJHLWWRPDNHIDWKHU   WILQGDQ\IDWKHUVZHMXVWUHOHDVHRXUVHOYHV LIZHGRQ  ` UHWXUQ  6,*&+/'   WDVN>L@!VLJQDO_ FRQWLQXH   H[LWF 〻ᒿ ↔ᰦᢛ᧿䘹ᤙࡠⲴ䘋〻 S 㛟ᇊᱟᖃࡽ䘋〻Ⲵᆀ䘋〻DŽ FRQWLQXH  S !IDWKHU FXUUHQW!SLG LI FRQWLQXH  S FXUUHQW S__  LI S ^),567B7$6. S!/$67B7$6.  S IRU Ӿԫ࣑ᮠ㓴ᵛㄟᔰ࿻ᢛ᧿ᡰᴹԫ࣑ˈ䐣䗷オ亩ǃᵜ䘋〻亩ԕ৺䶎ᖃࡽ䘋〻Ⲵᆀ䘋〻亩DŽ  IODJ UHSHDW  VWDWBDGGU YHULI\BDUHD  S VWUXFWWDVNBVWUXFW IODJ ḷᘇ⭘Ҿਾ䶒㺘⽪ᡰ䘹ࠪⲴᆀ䘋〻༴Ҿቡ㔚ᡆⶑⵐᘱDŽLQWIODJFRGH ^  VWDWBDGGULQWRSWLRQV SLGBWSLGXQVLJQHGORQJ LQWV\VBZDLWSLG ᆈ⣦ᘱؑ᚟ս㖞Ⲵᤷ䪸˗RSWLRQV ᱟ ZDLWSLG 䘹亩DŽ؍VWDWBDGGU ᱟ ৲ᮠ SLG ᱟ䘋〻ਧ˗ ᆈࡠ䛓䟼DŽ؍ྲ᷌䘄എ⣦ᘱᤷ䪸 VWDWBDGGU нѪオˈࡉቡሶ⣦ᘱؑ᚟ 㤕 RSWLRQV :12+$1*ˈ㺘⽪ྲ᷌⋑ᴹᆀ䘋〻䘰ࠪᡆ㓸→ቡ傜к䘄എDŽ Ⲵˈҏ傜к䘄എ˄ᰐ享䐏䑚˅DŽ→ڌ㤕 RSWLRQV :8175$&('ˈ㺘⽪ྲ᷌ᆀ䘋〻ᱟ ྲ᷌ SLG 㺘⽪ㅹᖵԫօᆀ䘋〻DŽ 㺘⽪ㅹᖵ䘋〻㓴ਧㅹҾ SLG 㔍ሩ٬Ⲵԫօᆀ䘋〻DŽྲ᷌ SLG ྲ᷌ SLG 㺘⽪ㅹᖵ䘋〻㓴ਧㅹҾᖃࡽ䘋〻㓴ਧⲴԫօᆀ䘋〻DŽ ྲ᷌ SLG!㺘⽪ㅹᖵ䘋〻ਧㅹҾ SLG Ⲵᆀ䘋〻DŽ 䘋〻˅ˈࡉᵜ䈳⭘ሶ・࡫䘄എDŽᆀ䘋〻֯⭘Ⲵᡰᴹ䍴Ⓚሶ䟺᭮DŽ↫ܥ䘰ࠪ˄ᐢᡀᡰ䉃Ⲵ 䈕䘋〻Ⲵؑਧˈᡆ㘵ᱟ䴰㾱䈳⭘ањؑਧਕᷴ˄ؑਧ༴⨶〻ᒿ˅DŽྲ᷌ SLG ᡰᤷⲴᆀ䘋〻ᰙᐢ  DŽᤲ䎧ᖃࡽ䘋〻ˈⴤࡠ SLG ᤷᇊⲴᆀ䘋〻䘰ࠪ˄㓸→˅ᡆ㘵᭦ࡠ㾱≲㓸→ ㌫㔏䈳⭘ ZDLWSLG  `   [II HUURUBFRGH UHWXUQGRBH[LW ^  LQWHUURUBFRGH LQWV\VBH[LW 䘋〻㓸→Ⲵ৏ഐ˄ؑਧ˅DŽ  ࡙⭘䘉Ӌᆿቡਟԕਆᗇᆀ䘋〻Ⲵ䘰ࠪ⣦ᘱ⸱ᡆᆀ ᡆ ZDLWSLG ᮷Ԧㅜ  㹼DŽZDLW ᘱ˄7$6.B67233('˅ˈ䛓Ѹަվᆇ㢲ቡㅹҾ[IDŽ৲㿱V\VZDLWK⣦ڌྲ᷌䘋〻༴ҾᲲ  Ⲵ⣦ᘱؑ᚟DŽֻྲˈ ᆈ ZDLW؍ ࠭ᮠⲴ㾱≲DŽվᆇ㢲ѝሶ⭘ᶕ ᡆZDLWSLG ∄⢩ᱟZDLW  ৲ᮠ HUURUBFRGH ᱟ⭘ᡧ〻ᒿᨀ׋Ⲵ䘰ࠪ⣦ᘱؑ᚟ˈਚᴹվᆇ㢲ᴹ᭸DŽᢺ HUURUBFRGH ᐖ〫  DŽ㓸→䘋〻DŽ ㌫㔏䈳⭘ H[LW  `  ӵ⭘Ҿ৫ᦹ䆖੺ؑ᚟  MXVWWRVXSSUHVVZDUQLQJV   UHWXUQ 䆖੺ؑ᚟DŽٷӋⲴԓ⸱ˈᒦфਟԕн⭘޽߉䘉ᶑ UHWXUQ 䈝ਕҏнՊӗ⭏ YRODWLOHˈቡਟԕ੺䇹 JFF 㕆䈁ಘᵜ࠭ᮠнՊ䘄എⲴ⢩↺ᛵߥDŽ䘉ṧਟ䇙 JFF ӗ⭏ᴤྭа 䭞ᆇޣл䶒 UHWXUQ 䈝ਕӵ⭘Ҿ৫ᦹ䆖੺ؑ᚟DŽഐѪ䘉њ࠭ᮠн䘄എˈᡰԕ㤕൘࠭ᮠ਽ࡽ࣐ 䘋〻ަԆⲴழਾһᇌDŽ↫ܥ⨶䟽ᯠ䈳ᓖ䘋〻䘀㹼ˈԕ䇙⡦䘋〻༴ VFKHGXOH  FXUUHQW!IDWKHU WHOOBIDWKHU ᡆ㓸→DŽ→ڌ䙊⸕⡦䘋〻ˈҏণੁ⡦䘋〻ਁ䘱ؑਧ 6,*&+/'ᆀ䘋〻ሶ FXUUHQW!H[LWBFRGH FRGH FXUUHQW!VWDWH 7$6.B=20%,( ᆈሶ⭡⡦䘋〻䈫ਆⲴ䘰ࠪ⸱DŽ؍ᘱˈ㺘᰾ᖃࡽ䘋〻ᐢ㓿䟺᭮Ҷ䍴ⓀDŽᒦ⣦↫ܥᢺᖃࡽ䘋〻㖞Ѫ  NLOOBVHVVLRQ  FXUUHQW!OHDGHU LI 䘋〻DŽޣྲ᷌ᖃࡽ䘋〻ᱟ OHDGHU 䘋〻ˈࡉ㓸→䈕Պ䈍Ⲵᡰᴹ⴨ ODVWBWDVNBXVHGBPDWK 18//   H[LWF 〻ᒿ ੖ࡉˈ䘄എࠪ䭉⸱þѝᯝⲴ㌫㔏䈳⭘ÿᒦ䘰ࠪDŽ䪸ሩ䘉њࠪ䭉ਧ⭘ᡧ〻ᒿᓄ䈕޽㔗㔝䈳⭘ᵜ ᖃ৸ᔰ࿻ᢗ㹼ᵜ䘋〻ᰦˈྲ᷌ᵜ䘋〻⋑ᴹ᭦ࡠ䲔6,*&+/'ԕཆⲴؑਧˈࡉ䘈ᱟ䟽༽༴⨶DŽ ・࡫䘄എ˅ˈቡ・࡫䘄എˈ䘰ࠪDŽ੖ࡉᢺᖃࡽ䘋〻㖞Ѫਟѝᯝㅹᖵ⣦ᘱᒦ䟽ᯠᢗ㹼䈳ᓖDŽ ᘱDŽྲ᷌↔ᰦᐢ䇮㖞 :12+$1* 䘹亩˄㺘⽪㤕⋑ᴹᆀ䘋〻༴Ҿ䘰ࠪᡆ㓸→ᘱቡ⣦↫ܥҾ䘰ࠪᡆ ൘к䶒ሩԫ࣑ᮠ㓴ᢛ᧿㔃ᶏਾˈྲ᷌IODJ 㻛㖞սˈ䈤᰾ᴹㅖਸㅹᖵ㾱≲Ⲵᆀ䘋〻ᒦ⋑ᴹ༴ ` ` FRQWLQXH  IODJ GHIDXOW 㾱≲Ⲵᆀ䘋〻ˈնᱟᆳ༴Ҿ䘀㹼ᘱᡆⶑⵐᘱDŽ 䛓Ѹቡ㖞 IODJ DŽ㺘⽪᢮ࡠ䗷ањㅖਸˈ↫ܥҏнᱟ→ڌྲ᷌䘉њᆀ䘋〻 S Ⲵ⣦ᘱᰒнᱟ 䘄എᆀ䘋〻Ⲵ SLGUHWXUQIODJ 㖞⣦ᘱؑ᚟Ѫ䘰ࠪ⸱٬DŽ FRGHVWDWBDGGU SXWBIVBORQJ 䟺᭮䈕ᆀ䘋〻DŽ S UHOHDVH ਆᆀ䘋〻Ⲵ䘰ࠪ⸱DŽS !H[LWBFRGH  FRGH ᆈᆀ䘋〻 SLGDŽ؍ѤᰦS !SLG  IODJ S !VWLPH  FXUUHQW!FVWLPH S !XWLPH  FXUUHQW!FXWLPH FDVH7$6.B=20%,( ⸱઼ SLGDŽ ˄⡦䘋〻˅ѝˈ❦ਾਆࠪᆀ䘋〻Ⲵ SLG ઼䘰ࠪ⸱ˈᒦ䟺᭮䈕ᆀ䘋〻DŽᴰਾ䘄എᆀ䘋〻Ⲵ䘰ࠪ ᘱˈࡉ俆ݸᢺᆳ൘⭘ᡧᘱ઼޵Ṩᘱ䘀㹼Ⲵᰦ䰤࠶࡛㍟䇑ࡠᖃࡽ䘋〻⣦↫ܥྲ᷌ᆀ䘋〻 S ༴Ҿ S !SLG UHWXUQ  [IVWDWBDGGU SXWBIVBORQJ FRQWLQXH  :8175$&(' RSWLRQV  LI FDVH7$6.B67233(' ৲㿱 LQFOXGHV\VZDLWKˈ 㹼DŽ  ᆿѪⵏDŽ ᒦ・࡫䘄എᆀ䘋〻ਧSLGDŽ䘉䟼[I㺘⽪Ⲵ䘄എ⣦ᘱ֯:,)67233(' VWDWBDGGUˈ ޕҾᱟ㔗㔝ᢛ᧿༴⨶ަԆ䘋〻DŽྲ᷌:8175$&(' 㖞սˈࡉᢺ⣦ᘱؑ᚟ [I ᭮ ᘱᰦˈྲ᷌↔ᰦ:8175$&('ḷᘇ⋑ᴹ㖞սˈ㺘⽪〻ᒿᰐ享・࡫䘄എˈ⣦→ڌᆀ䘋〻 S༴Ҿ S !VWDWH ^ VZLWFK ㅹҾ˅DŽ᧕лᶕṩᦞ䘉њᆀ䘋〻 S ᡰ༴Ⲵ⣦ᘱᶕ༴⨶DŽ ᆀ䘋〻ˈᡆ㘵ᱟ䘋〻ਧㅹҾᤷᇊ SLG 㔍ሩ٬Ⲵᆀ䘋〻ˈᡆ㘵ᱟԫօᆀ䘋〻˄↔ᰦᤷᇊⲴ SLG ⲴᛵߥDŽ↔ᰦᡰ䘹ᤙࡠⲴ䘋〻 S ᡆ㘵ᱟަ䘋〻ਧㅹҾᤷᇊ SLGˈᡆ㘵ᱟᖃࡽ䘋〻㓴ѝⲴԫօ  ྲ᷌ࡽ  њሩ SLG Ⲵࡔᯝ䜭нㅖਸˈࡉ㺘⽪ᖃࡽ䘋〻↓൘ㅹᖵަԫօᆀ䘋〻ˈҏণ SLG ` FRQWLQXH  S !SJUS SLG LI SLG  ^ `HOVHLI 㻛ᢛ᧿䘋〻 S Ⲵ㓴ਧо SLG Ⲵ㔍ሩ٬нㅹˈࡉ䐣䗷DŽ ˈ㺘⽪↓൘ㅹᖵ䘋〻㓴ਧㅹҾ SLG 㔍ሩ٬Ⲵԫօᆀ䘋〻DŽྲ᷌↔ᰦ੖ࡉˈྲ᷌ᤷᇊⲴ SLG FRQWLQXH  S !SJUS FXUUHQW!SJUS LI SLG ^ `HOVHLI ྲ᷌↔ᰦ㻛ᢛ᧿䘋〻 S Ⲵ䘋〻㓴ਧоᖃࡽ䘋〻Ⲵ㓴ਧнㅹˈࡉ䐣䗷DŽ ੖ࡉˈྲ᷌ᤷᇊㅹᖵ䘋〻Ⲵ SLG ˈ㺘⽪↓൘ㅹᖵ䘋〻㓴ਧㅹҾᖃࡽ䘋〻㓴ਧⲴԫօᆀ䘋〻DŽ FRQWLQXH  S !SLG SLG LI SLG! ^ LI 䘋〻ˈҾᱟ䐣䗷䈕䘋〻ˈ᧕⵰ᢛ᧿лањ䘋〻DŽ ྲ᷌ㅹᖵⲴᆀ䘋〻ਧ SLG!ˈնо㻛ᢛ᧿ᆀ䘋〻 S Ⲵ SLG н⴨ㅹˈ䈤᰾ᆳᱟᖃࡽ䘋〻ਖཆⲴᆀ   H[LWF 〻ᒿ ᢺ傼䇱Ⲵ䎧࿻ս㖞䈳ᮤѪ亥䶒䎧࿻ս㖞ˈ਼ᰦሩ傼䇱㤳ത֌⴨ᓄ䈳ᮤDŽ ࠭ᮠ write_verify()䴰㾱ԕ޵ᆈ亥䶒Ѫঅս˄4096 ᆇ㢲˅䘋㹼᫽֌ˈഐ↔൘䈳⭘ write_verify()ѻࡽˈ䴰㾱 മ 8-13 ᱟ޵ᆈ傼䇱࠭ᮠ verify_area()ѝ傼䇱޵ᆈⲴ䎧࿻ս㖞઼㤳തⲴ䈳ᮤ⽪᜿മDŽഐѪ޵ᆈ߉傼䇱 ᶴѝⲴ tss ઼ ldtDŽᴰਾ޽ሶᯠԫ࣑䇮㖞ᡀਟ䘀㹼⣦ᘱˈᒦੁᖃࡽ䘋〻䘄എᯠ䘋〻ਧDŽ ᢃᔰ⅑ᮠ໎ 1DŽ᧕⵰൘ GDT ѝ䇮㖞ᯠԫ࣑Ⲵ TSS ઼ LDT ᧿䘠ㅖ亩ˈަѝสൠ൰ؑ᚟ᤷੁᯠ䘋〻ԫ࣑㔃 亥㺘亩DŽྲ᷌⡦䘋〻ѝᴹ᮷ԦᱟᢃᔰⲴˈࡉᆀ䘋〻ѝ⴨ᓄⲴ᮷Ԧҏᱟᢃᔰ⵰Ⲵˈഐ↔䴰㾱ሶሩᓄ᮷ԦⲴ ↔ਾ㌫㔏䇮㖞ᯠԫ࣑ԓ⸱⇥઼ᮠᦞ⇥Ⲵส൰઼⇥䲀䮯ˈᒦ༽ࡦᖃࡽ䘋〻޵ᆈ࠶亥㇑⨶Ⲵ亥ⴞᖅ亩઼ ᆈࡠᯠ䘋〻Ⲵ tss.i387 㔃ᶴѝDŽ ؍ተ䜘㺘᧿䘠ㅖ൘ GDT ѝⲴ㍒ᕅ٬DŽྲ᷌ᖃࡽ䘋〻֯⭘Ҷॿ༴⨶ಘˈࡉ䘈䴰㾱ᢺॿ༴⨶ಘⲴᆼᮤ⣦ᘱ 䘋〻ԫ࣑ᮠᦞ㔃ᶴᡰ൘޵ᆈ亥䶒Ⲵ亦ㄟˈ㘼ึḸ⇥ tss.ss0 㻛䇮㖞ᡀ޵Ṩᮠᦞ⇥䘹ᤙㅖDŽtss.ldt 㻛䇮㖞Ѫ ᔪ䘋〻ᰦᯠ䘋〻䘄എ٬ᓄѪ 0ˈᡰԕ䴰㾱䇮㖞 tss.eax = 0DŽᯠᔪ䘋〻޵ṨᘱึḸᤷ䪸 tss.esp0 㻛䇮㖞ᡀᯠ ༽սᯠ䘋〻਴㔏䇑٬DŽ᧕⵰ṩᦞᖃࡽ䘋〻⧟ຳ䇮㖞ᯠ䘋〻ԫ࣑⣦ᘱ⇥˄TSS˅ѝ਴ᇴᆈಘⲴ٬DŽ⭡Ҿࡋ 䲿ਾሩᐢ༽ࡦⲴԫ࣑ᮠᦞ㔃ᶴ޵ᇩ䘋㹼؞᭩DŽᢺᖃࡽ䘋〻䇮㖞Ѫᯠ䘋〻Ⲵ⡦䘋〻ˈ␵䲔ؑਧսമᒦ ؑ᚟ˈᒦ༽ࡦᖃࡽ䘋〻ԫ࣑ᮠᦞ㔃ᶴѝⲴᡰᴹ޵ᇩ֌Ѫᯠ䘋〻ԫ࣑ᮠᦞ㔃ᶴⲴ⁑ᶯDŽ ࡠ䘋〻ᮠᦞ㔃ᶴѝؑ᚟Ⲵ䇮㖞DŽ㌫㔏俆ݸѪᯠᔪ䘋〻൘ѫ޵ᆈ४ѝ⭣䈧а亥޵ᆈᶕᆈ᭮ަԫ࣑ᮠᦞ㔃ᶴ copy_process()⭘Ҿࡋᔪᒦ༽ࡦ䘋〻Ⲵԓ⸱⇥઼ᮠᦞ⇥ԕ৺⧟ຳDŽ൘䘋〻༽ࡦ䗷〻ѝˈᐕ֌ѫ㾱⢥⎹ verify_area()઼ copy_mem()DŽ ⭘Ⲵєњ C 䈝䀰࠭ᮠ˖find_empty_process()઼ copy_process()DŽ䘈वᤜ䘋〻޵ᆈ४ฏ傼䇱о޵ᆈ࠶䝽࠭ᮠ ˄൘ kernel/system_call.s ѝӾ 208 㹼ᔰ࿻˅㌫㔏䈳⭘Ⲵ䖵ࣙ༴⨶࠭ᮠ䳶ˈ㔉ࠪҶ sys_fork()㌫㔏䈳⭘ѝ֯ fork()㌫㔏䈳⭘⭘Ҿࡋᔪᆀ䘋〻DŽLinux ѝᡰᴹ䘋〻䜭ᱟ䘋〻 0˄ԫ࣑ 0˅Ⲵᆀ䘋〻DŽ䈕〻ᒿᱟ sys_fork() 8.10.1 ࣕ㜳ᨅ䘦 8.10 fork.c ぁᓅ   ` UHWXUQ(&+,/' 㤕⋑ᴹ᢮ࡠㅖਸ㾱≲Ⲵᆀ䘋〻ˈࡉ䘄എࠪ䭉⸱˄ᆀ䘋〻нᆈ൘˅DŽ ` 䘄എࠪ䭉⸱˄ѝᯝⲴ㌫㔏䈳⭘˅DŽUHWXUQ(,175 HOVH JRWRUHSHDW  6,*&+/'  a FXUUHQW!VLJQDO  LI 䟽ᯠ䈳ᓖDŽ VFKHGXOH 㖞ᖃࡽ䘋〻Ѫਟѝᯝㅹᖵ⣦ᘱDŽFXUUHQW!VWDWH 7$6.B,17(55837,%/( UHWXUQ :12+$1* 㤕 RSWLRQV :12+$1*ˈࡉ・࡫䘄എDŽ RSWLRQV LI IODJ ^ LI ࠭ᮠㅹᖵᆀ䘋〻DŽ   IRUNF 〻ᒿ ᯠ䎧࿻ս㖞 VWDUW ᯠ䮯ᓖ VL]H ৏䎧࿻ս㖞 DGGU  QU ᱟԫ࣑ਧ ޵ᆈ亥䶒 ৏䮯ᓖ VL]H 0 QU 0 QU ԓ⸱ ᮠᦞ   ࠭ᮠDŽ FRS\BSDJHBWDEOHV ѝⲴ PPPHPRU\F ޵ᆈ㇑⨶তᴹӋ䳮ᓖDŽ৲㿱  ˅DŽаᰖ֐Ҷ䀓Ҷ IRUNˈቡՊਁ⧠ᆳᱟ䶎ᑨㆰঅⲴˈն YHULI\BDUHD ަԆ࠭ᮠ˄  Ⲵ䖵ࣙᆀ〻ᒿ˄৲㿱 V\VWHPBFDOOV˅ˈԕ৺аӋ IRUN ѝਜ਼ᴹ㌫㔏䈳⭘ IRUNF        FRS\BSDJHBWDEOHV  PPPPF PDQDJHPHQWFDQEHDELWFK6HH  )RUNLVUDWKHUVLPSOHRQFH\RXJHWWKHKDQJRILWEXWWKHPHPRU\   YHULI\BDUHD VHHDOVRV\VWHPBFDOOV DQGVRPHPLVFIXQFWLRQV   V\VWHPFDOO IRUN FRQWDLQVWKHKHOSURXWLQHVIRUWKH IRUNF        /LQXV7RUYDOGV &     OLQX[NHUQHOIRUNF     ぁᓅ 8-9 linux/kernel/fork.c 8.10.2 ԙ⸷⌞䠀 ᰦ㻛䇯䰞Ⲵ޵ᆈ亥䶒᡽Պ൘߉᫽֌ࡽ㻛༽ࡦࡠᯠ⭣䈧Ⲵ޵ᆈ亥䶒ѝDŽ ⭘⡦䘋〻ᐢᴹⲴԓ⸱઼ᮠᦞ޵ᆈ亥䶒DŽਚᴹᖃԕਾᢗ㹼䗷〻ѝྲ᷌ަѝᴹањ䘋〻ԕ߉ᯩᔿ䇯䰞޵ᆈ֯ ਼ޡ൘ fork()Ⲵᢗ㹼䗷〻ѝˈ޵ṨᒦнՊ・࡫Ѫᯠ䘋〻࠶䝽ԓ⸱઼ᮠᦞ޵ᆈ亥DŽᯠ䘋〻ሶо⡦䘋〻 Ⲵ亥ⴞᖅ㺘ˈ㘼ᯠ䘋〻Ⲵ亥㺘ࡉ䴰ਖ㹼⭣䈧а亥޵ᆈᶕᆈ᭮DŽ ⭘ањսҾ⢙⨶޵ᆈᔰ࿻ս㖞༴ޡࡦ⡦䘋〻Ⲵ亥ⴞᖅ亩઼亥㺘亩DŽሩҾ Linux 0.11 ޵Ṩᶕ䈤ˈᡰᴹ〻ᒿ ⴨਼DŽ᧕⵰㌫㔏ՊѪᯠ䘋〻༽ޘᵪࡦˈLinux 0.11 Ⲵԓ⸱⇥઼ᮠᦞ⇥൘㓯ᙗൠ൰オ䰤ѝⲴս㖞઼䮯ᓖᆼ ѝᯝ䗷〻ࡽⲴ⣦ᘱDŽ❦ਾѪᯠ䘋〻⺞ᇊ൘㓯ᙗൠ൰オ䰤ѝⲴ䎧࿻ս㖞˄nr * 64MB˅DŽሩҾ CPU Ⲵ࠶⇥ޕ ᤱ⡦䘋〻ণሶ䘋؍䇙ᯠ䘋〻Ⲵ⣦ᘱˈ٬⇥copy_process()Ⲵ৲ᮠ˅䟽ᯠ䇮㖞ԫ࣑㔃ᶴѝⲴ TSS 㔃ᶴⲴ਴ᆇ ḸⲴᇴᆈಘؑ᚟˄ণึޕवᤜ࡙⭘㌫㔏䈳⭘ѝᯝਁ⭏ᰦ䙀↕঻ˈ٬⇥〻؞᭩༽ࡦⲴԫ࣑ᮠᦞ㔃ᶴⲴḀӋᆇ ᶕ䈤 fork()俆ݸՊѪᯠ䘋〻⭣䈧а亥޵ᆈ亥⭘ᶕ༽ࡦ⡦䘋〻Ⲵԫ࣑ᮠᦞ㔃ᶴ˄PCB˅ؑ᚟ˈ❦ਾՊѪᯠ䘋 к䶒ṩᦞ fork.c 〻ᒿѝ਴࠭ᮠⲴ࣏㜭᧿䘠Ҷ fork()Ⲵ֌⭘DŽ䘉䟼ᡁԜӾᙫփк޽ሩަ〽࣐䈤᰾DŽᙫⲴ ഴ ޻ᆎ僂䇷㤹പૂ䎭ခփ㖤Ⲻ䈹᮪    IRUNF 〻ᒿ ӛᡰᴹ޵ᆈ亥䶒DŽ᫽֌ᡀ࣏䘄എ ˈ੖ࡉ䘄എࠪ䭉ਧDŽޡ޵ᆈ亥䶒DŽ↔ᰦᯠ䘋〻оަ⡦䘋〻 ᢰᵟˈഐ↔䘉䟼ӵѪᯠ䘋〻䇮㖞㠚ᐡⲴ亥ⴞᖅ㺘亩઼亥㺘亩ˈ㘼⋑ᴹᇎ䱵Ѫᯠ䘋〻࠶䝽⢙⨶ ⇥઼ᮠᦞ⇥ส൰ǃ䲀䮯ˈᒦ༽ࡦ亥㺘DŽ⭡Ҿ /LQX[ ㌫㔏䟷⭘Ҷ߉ᰦ༽ࡦ˄FRS\RQZULWH˅ ৲ᮠ QU ᱟᯠԫ࣑ਧ˗S ᱟᯠԫ࣑ᮠᦞ㔃ᶴᤷ䪸DŽ䈕࠭ᮠѪᯠԫ࣑൘㓯ᙗൠ൰オ䰤ѝ䇮㖞ԓ⸱ ༽ࡦ޵ᆈ亥㺘DŽ  ` `  VWDUW  VWDUW ZULWHBYHULI\  VL]H VL]H! ^ ZKLOH LQFOXGHOLQX[VFKHGKˈ 㹼DŽ FXUUHQW!OGW>@ VWDUW JHWBEDVH ❦ਾᗚ⧟䘋㹼߉亥䶒傼䇱DŽ㤕亥䶒нਟ߉ˈࡉ༽ࡦ亥䶒DŽ˄PPPHPRU\Fˈ 㹼˅ ൰ս㖞DŽሩҾ /LQX[ ޵Ṩˈަᮠᦞ⇥઼ԓ⸱⇥൘㓯ᙗൠ൰オ䰤ѝⲴส൰઼䲀䮯൷⴨਼DŽ л䶒ᢺVWDUW࣐к䘋〻ᮠᦞ⇥൘㓯ᙗൠ൰オ䰤ѝⲴ䎧࿻ส൰ˈਈᡀ㌫㔏ᮤњ㓯ᙗオ䰤ѝⲴൠ ↔ᰦ VWDUW ᱟᖃࡽ䘋〻オ䰤ѝⲴ䙫䗁ൠ൰DŽ [IIIII VWDUW [III VL]H VWDUW XQVLJQHGORQJ DGGU  VWDUW 䇱㤳തⲴ䈳ᮤāDŽ ഐ↔൘ 㹼кҏ䴰㾱ᢺ傼䇱ᔰ࿻ս㖞VWDUW䈳ᮤᡀ亥䶒䗩⭼٬DŽ৲㿱ࡽ䶒ⲴമĀ޵ᆈ傼 ٬ণᢙኅᡀԕDGGUᡰ൘亥䶒䎧࿻ս㖞ᔰ࿻Ⲵ㤳ത٬DŽ〫ٿ৏傼䇱㤳തVL]H࣐к䘉њˈ٬ 〫ٿ[III⭘ᶕ㧧ᗇᤷᇊ䎧࿻ս㖞 DGGU˄ҏণ VWDUW˅൘ᡰ൘亥䶒ѝⲴ лਕѝⲴVWDUW 俆ݸሶ䎧࿻ൠ൰ VWDUW 䈳ᮤѪަᡰ൘亥Ⲵᐖ䗩⭼ᔰ࿻ս㖞ˈ਼ᰦ⴨ᓄൠ䈳ᮤ傼䇱४ฏབྷሿDŽ  XQVLJQHGORQJVWDUW ^  DGGULQWVL]H YRLG YRLGYHULI\BDUHD ӛỰ傼઼༽ࡦ亥䶒᫽֌˄߉ᰦ༽ࡦ˅DŽޡᱟਚ䈫Ⲵˈࡉᢗ㹼  ሩᤷᇊབྷሿⲴ޵ᆈオ䰤䘋㹼߉ࡽ傼䇱DŽ㤕亥䶒 䰤ѝⲴൠ൰DŽᴰਾᗚ⧟䈳⭘ ZULWHBYHULI\ 䶒ᔰ࿻ൠ൰ VWDUWˈ❦ਾVWDUW ࣐к䘋〻ᮠᦞ⇥ส൰ˈ֯䘉њ VWDUW ਈᦒᡀ &38* 㓯ᙗオ ⲴỰ⍻᫽֌DŽ⭡ҾỰ⍻ࡔᯝᱟԕ亥䶒Ѫঅս䘋㹼᫽֌ˈഐ↔〻ᒿ俆ݸ䴰㾱᢮ࠪ DGGU ᡰ൘亥 䈕࠭ᮠሩᖃࡽ䘋〻䙫䗁ൠ൰ӾDGGUࡠDGGUVL]H䘉а⇥㤳തԕ亥Ѫঅսᢗ㹼߉᫽֌ࡽ ࡠᵜ࠭ᮠⲴⴞⲴDŽ ᣔᔲᑨDŽӾ㘼  ԕк &38 ਟԕ䙊䗷䇮㖞䈕ḷᘇᶕ䗮؍亥䶒ᢗ㹼߉ᮠᦞˈ੖ࡉሶሬ㠤ਁ⭏߉ ᣔḷᘇ :3˄ս ˅ˈ޵Ṩਟԕ䙊䗷䇮㖞䈕ḷᘇᶕ⾱→⢩ᵳ㓗  Ⲵԓ⸱ੁ⭘ᡧオ䰤ਚ䈫؍߉  ࠭ᮠቡ⭘Ҿ↔ⴞⲴDŽնሩҾ  ᡆਾᶕⲴ &38ˈަ᧗ࡦᇴᆈಘ &5 ѝᴹањ YHULI\BDUHD ᣔḷᘇ䎧нҶ֌⭘ˈ߉ᰦ༽ࡦᵪࡦҏቡཡ৫Ҷ֌⭘DŽ؍൘ᢗ㹼޵Ṩԓ⸱ᰦ⭘ᡧオ䰤ѝᮠᦞ亥䶒 ᣔⲴˈഐ↔؍ሩҾ &38ˈ൘ᢗ㹼⢩ᵳ㓗  ԓ⸱ᰦнՊ⨶Պ⭘ᡧオ䰤ѝⲴ亥䶒ᱟ੖ᱟ亥 䘋〻オ䰤४ฏ߉ࡽ傼䇱࠭ᮠDŽ   ⭏ᡀDŽ ٬Պ⭡ JHWBHPSW\BSURFHVVަˈᴰᯠ䘋〻ਧ ORQJODVWBSLG   XQVLJQHGORQJDGGUHVV H[WHUQYRLGZULWHBYHULI\ ߉亥䶒傼䇱DŽ㤕亥䶒нਟ߉ˈࡉ༽ࡦ亥䶒DŽᇊѹ൘ PPPHPRU\Fㅜ  㹼ᔰ࿻DŽ  ᔿ≷㕆ᆿDŽޕDVPV\VWHPK!㌫㔏ཤ᮷ԦDŽᇊѹҶ䇮㖞ᡆ؞᭩᧿䘠ㅖѝᯝ䰘ㅹⲴ፼LQFOXGH ᔿ≷㕆࠭ᮠDŽޕᇴᆈಘ᫽֌Ⲵ፼⇥ޣDVPVHJPHQWK!⇥᫽֌ཤ᮷ԦDŽᇊѹҶᴹLQFOXGH OLQX[NHUQHOK!޵Ṩཤ᮷ԦDŽਜ਼ᴹаӋ޵Ṩᑨ⭘࠭ᮠⲴ৏ᖒᇊѹDŽLQFOXGH ᔿ≷㕆࠭ᮠᆿ䈝ਕDŽޕ䘠ㅖ৲ᮠ䇮㖞઼㧧ਆⲴ፼᧿ޣ䘈ᴹаӋᴹ OLQX[VFKHGK!䈳ᓖ〻ᒿཤ᮷ԦˈᇊѹҶԫ࣑㔃ᶴ WDVNBVWUXFWǃԫ࣑  ⲴᮠᦞˈLQFOXGH  /LQXV Ӿ PLQL[ ѝᕅ䘋 DŽ HUUQRK!䭉䈟ਧཤ᮷ԦDŽवਜ਼㌫㔏ѝ਴⿽ࠪ䭉ਧDŽLQFOXGH   IRUNF 〻ᒿ ]ORQJHE[ORQJHF[ORQJHG LQWQUORQJHESORQJHGLORQJHVLORQJJVORQJQRQH LQWFRS\BSURFHVV  ࠶䝽Ⲵԫ࣑ᮠ㓴亩ਧDŽ ަѝ৲ᮠ QU ᱟ䈳⭘ ILQGBHPSW\BSURFHVV ٬DŽ˅ḸⲴ JVǃHVLǃHGLǃHES ઼ HD[˄QUޕ ѻࡽ঻ ĺㅜ  㹼൘䈳⭘ FRS\BSURFHVV ḸⲴ䘄എൠ൰˄⭘৲ᮠ QRQH 㺘⽪˅˗ޕ 㹼䈳⭘ V\VBFDOOBWDEOH ѝ V\VBIRUN ࠭ᮠᰦ঻ Ĺㅜ ḸⲴ⇥ᇴᆈಘ GVǃHVǃIV ઼ HG[ǃHF[ǃHE[˗ޕV\VWHPBFDOO ᰦ঻ ޕĸㅜ  㹼൘ࡊ䘋 Ⲵ⭘ᡧḸൠ൰ VV ઼ HVSǃḷᘇᇴᆈಘ HIODJV ઼䘄എൠ൰ FV ઼ HLS˗ޕķ&38 ᢗ㹼ѝᯝᤷԔ঻ ᮠ˅वᤜ৲˄ḸⲴ٬ޕ਴ᇴᆈಘⲴ٬DŽ䘉Ӌ൘ V\VWHPBFDOOV 〻ᒿѝ䙀↕঻ ḸⲴޕ䗷〻˄V\VWHPBFDOOV ㅜ  㹼˅઼䈳⭘ᵜ࠭ᮠࡽᰦ˄V\VWHPBFDOOV ㅜ  㹼˅䙀↕঻ ㌫㔏䈳⭘ѝᯝ༴⨶䗷〻˄V\VWHPBFDOOV˅ᔰ࿻ˈⴤࡠ䈳⭘ᵜ㌫㔏䈳⭘༴⨶ޕ䈕࠭ᮠⲴ৲ᮠᱟ䘋 ༽ࡦ䘋〻DŽ   ᒦф䇮㖞ᗵ㾱ⲴᇴᆈಘDŽᆳ䘈ᮤњൠ༽ࡦᮠᦞ⇥DŽ   WDVN>Q@ 2.ˈл䶒ᱟѫ㾱Ⲵ IRUN ᆀ〻ᒿDŽᆳ༽ࡦ㌫㔏䘋〻ؑ᚟      VHQWLUHW\ DOVRFRSLHVWKHGDWDVHJPHQWLQLW  WDVN>QU@ DQGVHWVXSWKHQHFHVVDU\UHJLVWHUV,W LQIRUPDWLRQ  2NWKLVLVWKHPDLQIRUNURXWLQH,WFRSLHVWKHV\VWHPSURFHVV     ` UHWXUQ ` UHWXUQ(120(0  QHZBGDWDBEDVHGDWDBOLPLW IUHHBSDJHBWDEOHV ROGBGDWDBEDVHQHZBGDWDBEDVHGDWDBOLPLW ^ FRS\BSDJHBWDEOHV LI  S!OGW>@QHZBGDWDBEDVH VHWBEDVH  S!OGW>@QHZBFRGHBEDVH VHWBEDVH S!VWDUWBFRGH QHZBFRGHBEDVH [ QHZBGDWDBEDVH QHZBFRGHBEDVH QU  䘄എ ˈ੖ࡉ㺘⽪ࠪ䭉ˈࡉ䟺᭮ࡊ⭣䈧Ⲵ亥㺘亩DŽ ↓ᑨᛵߥл FRS\BSDJHBWDEOHV ӛ⡦䘋〻Ⲵ޵ᆈ亥䶒DŽޡণ༽ࡦᖃࡽ䘋〻˄⡦䘋〻˅Ⲵ亥ⴞᖅ㺘亩઼亥㺘亩DŽ↔ᰦᆀ䘋〻 䇮㖞ᯠ䘋〻ተ䜘᧿䘠ㅖ㺘ѝ⇥᧿䘠ㅖѝⲴสൠ൰DŽ᧕⵰䇮㖞ᯠ䘋〻Ⲵ亥ⴞᖅ㺘亩઼亥㺘亩ˈ ަԫ࣑ਧ˅ˈᒦ⭘䈕٬ ❦ਾ䇮㖞ࡋᔪѝⲴᯠ䘋〻൘㓯ᙗൠ൰オ䰤ѝⲴสൠ൰ㅹҾ˄0%  %DGGDWDBOLPLW SDQLF  FRGHBOLPLWGDWDBOLPLW LI  ' WVXSSRUWVHSDUDWH, :HGRQ SDQLF  ROGBGDWDBEDVH ROGBFRGHBEDVH LI  FXUUHQW!OGW>@ ROGBGDWDBEDVH JHWBEDVH  FXUUHQW!OGW>@ ROGBFRGHBEDVH JHWBEDVH  [ GDWDBOLPLW JHWBOLPLW  [I FRGHBOLPLW JHWBOLPLW  ᇊѹ൘ LQFOXGHOLQX[VFKHGK ㅜ  㹼༴DŽ ઼ JHWBEDVH JHWBOLPLW 䘀㹼DŽ→ڌỰḕԓ⸱⇥઼ᮠᦞ⇥ส൰઼䲀䮯ᱟ੖䜭࠶࡛⴨਼DŽ੖ࡉ޵Ṩᱮ⽪ࠪ䭉ؑ᚟ˈᒦ オ䰤ѝⲴสൠ൰DŽ⭡Ҿ /LQX[ ޵Ṩ䘈н᭟ᤱԓ⸱઼ᮠᦞ⇥࠶・Ⲵᛵߥˈഐ↔䘉䟼䴰㾱 [I ᱟԓ⸱⇥䘹ᤙㅖ˗[ ᱟᮠᦞ⇥䘹ᤙㅖDŽ❦ਾਆᖃࡽ䘋〻ԓ⸱⇥઼ᮠᦞ⇥൘㓯ᙗൠ൰ 俆ݸਆᖃࡽ䘋〻ተ䜘᧿䘠ㅖ㺘ѝԓ⸱⇥᧿䘠ㅖ઼ᮠᦞ⇥᧿䘠ㅖ亩ѝⲴ⇥䲀䮯˄ᆇ㢲ᮠ˅DŽ  XQVLJQHGORQJROGBFRGHBEDVHQHZBFRGHBEDVHFRGHBOLPLW XQVLJQHGORQJROGBGDWDBEDVHQHZBGDWDBEDVHGDWDBOLPLW ^  S LQWQUVWUXFWWDVNBVWUXFW LQWFRS\BPHP   IRUNF 〻ᒿ [IIII S!WVVFV FV ⇥ᇴᆈಘӵ  սᴹ᭸DŽ[IIII S!WVVHV HV S!WVVHGL HGL S!WVVHVL HVL S!WVVHES HES S!WVVHVS HVS S!WVVHE[ HE[ S!WVVHG[ HG[ S!WVVHF[ HF[  䘄എᰦᯠ䘋〻Պ䘄എ  Ⲵ৏ഐᡰ൘DŽ 䘉ᱟᖃ IRUN S!WVVHD[ ḷᘇᇴᆈಘDŽS!WVVHIODJV HIODJV ᤷԔԓ⸱ᤷ䪸DŽS!WVVHLS HLS ޵ṨᘱḸⲴ⇥䘹ᤙㅖ˄о޵Ṩᮠᦞ⇥⴨਼˅DŽS!WVVVV [ ԫ࣑޵ṨᘱḸᤷ䪸DŽORQJ S S!WVVHVS 3$*(B6,=(  S!WVVEDFNBOLQN ࠷ᦒԫ࣑ᰦˈՊ㠚ࣘӾ 766 ѝᢺ /'7 ⇥᧿䘠ㅖⲴ䘹ᤙㅖ࣐䖭ࡠ OGWU ᇴᆈಘѝDŽ ᆈ൘ᵜԫ࣑Ⲵ 766 ⇥ѝDŽᖃ &38 ᢗ㹼؍䈝ਕቡᱟᢺ *'7 ѝᵜԫ࣑ /'7 ⇥᧿䘠ㅖⲴ䘹ᤙㅖ ⇥᧿䘠ㅖˈањᱟԫ࣑Ⲵ 766 ⇥᧿䘠ㅖˈਖањᱟԫ࣑Ⲵ /'7 㺘⇥᧿䘠ㅖDŽл䶒  㹼 ൘޵Ṩᘱᢗ㹼ᰦⲴḸDŽਖཆˈ൘ㅜ  ㄐѝᡁԜᐢ㓿⸕䚃ˈ⇿њԫ࣑൘*'7 㺘ѝ䜭ᴹєњ HVS⭘֌〻ᒿORQJ S 䇙 HVS ↓ྭᤷੁ䈕亥亦ㄟDŽVV 3$*(B6,=( ޵ᆈˈᡰԕ ޽؞᭩ԫ࣑⣦ᘱ⇥ 766ᮠᦞ˄৲㿱ࡇ㺘ਾ䈤᰾˅DŽ⭡Ҿ㌫㔏㔉ԫ࣑㔃ᶴS ࠶䝽Ҷ  亥ᯠ 䘋〻ᔰ࿻䘀㹼ᰦ䰤˄ᖃࡽᰦ䰤┤ㆄᮠ˅DŽS!VWDUWBWLPH MLIILHV ᆀ䘋〻⭘ᡧᘱ઼Ṩᗳᘱ䘀㹼ᰦ䰤DŽ S!FXWLPH S!FVWLPH ⭘ᡧᘱᰦ䰤઼Ṩᗳᘱ䘀㹼ᰦ䰤DŽ S!XWLPH S!VWLPH  䘋〻Ⲵ亶ሬᵳᱟн㜭㔗᢯Ⲵ   WLQKHULW SURFHVVOHDGHUVKLSGRHVQ  S!OHDGHU ㆄᮠ˅DŽ┤˄ᣕ䆖ᇊᰦ٬ S!DODUP ؑਧսമ㖞 DŽ S!VLJQDO ٬DŽ⡷䘀㹼ᰦ䰤S!FRXQWHU S!SULRULW\ 䇮㖞⡦䘋〻ਧDŽS!IDWKHU FXUUHQW!SLG  ᗇࡠDŽ ᯠ䘋〻ਧDŽҏ⭡ ILQGBHPSW\BSURFHVVS!SLG ODVWBSLG S!VWDWH 7$6.B81,17(55837,%/( 䘈䇮㖞䘋〻ᔰ࿻䘀㹼Ⲵ㌫㔏ᰦ䰤 VWDUWBWLPHDŽˈ䘋〻൘޵Ṩ઼⭘ᡧᘱ䘀㹼ᰦ䰤㔏䇑٬ ༽սᯠ䘋〻Ⲵؑਧսമǃᣕ䆖ᇊᰦ٬ǃՊ䈍˄VHVVLRQ˅亶ሬḷᘇOHDGHUǃ䘋〻৺ަᆀ а㡜Ѫ  њరం˅DŽ᧕⵰˄٬ \٬ㅹҾަSULRULW⡷ਧ IDWKHUˈᒦࡍ࿻ॆ䘋〻䘀㹼ᰦ䰤 㖞Ѫнਟѝᯝㅹᖵ⣦ᘱˈԕ䱢→޵Ṩ䈳ᓖަᢗ㹼DŽ❦ਾ䇮㖞ᯠ䘋〻Ⲵ䘋〻ਧ SLG ઼⡦䘋〻 䲿ਾሩ༽ࡦᶕⲴ䘋〻㔃ᶴ޵ᇩ䘋㹼аӋ؞᭩ˈ֌Ѫᯠ䘋〻Ⲵԫ࣑㔃ᶴDŽݸሶᯠ䘋〻Ⲵ⣦ᘱ  нՊ༽ࡦ䎵㓗⭘ᡧึḸ˄ਚ༽ࡦ䘋〻㔃ᶴ˅ڊ⌘᜿ʽ䘉ṧ   WFRS\WKHVXSHUYLVRUVWDFN 127(WKLVGRHVQ FXUUHQW  S  WDVN>QU@ S UHWXUQ($*$,1  S LI  JHWBIUHHBSDJH VWUXFWWDVNBVWUXFW  S ᧕⵰ᢺᖃࡽ䘋〻ԫ࣑㔃ᶴ޵ᇩ༽ࡦࡠࡊ⭣䈧ࡠⲴ޵ᆈ亥䶒 S ᔰ࿻༴DŽ  䘄എDŽ ԫ࣑ᮠ㓴Ⲵ QU 亩ѝDŽަѝ QU Ѫԫ࣑ਧˈ⭡ࡽ䶒 ILQGBHPSW\BSURFHVVޕ㔃ᶴᤷ䪸᭮ 俆ݸѪᯠԫ࣑ᮠᦞ㔃ᶴ࠶䝽޵ᆈDŽྲ᷌޵ᆈ࠶䝽ࠪ䭉ˈࡉ䘄എࠪ䭉⸱ᒦ䘰ࠪDŽ❦ਾሶᯠԫ࣑  I VWUXFWILOH LQWL S VWUXFWWDVNBVWUXFW ^  ORQJHLSORQJFVORQJHIODJVORQJHVSORQJVV ORQJIVORQJHVORQJGV   IRUNF 〻ᒿ  LQWL ^  YRLG LQWILQGBHPSW\BSURFHVV ᮠ㓴亩 DŽ Ѫᯠ䘋〻ਆᗇн䟽༽Ⲵ䘋〻ਧ ODVWBSLGDŽ࠭ᮠ䘄എ൘ԫ࣑ᮠ㓴ѝⲴԫ࣑ਧ  ` UHWXUQODVWBSLG  ᴰਾ᡽ሶᯠԫ࣑㖞ᡀቡ㔚ᘱˈԕ䱢за   GRWKLVODVWMXVWLQFDVH S!VWDWH 7$6.B5811,1*  S!OGW  ),567B/'7B(175<QU JGW VHWBOGWBGHVF  S!WVV  ),567B766B(175<QU JGW VHWBWVVBGHVF ᴰਾ䘄എᯠ䘋〻ਧDŽ 〻ᒿ❦ਾᢺᯠ䘋〻䇮㖞ᡀቡ㔚ᘱDŽਖཆ൘ԫ࣑࠷ᦒᰦˈԫ࣑ᇴᆈಘ WU ⭡ &38 㠚࣐ࣘ䖭DŽ DŽ QU 㺘ѝⲴൠ൰DŽഐѪ⇿њԫ࣑ঐ⭘ *'7 㺘ѝ  亩ˈഐ↔кᔿѝ㾱वᤜ ተޘ ),567B766B(175<āᱟԫ࣑ QU Ⲵ 766 ᧿䘠ㅖ亩൘QU ü㹼ԓ⸱DŽĀJGW  Ⲵᇊѹ৲㿱LQFOXGHDVPV\VWHPK᮷Ԧ ઼ VHWBOGWBGHVF ᆇ㢲DŽVHWBWVVBGHVF  䲿ਾ൘ *'7 㺘ѝ䇮㖞ᯠԫ࣑ 766 ⇥઼ /'7 ⇥᧿䘠ㅖ亩DŽ䘉єњ⇥Ⲵ䲀䮯൷㻛䇮㖞ᡀ FXUUHQW!H[HFXWDEOH!LBFRXQW  FXUUHQW!H[HFXWDEOH LI FXUUHQW!URRW!LBFRXQW  FXUUHQW!URRW LI FXUUHQW!SZG!LBFRXQW  FXUUHQW!SZG LI I!IBFRXQW  I S!ILOS>L@ LI  L15B23(1L L IRU ᕅ⭘⅑ᮠ൷໎ DŽок䶒਼ṧⲴ䚃⨶ˈᆀ䘋〻ҏᕅ⭘Ҷ䘉Ӌ L 㢲⛩DŽ ӛ䘉ӋᢃᔰⲴ᮷ԦDŽሶᖃࡽ䘋〻˄⡦䘋〻˅Ⲵ SZGURRW ઼ H[HFXWDEOHޡՊо⡦䘋〻 ྲ᷌⡦䘋〻ѝᴹ᮷ԦᱟᢃᔰⲴˈࡉሶሩᓄ᮷ԦⲴᢃᔰ⅑ᮠ໎ DŽഐѪ䘉䟼ࡋᔪⲴᆀ䘋〻 ` UHWXUQ($*$,1  ORQJ S IUHHBSDJH WDVN>QU@ 18// QUS ^䘄എнѪ  㺘⽪ࠪ䭉DŽ FRS\BPHP LI 䈕ᯠԫ࣑࠶䝽Ⲵ⭘Ҿԫ࣑㔃ᶴⲴ޵ᆈ亥DŽ ઼䲀䮯ˈᒦ༽ࡦ亥㺘DŽྲ᷌ࠪ䭉˄䘄എ٬нᱟ ˅ˈࡉ༽սԫ࣑ᮠ㓴ѝ⴨ᓄ亩ᒦ䟺᭮Ѫ ᧕лᶕ༽ࡦ䘋〻亥㺘DŽণ൘㓯ᙗൠ൰オ䰤ѝ䇮㖞ᯠԫ࣑ԓ⸱⇥઼ᮠᦞ⇥᧿䘠ㅖѝⲴส൰  S!WVVL PIQVDYHFOWV BBDVPBB  ODVWBWDVNBXVHGBPDWK FXUUHQW LI ᆈࡠⴞⲴ᫽֌ᮠᤷᇊⲴ޵ᆈ४ฏѝ˄WVVL˅DŽ؍Ⲵᡰᴹ⣦ᘱ ᆈॿ༴⨶ಘⲴ޵ᇩᒦ༽ս 76 ḷᘇDŽᤷԔ IQVDYH ⭘Ҿᢺॿ༴⨶ಘ؍䎧ᶕDŽᦅ㧧༴⨶ਕᷴՊ ᆈ؍њ (6& ᤷԔᔰ࿻ᢗ㹼ѻਾˈࡉॿ༴⨶ಘѝⲴ޵ᇩቡਟ㜭䴰㾱൘ᢗ㹼ᯠⲴ (6& ᤷԔѻࡽ ಘᆈ൘ḷᘇ 03 ҏ਼ᰦ㖞սⲴ䈍ˈ䛓Ѹ :$,7 ᤷԔҏՊᦅ㧧DŽഐ↔ˈྲ᷌ԫ࣑࠷ᦒਁ⭏൘а ᮠᆖॿ༴⨶ಘ˖ྲ᷌䈕ḷᘇ㖞սˈ䛓Ѹ⇿њ (6& ᤷԔ䜭Պ㻛ᦅ㧧˄ᔲᑨ ˅DŽྲ᷌ॿ༴⨶ ѝⲴԫ࣑ᐢӔᦒ˄76˅ḷᘇDŽ⇿ᖃਁ⭏ԫ࣑࠷ᦒˈ&38 䜭Պ䇮㖞䈕ḷᘇDŽ䈕ḷᘇ⭘Ҿ㇑⨶ ᆈަкл᮷DŽ≷㕆ᤷԔ FOWV ⭘Ҿ␵䲔᧗ࡦᇴᆈಘ &5؍ྲ᷌ᖃࡽԫ࣑֯⭘Ҷॿ༴⨶ಘˈቡ ˄儈  սᴹ᭸˅DŽS!WVVWUDFHBELWPDS [ ԫ࣑ተ䜘㺘᧿䘠ㅖⲴ䘹ᤙㅖ˄/'7 ᧿䘠ㅖ൘ *'7 ѝ˅DŽ QU S!WVVOGW B/'7 [IIII S!WVVJV JV [IIII S!WVVIV IV [IIII S!WVVGV GV [IIII S!WVVVV VV   IRUNF 〻ᒿ ᶴ task_struct ѝDŽሩᆳⲴ䈤᰾䈧৲ㅜ 4 ㄐDŽ ᆈ൘ԫ࣑ᮠᦞ㔃؍л䶒മ 8-14 ᱟԫ࣑⣦ᘱ⇥ TSS˄Task State Segment˅Ⲵ޵ᇩDŽ⇿њԫ࣑Ⲵ TSS 㻛 8.10.3.1 Աࣗ⣬ᘷ⇫δTSSεؗᚥ 8.10.3 ެԌؗᚥ    ` UHWXUQ($*$,1 UHWXUQL  WDVN>L@ LI L ԫ࣑  亩㻛ᧂ䲔൘ཆDŽ15B7$6.6L L IRU WDVN>L@!SLG ODVWBSLG JRWRUHSHDW WDVN>L@ LI  L15B7$6.6L L IRU   ODVWBSLG ODVWBSLG LI UHSHDW 䜘ঐ⭘ˈࡉ䘄എࠪ䭉⸱DŽ ޘተਈ䟿ˈн⭘䘄എDŽྲ᷌↔ᰦԫ࣑ᮠ㓴ѝ  њ亩ᐢ㓿㻛ޘ䘄എ亩ਧDŽODVWBSLG ᱟањ 䐣䖜ࡠ࠭ᮠᔰ࿻༴䟽ᯠ㧧ᗇањ SLG ਧDŽ᧕⵰൘ԫ࣑ᮠ㓴ѝѪᯠԫ࣑ራ᢮ањオ䰢亩ˈᒦ ֯⭘ SLG ਧDŽ❦ਾ൘ԫ࣑ᮠ㓴ѝᩌ㍒ࡊ䇮㖞Ⲵ SLG ਧᱟ੖ᐢ㓿㻛ԫօԫ࣑֯⭘DŽྲ᷌ᱟࡉ 俆ݸ㧧ਆᯠⲴ䘋〻ਧDŽྲ᷌ ODVWBSLG ໎  ਾ䎵ࠪ䘋〻ਧⲴ↓ᮠ㺘⽪㤳തˈࡉ䟽ᯠӾ  ᔰ࿻   IRUNF 〻ᒿ ⮉սˈ䇮㖞Ѫ DŽ؍  ࡽаԫ࣑䬮᧕ (63 66 (63 66 (63 66  3'%5 &5 (,3 ()/$*6 ($; (&; ('; (%; (63 (%3 (6, (', (6 &6 66 '6 )6 *6 /'7 ⇥䘹ᤙㅖ սമสൠ൰ 7 2,     ] ] ] &] ] ] ] &] ] ] ] &] ] ] ] &] ] ] ] &] ] ] ] &] ] ] ٿ I/O ∄⢩սമѝⲴ⇿ 1 ∄⢩ሩᓄ 1 њ I/O ㄟਓDŽ∄ྲㄟਓ 41 Ⲵ∄⢩սቡᱟ I/O սമสൠ൰+5ˈս ᇴᆈಘѝⲴ䘹ᤙㅖ˄ԫ࣑ᇴᆈಘⲴਟ㿱䜘࠶˅DŽ ⲴDŽᖃࡽ↓൘ᢗ㹼ԫ࣑Ⲵ TSS ᱟ⭡ԫ࣑ᇴᆈಘ˄TR˅ᶕᤷ⽪ⲴDŽᤷԔ LTR ઼ STR ⭘ᶕ؞᭩઼䈫ਆԫ࣑ ԫ࣑⣦ᘱ⇥ਟԕᆈ᭮൘㓯ᖒオ䰤ⲴԫօൠᯩDŽоަԆ਴㊫⇥⴨լˈԫ࣑⣦ᘱ⇥ҏᱟ⭡᧿䘠ㅖᶕᇊѹ ㅖѝ䈤᰾˅DŽ ᔲᑨⲴ T-∄⢩ս˄䈳䈅䐏䑚ս˅ǃI/O ∄⢩սമสൠ൰˄ަ䮯ᓖк䲀ቡᱟ TSS Ⲵ䮯ᓖк䲀ˈ൘ TSS ᧿䘠 ᖅสൠ൰Ⲵᇴᆈಘ˄PDBR˅ǃ⢩ᵳ㓗 0-2 ⲴึḸᤷ䪸ǃᖃԫ࣑䘋㹼࠷ᦒᰦሬ㠤 CPU ӗ⭏ањ䈳䈅(debug) 2 ㊫ᆇ⇥ᱟ CPU Պ䈫ਆնнՊᴤ᭩Ⲵ䶉ᘱؑ᚟䳶DŽ䘉Ӌᆇ⇥ᴹ˖ԫ࣑Ⲵ LDT Ⲵ䘹ᤙㅖǃਜ਼ᴹԫ࣑亥ⴞ ḷᘇᇴᆈಘ˄EFLAGS˅ǃᤷԔᤷ䪸˄EIP˅ǃࡽањᢗ㹼ԫ࣑Ⲵ TSS Ⲵ䘹ᤙㅖ˄ӵᖃ䘄എᰦ᡽ᴤᯠ˅DŽㅜ ⭘ᇴᆈಘ˄EAXˈECXˈEDXˈEBXˈESPˈEBPˈESIˈEDI˅ǃ⇥ᇴᆈಘ˄ES, CS, SS, DS, FS, GS˅ǃ TSS ѝⲴᆇ⇥ਟԕ࠶Ѫє㊫˖ㅜ 1 ㊫Պ൘ CPU 䘋㹼ԫ࣑࠷ᦒᰦࣘᘱᴤᯠⲴؑ᚟䳶DŽ䘉Ӌᆇ⇥ᴹ˖䙊 മѝᱮ⽪ࠪᢗ㹼 80386 ԫ࣑Ⲵ TSS ṬᔿDŽ CPU ㇑⨶ԫ࣑䴰㾱Ⲵᡰᴹؑ᚟㻛ᆈۘҾањ⢩↺㊫රⲴ⇥ѝˈԫ࣑⣦ᘱ⇥(task state segment - TSS)DŽ  ഴ Աࣗ⣬ᘷ⇫ 766 ѣⲺؗᚥȾ    IRUNF 〻ᒿ ᆈ൘ suid ѝDŽ਼⨶ˈ᮷ԦⲴ set-group-ID ḷᘇҏᴹ؍䘉⿽ḷᘇⲴਇ䲀᮷Ԧˈ਼ᰦ䈕᮷ԦᇯѫⲴ⭘ᡧ ID 㻛 ḷᘇ㖞սᰦˈ䛓Ѹ䘋〻Ⲵᴹ᭸⭘ᡧ ID ቡՊ㻛䇮㖞ᡀ䈕᮷ԦᇯѫⲴ⭘ᡧ IDˈഐ↔䘋〻ቡਟԕ䇯䰞䇮㖞Ҷ 㜭䇯䰞䘋〻Ⲵᴹ᭸⭘ᡧǃᴹ᭸⭘ᡧ㓴㿴ᇊⲴ᮷ԦᡆަԆݱ䇨䇯䰞Ⲵ᮷ԦDŽնᱟྲ᷌ањ᮷ԦⲴ set-user-ID Ⲵ᮷ԦDŽᖃᢗ㹼ањ〻ᒿᰦˈ䘋〻Ⲵ euid 䙊ᑨቡᱟᇎ䱵⭘ᡧ IDˈegid 䙊ᑨቡᱟᇎ䱵㓴 IDDŽഐ↔䘋〻ਚ ᆈⲴ㓴 ID˄sgid˅⭘Ҿ䘋〻䇯䰞䇮㖞Ҷ set-user-ID ᡆ set-group-ID ḷᘇ؍઼˅ᆈⲴ⭘ᡧ ID˄suid؍ 䘋〻䇯䰞᮷ԦᰦⲴ䇨ਟᵳࡔᯝDŽ ID˄rgid˅DŽ䎵㓗⭘ᡧਟԕ֯⭘࠭ᮠ set_uid()઼ set_gid()ሩᆳԜ䘋㹼؞᭩DŽᴹ᭸⭘ᡧ ID ઼ᴹ᭸㓴 ID ⭘Ҿ 䘋〻Ⲵ uid ઼ gid ࠶࡛ቡᱟ䘋〻ᤕᴹ㘵Ⲵ⭘ᡧ ID ઼㓴 IDˈҏণ䘋〻Ⲵᇎ䱵⭘ᡧ ID˄ruid˅઼ᇎ䱵㓴 gidDŽ੖ࡉ sgid ㅹҾ䘋〻Ⲵ egidDŽ ᆈ⵰ᢗ㹼᮷ԦⲴ؍˄set-group-ID˅㖞սᰦˈsgid ѝ ᆈⲴ㓴 IDDŽᖃᢗ㹼᮷ԦⲴ䇮㖞㓴 ID ḷᘇ؍ - sgid ᢗ㹼᮷ԦⲴ uidDŽ੖ࡉ suid ㅹҾ䘋〻Ⲵ euidDŽ ᆈ⵰؍ID ḷᘇ˄set-user-ID˅㖞սᰦˈsuid ѝ ᆈⲴ⭘ᡧ IDDŽᖃᢗ㹼᮷ԦⲴ䇮㖞⭘ᡧ؍ - suid ᆈⲴ؍ ᴹ᭸Ⲵ euid - ᴹ᭸⭘ᡧ IDDŽᤷ᰾䇯䰞᮷ԦⲴᵳ䲀DŽ egid - ᴹ᭸㓴 IDDŽᤷ᰾䇯䰞᮷ԦⲴᵳ䲀DŽ 䘋〻Ⲵ uid - ⭘ᡧ IDDŽᤷ᰾ᤕᴹ䈕䘋〻Ⲵ⭘ᡧDŽ gid - 㓴 IDDŽᤷ᰾ᤕᴹ䈕䘋〻Ⲵ⭘ᡧ㓴DŽ ㊫࡛ ⭘ᡧ ID 㓴 ID 㺞 ̢ф䘑ぁ⴮ީⲺ⭞ᡭ ,' ૂ㓺 ,' ᆈҶ 3 ⿽⭘ᡧ ID ઼㓴 IDDŽ㿱㺘 8–5 ᡰ⽪DŽ؍ањ䘋〻Ⲵԫ࣑ᮠᦞ㔃ᶴѝˈѪҶᇎ⧠н਼࣏㜭㘼 ઼㓴 IDˈᆳԜᤷ᰾Ҷ᮷Ԧᤕᴹ㘵઼ᡰ኎⭘ᡧ㓴DŽѫ㾱⭘Ҿ䇯䰞ᡆᢗ㹼᮷ԦᰦⲴᵳ䲀ࡔ࡛᫽֌DŽਖཆˈ൘ ᆈ⵰ᇯѫⲴ⭘ᡧ ID؍ᑨ㻛〠Ѫᇎ䱵⭘ᡧ ID˄ruid˅઼ᇎ䱵㓴 ID˄rgid˅DŽ㘼൘⇿њ᮷ԦⲴ i 㢲⛩ؑ᚟ѝ䜭 ањ⭘ᡧᴹ⭘ᡧ ID˄uid˅઼⭘ᡧ㓴 ID˄gid˅DŽ䘉єњ ID ᱟ passwd ᮷Ԧѝሩ䈕⭘ᡧ䇮㖞Ⲵ IDˈ䙊 аㆰ㾱䈤᰾DŽ ᇎ䱵⭘ᡧ ID˄ruid˅ǃᴹ᭸⭘ᡧ ID˄euid˅ԕ৺Պ䈍 ID˄session˅ㅹⲴ᫽֌࠭ᮠDŽл䶒俆ݸሩ䘉Ӌ ID ֌ 䘋〻 ID˄pid˅ǃ䘋〻㓴 ID˄pgrp ᡆ pgid˅ǃ⭘ᡧ ID˄uid˅ǃ⭘ᡧ㓴 ID˄gid˅ǃޣ䈕〻ᒿѝਜ਼ᴹᖸཊᴹ ᮷Ԧ include/linux/sys.hDŽ ޵Ṩ䘈⋑ᴹᇎ⧠䈕࣏㜭ˈਟԕ৲㘳ⴞࡽⲴԓ⸱ᶕҶ䀓ᆳԜⲴᇎ⧠ᯩ⌅DŽᡰᴹ㌫㔏䈳⭘࣏㜭䈤᰾䈧৲㿱ཤ ENOSYSˈࡉ㺘⽪ᵜ⡸ Linux- sys.c 〻ᒿਜ਼ᴹᖸཊ㌫㔏䈳⭘࣏㜭Ⲵᇎ⧠࠭ᮠDŽަѝˈ࠭ᮠ㤕ӵᴹ䘄എ٬ 8.11.1 ࣕ㜳ᨅ䘦 8.11 sys.c ぁᓅ Ḹᤷ䪸ࡍ࿻ս㖞нਈˈ൷Ѫԫ࣑ᮠᦞ㔃ᶴᡰ൘亥䶒Ⲵ亦ㄟս㖞༴DŽ ޵Ṩᘱᢗ㹼ᰦˈަ޵Ṩᘱึޕᆈ൘ SS:ESP ᇴᆈಘѝDŽ⭡кᡰ䘠ਟ⸕ˈ⇿ᖃԫ࣑䘋؍ᡧᘱᰦึḸᤷ䪸ࡉ ࠶࡛ሩᓄ䘀㹼Ҿ⢩ᵳ㓗 1 ઼ 2 ᰦ֯⭘ⲴึḸᤷ䪸ˈ䘉єњ⢩ᵳ㓗൘ Linux ѝ⋑ᴹ֯⭘DŽ㘼ԫ࣑ᐕ֌Ҿ⭘ ൘ Linux 0.11 ѝˈമѝ SS0:ESP0 ⭘Ҿᆈ᭮ԫ࣑൘޵Ṩᘱ䘀㹼ᰦⲴึḸᤷ䪸DŽSS1:ESP1 ઼ SS2:ESP2 սമส൰䇮㖞ᡀҶ 0x8000ˈᱮ❦བྷҾ TSS ⇥䲀䮯 104 ᆇ㢲ˈഐ↔ Linux 0.11 ޵Ṩѝ⋑ᴹ I/O 䇨ਟսമDŽ ᣔDŽ൘唈䇔ᛵߥлˈLinux 0.11 ޵Ṩѝᢺ I/O؍ᡰᴹᖃࡽ⢩ᵳቲ CPL>IOPL Ⲵ I/O ᤷԔ൷Պሬ㠤ਁ⭏ᔲᑨ ྲ᷌ I/O սമส൰㻛䇮㖞ᡀབྷҾᡆㅹҾ TSS ⇥䲀䮯ˈࡉ㺘⽪䈕 TSS ⇥⋑ᴹ I/O 䇨ਟսമˈ䛓ѸሩҾ I/O ᫽֌DŽ ᣔᙗᔲᑨˈ੖ࡉቡՊᢗ㹼䈕؍ՊỰḕ TSS ѝⲴ I/O ∄⢩սമDŽྲ᷌⴨ᓄ∄⢩սᱟ㖞սⲴˈቡՊӗ⭏а㡜 ᵳ㓗ᱟ੖ሿҾḷᘇᇴᆈಘⲴ IOPLˈྲ᷌䘉њᶑԦ┑䏣ˈቡᢗ㹼䈕 I/O ᫽֌DŽྲ᷌н┑䏣ˈ䛓Ѹ CPU ቡ ᣔ⁑ᔿѝˈᖃ䙷ࡠ 1 њ I/O ᤷԔᰦ˄INǃINSǃOUT ઼ OUTS˅ˈCPU 俆ݸቡՊỰḕᖃࡽ⢩؍〫 1 ༴DŽ൘   V\VF 〻ᒿ  ` UHWXUQ(126<6 ^  LQWV\VBVWW\ ᭩ਈᒦᢃঠ㓸ㄟ㹼䇮㖞DŽ  ` UHWXUQ(126<6 ^  LQWV\VBSWUDFH GHEXJJLQJ DŽ ⭘Ҿᖃࡽ䘋〻ሩᆀ䘋〻䘋㹼䈳䈅  ` UHWXUQ(126<6 ^  LQWV\VBEUHDN   ` UHWXUQ(126<6 ^  IWLPH̢)HWFKWLPH LQWV\VBIWLPH 䘄എᰕᵏ઼ᰦ䰤DŽԕл䘄എ٬ᱟ(126<6 Ⲵ㌫㔏䈳⭘࠭ᮠ൷㺘⽪൘ᵜ⡸ᵜ޵Ṩѝ䘈ᵚᇎ⧠DŽ  V\VXWVQDPHK!㌫㔏਽〠㔃ᶴཤ᮷ԦDŽLQFOXGH  ࠭ᮠ৏රDŽ V\VWLPHVK!ᇊѹҶ䘋〻ѝ䘀㹼ᰦ䰤Ⲵ㔃ᶴ WPV ԕ৺ WLPHVLQFOXGH ᔿ≷㕆࠭ᮠDŽޕᇴᆈಘ᫽֌Ⲵ፼⇥ޣDVPVHJPHQWK!⇥᫽֌ཤ᮷ԦDŽᇊѹҶᴹLQFOXGH OLQX[NHUQHOK!޵Ṩཤ᮷ԦDŽਜ਼ᴹаӋ޵Ṩᑨ⭘࠭ᮠⲴ৏ᖒᇊѹDŽLQFOXGH WW\BLRˈѢ㹼䙊ؑᯩ䶒Ⲵ৲ᮠǃᑨᮠDŽ ޣOLQX[WW\K!WW\ ཤ᮷ԦˈᇊѹҶᴹLQFOXGH ᔿ≷㕆࠭ᮠᆿ䈝ਕDŽޕ䘠ㅖ৲ᮠ䇮㖞઼㧧ਆⲴ፼᧿ޣ䘈ᴹаӋᴹ OLQX[VFKHGK!䈳ᓖ〻ᒿཤ᮷ԦˈᇊѹҶԫ࣑㔃ᶴ WDVNBVWUXFWǃࡍ࿻ԫ࣑  ⲴᮠᦞˈLQFOXGH  /LQXV Ӿ PLQL[ ѝᕅ䘋Ⲵ DŽ HUUQRK!䭉䈟ਧཤ᮷ԦDŽवਜ਼㌫㔏ѝ਴⿽ࠪ䭉ਧDŽLQFOXGH    /LQXV7RUYDOGV &     OLQX[NHUQHOV\VF     ぁᓅ 8-10 linux/kernel/sys.c ぁᓅ 8.11.2 ԙ⸷⌞䠀 DŽޣ㌫ˈо⭘ᡧ ID ઼㓴 ID ᰐޣⲴՊ䈍 ID˄session˅DŽ䘉 3 њ ID ⭘Ҿ㺘᰾䘋〻о䘋〻ѻ䰤Ⲵ ਖཆˈ䘋〻ҏᴹḷ䇶㠚ᐡ኎ᙗⲴ䘋〻 ID˄pid˅ǃᡰ኎䘋〻㓴Ⲵ䘋〻㓴 ID˄pgrp ᡆ pgid˅઼ᡰ኎Պ䈍 䎵㓗⭘ᡧ᡽ᴹ߉ᵳ䲀ˈഐ↔ passwd 〻ᒿቡ䴰㾱֯⭘ set-user-ID ḷᘇDŽ etc/passwd ᮷Ԧѝˈ㘼䈕᮷Ԧਚᴹ/ޕഐ↔ݱ䇨⭘ᡧ؞᭩㠚ᐡⲴਓԔDŽഐѪ䈕〻ᒿ䴰㾱ᢺ⭘ᡧⲴᯠਓԔ߉ 㓗⭘ᡧⲴᵳ䲀DŽањᇎ䱵ֻᆀቡᱟ Linux ㌫㔏Ⲵ passwd ભԔDŽ䈕ભԔᱟањ䇮㖞Ҷ set-user-Id Ⲵ〻ᒿˈ 〻䘀㹼ᰦˈࡉ䈕䘋〻Ⲵᴹ᭸⭘ᡧ ID˄euid˅ቡՊ㻛䇮㖞ᡀ䎵㓗⭘ᡧⲴ ID˄0˅DŽҾᱟ䘉њ䘋〻ቡᤕᴹҶ䎵 ֻྲˈྲ᷌ањ〻ᒿⲴᇯѫᱟ䎵㓗⭘ᡧˈն䈕〻ᒿ䇮㖞Ҷ set-user-ID ḷᘇˈ䛓Ѹᖃ䈕〻ᒿ㻛ањ䘋 ㊫լⲴ֌⭘ᒦ֌⴨਼Ⲵ༴⨶DŽ   V\VF 〻ᒿ ^  LQWV\VBDFFW 䰝䘋〻䇑ᑀ࣏㜭DŽޣᢃᔰᡆ  `  JLGJLG V\VBVHWUHJLG UHWXUQ ^  LQWJLG LQWV\VBVHWJLG ⮉ JLG 䜭㻛䇮㖞ᡀ৲ᮠᤷᇊⲴ JLGDŽ؍઼ ᴹ䎵㓗⭘ᡧ⢩ᵳˈࡉᇎ䱵 JLGǃᴹ᭸ JLG UHDOJLG DŽྲ᷌ԫ࣑ VDYHGJLG ᡆަᇎ䱵 JLG ⮉ JLG؍˄HIIHFWLYHJLG˅䇮㖞Ѫᡀަ  ሶަᴹ᭸ JLG JLG DŽྲ᷌ԫ࣑⋑ᴹ䎵㓗⭘ᡧ⢩ᵳˈᆳਟԕ֯⭘VHWJLG 䇮㖞䘋〻㓴ਧ  ` UHWXUQ `  (3(50 UHWXUQ HOVH FXUUHQW!HJLG HJLG  VXVHU FXUUHQW!VJLG HJLG __  FXUUHQW!HJLG HJLG __  FXUUHQW!JLG HJLG __ LI HJLG! ^ LI `  (3(50 UHWXUQ HOVH FXUUHQW!JLG UJLG  VXVHU FXUUHQW!JLG UJLG __ LI UJLG! ^ LI ^  LQWUJLGLQWHJLG LQWV\VBVHWUHJLG ٬DŽ਼ ⮉Ⲵ JLG˄VDYHGJLG˅㻛䇮㖞ᡀоᴹ᭸ JLG؍,'DŽ ᦒަᇎ䱵㓴 ,'઼ᴹ᭸㓴,'DŽྲ᷌ԫ࣑ާᴹ䎵㓗⭘ᡧ⢩ᵳˈቡ㜭ԫ᜿䇮㖞ᴹ᭸Ⲵ઼ᇎ䱵Ⲵ㓴 䇮㖞ᖃࡽԫ࣑Ⲵᇎ䱵ԕ৺ᡆ㘵ᴹ᭸㓴 ,'˄JLG˅DŽྲ᷌ԫ࣑⋑ᴹ䎵㓗⭘ᡧ⢩ᵳˈ䛓Ѹਚ㜭ӂ  ` UHWXUQ(126<6 ^  LQWV\VBSURI   ` UHWXUQ(126<6 ^  LQWV\VBUHQDPH ؞᭩᮷Ԧ਽DŽ  ` UHWXUQ(126<6 ^  LQWV\VBJWW\ ਆ㓸ㄟ㹼䇮㖞ؑ᚟DŽ   V\VF 〻ᒿ  LQWUXLGLQWHXLG LQWV\VBVHWUHXLG ٬DŽ਼ ⮉Ⲵ XLG˄VDYHGXLG˅㻛䇮㖞ᡀоᴹ᭸ XLG؍䱵Ⲵ⭘ᡧ ,'DŽ ӂᦒަᇎ䱵Ⲵ XLG઼ᴹ᭸Ⲵ XLGDŽྲ᷌ԫ࣑ާᴹ䎵㓗⭘ᡧ⢩ᵳˈቡ㜭ԫ᜿䇮㖞ᴹ᭸Ⲵ઼ᇎ 䇮㖞ԫ࣑Ⲵᇎ䱵ԕ৺ᡆ㘵ᴹ᭸Ⲵ⭘ᡧ ,'˄XLG˅DŽྲ᷌ԫ࣑⋑ᴹ䎵㓗⭘ᡧ⢩ᵳˈ䛓Ѹਚ㜭   HIIHFWLYHXLG ˈ৽ѻҏ❦DŽ   UHDOXLG ᭩ᡀᴹ᭸Ⲵ⭘ᡧḷ䇶ㅖ ᰐ⢩ᵳⲴ⭘ᡧਟԕ㿱ᇎ䱵Ⲵ⭘ᡧḷ䇶ㅖ      RUYLFHYHUVD  8QSULYLOHJHGXVHUVPD\FKDQJHWKHUHDOXVHULGWRWKHHIIHFWLYHXLG     ` UHWXUQL ` ⭘ᡧᮠᦞ⇥ WORF ༴DŽޕҏ᭮ WORF XQVLJQHGORQJ L SXWBIVBORQJ 傼䇱޵ᆈᇩ䟿ᱟ੖ཏ˄䘉䟼ᱟ  ᆇ㢲˅DŽ WORF YHULI\BDUHD WORF ^ LI L &855(17B7,0(  LQWL ^  WORF ORQJ LQWV\VBWLPH ࠭ᮠቡਟ࡙⭘ IV ᶕ䇯䰞⭘ᡧオ䰤ѝⲴ٬DŽ ޵Ṩѝ䘀㹼ᰦˈ⇥ᇴᆈಘ IV 㻛唈䇔ൠᤷੁᖃࡽ⭘ᡧᮠᦞオ䰤DŽഐ↔䈕ޕ䇯䰞䈕٬DŽ൘䘋  ᶕ ⭡Ҿ৲ᮠᱟањᤷ䪸ˈ㘼ަᡰᤷս㖞൘⭘ᡧオ䰤ˈഐ↔䴰㾱֯⭘࠭ᮠSXWBIVBORQJ ࡉᰦ䰤٬ҏᆈۘ൘䛓䟼DŽ DŽྲ᷌ WORF нѪ QXOOˈ˅。˄*07ᔰ࿻䇑ᰦⲴᰦ䰤٬  ᒤ  ᴸ  ᰕ䘄എӾ  ` UHWXUQ(126<6 ^  LQWV\VBXOLPLW  ` UHWXUQ(126<6 ^  LQWV\VBPS[  ` UHWXUQ(126<6 ^  LQWV\VBORFN  ` UHWXUQ(126<6 ^  LQWV\VBSK\V ᱐ሴԫ᜿⢙⨶޵ᆈࡠ䘋〻Ⲵ㲊ᤏൠ൰オ䰤DŽ  ` UHWXUQ(126<6   V\VF 〻ᒿ  WEXI WEXIVL]HRI YHULI\BDUHD WEXI ^ LI ^  WEXI VWUXFWWPV LQWV\VBWLPHV 〻⭘ᡧ䘀㹼ᰦ䰤ǃᆀ䘋〻㌫㔏䘀㹼ᰦ䰤DŽ࠭ᮠ䘄എ٬ᱟ㌫㔏䘀㹼ࡠᖃࡽⲴరంᮠDŽ 㧧ਆᖃࡽԫ࣑䘀㹼ᰦ䰤㔏䇑٬DŽWPV 㔃ᶴѝवᤜ䘋〻⭘ᡧ䘀㹼ᰦ䰤ǃ޵Ṩ˄㌫㔏˅ᰦ䰤ǃᆀ䘋  ` UHWXUQ  WSWU MLIILHV+= XQVLJQHGORQJ VWDUWXSBWLPH JHWBIVBORQJ UHWXUQ(3(50  ྲ᷌нᱟ䎵㓗⭘ᡧࡉࠪ䭉䘄എ˄䇨ਟ˅DŽ VXVHU LI ^  WSWU ORQJ LQWV\VBVWLPH ٬DŽ。MLIILHV+=˅ণᱟᔰᵪᰦ䰤˄٬。࠭ᮠ৲ᮠᨀ׋Ⲵᖃࡽᰦ䰤٬߿৫㌫㔏ᐢ㓿䘀㹼Ⲵᰦ䰤 ⭘ IV ᶕ䇯䰞⭘ᡧオ䰤ѝⲴ٬DŽ ޵Ṩѝ䘀㹼ᰦˈ⇥ᇴᆈಘIV㻛唈䇔ൠᤷੁᖃࡽ⭘ᡧᮠᦞオ䰤DŽഐ↔䈕࠭ᮠቡਟ࡙ޕ٬DŽ൘䘋  ᶕ䇯䰞䈕 ⭡Ҿ৲ᮠᱟањᤷ䪸ˈ㘼ަᡰᤷս㖞൘⭘ᡧオ䰤ˈഐ↔䴰㾱֯⭘࠭ᮠ JHWBIVBORQJ 䈳⭘䘋〻ᗵ享ާᴹ䎵㓗⭘ᡧᵳ䲀DŽަѝ += ˈᱟ޵Ṩ㌫㔏䘀㹼仁⦷DŽ DŽ˅。˄*07 ᔰ࿻䇑ᰦⲴᰦ䰤٬  ᒤ  ᴸ  ᰕ 䇮㖞㌫㔏ᔰᵪᰦ䰤DŽ৲ᮠ WSWU ᱟӾ  `  XLGXLG V\VBVHWUHXLG UHWXUQ ^  LQWXLG LQWV\VBVHWXLG ᇊⲴ XLGDŽ ᆈⲴ XLG 䜭Պ㻛䇮㖞ᡀ৲ᮠᤷ؍઼ ྲ᷌ԫ࣑ᴹ䎵㓗⭘ᡧ⢩ᵳˈࡉᇎ䱵Ⲵ XLGǃᴹ᭸Ⲵ XLG ᆈⲴ XLG˄VDYHGXLG˅ᡆަᇎ䱵Ⲵ XLG˄UHDOXLG˅DŽ؍XLG˄HIIHFWLYHXLG˅䇮㖞ᡀަ  ሶަᴹ᭸Ⲵ 䇮㖞ԫ࣑⭘ᡧ ,'˄XLG˅DŽྲ᷌ԫ࣑⋑ᴹ䎵㓗⭘ᡧ⢩ᵳˈᆳਟԕ֯⭘ VHWXLG  ` UHWXUQ ` `  (3(50 UHWXUQ FXUUHQW!XLG ROGBUXLG HOVH^ FXUUHQW!HXLG HXLG  VXVHU FXUUHQW!HXLG HXLG __  ROGBUXLG HXLG __ LI HXLG! ^ LI `  (3(50 UHWXUQ HOVH FXUUHQW!XLG UXLG  VXVHU ROGBUXLG UXLG __  FXUUHQW!HXLG UXLG __ LI UXLG! ^ LI  LQWROGBUXLG FXUUHQW!XLG ^   V\VF 〻ᒿ  WDVN>L@!OHDGHU LI WDVN>L@!SLG SLG ^ WDVN>L@ LI  L15B7$6.6L L IRU ࠪ䭉⸱DŽ ੖ࡉ䇮㖞䘋〻Ⲵ SJUS SJLGˈᒦ䘄എ DŽ㤕⋑ᴹ᢮ࡠᤷᇊ SLG Ⲵ䘋〻ˈࡉ䘄എ䘋〻нᆈ൘ ԫ࣑ᐢ㓿ᱟՊ䈍俆亶ˈࡉࠪ䭉䘄എDŽ㤕䈕ԫ࣑ⲴՊ䈍 ,' оᖃࡽ䘋〻Ⲵн਼ˈࡉҏࠪ䭉䘄എDŽ ᢛ᧿ԫ࣑ᮠ㓴ˈḕ᢮ᤷᇊ䘋〻ਧ SLGⲴԫ࣑DŽྲ᷌᢮ࡠҶ䘋〻ਧᱟSLG Ⲵ䘋〻ˈ䛓Ѹ㤕䈕 SJLG FXUUHQW!SLG  SJLG LI SLG FXUUHQW!SLG  SLG LI DŽ@ޕ>""䘉䟼о 326,; ḷ߶Ⲵ᧿䘠ᴹࠪ ྲ᷌৲ᮠ SLG ˈࡉ֯⭘ᖃࡽ䘋〻ਧDŽྲ᷌ SJLG Ѫ ˈࡉ֯⭘ᖃࡽ䘋〻 SLG ֌Ѫ SJLGDŽ  LQWL ^  LQWSLGLQWSJLG LQWV\VBVHWSJLG  㹼 DŽ 〻Ⲵ⴨਼ 䘋ޕⲴ⧠ᴹ䘋〻㓴 ,'ˈ↔ᰦ䈕㓴ⲴՊ䈍 ,' ᗵ享оሶ㾱࣐ޕᛵߥлˈ৲ᮠ SJLGᤷᇊҶ㾱࣐ VHVVLRQ DŽ൘䘉⿽ Ӿањ䘋〻㓴〫ࡠਖањ䘋〻㓴ˈࡉ䘉єњ䘋〻㓴ᗵ享኎Ҿ਼ањՊ䈍 ᱟᤷᇊⲴ䘋〻㓴ਧDŽྲ᷌ᆳѪ ˈࡉ䇙ᆳㅹҾ䘋〻 SLG Ⲵ䘋〻㓴ਧDŽྲ᷌䈕࠭ᮠ⭘Ҿሶ䘋〻 ৲ᮠ SLGᱟᤷᇊ䘋〻Ⲵ䘋〻ਧDŽྲ᷌ᆳѪ ˈࡉ䇙 SLG ㅹҾᖃࡽ䘋〻Ⲵ䘋〻ਧDŽ৲ᮠ SJLG 䇮㖞ᤷᇊ䘋〻 SLG Ⲵ䘋〻㓴ਧѪ SJLGDŽ   ੗DŽڊ᰾ⲭ VHVVLRQVSJUS ㅹDŽ䘈ᱟ䇙Ҷ䀓ᆳԜⲴӪᶕޘ䘉ӋDŽᡁҏнᆼڊᡁਚᱟ⋑ᴹ㛳ਓᶕ  л䶒ԓ⸱䴰㾱ḀӋѕṬⲴỰḕĂ      XQGHUVWDQGVHVVLRQVSJUSHWF/HWVRPHERG\ZKRGRHVH[SODLQLW  WIXOO\ WJHWWKHVWRPDFKIRULW,DOVRGRQ ,MXVWKDYHQ  7KLVQHHGVVRPHKHDYHFKHFNLQJ     ` 䘄എ䘋〻ᖃࡽⲴᮠᦞ⇥㔃ቮ٬DŽUHWXUQFXUUHQW!EUN FXUUHQW!EUN HQGBGDWDBVHJ  FXUUHQW!VWDUWBVWDFNHQGBGDWDBVHJ  HQGBGDWDBVHJ! FXUUHQW!HQGBFRGH LI ྲ᷌৲ᮠ٬བྷҾԓ⸱㔃ቮˈᒦфሿҾ˄ึḸ.%˅ˈࡉ䇮㖞ᯠᮠᦞ⇥㔃ቮ٬DŽ ^  XQVLJQHGORQJHQGBGDWDBVHJ LQWV\VBEUN ਁ⭏˅DŽ䈕࠭ᮠᒦн㻛⭘ᡧⴤ᧕䈳⭘ˈ㘼⭡ OLEF ᓃ࠭ᮠ䘋㹼व㻵ˈᒦф䘄എ٬ҏнаṧDŽ ٬н਼ˈࡉ㺘᰾ᴹ䭉䈟≳᷌䘄എ٬о㾱ྲ˄ሿҾึḸ㔃ቮ .%DŽ䘄എ٬ᱟᮠᦞ⇥Ⲵᯠ㔃ቮ٬ ⇥བྷሿᰦˈ䈕࠭ᮠ䇮㖞ᮠᦞ⇥ᵛቮѪ HQGBGDWDBVHJ ᤷᇊⲴ٬DŽ䈕٬ᗵ享བྷҾԓ⸱㔃ቮᒦф㾱 ᖃ৲ᮠ HQGBGDWDBVHJ ᮠ٬ਸ⨶ˈᒦф㌫㔏⺞ᇎᴹ䏣ཏⲴ޵ᆈˈ㘼ф䘋〻⋑ᴹ䎵䎺ަᴰབྷᮠᦞ  ` UHWXUQMLIILHV `  WEXI!WPVBFVWLPH XQVLJQHGORQJ FXUUHQW!FVWLPH SXWBIVBORQJ  WEXI!WPVBFXWLPH XQVLJQHGORQJ FXUUHQW!FXWLPH SXWBIVBORQJ  WEXI!WPVBVWLPH XQVLJQHGORQJ FXUUHQW!VWLPH SXWBIVBORQJ  WEXI!WPVBXWLPH XQVLJQHGORQJ FXUUHQW!XWLPH SXWBIVBORQJ   V\VF 〻ᒿ LQWROG FXUUHQW!XPDVN ^  LQWPDVN LQWV\VBXPDVN DŽᒦ䘄എ৏ቿ㭭⸱DŽ 䇮㖞ᖃࡽ䘋〻ࡋᔪ᮷Ԧ኎ᙗቿ㭭⸱Ѫ PDVN  ` UHWXUQ  QDPH FKDU WKLVQDPH >L@L  FKDU SXWBIVBE\WH  LQDPH VL]HRIL L IRU  QDPH QDPHVL]HRI YHULI\BDUHD QDPH UHWXUQ(5525 LI 䎵䲀˄㤕䎵ࠪࡉ޵Ṩ㠚ࣘᢙኅ˅DŽ❦ਾሶ XWVQDPH ѝⲴؑ᚟䙀ᆇ㢲༽ࡦࡠ⭘ᡧ㕃ߢ४ѝDŽ 俆ݸࡔᯝ৲ᮠⲴᴹ᭸ᙗDŽྲ᷌ᆈ᭮ؑ᚟Ⲵ㕃ߢ४ᤷ䪸Ѫオࡉࠪ䭉䘄എDŽ൘傼䇱㕃ߢ४བྷሿᱟ੖  LQWL ` OLQX[QRGHQDPHUHOHDVHYHUVLRQPDFKLQH VWDWLFVWUXFWXWVQDPHWKLVQDPH ^䘉䟼㔉ࠪҶ㔃ᶴѝⲴؑ᚟ˈ䘉⿽㕆⸱㛟ᇊՊ᭩ਈDŽ ^  QDPH VWUXFWXWVQDPH LQWV\VBXQDPH 䈕㔃ᶴᇊѹ൘ LQFOXGHV\VXWVQDPHK ᮷ԦѝDŽ 㢲⛩਽〠˄ѫᵪ਽˅ǃᖃࡽ᫽֌㌫㔏ਁ㹼㓗࡛ǃ᫽֌㌫㔏⡸ᵜਧԕ৺㌫㔏䘀㹼Ⲵ⺜Ԧ㊫ර਽〠DŽ 㧧ਆ㌫㔏਽〠ㅹؑ᚟DŽަѝ XWVQDPH 㔃ᶴवਜ਼  њᆇ⇥ˈ࠶࡛ᱟ˖ᖃࡽ䘀㹼㌫㔏Ⲵ਽〠ǃ㖁㔌  ` UHWXUQFXUUHQW!SJUS 㺘⽪ᖃࡽ䘋〻⋑ᴹ᧗ࡦ㓸ㄟDŽ FXUUHQW!WW\ FXUUHQW!VHVVLRQ FXUUHQW!SJUS FXUUHQW!SLG  FXUUHQW!OHDGHU UHWXUQ(3(50  VXVHU FXUUHQW!OHDGHU LI 㘼ф䇮㖞ᖃࡽ䘋〻⋑ᴹ᧗ࡦ㓸ㄟDŽᴰਾ㌫㔏䈳⭘䘄എՊ䈍ਧDŽ 俆亶˄OHDGHU ˅ˈᒦф䇮㖞ᖃࡽ䘋〻Պ䈍ਧVHVVLRQ ઼㓴ਧ SJUS 䜭ㅹҾ䘋〻ਧ SLGˈ ྲ᷌ᖃࡽ䘋〻ᐢᱟՊ䈍俆亶ᒦфнᱟ䎵㓗⭘ᡧˈࡉࠪ䭉䘄എDŽ੖ࡉ䇮㖞ᖃࡽ䘋〻ѪᯠՊ䈍 ^  YRLG LQWV\VBVHWVLG VHWVLG6(76HVVLRQ,'DŽ VHVVLRQ ˄ণ䇮㖞ަ OHDGHU ˅ˈᒦф䇮㖞ަՊ䈍ਧ ަ㓴ਧ ަ䘋〻ਧDŽ ࡋᔪањՊ䈍  ` UHWXUQFXUUHQW!SJUS ^  YRLG LQWV\VBJHWSJUS  ㅹ਼DŽ 䘄എᖃࡽ䘋〻Ⲵ䘋〻㓴ਧDŽо JHWSJLG  ` UHWXUQ(65&+ ` UHWXUQ WDVN>L@!SJUS SJLG UHWXUQ(3(50  WDVN>L@!VHVVLRQ FXUUHQW!VHVVLRQ LI UHWXUQ(3(50   V\VF 〻ᒿ UHWXUQL     V  L L  V LVBGLJLW ZKLOH   LQWL ^  V FRQVWFKDU VWDWLFLQWVNLSBDWRL ᱟᮠᆇѢᤷ䪸Ⲵᤷ䪸ˈ䘄എᱟ㔃᷌ᮠ٬DŽਖཆᤷ䪸ሶࡽ〫DŽޕ䈕࠭ᮠሶᆇㅖᮠᆇѢ䖜ᦒᡀᮤᮠDŽ䗃   ࡔᯝᆇㅖ F ᱟ੖ѪᮠᆇᆇㅖDŽ    F     F !  F GHILQHLVBGLJLW  ᡁԜ֯⭘л䶒Ⲵᇊѹˈ䘉ṧᡁԜቡਟԕн֯⭘ FW\SH ᓃҶ   ZHXVHWKLVVRWKDWZHFDQGRZLWKRXWWKHFW\SHOLEUDU\   ࠭ᮠDŽޕᆇㅖѢ᫽֌Ⲵ፼ޣVWULQJK!ᆇㅖѢཤ᮷ԦDŽѫ㾱ᇊѹҶаӋᴹLQFOXGH YVSULQWIǃYSULQWIǃYISULQWI ࠭ᮠDŽ YDBVWDUWYDBDUJ ઼ YDBHQG ˈ⭘Ҿ YDBOLVW ઼йњᆿ ㊫ර VWGDUJK!ḷ߶৲ᮠཤ᮷ԦDŽԕᆿⲴᖒᔿᇊѹਈ䟿৲ᮠࡇ㺘DŽѫ㾱䈤᰾ҶњLQFOXGH  OLZLNLILOLZਧҶDŽ൘ᵜԓ⸱ѝ䘉њ EXJ 䘈ӽ❦ᆈ൘˄ 㹼˅DŽԆⲴњӪѫ亥ᱟ KWWS ֌Ѫ䗃ࠪฏᇭᓖᰦˈᘈ䇠䙂໎ᤷ䪸䐣䗷䘉њᱏ  ᒤ᡽ᴹӪਁ⧠ˈᒦҸԕ㓐↓DŽ䘉њ EXJ ᱟ൘֯⭘  ᒤ ᢯䇔൘䘉⇥ԓ⸱ѝᴹањ EXJˈⴤࡠ ቡѪԆ㕆߉Ҷ䘉⇥⭘Ҿ޵Ṩᱮ⽪ؑ᚟Ⲵԓ⸱DŽԆਾᶕ ᰦˈ/LQXV ᖃᰦሩ & 䈝䀰䘈нᱟᖸ⟏ᚹˈ䘈нՊ֯⭘ਟਈ৲ᮠࡇ㺘࠭ᮠ࣏㜭DŽഐ↔ /DUV:LU]HQLXV  ᒤ༿ᆓᔰਁ /LQX[ ᇔDŽ൘ޜ/DUV:LU]HQLXV ᱟ /LQXV Ⲵྭ৻ˈ൘ +HOVLQNL བྷᆖᰦᴮ਼༴а䰤࣎    :LU]HQLXVZURWHWKLVSRUWDEO\7RUYDOGVIXFNHGLWXS     /LQXV7RUYDOGV YVSULQWIF/DUV:LU]HQLXV     /LQXV7RUYDOGV &     OLQX[NHUQHOYVSULQWIF     ぁᓅ 8-11 linux/kernel/vsprintf.c 8.12.2 ԙ⸷⌞䠀 vsprintf()࠭ᮠⲴ֯⭘ᯩ⌅䈧৲➗ C ᓃ࠭ᮠ᡻޼DŽ ᮠˈสᵜ⋑ᴹ⎹৺޵Ṩᐕ֌৏⨶ᯩ䶒Ⲵ޵ᇩˈഐ↔ਟԕ䐣䗷DŽⴤ᧕䰵䈫ԓ⸱ਾሩ䈕࠭ᮠⲴ֯⭘䈤᰾DŽ 䈕〻ᒿѫ㾱वᤜ vsprintf()࠭ᮠˈ⭘Ҿሩ৲ᮠӗ⭏ṬᔿॆⲴ䗃ࠪDŽ⭡Ҿ䈕࠭ᮠᱟ C ࠭ᮠᓃѝⲴḷ߶࠭ 8.12.1 ࣕ㜳ᨅ䘦 8.12 vsprintf.c ぁᓅ   `  ROG UHWXUQ  FXUUHQW!XPDVN PDVN    YVSULQWIF 〻ᒿ   QXP LI  L QXP 䖜ᦒᡀᆇㅖᖒᔿDŽ ˗੖ࡉṩᦞ㔉ᇊⲴสᮠሶᮠ٬  QXP Ѫ ˈࡉѤᰦᆇㅖѢ ྲ᷌ᮠ٬ EDVH  VL]H HOVHLI  EDVH  VL]H LI  63(&,$/ W\SH LI VLJQ VL]H LI 䘋ࡦ䖜ᦒ㔃᷌ࡽ᭮ањ䴦˅DŽޛ䘋ࡦᇭᓖ߿ ˄⭘ҾޛሩҾ ⭘Ҿ [ ˈ 䘋ࡦᇭᓖ޽߿ቁ  սޝ㤕ᑖㅖਧˈࡉᇭᓖ٬߿ DŽ㤕㊫රᤷࠪᱟ⢩↺䖜ᦒˈࡉሩҾॱ    63$&( " W\SH   3/86 " W\SH VLJQ `HOVH QXP QXP   VLJQ  ^QXP 6,*1 W\SH LI     =(523$' " W\SH  F ੖ࡉྲ᷌㊫රᤷࠪᱟ࣐ਧˈࡉ㖞 VLJQ ࣐ਧˈ੖ࡉ㤕㊫රᑖオṬḷᘇࡉ VLJQ オṬˈ੖ࡉ㖞 DŽ QXP ሿҾ ˈࡉ㖞ㅖਧਈ䟿 VLJQ 䍏ਧˈᒦ֯ QXP ਆ㔍ሩ٬DŽ ྲ᷌㊫රᤷࠪᱟᑖㅖਧᮠᒦфᮠ٬ ˈ੖ࡉ F ㅹҾオṬᆇㅖDŽ  ྲ᷌㊫රᤷࠪ㾱ປ䴦ˈࡉ㖞ᆇㅖਈ䟿 F UHWXUQ  __EDVH!EDVH LI  a=(523$' /()7 W\SH W\SH LI DEFGHIJKLMNOPQRSTUVWXYZ[\] 60$// GLJLWV W\SH LI ྲ᷌䘋ࡦสᮠሿҾ  ᡆབྷҾ ˈࡉ䘰ࠪ༴⨶ˈҏণᵜ〻ᒿਚ㜭༴⨶สᮠ൘  ѻ䰤ⲴᮠDŽ ྲ᷌㊫රᤷࠪ㾱ᐖ䈳ᮤ˄䶐ᐖ䗩⭼˅ˈࡉቿ㭭㊫රѝⲴປ䴦ḷᘇDŽ ྲ᷌㊫ර W\SH ᤷࠪ⭘ሿ߉ᆇ⇽ˈࡉᇊѹሿ߉ᆇ⇽䳶DŽ  LQWL $%&'()*+,-./0123456789:;<= GLJLWV FRQVWFKDU FKDUFVLJQWPS>@ ^  LQWW\SH VWULQWQXPLQWEDVHLQWVL]HLQWSUHFLVLRQ FKDU QXPEHU VWDWLFFKDU 䗃ࠪ˖VWU ᆇㅖѢᤷ䪸DŽ ㋮ᓖ ˗W\SH㊫ර䘹亩DŽ QXPᮤᮠ˗EDVH䘋ࡦ˗VL]HᆇㅖѢ䮯ᓖ˗SUHFLVLRQᮠᆇ䮯ᓖ˖ޕ䗃 ሶᮤᮠ䖜ᦒѪᤷᇊ䘋ࡦⲴᆇㅖѢDŽ   `BBUHV ? EDVH  U  Q  BBUHV Q  G  DGLYO BBDVPBB ?LQWBBUHV ^?  QEDVH GHILQHGRBGLY 㕆Ⲵؑ᚟DŽ≶ޕ፼ޣ৲㿱  㢲ᴹ Q Ѫ㻛䲔ᮠˈEDVH Ѫ䲔ᮠ˗㔃᷌˖Q Ѫ୶ˈ࠭ᮠ䘄എ٬Ѫ։ᮠDŽ˖ޕ䲔᫽֌DŽ䗃   ֯⭘ሿ߉ᆇ⇽   $%&'() LQVWHDGRI DEFGHI XVH GHILQH60$//  [  [ GHILQH63(&,$/  ᐖ䈳ᮤ  OHIWMXVWLILHG GHILQH/()7  ྲᱟ࣐ˈࡉ㖞オṬ  VSDFHLISOXV GHILQH63$&(  ᱮ⽪࣐  VKRZSOXV GHILQH3/86  ᰐㅖਧㅖਧ䮯ᮤᮠ  XQVLJQHGVLJQHGORQJ GHILQH6,*1  ປݵ䴦  SDGZLWK]HUR GHILQH=(523$' 䘉䟼ᇊѹ䖜ᦒ㊫රⲴ਴⿽ㅖਧᑨᮠDŽ  `   YVSULQWIF 〻ᒿ   IODJVWRQXPEHU LQWIODJV  LS LQW V FKDU ⭘Ҿᆈ᭮䖜ᦒ䗷〻ѝⲴᆇㅖѢDŽVWU FKDU LQWL LQWOHQ ^  IPWYDBOLVWDUJV EXIFRQVWFKDU FKDU LQWYVSULQWI Ṭᔿ䖜ᦒᆇㅖⲴӻ㓽DŽޣ䈧৲㿱ᵜԓ⸱ࡇ㺘ਾⲴᴹ EXI ᱟ䗃ࠪᆇㅖѢ㕃ߢ४DŽ˗ަѝ৲ᮠ IPW ᱟṬᔿᆇㅖѢ˗DUJV ᱟњᮠਈॆⲴ٬ ѪҶ㜭൘޵Ṩѝ֯⭘ṬᔿॆⲴ䗃ࠪˈ/LQXV ൘޵Ṩᇎ⧠Ҷ䈕 & ḷ߶࠭ᮠDŽ л䶒࠭ᮠᱟ䘱Ṭᔿॆ䗃ࠪࡠᆇㅖѢѝDŽ  ` 䘄എ䖜ᦒྭⲴᆇㅖѢDŽUHWXUQVWU    VWU   VL]H! ZKLOH オṬDŽޕ㤕ᇭᓖ٬ӽབྷҾ䴦ˈࡉ㺘⽪㊫රḷᘇѝᴹᐖ䶐喀ḷᘇDŽࡉ൘࢙։ᇭᓖѝ᭮ VWU WPS>L@   L! ZKLOH L њDŽ ޡVWU ѝDŽ ޕሶ䖜ᮠ٬ᦒྭⲴᮠᆇᆇㅖປ    VWU   SUHFLVLRQL ZKLOH DŽ  ㋮ᓖ٬L˅њ˄ޕࡉ VWU ѝ᭮ˈQXP ⲴᮠᆇњᮠDŽ㤕ᮠᆇњᮠሿҾ㋮ᓖ٬ ↔ᰦ L ᆈᴹᮠ٬ VWU F   VL]H! ZKLOH  /()7 W\SH  LI ᡆオṬ˅ˈ㿱  㹼DŽ  㤕㊫රѝ⋑ᴹᐖ䈳ᮤ˄ᐖ䶐喀˅ḷᘇˈࡉ൘࢙։ᇭᓖѝᆈ᭮ F ᆇㅖ˄ `  [ ᡆ ; VWU GLJLWV>@     VWU  EDVH  ^ HOVHLI    VWU    EDVH LI  63(&,$/ W\SH LI DŽ [ 䘋ࡦࡉᆈ᭮ޝ˗㘼ሩҾॱ  䘋ࡦ䖜ᦒ㔃᷌ཤаս᭮㖞ањޛ㤕㊫රᤷࠪᱟ⢩↺䖜ᦒˈࡉሩҾ VWU VLJQ   VLJQ LI    VWU   VL]H! ZKLOH  =(523$'/()7 W\SH  LI ㅖਧDŽޕປ࢙᭮։ᇭᓖ٬ᤷࠪⲴオṬᮠDŽ㤕䴰ᑖㅖਧսˈࡉᆈ =(523$' ઼ᐖ䶐喀˄ᐖ䈳ᮤ˅ḷᘇˈࡉ൘ VWU ѝ俆ݸ 㤕㊫රѝ⋑ᴹປ䴦 Ӿ䘉䟼ⵏ↓ᔰ࿻ᖒᡀᡰ䴰㾱Ⲵ䖜ᦒ㔃᷌ˈᒦᲲᰦ᭮൘ᆇㅖѢ VWU ѝDŽ  VL]H SUHFLVLRQ L!SUHFLVLRQ SUHFLVLRQ L LI VL]H ߿৫⭘Ҿᆈ᭮ᮠ٬ᆇㅖⲴњᮠDŽ ᇭᓖ٬ ࡉ㋮ᓖ٬ᢙኅѪᮠᆇњᮠ٬DŽˈ㤕ᮠ٬ᆇㅖњᮠབྷҾ㋮ᓖ٬ QXPEDVH @ WPS>L@ GLJLWV>GRBGLY   QXP HOVHZKLOH   WPS>L@   YVSULQWIF 〻ᒿ  SUHFLVLRQ  JHWWKHSUHFLVLRQ  ᆇ⇥㋮ᓖ٬ਆѪ DŽ ˈ㺘⽪лањ৲ᮠᤷᇊ㋮ᓖDŽഐ↔䈳⭘ YDBDUJ ਆ㋮ᓖ٬DŽ㤕↔ᰦᇭᓖ٬ሿҾ ˈࡉሶ ᆇㅖ ަ༴⨶䗷〻ок䶒ᇭᓖฏⲴ㊫լDŽྲ᷌㋮ᓖฏѝᱟᮠ٬ࡉⴤ᧕ਆަѪ㋮ᓖ٬DŽྲ᷌㋮ᓖฏѝᱟ DŽ  SUHFLVLRQ ਈ䟿ѝDŽ㋮ᓖฏᔰ࿻Ⲵḷᘇᱟ ޕл䶒䘉⇥ԓ⸱ˈਆṬᔿ䖜ᦒѢⲴ㋮ᓖฏˈᒦ᭮  ` ` IODJV_ /()7 ILHOGBZLGWK ILHOGBZLGWK  ^ILHOGBZLGWK LI  DUJVLQW ILHOGBZLGWK YDBDUJ IPWޕ䘉䟼ᴹњ EXJˈᓄᨂ VWKHQH[WDUJXPHQW LW   ^  IPW HOVHLI  IPW ILHOGBZLGWK VNLSBDWRL  IPW LVBGLJLW LI  ILHOGBZLGWK  JHWILHOGZLGWK  ሶᆇ⇥ᇭᓖ٬ਆѪަ㔍ሩ٬DŽ 䈕ḷᘇˈᒦޕḷᘇ˄ᐖ䶐喀˅ˈഐ↔䘈䴰൘ḷᘇਈ䟿ѝ␫  ሿҾ ˈࡉ䈕䍏ᮠ㺘⽪ަᑖᴹḷᘇฏ ˈ㺘⽪лањ৲ᮠᤷᇊᇭᓖDŽഐ↔䈳⭘ YDBDUJ ਆᇭᓖ٬DŽ㤕↔ᰦᇭᓖ٬ ྲ᷌ᇭᓖฏѝᱟᆇㅖ ILHOGBZLGWK ਈ䟿ѝDŽྲ᷌ᇭᓖฏѝᱟᮠ٬ࡉⴤ᧕ਆަѪᇭᓖ٬DŽ ޕ᭮ˈਆᖃࡽ৲ᮠᆇ⇥ᇭᓖฏ٬  `  DŽ  ণ 㾱ປ䴦JRWRUHSHDWIODJV_ =(523$' FDVH ᱟ⢩↺䖜ᦒDŽJRWRUHSHDWIODJV_ 63(&,$/  FDVH ᭮オṬDŽJRWRUHSHDWIODJV_ 63$&(  FDVH ࣐᭮ਧDŽJRWRUHSHDWIODJV_ 3/86  FDVH ᐖ䶐喀䈳ᮤDŽJRWRUHSHDWIODJV_ /()7  FDVH IPW ^ VZLWFK    WKLVDOVRVNLSVILUVW IPW UHSHDW  IODJV  SURFHVVIODJV  IODJV ਈ䟿ѝDŽ ޕл䶒ਆᗇṬᔿᤷ⽪ᆇㅖѢѝⲴḷᘇฏˈᒦሶḷᘇᑨ䟿᭮  ` FRQWLQXH IPW  VWU   ^   IPW LI VWUDŽ ޕнᱟṬᔿᤷ⽪Ⲵа㡜ᆇㅖ൷㻛׍⅑ᆈ ˈራ᢮Ṭᔿ䖜ᦒᆇㅖѢⲴᔰ࿻DŽ  ᔰ࿻ˈ䘉䟼Ӿ IPW ṬᔿᆇㅖѢѝᢛ᧿  Ṭᔿ䖜ᦒᤷ⽪ᆇㅖѢ൷ԕ IPW ^IPW VWU EXI IRU 俆ݸሶᆇㅖᤷ䪸ᤷੁ EXIˈ❦ਾᢛ᧿ṬᔿᆇㅖѢˈሩ਴њṬᔿ䖜ᦒᤷ⽪䘋㹼⴨ᓄⲴ༴⨶DŽ  ⭘Ҿᮤᮠᆇ⇥ / ᡆ O  K    IRULQWHJHUILHOGV / RU O  K  LQWTXDOLILHU  PLQᮤᮠᮠᆇњᮠ˗PD[ᆇㅖѢѝᆇㅖњᮠ   QXPEHURIFKDUVIRUIURPVWULQJ PD[PLQRIGLJLWVIRULQWHJHUV LQWSUHFLVLRQ  䗃ࠪᆇ⇥ᇭᓖ   ZLGWKRIRXWSXWILHOG LQWILHOGBZLGWK   ࠭ᮠ֯⭘Ⲵḷᘇ QXPEHU    YVSULQWIF 〻ᒿ    VWU   ILHOGBZLGWKOHQ ZKLOH V  VWU   LOHQL L IRU    VWU   ILHOGBZLGWKOHQ ZKLOH  /()7 IODJV  LI  OHQ SUHFLVLRQ  OHQ!SUHFLVLRQ HOVHLI SUHFLVLRQ OHQ  SUHFLVLRQ LI  V OHQ VWUOHQ  DUJVFKDU V YDBDUJ  V FDVH њオṬᆇㅖDŽ ᇭᓖ٬ᆇㅖѢ䮯ᓖ ␫࣐ ᮠᆇㅖѢDŽྲ᷌ᇭᓖฏ䘈བྷҾ ˈࡉ㺘⽪Ѫᐖ䶐喀ˈࡉ൘৲ᮠᆇㅖѢਾ䶒৲ޕњオṬᆇㅖDŽ❦ਾ޽᭮  ᇭᓖ٬ᆇㅖѢ䮯ᓖ ޕࡉᢙኅ㋮ᓖฏ ᆇㅖѢ䮯ᓖDŽ↔ᰦྲ᷌ḷᘇฏ㺘᰾нᱟᐖ䶐喀ˈࡉ䈕ᆇ⇥ࡽ᭮ ˈˈࡉ㺘⽪ሩᓄ৲ᮠᱟᆇㅖѢDŽ俆ݸਆ৲ᮠᆇㅖѢⲴ䮯ᓖˈ㤕ަ䎵䗷Ҷ㋮ᓖฏ٬ V ྲ᷌䖜ᦒᤷ⽪ㅖᱟ  EUHDN    VWU   ILHOGBZLGWK! ZKLOH  DUJVLQW XQVLJQHGFKDU YDBDUJ  VWU     VWU   ILHOGBZLGWK! ZKLOH  /()7 IODJV  LI  F FDVH њオṬᆇㅖDŽ ᇭᓖ٬ ৲ᮠᆇㅖਾ䶒␫࣐ ᮠᆇㅖDŽྲ᷌ᇭᓖฏ䘈བྷҾ ˈࡉ㺘⽪Ѫᐖ䶐喀ˈࡉ൘৲ޕњオṬᆇㅖˈ❦ਾ޽᭮ ᇭᓖฏ٬ ޕ᭮ ˈࡉ㺘⽪ሩᓄ৲ᮠᓄᱟᆇㅖDŽ↔ᰦྲ᷌ḷᘇฏ㺘᰾нᱟᐖ䶐喀ˈࡉ䈕ᆇ⇥ࡽ䶒 F ྲ᷌䖜ᦒᤷ⽪ㅖᱟ IPW ^ VZLWFK л䶒࠶᷀䖜ᦒᤷ⽪ㅖDŽ  ` IPW IPW  TXDOLILHU  ^ /  IPW __ O  IPW __ K  IPW LI  TXDOLILHU  JHWWKHFRQYHUVLRQTXDOLILHU  TXDOLIHU ਈ䟿DŽ˄KO/ Ⲵਜ਼ѹ৲㿱ࡇ㺘ਾⲴ䈤᰾˅DŽ ޕл䶒䘉⇥ԓ⸱࠶᷀䮯ᓖ؞侠ㅖˈᒦሶަᆈ  `  SUHFLVLRQ  SUHFLVLRQ LI `  DUJVLQW SUHFLVLRQ YDBDUJ IPWޕ਼к䘉䟼ҏᓄᨂ VWKHQH[WDUJXPHQ