hercules-390 / hyperion

Hercules 390
Other
251 stars 70 forks source link

Bugs in ieee.c in instructions CFEBR(A), CFDBR(A), CGEBR(A), CGDBR(A) #278

Open OxFF-Alex opened 4 years ago

OxFF-Alex commented 4 years ago

Hercules: version 4.0.0 (4.0.0.8871), last commit SHA: bec74e3a3dc26acb251eb820b3aeafcee0576b88 Host: Linux 5.0.0-32-generic #34~18.04.2-Ubuntu SMP Thu Oct 10 10:36:02 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux Description: Ubuntu 18.04.2 LTS Codename: bionic

Bug description:

In instructions CFEBR(A), CFDBR(A), CGEBR(A), CGDBR(A) a pair check BFPREGPAIR_CHECK(r2, regs) should not be performed.

Details information:

According to z/Architecture Principes of Operation, оnly CFXBR(A) and CGXBR(A) instructions must have this check: "For CFXBR, CFXBRA, CGXBR and CGXBRA, the R2 field must designate a valid floating-point-register pair; otherwise, a specification exception is recognized".

The bug happened during installation Ubuntu 18.10 cosmic on hercules4. After 94% оf installation was completed, i received the following error:

Oct 23 12:09:10 kernel: [ 7006.990987] User process fault: interruption code 0006 ilc:2 in python3.6[1000000+3e9000] Oct 23 12:09:10 kernel: [ 7006.991197] CPU: 0 PID: 21310 Comm: python3.6 Not tainted 4.18.0-10-generic #11-Ubuntu Oct 23 12:09:10 kernel: [ 7006.991216] Hardware name: HRC 9672 EMULATOR EMULATOR (LPAR) Oct 23 12:09:10 kernel: [ 7006.991241] User PSW : 00000000f8aa7f89 000000004870d5ad Oct 23 12:09:10 kernel: [ 7006.991288] R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:1 AS:0 CC:1 PM:0 RI:0 EA:3 Oct 23 12:09:10 kernel: [ 7006.991335] User GPRS: ffffffff00000031 000003ff86c5b8ea 000003ff86c5b8e9 0000000000000000 Oct 23 12:09:10 kernel: [ 7006.991362] 0000000000000039 0000000000000000 0000000001404134 000003ff86c5b8ea Oct 23 12:09:10 kernel: [ 7006.991385] 000003ff86c5b8b0 000000000000000a 000003ff86c5b8b7 0000000000000050 Oct 23 12:09:10 kernel: [ 7006.991409] 00000000014916f0 0000000001284b90 1ffffffffffffff9 000003ffea17bc60 Oct 23 12:09:10 kernel: [ 7006.991537] User Code: 00000000010af5ac: a7240bbf brc 2,10b0d2a Oct 23 12:09:10 kernel: [ 7006.991537] 00000000010af5b0: e3e0d0280004lg %r14,40(%r13) Oct 23 12:09:10 kernel: [ 7006.991537] #00000000010af5b6: b3a950c7 cgdbra %r12,5,%f7,0 Oct 23 12:09:10 kernel: [ 7006.991537] >00000000010af5ba: e3c0f0c00024stg %r12,192(%r15) Oct 23 12:09:10 kernel: [ 7006.991537] 00000000010af5c0: ecce0bb52064cgrj %r12,%r14,2,10b0d2a Oct 23 12:09:10 kernel: [ 7006.991537] 00000000010af5c6: ec4c000600d9aghik %r4,%r12,6 Oct 23 12:09:10 kernel: [ 7006.991537] 00000000010af5cc: eb240002000dsllg %r2,%r4,2 Oct 23 12:09:10 kernel: [ 7006.991537] 00000000010af5d2: c0e5fffdcc2bbrasl %r14,1068e28 Oct 23 12:09:10 kernel: [ 7006.992013] Last Breaking-Event-Address: Oct 23 12:09:10 kernel: [ 7006.992045] [<00000000010af57a>] 0x10af57a Oct 23 12:09:10 in-target: Illegal instruction Oct 23 12:09:10 in-target: dpkg: error processing package python3-asn1crypto (--configure): Oct 23 12:09:10 in-target: installed python3-asn1crypto package post-installation script subprocess returned error exit status 132

A similar error, but with a more detailed description of the exception (“Specification exception”) was printed by Hercules (and this message helped me find the bug):

HHC00801I Processor CP00: Specification exception code 0006 ilc 4
HHC02324I CP00: PSW=0705100180000000 00000000010AF5BA INST=B3A950C7 CGDBR 12,5,7 convert_bfp_long_to_fix64_reg

I fixed this bug locally by comment four lines BFPREGPAIR_CHECK(r2, regs) in ieee.c in CFEBR(A), CFDBR(A), CGEBR(A) and CGDBR(A) instructions, and Ubuntu installation succeeded.