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