国产毛片a精品毛-国产毛片黄片-国产毛片久久国产-国产毛片久久精品-青娱乐极品在线-青娱乐精品

電子工程網

標題: 找gas文檔來學學匯編。 [打印本頁]

作者: linux_Ultra    時間: 2009-7-25 07:59
標題: 找gas文檔來學學匯編。
本帖最后由 linux_Ultra 于 2009-7-25 08:31 編輯

無法理解 c 語言中那些 變量和常量 被加載到內存里的存儲布局, 所以只能找gas文檔來學學匯編。
有關
.fill
這個偽指令的解釋, 無法明白到底是什么意思。

.fill repeat , size , value
    result, size and value are absolute expressions. This emits repeat
copies of size bytes. Repeat may be zero or more. Size may be zero or more,
but if it is more than 8, then it is deemed to have the value 8, compatible with other people's assemblers. The contents of each repeat bytes is taken from an 8-byte number. The highest order 4 bytes are zero. The lowest order 4 bytes are value rendered in the byte-order of an interger on the computer as is assembling for. Each size bytes in a repetition is taken from the lowest order size bytes of this number. Again, this bizarre behavior is compatible with other people's assemblers.
    size and value are optional. If the second comma and value are absent, value is assumed zero. If the firsr comma  and following tokens are
absent, size is assumed to be 1.
--------------------------------------------------------------------------------
.fill repeat , size , value
result, size and value are absolute expressions.
結果,size 和 value是絕對表達式。
This emits repeat copies of size bytes. Repeat may be zero or more.  
這個偽指令用來重復拷貝size大小的字節數。repeat (重復次數)可以是零或更大。
Size may be zero or more,but if it is more than 8, then it is deemed to have the value 8, compatible with other people's assemblers.
size可以是零或更大,但是如果size比8大, 為了和其他的匯編器兼容,它的值會被認為是8。

The contents of each repeat bytes is taken from an 8-byte number. The highest order 4 bytes are zero. The lowest order 4 bytes are value rendered in the byte-order of an interger on the computer as is assembling for.
每個重復拷貝的內容被降低自于一個8字節的數。最高順序4字節是零。最低順序字節是value的值,在電腦上用一個字節順序的匯編整數來表示。

Each size bytes in a repetition is taken from the lowest order size bytes of this number. Again, this bizarre behavior is compatible with other people's assemblers.
每個size 字節被降低來自最低順序字節數。同樣的, 這些奇怪的行為也是為了和別的匯編器兼容。

    size and value are optional. If the second comma and value are absent, value is assumed zero. If the firsr comma  and following tokens are
absent, size is assumed to be 1.
size 和 value 是可選的。 如果第二個分號和value不寫, value 就被假定為1。如果第一個分號和后面的tokens 不寫,size 就被假定為1。

fill.JPG (99.26 KB)

fill.JPG

作者: linux_Ultra    時間: 2009-7-25 08:29
找了些例子。
:~/source/linux-kernel/linux-2.6.29$ find . -name '*.S'|xargs grep -In '\.fill'

-----------------------------------------------------------------------------------------------
.
.
.
/arch/m32r/boot/compressed/head.S:55:        .fillinsn
./arch/m32r/boot/setup.S:167:        .fillinsn
./arch/xtensa/kernel/head.S:239:        .fill        PAGE_SIZE, 1, 0
./arch/xtensa/kernel/head.S:241:        .fill        PAGE_SIZE, 1, 0
./arch/xtensa/kernel/coprocessor.S:332:        .fill XCHAL_CP_MAX, 4, 0
./arch/x86/kernel/head_32.S:616:        .fill 1024*KPMDS,4,0
./arch/x86/kernel/head_32.S:619:        .fill 1024,4,0
./arch/x86/kernel/head_32.S:622:        .fill 1024,4,0
./arch/x86/kernel/head_32.S:624:        .fill 4096,1,0
./arch/x86/kernel/head_32.S:713:        .fill GDT_ENTRY_BOOT_CS,8,0
./arch/x86/kernel/trampoline_64.S:160:        .fill        510,8,0
./arch/x86/kernel/head_64.S:356:        .fill        511,8,0
./arch/x86/kernel/head_64.S:359:        .fill        L3_START_KERNEL,8,0
./arch/x86/kernel/head_64.S:365:        .fill        506,8,0
./arch/x86/kernel/head_64.S:368:        .fill        5,8,0
./arch/x86/kernel/head_64.S:371:        .fill        512,8,0
./arch/x86/kernel/head_64.S:394:        .fill   512, 8, 0
./arch/x86/boot/compressed/head_32.S:188:        .fill BOOT_HEAP_SIZE, 1, 0
./arch/x86/boot/compressed/head_32.S:190:        .fill BOOT_STACK_SIZE, 1, 0
./arch/x86/boot/compressed/head_64.S:320:        .fill BOOT_HEAP_SIZE, 1, 0
./arch/x86/boot/compressed/head_64.S:322:        .fill BOOT_STACK_SIZE, 1, 0
./arch/ia64/kvm/trampoline.S:98:        ld8.fill        r4=[r2],16;                \
./arch/ia64/kvm/trampoline.S:99:        ld8.fill        r5=[r3],16;                \
./arch/ia64/kvm/trampoline.S:101:        ld8.fill        r6=[r2],48;                \
.
.
.
作者: linux_Ultra    時間: 2009-7-25 08:44
./arch/x86/kernel/head_32.S
------------------------------
/*
* BSS section
*/
.section ".bss.page_aligned","wa"
        .align PAGE_SIZE_asm
#ifdef CONFIG_X86_PAE
swapper_pg_pmd:
        .fill 1024*KPMDS,4,0
#else
ENTRY(swapper_pg_dir)
        .fill 1024,4,0
#endif
swapper_pg_fixmap:
        .fill 1024,4,0
ENTRY(empty_zero_page)
        .fill 4096,1,0
作者: linux_Ultra    時間: 2009-7-25 08:50
如:
.fill 1024,4,0------------>拷貝1024個塊,每個塊是4個字節,每個塊用0來初始化?
作者: linux_Ultra    時間: 2009-7-25 13:13
在linuxforum上找到的這本gas手冊的翻譯項目。
關于這部分的翻譯:
-----------------------------------------------
7.28 .fill repeat , size , value
repeat, size and value are absolute expressions. This emits repeat copies of size bytes. Repeat may be zero or more. Size may be zero or more, but if it is more than 8, then it is deemed to have the value 8, compatible with other people’s assemblers. The contents of each repeat bytes are taken from an 8-byte number. The highest order 4 bytes are zero. The lowest order 4 bytes are value rendered in the byte-order of an integer on the computer as is assembling for. Each size bytes in a repetition is taken from the lowest order size bytes of this number. Again, this bizarre behavior is compatible with other people’s assemblers.
size and value are optional. If the second comma and value are absent, value is assumed zero. If the first comma and following tokens are absent, size is assumed to be 1.

7.28 .fill repeat , size , value
repeat, size 和value都必須是純粹的表達式。本命令生成size個字節的repeat個副本。Repeat可以是0或更大的值。Size 可以是0或更大的值, 但即使size大于8,也被視作8,以兼容其它的匯編器。各個副本中的內容取自一個8字節長的數。最高4個字節為零,最低的4個字節是value,它以 as正在匯編的目標計算機的整數字節順序排列。每個副本中的size個字節都取值于這個數最低的size個字節。再次說明,這個古怪的動作只是為了兼容其他的匯編器。
size參數和value參數是可選的。如果不存在第2個逗號和value參數,則假定value為零。如果不存在第1個逗號和其后的參數,則假定size為1。

------------------------------------------------------------------------------------------------------
再貼一個關于 alignment 和 padding(對齊和填充 )偽指令 的翻譯:

7.3 .align abs-expr, abs-expr, abs-expr
Pad the location counter (in the current subsection) to a particular storage boundary. The first expression (which must be absolute) is the alignment required, as described below.
The second expression (also absolute) gives the fill value to be stored in the padding bytes. It (and the comma) may be omitted. If it is omitted, the padding bytes are normally zero. However, on some systems, if the section is marked as containing code and the fill value is omitted, the space is filled with no-op instructions.
The third expression is also absolute, and is also optional. If it is present, it is the maximum number of bytes that should be skipped by this alignment directive. If doing the alignment would require skipping more bytes than the specified maximum, then the alignment is not done at all. You can omit the fill value (the second argument) entirely by simply using two commas after the required alignment; this can be useful if you want the alignment to be filled with no-op instructions when appropriate.
The way the required alignment is specified varies from system to system. For the a29k, hppa, m68k, m88k, w65, sparc, and Hitachi SH, and i386 using ELF format, the first expression is the alignment request in bytes. For example ‘.align 8’ advances the location counter until it is a multiple of 8. If the location counter is already a multiple of 8, no change is needed.
For other systems, including the i386 using a.out format, and the arm and strongarm, it is the number of low-order zero bits the location counter must have after advancement. For example ‘.align 3’ advances the location counter until it a multiple of 8. If the location counter is already a multiple of 8, no change is needed.
This inconsistency is due to the different behaviors of the various native assemblers for these systems which GAS must emulate. GAS also provides .balign and .p2align directives, described later, which have a consistent behavior across all architectures (but are specific to GAS).


7.3 .align abs-expr, abs-expr, abs-expr
增加位置計數器(在當前的子段)使它指向規定的存儲邊界。第一個表達式參數(結果必須是純粹的數字)是必需參數:邊界基準,見后面的描述。
第二個表達式參數(結果必須是純粹的數字)給出填充字節的值,用這個值填充位置計數器越過的地方。這個參數(和逗點)可以省略,如果省略它,填充字節的值通常是0。但在某些系統上,如果本段標識為包含代碼,而填充值被省略,則使用no-op指令填充這個空間。
第3個參數表達式的結果也必須是純粹的數字,這個參數是可選的。如果存在第3個參數,它代表本對齊命令允許越過字節數的最大值。如果完成這個對齊需要跳過的字節比指定的最大值還多,則根本無法完成對齊。您可以在邊界基準后簡單地使用兩個逗號,以省略填充值參數(第二參數);如果您想在適當的時候,對齊操作自動使用no-op指令填充,這個方法將非常奏效。
邊界基準的定義因系統而有差異。a29k,hppa,m68k,m88k,w65,sparc,Hitachi SH, 和使用ELF格式的i386,第一個表達式是邊界基準,單位是字節。例如‘.align 8’向后移動位置計數器至8的倍數。如果地址已經是8的倍數,則無需移動。
有些其它系統,包括使用a.out格式的i386,ARM和strongarm,這代表位置計數器移動后,計數器中連續為0的低序位數量。例如‘.align 3’向后移動位置計數器直至8的倍數(計數器的最低的3位為0)。如果地址已經是8倍數,則無需移動。
之所以存在這樣的區別,是因為GAS需要模仿各種匯編器的不同動作。GAS還提供.balign和.p2align命令,在以后詳細講述,這兩條命令在所有的機型上使用相同的動作 (但需要向GAS明確說明機型)。




歡迎光臨 電子工程網 (http://m.qingdxww.cn/) Powered by Discuz! X3.4
主站蜘蛛池模板: 无限资源日本2019版免费| RUNAWAY韩国动漫免费官网版| 在线网站你懂的| 亚洲自拍第二页| 中文精品久久久久国产网站| 中文免费| 男子扒开美女尿口做羞羞的事| 亚洲AV一宅男色影视| 欧美区亚洲区| 最近韩国HD免费观看国语| 亚洲国产天堂久久九九九| 欧美一级第一免费高清| 天天干天天射天天舔| 色中文网| 一区二区日韩欧美| 国产成人教育视频在线观看| 男人吃奶摸下弄进去好爽| 日本美女黄色一级片| 日本a级三级三级三级久久| 天堂a| 天堂中文字幕在线观看| 亚洲视频中文字幕在线观看| 成人人观看的免费毛片| 奇米狠狠干| 亚洲欧美综合区自拍另类| 欧美国产精品不卡在线观看| 日韩欧美区| 中文天堂在线www| 一区二区三区四区在线免费观看 | videos gratis欧美另类| 天天靠天天擦天天摸| 亚洲人成一区二区不卡| 日本亚洲欧美美色| 亚洲专区路线一路线二| 亚洲欧美国产五月天综合 | 手机看片精品高清国产日韩| 四虎永久| 95国产精品人妻无码久| 久久国产乱子伦免费精品| 亚洲国产综合另类视频| 三级a黄|