<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設計應用 > Android arm linux 系統(tǒng)調用實現(xiàn)

          Android arm linux 系統(tǒng)調用實現(xiàn)

          作者: 時間:2016-11-09 來源:網(wǎng)絡 收藏
          In this article we will dive into system call interface implementation in arm linux(with gnu eabi).我們將從bionic中的open函數(shù)開始追溯arm linux的系統(tǒng)調用實現(xiàn)(使用gnu eabi)。

          Linux的應用程序要想訪問內(nèi)核必須使用系統(tǒng)調用從而實現(xiàn)從usr模式轉到svc模式。在arm中,這個過程是通過swi(或者和它等價的指令)來實現(xiàn)模式轉換的。

          本文引用地址:http://www.ex-cimer.com/article/201611/318011.htm

          從bionic libc中的open函數(shù)追溯系統(tǒng)調用實現(xiàn)

          相關文件:

          • bionic/libc/unistd/open.c

          • bionic/libc/arch-arm/syscalls/__open.S

          • linux/arch/arm/kernel/entry-common.S

          • linux/arch/arm/kernel/entry-armv.S

          • linux/arch/arm/kernel/entry-header.S

          相關調用過程:

          • int open(const char *pathname, int flags, ...);bionic/libc/unistd/open.c

          • __openbionic/libc/arch-arm/syscalls/__open.S

            __open:

            .save {r4, r7}

            stmfd sp!, {r4, r7}

            ldr r7, =__NR_open

            swi #0

            ldmfd sp!, {r4, r7}

            movs r0, r0

            bxpl lr

            b __set_syscall_errno

          • vector_swilinux/arch/arm/kernel/entry-common.S

            adr tbl, sys_call_table @ load syscall table pointer

            cmp scno, #NR_syscalls @ check upper syscall limit

            adr lr, BSYM(ret_fast_syscall) @ return address

            ldrcc pc, [tbl, scno, lsl #2] @ call sys_* routine

          • sys_call_table系統(tǒng)調用跳轉表,里面保存了各個系統(tǒng)調用實現(xiàn)的地址。

            .type sys_call_table, #object

            ENTRY(sys_call_table)

            #include "calls.S"



          評論


          技術專區(qū)

          關閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();