Compare commits
No commits in common. "6839eb469930fc3dadde450885228a4a953c1a5f" and "ca93f5077b495431c1efd1ec1f7e8a08f8ae0e75" have entirely different histories.
6839eb4699
...
ca93f5077b
10 changed files with 12 additions and 14 deletions
|
@ -173,7 +173,7 @@ static void isr31(struct interrupt_descriptor_32 *frame) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void exception_handlers_init(void) {
|
void exception_handlers_init() {
|
||||||
idt_register_handler(0, (size_t)isr0);
|
idt_register_handler(0, (size_t)isr0);
|
||||||
idt_register_handler(1, (size_t)isr1);
|
idt_register_handler(1, (size_t)isr1);
|
||||||
idt_register_handler(2, (size_t)isr2);
|
idt_register_handler(2, (size_t)isr2);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#ifndef _EXCEPTION_H
|
#ifndef _EXCEPTION_H
|
||||||
#define _EXCEPTION_H
|
#define _EXCEPTION_H
|
||||||
|
|
||||||
void exception_handlers_init(void);
|
void exception_handlers_init();
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -6,7 +6,7 @@
|
||||||
struct interrupt_descriptor_32 idt[256];
|
struct interrupt_descriptor_32 idt[256];
|
||||||
static size_t idt_ptr[2];
|
static size_t idt_ptr[2];
|
||||||
|
|
||||||
void idt_init(void) {
|
void idt_init() {
|
||||||
size_t idt_address = (size_t)idt;
|
size_t idt_address = (size_t)idt;
|
||||||
idt_ptr[0] = (sizeof (struct interrupt_descriptor_32) * 256) + ((idt_address & 0xffff) << 16);
|
idt_ptr[0] = (sizeof (struct interrupt_descriptor_32) * 256) + ((idt_address & 0xffff) << 16);
|
||||||
idt_ptr[1] = idt_address >> 16;
|
idt_ptr[1] = idt_address >> 16;
|
||||||
|
|
|
@ -16,7 +16,7 @@ struct interrupt_descriptor_32 {
|
||||||
uint16_t offset_2; // offset bits 16..31
|
uint16_t offset_2; // offset bits 16..31
|
||||||
} __attribute__((__packed__));
|
} __attribute__((__packed__));
|
||||||
|
|
||||||
void idt_init(void);
|
void idt_init();
|
||||||
void idt_register_handler(uint8_t interrupt, size_t address);
|
void idt_register_handler(uint8_t interrupt, size_t address);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
#include "cpu/io.h"
|
#include "cpu/io.h"
|
||||||
|
|
||||||
void pic_remap(uint8_t offset1, uint8_t offset2) {
|
void pic_remap(uint8_t offset1, uint8_t offset2) {
|
||||||
|
uint8_t a1, a2;
|
||||||
|
|
||||||
outb(PIC1_COMMAND, ICW1_INIT | ICW1_ICW4); // starts the initialization sequence (in cascade mode)
|
outb(PIC1_COMMAND, ICW1_INIT | ICW1_ICW4); // starts the initialization sequence (in cascade mode)
|
||||||
io_wait();
|
io_wait();
|
||||||
outb(PIC2_COMMAND, ICW1_INIT | ICW1_ICW4);
|
outb(PIC2_COMMAND, ICW1_INIT | ICW1_ICW4);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
menuentry "hippOS" {
|
menuentry "just some OS" {
|
||||||
multiboot /boot/kernel.bin
|
multiboot /boot/kernel.bin
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
#include "cpu/pic.h"
|
#include "cpu/pic.h"
|
||||||
#include "cpu/idt.h"
|
#include "cpu/idt.h"
|
||||||
#include "cpu/io.h"
|
#include "cpu/io.h"
|
||||||
#include "gfx/terminal.h"
|
|
||||||
|
|
||||||
const char us_map[128] = {
|
const char us_map[128] = {
|
||||||
0, 27, '1', '2', '3', '4', '5', '6', '7', '8',
|
0, 27, '1', '2', '3', '4', '5', '6', '7', '8',
|
||||||
|
@ -48,7 +47,7 @@ const char us_map[128] = {
|
||||||
|
|
||||||
__attribute__((interrupt))
|
__attribute__((interrupt))
|
||||||
static void irq(struct interrupt_descriptor_32 *frame) {
|
static void irq(struct interrupt_descriptor_32 *frame) {
|
||||||
uint8_t scancode = inb(0x60);
|
char scancode = inb(0x60);
|
||||||
|
|
||||||
if (scancode & 128) {
|
if (scancode & 128) {
|
||||||
goto end; // ignore release scancode
|
goto end; // ignore release scancode
|
||||||
|
@ -59,7 +58,7 @@ end:
|
||||||
pic_send_eoi(1);
|
pic_send_eoi(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void keyboard_init(void) {
|
void keyboard_init() {
|
||||||
pic_irq_clear_mask(1);
|
pic_irq_clear_mask(1);
|
||||||
idt_register_handler(33, (size_t)irq);
|
idt_register_handler(33, (size_t)irq);
|
||||||
inb(0x60);
|
inb(0x60);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#ifndef _KEYBOARD_H
|
#ifndef _KEYBOARD_H
|
||||||
#define _KEYBOARD_H
|
#define _KEYBOARD_H
|
||||||
|
|
||||||
void keyboard_init(void);
|
void keyboard_init();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -118,8 +118,7 @@ void kputs(const char* data) {
|
||||||
kprintf("%s\n", data);
|
kprintf("%s\n", data);
|
||||||
}
|
}
|
||||||
|
|
||||||
__attribute__((__noreturn__))
|
void kabort() {
|
||||||
void kabort(void) {
|
|
||||||
kprintf("kabort(): halting kernel...\n");
|
kprintf("kabort(): halting kernel...\n");
|
||||||
asm volatile("cli");
|
asm volatile("cli");
|
||||||
asm volatile("hlt");
|
asm volatile("hlt");
|
||||||
|
|
|
@ -6,8 +6,6 @@
|
||||||
int kputchar(int ic);
|
int kputchar(int ic);
|
||||||
int kprintf(const char* restrict format, ...);
|
int kprintf(const char* restrict format, ...);
|
||||||
void kputs(const char* data);
|
void kputs(const char* data);
|
||||||
|
void kabort();
|
||||||
__attribute__((__noreturn__))
|
|
||||||
void kabort(void);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
Reference in a new issue