Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(124)

Delta Between Two Patch Sets: src/cmd/6l/pass.c

Issue 4174060: code review 4174060: 5l/6l/8l: use enums for header type and symbolic string... (Closed)
Left Patch Set: Created 14 years ago
Right Patch Set: diff -r c166ed517af1 https://go.googlecode.com/hg/ Created 14 years ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « src/cmd/6l/obj.c ('k') | src/cmd/8l/asm.c » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 // Inferno utils/6l/pass.c 1 // Inferno utils/6l/pass.c
2 // http://code.google.com/p/inferno-os/source/browse/utils/6l/pass.c 2 // http://code.google.com/p/inferno-os/source/browse/utils/6l/pass.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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 Bflush(&bso); 264 Bflush(&bso);
265 mkfwd(); 265 mkfwd();
266 if(debug['v']) 266 if(debug['v'])
267 Bprint(&bso, "%5.2f patch\n", cputime()); 267 Bprint(&bso, "%5.2f patch\n", cputime());
268 Bflush(&bso); 268 Bflush(&bso);
269 269
270 s = lookup("exit", 0); 270 s = lookup("exit", 0);
271 vexit = s->value; 271 vexit = s->value;
272 for(cursym = textp; cursym != nil; cursym = cursym->next) 272 for(cursym = textp; cursym != nil; cursym = cursym->next)
273 for(p = cursym->text; p != P; p = p->link) { 273 for(p = cursym->text; p != P; p = p->link) {
274 » » if(HEADTYPE == 10) {· 274 » » if(HEADTYPE == Hwindows) {·
275 // Windows 275 // Windows
276 // Convert 276 // Convert
277 // op n(GS), reg 277 // op n(GS), reg
278 // to 278 // to
279 // MOVL 0x58(GS), reg 279 // MOVL 0x58(GS), reg
280 // op n(reg), reg 280 // op n(reg), reg
281 // The purpose of this patch is to fix some accesses 281 // The purpose of this patch is to fix some accesses
282 // to extern register variables (TLS) on Windows, as 282 // to extern register variables (TLS) on Windows, as
283 // a different method is used to access them. 283 // a different method is used to access them.
284 if(p->from.type == D_INDIR+D_GS 284 if(p->from.type == D_INDIR+D_GS
285 && p->to.type >= D_AX && p->to.type <= D_DI· 285 && p->to.type >= D_AX && p->to.type <= D_DI·
286 && p->from.offset <= 8) { 286 && p->from.offset <= 8) {
287 q = appendp(p); 287 q = appendp(p);
288 q->from = p->from; 288 q->from = p->from;
289 q->from.type = D_INDIR + p->to.type; 289 q->from.type = D_INDIR + p->to.type;
290 q->to = p->to; 290 q->to = p->to;
291 q->as = p->as; 291 q->as = p->as;
292 p->as = AMOVQ; 292 p->as = AMOVQ;
293 p->from.type = D_INDIR+D_GS; 293 p->from.type = D_INDIR+D_GS;
294 p->from.offset = 0x58; 294 p->from.offset = 0x58;
295 } 295 }
296 } 296 }
297 » » if(HEADTYPE == 7 || HEADTYPE == 9) { 297 » » if(HEADTYPE == Hlinux || HEADTYPE == Hfreebsd) {
298 // ELF uses FS instead of GS. 298 // ELF uses FS instead of GS.
299 if(p->from.type == D_INDIR+D_GS) 299 if(p->from.type == D_INDIR+D_GS)
300 p->from.type = D_INDIR+D_FS; 300 p->from.type = D_INDIR+D_FS;
301 if(p->to.type == D_INDIR+D_GS) 301 if(p->to.type == D_INDIR+D_GS)
302 p->to.type = D_INDIR+D_FS; 302 p->to.type = D_INDIR+D_FS;
303 } 303 }
304 if(p->as == ACALL || (p->as == AJMP && p->to.type != D_BRANCH)) { 304 if(p->as == ACALL || (p->as == AJMP && p->to.type != D_BRANCH)) {
305 s = p->to.sym; 305 s = p->to.sym;
306 if(s) { 306 if(s) {
307 if(debug['c']) 307 if(debug['c'])
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 autoffset = 0; 415 autoffset = 0;
416 416
417 q = P; 417 q = P;
418 q1 = P; 418 q1 = P;
419 if((p->from.scale & NOSPLIT) && autoffset >= StackSmall) 419 if((p->from.scale & NOSPLIT) && autoffset >= StackSmall)
420 diag("nosplit func likely to overflow stack"); 420 diag("nosplit func likely to overflow stack");
421 421
422 if(!(p->from.scale & NOSPLIT)) { 422 if(!(p->from.scale & NOSPLIT)) {
423 p = appendp(p); // load g into CX 423 p = appendp(p); // load g into CX
424 p->as = AMOVQ; 424 p->as = AMOVQ;
425 » » » if(HEADTYPE == 7 || HEADTYPE == 9)» // ELF uses FS 425 » » » if(HEADTYPE == Hlinux || HEADTYPE == Hfreebsd)» // ELF u ses FS
426 p->from.type = D_INDIR+D_FS; 426 p->from.type = D_INDIR+D_FS;
427 else 427 else
428 p->from.type = D_INDIR+D_GS; 428 p->from.type = D_INDIR+D_GS;
429 p->from.offset = tlsoffset+0; 429 p->from.offset = tlsoffset+0;
430 p->to.type = D_CX; 430 p->to.type = D_CX;
431 » » » if(HEADTYPE == 10) { // Windows 431 » » » if(HEADTYPE == Hwindows) {
432 // movq %gs:0x58, %rcx 432 // movq %gs:0x58, %rcx
433 // movq (%rcx), %rcx 433 // movq (%rcx), %rcx
434 p->as = AMOVQ; 434 p->as = AMOVQ;
435 p->from.type = D_INDIR+D_GS; 435 p->from.type = D_INDIR+D_GS;
436 p->from.offset = 0x58; 436 p->from.offset = 0x58;
437 p->to.type = D_CX; 437 p->to.type = D_CX;
438 438
439 ························ 439 ························
440 p = appendp(p); 440 p = appendp(p);
441 p->as = AMOVQ; 441 p->as = AMOVQ;
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 undef(void) 723 undef(void)
724 { 724 {
725 int i; 725 int i;
726 Sym *s; 726 Sym *s;
727 727
728 for(i=0; i<NHASH; i++) 728 for(i=0; i<NHASH; i++)
729 for(s = hash[i]; s != S; s = s->hash) 729 for(s = hash[i]; s != S; s = s->hash)
730 if(s->type == SXREF) 730 if(s->type == SXREF)
731 diag("%s: not defined", s->name); 731 diag("%s: not defined", s->name);
732 } 732 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b