as from binutils 2.9.5.0.31-2 miscompiles kernel code

From: Petr Vandrovec (vandrove@vc.cvut.cz)
Date: Mon Apr 10 2000 - 04:38:36 EST


Package: binutils
Version: 2.9.5.0.31-2

/usr/bin/as miscompiles movl $0x0000e820, %eax as
movl $0xffffe820, %eax. This causes 2.3.x kernels
to not detect full size of memory :-( (and maybe
some more problems...)

vana:~# cat x.s
.code16
        movl $0x0000e820, %eax
vana:~# as x.s
vana:~# objdump --disassemble a.out

a.out: file format elf32-i386

Disassembly of section .text:

0000000000000000 <.text>:
   0: 66 b8 20 e8 mov $0xe820,%ax
   4: ff (bad)
   5: ff .byte 0xff

As you can see, value got somewhat truncated to 16 bits
and then sign-extended.
For now I replaced movl $0x0000e820,%eax with
xorl %eax,%eax; movw $0xe820,%ax (code length is
unchanged, but it is much slower), but I simple do not
trust such assembler anymore :-(

I'm using debian woody, kernel 2.3.99-pre4-pre5, libc6
2.1.3-8.
I cc'ed linux-kernel, as there may be more peoples which
want to know why their 2.3.x kernel recognizes only
64MB of memory...
                        Thanks,
                                Petr Vandrovec
                                vandrove@vc.cvut.cz

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Apr 15 2000 - 21:00:13 EST