Make arsc and local async calls use the same structure.
[akaros.git] / tests / arsc_test.c
1 #include <parlib.h>
2 #include <vcore.h>
3 #include <ros/syscall.h>
4 #include <arc.h>
5 #include <stdio.h>
6
7 syscall_desc_t* sys_cputs_async(const char *s, size_t len,                                             
8                      void (*cleanup_handler)(void*), void* cleanup_data)
9 {                                                                                                                     
10     /*// could just hardcode 4 0's, will eventually wrap this marshaller anyway                                         
11         syscall_desc_t* desc;
12     syscall_req_t syscall = {REQ_alloc, cleanup_handler, cleanup_data,
13                                                         SYS_cputs,{(uint32_t)s, len, [2 ... (NUM_SYSCALL_ARGS-1)] 0} };                          
14     syscall.cleanup = cleanup_handler;                                                                                  
15     syscall.data = cleanup_data;
16     async_syscall(&syscall, &desc);
17         */
18         return arc_call(SYS_cputs, s, len);
19 }
20
21 int main(int argc, char** argv){
22         int pid = sys_getpid();
23         char testme = 't';
24         printf ("single thread - init arsc \n");
25         syscall_desc_t* sysdesc[2];
26         syscall_rsp_t sysrsp;
27         init_arc(&SYS_CHANNEL);
28
29         printf ("single thread - init complete \n");
30         // cprintf_async(&desc1, "Cross-Core call 1, coming from process %08x\n", pid);
31         sysdesc[0] = sys_cputs_async(&testme, 1, NULL, NULL);
32         sysdesc[1] = sys_cputs_async(&testme, 1, NULL, NULL);
33
34         printf ("single thread - call placed \n");
35         //ignore return value
36         assert(-1 != waiton_syscall(sysdesc[0]));
37         assert(-1 != waiton_syscall(sysdesc[1]));
38         printf ("single thread - dummy call \n");       
39 }