Subject: Re: Serious problems in either gcc or pmap
To: Reinoud Zandijk <reinoud@netbsd.org>
From: Richard Earnshaw <rearnsha@arm.com>
List: port-arm
Date: 04/22/2002 16:48:22
> Hiya folks,
>
> i've tried to figure out the reason i'm getting panics every time i try to
> build X .... looking at the log wich i will append, there is something
> fishy going on in either the compiler or in the pmap ... before i will send
> a PR i would first let you folks have a look at it to see if you can
> discover problems.
>
> Also added is the offending application that keeps giving problems too ..
> as you can see in the log there either are illegal instructions emitted
> (unlikely) or the pmap is confused and gives it the wrong page to
> execute...
>
> I tried to figure it out but i am still learning in gcc stuff... and i keep
> forgetting those ELF tools to visualise ELF binaries :(
>
> The kernel is a 1.5ZC (20 april 00:00 CEST) and userland is a 3 days old.
>
> Hope this will give some insights ...
It looks to me as though the function
FontCouldBeTerminal()
has been miscompiled. Note that at 0x10f80 we subtract 4 from the stack,
but at the end of the function we don't add this back again... :-( We
thus return off to never-never land and execute an illegal instruction.
It's not at all clear to me from looking at the dump why we are pushing
that stack space at all, there certainly aren't any uses of it.
Do you have cvs v1.9 of gnu/dist/toolchain/gcc/config/arm/netbsd-elf.h?
If so, I'll have to look into this in more detail.
R.
Dump of assembler code for function FontCouldBeTerminal:
0x10f7c>: stmdb sp!, {r4, r5, r6, r7, lr}
0x10f80>: sub sp, sp, #4 ; 0x4
0x10f84>: ldr r7, [r0, #28]
0x10f88>: tst r7, #32768 ; 0x8000
0x10f8c>: bne 0x11028 <FontCouldBeTerminal+172>
0x10f90>: ldr r2, [r0, #20]
0x10f94>: ldr r6, [r0, #16]
0x10f98>: mov r3, r2, lsl #16
0x10f9c>: mov r1, r3, asr #16
0x10fa0>: cmp r1, r6, asr #16
0x10fa4>: mov r12, r2
0x10fa8>: blt 0x11028 <FontCouldBeTerminal+172>
0x10fac>: ldr r5, [r0, #32]
0x10fb0>: mov r3, r5, lsl #16
0x10fb4>: mov r4, r3, asr #16
0x10fb8>: cmp r4, r1
0x10fbc>: bne 0x11028 <FontCouldBeTerminal+172>
0x10fc0>: ldr r1, [r0, #64]
0x10fc4>: mov r3, r1, lsl #16
0x10fc8>: mov lr, r3, asr #16
0x10fcc>: cmp lr, r12, asr #16
0x10fd0>: blt 0x11028 <FontCouldBeTerminal+172>
0x10fd4>: ldr r2, [r0, #24]
0x10fd8>: mov r1, r1, asr #16
0x10fdc>: mov r3, r2, lsl #16
0x10fe0>: cmp r1, r3, asr #16
0x10fe4>: blt 0x11028 <FontCouldBeTerminal+172>
0x10fe8>: movs r6, r6, lsl #16
0x10fec>: bne 0x11010 <FontCouldBeTerminal+148>
0x10ff0>: cmp r4, r7, asr #16
0x10ff4>: bne 0x11010 <FontCouldBeTerminal+148>
0x10ff8>: cmp lr, r5, asr #16
0x10ffc>: bne 0x11010 <FontCouldBeTerminal+148>
0x11000>: ldr r3, [r0, #36]
0x11004>: mov r3, r3, lsl #16
0x11008>: cmp r1, r3, asr #16
0x1100c>: beq 0x11028 <FontCouldBeTerminal+172>
0x11010>: movs r0, r12, asr #16
0x11014>: bne 0x11020 <FontCouldBeTerminal+164>
0x11018>: movs r2, r2, lsl #16
0x1101c>: beq 0x1102c <FontCouldBeTerminal+176>
0x11020>: mov r0, #1 ; 0x1
0x11024>: b 0x1102c <FontCouldBeTerminal+176>
0x11028>: mov r0, #0 ; 0x0
0x1102c>: ldmia sp!, {r4, r5, r6, r7, pc}
End of assembler dump.