mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-28 20:42:49 +00:00
arm: refactor the syscall glue to support ARMv6
This patch modifies the ARM syscall glue as follows: * the macros syscallX that produce different code for syscalls with different number of arguments are replaced by the generic syscall thunk copied from libc; * the syscall tables generation script is simplified since the syscall argument number analysis is redundant; * the ARMv7 specific instruction MOVW is eliminated. Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
6ee9ad5bc4
commit
d305fb1306
3 changed files with 31 additions and 71 deletions
|
|
@ -72,21 +72,7 @@ for (<IN>) {
|
|||
|
||||
if ($+{$code} ne "!") {
|
||||
print CODESOUT "#define $code_macro $+{$code}\n";
|
||||
|
||||
my $nargs;
|
||||
|
||||
if ($+{args} eq "void") {
|
||||
$nargs = 0;
|
||||
} else {
|
||||
my $tmp = $+{args};
|
||||
$nargs = 1 + ($tmp =~ tr/\,/\,/);
|
||||
|
||||
if ($nargs <= 4) {
|
||||
$nargs = 0;
|
||||
}
|
||||
}
|
||||
|
||||
print ASMOUT "syscall$nargs $sys_name, $code_macro\n";
|
||||
print ASMOUT "syscall $sys_name, $code_macro\n";
|
||||
|
||||
} else {
|
||||
$need_aux = 1;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,13 @@
|
|||
ENTRY(sys_mmap)
|
||||
push { %r4, %r5, %r7 }
|
||||
ldr %r4, [%sp, #12]
|
||||
ldr %r5, [%sp, #16]
|
||||
lsr %r5, #12
|
||||
do_sys 192
|
||||
pop { %r4, %r5, %r7 }
|
||||
bx %lr
|
||||
END(sys_mmap)
|
||||
nr_sys_mmap:
|
||||
.long 192
|
||||
|
||||
ENTRY(sys_mmap)
|
||||
push {%r4, %r5, %r7, %lr}
|
||||
ldr %r4, [%sp, #16]
|
||||
ldr %r5, [%sp, #20]
|
||||
lsr %r5, #12
|
||||
adr %r7, nr_sys_mmap
|
||||
ldr %r7, [%r7]
|
||||
svc 0x00000000
|
||||
pop {%r4, %r5, %r7, %pc}
|
||||
END(sys_mmap)
|
||||
|
|
|
|||
|
|
@ -1,56 +1,26 @@
|
|||
#include "asm/linkage.h"
|
||||
|
||||
.macro mov_r7 imm
|
||||
mov %r7, #\imm
|
||||
.endm
|
||||
syscall_common:
|
||||
ldr %r7, [%r7]
|
||||
add %ip, %sp, #16
|
||||
ldm %ip, {%r4, %r5, %r6}
|
||||
svc 0x00000000
|
||||
pop {%r4, %r5, %r6, %r7}
|
||||
bx %lr
|
||||
|
||||
|
||||
// Call the kernel
|
||||
.macro syscall name, nr
|
||||
.nr_\name :
|
||||
.long \nr
|
||||
|
||||
.macro do_sys opcode
|
||||
movw %r7, #\opcode
|
||||
svc #0
|
||||
.endm
|
||||
ENTRY(\name)
|
||||
push {%r4, %r5, %r6, %r7}
|
||||
adr %r7, .nr_\name
|
||||
b syscall_common
|
||||
END(\name)
|
||||
.endm
|
||||
|
||||
|
||||
// a syscall with 0-4 arguments
|
||||
|
||||
.macro syscall0 name, opcode
|
||||
ENTRY(\name)
|
||||
push { %r7 }
|
||||
do_sys \opcode
|
||||
pop { %r7 }
|
||||
bx %lr
|
||||
END(\name)
|
||||
.endm
|
||||
|
||||
|
||||
// a syscall with 5 arguments
|
||||
|
||||
.macro syscall5 name, opcode
|
||||
ENTRY(\name)
|
||||
push { %r4, %r7 }
|
||||
ldr %r4, [%sp, #8]
|
||||
do_sys \opcode
|
||||
pop { %r4, %r7 }
|
||||
bx %lr
|
||||
END(\name)
|
||||
.endm
|
||||
|
||||
|
||||
// a syscall with 6 arguments
|
||||
|
||||
.macro syscall6 name, opcode
|
||||
ENTRY(\name)
|
||||
push { %r4, %r5, %r7 }
|
||||
ldr %r4, [%sp, #12]
|
||||
ldr %r5, [%sp, #16]
|
||||
do_sys \opcode
|
||||
pop { %r4, %r5, %r7 }
|
||||
bx %lr
|
||||
END(\name)
|
||||
.endm
|
||||
|
||||
ENTRY(__cr_restore_rt)
|
||||
do_sys __NR_rt_sigreturn
|
||||
b sys_rt_sigreturn
|
||||
END(__cr_restore_rt)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue