Linux Assembly "Hello World" Tutorial, CS 200
by Bjorn Chambless
Introduction
The following is designed familiarize the reader with programming in x86 (AT&T
style, that produced by gcc) assembly under Linux and how to interface assembly
and higher-level language code (i.e. C). The tutorial will also briefly cover
debugging your assembly using GDB.
This tutorial requires the following:
an i386 family PC running Linux
GCC, the GNU C-compiler
GDB, the GNU debugger command line debugger
The tutorial was developed on and tested with GCC version 2.95.4 and GDB 19990928 under Linux kernel 2.4.9
I highly recommend working through this tutorial with
"as"
and "gdb"
documentation close at hand.
Source Code
The process begins with a source code program. For example, hello.c
/* hello.c */
#include
main()
{
printf("hello\n").
}
which, when compiled and executed, prints a message
linuxbox> gcc -o hello hello.c
linuxbox> ./hello
hello
The actual compilation process can be viewed by including the -v
option
linuxbox> gcc -v -o hello hello.c
Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.4/specs
gcc version 2.95.4 20010902 (Debian prerelease)
/usr/lib/gcc-lib/i386-linux/2.95.4/cpp0 -lang-c -v -D__GNUC__=2
-D__GNUC_MINOR__=95 -D__ELF__ -Dunix -D__i386__ -Dlinux -D__ELF__
-D__unix__ -D__i386__ -D__linux__ -D__unix -D__linux -Asystem(posix)
-Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ hello.c
/tmp/ccCGCFmG.i
GNU CPP version 2.95.4 20010902 (Debian prerelease) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here: /usr/local/include
/usr/lib/gcc-lib/i386-linux/2.95.4/include /usr/include
End of search list.
The following default directories have been omitted from the search
path: /usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3
/usr/lib/gcc-lib/i386-linux/2.95.4/../../../../i386-linux/include
End of omitted list. /usr/lib/gcc-lib/i386-linux/2.95.4/cc1
/tm
Ïà¹ØÎĵµ£º
£¨L2CAPÐÒé¼ò½é£¬L2CAPÔÚBlueZÖеÄʵÏÖÒÔ¼°L2CAP±à³Ì½Ó¿Ú£©
Ò»£ºL2CAPÐÒé¼ò½é£º
Logical Link Control and Adaptation Protocol(L2CAP)
Âß¼Á¬½Ó¿ØÖƺÍÊÊÅäÐÒé (L2CAP) ΪÉϲãÐÒéÌá¹©ÃæÏòÁ¬½ÓºÍÎÞÁ¬½ÓµÄÊý¾Ý·þÎñ£¬²¢Ìṩ¶àÐÒ鹦ÄܺͷָîÖØ×é²Ù×÷¡£L2CAP ³äÐíÉϲãÐÒéºÍÓ¦ÓÃÈí¼þ´«ÊäºÍ½ÓÊÕ×î´ó³¤¶ÈΪ 64K µÄ L2CAP Ê ......
Æô¶¯armlinux£¬bootloader±ØÐëÌṩÏÂÃæ¼¸²½£º
1£® ÉèÖò¢³õʼ»¯ram
2£® ³õʼ»¯Ò»¸ö´®¿Ú
3£® ¼ì²â´¦ÀíÆ÷ÀàÐÍ
4£® ÉèÖÃÄں˱ê¼ÇÁбí
5£® µ÷ÓÃÄÚºËÓ³Ïñ
1. ÉèÖò¢³õʼ»¯ram
bootloaderÒªÕÒµ½²¢³õʼ»¯ÏµÍ³ÖÐËùÓе ......
×÷Õߣº51cto
http://www.ccw.com.cn 2009-02-27 11:06:03
µ±Äã¶Ô±ðÈË˵£¬“ÎÒÒªÂòÁ¾³µ¡£”ËûÂíÉϾͻáÎÊÄ㣺“ʲô³µ£¿”¸£ÌØ¡¢·áÌï¡¢»¹ÊDZ¾ÌÊÇË«ÃÅÅܳµ¡¢Ð¡½Î³µ¡¢»¹ÊÇÃæ°ü³µ£¿µ±È»£¬»¹ÓÐÆäËûÀàËÆµÄÎÊÌâ¡£
ͬÑù£¬Èç¹ûÄã˵“ÎÒÏë°²×°Linux£¡”Äã»á±»Îʵ½Í¬ÑùµÄÎÊÌ⣺ÄĸöLinu ......
<!--
@page { margin: 2cm }
P { margin-bottom: 0.21cm }
-->
ÔÚ±¾ÎÄÖУ¬
Linux
ÊÇÖ¸²Ý¸ù°æµÄ
Linux
£¬Ò²¾ÍÊÇ˵£¬
Linux
ÊÇÕý×ÚµÄ
GNU/Linux
¡£ÏÖÔÚµÄÎÊÌâÊÇ£¬ÔÚÖйú£¬ÎªÊ²Ã´
GNU/Linux
ÒªÔ¶ÀëÓ²ÅÌ£¿ÕâÊÇʲôÔÒòÔì³ÉµÄ£¿
......