Files
DragonOS/kernel/src/process/c_adapter.rs
LoGin 7ae679ddd6 ahci内存越界问题修复+ mm的bug修复+在rust中解析acpi table (#384)
* bugfix: 修复了Flusher Drop的时候没有自动刷新TLB的bug

* 解决进程管理未初始化时,trap.c尝试打印pid导致错误的问题

* 设置kmalloc默认强制清0

* 修复ahci驱动的内存越界问题
* 修复mmio buddy忘记归还buddy block的问题
* 新增acpi模块,暂时能解析acpi tables
2023-09-17 15:41:01 +08:00

66 lines
1.6 KiB
Rust
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

use crate::smp::core::smp_get_processor_id;
use super::{kthread::kthread_init, process_init, ProcessManager, __PROCESS_MANAGEMENT_INIT_DONE};
#[no_mangle]
pub extern "C" fn rs_process_init() {
process_init();
}
#[no_mangle]
pub extern "C" fn rs_kthread_init() {
kthread_init();
}
/// 临时用于获取空闲进程的栈顶的函数这个函数是为了旧的smp模块的初始化而写在这的
#[no_mangle]
pub extern "C" fn rs_get_idle_stack_top(cpu_id: u32) -> usize {
return ProcessManager::idle_pcb()[cpu_id as usize]
.kernel_stack()
.stack_max_address()
.data();
}
#[no_mangle]
pub extern "C" fn rs_current_pcb_cpuid() -> u32 {
return smp_get_processor_id();
}
#[no_mangle]
pub extern "C" fn rs_current_pcb_pid() -> u32 {
if unsafe { __PROCESS_MANAGEMENT_INIT_DONE } {
return ProcessManager::current_pcb().pid().0 as u32;
}
return 0;
}
#[no_mangle]
pub extern "C" fn rs_current_pcb_preempt_count() -> u32 {
return ProcessManager::current_pcb().preempt_count() as u32;
}
#[no_mangle]
pub extern "C" fn rs_current_pcb_flags() -> u32 {
return ProcessManager::current_pcb().flags().bits() as u32;
}
#[no_mangle]
pub extern "C" fn rs_current_pcb_thread_rbp() -> u64 {
return ProcessManager::current_pcb().arch_info_irqsave().rbp() as u64;
}
#[no_mangle]
pub extern "C" fn rs_preempt_disable() {
return ProcessManager::preempt_disable();
}
#[no_mangle]
pub extern "C" fn rs_preempt_enable() {
return ProcessManager::preempt_enable();
}
#[no_mangle]
pub extern "C" fn rs_process_do_exit(exit_code: usize) -> usize {
ProcessManager::exit(exit_code);
}