ARM system call

1. The system call vector numbers are defined in arch/arm/include/asm/unistd.h

#define __NR_restart_syscall(__NR_SYSCALL_BASE+  0)
#define __NR_exit (__NR_SYSCALL_BASE+  1)
#define __NR_fork (__NR_SYSCALL_BASE+  2)
#define __NR_read (__NR_SYSCALL_BASE+  3)

...

2. Inarch/arm/kernel/entry-common.S, defined a variable, sys_call_table, then put syscall handlers' address (which defined inarch/arm/kernel/calls.S) here:

.type    sys_call_table, #object
ENTRY(sys_call_table)
#include "calls.S"  

...

/* Special system call wrappers*/

...

sys_mmap2:

#if PAGE_SHIFT > 12

...

#else

str r5, [sp, #4]

b do_mmap2

#endif

ENDPROC(sys_mmap2)


Be noted:

A. each entry of the sys_call_table is the syscall handler's address.

B. Some system call handler (the wrappers) are defined in this file.


3. Most of the syscall routines are declared ininclude/linux/syscalls.h and defined in separate modules. For several special syscalls, for example, sys_mmap2(), system defines wrappers for them just below the sys_call_table. See above. That is, the system call, mmap2's handler is just defined in this assembly source file, and it calls do_mmap2().


3. Also the swi software interrupt handler is defined inarch/arm/kernel/entry-common.S. It's a quite long routine but basically, it does following:

ENTRY(vector_swi)
Get syscall number

...
enable_irq
...
ldrcc pc, [tbl, scno, lsl #2]@ call sys_* routine
ENDPROC(vector_swi)



  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值