qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fabrice Bellard <fabrice@bellard.org>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Patch to fix Mac OS X compilation
Date: Mon, 21 Feb 2005 19:58:12 +0100	[thread overview]
Message-ID: <421A2F44.9040304@bellard.org> (raw)
In-Reply-To: <87491237e8d0eaafae0d0da9f45799de@elis.ugent.be>

Jonas Maebe wrote:
> 
> On 19 feb 2005, at 21:00, Jonas Maebe wrote:
> 
>> And again a more improved patch (I think). This one includes a special 
>> case/hack for Mac OS X for __op_gen_label. Now qemu doesn't crash 
>> anymore when trying to boot freedos, but it doesn't show anything 
>> either. I just get a black screen. The same goes for reactos, so I 
>> guess it's some endless loop while emulating the bios or so.
> 
> 
> Here's the semi-final fix (stupid bug in my previous patch). FreeDos can 
> now boot, so long as you do not load any drivers. The reason is that the 
> emulation of the loope instruction goes wrong, and that instruction is 
> used in himem.sys (but does not occur when booting without it). The 
> problem is that this is the assembler code generated by gcc for op_loopzw:
> 
> 0x74370 <op_loopzw>:    mflr    r0
> 0x74374 <op_loopzw+4>:  stw     r0,8(r1)
> 0x74378 <op_loopzw+8>:  stwu    r1,-64(r1)
> 0x7437c <op_loopzw+12>: lwz     r0,48(r27)
> 0x74380 <op_loopzw+16>: rlwinm  r0,r0,3,0,28
> 0x74384 <op_loopzw+20>: lis     r2,12
> 0x74388 <op_loopzw+24>: lwz     r2,-16636(r2)
> 0x7438c <op_loopzw+28>: lwzx    r12,r2,r0
> 0x74390 <op_loopzw+32>: mtctr   r12
> 0x74394 <op_loopzw+36>: bctrl
> 0x74398 <op_loopzw+40>: lhz     r0,6(r27)
> 0x7439c <op_loopzw+44>: cmpwi   cr7,r0,0
> 0x743a0 <op_loopzw+48>: beq-    cr7,0x743b0 <op_loopzw+64>
> 0x743a4 <op_loopzw+52>: andi.   r0,r3,64
> 0x743a8 <op_loopzw+56>: beq-    0x743b0 <op_loopzw+64>
> 0x743ac <op_loopzw+60>: b       0x296eb0 <__op_gen_label1>
> 0x743b0 <op_loopzw+64>: lwz     r0,72(r1)
> 0x743b4 <op_loopzw+68>: addi    r1,r1,64
> 0x743b8 <op_loopzw+72>: mtlr    r0
> 
> 
> At address 0x743ac, the branch to __op_gen_label1 gets patched so it 
> points to the basic block coming after the loopzw. In that case, LR does 
> not get restored (it was destroyed at 0x74394 by the bctrl), so the next 
> blr which gets executed returns to 0x74398. This causes an endless loop, 
> obviously.
> 
> This does not seem to be Mac OS X-specific at all, and should also 
> happen under Linux/ppc I think.

I do not see in your patch any fix for the PARAMn bug. The symptom is:

translate.c:x: error: too many arguments to function `gen_op_xxx'
translate.c:x: warning: initialization from incompatible pointer type

I am using gcc 3.3. The problem is related to the fact that 
'__op_paramN' is no longer exported in the symbol table.

Fabrice.

  reply	other threads:[~2005-02-21 19:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-12 20:47 [Qemu-devel] Patch to fix Mac OS X compilation Jonas Maebe
2005-02-13 13:30 ` Daniel Egger
2005-02-13 14:36   ` Jonas Maebe
2005-02-13 14:30 ` Jonas Maebe
2005-02-19 20:00   ` Jonas Maebe
2005-02-20 14:29     ` Jonas Maebe
2005-02-21 18:58       ` Fabrice Bellard [this message]
2005-02-21 19:36         ` Jonas Maebe
2005-02-21 19:43           ` Jonas Maebe
2005-02-21 20:08           ` Fabrice Bellard
2005-02-21 20:29             ` Jonas Maebe
2005-02-21 20:27       ` Fabrice Bellard
2005-02-21 20:58         ` Jonas Maebe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=421A2F44.9040304@bellard.org \
    --to=fabrice@bellard.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).