ARM syscall as c++ template
问题 I need to call some syscalls in my newlib stubs and the current implementation uses C macros which got unreadable and awful looking over time. (And I hate macros...) However, my implementation with C++ templates does only work for one parameter: template <int nr, typename RETTYPE, typename PARAM1> inline RETTYPE syscall(PARAM1 p1) { register PARAM1 r0 asm("r0") = p1; asm volatile("svc %[nr]\n" : "=r" (r0) : [nr] "i" (nr), "r" (r0) : "memory", "r1", "r2", "r3", "r12", "lr"); return (RETTYPE)