2019-05-01 14:17:16 +02:00
|
|
|
//----------------------------------------------------------------------------//
|
2020-09-27 17:33:48 +02:00
|
|
|
// OS on Kaleid //
|
2019-05-01 14:17:16 +02:00
|
|
|
// //
|
|
|
|
// Desc: Interrupt related functions //
|
|
|
|
// //
|
|
|
|
// //
|
2021-02-18 19:54:35 +01:00
|
|
|
// Copyright © 2018-2021 The OS/K Team //
|
2019-05-01 14:17:16 +02:00
|
|
|
// //
|
|
|
|
// This file is part of OS/K. //
|
|
|
|
// //
|
|
|
|
// OS/K is free software: you can redistribute it and/or modify //
|
|
|
|
// it under the terms of the GNU General Public License as published by //
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or //
|
|
|
|
// any later version. //
|
|
|
|
// //
|
|
|
|
// OS/K is distributed in the hope that it will be useful, //
|
|
|
|
// but WITHOUT ANY WARRANTY//without even the implied warranty of //
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
|
|
|
// GNU General Public License for more details. //
|
|
|
|
// //
|
|
|
|
// You should have received a copy of the GNU General Public License //
|
|
|
|
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. //
|
|
|
|
//----------------------------------------------------------------------------//
|
|
|
|
|
2019-05-13 23:22:27 +02:00
|
|
|
#ifndef _KERNEL_H
|
|
|
|
#include <kernel.h>
|
2019-04-24 11:40:28 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _KALKERN_IDT_H
|
|
|
|
#define _KALKERN_IDT_H
|
|
|
|
|
2019-05-01 14:17:16 +02:00
|
|
|
//----------------------------------------------------------------------------//
|
2019-04-24 11:40:28 +02:00
|
|
|
|
2019-05-01 14:17:16 +02:00
|
|
|
struct IdtDescriptor_t
|
|
|
|
{
|
2019-04-24 11:40:28 +02:00
|
|
|
ushort limit;
|
|
|
|
ulong base;
|
2019-05-01 14:17:16 +02:00
|
|
|
} __attribute__((packed));
|
2019-04-24 11:40:28 +02:00
|
|
|
|
|
|
|
struct IdtEntry_t
|
|
|
|
{
|
|
|
|
ushort baseLow;
|
|
|
|
ushort selector;
|
2019-05-22 00:38:04 +02:00
|
|
|
uchar ist;
|
2019-04-24 11:40:28 +02:00
|
|
|
uchar flags;
|
|
|
|
ushort baseMid;
|
|
|
|
uint baseHigh;
|
|
|
|
uint reserved;
|
|
|
|
} __attribute__((packed));
|
|
|
|
|
|
|
|
struct IdtPtr_t
|
|
|
|
{
|
|
|
|
ushort limit;
|
|
|
|
void *base;
|
|
|
|
} __attribute__((packed));
|
|
|
|
|
2019-05-06 22:04:22 +02:00
|
|
|
struct ISRList_t
|
2019-04-24 11:40:28 +02:00
|
|
|
{
|
|
|
|
uchar n; //number of entries in the list
|
|
|
|
|
|
|
|
struct entry {
|
2019-04-27 00:04:27 +02:00
|
|
|
void (*isr)(ISRFrame_t *regs);
|
2019-05-06 22:04:22 +02:00
|
|
|
uchar isrNo;
|
2019-04-24 11:40:28 +02:00
|
|
|
uchar flags;
|
2019-05-06 22:04:22 +02:00
|
|
|
} entry[255];
|
2019-04-24 11:40:28 +02:00
|
|
|
};
|
|
|
|
|
2019-05-01 14:17:16 +02:00
|
|
|
//----------------------------------------------------------------------------//
|
2019-04-24 11:40:28 +02:00
|
|
|
|
2019-05-14 11:48:07 +02:00
|
|
|
void KeLoadIDT(void);
|
|
|
|
void KeSetupIDT(void);
|
2019-11-14 00:54:34 +01:00
|
|
|
void KeUnmaskIRQ(uchar IRQline);
|
|
|
|
void KeMaskIRQ(uchar IRQline);
|
2019-05-01 14:17:16 +02:00
|
|
|
|
2019-05-14 11:48:07 +02:00
|
|
|
void KeSendEOItoPIC(uchar isr);
|
2019-05-22 00:38:04 +02:00
|
|
|
void KeSetIDTGate(uchar rank,
|
|
|
|
ulong base,
|
|
|
|
ushort selector,
|
|
|
|
uchar flags,
|
|
|
|
uchar ist);
|
2019-05-14 11:48:07 +02:00
|
|
|
error_t KeRegisterISR(void (*isr)(ISRFrame_t *regs), uchar isrNo);
|
2019-05-19 01:33:16 +02:00
|
|
|
void KeBrkDumpRegisters(ISRFrame_t *regs);
|
2019-05-01 14:17:16 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------------//
|
|
|
|
|
|
|
|
#define _isr0(a,b,c,d,e) \
|
|
|
|
void isr##a(); void isr##b(); void isr##c(); void isr##d(); void isr##e()
|
|
|
|
|
|
|
|
#define _isr1(a,b,c,d,e,f,g,h,i,j) _isr0(a,b,c,d,e); _isr0(f,g,h,i,j)
|
|
|
|
|
|
|
|
_isr1(0,1,2,3,4,5,6,7,8,9); _isr1(10,11,12,13,14,15,16,17,18,19);
|
|
|
|
_isr1(20,21,22,23,24,25,26,27,28,29); _isr1(30,31,32,33,34,35,36,37,38,39);
|
|
|
|
_isr1(40,41,42,43,44,45,46,47,48,49); _isr1(50,51,52,53,54,55,56,57,58,59);
|
2021-02-26 13:18:20 +01:00
|
|
|
_isr1(60,61,62,63,64,65,66,67,68,69); _isr1(70,71,72,73,74,75,76,77,78,79);
|
|
|
|
_isr1(80,81,82,83,84,85,86,87,88,89); _isr1(90,91,92,93,94,95,96,97,98,99);
|
|
|
|
_isr1(100,101,102,103,104,105,106,107,108,109);
|
|
|
|
_isr1(110,111,112,113,114,115,116,117,118,119);
|
|
|
|
_isr1(120,121,122,123,124,125,126,127,128,129);
|
|
|
|
_isr1(130,131,132,133,134,135,136,137,138,139);
|
|
|
|
_isr1(140,141,142,143,144,145,146,147,148,149);
|
|
|
|
_isr1(150,151,152,153,154,155,156,157,158,159);
|
|
|
|
_isr1(160,161,162,163,164,165,166,167,168,169);
|
|
|
|
_isr1(170,171,172,173,174,175,176,177,178,179);
|
|
|
|
_isr1(180,181,182,183,184,185,186,187,188,189);
|
|
|
|
_isr1(190,191,192,193,194,195,196,197,198,199);
|
|
|
|
_isr1(200,201,202,203,204,205,206,207,208,209);
|
|
|
|
_isr1(210,211,212,213,214,215,216,217,218,219);
|
|
|
|
_isr1(220,221,222,223,224,225,226,227,228,229);
|
|
|
|
_isr1(230,231,232,233,234,235,236,237,238,239);
|
|
|
|
_isr1(240,241,242,243,244,245,246,247,248,249);
|
|
|
|
_isr0(250,251,252,253,254);
|
|
|
|
void isr255();
|
2019-05-01 14:17:16 +02:00
|
|
|
|
|
|
|
#undef _isr1
|
|
|
|
#undef _isr0
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------//
|
2019-04-24 11:40:28 +02:00
|
|
|
|
|
|
|
#endif
|