mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	scripts/checkstack.pl: automatically handle 32-bit and 64-bit mode for ARCH=x86
This patch adds support for ARCH=x86 into checkstack.
Commit ffee0de411 ("x86: Default to ARCH=x86 to avoid overriding
CONFIG_64BIT") had merged ARCH=i386 and ARCH=x86_64 into one ARCH=x86.
checkstack.pl searches patterns of machine instructions which are
usually used for allocating stack frames.  checkstalk.pl needs either
i386 or x86_64, x86 isn't enough:
  $ make checkstack
  objdump -d vmlinux $(find . -name '*.ko') | \
  perl linux/scripts/checkstack.pl x86
  wrong or unknown architecture "x86"
Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Richard Weinberger <richard@nod.at>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
			
			
This commit is contained in:
		
							parent
							
								
									c965526a82
								
							
						
					
					
						commit
						fda9f9903b
					
				
					 1 changed files with 5 additions and 7 deletions
				
			
		| 
						 | 
					@ -52,14 +52,12 @@ my (@stack, $re, $dre, $x, $xs, $funcre);
 | 
				
			||||||
		#8000008a:       20 1d           sub sp,4
 | 
							#8000008a:       20 1d           sub sp,4
 | 
				
			||||||
		#80000ca8:       fa cd 05 b0     sub sp,sp,1456
 | 
							#80000ca8:       fa cd 05 b0     sub sp,sp,1456
 | 
				
			||||||
		$re = qr/^.*sub.*sp.*,([0-9]{1,8})/o;
 | 
							$re = qr/^.*sub.*sp.*,([0-9]{1,8})/o;
 | 
				
			||||||
	} elsif ($arch =~ /^i[3456]86$/) {
 | 
						} elsif ($arch =~ /^x86(_64)?$/ || $arch =~ /^i[3456]86$/) {
 | 
				
			||||||
		#c0105234:       81 ec ac 05 00 00       sub    $0x5ac,%esp
 | 
							#c0105234:       81 ec ac 05 00 00       sub    $0x5ac,%esp
 | 
				
			||||||
		$re = qr/^.*[as][du][db]    \$(0x$x{1,8}),\%esp$/o;
 | 
							# or
 | 
				
			||||||
		$dre = qr/^.*[as][du][db]    (%.*),\%esp$/o;
 | 
							#    2f60:    48 81 ec e8 05 00 00       sub    $0x5e8,%rsp
 | 
				
			||||||
	} elsif ($arch eq 'x86_64') {
 | 
							$re = qr/^.*[as][du][db]    \$(0x$x{1,8}),\%(e|r)sp$/o;
 | 
				
			||||||
		#    2f60:	48 81 ec e8 05 00 00 	sub    $0x5e8,%rsp
 | 
							$dre = qr/^.*[as][du][db]    (%.*),\%(e|r)sp$/o;
 | 
				
			||||||
		$re = qr/^.*[as][du][db]    \$(0x$x{1,8}),\%rsp$/o;
 | 
					 | 
				
			||||||
		$dre = qr/^.*[as][du][db]    (\%.*),\%rsp$/o;
 | 
					 | 
				
			||||||
	} elsif ($arch eq 'ia64') {
 | 
						} elsif ($arch eq 'ia64') {
 | 
				
			||||||
		#e0000000044011fc:       01 0f fc 8c     adds r12=-384,r12
 | 
							#e0000000044011fc:       01 0f fc 8c     adds r12=-384,r12
 | 
				
			||||||
		$re = qr/.*adds.*r12=-(([0-9]{2}|[3-9])[0-9]{2}),r12/o;
 | 
							$re = qr/.*adds.*r12=-(([0-9]{2}|[3-9])[0-9]{2}),r12/o;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue