forked from LemonOSProject/LemonOS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Kernel: Clean up IDT code, replace System.h
Put error code in RegisterContext and replaced idt_flush with inline assembly. System.h was removed and its contents were put in CPU.h (RegisterContext) and IOPorts.h (outportb, etc.)
- Loading branch information
Showing
23 changed files
with
200 additions
and
218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,32 @@ | ||
#pragma once | ||
|
||
#include <CPU.h> | ||
#include <stdint.h> | ||
#include <System.h> | ||
|
||
#define IRQ0 32 | ||
|
||
#define IPI_HALT 0xFE | ||
#define IPI_SCHEDULE 0xFD | ||
|
||
typedef struct { | ||
uint16_t base_low; | ||
uint16_t sel; | ||
uint8_t ist; | ||
uint8_t flags; | ||
uint16_t base_med; | ||
uint32_t base_high; | ||
uint32_t null; | ||
uint16_t base_low; | ||
uint16_t sel; | ||
uint8_t ist; | ||
uint8_t flags; | ||
uint16_t base_med; | ||
uint32_t base_high; | ||
uint32_t null; | ||
} __attribute__((packed)) idt_entry_t; | ||
|
||
typedef struct { | ||
uint16_t limit; | ||
uint64_t base; | ||
} __attribute__((packed)) idt_ptr_t; | ||
|
||
typedef void(*isr_t)(void*, RegisterContext*); | ||
typedef void (*isr_t)(void*, RegisterContext*); | ||
|
||
extern "C" void idt_flush(); | ||
|
||
namespace IDT{ | ||
void Initialize(); | ||
void RegisterInterruptHandler(uint8_t interrupt, isr_t handler, void* data = nullptr); | ||
|
||
void DisablePIC(); | ||
namespace IDT { | ||
void Initialize(); | ||
void RegisterInterruptHandler(uint8_t interrupt, isr_t handler, void* data = nullptr); | ||
|
||
uint8_t ReserveUnusedInterrupt(); | ||
void DisablePIC(); | ||
|
||
int GetErrCode(); | ||
} | ||
uint8_t ReserveUnusedInterrupt(); | ||
} // namespace IDT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#pragma once | ||
|
||
#include <stdint.h> | ||
|
||
void outportb(uint16_t port, uint8_t value); | ||
void outportw(uint16_t port, uint16_t value); | ||
void outportd(uint16_t port, uint32_t value); | ||
void outportl(uint16_t port, uint32_t value); | ||
|
||
uint8_t inportb(uint16_t port); | ||
uint16_t inportw(uint16_t port); | ||
uint32_t inportd(uint16_t port); | ||
uint32_t inportl(uint16_t port); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.