segment: don't store pointers in a long

This commit is contained in:
cinap_lenrek 2015-04-13 23:35:36 +02:00
parent 656dd953a8
commit 35e1aa1bfa

View file

@ -41,7 +41,7 @@ struct Globalseg
Rendez replywait; /* where requestor waits */ Rendez replywait; /* where requestor waits */
Proc *kproc; Proc *kproc;
char *data; char *data;
long off; char *addr;
int dlen; int dlen;
int cmd; int cmd;
char err[64]; char err[64];
@ -350,7 +350,7 @@ segmentio(Globalseg *g, void *a, long n, vlong off, int wr)
qunlock(&g->l); qunlock(&g->l);
nexterror(); nexterror();
} }
g->off = off + g->s->base; g->addr = (char*)g->s->base + off;
g->data = b; g->data = b;
g->dlen = n; g->dlen = n;
docmd(g, wr ? Cwrite : Cread); docmd(g, wr ? Cwrite : Cread);
@ -571,10 +571,10 @@ segmentkproc(void *arg)
done = 1; done = 1;
break; break;
case Cread: case Cread:
memmove(g->data, (char*)g->off, g->dlen); memmove(g->data, g->addr, g->dlen);
break; break;
case Cwrite: case Cwrite:
memmove((char*)g->off, g->data, g->dlen); memmove(g->addr, g->data, g->dlen);
break; break;
} }
poperror(); poperror();