Support kernel semaphore.

This commit is contained in:
TXuian
2024-05-29 11:06:03 +08:00
parent bd7966c5a3
commit 5a2c07e1a9
17 changed files with 394 additions and 16 deletions

View File

@@ -46,6 +46,8 @@ Modification:
#define SYSCALL_REGISTER_IRQ 11 //
#define SYSCALL_KILL 12 // kill the task by id
#define SYSCALL_SEMAPHORE 13 // semaphore related operations
// clang-format on
#ifndef __ASSEMBLER__
@@ -78,9 +80,12 @@ typedef union {
int priority;
} sys_state_info;
/* fn pointer to access user server */
typedef int (*ipc_read_fn)(struct Session* session, int fd, char* dst, int offset, int len);
typedef int (*ipc_write_fn)(struct Session* session, int fd, char* src, int offset, int len);
typedef enum {
SYS_SEM_NEW = 0,
SYS_SEM_FREE,
SYS_SEM_SIGNAL,
SYS_SEM_WAIT,
} sys_sem_option;
int syscall(int sys_num, uintptr_t param1, uintptr_t param2, uintptr_t param3, uintptr_t param4);
@@ -102,4 +107,6 @@ int sys_mmap(uintptr_t vaddr, uintptr_t paddr, int len, int is_dev);
int sys_register_irq(int irq_num, int irq_opcode);
int sys_unbind_irq_all(struct Thread* task);
int sys_unbind_irq(struct Thread* task, int irq_num);
int sys_semaphore(sys_sem_option op, int sem_id);
#endif