diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2008-02-23 17:29:17 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2008-02-23 17:29:17 +0000 |
commit | 849830bdfb30c93fda1fd4098b7070e8159d3663 (patch) | |
tree | b88c05e367d6766b332cdcd12786e6b8e4cc1be3 | |
parent | 1cd81501f406fd8c488574d3130c61ab4c492315 (diff) | |
download | fsf-binutils-gdb-849830bdfb30c93fda1fd4098b7070e8159d3663.zip fsf-binutils-gdb-849830bdfb30c93fda1fd4098b7070e8159d3663.tar.gz fsf-binutils-gdb-849830bdfb30c93fda1fd4098b7070e8159d3663.tar.bz2 |
gas/testsuite/
2008-02-23 H.J. Lu <hongjiu.lu@intel.com>
* gas/i386/jump.s: Add tests for far branches.
* gas/i386/jump16.s: Likewise.
* gas/i386/jump.d: Updated.
* gas/i386/jump16.d: Likewise.
* gas/i386/x86-64-inval.l: Likewise.
* gas/i386/x86-64-inval.s: Add tests for 16-bit near indirect
branches.
opcodes/
2008-02-23 H.J. Lu <hongjiu.lu@intel.com>
* i386-opc.tbl: Disallow 16-bit near indirect branches for
x86-64.
* i386-tbl.h: Regenerated.
-rw-r--r-- | gas/testsuite/ChangeLog | 12 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/jump.d | 47 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/jump.s | 13 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/jump16.d | 76 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/jump16.s | 13 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/x86-64-inval.l | 221 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/x86-64-inval.s | 41 | ||||
-rw-r--r-- | opcodes/ChangeLog | 6 | ||||
-rw-r--r-- | opcodes/i386-opc.tbl | 4 | ||||
-rw-r--r-- | opcodes/i386-tbl.h | 12 |
10 files changed, 304 insertions, 141 deletions
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 63375ba..f3465f8 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,15 @@ +2008-02-23 H.J. Lu <hongjiu.lu@intel.com> + + * gas/i386/jump.s: Add tests for far branches. + * gas/i386/jump16.s: Likewise. + + * gas/i386/jump.d: Updated. + * gas/i386/jump16.d: Likewise. + * gas/i386/x86-64-inval.l: Likewise. + + * gas/i386/x86-64-inval.s: Add tests for 16-bit near indirect + branches. + 2008-02-22 Nick Clifton <nickc@redhat.com> * gas/m68hc11/bug-1825.d: Update to match changes in the diff --git a/gas/testsuite/gas/i386/jump.d b/gas/testsuite/gas/i386/jump.d index cddd4a3..c8e8c6d 100644 --- a/gas/testsuite/gas/i386/jump.d +++ b/gas/testsuite/gas/i386/jump.d @@ -5,22 +5,31 @@ Disassembly of section .text: -0+000 <.text>: - 0: eb fe [ ]*jmp (0x0|0 <.text>) - 2: e9 ((fc|f9) ff ff ff|00 00 00 00) [ ]*jmp (0x)?(0|3|7)( <.text(\+0x7)?>)? 3: (R_386_PC)?(DISP)?32 xxx - 7: ff 25 00 00 00 00 [ ]*jmp \*0x0 9: (R_386_)?(dir)?32 xxx - d: ff e7 [ ]*jmp \*%edi - f: ff 27 [ ]*jmp \*\(%edi\) - 11: ff 2c bd 00 00 00 00 [ ]*ljmp \*0x0\(,%edi,4\) 14: (R_386_)?(dir)?32 xxx - 18: ff 2d 00 00 00 00 [ ]*ljmp \*0x0 1a: (R_386_)?(dir)?32 xxx - 1e: ea 00 00 00 00 34 12 [ ]*ljmp \$0x1234,\$0x0 1f: (R_386_)?(dir)?32 xxx - 25: e8 d6 ff ff ff [ ]*call (0x0|0 <.text>) - 2a: e8 ((fc|d1) ff ff ff|00 00 00 00) [ ]*call (0x)?(0|2b|2f)( <.text(\+0x2f)?>)? 2b: (R_386_PC)?(DISP)?32 xxx - 2f: ff 15 00 00 00 00 [ ]*call \*0x0 31: (R_386_)?(dir)?32 xxx - 35: ff d7 [ ]*call \*%edi - 37: ff 17 [ ]*call \*\(%edi\) - 39: ff 1c bd 00 00 00 00 [ ]*lcall \*0x0\(,%edi,4\) 3c: (R_386_)?(dir)?32 xxx - 40: ff 1d 00 00 00 00 [ ]*lcall \*0x0 42: (R_386_)?(dir)?32 xxx - 46: 9a 00 00 00 00 34 12 [ ]*lcall \$0x1234,\$0x0 47: (R_386_)?(dir)?32 xxx - 4d:.* -.* +0+ <.text>: +[ ]*[a-f0-9]+: eb fe jmp 0x0 +[ ]*[a-f0-9]+: e9 fc ff ff ff jmp 0x3 3: R_386_PC32 xxx +[ ]*[a-f0-9]+: ff 25 00 00 00 00 jmp \*0x0 9: R_386_32 xxx +[ ]*[a-f0-9]+: ff e7 jmp \*%edi +[ ]*[a-f0-9]+: ff 27 jmp \*\(%edi\) +[ ]*[a-f0-9]+: ff 2c bd 00 00 00 00 ljmp \*0x0\(,%edi,4\) 14: R_386_32 xxx +[ ]*[a-f0-9]+: 66 ff 2c bd 00 00 00 00 ljmpw \*0x0\(,%edi,4\) 1c: R_386_32 xxx +[ ]*[a-f0-9]+: ff 2d 00 00 00 00 ljmp \*0x0 22: R_386_32 xxx +[ ]*[a-f0-9]+: 66 ff 2d 00 00 00 00 ljmpw \*0x0 29: R_386_32 xxx +[ ]*[a-f0-9]+: ea 00 00 00 00 34 12 ljmp \$0x1234,\$0x0 2e: R_386_32 xxx +[ ]*[a-f0-9]+: e8 c7 ff ff ff call 0x0 +[ ]*[a-f0-9]+: e8 fc ff ff ff call 0x3a 3a: R_386_PC32 xxx +[ ]*[a-f0-9]+: ff 15 00 00 00 00 call \*0x0 40: R_386_32 xxx +[ ]*[a-f0-9]+: ff d7 call \*%edi +[ ]*[a-f0-9]+: ff 17 call \*\(%edi\) +[ ]*[a-f0-9]+: ff 1c bd 00 00 00 00 lcall \*0x0\(,%edi,4\) 4b: R_386_32 xxx +[ ]*[a-f0-9]+: 66 ff 1c bd 00 00 00 00 lcallw \*0x0\(,%edi,4\) 53: R_386_32 xxx +[ ]*[a-f0-9]+: ff 1d 00 00 00 00 lcall \*0x0 59: R_386_32 xxx +[ ]*[a-f0-9]+: 66 ff 1d 00 00 00 00 lcallw \*0x0 60: R_386_32 xxx +[ ]*[a-f0-9]+: 9a 00 00 00 00 34 12 lcall \$0x1234,\$0x0 65: R_386_32 xxx +[ ]*[a-f0-9]+: 66 ff 13 callw \*\(%ebx\) +[ ]*[a-f0-9]+: ff 13 call \*\(%ebx\) +[ ]*[a-f0-9]+: ff 1b lcall \*\(%ebx\) +[ ]*[a-f0-9]+: 66 ff 23 jmpw \*\(%ebx\) +[ ]*[a-f0-9]+: ff 23 jmp \*\(%ebx\) +[ ]*[a-f0-9]+: ff 2b ljmp \*\(%ebx\) +#pass diff --git a/gas/testsuite/gas/i386/jump.s b/gas/testsuite/gas/i386/jump.s index 1f11cd3..b760825 100644 --- a/gas/testsuite/gas/i386/jump.s +++ b/gas/testsuite/gas/i386/jump.s @@ -8,7 +8,9 @@ jmp *%edi jmp *(%edi) ljmp *xxx(,%edi,4) + ljmpw *xxx(,%edi,4) ljmp *xxx + ljmpw *xxx ljmp $0x1234,$xxx call 1b @@ -17,8 +19,15 @@ call *%edi call *(%edi) lcall *xxx(,%edi,4) + lcallw *xxx(,%edi,4) lcall *xxx + lcallw *xxx lcall $0x1234,$xxx - # Force a good alignment. - .p2align 4,0 + .intel_syntax noprefix + call word ptr [ebx] + call dword ptr [ebx] + call fword ptr [ebx] + jmp word ptr [ebx] + jmp dword ptr [ebx] + jmp fword ptr [ebx] diff --git a/gas/testsuite/gas/i386/jump16.d b/gas/testsuite/gas/i386/jump16.d index 87951ef..b2903d7 100644 --- a/gas/testsuite/gas/i386/jump16.d +++ b/gas/testsuite/gas/i386/jump16.d @@ -5,36 +5,46 @@ Disassembly of section .text: -0+000 <.text>: - 0: eb fe [ ]*jmp (0x0|0 <.text>) - 2: e9 (fe|fb) ff [ ]*jmp (0x3|0x0|0 <.text>) 3: (R_386_PC)?(DISP)?16 xxx - 5: ff 26 00 00 [ ]*jmp \*0x0 7: (R_386_)?(dir)?16 xxx - 9: 66 ff e7 [ ]*jmpl \*%edi - c: 67 ff 27 [ ]*addr32 jmp \*\(%edi\) - f: 67 ff af 00 00 00 00 [ ]*addr32 ljmp \*0x0\(%edi\) 12: (R_386_)?(dir)?32 xxx - 16: ff 2e 00 00 [ ]*ljmp \*0x0 18: (R_386_)?(dir)?16 xxx - 1a: ea 00 00 34 12 [ ]*ljmp \$0x1234,\$0x0 1b: (R_386_)?(dir)?16 xxx - 1f: 66 e8 db ff ff ff [ ]*calll (0x0|0 <.text>) - 25: 66 e8 (fc|d5) ff ff ff [ ]*calll (0x27|0x0|0 <.text>) 27: (R_386_PC)?(DISP)?32 xxx - 2b: 66 ff 16 00 00 [ ]*calll \*0x0 2e: (R_386_)?(dir)?16 xxx - 30: 66 ff d7 [ ]*calll \*%edi - 33: 67 66 ff 17 [ ]*addr32 calll \*\(%edi\) - 37: 67 66 ff 9f 00 00 00 00 [ ]*addr32 lcalll \*0x0\(%edi\) 3b: (R_386_)?(dir)?32 xxx - 3f: 66 ff 1e 00 00 [ ]*lcalll \*0x0 42: (R_386_)?(dir)?16 xxx - 44: 66 9a 00 00 00 00 34 12 [ ]*lcalll \$0x1234,\$0x0 46: (R_386_)?(dir)?32 xxx - 4c: eb b2 [ ]*jmp (0x0|0 <.text>) - 4e: ff 26 00 00 [ ]*jmp \*0x0 50: (R_386_)?(dir)?16 xxx - 52: ff e7 [ ]*jmp \*%di - 54: ff 25 [ ]*jmp \*\(%di\) - 56: ff ad 00 00 [ ]*ljmp \*0x0\(%di\) 58: (R_386_)?(dir)?16 xxx - 5a: ff 2e 00 00 [ ]*ljmp \*0x0 5c: (R_386_)?(dir)?16 xxx - 5e: ea 00 00 34 12 [ ]*ljmp \$0x1234,\$0x0 5f: (R_386_)?(dir)?16 xxx - 63: e8 9a ff [ ]*call (0x0|0 <.text>) - 66: e8 (fe|97) ff [ ]*call (0x67|0x0|0 <.text>) 67: (R_386_PC)?(DISP)?16 xxx - 69: ff 16 00 00 [ ]*call \*0x0 6b: (R_386_)?(dir)?16 xxx - 6d: ff d7 [ ]*call \*%di - 6f: ff 15 [ ]*call \*\(%di\) - 71: ff 9d 00 00 [ ]*lcall \*0x0\(%di\) 73: (R_386_)?(dir)?16 xxx - 75: ff 1e 00 00 [ ]*lcall \*0x0 77: (R_386_)?(dir)?16 xxx - 79: 9a 00 00 34 12 [ ]*lcall \$0x1234,\$0x0 7a: (R_386_)?(dir)?16 xxx - ... +0+ <.text>: +[ ]*[a-f0-9]+: eb fe jmp 0x0 +[ ]*[a-f0-9]+: e9 fe ff jmp 0x3 3: R_386_PC16 xxx +[ ]*[a-f0-9]+: ff 26 00 00 jmp \*0x0 7: R_386_16 xxx +[ ]*[a-f0-9]+: 66 ff e7 jmpl \*%edi +[ ]*[a-f0-9]+: 67 ff 27 addr32 jmp \*\(%edi\) +[ ]*[a-f0-9]+: 67 ff af 00 00 00 00 addr32 ljmp \*0x0\(%edi\) 12: R_386_32 xxx +[ ]*[a-f0-9]+: ff 2e 00 00 ljmp \*0x0 18: R_386_16 xxx +[ ]*[a-f0-9]+: ea 00 00 34 12 ljmp \$0x1234,\$0x0 1b: R_386_16 xxx +[ ]*[a-f0-9]+: 66 e8 db ff ff ff calll 0x0 +[ ]*[a-f0-9]+: 66 e8 fc ff ff ff calll 0x27 27: R_386_PC32 xxx +[ ]*[a-f0-9]+: 66 ff 16 00 00 calll \*0x0 2e: R_386_16 xxx +[ ]*[a-f0-9]+: 66 ff d7 calll \*%edi +[ ]*[a-f0-9]+: 67 66 ff 17 addr32 calll \*\(%edi\) +[ ]*[a-f0-9]+: 67 66 ff 9f 00 00 00 00 addr32 lcalll \*0x0\(%edi\) 3b: R_386_32 xxx +[ ]*[a-f0-9]+: 66 ff 1e 00 00 lcalll \*0x0 42: R_386_16 xxx +[ ]*[a-f0-9]+: 66 9a 00 00 00 00 34 12 lcalll \$0x1234,\$0x0 46: R_386_32 xxx +[ ]*[a-f0-9]+: eb b2 jmp 0x0 +[ ]*[a-f0-9]+: ff 26 00 00 jmp \*0x0 50: R_386_16 xxx +[ ]*[a-f0-9]+: ff e7 jmp \*%di +[ ]*[a-f0-9]+: ff 25 jmp \*\(%di\) +[ ]*[a-f0-9]+: ff ad 00 00 ljmp \*0x0\(%di\) 58: R_386_16 xxx +[ ]*[a-f0-9]+: 66 ff ad 00 00 ljmpl \*0x0\(%di\) 5d: R_386_16 xxx +[ ]*[a-f0-9]+: ff 2e 00 00 ljmp \*0x0 61: R_386_16 xxx +[ ]*[a-f0-9]+: 66 ff 2e 00 00 ljmpl \*0x0 66: R_386_16 xxx +[ ]*[a-f0-9]+: ea 00 00 34 12 ljmp \$0x1234,\$0x0 69: R_386_16 xxx +[ ]*[a-f0-9]+: e8 90 ff call 0x0 +[ ]*[a-f0-9]+: e8 fe ff call 0x71 71: R_386_PC16 xxx +[ ]*[a-f0-9]+: ff 16 00 00 call \*0x0 75: R_386_16 xxx +[ ]*[a-f0-9]+: ff d7 call \*%di +[ ]*[a-f0-9]+: ff 15 call \*\(%di\) +[ ]*[a-f0-9]+: ff 9d 00 00 lcall \*0x0\(%di\) 7d: R_386_16 xxx +[ ]*[a-f0-9]+: 66 ff 9d 00 00 lcalll \*0x0\(%di\) 82: R_386_16 xxx +[ ]*[a-f0-9]+: ff 1e 00 00 lcall \*0x0 86: R_386_16 xxx +[ ]*[a-f0-9]+: 66 ff 1e 00 00 lcalll \*0x0 8b: R_386_16 xxx +[ ]*[a-f0-9]+: 9a 00 00 34 12 lcall \$0x1234,\$0x0 8e: R_386_16 xxx +[ ]*[a-f0-9]+: ff 17 call \*\(%bx\) +[ ]*[a-f0-9]+: ff 1f lcall \*\(%bx\) +[ ]*[a-f0-9]+: 66 ff 1f lcalll \*\(%bx\) +[ ]*[a-f0-9]+: ff 27 jmp \*\(%bx\) +[ ]*[a-f0-9]+: ff 2f ljmp \*\(%bx\) +[ ]*[a-f0-9]+: 66 ff 2f ljmpl \*\(%bx\) +#pass diff --git a/gas/testsuite/gas/i386/jump16.s b/gas/testsuite/gas/i386/jump16.s index 1eee242..d6238b8 100644 --- a/gas/testsuite/gas/i386/jump16.s +++ b/gas/testsuite/gas/i386/jump16.s @@ -27,7 +27,9 @@ jmp *%di jmp *(%di) ljmp *xxx(%di) + ljmpl *xxx(%di) ljmp *xxx + ljmpl *xxx ljmp $0x1234,$xxx call 1b @@ -36,8 +38,15 @@ call *%di call *(%di) lcall *xxx(%di) + lcalll *xxx(%di) lcall *xxx + lcalll *xxx lcall $0x1234,$xxx - # Force a good alignment. - .p2align 4,0 + .intel_syntax noprefix + call word ptr [bx] + call dword ptr [bx] + call fword ptr [bx] + jmp word ptr [bx] + jmp dword ptr [bx] + jmp fword ptr [bx] diff --git a/gas/testsuite/gas/i386/x86-64-inval.l b/gas/testsuite/gas/i386/x86-64-inval.l index fe684d7..c663a12 100644 --- a/gas/testsuite/gas/i386/x86-64-inval.l +++ b/gas/testsuite/gas/i386/x86-64-inval.l @@ -58,6 +58,8 @@ .*:59: Error: .* .*:60: Error: .* .*:61: Error: .* +.*:62: Error: .* +.*:63: Error: .* .*:64: Error: .* .*:65: Error: .* .*:66: Error: .* @@ -69,8 +71,6 @@ .*:72: Error: .* .*:73: Error: .* .*:74: Error: .* -.*:75: Error: .* -.*:76: Error: .* .*:77: Error: .* .*:78: Error: .* .*:79: Error: .* @@ -80,6 +80,41 @@ .*:83: Error: .* .*:84: Error: .* .*:85: Error: .* +.*:86: Error: .* +.*:87: Error: .* +.*:88: Error: .* +.*:89: Error: .* +.*:90: Error: .* +.*:91: Error: .* +.*:92: Error: .* +.*:93: Error: .* +.*:94: Error: .* +.*:95: Error: .* +.*:96: Error: .* +.*:97: Error: .* +.*:98: Error: .* +.*:99: Error: .* +.*:100: Error: .* +.*:101: Error: .* +.*:102: Error: .* +.*:103: Error: .* +.*:104: Error: .* +.*:105: Error: .* +.*:106: Error: .* +.*:107: Error: .* +.*:108: Error: .* +.*:109: Error: .* +.*:110: Error: .* +.*:111: Error: .* +.*:112: Error: .* +.*:113: Error: .* +.*:114: Error: .* +.*:115: Error: .* +.*:116: Error: .* +.*:117: Error: .* +.*:118: Error: .* +.*:119: Error: .* +.*:120: Error: .* GAS LISTING .* @@ -96,78 +131,116 @@ GAS LISTING .* [ ]*11[ ]+calll \*\(%eax\) \# 32-bit data size not allowed [ ]*12[ ]+calll \*\(%r8\) \# 32-bit data size not allowed [ ]*13[ ]+calll \*\(%rax\) \# 32-bit data size not allowed -[ ]*14[ ]+callq \*\(%ax\) \# 32-bit data size not allowed -[ ]*15[ ]+callw \*\(%ax\) \# no 16-bit addressing -[ ]*16[ ]+daa \# illegal -[ ]*17[ ]+das \# illegal -[ ]*18[ ]+enterl \$0,\$0 \# can't have 32-bit stack operands -[ ]*19[ ]+into \# illegal -[ ]*20[ ]+foo: jcxz foo \# No prefix exists to select CX as a counter -[ ]*21[ ]+jmpl \*%eax \# 32-bit data size not allowed -[ ]*22[ ]+jmpl \*\(%rax\) \# 32-bit data size not allowed -[ ]*23[ ]+lcalll \$0,\$0 \# illegal -[ ]*24[ ]+lcallq \$0,\$0 \# illegal -[ ]*25[ ]+ldsl %eax,\(%rax\) \# illegal -[ ]*26[ ]+ldsq %rax,\(%rax\) \# illegal -[ ]*27[ ]+lesl %eax,\(%rax\) \# illegal -[ ]*28[ ]+lesq %rax,\(%rax\) \# illegal -[ ]*29[ ]+ljmpl \$0,\$0 \# illegal -[ ]*30[ ]+ljmpq \$0,\$0 \# illegal -[ ]*31[ ]+ljmpq \*\(%rax\) \# 64-bit data size not allowed -[ ]*32[ ]+loopw foo \# No prefix exists to select CX as a counter -[ ]*33[ ]+loopew foo \# No prefix exists to select CX as a counter -[ ]*34[ ]+loopnew foo \# No prefix exists to select CX as a counter -[ ]*35[ ]+loopnzw foo \# No prefix exists to select CX as a counter -[ ]*36[ ]+loopzw foo \# No prefix exists to select CX as a counter -[ ]*37[ ]+leavel \# can't have 32-bit stack operands -[ ]*38[ ]+pop %ds \# illegal -[ ]*39[ ]+pop %es \# illegal -[ ]*40[ ]+pop %ss \# illegal -[ ]*41[ ]+popa \# illegal -[ ]*42[ ]+popl %eax \# can't have 32-bit stack operands -[ ]*43[ ]+push %cs \# illegal -[ ]*44[ ]+push %ds \# illegal -[ ]*45[ ]+push %es \# illegal -[ ]*46[ ]+push %ss \# illegal -[ ]*47[ ]+pusha \# illegal -[ ]*48[ ]+pushl %eax \# can't have 32-bit stack operands -[ ]*49[ ]+pushfl \# can't have 32-bit stack operands -[ ]*50[ ]+popfl \# can't have 32-bit stack operands -[ ]*51[ ]+retl \# can't have 32-bit stack operands -[ ]*52[ ]+insertq \$4,\$2,%xmm2,%ebx \# The last operand must be XMM register\. -[ ]*53[ ]+fnstsw %eax -[ ]*54[ ]+fnstsw %al -[ ]*55[ ]+fstsw %eax -[ ]*56[ ]+fstsw %al -[ ]*57[ ]+in \$8,%rax +[ ]*14[ ]+callw \*%ax \# 16-bit data size not allowed +[ ]*15[ ]+callw \*\(%ax\) \# 16-bit data size not allowed +[ ]*16[ ]+callw \*\(%eax\) \# 16-bit data size not allowed +[ ]*17[ ]+callw \*\(%r8\) \# 16-bit data size not allowed +[ ]*18[ ]+callw \*\(%rax\) \# 16-bit data size not allowed +[ ]*19[ ]+callq \*\(%ax\) \# no 16-bit addressing +[ ]*20[ ]+daa \# illegal +[ ]*21[ ]+das \# illegal +[ ]*22[ ]+enterl \$0,\$0 \# can't have 32-bit stack operands +[ ]*23[ ]+into \# illegal +[ ]*24[ ]+foo: jcxz foo \# No prefix exists to select CX as a counter +[ ]*25[ ]+jmpl \*%eax \# 32-bit data size not allowed +[ ]*26[ ]+jmpl \*\(%ax\) \# 32-bit data size not allowed +[ ]*27[ ]+jmpl \*\(%eax\) \# 32-bit data size not allowed +[ ]*28[ ]+jmpl \*\(%r8\) \# 32-bit data size not allowed +[ ]*29[ ]+jmpl \*\(%rax\) \# 32-bit data size not allowed +[ ]*30[ ]+jmpw \*%ax \# 16-bit data size not allowed +[ ]*31[ ]+jmpw \*\(%ax\) \# 16-bit data size not allowed +[ ]*32[ ]+jmpw \*\(%eax\) \# 16-bit data size not allowed +[ ]*33[ ]+jmpw \*\(%r8\) \# 16-bit data size not allowed +[ ]*34[ ]+jmpw \*\(%rax\) \# 16-bit data size not allowed +[ ]*35[ ]+jmpq \*\(%ax\) \# no 16-bit addressing +[ ]*36[ ]+lcalll \$0,\$0 \# illegal +[ ]*37[ ]+lcallq \$0,\$0 \# illegal +[ ]*38[ ]+ldsl %eax,\(%rax\) \# illegal +[ ]*39[ ]+ldsq %rax,\(%rax\) \# illegal +[ ]*40[ ]+lesl %eax,\(%rax\) \# illegal +[ ]*41[ ]+lesq %rax,\(%rax\) \# illegal +[ ]*42[ ]+ljmpl \$0,\$0 \# illegal +[ ]*43[ ]+ljmpq \$0,\$0 \# illegal +[ ]*44[ ]+ljmpq \*\(%rax\) \# 64-bit data size not allowed +[ ]*45[ ]+loopw foo \# No prefix exists to select CX as a counter +[ ]*46[ ]+loopew foo \# No prefix exists to select CX as a counter +[ ]*47[ ]+loopnew foo \# No prefix exists to select CX as a counter +[ ]*48[ ]+loopnzw foo \# No prefix exists to select CX as a counter +[ ]*49[ ]+loopzw foo \# No prefix exists to select CX as a counter +[ ]*50[ ]+leavel \# can't have 32-bit stack operands +[ ]*51[ ]+pop %ds \# illegal +[ ]*52[ ]+pop %es \# illegal +[ ]*53[ ]+pop %ss \# illegal +[ ]*54[ ]+popa \# illegal +[ ]*55[ ]+popl %eax \# can't have 32-bit stack operands +[ ]*56[ ]+push %cs \# illegal +[ ]*57[ ]+push %ds \# illegal GAS LISTING .* -[ ]*58[ ]+out %rax,\$8 -[ ]*59[ ]+movzxl \(%rax\),%rax -[ ]*60[ ]+movnti %ax, \(%rax\) -[ ]*61[ ]+movntiw %ax, \(%rax\) -[ ]*62[ ]+ -[ ]*63[ ]+\.intel_syntax noprefix -[ ]*64[ ]+cmpxchg16b dword ptr \[rax\] \# Must be oword -[ ]*65[ ]+movq xmm1, XMMWORD PTR \[rsp\] -[ ]*66[ ]+movq xmm1, DWORD PTR \[rsp\] -[ ]*67[ ]+movq xmm1, WORD PTR \[rsp\] -[ ]*68[ ]+movq xmm1, BYTE PTR \[rsp\] -[ ]*69[ ]+movq XMMWORD PTR \[rsp\],xmm1 -[ ]*70[ ]+movq DWORD PTR \[rsp\],xmm1 -[ ]*71[ ]+movq WORD PTR \[rsp\],xmm1 -[ ]*72[ ]+movq BYTE PTR \[rsp\],xmm1 -[ ]*73[ ]+fnstsw eax -[ ]*74[ ]+fnstsw al -[ ]*75[ ]+fstsw eax -[ ]*76[ ]+fstsw al -[ ]*77[ ]+in rax,8 -[ ]*78[ ]+out 8,rax -[ ]*79[ ]+movsx ax, \[rax\] -[ ]*80[ ]+movsx eax, \[rax\] -[ ]*81[ ]+movsx rax, \[rax\] -[ ]*82[ ]+movzx ax, \[rax\] -[ ]*83[ ]+movzx eax, \[rax\] -[ ]*84[ ]+movzx rax, \[rax\] -[ ]*85[ ]+movnti word ptr \[rax\], ax +[ ]*58[ ]+push %es \# illegal +[ ]*59[ ]+push %ss \# illegal +[ ]*60[ ]+pusha \# illegal +[ ]*61[ ]+pushl %eax \# can't have 32-bit stack operands +[ ]*62[ ]+pushfl \# can't have 32-bit stack operands +[ ]*63[ ]+popfl \# can't have 32-bit stack operands +[ ]*64[ ]+retl \# can't have 32-bit stack operands +[ ]*65[ ]+insertq \$4,\$2,%xmm2,%ebx \# The last operand must be XMM register\. +[ ]*66[ ]+fnstsw %eax +[ ]*67[ ]+fnstsw %al +[ ]*68[ ]+fstsw %eax +[ ]*69[ ]+fstsw %al +[ ]*70[ ]+in \$8,%rax +[ ]*71[ ]+out %rax,\$8 +[ ]*72[ ]+movzxl \(%rax\),%rax +[ ]*73[ ]+movnti %ax, \(%rax\) +[ ]*74[ ]+movntiw %ax, \(%rax\) +[ ]*75[ ]+ +[ ]*76[ ]+\.intel_syntax noprefix +[ ]*77[ ]+cmpxchg16b dword ptr \[rax\] \# Must be oword +[ ]*78[ ]+movq xmm1, XMMWORD PTR \[rsp\] +[ ]*79[ ]+movq xmm1, DWORD PTR \[rsp\] +[ ]*80[ ]+movq xmm1, WORD PTR \[rsp\] +[ ]*81[ ]+movq xmm1, BYTE PTR \[rsp\] +[ ]*82[ ]+movq XMMWORD PTR \[rsp\],xmm1 +[ ]*83[ ]+movq DWORD PTR \[rsp\],xmm1 +[ ]*84[ ]+movq WORD PTR \[rsp\],xmm1 +[ ]*85[ ]+movq BYTE PTR \[rsp\],xmm1 +[ ]*86[ ]+fnstsw eax +[ ]*87[ ]+fnstsw al +[ ]*88[ ]+fstsw eax +[ ]*89[ ]+fstsw al +[ ]*90[ ]+in rax,8 +[ ]*91[ ]+out 8,rax +[ ]*92[ ]+movsx ax, \[rax\] +[ ]*93[ ]+movsx eax, \[rax\] +[ ]*94[ ]+movsx rax, \[rax\] +[ ]*95[ ]+movzx ax, \[rax\] +[ ]*96[ ]+movzx eax, \[rax\] +[ ]*97[ ]+movzx rax, \[rax\] +[ ]*98[ ]+movnti word ptr \[rax\], ax +[ ]*99[ ]+calld eax \# 32-bit data size not allowed +[ ]*100[ ]+calld \[ax\] \# 32-bit data size not allowed +[ ]*101[ ]+calld \[eax\] \# 32-bit data size not allowed +[ ]*102[ ]+calld \[r8\] \# 32-bit data size not allowed +[ ]*103[ ]+calld \[rax\] \# 32-bit data size not allowed +[ ]*104[ ]+callw ax \# 16-bit data size not allowed +[ ]*105[ ]+callw \[ax\] \# 16-bit data size not allowed +[ ]*106[ ]+callw \[eax\] \# 16-bit data size not allowed +[ ]*107[ ]+callw \[r8\] \# 16-bit data size not allowed +[ ]*108[ ]+callw \[rax\] \# 16-bit data size not allowed +[ ]*109[ ]+callq \[ax\] \# no 16-bit addressing +[ ]*110[ ]+jmpd eax \# 32-bit data size not allowed +[ ]*111[ ]+jmpd \[ax\] \# 32-bit data size not allowed +[ ]*112[ ]+jmpd \[eax\] \# 32-bit data size not allowed +[ ]*113[ ]+jmpd \[r8\] \# 32-bit data size not allowed +[ ]*114[ ]+jmpd \[rax\] \# 32-bit data size not allowed +GAS LISTING .* + + +[ ]*115[ ]+jmpw ax \# 16-bit data size not allowed +[ ]*116[ ]+jmpw \[ax\] \# 16-bit data size not allowed +[ ]*117[ ]+jmpw \[eax\] \# 16-bit data size not allowed +[ ]*118[ ]+jmpw \[r8\] \# 16-bit data size not allowed +[ ]*119[ ]+jmpw \[rax\] \# 16-bit data size not allowed +[ ]*120[ ]+jmpq \[ax\] \# no 16-bit addressing diff --git a/gas/testsuite/gas/i386/x86-64-inval.s b/gas/testsuite/gas/i386/x86-64-inval.s index b604e46..2688ace 100644 --- a/gas/testsuite/gas/i386/x86-64-inval.s +++ b/gas/testsuite/gas/i386/x86-64-inval.s @@ -11,15 +11,28 @@ calll *(%eax) # 32-bit data size not allowed calll *(%r8) # 32-bit data size not allowed calll *(%rax) # 32-bit data size not allowed - callq *(%ax) # 32-bit data size not allowed - callw *(%ax) # no 16-bit addressing + callw *%ax # 16-bit data size not allowed + callw *(%ax) # 16-bit data size not allowed + callw *(%eax) # 16-bit data size not allowed + callw *(%r8) # 16-bit data size not allowed + callw *(%rax) # 16-bit data size not allowed + callq *(%ax) # no 16-bit addressing daa # illegal das # illegal enterl $0,$0 # can't have 32-bit stack operands into # illegal foo: jcxz foo # No prefix exists to select CX as a counter jmpl *%eax # 32-bit data size not allowed - jmpl *(%rax) # 32-bit data size not allowed + jmpl *(%ax) # 32-bit data size not allowed + jmpl *(%eax) # 32-bit data size not allowed + jmpl *(%r8) # 32-bit data size not allowed + jmpl *(%rax) # 32-bit data size not allowed + jmpw *%ax # 16-bit data size not allowed + jmpw *(%ax) # 16-bit data size not allowed + jmpw *(%eax) # 16-bit data size not allowed + jmpw *(%r8) # 16-bit data size not allowed + jmpw *(%rax) # 16-bit data size not allowed + jmpq *(%ax) # no 16-bit addressing lcalll $0,$0 # illegal lcallq $0,$0 # illegal ldsl %eax,(%rax) # illegal @@ -83,3 +96,25 @@ movzx ax, [rax] movzx eax, [rax] movzx rax, [rax] movnti word ptr [rax], ax + calld eax # 32-bit data size not allowed + calld [ax] # 32-bit data size not allowed + calld [eax] # 32-bit data size not allowed + calld [r8] # 32-bit data size not allowed + calld [rax] # 32-bit data size not allowed + callw ax # 16-bit data size not allowed + callw [ax] # 16-bit data size not allowed + callw [eax] # 16-bit data size not allowed + callw [r8] # 16-bit data size not allowed + callw [rax] # 16-bit data size not allowed + callq [ax] # no 16-bit addressing + jmpd eax # 32-bit data size not allowed + jmpd [ax] # 32-bit data size not allowed + jmpd [eax] # 32-bit data size not allowed + jmpd [r8] # 32-bit data size not allowed + jmpd [rax] # 32-bit data size not allowed + jmpw ax # 16-bit data size not allowed + jmpw [ax] # 16-bit data size not allowed + jmpw [eax] # 16-bit data size not allowed + jmpw [r8] # 16-bit data size not allowed + jmpw [rax] # 16-bit data size not allowed + jmpq [ax] # no 16-bit addressing diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 620fb80..c0a83c4 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,9 @@ +2008-02-23 H.J. Lu <hongjiu.lu@intel.com> + + * i386-opc.tbl: Disallow 16-bit near indirect branches for + x86-64. + * i386-tbl.h: Regenerated. + 2008-02-21 Jan Beulich <jbeulich@novell.com> * i386-opc.tbl: Allow Dword for far indirect call. Allow Dword diff --git a/opcodes/i386-opc.tbl b/opcodes/i386-opc.tbl index cfb31f1..2fec30a 100644 --- a/opcodes/i386-opc.tbl +++ b/opcodes/i386-opc.tbl @@ -318,7 +318,7 @@ shrd, 2, 0xfad, None, 2, Cpu386, Modrm|No_bSuf|No_sSuf|No_ldSuf, { Reg16|Reg32|R call, 1, 0xe8, None, 1, CpuNo64, JumpDword|DefaultSize|No_bSuf|No_sSuf|No_qSuf|No_ldSuf, { Disp16|Disp32 } call, 1, 0xe8, None, 1, Cpu64, JumpDword|DefaultSize|No_bSuf|No_lSuf|No_sSuf|No_ldSuf|NoRex64, { Disp16|Disp32 } call, 1, 0xff, 0x2, 1, CpuNo64, Modrm|DefaultSize|No_bSuf|No_sSuf|No_qSuf|No_ldSuf, { Reg16|Reg32|Word|Dword|Unspecified|BaseIndex|Disp8|Disp16|Disp32|JumpAbsolute } -call, 1, 0xff, 0x2, 1, Cpu64, Modrm|DefaultSize|No_bSuf|No_lSuf|No_sSuf|No_ldSuf|NoRex64, { Reg16|Reg64|Word|Qword|Unspecified|BaseIndex|Disp8|Disp32|Disp32S|JumpAbsolute } +call, 1, 0xff, 0x2, 1, Cpu64, Modrm|DefaultSize|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_ldSuf|NoRex64, { Reg64|Qword|Unspecified|BaseIndex|Disp8|Disp32|Disp32S|JumpAbsolute } // Intel Syntax call, 2, 0x9a, None, 1, CpuNo64, JumpInterSegment|DefaultSize|No_bSuf|No_sSuf|No_qSuf|No_ldSuf, { Imm16, Imm16|Imm32 } // Intel Syntax @@ -328,7 +328,7 @@ lcall, 1, 0xff, 0x3, 1, 0, Modrm|DefaultSize|No_bSuf|No_sSuf|No_qSuf|No_ldSuf, { jmp, 1, 0xeb, None, 1, 0, Jump|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { Disp8|Disp16|Disp32|Disp32S|Disp64 } jmp, 1, 0xff, 0x4, 1, CpuNo64, Modrm|No_bSuf|No_sSuf|No_qSuf|No_ldSuf, { Reg16|Reg32|Word|Dword|Unspecified|BaseIndex|Disp8|Disp16|Disp32|JumpAbsolute } -jmp, 1, 0xff, 0x4, 1, Cpu64, Modrm|No_bSuf|No_lSuf|No_sSuf|No_ldSuf|NoRex64, { Reg16|Reg64|Word|Qword|Unspecified|BaseIndex|Disp8|Disp32|Disp32S|JumpAbsolute } +jmp, 1, 0xff, 0x4, 1, Cpu64, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_ldSuf|NoRex64, { Reg64|Qword|Unspecified|BaseIndex|Disp8|Disp32|Disp32S|JumpAbsolute } // Intel Syntax. jmp, 2, 0xea, None, 1, CpuNo64, JumpInterSegment|No_bSuf|No_sSuf|No_qSuf|No_ldSuf, { Imm16, Imm16|Imm32 } // Intel Syntax. diff --git a/opcodes/i386-tbl.h b/opcodes/i386-tbl.h index 3ca4bed..5588ab2 100644 --- a/opcodes/i386-tbl.h +++ b/opcodes/i386-tbl.h @@ -2335,11 +2335,11 @@ const template i386_optab[] = { "call", 1, 0xff, 0x2, 1, { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 } }, - { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, + { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { { { 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, + { { { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, + 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0 } } } }, { "call", 2, 0x9a, None, 1, { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -2404,11 +2404,11 @@ const template i386_optab[] = { "jmp", 1, 0xff, 0x4, 1, { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 } }, - { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, + { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { { { 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, + { { { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, + 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0 } } } }, { "jmp", 2, 0xea, None, 1, { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |