update aml library from cinap Reference: /n/atom/patch/applied2013/amlupd Date: Tue Jun 18 02:20:18 CES 2013 Signed-off-by: quanstro@quanstro.net --- /sys/src/libaml/aml.c Tue Jun 18 02:20:08 2013 +++ /sys/src/libaml/aml.c Tue Jun 18 02:20:08 2013 @@ -47,7 +47,7 @@ "Smbus", "Cmos", "Pcibar", - "Ipmi" + "Ipmi", }; /* field flags */ @@ -127,6 +127,7 @@ struct Frame { int tag; + int cond; char *phase; uchar *start; uchar *end; @@ -142,7 +143,6 @@ struct Interp { uchar *pc; Frame *fp; - int cond; }; static Interp interp; @@ -170,7 +170,7 @@ Ocfld, Ocfld0, Ocfld1, Ocfld2, Ocfld4, Ocfld8, Oif, Oelse, Owhile, Obreak, Oret, Ocall, Ostore, Oderef, Osize, Oref, Ocref, - Oacq, Orel, + Oacq, Orel, Ostall, Osleep, }; static Op optab[]; @@ -178,7 +178,8 @@ static uchar octab2[]; static Name* -rootname(Name *dot){ +rootname(Name *dot) +{ while(dot != dot->up) dot = dot->up; return dot; @@ -437,7 +438,7 @@ static uvlong ival(void *p) { - if(p) + if(p != nil) switch(TAG(p)){ case 'i': return *((uvlong*)p); @@ -593,7 +594,7 @@ { void *d; - if(s){ + if(s != nil){ int n; if(tag == 0) tag = TAG(s); @@ -812,6 +813,7 @@ FP = FB; FP->tag = 0; + FP->cond = 0; FP->narg = 0; FP->phase = "}"; FP->start = PC; @@ -826,7 +828,7 @@ if((++loop & 127) == 0) gc(); if(amldebug) - print("\n%.8p.%.2lx %-8s %d\t%N\t", PC, FP - FB, FP->phase, interp.cond, FP->dot); + print("\n%.8p.%.2lx %-8s\t%N\t", PC, FP - FB, FP->phase, FP->dot); r = nil; c = *FP->phase++; switch(c){ @@ -1052,15 +1054,21 @@ evalpkg(void) { Package *p; + void **x; int n; - if(p = FP->ref){ - n = sizeof(Package)+p->n*sizeof(void*); - if(n < SIZE(p)) - p->a[p->n++] = FP->arg[0]; + if((p = FP->ref) != nil){ + x = FP->aux; + if(x >= &p->a[0] && x < &p->a[p->n]){ + *x++ = FP->arg[0]; + FP->aux = x; + } }else { - n = sizeof(Package)+ival(FP->arg[0])*sizeof(void*); - p = mk('p', n); + n = ival(FP->arg[0]); + if(n < 0) n = 0; + p = mk('p', sizeof(Package) + n*sizeof(void*)); + p->n = n; + FP->aux = p->a; FP->ref = p; } return p; @@ -1278,12 +1286,16 @@ { switch(FP->op - optab){ case Oif: - interp.cond = ival(FP->arg[0]) != 0; - if(!interp.cond) + if(FP <= FB) + break; + FP[-1].cond = ival(FP->arg[0]) != 0; + if(!FP[-1].cond) PC = FP->end; break; case Oelse: - if(interp.cond) + if(FP <= FB) + break; + if(FP[-1].cond) PC = FP->end; break; case Owhile: @@ -1295,8 +1307,7 @@ return nil; } FP->aux = FP->end; - interp.cond = ival(FP->arg[0]) != 0; - if(!interp.cond){ + if(ival(FP->arg[0]) == 0){ PC = FP->end; break; } @@ -1661,6 +1672,8 @@ [Oacq] "Acquire", "@2", evalnop, [Orel] "Release", "@", evalnop, + [Ostall] "Stall", "i", evalnop, + [Osleep] "Sleep", "i", evalnop, }; static uchar octab1[] = { @@ -1703,7 +1716,7 @@ /* 08 */ Obad, Obad, Obad, Obad, Obad, Obad, Obad, Obad, /* 10 */ Obad, Obad, Ocref, Ocfld, Obad, Obad, Obad, Obad, /* 18 */ Obad, Obad, Obad, Obad, Obad, Obad, Obad, Obad, -/* 20 */ Obad, Obad, Obad, Oacq, Obad, Obad, Obad, Orel, +/* 20 */ Obad, Ostall, Osleep, Oacq, Obad, Obad, Obad, Orel, /* 28 */ Obad, Obad, Obad, Obad, Obad, Obad, Obad, Obad, /* 30 */ Obad, Odebug, Obad, Obad, Obad, Obad, Obad, Obad, /* 38 */ Obad, Obad, Obad, Obad, Obad, Obad, Obad, Obad, @@ -1791,6 +1804,7 @@ getname(amlroot, "_SB", 1); getname(amlroot, "_TZ", 1); getname(amlroot, "_SI", 1); + getname(amlroot, "_GL", 1); if(n = getname(amlroot, "_REV", 1)) n->v = mki(2);