Kernel thread creation can now take a pid and an argument

This commit is contained in:
pjht 2020-07-20 11:24:09 -05:00
parent ff3885241a
commit 69cd4f248d
3 changed files with 7 additions and 7 deletions

View File

@ -210,7 +210,7 @@ void isr_handler(registers_t* r) {
r->ebx=(uint32_t)tasking_get_errno_address(); r->ebx=(uint32_t)tasking_get_errno_address();
break; break;
case SYSCALL_GET_PID: case SYSCALL_GET_PID:
r->ebx=(pid_t)getPID(); r->ebx=(pid_t)tasking_getPID();
break; break;
case SYSCALL_ALLOC_MEM: case SYSCALL_ALLOC_MEM:
if ((void*)r->ecx==NULL) { if ((void*)r->ecx==NULL) {
@ -251,7 +251,7 @@ void isr_handler(registers_t* r) {
memcpy((char*)r->ebx,initrd,initrd_sz); memcpy((char*)r->ebx,initrd,initrd_sz);
break; break;
case SYSCALL_NEW_THREAD: case SYSCALL_NEW_THREAD:
tasking_new_thread((void*)r->ebx); tasking_new_thread((void*)r->ebx,tasking_getPID(),0,0);
break; break;
default: default:
break; break;

View File

@ -159,7 +159,7 @@ char tasking_isPrivleged() {
return currentThread->process->priv; return currentThread->process->priv;
} }
pid_t getPID() { pid_t tasking_getPID() {
return currentThread->process->pid; return currentThread->process->pid;
} }
@ -167,8 +167,8 @@ int* tasking_get_errno_address() {
return &currentThread->errno; return &currentThread->errno;
} }
void tasking_new_thread(void* start) { void tasking_new_thread(void* start,pid_t pid,char param_exists,uint32_t param_arg) {
tasking_createTask(start,NULL,0,0,0,0,getPID(),1); tasking_createTask(start,NULL,0,param_exists,param_arg,0,pid,1);
} }
void switch_to_thread(Thread* thread) { void switch_to_thread(Thread* thread) {

View File

@ -9,9 +9,9 @@
void tasking_createTask(void* eip,void* cr3,char kmode,char param1_exists,uint32_t param1_arg,char param2_exists,uint32_t param2_arg,char isThread); void tasking_createTask(void* eip,void* cr3,char kmode,char param1_exists,uint32_t param1_arg,char param2_exists,uint32_t param2_arg,char isThread);
void tasking_init(); void tasking_init();
char tasking_isPrivleged(); char tasking_isPrivleged();
pid_t getPID(); pid_t tasking_getPID();
int* tasking_get_errno_address(); int* tasking_get_errno_address();
void tasking_new_thread(void* start); void tasking_new_thread(void* start,pid_t pid,char param_exists,uint32_t param_arg);
void tasking_exit(uint8_t code); void tasking_exit(uint8_t code);
void tasking_block(ThreadState newstate); void tasking_block(ThreadState newstate);