mirror of
https://github.com/JannisHeydemann/BoredOS.git
synced 2026-05-30 02:16:58 +00:00
feature: Add syscalls for ELF metadata parsing
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
#include "tty.h"
|
||||
#include "font_manager.h"
|
||||
#include "graphics.h"
|
||||
#include "app_metadata.h"
|
||||
|
||||
extern bool ps2_ctrl_pressed;
|
||||
|
||||
@@ -2087,7 +2088,21 @@ static uint64_t sys_cmd_tty_destroy(const syscall_args_t *args) {
|
||||
return tty_destroy(tty_id);
|
||||
}
|
||||
|
||||
#define SYS_CMD_TABLE_SIZE 76
|
||||
static uint64_t sys_cmd_get_elf_metadata(const syscall_args_t *args) {
|
||||
const char *path = (const char *)args->arg2;
|
||||
boredos_app_metadata_t *out = (boredos_app_metadata_t *)args->arg3;
|
||||
if (!path || !out) return 0;
|
||||
return app_metadata_read(path, out) ? 1 : 0;
|
||||
}
|
||||
static uint64_t sys_cmd_get_elf_primary_image(const syscall_args_t *args) {
|
||||
const char *path = (const char *)args->arg2;
|
||||
char *out_path = (char *)args->arg3;
|
||||
size_t out_size = (size_t)args->arg4;
|
||||
if (!path || !out_path || !out_size) return 0;
|
||||
return app_metadata_get_primary_image(path, out_path, out_size) ? 1 : 0;
|
||||
}
|
||||
|
||||
#define SYS_CMD_TABLE_SIZE 78
|
||||
static const syscall_handler_fn sys_cmd_table[SYS_CMD_TABLE_SIZE] = {
|
||||
[SYSTEM_CMD_SET_BG_COLOR] = sys_cmd_set_bg_color,
|
||||
[SYSTEM_CMD_SET_BG_PATTERN] = sys_cmd_set_bg_pattern,
|
||||
@@ -2150,6 +2165,8 @@ static const syscall_handler_fn sys_cmd_table[SYS_CMD_TABLE_SIZE] = {
|
||||
[SYSTEM_CMD_SIGACTION] = sys_cmd_sigaction,
|
||||
[SYSTEM_CMD_SIGPROCMASK] = sys_cmd_sigprocmask,
|
||||
[SYSTEM_CMD_SIGPENDING] = sys_cmd_sigpending,
|
||||
[SYSTEM_CMD_GET_ELF_METADATA] = sys_cmd_get_elf_metadata,
|
||||
[SYSTEM_CMD_GET_ELF_PRIMARY_IMAGE] = sys_cmd_get_elf_primary_image,
|
||||
};
|
||||
|
||||
static uint64_t handle_sys_write(const syscall_args_t *args) {
|
||||
|
||||
@@ -117,6 +117,8 @@ typedef struct {
|
||||
#define SYSTEM_CMD_SIGACTION 73
|
||||
#define SYSTEM_CMD_SIGPROCMASK 74
|
||||
#define SYSTEM_CMD_SIGPENDING 75
|
||||
#define SYSTEM_CMD_GET_ELF_METADATA 76
|
||||
#define SYSTEM_CMD_GET_ELF_PRIMARY_IMAGE 77
|
||||
|
||||
void syscall_init(void);
|
||||
uint64_t syscall_handler_c(registers_t *regs);
|
||||
|
||||
Reference in New Issue
Block a user