fix: passage de Frame-omit-pointer à Stack Frame avec EBP, corrections multiple : exceptions ok et deboguage opérationnel
This commit is contained in:
parent
9041832823
commit
3129b5edcc
|
@ -20,74 +20,10 @@
|
||||||
|
|
||||||
#define popf() asm("popf"::)
|
#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 iret() asm("iret"::)
|
||||||
|
|
||||||
|
#define leave() asm("leave"::)
|
||||||
|
|
||||||
#define irqendmaster() asm("movb $0x20,%al; \
|
#define irqendmaster() asm("movb $0x20,%al; \
|
||||||
outb %al,$0x20;")
|
outb %al,$0x20;")
|
||||||
|
|
||||||
|
|
|
@ -46,13 +46,128 @@
|
||||||
#define TIMER_FREQ 1193180 /* fréquence pour timer dans un PC ou AT */
|
#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 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 */
|
/* save pile */
|
||||||
typedef struct save_stack {
|
typedef struct save_stack {
|
||||||
u64 efer;
|
u64 efer;
|
||||||
u32 dr7;
|
u32 dr7;
|
||||||
u32 dr6;
|
u32 dr6;
|
||||||
u32 dr5;
|
|
||||||
u32 dr4;
|
|
||||||
u32 dr3;
|
u32 dr3;
|
||||||
u32 dr2;
|
u32 dr2;
|
||||||
u32 dr1;
|
u32 dr1;
|
||||||
|
@ -61,7 +176,6 @@ typedef struct save_stack {
|
||||||
u32 cr3;
|
u32 cr3;
|
||||||
u32 cr2;
|
u32 cr2;
|
||||||
u32 cr0;
|
u32 cr0;
|
||||||
u32 oldesp;
|
|
||||||
u32 ss;
|
u32 ss;
|
||||||
u32 gs;
|
u32 gs;
|
||||||
u32 fs;
|
u32 fs;
|
||||||
|
|
16
lib/cpu.c
16
lib/cpu.c
|
@ -117,7 +117,7 @@ u8 getcpuinfos(cpuinfo * proc)
|
||||||
}
|
}
|
||||||
boolean = &proc->mmx;
|
boolean = &proc->mmx;
|
||||||
i = 0;
|
i = 0;
|
||||||
|
proc->techs[0]='\000';
|
||||||
for (i = 0; i < sizeof(msg); i++)
|
for (i = 0; i < sizeof(msg); i++)
|
||||||
if (*(boolean++) == 1) {
|
if (*(boolean++) == 1) {
|
||||||
strcat(msg[i], &proc->techs);
|
strcat(msg[i], &proc->techs);
|
||||||
|
@ -133,7 +133,7 @@ void show_lightcpu(save_stack *stack)
|
||||||
{
|
{
|
||||||
u32 i;
|
u32 i;
|
||||||
printf("\33[0mEAX=%Y EBX=%Y ECX=%Y EDX=%Y\r\n", stack->eax, stack->ebx, stack->ecx, stack->edx);
|
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,
|
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 <<11)) ? 'O':'-',
|
||||||
(stack->eflags & (1 <<10)) ? 'D':'-',
|
(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");
|
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 !");
|
printf("Pile invalide !");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
i=0;
|
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>0 && i % 10 == 0) print("\033[10A");
|
||||||
if (i>=10)
|
if (i>=10)
|
||||||
print("\033[25C");
|
print("\033[25C");
|
||||||
|
@ -197,7 +197,7 @@ void show_lightcpu(save_stack *stack)
|
||||||
void show_cpu(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("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,
|
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 <<11)) ? 'O':'-',
|
||||||
(stack->eflags & (1 <<10)) ? 'D':'-',
|
(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("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("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("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("EFER=%lY\r\n",stack->efer);
|
||||||
printf("STACK\r\n");
|
printf("STACK\r\n");
|
||||||
if (abs(KERNEL_STACK_ADDR-stack->oldesp)>0x10000)
|
if (abs(KERNEL_STACK_ADDR-stack->esp)>0x10000)
|
||||||
printf("Pile invalide !");
|
printf("Pile invalide !");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
u32 i=0;
|
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>0 && i % 10 == 0) print("\033[10A");
|
||||||
if (i>=10)
|
if (i>=10)
|
||||||
print("\033[25C");
|
print("\033[25C");
|
||||||
|
|
295
lib/interrupts.c
295
lib/interrupts.c
|
@ -170,34 +170,32 @@ void interruption()
|
||||||
|
|
||||||
void exception0()
|
void exception0()
|
||||||
{
|
{
|
||||||
cli();
|
save_stack *dump;
|
||||||
|
exception_stack_noerror *current;
|
||||||
|
u32 *oldesp;
|
||||||
|
getEBP(oldesp);
|
||||||
dumpcpu();
|
dumpcpu();
|
||||||
save_stack *dump = getESP();
|
getESP(dump);
|
||||||
exception_stack_noerror *current = getESP()+36;
|
current=(exception_stack *) (oldesp+1);
|
||||||
|
dump->esp=*oldesp;
|
||||||
|
dump->ebp=*((u32 *) dump->esp);
|
||||||
dump->eip=current->eip;
|
dump->eip=current->eip;
|
||||||
dump->cs=current->cs;
|
|
||||||
dump->oldesp=(current+1);
|
|
||||||
cpuerror("#DE Divide error",dump);
|
cpuerror("#DE Divide error",dump);
|
||||||
}
|
}
|
||||||
|
|
||||||
void exception1()
|
void exception1()
|
||||||
{
|
{
|
||||||
cli();
|
cli();
|
||||||
dumpcpu();
|
save_stack *dump;
|
||||||
save_stack *dump = getESP();
|
|
||||||
exception_stack_noerror *current;
|
exception_stack_noerror *current;
|
||||||
dump->eip=getdebugreg(0);
|
u32 *oldesp;
|
||||||
for(u32 *addr=dump;addr<KERNEL_STACK_ADDR;addr++)
|
getEBP(oldesp);
|
||||||
{
|
dumpcpu();
|
||||||
if (*addr==dump->eip && *(addr+1)==SEL_KERNEL_CODE)
|
getESP(dump);
|
||||||
{
|
current=(exception_stack *) (oldesp+1);
|
||||||
current = addr;
|
dump->esp=*oldesp;
|
||||||
break;
|
dump->ebp=*((u32 *) dump->esp);
|
||||||
}
|
|
||||||
}
|
|
||||||
dump->eip=current->eip;
|
dump->eip=current->eip;
|
||||||
dump->cs=current->cs;
|
|
||||||
dump->oldesp=(current+1);
|
|
||||||
changevc(6);
|
changevc(6);
|
||||||
clearscreen();
|
clearscreen();
|
||||||
show_lightcpu(dump);
|
show_lightcpu(dump);
|
||||||
|
@ -207,7 +205,7 @@ void exception1()
|
||||||
cli();
|
cli();
|
||||||
if (ascii=='P' || ascii=='p')
|
if (ascii=='P' || ascii=='p')
|
||||||
setdebugreg(0,current->eip+disasm(current->eip, NULL, false), DBG_EXEC);
|
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);
|
setdebugreg(0,0, DBG_CLEAR);
|
||||||
else if (ascii=='C' || ascii=='c')
|
else if (ascii=='C' || ascii=='c')
|
||||||
setdebugreg(0,0, DBG_CLEAR);
|
setdebugreg(0,0, DBG_CLEAR);
|
||||||
|
@ -218,164 +216,205 @@ void exception1()
|
||||||
initselectors(retry_address);
|
initselectors(retry_address);
|
||||||
}
|
}
|
||||||
changevc(0);
|
changevc(0);
|
||||||
restcpu();
|
dump->ebp=oldesp;
|
||||||
asm("addl $0x028, %esp;popl %ebx;");
|
restdebugcpu();
|
||||||
|
leave();
|
||||||
|
sti();
|
||||||
iret();
|
iret();
|
||||||
}
|
}
|
||||||
|
|
||||||
void exception2()
|
void exception2()
|
||||||
{
|
{
|
||||||
cli();
|
save_stack *dump;
|
||||||
|
exception_stack_noerror *current;
|
||||||
|
u32 *oldesp;
|
||||||
|
getEBP(oldesp);
|
||||||
dumpcpu();
|
dumpcpu();
|
||||||
save_stack *dump = getESP();
|
getESP(dump);
|
||||||
exception_stack_noerror *current = getESP()+36;
|
current=(exception_stack *) (oldesp+1);
|
||||||
|
dump->esp=*oldesp;
|
||||||
|
dump->ebp=*((u32 *) dump->esp);
|
||||||
dump->eip=current->eip;
|
dump->eip=current->eip;
|
||||||
dump->cs=current->cs;
|
|
||||||
dump->oldesp=(current+1);
|
|
||||||
cpuerror("NMI Non-maskable hardware interrupt",dump);
|
cpuerror("NMI Non-maskable hardware interrupt",dump);
|
||||||
}
|
}
|
||||||
|
|
||||||
void exception3()
|
void exception3()
|
||||||
{
|
{
|
||||||
cli();
|
save_stack *dump;
|
||||||
|
exception_stack_noerror *current;
|
||||||
|
u32 *oldesp;
|
||||||
|
getEBP(oldesp);
|
||||||
dumpcpu();
|
dumpcpu();
|
||||||
save_stack *dump = getESP();
|
getESP(dump);
|
||||||
exception_stack_noerror *current = getESP()+36;
|
current=(exception_stack *) (oldesp+1);
|
||||||
|
dump->esp=*oldesp;
|
||||||
|
dump->ebp=*((u32 *) dump->esp);
|
||||||
dump->eip=current->eip;
|
dump->eip=current->eip;
|
||||||
dump->cs=current->cs;
|
|
||||||
dump->oldesp=(current+1);
|
|
||||||
cpuerror("#BP INT3 instruction",dump);
|
cpuerror("#BP INT3 instruction",dump);
|
||||||
}
|
}
|
||||||
|
|
||||||
void exception4()
|
void exception4()
|
||||||
{
|
{
|
||||||
cli();
|
save_stack *dump;
|
||||||
|
exception_stack_noerror *current;
|
||||||
|
u32 *oldesp;
|
||||||
|
getEBP(oldesp);
|
||||||
dumpcpu();
|
dumpcpu();
|
||||||
save_stack *dump = getESP();
|
getESP(dump);
|
||||||
exception_stack_noerror *current = getESP()+36;
|
current=(exception_stack *) (oldesp+1);
|
||||||
|
dump->esp=*oldesp;
|
||||||
|
dump->ebp=*((u32 *) dump->esp);
|
||||||
dump->eip=current->eip;
|
dump->eip=current->eip;
|
||||||
dump->cs=current->cs;
|
|
||||||
dump->oldesp=(current+1);
|
|
||||||
cpuerror("#OF INTO instruction detected overflow",dump);
|
cpuerror("#OF INTO instruction detected overflow",dump);
|
||||||
}
|
}
|
||||||
|
|
||||||
void exception5()
|
void exception5()
|
||||||
{
|
{
|
||||||
cli();
|
save_stack *dump;
|
||||||
|
exception_stack_noerror *current;
|
||||||
|
u32 *oldesp;
|
||||||
|
getEBP(oldesp);
|
||||||
dumpcpu();
|
dumpcpu();
|
||||||
save_stack *dump = getESP();
|
getESP(dump);
|
||||||
exception_stack_noerror *current = getESP()+36;
|
current=(exception_stack *) (oldesp+1);
|
||||||
|
dump->esp=*oldesp;
|
||||||
|
dump->ebp=*((u32 *) dump->esp);
|
||||||
dump->eip=current->eip;
|
dump->eip=current->eip;
|
||||||
dump->cs=current->cs;
|
|
||||||
dump->oldesp=(current+1);
|
|
||||||
cpuerror("#BR BOUND instruction detected overrange",dump);
|
cpuerror("#BR BOUND instruction detected overrange",dump);
|
||||||
}
|
}
|
||||||
|
|
||||||
void exception6()
|
void exception6()
|
||||||
{
|
{
|
||||||
cli();
|
save_stack *dump;
|
||||||
|
exception_stack_noerror *current;
|
||||||
|
u32 *oldesp;
|
||||||
|
getEBP(oldesp);
|
||||||
dumpcpu();
|
dumpcpu();
|
||||||
save_stack *dump = getESP();
|
getESP(dump);
|
||||||
exception_stack_noerror *current = getESP()+36;
|
current=(exception_stack *) (oldesp+1);
|
||||||
|
dump->esp=*oldesp;
|
||||||
|
dump->ebp=*((u32 *) dump->esp);
|
||||||
dump->eip=current->eip;
|
dump->eip=current->eip;
|
||||||
dump->cs=current->cs;
|
|
||||||
dump->oldesp=(current+1);
|
|
||||||
cpuerror("#UD Invalid instruction opcode",dump);
|
cpuerror("#UD Invalid instruction opcode",dump);
|
||||||
}
|
}
|
||||||
|
|
||||||
void exception7()
|
void exception7()
|
||||||
{
|
{
|
||||||
cli();
|
save_stack *dump;
|
||||||
|
exception_stack_noerror *current;
|
||||||
|
u32 *oldesp;
|
||||||
|
getEBP(oldesp);
|
||||||
dumpcpu();
|
dumpcpu();
|
||||||
save_stack *dump = getESP();
|
getESP(dump);
|
||||||
exception_stack_noerror *current = getESP()+36;
|
current=(exception_stack *) (oldesp+1);
|
||||||
|
dump->esp=*oldesp;
|
||||||
|
dump->ebp=*((u32 *) dump->esp);
|
||||||
dump->eip=current->eip;
|
dump->eip=current->eip;
|
||||||
dump->cs=current->cs;
|
|
||||||
dump->oldesp=(current+1);
|
|
||||||
cpuerror("#NM No coprocessor",dump);
|
cpuerror("#NM No coprocessor",dump);
|
||||||
}
|
}
|
||||||
|
|
||||||
void exception8()
|
void exception8()
|
||||||
{
|
{
|
||||||
cli();
|
save_stack *dump;
|
||||||
|
exception_stack_noerror *current;
|
||||||
|
u32 *oldesp;
|
||||||
|
getEBP(oldesp);
|
||||||
dumpcpu();
|
dumpcpu();
|
||||||
save_stack *dump = getESP();
|
getESP(dump);
|
||||||
exception_stack_noerror *current = getESP()+36;
|
current=(exception_stack *) (oldesp+1);
|
||||||
|
dump->esp=*oldesp;
|
||||||
|
dump->ebp=*((u32 *) dump->esp);
|
||||||
dump->eip=current->eip;
|
dump->eip=current->eip;
|
||||||
dump->cs=current->cs;
|
|
||||||
dump->oldesp=(current+1);
|
|
||||||
cpuerror("#DF Double fault",dump);
|
cpuerror("#DF Double fault",dump);
|
||||||
}
|
}
|
||||||
|
|
||||||
void exception9()
|
void exception9()
|
||||||
{
|
{
|
||||||
cli();
|
save_stack *dump;
|
||||||
|
exception_stack_noerror *current;
|
||||||
|
u32 *oldesp;
|
||||||
|
getEBP(oldesp);
|
||||||
dumpcpu();
|
dumpcpu();
|
||||||
save_stack *dump = getESP();
|
getESP(dump);
|
||||||
exception_stack_noerror *current = getESP()+36;
|
current=(exception_stack *) (oldesp+1);
|
||||||
|
dump->esp=*oldesp;
|
||||||
|
dump->ebp=*((u32 *) dump->esp);
|
||||||
dump->eip=current->eip;
|
dump->eip=current->eip;
|
||||||
dump->cs=current->cs;
|
|
||||||
dump->oldesp=(current+1);
|
|
||||||
cpuerror("Coprocessor segment overrun",dump);
|
cpuerror("Coprocessor segment overrun",dump);
|
||||||
}
|
}
|
||||||
|
|
||||||
void exception10()
|
void exception10()
|
||||||
{
|
{
|
||||||
cli();
|
save_stack *dump;
|
||||||
|
exception_stack_noerror *current;
|
||||||
|
u32 *oldesp;
|
||||||
|
getEBP(oldesp);
|
||||||
dumpcpu();
|
dumpcpu();
|
||||||
save_stack *dump = getESP();
|
getESP(dump);
|
||||||
exception_stack_noerror *current = getESP()+36;
|
current=(exception_stack *) (oldesp+1);
|
||||||
|
dump->esp=*oldesp;
|
||||||
|
dump->ebp=*((u32 *) dump->esp);
|
||||||
dump->eip=current->eip;
|
dump->eip=current->eip;
|
||||||
dump->cs=current->cs;
|
|
||||||
dump->oldesp=(current+1);
|
|
||||||
cpuerror("#TS Invalid task state segment (TSS)",dump);
|
cpuerror("#TS Invalid task state segment (TSS)",dump);
|
||||||
}
|
}
|
||||||
|
|
||||||
void exception11()
|
void exception11()
|
||||||
{
|
{
|
||||||
cli();
|
save_stack *dump;
|
||||||
|
exception_stack *current;
|
||||||
|
u32 *oldesp;
|
||||||
|
getEBP(oldesp);
|
||||||
dumpcpu();
|
dumpcpu();
|
||||||
save_stack *dump = getESP();
|
getESP(dump);
|
||||||
exception_stack_noerror *current = getESP()+36;
|
current=(exception_stack *) (oldesp+1);
|
||||||
|
dump->esp=*oldesp;
|
||||||
|
dump->ebp=*((u32 *) dump->esp);
|
||||||
dump->eip=current->eip;
|
dump->eip=current->eip;
|
||||||
dump->cs=current->cs;
|
|
||||||
dump->oldesp=(current+1);
|
|
||||||
cpuerror("#NP Segment not present",dump);
|
cpuerror("#NP Segment not present",dump);
|
||||||
}
|
}
|
||||||
|
|
||||||
void exception12()
|
void exception12()
|
||||||
{
|
{
|
||||||
cli();
|
save_stack *dump;
|
||||||
|
exception_stack_noerror *current;
|
||||||
|
u32 *oldesp;
|
||||||
|
getEBP(oldesp);
|
||||||
dumpcpu();
|
dumpcpu();
|
||||||
save_stack *dump = getESP();
|
getESP(dump);
|
||||||
exception_stack_noerror *current = getESP()+36;
|
current=(exception_stack *) (oldesp+1);
|
||||||
|
dump->esp=*oldesp;
|
||||||
|
dump->ebp=*((u32 *) dump->esp);
|
||||||
dump->eip=current->eip;
|
dump->eip=current->eip;
|
||||||
dump->cs=current->cs;
|
|
||||||
dump->oldesp=(current+1);
|
|
||||||
cpuerror("#SS Stack fault",dump);
|
cpuerror("#SS Stack fault",dump);
|
||||||
}
|
}
|
||||||
|
|
||||||
void exception13()
|
void exception13()
|
||||||
{
|
{
|
||||||
cli();
|
save_stack *dump;
|
||||||
|
exception_stack *current;
|
||||||
|
u32 *oldesp;
|
||||||
|
getEBP(oldesp);
|
||||||
dumpcpu();
|
dumpcpu();
|
||||||
save_stack *dump = getESP();
|
getESP(dump);
|
||||||
exception_stack_noerror *current = getESP()+36;
|
current=(exception_stack *) (oldesp+1);
|
||||||
|
dump->esp=*oldesp;
|
||||||
|
dump->ebp=*((u32 *) dump->esp);
|
||||||
dump->eip=current->eip;
|
dump->eip=current->eip;
|
||||||
dump->cs=current->cs;
|
|
||||||
dump->oldesp=(current+1);
|
|
||||||
cpuerror("#GP General protection fault (GPF)",dump);
|
cpuerror("#GP General protection fault (GPF)",dump);
|
||||||
}
|
}
|
||||||
|
|
||||||
void exception14()
|
void exception14()
|
||||||
{
|
{
|
||||||
cli();
|
save_stack *dump;
|
||||||
|
exception_stack *current;
|
||||||
|
u32 *oldesp;
|
||||||
|
getEBP(oldesp);
|
||||||
dumpcpu();
|
dumpcpu();
|
||||||
save_stack *dump = getESP();
|
getESP(dump);
|
||||||
exception_stack *current = getESP()+sizeof(save_stack)+100;
|
current=(exception_stack *) (oldesp+1);
|
||||||
|
dump->esp=*oldesp;
|
||||||
|
dump->ebp=*((u32 *) dump->esp);
|
||||||
dump->eip=current->eip;
|
dump->eip=current->eip;
|
||||||
dump->cs=current->cs;
|
|
||||||
dump->oldesp=(current+1);
|
|
||||||
u8* errorstring;
|
u8* errorstring;
|
||||||
u8 completeerrorstring[255];
|
u8 completeerrorstring[255];
|
||||||
switch (current->error_code & 0xF) {
|
switch (current->error_code & 0xF) {
|
||||||
|
@ -411,49 +450,61 @@ void exception14()
|
||||||
|
|
||||||
void exception15()
|
void exception15()
|
||||||
{
|
{
|
||||||
cli();
|
save_stack *dump;
|
||||||
|
exception_stack_noerror *current;
|
||||||
|
u32 *oldesp;
|
||||||
|
getEBP(oldesp);
|
||||||
dumpcpu();
|
dumpcpu();
|
||||||
save_stack *dump = getESP();
|
getESP(dump);
|
||||||
exception_stack_noerror *current = getESP()+36;
|
current=(exception_stack *) (oldesp+1);
|
||||||
|
dump->esp=*oldesp;
|
||||||
|
dump->ebp=*((u32 *) dump->esp);
|
||||||
dump->eip=current->eip;
|
dump->eip=current->eip;
|
||||||
dump->cs=current->cs;
|
|
||||||
dump->oldesp=(current+1);
|
|
||||||
cpuerror("(reserved)",dump);
|
cpuerror("(reserved)",dump);
|
||||||
}
|
}
|
||||||
|
|
||||||
void exception16()
|
void exception16()
|
||||||
{
|
{
|
||||||
cli();
|
save_stack *dump;
|
||||||
|
exception_stack_noerror *current;
|
||||||
|
u32 *oldesp;
|
||||||
|
getEBP(oldesp);
|
||||||
dumpcpu();
|
dumpcpu();
|
||||||
save_stack *dump = getESP();
|
getESP(dump);
|
||||||
exception_stack_noerror *current = getESP()+36;
|
current=(exception_stack *) (oldesp+1);
|
||||||
|
dump->esp=*oldesp;
|
||||||
|
dump->ebp=*((u32 *) dump->esp);
|
||||||
dump->eip=current->eip;
|
dump->eip=current->eip;
|
||||||
dump->cs=current->cs;
|
|
||||||
dump->oldesp=(current+1);
|
|
||||||
cpuerror("#MF Coprocessor error",dump);
|
cpuerror("#MF Coprocessor error",dump);
|
||||||
}
|
}
|
||||||
|
|
||||||
void exception17()
|
void exception17()
|
||||||
{
|
{
|
||||||
cli();
|
save_stack *dump;
|
||||||
|
exception_stack_noerror *current;
|
||||||
|
u32 *oldesp;
|
||||||
|
getEBP(oldesp);
|
||||||
dumpcpu();
|
dumpcpu();
|
||||||
save_stack *dump = getESP();
|
getESP(dump);
|
||||||
exception_stack_noerror *current = getESP()+36;
|
current=(exception_stack *) (oldesp+1);
|
||||||
|
dump->esp=*oldesp;
|
||||||
|
dump->ebp=*((u32 *) dump->esp);
|
||||||
dump->eip=current->eip;
|
dump->eip=current->eip;
|
||||||
dump->cs=current->cs;
|
|
||||||
dump->oldesp=(current+1);
|
|
||||||
cpuerror("#AC Alignment check",dump);
|
cpuerror("#AC Alignment check",dump);
|
||||||
}
|
}
|
||||||
|
|
||||||
void exception18()
|
void exception18()
|
||||||
{
|
{
|
||||||
cli();
|
save_stack *dump;
|
||||||
|
exception_stack_noerror *current;
|
||||||
|
u32 *oldesp;
|
||||||
|
getEBP(oldesp);
|
||||||
dumpcpu();
|
dumpcpu();
|
||||||
save_stack *dump = getESP();
|
getESP(dump);
|
||||||
exception_stack_noerror *current = getESP()+36;
|
current=(exception_stack *) (oldesp+1);
|
||||||
|
dump->esp=*oldesp;
|
||||||
|
dump->ebp=*((u32 *) dump->esp);
|
||||||
dump->eip=current->eip;
|
dump->eip=current->eip;
|
||||||
dump->cs=current->cs;
|
|
||||||
dump->oldesp=(current+1);
|
|
||||||
cpuerror("#MC Machine check",dump);
|
cpuerror("#MC Machine check",dump);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -470,7 +521,7 @@ void irq0()
|
||||||
popad();
|
popad();
|
||||||
popf();
|
popf();
|
||||||
sti();
|
sti();
|
||||||
asm("addl $0x0C, %esp;");
|
leave();
|
||||||
iret();
|
iret();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -486,7 +537,7 @@ void irq1()
|
||||||
popad();
|
popad();
|
||||||
popf();
|
popf();
|
||||||
sti();
|
sti();
|
||||||
asm("addl $0x01C, %esp;");
|
leave();
|
||||||
iret();
|
iret();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -500,7 +551,7 @@ void irq2()
|
||||||
popad();
|
popad();
|
||||||
popf();
|
popf();
|
||||||
sti();
|
sti();
|
||||||
asm("addl $0x0C, %esp;");
|
leave();
|
||||||
iret();
|
iret();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -514,7 +565,7 @@ void irq3()
|
||||||
popad();
|
popad();
|
||||||
popf();
|
popf();
|
||||||
sti();
|
sti();
|
||||||
asm("addl $0x0C, %esp;");
|
leave();
|
||||||
iret();
|
iret();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -528,7 +579,7 @@ void irq4()
|
||||||
popad();
|
popad();
|
||||||
popf();
|
popf();
|
||||||
sti();
|
sti();
|
||||||
asm("addl $0x0C, %esp;");
|
leave();
|
||||||
iret();
|
iret();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -542,7 +593,7 @@ void irq5()
|
||||||
popad();
|
popad();
|
||||||
popf();
|
popf();
|
||||||
sti();
|
sti();
|
||||||
asm("addl $0x0C, %esp;");
|
leave();
|
||||||
iret();
|
iret();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -556,7 +607,7 @@ void irq6()
|
||||||
popad();
|
popad();
|
||||||
popf();
|
popf();
|
||||||
sti();
|
sti();
|
||||||
asm("addl $0x0C, %esp;");
|
leave();
|
||||||
iret();
|
iret();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -570,7 +621,7 @@ void irq7()
|
||||||
popad();
|
popad();
|
||||||
popf();
|
popf();
|
||||||
sti();
|
sti();
|
||||||
asm("addl $0x0C, %esp;");
|
leave();
|
||||||
iret();
|
iret();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -585,7 +636,7 @@ void irq8()
|
||||||
popad();
|
popad();
|
||||||
popf();
|
popf();
|
||||||
sti();
|
sti();
|
||||||
asm("addl $0x0C, %esp;");
|
leave();
|
||||||
iret();
|
iret();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -600,7 +651,7 @@ void irq9()
|
||||||
popad();
|
popad();
|
||||||
popf();
|
popf();
|
||||||
sti();
|
sti();
|
||||||
asm("addl $0x0C, %esp;");
|
leave();
|
||||||
iret();
|
iret();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -615,7 +666,7 @@ void irq10()
|
||||||
popad();
|
popad();
|
||||||
popf();
|
popf();
|
||||||
sti();
|
sti();
|
||||||
asm("addl $0x0C, %esp;");
|
leave();
|
||||||
iret();
|
iret();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -630,7 +681,7 @@ void irq11()
|
||||||
popad();
|
popad();
|
||||||
popf();
|
popf();
|
||||||
sti();
|
sti();
|
||||||
asm("addl $0x0C, %esp;");
|
leave();
|
||||||
iret();
|
iret();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -647,7 +698,7 @@ void irq12()
|
||||||
popad();
|
popad();
|
||||||
popf();
|
popf();
|
||||||
sti();
|
sti();
|
||||||
asm("addl $0x1C, %esp;");
|
leave();
|
||||||
iret();
|
iret();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -662,7 +713,7 @@ void irq13()
|
||||||
popad();
|
popad();
|
||||||
popf();
|
popf();
|
||||||
sti();
|
sti();
|
||||||
asm("addl $0x0C, %esp;");
|
leave();
|
||||||
iret();
|
iret();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -677,7 +728,7 @@ void irq14()
|
||||||
popad();
|
popad();
|
||||||
popf();
|
popf();
|
||||||
sti();
|
sti();
|
||||||
asm("addl $0x0C, %esp;");
|
leave();
|
||||||
iret();
|
iret();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -690,7 +741,7 @@ void irq15()
|
||||||
popad();
|
popad();
|
||||||
popf();
|
popf();
|
||||||
sti();
|
sti();
|
||||||
asm("addl $0x0C, %esp;");
|
leave();
|
||||||
iret();
|
iret();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -342,7 +342,7 @@ void keyboard(void)
|
||||||
popad();
|
popad();
|
||||||
popf();
|
popf();
|
||||||
sti();
|
sti();
|
||||||
asm("addl $0x01C, %esp;");
|
leave();
|
||||||
iret();
|
iret();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -133,9 +133,7 @@ void mouse(void)
|
||||||
popad();
|
popad();
|
||||||
popf();
|
popf();
|
||||||
sti();
|
sti();
|
||||||
asm("addl $0x18,%esp;\
|
leave();
|
||||||
popl %bx;\
|
|
||||||
iret;");
|
|
||||||
iret();
|
iret();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ void timer(void)
|
||||||
popad();
|
popad();
|
||||||
popf();
|
popf();
|
||||||
sti();
|
sti();
|
||||||
asm("addl $0x0C, %esp;");
|
leave();
|
||||||
iret();
|
iret();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue