summaryrefslogtreecommitdiff
path: root/sys/src/cmd/qi
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@gmx.de>2012-07-30 19:11:16 +0200
committercinap_lenrek <cinap_lenrek@gmx.de>2012-07-30 19:11:16 +0200
commit4f33c88a51587681b7be1ae57cfbc43b627c6bc4 (patch)
tree25560404dc80007e5dc268811242c9071f6a1017 /sys/src/cmd/qi
parentfcc5e75d07e5bc6cb3ddac6d9a437e7ec62d0d95 (diff)
import updated compilers from sources
Diffstat (limited to 'sys/src/cmd/qi')
-rw-r--r--sys/src/cmd/qi/qi.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/sys/src/cmd/qi/qi.c b/sys/src/cmd/qi/qi.c
index ebccc5e46..a76356e72 100644
--- a/sys/src/cmd/qi/qi.c
+++ b/sys/src/cmd/qi/qi.c
@@ -2,6 +2,7 @@
#include <libc.h>
#include <bio.h>
#include <mach.h>
+#include <tos.h>
#define Extern
#include "power.h"
@@ -51,6 +52,12 @@ main(int argc, char **argv)
cmd();
}
+/*
+ * we're rounding segment boundaries to the nearest 1MB on power now,
+ * and mach->pgsize is actually what to round segment boundaries up to.
+ */
+#define SEGROUND mach->pgsize
+
void
initmap(void)
{
@@ -58,10 +65,10 @@ initmap(void)
ulong t, d, b, bssend;
Segment *s;
- t = (fhdr.txtaddr+fhdr.txtsz+(BY2PG-1)) & ~(BY2PG-1);
- d = (t + fhdr.datsz + (BY2PG-1)) & ~(BY2PG-1);
+ t = (fhdr.txtaddr+fhdr.txtsz+(SEGROUND-1)) & ~(SEGROUND-1);
+ d = (t + fhdr.datsz + (SEGROUND-1)) & ~(SEGROUND-1);
bssend = t + fhdr.datsz + fhdr.bsssz;
- b = (bssend + (BY2PG-1)) & ~(BY2PG-1);
+ b = (bssend + (SEGROUND-1)) & ~(SEGROUND-1);
s = &memory.seg[Text];
s->type = Text;
@@ -278,12 +285,22 @@ reset(void)
void
initstk(int argc, char *argv[])
{
- ulong size, sp, ap;
+ ulong size, sp, ap, tos;
int i;
char *p;
initmap();
- sp = STACKTOP - 4;
+ tos = STACKTOP - sizeof(Tos)*2; /* we'll assume twice the host's is big enough */
+ sp = tos;
+ for (i = 0; i < sizeof(Tos)*2; i++)
+ putmem_b(tos + i, 0);
+
+ /*
+ * pid is second word from end of tos and needs to be set for nsec().
+ * we know power is a 32-bit cpu, so we'll assume knowledge of the Tos
+ * struct for now, and use our pid.
+ */
+ putmem_w(tos + 4*4 + 2*sizeof(ulong) + 3*sizeof(uvlong), getpid());
/* Build exec stack */
size = strlen(file)+1+BY2WD+BY2WD+(BY2WD*2);
@@ -293,7 +310,7 @@ initstk(int argc, char *argv[])
sp -= size;
sp &= ~7;
reg.r[1] = sp;
- reg.r[3] = STACKTOP-4; /* Plan 9 profiling clock */
+ reg.r[3] = tos; /* Plan 9 profiling clock, etc. */
/* Push argc */
putmem_w(sp, argc+1);