[תÌù]linuxÏÂcÓïÑÔǶÈë»ã±à
ÍøÉÏ¿´µ½µÄÕâÆª¹ØÓÚLinuxÏÂCÓïÑÔǶÈë»ã±àµÄÎÄÕÂдµÄ·Ç³£È«£¬×ªÔعýÀ´¡£
Using Assembly Language in Linux.
IntelºÍAT&T»ã±àÓï·¨²îÒ죺
1¡£Ç°×º£º
Intel»ã±à¼Ä´æÆ÷ºÍÁ¢¼´ÊýÎÞÐèǰ׺¡£ºóÕ߼ĴæÆ÷ǰ׺Ϊ%£¬Á¢¼´Êýǰ׺Ϊ$¡£
eg£º
Intex Syntax
mov eax,1
mov ebx,0ffh
int 80h
AT&T Syntax
movl $1,%eax
movl $0xff,%ebx
int $0x80
2¡£¶þÕß¶Ô²Ù×÷Êý´¦Àí·½Ïò²»Í¬£º
eg£º
Intel »ã±àÓï·¨£º
instr dest,source
mov eax,[ecx]
AT&T »ã±àÓï·¨£º
instr source,dest
movl (%ecx),%eax
3¡£ÄÚ´æ±äÁ¿Óï·¨²îÒ죺
IntelÓ﷨ʹÓÃÖÐÀ¨ºÅ[]£¬ºóÕßʹÓÃСÀ¨ºÅ()
eg£º
Intex Syntax
mov eax,[ebx]
mov eax,[ebx+3]
AT&T Syntax
movl (%ebx),%eax
movl 3(%ebx),%eax
4¡£ºó׺£º
AT&T»ã±àÖ¸ÁîÓкó׺£¬ÒÔ±íÃ÷Êý¾ÝÀàÐÍ£¨8λ¡¢16λµÈ£©£»IntelÔò¸ù¾Ý¼Ä´æÆ÷×Ô¶¯Ê¶±ð¡£
eg£º
Intel Syntax
mov al,bl
mov ax,bx
mov eax,ebx
mov eax, dword ptr [ebx]
AT&T Syntax
movb %bl,%al
movw %bx,%ax
movl %ebx,%eax
movl (%ebx),%eax
5¡£
Intel£ºsegreg:[base+index*scale+disp]
AT&T£º %segreg:disp(base,index,scale).
Àý×Ó£º
1 #include <stdio.h>
2
3 int main(void) {
4 long eax=4;
5 long ebx=2;
6
7 __asm__ __volatile__ ("addl %1, %0"
8
Ïà¹ØÎĵµ£º
(Ê®)Îȶ¨ÄÜÁ¦Æª¡¡
¡¡¡¡ÔËÐÐLinuxµÄ»úÆ÷Æô¶¯Ò»´Î¿ÉÒÔÔËÐÐÊýÔ¡£LinuxÌṩÁËÍêÈ«µÄÄÚ´æ±£»¤£¬Ã¿¸ö½ø³Ì¶¼ÔËÐÐÔÚ×Ô¼ºµÄÐéÄâµØÖ·¿Õ¼äÖУ¬²¢ÇÒ²»»áËð»µÆäËû½ø³Ì»òÄÚºËʹÓõĵØÖ·¿Õ¼ä¡£ÈÎÎñÓëÄں˼äÒ²ÊÇÏ໥¸ôÀ룬¼´ÐÐΪ²»Á¼»ò±àд²»Á¼µÄ³ÌÐòÖ»Äܻٻµ×Ô¼º¡£Òò´Ë±»ÆÆ»µµÄ½ø³Ì¼¸ºõ²»¿ÉÄÜʹϵͳ±ÀÀ£¡£LinuxÔÚºÍWindows98ºÍNTÔ ......
ѧϰlinuxÒ»Äê¶àÁË£¬»ù±¾¾ÍÊÇÒ»¸ö“ϹÕû££>³öÎÊÌ⣣>°Ù¶È/Google££>½â¾öÎÊÌ⣣>¼ÌÐøÏ¹Õû"µÄÑ»·¡£ºÜ¸ÐÐ»ÍøÉÏÄÇô¶àÈ˶¼ÄܰÑ×Ô¼ºµÄ¾Àú¡¢¾Ñé¸ú´ó¼Ò·ÖÏí£¬ËùÒÔÒ»Ö±¶¼ÓаÑ×Ô¼ºÅöµ½µÄÎÊÌâ¼°½â¾ö°ì·¨¸ú´ó¼Ò·ÖÏí£¬Ï£Íû¶Ô´ó¼ÒÄÜÓÐËù°ïÖú¡£
ºÃ£¬²»¶à·Ï»°ÁË¡ ......
Linux Òýµ¼¹ý³ÌÄÚÄ»
http://www.lemote.com/bbs/redirect.php?goto=newpost&tid=1723
µ±ÏµÍ³Ê×´ÎÒýµ¼Ê±£¬»òϵͳ±»ÖØÖÃʱ£¬´¦ÀíÆ÷»áÖ´ÐÐÒ»¸öλÓÚÒÑ֪λÖô¦µÄ´úÂë¡£ÔÚ¸öÈ˼ÆËã»ú£¨PC£©ÖУ¬Õâ¸öλÖÃÔÚ»ù±¾ÊäÈë/Êä³öϵͳ£¨BIOS£©ÖУ¬Ëü±£´æÔÚÖ÷°åÉϵÄÉÁ´æÖС£Ç¶ÈëʽϵͳÖеÄÖÐÑë´¦Àíµ¥Ôª£¨CPU£©»áµ÷ÓÃÕâ¸öÖØÖÃÏò ......
linuxÍøÇÅģʽvlantrunk͸´«
2007-12-27 08:30
Ê×ÏÈʹÓÃvconfig´´½¨vlanÐéÄâ½Ó¿Ú£¬²¢·Ö±ðÔÚÁ½¸ö½Ó¿ÚÉÏÔö¼Óvlan100\vlan200\vlan300
vconfig add eth0 100
vconfig add eth0 100
vconfig add eth0 300
vconfig add eth1 100
vconfig add eth1 200
vconfig add eth1 300
ÆôÓÃvlan¶Ë¿Ú
ifconfig eth0.10 ......