I've modified library. Since I'm very limited in hardware resources, I
can't test it on FC.
I won't commit modifications untill them work.

2014-05-10 17:06 GMT+04:00, Wolf Ramovsky <[email protected]>:
> Hi Martin
>
> Big thanks for your investigation. It helped me to find potential
> solution. Support of lea instuction was implemented in x.org x86emu
> library (see [1]), but haven't ported to *BSD lib ([2]).
> I'm going to port patch now.
>
> [1]
> http://cgit.freedesktop.org/xorg/xserver/commit/hw/xfree86/x86emu?id=f57bc0ede8e018c7e264b917927c42a018cd1d5a
> [2]
> http://bazaar.launchpad.net/~wolf-ramovsky/helenos/libx86emu/view/head:/uspace/lib/x86emu/x86emu.c#L2146
>
> 2014-05-10 2:43 GMT+04:00, Martin Decky <[email protected]>:
>> Hi Wolf,
>>
>>> Surprisingly, the mode setting code failed in my QEMU (in Fedora 19 and
>>> Fedora 20) with the following messages:
>>>
>>> rdb: address unknown 0x00002fda
>>> rdb: address unknown 0xc11e0000
>>> Mode 0xc112 unsupported
>>>
>>> I have checked and the VESA mode 0x112 is supported by the VESA BIOS in
>>> my QEMU (and works correctly if set by GRUB). Below is the list of the
>>> package versions if you would like to reproduce it (I'll try to look
>>> into it as well, again as time permits):
>>>
>>> qemu-system-x86-1.6.2-4.fc20.x86_64
>>> seavgabios-bin-1.7.3.1-2.fc20.noarch
>>>
>>> qemu-system-x86-1.4.2-15.fc19.x86_64
>>> seavgabios-bin-1.7.2.2-3.fc19.noarch
>>
>> I have done some further investigation. With newer VGA SeaBIOS from
>> upstream (post-1.7.4) there are no longer the messages about unknown
>> addresses, but the VESA mode stays undetected.
>>
>> I believe this might be related to the following changeset that speaks
>> about older versions of x86emu and the emulation of the leal
>> instructions:
>>
>> http://code.coreboot.org/p/seabios/source/commit/8032b8a0fec550de5cb2f7d37aa031cebc2200c3/
>>
>> Just my 2 cents.
>>
>>
>> M.D.
>>
>> _______________________________________________
>> HelenOS-devel mailing list
>> [email protected]
>> http://lists.modry.cz/listinfo/helenos-devel
>>
>
=== modified file 'uspace/lib/x86emu/x86emu.c'
--- uspace/lib/x86emu/x86emu.c	2014-04-28 04:33:08 +0000
+++ uspace/lib/x86emu/x86emu.c	2014-05-10 14:31:24 +0000
@@ -2149,21 +2149,25 @@
 static void
 x86emuOp_lea_word_R_M(struct x86emu *emu)
 {
-	uint16_t *srcreg;
 	uint32_t destoffset;
 
-/*
- * TODO: Need to handle address size prefix!
- *
- * lea  eax,[eax+ebx*2] ??
- */
 	fetch_decode_modrm(emu);
 	if (emu->cur_mod == 3)
 		x86emu_halt_sys(emu);
 
-	srcreg = decode_rh_word_register(emu);
-	destoffset = decode_rl_address(emu);
-	*srcreg = (uint16_t) destoffset;
+	if (emu->x86.mode & SYSMODE_PREFIX_ADDR) {
+		uint32_t *srcreg;
+		
+		srcreg = decode_rh_long_register(emu);
+		destoffset = decode_rl_address(emu);
+		*srcreg = (uint32_t) destoffset;
+	} else {
+		uint16_t *srcreg;
+		
+		srcreg = decode_rh_word_register(emu);
+		destoffset = decode_rl_address(emu);
+		*srcreg = (uint16_t) destoffset;
+	}
 }
 
 /*

_______________________________________________
HelenOS-devel mailing list
[email protected]
http://lists.modry.cz/listinfo/helenos-devel

Reply via email to