VBE Modes causes weird behaviour in Bochs
Posted: Wed Jan 15, 2014 2:50 pm
Hi,
I've a strange problem. I've added basic support for VESA/VBE. In the 16bits part of my kernel I'm iterating through VBE modes to find the most adapted to me, like that:
(I know that testing all the modes is not a good solution, but for now I haven't been able to use the far ptr to the modes memory in C++)
It works well under Qemu, but under Bochs it seems that it screws interrupt somehow. The keyboard interrupt are not caught or perhaps not even thrown, which means I got errors regarding internal buffer full. But the PIT interrupts are caught correctly, it seems that it is only the keyboard interrupts.
Only the listing screws Bochs, it is not necessary to enable it to see this behavior.
May that be a bug in Bochs ? Is there something wrong with my code ?
Thanks
I've a strange problem. I've added basic support for VESA/VBE. In the 16bits part of my kernel I'm iterating through VBE modes to find the most adapted to me, like that:
Code: Select all
for(uint16_t mode = 0; mode != 0xFFFF; ++mode){
asm volatile ("int 0x10"
: "=a"(return_code)
: "a"(0x4F01), "c"(mode), "D"(&vesa::mode_info_block)
: "memory");
//Make sure the mode is supported by get mode info function
if(return_code != 0x4F){
continue;
}
//Check that the mode support Linear Frame Buffer
if(!bit_set(vesa::mode_info_block.mode_attributes, 7)){
continue;
}
//Make sure it is a packed pixel or direct color model
if(vesa::mode_info_block.memory_model != 4 && vesa::mode_info_block.memory_model != 6){
continue;
}
if(vesa::mode_info_block.bpp != DEFAULT_BPP){
continue;
}
one = true;
auto x_res = vesa::mode_info_block.width;
auto y_res = vesa::mode_info_block.height;
auto size_diff = abs_diff(x_res, DEFAULT_WIDTH) + abs_diff(y_res, DEFAULT_HEIGHT);
if(size_diff < best_size_diff){
best_mode = mode;
best_size_diff = size_diff;
}
}
It works well under Qemu, but under Bochs it seems that it screws interrupt somehow. The keyboard interrupt are not caught or perhaps not even thrown, which means I got errors regarding internal buffer full. But the PIT interrupts are caught correctly, it seems that it is only the keyboard interrupts.
Only the listing screws Bochs, it is not necessary to enable it to see this behavior.
May that be a bug in Bochs ? Is there something wrong with my code ?
Thanks