• <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精品成人片试看| av午夜福利一片免费看久久| 久久精品人妻中文系列| 97久久精品午夜一区二区| 99久久国产综合精品成人影院| 久久亚洲2019中文字幕| av色综合久久天堂av色综合在| 四虎国产永久免费久久| 国产欧美久久久精品影院| 国产精品久久成人影院| 91精品国产91久久久久久| 久久久久综合中文字幕| 中文字幕精品无码久久久久久3D日动漫 | 亚洲国产成人久久笫一页| 精品久久久久成人码免费动漫 | 无码精品久久久天天影视| 欧美久久一级内射wwwwww.| 91精品国产高清久久久久久io| 国产午夜精品久久久久九九电影| 狠狠色丁香久久综合婷婷| 7777精品久久久大香线蕉| 国产成人综合久久综合| 亚洲欧美一级久久精品| 四虎国产精品免费久久5151| 伊人久久大香线蕉亚洲五月天| 久久久久国产一区二区| 国产L精品国产亚洲区久久| 91精品国产高清91久久久久久| 亚洲成av人片不卡无码久久| 国产精品欧美久久久天天影视| 久久综合九色综合网站| 久久久久黑人强伦姧人妻| 97久久国产亚洲精品超碰热| 中文字幕久久波多野结衣av| 武侠古典久久婷婷狼人伊人| 国产激情久久久久影院| 久久噜噜电影你懂的| 久久精品国产99国产电影网 | 久久精品人人做人人爽电影| 久久婷婷成人综合色综合|