shithub: riscv

Download patch

ref: 9743c2752c83bdd94d9f48f7257a51cfee56861a
parent: f459c5133a89ebba44d0de6ac88c41accd73b2a4
parent: f05af31f3685423e5f97fd6c17f6e6cb4fc11f4b
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sat Mar 8 16:09:59 EST 2014

merge

--- a/sys/src/cmd/5e/fpa.c
+++ b/sys/src/cmd/5e/fpa.c
@@ -100,6 +100,7 @@
 	case 19: res = (vlong) op2; break;
 	case 20: res = sqrt(op2); break;
 	default: sysfatal("unimplemented FPA operation %#x @ %8ux", opc, P->R[15] - 4);
+	return;
 	}
 	switch(prec) {
 	case 0: *Fd = (float) res; break;
--- a/sys/src/cmd/5e/proc.c
+++ b/sys/src/cmd/5e/proc.c
@@ -4,10 +4,30 @@
 #include <bio.h>
 #include <mach.h>
 #include <ctype.h>
-#include <tos.h>
 #include "dat.h"
 #include "fns.h"
 
+#pragma pack on
+typedef struct Tos Tos;
+struct Tos {
+	struct			/* Per process profiling */
+	{
+		ulong	pp;	/* known to be 0(ptr) */
+		ulong	next;	/* known to be 4(ptr) */
+		ulong	last;
+		ulong	first;
+		ulong	pid;
+		ulong	what;
+	} prof;
+	uvlong	cyclefreq;	/* cycle clock frequency if there is one, 0 otherwise */
+	vlong	kcycles;	/* cycles spent in kernel */
+	vlong	pcycles;	/* cycles spent in process (kernel + user) */
+	ulong	pid;		/* might as well put the pid here */
+	ulong	clock;
+	/* top of stack is here */
+};
+#pragma pack off
+
 Process plist;
 Lock plistlock;
 
@@ -77,7 +97,7 @@
 
 	if(P->path != nil && decref(P->path) == 0)
 		free(P->path);
-	P->path = emallocz(5 + strlen(file));
+	P->path = emallocz(sizeof(Ref) + strlen(file)+1);
 	incref(P->path);
 	strcpy((char*)(P->path + 1), file);
 }
--- a/sys/src/cmd/5e/sys.c
+++ b/sys/src/cmd/5e/sys.c
@@ -252,6 +252,8 @@
 	Segment *s;
 	
 	v = arg(0);
+	if(systrace)
+		fprint(2, "brk(%#lux)\n", v);
 	if(v >= P->S[SEGSTACK]->start)
 		sysfatal("bss > stack, wtf?");
 	if(v < P->S[SEGBSS]->start)
@@ -258,7 +260,7 @@
 		sysfatal("bss length < 0, wtf?");
 	s = P->S[SEGBSS];
 	wlock(&s->rw);
-	s->dref = realloc(s->dref, v - s->start + 4);
+	s->dref = realloc(s->dref, v - s->start + sizeof(Ref));
 	if(s->dref == nil)
 		sysfatal("error reallocating");
 	s->data = s->dref + 1;
@@ -503,7 +505,7 @@
 	value = arg(1);
 	if(systrace)
 		fprint(2, "rendezvous(%#ux, %#ux)\n", tag, value);
-	P->R[0] = (u32int) rendezvous((void *) tag, (void *) value);
+	P->R[0] = (u32int) (uintptr)rendezvous((void *) tag, (void *) value);
 	if(P->R[0] == ~0)
 		noteerr(0, 1);
 }