• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            隨筆 - 42  文章 - 3  trackbacks - 0
            <2012年7月>
            24252627282930
            1234567
            891011121314
            15161718192021
            22232425262728
            2930311234

            常用鏈接

            留言簿(2)

            隨筆檔案

            文章檔案

            網(wǎng)頁收藏

            搜索

            •  

            最新評(píng)論

            閱讀排行榜

            評(píng)論排行榜

             
            在編寫共享庫時(shí),為保證ABI(app binary interface)兼容:
              1 盡量使用C語言 2不要在接口類使用虛函數(shù)和模板; 3 不要改變成員函數(shù)的訪問權(quán)限; 4 不要使用STL 5 不要依賴使用虛擬析構(gòu)函數(shù),最好自己實(shí)現(xiàn),顯式調(diào)用;
            6 不要在DLL里面申請內(nèi)存,DLL外釋放,DLL和APP可能不在同一個(gè)內(nèi)存堆;

            可重入(reentrant)函數(shù)可以由多于一個(gè)任務(wù)并發(fā)使用,而不必?fù)?dān)心數(shù)據(jù)錯(cuò)誤。相反, 不可重入(non-reentrant)函數(shù)不能由超過一個(gè)任務(wù)所共享,除非能確保函數(shù)的互斥(或者使用信號(hào)量,或者在代碼的關(guān)鍵部分禁用中斷)。可重入函數(shù)可以在任意時(shí)刻被中斷,稍后再繼續(xù)運(yùn)行,不會(huì)丟失數(shù)據(jù)。可重入函數(shù)要么使用本地變量,要么在使用全局變量時(shí)保護(hù)自己的數(shù)據(jù)。
            Reentrant Function:A function whose effect, when called by two or more threads,is guaranteed to be as if the threads each executed thefunction one after another in an undefined order, even ifthe actual execution is interleaved.
            Thread-Safe Function:A function that may be safely invoked concurrently by multiple threads.

            函數(shù)可重入的必要條件:
            1 不使用任何(局部)靜態(tài)變量或者全局的非常量;
            2 不返回任何局部靜態(tài)或者全局非常量指針;
            3 僅依賴調(diào)用方的參數(shù);
            4 不依賴任何單個(gè)資源的鎖;
            5 不調(diào)用任何不可重入的函數(shù);

            In classical OS, stack grows downwards. After each push operatation, the value of ebp becomes small, and vice versa.

            esp is the top of the stack.

            ebp is usually set to esp at the start of the function. Local variables are accessed by subtracting a constant offset from ebp. All x86 calling conventions define ebp as being preserved across function calls. ebp itself actually points to the previous frame's base pointer, which enables stack walking in a debugger and viewing other frames local variables to work.

            Most function prologs look something like:
            push ebp      ; Preserve current frame pointer
            mov ebp, esp  ; Create new frame pointer pointing to current stack top
            sub esp, 20   ; allocate 20 bytes worth of locals on stack. 

            Then later in the function you may have code like (presuming both local variables are 4 bytes)
            mov [ebp-4], eax    ; Store eax in first local
            mov ebx, [ebp - 8]  ; Load ebx from second local

            objdump is a program for displaying various information about object files. For instance, it can be used as a disassembler to view executable in assembly form. It is part of the GNU Binutils for fine-grained control over executable and other binary data.

            For example, to completely disassemble a binary:
            objdump -Dslx file


            posted on 2012-07-17 22:20 鷹擊長空 閱讀(316) 評(píng)論(0)  編輯 收藏 引用

            只有注冊用戶登錄后才能發(fā)表評(píng)論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


            国产精品中文久久久久久久| 久久亚洲美女精品国产精品| 久久99精品综合国产首页| 久久精品国产99久久久| 久久精品一区二区三区不卡| 777米奇久久最新地址| 国产精品va久久久久久久| 精品久久久久久99人妻| 久久精品国产亚洲AV蜜臀色欲| 亚洲精品无码久久千人斩| 欧美日韩中文字幕久久伊人| 2020久久精品亚洲热综合一本| 久久精品亚洲中文字幕无码麻豆 | 国产精品久久久久久吹潮| 欧美综合天天夜夜久久| 久久久久久亚洲精品影院| 国内精品久久九九国产精品| 亚洲国产精品成人久久蜜臀 | 狠狠综合久久AV一区二区三区 | 国产成人99久久亚洲综合精品| 久久久久无码精品国产app| 99久久人妻无码精品系列蜜桃| 色综合久久88色综合天天 | 久久亚洲高清观看| 亚洲AV无码成人网站久久精品大| 久久精品三级视频| 欧美亚洲国产精品久久蜜芽| 久久久女人与动物群交毛片| 国产精品乱码久久久久久软件| 国产亚洲色婷婷久久99精品91| 婷婷五月深深久久精品| 中文字幕热久久久久久久| 亚洲伊人久久综合中文成人网 | 一本一本久久A久久综合精品| 国产亚洲成人久久| 狠狠色综合久久久久尤物 | 一本久久精品一区二区| 日本高清无卡码一区二区久久| yellow中文字幕久久网| 国产精品欧美亚洲韩国日本久久| 国产精品女同一区二区久久|