Merge remote-tracking branch 'origin/aarch64-rebase' into riscv64
This commit is contained in:
+12
-3
@@ -8,6 +8,7 @@ use spin::RwLock;
|
||||
|
||||
use crate::context::signal::signal_handler;
|
||||
use crate::context::{arch, contexts, Context, Status, CONTEXT_ID};
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
use crate::gdt;
|
||||
use crate::interrupt::irq::PIT_TICKS;
|
||||
use crate::interrupt;
|
||||
@@ -165,10 +166,18 @@ pub unsafe fn switch() -> bool {
|
||||
|
||||
from_context_guard.running = false;
|
||||
to_context.running = true;
|
||||
if let Some(ref stack) = to_context.kstack {
|
||||
gdt::set_tss_stack(stack.as_ptr() as usize + stack.len());
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
{
|
||||
if let Some(ref stack) = to_context.kstack {
|
||||
gdt::set_tss_stack(stack.as_ptr() as usize + stack.len());
|
||||
}
|
||||
gdt::set_tcb(to_context.id.into());
|
||||
}
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
{
|
||||
let pid = to_context.id.into();
|
||||
to_context.arch.set_tcb(pid);
|
||||
}
|
||||
gdt::set_tcb(to_context.id.into());
|
||||
CONTEXT_ID.store(to_context.id, Ordering::SeqCst);
|
||||
|
||||
if let Some(sig) = to_sig {
|
||||
|
||||
Reference in New Issue
Block a user