qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v4 1/4] Add moxie target code


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH v4 1/4] Add moxie target code
Date: Thu, 28 Feb 2013 17:35:40 +0000

On 28 February 2013 17:30, Anthony Green <address@hidden> wrote:
> On Thu, Feb 28, 2013 at 6:06 AM, Peter Maydell <address@hidden> wrote:
>> On 27 February 2013 22:09, Anthony Green <address@hidden> wrote:
>>> +        case 0x31: /* div.l */
>>> +            {
>>> +                int a = (opcode >> 4) & 0xf;
>>> +                int b = opcode & 0xf;
>>> +                tcg_gen_div_i32(REG(a), REG(a), REG(b));
>>
>> Didn't Richard mention the problem of exceptions on division
>> in review of an earlier version of this patch?
>
> Current hardware doesn't trap on divide by zero, so I don't mind this
> failing now.  The exception processing mechanism will be implemented
> soon at which time I'll clean this up.

No, you must avoid generating TCG code which can do undefined
things, even if your CPU's divide instruction does not throw
an exception. In fact, especially if your CPU's divide insn
doesn't throw an exception. Otherwise QEMU could just blow up
when trying to execute buggy or malicious guest code.

-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]