Functions cause HLT (Or simular lockup)
-
- Posts: 21
- Joined: Tue Mar 24, 2009 10:59 am
Functions cause HLT (Or simular lockup)
As stated in a previous post, I'm trying to write a very basic x86_64 kernel. In this kernel, I tried making a function to write text out to the buffer. Problem is: Calling any functions, from inside that file, from an external file, in any way at all, causes the kernel to lock up. Does anyone have any suggestions?
Re: Functions cause HLT (Or simular lockup)
Did you set up a stack?
Every good solution is obvious once you've found it.
-
- Posts: 21
- Joined: Tue Mar 24, 2009 10:59 am
Re: Functions cause HLT (Or simular lockup)
My luck with premade x86_64 code has been.... well, there's a lack of any luck. I reworked some x86 code and whatnot and got things working. Maybe I was wrong about the lack of example code being a bad thing when it only works sometimes after all
Re: Functions cause HLT (Or simular lockup)
It would go a long way to provide the end of a bochs debugging run.
It's very vague to say "locked up".
It could be your stack, your ELF not being properly/fully loaded (or to the right place), interrupts being enabled without any real IDT setup, or any other fault with the emulator not set to reboot/exit. =)
It's very vague to say "locked up".
It could be your stack, your ELF not being properly/fully loaded (or to the right place), interrupts being enabled without any real IDT setup, or any other fault with the emulator not set to reboot/exit. =)
Website: https://joscor.com
Re: Functions cause HLT (Or simular lockup)
How can you know that it is exactly HLT instruction? Can it be loop without exit point? I am asking you, because there is no instructions except HLT which causes such effect. If it is really loop without exit point then just check you code (maybe you lost something little ).
PS: It will be much better to most of repliers to see the code themself.
Daniel.
PS: It will be much better to most of repliers to see the code themself.
Daniel.
Don't think a ****, but in ukrainian schools English is TOO BAD!
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Functions cause HLT (Or simular lockup)
Any form of infinite loop will appear like a lockup to the end user.
so, you can HLT, while(1);, or get into an exception loop. If your HLTs are prefixed with a CLI, bochs will complain whenever a halt state is entered.
If bochs doesn't complain, 9 out of 10 chance an unintended lockup is an exception loop.
so, you can HLT, while(1);, or get into an exception loop. If your HLTs are prefixed with a CLI, bochs will complain whenever a halt state is entered.
If bochs doesn't complain, 9 out of 10 chance an unintended lockup is an exception loop.
-
- Posts: 21
- Joined: Tue Mar 24, 2009 10:59 am
Re: Functions cause HLT (Or simular lockup)
I still haven't figured out the problem, but the issue has SOMETHING to do with it being compiled as 64-bit. I rewrote the code- basically, I can select 2 targets now, x86 and x86_64, and the x86_64 version has the same code, plus an aout kludge. Of course I'm not expecting this to fully work, and it still gives me crashes (Even crashes big enough to take Windows down too), but it compiles. I plan to target just x86_64 in the future, but it couldn't hurt to work in x86 until someone can make a x86_64 bare bones that works (I really like the ZOmB project, but the code does not work, atleast for my tools. It tosses errors about there not being enough memory so it cuts out some of the ASM, which of course, leads to a bad file) I'm just looking for a simple x86_64 barebones, nothing as fancy as ZOmB anyway, just something that boots then loads long mode using as little code as possible.
Oh, and also, I use VirtualBox, not Bochs. It doesn't offer debugging, but it seems to be a very stable VM.
Oh, and also, I use VirtualBox, not Bochs. It doesn't offer debugging, but it seems to be a very stable VM.