· KLDP.org · KLDP.net · KLDP Wiki · KLDP BBS ·
Docbook Sgml/Assembly-HOWTO

You are not allowed to 'info'


Linux Assembly HOWTO : ¸®´ª½º ¾î¼Àºí¸® ÇÏ¿ìÅõ

Linux Assembly HOWTO : ¸®´ª½º ¾î¼Àºí¸® ÇÏ¿ìÅõ

BoldyshevKonstantin

RideauFrancois-Rene

±è¿µÈÖ

$Date: 2004/11/05 13:56:28 $

ÀÌ ¹®¼­´Â ¸®´ª½º ¾î¼Àºí¸® ÇÏ¿ìÅõÀÌ´Ù. ÀÌ ¹®¼­´Â GNU ÀÇ ÀÚÀ¯ ÇÁ·Î±×·¡¹Ö µµ±¸µéÀ» »ç¿ëÇÏ¿© (ÁÖ·Î) ÀÎÅÚÀÇ 32 ºñÆ® Ç÷§Æû(IA32 ; i386)ÀÇ ¸®´ª½º¿¡¼­ ¾î¼Àºí¸® ¾ð¾î·Î ÇÁ·Î±×·¡¹Ö ÇÏ´Â ¹ýÀ» ¼³¸íÇÑ´Ù. ÀÌ ±Û¿¡¼­ ¼³¸íÇÏ´Â ³»¿ëµéÀº ´Ù¸¥ Çϵå¿þ¾î³ª ¼ÒÇÁÆ®¿þ¾î Ç÷§Æû¿¡ Àû¿ëµÉ ¼öµµ ÀÖ°í, ±×·¸Áö ¾ÊÀ» ¼öµµ ÀÖ´Ù. (¿ªÁÖ: ÀÌ ¹ø¿ª¹®¼­´Â ºÎÁ·ÇÑ ÀúÀÇ ¹®Àå½Ç·ÂÀ¸·Î Çʿ伺¿¡ ÀÇÇÏ¿© ¹ø¿ªÇÑ °á°ú·Î À߸øµÈ ¿À¿ª°ú Àǹ̿¡ ÀÌ»ó¾ø´Â ºÎºÐÀÌ ºüÁú ¼öµµ ÀÖÀ½À» ¹Ì¸® ¾Ë¸³´Ï´Ù. µû¶ó¼­ À߸øµÈ ¹ø¿ªÀ¸·Î ¿À´Â Ã¥ÀÓÀº Àú¿¡°Ô ¾øÀ¸¸ç, ¸¸ÀÏ ¼öÁ¤ÇØ¾ß ÇÒ °÷ÀÌ ÀÖ´Ù¸é Àú¿¡°Ô ¿¬¶ôÀ» ÇØÁֽñ⠹ٶó¸ç, ¿øÀúÀÇ ¿À·ù¶ó¸é ¿øÀúÀÚ¿¡°Ô ¿¬¶ôÇØÁֽñ⠹ٶø´Ï´Ù. ºÎÁ·ÇÑ Á¦ ¿µ¾î½Ç·ÂÀ¸·Î ÀÎÇØ ¹ø¿ªÀÌ ¾Ö¸ÅÇÑ ºÎºÐÀº ¿ø¹®À» °°ÀÌ Ç¥±âÇØ µÎ¾ú½À´Ï´Ù.)

ÀÌ ¹®¼­ÀÇ º¹»ç, ¹èÆ÷ ȤÀº ¼öÁ¤Àº GNU Free Documentation License Version 1.1 ¿¡ µû¸¥´Ù. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1; with no Invariant Sections, with no Front-Cover Texts, and no Back-Cover texts.

고친 과정
고침 ¹ø¿ª ¹öÁ¯ 0.6-trans-0.12000. 11. 21 - 2001. 10. 20고친이 ¶óÅ°½Ã½º
¹®¼­ Ãʹú ¹ø¿ª ¿Ï·á : Resource ÀÌÈÄÀÇ °ÍÀº ¹Ì¹ø¿ª
Version 0.6

차례
1. ¼Ò°³
1.1. Legal Blurb (¹ýÀû¹®Á¦¿¡ °üÇÑ ÀܼҸ®)
1.2. ¼­¹®
1.3. ÀÌ ¹®¼­¿¡ ±â¿©ÇÏ´Â ¹ý
2. ¾î¼Àºí¸®°¡ Á¤¸»·Î(!) ÇÊ¿äÇÑ°¡?
2.1. Pros and Cons - µæ½Ç(¾î¼Àºí¸®¸¦ »ç¿ëÇÔÀ¸·Î½á »ý±â´Â ÀåÁ¡, ´ÜÁ¡)
2.1.1. ¾î¼Àºí¸®ÀÇ ÀåÁ¡
2.1.2. ¾î¼Àºí¸®ÀÇ ´ÜÁ¡
2.1.3. °á·Ð
2.2. ¾î¼Àºí¸®¸¦ »ç¿ëÇÏÁö ¾Ê´Â ¹æ¹ý
2.2.1. È¿À²ÀÌ ³ôÀº Äڵ带 »ý¼ºÇϱâ À§ÇÑ ÀϹÝÀûÀÎ ÀýÂ÷
2.2.2. ÃÖÀûÈ­µÈ ÁÁÀº Äڵ带 »ý¼ºÇÏ´Â ÄÄÆÄÀÏ·¯¸¦ °¡Áø ¾ð¾îµé
2.2.3. ¿©·¯ºÐÀÇ ÄÚµåÀÇ ¼öÇà¼Óµµ¸¦ ³ôÀÌ´Â ÀϹÝÀûÀÎ ÀýÂ÷
2.2.4. ÄÄÆÄÀÏ·¯°¡ »ý¼ºÇÑ Äڵ忡 ´ëÇÑ °íÂû
2.3. ¸®´ª½º¿Í ¾î¼Àºí¸®
3. °¡¿ëÇÑ ¾î¼Àºí·¯µé
3.1. GCC ÀζóÀÎ ¾î¼Àºí·¯
3.1.1. GCC ¸¦ ¾îµð¼­ ±¸ÇÒ °ÍÀΰ¡?
3.1.2. GCC ÀζóÀÎ ¾î¼Àºí·¯¿¡ °üÇÑ ¹®¼­¸¦ ¾îµð¼­ ãÀ» ¼ö Àִ°¡
3.1.3. GCC ¸¦ ÀÌ¿ëÇÏ¿© ÀζóÀÎ ¾î¼Àºí¸® Äڵ带 »ý¼ºÇϱâ
3.1.4. ¸ÅÅ©·ÎÀÇ Áö¿ø
3.2. GAS
3.2.1. ¾îµð¿¡¼­ GAS ¸¦ ãÀ» ¼ö Àִ°¡
3.2.2. AT&T ¹®¹ý
3.2.3. GAS ÀÇ ÀÎÅÚ ¹®¹ý Áö¿ø
3.2.4. 16-ºñÆ® ¸ðµå
3.2.5. ¸ÅÅ©·Î Áö¿ø
3.3. NASM
3.3.1. NASMÀ» ¾îµð¼­ ±¸ÇÒ ¼ö Àִ°¡
3.3.2. NASM À¸·Î ¹«¾ùÀ» ÇÒ ¼ö Àִ°¡
3.4. AS86
3.4.1. AS86 À» ¾îµð¼­ ±¸ÇÒ ¼ö Àִ°¡
3.4.2. ¾î¼Àºí·¯¸¦ ÀÛµ¿½ÃÅ°´Â ¹æ¹ý : How to invoke the assembler?
3.4.3. AS86ÀÇ ¹®¼­¸¦ ãÀ» ¼ö ÀÖ´Â °÷
3.4.4. ¸ÅÅ©·Î Áö¿ø
3.4.5. ¸¸¾à ÀÌ »õ·Î¿î ¹öÁ¯À» ÀÌ¿ëÇؼ­ ¸®´ª½º¸¦ ´õÀÌ»ó ÄÄÆÄÀÏ ÇÒ ¼ö ¾ø´Ù¸é ¾î¶»°Ô ÇØ¾ß Çϴ°¡ : What if I can't compile Linux anymore with this new version?
3.5. ´Ù¸¥ ¾î¼Àºí·¯µé
3.5.1. Win32Forth ¾î¼Àºí·¯
3.5.2. TDASM
3.5.3. Terse
3.5.4. HLA
3.5.5. TALC
3.5.6. x86 ¿ëÀÇ ÇÁ¸®°¡ ¾Æ´Ï°Å³ª 32ºñÆ®°¡ ¾Æ´Ñ ¾î¼Àºí·¯µé
4. ¸ÞŸÇÁ·Î±×·¡¹Ö
4.1. ¿ÜºÎ ÇÊÅ͵é
4.1.1. CPP
4.1.2. M4
4.1.3. ¿©·¯ºÐÀÌ ¸¸µç ÇÊÅ͸¦ ÀÌ¿ëÇÑ ¸ÅÅ©·Î ÇÁ·Î¼¼½Ì
4.2. ¸ÞŸÇÁ·Î±×·¡¹Ö
4.2.1. ÄÄÆÄÀÏ·¯ÀÇ ¹é¿£µå·Î Á¦°øµÇ´Â ¾î¼Àºí·¯ÀÇ ÀÌ¿ë
4.2.2. ´ºÀúÁö ¸Ó½Å-ÄÚµå ÅøŶ
4.2.3. TUNES ÇÁ·ÎÁ§Æ®
5. ÇÔ¼ö È£Ãâ ±ÔÄ¢
5.1. Linux
5.1.1. GCC ·ÎÀÇ ¸µÅ· : Linking to GCC
5.1.2. ELF ¿Í a.out ¹®Á¦
5.1.3. Direct Linux syscalls
5.1.4. ¸®´ª½º¿¡¼­ÀÇ Çϵå¿þ¾î ÀÔÃâ·Â
5.1.5. Accessing 16-bit drivers from Linux/i386
5.2. DOS and Windows
5.3. ¿©·¯ºÐÀÌ ¸¸µç OS
6. ÀÏ´Ü µû¶óÇغ¸ÀÚ(Quick Start)
6.1. ¼Ò°³
6.1.1. ÇÊ¿äÇÑ µµ±¸µé
6.2. Hello, world!
6.2.1. Program layout
6.2.2. NASM (hello.asm)
6.2.3. GAS (hello.S)
6.3. ½ÇÇàÆÄÀÏ ¸¸µé±â
6.3.1. ¸ñÀû ÄÚµå »ý¼º
6.3.2. ½ÇÇàÆÄÀÏÀÇ »ý¼º
7. Resources
7.1. Pointers
7.2. Mailing list
8. Frequently Asked Questions
A. History
B. Acknowledgements
C. Endorsements
D. GNU Free Documentation License

1장. ¼Ò°³

참고: ÇÏ¿ìÅõ ¹®¼­¿¡ Ä£¼÷Çϴٰųª ¾î¼Àºí¸®¿Í ¹«°üÇÑ ÀܼҸ® :-) µéÀ» º¸±â ½ÈÀ¸½Ã¸é ÀÌ ÀåÀ» °Ç³Ê¶Ù¾îµµ ÁÁ´Ù.


1.1. Legal Blurb (¹ýÀû¹®Á¦¿¡ °üÇÑ ÀܼҸ®)

ÀÌ ¹®¼­ÀÇ º¹»ç, ¹èÆ÷ ȤÀº ¼öÁ¤Àº GNU Free Documentation License Version 1.1 ¿¡ µû¸¥´Ù. with no Invariant Sections, with no Front-Cover Texts, and no Back-Cover texts. A copy of the license is included in the GNU Free Documentation License appendix.

ÀÌ ¹®¼­ÀÇ °¡Àå ÃÖ±ÙÀÇ °ø½ÄÆÇÀº Linux Assembly ³ª LDP ¿¡¼­ ±¸ÇÒ ¼ö ÀÖ´Ù. ¹®¼­ÀÇ »õ·Î¿î ¹öÁ¯À» È®ÀÎÇÏ´Â °ÍÀ» ÀØÁö ¹Ð¶ó.

참고: ¿ªÀÚ ÁÖ : ÇöÀç ÃֽŠ¹öÁ¯Àº 0.6d ÀÌ´Ù. ¹ø¿ª¹®Àº 0.6 À» ¹ø¿ªÇÑ °ÍÀÌ´Ù.


1.2. ¼­¹®

ÀÌ ¹®¼­´Â free ¼ÒÇÁÆ®¿þ¾î¸¦ »ç¿ëÇÑ 32ºñÆ® x86 ¾î¼Àºí¸® ÇÁ·Î±×·¡¹ÖÀ̳ª ÇÁ·Î±×·¥µé¿¡ ´ëÇØ Áú¹®ÇÏ´Â »ç¶÷µé¿¡°Ô ´äº¯Çϱâ À§ÇØ Á¦À۵ǾúÀ¸¸ç, ƯÈ÷ ¸®´ª½º ¿î¿µÃ¼Á¦¸¦ Ÿ°ÙÀ¸·Î »ï°í ¼³¸íÀ» ÁøÇàÇÏ°í ÀÖ´Ù. ¹®¼­ÀÇ ¿©·¯ ºÎºÐ¿¡¼­ ƯÁ¤ ¼ÒÇÁÆ®¿þ¾î³ª ¹®¼­¸¦ ±¸Çϱâ À§ÇÑ url µéÀ» ÀáÁ¶ÇÏ°í, ¾ð±ÞÇÏ°í ÀÖ´Ù. ÀÌ ¹®¼­´Â ¶ÇÇÑ ÁÖµÈ ¸ñÀûÀÌ ¾Æ´Ñ ÀÚÀ¯ ¼ÒÇÁÆ®¿þ¾î°¡ ¾Æ´Ï°Å³ª, x86 ±â¹ÝÀÌ ¾Æ´Ï°Å³ª, 32ºñÆ® ¾î¼Àºí·¯°¡ ¾Æ´Ï±âµµ ÇÑ °Íµé¿¡ ´ëÇÑ ¾ð±ÞÀ» Çϱ⵵ ÇÑ´Ù. ¿©·¯ºÐÀÌ ÁÁ¾ÆÇÏ´Â Ç÷§Æû¿¡¼­ÀÇ ÇÁ·Î±×·¡¹Ö¿¡ ´ëÇÑ FAQ ¿Í ¹®¼­µéÀÌ ÀÖÀ½À» Ç×»ó ±â¾ïÇ϶ó. ¿©·¯ºÐÀÌ ±×¿¡ ´ëÇÑ ³»¿ëÀ» ¹ß°ßÇÏ·Á¸é ±×(ƯÁ¤ Ç÷§Æû¿¡¼­ÀÇ)¿¡ °üÇÑ ¹®¼­ µéÀ» ÂüÁ¶Çϵµ·Ï Ç϶ó. (¾î¼Àºí¸® ÇÁ·Î±×·¡¹ÖÀ» ¹Ù·Î ãÁö ¸»°í, ƯÁ¤ Ç÷§Æû¿¡ °üÇÑ ¹®¼­¸¦ ãÀ¸¸é µÈ´Ù.)

¾î¼Àºí¸® ÇÁ·Î±×·¡¹ÖÀÇ ÁÖµÈ ¸ñÀûÀº ¿î¿µÃ¼Á¦, ÀÎÅÍÇÁ¸®ÅÍ, ÄÄÆÄÀÏ·¯, °ÔÀÓ µî°ú °°Àº ºÐ¾ß¿¡¼­ C ·Î ±¸ÇöÇϱâ Èûµç ºÎºÐÀ» (ÆÛÆ÷¸Õ½º°¡ ÁÖµÈ issue °¡ µÇ´Â ºÎºÐ) °Çµå¸®±â À§ÇÑ °ÍÀ̱⠶§¹®¿¡ ÀÌ ¹®¼­¿¡¼­´Â ±×·¯ÇÑ Á¾·ùÀÇ ¼ÒÇÁÆ®¿þ¾î °³¹ß°ú °ü·ÃµÈ ºÎºÐ¿¡ ÃÐÁ¡À» ¸ÂÃâ °èȹÀÌ´Ù.

¸¸¾à ¿©·¯ºÐÀÌ free ¼ÒÇÁÆ®¿þ¾î°¡ ¹«¾ùÀÎÁö ¸ð¸¥´Ù¸é, GNU General Public License (GPL ȤÀº copyleft) À» ÁÖÀDZíÀÌ Àо±â ¹Ù¶õ´Ù. ¾ÆÁÖ ¸¹Àº free ¼ÒÇÁÆ®¿þ¾î(¿ªÀÚ ÁÖ : ÀÚÀ¯ ¼ÒÇÁÆ®¿þ¾î ¶ó°í ¹ø¿ªÇÏ°Ú´Ù.)µéÀÌ GNU GPL À» µû¸¥´Ù. ¹èÆ÷µÇ´Â ÀÚÀ¯ ¼ÒÇÁÆ®¿þ¾îÀÇ ¼Ò½º Áß¿¡ COPYING(ȤÀº COPYING.LIB) À̶ó´Â À̸§ÀÇ ÆÄÀÏ¿¡¼­ Àо ¼ö ÀÖ´Ù. ¶ÇÇÑ, ÀÚÀ¯ ¼ÒÇÁÆ®¿þ¾î Àç´Ü (Free software foundation : FSF) ¿¡¼­ Á¦°øÇÏ´Â ¹®¼­µéµµ µµ¿òÀÌ µÉ °ÍÀÌ´Ù. ÀÌ·¯ÇÑ ÀÚÀ¯ ¼ÒÇÁÆ®¿þ¾î°¡ ¾ÆÁÖ Èï¹ÌÀÖ´Â(!) ÀÌÀ¯´Â ±× ¼ÒÇÁÆ®¿þ¾îµéÀÌ ¼Ò½ºÄÚµå¿Í ÇÔ²² Á¦°øµÇ±â ´ë¹®ÀÌ´Ù. °Ô´Ù°¡ ¿©·¯ºÐÀº ¼Ò½ºÄڵ带 ¼öÁ¤Çϰųª, ¹ö±×¸¦ Àâ¾Æ¼­ ´Ù½Ã ¹èÆ÷ÇÒ ¼öµµ ÀÖÀ¸¸ç, ½ÉÁö¾î ±× Äڵ忡¼­ Â÷¿ëÇÑ Äڵ带 °¡Áø ÇÁ·Î±×·¥À» ¸¸µé ¼öµµ ÀÖ´Ù. (Ãâó¸¦ ¹àÈ÷°í, ÀÚ½ÅÀÇ Äڵ带 GNU GPL ÇÏ¿¡ °ø°³ÇÑ´Ù¸é)


1.3. ÀÌ ¹®¼­¿¡ ±â¿©ÇÏ´Â ¹ý

ÀÌ ¹®¼­´Â ÁøÈ­(!)ÇØ °¡´Â ¹®¼­ÀÌ´Ù. ¿©·¯ºÐÀº ÀÚÀ¯·Ó°Ô ÀÌ ¹®¼­¿¡¼­ ´Ù·ç´Â ÁÖÁ¦¿¡ ´ëÇØ Áú¹®ÇÒ ¼ö ÀÖÀ¸¸ç, ¶ÇÇÑ, ´äµµ ÇØ ÁÙ¼ö ÀÖ´Ù. ¶ÇÇÑ ÁÖ¾îÁø ´äÀÇ ¿À·ù¸¦ Á¤Á¤Çؼ­ ´Ù½Ã ´äÇØÁÙ ¼öµµ ÀÖ´Ù. »õ·Î¿î ¼ÒÇÁÆ®¿þ¾î¸¦ ¾Ë·ÁÁÙ ¼öµµ ÀÖÀ¸¸ç, ÀÌ ¹®¼­ÀÇ ¹ö±×³ª ºñÈ¿À²ÀûÀÎ Á¡À» ÀúÀÚ¿¡°Ô ¾Ë·ÁÁÙ ¼öµµ ÀÖ´Ù.

Á¦¹ß!! ±â¿©ÇØ ´Þ¶ó!! ¹®¼­ÀÇ ÀúÀÚ¿¡°Ô ¸ÞÀÏÀ» : maintainer.

참고: ÀÌ ±ÛÀ» ¾²´Â ½ÃÁ¡¿¡, ÀÌ ¹®¼­ÀÇ °ü¸®ÀÚ´Â Francois-Rene Rideau °¡ ¾Æ´Ï¶ó Konstantin Boldyshev ÀÌ´Ù.(¹öÁ¯ 0.5ºÎÅÍ ±×·¯Çß´Ù.) ³ª(ÀúÀÚ)´Â ÀÌ ¹®¼­¸¦ ³ª¸¦ ´ë½ÅÇؼ­ À¯Áö/º¸¼öÇÒ ÁøÁöÇÑ ÇØÄ¿¸¦ Çѵ¿¾È ã¾Æ ¿ÔÀ¸¸ç, KonstantinÀÌ ³ªÀÇ ÈÄÀÓÀÌ µÇ¾úÀ½À» ±â»Ú°Ô ¹ßÇ¥ÇÏ´Â ¹ÙÀÌ´Ù.


2장. ¾î¼Àºí¸®°¡ Á¤¸»·Î(!) ÇÊ¿äÇÑ°¡?

À½... ¿©·¯ºÐÀÌ ¹«½¼ÀÏÀ» ÇÏ´ÂÁö ³»°¡ ¾Ë ¼ö ÀÖ´Â ¹æ¹ýÀÌ ¾ø±â ¶§¹®¿¡, ¿©·¯ºÐÀÇ ÀÏ¿¡ ¾î¼Àºí¸®°¡ Á¤¸» ÇÊ¿äÇÑÁö ³»°¡ ÆÇ´ÜÇÒ ¼ö´Â ¾ø´Ù. ´ë½Å, °ÅµìµÈ »ðÁú(-_-)ÀÇ °á°ú·Î ¾òÀº ±ÍÁßÇÑ °æÇèÀÇ Á¶¾ðÀ» ¾Æ·¡¿¡ Àû¾î º¸°Ú´Ù.


2.1. Pros and Cons - µæ½Ç(¾î¼Àºí¸®¸¦ »ç¿ëÇÔÀ¸·Î½á »ý±â´Â ÀåÁ¡, ´ÜÁ¡)

2.1.1. ¾î¼Àºí¸®ÀÇ ÀåÁ¡

¾î¼Àºí¸®´Â ¸Å¿ì Àú±ÞÀÇ(? - very low things, Çϵå¿þ¾î ·¹º§ÀÇ) ÀϵéÀ» ó¸®ÇÒ ¼ö ÀÖ´Ù. :

  • ¿©·¯ºÐÀÌ ¾î¼Àºí¸®¸¦ »ç¿ëÇϸé, ƯÁ¤ ÇÁ·Î¼¼¼­¿¡¸¸ ÀÖ´Â ·¹Áö½ºÅͳª I/O ¸¦ ¹Ù·Î Á¢±ÙÇÒ ¼ö ÀÖ´Ù.(you can access machine-dependent registers and I/O)

  • Å©¸®Æ¼Äà ¼½¼Ç µî¿¡¼­ µ¥µå¶ô°ú °°Àº ÀÏÀ» ¾ß±âÇÒ ¼ö ÀÖ´Â ¿©·¯°³ÀÇ ÇÁ·Î¼¼½º ¾²·¹µåµéÀÇ ÄÚµå µ¿ÀÛÀ» ¸Å¿ì Á¤È®ÇÏ°Ô(!) ÄÁÆ®·Ñ ÇÒ ¼ö ÀÖ´Ù. Áï, ÄÚµå ÇϳªÇϳªÀÇ µ¿ÀÛÀ» ¸ðµÎ Á¦¾îÇÏ°í, ¿©·¯ºÐÀÌ »ý°¢ÇÑ ´ë·Î ¿òÁ÷ÀÌ°Ô ÇÒ ¼ö ÀÖ´Ù.(¿ªÀÚ ÁÖ: ¹°·Ð, ¿©±â¿¡´Â ±×¸¸Å­ÀÇ ³ë·Â°ú ´ñ°¡°¡ µû¸¥´Ù.)

  • ÀϹÝÀûÀÎ ÄÄÆÄÀÏ·¯°¡ Á¦°øÇϴ ȯ°æ°ú, »ý¼ºÇÏ´Â ÄÚµåÀÇ ±ÔÄ¢µéÀ» ¹«½ÃÇÑ Ã¤ ÀÛ¾÷ÇÒ ¼ö ÀÖ´Ù. ´Ù½Ã ¸»Çؼ­, ¼ÓµµÀÇ ÃÖÀûÈ­ µîÀ» À§ÇØ ¸Þ¸ð¸® ÇÒ´ç¿¡ °üÇÑ ±ÔÄ¢À̳ª, ¾²·¹µù, ÇÔ¼ö È£Ãâ ±ÔÄ¢°ú °°Àº °ÍµéÀ» ÀϽÃÀûÀ¸·Î ¹«½ÃÇÏ°í ÇÁ·Î±×·¡¹Ö ÇÒ ¼ö ÀÖ´Ù.

  • ¼­·Î ´Ù¸¥ ±Ô¾àÀ» »ç¿ëÇÏ´Â ¿©·¯°³ÀÇ ÄÚµåµé °£ÀÇ ÀÎÅÍÆäÀ̽º¸¦ ±¸ÃàÇÒ ¼ö ÀÖ´Ù. (¿¹¸¦ µé¸é, ´Ù¸¥ ÄÄÆÄÀÏ·¯µé·Î »ý¼ºµÈ ÄÚµåµéÀÌ »óÈ£ ÀÛ¿ëÇÒ ¼ö ÀÖµµ·Ï ¸¸µç´ÙµçÁö, low-·¹º§ ÀÎÅÍÆäÀ̽º°¡ »óÀÌÇÑ ÄÚµåµéÀÇ ÀÎÅÍÆäÀ̽º¸¦ ÅëÀÏÇÑ´ÙµçÁö ÇÏ´Â ÀÏ ¸»ÀÌ´Ù.)

  • ÀϹÝÀûÀÎ °í¼öÁØ ¾ð¾î(c ³ª pascal °°Àº)¿ë ÄÄÆÄÀÏ·¯·Î´Â »ý¼ºÇϱâ Èûµç ƯÁ¤ ÇÁ·Î¼¼¼­ÀÇ Æ¯¼öÇÑ(!) ÇÁ·Î±×·¡¹Ö ¸ðµå¿¡ Á¢±ÙÇÒ ¼ö ÀÖ´Ù. À̸¦Å׸é, ÀÎÅÍÆäÀ̽º ½ºÅ¸Æ®¾÷À» À§ÇØ ÇÁ·Î¼¼¼­ÀÇ 16ºñÆ® ¸ðµå¸¦ »ç¿ëÇÑ´ÙµçÁö, Æß¿þ¾î¿ë ÇÁ·Î±×·¥À» ¸¸µç´ÙµçÁö, ÀÎÅÚ ÄÄÇ»ÅÍ¿¡¼­ ·¹°Å½Ã ÄÚµå(legacy code)¸¦ ¸¸µç´ÙµçÁö ÇÏ´Â ÀÏÀ» ¾î¼Àºí¸®¸¦ »ç¿ëÇؼ­ ÇÒ ¼ö ÀÖ´Ù.

  • ¶ÇÇÑ, ÄÚµå ÃÖÀûÈ­¸¦ Á¦´ë·Î ½ÃÅ°Áö ¸øÇÏ´Â ³ª»Û(!) ÄÄÆÄÀÏ·¯ÀÇ Äڵ带 Á÷Á¢(!) ÃÖÀûÈ­ ½ÃÄѼ­ ±×·± ÄÄÆÄÀÏ·¯°¡ »ý¼ºÇÑ ´À·ÁÅÍÁö°í ºÒÇÊ¿äÇÑ ·çÇÁ³ª ·çƾµéÀ» ¸Å¿ì ºü¸£°í, È¿À²ÀûÀÎ ·çÇÁ·Î ¹Ù²Ù¾î ÁÙ ¼ö ÀÖ´Ù. (±×·¯³ª, ¸Å¿ì ÁÁÀº free ÄÄÆÄÀÏ·¯µéÀÌ ÀÖ´Ù. gcc ó·³)

  • ¿©·¯ºÐÀÇ Çϵå¿þ¾î ¼³Á¤¿¡¸¸ ¿Ïº®ÇÏ°Ô ÃÖÀûÈ­µÈ Äڵ带 Á÷Á¢ Á¦ÀÛÇÒ ¼ö ÀÖ´Ù. ±×·³À¸·Î½á, ¹ü¿ëÀûÀÎ (ÀϹÝÀûÀÎ) ȣȯ(?)À» À§ÇÑ ºÒÇÊ¿äÇÑ ±º»ìÀ» ¿©·¯ºÐÀÇ Äڵ忡¼­ »¬ ¼ö ÀÖ´Ù.

  • ¸¸¾à ¿©·¯ºÐÀÌ »õ·Î¿î ¾ð¾î¸¦ ¸¸µé°í, ±× ¾ð¾î¸¦ À§ÇØ ÄÄÆÄÀÏ·¯¸¦ ¸¸µç´Ù¸é, (±×·± ÀÏÀ» ÇÏ´Â »ç¶÷Àº ¸î¸í ¾ÈµÇ°í, ¶Ç, ÀÚÁÖ ±×·¯Áöµµ ¾ÊÁö¸¸) ¿©·¯ºÐÀÇ ÄÄÆÄÀÏ·¯°¡ ÃÖÀûÀÇ Äڵ带 »ý»êÇÒ ¼ö ÀÖµµ·Ï Á¶Á¤ÇÒ ¼öµµ ÀÖÀ» °ÍÀÌ´Ù.


2.1.2. ¾î¼Àºí¸®ÀÇ ´ÜÁ¡

¾î¼Àºí¸®´Â ¸Å¿ì Àú¼öÁØÀÇ ¾ð¾îÀÌ´Ù. (ÀÌÁø ±â°è¾î ÀνºÆ®·°¼ÇÀ» ±×´ë·Î ½Éº¼È­ ÇÑ°Í¿¡ Áö³ªÁö ¾Ê´Â´Ù.) ÀÌ°ÍÀº ´ÙÀ½°ú °°Àº Àǹ̸¦ °¡Áø´Ù :

  • ¾î¶² ÇÁ·Î±×·¥À» óÀ½ºÎÅÍ ¾î¼Àºí¸® Äڵ带 ÀÌ¿ëÇÏ¿© ÀÛ¼ºÇÏ´Â ÀÏÀº ¸Å¿ì ¿À·¡ °É¸®°íµµ Â¥Áõ³ª´Â ÀÛ¾÷ÀÌ´Ù.

  • ¹ö±×°¡ ¹ß»ýÇÒ È®·üÀÌ ¸Å¿ì(!) ¸Å¿ì ³ô´Ù.

  • °Ô´Ù°¡ ¹ö±×¸¦ ÃßÀûÇؼ­ Àâ¾Æ³»±â¶õ ²ûÂïÇÒ Á¤µµ·Î ¾î·Æ´Ù.

  • ¿©·¯ºÐÀÌ ÀÛ¼ºÇÑ Äڵ带 ÀÌÇØÇϱ⵵ ¾î·Á¿ï »Ó¸¸ ¾Æ´Ï¶ó ¼öÁ¤Çϱ⵵ ¾î·Æ±â ±×Áö¾ø´Ù. Áï, À¯Áö º¸¼ö°¡ ¾î·Æ´Ù.

  • ¾î¼Àºí¸®·Î ÄÚµùÀ» ÇÑ °á°ú¹°Àº ÇöÁ¸Çϰųª ¾ÕÀ¸·Î °³¹ßµÉÁöµµ ¸ð¸£´Â ´Ù¸¥ ¾ÆÅ°ÅØÃÄÀÇ ¸Ó½ÅÀ¸·Î À̽ÄÇÒ ¼ö ¾ø´Ù.

  • ¿©·¯ºÐÀÌ ¾î¼Àºí¸®·Î ÃÖÀûÈ­½ÃÄÑ ÀÛ¼ºÇÑ ÄÚµå´Â ¿©·¯ºÐÀÌ °³¹ßÇÑ Å¸°ÙÀÌ µÇ´Â ¾ÆÅ°ÅØÃÄ¿Í µ¿ÀÏÇÑ ¾ÆÅ°ÅØÃĸ¦ °¡Áö°í, ¶Ç, µ¿ÀÏÇÑ ¼³Á¤À» ÇÏ°í, µ¿ÀÏÇÑ È¯°æÀ» °¡Áø ±â°è¿¡¼­¸¸ ¼öÇàµÉ °ÍÀÌ´Ù. ¿¹±Û µé¸é, ÀÎÅÚ °è¿­ÀÇ ÇÁ·Î¼¼¼­µé(Intel 386, 486, Pentium, PPro, PII, PIII, PIV; Cyrix 5x86, 6x86, M2; AMD K5, K6 (K6-2, K6-III), K7 (Athlon, Duron).µî) ¸¸ º¸´õ¶óµµ ´Ùµé ÇÁ·Î¼¼¼­ÀÇ µðÀÚÀÎÀ̳ª ±× ¿Ü ¿©·¯ ¿ä¼Òµé(»ó´ëÀû Ŭ·° Áö¿¬½Ã°£(?), ¼öÇà¼Óµµ, ¿ë·®, ij½¬, ·¥, ¹ö½º, µð½ºÅ©, FPU ÀÇ Á¸Àç¿©ºÎ, MMX, 3DNOW, SIMDÈ®Àå µîµî... ³ª¿­Çϱ⵵ Èûµé´Ù)ÀÇ Â÷ÀÌ·Î ÀÎÇؼ­ ÇÁ·Î¼¼¼­¸¶´Ù ¶Ç, ±× ÁÖº¯ ȯ°æ¿¡ µû¶ó¼­ ¿Ïº®ÇÏ°Ô ´Ù¸¥ ÃÖÀûÈ­ Å×Å©´ÐÀÌ ÇÊ¿äÇÏ´Ù. °Ô´Ù°¡ ÇÁ·Î¼¼¼­ÀÇ ¼³°è/µðÀÚÀÎÀº °è¼ÓÀûÀ¸·Î º¯ÇÏ°í, ¹Ù²î°í, ¹ßÀüÇÏ°í Àֱ⠶§¹®¿¡, ¹æ±Ý ³ª¿­ÇÑ ¸ñ·Ï°ú ¶ÇÇÑ, ¿©·¯ºÐÀÌ ÃÖÀûÈ­½ÃŲ Äڵ尡 ÃÖ½ÅÀÇ(!) Äڵ尡 µÇ±â¸¦ ¹Ù¶ó´Â°ÍÀº ¸»µµ ¾ÈµÈ´Ù.

  • °Ô´Ù°¡, ÀÚÀßÇÑ ¼¼¹ÐÇÑ ºÎºÐ¿¡ ½Å°æÀ» ¾²´À¶ó ÇÁ·Î±×·¥ ÀüüÀÇ ¾Ë°í¸®ÁòÀ̳ª ¼³°è¿¡ ½Å°æÀ» ¾²Áö ¸øÇÒ °¡´É¼ºÀÌ ´ÙºÐÈ÷ Á¸ÀçÇÑ´Ù.

    you spend more time on a few details and can't focus on small and large algorithmic design, that are known to bring the largest part of the speed up (e.g. you might spend some time building very fast list/array manipulation primitives in assembly; only a hash table would have sped up your program much more; or, in another context, a binary tree; or some high-level structure distributed over a cluster of CPUs)

  • ¾Ë°í¸®Áò ¼³°è¸¦ Á¶±Ý¸¸ ¹Ù²Ù¾îµµ ÀÌ¹Ì ¸¸µé¾îµÐ ¾î¼Àºí¸® ÄÚµåÀÇ Àüü¸¦ ´Ù½Ã ¸¸µé¾î¾ß ÇÒÁöµµ ¸ð¸¥´Ù.

  • ¹¹, Ç¥ÁØ º¥Ä¡¸¶Å© µî, ¾öû³­ ¼öÇà¼Óµµ°¡ ÇÊ¿äÇÏÁö ¾ÊÀº ÇÁ·Î±×·¥À̶ó¸é, »ó¿ë ÄÄÆÄÀÏ·¯µéÀÌ ¸¸µé¾î³»´Â ¾î¼Àºí¸® Äڵ嵵 ¼ÕÀ¸·Î ¸¸µç°Í ó·³ ÁÁÀº Äڵ带 »ý»êÇÑ´Ù. gcc µµ »ó´çÈ÷ ÁÁÀº ÄÄÆÄÀÏ·¯ÀÌ´Ù.

  • ±×¸®°í, ÄÄÆÄÀÏ·¯ ´º½º±×·ì (comp.compilers) ÀÇ moderator ÀÎ John Levine ÀÌ ¸»ÇÑ ³»¿ëÀ» ÀοëÇÏ°Ú´Ù.

            "ÄÄÆÄÀÏ·¯´Â º¹ÀâÇÑ ÀڷᱸÁ¶¸¦ ´Ù·ç±â ½±°Ô µµ¿ÍµÐ´Ù. ±×¸®°í, ÄÄÆÄÀÏ·¯¸¦ 
            »ç¿ëÇÑ ÇÁ·Î±×·¥Àº ±×¸® Áö·çÇÏÁöµµ ¾ÊÀ¸¸ç, °Ô´Ù°¡ ¸Å¿ì ÁÁÀº Ç°ÁúÀÇ Äڵ带 »ý»êÇØÁØ´Ù."
            

            "compilers make it a lot easier to use complex data structures,
            and compilers don't get bored halfway through
            and generate reliably pretty good code."
            

    ÄÄÆÄÀÏ·¯µéÀº °Å´ëÇÑ ÇÁ·Î±×·¥ Àüü¿¡ °ÉÃÄ ÇÔ¼öµé°ú, ¸ðµâµé °£ÀÇ ÀÎÅÍÆäÀ̽º ÄÚµå ÃÖÀûÈ­¿Í °°Àº °ÍµéÀ» Á¤È®ÇÏ°Ô ¼öÇàÇØ ÁØ´Ù.


2.1.3. °á·Ð

¿ä¾àÇÏÀÚ¸é, ¿©·¯ºÐÀº ¾î¼Àºí¸®°¡ ÇÊ¿äÇÑ °æ¿ì¸¦ °¡²û ¹ß°ßÇÒ ¼ö ÀÖÀ» °ÍÀÌ´Ù. ±×¸®°í, ¾î¶² °æ¿ì¿¡´Â ²À ÇÊ¿äÇÏÁö´Â ¾Ê¾Æµµ ¾î¼Àºí¸®·Î ÄÚµùÇÏ´Â °ÍÀÌ À¯¿ëÇÑ °æ¿ì¸¦ ¹ß°ßÇÒ ¼öµµ ÀÖÀ» °ÍÀ̸ç, ¿©·¯ºÐÀÌ ±×·¸°Ô ´À³¤´Ù¸é, ±×·¸°Ô Ç϶ó. ´ÜÁö, ´ÙÀ½ »çÇ×µéÀ» ¸í½ÉÇÏ°í, ±×·¸°Ô ÇÑ´Ù¸é ÁÁÀ» °ÍÀÌ´Ù. :

  • ¾î¼Àºí¸® ÄÚµåÀÇ »ç¿ëÀ» ÃÖ¼ÒÈ­Ç϶ó

  • ¸Å¿ì Àß Á¤ÀÇµÈ ÀÎÅÍÆäÀ̽º ³»ºÎ·Î ¾î¼Àºí¸® Äڵ带 ĸ½¶È­(!)Ç϶ó.

  • ¿©·¯ºÐÀÇ ¾î¼Àºí¸® Äڵ尡 º¸´Ù °í¼öÁØÀÇ ¾ð¾îÆÐÅÏÀ¸·ÎºÎÅÍ ÀÚµ¿ÀûÀ¸·Î »ý¼ºµÈ ÄÚµåÀΰ¡? (¿¹¸¦ µé¸é gcc ÀÇ ÀζóÀÎ ¾î¼Àºí¸® ¸ÅÅ©·Î µî°ú °°Àº)

  • ±× ÇÁ·Î±×·¥µéÀ» ¾î¼Àºí¸® ÄÚµå·Î ¹ø¿ªÇÑ ÈÄ ºñ±³ÇØ º¸¶ó

    have automatic tools translate these programs into assembly code

  • °¡´ÉÇÑ ¸¸Å­ ÄÚµåµéÀÌ ÃÖÀûÈ­ µÇ¾ú´Â°¡(have this code be optimized if possible)

  • À§ÀÇ »çÇ×µéÀ» Àß Ã¼Å©ÇØ º¸°í, ÃÖÀûÈ­µÈ ÁÁÀº Äڵ带 »ý»êÇÏ´Â ÄÄÆÄÀÏ·¯ÀÇ back-end ¸¦ Àß ÀÌ¿ëÇ϶ó.

    All of the above, i.e. write (an extension to) an optimizing compiler back-end.

ºñ·Ï ¿î¿µÃ¼Á¦ °³¹ß°ú °°ÀÌ ¾î¼Àºí¸®°¡ ²À ÇÊ¿äÇÑ °Íó·³ º¸ÀÌ´Â °æ¿ì¶ó ÇÒÁö¶óµµ À§¿¡¼­ ¾ð±ÞÇÑ ³»¿ëµéÀ» ÁÖÀDZí°Ô »ý°¢ÇØ º» ÈÄ¿¡ ¾î¼Àºí¸®ÀÇ »ç¿ë ¿©ºÎ¸¦ °áÁ¤Ç϶ó

¸®´ª½ºÀÇ Ä¿³Î ¼Ò½º¸¦ Çѹø º¸µµ·Ï Ç϶ó : ¸®´ª½ºÀÇ Ä¿³ÎÀº ÇÊ¿äÇÑ Á¤¸» ÃÖ¼Ò(!)ÀÇ ¾î¼Àºí¸® Äڵ常 »ç¿ëµÇ¾ú´Ù. ±× °á°ú·Î ºü¸£°í, ½Å·Ú¼ºÀÖ°í, Æ÷ÅͺíÇϸç, À¯Áöº¸¼öÇϱ⠿ëÀÌÇÑ ¿î¿µÃ¼Á¦ÀÇ Äڵ尡 »ý¼ºµÇ°Ô µÇ¾ú´Ù. °Ô´Ù°¡ µÒ°ú °°Àº °ÔÀÓÁ¶Â÷µµ ¼Óµµ Çâ»óÀ» À§ÇÑ ÀϺΠ¸Å¿ì ÀÛÀº ·çƾÀ» Á¦¿ÜÇÏ°í´Â ´ëºÎºÐ c ¸¦ ÀÌ¿ëÇؼ­ ¸¸µé¾îÁ³´Ù´Â »ç½ÇÀ» Ç×»ó »ó±âÇ϶ó.


2.2. ¾î¼Àºí¸®¸¦ »ç¿ëÇÏÁö ¾Ê´Â ¹æ¹ý

2.2.1. È¿À²ÀÌ ³ôÀº Äڵ带 »ý¼ºÇϱâ À§ÇÑ ÀϹÝÀûÀÎ ÀýÂ÷

´º½º±×·ì comp.compilers ÀÇ Charles Fiterman ÀÌ »ç¶÷ÀÌ ¼öÀÛ¾÷ÇÑ ¾î¼Àºí¸® ÄÚµå¿Í ÄÄÆÄÀÏ·¯°¡ »ý¼ºÇÑ ¾î¼Àºí¸® Äڵ带 ºñ±³Çؼ­ ÇÑ ¸»À» ÀοëÇÏ°Ú´Ù.

            »ç¶÷ÀÌ ¼öÀÛ¾÷ÇÑ Äڵ尡 ¾ðÁ¦³ª ´õ ¿ì¼öÇÑ ¼º´ÉÀ» º¸ÀδÙ. ÀÌÀ¯´Â
            »ç¶÷Àº ¸ÕÀú, °í¼öÁØÀÇ ¾ð¾î·Î Àüü ÇÁ·Î±×·¥À» ¸¸µç´Ù.
            ±×¸®°í, ±×·¸°Ô Çؼ­ »ý¼ºÇÑ ÄÚµåÀÇ ½Ã°£À» Àâ¾Æ¸Ô´Â µî ºñÈ¿À²ÀûÀΠºÎºÐÀ» Ã£¾Æ³½´Ù.
            ±×¸®°í³ª¼­, ÄÄÆÄÀÏ·¯°¡ »ý¼ºÇÑ ¾î¼Àºí¸® Äڵ带 ÀÚ½ÅÀÌ ¼öÁ¤ÇÑ È¿À²ÀûÀÌ°í ÀûÀº ÄÚµå·Î ´ëüÇÑ´Ù.
            ¸¶Áö¸·À¸·Î, ±â°è°¡ »ý¼ºÇÑ Äڵ忡 ºñ±³ÇØ Á¶±Ý ´õ ³ªÀº ¼º´ÉÀÇ Äڵ带 ¼öÀÛ¾÷Çؼ­
            ¸¸µé¾î³½´Ù.
            Àΰ£ÀÌ ¸¸µç Äڵ尡 ¾ðÁ¦³ª ´õ ¶Ù¾î³ª´Ù. Àΰ£Àº ±â°è¸¦ »ç¿ëÇÒ ¼ö Àֱ⠶§¹®ÀÌ´Ù.
        


2.2.2. ÃÖÀûÈ­µÈ ÁÁÀº Äڵ带 »ý¼ºÇÏ´Â ÄÄÆÄÀÏ·¯¸¦ °¡Áø ¾ð¾îµé

ObjectiveCAML, SML, CommonLISP, Scheme, ADA, Pascal, C, C++, µî°ú °°Àº ¾ð¾îµéÀº ¸ðµÎ ÁÁÀº free ÄÄÆÄÀÏ·¯¸¦ °¡Áö°í ÀÖÀ¸¸ç, ±×·¯ÇÑ ÄÄÆÄÀÏ·¯¸¦ »ç¿ëÇؼ­ »ý¼ºÇÑ ÄÚµåµéÀº ¸Å¿ì ÃÖÀûÈ­µÈ Äڵ带 ¸¸µé¾îÁØ´Ù. °Ô´Ù°¡ Á¾Á¾, ¼öÀÛ¾÷À¸·Î ¸¸µç ¾î¼Àºí¸® Äڵ庸´Ù ´õ ³ªÀº ÃÖÀûÈ­¸¦ º¸¿©Áֱ⵵ ÇÑ´Ù. ±×¿¡ ´õÇÏ¿©, ¿©·¯ºÐÀÌ º¸´Ù ³ôÀº ¼öÁØÀÇ ¼¼ºÎÀûÀÎ °Í¿¡, Áï, ¾Ë°í¸®ÁòÀ̳ª, ÇÁ·Î±×·¥ÀÇ Àüü ¼³°è¿Í °°Àº ºÎºÐ¿¡ º¸´Ù ½Å°æÀ» ¾²µµ·Ï µµ¿ÍÁØ´Ù. ±×¸®°í, ±×ó·³ ¼³°è¿Í °°Àº ºÎºÐ¿¡ º¸´Ù ½Å°æÀ» ¾¸À¸·Î½á, ÀÚÀßÇÑ, ¸î¸î ºÎºÐ¿¡¼­ÀÇ ¾à°£ÀÇ ¼öÇà¼ÓµµÀÇ ¼Õ½ÇÀº º¸´Ù ³ªÀº µðÀÚÀο¡ ÀÇÇÑ È¿°ú°¡ ÃæºÐÈ÷ »ó¼â½ÃÄÑ ÁÖ°íµµ ³²´Â´Ù. ¹°·Ð, »ó¿ëÀÇ ¾Õ¼­ ¾ð±ÞÇÑ ¾ð¾î¸¦ Áö¿øÇÏ´Â ÈǸ¢ÇÑ ÄÄÆÄÀÏ·¯µéµµ ÀÖ´Ù.

LISP, Scheme, Perl µîÀÇ ¾ð¾îÀÇ ÄÄÆÄÀÏ·¯´Â c Äڵ带 »ý¼ºÇϱ⵵ ÇÑ´Ù. ±×·¸°Ô Çؼ­ »ý¼ºµÈ c ÄÚµå´Â c ÄÄÆÄÀÏ·¯¿¡ ÀÇÇؼ­ ÃÖÀûÈ­µÇ¸ç, ¼Óµµµµ ²Ï ºü¸¥ ÆíÀÌ´Ù.


2.2.3. ¿©·¯ºÐÀÇ ÄÚµåÀÇ ¼öÇà¼Óµµ¸¦ ³ôÀÌ´Â ÀϹÝÀûÀÎ ÀýÂ÷

ÄÚµåÀÇ ¼öÇà¼Óµµ¸¦ ³ôÀ̱â À§ÇØ ¿©·¯ºÐÀº ÇÁ·ÎÆÄÀÏ ÅøÀÌ °è¼ÓÀûÀ¸·Î ¼öÇ༺´ÉÀÇ º´¸ñ Çö»óÀÌ ÀϾ´Ù°í ÁöÀûÇÏ´Â ºÎºÐÀÇ Äڵ忡 ´ëÇؼ­¸¸ ÃÖÀûÈ­ÀÇ ÀÛ¾÷À» ÇØ ÁÖ¸é µÈ´Ù.

¿©·¯ºÐÀÌ ÄÚµåÀÇ ÀϺκÐÀÌ ³Ê¹« ´À¸®´Ù´Â °ÍÀ» ¾Ë¾Æä¸é, ´ÙÀ½°ú °°Àº Á¶Ä¡¸¦ ÃëÇØ º¸¶ó

  • ¸ÕÀú, ´õ ³ªÀº ¾Ë°í¸®ÁòÀ» »ç¿ëÇϵµ·Ï Ç϶ó.

  • ±×¸®°í ³ª¼­, ±× Äڵ带 ÀÎÅÍÇÁ¸®Æ® ÇÏÁö ¸»°í, ÄÄÆÄÀÏ(!) Çϵµ·Ï Ç϶ó.

  • ¿©·¯ºÐÀÇ ÄÄÆÄÀÏ·¯ÀÇ tweak optimization À» È°¼ºÈ­½ÃÄѼ­ ÄÄÆÄÀÏÇ϶ó.

  • ±×¸®°í ³ª¼­, ÄÄÆÄÀÏ·¯¿¡°Ô ÃÖÀûÈ­ ½ÃÅ°´Â ¹ý¿¡ °üÇÑ ÈùÆ®¸¦ ÁÖ¾î¶ó (¿¹¸¦µé¸é, ¸®½À¿¡¼­´Â ŸÀÔ Á¤º¸, GCC¿¡¼­´Â ·¹Áö½ºÅÍ »ç¿ë Á¤º¸, ±×¿Ü ´ëºÎºÐÀÇ ÄÄÆÄÀÏ·¯µé¿¡ ÀÌ¿Í À¯»çÇÑ ¿É¼ÇµéÀÌ ÀÖ´Ù)

  • ±×¿Í°°ÀÌ ÇÑ´Ù¸é, ¾î¼Àºí¸® ÇÁ·Î±×·¡¹ÖÀ» ÃæºÐÈ÷ ´ë½ÅÇÒ ¼ö ÀÖÀ» °ÍÀÌ´Ù.

¸¶Áö¸·À¸·Î, ¿©·¯ºÐÀÌ ¾î¼Àºí¸® ÄÚµåÀÇ ÀÛ¼ºÀ» ¸¶¹«¸®Çϱâ Àü¿¡ »ý¼ºµÈ ÄÚµåµéÀ» °Ë»çÇؼ­ ÃÖÀûÈ­µÇÁö ¾ÊÀº »óÅ·ΠÄÄÆÄÀÏ·¯°¡ »ý¼ºÇÑ Äڵ尡 Á¤¸» ¹®Á¦°¡ µÇ´ÂÁö¸¦ È®ÀÎÇØ º¸¶ó. ´ëºÎºÐ, ±×·¸Áö ¾ÊÀ» °ÍÀÌ´Ù. ¿ÀÈ÷·Á ÄÄÆÄÀÏ·¯°¡ »ý¼ºÇØ ÁØ Äڵ尡 ¿©·¯ºÐÀÌ Á÷Á¢ ÀÛ¼ºÇÑ Äڵ庸´Ù ´õ ³ªÀ» ¼öµµ ÀÖ´Ù. ƯÈ÷, ¿À´Ã³¯ÀÇ º¹ÀâÇÑ, multi-pipelined ¾ÆÅ°ÅØÃÄ ±â¹ÝÀÇ Çϵå¿þ¾î¸¦ »ç¿ëÇϴ ȯ°æ¿¡¼­ÀÇ ÇÁ·Î±×·¥ÀÏ °æ¿ì¿¡´Â ´õ¿í ±×·¯ÇÏ´Ù.

ÇÁ·Î±×·¥¿¡¼­ ½Ã°£À» ¸¹ÀÌ Àâ¾Æ¸Ô´Â ºÎºÐÀº Á¤¸» ±×·¯Çѵ¥(?-¹ø¿ªÀÌ ÀÌ»óÇÕ´Ï´Ù...-_-;) ¿Ö³ÄÇϸé, ¿À´Ã³¯ÀÇ ÃÊ°í¼Ó :-)ÀÇ ÇÁ·Î¼¼¼­µé¿¡¼­´Â ½ÇÇà ½Ã°£À» ´ÊÃß´Â ÁÖ ¿øÀÎÀ¸·Î, ¸Þ¸ð¸® Á¢±Ù(¸Þ¸ð¸®¿¡ Á¢±ÙÇϴµ¥ °É¸®´Â ½Ã°£Àº ·¹Áö½ºÅÍ¿¡ Á¢±ÙÇÏ´Â µ¥ °É¸®´Â ½Ã°£ÀÇ ¸î¹è¿¡¼­ ¸î½Ê¹è´Â ´õ ±æ´Ù), ij½¬ÀÇ ºÎÀç, TLB (¿ªÀÚÁÖ : Transtate lookaside buffer:ÀÎÅÚ °è¿­ÀÇ ÇÁ·Î¼¼¼­¿¡¼­ ¸Þ¸ð¸® ÁÖ¼ÒÀÇ »óÈ£º¯È¯À» º¸´Ù »¡¸® Çϱâ À§ÇØ descriptor ¸¦ ÀúÀåÇϴ ij½¬¿Í ºñ½ÁÇÑ °Í) ÀÇ ºÎÀç, ÆäÀÌÁö ÆúÆ® µîÀÇ ¿øÀÎÀÌ ÀÖ´Ù. µû¶ó¼­, ·¹Áö½ºÅ͸¦ ÃÖÀûÈ­ Çϴ°ÍÀº Á¡Â÷ º° ¾µ¸ð°¡ ¾ø¾îÁö°Ô µÇ¾ú´Ù. ´ë½Å, ÀÚ·á ±¸Á¶¿Í ¾²·¹µùÀÇ Á¶ÀýÀ» ÅëÇؼ­ ¸Þ¸ð¸®¿¡ Á¢±ÙÇϴ Ƚ¼ö¸¦ ÁÙÀÌ´Â °ÍÀÌ º¸´Ù ³ªÀº ¼Óµµ¸¦ ¾ò´Âµ¥ ´õ È¿°úÀûÀÌ µÇ¾ú´Ù. ¾Æ¸¶µµ, ¿ÏÀüÈ÷ ´Ù¸¥ ¹æÇâ¿¡¼­ÀÇ Á¢±ÙÀÌ µµ¿òÀÌ µÉÁöµµ ¸ð¸¥´Ù.


2.2.4. ÄÄÆÄÀÏ·¯°¡ »ý¼ºÇÑ Äڵ忡 ´ëÇÑ °íÂû

ÄÄÆÄÀÏ·¯°¡ »ý¼ºÇØ ³½ ¾î¼Àºí¸® Äڵ带 °íÂûÇØ º¸¾Æ¾ß ÇÒ ¸¹Àº ÀÌÀ¯°¡ ÀÖ´Ù. ¿©·¯ºÐÀÌ ÇØ¾ß ÇÒ ÀÏÀº

  • ÄÄÆÄÀÏ·¯°¡ »ý¼ºÇÑ Äڵ尡 ¼öÀÛ¾÷À¸·Î ¸¸µç ¾î¼Àºí¸® Äڵ庸´Ù ´õ ³ªÀºÁö Á¤¸» °Ë»çÇØ º¼ °Í (¶Ç´Â, ÄÄÆÄÀÏ·¯ÀÇ ¿É¼ÇÀ» ¸Å¿ì ¼¼¹ÐÇÏ°Ô Á¶Á¤ÇØ º¼ °Í)

  • ±×·² °æ¿ì (¿ªÀÚ ÁÖ:ÄÄÆÄÀÏ·¯°¡ »ý¼ºÇÑ Äڵ尡 ¸¶À½¿¡ µéÁö ¾Ê´Â´Ù´Â »ý°¢ÀÌ µé¶§) óÀ½ºÎÅÍ ¿ÏÀüÈ÷ ¼ÕÀ¸·Î ¸¸µå´Â °Í º¸´Ù ÄÄÆÄÀÏ·¯°¡ »ý¼ºÇÑ ¹Ù·Î ±× Äڵ带 ¼öÁ¤ÇÏ´Â °ÍÀ¸·Î ÃÖÀûÈ­Ç϶ó

  • º¸´Ù ÀϹÝÀûÀ¸·Î À̾߱âÇؼ­, ÄÄÆÄÀÏ·¯°¡ ¸¸µé¾î³½ Äڵ带 ´ÜÁö, ¿©·¯ºÐÀÇ ¾î¼Àºí¸® ·çƾ°ú ¿ÜºÎ ·çƾÀÇ ÀÎÅÍÆäÀ̽º¸¸ Á¦°øÇÏ´Â »À´ë¸¸ »ý¼ºµÈ ½ºÅÓ(stub) ÄÚµå·Î °£ÁÖÇÏ°í ÀÛ¾÷Ç϶ó.

  • (±×·² ÀÏÀº º°·Î ¾ø°ÚÁö¸¸)¿©·¯ºÐÀÇ ÄÄÆÄÀÏ·¯°¡ »ý¼ºÇÑ Äڵ带 µû¶ó ÀÐ¾î ³»·Á°¡¸é¼­ ¹ö±×¸¦ ãµµ·Ï Ç϶ó.(track down bugs in your compiler (hopefully the rarer))

°á·ÐÀûÀ¸·Î, ¾î¼Àºí¸®·Î ÄÚµùÇϴ ǥÁØ(?)ÀûÀÎ ¹æ¹ýÀº ¿©·¯ºÐÀÇ ÄÄÆÄÀÏ·¯¿¡(gcc ÀÏ °ÍÀ̶ó°í °¡Á¤ÇÏ°í..) -S ¿É¼ÇÀ» ÁÖ°í c µîÀ¸·Î ÀÛ¼ºµÈ ÇÁ·Î±×·¥À» ÄÄÆÄÀÏÇؼ­ »ý¼ºµÈ ¾î¼Àºí¸® Äڵ带 »ç¿ëÇؼ­ ÇÁ·Î±×·¥À» ¸¸µå´Â °ÍÀÌ´Ù. ´ëºÎºÐÀÇ À¯´Ð½º °è¿­¿¡¼­ »ç¿ëµÇ´Â ÄÄÆÄÀÏ·¯·Î °¡´ÉÇÏ´Ù. gcc ¸¦ »ç¿ëÇÒ °æ¿ì, -fverbose-asm ¿É¼Çµµ ÁØ »óÅ¿¡¼­ ÄÄÆÄÀÏÇÑ´Ù¸é, º¸´Ù ¾Ë±â½¬¿î ¾î¼Àºí¸® Äڵ带 »ý»êÇÒ °ÍÀÌ´Ù. ¹°·Ð, ÈǸ¢ÇÑ(!) ¾î¼Àºí¸® Äڵ带 ¾ò±â¸¦ ¿øÇÑ´Ù¸é, ¿©·¯ºÐÀÌ Æò¼Ò¿¡ »ç¿ëÇÏ´ø ÃÖÀûÈ­ ¿É¼Ç°ú ÈùÆ®¸¦ ÄÄÆÄÀÏ·¯¿¡ ÁÖ´Â °ÍÀ» ÀØÁö ¸»¶ó.


2.3. ¸®´ª½º¿Í ¾î¼Àºí¸®

¿©·¯ºÐµµ ´«Ä¡ÃªÀ» Å×Áö¸¸, ÀϹÝÀûÀ¸·Î, ¸®´ª½º¿¡¼­ ÇÁ·Î±×·¡¹ÖÀ» Çϸ鼭 ¾î¼Àºí¸®¸¦ »ç¿ëÇÒ ÇÊ¿ä´Â ¾ø´Ù. ¸®´ª½º´Â µµ½º¿Í´Â ´Þ¶ó¼­, µå¶óÀ̹ö¿Í °°Àº °ÍµéÀ» ¾î¼Àºí¸®·Î ÀÛ¼ºÇÒ ÇÊ¿ä´Â ¾ø´Ù (À½.. ¸¸¾à ¿©·¯ºÐÀÌ ¾î¼Àºí¸®·Î ¸¸µé°Ú´Ù¸é ÇÒ ¼ö ¾øÁö¸¸ ¸»ÀÌ´Ù) ±×¸®°í, ¿À´Ã³¯ÀÇ ÁÁÀº ÄÄÆÄÀÏ·¯µéÀ» ÀÌ¿ëÇÑ´Ù¸é, ¼­·Î ´Ù¸¥ ÇÁ·Î¼¼¼­µéÀ» Ÿ°ÙÀ¸·Î °¢°¢ ¼öÇà¼ÓµµÀÇ ÃÖÀûÈ­¸¦ Çϱ⸦ ¿øÇÏ´õ¶óµµ, c ¾ð¾î¸¦ »ç¿ëÇؼ­ ÇÁ·Î±×·¡¹ÖÇÏ´Â °ÍÀÌ ¾î¼Àºí¸®·Î ÇÏ´Â °Íº¸´Ù ´õ ½±´Ù. ±×·¯³ª... ±×·³¿¡µµ ºÒ±¸ÇÏ°í, c ³ª c++ º¸´Ù ¾î¼Àºí¸®°¡ ´õ ÀûÀýÇÑ °æ¿ì°¡ ÀÖÀ» °ÍÀÌ´Ù.

¿©·¯ºÐÀÌ ¾î¼Àºí¸® ÇÁ·Î±×·¡¹ÖÀ» ÇÊ¿ä·Î Çϰųª, ȤÀº ¾î¼Àºí¸® ¾ð¾î¸¦ »ç¿ëÇϱ⸦ ¿øÇÒÁöµµ ¸ð¸¥´Ù. °£´ÜÈ÷ ¾ê±âÇؼ­, ¾î¼Àºí¸®ÀÇ ¹Ì±ÃÀ¸·Î ¶Ù¾îµé¾î¾ß ÇÏ´Â °æ¿ì´Â ¸Å¿ì ÀÛÀº Äڵ尡 ÇÊ¿äÇϰųª libc ¿¡ µ¶¸³ÀûÀÎ, Áï, ¶óÀ̺귯¸®¸¦ ÇÊ¿ä·Î ÇÏÁö ¾Ê´Â ÇÁ·Î±×·¥À» ¸¸µé¾î¾ß ÇÏ´Â Á».. ºñÁ¤»óÀûÀÎ(?) °æ¿ì ¹Û¿¡´Â ¾ø´Ù. ±×¸®°í, °¡Àå ÀÚÁÖ º¸°Ô µÇ´Â ±×·¯ÇÑ °æ¿ì´Â, ½ÅÈ­½Ã´ëÀÇ(!) Àü¼³ÀûÀÎ ±¤±âÀÇ ÇØĿó·³ µÇ°í ½Í¾îÇÏ´Â »ç¶÷ÀÇ °æ¿ìÀÌ´Ù. ±×·± »ç¶÷Àº ÁÖ·Î ½º¹«»ì °¡·®ÀÇ, ¸ðµç°ÍÀ» ÀÚ½ÅÀÌ ´Ù ¾Ë¾Æ¾ß ÇÏ°í, ¸ðµç°ÍÀ» ½º½º·Î ÇÏ°í ½Í¾îÇÏ°í, ¸ðµç°ÍÀ» ¾î¼Àºí¸®·Î ÇÏ°í ½Í¾îÇÏ´Â »ç¶÷ÀÌ ¸¹´Ù. :-) (¿ªÀÚ ÁÖ:¿ªÀÚÀÇ ÀÇ¿ªÀÌ ³Ê¹«(!) ¸¹¾Ò½À´Ï´Ù. ¾Æ·¡¿¡ - ±×·¡¿ÔµíÀÌ - ¿ø¹®À» º¸ÀÔ´Ï´Ù.

You may need to use assembly, or you may want to use assembly. In short, main practical (need) reasons of diving into the assembly realm are small code and libc independence. Impractical (want), and the most often reason is being just an old crazy hacker, who has twenty years old habit of doing everything in assembly language.

±×·¯³ª, ¿©·¯ºÐÀÌ ¸®´ª½º¸¦ ÀÓº£µðµå ½Ã½ºÅÛ¿¡ Æ÷ÆÃÇÏ·Á´Â °æ¿ì, Àüü ÇÁ·Î±×·¥ÀÇ Å©±â¿¡ »ó´çÈ÷ ¿¹¹ÎÇØ ÁúÅÙµ¥, Áï, Ä¿³Î, libc, À¯Æ¿¸®Æ¼µé(file|find|text|sh|etc.) ÀüºÎ¸¦ ´ÜÁö ¸î¹é kb ÀÇ ÀÛÀº Å©±â¿¡ ¸ÂÃß¾î ³ÖÀ»·Á°í ÇÏ°í, 1ų·Î¹ÙÀÌÆ®°¡ ´Ã¾î³¯ ¶§¸¶´Ù ½Ã½ºÅÛ »ý»ê ºñ¿ëÀÌ ³Ê¹« ¸¹ÀÌ µé ¶§°¡ ÀÖÀ» °ÍÀÌ´Ù. ±×·² °æ¿ì¿¡´Â ½Ã½ºÅÛÀÇ ÀϺΠȤÀº ÀüºÎ¸¦ ¾î¼Àºí¸®·Î ÀçÀÛ¼ºÇÏ´Â °Íµµ ÇÑ ¹æ¹ýÀÌ µÉ ¼ö ÀÖ´Ù. ±×¸®°í, ±×·¸°Ô ÇÑ´Ù¸é, »çÀÌÁî´Â °¨µ¿ÀûÀ¸·Î(! Á¤¸»·Î) ÀÛ¾ÆÁú °ÍÀÌ´Ù. ¿¹¸¦ Çϳª µé¾îº¸ÀÚ. ¾î¼Àºí¸®·Î °£´ÜÇÑ httpd µ¥¸óÀ» ¸¸µé¸é 600¹ÙÀÌÆ® ÀÌÇÏ·Î ¸¸µé¾îÁú ¼ö ÀÖ´Ù. ±×·¯¸é, ¿©·¯ºÐÀº Ä¿³Î°ú, httpd ¸¦ žÀçÇÑ À¥¼­¹ö¸¦ 400 kb ȤÀº º¸´Ù ´õ ÀÛÀº »çÀÌÁî·Î ¸¸µé ¼ö ÀÖ°Ô µÈ´Ù.


3장. °¡¿ëÇÑ ¾î¼Àºí·¯µé

3.1. GCC ÀζóÀÎ ¾î¼Àºí·¯

¾ÆÁÖ À¯¸íÇÑ GNU C/C++ ÄÄÆÄÀÏ·¯ÀÎ GCC ÀÌ´Ù. ÀÌ ÄÄÆÄÀÏ·¯´Â GNU ÇÁ·ÎÁ§Æ®ÀÇ ÇÙ½ÉÀÌ µÇ´Â 32ºñÆ® ÄÄÆÄÀÏ·¯ÀÌ´Ù. ¸Å¿ì, ¸Å¿ì(!) ÁÁÀº Äڵ带 »ý»êÇϸç, x86 ¾ÆÅ°ÅØÃÄÀÇ ÇÁ·Î¼¼¼­ ¶ÇÇÑ ¸Å¿ì Àß Áö¿øÇÑ´Ù. ÀÌ ÄÄÆÄÀÏ·¯¿¡´Â C ÇÁ·Î±×·¥ ÄÚµå Áß°£¿¡ ÀζóÀÎ ¾î¼Àºí¸®¸¦ »ðÀÔÇÒ ¼ö ÀÖ´Â ±â´ÉÀ» °¡Áö°í Àִµ¥, À̸¦Å׸é, ·¹Áö½ºÅÍ ÇÒ´ç°ú °°Àº °ÍÀ» gcc °¡ ½º½º·Î ÇÏ°Ô Çϰųª, ¶Ç´Â ÇÁ·Î±×·¡¸Ó°¡ ¿øÇÏ´Â ´ë·Î Á¶Á¤Çؼ­, ¿øÇÏ´Â ·¹Áö½ºÅ͸¦ ÇÒ´çÇÏ°Ô ÇÒ ¼öµµ ÀÖ´Ù. °Ô´Ù°¡, gcc ´Â °ÅÀÇ ´ëºÎºÐÀÇ Ç÷§Æû¿¡¼­ »ç¿ë°¡´ÉÇÏ´Ù. ¸®´ª½º, *BSD, VSTa, OS/2, *DOS, Win* µî°ú °°ÀÌ ±¤¹üÀ§ÇÑ ¿î¿µÃ¼Á¦¿¡¼­ »ç¿ë °¡´ÉÇÏ´Ù.


3.1.1. GCC ¸¦ ¾îµð¼­ ±¸ÇÒ °ÍÀΰ¡?

°¡Àå ÁÖµÈ »çÀÌÆ®´Â GNU ÀÇ FTP »çÀÌÆ® ( ftp://prep.ai.mit.edu/pub/gnu/gcc/) ÀÌ´Ù. ÀÌ »çÀÌÆ®´Â GNU ÇÁ·ÎÁ§Æ®ÀÇ »ê¹°ÀÎ ¸¹Àº ÀÚÀ¯ ¼ÒÇÁÆ®¿þ¾îµéÀÌ ÄÄÆÄÀÏµÈ ÇüÅ ȤÀº ¼Ò½ºÀÇ ÇüÅ·Π¹ßÇ¥µÇ´Â °÷ÀÌ´Ù. ¸®´ª½º¿¡ ¸ÂÃç¼­ ¼³Á¤ ¹× ÄÄÆÄÀÏµÈ ¹öÁ¯µéÀº ftp://metalab.unc.edu/pub/Linux/GCC/ ¿¡¼­ ãÀ» ¼ö ÀÖ´Ù. ¶ÇÇÑ, ¼¼°è °¢Ã³¿¡ FTP ¹Ì·¯ »çÀÌÆ®µéÀÌ ÀÖ´Ù. ¿øÇÑ´Ù¸é, CD-ROM À¸·Îµµ ±¸ÇÒ ¼ö ÀÖ´Ù.

GCC ÀÇ °³¹ßÀº ÀÏÀü¿¡ GCC2.8 °ú EGCS ÆÐÅ°ÁöÀÇ µÎ°³ÀÇ °¡Áö·Î ³ª´©¾îÁ³¾ú´Ù. ±×·¯³ª ÃÖ±Ù¿¡ ¿Í¼­ ÀÌ µÎ ÆÐÅ°Áö´Â ÅëÇյǾ °³¹ß ¹× ¹èÆ÷µÇ°í ÀÖ´Ù. ÇöÀç GCC ÀÇ À¥ÆäÀÌÁö´Â http://gcc.gnu.org ÀÌ´Ù.

¿©·¯ºÐÀÌ Áñ°Ü »ç¿ëÇÏ´Â ¿î¿µÃ¼Á¦¸¦ Ÿ°ÙÀ¸·Î ¸¸µé¾îÁø ¼Ò½º³ª ¹ÙÀ̳ʸ® ¶ÇÇÑ ¿©·¯ºÐÀÌ ÀÚÁÖ °¡´Â ¿©·¯ºÐ ¿î¿µÃ¼Á¦ÀÇ FTP »çÀÌÆ®µé¿¡¼­ ãÀ» ¼ö ÀÖÀ» °ÍÀÌ´Ù.

GCC ÀÇ DOS ¹öÁ¯Àº DJGPP ¶ó°í ºÒ¸®¿ì´Âµ¥, http://www.delorie.com/djgpp/ ¿¡¼­ ±¸ÇÒ ¼ö ÀÖ´Ù.

¶ÇÇÑ Win32 ¿ëÀÇ GCC Æ÷Æ®µµ ÀÖ´Ù : cygwin ( http://sourceware.cygnus.com/cygwin/) °ú mingw (http://www.mingw.org) °¡ ±×°ÍÀÌ´Ù.

½ÉÁö¾î OS/2 ¿ëÀÇ GCC Æ÷Æ®µµ ÀÖ´Ù. ÀÌ°ÍÀº EMX ¶ó°í ºÒ¸®¿î´Ù. ±¸ÇÒ ¼ö ÀÖ´Â URL Àº ´ÙÀ½°ú °°´Ù. ftp://ftp-os2.cdrom.com/pub/os2/emx09c/. ¿©±â¼­ ±¸ÇÒ ¼ö ÀÖ´Â EMX ´Â µµ½º¿¡¼­µµ ÀÛµ¿Çϸç, ÆÐÅ°Áö¿¡´Â À¯´Ð½º ¿¡¹Ä·¹À̼ÇÀ» À§ÇÑ ¸ñÀûÀº ¶óÀ̺귯¸® ·çƾµµ Æ÷ÇԵǾî ÀÖ´Ù. ¾ÕÀÇ »çÀÌÆ®¿¡¼­ ¿©±âÀú±â¸¦ µÑ·¯º¸°í ã¾Æ º¸¶ó.

There is also an OS/2 port of GCC called EMX; it works under DOS too, and includes lots of unix-emulation library routines.


3.1.2. GCC ÀζóÀÎ ¾î¼Àºí·¯¿¡ °üÇÑ ¹®¼­¸¦ ¾îµð¼­ ãÀ» ¼ö Àִ°¡

GCC ¹®¼­´Â TeXinfo Æ÷¸äÀ¸·Î ¹®¼­ÆÄÀϵéÀ» Æ÷ÇÔÇÑ´Ù. ¿©·¯ºÐÀº ±× ¹®¼­µéÀº TeX À» ÀÌ¿ëÇÏ¿© ÄÄÆÄÀÏÇØ Ãâ·ÂÇØ º¼ ¼öµµ ÀÖ°í, .info ÆÄÀÏ·Î º¯È¯Çؼ­ emacs ¿¡¼­ ºê¶ó¿ì¡ Çϸ鼭 ÀÐÀ»¼öµµ ÀÖ´Ù. ¶Ç´Â, .html ÆÄÀÏ·Î º¯È¯ÇÏ¿© À¥ ºê¶ó¿ìÀú¿¡¼­ ÀÐÀ» ¼öµµ ÀÖ°í... ±âŸ ¿©·¯ºÐµéÀÌ ÁÁ¾ÆÇÏ´Â Æ÷¸äÀ¸·Î º¯È¯ÇÒ ¼ö ÀÖ´Ù. .info ÆÄÀÏÀº GCC¸¦ Á¦´ë·Î ¼³Ä¡Çß´Ù¸é ÇÔ²² ¼³Ä¡µÇ¾úÀ» °ÍÀÌ´Ù.

¿©·¯ºÐÀÌ Á¤º¸¸¦ ¾ò±â À§Çؼ­ ã¾Æ¾ß ÇÒ ¼½¼ÇÀº C Extensions::Extended Asm:: ¼½¼ÇÀÌ´Ù.

¶ÇÇÑ, Invoking GCC::Submodel Options::i386 Options:: ¼½¼Ç¿¡ ÀÖ´Â ³»¿ëµµ »ó´çÈ÷ À¯¿ëÇÒ °ÍÀÌ´Ù. ƯÈ÷³ª ÀÌ ¼½¼ÇÀ» ÀÚ¼¼È÷ »ìÆ캸¸é, i386 °è¿­ÀÇ ·¹Áö½ºÅ͸¦ À§ÇØ ±ÔÁ¤µÈ À̸§¿¡ ´ëÇÑ Á¤º¸¸¦ ¾òÀ» ¼ö Àִµ¥ : abcdSDB °¡ °¢°¢ %eax, %ebx, %ecx, %edx, %esi, %edi, %ebp °ú Çϳª¾¿ ÀÏÄ¡ÇÏ°Ô µÈ´Ù. (´Ü %esp ¿¡ ÇØ´çÇÏ´Â °ÍÀº ¾øÀ½),

À¥ÀÇ DJGPP °ÔÀÓÁî ¸®¼Ò½º ÆäÀÌÁö¿¡ ¾î¼Àºí¸®¿¡ °üÇÑ ³»¿ëÀÌ ¸Å¿ì ¸¹ÀÌ ÀÖ¾ú´Âµ¥... Áö±ÝÀº ¼­¹ö°¡ Á×¾î ÀÖ´Â°Í °°´Ù. ±×·¯³ª, ÀÚ·á´Â DJGPP »çÀÌÆ® ¿¡ º¹±¸µÇ¾î ÀÖ´Ù. ÀÌ »çÀÌÆ®¿¡´Â ´Ù¸¥ À¯¿ëÇÑ Á¤º¸µéµµ ¸¹ÀÌ Á¸ÀçÇÑ´Ù : http://www.delorie.com/djgpp/doc/brennan/, ¶ÇÇÑ, Á¤¸» À¯¿ëÇÑ ÀÚ·áÀÎ DJGPP Quick ASM Programming Guide µµ ã¾Æº¼ ¼ö ÀÖ´Ù.

GCC ´Â ¾î¼Àºí¸® ¼Ò½º¸¦ ¾î¼Àºí Çϱâ À§Çؼ­ GAS ¿¡ ÀÇÁ¸Çϸç, GAS ÀÇ ¹®¹ýÀ» µû¸¥´Ù(¾Æ·¡¸¦ º¸¶ó:) ÀζóÀÎ ¾î¼Àºí¸®¸¦ ¾µ ¶§, ÆÛ¼¾Æ® ¹®ÀÚ´Â µû¿ÈÇ¥·Î µÑ·¯½Î¾ß ÇÑ´Ù´Â °ÍÀ» ¸í½ÉÇ϶ó. ÆÛ¼¾Æ® ¹®ÀÚ´Â GAS ·Î ³Ñ°ÜÁö°Ô µÈ´Ù. ÀÚ¼¼ÇÑ ³»¿ëÀº ¾Æ·¡ÀÇ GAS ¿¡ °ü·ÃµÈ ¼½¼ÇÀ» º¸¶ó.

±×¸®°í, Á¤¸» À¯¿ëÇÑ ¿¹Á¦µéÀÇ ÁýÇÕüÀÎ linux/include/asm-i386/ µð·ºÅ丮 ¾Æ·¡¸¦ »ìÆ캸¶ó. ¶ÇÇÑ, ¸®´ª½º Ä¿³ÎÀÇ ¼­ºêµð·ºÅ丮µéµµ »ìÆ캸µµ·Ï Ç϶ó. À¯¿ëÇÑ ¿¹Á¦µéÀ» Á¤¸»·Î ¸¹ÀÌ ¾òÀ» ¼ö ÀÖÀ» °ÍÀÌ´Ù.


3.1.3. GCC ¸¦ ÀÌ¿ëÇÏ¿© ÀζóÀÎ ¾î¼Àºí¸® Äڵ带 »ý¼ºÇϱâ

Ä¿³Î Çì´õµé¿¡¼­ ã¾Æº¼ ¼ö ÀÖ´Â ¾î¼Àºí¸® ·çƾµéÀº extern inline ÇÔ¼öµé ³»ºÎ¿¡ µé¾î°¡ Àֱ⠶§¹®¿¡, (¸¸¾à ¿©·¯ºÐÀÌ ¿©·¯ºÐÀÌ ¸¸µç Çì´õÆÄÀÏÀ» °¡Áö°í ÀÖÀ¸¸ç, ¿©·¯ºÐÀÇ ¾î¼Àºí¸® Äڵ带 ¸®´ª½º Ä¿³ÎÀÇ ±×°Íó·³ ¸í·áÇÏ°Ô ÀÛ¼ºÇÏ°í ½Í´Ù¸é ¿©·¯ºÐµµ ±×ó·³ ÇÏ¸é µÈ´Ù) ÀÌµé ·çƾµéÀÌ »ç¿ë°¡´ÉÇÏ°Ô Çϱâ À§Çؼ­ GCC ´Â ¹Ýµå½Ã -O Ç÷¡±×¿Í ÇÔ²² ½ÇÇàµÇ¾î¾ß ÇÑ´Ù. (¶Ç´Â -O2, -O3 µî°ú °°Àº ¿É¼Ç°ú ÇÔ²² ½ÇÇàµÇ¾î¾ß ÇÑ´Ù.) ±×·¸°Ô ÇÏÁö ¾ÊÀ¸¸é, ¿©·¯ºÐÀÇ ÄÚµå´Â ÄÄÆÄÀϵɷ±Áö´Â ¸ô¶óµµ, Á¦´ë·Î ¸µÅ©µÇÁö´Â ¾ÊÀ» °ÍÀÌ´Ù. ¿Ö³ÄÇϸé, ÇÁ·Î±×·¥ÀÌ ¸µÅ©µÉ ¶§, ¸µÄ¿´Â ÀζóÀÎÀÌ ¾Æ´Ñ extern ÇÔ¼öµéÀ» ¿©·¯ºÐÀÇ ÇÁ·Î±×·¥ÀÌ ¸µÅ©µÉ ¶óÀ̺귯¸®¿¡¼­ ã±â ¶§¹®ÀÌ´Ù. ¶Ç ´Ù¸¥ ¹æ¹ýÀº ·çƾµéÀÇ fallback ¹öÁ¯ÀÌ Á¸ÀçÇÏ´Â ¶óÀ̺귯¸®¿Í ¸µÅ©½ÃÅ°´Â °ÍÀÌ´Ù.

Because assembly routines from the kernel headers (and most likely your own headers, if you try making your assembly programming as clean as it is in the linux kernel) are embedded in extern inline functions, GCC must be invoked with the -O flag (or -O2, -O3, etc), for these routines to be available. If not, your code may compile, but not link properly, since it will be looking for non-inlined extern functions in the libraries against which your program is being linked! Another way is to link against libraries that include fallback versions of the routines.

ÀζóÀÎ ¾î¼Àºí¸®°¡ »ç¿ëÇϱ⠽ȴٸé, -fno-asm Ç÷¡±×¸¦ ÁÖ¸é µÈ´Ù. ±×·¸°Ô Çϸé, ÄÄÆÄÀÏ·¯´Â È®Àå ¹®¹ýÀÎ ÀζóÀÎ ¾î¼Àºí¸®°¡ ¹ß°ßµÇ¾úÀ» °æ¿ì, Á¾·áÇÏ°Ô µÈ´Ù. ±×·¸Áö ¾ÊÀ¸¸é, ¸µÄ¿°¡ ÀνÄÇÏÁö ¸øÇÏ´Â ¿ÜºÎÇÔ¼öÀÎ asm() ÇÔ¼ö¿¡ ´ëÇÑ È£ÃâÀ» »ý¼ºÇÏ°Ô µÇ¾î¹ö¸°´Ù. (¹ø¿ªÀÌ Á» ÀÌ»óÇϳ׿ä... -_-a) ±× ¹Ý´ëÀÇ Ç÷¡±×´Â -fasm ¿É¼ÇÀ¸·Î½á, asm Å°¿öµå¿¡ ´ëÇÑ Ãë±Þ¹æ¹ýÀ» º¹±¸ÇÑ´Ù(?)

which will have the compiler die when using extended inline asm syntax, or else generate calls to an external function named asm() that the linker can't resolve. To counter such flag, -fasm restores treatment of the asm keyword.

º¸´Ù ÀϹÝÀûÀÎ °ÍÀ¸·Î½á, x86 Ç÷§Æû¿¡¼­ ½ÇÇàµÇ´Â gcc ¿¡ ¸Å¿ì À¯¿ëÇÑ Ç÷¡±×°¡ Àִµ¥, ¹Ù·Î

gcc -O2 -fomit-frame-pointer -W -Wall

ÀÌ´Ù. -O2 ´Â ÀϹÝÀûÀ¸·Î, ¾µ¸¸ÇÑ ÃÖÀûÈ­ ·¹º§ÀÌ´Ù. ±× ¿ÜÀÇ ÃÖÀûÈ­ ·¹º§Àº ÄÄÆÄÀÏÇϴµ¥ ½Ã°£ÀÌ ´õ ¿À·¡ ±Û¸®°í, ´õ Å« Äڵ带 »ý»êÇÑ´Ù. ±×·³¿¡µµ ºÒ±¸ÇÏ°í, »ý¼ºµÈ ÄÚµåÀÇ ¼öÇ༺´ÉÀº ¾à°£ ´õ »¡¶óÁú »ÓÀÌ´Ù. °úµµÇÑ ÃÖÀûÈ­ ¿É¼ÇÀ» Á־ È¿°úÀûÀÎ °ÍÀº ¸Å¿ì ŸÀÌÆ®ÇÑ ·çÇÁ°¡ ÀÖÀ»¶§ »ÓÀÌ´Ù. ¿©·¯ºÐÀÌ Á¤¸», °­·ÂÇÑ(!) ÃÖÀûÈ­ ÄÄÆÄÀÏÀ» ÇÊ¿ä·Î ÇÏ´Â °æ¿ì¿¡´Â -O6 ÀÇ ·¹º§±îÁö »ç¿ëÇÏ´Â °ÍÀº °í·ÁÇØ º½Á÷ÇÏ´Ù.

-fomit-frame-pointer ¿É¼ÇÀº ¾µµ¥¾ø´Â frameÆ÷ÀÎÅÍ(¿ªÀÚÁÖ : stack ÀÇ ³»¿ëÀ» º¹±¸ÇÏ´Â °Í°ú °ü·ÃµÇ¾î¼­ ÄÄÆÄÀÏ·¯ ³»ºÎÀûÀ¸·Î »ý¼ºÇÏ´Â Æ÷ÀÎÅÍÀÔ´Ï´Ù.) ¸¦ À¯ÁöÇÏ´Â Äڵ带 »ý¼ºÇÏÁö ¾Êµµ·Ï ÇÑ´Ù. ±×·¸°Ô ÇÏ¸é »ý¼ºµÈ ¾î¼Àºí¸® ÄÚµå´Â º¸´Ù ÀÛ°í, ºü¸¥ °ÍÀÌ µÇ¸ç, ´õ ³ªÀº ÃÖÀûÈ­¸¦ À§ÇÑ ·¹Áö½ºÅ͵éÀÇ È®º¸¸¦ °¡´ÉÇÏ°Ô ÇØ ÁØ´Ù. ´Ü, µð¹ö±ë Åø (gdb ¿Í °°Àº..) À» »ç¿ëÇÑ µð¹ö±ëÀÌ ºÒ°¡´ÉÇØÁø´Ù.

-W -Wall ¿É¼ÇÀº À¯¿ëÇÑ °æ°í¸Þ¼¼ÁöµéÀ» ¹ß»ý½ÃÅ°µµ·Ï ÇÑ´Ù. °æ°í¸Þ¼¼Áö¸¦ ÅëÇØ ¿©·¯ºÐÀº Ȥ½Ã ¹ß»ýÇÒÁöµµ ¸ð¸¦ ¾î¸®¼®Àº ¿¡·¯µéÀ» ¹Ì¸® üũÇÒ ¼ö ÀÖ°Ô ÇÑ´Ù.

¿©·¯ºÐÀº ÀÏ·ÃÀÇ ÇÁ·Î¼¼¼­ Á¾¼ÓÀûÀÎ ÃÖÀûÈ­ ¿É¼ÇÀ» ÁÙ ¼ö Àִµ¥, ¿¹¸¦ µé¸é, -m486 µî°ú °°Àº ¿É¼ÇÀÌ ±×°ÍÀÌ´Ù. ±×·¯ÇÑ CPU ƯÁ¤ÀÇ ¿É¼ÇÀ» ÁÜÀ¸·Î½á, GCC ´Â ¿©·¯ºÐÀÌ Å¸°ÙÀ¸·Î »ï´Â ÇÁ·Î¼¼¼­¿¡ º¸´Ù ´õ Àß ¸Â°í, ÃÖÀûÈ­µÈ Äڵ带 ¸¸µé¾î ÁÙ °ÍÀÌ´Ù. ¶ÇÇÑ, ÃÖ±ÙÀÇ GCC ´Â -mpentium °ú °°Àº Ç÷¡±×µµ °¡Áö°Ô µÇ¾ú´Ù. (GCC 2.7.x ¶Ç´Â ±× ÀÌÇÏÀÇ ¹öÁ¯¿¡¼­´Â Áö¿øÇÏÁö ¾Ê´Â´Ù.) ¶ÇÇÑ PGCC, ¼ÒÀ§ ÆæƼ¾ö GCC ¶ó´Â °ÍÀº ´õ ¸¹Àº ¿É¼ÇµéÀ» °¡Áö°í ÀÖ´Ù. ±¸ÇÒ ¼ö ÀÖ´Â Àå¼Ò´Â ´ÙÀ½°ú °°´Ù : http://goof.com/pcg/ ÀÌó·³ ƯÁ¤ ÇÁ·Î¼¼¼­¿¡ ÃÖÀûÈ­ ½ÃÅ°´Â Ç÷¡±×µéÀº ¸®´ª½ºÀÇ Ä¿³ÎÀ» ÄÄÆÄÀÏ ÇÒ ¶§ º¼ ¼ö ÀÖÀ» °ÍÀÌ´Ù. ¿©·¯ºÐÀÇ GCC ¿¡ µþ·Á¿Â TeXInfo ¹®¼­¸¦ È®ÀÎÇÏ¸é º¸´Ù ¸¹Àº Á¤º¸¸¦ ¾òÀ» ¼ö ÀÖ´Ù.

-m386 ¿É¼ÇÀº ÄÚµåÀÇ Å©±â¸¦ ÃÖÀûÈ­½Ãų ¼ö ÀÖµµ·Ï ÇØÁØ´Ù. ±×°ÍÀÌ Áß¿äÇÑ ÀÌÀ¯´Â ¸Þ¸ð¸® »ç¿ëÀ²ÀÌ ¸Å¿ì ³ôÀº ÄÄÇ»Å͵鿡¼­ ¼Óµµ¿¡ ÃÖÀûÈ­µÇ¾úÁö¸¸, ±× ÃÖÀûÈ­·Î ÀÎÇØ Å©±â°¡ ¸Å¿ì Å« ÇÁ·Î±×·¥À» ½ÇÇà½ÃŲ´Ù¸é, ½ÊÁßÆȱ¸ ½º¿ÍÇÎÀÌ ¹ß»ýÇÏ°Ô µÇ¸ç, ±×·Î ÀÎÇØ ¿ø·¡ÀÇ ¸ñÀûÀÎ ºü¸¥ ¼ÓµµÀÇ È¿°ú¿¡ ¹ÝÇÏ´Â ÀÏÀÌ ¹ß»ýÇÑ´Ù. ÀÌ·² °æ¿ì¿¡´Â, C ¸¦ ¾²´Â °Í º¸´Ù, ÄÚµåÀÇ ºÐÇÒ(?)À» ±¸ÇöÇÑ ¾ð¾î (functional language ȤÀº FORTH ¶ó°í ºÒ¸®¿ì´Â ¾ð¾î¸¦ »ç¿ëÇؼ­, ¹ÙÀÌÆ®Äڵ峪 ¿öµåÄڵ忡 ±âÃÊÇÑ ±¸ÇöÀ» Çϵµ·Ï Ç϶ó.)

In such settings, it might be useful to stop using C, and use instead a language that favors code factorization, such as a functional language and/or FORTH, and use a bytecode- or wordcode- based implementation.

¿©·¯ºÐÀº ÃÖÀûÈ­ ¿É¼ÇÀ» ÆÄÀϺ°·Î ´Ù ´Ù¸£°Ô ÁöÁ¤ÇÒ ¼ö ÀÖ´Ù. ±×·¡¼­, ¸Å¿ì ÁÁÀº ¼º´ÉÀÌ ¿ä±¸µÇ´Â ·çƾÀ» ´ã°í ÀÖ´Â ÆÄÀÏ¿¡´Â ÃÖ°í ·¹º§ÀÇ ¼Óµµ¸¦ ³¾ ¼ö ÀÖµµ·Ï ÃÖÀûÈ­¸¦ ¼öÇàÇÏ°í, ´Ù¸¥ ÆÄÀÏ¿¡´Â »ý¼ºµÇ´Â ÄÚµåÀÇ Å©±â¸¦ ÀÛ°Ô ÇÏ´Â ¹æÇâÀ¸·Î ÃÖÀûÈ­ÇÒ ¼öµµ ÀÖ´Ù´Â °ÍÀ» À¯³äÇ϶ó.

Á» ´õ ³ªÀº ÃÖÀûÈ­¸¦ ½ÃÅ°·Á¸é -mregparm=2 ¿É¼ÇÀ» »ç¿ëÇϰųª, ÇØ´çÇÏ´Â ÇÔ¼ö Ư¼ºÀ» »ç¿ëÇϴ°ÍÀÌ µµ¿òÀÌ µÉ °ÍÀÌ´Ù. ±×·¯³ª, ´Ù¸¥ ÄÚµå(libcµî°ú °°Àº)ÀÇ ¸µÅ©½Ã¿¡ ¸î°¡Áö ¹®Á¦°¡ ¹ß»ýÇÒ ¼ö ÀÖ´Ù´Â »ç½ÇÀ» ¸í½ÉÇ϶ó(¿ªÀÚÁÖ : ¹ø¿ªÀÌ Á¤¸»-_- ¸Å²ô·´Áö ¸øÇÕ´Ï´Ù.) To optimize even more, option -mregparm=2 and/or corresponding function attribute might help, but might pose lots of problems when linking to foreign code, including libc.

¿ÜºÎÀÇ ÇÔ¼öµéÀ» Á¤È®ÇÏ°Ô ¼±¾ðÇØ ÁÜÀ¸·Î½á, ¿Ã¹Ù¸¥ ¼ø¼­¿¡ µû¸¥ È£ÃâÀÌ ¹ß»ýÇϵµ·Ï Á¶Á¤ÇØ Áְųª, ¿ÜºÎ ¶óÀ̺귯¸®µéÀ» ¿©·¯ºÐÀÌ ¸¸µç ÇÁ·Î±×·¥°ú °°Àº ·¹Áö½ºÅ͸¦ »ç¿ëÇϴ ȣÃâ ÄÁº¥¼ÇÀ» »ç¿ëÇϵµ·Ï ÀçÄÄÆÄÀÏ ÇØ ÁÜÀ¸·Î½á, ¹®Á¦¸¦ ±Øº¹ÇÒ ¼ö Àֱ⵵ ÇÏ´Ù.

There are ways to correctly declare foreign functions so the right call sequences be generated, or you might want to recompile the foreign libraries to use the same register-based calling convention...

/usr/lib/gcc-lib/i486-linux/2.7.2.3/specs À» ÆíÁýÇؼ­ ¿©·¯ºÐÀÇ make ¿¡ À§¿¡¼­ ¼³¸íÇÑ Ç÷¡±×µéÀÌ µðÆúÆ®°¡ µÇµµ·Ï ÇÒ ¼öµµ ÀÖ´Ù.(±×·¯³ª ±× °æ¿ì, -W -Wall ¿É¼ÇÀº µ¡ºÙÀÌÁö ¾Ê´Â °ÍÀÌ ³ªÀº °æ¿ìµµ ÀÖ´Ù.) ¿©·¯ºÐÀÇ ½Ã½ºÅÛ¿¡¼­ GCC specs ÆÄÀÏÀÇ Á¤È®ÇÑ À§Ä¡´Â gcc -v ¸¦ ÇÔÀ¸·Î½á ¾Ë ¼ö ÀÖ´Ù.


3.1.4. ¸ÅÅ©·ÎÀÇ Áö¿ø

GCC ´Â ¿©·¯ºÐÀÌ ¿©·¯ºÐÀÇ ÀζóÀÎ ¾î¼Àºí¸® ÄÚµå ³»¿¡ ·¹Áö½ºÅÍ ±Ô¾à(? - constraints)À» ¸í½ÃÇÏ´Â °ÍÀ» °¡´ÉÇÏ°Ô ÇÕ´Ï´Ù. ±×·³À¸·Î½á, ÃÖÀûÈ­ ÇÒ ¶§ ÄÄÆÄÀÏ·¯°¡ ±× »ç½ÇÀ» Âü°íÇÏ¿© ÀζóÀÎ ¾î¼Àºí¸® Äڵ尡 ÆÐÅϵéÀÇ ÁýÇÕÀ¸·Î »ý¼ºµÇµµ·Ï ÇÕ´Ï´Ù. (-_-; ³Ê¹« ¹ø¿ªÀ» ¸øÇÏ´Â °Å °°±º¿©)

GCC allows (and requires) you to specify register constraints in your inline assembly code, so the optimizer always know about it; thus, inline assembly code is really made of patterns, not forcibly exact code.

µû¶ó¼­ ¿©·¯ºÐÀº ¿©·¯ºÐÀÇ ¾î¼Àºí¸®¸¦ CPP ¸ÅÅ©·Î ¶óµçÁö, ÀζóÀÎÀÇ C ÇÔ¼öµé ³»ºÎ¿¡ Æ÷ÇÔ ½Ãų ¼ö ÀÖ½À´Ï´Ù. ±×·¸°Ô Çϸé, ´©±¸µçÁö, ±× ¾î¼Àºí¸® Äڵ带 Æò¹üÇÑ C ÇÔ¼ö³ª ¸ÅÅ©·Îó·³ »ç¿ëÇÒ ¼ö ÀÖ°Ô µË´Ï´Ù. ÀζóÀÎ ÇÔ¼öµéÀº ¸ÅÅ©·Î¿Í ¸Å¿ì ºñ½ÁÇÏ°Ô º¸ÀÌÁö¸¸, ¶§·Î´Â ´õ¿í ¸íÈ®ÇÏ¿© ¾²±â°¡ ´õ ½±´Ù. ±×·¯³ª, ¸ÅÅ©·Î¸¦ »ç¿ëÇϵç, ÀζóÀÎ ÇÔ¼ö¸¦ ¾²´ø, °è¼Ó Áߺ¹µÈ Äڵ带 ¾²°Ô µÈ´Ù´Â °ÍÀ» ¸í½ÉÇ϶ó. µû¶ó¼­, 1: °ú °°Àº ½ºÅ¸ÀÏÀÇ ·ÎÄà ·¹ÀÌºí¸¸ÀÌ ±×·¯ÇÑ ¾î¼Àºí¸® Äڵ忡¼­ Á¤Àǵǰí, »ç¿ëµÇ¾î¾ß ÇÑ´Ù. ±×·¯³ª, ¸ÅÅ©·Î´Â ·ÎÄà ·¹À̺í·Î Á¤ÀǵÇÁö ¾ÊÀº ·¹À̺íÀÌ ÆĶó¹ÌÅÍ·Î ³Ñ°ÜÁö´Â °ÍÀ» Çã¿ëÇÑ´Ù. (ȤÀº, ¿©·¯ºÐÀº ºÎ°¡ÀûÀÎ ¸ÞŸ ÇÁ·Î±×·¡¹Ö ±â¹ýÀ» »ç¿ëÇÒ ¼ö ÀÖÀ» °ÍÀÌ´Ù.) ¶ÇÇÑ, ÀζóÀÎ ¾î¼Àºí¸® Äڵ带 È®ÀåÇÏ°Ô µÇ¸é, ±× ÄÚµå ¾ÈÀÇ ÀáÀçÀûÀÎ ¹ö±× ¶ÇÇÑ ³ªÅ¸³¯ ¼ö ÀÖ´Ù. ±×·¯¹Ç·Î, ±×·¯ÇÑ ÀζóÀÎ ¾î¼Àºí¸® Äڵ忡¼­ ·¹Áö½ºÅÍ »ç¿ë¹æ¹ýÀ» ÀÌÁßÀ¸·Î °íÂûÇϵµ·Ï Ç϶ó.

Thus, you can make put your assembly into CPP macros, and inline C functions, so anyone can use it in as any C function/macro. Inline functions resemble macros very much, but are sometimes cleaner to use. Beware that in all those cases, code will be duplicated, so only local labels (of 1: style) should be defined in that asm code. However, a macro would allow the name for a non local defined label to be passed as a parameter (or else, you should use additional meta-programming methods). Also, note that propagating inline asm code will spread potential bugs in them; so watch out doubly for register constraints in such inline asm code.

¸¶Áö¸·À¸·Î, C ¾ð¾î ±× ÀÚü°¡ ¾î¼Àºí¸® ÇÁ·Î±×·¡¹ÖÀÇ ¸Å¿ì ÁÁÀº Ãß»óÈ­¶ó´Â °ÍÀ» ¸í½ÉÇÏ°í, C ¸¦ »ç¿ëÇÔÀ¸·Î½á, ¾î¼Àºí¸® ÇÁ·Î±×·¡¹Ö½Ã ¹ß»ýÇÒ ¼ö ÀÖ´Â ¸¹Àº ³­Á¡µé ±Øº¹ÇÏ°í, º¸´Ù ½Å·Úµµ ³ôÀº ÇÁ·Î±×·¥À» ¿©·¯ºÐÀÌ ¸¸µé ¼ö ÀÖ°Ô µÉ °ÍÀÌ´Ù.

Lastly, the C language itself may be considered as a good abstraction to assembly programming, which relieves you from most of the trouble of assembling.


3.2. GAS

GAS ´Â GCC °¡ »ç¿ëÇÏ´Â GNU ¾î¼Àºí·¯ÀÌ´Ù.


3.2.1. ¾îµð¿¡¼­ GAS ¸¦ ãÀ» ¼ö Àִ°¡

GCC ¸¦ ãÀº °÷°ú °°Àº Àå¼Ò¿¡ ÀÖ´Ù. ÆÐÅ°Áö binutils ¾È¿¡ ÆÐŰ¡µÇ¾î ÀÖ´Ù.

ÃÖ½ÅÀÇ GAS ¹öÁ¯Àº HJLu ¿¡¼­ ±¸ÇÒ ¼ö ÀÖ´Ù. url Àº ´ÙÀ½°ú °°´Ù : ftp://ftp.varesearch.com/pub/support/hjl/binutils/.


3.2.2. AT&T ¹®¹ý

GAS °¡ ¿ø·¡ 32-bit ÀÇ À¯´Ð½º ÄÄÆÄÀÏ·¯¸¦ Áö¿øÇϵµ·Ï óÀ½¿¡ °í¾ÈµÇ¾ú±â ¶§¹®¿¡, GAS ´Â Ç¥ÁØ AT&T ¹®¹ýÀ» »ç¿ëÇÑ´Ù. Ç¥ÁØ AT&T ¹®¹ýÀº m68k ¾î¼Àºí·¯ÀÇ ¹®¹ý°ú »ó´çÈ÷ À¯»çÇÏ´Ù. ÇöÀç UNIX °è¿­ ¾î¼Àºí¸®ÀÇ Ç¥ÁØ ¹®¹ýÀ̱⵵ ÇÏ´Ù. ÀÌ ¹®¹ýÀº Intel ¹®¹ý¿¡ ºñÇؼ­ ÁÁÁöµµ ¾Ê°í, ³ª»ÚÁöµµ ¾Ê´Ù. ´ÜÁö ´Ù¸¦ »ÓÀÌ´Ù. ¿©·¯ºÐµéÀÌ ±×°ÍÀ» »ç¿ëÇغ¸°Ô µÇ¸é, ÀÎÅÚ ¹®¹ý¿¡ ºñÇØ Á»´õ ¸¹Àº ±ÔÄ¢ÀÌ ÀÖÀ½ À» ¾Ë°Ô µÉ °ÍÀÌ´Ù.

¾Æ·¡¿¡ GAS ¹®¹ýÀÇ ÁÖ¿ä »çÇ×µéÀ» ³ª¿­ÇÏ°Ú´Ù.

  • ·¹Áö½ºÅÍÀÇ À̸§Àº %¹®ÀÚ·Î ½ÃÀÛÇÑ´Ù. ±×·¡¼­, ·¹Áö½ºÅ͸¦ Ç¥±âÇÒ ¶§ ´ÙÀ½Ã³·³ Ç¥½ÃÇÑ´Ù : %eax, %dl µîµî.. ÀÌ·¸°Ô ÇÏ´Â °ÍÀº ¿ÜºÎÀÇ C µî¿¡¼­ Á¤ÀÇµÈ ½Éº¼À» ¾Æ¹«·± È¥¶õ ¾øÀÌ °ð¹Ù·Î ¾î¼Àºí¸® ¼Ò½º¿¡ Æ÷ÇÔ½ÃÅ°´Â °ÍÀ» °¡´ÉÇÏ°Ô ÇØ ÁØ´Ù.

  • ¿ÀÆÛ·£µåÀÇ ¼ø¼­°¡, ¼Ò½º°¡ ¸ÕÀú ¿À°í, µ¥½ºÆ¼³×À̼ÇÀÌ µÚ¿¡ ¿Â´Ù. ÀÎÅÚÀÇ ¹®¹ý°ú´Â ¹Ý´ëÀÌ´Ù. ±×·¡¼­, ÀÎÅÚÀÇ ¹®¹ýÀ¸·Î ¾´ ¹®ÀåÀÌ mov eax,edx °ú °°´Ù¸é, GAS ÀÇ ¹®¹ýÀ¸·Î´Â mov %edx,%eax °ú °°ÀÌ ¾´´Ù. (edx ·¹Áö½ºÅÍÀÇ ³»¿ëÀ» eax ·¹Áö½ºÅÍ·Î ¿Å°Ü¶ó...´Â ¶æ)

  • ¿ÀÆÛ·£µåÀÇ Å©±â°¡ ÀνºÆ®·°¼ÇÀÇ Á¢¹Ì¾î·Î ºÙ´Â´Ù. °¡´ÉÇÑ Á¢¹Ì¾î´Â b ´Â ¹ÙÀÌÆ®¸¦(8-bit), w ´Â ¿öµå¸¦(16-bit) l ´Â long ÇüÀ»(32-bit) ³ªÅ¸³»´Â Á¢¹Ì¾îÀÌ´Ù. ¿¹¸¦ µéÀÚ¸é, ¹Ù·Î ¾Õ ´Ü¶ô¿¡¼­ ¾ð±ÞÇÑ ÀνºÆ®·°¼ÇÀÇ ¿Ã¹Ù¸¥ ¹®¹ýÀº movl %edx,%eax °¡ µÇ¾î¾ß ÇÑ´Ù. ±×·¯³ª, GAS ´Â ¾ö°ÝÇÏ°Ô AT&T ¹®¹ýÀÇ ±ÔÄ¢À» ÁؼöÇÒ °ÍÀ» ¿ä±¸ÇÏÁö ¾Ê´Â´Ù. ±×·¡¼­, ¿ÀÆÛ·£µåÀÇ Å©±â¸¦ ³ªÅ¸³»´Â Á¢¹Ì¾î´Â ¿ÀÆÛ·£µå·Î ¾²ÀÎ ·¹Áö½ºÅÍÀÇ À̸§À¸·ÎºÎÅÍ ¿ÀÆÛ·£µåÀÇ Å©±â¸¦ À¯ÃßÇÒ ¼ö ÀÖÀ» °æ¿ì¿¡´Â »ý·«Çصµ µÈ´Ù. ¶ÇÇÑ ±×·¸Áö ¾ÊÀ» °æ¿ì¶ó°í ÇÏ´õ¶óµµ, 32-bit ÀÇ Å©±â¸¦ °¡Á³´Ù°í °¡Á¤ÇÑ »óÅ¿¡¼­ µ¿ÀÛÇÑ´Ù(°æ°í ¸Þ¼¼Áö¸¦ »Ñ¸°´Ù)

  • ¿ÀÆÛ·£µå¿¡ ·¹Áö½ºÅÍ°¡ ¾Æ´Ï¶ó »ó¼ö µîÀ» »ç¿ëÇÒ ¶§¿¡´Â ±× ¿ÀÆÛ·£µå ¾Õ¿¡ $ ÀÇ Á¢µÎ¾î¸¦ ºÙ¿©ÁØ´Ù. Áï, addl $5,%eax Àº, %eax ·¹Áö½ºÅÍ¿¡ long Çü ¼ýÀÚ 5 ¸¦ ³ÖÀ¸¶ó´Â ¶æÀÌ´Ù.

  • ¿ÀÆÛ·£µå¿¡ Á¢µÎ¾î°¡ ¾øÀ» °æ¿ì¿¡´Â ±×°ÍÀÌ ¸Þ¸ð¸®ÀÇ °ªÀ̶ó´Â °ÍÀ» ÀǹÌÇÑ´Ù. ±×·¡¼­, movl $foo,%eax Àº º¯¼ö foo ÀÇ ÁÖ¼Ò ¸¦ ·¹Áö½ºÅÍ %eax ¿¡ ³ÖÀ¸¶ó´Â ¶æÀÌ µÈ´Ù. ±×·¯³ª, movl foo,%eax Àº º¯¼ö foo ÀÇ °ªÀ» %eax ·¹Áö½ºÅÍ¿¡ ³ÖÀ¸¶ó´Â ¶æÀÌ´Ù.

  • À妽ÌÀ̳ª °£Á¢ ÁÖ¼ÒÁöÁ¤ ¹æ½ÄÀº À妽º ·¹Áö½ºÅ͸¦ ÀÌ¿ëÇϰųª °£Á¢ ¸Þ¸ð¸® ÁÖ¼ÒÀÇ ¹øÁö¸¦ °ýÈ£ ¾È¿¡ ³ÖÀ½À¸·Î½á Ç¥ÇöµÇ¾îÁø´Ù. ¿¹¸¦ µé¾î, testb $0x80,17(%ebp) °ú °°Àº Ç¥ÇöÀº %ebp °¡ °¡¸®Å°´Â ¸Þ¸ð¸® ¹øÁö¿¡¼­ 17¹ø° ¿ÀÇÁ¼Â¿¡ ÀÖ´Â ¹ÙÀÌÆ® °ªÀÇ ÃÖ»óÀ§ ºñÆ®¸¦ Å×½ºÆ®Ç϶ó´Â ¸»ÀÌ µÈ´Ù.

ÁÖÀÇ : AT&T ¹®¹ýÀ» ÀÌ¿ëÇÑ ¾î¼Àºí¸® ¼Ò½ºÄÚµå¿Í ÀÎÅÚÀÇ ¹®¹ýÀ» ÀÌ¿ëÇÑ ¼Ò½º ÄÚµå °£¿¡ ¼­·Î º¯È¯À» ½ÃÄÑ ÁÖ´Â ÇÁ·Î±×·¥Àº °ÅÀÇ ¾ø´Ù.(few programs)

Note: There are few programs which may help you to convert source code between AT&T and Intel assembler syntaxes; some of the are capable of performing conversion in both directions.

GAS ´Â ÆÐÅ°Áö¿¡ TeXinfo Çü½ÄÀ¸·Î µÈ ¸Å¿ì ÀÌÇØÇϱ⠽¬¿î ¹®¼­¸¦ °¡Áö°í ÀÖ´Ù. .info ÆäÀÌÁö Çü½ÄÀ¸·Î Emacs µî¿¡¼­ ºê¶ó¿ì¡ ÇÒ ¼öµµ ÀÖ´Ù. ÆÄÀϸíÀº gas.doc À̰ųª as.doc ÀÏ °ÍÀÌ´Ù. ÀǽÉÀÇ ¿©Áö ¾øÀÌ ÃÖ°íÀÇ ¹®¼­´Â ¼Ò½ºÄÚµå ÀÚüÀÌ´Ù.

´Ù½ÃÇѹø, ¸®´ª½ºÀÇ ¼Ò½º°¡ ÃÖ»óÀÇ ¿¹Á¦ÀÓÀ» »ó±âÇ϶ó. linux/arch/i386/ µð·ºÅ丮 ¾Æ·¡¿¡¼­ kernel/*.S, boot/compressed/*.S, mathemu/*.S. °ú °°Àº ÆÄÀÏÀ» ¿­¾î¼­ ÀÐ¾î º¸¾Æ¶ó. ÃÖ°íÀÇ ¿¹Á¦ÀÌ´Ù.

¸¸¾à ¿©·¯ºÐÀÌ ¾ð¾î¸¦ Çϳª °í¾ÈÇÏ°í Àְųª, ¾²·¹µå ÆÐÅ°Áö¸¦ ÇÁ·Î±×·¡¹ÖÇÏ°í ÀÖ´Ù¸é, ´Ù¸¥ ¾ð¾î( OCaml, Gforth, etc.) ³ª ½º·¹µå ÆÐÅ°Áöµé (QuickThreads, MIT pthreads, LinuxThreads, etc) À» »ìÆì º¸±â¸¦ ¿øÇÒ °ÍÀÌ´Ù. ±×¸®°í, »ìÆì º¸¸é µÈ´Ù!!!

¸¶Áö¸·À¸·Î, ´ÜÁö, C ÇÁ·Î±×·¥À» ¾î¼Àºí¸®·Î ÄÄÆÄÀÏ Çϱ⸸À» ¿øÇÑ´Ù¸é, ´ÜÁö, ¿©·¯ºÐÀÌ ¿øÇÏ´Â ÀνºÆ®·°¼ÇÀÇ Á¾·ù¿Í ¹®¹ý¸¸ ¾Ë¸é µÉ °ÍÀÌ´Ù. À§¿¡¼­ ¿©·¯ºÐÀÌ Á¤¸» ¾î¼Àºí¸® ÇÁ·Î±×·¡¹ÖÀÌ ÇÊ¿äÇÑ°¡¸¦ ÆÇ´ÜÇϵµ·Ï µ½´Â ¼½¼ÇÀ» º¸µµ·Ï Ç϶ó : See section Do you need assembly? above.


3.2.3. GAS ÀÇ ÀÎÅÚ ¹®¹ý Áö¿ø

binutils 2.10 ºÎÅÍ GAS ´Â ÀÎÅÚ °è¿­ÀÇ ¹®¹ý ¶ÇÇÑ Áö¿øÇÑ´Ù. .intel_syntax Áö½Ã¾î¸¦ ÀÌ¿ëÇÏ¿© È°¼ºÈ­ ½ÃŲ´Ù.


3.2.4. 16-ºñÆ® ¸ðµå

Binutils (2.9.1.0.25+) ÀÌÈÄÀÇ ¹öÁ¯ºÎÅÍ´Â i386 °è¿­ÀÇ ÄÄÇ»Å͵鿡¼­ 16ºñÆ® ¸ðµå(·¹Áö½ºÅÍ¿Í ÁÖ¼ÒÁöÁ¤¹æ½Ä)¸¦ ¿Ïº®ÇÏ°Ô Áö¿øÇÑ´Ù. ¾î¼Àºí¸® Äڵ忡¼­ 16ºñÆ®¿Í 32ºñÆ® ¸ðµå¸¦ ÀüȯÇÒ ¶§´Â .code16 °ú .code32 Áö½ÃÀÚ¸¦ »ç¿ëÇÏ¸é µÈ´Ù.

¶ÇÇÑ, ¸î¸î »ç¶÷µé(oskit ÀÇ ÀúÀڵ鵵 Æ÷ÇÔ)ÀÌ »ç¿ëÇß´ø ±ò²ûÇÑ Æ®¸¯ÀÌ Àִµ¥, ±×°ÍÀº GCC ·Î ÇÏ¿©±Ý 16 ºñÆ® ¸®¾ó¸ðµå¿ëÀÇ Äڵ带 »ý¼ºÇϵµ·Ï °­Á¦ÇÏ´Â °ÍÀε¥, ÀζóÀÎ ¾î¼Àºí¸® ¹®ÀåÀÎ asm(".code16\n") À» ¾¸À¸·Î½á ±×·¸°Ô Çß´Ù. ±× ¹®ÀåÀ» »ç¿ëÇϸé, GCC ´Â ¿©ÀüÈ÷ 32ºñÆ®ÀÇ ÁÖ¼ÒÁöÁ¤ ¹æ½ÄÀ» »ç¿ëÇÑ Äڵ带 »ý»êÇÏÁö¸¸, GAS °¡ Àû´çÇÑ 32ºñÆ®ÀÇ Á¢µÎ¾î¸¦ ºÙ¿©ÁØ´Ù.


3.2.5. ¸ÅÅ©·Î Áö¿ø

GAS ¿¡´Â ¾ó¸¶ÀÇ ¸ÅÅ©·Î¿Í °ü·ÃµÈ ±â´Éµµ Æ÷ÇԵǾî ÀÖ´Ù. ÀÚ¼¼ÇÑ ³»¿ëÀº texinfo ¹®¼­¸¦ º¸¶ó. ¸ÅÅ©·Î¿¡ ´õÇÏ¿©, GCC ´Â .s È®ÀåÀÚÀÇ ÆÄÀÏÀ» GAS ¿¡ ¹Ù·Î º¸³»¿©¾ß ÇÒ ¼ø¼öÇÑ ¾î¼Àºí¸® ·Î ÀνÄÇϴµ¥, ¶ÇÇÑ, .S ÀÇ È®ÀåÀÚ¸¦ °¡Áö´Â ÆÄÀÏÀº GAS ·Î ³Ñ±âÁö Àü¿¡ ¸ÕÀú CPP ¸¦ °ÅÄ£ ÈÄ¿¡ ³Ñ°Ü¾ß ÇÒ ÆÄÀÏ·Î ÀνÄÇÑ´Ù. °è¼Ó ¸»ÇÏ´Â °ÍÀÌÁö¸¸, ¸®´ª½ºÀÇ ¼Ò½º¸¦ ¿¹Á¦»ï¾Æ º¸¶ó.

GAS ´Â ¶ÇÇÑ, GASP (GAS Preprocessor) ¸¦ °¡Áö°í Àִµ¥, GASP °¡ ÇÏ´Â ÀÏÀº ÀϹÝÀûÀÎ ¸ÅÅ©·Î¾î¼Àºí¸®ÀÇ Æ®¸¯À» GAS ¿¡ ´õÇØÁÖ´Â °ÍÀÌ´Ù. GASP ´Â GNU binutils ÆÐÅ°Áö ¾È¿¡ GAS ¿Í ´õºÒ¾î¼­ ¹èÆ÷µÈ´Ù. GASP ´Â CPP ³ª m4 À¯Æ¿¸®Æ¼Ã³·³ ÇÊÅÍ·Î½á µ¿ÀÛÇÑ´Ù. ÀÚ¼¼ÇÑ °ÍÀº ÀúÀÚ°¡ Àß ¸ð¸£°ÚÀ¸³ª, texinfo Çü½ÄÀÇ ¹®¼­°¡ µû¶ó¿À¹Ç·Î, ¹®¼­¸¦ ÂüÁ¶Çϱ⠹ٶõ´Ù. ÀúÀÚ¿¡°Õ GAS ¿Í GASP ÀÇ Á¶ÇÕÀÌ ÀϹÝÀûÀÎ macro-assembler ó·³ ´À²¸Á³´Ù.


3.3. NASM

Netwide Assembler project ´Â ¸Å¿ì ±¦ÂúÀº i386 ¾î¼Àºí·¯¸¦ Á¦°øÇÑ´Ù. ±× ¾î¼Àºí·¯´Â C ·Î ¾²¿©Á³À¸¸ç, ÃæºÐÈ÷ ¸ðµâÈ­ µÇ¾î ÀÖ´Ù. ±×¸®°í, Áö±ÝÀº °ÅÀÇ ¸ðµç ¾Ë·ÁÁø ¹®¹ý°ú, ¸ñÀû ÆÄÀÏÀÇ Çü½ÄÀ» Áö¿øÇÏ°Ô µÇ¾ú´Ù.


3.3.1. NASMÀ» ¾îµð¼­ ±¸ÇÒ ¼ö Àִ°¡

http://www.cryogen.com/nasm/, http://nasm.rm-f.net

¿©·¯ºÐÀÌ ÀÚÁÖ °¡´Â metalab ¹Ì·¯ »çÀÌÆ®ÀÇ devel/lang/asm/ µð·ºÅ丮¿¡ ÀÖ´Ù. ¾Æ¸¶µµ rpm À̳ª deb Çü½ÄÀÇ ÆÐÅ°Áö·Îµµ ±¸ÇÒ ¼ö ÀÖÀ» °ÍÀÌ´Ù.


3.3.2. NASM À¸·Î ¹«¾ùÀ» ÇÒ ¼ö Àִ°¡

¹®¹ýÀº ÀÎÅÚ ½ºÅ¸ÀÏÀÌ´Ù. ¶ÇÇÑ, ÀÌÇØÇϱ⠽¬¿î ¸ÅÅ©·Î ÇÁ·Î¼¼½Ì¿¡ ´ëÇÑ Áö¿øµµ ÇÑ´Ù.

Áö¿øµÇ´Â ¸ñÀû ÄÚµåÀÇ Çü½ÄÀº ´ÙÀ½°ú °°´Ù : bin, aout, coff, elf, as86, obj (DOS), win32, rdf (NASM °íÀ¯ÀÇ Æ÷¸Ë).

NASM Àº ¶ÇÇÑ LCC ÄÄÆÄÀÏ·¯ÀÇ ¹é¿£µå·Îµµ »ç¿ëµÉ ¼ö ÀÖ´Ù.

¿©·¯ºÐÀÌ BCC ¸¦ 16ºñÆ® ÄÄÆÄÀÏ·¯·Î »ç¿ëÇÏÁö ¾Ê´Â´Ù¸é ¿©·¯ºÐÀº ¾Æ¸¶µµ, AS86 À̳ª MASM º¸´Ù NASM À» »ç¿ëÇØ¾ß ÇÒ °ÍÀÌ´Ù. NASM Àº ¿Â¶óÀÎÀ¸·Î °è¼Ó Áö¿øÀÌ ÀÌ·ç¾îÁö°í ÀÖ°í, ¶ÇÇÑ, °ÅÀÇ ¸ðµç Ç÷§Æû¿¡¼­ µ¹¾Æ°¡±â ¶§¹®ÀÌ´Ù.

Note: NASM ¿¡´Â µð½º¾î¼Àºí·¯ÀÎ NDISASM µµ µþ·Á¿Â´Ù.

NASM Àº »ç¶÷ÀÇ ¼ÕÀ¸·Î ÀÛ¾÷Çس½ Æļ­¸¦ žÀçÇÏ°í Àִµ¥, ±×·Î ÀÎÇØ GAS º¸´Ù ÈξÀ ºü¸£´Ù. (¿ªÀÚ ÁÖ : ±× ÀÌÈÄÀÇ ¸»Àº... Çؼ®ÀÌ Á» Èûµé±º¿ä -_- ¿ø¹®À» ±×´ë·Î µÎ°Ú½À´Ï´Ù.) Its hand-written parser makes it much faster than GAS, though of course, it doesn't support three bazillion different architectures. If you like Intel-style syntax, as opposed to GAS syntax, then it should be the assembler of choice..


3.4. AS86

AS86 Àº 16ºñÆ®¿Í 32ºñÆ® ¸ðµÎ¸¦ Áö¿øÇÏ´Â 80x86 ¿ëÀÇ ¾î¼Àºí·¯ÀÌ´Ù. ÀÌ ÇÁ·Î±×·¥Àº Bruce Evans ÀÇ C ÄÄÆÄÀÏ·¯(BCC) ÆÐÅ°ÁöÀÇ ÀϺÎÀÌ´Ù. °ÅÀÇ ´ëºÎºÐ ÀÎÅÚÀÇ ¹®¹ýÀ» µû¸£Áö¸¸, ÁÖ¼Ò ÁöÁ¤¹æ½Ä µî¿¡¼­ ¾à°£ÀÇ Â÷À̸¦ º¸ÀδÙ.


3.4.1. AS86 À» ¾îµð¼­ ±¸ÇÒ ¼ö Àִ°¡

¿ÏÀüÈ÷ ½Ã´ë¿¡ µÚ¶³¾îÁø AS86 ÀÇ ¹öÁ¯Àº HJLu ¿¡ ÀÇÇØ ¹èÆ÷µÈ´Ù. ¿ëµµ´Â ´ÜÁö ¸®´ª½º Ä¿³ÎÀ» ÄÄÆÄÀÏÇÏ´Â°Í ¹Û¿¡ ¾ø´Ù. bin86 ÆÐÅ°Áö (ÇöÀç ¹öÁ¯ 0.4) ¾È¿¡ Æ÷ÇԵǾî ÀÖ´Ù. ¸®´ª½º GCC ¸¦ ±¸ÇÒ ¼ö ÀÖ´Â °÷ÀÌ¸é ¾îµð¿¡³ª ÀÖ´Ù. ±×·¯³ª, ÀúÀÚ´Â ¸®´ª½º¸¦ ÄÄÆÄÀÏÇÏ´Â ¿ëµµ ¿Ü¿¡´Â ¾Æ¹«µµ AS86 À» ¾²Áö ¾Ê´Â´Ù°í ¸»ÇØÁÖ°í ½Í´Ù. °Ô´Ù°¡ ¸®´ª½º¸¦ ÄÄÆÄÀÏÇϴµ¥¿¡µµ, ¹Ì´Ð½ºÀÇ ¿ÀºêÁ§Æ® ÆÄÀÏ Æ÷¸ËÀ» Áö¿øÇÏ´Â ºÎºÐ ¿Ü¿¡´Â ¾²ÀÌÁö ¾Ê´Â´Ù. ÀÌ ºÐ¾ß´Â GNU binutils µî°ú °°Àº ´Ù¸¥ Åø¿¡¼­´Â ÀüÇô Áö¿øÇÏÁö ¾Ê´Â ºÐ¾ßÀÌ´Ù. ±×¸®°í, AS86 Àº 32ºñÆ® ¸ðµå¿¡¼­ ¸î°¡Áö ¹ö±×¸¦ ³»Æ÷ÇÏ°í ÀÖ´Ù. ±×³É AS86 À» ¸®´ª½º¸¦ ÄÄÆÄÀÏÇÏ´Â µ¥¿¡¸¸ »ç¿ëÇ϶ó.

Bruce Evans ÀÇ ÄÄÆÄÀÏ·¯ÀÇ ÃֽŠ¹öÁ¯Àº Ç×»ó FreeBSD ¿Í ÇÔ²² ¹èÆ÷µÈ´Ù. 2.1 ¹öÁ¯ÀÇ ¹èÆ÷ÆÇ¿¡¼­´Â ¼Ò½º¸¦ ãÀ» ¼ö ¾ø¾ú´Ù :( ÀúÀÚÀÇ È¨ÆäÀÌÁö¿¡ ¼Ò½º¸¦ µÎ°Ú´Ù. http://www.tunes.org/~fare/files/asm/bcc-95.3.12.src.tgz

¾î·µç Linux/8086 (aka ELKS) ÇÁ·ÎÁ§Æ®´Â bcc ¸¦ À¯Áö/º¸¼ö ÇÏ°í ÀÖ±â´Â ÇÏ´Ù. (ÀúÀÚ´Â 32 ºñÆ® ÆÐÄ¡°¡ Æ÷ÇԵǾú´Ù°í´Â »ý°¢ÇÏÁö ¾Ê´Â´Ù) http://www.linux.org.uk/ELKS-Home/ (ȤÀº http://www.elks.ecs.soton.ac.uk) ¿Í ftp://linux.mit.edu/pub/linux/ELKS/ ¸¦ µÑ·¯º¸µµ·Ï Ç϶ó. ÀúÀÚ°¡ ¿©±â ¿Ã¶ó¿À´Â °³¹ß ¹öÁ¯µéÀ» ¸ðµÎ È®ÀÎÇØ º¼ ¼ö ¾ø¾ú´Ù. ÀÌ ±ÛÀ» ÀÐÀ¸½Ã´Â ºÐÀÌ °ü½ÉÀÌ ÀÖ´Ù¸é Á¶»çÇØ º¸°í ÀúÀÚ¿¡°Ô À̾߱âÇØ Áشٸé ÁÁ°Ú´Ù.

±×¸®°í, ¹«¾ùº¸´Ù ÀÌ ÅøÀÇ º¸´Ù ÃÖ½ÅÀÇ ¹öÁ¯Àº ¸®´ª½ºÀÇ a.out Æ÷¸ËÀÇ ½ÇÇàÆÄÀÏ Çü½ÄÀ» Áö¿øÇÑ´Ù. ±×·¡¼­, ¿©·¯ºÐÀº ¿©·¯ºÐÀÇ Äڵ带 ¸®´ª½º ÇÁ·Î±×·¥¿¡ ¸µÅ©½ÃÄѼ­ »ç¿ëÇϰųª, GNU binutils ÆÐÅ°ÁöÀÇ ÅøµéÀ» ¿©·¯ºÐÀÇ ÇÁ·Î±×·¥ÀÇ ÀڷḦ À¯ÁöÇϴµ¥ »ç¿ëÇÒ ¼ö ÀÖÀ» °ÍÀÌ´Ù. AS86 ÇÁ·Î±×·¥Àº ÀÌÀü ¹öÁ¯ ȤÀº ´Ù¸¥ ÇÁ·Î±×·¥°ú ¾Æ¹«·± Ãæµ¹ ¾øÀÌ ¿©·¯ºÐÀÇ ½Ã½ºÅÛ¿¡ °øÁ¸ÇÒ ¼ö ÀÖ´Ù.

1995 ³â 3¿ù 12ÀÏ ÀÌÀüÀÇ ¹öÁ¯ÀÇ BCC ´Â ¸ðµç ¼¼±×¸ÕÆ®ÀÇ Çª½Ã/ÆË À» 16ºñÆ®·Î ÇÏ´Â ¿À·ù°¡ Àִµ¥, ±×°ÍÀº 32ºñÆ® ¸ðµå·Î ÇÁ·Î±×·¡¹Ö Çϴµ¥ À־ »ó´çÈ÷ ±ÍÂú°í, °ñÄ¡¾ÆÇ ¹®Á¦ÀÌ´Ù. ÀúÀÚ´Â TUNES ÇÁ·ÎÁ§Æ®°¡ AS86 À» »ç¿ëÇÒ ´ç½Ã ±×¿¡´ëÇÑ ÆÐÄ¡¸¦ Çß¾ú´Ù. http://www.tunes.org/~fare/files/asm/as86.bcc.patch.gz ºê·ç½º ¿¡¹Ý½ºµµ ÀÌ ÆÐÄ¡¸¦ ½ÂÀÎÇÏ¿´´Ù. ±×·¸Áö¸¸, ±×´Â bcc ÀÇ »õ·Î¿î ¸±¸®Áî´Â ¹ßÇ¥ÇÏÁö ¾Ê¾Ò´Ù.


3.4.2. ¾î¼Àºí·¯¸¦ ÀÛµ¿½ÃÅ°´Â ¹æ¹ý : How to invoke the assembler?

¾Æ·¡¿¡ BCC ¸¦ »ç¿ëÇؼ­ .s ÆÄÀϷκÎÅÍ a.out Çü½ÄÀÇ .o ¿ÀºêÁ§Æ® ÄÚµå¿Í .l ÀÇ ¸®½ºÆà ÆÄÀÏÀ» »ý¼º½ÃÅ°´Â »ý¼º½ÃÅ°´Â GNU makefile ÀÇ ¿£Æ®¸®°¡ ÀÖ´Ù.

    %.o %.l:	%.s
        bcc -3 -G -c -A-d -A-l -A$*.l -o $*.o $<
    

¿©·¯ºÐÀÌ ¸®½ºÆà ÆÄÀÏÀ» »ý¼ºÇϱ⸦ ¿øÇÏÁö ¾Ê´Â´Ù¸é, %.l °ú -A-l, ±×¸®°í -A$*.l À» »èÁ¦ÇÏ¸é µÈ´Ù. ±×¸®°í, a.out ¸»°í ´Ù¸¥ ÆÄÀÏÀÌ Ãâ·ÂµÇ°Ô ÇÏ·Á¸é, bcc ÀÇ ¹®¼­¸¦ ÂüÁ¶ÇÏ¿© ´Ù¸¥ Áö¿øµÇ´Â Çü½ÄÀ» ã¾Æº¸°Å³ª, GNU binutils ÆÐÅ°ÁöÀÇ objcopy À¯Æ¿¸®Æ¼¸¦ »ç¿ëÇ϶ó.


3.4.3. AS86ÀÇ ¹®¼­¸¦ ãÀ» ¼ö ÀÖ´Â °÷

¹®¼­µéÀº bcc ÆÐÅ°Áö ¾È¿¡ Æ÷ÇԵǾî ÀÖ´Ù. FreeBSD »çÀÌÆ®ÀÎ http://www.tunes.org/~fare/files/asm/bcc-95.3.12.src.tgz ¿¡¼­ ¸ÇÆäÀÌÁö¸¦ ±¸ÇÒ ¼ö ÀÖ¾ú´Ù. ELKS ÀÇ °³¹ßÀÚµéÀÌ ´õ ¸¹ÀÌ ¾Ë°í ÀÖÀ» °ÍÀÌ´Ù. Èì... ±×¸®°í, Á» ´õ ¾Ë°í ½Í´Ù¸é, AS86 ÀÇ ¼Ò½º ±× ÀÚü°¡ ÁÁÀº ¹®¼­°¡ µÉ °ÍÀÌ´Ù. ÁÖ¼®ÀÌ ±×¸® Àß µÇ¾î ÀÖ´Â °ÍÀº ¾Æ´ÏÁö¸¸, ÇÁ·Î±×·¡¹Ö ½ºÅ¸ÀÏÀº ¸Å¿ì Á÷¼±Àû(?)ÀÌ´Ù. ¿©·¯ºÐÀº ELKS ÇÁ·ÎÁ§Æ®³ª TUNES ÇÁ·ÎÁ§Æ® 0.0.0.25 ¿¡¼­ AS86 ÀÌ ¾î¶»°Ô ¾²¿´´ÂÁö »ìÆ캼 ¼öµµ ÀÖÀ» °ÍÀÌ´Ù.


3.4.4. ¸ÅÅ©·Î Áö¿ø

AS86 Àº °£´ÜÇÑ ¸ÅÅ©·Îµµ Áö¿øÇÑ´Ù. ±×·¸Áö¸¸, ÀúÀÚ´Â ±×¿¡´ëÇÑ ¹®¼­´Â ãÁö ¸øÇÏ¿´´Ù. AS86ÀÇ ¼Ò½º´Â ¸Å¿ì straightforward ÇÏ°Ô ¾²¿´À¸¹Ç·Î, ¿©·¯ºÐÀÌ ¿øÇÑ´Ù¸é, ¼Ò½º¸¦ »ìÆ캸°í, ¿øÇÏ´Â ºÎºÐÀ» ½±°Ô ÀÌÇØÇÒ ¼ö ÀÖÀ» °ÍÀÌ´Ù. ¿©·¯ºÐÀÌ ´Ü¼øÇÑ ¸ÅÅ©·Î ÀÌ»óÀÇ ´õ ¸¹Àº °ÍÀ» ¿øÇÑ´Ù¸é ¿ÜºÎÀÇ ÇÊÅÍ (µÚ¿¡¼­ ¼³¸íÇÑ´Ù)¸¦ ÀÌ¿ëÇÒ ¼öµµ ÀÖ´Ù.


3.4.5. ¸¸¾à ÀÌ »õ·Î¿î ¹öÁ¯À» ÀÌ¿ëÇؼ­ ¸®´ª½º¸¦ ´õÀÌ»ó ÄÄÆÄÀÏ ÇÒ ¼ö ¾ø´Ù¸é ¾î¶»°Ô ÇØ¾ß Çϴ°¡ : What if I can't compile Linux anymore with this new version?

Linus ´Â ½ñ¾ÆÁö´Â ¸ÞÀÏ´õ¹Ì¿¡ ÆĹ¯Çô :) ÀÖ´Ù. ±×¸®°í, HJLu (bin86 ÀÇ °ø½ÄÀû À¯Áö/º¸¼öÀÚ) °¡ as86 ÀÇ as86 ÀÇ ÃֽŠ¹öÁ¯À» »ç¿ëÇÑ ÄÚµåÀÇ Àç ±¸Ãà º¸´Ù ±¸¹öÁ¯ÀÇ ÇØÅ·À» ¼±ÅÃÇ߱⠶§¹®¿¡ ÀúÀÚ°¡ as86 ¿¡ ¸®´ª½º¸¦ ÄÄÆÄÀÏ ÇÒ ¼ö ÀÖµµ·Ï ÇÑ ÆÐÄ¡°¡ Á¦´ë·Î ¹Þ¾Æµé¿©ÁöÁö ¾Ê¾Ò´Ù°í »ý°¢ÇÑ´Ù. (¿ªÀÚÁÖ : ¹ø¿ªÀÌ ÀÌ»óÇؼ­ ¿ø¹®À» ½Æ½À´Ï´Ù) Linus is buried alive in mail, and since HJLu (official bin86 maintainer) chose to write hacks around an obsolete version of as86 instead of building clean code around the latest version, I don't think my patch for compiling Linux with a modern as86 has any chance to be accepted if resubmitted.

±×·¯³ª, º° ¹®Á¦ ¾ø´Ù. bin86 ÆÐÅ°Áö¿¡¼­ as86 À» /usr/bin/ ¿¡ ±×´ë·Î ³öµÎ°í, bcc °¡ ÃÖ½ÅÀÇ as86 À» /usr/local/libexec/i386/bcc/as ·Î ÀνºÅçÇϵµ·Ï ÇØ ÁÖ¸é µÈ´Ù. ¿©·¯ºÐÀº ¸í½ÃÀûÀ¸·Î /ÁÁÀº/ ¹öÁ¯ÀÇ as86 À» È£ÃâÇÒ ÇÊ¿ä´Â ¾ø´Ù. Á¦´ë·Î µÈ ¿É¼Ç°ú ÇÔ²² È£ÃâµÇ¸é, bcc °¡ ¸ðµç°ÍÀ» Á¦´ë·Î Á¶Á¤ÇØ Áֱ⠶§¹®ÀÌ´Ù. ¸®´ª½ºÀÇ a.out Æ÷¸ËÀ¸·ÎÀÇ º¯È¯±îÁö Æ÷ÇÔÇؼ­ ¸»ÀÌ´Ù. ±×·¡¼­, ÆÄÀÏÀ» as86 À» ¹Ù·Î »ç¿ëÇÏÁö ¸»°í, bcc ¸¦ ÇÁ·ÐÆ®¿£µå·Î ÀÌ¿ëÇؼ­ ¾î¼ÀºíÇ϶ó. Now, this shouldn't matter: just keep your as86 from the bin86 package in /usr/bin/, and let bcc install the good as86 as /usr/local/libexec/i386/bcc/as where it should be. You never need explicitly call this "good" as86, because bcc does everything right, including conversion to Linux a.out, when invoked with the right options; so assemble files exclusively with bcc as a frontend, not directly with as86.

Áö±ÝÀº gas µµ 16ºñÆ® Äڵ嵵 Áö¿øÇÏ°í, NASM µµ ±×·¸°Ô ÇÒ ¸ð¾çÀ̹ǷÎ, ¸®´ª½º´Â AS86 ÀÇ ±×´Ã¿¡¼­ ¹þ¾î³¯ ¼ö ÀÖÀ» °ÍÀÌ´Ù. ´©°¡ ¾Ë¸®... Since GAS now supports 16-bit code, and NASM looks promising, maybe Linux will get rid of AS86, anyway? Who knows!


3.5. ´Ù¸¥ ¾î¼Àºí·¯µé

Áö±ÝºÎÅÍ ¼Ò°³ÇÏ°íÀÚ ÇÏ´Â ¾î¼Àºí·¯µéÀº ÀϹÝÀûÀ¸·Î »ç¿ëÇÏ´Â °ÍÀÌ ¾Æ´Ñ ¾î¼Àºí·¯µéÀÌ´Ù. ¾Õ¼­ ¾ð±ÞÇÑ ¾î¼Àºí·¯µéÀÌ ºÒ¸¸Á·½º·´´Ù¸é Áö±ÝºÎÅÍ ¼Ò°³ÇÏ´Â ¾î¼Àºí·¯µéÀ» »ç¿ëÇ϶ó. ±×·¯³ª ¾Õ¼­ ¾ð±ÞÇÑ ¾î¼Àºí·¯µéÀÌ ºÒ¸¸Á·½º·¯¿ï ÀÌÀ¯°¡ ¾ø´Ù. :) ±×·¡¼­ ÀúÀÚ´Â ¾Õ¼­ÀÇ ¾î¼Àºí·¯µéÀ» »ç¿ëÇϱ⸦ ÃßõÇÏ´Â ¹ÙÀÌ´Ù. ÇÏÁö¸¸, ¿©·¯ºÐÀÌ °³¹ßÇÏ´Â ¼ÒÇÁÆ®¿þ¾î¿¡ »ç¿ëÇÏ´Â ¾î¼Àºí·¯¸¦ ÀÏ·üÀûÀ¸·Î °°Àº °ÍÀ¸·Î ÇÒ ÇÊ¿ä´Â ¾ø´Ù.


3.5.1. Win32Forth ¾î¼Àºí·¯

Win32Forth ´Â free 32-bit ANS FORTH system ÀÌ´Ù. Win32 ȯ°æ, Áï, À©95, À©NT µî¿¡¼­ ¼º°øÀûÀ¸·Î »ç¿ëÇÒ ¼ö ÀÖ´Â ¾î¼Àºí·¯ÀÌ´Ù. ÀÌ ¾î¼Àºí·¯´Â reflective FORTH language ¿¡ Æ÷ÇԵǾî ÀÖ´Â °ø°³ 32ºñÆ® ¾î¼Àºí·¯ÀÌ´Ù. (¹®¹ýÀº prefix ³ª postfix ¸ðµÎ¸¦ Áö¿øÇÑ´Ù) ¸ÅÅ©·Î ÇÁ·Î¼¼½Ìµµ reflective language FORTH ÀÇ ´É·Â ÇÏ¿¡¼­ ¼º°øÀûÀ¸·Î Àß Áö¿øµÈ´Ù. ±×·¯³ª, ´ÜÁ¡ÀÌ ÀÖ´Ù¸é, Áö¿øµÇ´Â ÀÔ.Ãâ·Â ³»¿ëÀÌ Win32Forth ¿¡¼­¸¸ »ç¿ëÇÒ ¼ö ÀÖ´Ù´Â °ÍÀÌ´Ù. (.obj ÆÄÀÏ·ÎÀÇ ´ýÇÁ´Â ¾ø´Ù. ±×·¯³ª ¿©·¯ºÐÀÌ ÇÊ¿äÇÏ´Ù¸é ±×·¯ÇÑ ±â´ÉÀ» Ãß°¡ÇÒ ¼ö ÀÖ´Ù) ÀÌ ¾î¼Àºí·¯¸¦ ãÀ» ¼ö ÀÖ´Â Àå¼Ò´Â ´ÙÀ½°ú °°´Ù : ftp://ftp.forth.org/pub/Forth/Compilers/native/windows/Win32For/.

Win32Forth is a free 32-bit ANS FORTH system that successfully runs under Win32s, Win95, Win/NT. It includes a free 32-bit assembler (either prefix or postfix syntax) integrated into the reflective FORTH language. Macro processing is done with the full power of the reflective language FORTH; however, the only supported input and output contexts is Win32For itself (no dumping of .obj file, but you could add that feature yourself, of course). Find it at ftp://ftp.forth.org/pub/Forth/Compilers/native/windows/Win32For/.


3.5.2. TDASM

TDASM (the Table Driven Assembler) Àº ¾î¶² ¾î¼Àºí¸® ¾ð¾î·Îµµ Æ÷ÆÃÀÌ °¡´ÉÇÑ °ø°³ ¾î¼Àºí·¯ÀÌ´Ù. ÀÌ ¾î¼Àºí·¯´Â Ÿ°ÙÀÌ µÇ´Â ¸¶ÀÌÅ©·ÎÇÁ·Î¼¼¼­°¡ ¹«¾ùÀÌµç °£¿¡ ±×¿¡ ÇØ´çÇÏ´Â ÄÄÆÄÀÏ ÀÛ¾÷À» Á¤ÀÇÇÏ´Â Å×À̺íÀ» ÀÌ¿ëÇÏ¿©¼­ ÇØ´ç ¸¶ÀÌÅ©·ÎÇÁ·Î¼¼¼­ÀÇ ÄÄÆÄÀÏ·¯·Î »ç¿ëÀÌ °¡´ÉÇÑ ¾î¼Àºí·¯ÀÌ´Ù.

The Table Driven Assembler (TDASM) is a free portable cross assembler for any kind of assembly language. It should be possible to use it as a compiler to any target microprocessor using a table that defines the compilation process.

±¸ÇÒ ¼ö ÀÖ´Â Àå¼Ò´Â http://www.penguin.cz/~niki/tdasm/ ÀÌ´Ù.


3.5.3. Terse

Terse ´Â x86 °è¿­À» À§ÇÑ °¡Àå ÄÄÆÑÆ®ÇÑ ¾î¼Àºí·¯ ¹®¹ýÀ» °¡Áö°í ÀÖ´Â ÇÁ·Î±×·¡¹Ö ÅøÀÌ´Ù. ÇÏÁö¸¸, ÀÌ ¾î¼Àºí·¯´Â evil proprietary software ÀÌ´Ù (¿ªÀÚÁÖ:¸¶¶¥ÇÑ ¸»À» ¸øã¾Ò½À´Ï´Ù) ÀÌ ¾î¼Àºí·¯ÀÇ °ø°³ Ŭ·ÐÀ» ¸¸µå´Â ÇÁ·ÎÁ§Æ®°¡ ÀÖ¾ú´Ù°í´Â Çϴµ¥, Áö±ÝÀº ´õÀÌ»ó °³¹ßµÇÁö ¾Ê´Â °ÍÀ¸·Î ÇÊÀÚ´Â ¾Ë°í ÀÖ´Ù. ¸¸¾à ¿©·¯ºÐÀÌ terse ¿Í ºñ½ÁÇÑ ¹®¹ýÀ» °¡Áø ¾î¼Àºí·¯¸¦ ã´Â´Ù¸é, NASM ÀÇ ÇÁ·ÐÆ®¿£µå·Î ±× ¹®¹ýÀ» °³¹ßÇÏ¸é µÉ °ÍÀÌ´Ù. °ü½ÉÀÖ´Ù¸é, comp.compilers ¿¡¼­ ¿ª»çÀûÀÎ ÅäÀǵé(?)À» ÈȾ ¼ö ÀÖÀ» °ÍÀÌ´Ù.

    1999/07/11 19:36:51, the moderator wrote:

    "There's no reason that assemblers have to have awful syntax.  About
    30 years ago I used Niklaus Wirth's PL360, which was basically a S/360
    assembler with Algol syntax and a a little syntactic sugar like while
    loops that turned into the obvious branches.  It really was an
    assembler, e.g., you had to write out your expressions with explicit
    assignments of values to registers, but it was nice.  Wirth used it to
    write Algol W, a small fast Algol subset, which was a predecessor to
    Pascal.  As is so often the case, Algol W was a significant
    improvement over many of its successors. -John"
    


3.5.4. HLA

HLA ´Â High Level Assembly language ÀÇ ¾àÀÚÀÌ´Ù. ÀÌ ¾î¼Àºí·¯´Â º¯¼ö ¼±¾ðÀ̳ª ÇÔ¼ö ¼±¾ð, ÇÔ¼ö È£Ãâ°ú °°Àº ºÎºÐ¿¡¼­ ÆĽºÄ®À̳ª C/C++ °ú °°Àº °í±Þ¾ð¾î¿Í ¸Å¿ì ºñ½ÁÇÑ ¹®¹ýÀ» »ç¿ëÇÑ´Ù. ±×¸®°í ÀÌ ¾î¼Àºí·¯´Â Ç¥ÁØ ¸Ó½Å ÀνºÆ®·°¼ÇÀ» À§ÇÑ ¼öÁ¤µÈ ¾î¼Àºí¸® ¾ð¾î ¹®¹ýÀ» »ç¿ëÇÑ´Ù. ¶ÇÇÑ if, while, repeat, until µî°ú °°Àº °í±Þ¾ð¾î¿¡¼­ Á¦°øÇÏ´Â Á¦¾î ±¸Á¶¸¦ °¡Áø´Ù.

HLA ´Â free ÀÌÁö¸¸, Win32 ȯ°æ¿¡¼­¸¸ µ¿ÀÛÇÑ´Ù. HLA ´Â MASM ¿ëÀÇ Äڵ带 »ý»êÇϱ⠶§¹®¿¡ ¸ñÀûÆÄÀÏÀ» »ý¼ºÇϱâ À§ÇÑ ÃÖÁ¾ ¾î¼Àºí¸µ°ú ¸µÅ·À» À§ÇØ ¿©·¯ºÐÀº MASM °ú MS-link ÀÇ 32ºñÆ® ¹öÁ¯ÀÌ ÇÊ¿äÇÏ´Ù. ±×·¯³ª, HLA ÀÇ MASM ¹öÁ¯ÀÇ Ãâ·ÂÀ» TASM ¿¡¼­ ÄÄÆÄÀÏ µÉ ¼ö ÀÖµµ·Ï º¯È¯ÇØÁÖ´Â m2t Æ÷½ºÆ® ÇÁ·Î¼¼¼­ ÇÁ·Î±×·¥µµ µû¶ó¿Â´Ù. ºÒÇàÈ÷µµ, NASM Àº Áö¿øµÇÁö ¾Ê´Â´Ù.


3.5.5. TALC

TALC ´Â ¶Ç´Ù¸¥ MASM/Win32 ±â¹ÝÀÇ °ø°³ ÄÄÆÄÀÏ·¯ÀÌ´Ù. (±×·³¿¡µµ ºÒ±¸ÇÏ°í, ELF Çü½ÄÀÇ Ãâ·Âµµ Áö¿øÇÏ´Â °Í °°´Ù)

TAL Àº Typed Assembly Language ÀÇ ¾àÀÚÀÌ´Ù. (¿ªÀÚÁÖ:Á¤¸».. ¾Æ·¡ÀÇ ¹®ÀåµéÀº Àü¹®ÀûÀÎ ¿ë¾î¶ó.. ¹ø¿ªÀÌ Èûµé±º¿ä.. ´©±º°¡ ¹ø¿ªÇØÁÖ½Ç ºÐÀº... ªÀ¸´Ï±î Àú¿¡°Ô ¸ÞÀÏ ÁֽʽÿÀ. ¹Ý¿µÇÏ°Ú½À´Ï´Ù) It extends traditional untyped assembly languages with typing annotations, memory management primitives, and a sound set of typing rules, to guarantee the memory safety, control flow safety,and type safety of TAL programs. Moreover, the typing constructs are expressive enough to encode most source language programming features including records and structures, arrays, higher-order and polymorphic functions, exceptions, abstract data types, subtyping, and modules. Just as importantly, TAL is flexible enough to admit many low-level compiler optimizations. Consequently, TAL is an ideal target platform for type-directed compilers that want to produce verifiably safe code for use in secure mobile code applications or extensible operating system kernels.


3.5.6. x86 ¿ëÀÇ ÇÁ¸®°¡ ¾Æ´Ï°Å³ª 32ºñÆ®°¡ ¾Æ´Ñ ¾î¼Àºí·¯µé

¿©·¯ºÐÀº Raymond Moon's x86 assembly FAQ ¿¡¼­ x86 ¾î¼Àºí¸® ÇÁ·Î±×·¡¹ÖÀÇ ±âÃÊÀûÀÎ Áö½Ä°ú ÇÔ²² ±×·¯ÇÑ ¾î¼Àºí¸®¿¡ ´ëÇØ º¸´Ù ¸¹Àº ÀÚ·áµéÀ» ãÀ» ¼ö ÀÖ´Ù.

Note : ¸ðµç µµ½º ±â¹ÝÀÇ ¾î¼Àºí·¯µéÀº ¸®´ª½ºÀÇ DOS ¿¡¹Ä·¹ÀÌÅ͸¦ ÅëÇؼ­ »ç¿ëµÇ¾î¾ß ÇÑ´Ù. ÃÖ±ÙÀÇ µµ½º ±â¹ÝÀÇ ¾î¼Àºí·¯µéÀº GNU BFD ¶óÀ̺귯¸®¿¡¼­ Áö¿øÇÏ´Â COFF ³ª ´Ù¸¥ ¸ñÀû ÆÄÀÏ Æ÷¸ËµéÀ» Áö¿øÇϱ⠶§¹®¿¡ ¿©·¯ºÐÀº ±×·¯ÇÑ ¾î¼Àºí·¯µéÀ» ´Ù¸¥ °ø°³ÀÇ 32ºñÆ® Åøµé°ú ÇÔ²² »ç¿ëÇÒ ¼öµµ ÀÖÀ» °ÍÀÌ´Ù. ¾Æ¸¶µµ GNU objcopy(binutils ÆÐÅ°Áö¿¡ ÀÖ´Ù) ¸¦ º¯È¯¿ë ÇÊÅÍ·Î ÀÌ¿ëÇÒ ¼öµµ ÀÖÀ» °ÍÀÌ´Ù.


4장. ¸ÞŸÇÁ·Î±×·¡¹Ö

¾î¼Àºí¸® ÇÁ·Î±×·¡¹ÖÀº Áö·çÇÑ ÀÛ¾÷ÀÌ´Ù. ±×·¯³ª, ±×·¸´Ù°í °áÁ¤ÀûÀÎ ºÎºÐ¿¡¼­ ¾î¼Àºí¸®¸¦ »ç¿ëÇÏÁö ¾ÊÀ»¼ö´Â ¾ø´Ù.

¿©·¯ºÐÀº Á¦´ë·Î ÀÛ¾÷À» ¼öÇàÇϱâ À§Çؼ­ ÀûÀýÇÑ ÅøÀ» »ç¿ëÇØ¾ß ÇÒ °ÍÀÌ´Ù.... ´Ù½Ã ¸»ÇÏÀÚ¸é, ¾î¼Àºí¸® ¾ð¾î°¡ ¹Ýµå½Ã ÇÊ¿äÇÏÁö ¾Ê´Ù¸é ¾î¼Àºí¸®¸¦ »ç¿ëÇؼ­´Â ¾ÈµÈ´Ù. ´ë½Å, C, OCaml, perl, Scheme, µîÀÇ °í±Þ¾ð¾î¸¦ »ç¿ëÇÏ´Â °ÍÀÌ ´ë°³ÀÇ °æ¿ì ´õ ³ªÀº ¼±ÅÃÀÌ µÉ °ÍÀÌ´Ù.

±×·¯³ª, ¾Õ¼­ ¾ð±ÞÇÑ °í±Þ ÇÁ·Î±×·¡¹Ö ¾ð¾î°¡ ±â°è ÀÚü¸¦ ¸¸Á·ÇÒ ¸¸ÇÑ ¼öÁØÀ¸·Î ÄÁÆ®·Ñ ÇÒ ¼ö ÀÖ´Â ±â´ÉÀ» Á¦°øÇÏÁö ¸øÇÏ´Â °æ¿ì°¡ ÀÖ´Ù. ´Ù½Ã ¸»Çؼ­, ±×·¯ÇÑ ¾ð¾î°¡ Á¦°øÇÏ´Â ¸Ó½Å¿¡ ´ëÇÑ Á¦¾î±â´É º¸´Ù ´õ ¼¼¹ÐÇÏ°Ô Çϵå¿þ¾î¸¦ ÄÁÆ®·Ñ ÇØ¾ß ÇÏ´Â °æ¿ì¿¡ ¾î¼Àºí¸®°¡ À¯¿ëÇϰųª, ÇÊ¿äÇÒ °ÍÀÌ´Ù. ±×·¯ÇÑ °æ¿ì, ¿©·¯ºÐÀº ¸ÅÅ©·Î ÇÁ·Î¼¼½ÌÀ̳ª ¸ÞŸ ÇÁ·Î±×·¡¹Ö ÅøÀ» À¯¿ëÇÏ°Ô ¾µ ¼ö ÀÖ´Ù. ±×·¯ÇÑ ÅøÀ» »ç¿ëÇϸé, ¿©·¯ºÐÀº ÆÐÅÏÀ» ÀÌ¿ëÇÑ ÇÁ·Î±×·¡¹ÖÀ» ÇÒ ¼ö ÀÖ°Ô µÈ´Ù. ´Ù½Ã ¸»Çؼ­, ÇÑ ÆÐÅÏ¿¡ ´ëÇÑ Á¤ÀǸ¦ ³»·Á µÎ¸é, ±×°ÍÀ» ÀÌ¿ëÇÏ¿© ¾ÈÀüÇÏ°Ô, ¶Ç Àç»ç¿ë °¡´ÉÇÏ°Ô ¸ÅÅ©·Î ó·³ »ç¿ëÇÏ¿© ÇÁ·Î±×·¡¹ÖÀ» ÇÒ ¼ö ÀÖ°Ô µÇ´Â °ÍÀÌ´Ù. ±×·¯ÇÑ ¹æ½ÄÀ¸·Î ÇÁ·Î±×·¡¹ÖÀ» ÇÑ´Ù¸é, ¿©·¯ºÐÀÌ ¸¸µç ÄÚµå´Â º¸´Ù ¾ÈÀüÇϸç, ¼öÁ¤ÇÒ ¶§¿¡µµ ÆÐÅÏÀÇ Á¤ÀǸ¸ ¹Ù²ãÁÖ¸é ÀÚµ¿À¸·Î ¼öÁ¤µÈ ¹öÁ¯ÀÇ ¼Ò½º°¡ ´Ù½Ã »ý¼ºµÇ°Ô ÇÏ´Â µîÀÇ ¿©·¯°¡Áö ÀÕÁ¡ÀÌ ÀÖ´Ù. ÀϹÝÀûÀ¸·Î »ç¿ëÇÏ´Â ¾î¼Àºí·¯¸¸ °¡Áö°í´Â ½ÉÁö¾î ÀÛÀº ·çƾÀ» C ¿Í ¿¬°áÇÏ·Á°í ÇÒ ¶§¿¡µµ ÀÌ¿Í°°ÀÌ º¹ÀâÇÑ ±â´ÉÀ» ¼öÇàÇÒ ¼ö ¾ø´Ù.


4.1. ¿ÜºÎ ÇÊÅ͵é

¿©·¯ºÐÀÌ Áñ°Ü »ç¿ëÇÏ´Â ¾î¼Àºí·¯¿¡¼­ Áö¿øÇÏ´Â ¸ÅÅ©·Î°¡ ¹«¾ùÀ̵ç, ¿©·¯ºÐÀÌ ÁÖ·Î »ç¿ëÇÏ´Â ¾ð¾î°¡ ¹«¾ùÀ̵çÁö°£¿¡ (½ÉÁöÀÇ C ÀÏ °æ¿ì¿¡µµ) ±× ¾ð¾î°¡ ¿©·¯ºÐÀÌ »ý°¢Çϱ⿡ ÃæºÐÈ÷ expressive(¸ðµç °ÍÀ» Ç¥ÇöÇÒ ¼ö ÀÖ´Â) ÇÏÁö ¾Ê´Ù¸é, ¿©·¯ºÐÀº ¿©·¯ºÐÀÇ ¼Ò½º ÆÄÀÏÀ» ¿ÜºÎÀÇ ÇÊÅ͸¦ Åë°úÇؼ­ Àç»ý¼º(?)µÇ°Ô ÇÒ ¼ö ÀÖÀ¸¸ç, Makefile ¿¡¼­ ´ÙÀ½¿¡ º¸¿©Áö´Â °Í°ú °°Àº °£´ÜÇÑ ±ÔÄ¢¸¸ Ãß°¡ ÇÔÀ¸·Î¼­ ±×·¸°Ô ÇÒ ¼ö ÀÖ´Ù.

%.s:    %.S other_dependencies
        $(FILTER) $(FILTER_OPTIONS) < $< > $@


4.1.1. CPP

CPP ´Â ½ÇÀº ±×¸® Ç¥ÇöÀûÀÌÁö ¸øÇÏ´Ù(is truly not very expressive), ÇÏÁö¸¸, °£´ÜÇÑ ÀÏÀ» Çϱâ À§Çؼ­´Â CPP ·Îµµ ÃæºÐÇÏ´Ù. CPP ´Â Ç¥ÁØÀ̸ç, GCC ¿¡ ÀÇÇؼ­ Åõ¸íÇÏ°Ô È£ÃâµÇ¾îÁø´Ù.

CPP ÀÇ ÇÑ°è¿¡ ´ëÇÑ ¿¹¸¦ µéÀÚ¸é, ¿©·¯ºÐÀº ¿©·¯ºÐÀÇ °´Ã¼°¡ ¼±¾ðµÇ¾î¼­, »ç¿ëÇÒ ¶§, ±× °´Ã¼°¡ À¯È¿ÇÑ ºÎºÐÀÇ ¸¶Áö¸·¿¡ ÀÚµ¿À¸·Î ¼Ò¸êÀÚ(destructor) °¡ È£ÃâµÇ°Ô ÇÏ´Â ±â´ÉÀ» ±¸ÇöÇÒ ¼ö´Â ¾ø´Ù.

As an example of its limitations, you can't declare objects so that destructors are automatically called at the end of the declaring block; you don't have diversions or scoping, etc.

CPP ´Â ´ëºÎºÐÀÇ C ÄÄÆÄÀÏ·¯ ÆÐÅ°Áöµé¿¡ Æ÷ÇԵǾî ÀÖ´Ù. ±×·¯³ª, Ưº°È÷ ¶Ù¾î³ª°Å³ª ÇÏÁöµµ ¾Ê´Ù.


4.1.2. M4

M4 ´Â ¿©·¯ºÐ¿¡°Ô ¸Å¿ì ÈǸ¢ÇÏ°í, °­·ÂÇÑ ¸ÅÅ©·Î ÇÁ·Î¼¼½Ì µµ±¸°¡ µÇ¾î ÁÙ °ÍÀÌ´Ù. °Ô´Ù°¡ Turing °ú °°Àº ¾ð¾î¸¦ Áö¿øÇÏ°í, Àç±Í, Á¤±Ô Ç¥Çö½Ä µîµµ Áö¿øÇÑ´Ù. ¿©·¯ºÐÀº CPP ·Î ÇÏÁö ¸øÇß´ø ¸ðµç °ÍÀ» M4 ¸¦ °¡Áö°í ÇÒ ¼ö ÀÖ°Ô µÉ °ÍÀÌ´Ù.

M4 gives you the full power of macroprocessing, with a Turing equivalent language, recursion, regular expressions, etc. You can do with it everything that CPP cannot.

m4 ¸¦ »ç¿ëÇÑ ¸ÅÅ©·Î ÇÁ·Î±×·¡¹ÖÀÇ ¿¹Á¦¸¦ ±¸Çϱ⸦ ¿øÇÑ´Ù¸é, macro4th (this4th - ftp://ftp.forth.org/pub/Forth/Compilers/native/unix/this4th.tar.gz) ³ª the Tunes 0.0.0.25 sources(ftp://ftp.tunes.org/pub/tunes/obsolete/dist/tunes.0.0.0/tunes.0.0.0.25.src.zip) À» ÂüÁ¶Çϱ⠹ٶõ´Ù.

±×·¯³ª, However, its disfunctional quoting and unquoting semantics force you to use explicit continuation-passing tail-recursive macro style if you want to do advanced macro programming (which is remindful of TeX -- BTW, has anyone tried to use TeX as a macroprocessor for anything else than typesetting ?). This is NOT worse than CPP that does not allow quoting and recursion anyway.

±¸ÇØ¾ß ÇÒ M4 ÀÇ ¹öÁ¯Àº GNU m4 1.4 ȤÀº ±× ÀÌ»óÀÇ ¹öÁ¯ÀÌ´Ù. °¡Àå ¸¹Àº ±â´É°ú °¡Àå ÀûÀº ¹ö±× ȤÀº Á¦ÇÑÀ» °¡Áö°í ÀÖ´Â ¹öÁ¯À̱⠶§¹®ÀÌ´Ù. m4 ´Â ¼È°èµÉ ¶§, °£ÆíÇÑ »ç¿ëÀ» ¸ñÀûÀ¸·Î ¼³°èµÇ°í, ºü¸¥ ¼Óµµ¸¦ ¸ñÇ¥·Î Çؼ­ ¼³°èµÇÁö ¾Ê¾Ò±â ¶§¹®¿¡, ¹«¾ùÀ» ÇϵçÁö Á».. ´À¸®´Ù. ±×·¯³ª, ¾î¼Àºí¸® ÇÁ·Î±×·¥À» ¸¸µé¶§¿¡´Â º° ¹®Á¦°¡ µÇÁö ¾Ê´Â´Ù. ¾î¼Àºí¸®·Î ¸î¹é¸¸ ¶óÀÎÀ̳ª µÇ´Â ¾çÀ» ÄÚµùÇÒ °ÍÀΰ¡? ±×·¸Áö ¾Ê´Ù.


4.1.3. ¿©·¯ºÐÀÌ ¸¸µç ÇÊÅ͸¦ ÀÌ¿ëÇÑ ¸ÅÅ©·Î ÇÁ·Î¼¼½Ì

¿©·¯ºÐÀº perl À̳ª awk, sed µîÀ» °¡Áö°íµµ ¿©·¯ºÐ ÀÚ½ÅÀÇ °£´ÜÇÑ ¸ÅÅ©·Î È®Àå ÇÊÅ͸¦ ¸¸µé ¼ö ÀÖ´Ù. ¿ÀÈ÷·Á °£´ÜÇÑ °ÍÀº ÀÌ·¯ÇÑ ÅøÀ» °¡Áö°í ¸¸µå´Â °ÍÀÌ ´õ ³ªÀ»Áöµµ ¸ð¸¥´Ù. ±×·¯³ª. ¸ÅÅ©·Î ÇÁ·Î¼¼½ÌÀ̶õ ¸»Àº "the hard way(Á» ´õ Èûµç ¹æ¹ý?)" ¶ó´Â ´µ¾Ó½º¸¦ dz±ä´Ù. You can write your own simple macro-expansion filter with the usual tools: perl, awk, sed, etc. It can be made rather quickly, and you control everything. But, of course, power in macroprocessing implies "the hard way".


4.2. ¸ÞŸÇÁ·Î±×·¡¹Ö

¸ÅÅ©·Î¸¦ È®Àå½ÃÄÑ ÁÖ´Â ¿ÜºÎÇÊÅ͸¦ »ç¿ëÇÏ´Â ´ë½Å »ç¿ëÇÒ ¼ö ÀÖ´Â ¶Ç´Ù¸¥ ¹æ¹ýÀÌ Àִµ¥, ±×°ÍÀº ¿©·¯ºÐÀÇ ÇÁ·Î±×·¥ÀÇ ÀϺΠȤÀº Àüü¸¦ ¸¸µé¾îÁÖ´Â ÇÁ·Î±×·¥À» Â¥´Â °ÍÀÌ´Ù.

¹«½¼ ¸»Àΰí ÇÏ´Ï, ¿¹¸¦ µé¾î ¼³¸íÇØ º¸¸é, ¿©·¯ºÐÀº ¼Ò½º Äڵ带 Ãâ·ÂÇØÁÖ´Â ÇÁ·Î±×·¥À» »ç¿ëÇÒ ¼öµµ ÀÖ´Ù. ±×·¯ÇÑ ÇÁ·Î±×·¥ÀÇ ¿¹¸¦ µéÀÚ¸é,

  • »çÀÎ(sine)À̳ª ÄÚ»çÀÎ(cosine) µîÀÇ ÇÔ¼ö°ªÀÇ Å×À̺íÀ» ã¾Æ¼­ ÀûÀýÇÑ °ªÀ» »ý¼º½ÃÄÑ ÁÖ´Â ÇÁ·Î±×·¥

  • ÀÌÁøÆÄÀÏ¿¡¼­ ¼Ò½º-Æû(source-form) À» ÃßÃâÇÏ´Â ÇÁ·Î±×·¥

  • ¿©·¯ºÐÀÇ ºñÆ®¸ÊÀ» ÄÄÆÄÀÏÇؼ­ °í¼Ó Ãâ·Â ·çƾÀ» ¸¸µé¾îÁÖ´Â ÇÁ·Î±×·¥

  • ÃʱâÈ­¿Í Á¾·á Äڵ带 ¸¸µé¾îÁְųª, ¹®¼­¸¦ ÃßÃâÇϰųª, ÇÏ´Â ÇÁ·Î±×·¥

    to extract documentation, initialization/finalization code, description tables, as well as normal code from the same source files,

  • ¾î¶² ÀÏÀ» ÇÏ´Â ½©À̳ª ÆÞ Äڵ带 ¾î¼Àºí¸® ÄÚµå·Î ¹Ù²Ù¾î ÁÖ´Â ÇÁ·Î±×·¥

  • ÇÑ°÷¿¡¼­ Á¤ÀÇµÈ µ¥ÀÌÅ͸¦ ¿©·¯°¡ÁöÀÇ »óÈ£ ÂüÁ¶ÇÏ´Â Å×À̺í°ú ÄÚµå ûũµé·Î »ý¼º½ÃÄÑ ÁÖ´Â ÇÁ·Î±×·¥

  • µîÀÌ ÀÖÀ» ¼ö ÀÖ´Ù. (¿ªÀÚÀÇ »ý°¢À¸·Î´Â yacc ³ª lex µî°ú °°Àº ÇÁ·Î±×·¥À» À̾߱âÇÏ´Â °Í °°´Ù : ¿ªÀÚÁÖ : yacc ³ª lex ¸¦ ÀÌ¿ëÇؼ­ °£´ÜÇÑ ÄÄÆÄÀÏ·¯³ª ¾î¼Àºí·¯¸¦ ¸¸µé ¼ö ÀÖ´Ù. »ç¿ëÇÒ ·©±ÍÁöÀÇ ¹®¹ýÀ» ÀÔ·ÂÇϸé, ÇØ´çÇÏ´Â ÄÄÆÄÀÏ·¯°¡ »ý¼ºµÈ´Ù.)

±×·¯ÇÑ ÇÁ·Î±×·¥µéÀ» Çѹø °í·ÁÇØ º¸¶ó!


4.2.1. ÄÄÆÄÀÏ·¯ÀÇ ¹é¿£µå·Î Á¦°øµÇ´Â ¾î¼Àºí·¯ÀÇ ÀÌ¿ë

GCC, SML/NJ, Objective CALM, MIT-Scheme, CMUCL µî°ú °°Àº ÄÄÆÄÀÏ·¯µéÀº °íÀ¯ÀÇ ¾î¼Àºí·¯ ¹é¿£µå¸¦ °®Ãß°í ÀÖ´Ù. ¿©·¯ºÐÀº ÀÌ·¯ÇÑ ¹é¿£µå¸¦ ÀÌ¿ëÇؼ­ ¾î¼Àºí¸® Äڵ带 ¾òÀ» ¼ö ÀÖ´Ù. ¿©·¯ºÐÀÌ »ç¿ëÇÏ´Â ¾ð¾î¸¦ ÀÌ¿ëÇؼ­ ¸¸µç ÇÁ·Î±×·¥À» ¾Õ¼­ ¾ð±ÞÇÑ ÄÄÆÄÀÏ·¯·Î ÄÄÆÄÀÏÇؼ­ ÈǸ¢ÇÑ ¾î¼Àºí¸® Äڵ带 ¾òÀ» ¼ö ÀÖ°í, ±× Äڵ带 ¿©·¯ºÐÀÌ ´õ ³´°Ô ¼öÁ¤Çؼ­ ¸¶À½¿¡ µå´Â ¾î¼Àºí¸® Äڵ带 ¾òÀ» ¼ö ÀÖ´Ù.


4.2.2. ´ºÀúÁö ¸Ó½Å-ÄÚµå ÅøŶ

ÇÁ·Î±×·¡¹Ö ¾ð¾î¶ó´Â ¾ÆÀÌÄÜÀ» »ç¿ëÇؼ­ ±â°è¾î¸¦ ´Ù·ç´Â ÅøŶÀÇ °³¹ß°ú °ü·ÃµÈ ÇÁ·ÎÁ§Æ®°¡ ÀÖ´Ù(½ÇÇèÀûÀÎ ML ¹öÁ¯µµ Á¦°øÇÑ´Ù) http://www.eecs.harvard.edu/~nr/toolkit/À» Çѹø µÑ·¯º¸¶ó


4.2.3. TUNES ÇÁ·ÎÁ§Æ®

Free Reflective Computing System À» À§ÇÑ TUNES Project(http://www.tunes.org) ¿¡¼­µµ ÀÚüÀûÀÎ ¾î¼Àºí·¯¸¦ Scheme ¾ð¾îÀÇ È®ÀåÀ¸·Î °³¹ßÇÏ°í ÀÖ´Ù. ¾ÆÁ÷ Á¦´ë·Î ½ÇÇàµÇ´Â °ÍÀº ¾Æ´ÏÁö¸¸ ¸»ÀÌ´Ù.

tunes ÇÁ·ÎÁ§Æ®¿¡¼­ °³¹ßÁßÀÎ ¾î¼Àºí·¯´Â abstract syntax Æ®¸®¸¦ ´Ù·ç´Âµ¥, ±×·¸°Ô ÇÏ¿©, µð½º¾î¼Àºí·¯·Îµµ, ¾î¼Àºí·¯ ¹®¹ý ¹ø¿ª±â·Îµµ, ÄÄÆÄÀÏ·¯³ª ¾î¼Àºí·¯µéÀÇ °øÅëÀûÀÎ ¹é¿£µå·Îµµ »ç¿ëÇÒ ¼ö ÀÖµµ·Ï ÇÏ°í ÀÖ´Ù. ¶ÇÇÑ, Scheme À̶ó´Â ¾ð¾îÀÇ °­·ÂÇÔÀº ¸ÅÅ©·Î ÇÁ·Î¼¼½ÌÀ̳ª ¸ÞŸ ÇÁ·Î±×·¡¹Öó·³ µµÀüÇÒ ¸¸ÇÑ ºÐ¾ßÀÌ´Ù.(?)

The assembler manipulates abstract syntax trees, so it could equally serve as the basis for a assembly syntax translator, a disassembler, a common assembler/compiler back-end, etc. Also, the full power of a real language, Scheme, make it unchallenged as for macroprocessing/metaprogramming.


5장. ÇÔ¼ö È£Ãâ ±ÔÄ¢

5.1. Linux

5.1.1. GCC ·ÎÀÇ ¸µÅ· : Linking to GCC

¸¸¾à ¿©·¯ºÐÀÌ C ¿Í ¾î¼Àºí¸®°¡ È¥ÇÕµÈ ÇÁ·ÎÁ§Æ®¸¦ ¼öÇàÇÏ°í ÀÖ´Ù¸é, Áö±Ý ¼Ò°³ÇÏ°íÀÚ ÇÏ´Â ¹æ¹ýÀ» ÃßõÇÏ°íÀÚ ÇÑ´Ù. ¸®´ª½º Ä¿³Î¿¡¼­ .S ÀÇ È®ÀåÀÚ¸¦ °¡Áø ÆÄÀϵé Áß¿¡¼­, gas °¡ ó¸®ÇÏ´Â (as86 ÀÌ Ã³¸®ÇÏ´Â ÆÄÀÏÀÌ ¾Æ´Ô!) ÆÄÀϵéÀ» ÅëÇؼ­ À¯¿ëÇÑ ¿¹Á¦¸¦ ¹ß°ßÇÒ ¼ö ÀÖ´Ù.

32ºñÆ®ÀÇ argument µéÀº ½ºÅÿ¡ Ǫ½ÃµÉ ¶§, 32ºñÆ®ÀÇ ±Ù°Å¸® ¹Ýȯ ÁÖ¼Ò (32-bit near return address) ÀÇ À­ºÎºÐ¿¡ ¿ª¼øÀ¸·Î Ǫ½ÃµÇ¾îÁø´Ù. µû¶ó¼­, ±×°ÍµéÀÌ pop µÉ ¶§¿¡´Â ¿Ã¹Ù¸¥ ¼ø¼­·Î pop µÇ¾îÁø´Ù. %ebp, %esi, %edi, %ebx ·¹Áö½ºÅ͵éÀº ÇÇÈ£ÃâÀÚ°¡ ÀúÀåÇÏ°Ô µÇ°í, ´Ù¸¥ ·¹Áö½ºÅ͵éÀº È£ÃâÀÚ°¡ ÀúÀåÇÏ°Ô µÈ´Ù. %eax ´Â °á°ú°¡ 32ºñÆ® À϶§ °á°ú¸¦ ÀúÀåÇÏ´Â ¿ëµµ·Î »ç¿ëµÇ¾îÁö°í, ¸¸¾à, °á°ú°¡ 64ºñÆ®¶ó¸é, ±×¶§´Â %edx:%eax ·¹Áö½ºÅÍ ½ÖÀÌ °á°ú¸¦ ÀúÀåÇϴµ¥ »ç¿ëµÈ´Ù.

FP stack ¿¡ ´ëÇؼ­´Â È®½ÇÇØ Àß ¸ð¸£°ÚÁö¸¸, ÀúÀÚ´Â °á°ú°¡ st(0) ¿¡ ÀúÀåµÇ°í, ½ºÅà Àüü°¡ È£ÃâÀÚ°¡ ÀúÀåÇÏ´Â ¿ëµµ·Î ¾²ÀÎ´Ù°í »ý°¢ÇÑ´Ù.

GCC °¡ ·¹Áö½ºÅ͵éÀÇ ¿ëµµ¸¦ ¹Ì¸® ÁöÁ¤Çؼ­ À§¿¡¼­ ¼³¸íÇÑ È£Ãâ ±ÔÄ¢À» ¼öÁ¤ÇÏ´Â ¿É¼ÇÀ» °¡Áö°í ÀÖ´Ù´Â °ÍÀ» ÀØÁö ¾Êµµ·Ï Ç϶ó. ÀÚ¼¼ÇÑ ³»¿ëÀº i386 .info ÆäÀÌÁö¸¦ ÂüÁ¶Ç϶ó.

¿©·¯ºÐÀº GCC ÀÇ Ç¥ÁØ ÇÔ¼ö È£Ãâ ±ÔÄ¢À» µû¸£´Â ÇÔ¼ö¸¦ À§Çؼ­ cdecl À̳ª regparm(0) attribute ¸¦ ¼±¾ðÇؾ߸¸ ÇÑ´Ù´Â °ÍÀ» ±â¾ïÇ϶ó. GCC info ÆäÀÌÁöÀÇ C Extensions::Extended Asm:: ¼½¼ÇÀ» ÂüÁ¶Ç϶ó. ¶ÇÇÑ, Linux °¡ asmlinkage ¸ÅÅ©·Î¸¦ ¾î¶»°Ô Á¤ÀÇÇÏ°í ÀÖ´ÂÁöµµ ÂüÁ¶Ç϶ó.


5.1.2. ELF ¿Í a.out ¹®Á¦

¸î¸î C ÄÄÆÄÀÏ·¯µéÀº ¹ØÁÙ ¹®ÀÚ¸¦ ´Ù¸¥ ½Éº¼µé º¸´Ù ¸ÕÀú È®ÀåÇÑ´Ù. ´Ù¸¥ ÄÄÆÄÀÏ·¯´Â ±×·¸°Ô ÇÏÁö ¾ÊÁö¸¸ (¿ªÀÚ ÁÖ : ¿ø¹®ÀÇ ³»¿ëÀº Some C compilers prepend an underscore before every symbol, while others do not. ÀÔ´Ï´Ù)

Linux ÀÇ a.out GCC ´Â ±×·¯ÇÑ È®ÀåÀ» ÇÑ´Ù. ±×·¸Áö¸¸, ELF GCC ´Â ÇÏÁö ¾Ê´Â´Ù.

¿©·¯ºÐÀÌ ±×·¯ÇÑ Æ¯¼ºÀ» ±Øº¹ÇÒ ÇÊ¿ä°¡ ÀÖ´Ù¸é, ÇöÁ¸ÇÏ´Â ÆÐÅ°ÁöµéÀº ¾î¶»°Ô ÇÏ´ÂÁö¸¦ ÂüÁ¶Ç϶ó. ¿¹¸¦ µé¾î, ¿À·¡µÈ ¸®´ª½ºÀÇ ¼Ò½ºÆ®¸®³ª, ȤÀº Elk, qthreads, OCaml µî°ú °°Àº ÆÐÅ°Áö¸¦ ±¸Çؼ­ »ìÆ캼 ¼ö ÀÖÀ» °ÍÀÌ´Ù.

¿©·¯ºÐÀº ¶ÇÇÑ, ´ÙÀ½°ú °°Àº ¹®ÀåÀ» »ðÀÔÇÔÀ¸·Î½á ÇÔÃàµÈ(implicit) C -> asm ÀÇ renaming ±ÔÄ¢À» override ÇÒ ¼öµµ ÀÖÀ» °ÍÀÌ´Ù.

	void foo asm("bar") (void);
±×·¸°Ô Çϸé, foo() C ÇÔ¼ö´Â ½ÇÁ¦·Î ¾î¼Àºí¸®¿¡¼­´Â bar À̶ó°í ºÒ¸®¿ì°Ô µÉ °ÍÀÌ´Ù.

binutils ÆÐÅ°ÁöÀÇ objcopy À¯Æ¿¸®Æ¼°¡ ¿©·¯ºÐÀÇ a.out ¿ÀºêÁ§Æ®¸¦ ELF Çü½ÄÀÇ ¿ÀºêÁ§Æ® ÆÄÀÏ·Î º¯È¯ÇØ ÁÙ ¼ö ÀÖÀ½À» ÁÖ¸ñÇ϶ó. ±×¸®°í, ±× ¹Ý´ëÀÇ Àϵµ °¡´ÉÇÒ °ÍÀÌ´Ù. º¸´Ù ÀϹÝÀûÀ¸·Î À̾߱âÇÏÀÚ¸é, ±× À¯Æ¿¸®Æ¼´Â ´õ ¸¹Àº ÇüÅÂÀÇ ÆÄÀÏ Çü½Ä º¯È¯µµ ÇØ ÁÙ °ÍÀÌ´Ù.


5.1.3. Direct Linux syscalls

¿©·¯ºÐÀº Á¾Á¾ C library (libc) ¸¦ »ç¿ëÇÏ´Â °ÍÀÌ À¯ÀÏÇÑ ¹æ¹ýÀ̸ç, Á÷Á¢ÀûÀÎ ½Ã½ºÅÛ ÄÝÀº º°·Î ÁÁÁö ¾Ê´Ù´Â ¸»À» µéÀ» °ÍÀÌ´Ù. ÀÌ°ÍÀº »ç½ÇÀÌ´Ù. ±×·¯³ª ÀϹÝÀûÀ¸·Î ¿©·¯ºÐÀº libc °¡ ½Å¼º½ÃµÇ°í ÀÖÁö ¾Ê´Ù´Â °Í°ú, ´ëºÎºÐÀÇ °æ¿ì libc ´Â ¸î°¡Áö üũ¸¸ ÇÏ°í, Ä¿³ÎÀ» È£ÃâÇÑ ÈÄ, errno º¯¼ö¸¦¼¼ÆÃÇÒ »ÓÀ̶ó´Â °ÍÀ» ¾Ë¾Æ¾ß ÇÑ´Ù. ¿©·¯ºÐÀº ¿©·¯ºÐÀÇ ÇÁ·Î±×·¥¿¡¼­µµ ÀÌ¿Í °°Àº °ÍÀ» ½±°Ô ÇÒ ¼ö ÀÖ´Ù (¸¸¾à ¿©·¯ºÐÀÌ ±×°ÍÀ» ÇÊ¿ä·Î ÇÑ´Ù¸é). ±×¸®°í ¿©·¯ºÐÀÌ °øÀ¯ ¶óÀ̺귯¸®¸¦ »ç¿ëÇÏÁö ¾Ê´Â´Ù´Â ÀÌÀ¯¸¸À¸·Îµµ ¿©·¯ºÐÀÇ ÇÁ·Î±×·¥Àº ¸î½Ê¹è ´õ Å©±â°¡ ÁÙ¾îµé °ÍÀ̸ç, ¼öÇ༺´É ¶ÇÇÑ ´õ ÁÁ¾ÆÁú °ÍÀÌ´Ù. libc À» ¾î¼Àºí¸® ÇÁ·Î±×·¡¹Ö¿¡¼­ »ç¿ëÇϰųª ÇÏÁö ¾Ê°Å³ª ÇÏ´Â ¹®Á¦´Â ½Ç¿ëÀûÀÎ ¹®Á¦¶ó±â º¸´Ù´Â ±âÈ£³ª ½Å³ä¿¡ °üÇÑ ¹®Á¦ÀÌ´Ù. Linux ´Â POSIX ȣȯÀ» ¸ñÇ¥·Î ÇÏ°í ÀÖ´Ù´Â °ÍÀ» ±â¾ïÇ϶ó. ±×¸®°í, libc ´Â ±×·¯ÇÑ ¸ñÇ¥¸¦ ¸¸Á·ÇÑ´Ù. ÀÌ°ÍÀº libc system call ÀÇ °ÅÀÇ ¸ðµç ¹®¹ýÀÌ Ä¿³ÎÀÇ ½Ã½ºÅÛ ÄÝÀÇ ½ÇÁ¦ ¹®¹ý°ú Á¤È®È÷ ÀÏÄ¡ÇÑ´Ù´Â ¶æÀÌ´Ù. ±×·¯³ª GNU libc(glibc) ´Â ¹öÁ¯¾÷ÀÌ µÇ¾î °¥¼ö·Ï ´õ ´À·ÁÁö°í ÀÖ´Ù. ¶ÇÇÑ ¸Þ¸ð¸®µµ ´õ ¸¹ÀÌ Àâ¾Æ¸Ô¾î °¡°í ÀÖ´Ù. ±×·¡¼­ Á÷Á¢ÀûÀÎ ½Ã½ºÅÛ ÄÝÀÌ ²Ï³ª ½Ç¿ëÀûÀÎ °ÍÀÌ µÇ¾î°¡°í ÀÖ´Ù. ±×·¸Áö¸¸... libc ¸¦ »ç¿ëÇÏÁö ¾ÊÀ½À¸·Î½á »ý±â´Â ÁÖµÈ ºÎÀÛ¿ë(?, drawback) Àº ¾Æ¸¶µµ ¿©·¯ºÐÀÌ ¸î¸îÀÇ libc ÀÇ Æ¯Á¤ ÇÔ¼öµé(½Ã½ºÅÛ ÄÝ wrapper °¡ ¾Æ´Ñ)À» Á÷Á¢ ±¸ÇöÇÒ ÇÊ¿ä°¡ »ý±æÁöµµ ¸ð¸¥´Ù´Â °ÍÀÌ´Ù. (À̸¦Å׸é, printf() °ú °°Àº...) ±×¸®°í, ¿©·¯ºÐÀÌ libc ¸¦ »ç¿ëÇÏÁö ¾Ê±â·Î °áÁ¤Çß´Ù¸é, ´ç¿¬È÷ ¿©·¯ºÐÀº ±×·¸°Ô ÇÒ °¢¿À(?)°¡ µÇ¾î ÀÖ´Â °ÍÀÌ´Ù. ±×·¸Áö ¾ÊÀº°¡?

¿©±â¿¡ Á÷Á¢ÀûÀÎ ½Ã½ºÅÛ ÄÝÀ» ÇÏ´Â °ÍÀÇ µæ°ú ½ÇÀÌ ³ª¿­µÇ¾î ÀÖ´Ù :

À̵æ:

  • °¡´ÉÇÑÇÑ ÄÚµåÀÇ Å©±â¸¦ ÁÙÀÏ ¼ö ÀÖ´Ù

  • °¡´ÉÇÑ ÃÖ´ëÀÇ ¼Óµµ¸¦ ³¾ ¼ö ÀÖ´Ù.

  • ¿©·¯ºÐÀÇ ÇÁ·Î±×·¥À̳ª ¶óÀ̺귯¸®¸¦ ¿©·¯ºÐÀÌ »ç¿ëÇϴ ƯÁ¤ ¾ð¾î³ª ¸Þ¸ð¸® ¿ä±¸»çÇ× µî ¾î¶² °Í¿¡µµ Àû¿ëÇÒ ¼ö ÀÖ´Ù. Áï, full control À» ¾òÀ» ¼ö ÀÖ´Ù.

  • libc cruft ¿¡ ÀÇÇÑ °øÇØ°¡ ¾ø´Ù(? ¿ø¹® : no pollution by libc cruft)

  • C ÀÇ ÇÔ¼ö È£Ãâ ±ÔÄ¢À¸·Î ÀÎÇÑ °øÇØ°¡ ¾ø´Ù (¿ø¹® : no pollution by C calling conventions) (¸¸¾à ¿©·¯ºÐÀÌ ¿©·¯ºÐ ÀÚ½ÅÀÇ ¾ð¾î³ª ȤÀº ȯ°æÀ» °³¹ßÇÏ°í ÀÖ´Ù¸é)

  • Á¤Àû ¹ÙÀ̳ʸ®µéÀº ¿©·¯ºÐÀ» libc ¾÷±×·¹À̵峪 Å©·¡½¬¿Í ¹«°üÇÏ°Ô ÇØ ÁÙ °ÍÀÌ´Ù. ȤÀº, ½©ÀÇ #! ÀÎÅÍÇÁ¸®ÅÍ Æнº¿Íµµ ¹«°üÇÏ°Ô ÇØ ÁÙ °ÍÀÌ´Ù.

    ¿ø¹® : static binaries make you independent from libc upgrades or crashes, or from dangling #! path to an interpreter (and are faster)

  • Àç¹ÌÀÖ´Ù. (¿ø¹® : just for the fun out of it (don't you get a kick out of assembly programming?)

¼ÕÇØ:

  • ¸¸¾à ¿©·¯ºÐÀÇ ÄÄÇ»ÅÍÀÇ ´Ù¸¥ ÇÁ·Î±×·¥ Áß libc ¸¦ »ç¿ëÇÏ´Â ÇÁ·Î±×·¥ÀÌ ÀÖ´Ù¸é, libc ÀÇ Äڵ带 µÎ°³¾¿À̳ª °¡Áö´Â ÀÏÀº ¿©·¯ºÐÀÇ ¸Þ¸ð¸®¸¦ ³¶ºñÇÒ »ÓÀÌ´Ù.

  • ¿©·¯ Á¤Àû ¹ÙÀ̳ʸ®¿¡¼­ ºÒÇÊ¿äÇÏ°Ô ±¸ÇöµÈ ¼­ºñ½ºµé ¿ª½Ã ¸Þ¸ð¸®ÀÇ ³¶ºñÀÏ µû¸§ÀÌ´Ù. ±×·¯³ª ¿©·¯ºÐÀÈ ¿©·¯ºÐÀÇ libc ´ëüǰÀ» ¸¸µé¾î¼­ °øÀ¯ ¶óÀ̺귯¸®·Î »ç¿ëÇÒ ¼ö ÀÖ´Ù.

  • ¸ðµç°ÍÀ» ¾î¼Àºí¸®·Î ¸¸µå´Â °Í ´ë½Å, ¹ÙÀÌÆ®Äڵ峪 ¿öµåÄÚµå ȤÀº, structure interpreter ¿Í °°Àº °ÍÀ» »ç¿ëÇÔÀ¸·Î½á ÄÚµåÀÇ Å©±â°¡ °ý¸ñÇÒ ¸¸Å­ ÁÙ¾îµé °ÍÀÌ´Ù. (ÀÎÅÍÇÁ¸®ÅÍ ÀÚü´Â C ·Î ¸¸µéµç, ¾î¼Àºí¸®·Î ¸¸µéµç »ó°ü ¾ø´Ù.) ¿©·¯°³ÀÇ ¹ÙÀ̳ʸ®µéÀ» ÀÛ°Ô À¯ÁöÇÏ´Â ÃÖ»óÀÇ ¹æ¹ýÀº, ¿©·¯°³ÀÇ ¹ÙÀ̳ʸ® ÆÄÀÏÀ» À¯ÁöÇÏ´Â °ÍÀÌ ¾Æ´Ï¶ó, #! µî°ú °°Àº ½© ÀÎÅÍÇÁ¸®Å͸¦ »ç¿ëÇؼ­ ÀÎÅÍÇÁ¸®ÅÍ ÇÁ·Î¼¼½º¸¦ Çϳª ¸¶·ÃÇÏ´Â °ÍÀÌ´Ù. ÀÌ·¯ÇÑ ¹æ¹ýÀ¸·Î OCaml Àº ¿öµåÄÚµå ¸ðµå (ÃÖÀûÈ­µÈ native code mode ¿Í ¹Ý´ë¸») ¿¡¼­ µ¿ÀÛÇÑ´Ù. ¶ÇÇÑ, ±×·¸°Ô ÇÏ´Â °ÍÀº libc ¸¦ »ç¿ëÇÏ´Â °Í°úµµ ȣȯ¼ºÀÌ ÀÖ´Ù. ÀÌ ¹æ¹ýÀº Tom Christiansen ÀÌ Perl PowerTools ¿¡¼­ À¯´Ð½º À¯Æ¿¸®Æ¼µéÀ» »õ·Î ±¸ÇöÇÑ ¹æ¹ýÀÌ´Ù. ¸¶Áö¸·À¸·Î, ÇϵåÄÚµåµÈ °æ·Î¿¡ ÀÇÇÑ ¿ÜºÎ ÆÄÀÏ¿¡ ÀÇÁ¸ÇÏÁö ¾Ê°í¼­ ÄÚµåÀÇ Å©±â¸¦ ÁÙÀÌ´Â ¹æ¹ýÀ¸·Î, ´ÜÁö ÇϳªÀÇ ¹ÙÀ̳ʸ® ÆÄÀϸ¸ À¯ÁöÇÏ°í, ±× ÆÄÀÏ¿¡ ´ëÇÑ ¿©·¯°¡Áö À̸§ÀÇ hard ȤÀº soft ¸µÅ©¸¦ À¯ÁöÇÏ´Â ¹æ¹ýÀÌ ÀÖ´Ù : µ¿ÀÏÇÑ ¹ÙÀ̳ʸ® ÆÄÀÏÀº ÃÖÀûÀÇ °ø°£¿¡¼­ ¿©·¯ºÐÀÌ ¿øÇÏ´Â ¸ðµç°ÍÀ» Á¦°øÇÒ °ÍÀ̸ç, ±×°Í¿¡´Â ºÒÇÊ¿äÇÑ ¼­ºê·çƾÀ̳ª ȤÀº ÇÊ¿ä¾ø´Â ¹ÙÀ̳ʸ® Çì´õµµ ¾øÀ» °ÍÀÌ´Ù. ¹ÙÀ̳ʸ®´Â argv[0] ¿¡ ÀÇÇؼ­¸¸ ÇൿÀ» °áÁ¤ÇÒ °ÍÀÌ´Ù. ƯÁ¤ À̸§À¸·Î È£ÃâµÇÁö ¾ÊÀº °æ¿ì¿¡´Â µðÆúÆ®·Î ½©ÀÌ µÉ ¼öµµ ÀÖÀ¸¸ç, ¾Æ¸¶µµ ÀÎÅÍÇÁ¸®ÅÍ·Î µ¿ÀÛÇÏÁö ¾ÊÀ»¼öµµ ÀÖ´Ù.

    (¿ø¹®À» ÇÔ²² °³Á¦ÇÕ´Ï´Ù : Finally, one last way to keep things small, that doesn't depend on an external file with a hardcoded path, be it library or interpreter, is to have only one binary, and have multiply-named hard or soft links to it: the same binary will provide everything you need in an optimal space, with no redundancy of subroutines or useless binary headers; it will dispatch its specific behavior according to its argv[0]; in case it isn't called with a recognized name, it might default to a shell, and be possibly thus also usable as an interpreter!

  • ¿©·¯ºÐÀº ¸®´ª½º ½Ã½ºÅÛ ÄÝ ÀÌ¿Ü¿¡µµ libc °¡ Á¦°øÇÏ´Â ¸¹Àº ±â´ÉµéÀ» À¯¿ëÇÏ°Ô »ç¿ëÇÒ ¼ö ¾ø´Ù : Áï, ¸ÇÆäÀÌÁö ¼½¼Ç 3 ¿¡ ³ª¿À´Â ¿©·¯°¡Áö ±â´Éµé, À̸¦Å׸é, malloc, threads, locale, password, high-level network management µî°ú °°Àº °ÍÀ» »ç¿ëÇÒ ¼ö ¾ø´Ù´Â À̾߱âÀÌ´Ù.

  • µû¶ó¼­, ¿©·¯ºÐÀº libc ÀÇ ´ëºÎºÐÀ» »õ·Î ±¸ÇöÇØ¾ß ÇÒÁöµµ ¸ð¸£´Ù. Áï, printf() ·ÎºÎÅÍ malloc() °ú gethostbyname ±îÁöµµ Á÷Á¢ ±¸ÇöÇØ¾ß ÇÒ °ÍÀÌ´Ù. ±×·¸°Ô ÇÏ´Â °ÍÀº ºÒÇÊ¿äÇÑ ÀÏÀ̸ç, ¶§¶§·Î ¸Å¿ì Áö·çÇÑ ÀÛ¾÷ÀÌ µÉ ¼öµµ ÀÖ´Ù. ¸î¸î »ç¶÷µéÀÌ ¹ú½á "light" ¹öÁ¯ÀÇ libc ¸¦ ±¸ÇöÇØ µÎ¾ú´Ù´Â °Í¿¡ ÁÖ¸ñÇÏ°í, ±×·¯ÇÑ ÀÛ¾÷ÀÇ °á°ú¹°À» üũÇØ º¸µµ·Ï Ç϶ó. (·¹µåÇÞÀÇ minilibc : Rick Hohensee's libsys, Felix von Leitner's dietlibc, Christian Fowelin's libASM, asmutils ÀÌ ÇÁ·ÎÁ§Æ®´Â ¼ø¼ö ¾î¼Àºí¸® libc ¸¦ °¡Áö°í ÀÛ¾÷ÇÏ°í ÀÖ´Ù.)

  • Á¤Àû ¶óÀ̺귯¸®¸¦ »ç¿ëÇÏ¸é ¿©·¯ºÐÀº libc ¾÷±×·¹À̵峪 zlibc ÆÐÅ°Áö (gzip À¸·Î ¾ÐÃàµÈ ÆÄÀϵ鿡 ´ëÇؼ­ Åõ¸íÇÑ ¾ÐÃàÇ®±â¸¦ ¼öÇàÇØ ÁÖ´Â) ¿Í °°Àº libc add-on µé·ÎºÎÅÍ À̵æÀ» ¾òÀ» ¼ö ¾ø°Ô µË´Ï´Ù.

  • libc ¿¡ ÀÇÇؼ­ Ãß°¡µÈ ¸î¸î ÀνºÆ®·°¼ÇÀº ½Ã½ºÅÛ ÄÝ°ú ºñ±³Çؼ­ ¹Ï±âÁö ¾ÊÀ»¸¸Å­ ÀûÀº ¼ÓµµÀÇ ¿À¹öÇìµå¸¦ °¡Áø´Ù. ¸¸¾à ¼öÇà¼Óµµ°¡ Áß¿äÇÑ ¹®Á¦¶ó¸é, ¿©·¯ºÐÀÇ ÁÖµÈ ¹®Á¦´Â ¿©·¯ºÐÀÌ ½Ã½ºÅÛ ÄÝÀ» »ç¿ëÇϴµ¥ ÀÖÀ» °ÍÀ̸ç, ¿©·¯ºÐÀÌ »ç¿ëÇÏ´Â wrapper °¡ ±¸ÇöµÈ ¹æ½Ä¿¡´Â ¹®Á¦°¡ ¾øÀ» °ÍÀÌ´Ù.

  • L4Linux ¿Í °°Àº micro-kernel ¸®´ª½º ¹öÁ¯À» »ç¿ëÇÒ ¶§¿¡´Â ½Ã½ºÅÛ ÄÝÀÇ Ç¥ÁØ ¾î¼Àºí¸® API ¸¦ »ç¿ëÇÏ´Â °ÍÀÌ libc ÀÇ API ¸¦ »ç¿ëÇÏ´Â °Í º¸´Ù ÈξÀ ´À¸± ¼ö ÀÖ´Ù. ±×·¯ÇÑ ¸¶ÀÌÅ©·Î Ä¿³Î ¸®´ª½º ¹öÁ¯Àº ÀڽŸ¸ÀÇ º¸´Ù ºü¸¥ È£Ãâ ±ÔÄ¢À» °¡Áö°í ÀÖÀ¸¸ç, Ç¥ÁØ È£Ãâ ±ÔÄ¢À» »ç¿ëÇÏ´Â °æ¿ì ¸Å¿ì ³ôÀº convention translation (È£Ãâ ±ÔÄ¢ º¯È¯) ¿À¹öÇìµå°¡ °É¸± ¼ö ÀÖ´Ù. (L4Linux ´Â ±×¿¡ ¸Â´Â syscall API ¸¦ ÀÌ¿ëÇؼ­ ÀçÄÄÆÄÀÏµÈ libc ¿Í ÇÔ²² Á¦°øµÈ´Ù : ¹°·Ð, ¿©·¯ºÐÀº ¿©·¯ºÐÀÇ Äڵ带 Á¦°øµÈ API ¸¦ ÀÌ¿ëÇؼ­ ´Ù½Ã ÄÄÆÄÀÏ ÇØ¾ß ÇÒÁöµµ ¸ð¸¥´Ù)

  • ¾Õ¼­ ´Ù·ç¾ú´ø ÀϹÝÀûÀÎ ¼Óµµ ÃÖÀûÈ­¿¡ ´ëÇÑ ÅäÀǸ¦ ÂüÁ¶Ç϶ó.

  • ¸¸¾à¿¡ ½Ã½ºÅÛ ÄÝÀÌ ¿©·¯ºÐÀÌ º¸±â¿¡ ³Ê¹« ´À·Á º¸Àδٸé, ¿©·¯ºÐÀº userland ¿¡ ¸Ó¹°±âº¸´Ù´Â Ä¿³Î ¼Ò½º¸¦ Á÷Á¢ ÇØÅ·Çؼ­ ¿øÇÏ´Â °á°ú¸¦ ¾òÀ» ¼ö ÀÖ´Ù.

¸¸¾à ¿©·¯ºÐÀÌ ¹æ±Ý ¾ð±ÞÇÑ µæ½ÇµéÀ» ½É»ç¼÷°í ÇßÀ¸¸ç, ±×·¡µµ ¿©ÀüÈ÷ direct ½Ã½ºÅÛ ÄÝÀ» »ç¿ëÇϱ⸦ ¿øÇÑ´Ù¸é, ¾Æ·¡¿¡ ¸î°¡Áö Á¶¾ðÀ» ÷ºÎÇØ ÁÖ°Ú´Ù :

  • ¿©·¯ºÐÀº ¿©·¯ºÐÀÇ ½Ã½ºÅÛ ÄÝ ÇÔ¼öµéÀ» asm/unistd.h À» include ÇÏ°í, Á¦°øµÈ ¸ÅÅ©·ÎµéÀ» »ç¿ëÇÔÀ¸·Î½á C ·Î Æ÷ÅͺíÇÏ°Ô(¾î¼Àºí¸®¸¦ »ç¿ëÇÑ Æ÷ÅͺíÇÏÁö ¾ÊÀº ÇüÅÂ¿Í ¹Ý´ëµÇ´Â) ±¸ÇöÇÒ ¼ö ÀÖ´Ù.

  • ¿©·¯ºÐÀÌ ±×°ÍÀ» ´ëüÇÏ·Á°í Çϱ⠶§¹®¿¡, libc ¼Ò½º Äڵ带 ±¸Çؼ­, ±×°ÍÀ» ÇØÅ·ÇØ º¸¶ó (and grok them) (±×¸®°í, ¸¸¾à ¿©·¯ºÐÀÌ ´õ Àß ÇÒ ¼ö ÀÖ´Ù°í »ý°¢ÇÑ´Ù¸é, libc ÀúÀڵ鿡°Ô Çǵå¹éÀ» ÇÒ ¼ö ÀÖµµ·Ï Ç϶ó!)

  • ¿©·¯ºÐÀÌ ¿øÇÏ´Â ¸ðµç°ÍÀ» ÇØ ÁÖ´Â ¼ø¼ö ¾î¼Àºí¸® ÄÚµåÀÇ ¿¹Á¦·Î½á, ÀÌ ¹®¼­ÀÇ µÞºÎºÐ¿¡ ³ª¿À´Â ¸®¼Ò½º ¸ñ·ÏÀ» ÂüÁ¶Ç϶ó.Linux assembly resources.

±âº»ÀûÀ¸·Î, ½Ã½ºÅÛ ÄÝÀº int 0x80 ÀνºÆ®·°¼ÇÀ» __NR_ ½Ã½ºÅÛ ÄÝ ¹øÈ£ ¸¦ (asm/unistd.h ÆÄÀϷκÎÅÍ.) eax ·¹Áö½ºÅÍ¿¡ ³Ö°í, ÆĶó¹ÌÅ͵é (six°³ ±îÁö) Àº °¢°¢ ebx, ecx, edx, esi, edi, ebp ·¹Áö½ºÅÍ¿¡ ³Ö¾î¼­ È£ÃâÇÑ´Ù.

¸®ÅÏ°ªÀº eax ·¹Áö½ºÅÍ¿¡ ´ã°ÜÁö°Ô µÇ¸ç, À½¼öÀÇ ¸®ÅÏ°ªÀº ¿¡·¯°¡ ÀÖÀ½À» ³ªÅ¸³½´Ù. libc °¡ errno º¯¼ö¿¡ Áý¾î³Ö´Â °ª°ú ´ëÀÀµÇ´Â °ªÀÌ´Ù. »ç¿ëÀÚ ¿µ¿ªÀÇ ½ºÅÃÀº ¿µÇâÀ» ¹ÞÁö ¾Ê´Â´Ù. ±×·¡¼­ ¿©·¯ºÐÀº ½Ã½ºÅÛ ÄÝÀ» ÇàÇÒ µ¿¾È¿¡ À¯È¿ÇÑ °ÍÀ» °¡Áú ÇÊ¿ä´Â ¾ø´Ù(?)

¿ø¹® : Result is returned in eax, negative result being an error, whose opposite is what libc would put into errno. The user-stack is not touched, so you needn't have a valid one when doing a syscall.

참고: ebp ·¹Áö½ºÅÍ¿¡ ¿©¼¸¹ø° ÆĶó¹ÌÅ͸¦ ´ã¾Æ¼­ ³Ñ°ÜÁÖ´Â °ÍÀº Linux 2.4 ¿¡¼­ºÎÅÍ º¼ ¼ö ÀÖ´Ù. ±× ÀÌÀüÀÇ ¸®´ª½º ¹öÁ¯µéÀº ·¹Áö½ºÅÍ¿¡ ´ã±â´Â ´Ù¼¸°³ÀÇ ÆĶó¹ÌÅ͸¸ ÀνÄÇÑ´Ù.

Linux Kernel Internals, ¹®¼­ÀÇ How System Calls Are Implemented on i386 Architecture? ÀåÀº ¿©·¯ºÐ¿¡°Ô º¸´Ù È®½ÇÇÑ °³³äÀ» Á¦°øÇÒ °ÍÀÌ´Ù.

ÇÁ·Î¼¼½º¸¦ óÀ½ ½ÃÀÛÇÒ ¶§ ³Ñ°ÜÁö´Â ÀÎÀڵ鿡 ´ëÇؼ­´Â, ÀϹÝÀûÀÎ ¿øÄ¢Àº ½ºÅÃÀÌ ÀÎÀÚÀÇ °¹¼ö¸¦ ÀúÀåÇÏ´Â argc ÀÇ °ª°ú, *argc ¸¦ ±¸¼ºÇÏ´Â Æ÷ÀÎÅÍÀÇ ¸®½ºÆ®¿Í NULL-terminated µÇ´Â variable=value ÀÇ È¯°æº¯¼ö (environ) °ªµéÀÇ ¸®½ºÆ®¸¦ ÀúÀåÇÑ´Ù´Â °ÍÀÌ´Ù.

¿ø¹® : As for the invocation arguments passed to a process upon startup, the general principle is that the stack originally contains the number of arguments argc, then the list of pointers that constitute *argv, then a null-terminated sequence of null-terminated variable=value strings for the environment.

º¸´Ù ÀÚ¼¼ÇÑ Á¤º¸¸¦ ¿øÇÑ´Ù¸é, ¸®¼Ò½º ¸®½ºÆ®¸¦ ÂüÁ¶Çؼ­ (: Linux assembly resources) libc ÀÇ C ½ºÅ¸Æ®¾÷ ÄÚµåÀÇ ¼Ò½º¸¦ ÀÐ¾î º¸¾Æ¶ó. (crt0.S or crt1.S) ȤÀº ¸®´ª½º Ä¿³ÎÀÇ ¼Ò½º¸¦ ÂüÁ¶Ç϶ó . (exec.c and binfmt_*.c in linux/fs/).


5.1.4. ¸®´ª½º¿¡¼­ÀÇ Çϵå¿þ¾î ÀÔÃâ·Â

¿©·¯ºÐÀÌ ¸®´ª½º¿¡¼­ Á÷Á¢ I/O Æ÷Æ®¿¡ÀÇ ÀÔÃâ·ÂÀ» ¼öÇàÇÏ°íÀÚ ÇÑ´Ù¸é, OS ÀÇ ÁßÀ縦 ÇÊ¿ä·Î ÇÏÁö ¾Ê´Â ¸Å¿ì °£´ÜÇÑ ÀÏÀ̾ IO-Port-Programming ¹Ì´Ï ÇÏ¿ìÅõ¸¦ ÂüÁ¶ÇÏ¸é µÉ Á¤µµÀ̰ųª ¾Æ´Ï¸é Ä¿³Î µð¹ÙÀ̽º µå¶óÀ̹ö¸¦ ÇÊ¿ä·Î Çؼ­ ¿©·¯ºÐÀÌ Ä¿³Î ÇØÅ·À̳ª µð¹ÙÀ̽º µå¶óÀ̹ö °³¹ßÀ̳ª, Ä¿³Î ¸ðµâ°ú °°Àº °Íµé¿¡ ´ëÇؼ­ ´õ ¸¹Àº °ÍÀ» ½ÀµæÇؾ߸¸ ÇÏ´Â °æ¿ìÀ̰ųª µÑÁß ÇϳªÀÇ °æ¿ìÀÏ °ÍÀÌ´Ù. (Ä¿³Î ¸ðµâÀ̳ª µð¹ÙÀ̽º µå¶óÀ̹ö¿¡ ´ëÇÑ °ÍµéÀº LDP ¿¡ ¸Å¿ì ÈǸ¢ÇÑ ÇÏ¿ìÅõµéÀÌ Á¸ÀçÇÑ´Ù.)

Ȥ½Ã ¿©·¯ºÐÀÌ ¿øÇÏ´Â °ÍÀÌ ±×·¡ÇÈ ÇÁ·Î±×·¡¹ÖÀÎ °æ¿ì, ´ÙÀ½ÀÇ ÇÁ·ÎÁ§Æ®µéÀ» ÂüÁ¶Ç϶ó : GGI ȤÀº XFree86 ÇÁ·ÎÁ§Æ®

¾î¶² »ç¶÷µéÀº ÀÛ°í, °ß°íÇÑ XFree86 µå¶óÀ̹öµéÀ» interperted domain-specific language ÀÎ GAL, ·Î °³¹ßÇÔÀ¸·Î½á º¸´Ù È¿°úÀûÀÎ °á°ú¸¦ ¾ò¾ú´Ù.

¿ø¹® : Some people have even done better, writing small and robust XFree86 drivers in an interpreted domain-specific language, GAL, and achieving the efficiency of hand C-written drivers through partial evaluation (drivers not only not in asm, but not even in C!). The problem is that the partial evaluator they used to achieve efficiency is not free software. Any taker for a replacement?

¾î·°Å³ª, ÀÌ ¸ðµç °æ¿ì¿¡µµ, ¿©·¯ºÐÀº linux/asm/*.h ¿¡ ÀÖ´Â GCC ÀζóÀÎ ¾î¼Àºí¸®¿Í ¸ÅÅ©·Î¸¦ »ç¿ëÇÔÀ¸·Î½á Àüü¸¦ ¾î¼Àºí¸®·Î ÄÚµùÇÏ´Â °Íº¸´Ù È¿À²ÀûÀ¸·Î ÀÏÀ» ¼öÇàÇÒ ¼ö ÀÖ´Ù.


5.1.5. Accessing 16-bit drivers from Linux/i386

±×·¯ÇÑ ÀϵéÀº ÀÌ·ÐÀûÀ¸·Î °¡´ÉÇÏ´Ù (Áõ¸í : DOSEMU °¡ ÇÁ·Î±×·¥µé¿¡°Ô ¼±ÅÃÀûÀ¸·Î Çϵå¿þ¾î Æ÷Æ® Á¢±Ù ±ÇÇÑÀ» ÁÖ´Â ¹æ¹ýÀ» º¸¶ó) ±×¸®°í, ÀúÀÚ´Â ¾îµò°¡ÀÇ ´©±º°¡°¡ ½ÇÁ¦·Î ±×·¯ÇÑ ÀÏÀ» Çß´Ù´Â ¼Ò¹®À» µé¾ú´Ù. (PCI µå¶óÀ̹ö¿¡¼­Àΰ¡? ¾Æ´Ï¸é, VESA µå¶óÀ̹ö¿¡¼­Àΰ¡... À½... ISA PnP ¿´´ø°¡... Àß ¸ð¸£°Ú´Ù) ¸¸¾à ¿©·¯ºÐÀÌ º¸´Ù Á¤È®ÇÑ Á¤º¸¸¦ °¡Áö°í ÀÖ´Ù¸é ȯ¿µÇÑ´Ù. (¿ªÀÚÁÖ : ¸ÞÀÏÀ» ´Þ¶ó´Â ¶æÀεí) ¾î·µç, Á¤º¸¸¦ ã±â ¸Å¿ì ÁÁÀº °÷Àº ¸®´ª½ºÀÇ Ä¿³Î ¼Ò½º¿Í DOSEMU ÀÇ ¼Ò½ºÀÌ´Ù. (±×¸®°í, DOSEMU repository ÀÇ ´Ù¸¥ ¸¹Àº ÇÁ·Î±×·¥µéÀÌ´Ù.) ¶ÇÇÑ, ¿©·¯°¡ÁöÀÇ ¸®´ª½ºÀÇ low-level ÇÁ·Î±×·¥µéÀÇ ¼Ò½ºµéµµ µµ¿òÀÌ µÉ °ÍÀÌ´Ù. (perhaps GGI if it supports VESA)

±âº»ÀûÀ¸·Î ¿©·¯ºÐÀº 16ºñÆ® º¸È£¸ðµå³ª ȤÀº vm86 ¸ðµå¸¦ ÀÌ¿ëÇؾ߸¸ ÇÒ °ÍÀÌ´Ù.

ÀüÀÚ(16ºñÆ® º¸È£¸ðµå) ´Â ¼Â¾÷Àº ºñ±³Àû ½¬¿ì³ª ¼¼±×¸ÕÆ® Á¶ÀÛÀ̳ª Àý´ë ¼¼±×¸ÕÆ® ÁÖ¼ÒÁöÁ¤(segment 0 À» ÁÖ¼ÒÁöÁ¤ÇÏ´Â °Í°ú°°Àº) ÀÌ ¾ø´Â Àß µ¿ÀÛÇÏ´Â Äڵ带 ¸¸µé¾î¾ß¸¸ µ¿ÀÛÇÑ´Ù. ¿ì¿¬ÀÌ¶óµµ ¸ðµç »ç¿ëÇÏ´Â ¼¼±×¸ÕÆ®°¡ LDT(¿ªÀÚÁÖ : Local Descriptor Table, ÀÎÅÚ ¾ÆÅ°ÅØÃÄ¿¡¼­ ¼¼±×¸ÕÆ®¿Í ³í¸® ÁÖ¼Ò, ¹°¸® ÁÖ¼ÒµéÀ» º¯È¯ÇÏ´Â µ¥ »ç¿ëµÇ´Â ÀڷᱸÁ¶) ¸¦ ¸¶¸® ¼Â¾÷ÇØ ¹ö¸®Áö ¾Ê´Â ÇÑÀº ±×·¯ÇÏ´Ù

¿ø¹® : The first is simpler to setup, but only works with well-behaved code that won't do any kind of segment arithmetics or absolute segment addressing (particularly addressing segment 0), unless by chance it happens that all segments used can be setup in advance in the LDT.

ÈÄÀÚ(vm86 ¸ðµå) ´Â 'vanilla 16-bit ȯ°æ' ¿¡¼­ º¸´Ù ¸¹Àº ȣȯ¼ºÀ» Á¦°øÇϱâ´Â ÇÏÁö¸¸, ´õ º¹ÀâÇÑ Çڵ鸵ÀÌ ÇÊ¿äÇÏ´Ù.

µÎ °æ¿ì ¸ðµÎ ¿©·¯ºÐÀÌ 16ºñÆ® Äڵ带 »ç¿ëÇϱâ Àü¿¡ ¹Ýµå½Ã ÇØ¾ß ÇÒ ÀϵéÀÌ ÀÖ´Ù :

  • 16ºñÆ® Äڵ忡¼­ »ç¿ëµÉ Àý´ë ÁÖ¼ÒµéÀ» /dev/mem À¸·ÎºÎÅÍ ¿©·¯ºÐÀÇ ÇÁ·Î¼¼½ºÀÇ ÁÖ¼Ò °ø°£À¸·Î ¸Þ¸ð¸® ¸Ê Ç϶ó. (À̸¦Å׸é, ROM À̳ª, ºñµð¿À ¹öÆÛ, DMA Ÿ°Ùµé, ±×¸®°í, memory-mapped I/O ¿Í °°Àº °Íµé)

  • LDT ¿Í(³ª) vm86 ¸ðµåÀÇ ¸ð´ÏÅ͸¦ ¼Â¾÷Ç϶ó (setup the LDT and/or vm86 mode monitor)

  • ÀûÀýÇÑ I/O Á¢±Ù ±ÇÇÑÀ» Ä¿³Î·ÎºÎÅÍ È¹µæÇ϶ó(À§ÀÇ ¼½¼ÇÀ» ÂüÁ¶Ç϶ó)

´Ù½ÃÇѹø DOSEMU ÇÁ·ÎÁ§Æ®ÀÇ ¼Ò½ºµé¿¡ ³ª¿À´Â ³»¿ëµéÀ» ÁÖÀDZíÀÌ Àеµ·Ï ÇÏ¿©¶ó. ƯÈ÷, ¸®´ª½º/i386 ¿¡¼­ ELKS ¿Í °£´ÜÇÑ .COM ÇÁ·Î±×·¥µéÀ» µ¹¸± ¼ö ÀÖ´Â mini-emulator µéÀÇ ¼Ò½º¸¦ ÀÚ¼¼È÷ º¸µµ·Ï Ç϶ó.


5.2. DOS and Windows

´ëºÎºÐÀÇ µµ½º È®ÀåÀÚµéÀº µµ½º ¼­ºñ½º¿¡ ´ëÇÑ ÀÎÅÍÆäÀ̽º¸¦ Á¦°øÇÑ´Ù. ±×µéÀÇ ¹®¼­¿¡¼­ °ü·ÃµÈ ³»¿ëµéÀ» ÀÐ¾î º¸µµ·Ï Ç϶ó. ±×·¯³ª Á¾Á¾ ±×µéÀº int 0x21 À» ½Ã¹Ä·¹ÀÌÆ® Çϱ⸸ Çϸç, ¿©·¯ºÐÀÌ Á¤¸»·Î real mode ¿¡ ÀÖ´Â °Í "ó·³" ¸¸µé¾î ÁØ´Ù. (ÀúÀÚ´Â ±×µéÀÌ Á¤¸»·Î ½ºÅÓ ÀÌ»óÀÇ ¹«¾ùÀΰ¡¸¦ °¡Áö°í ÀÖ´ÂÁö Àǽɽº·´´Ù. ±×¸®°í, 32ºñÆ® ¿ÀÆÛ·£µåµéÀ» °¡Áö°í¼­ Á¦´ë·Î µ¿ÀÛÇÏ´ÂÁöµµ Àǽɽº·´´Ù. ´ë°³°¡ ±×·¯ÇÑ ÇÁ·Î±×·¥µéÀº ¸®¾ó ¸ðµå ÀÎÅÍ·´Æ®¸¦ °¡»ó 86 ¸ðµå(vm86 ¸ðµå) ·Î ¹Ý¿µ¸¸ ÇÒ µû¸§ÀÌ´Ù.

DPMI ¿Í °ü·ÃµÈ ¹®¼­µéÀÌ ´ÙÀ½ÀÇ ¸µÅ©µé¿¡ Á¸ÀçÇÑ´Ù : ftp://x2ftp.oulu.fi/pub/msdos/programming/ (¿ø·¡ÀÇ x2ftp »çÀÌÆ®°¡ ¹®µé ´Ý¾Ò±â ¶§¹®¿¡ ´ÙÀ½ÀÇ ¸µÅ©¸¦ ÀÌ¿ëÇ϶ó : mirror site).

DJGPP ´Â ÀÚüÀÇ(Á¦ÇѹöÁ¯ÀÓ) glibc À¯»çÇ°(?) À» Á¦°øÇÑ´Ù.

Linux ¿¡¼­ DOS ¿ëÀÇ ¹ÙÀ̳ʸ®·Î Å©·Î½º ÄÄÆÄÀÏ ÇÏ´Â °Íµµ °¡´ÉÇÏ´Ù. ¿©·¯ºÐ Áö¿ªÀÇ metalab.unc.edu ÀÇ FTP ¹Ì·¯ÀÇ devel/msdos/ µð·ºÅ丮¸¦ º¸¶ó. ¶ÇÇÑ, MOSS DOS-È®ÀåÀÚ¸¦ Utah ´ëÇÐÀÇ Flux project ¿¡¼­ ±¸ÇÒ ¼ö ÀÖ´Ù.

´Ù¸¥ ¹®¼­µéÀ̳ª faq µéÀº º¸´Ù µµ½º Áß½ÉÀÌ´Ù. ¿ì¸®´Â µµ½ºÈ¯°æÀÇ °³¹ßÀ» ÃßõÇÏÁö ¾Ê´Â´Ù.

Windows and Co. ÀÌ ¹®¼­´Â À©µµ¿ìÁî ÇÁ·Î±×·¡¹Ö¿¡ °üÇÑ ¹®¼­°¡ ¾Æ´Ï´Ù. ´ç½ÅÀº ´Ù¸¥ °÷¿¡¼­ ±×¿¡ °ü·ÃµÈ ¸¹Àº °ÍµéÀ» ãÀ» ¼ö ÀÖ´Ù. ´ç½ÅÀÌ ¾Ë¾Æ¾ß ÇÒ °ÍÀº Cygnus Solutions °¡ cygwin32.dll library ¸¦ Win32 Ç÷§Æû¿¡¼­ GNU ÇÁ·Î±×·¥µéÀ» ½ÇÇà½ÃÅ°±â À§Çؼ­ °³¹ßÇß´Ù´Â °ÍÀÌ´Ù. µû¶ó¼­, ´ç½ÅÀº gcc, gas, ±×¸®°í ±× ¿ÜÀÇ gnu ÅøµéÀ» ´Ù¸¥ ¸¹Àº À¯´Ð½º ÀÀ¿ë ÇÁ·Î±×·¥Ã³·³ À©µµ¿ì¿¡¼­ ½ÇÇà½Ãų ¼ö ÀÖ´Ù.


5.3. ¿©·¯ºÐÀÌ ¸¸µç OS

½Ã½ºÅÛ¿¡ ´ëÇÑ ¿ÏÀüÇÑ Á¦¾î ¶ó´Â Ư¼ºÀº ¸¹Àº OS °³¹ßÀÚµéÀ» ¾î¼Àºí¸®·Î À¯È¤Çϴ Ư¼ºÀÌ´Ù. self-development ¸¦ Çã¿ëÇÏ´Â ½Ã½ºÅÛÀº, ºñ·Ï, ±×°ÍÀÌ ´Ù¸¥ ½Ã½ºÅÛÀÇ 'À§¿¡¼­' ¿î¿µµÉÁö¶óµµ (Linux over Mach ³ª OpenGenera over Unix ó·³) "OS" ¶ó°í ºÎ¸¦ ¼ö ÀÖÀ½À» ±â¾ïÇ϶ó.

µû¶ó¼­, º¸´Ù ½¬¿î µð¹ö±ëÀ» À§ÇØ ¿©·¯ºÐÀº ¸®´ª½º¿¡¼­ ½ÇÇàµÇ´Â ÇÁ·Î¼¼½º·Î¼­ÀÇ ¿©·¯ºÐÀÇ "OS" ¸¦ ¸ÕÀú °³¹ßÇÏ°íÀÚ ÇÒÁöµµ ¸ð¸¥´Ù. (´À¸±Áö´Â ¸ð¸£Áö¸¸) ±×¸®°í ³ª¼­ Flux OS kit (Linux ¿Í BSD µå¶óÀ̹öµéÀ» ¿©·¯ºÐ ÀÚ½ÅÀÇ OS ¿¡¼­ »ç¿ëÇÒ ¼ö ÀÖ°Ô ÇØ ÁÖ´Â À¯Æ¿¸®Æ¼) ¸¦ »ç¿ëÇؼ­ ±×°ÍÀ» stand-alone À¸·Î ¸¸µé°íÀÚ ÇÒÁöµµ ¸ð¸£°Ú´Ù. ¿©·¯ºÐÀÇ OS °¡ stable ÇÏ°í, ¿©·¯ºÐÀÌ ÁøÁ¤À¸·Î ¿©·¯ºÐÀÇ Ã¢Á¶¹°À» »ç¶ûÇÑ´Ù¸é ±×¶§¿¡¾ß ¿©·¯ºÐÀÇ Çϵå¿þ¾î µå¶óÀ̹öµéÀ» ¸¸µé ½Ã±â°¡ ¿Â °ÍÀÌ´Ù.

ÀÌ ÇÏ¿ìÅõ´Â ºÎÆ®·Î´õÀÇ Äڵ峪, 32-ºñÆ® ¸ðµå·Î ÁøÀÔÇÏ´Â ¹ýÀ̶óµçÁö, ÀÎÅÍ·´Æ®¸¦ ´Ù·ç´Â ¹ýÀ̳ª, ÀÎÅÚÀÇ º¸È£¸ðµå, ȤÀº °¡»ó/¸®¾ó 86 ¸ðµå¶óµçÁö ¿©·¯ºÐÀÇ ¿ÀºêÁ§Æ® ÆÄÀÏ Æ÷¸ËÀ̳ª È£Ãâ ±ÔÄ¢¿¡ °üÇÑ °ÍµéÀº ´Ù·çÁö ¾Ê´Â´Ù.

¿©·¯ºÐÀÌ ±×·¯ÇÑ °Íµé¿¡ °üÇÑ ¹ÏÀ»¸¸ÇÑ Á¤º¸¸¦ ãÀ» ¼ö ÀÖ´Â ÁÖµÈ Àå¼Ò´Â ÇöÁ¸ÇÏ´Â OS µé°ú ºÎÆ®·Î´õµéÀÇ ¼Ò½ºÄÚµåÀÌ´Ù. ´ÙÀ½ÀÇ À¥ÆäÀÌÁö¿¡ ¸¹Àº ¸µÅ©µéÀÌ ÀÖÀ» °ÍÀÌ´Ù : http://www.tunes.org/Review/OSes.html


6장. ÀÏ´Ü µû¶óÇغ¸ÀÚ(Quick Start)

6.1. ¼Ò°³

¸¶Ä§³» ¶§°¡ ¿Ô´Ù. ¿©·¯ºÐÀÌ ¾ÆÁ÷µµ ÀÌ ¹®¼­¸¦ Àаí ÀÖÀ¸¸ç, ¿©ÀüÈ÷ ¾î¼Àºí¸®·Î ¹«¾ð°¡¸¦ ¸¸µé°Ú´Ù´Â ±¤±â¾î¸°(!) »ý°¢À» °¡Áö°í ÀÖ´Ù¸é (¿©±â±îÁö ÀÐÀº »ç¶÷À̶ó¸é, Á¤¸» ¾î¼Àºí¸® ÆÒÀÓ¿¡ Ʋ¸²¾ø´Ù), ÀÌÁ¦ºÎÅÍ ½ÃÀÛÇϴµ¥¿¡ ÇÊ¿äÇÑ °ÍÀ» ¾Ë·ÁÁÖ°Ú´Ù.

¿©·¯ºÐÀÌ ¾Õ¼­ ÀÐÀº ¹Ù¿Í °°ÀÌ ¿©·¯ºÐÀº ¸®´ª½º ¿î¿µÃ¼Á¦¿¡¼­ ¿©·¯°¡Áö ¹æ¹ýÀ¸·Î ÇÁ·Î±×·¡¹ÖÀ» ÇÒ ¼ö ÀÖ´Ù. ÀÌÁ¦ºÎÅÍ º» ÀúÀÚ´Â Ä¿³ÎÀÇ ½Ã½ºÅÛ ÄÝÀ» Á÷Á¢ È£ÃâÇÏ´Â ¹æ¹ýÀ» º¸¿©ÁÖ·Á ÇÑ´Ù. ¿Ö! Á÷Á¢ Ä¿³ÎÀ» È£ÃâÇϴ°¡? ±×·¸°Ô ÇÏ´Â °ÍÀÌ Ä¿³ÎÀÌ Á¦°øÇÏ´Â ¼­ºñ½º¸¦ È£ÃâÇÏ´Â °¡Àå ºü¸¥(!) ¹æ¹ýÀ̱⠴빮ÀÌ´Ù. ÀÌ ¹æ¹ýÀ» »ç¿ëÇϸé, ¿ì¸®ÀÇ ÄÚµå´Â ´Ù¸¥ ¶óÀ̺귯¸®¿¡ ¸µÅ©µÉ ÇÊ¿ä°¡ ¾ø´Ù. ELF ÀÎÅÍÇÁ¸®Å͸¦ »ç¿ëÇÒ ÇÊ¿äµµ ¾ø´Ù.´ÜÁö, Ä¿³Î°ú Á÷Á¢ ÀÇ»ç¼ÒÅëÇÒ µû¸§ÀÌ´Ù.

ÀúÀÚ´Â µ¿ÀÏÇÑ ÀÏÀ» ÇÏ´Â »ùÇà ÇÁ·Î±×·¥À» nasm °ú gas, ÀÌ µÎ°³ÀÇ ¾î¼Àºí·¯¸¦ »ç¿ëÇؼ­ °¢°¢ ÇÁ·Î±×·¡¹Ö ÇÑ ¼Ò½º¸¦ º¸¿©ÁÖ°Ú´Ù. ÀÚ¼¼È÷ º¸¸é, ÀÎÅÚ°è¿­°ú AT&T À¯´Ð½º °è¿­ÀÇ ¹®¹ýÀÇ Â÷À̸¦ ¾Ë.. ¼öµµ ÀÖÀ»±î?

¿©·¯ºÐÀº ¶ÇÇÑ, À¯´Ð½º ¾î¼Àºí¸® ÇÁ·Î±×·¡¹Ö Æ©Å丮¾ó(UNIX assembly programming tutorial - http://linuxassembly.org/intro.html)ÀÇ ¼Ò°³¸¦ Àо ¼ö ÀÖ´Ù. °Å±â¿¡´Â ¸®´ª½º ÀÌ¿Ü¿¡µµ, ´Ù¸¥ À¯´Ð½º °è¿­ÀÇ ¿î¿µÃ¼Á¦¸¦ À§ÇÑ »ùÇà ÄÚµåµéÀÌ ÀÖ´Ù.(¿ªÀÚ ÁÖ : FreeBSD, BeOS µî)


6.1.1. ÇÊ¿äÇÑ µµ±¸µé

´ç¿¬È÷ ¾î¼Àºí·¯°¡ ÇÊ¿äÇÏ´Ù. -- nasm À̳ª gas.

±×¸®°í, ¸µÄ¿°¡ ÇÊ¿äÇÏ´Ù. -- ld ¿Ö³ÄÇϸé, ¾î¼Àºí·¯´Â ´ÜÁö ¸ñÀûÄÚµå(object code)¸¸À» ¸¸µé¾î³»±â ¶§¹®ÀÌ´Ù. ´ëºÎºÐÀÇ ¹èÆ÷º»¿¡´Â gas ¿Í ld °¡ Æ÷ÇԵǾî ÀÖ´Ù. binutils ÆÐÅ°Áö¿¡ ÆÐŰ¡µÇ¾î ÀÖ´Ù.

nasm ÀÇ °æ¿ì, ¸®´ª½º¿ëÀÇ ¹®¼­¿Í ¹ÙÀ̳ʸ® ÆÐÅ°Áö¸¦ ´Ù¿î·ÎµåÇؼ­ ¼³Ä¡ÇØ¾ß ÇÑ´Ù. ´Ù¿î·Îµå ÇÒ ¼ö ÀÖ´Â »çÀÌÆ®´Â ´ÙÀ½°ú °°´Ù : nasm site; ¸Çµå·¹ÀÌÅ©, ¼ö¼¼, Stampede, µ¥ºñ¾È µîÀÇ ÆÐÅ°Áö¿¡´Â Æ÷ÇԵǾî ÀÖ´Ù. ¸ÕÀú, È®ÀÎÇ϶ó.

Á¤¸» ±íÀÌ ÆÄ°íµé·Á¸é, ¿©·¯ºÐÀÇ ¿î¿µÃ¼Á¦ÀÇ include ÆÄÀϵéÀ» ¼³Ä¡ÇØ¾ß ÇÏ°í, °¡´ÉÇÏ´Ù¸é, Ä¿³Î ¼Ò½º±îÁö ¼³Ä¡Ç϶ó (¿©·¯ºÐÀÇ ¿î¿µÃ¼Á¦°¡ °ø°³ ¿î¿µÃ¼Á¦ÀÌ¸é °¡´ÉÇÏ´Ù.)


6.2. Hello, world!

6.2.1. Program layout

¸®´ª½º´Â 32ºñÆ® ÇÁ·ÎÅØƼµå ¸ðµå¿¡¼­ µ¿ÀÛÇϸç, ¼±Çü ¸Þ¸ð¸® ¸ðµ¨(flat memory model)À» °¡Áø´Ù. ±×¸®°í, ÀÌÁø ½ÇÇàÆÄÀÏ¿¡ ELF Æ÷¸ËÀ» °¡Áø´Ù.

ÇÁ·Î±×·¥Àº ¿©·¯ºÐÀÌ ÀÛ¼ºÇÑ Äڵ尡 ÀÖ´Â .text ¼½¼Ç°ú (ÀÌ ºÎºÐÀº Àбâ Àü¿ëÀÌ´Ù) ¿©·¯ºÐÀÇ ÃʱâÈ­µÈ(!) data °¡ ÀúÀåµÇ¾î ÀÖ´Â .data ¼½¼Ç, ÃʱâÈ­µÇÁö ¾ÊÀº(!) µ¥ÀÌŸ°¡ ÀúÀåµÇ´Â .bss ¼½¼Ç ¹× ´Ù¸¥ Ç¥ÁØÀûÀÎ ¼½¼Çµé·Î ³ª´¶´Ù. Å©°Ô º¸¸é, .text ¿Í .data ÀÇ µÎ°³ÀÇ ¼½¼ÇÀ¸·Î ³ª´¶´Ù. (Áï, ÄÚµå¿Í µ¥ÀÌŸ) ±×·¯³ª, ´Ù¸¥ ¼½¼Ç ¾øÀÌ .text ¼½¼Ç¸¸À¸·Îµµ ÇÁ·Î±×·¥ÀÌ °¡´ÉÇÏ´Ù. .text ¼½¼ÇÀº ÇÁ·Î±×·¥¿¡ ¹Ýµå½Ã ÀÖ¾î¾ß ÇÏ´Â ¼½¼ÇÀÌ´Ù. (¿ªÀÚÁÖ : »ó»óÇغ¸¶ó! ÄÚµå ¾ø´Â ÇÁ·Î±×·¥ -- ¸»µµ ¾ÈµÈ´Ù.)

ÀÌÁ¦, ù¹ø° ÇÁ·Î±×·¥À» ÀÛ¼ºÇØ º¸ÀÚ (¿ªÀÚÁÖ : ¿ª½Ã³ª.. Çï·Î¿ùµå ÇÁ·Î±×·¥ÀÌ´Ù ¤Ñ.¤Ñ)


6.2.2. NASM (hello.asm)

section     .data                           ;¼½¼Ç .data ¸¦ ¼±¾ðÇÑ´Ù.(¿©±âºÎÅÍ
                                            ; .data ¼½¼ÇÀÌ´Ù.)

msg     db          "Hello, world!",0xa     ;Ãâ·ÂÇÒ »ç¶û½º·±(!) ½ºÆ®¸µÀÌ´Ù.
len     equ         $ - msg                 ;Ä£¾ÖÇÏ´Â(!) ¹®ÀÚ¿­ÀÇ ±æÀÌ

section     .text                           ;¿©±âºÎÅÍ .text ¼½¼ÇÀÌ´Ù. ÄÚµåÀÖÀ½

                    ;ELF ¸µÄ¿³ª ·Î´õ¿¡°Ô ÇÁ·Î±×·¥ÀÇ ¿£Æ®¸® Æ÷ÀÎÆ®¸¦ ¾Ë·ÁÁÖ¾î¾ß
    global _start   ;ÇÑ´Ù. ·Î´õ ȤÀº ¸µÄ¿´Â ÀϹÝÀûÀ¸·Î ¿£Æ®¸® Æ÷ÀÎÆ®°¡ _start 
                    ;¶ó°í °¡Á¤ÇÏ°í ÀÖ´Ù. ÀÌ µðÆúÆ® ¼³Á¤À» ¹Ù²Ü·Á¸é,
                    ;ld -e foo ¸¦ »ç¿ëÇ϶ó.

_start:

;stdout ¿¡ ¿ì¸®ÀÇ »ç¶û½º·± ¹®ÀÚ¿­À» Ãâ·ÂÇÏÀÚ.

        mov     edx,len ;½Ã½ºÅÛ ÄÝ 4¹ø(sys_write)Àº ¼¼¹ø° Àμö·Î Ãâ·ÂÇÒ ¸Þ¼¼ÁöÀÇ
                        ;±æÀ̸¦ ÃëÇÑ´Ù.
        mov     ecx,msg ;½Ã½ºÅÛ ÄÝ 4¹øÀº µÎ¹ø° Àμö·Î Ãâ·ÂÇÒ ¸Þ¼¼Áö°¡ ´ã±ä ¸Þ¸ð¸®
                        ;ÁÖ¼Ò¸¦ ÃëÇÑ´Ù. Áï, Ãâ·ÂÇÒ ¸Þ¼¼Áö·ÎÀÇ Æ÷ÀÎÅ͸¦ ÃëÇÑ´Ù.
        mov     ebx,1   ;½Ã½ºÅÛ ÄÝ 4¹øÀº ù¹ø° Àμö·Î ÆÄÀÏÀÇ ÇÚµé(µð½ºÅ©¸³ÅÍ)À» 
                        ;ÃëÇÑ´Ù.
        mov     eax,4   ;eax ·¹Áö½ºÅÍ¿¡ È£ÃâÇÒ Ä¿³Î ½Ã½ºÅÛ ÄÝÀÇ ¹øÈ£¸¦ ³Ö¾î ÁØ´Ù.
                        ;ÀÌ °æ¿ì¿¡´Â 4¹ø(sys_write) ÀÌ´Ù.
        int     0x80    ;Ä¿³ÎÀ» È£ÃâÇÑ´Ù.

;Ãâ·ÂÀÌ ³¡³µÀ¸¸é, exit ¸¦ È£ÃâÇÑ´Ù.

        mov     ebx,0   ;exit ÄÚµå·Î 0À» ÁØ´Ù. (c ÄÚµå·Î´Â exit(0);)
        mov     eax,1   ;½Ã½ºÅÛ ÄÝ 1¹ø (sys_exit)
        int     0x80	;Ä¿³ÎÀ» È£ÃâÇÑ´Ù.


6.2.3. GAS (hello.S)

.data                           # ¼½¼Ç .data °¡ ¿©±â¼­ºÎÅÍ ½ÃÀÛÇÑ´Ù.

msg:
    .string	"Hello, world!\n"   # ¿ì¸®ÀÇ »ç¶û½º·± ¹®ÀÚ¿­
    len = . - msg               # Ä£¾ÖÇÏ´Â ¹®ÀÚ¿­ÀÇ ±æÀÌ

.text                           # ¼½¼Ç .text °¡ ¿©±â¼­ºÎÅÍ ½ÃÀÛÇÑ´Ù.

                    # ELF ¸µÄ¿³ª ·Î´õ¿¡°Ô ÇÁ·Î±×·¥ÀÇ ¿£Æ®¸® Æ÷ÀÎÆ®¸¦ ¾Ë·ÁÁÖ¾î¾ß
    .global _start  # ÇÑ´Ù. ·Î´õ ȤÀº ¸µÄ¿´Â ÀϹÝÀûÀ¸·Î ¿£Æ®¸® Æ÷ÀÎÆ®°¡ _start 
                    # ¶ó°í °¡Á¤ÇÏ°í ÀÖ´Ù. ÀÌ µðÆúÆ® ¼³Á¤À» ¹Ù²Ü·Á¸é,
                    # ld -e foo ¸¦ »ç¿ëÇ϶ó.

_start:

# stdout ¿¡ ¿ì¸®ÀÇ »ç¶û½º·± ¹®ÀÚ¿­À» Ãâ·ÂÇÏÀÚ.

    movl    $len,%edx   # ½Ã½ºÅÛ ÄÝ 4¹ø(sys_write)Àº ¼¼¹ø° Àμö·Î Ãâ·ÂÇÒ 
                        # ¸Þ¼¼ÁöÀÇ ±æÀ̸¦ ÃëÇÑ´Ù.
    movl    $msg,%ecx   # ½Ã½ºÅÛ ÄÝ 4¹øÀº µÎ¹ø° Àμö·Î Ãâ·ÂÇÒ ¸Þ¼¼Áö°¡ 
                        # ´ã±ä ¸Þ¸ð¸® ÁÖ¼Ò¸¦ ÃëÇÑ´Ù. Áï, Ãâ·ÂÇÒ ¸Þ¼¼Áö·ÎÀÇ 
                        # Æ÷ÀÎÅ͸¦ ÃëÇÑ´Ù.
    movl    $1,%ebx     # ½Ã½ºÅÛ ÄÝ 4¹øÀº ù¹ø° Àμö·Î ÆÄÀÏÀÇ 
                        # ÇÚµé(µð½ºÅ©¸³ÅÍ)À» ÃëÇÑ´Ù.
    movl    $4,%eax     # eax ·¹Áö½ºÅÍ¿¡ È£ÃâÇÒ Ä¿³Î ½Ã½ºÅÛ ÄÝÀÇ ¹øÈ£¸¦ 
                        # ³Ö¾î ÁØ´Ù. ÀÌ °æ¿ì¿¡´Â 4¹ø(sys_write) ÀÌ´Ù. 
    int     $0x80       # Ä¿³ÎÀ» È£ÃâÇÑ´Ù. 

# Ãâ·ÂÀÌ ³¡³µÀ¸¸é, exit ¸¦ È£ÃâÇÑ´Ù.

    movl    $0,%ebx     # exit ÄÚµå·Î 0À» ÁØ´Ù. (c ÄÚµå·Î´Â exit(0);)
    movl    $1,%eax     # ½Ã½ºÅÛ ÄÝ 1¹ø (sys_exit)
    int     $0x80       # Ä¿³ÎÀ» È£ÃâÇÑ´Ù.


6.3. ½ÇÇàÆÄÀÏ ¸¸µé±â

6.3.1. ¸ñÀû ÄÚµå »ý¼º

½ÇÇàÆÄÀÏÀ» ¸¸µé±â À§ÇÑ Ã¹¹ø° ´Ü°è´Â ¼Ò½ºÆÄÀÏÀ» ÄÄÆÄÀÏ È¤Àº ¾î¼Àºí¸µ Çؼ­ ¸ñÀû Äڵ尡 ´ã±ä ÆÄÀÏÀ» ¸¸µå´Â °ÍÀÌ´Ù.

nasm À» »ç¿ëÇÑ´Ù¸é,

            $ nasm -f elf hello.asm
        

gas ¸¦ »ç¿ëÇÑ´Ù¸é,

            $ as -o hello.o hello.S
        

¿Í °°ÀÌ ÇÏ¸é ¸ñÀû Äڵ尡 ´ã°Ü ÀÖ´Â hello.o ¸¦ »ý¼ºÇÏ°Ô µÈ´Ù.


6.3.2. ½ÇÇàÆÄÀÏÀÇ »ý¼º

µÎ¹ø° ´Ü°è·Î½á, ¸ñÀûÄڵ尡 ´ã±ä ÆÄÀϷκÎÅÍ ¸µÄ¿¸¦ È£ÃâÇÏ¿© ½ÇÇà°¡´ÉÇÑ ÆÄÀÏÀ» ¸¸µé¾î³»°Ô µÈ´Ù.

            $ ld -s -o hello hello.o
        

À§¿Í °°ÀÌ ÇÏ¸é µÈ´Ù. ±×·¸°Ô ÇÏ°í ³ª¸é, ¸¶Ä§³», hello ¶ó´Â ½ÇÇàÆÄÀÏÀ» º¼ ¼ö ÀÖ°Ô µÈ´Ù.

Çѹø ½ÇÇà½ÃÄÑ º¸¾Æ¶ó. Á¦´ë·Î µ¿ÀÛÇϴ°¡? ³¡ÀÌ´Ù. ÀÌ°Ô ÀüºÎÀÌ´Ù. ¸Å¿ì °£´ÜÇÏÁö ¾ÊÀº°¡? ³Ê¹«³ª °£´ÜÇؼ­ µÇ·Á Ȳ´çÇÏÁö ¾ÊÀº°¡?!?!

참고: (¿ªÀÚ ÁÖ: ±×·¸´Ù. ÀÌ°ÍÀÌ ¾î¼Àºí¸® ÇÁ·Î±×·¡¹ÖÀÇ ÀüºÎÀÌ´Ù. ´õ ±íÀÌ ÇÁ·Î±×·¡¹ÖÇϱâ À§Çؼ­´Â Ä¿³ÎÀÇ ½Ã½ºÅÛ ÄÝÀÇ ¹øÈ£¸¦ ÀüºÎ ¾Ë¾Æ¾ß ÇÏ°í, ÀÎÅÚ È¤Àº ¿©·¯ºÐÀÌ ÇÁ·Î±×·¡¹Ö Çϱ⠿øÇÏ´Â Ç÷§ÆûÀÇ ¸¶ÀÌÅ©·ÎÇÁ·Î¼¼¼­ÀÇ ÀνºÆ®·°¼Ç ¼¼Æ® ¹×, Ư¼º, Á¦°øÇÏ´Â ±â´É µîÀ» Àß ¾Ë¾Æ¾ß ÇÑ´Ù. ±×·¯ÇÑ °ÍÀº ÇØ´ç ¸¶ÀÌÅ©·ÎÇÁ·Î¼¼¼­ÀÇ Á¦Á¶¾÷ü ȨÆäÀÌÁö µî¿¡ °¡¸é ÀÚ¼¼ÇÑ ÀڷḦ ±¸ÇÒ ¼ö ÀÖ´Ù. ¸®´ª½º Ä¿³ÎÀÇ ½Ã½ºÅÛ ÄÝÀÇ ¸ñ·Ï°ú Àμö·Î ·¹Áö½ºÅÍ¿¡ ¹«¾ùÀ» ³Ö¾îÁÖ¾î¾ß Çϴ°¡¿¡ °üÇÑ ÀÚ·á´Â http://linuxassembly.org ÀÇ ¹®¼­¸¦ ÂüÁ¶Ç϶ó.


7장. Resources

7.1. Pointers

Your main resource for Linux/UNIX assembly programming material is:

http://linuxassembly.org/resources.html

Do visit it, and get plenty of pointers to assembly projects, tools, tutorials, documentation, guides, etc, concerning different UNIX operating systems and CPUs. Because it evolves quickly, I will no longer duplicate it here.

If you are new to assembly in general, here are few starting pointers:


7.2. Mailing list

If you're are interested in Linux/UNIX assembly programming (or have questions, or are just curious) I especially invite you to join Linux assembly programming mailing list.

This is an open discussion of assembly programming under Linux, *BSD, BeOS, or any other UNIX/POSIX like OS; also it is not limited to x86 assembly (Alpha, Sparc, PPC and other hackers are welcome too!).

To subscribe send a blank message to .

List address is .

List archives are available at http://www.egroups.com/list/linux-assembly/.


8장. Frequently Asked Questions

Here are frequently asked questions (with answers) about Linux assembly programming. Some of the questions (and the answers) were taken from the the linux-assembly mailing list.

8.1. How do I do graphics programming in Linux?
8.2. How do I debug pure assembly code under Linux?
8.3. Any other useful debugging tools?
8.4. How do I access BIOS functions from Linux (BSD, BeOS, etc)?
8.5. Is it possible to write kernel modules in assembly?

8.1. How do I do graphics programming in Linux?

An answer from Paul Furber:

Ok you have a number of options to graphics in Linux. Which one you use
depends on what you want to do. There isn't one Web site with all the
information but here are some tips:

SVGALib: This is a C library for console SVGA access.
Pros: very easy to learn, good coding examples, not all that different
from equivalent gfx libraries for DOS, all the effects you know from DOS
can be converted with little difficulty.
Cons: programs need superuser rights to run since they write directly to
the hardware, doesn't work with all chipsets, can't run under X-Windows.
Search for svgalib-1.4.x on http://ftp.is.co.za

Framebuffer: do it yourself graphics at SVGA res
Pros: fast, linear mapped video access, ASM can be used if you want :)
Cons: has to be compiled into the kernel, chipset-specific issues, must
switch out of X to run, relies on good knowledge of linux system calls
and kernel, tough to debug
Examples: asmutils (http://www.linuxassembly.org) and the leaves example
and my own site for some framebuffer code and tips in asm
(http://ma.verick.co.za/linux4k/)

Xlib: the application and development libraries for XFree86.
Pros: Complete control over your X application
Cons: Difficult to learn, horrible to work with and requires quite a bit
of knowledge as to how X works at the low level. 
Not recommended but if you're really masochistic go for it. All the
include and lib files are probably installed already so you have what
you need. 

Low-level APIs: include PTC, SDL, GGI and Clanlib
Pros: very flexible, run under X or the console, generally abstract away
the video hardware a little so you can draw to a linear surface, lots of
good coding examples, can link to other APIs like OpenGL and sound libs,
Windows DirectX versions for free
Cons: Not as fast as doing it yourself, often in development so versions
can (and do) change frequently.
Examples: PTC and GGI have excellent demos, SDL is used in sdlQuake,
Myth II, Civ CTP and Clanlib has been used for games as well.

High-level APIs: OpenGL - any others?
Pros: clean api, tons of functionality and examples, industry standard
so you can learn from SGI demos for example
Cons: hardware acceleration is normally a must, some quirks between
versions and platforms
Examples: loads - check out www.mesa3d.org under the links section.

To get going try looking at the svgalib examples and also install SDL
and get it working. After that, the sky's the limit.

8.2. How do I debug pure assembly code under Linux?

There's an early version of the Assembly Language Debugger, which is designed to work with assembly code, and is portable enough to run on Linux and *BSD. It is already functional and should be the right choice, check it out!

You can also try gdb ;). Although it is source-level debugger, it can be used to debug pure assembly code, and with some trickery you can make gdb to do what you need. Here's an answer from Dmitry Bakhvalov:

Personally, I use gdb for debugging asmutils. Try this:
 
1) Use the following stuff to compile:
   $ nasm -f elf -g smth.asm
   $ ld -o smth smth.o

2) Fire up gdb:
   $ gdb smth

3) In gdb:
   (gdb) disassemble _start
   Place a breakpoint at _start+1 (If placed at _start the breakpoint
   wouldnt work, dunno why)
   (gdb) b *0x8048075

   To step thru the code I use the following macro:
   (gdb)define n
   >ni
   >printf "eax=%x ebx=%x ...etc...",$eax,$ebx,...etc...
   >disassemble $pc $pc+15
   >end

   Then start the program with r command and debug with n.

   Hope this helps.

An additional note from ???:

    I have such a macro in my .gdbinit for quite some time now, and it
    for sure makes life easier. A small difference : I use "x /8i $pc",
    which guarantee a fixed number of disassembled instructions. Then,
    with a well chosen size for my xterm, gdb output looks like it is
    refreshed, and not scrolling.

If you want to set breakpoints across your code, you can just use int 3 instruction as breakpoint (instead of entering address manually in gdb).

If you're using gas, you should consult gas and gdb related tutorials.

8.3. Any other useful debugging tools?

Definitely strace can help a lot (ktrace and kdump on FreeBSD), it is used to trace system calls and signals. Read its manual page (man strace) and strace --help output for details.

8.4. How do I access BIOS functions from Linux (BSD, BeOS, etc)?

Noway. This is protected mode, use OS services instead. Again, you can't use int 0x10, int 0x13, etc. Fortunately almost everything can be implemented by means of system calls or library functions. In the worst case you may go through direct port access, or make a kernel patch to implement needed functionality.

8.5. Is it possible to write kernel modules in assembly?

Yes, indeed it is. While in general it is not a good idea (it hardly will speedup anything), there may be a need of such wizardy. The process of writing a module itself is not that hard -- a module must have some predefined global function, it may also need to call some external functions from the kernel. Examine kernel source code (that can be built as module) for details.

Meanwhile, here's an example of a minimum dumb kernel module (module.asm) (source is based on example by mammon_ from APJ #8):

section .text

	global init_module
	global cleanup_module
	global kernel_version

	extern printk

init_module:
	push	dword str1
	call	printk
	pop	eax
	xor	eax,eax
	ret

cleanup_module:
	push	dword str2
	call	printk
	pop	eax
	ret
	
str1		db	"init_module done",0xa,0
str2		db	"cleanup_module done",0xa,0

kernel_version	db	"2.2.18",0

The only thing this example does is reporting its actions. Modify kernel_version to match yours, and build module with:

$ nasm -f elf -o module.m module.asm

$ ld -r -o module.o module.m

Now you can play with it using insmod/rmmod/lsmod (root privilidged are required); a lot of fun, huh?

That's all for now, folks.


부록 A. History

Each version includes a few fixes and minor corrections, that need not to be repeatedly mentioned every time.

고친 과정
고침 0.611 Nov 2000고친이 konst
HOWTO is completely rewritten using DocBook DTD. Layout is totally rearranged; too much changes to list them here.
고침 0.5n07 Nov 2000고친이 konst
Added question regarding kernel modules to FAQ, fixed NASM URLs, GAS has Intel syntax too
고침 0.5m22 Oct 2000고친이 konst
Linux 2.4 system calls can have 6 args, Added ALD note to FAQ, fixed mailing list subscribe address
고침 0.5l23 Aug 2000고친이 konst
Added TDASM, updates on NASM
고침 0.5k11 Jul 2000고친이 konst
Few additions to FAQ
고침 0.5j14 Jun 2000고친이 konst
Complete rearrangement of Introduction and Resources sections. FAQ added to Resources, misc cleanups and additions.
고침 0.5i04 May 2000고친이 konst
Added HLA, TALC; rearrangements in Resources, Quick Start Assemblers sections. Few new pointers.
고침 0.5h09 Apr 2000고친이 konst
finally managed to state LDP license on document, new resources added, misc fixes
고침 0.5g26 Mar 2000고친이 konst
new resources on different CPUs
고침 0.5f02 Mar 2000고친이 konst
new resources, misc corrections
고침 0.5e10 Feb 2000고친이 konst
URL updates, changes in GAS example
고침 0.5d01 Feb 2000고친이 konst
Resources (former "Pointers") section completely redone, various URL updates.
고침 0.5c05 Dec 1999고친이 konst
New pointers, updates and some rearrangements. Rewrite of sgml source.
고침 0.5b19 Sep 1999고친이 konst
Discussion about libc or not libc continues. New web pointers and and overall updates.
고침 0.5a01 Aug 1999고친이 konst
Quick Start section rearranged, added GAS example. Several new web pointers.
고침 0.501 Aug 1999고친이 konstfare
GAS has 16-bit mode. New maintainer (at last): Konstantin Boldyshev. Discussion about libc or not libc. Added Quick Start section with examples of assembly code.
고침 0.4q22 Jun 1999고친이 fare
process argument passing (argc, argv, environ) in assembly. This is yet another "last release by Fare before new maintainer takes over". Nobody knows who might be the new maintainer.
고침 0.4p06 Jun 1999고친이 fare
clean up and updates
고침 0.4o01 Dec 1998고친이 fare
고침 0.4m23 Mar 1998고친이 fare
corrections about gcc invocation
고침 0.4l16 Nov 1997고친이 fare
release for LSL 6th edition
고침 0.4k19 Oct 1997고친이 fare
고침 0.4j07 Sep 1997고친이 fare
고침 0.4i17 Jul 1997고친이 fare
info on 16-bit mode access from Linux
고침 0.4h19 Jun 1997고친이 fare
still more on "how not to use assembly"; updates on NASM, GAS.
고침 0.4g30 Mar 1997고친이 fare
고침 0.4f20 Mar 1997고친이 fare
고침 0.4e13 Mar 1997고친이 fare
Release for DrLinux
고침 0.4d28 Feb 1997고친이 fare
Vapor announce of a new Assembly-HOWTO maintainer
고침 0.4c09 Feb 1997고친이 fare
Added section Do you need assembly?.
고침 0.4b03 Feb 1997고친이 fare
NASM moved: now is before AS86
고침 0.4a20 Jan 1997고친이 fare
CREDITS section added
고침 0.420 Jan 1997고친이 fare
first release of the HOWTO as such
고침 0.4pre113 Jan 1997고친이 fare
text mini-HOWTO transformed into a full linuxdoc-sgml HOWTO, to see what the SGML tools are like
고침 0.3l11 Jan 1997고친이 fare
고침 0.3k19 Dec 1996고친이 fare
What? I had forgotten to point to terse???
고침 0.3j24 Nov 1996고친이 fare
point to French translated version
고침 0.3i16 Nov 1996고친이 fare
NASM is getting pretty slick
고침 0.3h06 Nov 1996고친이 fare
more about cross-compiling -- See on sunsite: devel/msdos/
고침 0.3g02 Nov 1996고친이 fare
Created the History. Added pointers in cross-compiling section. Added section about I/O programming under Linux (particularly video).
고침 0.3f17 Oct 1996고친이 fare
고침 0.3c15 Jun 1996고친이 fare
고침 0.204 May 1996고친이 fare
고침 0.123 Apr 1996고친이 fare
Francois-Rene "Fare" Rideau creates and publishes the first mini-HOWTO, because "I'm sick of answering ever the same questions on comp.lang.asm.x86"


부록 B. Acknowledgements

I would like to thank all the people who have contributed ideas, answers, remarks, and moral support, and additionally the following persons, by order of appearance:


부록 C. Endorsements

This version of the document is endorsed by Konstantin Boldyshev.

Modifications (including translations) must remove this appendix according to the license agreement included below.

$Id: DocbookSgml_2fAssembly_2dHOWTO,v 1.3 2004/11/05 13:56:28 kss Exp kss $


부록 D. GNU Free Documentation License

GNU Free Documentation License
Version 1.1, March 2000

    Copyright (C) 2000  Free Software Foundation, Inc.
    59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    Everyone is permitted to copy and distribute verbatim copies
    of this license document, but changing it is not allowed.

0. PREAMBLE

The purpose of this License is to make a manual, textbook, or other written document "free" in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or noncommercially. Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others.

This License is a kind of "copyleft", which means that derivative works of the document must themselves be free in the same sense. It complements the GNU General Public License, which is a copyleft license designed for free software.

We have designed this License in order to use it for manuals for free software, because free software needs free documentation: a free program should come with manuals providing the same freedoms that the software does. But this License is not limited to software manuals; it can be used for any textual work, regardless of subject matter or whether it is published as a printed book. We recommend this License principally for works whose purpose is instruction or reference.

1. APPLICABILITY AND DEFINITIONS

This License applies to any manual or other work that contains a notice placed by the copyright holder saying it can be distributed under the terms of this License. The "Document", below, refers to any such manual or work. Any member of the public is a licensee, and is addressed as "you".

A "Modified Version" of the Document means any work containing the Document or a portion of it, either copied verbatim, or with modifications and/or translated into another language.

A "Secondary Section" is a named appendix or a front-matter section of the Document that deals exclusively with the relationship of the publishers or authors of the Document to the Document's overall subject (or to related matters) and contains nothing that could fall directly within that overall subject. (For example, if the Document is in part a textbook of mathematics, a Secondary Section may not explain any mathematics.) The relationship could be a matter of historical connection with the subject or with related matters, or of legal, commercial, philosophical, ethical or political position regarding them.

The "Invariant Sections" are certain Secondary Sections whose titles are designated, as being those of Invariant Sections, in the notice that says that the Document is released under this License.

The "Cover Texts" are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says that the Document is released under this License.

A "Transparent" copy of the Document means a machine-readable copy, represented in a format whose specification is available to the general public, whose contents can be viewed and edited directly and straightforwardly with generic text editors or (for images composed of pixels) generic paint programs or (for drawings) some widely available drawing editor, and that is suitable for input to text formatters or for automatic translation to a variety of formats suitable for input to text formatters. A copy made in an otherwise Transparent file format whose markup has been designed to thwart or discourage subsequent modification by readers is not Transparent. A copy that is not "Transparent" is called "Opaque".

Examples of suitable formats for Transparent copies include plain ASCII without markup, Texinfo input format, LaTeX input format, SGML or XML using a publicly available DTD, and standard-conforming simple HTML designed for human modification. Opaque formats include PostScript, PDF, proprietary formats that can be read and edited only by proprietary word processors, SGML or XML for which the DTD and/or processing tools are not generally available, and the machine-generated HTML produced by some word processors for output purposes only.

The "Title Page" means, for a printed book, the title page itself, plus such following pages as are needed to hold, legibly, the material this License requires to appear in the title page. For works in formats which do not have any title page as such, "Title Page" means the text near the most prominent appearance of the work's title, preceding the beginning of the body of the text.

2. VERBATIM COPYING

You may copy and distribute the Document in any medium, either commercially or noncommercially, provided that this License, the copyright notices, and the license notice saying this License applies to the Document are reproduced in all copies, and that you add no other conditions whatsoever to those of this License. You may not use technical measures to obstruct or control the reading or further copying of the copies you make or distribute. However, you may accept compensation in exchange for copies. If you distribute a large enough number of copies you must also follow the conditions in section 3.

You may also lend copies, under the same conditions stated above, and you may publicly display copies.

3. COPYING IN QUANTITY

If you publish printed copies of the Document numbering more than 100, and the Document's license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the back cover. Both covers must also clearly and legibly identify you as the publisher of these copies. The front cover must present the full title with all words of the title equally prominent and visible. You may add other material on the covers in addition. Copying with changes limited to the covers, as long as they preserve the title of the Document and satisfy these conditions, can be treated as verbatim copying in other respects.

If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages.

If you publish or distribute Opaque copies of the Document numbering more than 100, you must either include a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque copy a publicly-accessible computer-network location containing a complete Transparent copy of the Document, free of added material, which the general network-using public has access to download anonymously at no charge using public-standard network protocols. If you use the latter option, you must take reasonably prudent steps, when you begin distribution of Opaque copies in quantity, to ensure that this Transparent copy will remain thus accessible at the stated location until at least one year after the last time you distribute an Opaque copy (directly or through your agents or retailers) of that edition to the public.

It is requested, but not required, that you contact the authors of the Document well before redistributing any large number of copies, to give them a chance to provide you with an updated version of the Document.

4. MODIFICATIONS

You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3 above, provided that you release the Modified Version under precisely this License, with the Modified Version filling the role of the Document, thus licensing distribution and modification of the Modified Version to whoever possesses a copy of it. In addition, you must do these things in the Modified Version:

  1. Use in the Title Page (and on the covers, if any) a title distinct from that of the Document, and from those of previous versions (which should, if there were any, be listed in the History section of the Document). You may use the same title as a previous version if the original publisher of that version gives permission.

  2. List on the Title Page, as authors, one or more persons or entities responsible for authorship of the modifications in the Modified Version, together with at least five of the principal authors of the Document (all of its principal authors, if it has less than five).

  3. State on the Title page the name of the publisher of the Modified Version, as the publisher.

  4. Preserve all the copyright notices of the Document.

  5. Add an appropriate copyright notice for your modifications adjacent to the other copyright notices.

  6. Include, immediately after the copyright notices, a license notice giving the public permission to use the Modified Version under the terms of this License, in the form shown in the Addendum below.

  7. Preserve in that license notice the full lists of Invariant Sections and required Cover Texts given in the Document's license notice.

  8. Include an unaltered copy of this License.

  9. Preserve the section entitled "History", and its title, and add to it an item stating at least the title, year, new authors, and publisher of the Modified Version as given on the Title Page. If there is no section entitled "History" in the Document, create one stating the title, year, authors, and publisher of the Document as given on its Title Page, then add an item describing the Modified Version as stated in the previous sentence.

  10. Preserve the network location, if any, given in the Document for public access to a Transparent copy of the Document, and likewise the network locations given in the Document for previous versions it was based on. These may be placed in the "History" section. You may omit a network location for a work that was published at least four years before the Document itself, or if the original publisher of the version it refers to gives permission.

  11. In any section entitled "Acknowledgements" or "Dedications", preserve the section's title, and preserve in the section all the substance and tone of each of the contributor acknowledgements and/or dedications given therein.

  12. Preserve all the Invariant Sections of the Document, unaltered in their text and in their titles. Section numbers or the equivalent are not considered part of the section titles.

  13. Delete any section entitled "Endorsements". Such a section may not be included in the Modified Version.

  14. Do not retitle any existing section as "Endorsements" or to conflict in title with any Invariant Section.

If the Modified Version includes new front-matter sections or appendices that qualify as Secondary Sections and contain no material copied from the Document, you may at your option designate some or all of these sections as invariant. To do this, add their titles to the list of Invariant Sections in the Modified Version's license notice. These titles must be distinct from any other section titles.

You may add a section entitled "Endorsements", provided it contains nothing but endorsements of your Modified Version by various parties--for example, statements of peer review or that the text has been approved by an organization as the authoritative definition of a standard.

You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be added by (or through arrangements made by) any one entity. If the Document already includes a cover text for the same cover, previously added by you or by arrangement made by the same entity you are acting on behalf of, you may not add another; but you may replace the old one, on explicit permission from the previous publisher that added the old one.

The author(s) and publisher(s) of the Document do not by this License give permission to use their names for publicity for or to assert or imply endorsement of any Modified Version.

5. COMBINING DOCUMENTS

You may combine the Document with other documents released under this License, under the terms defined in section 4 above for modified versions, provided that you include in the combination all of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant Sections of your combined work in its license notice.

The combined work need only contain one copy of this License, and multiple identical Invariant Sections may be replaced with a single copy. If there are multiple Invariant Sections with the same name but different contents, make the title of each such section unique by adding at the end of it, in parentheses, the name of the original author or publisher of that section if known, or else a unique number. Make the same adjustment to the section titles in the list of Invariant Sections in the license notice of the combined work.

In the combination, you must combine any sections entitled "History" in the various original documents, forming one section entitled "History"; likewise combine any sections entitled "Acknowledgements", and any sections entitled "Dedications". You must delete all sections entitled "Endorsements."

6. COLLECTIONS OF DOCUMENTS

You may make a collection consisting of the Document and other documents released under this License, and replace the individual copies of this License in the various documents with a single copy that is included in the collection, provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects.

You may extract a single document from such a collection, and distribute it individually under this License, provided you insert a copy of this License into the extracted document, and follow this License in all other respects regarding verbatim copying of that document.

7. AGGREGATION WITH INDEPENDENT WORKS

A compilation of the Document or its derivatives with other separate and independent documents or works, in or on a volume of a storage or distribution medium, does not as a whole count as a Modified Version of the Document, provided no compilation copyright is claimed for the compilation. Such a compilation is called an "aggregate", and this License does not apply to the other self-contained works thus compiled with the Document, on account of their being thus compiled, if they are not themselves derivative works of the Document.

If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if the Document is less than one quarter of the entire aggregate, the Document's Cover Texts may be placed on covers that surround only the Document within the aggregate. Otherwise they must appear on covers around the whole aggregate.

8. TRANSLATION

Translation is considered a kind of modification, so you may distribute translations of the Document under the terms of section 4. Replacing Invariant Sections with translations requires special permission from their copyright holders, but you may include translations of some or all Invariant Sections in addition to the original versions of these Invariant Sections. You may include a translation of this License provided that you also include the original English version of this License. In case of a disagreement between the translation and the original English version of this License, the original English version will prevail.

9. TERMINATION

You may not copy, modify, sublicense, or distribute the Document except as expressly provided for under this License. Any other attempt to copy, modify, sublicense or distribute the Document is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.

10. FUTURE REVISIONS OF THIS LICENSE

The Free Software Foundation may publish new, revised versions of the GNU Free Documentation License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. See http://www.gnu.org/copyleft/.

Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License "or any later version" applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been published (not as a draft) by the Free Software Foundation. If the Document does not specify a version number of this License, you may choose any version ever published (not as a draft) by the Free Software Foundation.

How to use this License for your documents

To use this License in a document you have written, include a copy of the License in the document and put the following copyright and license notices just after the title page:

      Copyright (c)  YEAR  YOUR NAME.
      Permission is granted to copy, distribute and/or modify this document
      under the terms of the GNU Free Documentation License, Version 1.1
      or any later version published by the Free Software Foundation;
      with the Invariant Sections being LIST THEIR TITLES, with the
      Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
      A copy of the license is included in the section entitled "GNU
      Free Documentation License".

If you have no Invariant Sections, write "with no Invariant Sections" instead of saying which ones are invariant. If you have no Front-Cover Texts, write "no Front-Cover Texts" instead of "Front-Cover Texts being LIST"; likewise for Back-Cover Texts.

If your document contains nontrivial examples of program code, we recommend releasing these examples in parallel under your choice of free software license, such as the GNU General Public License, to permit their use in free software.


ID
Password
Join
He who has imagination without learning has wings but no feet.


sponsored by andamiro
sponsored by cdnetworks
sponsored by HP

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2004-11-05 22:56:28
Processing time 0.0023 sec