Something missing from this kernel interface?
Posted: Sun Jan 06, 2008 1:20 pm
This is the interface I want my kernel to have. Did I forget something?
Messages
Processes
Threads
Memory allocation
Memory sharing
Note: On writing/copying/moving, the page table entries for the target process are managed automatically.
Edit:
Synchronization
Security
The message API can be accessed by all processes. (Processes can only destroy their own ports.)
The synchronization API can be accessed by all processes.
All other APIs can only be accessed by the root task.
Messages
Code: Select all
port_t ki_port_create(tick_t max_response_time, cb * callback);
bool ki_port_destroy(port_t port);
bool ki_send_message(port_t port, int aParam, int bParam, int cParam, int dParam);
void ki_get_message();
Code: Select all
handle ki_process_create(bool is_driver);
bool ki_process_destroy(handle process);
handle ki_process_get_current();
Code: Select all
handle ki_thread_create(handle process, void * entrypoint, void * stack);
bool ki_thread_pause(handle thread);
bool ki_thread_resume(handle thread);
bool ki_thread_destroy(handle thread);
handle ki_thread_get_current();
Code: Select all
void * ki_page_alloc(handle process, void * page);
bool ki_page_free(handle process, void * page);
Code: Select all
void * ki_write_process_memory(handle process, void * source, void * otarget, size_t bytes);
void * ki_read_process_memory(handle process, void * osource, void * target, size_t bytes);
void * ki_copy_process_memory(handle pfrom, handle pto, void *osource, void * otarget, size_t bytes);
void * ki_move_process_memory(handle pfrom, handle pto, void *osource, void * otarget, size_t bytes);
Edit:
Synchronization
Code: Select all
mutex_t ki_mutex_create();
void ki_mutex_destroy(mutex_t mutex);
void ki_mutex_lock(mutex_t mutex);
bool ki_mutex_try_lock(mutex_t mutex);
bool ki_mutex_unlock(mutex_t mutex);
bool ki_timer_wait(uint time);
The message API can be accessed by all processes. (Processes can only destroy their own ports.)
The synchronization API can be accessed by all processes.
All other APIs can only be accessed by the root task.