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
Ïà¹ØÎĵµ£º
1. HCI²ãÐÒé¸ÅÊö£º
HCIÌṩһÌ×ͳһµÄ·½·¨À´·ÃÎÊBluetoothµ×²ã¡£ÈçͼËùʾ£º
´ÓͼÉÏ¿ÉÒÔ¿´³ö£¬Host Controller Interface(HCI) ¾ÍÊÇÓÃÀ´¹µÍ¨HostºÍModule¡£Hostͨ³£¾ÍÊÇPC£¬ ModuleÔòÊÇÒÔ¸÷ÖÖÎïÀíÁ¬½ÓÐÎʽ£¨USB,serial,pc-cardµÈ£©Á¬½Óµ½PCÉϵÄbluetooth Dongle¡£
ÔÚHostÕâÒ»¶Ë£ºapplication,SDP,L2capµÈÐÒé ......
Ê×ÏÈÐèÒª°²×°Red5ÔËÐÐËùÐèµÄjava¿ª·¢»·¾³jdk,ÎÒËùÓеÄÎļþ¶¼±£´æµ½/root/download,°²×°ÒªÓÃroot
¡¡¡¡Óû§½øÐа²×°
¡¡¡¡ÏÂÔØµØÖ·Îªhttps://sdlc6e.sun.com/ECom/EComActionServlet;jsessionid= 8CEC5D9DFF18A14B277B3C32456062B1ÎÒÏÂÔØµÄÊÇÀàÐÍLinux RPM in self-extracting file µÄÎļþ£¬ÎļþÃûΪ
¡¡¡¡jdk-1_5_0_0 ......
×ÔÓÉÈí¼þ Linux Ö®¸¸£ºÀîÄÉ˹·ÍÐÎÖ×È(Linus Torvalds)
¡¡¡¡µ¼Ó28ËêµÄ·ÒÀ¼ÇàÄêÀîÄÉ˹´´ÔìÁËÒ»¸öȫеÄÊÀ½ç£º¾ÍÊÇÒ»ÖÖÃûΪLinuxµÄ²Ù×÷ϵͳ¡£ËüËù²úÉúµÄÁ¦Á¿¾ö¶¨Á˱à³ÌÁìÓòµÄзÕΧ£¬ÕýÈçÎÒÃǵĻ·¾³¾ö¶¨Á˶¯Ö²ÎïµÄÌØÐÔÒ»Ñù¡£´´Ôì¼ò½àÓÅÑŵijÌÐò£¬Ð´³ö¸É¾»¶øÎÞÈß³¤µÄ´úÂ룬»òÕßÊdz¬Ò»Á÷µÄ³ÌÐò£¬¾Í×ãÒÔÓ®µÃͬÐÐÃǵÄ×ð ......
ÍøÂçÎļþϵͳ£¨NFS£¬Network File System£©ÊÇÒ»ÖÖ½«Ô¶³ÌÖ÷»úÉϵķÖÇø£¨Ä¿Â¼£©¾ÍøÂç¹ÒÔØµ½±¾µØÏµÍ³µÄÒ»ÖÖ»úÖÆ£¬Í¨¹ý¶ÔÍøÂçÎļþϵͳµÄÖ§³Ö£¬Óû§¿ÉÒÔÔÚ±¾µØÏµÍ³ÉÏÏñ²Ù×÷±¾µØ·ÖÇøÒ»ÑùÀ´¶ÔÔ¶³ÌÖ÷»úµÄ¹²Ïí·ÖÇø£¨Ä¿Â¼£©½øÐвÙ×÷¡£
ÔÚǶÈëʽLinux µÄ¿ª·¢¹ý³ÌÖУ¬¿ª·¢ÕßÐèÒªÔÚLinux ·þÎñÆ÷ÉϽøÐÐËùÓеÄÈí¼þ¿ª·¢£¬½»²æ±àÒëºó£¬Í¨Ó ......