You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a question about system call, because development needs so we will add new system call api for user ta.
My question is system call parameter have limit can not used uint64_t type?
Because I have some problem when use uint64_t type as system call parameter.
In arm32 compiler when use uint64_t type as parameter will use 2 registers to save data(because arm 32 register is 32bit),if can't put in register will save to stack, and I get a problem when system call api define as follows :
void f(int a,int b,int c, uint64_t d)
f(1,2,3,0x123456789);
disassembly will like :
.
strd r2,r3,[sp] will use r2 & r3 combination to 64bit data and save to stack
movs r0,#1
movs r1,#2
movs r3,#3
In lib/libutee/arch/arm/utee_syscalls_a32.S
.macro UTEE_SYSCALL name, scn, num_args
.
.
@ Tell number of arguments passed on the stack
mov r6, #(\num_args - 4)
.
. => because my system call only have 4 args so here r6 will 0, because This code default considered args 1~4 will all put in arm 32 register but in our case will put in stack
then in core/arch/arm/tee/arch_svc_a32.S
tee_svc_do_call
.
.
cmp r6, #0
beq .Lno_args
.
. => in our case will not use tee_svc_copy_from_user copy stack from user to kernel space,
here cause subsequent code use arg4 will error
I think problem will occur when system call args have uint64_t type and not enough cpu register can't use, will cause same problem(eg. ff(uint64_t a,uint64_t b,uint32_t c) c will get error because no copy stack from user space to kernel space).
Is there a limit 32bit optee system call can't use uint64_t type as System call parameter ??
If not limit, I think have to modify utee_syscalls_a32.S & arch_svc_a32.S mechanism.
The text was updated successfully, but these errors were encountered:
Hi optee expert
I have a question about system call, because development needs so we will add new system call api for user ta.
My question is system call parameter have limit can not used uint64_t type?
Because I have some problem when use uint64_t type as system call parameter.
In arm32 compiler when use uint64_t type as parameter will use 2 registers to save data(because arm 32 register is 32bit),if can't put in register will save to stack, and I get a problem when system call api define as follows :
void f(int a,int b,int c, uint64_t d)
f(1,2,3,0x123456789);
disassembly will like :
.
strd r2,r3,[sp] will use r2 & r3 combination to 64bit data and save to stack
movs r0,#1
movs r1,#2
movs r3,#3
In lib/libutee/arch/arm/utee_syscalls_a32.S
.macro UTEE_SYSCALL name, scn, num_args
.
.
@ Tell number of arguments passed on the stack
mov r6, #(\num_args - 4)
.
.
=> because my system call only have 4 args so here r6 will 0, because This code default considered args 1~4 will all put in arm 32 register but in our case will put in stack
then in core/arch/arm/tee/arch_svc_a32.S
tee_svc_do_call
.
.
cmp r6, #0
beq .Lno_args
.
.
=> in our case will not use tee_svc_copy_from_user copy stack from user to kernel space,
here cause subsequent code use arg4 will error
I think problem will occur when system call args have uint64_t type and not enough cpu register can't use, will cause same problem(eg. ff(uint64_t a,uint64_t b,uint32_t c) c will get error because no copy stack from user space to kernel space).
Is there a limit 32bit optee system call can't use uint64_t type as System call parameter ??
If not limit, I think have to modify utee_syscalls_a32.S & arch_svc_a32.S mechanism.
The text was updated successfully, but these errors were encountered: