signal的发送(暂时父子进程之间共享信号及相应的结构体) (#89)

* 解决由于spinlock.h中包含preempt_enable()带来的循环include问题

* new: 初步实现signal的数据结构

* new:signal相关数据结构

* fix: 解决bindings.rs报一堆警告的问题

* new: rust下的kdebug kinfo kwarn kBUG kerror宏

* 移动asm.h和cmpxchg.h

* new: signal的发送(暂时只支持父子进程共享信号及处理函数)
This commit is contained in:
login
2022-11-23 11:38:20 +08:00
committed by GitHub
parent 3d729e2069
commit 66f67c6a95
44 changed files with 1677 additions and 472 deletions

View File

@ -2,27 +2,32 @@
#![no_main] // <1>
#![feature(core_intrinsics)] // <2>
#![feature(alloc_error_handler)]
#![feature(panic_info_message)]
#[allow(non_upper_case_globals)]
#[allow(non_camel_case_types)]
#[allow(non_snake_case)]
use core::intrinsics; // <2>
use core::panic::PanicInfo;
#[macro_use]
mod arch;
#[macro_use]
mod include;
mod ipc;
#[macro_use]
mod mm;
mod include;
mod libs;
mod ipc;
mod mm;
mod process;
mod sched;
mod smp;
extern crate alloc;
use mm::allocator::KernelAllocator;
// <3>
use crate::include::bindings::bindings::{BLACK, GREEN};
use crate::{include::bindings::bindings::{process_do_exit, BLACK, GREEN}, arch::x86_64::asm::current::current_pcb};
// 声明全局的slab分配器
#[cfg_attr(not(test), global_allocator)]
@ -31,14 +36,44 @@ pub static KERNEL_ALLOCATOR: KernelAllocator = KernelAllocator {};
/// 全局的panic处理函数
#[panic_handler]
#[no_mangle]
pub fn panic(_info: &PanicInfo) -> ! {
intrinsics::abort(); // <4>
pub fn panic(info: &PanicInfo) -> ! {
kerror!("Kernel Panic Occurred.");
match info.location() {
Some(loc) => {
println!(
"Location:\n\tFile: {}\n\tLine: {}, Column: {}",
loc.file(),
loc.line(),
loc.column()
);
}
None => {
println!("No location info");
}
}
match info.message() {
Some(msg) => {
println!("Message:\n\t{}", msg);
}
None => {
println!("No panic message.");
}
}
println!("Current PCB:\n\t{:?}", current_pcb());
unsafe {
process_do_exit(u64::MAX);
};
loop {
}
}
/// 该函数用作测试在process.c的initial_kernel_thread()中调用了此函数
#[no_mangle]
pub extern "C" fn __rust_demo_func() -> i32 {
printk_color!(GREEN, BLACK, "__rust_demo_func()\n");
return 0;