19
« am: 22. August 2009, 18:26 »
"intr_dispatcher" war nirgends zu finden, hab einfach die kernel.o gelöscht und weg war der Fehler.
Hier mal die ganze Kernel.c:
#include <stdint.h>
#include "hInit.h"
typedef struct {
uint16_t offset_low;
uint16_t selector;
uint8_t zero;
uint8_t attribute;
uint16_t offset_high;
}id_table;
id_table IDT[256];
int begin() {
//idt_set_gate(0x16, (unsigned), 0x08, IDT_STD_GATE);
v_clear();
v_print("$3-=Xype=-", 0);
v_print("$2Willkommen!", 2);
i_getKey();
v_print(str_replace("Eingabe", "ga", ""), 3);
while(1);
}
extern void intr1();
extern void intr2();
extern void intr3();
extern void intr4();
extern void intr5();
extern void intr6();
extern void intr7();
extern void intr8();
extern void intr9();
extern void intr10();
extern void intr11();
extern void intr12();
extern void intr13();
extern void intr14();
extern void intr15();
extern void intr16();
extern void intr47();
void remap_irq(void) {
outb(0x20, 0x11);
outb(0xA0, 0x11);
outb(0x21, 0x20);
outb(0xA1, 0x28);
outb(0x21, 0x04);
outb(0xA1, 0x02);
outb(0x21, 0x01);
outb(0xA1, 0x01);
outb(0x21, 0x0);
outb(0xA1, 0x0);
}
void install_interrupts() {
remap_irq();
idt_set_gate(1, (unsigned)intr1, 0x08, 0x8E);
idt_set_gate(2, (unsigned)intr2, 0x08, 0x8E);
idt_set_gate(3, (unsigned)intr3, 0x08, 0x8E);
idt_set_gate(4, (unsigned)intr4, 0x08, 0x8E);
idt_set_gate(5, (unsigned)intr5, 0x08, 0x8E);
idt_set_gate(6, (unsigned)intr6, 0x08, 0x8E);
idt_set_gate(7, (unsigned)intr7, 0x08, 0x8E);
idt_set_gate(8, (unsigned)intr8, 0x08, 0x8E);
idt_set_gate(9, (unsigned)intr9, 0x08, 0x8E);
idt_set_gate(10, (unsigned)intr10, 0x08, 0x8E);
idt_set_gate(11, (unsigned)intr11, 0x08, 0x8E);
idt_set_gate(12, (unsigned)intr12, 0x08, 0x8E);
idt_set_gate(13, (unsigned)intr13, 0x08, 0x8E);
idt_set_gate(14, (unsigned)intr14, 0x08, 0x8E);
idt_set_gate(15, (unsigned)intr15, 0x08, 0x8E);
idt_set_gate(16, (unsigned)intr16, 0x08, 0x8E);
idt_set_gate(47, (unsigned)intr47,0x08, 0x8E);
}
struct registers {
unsigned int gs, fs, es, ds; // segmentregister
unsigned int edi, esi, ebp, esp, ebx, edx, ecx, eax;
unsigned int int_num, err_code; // müssen von den Asm funktionen draufgepusht werden
unsigned int eip, cs, eflags, useresp, ss; //ACHTE AUF DIE REIHENFOLGE!!!
};
void *interrupt_routines;
void install_handler(int interrupt, void (*handler) (struct registers *regs)) {
interrupt_routines[interrupt] = handler;
}
void interrupt_handler(struct registers *reg) {
void (*handler)();
handler = interrupt_routines[reg->int_num];
if (handler) {
handler(reg);
}
if(reg->int_num >= 40) {
outb(0xA0, 0x20);
}
outb(0x20, 0x20);
}
void idt_set_gate(uint16_t num, uint32_t base, uint16_t sel, uint8_t attr) {
IDT[num].offset_low = (base & 0xFFFF);
IDT[num].offset_high = (base >> 16) & 0xFFFF;
IDT[num].selector = sel;
IDT[num].zero = 0;
IDT[num].attribute = attr;
struct {
unsigned int limit;
unsigned int base;
} __attribute__((packed)) idt_ptr = {
.limit = 256*8 - 1,
.base = (unsigned int)IDT,
};
asm("lidt %0" : : "m" (idt_ptr));
}
#include "hString.h"
#include "hVideo.h"
#include "hInput.h"
Übrigen Fehler:
C:\Users\Pk3\Desktop\C_Kernel\kernel.c: In function `install_handler':
C:\Users\Pk3\Desktop\C_Kernel\kernel.c:90: warning: dereferencing `void *' point
er
C:\Users\Pk3\Desktop\C_Kernel\kernel.c:90: error: invalid use of void expression
C:\Users\Pk3\Desktop\C_Kernel\kernel.c: In function `interrupt_handler':
C:\Users\Pk3\Desktop\C_Kernel\kernel.c:96: warning: dereferencing `void *' point
er
C:\Users\Pk3\Desktop\C_Kernel\kernel.c:96: error: void value not ignored as it o
ught to be