OLD | NEW |
1 // Derived from Inferno utils/8c/txt.c | 1 // Derived from Inferno utils/8c/txt.c |
2 // http://code.google.com/p/inferno-os/source/browse/utils/8c/txt.c | 2 // http://code.google.com/p/inferno-os/source/browse/utils/8c/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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 plast = pl; | 116 plast = pl; |
117 | 117 |
118 pc = mal(sizeof(*pc)); | 118 pc = mal(sizeof(*pc)); |
119 clearp(pc); | 119 clearp(pc); |
120 pl->firstpc = pc; | 120 pl->firstpc = pc; |
121 | 121 |
122 return pl; | 122 return pl; |
123 } | 123 } |
124 | 124 |
125 void | 125 void |
| 126 clearstk(void) |
| 127 { |
| 128 Plist *pl; |
| 129 Prog *p1, *p2; |
| 130 Node sp, di, cx, con; |
| 131 |
| 132 if(plast->firstpc->to.offset <= 0) |
| 133 return; |
| 134 |
| 135 // reestablish context for inserting code |
| 136 // at beginning of function. |
| 137 pl = plast; |
| 138 p1 = pl->firstpc; |
| 139 p2 = p1->link; |
| 140 pc = mal(sizeof(*pc)); |
| 141 clearp(pc); |
| 142 p1->link = pc; |
| 143 ········ |
| 144 // zero stack frame |
| 145 nodreg(&sp, types[tptr], D_SP); |
| 146 nodreg(&di, types[tptr], D_DI); |
| 147 nodreg(&cx, types[TUINT32], D_CX); |
| 148 nodconst(&con, types[TUINT32], p1->to.offset / widthptr); |
| 149 gins(ACLD, N, N); |
| 150 gins(AMOVL, &sp, &di); |
| 151 gins(AMOVL, &con, &cx); |
| 152 gins(AREP, N, N); |
| 153 gins(ASTOSL, N, N); |
| 154 |
| 155 // continue with original code. |
| 156 gins(ANOP, N, N)->link = p2; |
| 157 pc = P; |
| 158 }······· |
| 159 |
| 160 void |
126 gused(Node *n) | 161 gused(Node *n) |
127 { | 162 { |
128 gins(ANOP, n, N); // used | 163 gins(ANOP, n, N); // used |
129 } | 164 } |
130 | 165 |
131 Prog* | 166 Prog* |
132 gjmp(Prog *to) | 167 gjmp(Prog *to) |
133 { | 168 { |
134 Prog *p; | 169 Prog *p; |
135 | 170 |
(...skipping 1763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1899 void | 1934 void |
1900 sudoclean(void) | 1935 sudoclean(void) |
1901 { | 1936 { |
1902 } | 1937 } |
1903 | 1938 |
1904 int | 1939 int |
1905 sudoaddable(int as, Node *n, Addr *a) | 1940 sudoaddable(int as, Node *n, Addr *a) |
1906 { | 1941 { |
1907 return 0; | 1942 return 0; |
1908 } | 1943 } |
OLD | NEW |