Hello everyone,
So I am constructing my simple kernel on an ARM CortexM3. To system calls I have created a macro that can take the SVC immediate and arguments.
#define syscall_1(code, args) { \ asm volatile ("MOV %%r0, %0 " \ : \ : "r" (args) \ : "%r0"); \ asm volatile ("svc %[immediate]" \ : \ :[immediate] "I" (code) \ : ); \}#define syscall_2(code, args1, args2) { \ asm volatile ("MOV %%r0, %0\n\t" \ "MOV %%r1, %1\n\t" \ : \ : "r" (args1), \ "r" (args2) \ : "%r0", \ "%r1"); \ asm volatile ("svc %[immediate]" \ : \ :[immediate] "I" (code) \ : ); \}
So I use a C wrapper to manage the callbacks as widely documented around, like on the ARM Cortex M3 Guide and other manuals. But first and most importantly, how would I get a return for this system call? I am storing it at a global, but I would like to be able to do something like ret = syscall(....).
And also, any way to create a single macro to adapt to the number of arguments?
Sorry, make that the RTOS2 directory, not RTOS, which is present also.