summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@gmx.de>2013-06-19 22:26:27 +0200
committercinap_lenrek <cinap_lenrek@gmx.de>2013-06-19 22:26:27 +0200
commit5bb8203bf6cf2db988fc61ffaf8bf39aa30fabfe (patch)
tree3174386f75f920c34c4a48707b428295be5000c3
parent40bc0b9de717c9f7cfadcca1d6d21bb115b3e8bb (diff)
downloadplan9front-5bb8203bf6cf2db988fc61ffaf8bf39aa30fabfe.tar.xz
acpi: use Tblsz enum instead of sizeof(Tbl) due to alignment, enable use tsc on terminal kernel (thank erik)
-rw-r--r--sys/src/9/pc/archacpi.c12
-rw-r--r--sys/src/9/pc/archmp.c2
-rw-r--r--sys/src/cmd/scram.c14
3 files changed, 18 insertions, 10 deletions
diff --git a/sys/src/9/pc/archacpi.c b/sys/src/9/pc/archacpi.c
index 243b8996c..24b3245bc 100644
--- a/sys/src/9/pc/archacpi.c
+++ b/sys/src/9/pc/archacpi.c
@@ -37,6 +37,10 @@ struct Tbl {
uchar data[];
};
+enum {
+ Tblsz = 4+4+1+1+6+8+4+4+4,
+};
+
static Rsd *rsd;
/* physical addresses visited by maptable() */
@@ -82,7 +86,7 @@ get64(uchar *p){
static uint
tbldlen(Tbl *t){
- return get32(t->len) - sizeof(Tbl);
+ return get32(t->len) - Tblsz;
}
static void
@@ -109,7 +113,7 @@ maptable(uvlong xpa)
if((t = vmap(pa, 8)) == nil)
return;
l = get32(t->len);
- if(l < sizeof(Tbl)){
+ if(l < Tblsz){
vunmap(t, 8);
return;
}
@@ -396,7 +400,7 @@ Foundapic:
a->addr = va;
a->lintr[0] = ApicIMASK;
a->lintr[1] = ApicIMASK;
- a->flags = (p[4] & PcmpEN);
+ a->flags = p[4] & PcmpEN;
if(a->flags & PcmpEN){
a->machno = machno++;
@@ -515,7 +519,7 @@ identify(void)
return 1;
if((cp = getconf("*nomp")) != nil && strcmp(cp, "0") != 0)
return 1;
- if(cpuserver && m->havetsc)
+ if(m->havetsc)
archacpi.fastclock = tscticks;
return 0;
}
diff --git a/sys/src/9/pc/archmp.c b/sys/src/9/pc/archmp.c
index bbde765a0..23cf4fa66 100644
--- a/sys/src/9/pc/archmp.c
+++ b/sys/src/9/pc/archmp.c
@@ -395,7 +395,7 @@ identify(void)
return 1;
}
- if(cpuserver && m->havetsc)
+ if(m->havetsc)
archmp.fastclock = tscticks;
return 0;
diff --git a/sys/src/cmd/scram.c b/sys/src/cmd/scram.c
index cbbe8d90d..1ce3aa6e8 100644
--- a/sys/src/cmd/scram.c
+++ b/sys/src/cmd/scram.c
@@ -25,6 +25,10 @@ struct Tbl {
uchar data[];
};
+enum {
+ Tblsz = 4+4+1+1+6+8+4+4+4,
+};
+
void*
amlalloc(int n){
return mallocz(n, 1);
@@ -64,15 +68,15 @@ loadacpi(void)
amlinit();
for(;;){
t = malloc(sizeof(*t));
- if((n = readn(fd, t, sizeof(*t))) <= 0)
+ if((n = readn(fd, t, Tblsz)) <= 0)
break;
- if(n != sizeof(*t))
+ if(n != Tblsz)
return -1;
l = get32(t->len);
- if(l < sizeof(*t))
+ if(l < Tblsz)
return -1;
- t = realloc(t, l);
- l -= sizeof(*t);
+ l -= Tblsz;
+ t = realloc(t, sizeof(*t) + l);
if(readn(fd, t->data, l) != l)
return -1;
if(memcmp("DSDT", t->sig, 4) == 0)