mirror of
https://gitlab.os-k.eu/os-k-team/os-k.git
synced 2023-08-25 14:03:10 +02:00
reworking on IDT
This commit is contained in:
parent
93cce54081
commit
59bd638188
@ -89,7 +89,7 @@ static char *IsrExceptions[32] = {
|
|||||||
void IdtRegisterIrq(void (*isr)(void), uchar irq, uchar flags);
|
void IdtRegisterIrq(void (*isr)(void), uchar irq, uchar flags);
|
||||||
void IdtSetup(void);
|
void IdtSetup(void);
|
||||||
void IdtSetGate(uchar rank, ulong base, ushort selector, uchar flags);
|
void IdtSetGate(uchar rank, ulong base, ushort selector, uchar flags);
|
||||||
void IdtHandler(ulong intNo);
|
//void IdtHandler(ulong intNo);
|
||||||
static void EnablePIC(void);
|
static void EnablePIC(void);
|
||||||
void SendEOItoPIC(uchar isr);
|
void SendEOItoPIC(uchar isr);
|
||||||
|
|
||||||
|
@ -200,6 +200,6 @@ void IdtHandler(ulong intNo)
|
|||||||
KeStartPanic("[ISR 0x%x] Irrecoverable %s\n", intNo, exceptionMsg);
|
KeStartPanic("[ISR 0x%x] Irrecoverable %s\n", intNo, exceptionMsg);
|
||||||
} else {
|
} else {
|
||||||
bprintf(BStdOut, "[ISR 0x%x] %s\n", intNo, exceptionMsg);
|
bprintf(BStdOut, "[ISR 0x%x] %s\n", intNo, exceptionMsg);
|
||||||
IoSendEOItoPIC(intNo);
|
//IoSendEOItoPIC(intNo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,18 +52,25 @@ divideByZero:
|
|||||||
;; ISR handler
|
;; ISR handler
|
||||||
;;
|
;;
|
||||||
isrPreHandler:
|
isrPreHandler:
|
||||||
pushAll
|
|
||||||
|
|
||||||
xor rax, rax
|
|
||||||
mov ax, ds
|
mov ax, ds
|
||||||
push rax
|
push rax
|
||||||
|
|
||||||
|
mov ax, 0x0
|
||||||
|
mov ds, ax
|
||||||
|
mov es, ax
|
||||||
|
mov fs, ax
|
||||||
|
mov gs, ax
|
||||||
|
|
||||||
call IdtHandler
|
call IdtHandler
|
||||||
|
|
||||||
pop rax
|
pop rbx
|
||||||
mov ds, ax
|
mov ds, bx
|
||||||
|
mov es, bx
|
||||||
|
mov fs, bx
|
||||||
|
mov gs, bx
|
||||||
|
|
||||||
popAll
|
popAll
|
||||||
|
add rsp, 8
|
||||||
sti
|
sti
|
||||||
iretq
|
iretq
|
||||||
|
|
||||||
|
@ -21,6 +21,9 @@
|
|||||||
; You should have received a copy of the GNU General Public License ;
|
; You should have received a copy of the GNU General Public License ;
|
||||||
; along with OS/K. If not, see <https://www.gnu.org/licenses/>. ;
|
; along with OS/K. If not, see <https://www.gnu.org/licenses/>. ;
|
||||||
;=----------------------------------------------------------------------------=;
|
;=----------------------------------------------------------------------------=;
|
||||||
|
|
||||||
|
[BITS 64]
|
||||||
|
|
||||||
%macro pushAll 0
|
%macro pushAll 0
|
||||||
push rax
|
push rax
|
||||||
push rcx
|
push rcx
|
||||||
@ -42,17 +45,22 @@
|
|||||||
%endmacro
|
%endmacro
|
||||||
|
|
||||||
%macro IsrWithoutErrCode 1
|
%macro IsrWithoutErrCode 1
|
||||||
global isr%1
|
global isr%1
|
||||||
isr%1:
|
isr%1:
|
||||||
cli
|
cli
|
||||||
|
push byte 0
|
||||||
|
pushAll
|
||||||
|
xor rdi, rdi
|
||||||
mov rdi, %1
|
mov rdi, %1
|
||||||
jmp isrPreHandler
|
jmp isrPreHandler
|
||||||
%endmacro
|
%endmacro
|
||||||
|
|
||||||
%macro IsrWithErrCode 1
|
%macro IsrWithErrCode 1
|
||||||
global isr%1
|
global isr%1
|
||||||
isr%1:
|
isr%1:
|
||||||
cli
|
cli
|
||||||
|
pushAll
|
||||||
|
xor rdi, rdi
|
||||||
mov rdi, %1
|
mov rdi, %1
|
||||||
jmp isrPreHandler
|
jmp isrPreHandler
|
||||||
%endmacro
|
%endmacro
|
||||||
|
@ -94,12 +94,14 @@ noreturn void BtStartKern(multiboot_info_t *mbInfo, uint mbMagic, void *codeSeg)
|
|||||||
|
|
||||||
IoPrintRtcTime();
|
IoPrintRtcTime();
|
||||||
|
|
||||||
KernLog("There was %d ticks\n", IoGetRtcTicks());
|
/* KernLog("There was %d ticks\n", IoGetRtcTicks()); */
|
||||||
for (uint i = 1; i < 10 ; i++) {
|
/* for (uint i = 1; i < 2 ; i++) { */
|
||||||
while (IoGetRtcTicks() < i * 10000) {
|
/* while (IoGetRtcTicks() < i * 10000) { */
|
||||||
}
|
/* } */
|
||||||
IoPrintRtcTime();
|
/* IoPrintRtcTime(); */
|
||||||
}
|
/* } */
|
||||||
|
long var = -1;
|
||||||
|
KernLog("salut : %s", var);
|
||||||
|
|
||||||
KernLog("Goodbye after %d ticks\n", IoGetRtcTicks());
|
KernLog("Goodbye after %d ticks\n", IoGetRtcTicks());
|
||||||
// End this machine's suffering
|
// End this machine's suffering
|
||||||
|
Loading…
Reference in New Issue
Block a user