Good morning my dear friends.
I am trying to compile and run one of the many excellent toturials I have found out there about developing operating systems. However, I always face the same problem.
(the code can be found at <https://github.com/zecarlos1957/LearnOS>)
When an interruption occurs, the processor resets and the process restarts.
To confirm my prediction, I will unmask timer interrupt 0 in the idt.cpp file with the instruction
io :: outb (PIC_MASTER_DATA, 0x1). So it only restarts when I press a key.
This appears to be because the call to the interruption entry point does not jump to the correct address, but I cannot find the reason for this. Can you help me to solve this difficulty?
Thank you for your attention.
Along with the result of BochsDBG that executes all the code and when it is in the infinite loop after leaving kmain, there is an interruption that resets the processor.
========================================================================
Bochs x86 Emulator 2.6.9
Built from SVN snapshot on April 9, 2017
Compiled on Apr 9 2017 at 09:49:25
========================================================================
00000000000i[ ] reading configuration from bochsrc.txt
00000000000e[ ] bochsrc.txt:736: ataX-master/slave CHS set to 0/0/0 - autodetection enabled
00000000000i[ ] installing win32 module as the Bochs GUI
00000000000i[ ] using log file bochsout.txt
Next at t=0
(0) [0x0000fffffff0] f000:fff0 (unk. ctxt): jmpf 0xf000:e05b ; ea5be000f0
<bochs:1> lb 0x100027
<bochs:2> c
(0) Breakpoint 1, 0x0000000000100027 in ?? ()
Next at t=63796793
(0) [0x000000100027] 0008:0000000000100027 (unk. ctxt): jmp .-2 (0x00100027) ; ebfe
<bochs:3> s
Next at t=63796794
(0) [0x000000100027] 0008:0000000000100027 (unk. ctxt): jmp .-2 (0x00100027) ; ebfe
<bochs:4> c
(0) Breakpoint 1, 0x0000000000100027 in ?? ()
Next at t=63796795
(0) [0x000000100027] 0008:0000000000100027 (unk. ctxt): jmp .-2 (0x00100027) ; ebfe
<bochs:5> del 1
<bochs:6> c
(0).[65915658] [0x000000100027] 0008:0000000000100027 (unk. ctxt): jmp .-2 (0x00100027) ; ebfe
Next at t=65915659
(0) [0x0000fffffff0] f000:fff0 (unk. ctxt): jmpf 0xf000:e05b ; ea5be000f0
<bochs:7>
Problems with Interrupts
Re: Problems with Interrupts
Perhaps an email to the author of this "tutorial" (although it just seems to be code, not a tutorial)? They are best placed to test the code with the information that you give.
Re: Problems with Interrupts
Your problem is in file https://github.com/zecarlos1957/LearnOS ... Stage2.asm on line:
HLT command halt CPU only to next interrupt, so if interrupt is call, CPU try to execute commands after HLT what in your code make reboot. Solution is very easy:
Now your handlers should call right. I use same way in my OS.
Code: Select all
cli
hlt
Code: Select all
;we don't want disable interrupts! cli command should be erased
halt:
hlt ;halt CPU to next interrupt
jmp halt
Re: Problems with Interrupts
Thank you for your observation KLAKAP
Your analysis makes perfect sense, that will be one of the problems I have already addressed, but it continues to do the same. I'm going back to BochsDBG.
Your analysis makes perfect sense, that will be one of the problems I have already addressed, but it continues to do the same. I'm going back to BochsDBG.