From 3129b5edcca464c5f6fa045cb0eb4667a33a8293 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Hord=C3=A9?= Date: Wed, 5 Dec 2018 14:00:43 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20passage=20de=20Frame-omit-pointer=20?= =?UTF-8?q?=C3=A0=20Stack=20Frame=20avec=20EBP,=20corrections=20multiple?= =?UTF-8?q?=20:=20exceptions=20ok=20et=20deboguage=20op=C3=A9rationnel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/asm.h | 68 +--------- include/interrupts.h | 120 +++++++++++++++++- lib/cpu.c | 16 +-- lib/interrupts.c | 295 +++++++++++++++++++++++++------------------ lib/keyboard.c | 2 +- lib/mouse.c | 4 +- lib/timer.c | 2 +- 7 files changed, 303 insertions(+), 204 deletions(-) diff --git a/include/asm.h b/include/asm.h index 6470fc5..d65526f 100755 --- a/include/asm.h +++ b/include/asm.h @@ -20,74 +20,10 @@ #define popf() asm("popf"::) -#define getESP() ({ \ - u32 _v; \ - asm volatile ("movl %%esp,%%eax;": "=a" (_v)); \ - _v; \ -}) - -#define dumpcpu() asm("\ - pushal \n \ - pushf \n \ - pushl %%cs\n \ - pushl $0x0\n \ - pushl %%ds\n \ - pushl %%es\n \ - pushl %%fs\n \ - pushl %%gs\n \ - pushl %%ss\n \ - pushl $0x0\n \ - mov %%cr0, %%eax \n \ - pushl %%eax\n \ - mov %%cr2, %%eax \n \ - pushl %%eax\n \ - mov %%cr3, %%eax \n \ - pushl %%eax\n \ - mov %%cr4, %%eax \n \ - pushl %%eax \n \ - mov %%dr0, %%eax \n \ - pushl %%eax\n \ - mov %%dr1, %%eax \n \ - pushl %%eax\n \ - mov %%dr2, %%eax \n \ - pushl %%eax\n \ - mov %%dr3, %%eax \n \ - pushl %%eax\n \ - mov %%dr6, %%eax \n \ - pushl %%eax\n \ - mov %%dr7, %%eax \n \ - pushl %%eax\n \ - mov $0xC0000080, %%ecx \n \ - rdmsr \n \ - pushl %%edx \n \ - pushl %%eax":::) - -#define restcpu() asm("\ - popl %%eax \n \ - popl %%eax \n \ - popl %%eax \n \ - popl %%eax \n \ - popl %%eax \n \ - popl %%eax \n \ - popl %%eax \n \ - popl %%eax \n \ - popl %%eax \n \ - popl %%eax \n \ - popl %%eax \n \ - popl %%eax \n \ - popl %%eax \n \ - popl %%ss\n \ - popl %%gs\n \ - popl %%fs\n \ - popl %%es\n \ - popl %%ds\n \ - popl %%eax \n \ - popl %%eax \n \ - popf \n \ - popal":::) - #define iret() asm("iret"::) +#define leave() asm("leave"::) + #define irqendmaster() asm("movb $0x20,%al; \ outb %al,$0x20;") diff --git a/include/interrupts.h b/include/interrupts.h index 67c1096..9734b11 100755 --- a/include/interrupts.h +++ b/include/interrupts.h @@ -46,13 +46,128 @@ #define TIMER_FREQ 1193180 /* fréquence pour timer dans un PC ou AT */ #define HZ 100 /* Fréquence d'horloge (ajutste logiciellement sur IBM-PC) */ +#define getESP(mem) ({ \ + asm volatile ("movl %%esp,%[tomem];":: [tomem] "m" (mem)); \ +}) + +#define getEBP(mem) ({ \ + asm volatile ("movl %%ebp,%[tomem];":: [tomem] "m" (mem)); \ +}) + +#define setEBP(mem) ({ \ + asm volatile ("movl %[tomem],%%ebp;":[tomem] "=m" (mem):); \ +}) + +#define setESP(mem) ({ \ + asm volatile ("movl %[tomem],%%esp;":[tomem] "=m" (mem):); \ +}) + + +#define dumpcpu() asm("\ + pushal \n \ + pushf \n \ + pushl %%cs\n \ + pushl $0x0\n \ + pushl %%ds\n \ + pushl %%es\n \ + pushl %%fs\n \ + pushl %%gs\n \ + pushl %%ss\n \ + mov %%cr0, %%eax \n \ + pushl %%eax\n \ + mov %%cr2, %%eax \n \ + pushl %%eax\n \ + mov %%cr3, %%eax \n \ + pushl %%eax\n \ + mov %%cr4, %%eax \n \ + pushl %%eax \n \ + mov %%dr0, %%eax \n \ + pushl %%eax\n \ + mov %%dr1, %%eax \n \ + pushl %%eax\n \ + mov %%dr2, %%eax \n \ + pushl %%eax\n \ + mov %%dr3, %%eax \n \ + pushl %%eax\n \ + mov %%dr6, %%eax \n \ + pushl %%eax\n \ + mov %%dr7, %%eax \n \ + pushl %%eax\n \ + mov $0xC0000080, %%ecx \n \ + rdmsr \n \ + pushl %%edx \n \ + pushl %%eax":::) + +#define restcpu() asm("\ + popl %%eax \n \ + popl %%edx \n \ + mov $0xC0000080, %%ecx \n \ + wrmsr\n \ + popl %%eax\n \ + mov %%eax,%%dr7 \n \ + popl %%eax \n \ + mov %%eax,%%dr6 \n \ + popl %%eax \n \ + mov %%eax,%%dr3 \n \ + popl %%eax \n \ + mov %%eax,%%dr2 \n \ + popl %%eax \n \ + mov %%eax,%%dr1 \n \ + popl %%eax \n \ + mov %%eax,%%dr0 \n \ + popl %%eax \n \ + mov %%eax,%%cr4 \n \ + popl %%eax \n \ + mov %%eax,%%cr3 \n \ + popl %%eax \n \ + mov %%eax,%%cr2 \n \ + popl %%eax \n \ + mov %%eax,%%cr0 \n \ + popl %%ss\n \ + popl %%gs\n \ + popl %%fs\n \ + popl %%es\n \ + popl %%ds\n \ + popl %%eax \n \ + popl %%eax \n \ + popf \n \ + popal":::) + +#define restdebugcpu() asm("\ + popl %%eax \n \ + popl %%edx \n \ + mov $0xC0000080, %%ecx \n \ + wrmsr\n \ + popl %%eax\n \ + popl %%eax \n \ + popl %%eax \n \ + popl %%eax \n \ + popl %%eax \n \ + popl %%eax \n \ + popl %%eax \n \ + mov %%eax,%%cr4 \n \ + popl %%eax \n \ + mov %%eax,%%cr3 \n \ + popl %%eax \n \ + mov %%eax,%%cr2 \n \ + popl %%eax \n \ + mov %%eax,%%cr0 \n \ + popl %%ss\n \ + popl %%gs\n \ + popl %%fs\n \ + popl %%es\n \ + popl %%ds\n \ + popl %%eax \n \ + popl %%eax \n \ + popf \n \ + popal":::) + + /* save pile */ typedef struct save_stack { u64 efer; u32 dr7; u32 dr6; - u32 dr5; - u32 dr4; u32 dr3; u32 dr2; u32 dr1; @@ -61,7 +176,6 @@ typedef struct save_stack { u32 cr3; u32 cr2; u32 cr0; - u32 oldesp; u32 ss; u32 gs; u32 fs; diff --git a/lib/cpu.c b/lib/cpu.c index 662c6c0..7ce62b5 100755 --- a/lib/cpu.c +++ b/lib/cpu.c @@ -117,7 +117,7 @@ u8 getcpuinfos(cpuinfo * proc) } boolean = &proc->mmx; i = 0; - + proc->techs[0]='\000'; for (i = 0; i < sizeof(msg); i++) if (*(boolean++) == 1) { strcat(msg[i], &proc->techs); @@ -133,7 +133,7 @@ void show_lightcpu(save_stack *stack) { u32 i; printf("\33[0mEAX=%Y EBX=%Y ECX=%Y EDX=%Y\r\n", stack->eax, stack->ebx, stack->ecx, stack->edx); - printf("ESI=%Y EDI=%Y ESP=%Y EBP=%Y\r\n", stack->esi, stack->edi, stack->oldesp, stack->ebp); + printf("ESI=%Y EDI=%Y ESP=%Y EBP=%Y\r\n", stack->esi, stack->edi, stack->esp, stack->ebp); printf("EIP=%Y EFL=%Y [%c%c%c%c%c%c%c%c%c]\r\n", stack->eip, stack->eflags, (stack->eflags & (1 <<11)) ? 'O':'-', (stack->eflags & (1 <<10)) ? 'D':'-', @@ -175,12 +175,12 @@ void show_lightcpu(save_stack *stack) } printf("\33[0m\r\n\r\n\r\nSTACK\r\n"); - if (abs(KERNEL_STACK_ADDR-stack->oldesp)>0x10000) + if (abs(KERNEL_STACK_ADDR-stack->esp)>0x10000) printf("Pile invalide !"); else { i=0; - for (u32 *pointer = stack->oldesp; pointer < KERNEL_STACK_ADDR; pointer ++) { + for (u32 *pointer = stack->esp; pointer < KERNEL_STACK_ADDR; pointer ++) { if (i>0 && i % 10 == 0) print("\033[10A"); if (i>=10) print("\033[25C"); @@ -197,7 +197,7 @@ void show_lightcpu(save_stack *stack) void show_cpu(save_stack *stack) { printf("EAX=%Y EBX=%Y ECX=%Y EDX=%Y\r\n", stack->eax, stack->ebx, stack->ecx, stack->edx); - printf("ESI=%Y EDI=%Y ESP=%Y EBP=%Y\r\n", stack->esi, stack->edi, stack->oldesp, stack->ebp); + printf("ESI=%Y EDI=%Y ESP=%Y EBP=%Y\r\n", stack->esi, stack->edi, stack->esp, stack->ebp); printf("EIP=%Y EFL=%Y [%c%c%c%c%c%c%c%c%c]\r\n", stack->eip, stack->eflags, (stack->eflags & (1 <<11)) ? 'O':'-', (stack->eflags & (1 <<10)) ? 'D':'-', @@ -225,15 +225,15 @@ void show_cpu(save_stack *stack) printf("IDT= %Y %Y\r\n",idtreg.base,idtreg.limite); printf("CR0=%Y CR2=%Y CR3=%Y CR4=%Y\r\n",stack->cr0,stack->cr2,stack->cr3,stack->cr4); printf("DR0=%Y DR1=%Y DR2=%Y DR3=%Y\r\n",stack->dr0,stack->dr1,stack->dr2,stack->dr3); - printf("DR4=%Y DR5=%Y DR6=%Y DR7=%Y\r\n",stack->dr4,stack->dr5,stack->dr6,stack->dr7); + printf("DR6=%Y DR7=%Y\r\n",stack->dr6,stack->dr7); printf("EFER=%lY\r\n",stack->efer); printf("STACK\r\n"); - if (abs(KERNEL_STACK_ADDR-stack->oldesp)>0x10000) + if (abs(KERNEL_STACK_ADDR-stack->esp)>0x10000) printf("Pile invalide !"); else { u32 i=0; - for (u32 *pointer = stack->oldesp; pointer < KERNEL_STACK_ADDR; pointer ++) { + for (u32 *pointer = stack->esp; pointer < KERNEL_STACK_ADDR; pointer ++) { if (i>0 && i % 10 == 0) print("\033[10A"); if (i>=10) print("\033[25C"); diff --git a/lib/interrupts.c b/lib/interrupts.c index 340dd30..e55e66a 100755 --- a/lib/interrupts.c +++ b/lib/interrupts.c @@ -170,34 +170,32 @@ void interruption() void exception0() { - cli(); + save_stack *dump; + exception_stack_noerror *current; + u32 *oldesp; + getEBP(oldesp); dumpcpu(); - save_stack *dump = getESP(); - exception_stack_noerror *current = getESP()+36; + getESP(dump); + current=(exception_stack *) (oldesp+1); + dump->esp=*oldesp; + dump->ebp=*((u32 *) dump->esp); dump->eip=current->eip; - dump->cs=current->cs; - dump->oldesp=(current+1); cpuerror("#DE Divide error",dump); } void exception1() { cli(); - dumpcpu(); - save_stack *dump = getESP(); + save_stack *dump; exception_stack_noerror *current; - dump->eip=getdebugreg(0); - for(u32 *addr=dump;addreip && *(addr+1)==SEL_KERNEL_CODE) - { - current = addr; - break; - } - } + u32 *oldesp; + getEBP(oldesp); + dumpcpu(); + getESP(dump); + current=(exception_stack *) (oldesp+1); + dump->esp=*oldesp; + dump->ebp=*((u32 *) dump->esp); dump->eip=current->eip; - dump->cs=current->cs; - dump->oldesp=(current+1); changevc(6); clearscreen(); show_lightcpu(dump); @@ -207,7 +205,7 @@ void exception1() cli(); if (ascii=='P' || ascii=='p') setdebugreg(0,current->eip+disasm(current->eip, NULL, false), DBG_EXEC); - if (ascii=='D' || ascii=='d') + else if (ascii=='D' || ascii=='d') setdebugreg(0,0, DBG_CLEAR); else if (ascii=='C' || ascii=='c') setdebugreg(0,0, DBG_CLEAR); @@ -218,164 +216,205 @@ void exception1() initselectors(retry_address); } changevc(0); - restcpu(); - asm("addl $0x028, %esp;popl %ebx;"); + dump->ebp=oldesp; + restdebugcpu(); + leave(); + sti(); iret(); } void exception2() { - cli(); + save_stack *dump; + exception_stack_noerror *current; + u32 *oldesp; + getEBP(oldesp); dumpcpu(); - save_stack *dump = getESP(); - exception_stack_noerror *current = getESP()+36; + getESP(dump); + current=(exception_stack *) (oldesp+1); + dump->esp=*oldesp; + dump->ebp=*((u32 *) dump->esp); dump->eip=current->eip; - dump->cs=current->cs; - dump->oldesp=(current+1); cpuerror("NMI Non-maskable hardware interrupt",dump); } void exception3() { - cli(); + save_stack *dump; + exception_stack_noerror *current; + u32 *oldesp; + getEBP(oldesp); dumpcpu(); - save_stack *dump = getESP(); - exception_stack_noerror *current = getESP()+36; + getESP(dump); + current=(exception_stack *) (oldesp+1); + dump->esp=*oldesp; + dump->ebp=*((u32 *) dump->esp); dump->eip=current->eip; - dump->cs=current->cs; - dump->oldesp=(current+1); cpuerror("#BP INT3 instruction",dump); } void exception4() { - cli(); + save_stack *dump; + exception_stack_noerror *current; + u32 *oldesp; + getEBP(oldesp); dumpcpu(); - save_stack *dump = getESP(); - exception_stack_noerror *current = getESP()+36; + getESP(dump); + current=(exception_stack *) (oldesp+1); + dump->esp=*oldesp; + dump->ebp=*((u32 *) dump->esp); dump->eip=current->eip; - dump->cs=current->cs; - dump->oldesp=(current+1); cpuerror("#OF INTO instruction detected overflow",dump); } void exception5() { - cli(); + save_stack *dump; + exception_stack_noerror *current; + u32 *oldesp; + getEBP(oldesp); dumpcpu(); - save_stack *dump = getESP(); - exception_stack_noerror *current = getESP()+36; + getESP(dump); + current=(exception_stack *) (oldesp+1); + dump->esp=*oldesp; + dump->ebp=*((u32 *) dump->esp); dump->eip=current->eip; - dump->cs=current->cs; - dump->oldesp=(current+1); cpuerror("#BR BOUND instruction detected overrange",dump); } void exception6() { - cli(); + save_stack *dump; + exception_stack_noerror *current; + u32 *oldesp; + getEBP(oldesp); dumpcpu(); - save_stack *dump = getESP(); - exception_stack_noerror *current = getESP()+36; + getESP(dump); + current=(exception_stack *) (oldesp+1); + dump->esp=*oldesp; + dump->ebp=*((u32 *) dump->esp); dump->eip=current->eip; - dump->cs=current->cs; - dump->oldesp=(current+1); cpuerror("#UD Invalid instruction opcode",dump); } void exception7() { - cli(); + save_stack *dump; + exception_stack_noerror *current; + u32 *oldesp; + getEBP(oldesp); dumpcpu(); - save_stack *dump = getESP(); - exception_stack_noerror *current = getESP()+36; + getESP(dump); + current=(exception_stack *) (oldesp+1); + dump->esp=*oldesp; + dump->ebp=*((u32 *) dump->esp); dump->eip=current->eip; - dump->cs=current->cs; - dump->oldesp=(current+1); cpuerror("#NM No coprocessor",dump); } void exception8() { - cli(); + save_stack *dump; + exception_stack_noerror *current; + u32 *oldesp; + getEBP(oldesp); dumpcpu(); - save_stack *dump = getESP(); - exception_stack_noerror *current = getESP()+36; + getESP(dump); + current=(exception_stack *) (oldesp+1); + dump->esp=*oldesp; + dump->ebp=*((u32 *) dump->esp); dump->eip=current->eip; - dump->cs=current->cs; - dump->oldesp=(current+1); cpuerror("#DF Double fault",dump); } void exception9() { - cli(); + save_stack *dump; + exception_stack_noerror *current; + u32 *oldesp; + getEBP(oldesp); dumpcpu(); - save_stack *dump = getESP(); - exception_stack_noerror *current = getESP()+36; + getESP(dump); + current=(exception_stack *) (oldesp+1); + dump->esp=*oldesp; + dump->ebp=*((u32 *) dump->esp); dump->eip=current->eip; - dump->cs=current->cs; - dump->oldesp=(current+1); cpuerror("Coprocessor segment overrun",dump); } void exception10() { - cli(); + save_stack *dump; + exception_stack_noerror *current; + u32 *oldesp; + getEBP(oldesp); dumpcpu(); - save_stack *dump = getESP(); - exception_stack_noerror *current = getESP()+36; + getESP(dump); + current=(exception_stack *) (oldesp+1); + dump->esp=*oldesp; + dump->ebp=*((u32 *) dump->esp); dump->eip=current->eip; - dump->cs=current->cs; - dump->oldesp=(current+1); cpuerror("#TS Invalid task state segment (TSS)",dump); } void exception11() { - cli(); + save_stack *dump; + exception_stack *current; + u32 *oldesp; + getEBP(oldesp); dumpcpu(); - save_stack *dump = getESP(); - exception_stack_noerror *current = getESP()+36; + getESP(dump); + current=(exception_stack *) (oldesp+1); + dump->esp=*oldesp; + dump->ebp=*((u32 *) dump->esp); dump->eip=current->eip; - dump->cs=current->cs; - dump->oldesp=(current+1); cpuerror("#NP Segment not present",dump); } void exception12() { - cli(); + save_stack *dump; + exception_stack_noerror *current; + u32 *oldesp; + getEBP(oldesp); dumpcpu(); - save_stack *dump = getESP(); - exception_stack_noerror *current = getESP()+36; + getESP(dump); + current=(exception_stack *) (oldesp+1); + dump->esp=*oldesp; + dump->ebp=*((u32 *) dump->esp); dump->eip=current->eip; - dump->cs=current->cs; - dump->oldesp=(current+1); cpuerror("#SS Stack fault",dump); } void exception13() { - cli(); + save_stack *dump; + exception_stack *current; + u32 *oldesp; + getEBP(oldesp); dumpcpu(); - save_stack *dump = getESP(); - exception_stack_noerror *current = getESP()+36; + getESP(dump); + current=(exception_stack *) (oldesp+1); + dump->esp=*oldesp; + dump->ebp=*((u32 *) dump->esp); dump->eip=current->eip; - dump->cs=current->cs; - dump->oldesp=(current+1); cpuerror("#GP General protection fault (GPF)",dump); } void exception14() { - cli(); + save_stack *dump; + exception_stack *current; + u32 *oldesp; + getEBP(oldesp); dumpcpu(); - save_stack *dump = getESP(); - exception_stack *current = getESP()+sizeof(save_stack)+100; + getESP(dump); + current=(exception_stack *) (oldesp+1); + dump->esp=*oldesp; + dump->ebp=*((u32 *) dump->esp); dump->eip=current->eip; - dump->cs=current->cs; - dump->oldesp=(current+1); u8* errorstring; u8 completeerrorstring[255]; switch (current->error_code & 0xF) { @@ -411,49 +450,61 @@ void exception14() void exception15() { - cli(); + save_stack *dump; + exception_stack_noerror *current; + u32 *oldesp; + getEBP(oldesp); dumpcpu(); - save_stack *dump = getESP(); - exception_stack_noerror *current = getESP()+36; + getESP(dump); + current=(exception_stack *) (oldesp+1); + dump->esp=*oldesp; + dump->ebp=*((u32 *) dump->esp); dump->eip=current->eip; - dump->cs=current->cs; - dump->oldesp=(current+1); cpuerror("(reserved)",dump); } void exception16() { - cli(); + save_stack *dump; + exception_stack_noerror *current; + u32 *oldesp; + getEBP(oldesp); dumpcpu(); - save_stack *dump = getESP(); - exception_stack_noerror *current = getESP()+36; + getESP(dump); + current=(exception_stack *) (oldesp+1); + dump->esp=*oldesp; + dump->ebp=*((u32 *) dump->esp); dump->eip=current->eip; - dump->cs=current->cs; - dump->oldesp=(current+1); cpuerror("#MF Coprocessor error",dump); } void exception17() { - cli(); + save_stack *dump; + exception_stack_noerror *current; + u32 *oldesp; + getEBP(oldesp); dumpcpu(); - save_stack *dump = getESP(); - exception_stack_noerror *current = getESP()+36; + getESP(dump); + current=(exception_stack *) (oldesp+1); + dump->esp=*oldesp; + dump->ebp=*((u32 *) dump->esp); dump->eip=current->eip; - dump->cs=current->cs; - dump->oldesp=(current+1); cpuerror("#AC Alignment check",dump); } void exception18() { - cli(); + save_stack *dump; + exception_stack_noerror *current; + u32 *oldesp; + getEBP(oldesp); dumpcpu(); - save_stack *dump = getESP(); - exception_stack_noerror *current = getESP()+36; + getESP(dump); + current=(exception_stack *) (oldesp+1); + dump->esp=*oldesp; + dump->ebp=*((u32 *) dump->esp); dump->eip=current->eip; - dump->cs=current->cs; - dump->oldesp=(current+1); cpuerror("#MC Machine check",dump); } @@ -470,7 +521,7 @@ void irq0() popad(); popf(); sti(); - asm("addl $0x0C, %esp;"); + leave(); iret(); } @@ -486,7 +537,7 @@ void irq1() popad(); popf(); sti(); - asm("addl $0x01C, %esp;"); + leave(); iret(); } @@ -500,7 +551,7 @@ void irq2() popad(); popf(); sti(); - asm("addl $0x0C, %esp;"); + leave(); iret(); } @@ -514,7 +565,7 @@ void irq3() popad(); popf(); sti(); - asm("addl $0x0C, %esp;"); + leave(); iret(); } @@ -528,7 +579,7 @@ void irq4() popad(); popf(); sti(); - asm("addl $0x0C, %esp;"); + leave(); iret(); } @@ -542,7 +593,7 @@ void irq5() popad(); popf(); sti(); - asm("addl $0x0C, %esp;"); + leave(); iret(); } @@ -556,7 +607,7 @@ void irq6() popad(); popf(); sti(); - asm("addl $0x0C, %esp;"); + leave(); iret(); } @@ -570,7 +621,7 @@ void irq7() popad(); popf(); sti(); - asm("addl $0x0C, %esp;"); + leave(); iret(); } @@ -585,7 +636,7 @@ void irq8() popad(); popf(); sti(); - asm("addl $0x0C, %esp;"); + leave(); iret(); } @@ -600,7 +651,7 @@ void irq9() popad(); popf(); sti(); - asm("addl $0x0C, %esp;"); + leave(); iret(); } @@ -615,7 +666,7 @@ void irq10() popad(); popf(); sti(); - asm("addl $0x0C, %esp;"); + leave(); iret(); } @@ -630,7 +681,7 @@ void irq11() popad(); popf(); sti(); - asm("addl $0x0C, %esp;"); + leave(); iret(); } @@ -647,7 +698,7 @@ void irq12() popad(); popf(); sti(); - asm("addl $0x1C, %esp;"); + leave(); iret(); } @@ -662,7 +713,7 @@ void irq13() popad(); popf(); sti(); - asm("addl $0x0C, %esp;"); + leave(); iret(); } @@ -677,7 +728,7 @@ void irq14() popad(); popf(); sti(); - asm("addl $0x0C, %esp;"); + leave(); iret(); } @@ -690,7 +741,7 @@ void irq15() popad(); popf(); sti(); - asm("addl $0x0C, %esp;"); + leave(); iret(); } diff --git a/lib/keyboard.c b/lib/keyboard.c index 4713ed8..a9ccaef 100755 --- a/lib/keyboard.c +++ b/lib/keyboard.c @@ -342,7 +342,7 @@ void keyboard(void) popad(); popf(); sti(); - asm("addl $0x01C, %esp;"); + leave(); iret(); } diff --git a/lib/mouse.c b/lib/mouse.c index 269e21b..3f0fd13 100755 --- a/lib/mouse.c +++ b/lib/mouse.c @@ -133,9 +133,7 @@ void mouse(void) popad(); popf(); sti(); - asm("addl $0x18,%esp;\ -popl %bx;\ -iret;"); + leave(); iret(); } diff --git a/lib/timer.c b/lib/timer.c index 4296924..262e2da 100755 --- a/lib/timer.c +++ b/lib/timer.c @@ -37,7 +37,7 @@ void timer(void) popad(); popf(); sti(); - asm("addl $0x0C, %esp;"); + leave(); iret(); }