reworking on IDT

This commit is contained in:
Adrien Bourmault 2019-04-25 23:09:04 +02:00
parent 93cce54081
commit 59bd638188
5 changed files with 34 additions and 17 deletions

View File

@ -89,7 +89,7 @@ static char *IsrExceptions[32] = {
void IdtRegisterIrq(void (*isr)(void), uchar irq, uchar flags);
void IdtSetup(void);
void IdtSetGate(uchar rank, ulong base, ushort selector, uchar flags);
void IdtHandler(ulong intNo);
//void IdtHandler(ulong intNo);
static void EnablePIC(void);
void SendEOItoPIC(uchar isr);

View File

@ -200,6 +200,6 @@ void IdtHandler(ulong intNo)
KeStartPanic("[ISR 0x%x] Irrecoverable %s\n", intNo, exceptionMsg);
} else {
bprintf(BStdOut, "[ISR 0x%x] %s\n", intNo, exceptionMsg);
IoSendEOItoPIC(intNo);
//IoSendEOItoPIC(intNo);
}
}

View File

@ -52,18 +52,25 @@ divideByZero:
;; ISR handler
;;
isrPreHandler:
pushAll
xor rax, rax
mov ax, ds
push rax
mov ax, 0x0
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
call IdtHandler
pop rax
mov ds, ax
pop rbx
mov ds, bx
mov es, bx
mov fs, bx
mov gs, bx
popAll
add rsp, 8
sti
iretq

View File

@ -21,6 +21,9 @@
; You should have received a copy of the GNU General Public License ;
; along with OS/K. If not, see <https://www.gnu.org/licenses/>. ;
;=----------------------------------------------------------------------------=;
[BITS 64]
%macro pushAll 0
push rax
push rcx
@ -42,17 +45,22 @@
%endmacro
%macro IsrWithoutErrCode 1
global isr%1
isr%1:
global isr%1
isr%1:
cli
push byte 0
pushAll
xor rdi, rdi
mov rdi, %1
jmp isrPreHandler
%endmacro
%macro IsrWithErrCode 1
global isr%1
isr%1:
global isr%1
isr%1:
cli
pushAll
xor rdi, rdi
mov rdi, %1
jmp isrPreHandler
%endmacro

View File

@ -94,12 +94,14 @@ noreturn void BtStartKern(multiboot_info_t *mbInfo, uint mbMagic, void *codeSeg)
IoPrintRtcTime();
KernLog("There was %d ticks\n", IoGetRtcTicks());
for (uint i = 1; i < 10 ; i++) {
while (IoGetRtcTicks() < i * 10000) {
}
IoPrintRtcTime();
}
/* KernLog("There was %d ticks\n", IoGetRtcTicks()); */
/* for (uint i = 1; i < 2 ; i++) { */
/* while (IoGetRtcTicks() < i * 10000) { */
/* } */
/* IoPrintRtcTime(); */
/* } */
long var = -1;
KernLog("salut : %s", var);
KernLog("Goodbye after %d ticks\n", IoGetRtcTicks());
// End this machine's suffering