iOSREBook-issues icon indicating copy to clipboard operation
iOSREBook-issues copied to clipboard

内容错误,arm32 svc #80

Open fengjian opened this issue 6 years ago • 2 comments

印次:2018年6月第2次印刷 位置:351页3行 问题:svc #80 修改:svc #0x80 或者和下面arm64 一样svc #128

fengjian avatar Dec 19 '19 03:12 fengjian

#define SWI_SYSCALL 0x80

/* load the syscall number into r12 and trap / #define DO_SYSCALL(num)
.if (((num) & 0xff) == (num)) ;
mov r12, #(num) ;
.elseif (((num) & 0x3fc) == (num)) ;
mov r12, #(num) ;
.else ;
mov r12, #((num) & 0xffffff00) /
top half of the syscall number / ;
orr r12, r12, #((num) & 0xff) /
bottom half */ ;
.endif ;
swi #SWI_SYSCALL

/*

  • ARM64 system call interface:
  • TBD */

#define DO_SYSCALL(num, cerror)
mov x16, #(num) %%
svc #SWI_SYSCALL %%
b.cc 2f %%
PUSH_FRAME %%
bl _##cerror %%
POP_FRAME %%
2:

fengjian avatar Dec 19 '19 03:12 fengjian

https://www.theiphonewiki.com/wiki/Kernel_Syscalls

Unix Usage MOV IP, #x // number from following list into Intraprocedural, a.k.a. r12 on arm32 and x16 on arm64 SVC 0x80 // Formerly, SWI (software interrupt) For example, arm32:

(gdb) disass chown 0x30d2ad54 : mov r12, #16 ; 0x10, being # of chown 0x30d2ad58 <chown+4>: svc 0x00000080 And arm64:

libsystem_kernel.dylib`chown: 0x1866c6084 <+0>: mov x16, #0x10 0x1866c6088 <+4>: svc #0x80

fengjian avatar Dec 19 '19 04:12 fengjian