Frank Wille | 4 Jan 2008 20:30
Picon

Xamiga segfaults with 16 bit on CV64

Hi,

either it's me having done something stupid, or the Xamiga of 4.0 no longer
supports 16 bit screen depths. This is what I did:

---8<---
frank <at> phoenix grfconfig /dev/grf5
 1: 800x600x8   57.0kHz  <at>  92Hz flags: +hsync +vsync
 2: 800x600x16  57.8kHz  <at>  90Hz flags: +hsync +vsync
 3: 1024x768x8  72.8kHz  <at>  92Hz flags: default
 4: 1024x768x16 67.2kHz  <at>  83Hz flags: default
 5: 1152x900x8  68.9kHz  <at>  74Hz flags: default
 6: 1152x900x16 62.1kHz  <at>  66Hz flags: default
Console: 640x480 (80x60)        31.2kHz  <at>  59Hz flags: default
frank <at> phoenix cat .xserverrc 
X -dev /dev/grf5 -mode 2

frank <at> phoenix startx

The XKEYBOARD keymap compiler (xkbcomp) reports:
> Error:            Can't find file "amiga" for symbols include
>                   Exiting
>                   Abandoning symbols file "usa1"
Errors from xkbcomp are not fatal to the X server
Could not init font path element /usr/X11R6/lib/X11/fonts/CID/, removing from list!
X connection to :0.0 broken (explicit kill or server shutdown).
[1]   Segmentation fault      X -dev /dev/grf5...
---8<---

Further experiments have shown that it segfaults for mode 2, 4 and 6, but
(Continue reading)

Frank Wille | 6 Jan 2008 14:43
Picon

Re: Xamiga segfaults with 16 bit on CV64

Hi,

I'm crossposting to port-m68k, because gcc4 compiler bugs may be interesting
for all 68k ports.

Here are some more information about my Xserver crash.

Stack frame backtrace:

#0  0x00091be2 in cfb16FillBoxTile32sCopy ()
#1  0x0008a8b0 in cfb16FillBoxTileOdd ()
#2  0x00088222 in cfb16PaintWindow ()
#3  0x0010ed34 in miWindowExposures ()
#4  0x00025fc0 in MapWindow ()
#5  0x00026106 in InitRootWindow ()
#6  0x0000686a in main ()
#7  0x00005de4 in __start ()

The registers:

d0             0x0      0
d1             0x2      2
d2             0x1      1
d3             0x178500 1541376
d4             0x5      5
d5             0xdffecb4        234876084
d6             0x60dec  396780
d7             0x2037c  131964
a0             0x0      0x0
a1             0x178500 0x178500
(Continue reading)

David Laight | 6 Jan 2008 15:12
Picon

Re: Xamiga segfaults with 16 bit on CV64

On Sun, Jan 06, 2008 at 02:43:00PM +0100, Frank Wille wrote:
> 
> Disassembly of the crash location:
> [...]
> 0x91bd4 <cfb16FillBoxTile32sCopy+56>:   moveal %a1 <at> (16),%a0
> 0x91bd8 <cfb16FillBoxTile32sCopy+60>:   movel %a1,%sp <at> -
> 0x91bda <cfb16FillBoxTile32sCopy+62>:   moveal %a0 <at> (372),%a0
> 0x91bde <cfb16FillBoxTile32sCopy+66>:   jsr %a0 <at> 
> 0x91be0 <cfb16FillBoxTile32sCopy+68>:   addql #4,%sp
> 0x91be2 <cfb16FillBoxTile32sCopy+70>:   movel %a0 <at> (32),%fp <at> (-24)  <-- HERE
> [...]
> 
> The code looks to me like a compiler bug (unless the sub-routine is meant to
> return a result in a0). Register a0 is reused for deferencing after a sub-
> routine call, although it is definitely a volatile register (and zero after
> returning from the sub-routine).

%a0 is used to return a pointer from a function.
So it looks as though the called function returned 'NULL' and it wasn't
checked for.

	David

--

-- 
David Laight: david <at> l8s.co.uk

Frank Wille | 6 Jan 2008 16:05
Picon

Re: Xamiga segfaults with 16 bit on CV64

David Laight wrote:

> On Sun, Jan 06, 2008 at 02:43:00PM +0100, Frank Wille wrote:
>> 
>> Disassembly of the crash location: [...]
>> 0x91bd4 <cfb16FillBoxTile32sCopy+56>: moveal %a1 <at> (16),%a0 0x91bd8
>> <cfb16FillBoxTile32sCopy+60>: movel %a1,%sp <at> - 0x91bda
>> <cfb16FillBoxTile32sCopy+62>: moveal %a0 <at> (372),%a0 0x91bde
>> <cfb16FillBoxTile32sCopy+66>: jsr %a0 <at>  0x91be0
>> <cfb16FillBoxTile32sCopy+68>: addql #4,%sp 0x91be2
>> <cfb16FillBoxTile32sCopy+70>: movel %a0 <at> (32),%fp <at> (-24) <-- HERE [...]
>> 
>> The code looks to me like a compiler bug (unless the sub-routine is meant
>> to return a result in a0). Register a0 is reused for deferencing after a
>> sub- routine call, although it is definitely a volatile register (and
>> zero after returning from the sub-routine).
> 
> %a0 is used to return a pointer from a function.
> So it looks as though the called function returned 'NULL' and it wasn't
> checked for.

Thanks for the explanation. I wasn't aware that NetBSD follows a different ABI
than AmigaOS, which always uses d0 for return values.

Then I have to find out which function pointer is NULL here...

--

-- 
    _  Frank Wille (frank <at> phoenix.owl.de)
 _ //  http://sun.hasenbraten.de/~frank/
 \X/   Phx  <at>  #AmigaGer
(Continue reading)

David Laight | 6 Jan 2008 17:23
Picon

Re: Xamiga segfaults with 16 bit on CV64

On Sun, Jan 06, 2008 at 04:05:27PM +0100, Frank Wille wrote:
> > 
> > %a0 is used to return a pointer from a function.
> > So it looks as though the called function returned 'NULL' and it wasn't
> > checked for.
> 
> Thanks for the explanation. I wasn't aware that NetBSD follows a different ABI
> than AmigaOS, which always uses d0 for return values.

I only know because of the recent issues with the return value from mmap().

	David

--

-- 
David Laight: david <at> l8s.co.uk

Martin Husemann | 6 Jan 2008 17:23
Picon

Re: Xamiga segfaults with 16 bit on CV64

On Sun, Jan 06, 2008 at 04:05:27PM +0100, Frank Wille wrote:
> Thanks for the explanation. I wasn't aware that NetBSD follows a different ABI
> than AmigaOS, which always uses d0 for return values.

We use the SVR4 m68k ABI with ELF.

Martin


Gmane