101
Softwareentwicklung / Re: Qemu und Oracle...
« am: 02. April 2012, 14:30 »"VBox geht nicht mehr"?Ich meine damit, dass wenn ich den VBoxManager ausführe passiert nichts, und kann die *.vbox dateien nichtmehr starten
17. May 2024, 16:58
Diese Sektion erlaubt es dir alle Beiträge dieses Mitglieds zu sehen. Beachte, dass du nur solche Beiträge sehen kannst, zu denen du auch Zugriffsrechte hast.
"VBox geht nicht mehr"?Ich meine damit, dass wenn ich den VBoxManager ausführe passiert nichts, und kann die *.vbox dateien nichtmehr starten
int_handler_0x21:
iret
) (Kalmmer zu)static inline void outb(uint16_t port, uint8_t data){
asm("outb %0, %1" : : "a" (data), "Nd" (port));
}
static inline uint8_t inb(uint16_t port){
unsigned char result = 0;
asm("inb %1, %0" : "=a" (result) : "Nd" (port));
return result;
}
Diese Datei binde ich dann zb. in meinem Kernel ein:Code: [Auswählen]#include "kernel\console.h"
#include "kernel\asmaccess.h"
void main()
{
Console_ClearScreen();
Console_WriteLine("Hallo!");
Console_WriteLine("Ich heiße Compi!");
Console_WriteLine("Ich bin ein Computer");
Console_WriteLine("und lasse hier diesen sinnfreien Text anzeigen.");
halt();
}
#include "console.h"
#include "asmaccess.h"
#include "kernel\console.h"
#include "kernel\asmaccess.h"
.extern keyboard_irq_handler
...
.global int_handler0x21
int_handler0x21:
call keyboard_irq_handler
iret
...
...
void keyboard_irq_handler(void){
printf("Taste gedrueckt!\n");
}
gdb [dann kommt hier das file]
Bla.. BLa ...Bla
(gdb) target remote :1234
[dann kommt hier das file]soll ich da mein iso-image angeben?
qemu -S -cdrom image.iso
0: v=21 e=0000 i=0 cpl=0 IP=0008:00101835 pc=00101835 SP=0010:00105f70 EAX=000000ed
und dann:check_exception old: 0xffffffff new 0xd
1: v=0d e=0204 i=0 cpl=0 IP=0008:00100d66 pc=00100d66 SP=0010:00105f6a EAX=00000000
du hast nicht mit IDT_ENTRIES * 8 - 1 probiert, oder? Die minus 1 war schon richtig.Na klar hab ich das!!!
/**
* kernel/interrupt/idt.h
* set_interrupt, init_idt, load_idt
*
* (C) Copyright 2012 Michael Sippel
*/
#include <stdint.h>
#include <stdbool.h>
#include "handlerextern.h"
#include "interrupt.h"
/* ---------- Globale Variablen ----------------------- */
static uint64_t idt[IDT_ENTRIES]; //Interupt Deskriptor Table
/* ---------- Eintrag in die IDT setzen --------------- */
static void set_interrupt(int i, uint32_t offset, uint16_t selector, int type, bool present, int dpl){
idt[i] = 0;
//untere 32-Bit
idt[i] = (offset & 0x0000ffff) | (selector << 16);
//obere 32-Bit
idt[i] |=(
( type << 8 ) |
( (dpl&3) << 13 ) |
( (present&1) << 15)|
( offset & 0xffff0000 )
) * 0x100000000;
}
/* ---------- IDT laden ------------------------------- */
void load_idt(void){
struct {
uint16_t size;
uint64_t pointer;
} __attribute__((packed)) idtp = {
.size = IDT_ENTRIES - 1,
.pointer = &idt,
};
asm("lidt %0" : : "m" (idtp));
}
/* ---------- IDT initalisieren ----------------------- */
void init_idt(void){
/// index, offset, selector, type, present, dpl
set_interrupt(0x00, (uint32_t)&int_handler0x00,0x08,INTERRUPT_GATE,TRUE, 0 );//Exeption
set_interrupt(0x01, (uint32_t)&int_handler0x01,0x08,INTERRUPT_GATE,TRUE, 0 );//Exeption
set_interrupt(0x02, (uint32_t)&int_handler0x02,0x08,INTERRUPT_GATE,TRUE, 0 );//Exeption
set_interrupt(0x03, (uint32_t)&int_handler0x03,0x08,INTERRUPT_GATE,TRUE, 0 );//Exeption
set_interrupt(0x04, (uint32_t)&int_handler0x04,0x08,INTERRUPT_GATE,TRUE, 0 );//Exeption
set_interrupt(0x05, (uint32_t)&int_handler0x05,0x08,INTERRUPT_GATE,TRUE, 0 );//Exeption
set_interrupt(0x06, (uint32_t)&int_handler0x06,0x08,INTERRUPT_GATE,TRUE, 0 );//Exeption
set_interrupt(0x07, (uint32_t)&int_handler0x07,0x08,INTERRUPT_GATE,TRUE, 0 );//Exeption
set_interrupt(0x08, (uint32_t)&int_handler0x08,0x08,INTERRUPT_GATE,TRUE, 0 );//Exeption
set_interrupt(0x09, (uint32_t)&int_handler0x09,0x08,INTERRUPT_GATE,TRUE, 0 );//Exeption
set_interrupt(0x0A, (uint32_t)&int_handler0x0A,0x08,INTERRUPT_GATE,TRUE, 0 );//Exeption
set_interrupt(0x0B, (uint32_t)&int_handler0x0B,0x08,INTERRUPT_GATE,TRUE, 0 );//Exeption
set_interrupt(0x0C, (uint32_t)&int_handler0x0C,0x08,INTERRUPT_GATE,TRUE, 0 );//Exeption
set_interrupt(0x0D, (uint32_t)&int_handler0x0D,0x08,INTERRUPT_GATE,TRUE, 0 );//Exeption
set_interrupt(0x0E, (uint32_t)&int_handler0x0E,0x08,INTERRUPT_GATE,TRUE, 0 );//Exeption
set_interrupt(0x0F, (uint32_t)&int_handler0x0F,0x08,INTERRUPT_GATE,TRUE, 0 );//Exeption
set_interrupt(0x10, (uint32_t)&int_handler0x10,0x08,INTERRUPT_GATE,TRUE, 0 );//Exeption
set_interrupt(0x11, (uint32_t)&int_handler0x11,0x08,INTERRUPT_GATE,TRUE, 0 );//Exeption
set_interrupt(0x12, (uint32_t)&int_handler0x12,0x08,INTERRUPT_GATE,TRUE, 0 );//Exeption
set_interrupt(0x13, (uint32_t)&int_handler0x13,0x08,INTERRUPT_GATE,TRUE, 0 );//Exeption
set_interrupt(0x14, (uint32_t)&int_handler0x14,0x08,INTERRUPT_GATE,TRUE, 0 );//Exeption
set_interrupt(0x15, (uint32_t)&int_handler0x15,0x08,INTERRUPT_GATE,TRUE, 0 );//Exeption
set_interrupt(0x16, (uint32_t)&int_handler0x16,0x08,INTERRUPT_GATE,TRUE, 0 );//Exeption
set_interrupt(0x17, (uint32_t)&int_handler0x17,0x08,INTERRUPT_GATE,TRUE, 0 );//Exeption
set_interrupt(0x18, (uint32_t)&int_handler0x18,0x08,INTERRUPT_GATE,TRUE, 0 );//Exeption
set_interrupt(0x19, (uint32_t)&int_handler0x19,0x08,INTERRUPT_GATE,TRUE, 0 );//Exeption
set_interrupt(0x1A, (uint32_t)&int_handler0x1A,0x08,INTERRUPT_GATE,TRUE, 0 );//Exeption
set_interrupt(0x1B, (uint32_t)&int_handler0x1B,0x08,INTERRUPT_GATE,TRUE, 0 );//Exeption
set_interrupt(0x1C, (uint32_t)&int_handler0x1C,0x08,INTERRUPT_GATE,TRUE, 0 );//Exeption
set_interrupt(0x1D, (uint32_t)&int_handler0x1D,0x08,INTERRUPT_GATE,TRUE, 0 );//Exeption
set_interrupt(0x1E, (uint32_t)&int_handler0x1E,0x08,INTERRUPT_GATE,TRUE, 0 );//Exeption
set_interrupt(0x1F, (uint32_t)&int_handler0x1F,0x08,INTERRUPT_GATE,TRUE, 0 );//Exeption
set_interrupt(0x20, (uint32_t)&int_handler0x20,0x08,INTERRUPT_GATE,TRUE, 0 );//IRQ
set_interrupt(0x21, (uint32_t)&int_handler0x21,0x08,INTERRUPT_GATE,TRUE, 0 );//IRQ
set_interrupt(0x22, (uint32_t)&int_handler0x22,0x08,INTERRUPT_GATE,TRUE, 0 );//IRQ
set_interrupt(0x23, (uint32_t)&int_handler0x23,0x08,INTERRUPT_GATE,TRUE, 0 );//IRQ
set_interrupt(0x24, (uint32_t)&int_handler0x24,0x08,INTERRUPT_GATE,TRUE, 0 );//IRQ
set_interrupt(0x25, (uint32_t)&int_handler0x25,0x08,INTERRUPT_GATE,TRUE, 0 );//IRQ
set_interrupt(0x26, (uint32_t)&int_handler0x26,0x08,INTERRUPT_GATE,TRUE, 0 );//IRQ
set_interrupt(0x27, (uint32_t)&int_handler0x27,0x08,INTERRUPT_GATE,TRUE, 0 );//IRQ
set_interrupt(0x28, (uint32_t)&int_handler0x28,0x08,INTERRUPT_GATE,TRUE, 0 );//IRQ
set_interrupt(0x29, (uint32_t)&int_handler0x29,0x08,INTERRUPT_GATE,TRUE, 0 );//IRQ
set_interrupt(0x2A, (uint32_t)&int_handler0x2A,0x08,INTERRUPT_GATE,TRUE, 0 );//IRQ
set_interrupt(0x2B, (uint32_t)&int_handler0x2B,0x08,INTERRUPT_GATE,TRUE, 0 );//IRQ
set_interrupt(0x2C, (uint32_t)&int_handler0x2C,0x08,INTERRUPT_GATE,TRUE, 0 );//IRQ
set_interrupt(0x2D, (uint32_t)&int_handler0x2D,0x08,INTERRUPT_GATE,TRUE, 0 );//IRQ
set_interrupt(0x2E, (uint32_t)&int_handler0x2E,0x08,INTERRUPT_GATE,TRUE, 0 );//IRQ
set_interrupt(0x2F, (uint32_t)&int_handler0x2F,0x08,INTERRUPT_GATE,TRUE, 0 );//IRQ
set_interrupt(0x30, (uint32_t)&int_handler0x30,0x08,INTERRUPT_GATE,TRUE, 0 );//Software
set_interrupt(0x31, (uint32_t)&test_int_handler00,0x08,INTERRUPT_GATE,TRUE,0);//Software
set_interrupt(0x32, (uint32_t)&test_int_handler01,0x08,INTERRUPT_GATE,TRUE,0);//Software
}
/*----- ENDE idt.c ---- */
/**
* kernel/interrupt/pic.c
* init_pic
*
* (C) Copyright 2012 Michael Sippel
*/
#include <portio.h>
#include "interrupt.h"
#define PIC_MASTER_COMM 0x20
#define PIC_MASTER_DATA (PIC_MASTER_COMM) + 1
#define PIC_SLAVE_COMM 0xa0
#define PIC_SLAVE_DATA (PIC_SLAVE_COMM) + 1
#define PIC_INIT 0x11
#define PIC_ICW4 0x01
#define PIC_EOI 0x20
/* ---------- Initalisierung des PIC ------------------ */
void init_pic(void){
// PICs initalisieren
outb(PIC_MASTER_COMM,PIC_INIT);
outb(PIC_SLAVE_COMM,PIC_INIT);
//Erstes IRQ
outb(PIC_MASTER_DATA, FIRST_IRQ); // Master
outb(PIC_SLAVE_DATA, FIRST_IRQ + 8);// Slave
//Slave auf IRQ 2 setzen
outb(PIC_MASTER_DATA, 0x04);
outb(PIC_SLAVE_DATA, 0x02);
//ICW 4
outb(PIC_MASTER_DATA, PIC_ICW4);// Master
outb(PIC_SLAVE_DATA, PIC_ICW4);// Slave
// All IRQs aktivieren / demaskieren
outb(PIC_MASTER_DATA, 0x0);
outb(PIC_SLAVE_DATA, 0x0);
}