diff options
author | Ondřej Surý <ondrej@sury.org> | 2011-09-13 13:11:55 +0200 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2011-09-13 13:11:55 +0200 |
commit | 80f18fc933cf3f3e829c5455a1023d69f7b86e52 (patch) | |
tree | 4b825dc642cb6eb9a060e54bf8d69288fbee4904 /include | |
parent | 28592ee1ea1f5cdffcf85472f9de0285d928cf12 (diff) | |
download | golang-80f18fc933cf3f3e829c5455a1023d69f7b86e52.tar.gz |
Imported Upstream version 60
Diffstat (limited to 'include')
-rw-r--r-- | include/ar.h | 47 | ||||
-rw-r--r-- | include/bio.h | 116 | ||||
-rw-r--r-- | include/bootexec.h | 169 | ||||
-rw-r--r-- | include/fmt.h | 116 | ||||
-rw-r--r-- | include/libc.h | 382 | ||||
-rw-r--r-- | include/mach.h | 410 | ||||
-rw-r--r-- | include/u.h | 228 | ||||
-rw-r--r-- | include/ureg_amd64.h | 58 | ||||
-rw-r--r-- | include/ureg_arm.h | 49 | ||||
-rw-r--r-- | include/ureg_x86.h | 53 | ||||
-rw-r--r-- | include/utf.h | 1 |
11 files changed, 0 insertions, 1629 deletions
diff --git a/include/ar.h b/include/ar.h deleted file mode 100644 index b565ac90b..000000000 --- a/include/ar.h +++ /dev/null @@ -1,47 +0,0 @@ -// Inferno utils/include/ar.h -// http://code.google.com/p/inferno-os/source/browse/utils/include/ar.h -// -// Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved. -// Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net) -// Portions Copyright © 1997-1999 Vita Nuova Limited -// Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuova.com) -// Portions Copyright © 2004,2006 Bruce Ellis -// Portions Copyright © 2005-2007 C H Forsyth (forsyth@terzarima.net) -// Revisions Copyright © 2000-2007 Lucent Technologies Inc. and others -// Portions Copyright © 2009 The Go Authors. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#define ARMAG "!<arch>\n" -#define SARMAG 8 - -#define ARFMAG "`\n" -#define SARNAME 64 - -struct ar_hdr -{ - char name[SARNAME]; - char date[12]; - char uid[6]; - char gid[6]; - char mode[8]; - char size[10]; - char fmag[2]; -}; -#define SAR_HDR (SARNAME+44) diff --git a/include/bio.h b/include/bio.h deleted file mode 100644 index c754d7a57..000000000 --- a/include/bio.h +++ /dev/null @@ -1,116 +0,0 @@ -/* -http://code.google.com/p/inferno-os/source/browse/include/bio.h - - Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved. - Revisions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuova.com). All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -*/ - -#ifndef _BIO_H_ -#define _BIO_H_ 1 -#if defined(__cplusplus) -extern "C" { -#endif - -#ifdef AUTOLIB -AUTOLIB(bio) -#endif - -#include <fcntl.h> /* for O_RDONLY, O_WRONLY */ - -typedef struct Biobuf Biobuf; - -enum -{ - Bsize = 8*1024, - Bungetsize = 4, /* space for ungetc */ - Bmagic = 0x314159, - Beof = -1, - Bbad = -2, - - Binactive = 0, /* states */ - Bractive, - Bwactive, - Bracteof, - - Bend -}; - -struct Biobuf -{ - int icount; /* neg num of bytes at eob */ - int ocount; /* num of bytes at bob */ - int rdline; /* num of bytes after rdline */ - int runesize; /* num of bytes of last getrune */ - int state; /* r/w/inactive */ - int fid; /* open file */ - int flag; /* magic if malloc'ed */ - vlong offset; /* offset of buffer in file */ - int bsize; /* size of buffer */ - unsigned char* bbuf; /* pointer to beginning of buffer */ - unsigned char* ebuf; /* pointer to end of buffer */ - unsigned char* gbuf; /* pointer to good data in buf */ - unsigned char b[Bungetsize+Bsize]; -}; - -#define BGETC(bp)\ - ((bp)->icount?(bp)->bbuf[(bp)->bsize+(bp)->icount++]:Bgetc((bp))) -#define BPUTC(bp,c)\ - ((bp)->ocount?(bp)->bbuf[(bp)->bsize+(bp)->ocount++]=(c),0:Bputc((bp),(c))) -#define BOFFSET(bp)\ - (((bp)->state==Bractive)?\ - (bp)->offset + (bp)->icount:\ - (((bp)->state==Bwactive)?\ - (bp)->offset + ((bp)->bsize + (bp)->ocount):\ - -1)) -#define BLINELEN(bp)\ - (bp)->rdline -#define BFILDES(bp)\ - (bp)->fid - -int Bbuffered(Biobuf*); -Biobuf* Bfdopen(int, int); -int Bfildes(Biobuf*); -int Bflush(Biobuf*); -int Bgetc(Biobuf*); -int Bgetd(Biobuf*, double*); -long Bgetrune(Biobuf*); -int Binit(Biobuf*, int, int); -int Binits(Biobuf*, int, int, unsigned char*, int); -int Blinelen(Biobuf*); -vlong Boffset(Biobuf*); -Biobuf* Bopen(char*, int); -int Bprint(Biobuf*, char*, ...); -int Bputc(Biobuf*, int); -int Bputrune(Biobuf*, long); -void* Brdline(Biobuf*, int); -char* Brdstr(Biobuf*, int, int); -long Bread(Biobuf*, void*, long); -vlong Bseek(Biobuf*, vlong, int); -int Bterm(Biobuf*); -int Bungetc(Biobuf*); -int Bungetrune(Biobuf*); -long Bwrite(Biobuf*, void*, long); -int Bvprint(Biobuf*, char*, va_list); - -#if defined(__cplusplus) -} -#endif -#endif diff --git a/include/bootexec.h b/include/bootexec.h deleted file mode 100644 index 49721ea33..000000000 --- a/include/bootexec.h +++ /dev/null @@ -1,169 +0,0 @@ -// Inferno libmach/bootexec.h -// http://code.google.com/p/inferno-os/source/browse/utils/libmach/bootexec.h -// -// Copyright © 1994-1999 Lucent Technologies Inc. -// Power PC support Copyright © 1995-2004 C H Forsyth (forsyth@terzarima.net). -// Portions Copyright © 1997-1999 Vita Nuova Limited. -// Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuova.com). -// Revisions Copyright © 2000-2004 Lucent Technologies Inc. and others. -// Portions Copyright © 2009 The Go Authors. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -struct coffsect -{ - char name[8]; - uint32 phys; - uint32 virt; - uint32 size; - uint32 fptr; - uint32 fptrreloc; - uint32 fptrlineno; - uint32 nrelocnlineno; - uint32 flags; -}; - -/* - * proprietary exec headers, needed to bootstrap various machines - */ -struct mipsexec -{ - short mmagic; /* (0x160) mips magic number */ - short nscns; /* (unused) number of sections */ - int32 timdat; /* (unused) time & date stamp */ - int32 symptr; /* offset to symbol table */ - int32 nsyms; /* size of symbol table */ - short opthdr; /* (0x38) sizeof(optional hdr) */ - short pcszs; /* flags */ - short amagic; /* see above */ - short vstamp; /* version stamp */ - int32 tsize; /* text size in bytes */ - int32 dsize; /* initialized data */ - int32 bsize; /* uninitialized data */ - int32 mentry; /* entry pt. */ - int32 text_start; /* base of text used for this file */ - int32 data_start; /* base of data used for this file */ - int32 bss_start; /* base of bss used for this file */ - int32 gprmask; /* general purpose register mask */ -union{ - int32 cprmask[4]; /* co-processor register masks */ - int32 pcsize; -}; - int32 gp_value; /* the gp value used for this object */ -}; - -struct mips4kexec -{ - struct mipsexec h; - struct coffsect itexts; - struct coffsect idatas; - struct coffsect ibsss; -}; - -struct sparcexec -{ - short sjunk; /* dynamic bit and version number */ - short smagic; /* 0407 */ - uint32 stext; - uint32 sdata; - uint32 sbss; - uint32 ssyms; - uint32 sentry; - uint32 strsize; - uint32 sdrsize; -}; - -struct nextexec -{ -/* UNUSED - struct nexthdr{ - uint32 nmagic; - uint32 ncputype; - uint32 ncpusubtype; - uint32 nfiletype; - uint32 ncmds; - uint32 nsizeofcmds; - uint32 nflags; - }; - - struct nextcmd{ - uint32 cmd; - uint32 cmdsize; - uchar segname[16]; - uint32 vmaddr; - uint32 vmsize; - uint32 fileoff; - uint32 filesize; - uint32 maxprot; - uint32 initprot; - uint32 nsects; - uint32 flags; - }textc; - struct nextsect{ - char sectname[16]; - char segname[16]; - uint32 addr; - uint32 size; - uint32 offset; - uint32 align; - uint32 reloff; - uint32 nreloc; - uint32 flags; - uint32 reserved1; - uint32 reserved2; - }texts; - struct nextcmd datac; - struct nextsect datas; - struct nextsect bsss; - struct nextsym{ - uint32 cmd; - uint32 cmdsize; - uint32 symoff; - uint32 nsyms; - uint32 spoff; - uint32 pcoff; - }symc; -*/ -}; - -struct i386exec -{ -/* UNUSED - struct i386coff{ - uint32 isectmagic; - uint32 itime; - uint32 isyms; - uint32 insyms; - uint32 iflags; - }; - struct i386hdr{ - uint32 imagic; - uint32 itextsize; - uint32 idatasize; - uint32 ibsssize; - uint32 ientry; - uint32 itextstart; - uint32 idatastart; - }; - struct coffsect itexts; - struct coffsect idatas; - struct coffsect ibsss; - struct coffsect icomments; -*/ -}; diff --git a/include/fmt.h b/include/fmt.h deleted file mode 100644 index 2280f2525..000000000 --- a/include/fmt.h +++ /dev/null @@ -1,116 +0,0 @@ -#ifndef _FMT_H_ -#define _FMT_H_ 1 -#if defined(__cplusplus) -extern "C" { -#endif -/* - * The authors of this software are Rob Pike and Ken Thompson. - * Copyright (c) 2002 by Lucent Technologies. - * Permission to use, copy, modify, and distribute this software for any - * purpose without fee is hereby granted, provided that this entire notice - * is included in all copies of any software which is or includes a copy - * or modification of this software and in all copies of the supporting - * documentation for such software. - * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED - * WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE ANY - * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY - * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. - */ - -#include <stdarg.h> -#include <utf.h> - -typedef struct Fmt Fmt; -struct Fmt{ - unsigned char runes; /* output buffer is runes or chars? */ - void *start; /* of buffer */ - void *to; /* current place in the buffer */ - void *stop; /* end of the buffer; overwritten if flush fails */ - int (*flush)(Fmt *); /* called when to == stop */ - void *farg; /* to make flush a closure */ - int nfmt; /* num chars formatted so far */ - va_list args; /* args passed to dofmt */ - Rune r; /* % format Rune */ - int width; - int prec; - unsigned long flags; - char *decimal; /* decimal point; cannot be "" */ - - /* For %'d */ - char *thousands; /* separator for thousands */ - - /* - * Each char is an integer indicating #digits before next separator. Values: - * \xFF: no more grouping (or \x7F; defined to be CHAR_MAX in POSIX) - * \x00: repeat previous indefinitely - * \x**: count that many - */ - char *grouping; /* descriptor of separator placement */ -}; - -enum{ - FmtWidth = 1, - FmtLeft = FmtWidth << 1, - FmtPrec = FmtLeft << 1, - FmtSharp = FmtPrec << 1, - FmtSpace = FmtSharp << 1, - FmtSign = FmtSpace << 1, - FmtApost = FmtSign << 1, - FmtZero = FmtApost << 1, - FmtUnsigned = FmtZero << 1, - FmtShort = FmtUnsigned << 1, - FmtLong = FmtShort << 1, - FmtVLong = FmtLong << 1, - FmtComma = FmtVLong << 1, - FmtByte = FmtComma << 1, - FmtLDouble = FmtByte << 1, - - FmtFlag = FmtLDouble << 1 -}; - -extern int (*fmtdoquote)(int); - -/* Edit .+1,/^$/ | cfn $PLAN9/src/lib9/fmt/?*.c | grep -v static |grep -v __ */ -int dofmt(Fmt *f, char *fmt); -int dorfmt(Fmt *f, const Rune *fmt); -double fmtcharstod(int(*f)(void*), void *vp); -int fmtfdflush(Fmt *f); -int fmtfdinit(Fmt *f, int fd, char *buf, int size); -int fmtinstall(int c, int (*f)(Fmt*)); -int fmtnullinit(Fmt*); -void fmtlocaleinit(Fmt*, char*, char*, char*); -int fmtprint(Fmt *f, char *fmt, ...); -int fmtrune(Fmt *f, int r); -int fmtrunestrcpy(Fmt *f, Rune *s); -int fmtstrcpy(Fmt *f, char *s); -char* fmtstrflush(Fmt *f); -int fmtstrinit(Fmt *f); -double fmtstrtod(const char *as, char **aas); -int fmtvprint(Fmt *f, char *fmt, va_list args); -int fprint(int fd, char *fmt, ...); -int print(char *fmt, ...); -void quotefmtinstall(void); -int quoterunestrfmt(Fmt *f); -int quotestrfmt(Fmt *f); -Rune* runefmtstrflush(Fmt *f); -int runefmtstrinit(Fmt *f); -Rune* runeseprint(Rune *buf, Rune *e, char *fmt, ...); -Rune* runesmprint(char *fmt, ...); -int runesnprint(Rune *buf, int len, char *fmt, ...); -int runesprint(Rune *buf, char *fmt, ...); -Rune* runevseprint(Rune *buf, Rune *e, char *fmt, va_list args); -Rune* runevsmprint(char *fmt, va_list args); -int runevsnprint(Rune *buf, int len, char *fmt, va_list args); -char* seprint(char *buf, char *e, char *fmt, ...); -char* smprint(char *fmt, ...); -int snprint(char *buf, int len, char *fmt, ...); -int sprint(char *buf, char *fmt, ...); -int vfprint(int fd, char *fmt, va_list args); -char* vseprint(char *buf, char *e, char *fmt, va_list args); -char* vsmprint(char *fmt, va_list args); -int vsnprint(char *buf, int len, char *fmt, va_list args); - -#if defined(__cplusplus) -} -#endif -#endif diff --git a/include/libc.h b/include/libc.h deleted file mode 100644 index a91039dbf..000000000 --- a/include/libc.h +++ /dev/null @@ -1,382 +0,0 @@ -/* -Derived from Inferno include/kern.h and -Plan 9 from User Space include/libc.h - -http://code.google.com/p/inferno-os/source/browse/include/kern.h -http://code.swtch.com/plan9port/src/tip/include/libc.h - - Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved. - Revisions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuova.com). All rights reserved. - Portions Copyright © 2001-2007 Russ Cox. All rights reserved. - Portions Copyright © 2009 The Go Authors. All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -*/ - -/* - * Lib9 is miscellany from the Plan 9 C library that doesn't - * fit into libutf or into libfmt, but is still missing from traditional - * Unix C libraries. - */ -#ifndef _LIBC_H_ -#define _LIBC_H_ 1 -#if defined(__cplusplus) -extern "C" { -#endif - -#include <utf.h> -#include <fmt.h> - -/* - * Begin trimmed down usual libc.h - */ - -#ifndef nil -#define nil ((void*)0) -#endif -#define nelem(x) (sizeof(x)/sizeof((x)[0])) - -#ifndef offsetof -#define offsetof(s, m) (ulong)(&(((s*)0)->m)) -#endif - -extern char* strecpy(char*, char*, char*); -extern int tokenize(char*, char**, int); - -extern double p9cputime(void); -#ifndef NOPLAN9DEFINES -#define cputime p9cputime -#endif -/* - * one-of-a-kind - */ -enum -{ - PNPROC = 1, - PNGROUP = 2 -}; -int isInf(double, int); - -extern int p9atoi(char*); -extern long p9atol(char*); -extern vlong p9atoll(char*); -extern double fmtcharstod(int(*)(void*), void*); -extern char* cleanname(char*); -extern int exitcode(char*); -extern void exits(char*); -extern double frexp(double, int*); -extern char* p9getenv(char*); -extern int p9putenv(char*, char*); -extern int getfields(char*, char**, int, int, char*); -extern int gettokens(char *, char **, int, char *); -extern char* getuser(void); -extern char* p9getwd(char*, int); -extern void p9longjmp(p9jmp_buf, int); -extern char* mktemp(char*); -extern int opentemp(char*); -extern void p9notejmp(void*, p9jmp_buf, int); -extern void perror(const char*); -extern int postnote(int, int, char *); -extern double p9pow10(int); -extern char* searchpath(char*); -#define p9setjmp(b) sigsetjmp((void*)(b), 1) - -extern void sysfatal(char*, ...); - -#ifndef NOPLAN9DEFINES -#define atoi p9atoi -#define atol p9atol -#define atoll p9atoll -#define getenv p9getenv -#define getwd p9getwd -#define longjmp p9longjmp -#undef setjmp -#define setjmp p9setjmp -#define putenv p9putenv -#define notejmp p9notejmp -#define jmp_buf p9jmp_buf -#define pow10 p9pow10 -#define strtod fmtstrtod -#define charstod fmtcharstod -#endif - -/* - * system calls - * - */ -#define STATMAX 65535U /* max length of machine-independent stat structure */ -#define DIRMAX (sizeof(Dir)+STATMAX) /* max length of Dir structure */ -#define ERRMAX 128 /* max length of error string */ - -#define MORDER 0x0003 /* mask for bits defining order of mounting */ -#define MREPL 0x0000 /* mount replaces object */ -#define MBEFORE 0x0001 /* mount goes before others in union directory */ -#define MAFTER 0x0002 /* mount goes after others in union directory */ -#define MCREATE 0x0004 /* permit creation in mounted directory */ -#define MCACHE 0x0010 /* cache some data */ -#define MMASK 0x0017 /* all bits on */ - -#define OREAD 0 /* open for read */ -#define OWRITE 1 /* write */ -#define ORDWR 2 /* read and write */ -#define OEXEC 3 /* execute, == read but check execute permission */ -#define OTRUNC 16 /* or'ed in (except for exec), truncate file first */ -#define ORCLOSE 64 /* or'ed in, remove on close */ -#define ODIRECT 128 /* or'ed in, direct access */ -#define OEXCL 0x1000 /* or'ed in, exclusive use (create only) */ -#define OAPPEND 0x4000 /* or'ed in, append only */ - -#define AEXIST 0 /* accessible: exists */ -#define AEXEC 1 /* execute access */ -#define AWRITE 2 /* write access */ -#define AREAD 4 /* read access */ - -/* Segattch */ -#define SG_RONLY 0040 /* read only */ -#define SG_CEXEC 0100 /* detach on exec */ - -#define NCONT 0 /* continue after note */ -#define NDFLT 1 /* terminate after note */ -#define NSAVE 2 /* clear note but hold state */ -#define NRSTR 3 /* restore saved state */ - -/* bits in Qid.type */ -#define QTDIR 0x80 /* type bit for directories */ -#define QTAPPEND 0x40 /* type bit for append only files */ -#define QTEXCL 0x20 /* type bit for exclusive use files */ -#define QTMOUNT 0x10 /* type bit for mounted channel */ -#define QTAUTH 0x08 /* type bit for authentication file */ -#define QTTMP 0x04 /* type bit for non-backed-up file */ -#define QTSYMLINK 0x02 /* type bit for symbolic link */ -#define QTFILE 0x00 /* type bits for plain file */ - -/* bits in Dir.mode */ -#define DMDIR 0x80000000 /* mode bit for directories */ -#define DMAPPEND 0x40000000 /* mode bit for append only files */ -#define DMEXCL 0x20000000 /* mode bit for exclusive use files */ -#define DMMOUNT 0x10000000 /* mode bit for mounted channel */ -#define DMAUTH 0x08000000 /* mode bit for authentication file */ -#define DMTMP 0x04000000 /* mode bit for non-backed-up file */ -#define DMSYMLINK 0x02000000 /* mode bit for symbolic link (Unix, 9P2000.u) */ -#define DMDEVICE 0x00800000 /* mode bit for device file (Unix, 9P2000.u) */ -#define DMNAMEDPIPE 0x00200000 /* mode bit for named pipe (Unix, 9P2000.u) */ -#define DMSOCKET 0x00100000 /* mode bit for socket (Unix, 9P2000.u) */ -#define DMSETUID 0x00080000 /* mode bit for setuid (Unix, 9P2000.u) */ -#define DMSETGID 0x00040000 /* mode bit for setgid (Unix, 9P2000.u) */ - -#define DMREAD 0x4 /* mode bit for read permission */ -#define DMWRITE 0x2 /* mode bit for write permission */ -#define DMEXEC 0x1 /* mode bit for execute permission */ - -#ifdef RFMEM /* FreeBSD, OpenBSD */ -#undef RFFDG -#undef RFNOTEG -#undef RFPROC -#undef RFMEM -#undef RFNOWAIT -#undef RFCFDG -#undef RFNAMEG -#undef RFENVG -#undef RFCENVG -#undef RFCFDG -#undef RFCNAMEG -#endif - -enum -{ - RFNAMEG = (1<<0), - RFENVG = (1<<1), - RFFDG = (1<<2), - RFNOTEG = (1<<3), - RFPROC = (1<<4), - RFMEM = (1<<5), - RFNOWAIT = (1<<6), - RFCNAMEG = (1<<10), - RFCENVG = (1<<11), - RFCFDG = (1<<12) -/* RFREND = (1<<13), */ -/* RFNOMNT = (1<<14) */ -}; - -typedef -struct Qid -{ - uvlong path; - ulong vers; - uchar type; -} Qid; - -typedef -struct Dir { - /* system-modified data */ - ushort type; /* server type */ - uint dev; /* server subtype */ - /* file data */ - Qid qid; /* unique id from server */ - ulong mode; /* permissions */ - ulong atime; /* last read time */ - ulong mtime; /* last write time */ - vlong length; /* file length */ - char *name; /* last element of path */ - char *uid; /* owner name */ - char *gid; /* group name */ - char *muid; /* last modifier name */ - - /* 9P2000.u extensions */ - uint uidnum; /* numeric uid */ - uint gidnum; /* numeric gid */ - uint muidnum; /* numeric muid */ - char *ext; /* extended info */ -} Dir; - -typedef -struct Waitmsg -{ - int pid; /* of loved one */ - ulong time[3]; /* of loved one & descendants */ - char *msg; -} Waitmsg; - -extern void _exits(char*); - -extern void abort(void); -extern long p9alarm(ulong); -extern int await(char*, int); -extern int awaitfor(int, char*, int); -extern int awaitnohang(char*, int); -extern int p9chdir(char*); -extern int close(int); -extern int p9create(char*, int, ulong); -extern int p9dup(int, int); -extern int errstr(char*, uint); -extern int p9exec(char*, char*[]); -extern int p9execl(char*, ...); -extern int p9rfork(int); -extern int noted(int); -extern int notify(void(*)(void*, char*)); -extern int noteenable(char*); -extern int notedisable(char*); -extern int notifyon(char*); -extern int notifyoff(char*); -extern int p9open(char*, int); -extern int fd2path(int, char*, int); -extern long readn(int, void*, long); -extern int remove(const char*); -extern vlong p9seek(int, vlong, int); -extern int p9sleep(long); -extern Waitmsg* p9wait(void); -extern Waitmsg* p9waitfor(int); -extern Waitmsg* waitnohang(void); -extern int p9waitpid(void); -extern ulong rendezvous(ulong, ulong); - -extern char* getgoos(void); -extern char* getgoarch(void); -extern char* getgoroot(void); -extern char* getgoversion(void); - -#ifdef _WIN32 -struct timespec { - int tv_sec; - long tv_nsec; -}; -extern int nanosleep(const struct timespec *rqtp, struct timespec *rmtp); -extern int fork(void); -extern int pread(int fd, void *buf, int n, int off); -extern int pwrite(int fd, void *buf, int n, int off); -#define execv(prog, argv) execv(prog, (const char* const*)(argv)) -#define execvp(prog, argv) execvp(prog, (const char**)(argv)) -#define lseek(fd, n, base) _lseeki64(fd, n, base) -#define mkdir(path, perm) mkdir(path) -#define pipe(fd) _pipe(fd, 512, O_BINARY) -#else -#define O_BINARY 0 -#endif - -#ifndef NOPLAN9DEFINES -#define alarm p9alarm -#define dup p9dup -#define exec p9exec -#define execl p9execl -#define seek p9seek -#define sleep p9sleep -#define wait p9wait -#define waitpid p9waitpid -#define rfork p9rfork -#define create p9create -#undef open -#define open p9open -#define waitfor p9waitfor -#endif - -extern Dir* dirstat(char*); -extern Dir* dirfstat(int); -extern int dirwstat(char*, Dir*); -extern int dirfwstat(int, Dir*); -extern void nulldir(Dir*); -extern long dirreadall(int, Dir**); -extern void rerrstr(char*, uint); -extern char* sysname(void); -extern void werrstr(char*, ...); -extern char* getns(void); -extern char* get9root(void); -extern char* unsharp(char*); - -/* external names that we don't want to step on */ -#ifndef NOPLAN9DEFINES -#define main p9main -#endif - -/* compiler directives on plan 9 */ -#define SET(x) ((x)=0) -#define USED(x) if(x){}else{} -#ifdef __GNUC__ -# if __GNUC__ >= 3 -# undef USED -# define USED(x) ((void)(x)) -# endif -#endif - -/* command line */ -extern char *argv0; -extern void __fixargv0(void); -#define ARGBEGIN for((argv0?0:(argv0=(__fixargv0(),*argv))),argv++,argc--;\ - argv[0] && argv[0][0]=='-' && argv[0][1];\ - argc--, argv++) {\ - char *_args, *_argt;\ - Rune _argc;\ - _args = &argv[0][1];\ - if(_args[0]=='-' && _args[1]==0){\ - argc--; argv++; break;\ - }\ - _argc = 0;\ - while(*_args && (_args += chartorune(&_argc, _args)))\ - switch(_argc) -#define ARGEND SET(_argt);USED(_argt);USED(_argc);USED(_args);}USED(argv);USED(argc); -#define ARGF() (_argt=_args, _args="",\ - (*_argt? _argt: argv[1]? (argc--, *++argv): 0)) -#define EARGF(x) (_argt=_args, _args="",\ - (*_argt? _argt: argv[1]? (argc--, *++argv): ((x), abort(), (char*)0))) - -#define ARGC() _argc - -#if defined(__cplusplus) -} -#endif -#endif /* _LIB9_H_ */ diff --git a/include/mach.h b/include/mach.h deleted file mode 100644 index 5b1ce7b3a..000000000 --- a/include/mach.h +++ /dev/null @@ -1,410 +0,0 @@ -// Inferno libmach/a.out.h and libmach/mach.h -// http://code.google.com/p/inferno-os/source/browse/utils/libmach/a.out.h -// http://code.google.com/p/inferno-os/source/browse/utils/libmach/mach.h -// -// Copyright © 1994-1999 Lucent Technologies Inc. -// Power PC support Copyright © 1995-2004 C H Forsyth (forsyth@terzarima.net). -// Portions Copyright © 1997-1999 Vita Nuova Limited. -// Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuova.com). -// Revisions Copyright © 2000-2004 Lucent Technologies Inc. and others. -// Portions Copyright © 2009 The Go Authors. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -/* - * Architecture-dependent application data - */ - -typedef struct Exec Exec; -struct Exec -{ - int32 magic; /* magic number */ - int32 text; /* size of text segment */ - int32 data; /* size of initialized data */ - int32 bss; /* size of uninitialized data */ - int32 syms; /* size of symbol table */ - int32 entry; /* entry point */ - int32 spsz; /* size of pc/sp offset table */ - int32 pcsz; /* size of pc/line number table */ -}; - -#define HDR_MAGIC 0x00008000 /* header expansion */ - -#define _MAGIC(f, b) ((f)|((((4*(b))+0)*(b))+7)) -#define A_MAGIC _MAGIC(0, 8) /* 68020 */ -#define I_MAGIC _MAGIC(0, 11) /* intel 386 */ -#define J_MAGIC _MAGIC(0, 12) /* intel 960 (retired) */ -#define K_MAGIC _MAGIC(0, 13) /* sparc */ -#define V_MAGIC _MAGIC(0, 16) /* mips 3000 BE */ -#define X_MAGIC _MAGIC(0, 17) /* att dsp 3210 (retired) */ -#define M_MAGIC _MAGIC(0, 18) /* mips 4000 BE */ -#define D_MAGIC _MAGIC(0, 19) /* amd 29000 (retired) */ -#define E_MAGIC _MAGIC(0, 20) /* arm */ -#define Q_MAGIC _MAGIC(0, 21) /* powerpc */ -#define N_MAGIC _MAGIC(0, 22) /* mips 4000 LE */ -#define L_MAGIC _MAGIC(0, 23) /* dec alpha */ -#define P_MAGIC _MAGIC(0, 24) /* mips 3000 LE */ -#define U_MAGIC _MAGIC(0, 25) /* sparc64 */ -#define S_MAGIC _MAGIC(HDR_MAGIC, 26) /* amd64 */ -#define T_MAGIC _MAGIC(HDR_MAGIC, 27) /* powerpc64 */ - -#define MIN_MAGIC 8 -#define MAX_MAGIC 27 /* <= 90 */ - -#define DYN_MAGIC 0x80000000 /* dlm */ - -typedef struct Sym Sym; -struct Sym -{ - vlong value; - uint sig; - char type; - char *name; - vlong gotype; - int sequence; // order in file -}; - - -/* - * Supported architectures: - * mips, - * 68020, - * i386, - * amd64, - * sparc, - * sparc64, - * mips2 (R4000) - * arm - * powerpc, - * powerpc64 - * alpha - */ -enum -{ - MMIPS, /* machine types */ - MSPARC, - M68020, - MI386, - MI960, /* retired */ - M3210, /* retired */ - MMIPS2, - NMIPS2, - M29000, /* retired */ - MARM, - MPOWER, - MALPHA, - NMIPS, - MSPARC64, - MAMD64, - MPOWER64, - /* types of executables */ - FNONE = 0, /* unidentified */ - FMIPS, /* v.out */ - FMIPSB, /* mips bootable */ - FSPARC, /* k.out */ - FSPARCB, /* Sparc bootable */ - F68020, /* 2.out */ - F68020B, /* 68020 bootable */ - FNEXTB, /* Next bootable */ - FI386, /* 8.out */ - FI386B, /* I386 bootable */ - FI960, /* retired */ - FI960B, /* retired */ - F3210, /* retired */ - FMIPS2BE, /* 4.out */ - F29000, /* retired */ - FARM, /* 5.out */ - FARMB, /* ARM bootable */ - FPOWER, /* q.out */ - FPOWERB, /* power pc bootable */ - FMIPS2LE, /* 0.out */ - FALPHA, /* 7.out */ - FALPHAB, /* DEC Alpha bootable */ - FMIPSLE, /* 3k little endian */ - FSPARC64, /* u.out */ - FAMD64, /* 6.out */ - FAMD64B, /* 6.out bootable */ - FPOWER64, /* 9.out */ - FPOWER64B, /* 9.out bootable */ - - ANONE = 0, /* dissembler types */ - AMIPS, - AMIPSCO, /* native mips */ - ASPARC, - ASUNSPARC, /* native sun */ - A68020, - AI386, - AI8086, /* oh god */ - AI960, /* retired */ - A29000, /* retired */ - AARM, - APOWER, - AALPHA, - ASPARC64, - AAMD64, - APOWER64, - /* object file types */ - Obj68020 = 0, /* .2 */ - ObjSparc, /* .k */ - ObjMips, /* .v */ - Obj386, /* .8 */ - Obj960, /* retired */ - Obj3210, /* retired */ - ObjMips2, /* .4 */ - Obj29000, /* retired */ - ObjArm, /* .5 */ - ObjPower, /* .q */ - ObjMips2le, /* .0 */ - ObjAlpha, /* .7 */ - ObjSparc64, /* .u */ - ObjAmd64, /* .6 */ - ObjSpim, /* .0 */ - ObjPower64, /* .9 */ - Maxobjtype, - - CNONE = 0, /* symbol table classes */ - CAUTO, - CPARAM, - CSTAB, - CTEXT, - CDATA, - CANY, /* to look for any class */ -}; - -typedef struct Map Map; -typedef struct Symbol Symbol; -typedef struct Reglist Reglist; -typedef struct Mach Mach; -typedef struct Machdata Machdata; -typedef struct Seg Seg; - -typedef int Maprw(Map *m, Seg *s, uvlong addr, void *v, uint n, int isread); - -struct Seg { - char *name; /* the segment name */ - int fd; /* file descriptor */ - int inuse; /* in use - not in use */ - int cache; /* should cache reads? */ - uvlong b; /* base */ - uvlong e; /* end */ - vlong f; /* offset within file */ - Maprw *rw; /* read/write fn for seg */ -}; - -/* - * Structure to map a segment to data - */ -struct Map { - int pid; - int tid; - int nsegs; /* number of segments */ - Seg seg[1]; /* actually n of these */ -}; - -/* - * Internal structure describing a symbol table entry - */ -struct Symbol { - void *handle; /* used internally - owning func */ - struct { - char *name; - vlong value; /* address or stack offset */ - char type; /* as in a.out.h */ - char class; /* as above */ - int index; /* in findlocal, globalsym, textsym */ - }; -}; - -/* - * machine register description - */ -struct Reglist { - char *rname; /* register name */ - short roffs; /* offset in u-block */ - char rflags; /* INTEGER/FLOAT, WRITABLE */ - char rformat; /* print format: 'x', 'X', 'f', '8', '3', 'Y', 'W' */ -}; - -enum { /* bits in rflags field */ - RINT = (0<<0), - RFLT = (1<<0), - RRDONLY = (1<<1), -}; - -/* - * Machine-dependent data is stored in two structures: - * Mach - miscellaneous general parameters - * Machdata - jump vector of service functions used by debuggers - * - * Mach is defined in ?.c and set in executable.c - * - * Machdata is defined in ?db.c - * and set in the debugger startup. - */ -struct Mach{ - char *name; - int mtype; /* machine type code */ - Reglist *reglist; /* register set */ - int32 regsize; /* sizeof registers in bytes */ - int32 fpregsize; /* sizeof fp registers in bytes */ - char *pc; /* pc name */ - char *sp; /* sp name */ - char *link; /* link register name */ - char *sbreg; /* static base register name */ - uvlong sb; /* static base register value */ - int pgsize; /* page size */ - uvlong kbase; /* kernel base address */ - uvlong ktmask; /* ktzero = kbase & ~ktmask */ - uvlong utop; /* user stack top */ - int pcquant; /* quantization of pc */ - int szaddr; /* sizeof(void*) */ - int szreg; /* sizeof(register) */ - int szfloat; /* sizeof(float) */ - int szdouble; /* sizeof(double) */ -}; - -extern Mach *mach; /* Current machine */ - -typedef uvlong (*Rgetter)(Map*, char*); -typedef void (*Tracer)(Map*, uvlong, uvlong, Symbol*); - -struct Machdata { /* Machine-dependent debugger support */ - uchar bpinst[4]; /* break point instr. */ - short bpsize; /* size of break point instr. */ - - ushort (*swab)(ushort); /* ushort to local byte order */ - uint32 (*swal)(uint32); /* uint32 to local byte order */ - uvlong (*swav)(uvlong); /* uvlong to local byte order */ - int (*ctrace)(Map*, uvlong, uvlong, uvlong, Tracer); /* C traceback */ - uvlong (*findframe)(Map*, uvlong, uvlong, uvlong, uvlong);/* frame finder */ - char* (*excep)(Map*, Rgetter); /* last exception */ - uint32 (*bpfix)(uvlong); /* breakpoint fixup */ - int (*sftos)(char*, int, void*); /* single precision float */ - int (*dftos)(char*, int, void*); /* double precision float */ - int (*foll)(Map*, uvlong, Rgetter, uvlong*);/* follow set */ - int (*das)(Map*, uvlong, char, char*, int); /* symbolic disassembly */ - int (*hexinst)(Map*, uvlong, char*, int); /* hex disassembly */ - int (*instsize)(Map*, uvlong); /* instruction size */ -}; - -/* - * Common a.out header describing all architectures - */ -typedef struct Fhdr -{ - char *name; /* identifier of executable */ - uchar type; /* file type - see codes above */ - uchar hdrsz; /* header size */ - uchar _magic; /* _MAGIC() magic */ - uchar spare; - int32 magic; /* magic number */ - uvlong txtaddr; /* text address */ - vlong txtoff; /* start of text in file */ - uvlong dataddr; /* start of data segment */ - vlong datoff; /* offset to data seg in file */ - vlong symoff; /* offset of symbol table in file */ - uvlong entry; /* entry point */ - vlong sppcoff; /* offset of sp-pc table in file */ - vlong lnpcoff; /* offset of line number-pc table in file */ - int32 txtsz; /* text size */ - int32 datsz; /* size of data seg */ - int32 bsssz; /* size of bss */ - int32 symsz; /* size of symbol table */ - int32 sppcsz; /* size of sp-pc table */ - int32 lnpcsz; /* size of line number-pc table */ -} Fhdr; - -extern int asstype; /* dissembler type - machdata.c */ -extern Machdata *machdata; /* jump vector - machdata.c */ - -int beieee80ftos(char*, int, void*); -int beieeesftos(char*, int, void*); -int beieeedftos(char*, int, void*); -ushort beswab(ushort); -uint32 beswal(uint32); -uvlong beswav(uvlong); -uvlong ciscframe(Map*, uvlong, uvlong, uvlong, uvlong); -int cisctrace(Map*, uvlong, uvlong, uvlong, Tracer); -int crackhdr(int fd, Fhdr*); -uvlong file2pc(char*, int32); -int fileelem(Sym**, uchar *, char*, int); -int32 fileline(char*, int, uvlong); -int filesym(int, char*, int); -int findlocal(Symbol*, char*, Symbol*); -int findseg(Map*, char*); -int findsym(uvlong, int, Symbol *); -int fnbound(uvlong, uvlong*); -int fpformat(Map*, Reglist*, char*, int, int); -int get1(Map*, uvlong, uchar*, int); -int get2(Map*, uvlong, ushort*); -int get4(Map*, uvlong, uint32*); -int get8(Map*, uvlong, uvlong*); -int geta(Map*, uvlong, uvlong*); -int getauto(Symbol*, int, int, Symbol*); -Sym* getsym(int); -int globalsym(Symbol *, int); -char* _hexify(char*, uint32, int); -int ieeesftos(char*, int, uint32); -int ieeedftos(char*, int, uint32, uint32); -int isar(Biobuf*); -int leieee80ftos(char*, int, void*); -int leieeesftos(char*, int, void*); -int leieeedftos(char*, int, void*); -ushort leswab(ushort); -uint32 leswal(uint32); -uvlong leswav(uvlong); -uvlong line2addr(int32, uvlong, uvlong); -Map* loadmap(Map*, int, Fhdr*); -int localaddr(Map*, char*, char*, uvlong*, Rgetter); -int localsym(Symbol*, int); -int lookup(char*, char*, Symbol*); -void machbytype(int); -int machbyname(char*); -int nextar(Biobuf*, int, char*); -Map* newmap(Map*, int); -void objtraverse(void(*)(Sym*, void*), void*); -int objtype(Biobuf*, char**); -uvlong pc2sp(uvlong); -int32 pc2line(uvlong); -int put1(Map*, uvlong, uchar*, int); -int put2(Map*, uvlong, ushort); -int put4(Map*, uvlong, uint32); -int put8(Map*, uvlong, uvlong); -int puta(Map*, uvlong, uvlong); -int readar(Biobuf*, int, vlong, int); -int readobj(Biobuf*, int); -uvlong riscframe(Map*, uvlong, uvlong, uvlong, uvlong); -int risctrace(Map*, uvlong, uvlong, uvlong, Tracer); -int setmap(Map*, int, uvlong, uvlong, vlong, char*, Maprw *rw); -Sym* symbase(int32*); -int syminit(int, Fhdr*); -int symoff(char*, int, uvlong, int); -void textseg(uvlong, Fhdr*); -int textsym(Symbol*, int); -void unusemap(Map*, int); - -Map* attachproc(int pid, Fhdr *fp); -int ctlproc(int pid, char *msg); -void detachproc(Map *m); -int procnotes(int pid, char ***pnotes); -char* proctextfile(int pid); -int procthreadpids(int pid, int *tid, int ntid); -char* procstatus(int); - -Maprw fdrw; diff --git a/include/u.h b/include/u.h deleted file mode 100644 index 9ee7493b4..000000000 --- a/include/u.h +++ /dev/null @@ -1,228 +0,0 @@ -/* -Plan 9 from User Space include/u.h -http://code.swtch.com/plan9port/src/tip/include/u.h - -Copyright 2001-2007 Russ Cox. All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -*/ - -#ifndef _U_H_ -#define _U_H_ 1 -#if defined(__cplusplus) -extern "C" { -#endif - -#define __BSD_VISIBLE 1 /* FreeBSD 5.x */ -#if defined(__sun__) -# define __EXTENSIONS__ 1 /* SunOS */ -# if defined(__SunOS5_6__) || defined(__SunOS5_7__) || defined(__SunOS5_8__) - /* NOT USING #define __MAKECONTEXT_V2_SOURCE 1 / * SunOS */ -# else -# define __MAKECONTEXT_V2_SOURCE 1 -# endif -#endif -#define _BSD_SOURCE 1 -#define _NETBSD_SOURCE 1 /* NetBSD */ -#define _SVID_SOURCE 1 -#if !defined(__APPLE__) && !defined(__OpenBSD__) -# define _XOPEN_SOURCE 1000 -# define _XOPEN_SOURCE_EXTENDED 1 -#endif -#if defined(__FreeBSD__) -# include <sys/cdefs.h> - /* for strtoll */ -# undef __ISO_C_VISIBLE -# define __ISO_C_VISIBLE 1999 -# undef __LONG_LONG_SUPPORTED -# define __LONG_LONG_SUPPORTED -#endif -#define _LARGEFILE64_SOURCE 1 -#define _FILE_OFFSET_BITS 64 - -#include <inttypes.h> - -#include <unistd.h> -#include <string.h> -#include <stdlib.h> -#include <stdarg.h> -#include <fcntl.h> -#include <assert.h> -#include <setjmp.h> -#include <stddef.h> -#include <math.h> -#include <ctype.h> /* for tolower */ -#include <signal.h> -#include <time.h> - -/* - * OS-specific crap - */ -#define _NEEDUCHAR 1 -#define _NEEDUSHORT 1 -#define _NEEDUINT 1 -#define _NEEDULONG 1 - -#ifdef _WIN32 -typedef jmp_buf sigjmp_buf; -#endif -typedef long p9jmp_buf[sizeof(sigjmp_buf)/sizeof(long)]; - -#if defined(__linux__) -# include <sys/types.h> -# if defined(__Linux26__) -# include <pthread.h> -# define PLAN9PORT_USING_PTHREADS 1 -# endif -# if defined(__USE_MISC) -# undef _NEEDUSHORT -# undef _NEEDUINT -# undef _NEEDULONG -# endif -#elif defined(__sun__) -# include <sys/types.h> -# include <pthread.h> -# define PLAN9PORT_USING_PTHREADS 1 -# undef _NEEDUSHORT -# undef _NEEDUINT -# undef _NEEDULONG -# define nil 0 /* no cast to void* */ -#elif defined(__FreeBSD__) -# include <sys/types.h> -# include <osreldate.h> -# if __FreeBSD_version >= 500000 -# define PLAN9PORT_USING_PTHREADS 1 -# include <pthread.h> -# endif -# if !defined(_POSIX_SOURCE) -# undef _NEEDUSHORT -# undef _NEEDUINT -# endif -#elif defined(__APPLE__) -# include <sys/types.h> -# include <pthread.h> -# define PLAN9PORT_USING_PTHREADS 1 -# if __GNUC__ < 4 -# undef _NEEDUSHORT -# undef _NEEDUINT -# endif -# undef _ANSI_SOURCE -# undef _POSIX_C_SOURCE -# undef _XOPEN_SOURCE -# if !defined(NSIG) -# define NSIG 32 -# endif -# define _NEEDLL 1 -#elif defined(__NetBSD__) -# include <sched.h> -# include <sys/types.h> -# undef _NEEDUSHORT -# undef _NEEDUINT -# undef _NEEDULONG -#elif defined(__OpenBSD__) -# include <sys/types.h> -# undef _NEEDUSHORT -# undef _NEEDUINT -# undef _NEEDULONG -#elif defined(_WIN32) -#else - /* No idea what system this is -- try some defaults */ -# include <pthread.h> -# define PLAN9PORT_USING_PTHREADS 1 -#endif - -#ifndef O_DIRECT -#define O_DIRECT 0 -#endif - -typedef signed char schar; - -#ifdef _NEEDUCHAR - typedef unsigned char uchar; -#endif -#ifdef _NEEDUSHORT - typedef unsigned short ushort; -#endif -#ifdef _NEEDUINT - typedef unsigned int uint; -#endif -#ifdef _NEEDULONG - typedef unsigned long ulong; -#endif -typedef unsigned long long uvlong; -typedef long long vlong; - -typedef uint64_t u64int; -typedef int64_t s64int; -typedef uint8_t u8int; -typedef int8_t s8int; -typedef uint16_t u16int; -typedef int16_t s16int; -typedef uintptr_t uintptr; -typedef intptr_t intptr; -typedef uint32_t u32int; -typedef int32_t s32int; - -typedef s8int int8; -typedef u8int uint8; -typedef s16int int16; -typedef u16int uint16; -typedef s32int int32; -typedef u32int uint32; -typedef s64int int64; -typedef u64int uint64; - - -#undef _NEEDUCHAR -#undef _NEEDUSHORT -#undef _NEEDUINT -#undef _NEEDULONG - -#ifndef SIGBUS -#define SIGBUS SIGSEGV /* close enough */ -#endif - -/* - * Funny-named symbols to tip off 9l to autolink. - */ -#define AUTOLIB(x) static int __p9l_autolib_ ## x = 1; -#define AUTOFRAMEWORK(x) static int __p9l_autoframework_ ## x = 1; - -/* - * Gcc is too smart for its own good. - */ -#if defined(__GNUC__) -# undef strcmp /* causes way too many warnings */ -# if __GNUC__ >= 4 || (__GNUC__==3 && !defined(__APPLE_CC__) && !defined(_WIN32)) -# undef AUTOLIB -# define AUTOLIB(x) int __p9l_autolib_ ## x __attribute__ ((weak)); -# undef AUTOFRAMEWORK -# define AUTOFRAMEWORK(x) int __p9l_autoframework_ ## x __attribute__ ((weak)); -# else -# undef AUTOLIB -# define AUTOLIB(x) static int __p9l_autolib_ ## x __attribute__ ((unused)); -# undef AUTOFRAMEWORK -# define AUTOFRAMEWORK(x) static int __p9l_autoframework_ ## x __attribute__ ((unused)); -# endif -#endif - -#if defined(__cplusplus) -} -#endif -#endif diff --git a/include/ureg_amd64.h b/include/ureg_amd64.h deleted file mode 100644 index 2c39f17ce..000000000 --- a/include/ureg_amd64.h +++ /dev/null @@ -1,58 +0,0 @@ -// Inferno utils/libmach/ureg6.h -// http://code.google.com/p/inferno-os/source/browse/utils/libmach/ureg6.h -// -// Copyright © 1994-1999 Lucent Technologies Inc. -// Power PC support Copyright © 1995-2004 C H Forsyth (forsyth@terzarima.net). -// Portions Copyright © 1997-1999 Vita Nuova Limited. -// Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuova.com). -// Revisions Copyright © 2000-2004 Lucent Technologies Inc. and others. -// Portions Copyright © 2009 The Go Authors. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -struct Ureg { - u64int ax; - u64int bx; - u64int cx; - u64int dx; - u64int si; - u64int di; - u64int bp; - u64int r8; - u64int r9; - u64int r10; - u64int r11; - u64int r12; - u64int r13; - u64int r14; - u64int r15; - - u16int ds; - u16int es; - u16int fs; - u16int gs; - - u64int type; - u64int error; /* error code (or zero) */ - u64int ip; /* pc */ - u64int cs; /* old context */ - u64int flags; /* old flags */ - u64int sp; /* sp */ - u64int ss; /* old stack segment */ -}; diff --git a/include/ureg_arm.h b/include/ureg_arm.h deleted file mode 100644 index c740b0302..000000000 --- a/include/ureg_arm.h +++ /dev/null @@ -1,49 +0,0 @@ -// Inferno utils/libmach/ureg5.h -// http://code.google.com/p/inferno-os/source/browse/utils/libmach/ureg5.h -// -// Copyright © 1994-1999 Lucent Technologies Inc. -// Power PC support Copyright © 1995-2004 C H Forsyth (forsyth@terzarima.net). -// Portions Copyright © 1997-1999 Vita Nuova Limited. -// Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuova.com). -// Revisions Copyright © 2000-2004 Lucent Technologies Inc. and others. -// Portions Copyright © 2009 The Go Authors. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -struct Ureg { - uint r0; - uint r1; - uint r2; - uint r3; - uint r4; - uint r5; - uint r6; - uint r7; - uint r8; - uint r9; - uint r10; - uint r11; - uint r12; - uint r13; - uint r14; - uint link; - uint type; - uint psr; - uint pc; -}; diff --git a/include/ureg_x86.h b/include/ureg_x86.h deleted file mode 100644 index c20fe4e4c..000000000 --- a/include/ureg_x86.h +++ /dev/null @@ -1,53 +0,0 @@ -// Inferno utils/libmach/ureg8.h -// http://code.google.com/p/inferno-os/source/browse/utils/libmach/ureg8.h -// -// Copyright © 1994-1999 Lucent Technologies Inc. -// Power PC support Copyright © 1995-2004 C H Forsyth (forsyth@terzarima.net). -// Portions Copyright © 1997-1999 Vita Nuova Limited. -// Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuova.com). -// Revisions Copyright © 2000-2004 Lucent Technologies Inc. and others. -// Portions Copyright © 2009 The Go Authors. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -struct Ureg -{ - uint32 di; /* general registers */ - uint32 si; /* ... */ - uint32 bp; /* ... */ - uint32 nsp; - uint32 bx; /* ... */ - uint32 dx; /* ... */ - uint32 cx; /* ... */ - uint32 ax; /* ... */ - uint32 gs; /* data segments */ - uint32 fs; /* ... */ - uint32 es; /* ... */ - uint32 ds; /* ... */ - uint32 trap; /* trap type */ - uint32 ecode; /* error code (or zero) */ - uint32 pc; /* pc */ - uint32 cs; /* old context */ - uint32 flags; /* old flags */ - union { - uint32 usp; - uint32 sp; - }; - uint32 ss; /* old stack segment */ -}; diff --git a/include/utf.h b/include/utf.h deleted file mode 100644 index be1c46e7f..000000000 --- a/include/utf.h +++ /dev/null @@ -1 +0,0 @@ -#include "../src/lib9/utf/utf.h" |