diff options
Diffstat (limited to 'utils/0l')
| -rw-r--r-- | utils/0l/Nt.c | 77 | ||||
| -rw-r--r-- | utils/0l/Plan9.c | 57 | ||||
| -rw-r--r-- | utils/0l/Posix.c | 80 | ||||
| -rw-r--r-- | utils/0l/l.h | 2 | ||||
| -rw-r--r-- | utils/0l/list.c | 2 | ||||
| -rw-r--r-- | utils/0l/mkfile | 5 | ||||
| -rw-r--r-- | utils/0l/span.c | 2 |
7 files changed, 7 insertions, 218 deletions
diff --git a/utils/0l/Nt.c b/utils/0l/Nt.c deleted file mode 100644 index 2efff499..00000000 --- a/utils/0l/Nt.c +++ /dev/null @@ -1,77 +0,0 @@ -#include <windows.h> -#include "l.h" - -/* - * 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) -{ - USED(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/0l/Plan9.c b/utils/0l/Plan9.c deleted file mode 100644 index f4cf23f4..00000000 --- a/utils/0l/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/0l/Posix.c b/utils/0l/Posix.c deleted file mode 100644 index aa5d9551..00000000 --- a/utils/0l/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; -} - -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; - -} - -void* -mysbrk(ulong size) -{ - return (void*)sbrk(size); -} diff --git a/utils/0l/l.h b/utils/0l/l.h index 6b027814..b58e92c5 100644 --- a/utils/0l/l.h +++ b/utils/0l/l.h @@ -306,7 +306,7 @@ void nocache(Prog*); void noops(void); void nuxiinit(void); void objfile(char*); -int ocmp(const void*, const void*); +int ocmp(void*, void*); long opirr(int); Optab* oplook(Prog*); long oprrr(int); diff --git a/utils/0l/list.c b/utils/0l/list.c index 9261bc8e..c5033a5b 100644 --- a/utils/0l/list.c +++ b/utils/0l/list.c @@ -56,7 +56,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/0l/mkfile b/utils/0l/mkfile index 3001002b..65d2eb40 100644 --- a/utils/0l/mkfile +++ b/utils/0l/mkfile @@ -24,7 +24,10 @@ BIN=$ROOT/$OBJDIR/bin <$ROOT/mkfiles/mkone-$SHELLTYPE -CFLAGS= $CFLAGS -I ../include +CFLAGS= $CFLAGS -I ../include -I. enam.$O: ../0c/enam.c $CC $CFLAGS ../0c/enam.c + +$TARGMODEL.$O: ../ld/$TARGMODEL.c + $CC $CFLAGS ../ld/$TARGMODEL.c diff --git a/utils/0l/span.c b/utils/0l/span.c index 3c9d2d50..f0a423dc 100644 --- a/utils/0l/span.c +++ b/utils/0l/span.c @@ -401,7 +401,7 @@ cmp(int a, int b) } int -ocmp(const void *a1, const void *a2) +ocmp(void *a1, void *a2) { Optab *p1, *p2; int n; |
