5 int sys_proc_destroy(int pid, int exitcode)
7 return ros_syscall(SYS_proc_destroy, pid, exitcode, 0, 0, 0);
10 void* sys_brk(void* addr)
12 return (void*)ros_syscall(SYS_brk, addr, 0, 0, 0, 0);
17 return ros_syscall(SYS_getpid, 0, 0, 0, 0, 0);
20 size_t sys_getcpuid(void)
22 return ros_syscall(SYS_getcpuid, 0, 0, 0, 0, 0);
25 ssize_t sys_cputs(const uint8_t *s, size_t len)
27 return ros_syscall(SYS_cputs, s, len, 0, 0, 0);
30 uint16_t sys_cgetc(void)
32 return ros_syscall(SYS_cgetc, 0, 0, 0, 0, 0);
37 return ros_syscall(SYS_null, 0, 0, 0, 0, 0);
40 ssize_t sys_shared_page_alloc(void** addr, pid_t p2,
41 int p1_flags, int p2_flags
44 return ros_syscall(SYS_shared_page_alloc, addr,
45 p2, p1_flags, p2_flags, 0);
48 ssize_t sys_shared_page_free(void* addr, pid_t p2)
50 return ros_syscall(SYS_shared_page_free, addr, p2, 0,0,0);
53 //Write a buffer over the serial port
54 ssize_t sys_serial_write(void* buf, size_t len)
56 return ros_syscall(SYS_serial_write, buf, len, 0, 0, 0);
59 //Read a buffer over the serial port
60 ssize_t sys_serial_read(void* buf, size_t len)
62 return ros_syscall(SYS_serial_read, buf, len, 0, 0, 0);
65 //Run a binary loaded at the specificed address with the specified arguments
66 ssize_t sys_run_binary(void* binary_buf, size_t len,
67 const procinfo_t* pi, size_t num_colors)
69 return ros_syscall(SYS_run_binary, binary_buf, len,
73 //Write a buffer over ethernet
74 ssize_t sys_eth_write(void* buf, size_t len)
79 return ros_syscall(SYS_eth_write, buf, len, 0, 0, 0);
82 //Read a buffer via ethernet
83 ssize_t sys_eth_read(void* buf, size_t len)
88 return ros_syscall(SYS_eth_read, buf, len, 0, 0, 0);
91 /* Request resources from the kernel. Flags in ros/resource.h. */
92 ssize_t sys_resource_req(int type, size_t amt_max, size_t amt_min, uint32_t flags)
94 return ros_syscall(SYS_resource_req, type, amt_max, amt_min, flags, 0);
99 ros_syscall(SYS_reboot,0,0,0,0,0);
102 void sys_yield(bool being_nice)
104 ros_syscall(SYS_yield, being_nice, 0, 0, 0, 0);
107 int sys_proc_create(char* path)
109 return ros_syscall(SYS_proc_create, (uintreg_t)path, 0, 0, 0, 0);
112 int sys_proc_run(int pid)
114 return ros_syscall(SYS_proc_run, pid, 0, 0, 0, 0);
117 /* We need to do some hackery to pass 6 arguments. Arg4 pts to the real arg4,
118 * arg5, and arg6. Keep this in sync with kern/src/syscall.c.
119 * TODO: consider a syscall_multi that can take more args, and keep it in sync
120 * with the kernel. Maybe wait til we fix sysenter to have 5 or 6 args. */
121 void *CT(length) sys_mmap(void *SNT addr, size_t length, int prot, int flags,
122 int fd, size_t offset)
129 extra_args._flags = flags;
131 extra_args._offset = offset;
132 // TODO: deputy bitches about this
133 return (void*CT(length))TC(ros_syscall(SYS_mmap, addr, length,
134 prot, &extra_args, 0));
137 int sys_notify(int pid, unsigned int notif, struct notif_event *ne)
139 return ros_syscall(SYS_notify, pid, notif, ne, 0, 0);
142 int sys_self_notify(uint32_t vcoreid, unsigned int notif,
143 struct notif_event *ne)
145 return ros_syscall(SYS_self_notify, vcoreid, notif, ne, 0, 0);
148 int sys_halt_core(unsigned int usec)
150 return ros_syscall(SYS_halt_core, usec, 0, 0, 0, 0);