linux 0.11 ÄÚºËѧϰ asm.s£¬»úÆ÷ÄÑÃâ³ö¹ÊÕÏ¡£
/*
* linux/kernel/asm.s
*
* (C) 1991 Linus Torvalds
*/
/*
* asm.s contains the low-level code for most hardware faults.
* page_exception is handled by the mm, so that isn't here. This
* file also handles (hopefully) fpu-exceptions due to TS-bit, as
* the fpu must be properly saved/resored. This hasn't been tested.
*/
/*
* asm.asm´¦ÀíµÄÖ÷ÒªÊǺÍÓ²¼þÏà¹ØµÄ¹ÊÕÏ¡£×¢ÒâµÄÊÇÒ³Òì³£ÊÇÓÐmmÄ£¿é
* À´ÊµÏÖ¹ÜÀíµÄ£¬ËùÒÔÔÚÕâÀï²»ÐèÒª´¦Àí¡£´ËÍâ´Ë³ÌÐòÀ´´¦ÀífpuµÄÒì³£¡£
*
*/
/*
* È«¾Öº¯ÊýµÄ¶¨Ò壬Ö÷ÒªÊÇÒýÓõÄÊÇtraps.cÎļþÖеĺ¯ÊýÉùÃ÷¡£
* ÏÂÃæµÄ´úÂëÖ÷ÒªÊǶÔintelµÄ±£ÁôÖжÏint0 -- int16µÄ´¦Àí¡£
*/
.globl _divide_error,_debug,_nmi,_int3,_overflow,_bounds,_invalid_op
.globl _double_fault,_coprocessor_segment_overrun
.globl _invalid_TSS,_segment_not_present,_stack_segment
.globl _general_protection,_coprocessor_error,_irq13,_reserved
# һϵÄÖж϶¼ÊÇIntelµÃ±£ÁôÖжϵĴ¦Àí³ÌÐò¡£
#------------------------------------------------------------------------
# int0 -- ±»0³ýËùÒý·¢µÄÖжϡ£ÏÂÃæµÄ$_do_divide_errorÊÇcº¯Êý±àÒëÖ®ºó
# ¶ÔÓ¦µÄÄ£¿éµÄÃû³Æ¡£
_divide_error:
pushl $_do_divide_error # Ê×ÏȽ«º¯ÊýÈë¿ÚµØַѹÈë¶ÑÕ»¡£
no_error_code: # ±êºÅÏ൱ÓÚº¯Êý±»ÏÂÃæ³ÌÐòµ÷Óá£
xchgl %eax,(%esp) # xchglÖ¸ÁîµÄ×÷ÓÃÊǽ»»»¼Ä´æÆ÷¡£
# Ôڴ˵ĺ¬ÒåÊǽ«º¯ÊýµÄµØÖ·´æÔÚ
# eaxÖУ¬½«eaxÔÀ´ÄÚÈÝÈëÕ»¡£
pushl %ebx # ¼Ä´æÆ÷ÈëÕ»
pushl %ecx
pushl %edx
pushl %edi
pushl %esi
pushl %ebp
push %ds
push %es
push %fs
####################################################
# ½«³ö´íÂëºÍÖжϷµ»ØµØÖ·ÈëÕ»×÷Ϊº¯Êýµ÷ÓÃ_do_divide_error
# µÄ²ÎÊý¡£
pushl $0 # "error code"£¬³ö´íÂë0ÈëÕ»
lea 44(%esp),%edx # È¡µÃÖжϷµ»ØµØÖ·
pushl %edx # ÖжϷµ»ØµØÖ·ÈëÕ»
#####################################################
# ÏÂÃæµÄ´úÂëÖØÐÂÉèÖüĴæÆ÷¡£dsºÍesÖ¸ÏòµÄÊÇÄں˴úÂë¶Î
# fsÖ¸ÏòµÄÊÇÓû§Êý¾Ý¶Î¡£
movl $0x10,%edx
mov %dx,%ds
mov %dx,%es
mov %dx,%fs
Ïà¹ØÎĵµ£º
Íز¨±ü³Ð²»¶Ï¿ªÍؽøÈ¡µÄ¾«Éñ£¬ÔÚ¼¼ÊõÑз¢ºÍÖ§³ÖÉϲ»¶ÏµÄͶÈëÈËÁ¦ÎïÁ¦£¬Á¦ÇóÔÚ²»¶Ï±ä»¯µÄÊг¡ÐèÇóÖУ¬´ïµ½100%µÄ¿Í»§ÂúÒâ¶È¡£ÔÚ¸Õ¸Õ̤Èë2010Ä꣬¸ù¾Ý¹ýÍùµÄÊг¡µ÷²é£¬½áºÏ¿Í»§µÄÐèÇóºÍ½¨Ò飬Íز¨ÓʼþϵͳÍƳöÁËLinux_°²ÌÚ°æ±¾£¬×÷ΪдºË͸ø¹ã´ó¿Í»§µÄµÚÒ»·ÝÀñÎï¡£
°²ÌÚ´¦ÀíÆ÷ÊÇ×î½üÊ®Äê²ÅÖð½¥·¢Õ¹ÆðÀ´µ ......
1.1 Óï·¨»ù±¾½éÉÜ
1.1.1 ¿ªÍ·
³ÌÐò±ØÐëÒÔÏÂÃæµÄÐпªÊ¼£¨±ØÐë·½ÔÚÎļþµÄµÚÒ»ÐУ©£º
#!/bin/sh
·ûºÅ#!ÓÃÀ´¸æËßϵͳËüºóÃæµÄ²ÎÊýÊÇÓÃÀ´Ö´ÐиÃÎļþµÄ³ÌÐò¡£ÔÚÕâ¸öÀý×ÓÖÐÎÒÃÇʹÓÃ/bin/shÀ´Ö´ÐгÌÐò¡£
µ±±à¼ºÃ½Å±¾Ê±£¬Èç¹ûÒªÖ´Ðиýű¾£¬»¹±ØÐëʹÆä¿ÉÖ´ÐС£
Ҫʹ½Å±¾¿ÉÖ´ÐУº
±àÒë chmod +x filename ÕâÑù²ÅÄÜÓÃ./filena ......
1.1.5 ShellÃüÁîºÍÁ÷³Ì¿ØÖÆ
ÔÚshell½Å±¾ÖпÉÒÔʹÓÃÈýÀàÃüÁ
1)Unix ÃüÁî:
ËäÈ»ÔÚshell½Å±¾ÖпÉÒÔʹÓÃÈÎÒâµÄunixÃüÁµ«ÊÇ»¹ÊÇÓÉһЩÏà¶Ô¸ü³£ÓõÄÃüÁî¡£ÕâЩÃüÁîͨ³£ÊÇÓÃÀ´½øÐÐÎļþºÍÎÄ×Ö²Ù×÷µÄ¡£
³£ÓÃÃüÁîÓï·¨¼°¹¦ÄÜ
echo "some text": ½«ÎÄ×ÖÄÚÈÝ´òÓ¡ÔÚÆÁÄ»ÉÏ
ls: ÎļþÁбí
wc –l filewc -w filewc -c fi ......
1 ÒýÑÔ
ÔÚǶÈëʽӦÓÃϵͳÖУ¬ÌرðÊÇÖÇÄÜÒÇÆ÷¡¢ÒÇ±í¡¢»úµçÉ豸¼°×°ÖÿØÖÆÖУ¬ÐèҪʹÓÃA/Dת»»½«Ä£ÄâµÄµçÁ¿ÐźÅת»»ÎªÊý×ÖÐźŽøÐд¦Àí£¬¶øºóÔÙ½«´¦ÀíµÄ½á¹ûͨ¹ýD/Aת»»ÎªÄ£ÄâÁ¿ÊµÏÖ¶Ô±»¿Ø¹ý³ÌºÍ¶ÔÏóµÄ¿ØÖÆ[1]¡£
»ùÓÚARM920TÄں˵Äs3c2410ÊÇÒ»¿îµÍ¹¦ºÄ£¬¸ßÐԼ۱ȵĴ¦ÀíÆ÷[2]¡£Õâ¿î´¦ÀíÆ÷ÄÚ²¿¼¯³ÉÁ˶àÖÖ¿ØÖƽӿڣ¬×Ô´ø8·1 ......