1
0
mirror of https://github.com/golang/go synced 2024-09-25 05:20:13 -06:00

stack offseet table marker

tacked above each TEXT entry

SVN=123496
This commit is contained in:
Ken Thompson 2008-06-18 17:51:56 -07:00
parent 543226e8fd
commit f997bc6eb6
6 changed files with 26 additions and 4 deletions

View File

@ -32,6 +32,7 @@
#define NSNAME 8
#define NOPROF (1<<0)
#define DUPOK (1<<1)
#define SOFmark (11)
/*
* amd64

View File

@ -138,7 +138,8 @@ asmb(void)
for(p = firstp; p != P; p = p->link) {
if(p->as == ATEXT)
curtext = p;
if(p->pc != pc) {
if(p->pc != pc)
if(p->as != ATEXT || p->pc != pc+SOFmark) {
if(!debug['a'])
print("%P\n", curp);
diag("phase error %llux sb %llux in %s", p->pc, pc, TNAME);

View File

@ -217,6 +217,7 @@ enum
Zaut_r,
Zo_m,
Zo_m64,
Ztext,
Zpseudo,
Zr_m,
Zr_m_xm,

View File

@ -925,7 +925,9 @@ loop:
sig = 1729;
if(sig != 0){
if(s->sig != 0 && s->sig != sig)
diag("incompatible type signatures %lux(%s) and %lux(%s) for %s", s->sig, filen[s->file], sig, pn, s->name);
diag("incompatible type signatures %lux(%s)"
"and %lux(%s) for %s", s->sig,
filen[s->file], sig, pn, s->name);
s->sig = sig;
s->file = files-1;
}

View File

@ -37,7 +37,7 @@ uchar ynone[] =
};
uchar ytext[] =
{
Ymb, Yi32, Zpseudo,1,
Ymb, Yi32, Ztext, 1,
0
};
uchar ynop[] =

View File

@ -83,6 +83,8 @@ start:
p->pc = c;
asmins(p);
p->pc = c;
if(p->as == ATEXT)
p->pc += SOFmark; // skip the stack marker
m = andptr-and;
p->mark = m;
c += m;
@ -113,6 +115,8 @@ loop:
}
}
p->pc = c;
if(p->as == ATEXT)
p->pc += SOFmark; // skip the stack marker
c += p->mark;
}
if(again) {
@ -269,7 +273,7 @@ asmlc(void)
Prog *p;
long oldlc, v, s;
oldpc = INITTEXT;
oldpc = INITTEXT+SOFmark;
oldlc = 0;
for(p = firstp; p != P; p = p->link) {
if(p->line == oldlc || p->as == ATEXT || p->as == ANOP) {
@ -1120,6 +1124,19 @@ found:
diag("asmins: unknown z %d %P", t[2], p);
return;
case Ztext:
v = p->to.offset;
if(v < 0)
v = 0;
// eleven bytes of buried stack offset
*andptr++ = v>>3;
*andptr++ = v>>11;
*andptr++ = v>>19;
for(v=0; v<SOFmark-3; v++)
*andptr++ = "\xa7\xf1\xd9\x2a\x82\xc8\xd8\xfe"[v];
break;
case Zpseudo:
break;