ports/50850: -march=pca56 blows up nethack34-nox11

Dave friend at vortex4.net
Sat Apr 12 09:10:08 UTC 2003


>Number:         50850
>Category:       ports
>Synopsis:       -march=pca56 blows up nethack34-nox11
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Apr 12 02:10:06 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Dave <friend at vortex4.net>
>Release:        FreeBSD 5.0-RELEASE-p6 alpha
>Organization:
vortex4.net
>Environment:
System: FreeBSD frane.vortex4.net 5.0-RELEASE-p6 FreeBSD 5.0-RELEASE-p6 #2: Tue Mar 25 04:13:12 PST 2003 root at frane.vortex4.net:/usr/src/sys/alpha/compile/FRANE alpha

PC164SX Alpha system
cvsup'ed to current
built & installed world with the following options set in /etc/make.conf:

CPUTYPE?=pca56
CFLAGS= -O -pipe
CXXFLAGS+= -fmemoize-lookups -fsave-memoized
MAKE_SHELL?=sh
COPTFLAGS= -O -pipe
WANT_FORCE_OPTIMIZATION_DOWNGRADE=1

Most notably.  Send me mail if you need the rest of my make.conf
the FRANE kernel pretty much GENERIC minus the hardware that isn't in this box.

>Description:

Built the nethack34-nox11 port.  Builds cleanly, appears to run fine until
after the class/race/alignment selection process (or letting the game
choose), at which point the program exits with "illegal instruction".

Posted this problem to alpha at freebsd.org 3/27/2003.  Ran gdb at the promping
of Andrew Gallatin with the following results:

Shall I pick a character's race, role, gender and alignment for you? [ynq] y(no 
debugging symbols found)...                                                     
Program received signal SIGILL, Illegal instruction.                            
0x1201046d4 in intersect ()                                                     
(gdb) bt                                                                        
#0  0x1201046d4 in intersect ()                                                 
#1  0x1201048c4 in split_rects ()                                               
#2  0x120120550 in create_room ()                                               
#3  0x12009c8b8 in makerooms ()                                                 
#4  0x12009deac in makelevel ()                                                 
#5  0x12009f0d0 in mklev ()                                                     
#6  0x120003f34 in newgame ()                                                   
#7  0x12017288c in main ()                                                      
#8  0x120002704 in _start ()                                                    
#9  0x1601c9944 in _rtld_start () from /usr/libexec/ld-elf.so.1                 
#10 0x1601c9944 in _rtld_start () from /usr/libexec/ld-elf.so.1                 
#11 0x1601c9944 in _rtld_start () from /usr/libexec/ld-elf.so.1                 
#12 0x1601c9944 in _rtld_start () from /usr/libexec/ld-elf.so.1                 
#13 0x1601c9944 in _rtld_start () from /usr/libexec/ld-elf.so.1                 
#14 0x1601c9944 in _rtld_start () from /usr/libexec/ld-elf.so.1                 
#15 0x1601c9944 in _rtld_start () from /usr/libexec/ld-elf.so.1                 
#16 0x1601c9944 in _rtld_start () from /usr/libexec/ld-elf.so.1                 #17 0x1601c9944 in _rtld_start () from /usr/libexec/ld-elf.so.1                 
#18 0x1601c9944 in _rtld_start () from /usr/libexec/ld-elf.so.1                 
#19 0x1601c9944 in _rtld_start () from /usr/libexec/ld-elf.so.1                 
#20 0x1601c9944 in _rtld_start () from /usr/libexec/ld-elf.so.1                 
#21 0x1601c9944 in _rtld_start () from /usr/libexec/ld-elf.so.1                 
#22 0x1601c9944 in _rtld_start () from /usr/libexec/ld-elf.so.1                 
---Type <return> to continue, or q <return> to quit---                          
                                                                                
...it goes on like that

(gdb) disassemble 0x1201046d0                                                   
Dump of assembler code for function intersect:                                  
0x120104660 <intersect>:        ldbu    t1,0(a1)                                
0x120104664 <intersect+4>:      sextb   t1,t1                                   
0x120104668 <intersect+8>:      ldbu    t0,2(a0)                                
0x12010466c <intersect+12>:     sextb   t0,t0                                   
0x120104670 <intersect+16>:     cmple   t1,t0,t1                                
0x120104674 <intersect+20>:     beq     t1,0x1201046c0 <intersect+96>           
0x120104678 <intersect+24>:     ldbu    t1,1(a1)                                
0x12010467c <intersect+28>:     sextb   t1,t1                                   
0x120104680 <intersect+32>:     ldbu    t0,3(a0)                                
0x120104684 <intersect+36>:     sextb   t0,t0                                   
0x120104688 <intersect+40>:     cmple   t1,t0,t1                                
0x12010468c <intersect+44>:     beq     t1,0x1201046c0 <intersect+96>           
0x120104690 <intersect+48>:     ldbu    t1,2(a1)                                
0x120104694 <intersect+52>:     sextb   t1,t1                                   
0x120104698 <intersect+56>:     ldbu    t0,0(a0)                                
0x12010469c <intersect+60>:     sextb   t0,t0                                   
0x1201046a0 <intersect+64>:     cmplt   t1,t0,t1                                
0x1201046a4 <intersect+68>:     bne     t1,0x1201046c0 <intersect+96>           
0x1201046a8 <intersect+72>:     ldbu    t1,3(a1)                                
0x1201046ac <intersect+76>:     sextb   t1,t1                                   0x1201046b0 <intersect+80>:     ldbu    t0,1(a0)                                
0x1201046b4 <intersect+84>:     sextb   t0,t0                                   
0x1201046b8 <intersect+88>:     cmplt   t1,t0,t1                                
0x1201046bc <intersect+92>:     beq     t1,0x1201046c8 <intersect+104>          
0x1201046c0 <intersect+96>:     clr     v0                                      
0x1201046c4 <intersect+100>:    ret                                             
0x1201046c8 <intersect+104>:    ldbu    t1,0(a0)                                
0x1201046cc <intersect+108>:    ldbu    t0,0(a1)                                
0x1201046d0 <intersect+112>:    maxsb8  t1,t0,t1                                
0x1201046d4 <intersect+116>:    stb     t1,0(a2)                                
0x1201046d8 <intersect+120>:    ldbu    t2,1(a0)                                
0x1201046dc <intersect+124>:    ldbu    t0,1(a1)                                
0x1201046e0 <intersect+128>:    maxsb8  t2,t0,t4                                
0x1201046e4 <intersect+132>:    stb     t4,1(a2)                                
0x1201046e8 <intersect+136>:    ldbu    t2,2(a1)                                
0x1201046ec <intersect+140>:    ldbu    t0,2(a0)                                
0x1201046f0 <intersect+144>:    minsb8  t2,t0,t2                                
0x1201046f4 <intersect+148>:    stb     t2,2(a2)                                
0x1201046f8 <intersect+152>:    ldbu    t3,3(a1)                                
0x1201046fc <intersect+156>:    ldbu    t0,3(a0)                                
0x120104700 <intersect+160>:    minsb8  t3,t0,t3                                
0x120104704 <intersect+164>:    stb     t3,3(a2)                                0x120104708 <intersect+168>:    sextb   t1,t1                                   
0x12010470c <intersect+172>:    sextb   t2,t2                                   
0x120104710 <intersect+176>:    cmple   t1,t2,t1                                
0x120104714 <intersect+180>:    beq     t1,0x12010472c <intersect+204>          
0x120104718 <intersect+184>:    sextb   t4,t0                                   
0x12010471c <intersect+188>:    sextb   t3,t1                                   
0x120104720 <intersect+192>:    cmple   t0,t1,t0                                
0x120104724 <intersect+196>:    lda     v0,1                                    
0x120104728 <intersect+200>:    bne     t0,0x120104730 <intersect+208>          
0x12010472c <intersect+204>:    clr     v0                                      
0x120104730 <intersect+208>:    ret                                             
0x120104734 <intersect+212>:    unop                                            
0x120104738 <intersect+216>:    nop                                             
0x12010473c <intersect+220>:    unop                                            
End of assembler dump.                                                          

At Andrew's prompting, I compiled and ran the following program on my system:

> #include <sys/cdefs.h>                                                        
> #include <sys/types.h>                                                        
> #include <stdio.h>                                                            
> #include <machine/bwx.h>                                                      
> #include <machine/alpha_cpu.h>                                                
>                                                                               
> main()                                                                        
> {                                                                             
>         u_int8_t byte;                                                        
>         u_int16_t word;                                                       
>         u_int32_t lng;                                                        
>         u_int64_t hack = 0x123456789abcdef;                                   
>         u_int64_t va = ((u_int64_t)&hack)+4UL;                                
>                                                                               >         printf("implver = 0x%lx\n", alpha_implver());                         
>         printf("amask = 0x%lx\n", alpha_amask(-1L));                          
>         printf ("0x%lx\n", hack);                                             
>         byte = ldbu(va);                                                      
>         printf ("0x%x\n", byte);                                              
>         stb(va, 0xff);                                                        
>         printf ("0x%lx\n", hack);                                             
> }                                                                             
>                                                                               
                                                                                with the following results:

$ cc  -O -pipe -mcpu=pca56 test.c                                               
$ ./a.out                                                                       
implver = 0x1                                                                   
amask = 0xfffffffffffffffe                                                      
0x123456789abcdef                                                               
0x67                                                                            
0x12345ff89abcdef                                                               

Andrew's guess was that nethack was trapping on a BWX instruction, but
indicated that from the program output my box could handle those
instructions.  Here is my dmesg output, if that's at all helpful:

Copyright (c) 1992-2003 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.
FreeBSD 5.0-RELEASE-p6 #2: Tue Mar 25 04:13:12 PST 2003
    root at frane.vortex4.net:/usr/src/sys/alpha/compile/FRANE
Preloaded elf kernel "/boot/kernel/kernel" at 0xfffffc000062c000.
EB164
Digital AlphaPC 164SX 533 MHz, 531MHz
8192 byte page size, 1 processor.
CPU: PCA56 (21164PC) major=9 minor=2 extensions=0x1<BWX>
OSF PAL rev: 0x1000600020116
real memory  = 534921216 (510 MB)
avail memory = 514654208 (490 MB)
Initializing GEOMetry subsystem
cia0: <2117x Core Logic chipset>  
cia0: Pyxis, pass 1
cia0: extended capabilities: 1<BWEN>    
pcib0: <2117x PCI host bus adapter> on cia0
pci0: <PCI bus> on pcib0
sym0: <875> port 0x10000-0x100ff mem 0x82040000-0x82040fff,0x82042000-0x820420ff
 irq 9 at device 5.0 on pci0
sym0: Tekram NVRAM, ID 7, Fast-20, SE, parity checking
sym0: interrupting at CIA irq 9  
isab0: <PCI-ISA bridge> at device 8.0 on pci0
isa0: <ISA bus> on isab0
pci0: <mass storage, ATA> at device 8.1 (no driver attached)
pci0: <mass storage, ATA> at device 8.2 (no driver attached)
pci0: <serial bus, USB> at device 8.3 (no driver attached)       
xl0: <3Com 3c905B-TX Fast Etherlink XL> port 0x10100-0x1017f mem 0x82042100-0x82
04217f irq 8 at device 9.0 on pci0   
xl0: interrupting at CIA irq 8   
xl0: Ethernet address: 00:50:da:80:2c:11
miibus0: <MII bus> on xl0   
xlphy0: <3Com internal media interface> on miibus0
xlphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
atkbdc0: <Keyboard controller (i8042)> at port 0x64,0x60 on isa0
atkbd0: <AT Keyboard> irq 1 on atkbdc0
atkbd0: interrupting at ISA irq 1
fdc0: <Enhanced floppy controller (i82077, NE72065 or clone)> at port 0x3f7,0x3f
0-0x3f5 irq 6 drq 2 on isa0
fdc0: interrupting at ISA irq 6
mcclock0: <MC146818A real time clock> at port 0x70-0x71 on isa0
sio0 at port 0x3f8-0x3ff irq 4 on isa0
sio0: type 16550A, console
sio0: interrupting at ISA irq 4  
sio1 at port 0x2f8-0x2ff irq 3 on isa0       
sio1: type 16550A
sio1: interrupting at ISA irq 3
Timecounter "i8254"  frequency 1193182 Hz
Timecounter "alpha"  frequency 533159245 Hz
Timecounters tick every 0.976 msec
Waiting 10 seconds for SCSI devices to settle
da0 at sym0 bus 0 target 0 lun 0 
da0: <QUANTUM ATLAS IV 9 WLS 0808> Fixed Direct Access SCSI-3 device
da0: 40.000MB/s transfers (20.000MHz, offset 16, 16bit), Tagged Queueing Enabled
da0: 8683MB (17783249 512 byte sectors: 255H 63S/T 1106C)
Mounting root from ufs:/dev/da0a

It is with a heavy heart that I mark this low/non-critical.  It's nethack, 
after all :>

>How-To-Repeat:

Problem is consistent on each execution of nethack built with the -march=pca56
flag

>Fix:

pkg_delete nethack-nox11-3.4.0_1
edit make.conf, comment out CPUTYPE?=pca56
cd /usr/ports/games/nethack34-nox11 ; make all install clean
without -mcpu=pca56, the game runs without problems
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list