diff --git a/.cproject b/.cproject index c611a22..0c0add5 100644 --- a/.cproject +++ b/.cproject @@ -5,6 +5,7 @@ + @@ -15,59 +16,60 @@ - - - - - + + + + + + + - - - - - - - + + + + + + - - - - - - + @@ -84,6 +86,9 @@ + + + @@ -98,8 +103,11 @@ - - - + + + + + + diff --git a/include/fs/ubixfs/ubixfs.h b/include/fs/ubixfs/ubixfs.h index 877c9cb..cab2be5 100644 --- a/include/fs/ubixfs/ubixfs.h +++ b/include/fs/ubixfs/ubixfs.h @@ -30,10 +30,10 @@ #define _UBIXFS_UBIXFS_H #include -#include +#include #include #include -#include +#include #define UBIXFS_BLOCKSIZE_BYTES blockSize*512 #define UBIXFS_ALIGN(size) (size + ((((size) % (UBIXFS_BLOCKSIZE_BYTES)) == 0)? 0 : ((UBIXFS_BLOCKSIZE_BYTES) - ((size) % (UBIXFS_BLOCKSIZE_BYTES))))) diff --git a/include/fs/ufs/ffs.h b/include/fs/ufs/ffs.h index 77463f6..d8996f1 100644 --- a/include/fs/ufs/ffs.h +++ b/include/fs/ufs/ffs.h @@ -31,7 +31,7 @@ #define _FFS_H #include -#include +#include #include int ffs_read(fileDescriptor_t *,char *,uint32_t,long); diff --git a/include/isa/8259.h b/include/isa/8259.h new file mode 100644 index 0000000..df36487 --- /dev/null +++ b/include/isa/8259.h @@ -0,0 +1,74 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ISA_8259_H +#define _ISA_8259_H + +#include + +#define mPic 0x20 // I/O for master PIC +#define mImr 0x21 // I/O for master IMR +#define sPic 0xA0 // I/O for slave PIC +#define sImr 0xA1 // I/O for slace IMR +#define eoi 0x20 // EOI command +#define icw1 0x11 // Cascade, Edge triggered +#define icw4 0x01 // 8088 mode +#define mVec 0x68 // Vector for master +#define sVec 0x70 // Vector for slave +#define ocw3Irr 0x0A // Read IRR +#define ocw3Isr 0x0B // Read ISR + +int i8259_init(); +void irqEnable(uInt16 irqNo); +void irqDisable(uInt16 irqNo); + +#endif + +/*** + $Log: 8259.h,v $ + Revision 1.1.1.1 2006/06/01 12:46:14 reddawg + ubix2 + + Revision 1.2 2005/10/12 00:13:36 reddawg + Removed + + Revision 1.1.1.1 2005/09/26 17:23:39 reddawg + no message + + Revision 1.4 2004/07/09 13:20:08 reddawg + Oh yeah duh you can not name functions with numbers + + Revision 1.3 2004/07/09 13:14:29 reddawg + 8259: changed init8259 to 8259_init + Adjusted Startup Routines + + Revision 1.2 2004/05/21 14:57:16 reddawg + Cleaned up + + END + ***/ diff --git a/include/isa/atkbd.h b/include/isa/atkbd.h new file mode 100644 index 0000000..c1e41d9 --- /dev/null +++ b/include/isa/atkbd.h @@ -0,0 +1,46 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ISA_ATKBD_H +#define _ISA_ATKBD_H + +#define shiftKey 1 +#define controlKey 2 +#define altKey 4 +#define ledNumlock 2 +#define ledScrolllock 1 +#define ledCapslock 4 + +int atkbd_init(); +void atkbd_isr(); + +void keyboardHandler(); +void setLED(); + + +#endif /* END _ISA_ATKBD_H */ diff --git a/include/isa/fdc.h b/include/isa/fdc.h new file mode 100644 index 0000000..fcc33b8 --- /dev/null +++ b/include/isa/fdc.h @@ -0,0 +1,108 @@ +/***************************************************************************************** + Copyright (c) 2002-2004 The UbixOS Project + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, are + permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this list of + conditions, the following disclaimer and the list of authors. Redistributions in binary + form must reproduce the above copyright notice, this list of conditions, the following + disclaimer and the list of authors in the documentation and/or other materials provided + with the distribution. Neither the name of the UbixOS Project nor the names of its + contributors may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + $Id: fdc.h 79 2016-01-11 16:21:27Z reddawg $ + +*****************************************************************************************/ + +#ifndef _FDC_H +#define _FDC_H + +#include + +typedef struct DrvGeom { + Int8 heads; + Int8 tracks; + Int8 spt; +} drvGeom; + + +#define fdcMsr (0x3f4) +#define fdcData (0x3f5) +#define fdcDir (0x3f7) +#define fdcCcr (0x3f7) +#define fdcDor (0x3f2) +#define fdcDrs (0x3f4) + +#define cmdWrite (0xc5) +#define cmdRead (0xe6) +#define cmdSeek (0x0f) +#define cmdSensei (0x08) +#define cmdRecal (0x07) +#define cmdSpecify (0x03) + +#define dg144Heads 2 /* heads per drive (1.44M) */ +#define dg144Tracks 80 +#define dg144Spt 18 +#define dg144Gap3rw 0x1b +#define dg168Gap3rw 0x1c + + + +int fdc_init(); +void floppyIsr(); +void floppyIsrhndlr(); +void sendByte(int Int8); +int getByte(); +bool fdcRw(int block,unsigned char *blockBuffer,bool read,unsigned long numSectors); +void block2Hts(int block,int *head,int *track,int *sector); +void motorOn(void); +void motorOff(void); +bool seek(int track); +bool waitFdc(bool sensei); +int getByte(); +void sendByte(int Int8); +void recalibrate(void); +void reset(void); +bool writeBlock(int block,Int8 *blockBuffer, unsigned long numSectors); +bool readBlock(int block,Int8 *blockBuffer, unsigned long numSectors); +void fdcWrite(void *info,void *,uInt32 startSector,uInt32 sectorCount); +void fdcRead(void *info,void *,uInt32 startSector,uInt32 sectorCount); + +#endif + +/*** + $Log: fdc.h,v $ + Revision 1.1.1.1 2006/06/01 12:46:14 reddawg + ubix2 + + Revision 1.2 2005/10/12 00:13:36 reddawg + Removed + + Revision 1.1.1.1 2005/09/26 17:23:39 reddawg + no message + + Revision 1.6 2004/07/17 02:38:31 reddawg + Fixed a few problems + + Revision 1.5 2004/07/14 12:42:46 reddawg + fdc: fdcInit to fdc_init + Changed Startup Routines + + Revision 1.4 2004/05/21 14:57:16 reddawg + Cleaned up + + END + ***/ diff --git a/include/isa/mouse.h b/include/isa/mouse.h new file mode 100644 index 0000000..240f253 --- /dev/null +++ b/include/isa/mouse.h @@ -0,0 +1,53 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ISA_MOUSE_H +#define _ISA_MOUSE_H + +int mouseInit(); +void mouseISR(); +void mouseHandler(); + +#endif + +/*** + $Log: mouse.h,v $ + Revision 1.1.1.1 2006/06/01 12:46:14 reddawg + ubix2 + + Revision 1.2 2005/10/12 00:13:36 reddawg + Removed + + Revision 1.1.1.1 2005/09/26 17:23:39 reddawg + no message + + Revision 1.1 2004/06/04 10:20:53 reddawg + mouse drive: fixed a few bugs works a bit better now + + END + ***/ diff --git a/include/isa/ne2k.h b/include/isa/ne2k.h new file mode 100644 index 0000000..e908f9c --- /dev/null +++ b/include/isa/ne2k.h @@ -0,0 +1,190 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ISA_NE2K_H +#define _ISA_NE2K_H + +#include +#include + +#define ether_addr ether_addr_t +typedef struct dp_rcvhdr +{ + uInt8 dr_status; /* Copy of rsr */ + uInt8 dr_next; /* Pointer to next packet */ + uInt8 dr_rbcl; /* Receive Byte Count Low */ + uInt8 dr_rbch; /* Receive Byte Count High */ +} dp_rcvhdr_t; + +typedef union etheraddr { + unsigned char bytes[6]; /* byteorder safe initialization */ + unsigned short shorts[3]; /* force 2-byte alignment */ +} ether_addr; + + +#define RSR_FO 0x08 +#define RSR_PRX 0x01 +#define DEF_ENABLED 0x200 + +#define OK 0 + + +#define startPage 0x4C +#define stopPage 0x80 + + +#define NE_CMD 0x00 +#define NE_PSTART 0x01 +#define NE_PSTOP 0x02 +#define NE_BNRY 0x03 +#define NE_TPSR 0x04 +#define NE_ISR 0x07 +#define NE_CURRENT 0x07 +#define NE_RBCR0 0x0A +#define NE_RBCR1 0x0B +#define NE_RCR 0x0C +#define NE_TCR 0x0D +#define NE_DCR 0x0E +#define NE_IMR 0x0F + + +#define NE_DCR_WTS 0x01 +#define NE_DCR_LS 0x08 +#define NE_DCR_AR 0x10 +#define NE_DCR_FT1 0x40 +#define NE_DCR_FT0 0x20 + + + +#define E8390_STOP 0x01 +#define E8390_NODMA 0x20 +#define E8390_PAGE0 0x00 +#define E8390_PAGE1 0x40 +#define E8390_CMD 0x00 +#define E8390_START 0x02 +#define E8390_RREAD 0x08 +#define E8390_RWRITE 0x10 +#define E8390_RXOFF 0x20 +#define E8390_TXOFF 0x00 +#define E8390_RXCONFIG 0x04 +#define E8390_TXCONFIG 0x00 + +#define EN0_COUNTER0 0x0d +#define EN0_DCFG 0x0e +#define EN0_RCNTLO 0x0a +#define EN0_RCNTHI 0x0b +#define EN0_ISR 0x07 +#define EN0_IMR 0x0f +#define EN0_RSARLO 0x08 +#define EN0_RSARHI 0x09 +#define EN0_TPSR 0x04 +#define EN0_RXCR 0x0c +#define EN0_TXCR 0x0D +#define EN0_STARTPG 0x01 +#define EN0_STOPPG 0x02 +#define EN0_BOUNDARY 0x03 + +#define EN1_PHYS 0x01 +#define EN1_CURPAG 0x07 +#define EN1_MULT 0x08 + +#define NE1SM_START_PG 0x20 +#define NE1SM_STOP_PG 0x40 +#define NESM_START_PG 0x40 +#define NESM_STOP_PG 0x80 + +#define ENISR_ALL 0x3f + +#define ENDCFG_WTS 0x01 + +#define NE_DATAPORT 0x10 + +#define TX_2X_PAGES 12 +#define TX_1X_PAGES 6 +#define TX_PAGES (dev->priv->pingPong ? TX_2X_PAGES : TX_1X_PAGES) + + +#define DP_CURR 0x7 /* Current Page Register */ +#define DP_MAR0 0x8 /* Multicast Address Register 0 */ +#define DP_MAR1 0x9 /* Multicast Address Register 1 */ +#define DP_MAR2 0xA /* Multicast Address Register 2 */ +#define DP_MAR3 0xB /* Multicast Address Register 3 */ +#define DP_MAR4 0xC /* Multicast Address Register 4 */ +#define DP_MAR5 0xD /* Multicast Address Register 5 */ +#define DP_MAR6 0xE /* Multicast Address Register 6 */ +#define DP_MAR7 0xF /* Multicast Address Register 7 */ + +#define DP_CNTR0 0xD /* Tally Counter 0 */ +#define DP_CNTR1 0xE /* Tally Counter 1 */ +#define DP_CNTR2 0xF /* Tally Counter 2 */ + + +#define DP_PAGESIZE 256 + +extern char *nicPacket; +extern uInt32 packetLength; + + +int ne2k_init(); +int ne2kProbe(int,struct device *); +int ne2kDevInit(struct device *); +void NS8390_init(struct device *dev,int startp); + +void ne2kISR(); +void ne2kHandler(); + +int NICtoPC(struct device *dev,void *packet,int length,int nic_addr); +int PCtoNIC(struct device *dev,void *packet,int length); + +struct nicBuffer *ne2kAllocBuffer(int); +struct nicBuffer *ne2kGetBuffer(); +void ne2kFreeBuffer(struct nicBuffer *); + +#endif + +/*** + $Log: ne2k.h,v $ + Revision 1.1.1.1 2006/06/01 12:46:14 reddawg + ubix2 + + Revision 1.2 2005/10/12 00:13:36 reddawg + Removed + + Revision 1.1.1.1 2005/09/26 17:23:39 reddawg + no message + + Revision 1.6 2004/07/14 12:03:49 reddawg + ne2k: ne2kInit to ne2k_init + Changed Startup Routines + + Revision 1.5 2004/05/21 14:57:16 reddawg + Cleaned up + + + END + ***/ diff --git a/include/isa/pit.h b/include/isa/pit.h new file mode 100644 index 0000000..628fd22 --- /dev/null +++ b/include/isa/pit.h @@ -0,0 +1,67 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ISA_PIT_H +#define _ISA_PIT_H + +#define PIT_TIMER 200 + +int pit_init(); + +#endif + +/*** + $Log: pit.h,v $ + Revision 1.1.1.1 2006/06/01 12:46:14 reddawg + ubix2 + + Revision 1.2 2005/10/12 00:13:36 reddawg + Removed + + Revision 1.1.1.1 2005/09/26 17:23:40 reddawg + no message + + Revision 1.6 2004/08/14 11:23:02 reddawg + Changes + + Revision 1.5 2004/07/16 04:06:32 reddawg + Tune ups this stuff should of been taken care of months ago + + Revision 1.4 2004/07/16 01:08:58 reddawg + Whew we work once again + + Revision 1.3 2004/07/09 13:29:15 reddawg + pit: pitInit to pit_init + Adjusted initialization routines + + Revision 1.2 2004/05/21 14:57:16 reddawg + Cleaned up + + END + ***/ + diff --git a/include/machine/_limits.h b/include/machine/_limits.h new file mode 100644 index 0000000..e3c85d7 --- /dev/null +++ b/include/machine/_limits.h @@ -0,0 +1,101 @@ +/*- + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)limits.h 8.3 (Berkeley) 1/4/94 + * $FreeBSD: releng/11.2/sys/x86/include/_limits.h 331722 2018-03-29 02:50:57Z eadler $ + */ + +#ifndef _MACHINE__LIMITS_H_ +#define _MACHINE__LIMITS_H_ + +/* + * According to ANSI (section 2.2.4.2), the values below must be usable by + * #if preprocessing directives. Additionally, the expression must have the + * same type as would an expression that is an object of the corresponding + * type converted according to the integral promotions. The subtraction for + * INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an + * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2). + */ + +#define __CHAR_BIT 8 /* number of bits in a char */ + +#define __SCHAR_MAX 0x7f /* max value for a signed char */ +#define __SCHAR_MIN (-0x7f - 1) /* min value for a signed char */ + +#define __UCHAR_MAX 0xff /* max value for an unsigned char */ + +#define __USHRT_MAX 0xffff /* max value for an unsigned short */ +#define __SHRT_MAX 0x7fff /* max value for a short */ +#define __SHRT_MIN (-0x7fff - 1) /* min value for a short */ + +#define __UINT_MAX 0xffffffff /* max value for an unsigned int */ +#define __INT_MAX 0x7fffffff /* max value for an int */ +#define __INT_MIN (-0x7fffffff - 1) /* min value for an int */ + +#ifdef __LP64__ +#define __ULONG_MAX 0xffffffffffffffff /* max for an unsigned long */ +#define __LONG_MAX 0x7fffffffffffffff /* max for a long */ +#define __LONG_MIN (-0x7fffffffffffffff - 1) /* min for a long */ +#else +#define __ULONG_MAX 0xffffffffUL +#define __LONG_MAX 0x7fffffffL +#define __LONG_MIN (-0x7fffffffL - 1) +#endif + + /* max value for an unsigned long long */ +#define __ULLONG_MAX 0xffffffffffffffffULL +#define __LLONG_MAX 0x7fffffffffffffffLL /* max value for a long long */ +#define __LLONG_MIN (-0x7fffffffffffffffLL - 1) /* min for a long long */ + +#ifdef __LP64__ +#define __SSIZE_MAX __LONG_MAX /* max value for a ssize_t */ +#define __SIZE_T_MAX __ULONG_MAX /* max value for a size_t */ +#define __OFF_MAX __LONG_MAX /* max value for an off_t */ +#define __OFF_MIN __LONG_MIN /* min value for an off_t */ +/* Quads and longs are the same on the amd64. Ensure they stay in sync. */ +#define __UQUAD_MAX __ULONG_MAX /* max value for a uquad_t */ +#define __QUAD_MAX __LONG_MAX /* max value for a quad_t */ +#define __QUAD_MIN __LONG_MIN /* min value for a quad_t */ +#define __LONG_BIT 64 +#else +#define __SSIZE_MAX __INT_MAX +#define __SIZE_T_MAX __UINT_MAX +#define __OFF_MAX __LLONG_MAX +#define __OFF_MIN __LLONG_MIN +#define __UQUAD_MAX __ULLONG_MAX +#define __QUAD_MAX __LLONG_MAX +#define __QUAD_MIN __LLONG_MIN +#define __LONG_BIT 32 +#endif + +#define __WORD_BIT 32 + +/* Minimum signal stack size. */ +#define __MINSIGSTKSZ (512 * 4) + +#endif /* !_MACHINE__LIMITS_H_ */ diff --git a/include/machine/_stdint.h b/include/machine/_stdint.h new file mode 100644 index 0000000..b876c53 --- /dev/null +++ b/include/machine/_stdint.h @@ -0,0 +1,152 @@ +#ifndef _MACHINE__STDINT_H_ +#define _MACHINE__STDINT_H_ + +#include + +#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) + +#define INT8_C(c) (c) +#define INT16_C(c) (c) +#define INT32_C(c) (c) + +#define UINT8_C(c) (c) +#define UINT16_C(c) (c) +#define UINT32_C(c) (c ## U) + +#ifdef __LP64__ +#define INT64_C(c) (c ## L) +#define UINT64_C(c) (c ## UL) +#else +#define INT64_C(c) (c ## LL) +#define UINT64_C(c) (c ## ULL) +#endif + +#define INTMAX_C(c) INT64_C(c) +#define UINTMAX_C(c) UINT64_C(c) + +#endif /* !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) */ + +#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) + +/* + * ISO/IEC 9899:1999 + * 7.18.2.1 Limits of exact-width integer types + */ +#define INT8_MIN (-0x7f-1) +#define INT16_MIN (-0x7fff-1) +#define INT32_MIN (-0x7fffffff-1) + +#define INT8_MAX 0x7f +#define INT16_MAX 0x7fff +#define INT32_MAX 0x7fffffff + +#define UINT8_MAX 0xff +#define UINT16_MAX 0xffff +#define UINT32_MAX 0xffffffffU + +#ifdef __LP64__ +#define INT64_MIN (-0x7fffffffffffffff-1) +#define INT64_MAX 0x7fffffffffffffff +#define UINT64_MAX 0xffffffffffffffff +#else +#define INT64_MIN (-0x7fffffffffffffffLL-1) +#define INT64_MAX 0x7fffffffffffffffLL +#define UINT64_MAX 0xffffffffffffffffULL +#endif + +/* + * ISO/IEC 9899:1999 + * 7.18.2.2 Limits of minimum-width integer types + */ +/* Minimum values of minimum-width signed integer types. */ +#define INT_LEAST8_MIN INT8_MIN +#define INT_LEAST16_MIN INT16_MIN +#define INT_LEAST32_MIN INT32_MIN +#define INT_LEAST64_MIN INT64_MIN + +/* Maximum values of minimum-width signed integer types. */ +#define INT_LEAST8_MAX INT8_MAX +#define INT_LEAST16_MAX INT16_MAX +#define INT_LEAST32_MAX INT32_MAX +#define INT_LEAST64_MAX INT64_MAX + +/* Maximum values of minimum-width unsigned integer types. */ +#define UINT_LEAST8_MAX UINT8_MAX +#define UINT_LEAST16_MAX UINT16_MAX +#define UINT_LEAST32_MAX UINT32_MAX +#define UINT_LEAST64_MAX UINT64_MAX + +/* + * ISO/IEC 9899:1999 + * 7.18.2.3 Limits of fastest minimum-width integer types + */ +/* Minimum values of fastest minimum-width signed integer types. */ +#define INT_FAST8_MIN INT32_MIN +#define INT_FAST16_MIN INT32_MIN +#define INT_FAST32_MIN INT32_MIN +#define INT_FAST64_MIN INT64_MIN + +/* Maximum values of fastest minimum-width signed integer types. */ +#define INT_FAST8_MAX INT32_MAX +#define INT_FAST16_MAX INT32_MAX +#define INT_FAST32_MAX INT32_MAX +#define INT_FAST64_MAX INT64_MAX + +/* Maximum values of fastest minimum-width unsigned integer types. */ +#define UINT_FAST8_MAX UINT32_MAX +#define UINT_FAST16_MAX UINT32_MAX +#define UINT_FAST32_MAX UINT32_MAX +#define UINT_FAST64_MAX UINT64_MAX + +/* + * ISO/IEC 9899:1999 + * 7.18.2.4 Limits of integer types capable of holding object pointers + */ +#ifdef __LP64__ +#define INTPTR_MIN INT64_MIN +#define INTPTR_MAX INT64_MAX +#define UINTPTR_MAX UINT64_MAX +#else +#define INTPTR_MIN INT32_MIN +#define INTPTR_MAX INT32_MAX +#define UINTPTR_MAX UINT32_MAX +#endif + +/* + * ISO/IEC 9899:1999 + * 7.18.2.5 Limits of greatest-width integer types + */ +#define INTMAX_MIN INT64_MIN +#define INTMAX_MAX INT64_MAX +#define UINTMAX_MAX UINT64_MAX + +/* + * ISO/IEC 9899:1999 + * 7.18.3 Limits of other integer types + */ +#ifdef __LP64__ +/* Limits of ptrdiff_t. */ +#define PTRDIFF_MIN INT64_MIN +#define PTRDIFF_MAX INT64_MAX + +/* Limits of sig_atomic_t. */ +#define SIG_ATOMIC_MIN __LONG_MIN +#define SIG_ATOMIC_MAX __LONG_MAX + +/* Limit of size_t. */ +#define SIZE_MAX UINT64_MAX +#else +#define PTRDIFF_MIN INT32_MIN +#define PTRDIFF_MAX INT32_MAX +#define SIG_ATOMIC_MIN INT32_MIN +#define SIG_ATOMIC_MAX INT32_MAX +#define SIZE_MAX UINT32_MAX +#endif + +/* Limits of wint_t. */ +#define WINT_MIN INT32_MIN +#define WINT_MAX INT32_MAX + +#endif /* !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) */ + +#endif /* !_MACHINE__STDINT_H_ */ diff --git a/include/machine/_types.h b/include/machine/_types.h new file mode 100644 index 0000000..7c3fdfb --- /dev/null +++ b/include/machine/_types.h @@ -0,0 +1,84 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _MACHINE__TYPES_H_ +#define _MACHINE__TYPES_H_ + +/* Basic types upon which most other types are built */ + +typedef __signed char __int8_t; +typedef unsigned char __uint8_t; +typedef short __int16_t; +typedef unsigned short __uint16_t; +typedef int __int32_t; +typedef unsigned int __uint32_t; +typedef long long __int64_t; +typedef unsigned long long __uint64_t; + +// Standard type definitions. + +typedef unsigned long __clock_t; /* clock()... */ +typedef __int32_t __critical_t; +typedef double __double_t; +typedef double __float_t; +typedef __int32_t __intfptr_t; +typedef __int64_t __intmax_t; +typedef __int32_t __intptr_t; +typedef __int32_t __int_fast8_t; +typedef __int32_t __int_fast16_t; +typedef __int32_t __int_fast32_t; +typedef __int64_t __int_fast64_t; +typedef __int8_t __int_least8_t; +typedef __int16_t __int_least16_t; +typedef __int32_t __int_least32_t; +typedef __int64_t __int_least64_t; +typedef __int32_t __ptrdiff_t; /* ptr1 - ptr2 */ +typedef __int32_t __register_t; +typedef __int32_t __segsz_t; /* segment size (in pages) */ +typedef __uint32_t __size_t; /* sizeof() */ +typedef __int32_t __ssize_t; /* byte count or error */ +typedef __int32_t __time_t; /* time()... */ +typedef __uint32_t __uintfptr_t; +typedef __uint64_t __uintmax_t; +typedef __uint32_t __uintptr_t; +typedef __uint32_t __uint_fast8_t; +typedef __uint32_t __uint_fast16_t; +typedef __uint32_t __uint_fast32_t; +typedef __uint64_t __uint_fast64_t; +typedef __uint8_t __uint_least8_t; +typedef __uint16_t __uint_least16_t; +typedef __uint32_t __uint_least32_t; +typedef __uint64_t __uint_least64_t; +typedef __uint32_t __u_register_t; +typedef __uint32_t __vm_offset_t; +typedef __int64_t __vm_ooffset_t; +typedef __uint32_t __vm_paddr_t; +typedef __uint64_t __vm_pindex_t; +typedef __uint32_t __vm_size_t; + +#endif /* !_MACHINE__TYPES_H_ */ diff --git a/include/mpi/mpi.h b/include/mpi/mpi.h new file mode 100644 index 0000000..0b1ce14 --- /dev/null +++ b/include/mpi/mpi.h @@ -0,0 +1,62 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _MPI_MPI_H +#define _MPI_MPI_H + +#include +#include + +#define MESSAGE_LENGTH 248 + +struct mpi_message { + char data[MESSAGE_LENGTH]; + uInt32 header; + pidType pid; + struct mpi_message *next; +}; + +struct mpi_mbox { + struct mpi_mbox *next; + struct mpi_mbox *prev; + struct mpi_message *msg; + struct mpi_message *msgLast; + char name[64]; + pidType pid; +}; + +typedef struct mpi_mbox mpi_mbox_t; +typedef struct mpi_message mpi_message_t; + +int mpi_createMbox(char *); +int mpi_destroyMbox(char *); +int mpi_postMessage(char *, uInt32, mpi_message_t *); +int mpi_fetchMessage(char *, mpi_message_t *); +int mpi_spam(uInt32, void *); + +#endif diff --git a/include/net/opt.h b/include/net/opt.h index 3156c2c..4dbf656 100644 --- a/include/net/opt.h +++ b/include/net/opt.h @@ -38,6 +38,8 @@ #if !defined LWIP_HDR_OPT_H #define LWIP_HDR_OPT_H +#include + /* * Include user defined options first. Anything not defined in these files * will be set to standard values. Override anything you don't like! diff --git a/include/pci/hd.h b/include/pci/hd.h new file mode 100644 index 0000000..ea314f5 --- /dev/null +++ b/include/pci/hd.h @@ -0,0 +1,487 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _PCI_HD_H_ +#define _PCI_HD_H_ + +#include +#include + +#define hdData 0x0 +#define hdError 0x1 +#define hdSecCount 0x2 +#define hdSecNum 0x3 +#define hdCylLow 0x4 +#define hdCylHi 0x5 +#define hdHead 0x6 +#define hdStat 0x7 +#define hdCmd 0x7 + +/* ATA Uhm? */ +#define ATA_IDENTIFY_COMMAND_SET_SUPPORTED1_48BIT_ENABLE 0x0400 +#define ATA_IDENTIFY_SECTOR_LARGER_THEN_512_ENABLE 0x0100 + +/* ATA register defines */ +#define ATA_DATA 0 /* (RW) data */ + +#define ATA_FEATURE 1 /* (W) feature */ +#define ATA_F_DMA 0x01 /* enable DMA */ +#define ATA_F_OVL 0x02 /* enable overlap */ + +#define ATA_COUNT 2 /* (W) sector count */ + +#define ATA_SECTOR 3 /* (RW) sector # */ +#define ATA_CYL_LSB 4 /* (RW) cylinder# LSB */ +#define ATA_CYL_MSB 5 /* (RW) cylinder# MSB */ +#define ATA_DRIVE 6 /* (W) Sector/Drive/Head */ +#define ATA_D_LBA 0x40 /* use LBA addressing */ +#define ATA_D_IBM 0xa0 /* 512 byte sectors, ECC */ + +#define ATA_COMMAND 7 /* (W) command */ + +#define ATA_ERROR 8 /* (R) error */ +#define ATA_E_ILI 0x01 /* illegal length */ +#define ATA_E_NM 0x02 /* no media */ +#define ATA_E_ABORT 0x04 /* command aborted */ +#define ATA_E_MCR 0x08 /* media change request */ +#define ATA_E_IDNF 0x10 /* ID not found */ +#define ATA_E_MC 0x20 /* media changed */ +#define ATA_E_UNC 0x40 /* uncorrectable data */ +#define ATA_E_ICRC 0x80 /* UDMA crc error */ +#define ATA_E_ATAPI_SENSE_MASK 0xf0 /* ATAPI sense key mask */ + +#define ATA_IREASON 9 /* (R) interrupt reason */ +#define ATA_I_CMD 0x01 /* cmd (1) | data (0) */ +#define ATA_I_IN 0x02 /* read (1) | write (0) */ +#define ATA_I_RELEASE 0x04 /* released bus (1) */ +#define ATA_I_TAGMASK 0xf8 /* tag mask */ + +#define ATA_STATUS 10 /* (R) status */ +#define ATA_ALTSTAT 11 /* (R) alternate status */ +#define ATA_S_ERROR 0x01 /* error */ +#define ATA_S_INDEX 0x02 /* index */ +#define ATA_S_CORR 0x04 /* data corrected */ +#define ATA_S_DRQ 0x08 /* data request */ +#define ATA_S_DSC 0x10 /* drive seek completed */ +#define ATA_S_SERVICE 0x10 /* drive needs service */ +#define ATA_S_DWF 0x20 /* drive write fault */ +#define ATA_S_DMA 0x20 /* DMA ready */ +#define ATA_S_READY 0x40 /* drive ready */ +#define ATA_S_BUSY 0x80 /* busy */ + +#define ATA_CONTROL 12 /* (W) control */ + +#define ATA_CTLOFFSET 0x206 /* control register offset */ +#define ATA_PCCARD_CTLOFFSET 0x0e /* do for PCCARD devices */ +#define ATA_PC98_CTLOFFSET 0x10c /* do for PC98 devices */ +#define ATA_A_IDS 0x02 /* disable interrupts */ +#define ATA_A_RESET 0x04 /* RESET controller */ +#ifdef ATA_LEGACY_SUPPORT +#define ATA_A_4BIT 0x08 /* 4 head bits: obsolete 1996 */ +#else +#define ATA_A_4BIT 0x00 +#endif +#define ATA_A_HOB 0x80 /* High Order Byte enable */ + +/* ATA Commands */ +#define ATA_IDENTIFY 0xEC +#define ATA_CHECK_POWER_MODE 0xE5 +#define ATA_STANDBY 0xE2 +#define ATA_STANDBY_IMMED 0xE0 +#define ATA_IDLE_IMMED 0xE1 +#define ATA_IDLE 0xE3 +#define ATA_FLUSH_CACHE 0xE7 +#define ATA_FLUSH_CACHE_EXT 0xEA +#define ATA_READ_DMA_EXT 0x25 +#define ATA_READ_DMA 0xC8 +#define ATA_READ_SECTORS_EXT 0x24 +#define ATA_READ_SECTORS 0x20 +#define ATA_WRITE_DMA_EXT 0x35 +#define ATA_WRITE_DMA 0xCA +#define ATA_WRITE_SECTORS_EXT 0x34 +#define ATA_WRITE_SECTORS 0x30 +#define ATA_WRITE_UNCORRECTABLE 0x45 +#define ATA_READ_VERIFY_SECTORS 0x40 +#define ATA_READ_VERIFY_SECTORS_EXT 0x42 +#define ATA_READ_BUFFER 0xE4 +#define ATA_WRITE_BUFFER 0xE8 +#define ATA_EXECUTE_DEVICE_DIAG 0x90 +#define ATA_SET_FEATURES 0xEF +#define ATA_SMART 0xB0 +#define ATA_PACKET_IDENTIFY 0xA1 +#define ATA_PACKET 0xA0 +#define ATA_READ_FPDMA 0x60 +#define ATA_WRITE_FPDMA 0x61 +#define ATA_READ_LOG_EXT 0x2F +#define ATA_NOP 0x00 +#define ATA_DEVICE_RESET 0x08 +#define ATA_MEDIA_EJECT 0xED +#define ATA_SECURITY_UNLOCK 0xF2 +#define ATA_SECURITY_FREEZE_LOCK 0xF5 +#define ATA_DATA_SET_MANAGEMENT 0x06 +#define ATA_DOWNLOAD_MICROCODE 0x92 +#define ATA_WRITE_STREAM_DMA_EXT 0x3A +#define ATA_READ_LOG_DMA_EXT 0x47 +#define ATA_READ_STREAM_DMA_EXT 0x2A +#define ATA_WRITE_DMA_FUA 0x3D +#define ATA_WRITE_LOG_DMA_EXT 0x57 +#define ATA_READ_DMA_QUEUED 0xC7 +#define ATA_READ_DMA_QUEUED_EXT 0x26 +#define ATA_WRITE_DMA_QUEUED 0xCC +#define ATA_WRITE_DMA_QUEUED_EXT 0x36 +#define ATA_WRITE_DMA_QUEUED_FUA_EXT 0x3E +#define ATA_READ_MULTIPLE 0xC4 +#define ATA_READ_MULTIPLE_EXT 0x29 +#define ATA_WRITE_MULTIPLE 0xC5 +#define ATA_WRITE_MULTIPLE_EXT 0x39 +#define ATA_WRITE_MULTIPLE_FUA_EXT 0xCE + +struct driveInfo { + struct driveDiskLabel *diskLabel; + struct ata_identify_data *ata_identify; + uint32_t lba_high; + uint32_t lba_low; + uint32_t sector_size; + char hdEnable; + char hdDev; + char hdFlags; + char hdShift; + long hdMask; + uint32_t hdMulti; + long hdPort; + long hdSize; + long hdCalc; + long parOffset; + int part; + long lba_start; + long lba_end; +}; + +int initHardDisk(); +int hdWrite(struct driveInfo *hdd, void *, uInt32, uInt32); +int hdRead(struct driveInfo *hdd, void *, uInt32, uInt32); +int hdReset(); +int hdIoctl(); +int hdStart(); +int hdStop(); +int hdStandby(); +int hdInit(struct device_node *dev); + +struct dos_partition { + unsigned char dp_flag; /* bootstrap flags */ + unsigned char dp_shd; /* starting head */ + unsigned char dp_ssect; /* starting sector */ + unsigned char dp_scyl; /* starting cylinder */ + unsigned char dp_type; /* partition type */ + unsigned char dp_ehd; /* end head */ + unsigned char dp_esect; /* end sector */ + unsigned char dp_ecyl; /* end cylinder */ + uInt32 dp_start; /* absolute starting sector number */ + uInt32 dp_size; /* partition size in sectors */ +}; + +#define MAXPARTITIONS 8 + +struct bsd_disklabel { + uint32_t d_magic; /* the magic number */ + u_int16_t d_type; /* drive type */ + u_int16_t d_subtype; /* controller/d_type specific */ + char d_typename[16]; /* type name, e.g. "eagle" */ + + char d_packname[16]; /* pack identifier */ + + /* disk geometry: */ + uint32_t d_secsize; /* # of bytes per sector */ + uint32_t d_nsectors; /* # of data sectors per track */ + uint32_t d_ntracks; /* # of tracks per cylinder */ + uint32_t d_ncylinders; /* # of data cylinders per unit */ + uint32_t d_secpercyl; /* # of data sectors per cylinder */ + uint32_t d_secperunit; /* # of data sectors per unit */ + + /* + * Spares (bad sector replacements) below are not counted in + * d_nsectors or d_secpercyl. Spare sectors are assumed to + * be physical sectors which occupy space at the end of each + * track and/or cylinder. + */ + u_int16_t d_sparespertrack; /* # of spare sectors per track */ + u_int16_t d_sparespercyl; /* # of spare sectors per cylinder */ + /* + * Alternate cylinders include maintenance, replacement, configuration + * description areas, etc. + */ + uint32_t d_acylinders; /* # of alt. cylinders per unit */ + + /* hardware characteristics: */ + /* + * d_interleave, d_trackskew and d_cylskew describe perturbations + * in the media format used to compensate for a slow controller. + * Interleave is physical sector interleave, set up by the + * formatter or controller when formatting. When interleaving is + * in use, logically adjacent sectors are not physically + * contiguous, but instead are separated by some number of + * sectors. It is specified as the ratio of physical sectors + * traversed per logical sector. Thus an interleave of 1:1 + * implies contiguous layout, while 2:1 implies that logical + * sector 0 is separated by one sector from logical sector 1. + * d_trackskew is the offset of sector 0 on track N relative to + * sector 0 on track N-1 on the same cylinder. Finally, d_cylskew + * is the offset of sector 0 on cylinder N relative to sector 0 + * on cylinder N-1. + */ + u_int16_t d_rpm; /* rotational speed */ + u_int16_t d_interleave; /* hardware sector interleave */ + u_int16_t d_trackskew; /* sector 0 skew, per track */ + u_int16_t d_cylskew; /* sector 0 skew, per cylinder */ + uint32_t d_headswitch; /* head switch time, usec */ + uint32_t d_trkseek; /* track-to-track seek, usec */ + uint32_t d_flags; /* generic flags */ +#define NDDATA 5 + uint32_t d_drivedata[NDDATA]; /* drive-type specific information */ +#define NSPARE 5 + uint32_t d_spare[NSPARE]; /* reserved for future use */ + uint32_t d_magic2; /* the magic number (again) */ + u_int16_t d_checksum; /* xor of data incl. partitions */ + + /* filesystem and partition information: */ + u_int16_t d_npartitions; /* number of partitions in following */ + uint32_t d_bbsize; /* size of boot area at sn0, bytes */ + uint32_t d_sbsize; /* max size of fs superblock, bytes */ + struct partition { /* the partition table */ + uint32_t p_size; /* number of sectors in partition */ + uint32_t p_offset; /* starting sector */ + uint32_t p_fsize; /* filesystem basic fragment size */ + u_int8_t p_fstype; /* filesystem type, see below */ + u_int8_t p_frag; /* filesystem fragments per block */ + u_int16_t p_cpg; /* filesystem cylinders per group */ + } d_partitions[MAXPARTITIONS]; /* actually may be more */ +}; + +static const char *fstypenames[] = { "unused", "swap", "Version 6", "Version 7", "System V", "4.1BSD", "Eighth Edition", "4.2BSD", "MSDOS", "4.4LFS", "unknown", "HPFS", "ISO9660", "boot", "vinum", "raid", "?", "?", "?", "?", "jfs", NULL }; + +/** + * @name ATA_IDENTIFY_DEVICE_FIELD_LENGTHS + * + * The following constants define the number of bytes contained in various + * fields found in the IDENTIFY DEVICE data structure. + */ +#define ATA_IDENTIFY_SERIAL_NUMBER_LEN 20 +#define ATA_IDENTIFY_MODEL_NUMBER_LEN 40 +#define ATA_IDENTIFY_FW_REVISION_LEN 8 +#define ATA_IDENTIFY_48_LBA_LEN 8 +#define ATA_IDENTIFY_MEDIA_SERIAL_NUMBER_LEN 30 +#define ATA_IDENTIFY_WWN_LEN 8 + +struct ata_identify_data { + u_int16_t general_config_bits; // word 00 + u_int16_t obsolete0; // word 01 (num cylinders) + u_int16_t vendor_specific_config_bits; // word 02 + u_int16_t obsolete1; // word 03 (num heads) + u_int16_t retired1[2]; // words 04-05 + u_int16_t obsolete2; // word 06 (sectors / track) + u_int16_t reserved_for_compact_flash1[2]; // words 07-08 + u_int16_t retired0; // word 09 + u_int8_t serial_number[ATA_IDENTIFY_SERIAL_NUMBER_LEN]; // word 10-19 + u_int16_t retired2[2]; // words 20-21 + u_int16_t obsolete4; // word 22 + u_int8_t firmware_revision[ATA_IDENTIFY_FW_REVISION_LEN]; // words 23-26 + u_int8_t model_number[ATA_IDENTIFY_MODEL_NUMBER_LEN]; // words 27-46 + u_int16_t max_sectors_per_multiple; // word 47 + u_int16_t reserved0; // word 48 + u_int16_t capabilities1; // word 49 + u_int16_t capabilities2; // word 50 + u_int16_t obsolete5[2]; // words 51-52 + u_int16_t validity_bits; // word 53 + u_int16_t obsolete6[5]; // words 54-58 Used to be: + // current cylinders, + // current heads, + // current sectors/Track, + // current capacity + u_int16_t current_max_sectors_per_multiple; // word 59 + u_int8_t total_num_sectors[4]; // words 60-61 + u_int16_t obsolete7; // word 62 + u_int16_t multi_word_dma_mode; // word 63 + u_int16_t pio_modes_supported; // word 64 + u_int16_t min_multiword_dma_transfer_cycle; // word 65 + u_int16_t rec_min_multiword_dma_transfer_cycle; // word 66 + u_int16_t min_pio_transfer_no_flow_ctrl; // word 67 + u_int16_t min_pio_transfer_with_flow_ctrl; // word 68 + u_int16_t additional_supported; // word 69 + u_int16_t reserved1; // word 70 + u_int16_t reserved2[4]; // words 71-74 + u_int16_t queue_depth; // word 75 + u_int16_t serial_ata_capabilities; // word 76 + u_int16_t serial_ata_reserved; // word 77 + u_int16_t serial_ata_features_supported; // word 78 + u_int16_t serial_ata_features_enabled; // word 79 + u_int16_t major_version_number; // word 80 + u_int16_t minor_version_number; // word 81 + u_int16_t command_set_supported0; // word 82 + u_int16_t command_set_supported1; // word 83 + u_int16_t command_set_supported_extention; // word 84 + u_int16_t command_set_enabled0; // word 85 + u_int16_t command_set_enabled1; // word 86 + u_int16_t command_set_default; // word 87 + u_int16_t ultra_dma_mode; // word 88 + u_int16_t security_erase_completion_time; // word 89 + u_int16_t enhanced_security_erase_time; // word 90 + u_int16_t current_power_mgmt_value; // word 91 + u_int16_t master_password_revision; // word 92 + u_int16_t hardware_reset_result; // word 93 + u_int16_t current_acoustic_management_value; // word 94 + u_int16_t stream_min_request_size; // word 95 + u_int16_t stream_transfer_time; // word 96 + u_int16_t stream_access_latency; // word 97 + u_int16_t stream_performance_granularity[2]; // words 98-99 + u_int8_t max_48bit_lba[ATA_IDENTIFY_48_LBA_LEN]; // words 100-103 + u_int16_t streaming_transfer_time; // word 104 + u_int16_t max_lba_range_entry_blocks; // word 105 + u_int16_t physical_logical_sector_info; // word 106 + u_int16_t acoustic_test_interseek_delay; // word 107 + u_int8_t world_wide_name[ATA_IDENTIFY_WWN_LEN]; // words 108-111 + u_int8_t reserved_for_wwn_extention[ATA_IDENTIFY_WWN_LEN]; // words 112-115 + u_int16_t reserved4; // word 116 + u_int8_t words_per_logical_sector[4]; // words 117-118 + u_int16_t command_set_supported2; // word 119 + u_int16_t reserved5[7]; // words 120-126 + u_int16_t removable_media_status; // word 127 + u_int16_t security_status; // word 128 + u_int16_t vendor_specific1[31]; // words 129-159 + u_int16_t cfa_power_mode1; // word 160 + u_int16_t reserved_for_compact_flash2[7]; // words 161-167 + u_int16_t device_nominal_form_factor; // word 168 + u_int16_t data_set_management; // word 169 + u_int16_t reserved_for_compact_flash3[6]; // words 170-175 + u_int16_t current_media_serial_number[ATA_IDENTIFY_MEDIA_SERIAL_NUMBER_LEN]; //words 176-205 + u_int16_t reserved6[3]; // words 206-208 + u_int16_t logical_sector_alignment; // words 209 + u_int16_t reserved7[7]; // words 210-216 + u_int16_t nominal_media_rotation_rate; // word 217 + u_int16_t reserved8[16]; // words 218-233 + u_int16_t min_num_blocks_per_microcode; // word 234 + u_int16_t max_num_blocks_per_microcode; // word 235 + u_int16_t reserved9[19]; // words 236-254 + u_int16_t integrity_word; // word 255 +}; + +/* + * A list of partition types, probably outdated. + */ +static const char * const part_types[256] = { + [0x00] = "unused", + [0x01] = "Primary DOS with 12 bit FAT", + [0x02] = "XENIX / file system", + [0x03] = "XENIX /usr file system", + [0x04] = "Primary DOS with 16 bit FAT (< 32MB)", + [0x05] = "Extended DOS", + [0x06] = "Primary DOS, 16 bit FAT (>= 32MB)", + [0x07] = "NTFS, OS/2 HPFS, QNX-2 (16 bit) or Advanced UNIX", + [0x08] = "AIX file system or SplitDrive", + [0x09] = "AIX boot partition or Coherent", + [0x0A] = "OS/2 Boot Manager, OPUS or Coherent swap", + [0x0B] = "DOS or Windows 95 with 32 bit FAT", + [0x0C] = "DOS or Windows 95 with 32 bit FAT (LBA)", + [0x0E] = "Primary 'big' DOS (>= 32MB, LBA)", + [0x0F] = "Extended DOS (LBA)", + [0x10] = "OPUS", + [0x11] = "OS/2 BM: hidden DOS with 12-bit FAT", + [0x12] = "Compaq diagnostics", + [0x14] = "OS/2 BM: hidden DOS with 16-bit FAT (< 32MB)", + [0x16] = "OS/2 BM: hidden DOS with 16-bit FAT (>= 32MB)", + [0x17] = "OS/2 BM: hidden IFS (e.g. HPFS)", + [0x18] = "AST Windows swapfile", + [0x1b] = "ASUS Recovery partition (NTFS)", + [0x24] = "NEC DOS", + [0x3C] = "PartitionMagic recovery", + [0x39] = "plan9", + [0x40] = "VENIX 286", + [0x41] = "Linux/MINIX (sharing disk with DRDOS)", + [0x42] = "SFS or Linux swap (sharing disk with DRDOS)", + [0x43] = "Linux native (sharing disk with DRDOS)", + [0x4D] = "QNX 4.2 Primary", + [0x4E] = "QNX 4.2 Secondary", + [0x4F] = "QNX 4.2 Tertiary", + [0x50] = "DM (disk manager)", + [0x51] = "DM6 Aux1 (or Novell)", + [0x52] = "CP/M or Microport SysV/AT", + [0x53] = "DM6 Aux3", + [0x54] = "DM6", + [0x55] = "EZ-Drive (disk manager)", + [0x56] = "Golden Bow (disk manager)", + [0x5c] = "Priam Edisk (disk manager)", /* according to S. Widlake */ + [0x61] = "SpeedStor", + [0x63] = "System V/386 (such as ISC UNIX), GNU HURD or Mach", + [0x64] = "Novell Netware/286 2.xx", + [0x65] = "Novell Netware/386 3.xx", + [0x70] = "DiskSecure Multi-Boot", + [0x75] = "PCIX", + [0x77] = "QNX4.x", + [0x78] = "QNX4.x 2nd part", + [0x79] = "QNX4.x 3rd part", + [0x80] = "Minix until 1.4a", + [0x81] = "Minix since 1.4b, early Linux partition or Mitac disk manager", + [0x82] = "Linux swap or Solaris x86", + [0x83] = "Linux native", + [0x84] = "OS/2 hidden C: drive", + [0x85] = "Linux extended", + [0x86] = "NTFS volume set??", + [0x87] = "NTFS volume set??", + [0x93] = "Amoeba file system", + [0x94] = "Amoeba bad block table", + [0x9F] = "BSD/OS", + [0xA0] = "Suspend to Disk", + [0xA5] = "FreeBSD/NetBSD/386BSD", + [0xA6] = "OpenBSD", + [0xA7] = "NeXTSTEP", + [0xA9] = "NetBSD", + [0xAC] = "IBM JFS", + [0xAF] = "HFS+", + [0xB7] = "BSDI BSD/386 file system", + [0xB8] = "BSDI BSD/386 swap", + [0xBE] = "Solaris x86 boot", + [0xBF] = "Solaris x86 (new)", + [0xC1] = "DRDOS/sec with 12-bit FAT", + [0xC4] = "DRDOS/sec with 16-bit FAT (< 32MB)", + [0xC6] = "DRDOS/sec with 16-bit FAT (>= 32MB)", + [0xC7] = "Syrinx", + [0xDB] = "CP/M, Concurrent CP/M, Concurrent DOS or CTOS", + [0xDE] = "DELL Utilities - FAT filesystem", + [0xE1] = "DOS access or SpeedStor with 12-bit FAT extended partition", + [0xE3] = "DOS R/O or SpeedStor", + [0xE4] = "SpeedStor with 16-bit FAT extended partition < 1024 cyl.", + [0xEB] = "BeOS file system", + [0xEE] = "EFI GPT", + [0xEF] = "EFI System Partition", + [0xF1] = "SpeedStor", + [0xF2] = "DOS 3.3+ Secondary", + [0xF4] = "SpeedStor large partition", + [0xFB] = "VMware VMFS", + [0xFE] = "SpeedStor >1024 cyl. or LANstep", + [0xFF] = "Xenix bad blocks table", }; + +#endif diff --git a/include/pci/lnc.h b/include/pci/lnc.h new file mode 100644 index 0000000..aafd2a0 --- /dev/null +++ b/include/pci/lnc.h @@ -0,0 +1,257 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _PCI_LNC_H +#define _PCI_LNC_H + +#include + +// TEMP COMMENT FRESH +#define RDP 0x10 // Register Data Port 16Bit +#define RDP32 0x10 // Register Data Port 32Bit +#define RAP 0x12 // Register Address Port 16Bit +#define RAP32 0x14 // Register Address Port 32Bit +#define RESET 0x14 // Reset Port 16Bit +#define RESET32 0x18 // Reset Port 32Bit +#define BDP 0x16 // 16Bit +#define BDP32 0x1C // 32Bit + +// BCR18 +#define BCR18 18 +#define BCR18_DWIO 0x0080 + +// BCR20 +#define BCR20 0x0014 + +// Modes +#define MODE_16 0 +#define MODE_32 1 +#define MODE_INVALID 3 + +// CSR0 +#define CSR0 0x0000 +#define CSR0_STOP 0x0004 + +// CSR15 +#define CSR15 15 +#define CSR15_DXMTFCS 0x0008 +#define CSR15_DRTY 0x0020 +#define CSR15_PROM 0x8000 + +// CSR58 +#define CSR58 0x003A + +struct mds { + uint16_t md0; + uint16_t md1; + short md2; + uint16_t md3; +}; + +struct hostRingEntry_old { + struct mds *md; + union { + //struct mbuf *mbuf; + char *data; + } buff; +}; + +struct hostRingEntry { + uint32_t addr; + uint16_t bcnt; + uint8_t md[6]; + uint32_t reserved; +}; + +struct arpcom { + //struct ifnet ac_if; /* network-visible interface */ + uint8_t ac_enaddr[6]; /* ethernet hardware address */ + int ac_multicnt; /* length of ac_multiaddrs list */ + void *ac_netgraph; /* ng_ether(4) netgraph node info */ +}; + +struct nicInfo { + int ident; /* Type of card */ + int ic; /* Type of ic, Am7990, Am79C960 etc. */ + int memMode; + int iobase; + int mode; /* Mode setting at initialization */ +}; + +struct initBlock16 { + uint16_t mode; // Mode register + uint8_t padr[6]; // Ethernet address + uint8_t ladrf[8]; // Logical address filter (multicast) + uint16_t rdra; // Low order pointer to receive ring + uint16_t rlen; // High order pointer and no. rings + uint16_t tdra; // Low order pointer to transmit ring + uint16_t tlen; // High order pointer and no rings +}; + +struct initBlock32 { + uint16_t mode; + uint8_t rlen; + uint8_t tlen; + uint8_t padr[6]; + uint16_t res; + uint8_t ladrf[8]; + uint32_t rdra; + uint32_t tdra; +}; + +struct lncInfo { + struct arpcom arpcom; + struct nicInfo nic; + struct hostRingEntry *rxRing; + char *rxBuffer; + struct hostRingEntry *txRing; + char *txBuffer; + struct initBlock32 init; + unsigned int ioAddr; + int nrdre; + int ntdre; + int bufferSize; + int txPtr; + int rxPtr; +}; + +/* Functions */ +void lnc_writeCSR(struct lncInfo *, uint16_t, uint16_t); +void lnc_writeCSR32(struct lncInfo *, uint32_t, uint32_t); + +uint16_t lnc_readCSR(struct lncInfo *, uint16_t); +uint32_t lnc_readCSR32(struct lncInfo *, uint32_t); + +void lnc_writeBCR(struct lncInfo *, uint16_t, uint16_t); +void lnc_writeBCR32(struct lncInfo *, uint32_t, uint32_t); + +uint16_t lnc_readBCR(struct lncInfo *, uint16_t); +uint32_t lnc_readBCR32(struct lncInfo *, uint32_t); + +void lnc_reset(struct lncInfo *); +void lnc_reset32(struct lncInfo *); + +int lnc_probe(struct lncInfo *); + +int lnc_switchDWord(struct lncInfo *); + +int lnc_getMode(struct lncInfo *); + +void lnc_isr(); +int lnc_driverOwnsRX(struct lncInfo *); +int lnc_driverOwnsRX(struct lncInfo *); + +void lnc_INT(); +void lnc_rxINT(); +void lnc_txINT(); + +// OLD + +#define NDESC(len2) (1 << len2) +#define NORMAL 0 +#define MEM_SLEW 8 +#define TRANSBUFSIZE 1518 +#define RECVBUFSIZE 1518 +#define NRDRE 3 +#define NTDRE 3 +#define ETHER_ADDR_LEN 6 +#define NE2100_IOSIZE 24 + +#define PCNET_VSW 0x18 +#define NE2100 2 + +/* mem_mode values */ +#define DMA_FIXED 1 +#define DMA_MBUF 2 +#define SHMEM 4 + +/********** Chip Types **********/ +#define UNKNOWN 0 /* Unknown */ +#define LANCE 1 /* Am7990 */ +#define C_LANCE 2 /* Am79C90 */ +#define PCnet_ISA 3 /* Am79C960 */ +#define PCnet_ISAplus 4 /* Am79C961 */ +#define PCnet_ISA_II 5 /* Am79C961A */ +#define PCnet_32 6 /* Am79C965 */ +#define PCnet_PCI 7 /* Am79C970 */ +#define PCnet_PCI_II 8 /* Am79C970A */ +#define PCnet_FAST 9 /* Am79C971 */ +#define PCnet_FASTplus 10 /* Am79C972 */ +#define PCnet_Home 11 /* Am79C978 */ + +/******** AM7990 Specifics **************/ +#define CSR1 1 +#define CSR2 2 +#define CSR3 3 +#define CSR88 88 +#define CSR89 89 + +#define ERR 0x8000 +#define BABL 0x4000 +#define CERR 0x2000 +#define MISS 0x1000 +#define MERR 0x0800 +#define RINT 0x0400 +#define TINT 0x0200 +#define IDON 0x0100 +#define INTR 0x0080 +#define INEA 0x0040 +#define RXON 0x0020 +#define TXON 0x0010 +#define TDMD 0x0008 + +#define STRT 0x0002 +#define INIT 0x0001 + +/* CSR88-89: Chip ID masks */ +#define AMD_MASK 0x003 +#define PART_MASK 0xffff +#define Am79C960 0x0003 +#define Am79C961 0x2260 +#define Am79C961A 0x2261 +#define Am79C965 0x2430 +#define Am79C970 0x0242 +#define Am79C970A 0x2621 +#define Am79C971 0x2623 +#define Am79C972 0x2624 +#define Am79C973 0x2625 +#define Am79C978 0x2626 + +extern struct lncInfo *lnc; + +int initLNC(); +int probe(struct lncInfo *lnc); +int lanceProbe(struct lncInfo *lnc); +int lncAttach(struct lncInfo *lnc, int unit); + +void lncInt(); +void _lncInt(); + +int lnc_sendPacket(struct lncInfo *lnc, void *packet, size_t len, uInt8 *dest); + +#endif diff --git a/include/pci/pci.h b/include/pci/pci.h new file mode 100644 index 0000000..1c8d00d --- /dev/null +++ b/include/pci/pci.h @@ -0,0 +1,106 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _PCI_H +#define _PCI_H + +#include + +struct pciConfig { + uint16_t vendorID; + uint16_t deviceID; + + uint16_t command; + uint16_t status; + + uint8_t revisionID; + uint8_t progIf; + uint8_t subClass; + uint8_t classCode; + + uint8_t cacheLineSize; + uint8_t latencyTimer; + uint8_t headerType; + uint8_t bist; + + uint32_t bar[6]; + + uint32_t cbPointer; + + uint16_t subsysVendorID; + uint16_t subsysID; + + uint32_t epromAddr; + + uint16_t capabilites; + uint16_t res1; + + uint32_t res2; + + uint8_t intLine; + uint8_t intPin; + uint8_t minGrant; + uint8_t maxLatency; + + /* device info */ + //uint8_t bus; + //uint8_t dev; + //uint8_t func; + //uint8_t irq; + //uint8_t irqLine; + /* base registers */ + //uInt32 base[6]; + //uInt32 size[6]; + //uint16_t subsysVendor; + //uint16_t subsys; + /* Device Info */ + //Move this to anotther struct eventually + uint8_t bus; + uint8_t dev; + uint8_t func; + +}; + +struct confadd { + uint8_t reg :8; + uint8_t func :3; + uint8_t dev :5; + uint8_t bus :8; + uint8_t rsvd :7; + uint8_t enable :1; +}; + +#define countof(a) (sizeof(a) / sizeof(a[0])) + +int pci_init(); + +uint32_t pciProbe(int bus, int dev, int func); +uInt32 pciRead(int bus, int dev, int func, int reg, int bytes); +void pciWrite(int bus, int dev, int func, int reg, uInt32 v, int bytes); + +#endif diff --git a/include/sde/ogDisplay_UbixOS.h b/include/sde/ogDisplay_UbixOS.h new file mode 100644 index 0000000..8726d07 --- /dev/null +++ b/include/sde/ogDisplay_UbixOS.h @@ -0,0 +1,116 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef OGDISPLAY_UBIXOS_H +#define OGDISPLAY_UBIXOS_H + +#include +#include + +struct ogModeInfo { + uint16_t modeAttributes __attribute__((packed)); + uint8_t windowAFlags __attribute__((packed)); + uint8_t windowBFlags __attribute__((packed)); + uint16_t granularity __attribute__((packed)); + uint16_t windowSize __attribute__((packed)); + uint16_t windowASeg __attribute__((packed)); + uint16_t windowBSeg __attribute__((packed)); + void* bankSwitch __attribute__((packed)); + uint16_t bytesPerLine __attribute__((packed)); + uint16_t xRes __attribute__((packed)); + uint16_t yRes __attribute__((packed)); + uint8_t charWidth __attribute__((packed)); + uint8_t charHeight __attribute__((packed)); + uint8_t numBitPlanes __attribute__((packed)); + uint8_t bitsPerPixel __attribute__((packed)); + uint8_t numberOfBanks __attribute__((packed)); + uint8_t memoryModel __attribute__((packed)); + uint8_t bankSize __attribute__((packed)); + uint8_t numOfImagePages __attribute__((packed)); + uint8_t reserved __attribute__((packed)); + // Direct colour fields (required for Direct/6 and YUV/7 memory models + uint8_t redMaskSize __attribute__((packed)); + uint8_t redFieldPosition __attribute__((packed)); + uint8_t greenMaskSize __attribute__((packed)); + uint8_t greenFieldPosition __attribute__((packed)); + uint8_t blueMaskSize __attribute__((packed)); + uint8_t blueFieldPosition __attribute__((packed)); + uint8_t alphaMaskSize __attribute__((packed)); + uint8_t alphaFieldPosition __attribute__((packed)); + uint8_t directColourMode __attribute__((packed)); + // VESA 2.0 specific fields + uint32_t physBasePtr __attribute__((packed)); + void* offScreenMemOffset __attribute__((packed)); + uint16_t offScreenMemSize __attribute__((packed)); + uint8_t paddington[461] __attribute__((packed)); +}; + +struct ogVESAInfo { + char VBESignature[4] __attribute__((packed)); + uint8_t minVersion __attribute__((packed)); + uint8_t majVersion __attribute__((packed)); + uint32_t OEMStringPtr __attribute__((packed)); + uint32_t capabilities __attribute__((packed)); + uint32_t videoModePtr __attribute__((packed)); + uint16_t totalMemory __attribute__((packed)); + // VESA 2.0 specific fields + uint16_t OEMSoftwareRev __attribute__((packed)); + uint32_t OEMVendorNamePtr __attribute__((packed)); + uint32_t OEMProductNamePtr __attribute__((packed)); + uint32_t OEMProductRevPtr __attribute__((packed)); + uint8_t paddington[474] __attribute__((packed)); +}; + +class ogDisplay_UbixOS: public ogSurface { + protected: + void * pages[2]; + uint32_t activePage; + uint32_t visualPage; + ogVESAInfo * VESAInfo; + ogModeInfo * modeInfo; + + uint16_t FindMode(uint32_t, uint32_t, uint32_t); + void GetModeInfo(uint16_t); + void GetVESAInfo(void); + void SetMode(uint16_t); + void SetPal(void); + public: + ogDisplay_UbixOS(void); + virtual bool ogAlias(ogSurface&, uint32_t, uint32_t, uint32_t, uint32_t); + virtual bool ogClone(ogSurface&); + virtual void ogCopyPalette(ogSurface&); + virtual bool ogCreate(uint32_t, uint32_t, ogPixelFmt); + virtual bool ogLoadPalette(const char *); + virtual void ogSetPalette(const ogRGBA8[]); + virtual void ogSetPalette(uint8_t, uint8_t, uint8_t, uint8_t); + virtual void ogSetPalette(uint8_t, uint8_t, uint8_t, uint8_t, uint8_t); + virtual ~ogDisplay_UbixOS(void); +}; +// ogDisplay_UbixOS + +#endif diff --git a/include/sde/sde.h b/include/sde/sde.h new file mode 100644 index 0000000..4454434 --- /dev/null +++ b/include/sde/sde.h @@ -0,0 +1,62 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _SDE_SDE_H +#define _SDE_SDE_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define registerWindow 1 +#define windowReady 2 +#define drawWindow 3 +#define killWindow 4 + +void sdeThread(); + +//void sysSDE(uint32_t cmd, void *ptr); +int sysSDE(struct thread *td, struct sys_sde_args *args); + +struct sdeWindows { + struct sdeWindows *next; + struct sdeWindows *prev; + void *buf; + pidType pid; + uint8_t status; +}; + +extern struct sdeWindows *windows; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/string.h b/include/string.h index e375a77..c5d96d1 100644 --- a/include/string.h +++ b/include/string.h @@ -41,9 +41,8 @@ * Prototype functions which were historically defined in , but * are required by POSIX to be prototyped in . */ -#if __BSD_VISIBLE #include -#endif + #ifndef _SIZE_T_DECLARED typedef __size_t size_t; diff --git a/include/sys/_sigset.h b/include/sys/_sigset.h index c488c4e..eb73c5b 100644 --- a/include/sys/_sigset.h +++ b/include/sys/_sigset.h @@ -1,46 +1,59 @@ /*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. + * Copyright (c) 1982, 1986, 1989, 1991, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. * - * This was developed by Christopher W. Olsen for the UbixOS Project. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * @(#)signal.h 8.4 (Berkeley) 5/4/95 + * $FreeBSD: releng/11.2/sys/sys/_sigset.h 331722 2018-03-29 02:50:57Z eadler $ */ -#ifndef _SYS__SIGSET_H -#define _SYS__SIGSET_H +#ifndef _SYS__SIGSET_H_ +#define _SYS__SIGSET_H_ -#include - -// sigset_t macros -#define _SIG_WORDS 4 -#define _SIG_MAXSIG 128 -#define _SIG_IDX(sig) ((sig) - 1) -#define _SIG_WORD(sig) (_SIG_IDX(sig) >> 5) -#define _SIG_BIT(sig) (1 << (_SIG_IDX(sig) & 31)) -#define _SIG_VALID(sig) ((sig) <= _SIG_MAXSIG && (sig) > 0) +/* + * sigset_t macros. + */ +#define _SIG_WORDS 4 +#define _SIG_MAXSIG 128 +#define _SIG_IDX(sig) ((sig) - 1) +#define _SIG_WORD(sig) (_SIG_IDX(sig) >> 5) +#define _SIG_BIT(sig) (1 << (_SIG_IDX(sig) & 31)) +#define _SIG_VALID(sig) ((sig) <= _SIG_MAXSIG && (sig) > 0) typedef struct __sigset { - __uint32_t __bits [_SIG_WORDS]; + __uint32_t __bits[_SIG_WORDS]; } __sigset_t; -#endif /* END _SYS__SIGSET_H */ +#if defined(_KERNEL) && defined(COMPAT_43) +typedef unsigned int osigset_t; +#endif + +#endif /* !_SYS__SIGSET_H_ */ diff --git a/include/sys/_stdint.h b/include/sys/_stdint.h new file mode 100644 index 0000000..d5b8c77 --- /dev/null +++ b/include/sys/_stdint.h @@ -0,0 +1,90 @@ +/*- + * Copyright (c) 2011 David E. O'Brien + * Copyright (c) 2001 Mike Barcroft + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: releng/11.2/sys/sys/_stdint.h 331722 2018-03-29 02:50:57Z eadler $ + */ + +#ifndef _SYS__STDINT_H_ +#define _SYS__STDINT_H_ + +#ifndef _INT8_T_DECLARED +typedef __int8_t int8_t; +#define _INT8_T_DECLARED +#endif + +#ifndef _INT16_T_DECLARED +typedef __int16_t int16_t; +#define _INT16_T_DECLARED +#endif + +#ifndef _INT32_T_DECLARED +typedef __int32_t int32_t; +#define _INT32_T_DECLARED +#endif + +#ifndef _INT64_T_DECLARED +typedef __int64_t int64_t; +#define _INT64_T_DECLARED +#endif + +#ifndef _UINT8_T_DECLARED +typedef __uint8_t uint8_t; +#define _UINT8_T_DECLARED +#endif + +#ifndef _UINT16_T_DECLARED +typedef __uint16_t uint16_t; +#define _UINT16_T_DECLARED +#endif + +#ifndef _UINT32_T_DECLARED +typedef __uint32_t uint32_t; +#define _UINT32_T_DECLARED +#endif + +#ifndef _UINT64_T_DECLARED +typedef __uint64_t uint64_t; +#define _UINT64_T_DECLARED +#endif + +#ifndef _INTPTR_T_DECLARED +typedef __intptr_t intptr_t; +#define _INTPTR_T_DECLARED +#endif +#ifndef _UINTPTR_T_DECLARED +typedef __uintptr_t uintptr_t; +#define _UINTPTR_T_DECLARED +#endif +#ifndef _INTMAX_T_DECLARED +typedef __intmax_t intmax_t; +#define _INTMAX_T_DECLARED +#endif +#ifndef _UINTMAX_T_DECLARED +typedef __uintmax_t uintmax_t; +#define _UINTMAX_T_DECLARED +#endif + +#endif /* !_SYS__STDINT_H_ */ diff --git a/include/sys/_types.h b/include/sys/_types.h index c998ff6..baef253 100644 --- a/include/sys/_types.h +++ b/include/sys/_types.h @@ -29,30 +29,58 @@ #ifndef _SYS__TYPES_H_ #define _SYS__TYPES_H_ -typedef char __int8_t; -typedef unsigned char __uint8_t; -typedef short __int16_t; -typedef unsigned short __uint16_t; -typedef int __int32_t; -typedef unsigned int __uint32_t; -typedef long long __int64_t; -typedef unsigned long long __uint64_t; +#include +#include -typedef unsigned long __clock_t; -typedef __uint32_t __ino_t; typedef __int32_t __ssize_t;/* stat types */ -typedef __uint32_t __dev_t;/* device number */ -typedef __uint16_t __mode_t; typedef __uint16_t __nlink_t;/* link count */ -typedef __uint32_t __uid_t; typedef __uint32_t __gid_t; typedef __int32_t __time_t; typedef __int64_t __blkcnt_t;/* file block count */ -typedef __uint32_t __blksize_t;/* file block size */ -typedef __uint32_t __fflags_t;/* file flags */ -typedef __int8_t __int_fast8_t; typedef __uint8_t __uint_fast8_t; typedef __int16_t __int_fast16_t; typedef __uint16_t __uint_fast16_t; typedef __int32_t __int_fast32_t; typedef __uint32_t __uint_fast32_t; typedef __int64_t __int_fast64_t; typedef __uint64_t __uint_fast64_t; typedef __int32_t __intptr_t; typedef __uint32_t __uintptr_t; typedef __uint32_t __uintfptr_t; typedef __uint32_t __size_t; typedef __int64_t __intmax_t; typedef __uint64_t __uintmax_t; typedef __int32_t __ptrdiff_t; typedef __uint8_t __uint_least8_t; typedef __uint16_t __uint_least16_t; typedef __uint32_t __uint_least32_t; typedef __uint64_t __uint_least64_t; typedef __int8_t __int_least8_t; typedef __int16_t __int_least16_t; typedef __int32_t __int_least32_t; typedef __int64_t __int_least64_t; typedef -int ___wchar_t; +typedef __uint32_t __ino_t; +typedef __uint32_t __dev_t; /* device number */ +typedef __uint16_t __mode_t; +typedef __uint16_t __nlink_t; /* link count */ +typedef __uint32_t __uid_t; +typedef __uint32_t __gid_t; +typedef __int32_t __time_t; +typedef __int64_t __blkcnt_t; /* file block count */ +typedef __uint32_t __blksize_t; /* file block size */ +typedef __uint32_t __fflags_t; /* file flags */ +typedef int ___wchar_t; typedef long __suseconds_t; /* microseconds (signed) */ typedef __int32_t __pid_t;/* process [group] */ + +/* + * Unusual type definitions. + */ +/* + * rune_t is declared to be an ``int'' instead of the more natural + * ``unsigned long'' or ``long''. Two things are happening here. It is not + * unsigned so that EOF (-1) can be naturally assigned to it and used. Also, + * it looks like 10646 will be a 31 bit standard. This means that if your + * ints cannot hold 32 bits, you will be in trouble. The reason an int was + * chosen over a long is that the is*() and to*() routines take ints (says + * ANSI C), but they use __ct_rune_t instead of int. + * + * NOTE: rune_t is not covered by ANSI nor other standards, and should not + * be instantiated outside of lib/libc/locale. Use wchar_t. wint_t and + * rune_t must be the same type. Also, wint_t should be able to hold all + * members of the largest character set plus one extra value (WEOF), and + * must be at least 16 bits. + */ +typedef int __ct_rune_t; /* arg type for ctype funcs */ +typedef __ct_rune_t __rune_t; /* rune_t (see above) */ +typedef __ct_rune_t __wint_t; /* wint_t (see above) */ + +typedef struct { + long long __max_align1 __aligned(_Alignof(long long)); +#ifndef _STANDALONE + long double __max_align2 __aligned(_Alignof(long double)); +#endif +} __max_align_t; + + #if !defined(__clang__) || !defined(__cplusplus) -typedef __uint_least16_t __char16_t; typedef __uint_least32_t __char32_t; +typedef __uint_least16_t __char16_t; +typedef __uint_least32_t __char32_t; #endif -#endif +#endif /* !_SYS__TYPES_H_ */ diff --git a/include/sys/buf.h b/include/sys/buf.h index b08e384..f9df8ae 100644 --- a/include/sys/buf.h +++ b/include/sys/buf.h @@ -30,7 +30,7 @@ #ifndef _BUF_H #define _BUF_H -#include +#include #include struct buf { diff --git a/include/sys/descrip.h b/include/sys/descrip.h index 9953efd..67f8e88 100644 --- a/include/sys/descrip.h +++ b/include/sys/descrip.h @@ -32,8 +32,8 @@ #include #include -#include -#include +#include +#include /* Limits */ #define MAX_FILES 256 diff --git a/include/sys/elf.h b/include/sys/elf.h index 4392989..ac3a614 100644 --- a/include/sys/elf.h +++ b/include/sys/elf.h @@ -32,7 +32,7 @@ #define __i386__ 1 #include -#include +#include #include #include diff --git a/include/sys/limits.h b/include/sys/limits.h index 34bfbd5..58ca781 100644 --- a/include/sys/limits.h +++ b/include/sys/limits.h @@ -29,7 +29,7 @@ #ifndef _SYS_LIMITS_H #define _SYS_LIMITS_H -#include +#include #define LONG_BIT __LONG_BIT diff --git a/include/sys/signal.h b/include/sys/signal.h index 0ffe9b8..33721d0 100644 --- a/include/sys/signal.h +++ b/include/sys/signal.h @@ -30,6 +30,9 @@ #define _SYS_SIGNAL_H #include +#include + +typedef __sigset_t sigset_t; #define _SIG_WORDS 4 #define _SIG_MAXSIG 128 diff --git a/include/sys/stdint.h b/include/sys/stdint.h new file mode 100644 index 0000000..489cd4b --- /dev/null +++ b/include/sys/stdint.h @@ -0,0 +1,76 @@ +/*- + * Copyright (c) 2001 Mike Barcroft + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: releng/11.2/sys/sys/stdint.h 331722 2018-03-29 02:50:57Z eadler $ + */ + +#ifndef _SYS_STDINT_H_ +#define _SYS_STDINT_H_ + +#include +#include + +#include +#include + +typedef __int_least8_t int_least8_t; +typedef __int_least16_t int_least16_t; +typedef __int_least32_t int_least32_t; +typedef __int_least64_t int_least64_t; + +typedef __uint_least8_t uint_least8_t; +typedef __uint_least16_t uint_least16_t; +typedef __uint_least32_t uint_least32_t; +typedef __uint_least64_t uint_least64_t; + +typedef __int_fast8_t int_fast8_t; +typedef __int_fast16_t int_fast16_t; +typedef __int_fast32_t int_fast32_t; +typedef __int_fast64_t int_fast64_t; + +typedef __uint_fast8_t uint_fast8_t; +typedef __uint_fast16_t uint_fast16_t; +typedef __uint_fast32_t uint_fast32_t; +typedef __uint_fast64_t uint_fast64_t; + +/* GNU and Darwin define this and people seem to think it's portable */ +#if defined(UINTPTR_MAX) && defined(UINT64_MAX) && (UINTPTR_MAX == UINT64_MAX) +#define __WORDSIZE 64 +#else +#define __WORDSIZE 32 +#endif + +/* Limits of wchar_t. */ +#define WCHAR_MIN __WCHAR_MIN +#define WCHAR_MAX __WCHAR_MAX + +#if __EXT1_VISIBLE +/* ISO/IEC 9899:2011 K.3.4.4 */ +#ifndef RSIZE_MAX +#define RSIZE_MAX (SIZE_MAX >> 1) +#endif +#endif /* __EXT1_VISIBLE */ + +#endif /* !_SYS_STDINT_H_ */ diff --git a/include/sys/types.h b/include/sys/types.h index 70d5723..9954b42 100644 --- a/include/sys/types.h +++ b/include/sys/types.h @@ -40,6 +40,9 @@ typedef char *caddr_t; +/* POSIX integrals that should only appear only in */ +#include + /* unsigned integrals */ typedef __uint8_t uint8_t; typedef __uint16_t uint16_t; @@ -130,11 +133,6 @@ #define _TIME_T_DECLARED #endif -typedef uint32_t uintmax_t; -typedef int32_t intmax_t; -typedef int32_t ptrdiff_t; -typedef uint32_t uintptr_t; - #define __ULONG_MAX 0xffffffffUL #define __USHRT_MAX 0xffff /* max value for an unsigned short */ diff --git a/include/sys/ubixos/access.h b/include/sys/ubixos/access.h deleted file mode 100644 index 773102a..0000000 --- a/include/sys/ubixos/access.h +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _UBIXOS_ACCESS_H -#define _UBIXOS_ACCESS_H - -#include - -struct sys_setUID_args { - uint32_t uid; -}; - -struct sys_setGID_args { - uint32_t gid; -}; - -int sys_getUID(struct thread *, void *); -int sys_getEUID(struct thread *, void *); -int sys_setUID(struct thread *, struct sys_setUID_args *); - -int sys_getGID(struct thread *, void *); -int sys_setGID(struct thread *, struct sys_setGID_args *); - -#endif /* END _UBIXOS_ACCESS_H */ diff --git a/include/sys/ubixos/endtask.h b/include/sys/ubixos/endtask.h deleted file mode 100644 index 998623e..0000000 --- a/include/sys/ubixos/endtask.h +++ /dev/null @@ -1,37 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _UBIXOS_ENDTASK_H -#define _UBIXOS_ENDTASK_H - -#include -#include - -void endTask(pidType); - -#endif /* END _UBIXOS_ENDTASK_H */ diff --git a/include/sys/ubixos/errno.h b/include/sys/ubixos/errno.h deleted file mode 100644 index 04aa285..0000000 --- a/include/sys/ubixos/errno.h +++ /dev/null @@ -1,177 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _UBIXOS_ERRNO_H -#define _UBIXOS_ERRNO_H - -#ifdef __cplusplus -extern "C" { -#endif - -#define ENOERR 0 /* No Error */ -#define EPERM 1 /* Operation not permitted */ -#define ENOENT 2 /* No such file or directory */ -#define ESRCH 3 /* No such process */ -#define EINTR 4 /* Interrupted system call */ -#define EIO 5 /* I/O error */ -#define ENXIO 6 /* No such device or address */ -#define E2BIG 7 /* Arg list too long */ -#define ENOEXEC 8 /* Exec format error */ -#define EBADF 9 /* Bad file number */ -#define ECHILD 10 /* No child processes */ -#define EAGAIN 11 /* Try again */ -#define ENOMEM 12 /* Out of memory */ -#define EACCES 13 /* Permission denied */ -#define EFAULT 14 /* Bad address */ -#define ENOTBLK 15 /* Block device required */ -#define EBUSY 16 /* Device or resource busy */ -#define EEXIST 17 /* File exists */ -#define EXDEV 18 /* Cross-device link */ -#define ENODEV 19 /* No such device */ -#define ENOTDIR 20 /* Not a directory */ -#define EISDIR 21 /* Is a directory */ -#define EINVAL 22 /* Invalid argument */ -#define ENFILE 23 /* File table overflow */ -#define EMFILE 24 /* Too many open files */ -#define ENOTTY 25 /* Not a typewriter */ -#define ETXTBSY 26 /* Text file busy */ -#define EFBIG 27 /* File too large */ -#define ENOSPC 28 /* No space left on device */ -#define ESPIPE 29 /* Illegal seek */ -#define EROFS 30 /* Read-only file system */ -#define EMLINK 31 /* Too many links */ -#define EPIPE 32 /* Broken pipe */ -#define EDOM 33 /* Math argument out of domain of func */ -#define ERANGE 34 /* Math result not representable */ -#define EDEADLK 35 /* Resource deadlock would occur */ -#define ENAMETOOLONG 36 /* File name too long */ -#define ENOLCK 37 /* No record locks available */ -#define ENOSYS 38 /* Function not implemented */ -#define ENOTEMPTY 39 /* Directory not empty */ -#define ELOOP 40 /* Too many symbolic links encountered */ -#define EWOULDBLOCK EAGAIN /* Operation would block */ -#define ENOMSG 42 /* No message of desired type */ -#define EIDRM 43 /* Identifier removed */ -#define ECHRNG 44 /* Channel number out of range */ -#define EL2NSYNC 45 /* Level 2 not synchronized */ -#define EL3HLT 46 /* Level 3 halted */ -#define EL3RST 47 /* Level 3 reset */ -#define ELNRNG 48 /* Link number out of range */ -#define EUNATCH 49 /* Protocol driver not attached */ -#define ENOCSI 50 /* No CSI structure available */ -#define EL2HLT 51 /* Level 2 halted */ -#define EBADE 52 /* Invalid exchange */ -#define EBADR 53 /* Invalid request descriptor */ -#define EXFULL 54 /* Exchange full */ -#define ENOANO 55 /* No anode */ -#define EBADRQC 56 /* Invalid request code */ -#define EBADSLT 57 /* Invalid slot */ - -#define EDEADLOCK EDEADLK - -#define EBFONT 59 /* Bad font file format */ -#define ENOSTR 60 /* Device not a stream */ -#define ENODATA 61 /* No data available */ -#define ETIME 62 /* Timer expired */ -#define ENOSR 63 /* Out of streams resources */ -#define ENONET 64 /* Machine is not on the network */ -#define ENOPKG 65 /* Package not installed */ -#define EREMOTE 66 /* Object is remote */ -#define ENOLINK 67 /* Link has been severed */ -#define EADV 68 /* Advertise error */ -#define ESRMNT 69 /* Srmount error */ -#define ECOMM 70 /* Communication error on send */ -#define EPROTO 71 /* Protocol error */ -#define EMULTIHOP 72 /* Multihop attempted */ -#define EDOTDOT 73 /* RFS specific error */ -#define EBADMSG 74 /* Not a data message */ -#define EOVERFLOW 75 /* Value too large for defined data type */ -#define ENOTUNIQ 76 /* Name not unique on network */ -#define EBADFD 77 /* File descriptor in bad state */ -#define EREMCHG 78 /* Remote address changed */ -#define ELIBACC 79 /* Can not access a needed shared library */ -#define ELIBBAD 80 /* Accessing a corrupted shared library */ -#define ELIBSCN 81 /* .lib section in a.out corrupted */ -#define ELIBMAX 82 /* Attempting to link in too many shared libraries */ -#define ELIBEXEC 83 /* Cannot exec a shared library directly */ -#define EILSEQ 84 /* Illegal byte sequence */ -#define ERESTART 85 /* Interrupted system call should be restarted */ -#define ESTRPIPE 86 /* Streams pipe error */ -#define EUSERS 87 /* Too many users */ -#define ENOTSOCK 88 /* Socket operation on non-socket */ -#define EDESTADDRREQ 89 /* Destination address required */ -#define EMSGSIZE 90 /* Message too long */ -#define EPROTOTYPE 91 /* Protocol wrong type for socket */ -#define ENOPROTOOPT 92 /* Protocol not available */ -#define EPROTONOSUPPORT 93 /* Protocol not supported */ -#define ESOCKTNOSUPPORT 94 /* Socket type not supported */ -#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ -#define EPFNOSUPPORT 96 /* Protocol family not supported */ -#define EAFNOSUPPORT 97 /* Address family not supported by protocol */ -#define EADDRINUSE 98 /* Address already in use */ -#define EADDRNOTAVAIL 99 /* Cannot assign requested address */ -#define ENETDOWN 100 /* Network is down */ -#define ENETUNREACH 101 /* Network is unreachable */ -#define ENETRESET 102 /* Network dropped connection because of reset */ -#define ECONNABORTED 103 /* Software caused connection abort */ -#define ECONNRESET 104 /* Connection reset by peer */ -#define ENOBUFS 105 /* No buffer space available */ -#define EISCONN 106 /* Transport endpoint is already connected */ -#define ENOTCONN 107 /* Transport endpoint is not connected */ -#define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */ -#define ETOOMANYREFS 109 /* Too many references: cannot splice */ -#define ETIMEDOUT 110 /* Connection timed out */ -#define ECONNREFUSED 111 /* Connection refused */ -#define EHOSTDOWN 112 /* Host is down */ -#define EHOSTUNREACH 113 /* No route to host */ -#define EALREADY 114 /* Operation already in progress */ -#define EINPROGRESS 115 /* Operation now in progress */ -#define ESTALE 116 /* Stale NFS file handle */ -#define EUCLEAN 117 /* Structure needs cleaning */ -#define ENOTNAM 118 /* Not a XENIX named type file */ -#define ENAVAIL 119 /* No XENIX semaphores available */ -#define EISNAM 120 /* Is a named type file */ -#define EREMOTEIO 121 /* Remote I/O error */ -#define EDQUOT 122 /* Quota exceeded */ - -#define ENOMEDIUM 123 /* No medium found */ -#define EMEDIUMTYPE 124 /* Wrong medium type */ - -#ifndef errno - extern int errno; -#endif - -#ifndef err_t -typedef int err_t; -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* _UBIXOS_ERRNO*/ diff --git a/include/sys/ubixos/exec.h b/include/sys/ubixos/exec.h deleted file mode 100644 index 3731eaf..0000000 --- a/include/sys/ubixos/exec.h +++ /dev/null @@ -1,40 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _UBIXOS_EXEC_H -#define _UBIXOS_EXEC_H - -#include -#include - -uint32_t execThread(void (*tproc)(void), uint32_t, char *); -void execFile(char *file, char **argv, char **envp, int console); - -int sys_exec(struct thread *, char *, char **, char **); - -#endif /* END _UBIXOS_EXEC_H */ diff --git a/include/sys/ubixos/fork.h b/include/sys/ubixos/fork.h deleted file mode 100644 index ad66125..0000000 --- a/include/sys/ubixos/fork.h +++ /dev/null @@ -1,38 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _UBIXOS_FORK_H -#define _UBIXOS_FORK_H - -#include -#include - -//void sysFork(); -int sysFork(struct thread *, void *); - -#endif /* END _UBIXOS_FORK_H */ diff --git a/include/sys/ubixos/init.h b/include/sys/ubixos/init.h deleted file mode 100644 index e837858..0000000 --- a/include/sys/ubixos/init.h +++ /dev/null @@ -1,65 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _UBIXOS_INIT_H -#define _UBIXOS_INIT_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -typedef int (*intFunctionPTR)(void); - -intFunctionPTR init_tasks[] = { static_constructors, i8259_init, idt_init, vitals_init, sysctl_init, vfs_init, sched_init, pit_init, atkbd_init, time_init, pci_init, devfs_init, tty_init, ufs_init, initHardDisk, initLNC, net_init }; - -//ne2k_init, -//ubixfs_init, -//fdc_init, - -int init_tasksTotal = sizeof(init_tasks) / sizeof(intFunctionPTR); - -#endif /* END _UBIXOS_INIT_H */ diff --git a/include/sys/ubixos/kmod.h b/include/sys/ubixos/kmod.h deleted file mode 100644 index 39a3660..0000000 --- a/include/sys/ubixos/kmod.h +++ /dev/null @@ -1,48 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _UBIXOS_KMOD_H -#define _UBIXOS_KMOD_H - -#include - -#define LD_START 0x1000000 - -typedef struct kmod_struct { - struct kmod_struct *next; - struct kmod_struct *prev; - uInt16 id; - uInt16 refs; - uInt32 address; - char name[128]; -} kmod_t; - -uInt32 kmod_load(const char *); -uInt32 kmod_add(const char *, const char *name); - -#endif diff --git a/include/sys/ubixos/kpanic.h b/include/sys/ubixos/kpanic.h deleted file mode 100644 index 3adc795..0000000 --- a/include/sys/ubixos/kpanic.h +++ /dev/null @@ -1,36 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _SYS_KPANIC_H -#define _SYS_KPANIC_H - -#define K_PANIC(msg) kpanic("Error: (%s), File: %s, Line: %i\n",msg ,__FILE__,__LINE__); - -void kpanic(const char *fmt, ...); - -#endif /* END _SYS_KPANIC_H */ diff --git a/include/sys/ubixos/ld.h b/include/sys/ubixos/ld.h deleted file mode 100644 index 2790ec4..0000000 --- a/include/sys/ubixos/ld.h +++ /dev/null @@ -1,38 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _UBIXOS_LD_H -#define _UBIXOS_LD_H - -#include - -#define LD_START 0xAAA00000 //0x1000000 - -uInt32 ldEnable(); - -#endif /* END _UBIXOS_LD_H */ diff --git a/include/sys/ubixos/lists.h b/include/sys/ubixos/lists.h deleted file mode 100644 index f730a52..0000000 --- a/include/sys/ubixos/lists.h +++ /dev/null @@ -1,69 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#define IN -#define STATUS_FAILURE -1 -#define STATUS_SUCCESS 0 - -typedef struct _item_t Item_t; -typedef struct _list_t List_t; -struct _item_t { - Item_t *Previous; - Item_t *Next; - void *data; -}; - -struct _list_t { - Item_t *First; - Item_t *Last; -}; - -List_t * -InitializeList(); -Item_t * -CreateItem(); -int -InsertItemAtFront( IN List_t * TList, IN Item_t * kItem); -int -InsertItemBetweenItems( IN List_t * TList, IN Item_t * Previous, IN Item_t * Next, IN Item_t * Insert); -int -RemoveItem( IN List_t * TList, IN Item_t * kItem); -int -DestroyItemsInList(IN List_t * ItemList); -int -DestroyItemList(IN List_t * ItemList); -Item_t * -GetFirstItem(IN List_t * kItem); - -Item_t * -GetLastItem(IN List_t * kItem); -List_t * -RemoveItemListBetweenItems( IN Item_t * Previous, IN Item_t * Next); - -void -InsertItemListBetweenItems( IN Item_t * Previous, IN Item_t * Next, IN List_t * Insert); diff --git a/include/sys/ubixos/sched.h b/include/sys/ubixos/sched.h deleted file mode 100644 index 3388bec..0000000 --- a/include/sys/ubixos/sched.h +++ /dev/null @@ -1,113 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _UBIXOS_SCHED_H -#define _UBIXOS_SCHED_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include - -#include -#include - -#define NO_GROUP -1 -#define NR_GROUPS 32 - -typedef enum { - PLACEHOLDER = -2, DEAD = -1, NEW = 0, READY = 1, RUNNING = 2, IDLE = 3, FORK = 4, WAIT = 5, UNINTERRUPTIBLE = 6, INTERRUPTIBLE = 7 -} tState; - -struct osInfo { - uInt8 timer; - uInt8 v86Task; - bool v86If; - uInt32 vmStart; - uInt32 stdinSize; - uInt32 controlKeys; - char *stdin; - char cwd[1024]; /* current working dir */ - uint8_t gpf; -}; - -typedef struct taskStruct { - pidType id; - char name[256]; - struct taskStruct *prev; - struct taskStruct *next; - struct tssStruct tss; - struct i387Struct i387; - struct osInfo oInfo; - //fileDescriptor *imageFd; - fileDescriptor_t *files[MAX_OFILES]; - tState state; - uint32_t uid, gid; - uint16_t euid, suid; - uint16_t egid, sgid; - uInt16 usedMath; - tty_term *term; - struct thread td; - struct { - struct inode *pwd; - struct inode *root; - struct inode *exec; - } inodes; - uint32_t counter; - uint16_t groups[NR_GROUPS]; - pidType ppid; - uint32_t pgrp; - uint32_t children; // Hack for WAIT - uint32_t last_exit; // Hack For WAIT - struct taskStruct *parent; -} kTask_t; - -int sched_init(); -int sched_setStatus(pidType, tState); -int sched_deleteTask(pidType); -int sched_addDelTask(kTask_t *); -kTask_t *sched_getDelTask(); -void sched_yield(); -void sched(); - -void schedEndTask(pidType pid); -kTask_t *schedNewTask(); -kTask_t *schedFindTask(uInt32 id); - -extern kTask_t *_current; -extern kTask_t *_usedMath; - -#ifdef __cplusplus -} -#endif - - -#endif diff --git a/include/sys/ubixos/sem.h b/include/sys/ubixos/sem.h deleted file mode 100644 index 7afd3de..0000000 --- a/include/sys/ubixos/sem.h +++ /dev/null @@ -1,58 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _UBIXOS_SEM_H -#define _UBIXOS_SEM_H - -#include -#include -#include - -struct sys_sem { - uint32_t signaled; - ubthread_cond_t cond; - ubthread_mutex_t mutex; -}; - -typedef struct sys_sem sys_sem_t; - -typedef uint32_t semID_t; -struct timespec; - -int sem_close(semID_t id); -int sem_post(semID_t id); -int sem_wait(semID_t id); -int sem_trywait(semID_t id); -int sem_timedwait(semID_t id, const struct timespec *); -int sem_init(sys_sem_t **, uint8_t); -int sem_open(semID_t *id, const char *name, int oflag, mode_t mode, unsigned int value); -int sem_unlink(const char *name); -int sem_getvalue(semID_t id, int *val); -int sem_destroy(sys_sem_t **); - -#endif /* END _UBIXOS_SEM_H */ diff --git a/include/sys/ubixos/smp.h b/include/sys/ubixos/smp.h deleted file mode 100644 index d4a630d..0000000 --- a/include/sys/ubixos/smp.h +++ /dev/null @@ -1,53 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _UBIXOS_SMP_H -#define _UBIXOS_SMP_H - -#include - -struct cpuinfo_t { - uInt8 id; - uInt8 ok; // 1=Ok, 0=Bad - uInt8 apic_id, apic_ver; - uInt32 signature; // Family, Model, Stepping - uInt32 feature; - uInt32 max; - char brand[49]; // Brand name - char ident[17]; -}; - -void smpInit(); -void cpuidDetect(); -uInt8 cpuInfo(); -uInt32 getEflags(); -void setEflags(uInt32); -void cpuid(uInt32, uInt32 *); -void apicMagic(); - -#endif diff --git a/include/sys/ubixos/spinlock.h b/include/sys/ubixos/spinlock.h deleted file mode 100644 index 2ebfa2a..0000000 --- a/include/sys/ubixos/spinlock.h +++ /dev/null @@ -1,96 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _UBIXOS_SPINLOCK_H -#define _UBIXOS_SPINLOCK_H - -#include - -#define LOCKED 1 -#define UNLOCKED 0 -#define SPIN_LOCK_INITIALIZER {NULL, 0} -#define LLOCK_FLAG 1 - -//typedef volatile int spinLock_t; - -struct spinLock { - struct spinLock *next; - uint32_t locked; -}; - -typedef struct spinLock *spinLock_t; - -extern struct spinLock Master; - -void spinLockInit(spinLock_t); -void spinUnlock(spinLock_t); -int spinTryLock(spinLock_t); -void spinLock(spinLock_t); - -void spinLock_scheduler(spinLock_t *); /* Only use this spinlock in the sched. */ - -int spinLockLocked(spinLock_t *); - -/* Atomic exchange (of various sizes) */ -static inline u_long xchg_64(volatile uint32_t *ptr, u_long x) { - __asm__ __volatile__("xchgq %1,%0" - :"+r" (x), - "+m" (*ptr)); - - return x; -} - -static inline unsigned xchg_32(volatile uint32_t *ptr, uint32_t x) { - __asm__ __volatile__("xchgl %1,%0" - :"+r" (x), - "+m" (*ptr)); - - return x; -} - -static inline unsigned short xchg_16(volatile uint32_t *ptr, uint16_t x) { - __asm__ __volatile__("xchgw %1,%0" - :"+r" (x), - "+m" (*ptr)); - - return x; -} - -/* Test and set a bit */ -static inline char atomic_bitsetandtest(void *ptr, int x) { - char out; - __asm__ __volatile__("lock; bts %2,%1\n" - "sbb %0,%0\n" - :"=r" (out), "=m" (*(volatile long long *)ptr) - :"Ir" (x) - :"memory"); - - return out; -} - -#endif diff --git a/include/sys/ubixos/static.h b/include/sys/ubixos/static.h deleted file mode 100644 index 59986ca..0000000 --- a/include/sys/ubixos/static.h +++ /dev/null @@ -1,34 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _UBIXOS_STATIC_H -#define _UBIXOS_STATIC_H - -int static_constructors(void); - -#endif diff --git a/include/sys/ubixos/syscall.h b/include/sys/ubixos/syscall.h deleted file mode 100644 index e824415..0000000 --- a/include/sys/ubixos/syscall.h +++ /dev/null @@ -1,39 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _UBIXOS_SYSCALL_H -#define _UBIXOS_SYSCALL_H - -#include - -void _sys_call(); -void sys_call(struct trapframe *frame); -int invalidCall(); -void invalidCallINT(int); - -#endif diff --git a/include/sys/ubixos/syscall_posix.h b/include/sys/ubixos/syscall_posix.h deleted file mode 100644 index 65b2f09..0000000 --- a/include/sys/ubixos/syscall_posix.h +++ /dev/null @@ -1,37 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _UBIXOS_SYSCALL_POSIX_H -#define _UBIXOS_SYSCALL_POSIX_H - -#include - -void _sys_call_posix(); -void sys_call_posix(struct trapframe *frame); - -#endif diff --git a/include/sys/ubixos/syscalls.h b/include/sys/ubixos/syscalls.h deleted file mode 100644 index 1336ac6..0000000 --- a/include/sys/ubixos/syscalls.h +++ /dev/null @@ -1,103 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _SYSCALLS_H -#define _SYSCALLS_H - -#include -#include -#include - -#define SYSCALLS_MAX 1024 - -#define PSL_C 0x00000001 /* carry bit */ -#define EJUSTRETURN (-2) /* don't modify regs, just return */ -#define ERESTART (-1) /* restart syscall */ - -#define ARG_COUNT(name) (sizeof(struct name) / sizeof(register_t)) - -#define SYSCALL_INVALID 0 -#define SYSCALL_VALID 1 -#define SYSCALL_DUMMY 2 -#define SYSCALL_NOTIMP 3 - -typedef int sys_call_t(struct thread *, void *); - -struct syscall_entry { - int sc_args; - char *sc_name; - sys_call_t *sc_entry; - int sc_status; -}; - -/* - * - * Old Style Calls Need Updates - * - */ -int sysAuth(); -int sysPasswd(); -int sysAddModule(); -int sysRmModule(); -int sysGetpid(); -int sysExit(); -int sysExec(); - -int sysCheckPid(); -int sysGetFreePage(); - -int sysFgetc(); -int sysFopen(); -int sysFclose(); -int sysFseek(); -int sysMkDir(); -int sysRmDir(); - -//int sysSDE(); -int sysGetDrives(); -int sysGetCwd(); -int sysChDir(); -int sysGetUptime(); -int sysGetTime(); -int sysStartSDE(); -int sysUnlink(); -int sysMpiCreateMbox(); -int sysMpiDestroyMbox(); -int sysMpiPostMessage(); -int sysMpiFetchMessage(); -int sysMpiSpam(); - -typedef int (*functionPTR)(); - -extern int totalCalls; -extern struct syscall_entry systemCalls[]; - -extern int totalCalls_posix; -extern struct syscall_entry systemCalls_posix[]; - -#endif diff --git a/include/sys/ubixos/syscalls_new.h b/include/sys/ubixos/syscalls_new.h deleted file mode 100644 index 706484e..0000000 --- a/include/sys/ubixos/syscalls_new.h +++ /dev/null @@ -1,531 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _SYSCALLS_NEW_H -#define _SYSCALLS_NEW_H - -#include - -int sysExit(); -int read(); -int getpid(); -int fcntl(); -int issetugid(); -int __sysctl(); -int pipe(); -int readlink(); -int getuid(); -int getgid(); -int close(); -int mmap(); -int obreak(); -int sigaction(); -int getdtablesize(); -int munmap(); -int sigprocmask(); -int gettimeofday_new(); -int fstat(); -int ioctl(); - -#define invalid_call 0x0 -#define PSL_C 0x00000001 /* carry bit */ -#define EJUSTRETURN (-2) /* don't modify regs, just return */ -#define ERESTART (-1) /* restart syscall */ - -typedef int (*functionPTR)(); - -/*! - * \brief Mast System Call List - */ -functionPTR systemCalls_new[] = { -invalid_call, /** 0 **/ -sysExit, /** 1 **/ -invalid_call, /** 2 **/ -read, /** 3 **/ -sys_write, /** 4 **/ -sys_open, /** 5 **/ -close, /** 6 **/ -invalid_call, /** 7 **/ -invalid_call, /** 8 **/ -invalid_call, /** 9 **/ -invalid_call, /** 10 **/ -invalid_call, /** 11 **/ -invalid_call, /** 12 **/ -invalid_call, /** 13 **/ -invalid_call, /** 14 **/ -invalid_call, /** 15 **/ -invalid_call, /** 16 **/ -obreak, /** 17 **/ -invalid_call, /** 18 **/ -invalid_call, /** 19 **/ -getpid, /** 20 **/ -invalid_call, /** 21 **/ -invalid_call, /** 22 **/ -invalid_call, /** 23 **/ -getuid, /** 24 **/ -invalid_call, /** 25 **/ -invalid_call, /** 26 **/ -invalid_call, /** 27 **/ -invalid_call, /** 28 **/ -invalid_call, /** 29 **/ -invalid_call, /** 30 **/ -invalid_call, /** 31 **/ -invalid_call, /** 32 **/ -access, /** 33 **/ -invalid_call, /** 34 **/ -invalid_call, /** 35 **/ -invalid_call, /** 36 **/ -invalid_call, /** 37 **/ -invalid_call, /** 38 **/ -invalid_call, /** 39 **/ -invalid_call, /** 40 **/ -invalid_call, /** 41 **/ -pipe, /** 42 **/ -invalid_call, /** 43 **/ -invalid_call, /** 44 **/ -invalid_call, /** 45 **/ -invalid_call, /** 46 **/ -getgid, /** 47 **/ -invalid_call, /** 48 **/ -invalid_call, /** 49 **/ -invalid_call, /** 50 **/ -invalid_call, /** 51 **/ -invalid_call, /** 52 **/ -invalid_call, /** 53 **/ -ioctl, /** 54 **/ -invalid_call, /** 55 **/ -invalid_call, /** 56 **/ -invalid_call, /** 57 **/ -readlink, /** 58 **/ -invalid_call, /** 59 **/ -invalid_call, /** 60 **/ -invalid_call, /** 61 **/ -invalid_call, /** 62 **/ -invalid_call, /** 63 **/ -invalid_call, /** 64 **/ -invalid_call, /** 65 **/ -invalid_call, /** 66 **/ -invalid_call, /** 67 **/ -invalid_call, /** 68 **/ -invalid_call, /** 69 **/ -invalid_call, /** 70 **/ -invalid_call, /** 71 **/ -invalid_call, /** 72 **/ -munmap, /** 73 **/ -mprotect, /** 74 **/ -invalid_call, /** 75 **/ -invalid_call, /** 76 **/ -invalid_call, /** 77 **/ -invalid_call, /** 78 **/ -invalid_call, /** 79 **/ -invalid_call, /** 80 **/ -invalid_call, /** 81 **/ -invalid_call, /** 82 **/ -setitimer, /** 83 **/ -invalid_call, /** 84 **/ -invalid_call, /** 85 **/ -invalid_call, /** 86 **/ -invalid_call, /** 87 **/ -invalid_call, /** 88 **/ -getdtablesize, /** 89 **/ -invalid_call, /** 90 **/ -invalid_call, /** 91 **/ -fcntl, /** 92 **/ -invalid_call, /** 93 **/ -invalid_call, /** 94 **/ -invalid_call, /** 95 **/ -invalid_call, /** 96 **/ -invalid_call, /** 97 **/ -invalid_call, /** 98 **/ -invalid_call, /** 99 **/ -invalid_call, /** 100 **/ -invalid_call, /** 101 **/ -invalid_call, /** 102 **/ -invalid_call, /** 103 **/ -invalid_call, /** 104 **/ -invalid_call, /** 105 **/ -invalid_call, /** 106 **/ -invalid_call, /** 107 **/ -invalid_call, /** 108 **/ -invalid_call, /** 109 **/ -invalid_call, /** 110 **/ -invalid_call, /** 111 **/ -invalid_call, /** 112 **/ -invalid_call, /** 113 **/ -invalid_call, /** 114 **/ -invalid_call, /** 115 **/ -gettimeofday_new, /** 116 **/ -invalid_call, /** 117 **/ -invalid_call, /** 118 **/ -invalid_call, /** 119 **/ -invalid_call, /** 120 **/ -invalid_call, /** 121 **/ -invalid_call, /** 122 **/ -invalid_call, /** 123 **/ -invalid_call, /** 124 **/ -invalid_call, /** 125 **/ -invalid_call, /** 126 **/ -invalid_call, /** 127 **/ -invalid_call, /** 128 **/ -invalid_call, /** 129 **/ -invalid_call, /** 130 **/ -invalid_call, /** 131 **/ -invalid_call, /** 132 **/ -invalid_call, /** 133 **/ -invalid_call, /** 134 **/ -invalid_call, /** 135 **/ -invalid_call, /** 136 **/ -invalid_call, /** 137 **/ -invalid_call, /** 138 **/ -invalid_call, /** 139 **/ -invalid_call, /** 140 **/ -invalid_call, /** 141 **/ -invalid_call, /** 142 **/ -invalid_call, /** 143 **/ -invalid_call, /** 144 **/ -invalid_call, /** 145 **/ -invalid_call, /** 146 **/ -invalid_call, /** 147 **/ -invalid_call, /** 148 **/ -invalid_call, /** 149 **/ -invalid_call, /** 150 **/ -invalid_call, /** 151 **/ -invalid_call, /** 152 **/ -invalid_call, /** 153 **/ -invalid_call, /** 154 **/ -invalid_call, /** 155 **/ -invalid_call, /** 156 **/ -invalid_call, /** 157 **/ -invalid_call, /** 158 **/ -invalid_call, /** 159 **/ -invalid_call, /** 160 **/ -invalid_call, /** 161 **/ -invalid_call, /** 162 **/ -invalid_call, /** 163 **/ -invalid_call, /** 164 **/ -invalid_call, /** 165 **/ -invalid_call, /** 166 **/ -invalid_call, /** 167 **/ -invalid_call, /** 168 **/ -invalid_call, /** 169 **/ -invalid_call, /** 170 **/ -invalid_call, /** 171 **/ -invalid_call, /** 172 **/ -invalid_call, /** 173 **/ -invalid_call, /** 174 **/ -invalid_call, /** 175 **/ -invalid_call, /** 176 **/ -invalid_call, /** 177 **/ -invalid_call, /** 178 **/ -invalid_call, /** 179 **/ -invalid_call, /** 180 **/ -invalid_call, /** 181 **/ -invalid_call, /** 182 **/ -invalid_call, /** 183 **/ -invalid_call, /** 184 **/ -invalid_call, /** 185 **/ -invalid_call, /** 186 **/ -invalid_call, /** 187 **/ -invalid_call, /** 188 **/ -fstat, /** 189 **/ -invalid_call, /** 190 **/ -invalid_call, /** 191 **/ -invalid_call, /** 192 **/ -invalid_call, /** 193 **/ -invalid_call, /** 194 **/ -invalid_call, /** 195 **/ -invalid_call, /** 196 **/ -mmap, /** 197 **/ -invalid_call, /** 198 **/ -invalid_call, /** 199 **/ -invalid_call, /** 200 **/ -invalid_call, /** 201 **/ -__sysctl, /** 202 **/ -invalid_call, /** 203 **/ -invalid_call, /** 204 **/ -invalid_call, /** 205 **/ -invalid_call, /** 206 **/ -invalid_call, /** 207 **/ -invalid_call, /** 208 **/ -invalid_call, /** 209 **/ -invalid_call, /** 210 **/ -invalid_call, /** 211 **/ -invalid_call, /** 212 **/ -invalid_call, /** 213 **/ -invalid_call, /** 214 **/ -invalid_call, /** 215 **/ -invalid_call, /** 216 **/ -invalid_call, /** 217 **/ -invalid_call, /** 218 **/ -invalid_call, /** 219 **/ -invalid_call, /** 220 **/ -invalid_call, /** 221 **/ -invalid_call, /** 222 **/ -invalid_call, /** 223 **/ -invalid_call, /** 224 **/ -invalid_call, /** 225 **/ -invalid_call, /** 226 **/ -invalid_call, /** 227 **/ -invalid_call, /** 228 **/ -invalid_call, /** 229 **/ -invalid_call, /** 230 **/ -invalid_call, /** 231 **/ -invalid_call, /** 232 **/ -invalid_call, /** 233 **/ -invalid_call, /** 234 **/ -invalid_call, /** 235 **/ -invalid_call, /** 236 **/ -invalid_call, /** 237 **/ -invalid_call, /** 238 **/ -invalid_call, /** 239 **/ -invalid_call, /** 240 **/ -invalid_call, /** 241 **/ -invalid_call, /** 242 **/ -invalid_call, /** 243 **/ -invalid_call, /** 244 **/ -invalid_call, /** 245 **/ -invalid_call, /** 246 **/ -invalid_call, /** 247 **/ -invalid_call, /** 248 **/ -invalid_call, /** 249 **/ -invalid_call, /** 250 **/ -invalid_call, /** 251 **/ -invalid_call, /** 252 **/ -issetugid, /** 253 **/ -invalid_call, /** 254 **/ -invalid_call, /** 255 **/ -invalid_call, /** 256 **/ -invalid_call, /** 257 **/ -invalid_call, /** 258 **/ -invalid_call, /** 259 **/ -invalid_call, /** 260 **/ -invalid_call, /** 261 **/ -invalid_call, /** 262 **/ -invalid_call, /** 263 **/ -invalid_call, /** 264 **/ -invalid_call, /** 265 **/ -invalid_call, /** 266 **/ -invalid_call, /** 267 **/ -invalid_call, /** 268 **/ -invalid_call, /** 269 **/ -invalid_call, /** 270 **/ -invalid_call, /** 271 **/ -invalid_call, /** 272 **/ -invalid_call, /** 273 **/ -invalid_call, /** 274 **/ -invalid_call, /** 275 **/ -invalid_call, /** 276 **/ -invalid_call, /** 277 **/ -invalid_call, /** 278 **/ -invalid_call, /** 279 **/ -invalid_call, /** 280 **/ -invalid_call, /** 281 **/ -invalid_call, /** 282 **/ -invalid_call, /** 283 **/ -invalid_call, /** 284 **/ -invalid_call, /** 285 **/ -invalid_call, /** 286 **/ -invalid_call, /** 287 **/ -invalid_call, /** 288 **/ -invalid_call, /** 289 **/ -invalid_call, /** 290 **/ -invalid_call, /** 291 **/ -invalid_call, /** 292 **/ -invalid_call, /** 293 **/ -invalid_call, /** 294 **/ -invalid_call, /** 295 **/ -invalid_call, /** 296 **/ -invalid_call, /** 297 **/ -invalid_call, /** 298 **/ -invalid_call, /** 299 **/ -invalid_call, /** 300 **/ -invalid_call, /** 301 **/ -invalid_call, /** 302 **/ -invalid_call, /** 303 **/ -invalid_call, /** 304 **/ -invalid_call, /** 305 **/ -invalid_call, /** 306 **/ -invalid_call, /** 307 **/ -invalid_call, /** 308 **/ -invalid_call, /** 309 **/ -invalid_call, /** 310 **/ -invalid_call, /** 311 **/ -invalid_call, /** 312 **/ -invalid_call, /** 313 **/ -invalid_call, /** 314 **/ -invalid_call, /** 315 **/ -invalid_call, /** 316 **/ -invalid_call, /** 317 **/ -invalid_call, /** 318 **/ -invalid_call, /** 319 **/ -invalid_call, /** 320 **/ -invalid_call, /** 321 **/ -invalid_call, /** 322 **/ -invalid_call, /** 323 **/ -invalid_call, /** 324 **/ -invalid_call, /** 325 **/ -invalid_call, /** 326 **/ -invalid_call, /** 327 **/ -invalid_call, /** 328 **/ -invalid_call, /** 329 **/ -invalid_call, /** 330 **/ -invalid_call, /** 331 **/ -invalid_call, /** 332 **/ -invalid_call, /** 333 **/ -invalid_call, /** 334 **/ -invalid_call, /** 335 **/ -invalid_call, /** 336 **/ -invalid_call, /** 337 **/ -invalid_call, /** 338 **/ -invalid_call, /** 339 **/ -sigprocmask, /** 340 **/ -invalid_call, /** 341 **/ -invalid_call, /** 342 **/ -invalid_call, /** 343 **/ -invalid_call, /** 344 **/ -invalid_call, /** 345 **/ -invalid_call, /** 346 **/ -invalid_call, /** 347 **/ -invalid_call, /** 348 **/ -invalid_call, /** 349 **/ -invalid_call, /** 350 **/ -invalid_call, /** 351 **/ -invalid_call, /** 352 **/ -invalid_call, /** 353 **/ -invalid_call, /** 354 **/ -invalid_call, /** 355 **/ -invalid_call, /** 356 **/ -invalid_call, /** 357 **/ -invalid_call, /** 358 **/ -invalid_call, /** 359 **/ -invalid_call, /** 360 **/ -invalid_call, /** 361 **/ -invalid_call, /** 362 **/ -invalid_call, /** 363 **/ -invalid_call, /** 364 **/ -invalid_call, /** 365 **/ -invalid_call, /** 366 **/ -invalid_call, /** 367 **/ -invalid_call, /** 368 **/ -invalid_call, /** 369 **/ -invalid_call, /** 370 **/ -invalid_call, /** 371 **/ -invalid_call, /** 372 **/ -invalid_call, /** 373 **/ -invalid_call, /** 374 **/ -invalid_call, /** 375 **/ -invalid_call, /** 376 **/ -invalid_call, /** 377 **/ -invalid_call, /** 378 **/ -invalid_call, /** 379 **/ -invalid_call, /** 380 **/ -invalid_call, /** 381 **/ -invalid_call, /** 382 **/ -invalid_call, /** 383 **/ -invalid_call, /** 384 **/ -invalid_call, /** 385 **/ -invalid_call, /** 386 **/ -invalid_call, /** 387 **/ -invalid_call, /** 388 **/ -invalid_call, /** 389 **/ -invalid_call, /** 390 **/ -invalid_call, /** 391 **/ -invalid_call, /** 392 **/ -invalid_call, /** 393 **/ -invalid_call, /** 394 **/ -invalid_call, /** 395 **/ -invalid_call, /** 396 **/ -fstatfs, /** 397 **/ -invalid_call, /** 398 **/ -invalid_call, /** 399 **/ -invalid_call, /** 400 **/ -invalid_call, /** 401 **/ -invalid_call, /** 402 **/ -invalid_call, /** 403 **/ -invalid_call, /** 404 **/ -invalid_call, /** 405 **/ -invalid_call, /** 406 **/ -invalid_call, /** 407 **/ -invalid_call, /** 408 **/ -invalid_call, /** 409 **/ -invalid_call, /** 410 **/ -invalid_call, /** 411 **/ -invalid_call, /** 412 **/ -invalid_call, /** 413 **/ -invalid_call, /** 414 **/ -invalid_call, /** 415 **/ -sigaction, /** 416 **/ -invalid_call, /** 417 **/ -invalid_call, /** 418 **/ -invalid_call, /** 419 **/ -invalid_call, /** 420 **/ -invalid_call, /** 421 **/ -invalid_call, /** 422 **/ -invalid_call, /** 423 **/ -invalid_call, /** 424 **/ -invalid_call, /** 425 **/ -invalid_call, /** 426 **/ -invalid_call, /** 427 **/ -invalid_call, /** 428 **/ -invalid_call, /** 429 **/ -invalid_call, /** 430 **/ -invalid_call, /** 431 **/ -invalid_call, /** 432 **/ -invalid_call, /** 433 **/ -invalid_call, /** 434 **/ -invalid_call, /** 435 **/ -invalid_call, /** 436 **/ -invalid_call, /** 437 **/ -invalid_call, /** 438 **/ -invalid_call, /** 439 **/ -invalid_call, /** 440 **/ -invalid_call, /** 441 **/ -invalid_call, /** 442 **/ -invalid_call, /** 443 **/ -invalid_call, /** 444 **/ -invalid_call, /** 445 **/ -invalid_call, /** 446 **/ -invalid_call, /** 447 **/ -invalid_call, /** 448 **/ -invalid_call, /** 449 **/ -invalid_call, /** 450 **/ -invalid_call, /** 451 **/ -invalid_call, /** 452 **/ -invalid_call, /** 453 **/ -invalid_call, /** 454 **/ -invalid_call, /** 455 **/ -}; - -int totalCalls_new = sizeof(systemCalls_new) / sizeof(functionPTR); - -#endif - -/*** - END - ***/ - diff --git a/include/sys/ubixos/systemtask.h b/include/sys/ubixos/systemtask.h deleted file mode 100644 index 22589b1..0000000 --- a/include/sys/ubixos/systemtask.h +++ /dev/null @@ -1,60 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _SYSTEMTASK_H -#define _SYSTEMTASK_H - -#include - -void systemTask(); - -#endif - -/*** - $Log: systemtask.h,v $ - Revision 1.1.1.1 2006/06/01 12:46:14 reddawg - ubix2 - - Revision 1.2 2005/10/12 00:13:37 reddawg - Removed - - Revision 1.1.1.1 2005/09/26 17:23:56 reddawg - no message - - Revision 1.2 2004/06/04 17:49:32 reddawg - Wont work with out the makefile updated - - Revision 1.1 2004/06/04 17:33:33 reddawg - Changed idle task to system task - - Revision 1.2 2004/05/21 15:20:00 reddawg - Cleaned up - - - END - ***/ diff --git a/include/sys/ubixos/time.h b/include/sys/ubixos/time.h deleted file mode 100644 index d9ab30d..0000000 --- a/include/sys/ubixos/time.h +++ /dev/null @@ -1,89 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _UBIXOS_TIME_H -#define _UBIXOS_TIME_H - -#include -#include -#include - -typedef long suseconds_t; - -#define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10) - -#define MINUTE 60 -#define HOUR (60*MINUTE) -#define DAY (24*HOUR) -#define YEAR (365*DAY) - - -struct timeStruct { - int sec; - int min; - int hour; - int day; - int mon; - int year; -}; - -struct timezone { - int tz_minuteswest; /* minutes west of Greenwich */ - int tz_dsttime; /* type of dst correction */ -}; - -int gettimeofday(struct timeval *tp, struct timezone *tzp); - -int time_init(); -uInt32 timeMake(struct timeStruct *time); - -#endif - -/*** - $Log: time.h,v $ - Revision 1.1.1.1 2006/06/01 12:46:14 reddawg - ubix2 - - Revision 1.2 2005/10/12 00:13:37 reddawg - Removed - - Revision 1.1.1.1 2005/09/26 17:23:56 reddawg - no message - - Revision 1.4 2004/07/09 13:37:30 reddawg - time: timeInit to time_init - Adjusted initialization routines - - Revision 1.3 2004/06/29 11:41:44 reddawg - Fixed some global variables - - Revision 1.2 2004/05/21 15:20:00 reddawg - Cleaned up - - END - ***/ diff --git a/include/sys/ubixos/times.h b/include/sys/ubixos/times.h deleted file mode 100644 index eb575b1..0000000 --- a/include/sys/ubixos/times.h +++ /dev/null @@ -1,64 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _TIMES_H -#define _TIMES_H - -#include - -#ifndef _CLOCK_T_DECLARED -typedef __clock_t clock_t; -#define _CLOCK_T_DECLARED -#endif - -struct tms { - clock_t tms_utime; /* User CPU time */ - clock_t tms_stime; /* System CPU time */ - clock_t tms_cutime; /* User CPU time of terminated child procs */ - clock_t tms_cstime; /* System CPU time of terminated child procs */ -}; - -#endif - -/*** - $Log: times.h,v $ - Revision 1.1.1.1 2006/06/01 12:46:14 reddawg - ubix2 - - Revision 1.2 2005/10/12 00:13:37 reddawg - Removed - - Revision 1.1.1.1 2005/09/26 17:23:57 reddawg - no message - - Revision 1.2 2004/05/21 15:20:00 reddawg - Cleaned up - - - END - ***/ diff --git a/include/sys/ubixos/tty.h b/include/sys/ubixos/tty.h deleted file mode 100644 index 4389db6..0000000 --- a/include/sys/ubixos/tty.h +++ /dev/null @@ -1,54 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _UBIXOS_TTY_H -#define _UBIXOS_TTY_H - -#include - -#define TTY_MAX_TERMS 5 - -typedef struct tty_termNode { - char *tty_buffer; - char *tty_pointer; - uint8_t tty_colour; - uint16_t tty_x; - uint16_t tty_y; - pidType owner; - char stdin[512]; - int stdinSize; -} tty_term; - -int tty_init(); -int tty_change(uInt16); -tty_term *tty_find(uInt16); -int tty_print(char *, tty_term *); - -extern tty_term *tty_foreground; - -#endif diff --git a/include/sys/ubixos/ubthread.h b/include/sys/ubixos/ubthread.h deleted file mode 100644 index 26a07f4..0000000 --- a/include/sys/ubixos/ubthread.h +++ /dev/null @@ -1,86 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _UBTHREAD_H -#define _UBTHREAD_H - -#include -#include -#include - -#define LOCKED 1 -#define UNLOCKED 0 - -typedef struct ubthread *ubthread_t; -typedef struct ubthread_cond *ubthread_cond_t; -typedef struct ubthread_mutex *ubthread_mutex_t; - -struct ubthread { - struct taskStruct *task; -}; - -struct ubthread_cond { - int id; - bool lock; -}; - -struct ubthread_mutex { - int id; - bool lock; - pidType pid; -}; - -struct ubthread_list { - struct ubthread_list *next; - ubthread_t thread; -}; - -struct ubthread_cond_list { - struct ubthread_cond_list *next; - ubthread_cond_t *cond; -}; - -struct ubthread_mutex_list { - struct ubthread_mutex_list *next; - ubthread_mutex_t *mutex; -}; - -struct taskStruct *ubthread_self(); -int ubthread_cond_init(ubthread_cond_t *cond, const uInt32 attr); -int ubthread_mutex_init(ubthread_mutex_t *mutex, const uInt32 attr); -int ubthread_cond_destroy(ubthread_cond_t *cond); -int ubthread_mutex_destroy(ubthread_mutex_t *mutex); -int ubthread_create(struct taskStruct **thread, const uInt32 *attr, void (*tproc)(void), void *arg); -int ubthread_mutex_lock(ubthread_mutex_t *mutex); -int ubthread_mutex_unlock(ubthread_mutex_t *mutex); -int ubthread_cond_timedwait(ubthread_cond_t *cond, ubthread_mutex_t *mutex, const struct timespec *abstime); -int ubthread_cond_wait(ubthread_cond_t *cond, ubthread_mutex_t *mutex); -int ubthread_cond_signal(ubthread_cond_t *cond); -int ubthread_cond_broadcast(ubthread_cond_t *cond); - -#endif diff --git a/include/sys/ubixos/uthread.h b/include/sys/ubixos/uthread.h deleted file mode 100644 index ac8b160..0000000 --- a/include/sys/ubixos/uthread.h +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _UBIXOS_UTHREAD_H -#define _UBIXOS_UTHREAD_H - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - - struct uthread { - struct uthread *uthread_pointer; - size_t uthread_size; - unsigned long uthread_flags; - void *tls_master_mmap; - size_t tls_master_size; - size_t tls_master_align; - void *tls_mmap; - size_t stack_size; - void *arg_mmap; - size_t arg_size; - size_t __uthread_reserved[4]; - }; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/include/sys/ubixos/vitals.h b/include/sys/ubixos/vitals.h deleted file mode 100644 index 8c81915..0000000 --- a/include/sys/ubixos/vitals.h +++ /dev/null @@ -1,58 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _UBIXOS_VITALS_H -#define _UBIXOS_VITALS_H - -#include -#include -#include - -typedef struct vitalsStruct { - uint32_t sysTicks; // 0 - Do Not Change Order - uint32_t sysUptime; // 4 - Do Not Change Order - uint32_t quantum; // 8 - Do Not Change Order - uint32_t dQuantum; // 12 - Do Not Change Order - uint32_t openFiles; - uint32_t lastFD; - uint32_t freePages; - struct fileSystem *fileSystems; - struct vfs_mountPoint *mountPoints; - uint32_t timeStart; - void *screen; - void *font; - char *packet; - uint32_t packetLength; -} vitalsNode; - -extern vitalsNode *systemVitals; -extern spinLock_t vitals_lock; - -int vitals_init(); - -#endif diff --git a/include/sys/ubixos/wait.h b/include/sys/ubixos/wait.h deleted file mode 100644 index 9c9f703..0000000 --- a/include/sys/ubixos/wait.h +++ /dev/null @@ -1,52 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _UBIXOS_WAIT_H -#define _UBIXOS_WAIT_H - -struct taskStruct; - -struct wait_queue { - struct taskStruct *task; - struct wait_queue *next; -}; - -struct semaphore { - int sount; - struct wait_queue *wait; -}; - -#define sti() __asm__ __volatile__ ("sti": : :"memory") -#define cli() __asm__ __volatile__ ("cli": : :"memory") -#define nop() __asm__ __volatile__ ("nop") - -#define save_flags(x) __asm__ __volatile__("pushfl ; popl %0":"=r" (x): /* no input */ :"memory") - -#define restore_flags(x) __asm__ __volatile__("pushl %0 ; popfl": /* no output */ :"r" (x):"memory") - -#endif diff --git a/include/ubixos/access.h b/include/ubixos/access.h new file mode 100644 index 0000000..773102a --- /dev/null +++ b/include/ubixos/access.h @@ -0,0 +1,49 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _UBIXOS_ACCESS_H +#define _UBIXOS_ACCESS_H + +#include + +struct sys_setUID_args { + uint32_t uid; +}; + +struct sys_setGID_args { + uint32_t gid; +}; + +int sys_getUID(struct thread *, void *); +int sys_getEUID(struct thread *, void *); +int sys_setUID(struct thread *, struct sys_setUID_args *); + +int sys_getGID(struct thread *, void *); +int sys_setGID(struct thread *, struct sys_setGID_args *); + +#endif /* END _UBIXOS_ACCESS_H */ diff --git a/include/ubixos/bcd.h b/include/ubixos/bcd.h new file mode 100644 index 0000000..be97ca9 --- /dev/null +++ b/include/ubixos/bcd.h @@ -0,0 +1,45 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _UBIXOS_BCD_H_ +#define _UBIXOS_BCD_H_ + + +/* XXX Putting this here for now as I'm not sure where is the best place for them yet. */ +#define toupper(c) ((c) - 0x20 * (((c) >= 'a') && ((c) <= 'z'))) +#define tolower(c) ((c) + 0x20 * (((c) >= 'A') && ((c) <= 'Z'))) + +extern const u_char bcd2bin_data[]; +extern const u_char bin2bcd_data[]; +extern char const hex2ascii_data[]; + +#define bcd2bin(bcd) (bcd2bin_data[bcd]) +#define bin2bcd(bin) (bin2bcd_data[bin]) +#define hex2ascii(hex) (hex2ascii_data[hex]) + +#endif /* !_UBIXOS_BCD_H_ */ diff --git a/include/ubixos/endtask.h b/include/ubixos/endtask.h new file mode 100644 index 0000000..998623e --- /dev/null +++ b/include/ubixos/endtask.h @@ -0,0 +1,37 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _UBIXOS_ENDTASK_H +#define _UBIXOS_ENDTASK_H + +#include +#include + +void endTask(pidType); + +#endif /* END _UBIXOS_ENDTASK_H */ diff --git a/include/ubixos/errno.h b/include/ubixos/errno.h new file mode 100644 index 0000000..04aa285 --- /dev/null +++ b/include/ubixos/errno.h @@ -0,0 +1,177 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _UBIXOS_ERRNO_H +#define _UBIXOS_ERRNO_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define ENOERR 0 /* No Error */ +#define EPERM 1 /* Operation not permitted */ +#define ENOENT 2 /* No such file or directory */ +#define ESRCH 3 /* No such process */ +#define EINTR 4 /* Interrupted system call */ +#define EIO 5 /* I/O error */ +#define ENXIO 6 /* No such device or address */ +#define E2BIG 7 /* Arg list too long */ +#define ENOEXEC 8 /* Exec format error */ +#define EBADF 9 /* Bad file number */ +#define ECHILD 10 /* No child processes */ +#define EAGAIN 11 /* Try again */ +#define ENOMEM 12 /* Out of memory */ +#define EACCES 13 /* Permission denied */ +#define EFAULT 14 /* Bad address */ +#define ENOTBLK 15 /* Block device required */ +#define EBUSY 16 /* Device or resource busy */ +#define EEXIST 17 /* File exists */ +#define EXDEV 18 /* Cross-device link */ +#define ENODEV 19 /* No such device */ +#define ENOTDIR 20 /* Not a directory */ +#define EISDIR 21 /* Is a directory */ +#define EINVAL 22 /* Invalid argument */ +#define ENFILE 23 /* File table overflow */ +#define EMFILE 24 /* Too many open files */ +#define ENOTTY 25 /* Not a typewriter */ +#define ETXTBSY 26 /* Text file busy */ +#define EFBIG 27 /* File too large */ +#define ENOSPC 28 /* No space left on device */ +#define ESPIPE 29 /* Illegal seek */ +#define EROFS 30 /* Read-only file system */ +#define EMLINK 31 /* Too many links */ +#define EPIPE 32 /* Broken pipe */ +#define EDOM 33 /* Math argument out of domain of func */ +#define ERANGE 34 /* Math result not representable */ +#define EDEADLK 35 /* Resource deadlock would occur */ +#define ENAMETOOLONG 36 /* File name too long */ +#define ENOLCK 37 /* No record locks available */ +#define ENOSYS 38 /* Function not implemented */ +#define ENOTEMPTY 39 /* Directory not empty */ +#define ELOOP 40 /* Too many symbolic links encountered */ +#define EWOULDBLOCK EAGAIN /* Operation would block */ +#define ENOMSG 42 /* No message of desired type */ +#define EIDRM 43 /* Identifier removed */ +#define ECHRNG 44 /* Channel number out of range */ +#define EL2NSYNC 45 /* Level 2 not synchronized */ +#define EL3HLT 46 /* Level 3 halted */ +#define EL3RST 47 /* Level 3 reset */ +#define ELNRNG 48 /* Link number out of range */ +#define EUNATCH 49 /* Protocol driver not attached */ +#define ENOCSI 50 /* No CSI structure available */ +#define EL2HLT 51 /* Level 2 halted */ +#define EBADE 52 /* Invalid exchange */ +#define EBADR 53 /* Invalid request descriptor */ +#define EXFULL 54 /* Exchange full */ +#define ENOANO 55 /* No anode */ +#define EBADRQC 56 /* Invalid request code */ +#define EBADSLT 57 /* Invalid slot */ + +#define EDEADLOCK EDEADLK + +#define EBFONT 59 /* Bad font file format */ +#define ENOSTR 60 /* Device not a stream */ +#define ENODATA 61 /* No data available */ +#define ETIME 62 /* Timer expired */ +#define ENOSR 63 /* Out of streams resources */ +#define ENONET 64 /* Machine is not on the network */ +#define ENOPKG 65 /* Package not installed */ +#define EREMOTE 66 /* Object is remote */ +#define ENOLINK 67 /* Link has been severed */ +#define EADV 68 /* Advertise error */ +#define ESRMNT 69 /* Srmount error */ +#define ECOMM 70 /* Communication error on send */ +#define EPROTO 71 /* Protocol error */ +#define EMULTIHOP 72 /* Multihop attempted */ +#define EDOTDOT 73 /* RFS specific error */ +#define EBADMSG 74 /* Not a data message */ +#define EOVERFLOW 75 /* Value too large for defined data type */ +#define ENOTUNIQ 76 /* Name not unique on network */ +#define EBADFD 77 /* File descriptor in bad state */ +#define EREMCHG 78 /* Remote address changed */ +#define ELIBACC 79 /* Can not access a needed shared library */ +#define ELIBBAD 80 /* Accessing a corrupted shared library */ +#define ELIBSCN 81 /* .lib section in a.out corrupted */ +#define ELIBMAX 82 /* Attempting to link in too many shared libraries */ +#define ELIBEXEC 83 /* Cannot exec a shared library directly */ +#define EILSEQ 84 /* Illegal byte sequence */ +#define ERESTART 85 /* Interrupted system call should be restarted */ +#define ESTRPIPE 86 /* Streams pipe error */ +#define EUSERS 87 /* Too many users */ +#define ENOTSOCK 88 /* Socket operation on non-socket */ +#define EDESTADDRREQ 89 /* Destination address required */ +#define EMSGSIZE 90 /* Message too long */ +#define EPROTOTYPE 91 /* Protocol wrong type for socket */ +#define ENOPROTOOPT 92 /* Protocol not available */ +#define EPROTONOSUPPORT 93 /* Protocol not supported */ +#define ESOCKTNOSUPPORT 94 /* Socket type not supported */ +#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ +#define EPFNOSUPPORT 96 /* Protocol family not supported */ +#define EAFNOSUPPORT 97 /* Address family not supported by protocol */ +#define EADDRINUSE 98 /* Address already in use */ +#define EADDRNOTAVAIL 99 /* Cannot assign requested address */ +#define ENETDOWN 100 /* Network is down */ +#define ENETUNREACH 101 /* Network is unreachable */ +#define ENETRESET 102 /* Network dropped connection because of reset */ +#define ECONNABORTED 103 /* Software caused connection abort */ +#define ECONNRESET 104 /* Connection reset by peer */ +#define ENOBUFS 105 /* No buffer space available */ +#define EISCONN 106 /* Transport endpoint is already connected */ +#define ENOTCONN 107 /* Transport endpoint is not connected */ +#define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */ +#define ETOOMANYREFS 109 /* Too many references: cannot splice */ +#define ETIMEDOUT 110 /* Connection timed out */ +#define ECONNREFUSED 111 /* Connection refused */ +#define EHOSTDOWN 112 /* Host is down */ +#define EHOSTUNREACH 113 /* No route to host */ +#define EALREADY 114 /* Operation already in progress */ +#define EINPROGRESS 115 /* Operation now in progress */ +#define ESTALE 116 /* Stale NFS file handle */ +#define EUCLEAN 117 /* Structure needs cleaning */ +#define ENOTNAM 118 /* Not a XENIX named type file */ +#define ENAVAIL 119 /* No XENIX semaphores available */ +#define EISNAM 120 /* Is a named type file */ +#define EREMOTEIO 121 /* Remote I/O error */ +#define EDQUOT 122 /* Quota exceeded */ + +#define ENOMEDIUM 123 /* No medium found */ +#define EMEDIUMTYPE 124 /* Wrong medium type */ + +#ifndef errno + extern int errno; +#endif + +#ifndef err_t +typedef int err_t; +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _UBIXOS_ERRNO*/ diff --git a/include/ubixos/exec.h b/include/ubixos/exec.h new file mode 100644 index 0000000..3731eaf --- /dev/null +++ b/include/ubixos/exec.h @@ -0,0 +1,40 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _UBIXOS_EXEC_H +#define _UBIXOS_EXEC_H + +#include +#include + +uint32_t execThread(void (*tproc)(void), uint32_t, char *); +void execFile(char *file, char **argv, char **envp, int console); + +int sys_exec(struct thread *, char *, char **, char **); + +#endif /* END _UBIXOS_EXEC_H */ diff --git a/include/ubixos/fork.h b/include/ubixos/fork.h new file mode 100644 index 0000000..ad66125 --- /dev/null +++ b/include/ubixos/fork.h @@ -0,0 +1,38 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _UBIXOS_FORK_H +#define _UBIXOS_FORK_H + +#include +#include + +//void sysFork(); +int sysFork(struct thread *, void *); + +#endif /* END _UBIXOS_FORK_H */ diff --git a/include/ubixos/init.h b/include/ubixos/init.h new file mode 100644 index 0000000..5eebbfe --- /dev/null +++ b/include/ubixos/init.h @@ -0,0 +1,65 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _UBIXOS_INIT_H +#define _UBIXOS_INIT_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +typedef int (*intFunctionPTR)(void); + +intFunctionPTR init_tasks[] = { static_constructors, i8259_init, idt_init, vitals_init, sysctl_init, vfs_init, sched_init, pit_init, atkbd_init, time_init, pci_init, devfs_init, tty_init, ufs_init, initHardDisk, initLNC, net_init }; + +/* ne2k_init, */ +/* ubixfs_init, */ +/* fdc_init, */ + +int init_tasksTotal = sizeof(init_tasks) / sizeof(intFunctionPTR); + +#endif /* END _UBIXOS_INIT_H */ diff --git a/include/ubixos/kmod.h b/include/ubixos/kmod.h new file mode 100644 index 0000000..39a3660 --- /dev/null +++ b/include/ubixos/kmod.h @@ -0,0 +1,48 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _UBIXOS_KMOD_H +#define _UBIXOS_KMOD_H + +#include + +#define LD_START 0x1000000 + +typedef struct kmod_struct { + struct kmod_struct *next; + struct kmod_struct *prev; + uInt16 id; + uInt16 refs; + uInt32 address; + char name[128]; +} kmod_t; + +uInt32 kmod_load(const char *); +uInt32 kmod_add(const char *, const char *name); + +#endif diff --git a/include/ubixos/kpanic.h b/include/ubixos/kpanic.h new file mode 100644 index 0000000..3adc795 --- /dev/null +++ b/include/ubixos/kpanic.h @@ -0,0 +1,36 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _SYS_KPANIC_H +#define _SYS_KPANIC_H + +#define K_PANIC(msg) kpanic("Error: (%s), File: %s, Line: %i\n",msg ,__FILE__,__LINE__); + +void kpanic(const char *fmt, ...); + +#endif /* END _SYS_KPANIC_H */ diff --git a/include/ubixos/ld.h b/include/ubixos/ld.h new file mode 100644 index 0000000..2790ec4 --- /dev/null +++ b/include/ubixos/ld.h @@ -0,0 +1,38 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _UBIXOS_LD_H +#define _UBIXOS_LD_H + +#include + +#define LD_START 0xAAA00000 //0x1000000 + +uInt32 ldEnable(); + +#endif /* END _UBIXOS_LD_H */ diff --git a/include/ubixos/lists.h b/include/ubixos/lists.h new file mode 100644 index 0000000..f730a52 --- /dev/null +++ b/include/ubixos/lists.h @@ -0,0 +1,69 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#define IN +#define STATUS_FAILURE -1 +#define STATUS_SUCCESS 0 + +typedef struct _item_t Item_t; +typedef struct _list_t List_t; +struct _item_t { + Item_t *Previous; + Item_t *Next; + void *data; +}; + +struct _list_t { + Item_t *First; + Item_t *Last; +}; + +List_t * +InitializeList(); +Item_t * +CreateItem(); +int +InsertItemAtFront( IN List_t * TList, IN Item_t * kItem); +int +InsertItemBetweenItems( IN List_t * TList, IN Item_t * Previous, IN Item_t * Next, IN Item_t * Insert); +int +RemoveItem( IN List_t * TList, IN Item_t * kItem); +int +DestroyItemsInList(IN List_t * ItemList); +int +DestroyItemList(IN List_t * ItemList); +Item_t * +GetFirstItem(IN List_t * kItem); + +Item_t * +GetLastItem(IN List_t * kItem); +List_t * +RemoveItemListBetweenItems( IN Item_t * Previous, IN Item_t * Next); + +void +InsertItemListBetweenItems( IN Item_t * Previous, IN Item_t * Next, IN List_t * Insert); diff --git a/include/ubixos/sched.h b/include/ubixos/sched.h new file mode 100644 index 0000000..2cb244d --- /dev/null +++ b/include/ubixos/sched.h @@ -0,0 +1,113 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _UBIXOS_SCHED_H +#define _UBIXOS_SCHED_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +#include +#include + +#define NO_GROUP -1 +#define NR_GROUPS 32 + +typedef enum { + PLACEHOLDER = -2, DEAD = -1, NEW = 0, READY = 1, RUNNING = 2, IDLE = 3, FORK = 4, WAIT = 5, UNINTERRUPTIBLE = 6, INTERRUPTIBLE = 7 +} tState; + +struct osInfo { + uInt8 timer; + uInt8 v86Task; + bool v86If; + uInt32 vmStart; + uInt32 stdinSize; + uInt32 controlKeys; + char *stdin; + char cwd[1024]; /* current working dir */ + uint8_t gpf; +}; + +typedef struct taskStruct { + pidType id; + char name[256]; + struct taskStruct *prev; + struct taskStruct *next; + struct tssStruct tss; + struct i387Struct i387; + struct osInfo oInfo; + //fileDescriptor *imageFd; + fileDescriptor_t *files[MAX_OFILES]; + tState state; + uint32_t uid, gid; + uint16_t euid, suid; + uint16_t egid, sgid; + uInt16 usedMath; + tty_term *term; + struct thread td; + struct { + struct inode *pwd; + struct inode *root; + struct inode *exec; + } inodes; + uint32_t counter; + uint16_t groups[NR_GROUPS]; + pidType ppid; + uint32_t pgrp; + uint32_t children; // Hack for WAIT + uint32_t last_exit; // Hack For WAIT + struct taskStruct *parent; +} kTask_t; + +int sched_init(); +int sched_setStatus(pidType, tState); +int sched_deleteTask(pidType); +int sched_addDelTask(kTask_t *); +kTask_t *sched_getDelTask(); +void sched_yield(); +void sched(); + +void schedEndTask(pidType pid); +kTask_t *schedNewTask(); +kTask_t *schedFindTask(uInt32 id); + +extern kTask_t *_current; +extern kTask_t *_usedMath; + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/include/ubixos/sem.h b/include/ubixos/sem.h new file mode 100644 index 0000000..7afd3de --- /dev/null +++ b/include/ubixos/sem.h @@ -0,0 +1,58 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _UBIXOS_SEM_H +#define _UBIXOS_SEM_H + +#include +#include +#include + +struct sys_sem { + uint32_t signaled; + ubthread_cond_t cond; + ubthread_mutex_t mutex; +}; + +typedef struct sys_sem sys_sem_t; + +typedef uint32_t semID_t; +struct timespec; + +int sem_close(semID_t id); +int sem_post(semID_t id); +int sem_wait(semID_t id); +int sem_trywait(semID_t id); +int sem_timedwait(semID_t id, const struct timespec *); +int sem_init(sys_sem_t **, uint8_t); +int sem_open(semID_t *id, const char *name, int oflag, mode_t mode, unsigned int value); +int sem_unlink(const char *name); +int sem_getvalue(semID_t id, int *val); +int sem_destroy(sys_sem_t **); + +#endif /* END _UBIXOS_SEM_H */ diff --git a/include/ubixos/smp.h b/include/ubixos/smp.h new file mode 100644 index 0000000..d4a630d --- /dev/null +++ b/include/ubixos/smp.h @@ -0,0 +1,53 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _UBIXOS_SMP_H +#define _UBIXOS_SMP_H + +#include + +struct cpuinfo_t { + uInt8 id; + uInt8 ok; // 1=Ok, 0=Bad + uInt8 apic_id, apic_ver; + uInt32 signature; // Family, Model, Stepping + uInt32 feature; + uInt32 max; + char brand[49]; // Brand name + char ident[17]; +}; + +void smpInit(); +void cpuidDetect(); +uInt8 cpuInfo(); +uInt32 getEflags(); +void setEflags(uInt32); +void cpuid(uInt32, uInt32 *); +void apicMagic(); + +#endif diff --git a/include/ubixos/spinlock.h b/include/ubixos/spinlock.h new file mode 100644 index 0000000..d5eff8c --- /dev/null +++ b/include/ubixos/spinlock.h @@ -0,0 +1,94 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _UBIXOS_SPINLOCK_H_ +#define _UBIXOS_SPINLOCK_H_ + +#include + +#define LOCKED 1 +#define UNLOCKED 0 +#define SPIN_LOCK_INITIALIZER { 0x0, 0x0 } +#define LLOCK_FLAG 1 + +struct spinLock { + struct spinLock *next; + u_int32_t locked; +}; + +typedef struct spinLock *spinLock_t; + +extern struct spinLock Master; + +void spinLockInit(spinLock_t); +void spinUnlock(spinLock_t); +int spinTryLock(spinLock_t); +void spinLock(spinLock_t); + +void spinLock_scheduler(spinLock_t *); /* Only use this spinlock in the sched. */ + +int spinLockLocked(spinLock_t *); + +/* Atomic exchange (of various sizes) */ +static inline u_long xchg_64(volatile uint32_t *ptr, u_long x) { + __asm__ __volatile__("xchgq %1,%0" + :"+r" (x), + "+m" (*ptr)); + + return x; +} + +static inline unsigned xchg_32(volatile uint32_t *ptr, uint32_t x) { + __asm__ __volatile__("xchgl %1,%0" + :"+r" (x), + "+m" (*ptr)); + + return x; +} + +static inline unsigned short xchg_16(volatile uint32_t *ptr, uint16_t x) { + __asm__ __volatile__("xchgw %1,%0" + :"+r" (x), + "+m" (*ptr)); + + return x; +} + +/* Test and set a bit */ +static inline char atomic_bitsetandtest(void *ptr, int x) { + char out; + __asm__ __volatile__("lock; bts %2,%1\n" + "sbb %0,%0\n" + :"=r" (out), "=m" (*(volatile long long *)ptr) + :"Ir" (x) + :"memory"); + + return out; +} + +#endif /* !_UBIXOS_SPINLOCK_H_ */ diff --git a/include/ubixos/static.h b/include/ubixos/static.h new file mode 100644 index 0000000..59986ca --- /dev/null +++ b/include/ubixos/static.h @@ -0,0 +1,34 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _UBIXOS_STATIC_H +#define _UBIXOS_STATIC_H + +int static_constructors(void); + +#endif diff --git a/include/ubixos/syscall.h b/include/ubixos/syscall.h new file mode 100644 index 0000000..e824415 --- /dev/null +++ b/include/ubixos/syscall.h @@ -0,0 +1,39 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _UBIXOS_SYSCALL_H +#define _UBIXOS_SYSCALL_H + +#include + +void _sys_call(); +void sys_call(struct trapframe *frame); +int invalidCall(); +void invalidCallINT(int); + +#endif diff --git a/include/ubixos/syscall_posix.h b/include/ubixos/syscall_posix.h new file mode 100644 index 0000000..65b2f09 --- /dev/null +++ b/include/ubixos/syscall_posix.h @@ -0,0 +1,37 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _UBIXOS_SYSCALL_POSIX_H +#define _UBIXOS_SYSCALL_POSIX_H + +#include + +void _sys_call_posix(); +void sys_call_posix(struct trapframe *frame); + +#endif diff --git a/include/ubixos/syscalls.h b/include/ubixos/syscalls.h new file mode 100644 index 0000000..426fa88 --- /dev/null +++ b/include/ubixos/syscalls.h @@ -0,0 +1,103 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _SYSCALLS_H +#define _SYSCALLS_H + +#include +#include +#include + +#define SYSCALLS_MAX 1024 + +#define PSL_C 0x00000001 /* carry bit */ +#define EJUSTRETURN (-2) /* don't modify regs, just return */ +#define ERESTART (-1) /* restart syscall */ + +#define ARG_COUNT(name) (sizeof(struct name) / sizeof(register_t)) + +#define SYSCALL_INVALID 0 +#define SYSCALL_VALID 1 +#define SYSCALL_DUMMY 2 +#define SYSCALL_NOTIMP 3 + +typedef int sys_call_t(struct thread *, void *); + +struct syscall_entry { + int sc_args; + char *sc_name; + sys_call_t *sc_entry; + int sc_status; +}; + +/* + * + * Old Style Calls Need Updates + * + */ +int sysAuth(); +int sysPasswd(); +int sysAddModule(); +int sysRmModule(); +int sysGetpid(); +int sysExit(); +int sysExec(); + +int sysCheckPid(); +int sysGetFreePage(); + +int sysFgetc(); +int sysFopen(); +int sysFclose(); +int sysFseek(); +int sysMkDir(); +int sysRmDir(); + +//int sysSDE(); +int sysGetDrives(); +int sysGetCwd(); +int sysChDir(); +int sysGetUptime(); +int sysGetTime(); +int sysStartSDE(); +int sysUnlink(); +int sysMpiCreateMbox(); +int sysMpiDestroyMbox(); +int sysMpiPostMessage(); +int sysMpiFetchMessage(); +int sysMpiSpam(); + +typedef int (*functionPTR)(); + +extern int totalCalls; +extern struct syscall_entry systemCalls[]; + +extern int totalCalls_posix; +extern struct syscall_entry systemCalls_posix[]; + +#endif diff --git a/include/ubixos/syscalls_new.h b/include/ubixos/syscalls_new.h new file mode 100644 index 0000000..706484e --- /dev/null +++ b/include/ubixos/syscalls_new.h @@ -0,0 +1,531 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _SYSCALLS_NEW_H +#define _SYSCALLS_NEW_H + +#include + +int sysExit(); +int read(); +int getpid(); +int fcntl(); +int issetugid(); +int __sysctl(); +int pipe(); +int readlink(); +int getuid(); +int getgid(); +int close(); +int mmap(); +int obreak(); +int sigaction(); +int getdtablesize(); +int munmap(); +int sigprocmask(); +int gettimeofday_new(); +int fstat(); +int ioctl(); + +#define invalid_call 0x0 +#define PSL_C 0x00000001 /* carry bit */ +#define EJUSTRETURN (-2) /* don't modify regs, just return */ +#define ERESTART (-1) /* restart syscall */ + +typedef int (*functionPTR)(); + +/*! + * \brief Mast System Call List + */ +functionPTR systemCalls_new[] = { +invalid_call, /** 0 **/ +sysExit, /** 1 **/ +invalid_call, /** 2 **/ +read, /** 3 **/ +sys_write, /** 4 **/ +sys_open, /** 5 **/ +close, /** 6 **/ +invalid_call, /** 7 **/ +invalid_call, /** 8 **/ +invalid_call, /** 9 **/ +invalid_call, /** 10 **/ +invalid_call, /** 11 **/ +invalid_call, /** 12 **/ +invalid_call, /** 13 **/ +invalid_call, /** 14 **/ +invalid_call, /** 15 **/ +invalid_call, /** 16 **/ +obreak, /** 17 **/ +invalid_call, /** 18 **/ +invalid_call, /** 19 **/ +getpid, /** 20 **/ +invalid_call, /** 21 **/ +invalid_call, /** 22 **/ +invalid_call, /** 23 **/ +getuid, /** 24 **/ +invalid_call, /** 25 **/ +invalid_call, /** 26 **/ +invalid_call, /** 27 **/ +invalid_call, /** 28 **/ +invalid_call, /** 29 **/ +invalid_call, /** 30 **/ +invalid_call, /** 31 **/ +invalid_call, /** 32 **/ +access, /** 33 **/ +invalid_call, /** 34 **/ +invalid_call, /** 35 **/ +invalid_call, /** 36 **/ +invalid_call, /** 37 **/ +invalid_call, /** 38 **/ +invalid_call, /** 39 **/ +invalid_call, /** 40 **/ +invalid_call, /** 41 **/ +pipe, /** 42 **/ +invalid_call, /** 43 **/ +invalid_call, /** 44 **/ +invalid_call, /** 45 **/ +invalid_call, /** 46 **/ +getgid, /** 47 **/ +invalid_call, /** 48 **/ +invalid_call, /** 49 **/ +invalid_call, /** 50 **/ +invalid_call, /** 51 **/ +invalid_call, /** 52 **/ +invalid_call, /** 53 **/ +ioctl, /** 54 **/ +invalid_call, /** 55 **/ +invalid_call, /** 56 **/ +invalid_call, /** 57 **/ +readlink, /** 58 **/ +invalid_call, /** 59 **/ +invalid_call, /** 60 **/ +invalid_call, /** 61 **/ +invalid_call, /** 62 **/ +invalid_call, /** 63 **/ +invalid_call, /** 64 **/ +invalid_call, /** 65 **/ +invalid_call, /** 66 **/ +invalid_call, /** 67 **/ +invalid_call, /** 68 **/ +invalid_call, /** 69 **/ +invalid_call, /** 70 **/ +invalid_call, /** 71 **/ +invalid_call, /** 72 **/ +munmap, /** 73 **/ +mprotect, /** 74 **/ +invalid_call, /** 75 **/ +invalid_call, /** 76 **/ +invalid_call, /** 77 **/ +invalid_call, /** 78 **/ +invalid_call, /** 79 **/ +invalid_call, /** 80 **/ +invalid_call, /** 81 **/ +invalid_call, /** 82 **/ +setitimer, /** 83 **/ +invalid_call, /** 84 **/ +invalid_call, /** 85 **/ +invalid_call, /** 86 **/ +invalid_call, /** 87 **/ +invalid_call, /** 88 **/ +getdtablesize, /** 89 **/ +invalid_call, /** 90 **/ +invalid_call, /** 91 **/ +fcntl, /** 92 **/ +invalid_call, /** 93 **/ +invalid_call, /** 94 **/ +invalid_call, /** 95 **/ +invalid_call, /** 96 **/ +invalid_call, /** 97 **/ +invalid_call, /** 98 **/ +invalid_call, /** 99 **/ +invalid_call, /** 100 **/ +invalid_call, /** 101 **/ +invalid_call, /** 102 **/ +invalid_call, /** 103 **/ +invalid_call, /** 104 **/ +invalid_call, /** 105 **/ +invalid_call, /** 106 **/ +invalid_call, /** 107 **/ +invalid_call, /** 108 **/ +invalid_call, /** 109 **/ +invalid_call, /** 110 **/ +invalid_call, /** 111 **/ +invalid_call, /** 112 **/ +invalid_call, /** 113 **/ +invalid_call, /** 114 **/ +invalid_call, /** 115 **/ +gettimeofday_new, /** 116 **/ +invalid_call, /** 117 **/ +invalid_call, /** 118 **/ +invalid_call, /** 119 **/ +invalid_call, /** 120 **/ +invalid_call, /** 121 **/ +invalid_call, /** 122 **/ +invalid_call, /** 123 **/ +invalid_call, /** 124 **/ +invalid_call, /** 125 **/ +invalid_call, /** 126 **/ +invalid_call, /** 127 **/ +invalid_call, /** 128 **/ +invalid_call, /** 129 **/ +invalid_call, /** 130 **/ +invalid_call, /** 131 **/ +invalid_call, /** 132 **/ +invalid_call, /** 133 **/ +invalid_call, /** 134 **/ +invalid_call, /** 135 **/ +invalid_call, /** 136 **/ +invalid_call, /** 137 **/ +invalid_call, /** 138 **/ +invalid_call, /** 139 **/ +invalid_call, /** 140 **/ +invalid_call, /** 141 **/ +invalid_call, /** 142 **/ +invalid_call, /** 143 **/ +invalid_call, /** 144 **/ +invalid_call, /** 145 **/ +invalid_call, /** 146 **/ +invalid_call, /** 147 **/ +invalid_call, /** 148 **/ +invalid_call, /** 149 **/ +invalid_call, /** 150 **/ +invalid_call, /** 151 **/ +invalid_call, /** 152 **/ +invalid_call, /** 153 **/ +invalid_call, /** 154 **/ +invalid_call, /** 155 **/ +invalid_call, /** 156 **/ +invalid_call, /** 157 **/ +invalid_call, /** 158 **/ +invalid_call, /** 159 **/ +invalid_call, /** 160 **/ +invalid_call, /** 161 **/ +invalid_call, /** 162 **/ +invalid_call, /** 163 **/ +invalid_call, /** 164 **/ +invalid_call, /** 165 **/ +invalid_call, /** 166 **/ +invalid_call, /** 167 **/ +invalid_call, /** 168 **/ +invalid_call, /** 169 **/ +invalid_call, /** 170 **/ +invalid_call, /** 171 **/ +invalid_call, /** 172 **/ +invalid_call, /** 173 **/ +invalid_call, /** 174 **/ +invalid_call, /** 175 **/ +invalid_call, /** 176 **/ +invalid_call, /** 177 **/ +invalid_call, /** 178 **/ +invalid_call, /** 179 **/ +invalid_call, /** 180 **/ +invalid_call, /** 181 **/ +invalid_call, /** 182 **/ +invalid_call, /** 183 **/ +invalid_call, /** 184 **/ +invalid_call, /** 185 **/ +invalid_call, /** 186 **/ +invalid_call, /** 187 **/ +invalid_call, /** 188 **/ +fstat, /** 189 **/ +invalid_call, /** 190 **/ +invalid_call, /** 191 **/ +invalid_call, /** 192 **/ +invalid_call, /** 193 **/ +invalid_call, /** 194 **/ +invalid_call, /** 195 **/ +invalid_call, /** 196 **/ +mmap, /** 197 **/ +invalid_call, /** 198 **/ +invalid_call, /** 199 **/ +invalid_call, /** 200 **/ +invalid_call, /** 201 **/ +__sysctl, /** 202 **/ +invalid_call, /** 203 **/ +invalid_call, /** 204 **/ +invalid_call, /** 205 **/ +invalid_call, /** 206 **/ +invalid_call, /** 207 **/ +invalid_call, /** 208 **/ +invalid_call, /** 209 **/ +invalid_call, /** 210 **/ +invalid_call, /** 211 **/ +invalid_call, /** 212 **/ +invalid_call, /** 213 **/ +invalid_call, /** 214 **/ +invalid_call, /** 215 **/ +invalid_call, /** 216 **/ +invalid_call, /** 217 **/ +invalid_call, /** 218 **/ +invalid_call, /** 219 **/ +invalid_call, /** 220 **/ +invalid_call, /** 221 **/ +invalid_call, /** 222 **/ +invalid_call, /** 223 **/ +invalid_call, /** 224 **/ +invalid_call, /** 225 **/ +invalid_call, /** 226 **/ +invalid_call, /** 227 **/ +invalid_call, /** 228 **/ +invalid_call, /** 229 **/ +invalid_call, /** 230 **/ +invalid_call, /** 231 **/ +invalid_call, /** 232 **/ +invalid_call, /** 233 **/ +invalid_call, /** 234 **/ +invalid_call, /** 235 **/ +invalid_call, /** 236 **/ +invalid_call, /** 237 **/ +invalid_call, /** 238 **/ +invalid_call, /** 239 **/ +invalid_call, /** 240 **/ +invalid_call, /** 241 **/ +invalid_call, /** 242 **/ +invalid_call, /** 243 **/ +invalid_call, /** 244 **/ +invalid_call, /** 245 **/ +invalid_call, /** 246 **/ +invalid_call, /** 247 **/ +invalid_call, /** 248 **/ +invalid_call, /** 249 **/ +invalid_call, /** 250 **/ +invalid_call, /** 251 **/ +invalid_call, /** 252 **/ +issetugid, /** 253 **/ +invalid_call, /** 254 **/ +invalid_call, /** 255 **/ +invalid_call, /** 256 **/ +invalid_call, /** 257 **/ +invalid_call, /** 258 **/ +invalid_call, /** 259 **/ +invalid_call, /** 260 **/ +invalid_call, /** 261 **/ +invalid_call, /** 262 **/ +invalid_call, /** 263 **/ +invalid_call, /** 264 **/ +invalid_call, /** 265 **/ +invalid_call, /** 266 **/ +invalid_call, /** 267 **/ +invalid_call, /** 268 **/ +invalid_call, /** 269 **/ +invalid_call, /** 270 **/ +invalid_call, /** 271 **/ +invalid_call, /** 272 **/ +invalid_call, /** 273 **/ +invalid_call, /** 274 **/ +invalid_call, /** 275 **/ +invalid_call, /** 276 **/ +invalid_call, /** 277 **/ +invalid_call, /** 278 **/ +invalid_call, /** 279 **/ +invalid_call, /** 280 **/ +invalid_call, /** 281 **/ +invalid_call, /** 282 **/ +invalid_call, /** 283 **/ +invalid_call, /** 284 **/ +invalid_call, /** 285 **/ +invalid_call, /** 286 **/ +invalid_call, /** 287 **/ +invalid_call, /** 288 **/ +invalid_call, /** 289 **/ +invalid_call, /** 290 **/ +invalid_call, /** 291 **/ +invalid_call, /** 292 **/ +invalid_call, /** 293 **/ +invalid_call, /** 294 **/ +invalid_call, /** 295 **/ +invalid_call, /** 296 **/ +invalid_call, /** 297 **/ +invalid_call, /** 298 **/ +invalid_call, /** 299 **/ +invalid_call, /** 300 **/ +invalid_call, /** 301 **/ +invalid_call, /** 302 **/ +invalid_call, /** 303 **/ +invalid_call, /** 304 **/ +invalid_call, /** 305 **/ +invalid_call, /** 306 **/ +invalid_call, /** 307 **/ +invalid_call, /** 308 **/ +invalid_call, /** 309 **/ +invalid_call, /** 310 **/ +invalid_call, /** 311 **/ +invalid_call, /** 312 **/ +invalid_call, /** 313 **/ +invalid_call, /** 314 **/ +invalid_call, /** 315 **/ +invalid_call, /** 316 **/ +invalid_call, /** 317 **/ +invalid_call, /** 318 **/ +invalid_call, /** 319 **/ +invalid_call, /** 320 **/ +invalid_call, /** 321 **/ +invalid_call, /** 322 **/ +invalid_call, /** 323 **/ +invalid_call, /** 324 **/ +invalid_call, /** 325 **/ +invalid_call, /** 326 **/ +invalid_call, /** 327 **/ +invalid_call, /** 328 **/ +invalid_call, /** 329 **/ +invalid_call, /** 330 **/ +invalid_call, /** 331 **/ +invalid_call, /** 332 **/ +invalid_call, /** 333 **/ +invalid_call, /** 334 **/ +invalid_call, /** 335 **/ +invalid_call, /** 336 **/ +invalid_call, /** 337 **/ +invalid_call, /** 338 **/ +invalid_call, /** 339 **/ +sigprocmask, /** 340 **/ +invalid_call, /** 341 **/ +invalid_call, /** 342 **/ +invalid_call, /** 343 **/ +invalid_call, /** 344 **/ +invalid_call, /** 345 **/ +invalid_call, /** 346 **/ +invalid_call, /** 347 **/ +invalid_call, /** 348 **/ +invalid_call, /** 349 **/ +invalid_call, /** 350 **/ +invalid_call, /** 351 **/ +invalid_call, /** 352 **/ +invalid_call, /** 353 **/ +invalid_call, /** 354 **/ +invalid_call, /** 355 **/ +invalid_call, /** 356 **/ +invalid_call, /** 357 **/ +invalid_call, /** 358 **/ +invalid_call, /** 359 **/ +invalid_call, /** 360 **/ +invalid_call, /** 361 **/ +invalid_call, /** 362 **/ +invalid_call, /** 363 **/ +invalid_call, /** 364 **/ +invalid_call, /** 365 **/ +invalid_call, /** 366 **/ +invalid_call, /** 367 **/ +invalid_call, /** 368 **/ +invalid_call, /** 369 **/ +invalid_call, /** 370 **/ +invalid_call, /** 371 **/ +invalid_call, /** 372 **/ +invalid_call, /** 373 **/ +invalid_call, /** 374 **/ +invalid_call, /** 375 **/ +invalid_call, /** 376 **/ +invalid_call, /** 377 **/ +invalid_call, /** 378 **/ +invalid_call, /** 379 **/ +invalid_call, /** 380 **/ +invalid_call, /** 381 **/ +invalid_call, /** 382 **/ +invalid_call, /** 383 **/ +invalid_call, /** 384 **/ +invalid_call, /** 385 **/ +invalid_call, /** 386 **/ +invalid_call, /** 387 **/ +invalid_call, /** 388 **/ +invalid_call, /** 389 **/ +invalid_call, /** 390 **/ +invalid_call, /** 391 **/ +invalid_call, /** 392 **/ +invalid_call, /** 393 **/ +invalid_call, /** 394 **/ +invalid_call, /** 395 **/ +invalid_call, /** 396 **/ +fstatfs, /** 397 **/ +invalid_call, /** 398 **/ +invalid_call, /** 399 **/ +invalid_call, /** 400 **/ +invalid_call, /** 401 **/ +invalid_call, /** 402 **/ +invalid_call, /** 403 **/ +invalid_call, /** 404 **/ +invalid_call, /** 405 **/ +invalid_call, /** 406 **/ +invalid_call, /** 407 **/ +invalid_call, /** 408 **/ +invalid_call, /** 409 **/ +invalid_call, /** 410 **/ +invalid_call, /** 411 **/ +invalid_call, /** 412 **/ +invalid_call, /** 413 **/ +invalid_call, /** 414 **/ +invalid_call, /** 415 **/ +sigaction, /** 416 **/ +invalid_call, /** 417 **/ +invalid_call, /** 418 **/ +invalid_call, /** 419 **/ +invalid_call, /** 420 **/ +invalid_call, /** 421 **/ +invalid_call, /** 422 **/ +invalid_call, /** 423 **/ +invalid_call, /** 424 **/ +invalid_call, /** 425 **/ +invalid_call, /** 426 **/ +invalid_call, /** 427 **/ +invalid_call, /** 428 **/ +invalid_call, /** 429 **/ +invalid_call, /** 430 **/ +invalid_call, /** 431 **/ +invalid_call, /** 432 **/ +invalid_call, /** 433 **/ +invalid_call, /** 434 **/ +invalid_call, /** 435 **/ +invalid_call, /** 436 **/ +invalid_call, /** 437 **/ +invalid_call, /** 438 **/ +invalid_call, /** 439 **/ +invalid_call, /** 440 **/ +invalid_call, /** 441 **/ +invalid_call, /** 442 **/ +invalid_call, /** 443 **/ +invalid_call, /** 444 **/ +invalid_call, /** 445 **/ +invalid_call, /** 446 **/ +invalid_call, /** 447 **/ +invalid_call, /** 448 **/ +invalid_call, /** 449 **/ +invalid_call, /** 450 **/ +invalid_call, /** 451 **/ +invalid_call, /** 452 **/ +invalid_call, /** 453 **/ +invalid_call, /** 454 **/ +invalid_call, /** 455 **/ +}; + +int totalCalls_new = sizeof(systemCalls_new) / sizeof(functionPTR); + +#endif + +/*** + END + ***/ + diff --git a/include/ubixos/systemtask.h b/include/ubixos/systemtask.h new file mode 100644 index 0000000..22589b1 --- /dev/null +++ b/include/ubixos/systemtask.h @@ -0,0 +1,60 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _SYSTEMTASK_H +#define _SYSTEMTASK_H + +#include + +void systemTask(); + +#endif + +/*** + $Log: systemtask.h,v $ + Revision 1.1.1.1 2006/06/01 12:46:14 reddawg + ubix2 + + Revision 1.2 2005/10/12 00:13:37 reddawg + Removed + + Revision 1.1.1.1 2005/09/26 17:23:56 reddawg + no message + + Revision 1.2 2004/06/04 17:49:32 reddawg + Wont work with out the makefile updated + + Revision 1.1 2004/06/04 17:33:33 reddawg + Changed idle task to system task + + Revision 1.2 2004/05/21 15:20:00 reddawg + Cleaned up + + + END + ***/ diff --git a/include/ubixos/time.h b/include/ubixos/time.h new file mode 100644 index 0000000..d9ab30d --- /dev/null +++ b/include/ubixos/time.h @@ -0,0 +1,89 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _UBIXOS_TIME_H +#define _UBIXOS_TIME_H + +#include +#include +#include + +typedef long suseconds_t; + +#define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10) + +#define MINUTE 60 +#define HOUR (60*MINUTE) +#define DAY (24*HOUR) +#define YEAR (365*DAY) + + +struct timeStruct { + int sec; + int min; + int hour; + int day; + int mon; + int year; +}; + +struct timezone { + int tz_minuteswest; /* minutes west of Greenwich */ + int tz_dsttime; /* type of dst correction */ +}; + +int gettimeofday(struct timeval *tp, struct timezone *tzp); + +int time_init(); +uInt32 timeMake(struct timeStruct *time); + +#endif + +/*** + $Log: time.h,v $ + Revision 1.1.1.1 2006/06/01 12:46:14 reddawg + ubix2 + + Revision 1.2 2005/10/12 00:13:37 reddawg + Removed + + Revision 1.1.1.1 2005/09/26 17:23:56 reddawg + no message + + Revision 1.4 2004/07/09 13:37:30 reddawg + time: timeInit to time_init + Adjusted initialization routines + + Revision 1.3 2004/06/29 11:41:44 reddawg + Fixed some global variables + + Revision 1.2 2004/05/21 15:20:00 reddawg + Cleaned up + + END + ***/ diff --git a/include/ubixos/times.h b/include/ubixos/times.h new file mode 100644 index 0000000..eb575b1 --- /dev/null +++ b/include/ubixos/times.h @@ -0,0 +1,64 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _TIMES_H +#define _TIMES_H + +#include + +#ifndef _CLOCK_T_DECLARED +typedef __clock_t clock_t; +#define _CLOCK_T_DECLARED +#endif + +struct tms { + clock_t tms_utime; /* User CPU time */ + clock_t tms_stime; /* System CPU time */ + clock_t tms_cutime; /* User CPU time of terminated child procs */ + clock_t tms_cstime; /* System CPU time of terminated child procs */ +}; + +#endif + +/*** + $Log: times.h,v $ + Revision 1.1.1.1 2006/06/01 12:46:14 reddawg + ubix2 + + Revision 1.2 2005/10/12 00:13:37 reddawg + Removed + + Revision 1.1.1.1 2005/09/26 17:23:57 reddawg + no message + + Revision 1.2 2004/05/21 15:20:00 reddawg + Cleaned up + + + END + ***/ diff --git a/include/ubixos/tty.h b/include/ubixos/tty.h new file mode 100644 index 0000000..4389db6 --- /dev/null +++ b/include/ubixos/tty.h @@ -0,0 +1,54 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _UBIXOS_TTY_H +#define _UBIXOS_TTY_H + +#include + +#define TTY_MAX_TERMS 5 + +typedef struct tty_termNode { + char *tty_buffer; + char *tty_pointer; + uint8_t tty_colour; + uint16_t tty_x; + uint16_t tty_y; + pidType owner; + char stdin[512]; + int stdinSize; +} tty_term; + +int tty_init(); +int tty_change(uInt16); +tty_term *tty_find(uInt16); +int tty_print(char *, tty_term *); + +extern tty_term *tty_foreground; + +#endif diff --git a/include/ubixos/ubthread.h b/include/ubixos/ubthread.h new file mode 100644 index 0000000..26a07f4 --- /dev/null +++ b/include/ubixos/ubthread.h @@ -0,0 +1,86 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _UBTHREAD_H +#define _UBTHREAD_H + +#include +#include +#include + +#define LOCKED 1 +#define UNLOCKED 0 + +typedef struct ubthread *ubthread_t; +typedef struct ubthread_cond *ubthread_cond_t; +typedef struct ubthread_mutex *ubthread_mutex_t; + +struct ubthread { + struct taskStruct *task; +}; + +struct ubthread_cond { + int id; + bool lock; +}; + +struct ubthread_mutex { + int id; + bool lock; + pidType pid; +}; + +struct ubthread_list { + struct ubthread_list *next; + ubthread_t thread; +}; + +struct ubthread_cond_list { + struct ubthread_cond_list *next; + ubthread_cond_t *cond; +}; + +struct ubthread_mutex_list { + struct ubthread_mutex_list *next; + ubthread_mutex_t *mutex; +}; + +struct taskStruct *ubthread_self(); +int ubthread_cond_init(ubthread_cond_t *cond, const uInt32 attr); +int ubthread_mutex_init(ubthread_mutex_t *mutex, const uInt32 attr); +int ubthread_cond_destroy(ubthread_cond_t *cond); +int ubthread_mutex_destroy(ubthread_mutex_t *mutex); +int ubthread_create(struct taskStruct **thread, const uInt32 *attr, void (*tproc)(void), void *arg); +int ubthread_mutex_lock(ubthread_mutex_t *mutex); +int ubthread_mutex_unlock(ubthread_mutex_t *mutex); +int ubthread_cond_timedwait(ubthread_cond_t *cond, ubthread_mutex_t *mutex, const struct timespec *abstime); +int ubthread_cond_wait(ubthread_cond_t *cond, ubthread_mutex_t *mutex); +int ubthread_cond_signal(ubthread_cond_t *cond); +int ubthread_cond_broadcast(ubthread_cond_t *cond); + +#endif diff --git a/include/ubixos/uthread.h b/include/ubixos/uthread.h new file mode 100644 index 0000000..ac8b160 --- /dev/null +++ b/include/ubixos/uthread.h @@ -0,0 +1,57 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _UBIXOS_UTHREAD_H +#define _UBIXOS_UTHREAD_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + + struct uthread { + struct uthread *uthread_pointer; + size_t uthread_size; + unsigned long uthread_flags; + void *tls_master_mmap; + size_t tls_master_size; + size_t tls_master_align; + void *tls_mmap; + size_t stack_size; + void *arg_mmap; + size_t arg_size; + size_t __uthread_reserved[4]; + }; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/ubixos/vitals.h b/include/ubixos/vitals.h new file mode 100644 index 0000000..8c3ab88 --- /dev/null +++ b/include/ubixos/vitals.h @@ -0,0 +1,58 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _UBIXOS_VITALS_H +#define _UBIXOS_VITALS_H + +#include +#include +#include + +typedef struct vitalsStruct { + uint32_t sysTicks; // 0 - Do Not Change Order + uint32_t sysUptime; // 4 - Do Not Change Order + uint32_t quantum; // 8 - Do Not Change Order + uint32_t dQuantum; // 12 - Do Not Change Order + uint32_t openFiles; + uint32_t lastFD; + uint32_t freePages; + struct fileSystem *fileSystems; + struct vfs_mountPoint *mountPoints; + uint32_t timeStart; + void *screen; + void *font; + char *packet; + uint32_t packetLength; +} vitalsNode; + +extern vitalsNode *systemVitals; +extern spinLock_t vitals_lock; + +int vitals_init(); + +#endif diff --git a/include/ubixos/wait.h b/include/ubixos/wait.h new file mode 100644 index 0000000..9c9f703 --- /dev/null +++ b/include/ubixos/wait.h @@ -0,0 +1,52 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _UBIXOS_WAIT_H +#define _UBIXOS_WAIT_H + +struct taskStruct; + +struct wait_queue { + struct taskStruct *task; + struct wait_queue *next; +}; + +struct semaphore { + int sount; + struct wait_queue *wait; +}; + +#define sti() __asm__ __volatile__ ("sti": : :"memory") +#define cli() __asm__ __volatile__ ("cli": : :"memory") +#define nop() __asm__ __volatile__ ("nop") + +#define save_flags(x) __asm__ __volatile__("pushfl ; popl %0":"=r" (x): /* no input */ :"memory") + +#define restore_flags(x) __asm__ __volatile__("pushl %0 ; popfl": /* no output */ :"r" (x):"memory") + +#endif diff --git a/include/vmm/paging.h b/include/vmm/paging.h new file mode 100644 index 0000000..6186705 --- /dev/null +++ b/include/vmm/paging.h @@ -0,0 +1,104 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _VMM_PAGING_H_ +#define _VMM_PAGING_H_ + +#include +#include +#include + +#define PAGE_SHIFT 12 // Page Shift +#define PAGE_SIZE 0x1000 // Page Size +#define PAGE_MASK (PAGE_SIZE-1) // Page Mask + +#define PD_INDEX(v_addr) (v_addr >> 22) // Calc Page Directory Index +#define PD_OFFSET(v_addr) (v_addr >> 0xA) // Calc Page Directory OFfset +#define PT_INDEX(v_addr) ((v_addr >> 12) & 0x03FF) // Calc Page Table Offset +#define PD_BASE_ADDR2 ((PAGE_SIZE << 0xA) + VMM_KERN_START) // Find Out What This Was For + +#define PD_BASE_ADDR 0xC0400000 // Page Directory Addressable Base Address +#define PT_BASE_ADDR 0xC0000000 // Page Table Addressable Base Address + +#define PD_ENTRIES (PAGE_SIZE/4) //Return Page Directory Entries +#define PT_ENTRIES (PAGE_SIZE/4) //Return Page Table Entries + +#define VM_THRD 0 // Thread +#define VM_TASK 1 // Task + +// Page Flags +#define PAGE_PRESENT 0x00000001 +#define PAGE_WRITE 0x00000002 +#define PAGE_USER 0x00000004 +#define PAGE_WRITE_THROUGH 0x00000008 +#define PAGE_CACHE_DISABLED 0x00000010 +#define PAGE_ACCESSED 0x00000020 +#define PAGE_DIRTY 0x00000040 +#define PAGE_GLOBAL 0x00000080 +#define PAGE_ 0x00000100 +#define PAGE_COW 0x00000200 +#define PAGE_STACK 0x00000400 +#define PAGE_WIRED 0x00000800 + +#define PAGE_DEFAULT (PAGE_PRESENT|PAGE_WRITE|PAGE_USER) +#define KERNEL_PAGE_DEFAULT (PAGE_PRESENT|PAGE_WRITE) + +#define trunc_page(x) ((x) & ~PAGE_MASK) +#define round_page(x) (((x) + PAGE_MASK) & ~PAGE_MASK) + +#define ctob(x) ((x)<>PAGE_SHIFT) + +int vmmClearVirtualPage(uint32_t pageAddr); + +void *vmm_mapFromTask(pidType, void *, uint32_t); +void *vmm_copyVirtualSpace(pidType); +void *vmm_getFreePage(pidType); +void *vmm_getFreeKernelPage(pidType pid, uint16_t count); +void *vmm_createVirtualSpace(pidType); +void *vmm_getFreeVirtualPage(pidType, int, int); + +uint32_t vmm_getPhysicalAddr(uint32_t); +uint32_t vmm_getRealAddr(uint32_t); +int vmm_setPageAttributes(uint32_t, uint16_t); +int vmm_remapPage(uint32_t, uint32_t, uint16_t, pidType, int haveLock); +int vmm_pagingInit(); +void *vmm_getFreeMallocPage(uint16_t count); +//void vmm_pageFault( uint32_t, uint32_t, uint32_t ); +void vmm_pageFault(struct trapframe *, uint32_t); +void _vmm_pageFault(); +int mmap(struct thread *, struct sys_mmap_args *); +int obreak(struct thread *, struct obreak_args *); +int munmap(struct thread *, struct sys_munmap_args *); + +int vmm_cleanVirtualSpace(uint32_t); +void *vmm_getFreeVirtualPage(pidType pid, int count, int type); + +extern uint32_t *kernelPageDirectory; + +#endif diff --git a/include/vmm/vmm.h b/include/vmm/vmm.h new file mode 100644 index 0000000..bb769b1 --- /dev/null +++ b/include/vmm/vmm.h @@ -0,0 +1,133 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _VMM_VMM_H +#define _VMM_VMM_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define STACK_ADDR 0xBFFFFFFF//0xC800000 // Default App Stack Address + +#define memAvail 1 +#define memNotavail 2 +#define vmmID -3 + + /* + #define vmmMemoryMapAddr 0xE6667000 + #define VMM_MMAP_ADDR_PMODE2 0xE6667000 + */ + +#define VMM_MMAP_ADDR_PMODE VMM_KERN_START /* (PD_BASE_ADDR + PAGE_SIZE) */ +#define VMM_MMAP_ADDR_RMODE 0x101000 + +#define VMM_KERN_CODE_START 0x00000000 +#define VMM_KERN_CODE_END 0x007FEFFF + +#define VMM_USER_LDT 0x007FF000 + +#define VMM_USER_START 0x00800000 +#define VMM_USER_END 0xBFFFFFFF + +#define VMM_PAGE_DIRS 0xC0000000 +#define VMM_PAGE_DIR 0xC0400000 + +#define VMM_KERN_START 0xC0800000 //TMP ADDED 1000 +#define VMM_KERN_END 0xFDFFFFFF + +#define VMM_KERN_STACK_START 0xFE000000 +#define VMM_KERN_STACK_END 0xFFFFFFFF + + extern struct spinLock pdSpinLock; + + + struct freebsd6_mmap_args { + char addr_l_[PADL_(caddr_t)]; + caddr_t addr; + char addr_r_[PADR_(caddr_t)]; + + char len_l_[PADL_(size_t)]; + size_t len; + char len_r_[PADR_(size_t)]; + + char prot_l_[PADL_(int)]; + int prot; + char prot_r_[PADR_(int)]; + char flags_l_[PADL_(int)]; + + int flags; + char flags_r_[PADR_(int)]; + char fd_l_[PADL_(int)]; + int fd; + char fd_r_[PADR_(int)]; + + char pad_l_[PADL_(int)]; + int pad; + char pad_r_[PADR_(int)]; + + char pos_l_[PADL_(off_t)]; + off_t pos; + char pos_r_[PADR_(off_t)]; + }; + + typedef struct { + uint32_t pageAddr; + u_int16_t status; + u_int16_t reserved; + pid_t pid; + int cowCounter; + } mMap; + + typedef enum { + VMM_FREE = 0, VMM_KEEP = 1 + } unmapFlags_t; + + extern int numPages; + extern mMap *vmmMemoryMap; + + int vmm_init(); + int vmm_memMapInit(); + int countMemory(); + uint32_t vmm_findFreePage(pidType pid); + int freePage(uint32_t pageAddr); + int adjustCowCounter(uint32_t baseAddr, int adjustment); + void vmm_freeProcessPages(pidType pid); + + int vmm_allocPageTable(uint32_t, pidType); + void vmm_unmapPage(uint32_t, unmapFlags_t); + void vmm_unmapPages(void *, uint32_t, unmapFlags_t); + +#ifdef __cplusplus +} +#endif + +#endif // _VMM_VMM_H diff --git a/include_old/machine/_types.h b/include_old/machine/_types.h index d57eb23..84c2324 100644 --- a/include_old/machine/_types.h +++ b/include_old/machine/_types.h @@ -1,72 +1,46 @@ /*- - * Copyright (c) 2002 Mike Barcroft - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. + * This was developed by Christopher W. Olsen for the UbixOS Project. * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: * - * From: @(#)ansi.h 8.2 (Berkeley) 1/4/94 - * From: @(#)types.h 8.3 (Berkeley) 1/5/94 - * $FreeBSD: src/sys/i386/include/_types.h,v 1.7 2003/03/30 05:24:52 jake Exp $ + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _MACHINE__TYPES_H_ #define _MACHINE__TYPES_H_ -/* - * Basic types upon which most other types are built. - */ +// Basic types upon which most other types are built. typedef __signed char __int8_t; typedef unsigned char __uint8_t; -typedef short __int16_t; +typedef short __int16_t; typedef unsigned short __uint16_t; -typedef int __int32_t; +typedef int __int32_t; typedef unsigned int __uint32_t; - -#if defined(lint) -/* LONGLONG */ -typedef long long __int64_t; -/* LONGLONG */ +typedef long long __int64_t; typedef unsigned long long __uint64_t; -#elif defined(__GNUC__) -typedef int __attribute__((__mode__(__DI__))) __int64_t; -typedef unsigned int __attribute__((__mode__(__DI__))) __uint64_t; -#else -/* LONGLONG */ -typedef long long __int64_t; -/* LONGLONG */ -typedef unsigned long long __uint64_t; -#endif -/* - * Standard type definitions. - */ +// Standard type definitions. + typedef unsigned long __clock_t; /* clock()... */ typedef __int32_t __critical_t; typedef double __double_t; @@ -102,25 +76,8 @@ typedef __uint32_t __u_register_t; typedef __uint32_t __vm_offset_t; typedef __int64_t __vm_ooffset_t; -#ifdef PAE -typedef __uint64_t __vm_paddr_t; -#else typedef __uint32_t __vm_paddr_t; -#endif typedef __uint64_t __vm_pindex_t; typedef __uint32_t __vm_size_t; -/* - * Unusual type definitions. - */ -#if defined(__GNUC__) && (__GNUC__ == 2 && __GNUC_MINOR__ > 95 || __GNUC__ >= 3) -typedef __builtin_va_list __va_list; /* internally known to gcc */ -#else -typedef char * __va_list; -#endif /* post GCC 2.95 */ -#if defined __GNUC__ && !defined(__GNUC_VA_LIST) && !defined(__NO_GNUC_VA_LIST) -#define __GNUC_VA_LIST -typedef __va_list __gnuc_va_list; /* compatibility w/GNU headers*/ -#endif - #endif /* !_MACHINE__TYPES_H_ */ diff --git a/sys/fs/ubixfs/block.c b/sys/fs/ubixfs/block.c index 8be4d23..261cc3c 100644 --- a/sys/fs/ubixfs/block.c +++ b/sys/fs/ubixfs/block.c @@ -66,9 +66,9 @@ *****************************************************************************************/ -#include -#include -#include +#include +#include +#include void syncBat(struct vfs_mountPoint *mp) { diff --git a/sys/fs/ubixfs/dirCache.c b/sys/fs/ubixfs/dirCache.c index d4a483d..f6f7f08 100644 --- a/sys/fs/ubixfs/dirCache.c +++ b/sys/fs/ubixfs/dirCache.c @@ -28,8 +28,8 @@ *****************************************************************************************/ #include -#include -#include +#include +#include #include #include #include diff --git a/sys/fs/ubixfs/directory.c b/sys/fs/ubixfs/directory.c index 52cd70d..c47d1fb 100644 --- a/sys/fs/ubixfs/directory.c +++ b/sys/fs/ubixfs/directory.c @@ -27,9 +27,9 @@ *****************************************************************************************/ -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/sys/fs/ubixfs/thread.c b/sys/fs/ubixfs/thread.c index 69481e4..b1205a4 100644 --- a/sys/fs/ubixfs/thread.c +++ b/sys/fs/ubixfs/thread.c @@ -27,9 +27,9 @@ *****************************************************************************************/ -#include +#include #include -#include +#include #include static struct { diff --git a/sys/fs/ubixfs/ubixfs.c b/sys/fs/ubixfs/ubixfs.c index 602331c..2ea5462 100644 --- a/sys/fs/ubixfs/ubixfs.c +++ b/sys/fs/ubixfs/ubixfs.c @@ -27,9 +27,9 @@ *****************************************************************************************/ -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/sys/fs/ufs/ffs.c b/sys/fs/ufs/ffs.c index c9b8721..2a74592 100644 --- a/sys/fs/ufs/ffs.c +++ b/sys/fs/ufs/ffs.c @@ -1,6 +1,6 @@ -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/sys/fs/ufs/ufs.c b/sys/fs/ufs/ufs.c index 9ecb3ce..c3ecd6d 100644 --- a/sys/fs/ufs/ufs.c +++ b/sys/fs/ufs/ufs.c @@ -28,10 +28,10 @@ *****************************************************************************************/ #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include diff --git a/sys/fs/vfs/file.c b/sys/fs/vfs/file.c index 4534ab6..69e670d 100644 --- a/sys/fs/vfs/file.c +++ b/sys/fs/vfs/file.c @@ -27,7 +27,7 @@ */ #include -#include +#include #include #include #include diff --git a/sys/fs/vfs/inode.c b/sys/fs/vfs/inode.c index 30816cc..6794040 100644 --- a/sys/fs/vfs/inode.c +++ b/sys/fs/vfs/inode.c @@ -26,7 +26,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include #include #include diff --git a/sys/fs/vfs/mount.c b/sys/fs/vfs/mount.c index 4363a75..7834732 100644 --- a/sys/fs/vfs/mount.c +++ b/sys/fs/vfs/mount.c @@ -26,7 +26,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include #include #include #include diff --git a/sys/fs/vfs/namei.c b/sys/fs/vfs/namei.c index 139bb9c..2991df0 100644 --- a/sys/fs/vfs/namei.c +++ b/sys/fs/vfs/namei.c @@ -28,7 +28,7 @@ #include #include -#include +#include #include int follow_link(struct inode * dir, struct inode * inode, int flag, int mode, struct inode ** res_inode) { diff --git a/sys/fs/vfs/stat.c b/sys/fs/vfs/stat.c index ff102b6..5b5ea1b 100644 --- a/sys/fs/vfs/stat.c +++ b/sys/fs/vfs/stat.c @@ -28,8 +28,8 @@ #include #include -#include -#include +#include +#include #include #include diff --git a/sys/fs/vfs/vfs.c b/sys/fs/vfs/vfs.c index 63f5535..5f3914a 100644 --- a/sys/fs/vfs/vfs.c +++ b/sys/fs/vfs/vfs.c @@ -26,7 +26,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include #include #include #include diff --git a/sys/i386/cpu.c b/sys/i386/cpu.c index ef9e0c0..ceb3db9 100644 --- a/sys/i386/cpu.c +++ b/sys/i386/cpu.c @@ -26,4 +26,4 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include diff --git a/sys/i386/i386_exec.c b/sys/i386/i386_exec.c index ae96533..ad86bab 100644 --- a/sys/i386/i386_exec.c +++ b/sys/i386/i386_exec.c @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/sys/i386/memcmp.S b/sys/i386/memcmp.S index c8e68c2..6f250dd 100644 --- a/sys/i386/memcmp.S +++ b/sys/i386/memcmp.S @@ -26,7 +26,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include + #include ENTRY(memcmp) pushl %edi diff --git a/sys/i386/memset.S b/sys/i386/memset.S index 03bef8d..128d1d1 100644 --- a/sys/i386/memset.S +++ b/sys/i386/memset.S @@ -26,7 +26,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include + #include ENTRY(memset) diff --git a/sys/i386/sched.c b/sys/i386/sched.c index 069868d..98ec14f 100644 --- a/sys/i386/sched.c +++ b/sys/i386/sched.c @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/sys/i386/strcmp.S b/sys/i386/strcmp.S index 19bb2ff..79884e2 100644 --- a/sys/i386/strcmp.S +++ b/sys/i386/strcmp.S @@ -26,7 +26,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include + #include ENTRY(strcmp) movl 0x04(%esp),%eax diff --git a/sys/i386/strcpy.S b/sys/i386/strcpy.S index e6f6a0c..dd55272 100644 --- a/sys/i386/strcpy.S +++ b/sys/i386/strcpy.S @@ -26,7 +26,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include + #include ENTRY(strcpy) movl 4(%esp),%ecx /* dst address */ diff --git a/sys/i386/strncmp.S b/sys/i386/strncmp.S index 9696281..30d5ba1 100644 --- a/sys/i386/strncmp.S +++ b/sys/i386/strncmp.S @@ -26,7 +26,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include + #include ENTRY(strncmp) pushl %ebx diff --git a/sys/i386/support.S b/sys/i386/support.S index 347cdf8..6b4c974 100644 --- a/sys/i386/support.S +++ b/sys/i386/support.S @@ -26,7 +26,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include + #include .text // void bzero(void *buf, u_int len) diff --git a/sys/i386/trap.c b/sys/i386/trap.c index 60f0c65..5bba1f8 100644 --- a/sys/i386/trap.c +++ b/sys/i386/trap.c @@ -26,7 +26,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include #include #include #include diff --git a/sys/include/isa/8259.h b/sys/include/isa/8259.h deleted file mode 100644 index df36487..0000000 --- a/sys/include/isa/8259.h +++ /dev/null @@ -1,74 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _ISA_8259_H -#define _ISA_8259_H - -#include - -#define mPic 0x20 // I/O for master PIC -#define mImr 0x21 // I/O for master IMR -#define sPic 0xA0 // I/O for slave PIC -#define sImr 0xA1 // I/O for slace IMR -#define eoi 0x20 // EOI command -#define icw1 0x11 // Cascade, Edge triggered -#define icw4 0x01 // 8088 mode -#define mVec 0x68 // Vector for master -#define sVec 0x70 // Vector for slave -#define ocw3Irr 0x0A // Read IRR -#define ocw3Isr 0x0B // Read ISR - -int i8259_init(); -void irqEnable(uInt16 irqNo); -void irqDisable(uInt16 irqNo); - -#endif - -/*** - $Log: 8259.h,v $ - Revision 1.1.1.1 2006/06/01 12:46:14 reddawg - ubix2 - - Revision 1.2 2005/10/12 00:13:36 reddawg - Removed - - Revision 1.1.1.1 2005/09/26 17:23:39 reddawg - no message - - Revision 1.4 2004/07/09 13:20:08 reddawg - Oh yeah duh you can not name functions with numbers - - Revision 1.3 2004/07/09 13:14:29 reddawg - 8259: changed init8259 to 8259_init - Adjusted Startup Routines - - Revision 1.2 2004/05/21 14:57:16 reddawg - Cleaned up - - END - ***/ diff --git a/sys/include/isa/atkbd.h b/sys/include/isa/atkbd.h deleted file mode 100644 index c1e41d9..0000000 --- a/sys/include/isa/atkbd.h +++ /dev/null @@ -1,46 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _ISA_ATKBD_H -#define _ISA_ATKBD_H - -#define shiftKey 1 -#define controlKey 2 -#define altKey 4 -#define ledNumlock 2 -#define ledScrolllock 1 -#define ledCapslock 4 - -int atkbd_init(); -void atkbd_isr(); - -void keyboardHandler(); -void setLED(); - - -#endif /* END _ISA_ATKBD_H */ diff --git a/sys/include/isa/fdc.h b/sys/include/isa/fdc.h deleted file mode 100644 index fcc33b8..0000000 --- a/sys/include/isa/fdc.h +++ /dev/null @@ -1,108 +0,0 @@ -/***************************************************************************************** - Copyright (c) 2002-2004 The UbixOS Project - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, are - permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this list of - conditions, the following disclaimer and the list of authors. Redistributions in binary - form must reproduce the above copyright notice, this list of conditions, the following - disclaimer and the list of authors in the documentation and/or other materials provided - with the distribution. Neither the name of the UbixOS Project nor the names of its - contributors may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY - EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - $Id: fdc.h 79 2016-01-11 16:21:27Z reddawg $ - -*****************************************************************************************/ - -#ifndef _FDC_H -#define _FDC_H - -#include - -typedef struct DrvGeom { - Int8 heads; - Int8 tracks; - Int8 spt; -} drvGeom; - - -#define fdcMsr (0x3f4) -#define fdcData (0x3f5) -#define fdcDir (0x3f7) -#define fdcCcr (0x3f7) -#define fdcDor (0x3f2) -#define fdcDrs (0x3f4) - -#define cmdWrite (0xc5) -#define cmdRead (0xe6) -#define cmdSeek (0x0f) -#define cmdSensei (0x08) -#define cmdRecal (0x07) -#define cmdSpecify (0x03) - -#define dg144Heads 2 /* heads per drive (1.44M) */ -#define dg144Tracks 80 -#define dg144Spt 18 -#define dg144Gap3rw 0x1b -#define dg168Gap3rw 0x1c - - - -int fdc_init(); -void floppyIsr(); -void floppyIsrhndlr(); -void sendByte(int Int8); -int getByte(); -bool fdcRw(int block,unsigned char *blockBuffer,bool read,unsigned long numSectors); -void block2Hts(int block,int *head,int *track,int *sector); -void motorOn(void); -void motorOff(void); -bool seek(int track); -bool waitFdc(bool sensei); -int getByte(); -void sendByte(int Int8); -void recalibrate(void); -void reset(void); -bool writeBlock(int block,Int8 *blockBuffer, unsigned long numSectors); -bool readBlock(int block,Int8 *blockBuffer, unsigned long numSectors); -void fdcWrite(void *info,void *,uInt32 startSector,uInt32 sectorCount); -void fdcRead(void *info,void *,uInt32 startSector,uInt32 sectorCount); - -#endif - -/*** - $Log: fdc.h,v $ - Revision 1.1.1.1 2006/06/01 12:46:14 reddawg - ubix2 - - Revision 1.2 2005/10/12 00:13:36 reddawg - Removed - - Revision 1.1.1.1 2005/09/26 17:23:39 reddawg - no message - - Revision 1.6 2004/07/17 02:38:31 reddawg - Fixed a few problems - - Revision 1.5 2004/07/14 12:42:46 reddawg - fdc: fdcInit to fdc_init - Changed Startup Routines - - Revision 1.4 2004/05/21 14:57:16 reddawg - Cleaned up - - END - ***/ diff --git a/sys/include/isa/mouse.h b/sys/include/isa/mouse.h deleted file mode 100644 index 240f253..0000000 --- a/sys/include/isa/mouse.h +++ /dev/null @@ -1,53 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _ISA_MOUSE_H -#define _ISA_MOUSE_H - -int mouseInit(); -void mouseISR(); -void mouseHandler(); - -#endif - -/*** - $Log: mouse.h,v $ - Revision 1.1.1.1 2006/06/01 12:46:14 reddawg - ubix2 - - Revision 1.2 2005/10/12 00:13:36 reddawg - Removed - - Revision 1.1.1.1 2005/09/26 17:23:39 reddawg - no message - - Revision 1.1 2004/06/04 10:20:53 reddawg - mouse drive: fixed a few bugs works a bit better now - - END - ***/ diff --git a/sys/include/isa/ne2k.h b/sys/include/isa/ne2k.h deleted file mode 100644 index e908f9c..0000000 --- a/sys/include/isa/ne2k.h +++ /dev/null @@ -1,190 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _ISA_NE2K_H -#define _ISA_NE2K_H - -#include -#include - -#define ether_addr ether_addr_t -typedef struct dp_rcvhdr -{ - uInt8 dr_status; /* Copy of rsr */ - uInt8 dr_next; /* Pointer to next packet */ - uInt8 dr_rbcl; /* Receive Byte Count Low */ - uInt8 dr_rbch; /* Receive Byte Count High */ -} dp_rcvhdr_t; - -typedef union etheraddr { - unsigned char bytes[6]; /* byteorder safe initialization */ - unsigned short shorts[3]; /* force 2-byte alignment */ -} ether_addr; - - -#define RSR_FO 0x08 -#define RSR_PRX 0x01 -#define DEF_ENABLED 0x200 - -#define OK 0 - - -#define startPage 0x4C -#define stopPage 0x80 - - -#define NE_CMD 0x00 -#define NE_PSTART 0x01 -#define NE_PSTOP 0x02 -#define NE_BNRY 0x03 -#define NE_TPSR 0x04 -#define NE_ISR 0x07 -#define NE_CURRENT 0x07 -#define NE_RBCR0 0x0A -#define NE_RBCR1 0x0B -#define NE_RCR 0x0C -#define NE_TCR 0x0D -#define NE_DCR 0x0E -#define NE_IMR 0x0F - - -#define NE_DCR_WTS 0x01 -#define NE_DCR_LS 0x08 -#define NE_DCR_AR 0x10 -#define NE_DCR_FT1 0x40 -#define NE_DCR_FT0 0x20 - - - -#define E8390_STOP 0x01 -#define E8390_NODMA 0x20 -#define E8390_PAGE0 0x00 -#define E8390_PAGE1 0x40 -#define E8390_CMD 0x00 -#define E8390_START 0x02 -#define E8390_RREAD 0x08 -#define E8390_RWRITE 0x10 -#define E8390_RXOFF 0x20 -#define E8390_TXOFF 0x00 -#define E8390_RXCONFIG 0x04 -#define E8390_TXCONFIG 0x00 - -#define EN0_COUNTER0 0x0d -#define EN0_DCFG 0x0e -#define EN0_RCNTLO 0x0a -#define EN0_RCNTHI 0x0b -#define EN0_ISR 0x07 -#define EN0_IMR 0x0f -#define EN0_RSARLO 0x08 -#define EN0_RSARHI 0x09 -#define EN0_TPSR 0x04 -#define EN0_RXCR 0x0c -#define EN0_TXCR 0x0D -#define EN0_STARTPG 0x01 -#define EN0_STOPPG 0x02 -#define EN0_BOUNDARY 0x03 - -#define EN1_PHYS 0x01 -#define EN1_CURPAG 0x07 -#define EN1_MULT 0x08 - -#define NE1SM_START_PG 0x20 -#define NE1SM_STOP_PG 0x40 -#define NESM_START_PG 0x40 -#define NESM_STOP_PG 0x80 - -#define ENISR_ALL 0x3f - -#define ENDCFG_WTS 0x01 - -#define NE_DATAPORT 0x10 - -#define TX_2X_PAGES 12 -#define TX_1X_PAGES 6 -#define TX_PAGES (dev->priv->pingPong ? TX_2X_PAGES : TX_1X_PAGES) - - -#define DP_CURR 0x7 /* Current Page Register */ -#define DP_MAR0 0x8 /* Multicast Address Register 0 */ -#define DP_MAR1 0x9 /* Multicast Address Register 1 */ -#define DP_MAR2 0xA /* Multicast Address Register 2 */ -#define DP_MAR3 0xB /* Multicast Address Register 3 */ -#define DP_MAR4 0xC /* Multicast Address Register 4 */ -#define DP_MAR5 0xD /* Multicast Address Register 5 */ -#define DP_MAR6 0xE /* Multicast Address Register 6 */ -#define DP_MAR7 0xF /* Multicast Address Register 7 */ - -#define DP_CNTR0 0xD /* Tally Counter 0 */ -#define DP_CNTR1 0xE /* Tally Counter 1 */ -#define DP_CNTR2 0xF /* Tally Counter 2 */ - - -#define DP_PAGESIZE 256 - -extern char *nicPacket; -extern uInt32 packetLength; - - -int ne2k_init(); -int ne2kProbe(int,struct device *); -int ne2kDevInit(struct device *); -void NS8390_init(struct device *dev,int startp); - -void ne2kISR(); -void ne2kHandler(); - -int NICtoPC(struct device *dev,void *packet,int length,int nic_addr); -int PCtoNIC(struct device *dev,void *packet,int length); - -struct nicBuffer *ne2kAllocBuffer(int); -struct nicBuffer *ne2kGetBuffer(); -void ne2kFreeBuffer(struct nicBuffer *); - -#endif - -/*** - $Log: ne2k.h,v $ - Revision 1.1.1.1 2006/06/01 12:46:14 reddawg - ubix2 - - Revision 1.2 2005/10/12 00:13:36 reddawg - Removed - - Revision 1.1.1.1 2005/09/26 17:23:39 reddawg - no message - - Revision 1.6 2004/07/14 12:03:49 reddawg - ne2k: ne2kInit to ne2k_init - Changed Startup Routines - - Revision 1.5 2004/05/21 14:57:16 reddawg - Cleaned up - - - END - ***/ diff --git a/sys/include/isa/pit.h b/sys/include/isa/pit.h deleted file mode 100644 index 628fd22..0000000 --- a/sys/include/isa/pit.h +++ /dev/null @@ -1,67 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _ISA_PIT_H -#define _ISA_PIT_H - -#define PIT_TIMER 200 - -int pit_init(); - -#endif - -/*** - $Log: pit.h,v $ - Revision 1.1.1.1 2006/06/01 12:46:14 reddawg - ubix2 - - Revision 1.2 2005/10/12 00:13:36 reddawg - Removed - - Revision 1.1.1.1 2005/09/26 17:23:40 reddawg - no message - - Revision 1.6 2004/08/14 11:23:02 reddawg - Changes - - Revision 1.5 2004/07/16 04:06:32 reddawg - Tune ups this stuff should of been taken care of months ago - - Revision 1.4 2004/07/16 01:08:58 reddawg - Whew we work once again - - Revision 1.3 2004/07/09 13:29:15 reddawg - pit: pitInit to pit_init - Adjusted initialization routines - - Revision 1.2 2004/05/21 14:57:16 reddawg - Cleaned up - - END - ***/ - diff --git a/sys/include/mpi/mpi.h b/sys/include/mpi/mpi.h deleted file mode 100644 index 0b1ce14..0000000 --- a/sys/include/mpi/mpi.h +++ /dev/null @@ -1,62 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _MPI_MPI_H -#define _MPI_MPI_H - -#include -#include - -#define MESSAGE_LENGTH 248 - -struct mpi_message { - char data[MESSAGE_LENGTH]; - uInt32 header; - pidType pid; - struct mpi_message *next; -}; - -struct mpi_mbox { - struct mpi_mbox *next; - struct mpi_mbox *prev; - struct mpi_message *msg; - struct mpi_message *msgLast; - char name[64]; - pidType pid; -}; - -typedef struct mpi_mbox mpi_mbox_t; -typedef struct mpi_message mpi_message_t; - -int mpi_createMbox(char *); -int mpi_destroyMbox(char *); -int mpi_postMessage(char *, uInt32, mpi_message_t *); -int mpi_fetchMessage(char *, mpi_message_t *); -int mpi_spam(uInt32, void *); - -#endif diff --git a/sys/include/pci/hd.h b/sys/include/pci/hd.h deleted file mode 100644 index 6b0870e..0000000 --- a/sys/include/pci/hd.h +++ /dev/null @@ -1,487 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _PCI_HD_H_ -#define _PCI_HD_H_ - -#include -#include - -#define hdData 0x0 -#define hdError 0x1 -#define hdSecCount 0x2 -#define hdSecNum 0x3 -#define hdCylLow 0x4 -#define hdCylHi 0x5 -#define hdHead 0x6 -#define hdStat 0x7 -#define hdCmd 0x7 - -/* ATA Uhm? */ -#define ATA_IDENTIFY_COMMAND_SET_SUPPORTED1_48BIT_ENABLE 0x0400 -#define ATA_IDENTIFY_SECTOR_LARGER_THEN_512_ENABLE 0x0100 - -/* ATA register defines */ -#define ATA_DATA 0 /* (RW) data */ - -#define ATA_FEATURE 1 /* (W) feature */ -#define ATA_F_DMA 0x01 /* enable DMA */ -#define ATA_F_OVL 0x02 /* enable overlap */ - -#define ATA_COUNT 2 /* (W) sector count */ - -#define ATA_SECTOR 3 /* (RW) sector # */ -#define ATA_CYL_LSB 4 /* (RW) cylinder# LSB */ -#define ATA_CYL_MSB 5 /* (RW) cylinder# MSB */ -#define ATA_DRIVE 6 /* (W) Sector/Drive/Head */ -#define ATA_D_LBA 0x40 /* use LBA addressing */ -#define ATA_D_IBM 0xa0 /* 512 byte sectors, ECC */ - -#define ATA_COMMAND 7 /* (W) command */ - -#define ATA_ERROR 8 /* (R) error */ -#define ATA_E_ILI 0x01 /* illegal length */ -#define ATA_E_NM 0x02 /* no media */ -#define ATA_E_ABORT 0x04 /* command aborted */ -#define ATA_E_MCR 0x08 /* media change request */ -#define ATA_E_IDNF 0x10 /* ID not found */ -#define ATA_E_MC 0x20 /* media changed */ -#define ATA_E_UNC 0x40 /* uncorrectable data */ -#define ATA_E_ICRC 0x80 /* UDMA crc error */ -#define ATA_E_ATAPI_SENSE_MASK 0xf0 /* ATAPI sense key mask */ - -#define ATA_IREASON 9 /* (R) interrupt reason */ -#define ATA_I_CMD 0x01 /* cmd (1) | data (0) */ -#define ATA_I_IN 0x02 /* read (1) | write (0) */ -#define ATA_I_RELEASE 0x04 /* released bus (1) */ -#define ATA_I_TAGMASK 0xf8 /* tag mask */ - -#define ATA_STATUS 10 /* (R) status */ -#define ATA_ALTSTAT 11 /* (R) alternate status */ -#define ATA_S_ERROR 0x01 /* error */ -#define ATA_S_INDEX 0x02 /* index */ -#define ATA_S_CORR 0x04 /* data corrected */ -#define ATA_S_DRQ 0x08 /* data request */ -#define ATA_S_DSC 0x10 /* drive seek completed */ -#define ATA_S_SERVICE 0x10 /* drive needs service */ -#define ATA_S_DWF 0x20 /* drive write fault */ -#define ATA_S_DMA 0x20 /* DMA ready */ -#define ATA_S_READY 0x40 /* drive ready */ -#define ATA_S_BUSY 0x80 /* busy */ - -#define ATA_CONTROL 12 /* (W) control */ - -#define ATA_CTLOFFSET 0x206 /* control register offset */ -#define ATA_PCCARD_CTLOFFSET 0x0e /* do for PCCARD devices */ -#define ATA_PC98_CTLOFFSET 0x10c /* do for PC98 devices */ -#define ATA_A_IDS 0x02 /* disable interrupts */ -#define ATA_A_RESET 0x04 /* RESET controller */ -#ifdef ATA_LEGACY_SUPPORT -#define ATA_A_4BIT 0x08 /* 4 head bits: obsolete 1996 */ -#else -#define ATA_A_4BIT 0x00 -#endif -#define ATA_A_HOB 0x80 /* High Order Byte enable */ - -/* ATA Commands */ -#define ATA_IDENTIFY 0xEC -#define ATA_CHECK_POWER_MODE 0xE5 -#define ATA_STANDBY 0xE2 -#define ATA_STANDBY_IMMED 0xE0 -#define ATA_IDLE_IMMED 0xE1 -#define ATA_IDLE 0xE3 -#define ATA_FLUSH_CACHE 0xE7 -#define ATA_FLUSH_CACHE_EXT 0xEA -#define ATA_READ_DMA_EXT 0x25 -#define ATA_READ_DMA 0xC8 -#define ATA_READ_SECTORS_EXT 0x24 -#define ATA_READ_SECTORS 0x20 -#define ATA_WRITE_DMA_EXT 0x35 -#define ATA_WRITE_DMA 0xCA -#define ATA_WRITE_SECTORS_EXT 0x34 -#define ATA_WRITE_SECTORS 0x30 -#define ATA_WRITE_UNCORRECTABLE 0x45 -#define ATA_READ_VERIFY_SECTORS 0x40 -#define ATA_READ_VERIFY_SECTORS_EXT 0x42 -#define ATA_READ_BUFFER 0xE4 -#define ATA_WRITE_BUFFER 0xE8 -#define ATA_EXECUTE_DEVICE_DIAG 0x90 -#define ATA_SET_FEATURES 0xEF -#define ATA_SMART 0xB0 -#define ATA_PACKET_IDENTIFY 0xA1 -#define ATA_PACKET 0xA0 -#define ATA_READ_FPDMA 0x60 -#define ATA_WRITE_FPDMA 0x61 -#define ATA_READ_LOG_EXT 0x2F -#define ATA_NOP 0x00 -#define ATA_DEVICE_RESET 0x08 -#define ATA_MEDIA_EJECT 0xED -#define ATA_SECURITY_UNLOCK 0xF2 -#define ATA_SECURITY_FREEZE_LOCK 0xF5 -#define ATA_DATA_SET_MANAGEMENT 0x06 -#define ATA_DOWNLOAD_MICROCODE 0x92 -#define ATA_WRITE_STREAM_DMA_EXT 0x3A -#define ATA_READ_LOG_DMA_EXT 0x47 -#define ATA_READ_STREAM_DMA_EXT 0x2A -#define ATA_WRITE_DMA_FUA 0x3D -#define ATA_WRITE_LOG_DMA_EXT 0x57 -#define ATA_READ_DMA_QUEUED 0xC7 -#define ATA_READ_DMA_QUEUED_EXT 0x26 -#define ATA_WRITE_DMA_QUEUED 0xCC -#define ATA_WRITE_DMA_QUEUED_EXT 0x36 -#define ATA_WRITE_DMA_QUEUED_FUA_EXT 0x3E -#define ATA_READ_MULTIPLE 0xC4 -#define ATA_READ_MULTIPLE_EXT 0x29 -#define ATA_WRITE_MULTIPLE 0xC5 -#define ATA_WRITE_MULTIPLE_EXT 0x39 -#define ATA_WRITE_MULTIPLE_FUA_EXT 0xCE - -struct driveInfo { - struct driveDiskLabel *diskLabel; - struct ata_identify_data *ata_identify; - uint32_t lba_high; - uint32_t lba_low; - uint32_t sector_size; - char hdEnable; - char hdDev; - char hdFlags; - char hdShift; - long hdMask; - uint32_t hdMulti; - long hdPort; - long hdSize; - long hdCalc; - long parOffset; - int part; - long lba_start; - long lba_end; -}; - -int initHardDisk(); -int hdWrite(struct driveInfo *hdd, void *, uInt32, uInt32); -int hdRead(struct driveInfo *hdd, void *, uInt32, uInt32); -int hdReset(); -int hdIoctl(); -int hdStart(); -int hdStop(); -int hdStandby(); -int hdInit(struct device_node *dev); - -struct dos_partition { - unsigned char dp_flag; /* bootstrap flags */ - unsigned char dp_shd; /* starting head */ - unsigned char dp_ssect; /* starting sector */ - unsigned char dp_scyl; /* starting cylinder */ - unsigned char dp_type; /* partition type */ - unsigned char dp_ehd; /* end head */ - unsigned char dp_esect; /* end sector */ - unsigned char dp_ecyl; /* end cylinder */ - uInt32 dp_start; /* absolute starting sector number */ - uInt32 dp_size; /* partition size in sectors */ -}; - -#define MAXPARTITIONS 8 - -struct bsd_disklabel { - uint32_t d_magic; /* the magic number */ - u_int16_t d_type; /* drive type */ - u_int16_t d_subtype; /* controller/d_type specific */ - char d_typename[16]; /* type name, e.g. "eagle" */ - - char d_packname[16]; /* pack identifier */ - - /* disk geometry: */ - uint32_t d_secsize; /* # of bytes per sector */ - uint32_t d_nsectors; /* # of data sectors per track */ - uint32_t d_ntracks; /* # of tracks per cylinder */ - uint32_t d_ncylinders; /* # of data cylinders per unit */ - uint32_t d_secpercyl; /* # of data sectors per cylinder */ - uint32_t d_secperunit; /* # of data sectors per unit */ - - /* - * Spares (bad sector replacements) below are not counted in - * d_nsectors or d_secpercyl. Spare sectors are assumed to - * be physical sectors which occupy space at the end of each - * track and/or cylinder. - */ - u_int16_t d_sparespertrack; /* # of spare sectors per track */ - u_int16_t d_sparespercyl; /* # of spare sectors per cylinder */ - /* - * Alternate cylinders include maintenance, replacement, configuration - * description areas, etc. - */ - uint32_t d_acylinders; /* # of alt. cylinders per unit */ - - /* hardware characteristics: */ - /* - * d_interleave, d_trackskew and d_cylskew describe perturbations - * in the media format used to compensate for a slow controller. - * Interleave is physical sector interleave, set up by the - * formatter or controller when formatting. When interleaving is - * in use, logically adjacent sectors are not physically - * contiguous, but instead are separated by some number of - * sectors. It is specified as the ratio of physical sectors - * traversed per logical sector. Thus an interleave of 1:1 - * implies contiguous layout, while 2:1 implies that logical - * sector 0 is separated by one sector from logical sector 1. - * d_trackskew is the offset of sector 0 on track N relative to - * sector 0 on track N-1 on the same cylinder. Finally, d_cylskew - * is the offset of sector 0 on cylinder N relative to sector 0 - * on cylinder N-1. - */ - u_int16_t d_rpm; /* rotational speed */ - u_int16_t d_interleave; /* hardware sector interleave */ - u_int16_t d_trackskew; /* sector 0 skew, per track */ - u_int16_t d_cylskew; /* sector 0 skew, per cylinder */ - uint32_t d_headswitch; /* head switch time, usec */ - uint32_t d_trkseek; /* track-to-track seek, usec */ - uint32_t d_flags; /* generic flags */ -#define NDDATA 5 - uint32_t d_drivedata[NDDATA]; /* drive-type specific information */ -#define NSPARE 5 - uint32_t d_spare[NSPARE]; /* reserved for future use */ - uint32_t d_magic2; /* the magic number (again) */ - u_int16_t d_checksum; /* xor of data incl. partitions */ - - /* filesystem and partition information: */ - u_int16_t d_npartitions; /* number of partitions in following */ - uint32_t d_bbsize; /* size of boot area at sn0, bytes */ - uint32_t d_sbsize; /* max size of fs superblock, bytes */ - struct partition { /* the partition table */ - uint32_t p_size; /* number of sectors in partition */ - uint32_t p_offset; /* starting sector */ - uint32_t p_fsize; /* filesystem basic fragment size */ - u_int8_t p_fstype; /* filesystem type, see below */ - u_int8_t p_frag; /* filesystem fragments per block */ - u_int16_t p_cpg; /* filesystem cylinders per group */ - } d_partitions[MAXPARTITIONS]; /* actually may be more */ -}; - -static const char *fstypenames[] = { "unused", "swap", "Version 6", "Version 7", "System V", "4.1BSD", "Eighth Edition", "4.2BSD", "MSDOS", "4.4LFS", "unknown", "HPFS", "ISO9660", "boot", "vinum", "raid", "?", "?", "?", "?", "jfs", NULL }; - -/** - * @name ATA_IDENTIFY_DEVICE_FIELD_LENGTHS - * - * The following constants define the number of bytes contained in various - * fields found in the IDENTIFY DEVICE data structure. - */ -#define ATA_IDENTIFY_SERIAL_NUMBER_LEN 20 -#define ATA_IDENTIFY_MODEL_NUMBER_LEN 40 -#define ATA_IDENTIFY_FW_REVISION_LEN 8 -#define ATA_IDENTIFY_48_LBA_LEN 8 -#define ATA_IDENTIFY_MEDIA_SERIAL_NUMBER_LEN 30 -#define ATA_IDENTIFY_WWN_LEN 8 - -struct ata_identify_data { - u_int16_t general_config_bits; // word 00 - u_int16_t obsolete0; // word 01 (num cylinders) - u_int16_t vendor_specific_config_bits; // word 02 - u_int16_t obsolete1; // word 03 (num heads) - u_int16_t retired1[2]; // words 04-05 - u_int16_t obsolete2; // word 06 (sectors / track) - u_int16_t reserved_for_compact_flash1[2]; // words 07-08 - u_int16_t retired0; // word 09 - u_int8_t serial_number[ATA_IDENTIFY_SERIAL_NUMBER_LEN]; // word 10-19 - u_int16_t retired2[2]; // words 20-21 - u_int16_t obsolete4; // word 22 - u_int8_t firmware_revision[ATA_IDENTIFY_FW_REVISION_LEN]; // words 23-26 - u_int8_t model_number[ATA_IDENTIFY_MODEL_NUMBER_LEN]; // words 27-46 - u_int16_t max_sectors_per_multiple; // word 47 - u_int16_t reserved0; // word 48 - u_int16_t capabilities1; // word 49 - u_int16_t capabilities2; // word 50 - u_int16_t obsolete5[2]; // words 51-52 - u_int16_t validity_bits; // word 53 - u_int16_t obsolete6[5]; // words 54-58 Used to be: - // current cylinders, - // current heads, - // current sectors/Track, - // current capacity - u_int16_t current_max_sectors_per_multiple; // word 59 - u_int8_t total_num_sectors[4]; // words 60-61 - u_int16_t obsolete7; // word 62 - u_int16_t multi_word_dma_mode; // word 63 - u_int16_t pio_modes_supported; // word 64 - u_int16_t min_multiword_dma_transfer_cycle; // word 65 - u_int16_t rec_min_multiword_dma_transfer_cycle; // word 66 - u_int16_t min_pio_transfer_no_flow_ctrl; // word 67 - u_int16_t min_pio_transfer_with_flow_ctrl; // word 68 - u_int16_t additional_supported; // word 69 - u_int16_t reserved1; // word 70 - u_int16_t reserved2[4]; // words 71-74 - u_int16_t queue_depth; // word 75 - u_int16_t serial_ata_capabilities; // word 76 - u_int16_t serial_ata_reserved; // word 77 - u_int16_t serial_ata_features_supported; // word 78 - u_int16_t serial_ata_features_enabled; // word 79 - u_int16_t major_version_number; // word 80 - u_int16_t minor_version_number; // word 81 - u_int16_t command_set_supported0; // word 82 - u_int16_t command_set_supported1; // word 83 - u_int16_t command_set_supported_extention; // word 84 - u_int16_t command_set_enabled0; // word 85 - u_int16_t command_set_enabled1; // word 86 - u_int16_t command_set_default; // word 87 - u_int16_t ultra_dma_mode; // word 88 - u_int16_t security_erase_completion_time; // word 89 - u_int16_t enhanced_security_erase_time; // word 90 - u_int16_t current_power_mgmt_value; // word 91 - u_int16_t master_password_revision; // word 92 - u_int16_t hardware_reset_result; // word 93 - u_int16_t current_acoustic_management_value; // word 94 - u_int16_t stream_min_request_size; // word 95 - u_int16_t stream_transfer_time; // word 96 - u_int16_t stream_access_latency; // word 97 - u_int16_t stream_performance_granularity[2]; // words 98-99 - u_int8_t max_48bit_lba[ATA_IDENTIFY_48_LBA_LEN]; // words 100-103 - u_int16_t streaming_transfer_time; // word 104 - u_int16_t max_lba_range_entry_blocks; // word 105 - u_int16_t physical_logical_sector_info; // word 106 - u_int16_t acoustic_test_interseek_delay; // word 107 - u_int8_t world_wide_name[ATA_IDENTIFY_WWN_LEN]; // words 108-111 - u_int8_t reserved_for_wwn_extention[ATA_IDENTIFY_WWN_LEN]; // words 112-115 - u_int16_t reserved4; // word 116 - u_int8_t words_per_logical_sector[4]; // words 117-118 - u_int16_t command_set_supported2; // word 119 - u_int16_t reserved5[7]; // words 120-126 - u_int16_t removable_media_status; // word 127 - u_int16_t security_status; // word 128 - u_int16_t vendor_specific1[31]; // words 129-159 - u_int16_t cfa_power_mode1; // word 160 - u_int16_t reserved_for_compact_flash2[7]; // words 161-167 - u_int16_t device_nominal_form_factor; // word 168 - u_int16_t data_set_management; // word 169 - u_int16_t reserved_for_compact_flash3[6]; // words 170-175 - u_int16_t current_media_serial_number[ATA_IDENTIFY_MEDIA_SERIAL_NUMBER_LEN]; //words 176-205 - u_int16_t reserved6[3]; // words 206-208 - u_int16_t logical_sector_alignment; // words 209 - u_int16_t reserved7[7]; // words 210-216 - u_int16_t nominal_media_rotation_rate; // word 217 - u_int16_t reserved8[16]; // words 218-233 - u_int16_t min_num_blocks_per_microcode; // word 234 - u_int16_t max_num_blocks_per_microcode; // word 235 - u_int16_t reserved9[19]; // words 236-254 - u_int16_t integrity_word; // word 255 -}; - -/* - * A list of partition types, probably outdated. - */ -static const char * const part_types[256] = { - [0x00] = "unused", - [0x01] = "Primary DOS with 12 bit FAT", - [0x02] = "XENIX / file system", - [0x03] = "XENIX /usr file system", - [0x04] = "Primary DOS with 16 bit FAT (< 32MB)", - [0x05] = "Extended DOS", - [0x06] = "Primary DOS, 16 bit FAT (>= 32MB)", - [0x07] = "NTFS, OS/2 HPFS, QNX-2 (16 bit) or Advanced UNIX", - [0x08] = "AIX file system or SplitDrive", - [0x09] = "AIX boot partition or Coherent", - [0x0A] = "OS/2 Boot Manager, OPUS or Coherent swap", - [0x0B] = "DOS or Windows 95 with 32 bit FAT", - [0x0C] = "DOS or Windows 95 with 32 bit FAT (LBA)", - [0x0E] = "Primary 'big' DOS (>= 32MB, LBA)", - [0x0F] = "Extended DOS (LBA)", - [0x10] = "OPUS", - [0x11] = "OS/2 BM: hidden DOS with 12-bit FAT", - [0x12] = "Compaq diagnostics", - [0x14] = "OS/2 BM: hidden DOS with 16-bit FAT (< 32MB)", - [0x16] = "OS/2 BM: hidden DOS with 16-bit FAT (>= 32MB)", - [0x17] = "OS/2 BM: hidden IFS (e.g. HPFS)", - [0x18] = "AST Windows swapfile", - [0x1b] = "ASUS Recovery partition (NTFS)", - [0x24] = "NEC DOS", - [0x3C] = "PartitionMagic recovery", - [0x39] = "plan9", - [0x40] = "VENIX 286", - [0x41] = "Linux/MINIX (sharing disk with DRDOS)", - [0x42] = "SFS or Linux swap (sharing disk with DRDOS)", - [0x43] = "Linux native (sharing disk with DRDOS)", - [0x4D] = "QNX 4.2 Primary", - [0x4E] = "QNX 4.2 Secondary", - [0x4F] = "QNX 4.2 Tertiary", - [0x50] = "DM (disk manager)", - [0x51] = "DM6 Aux1 (or Novell)", - [0x52] = "CP/M or Microport SysV/AT", - [0x53] = "DM6 Aux3", - [0x54] = "DM6", - [0x55] = "EZ-Drive (disk manager)", - [0x56] = "Golden Bow (disk manager)", - [0x5c] = "Priam Edisk (disk manager)", /* according to S. Widlake */ - [0x61] = "SpeedStor", - [0x63] = "System V/386 (such as ISC UNIX), GNU HURD or Mach", - [0x64] = "Novell Netware/286 2.xx", - [0x65] = "Novell Netware/386 3.xx", - [0x70] = "DiskSecure Multi-Boot", - [0x75] = "PCIX", - [0x77] = "QNX4.x", - [0x78] = "QNX4.x 2nd part", - [0x79] = "QNX4.x 3rd part", - [0x80] = "Minix until 1.4a", - [0x81] = "Minix since 1.4b, early Linux partition or Mitac disk manager", - [0x82] = "Linux swap or Solaris x86", - [0x83] = "Linux native", - [0x84] = "OS/2 hidden C: drive", - [0x85] = "Linux extended", - [0x86] = "NTFS volume set??", - [0x87] = "NTFS volume set??", - [0x93] = "Amoeba file system", - [0x94] = "Amoeba bad block table", - [0x9F] = "BSD/OS", - [0xA0] = "Suspend to Disk", - [0xA5] = "FreeBSD/NetBSD/386BSD", - [0xA6] = "OpenBSD", - [0xA7] = "NeXTSTEP", - [0xA9] = "NetBSD", - [0xAC] = "IBM JFS", - [0xAF] = "HFS+", - [0xB7] = "BSDI BSD/386 file system", - [0xB8] = "BSDI BSD/386 swap", - [0xBE] = "Solaris x86 boot", - [0xBF] = "Solaris x86 (new)", - [0xC1] = "DRDOS/sec with 12-bit FAT", - [0xC4] = "DRDOS/sec with 16-bit FAT (< 32MB)", - [0xC6] = "DRDOS/sec with 16-bit FAT (>= 32MB)", - [0xC7] = "Syrinx", - [0xDB] = "CP/M, Concurrent CP/M, Concurrent DOS or CTOS", - [0xDE] = "DELL Utilities - FAT filesystem", - [0xE1] = "DOS access or SpeedStor with 12-bit FAT extended partition", - [0xE3] = "DOS R/O or SpeedStor", - [0xE4] = "SpeedStor with 16-bit FAT extended partition < 1024 cyl.", - [0xEB] = "BeOS file system", - [0xEE] = "EFI GPT", - [0xEF] = "EFI System Partition", - [0xF1] = "SpeedStor", - [0xF2] = "DOS 3.3+ Secondary", - [0xF4] = "SpeedStor large partition", - [0xFB] = "VMware VMFS", - [0xFE] = "SpeedStor >1024 cyl. or LANstep", - [0xFF] = "Xenix bad blocks table", }; - -#endif diff --git a/sys/include/pci/lnc.h b/sys/include/pci/lnc.h deleted file mode 100644 index aafd2a0..0000000 --- a/sys/include/pci/lnc.h +++ /dev/null @@ -1,257 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _PCI_LNC_H -#define _PCI_LNC_H - -#include - -// TEMP COMMENT FRESH -#define RDP 0x10 // Register Data Port 16Bit -#define RDP32 0x10 // Register Data Port 32Bit -#define RAP 0x12 // Register Address Port 16Bit -#define RAP32 0x14 // Register Address Port 32Bit -#define RESET 0x14 // Reset Port 16Bit -#define RESET32 0x18 // Reset Port 32Bit -#define BDP 0x16 // 16Bit -#define BDP32 0x1C // 32Bit - -// BCR18 -#define BCR18 18 -#define BCR18_DWIO 0x0080 - -// BCR20 -#define BCR20 0x0014 - -// Modes -#define MODE_16 0 -#define MODE_32 1 -#define MODE_INVALID 3 - -// CSR0 -#define CSR0 0x0000 -#define CSR0_STOP 0x0004 - -// CSR15 -#define CSR15 15 -#define CSR15_DXMTFCS 0x0008 -#define CSR15_DRTY 0x0020 -#define CSR15_PROM 0x8000 - -// CSR58 -#define CSR58 0x003A - -struct mds { - uint16_t md0; - uint16_t md1; - short md2; - uint16_t md3; -}; - -struct hostRingEntry_old { - struct mds *md; - union { - //struct mbuf *mbuf; - char *data; - } buff; -}; - -struct hostRingEntry { - uint32_t addr; - uint16_t bcnt; - uint8_t md[6]; - uint32_t reserved; -}; - -struct arpcom { - //struct ifnet ac_if; /* network-visible interface */ - uint8_t ac_enaddr[6]; /* ethernet hardware address */ - int ac_multicnt; /* length of ac_multiaddrs list */ - void *ac_netgraph; /* ng_ether(4) netgraph node info */ -}; - -struct nicInfo { - int ident; /* Type of card */ - int ic; /* Type of ic, Am7990, Am79C960 etc. */ - int memMode; - int iobase; - int mode; /* Mode setting at initialization */ -}; - -struct initBlock16 { - uint16_t mode; // Mode register - uint8_t padr[6]; // Ethernet address - uint8_t ladrf[8]; // Logical address filter (multicast) - uint16_t rdra; // Low order pointer to receive ring - uint16_t rlen; // High order pointer and no. rings - uint16_t tdra; // Low order pointer to transmit ring - uint16_t tlen; // High order pointer and no rings -}; - -struct initBlock32 { - uint16_t mode; - uint8_t rlen; - uint8_t tlen; - uint8_t padr[6]; - uint16_t res; - uint8_t ladrf[8]; - uint32_t rdra; - uint32_t tdra; -}; - -struct lncInfo { - struct arpcom arpcom; - struct nicInfo nic; - struct hostRingEntry *rxRing; - char *rxBuffer; - struct hostRingEntry *txRing; - char *txBuffer; - struct initBlock32 init; - unsigned int ioAddr; - int nrdre; - int ntdre; - int bufferSize; - int txPtr; - int rxPtr; -}; - -/* Functions */ -void lnc_writeCSR(struct lncInfo *, uint16_t, uint16_t); -void lnc_writeCSR32(struct lncInfo *, uint32_t, uint32_t); - -uint16_t lnc_readCSR(struct lncInfo *, uint16_t); -uint32_t lnc_readCSR32(struct lncInfo *, uint32_t); - -void lnc_writeBCR(struct lncInfo *, uint16_t, uint16_t); -void lnc_writeBCR32(struct lncInfo *, uint32_t, uint32_t); - -uint16_t lnc_readBCR(struct lncInfo *, uint16_t); -uint32_t lnc_readBCR32(struct lncInfo *, uint32_t); - -void lnc_reset(struct lncInfo *); -void lnc_reset32(struct lncInfo *); - -int lnc_probe(struct lncInfo *); - -int lnc_switchDWord(struct lncInfo *); - -int lnc_getMode(struct lncInfo *); - -void lnc_isr(); -int lnc_driverOwnsRX(struct lncInfo *); -int lnc_driverOwnsRX(struct lncInfo *); - -void lnc_INT(); -void lnc_rxINT(); -void lnc_txINT(); - -// OLD - -#define NDESC(len2) (1 << len2) -#define NORMAL 0 -#define MEM_SLEW 8 -#define TRANSBUFSIZE 1518 -#define RECVBUFSIZE 1518 -#define NRDRE 3 -#define NTDRE 3 -#define ETHER_ADDR_LEN 6 -#define NE2100_IOSIZE 24 - -#define PCNET_VSW 0x18 -#define NE2100 2 - -/* mem_mode values */ -#define DMA_FIXED 1 -#define DMA_MBUF 2 -#define SHMEM 4 - -/********** Chip Types **********/ -#define UNKNOWN 0 /* Unknown */ -#define LANCE 1 /* Am7990 */ -#define C_LANCE 2 /* Am79C90 */ -#define PCnet_ISA 3 /* Am79C960 */ -#define PCnet_ISAplus 4 /* Am79C961 */ -#define PCnet_ISA_II 5 /* Am79C961A */ -#define PCnet_32 6 /* Am79C965 */ -#define PCnet_PCI 7 /* Am79C970 */ -#define PCnet_PCI_II 8 /* Am79C970A */ -#define PCnet_FAST 9 /* Am79C971 */ -#define PCnet_FASTplus 10 /* Am79C972 */ -#define PCnet_Home 11 /* Am79C978 */ - -/******** AM7990 Specifics **************/ -#define CSR1 1 -#define CSR2 2 -#define CSR3 3 -#define CSR88 88 -#define CSR89 89 - -#define ERR 0x8000 -#define BABL 0x4000 -#define CERR 0x2000 -#define MISS 0x1000 -#define MERR 0x0800 -#define RINT 0x0400 -#define TINT 0x0200 -#define IDON 0x0100 -#define INTR 0x0080 -#define INEA 0x0040 -#define RXON 0x0020 -#define TXON 0x0010 -#define TDMD 0x0008 - -#define STRT 0x0002 -#define INIT 0x0001 - -/* CSR88-89: Chip ID masks */ -#define AMD_MASK 0x003 -#define PART_MASK 0xffff -#define Am79C960 0x0003 -#define Am79C961 0x2260 -#define Am79C961A 0x2261 -#define Am79C965 0x2430 -#define Am79C970 0x0242 -#define Am79C970A 0x2621 -#define Am79C971 0x2623 -#define Am79C972 0x2624 -#define Am79C973 0x2625 -#define Am79C978 0x2626 - -extern struct lncInfo *lnc; - -int initLNC(); -int probe(struct lncInfo *lnc); -int lanceProbe(struct lncInfo *lnc); -int lncAttach(struct lncInfo *lnc, int unit); - -void lncInt(); -void _lncInt(); - -int lnc_sendPacket(struct lncInfo *lnc, void *packet, size_t len, uInt8 *dest); - -#endif diff --git a/sys/include/pci/pci.h b/sys/include/pci/pci.h deleted file mode 100644 index 1c8d00d..0000000 --- a/sys/include/pci/pci.h +++ /dev/null @@ -1,106 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _PCI_H -#define _PCI_H - -#include - -struct pciConfig { - uint16_t vendorID; - uint16_t deviceID; - - uint16_t command; - uint16_t status; - - uint8_t revisionID; - uint8_t progIf; - uint8_t subClass; - uint8_t classCode; - - uint8_t cacheLineSize; - uint8_t latencyTimer; - uint8_t headerType; - uint8_t bist; - - uint32_t bar[6]; - - uint32_t cbPointer; - - uint16_t subsysVendorID; - uint16_t subsysID; - - uint32_t epromAddr; - - uint16_t capabilites; - uint16_t res1; - - uint32_t res2; - - uint8_t intLine; - uint8_t intPin; - uint8_t minGrant; - uint8_t maxLatency; - - /* device info */ - //uint8_t bus; - //uint8_t dev; - //uint8_t func; - //uint8_t irq; - //uint8_t irqLine; - /* base registers */ - //uInt32 base[6]; - //uInt32 size[6]; - //uint16_t subsysVendor; - //uint16_t subsys; - /* Device Info */ - //Move this to anotther struct eventually - uint8_t bus; - uint8_t dev; - uint8_t func; - -}; - -struct confadd { - uint8_t reg :8; - uint8_t func :3; - uint8_t dev :5; - uint8_t bus :8; - uint8_t rsvd :7; - uint8_t enable :1; -}; - -#define countof(a) (sizeof(a) / sizeof(a[0])) - -int pci_init(); - -uint32_t pciProbe(int bus, int dev, int func); -uInt32 pciRead(int bus, int dev, int func, int reg, int bytes); -void pciWrite(int bus, int dev, int func, int reg, uInt32 v, int bytes); - -#endif diff --git a/sys/include/sde/ogDisplay_UbixOS.h b/sys/include/sde/ogDisplay_UbixOS.h deleted file mode 100644 index 8726d07..0000000 --- a/sys/include/sde/ogDisplay_UbixOS.h +++ /dev/null @@ -1,116 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef OGDISPLAY_UBIXOS_H -#define OGDISPLAY_UBIXOS_H - -#include -#include - -struct ogModeInfo { - uint16_t modeAttributes __attribute__((packed)); - uint8_t windowAFlags __attribute__((packed)); - uint8_t windowBFlags __attribute__((packed)); - uint16_t granularity __attribute__((packed)); - uint16_t windowSize __attribute__((packed)); - uint16_t windowASeg __attribute__((packed)); - uint16_t windowBSeg __attribute__((packed)); - void* bankSwitch __attribute__((packed)); - uint16_t bytesPerLine __attribute__((packed)); - uint16_t xRes __attribute__((packed)); - uint16_t yRes __attribute__((packed)); - uint8_t charWidth __attribute__((packed)); - uint8_t charHeight __attribute__((packed)); - uint8_t numBitPlanes __attribute__((packed)); - uint8_t bitsPerPixel __attribute__((packed)); - uint8_t numberOfBanks __attribute__((packed)); - uint8_t memoryModel __attribute__((packed)); - uint8_t bankSize __attribute__((packed)); - uint8_t numOfImagePages __attribute__((packed)); - uint8_t reserved __attribute__((packed)); - // Direct colour fields (required for Direct/6 and YUV/7 memory models - uint8_t redMaskSize __attribute__((packed)); - uint8_t redFieldPosition __attribute__((packed)); - uint8_t greenMaskSize __attribute__((packed)); - uint8_t greenFieldPosition __attribute__((packed)); - uint8_t blueMaskSize __attribute__((packed)); - uint8_t blueFieldPosition __attribute__((packed)); - uint8_t alphaMaskSize __attribute__((packed)); - uint8_t alphaFieldPosition __attribute__((packed)); - uint8_t directColourMode __attribute__((packed)); - // VESA 2.0 specific fields - uint32_t physBasePtr __attribute__((packed)); - void* offScreenMemOffset __attribute__((packed)); - uint16_t offScreenMemSize __attribute__((packed)); - uint8_t paddington[461] __attribute__((packed)); -}; - -struct ogVESAInfo { - char VBESignature[4] __attribute__((packed)); - uint8_t minVersion __attribute__((packed)); - uint8_t majVersion __attribute__((packed)); - uint32_t OEMStringPtr __attribute__((packed)); - uint32_t capabilities __attribute__((packed)); - uint32_t videoModePtr __attribute__((packed)); - uint16_t totalMemory __attribute__((packed)); - // VESA 2.0 specific fields - uint16_t OEMSoftwareRev __attribute__((packed)); - uint32_t OEMVendorNamePtr __attribute__((packed)); - uint32_t OEMProductNamePtr __attribute__((packed)); - uint32_t OEMProductRevPtr __attribute__((packed)); - uint8_t paddington[474] __attribute__((packed)); -}; - -class ogDisplay_UbixOS: public ogSurface { - protected: - void * pages[2]; - uint32_t activePage; - uint32_t visualPage; - ogVESAInfo * VESAInfo; - ogModeInfo * modeInfo; - - uint16_t FindMode(uint32_t, uint32_t, uint32_t); - void GetModeInfo(uint16_t); - void GetVESAInfo(void); - void SetMode(uint16_t); - void SetPal(void); - public: - ogDisplay_UbixOS(void); - virtual bool ogAlias(ogSurface&, uint32_t, uint32_t, uint32_t, uint32_t); - virtual bool ogClone(ogSurface&); - virtual void ogCopyPalette(ogSurface&); - virtual bool ogCreate(uint32_t, uint32_t, ogPixelFmt); - virtual bool ogLoadPalette(const char *); - virtual void ogSetPalette(const ogRGBA8[]); - virtual void ogSetPalette(uint8_t, uint8_t, uint8_t, uint8_t); - virtual void ogSetPalette(uint8_t, uint8_t, uint8_t, uint8_t, uint8_t); - virtual ~ogDisplay_UbixOS(void); -}; -// ogDisplay_UbixOS - -#endif diff --git a/sys/include/sde/sde.h b/sys/include/sde/sde.h deleted file mode 100644 index 4454434..0000000 --- a/sys/include/sde/sde.h +++ /dev/null @@ -1,62 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef _SDE_SDE_H -#define _SDE_SDE_H - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define registerWindow 1 -#define windowReady 2 -#define drawWindow 3 -#define killWindow 4 - -void sdeThread(); - -//void sysSDE(uint32_t cmd, void *ptr); -int sysSDE(struct thread *td, struct sys_sde_args *args); - -struct sdeWindows { - struct sdeWindows *next; - struct sdeWindows *prev; - void *buf; - pidType pid; - uint8_t status; -}; - -extern struct sdeWindows *windows; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/sys/include/string.h b/sys/include/string.h index ffc5559..781da93 100644 --- a/sys/include/string.h +++ b/sys/include/string.h @@ -26,10 +26,14 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef _STRING_H -#define _STRING_H +#ifndef _STRING_H_ +#define _STRING_H_ -#include +#include +#include +#include + + #include void *memcpy(const void *dst, const void * src, size_t length); @@ -44,31 +48,16 @@ char *strtok_r(char *str, const char *sep, char **last); char *strstr(const char *s, char *find); -extern u_char const bcd2bin_data[]; -extern u_char const bin2bcd_data[]; -extern char const hex2ascii_data[]; -#define bcd2bin(bcd) (bcd2bin_data[bcd]) -#define bin2bcd(bin) (bin2bcd_data[bin]) -#define hex2ascii(hex) (hex2ascii_data[hex]) - -#define toupper(c) ((c) - 0x20 * (((c) >= 'a') && ((c) <= 'z'))) -#define tolower(c) ((c) + 0x20 * (((c) >= 'A') && ((c) <= 'Z'))) #ifdef __cplusplus extern "C" { #endif - - - - - - int sprintf(char *buf, const char *fmt, ...); #ifdef __cplusplus } #endif -#endif /* END _STRING_H */ +#endif /* !_STRING_H_ */ diff --git a/sys/include/vmm/paging.h b/sys/include/vmm/paging.h deleted file mode 100644 index 6186705..0000000 --- a/sys/include/vmm/paging.h +++ /dev/null @@ -1,104 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _VMM_PAGING_H_ -#define _VMM_PAGING_H_ - -#include -#include -#include - -#define PAGE_SHIFT 12 // Page Shift -#define PAGE_SIZE 0x1000 // Page Size -#define PAGE_MASK (PAGE_SIZE-1) // Page Mask - -#define PD_INDEX(v_addr) (v_addr >> 22) // Calc Page Directory Index -#define PD_OFFSET(v_addr) (v_addr >> 0xA) // Calc Page Directory OFfset -#define PT_INDEX(v_addr) ((v_addr >> 12) & 0x03FF) // Calc Page Table Offset -#define PD_BASE_ADDR2 ((PAGE_SIZE << 0xA) + VMM_KERN_START) // Find Out What This Was For - -#define PD_BASE_ADDR 0xC0400000 // Page Directory Addressable Base Address -#define PT_BASE_ADDR 0xC0000000 // Page Table Addressable Base Address - -#define PD_ENTRIES (PAGE_SIZE/4) //Return Page Directory Entries -#define PT_ENTRIES (PAGE_SIZE/4) //Return Page Table Entries - -#define VM_THRD 0 // Thread -#define VM_TASK 1 // Task - -// Page Flags -#define PAGE_PRESENT 0x00000001 -#define PAGE_WRITE 0x00000002 -#define PAGE_USER 0x00000004 -#define PAGE_WRITE_THROUGH 0x00000008 -#define PAGE_CACHE_DISABLED 0x00000010 -#define PAGE_ACCESSED 0x00000020 -#define PAGE_DIRTY 0x00000040 -#define PAGE_GLOBAL 0x00000080 -#define PAGE_ 0x00000100 -#define PAGE_COW 0x00000200 -#define PAGE_STACK 0x00000400 -#define PAGE_WIRED 0x00000800 - -#define PAGE_DEFAULT (PAGE_PRESENT|PAGE_WRITE|PAGE_USER) -#define KERNEL_PAGE_DEFAULT (PAGE_PRESENT|PAGE_WRITE) - -#define trunc_page(x) ((x) & ~PAGE_MASK) -#define round_page(x) (((x) + PAGE_MASK) & ~PAGE_MASK) - -#define ctob(x) ((x)<>PAGE_SHIFT) - -int vmmClearVirtualPage(uint32_t pageAddr); - -void *vmm_mapFromTask(pidType, void *, uint32_t); -void *vmm_copyVirtualSpace(pidType); -void *vmm_getFreePage(pidType); -void *vmm_getFreeKernelPage(pidType pid, uint16_t count); -void *vmm_createVirtualSpace(pidType); -void *vmm_getFreeVirtualPage(pidType, int, int); - -uint32_t vmm_getPhysicalAddr(uint32_t); -uint32_t vmm_getRealAddr(uint32_t); -int vmm_setPageAttributes(uint32_t, uint16_t); -int vmm_remapPage(uint32_t, uint32_t, uint16_t, pidType, int haveLock); -int vmm_pagingInit(); -void *vmm_getFreeMallocPage(uint16_t count); -//void vmm_pageFault( uint32_t, uint32_t, uint32_t ); -void vmm_pageFault(struct trapframe *, uint32_t); -void _vmm_pageFault(); -int mmap(struct thread *, struct sys_mmap_args *); -int obreak(struct thread *, struct obreak_args *); -int munmap(struct thread *, struct sys_munmap_args *); - -int vmm_cleanVirtualSpace(uint32_t); -void *vmm_getFreeVirtualPage(pidType pid, int count, int type); - -extern uint32_t *kernelPageDirectory; - -#endif diff --git a/sys/include/vmm/vmm.h b/sys/include/vmm/vmm.h deleted file mode 100644 index bb769b1..0000000 --- a/sys/include/vmm/vmm.h +++ /dev/null @@ -1,133 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _VMM_VMM_H -#define _VMM_VMM_H - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define STACK_ADDR 0xBFFFFFFF//0xC800000 // Default App Stack Address - -#define memAvail 1 -#define memNotavail 2 -#define vmmID -3 - - /* - #define vmmMemoryMapAddr 0xE6667000 - #define VMM_MMAP_ADDR_PMODE2 0xE6667000 - */ - -#define VMM_MMAP_ADDR_PMODE VMM_KERN_START /* (PD_BASE_ADDR + PAGE_SIZE) */ -#define VMM_MMAP_ADDR_RMODE 0x101000 - -#define VMM_KERN_CODE_START 0x00000000 -#define VMM_KERN_CODE_END 0x007FEFFF - -#define VMM_USER_LDT 0x007FF000 - -#define VMM_USER_START 0x00800000 -#define VMM_USER_END 0xBFFFFFFF - -#define VMM_PAGE_DIRS 0xC0000000 -#define VMM_PAGE_DIR 0xC0400000 - -#define VMM_KERN_START 0xC0800000 //TMP ADDED 1000 -#define VMM_KERN_END 0xFDFFFFFF - -#define VMM_KERN_STACK_START 0xFE000000 -#define VMM_KERN_STACK_END 0xFFFFFFFF - - extern struct spinLock pdSpinLock; - - - struct freebsd6_mmap_args { - char addr_l_[PADL_(caddr_t)]; - caddr_t addr; - char addr_r_[PADR_(caddr_t)]; - - char len_l_[PADL_(size_t)]; - size_t len; - char len_r_[PADR_(size_t)]; - - char prot_l_[PADL_(int)]; - int prot; - char prot_r_[PADR_(int)]; - char flags_l_[PADL_(int)]; - - int flags; - char flags_r_[PADR_(int)]; - char fd_l_[PADL_(int)]; - int fd; - char fd_r_[PADR_(int)]; - - char pad_l_[PADL_(int)]; - int pad; - char pad_r_[PADR_(int)]; - - char pos_l_[PADL_(off_t)]; - off_t pos; - char pos_r_[PADR_(off_t)]; - }; - - typedef struct { - uint32_t pageAddr; - u_int16_t status; - u_int16_t reserved; - pid_t pid; - int cowCounter; - } mMap; - - typedef enum { - VMM_FREE = 0, VMM_KEEP = 1 - } unmapFlags_t; - - extern int numPages; - extern mMap *vmmMemoryMap; - - int vmm_init(); - int vmm_memMapInit(); - int countMemory(); - uint32_t vmm_findFreePage(pidType pid); - int freePage(uint32_t pageAddr); - int adjustCowCounter(uint32_t baseAddr, int adjustment); - void vmm_freeProcessPages(pidType pid); - - int vmm_allocPageTable(uint32_t, pidType); - void vmm_unmapPage(uint32_t, unmapFlags_t); - void vmm_unmapPages(void *, uint32_t, unmapFlags_t); - -#ifdef __cplusplus -} -#endif - -#endif // _VMM_VMM_H diff --git a/sys/init/main.c b/sys/init/main.c index 8b4ebbe..939622e 100644 --- a/sys/init/main.c +++ b/sys/init/main.c @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include #include @@ -109,8 +109,8 @@ union descriptorTableUnion *gdt __attribute__ ((packed)); } loadGDT = { (11 * sizeof(union descriptorTableUnion) - 1), ubixGDT }; -static char *argv_init[2] = { "init", NULL, }; // ARGV For Initial Proccess -static char *envp_init[6] = { "HOME=/", "PWD=/", "PATH=/bin:/sbin:/usr/bin:/usr/sbin", "USER=root", "GROUP=admin", NULL, }; //ENVP For Initial Proccess +static char *argv_init[2] = { "init", NULL, }; /* ARGV For Initial Proccess */ +static char *envp_init[6] = { "HOME=/", "PWD=/", "PATH=/bin:/sbin:/usr/bin:/usr/sbin", "USER=root", "GROUP=admin", NULL, }; /* ENVP For Initial Proccess */ struct bootinfo _bootinfo; char _kernelname[512]; diff --git a/sys/isa/fdc.c b/sys/isa/fdc.c index 8e53ed1..3513d9d 100644 --- a/sys/isa/fdc.c +++ b/sys/isa/fdc.c @@ -37,7 +37,7 @@ #include #include #include -#include +#include static struct spinLock fdcSpinLock = SPIN_LOCK_INITIALIZER; diff --git a/sys/kernel/ld.c b/sys/kernel/ld.c index 725b6ad..571ef0a 100644 --- a/sys/kernel/ld.c +++ b/sys/kernel/ld.c @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/sys/kernel/vfs_calls.c b/sys/kernel/vfs_calls.c index dd465ec..c9a14d1 100644 --- a/sys/kernel/vfs_calls.c +++ b/sys/kernel/vfs_calls.c @@ -32,7 +32,7 @@ #include #include #include -#include +#include int sys_open(struct thread *td, struct sys_open_args *args) { int error = 0x0; diff --git a/sys/lib/kprintf.c b/sys/lib/kprintf.c index 66d096a..c3982a4 100644 --- a/sys/lib/kprintf.c +++ b/sys/lib/kprintf.c @@ -30,6 +30,7 @@ #include #include #include +#include static char *ksprintn(char *nbuf, uintmax_t num, int base, int *lenp, int upper); @@ -222,7 +223,8 @@ u[j] = LHALF(u[j] + t); } q[j] = qhat; - } while (++j <= m); /* D7: loop on j. */ + } + while (++j <= m); /* D7: loop on j. */ /* * If caller wants the remainder, we have to calculate it as @@ -264,6 +266,7 @@ va_start(ap, fmt); retval = kvprintf(fmt, NULL, &buf, 10, ap); + buf[retval] = '\0'; va_end(ap); @@ -276,13 +279,18 @@ } int sprintf(char *buf, const char *fmt, ...) { + va_list args; int i; + va_start(args, fmt); -//i = vsprintf( buf, fmt, args ); + + /* i = vsprintf( buf, fmt, args ); */ i = kvprintf(fmt, NULL, buf, 10, args); + va_end(args); return (i); + } /* @@ -313,7 +321,9 @@ */ int kvprintf(const char *fmt, void (*func)(int, void*), void *arg, int radix, va_list ap) { + #define PCHAR(c) {int cc=(c); if (func) (*func)(cc,arg); else *d++ = cc; retval++; } + char nbuf[MAXNBUF]; char *d; const char *p, *percent, *q; @@ -339,13 +349,16 @@ radix = 10; for (;;) { + padc = ' '; width = 0; + while ((ch = (u_char) *fmt++) != '%' || stop) { if (ch == '\0') return (retval); PCHAR(ch); } + percent = fmt - 1; qflag = 0; lflag = 0; @@ -361,302 +374,307 @@ jflag = 0; tflag = 0; zflag = 0; + reswitch: switch (ch = (u_char) *fmt++) { - case '.': - dot = 1; - goto reswitch; - case '#': - sharpflag = 1; - goto reswitch; - case '+': - sign = 1; - goto reswitch; - case '-': - ladjust = 1; - goto reswitch; - case '%': - PCHAR(ch) - ; + case '.': + dot = 1; + goto reswitch; + case '#': + sharpflag = 1; + goto reswitch; + case '+': + sign = 1; + goto reswitch; + case '-': + ladjust = 1; + goto reswitch; + case '%': + PCHAR(ch) + ; break; - case '*': - if (!dot) { - width = va_arg(ap, int); - if (width < 0) { - ladjust = !ladjust; - width = -width; - } + case '*': + if (!dot) { + width = va_arg(ap, int); + if (width < 0) { + ladjust = !ladjust; + width = -width; } - else { - dwidth = va_arg(ap, int); - } + } + else { + dwidth = va_arg(ap, int); + } + goto reswitch; + case '0': + if (!dot) { + padc = '0'; goto reswitch; - case '0': - if (!dot) { - padc = '0'; - goto reswitch; - } - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - for (n = 0;; ++fmt) { - n = n * 10 + ch - '0'; - ch = *fmt; - if (ch < '0' || ch > '9') - break; - } - if (dot) - dwidth = n; - else - width = n; - goto reswitch; - case 'b': - num = (u_int) va_arg(ap, int); - p = va_arg(ap, char *); - for (q = ksprintn(nbuf, num, *p++, NULL, 0); *q;) - PCHAR(*q--) - ; - - if (num == 0) + } + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + for (n = 0;; ++fmt) { + n = n * 10 + ch - '0'; + ch = *fmt; + if (ch < '0' || ch > '9') break; + } + if (dot) + dwidth = n; + else + width = n; + goto reswitch; + case 'b': + num = (u_int) va_arg(ap, int); + p = va_arg(ap, char *); + for (q = ksprintn(nbuf, num, *p++, NULL, 0); *q;) + PCHAR(*q--) + ; - for (tmp = 0; *p;) { - n = *p++; - if (num & (1 << (n - 1))) { - PCHAR(tmp ? ',' : '<'); - for (; (n = *p) > ' '; ++p) - PCHAR(n); - tmp = 1; - } - else - for (; *p > ' '; ++p) - continue; - } - if (tmp) - PCHAR('>') - ; - break; - case 'c': - PCHAR(va_arg(ap, int)) - ; - break; - case 'D': - up = va_arg(ap, u_char *); - p = va_arg(ap, char *); - if (!width) - width = 16; - while (width--) { - PCHAR(hex2ascii( *up >> 4 )); - PCHAR(hex2ascii( *up & 0x0f )); - up++; - if (width) - for (q = p; *q; q++) - PCHAR(*q); - } - break; - case 'd': - case 'i': - base = 10; - sign = 1; - goto handle_sign; - case 'h': - if (hflag) { - hflag = 0; - cflag = 1; + if (num == 0) + break; + + for (tmp = 0; *p;) { + n = *p++; + if (num & (1 << (n - 1))) { + PCHAR(tmp ? ',' : '<'); + for (; (n = *p) > ' '; ++p) + PCHAR(n); + tmp = 1; } else - hflag = 1; - goto reswitch; - case 'j': - jflag = 1; - goto reswitch; - case 'l': - if (lflag) { - lflag = 0; - qflag = 1; - } - else - lflag = 1; - goto reswitch; - case 'n': - if (jflag) - *(va_arg(ap, intmax_t *)) = retval; - else if (qflag) - *(va_arg(ap, quad_t *)) = retval; - else if (lflag) - *(va_arg(ap, long *)) = retval; - else if (zflag) - *(va_arg(ap, size_t *)) = retval; - else if (hflag) - *(va_arg(ap, short *)) = retval; - else if (cflag) - *(va_arg(ap, char *)) = retval; - else - *(va_arg(ap, int *)) = retval; - break; - case 'o': - base = 8; - goto handle_nosign; - case 'p': - base = 16; - sharpflag = (width == 0); - sign = 0; - num = (uintptr_t) va_arg(ap, void *); - goto number; - case 'q': - qflag = 1; - goto reswitch; - case 'r': - base = radix; - if (sign) - goto handle_sign; - goto handle_nosign; - case 's': - p = va_arg(ap, char *); - if (p == NULL) - p = "(null)"; - if (!dot) - n = strlen(p); - else - for (n = 0; n < dwidth && p[n]; n++) + for (; *p > ' '; ++p) continue; - - width -= n; - - if (!ladjust && width > 0) - while (width--) - PCHAR(padc) - ; - while (n--) - PCHAR(*p++) - ; - if (ladjust && width > 0) - while (width--) - PCHAR(padc) - ; + } + if (tmp) + PCHAR('>') + ; break; - case 't': - tflag = 1; - goto reswitch; - case 'u': - base = 10; - goto handle_nosign; - case 'X': - upper = 1; - case 'x': - base = 16; - goto handle_nosign; - case 'y': - base = 16; - sign = 1; + case 'c': + PCHAR(va_arg(ap, int)) + ; + break; + case 'D': + up = va_arg(ap, u_char *); + p = va_arg(ap, char *); + if (!width) + width = 16; + while (width--) { + asm("nop"); + PCHAR(hex2ascii( *up >> 4 )); + asm("nop"); + PCHAR(hex2ascii( *up & 0x0f )); + asm("nop"); + up++; + if (width) + for (q = p; *q; q++) + PCHAR(*q); + } + break; + case 'd': + case 'i': + base = 10; + sign = 1; + goto handle_sign; + case 'h': + if (hflag) { + hflag = 0; + cflag = 1; + } + else + hflag = 1; + goto reswitch; + case 'j': + jflag = 1; + goto reswitch; + case 'l': + if (lflag) { + lflag = 0; + qflag = 1; + } + else + lflag = 1; + goto reswitch; + case 'n': + if (jflag) + *(va_arg(ap, intmax_t *)) = retval; + else if (qflag) + *(va_arg(ap, quad_t *)) = retval; + else if (lflag) + *(va_arg(ap, long *)) = retval; + else if (zflag) + *(va_arg(ap, size_t *)) = retval; + else if (hflag) + *(va_arg(ap, short *)) = retval; + else if (cflag) + *(va_arg(ap, char *)) = retval; + else + *(va_arg(ap, int *)) = retval; + break; + case 'o': + base = 8; + goto handle_nosign; + case 'p': + base = 16; + sharpflag = (width == 0); + sign = 0; + num = (uintptr_t) va_arg(ap, void *); + goto number; + case 'q': + qflag = 1; + goto reswitch; + case 'r': + base = radix; + if (sign) goto handle_sign; - case 'z': - zflag = 1; - goto reswitch; - handle_nosign: sign = 0; - if (jflag) - num = va_arg(ap, uintmax_t); - else if (qflag) - num = va_arg(ap, u_quad_t); - else if (tflag) - num = va_arg(ap, ptrdiff_t); - else if (lflag) - num = va_arg(ap, u_long); - else if (zflag) - num = va_arg(ap, size_t); - else if (hflag) - num = (u_short) va_arg(ap, int); - else if (cflag) - num = (u_char) va_arg(ap, int); - else - num = va_arg(ap, u_int); - goto number; - handle_sign: if (jflag) - num = va_arg(ap, intmax_t); - else if (qflag) - num = va_arg(ap, quad_t); - else if (tflag) - num = va_arg(ap, ptrdiff_t); - else if (lflag) - num = va_arg(ap, long); - else if (zflag) - num = va_arg(ap, ssize_t); - else if (hflag) - num = (short) va_arg(ap, int); - else if (cflag) - num = (char) va_arg(ap, int); - else - num = va_arg(ap, int); - number: if (sign && (intmax_t) num < 0) { - neg = 1; - num = -(intmax_t) num; - } - p = ksprintn(nbuf, num, base, &n, upper); - tmp = 0; - if (sharpflag && num != 0) { - if (base == 8) - tmp++; - else if (base == 16) - tmp += 2; - } - if (neg) + goto handle_nosign; + case 's': + p = va_arg(ap, char *); + if (p == NULL) + p = "(null)"; + if (!dot) + n = strlen(p); + else + for (n = 0; n < dwidth && p[n]; n++) + continue; + + width -= n; + + if (!ladjust && width > 0) + while (width--) + PCHAR(padc) + ; + while (n--) + PCHAR(*p++) + ; + if (ladjust && width > 0) + while (width--) + PCHAR(padc) + ; + break; + case 't': + tflag = 1; + goto reswitch; + case 'u': + base = 10; + goto handle_nosign; + case 'X': + upper = 1; + case 'x': + base = 16; + goto handle_nosign; + case 'y': + base = 16; + sign = 1; + goto handle_sign; + case 'z': + zflag = 1; + goto reswitch; + handle_nosign: sign = 0; + if (jflag) + num = va_arg(ap, uintmax_t); + else if (qflag) + num = va_arg(ap, u_quad_t); + else if (tflag) + num = va_arg(ap, __ptrdiff_t); + else if (lflag) + num = va_arg(ap, u_long); + else if (zflag) + num = va_arg(ap, size_t); + else if (hflag) + num = (u_short) va_arg(ap, int); + else if (cflag) + num = (u_char) va_arg(ap, int); + else + num = va_arg(ap, u_int); + goto number; + handle_sign: if (jflag) + num = va_arg(ap, intmax_t); + else if (qflag) + num = va_arg(ap, quad_t); + else if (tflag) + num = va_arg(ap, __ptrdiff_t); + else if (lflag) + num = va_arg(ap, long); + else if (zflag) + num = va_arg(ap, ssize_t); + else if (hflag) + num = (short) va_arg(ap, int); + else if (cflag) + num = (char) va_arg(ap, int); + else + num = va_arg(ap, int); + number: if (sign && (intmax_t) num < 0) { + neg = 1; + num = -(intmax_t) num; + } + p = ksprintn(nbuf, num, base, &n, upper); + tmp = 0; + if (sharpflag && num != 0) { + if (base == 8) tmp++; + else if (base == 16) + tmp += 2; + } + if (neg) + tmp++; - if (!ladjust && padc == '0') - dwidth = width - tmp; - width -= tmp + imax(dwidth, n); - dwidth -= n; - if (!ladjust) - while (width-- > 0) - PCHAR(' ') - ; - if (neg) - PCHAR('-') - ; - if (sharpflag && num != 0) { - if (base == 8) { - PCHAR('0'); - } - else if (base == 16) { - PCHAR('0'); - PCHAR('x'); - } + if (!ladjust && padc == '0') + dwidth = width - tmp; + width -= tmp + imax(dwidth, n); + dwidth -= n; + if (!ladjust) + while (width-- > 0) + PCHAR(' ') + ; + if (neg) + PCHAR('-') + ; + if (sharpflag && num != 0) { + if (base == 8) { + PCHAR('0'); } - while (dwidth-- > 0) - PCHAR('0') - ; + else if (base == 16) { + PCHAR('0'); + PCHAR('x'); + } + } + while (dwidth-- > 0) + PCHAR('0') + ; - while (*p) - PCHAR(*p--) - ; + while (*p) + PCHAR(*p--) + ; - if (ladjust) - while (width-- > 0) - PCHAR(' ') - ; + if (ladjust) + while (width-- > 0) + PCHAR(' ') + ; break; - default: - while (percent < fmt) - PCHAR(*percent++) - ; - /* - * Since we ignore a formatting argument it is no - * longer safe to obey the remaining formatting - * arguments as the arguments will no longer match - * the format specs. - */ - stop = 1; + default: + while (percent < fmt) + PCHAR(*percent++) + ; + /* + * Since we ignore a formatting argument it is no + * longer safe to obey the remaining formatting + * arguments as the arguments will no longer match + * the format specs. + */ + stop = 1; break; } } #undef PCHAR return (0); + } static char *ksprintn(char *nbuf, uintmax_t num, int base, int *lenp, int upper) { @@ -668,7 +686,8 @@ do { c = hex2ascii(num % base); *++p = upper ? toupper(c) : c; - } while (num /= base); + } + while (num /= base); if (lenp) *lenp = p - nbuf; diff --git a/sys/lib/string.c b/sys/lib/string.c index 19fcbd1..4864390 100644 --- a/sys/lib/string.c +++ b/sys/lib/string.c @@ -26,11 +26,266 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include +#include -u_char const bcd2bin_data[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 0, 0, 0, 0, 0, 0, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 0, 0, 0, 0, 0, 0, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 0, 0, 0, 0, 0, 0, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 0, 0, 0, 0, 0, 0, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 0, 0, 0, 0, 0, 0, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 0, 0, 0, 0, 0, 0, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 0, 0, 0, 0, 0, 0, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 0, 0, 0, 0, 0, 0, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 }; +const char hex2ascii_data[] = "0123456789abcdefghijklmnopqrstuvwxyz"; -u_char const bin2bcd_data[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99 }; +const u_char bcd2bin_data[] = { + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 0, + 0, + 0, + 0, + 0, + 0, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 0, + 0, + 0, + 0, + 0, + 0, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 0, + 0, + 0, + 0, + 0, + 0, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 0, + 0, + 0, + 0, + 0, + 0, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 0, + 0, + 0, + 0, + 0, + 0, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 0, + 0, + 0, + 0, + 0, + 0, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 0, + 0, + 0, + 0, + 0, + 0, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77, + 78, + 79, + 0, + 0, + 0, + 0, + 0, + 0, + 80, + 81, + 82, + 83, + 84, + 85, + 86, + 87, + 88, + 89, + 0, + 0, + 0, + 0, + 0, + 0, + 90, + 91, + 92, + 93, + 94, + 95, + 96, + 97, + 98, + 99 }; -/* This is actually used with radix [2..36] */ -char const hex2ascii_data[] = "0123456789abcdefghijklmnopqrstuvwxyz"; +const u_char bin2bcd_data[] = { + 0x00, + 0x01, + 0x02, + 0x03, + 0x04, + 0x05, + 0x06, + 0x07, + 0x08, + 0x09, + 0x10, + 0x11, + 0x12, + 0x13, + 0x14, + 0x15, + 0x16, + 0x17, + 0x18, + 0x19, + 0x20, + 0x21, + 0x22, + 0x23, + 0x24, + 0x25, + 0x26, + 0x27, + 0x28, + 0x29, + 0x30, + 0x31, + 0x32, + 0x33, + 0x34, + 0x35, + 0x36, + 0x37, + 0x38, + 0x39, + 0x40, + 0x41, + 0x42, + 0x43, + 0x44, + 0x45, + 0x46, + 0x47, + 0x48, + 0x49, + 0x50, + 0x51, + 0x52, + 0x53, + 0x54, + 0x55, + 0x56, + 0x57, + 0x58, + 0x59, + 0x60, + 0x61, + 0x62, + 0x63, + 0x64, + 0x65, + 0x66, + 0x67, + 0x68, + 0x69, + 0x70, + 0x71, + 0x72, + 0x73, + 0x74, + 0x75, + 0x76, + 0x77, + 0x78, + 0x79, + 0x80, + 0x81, + 0x82, + 0x83, + 0x84, + 0x85, + 0x86, + 0x87, + 0x88, + 0x89, + 0x90, + 0x91, + 0x92, + 0x93, + 0x94, + 0x95, + 0x96, + 0x97, + 0x98, + 0x99 }; + diff --git a/sys/net/api/Makefile b/sys/net/api/Makefile index 20ec808..8ce3ea4 100644 --- a/sys/net/api/Makefile +++ b/sys/net/api/Makefile @@ -13,13 +13,13 @@ # Compile Types .cc.o: - $(CXX) ${CFLAGS} -DNOBOOL -I../../include -c -o $@ $< + $(CXX) ${CFLAGS} -DNOBOOL -I../../../include -c -o $@ $< .cc.s: - $(CXX) ${CFLAGS} -DNOBOOL -I../../include -S -o $@ $< + $(CXX) ${CFLAGS} -DNOBOOL -I../../../include -S -o $@ $< .c.o: - $(CC) ${CFLAGS} -I../../include -c -o $@ $< + $(CC) ${CFLAGS} -I../../../include -c -o $@ $< .c.s: - $(CC) ${CFLAGS}-I../../include -S -o $@ $< + $(CC) ${CFLAGS}-I../../../include -S -o $@ $< .S.o: $(CC) ${CFLAGS}-c -o $@ $< diff --git a/sys/net/core/Makefile b/sys/net/core/Makefile index 103838a..08481c0 100644 --- a/sys/net/core/Makefile +++ b/sys/net/core/Makefile @@ -12,13 +12,13 @@ # Compile Types .cc.o: - $(CXX) ${CFLAGS} -DNOBOOL -I../../include -c -o $@ $< + $(CXX) ${CFLAGS} -DNOBOOL -I../../../include -c -o $@ $< .cc.s: - $(CXX) ${CFLAGS} -DNOBOOL -I../../include -S -o $@ $< + $(CXX) ${CFLAGS} -DNOBOOL -I../../../include -S -o $@ $< .c.o: - $(CC) ${CFLAGS} -I../../include -c -o $@ $< + $(CC) ${CFLAGS} -I../../../include -c -o $@ $< .c.s: - $(CC) ${CFLAGS} -I../../include -S -o $@ $< + $(CC) ${CFLAGS} -I../../../include -S -o $@ $< .S.o: $(CC) ${CFLAGS} -c -o $@ $< diff --git a/sys/net/core/def.c b/sys/net/core/def.c index bfa98af..d1dbb9e 100644 --- a/sys/net/core/def.c +++ b/sys/net/core/def.c @@ -61,6 +61,8 @@ #include "net/opt.h" #include "net/def.h" +#include +#include #include #if BYTE_ORDER == LITTLE_ENDIAN diff --git a/sys/net/core/init.c b/sys/net/core/init.c index 20c7be8..a2271c7 100644 --- a/sys/net/core/init.c +++ b/sys/net/core/init.c @@ -31,6 +31,7 @@ #include "net/opt.h" +#include #include #include "net/init.h" diff --git a/sys/net/core/ipv4/Makefile b/sys/net/core/ipv4/Makefile index 008e01a..bcbea86 100644 --- a/sys/net/core/ipv4/Makefile +++ b/sys/net/core/ipv4/Makefile @@ -12,13 +12,13 @@ # Compile Types .cc.o: - $(CXX) ${CFLAGS} -DNOBOOL -I../../../include -c -o $@ $< + $(CXX) ${CFLAGS} -DNOBOOL -I../../../../include -c -o $@ $< .cc.s: - $(CXX) ${CFLAGS} -DNOBOOL -I../../../include -S -o $@ $< + $(CXX) ${CFLAGS} -DNOBOOL -I../../../../include -S -o $@ $< .c.o: - $(CC) ${CFLAGS} -I../../../include -c -o $@ $< + $(CC) ${CFLAGS} -I../../../../include -c -o $@ $< .c.s: - $(CC) ${CFLAGS} -I../../../include -S -o $@ $< + $(CC) ${CFLAGS} -I../../../../include -S -o $@ $< .S.o: $(CC) ${CFLAGS} -c -o $@ $< diff --git a/sys/net/core/ipv6/Makefile b/sys/net/core/ipv6/Makefile index 71d058c..f0ca889 100644 --- a/sys/net/core/ipv6/Makefile +++ b/sys/net/core/ipv6/Makefile @@ -12,13 +12,13 @@ # Compile Types .cc.o: - $(CXX) ${CFLAGS} -DNOBOOL -I../../../include -c -o $@ $< + $(CXX) ${CFLAGS} -DNOBOOL -I../../../../include -c -o $@ $< .cc.s: - $(CXX) ${CFLAGS} -DNOBOOL -I../../../include -S -o $@ $< + $(CXX) ${CFLAGS} -DNOBOOL -I../../../../include -S -o $@ $< .c.o: - $(CC) ${CFLAGS} -I../../../include -c -o $@ $< + $(CC) ${CFLAGS} -I../../../../include -c -o $@ $< .c.s: - $(CC) ${CFLAGS} -I../../../include -S -o $@ $< + $(CC) ${CFLAGS} -I../../../../include -S -o $@ $< .S.o: $(CC) ${CFLAGS} -c -o $@ $< diff --git a/sys/net/net/Makefile b/sys/net/net/Makefile index a3489aa..f858454 100644 --- a/sys/net/net/Makefile +++ b/sys/net/net/Makefile @@ -13,13 +13,13 @@ # Compile Types .cc.o: - $(CXX) ${CFLAGS} -DNOBOOL -I../../include -c -o $@ $< + $(CXX) ${CFLAGS} -DNOBOOL -I../../../include -c -o $@ $< .cc.s: - $(CXX) ${CFLAGS} -DNOBOOL-I../../include -S -o $@ $< + $(CXX) ${CFLAGS} -DNOBOOL-I../../../include -S -o $@ $< .c.o: - $(CC) ${CFLAGS} -I../../include -c -o $@ $< + $(CC) ${CFLAGS} -I../../../include -c -o $@ $< .c.s: - $(CC) ${CFLAGS} -I../../include -S -o $@ $< + $(CC) ${CFLAGS} -I../../../include -S -o $@ $< .S.o: $(CC) ${CFLAGS} -c -o $@ $< diff --git a/sys/net/netif/Makefile b/sys/net/netif/Makefile index d90ab2f..e9a5b4e 100644 --- a/sys/net/netif/Makefile +++ b/sys/net/netif/Makefile @@ -13,13 +13,13 @@ # Compile Types .cc.o: - $(CXX) ${CFLAGS} -DNOBOOL -I../../include -c -o $@ $< + $(CXX) ${CFLAGS} -DNOBOOL -I../../../include -c -o $@ $< .cc.s: - $(CXX) ${CFLAGS} -DNOBOOL -I../../include -S -o $@ $< + $(CXX) ${CFLAGS} -DNOBOOL -I../../../include -S -o $@ $< .c.o: - $(CC) ${CFLAGS} -I../../include -c -o $@ $< + $(CC) ${CFLAGS} -I../../../include -c -o $@ $< .c.s: - $(CC) ${CFLAGS} -I../../include -S -o $@ $< + $(CC) ${CFLAGS} -I../../../include -S -o $@ $< .S.o: $(CC) ${CFLAGS} -c -o $@ $< diff --git a/sys/pci/hd.c b/sys/pci/hd.c index be6db78..a37c2ba 100644 --- a/sys/pci/hd.c +++ b/sys/pci/hd.c @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include diff --git a/sys/vmm/copyvirtualspace.c b/sys/vmm/copyvirtualspace.c index dba354b..78936c1 100644 --- a/sys/vmm/copyvirtualspace.c +++ b/sys/vmm/copyvirtualspace.c @@ -31,7 +31,6 @@ #include #include #include -#include static struct spinLock cvsSpinLock = SPIN_LOCK_INITIALIZER; @@ -50,227 +49,259 @@ ************************************************************************/ void *vmm_copyVirtualSpace(pidType pid) { - void *newPageDirectoryAddress = 0x0; + void *newPageDirectoryAddress = 0x0; - uint32_t *parentPageDirectory = 0x0, *newPageDirectory = 0x0; - uint32_t *parentPageTable = 0x0, *newPageTable = 0x0; - uint32_t *parentStackPage = 0x0, *newStackPage = 0x0; - uint16_t x = 0, i = 0, s = 0; + uint32_t *parentPageDirectory = 0x0, *newPageDirectory = 0x0; + uint32_t *parentPageTable = 0x0, *newPageTable = 0x0; + uint32_t *parentStackPage = 0x0, *newStackPage = 0x0; + uint16_t x = 0, i = 0, s = 0; - spinLock(&cvsSpinLock); + spinLock(&cvsSpinLock); - /* Set Address Of Parent Page Directory */ - parentPageDirectory = (uint32_t *) PD_BASE_ADDR; + /* Set Address Of Parent Page Directory */ + parentPageDirectory = (uint32_t *) PD_BASE_ADDR; - /* Allocate A New Page For The New Page Directory */ - if ((newPageDirectory = (uint32_t *) vmm_getFreeKernelPage(pid, 1)) == 0x0) - kpanic("Error: newPageDirectory == NULL, File: %s, Line: %i\n", __FILE__, __LINE__); + /* Allocate A New Page For The New Page Directory */ + if ((newPageDirectory = (uint32_t *) vmm_getFreeKernelPage(pid, 1)) == 0x0) + kpanic("Error: newPageDirectory == NULL, File: %s, Line: %i\n", + __FILE__, __LINE__); - /* Set newPageDirectoryAddress To The Newly Created Page Directories Page */ - newPageDirectoryAddress = (void *) vmm_getPhysicalAddr((uint32_t) newPageDirectory); + /* Set newPageDirectoryAddress To The Newly Created Page Directories Page */ + newPageDirectoryAddress = (void *) vmm_getPhysicalAddr( + (uint32_t) newPageDirectory); - /* First Set Up A Flushed Page Directory */ - bzero(newPageDirectory, PAGE_SIZE); + /* First Set Up A Flushed Page Directory */ + bzero(newPageDirectory, PAGE_SIZE); - /* Map Kernel Code Region Entries 0 & 1 */ - newPageDirectory[0] = parentPageDirectory[0]; - //XXX: We Dont Need This - newPageDirectory[1] = parentPageDirectory[1]; + /* Map Kernel Code Region Entries 0 & 1 */ + newPageDirectory[0] = parentPageDirectory[0]; + //XXX: We Dont Need This - newPageDirectory[1] = parentPageDirectory[1]; - if ((newPageTable = (uint32_t *) vmm_getFreeKernelPage(pid, 1)) == 0x0) - kpanic("Error: newPageTable == NULL, File: %s, Line: %i\n", __FILE__, __LINE__); + if ((newPageTable = (uint32_t *) vmm_getFreeKernelPage(pid, 1)) == 0x0) + kpanic("Error: newPageTable == NULL, File: %s, Line: %i\n", __FILE__, + __LINE__); - parentPageTable = (uint32_t *) (PT_BASE_ADDR + (PAGE_SIZE * 1)); + parentPageTable = (uint32_t *) (PT_BASE_ADDR + (PAGE_SIZE * 1)); - for (x = 0; x < PT_ENTRIES; x++) { - if (((parentPageTable[x]) & PAGE_PRESENT) == PAGE_PRESENT) { + for (x = 0; x < PT_ENTRIES; x++) { + if (((parentPageTable[x]) & PAGE_PRESENT) == PAGE_PRESENT) { - /* Set Page To COW In Parent And Child Space */ - newPageTable[x] = (((uint32_t) parentPageTable[x] & 0xFFFFF000) | (KERNEL_PAGE_DEFAULT | PAGE_COW)); + /* Set Page To COW In Parent And Child Space */ + newPageTable[x] = (((uint32_t) parentPageTable[x] & 0xFFFFF000) + | (KERNEL_PAGE_DEFAULT | PAGE_COW)); - /* Increment The COW Counter For This Page */ - if (((uint32_t) parentPageTable[x] & PAGE_COW) == PAGE_COW) { - adjustCowCounter(((uint32_t) parentPageTable[x] & 0xFFFFF000), 1); - } - else { - /* Add Two If This Is The First Time Setting To COW */ - adjustCowCounter(((uint32_t) parentPageTable[x] & 0xFFFFF000), 2); - parentPageTable[x] |= PAGE_COW; // newPageTable[i]; - } + /* Increment The COW Counter For This Page */ + if (((uint32_t) parentPageTable[x] & PAGE_COW) == PAGE_COW) { + adjustCowCounter(((uint32_t) parentPageTable[x] & 0xFFFFF000), + 1); + } else { + /* Add Two If This Is The First Time Setting To COW */ + adjustCowCounter(((uint32_t) parentPageTable[x] & 0xFFFFF000), + 2); + parentPageTable[x] |= PAGE_COW; // newPageTable[i]; + } - } - else - newPageTable[x] = parentPageTable[x]; - } + } else + newPageTable[x] = parentPageTable[x]; + } - newPageDirectory[1] = (vmm_getPhysicalAddr((uint32_t) newPageTable) | KERNEL_PAGE_DEFAULT); + newPageDirectory[1] = (vmm_getPhysicalAddr((uint32_t) newPageTable) + | KERNEL_PAGE_DEFAULT); - vmm_unmapPage((uint32_t) newPageTable, 1); + vmm_unmapPage((uint32_t) newPageTable, 1); - newPageTable = 0x0; + newPageTable = 0x0; - /* Map The Kernel Memory Region Entry 770 Address 0xC0800000 */ - for (x = PD_INDEX(VMM_KERN_START); x <= PD_INDEX(VMM_KERN_END); x++) - newPageDirectory[x] = parentPageDirectory[x]; + /* Map The Kernel Memory Region Entry 770 Address 0xC0800000 */ + for (x = PD_INDEX(VMM_KERN_START); x <= PD_INDEX(VMM_KERN_END); x++) + newPageDirectory[x] = parentPageDirectory[x]; - /* Map The Kernel Stack Region */ - for (x = PD_INDEX(VMM_KERN_STACK_START); x <= PD_INDEX(VMM_KERN_STACK_END); x++) { - if ((parentPageDirectory[x] & PAGE_PRESENT) == PAGE_PRESENT) { - /* Set Parent To Propper Page Table */ - parentPageTable = (uint32_t *) (PT_BASE_ADDR + (PAGE_SIZE * x)); + /* Map The Kernel Stack Region */ + for (x = PD_INDEX(VMM_KERN_STACK_START); x <= PD_INDEX(VMM_KERN_STACK_END); + x++) { + if ((parentPageDirectory[x] & PAGE_PRESENT) == PAGE_PRESENT) { + /* Set Parent To Propper Page Table */ + parentPageTable = (uint32_t *) (PT_BASE_ADDR + (PAGE_SIZE * x)); - /* Allocate A New Page Table */ - if ((newPageTable = (uint32_t *) vmm_getFreeKernelPage(pid, 1)) == 0x0) - kpanic("Error: newPageTable == NULL, File: %s, Line: %i\n", __FILE__, __LINE__); + /* Allocate A New Page Table */ + if ((newPageTable = (uint32_t *) vmm_getFreeKernelPage(pid, 1)) + == 0x0) + kpanic("Error: newPageTable == NULL, File: %s, Line: %i\n", + __FILE__, __LINE__); - bzero(newPageTable, PAGE_SIZE); + bzero(newPageTable, PAGE_SIZE); - for (i = 0; i < PT_ENTRIES; i++) { - if ((parentPageTable[i] & PAGE_PRESENT) == PAGE_PRESENT) { + for (i = 0; i < PT_ENTRIES; i++) { + if ((parentPageTable[i] & PAGE_PRESENT) == PAGE_PRESENT) { - /* Alloc A New Page For This Stack Page */ - if ((newStackPage = (uint32_t *) vmm_getFreeKernelPage(pid, 1)) == 0x0) - kpanic("Error: newStackPage == NULL, File: %s, Line: %i\n", __FILE__, __LINE__); + /* Alloc A New Page For This Stack Page */ + if ((newStackPage = (uint32_t *) vmm_getFreeKernelPage(pid, + 1)) == 0x0) + kpanic( + "Error: newStackPage == NULL, File: %s, Line: %i\n", + __FILE__, __LINE__); - /* Set Pointer To Parents Stack Page */ - parentStackPage = (uint32_t *) (((PAGE_SIZE * PD_ENTRIES) * x) + (PAGE_SIZE * i)); + /* Set Pointer To Parents Stack Page */ + parentStackPage = (uint32_t *) (((PAGE_SIZE * PD_ENTRIES) + * x) + (PAGE_SIZE * i)); - /* Copy The Stack Byte For Byte (I Should Find A Faster Way) */ - memcpy(newStackPage, parentStackPage, PAGE_SIZE); + /* Copy The Stack Byte For Byte (I Should Find A Faster Way) */ + memcpy(newStackPage, parentStackPage, PAGE_SIZE); - /* Insert New Stack Into Page Table */ - newPageTable[i] = (vmm_getPhysicalAddr((uint32_t) newStackPage) | PAGE_DEFAULT | PAGE_STACK); + /* Insert New Stack Into Page Table */ + newPageTable[i] = + (vmm_getPhysicalAddr((uint32_t) newStackPage) + | PAGE_DEFAULT | PAGE_STACK); - /* Unmap From Kernel Space */ - vmm_unmapPage((uint32_t) newStackPage, 1); - } - } - /* Put New Page Table Into New Page Directory */ - newPageDirectory[x] = (vmm_getPhysicalAddr((uint32_t) newPageTable) | PAGE_DEFAULT); - /* Unmap Page From Kernel Space But Keep It Marked As Not Avail */ - vmm_unmapPage((uint32_t) newPageTable, 1); - } - } + /* Unmap From Kernel Space */ + vmm_unmapPage((uint32_t) newStackPage, 1); + } + } + /* Put New Page Table Into New Page Directory */ + newPageDirectory[x] = (vmm_getPhysicalAddr((uint32_t) newPageTable) + | PAGE_DEFAULT); + /* Unmap Page From Kernel Space But Keep It Marked As Not Avail */ + vmm_unmapPage((uint32_t) newPageTable, 1); + } + } - /* - * Now For The Fun Stuff For Page Tables 2-767 We Must Map These And Set - * The Permissions On Every Mapped Pages To COW This Will Conserve Memory - * Because The Two VM Spaces Will Be Sharing Pages Unless an EXECVE Happens - * - * We start at the 4MB boundary as the first 4MB is special - */ + /* + * Now For The Fun Stuff For Page Tables 2-767 We Must Map These And Set + * The Permissions On Every Mapped Pages To COW This Will Conserve Memory + * Because The Two VM Spaces Will Be Sharing Pages Unless an EXECVE Happens + * + * We start at the 4MB boundary as the first 4MB is special + */ - for (x = PD_INDEX(VMM_USER_START); x <= PD_INDEX(VMM_USER_END); x++) { + for (x = PD_INDEX(VMM_USER_START); x <= PD_INDEX(VMM_USER_END); x++) { - /* If Page Table Exists Map It */ - if ((parentPageDirectory[x] & PAGE_PRESENT) == PAGE_PRESENT) { + /* If Page Table Exists Map It */ + if ((parentPageDirectory[x] & PAGE_PRESENT) == PAGE_PRESENT) { - /* Set Parent To Propper Page Table */ - parentPageTable = (uint32_t *) (PT_BASE_ADDR + (PAGE_SIZE * x)); + /* Set Parent To Propper Page Table */ + parentPageTable = (uint32_t *) (PT_BASE_ADDR + (PAGE_SIZE * x)); - /* Allocate A New Page Table */ - if ((newPageTable = (uint32_t *) vmm_getFreeKernelPage(pid, 1)) == 0x0) - kpanic("Error: newPageTable == NULL, File: %s, Line: %i\n", __FILE__, __LINE__); + /* Allocate A New Page Table */ + if ((newPageTable = (uint32_t *) vmm_getFreeKernelPage(pid, 1)) + == 0x0) + kpanic("Error: newPageTable == NULL, File: %s, Line: %i\n", + __FILE__, __LINE__); - bzero(newPageTable, PAGE_SIZE); + bzero(newPageTable, PAGE_SIZE); - /* Set Parent And New Pages To COW */ - for (i = 0; i < PD_ENTRIES; i++) { + /* Set Parent And New Pages To COW */ + for (i = 0; i < PD_ENTRIES; i++) { - /* If Page Is Mapped */ - if ((parentPageTable[i] & PAGE_PRESENT) == PAGE_PRESENT) { + /* If Page Is Mapped */ + if ((parentPageTable[i] & PAGE_PRESENT) == PAGE_PRESENT) { - /* Check To See If Its A Stack Page */ - if (((uint32_t) parentPageTable[i] & PAGE_STACK) == PAGE_STACK) { + /* Check To See If Its A Stack Page */ + if (((uint32_t) parentPageTable[i] & PAGE_STACK) + == PAGE_STACK) { - /* Alloc A New Page For This Stack Page */ - if ((newStackPage = (uint32_t *) vmm_getFreeKernelPage(pid, 1)) == 0x0) - kpanic("Error: newStackPage == NULL, File: %s, Line: %i\n", __FILE__, __LINE__); + /* Alloc A New Page For This Stack Page */ + if ((newStackPage = (uint32_t *) vmm_getFreeKernelPage( + pid, 1)) == 0x0) + kpanic( + "Error: newStackPage == NULL, File: %s, Line: %i\n", + __FILE__, __LINE__); - /* Set Pointer To Parents Stack Page */ - parentStackPage = (uint32_t *) (((PAGE_SIZE * PD_ENTRIES) * x) + (PAGE_SIZE * i)); + /* Set Pointer To Parents Stack Page */ + parentStackPage = + (uint32_t *) (((PAGE_SIZE * PD_ENTRIES) * x) + + (PAGE_SIZE * i)); - /* Copy The Stack Byte For Byte (I Should Find A Faster Way) */ - memcpy(newStackPage, parentStackPage, PAGE_SIZE); + /* Copy The Stack Byte For Byte (I Should Find A Faster Way) */ + memcpy(newStackPage, parentStackPage, PAGE_SIZE); - /* Insert New Stack Into Page Table */ - newPageTable[i] = (vmm_getPhysicalAddr((uint32_t) newStackPage) | PAGE_DEFAULT | PAGE_STACK); + /* Insert New Stack Into Page Table */ + newPageTable[i] = (vmm_getPhysicalAddr( + (uint32_t) newStackPage) | PAGE_DEFAULT + | PAGE_STACK); - /* Unmap From Kernel Space */ - vmm_unmapPage((uint32_t) newStackPage, 1); + /* Unmap From Kernel Space */ + vmm_unmapPage((uint32_t) newStackPage, 1); - } - else { + } else { - /* Set Page To COW In Parent And Child Space */ - newPageTable[i] = (((uint32_t) parentPageTable[i] & 0xFFFFF000) | (PAGE_DEFAULT | PAGE_COW)); + /* Set Page To COW In Parent And Child Space */ + newPageTable[i] = (((uint32_t) parentPageTable[i] + & 0xFFFFF000) | (PAGE_DEFAULT | PAGE_COW)); - /* Increment The COW Counter For This Page */ - if (((uint32_t) parentPageTable[i] & PAGE_COW) == PAGE_COW) { - adjustCowCounter(((uint32_t) parentPageTable[i] & 0xFFFFF000), 1); - } - else { - /* Add Two If This Is The First Time Setting To COW */ - adjustCowCounter(((uint32_t) parentPageTable[i] & 0xFFFFF000), 2); - parentPageTable[i] |= PAGE_COW; // newPageTable[i]; - } - } - } - else { - newPageTable[i] = (uint32_t) 0x0; - } - } + /* Increment The COW Counter For This Page */ + if (((uint32_t) parentPageTable[i] & PAGE_COW) + == PAGE_COW) { + adjustCowCounter( + ((uint32_t) parentPageTable[i] & 0xFFFFF000), + 1); + } else { + /* Add Two If This Is The First Time Setting To COW */ + adjustCowCounter( + ((uint32_t) parentPageTable[i] & 0xFFFFF000), + 2); + parentPageTable[i] |= PAGE_COW; // newPageTable[i]; + } + } + } else { + newPageTable[i] = (uint32_t) 0x0; + } + } - /* Put New Page Table Into New Page Directory */ - newPageDirectory[x] = (vmm_getPhysicalAddr((uint32_t) newPageTable) | PAGE_DEFAULT); - /* Unmap Page From Kernel Space But Keep It Marked As Not Avail */ - vmm_unmapPage((uint32_t) newPageTable, 1); - } - } + /* Put New Page Table Into New Page Directory */ + newPageDirectory[x] = (vmm_getPhysicalAddr((uint32_t) newPageTable) + | PAGE_DEFAULT); + /* Unmap Page From Kernel Space But Keep It Marked As Not Avail */ + vmm_unmapPage((uint32_t) newPageTable, 1); + } + } - /* - * Allocate A New Page For The The First Page Table Where We Will Map The - * Lower Region First 4MB - */ + /* + * Allocate A New Page For The The First Page Table Where We Will Map The + * Lower Region First 4MB + */ - /* - * - * Map Page Directory Into VM Space - * First Page After Page Tables - * This must be mapped into the page directory before we map all 1024 page directories into the memory space - */ - newPageTable = (uint32_t *) vmm_getFreePage(pid); + /* + * + * Map Page Directory Into VM Space + * First Page After Page Tables + * This must be mapped into the page directory before we map all 1024 page directories into the memory space + */ + newPageTable = (uint32_t *) vmm_getFreePage(pid); - newPageDirectory[PD_INDEX(PD_BASE_ADDR)] = (uint32_t) (vmm_getPhysicalAddr((uint32_t) newPageTable) | PAGE_DEFAULT); + newPageDirectory[PD_INDEX(PD_BASE_ADDR)] = (uint32_t) (vmm_getPhysicalAddr( + (uint32_t) newPageTable) | PAGE_DEFAULT); - newPageTable[0] = (uint32_t) ((uint32_t) (newPageDirectoryAddress) | PAGE_DEFAULT); + newPageTable[0] = (uint32_t) ((uint32_t) (newPageDirectoryAddress) + | PAGE_DEFAULT); - vmm_unmapPage((uint32_t) newPageTable, 1); + vmm_unmapPage((uint32_t) newPageTable, 1); - /* - * - * Map Page Tables Into VM Space - * The First Page Table (4MB) Maps To All Page Directories - * - */ + /* + * + * Map Page Tables Into VM Space + * The First Page Table (4MB) Maps To All Page Directories + * + */ - newPageTable = (uint32_t *) vmm_getFreePage(pid); + newPageTable = (uint32_t *) vmm_getFreePage(pid); - newPageDirectory[PD_INDEX(PT_BASE_ADDR)] = (uint32_t) (vmm_getPhysicalAddr((uint32_t) newPageTable) | PAGE_DEFAULT); + newPageDirectory[PD_INDEX(PT_BASE_ADDR)] = (uint32_t) (vmm_getPhysicalAddr( + (uint32_t) newPageTable) | PAGE_DEFAULT); - /* Flush The Page From Garbage In Memory */ - bzero(newPageTable, PAGE_SIZE); + /* Flush The Page From Garbage In Memory */ + bzero(newPageTable, PAGE_SIZE); - for (x = 0; x < PD_ENTRIES; x++) - newPageTable[x] = newPageDirectory[x]; + for (x = 0; x < PD_ENTRIES; x++) + newPageTable[x] = newPageDirectory[x]; - /* Unmap Page From Virtual Space */ - vmm_unmapPage((uint32_t) newPageTable, 1); + /* Unmap Page From Virtual Space */ + vmm_unmapPage((uint32_t) newPageTable, 1); - /* Now We Are Done With The Page Directory So Lets Unmap That Too */ - vmm_unmapPage((uint32_t) newPageDirectory, 1); + /* Now We Are Done With The Page Directory So Lets Unmap That Too */ + vmm_unmapPage((uint32_t) newPageDirectory, 1); - spinUnlock(&cvsSpinLock); + spinUnlock(&cvsSpinLock); - /* Return Physical Address Of Page Directory */ - return (newPageDirectoryAddress); + /* Return Physical Address Of Page Directory */ + return (newPageDirectoryAddress); } diff --git a/sys/vmm/vmm_memory.c b/sys/vmm/vmm_memory.c index 56e2ac8..ee021b5 100644 --- a/sys/vmm/vmm_memory.c +++ b/sys/vmm/vmm_memory.c @@ -36,7 +36,7 @@ #include //MrOlsen (2016-01-11) NOTE: Need to Seperate Out CPU Specific Stuff Over Time -#include +#include static uint32_t freePages = 0; static struct spinLock vmmSpinLock = SPIN_LOCK_INITIALIZER; @@ -92,6 +92,9 @@ systemVitals->freePages = freePages; /* Print Out Amount Of Memory */ + kprintf("T\n"); + kprintf("[%i]\n", 1024); + kprintf("E\n"); kprintf("Real Memory: %iKB\n", numPages * 4); kprintf("Available Memory: %iKB\n", freePages * 4);