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

查看: 4955|回復: 4
打印 上一主題 下一主題

找gas文檔來學學匯編。

[復制鏈接]
跳轉到指定樓層
樓主
發表于 2009-7-25 07:59:31 | 只看該作者 |只看大圖 回帖獎勵 |倒序瀏覽 |閱讀模式
關鍵詞: 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
沙發
 樓主| 發表于 2009-7-25 08:29:14 | 只看該作者
找了些例子。
:~/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;                \
.
.
.
板凳
 樓主| 發表于 2009-7-25 08:44:22 | 只看該作者
./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
地板
 樓主| 發表于 2009-7-25 08:50:47 | 只看該作者
如:
.fill 1024,4,0------------>拷貝1024個塊,每個塊是4個字節,每個塊用0來初始化?
地下室
 樓主| 發表于 2009-7-25 13:13:48 | 只看該作者
在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明確說明機型)。
您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規則

關于我們  -  服務條款  -  使用指南  -  站點地圖  -  友情鏈接  -  聯系我們
電子工程網 © 版權所有   京ICP備16069177號 | 京公網安備11010502021702
快速回復 返回頂部 返回列表
主站蜘蛛池模板: 日欧毛片| 天天做天天爱夜夜爽| 亚洲欧洲日产国码无码av| 国产精品1区在线播放| 无码一区二区三区| 亚洲国产美女精品久久| 色综合天天综合网看在线影院| 日韩美一区二区| 婷婷色天使在线视频观看| lesbabes性欧美| 天天色天天综合网| 亚洲免费片| 亚州综合| 五月天色综合| 国产AV无码成人黄网站免费| 无码人妻少妇色欲AV一区二区| 欧美一区综合| 午夜久久久久久亚洲国产精品| 乌克兰xxxxhd| 97成人在线| 三级网站视频| 香蕉片视频在线观看| 新久草视频| 伊人久久精品无码二区麻豆| 国产乱色伦影片在线观看| 色婷婷AV99XX| 欧美一级在线观看视频| 日本一区二区视频在线| 天美传媒影视mv| 2019精品国产品在线不卡| 欧美性猛交AAA片| 四虎影院国产| 欧美一级黄色录相| 射玉足| www精品一区二区三区四区| 熟妇少妇任你躁在线无码| 全免费一级毛片在线播放| 天天操天天干天天透| 一个人看的www的视频| 国产精品永久免费| 在线视频网站www色|