AlgorithMan-de / wyoos

Source codes for the "Write your own Operating System" video-series on YouTube
http://wyoos.org
GNU General Public License v3.0
719 stars 222 forks source link

Tutorial 5: Error when executing 'asm("sti");' #14

Open jj01101010 opened 4 years ago

jj01101010 commented 4 years ago

If i execute the line you see above. VirtualBox is crashing and spamming my terminal with many lines but i dont know 1. Why it is crashing and 2. How can I fix this crash

Pls help me i am lost

jj01101010 commented 4 years ago

But i have to say your tutorial series is GREAT pls never leave this project

sgermain06 commented 3 years ago

Hey, I have the same problem. If I comment out the sti call, it doesn't crash, but if I don't, as soon as it calls it, VirtualBox crashes. Were you ever able to fix this? Anyone can help?

sgermain06 commented 3 years ago

Ah! I found out what was happening. In my gdt constructor, I had inverted the indexes of the array I sent to the lgdt command. After I switched those around, it stopped crashing. Now, I have another problem though. When I call sti, not only I don't receive any interrupt calls to my HandleInterrupt function, but after like 5-10 seconds, my screens clear and fills with some weird characters. I'm trying to compare my code with the code in this git repository and, so far, I seem to be matching. I'm sure I'm missing something stupid...

sgermain06 commented 3 years ago

Yeah, I found what I did. In the interrupts.cpp, I set the handlerAddressLowBits twice instead of setting the handlerAddressLowBits and handlerAddressHighBits. Everything is working fine now.

fluecs commented 3 years ago

Same issue. Can't seem to fix it.

M1sterPl0w commented 2 years ago

@HayJayDee @Ilc-Ilia-Developer Is it possible to show your code? Maybe I can take a look.

StjepanBM1 commented 1 year ago

Does anyone know how to fix this issue?

ssagar-linux commented 1 year ago

I resolved following issue via:- -GlobalDescriptorTable::SegmentDescriptor::SegmentDescriptor(uint32_t limit, uint32_t base , uint8_t type) +GlobalDescriptorTable::SegmentDescriptor::SegmentDescriptor(uint32_t base, uint32_t limit, uint8_t type)

mistakenly using base & limit interchangeably

yutojama commented 6 months ago
  1. check out constructor of GlobalDescriptorTable(), make sure i[0] = sizeof(GlobalDescriptorTable) << 16; i[1] = (uint32_t) i[2];
  2. check all structs with attribute((packed)), make sure everything is placed just in the order as tutorial and nothing is randomly swapped. For me, I changed sequence of size and base in InterruptDescriptorTablePointer and that led to error.