-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from akriese/feature/syscall
Feature/syscall
- Loading branch information
Showing
33 changed files
with
1,227 additions
and
351 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,4 +24,6 @@ char dbgu_grab_char(); | |
|
||
void dbgu_enable(); | ||
|
||
int dbgu_has_next(); | ||
|
||
#endif // !_DBGU_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,5 @@ int exception_program(); | |
int interrupt_program(); | ||
|
||
int thread_program(); | ||
|
||
int sys_call_application(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#ifndef _RESOURCES_H_ | ||
#define _RESOURCES_H_ | ||
|
||
typedef enum resource_type { | ||
RESOURCE_NONE, | ||
RESOURCE_DBGU_RECEIVE, | ||
RESOURCE_DBGU_TRANSMIT, | ||
RESOURCE_WAITING_TIME, | ||
} resource_type; | ||
|
||
#endif /* ifndef _RESOURCES_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,15 @@ | ||
void scheduler_start(); | ||
|
||
void scheduler_register_thread(unsigned int thread_id); | ||
#include <thread.h> | ||
|
||
void scheduler_end_thread(); | ||
|
||
void scheduler_next(void *context); | ||
void scheduler_next(thread_context *context); | ||
|
||
void scheduler_init(); | ||
|
||
void scheduler_count_time(); | ||
|
||
void scheduler_switch(unsigned int thread_id, thread_context *context); | ||
|
||
unsigned int scheduler_count_ready(); | ||
|
||
void scheduler_init(int (*idle_fun)()); | ||
void scheduler_set_idle_fun(int (*idle_fun)()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#ifndef _SHRINE_OS_LIB_H_ | ||
#define _SHRINE_OS_LIB_H_ | ||
|
||
void sys_call_exit_thread(); | ||
int sys_call_create_thread(int (*fun)(void *), void *input); | ||
void sys_call_sleep(unsigned int duration); | ||
char sys_call_read_char(); | ||
void sys_call_put_char(char c); | ||
void sys_call_register_irq_callback(unsigned int callback_id, | ||
int (*fun)(void *)); | ||
void sys_call_st_set_pits_intervall(unsigned int ms); | ||
void sys_call_set_idle_function(int (*idle_fun)()); | ||
|
||
#endif /* ifndef _SHRINE_OS_LIB_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,30 @@ | ||
#ifndef _SYS_CALL_H_ | ||
#define _SYS_CALL_H_ | ||
|
||
void sys_call_handler(unsigned int number, void *context); | ||
#include <resource.h> | ||
#include <thread.h> | ||
|
||
#define SYSCALL_NUM_THREAD_EXIT 1 | ||
#define SYSCALL_NUM_THREAD_CREATE 2 | ||
#define SYSCALL_NUM_THREAD_SLEEP 3 | ||
#define SYSCALL_NUM_IO_READ_CHAR 4 | ||
#define SYSCALL_NUM_IO_PUT_CHAR 5 | ||
#define SYSCALL_NUM_REGISTER_IRQ_CALLBACK 6 | ||
#define SYSCALL_NUM_ST_SET_PITS_INTERVALL 7 | ||
#define SYSCALL_NUM_SET_IDLE_FUNCTION 8 | ||
|
||
void sys_call_handler(unsigned int number, thread_context *context); | ||
void sys_call_post_unblock(resource_type blocking_resource, | ||
unsigned int unblocked_thread_id); | ||
|
||
void sys_call_exit_thread(); | ||
int sys_call_create_thread(int (*fun)(void *), void *input); | ||
void sys_call_sleep(unsigned int duration); | ||
char sys_call_read_char(); | ||
void sys_call_put_char(char c); | ||
void sys_call_register_irq_callback(unsigned int callback_id, | ||
int (*fun)(void *)); | ||
void sys_call_st_set_pits_intervall(unsigned int ms); | ||
void sys_call_set_idle_function(int (*idle_fun)()); | ||
|
||
#endif // !_SYS_CALL_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.