diff options
author | Richard Braun <rbraun@sceen.net> | 2014-05-06 20:49:26 +0200 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2014-05-06 20:49:26 +0200 |
commit | b11e4e9411cb0a4e99c370a4ff9a275540036aae (patch) | |
tree | 72064536d69b40727b1309f78da341b456a3c8f5 /arch | |
parent | edae23a2cd2800dff9806309854fb46f12d408d7 (diff) |
x86/tcb: make tcb_init initialize thread-local data
For now, there is no thread-local data to actually initialize, but the
interface is there to allow it. The main goal of this change is to avoid
the need of complex startup synchronization by allocating thread-local
data at thread creation time.
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/machine/tcb.c | 6 | ||||
-rw-r--r-- | arch/x86/machine/tcb.h | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/arch/x86/machine/tcb.c b/arch/x86/machine/tcb.c index e65eddf..c6d4c7f 100644 --- a/arch/x86/machine/tcb.c +++ b/arch/x86/machine/tcb.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013 Richard Braun. + * Copyright (c) 2012-2014 Richard Braun. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,7 +28,7 @@ void __noreturn tcb_context_load(struct tcb *tcb); void __noreturn tcb_start(void); -void +int tcb_init(struct tcb *tcb, void *stack, void (*fn)(void)) { void **ptr; @@ -39,6 +39,8 @@ tcb_init(struct tcb *tcb, void *stack, void (*fn)(void)) ptr = (void **)tcb->sp; *ptr = fn; + + return 0; } void __init diff --git a/arch/x86/machine/tcb.h b/arch/x86/machine/tcb.h index b3785af..79f953c 100644 --- a/arch/x86/machine/tcb.h +++ b/arch/x86/machine/tcb.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013 Richard Braun. + * Copyright (c) 2012-2014 Richard Braun. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -39,8 +39,10 @@ struct tcb { * * Prepare the given stack for execution. The context is defined so that it * will call fn() with interrupts disabled when loaded. + * + * In addition, initialize any thread-local machine-specific data. */ -void tcb_init(struct tcb *tcb, void *stack, void (*fn)(void)); +int tcb_init(struct tcb *tcb, void *stack, void (*fn)(void)); /* * Low level context switch function. |