|
XenevaOS
|
#include <stdint.h>#include <Hal/AA64/aa64cpu.h>#include <Hal/AA64/sched.h>#include <Mm/pmmngr.h>#include <Mm/kmalloc.h>#include <Mm/vmmngr.h>#include <string.h>#include <_null.h>#include <Hal/AA64/aa64lowlevel.h>#include <Drivers/uart.h>#include <Hal/AA64/gic.h>#include <aucon.h>#include <aurora.h>
Functions | |
| void | aa64_store_context (AA64Thread *thr) |
| void | store_syscall (AA64Thread *thr) |
| bool | aa64_restore_context (AA64Thread *thr) |
| void | ret_from_syscall (AA64Thread *thr) |
| void | first_time_sex (AA64Thread *thr) |
| void | first_time_sex2 (AA64Thread *thr) |
| uint64_t | read_sp () |
| void | AuThreadInsert (AA64Thread *new_task) |
| AuThreadInsert – insert a thread into thread list. | |
| void | AuThreadDelete (AA64Thread *thread) |
| AuThreadDelete – remove a thread from thread list. | |
| void | AuThreadInsertBlock (AA64Thread *new_task) |
| AuThreadInsertBlock – insert a thread to block thread list. | |
| void | AuThreadDeleteBlock (AA64Thread *thread) |
| AuThreadDeleteBlock – remove a thread from thread list. | |
| void | AuThreadInsertTrash (AA64Thread *new_task) |
| AuThreadInsertTrash – Insert a thread to trash list. | |
| void | AuThreadDeleteTrash (AA64Thread *thread) |
| AuThreadDeleteTrash – remove a thread from thread list. | |
| void | AuThreadInsertSleep (AA64Thread *new_task) |
| AuThreadInsertSleep – Insert a thread to sleep list. | |
| void | AuThreadDeleteSleep (AA64Thread *thread) |
| AuThreadDeleteSleep – remove a thread from sleep list. | |
| void | AA64NextThread () |
| AA64Thread * | AuCreateKthread (void(*entry)(uint64_t), uint64_t *pml, char *name) |
| AuCreateKthread – create kernel thread. | |
| void | PrintThreadInfo () |
| void | AuIdleThread (uint64_t ctx) |
| void | resume_user (AA64Thread *thr, void *ksp) |
| void | AuResumeUserThread () |
| uint64_t | read_x30 () |
| void | settimerdebug () |
| void | enscheddebug () |
| void | AuHandleSleepThreads () |
| void | PrintThrIn () |
| void | AuThreadSafeReturn (uint64_t rcx) |
| void | AuPrintStack (uint64_t st) |
| void | AuScheduleThread (AA64Registers *regs) |
| AuScheduleThread – the core of multi-tasking. It schedules threads next to be runned. | |
| bool | setStk () |
| uint64_t | AuCreateKernelStack (uint64_t *pml) |
| AuCreateKernelStack – maps kernel stack and return the top of the stack, it only maps 4KiB of stack. | |
| void | AuSchedulerInitialize () |
| AuSchedulerInitialize – initialize the scheduler. | |
| void | AuSchedulerStart () |
| AuSchedulerStart – start the scheduler. | |
| AA64Thread * | AuGetIdleThread () |
| AA64Thread * | AuGetCurrentThread () |
| void | AuForceScheduler () |
| AuForceScheduler – force the scheduler to switch next thread. | |
| void | AuBlockThread (AA64Thread *thread) |
| AuBlockThread – blocks a running thread. | |
| void | AuUnblockThread (AA64Thread *thread) |
| AuUnblockThread – unblocks a thread and insert it to ready list. | |
| void | AuSleepThread (AA64Thread *thread, uint64_t ms) |
| AuSleepThread – block a running thread and put it into sleep list. | |
| AA64Thread * | AuThreadFindByID (uint64_t id) |
| AuThreadFindByID – finds a thread by its id from ready queue. | |
| AA64Thread * | AuThreadFindByIDBlockList (uint64_t id) |
| AuThreadFindByIDBlockList – finds a thread by its id from the block queue. | |
| void | AuThreadMoveToTrash (AA64Thread *t) |
| AuThreadMoveToTrash – move given thread to trash. | |
| uint64_t | AuGetSystemTimerTick () |
| AuGetSystemTimerTick – return the current system timer tick. | |
| void | AuSetIdleThread (AA64Thread *thr) |
| AuSetIdleThread – change the idle thread pointer. | |
Variables | |
| AA64Thread * | thread_list_head |
| AA64Thread * | thread_list_last |
| AA64Thread * | blocked_thr_head |
| AA64Thread * | blocked_thr_last |
| AA64Thread * | trash_thr_head |
| AA64Thread * | trash_thr_last |
| AA64Thread * | sleep_thr_head |
| AA64Thread * | sleep_thr_last |
| AA64Thread * | current_thread |
| AA64Thread * | _idle_thr |
| uint64_t | thread_id |
| bool | _scheduler_initialized |
| uint64_t | scheduler_tick |
| bool | debug = 0 |
| uint64_t | stack_index |
BSD 2-Clause License
Copyright (c) 2022-2025, 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:
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.
|
extern |
|
extern |
| void AA64NextThread | ( | ) |
| void AuBlockThread | ( | AA64Thread * | thread | ) |
AuBlockThread – blocks a running thread.
| thread | – Pointer to AA64 Thread |
AuCreateKernelStack – maps kernel stack and return the top of the stack, it only maps 4KiB of stack.
| pml | – Pointer to page directory |
AuCreateKthread – create kernel thread.
| entry | – Pointer to entry point |
| pml | – Pointer to Page directory |
| name | – Name of the thread |
| void AuForceScheduler | ( | ) |
AuForceScheduler – force the scheduler to switch next thread.
| AA64Thread * AuGetCurrentThread | ( | ) |
| AA64Thread * AuGetIdleThread | ( | ) |
| uint64_t AuGetSystemTimerTick | ( | ) |
AuGetSystemTimerTick – return the current system timer tick.
| void AuHandleSleepThreads | ( | ) |
| void AuIdleThread | ( | uint64_t | ctx | ) |
|
extern |
| void AuResumeUserThread | ( | ) |
| void AuSchedulerInitialize | ( | ) |
AuSchedulerInitialize – initialize the scheduler.
| void AuSchedulerStart | ( | ) |
AuSchedulerStart – start the scheduler.
| void AuScheduleThread | ( | AA64Registers * | regs | ) |
AuScheduleThread – the core of multi-tasking. It schedules threads next to be runned.
| regs | – Passed by Timer ISR |
| void AuSetIdleThread | ( | AA64Thread * | thr | ) |
AuSetIdleThread – change the idle thread pointer.
| thr | – Pointer to idle thread |
| void AuSleepThread | ( | AA64Thread * | thread, |
| uint64_t | ms | ||
| ) |
AuSleepThread – block a running thread and put it into sleep list.
| thread | – Pointer to AA64 Thread |
| void AuThreadDelete | ( | AA64Thread * | thread | ) |
AuThreadDelete – remove a thread from thread list.
| thread | – thread address to remove |
| void AuThreadDeleteBlock | ( | AA64Thread * | thread | ) |
AuThreadDeleteBlock – remove a thread from thread list.
| thread | – thread address to remove |
| void AuThreadDeleteSleep | ( | AA64Thread * | thread | ) |
AuThreadDeleteSleep – remove a thread from sleep list.
| thread | – thread address to remove |
| void AuThreadDeleteTrash | ( | AA64Thread * | thread | ) |
AuThreadDeleteTrash – remove a thread from thread list.
| thread | – thread address to remove |
| AA64Thread * AuThreadFindByID | ( | uint64_t | id | ) |
AuThreadFindByID – finds a thread by its id from ready queue.
| id | – id of the thread |
| AA64Thread * AuThreadFindByIDBlockList | ( | uint64_t | id | ) |
AuThreadFindByIDBlockList – finds a thread by its id from the block queue.
| id | – id of the thread |
| void AuThreadInsert | ( | AA64Thread * | new_task | ) |
AuThreadInsert – insert a thread into thread list.
| new_task | – pointer to thread that need to insert |
| void AuThreadInsertBlock | ( | AA64Thread * | new_task | ) |
AuThreadInsertBlock – insert a thread to block thread list.
| new_task | – Pointer to thread |
| void AuThreadInsertSleep | ( | AA64Thread * | new_task | ) |
AuThreadInsertSleep – Insert a thread to sleep list.
| new_task | – new thread address |
| void AuThreadInsertTrash | ( | AA64Thread * | new_task | ) |
AuThreadInsertTrash – Insert a thread to trash list.
| new_task | – new thread address |
| void AuThreadMoveToTrash | ( | AA64Thread * | t | ) |
AuThreadMoveToTrash – move given thread to trash.
| t | – Thread to move to trash |
| void AuThreadSafeReturn | ( | uint64_t | rcx | ) |
| void AuUnblockThread | ( | AA64Thread * | thread | ) |
AuUnblockThread – unblocks a thread and insert it to ready list.
| t | – pointer to thread |
| void enscheddebug | ( | ) |
|
extern |
|
extern |
|
extern |
| void PrintThrIn | ( | ) |
|
extern |
|
extern |
|
extern |
|
extern |
| bool setStk | ( | ) |
|
extern |
|
extern |
| AA64Thread* _idle_thr |
| bool _scheduler_initialized |
| AA64Thread* blocked_thr_head |
| AA64Thread* blocked_thr_last |
| AA64Thread* current_thread |
| bool debug = 0 |
| uint64_t scheduler_tick |
| AA64Thread* sleep_thr_head |
| AA64Thread* sleep_thr_last |
| uint64_t stack_index |
| uint64_t thread_id |
| AA64Thread* thread_list_head |
| AA64Thread* thread_list_last |
| AA64Thread* trash_thr_head |
| AA64Thread* trash_thr_last |