summaryrefslogtreecommitdiff
path: root/sys/src/cmd/vi
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/vi
parentfcc5e75d07e5bc6cb3ddac6d9a437e7ec62d0d95 (diff)
import updated compilers from sources
Diffstat (limited to 'sys/src/cmd/vi')
-rw-r--r--sys/src/cmd/vi/vi.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/sys/src/cmd/vi/vi.c b/sys/src/cmd/vi/vi.c
index bc31b5bf1..5ef36fe4a 100644
--- a/sys/src/cmd/vi/vi.c
+++ b/sys/src/cmd/vi/vi.c
@@ -2,6 +2,7 @@
#include <libc.h>
#include <bio.h>
#include <mach.h>
+#include <tos.h>
#define Extern
#include "mips.h"
@@ -291,12 +292,22 @@ void
initstk(int argc, char *argv[])
{
ulong size;
- ulong sp, ap;
+ ulong 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 mips 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;
@@ -306,7 +317,7 @@ initstk(int argc, char *argv[])
sp -= size;
sp &= ~3;
reg.r[29] = sp;
- reg.r[1] = STACKTOP-4; /* Plan 9 profiling clock */
+ reg.r[1] = tos; /* Plan 9 profiling clock, etc. */
/* Push argc */
putmem_w(sp, argc+1);