On 03/02/12 09:09, Gerd Hoffmann wrote:
Hi,
Did some more testing of the vgabios today, two issues popped up:
(1) screen isn't cleared in some cases. Visible with grub1 in text mode. When it displays the menu a few stray chars are visible. Even more obvious it becomes when hitting 'c' then to get a prompt, then alot of the menu is still visible.
(2) The Xorg Server has trouble, the VESA driver doesn't work.
There are also some good news: linux kernel with vesafb active works fine, likewise winxp guests.
Hi Gerd.
I took a look at the issue with Xorg. According to my diagnostic, x86emu (the real-mode emulator that the X server uses) seems to have problems emulating mov instructions that uses segment selectors other than DS and SS.
In lots of places in the vga bios code, we use instructions like mov %cs:(%eax), %ebp to access global variables (mostly when we use the GET_GLOBAL macro). We also might have a problem we use the SET_FARVAR macro because it uses ES.
This issue with segment selector seems to be confirmed by some comments I found in x86emu's code while doing my research: http://cgit.freedesktop.org/xorg/xserver/tree/hw/xfree86/x86emu/decode.c The comment describing the decode_rm00_address function (line 838) seems to imply that only DS or SS can be used.
Kevin, would you see a problem modifying the READx_SEG macros in src/farptr.h to only dereference memory using the DS selector, in the vgabios case ?
For example:
#define READ8_SEG(prefix, SEG, value, var) \ __asm__(prefix "push %%ds\n" \ "movw %%" #SEG " , %%ax\n" \ "movw %%ax, %%ds\n" \ "movb %1, %b0\n" \ "pop %%ds" : "=Qi"(value) \ : "m"(var), "m"(__segment_ ## SEG))
instead of:
#define READ8_SEG(prefix, SEG, value, var) \ __asm__(prefix "movb %%" #SEG ":%1, %b0" : "=Qi"(value) \