Skip to content

Commit

Permalink
tidtyups
Browse files Browse the repository at this point in the history
  • Loading branch information
braindigitalis committed May 15, 2023
1 parent ae60cd9 commit e1bd644
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
15 changes: 5 additions & 10 deletions include/idt.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,24 @@
* @author Craig Edwards (craigedwards@brainbox.cc)
* @copyright Copyright (c) 2012-2023
*/
#ifndef __IDT_H__
#define __IDT_H__
#pragma once

#include <kernel.h>

struct idt_ptr {
typedef struct idt_ptr_t {
uint16_t limit;
void* base;
} __attribute__((packed));
typedef struct idt_ptr idt_ptr_t;
} __attribute__((packed)) idt_ptr_t;

struct idt_entry {
typedef struct idt_entry_t {
uint16_t offset_1; // offset bits 0..15
uint16_t selector; // a code segment selector in GDT or LDT
uint8_t ist; // bits 0..2 holds Interrupt Stack Table offset, rest of bits zero.
uint8_t type_attributes; // gate type, dpl, and p fields
uint16_t offset_2; // offset bits 16..31
uint32_t offset_3; // offset bits 32..63
uint32_t zero; // reserved
};
typedef struct idt_entry idt_entry_t;
} __attribute__((packed)) idt_entry_t;

extern volatile idt_ptr_t idt64;

Expand All @@ -33,5 +30,3 @@ void init_idt();
void idt_init(void* idt);

void pic_eoi(int irq);

#endif
2 changes: 1 addition & 1 deletion src/idt.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <kernel.h>

volatile idt_ptr_t idt64 = { sizeof(idt_entry_t) * 64, NULL };
volatile idt_ptr_t idt64 = { .limit = sizeof(idt_entry_t) * 64, .base = NULL };

#define PIC1 0x20 /* IO base address for master PIC */
#define PIC2 0xA0 /* IO base address for slave PIC */
Expand Down

0 comments on commit e1bd644

Please sign in to comment.