mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 14:27:49 +00:00
Move global_asm inline in threads module
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
.intel_syntax noprefix
|
||||
|
||||
asm_context_switch:
|
||||
pushfq
|
||||
|
||||
mov rax, rsp
|
||||
mov rsp, rdi
|
||||
|
||||
mov rdi, rax
|
||||
call add_paused_thread
|
||||
|
||||
popfq
|
||||
ret
|
||||
@@ -2,8 +2,6 @@ use alloc::collections::VecDeque;
|
||||
use x86_64::structures::paging::{FrameAllocator, Mapper, Size4KiB};
|
||||
use x86_64::VirtAddr;
|
||||
|
||||
global_asm!(include_str!("multitasking/context_switch.s"));
|
||||
|
||||
pub unsafe fn context_switch(stack_pointer: VirtAddr) {
|
||||
asm!(
|
||||
"call asm_context_switch"
|
||||
@@ -15,6 +13,24 @@ pub unsafe fn context_switch(stack_pointer: VirtAddr) {
|
||||
);
|
||||
}
|
||||
|
||||
global_asm!(
|
||||
"
|
||||
.intel_syntax noprefix
|
||||
|
||||
asm_context_switch:
|
||||
pushfq
|
||||
|
||||
mov rax, rsp
|
||||
mov rsp, rdi
|
||||
|
||||
mov rdi, rax
|
||||
call add_paused_thread
|
||||
|
||||
popfq
|
||||
ret
|
||||
"
|
||||
);
|
||||
|
||||
pub fn scheduler() {
|
||||
let next = PAUSED_THREADS.try_lock().and_then(|mut paused_threads| {
|
||||
paused_threads
|
||||
|
||||
Reference in New Issue
Block a user