get rid of useless types.h header
This commit is contained in:
+1
-2
@@ -1,6 +1,5 @@
|
||||
#ifndef IDT_H
|
||||
#define IDT_H
|
||||
#include "../include/types.h"
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct {
|
||||
@@ -21,7 +20,7 @@ typedef struct {
|
||||
|
||||
static idtr_t idtr;
|
||||
|
||||
void idt_set_descriptor(uint8 vector, uint32 isr, uint8_t flags);
|
||||
void idt_set_descriptor(uint8_t vector, uint32_t isr, uint8_t flags);
|
||||
void idt_set();
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
#ifndef TYPES_H
|
||||
#define TYPES_H
|
||||
|
||||
typedef signed char int8;
|
||||
typedef unsigned char uint8;
|
||||
|
||||
typedef signed short int16;
|
||||
typedef unsigned short uint16;
|
||||
|
||||
typedef signed int int32;
|
||||
typedef unsigned int uint32;
|
||||
|
||||
typedef signed long long int64;
|
||||
typedef unsigned long long uint64;
|
||||
|
||||
typedef char* string;
|
||||
|
||||
#define low_16(address) (uint16)((address) & 0xFFFF)
|
||||
#define high_16(address) (uint16)(((address) >> 16) & 0xFFFF)
|
||||
|
||||
#endif
|
||||
+2
-3
@@ -1,11 +1,10 @@
|
||||
#ifndef UTILS_H
|
||||
#define UTILS_H
|
||||
#include "../include/types.h"
|
||||
#include "../include/stdio.h"
|
||||
#include <stdint.h>
|
||||
|
||||
uint8 inportb(uint16 _port);
|
||||
void outportb(uint16 _port, uint8 _data);
|
||||
uint8_t inportb(uint16_t _port);
|
||||
void outportb(uint16_t _port, uint8_t _data);
|
||||
uint8_t get_rtc(uint8_t reg);
|
||||
void get_fancy_datetime();
|
||||
void get_datetime(uint16_t *year, uint8_t *month, uint8_t *day, uint8_t *hour, uint8_t *minute, uint8_t *second);
|
||||
|
||||
+5
-2
@@ -6,14 +6,17 @@ extern void* isr_stub_table[];
|
||||
|
||||
#define KERNEL_CS 0x08
|
||||
|
||||
#define low_16(address) (uint16_t)((address) & 0xFFFF)
|
||||
#define high_16(address) (uint16_t)(((address) >> 16) & 0xFFFF)
|
||||
|
||||
void idt_set() {
|
||||
idtr.base = (uint32) &idt;
|
||||
idtr.base = (uint32_t) &idt;
|
||||
idtr.limit = sizeof(idt) * sizeof(idt_entry_t) - 1;
|
||||
__asm__ __volatile__("lidt %0" : : "m" (idtr));
|
||||
}
|
||||
|
||||
|
||||
void idt_set_descriptor(uint8_t vector, uint32 isr, uint8_t flags) {
|
||||
void idt_set_descriptor(uint8_t vector, uint32_t isr, uint8_t flags) {
|
||||
idt_entry_t* descriptor = &idt[vector];
|
||||
|
||||
descriptor->isr_low = isr & 0xFFFF;
|
||||
|
||||
+38
-39
@@ -1,6 +1,5 @@
|
||||
#include "../include/idt.h"
|
||||
#include "../include/isr.h"
|
||||
#include "../include/types.h"
|
||||
#include "../include/pic.h"
|
||||
#include "../include/pit.h"
|
||||
#include "../include/keyboard.h"
|
||||
@@ -28,48 +27,48 @@ extern void sys_exit_handler();
|
||||
extern void page_fault_handler();
|
||||
|
||||
void isr_install() {
|
||||
idt_set_descriptor(0, (uint32)isr0, 0x8E);
|
||||
idt_set_descriptor(1, (uint32)isr1, 0x8E);
|
||||
idt_set_descriptor(2, (uint32)isr2, 0x8E);
|
||||
idt_set_descriptor(3, (uint32)isr3, 0x8E);
|
||||
idt_set_descriptor(4, (uint32)isr4, 0x8E);
|
||||
idt_set_descriptor(5, (uint32)isr5, 0x8E);
|
||||
idt_set_descriptor(6, (uint32)isr6, 0x8E);
|
||||
idt_set_descriptor(7, (uint32)isr7, 0x8E);
|
||||
idt_set_descriptor(8, (uint32)isr8, 0x8E);
|
||||
idt_set_descriptor(9, (uint32)isr9, 0x8E);
|
||||
idt_set_descriptor(10, (uint32)isr10, 0x8E);
|
||||
idt_set_descriptor(11, (uint32)isr11, 0x8E);
|
||||
idt_set_descriptor(12, (uint32)isr12, 0x8E);
|
||||
idt_set_descriptor(13, (uint32)isr13, 0x8E);
|
||||
idt_set_descriptor(14, (uint32)page_fault_handler, 0x8E);
|
||||
idt_set_descriptor(15, (uint32)isr15, 0x8E);
|
||||
idt_set_descriptor(16, (uint32)isr16, 0x8E);
|
||||
idt_set_descriptor(17, (uint32)isr17, 0x8E);
|
||||
idt_set_descriptor(18, (uint32)isr18, 0x8E);
|
||||
idt_set_descriptor(19, (uint32)isr19, 0x8E);
|
||||
idt_set_descriptor(20, (uint32)isr20, 0x8E);
|
||||
idt_set_descriptor(21, (uint32)isr21, 0x8E);
|
||||
idt_set_descriptor(22, (uint32)isr22, 0x8E);
|
||||
idt_set_descriptor(23, (uint32)isr23, 0x8E);
|
||||
idt_set_descriptor(24, (uint32)isr24, 0x8E);
|
||||
idt_set_descriptor(25, (uint32)isr25, 0x8E);
|
||||
idt_set_descriptor(26, (uint32)isr26, 0x8E);
|
||||
idt_set_descriptor(27, (uint32)isr27, 0x8E);
|
||||
idt_set_descriptor(28, (uint32)isr28, 0x8E);
|
||||
idt_set_descriptor(29, (uint32)isr29, 0x8E);
|
||||
idt_set_descriptor(30, (uint32)isr30, 0x8E);
|
||||
idt_set_descriptor(31, (uint32)isr31, 0x8E);
|
||||
idt_set_descriptor(0, (uint32_t)isr0, 0x8E);
|
||||
idt_set_descriptor(1, (uint32_t)isr1, 0x8E);
|
||||
idt_set_descriptor(2, (uint32_t)isr2, 0x8E);
|
||||
idt_set_descriptor(3, (uint32_t)isr3, 0x8E);
|
||||
idt_set_descriptor(4, (uint32_t)isr4, 0x8E);
|
||||
idt_set_descriptor(5, (uint32_t)isr5, 0x8E);
|
||||
idt_set_descriptor(6, (uint32_t)isr6, 0x8E);
|
||||
idt_set_descriptor(7, (uint32_t)isr7, 0x8E);
|
||||
idt_set_descriptor(8, (uint32_t)isr8, 0x8E);
|
||||
idt_set_descriptor(9, (uint32_t)isr9, 0x8E);
|
||||
idt_set_descriptor(10, (uint32_t)isr10, 0x8E);
|
||||
idt_set_descriptor(11, (uint32_t)isr11, 0x8E);
|
||||
idt_set_descriptor(12, (uint32_t)isr12, 0x8E);
|
||||
idt_set_descriptor(13, (uint32_t)isr13, 0x8E);
|
||||
idt_set_descriptor(14, (uint32_t)page_fault_handler, 0x8E);
|
||||
idt_set_descriptor(15, (uint32_t)isr15, 0x8E);
|
||||
idt_set_descriptor(16, (uint32_t)isr16, 0x8E);
|
||||
idt_set_descriptor(17, (uint32_t)isr17, 0x8E);
|
||||
idt_set_descriptor(18, (uint32_t)isr18, 0x8E);
|
||||
idt_set_descriptor(19, (uint32_t)isr19, 0x8E);
|
||||
idt_set_descriptor(20, (uint32_t)isr20, 0x8E);
|
||||
idt_set_descriptor(21, (uint32_t)isr21, 0x8E);
|
||||
idt_set_descriptor(22, (uint32_t)isr22, 0x8E);
|
||||
idt_set_descriptor(23, (uint32_t)isr23, 0x8E);
|
||||
idt_set_descriptor(24, (uint32_t)isr24, 0x8E);
|
||||
idt_set_descriptor(25, (uint32_t)isr25, 0x8E);
|
||||
idt_set_descriptor(26, (uint32_t)isr26, 0x8E);
|
||||
idt_set_descriptor(27, (uint32_t)isr27, 0x8E);
|
||||
idt_set_descriptor(28, (uint32_t)isr28, 0x8E);
|
||||
idt_set_descriptor(29, (uint32_t)isr29, 0x8E);
|
||||
idt_set_descriptor(30, (uint32_t)isr30, 0x8E);
|
||||
idt_set_descriptor(31, (uint32_t)isr31, 0x8E);
|
||||
|
||||
for(int i = 32; i < 255; i++)
|
||||
idt_set_descriptor(i, (uint32)default_handler, 0x8E);
|
||||
idt_set_descriptor(i, (uint32_t)default_handler, 0x8E);
|
||||
|
||||
idt_set_descriptor(0x20, (uint32)isr_timer, 0x8E);
|
||||
idt_set_descriptor(0x21, (uint32)isr_custom, 0x8E);
|
||||
idt_set_descriptor(0x20, (uint32_t)isr_timer, 0x8E);
|
||||
idt_set_descriptor(0x21, (uint32_t)isr_custom, 0x8E);
|
||||
|
||||
idt_set_descriptor(0x80, (uint32)sys_exit_handler, 0xEE);
|
||||
idt_set_descriptor(0x80, (uint32_t)sys_exit_handler, 0xEE);
|
||||
|
||||
idt_set_descriptor(255, (uint32)spurious, 0x8E);
|
||||
idt_set_descriptor(255, (uint32_t)spurious, 0x8E);
|
||||
|
||||
idt_set(); // Load with ASM
|
||||
printf("isr_install done\n");
|
||||
@@ -304,7 +303,7 @@ void isr31()
|
||||
asm("hlt");
|
||||
}
|
||||
|
||||
static string exception_messages[] = {
|
||||
static char* exception_messages[] = {
|
||||
"Division By Zero",
|
||||
"Debug",
|
||||
"Non Maskable Interrupt",
|
||||
|
||||
+3
-4
@@ -1,14 +1,13 @@
|
||||
#include "../include/types.h"
|
||||
#include "../include/utils.h"
|
||||
|
||||
uint8 inportb(uint16 _port)
|
||||
uint8_t inportb(uint16_t _port)
|
||||
{
|
||||
uint8 rv;
|
||||
uint8_t rv;
|
||||
__asm__ __volatile__ ("inb %1, %0" : "=a" (rv) : "dN" (_port));
|
||||
return rv;
|
||||
}
|
||||
|
||||
void outportb(uint16 _port, uint8 _data)
|
||||
void outportb(uint16_t _port, uint8_t _data)
|
||||
{
|
||||
__asm__ __volatile__ ("outb %1, %0" : : "dN" (_port), "a" (_data));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user