Skip to contentSkip to conversation

Fix markup_oops to work with 32-bit userspace on a 64-bit kernel

PATCH In review Matthew Wilcox 3 participants 3 messages Jul 13, 2009 – Aug 6, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix markup_oops to work with 32-bit userspace on a 64-bit kernel

A 32-bit perl can't handle 64-bit addresses without using the BigInt package.

scripts/markup_oops.pl +3 -2
index 528492b..8977401 100644
@@ -1,6 +1,7 @@
 #!/usr/bin/perl
 
 use File::Basename;
+use Math::BigInt;
 
 # Copyright 2008, Intel Corporation
 #
@@ -172,8 +173,8 @@ while (<STDIN>) {
 	parse_x86_regs($line);
 }
 
-my $decodestart = hex($target) - hex($func_offset);
-my $decodestop = hex($target) + 8192;
+my $decodestart = Math::BigInt->from_hex("0x$target") - Math::BigInt->from_hex("0x$func_offset");
+my $decodestop = Math::BigInt->from_hex("0x$target") + 8192;
 if ($target eq "0") {
 	print "No oops found!\n";
 	print "Usage: \n";
Signature · 4 lines
Matthew Wilcox				Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · On Mon, 13 Jul 2009 08:18:19 -0600 Matthew Wilcox <[email protected]> wrote:

A 32-bit perl can't handle 64-bit addresses without using the BigInt package.

looks sane enuogh to me

Andrew, can you pull this into -mm patch-logistics wise please?

Quoted 25 lines
scripts/markup_oops.pl +2 -2
index 528492b..8977401 100644
@@ -1,6 +1,7 @@
 #!/usr/bin/perl
 
 use File::Basename;
+use Math::BigInt;
 
 # Copyright 2008, Intel Corporation
 #
@@ -172,8 +173,8 @@ while (<STDIN>) {
 	parse_x86_regs($line);
 }
 
-my $decodestart = hex($target) - hex($func_offset);
-my $decodestop = hex($target) + 8192;
+my $decodestart = Math::BigInt->from_hex("0x$target") -

Math::BigInt->from_hex("0x$func_offset"); +my $decodestop = Math::BigInt->from_hex("0x$target") + 8192; if ($target eq "0") {

scripts/markup_oops.pl +0 -0
 	print "No oops found!\n";
 	print "Usage: \n";
Signature · 3 lines
Arjan van de Ven 	Intel Open Source Technology Centre
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org
#2 lore raw
In reply to Matthew Wilcox

Matthew Wilcox wrote On 13-07-2009 17:18:

scripts/markup_oops.pl while (<STDIN>) { · line 180

Quoted 11 lines

A 32-bit perl can't handle 64-bit addresses without using the BigInt package.

scripts/markup_oops.pl +2 -2
-my $decodestart = hex($target) - hex($func_offset);
-my $decodestop = hex($target) + 8192;
+my $decodestart = Math::BigInt->from_hex("0x$target") - Math::BigInt->from_hex("0x$func_offset");
+my $decodestop = Math::BigInt->from_hex("0x$target") + 8192;
 if ($target eq "0") {
 	print "No oops found!\n";
 	print "Usage: \n";

$func_offset has already "0x" so this commit prepends another "0x" causing decodestart to be NaN.

Regards,
Ozan