OLD | NEW |
1 // Derived from Inferno utils/5c/txt.c | 1 // Derived from Inferno utils/5c/txt.c |
2 // http://code.google.com/p/inferno-os/source/browse/utils/5c/txt.c | 2 // http://code.google.com/p/inferno-os/source/browse/utils/5c/txt.c |
3 // | 3 // |
4 // Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved. | 4 // Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved. |
5 // Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net) | 5 // Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net) |
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 // Portions Copyright © 2004,2006 Bruce Ellis | 8 // Portions Copyright © 2004,2006 Bruce Ellis |
9 // Portions Copyright © 2005-2007 C H Forsyth (forsyth@terzarima.net) | 9 // Portions Copyright © 2005-2007 C H Forsyth (forsyth@terzarima.net) |
10 // Revisions Copyright © 2000-2007 Lucent Technologies Inc. and others | 10 // Revisions Copyright © 2000-2007 Lucent Technologies Inc. and others |
(...skipping 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1187 Prog * | 1187 Prog * |
1188 gregshift(int as, Node *lhs, int32 stype, Node *reg, Node *rhs) | 1188 gregshift(int as, Node *lhs, int32 stype, Node *reg, Node *rhs) |
1189 { | 1189 { |
1190 Prog *p; | 1190 Prog *p; |
1191 p = gins(as, N, rhs); | 1191 p = gins(as, N, rhs); |
1192 p->from.type = D_SHIFT; | 1192 p->from.type = D_SHIFT; |
1193 p->from.offset = stype | reg->val.u.reg << 8 | 1<<4 | lhs->val.u.reg; | 1193 p->from.offset = stype | reg->val.u.reg << 8 | 1<<4 | lhs->val.u.reg; |
1194 return p; | 1194 return p; |
1195 } | 1195 } |
1196 | 1196 |
| 1197 |
| 1198 // Generate an instruction referencing *n |
| 1199 // to force segv on nil pointer dereference. |
| 1200 void |
| 1201 checkref(Node *n) |
| 1202 { |
| 1203 Node m; |
| 1204 |
| 1205 if(n->type->type->width < unmappedzero) |
| 1206 return; |
| 1207 |
| 1208 // TODO lvd |
| 1209 } |
| 1210 |
1197 static void | 1211 static void |
1198 checkoffset(Addr *a, int canemitcode) | 1212 checkoffset(Addr *a, int canemitcode) |
1199 { | 1213 { |
1200 Prog *p; | 1214 Prog *p; |
1201 Node n1; | 1215 Node n1; |
1202 | 1216 |
1203 if(a->offset < unmappedzero) | 1217 if(a->offset < unmappedzero) |
1204 return; | 1218 return; |
1205 if(!canemitcode) | 1219 if(!canemitcode) |
1206 fatal("checkoffset %#x, cannot emit code", a->offset); | 1220 fatal("checkoffset %#x, cannot emit code", a->offset); |
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2065 naddr(&n2, a, 1); | 2079 naddr(&n2, a, 1); |
2066 goto yes; | 2080 goto yes; |
2067 | 2081 |
2068 yes: | 2082 yes: |
2069 return 1; | 2083 return 1; |
2070 | 2084 |
2071 no: | 2085 no: |
2072 sudoclean(); | 2086 sudoclean(); |
2073 return 0; | 2087 return 0; |
2074 } | 2088 } |
OLD | NEW |