From 081f14eaaba514c12949a4f4917635cdd8e52c77 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Thu, 10 Jul 1997 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1997-07-10 --- pc/archmp.c | 12 +++++++++--- pc/devastar.c | 7 ++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/pc/archmp.c b/pc/archmp.c index 07369f09f81cd5cb6aa8079dbaab269a33cb455d..145bfa0879e0cebc90f6aa2f04e612457783b7d5 100644 --- a/pc/archmp.c +++ b/pc/archmp.c @@ -67,20 +67,26 @@ identify(void) /* * Search for an MP configuration table. For now, * don't accept the default configurations (physaddr == 0). - * Calculate the checksum. + * Check for correct signature, calculate the checksum and, + * if correct, check the version. * To do: check extended table checksum. */ if((_mp_ = mpsearch()) == 0 || _mp_->physaddr == 0) return 1; pcmp = KADDR(_mp_->physaddr); - length = pcmp->length; + if(memcmp(pcmp, "PCMP", 4)) + return 1; + length = pcmp->length; sum = 0; for(p = (uchar*)pcmp; length; length--) sum += *p++; - return sum; + if(sum || (pcmp->version != 1 && pcmp->version != 4)) + return 1; + + return 0; } PCArch archmp = { diff --git a/pc/devastar.c b/pc/devastar.c index 4336b4e30000ee7ecfad6c5e076e8e511471c9b5..23eb56905cbff5f75451404739b9c4ddaf974f2c 100644 --- a/pc/devastar.c +++ b/pc/devastar.c @@ -277,7 +277,7 @@ static int nastar; enum { - Qmem= 0, + Qmem= 1, Qbctl, Qdata, Qctl, @@ -560,11 +560,12 @@ astarclose(Chan *c) Astar *a; Astarchan *ac; + if((c->flag & COPEN) == 0) + return; + a = astar[BOARD(c->qid.path)]; switch(TYPE(c->qid.path)){ - case Qmem: - break; case Qdata: case Qctl: ac = a->c + CHAN(c->qid.path);