Date: Thu, 6 Jan 2005 16:00:33 +0000 From: Chris <chrcoluk@gmail.com> To: Bartosz Fabianowski <freebsd@chillt.de> Cc: obrien@freebsd.org Subject: Re: Instant reboots with CPUTYPE=pentium-m Message-ID: <3aaaa3a050106080075c6d4a@mail.gmail.com> In-Reply-To: <41DC5554.1020702@chillt.de> References: <41DC5554.1020702@chillt.de>
next in thread | previous in thread | raw e-mail | index | archive | help
I use the athlon-xp switch on 3 boxes with no problems all of them running 5.3 On Wed, 05 Jan 2005 22:00:04 +0100, Bartosz Fabianowski <freebsd@chillt.de> wrote: > Hi list, > > I am still having the problems with instant reboots that I reported [1] > a couple of weeks ago. I have a bit more info now and hope that someone > can lead me in the right direction. > > The problem is that setting CPUTYPE=pentium-m in make.conf leads to a > corrupt boot loader and a corrupt kernel being generated. This setting > for the CPUTYPE has been available on -STABLE since 16th December, when > revision 1.40.2.1 of bsd.cpu.mk was committed. I have traced the start > of my problems to that exact commit (the commiter is CC'd). > > On -current, the setting has been available for a longer time and has > led to the same problems for some people. Also, it seems that not only > pentium-m is broken, but athlon-xp as well. The end of a thread on the > -current mailing list discussing this issue is in [2]. Unfortunately, it > provides no insight as to where the problem lies. > > It seems to me that every other part of the world, including GCC itself, > is built correctly when CPUTYPE is set to pentium-m. The issue only > affects the boot loader and the kernel for some reason. > > When I changed the CPUTYPE from pentium-m down to pentium3 (essentially > just disabling SSE2) and recompiled the boot loader, I instantly got a > working loader again. I have attached a diff of the .s files generated > for the loader with CPUTYPE=pentium3 and CPUTYPE=pentium-m. I do not see > any real changes except for the use of xmm registers when > CPUTYPE=pentium-m is set. > > Does anybody have an idea how to debug this further? I am totally out of > ideas and really do not know where to continue looking. I have some time > on my hands to go searching for the bug - all I need is some direction. > > - Bartosz > > [1] > http://lists.freebsd.org/pipermail/freebsd-stable/2004-December/010594.html > [2] > http://lists.freebsd.org/pipermail/freebsd-current/2004-November/042127.html > > > diff -u loader_dir_p3/bcache.s loader_dir_pm/bcache.s > --- loader_dir_p3/bcache.s Wed Jan 5 21:56:29 2005 > +++ loader_dir_pm/bcache.s Wed Jan 5 21:56:29 2005 > @@ -684,7 +684,7 @@ > pushl %edi > pushl %esi > pushl %ebx > - subl $36, %esp > + subl $28, %esp > movl 12(%ebp), %ebx > movl 16(%ebp), %esi > leal -16(%ebp), %eax > @@ -692,21 +692,19 @@ > call time > movl $0, -20(%ebp) > movl bcache_ctl, %eax > - movl 12(%eax), %eax > - movl %eax, -24(%ebp) > + movd 12(%eax), %xmm0 > movl $1, %ecx > cmpl bcache_nblks, %ecx > jae .L99 > - movl bcache_ctl, %eax > - movl %eax, -36(%ebp) > - movl %eax, -28(%ebp) > - movl bcache_nblks, %eax > - movl %eax, -32(%ebp) > + movd %eax, %xmm1 > + movl %eax, -24(%ebp) > + movl bcache_nblks, %edi > + movl %edi, -28(%ebp) > .p2align 4,,15 > .L103: > movl %ecx, %eax > sall $4, %eax > - movl -36(%ebp), %edi > + movd %xmm1, %edi > movl 4(%eax,%edi), %edx > xorl %esi, %edx > movl (%eax,%edi), %eax > @@ -717,18 +715,17 @@ > jmp .L99 > .p2align 4,,7 > .L101: > - movl -28(%ebp), %edx > + movl -24(%ebp), %edx > movl %ecx, %eax > sall $4, %eax > - movl -24(%ebp), %edi > + movd %xmm0, %edi > cmpl %edi, 12(%eax,%edx) > jge .L100 > - movl 12(%eax,%edx), %eax > - movl %eax, -24(%ebp) > + movd 12(%eax,%edx), %xmm0 > movl %ecx, -20(%ebp) > .L100: > incl %ecx > - cmpl -32(%ebp), %ecx > + cmpl -28(%ebp), %ecx > jb .L103 > .L99: > movl bcache_blksize, %eax > @@ -753,7 +750,7 @@ > movl %eax, bcache_bcount > movl bcache_ctl, %eax > movl %edx, 12(%ecx,%eax) > - addl $36, %esp > + addl $28, %esp > popl %ebx > popl %esi > popl %edi > diff -u loader_dir_p3/interp_backslash.s loader_dir_pm/interp_backslash.s > --- loader_dir_p3/interp_backslash.s Wed Jan 5 21:56:29 2005 > +++ loader_dir_pm/interp_backslash.s Wed Jan 5 21:56:29 2005 > @@ -12,7 +12,7 @@ > pushl %edi > pushl %esi > pushl %ebx > - subl $32, %esp > + subl $28, %esp > movl 8(%ebp), %ebx > movl $0, %edi > movl $0, %esi > @@ -211,39 +211,39 @@ > subl $55, %eax > sall $6, %eax > .L31: > - movl %eax, -24(%ebp) > + movd %eax, %xmm0 > movsbl 1(%ebx),%eax > leal -48(%eax), %edx > - movl %edx, -40(%ebp) > - movl -24(%ebp), %edx > + movl %edx, -36(%ebp) > + movd %xmm0, %edx > leal -384(%edx,%eax,8), %eax > - cmpl $9, -40(%ebp) > + cmpl $9, -36(%ebp) > jbe .L37 > movsbl 1(%ebx),%eax > leal -97(%eax), %edx > - movl %edx, -40(%ebp) > - movl -24(%ebp), %edx > + movl %edx, -36(%ebp) > + movd %xmm0, %edx > leal -696(%edx,%eax,8), %eax > - cmpl $25, -40(%ebp) > + cmpl $25, -36(%ebp) > jbe .L37 > movsbl 1(%ebx),%eax > - movl -24(%ebp), %edx > + movd %xmm0, %edx > leal -440(%edx,%eax,8), %eax > .L37: > movl %eax, -20(%ebp) > movsbl 2(%ebx),%eax > leal -48(%eax), %edx > - movl %edx, -40(%ebp) > + movl %edx, -36(%ebp) > movl -20(%ebp), %edx > leal -48(%edx,%eax), %eax > - cmpl $9, -40(%ebp) > + cmpl $9, -36(%ebp) > jbe .L43 > movsbl 2(%ebx),%eax > leal -97(%eax), %edx > - movl %edx, -40(%ebp) > + movl %edx, -36(%ebp) > movl -20(%ebp), %edx > leal -87(%edx,%eax), %eax > - cmpl $25, -40(%ebp) > + cmpl $25, -36(%ebp) > jbe .L43 > movsbl 2(%ebx),%eax > movl -20(%ebp), %edx > @@ -266,7 +266,7 @@ > testb $1, %al > je .L3 > movsbl 2(%ebx),%edx > - movl $0, -28(%ebp) > + movl $0, -24(%ebp) > leal -48(%edx), %eax > cmpl $9, %eax > jbe .L50 > @@ -277,9 +277,9 @@ > cmpl $5, %eax > ja .L49 > .L50: > - movl $1, -28(%ebp) > + movl $1, -24(%ebp) > .L49: > - cmpl $0, -28(%ebp) > + cmpl $0, -24(%ebp) > je .L3 > movsbl 2(%ebx),%eax > subl $48, %eax > @@ -302,7 +302,7 @@ > .L54: > movb %al, -13(%ebp) > movsbl 3(%ebx),%edx > - movl $0, -32(%ebp) > + movl $0, -28(%ebp) > leal -48(%edx), %eax > cmpl $9, %eax > jbe .L61 > @@ -313,29 +313,29 @@ > cmpl $5, %eax > ja .L60 > .L61: > - movl $1, -32(%ebp) > + movl $1, -28(%ebp) > .L60: > - cmpl $0, -32(%ebp) > + cmpl $0, -28(%ebp) > je .L59 > movsbl -13(%ebp),%eax > sall $4, %eax > - movl %eax, -36(%ebp) > + movl %eax, -32(%ebp) > movsbl 3(%ebx),%eax > leal -48(%eax), %edx > - movl %edx, -40(%ebp) > - movl -36(%ebp), %edx > + movl %edx, -36(%ebp) > + movl -32(%ebp), %edx > leal -48(%edx,%eax), %eax > - cmpl $9, -40(%ebp) > + cmpl $9, -36(%ebp) > jbe .L65 > movsbl 3(%ebx),%eax > leal -97(%eax), %edx > - movl %edx, -40(%ebp) > - movl -36(%ebp), %edx > + movl %edx, -36(%ebp) > + movl -32(%ebp), %edx > leal -87(%edx,%eax), %eax > - cmpl $25, -40(%ebp) > + cmpl $25, -36(%ebp) > jbe .L65 > movsbl 3(%ebx),%eax > - movl -36(%ebp), %edx > + movl -32(%ebp), %edx > leal -55(%edx,%eax), %eax > .L65: > movb %al, -13(%ebp) > @@ -380,7 +380,7 @@ > movb $0, (%ecx,%esi) > movl %ecx, %eax > .L1: > - addl $32, %esp > + addl $28, %esp > popl %ebx > popl %esi > popl %edi > diff -u loader_dir_p3/load_elf32_obj.s loader_dir_pm/load_elf32_obj.s > --- loader_dir_p3/load_elf32_obj.s Wed Jan 5 21:56:29 2005 > +++ loader_dir_pm/load_elf32_obj.s Wed Jan 5 21:56:29 2005 > @@ -252,7 +252,7 @@ > pushl %edi > pushl %esi > pushl %ebx > - subl $52, %esp > + subl $48, %esp > movl 16(%ebp), %eax > movl $0, -24(%ebp) > movl %eax, %edi > @@ -311,16 +311,16 @@ > .L31: > leal (%ebx,%ebx,4), %eax > sall $3, %eax > - movl %eax, -44(%ebp) > + movd %eax, %xmm0 > movl %edi, %edx > addl 32(%eax,%esi), %edx > decl %edx > movl %edx, %eax > - movl -44(%ebp), %edi > + movd %xmm0, %edi > movl $0, %edx > divl 32(%edi,%esi) > movl %eax, %edi > - movl -44(%ebp), %eax > + movd %xmm0, %eax > imull 32(%eax,%esi), %edi > movl %edi, 12(%eax,%esi) > addl 20(%eax,%esi), %edi > @@ -456,16 +456,16 @@ > .L49: > leal (%ebx,%ebx,4), %eax > sall $3, %eax > - movl %eax, -44(%ebp) > + movd %eax, %xmm0 > movl %edi, %edx > addl 32(%eax,%esi), %edx > decl %edx > movl %edx, %eax > - movl -44(%ebp), %edi > + movd %xmm0, %edi > movl $0, %edx > divl 32(%edi,%esi) > movl %eax, %edi > - movl -44(%ebp), %eax > + movd %xmm0, %eax > imull 32(%eax,%esi), %edi > movl %edi, 12(%eax,%esi) > addl 20(%eax,%esi), %edi > @@ -541,7 +541,7 @@ > movl $.LC13, (%esp) > call printf > movl -24(%ebp), %eax > - addl $52, %esp > + addl $48, %esp > popl %ebx > popl %esi > popl %edi > diff -u loader_dir_p3/load_elf64.s loader_dir_pm/load_elf64.s > --- loader_dir_p3/load_elf64.s Wed Jan 5 21:56:29 2005 > +++ loader_dir_pm/load_elf64.s Wed Jan 5 21:56:29 2005 > @@ -325,7 +325,7 @@ > pushl %edi > pushl %esi > pushl %ebx > - subl $140, %esp > + subl $136, %esp > movl $0, -68(%ebp) > movl $0, -52(%ebp) > movl $0, -56(%ebp) > @@ -519,18 +519,18 @@ > cmpl $0, -60(%ebp) > je .L50 > movl -60(%ebp), %eax > - movl %eax, -108(%ebp) > - movl $0, -104(%ebp) > + movl %eax, -104(%ebp) > + movl $0, -100(%ebp) > leal 0(,%esi,8), %eax > subl %esi, %eax > movl 16(%ebp), %ecx > movl 20(%ebp), %ebx > addl 16(%edi,%eax,8), %ecx > adcl 20(%edi,%eax,8), %ebx > - cmpl %ebx, -104(%ebp) > + cmpl %ebx, -100(%ebp) > ja .L50 > jb .L49 > - cmpl %ecx, -108(%ebp) > + cmpl %ecx, -104(%ebp) > jbe .L49 > .p2align 4,,15 > .L50: > @@ -642,73 +642,81 @@ > movl -52(%ebp), %ecx > cmpl $2, 4(%eax,%ecx) > jne .L62 > - movl $0, -100(%ebp) > + movl $0, -96(%ebp) > movl -48(%ebp), %ebx > cmpw $0, 56(%ebx) > je .L65 > movl %esi, %eax > sall $6, %eax > - movl %eax, -88(%ebp) > + movd %eax, %xmm0 > .p2align 4,,15 > .L71: > - movl -100(%ebp), %eax > + movl -96(%ebp), %eax > sall $3, %eax > - subl -100(%ebp), %eax > + subl -96(%ebp), %eax > sall $3, %eax > cmpl $1, (%eax,%edi) > jne .L66 > - movl -88(%ebp), %ecx > + movd %xmm0, %ecx > movl -52(%ebp), %edx > leal 24(%ecx,%edx), %ecx > movl (%ecx), %edx > movl 4(%ecx), %ecx > - movl %edx, -116(%ebp) > - movl %ecx, -112(%ebp) > + movl %edx, -112(%ebp) > + movl %ecx, -108(%ebp) > cmpl 12(%eax,%edi), %ecx > jb .L66 > - movl -112(%ebp), %ecx > + movl -108(%ebp), %ecx > cmpl 12(%eax,%edi), %ecx > ja .L69 > cmpl 8(%eax,%edi), %edx > jb .L66 > .L69: > - movl -88(%ebp), %edx > + movd %xmm0, %edx > movl -52(%ebp), %eax > leal 24(%edx,%eax), %edx > movl (%edx), %eax > movl 4(%edx), %edx > - movl -88(%ebp), %ecx > - movl -52(%ebp), %ebx > - addl 32(%ecx,%ebx), %eax > - adcl 36(%ecx,%ebx), %edx > - movl %eax, -96(%ebp) > - movl %edx, -92(%ebp) > - movl -100(%ebp), %ecx > + movl %eax, -120(%ebp) > + movl %edx, -116(%ebp) > + movd %xmm0, %eax > + movl -52(%ebp), %edx > + movl 32(%eax,%edx), %ecx > + movl 36(%eax,%edx), %ebx > + addl -120(%ebp), %ecx > + adcl -116(%ebp), %ebx > + movl %ecx, -92(%ebp) > + movl %ebx, -88(%ebp) > + movl -96(%ebp), %ecx > sall $3, %ecx > - subl -100(%ebp), %ecx > + subl -96(%ebp), %ecx > movl 8(%edi,%ecx,8), %eax > movl 12(%edi,%ecx,8), %edx > addl 32(%edi,%ecx,8), %eax > adcl 36(%edi,%ecx,8), %edx > - cmpl %edx, -92(%ebp) > + cmpl %edx, %ebx > ja .L66 > + cmpl %edx, -88(%ebp) > jb .L70 > - cmpl %eax, -96(%ebp) > + cmpl %eax, -92(%ebp) > ja .L66 > .L70: > - movl -88(%ebp), %eax > + movl $0, %ecx > + movl $0, %ebx > + movd %xmm0, %eax > movl -52(%ebp), %edx > - movl $0, 24(%eax,%edx) > - movl $0, 28(%eax,%edx) > - movl $0, 32(%eax,%edx) > - movl $0, 36(%eax,%edx) > + movl %ecx, 24(%eax,%edx) > + movl %ebx, 28(%eax,%edx) > + movl -52(%ebp), %edx > + movl %ecx, 32(%eax,%edx) > + movl %ebx, 36(%eax,%edx) > jmp .L65 > .p2align 4,,7 > .L66: > - incl -100(%ebp) > + incl -96(%ebp) > movl -48(%ebp), %ecx > movzwl 56(%ecx), %eax > - cmpl -100(%ebp), %eax > + cmpl -96(%ebp), %eax > ja .L71 > .L65: > movl %esi, %edx > @@ -796,15 +804,15 @@ > call *archsw+16 > testl %eax, %eax > js .L82 > - movl %eax, -132(%ebp) > - movl $0, -128(%ebp) > - movl -128(%ebp), %eax > + movl %eax, -128(%ebp) > + movl $0, -124(%ebp) > + movl -124(%ebp), %eax > movl -52(%ebp), %ecx > xorl 36(%ebx,%ecx), %eax > - movl %eax, -108(%ebp) > - movl -132(%ebp), %eax > + movl %eax, -104(%ebp) > + movl -128(%ebp), %eax > xorl 32(%ebx,%ecx), %eax > - orl -108(%ebp), %eax > + orl -104(%ebp), %eax > je .L81 > .L82: > movl $.LC21, (%esp) > @@ -1075,7 +1083,7 @@ > call Free > .L117: > movl -56(%ebp), %eax > - addl $140, %esp > + addl $136, %esp > popl %ebx > popl %esi > popl %edi > diff -u loader_dir_p3/reloc_elf64.s loader_dir_pm/reloc_elf64.s > --- loader_dir_p3/reloc_elf64.s Wed Jan 5 21:56:29 2005 > +++ loader_dir_pm/reloc_elf64.s Wed Jan 5 21:56:29 2005 > @@ -14,7 +14,7 @@ > elf64_reloc: > pushl %ebp > movl %esp, %ebp > - subl $40, %esp > + subl $32, %esp > movl %ebx, -12(%ebp) > movl %esi, -8(%ebp) > movl %edi, -4(%ebp) > @@ -35,10 +35,7 @@ > movl $0, -16(%ebp) > movzbl 8(%eax), %edx > movl $0, %ecx > - movl 12(%eax), %esi > - movl $0, %edi > - movl %esi, -28(%ebp) > - movl %edi, -24(%ebp) > + movd 12(%eax), %xmm0 > jmp .L2 > .p2align 4,,7 > .L4: > @@ -52,10 +49,7 @@ > movl %ecx, -16(%ebp) > movzbl 8(%eax), %edx > movl $0, %ecx > - movl 12(%eax), %esi > - movl $0, %edi > - movl %esi, -28(%ebp) > - movl %edi, -24(%ebp) > + movd 12(%eax), %xmm0 > jmp .L2 > .L5: > movl $22, %eax > @@ -91,18 +85,15 @@ > je .L12 > jmp .L13 > .L10: > - movl -28(%ebp), %eax > - movl -24(%ebp), %edx > - movl %eax, 4(%esp) > - movl %edx, 8(%esp) > + movq %xmm0, 4(%esp) > movl 8(%ebp), %eax > movl %eax, (%esp) > call *12(%ebp) > movl %edx, %ecx > movl %eax, %edx > movl $3, %eax > - movl %ecx, %esi > - orl %edx, %esi > + movl %ecx, %edi > + orl %edx, %edi > je .L1 > movl -20(%ebp), %esi > movl -16(%ebp), %edi > diff -u loader_dir_p3/vers.c loader_dir_pm/vers.c > --- loader_dir_p3/vers.c Wed Jan 5 21:56:29 2005 > +++ loader_dir_pm/vers.c Wed Jan 5 21:56:29 2005 > @@ -1,4 +1,4 @@ > char bootprog_name[] = "FreeBSD/i386 bootstrap loader"; > char bootprog_rev[] = "1.1"; > -char bootprog_date[] = "Wed Jan 5 21:27:50 CET 2005"; > +char bootprog_date[] = "Wed Jan 5 21:28:41 CET 2005"; > char bootprog_maker[] = "root@takahe.local"; > diff -u loader_dir_p3/vers.i loader_dir_pm/vers.i > --- loader_dir_p3/vers.i Wed Jan 5 21:56:29 2005 > +++ loader_dir_pm/vers.i Wed Jan 5 21:56:29 2005 > @@ -4,5 +4,5 @@ > # 1 "vers.c" > char bootprog_name[] = "FreeBSD/i386 bootstrap loader"; > char bootprog_rev[] = "1.1"; > -char bootprog_date[] = "Wed Jan 5 21:27:50 CET 2005"; > +char bootprog_date[] = "Wed Jan 5 21:28:41 CET 2005"; > char bootprog_maker[] = "root@takahe.local"; > diff -u loader_dir_p3/vers.s loader_dir_pm/vers.s > --- loader_dir_p3/vers.s Wed Jan 5 21:56:29 2005 > +++ loader_dir_pm/vers.s Wed Jan 5 21:56:29 2005 > @@ -14,7 +14,7 @@ > .type bootprog_date, @object > .size bootprog_date, 29 > bootprog_date: > - .string "Wed Jan 5 21:27:50 CET 2005" > + .string "Wed Jan 5 21:28:41 CET 2005" > .globl bootprog_maker > .type bootprog_maker, @object > .size bootprog_maker, 18 > > > _______________________________________________ > freebsd-stable@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-stable > To unsubscribe, send any mail to "freebsd-stable-unsubscribe@freebsd.org" > > >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3aaaa3a050106080075c6d4a>
