Hi, vincentc@andestech.com wrote,
Dear all: Stafford is right. internal_syscall_ncs6 is able to define in libc/sysdeps/linux/nds32/bits/syscalls.h like the following.
#define internal_syscall_ncs6(name, err, arg1, arg2, arg3, arg4, arg5, arg6) \ ({ \ register long __res __asm__("$r0"); \ register long __no __asm__("$r0") = (long) (name); \ register long __arg1 __asm__("$r1") = (long) (arg1); \ register long __arg2 __asm__("$r2") = (long) (arg2); \ register long __arg3 __asm__("$r3") = (long) (arg3); \ register long __arg4 __asm__("$r4") = (long) (arg4); \ register long __arg5 __asm__("$r5") = (long) (arg5); \ __asm__ volatile ( \ "addi10.sp\t #-4\n\t" \ CFI_ADJUST_CFA_OFFSET(4)"\n\t" \ "push\t %7\n\t" \ CFI_ADJUST_CFA_OFFSET(4)"\n\t" \ __issue_syscall (LIB_SYSCALL) \ "pop\t %7\n\t" \ CFI_ADJUST_CFA_OFFSET(-4)"\n\t" \ "addi10.sp\t #4\n\t" \ CFI_ADJUST_CFA_OFFSET(-4)"\n\t" \ __asm__ volatile ( \ __issue_syscall (LIB_SYSCALL) \ : "=r" (__res) /* output operands */ \ : "r" (__no) /* input operands */ \ , "r" (__arg1) /* input operands */ \ , "r" (__arg2) /* input operands */ \ , "r" (__arg3) /* input operands */ \ , "r" (__arg4) /* input operands */ \ , "r" (__arg5) /* input operands */ \ , "r" (arg6) /* input operands */ \ : __SYSCALL_CLOBBERS); /* list of clobbered registers */ \ __res; \ })
The value of argument "name" is the number of specified syscall. This syscall will be sent to kernel later through sys_syscall by "__issue_syscall (LIB_SYSCALL)".
When testing Stafford patch from: https://github.com/stffrdhrn/uclibc-ng.git -> branch gen-syscall
I added a missing ); before the second __asm__ volatile.
I get: /home/wbx/nds32/toolchain_andes-ag101p_uclibc-ng_nds32le/usr/bin/nds32le-openadk-linux-uclibc-gcc -c libc/sysdeps/linux/common/syscall.c -o libc/sysdeps/linux/common/syscall.os -Wall -Wstrict-prototypes -Wstrict-aliasing -funsigned-char -fno-builtin -fno-asm -fmerge-all-constants -std=gnu99 -fno-stack-protector -nostdinc -I./include -I./include -include libc-symbols.h -I./libc/sysdeps/linux/nds32 -I./libc/sysdeps/linux -I./ldso/ldso/nds32 -I./ldso/include -I. -Os -fstrict-aliasing -fwrapv -fno-ident -mcpu=n13 -Os -pipe -fomit-frame-pointer -fno-unwind-tables -fno-asynchronous-unwind-tables -D__USE_STDIO_FUTEXES__ -DHAVE_FORCED_UNWIND -D_LIBC_REENTRANT -I./libpthread/nptl -I./libpthread/nptl -I./libpthread/nptl/sysdeps/unix/sysv/linux/nds32 -I./libpthread/nptl/sysdeps/nds32 -I./libpthread/nptl/sysdeps/nds32 -I./libpthread/nptl/sysdeps/unix/sysv/linux -I./libpthread/nptl/sysdeps/unix/sysv/linux -I./libpthread/nptl/sysdeps/pthread -I./libpthread/nptl/sysdeps/pthread/bits -I./libpthread/nptl/sysdeps/generic -I./libc/sysdeps/linux/common -isystem /home/wbx/nds32/toolchain_andes-ag101p_uclibc-ng_nds32le/usr/lib/gcc/nds32le-openadk-linux-uclibc/4.9.4/include-fixed -isystem /home/wbx/nds32/toolchain_andes-ag101p_uclibc-ng_nds32le/usr/lib/gcc/nds32le-openadk-linux-uclibc/4.9.4/include -I/home/wbx/nds32/target_andes-ag101p_uclibc-ng_nds32le/usr/include/ -DNDEBUG -DIN_LIB=libc -DPIC -fPIC -MT libc/sysdeps/linux/common/syscall.os -MD -MP -MF libc/sysdeps/linux/common/.syscall.os.dep {standard input}: Assembler messages: {standard input}:62: Error: Unrecognized operand/register, smw.adm $r-1,[$sp],$r-1,0. {standard input}:65: Error: Unrecognized operand/register, lmw.bim $r-1,[$sp],$r-1,0. Makerules:369: recipe for target 'libc/sysdeps/linux/common/syscall.os' failed
Ideas?
best regards Waldemar