I'm trying to set a video mode by returning to real-mode and issuing an interrupt.
It works well under all VMs I've tried, but Bochs just hangs in the interrupt handler without returning. I also get the following line spammed in the logfile:
io write to address 00000000, len=2
The steps I've taken to return to real-mode are:
0) cli
1) copy some 16-bit code to a low address
2) far-jump to that code on a 16-bit, 64k-limit code segment
3) clear first bit of cr0
4) far-jump to the next instruction
5) set proper real-mode segment register values
5) reset IDT & GDT to the real-mode defaults
6) set proper real-mode segment register values again (don't know if it's needed)
7) issue an interrupt
I'll appreciate it if anyone points out any mistakes I've made or any Bochs-gotchas that could be causing this behaviour. Thanks
Can't use interrupts after returning to realmode under Bochs
- Masterkiller
- Member
- Posts: 153
- Joined: Sat May 05, 2007 6:20 pm
Re: Can't use interrupts after returning to realmode under B
Hi,
I think you might end up with a 32-bit stack (where "push byte 0x00" decreases SP by 4). Try this to see:
0) cli
1) copy some 16-bit code to a low address
2) far-jump to that code on a 16-bit, 64k-limit code segment
3) load 16-bit data segment registers (especially SS)
4) clear first bit of cr0
5) far-jump to the next instruction
6) set proper real-mode segment register values
7) reset IDT to the real-mode default (don't worry about the GDT)
8 ) issue an interrupt
Cheers,
Brendan
I think you might end up with a 32-bit stack (where "push byte 0x00" decreases SP by 4). Try this to see:
0) cli
1) copy some 16-bit code to a low address
2) far-jump to that code on a 16-bit, 64k-limit code segment
3) load 16-bit data segment registers (especially SS)
4) clear first bit of cr0
5) far-jump to the next instruction
6) set proper real-mode segment register values
7) reset IDT to the real-mode default (don't worry about the GDT)
8 ) issue an interrupt
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
You could also compare your code to my vesa demos, as the does what you want to do.
http://www.dex4u.com/demos/VesaDemo.zip
http://www.dex4u.com/demos/VesaDemo.zip
Re: Can't use interrupts after returning to realmode under B
Thanks Brendan! The problem was indeed stack-related,it's fixed now, and the interrupt returns just fineBrendan wrote:Hi,
I think you might end up with a 32-bit stack
Brendan
...except that it doesn't much more than that
Doesn't crash, doesn't print anything to the logfile, and worst of all, doesn't change video-modes
Any ideas on this one?
Thanks