diff options
author | Richard Braun <rbraun@sceen.net> | 2012-11-09 21:35:49 +0100 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2012-11-09 21:40:52 +0100 |
commit | 79b5932c4eea229fca427bc93ba491ffecef10f5 (patch) | |
tree | bf1165e7fa7c2f6232fd8c1e8b6c148b329b42f7 /arch/x86/machine/tcb.h | |
parent | c8ba9280fafe518ada8a6d2a545d6afa2b2dbe23 (diff) |
Implement preliminary thread context
Three new modules are added :
- kern/task: Tasks are thread groups and resource containers for their
threads.
- kern/thread: The well known scheduling unit.
- x86/tcb: The architecture specific thread control block.
The kernel currently loads a single thread context on the main processor.
Diffstat (limited to 'arch/x86/machine/tcb.h')
-rw-r--r-- | arch/x86/machine/tcb.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/arch/x86/machine/tcb.h b/arch/x86/machine/tcb.h new file mode 100644 index 00000000..96ac66a7 --- /dev/null +++ b/arch/x86/machine/tcb.h @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2012 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * + * Thread control block. + */ + +#ifndef _X86_TCB_H +#define _X86_TCB_H + +#include <kern/macros.h> +#include <machine/trap.h> + +/* + * Forward declaration. + */ +struct thread; + +/* + * Architecture specific thread data. + */ +struct tcb { + struct trap_frame *frame; +}; + +/* + * Set up the tcb module. + */ +void tcb_setup(void); + +/* + * Create a TCB. + * + * Prepare the given stack for execution. + */ +int tcb_create(struct tcb **tcbp, void *stack, const struct thread *thread); + +/* + * Load a TCB. + * + * The caller context is lost. + */ +void __noreturn tcb_load(struct tcb *tcb); + +#endif /* _X86_TCB_H */ |