@@ -22,8 +22,9 @@ use x86_64::structures::idt::PageFaultErrorCode;
2222use self :: manager:: init_PROCESS_MANAGER;
2323
2424const STACK_BOT : u64 = 0x0000_2000_0000_0000 ;
25- const STACK_PAGES : u64 = 512 ;
26- const STACK_TOP : u64 = STACK_BOT + STACK_PAGES * 0x1000 ;
25+ const STACK_PAGES : u64 = 0x200 ;
26+ const STACK_SIZE : u64 = STACK_PAGES * crate :: memory:: PAGE_SIZE ;
27+ const STACK_START_MASK : u64 = !( STACK_SIZE - 1 ) ;
2728
2829#[ derive( Debug , Copy , Clone , Eq , PartialEq ) ]
2930pub enum ProgramStatus {
@@ -34,7 +35,7 @@ pub enum ProgramStatus {
3435 Dead ,
3536}
3637
37- #[ derive( Debug , Clone , Copy , PartialEq , Eq , PartialOrd , Ord ) ]
38+ #[ derive( Clone , Copy , PartialEq , Eq , PartialOrd , Ord ) ]
3839pub struct ProcessId ( pub u16 ) ;
3940
4041impl ProcessId {
@@ -50,6 +51,12 @@ impl core::fmt::Display for ProcessId {
5051 }
5152}
5253
54+ impl core:: fmt:: Debug for ProcessId {
55+ fn fmt ( & self , f : & mut core:: fmt:: Formatter < ' _ > ) -> core:: fmt:: Result {
56+ write ! ( f, "{}" , self . 0 )
57+ }
58+ }
59+
5360impl From < ProcessId > for u16 {
5461 fn from ( pid : ProcessId ) -> Self {
5562 pid. 0
@@ -130,13 +137,13 @@ pub fn current_pid() -> ProcessId {
130137 } )
131138}
132139
133- pub fn try_resolve_page_fault ( err_code : PageFaultErrorCode , sf : & mut InterruptStackFrame ) -> Result < ( ) , ( ) > {
140+ pub fn try_resolve_page_fault ( _err_code : PageFaultErrorCode , _sf : & mut InterruptStackFrame ) -> Result < ( ) , ( ) > {
134141 let addr = Cr2 :: read ( ) ;
135142 debug ! ( "Trying to access address: {:?}" , addr) ;
136143
137144 x86_64:: instructions:: interrupts:: without_interrupts ( || {
138145 let manager = get_process_manager_for_sure ( ) ;
139- debug ! ( "Current process: {:?}" , manager. current( ) ) ;
146+ debug ! ( "Current process: {:# ?}" , manager. current( ) ) ;
140147 } ) ;
141148
142149 Err ( ( ) )
0 commit comments