#1278 closed defect (fixed)

(cpu.c for sparc) _CPU_ISR_install_raw_handler returns incorrect value

Reported by: Alexandru Bugnar Owned by: Joel Sherrill
Priority: normal Milestone: 4.9
Component: score Version: 4.6
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description

Version of RTEMS: 4.6.6

CPU family: SPARC

CPU model: Leon2 (irrelevant for the issue at hand)

File: cpukit/score/cpu/sparc/cpu.c

Desired run-time behavior:
When installing a new raw trap handler using the _CPU_ISR_install_raw_handler function it should set the old_handler to the value corresponding to the previous trap handler (the one that is about to be replaced). Of course, this should only happen if the entry in the TBR adheres to the RTEMS model.

Description of the problem:
The value returned as the address of previous handler is incorrect.

Reason:
The code makes erroneous bit processing thus altering the correct value that must be returned. The code actually masks some bits that are not supposed to be masked. The value that is processed represents a sethi instruction and the code is meant to extract the value of the 22 bits given as an argument to the instruction.

Format of the sethi instruction (as stated in the Sparc V8 manual):
0 0 | X X X X X | 1 0 0 | X X X X X X | X X X X X X X X | X X X X X X X X |

  • 00 and 100 are the operation codes for "sethi"
  • the 5bit field after 00 represent the destination register (in our case it is %l4)
  • the rest of the bits are the 22bit value to be loaded in the register

Note: The issue seams to be present in the latest release also (4.8)

Please find attached a patch containing the suggested fix for this issue.

Attachments (1)

sparc-cpu-patch (516 bytes) - added by Alexandru Bugnar on 02/19/08 at 10:18:51.
Suggested fix for the issue at hand

Download all attachments as: .zip

Change History (2)

Changed on 02/19/08 at 10:18:51 by Alexandru Bugnar

Attachment: sparc-cpu-patch added

Suggested fix for the issue at hand

comment:1 Changed on 02/20/08 at 20:54:47 by Joel Sherrill

Resolution: fixed
Status: newclosed

Patch applied to 4.7, 4.8, and CVS trunk.

Note: See TracTickets for help on using tickets.