Skip to contentSkip to conversation

Change hex to Math::BigInt->from_hex in markup_oops.pl

PATCH In review Hui Zhu 1 participant 2 messages Jan 17, 2010 – Jan 25, 2010

lore
Share & tools
lore

Hui Zhu

author
#0 lore raw

PATCH 1/1 Change hex to Math::BigInt->from_hex in markup_oops.pl

The hex cannot work well in x86 to parse the oops message for x8664. So this patch change it.

Thanks,
Hui

Cc Andrew Morton <[email protected]>
Cc Arjan van de Ven <[email protected]>
Cc Sam Ravnborg <[email protected]>
Cc Ozan Çaglayan <[email protected]>
Cc Matthew Wilcox <[email protected]>
---
 scripts/markup_oops.pl |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/markup_oops.pl +1 -1
@@ -196,7 +196,7 @@ if ($module ne "") {
 	while (<FILE>) {
 		if ($_ =~ /^([0-9a-f]+) \<$function\>\:/) {
 			my $fu = $1;
-			$vmaoffset = hex($target) - hex($fu) - hex($func_offset);
+			$vmaoffset = Math::BigInt->from_hex("0x$target") -

Math::BigInt->from_hex("0x$fu") -
Math::BigInt->from_hex("0x$func_offset");
}
}
close(FILE);
@@ -212,7 +212,7 @@ sub InRange {
my ($address, $target) = @_;
my $ad = "0x".$address;
my $ta = "0x".$target;
- my $delta = hex($ad) - hex($ta);
+ my $delta = Math::BigInt->from_hex($ad) - Math::BigInt->from_hex($ta);

if (($delta > -4096) && ($delta < 4096)) {
return 1;

author
#1 lore raw

Please ignore this patch. Because it was included in "[PATCH] markup_oops.pl: add options to improve cross-sompilation environments".

Thanks,
Hui

Quoted 40 lines · Hui Zhu

The hex cannot work well in x86 to parse the oops message for x8664. So this patch change it.

Thanks,
Hui

Cc Andrew Morton <[email protected]>
Cc Arjan van de Ven <[email protected]>
Cc Sam Ravnborg <[email protected]>
Cc Ozan Çaglayan <[email protected]>
Cc Matthew Wilcox <[email protected]>

---
 scripts/markup_oops.pl |    4 ++--

 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/markup_oops.pl +1 -1
@@ -196,7 +196,7 @@ if ($module ne "") {
        while (<FILE>) {
                if ($_ =~ /^([0-9a-f]+) \<$function\>\:/) {
                        my $fu = $1;
-                       $vmaoffset = hex($target) - hex($fu) - hex($func_offset);
+                       $vmaoffset = Math::BigInt->from_hex("0x$target") -

Math::BigInt->from_hex("0x$fu") -
Math::BigInt->from_hex("0x$func_offset");
               }
       }
       close(FILE);

scripts/markup_oops.pl +1 -1
@@ -212,7 +212,7 @@ sub InRange {
        my ($address, $target) = @_;
        my $ad = "0x".$address;
        my $ta = "0x".$target;
-       my $delta = hex($ad) - hex($ta);
+       my $delta = Math::BigInt->from_hex($ad) - Math::BigInt->from_hex($ta);
 
        if (($delta > -4096) && ($delta < 4096)) {
                return 1;