XenevaOS
Loading...
Searching...
No Matches
Functions | Variables
x86_64_sched.cpp File Reference
#include <Hal/x86_64_sched.h>
#include <Hal/x86_64_hal.h>
#include <Hal/Hal.h>
#include <Hal/x86_64_cpu.h>
#include <Hal/x86_64_lowlevel.h>
#include <Hal/x86_64_signal.h>
#include <Hal/x86_64_pic.h>
#include <Sync/spinlock.h>
#include <Hal/serial.h>
#include <Mm/kmalloc.h>
#include <Mm/vmmngr.h>
#include <Hal/pcpu.h>
#include <Mm/pmmngr.h>
#include <string.h>
#include <_null.h>
#include <aucon.h>
Include dependency graph for x86_64_sched.cpp:

Functions

int save_context (AuThread *t, void *tss)
 
void execute_idle (AuThread *t, void *tss)
 
uint64_t AuMapKStack (uint64_t *cr3)
 
void AuThreadInsert (AuThread *new_task)
 
void AuThreadDelete (AuThread *thread)
 
void AuThreadInsertBlock (AuThread *new_task)
 
void AuThreadDeleteBlock (AuThread *thread)
 
void AuThreadInsertTrash (AuThread *new_task)
 
void AuThreadDeleteTrash (AuThread *thread)
 
void AuThreadInsertSleep (AuThread *new_task)
 
void AuThreadDeleteSleep (AuThread *thread)
 
AuThreadAuCreateKthread (void(*entry)(uint64_t), uint64_t stack, uint64_t cr3, char *name)
 
void AuKThreadCopy (AuThread *dest, AuThread *src)
 
void AuIdleThread (uint64_t t)
 
void AuSchedulerInitialise ()
 
void AuSchedulerInitAp ()
 
void AuHandleSleepThreads ()
 
void AuNextThread ()
 
uint64_t x64_get_rsp ()
 
void x8664SchedulerISR (size_t v, void *param)
 
void AuSchedulerStart ()
 
void AuPrintStack ()
 
AuThreadAuGetCurrentThread ()
 
AU_EXTERN AU_EXPORT void AuBlockThread (AuThread *thread)
 
AU_EXTERN AU_EXPORT void AuSleepThread (AuThread *thread, uint64_t ms)
 
AU_EXTERN AU_EXPORT void AuUnblockThread (AuThread *t)
 
void AuThreadMoveToTrash (AuThread *t)
 
void AuThreadCleanTrash (AuThread *t)
 
AuThreadAuThreadFindByID (uint16_t id)
 
AuThreadAuThreadFindByIDBlockList (uint16_t id)
 
AU_EXTERN AU_EXPORT void AuForceScheduler ()
 
bool AuIsSchedulerInitialised ()
 
uint64_t AuGetSystemTimerTick ()
 

Variables

AuThreadthread_list_head
 
AuThreadthread_list_last
 
AuThreadblocked_thr_head
 
AuThreadblocked_thr_last
 
AuThreadtrash_thr_head
 
AuThreadtrash_thr_last
 
AuThreadsleep_thr_head
 
AuThreadsleep_thr_last
 
bool _x86_64_sched_enable
 
AuThread_idle_thr
 
Spinlock_idle_lock
 
bool _x86_64_sched_init
 

Function Documentation

◆ AuBlockThread()

AU_EXTERN AU_EXPORT void AuBlockThread ( AuThread thread)

◆ AuCreateKthread()

AuThread * AuCreateKthread ( void(*)(uint64_t entry,
uint64_t  stack,
uint64_t  cr3,
char *  name 
)

! Creates a kernel mode thread

Parameters
entry– Entry point address
stack– Stack address
cr3– the top most page map level address
name– name of the thread
priority– (currently unused) thread's priority

◆ AuForceScheduler()

AU_EXTERN AU_EXPORT void AuForceScheduler ( )

◆ AuGetCurrentThread()

AuThread * AuGetCurrentThread ( )

◆ AuGetSystemTimerTick()

uint64_t AuGetSystemTimerTick ( )

◆ AuHandleSleepThreads()

void AuHandleSleepThreads ( )

◆ AuIdleThread()

void AuIdleThread ( uint64_t  t)

◆ AuIsSchedulerInitialised()

bool AuIsSchedulerInitialised ( )

◆ AuKThreadCopy()

void AuKThreadCopy ( AuThread dest,
AuThread src 
)

◆ AuMapKStack()

uint64_t AuMapKStack ( uint64_t cr3)

◆ AuNextThread()

void AuNextThread ( )

◆ AuPrintStack()

void AuPrintStack ( )

◆ AuSchedulerInitAp()

void AuSchedulerInitAp ( )

◆ AuSchedulerInitialise()

void AuSchedulerInitialise ( )

◆ AuSchedulerStart()

void AuSchedulerStart ( )

◆ AuSleepThread()

AU_EXTERN AU_EXPORT void AuSleepThread ( AuThread thread,
uint64_t  ms 
)

◆ AuThreadCleanTrash()

void AuThreadCleanTrash ( AuThread t)

◆ AuThreadDelete()

void AuThreadDelete ( AuThread thread)

AuThreadDelete – remove a thread from thread list

Parameters
thread– thread address to remove

◆ AuThreadDeleteBlock()

void AuThreadDeleteBlock ( AuThread thread)

AuThreadDeleteBlock – remove a thread from thread list

Parameters
thread– thread address to remove

◆ AuThreadDeleteSleep()

void AuThreadDeleteSleep ( AuThread thread)

AuThreadDeleteSleep – remove a thread from sleep list

Parameters
thread– thread address to remove

◆ AuThreadDeleteTrash()

void AuThreadDeleteTrash ( AuThread thread)

AuThreadDeleteTrash – remove a thread from thread list

Parameters
thread– thread address to remove

◆ AuThreadFindByID()

AuThread * AuThreadFindByID ( uint16_t  id)

◆ AuThreadFindByIDBlockList()

AuThread * AuThreadFindByIDBlockList ( uint16_t  id)

◆ AuThreadInsert()

void AuThreadInsert ( AuThread new_task)

◆ AuThreadInsertBlock()

void AuThreadInsertBlock ( AuThread new_task)

Insert a thread to thread list

Parameters
new_task– new thread address

◆ AuThreadInsertSleep()

void AuThreadInsertSleep ( AuThread new_task)

Insert a thread to sleep list

Parameters
new_task– new thread address

◆ AuThreadInsertTrash()

void AuThreadInsertTrash ( AuThread new_task)

Insert a thread to trash list

Parameters
new_task– new thread address

◆ AuThreadMoveToTrash()

void AuThreadMoveToTrash ( AuThread t)

◆ AuUnblockThread()

AU_EXTERN AU_EXPORT void AuUnblockThread ( AuThread t)

◆ execute_idle()

void execute_idle ( AuThread t,
void *  tss 
)

◆ save_context()

int save_context ( AuThread t,
void *  tss 
)

◆ x64_get_rsp()

uint64_t x64_get_rsp ( )

◆ x8664SchedulerISR()

void x8664SchedulerISR ( size_t  v,
void *  param 
)

Variable Documentation

◆ _idle_lock

Spinlock* _idle_lock

◆ _idle_thr

AuThread* _idle_thr

◆ _x86_64_sched_enable

bool _x86_64_sched_enable

◆ _x86_64_sched_init

bool _x86_64_sched_init

◆ blocked_thr_head

AA64Thread * blocked_thr_head

◆ blocked_thr_last

AA64Thread * blocked_thr_last

◆ sleep_thr_head

AuThread* sleep_thr_head

◆ sleep_thr_last

AuThread* sleep_thr_last

◆ thread_list_head

AuThread* thread_list_head

BSD 2-Clause License

Copyright (c) 2022-2023, Manas Kamal Choudhury All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

◆ thread_list_last

AuThread* thread_list_last

◆ trash_thr_head

AuThread* trash_thr_head

◆ trash_thr_last

AuThread* trash_thr_last