• <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   管理


            久久精品天天中文字幕人妻| 日日躁夜夜躁狠狠久久AV| 国产成人精品久久亚洲高清不卡 国产成人精品久久亚洲高清不卡 国产成人精品久久亚洲 | 久久亚洲电影| 久久婷婷五月综合色高清| 99久久精品国产高清一区二区| 亚洲国产精品婷婷久久| 国产精品乱码久久久久久软件| 亚洲AV无码久久| 久久九色综合九色99伊人| 亚洲精品白浆高清久久久久久| 天天久久狠狠色综合| 久久精品成人欧美大片| 国产精品久久久久一区二区三区 | 久久综合狠狠综合久久97色| 久久香蕉超碰97国产精品| 欧美一级久久久久久久大| 久久香蕉国产线看观看乱码| 亚洲愉拍99热成人精品热久久| 国产精品伦理久久久久久| av无码久久久久久不卡网站 | 久久人人爽人人爽人人片AV东京热| 无遮挡粉嫩小泬久久久久久久| 久久国产精品免费一区| 国内精品伊人久久久久| 99久久国产综合精品女同图片| 欧美与黑人午夜性猛交久久久| 国产精品美女久久久免费| 99久久综合国产精品二区| 国产69精品久久久久777| 久久综合久久自在自线精品自 | 一本综合久久国产二区| 国产综合精品久久亚洲| 久久国产精品免费| 久久久久九国产精品| 欧美麻豆久久久久久中文| 久久精品国产一区二区| 亚洲国产精品成人久久蜜臀| 亚洲AⅤ优女AV综合久久久| 亚洲另类欧美综合久久图片区| 久久久久久久综合狠狠综合|