mirror of
https://github.com/tailix/kernel.git
synced 2025-09-18 22:57:59 -04:00
Add file "arch/interrupt.h"
This commit is contained in:
parent
baf6bfd6bb
commit
be7b16afc0
5 changed files with 19 additions and 20 deletions
|
@ -1,13 +1,7 @@
|
||||||
|
#include "interrupt.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
|
|
||||||
struct IsrRegisters {
|
|
||||||
unsigned int ds; // Data segment selector
|
|
||||||
unsigned int edi, esi, ebp, esp, ebx, edx, ecx, eax; // Pushed by pusha.
|
|
||||||
unsigned int int_no, err_code; // Interrupt number and error code (if applicable)
|
|
||||||
unsigned int eip, cs, eflags, useresp, ss; // Pushed by the processor automatically.
|
|
||||||
};
|
|
||||||
|
|
||||||
static const char *const messages[] = {
|
static const char *const messages[] = {
|
||||||
"Unhandled protected-mode exception: 0x0",
|
"Unhandled protected-mode exception: 0x0",
|
||||||
"Unhandled protected-mode exception: 0x1",
|
"Unhandled protected-mode exception: 0x1",
|
||||||
|
|
|
@ -1,16 +1,10 @@
|
||||||
#include "hwint.h"
|
#include "hwint.h"
|
||||||
|
|
||||||
|
#include "interrupt.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "asm.h"
|
#include "asm.h"
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
|
|
||||||
struct IsrRegisters {
|
|
||||||
unsigned int ds; // Data segment selector
|
|
||||||
unsigned int edi, esi, ebp, esp, ebx, edx, ecx, eax; // Pushed by pusha.
|
|
||||||
unsigned int int_no, err_code; // Interrupt number and error code (if applicable)
|
|
||||||
unsigned int eip, cs, eflags, useresp, ss; // Pushed by the processor automatically.
|
|
||||||
};
|
|
||||||
|
|
||||||
static const char *const messages[] = {
|
static const char *const messages[] = {
|
||||||
"Unhandled hardware interrupt: 0",
|
"Unhandled hardware interrupt: 0",
|
||||||
"Unhandled hardware interrupt: 1",
|
"Unhandled hardware interrupt: 1",
|
||||||
|
|
11
arch/interrupt.h
Normal file
11
arch/interrupt.h
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
#ifndef KERNELMQ_INCLUDED_INTERRUPT
|
||||||
|
#define KERNELMQ_INCLUDED_INTERRUPT 1
|
||||||
|
|
||||||
|
struct IsrRegisters {
|
||||||
|
unsigned int ds; // Data segment selector
|
||||||
|
unsigned int edi, esi, ebp, esp, ebx, edx, ecx, eax; // Pushed by pusha.
|
||||||
|
unsigned int int_no, err_code; // Interrupt number and error code (if applicable)
|
||||||
|
unsigned int eip, cs, eflags, useresp, ss; // Pushed by the processor automatically.
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -7,6 +7,9 @@
|
||||||
syscall_gate:
|
syscall_gate:
|
||||||
cli
|
cli
|
||||||
|
|
||||||
|
push byte 0
|
||||||
|
push byte INT_SYSCALL
|
||||||
|
|
||||||
pusha ; Pushes edi,esi,ebp,esp,ebx,edx,ecx,eax
|
pusha ; Pushes edi,esi,ebp,esp,ebx,edx,ecx,eax
|
||||||
|
|
||||||
mov ax, ds ; Lower 16-bits of eax = ds.
|
mov ax, ds ; Lower 16-bits of eax = ds.
|
||||||
|
@ -28,5 +31,7 @@ syscall_gate:
|
||||||
|
|
||||||
popa ; Pops edi,esi,ebp...
|
popa ; Pops edi,esi,ebp...
|
||||||
|
|
||||||
|
add esp, 8 ; Cleans up the pushed error code and pushed ISR number
|
||||||
|
|
||||||
sti
|
sti
|
||||||
iret ; pops 5 things at once: CS, EIP, EFLAGS, SS, and ESP
|
iret ; pops 5 things at once: CS, EIP, EFLAGS, SS, and ESP
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
|
#include "interrupt.h"
|
||||||
#include "kprintf.h"
|
#include "kprintf.h"
|
||||||
|
|
||||||
struct IsrRegisters {
|
|
||||||
unsigned int ds; // Data segment selector
|
|
||||||
unsigned int edi, esi, ebp, esp, ebx, edx, ecx, eax; // Pushed by pusha.
|
|
||||||
unsigned int eip, cs, eflags, useresp, ss; // Pushed by the processor automatically.
|
|
||||||
};
|
|
||||||
|
|
||||||
void syscall_handler(struct IsrRegisters regs)
|
void syscall_handler(struct IsrRegisters regs)
|
||||||
{
|
{
|
||||||
const unsigned int id = regs.eax;
|
const unsigned int id = regs.eax;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue