@@ -63,15 +63,6 @@ static void vga_write_hex32(uint32_t value, uint8_t color) {
6363 }
6464}
6565
66- static void vga_write_hex64 (uint64_t value , uint8_t color ) {
67- static const char hex [] = "0123456789ABCDEF" ;
68- vga_write_string ("0x" , color );
69- for (int i = 15 ; i >= 0 ; -- i ) {
70- uint8_t nibble = (uint8_t )((value >> (i * 4 )) & 0xF );
71- vga_put_char ((uint8_t )hex [nibble ], color );
72- }
73- }
74-
7566static void vga_write_label_hex (const char * label , uint32_t value , uint8_t color ) {
7667 vga_write_string (label , color );
7768 vga_write_hex32 (value , color );
@@ -202,11 +193,14 @@ static registers_t* irq0_handler(registers_t* regs) {
202193 if (!previous || !next || next == previous ) {
203194 return regs ;
204195 }
196+
197+ previous -> esp = (uint32_t )regs ;
198+
205199 if (next -> page_directory ) {
206200 load_cr3 (next -> page_directory );
207201 }
208- context_switch ( previous , next , regs );
209- return regs ;
202+
203+ return ( registers_t * ) next -> esp ;
210204}
211205
212206void register_interrupt_handler (uint8_t n , isr_t handler ) {
@@ -231,10 +225,11 @@ registers_t* isr_handler(registers_t* regs) {
231225}
232226
233227registers_t * irq_handler (registers_t * regs ) {
234- if (interrupt_handlers [regs -> int_no ]) {
235- regs = interrupt_handlers [regs -> int_no ](regs );
228+ uint32_t int_no = regs -> int_no ;
229+ if (interrupt_handlers [int_no ]) {
230+ regs = interrupt_handlers [int_no ](regs );
236231 }
237- if (regs -> int_no >= 40 ) {
232+ if (int_no >= 40 ) {
238233 outb (0xA0 , 0x20 );
239234 }
240235 outb (0x20 , 0x20 );
0 commit comments