Added usermode interrupt handling
This commit is contained in:
@@ -22,6 +22,8 @@
|
||||
#define IO_PORT 1 << 1
|
||||
#define IO_MAILBOX 2 << 1
|
||||
|
||||
typedef unsigned long (*signal_handler_t)(void*, void*);
|
||||
|
||||
struct process_context_t;
|
||||
|
||||
struct module_t
|
||||
@@ -73,10 +75,24 @@ struct port_t
|
||||
unsigned long owner_pid;
|
||||
};
|
||||
|
||||
struct signal_action_t
|
||||
{
|
||||
unsigned long pid;
|
||||
signal_handler_t func_ptr;
|
||||
void (*trampoline_ptr)();
|
||||
void *userdata;
|
||||
};
|
||||
|
||||
struct signal_context_t
|
||||
{
|
||||
unsigned long signal_id;
|
||||
};
|
||||
|
||||
struct kernel_t
|
||||
{
|
||||
struct syscall_t syscall_table[MAX_SYSCALL_ID];
|
||||
struct priority_queue_t priority_queue;
|
||||
struct avltree_t *interrupt_handlers;
|
||||
struct avltree_t *port_table;
|
||||
struct avltree_t *process_table;
|
||||
struct process_t *active_process;
|
||||
@@ -111,10 +127,16 @@ unsigned long kernel_get_port_owner(unsigned long id);
|
||||
|
||||
enum error_t kernel_send_message(unsigned long recipient, struct message_t *message);
|
||||
|
||||
enum error_t kernel_queue_sender(unsigned long recipient);
|
||||
|
||||
enum error_t kernel_queue_message(unsigned long recipient, struct message_t *message);
|
||||
|
||||
enum error_t kernel_register_interrupt_handler(unsigned long interrupt, signal_handler_t handler, void *userdata);
|
||||
|
||||
enum error_t kernel_remove_interrupt_handler(unsigned long interrupt);
|
||||
|
||||
enum error_t kernel_execute_interrupt_handler(unsigned long interrupt);
|
||||
|
||||
enum error_t kernel_signal_return();
|
||||
|
||||
int receive_message(struct message_t *buffer, int flags);
|
||||
|
||||
void panic(const char *message) __attribute__ ((noreturn));
|
||||
|
||||
@@ -33,12 +33,28 @@ struct process_context_t
|
||||
|
||||
void load_context(struct process_context_t *context);
|
||||
|
||||
void *get_context_pc(struct process_context_t *context);
|
||||
|
||||
void set_context_pc(struct process_context_t *context, void *pc);
|
||||
|
||||
void *get_context_stack(struct process_context_t *context);
|
||||
|
||||
void set_context_stack(struct process_context_t *context, void *stack);
|
||||
|
||||
void set_context_flags(struct process_context_t *context, unsigned long flags);
|
||||
|
||||
void set_context_return(struct process_context_t *context, unsigned long value);
|
||||
|
||||
void *context_stack_push(struct process_context_t *context, unsigned long value);
|
||||
|
||||
void *context_stack_push_struct(struct process_context_t *context, void *data, unsigned long size);
|
||||
|
||||
void *context_stack_pop(struct process_context_t *context, void *value);
|
||||
|
||||
void *context_stack_pop_struct(struct process_context_t *context, void *value, unsigned long size);
|
||||
|
||||
void context_call_func(struct process_context_t *context, void *func_ptr, void *ret_ptr, int argc, ...);
|
||||
|
||||
void context_cleanup_func(struct process_context_t *context, int argc);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user