2020-07-25 16:54:37 -05:00
|
|
|
/**
|
|
|
|
* \file
|
|
|
|
*/
|
|
|
|
|
2019-02-11 09:30:28 -06:00
|
|
|
#ifndef TASKING_HELPERS_H
|
|
|
|
#define TASKING_HELPERS_H
|
|
|
|
|
2020-07-22 19:37:11 -05:00
|
|
|
#include "../tasking.h"
|
2019-02-11 09:30:28 -06:00
|
|
|
|
2020-07-25 16:54:37 -05:00
|
|
|
/**
|
|
|
|
* The assembly part of switching to a thread. Performs the actual context switch.
|
|
|
|
* \param thread The thread to switch to.
|
|
|
|
*/
|
2020-07-20 09:51:30 -05:00
|
|
|
void switch_to_thread_asm(Thread* thread);
|
2020-07-25 16:54:37 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initializes a usermode task
|
|
|
|
*/
|
2020-07-20 09:51:30 -05:00
|
|
|
void task_init();
|
2020-07-25 16:54:37 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* An assembly helper for waiting for an unblocked thread
|
|
|
|
* Starts interrupts, halts, then clears interrupts.
|
|
|
|
*/
|
2020-07-22 19:26:55 -05:00
|
|
|
void wait_for_unblocked_thread_asm();
|
2020-07-25 16:54:37 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Setup a kernel stack for a thread
|
|
|
|
* \param thread The thread to setup a stack for
|
|
|
|
* \param param1 The thread's start function first parameter
|
|
|
|
* \param param2 The thread's start function second parameter
|
|
|
|
* \param kmode Whether the thread is a kernel mode thread
|
|
|
|
* \param eip The start address of the thread
|
|
|
|
*/
|
2020-07-23 11:50:23 -05:00
|
|
|
void setup_kstack(Thread* thread,void* param1,void* param2,char kmode,void* eip);
|
2019-02-11 09:30:28 -06:00
|
|
|
|
|
|
|
#endif
|