Skip to contentSkip to conversation

All variants of ADDSUBX, SUBADDX give incorrect results

Qemu-devel Bradley Smith 3 participants 7 messages Jun 18, 2010 – Jul 29, 2010

lore
Share & tools
lore
#0 lore raw

Public bug reported:

All variants of the ADDSUBX/SUBADDX instructions seem to be implemented incorrectly, i.e.

    MOV r12, #0
    LDR r0, =0x18004800
    LDR r1, =0x30006000
    QADDSUBX r12, r0, r1    ; Should give 0x78001800 - gives 0x4800e800

This happens with latest git HEAD.

** Affects: qemu
Importance: Undecided
Status: New

Signature · 16 lines
[ARM] All variants of ADDSUBX,SUBADDX give incorrect results
https://bugs.launchpad.net/bugs/595906
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.

Status in QEMU: New

Bug description:
All variants of the ADDSUBX/SUBADDX instructions seem to be implemented incorrectly, i.e.

    MOV r12, #0
    LDR r0, =0x18004800
    LDR r1, =0x30006000
    QADDSUBX r12, r0, r1    ; Should give 0x78001800 - gives 0x4800e800

This happens with latest git HEAD.
#1 lore raw

I have been able to reproduce this issue using the attached C file on a custom arm1136-based qemu device, with latest git HEAD as of about 15 minutes ago. Running my test program on real hardware -- an arm1176-based board, and a cortex-a8-based board -- produces the desired result (0x78001800).

I'll try to investigate further, but it may take me a while to find a fix because I haven't spent much time looking at qemu's lower level instruction translation code. If someone with experience in this area can devise a fix more quickly, then I can help test.

** Attachment added: "Test code to reproduce the bug"
http://launchpadlibrarian.net/50548546/test.c

Signature · 16 lines
[ARM] All variants of ADDSUBX,SUBADDX give incorrect results
https://bugs.launchpad.net/bugs/595906
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.

Status in QEMU: New

Bug description:
All variants of the ADDSUBX/SUBADDX instructions seem to be implemented incorrectly, i.e.

    MOV r12, #0
    LDR r0, =0x18004800
    LDR r1, =0x30006000
    QADDSUBX r12, r0, r1    ; Should give 0x78001800 - gives 0x4800e800

This happens with latest git HEAD.
#2 lore raw
In reply to Bradley Smith

The addsub/subadd implemetation is incorrect. The patch can fixed it and is verified by Chris's test case

** Patch added: "target-arm: fix addsub/subadd implementation"
http://launchpadlibrarian.net/50552359/0001-target-arm-fix-addsub-subadd-implementation.patch

Signature · 16 lines
[ARM] All variants of ADDSUBX,SUBADDX give incorrect results
https://bugs.launchpad.net/bugs/595906
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.

Status in QEMU: New

Bug description:
All variants of the ADDSUBX/SUBADDX instructions seem to be implemented incorrectly, i.e.

    MOV r12, #0
    LDR r0, =0x18004800
    LDR r1, =0x30006000
    QADDSUBX r12, r0, r1    ; Should give 0x78001800 - gives 0x4800e800

This happens with latest git HEAD.
#3 lore raw
In reply to Bradley Smith

I tested Chih-Min's patch with my local git clone, and I can verify that it appears to fix the issue.

Signature · 16 lines
[ARM] All variants of ADDSUBX,SUBADDX give incorrect results
https://bugs.launchpad.net/bugs/595906
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.

Status in QEMU: New

Bug description:
All variants of the ADDSUBX/SUBADDX instructions seem to be implemented incorrectly, i.e.

    MOV r12, #0
    LDR r0, =0x18004800
    LDR r1, =0x30006000
    QADDSUBX r12, r0, r1    ; Should give 0x78001800 - gives 0x4800e800

This happens with latest git HEAD.
#4 lore raw
In reply to Bradley Smith

** Changed in: qemu
Status: New => Confirmed

** Changed in: qemu
Status: Confirmed => In Progress

Signature · 16 lines
[ARM] All variants of ADDSUBX,SUBADDX give incorrect results
https://bugs.launchpad.net/bugs/595906
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.

Status in QEMU: In Progress

Bug description:
All variants of the ADDSUBX/SUBADDX instructions seem to be implemented incorrectly, i.e.

    MOV r12, #0
    LDR r0, =0x18004800
    LDR r1, =0x30006000
    QADDSUBX r12, r0, r1    ; Should give 0x78001800 - gives 0x4800e800

This happens with latest git HEAD.
#5 lore raw
In reply to Bradley Smith

Chih-Min,

I think this fix looks good. Can you submit it to qemu-devel so someone can push it to mainline?

Signature · 16 lines
[ARM] All variants of ADDSUBX,SUBADDX give incorrect results
https://bugs.launchpad.net/bugs/595906
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.

Status in QEMU: In Progress

Bug description:
All variants of the ADDSUBX/SUBADDX instructions seem to be implemented incorrectly, i.e.

    MOV r12, #0
    LDR r0, =0x18004800
    LDR r1, =0x30006000
    QADDSUBX r12, r0, r1    ; Should give 0x78001800 - gives 0x4800e800

This happens with latest git HEAD.
#6 lore raw
In reply to Bradley Smith

The patch has been included in v0.12.5

** Changed in: qemu
Status: In Progress => Fix Released

Signature · 16 lines
[ARM] All variants of ADDSUBX,SUBADDX give incorrect results
https://bugs.launchpad.net/bugs/595906
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.

Status in QEMU: Fix Released

Bug description:
All variants of the ADDSUBX/SUBADDX instructions seem to be implemented incorrectly, i.e.

    MOV r12, #0
    LDR r0, =0x18004800
    LDR r1, =0x30006000
    QADDSUBX r12, r0, r1    ; Should give 0x78001800 - gives 0x4800e800

This happens with latest git HEAD.