summaryrefslogtreecommitdiff
path: root/utils/kl
diff options
context:
space:
mode:
Diffstat (limited to 'utils/kl')
-rw-r--r--utils/kl/Nt.c88
-rw-r--r--utils/kl/Plan9.c57
-rw-r--r--utils/kl/Posix.c80
-rw-r--r--utils/kl/l.h2
-rw-r--r--utils/kl/list.c2
-rw-r--r--utils/kl/mkfile5
-rw-r--r--utils/kl/span.c2
7 files changed, 7 insertions, 229 deletions
diff --git a/utils/kl/Nt.c b/utils/kl/Nt.c
deleted file mode 100644
index 6be99a36..00000000
--- a/utils/kl/Nt.c
+++ /dev/null
@@ -1,88 +0,0 @@
-#include <windows.h>
-
-/*
- * We can't include l.h, because Windoze wants to use some names
- * like FLOAT which we declare. Define what we need here.
- */
-typedef unsigned char uchar;
-typedef unsigned int uint;
-typedef unsigned long ulong;
-
-extern char *hunk;
-extern long nhunk;
-
-void gethunk(void);
-
-/*
- * fake malloc
- */
-void*
-malloc(uint n)
-{
- void *p;
-
- while(n & 7)
- n++;
- while(nhunk < n)
- gethunk();
- p = hunk;
- nhunk -= n;
- hunk += n;
- return p;
-}
-
-void
-free(void *p)
-{
-}
-
-void*
-calloc(uint m, uint n)
-{
- void *p;
-
- n *= m;
- p = malloc(n);
- memset(p, 0, n);
- return p;
-}
-
-void*
-realloc(void *p, uint n)
-{
- void *new;
-
- new = malloc(n);
- if(new && p)
- memmove(new, p, n);
- return new;
-}
-
-#define Chunk (1*1024*1024)
-
-void*
-mysbrk(ulong size)
-{
- void *v;
- static int chunk;
- static uchar *brk;
-
- if(chunk < size) {
- chunk = Chunk;
- if(chunk < size)
- chunk = Chunk + size;
- brk = VirtualAlloc(NULL, chunk, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
- if(brk == 0)
- return (void*)-1;
- }
- v = brk;
- chunk -= size;
- brk += size;
- return v;
-}
-
-double
-cputime(void)
-{
- return ((double)0);
-}
diff --git a/utils/kl/Plan9.c b/utils/kl/Plan9.c
deleted file mode 100644
index f4cf23f4..00000000
--- a/utils/kl/Plan9.c
+++ /dev/null
@@ -1,57 +0,0 @@
-#include "l.h"
-
-/*
- * fake malloc
- */
-void*
-malloc(ulong n)
-{
- void *p;
-
- while(n & 7)
- n++;
- while(nhunk < n)
- gethunk();
- p = hunk;
- nhunk -= n;
- hunk += n;
- return p;
-}
-
-void
-free(void *p)
-{
- USED(p);
-}
-
-void*
-calloc(ulong m, ulong n)
-{
- void *p;
-
- n *= m;
- p = malloc(n);
- memset(p, 0, n);
- return p;
-}
-
-void*
-realloc(void *p, ulong n)
-{
- USED(p);
- USED(n);
- fprint(2, "realloc called\n");
- abort();
- return 0;
-}
-
-void*
-mysbrk(ulong size)
-{
- return sbrk(size);
-}
-
-void
-setmalloctag(void*, ulong)
-{
-}
diff --git a/utils/kl/Posix.c b/utils/kl/Posix.c
deleted file mode 100644
index 7c3a661f..00000000
--- a/utils/kl/Posix.c
+++ /dev/null
@@ -1,80 +0,0 @@
-#include "l.h"
-#include <sys/types.h>
-#include <sys/times.h>
-#undef getwd
-#include <unistd.h> /* For sysconf() and _SC_CLK_TCK */
-
-/*
- * fake malloc
- */
-void*
-malloc(size_t n)
-{
- void *p;
-
- while(n & 7)
- n++;
- while(nhunk < n)
- gethunk();
- p = hunk;
- nhunk -= n;
- hunk += n;
- return p;
-}
-
-void
-free(void *p)
-{
- USED(p);
-}
-
-void*
-calloc(size_t m, size_t n)
-{
- void *p;
-
- n *= m;
- p = malloc(n);
- memset(p, 0, n);
- return p;
-}
-
-void*
-realloc(void *p, size_t n)
-{
- fprint(2, "realloc called\n", p, n);
- abort();
- return 0;
-}
-
-void*
-mysbrk(ulong size)
-{
- return (void*)sbrk(size);
-}
-
-double
-cputime(void)
-{
-
- struct tms tmbuf;
- double ret_val;
-
- /*
- * times() only fials if &tmbuf is invalid.
- */
- (void)times(&tmbuf);
- /*
- * Return the total time (in system clock ticks)
- * spent in user code and system
- * calls by both the calling process and its children.
- */
- ret_val = (double)(tmbuf.tms_utime + tmbuf.tms_stime +
- tmbuf.tms_cutime + tmbuf.tms_cstime);
- /*
- * Convert to seconds.
- */
- ret_val *= sysconf(_SC_CLK_TCK);
- return ret_val;
-
-}
diff --git a/utils/kl/l.h b/utils/kl/l.h
index c036e14d..7a2f02ae 100644
--- a/utils/kl/l.h
+++ b/utils/kl/l.h
@@ -305,7 +305,7 @@ void nocache(Prog*);
void noops(void);
void nuxiinit(void);
void objfile(char*);
-int ocmp(const void*, const void*);
+int ocmp(void*, void*);
long opcode(int);
Optab* oplook(Prog*);
void patch(void);
diff --git a/utils/kl/list.c b/utils/kl/list.c
index 00fcb7ee..214da7e4 100644
--- a/utils/kl/list.c
+++ b/utils/kl/list.c
@@ -59,7 +59,7 @@ Aconv(Fmt *fp)
int a;
a = va_arg(fp->args, int);
- s = "???";
+ s = "?";
if(a >= AXXX && a <= ALAST)
s = anames[a];
return fmtstrcpy(fp, s);
diff --git a/utils/kl/mkfile b/utils/kl/mkfile
index cf406d8f..fd44f0d3 100644
--- a/utils/kl/mkfile
+++ b/utils/kl/mkfile
@@ -1,6 +1,6 @@
<../../mkconfig
-CFLAGS=$CFLAGS -I../include
+CFLAGS=$CFLAGS -I../include -I.
TARG=kl
@@ -29,3 +29,6 @@ BIN=$ROOT/$OBJDIR/bin
enam.$O: ../kc/enam.c
$CC $CFLAGS ../kc/enam.c
+
+$TARGMODEL.$O: ../ld/$TARGMODEL.c
+ $CC $CFLAGS ../ld/$TARGMODEL.c
diff --git a/utils/kl/span.c b/utils/kl/span.c
index a788b8d3..28a66dd4 100644
--- a/utils/kl/span.c
+++ b/utils/kl/span.c
@@ -335,7 +335,7 @@ cmp(int a, int b)
}
int
-ocmp(const void *a1, const void *a2)
+ocmp(void *a1, void *a2)
{
Optab *p1, *p2;
int n;