Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 457450 Details for
Bug 538596
sys-apps/memtest86+-5.01 - test.c: In function ‘movinvr’: test.c:350:25: error: inconsistent operand constraints in an ‘asm’
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
improved patch to remove ebx from asm blocks in test.c
memtest86+-5.01-test_c_noebx.patch (text/plain), 10.81 KB, created by
Peter Fox
on 2016-12-26 20:23:18 UTC
(
hide
)
Description:
improved patch to remove ebx from asm blocks in test.c
Filename:
MIME Type:
Creator:
Peter Fox
Created:
2016-12-26 20:23:18 UTC
Size:
10.81 KB
patch
obsolete
>--- test.orig.c 2016-12-25 22:22:44.065762386 +0000 >+++ test.c 2016-12-26 19:43:45.618874725 +0000 >@@ -348,18 +369,26 @@ > */ > > asm __volatile__ ( >- "jmp L200\n\t" >- ".p2align 4,,7\n\t" >- "L201:\n\t" >- "addl $4,%%edi\n\t" >- "L200:\n\t" >- "pushl %%ecx\n\t" \ >- "call rand\n\t" >- "popl %%ecx\n\t" \ >- "movl %%eax,(%%edi)\n\t" >- "cmpl %%ebx,%%edi\n\t" >- "jb L201\n\t" >- : : "D" (p), "b" (pe), "c" (me) >+ // Put pe(edx) on stack for protection from rand calls >+ "pushl %%edx\n\t" >+ // Put me(ecx) on stack for repeated calls >+ "pushl %%ecx\n\t" >+ "jmp L200\n\t" >+ ".p2align 4,,7\n\t" >+ "L201:\n\t" >+ "addl $4,%%edi\n\t" >+ "L200:\n\t" >+ // Destroys ecx, but we don't care as it is already on tos as the first parameter >+ "call rand\n\t" >+ "movl %%eax,(%%edi)\n\t" >+ // pe(edx) is on stack now >+ "cmpl 4(%%esp),%%edi\n\t" >+ "jb L201\n\t" >+ // Finally pop me(ecx) >+ "popl %%ecx\n\t" >+ // and pe(edx) >+ "popl %%edx\n\t" >+ : : "D" (p), "d" (pe), "c" (me) > : "eax" > ); > p = pe + 1; >@@ -413,7 +442,11 @@ > } > asm __volatile__ ( > >- "pushl %%ebp\n\t" >+ // Save xorVal on stack as we use ecx later >+ "pushl %%ecx\n\t" >+ // Push me(edx) onto tos ready for rand calls >+ "pushl %%edx\n\t" // Push function inputs onto stack >+ // edx now available as general register > > // Skip first increment > "jmp L26\n\t" >@@ -429,16 +462,14 @@ > // Get next random number, pass in me(edx), random value returned in num(eax) > // num = rand(me); > // cdecl call maintains all registers except eax, ecx, and edx >- // We maintain edx with a push and pop here using it also as an input >+ // me(edx) is already on tos, and we keep it there saving pushes and pops > // we don't need the current eax value and want it to change to the return value > // we overwrite ecx shortly after this discarding its current value >- "pushl %%edx\n\t" // Push function inputs onto stack > "call rand\n\t" >- "popl %%edx\n\t" // Remove function inputs from stack > >- // XOR the random number with xorVal(ebx), which is either 0xffffffff or 0 depending on the outer loop >+ // XOR the random number with xorVal(ecx), which is either 0xffffffff or 0 depending on the outer loop > // if (i) { num = ~num; } >- "xorl %%ebx,%%eax\n\t" >+ "xorl 4(%%esp),%%eax\n\t" > > // Move the current value of the current position p(edi) into bad(ecx) > // (bad=*p) >@@ -453,19 +484,20 @@ > // Set a new value or not num(eax) at the current position p(edi) > // *p = ~num; > "L25:\n\t" >- "movl $0xffffffff,%%ebp\n\t" >- "xorl %%ebp,%%eax\n\t" >+ "movl $0xffffffff,%%edx\n\t" >+ "xorl %%edx,%%eax\n\t" > "movl %%eax,(%%edi)\n\t" > > // Loop until current position p(edi) equals the end position pe(esi) >- "cmpl %%esi,%%edi\n\t" >+ "movl %%esi,%%edx\n\t" >+ "cmpl %%edx,%%edi\n\t" > "jb L27\n\t" > "jmp L24\n" > > // Error case > "L23:\n\t" > // Must manually maintain eax, ecx, and edx as part of cdecl call convention >- "pushl %%edx\n\t" >+ // but don't need to preserve edx register > "pushl %%ecx\n\t" // Next three pushes are functions input > "pushl %%eax\n\t" > "pushl %%edi\n\t" >@@ -473,14 +505,14 @@ > "popl %%edi\n\t" // Remove function inputs from stack and restore register values > "popl %%eax\n\t" > "popl %%ecx\n\t" >- "popl %%edx\n\t" > "jmp L25\n" > > "L24:\n\t" >- "popl %%ebp\n\t" >- :: "D" (p), "S" (pe), "b" (xorVal), >+ "popl %%edx\n\t" // Remove rand function input me(edx) from stack >+ "popl %%ecx\n\t" // xorVal >+ :: "D" (p), "S" (pe), "c" (xorVal), > "d" (me) >- : "eax", "ecx" >+ : "eax" > ); > p = pe + 1; > } while (!done); >@@ -589,7 +621,7 @@ > "cmpl %%eax,%%ecx\n\t" \ > "jne L3\n\t" \ > "L5:\n\t" \ >- "movl %%ebx,(%%edi)\n\t" \ >+ "movl %%esi,(%%edi)\n\t" \ > "cmpl %%edx,%%edi\n\t" \ > "jb L0\n\t" \ > "jmp L4\n" \ >@@ -609,7 +641,7 @@ > "jmp L5\n" \ > > "L4:\n\t" \ >- :: "a" (p1), "D" (p), "d" (pe), "b" (p2) >+ :: "a" (p1), "D" (p), "d" (pe), "S" (p2) > : "ecx" > ); > p = pe + 1; >@@ -658,7 +690,7 @@ > "subl $4, %%edi\n\t" > "L9:\n\t" > "movl (%%edi),%%ecx\n\t" >- "cmpl %%ebx,%%ecx\n\t" >+ "cmpl %%esi,%%ecx\n\t" > "jne L6\n\t" > "L10:\n\t" > "movl %%eax,(%%edi)\n\t" >@@ -670,18 +702,18 @@ > "pushl %%edx\n\t" > "pushl %%eax\n\t" > "pushl %%ecx\n\t" >- "pushl %%ebx\n\t" >+ "pushl %%esi\n\t" > "pushl %%edi\n\t" > "call error\n\t" > "popl %%edi\n\t" >- "popl %%ebx\n\t" >+ "popl %%esi\n\t" > "popl %%ecx\n\t" > "popl %%eax\n\t" > "popl %%edx\n\t" > "jmp L10\n" > > "L7:\n\t" >- :: "a" (p1), "D" (p), "d" (pe), "b" (p2) >+ :: "a" (p1), "D" (p), "d" (pe), "S" (p2) > : "ecx" > ); > p = pe - 1; >@@ -745,20 +777,20 @@ > "addl $4,%%edi\n\t" > "L20:\n\t" > "movl %%ecx,(%%edi)\n\t" >- "addl $1,%%ebx\n\t" >- "cmpl $32,%%ebx\n\t" >+ "addl $1,%%edx\n\t" >+ "cmpl $32,%%edx\n\t" > "jne L21\n\t" > "movl %%esi,%%ecx\n\t" >- "xorl %%ebx,%%ebx\n\t" >+ "xorl %%edx,%%edx\n\t" > "jmp L22\n" > "L21:\n\t" > "shll $1,%%ecx\n\t" > "orl %%eax,%%ecx\n\t" > "L22:\n\t" >- "cmpl %%edx,%%edi\n\t" >+ "cmpl %3,%%edi\n\t" > "jb L923\n\t" >- : "=b" (k), "=c" (pat) >- : "D" (p),"d" (pe),"b" (k),"c" (pat), >+ : "=d" (k), "=c" (pat) >+ : "D" (p),"m" (pe),"d" (k),"c" (pat), > "a" (sval), "S" (lb) > ); > p = pe + 1; >@@ -826,17 +858,19 @@ > "notl %%ecx\n\t" > "movl %%ecx,(%%edi)\n\t" > "notl %%ecx\n\t" >- "incl %%ebx\n\t" >- "cmpl $32,%%ebx\n\t" >+ "incl %%edx\n\t" >+ "cmpl $32,%%edx\n\t" > "jne L31\n\t" > "movl %%esi,%%ecx\n\t" >- "xorl %%ebx,%%ebx\n\t" >+ "xorl %%edx,%%edx\n\t" > "jmp L32\n" > "L31:\n\t" > "shll $1,%%ecx\n\t" > "orl %%eax,%%ecx\n\t" > "L32:\n\t" >- "cmpl %%edx,%%edi\n\t" >+ "popl %%ebp\n\t" >+ "cmpl %3,%%edi\n\t" >+ "pushl %%ebp\n\t" > "jb L930\n\t" > "jmp L33\n\t" > >@@ -860,8 +894,8 @@ > > "L33:\n\t" > "popl %%ebp\n\t" >- : "=b" (k),"=c" (pat) >- : "D" (p),"d" (pe),"b" (k),"c" (pat), >+ : "=d" (k),"=c" (pat) >+ : "D" (p),"m" (pe),"d" (k),"c" (pat), > "a" (sval), "S" (lb) > ); > p = pe + 1; >@@ -935,17 +969,19 @@ > "L45:\n\t" > "notl %%ecx\n\t" > "movl %%ecx,(%%edi)\n\t" >- "decl %%ebx\n\t" >- "cmpl $0,%%ebx\n\t" >+ "decl %%edx\n\t" >+ "cmpl $0,%%edx\n\t" > "jg L41\n\t" > "movl %%esi,%%ecx\n\t" >- "movl $32,%%ebx\n\t" >+ "movl $32,%%edx\n\t" > "jmp L42\n" > "L41:\n\t" > "shrl $1,%%ecx\n\t" > "orl %%eax,%%ecx\n\t" > "L42:\n\t" >- "cmpl %%edx,%%edi\n\t" >+ "popl %%ebp\n\t" >+ "cmpl %3,%%edi\n\t" >+ "pushl %%ebp\n\t" > "ja L49\n\t" > "jmp L43\n\t" > >@@ -969,8 +1005,8 @@ > > "L43:\n\t" > "popl %%ebp\n\t" >- : "=b" (k), "=c" (pat) >- : "D" (p),"d" (pe),"b" (k),"c" (pat), >+ : "=d" (k), "=c" (pat) >+ : "D" (p),"m" (pe),"d" (k),"c" (pat), > "a" (p3), "S" (hb) > ); > p = pe - 1; >@@ -1082,20 +1118,20 @@ > "L54:\n\t" \ > "addl $4,%%edi\n\t" \ > "L50:\n\t" \ >- "cmpl %%ebx,%%ecx\n\t" \ >+ "cmpl %%edx,%%ecx\n\t" \ > "je L52\n\t" \ > "movl %%eax,(%%edi)\n\t" \ > "L52:\n\t" \ >- "incl %%ebx\n\t" \ >- "cmpl $19,%%ebx\n\t" \ >+ "incl %%edx\n\t" \ >+ "cmpl $19,%%edx\n\t" \ > "jle L53\n\t" \ >- "xorl %%ebx,%%ebx\n\t" \ >+ "xorl %%edx,%%edx\n\t" \ > "L53:\n\t" \ >- "cmpl %%edx,%%edi\n\t" \ >+ "cmpl %%esi,%%edi\n\t" \ > "jb L54\n\t" \ >- : "=b" (k) >- : "D" (p), "d" (pe), "a" (p2), >- "b" (k), "c" (offset) >+ : "=d" (k) >+ : "D" (p), "S" (pe), "a" (p2), >+ "d" (k), "c" (offset) > ); > p = pe + 1; > } while (!done);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 538596
:
407586
|
457366
| 457450