From dc42c3998b01e66a609fed5d503a81a972e636d6 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Wed, 12 Oct 2011 12:37:37 +0800 Subject: [PATCH] Kernel - Changed Threads_CloneTCB (removed Err ptr) --- Kernel/arch/x86/proc.c | 4 ++-- Kernel/arch/x86_64/proc.c | 7 +++++-- Kernel/include/threads_int.h | 2 +- Kernel/threads.c | 9 +++------ 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Kernel/arch/x86/proc.c b/Kernel/arch/x86/proc.c index c0b748f1..3c298fce 100644 --- a/Kernel/arch/x86/proc.c +++ b/Kernel/arch/x86/proc.c @@ -557,7 +557,7 @@ int Proc_NewKThread(void (*Fcn)(void*), void *Data) tThread *newThread, *cur; cur = Proc_GetCurThread(); - newThread = Threads_CloneTCB(NULL, 0); + newThread = Threads_CloneTCB(0); if(!newThread) return -1; // Set CR3 @@ -604,7 +604,7 @@ int Proc_Clone(Uint Flags) } // New thread - newThread = Threads_CloneTCB(NULL, Flags); + newThread = Threads_CloneTCB(Flags); if(!newThread) return -1; newThread->KernelStack = cur->KernelStack; diff --git a/Kernel/arch/x86_64/proc.c b/Kernel/arch/x86_64/proc.c index 415901fc..ce6ebbde 100644 --- a/Kernel/arch/x86_64/proc.c +++ b/Kernel/arch/x86_64/proc.c @@ -429,13 +429,16 @@ tThread *Proc_GetCurThread(void) #endif } +/** + * \brief Create a new kernel thread + */ int Proc_NewKThread(void (*Fcn)(void*), void *Data) { Uint rsp; tThread *newThread, *cur; cur = Proc_GetCurThread(); - newThread = Threads_CloneTCB(NULL, 0); + newThread = Threads_CloneTCB(0); if(!newThread) return -1; // Set CR3 @@ -481,7 +484,7 @@ int Proc_Clone(Uint Flags) } // Create new TCB - newThread = Threads_CloneTCB(NULL, Flags); + newThread = Threads_CloneTCB(Flags); if(!newThread) return -1; // Save core machine state diff --git a/Kernel/include/threads_int.h b/Kernel/include/threads_int.h index f5c7b1b8..124f51a1 100644 --- a/Kernel/include/threads_int.h +++ b/Kernel/include/threads_int.h @@ -111,7 +111,7 @@ extern void Threads_AddActive(tThread *Thread); extern tThread *Threads_RemActive(void); extern tThread *Threads_GetNextToRun(int CPU, tThread *Last); -extern tThread *Threads_CloneTCB(Uint *Err, Uint Flags); +extern tThread *Threads_CloneTCB(Uint Flags); extern tThread *Threads_CloneThreadZero(void); #endif diff --git a/Kernel/threads.c b/Kernel/threads.c index 10226a13..76041f58 100644 --- a/Kernel/threads.c +++ b/Kernel/threads.c @@ -233,12 +233,10 @@ void Threads_SetPriority(tThread *Thread, int Pri) } /** - * \fn tThread *Threads_CloneTCB(Uint *Err, Uint Flags) * \brief Clone the TCB of the current thread - * \param Err Error pointer * \param Flags Flags for something... (What is this for?) */ -tThread *Threads_CloneTCB(Uint *Err, Uint Flags) +tThread *Threads_CloneTCB(Uint Flags) { tThread *cur, *new; int i; @@ -246,7 +244,7 @@ tThread *Threads_CloneTCB(Uint *Err, Uint Flags) // Allocate and duplicate new = malloc(sizeof(tThread)); - if(new == NULL) { *Err = -ENOMEM; return NULL; } + if(new == NULL) { errno = -ENOMEM; return NULL; } memcpy(new, cur, sizeof(tThread)); new->CurCPU = -1; @@ -309,8 +307,7 @@ tThread *Threads_CloneTCB(Uint *Err, Uint Flags) } /** - * \fn tThread *Threads_CloneTCB(Uint *Err, Uint Flags) - * \brief Clone the TCB of the current thread + * \brief Clone the TCB of the kernel thread */ tThread *Threads_CloneThreadZero(void) { -- 2.20.1