This commit is contained in:
cinap_lenrek 2014-03-08 21:09:59 +01:00
commit 9743c2752c
3 changed files with 27 additions and 4 deletions

View file

@ -100,6 +100,7 @@ fpaoperation(u32int instr)
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;

View file

@ -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 @@ copyname(char *file)
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);
}

View file

@ -252,13 +252,15 @@ sysbrk(void)
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)
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 @@ sysrendezvous(void)
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);
}