X86.pm

filter: Statementstmt 79.0% 1720 / 2176 Branchbran 63.6% 894 / 1404 Conditioncond 53.4% 116 / 217 MC/DCmcdc 21.9% 30 / 137 Subroutinesub 96.5% 337 / 349 Podpod 12.8% 14 / 109 totaltotal 70.8% 3111 / 4392 CC 779 SCAR 63.3
CC
779
Cov
72%
twobyte
2791.6
_disasm
684.7
tdnow_op
154.0
CRAP 562.4
↑ Summary X86/FormatText.pm »
1 package Disassemble::X86;
2  
3 1 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use AutoLoader qw( AUTOLOAD );
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use integer;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Disassemble::X86::MemRegion;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use vars qw( $VERSION );
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 $VERSION = "0.13";
12  
13 1 ▶use vars qw( $max_instr_len );
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 $max_instr_len = 15;
15  
16 1 ▶use vars qw( @long_regs @word_regs @byte_regs @seg_regs );
Subroutine BEGIN: called CC=1 SCAR=0.0
17 1 @long_regs = qw( eax ecx edx ebx esp ebp esi edi );
18 1 @word_regs = qw( ax cx dx bx sp bp si di );
19 1 @byte_regs = qw( al cl dl bl ah ch dh bh );
20 1 @seg_regs = qw( es cs ss ds fs gs );
21  
22 1 ▶use vars qw( @immed_grp @shift_grp @unary_grp @bittst_grp
Subroutine BEGIN: called CC=1 SCAR=0.0
23 1 @float_op @floatr_op @prefetch_op @cond_code @sse_comp );
24 1 @immed_grp = qw( add or adc sbb and sub xor cmp );
25 1 @shift_grp = qw( rol ror rcl rcr shl shr xxx sar );
26 1 @unary_grp = qw( test xxx not neg mul imul div idiv );
27 1 @bittst_grp = qw( bt bts btr btc );
28 1 @float_op = qw( add mul com comp sub subr div divr );
29 1 @floatr_op = qw( add mul com comp subr sub divr div );
30 1 @prefetch_op = qw( nta t0 t1 t2 );
31 1 @cond_code = qw( o no b ae e ne be a s ns pe po l ge le g );
32 1 @sse_comp = qw( eq lt le unord neq nlt nle ord );
33  
34 1 ▶use vars qw( $mmx_proc $tdnow_proc $tdnow2_proc $sse_proc $sse2_proc
Subroutine BEGIN: called CC=1 SCAR=0.0
35 1 %proc_xlat );
36 1 $mmx_proc = 995;
37 1 $tdnow_proc = 996;
38 1 $tdnow2_proc = 997;
39 1 $sse_proc = 998;
40 1 $sse2_proc = 999;
41 1 %proc_xlat = (
42 $mmx_proc => "mmx",
43 $tdnow_proc => "3dnow",
44 $tdnow2_proc => "3dnow-e",
45 $sse_proc => "sse",
46 $sse2_proc => "sse2",
47 );
48  
49 2 ▶sub new {
Subroutine new: called CC=9 SCAR=25.1
Pod documented
50 2 my ($class, %args) = @_;
51 2 my $self = bless {
52 addr_size => 32,
53 data_size => 32,
54 asize => undef, # address size override
55 dsize => undef, # data size override
56 seg_pre => undef,
57 mmx_pre => 0,
58 def_proc => 386,
59 } => $class;
60  
61 2 my $text = $args{text};
62 2 ▶ unless (ref $text) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $text) 2 0 2
63 $text = Disassemble::X86::MemRegion->new(
64 mem => $text,
65 2 ▶ start => $args{start} || 0,
Condition50%1/2
$args{'start'} || 0
l!l
02
MC/DC0%0/1
$args{'start'} || 0
$args{'start'}
Truth table50%1/2
A
A= $args{'start'}
Aresult
11
00
66 );
67 }
68 2 $self->{text} = $text;
69  
70 2 ▶ $self->addr_size($args{addr_size} || $args{size} || 32);
Condition40%2/5
$args{'addr_size'} || $args{'size'} || 32
l!l
20
$args{"addr_size"} or $args{"size"}
l!l&&r!l&&!r
020
MC/DC0%0/2
$args{'addr_size'} || $args{'size'} || 32
$args{"addr_size"} $args{"size"}
Truth table33%1/3
A or B
A= $args{"addr_size"}B= $args{"size"}
ABresult
1X1
011
000
71 2 ▶ $self->data_size($args{data_size} || $args{size} || 32);
Condition40%2/5
$args{'data_size'} || $args{'size'} || 32
l!l
20
$args{"data_size"} or $args{"size"}
l!l&&r!l&&!r
020
MC/DC0%0/2
$args{'data_size'} || $args{'size'} || 32
$args{"data_size"} $args{"size"}
Truth table33%1/3
A or B
A= $args{"data_size"}B= $args{"size"}
ABresult
1X1
011
000
72  
73 2 ▶ $self->pos( exists($args{pos}) ? $args{pos} : $text->start() );
Branch: 1 branch
BranchTrueFalseTotal
exists $args{'pos'} ? : 0 2 2
74 2 ▶ $self->set_format($args{format} || "Text");
Condition50%1/2
$args{'format'} || 'Text'
l!l
02
MC/DC0%0/1
$args{'format'} || 'Text'
$args{'format'}
Truth table50%1/2
A
A= $args{'format'}
Aresult
11
00
75 2 return $self;
76 } # new
77  
78 2 ▶sub addr_size {
Subroutine addr_size: called CC=7 SCAR=22.0
Pod documented
79 2 my ($self, $size) = @_;
80 2 ▶ if ($size) {
Branch: 1 branch
BranchTrueFalseTotal
if ($size) 2 0 2
81 2 ▶ if ($size eq "16" || $size eq "word") { $self->{addr_size} = 16 }
Branch: 2 branches
BranchTrueFalseTotal
if ($size eq '16' or $size eq 'word') { } 1 1 2
elsif ($size eq '32' or $size eq 'dword' or $size eq 'long') { } 1 0 1
Condition66%2/3
$size eq 16 or $size eq "word"
l!l&&r!l&&!r
101
MC/DC50%1/2
$size eq 16 or $size eq "word"
$size eq 16 $size eq "word"
Truth table66%2/3
A or B
A= $size eq 16B= $size eq "word"
ABresult
1X1
011
000
82 ▶ elsif ($size eq "32" || $size eq "dword" || $size eq "long") {
Condition33%2/6
$size eq 32 or $size eq "dword" or $size eq "long"
l!l&&r!l&&!r
100
$size eq 32 or $size eq "dword"
l!l&&r!l&&!r
100
MC/DC0%0/3
$size eq 32 or $size eq "dword" or $size eq "long"
$size eq 32 $size eq "dword" $size eq "long"
Truth table25%1/4
A or B or C
A= $size eq 32B= $size eq "dword"C= $size eq "long"
ABCresult
1XX1
01X1
0011
0000
83 1 $self->{addr_size} = 32;
84 }
85 0 else { return }
86 2 $self->set_def_proc();
87 }
88 2 return $self->{addr_size};
89 } # addr_size
90  
91 2 ▶sub data_size {
Subroutine data_size: called CC=7 SCAR=22.0
Pod documented
92 2 my ($self, $size) = @_;
93 2 ▶ if ($size) {
Branch: 1 branch
BranchTrueFalseTotal
if ($size) 2 0 2
94 2 ▶ if ($size eq "16" || $size eq "word") { $self->{data_size} = 16 }
Branch: 2 branches
BranchTrueFalseTotal
if ($size eq '16' or $size eq 'word') { } 1 1 2
elsif ($size eq '32' or $size eq 'dword' or $size eq 'long') { } 1 0 1
Condition66%2/3
$size eq 16 or $size eq "word"
l!l&&r!l&&!r
101
MC/DC50%1/2
$size eq 16 or $size eq "word"
$size eq 16 $size eq "word"
Truth table66%2/3
A or B
A= $size eq 16B= $size eq "word"
ABresult
1X1
011
000
95 ▶ elsif ($size eq "32" || $size eq "dword" || $size eq "long") {
Condition33%2/6
$size eq 32 or $size eq "dword" or $size eq "long"
l!l&&r!l&&!r
100
$size eq 32 or $size eq "dword"
l!l&&r!l&&!r
100
MC/DC0%0/3
$size eq 32 or $size eq "dword" or $size eq "long"
$size eq 32 $size eq "dword" $size eq "long"
Truth table25%1/4
A or B or C
A= $size eq 32B= $size eq "dword"C= $size eq "long"
ABCresult
1XX1
01X1
0011
0000
96 1 $self->{data_size} = 32;
97 }
98 0 else { return }
99 2 $self->set_def_proc();
100 }
101 2 return $self->{data_size};
102 } # data_size
103  
104 2 ▶sub set_format {
Subroutine set_format: called CC=5 SCAR=17.2
Pod undocumented
105 2 my ($self, $fmt) = @_;
106 2 ▶ return $self->{format} = $fmt if ref($fmt);
Branch: 1 branch
BranchTrueFalseTotal
if ref $fmt 0 2 2
107 2 ▶ die "Invalid characters in format name: $fmt" if $fmt =~ /[^\w:]/;
Branch: 1 branch
BranchTrueFalseTotal
if $fmt =~ /[^\w:]/ 0 2 2
108 2 foreach ("Disassemble::X86::Format$fmt", $fmt) {
109 2 eval "require $_";
110 2 ▶ next if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 2 2
111 2 return $self->{format} = $_;
112 }
113 0 die "Invalid format module: $fmt";
114 } # set_format
115  
116 4 ▶sub set_def_proc {
Subroutine set_def_proc: called CC=3 SCAR=11.0
Pod undocumented
117 4 my ($self) = @_;
118 $self->{def_proc} = ($self->{addr_size} == 16
119 4 ▶ && $self->{data_size} == 16) ? 86 : 386;
Branch: 1 branch
BranchTrueFalseTotal
$self->{'addr_size'} == 16 && $self->{'data_size'} == 16 ? : 1 3 4
Condition100%3/3
$self->{"addr_size"} == 16 and $self->{"data_size"} == 16
!ll&&!rl&&r
211
MC/DC100%2/2
$self->{"addr_size"} == 16 and $self->{"data_size"} == 16
$self->{"addr_size"} == 16 $self->{"data_size"} == 16
Truth table100%3/3
A and B
A= $self->{"addr_size"} == 16B= $self->{"data_size"} == 16
ABresult
0X0
100
111
120 } # set_def_proc
121  
122 0 ▶sub text { $_[0]->{text} }
Subroutine text: not called CC=1 SCAR=6.9
Pod documented
123 0 ▶sub at_end { $_[0]->{pos} >= $_[0]->{text}->end() }
Subroutine at_end: not called CC=1 SCAR=6.9
Pod documented
124 0 ▶sub contains { $_[0]->{text}->contains($_[1]) }
Subroutine contains: not called CC=1 SCAR=6.9
Pod documented
125 0 ▶sub error { $_[0]->{error} }
Subroutine error: not called CC=1 SCAR=6.9
Pod documented
126 0 ▶sub op { $_[0]->{op} }
Subroutine op: not called CC=1 SCAR=6.9
Pod documented
127 0 ▶sub op_start { $_[0]->{op_start} }
Subroutine op_start: not called CC=1 SCAR=6.9
Pod documented
128  
129 0 ▶sub op_len {
Subroutine op_len: not called CC=2 SCAR=17.9
Pod documented
130 0 ▶ my $op = $_[0]->{op} or return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $op = $_[0]{"op"} or return 0 0 0 0
131 0 return $op->{len};
132 } # op_len
133  
134 0 ▶sub op_proc {
Subroutine op_proc: not called CC=2 SCAR=17.9
Pod documented
135 0 ▶ my $op = $_[0]->{op} or return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $op = $_[0]{"op"} or return 0 0 0 0
136 0 return $op->{proc};
137 } # op_len
138  
139 2 ▶sub pos {
Subroutine pos: called CC=2 SCAR=7.0
Pod documented
140 2 my ($self, $pos) = @_;
141 2 ▶ if (defined $pos) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $pos) 2 0 2
142 2 $self->{pos} = $pos;
143 2 $self->{lim} = $pos + $max_instr_len;
144 }
145 2 return $self->{pos};
146 } # pos
147  
148 456 ▶sub disasm {
Subroutine disasm: called CC=7 SCAR=19.5
Pod documented
149 456 my ($self) = @_;
150 456 my $start = $self->{op_start} = $self->{pos};
151 456 $self->{lim} = $start + $max_instr_len;
152 456 $self->{error} = "";
153  
154 456 my $op = $self->_disasm();
155  
156 456 ▶ $self->{pos} > $self->{lim} and $self->{error} = "opcode too long";
Branch: 1 branch
BranchTrueFalseTotal
$self->{"pos"} > $self->{"lim"} and $self->{"error"} = "opcode too long" 0 456 456
157 456 ▶ $self->{error} and undef $op;
Branch: 1 branch
BranchTrueFalseTotal
$self->{"error"} and undef $op 2 454 456
158 456 $self->{op} = $op;
159 456 ▶ if ($op) {
Branch: 1 branch
BranchTrueFalseTotal
if ($op) { } 454 2 456
160 454 ▶ my $proc = $op->{proc} || 0;
Condition100%2/2
$op->{'proc'} || 0
l!l
354100
MC/DC100%1/1
$op->{'proc'} || 0
$op->{'proc'}
Truth table100%2/2
A
A= $op->{'proc'}
Aresult
11
00
161 454 my $def_proc = $self->{def_proc};
162 454 ▶ $proc = $def_proc if $proc < $def_proc;
Branch: 1 branch
BranchTrueFalseTotal
if $proc < $def_proc 141 313 454
163 454 ▶ $op->{proc} = $proc_xlat{$proc} || $proc;
Condition66%2/3
$Disassemble::X86::proc_xlat{$proc} || $proc
l!l&&r!l&&!r
843700
MC/DC0%0/2
$Disassemble::X86::proc_xlat{$proc} || $proc
$Disassemble::X86::proc_xlat{$proc} $proc
Truth table66%2/3
A || B
A= $Disassemble::X86::proc_xlat{$proc}B= $proc
ABresult
1X1
011
000
164 454 $op->{start} = $start;
165 454 $op->{len} = $self->{pos} - $start;
166 454 return $self->{format}->format_instr($op);
167 }
168 else {
169 2 $self->{pos} = $start; # back off from the bad opcode
170 2 return undef;
171 }
172 } # disasm
173  
174 0 ▶sub bad_op {
Subroutine bad_op: not called CC=1 SCAR=6.9
Pod undocumented
175 0 my ($self) = @_;
176 0 $self->{error} = "bad opcode";
177 0 return undef;
178 } # bad_op
179  
180 979 ▶sub next_byte {
Subroutine next_byte: called CC=3 SCAR=11.0
Pod documented
181 979 my ($self) = @_;
182 979 my $pos = $self->{pos};
183 979 $self->{pos} = $pos + 1;
184 979 ▶ return 0 if $pos >= $self->{lim};
Branch: 1 branch
BranchTrueFalseTotal
if $pos >= $self->{"lim"} 0 979 979
185 979 my $byte = $self->{text}->get_byte($pos);
186 979 ▶ if (!defined $byte) { $self->{error} = "end of data"; return 0; }
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $byte) 2 977 979
187 977 return $byte;
188 } # next_byte
189  
190 354 ▶sub split_next_byte {
Subroutine split_next_byte: called CC=3 SCAR=11.0
Pod undocumented
191 354 my ($self) = @_;
192 354 my $pos = $self->{pos};
193 354 $self->{pos} = $pos + 1;
194 354 ▶ return (0,0,0) if $pos >= $self->{lim};
Branch: 1 branch
BranchTrueFalseTotal
if $pos >= $self->{"lim"} 0 354 354
195 354 my $byte = $self->{text}->get_byte($pos);
196 354 ▶ if (!defined $byte) { $self->{error} = "end of data"; return (0,0,0); }
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $byte) 2 352 354
197 352 return ( ($byte >> 6) & 3, ($byte >> 3) & 7, $byte & 7 );
198 } # split_next_byte
199  
200 64 ▶sub next_word {
Subroutine next_word: called CC=3 SCAR=11.8
Pod undocumented
201 64 my ($self) = @_;
202 64 my $pos = $self->{pos};
203 64 my $newpos = $self->{pos} = $pos + 2;
204 64 ▶ return 0 if $newpos > $self->{lim};
Branch: 1 branch
BranchTrueFalseTotal
if $newpos > $self->{"lim"} 0 64 64
205 64 my $word = $self->{text}->get_word($pos);
206 0 ▶ if (!defined $word) { $self->{error} = "end of data"; return 0; }
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $word) 0 64 64
207 64 return $word;
208 } # next_word
209  
210 56 ▶sub next_long {
Subroutine next_long: called CC=3 SCAR=11.8
Pod undocumented
211 56 my ($self) = @_;
212 56 my $pos = $self->{pos};
213 56 my $newpos = $self->{pos} = $pos + 4;
214 56 ▶ return 0 if $newpos > $self->{lim};
Branch: 1 branch
BranchTrueFalseTotal
if $newpos > $self->{"lim"} 0 56 56
215 56 my $long = $self->{text}->get_long($pos);
216 0 ▶ if (!defined $long) { $self->{error} = "end of data"; return 0; }
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $long) 0 56 56
217 56 return $long;
218 } # next_long
219  
220 68 ▶sub get_byteval {
Subroutine get_byteval: called CC=5 SCAR=16.4
Pod undocumented
221 68 my ($self, $size) = @_;
222 68 ▶ $size ||= $self->dsize();
Condition33%1/3
$size ||= $self->dsize
l!l&&r!l&&!r
6800
MC/DC0%0/2
$size ||= $self->dsize
$size $self->dsize
Truth table33%1/3
A ||= B
A= $sizeB= $self->dsize
ABresult
1X1
011
000
223 68 my $b = $self->next_byte();
224 68 ▶ if ($b & 0x80) {
Branch: 1 branch
BranchTrueFalseTotal
if ($b & 128) 32 36 68
225 32 ▶ if ($size == 32) { $b |= 0xffffff00 }
Branch: 2 branches
BranchTrueFalseTotal
if ($size == 32) { } 18 14 32
elsif ($size == 16) { } 14 0 14
226 14 elsif ($size == 16) { $b |= 0xff00 }
227 }
228 68 return { op=>"lit", arg=>[$b], size=>$size };
229 } # get_byteval
230  
231 152 ▶sub get_val {
Subroutine get_val: called CC=5 SCAR=16.6
Pod undocumented
232 152 my ($self, $size) = @_;
233 152 ▶ $size ||= $self->dsize();
Condition33%1/3
$size ||= $self->dsize
l!l&&r!l&&!r
15200
MC/DC0%0/2
$size ||= $self->dsize
$size $self->dsize
Truth table33%1/3
A ||= B
A= $sizeB= $self->dsize
ABresult
1X1
011
000
234 152 my $val;
235 152 ▶ if ($size == 32) { $val = $self->next_long() }
Branch: 3 branches
BranchTrueFalseTotal
if ($size == 32) { } 54 98 152
elsif ($size == 16) { } 58 40 98
elsif ($size == 8) { } 40 0 40
236 58 elsif ($size == 16) { $val = $self->next_word() }
237 40 elsif ($size == 8) { $val = $self->next_byte() }
238 0 else { die "can't happen" }
239 152 return { op=>"lit", arg=>[$val], size=>$size };
240 } # get_val
241  
242 12 ▶sub iflong_op {
Subroutine iflong_op: called CC=2 SCAR=6.9
Pod undocumented
243 12 my ($self, $if, $else, $proc) = @_;
244 12 ▶ return { op=>($self->dsize() == 32 ? $if : $else), proc=>$proc }
Branch: 1 branch
BranchTrueFalseTotal
$self->dsize == 32 ? : 6 6 12
245 } # iflong_op
246  
247 20 ▶sub op_r_rm {
Subroutine op_r_rm: called CC=2 SCAR=7.1
Pod undocumented
248 20 my ($self, $op, $size, $proc) = @_;
249 20 ▶ $size ||= $self->dsize();
Condition33%1/3
$size ||= $self->dsize
l!l&&r!l&&!r
0200
MC/DC0%0/2
$size ||= $self->dsize
$size $self->dsize
Truth table33%1/3
A ||= B
A= $sizeB= $self->dsize
ABresult
1X1
011
000
250 20 my ($mod, $reg, $rm) = $self->split_next_byte();
251 20 my $src = $self->modrm($mod, $rm, $size);
252 20 my $dest = $self->get_reg($reg, $size);
253 20 return { op=>$op, arg=>[$dest, $src], proc=>$proc };
254 } # op_r_rm
255  
256 12 ▶sub op_rm_r {
Subroutine op_rm_r: called CC=2 SCAR=7.0
Pod undocumented
257 12 my ($self, $op, $size, $proc) = @_;
258 12 ▶ $size ||= $self->dsize();
Condition66%2/3
$size ||= $self->dsize
l!l&&r!l&&!r
480
MC/DC0%0/2
$size ||= $self->dsize
$size $self->dsize
Truth table66%2/3
A ||= B
A= $sizeB= $self->dsize
ABresult
1X1
011
000
259 12 my ($mod, $reg, $rm) = $self->split_next_byte();
260 12 my $src = $self->get_reg($reg, $size);
261 12 my $dest = $self->modrm($mod, $rm, $size);
262 12 return { op=>$op, arg=>[$dest,$src], proc=>$proc };
263 } # op_rm_r
264  
265 4 ▶sub mov_imm {
Subroutine mov_imm: called CC=3 SCAR=11.2
Pod undocumented
266 4 my ($self, $size) = @_;
267 4 ▶ $size ||= $self->dsize();
Condition66%2/3
$size ||= $self->dsize
l!l&&r!l&&!r
220
MC/DC0%0/2
$size ||= $self->dsize
$size $self->dsize
Truth table66%2/3
A ||= B
A= $sizeB= $self->dsize
ABresult
1X1
011
000
268 4 my ($mod, $op, $rm) = $self->split_next_byte();
269 4 ▶ return $self->bad_op() unless $op == 0;
Branch: 1 branch
BranchTrueFalseTotal
unless $op == 0 0 4 4
270 4 my $dest = $self->modrm($mod, $rm, $size);
271 4 return { op=>"mov", arg=>[$dest, $self->get_val($size)] };
272 } # mov_imm
273  
274 10 ▶sub unary_op {
Subroutine unary_op: called CC=4 SCAR=15.2
Pod undocumented
275 10 my ($self, $size) = @_;
276 10 ▶ $size ||= $self->dsize();
Condition66%2/3
$size ||= $self->dsize
l!l&&r!l&&!r
460
MC/DC0%0/2
$size ||= $self->dsize
$size $self->dsize
Truth table66%2/3
A ||= B
A= $sizeB= $self->dsize
ABresult
1X1
011
000
277 10 my ($mod, $op, $rm) = $self->split_next_byte();
278 10 my $arg = $self->modrm($mod, $rm, $size);
279 10 ▶ if ($op == 0) {
Branch: 2 branches
BranchTrueFalseTotal
if ($op == 0) { } 0 10 10
elsif ($op == 1) { } 0 10 10
280 0 return { op=>"test", arg=>[$arg, $self->get_val($size)] };
281 }
282 0 elsif ($op == 1) { return $self->bad_op() }
283 10 else { return { op=>$unary_grp[$op], arg=>[$arg] } }
284 } # unary_op
285  
286 8 ▶sub abs_addr {
Subroutine abs_addr: called CC=3 SCAR=11.1
Pod undocumented
287 8 my ($self, $data_size) = @_;
288 8 ▶ $data_size ||= $self->dsize();
Condition33%1/3
$data_size ||= $self->dsize
l!l&&r!l&&!r
800
MC/DC0%0/2
$data_size ||= $self->dsize
$data_size $self->dsize
Truth table33%1/3
A ||= B
A= $data_sizeB= $self->dsize
ABresult
1X1
011
000
289 8 my $addr_size = $self->asize();
290 8 my $addr = $self->get_val($addr_size);
291 8 my $seg = $self->seg_prefix();
292 8 ▶ $addr = { op=>"seg", arg=>[$seg,$addr], size=>$addr_size } if $seg;
Branch: 1 branch
BranchTrueFalseTotal
if $seg 4 4 8
293 8 return { op=>"mem", arg=>[$addr], size=>$data_size };
294 } # abs_addr
295  
296 0 ▶sub eipbyte {
Subroutine eipbyte: not called CC=4 SCAR=30.0
Pod undocumented
297 0 my ($self) = @_;
298 0 my $off = $self->next_byte();
299 0 ▶ $off |= 0xffffff00 if $off & 0x80;
Branch: 1 branch
BranchTrueFalseTotal
if $off & 128 0 0 0
300 0 $off += $self->{pos};
301 0 my $size = $self->dsize();
302 0 ▶ if ($size == 32) { $off &= 0xffffffff }
Branch: 2 branches
BranchTrueFalseTotal
if ($size == 32) { } 0 0 0
elsif ($size == 16) { } 0 0 0
303 0 elsif ($size == 16) { $off &= 0xffff }
304 0 else { die "can't happen" }
305 0 return { op=>"lit", arg=>[$off], size=>$size };
306 } # eipbyte
307  
308 0 ▶sub eipoff {
Subroutine eipoff: not called CC=3 SCAR=24.8
Pod undocumented
309 0 my ($self, $op, $proc) = @_;
310 0 my $size = $self->dsize();
311 0 my $off;
312 0 ▶ if ($size == 32) {
Branch: 2 branches
BranchTrueFalseTotal
if ($size == 32) { } 0 0 0
elsif ($size == 16) { } 0 0 0
313 0 $off = $self->next_long();
314 0 $off = ($off + $self->{pos}) & 0xffffffff;
315 }
316 elsif ($size == 16) {
317 0 $off = $self->next_word();
318 0 $off = ($off + $self->{pos}) & 0xffff;
319 }
320 0 else { die "can't happen" }
321 0 return { op=>"lit", arg=>[$off], size=>$size };
322 } # eipoff
323  
324 0 ▶sub jcond_op {
Subroutine jcond_op: not called CC=4 SCAR=30.0
Pod undocumented
325 0 my ($self, $cond, $addr, $proc) = @_;
326 0 my $arg = [$addr];
327 0 my $op = { op=>"j".$cond_code[$cond & 0xf], arg=>[$addr] };
328 0 my $seg = $self->{seg_pre};
329 0 ▶ if ($seg) {
Branch: 1 branch
BranchTrueFalseTotal
if ($seg) 0 0 0
330 # Branch hints. Someone please suggest some better mnemonics.
331 0 ▶ if ($seg == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if ($seg == 1) { } 0 0 0
elsif ($seg == 3) { } 0 0 0
332 0 $self->{seg_pre} = undef;
333 0 return { op=>"hint_no", prefix=>1, arg=>[$op], proc=>$sse2_proc };
334 }
335 elsif ($seg == 3) {
336 0 $self->{seg_pre} = undef;
337 0 return { op=>"hint_yes", prefix=>1, arg=>[$op], proc=>$sse2_proc };
338 }
339 }
340 0 $op->{proc} = $proc;
341 0 return $op;
342 } # jcond_op
343  
344 212 ▶sub seg_prefix {
Subroutine seg_prefix: called CC=2 SCAR=6.9
Pod undocumented
345 212 my ($self) = @_;
346 212 my $prefix = $self->{seg_pre};
347 212 ▶ return undef unless defined $prefix;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $prefix 200 12 212
348 12 $self->{seg_pre} = undef;
349 12 return $self->seg_reg($prefix);
350 } # seg_prefix
351  
352 168 ▶sub dsize {
Subroutine dsize: called CC=2 SCAR=7.0
Pod undocumented
353 168 my ($self) = @_;
354 168 ▶ my $dsize = $self->{dsize} || $self->{data_size};
Condition66%2/3
$self->{'dsize'} || $self->{'data_size'}
l!l&&r!l&&!r
83850
MC/DC0%0/2
$self->{'dsize'} || $self->{'data_size'}
$self->{'dsize'} $self->{'data_size'}
Truth table66%2/3
A || B
A= $self->{'dsize'}B= $self->{'data_size'}
ABresult
1X1
011
000
355 168 $self->{dsize} = undef;
356 168 return $dsize;
357 } # dsize
358  
359 218 ▶sub asize {
Subroutine asize: called CC=2 SCAR=7.0
Pod undocumented
360 218 my ($self) = @_;
361 218 ▶ my $asize = $self->{asize} || $self->{addr_size};
Condition66%2/3
$self->{'asize'} || $self->{'addr_size'}
l!l&&r!l&&!r
1081100
MC/DC0%0/2
$self->{'asize'} || $self->{'addr_size'}
$self->{'asize'} $self->{'addr_size'}
Truth table66%2/3
A || B
A= $self->{'asize'}B= $self->{'addr_size'}
ABresult
1X1
011
000
362 218 $self->{asize} = undef;
363 218 return $asize;
364 } # asize
365  
366 1 1 # end X86.pm
367 __END__
↑ Summary X86/FormatText.pm »