arm linux 系统调用实现

vmlinz posted @ Thu, 19 May 2011 18:17:35 +0800 in Linux with tags ARM linux , 6047 readers

arm linux 系统调用实现

In this article we will dive into system call interface implementation in arm linux(with gnu eabi).我们将从bionic中的open函数开始追溯arm linux的系统调用实现(使用gnu eabi)。


从bionic libc中的open函数追溯系统调用实现


  • 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

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


    .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_swi linux/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 系统调用跳转表,里面保存了各个系统调用实现的地址。

    .type sys_call_table, #object


    #include "calls.S"



  • 找出eabi中寄存器使用和参数传递的规则
  • 了解swi跳转的更多详细知识,比如如何跳转到一个固定位置的
  • arm系统的中断系统
  • 熟悉常用的arm指令和gnu 汇编器指令
unifoxz said:
Tue, 27 Sep 2011 22:17:29 +0800

请问 bionic/libc/arch-arm/syscalls/__open.S 中的 .save {r4, r7} 和 stmfd sp!, {r4, r7} 有什么区别?
另外,为什么 r4 在系统调用中也被收存?

Avatar_small said:
Tue, 14 May 2019 16:30:46 +0800

Here we will dive into system call interface implementation in arm linux (with gnu eabi). We will trace the arm linux system call implementation (using gnu eabi) from the open function in bionic. You can try in the school. Linux applications that want to access the kernel must use system calls to move from usr mode to svc mode.

Avatar_small said:
Mon, 20 May 2019 14:24:49 +0800

Linux apps that need to gain access to the kernel must utilize system calls to move from user mode to svc mode. In arm, this procedure is applied by swim (or equivalent to its instructions). Have you browsed at Users can get to more about it by visiting this site or try it on some other site.

AAA said:
Tue, 22 Feb 2022 04:26:56 +0800

i like the role of Anthony Hopkins in the movie Silence of The Lambs. this guy is simply amazing., How to Become a Credit Card Processor




I wanted to thank you for this great read!! I definitely enjoying every little bit of it I have you bookmarked to check out new stuff you post. ISO merchant services




I love blogging and i can say that you also love blogging . how to start a payment processing company

Robinjack said:
Mon, 13 Nov 2023 00:03:00 +0800

It lags behind how reality changes, which is why most data isn’t right forever. Data is only right for a short period..   seed phrase hack

robinjack said:
Thu, 08 Feb 2024 20:16:22 +0800

Talk Therapy: You share feelings and thoughts with a therapist who listens and guides you. It helps with stress, depression, or anxiety.. therapist Glastonbury CT

Login *

loading captcha image...
(type the code from the image)
or Ctrl+Enter