M bitsy/etherwavelan.c => bitsy/etherwavelan.c +8 -3
@@ 438,7 438,7 @@ ltv_outstr(Ctlr* ctlr, int type, char* val)
ltv.type = type;
// This should be ltv.slen = len; according to Axel Belinfante
- ltv.slen = (len+1) & ~1;
+ ltv.slen = len;
strncpy(ltv.s, val, len);
w_outltv(ctlr, <v);
@@ 451,15 451,20 @@ static char*
ltv_inname(Ctlr* ctlr, int type)
{
static Wltv ltv;
+ int len;
memset(<v,0,sizeof(ltv));
ltv.len = WNameLen/2+2;
ltv.type = type;
if (w_inltv(ctlr, <v))
return Unkname;
- if (ltv.name[2] == 0)
+ len = ltv.slen;
+ if(len == 0 || ltv.s[0] == 0)
return Nilname;
- return ltv.name+2;
+ if(len >= sizeof ltv.s)
+ len = sizeof ltv.s - 1;
+ ltv.s[len] = '\0';
+ return ltv.s;
}
static int
M pc/etherwavelan.c => pc/etherwavelan.c +8 -3
@@ 438,7 438,7 @@ ltv_outstr(Ctlr* ctlr, int type, char* val)
ltv.type = type;
// This should be ltv.slen = len; according to Axel Belinfante
- ltv.slen = (len+1) & ~1;
+ ltv.slen = len;
strncpy(ltv.s, val, len);
w_outltv(ctlr, <v);
@@ 451,15 451,20 @@ static char*
ltv_inname(Ctlr* ctlr, int type)
{
static Wltv ltv;
+ int len;
memset(<v,0,sizeof(ltv));
ltv.len = WNameLen/2+2;
ltv.type = type;
if (w_inltv(ctlr, <v))
return Unkname;
- if (ltv.name[2] == 0)
+ len = ltv.slen;
+ if(len == 0 || ltv.s[0] == 0)
return Nilname;
- return ltv.name+2;
+ if(len >= sizeof ltv.s)
+ len = sizeof ltv.s - 1;
+ ltv.s[len] = '\0';
+ return ltv.s;
}
static int
M pc/trap.c => pc/trap.c +8 -1
@@ 56,6 56,13 @@ intrdisable(int irq, void (*f)(Ureg *, void *), void *a, int tbdf, char *name)
Vctl **pv, *v;
int vno;
+ /*
+ * For now, none of this will work with the APIC code,
+ * there is no mapping between irq and vector as the IRQ
+ * is pretty meaningless.
+ */
+ if(arch->intrvecno == nil)
+ return;
vno = arch->intrvecno(irq);
ilock(&vctllock);
pv = &vctl[vno];
@@ 68,7 75,7 @@ intrdisable(int irq, void (*f)(Ureg *, void *), void *a, int tbdf, char *name)
v = *pv;
*pv = (*pv)->next; /* Link out the entry */
- if (vctl[vno] == nil)
+ if (vctl[vno] == nil && arch->intrdisable != nil)
arch->intrdisable(irq);
iunlock(&vctllock);
xfree(v);