diff --git a/cleonos/c/apps/help_main.c b/cleonos/c/apps/help_main.c index 52a3257..33221b7 100644 --- a/cleonos/c/apps/help_main.c +++ b/cleonos/c/apps/help_main.c @@ -12,29 +12,29 @@ static int ush_cmd_help(void) { ush_writeln(" cd [dir]"); ush_writeln(" exec|run [args...]"); ush_writeln(" clear"); - ush_writeln(" ansi / ansitest / color"); - ush_writeln(" bmpview [cols]"); - ush_writeln(" qrcode [--ecc ] "); - ush_writeln(" wavplay [steps] [ticks] / wavplay --stop"); - ush_writeln(" fastfetch [--plain]"); - ush_writeln(" doom [wad_path] (framebuffer bootstrap renderer)"); - ush_writeln(" memstat / fsstat / taskstat / userstat / shstat / stats"); + ush_writeln(" ansi / ansitest / color"); + ush_writeln(" bmpview [cols]"); + ush_writeln(" qrcode [--ecc ] "); + ush_writeln(" wavplay [steps] [ticks] / wavplay --stop"); + ush_writeln(" fastfetch [--plain]"); + ush_writeln(" doom [wad_path] (framebuffer bootstrap renderer)"); + ush_writeln(" memstat / fsstat / taskstat / userstat / shstat / stats"); ush_writeln(" tty [index]"); ush_writeln(" dmesg [n]"); ush_writeln(" kbdstat"); - ush_writeln(" mkdir (/temp only)"); - ush_writeln(" touch (/temp only)"); - ush_writeln(" write (/temp only, or from pipeline)"); - ush_writeln(" append (/temp only, or from pipeline)"); - ush_writeln(" cp (dst /temp only)"); - ush_writeln(" mv (/temp only)"); - ush_writeln(" rm (/temp only)"); - ush_writeln(" diskinfo"); - ush_writeln(" mkfsfat32 [label]"); - ush_writeln(" mount [path] (default suggested: /temp/disk)"); - ush_writeln(" partctl (mbr partition control: list/init-mbr/create/delete/set-boot)"); - ush_writeln(" ping [count]"); - ush_writeln(" pid"); + ush_writeln(" mkdir (/temp only)"); + ush_writeln(" touch (/temp only)"); + ush_writeln(" write (/temp only, or from pipeline)"); + ush_writeln(" append (/temp only, or from pipeline)"); + ush_writeln(" cp (dst /temp only)"); + ush_writeln(" mv (/temp only)"); + ush_writeln(" rm (/temp only)"); + ush_writeln(" diskinfo"); + ush_writeln(" mkfsfat32 [label]"); + ush_writeln(" mount [path] (default suggested: /temp/disk)"); + ush_writeln(" partctl (mbr partition control: list/init-mbr/create/delete/set-boot)"); + ush_writeln(" ping [count]"); + ush_writeln(" pid"); ush_writeln(" spawn [args...] / bg [args...]"); ush_writeln(" wait / fg [pid]"); ush_writeln(" kill [signal]"); diff --git a/cleonos/c/include/cleonos_syscall.h b/cleonos/c/include/cleonos_syscall.h index 7796f71..fc08eb7 100644 --- a/cleonos/c/include/cleonos_syscall.h +++ b/cleonos/c/include/cleonos_syscall.h @@ -26,7 +26,7 @@ typedef unsigned long long usize; #define CLEONOS_O_APPEND 0x0400ULL #define CLEONOS_FD_INHERIT ((u64) - 1) -typedef struct cleonos_proc_snapshot { +typedef struct cleonos_proc_snapshot { u64 pid; u64 ppid; u64 state; @@ -41,40 +41,40 @@ typedef struct cleonos_proc_snapshot { u64 last_fault_error; u64 last_fault_rip; char path[CLEONOS_PROC_PATH_MAX]; -} cleonos_proc_snapshot; - -typedef struct cleonos_fb_info { - u64 width; - u64 height; - u64 pitch; - u64 bpp; -} cleonos_fb_info; - -typedef struct cleonos_fb_blit_req { - u64 pixels_ptr; - u64 src_width; - u64 src_height; - u64 src_pitch_bytes; - u64 dst_x; - u64 dst_y; - u64 scale; -} cleonos_fb_blit_req; - -typedef struct cleonos_net_udp_send_req { - u64 dst_ipv4_be; - u64 dst_port; - u64 src_port; - u64 payload_ptr; - u64 payload_len; -} cleonos_net_udp_send_req; - -typedef struct cleonos_net_udp_recv_req { - u64 out_payload_ptr; - u64 payload_capacity; - u64 out_src_ipv4_ptr; - u64 out_src_port_ptr; - u64 out_dst_port_ptr; -} cleonos_net_udp_recv_req; +} cleonos_proc_snapshot; + +typedef struct cleonos_fb_info { + u64 width; + u64 height; + u64 pitch; + u64 bpp; +} cleonos_fb_info; + +typedef struct cleonos_fb_blit_req { + u64 pixels_ptr; + u64 src_width; + u64 src_height; + u64 src_pitch_bytes; + u64 dst_x; + u64 dst_y; + u64 scale; +} cleonos_fb_blit_req; + +typedef struct cleonos_net_udp_send_req { + u64 dst_ipv4_be; + u64 dst_port; + u64 src_port; + u64 payload_ptr; + u64 payload_len; +} cleonos_net_udp_send_req; + +typedef struct cleonos_net_udp_recv_req { + u64 out_payload_ptr; + u64 payload_capacity; + u64 out_src_ipv4_ptr; + u64 out_src_port_ptr; + u64 out_dst_port_ptr; +} cleonos_net_udp_recv_req; #define CLEONOS_SYSCALL_LOG_WRITE 0ULL #define CLEONOS_SYSCALL_TIMER_TICKS 1ULL @@ -153,29 +153,29 @@ typedef struct cleonos_net_udp_recv_req { #define CLEONOS_SYSCALL_FD_WRITE 74ULL #define CLEONOS_SYSCALL_FD_CLOSE 75ULL #define CLEONOS_SYSCALL_FD_DUP 76ULL -#define CLEONOS_SYSCALL_DL_OPEN 77ULL -#define CLEONOS_SYSCALL_DL_CLOSE 78ULL -#define CLEONOS_SYSCALL_DL_SYM 79ULL -#define CLEONOS_SYSCALL_EXEC_PATHV_IO 80ULL -#define CLEONOS_SYSCALL_FB_INFO 81ULL -#define CLEONOS_SYSCALL_FB_BLIT 82ULL -#define CLEONOS_SYSCALL_FB_CLEAR 83ULL -#define CLEONOS_SYSCALL_KERNEL_VERSION 84ULL -#define CLEONOS_SYSCALL_DISK_PRESENT 85ULL -#define CLEONOS_SYSCALL_DISK_SIZE_BYTES 86ULL -#define CLEONOS_SYSCALL_DISK_SECTOR_COUNT 87ULL -#define CLEONOS_SYSCALL_DISK_FORMATTED 88ULL -#define CLEONOS_SYSCALL_DISK_FORMAT_FAT32 89ULL -#define CLEONOS_SYSCALL_DISK_MOUNT 90ULL -#define CLEONOS_SYSCALL_DISK_MOUNTED 91ULL -#define CLEONOS_SYSCALL_DISK_MOUNT_PATH 92ULL -#define CLEONOS_SYSCALL_DISK_READ_SECTOR 93ULL -#define CLEONOS_SYSCALL_DISK_WRITE_SECTOR 94ULL -#define CLEONOS_SYSCALL_NET_AVAILABLE 95ULL -#define CLEONOS_SYSCALL_NET_IPV4_ADDR 96ULL -#define CLEONOS_SYSCALL_NET_PING 97ULL -#define CLEONOS_SYSCALL_NET_UDP_SEND 98ULL -#define CLEONOS_SYSCALL_NET_UDP_RECV 99ULL +#define CLEONOS_SYSCALL_DL_OPEN 77ULL +#define CLEONOS_SYSCALL_DL_CLOSE 78ULL +#define CLEONOS_SYSCALL_DL_SYM 79ULL +#define CLEONOS_SYSCALL_EXEC_PATHV_IO 80ULL +#define CLEONOS_SYSCALL_FB_INFO 81ULL +#define CLEONOS_SYSCALL_FB_BLIT 82ULL +#define CLEONOS_SYSCALL_FB_CLEAR 83ULL +#define CLEONOS_SYSCALL_KERNEL_VERSION 84ULL +#define CLEONOS_SYSCALL_DISK_PRESENT 85ULL +#define CLEONOS_SYSCALL_DISK_SIZE_BYTES 86ULL +#define CLEONOS_SYSCALL_DISK_SECTOR_COUNT 87ULL +#define CLEONOS_SYSCALL_DISK_FORMATTED 88ULL +#define CLEONOS_SYSCALL_DISK_FORMAT_FAT32 89ULL +#define CLEONOS_SYSCALL_DISK_MOUNT 90ULL +#define CLEONOS_SYSCALL_DISK_MOUNTED 91ULL +#define CLEONOS_SYSCALL_DISK_MOUNT_PATH 92ULL +#define CLEONOS_SYSCALL_DISK_READ_SECTOR 93ULL +#define CLEONOS_SYSCALL_DISK_WRITE_SECTOR 94ULL +#define CLEONOS_SYSCALL_NET_AVAILABLE 95ULL +#define CLEONOS_SYSCALL_NET_IPV4_ADDR 96ULL +#define CLEONOS_SYSCALL_NET_PING 97ULL +#define CLEONOS_SYSCALL_NET_UDP_SEND 98ULL +#define CLEONOS_SYSCALL_NET_UDP_RECV 99ULL u64 cleonos_syscall(u64 id, u64 arg0, u64 arg1, u64 arg2); u64 cleonos_sys_log_write(const char *message, u64 length); @@ -256,27 +256,27 @@ u64 cleonos_sys_fd_read(u64 fd, void *out_buffer, u64 size); u64 cleonos_sys_fd_write(u64 fd, const void *buffer, u64 size); u64 cleonos_sys_fd_close(u64 fd); u64 cleonos_sys_fd_dup(u64 fd); -u64 cleonos_sys_dl_open(const char *path); -u64 cleonos_sys_dl_close(u64 handle); -u64 cleonos_sys_dl_sym(u64 handle, const char *symbol); -u64 cleonos_sys_fb_info(cleonos_fb_info *out_info); -u64 cleonos_sys_fb_blit(const cleonos_fb_blit_req *req); -u64 cleonos_sys_fb_clear(u64 rgb); -u64 cleonos_sys_kernel_version(char *out_version, u64 out_size); -u64 cleonos_sys_disk_present(void); -u64 cleonos_sys_disk_size_bytes(void); -u64 cleonos_sys_disk_sector_count(void); -u64 cleonos_sys_disk_formatted(void); -u64 cleonos_sys_disk_format_fat32(const char *label); -u64 cleonos_sys_disk_mount(const char *mount_path); -u64 cleonos_sys_disk_mounted(void); -u64 cleonos_sys_disk_mount_path(char *out_path, u64 out_size); -u64 cleonos_sys_disk_read_sector(u64 lba, void *out_sector); -u64 cleonos_sys_disk_write_sector(u64 lba, const void *sector_data); -u64 cleonos_sys_net_available(void); -u64 cleonos_sys_net_ipv4_addr(void); -u64 cleonos_sys_net_ping(u64 dst_ipv4_be, u64 poll_budget); -u64 cleonos_sys_net_udp_send(const cleonos_net_udp_send_req *req); -u64 cleonos_sys_net_udp_recv(cleonos_net_udp_recv_req *req); - -#endif +u64 cleonos_sys_dl_open(const char *path); +u64 cleonos_sys_dl_close(u64 handle); +u64 cleonos_sys_dl_sym(u64 handle, const char *symbol); +u64 cleonos_sys_fb_info(cleonos_fb_info *out_info); +u64 cleonos_sys_fb_blit(const cleonos_fb_blit_req *req); +u64 cleonos_sys_fb_clear(u64 rgb); +u64 cleonos_sys_kernel_version(char *out_version, u64 out_size); +u64 cleonos_sys_disk_present(void); +u64 cleonos_sys_disk_size_bytes(void); +u64 cleonos_sys_disk_sector_count(void); +u64 cleonos_sys_disk_formatted(void); +u64 cleonos_sys_disk_format_fat32(const char *label); +u64 cleonos_sys_disk_mount(const char *mount_path); +u64 cleonos_sys_disk_mounted(void); +u64 cleonos_sys_disk_mount_path(char *out_path, u64 out_size); +u64 cleonos_sys_disk_read_sector(u64 lba, void *out_sector); +u64 cleonos_sys_disk_write_sector(u64 lba, const void *sector_data); +u64 cleonos_sys_net_available(void); +u64 cleonos_sys_net_ipv4_addr(void); +u64 cleonos_sys_net_ping(u64 dst_ipv4_be, u64 poll_budget); +u64 cleonos_sys_net_udp_send(const cleonos_net_udp_send_req *req); +u64 cleonos_sys_net_udp_recv(cleonos_net_udp_recv_req *req); + +#endif diff --git a/cleonos/c/src/syscall.c b/cleonos/c/src/syscall.c index dac70b0..8217151 100644 --- a/cleonos/c/src/syscall.c +++ b/cleonos/c/src/syscall.c @@ -352,82 +352,82 @@ u64 cleonos_sys_dl_close(u64 handle) { return cleonos_syscall(CLEONOS_SYSCALL_DL_CLOSE, handle, 0ULL, 0ULL); } -u64 cleonos_sys_dl_sym(u64 handle, const char *symbol) { - return cleonos_syscall(CLEONOS_SYSCALL_DL_SYM, handle, (u64)symbol, 0ULL); -} - -u64 cleonos_sys_fb_info(cleonos_fb_info *out_info) { - return cleonos_syscall(CLEONOS_SYSCALL_FB_INFO, (u64)out_info, 0ULL, 0ULL); -} - -u64 cleonos_sys_fb_blit(const cleonos_fb_blit_req *req) { - return cleonos_syscall(CLEONOS_SYSCALL_FB_BLIT, (u64)req, 0ULL, 0ULL); -} - -u64 cleonos_sys_fb_clear(u64 rgb) { - return cleonos_syscall(CLEONOS_SYSCALL_FB_CLEAR, rgb, 0ULL, 0ULL); -} - -u64 cleonos_sys_kernel_version(char *out_version, u64 out_size) { - return cleonos_syscall(CLEONOS_SYSCALL_KERNEL_VERSION, (u64)out_version, out_size, 0ULL); -} - -u64 cleonos_sys_disk_present(void) { - return cleonos_syscall(CLEONOS_SYSCALL_DISK_PRESENT, 0ULL, 0ULL, 0ULL); -} - -u64 cleonos_sys_disk_size_bytes(void) { - return cleonos_syscall(CLEONOS_SYSCALL_DISK_SIZE_BYTES, 0ULL, 0ULL, 0ULL); -} - -u64 cleonos_sys_disk_sector_count(void) { - return cleonos_syscall(CLEONOS_SYSCALL_DISK_SECTOR_COUNT, 0ULL, 0ULL, 0ULL); -} - -u64 cleonos_sys_disk_formatted(void) { - return cleonos_syscall(CLEONOS_SYSCALL_DISK_FORMATTED, 0ULL, 0ULL, 0ULL); -} - -u64 cleonos_sys_disk_format_fat32(const char *label) { - return cleonos_syscall(CLEONOS_SYSCALL_DISK_FORMAT_FAT32, (u64)label, 0ULL, 0ULL); -} - -u64 cleonos_sys_disk_mount(const char *mount_path) { - return cleonos_syscall(CLEONOS_SYSCALL_DISK_MOUNT, (u64)mount_path, 0ULL, 0ULL); -} - -u64 cleonos_sys_disk_mounted(void) { - return cleonos_syscall(CLEONOS_SYSCALL_DISK_MOUNTED, 0ULL, 0ULL, 0ULL); -} - -u64 cleonos_sys_disk_mount_path(char *out_path, u64 out_size) { - return cleonos_syscall(CLEONOS_SYSCALL_DISK_MOUNT_PATH, (u64)out_path, out_size, 0ULL); -} - -u64 cleonos_sys_disk_read_sector(u64 lba, void *out_sector) { - return cleonos_syscall(CLEONOS_SYSCALL_DISK_READ_SECTOR, lba, (u64)out_sector, 0ULL); -} - -u64 cleonos_sys_disk_write_sector(u64 lba, const void *sector_data) { - return cleonos_syscall(CLEONOS_SYSCALL_DISK_WRITE_SECTOR, lba, (u64)sector_data, 0ULL); -} - -u64 cleonos_sys_net_available(void) { - return cleonos_syscall(CLEONOS_SYSCALL_NET_AVAILABLE, 0ULL, 0ULL, 0ULL); -} - -u64 cleonos_sys_net_ipv4_addr(void) { - return cleonos_syscall(CLEONOS_SYSCALL_NET_IPV4_ADDR, 0ULL, 0ULL, 0ULL); -} - -u64 cleonos_sys_net_ping(u64 dst_ipv4_be, u64 poll_budget) { - return cleonos_syscall(CLEONOS_SYSCALL_NET_PING, dst_ipv4_be, poll_budget, 0ULL); -} - -u64 cleonos_sys_net_udp_send(const cleonos_net_udp_send_req *req) { - return cleonos_syscall(CLEONOS_SYSCALL_NET_UDP_SEND, (u64)req, 0ULL, 0ULL); -} - -u64 cleonos_sys_net_udp_recv(cleonos_net_udp_recv_req *req) { - return cleonos_syscall(CLEONOS_SYSCALL_NET_UDP_RECV, (u64)req, 0ULL, 0ULL); -} +u64 cleonos_sys_dl_sym(u64 handle, const char *symbol) { + return cleonos_syscall(CLEONOS_SYSCALL_DL_SYM, handle, (u64)symbol, 0ULL); +} + +u64 cleonos_sys_fb_info(cleonos_fb_info *out_info) { + return cleonos_syscall(CLEONOS_SYSCALL_FB_INFO, (u64)out_info, 0ULL, 0ULL); +} + +u64 cleonos_sys_fb_blit(const cleonos_fb_blit_req *req) { + return cleonos_syscall(CLEONOS_SYSCALL_FB_BLIT, (u64)req, 0ULL, 0ULL); +} + +u64 cleonos_sys_fb_clear(u64 rgb) { + return cleonos_syscall(CLEONOS_SYSCALL_FB_CLEAR, rgb, 0ULL, 0ULL); +} + +u64 cleonos_sys_kernel_version(char *out_version, u64 out_size) { + return cleonos_syscall(CLEONOS_SYSCALL_KERNEL_VERSION, (u64)out_version, out_size, 0ULL); +} + +u64 cleonos_sys_disk_present(void) { + return cleonos_syscall(CLEONOS_SYSCALL_DISK_PRESENT, 0ULL, 0ULL, 0ULL); +} + +u64 cleonos_sys_disk_size_bytes(void) { + return cleonos_syscall(CLEONOS_SYSCALL_DISK_SIZE_BYTES, 0ULL, 0ULL, 0ULL); +} + +u64 cleonos_sys_disk_sector_count(void) { + return cleonos_syscall(CLEONOS_SYSCALL_DISK_SECTOR_COUNT, 0ULL, 0ULL, 0ULL); +} + +u64 cleonos_sys_disk_formatted(void) { + return cleonos_syscall(CLEONOS_SYSCALL_DISK_FORMATTED, 0ULL, 0ULL, 0ULL); +} + +u64 cleonos_sys_disk_format_fat32(const char *label) { + return cleonos_syscall(CLEONOS_SYSCALL_DISK_FORMAT_FAT32, (u64)label, 0ULL, 0ULL); +} + +u64 cleonos_sys_disk_mount(const char *mount_path) { + return cleonos_syscall(CLEONOS_SYSCALL_DISK_MOUNT, (u64)mount_path, 0ULL, 0ULL); +} + +u64 cleonos_sys_disk_mounted(void) { + return cleonos_syscall(CLEONOS_SYSCALL_DISK_MOUNTED, 0ULL, 0ULL, 0ULL); +} + +u64 cleonos_sys_disk_mount_path(char *out_path, u64 out_size) { + return cleonos_syscall(CLEONOS_SYSCALL_DISK_MOUNT_PATH, (u64)out_path, out_size, 0ULL); +} + +u64 cleonos_sys_disk_read_sector(u64 lba, void *out_sector) { + return cleonos_syscall(CLEONOS_SYSCALL_DISK_READ_SECTOR, lba, (u64)out_sector, 0ULL); +} + +u64 cleonos_sys_disk_write_sector(u64 lba, const void *sector_data) { + return cleonos_syscall(CLEONOS_SYSCALL_DISK_WRITE_SECTOR, lba, (u64)sector_data, 0ULL); +} + +u64 cleonos_sys_net_available(void) { + return cleonos_syscall(CLEONOS_SYSCALL_NET_AVAILABLE, 0ULL, 0ULL, 0ULL); +} + +u64 cleonos_sys_net_ipv4_addr(void) { + return cleonos_syscall(CLEONOS_SYSCALL_NET_IPV4_ADDR, 0ULL, 0ULL, 0ULL); +} + +u64 cleonos_sys_net_ping(u64 dst_ipv4_be, u64 poll_budget) { + return cleonos_syscall(CLEONOS_SYSCALL_NET_PING, dst_ipv4_be, poll_budget, 0ULL); +} + +u64 cleonos_sys_net_udp_send(const cleonos_net_udp_send_req *req) { + return cleonos_syscall(CLEONOS_SYSCALL_NET_UDP_SEND, (u64)req, 0ULL, 0ULL); +} + +u64 cleonos_sys_net_udp_recv(cleonos_net_udp_recv_req *req) { + return cleonos_syscall(CLEONOS_SYSCALL_NET_UDP_RECV, (u64)req, 0ULL, 0ULL); +}