Fixed uninitialised n_chunks in untested vpcreate
[marionette.git] / kernel / thread.h
blob6c4c58f8144331d2ac28636bd2403c4aa7238595
1 /*
2 * Copyright (c) 2008 Joshua Phillips. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 *
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in
12 * the documentation and/or other materials provided with the
13 * distribution.
15 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
16 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 * DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
19 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
21 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
23 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
25 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 #ifndef THREAD_H
29 #define THREAD_H
31 #include "cpustruct.h"
32 #include "stdint.h"
33 #include "timer.h"
34 #include "interrupt.h"
35 #include "mm/paging.h"
37 struct thread;
39 // only for use by timer.c
40 extern int preempt_on;
41 extern tick_t next_preempt;
43 void thread_sys_init(void); // initialize the threading system
44 void thread_sys_start(void); // start the threading system
45 struct thread *thread_new(void);
46 struct thread *thread_get_current(void);
47 void thread_set_pagedir(struct thread *t, struct pagedir *pd);
48 void thread_set_eip(struct thread *t, uint32_t eip);
49 void thread_set_esp(struct thread *t, uint32_t esp);
50 void thread_set_userspace(struct thread *t, int is_userspace);
51 void thread_resume(struct thread *t);
52 void thread_suspend(struct thread *t);
53 void thread_delete(struct thread *t);
54 void yield_internal(void);
55 void yield(void);
56 void preempt(struct interrupt_stack *is);
58 #endif