SYSCALL naked assembly working
[cortex-from-scratch] / lib / syscall.c
1
2 /* (CC-BY-NC-SA) ROBIN KRENS - ROBIN @ ROBINKRENS.NL
3  * 
4  * $LOG$
5  * 2019/9/21 - ROBIN KRENS      
6  * Initial version 
7  * 
8  * $DESCRIPTION$
9  * System calls for user functions
10  *
11  */
12
13 #include <stdbool.h>
14 #include <stddef.h>
15 #include <stdint.h>
16
17 #include <lib/syscall.h>
18
19
20 //__attribute__ ((naked))
21 static int theos_syscall(int SYSCALL_N, int SYSCALL_N2) {
22
23         asm volatile ("svc 11");
24         
25         return 0;
26 }
27
28 //__attribute__ ((naked))
29 void theos_test(int dummy, int dummy2) {
30
31         theos_syscall(0xB1, 0xB2);
32 }
33
34 /* void theos_cputs(const char * str, size_t len) {
35
36         //syscall(#, 0, 0, 0 ..);
37         theos_syscall(22, 44);
38 } */