shithub: riscv

Download patch

ref: 35e1aa1bfa5f1bdb2002b724e636ffe1ddea9a09
parent: 656dd953a85b043c1eb085d5d8e1f7f7f1e4452f
author: cinap_lenrek <[email protected]>
date: Mon Apr 13 19:35:36 EDT 2015

segment: don't store pointers in a long

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