OLD | NEW |
1 // Inferno libmach/8db.c | 1 // Inferno libmach/8db.c |
2 // http://code.google.com/p/inferno-os/source/browse/utils/libmach/8db.c | 2 // http://code.google.com/p/inferno-os/source/browse/utils/libmach/8db.c |
3 // | 3 // |
4 // » Copyright © 1994-1999 Lucent Technologies Inc. | 4 //» Copyright © 1994-1999 Lucent Technologies Inc. |
5 // » Power PC support Copyright © 1995-2004 C H Forsyth (forsyth@terzarima.ne
t). | 5 //» Power PC support Copyright © 1995-2004 C H Forsyth (forsyth@terzarima.ne
t). |
6 // » Portions Copyright © 1997-1999 Vita Nuova Limited. | 6 //» Portions Copyright © 1997-1999 Vita Nuova Limited. |
7 // » Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuov
a.com). | 7 //» Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuov
a.com). |
8 // » Revisions Copyright © 2000-2004 Lucent Technologies Inc. and others. | 8 //» Revisions Copyright © 2000-2004 Lucent Technologies Inc. and others. |
9 // Portions Copyright © 2009 The Go Authors. All rights reserved. | 9 // Portions Copyright © 2009 The Go Authors. All rights reserved. |
10 // | 10 // |
11 // Permission is hereby granted, free of charge, to any person obtaining a copy | 11 // Permission is hereby granted, free of charge, to any person obtaining a copy |
12 // of this software and associated documentation files (the "Software"), to deal | 12 // of this software and associated documentation files (the "Software"), to deal |
13 // in the Software without restriction, including without limitation the rights | 13 // in the Software without restriction, including without limitation the rights |
14 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | 14 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
15 // copies of the Software, and to permit persons to whom the Software is | 15 // copies of the Software, and to permit persons to whom the Software is |
16 // furnished to do so, subject to the following conditions: | 16 // furnished to do so, subject to the following conditions: |
17 // | 17 // |
18 // The above copyright notice and this permission notice shall be included in | 18 // The above copyright notice and this permission notice shall be included in |
(...skipping 2062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2081 } | 2081 } |
2082 if((ip->rex & REXW) == 0) | 2082 if((ip->rex & REXW) == 0) |
2083 bprint(ip, "%lux", (long)val); | 2083 bprint(ip, "%lux", (long)val); |
2084 else | 2084 else |
2085 bprint(ip, "%llux", val); | 2085 bprint(ip, "%llux", val); |
2086 } | 2086 } |
2087 | 2087 |
2088 static void | 2088 static void |
2089 pea(Instr *ip) | 2089 pea(Instr *ip) |
2090 { | 2090 { |
| 2091 int base; |
| 2092 |
| 2093 base = ip->base; |
| 2094 if(base >= 0 && (ip->rex & REXB)) |
| 2095 base += 8; |
| 2096 |
2091 if (ip->mod == 3) { | 2097 if (ip->mod == 3) { |
2092 if (ip->osize == 'B') | 2098 if (ip->osize == 'B') |
2093 bprint(ip, (ip->rex & REXB? breg64: breg)[(uchar)ip->bas
e]); | 2099 bprint(ip, (ip->rex & REXB? breg64: breg)[(uchar)ip->bas
e]); |
2094 else if(ip->rex & REXB) | |
2095 bprint(ip, "%s%s", ANAME(ip), reg[ip->base+8]); | |
2096 else | 2100 else |
2097 » » » bprint(ip, "%s%s", ANAME(ip), reg[(uchar)ip->base]); | 2101 » » » bprint(ip, "%s%s", ANAME(ip), reg[base]); |
2098 return; | 2102 return; |
2099 } | 2103 } |
| 2104 |
2100 if (ip->segment) | 2105 if (ip->segment) |
2101 bprint(ip, ip->segment); | 2106 bprint(ip, ip->segment); |
2102 » if (ip->asize == 'E' && ip->base == SP) | 2107 » if (ip->asize == 'E' && base == SP) |
2103 plocal(ip); | 2108 plocal(ip); |
2104 else { | 2109 else { |
2105 if (ip->base < 0) | 2110 if (ip->base < 0) |
2106 immediate(ip, ip->disp); | 2111 immediate(ip, ip->disp); |
2107 else { | 2112 else { |
2108 bprint(ip, "%ux", ip->disp); | 2113 bprint(ip, "%ux", ip->disp); |
2109 if(ip->rip) | 2114 if(ip->rip) |
2110 bprint(ip, "(RIP)"); | 2115 bprint(ip, "(RIP)"); |
2111 bprint(ip,"(%s%s)", ANAME(ip), reg[ip->rex&REXB? ip->bas
e+8: ip->base]); | 2116 bprint(ip,"(%s%s)", ANAME(ip), reg[ip->rex&REXB? ip->bas
e+8: ip->base]); |
2112 } | 2117 } |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2387 } | 2392 } |
2388 return 1; | 2393 return 1; |
2389 default: | 2394 default: |
2390 break; | 2395 break; |
2391 } | 2396 } |
2392 if (strncmp(op->proto,"JMP", 3) == 0 || strncmp(op->proto,"CALL", 4) ==
0) | 2397 if (strncmp(op->proto,"JMP", 3) == 0 || strncmp(op->proto,"CALL", 4) ==
0) |
2393 return 1; | 2398 return 1; |
2394 foll[n++] = pc+i.n; | 2399 foll[n++] = pc+i.n; |
2395 return n; | 2400 return n; |
2396 } | 2401 } |
OLD | NEW |