1 use core::{
2     ptr::null_mut,
3     sync::atomic::{compiler_fence, Ordering},
4 };
5 
6 use crate::{
7     arch::asm::current::current_pcb,
8     kdebug,
9     mm::{
10         set_INITIAL_PROCESS_ADDRESS_SPACE, ucontext::AddressSpace, INITIAL_PROCESS_ADDRESS_SPACE,
11     },
12 };
13 
14 pub mod abi;
15 pub mod c_adapter;
16 pub mod exec;
17 pub mod fork;
18 pub mod initial_proc;
19 pub mod pid;
20 pub mod preempt;
21 pub mod process;
22 pub mod syscall;
23 
process_init()24 pub fn process_init() {
25     unsafe {
26         compiler_fence(Ordering::SeqCst);
27         current_pcb().address_space = null_mut();
28         kdebug!("To create address space for INIT process.");
29         // test_buddy();
30         set_INITIAL_PROCESS_ADDRESS_SPACE(
31             AddressSpace::new(true).expect("Failed to create address space for INIT process."),
32         );
33         kdebug!("INIT process address space created.");
34         compiler_fence(Ordering::SeqCst);
35         current_pcb().set_address_space(INITIAL_PROCESS_ADDRESS_SPACE());
36         compiler_fence(Ordering::SeqCst);
37     };
38 }
39