diff --git a/bin/clock/main.c b/bin/clock/main.c index 397c3a4..8fbdf58 100644 --- a/bin/clock/main.c +++ b/bin/clock/main.c @@ -1,38 +1,37 @@ -/***************************************************************************************** - 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: main.c 89 2016-01-12 00:20:40Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include #include #include -void print2(char *string,int,int); +void print2(char *string, int, int); #define MINUTE 60 #define HOUR (60*MINUTE) @@ -40,60 +39,57 @@ #define YEAR (365*DAY) extern const char *__progname; +static int monthSecs[12] = { 0, +DAY * (31), +DAY * (31 + 29), +DAY * (31 + 29 + 31), +DAY * (31 + 29 + 31 + 30), +DAY * (31 + 29 + 31 + 30 + 31), +DAY * (31 + 29 + 31 + 30 + 31 + 30), +DAY * (31 + 29 + 31 + 30 + 31 + 30 + 31), +DAY * (31 + 29 + 31 + 30 + 31 + 30 + 31 + 31), +DAY * (31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30), +DAY * (31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31), +DAY * (31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30) }; -static int monthSecs[12] = { - 0, - DAY*(31), - DAY*(31+29), - DAY*(31+29+31), - DAY*(31+29+31+30), - DAY*(31+29+31+30+31), - DAY*(31+29+31+30+31+30), - DAY*(31+29+31+30+31+30+31), - DAY*(31+29+31+30+31+30+31+31), - DAY*(31+29+31+30+31+30+31+31+30), - DAY*(31+29+31+30+31+30+31+31+30+31), - DAY*(31+29+31+30+31+30+31+31+30+31+30) -}; - -int main(int argc,char **argv) { +int main(int argc, char **argv) { int sysTime = 0x0; - int i = 0x0; - - int year = 0x0; + int i = 0x0; + + int year = 0x0; int month = 0x0; - int day = 0x0; - int hour = 0x0; - int min = 0x0; - int sec = 0x0; + int day = 0x0; + int hour = 0x0; + int min = 0x0; + int sec = 0x0; sysTime = gettime(); - year = (sysTime/YEAR) + 1970; - sysTime -= (YEAR * (year-1970)); - sysTime -= DAY*(((year-1970)+1)/4); - for (i = 11;i >= 0;i--) { + year = (sysTime / YEAR) + 1970; + sysTime -= (YEAR * (year - 1970)); + sysTime -= DAY * (((year - 1970) + 1) / 4); + for (i = 11; i >= 0; i--) { if ((sysTime - monthSecs[i]) > 0) { month = i; break; - } } + } sysTime -= monthSecs[i]; - if (((month > 1) && (((year-1970)+2)%4)) == 0x0) { + if (((month > 1) && (((year - 1970) + 2) % 4)) == 0x0) { sysTime += DAY; - } - - day = (sysTime/DAY); - sysTime -= (day*DAY); - hour = (sysTime/HOUR); - sysTime -= (hour*HOUR); - min = (sysTime/MINUTE); - sysTime -= (min*MINUTE); + } + + day = (sysTime / DAY); + sysTime -= (day * DAY); + hour = (sysTime / HOUR); + sysTime -= (hour * HOUR); + min = (sysTime / MINUTE); + sysTime -= (min * MINUTE); sec = sysTime; - printf("[%s][%02d/%02d/%i, %02d:%02d.%02d]\n",argv[0],month,day,year,hour,min,sec); - return(0); - } + printf("[%s][%02d/%02d/%i, %02d:%02d.%02d]\n", argv[0], month, day, year, hour, min, sec); + return (0); +} /*** END diff --git a/bin/cp/main.c b/bin/cp/main.c index e45c71c..155c147 100644 --- a/bin/cp/main.c +++ b/bin/cp/main.c @@ -1,53 +1,52 @@ -/***************************************************************************************** - 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: main.c 89 2016-01-12 00:20:40Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include - -int main(int argc,char **argv) { + +int main(int argc, char **argv) { int i = 0x0; - char *buffer = (char *)malloc(0x2000); - FILE *in = 0x0; + char *buffer = (char *) malloc(0x2000); + FILE *in = 0x0; FILE *out = 0x0; - in = fopen(argv[1],"rb"); - out = fopen(argv[2],"wb"); + in = fopen(argv[1], "rb"); + out = fopen(argv[2], "wb"); /* - while (!feof(in)) { - */ - for (i=0;i<21;i++) { - fread(buffer,0x1000,1,in); - fwrite(buffer,0x1000,1,out); - } + while (!feof(in)) { + */ + for (i = 0; i < 21; i++) { + fread(buffer, 0x1000, 1, in); + fwrite(buffer, 0x1000, 1, out); + } fclose(in); fclose(out); - return(0x0); - } + return (0x0); +} /*** $Log: main.c,v $ diff --git a/bin/disklabel/main.c b/bin/disklabel/main.c index bdbf664..3636acc 100644 --- a/bin/disklabel/main.c +++ b/bin/disklabel/main.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: main.c 89 2016-01-12 00:20:40Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include @@ -35,68 +34,67 @@ #include "ubixfs.h" - -int main(int argc,char **argv) { +int main(int argc, char **argv) { FILE *fd; - struct ubixDiskLabel *d = (struct ubixDiskLabel *)malloc(512); + struct ubixDiskLabel *d = (struct ubixDiskLabel *) malloc(512); int i = 0x0; char buf[256]; printf("Ubix Disk Label Editor Version 1.0\n"); printf("(c) 2004 Ubix Corp \n\n"); - + if (argc >= 2) { - printf("Drive Info (%s):\n",argv[1]); - fd = fopen(argv[1],"rb"); - } + printf("Drive Info (%s):\n", argv[1]); + fd = fopen(argv[1], "rb"); + } else { printf("Drive Info (hd0):\n"); - fd = fopen("hd0@devfs","rb"); - } - fseek(fd,512,0); - fread(d,512,1,fd); + fd = fopen("hd0@devfs", "rb"); + } + fseek(fd, 512, 0); + fread(d, 512, 1, fd); if (argc >= 3) { i = atoi(argv[2]); - printf("d->partitions[%i].p_size = %i, ",i,d->partitions[i].p_size); + printf("d->partitions[%i].p_size = %i, ", i, d->partitions[i].p_size); printf("New Value: "); - gets((char *)&buf); + gets((char *) &buf); d->partitions[i].p_size = atoi(buf); - printf("d->partitions[%i].p_offset = %i, ",i,d->partitions[i].p_offset); + printf("d->partitions[%i].p_offset = %i, ", i, d->partitions[i].p_offset); printf("New Value: "); - gets((char *)&buf); + gets((char *) &buf); d->partitions[i].p_offset = atoi(buf); - printf("d->partitions[%i].p_fstype = %i, ",i,d->partitions[i].p_fstype); + printf("d->partitions[%i].p_fstype = %i, ", i, d->partitions[i].p_fstype); printf("New Value: "); - gets((char *)&buf); + gets((char *) &buf); d->partitions[i].p_fstype = atoi(buf); - printf("d->partitions[%i].p_bsize = %i, ",i,d->partitions[i].p_bsize); + printf("d->partitions[%i].p_bsize = %i, ", i, d->partitions[i].p_bsize); printf("New Value: "); - gets((char *)&buf); + gets((char *) &buf); d->partitions[i].p_bsize = atoi(buf); printf("\n"); - printf("d->partitions[%i].p_size = %i\n",i,d->partitions[i].p_size); - printf("d->partitions[%i].p_offset = %i\n",i,d->partitions[i].p_offset); - printf("d->partitions[%i].p_fstype = %i\n",i,d->partitions[i].p_fstype); - printf("d->partitions[%i].p_bsize = %i\n",i,d->partitions[i].p_bsize); - fseek(fd,512,0); - fwrite(d,512,1,fd); - } + printf("d->partitions[%i].p_size = %i\n", i, d->partitions[i].p_size); + printf("d->partitions[%i].p_offset = %i\n", i, d->partitions[i].p_offset); + printf("d->partitions[%i].p_fstype = %i\n", i, d->partitions[i].p_fstype); + printf("d->partitions[%i].p_bsize = %i\n", i, d->partitions[i].p_bsize); + fseek(fd, 512, 0); + fwrite(d, 512, 1, fd); + } else { - for (i=0;i<4;i++) { + for (i = 0; i < 4; i++) { if (d->partitions[i].p_fstype != 0x0) { - printf("d->partitions[%i].p_size = %i\n",i,d->partitions[i].p_size); - printf("d->partitions[%i].p_offset = %i\n",i,d->partitions[i].p_offset); - printf("d->partitions[%i].p_fstype = 0x%X\n",i,d->partitions[i].p_fstype); - printf("d->partitions[%i].p_bsize = 0x%X\n",i,d->partitions[i].p_bsize); - } + printf("d->partitions[%i].p_size = %i\n", i, d->partitions[i].p_size); + printf("d->partitions[%i].p_offset = %i\n", i, d->partitions[i].p_offset); + printf("d->partitions[%i].p_fstype = 0x%X\n", i, d->partitions[i].p_fstype); + printf("d->partitions[%i].p_bsize = 0x%X\n", i, d->partitions[i].p_bsize); } } + } fclose(fd); - return(0); - } + return (0); +} /*** $Log: main.c,v $ diff --git a/bin/disklabel/ubixfs.h b/bin/disklabel/ubixfs.h index 42662cf..65c4f7f 100644 --- a/bin/disklabel/ubixfs.h +++ b/bin/disklabel/ubixfs.h @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: ubixfs.h 89 2016-01-12 00:20:40Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include @@ -35,40 +34,39 @@ #define UBIXFSMAGIC ((uInt32)0x69) /* The File System Magic Number */ struct ubixDiskLabel { - uInt32 magicNum; - uInt32 magicNum2; - uInt16 driveType; - uInt16 numPartitions; - struct ubixPartitions { /* the partition table */ - uInt32 p_size; /* number of sectors in partition */ - uInt32 p_offset; /* starting sector */ - uInt32 p_fsize; /* filesystem basic fragment size */ - uInt32 p_bsize; /* BAT size */ - uInt8 p_fstype; /* filesystem type, see below */ - uInt8 p_frag; /* filesystem fragments per block */ - } partitions[MAXUBIXPARTITIONS]; - }; + uInt32 magicNum; + uInt32 magicNum2; + uInt16 driveType; + uInt16 numPartitions; + struct ubixPartitions { /* the partition table */ + uInt32 p_size; /* number of sectors in partition */ + uInt32 p_offset; /* starting sector */ + uInt32 p_fsize; /* filesystem basic fragment size */ + uInt32 p_bsize; /* BAT size */ + uInt8 p_fstype; /* filesystem type, see below */ + uInt8 p_frag; /* filesystem fragments per block */ + } partitions[MAXUBIXPARTITIONS]; +}; //Block Allocation Table Entry struct blockAllocationTableEntry { - long attributes; //Block Attributes - long realSector; //Real Sector - long nextBlock; //Sector Of Next Block - long reserved; //Reserved - }; - + long attributes; //Block Attributes + long realSector; //Real Sector + long nextBlock; //Sector Of Next Block + long reserved; //Reserved +}; struct directoryEntry { - uInt32 startCluster; //Starting Cluster Of File - uInt32 size; //Size Of File - uInt32 creationDate; //Date Created - uInt32 lastModified; //Date Last Modified - uInt32 uid; //UID Of Owner - uInt32 gid; //GID Of Owner - uInt16 attributes; //Files Attributes - uInt16 permissions; //Files Permissions - char fileName[256]; //File Name - }; + uInt32 startCluster; //Starting Cluster Of File + uInt32 size; //Size Of File + uInt32 creationDate; //Date Created + uInt32 lastModified; //Date Last Modified + uInt32 uid; //UID Of Owner + uInt32 gid; //GID Of Owner + uInt16 attributes; //Files Attributes + uInt16 permissions; //Files Permissions + char fileName[256]; //File Name +}; /*** $Log: ubixfs.h,v $ diff --git a/bin/edit/main.c b/bin/edit/main.c index 558afa2..fcfade3 100644 --- a/bin/edit/main.c +++ b/bin/edit/main.c @@ -1,58 +1,57 @@ -/***************************************************************************************** - 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: main.c 89 2016-01-12 00:20:40Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include -int main(int argc,char **argv) { +int main(int argc, char **argv) { extern char *environ; char in[1024]; FILE *out; size_t count = 0x0; printf("UbixOS Text Editor\n"); printf("V1.0\n"); - printf("ARGC: [%i]\n",argc); - printf("ARGV[0]: [%s]\n",argv[0]); + printf("ARGC: [%i]\n", argc); + printf("ARGV[0]: [%s]\n", argv[0]); - out = fopen("/test.txt","r"); + out = fopen("/test.txt", "r"); while (!feof(out)) { - printf("%c",fgetc(out)); - } + printf("%c", fgetc(out)); + } //printf("[%S]",getenv("TEST")); - printf("\nENV TEST: [0x%X]\n",environ); - setenv("BLAH","WOOT",1); - printf("[%s]",getenv("BLAH")); + printf("\nENV TEST: [0x%X]\n", environ); + setenv("BLAH", "WOOT", 1); + printf("[%s]", getenv("BLAH")); - return(0); - } + return (0); +} /*** END diff --git a/bin/fdisk/main.c b/bin/fdisk/main.c index 1648d30..486054d 100644 --- a/bin/fdisk/main.c +++ b/bin/fdisk/main.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: main.c 89 2016-01-12 00:20:40Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include @@ -36,92 +35,91 @@ #include "ubixfs.h" 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 */ + 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 */ }; - -int main(int argc,char **argv) { +int main(int argc, char **argv) { FILE *fd; FILE *mbr; struct dos_partition *d = 0x0; - char *data = (char *)malloc(512); + char *data = (char *) malloc(512); int i = 0x0; char buf[256]; - d = (struct dos_partition *)(data + 0x1BE); + d = (struct dos_partition *) (data + 0x1BE); printf("Ubix Disk Editor Version 1.0\n"); printf("(c) 2004 Ubix Corp \n\n"); - + if (argc >= 2) { - printf("Drive Info (%s):\n",argv[1]); - fd = fopen(argv[1],"rb"); - } + printf("Drive Info (%s):\n", argv[1]); + fd = fopen(argv[1], "rb"); + } else { printf("Drive Info (ad0):\n"); - fd = fopen("devfs:ad0","rb"); - } + fd = fopen("devfs:ad0", "rb"); + } if (fd->size == 0x0) { printf("Invalid Device\n"); exit(0x1); - } + } - fseek(fd,0,0); - fread(data,512,1,fd); + fseek(fd, 0, 0); + fread(data, 512, 1, fd); if (argc >= 3) { i = atoi(argv[2]); if (i == 0) { - mbr = fopen("sys:mrb","rb"); - fseek(mbr,0,0); - fread(data,512,1,mbr); + mbr = fopen("sys:mrb", "rb"); + fseek(mbr, 0, 0); + fread(data, 512, 1, mbr); printf("Installing Ubix MBR\n"); - } + } else { i--; - printf("d[%i].dp_type = %i, ",i,d[i].dp_type); + printf("d[%i].dp_type = %i, ", i, d[i].dp_type); printf("New Value: "); - gets((char *)&buf); + gets((char *) &buf); d[i].dp_type = atoi(buf); - printf("d[%i].dp_start: %i, ",i,d[i].dp_start); + printf("d[%i].dp_start: %i, ", i, d[i].dp_start); printf("New Value: "); - gets((char *)&buf); + gets((char *) &buf); d[i].dp_start = atoi(buf); - printf("d[%i].dp_size: %i, ",i,d[i].dp_size); + printf("d[%i].dp_size: %i, ", i, d[i].dp_size); printf("New Value: "); - gets((char *)&buf); + gets((char *) &buf); d[i].dp_size = atoi(buf); - printf("d[%i].dp_type: 0x%X\n",i,d[i].dp_type); - printf("d[%i].dp_start: %i\n",i,d[i].dp_start); - printf("d[%i].dp_size: %i\n",i,d[i].dp_size); - } - fseek(fd,0,0); - fwrite(data,512,1,fd); + printf("d[%i].dp_type: 0x%X\n", i, d[i].dp_type); + printf("d[%i].dp_start: %i\n", i, d[i].dp_start); + printf("d[%i].dp_size: %i\n", i, d[i].dp_size); } + fseek(fd, 0, 0); + fwrite(data, 512, 1, fd); + } else { printf("Partition Table:\n"); - for (i=0;i<4;i++) { + for (i = 0; i < 4; i++) { if (d[i].dp_type != 0x0) { - printf("d[%i].dp_type: 0x%X\n",i,d[i].dp_type); - printf("d[%i].dp_start: %i\n",i,d[i].dp_start); - printf("d[%i].dp_size: %i\n",i,d[i].dp_size); - } + printf("d[%i].dp_type: 0x%X\n", i, d[i].dp_type); + printf("d[%i].dp_start: %i\n", i, d[i].dp_start); + printf("d[%i].dp_size: %i\n", i, d[i].dp_size); } } + } fclose(fd); - return(0); - } + return (0); +} /*** $Log: main.c,v $ diff --git a/bin/fdisk/ubixfs.h b/bin/fdisk/ubixfs.h index 42662cf..65c4f7f 100644 --- a/bin/fdisk/ubixfs.h +++ b/bin/fdisk/ubixfs.h @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: ubixfs.h 89 2016-01-12 00:20:40Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include @@ -35,40 +34,39 @@ #define UBIXFSMAGIC ((uInt32)0x69) /* The File System Magic Number */ struct ubixDiskLabel { - uInt32 magicNum; - uInt32 magicNum2; - uInt16 driveType; - uInt16 numPartitions; - struct ubixPartitions { /* the partition table */ - uInt32 p_size; /* number of sectors in partition */ - uInt32 p_offset; /* starting sector */ - uInt32 p_fsize; /* filesystem basic fragment size */ - uInt32 p_bsize; /* BAT size */ - uInt8 p_fstype; /* filesystem type, see below */ - uInt8 p_frag; /* filesystem fragments per block */ - } partitions[MAXUBIXPARTITIONS]; - }; + uInt32 magicNum; + uInt32 magicNum2; + uInt16 driveType; + uInt16 numPartitions; + struct ubixPartitions { /* the partition table */ + uInt32 p_size; /* number of sectors in partition */ + uInt32 p_offset; /* starting sector */ + uInt32 p_fsize; /* filesystem basic fragment size */ + uInt32 p_bsize; /* BAT size */ + uInt8 p_fstype; /* filesystem type, see below */ + uInt8 p_frag; /* filesystem fragments per block */ + } partitions[MAXUBIXPARTITIONS]; +}; //Block Allocation Table Entry struct blockAllocationTableEntry { - long attributes; //Block Attributes - long realSector; //Real Sector - long nextBlock; //Sector Of Next Block - long reserved; //Reserved - }; - + long attributes; //Block Attributes + long realSector; //Real Sector + long nextBlock; //Sector Of Next Block + long reserved; //Reserved +}; struct directoryEntry { - uInt32 startCluster; //Starting Cluster Of File - uInt32 size; //Size Of File - uInt32 creationDate; //Date Created - uInt32 lastModified; //Date Last Modified - uInt32 uid; //UID Of Owner - uInt32 gid; //GID Of Owner - uInt16 attributes; //Files Attributes - uInt16 permissions; //Files Permissions - char fileName[256]; //File Name - }; + uInt32 startCluster; //Starting Cluster Of File + uInt32 size; //Size Of File + uInt32 creationDate; //Date Created + uInt32 lastModified; //Date Last Modified + uInt32 uid; //UID Of Owner + uInt32 gid; //GID Of Owner + uInt16 attributes; //Files Attributes + uInt16 permissions; //Files Permissions + char fileName[256]; //File Name +}; /*** $Log: ubixfs.h,v $ diff --git a/bin/format/main.c b/bin/format/main.c index 5872c27..b82d812 100644 --- a/bin/format/main.c +++ b/bin/format/main.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: main.c 89 2016-01-12 00:20:40Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include diff --git a/bin/init/main.c b/bin/init/main.c index 3376193..9d7fbf7 100644 --- a/bin/init/main.c +++ b/bin/init/main.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: main.c 158 2016-01-19 02:08:13Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include diff --git a/bin/launcher/launcher.cpp b/bin/launcher/launcher.cpp index db6cd82..5867cb3 100644 --- a/bin/launcher/launcher.cpp +++ b/bin/launcher/launcher.cpp @@ -1,3 +1,31 @@ +/*- + * 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. + */ + #include #include #include diff --git a/bin/launcher/ubixButton.cpp b/bin/launcher/ubixButton.cpp index f74f65c..ed3fac5 100644 --- a/bin/launcher/ubixButton.cpp +++ b/bin/launcher/ubixButton.cpp @@ -1,3 +1,31 @@ +/*- + * 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. + */ + #include #include #include diff --git a/bin/launcher/ubixDesktop.cpp b/bin/launcher/ubixDesktop.cpp index c9afad0..47f18bb 100644 --- a/bin/launcher/ubixDesktop.cpp +++ b/bin/launcher/ubixDesktop.cpp @@ -1,3 +1,31 @@ +/*- + * 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. + */ + #include #include #include diff --git a/bin/login/main.c b/bin/login/main.c index 37e006c..4c882f5 100644 --- a/bin/login/main.c +++ b/bin/login/main.c @@ -1,25 +1,30 @@ -/************************************************************************************** - Copyright (c) 2002 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: main.c 159 2016-01-19 03:07:04Z reddawg $ - -**************************************************************************************/ +/*- + * 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. + */ #include #include diff --git a/bin/ls/main.c b/bin/ls/main.c index 6092b77..cb11901 100644 --- a/bin/ls/main.c +++ b/bin/ls/main.c @@ -1,25 +1,30 @@ -/************************************************************************************** - Copyright (c) 2002 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: main.c 89 2016-01-12 00:20:40Z reddawg $ - -**************************************************************************************/ +/*- + * 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. + */ #include #include diff --git a/bin/mount/main.c b/bin/mount/main.c index 75a03f1..98d6988 100644 --- a/bin/mount/main.c +++ b/bin/mount/main.c @@ -1,3 +1,31 @@ +/*- + * 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. + */ + #include #include diff --git a/bin/muffin/main.cc b/bin/muffin/main.cc index 30868da..9e7dbc3 100644 --- a/bin/muffin/main.cc +++ b/bin/muffin/main.cc @@ -1,3 +1,31 @@ +/*- + * 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. + */ + #include extern "C" { #include diff --git a/bin/shell/commands.c b/bin/shell/commands.c index e6f22d3..33f7f21 100644 --- a/bin/shell/commands.c +++ b/bin/shell/commands.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: commands.c 158 2016-01-19 02:08:13Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include diff --git a/bin/shell/error.c b/bin/shell/error.c index 3bba1a3..f0c6387 100644 --- a/bin/shell/error.c +++ b/bin/shell/error.c @@ -1,25 +1,30 @@ -/************************************************************************************** - Copyright (c) 2002 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: error.c 89 2016-01-12 00:20:40Z reddawg $ - -**************************************************************************************/ +/*- + * 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. + */ #include #include diff --git a/bin/shell/exec.c b/bin/shell/exec.c index c542678..2ebe057 100644 --- a/bin/shell/exec.c +++ b/bin/shell/exec.c @@ -1,26 +1,30 @@ -/************************************************************************************** - Copyright (c) 2002 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: exec.c 158 2016-01-19 02:08:13Z reddawg $ - -**************************************************************************************/ - +/*- + * 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. + */ #include #include #include diff --git a/bin/shell/input.c b/bin/shell/input.c index 11f8fe6..c3bc07d 100644 --- a/bin/shell/input.c +++ b/bin/shell/input.c @@ -1,26 +1,30 @@ -/************************************************************************************** - Copyright (c) 2002 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: input.c 128 2016-01-14 14:06:43Z reddawg $ - - **************************************************************************************/ - +/*- + * 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. + */ #include #include #include diff --git a/bin/shell/main.c b/bin/shell/main.c index ddc745f..eb5c348 100644 --- a/bin/shell/main.c +++ b/bin/shell/main.c @@ -1,25 +1,30 @@ -/************************************************************************************** - Copyright (c) 2002 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: main.c 160 2016-01-19 04:01:03Z reddawg $ - - **************************************************************************************/ +/*- + * 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. + */ #include #include diff --git a/bin/shell/shell.h b/bin/shell/shell.h index e140799..13edb0c 100644 --- a/bin/shell/shell.h +++ b/bin/shell/shell.h @@ -1,3 +1,31 @@ +/*- + * 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. + */ + #include extern char *cwd; diff --git a/bin/stat/main.c b/bin/stat/main.c index b422f22..1672100 100644 --- a/bin/stat/main.c +++ b/bin/stat/main.c @@ -1,70 +1,66 @@ -/***************************************************************************************** - 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: main.c 163 2016-01-19 15:34:38Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include #include #include -void print2(char *string,int,int); +void print2(char *string, int, int); #define MINUTE 60 #define HOUR (60*MINUTE) #define DAY (24*HOUR) #define YEAR (365*DAY) +static int monthSecs[12] = { 0, +DAY * (31), +DAY * (31 + 29), +DAY * (31 + 29 + 31), +DAY * (31 + 29 + 31 + 30), +DAY * (31 + 29 + 31 + 30 + 31), +DAY * (31 + 29 + 31 + 30 + 31 + 30), +DAY * (31 + 29 + 31 + 30 + 31 + 30 + 31), +DAY * (31 + 29 + 31 + 30 + 31 + 30 + 31 + 31), +DAY * (31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30), +DAY * (31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31), +DAY * (31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30) }; -static int monthSecs[12] = { - 0, - DAY*(31), - DAY*(31+29), - DAY*(31+29+31), - DAY*(31+29+31+30), - DAY*(31+29+31+30+31), - DAY*(31+29+31+30+31+30), - DAY*(31+29+31+30+31+30+31), - DAY*(31+29+31+30+31+30+31+31), - DAY*(31+29+31+30+31+30+31+31+30), - DAY*(31+29+31+30+31+30+31+31+30+31), - DAY*(31+29+31+30+31+30+31+31+30+31+30) -}; - -int main(int argc,char **argv) { +int main(int argc, char **argv) { int sysTime = 0x0; - int i = 0x0; - - int year = 0x0; + int i = 0x0; + + int year = 0x0; int month = 0x0; - int day = 0x0; - int hour = 0x0; - int min = 0x0; - int sec = 0x0; + int day = 0x0; + int hour = 0x0; + int min = 0x0; + int sec = 0x0; int x = 0x0; @@ -87,37 +83,35 @@ printf("FS: [0x%X]\n", x); exit(0); - - //start: sysTime = gettime(); - year = (sysTime/YEAR) + 1970; - sysTime -= (YEAR * (year-1970)); - sysTime -= DAY*(((year-1970)+1)/4); - for (i = 11;i >= 0;i--) { + year = (sysTime / YEAR) + 1970; + sysTime -= (YEAR * (year - 1970)); + sysTime -= DAY * (((year - 1970) + 1) / 4); + for (i = 11; i >= 0; i--) { if ((sysTime - monthSecs[i]) > 0) { month = i; break; - } } + } sysTime -= monthSecs[i]; - if (((month > 1) && (((year-1970)+2)%4)) == 0x0) { + if (((month > 1) && (((year - 1970) + 2) % 4)) == 0x0) { sysTime += DAY; - } - - day = (sysTime/DAY); - sysTime -= (day*DAY); - hour = (sysTime/HOUR); - sysTime -= (hour*HOUR); - min = (sysTime/MINUTE); - sysTime -= (min*MINUTE); + } + + day = (sysTime / DAY); + sysTime -= (day * DAY); + hour = (sysTime / HOUR); + sysTime -= (hour * HOUR); + min = (sysTime / MINUTE); + sysTime -= (min * MINUTE); sec = sysTime; - printf("[%02d/%02d/%i, %02d:%02d.%02d]\n",month,day,year,hour,min,sec); + printf("[%02d/%02d/%i, %02d:%02d.%02d]\n", month, day, year, hour, min, sec); // goto start; - return(0); - } + return (0); +} /*** END diff --git a/bin/ttyd/main.c b/bin/ttyd/main.c index 8cf8479..32b99f8 100644 --- a/bin/ttyd/main.c +++ b/bin/ttyd/main.c @@ -1,43 +1,42 @@ -/***************************************************************************************** - 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: main.c 89 2016-01-12 00:20:40Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include -int main(int argc,char **argv) { +int main(int argc, char **argv) { mpi_message_t myMsg; - - printf("Initializing TTYD\n"); - printf("mpi_post: [%i]\n",mpi_postMessage("system",0x1,&myMsg)); - return(0x0); - } + printf("Initializing TTYD\n"); + printf("mpi_post: [%i]\n", mpi_postMessage("system", 0x1, &myMsg)); + + return (0x0); +} /*** $Log: main.c,v $ diff --git a/bin/ubistry/db.c b/bin/ubistry/db.c index 633d666..be451d5 100644 --- a/bin/ubistry/db.c +++ b/bin/ubistry/db.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: db.c 89 2016-01-12 00:20:40Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include diff --git a/bin/ubistry/include/ubistry.h b/bin/ubistry/include/ubistry.h index 231acea..084e200 100644 --- a/bin/ubistry/include/ubistry.h +++ b/bin/ubistry/include/ubistry.h @@ -1,3 +1,31 @@ +/*- + * 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. + */ + #include #define MBOX_NAME "ubistry" diff --git a/bin/ubistry/main.c b/bin/ubistry/main.c index c12c9f4..1dd1f5f 100644 --- a/bin/ubistry/main.c +++ b/bin/ubistry/main.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: main.c 89 2016-01-12 00:20:40Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include diff --git a/bin/ubistry/message.c b/bin/ubistry/message.c index 75523ab..1f03e12 100644 --- a/bin/ubistry/message.c +++ b/bin/ubistry/message.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: message.c 158 2016-01-19 02:08:13Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include diff --git a/bin/views/main.c b/bin/views/main.c index dcf041e..36ca99f 100644 --- a/bin/views/main.c +++ b/bin/views/main.c @@ -1,25 +1,30 @@ -/************************************************************************************** - Copyright (c) 2002 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: main.c 89 2016-01-12 00:20:40Z reddawg $ - -**************************************************************************************/ +/*- + * 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. + */ #include #include diff --git a/sys/armv6/ap-boot.S b/sys/armv6/ap-boot.S index 2645aff..c08bd1e 100644 --- a/sys/armv6/ap-boot.S +++ b/sys/armv6/ap-boot.S @@ -1,3 +1,31 @@ +/*- + * 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. + */ + /* * Okay, this file contains the code that's going to bootstrap the AP cpus */ diff --git a/sys/armv6/bioscall.c b/sys/armv6/bioscall.c index abb14fb..c27a8db 100644 --- a/sys/armv6/bioscall.c +++ b/sys/armv6/bioscall.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: bioscall.c 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include diff --git a/sys/armv6/exec.c b/sys/armv6/exec.c index 0a512c4..873cbf6 100644 --- a/sys/armv6/exec.c +++ b/sys/armv6/exec.c @@ -1,32 +1,30 @@ -/***************************************************************************************** - 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 F -ITNESS 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: exec.c 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include diff --git a/sys/armv6/fork.c b/sys/armv6/fork.c index 6a42c03..20fcde6 100644 --- a/sys/armv6/fork.c +++ b/sys/armv6/fork.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: fork.c 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include @@ -38,65 +37,66 @@ /***************************************************************************************** Functoin: static int fork_copyProcess(struct taskStruct *newProcess,long ebp,long edi, - long esi, long none,long ebx,long ecx,long edx,long eip,long cs,long eflags, - long esp,long ss) + long esi, long none,long ebx,long ecx,long edx,long eip,long cs,long eflags, + long esp,long ss) Desc: This function will copy a process Notes: -*****************************************************************************************/ + *****************************************************************************************/ /* Had to remove static though tihs function is only used in this file */ -int fork_copyProcess(struct taskStruct *newProcess,long ebp,long edi,long esi,long none,long ebx,long ecx,long edx,long eip,long cs,long eflags,long esp,long ss) { +int fork_copyProcess(struct taskStruct *newProcess, long ebp, long edi, long esi, long none, long ebx, long ecx, long edx, long eip, long cs, long eflags, long esp, long ss) { volatile struct taskStruct * tmpProcPtr = newProcess; assert(newProcess); assert(_current); - + /* Set Up New Tasks Information */ - memcpy(newProcess->oInfo.cwd,_current->oInfo.cwd,1024); - - newProcess->tss.eip = eip; - newProcess->oInfo.vmStart = _current->oInfo.vmStart; - newProcess->term = _current->term; - newProcess->term->owner = newProcess->id; - newProcess->uid = _current->uid; - newProcess->gid = _current->gid; - newProcess->tss.back_link = 0x0; - newProcess->tss.esp0 = _current->tss.esp0; - newProcess->tss.ss0 = 0x10; - newProcess->tss.esp1 = 0x0; - newProcess->tss.ss1 = 0x0; - newProcess->tss.esp2 = 0x0; - newProcess->tss.ss2 = 0x0; - newProcess->tss.eflags = eflags; - newProcess->tss.eax = 0x0; - newProcess->tss.ebx = ebx; - newProcess->tss.ecx = ecx; - newProcess->tss.edx = edx; - newProcess->tss.esi = esi; - newProcess->tss.edi = edi; - newProcess->tss.ebp = ebp; - newProcess->tss.esp = esp; - newProcess->tss.cs = cs & 0xFF; - newProcess->tss.ss = ss & 0xFF; - newProcess->tss.ds = _current->tss.ds & 0xFF; - newProcess->tss.fs = _current->tss.fs & 0xFF; - newProcess->tss.gs = _current->tss.gs & 0xFF; - newProcess->tss.es = _current->tss.es & 0xFF; - newProcess->tss.ldt = 0x18; + memcpy(newProcess->oInfo.cwd, _current->oInfo.cwd, 1024); + + newProcess->tss.eip = eip; + newProcess->oInfo.vmStart = _current->oInfo.vmStart; + newProcess->term = _current->term; + newProcess->term->owner = newProcess->id; + newProcess->uid = _current->uid; + newProcess->gid = _current->gid; + newProcess->tss.back_link = 0x0; + newProcess->tss.esp0 = _current->tss.esp0; + newProcess->tss.ss0 = 0x10; + newProcess->tss.esp1 = 0x0; + newProcess->tss.ss1 = 0x0; + newProcess->tss.esp2 = 0x0; + newProcess->tss.ss2 = 0x0; + newProcess->tss.eflags = eflags; + newProcess->tss.eax = 0x0; + newProcess->tss.ebx = ebx; + newProcess->tss.ecx = ecx; + newProcess->tss.edx = edx; + newProcess->tss.esi = esi; + newProcess->tss.edi = edi; + newProcess->tss.ebp = ebp; + newProcess->tss.esp = esp; + newProcess->tss.cs = cs & 0xFF; + newProcess->tss.ss = ss & 0xFF; + newProcess->tss.ds = _current->tss.ds & 0xFF; + newProcess->tss.fs = _current->tss.fs & 0xFF; + newProcess->tss.gs = _current->tss.gs & 0xFF; + newProcess->tss.es = _current->tss.es & 0xFF; + newProcess->tss.ldt = 0x18; newProcess->tss.trace_bitmap = 0x0000; - newProcess->tss.io_map = 0x8000; + newProcess->tss.io_map = 0x8000; /* Create A Copy Of The VM Space For New Task */ - newProcess->tss.cr3 = (uInt32)vmmCopyVirtualSpace(newProcess->id); + newProcess->tss.cr3 = (uInt32) vmmCopyVirtualSpace(newProcess->id); newProcess->state = FORK; - + /* Fix gcc optimization problems */ - while (tmpProcPtr->state == FORK) sched_yield(); + while (tmpProcPtr->state == FORK) + sched_yield(); /* Return Id of Proccess */ - return(newProcess->id); - } - + return (newProcess->id); +} + /***************************************************************************************** Functoin: void sysFork(); @@ -104,11 +104,11 @@ Notes: - 08/01/02 - This Seems To Be Working Fine However I'm Not Sure If I - Chose The Best Path To Impliment It I Guess We Will See - What The Future May Bring + 08/01/02 - This Seems To Be Working Fine However I'm Not Sure If I + Chose The Best Path To Impliment It I Guess We Will See + What The Future May Bring -*****************************************************************************************/ + *****************************************************************************************/ asm( ".globl sysFork \n" "sysFork: \n" @@ -125,9 +125,4 @@ " addl $16,%esp \n" "fork_ret: \n" " ret \n" - ); - -/*** - END - ***/ - +); diff --git a/sys/armv6/kpanic.c b/sys/armv6/kpanic.c index daad804..57c4920 100644 --- a/sys/armv6/kpanic.c +++ b/sys/armv6/kpanic.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: kpanic.c 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include @@ -40,7 +39,7 @@ * */ void kpanic(const char *fmt, ...) { - char buf[512]; + char buf[512]; vaList args; vaStart(args, fmt); diff --git a/sys/armv6/sched.c b/sys/armv6/sched.c index 2c09098..476d1f9 100644 --- a/sys/armv6/sched.c +++ b/sys/armv6/sched.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: sched.c 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include @@ -45,8 +44,8 @@ #include static kTask_t *taskList = 0x0; -static kTask_t *delList = 0x0; -static uInt32 nextID = -1; +static kTask_t *delList = 0x0; +static uInt32 nextID = -1; kTask_t *_current = 0x0; kTask_t *_usedMath = 0x0; @@ -55,176 +54,166 @@ /************************************************************************ -Function: int sched_init() + Function: int sched_init() -Description: This function is used to enable the kernel scheduler + Description: This function is used to enable the kernel scheduler -Notes: + Notes: -02/20/2004 - Approved for quality + 02/20/2004 - Approved for quality -************************************************************************/ + ************************************************************************/ +int sched_init() { + taskList = (kTask_t *) kmalloc(sizeof(kTask_t)); + if (taskList == 0x0) + kpanic("Unable to create task list"); -int sched_init() { - taskList = (kTask_t *)kmalloc(sizeof(kTask_t)); - if(taskList == 0x0) - kpanic("Unable to create task list"); - taskList->id = nextID++; /* Print out information on scheduler */ kprintf("sched0 - Address: [0x%X]\n", taskList); - + /* Return so we know everything went well */ - return(0x0); - } + return (0x0); +} - -void sched(){ - uInt32 memAddr = 0x0; +void sched() { + uInt32 memAddr = 0x0; kTask_t *tmpTask = 0x0; kTask_t *delTask = 0x0; - + if (!spinTryLock(&schedulerSpinLock)) - return; - + return; + tmpTask = _current->next; //outportByte(0xE9,_current->id + '0'); schedStart: /* Yield the next task from the current prio queue */ - for (;tmpTask != 0x0; tmpTask = tmpTask->next) { + for (; tmpTask != 0x0; tmpTask = tmpTask->next) { if (tmpTask->state > 0x0) { _current = tmpTask; if (_current->state == FORK) _current->state = READY; break; - } - else if (tmpTask->state == DEAD) - { - delTask = tmpTask; - tmpTask = tmpTask->next; - sched_deleteTask(delTask->id); - sched_addDelTask(delTask); - goto schedStart; - } } + else if (tmpTask->state == DEAD) { + delTask = tmpTask; + tmpTask = tmpTask->next; + sched_deleteTask(delTask->id); + sched_addDelTask(delTask); + goto schedStart; + } + } - /* Finished all the tasks, restarting the list */ - if (0x0 == tmpTask) { - tmpTask = taskList; - goto schedStart; - } - - - if (_current->state > 0x0) { - if (_current->oInfo.v86Task == 0x1) - irqDisable(0x0); - asm("cli"); - memAddr = (uInt32)&(_current->tss); - ubixGDT[4].descriptor.baseLow = (memAddr & 0xFFFF); - ubixGDT[4].descriptor.baseMed = ((memAddr >> 16) & 0xFF); - ubixGDT[4].descriptor.baseHigh = (memAddr >> 24); - ubixGDT[4].descriptor.access = '\x89'; - spinUnlock(&schedulerSpinLock); - asm("sti"); - asm("ljmp $0x20,$0\n"); - } - else - { - spinUnlock(&schedulerSpinLock); - } - - return; + /* Finished all the tasks, restarting the list */ + if (0x0 == tmpTask) { + tmpTask = taskList; + goto schedStart; + } + + if (_current->state > 0x0) { + if (_current->oInfo.v86Task == 0x1) + irqDisable(0x0); + asm("cli"); + memAddr = (uInt32) &(_current->tss); + ubixGDT[4].descriptor.baseLow = (memAddr & 0xFFFF); + ubixGDT[4].descriptor.baseMed = ((memAddr >> 16) & 0xFF); + ubixGDT[4].descriptor.baseHigh = (memAddr >> 24); + ubixGDT[4].descriptor.access = '\x89'; + spinUnlock(&schedulerSpinLock); + asm("sti"); + asm("ljmp $0x20,$0\n"); + } + else { + spinUnlock(&schedulerSpinLock); + } + + return; } - kTask_t *schedNewTask() { int i = 0; - kTask_t *tmpTask = (kTask_t *)kmalloc(sizeof(kTask_t)); + kTask_t *tmpTask = (kTask_t *) kmalloc(sizeof(kTask_t)); struct file *fp = 0x0; if (tmpTask == 0x0) kpanic("Error: schedNewTask() - kmalloc failed trying to initialize a new task struct\n"); - memset(tmpTask,0x0,sizeof(kTask_t)); + memset(tmpTask, 0x0, sizeof(kTask_t)); /* Filling in tasks attrs */ - tmpTask->usedMath = 0x0; - tmpTask->state = NEW; + tmpTask->usedMath = 0x0; + tmpTask->state = NEW; /* HACK */ - for (i=0;i<3;i++) { - fp = (void *)kmalloc(sizeof(struct file)); - tmpTask->td.o_files[i] = (uint32_t)fp; + for (i = 0; i < 3; i++) { + fp = (void *) kmalloc(sizeof(struct file)); + tmpTask->td.o_files[i] = (uint32_t) fp; fp->f_flag = 0x4; - } - - spinLock(&schedulerSpinLock); - tmpTask->id = nextID++; - tmpTask->next = taskList; - tmpTask->prev = 0x0; - taskList->prev = tmpTask; - taskList = tmpTask; - - spinUnlock(&schedulerSpinLock); - - return(tmpTask); } + spinLock(&schedulerSpinLock); + tmpTask->id = nextID++; + tmpTask->next = taskList; + tmpTask->prev = 0x0; + taskList->prev = tmpTask; + taskList = tmpTask; + + spinUnlock(&schedulerSpinLock); + + return (tmpTask); +} int sched_deleteTask(pidType id) { - kTask_t *tmpTask = 0x0; + kTask_t *tmpTask = 0x0; /* Checking each task from the prio queue */ for (tmpTask = taskList; tmpTask != 0x0; tmpTask = tmpTask->next) { - if (tmpTask->id == id) { - if (tmpTask->prev != 0x0) - tmpTask->prev->next = tmpTask->next; - if (tmpTask->next != 0x0) - tmpTask->next->prev = tmpTask->prev; - if (taskList == tmpTask) - taskList = tmpTask->next; - - return(0x0); - } - } - return(0x1); + if (tmpTask->id == id) { + if (tmpTask->prev != 0x0) + tmpTask->prev->next = tmpTask->next; + if (tmpTask->next != 0x0) + tmpTask->next->prev = tmpTask->prev; + if (taskList == tmpTask) + taskList = tmpTask->next; + + return (0x0); + } } - -int sched_addDelTask(kTask_t *tmpTask) { + return (0x1); +} + +int sched_addDelTask(kTask_t *tmpTask) { tmpTask->next = delList; tmpTask->prev = 0x0; if (delList != 0x0) delList->prev = tmpTask; - delList = tmpTask; - return(0x0); - } - -kTask_t *sched_getDelTask() { - kTask_t *tmpTask = 0x0; - - if (delList == 0x0) - return(0x0); - - tmpTask = delList; - delList = delList->next; - return(tmpTask); - } - - -kTask_t * -schedFindTask(uInt32 id) -{ - kTask_t *tmpTask = 0x0; - - for (tmpTask = taskList; tmpTask; tmpTask = tmpTask->next) { - if (tmpTask->id == id) - return(tmpTask); - } - - return(0x0); + delList = tmpTask; + return (0x0); } +kTask_t *sched_getDelTask() { + kTask_t *tmpTask = 0x0; + + if (delList == 0x0) + return (0x0); + + tmpTask = delList; + delList = delList->next; + return (tmpTask); +} + +kTask_t * +schedFindTask(uInt32 id) { + kTask_t *tmpTask = 0x0; + + for (tmpTask = taskList; tmpTask; tmpTask = tmpTask->next) { + if (tmpTask->id == id) + return (tmpTask); + } + + return (0x0); +} /************************************************************************ @@ -234,57 +223,55 @@ Notes: - 02/20/2004 - Approved for quality + 02/20/2004 - Approved for quality -************************************************************************/ -void -schedEndTask(pidType pid) { - endTask(_current->id); - sched_yield(); + ************************************************************************/ +void schedEndTask(pidType pid) { + endTask(_current->id); + sched_yield(); } /************************************************************************ -Function: int schedEndTask() + Function: int schedEndTask() -Description: This function will yield a task + Description: This function will yield a task -Notes: + Notes: -02/20/2004 - Approved for quality + 02/20/2004 - Approved for quality -************************************************************************/ + ************************************************************************/ -void -sched_yield() { +void sched_yield() { sched(); - } +} /* -asm( - ".globl sched_yield \n" - "sched_yield: \n" - " cli \n" - " call sched \n" - ); -*/ + asm( + ".globl sched_yield \n" + "sched_yield: \n" + " cli \n" + " call sched \n" + ); + */ /************************************************************************ -Function: int sched_setStatus(pidType pid,tState state) + Function: int sched_setStatus(pidType pid,tState state) -Description: Change the tasks status + Description: Change the tasks status -Notes: + Notes: -************************************************************************/ -int sched_setStatus(pidType pid,tState state) { + ************************************************************************/ +int sched_setStatus(pidType pid, tState state) { kTask_t *tmpTask = schedFindTask(pid); if (tmpTask == 0x0) - return(0x1); + return (0x1); tmpTask->state = state; - return(0x0); - } + return (0x0); +} /*** END diff --git a/sys/armv6/schedyield.S b/sys/armv6/schedyield.S index b04277e..1072793 100644 --- a/sys/armv6/schedyield.S +++ b/sys/armv6/schedyield.S @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: schedyield.S 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ .globl sched_yield_new .text diff --git a/sys/armv6/spinlock.c b/sys/armv6/spinlock.c index 7d36549..790d1fb 100644 --- a/sys/armv6/spinlock.c +++ b/sys/armv6/spinlock.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: spinlock.c 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include diff --git a/sys/armv6/sys_call.S b/sys/armv6/sys_call.S index 3540601..b4a557e 100644 --- a/sys/armv6/sys_call.S +++ b/sys/armv6/sys_call.S @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: sys_call.S 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ .globl _sysCall .text diff --git a/sys/armv6/sys_call_new.S b/sys/armv6/sys_call_new.S index 02169e3..2f73600 100644 --- a/sys/armv6/sys_call_new.S +++ b/sys/armv6/sys_call_new.S @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: sys_call_new.S 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ +/*- + * 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 FAKE_MCOUNT(caller) pushl caller ; call __mcount ; popl %ecx diff --git a/sys/armv6/syscall.c b/sys/armv6/syscall.c index f70a614..b371ff5 100644 --- a/sys/armv6/syscall.c +++ b/sys/armv6/syscall.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: syscall.c 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include diff --git a/sys/armv6/systemtask.c b/sys/armv6/systemtask.c index 0d60881..10fe017 100644 --- a/sys/armv6/systemtask.c +++ b/sys/armv6/systemtask.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: systemtask.c 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include diff --git a/sys/armv6/timer.S b/sys/armv6/timer.S index d06e868..c7aa642 100644 --- a/sys/armv6/timer.S +++ b/sys/armv6/timer.S @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: timer.S 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ .globl timerInt .text diff --git a/sys/fs/devfs/devfs.c b/sys/fs/devfs/devfs.c index 4c8c50d..8c1998f 100644 --- a/sys/fs/devfs/devfs.c +++ b/sys/fs/devfs/devfs.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - Copyright (c) 2002-2004, 2016 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: devfs.c 169 2016-01-20 01:10:22Z reddawg $ - - *****************************************************************************************/ +/*- + * 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. + */ #include #include @@ -46,12 +45,12 @@ This is the initialized called by the vfs system when enabling devfs basically it allocates memory for the devfs module */ -static void devfs_initialize( struct vfs_mountPoint *mp ) { +static void devfs_initialize(struct vfs_mountPoint *mp) { struct devfs_info *fsInfo = 0x0; /* Allocate memory for the fsInfo */ - if ( (mp->fsInfo = (struct devfs_info *) kmalloc( sizeof(struct devfs_info) )) == 0x0 ) - K_PANIC( "devfs: failed to allocate memor\n" ); + if ((mp->fsInfo = (struct devfs_info *) kmalloc(sizeof(struct devfs_info))) == 0x0) + K_PANIC("devfs: failed to allocate memor\n"); fsInfo = mp->fsInfo; fsInfo->deviceList = 0x0; @@ -67,41 +66,41 @@ This format will be changing down the road */ -static int devfs_open( char *file, fileDescriptor *fd ) { +static int devfs_open(char *file, fileDescriptor *fd) { struct devfs_info *fsInfo = fd->mp->fsInfo; struct devfs_devices *tmpDev = 0x0; struct device_node *device = 0x0; - spinLock( &devfsSpinLock ); + spinLock(&devfsSpinLock); - if ( strcmp( file, "/" ) == 0x0 ) { + if (strcmp(file, "/") == 0x0) { fd->start = -1; fd->size = devfs_len; - spinUnlock( &devfsSpinLock ); + spinUnlock(&devfsSpinLock); return (0x1); } - if ( file[0] == '/' ) + if (file[0] == '/') file++; - for ( tmpDev = fsInfo->deviceList; tmpDev != 0x0; tmpDev = tmpDev->next ) { - if ( strcmp( tmpDev->devName, file ) == 0x0 ) { - switch ( (fd->mode & 0x3) ) { + for (tmpDev = fsInfo->deviceList; tmpDev != 0x0; tmpDev = tmpDev->next) { + if (strcmp(tmpDev->devName, file) == 0x0) { + switch ((fd->mode & 0x3)) { case 0: - case 1: - device = device_find( tmpDev->devMajor, tmpDev->devMinor ); + case 1: + device = device_find(tmpDev->devMajor, tmpDev->devMinor); fd->start = (uint32_t *) tmpDev; /* MrOlsen (2016-01-19) FIX: I Don't Understand This */ fd->size = device->devInfo->size; - break; + break; default: - kprintf( "Invalid File Mode\n" ); - spinUnlock( &devfsSpinLock ); + kprintf("Invalid File Mode\n"); + spinUnlock(&devfsSpinLock); return (-1); - break; + break; } - spinUnlock( &devfsSpinLock ); + spinUnlock(&devfsSpinLock); return (0x1); } } - spinUnlock( &devfsSpinLock ); + spinUnlock(&devfsSpinLock); return (0x0); } @@ -110,16 +109,16 @@ Description: Read File Into Data Notes: */ -static int devfs_read( fileDescriptor *fd, char *data, long offset, long size ) { +static int devfs_read(fileDescriptor *fd, char *data, long offset, long size) { int i = 0x0, x = 0x0; uInt32 sectors = 0x0; uInt16 diff = 0x0; struct device_node *device = 0x0; struct devfs_devices *tmpDev = (void *) fd->start; - if ( tmpDev == -1 ) { - kprintf( "Hi Ubie [%i]!!!\n", size ); - for ( i = 0; i < size; i++ ) { + if (tmpDev == -1) { + kprintf("Hi Ubie [%i]!!!\n", size); + for (i = 0; i < size; i++) { data[i] = 'a'; fd->buffer[i] = 'a'; } @@ -127,15 +126,15 @@ return (size); } - device = device_find( tmpDev->devMajor, tmpDev->devMinor ); + device = device_find(tmpDev->devMajor, tmpDev->devMinor); sectors = ((size + 511) / 512); diff = (offset - ((offset / 512) * 512)); - for ( i = 0x0; i < sectors; i++ ) { - device->devInfo->read( device->devInfo->info, fd->buffer, i + (offset / 512), 1 ); - for ( x = 0x0; x < (size - (i * 512)); x++ ) { - if ( diff > 0 ) { + for (i = 0x0; i < sectors; i++) { + device->devInfo->read(device->devInfo->info, fd->buffer, i + (offset / 512), 1); + for (x = 0x0; x < (size - (i * 512)); x++) { + if (diff > 0) { data[x] = fd->buffer[x + diff]; } else { @@ -156,87 +155,82 @@ Notes: ************************************************************************/ -static int devfs_write( fileDescriptor *fd, char *data, long offset, long size ) { +static int devfs_write(fileDescriptor *fd, char *data, long offset, long size) { int i = 0x0, x = 0x0; struct device_node *device = 0x0; struct devfs_devices *tmpDev = (void *) fd->start; - device = device_find( tmpDev->devMajor, tmpDev->devMinor ); - for ( i = 0x0; i < ((size + 511) / 512); i++ ) { - device->devInfo->read( device->devInfo->info, fd->buffer, i + (offset / 512), 1 ); - for ( x = 0x0; ((x < 512) && ((x + (i * 512)) < size)); x++ ) { + device = device_find(tmpDev->devMajor, tmpDev->devMinor); + for (i = 0x0; i < ((size + 511) / 512); i++) { + device->devInfo->read(device->devInfo->info, fd->buffer, i + (offset / 512), 1); + for (x = 0x0; ((x < 512) && ((x + (i * 512)) < size)); x++) { fd->buffer[x] = data[x]; } - device->devInfo->write( device->devInfo->info, fd->buffer, i + (offset / 512), 1 ); + device->devInfo->write(device->devInfo->info, fd->buffer, i + (offset / 512), 1); data += 512; } return (size); } -int devfs_makeNode( char *name, uInt8 type, uInt16 major, uInt16 minor ) { +int devfs_makeNode(char *name, uInt8 type, uInt16 major, uInt16 minor) { struct vfs_mountPoint *mp = 0x0; struct devfs_info *fsInfo = 0x0; struct devfs_devices *tmpDev = 0x0; - spinLock( &devfsSpinLock ); + spinLock(&devfsSpinLock); - mp = vfs_findMount( "devfs" ); + mp = vfs_findMount("devfs"); - if ( mp == 0x0 ) { - kprintf( "Error: Can't Find Mount Point\n" ); - spinUnlock( &devfsSpinLock ); + if (mp == 0x0) { + kprintf("Error: Can't Find Mount Point\n"); + spinUnlock(&devfsSpinLock); return (-1); } fsInfo = mp->fsInfo; - tmpDev = (struct devfs_devices *) kmalloc( sizeof(struct devfs_devices) ); + tmpDev = (struct devfs_devices *) kmalloc(sizeof(struct devfs_devices)); tmpDev->devType = type; tmpDev->devMajor = major; tmpDev->devMinor = minor; - sprintf( tmpDev->devName, name ); - devfs_len += strlen( name ) + 1; + sprintf(tmpDev->devName, name); + devfs_len += strlen(name) + 1; tmpDev->next = fsInfo->deviceList; tmpDev->prev = 0x0; - if ( fsInfo->deviceList != 0x0 ) { + if (fsInfo->deviceList != 0x0) { fsInfo->deviceList->prev = tmpDev; } fsInfo->deviceList = tmpDev; - spinUnlock( &devfsSpinLock ); + spinUnlock(&devfsSpinLock); return (0x0); } int devfs_init() { /* Build our devfs struct */ - struct fileSystem devFS = - { NULL, /* prev */ - NULL, /* next */ - (void *) devfs_initialize, /* vfsInitFS */ - (void *) devfs_read, /* vfsRead */ - (void *) devfs_write, /* vfsWrite */ - (void *) devfs_open, /* vfsOpenFile */ - NULL, /* vfsUnlink */ - NULL, /* vfsMakeDir */ - NULL, /* vfsRemDir */ - NULL, /* vfsSync */ - 1 /* vfsType */ - }; /* devFS */ + struct fileSystem devFS = { NULL, /* prev */ + NULL, /* next */ + (void *) devfs_initialize, /* vfsInitFS */ + (void *) devfs_read, /* vfsRead */ + (void *) devfs_write, /* vfsWrite */ + (void *) devfs_open, /* vfsOpenFile */ + NULL, /* vfsUnlink */ + NULL, /* vfsMakeDir */ + NULL, /* vfsRemDir */ + NULL, /* vfsSync */ + 1 /* vfsType */ + }; /* devFS */ - if ( vfsRegisterFS( devFS ) != 0x0 ) { + if (vfsRegisterFS(devFS) != 0x0) { //sysErr(systemErr,"Unable To Enable DevFS"); return (0x1); } /* Mount our devfs this will build the devfs container node */ - vfs_mount( 0x0, 0x0, 0x0, 0x1, "devfs", "rw" ); // Mount Device File System + vfs_mount(0x0, 0x0, 0x0, 0x1, "devfs", "rw"); // Mount Device File System /* Return */ return (0x0); } - -/*** - END - ***/ diff --git a/sys/fs/vfs/file.c b/sys/fs/vfs/file.c index 43b70ce..70f454c 100644 --- a/sys/fs/vfs/file.c +++ b/sys/fs/vfs/file.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - Copyright (c) 2002, 2016 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: file.c 169 2016-01-20 01:10:22Z reddawg $ - - *****************************************************************************************/ +/*- + * 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. + */ #include #include diff --git a/sys/fs/vfs/inode.c b/sys/fs/vfs/inode.c index ac3cd8d..536a946 100644 --- a/sys/fs/vfs/inode.c +++ b/sys/fs/vfs/inode.c @@ -1,3 +1,31 @@ +/*- + * 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. + */ + #include #include #include diff --git a/sys/fs/vfs/mount.c b/sys/fs/vfs/mount.c index 4fc23cc..a62aef8 100644 --- a/sys/fs/vfs/mount.c +++ b/sys/fs/vfs/mount.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: mount.c 169 2016-01-20 01:10:22Z reddawg $ - - *****************************************************************************************/ +/*- + * 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. + */ #include #include diff --git a/sys/fs/vfs/namei.c b/sys/fs/vfs/namei.c index 54c57b3..15ed3c7 100644 --- a/sys/fs/vfs/namei.c +++ b/sys/fs/vfs/namei.c @@ -1,3 +1,31 @@ +/*- + * 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. + */ + #include #include #include diff --git a/sys/fs/vfs/stat.c b/sys/fs/vfs/stat.c index 83d74f2..61bec34 100644 --- a/sys/fs/vfs/stat.c +++ b/sys/fs/vfs/stat.c @@ -1,3 +1,31 @@ +/*- + * 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. + */ + #include #include #include diff --git a/sys/fs/vfs/vfs.c b/sys/fs/vfs/vfs.c index 7c971ca..dcd50fd 100644 --- a/sys/fs/vfs/vfs.c +++ b/sys/fs/vfs/vfs.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: vfs.c 158 2016-01-19 02:08:13Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include diff --git a/sys/i386/ap-boot.S b/sys/i386/ap-boot.S index 2645aff..c08bd1e 100644 --- a/sys/i386/ap-boot.S +++ b/sys/i386/ap-boot.S @@ -1,3 +1,31 @@ +/*- + * 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. + */ + /* * Okay, this file contains the code that's going to bootstrap the AP cpus */ diff --git a/sys/i386/bioscall.c b/sys/i386/bioscall.c index d0301de..bd4d4e5 100644 --- a/sys/i386/bioscall.c +++ b/sys/i386/bioscall.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: bioscall.c 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include @@ -36,7 +35,6 @@ #include #include - asm( ".globl bios16Code\n" // ".code16 \n" @@ -44,57 +42,56 @@ "int $0x10 \n" "int $0x69 \n" // ".code32 \n" - ); +); - -void biosCall(int biosInt,int eax,int ebx,int ecx,int edx,int esi,int edi,int es,int ds) { - short segment = 0x0,offset = 0x0; - uInt32 tmpAddr = (uInt32)&bios16Code; +void biosCall(int biosInt, int eax, int ebx, int ecx, int edx, int esi, int edi, int es, int ds) { + short segment = 0x0, offset = 0x0; + uInt32 tmpAddr = (uInt32) &bios16Code; kTask_t *newProcess = 0x0; offset = tmpAddr & 0xF; // lower 4 bits segment = tmpAddr >> 4; - + newProcess = schedNewTask(); assert(newProcess); - - newProcess->tss.back_link = 0x0; - newProcess->tss.esp0 = (uInt32)kmalloc(0x2000)+0x2000; - newProcess->tss.ss0 = 0x10; - newProcess->tss.esp1 = 0x0; - newProcess->tss.ss1 = 0x0; - newProcess->tss.esp2 = 0x0; - newProcess->tss.ss2 = 0x0; - newProcess->tss.cr3 = (uInt32)_current->tss.cr3;//(uInt32)vmmCreateVirtualSpace(newProcess->id); - newProcess->tss.eip = offset & 0xFFFF; - newProcess->tss.eflags = 2 | EFLAG_IF | EFLAG_VM; - newProcess->tss.eax = eax & 0xFFFF; - newProcess->tss.ebx = ebx & 0xFFFF; - newProcess->tss.ecx = ecx & 0xFFFF; - newProcess->tss.edx = edx & 0xFFFF; - newProcess->tss.esp = 0x1000 & 0xFFFF; - newProcess->tss.ebp = 0x1000 & 0xFFFF; - newProcess->tss.esi = esi & 0xFFFF; - newProcess->tss.edi = edi & 0xFFFF; - newProcess->tss.es = es & 0xFFFF; - newProcess->tss.cs = segment & 0xFFFF; - newProcess->tss.ss = 0x1000 & 0xFFFF; - newProcess->tss.ds = ds & 0xFFFF; - newProcess->tss.fs = 0x0 & 0xFFFF; - newProcess->tss.gs = 0x0 & 0xFFFF; - newProcess->tss.ldt = 0x0 & 0xFFFF; - newProcess->tss.trace_bitmap = 0x0 & 0xFFFF; - newProcess->tss.io_map = 0x0 & 0xFFFF; - newProcess->tss.io_map = sizeof(struct tssStruct)-8192; - newProcess->oInfo.v86Task = 0x1; + newProcess->tss.back_link = 0x0; + newProcess->tss.esp0 = (uInt32) kmalloc(0x2000) + 0x2000; + newProcess->tss.ss0 = 0x10; + newProcess->tss.esp1 = 0x0; + newProcess->tss.ss1 = 0x0; + newProcess->tss.esp2 = 0x0; + newProcess->tss.ss2 = 0x0; + newProcess->tss.cr3 = (uInt32) _current->tss.cr3; //(uInt32)vmmCreateVirtualSpace(newProcess->id); + newProcess->tss.eip = offset & 0xFFFF; + newProcess->tss.eflags = 2 | EFLAG_IF | EFLAG_VM; + newProcess->tss.eax = eax & 0xFFFF; + newProcess->tss.ebx = ebx & 0xFFFF; + newProcess->tss.ecx = ecx & 0xFFFF; + newProcess->tss.edx = edx & 0xFFFF; + newProcess->tss.esp = 0x1000 & 0xFFFF; + newProcess->tss.ebp = 0x1000 & 0xFFFF; + newProcess->tss.esi = esi & 0xFFFF; + newProcess->tss.edi = edi & 0xFFFF; + newProcess->tss.es = es & 0xFFFF; + newProcess->tss.cs = segment & 0xFFFF; + newProcess->tss.ss = 0x1000 & 0xFFFF; + newProcess->tss.ds = ds & 0xFFFF; + newProcess->tss.fs = 0x0 & 0xFFFF; + newProcess->tss.gs = 0x0 & 0xFFFF; + newProcess->tss.ldt = 0x0 & 0xFFFF; + newProcess->tss.trace_bitmap = 0x0 & 0xFFFF; + newProcess->tss.io_map = 0x0 & 0xFFFF; + newProcess->tss.io_map = sizeof(struct tssStruct) - 8192; + newProcess->oInfo.v86Task = 0x1; newProcess->state = READY; - while (newProcess->state > 0); + while (newProcess->state > 0) + ; return; - } +} /*** END diff --git a/sys/i386/cpu.c b/sys/i386/cpu.c index 21f2667..ef9e0c0 100644 --- a/sys/i386/cpu.c +++ b/sys/i386/cpu.c @@ -1,30 +1,29 @@ -/***************************************************************************************** - Copyright (c) 2002-2004, 2016 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: cpu.c 89 2016-01-12 00:20:40Z reddawg $ - - *****************************************************************************************/ +/*- + * 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. + */ #include diff --git a/sys/i386/fork.c b/sys/i386/fork.c index 54541ed..1b090e2 100644 --- a/sys/i386/fork.c +++ b/sys/i386/fork.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: fork.c 184 2016-01-23 01:38:22Z reddawg $ - - *****************************************************************************************/ +/*- + * 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. + */ #include #include @@ -37,7 +36,7 @@ #include #include -int sys_fork( struct thread *td, struct sys_fork_args *args ) { +int sys_fork(struct thread *td, struct sys_fork_args *args) { struct taskStruct *newProcess; newProcess = schedNewTask(); @@ -49,7 +48,7 @@ */ /* Set CWD */ - memcpy( newProcess->oInfo.cwd, _current->oInfo.cwd, 1024 ); + memcpy(newProcess->oInfo.cwd, _current->oInfo.cwd, 1024); /* Set Up Task State */ newProcess->tss.eip = td->frame->tf_eip; @@ -89,19 +88,19 @@ newProcess->td.vm_dsize = _current->td.vm_dsize; newProcess->td.vm_daddr = _current->td.vm_daddr; - kprintf( "Copying Mem Space! [0x%X:0x%X:0x%X:0x%X:0x%X:%i:%i]\n", newProcess->tss.esp0, newProcess->tss.esp, newProcess->tss.ebp, td->frame->tf_esi, td->frame->tf_eip, newProcess->id, _current->id ); + kprintf("Copying Mem Space! [0x%X:0x%X:0x%X:0x%X:0x%X:%i:%i]\n", newProcess->tss.esp0, newProcess->tss.esp, newProcess->tss.ebp, td->frame->tf_esi, td->frame->tf_eip, newProcess->id, _current->id); - newProcess->tss.cr3 = (uInt32) vmm_copyVirtualSpace( newProcess->id ); + newProcess->tss.cr3 = (uInt32) vmm_copyVirtualSpace(newProcess->id); //kprintf( "Copied Mem Space!\n" ); newProcess->state = FORK; /* Fix gcc optimization problems */ - while ( newProcess->state == FORK ) + while (newProcess->state == FORK) sched_yield(); /* Return Id of Proccess */ - kprintf("Returning! [%i][0x%X]\n", _current->id,newProcess->tss.cr3); + kprintf("Returning! [%i][0x%X]\n", _current->id, newProcess->tss.cr3); return (newProcess->id); } @@ -118,13 +117,13 @@ *****************************************************************************************/ /* Had to remove static though tihs function is only used in this file */ -int fork_copyProcess( struct taskStruct *newProcess, long ebp, long edi, long esi, long none, long ebx, long ecx, long edx, long eip, long cs, long eflags, long esp, long ss ) { +int fork_copyProcess(struct taskStruct *newProcess, long ebp, long edi, long esi, long none, long ebx, long ecx, long edx, long eip, long cs, long eflags, long esp, long ss) { volatile struct taskStruct * tmpProcPtr = newProcess; - assert( newProcess ); - assert (_current); + assert(newProcess); + assert(_current); /* Set Up New Tasks Information */ - memcpy( newProcess->oInfo.cwd, _current->oInfo.cwd, 1024 ); + memcpy(newProcess->oInfo.cwd, _current->oInfo.cwd, 1024); //kprintf( "Initializing New CWD!\n" ); newProcess->tss.eip = eip; @@ -165,22 +164,22 @@ newProcess->td.vm_daddr = _current->td.vm_daddr; /* Create A Copy Of The VM Space For New Task */ - kprintf( "Copying Mem Space! [0x%X:0x%X:0x%X:0x%X:0x%X:%i:%i:0x%X]\n", newProcess->tss.esp0, newProcess->tss.esp, newProcess->tss.ebp, esi, eip, newProcess->id, _current->id, newProcess->td.vm_daddr ); - newProcess->tss.cr3 = (uInt32) vmm_copyVirtualSpace( newProcess->id ); + kprintf("Copying Mem Space! [0x%X:0x%X:0x%X:0x%X:0x%X:%i:%i:0x%X]\n", newProcess->tss.esp0, newProcess->tss.esp, newProcess->tss.ebp, esi, eip, newProcess->id, _current->id, newProcess->td.vm_daddr); + newProcess->tss.cr3 = (uInt32) vmm_copyVirtualSpace(newProcess->id); //kprintf( "Copied Mem Space!\n" ); newProcess->state = FORK; /* Fix gcc optimization problems */ - while ( tmpProcPtr->state == FORK ) + while (tmpProcPtr->state == FORK) sched_yield(); /* Return Id of Proccess */ - kprintf( "Returning! [%i]", _current->id ); + kprintf("Returning! [%i]", _current->id); return (newProcess->id); } void qT() { - kprintf( "qT\n" ); + kprintf("qT\n"); } /***************************************************************************************** @@ -197,21 +196,21 @@ *****************************************************************************************/ //asm volatile( __asm( - ".globl sysFork_old \n" - "sysFork_old: \n" - " xor %eax,%eax \n" - " call schedNewTask \n" - " testl %eax,%eax \n" - " je fork_ret \n" - " pushl %esi \n" - " pushl %edi \n" - " pushl %ebp \n" - " pushl %eax \n" - " call fork_copyProcess \n" - " movl %eax,(%ebx) \n" - " addl $16,%esp \n" - "fork_ret: \n" - " ret \n" + ".globl sysFork_old \n" + "sysFork_old: \n" + " xor %eax,%eax \n" + " call schedNewTask \n" + " testl %eax,%eax \n" + " je fork_ret \n" + " pushl %esi \n" + " pushl %edi \n" + " pushl %ebp \n" + " pushl %eax \n" + " call fork_copyProcess \n" + " movl %eax,(%ebx) \n" + " addl $16,%esp \n" + "fork_ret: \n" + " ret \n" ); /*** diff --git a/sys/i386/i386_exec.c b/sys/i386/i386_exec.c index acf61b1..94c42cd 100644 --- a/sys/i386/i386_exec.c +++ b/sys/i386/i386_exec.c @@ -1,27 +1,29 @@ /*- - * Copyright (c) 2002-2004, 2016, 2018 The UbixOS Project + * 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: + * This was developed by Christopher W. Olsen for the UbixOS Project. * - * 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. + * 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 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. + * 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. */ #include @@ -81,9 +83,9 @@ int argc = argv_count(argv_in); - uint32_t *argv_tmp = (uint32_t *)kmalloc(sizeof(char *) * (argc + 2)); // + 1 For ARGC + 1 For NULL TERM + uint32_t *argv_tmp = (uint32_t *) kmalloc(sizeof(char *) * (argc + 2)); // + 1 For ARGC + 1 For NULL TERM - char *args_tmp = (char *)kmalloc(ARGV_PAGE); + char *args_tmp = (char *) kmalloc(ARGV_PAGE); argv_tmp[0] = argc; @@ -91,7 +93,7 @@ int i = 0x0; - for (i = 1; i <=argc; i++) { + for (i = 1; i <= argc; i++) { argv_tmp[i] = args_tmp + sp; strcpy(argv_tmp[i], argv_in[i - 1]); sp += strlen(argv_in[i - 1]) + 1; @@ -102,7 +104,7 @@ *argv_out = argv_tmp; *args_out = args_tmp; - return(0); + return (0); } @@ -110,9 +112,9 @@ int envc = envp_count(envp_in); - uint32_t *envp_tmp = (uint32_t *)kmalloc(sizeof(char *) * (envc + 1)); // + 1 For NULL TERM + uint32_t *envp_tmp = (uint32_t *) kmalloc(sizeof(char *) * (envc + 1)); // + 1 For NULL TERM - char *envs_tmp = (char *)kmalloc(ENVP_PAGE); + char *envs_tmp = (char *) kmalloc(ENVP_PAGE); uint32_t sp = 0x0; @@ -127,7 +129,7 @@ *envp_out = envp_tmp; *envs_out = envs_tmp; - return(0); + return (0); } static int elf_parse_dynamic(elf_file_t ef); @@ -422,7 +424,7 @@ for (i = 1; i <= argc; i++) { tmp[i] = STACK_ADDR - ARGV_PAGE + sp; - strcpy((char *)tmp[i], argv[i - 1]); + strcpy((char *) tmp[i], argv[i - 1]); sp += strlen(argv[i - 1]) + 1; } tmp[i++] = 0x0; @@ -430,7 +432,7 @@ sp = 0; for (int x = 0; x < envc; x++) { tmp[x + i] = STACK_ADDR - ARGV_PAGE - ENVP_PAGE + sp; - strcpy((char *)tmp[x + i], envp[x]); + strcpy((char *) tmp[x + i], envp[x]); sp += strlen(envp[x]) + 1; } tmp[i + x] = 0x0; @@ -662,9 +664,9 @@ break; case PT_GNU_STACK: asm("nop"); - break; + break; default: - break; + break; } } @@ -696,9 +698,9 @@ //iFrame->edx = 0x0; - iFrame->user_esp = (uint32_t)STACK_ADDR - ARGV_PAGE - ENVP_PAGE - ELF_AUX - (argc + 1) - (envc + 1) - STACK_PAD; + iFrame->user_esp = (uint32_t) STACK_ADDR - ARGV_PAGE - ENVP_PAGE - ELF_AUX - (argc + 1) - (envc + 1) - STACK_PAD; - tmp = (uint32_t *)iFrame->user_esp; + tmp = (uint32_t *) iFrame->user_esp; memset((char *) tmp, 0x0, ARGV_PAGE + ENVP_PAGE + ELF_AUX + (argc + 1) + (envc + 1) + STACK_PAD); @@ -707,55 +709,55 @@ uint32_t sp = 0x0; for (i = 1; i <= argc; i++) { - tmp[i] = (uint32_t)STACK_ADDR - ARGV_PAGE + sp; - strcpy((char *)tmp[i], (char *)argv_out[i]); + tmp[i] = (uint32_t) STACK_ADDR - ARGV_PAGE + sp; + strcpy((char *) tmp[i], (char *) argv_out[i]); sp += strlen(argv_out[i]) + 1; } - tmp[i++] = (char *)0x0; + tmp[i++] = (char *) 0x0; kfree(argv_out); kfree(args_out); sp = 0; - + x = 0; for (x = 0; x < envc; x++) { - tmp[x + i] = (uint32_t)STACK_ADDR - ARGV_PAGE - ENVP_PAGE + sp; - strcpy((char *)tmp[x + i], (char *)envp_out[x]); + tmp[x + i] = (uint32_t) STACK_ADDR - ARGV_PAGE - ENVP_PAGE + sp; + strcpy((char *) tmp[x + i], (char *) envp_out[x]); sp += strlen(envp_out[x]) + 1; } - tmp[i + x] = (char *)0x0; + tmp[i + x] = (char *) 0x0; kfree(envp_out); kfree(envs_out); - i = i+ x + 1; + i = i + x + 1; tmp[i++] = 2; - tmp[i++] = -1;// _current->imageFd; - kprintf("AT_EXECFD: [%i]", tmp[i-1]); + tmp[i++] = -1; // _current->imageFd; + kprintf("AT_EXECFD: [%i]", tmp[i - 1]); tmp[i++] = 3; tmp[i++] = binaryHeader->e_phoff + 0x08048000; - kprintf("AT_PHDR: [0x%X]", tmp[i-1]); + kprintf("AT_PHDR: [0x%X]", tmp[i - 1]); tmp[i++] = 4; tmp[i++] = binaryHeader->e_phentsize; - kprintf("AT_PHENT: [0x%X]", tmp[i-1]); - + kprintf("AT_PHENT: [0x%X]", tmp[i - 1]); + tmp[i++] = 5; tmp[i++] = binaryHeader->e_phnum; - kprintf("AT_PHNUM: [0x%X]", tmp[i-1]); + kprintf("AT_PHNUM: [0x%X]", tmp[i - 1]); tmp[i++] = 6; tmp[i++] = 0x1000; tmp[i++] = 7; - tmp[i++] = 0x0;//LD_START; - kprintf("AT_BASE: [0x%X]", tmp[i-1]); + tmp[i++] = 0x0; //LD_START; + kprintf("AT_BASE: [0x%X]", tmp[i - 1]); tmp[i++] = 8; tmp[i++] = 0x0; @@ -778,14 +780,12 @@ tmp[i++] = 0; tmp[i++] = 0; - /* Now That We Relocated The Binary We Can Unmap And Free Header Info */ kfree(binaryHeader); kfree(programHeader); //irqEnable(0); //asm("sti"); - /* _current->tss.es = 0x30 + 3; _current->tss.cs = 0x28 + 3; @@ -889,10 +889,10 @@ case DT_PLTGOT: ef->got = (Elf_Addr *) (ef->address + dynp->d_un.d_ptr); /* - tmp = (void *) dynp->d_un.d_ptr; //elfDynamicS[i].dynPtr; - tmp[2] = (uInt32) ef->ld_addr; - tmp[1] = (uInt32) ef; //0x0;//0xBEEFEAD;//STACK_ADDR - 128;//_current->imageFd;//0xBEEFDEAD;//ef; - */ + tmp = (void *) dynp->d_un.d_ptr; //elfDynamicS[i].dynPtr; + tmp[2] = (uInt32) ef->ld_addr; + tmp[1] = (uInt32) ef; //0x0;//0xBEEFEAD;//STACK_ADDR - 128;//_current->imageFd;//0xBEEFDEAD;//ef; + */ break; default: asm("nop"); @@ -902,10 +902,10 @@ } if (plttype == DT_RELA) { - ef->pltrela = (const Elf_Rela *) ef->pltrel; - ef->pltrel = NULL; - ef->pltrelasize = ef->pltrelsize; - ef->pltrelsize = 0; + ef->pltrela = (const Elf_Rela *) ef->pltrel; + ef->pltrel = NULL; + ef->pltrelasize = ef->pltrelsize; + ef->pltrelsize = 0; } ef->ddbsymtab = ef->symtab; diff --git a/sys/i386/kpanic.c b/sys/i386/kpanic.c index b02cc20..4b6ce22 100644 --- a/sys/i386/kpanic.c +++ b/sys/i386/kpanic.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: kpanic.c 79 2016-01-11 16:21:27Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include @@ -40,7 +39,7 @@ * */ void kpanic(const char *fmt, ...) { - char buf[512]; + char buf[512]; va_list args; va_start(args, fmt); diff --git a/sys/i386/sched.c b/sys/i386/sched.c index 9488039..a79d522 100644 --- a/sys/i386/sched.c +++ b/sys/i386/sched.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: sched.c 164 2016-01-20 00:04:02Z reddawg $ - - *****************************************************************************************/ +/*- + * 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. + */ #include #include @@ -71,14 +70,14 @@ ************************************************************************/ int sched_init() { - taskList = (kTask_t *) kmalloc( sizeof(kTask_t) ); - if ( taskList == 0x0 ) - kpanic( "Unable to create task list" ); + taskList = (kTask_t *) kmalloc(sizeof(kTask_t)); + if (taskList == 0x0) + kpanic("Unable to create task list"); taskList->id = nextID++; /* Print out information on scheduler */ - kprintf( "sched0 - Address: [0x%X]\n", taskList ); + kprintf("sched0 - Address: [0x%X]\n", taskList); /* Return so we know everything went well */ return (0x0); @@ -89,7 +88,7 @@ kTask_t *tmpTask = 0x0; kTask_t *delTask = 0x0; - if ( spinTryLock( &schedulerSpinLock ) ) + if (spinTryLock(&schedulerSpinLock)) return; tmpTask = _current->next; @@ -97,56 +96,56 @@ schedStart: /* Yield the next task from the current prio queue */ - for ( ; tmpTask != 0x0; tmpTask = tmpTask->next ) { - if ( tmpTask->state > 0x0 ) { + for (; tmpTask != 0x0; tmpTask = tmpTask->next) { + if (tmpTask->state > 0x0) { _current = tmpTask; - if ( _current->state == FORK ) + if (_current->state == FORK) _current->state = READY; break; } - else if ( tmpTask->state == DEAD ) { + else if (tmpTask->state == DEAD) { delTask = tmpTask; tmpTask = tmpTask->next; - sched_deleteTask( delTask->id ); - sched_addDelTask( delTask ); + sched_deleteTask(delTask->id); + sched_addDelTask(delTask); goto schedStart; } } /* Finished all the tasks, restarting the list */ - if ( 0x0 == tmpTask ) { + if (0x0 == tmpTask) { tmpTask = taskList; goto schedStart; } - if ( _current->state > 0x0 ) { + if (_current->state > 0x0) { - if ( _current->oInfo.v86Task == 0x1 ) - irqDisable( 0x0 ); + if (_current->oInfo.v86Task == 0x1) + irqDisable(0x0); asm("cli"); - memAddr = (uint32_t) & (_current->tss); + memAddr = (uint32_t) &(_current->tss); ubixGDT[4].descriptor.baseLow = (memAddr & 0xFFFF); ubixGDT[4].descriptor.baseMed = ((memAddr >> 16) & 0xFF); ubixGDT[4].descriptor.baseHigh = (memAddr >> 24); ubixGDT[4].descriptor.access = '\x89'; - // memAddr = STACK_ADDR; //(uint32_t) & (_current->tss); + // memAddr = STACK_ADDR; //(uint32_t) & (_current->tss); ubixGDT[10].descriptor.baseLow = (STACK_ADDR & 0xFFFF); ubixGDT[10].descriptor.baseMed = ((STACK_ADDR >> 16) & 0xFF); ubixGDT[10].descriptor.baseHigh = (STACK_ADDR >> 24); -/* - ubixGDT[10].descriptor.access = '\x89'; -*/ + /* + ubixGDT[10].descriptor.access = '\x89'; + */ - spinUnlock( &schedulerSpinLock ); + spinUnlock(&schedulerSpinLock); asm("sti"); asm("ljmp $0x20,$0\n"); } else { - spinUnlock( &schedulerSpinLock ); + spinUnlock(&schedulerSpinLock); } return; @@ -155,14 +154,14 @@ kTask_t *schedNewTask() { int i = 0; - kTask_t *tmpTask = (kTask_t *) kmalloc( sizeof(kTask_t) ); + kTask_t *tmpTask = (kTask_t *) kmalloc(sizeof(kTask_t)); struct file *fp = 0x0; - if ( tmpTask == 0x0 ) - kpanic( "Error: schedNewTask() - kmalloc failed trying to initialize a new task struct\n" ); + if (tmpTask == 0x0) + kpanic("Error: schedNewTask() - kmalloc failed trying to initialize a new task struct\n"); - memset( tmpTask, 0x0, sizeof(kTask_t) ); + memset(tmpTask, 0x0, sizeof(kTask_t)); /* Filling in tasks attrs */ tmpTask->usedMath = 0x0; @@ -170,36 +169,36 @@ /* HACK */ - for ( i = 0; i < 3; i++ ) { - fp = (void *) kmalloc( sizeof(struct file) ); + for (i = 0; i < 3; i++) { + fp = (void *) kmalloc(sizeof(struct file)); //kprintf("DB: [0x%X]\n", (uint32_t) fp); tmpTask->td.o_files[i] = (void *) fp; fp->f_flag = 0x4; } - spinLock( &schedulerSpinLock ); + spinLock(&schedulerSpinLock); tmpTask->id = nextID++; tmpTask->next = taskList; tmpTask->prev = 0x0; taskList->prev = tmpTask; taskList = tmpTask; - spinUnlock( &schedulerSpinLock ); + spinUnlock(&schedulerSpinLock); return (tmpTask); } -int sched_deleteTask( pidType id ) { +int sched_deleteTask(pidType id) { kTask_t *tmpTask = 0x0; /* Checking each task from the prio queue */ - for ( tmpTask = taskList; tmpTask != 0x0; tmpTask = tmpTask->next ) { - if ( tmpTask->id == id ) { - if ( tmpTask->prev != 0x0 ) + for (tmpTask = taskList; tmpTask != 0x0; tmpTask = tmpTask->next) { + if (tmpTask->id == id) { + if (tmpTask->prev != 0x0) tmpTask->prev->next = tmpTask->next; - if ( tmpTask->next != 0x0 ) + if (tmpTask->next != 0x0) tmpTask->next->prev = tmpTask->prev; - if ( taskList == tmpTask ) + if (taskList == tmpTask) taskList = tmpTask->next; return (0x0); @@ -208,10 +207,10 @@ return (0x1); } -int sched_addDelTask( kTask_t *tmpTask ) { +int sched_addDelTask(kTask_t *tmpTask) { tmpTask->next = delList; tmpTask->prev = 0x0; - if ( delList != 0x0 ) + if (delList != 0x0) delList->prev = tmpTask; delList = tmpTask; return (0x0); @@ -220,7 +219,7 @@ kTask_t *sched_getDelTask() { kTask_t *tmpTask = 0x0; - if ( delList == 0x0 ) + if (delList == 0x0) return (0x0); tmpTask = delList; @@ -228,11 +227,11 @@ return (tmpTask); } -kTask_t *schedFindTask( uint32_t id ) { +kTask_t *schedFindTask(uint32_t id) { kTask_t *tmpTask = 0x0; - for ( tmpTask = taskList; tmpTask; tmpTask = tmpTask->next ) { - if ( tmpTask->id == id ) + for (tmpTask = taskList; tmpTask; tmpTask = tmpTask->next) { + if (tmpTask->id == id) return (tmpTask); } @@ -250,8 +249,8 @@ 02/20/2004 - Approved for quality ************************************************************************/ -void schedEndTask( pidType pid ) { - endTask( _current->id ); +void schedEndTask(pidType pid) { + endTask(_current->id); sched_yield(); } @@ -289,28 +288,28 @@ Notes: ************************************************************************/ -int sched_setStatus( pidType pid, tState state ) { - kTask_t *tmpTask = schedFindTask( pid ); - if ( tmpTask == 0x0 ) +int sched_setStatus(pidType pid, tState state) { + kTask_t *tmpTask = schedFindTask(pid); + if (tmpTask == 0x0) return (0x1); tmpTask->state = state; return (0x0); } -void add_wait_queue(struct wait_queue ** p, struct wait_queue * wait) -{ - unsigned long flags; +void add_wait_queue(struct wait_queue ** p, struct wait_queue * wait) { + unsigned long flags; - save_flags(flags); - cli(); - if (!*p) { - wait->next = wait; - *p = wait; - } else { - wait->next = (*p)->next; - (*p)->next = wait; - } - restore_flags(flags); + save_flags(flags); + cli(); + if (!*p) { + wait->next = wait; + *p = wait; + } + else { + wait->next = (*p)->next; + (*p)->next = wait; + } + restore_flags(flags); } void remove_wait_queue(struct wait_queue ** p, struct wait_queue * wait) { @@ -319,10 +318,10 @@ save_flags(flags); cli(); - if ((*p == wait) && - ((*p = wait->next) == wait)) { + if ((*p == wait) && ((*p = wait->next) == wait)) { *p = NULL; - } else { + } + else { tmp = wait; while (tmp->next != wait) { tmp = tmp->next; diff --git a/sys/i386/schedyield.S b/sys/i386/schedyield.S index b04277e..1072793 100644 --- a/sys/i386/schedyield.S +++ b/sys/i386/schedyield.S @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: schedyield.S 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ .globl sched_yield_new .text diff --git a/sys/i386/spinlock.c b/sys/i386/spinlock.c index 5a2194f..6cf0b88 100644 --- a/sys/i386/spinlock.c +++ b/sys/i386/spinlock.c @@ -1,27 +1,29 @@ /*- - * Copyright (c) 2002-2004, 2017 The UbixOS Project + * 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: + * This was developed by Christopher W. Olsen for the UbixOS Project. * - * 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. + * 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 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. + * 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. */ #include diff --git a/sys/i386/sys_call.S b/sys/i386/sys_call.S index 9dc055f..bff7fb0 100644 --- a/sys/i386/sys_call.S +++ b/sys/i386/sys_call.S @@ -1,31 +1,30 @@ -/***************************************************************************************** - Copyright (c) 2002-2004, 2016 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: sys_call.S 199 2016-01-23 14:47:53Z reddawg $ - - *****************************************************************************************/ +/*- + * 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. + */ .globl _sysCall .text diff --git a/sys/i386/sys_call_new.S b/sys/i386/sys_call_new.S index 863fad2..85559a8 100644 --- a/sys/i386/sys_call_new.S +++ b/sys/i386/sys_call_new.S @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: sys_call_new.S 142 2016-01-17 02:23:20Z reddawg $ - - *****************************************************************************************/ +/*- + * 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 FAKE_MCOUNT(caller) pushl caller ; call __mcount ; popl %ecx diff --git a/sys/i386/syscall.c b/sys/i386/syscall.c index aba1058..1730aca 100644 --- a/sys/i386/syscall.c +++ b/sys/i386/syscall.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: syscall.c 183 2016-01-22 04:49:08Z reddawg $ - - *****************************************************************************************/ +/*- + * 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. + */ #include /* @@ -53,7 +52,7 @@ //void sdeTestThread(); int InvalidSystemCall() { - kprintf( "attempt was made to an invalid system call\n" ); + kprintf("attempt was made to an invalid system call\n"); return (0); } @@ -67,8 +66,8 @@ char *shell; }; -int sysAuth( UbixUser *uu ) { - kprintf( "authenticating user %s\n", uu->username ); +int sysAuth(UbixUser *uu) { + kprintf("authenticating user %s\n", uu->username); /* MrOlsen 2016-01-01 uh? if(uu->username == "root" && uu->password == "user") @@ -82,8 +81,8 @@ return (0); } -int sysPasswd( char *passwd ) { - kprintf( "changing user password for user %d\n", _current->uid ); +int sysPasswd(char *passwd) { + kprintf("changing user password for user %d\n", _current->uid); return (0); } @@ -95,20 +94,20 @@ return (0); } -int sysGetpid( int *pid ) { - if ( pid ) +int sysGetpid(int *pid) { + if (pid) *pid = _current->id; return (0); } -int sysExit( int status ) { - endTask( _current->id ); +int sysExit(int status) { + endTask(_current->id); return (0x0); } -int sysCheckPid( int pid, int *ptr ) { - kTask_t *tmpTask = schedFindTask( pid ); - if ( (tmpTask != 0x0) && (ptr != 0x0) ) +int sysCheckPid(int pid, int *ptr) { + kTask_t *tmpTask = schedFindTask(pid); + if ((tmpTask != 0x0) && (ptr != 0x0)) *ptr = tmpTask->state; else *ptr = 0x0; @@ -122,45 +121,45 @@ Notes: ************************************************************************/ -int sysGetFreePage( struct thread *td, uint32_t *count) { +int sysGetFreePage(struct thread *td, uint32_t *count) { //MrOlsen 2017-12-15 kprintf("sysGetFreePage - Count: %i\n", *count); - return((int) vmm_getFreeVirtualPage(_current->id, *count, VM_THRD)); + return ((int) vmm_getFreeVirtualPage(_current->id, *count, VM_THRD)); //return(vmm_getFreeVirtualPage(_current->id, *count, VM_TASK)); } -int sysGetFreePage_OLD( long *ptr, int count, int type ) { - if ( ptr ) { - if ( type == 2 ) - *ptr = (long) vmm_getFreeVirtualPage( _current->id, count, VM_THRD ); +int sysGetFreePage_OLD(long *ptr, int count, int type) { + if (ptr) { + if (type == 2) + *ptr = (long) vmm_getFreeVirtualPage(_current->id, count, VM_THRD); else - *ptr = (long) vmm_getFreeVirtualPage( _current->id, count, VM_TASK ); + *ptr = (long) vmm_getFreeVirtualPage(_current->id, count, VM_TASK); } return (0); } -int sysGetDrives( uInt32 *ptr ) { - if ( ptr ) +int sysGetDrives(uInt32 *ptr) { + if (ptr) *ptr = 0x0; //(uInt32)devices; return (0); } -int sysGetUptime( uInt32 *ptr ) { - if ( ptr ) +int sysGetUptime(uInt32 *ptr) { + if (ptr) *ptr = systemVitals->sysTicks; return (0); } -int sysGetTime( uInt32 *ptr ) { - if ( ptr ) +int sysGetTime(uInt32 *ptr) { + if (ptr) *ptr = systemVitals->sysUptime + systemVitals->timeStart; return (0); } int sys_getcwd(struct thread *td, struct sys_getcwd_args *args) { - char *buf = (char *)args->buf; + char *buf = (char *) args->buf; kprintf("GETCWD: [%s][0x%X]\n", _current->oInfo.cwd, args->buf); - if ( args->buf ) { - sprintf(buf, "%s", _current->oInfo.cwd ); + if (args->buf) { + sprintf(buf, "%s", _current->oInfo.cwd); buf[strlen(_current->oInfo.cwd)] = '\0'; //MrOlsen (2018-01-01) - Why is sprintf not null terminating } @@ -176,11 +175,11 @@ int sysStartSDE() { int i = 0x0; - for ( i = 0; i < 1400; i++ ) { + for (i = 0; i < 1400; i++) { asm("hlt"); } //execThread(sdeThread,(uInt32)(kmalloc(0x2000)+0x2000),0x0); - for ( i = 0; i < 1400; i++ ) { + for (i = 0; i < 1400; i++) { asm("hlt"); } return (0); diff --git a/sys/i386/systemtask.c b/sys/i386/systemtask.c index 4663abd..f563cdf 100644 --- a/sys/i386/systemtask.c +++ b/sys/i386/systemtask.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - Copyright (c) 2002-2004, 2016 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: systemtask.c 169 2016-01-20 01:10:22Z reddawg $ - - *****************************************************************************************/ +/*- + * 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. + */ #include #include @@ -51,51 +50,51 @@ int *x = 0x0; kTask_t *tmpTask = 0x0; - if ( mpi_createMbox( "system" ) != 0x0 ) { - kpanic( "Error: Error creating mailbox: system\n" ); + if (mpi_createMbox("system") != 0x0) { + kpanic("Error: Error creating mailbox: system\n"); } - while ( 1 ) { - if ( mpi_fetchMessage( "system", &myMsg ) == 0x0 ) { - kprintf( "A" ); - switch ( myMsg.header ) { + while (1) { + if (mpi_fetchMessage("system", &myMsg) == 0x0) { + kprintf("A"); + switch (myMsg.header) { case 0x69: x = (int *) &myMsg.data; - kprintf( "Switching to term: [%i][%i]\n", *x, myMsg.pid ); - schedFindTask( myMsg.pid )->term = tty_find( *x ); - break; + kprintf("Switching to term: [%i][%i]\n", *x, myMsg.pid); + schedFindTask(myMsg.pid)->term = tty_find(*x); + break; case 1000: - kprintf( "Restarting the system in 5 seconds\n" ); + kprintf("Restarting the system in 5 seconds\n"); counter = systemVitals->sysUptime + 5; - while ( systemVitals->sysUptime < counter ) { + while (systemVitals->sysUptime < counter) { sched_yield(); } - kprintf( "Rebooting NOW!!!\n" ); - while ( inportByte( 0x64 ) & 0x02 ) + kprintf("Rebooting NOW!!!\n"); + while (inportByte(0x64) & 0x02) ; - outportByte( 0x64, 0xFE ); - break; + outportByte(0x64, 0xFE); + break; case 31337: - kprintf( "system: backdoor opened\n" ); - break; + kprintf("system: backdoor opened\n"); + break; case 0x80: - if ( !strcmp( myMsg.data, "sdeStart" ) ) { - kprintf( "Starting SDE\n" ); + if (!strcmp(myMsg.data, "sdeStart")) { + kprintf("Starting SDE\n"); //execThread(sdeThread,(uInt32)(kmalloc(0x2000)+0x2000),0x0); } - else if ( !strcmp( myMsg.data, "freePage" ) ) { - kprintf( "kkk Free Pages" ); + else if (!strcmp(myMsg.data, "freePage")) { + kprintf("kkk Free Pages"); } - else if ( !strcmp( myMsg.data, "sdeStop" ) ) { + else if (!strcmp(myMsg.data, "sdeStop")) { printOff = 0x0; - biosCall( 0x10, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 ); - for ( i = 0x0; i < 100; i++ ) + biosCall(0x10, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0); + for (i = 0x0; i < 100; i++) asm("hlt"); } - break; + break; default: - kprintf( "system: Received message %i:%s\n", myMsg.header, myMsg.data ); - break; + kprintf("system: Received message %i:%s\n", myMsg.header, myMsg.data); + break; } } @@ -105,11 +104,11 @@ we free the pages for the process and then free the task */ tmpTask = sched_getDelTask(); - if ( tmpTask != 0x0 ) { - if ( tmpTask->imageFd != 0x0 ) - fclose( tmpTask->imageFd ); - vmm_freeProcessPages( tmpTask->id ); - kfree( tmpTask ); + if (tmpTask != 0x0) { + if (tmpTask->imageFd != 0x0) + fclose(tmpTask->imageFd); + vmm_freeProcessPages(tmpTask->id); + kfree(tmpTask); } videoBuffer[0] = systemVitals->sysTicks; sched_yield(); diff --git a/sys/i386/timer.S b/sys/i386/timer.S index d06e868..c7aa642 100644 --- a/sys/i386/timer.S +++ b/sys/i386/timer.S @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: timer.S 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ .globl timerInt .text diff --git a/sys/i386/trap.c b/sys/i386/trap.c index d6e81e8..77677fc 100644 --- a/sys/i386/trap.c +++ b/sys/i386/trap.c @@ -4,28 +4,26 @@ * * 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: + * 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. + * 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. + * 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. */ #include @@ -45,17 +43,17 @@ trap_end_task(str, regs, error_code); \ } -TRAP_CODE( 0, SIGFPE, "divide error", divide_error, _current) -TRAP_CODE( 3, SIGTRAP, "int3", int3, _current) -TRAP_CODE( 4, SIGSEGV, "overflow", overflow, _current) -TRAP_CODE( 5, SIGSEGV, "bounds", bounds, _current) -TRAP_CODE( 6, SIGILL, "invalid operand", invalid_op, _current) -TRAP_CODE( 7, SIGSEGV, "device not available", device_not_available, _current) -TRAP_CODE( 8, SIGSEGV, "double fault", double_fault, _current) +TRAP_CODE(0, SIGFPE, "divide error", divide_error, _current) +TRAP_CODE(3, SIGTRAP, "int3", int3, _current) +TRAP_CODE(4, SIGSEGV, "overflow", overflow, _current) +TRAP_CODE(5, SIGSEGV, "bounds", bounds, _current) +TRAP_CODE(6, SIGILL, "invalid operand", invalid_op, _current) +TRAP_CODE(7, SIGSEGV, "device not available", device_not_available, _current) +TRAP_CODE(8, SIGSEGV, "double fault", double_fault, _current) //TRAP_CODE( 9, SIGFPE, "coprocessor segment overrun", coprocessor_segment_overrun, last_task_used_math) TRAP_CODE(10, SIGSEGV, "invalid TSS", invalid_TSS, _current) -TRAP_CODE(11, SIGBUS, "segment not present", segment_not_present, _current) -TRAP_CODE(12, SIGBUS, "stack segment", stack_segment, _current) +TRAP_CODE(11, SIGBUS, "segment not present", segment_not_present, _current) +TRAP_CODE(12, SIGBUS, "stack segment", stack_segment, _current) TRAP_CODE(15, SIGSEGV, "reserved", reserved, _current) TRAP_CODE(17, SIGSEGV, "alignment check", alignment_check, _current) @@ -117,7 +115,7 @@ store_TR(i); kprintf("Process %s (pid: %i, process nr: %d, stackpage=%08lx)\nStack:", _current->name, _current->id, 0xffff & i, KERNEL_STACK); - stack = (unsigned long *)esp; + stack = (unsigned long *) esp; for (i = 0; i < 16; i++) { if (i && ((i % 8) == 0)) @@ -141,23 +139,23 @@ while (i < 12) { addr = get_seg_long(ss, stack++); /* - * If the address is either in the text segment of the - * kernel, or in the region which contains vmalloc'ed - * memory, it *may* be the address of a calling - * routine; if so, print it so that someone tracing - * down the cause of the crash will be able to figure - * out the call path that was taken. - */ + * If the address is either in the text segment of the + * kernel, or in the region which contains vmalloc'ed + * memory, it *may* be the address of a calling + * routine; if so, print it so that someone tracing + * down the cause of the crash will be able to figure + * out the call path that was taken. + */ if (((addr >= (unsigned long) &kmain) && (addr <= (unsigned long) &_etext)) || ((addr >= module_start) && (addr <= module_end))) { - if (i && ((i % 8) == 0)) - kprintf("\n "); - kprintf("[<%08lx>] ", addr); - i++; - } - } + if (i && ((i % 8) == 0)) + kprintf("\n "); + kprintf("[<%08lx>] ", addr); + i++; + } + } for (i = 0; i < 20; i++) - kprintf("%02x ", 0xff & get_seg_byte(regs->tf_cs, (i+(char *)regs->tf_eip))); + kprintf("%02x ", 0xff & get_seg_byte(regs->tf_cs, (i+(char *)regs->tf_eip))); kprintf("\n"); #endif } @@ -186,10 +184,9 @@ //kpanic("trap_code: %i(0x%X), EIP: 0x%X, CR2: 0x%X\n", frame->tf_trapno, frame->tf_trapno, frame->tf_eip, cr2); die_if_kernel("trapCode", frame, frame->tf_trapno); - endTask( _current->id ); + endTask(_current->id); sched_yield(); - /* switch (trap_code) { case 0xC: diff --git a/sys/include/devfs/devfs.h b/sys/include/devfs/devfs.h index 3a1392f..3e2ba65 100644 --- a/sys/include/devfs/devfs.h +++ b/sys/include/devfs/devfs.h @@ -1,59 +1,58 @@ -/***************************************************************************************** - Copyright (c) 2002-2004 The UbixOS Project - All rights reserved. +/*- + * 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. + */ - 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: devfs.h 79 2016-01-11 16:21:27Z reddawg $ - -*****************************************************************************************/ - -#ifndef _DEVFS_H -#define _DEVFS_H +#ifndef _DEVFS_DEVFS_H +#define _DEVFS_DEVFS_H #include #include struct devfs_devices { - struct devfs_devices *next; - struct devfs_devices *prev; - uInt8 devType; - uInt16 devMajor; - uInt16 devMinor; - char devName[32]; - }; + struct devfs_devices *next; + struct devfs_devices *prev; + uInt8 devType; + uInt16 devMajor; + uInt16 devMinor; + char devName[32]; +}; struct devfs_info { - struct devfs_devices *deviceList; - }; + struct devfs_devices *deviceList; +}; int devfs_init(); -int devfs_makeNode(char *name,uInt8 type,uInt16 major,uInt16 minor); +int devfs_makeNode(char *name, uInt8 type, uInt16 major, uInt16 minor); /* -int devfs_open(char *file,fileDescriptor *fd); -void devFSInit(struct mountPoints *mp); -int devfs_read(fileDescriptor *fd,char *data,long offset,long size); -int devfs_write(fileDescriptor *fd,char *data,long offset,long size); -*/ + int devfs_open(char *file,fileDescriptor *fd); + void devFSInit(struct mountPoints *mp); + int devfs_read(fileDescriptor *fd,char *data,long offset,long size); + int devfs_write(fileDescriptor *fd,char *data,long offset,long size); + */ #endif diff --git a/sys/include/fs/msdos_fs.h b/sys/include/fs/msdos_fs.h index 372bbe0..0248157 100644 --- a/sys/include/fs/msdos_fs.h +++ b/sys/include/fs/msdos_fs.h @@ -1,3 +1,30 @@ +/*- + * 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 _FS_MSDOS_FS_H #define _FS_MSDOS_FS_H @@ -29,15 +56,15 @@ */ struct msdos_inode_info { - int i_start; /* first cluster or 0 */ - int i_attrs; /* unused attribute bits */ - int i_busy; /* file is either deleted but still open, or - inconsistent (mkdir) */ - struct inode *i_depend; /* pointer to inode that depends on the - current inode */ - struct inode *i_old; /* pointer to the old inode this inode - depends on */ - int i_binary; /* file contains non-text data */ + int i_start; /* first cluster or 0 */ + int i_attrs; /* unused attribute bits */ + int i_busy; /* file is either deleted but still open, or + inconsistent (mkdir) */ + struct inode *i_depend; /* pointer to inode that depends on the + current inode */ + struct inode *i_old; /* pointer to the old inode this inode + depends on */ + int i_binary; /* file contains non-text data */ }; #endif diff --git a/sys/include/fs/pipe_fs.h b/sys/include/fs/pipe_fs.h index d87f50a..e7431ea 100644 --- a/sys/include/fs/pipe_fs.h +++ b/sys/include/fs/pipe_fs.h @@ -1,3 +1,31 @@ +/*- + * 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 _FS_PIPE_FS_H #define _FS_PIPE_FS_H diff --git a/sys/include/i386/atkbd.h b/sys/include/i386/atkbd.h new file mode 100644 index 0000000..59e91de --- /dev/null +++ b/sys/include/i386/atkbd.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. + */ + +#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 + +/*** + $Log: atkbd.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/29 21:32:16 reddawg + My quick lunchs breaks worth of updates.... + + Revision 1.3 2004/07/09 13:34:51 reddawg + keyboard: keyboardInit to atkbd_init + Adjusted initialization routines + + Revision 1.2 2004/05/21 14:57:16 reddawg + Cleaned up + + END + ***/ diff --git a/sys/include/i386/cpu.h b/sys/include/i386/cpu.h index 60e0351..96841d6 100644 --- a/sys/include/i386/cpu.h +++ b/sys/include/i386/cpu.h @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: cpu.h 207 2016-01-23 19:43:49Z reddawg $ - - *****************************************************************************************/ +/*- + * 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 _CPU_H_ #define _CPU_H_ @@ -54,47 +53,47 @@ #define PSL_ID 0x00200000 /* identification bit */ /* Read Contents Of CR0 */ -static __inline u_int rcr0( void ) { +static __inline u_int rcr0(void) { u_int data; __asm __volatile("movl %%cr0,%0" : "=r" (data)); return (data); } /* Write To CR0 */ -static __inline void load_cr0( u_int data ) { +static __inline void load_cr0(u_int data) { __asm __volatile("movl %0,%%cr0" : : "r" (data)); } -static __inline u_int rcr2( void ) { +static __inline u_int rcr2(void) { u_int data; __asm __volatile("movl %%cr2,%0" : "=r" (data)); return (data); } -static __inline u_int rcr3( void ) { +static __inline u_int rcr3(void) { u_int data; __asm __volatile("movl %%cr3,%0" : "=r" (data)); return (data); } -static __inline void load_cr3( u_int data ) { +static __inline void load_cr3(u_int data) { __asm __volatile("movl %0,%%cr3" : : "r" (data) : "memory"); } -static __inline u_int rcr4( void ) { +static __inline u_int rcr4(void) { u_int data; __asm __volatile("movl %%cr4,%0" : "=r" (data)); return (data); } -static __inline void load_cr4( u_int data ) { +static __inline void load_cr4(u_int data) { __asm __volatile("movl %0,%%cr4" : : "r" (data)); } -static __inline void invlpg( u_int addr ) { +static __inline void invlpg(u_int addr) { __asm __volatile("invlpg %0" : : "m" (*(char *)addr) : "memory"); } diff --git a/sys/include/i386/elf.h b/sys/include/i386/elf.h index 356f0df..a453017 100644 --- a/sys/include/i386/elf.h +++ b/sys/include/i386/elf.h @@ -1,3 +1,31 @@ +/*- + * 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 _I386_ELF_H_ #define _I386_ELF_H_ 1 @@ -29,20 +57,20 @@ * but POSIX lays claim to all symbols ending with "_t". */ -typedef struct { /* Auxiliary vector entry on initial stack */ - int a_type; /* Entry type. */ - union { - long a_val; /* Integer value. */ - void *a_ptr; /* Address. */ - void (*a_fcn)(void); /* Function pointer (not used). */ - } a_un; -} Elf32_Auxinfo; +typedef struct { /* Auxiliary vector entry on initial stack */ + int a_type; /* Entry type. */ + union { + long a_val; /* Integer value. */ + void *a_ptr; /* Address. */ + void (*a_fcn)(void); /* Function pointer (not used). */ + }a_un; +}Elf32_Auxinfo; #if __ELF_WORD_SIZE == 64 /* Fake for amd64 loader support */ typedef struct { - int fake; -} Elf64_Auxinfo; + int fake; +}Elf64_Auxinfo; #endif __ElfType(Auxinfo); @@ -113,22 +141,21 @@ * The i386 supplement to the SVR4 ABI specification names this "auxv_t", * but POSIX lays claim to all symbols ending with "_t". */ -typedef struct { /* Auxiliary vector entry on initial stack */ - int a_type; /* Entry type. */ - union { - int a_val; /* Integer value. */ - } a_un; -} Elf32_Auxinfo; +typedef struct { /* Auxiliary vector entry on initial stack */ + int a_type; /* Entry type. */ + union { + int a_val; /* Integer value. */ + }a_un; +}Elf32_Auxinfo; - -typedef struct { /* Auxiliary vector entry on initial stack */ - long a_type; /* Entry type. */ - union { - long a_val; /* Integer value. */ - void *a_ptr; /* Address. */ - void (*a_fcn)(void); /* Function pointer (not used). */ - } a_un; -} Elf64_Auxinfo; +typedef struct { /* Auxiliary vector entry on initial stack */ + long a_type; /* Entry type. */ + union { + long a_val; /* Integer value. */ + void *a_ptr; /* Address. */ + void (*a_fcn)(void); /* Function pointer (not used). */ + }a_un; +}Elf64_Auxinfo; __ElfType(Auxinfo); diff --git a/sys/include/i386/signal.h b/sys/include/i386/signal.h index bc08ad9..247663e 100644 --- a/sys/include/i386/signal.h +++ b/sys/include/i386/signal.h @@ -1,3 +1,31 @@ +/*- + * 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 _I386_SIGNAL_H_ #define _I386_SIGNAL_H_ diff --git a/sys/include/isa/8259.h b/sys/include/isa/8259.h index 526cc95..df36487 100644 --- a/sys/include/isa/8259.h +++ b/sys/include/isa/8259.h @@ -1,34 +1,33 @@ -/***************************************************************************************** - Copyright (c) 2002-2004 The UbixOS Project - All rights reserved. +/*- + * 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. + */ - 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: 8259.h 79 2016-01-11 16:21:27Z reddawg $ - -*****************************************************************************************/ - -#ifndef _8259_H -#define _8259_H +#ifndef _ISA_8259_H +#define _ISA_8259_H #include diff --git a/sys/include/isa/atkbd.h b/sys/include/isa/atkbd.h deleted file mode 100644 index 1b266c6..0000000 --- a/sys/include/isa/atkbd.h +++ /dev/null @@ -1,70 +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: atkbd.h 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ - -#ifndef _ATKBD_H -#define _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 - -/*** - $Log: atkbd.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/29 21:32:16 reddawg - My quick lunchs breaks worth of updates.... - - Revision 1.3 2004/07/09 13:34:51 reddawg - keyboard: keyboardInit to atkbd_init - Adjusted initialization routines - - Revision 1.2 2004/05/21 14:57:16 reddawg - Cleaned up - - END - ***/ diff --git a/sys/include/isa/mouse.h b/sys/include/isa/mouse.h index a59a863..240f253 100644 --- a/sys/include/isa/mouse.h +++ b/sys/include/isa/mouse.h @@ -1,34 +1,33 @@ -/***************************************************************************************** - Copyright (c) 2002-2004 The UbixOS Project - All rights reserved. +/*- + * 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. + */ - 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: mouse.h 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ - -#ifndef _MOUSE_H -#define _MOUSE_H +#ifndef _ISA_MOUSE_H +#define _ISA_MOUSE_H int mouseInit(); void mouseISR(); diff --git a/sys/include/isa/ne2k.h b/sys/include/isa/ne2k.h index 70ac271..e908f9c 100644 --- a/sys/include/isa/ne2k.h +++ b/sys/include/isa/ne2k.h @@ -1,34 +1,33 @@ -/***************************************************************************************** - Copyright (c) 2002-2004 The UbixOS Project - All rights reserved. +/*- + * 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. + */ - 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: ne2k.h 79 2016-01-11 16:21:27Z reddawg $ - -*****************************************************************************************/ - -#ifndef _NE2K_H -#define _NE2K_H +#ifndef _ISA_NE2K_H +#define _ISA_NE2K_H #include #include diff --git a/sys/include/isa/pit.h b/sys/include/isa/pit.h index 4267ad9..628fd22 100644 --- a/sys/include/isa/pit.h +++ b/sys/include/isa/pit.h @@ -1,34 +1,33 @@ -/***************************************************************************************** - Copyright (c) 2002-2004 The UbixOS Project - All rights reserved. +/*- + * 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. + */ - 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: pit.h 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ - -#ifndef _PIT_H -#define _PIT_H +#ifndef _ISA_PIT_H +#define _ISA_PIT_H #define PIT_TIMER 200 diff --git a/sys/include/lib/bioscall.h b/sys/include/lib/bioscall.h index 82a04a2..6593bb4 100644 --- a/sys/include/lib/bioscall.h +++ b/sys/include/lib/bioscall.h @@ -1,34 +1,33 @@ -/***************************************************************************************** - Copyright (c) 2002-2004 The UbixOS Project - All rights reserved. +/*- + * 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. + */ - 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: bioscall.h 79 2016-01-11 16:21:27Z reddawg $ - -*****************************************************************************************/ - -#ifndef _BIOSCALL_H -#define _BIOSCALL_H +#ifndef _ISA_BIOSCALL_H +#define _ISA_BIOSCALL_H #include @@ -37,7 +36,7 @@ #define EFLAG_IOPL3 0x3000 #define EFLAG_VM 0x20000 -void biosCall(int biosInt,int eax,int ebx,int ecx,int edx,int esi,int edi,int es,int ds); +void biosCall(int biosInt, int eax, int ebx, int ecx, int edx, int esi, int edi, int es, int ds); void bios16Code(); #endif diff --git a/sys/include/lib/kmalloc.h b/sys/include/lib/kmalloc.h index 4a31c92..edc4889 100644 --- a/sys/include/lib/kmalloc.h +++ b/sys/include/lib/kmalloc.h @@ -1,34 +1,33 @@ -/***************************************************************************************** - Copyright (c) 2002-2004 The UbixOS Project - All rights reserved. +/*- + * 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. + */ - 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: kmalloc.h 79 2016-01-11 16:21:27Z reddawg $ - -*****************************************************************************************/ - -#ifndef _KMALLOC_H -#define _KMALLOC_H +#ifndef _LIB_KMALLOC_H +#define _LIB_KMALLOC_H #include @@ -40,20 +39,20 @@ #define MALLOC_ALIGN_SIZE 32 #define MALLOC_ALIGN(size) (size + ((((size) % (MALLOC_ALIGN_SIZE)) == 0)? 0 : ((MALLOC_ALIGN_SIZE) - ((size) % (MALLOC_ALIGN_SIZE))))) -struct memDescriptor { - struct memDescriptor *prev; //4 - struct memDescriptor *next; //4 - void *baseAddr; //4 - uInt32 limit; //4 - /*uInt8 status; //1 */ - /*char reserved[11]; //11 */ + struct memDescriptor { + struct memDescriptor *prev; //4 + struct memDescriptor *next; //4 + void *baseAddr; //4 + uInt32 limit; //4 + /*uInt8 status; //1 */ + /*char reserved[11]; //11 */ }; -void kfree(void *baseAddr); -void *kmalloc(uInt32 len); + void kfree(void *baseAddr); + void *kmalloc(uInt32 len); #ifdef __cplusplus - } +} #endif #endif diff --git a/sys/include/lib/kprintf.h b/sys/include/lib/kprintf.h index 641a12d..10f876e 100644 --- a/sys/include/lib/kprintf.h +++ b/sys/include/lib/kprintf.h @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: kprintf.h 81 2016-01-11 16:30:47Z reddawg $ - - *****************************************************************************************/ +/*- + * 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 _KPRINTF_H #define _KPRINTF_H @@ -35,10 +34,10 @@ #define MAXNBUF 512 -int kprintf( const char *, ... ); -int sprintf( char *buf, const char *fmt, ... ); -int kvprintf( char const *fmt, void (*func)( int, void* ), void *arg, int radix, va_list ap ); -int ogPrintf( char * ); +int kprintf(const char *, ...); +int sprintf(char *buf, const char *fmt, ...); +int kvprintf(char const *fmt, void (*func)(int, void*), void *arg, int radix, va_list ap); +int ogPrintf(char *); extern int printOff; extern int ogprintOff; diff --git a/sys/include/lib/libcpp.h b/sys/include/lib/libcpp.h index 3d2c65c..47d9deb 100644 --- a/sys/include/lib/libcpp.h +++ b/sys/include/lib/libcpp.h @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: libcpp.h 79 2016-01-11 16:21:27Z reddawg $ - -*****************************************************************************************/ +/*- + * 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 __LIBCPP_H #define __LIBCPP_H @@ -33,26 +32,8 @@ #include void * operator new(unsigned size); -void operator delete(void * ptr); +void operator delete(void * ptr); void * operator new[](unsigned size); -void operator delete[](void * ptr); +void operator delete[](void * ptr); #endif - -/*** - $Log: libcpp.h,v $ - Revision 1.1.1.1 2006/06/01 12:46:13 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.2 2004/05/21 15:00:27 reddawg - Cleaned up - - - END - ***/ diff --git a/sys/include/lib/string.h b/sys/include/lib/string.h index 834113a..39ae15a 100644 --- a/sys/include/lib/string.h +++ b/sys/include/lib/string.h @@ -1,34 +1,33 @@ -/***************************************************************************************** - Copyright (c) 2002-2004 The UbixOS Project - All rights reserved. +/*- + * 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. + */ - 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: string.h 80 2016-01-11 16:24:44Z reddawg $ - - *****************************************************************************************/ - -#ifndef _STRING_H -#define _STRING_H +#ifndef _LIB_STRING_H +#define _LIB_STRING_H #include @@ -47,51 +46,22 @@ extern "C" { #endif -char * strcpy( char *, const char * ); -int strcmp( const char *str1, const char *str2 ); -int strncmp( const char * a, const char * b, size_t c ); -void *memcpy( const void *dst, const void * src, size_t length ); -void *memset( void * dst, int c, size_t length ); -int strlen( const char * string ); -int memcmp( const void * dst, const void * src, size_t length ); -void strncpy( char * dest, const char * src, size_t size ); -char *strtok( char *str, const char *sep ); -char *strtok_r( char *str, const char *sep, char **last ); -char *strstr( const char *s, char *find ); + char * strcpy(char *, const char *); + int strcmp(const char *str1, const char *str2); + int strncmp(const char * a, const char * b, size_t c); + void *memcpy(const void *dst, const void * src, size_t length); + void *memset(void * dst, int c, size_t length); + int strlen(const char * string); + int memcmp(const void * dst, const void * src, size_t length); + void strncpy(char * dest, const char * src, size_t size); + char *strtok(char *str, const char *sep); + char *strtok_r(char *str, const char *sep, char **last); + char *strstr(const char *s, char *find); -int sprintf( char *buf, const char *fmt, ... ); + int sprintf(char *buf, const char *fmt, ...); #ifdef __cplusplus } #endif #endif - -/*** - $Log: string.h,v $ - Revision 1.1.1.1 2006/06/01 12:46:13 reddawg - ubix2 - - Revision 1.2 2005/10/12 00:13:36 reddawg - Removed - - Revision 1.1.1.1 2005/09/26 17:23:41 reddawg - no message - - Revision 1.5 2004/07/20 19:09:40 flameshadow - chg: put strcpy() declaration in the right .h file - add: prototypes for the dirCaching functions in dirCache.h - chg: renamed dirCaching functions - - Revision 1.4 2004/07/06 23:26:12 reddawg - Fixed A Compilation Error - - Revision 1.3 2004/06/28 23:12:58 reddawg - file format now container:/path/to/file - - Revision 1.2 2004/05/21 15:00:27 reddawg - Cleaned up - - - END - ***/ diff --git a/sys/include/math.h b/sys/include/math.h index 29b259a..d5418c1 100644 --- a/sys/include/math.h +++ b/sys/include/math.h @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: math.h 79 2016-01-11 16:21:27Z reddawg $ - -*****************************************************************************************/ +/*- + * 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 __MATH_H #define __MATH_H @@ -37,8 +36,8 @@ double atan(double x); double sqrt(double x); -u_quad_t __udivdi3(u_quad_t a,u_quad_t b); -quad_t __divdi3(quad_t a,quad_t b); +u_quad_t __udivdi3(u_quad_t a, u_quad_t b); +quad_t __divdi3(quad_t a, quad_t b); #endif diff --git a/sys/include/mpi/mpi.h b/sys/include/mpi/mpi.h index 2301c35..0b1ce14 100644 --- a/sys/include/mpi/mpi.h +++ b/sys/include/mpi/mpi.h @@ -1,34 +1,33 @@ -/***************************************************************************************** - Copyright (c) 2002-2004 The UbixOS Project - All rights reserved. +/*- + * 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. + */ - 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: mpi.h 79 2016-01-11 16:21:27Z reddawg $ - -*****************************************************************************************/ - -#ifndef _MPI_H -#define _MPI_H +#ifndef _MPI_MPI_H +#define _MPI_MPI_H #include #include @@ -36,68 +35,28 @@ #define MESSAGE_LENGTH 248 struct mpi_message { - char data[MESSAGE_LENGTH]; - uInt32 header; - pidType pid; - struct mpi_message *next; - }; + 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; - }; + 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_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 *); +int mpi_postMessage(char *, uInt32, mpi_message_t *); +int mpi_fetchMessage(char *, mpi_message_t *); +int mpi_spam(uInt32, void *); #endif - -/*** - $Log: mpi.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:42 reddawg - no message - - Revision 1.8 2004/08/14 11:23:02 reddawg - Changes - - Revision 1.7 2004/05/28 03:52:56 reddawg - mpi: took a few suggestions from TCA - - Revision 1.6 2004/05/25 18:33:11 reddawg - We now use 128byte messages I can increase later - - Revision 1.5 2004/05/25 18:29:57 reddawg - We now lock onto a pid - - Revision 1.4 2004/05/25 16:52:22 reddawg - We now have mpiDestroyMbox(char *) This will of course destroy a mail box - - Revision 1.3 2004/05/25 16:28:21 reddawg - Made mpiFindMbox() static - - Revision 1.2 2004/05/25 15:42:19 reddawg - Enabled mpiSpam(); - - Revision 1.1 2004/05/25 14:07:01 reddawg - Sorry we can't forget the headers files - - END - ***/ - diff --git a/sys/include/objgfx/ogDisplay_VESA.h b/sys/include/objgfx/ogDisplay_VESA.h index 8c05fc1..83410c0 100755 --- a/sys/include/objgfx/ogDisplay_VESA.h +++ b/sys/include/objgfx/ogDisplay_VESA.h @@ -1,95 +1,126 @@ +/*- + * 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_VESA_H #define OGDISPLAY_VESA_H +#include + #include "objgfx30.h" struct TMode_Rec { - uInt16 ModeAttributes __attribute__((packed)); - uInt8 WindowAFlags __attribute__((packed)); - uInt8 WindowBFlags __attribute__((packed)); - uInt16 Granularity __attribute__((packed)); - uInt16 WindowSize __attribute__((packed)); - uInt16 WindowASeg __attribute__((packed)); - uInt16 WindowBSeg __attribute__((packed)); - void* BankSwitch __attribute__((packed)); - uInt16 BytesPerLine __attribute__((packed)); - uInt16 xRes __attribute__((packed)); - uInt16 yRes __attribute__((packed)); - uInt8 CharWidth __attribute__((packed)); - uInt8 CharHeight __attribute__((packed)); - uInt8 NumBitPlanes __attribute__((packed)); - uInt8 BitsPerPixel __attribute__((packed)); - uInt8 NumberOfBanks __attribute__((packed)); - uInt8 MemoryModel __attribute__((packed)); - uInt8 BankSize __attribute__((packed)); - uInt8 NumOfImagePages __attribute__((packed)); - uInt8 Reserved __attribute__((packed)); + uInt16 ModeAttributes __attribute__((packed)); + uInt8 WindowAFlags __attribute__((packed)); + uInt8 WindowBFlags __attribute__((packed)); + uInt16 Granularity __attribute__((packed)); + uInt16 WindowSize __attribute__((packed)); + uInt16 WindowASeg __attribute__((packed)); + uInt16 WindowBSeg __attribute__((packed)); + void* BankSwitch __attribute__((packed)); + uInt16 BytesPerLine __attribute__((packed)); + uInt16 xRes __attribute__((packed)); + uInt16 yRes __attribute__((packed)); + uInt8 CharWidth __attribute__((packed)); + uInt8 CharHeight __attribute__((packed)); + uInt8 NumBitPlanes __attribute__((packed)); + uInt8 BitsPerPixel __attribute__((packed)); + uInt8 NumberOfBanks __attribute__((packed)); + uInt8 MemoryModel __attribute__((packed)); + uInt8 BankSize __attribute__((packed)); + uInt8 NumOfImagePages __attribute__((packed)); + uInt8 Reserved __attribute__((packed)); // Direct colour fields (required for Direct/6 and YUV/7 memory models - uInt8 RedMaskSize __attribute__((packed)); - uInt8 RedFieldPosition __attribute__((packed)); - uInt8 GreenMaskSize __attribute__((packed)); - uInt8 GreenFieldPosition __attribute__((packed)); - uInt8 BlueMaskSize __attribute__((packed)); - uInt8 BlueFieldPosition __attribute__((packed)); - uInt8 AlphaMaskSize __attribute__((packed)); - uInt8 AlphaFieldPosition __attribute__((packed)); - uInt8 DirectColourMode __attribute__((packed)); + uInt8 RedMaskSize __attribute__((packed)); + uInt8 RedFieldPosition __attribute__((packed)); + uInt8 GreenMaskSize __attribute__((packed)); + uInt8 GreenFieldPosition __attribute__((packed)); + uInt8 BlueMaskSize __attribute__((packed)); + uInt8 BlueFieldPosition __attribute__((packed)); + uInt8 AlphaMaskSize __attribute__((packed)); + uInt8 AlphaFieldPosition __attribute__((packed)); + uInt8 DirectColourMode __attribute__((packed)); // VESA 2.0 specific fields - uInt32 physBasePtr __attribute__((packed)); - void* OffScreenMemOffset __attribute__((packed)); - uInt16 OffScreenMemSize __attribute__((packed)); - uInt8 paddington[461] __attribute__((packed)); + uInt32 physBasePtr __attribute__((packed)); + void* OffScreenMemOffset __attribute__((packed)); + uInt16 OffScreenMemSize __attribute__((packed)); + uInt8 paddington[461] __attribute__((packed)); }; struct TVESA_Rec { - char VBESignature[4] __attribute__((packed)); - uInt8 minVersion __attribute__((packed)); - uInt8 majVersion __attribute__((packed)); - uInt32 OEMStringPtr __attribute__((packed)); - uInt32 Capabilities __attribute__((packed)); - uInt32 VideoModePtr __attribute__((packed)); - uInt16 TotalMemory __attribute__((packed)); + char VBESignature[4] __attribute__((packed)); + uInt8 minVersion __attribute__((packed)); + uInt8 majVersion __attribute__((packed)); + uInt32 OEMStringPtr __attribute__((packed)); + uInt32 Capabilities __attribute__((packed)); + uInt32 VideoModePtr __attribute__((packed)); + uInt16 TotalMemory __attribute__((packed)); // VESA 2.0 specific fields - uInt16 OEMSoftwareRev __attribute__((packed)); - uInt32 OEMVendorNamePtr __attribute__((packed)); - uInt32 OEMProductNamePtr __attribute__((packed)); - uInt32 OEMProductRevPtr __attribute__((packed)); - uInt8 paddington[474] __attribute__((packed)); + uInt16 OEMSoftwareRev __attribute__((packed)); + uInt32 OEMVendorNamePtr __attribute__((packed)); + uInt32 OEMProductNamePtr __attribute__((packed)); + uInt32 OEMProductRevPtr __attribute__((packed)); + uInt8 paddington[474] __attribute__((packed)); }; -class ogDisplay_VESA : public ogSurface { - protected: - uInt16 ScreenSelector; - TVESA_Rec* VESARec; - TMode_Rec* ModeRec; - bool InGraphics; - uInt16 findMode(uInt32, uInt32, uInt32); - void getModeInfo(uInt16); - void getVESAInfo(void); - void setMode(uInt16); - virtual uInt32 rawGetPixel(uInt32, uInt32); - virtual void rawSetPixel(uInt32, uInt32, uInt32); - virtual void rawLine(uInt32, uInt32, uInt32, uInt32, uInt32); - void setPal(void); - public: - ogDisplay_VESA(void); - virtual bool ogAvail(void); - virtual bool ogAlias(ogSurface&, uInt32, uInt32, uInt32, uInt32); - virtual void ogClear(uInt32); - virtual bool ogClone(ogSurface&); - virtual void ogCopyLineTo(uInt32, uInt32, const void *, uInt32); - virtual void ogCopyLineFrom(uInt32, uInt32, void *, uInt32); - virtual void ogCopyPal(ogSurface&); - virtual bool ogCreate(uInt32, uInt32, ogPixelFmt); - virtual uInt32 ogGetPixel(int32, int32); - virtual void * ogGetPtr(uInt32, uInt32); - virtual void ogHLine(int32, int32, int32, uInt32); - virtual bool ogLoadPal(const char *); - virtual void ogSetPixel(int32, int32, uInt32); - virtual void ogSetRGBPalette(uInt8, uInt8, uInt8, uInt8); - virtual void ogVFlip(void); - virtual void ogVLine(int32, int32, int32, uInt32); - virtual ~ogDisplay_VESA(void); -}; // ogDisplay_VESA +class ogDisplay_VESA: public ogSurface { + protected: + uInt16 ScreenSelector; + TVESA_Rec* VESARec; + TMode_Rec* ModeRec; + bool InGraphics; + uInt16 findMode(uInt32, uInt32, uInt32); + void getModeInfo(uInt16); + void getVESAInfo(void); + void setMode(uInt16); + virtual uInt32 rawGetPixel(uInt32, uInt32); + virtual void rawSetPixel(uInt32, uInt32, uInt32); + virtual void rawLine(uInt32, uInt32, uInt32, uInt32, uInt32); + void setPal(void); + public: + ogDisplay_VESA(void); + virtual bool ogAvail(void); + virtual bool ogAlias(ogSurface&, uInt32, uInt32, uInt32, uInt32); + virtual void ogClear(uInt32); + virtual bool ogClone(ogSurface&); + virtual void ogCopyLineTo(uInt32, uInt32, const void *, uInt32); + virtual void ogCopyLineFrom(uInt32, uInt32, void *, uInt32); + virtual void ogCopyPal(ogSurface&); + virtual bool ogCreate(uInt32, uInt32, ogPixelFmt); + virtual uInt32 ogGetPixel(int32, int32); + virtual void * ogGetPtr(uInt32, uInt32); + virtual void ogHLine(int32, int32, int32, uInt32); + virtual bool ogLoadPal(const char *); + virtual void ogSetPixel(int32, int32, uInt32); + virtual void ogSetRGBPalette(uInt8, uInt8, uInt8, uInt8); + virtual void ogVFlip(void); + virtual void ogVLine(int32, int32, int32, uInt32); + virtual ~ogDisplay_VESA(void); +}; +// ogDisplay_VESA #endif diff --git a/sys/include/pci/hd.h b/sys/include/pci/hd.h index 6f6029d..6b0870e 100644 --- a/sys/include/pci/hd.h +++ b/sys/include/pci/hd.h @@ -1,34 +1,33 @@ -/***************************************************************************************** - Copyright (c) 2002-2004, 2016 The UbixOS Project - All rights reserved. +/*- + * 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. + */ - 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: hd.h 102 2016-01-12 03:59:34Z reddawg $ - - *****************************************************************************************/ - -#ifndef _HD_H_ -#define _HD_H_ +#ifndef _PCI_HD_H_ +#define _PCI_HD_H_ #include #include @@ -163,124 +162,124 @@ #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; + 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 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 ); +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 */ + 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" */ + 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 */ + 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 */ + /* 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 */ + /* + * 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 */ + /* 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 */ + 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 */ + 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 */ + /* 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 }; @@ -299,101 +298,101 @@ #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 + 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] = { +static const char * const part_types[256] = { [0x00] = "unused", [0x01] = "Primary DOS with 12 bit FAT", [0x02] = "XENIX / file system", @@ -483,42 +482,6 @@ [0xF4] = "SpeedStor large partition", [0xFB] = "VMware VMFS", [0xFE] = "SpeedStor >1024 cyl. or LANstep", - [0xFF] = "Xenix bad blocks table", -}; + [0xFF] = "Xenix bad blocks table", }; #endif - -/*** - $Log: hd.h,v $ - Revision 1.2 2006/10/09 02:58:05 reddawg - Fixing UFS - - 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:50 reddawg - no message - - Revision 1.7 2004/08/15 00:33:02 reddawg - Wow the ide driver works again - - Revision 1.6 2004/07/21 10:02:09 reddawg - devfs: renamed functions - device system: renamed functions - fdc: fixed a few potential bugs and cleaned up some unused variables - strol: fixed definition - endtask: made it print out freepage debug info - kmalloc: fixed a huge memory leak we had some unhandled descriptor insertion so some descriptors were lost - ld: fixed a pointer conversion - file: cleaned up a few unused variables - sched: broke task deletion - kprintf: fixed ogPrintf definition - - Revision 1.5 2004/05/21 15:05:07 reddawg - Cleaned up - - END - ***/ diff --git a/sys/include/pci/lnc.h b/sys/include/pci/lnc.h index b1a3c55..aafd2a0 100644 --- a/sys/include/pci/lnc.h +++ b/sys/include/pci/lnc.h @@ -1,31 +1,33 @@ /*- - * Copyright (c) 2002-2004 The UbixOS Project + * 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: + * This was developed by Christopher W. Olsen for the UbixOS Project. * - * 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. + * 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 COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY - * THIS 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. + * 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 _LNC_H -#define _LNC_H +#ifndef _PCI_LNC_H +#define _PCI_LNC_H #include @@ -51,7 +53,6 @@ #define MODE_32 1 #define MODE_INVALID 3 - // CSR0 #define CSR0 0x0000 #define CSR0_STOP 0x0004 @@ -73,57 +74,56 @@ }; struct hostRingEntry_old { - struct mds *md; - union { - //struct mbuf *mbuf; - char *data; - } buff; + 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; + 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 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 */ + 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 + 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; + 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; @@ -242,10 +242,8 @@ #define Am79C973 0x2625 #define Am79C978 0x2626 - extern struct lncInfo *lnc; - int initLNC(); int probe(struct lncInfo *lnc); int lanceProbe(struct lncInfo *lnc); diff --git a/sys/include/pci/pci.h b/sys/include/pci/pci.h index 684b7bb..1c8d00d 100644 --- a/sys/include/pci/pci.h +++ b/sys/include/pci/pci.h @@ -1,133 +1,106 @@ -/***************************************************************************************** - 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: pci.h 79 2016-01-11 16:21:27Z reddawg $ - -*****************************************************************************************/ +/*- + * 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 vendorID; + uint16_t deviceID; - uint16_t command; - uint16_t status; + uint16_t command; + uint16_t status; - uint8_t revisionID; - uint8_t progIf; - uint8_t subClass; - uint8_t classCode; + uint8_t revisionID; + uint8_t progIf; + uint8_t subClass; + uint8_t classCode; - uint8_t cacheLineSize; - uint8_t latencyTimer; - uint8_t headerType; - uint8_t bist; + uint8_t cacheLineSize; + uint8_t latencyTimer; + uint8_t headerType; + uint8_t bist; - uint32_t bar[6]; + uint32_t bar[6]; - uint32_t cbPointer; + uint32_t cbPointer; - uint16_t subsysVendorID; - uint16_t subsysID; + uint16_t subsysVendorID; + uint16_t subsysID; - uint32_t epromAddr; + uint32_t epromAddr; - uint16_t capabilites; - uint16_t res1; + uint16_t capabilites; + uint16_t res1; - uint32_t res2; + uint32_t res2; - uint8_t intLine; - uint8_t intPin; - uint8_t minGrant; - uint8_t maxLatency; + 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; + /* 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; - /* 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; - }; + 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_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); +void pciWrite(int bus, int dev, int func, int reg, uInt32 v, int bytes); #endif - -/*** - $Log: pci.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:51 reddawg - no message - - Revision 1.3 2004/08/20 16:49:11 reddawg - PCI Updates - More to follow as PCI system gets revamped - - Revision 1.2 2004/05/21 15:05:07 reddawg - Cleaned up - - - END - ***/ diff --git a/sys/include/sde/ogDisplay_UbixOS.h b/sys/include/sde/ogDisplay_UbixOS.h index fa8022a..cb799bb 100755 --- a/sys/include/sde/ogDisplay_UbixOS.h +++ b/sys/include/sde/ogDisplay_UbixOS.h @@ -1,87 +1,117 @@ +/*- + * 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 modeAttributes __attribute__((packed)); - uInt8 windowAFlags __attribute__((packed)); - uInt8 windowBFlags __attribute__((packed)); - uInt16 granularity __attribute__((packed)); - uInt16 windowSize __attribute__((packed)); - uInt16 windowASeg __attribute__((packed)); - uInt16 windowBSeg __attribute__((packed)); - void* bankSwitch __attribute__((packed)); - uInt16 bytesPerLine __attribute__((packed)); - uInt16 xRes __attribute__((packed)); - uInt16 yRes __attribute__((packed)); - uInt8 charWidth __attribute__((packed)); - uInt8 charHeight __attribute__((packed)); - uInt8 numBitPlanes __attribute__((packed)); - uInt8 bitsPerPixel __attribute__((packed)); - uInt8 numberOfBanks __attribute__((packed)); - uInt8 memoryModel __attribute__((packed)); - uInt8 bankSize __attribute__((packed)); - uInt8 numOfImagePages __attribute__((packed)); - uInt8 reserved __attribute__((packed)); + uInt16 modeAttributes __attribute__((packed)); + uInt8 windowAFlags __attribute__((packed)); + uInt8 windowBFlags __attribute__((packed)); + uInt16 granularity __attribute__((packed)); + uInt16 windowSize __attribute__((packed)); + uInt16 windowASeg __attribute__((packed)); + uInt16 windowBSeg __attribute__((packed)); + void* bankSwitch __attribute__((packed)); + uInt16 bytesPerLine __attribute__((packed)); + uInt16 xRes __attribute__((packed)); + uInt16 yRes __attribute__((packed)); + uInt8 charWidth __attribute__((packed)); + uInt8 charHeight __attribute__((packed)); + uInt8 numBitPlanes __attribute__((packed)); + uInt8 bitsPerPixel __attribute__((packed)); + uInt8 numberOfBanks __attribute__((packed)); + uInt8 memoryModel __attribute__((packed)); + uInt8 bankSize __attribute__((packed)); + uInt8 numOfImagePages __attribute__((packed)); + uInt8 reserved __attribute__((packed)); // Direct colour fields (required for Direct/6 and YUV/7 memory models - uInt8 redMaskSize __attribute__((packed)); - uInt8 redFieldPosition __attribute__((packed)); - uInt8 greenMaskSize __attribute__((packed)); - uInt8 greenFieldPosition __attribute__((packed)); - uInt8 blueMaskSize __attribute__((packed)); - uInt8 blueFieldPosition __attribute__((packed)); - uInt8 alphaMaskSize __attribute__((packed)); - uInt8 alphaFieldPosition __attribute__((packed)); - uInt8 directColourMode __attribute__((packed)); + uInt8 redMaskSize __attribute__((packed)); + uInt8 redFieldPosition __attribute__((packed)); + uInt8 greenMaskSize __attribute__((packed)); + uInt8 greenFieldPosition __attribute__((packed)); + uInt8 blueMaskSize __attribute__((packed)); + uInt8 blueFieldPosition __attribute__((packed)); + uInt8 alphaMaskSize __attribute__((packed)); + uInt8 alphaFieldPosition __attribute__((packed)); + uInt8 directColourMode __attribute__((packed)); // VESA 2.0 specific fields - uInt32 physBasePtr __attribute__((packed)); - void* offScreenMemOffset __attribute__((packed)); - uInt16 offScreenMemSize __attribute__((packed)); - uInt8 paddington[461] __attribute__((packed)); + uInt32 physBasePtr __attribute__((packed)); + void* offScreenMemOffset __attribute__((packed)); + uInt16 offScreenMemSize __attribute__((packed)); + uInt8 paddington[461] __attribute__((packed)); }; struct ogVESAInfo { - char VBESignature[4] __attribute__((packed)); - uInt8 minVersion __attribute__((packed)); - uInt8 majVersion __attribute__((packed)); - uInt32 OEMStringPtr __attribute__((packed)); - uInt32 capabilities __attribute__((packed)); - uInt32 videoModePtr __attribute__((packed)); - uInt16 totalMemory __attribute__((packed)); + char VBESignature[4] __attribute__((packed)); + uInt8 minVersion __attribute__((packed)); + uInt8 majVersion __attribute__((packed)); + uInt32 OEMStringPtr __attribute__((packed)); + uInt32 capabilities __attribute__((packed)); + uInt32 videoModePtr __attribute__((packed)); + uInt16 totalMemory __attribute__((packed)); // VESA 2.0 specific fields - uInt16 OEMSoftwareRev __attribute__((packed)); - uInt32 OEMVendorNamePtr __attribute__((packed)); - uInt32 OEMProductNamePtr __attribute__((packed)); - uInt32 OEMProductRevPtr __attribute__((packed)); - uInt8 paddington[474] __attribute__((packed)); + uInt16 OEMSoftwareRev __attribute__((packed)); + uInt32 OEMVendorNamePtr __attribute__((packed)); + uInt32 OEMProductNamePtr __attribute__((packed)); + uInt32 OEMProductRevPtr __attribute__((packed)); + uInt8 paddington[474] __attribute__((packed)); }; +class ogDisplay_UbixOS: public ogSurface { + protected: + void * pages[2]; + uInt32 activePage; + uInt32 visualPage; + ogVESAInfo * VESAInfo; + ogModeInfo * modeInfo; -class ogDisplay_UbixOS : public ogSurface { - protected: - void * pages[2]; - uInt32 activePage; - uInt32 visualPage; - ogVESAInfo * VESAInfo; - ogModeInfo * modeInfo; - - uInt16 FindMode(uInt32, uInt32, uInt32); - void GetModeInfo(uInt16); - void GetVESAInfo(void); - void SetMode(uInt16); - void SetPal(void); - public: - ogDisplay_UbixOS(void); - virtual bool ogAlias(ogSurface&, uInt32, uInt32, uInt32, uInt32); - virtual bool ogClone(ogSurface&); - virtual void ogCopyPalette(ogSurface&); - virtual bool ogCreate(uInt32, uInt32, ogPixelFmt); - virtual bool ogLoadPalette(const char *); - virtual void ogSetPalette(const ogRGBA8[]); - virtual void ogSetPalette(uInt8, uInt8, uInt8, uInt8); - virtual void ogSetPalette(uInt8, uInt8, uInt8, uInt8, uInt8); - virtual ~ogDisplay_UbixOS(void); -}; // ogDisplay_UbixOS + uInt16 FindMode(uInt32, uInt32, uInt32); + void GetModeInfo(uInt16); + void GetVESAInfo(void); + void SetMode(uInt16); + void SetPal(void); + public: + ogDisplay_UbixOS(void); + virtual bool ogAlias(ogSurface&, uInt32, uInt32, uInt32, uInt32); + virtual bool ogClone(ogSurface&); + virtual void ogCopyPalette(ogSurface&); + virtual bool ogCreate(uInt32, uInt32, ogPixelFmt); + virtual bool ogLoadPalette(const char *); + virtual void ogSetPalette(const ogRGBA8[]); + virtual void ogSetPalette(uInt8, uInt8, uInt8, uInt8); + virtual void ogSetPalette(uInt8, uInt8, uInt8, uInt8, uInt8); + virtual ~ogDisplay_UbixOS(void); +}; +// ogDisplay_UbixOS #endif diff --git a/sys/include/sde/sde.h b/sys/include/sde/sde.h index 24d3b8c..1cd485e 100644 --- a/sys/include/sde/sde.h +++ b/sys/include/sde/sde.h @@ -1,26 +1,30 @@ -/************************************************************************************** - Copyright (c) 2002 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: sde.h 79 2016-01-11 16:21:27Z reddawg $ - -**************************************************************************************/ - +/*- + * 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_H_ #define _SDE_H_ @@ -39,17 +43,17 @@ #ifdef __cplusplus extern "C" #endif -void sysSDE(uInt32 cmd,void *ptr); +void sysSDE(uInt32 cmd, void *ptr); struct sdeWindows { - struct sdeWindows *next; - struct sdeWindows *prev; - void *buf; - pidType pid; - uInt8 status; - }; + struct sdeWindows *next; + struct sdeWindows *prev; + void *buf; + pidType pid; + uInt8 status; +}; -extern struct sdeWindows *windows; - +extern struct sdeWindows *windows; + #endif diff --git a/sys/include/stdarg.h b/sys/include/stdarg.h index 79ecda8..0555230 100644 --- a/sys/include/stdarg.h +++ b/sys/include/stdarg.h @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: stdarg.h 75 2016-01-11 06:15:17Z reddawg $ - - *****************************************************************************************/ +/*- + * 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 _STDARG_H #define _STDARG_H @@ -51,7 +50,7 @@ #define va_end(ap) \ __builtin_va_end(ap) -int vsprintf( char *buf, const char *fmt, va_list args ); +int vsprintf(char *buf, const char *fmt, va_list args); #endif diff --git a/sys/include/string.h b/sys/include/string.h index 9611096..8025018 100644 --- a/sys/include/string.h +++ b/sys/include/string.h @@ -1,43 +1,42 @@ -/***************************************************************************************** - 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: string.h 79 2016-01-11 16:21:27Z reddawg $ - -*****************************************************************************************/ +/*- + * 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 _STRING_H #define _STRING_H #include -char *strcpy(char *dst,const char *src); +char *strcpy(char *dst, const char *src); void *memcpy(void * dst, const void * src, size_t length); void *memset(void * dst, int c, size_t length); int strlen(const char * string); -int strcmp(const char *,const char *); +int strcmp(const char *, const char *); int sprintf(char * str, const char * format, ...); diff --git a/sys/include/sys/_types.h b/sys/include/sys/_types.h index 73bd3d7..55a9c44 100644 --- a/sys/include/sys/_types.h +++ b/sys/include/sys/_types.h @@ -1,76 +1,54 @@ /*- - * Copyright (c) 2002-2004, 2017 The UbixOS Project + * 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: + * This was developed by Christopher W. Olsen for the UbixOS Project. * - * 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. + * 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 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. + * 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__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 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; 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 __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 __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 __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; #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 diff --git a/sys/include/sys/buf.h b/sys/include/sys/buf.h index 695c9db..b08e384 100644 --- a/sys/include/sys/buf.h +++ b/sys/include/sys/buf.h @@ -25,7 +25,7 @@ $Id: buf.h 79 2016-01-11 16:21:27Z reddawg $ -*****************************************************************************************/ + *****************************************************************************************/ #ifndef _BUF_H #define _BUF_H @@ -38,8 +38,3 @@ #endif - -/*** - END - ***/ - diff --git a/sys/include/sys/device.h b/sys/include/sys/device.h index 415bff7..3dc5d70 100644 --- a/sys/include/sys/device.h +++ b/sys/include/sys/device.h @@ -1,113 +1,66 @@ -/***************************************************************************************** - Copyright (c) 2002-2004 The UbixOS Project - All rights reserved. +/*- + * 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. + */ - 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: device.h 102 2016-01-12 03:59:34Z reddawg $ - - *****************************************************************************************/ - -#ifndef _DEVICE_H -#define _DEVICE_H +#ifndef _SYS_DEVICE_H +#define _SYS_DEVICE_H #include struct device_node { - struct device_node *prev; - struct device_node *next; - struct device_interface *devInfo; - struct device_resource *devRec; - char type; - int minor; + struct device_node *prev; + struct device_node *next; + struct device_interface *devInfo; + struct device_resource *devRec; + char type; + int minor; }; struct device_resource { - uInt8 irq; + uInt8 irq; }; struct device_interface { - uInt8 initialized; - uInt32 size; - int major; - void *info; - int (*read)( void *, void *, uInt32, uInt32 ); - int (*write)( void *, void *, uInt32, uInt32 ); - void (*reset)( void * ); - int (*init)( void * ); - void (*ioctl)( void * ); - void (*stop)( void * ); - void (*start)( void * ); - void (*standby)( void * ); + uInt8 initialized; + uInt32 size; + int major; + void *info; + int (*read)(void *, void *, uInt32, uInt32); + int (*write)(void *, void *, uInt32, uInt32); + void (*reset)(void *); + int (*init)(void *); + void (*ioctl)(void *); + void (*stop)(void *); + void (*start)(void *); + void (*standby)(void *); }; -int device_add( int, char, struct device_interface * ); -struct device_node *device_find( int major, int minor ); -int device_remove( struct device_node * ); -#endif +int device_add(int, char, struct device_interface *); +struct device_node *device_find(int major, int minor); +int device_remove(struct device_node *); -/*** - $Log: device.h,v $ - Revision 1.1.1.1 2006/06/01 12:46:15 reddawg - ubix2 - - Revision 1.2 2005/10/12 00:13:37 reddawg - Removed - - Revision 1.1.1.1 2005/09/26 17:23:51 reddawg - no message - - Revision 1.14 2004/08/15 00:33:02 reddawg - Wow the ide driver works again - - Revision 1.13 2004/08/14 21:56:44 reddawg - Added initialized byte to the device system to make it easy to add child devices which use parent hardware. - - Revision 1.12 2004/07/21 10:02:09 reddawg - devfs: renamed functions - device system: renamed functions - fdc: fixed a few potential bugs and cleaned up some unused variables - strol: fixed definition - endtask: made it print out freepage debug info - kmalloc: fixed a huge memory leak we had some unhandled descriptor insertion so some descriptors were lost - ld: fixed a pointer conversion - file: cleaned up a few unused variables - sched: broke task deletion - kprintf: fixed ogPrintf definition - - Revision 1.11 2004/05/22 02:40:04 ionix - - - fixed typo in device.h and initialized previous in device.c :) - - Revision 1.10 2004/05/22 02:34:03 ionix - - - Added proto - - Revision 1.9 2004/05/21 15:12:17 reddawg - Cleaned up - - - END - ***/ - +#endif /* END _SYS_DEVICE_H */ diff --git a/sys/include/sys/device.old.h b/sys/include/sys/device.old.h index 388a6ec..27641cd 100644 --- a/sys/include/sys/device.old.h +++ b/sys/include/sys/device.old.h @@ -1,25 +1,30 @@ -/************************************************************************************** - Copyright (c) 2002 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: device.old.h 79 2016-01-11 16:21:27Z reddawg $ - -**************************************************************************************/ +/*- + * 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 _DEVICE_H #define _DEVICE_H diff --git a/sys/include/sys/dma.h b/sys/include/sys/dma.h index afaabd1..b2ca5ed 100644 --- a/sys/include/sys/dma.h +++ b/sys/include/sys/dma.h @@ -1,56 +1,37 @@ -/***************************************************************************************** - Copyright (c) 2002-2004 The UbixOS Project - All rights reserved. +/*- + * 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. + */ - 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: dma.h 79 2016-01-11 16:21:27Z reddawg $ - -*****************************************************************************************/ - -#ifndef _DMA_H -#define _DMA_H +#ifndef _SYS_DMA_H +#define _SYS_DMA_H #include -void dmaXfer(uInt8 channel,uInt32 address,uInt length,uInt8 read); -void _dmaXfer(uInt8 dmaChannel,uInt8 page,uInt offset,uInt length,uInt8 mode); +void dmaXfer(uInt8 channel, uInt32 address, uInt length, uInt8 read); +void _dmaXfer(uInt8 dmaChannel, uInt8 page, uInt offset, uInt length, uInt8 mode); -#endif - -/*** - $Log: dma.h,v $ - Revision 1.1.1.1 2006/06/01 12:46:15 reddawg - ubix2 - - Revision 1.2 2005/10/12 00:13:37 reddawg - Removed - - Revision 1.1.1.1 2005/09/26 17:23:52 reddawg - no message - - Revision 1.3 2004/05/21 15:12:17 reddawg - Cleaned up - - - END - ***/ +#endif /* END _SYS_DMA_H */ diff --git a/sys/include/sys/driver.h b/sys/include/sys/driver.h index 75e85e8..b0b16ff 100644 --- a/sys/include/sys/driver.h +++ b/sys/include/sys/driver.h @@ -1,67 +1,44 @@ -/***************************************************************************************** - Copyright (c) 2002-2004 The UbixOS Project - All rights reserved. +/*- + * 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. + */ - Redistribution and use in source and binary forms, with or without modification, are - permitted provided that the following conditions are met: +#ifndef _SYS_DRIVER_H +#define _SYS_DRIVER_H - 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: driver.h 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ - -#ifndef _DRIVER_H -#define _DRIVER_H - -#include - +#include typedef struct devMethodType devMethod; struct devMethodType { - }; +}; struct driverType { - const char *devName; - devMethod *methods; - } + const char *devName; + devMethod *methods; +} - - - -#endif - -/*** - $Log: driver.h,v $ - Revision 1.1.1.1 2006/06/01 12:46:15 reddawg - ubix2 - - Revision 1.2 2005/10/12 00:13:37 reddawg - Removed - - Revision 1.1.1.1 2005/09/26 17:23:52 reddawg - no message - - Revision 1.2 2004/05/21 15:12:17 reddawg - Cleaned up - - - END - ***/ +#endif /* END _SYS_DRIVER_H */ diff --git a/sys/include/sys/elf.h b/sys/include/sys/elf.h index eedb3dd..4392989 100644 --- a/sys/include/sys/elf.h +++ b/sys/include/sys/elf.h @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: elf.h 171 2016-01-20 05:02:07Z reddawg $ - - *****************************************************************************************/ +/*- + * 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_ELF_H_ #define _SYS_ELF_H_ 1 @@ -87,4 +86,4 @@ int elf_load_file( kTask_t *p, const char *file, uint32_t *addr, uint32_t *entry ); -#endif +#endif /* END _SYS_ELF_H */ diff --git a/sys/include/sys/elf32.h b/sys/include/sys/elf32.h index 37687db..d19803e 100644 --- a/sys/include/sys/elf32.h +++ b/sys/include/sys/elf32.h @@ -1,27 +1,29 @@ /*- - * Copyright (c) 2018 The UbixOS Project + * 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: + * This was developed by Christopher W. Olsen for the UbixOS Project. * - * 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. + * 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 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. + * 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_ELF32_H_ @@ -254,4 +256,4 @@ Elf32_Word ch_addralign; } Elf32_Chdr; -#endif +#endif /* END _SYS_ELF32_H */ diff --git a/sys/include/sys/elf64.h b/sys/include/sys/elf64.h index 4690401..fe825dc 100644 --- a/sys/include/sys/elf64.h +++ b/sys/include/sys/elf64.h @@ -1,3 +1,31 @@ +/*- + * 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_ELF64_H_ #define _SYS_ELF64_H_ 1 diff --git a/sys/include/sys/elf_common.h b/sys/include/sys/elf_common.h index 3936736..8f1cc61 100644 --- a/sys/include/sys/elf_common.h +++ b/sys/include/sys/elf_common.h @@ -1,3 +1,31 @@ +/*- + * 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_ELF_COMMON_H_ #define _SYS_ELF_COMMON_H_ 1 diff --git a/sys/include/sys/elf_generic.h b/sys/include/sys/elf_generic.h index 36df0db..3350856 100644 --- a/sys/include/sys/elf_generic.h +++ b/sys/include/sys/elf_generic.h @@ -1,3 +1,31 @@ +/*- + * 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_ELF_GENERIC_H_ #define _SYS_ELF_GENERIC_H_ 1 diff --git a/sys/include/sys/gdt.h b/sys/include/sys/gdt.h index bd795ed..e6a38c5 100644 --- a/sys/include/sys/gdt.h +++ b/sys/include/sys/gdt.h @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: gdt.h 204 2016-01-23 17:53:11Z reddawg $ - - *****************************************************************************************/ +/*- + * 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 _GDT_H_ #define _GDT_H_ diff --git a/sys/include/sys/gen_calls.h b/sys/include/sys/gen_calls.h index 62af9de..e175176 100644 --- a/sys/include/sys/gen_calls.h +++ b/sys/include/sys/gen_calls.h @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: gen_calls.h 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ +/*- + * 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 _GEN_CALLS_H #define _GEN_CALLS_H @@ -43,8 +42,3 @@ int gettimeofday_new(struct thread *, struct gettimeofday_args *); #endif - -/*** - END - ***/ - diff --git a/sys/include/sys/idt.h b/sys/include/sys/idt.h index 2cea10c..586fbfd 100644 --- a/sys/include/sys/idt.h +++ b/sys/include/sys/idt.h @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: idt.h 79 2016-01-11 16:21:27Z reddawg $ - -*****************************************************************************************/ +/*- + * 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 _IDT_H #define _IDT_H @@ -40,7 +39,7 @@ int idt_init(); void setVector(void *handler, unsigned char interrupt, unsigned short controlMajor); -void setTaskVector(uInt8 interrupt,uInt16 controlMajor,uInt8 selector); +void setTaskVector(uInt8 interrupt, uInt16 controlMajor, uInt8 selector); void intNull(); void _int0(); diff --git a/sys/include/sys/io.h b/sys/include/sys/io.h index 1fa648c..9d118d7 100644 --- a/sys/include/sys/io.h +++ b/sys/include/sys/io.h @@ -1,43 +1,42 @@ -/***************************************************************************************** - Copyright (c) 2002-2004, 2016 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: io.h 88 2016-01-12 00:11:29Z reddawg $ - - *****************************************************************************************/ +/*- + * 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 _IO_H_ #define _IO_H_ -unsigned char inportByte( unsigned int ); -unsigned short inportWord( unsigned int ); -unsigned long inportDWord( unsigned int ); +unsigned char inportByte(unsigned int); +unsigned short inportWord(unsigned int); +unsigned long inportDWord(unsigned int); -void outportByte( unsigned int, unsigned char ); -void outportByteP( unsigned int port, unsigned char value ); -void outportWord( unsigned int, unsigned short ); -void outportDWord( unsigned int port, unsigned long value ); +void outportByte(unsigned int, unsigned char); +void outportByteP(unsigned int port, unsigned char value); +void outportWord(unsigned int, unsigned short); +void outportDWord(unsigned int port, unsigned long value); #endif diff --git a/sys/include/sys/kern_descrip.h b/sys/include/sys/kern_descrip.h index 66a0b10..0b3c1de 100644 --- a/sys/include/sys/kern_descrip.h +++ b/sys/include/sys/kern_descrip.h @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: kern_descrip.h 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ +/*- + * 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 _KERN_DESCRIP_H #define _KERN_DESCRIP_H @@ -36,8 +35,8 @@ #include #include -typedef __mode_t mode_t; -typedef __nlink_t nlink_t; +typedef __mode_t mode_t; +typedef __nlink_t nlink_t; /* command values */ #define F_DUPFD 0 /* duplicate file descriptor */ @@ -71,10 +70,8 @@ #define O_RDWR 0x0002 /* open for reading and writing */ #define O_ACCMODE 0x0003 /* mask for above modes */ - #define FHASLOCK 0x4000 /* descriptor holds advisory lock */ - /* F MAPPERS */ #define FAPPEND O_APPEND /* kernel/compat */ #define FASYNC O_ASYNC /* kernel/compat */ @@ -84,83 +81,78 @@ #define O_NDELAY O_NONBLOCK /* compat */ #define FPOSIXSHM O_NOFOLLOW - - #define FCNTLFLAGS (FAPPEND|FASYNC|FFSYNC|FNONBLOCK|FPOSIXSHM|O_DIRECT) #define FFLAGS(oflags) ((oflags) + 1) #define OFLAGS(fflags) ((fflags) - 1) struct file { - int f_flag; - char path[1024]; - fileDescriptor *fd; - }; + int f_flag; + char path[1024]; + fileDescriptor *fd; +}; #ifdef _BALLS /* TEMP */ struct __timespec { - __time_t tv_sec; /* seconds */ - long tv_nsec; /* and nanoseconds */ + __time_t tv_sec; /* seconds */ + long tv_nsec; /* and nanoseconds */ }; - struct stat { - __dev_t st_dev; /* inode's device */ - ino_t st_ino; /* inode's number */ - mode_t st_mode; /* inode protection mode */ - nlink_t st_nlink; /* number of hard links */ - uid_t st_uid; /* user ID of the file's owner */ - gid_t st_gid; /* group ID of the file's group */ - __dev_t st_rdev; /* device type */ + __dev_t st_dev; /* inode's device */ + ino_t st_ino; /* inode's number */ + mode_t st_mode; /* inode protection mode */ + nlink_t st_nlink; /* number of hard links */ + uid_t st_uid; /* user ID of the file's owner */ + gid_t st_gid; /* group ID of the file's group */ + __dev_t st_rdev; /* device type */ #if __BSD_VISIBLE - struct timespec st_atimespec; /* time of last access */ - struct timespec st_mtimespec; /* time of last data modification */ - struct timespec st_ctimespec; /* time of last file status change */ + struct timespec st_atimespec; /* time of last access */ + struct timespec st_mtimespec; /* time of last data modification */ + struct timespec st_ctimespec; /* time of last file status change */ #else - time_t st_atime; /* time of last access */ - long __st_atimensec; /* nsec of last access */ - time_t st_mtime; /* time of last data modification */ - long __st_mtimensec; /* nsec of last data modification */ - time_t st_ctime; /* time of last file status change */ - long __st_ctimensec; /* nsec of last file status change */ + time_t st_atime; /* time of last access */ + long __st_atimensec; /* nsec of last access */ + time_t st_mtime; /* time of last data modification */ + long __st_mtimensec; /* nsec of last data modification */ + time_t st_ctime; /* time of last file status change */ + long __st_ctimensec; /* nsec of last file status change */ #endif - off_t st_size; /* file size, in bytes */ - blkcnt_t st_blocks; /* blocks allocated for file */ - blksize_t st_blksize; /* optimal blocksize for I/O */ - fflags_t st_flags; /* user defined flags for file */ - __uint32_t st_gen; /* file generation number */ - __int32_t st_lspare; + off_t st_size; /* file size, in bytes */ + blkcnt_t st_blocks; /* blocks allocated for file */ + blksize_t st_blksize; /* optimal blocksize for I/O */ + fflags_t st_flags; /* user defined flags for file */ + __uint32_t st_gen; /* file generation number */ + __int32_t st_lspare; #if __BSD_VISIBLE - struct timespec st_birthtimespec; /* time of file creation */ - /* - * Explicitly pad st_birthtimespec to 16 bytes so that the size of - * struct stat is backwards compatible. We use bitfields instead - * of an array of chars so that this doesn't require a C99 compiler - * to compile if the size of the padding is 0. We use 2 bitfields - * to cover up to 64 bits on 32-bit machines. We assume that - * CHAR_BIT is 8... - */ - unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec)); - unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec)); + struct timespec st_birthtimespec; /* time of file creation */ + /* + * Explicitly pad st_birthtimespec to 16 bytes so that the size of + * struct stat is backwards compatible. We use bitfields instead + * of an array of chars so that this doesn't require a C99 compiler + * to compile if the size of the padding is 0. We use 2 bitfields + * to cover up to 64 bits on 32-bit machines. We assume that + * CHAR_BIT is 8... + */ + unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec)); + unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec)); #else - time_t st_birthtime; /* time of file creation */ - long st_birthtimensec; /* nsec of file creation */ - unsigned int :(8 / 2) * (16 - (int)sizeof(struct __timespec)); - unsigned int :(8 / 2) * (16 - (int)sizeof(struct __timespec)); + time_t st_birthtime; /* time of file creation */ + long st_birthtimensec; /* nsec of file creation */ + unsigned int :(8 / 2) * (16 - (int)sizeof(struct __timespec)); + unsigned int :(8 / 2) * (16 - (int)sizeof(struct __timespec)); #endif }; #endif - int fcntl(struct thread *, struct fcntl_args *); -int close(struct thread *,struct close_args *); +int close(struct thread *, struct close_args *); int falloc(struct thread *, struct file **, int *); int getdtablesize(struct thread *, struct getdtablesize_args *); int fstat(struct thread *, struct fstat_args *); int ioctl(struct thread *, struct ioctl_args *); -int getfd(struct thread *td,struct file **fp,int fd); - +int getfd(struct thread *td, struct file **fp, int fd); #endif diff --git a/sys/include/sys/kern_sig.h b/sys/include/sys/kern_sig.h index dd5884b..1979965 100644 --- a/sys/include/sys/kern_sig.h +++ b/sys/include/sys/kern_sig.h @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: kern_sig.h 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ +/*- + * 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 _KERN_SIG_H #define _KERN_SIG_H @@ -36,9 +35,4 @@ int sigaction(struct thread *,struct sigaction_args *); int sigprocmask(struct thread *, struct sigprocmask_args *); -#endif - -/*** - END - ***/ - +#endif /* END _KERN_SIG_H */ diff --git a/sys/include/sys/kern_sysctl.h b/sys/include/sys/kern_sysctl.h index b981b75..caba27c 100644 --- a/sys/include/sys/kern_sysctl.h +++ b/sys/include/sys/kern_sysctl.h @@ -1,34 +1,33 @@ -/***************************************************************************************** - Copyright (c) 2002-2004 The UbixOS Project - All rights reserved. +/*- + * 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. + */ - 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: kern_sysctl.h 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ - -#ifndef _KERNSYSCTL_H -#define _KERNSYSCTL_H +#ifndef _SYS_KERN_SYSCTL_H +#define _SYS_KERN_SYSCTL_H #include #include @@ -69,9 +68,4 @@ int sysctl_init(); extern bool sysctl_enabled; -#endif - -/*** - END - ***/ - +#endif /* END _SYS_KERN_SYSCTL_H */ diff --git a/sys/include/sys/pipe.h b/sys/include/sys/pipe.h index 657e5ac..b76d9dc 100644 --- a/sys/include/sys/pipe.h +++ b/sys/include/sys/pipe.h @@ -1,43 +1,37 @@ -/***************************************************************************************** - Copyright (c) 2002-2004 The UbixOS Project - All rights reserved. +/*- + * 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. + */ - 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: pipe.h 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ - -#ifndef _PIPE_H -#define _PIPE_H +#ifndef _SYS_PIPE_H +#define _SYS_PIPE_H #include #include int pipe(struct thread *, struct pipe_args *); -#endif - -/*** - END - ***/ - +#endif /* END _SYS_PIPE_H */ diff --git a/sys/include/sys/signal.h b/sys/include/sys/signal.h index 628e1da..22ccfd5 100644 --- a/sys/include/sys/signal.h +++ b/sys/include/sys/signal.h @@ -1,34 +1,33 @@ -/***************************************************************************************** - Copyright (c) 2002-2004 The UbixOS Project - All rights reserved. +/*- + * 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. + */ - 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: signal.h 79 2016-01-11 16:21:27Z reddawg $ - -*****************************************************************************************/ - -#ifndef _SIGNAL_H -#define _SIGNAL_H +#ifndef _SYS_SIGNAL_H +#define _SYS_SIGNAL_H #include @@ -45,9 +44,4 @@ typedef __sigset_t sigset_t; -#endif - -/*** - END - ***/ - +#endif /* END _SYS_SIGNAL_H */ diff --git a/sys/include/sys/sysproto.h b/sys/include/sys/sysproto.h index 848203b..0f75759 100644 --- a/sys/include/sys/sysproto.h +++ b/sys/include/sys/sysproto.h @@ -1,31 +1,30 @@ -/***************************************************************************************** - Copyright (c) 2016 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: sysproto.h 171 2016-01-20 05:02:07Z reddawg $ - - *****************************************************************************************/ +/*- + * 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_SYSPROTO_H #define _SYS_SYSPROTO_H diff --git a/sys/include/sys/thread.h b/sys/include/sys/thread.h index 083a800..84b474d 100644 --- a/sys/include/sys/thread.h +++ b/sys/include/sys/thread.h @@ -1,34 +1,33 @@ -/***************************************************************************************** - Copyright (c) 2002-2004 The UbixOS Project - All rights reserved. +/*- + * 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. + */ - 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: thread.h 172 2016-01-20 13:57:36Z reddawg $ - - *****************************************************************************************/ - -#ifndef _THREAD_H_ -#define _THREAD_H_ +#ifndef _SYS_THREAD_H +#define _SYS_THREAD_H #include #include @@ -46,8 +45,4 @@ int abi; }; -#endif - -/*** - END - ***/ +#endif /* END _SYS_THREAD_H */ diff --git a/sys/include/sys/trap.h b/sys/include/sys/trap.h index 262fa7f..e3a73f5 100644 --- a/sys/include/sys/trap.h +++ b/sys/include/sys/trap.h @@ -1,34 +1,33 @@ -/***************************************************************************************** - Copyright (c) 2002-2004 The UbixOS Project - All rights reserved. +/*- + * 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. + */ - 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: trap.h 205 2016-01-23 19:18:59Z reddawg $ - - *****************************************************************************************/ - -#ifndef _TRAP_H -#define _TRAP_H +#ifndef _SYS_TRAP_H +#define _SYS_TRAP_H #include @@ -58,9 +57,4 @@ void trap( struct trapframe * ); -#endif - -/*** - END - ***/ - +#endif /* END _SYS_TRAP_H */ diff --git a/sys/include/sys/tss.h b/sys/include/sys/tss.h index 6cdf7ef..c4d7379 100644 --- a/sys/include/sys/tss.h +++ b/sys/include/sys/tss.h @@ -1,140 +1,109 @@ -/***************************************************************************************** - Copyright (c) 2002-2004 The UbixOS Project - All rights reserved. +/*- + * 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. + */ - 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: tss.h 86 2016-01-11 20:33:10Z reddawg $ - -*****************************************************************************************/ - -#ifndef _TSS_H -#define _TSS_H +#ifndef _SYS_TSS_H +#define _SYS_TSS_H #include struct tssStruct { - short back_link; - short back_link_reserved; - long esp0; - short ss0; - short ss0_reserved; - long esp1; - short ss1; - short ss1_reserved; - long esp2; - short ss2; - short ss2_reserved; - long cr3; - long eip; - long eflags; - long eax,ecx,edx,ebx; - long esp; - long ebp; - long esi; - long edi; - short es; - short es_reserved; - short cs; - short cs_reserved; - short ss; - short ss_reserved; - short ds; - short ds_reserved; - short fs; - short fs_reserved; - short gs; - short gs_reserved; - short ldt; - short ldt_reserved; - short trace_bitmap; - short io_map; - char io_space[8192]; - }; + short back_link; + short back_link_reserved; + long esp0; + short ss0; + short ss0_reserved; + long esp1; + short ss1; + short ss1_reserved; + long esp2; + short ss2; + short ss2_reserved; + long cr3; + long eip; + long eflags; + long eax, ecx, edx, ebx; + long esp; + long ebp; + long esi; + long edi; + short es; + short es_reserved; + short cs; + short cs_reserved; + short ss; + short ss_reserved; + short ds; + short ds_reserved; + short fs; + short fs_reserved; + short gs; + short gs_reserved; + short ldt; + short ldt_reserved; + short trace_bitmap; + short io_map; + char io_space[8192]; +}; struct i387Struct { - long cwd; - long swd; - long twd; - long fip; - long fcs; - long foo; - long fos; - long st_space[20]; /* 8*10 bytes for each FP-reg = 80 bytes */ - }; + long cwd; + long swd; + long twd; + long fip; + long fcs; + long foo; + long fos; + long st_space[20]; /* 8*10 bytes for each FP-reg = 80 bytes */ +}; struct i386_frame { - uint32_t gs; - uint32_t fs; - uint32_t es; - uint32_t ds; - uint32_t ss; - uint32_t edi; - uint32_t esi; - uint32_t ebp; - uint32_t esp; - uint32_t ebx; - uint32_t edx; - uint32_t ecx; - uint32_t eax; - /* - uint32_t vector; - uint32_t error_code; - */ - uint32_t eip; - uint32_t cs; - uint32_t flags; - uint32_t user_esp; - uint32_t user_ss; - }; + uint32_t gs; + uint32_t fs; + uint32_t es; + uint32_t ds; + uint32_t ss; + uint32_t edi; + uint32_t esi; + uint32_t ebp; + uint32_t esp; + uint32_t ebx; + uint32_t edx; + uint32_t ecx; + uint32_t eax; + /* + uint32_t vector; + uint32_t error_code; + */ + uint32_t eip; + uint32_t cs; + uint32_t flags; + uint32_t user_esp; + uint32_t user_ss; +}; -#endif - -/*** - $Log: tss.h,v $ - Revision 1.1.1.1 2006/06/01 12:46:15 reddawg - ubix2 - - Revision 1.2 2005/10/12 00:13:37 reddawg - Removed - - Revision 1.1.1.1 2005/09/26 17:23:53 reddawg - no message - - Revision 1.6 2004/07/27 07:42:29 reddawg - *burp* - - Revision 1.5 2004/07/27 07:40:41 reddawg - does it compile now? - - Revision 1.4 2004/07/27 07:27:50 reddawg - chg: I was fooled thought we failed but it was a casting issue - - Revision 1.3 2004/07/22 20:53:07 reddawg - atkbd: fixed problem - - Revision 1.2 2004/05/21 15:12:17 reddawg - Cleaned up - - - END - ***/ +#endif /* END _SYS_TSS_H */ diff --git a/sys/include/sys/types.h b/sys/include/sys/types.h index 77f3cdf..3eb1faf 100644 --- a/sys/include/sys/types.h +++ b/sys/include/sys/types.h @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: types.h 102 2016-01-12 03:59:34Z reddawg $ - - *****************************************************************************************/ +/*- + * 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_TYPES_H_ #define _SYS_TYPES_H_ @@ -41,14 +40,14 @@ typedef char *caddr_t; /* unsigned integrals */ -typedef __uint8_t uint8_t; +typedef __uint8_t uint8_t; typedef __uint16_t uint16_t; typedef __uint32_t uint32_t; typedef __uint64_t uint64_t; typedef __uint64_t uquad_t; /* unsigned integrals (deprecated) */ -typedef __uint8_t u_int8_t; +typedef __uint8_t u_int8_t; typedef __uint16_t u_int16_t; typedef __uint32_t u_int32_t; typedef __uint64_t u_int64_t; @@ -56,8 +55,8 @@ typedef __int64_t quad_t; -typedef __int64_t daddr_t; /* disk address */ -typedef __uint32_t u_daddr_t; /* unsigned disk address */ +typedef __int64_t daddr_t; /* disk address */ +typedef __uint32_t u_daddr_t; /* unsigned disk address */ typedef unsigned char uInt8; typedef unsigned short uInt16; @@ -67,7 +66,6 @@ typedef short Int16; typedef long Int32; - typedef unsigned char u_char; typedef unsigned short u_short; typedef unsigned int u_int; @@ -172,4 +170,4 @@ /* Combine two `digits' to make a single two-digit number. */ #define COMBINE(a, b) (((u_long)(a) << HALF_BITS) | (b)) -#endif +#endif /* END _SYS_TYPES_H */ diff --git a/sys/include/sys/uuid.h b/sys/include/sys/uuid.h index 965b0a7..2593d99 100644 --- a/sys/include/sys/uuid.h +++ b/sys/include/sys/uuid.h @@ -43,12 +43,12 @@ * A DCE 1.1 compatible source representation of UUIDs. */ struct uuid { - uint32_t time_low; - uint16_t time_mid; - uint16_t time_hi_and_version; - uint8_t clock_seq_hi_and_reserved; - uint8_t clock_seq_low; - uint8_t node[_UUID_NODE_LEN]; + uint32_t time_low; + uint16_t time_mid; + uint16_t time_hi_and_version; + uint8_t clock_seq_hi_and_reserved; + uint8_t clock_seq_low; + uint8_t node[_UUID_NODE_LEN]; }; #ifdef _KERNEL @@ -78,7 +78,7 @@ typedef struct uuid uuid_t; //__BEGIN_DECLS -int uuidgen(struct uuid *, int); +int uuidgen(struct uuid *, int); //__END_DECLS #endif /* _KERNEL */ diff --git a/sys/include/sys/video.h b/sys/include/sys/video.h index dbcb1eb..5d940cf 100644 --- a/sys/include/sys/video.h +++ b/sys/include/sys/video.h @@ -1,34 +1,33 @@ -/***************************************************************************************** - Copyright (c) 2002-2004 The UbixOS Project - All rights reserved. +/*- + * 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. + */ - 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: video.h 79 2016-01-11 16:21:27Z reddawg $ - -*****************************************************************************************/ - -#ifndef _VIDEO_H -#define _VIDEO_H +#ifndef _SYS_VIDEO_H +#define _SYS_VIDEO_H #include @@ -40,22 +39,4 @@ void kprint(char *string); void backSpace(); -#endif - -/*** - $Log: video.h,v $ - Revision 1.1.1.1 2006/06/01 12:46:15 reddawg - ubix2 - - Revision 1.2 2005/10/12 00:13:37 reddawg - Removed - - Revision 1.1.1.1 2005/09/26 17:23:53 reddawg - no message - - Revision 1.2 2004/05/21 15:12:17 reddawg - Cleaned up - - - END - ***/ +#endif /* END _SYS_VIDEO_H */ diff --git a/sys/include/ubixfs/dirCache.h b/sys/include/ubixfs/dirCache.h index c9a3ea5..710904c 100644 --- a/sys/include/ubixfs/dirCache.h +++ b/sys/include/ubixfs/dirCache.h @@ -1,28 +1,57 @@ -#ifndef DIRCACHE_H -#define DIRCACHE_H +/*- + * 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 _UBIXFS_DIRCACHE_H +#define _UBIXFS_DIRCACHE_H /* #include "ubixfs.h" */ #include struct cacheNode { - char * name; - struct cacheNode * prev; - struct cacheNode * next; - struct cacheNode * parent; - struct cacheNode * fileListHead; - struct cacheNode * fileListTail; - void * info; - int * size; - int present; - int dirty; - uInt32 * startCluster; - uInt16 * attributes; - uInt16 * permissions; -}; /* cacheNode */ + char * name; + struct cacheNode * prev; + struct cacheNode * next; + struct cacheNode * parent; + struct cacheNode * fileListHead; + struct cacheNode * fileListTail; + void * info; + int * size; + int present; + int dirty; + uInt32 * startCluster; + uInt16 * attributes; + uInt16 * permissions; +}; +/* cacheNode */ struct cacheNode * ubixfs_cacheFind(struct cacheNode *, char *); struct cacheNode * ubixfs_cacheNew(const char *); void ubixfs_cacheDelete(struct cacheNode **); struct cacheNode * ubixfs_cacheAdd(struct cacheNode *, struct cacheNode *); -#endif /* !DIRCACHE_H */ +#endif /* END _UBIXFS_DIRCACHE_H */ diff --git a/sys/include/ubixfs/ubixfs.h b/sys/include/ubixfs/ubixfs.h index 652957a..6e18062 100644 --- a/sys/include/ubixfs/ubixfs.h +++ b/sys/include/ubixfs/ubixfs.h @@ -1,34 +1,33 @@ -/***************************************************************************************** - Copyright (c) 2002-2004 The UbixOS Project - All rights reserved. +/*- + * 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. + */ - 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: ubixfs.h 79 2016-01-11 16:21:27Z reddawg $ - -*****************************************************************************************/ - -#ifndef _UBIXFS_H -#define _UBIXFS_H +#ifndef _UBIXFS_UBIXFS_H +#define _UBIXFS_UBIXFS_H #include #include @@ -36,7 +35,6 @@ #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))))) @@ -44,10 +42,8 @@ #define MAXUBIXPARTITIONS 16 #define blockSize 8 - #define EOBC -1 - #define typeFile 1 #define typeContainer 2 #define typeDirectory 4 @@ -55,12 +51,12 @@ /* Start */ struct directoryList { - char dirName[256]; - char *dirCache; - uInt32 dirBlock; - struct directoryList *next; - struct directoryList *prev; - }; + char dirName[256]; + char *dirCache; + uInt32 dirBlock; + struct directoryList *next; + struct directoryList *prev; +}; typedef struct directoryList * dirList_t; @@ -69,135 +65,90 @@ //Partition Information struct ubixDiskLabel { - uInt32 magicNum; - uInt32 magicNum2; - uInt16 driveType; - uInt16 numPartitions; - struct ubixPartitions { //the partition table - uInt32 pSize; //number of sectors in partition - uInt32 pOffset; //starting sector - uInt32 pFsSize; //filesystem basic fragment size - uInt32 pBatSize; //BAT size - uInt8 pFsType; //filesystem type, see below - uInt8 pFrag; //filesystem fragments per block + uInt32 magicNum; + uInt32 magicNum2; + uInt16 driveType; + uInt16 numPartitions; + struct ubixPartitions { //the partition table + uInt32 pSize; //number of sectors in partition + uInt32 pOffset; //starting sector + uInt32 pFsSize; //filesystem basic fragment size + uInt32 pBatSize; //BAT size + uInt8 pFsType; //filesystem type, see below + uInt8 pFrag; //filesystem fragments per block } partitions[MAXUBIXPARTITIONS]; - }; - +}; struct partitionInformation { - uInt32 size; //Size In Sectors - uInt32 startSector; //Base Sector Of Partition - uInt32 blockAllocationTable; //Base Sector Of BAT - uInt32 rootDirectory; //Base Sector Of Root Directory - }; + uInt32 size; //Size In Sectors + uInt32 startSector; //Base Sector Of Partition + uInt32 blockAllocationTable; //Base Sector Of BAT + uInt32 rootDirectory; //Base Sector Of Root Directory +}; //Block Allocation Table Entry struct blockAllocationTableEntry { - long attributes; //Block Attributes - long realSector; //Real Sector - long nextBlock; //Sector Of Next Block - long reserved; //Reserved - }; + long attributes; //Block Attributes + long realSector; //Real Sector + long nextBlock; //Sector Of Next Block + long reserved; //Reserved +}; //UbixFS Directory Entry struct directoryEntry { - uInt32 startCluster; //Starting Cluster Of File - uInt32 size; //Size Of File - uInt32 creationDate; //Date Created - uInt32 lastModified; //Date Last Modified - uInt32 uid; //UID Of Owner - uInt32 gid; //GID Of Owner - uInt16 attributes; //Files Attributes - uInt16 permissions; //Files Permissions - char fileName[256]; //File Name - }; + uInt32 startCluster; //Starting Cluster Of File + uInt32 size; //Size Of File + uInt32 creationDate; //Date Created + uInt32 lastModified; //Date Last Modified + uInt32 uid; //UID Of Owner + uInt32 gid; //GID Of Owner + uInt16 attributes; //Files Attributes + uInt16 permissions; //Files Permissions + char fileName[256]; //File Name +}; struct bootSect { - uInt8 jmp[4]; - uInt8 id[6]; - uInt16 version; - uInt16 tmp; - uInt16 fsStart; - uInt16 tmp2; - uInt32 krnl_start; - uInt BytesPerSector; - uInt SectersPerTrack; - uInt TotalHeads; - uInt32 TotalSectors; - uInt8 code[479]; - }; + uInt8 jmp[4]; + uInt8 id[6]; + uInt16 version; + uInt16 tmp; + uInt16 fsStart; + uInt16 tmp2; + uInt32 krnl_start; + uInt BytesPerSector; + uInt SectersPerTrack; + uInt TotalHeads; + uInt32 TotalSectors; + uInt8 code[479]; +}; struct ubixFSInfo { - struct blockAllocationTableEntry *blockAllocationTable; - struct cacheNode * dirCache; - uInt32 batEntries; - uInt32 rootDir; -}; /* ubixFSInfo */ + struct blockAllocationTableEntry *blockAllocationTable; + struct cacheNode * dirCache; + uInt32 batEntries; + uInt32 rootDir; +}; +/* ubixFSInfo */ int readFile(char *file); -int writeFileByte(int ch,fileDescriptor *fd,long offset); +int writeFileByte(int ch, fileDescriptor *fd, long offset); //int openFileUbixFS(char *file,fileDescriptor *fd); -int getFreeBlocks(int count,fileDescriptor *fd); +int getFreeBlocks(int count, fileDescriptor *fd); //extern struct ubixDiskLabel *diskLabel; //Good Functions //void initUbixFS(struct mountPoints *mp); -int readUbixFS(fileDescriptor *fd,char *data,uInt32,long size); -int writeUbixFS(fileDescriptor *fd,char *data,long offset,long size); +int readUbixFS(fileDescriptor *fd, char *data, uInt32, long size); +int writeUbixFS(fileDescriptor *fd, char *data, long offset, long size); void syncBat(struct vfs_mountPoint *mp); -int freeBlocks(int block,fileDescriptor *fd); -int addDirEntry(struct directoryEntry *dir,fileDescriptor *fd); -void ubixFSUnlink(char *path,struct vfs_mountPoint *mp); -int ubixFSmkDir(char *dir,fileDescriptor *fd); +int freeBlocks(int block, fileDescriptor *fd); +int addDirEntry(struct directoryEntry *dir, fileDescriptor *fd); +void ubixFSUnlink(char *path, struct vfs_mountPoint *mp); +int ubixFSmkDir(char *dir, fileDescriptor *fd); -int ubixfs_init(); -int ubixfs_initialize(); +int ubixfs_init(); +int ubixfs_initialize(); void ubixfs_thread(); - -#endif - -/*** - $Log: ubixfs.h,v $ - Revision 1.2 2006/12/05 14:10:21 reddawg - Workign Distro - - 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:53 reddawg - no message - - Revision 1.21 2004/09/14 20:57:01 reddawg - Bug fixes: macro problem over opt a multiply - - Revision 1.20 2004/08/01 17:58:39 flameshadow - chg: fixed string allocation bug in ubixfs_cacheNew() - - Revision 1.19 2004/07/27 12:02:01 reddawg - chg: fixed marks bug readFile did a lookup which is why it looked like it was loopping so much - - Revision 1.18 2004/07/23 09:10:06 reddawg - ubixfs: cleaned up some functions played with the caching a bit - vfs: renamed a bunch of functions - cleaned up a few misc bugs - - Revision 1.17 2004/07/22 22:37:03 reddawg - Caching is working now the FS is extremely fast but needs to be optimized to do 32bit copies over 8bit - - Revision 1.16 2004/07/20 21:28:16 flameshadow - oops - - Revision 1.14 2004/07/20 19:36:49 reddawg - UBU Tags - - Revision 1.13 2004/07/14 12:21:49 reddawg - ubixfs: enableUbixFs to ubixfs_init - Changed Startup Routines - - END - ***/ +#endif /* END _UBIXFS_UBIXFS_H */ diff --git a/sys/include/ubixos/access.h b/sys/include/ubixos/access.h index 44de351..773102a 100644 --- a/sys/include/ubixos/access.h +++ b/sys/include/ubixos/access.h @@ -1,54 +1,49 @@ -/***************************************************************************************** - Copyright (c) 2002-2004 The UbixOS Project - All rights reserved. +/*- + * 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. + */ - 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: vitals.h 54 2016-01-11 01:29:55Z reddawg $ - - *****************************************************************************************/ - -#ifndef _ACCESS_H_ -#define _ACCESS_H_ +#ifndef _UBIXOS_ACCESS_H +#define _UBIXOS_ACCESS_H #include struct sys_setUID_args { - uint32_t uid; + uint32_t uid; }; struct sys_setGID_args { - uint32_t gid; + 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_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 * ); +int sys_getGID(struct thread *, void *); +int sys_setGID(struct thread *, struct sys_setGID_args *); -#endif - -/*** - END - ***/ +#endif /* END _UBIXOS_ACCESS_H */ diff --git a/sys/include/ubixos/endtask.h b/sys/include/ubixos/endtask.h index 8bbde73..998623e 100644 --- a/sys/include/ubixos/endtask.h +++ b/sys/include/ubixos/endtask.h @@ -1,59 +1,37 @@ -/***************************************************************************************** - Copyright (c) 2002-2004 The UbixOS Project - All rights reserved. +/*- + * 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. + */ - 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: endtask.h 79 2016-01-11 16:21:27Z reddawg $ - -*****************************************************************************************/ - -#ifndef _ENDTASK_H -#define _ENDTASK_H +#ifndef _UBIXOS_ENDTASK_H +#define _UBIXOS_ENDTASK_H #include #include void endTask(pidType); -#endif - -/*** - $Log: endtask.h,v $ - Revision 1.2 2006/10/31 20:41:16 reddawg - Includes - - Revision 1.1.1.1 2006/06/01 12:46:13 reddawg - ubix2 - - Revision 1.2 2005/10/12 00:13:37 reddawg - Removed - - Revision 1.1.1.1 2005/09/26 17:23:54 reddawg - no message - - Revision 1.2 2004/05/21 15:20:00 reddawg - Cleaned up - - - END - ***/ +#endif /* END _UBIXOS_ENDTASK_H */ diff --git a/sys/include/ubixos/errno.h b/sys/include/ubixos/errno.h index 29d909b..516f4c0 100644 --- a/sys/include/ubixos/errno.h +++ b/sys/include/ubixos/errno.h @@ -170,7 +170,7 @@ #define EMEDIUMTYPE 124 /* Wrong medium type */ #ifndef errno -extern int errno; + extern int errno; #endif #ifdef __cplusplus diff --git a/sys/include/ubixos/exec.h b/sys/include/ubixos/exec.h index 1fc16e6..3731eaf 100644 --- a/sys/include/ubixos/exec.h +++ b/sys/include/ubixos/exec.h @@ -1,45 +1,40 @@ -/***************************************************************************************** - Copyright (c) 2002-2004 The UbixOS Project - All rights reserved. +/*- + * 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. + */ - 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: exec.h 171 2016-01-20 05:02:07Z reddawg $ - - *****************************************************************************************/ - -#ifndef _EXEC_H -#define _EXEC_H +#ifndef _UBIXOS_EXEC_H +#define _UBIXOS_EXEC_H #include #include -uInt32 execThread( void (*tproc)( void ), uInt32, char * ); -void execFile( char *file, char **argv, char **envp, int console ); +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 ** ); +int sys_exec(struct thread *, char *, char **, char **); -#endif - -/*** - END - ***/ +#endif /* END _UBIXOS_EXEC_H */ diff --git a/sys/include/ubixos/fork.h b/sys/include/ubixos/fork.h index 5369f6a..ad66125 100644 --- a/sys/include/ubixos/fork.h +++ b/sys/include/ubixos/fork.h @@ -1,34 +1,33 @@ -/***************************************************************************************** - Copyright (c) 2002-2004 The UbixOS Project - All rights reserved. +/*- + * 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. + */ - 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: fork.h 145 2016-01-17 18:44:13Z reddawg $ - -*****************************************************************************************/ - -#ifndef _FORK_H -#define _FORK_H +#ifndef _UBIXOS_FORK_H +#define _UBIXOS_FORK_H #include #include @@ -36,25 +35,4 @@ //void sysFork(); int sysFork(struct thread *, void *); -#endif - -/*** - $Log: fork.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:54 reddawg - no message - - Revision 1.3 2004/09/11 13:06:39 reddawg - fork: cleaned up comments in fork and made fork_copyProcess static - - Revision 1.2 2004/05/21 15:20:00 reddawg - Cleaned up - - - END - ***/ +#endif /* END _UBIXOS_FORK_H */ diff --git a/sys/include/ubixos/init.h b/sys/include/ubixos/init.h index 6c220a7..c4edfb8 100644 --- a/sys/include/ubixos/init.h +++ b/sys/include/ubixos/init.h @@ -1,34 +1,33 @@ -/***************************************************************************************** - Copyright (c) 2002-2004 The UbixOS Project - All rights reserved. +/*- + * 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. + */ - 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: init.h 158 2016-01-19 02:08:13Z reddawg $ - - *****************************************************************************************/ - -#ifndef _INIT_H -#define _INIT_H +#ifndef _UBIXOS_INIT_H +#define _UBIXOS_INIT_H #include #include @@ -53,10 +52,9 @@ #include #include -typedef int (*intFunctionPTR)( void ); +typedef int (*intFunctionPTR)(void); -intFunctionPTR init_tasks[] = { vmm_init, 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 }; +intFunctionPTR init_tasks[] = { vmm_init, 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, @@ -64,8 +62,4 @@ int init_tasksTotal = sizeof(init_tasks) / sizeof(intFunctionPTR); -#endif - -/*** - END - ***/ +#endif /* END _UBIXOS_INIT_H */ diff --git a/sys/include/ubixos/kmod.h b/sys/include/ubixos/kmod.h index adf8256..39a3660 100644 --- a/sys/include/ubixos/kmod.h +++ b/sys/include/ubixos/kmod.h @@ -1,80 +1,48 @@ -/***************************************************************************************** - Copyright (c) 2002-2004 The UbixOS Project - All rights reserved. +/*- + * 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. + */ - 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: kmod.h 79 2016-01-11 16:21:27Z reddawg $ - -*****************************************************************************************/ - -#ifndef _KMOD_H -#define _KMOD_H +#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]; + 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 - -/*** - $Log: kmod.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:55 reddawg - no message - - Revision 1.5 2005/08/04 20:35:19 fsdfs - - various updates. mostly kprints, tabbing code to look cleaner - - Revision 1.4 2004/09/26 20:46:13 reddawg - ok time for bed added kmod_add keeps modules listed now - - Revision 1.3 2004/09/26 20:40:51 reddawg - Added baseAddr to the kmod_t - - Revision 1.2 2004/09/26 20:39:19 reddawg - Added kmod struct type kmod_t - - Revision 1.1 2004/09/20 07:33:10 reddawg - Start of kernel modules will make it much more flexable - These modules can be either in kernel threads or system services... - - END - ***/ diff --git a/sys/include/ubixos/kpanic.h b/sys/include/ubixos/kpanic.h index 9f3586b..3adc795 100644 --- a/sys/include/ubixos/kpanic.h +++ b/sys/include/ubixos/kpanic.h @@ -1,42 +1,36 @@ -/***************************************************************************************** - Copyright (c) 2002-2004 The UbixOS Project - All rights reserved. +/*- + * 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. + */ - 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: kpanic.h 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ - -#ifndef _KPANIC_H -#define _KPANIC_H +#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 - ***/ - +#endif /* END _SYS_KPANIC_H */ diff --git a/sys/include/ubixos/ld.h b/sys/include/ubixos/ld.h index 70f5167..0dbb7a9 100644 --- a/sys/include/ubixos/ld.h +++ b/sys/include/ubixos/ld.h @@ -1,34 +1,33 @@ -/***************************************************************************************** - Copyright (c) 2002-2004 The UbixOS Project - All rights reserved. +/*- + * 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. + */ - 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: ld.h 79 2016-01-11 16:21:27Z reddawg $ - -*****************************************************************************************/ - -#ifndef _LD_H -#define _LD_H +#ifndef _UBIXOS_LD_H +#define _UBIXOS_LD_H #include @@ -36,39 +35,4 @@ uInt32 ldEnable(); -#endif - -/*** - $Log: ld.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:55 reddawg - no message - - Revision 1.10 2004/06/17 12:20:32 reddawg - Try this now solarwind - - Revision 1.9 2004/06/17 02:19:29 reddawg - Cleaning out dead code - - Revision 1.8 2004/06/16 17:32:14 reddawg - Removed Dead LD Code now part of ld.so - - Revision 1.7 2004/06/16 17:04:13 reddawg - ld.so: rest of the commit - - Revision 1.4 2004/06/13 03:05:15 reddawg - we now have a dynamic linker - - Revision 1.3 2004/06/12 01:27:26 reddawg - shared objects: yes we almost fully support shared objects - - Revision 1.2 2004/05/21 15:20:00 reddawg - Cleaned up - - END - ***/ +#endif /* END _UBIXOS_LD_H */ diff --git a/sys/include/ubixos/lists.h b/sys/include/ubixos/lists.h index ab3dedd..f730a52 100644 --- a/sys/include/ubixos/lists.h +++ b/sys/include/ubixos/lists.h @@ -1,37 +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. + */ + #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 _item_t { + Item_t *Previous; + Item_t *Next; + void *data; }; -struct _list_t -{ - Item_t *First; - Item_t *Last; +struct _list_t { + Item_t *First; + Item_t *Last; }; -List_t * +List_t * InitializeList(); Item_t * CreateItem(); int -InsertItemAtFront( IN List_t * TList, - IN Item_t * kItem); +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); +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); +RemoveItem( IN List_t * TList, IN Item_t * kItem); int DestroyItemsInList(IN List_t * ItemList); int @@ -42,10 +63,7 @@ Item_t * GetLastItem(IN List_t * kItem); List_t * -RemoveItemListBetweenItems( IN Item_t * Previous, - IN Item_t * Next); +RemoveItemListBetweenItems( IN Item_t * Previous, IN Item_t * Next); void -InsertItemListBetweenItems( IN Item_t * Previous, - IN Item_t * Next, - IN List_t * Insert); +InsertItemListBetweenItems( IN Item_t * Previous, IN Item_t * Next, IN List_t * Insert); diff --git a/sys/include/ubixos/sched.h b/sys/include/ubixos/sched.h index ec3a934..7ad269c 100644 --- a/sys/include/ubixos/sched.h +++ b/sys/include/ubixos/sched.h @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: sched.h 146 2016-01-17 18:55:56Z reddawg $ - - *****************************************************************************************/ +/*- + * 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 diff --git a/sys/include/ubixos/sem.h b/sys/include/ubixos/sem.h index 0e648e4..c4a673b 100644 --- a/sys/include/ubixos/sem.h +++ b/sys/include/ubixos/sem.h @@ -1,51 +1,32 @@ -/***************************************************************************************** - Copyright (c) 2002-2004 The UbixOS Project - All rights reserved. +/*- + * 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. + */ - 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: sem.h 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ - -#ifndef _SEM_H -#define _SEM_H +#ifndef _UBIXOS_SEM_H +#define _UBIXOS_SEM_H #endif - -/*** - $Log: sem.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:55 reddawg - no message - - Revision 1.1 2004/07/20 18:58:24 reddawg - Few fixes - - END - ***/ - diff --git a/sys/include/ubixos/smp.h b/sys/include/ubixos/smp.h index 4862656..d4a630d 100644 --- a/sys/include/ubixos/smp.h +++ b/sys/include/ubixos/smp.h @@ -1,73 +1,53 @@ -/***************************************************************************************** - Copyright (c) 2002-2004 The UbixOS Project - All rights reserved. +/*- + * 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. + */ - 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: smp.h 79 2016-01-11 16:21:27Z reddawg $ - -*****************************************************************************************/ - -#ifndef _SMP_H -#define _SMP_H +#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]; - }; - + 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 cpuid(uInt32, uInt32 *); void apicMagic(); #endif - -/*** - $Log: smp.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/05/21 15:20:00 reddawg - Cleaned up - - - END - ***/ diff --git a/sys/include/ubixos/spinlock.h b/sys/include/ubixos/spinlock.h index a4f57f4..09ee164 100644 --- a/sys/include/ubixos/spinlock.h +++ b/sys/include/ubixos/spinlock.h @@ -1,34 +1,33 @@ -/***************************************************************************************** - Copyright (c) 2002-2004 The UbixOS Project - All rights reserved. +/*- + * 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. + */ - 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: spinlock.h 79 2016-01-11 16:21:27Z reddawg $ - - *****************************************************************************************/ - -#ifndef _SPINLOCK_H -#define _SPINLOCK_H +#ifndef _UBIXOS_SPINLOCK_H +#define _UBIXOS_SPINLOCK_H #include diff --git a/sys/include/ubixos/static.h b/sys/include/ubixos/static.h index 94fe513..59986ca 100644 --- a/sys/include/ubixos/static.h +++ b/sys/include/ubixos/static.h @@ -1,3 +1,31 @@ +/*- + * 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 diff --git a/sys/include/ubixos/syscall.h b/sys/include/ubixos/syscall.h index 2143020..e24253a 100644 --- a/sys/include/ubixos/syscall.h +++ b/sys/include/ubixos/syscall.h @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: syscall.h 142 2016-01-17 02:23:20Z reddawg $ - -*****************************************************************************************/ +/*- + * 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 _SYSCALL_H #define _SYSCALL_H diff --git a/sys/include/ubixos/syscalls.h b/sys/include/ubixos/syscalls.h index 95b3869..c6956a2 100644 --- a/sys/include/ubixos/syscalls.h +++ b/sys/include/ubixos/syscalls.h @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: syscalls.h 160 2016-01-19 04:01:03Z reddawg $ - - *****************************************************************************************/ +/*- + * 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 @@ -46,13 +45,13 @@ #define SYSCALL_VALID 1 #define SYSCALL_DUMMY 2 -typedef int sys_call_t( struct thread *, void * ); +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; + int sc_args; + char *sc_name; + sys_call_t *sc_entry; + int sc_status; }; /* diff --git a/sys/include/ubixos/syscalls_new.h b/sys/include/ubixos/syscalls_new.h index 9c41a52..be63226 100644 --- a/sys/include/ubixos/syscalls_new.h +++ b/sys/include/ubixos/syscalls_new.h @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: syscalls_new.h 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ +/*- + * 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 @@ -64,465 +63,465 @@ * \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 **/ - }; +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); +int totalCalls_new = sizeof(systemCalls_new) / sizeof(functionPTR); #endif diff --git a/sys/include/ubixos/systemtask.h b/sys/include/ubixos/systemtask.h index 0f9a4c8..22589b1 100644 --- a/sys/include/ubixos/systemtask.h +++ b/sys/include/ubixos/systemtask.h @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: systemtask.h 79 2016-01-11 16:21:27Z reddawg $ - -*****************************************************************************************/ +/*- + * 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 diff --git a/sys/include/ubixos/time.h b/sys/include/ubixos/time.h index 6ad86ff..7ce4ead 100644 --- a/sys/include/ubixos/time.h +++ b/sys/include/ubixos/time.h @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: time.h 79 2016-01-11 16:21:27Z reddawg $ - -*****************************************************************************************/ +/*- + * 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 _TIME_H #define _TIME_H @@ -43,40 +42,35 @@ #define YEAR (365*DAY) #ifndef _TIME_T_DECLARED -typedef __time_t time_t; +typedef __time_t time_t; #define _TIME_T_DECLARED #endif struct timespec { - time_t tv_sec; /* seconds */ - long tv_nsec; /* and nanoseconds */ + time_t tv_sec; /* seconds */ + long tv_nsec; /* and nanoseconds */ }; - - struct timeStruct { - int sec; - int min; - int hour; - int day; - int mon; - int year; - }; - + 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 tz_minuteswest; /* minutes west of Greenwich */ + int tz_dsttime; /* type of dst correction */ +}; struct timeval { - long tv_sec; /* seconds (XXX should be time_t) */ - suseconds_t tv_usec; /* and microseconds */ - }; + long tv_sec; /* seconds (XXX should be time_t) */ + suseconds_t tv_usec; /* and microseconds */ +}; -int gettimeofday(struct timeval *tp,struct timezone *tzp); - - +int gettimeofday(struct timeval *tp, struct timezone *tzp); int time_init(); uInt32 timeMake(struct timeStruct *time); diff --git a/sys/include/ubixos/times.h b/sys/include/ubixos/times.h index 9736c20..eb575b1 100644 --- a/sys/include/ubixos/times.h +++ b/sys/include/ubixos/times.h @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: times.h 79 2016-01-11 16:21:27Z reddawg $ - -*****************************************************************************************/ +/*- + * 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 @@ -33,15 +32,15 @@ #include #ifndef _CLOCK_T_DECLARED -typedef __clock_t clock_t; +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 */ + 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 diff --git a/sys/include/ubixos/tty.h b/sys/include/ubixos/tty.h index b3d6697..4389db6 100644 --- a/sys/include/ubixos/tty.h +++ b/sys/include/ubixos/tty.h @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: tty.h 79 2016-01-11 16:21:27Z reddawg $ - - *****************************************************************************************/ +/*- + * 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 diff --git a/sys/include/ubixos/ubthread.h b/sys/include/ubixos/ubthread.h index 88a1324..8d71349 100644 --- a/sys/include/ubixos/ubthread.h +++ b/sys/include/ubixos/ubthread.h @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: ubthread.h 79 2016-01-11 16:21:27Z reddawg $ - - *****************************************************************************************/ +/*- + * 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 diff --git a/sys/include/ubixos/uthread.h b/sys/include/ubixos/uthread.h index cf5577f..ac8b160 100644 --- a/sys/include/ubixos/uthread.h +++ b/sys/include/ubixos/uthread.h @@ -1,3 +1,31 @@ +/*- + * 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 @@ -8,19 +36,19 @@ 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]; -}; + 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 } diff --git a/sys/include/ubixos/vitals.h b/sys/include/ubixos/vitals.h index 02eaf8f..33dd1c7 100644 --- a/sys/include/ubixos/vitals.h +++ b/sys/include/ubixos/vitals.h @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: vitals.h 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ +/*- + * 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 _VITALS_H #define _VITALS_H diff --git a/sys/include/ubixos/wait.h b/sys/include/ubixos/wait.h index 1abbef4..277cbb9 100644 --- a/sys/include/ubixos/wait.h +++ b/sys/include/ubixos/wait.h @@ -1,16 +1,44 @@ +/*- + * 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 #include struct wait_queue { - struct kTask_t *task; - struct wait_queue *next; + struct kTask_t *task; + struct wait_queue *next; }; struct semaphore { - int sount; - struct wait_queue *wait; + int sount; + struct wait_queue *wait; }; #define sti() __asm__ __volatile__ ("sti": : :"memory") diff --git a/sys/include/vfs/file.h b/sys/include/vfs/file.h index 8121b26..55a7a7d 100644 --- a/sys/include/vfs/file.h +++ b/sys/include/vfs/file.h @@ -1,25 +1,30 @@ -/************************************************************************************** - Copyright (c) 2002 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: file.h 159 2016-01-19 03:07:04Z reddawg $ - - **************************************************************************************/ +/*- + * 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 _VFS_FILE_H_ #define _VFS_FILE_H_ 1 diff --git a/sys/include/vfs/mount.h b/sys/include/vfs/mount.h index 86297fd..a59835d 100644 --- a/sys/include/vfs/mount.h +++ b/sys/include/vfs/mount.h @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: mount.h 79 2016-01-11 16:21:27Z reddawg $ - - *****************************************************************************************/ +/*- + * 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 _MOUNT_H #define _MOUNT_H diff --git a/sys/include/vfs/stat.h b/sys/include/vfs/stat.h index a637e14..ea5f7a0 100644 --- a/sys/include/vfs/stat.h +++ b/sys/include/vfs/stat.h @@ -1,3 +1,31 @@ +/*- + * 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 _VFS_STAT_H #define _VFS_STAT_H @@ -9,34 +37,34 @@ #define STAT_FOLLOW 0x00000001 struct __timespec { - __time_t tv_sec; /* seconds */ - long tv_nsec; /* and nanoseconds */ + __time_t tv_sec; /* seconds */ + long tv_nsec; /* and nanoseconds */ }; struct stat { - __dev_t st_dev; /* inode's device */ - ino_t st_ino; /* inode's number */ - __mode_t st_mode; /* inode protection mode */ - __nlink_t st_nlink; /* number of hard links */ - uid_t st_uid; /* user ID of the file's owner */ - gid_t st_gid; /* group ID of the file's group */ - __dev_t st_rdev; /* device type */ - time_t st_atime; /* time of last access */ - long __st_atimensec; /* nsec of last access */ - time_t st_mtime; /* time of last data modification */ - long __st_mtimensec; /* nsec of last data modification */ - time_t st_ctime; /* time of last file status change */ - long __st_ctimensec; /* nsec of last file status change */ - off_t st_size; /* file size, in bytes */ - blkcnt_t st_blocks; /* blocks allocated for file */ - blksize_t st_blksize; /* optimal blocksize for I/O */ - fflags_t st_flags; /* user defined flags for file */ - __uint32_t st_gen; /* file generation number */ - __int32_t st_lspare; - time_t st_birthtime; /* time of file creation */ - long st_birthtimensec; /* nsec of file creation */ - unsigned int :(8 / 2) * (16 - (int)sizeof(struct __timespec)); - unsigned int :(8 / 2) * (16 - (int)sizeof(struct __timespec)); + __dev_t st_dev; /* inode's device */ + ino_t st_ino; /* inode's number */ + __mode_t st_mode; /* inode protection mode */ + __nlink_t st_nlink; /* number of hard links */ + uid_t st_uid; /* user ID of the file's owner */ + gid_t st_gid; /* group ID of the file's group */ + __dev_t st_rdev; /* device type */ + time_t st_atime; /* time of last access */ + long __st_atimensec; /* nsec of last access */ + time_t st_mtime; /* time of last data modification */ + long __st_mtimensec; /* nsec of last data modification */ + time_t st_ctime; /* time of last file status change */ + long __st_ctimensec; /* nsec of last file status change */ + off_t st_size; /* file size, in bytes */ + blkcnt_t st_blocks; /* blocks allocated for file */ + blksize_t st_blksize; /* optimal blocksize for I/O */ + fflags_t st_flags; /* user defined flags for file */ + __uint32_t st_gen; /* file generation number */ + __int32_t st_lspare; + time_t st_birthtime; /* time of file creation */ + long st_birthtimensec; /* nsec of file creation */ + unsigned int :(8 / 2) * (16 - (int) sizeof(struct __timespec)); + unsigned int :(8 / 2) * (16 - (int) sizeof(struct __timespec)); }; #endif diff --git a/sys/include/vfs/vfs.h b/sys/include/vfs/vfs.h index 4633c34..a375976 100644 --- a/sys/include/vfs/vfs.h +++ b/sys/include/vfs/vfs.h @@ -1,32 +1,30 @@ -/***************************************************************************************** - 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: vfs.h 79 2016-01-11 16:21:27Z reddawg $ - - *****************************************************************************************/ - +/*- + * 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 _VFS_VFS_H #define _VFS_VFS_H diff --git a/sys/include/vmm/paging.h b/sys/include/vmm/paging.h index 30a8745..91e8d9c 100644 --- a/sys/include/vmm/paging.h +++ b/sys/include/vmm/paging.h @@ -1,27 +1,29 @@ /*- - * Copyright (c) 2002-2004, 2016, 2017 The UbixOS Project + * 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: + * This was developed by Christopher W. Olsen for the UbixOS Project. * - * 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. + * 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 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. + * 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_ @@ -49,7 +51,6 @@ #define VM_THRD 0 // Thread #define VM_TASK 1 // Task - // Page Flags #define PAGE_PRESENT 0x00000001 #define PAGE_WRITE 0x00000002 @@ -73,7 +74,6 @@ #define ctob(x) ((x)<>PAGE_SHIFT) - int vmmClearVirtualPage(uint32_t pageAddr); void vmm_unmapPage(uint32_t, int); @@ -99,7 +99,7 @@ int munmap(struct thread *, struct munmap_args *); int vmm_cleanVirtualSpace(uint32_t); -void *vmm_getFreeVirtualPage( pidType pid, int count, int type ); +void *vmm_getFreeVirtualPage(pidType pid, int count, int type); extern uint32_t *kernelPageDirectory; diff --git a/sys/include/vmm/vmm.h b/sys/include/vmm/vmm.h index 33c21ba..a96a8b8 100644 --- a/sys/include/vmm/vmm.h +++ b/sys/include/vmm/vmm.h @@ -1,31 +1,30 @@ -/***************************************************************************************** - Copyright (c) 2002-2004, 2016 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: vmm.h 232 2016-01-24 01:47:12Z reddawg $ - - *****************************************************************************************/ +/*- + * 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_ diff --git a/sys/init/main.c b/sys/init/main.c index a542dd3..c004bf8 100644 --- a/sys/init/main.c +++ b/sys/init/main.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - Copyright (c) 2002-2004, 2005, 2016 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: main.c 162 2016-01-19 15:16:01Z reddawg $ - - *****************************************************************************************/ +/*- + * 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. + */ #include #include @@ -93,7 +92,6 @@ 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 @@ -122,7 +120,8 @@ //if ( vfs_mount( 0x1, B_PARTITION(rootdev) + 2, 0x0, 0xAA, "sys", "rw" ) != 0x0 ) { if (vfs_mount(0x1, 0x2, 0x0, 0xAA, "sys", "rw") != 0x0) { kprintf("Problem Mounting sys Mount Point\n"); - } else + } + else kprintf("Mounted sys\n"); /* Do our mounting */ diff --git a/sys/init/start.S b/sys/init/start.S index 8f1fc16..6f8e4cc 100644 --- a/sys/init/start.S +++ b/sys/init/start.S @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: start.S 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ .globl _start .text diff --git a/sys/init/static.c b/sys/init/static.c index 8f1f844..ed697d8 100644 --- a/sys/init/static.c +++ b/sys/init/static.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: static.c 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include @@ -34,19 +33,19 @@ */ int static_constructors(void) { - extern void (* __ctor_list)(); - void (** l_ctor)() = &__ctor_list; - int l_ctorCount = *(int *)l_ctor; + extern void (*__ctor_list)(); + void (**l_ctor)() = &__ctor_list; + int l_ctorCount = *(int *) l_ctor; // kprintf("Calling static constructors\n"); l_ctor++; - while(l_ctorCount) { + while (l_ctorCount) { (*l_ctor)(); l_ctorCount--; l_ctor++; - } - return(0x0); } + return (0x0); +} /*** END diff --git a/sys/isa/8259.c b/sys/isa/8259.c index 8f98456..5f9d869 100644 --- a/sys/isa/8259.c +++ b/sys/isa/8259.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: 8259.c 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include @@ -40,24 +39,24 @@ * */ int i8259_init() { - outportByte(mPic, icw1); /* Initialize Master PIC */ - outportByte(sPic, icw1); /* Initialize Seconary PIC */ - outportByte(mPic+1, mVec); /* Master Interrup Vector */ - outportByte(sPic+1, sVec); /* Secondary Interrupt Vector */ - outportByte(mPic+1, 1<<2); /* Bitmask for cascade on IRQ 2 */ - outportByte(sPic+1, 2); /* Cascade on IRQ 2 */ - outportByte(mPic+1, icw4); /* Finish Primary Initialization */ - outportByte(sPic+1, icw4); /* Finish Seconary Initialization */ - outportByte(mImr, 0xff); /* Mask All Primary Interrupts */ - outportByte(sImr, 0xff); /* Mask All Seconary Interrupts */ + outportByte(mPic, icw1); /* Initialize Master PIC */ + outportByte(sPic, icw1); /* Initialize Seconary PIC */ + outportByte(mPic + 1, mVec); /* Master Interrup Vector */ + outportByte(sPic + 1, sVec); /* Secondary Interrupt Vector */ + outportByte(mPic + 1, 1 << 2); /* Bitmask for cascade on IRQ 2 */ + outportByte(sPic + 1, 2); /* Cascade on IRQ 2 */ + outportByte(mPic + 1, icw4); /* Finish Primary Initialization */ + outportByte(sPic + 1, icw4); /* Finish Seconary Initialization */ + outportByte(mImr, 0xff); /* Mask All Primary Interrupts */ + outportByte(sImr, 0xff); /* Mask All Seconary Interrupts */ /* Print out the system info for this */ - kprintf("pic0 - Port: [0x%X]\n",mPic); - kprintf("pic1 - Port: [0x%X]\n",sPic); + kprintf("pic0 - Port: [0x%X]\n", mPic); + kprintf("pic1 - Port: [0x%X]\n", sPic); /* Return so the system knows it went well */ - return(0x0); - } + return (0x0); +} /*! * \brief enable specified IRQ @@ -68,16 +67,16 @@ irqMask &= ~(1 << irqNo); if (irqNo >= 8) { irqMask &= ~(1 << 2); - } - outportByte(mPic+1, irqMask & 0xFF); - outportByte(sPic+1, (irqMask >> 8) & 0xFF); } + outportByte(mPic + 1, irqMask & 0xFF); + outportByte(sPic + 1, (irqMask >> 8) & 0xFF); +} void irqEnable(uint16_t irqNo) { uint16_t port; uint8_t value; - - if(irqNo < 8) { + + if (irqNo < 8) { port = mImr; } else { @@ -95,17 +94,17 @@ */ void irqDisable_old(u_int16_t irqNo) { irqMask |= (1 << irqNo); - if ((irqMask & 0xFF00)==0xFF00) { + if ((irqMask & 0xFF00) == 0xFF00) { irqMask |= (1 << 2); - } - outportByte(mPic+1, irqMask & 0xFF); - outportByte(sPic+1, (irqMask >> 8) & 0xFF); } + outportByte(mPic + 1, irqMask & 0xFF); + outportByte(sPic + 1, (irqMask >> 8) & 0xFF); +} void irqDisable(uint16_t irqNo) { uint16_t port; uint8_t value; - + if (irqNo < 8) { port = mImr; } @@ -114,7 +113,7 @@ irqNo -= 8; } value = inportByte(port) | (1 << irqNo); - outportByte(port, value); + outportByte(port, value); } /*** diff --git a/sys/isa/atkbd.c b/sys/isa/atkbd.c index 371621e..46d0f59 100644 --- a/sys/isa/atkbd.c +++ b/sys/isa/atkbd.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: atkbd.c 159 2016-01-19 03:07:04Z reddawg $ - - *****************************************************************************************/ +/*- + * 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. + */ #include #include @@ -154,7 +153,7 @@ ************************************************************************/ int atkbd_init() { /* Insert the IDT vector for the keyboard handler */ - setVector( &atkbd_isr, mVec + 0x1, dPresent + dInt + dDpl0 ); + setVector(&atkbd_isr, mVec + 0x1, dPresent + dInt + dDpl0); /* Set the LEDS to their defaults */ setLED(); @@ -163,13 +162,13 @@ atkbd_scan(); /* Turn on the keyboard vector */ - irqEnable( 0x1 ); + irqEnable(0x1); /* Print out information on keyboard */ - kprintf( "atkbd0 - Address: [0x%X], Keyboard Buffer: [0x%X], Buffer Size [%i]\n", &atkbd_isr, &stdinBuffer, 512 ); + kprintf("atkbd0 - Address: [0x%X], Keyboard Buffer: [0x%X], Buffer Size [%i]\n", &atkbd_isr, &stdinBuffer, 512); /* Return so we know everything went well */ - return ( 0x0 ); + return (0x0); } /* @@ -177,106 +176,106 @@ */ asm( - ".globl atkbd_isr \n" - "atkbd_isr: \n" - " pusha \n" /* Save all registers */ - " push %ss \n" - " push %ds \n" - " push %es \n" - " push %fs \n" - " push %gs \n" - " call keyboardHandler \n" - " mov $0x20,%dx \n" - " mov $0x20,%ax \n" - " outb %al,%dx \n" - " pop %gs \n" - " pop %fs \n" - " pop %es \n" - " pop %ds \n" - " pop %ss \n" - " popa \n" - " iret \n" /* Exit interrupt */ + ".globl atkbd_isr \n" + "atkbd_isr: \n" + " pusha \n" /* Save all registers */ + " push %ss \n" + " push %ds \n" + " push %es \n" + " push %fs \n" + " push %gs \n" + " call keyboardHandler \n" + " mov $0x20,%dx \n" + " mov $0x20,%ax \n" + " outb %al,%dx \n" + " pop %gs \n" + " pop %fs \n" + " pop %es \n" + " pop %ds \n" + " pop %ss \n" + " popa \n" + " iret \n" /* Exit interrupt */ ); static int atkbd_scan() { int code = 0x0; int val = 0x0; - code = inportByte( 0x60 ); - val = inportByte( 0x61 ); + code = inportByte(0x60); + val = inportByte(0x61); - outportByte( 0x61, val | 0x80 ); - outportByte( 0x61, val ); + outportByte(0x61, val | 0x80); + outportByte(0x61, val); - return ( code ); + return (code); } void keyboardHandler() { int key = 0x0; - if ( spinTryLock( &atkbdSpinLock ) ) + if (spinTryLock(&atkbdSpinLock)) return; key = atkbd_scan(); - if ( key > 255 ) + if (key > 255) return; /* Control Key */ - if ( key == 0x1D && !( controlKeys & controlKey ) ) { + if (key == 0x1D && !(controlKeys & controlKey)) { controlKeys |= controlKey; } - if ( key == 0x80 + 0x1D ) { - controlKeys &= ( 0xFF - controlKey ); + if (key == 0x80 + 0x1D) { + controlKeys &= (0xFF - controlKey); } /* ALT Key */ - if ( key == 0x38 && !( controlKeys & altKey ) ) { + if (key == 0x38 && !(controlKeys & altKey)) { controlKeys |= altKey; } - if ( key == 0x80 + 0x38 ) { - controlKeys &= ( 0xFF - altKey ); + if (key == 0x80 + 0x38) { + controlKeys &= (0xFF - altKey); } /* Shift Key */ - if ( ( key == 0x2A || key == 0x36 ) && !( controlKeys & shiftKey ) ) { + if ((key == 0x2A || key == 0x36) && !(controlKeys & shiftKey)) { controlKeys |= shiftKey; } - if ( ( key == 0x80 + 0x2A ) || ( key == 0x80 + 0x36 ) ) { - controlKeys &= ( 0xFF - shiftKey ); + if ((key == 0x80 + 0x2A) || (key == 0x80 + 0x36)) { + controlKeys &= (0xFF - shiftKey); } /* Caps Lock */ - if ( key == 0x3A ) { + if (key == 0x3A) { ledStatus ^= ledCapslock; setLED(); } /* Num Lock */ - if ( key == 0x45 ) { + if (key == 0x45) { ledStatus ^= ledNumlock; setLED(); } /* Scroll Lock */ - if ( key == 0x46 ) { + if (key == 0x46) { ledStatus ^= ledScrolllock; setLED(); } /* Pick Which Key Map */ - if ( controlKeys == 0 ) { + if (controlKeys == 0) { keyMap = 0; } - else if ( controlKeys == 1 ) { + else if (controlKeys == 1) { keyMap = 1; } - else if ( controlKeys == 2 ) { + else if (controlKeys == 2) { keyMap = 2; } - else if ( controlKeys == 4 ) { + else if (controlKeys == 4) { keyMap = 3; } /* If Key Is Not Null Add It To Handler */ - if ( ( ( uInt )( keyboardMap[key][keyMap] ) > 0 ) && ( ( uInt32 )( keyboardMap[key][keyMap] ) < 0xFF ) ) { - switch ( (uInt32) keyboardMap[key][keyMap] ) { + if (((uInt) (keyboardMap[key][keyMap]) > 0) && ((uInt32) (keyboardMap[key][keyMap]) < 0xFF)) { + switch ((uInt32) keyboardMap[key][keyMap]) { case 8: backSpace(); - if ( tty_foreground == 0x0 ) { + if (tty_foreground == 0x0) { stdinBuffer[stdinSize] = keyboardMap[key][keyMap]; stdinSize++; } @@ -284,21 +283,21 @@ tty_foreground->stdin[tty_foreground->stdinSize] = keyboardMap[key][keyMap]; tty_foreground->stdinSize++; } - break; + break; case 0x3: //if (tty_foreground != 0x0) // endTask(tty_foreground->owner); //K_PANIC( "CTRL-C pressed\n" ); - kprintf( "FreePages: [0x%X]\n", systemVitals->freePages ); - break; + kprintf("FreePages: [0x%X]\n", systemVitals->freePages); + break; case 0x9: - kprintf( "REBOOTING" ); - while ( inportByte( 0x64 ) & 0x02 ) + kprintf("REBOOTING"); + while (inportByte(0x64) & 0x02) ; - outportByte( 0x64, 0xFE ); - break; + outportByte(0x64, 0xFE); + break; default: - if ( tty_foreground == 0x0 ) { + if (tty_foreground == 0x0) { stdinBuffer[stdinSize] = keyboardMap[key][keyMap]; stdinSize++; } @@ -306,31 +305,31 @@ tty_foreground->stdin[tty_foreground->stdinSize] = keyboardMap[key][keyMap]; tty_foreground->stdinSize++; } - break; + break; } } else { - switch ( ( keyboardMap[key][keyMap] >> 8 ) ) { + switch ((keyboardMap[key][keyMap] >> 8)) { case 0x30: - tty_change( keyboardMap[key][keyMap] & 0xFF ); + tty_change(keyboardMap[key][keyMap] & 0xFF); //kprintf("Changing Consoles[0x%X:0x%X]\n",_current->id,_current); - break; + break; default: - break; + break; } } /* Return */ - spinUnlock( &atkbdSpinLock ); + spinUnlock(&atkbdSpinLock); return; } void setLED() { - outportByte( 0x60, 0xED ); - while ( inportByte( 0x64 ) & 2 ) + outportByte(0x60, 0xED); + while (inportByte(0x64) & 2) ; - outportByte( 0x60, ledStatus ); - while ( inportByte( 0x64 ) & 2 ) + outportByte(0x60, ledStatus); + while (inportByte(0x64) & 2) ; } @@ -354,34 +353,34 @@ return(0x0); */ - if ( tty_foreground == 0x0 ) { - if ( stdinSize == 0x0 ) { + if (tty_foreground == 0x0) { + if (stdinSize == 0x0) { // spinUnlock(&atkbdSpinLock); - return ( 0x0 ); + return (0x0); } retKey = stdinBuffer[0]; stdinSize--; - for ( i = 0x0; i < stdinSize ; i++ ) { + for (i = 0x0; i < stdinSize; i++) { stdinBuffer[i] = stdinBuffer[i + 0x1]; } } else { - if ( tty_foreground->stdinSize == 0x0 ) { + if (tty_foreground->stdinSize == 0x0) { // spinUnlock(&atkbdSpinLock); - return ( 0x0 ); + return (0x0); } retKey = tty_foreground->stdin[0]; tty_foreground->stdinSize--; - for ( i = 0x0; i < tty_foreground->stdinSize ; i++ ) { + for (i = 0x0; i < tty_foreground->stdinSize; i++) { tty_foreground->stdin[i] = tty_foreground->stdin[i + 0x1]; } } //spinUnlock(&atkbdSpinLock); - return ( retKey ); + return (retKey); } /*** diff --git a/sys/isa/fdc.c b/sys/isa/fdc.c index 8824f96..8e53ed1 100644 --- a/sys/isa/fdc.c +++ b/sys/isa/fdc.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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.c 79 2016-01-11 16:21:27Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include @@ -43,7 +42,7 @@ static struct spinLock fdcSpinLock = SPIN_LOCK_INITIALIZER; static volatile bool done = FALSE; -static drvGeom geometry = { dg144Heads,dg144Tracks,dg144Spt }; +static drvGeom geometry = { dg144Heads, dg144Tracks, dg144Spt }; static bool diskChange = FALSE; static bool motor = FALSE; static volatile Int8 fdcTrack = 0xff; @@ -56,24 +55,24 @@ int fdcInit2(struct device_node *dev) { dev->devInfo->size = (1024 * 1450); - return(0x0); - } + return (0x0); +} int fdc_init() { - struct device_interface *devInfo = (struct device_interface *)kmalloc(sizeof(struct device_interface)); - setVector(floppyIsr, mVec+6, (dInt+dPresent)); + struct device_interface *devInfo = (struct device_interface *) kmalloc(sizeof(struct device_interface)); + setVector(floppyIsr, mVec + 6, (dInt + dPresent)); irqEnable(6); reset(); devInfo->major = 0x0; - devInfo->init = (void *)&fdcInit2; - devInfo->read = fdcRead; + devInfo->init = (void *) &fdcInit2; + devInfo->read = fdcRead; devInfo->write = fdcWrite; - devInfo->reset = (void *)reset; - - device_add(0,'c',devInfo); - devfs_makeNode("fd0",'b',0x0,0x0); - return(0x0); - } + devInfo->reset = (void *) reset; + + device_add(0, 'c', devInfo); + devfs_makeNode("fd0", 'b', 0x0, 0x0); + return (0x0); +} asm( ".globl floppyIsr \n" @@ -86,195 +85,197 @@ " push %gs \n" " call floppyIsrhndlr \n" " pop %gs \n" - " pop %fs \n" + " pop %fs \n" " pop %es \n" " pop %ds \n" " pop %ss \n" " popa \n" " iret \n" - ); +); void floppyIsrhndlr() { done = TRUE; - outportByte(0x20,0x20); - } + outportByte(0x20, 0x20); +} void sendByte(int Int8) { volatile int msr; int tmo; - for (tmo=0;tmo<128;tmo++) { + for (tmo = 0; tmo < 128; tmo++) { msr = inportByte(fdcMsr); if ((msr & 0xc0) == 0x80) { - outportByte(fdcData,Int8); + outportByte(fdcData, Int8); return; - } - inportByte(0x80); } + inportByte(0x80); } +} int getByte() { volatile int msr; int tmo; - for (tmo=0;tmo<128;tmo++) { + for (tmo = 0; tmo < 128; tmo++) { msr = inportByte(fdcMsr); if ((msr & 0xd0) == 0xd0) { return inportByte(fdcData); - } - inportByte(0x80); } - return(-1); + inportByte(0x80); } + return (-1); +} -bool fdcRw(int block,unsigned char *blockBuffer,bool read,unsigned long numSectors) { - int head = 0x0,track = 0x0,sector = 0x0,tries= 0x0, copyCount = 0x0; - unsigned char *p_tbaddr = (unsigned char *)0x80000; +bool fdcRw(int block, unsigned char *blockBuffer, bool read, unsigned long numSectors) { + int head = 0x0, track = 0x0, sector = 0x0, tries = 0x0, copyCount = 0x0; + unsigned char *p_tbaddr = (unsigned char *) 0x80000; unsigned char *p_blockbuff = blockBuffer; //kprintf("Block: [%i]\n",block); - block2Hts(block,&head,&track,§or); + block2Hts(block, &head, &track, §or); motorOn(); if (!read && blockBuffer) { /* copy data from data buffer into track buffer */ - for (copyCount=0; copyCount<(numSectors*512); copyCount++) { + for (copyCount = 0; copyCount < (numSectors * 512); copyCount++) { *p_tbaddr = *p_blockbuff; p_blockbuff++; p_tbaddr++; - } } - for (tries = 0;tries < 3;tries++) { + } + for (tries = 0; tries < 3; tries++) { if (inportByte(fdcDir) & 0x80) { diskChange = TRUE; - seek(1); /* clear "disk change" status */ + seek(1); /* clear "disk change" status */ recalibrate(); motorOff(); kprint("FDC: Disk change detected. Trying again.\n"); return fdcRw(block, blockBuffer, read, numSectors); - } + } if (!seek(track)) { motorOff(); - kprintf("FDC: Error seeking to track [%i]\n",block); + kprintf("FDC: Error seeking to track [%i]\n", block); return FALSE; - } - outportByte(fdcCcr,0); + } + outportByte(fdcCcr, 0); if (read) { - dmaXfer(2,tbaddr,numSectors*512,FALSE); + dmaXfer(2, tbaddr, numSectors * 512, FALSE); sendByte(cmdRead); - } + } else { - dmaXfer(2,tbaddr,numSectors*512,TRUE); + dmaXfer(2, tbaddr, numSectors * 512, TRUE); sendByte(cmdWrite); - } + } sendByte(head << 2); sendByte(track); sendByte(head); sendByte(sector); - sendByte(2); /* 512 Int8s/sector */ + sendByte(2); /* 512 Int8s/sector */ sendByte(geometry.spt); if (geometry.spt == dg144Spt) { - sendByte(dg144Gap3rw); /* gap 3 size for 1.44M read/write */ - } + sendByte(dg144Gap3rw); /* gap 3 size for 1.44M read/write */ + } else { - sendByte(dg168Gap3rw); /* gap 3 size for 1.68M read/write */ - } - sendByte(0xff); /* DTL = unused */ + sendByte(dg168Gap3rw); /* gap 3 size for 1.68M read/write */ + } + sendByte(0xff); /* DTL = unused */ if (!waitFdc(TRUE)) { kprint("Timed out, trying operation again after reset()\n"); reset(); return fdcRw(block, blockBuffer, read, numSectors); - } - if ((status[0] & 0xc0) == 0) break; /* worked! outta here! */ - recalibrate(); /* oops, try again... */ } + if ((status[0] & 0xc0) == 0) + break; /* worked! outta here! */ + recalibrate(); /* oops, try again... */ + } motorOff(); if (read && blockBuffer) { p_blockbuff = blockBuffer; p_tbaddr = (unsigned char *) 0x80000; - for (copyCount=0x0; copyCount<(numSectors*512); copyCount++) { + for (copyCount = 0x0; copyCount < (numSectors * 512); copyCount++) { *p_blockbuff = *p_tbaddr; p_blockbuff++; p_tbaddr++; - } } - return (tries != 3); } + return (tries != 3); +} -void block2Hts(int block,int *head,int *track,int *sector) { +void block2Hts(int block, int *head, int *track, int *sector) { *head = (block % (geometry.spt * geometry.heads)) / (geometry.spt); *track = block / (geometry.spt * geometry.heads); *sector = block % geometry.spt + 1; - } +} void motorOn(void) { if (motor == FALSE) { - outportByte(fdcDor,0x1c); + outportByte(fdcDor, 0x1c); motor = TRUE; - } } +} void motorOff(void) { if (motor == TRUE) { //outportByte(fdcDor,0x0); //outportByte(fdcDor,0x0C); motor = FALSE; - } } +} bool seek(int track) { if (fdcTrack == track) { - return(TRUE); - } + return (TRUE); + } sendByte(cmdSeek); sendByte(0); sendByte(track); if (!waitFdc(TRUE)) { kprintf("wait fdc failed\n"); - return(FALSE); - } + return (FALSE); + } if ((sr0 != 0x20) || (fdcTrack != track)) { - return(FALSE); - } + return (FALSE); + } else { - return(TRUE); - } + return (TRUE); } +} -bool readBlock(int block,Int8 *blockBuffer, unsigned long numSectors) { - int result = 0x0,loop = 0x0; +bool readBlock(int block, Int8 *blockBuffer, unsigned long numSectors) { + int result = 0x0, loop = 0x0; if (numSectors > 1) { - for (loop=0; loop #include @@ -38,43 +37,43 @@ unsigned long Timeout; uInt8 Stat, Data; - for ( Timeout = 50000L; Timeout != 0 ; Timeout-- ) { - Stat = inportByte( 0x64 ); + for (Timeout = 50000L; Timeout != 0; Timeout--) { + Stat = inportByte(0x64); /* loop until 8042 output buffer full */ - if ( ( Stat & 0x01 ) != 0 ) { - Data = inportByte( 0x60 ); + if ((Stat & 0x01) != 0) { + Data = inportByte(0x60); /* loop if parity error or receive timeout */ - if ( ( Stat & 0xC0 ) == 0 ) + if ((Stat & 0xC0) == 0) return Data; } } return -1; } -static void kbdWrite( uInt16 port, uInt8 data ) { +static void kbdWrite(uInt16 port, uInt8 data) { uInt32 timeout; uInt8 stat; - for ( timeout = 500000L; timeout != 0 ; timeout-- ) { - stat = inportByte( 0x64 ); + for (timeout = 500000L; timeout != 0; timeout--) { + stat = inportByte(0x64); - if ( ( stat & 0x02 ) == 0 ) + if ((stat & 0x02) == 0) break; } - if ( timeout != 0 ) - outportByte( port, data ); + if (timeout != 0) + outportByte(port, data); } -static uInt8 kbdWriteRead( uInt16 port, uInt8 data, const char* expect ) { +static uInt8 kbdWriteRead(uInt16 port, uInt8 data, const char* expect) { int RetVal; - kbdWrite( port, data ); - for ( ; *expect ; expect++ ) { + kbdWrite(port, data); + for (; *expect; expect++) { RetVal = kbdRead(); - if ( ( uInt8 ) * expect != RetVal ) { + if ((uInt8) *expect != RetVal) { return RetVal; } } @@ -88,52 +87,52 @@ const uInt8* ch; Int8 cmd = 0x0; - kbdWrite( 0x64, 0xA8 ); - for ( ch = s1; *ch ; ch++ ) { - kbdWrite( 0x64, 0xD4 ); - kbdWriteRead( 0x60, *ch, "\xFA" ); + kbdWrite(0x64, 0xA8); + for (ch = s1; *ch; ch++) { + kbdWrite(0x64, 0xD4); + kbdWriteRead(0x60, *ch, "\xFA"); } - for ( ch = s2; *ch ; ch++ ) { - kbdWrite( 0x64, 0xD4 ); - kbdWriteRead( 0x60, *ch, "\xFA" ); + for (ch = s2; *ch; ch++) { + kbdWrite(0x64, 0xD4); + kbdWriteRead(0x60, *ch, "\xFA"); } - kbdWrite( 0x64, 0xD4 ); - if ( kbdWriteRead( 0x60, 0xF2, "\xFA" ) != 0x0 ) { - kprintf( "Error With Mouse\n" ); + kbdWrite(0x64, 0xD4); + if (kbdWriteRead(0x60, 0xF2, "\xFA") != 0x0) { + kprintf("Error With Mouse\n"); } cmd = kbdRead(); - kprintf( "CMD: [0x%X]\n", cmd ); - kbdWrite( 0x64, 0xD4 ); - kbdWriteRead( 0x60, 0xF4, "\xFA" ); + kprintf("CMD: [0x%X]\n", cmd); + kbdWrite(0x64, 0xD4); + kbdWriteRead(0x60, 0xF4, "\xFA"); - setVector( &mouseISR, mVec + 12, dPresent + dInt + dDpl3 ); + setVector(&mouseISR, mVec + 12, dPresent + dInt + dDpl3); - outportByte( mPic, eoi ); - outportByte( sPic, eoi ); - irqEnable( 12 ); - outportByte( mPic, eoi ); - outportByte( sPic, eoi ); + outportByte( mPic, eoi); + outportByte( sPic, eoi); + irqEnable(12); + outportByte( mPic, eoi); + outportByte( sPic, eoi); - kprintf( "psm0 - Address: [0x%X]\n", &mouseISR ); + kprintf("psm0 - Address: [0x%X]\n", &mouseISR); /* Return so we know everything went well */ - return ( 0x0 ); + return (0x0); } asm( - ".globl mouseISR \n" - "mouseISR: \n" - " pusha \n" /* Save all registers */ - " call mouseHandler \n" - " popa \n" - " iret \n" /* Exit interrupt */ + ".globl mouseISR \n" + "mouseISR: \n" + " pusha \n" /* Save all registers */ + " call mouseHandler \n" + " popa \n" + " iret \n" /* Exit interrupt */ ); void mouseHandler() { - kprintf( "MOUSE!!!\n" ); + kprintf("MOUSE!!!\n"); - outportByte( mPic, eoi ); - outportByte( sPic, eoi ); + outportByte( mPic, eoi); + outportByte( sPic, eoi); /* Return */ return; } diff --git a/sys/isa/ne2k.c b/sys/isa/ne2k.c index cda23ce..ffe2dfe 100644 --- a/sys/isa/ne2k.c +++ b/sys/isa/ne2k.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: ne2k.c 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include @@ -40,15 +39,14 @@ #include #include - static struct spinLock ne2k_spinLock = SPIN_LOCK_INITIALIZER; -static int dp_pkt2user(struct device *dev,int page,int length); -static void getblock(struct device *dev,int page,size_t offset,size_t size,void *dst); +static int dp_pkt2user(struct device *dev, int page, int length); +static void getblock(struct device *dev, int page, size_t offset, size_t size, void *dst); static int dp_recv(struct device *); static struct nicBuffer *ne2kBuffer = 0x0; -static struct device *mDev = 0x0; +static struct device *mDev = 0x0; asm( ".globl ne2kISR \n" @@ -57,36 +55,36 @@ " call ne2kHandler \n" " popa \n" " iret \n" /* Exit interrupt */ - ); +); /************************************************************************ -Function: int ne2kInit(uInt32 ioAddr) -Description: This Function Will Initialize The Programmable Timer + Function: int ne2kInit(uInt32 ioAddr) + Description: This Function Will Initialize The Programmable Timer -Notes: + Notes: -************************************************************************/ + ************************************************************************/ int ne2k_init() { - mDev = (struct device *)kmalloc(sizeof(struct device)); + mDev = (struct device *) kmalloc(sizeof(struct device)); mDev->ioAddr = 0x280; - mDev->irq = 10; - setVector(&ne2kISR, mVec+10, dPresent + dInt + dDpl0); + mDev->irq = 10; + setVector(&ne2kISR, mVec + 10, dPresent + dInt + dDpl0); irqEnable(10); // kprintf("ne0 - irq: %i, ioAddr: 0x%X MAC: %X:%X:%X:%X:%X:%X\n",dev->irq,dev->ioAddr,dev->net->mac[0] & 0xFF,dev->net->mac[1] & 0xFF,dev->net->mac[2] & 0xFF,dev->net->mac[3] & 0xFF,dev->net->mac[4] & 0xFF,dev->net->mac[5] & 0xFF); outportByte(mDev->ioAddr + NE_CMD, 0x21); // stop mode - outportByte(mDev->ioAddr + NE_DCR,0x29); // 0x29 data config reg - outportByte(mDev->ioAddr + NE_RBCR0,0x00); // LOW byte count (remote) - outportByte(mDev->ioAddr + NE_RBCR1,0x00); // HIGH byte count (remote) - outportByte(mDev->ioAddr + NE_RCR,0x3C); // receive config reg - outportByte(mDev->ioAddr + NE_TCR,0x02); // LOOP mode (temp) - outportByte(mDev->ioAddr + NE_PSTART,startPage); // 0x26 PAGE start - outportByte(mDev->ioAddr + NE_BNRY,startPage); // 0x26 BOUNDARY - outportByte(mDev->ioAddr + NE_PSTOP,stopPage); // 0x40 PAGE stop - outportByte(mDev->ioAddr + NE_ISR,0xFF); // interrupt status reg - outportByte(mDev->ioAddr + NE_IMR,0x0B); - outportByte(mDev->ioAddr + NE_CMD,0x61); // PAGE 1 regs + outportByte(mDev->ioAddr + NE_DCR, 0x29); // 0x29 data config reg + outportByte(mDev->ioAddr + NE_RBCR0, 0x00); // LOW byte count (remote) + outportByte(mDev->ioAddr + NE_RBCR1, 0x00); // HIGH byte count (remote) + outportByte(mDev->ioAddr + NE_RCR, 0x3C); // receive config reg + outportByte(mDev->ioAddr + NE_TCR, 0x02); // LOOP mode (temp) + outportByte(mDev->ioAddr + NE_PSTART, startPage); // 0x26 PAGE start + outportByte(mDev->ioAddr + NE_BNRY, startPage); // 0x26 BOUNDARY + outportByte(mDev->ioAddr + NE_PSTOP, stopPage); // 0x40 PAGE stop + outportByte(mDev->ioAddr + NE_ISR, 0xFF); // interrupt status reg + outportByte(mDev->ioAddr + NE_IMR, 0x0B); + outportByte(mDev->ioAddr + NE_CMD, 0x61); // PAGE 1 regs outportByte(mDev->ioAddr + DP_MAR0, 0xFF); outportByte(mDev->ioAddr + DP_MAR1, 0xFF); @@ -97,147 +95,147 @@ outportByte(mDev->ioAddr + DP_MAR6, 0xFF); outportByte(mDev->ioAddr + DP_MAR7, 0xFF); outportByte(mDev->ioAddr + DP_CURR, startPage + 1); - outportByte(mDev->ioAddr + NE_CMD, 0x20); - inportByte(mDev->ioAddr + DP_CNTR0); /* reset counters by reading */ + outportByte(mDev->ioAddr + NE_CMD, 0x20); + inportByte(mDev->ioAddr + DP_CNTR0); /* reset counters by reading */ inportByte(mDev->ioAddr + DP_CNTR1); inportByte(mDev->ioAddr + DP_CNTR2); - outportByte(mDev->ioAddr + NE_TCR, 0x00); + outportByte(mDev->ioAddr + NE_TCR, 0x00); outportByte(mDev->ioAddr + NE_CMD, 0x0); outportByte(mDev->ioAddr + NE_DCR, 0x29); kprintf("Initialized"); /* Return so we know everything went well */ - return(0x0); - } + return (0x0); +} -int PCtoNIC(struct device *dev,void *packet,int length) { - int i = 0x0; - uInt16 *packet16 = (uInt16 *)packet; - uInt8 *packet8 = (uInt8 *)packet; - uInt8 word16 = 0x1; +int PCtoNIC(struct device *dev, void *packet, int length) { + int i = 0x0; + uInt16 *packet16 = (uInt16 *) packet; + uInt8 *packet8 = (uInt8 *) packet; + uInt8 word16 = 0x1; if ((inportByte(dev->ioAddr) & 0x04) == 0x04) { kpanic("Device Not Ready\n"); - } + } assert(length); if ((word16 == 1) && (length & 0x01)) { length++; - } - - outportByte(dev->ioAddr+EN0_RCNTLO,(length & 0xFF)); - outportByte(dev->ioAddr+EN0_RCNTHI,(length >> 8)); - - outportByte(dev->ioAddr+EN0_RSARLO,0x0); - outportByte(dev->ioAddr+EN0_RSARHI,0x41); - - outportByte(dev->ioAddr,E8390_RWRITE+E8390_START); - - if (word16 != 0x0) { - for(i=0;iioAddr + NE_DATAPORT,packet16[i]); - } - } - else { - for(i=0;iioAddr + NE_DATAPORT,packet8[i]); - } - } - - for (i = 0;i<=100;i++) { - if ((inportByte(dev->ioAddr+EN0_ISR) & 0x40) == 0x40) { - break; - } - } - - outportByte(dev->ioAddr+EN0_ISR,0x40); - outportByte(dev->ioAddr+EN0_TPSR,0x41);//ei_local->txStartPage); - outportByte(dev->ioAddr+0x05,(length & 0xFF)); - outportByte(dev->ioAddr+0x06,(length >> 8)); - outportByteP(dev->ioAddr,0x26); - //kprintf("SENT\n"); - return(length); } -int NICtoPC(struct device *dev,void *packet,int length,int nic_addr) { + outportByte(dev->ioAddr + EN0_RCNTLO, (length & 0xFF)); + outportByte(dev->ioAddr + EN0_RCNTHI, (length >> 8)); + + outportByte(dev->ioAddr + EN0_RSARLO, 0x0); + outportByte(dev->ioAddr + EN0_RSARHI, 0x41); + + outportByte(dev->ioAddr, E8390_RWRITE + E8390_START); + + if (word16 != 0x0) { + for (i = 0; i < length / 2; i++) { + outportWord(dev->ioAddr + NE_DATAPORT, packet16[i]); + } + } + else { + for (i = 0; i < length; i++) { + outportByte(dev->ioAddr + NE_DATAPORT, packet8[i]); + } + } + + for (i = 0; i <= 100; i++) { + if ((inportByte(dev->ioAddr + EN0_ISR) & 0x40) == 0x40) { + break; + } + } + + outportByte(dev->ioAddr + EN0_ISR, 0x40); + outportByte(dev->ioAddr + EN0_TPSR, 0x41); //ei_local->txStartPage); + outportByte(dev->ioAddr + 0x05, (length & 0xFF)); + outportByte(dev->ioAddr + 0x06, (length >> 8)); + outportByteP(dev->ioAddr, 0x26); + //kprintf("SENT\n"); + return (length); +} + +int NICtoPC(struct device *dev, void *packet, int length, int nic_addr) { int i = 0x0; - uInt16 *packet16 = (uInt16 *)packet; + uInt16 *packet16 = (uInt16 *) packet; assert(length); - + if (length & 0x01) length++; - + outportByte(dev->ioAddr + EN0_RCNTLO, (length & 0xFF)); + outportByte(dev->ioAddr + EN0_RCNTHI, (length >> 8)); - outportByte(dev->ioAddr+EN0_RCNTLO,(length & 0xFF)); - outportByte(dev->ioAddr+EN0_RCNTHI,(length >> 8)); + outportByte(dev->ioAddr + EN0_RSARLO, nic_addr & 0xFF); + outportByte(dev->ioAddr + EN0_RSARHI, nic_addr >> 8); - outportByte(dev->ioAddr+EN0_RSARLO,nic_addr & 0xFF); - outportByte(dev->ioAddr+EN0_RSARHI,nic_addr >> 8); + outportByte(dev->ioAddr, 0x0A); - outportByte(dev->ioAddr,0x0A); - - for(i=0;iioAddr + NE_DATAPORT); - } - - outportByte(dev->ioAddr+EN0_ISR,0x40); - return(length); } + outportByte(dev->ioAddr + EN0_ISR, 0x40); + return (length); +} + void ne2kHandler() { - uInt16 isr = 0x0; + uInt16 isr = 0x0; uInt16 status = 0x0; - + irqDisable(10); outportByte(mPic, eoi); outportByte(sPic, eoi); - + asm("sti"); isr = inportByte(mDev->ioAddr + NE_ISR); - + if ((isr & 0x02) == 0x02) { outportByte(mDev->ioAddr + NE_ISR, 0x0A); status = inportByte(0x280 + NE_TPSR); - } + } if ((isr & 0x01) == 0x01) { if (dp_recv(mDev)) { kprintf("Error Getting Packet\n"); - } - outportByte(mDev->ioAddr + NE_ISR, 0x05); } - - outportByte(mDev->ioAddr + NE_IMR,0x0); - outportByte(mDev->ioAddr + NE_IMR,0x0B); - + outportByte(mDev->ioAddr + NE_ISR, 0x05); + } + + outportByte(mDev->ioAddr + NE_IMR, 0x0); + outportByte(mDev->ioAddr + NE_IMR, 0x0B); + asm("cli"); irqEnable(10); return; - } +} static int dp_recv(struct device *dev) { dp_rcvhdr_t header; unsigned int pageno = 0x0, curr = 0x0, next = 0x0; int packet_processed = 0x0, r = 0x0; - uInt16 eth_type = 0x0; + uInt16 eth_type = 0x0; uInt32 length = 0x0; pageno = inportByte(dev->ioAddr + NE_BNRY) + 1; - if (pageno == stopPage) pageno = startPage; + if (pageno == stopPage) + pageno = startPage; do { outportByte(dev->ioAddr + NE_CMD, 0x40); curr = inportByte(dev->ioAddr + NE_CURRENT); outportByte(dev->ioAddr, 0x0); - if (curr == pageno) break; - getblock(dev, pageno, (size_t)0, sizeof(header), &header); - getblock(dev, pageno, sizeof(header) + 2*sizeof(ether_addr_t), sizeof(eth_type), ð_type); + if (curr == pageno) + break; + getblock(dev, pageno, (size_t) 0, sizeof(header), &header); + getblock(dev, pageno, sizeof(header) + 2 * sizeof(ether_addr_t), sizeof(eth_type), ð_type); length = (header.dr_rbcl | (header.dr_rbch << 8)) - sizeof(dp_rcvhdr_t); next = header.dr_next; @@ -245,26 +243,26 @@ //kprintf("length: [0x%X:0x%X:0x%X]\n",header.dr_next,header.dr_status,length); if (length < 60 || length > 1514) { - kprintf("dp8390: packet with strange length arrived: %d\n",length); - next= curr; - } + kprintf("dp8390: packet with strange length arrived: %d\n", length); + next = curr; + } else if (next < startPage || next >= stopPage) { kprintf("dp8390: strange next page\n"); - next= curr; - } + next = curr; + } else if (header.dr_status & RSR_FO) { kpanic("dp8390: fifo overrun, resetting receive buffer\n"); next = curr; - } + } else if (header.dr_status & RSR_PRX) { r = dp_pkt2user(dev, pageno, length); if (r != OK) { kprintf("FRUIT"); - return(0x0); - } + return (0x0); + } packet_processed = 0x1; - } + } if (next == startPage) outportByte(dev->ioAddr + NE_BNRY, stopPage - 1); else @@ -272,89 +270,90 @@ pageno = next; - } while (packet_processed == 0x0); - return(0x0); - } + } while (packet_processed == 0x0); + return (0x0); +} -static void getblock(struct device *dev,int page,size_t offset,size_t size,void *dst) { - uInt16 *ha = 0x0; - int i = 0x0; +static void getblock(struct device *dev, int page, size_t offset, size_t size, void *dst) { + uInt16 *ha = 0x0; + int i = 0x0; - ha = (uInt16 *) dst; - offset = page * DP_PAGESIZE + offset; - outportByte(dev->ioAddr + NE_RBCR0, size & 0xFF); - outportByte(dev->ioAddr + NE_RBCR1, size >> 8); - outportByte(dev->ioAddr + EN0_RSARLO, offset & 0xFF); - outportByte(dev->ioAddr + EN0_RSARHI, offset >> 8); - outportByte(dev->ioAddr + NE_CMD, E8390_RREAD | E8390_START); + ha = (uInt16 *) dst; + offset = page * DP_PAGESIZE + offset; + outportByte(dev->ioAddr + NE_RBCR0, size & 0xFF); + outportByte(dev->ioAddr + NE_RBCR1, size >> 8); + outportByte(dev->ioAddr + EN0_RSARLO, offset & 0xFF); + outportByte(dev->ioAddr + EN0_RSARHI, offset >> 8); + outportByte(dev->ioAddr + NE_CMD, E8390_RREAD | E8390_START); - size /= 2; - for (i= 0; iioAddr + NE_DATAPORT); - outportByte(dev->ioAddr+EN0_ISR,0x40); - } - -static int dp_pkt2user(struct device *dev,int page,int length) { + size /= 2; + for (i = 0; i < size; i++) + ha[i] = inportWord(dev->ioAddr + NE_DATAPORT); + outportByte(dev->ioAddr + EN0_ISR, 0x40); +} + +static int dp_pkt2user(struct device *dev, int page, int length) { int last = 0x0; struct nicBuffer *tmpBuf = 0x0; - + last = page + (length - 1) / DP_PAGESIZE; if (last >= stopPage) { kprintf("FOOK STOP PAGE!!!"); - } + } else { tmpBuf = ne2kAllocBuffer(length); - NICtoPC(dev,tmpBuf->buffer,length,page * DP_PAGESIZE + sizeof(dp_rcvhdr_t)); - } - return(OK); + NICtoPC(dev, tmpBuf->buffer, length, page * DP_PAGESIZE + sizeof(dp_rcvhdr_t)); } + return (OK); +} struct nicBuffer *ne2kAllocBuffer(int length) { struct nicBuffer *tmpBuf = 0x0; - + spinLock(&ne2k_spinLock); - + if (ne2kBuffer == 0x0) { - ne2kBuffer = (struct nicBuffer *)kmalloc(sizeof(struct nicBuffer)); - ne2kBuffer->next = 0x0; + ne2kBuffer = (struct nicBuffer *) kmalloc(sizeof(struct nicBuffer)); + ne2kBuffer->next = 0x0; ne2kBuffer->length = length; - ne2kBuffer->buffer = (char *)kmalloc(length); + ne2kBuffer->buffer = (char *) kmalloc(length); spinUnlock(&ne2k_spinLock); - return(ne2kBuffer); - } - else { - for (tmpBuf = ne2kBuffer;tmpBuf->next != 0x0;tmpBuf = tmpBuf->next); - - tmpBuf->next = (struct nicBuffer *)kmalloc(sizeof(struct nicBuffer)); - tmpBuf = tmpBuf->next; - tmpBuf->next = 0x0; - tmpBuf->length = length; - tmpBuf->buffer = (char *)kmalloc(length); - spinUnlock(&ne2k_spinLock); - return(tmpBuf); - } - spinUnlock(&ne2k_spinLock); - return(0x0); + return (ne2kBuffer); } + else { + for (tmpBuf = ne2kBuffer; tmpBuf->next != 0x0; tmpBuf = tmpBuf->next) + ; + + tmpBuf->next = (struct nicBuffer *) kmalloc(sizeof(struct nicBuffer)); + tmpBuf = tmpBuf->next; + tmpBuf->next = 0x0; + tmpBuf->length = length; + tmpBuf->buffer = (char *) kmalloc(length); + spinUnlock(&ne2k_spinLock); + return (tmpBuf); + } + spinUnlock(&ne2k_spinLock); + return (0x0); +} struct nicBuffer *ne2kGetBuffer() { struct nicBuffer *tmpBuf = 0x0; - + if (ne2k_spinLock == 0x1) - return(0x0); - - tmpBuf = ne2kBuffer; + return (0x0); + + tmpBuf = ne2kBuffer; if (ne2kBuffer != 0x0) ne2kBuffer = ne2kBuffer->next; - return(tmpBuf); - } + return (tmpBuf); +} void ne2kFreeBuffer(struct nicBuffer *buf) { kfree(buf->buffer); kfree(buf); return; - } +} /*** diff --git a/sys/isa/pit.c b/sys/isa/pit.c index c22a238..49467b3 100644 --- a/sys/isa/pit.c +++ b/sys/isa/pit.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: pit.c 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include @@ -44,34 +43,34 @@ 0042 r/w PIT counter 2, cassette & speaker (XT, AT, PS/2) 0043 r/w PIT mode port, control word register for counters 0-2 - bit 7-6 = 00 counter 0 select - = 01 counter 1 select (not PS/2) - = 10 counter 2 select - bit 5-4 = 00 counter latch command - = 01 read/write counter bits 0-7 only - = 10 read/write counter bits 8-15 only - = 11 read/write counter bits 0-7 first, then 8-15 - bit 3-1 = 000 mode 0 select - = 001 mode 1 select - programmable one shot - = x10 mode 2 select - rate generator - = x11 mode 3 select - square wave generator - = 100 mode 4 select - software triggered strobe - = 101 mode 5 select - hardware triggered strobe - bit 0 = 0 binary counter 16 bits - = 1 BCD counter + bit 7-6 = 00 counter 0 select + = 01 counter 1 select (not PS/2) + = 10 counter 2 select + bit 5-4 = 00 counter latch command + = 01 read/write counter bits 0-7 only + = 10 read/write counter bits 8-15 only + = 11 read/write counter bits 0-7 first, then 8-15 + bit 3-1 = 000 mode 0 select + = 001 mode 1 select - programmable one shot + = x10 mode 2 select - rate generator + = x11 mode 3 select - square wave generator + = 100 mode 4 select - software triggered strobe + = 101 mode 5 select - hardware triggered strobe + bit 0 = 0 binary counter 16 bits + = 1 BCD counter -*****************************************************************************************/ + *****************************************************************************************/ int pit_init() { - outportByteP(0x43,0x36); - outportByteP(0x40,((1193180/PIT_TIMER) & 0xFF)); - outportByte(0x40,(((1193180/PIT_TIMER) >> 8) & 0xFF)); + outportByteP(0x43, 0x36); + outportByteP(0x40, ((1193180 / PIT_TIMER) & 0xFF)); + outportByte(0x40, (((1193180 / PIT_TIMER) >> 8) & 0xFF)); /* Print out information on the PIT */ - kprintf("pit0 - Port [0x%X], Timer Hz: [%iHz]\n",0x43,PIT_TIMER); + kprintf("pit0 - Port [0x%X], Timer Hz: [%iHz]\n", 0x43, PIT_TIMER); /* Return so we know everything went well */ - return(0x0); - } + return (0x0); +} /*** $Log: pit.c,v $ diff --git a/sys/isa/rs232.c b/sys/isa/rs232.c index 496af5e..6711cb6 100644 --- a/sys/isa/rs232.c +++ b/sys/isa/rs232.c @@ -1,35 +1,34 @@ -/***************************************************************************************** - Copyright (c) 2002 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: rs232.c 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ void rs232Init() { return; - } +} /*** diff --git a/sys/kernel/access.c b/sys/kernel/access.c index 639b76d..ab9eda6 100644 --- a/sys/kernel/access.c +++ b/sys/kernel/access.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - Copyright (c) 2016 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: access.c 159 2016-01-19 03:07:04Z reddawg $ - - *****************************************************************************************/ +/*- + * 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. + */ #include @@ -42,29 +41,29 @@ ************************************************************************/ -int sys_setUID( struct thread *td, struct sys_setUID_args *args ) { - if ( _current->uid == 0x0 ) { +int sys_setUID(struct thread *td, struct sys_setUID_args *args) { + if (_current->uid == 0x0) { _current->uid = args->uid; return (0); } return (-1); } -int sys_getUID( struct thread *td, void *uap ) { +int sys_getUID(struct thread *td, void *uap) { return (_current->uid); } -int sys_getEUID( struct thread *td, void *uap ) { +int sys_getEUID(struct thread *td, void *uap) { return (_current->uid); } -int sys_getGID( struct thread *td, void *uap ) { +int sys_getGID(struct thread *td, void *uap) { return (_current->gid); } -int sys_setGID( struct thread *td, struct sys_setGID_args *uap ) { +int sys_setGID(struct thread *td, struct sys_setGID_args *uap) { - if ( _current->gid == 0x0 ) { + if (_current->gid == 0x0) { _current->gid = uap->gid; @@ -75,18 +74,17 @@ return (-1); } -int in_group_p(gid_t grp) -{ - int i; +int in_group_p(gid_t grp) { + int i; - if (grp == _current->egid) - return 1; + if (grp == _current->egid) + return 1; - for (i = 0; i < NGROUPS; i++) { - if (_current->groups[i] == NOGROUP) - break; - if (_current->groups[i] == grp) - return 1; - } - return 0; + for (i = 0; i < NGROUPS; i++) { + if (_current->groups[i] == NOGROUP) + break; + if (_current->groups[i] == grp) + return 1; + } + return 0; } diff --git a/sys/kernel/elf.c b/sys/kernel/elf.c index be3d4c5..627814e 100644 --- a/sys/kernel/elf.c +++ b/sys/kernel/elf.c @@ -1,27 +1,29 @@ /*- - * Copyright (c) 2002-2004, 2018 The UbixOS Project + * 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: + * This was developed by Christopher W. Olsen for the UbixOS Project. * - * 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. + * 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 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. + * 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. */ #include diff --git a/sys/kernel/endtask.c b/sys/kernel/endtask.c index f204767..9cadda3 100644 --- a/sys/kernel/endtask.c +++ b/sys/kernel/endtask.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: endtask.c 79 2016-01-11 16:21:27Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include @@ -36,19 +35,19 @@ /************************************************************************ -Function: endTask(pidType pid) + Function: endTask(pidType pid) -Description: This will do cleanup for an ending task + Description: This will do cleanup for an ending task -Notes: + Notes: -************************************************************************/ + ************************************************************************/ void endTask(pidType pid) { //kTask_t *tmpTask = 0x0; /* Don't mess with scheduler structures from outside the scheduler! */ /* Just set status to dead, and let the scheduler clean up itself */ - sched_setStatus(pid,DEAD); + sched_setStatus(pid, DEAD); //tmpTask = schedFindTask(pid); //if (sched_deleteTask(pid) != 0x0) // kpanic("sched_deleteTask: Failed\n"); @@ -59,12 +58,12 @@ //tmpTask->term->owner = tmpTask->parentPid; if (pid == _current->id) - while(1) + while (1) sched_yield(); sched_yield(); return; - } +} /*** END diff --git a/sys/kernel/execve.c b/sys/kernel/execve.c index f560a64..ced8d21 100644 --- a/sys/kernel/execve.c +++ b/sys/kernel/execve.c @@ -1,3 +1,31 @@ +/*- + * 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. + */ + #include #include #include diff --git a/sys/kernel/gen_calls.c b/sys/kernel/gen_calls.c index ca2372d..987555a 100644 --- a/sys/kernel/gen_calls.c +++ b/sys/kernel/gen_calls.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - Copyright (c) 2002-2004, 2016 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: gen_calls.c 169 2016-01-20 01:10:22Z reddawg $ - - *****************************************************************************************/ +/*- + * 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. + */ #include #include diff --git a/sys/kernel/kern_descrip.c b/sys/kernel/kern_descrip.c index 04bbbf0..2e85f83 100644 --- a/sys/kernel/kern_descrip.c +++ b/sys/kernel/kern_descrip.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: kern_descrip.c 79 2016-01-11 16:21:27Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include @@ -38,89 +37,89 @@ int fcntl(struct thread *td, struct fcntl_args *uap) { struct file *fp = 0x0; - #ifdef DEBUG +#ifdef DEBUG kprintf("[%s:%i]",__FILE__,__LINE__); - #endif +#endif if (td->o_files[uap->fd] == 0x0) { kprintf("ERROR!!!\n"); - return(-1); - } + return (-1); + } - fp = (struct file *)td->o_files[uap->fd]; + fp = (struct file *) td->o_files[uap->fd]; switch (uap->cmd) { case 3: td->td_retval[0] = fp->f_flag; - break; + break; case 4: - fp->f_flag &= ~FCNTLFLAGS; - fp->f_flag |= FFLAGS(uap->arg & ~O_ACCMODE) & FCNTLFLAGS; - break; + fp->f_flag &= ~FCNTLFLAGS; + fp->f_flag |= FFLAGS(uap->arg & ~O_ACCMODE) & FCNTLFLAGS; + break; default: kprintf("ERROR DEFAULT"); - } - - return(0x0); } -int falloc(struct thread *td,struct file **resultfp, int *resultfd) { + return (0x0); +} + +int falloc(struct thread *td, struct file **resultfp, int *resultfd) { struct file *fp = 0x0; int i = 0; - #ifdef DEBUG +#ifdef DEBUG kprintf("[%s:%i]",__FILE__,__LINE__); - #endif +#endif - fp = (struct file *)kmalloc(sizeof(struct file)); + fp = (struct file *) kmalloc(sizeof(struct file)); /* First 5 Descriptors Are Reserved */ - for (i = 5;i<1024;i++) { + for (i = 5; i < 1024; i++) { if (td->o_files[i] == 0x0) { - td->o_files[i] = (void *)fp; - if (resultfd) - *resultfd = i; - if (resultfp) - *resultfp = fp; + td->o_files[i] = (void *) fp; + if (resultfd) + *resultfd = i; + if (resultfp) + *resultfp = fp; break; - } - } - return(0x0); + } } + return (0x0); +} -int close(struct thread *td,struct close_args *uap) { - #ifdef DEBUG +int close(struct thread *td, struct close_args *uap) { +#ifdef DEBUG kprintf("[%s:%i]",__FILE__,__LINE__); - #endif - kfree((void *)td->o_files[uap->fd]); +#endif + kfree((void *) td->o_files[uap->fd]); td->o_files[uap->fd] = 0x0; - td->td_retval[0] = 0x0; - return(0x0); - } + td->td_retval[0] = 0x0; + return (0x0); +} /*! * \brief return data table size */ int getdtablesize(struct thread *td, struct getdtablesize_args *uap) { - #ifdef DEBUG +#ifdef DEBUG kprintf("[%s:%i]",__FILE__,__LINE__); - #endif +#endif td->td_retval[0] = O_FILES; return (0); - } +} /* HACK */ -int fstat(struct thread *td,struct fstat_args *uap) { +int fstat(struct thread *td, struct fstat_args *uap) { struct file *fp = 0x0; - #ifdef DEBUG +#ifdef DEBUG kprintf("[%s:%i]",__FILE__,__LINE__); - #endif +#endif - fp = (struct file *)_current->td.o_files[uap->fd]; - uap->sb->st_mode = 0x2180; + fp = (struct file *) _current->td.o_files[uap->fd]; + uap->sb->st_mode = 0x2180; uap->sb->st_blksize = 0x1000; - kprintf("fstat: %i",uap->fd); - return(0x0); - } + kprintf("fstat: %i", uap->fd); + return (0x0); +} /*! * \brief ioctl functionality not implimented yet @@ -129,28 +128,28 @@ */ int ioctl(struct thread *td, struct ioctl_args *uap) { td->td_retval[0] = 0x0; - return(0x0); - } + return (0x0); +} /*! * \brief get pointer to file fd in specified thread * * \return returns fp */ -int getfd(struct thread *td,struct file **fp,int fd) { +int getfd(struct thread *td, struct file **fp, int fd) { int error = 0x0; - #ifdef DEBUG +#ifdef DEBUG kprintf("[%s:%i]",__FILE__,__LINE__); - #endif +#endif - *fp = (struct file *)td->o_files[fd]; + *fp = (struct file *) td->o_files[fd]; if (fp == 0x0) error = -1; - return(error); - } + return (error); +} /*** END diff --git a/sys/kernel/kern_execve.c b/sys/kernel/kern_execve.c index 7134720..05d046f 100644 --- a/sys/kernel/kern_execve.c +++ b/sys/kernel/kern_execve.c @@ -1,4 +1,30 @@ -/* Kernel EXECVE */ +/*- + * 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. + */ int kern_execve(const char *file, char **argv, char **envp) { return(0); diff --git a/sys/kernel/kern_sig.c b/sys/kernel/kern_sig.c index 86bc9ee..0681225 100644 --- a/sys/kernel/kern_sig.c +++ b/sys/kernel/kern_sig.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: kern_sig.c 79 2016-01-11 16:21:27Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include @@ -35,15 +34,13 @@ #include #include -int sigaction(struct thread *td,register struct sigaction_args *uap) { - return(0x0); - } +int sigaction(struct thread *td, register struct sigaction_args *uap) { + return (0x0); +} int sigprocmask(register struct thread *td, struct sigprocmask_args *uap) { return (0x0); - } - - +} /*** END diff --git a/sys/kernel/kern_sysctl.c b/sys/kernel/kern_sysctl.c index bd1d6e2..5c010e8 100644 --- a/sys/kernel/kern_sysctl.c +++ b/sys/kernel/kern_sysctl.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - Copyright (c) 2002-2004, 2016 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: kern_sysctl.c 168 2016-01-20 00:41:47Z reddawg $ - - *****************************************************************************************/ +/*- + * 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. + */ #include #include @@ -39,7 +38,7 @@ static struct sysctl_entry *ctls = 0x0; -static struct sysctl_entry *sysctl_find( int *, int ); +static struct sysctl_entry *sysctl_find(int *, int); /* This is a cheat for now */ static void def_ctls() { @@ -48,203 +47,203 @@ name[0] = 6; name[1] = 7; name_len = 2; - sysctl_add( name, name_len, "page_size", &page_val, sizeof(uInt32) ); + sysctl_add(name, name_len, "page_size", &page_val, sizeof(uInt32)); /* Clock Rate */ name[0] = 1; name[1] = 12; page_val = 0x3E8; - sysctl_add( name, name_len, "page_size", &page_val, sizeof(uInt32) ); + sysctl_add(name, name_len, "page_size", &page_val, sizeof(uInt32)); /* KERN: OS Release */ name[0] = 1; name[1] = 24; page_val = 101000; - sysctl_add( name, name_len, "kern.osreldate", &page_val, sizeof(uInt32) ); + sysctl_add(name, name_len, "kern.osreldate", &page_val, sizeof(uInt32)); /* KERN: User Stack */ name[0] = 1; name[1] = 33; page_val = 0xCBE8000; - sysctl_add( name, name_len, "page_size", &page_val, sizeof(uInt32) ); + sysctl_add(name, name_len, "page_size", &page_val, sizeof(uInt32)); /* KERN: ARND */ name[0] = 1; name[1] = 37; page_val = 0x1; - sysctl_add( name, name_len, "kern_arnd", &page_val, sizeof(uint32_t) ); + sysctl_add(name, name_len, "kern_arnd", &page_val, sizeof(uint32_t)); /* HW: NCPU */ name[0] = 6; name[1] = 3; page_val = 0x1; - sysctl_add( name, name_len, "hw.ncpu", &page_val, sizeof(uint32_t) ); + sysctl_add(name, name_len, "hw.ncpu", &page_val, sizeof(uint32_t)); } int sysctl_init() { struct sysctl_entry *tmpCtl = 0x0; - if ( ctls != 0x0 ) { - kprintf( "sysctl already Initialized\n" ); - while ( 1 ) + if (ctls != 0x0) { + kprintf("sysctl already Initialized\n"); + while (1) ; } - ctls = (struct sysctl_entry *) kmalloc( sizeof(struct sysctl_entry) ); + ctls = (struct sysctl_entry *) kmalloc(sizeof(struct sysctl_entry)); ctls->prev = 0x0; ctls->id = CTL_UNSPEC; ctls->children = 0x0; - sprintf( ctls->name, "unspec" ); + sprintf(ctls->name, "unspec"); - tmpCtl = (struct sysctl_entry *) kmalloc( sizeof(struct sysctl_entry) ); + tmpCtl = (struct sysctl_entry *) kmalloc(sizeof(struct sysctl_entry)); tmpCtl->prev = ctls; tmpCtl->id = CTL_KERN; tmpCtl->children = 0x0; - sprintf( tmpCtl->name, "kern" ); + sprintf(tmpCtl->name, "kern"); ctls->next = tmpCtl; - tmpCtl->next = (struct sysctl_entry *) kmalloc( sizeof(struct sysctl_entry) ); + tmpCtl->next = (struct sysctl_entry *) kmalloc(sizeof(struct sysctl_entry)); tmpCtl->next->prev = tmpCtl; tmpCtl = tmpCtl->next; tmpCtl->id = CTL_VM; tmpCtl->children = 0x0; - sprintf( tmpCtl->name, "vm" ); + sprintf(tmpCtl->name, "vm"); - tmpCtl->next = (struct sysctl_entry *) kmalloc( sizeof(struct sysctl_entry) ); + tmpCtl->next = (struct sysctl_entry *) kmalloc(sizeof(struct sysctl_entry)); tmpCtl->next->prev = tmpCtl; tmpCtl = tmpCtl->next; tmpCtl->id = CTL_VFS; tmpCtl->children = 0x0; - sprintf( tmpCtl->name, "vfs" ); + sprintf(tmpCtl->name, "vfs"); - tmpCtl->next = (struct sysctl_entry *) kmalloc( sizeof(struct sysctl_entry) ); + tmpCtl->next = (struct sysctl_entry *) kmalloc(sizeof(struct sysctl_entry)); tmpCtl->next->prev = tmpCtl; tmpCtl = tmpCtl->next; tmpCtl->id = CTL_NET; tmpCtl->children = 0x0; - sprintf( tmpCtl->name, "net" ); + sprintf(tmpCtl->name, "net"); - tmpCtl->next = (struct sysctl_entry *) kmalloc( sizeof(struct sysctl_entry) ); + tmpCtl->next = (struct sysctl_entry *) kmalloc(sizeof(struct sysctl_entry)); tmpCtl->next->prev = tmpCtl; tmpCtl = tmpCtl->next; tmpCtl->id = CTL_DEBUG; tmpCtl->children = 0x0; - sprintf( tmpCtl->name, "debug" ); + sprintf(tmpCtl->name, "debug"); - tmpCtl->next = (struct sysctl_entry *) kmalloc( sizeof(struct sysctl_entry) ); + tmpCtl->next = (struct sysctl_entry *) kmalloc(sizeof(struct sysctl_entry)); tmpCtl->next->prev = tmpCtl; tmpCtl = tmpCtl->next; tmpCtl->id = CTL_HW; tmpCtl->children = 0x0; - sprintf( tmpCtl->name, "hw" ); + sprintf(tmpCtl->name, "hw"); - tmpCtl->next = (struct sysctl_entry *) kmalloc( sizeof(struct sysctl_entry) ); + tmpCtl->next = (struct sysctl_entry *) kmalloc(sizeof(struct sysctl_entry)); tmpCtl->next->prev = tmpCtl; tmpCtl = tmpCtl->next; tmpCtl->id = CTL_MACHDEP; tmpCtl->children = 0x0; - sprintf( tmpCtl->name, "machdep" ); + sprintf(tmpCtl->name, "machdep"); - tmpCtl->next = (struct sysctl_entry *) kmalloc( sizeof(struct sysctl_entry) ); + tmpCtl->next = (struct sysctl_entry *) kmalloc(sizeof(struct sysctl_entry)); tmpCtl->next->prev = tmpCtl; tmpCtl = tmpCtl->next; tmpCtl->id = CTL_USER; tmpCtl->children = 0x0; - sprintf( tmpCtl->name, "user" ); + sprintf(tmpCtl->name, "user"); - tmpCtl->next = (struct sysctl_entry *) kmalloc( sizeof(struct sysctl_entry) ); + tmpCtl->next = (struct sysctl_entry *) kmalloc(sizeof(struct sysctl_entry)); tmpCtl->next->prev = tmpCtl; tmpCtl = tmpCtl->next; tmpCtl->id = CTL_P1003_1B; tmpCtl->children = 0x0; - sprintf( tmpCtl->name, "p1003_1b" ); + sprintf(tmpCtl->name, "p1003_1b"); - tmpCtl->next = (struct sysctl_entry *) kmalloc( sizeof(struct sysctl_entry) ); + tmpCtl->next = (struct sysctl_entry *) kmalloc(sizeof(struct sysctl_entry)); tmpCtl->next->prev = tmpCtl; tmpCtl = tmpCtl->next; tmpCtl->id = CTL_UBIX; tmpCtl->children = 0x0; - sprintf( tmpCtl->name, "ubix" ); + sprintf(tmpCtl->name, "ubix"); def_ctls(); return (0x0); } -int __sysctl( struct thread *td, struct sysctl_args *uap ) { +int __sysctl(struct thread *td, struct sysctl_args *uap) { struct sysctl_entry *tmpCtl = 0x0; int i = 0; - if ( ctls == 0x0 ) - K_PANIC( "sysctl not initialized" ); + if (ctls == 0x0) + K_PANIC("sysctl not initialized"); - if ( uap->newlen < 0 ) { - kprintf( "Changing Not supported yet.\n" ); - endTask( _current->id ); + if (uap->newlen < 0) { + kprintf("Changing Not supported yet.\n"); + endTask(_current->id); } - tmpCtl = sysctl_find( uap->name, uap->namelen ); - if ( tmpCtl == 0x0 ) { - kprintf( "Invalid CTL\n" ); - for ( i = 0x0; i < uap->namelen; i++ ) - kprintf( "(%i)", uap->name[i] ); - kprintf( "\n" ); - endTask( _current->id ); + tmpCtl = sysctl_find(uap->name, uap->namelen); + if (tmpCtl == 0x0) { + kprintf("Invalid CTL\n"); + for (i = 0x0; i < uap->namelen; i++) + kprintf("(%i)", uap->name[i]); + kprintf("\n"); + endTask(_current->id); } - if ( (uint32_t) uap->oldlenp < tmpCtl->val_len ) - memcpy( uap->old, tmpCtl->value, (uInt32) uap->oldlenp ); + if ((uint32_t) uap->oldlenp < tmpCtl->val_len) + memcpy(uap->old, tmpCtl->value, (uInt32) uap->oldlenp); else - memcpy( uap->old, tmpCtl->value, tmpCtl->val_len ); + memcpy(uap->old, tmpCtl->value, tmpCtl->val_len); td->td_retval[0] = 0x0; return (0x0); } -int sys_sysctl( struct thread *td, struct sys_sysctl_args *args ) { +int sys_sysctl(struct thread *td, struct sys_sysctl_args *args) { struct sysctl_entry *tmpCtl = 0x0; int i = 0; - if ( ctls == 0x0 ) - K_PANIC( "sysctl not initialized" ); + if (ctls == 0x0) + K_PANIC("sysctl not initialized"); - if ( args->newlenp < 0 ) { - kprintf( "Changing Not supported yet.\n" ); - endTask( _current->id ); + if (args->newlenp < 0) { + kprintf("Changing Not supported yet.\n"); + endTask(_current->id); } - tmpCtl = sysctl_find( args->name, args->namelen ); + tmpCtl = sysctl_find(args->name, args->namelen); - if ( tmpCtl == 0x0 ) { - kprintf( "Invalid CTL\n" ); - for ( i = 0x0; i < args->namelen; i++ ) - kprintf( "(%i)", (int)args->name[i] ); - kprintf( "\n" ); + if (tmpCtl == 0x0) { + kprintf("Invalid CTL\n"); + for (i = 0x0; i < args->namelen; i++) + kprintf("(%i)", (int) args->name[i]); + kprintf("\n"); td->td_retval[0] = -1; return (-1); } - if ( (uint32_t) args->oldlenp < tmpCtl->val_len ) - memcpy( args->oldp, tmpCtl->value, (uInt32) args->oldlenp ); + if ((uint32_t) args->oldlenp < tmpCtl->val_len) + memcpy(args->oldp, tmpCtl->value, (uInt32) args->oldlenp); else - memcpy( args->oldp, tmpCtl->value, tmpCtl->val_len ); + memcpy(args->oldp, tmpCtl->value, tmpCtl->val_len); td->td_retval[0] = 0x0; return (0x0); } -static struct sysctl_entry *sysctl_find( int *name, int namelen ) { +static struct sysctl_entry *sysctl_find(int *name, int namelen) { int i = 0x0; struct sysctl_entry *tmpCtl = 0x0; struct sysctl_entry *lCtl = ctls; /* Loop Name Len */ - for ( i = 0x0; i < namelen; i++ ) { - for ( tmpCtl = lCtl; tmpCtl != 0x0; tmpCtl = tmpCtl->next ) { + for (i = 0x0; i < namelen; i++) { + for (tmpCtl = lCtl; tmpCtl != 0x0; tmpCtl = tmpCtl->next) { //kprintf("ctlName: [%s], ctlId; [%i]\n",tmpCtl->name,tmpCtl->id); - if ( tmpCtl->id == name[i] ) { - if ( (i + 1) == namelen ) { + if (tmpCtl->id == name[i]) { + if ((i + 1) == namelen) { return (tmpCtl); } lCtl = tmpCtl->children; @@ -255,44 +254,44 @@ return (0x0); } -int sysctl_add( int *name, int namelen, char *str_name, void *buf, int buf_size ) { +int sysctl_add(int *name, int namelen, char *str_name, void *buf, int buf_size) { struct sysctl_entry *tmpCtl = 0x0; struct sysctl_entry *newCtl = 0x0; /* Check if it exists */ - tmpCtl = sysctl_find( name, namelen ); - if ( tmpCtl != 0x0 ) { - kprintf( "Node Exists!\n" ); - while ( 1 ) + tmpCtl = sysctl_find(name, namelen); + if (tmpCtl != 0x0) { + kprintf("Node Exists!\n"); + while (1) ; } /* Get Parent Node */ - tmpCtl = sysctl_find( name, namelen - 1 ); - if ( tmpCtl == 0x0 ) { - kprintf( "Parent Node Non Existant\n" ); + tmpCtl = sysctl_find(name, namelen - 1); + if (tmpCtl == 0x0) { + kprintf("Parent Node Non Existant\n"); return (-1); } - if ( tmpCtl->children == 0x0 ) { - tmpCtl->children = (struct sysctl_entry *) kmalloc( sizeof(struct sysctl_entry) ); + if (tmpCtl->children == 0x0) { + tmpCtl->children = (struct sysctl_entry *) kmalloc(sizeof(struct sysctl_entry)); tmpCtl->children->children = 0x0; tmpCtl->children->prev = 0x0; tmpCtl->children->next = 0x0; tmpCtl->children->id = name[namelen - 1]; - sprintf( tmpCtl->children->name, str_name ); - tmpCtl->children->value = (void *) kmalloc( buf_size ); - memcpy( tmpCtl->children->value, buf, buf_size ); + sprintf(tmpCtl->children->name, str_name); + tmpCtl->children->value = (void *) kmalloc(buf_size); + memcpy(tmpCtl->children->value, buf, buf_size); tmpCtl->children->val_len = buf_size; } else { - newCtl = (struct sysctl_entry *) kmalloc( sizeof(struct sysctl_entry) ); + newCtl = (struct sysctl_entry *) kmalloc(sizeof(struct sysctl_entry)); newCtl->prev = 0x0; newCtl->next = tmpCtl->children; newCtl->children = 0x0; newCtl->id = name[namelen - 1]; - sprintf( newCtl->name, str_name ); - newCtl->value = (void *) kmalloc( buf_size ); - memcpy( newCtl->value, buf, buf_size ); + sprintf(newCtl->name, str_name); + newCtl->value = (void *) kmalloc(buf_size); + memcpy(newCtl->value, buf, buf_size); newCtl->val_len = buf_size; tmpCtl->children->prev = newCtl; tmpCtl->children = newCtl; diff --git a/sys/kernel/ld.c b/sys/kernel/ld.c index 93e9033..42c915e 100644 --- a/sys/kernel/ld.c +++ b/sys/kernel/ld.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: ld.c 141 2016-01-17 02:05:18Z reddawg $ - - *****************************************************************************************/ +/*- + * 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. + */ #include #include diff --git a/sys/kernel/pipe.c b/sys/kernel/pipe.c index 9945db0..583e063 100644 --- a/sys/kernel/pipe.c +++ b/sys/kernel/pipe.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: pipe.c 79 2016-01-11 16:21:27Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include @@ -35,19 +34,19 @@ #include /** - HACK -*/ + HACK + */ int pipe(struct thread *td, struct pipe_args *uap) { struct file *rf, *wf; int fd = 0x0; - falloc(td,&rf,&fd); + falloc(td, &rf, &fd); rf->f_flag = FREAD | FWRITE; td->td_retval[0] = fd; - falloc(td,&wf,&fd); + falloc(td, &wf, &fd); wf->f_flag = FREAD | FWRITE; td->td_retval[1] = fd; - return(0x0); - } + return (0x0); +} /*** END diff --git a/sys/kernel/sem.c b/sys/kernel/sem.c index 842f832..6bc5344 100644 --- a/sys/kernel/sem.c +++ b/sys/kernel/sem.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: sem.c 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include diff --git a/sys/kernel/smp.c b/sys/kernel/smp.c index 1c9f986..5f8e023 100644 --- a/sys/kernel/smp.c +++ b/sys/kernel/smp.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - Copyright (c) 2002 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: smp.c 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include @@ -44,55 +43,54 @@ static inline unsigned int apicRead(address) { return *(volatile unsigned int *) (0xFEE00000 + address); - } +} static inline void apicWrite(unsigned int address,unsigned int data) { *(volatile unsigned int *) (0xFEE00000 + address) = data; - } +} static __inline__ void setDr3 (void *dr3) { register uInt32 value = (uInt32)dr3; __asm__ __volatile__ ("mov %0, %%dr3" :: "r" (value)); - } +} static __inline__ uInt32 getDr3 (void) { register uInt32 value; __asm__ __volatile__ ("mov %%dr3, %0" : "=r" (value)); return value; - } +} struct gdt_descr { - uInt16 limit; + uInt16 limit; uInt32 *base __attribute__ ((packed)); }; static void GDT_fixer() { - struct gdt_descr gdt_descr; + struct gdt_descr gdt_descr; uInt32 *gdt = (uInt32 *)0x20000; // 128KB gdt[0] = 0; gdt[1] = 0; - gdt[2] = 0x0000ffff; // seg 0x8 -- DPL 0 4GB code + gdt[2] = 0x0000ffff;// seg 0x8 -- DPL 0 4GB code gdt[3] = 0x00cf9a00; - gdt[4] = 0x0000ffff; // seg 0x10 -- DPL 0 4GB data + gdt[4] = 0x0000ffff;// seg 0x10 -- DPL 0 4GB data gdt[5] = 0x00cf9200; - gdt[6] = 0x0000ffff; // seg 0x1b -- DPL 3 4GB code + gdt[6] = 0x0000ffff;// seg 0x1b -- DPL 3 4GB code gdt[7] = 0x00cffa00; - gdt[8] = 0x0000ffff; // seg 0x23 -- DPL 3 4GB data + gdt[8] = 0x0000ffff;// seg 0x23 -- DPL 3 4GB data gdt[9] = 0x00cff200; gdt_descr.limit = 32 * 4; - gdt_descr.base = gdt; + gdt_descr.base = gdt; /* - asm("lgdt %0;" : : "m" (gdt_descr)); - __asm__ __volatile__ ("ljmp %0,$1f; 1:" :: "i" (0x08)); - __asm__ __volatile__ ("movw %w0,%%ds" :: "r" (0x10)); - __asm__ __volatile__ ("movw %w0,%%es" :: "r" (0x10)); - __asm__ __volatile__ ("movw %w0,%%ss" :: "r" (0x10)); - */ - } - + asm("lgdt %0;" : : "m" (gdt_descr)); + __asm__ __volatile__ ("ljmp %0,$1f; 1:" :: "i" (0x08)); + __asm__ __volatile__ ("movw %w0,%%ds" :: "r" (0x10)); + __asm__ __volatile__ ("movw %w0,%%es" :: "r" (0x10)); + __asm__ __volatile__ ("movw %w0,%%ss" :: "r" (0x10)); + */ +} void cpu0_thread(void) { for(;;) { @@ -125,7 +123,6 @@ spinLock(&bkl); - cpu = (struct cpuinfo_t *)getDr3(); spinUnlock(&bkl); @@ -133,19 +130,18 @@ return('0' + cpu->id); } - void c_ap_boot(void) { while(spinLockLocked(&initSpinLock)); switch(cpuInfo()) { - case 1: + case 1: cpu1_thread(); break; - case 2: + case 2: cpu2_thread(); break; - case 3: + case 3: cpu3_thread(); break; } @@ -157,7 +153,6 @@ } } - void smpInit() { spinLock(&initSpinLock); GDT_fixer(); @@ -167,23 +162,23 @@ spinUnlock(&initSpinLock); //cpu0_thread(); - - } + +} void cpuidDetect() { if (!(getEflags() & (1<<21)) ) { setEflags(getEflags() | (1<<21)); if( !(getEflags() & (1<<21)) ) { kpanic("CPU doesn't support CPUID, get a newer machine\n"); - } } } +} uInt8 cpuInfo() { uInt32 data[4],i; if( !(getEflags() & (1<<21)) ) { // If the cpuid bit in eflags not set.. - setEflags(getEflags() | (1<<21)); // ..try and set it to see if it comes on.. + setEflags(getEflags() | (1<<21));// ..try and set it to see if it comes on.. if( !(getEflags() & (1<<21)) ) { // It didn't.. This CPU suck kpanic("CPU doesn't support CPUID, get a newer machine\n"); } @@ -191,7 +186,7 @@ spinLock(&cpuInfoLock); cpuinfo[cpus].ok = 1; - cpuinfo[cpus].apic_id = apicRead(0x20) >> 24; + cpuinfo[cpus].apic_id = apicRead(0x20) >> 24; cpuinfo[cpus].apic_ver = apicRead(0x30) & 0xFF; cpuid(0,data); @@ -203,20 +198,21 @@ cpuid(1,data); cpuinfo[cpus].signature = data[0]; - cpuinfo[cpus].feature = data[3]; + cpuinfo[cpus].feature = data[3]; cpuid(0x80000000,data); if(data[0]>=0x80000004) { for(i=0;i<3;i++) { cpuid(0x80000002 + i,data); - *(unsigned int *)&cpuinfo[cpus].brand[16*i+0] = data[0]; - *(unsigned int *)&cpuinfo[cpus].brand[16*i+4] = data[1]; - *(unsigned int *)&cpuinfo[cpus].brand[16*i+8] = data[2]; + *(unsigned int *)&cpuinfo[cpus].brand[16*i+0] = data[0]; + *(unsigned int *)&cpuinfo[cpus].brand[16*i+4] = data[1]; + *(unsigned int *)&cpuinfo[cpus].brand[16*i+8] = data[2]; *(unsigned int *)&cpuinfo[cpus].brand[16*i+12] = data[3]; } cpuinfo[cpus].brand[48] = 0; - } else { + } + else { cpuinfo[cpus].brand[0] = 0; } @@ -228,26 +224,31 @@ spinUnlock(&cpuInfoLock); return(cpus - 1); - } +} -extern void ap_trampoline_start(),ap_trampoline_end(); +extern void ap_trampoline_start(), +ap_trampoline_end(); void apicMagic(void) { uInt32 tmp; - kprintf("Copying %u bytes from 0x%x to 0x00\n",ap_trampoline_end - ap_trampoline_start,ap_trampoline_start); - memcpy(0x0,(char *)ap_trampoline_start,ap_trampoline_end - ap_trampoline_start); - apicWrite(0x280,0); + kprintf("Copying %u bytes from 0x%x to 0x00\n", ap_trampoline_end - ap_trampoline_start, ap_trampoline_start); + memcpy(0x0, (char *) ap_trampoline_start, ap_trampoline_end - ap_trampoline_start); + apicWrite(0x280, 0); apicRead(0x280); - apicWrite(0x300,0x000C4500); // INIT IPI to all CPUs - for(tmp=0;tmp<800000;tmp++) asm("nop"); // Sleep a little (should be 10ms) - apicWrite(0x300,0x000C4600); // INIT SIPI to all CPUs - for(tmp=0;tmp<800000;tmp++) asm("nop"); // Sleep a little (should be 200ms) - apicWrite(0x300,0x000C4600); // Second INIT SIPI - for(tmp=0;tmp<800000;tmp++) asm("nop"); // Sleep a little (should be 200ms) - } - - + apicWrite(0x300, 0x000C4500); // INIT IPI to all CPUs + for (tmp = 0; tmp < 800000; tmp++) + asm("nop"); + // Sleep a little (should be 10ms) + apicWrite(0x300, 0x000C4600); // INIT SIPI to all CPUs + for (tmp = 0; tmp < 800000; tmp++) + asm("nop"); + // Sleep a little (should be 200ms) + apicWrite(0x300, 0x000C4600); // Second INIT SIPI + for (tmp = 0; tmp < 800000; tmp++) + asm("nop"); + // Sleep a little (should be 200ms) +} uInt32 getEflags() { uInt32 eflags = 0x0; @@ -255,9 +256,9 @@ "pushfl \n" "popl %%eax \n" : "=a" (eflags) - ); - return(eflags); - } + ); + return (eflags); +} void setEflags(uInt32 eflags) { asm( @@ -265,8 +266,8 @@ "popfl \n" : : "a" (eflags) - ); - } + ); +} asm( ".globl cpuid \n" @@ -283,8 +284,8 @@ " popl %edi \n" " popl %ebx \n" " ret \n" - ); - +); + /*** END ***/ diff --git a/sys/kernel/syscall_new.c b/sys/kernel/syscall_new.c index e8ed0f7..9298d23 100644 --- a/sys/kernel/syscall_new.c +++ b/sys/kernel/syscall_new.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - Copyright (c) 2002-2004, 2016 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: syscall_new.c 172 2016-01-20 13:57:36Z reddawg $ - - *****************************************************************************************/ +/*- + * 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. + */ #include #include @@ -40,7 +39,7 @@ struct spinLock Master = SPIN_LOCK_INITIALIZER; -void syscall( struct trapframe *frame ) { +void syscall(struct trapframe *frame) { uint32_t code = 0x0; caddr_t params; @@ -55,18 +54,18 @@ code = frame->tf_eax; - if ( code == 198 ) { - memcpy( &code, params, sizeof(int) ); + if (code == 198) { + memcpy(&code, params, sizeof(int)); params += sizeof(quad_t); } - if ( code > totalCalls ) { + if (code > totalCalls) { //kprintf( "Invalid Call: [%i:%i]\n", frame->tf_eax, totalCalls ); die_if_kernel("Invalid System Call", frame, frame->tf_eax); kpanic("PID: %i", _current->id); } - else if ( (uint32_t) systemCalls[code].sc_status == SYSCALL_INVALID ) { - kprintf( "Invalid Call: [%i][0x%X]\n", code, (uint32_t) systemCalls[code].sc_name ); + else if ((uint32_t) systemCalls[code].sc_status == SYSCALL_INVALID) { + kprintf("Invalid Call: [%i][0x%X]\n", code, (uint32_t) systemCalls[code].sc_name); frame->tf_eax = -1; frame->tf_edx = 0x0; } @@ -76,46 +75,46 @@ td->td_retval[0] = 0; td->td_retval[1] = frame->tf_edx; - if ( systemCalls[code].sc_status == SYSCALL_DUMMY ) - kprintf( "Syscall->abi: [%i], PID: [%i], Code: %i, Call: %s\n", td->abi, _current->id, frame->tf_eax, systemCalls[code].sc_name ); + if (systemCalls[code].sc_status == SYSCALL_DUMMY) + kprintf("Syscall->abi: [%i], PID: [%i], Code: %i, Call: %s\n", td->abi, _current->id, frame->tf_eax, systemCalls[code].sc_name); /* if ( td->abi == ELFOSABI_UBIXOS ) error = (int) systemCalls[code].sc_entry( frame->tf_ebx, frame->tf_ecx, frame->tf_edx ); */ - if ( td->abi == ELFOSABI_FREEBSD ) - error = (int) systemCalls[code].sc_entry( td, params ); + if (td->abi == ELFOSABI_FREEBSD) + error = (int) systemCalls[code].sc_entry(td, params); else - error = (int) systemCalls[code].sc_entry( td, params ); + error = (int) systemCalls[code].sc_entry(td, params); -if ( systemCalls[code].sc_status == SYSCALL_DUMMY ) { - kprintf("RET(%i)1", code); -return; -} + if (systemCalls[code].sc_status == SYSCALL_DUMMY) { + kprintf("RET(%i)1", code); + return; + } - switch ( error ) { + switch (error) { case 0: frame->tf_eax = td->td_retval[0]; frame->tf_edx = td->td_retval[1]; frame->tf_eflags &= ~PSL_C; -if ( systemCalls[code].sc_status == SYSCALL_DUMMY ) - kprintf("RET3"); - break; -/* - case ERESTART: - frame->tf_eip -= frame->tf_err; - break; -*/ + if (systemCalls[code].sc_status == SYSCALL_DUMMY) + kprintf("RET3"); + break; + /* + case ERESTART: + frame->tf_eip -= frame->tf_err; + break; + */ case EJUSTRETURN: - break; + break; default: frame->tf_eax = error; frame->tf_eflags |= PSL_C; - break; + break; -if ( systemCalls[code].sc_status == SYSCALL_DUMMY ) - kprintf("RET2"); + if (systemCalls[code].sc_status == SYSCALL_DUMMY) + kprintf("RET2"); } } } @@ -124,11 +123,11 @@ int sys_call; asm( - "nop" - : "=a" (sys_call) - : + "nop" + : "=a" (sys_call) + : ); - kprintf( "Invalid System Call #[%i], PID: %i\n", sys_call, _current->id ); + kprintf("Invalid System Call #[%i], PID: %i\n", sys_call, _current->id); return (0); } diff --git a/sys/kernel/syscalls.c b/sys/kernel/syscalls.c index 503f0ca..9286f8e 100644 --- a/sys/kernel/syscalls.c +++ b/sys/kernel/syscalls.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: elf.c 141 2016-01-17 02:05:18Z reddawg $ - - *****************************************************************************************/ +/*- + * 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. + */ #include #include diff --git a/sys/kernel/time.c b/sys/kernel/time.c index 9f106db..c5d470e 100644 --- a/sys/kernel/time.c +++ b/sys/kernel/time.c @@ -1,66 +1,63 @@ -/***************************************************************************************** - 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: time.c 79 2016-01-11 16:21:27Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include #include #include -static int month[12] = { - 0, - DAY*(31), - DAY*(31+29), - DAY*(31+29+31), - DAY*(31+29+31+30), - DAY*(31+29+31+30+31), - DAY*(31+29+31+30+31+30), - DAY*(31+29+31+30+31+30+31), - DAY*(31+29+31+30+31+30+31+31), - DAY*(31+29+31+30+31+30+31+31+30), - DAY*(31+29+31+30+31+30+31+31+30+31), - DAY*(31+29+31+30+31+30+31+31+30+31+30) -}; +static int month[12] = { 0, +DAY * (31), +DAY * (31 + 29), +DAY * (31 + 29 + 31), +DAY * (31 + 29 + 31 + 30), +DAY * (31 + 29 + 31 + 30 + 31), +DAY * (31 + 29 + 31 + 30 + 31 + 30), +DAY * (31 + 29 + 31 + 30 + 31 + 30 + 31), +DAY * (31 + 29 + 31 + 30 + 31 + 30 + 31 + 31), +DAY * (31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30), +DAY * (31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31), +DAY * (31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30) }; static int timeCmosRead(int addr) { - outportByteP(0x70,addr); - return((int)inportByte(0x71)); - } + outportByteP(0x70, addr); + return ((int) inportByte(0x71)); +} int time_init() { int i; struct timeStruct time; - - for (i = 0 ; i < 1000000 ; i++) { + + for (i = 0; i < 1000000; i++) { if (!(timeCmosRead(10) & 0x80)) { break; - } } + } do { time.sec = timeCmosRead(0); @@ -69,7 +66,7 @@ time.day = timeCmosRead(7); time.mon = timeCmosRead(8); time.year = timeCmosRead(9); - } while (time.sec != timeCmosRead(0)); + } while (time.sec != timeCmosRead(0)); BCD_TO_BIN(time.sec); BCD_TO_BIN(time.min); @@ -81,37 +78,36 @@ /* Set up our start time in seconds */ systemVitals->timeStart = timeMake(&time); - kprintf("%i/%i/%i %i:%i.%i\n",time.mon,time.day,time.year,time.hour,time.min,time.sec); + kprintf("%i/%i/%i %i:%i.%i\n", time.mon, time.day, time.year, time.hour, time.min, time.sec); - /* Return so we know all went well */ - return(0x0); - } + return (0x0); +} uInt32 timeMake(struct timeStruct *time) { uInt32 res; int year; - year = (time->year+100) - 70; + year = (time->year + 100) - 70; /* magic offsets (y+1) needed to get leapyears right.*/ - res = YEAR*year + DAY*((year+1)/4); + res = YEAR * year + DAY * ((year + 1) / 4); res += month[time->mon]; /* and (y+2) here. If it wasn't a leap-year, we have to adjust */ - if (time->mon>1 && ((year+2)%4)) + if (time->mon > 1 && ((year + 2) % 4)) res -= DAY; - res += DAY*(time->day-1); - res += HOUR*time->hour; - res += MINUTE*time->min; + res += DAY * (time->day - 1); + res += HOUR * time->hour; + res += MINUTE * time->min; res += time->sec; - return(res); - } + return (res); +} -int gettimeofday(struct timeval *tp,struct timezone *tzp) { +int gettimeofday(struct timeval *tp, struct timezone *tzp) { //tp->tv_sec = systemVitals->timeStart + systemVitals->sysUptime; - tp->tv_sec = 0x0;//systemVitals->sysUptime; + tp->tv_sec = 0x0; //systemVitals->sysUptime; tp->tv_usec = 0x0; - return(0x0); - } + return (0x0); +} /*** END diff --git a/sys/kernel/tty.c b/sys/kernel/tty.c index c1094a4..a8fcd33 100644 --- a/sys/kernel/tty.c +++ b/sys/kernel/tty.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: tty.c 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include @@ -35,29 +34,29 @@ #include #include -static tty_term *terms = 0x0; -tty_term *tty_foreground = 0x0; -static struct spinLock tty_spinLock = SPIN_LOCK_INITIALIZER; +static tty_term *terms = 0x0; +tty_term *tty_foreground = 0x0; +static struct spinLock tty_spinLock = SPIN_LOCK_INITIALIZER; int tty_init() { int i = 0x0; /* Allocate memory for terminals */ - terms = (tty_term *)kmalloc(sizeof(tty_term)*TTY_MAX_TERMS); + terms = (tty_term *) kmalloc(sizeof(tty_term) * TTY_MAX_TERMS); if (terms == 0x0) - kpanic("tty_init: Failed to allocate memory. File: %s, Line: %i\n",__FILE__,__LINE__); + kpanic("tty_init: Failed to allocate memory. File: %s, Line: %i\n", __FILE__, __LINE__); /* Set up all default terminal information */ - for (i = 0;i < TTY_MAX_TERMS;i++) { - terms[i].tty_buffer = (char *)kmalloc(80*60*2); + for (i = 0; i < TTY_MAX_TERMS; i++) { + terms[i].tty_buffer = (char *) kmalloc(80 * 60 * 2); if (terms[i].tty_buffer == 0x0) - kpanic("tty_init: Failed to allocate buffer memory. File: %s, Line: %i\n",__FILE__,__LINE__); + kpanic("tty_init: Failed to allocate buffer memory. File: %s, Line: %i\n", __FILE__, __LINE__); - terms[i].tty_pointer = terms[i].tty_buffer; /* Set up tty pointer to internal buffer */ - terms[i].tty_x = 0x0; /* Set up default X position */ - terms[i].tty_y = 0x0; /* Set up default Y position */ - terms[i].tty_colour = 0x0A + i; /* Set up default tty text colour */ - } + terms[i].tty_pointer = terms[i].tty_buffer; /* Set up tty pointer to internal buffer */ + terms[i].tty_x = 0x0; /* Set up default X position */ + terms[i].tty_y = 0x0; /* Set up default Y position */ + terms[i].tty_colour = 0x0A + i; /* Set up default tty text colour */ + } /* Read tty0 current position (to migrate from kprintf). */ outportByte(0x3D4, 0x0e); @@ -65,43 +64,41 @@ outportByte(0x3D4, 0x0f); terms[0].tty_x = inportByte(0x3D5); - /* Set up pointer for the foreground tty */ tty_foreground = &terms[0]; /* Set up the foreground ttys information */ - tty_foreground->tty_pointer = (char *)0xB8000; + tty_foreground->tty_pointer = (char *) 0xB8000; /* Return to let kernel know initialization is complete */ kprintf("tty0 - Initialized\n"); - return(0x0); - } + return (0x0); +} - - /* - This will change the specified tty. It ultimately copies the screen - to the foreground buffer copies the new ttys buffer to the screen and - adjusts a couple pointers and we are good to go. +/* + This will change the specified tty. It ultimately copies the screen + to the foreground buffer copies the new ttys buffer to the screen and + adjusts a couple pointers and we are good to go. */ int tty_change(uInt16 tty) { if (tty > TTY_MAX_TERMS) - kpanic("Error: Changing to an invalid tty. File: %s, Line: %i\n",__FILE__,__LINE__); + kpanic("Error: Changing to an invalid tty. File: %s, Line: %i\n", __FILE__, __LINE__); /* Copy display buffer to tty buffer */ - memcpy(tty_foreground->tty_buffer,(char *)0xB8000,(80*60*2)); + memcpy(tty_foreground->tty_buffer, (char *) 0xB8000, (80 * 60 * 2)); /* Copy new tty buffer to display buffer */ - memcpy((char *)0xB8000,terms[tty].tty_buffer,(80*60*2)); + memcpy((char *) 0xB8000, terms[tty].tty_buffer, (80 * 60 * 2)); /* Set the tty_pointer to the internal buffer so I can continue writing to what it believes is the screen - */ + */ tty_foreground->tty_pointer = tty_foreground->tty_buffer; - terms[tty].tty_pointer = (char *)0xB8000; + terms[tty].tty_pointer = (char *) 0xB8000; /* set new foreground tty */ tty_foreground = &terms[tty]; @@ -112,11 +109,11 @@ outportByte(0x3D4, 0x0E); outportByte(0x3D5, tty_foreground->tty_y); - return(0x0); - } + return (0x0); +} -int tty_print(char *string,tty_term *term) { - unsigned int bufferOffset = 0x0, character = 0x0, i = 0x0; +int tty_print(char *string, tty_term *term) { + unsigned int bufferOffset = 0x0, character = 0x0, i = 0x0; spinLock(&tty_spinLock); /* We Need To Get The Y Position */ @@ -129,30 +126,30 @@ while ((character = *string++)) { switch (character) { - case '\n': - bufferOffset = (bufferOffset / 160) * 160 + 160; + case '\n': + bufferOffset = (bufferOffset / 160) * 160 + 160; break; - default: - term->tty_pointer[bufferOffset++] = character; - term->tty_pointer[bufferOffset++] = term->tty_colour; + default: + term->tty_pointer[bufferOffset++] = character; + term->tty_pointer[bufferOffset++] = term->tty_colour; break; - } /* switch */ + } /* switch */ /* Check To See If We Are Out Of Bounds */ if (bufferOffset >= 160 * 25) { for (i = 0; i < 160 * 24; i++) { term->tty_pointer[i] = term->tty_pointer[i + 160]; - } + } for (i = 0; i < 80; i++) { term->tty_pointer[(160 * 24) + (i * 2)] = 0x20; term->tty_pointer[(160 * 24) + (i * 2) + 1] = term->tty_colour; - } - bufferOffset -= 160; } + bufferOffset -= 160; } + } - bufferOffset >>= 1; /* Set the new cursor position */ - term->tty_x = (bufferOffset & 0xFF); + bufferOffset >>= 1; /* Set the new cursor position */ + term->tty_x = (bufferOffset & 0xFF); term->tty_y = (bufferOffset >> 0x8); if (term == tty_foreground) { @@ -160,16 +157,16 @@ outportByte(0x3D5, term->tty_x); outportByte(0x3D4, 0x0e); outportByte(0x3D5, term->tty_y); - } + } spinUnlock(&tty_spinLock); - return(0x0); - } + return (0x0); +} tty_term *tty_find(uInt16 tty) { - return(&terms[tty]); - } + return (&terms[tty]); +} /*** END diff --git a/sys/kernel/ubthread.c b/sys/kernel/ubthread.c index 5359761..787e2af 100644 --- a/sys/kernel/ubthread.c +++ b/sys/kernel/ubthread.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - Copyright (c) 2002-2004, 2017 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: ubthread.c 54 2016-01-11 01:29:55Z reddawg $ - - *****************************************************************************************/ +/*- + * 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. + */ /* All these must be converted to be done atomically */ diff --git a/sys/kernel/vitals.c b/sys/kernel/vitals.c index 1a94fb5..0f22df4 100644 --- a/sys/kernel/vitals.c +++ b/sys/kernel/vitals.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: vitals.c 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include @@ -37,35 +36,34 @@ /************************************************************************ -Function: vitals_init(); -Description: This will enable the vitals subsystem for ubixos + Function: vitals_init(); + Description: This will enable the vitals subsystem for ubixos -Notes: + Notes: -02/20/2004 - Approved Its Quality + 02/20/2004 - Approved Its Quality -************************************************************************/ + ************************************************************************/ int vitals_init() { - /* Initialize Memory For The System Vitals Node */ - systemVitals = (vitalsNode *) kmalloc(sizeof(vitalsNode)); + /* Initialize Memory For The System Vitals Node */ + systemVitals = (vitalsNode *) kmalloc(sizeof(vitalsNode)); - /* If malloc Failed Then Error */ - if (systemVitals == 0x0) - { - kpanic("Error: kmalloc Failed In initVitals\n"); - } + /* If malloc Failed Then Error */ + if (systemVitals == 0x0) { + kpanic("Error: kmalloc Failed In initVitals\n"); + } - /* Set all default values */ - memset(systemVitals,0x0,sizeof(vitalsNode)); - - systemVitals->quantum = 8; - systemVitals->dQuantum = 8; + /* Set all default values */ + memset(systemVitals, 0x0, sizeof(vitalsNode)); - /* Print Out Info For Vitals: */ - kprintf("vitals0 - Address: [0x%X]\n",systemVitals); + systemVitals->quantum = 8; + systemVitals->dQuantum = 8; - /* Return so kernel knows that there is no problem */ - return(0x0); + /* Print Out Info For Vitals: */ + kprintf("vitals0 - Address: [0x%X]\n", systemVitals); + + /* Return so kernel knows that there is no problem */ + return (0x0); } /*** diff --git a/sys/kmods/kmod.c b/sys/kmods/kmod.c index 9d9f698..518b54f 100644 --- a/sys/kmods/kmod.c +++ b/sys/kmods/kmod.c @@ -1,36 +1,35 @@ -/***************************************************************************************** - Copyright (c) 2002-2005 The UbixOS Project - All rights reserved. +/*- + * 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. + */ - 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: kmod.c 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ - -#include +#include #include #include -#include +#include #include #include #include @@ -43,159 +42,154 @@ List_t *List = 0x0; -uInt32 kmod_add(const char *kmod_file, const char *name) -{ - uInt32 addr = 0x0; - Item_t *tmp; - kmod_t *kmods; +uInt32 kmod_add(const char *kmod_file, const char *name) { + uInt32 addr = 0x0; + Item_t *tmp; + kmod_t *kmods; - - addr = kmod_load(kmod_file); - if (addr == 0x0) - return 0x0; + addr = kmod_load(kmod_file); + if (addr == 0x0) + return 0x0; - if(List == 0x0) - { - List = InitializeList(); - } + if (List == 0x0) { + List = InitializeList(); + } - tmp = CreateItem(); - InsertItemAtFront(List, tmp); - kmods = kmalloc(sizeof *kmods); - tmp->data = kmods; - if(kmods == NULL) - { - kprintf("kmod_add: unable to allocate memory!\n"); - return 0x0; - } - - return 0x0; + tmp = CreateItem(); + InsertItemAtFront(List, tmp); + kmods = kmalloc(sizeof *kmods); + tmp->data = kmods; + if (kmods == NULL) { + kprintf("kmod_add: unable to allocate memory!\n"); + return 0x0; + } + + return 0x0; } uInt32 kmod_load(const char *kmod_file) { - int i = 0x0; - int x = 0x0; - int rel = 0x0; - int sym = 0x0; - char *newLoc = 0x0; - char *shStr = 0x0; - char *dynStr = 0x0; - uInt32 *reMap = 0x0; - fileDescriptor *kmod_fd = 0x0; - elfHeader *binaryHeader = 0x0; + int i = 0x0; + int x = 0x0; + int rel = 0x0; + int sym = 0x0; + char *newLoc = 0x0; + char *shStr = 0x0; + char *dynStr = 0x0; + uInt32 *reMap = 0x0; + fileDescriptor *kmod_fd = 0x0; + elfHeader *binaryHeader = 0x0; elfProgramHeader *programHeader = 0x0; elfSectionHeader *sectionHeader = 0x0; - elfDynSym *relSymTab = 0x0; - elfPltInfo *elfRel = 0x0; + elfDynSym *relSymTab = 0x0; + elfPltInfo *elfRel = 0x0; /* Open kernel module */ - kmod_fd = fopen(kmod_file,"rb"); + kmod_fd = fopen(kmod_file, "rb"); if (kmod_fd == 0x0) { - kprintf("Can not open %s\n",kmod_file); - return 0x0; - } - - /* load module header */ - fseek(kmod_fd,0x0,0x0); - binaryHeader = (elfHeader *)kmalloc(sizeof(elfHeader)); - if(binaryHeader == 0x0) - { - kprintf("kmod: out of memory\n"); - return 0x0; + kprintf("Can not open %s\n", kmod_file); + return 0x0; } - + + /* load module header */ + fseek(kmod_fd, 0x0, 0x0); + binaryHeader = (elfHeader *) kmalloc(sizeof(elfHeader)); + if (binaryHeader == 0x0) { + kprintf("kmod: out of memory\n"); + return 0x0; + } + assert(binaryHeader); - fread(binaryHeader,sizeof(elfHeader),1,kmod_fd); + fread(binaryHeader, sizeof(elfHeader), 1, kmod_fd); - programHeader = (elfProgramHeader *)kmalloc(sizeof(elfProgramHeader)*binaryHeader->ePhnum); + programHeader = (elfProgramHeader *) kmalloc(sizeof(elfProgramHeader) * binaryHeader->ePhnum); assert(programHeader); - fseek(kmod_fd,binaryHeader->ePhoff,0); - fread(programHeader,sizeof(elfSectionHeader),binaryHeader->ePhnum,kmod_fd); + fseek(kmod_fd, binaryHeader->ePhoff, 0); + fread(programHeader, sizeof(elfSectionHeader), binaryHeader->ePhnum, kmod_fd); - sectionHeader = (elfSectionHeader *)kmalloc(sizeof(elfSectionHeader)*binaryHeader->eShnum); + sectionHeader = (elfSectionHeader *) kmalloc(sizeof(elfSectionHeader) * binaryHeader->eShnum); assert(sectionHeader); - fseek(kmod_fd,binaryHeader->eShoff,0); - fread(sectionHeader,sizeof(elfSectionHeader),binaryHeader->eShnum,kmod_fd); + fseek(kmod_fd, binaryHeader->eShoff, 0); + fread(sectionHeader, sizeof(elfSectionHeader), binaryHeader->eShnum, kmod_fd); - shStr = (char *)kmalloc(sectionHeader[binaryHeader->eShstrndx].shSize); - fseek(kmod_fd,sectionHeader[binaryHeader->eShstrndx].shOffset,0); - fread(shStr,sectionHeader[binaryHeader->eShstrndx].shSize,1,kmod_fd); + shStr = (char *) kmalloc(sectionHeader[binaryHeader->eShstrndx].shSize); + fseek(kmod_fd, sectionHeader[binaryHeader->eShstrndx].shOffset, 0); + fread(shStr, sectionHeader[binaryHeader->eShstrndx].shSize, 1, kmod_fd); - for (i=0;iePhnum;i++) { + for (i = 0; i < binaryHeader->ePhnum; i++) { switch (programHeader[i].phType) { case PT_LOAD: case PT_DYNAMIC: - newLoc = (char *)programHeader[i].phVaddr + LD_START; + newLoc = (char *) programHeader[i].phVaddr + LD_START; /* - Allocate Memory Im Going To Have To Make This Load Memory With Correct - Settings so it helps us in the future - */ - for (x=0;x < ((programHeader[i].phMemsz)+4095);x += 0x1000) { + Allocate Memory Im Going To Have To Make This Load Memory With Correct + Settings so it helps us in the future + */ + for (x = 0; x < ((programHeader[i].phMemsz) + 4095); x += 0x1000) { /* make r/w or ro */ - if ((vmm_remapPage(vmm_findFreePage(_current->id),((programHeader[i].phVaddr & 0xFFFFF000) + x + LD_START),PAGE_DEFAULT)) == 0x0) - kpanic("vmmRemapPage: ld\n"); - memset((void *)((programHeader[i].phVaddr & 0xFFFFF000) + x + LD_START),0x0,0x1000); - } + if ((vmm_remapPage(vmm_findFreePage(_current->id), ((programHeader[i].phVaddr & 0xFFFFF000) + x + LD_START), PAGE_DEFAULT)) == 0x0) + kpanic("vmmRemapPage: ld\n"); + memset((void *) ((programHeader[i].phVaddr & 0xFFFFF000) + x + LD_START), 0x0, 0x1000); + } /* Now Load Section To Memory */ - fseek(kmod_fd,programHeader[i].phOffset,0x0); - fread(newLoc,programHeader[i].phFilesz,1,kmod_fd); - break; + fseek(kmod_fd, programHeader[i].phOffset, 0x0); + fread(newLoc, programHeader[i].phFilesz, 1, kmod_fd); + break; case PT_GNU_STACK: /* Tells us if the stack should be executable. Failsafe to executable - until we add checking */ - break; + until we add checking */ + break; case PT_PAX_FLAGS: - /* Not sure... */ - break; + /* Not sure... */ + break; default: kprintf("Unhandled Header : %08x\n", programHeader[i].phType); - break; - } + break; } + } - for (i=0x0;ieShnum;i++) { + for (i = 0x0; i < binaryHeader->eShnum; i++) { switch (sectionHeader[i].shType) { - case 3: - if (!strcmp((shStr + sectionHeader[i].shName),".dynstr")) { - dynStr = (char *)kmalloc(sectionHeader[i].shSize); - fseek(kmod_fd,sectionHeader[i].shOffset,0x0); - fread(dynStr,sectionHeader[i].shSize,1,kmod_fd); - } - break; + case 3: + if (!strcmp((shStr + sectionHeader[i].shName), ".dynstr")) { + dynStr = (char *) kmalloc(sectionHeader[i].shSize); + fseek(kmod_fd, sectionHeader[i].shOffset, 0x0); + fread(dynStr, sectionHeader[i].shSize, 1, kmod_fd); + } + break; case 9: - elfRel = (elfPltInfo *)kmalloc(sectionHeader[i].shSize); - fseek(kmod_fd,sectionHeader[i].shOffset,0x0); - fread(elfRel,sectionHeader[i].shSize,1,kmod_fd); + elfRel = (elfPltInfo *) kmalloc(sectionHeader[i].shSize); + fseek(kmod_fd, sectionHeader[i].shOffset, 0x0); + fread(elfRel, sectionHeader[i].shSize, 1, kmod_fd); - for (x=0x0;xeEntry + LD_START; @@ -207,8 +201,8 @@ kfree(binaryHeader); fclose(kmod_fd); - return((uInt32)i); - } + return ((uInt32) i); +} /*** END diff --git a/sys/lib/assert.c b/sys/lib/assert.c index f914131..fa2e3c1 100644 --- a/sys/lib/assert.c +++ b/sys/lib/assert.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - Copyright (c) 2002 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: assert.c 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include diff --git a/sys/lib/atan.c b/sys/lib/atan.c index 9c68b98..348e1ce 100644 --- a/sys/lib/atan.c +++ b/sys/lib/atan.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - Copyright (c) 2002 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: atan.c 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include diff --git a/sys/lib/divdi3.c b/sys/lib/divdi3.c index cd33f1e..beb7869 100644 --- a/sys/lib/divdi3.c +++ b/sys/lib/divdi3.c @@ -1,41 +1,40 @@ -/***************************************************************************************** - Copyright (c) 2002 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: divdi3.c 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include -u_quad_t __udivdi3(u_quad_t a,u_quad_t b) { - return(0); /* Quick Hack */ - } +u_quad_t __udivdi3(u_quad_t a, u_quad_t b) { + return (0); /* Quick Hack */ +} -quad_t __divdi3(quad_t a,quad_t b) { - return(0); /* Quick Hack */ - } +quad_t __divdi3(quad_t a, quad_t b) { + return (0); /* Quick Hack */ +} /*** $Log: divdi3.c,v $ diff --git a/sys/lib/kmalloc.c b/sys/lib/kmalloc.c index 94531b4..4fd419e 100644 --- a/sys/lib/kmalloc.c +++ b/sys/lib/kmalloc.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: kmalloc.c 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include @@ -43,226 +42,220 @@ freeKernDesc - The free descriptor table (descriptors with memory backing just not in use) emptyKernDesc - The empty descriptor table (descriptors with out a memory backing) -*/ -static struct memDescriptor *usedKernDesc = 0x0; -static struct memDescriptor *freeKernDesc = 0x0; + */ +static struct memDescriptor *usedKernDesc = 0x0; +static struct memDescriptor *freeKernDesc = 0x0; static struct memDescriptor *emptyKernDesc = 0x0; /* Set up our spinlocks so we do not corrupt linked lists if we have re-entrancy -*/ -static struct spinLock mallocSpinLock = SPIN_LOCK_INITIALIZER; + */ +static struct spinLock mallocSpinLock = SPIN_LOCK_INITIALIZER; static struct spinLock emptyDescSpinLock = SPIN_LOCK_INITIALIZER; /************************************************************************ -Function: void *getEmptyDesc() -Description: Find An Empty Descriptor + Function: void *getEmptyDesc() + Description: Find An Empty Descriptor -Notes: + Notes: -02/17/03 - Is This Efficient? + 02/17/03 - Is This Efficient? -************************************************************************/ + ************************************************************************/ static void *getEmptyDesc() { int i = 0x0; struct memDescriptor *tmpDesc = 0x0; spinLock(&emptyDescSpinLock); - + tmpDesc = emptyKernDesc; - + if (tmpDesc != 0x0) { - emptyKernDesc = tmpDesc->next; - if (emptyKernDesc != 0x0) + emptyKernDesc = tmpDesc->next; + if (emptyKernDesc != 0x0) emptyKernDesc->prev = 0x0; - - - tmpDesc->next = 0x0; - tmpDesc->prev = 0x0; + + tmpDesc->next = 0x0; + tmpDesc->prev = 0x0; spinUnlock(&emptyDescSpinLock); - return(tmpDesc); - } - if ((emptyKernDesc = (struct memDescriptor *)vmm_getFreeMallocPage(4)) == 0x0) + return (tmpDesc); + } + if ((emptyKernDesc = (struct memDescriptor *) vmm_getFreeMallocPage(4)) == 0x0) kpanic("Error: vmmGetFreeKernelPage returned NULL\n"); - + /* zero out the memory so we know there is no garbage */ - memset(emptyKernDesc,0x0,0x4000); + memset(emptyKernDesc, 0x0, 0x4000); emptyKernDesc[0].next = &emptyKernDesc[1]; - for (i = 0x1;i < ((0x4000/sizeof(struct memDescriptor)));i++) { - if (i+1 < (0x4000/sizeof(struct memDescriptor))) - emptyKernDesc[i].next = &emptyKernDesc[i+1]; + for (i = 0x1; i < ((0x4000 / sizeof(struct memDescriptor))); i++) { + if (i + 1 < (0x4000 / sizeof(struct memDescriptor))) + emptyKernDesc[i].next = &emptyKernDesc[i + 1]; else emptyKernDesc[i].next = 0x0; - emptyKernDesc[i].prev = &emptyKernDesc[i-1]; - } + emptyKernDesc[i].prev = &emptyKernDesc[i - 1]; + } tmpDesc = &emptyKernDesc[0]; - emptyKernDesc = tmpDesc->next; + emptyKernDesc = tmpDesc->next; emptyKernDesc->prev = 0x0; - tmpDesc->next = 0x0; - tmpDesc->prev = 0x0; + tmpDesc->next = 0x0; + tmpDesc->prev = 0x0; spinUnlock(&emptyDescSpinLock); - return(tmpDesc); - } + return (tmpDesc); +} /************************************************************************ -Function: void insertFreeDesc(struct memDescriptor *freeDesc) -Description: This Function Inserts A Free Descriptor On The List Which Is - Kept In Size Order + Function: void insertFreeDesc(struct memDescriptor *freeDesc) + Description: This Function Inserts A Free Descriptor On The List Which Is + Kept In Size Order -Notes: + Notes: -02/17/03 - This Was Inspired By TCA's Great Wisdom - - "[20:20:59] You should just insert it in order" + 02/17/03 - This Was Inspired By TCA's Great Wisdom - + "[20:20:59] You should just insert it in order" -************************************************************************/ + ************************************************************************/ static int insertFreeDesc(struct memDescriptor *freeDesc) { struct memDescriptor *tmpDesc = 0x0; assert(freeDesc); - + if (freeDesc->limit <= 0x0) kpanic("Inserting Descriptor with no limit\n"); - + if (freeKernDesc != 0x0) { - - #if 0 + +#if 0 freeDesc->next = freeKernDesc; freeDesc->prev = 0x0; freeKernDesc->prev = freeDesc; freeKernDesc = freeDesc; - #endif - - for (tmpDesc = freeKernDesc;tmpDesc != 0x0;tmpDesc = tmpDesc->next) { +#endif + + for (tmpDesc = freeKernDesc; tmpDesc != 0x0; tmpDesc = tmpDesc->next) { if (freeDesc->limit <= tmpDesc->limit) { - + freeDesc->prev = tmpDesc->prev; if (tmpDesc->prev != 0x0) tmpDesc->prev->next = freeDesc; - - tmpDesc->prev = freeDesc; + tmpDesc->prev = freeDesc; freeDesc->next = tmpDesc; - + if (tmpDesc == freeKernDesc) freeKernDesc = freeDesc; - return(0x0); - } - if (tmpDesc->next == 0x0) { - tmpDesc->next = freeDesc; - freeDesc->prev = tmpDesc; - freeDesc->next = 0x0; - return(0x0); - } + return (0x0); } - kpanic("didnt Insert\n"); - return(0x0); + if (tmpDesc->next == 0x0) { + tmpDesc->next = freeDesc; + freeDesc->prev = tmpDesc; + freeDesc->next = 0x0; + return (0x0); + } } + kpanic("didnt Insert\n"); + return (0x0); + } else { freeDesc->prev = 0x0; freeDesc->next = 0x0; freeKernDesc = freeDesc; - return(0x0); - } - - return(0x1); + return (0x0); } + return (0x1); +} + /************************************************************************ -Function: void mergeMemBlocks() -Description: This Function Will Merge Free Blocks And Free Pages + Function: void mergeMemBlocks() + Description: This Function Will Merge Free Blocks And Free Pages -Notes: + Notes: -03/05/03 - We Have A Problem It Seems The First Block Is Limit 0x0 + 03/05/03 - We Have A Problem It Seems The First Block Is Limit 0x0 -************************************************************************/ + ************************************************************************/ static void mergeMemBlocks() { struct memDescriptor *tmpDesc1 = 0x0; struct memDescriptor *tmpDesc2 = 0x0; - uInt32 baseAddr = 0x0; + uInt32 baseAddr = 0x0; return; //Loop The Free Descriptors See If We Can Merge Them - mergeStart: - for (tmpDesc1=freeKernDesc;tmpDesc1 != 0x0;tmpDesc1=tmpDesc1->next) { + mergeStart: for (tmpDesc1 = freeKernDesc; tmpDesc1 != 0x0; tmpDesc1 = tmpDesc1->next) { /* Compare The Base Addr With The Other Descriptors If You Find The One That You Are Looking For Lets Merge Them - */ + */ if (tmpDesc1->limit != 0x0) { - baseAddr = (uInt32)tmpDesc1->baseAddr + (uInt32)tmpDesc1->limit; - for (tmpDesc2=freeKernDesc;tmpDesc2;tmpDesc2=tmpDesc2->next) { - if ((uInt32)tmpDesc2->baseAddr == baseAddr) { + baseAddr = (uInt32) tmpDesc1->baseAddr + (uInt32) tmpDesc1->limit; + for (tmpDesc2 = freeKernDesc; tmpDesc2; tmpDesc2 = tmpDesc2->next) { + if ((uInt32) tmpDesc2->baseAddr == baseAddr) { tmpDesc1->limit += tmpDesc2->limit; tmpDesc2->baseAddr = 0x0; - tmpDesc2->limit = 0x0; + tmpDesc2->limit = 0x0; if (tmpDesc2->prev) { tmpDesc2->prev->next = tmpDesc2->next; - } + } if (tmpDesc2->next) { tmpDesc2->next->prev = tmpDesc2->prev; - } - tmpDesc2->prev = 0x0; - tmpDesc2->next = emptyKernDesc; + } + tmpDesc2->prev = 0x0; + tmpDesc2->next = emptyKernDesc; emptyKernDesc->prev = tmpDesc2; - emptyKernDesc = tmpDesc2; + emptyKernDesc = tmpDesc2; if (tmpDesc1->prev) { tmpDesc1->prev->next = tmpDesc1->next; - } + } if (tmpDesc1->next) { tmpDesc1->next->prev = tmpDesc1->prev; - } + } tmpDesc1->prev = 0x0; tmpDesc1->next = 0x0; - kprintf("mergememBlocks: [%i]\n",tmpDesc1->limit); + kprintf("mergememBlocks: [%i]\n", tmpDesc1->limit); insertFreeDesc(tmpDesc1); //tmpDesc1 = freeKernDesc; - goto mergeStart; + goto mergeStart; break; - } } } } - return; } - + return; +} /************************************************************************ -Function: void *kmalloc(uInt32 len) -Description: Allocate Kernel Memory + Function: void *kmalloc(uInt32 len) + Description: Allocate Kernel Memory -Notes: + Notes: -02/17/03 - Do I Still Need To Pass In The Pid? + 02/17/03 - Do I Still Need To Pass In The Pid? -************************************************************************/ + ************************************************************************/ void *kmalloc(uInt32 len) { struct memDescriptor *tmpDesc1 = 0x0; struct memDescriptor *tmpDesc2 = 0x0; - char *buf = 0x0; - int i = 0x0; - uInt16 pages = 0x0; - + char *buf = 0x0; + int i = 0x0; + uInt16 pages = 0x0; spinLock(&mallocSpinLock); - + len = MALLOC_ALIGN(len); - if (len == 0x0) { spinUnlock(&mallocSpinLock); - kprintf("kmalloc: len = 0!\n"); - return(0x0); - } - for (tmpDesc1 = freeKernDesc;tmpDesc1 != 0x0;tmpDesc1=tmpDesc1->next) { + kprintf("kmalloc: len = 0!\n"); + return (0x0); + } + for (tmpDesc1 = freeKernDesc; tmpDesc1 != 0x0; tmpDesc1 = tmpDesc1->next) { assert(tmpDesc1); if (tmpDesc1->limit >= len) { if (tmpDesc1->prev != 0x0) @@ -277,7 +270,7 @@ tmpDesc1->next = usedKernDesc; if (usedKernDesc != 0x0) usedKernDesc->prev = tmpDesc1; - usedKernDesc = tmpDesc1; + usedKernDesc = tmpDesc1; if (tmpDesc1->limit > len) { tmpDesc2 = getEmptyDesc(); assert(tmpDesc2); @@ -287,81 +280,82 @@ tmpDesc2->next = 0x0; tmpDesc2->prev = 0x0; insertFreeDesc(tmpDesc2); - } - buf = (char *)tmpDesc1->baseAddr; - for (i=0;ilimit;i++) { - buf[i] = (char)0x0; - } + } + buf = (char *) tmpDesc1->baseAddr; + for (i = 0; i < tmpDesc1->limit; i++) { + buf[i] = (char) 0x0; + } spinUnlock(&mallocSpinLock); //kprintf("m1[%i:%i:0x%X]",tmpDesc1->limit,len,tmpDesc1->baseAddr); - assert(tmpDesc1->baseAddr); - return(tmpDesc1->baseAddr); - } + assert(tmpDesc1->baseAddr); + return (tmpDesc1->baseAddr); } + } tmpDesc1 = getEmptyDesc(); //kprintf("no empty desc\n"); if (tmpDesc1 != 0x0) { - pages = ((len + 4095)/4096); - tmpDesc1->baseAddr = (struct memDescriptor *)vmm_getFreeMallocPage(pages); - tmpDesc1->limit = len; - tmpDesc1->next = usedKernDesc; - tmpDesc1->prev = 0x0; + pages = ((len + 4095) / 4096); + tmpDesc1->baseAddr = (struct memDescriptor *) vmm_getFreeMallocPage(pages); + tmpDesc1->limit = len; + tmpDesc1->next = usedKernDesc; + tmpDesc1->prev = 0x0; if (usedKernDesc != 0x0) - usedKernDesc->prev = tmpDesc1; - usedKernDesc = tmpDesc1; + usedKernDesc->prev = tmpDesc1; + usedKernDesc = tmpDesc1; - if (((pages * 4096)-len) > 0x0) { - tmpDesc2 = getEmptyDesc(); + if (((pages * 4096) - len) > 0x0) { + tmpDesc2 = getEmptyDesc(); assert(tmpDesc2); tmpDesc2->baseAddr = tmpDesc1->baseAddr + tmpDesc1->limit; - tmpDesc2->limit = ((pages * 4096)-len); - tmpDesc2->prev = 0x0; - tmpDesc2->next = 0x0; + tmpDesc2->limit = ((pages * 4096) - len); + tmpDesc2->prev = 0x0; + tmpDesc2->next = 0x0; if (tmpDesc2->limit <= 0x0) - kprintf("kmalloc-2 tmpDesc2: [%i]\n",tmpDesc2->limit); + kprintf("kmalloc-2 tmpDesc2: [%i]\n", tmpDesc2->limit); insertFreeDesc(tmpDesc2); - } + } - buf = (char *)tmpDesc1->baseAddr; - for (i=0;ilimit;i++) { - buf[i] = (char)0x0; - } + buf = (char *) tmpDesc1->baseAddr; + for (i = 0; i < tmpDesc1->limit; i++) { + buf[i] = (char) 0x0; + } spinUnlock(&mallocSpinLock); //kprintf("baseAddr2[0x%X:0x%X]",tmpDesc1,tmpDesc1->baseAddr); //kprintf("m2[%i:%i:0x%X]",tmpDesc1->limit,len,tmpDesc1->baseAddr); - assert(tmpDesc1->baseAddr); - return(tmpDesc1->baseAddr); - } + assert(tmpDesc1->baseAddr); + return (tmpDesc1->baseAddr); + } //Return Null If Unable To Malloc spinUnlock(&mallocSpinLock); //kprintf("baseAddr3[0x0]"); - return(0x0); - } - + return (0x0); +} + /************************************************************************ -Function: void kfree(void *baseAddr) -Description: This Will Find The Descriptor And Free It + Function: void kfree(void *baseAddr) + Description: This Will Find The Descriptor And Free It -Notes: + Notes: -02/17/03 - I need To Make It Join Descriptors + 02/17/03 - I need To Make It Join Descriptors -************************************************************************/ + ************************************************************************/ void kfree(void *baseAddr) { struct memDescriptor *tmpDesc = 0x0; - if (baseAddr == 0x0) return; + if (baseAddr == 0x0) + return; assert(baseAddr); assert(usedKernDesc); spinLock(&mallocSpinLock); - - for (tmpDesc = usedKernDesc;tmpDesc != 0x0;tmpDesc = tmpDesc->next) { - + + for (tmpDesc = usedKernDesc; tmpDesc != 0x0; tmpDesc = tmpDesc->next) { + if (tmpDesc->baseAddr == baseAddr) { - memset(tmpDesc->baseAddr,0xBE,tmpDesc->limit); - + memset(tmpDesc->baseAddr, 0xBE, tmpDesc->limit); + if (usedKernDesc == tmpDesc) usedKernDesc = tmpDesc->next; @@ -371,24 +365,23 @@ if (tmpDesc->next != 0x0) tmpDesc->next->prev = tmpDesc->prev; - tmpDesc->next = 0x0; tmpDesc->prev = 0x0; - + if (tmpDesc->limit <= 0x0) - kprintf("kfree tmpDesc1: [%i]\n",tmpDesc->limit); + kprintf("kfree tmpDesc1: [%i]\n", tmpDesc->limit); //kprintf("{0x%X}",tmpDesc->baseAddr); insertFreeDesc(tmpDesc); - // mergeMemBlocks(); + // mergeMemBlocks(); spinUnlock(&mallocSpinLock); return; - } } - spinUnlock(&mallocSpinLock); - kprintf("Kernel: Error Freeing Descriptor! [0x%X]\n",(uInt32)baseAddr); - return; } + spinUnlock(&mallocSpinLock); + kprintf("Kernel: Error Freeing Descriptor! [0x%X]\n", (uInt32) baseAddr); + return; +} /*** $Log: kmalloc.c,v $ @@ -476,18 +469,18 @@ Revision 1.21 2004/07/28 15:05:43 reddawg Major: - Pages now have strict security enforcement. - Many null dereferences have been resolved. - When apps loaded permissions set for pages rw and ro + Pages now have strict security enforcement. + Many null dereferences have been resolved. + When apps loaded permissions set for pages rw and ro Revision 1.20 2004/07/28 00:17:05 reddawg Major: - Disconnected page 0x0 from the system... Unfortunately this broke many things - all of which have been fixed. This was good because nothing deferences NULL - any more. + Disconnected page 0x0 from the system... Unfortunately this broke many things + all of which have been fixed. This was good because nothing deferences NULL + any more. Things affected: - malloc,kmalloc,getfreepage,getfreevirtualpage,pagefault,fork,exec,ld,ld.so,exec,file + malloc,kmalloc,getfreepage,getfreevirtualpage,pagefault,fork,exec,ld,ld.so,exec,file Revision 1.19 2004/07/26 19:15:49 reddawg test code, fixes and the like @@ -541,7 +534,7 @@ Revision 1.6 2004/05/26 11:56:51 reddawg kmalloc: fixed memrgeMemBlocks hopefully it will prevent future segfault issues - by not having any more overlapping blocks + by not having any more overlapping blocks Revision 1.5 2004/05/25 14:01:14 reddawg Implimented Better Spinlocking No More Issues With KMALLOC which actually diff --git a/sys/lib/kprintf.c b/sys/lib/kprintf.c index f19d4ce..36c9cce 100644 --- a/sys/lib/kprintf.c +++ b/sys/lib/kprintf.c @@ -1,40 +1,39 @@ -/***************************************************************************************** - Copyright (c) 2002 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: kprintf.c 81 2016-01-11 16:30:47Z reddawg $ - - *****************************************************************************************/ +/*- + * 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. + */ #include #include #include #include -static char *ksprintn( char *nbuf, uintmax_t num, int base, int *lenp, int upper ); +static char *ksprintn(char *nbuf, uintmax_t num, int base, int *lenp, int upper); -static __inline int imax( int a, int b ) { +static __inline int imax(int a, int b) { return (a > b ? a : b); } @@ -45,16 +44,16 @@ u_long ul[2]; /* as two unsigned longs */ }; -static void __shl( register digit *p, register int len, register int sh ) { +static void __shl(register digit *p, register int len, register int sh) { register int i; - for ( i = 0; i < len; i++ ) + for (i = 0; i < len; i++) p[i] = LHALF( p[i] << sh ) | (p[i + 1] >> (HALF_BITS - sh)); - p[i] = LHALF( p[i] << sh ); + p[i] = LHALF(p[i] << sh); } -u_quad_t __qdivrem( u_quad_t uq, u_quad_t vq, u_quad_t *arq ) { +u_quad_t __qdivrem(u_quad_t uq, u_quad_t vq, u_quad_t *arq) { union uu tmp; digit *u, *v, *q; register digit v1, v2; @@ -65,17 +64,17 @@ /* * Take care of special cases: divide by zero, and u < v. */ - if ( vq == 0 ) { + if (vq == 0) { /* divide by zero. */ static volatile const unsigned int zero = 0; tmp.ul[H] = tmp.ul[L] = 1 / zero; - if ( arq ) + if (arq) *arq = uq; return (tmp.q); } - if ( uq < vq ) { - if ( arq ) + if (uq < vq) { + if (arq) *arq = uq; return (0); } @@ -98,17 +97,17 @@ */ tmp.uq = uq; u[0] = 0; - u[1] = HHALF( tmp.ul[H] ); - u[2] = LHALF( tmp.ul[H] ); - u[3] = HHALF( tmp.ul[L] ); - u[4] = LHALF( tmp.ul[L] ); + u[1] = HHALF(tmp.ul[H]); + u[2] = LHALF(tmp.ul[H]); + u[3] = HHALF(tmp.ul[L]); + u[4] = LHALF(tmp.ul[L]); tmp.uq = vq; - v[1] = HHALF( tmp.ul[H] ); - v[2] = LHALF( tmp.ul[H] ); - v[3] = HHALF( tmp.ul[L] ); - v[4] = LHALF( tmp.ul[L] ); - for ( n = 4; v[1] == 0; v++ ) { - if ( --n == 1 ) { + v[1] = HHALF(tmp.ul[H]); + v[2] = LHALF(tmp.ul[H]); + v[3] = HHALF(tmp.ul[L]); + v[4] = LHALF(tmp.ul[L]); + for (n = 4; v[1] == 0; v++) { + if (--n == 1) { u_long rbj; /* r*B+u[j] (not root boy jim) */ digit q1, q2, q3, q4; @@ -122,16 +121,16 @@ */ t = v[2]; /* nonzero, by definition */ q1 = u[1] / t; - rbj = COMBINE( u[1] % t, u[2] ); + rbj = COMBINE(u[1] % t, u[2]); q2 = rbj / t; - rbj = COMBINE( rbj % t, u[3] ); + rbj = COMBINE(rbj % t, u[3]); q3 = rbj / t; - rbj = COMBINE( rbj % t, u[4] ); + rbj = COMBINE(rbj % t, u[4]); q4 = rbj / t; - if ( arq ) + if (arq) *arq = rbj % t; - tmp.ul[H] = COMBINE( q1, q2 ); - tmp.ul[L] = COMBINE( q3, q4 ); + tmp.ul[H] = COMBINE(q1, q2); + tmp.ul[L] = COMBINE(q3, q4); return (tmp.q); } } @@ -140,9 +139,9 @@ * there is a complete four-digit quotient at &qspace[1] when * we finally stop. */ - for ( m = 4 - n; u[1] == 0; u++ ) + for (m = 4 - n; u[1] == 0; u++) m--; - for ( i = 4 - m; --i >= 0; ) + for (i = 4 - m; --i >= 0;) q[i] = 0; q += 4 - m; @@ -153,11 +152,11 @@ * D1: choose multiplier 1 << d to ensure v[1] >= B/2. */ d = 0; - for ( t = v[1]; t < B / 2; t <<= 1 ) + for (t = v[1]; t < B / 2; t <<= 1) d++; - if ( d > 0 ) { - __shl( &u[0], m + n, d ); /* u <<= d */ - __shl( &v[1], n - 1, d ); /* v <<= d */ + if (d > 0) { + __shl(&u[0], m + n, d); /* u <<= d */ + __shl(&v[1], n - 1, d); /* v <<= d */ } /* * D2: j = 0. @@ -179,19 +178,19 @@ uj0 = u[j + 0]; /* for D3 only -- note that u[j+...] change */ uj1 = u[j + 1]; /* for D3 only */ uj2 = u[j + 2]; /* for D3 only */ - if ( uj0 == v1 ) { + if (uj0 == v1) { qhat = B; rhat = uj1; goto qhat_too_big; } else { - u_long nn = COMBINE( uj0, uj1 ); + u_long nn = COMBINE(uj0, uj1); qhat = nn / v1; rhat = nn % v1; } - while ( v2 * qhat > COMBINE( rhat, uj2 ) ) { + while (v2 * qhat > COMBINE(rhat, uj2)) { qhat_too_big: qhat--; - if ( (rhat += v1) >= B ) + if ((rhat += v1) >= B) break; } /* @@ -200,88 +199,86 @@ * We split this up so that we do not require v[0] = 0, * and to eliminate a final special case. */ - for ( t = 0, i = n; i > 0; i-- ) { + for (t = 0, i = n; i > 0; i--) { t = u[i + j] - v[i] * qhat - t; - u[i + j] = LHALF( t ); - t = (B - HHALF( t )) & (B - 1); + u[i + j] = LHALF(t); + t = (B - HHALF(t)) & (B - 1); } t = u[j] - t; - u[j] = LHALF( t ); + u[j] = LHALF(t); /* * D5: test remainder. * There is a borrow if and only if HHALF(t) is nonzero; * in that (rare) case, qhat was too large (by exactly 1). * Fix it by adding v[1..n] to u[j..j+n]. */ - if ( HHALF( t ) ) { + if (HHALF(t)) { qhat--; - for ( t = 0, i = n; i > 0; i-- ) { /* D6: add back. */ + for (t = 0, i = n; i > 0; i--) { /* D6: add back. */ t += u[i + j] + v[i]; - u[i + j] = LHALF( t ); - t = HHALF( t ); + u[i + j] = LHALF(t); + t = HHALF(t); } - u[j] = LHALF( u[j] + t ); + 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 * u[m..m+n] >> d (this is at most n digits and thus fits in * u[m+1..m+n], but we may need more source digits). */ - if ( arq ) { - if ( d ) { - for ( i = m + n; i > m; --i ) - u[i] = (u[i] >> d) | LHALF( u[i - 1] << (HALF_BITS - d) ); + if (arq) { + if (d) { + for (i = m + n; i > m; --i) + u[i] = (u[i] >> d) | LHALF(u[i - 1] << (HALF_BITS - d)); u[i] = 0; } - tmp.ul[H] = COMBINE( uspace[1], uspace[2] ); - tmp.ul[L] = COMBINE( uspace[3], uspace[4] ); + tmp.ul[H] = COMBINE(uspace[1], uspace[2]); + tmp.ul[L] = COMBINE(uspace[3], uspace[4]); *arq = tmp.q; } - tmp.ul[H] = COMBINE( qspace[1], qspace[2] ); - tmp.ul[L] = COMBINE( qspace[3], qspace[4] ); + tmp.ul[H] = COMBINE(qspace[1], qspace[2]); + tmp.ul[L] = COMBINE(qspace[3], qspace[4]); return (tmp.q); } -u_quad_t -__umoddi3( a, b ) -u_quad_t a, b; -{ +u_quad_t __umoddi3(a, b) + u_quad_t a, b; { u_quad_t r; - (void)__qdivrem(a, b, &r); + (void) __qdivrem(a, b, &r); return (r); } int printOff = 0x0; int ogprintOff = 0x1; -int kprintf( const char *fmt, ... ) { +int kprintf(const char *fmt, ...) { va_list ap; int retval; char buf[1024]; - va_start( ap, fmt ); + va_start(ap, fmt); - retval = kvprintf( fmt, NULL, &buf, 10, ap ); + retval = kvprintf(fmt, NULL, &buf, 10, ap); buf[retval] = '\0'; - va_end( ap ); + va_end(ap); - kprint( buf ); + kprint(buf); return (retval); } -int sprintf( char *buf, const char *fmt, ... ) { +int sprintf(char *buf, const char *fmt, ...) { va_list args; int i; - va_start( args, fmt ); + va_start(args, fmt); //i = vsprintf( buf, fmt, args ); - i = kvprintf( fmt, NULL, buf, 10, args ); - va_end( args ); + i = kvprintf(fmt, NULL, buf, 10, args); + va_end(args); return (i); } @@ -312,7 +309,7 @@ * ("%*D", len, ptr, " " -> XX XX XX XX ... */ -int kvprintf( char const *fmt, void (*func)( int, void* ), void *arg, int radix, va_list ap ) { +int kvprintf(char const *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; @@ -327,24 +324,24 @@ int stop = 0, retval = 0; num = 0; - if ( !func ) + if (!func) d = (char *) arg; else d = NULL; - if ( fmt == NULL ) + if (fmt == NULL) fmt = "(fmt null)\n"; - if ( radix < 2 || radix > 36 ) + if (radix < 2 || radix > 36) radix = 10; - for ( ;; ) { + for (;;) { padc = ' '; width = 0; - while ( (ch = (u_char) * fmt++) != '%' || stop ) { - if ( ch == '\0' ) + while ((ch = (u_char) *fmt++) != '%' || stop) { + if (ch == '\0') return (retval); - PCHAR( ch ); + PCHAR(ch); } percent = fmt - 1; qflag = 0; @@ -361,319 +358,315 @@ 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 ) - ; + 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) + ; 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); - } - 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-- ) - ; + else { + dwidth = va_arg(ap, int); + } + 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 ) + 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 + 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; + } + 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++) + continue; - 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; - } - 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++ ) - continue; + width -= n; - 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 && 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'); + } + } + while (dwidth-- > 0) + PCHAR('0') + ; - 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' ); - } - } - 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; - break; + 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; + break; } } #undef PCHAR } -static char *ksprintn( char *nbuf, uintmax_t num, int base, int *lenp, int upper ) { +static char *ksprintn(char *nbuf, uintmax_t num, int base, int *lenp, int upper) { char *p, c; p = nbuf; *p = '\0'; do { - c = hex2ascii( num % base ); - *++p = upper ? toupper( c ) : c; - } while ( num /= base ); + c = hex2ascii(num % base); + *++p = upper ? toupper(c) : c; + } while (num /= base); - if ( lenp ) + if (lenp) *lenp = p - nbuf; return (p); diff --git a/sys/lib/libcpp.cc b/sys/lib/libcpp.cc index d0bad9a..152bd49 100644 --- a/sys/lib/libcpp.cc +++ b/sys/lib/libcpp.cc @@ -1,70 +1,75 @@ -/***************************************************************************************** - Copyright (c) 2002-2004 The UbixOS Project - All rights reserved. +/*- + * 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. + */ - 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: libcpp.cc 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ - -extern "C" -{ +extern "C" { #include #include -void __pure_virtual() { while(1); } + void __pure_virtual() { + while (1) + ; + } -void __cxa_pure_virtual() { while(1); } + void __cxa_pure_virtual() { + while (1) + ; + } -/* Don't plan on exiting the kernel...so do nothing. */ -int __cxa_atexit(void (*func)(void *), void * arg, void * d) { return 0; } + /* Don't plan on exiting the kernel...so do nothing. */ + int __cxa_atexit(void (*func)(void *), void * arg, void * d) { + return 0; + } -void __dso_handle() { while(1); } + void __dso_handle() { + while (1) + ; + } } #include -void * operator new[](unsigned size) -{ - return kmalloc(size); +void * operator new[](unsigned size) { + return kmalloc(size); } -void operator delete[](void * ptr) -{ - kfree(ptr); +void operator delete[](void * ptr) { + kfree(ptr); - return; + return; } -void * operator new(unsigned size) -{ - void * ptr = kmalloc(size); - return ptr; +void * operator new(unsigned size) { + void * ptr = kmalloc(size); + return ptr; } -void operator delete(void * ptr) -{ - kfree(ptr); - return; +void operator delete(void * ptr) { + kfree(ptr); + return; } /*** diff --git a/sys/lib/memcpy.c b/sys/lib/memcpy.c index ee11504..14bef90 100644 --- a/sys/lib/memcpy.c +++ b/sys/lib/memcpy.c @@ -1,2 +1,30 @@ -#define MEMCOPY +/*- + * 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 MEMCOPY #include "bcopy.c" diff --git a/sys/lib/memset.c b/sys/lib/memset.c index cc177cd..916a15f 100644 --- a/sys/lib/memset.c +++ b/sys/lib/memset.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - Copyright (c) 2002 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: memset.c 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include @@ -41,44 +40,43 @@ dst = dst0; - if (length < 3 * wsize) { - while (length != 0) { - *dst++ = VAL; - --length; - } - return(dst0); - } - - if ((c = (uInt8)c0) != 0) { /* Fill the word. */ - c = (c << 8) | c; /* u_int is 16 bits. */ - c = (c << 16) | c; /* u_int is 32 bits. */ - } - - /* Align destination by filling in bytes. */ - if ((t = (long)dst & wmask) != 0) { - t = wsize - t; - length -= t; - do { - *dst++ = VAL; - } while (--t != 0); - } - - /* Fill words. Length was >= 2*words so we know t >= 1 here. */ - t = length / wsize; - do { - *(u_int *)dst = WIDEVAL; - dst += wsize; - } while (--t != 0); - - /* Mop up trailing bytes, if any. */ - t = length & wmask; - if (t != 0) - do { - *dst++ = VAL; - } while (--t != 0); - return(dst0); + if (length < 3 * wsize) { + while (length != 0) { + *dst++ = VAL; + --length; + } + return (dst0); } + if ((c = (uInt8) c0) != 0) { /* Fill the word. */ + c = (c << 8) | c; /* u_int is 16 bits. */ + c = (c << 16) | c; /* u_int is 32 bits. */ + } + + /* Align destination by filling in bytes. */ + if ((t = (long) dst & wmask) != 0) { + t = wsize - t; + length -= t; + do { + *dst++ = VAL; + } while (--t != 0); + } + + /* Fill words. Length was >= 2*words so we know t >= 1 here. */ + t = length / wsize; + do { + *(u_int *) dst = WIDEVAL; + dst += wsize; + } while (--t != 0); + + /* Mop up trailing bytes, if any. */ + t = length & wmask; + if (t != 0) + do { + *dst++ = VAL; + } while (--t != 0); + return (dst0); +} /*** $Log: memset.c,v $ diff --git a/sys/lib/net.c b/sys/lib/net.c index 9937904..dc8cf68 100644 --- a/sys/lib/net.c +++ b/sys/lib/net.c @@ -1,28 +1,30 @@ -/***************************************************************************************** - Copyright (c) 2002 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. -*****************************************************************************************/ +/*- + * 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. + */ #include #include @@ -32,139 +34,139 @@ #include "lib/kprintf.h" #ifndef _IN_ADDR_T_DECLARED -typedef uInt32 in_addr_t; +typedef uInt32 in_addr_t; #define _IN_ADDR_T_DECLARED #endif /* -uInt32 htonl(uInt32 n) { - uInt32 retVal = 0x0; - retVal += ((n & 0xff) << 24); - retVal += ((n & 0xff00) << 8); - retVal += ((n & 0xff0000) >> 8); - retVal += ((n & 0xff000000) >> 24); - return(retVal); - } -*/ + uInt32 htonl(uInt32 n) { + uInt32 retVal = 0x0; + retVal += ((n & 0xff) << 24); + retVal += ((n & 0xff00) << 8); + retVal += ((n & 0xff0000) >> 8); + retVal += ((n & 0xff000000) >> 24); + return(retVal); + } + */ /* -uInt32 htons(uInt32 n) { - uInt32 retVal = 0x0; - retVal = (((n & 0xff) << 8) | ((n & 0xff00) >> 8)); - return(retVal); - } -*/ + uInt32 htons(uInt32 n) { + uInt32 retVal = 0x0; + retVal = (((n & 0xff) << 8) | ((n & 0xff00) >> 8)); + return(retVal); + } + */ void bcopy(const void *src, void *dest, int len) { - memcpy(dest,src,len); - } + memcpy(dest, src, len); +} void bzero(void *data, int n) { memset(data, 0, n); - } +} #ifdef _INET_ATON int inet_aton(cp, addr) - const char *cp; - struct in_addr *addr; +const char *cp; +struct in_addr *addr; { - uInt32 parts[4]; - in_addr_t val; - char *c; - char *endptr; - int gotend, n; + uInt32 parts[4]; + in_addr_t val; + char *c; + char *endptr; + int gotend, n; - c = (char *)cp; - n = 0; - /* - * Run through the string, grabbing numbers until - * the end of the string, or some error - */ - gotend = 0; - while (!gotend) { - //errno = 0; - val = strtol(c, &endptr, 0); - kprintf("VAL: [%x]",val); + c = (char *)cp; + n = 0; + /* + * Run through the string, grabbing numbers until + * the end of the string, or some error + */ + gotend = 0; + while (!gotend) { + //errno = 0; + val = strtol(c, &endptr, 0); + kprintf("VAL: [%x]",val); - //if (errno == ERANGE) /* Fail completely if it overflowed. */ - // return (0); + //if (errno == ERANGE) /* Fail completely if it overflowed. */ + // return (0); - /* - * If the whole string is invalid, endptr will equal - * c.. this way we can make sure someone hasn't - * gone '.12' or something which would get past - * the next check. - */ - if (endptr == c) - return (0); - parts[n] = val; - c = endptr; + /* + * If the whole string is invalid, endptr will equal + * c.. this way we can make sure someone hasn't + * gone '.12' or something which would get past + * the next check. + */ + if (endptr == c) + return (0); + parts[n] = val; + c = endptr; - /* Check the next character past the previous number's end */ - switch (*c) { - case '.' : - /* Make sure we only do 3 dots .. */ - if (n == 3) /* Whoops. Quit. */ - return (0); - n++; - c++; - break; + /* Check the next character past the previous number's end */ + switch (*c) { + case '.' : + /* Make sure we only do 3 dots .. */ + if (n == 3) /* Whoops. Quit. */ + return (0); + n++; + c++; + break; - case '\0': - gotend = 1; - break; + case '\0': + gotend = 1; + break; - default: - /* - if (isspace((unsigned char)*c)) { - gotend = 1; - break; - } else - */ - return (0); /* Invalid character, so fail */ - } + default: + /* + if (isspace((unsigned char)*c)) { + gotend = 1; + break; + } else + */ + return (0); /* Invalid character, so fail */ + } - } + } - /* - * Concoct the address according to - * the number of parts specified. - */ + /* + * Concoct the address according to + * the number of parts specified. + */ - switch (n) { - case 0: /* a -- 32 bits */ - /* - * Nothing is necessary here. Overflow checking was - * already done in strtoul(). - */ - break; - case 1: /* a.b -- 8.24 bits */ - if (val > 0xffffff || parts[0] > 0xff) - return (0); - val |= parts[0] << 24; - break; + switch (n) { + case 0: /* a -- 32 bits */ + /* + * Nothing is necessary here. Overflow checking was + * already done in strtoul(). + */ + break; + case 1: /* a.b -- 8.24 bits */ + if (val > 0xffffff || parts[0] > 0xff) + return (0); + val |= parts[0] << 24; + break; - case 2: /* a.b.c -- 8.8.16 bits */ - if (val > 0xffff || parts[0] > 0xff || parts[1] > 0xff) - return (0); - val |= (parts[0] << 24) | (parts[1] << 16); - break; + case 2: /* a.b.c -- 8.8.16 bits */ + if (val > 0xffff || parts[0] > 0xff || parts[1] > 0xff) + return (0); + val |= (parts[0] << 24) | (parts[1] << 16); + break; - case 3: /* a.b.c.d -- 8.8.8.8 bits */ - if (val > 0xff || parts[0] > 0xff || parts[1] > 0xff || - parts[2] > 0xff) - return (0); - val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8); - break; - } + case 3: /* a.b.c.d -- 8.8.8.8 bits */ + if (val > 0xff || parts[0] > 0xff || parts[1] > 0xff || + parts[2] > 0xff) + return (0); + val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8); + break; + } - if (addr != NULL) - addr->s_addr = htonl(val); - return (1); + if (addr != NULL) + addr->s_addr = htonl(val); + return (1); } #endif /*** END ***/ - + diff --git a/sys/lib/ogprintf.cc b/sys/lib/ogprintf.cc index 398b2b9..3d01814 100644 --- a/sys/lib/ogprintf.cc +++ b/sys/lib/ogprintf.cc @@ -1,31 +1,30 @@ -/***************************************************************************************** - Copyright (c) 2002 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: ogprintf.cc 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include @@ -35,53 +34,44 @@ #include + static int screenRow = 0x0; + static int screenCol = 0x1; -static int screenRow = 0x0; -static int screenCol = 0x1; - -int ogPrintf(char *s) { - int i = 0x0; - int bufHeight; - ogSurface *screen = (ogDisplay_UbixOS *)systemVitals->screen; - ogBitFont *font = (ogBitFont *)systemVitals->font; + int ogPrintf(char *s) { + int i = 0x0; + int bufHeight; + ogSurface *screen = (ogDisplay_UbixOS *) systemVitals->screen; + ogBitFont *font = (ogBitFont *) systemVitals->font; + while ('\0' != s[i]) { + switch (s[i]) { + case '\t': + screenCol += 3; + break; + case '\b': + if (screenCol > 0) + --screenCol; + case '\n': + screenCol = 0; - while ('\0' != s[i]) { - switch (s[i]) { - case '\t': - screenCol += 3; - break; - case '\b': - if (screenCol > 0) --screenCol; - case '\n': - screenCol = 0; + bufHeight = ((screen->ogGetMaxY() + 1) / font->GetHeight()) - 1; + if (screenRow < bufHeight) + ++screenRow; + else { + screen->ogCopyBuf(0, 0, *screen, 0, font->GetHeight(), screen->ogGetMaxX(), screen->ogGetMaxY()); + screen->ogFillRect(0, bufHeight * font->GetHeight() + 1, screen->ogGetMaxX(), screen->ogGetMaxY(), screen->ogPack(122, 140, 163)); + } + break; + default: + font->PutChar(*screen, screenCol * font->GetWidth(), screenRow * font->GetHeight(), s[i]); + break; + } /* switch */ + ++screenCol; + ++i; + } /* while */ - bufHeight = ((screen->ogGetMaxY()+1) / font->GetHeight())-1; - if (screenRow < bufHeight) - ++screenRow; - else { - screen->ogCopyBuf(0, 0, - *screen, - 0, font->GetHeight(), - screen->ogGetMaxX(), screen->ogGetMaxY()); - screen->ogFillRect(0, bufHeight * font->GetHeight()+1, - screen->ogGetMaxX(), screen->ogGetMaxY(), - screen->ogPack(122, 140, 163)); - } - break; - default: - font->PutChar(*screen, - screenCol * font->GetWidth(), - screenRow * font->GetHeight(), - s[i]); - break; - } /* switch */ - ++screenCol; - ++i; - } /* while */ - - return 0; -} // ogPrintf + return 0; + } // ogPrintf } diff --git a/sys/lib/sqrt.c b/sys/lib/sqrt.c index 8cb7150..daf6ace 100644 --- a/sys/lib/sqrt.c +++ b/sys/lib/sqrt.c @@ -1,35 +1,34 @@ -/***************************************************************************************** - Copyright (c) 2002 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: sqrt.c 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ double sqrt(double x) { - return(x); /* Quick Hack */ - } + return (x); /* Quick Hack */ +} /*** $Log: sqrt.c,v $ diff --git a/sys/lib/strcpy.S b/sys/lib/strcpy.S index 655eb91..0f6fa8b 100644 --- a/sys/lib/strcpy.S +++ b/sys/lib/strcpy.S @@ -1,4 +1,32 @@ -.globl strcpy +/*- + * 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. + */ + + .globl strcpy strcpy: movl 4(%esp),%ecx /* dst address */ movl 8(%esp),%edx /* src address */ diff --git a/sys/lib/string.c b/sys/lib/string.c index 04409b4..af97ca8 100644 --- a/sys/lib/string.c +++ b/sys/lib/string.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: string.c 80 2016-01-11 16:24:44Z reddawg $ - - *****************************************************************************************/ +/*- + * 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. + */ #include @@ -36,15 +35,15 @@ /* This is actually used with radix [2..36] */ char const hex2ascii_data[] = "0123456789abcdefghijklmnopqrstuvwxyz"; -int strcmp( const char *str1, const char *str2 ) { - while ( (*str1 == *str2) && (*str1 != 0x0) && (*str2 != 0x0) ) { +int strcmp(const char *str1, const char *str2) { + while ((*str1 == *str2) && (*str1 != 0x0) && (*str2 != 0x0)) { str1++; str2++; } - if ( *str1 == *str2 ) { + if (*str1 == *str2) { return (0); } - else if ( *str1 > *str2 ) { + else if (*str1 > *str2) { return (1); } else { @@ -52,17 +51,17 @@ } } -int strncmp( const char * a, const char * b, size_t c ) { +int strncmp(const char * a, const char * b, size_t c) { int i = 0; - while ( i < c ) { - if ( (a[i] != b[i]) || (a[i] == '\0') || (b[i] == '\0') ) + while (i < c) { + if ((a[i] != b[i]) || (a[i] == '\0') || (b[i] == '\0')) return a[i] - b[i]; i++; } return 0; } -void *memcpyold( const void *dst, const void * src, size_t length ) { +void *memcpyold(const void *dst, const void * src, size_t length) { //size_t x = length >> 2; //size_t y = length;// & 0xf; size_t i; @@ -76,57 +75,57 @@ ((char *) dst)[length-y+i] = ((char *) src)[length-y+i]; } */ - for ( i = 0x0; i < length; i++ ) + for (i = 0x0; i < length; i++) ((char *) dst)[i] = ((char *) src)[i]; return ((void *) dst); } -int memcmp( const void * dst, const void * src, size_t length ) { +int memcmp(const void * dst, const void * src, size_t length) { size_t x = length >> 2; size_t y = length & 0xf; size_t i; - for ( i = 0; i < x; i++ ) { - if ( ((unsigned long *) dst)[i] > ((unsigned long *) src)[i] ) + for (i = 0; i < x; i++) { + if (((unsigned long *) dst)[i] > ((unsigned long *) src)[i]) return 1; - if ( ((unsigned long *) dst)[i] < ((unsigned long *) src)[i] ) + if (((unsigned long *) dst)[i] < ((unsigned long *) src)[i]) return -1; } - for ( i = 0; i < y; i++ ) { - if ( ((char *) dst)[length - y + i] > ((char *) src)[length - y + i] ) + for (i = 0; i < y; i++) { + if (((char *) dst)[length - y + i] > ((char *) src)[length - y + i]) return 1; - if ( ((char *) dst)[length - y + i] < ((char *) src)[length - y + i] ) + if (((char *) dst)[length - y + i] < ((char *) src)[length - y + i]) return -1; } return 0; } -void strncpy( char * dest, const char * src, size_t size ) { - if ( size == 0 ) +void strncpy(char * dest, const char * src, size_t size) { + if (size == 0) return; do { *dest = *src; dest++; src++; size--; - } while ( ('\0' != *(src - 1)) && (size) ); + } while (('\0' != *(src - 1)) && (size)); } -char *strstr( const char *s, char *find ) { +char *strstr(const char *s, char *find) { char c, sc; size_t len; - if ( (c = *find++) != 0 ) { - len = strlen( find ); + if ((c = *find++) != 0) { + len = strlen(find); do { do { - if ( (sc = *s++) == 0 ) + if ((sc = *s++) == 0) return (NULL); - } while ( sc != c ); - } while ( strncmp( s, find, len ) != 0 ); + } while (sc != c); + } while (strncmp(s, find, len) != 0); s--; } return ((char *) s); diff --git a/sys/lib/strlen.S b/sys/lib/strlen.S index d301949..47f3e87 100644 --- a/sys/lib/strlen.S +++ b/sys/lib/strlen.S @@ -1,4 +1,31 @@ -.globl strlen +/*- + * 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. + */ + .globl strlen strlen: pushl %edi movl 8(%esp),%edi /* string address */ diff --git a/sys/lib/strtok.c b/sys/lib/strtok.c index 27d639c..c472c89 100644 --- a/sys/lib/strtok.c +++ b/sys/lib/strtok.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - Copyright (c) 2002 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: strtok.c 79 2016-01-11 16:21:27Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include @@ -36,45 +35,44 @@ char *tok; if ((s == NULL) && ((s = *last) == NULL)) { - return(NULL); - } + return (NULL); + } -cont: - c = *s++; - for (spanp = (char *)delim; (sc = *spanp++) != 0; ) { + cont: c = *s++; + for (spanp = (char *) delim; (sc = *spanp++) != 0;) { if (c == sc) { goto cont; - } } + } if (c == 0) { *last = NULL; - return(NULL); - } + return (NULL); + } tok = s - 1; for (;;) { c = *s++; - spanp = (char *)delim; + spanp = (char *) delim; do { if ((sc = *spanp++) == c) { if (c == 0) { s = NULL; - } + } else { char *w = s - 1; *w = '\0'; - } - *last = s; - return(tok); } - } while (sc != 0); - } + *last = s; + return (tok); + } + } while (sc != 0); } +} char *strtok(char *s, const char *delim) { static char *last; return (strtok_r(s, delim, &last)); - } +} /*** $Log: strtok.c,v $ @@ -99,4 +97,3 @@ END ***/ - diff --git a/sys/lib/strtol.c b/sys/lib/strtol.c index 3b7114f..9280068 100644 --- a/sys/lib/strtol.c +++ b/sys/lib/strtol.c @@ -1,3 +1,31 @@ +/*- + * 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. + */ + #include //#include //#include @@ -6,98 +34,95 @@ #define LONG_MIN (-0x7fffffffL - 1) #define LONG_MAX 0x7fffffffL +long strtol(const char * __restrict nptr, char ** __restrict endptr, int base) { + const char *s; + unsigned long acc; + char c = 0x0; /* to remove warning */ + unsigned long cutoff; + int neg, any, cutlim; + /* + * Skip white space and pick up leading +/- sign if any. + * If base is 0, allow 0x for hex and 0 for octal, else + * assume decimal; if base is already 16, allow 0x. + */ + s = nptr; + /* + do { + c = *s++; + } while (isspace((unsigned char)c)); + */ + if (c == '-') { + neg = 1; + c = *s++; + } + else { + neg = 0; + if (c == '+') + c = *s++; + } + if ((base == 0 || base == 16) && c == '0' && (*s == 'x' || *s == 'X')) { + c = s[1]; + s += 2; + base = 16; + } + if (base == 0) + base = c == '0' ? 8 : 10; + acc = any = 0; + if (base < 2 || base > 36) + goto noconv; -long -strtol(const char * __restrict nptr, char ** __restrict endptr, int base) -{ - const char *s; - unsigned long acc; - char c = 0x0; /* to remove warning */ - unsigned long cutoff; - int neg, any, cutlim; - - /* - * Skip white space and pick up leading +/- sign if any. - * If base is 0, allow 0x for hex and 0 for octal, else - * assume decimal; if base is already 16, allow 0x. - */ - s = nptr; - /* - do { - c = *s++; - } while (isspace((unsigned char)c)); - */ - if (c == '-') { - neg = 1; - c = *s++; - } else { - neg = 0; - if (c == '+') - c = *s++; - } - if ((base == 0 || base == 16) && - c == '0' && (*s == 'x' || *s == 'X')) { - c = s[1]; - s += 2; - base = 16; - } - if (base == 0) - base = c == '0' ? 8 : 10; - acc = any = 0; - if (base < 2 || base > 36) - goto noconv; - - /* - * Compute the cutoff value between legal numbers and illegal - * numbers. That is the largest legal value, divided by the - * base. An input number that is greater than this value, if - * followed by a legal input character, is too big. One that - * is equal to this value may be valid or not; the limit - * between valid and invalid numbers is then based on the last - * digit. For instance, if the range for longs is - * [-2147483648..2147483647] and the input base is 10, - * cutoff will be set to 214748364 and cutlim to either - * 7 (neg==0) or 8 (neg==1), meaning that if we have accumulated - * a value > 214748364, or equal but the next digit is > 7 (or 8), - * the number is too big, and we will return a range error. - * - * Set 'any' if any `digits' consumed; make it negative to indicate - * overflow. - */ - cutoff = neg ? (unsigned long)-(LONG_MIN + LONG_MAX) + LONG_MAX - : LONG_MAX; - cutlim = cutoff % base; - cutoff /= base; - for ( ; ; c = *s++) { - if (c >= '0' && c <= '9') - c -= '0'; - else if (c >= 'A' && c <= 'Z') - c -= 'A' - 10; - else if (c >= 'a' && c <= 'z') - c -= 'a' - 10; - else - break; - if (c >= base) - break; - if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) - any = -1; - else { - any = 1; - acc *= base; - acc += c; - } - } - if (any < 0) { - acc = neg ? LONG_MIN : LONG_MAX; - //errno = ERANGE; - } else if (!any) { -noconv: - //errno = EINVAL; - cutoff = 0x0;//UBU - } else if (neg) - acc = -acc; - if (endptr != 0x0) - *endptr = (char *)(any ? s - 1 : nptr); - return (acc); + /* + * Compute the cutoff value between legal numbers and illegal + * numbers. That is the largest legal value, divided by the + * base. An input number that is greater than this value, if + * followed by a legal input character, is too big. One that + * is equal to this value may be valid or not; the limit + * between valid and invalid numbers is then based on the last + * digit. For instance, if the range for longs is + * [-2147483648..2147483647] and the input base is 10, + * cutoff will be set to 214748364 and cutlim to either + * 7 (neg==0) or 8 (neg==1), meaning that if we have accumulated + * a value > 214748364, or equal but the next digit is > 7 (or 8), + * the number is too big, and we will return a range error. + * + * Set 'any' if any `digits' consumed; make it negative to indicate + * overflow. + */ + cutoff = neg ? (unsigned long) -(LONG_MIN + LONG_MAX) + LONG_MAX : LONG_MAX; + cutlim = cutoff % base; + cutoff /= base; + for (;; c = *s++) { + if (c >= '0' && c <= '9') + c -= '0'; + else if (c >= 'A' && c <= 'Z') + c -= 'A' - 10; + else if (c >= 'a' && c <= 'z') + c -= 'a' - 10; + else + break; + if (c >= base) + break; + if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) + any = -1; + else { + any = 1; + acc *= base; + acc += c; + } + } + if (any < 0) { + acc = neg ? LONG_MIN : LONG_MAX; + //errno = ERANGE; + } + else if (!any) { + noconv: + //errno = EINVAL; + cutoff = 0x0; //UBU + } + else if (neg) + acc = -acc; + if (endptr != 0x0) + *endptr = (char *) (any ? s - 1 : nptr); + return (acc); } diff --git a/sys/lib/vsprintf.c b/sys/lib/vsprintf.c index 2c6b901..4fc3c03 100644 --- a/sys/lib/vsprintf.c +++ b/sys/lib/vsprintf.c @@ -1,52 +1,30 @@ -/***************************************************************************************** - Copyright (c) 2002 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. - - $Log: vsprintf.c,v $ - Revision 1.1.1.1 2006/06/01 12:46:16 reddawg - ubix2 - - Revision 1.2 2005/10/12 00:13:37 reddawg - Removed - - Revision 1.1.1.1 2005/09/26 17:24:14 reddawg - no message - - Revision 1.2 2004/06/28 23:12:58 reddawg - file format now container:/path/to/file - - Revision 1.1.1.1 2004/04/15 12:07:11 reddawg - UbixOS v1.0 - - Revision 1.3 2004/04/13 16:36:33 reddawg - Changed our copyright, it is all now under a BSD-Style license - - - - $Id: vsprintf.c 65 2016-01-11 04:42:59Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ /* vsprintf.c -- Lars Wirzenius & Linus Torvalds. */ /* @@ -59,13 +37,12 @@ /* we use this so that we can do without the ctype library */ #define is_digit(c) ((c) >= '0' && (c) <= '9') -static int skip_atoi(const char **s) -{ - int i=0; +static int skip_atoi(const char **s) { + int i = 0; - while (is_digit(**s)) - i = i*10 + *((*s)++) - '0'; - return i; + while (is_digit(**s)) + i = i * 10 + *((*s)++) - '0'; + return i; } #define ZEROPAD 1 /* pad with zero */ @@ -81,202 +58,213 @@ __asm__("divl %4":"=a" (n),"=d" (__res):"0" (n),"1" (0),"r" (base)); \ __res; }) -static char * number(char * str, int num, int base, int size, int precision - ,int type) -{ - char c,sign,tmp[36]; - const char *digits="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - int i; +static char * number(char * str, int num, int base, int size, int precision, int type) { + char c, sign, tmp[36]; + const char *digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + int i; - if (type&SMALL) digits="0123456789abcdefghijklmnopqrstuvwxyz"; - if (type&LEFT) type &= ~ZEROPAD; - if (base<2 || base>36) - return 0; - c = (type & ZEROPAD) ? '0' : ' ' ; - if (type&SIGN && num<0) { - sign='-'; - num = -num; - } else - sign=(type&PLUS) ? '+' : ((type&SPACE) ? ' ' : 0); - if (sign) size--; - if (type&SPECIAL) { - if (base==16) { size -= 2; } - else if (base==8) { size--; } - } - i=0; - if (num==0) - tmp[i++]='0'; - else while (num!=0) - tmp[i++]=digits[do_div(num,base)]; - if (i>precision) precision=i; - size -= precision; - if (!(type&(ZEROPAD+LEFT))) - while(size-->0) - *str++ = ' '; - if (sign) - *str++ = sign; - if (type&SPECIAL) { - if (base==8) { - *str++ = '0'; - } - else if (base==16) { - *str++ = '0'; - *str++ = digits[33]; - } - } - if (!(type&LEFT)) - while(size-->0) - *str++ = c; - while(i0) - *str++ = tmp[i]; - while(size-->0) - *str++ = ' '; - return str; + if (type & SMALL) + digits = "0123456789abcdefghijklmnopqrstuvwxyz"; + if (type & LEFT) + type &= ~ZEROPAD; + if (base < 2 || base > 36) + return 0; + c = (type & ZEROPAD) ? '0' : ' '; + if (type & SIGN && num < 0) { + sign = '-'; + num = -num; + } + else + sign = (type & PLUS) ? '+' : ((type & SPACE) ? ' ' : 0); + if (sign) + size--; + if (type & SPECIAL) { + if (base == 16) { + size -= 2; + } + else if (base == 8) { + size--; + } + } + i = 0; + if (num == 0) + tmp[i++] = '0'; + else + while (num != 0) + tmp[i++] = digits[do_div(num, base)]; + if (i > precision) + precision = i; + size -= precision; + if (!(type & (ZEROPAD + LEFT))) + while (size-- > 0) + *str++ = ' '; + if (sign) + *str++ = sign; + if (type & SPECIAL) { + if (base == 8) { + *str++ = '0'; + } + else if (base == 16) { + *str++ = '0'; + *str++ = digits[33]; + } + } + if (!(type & LEFT)) + while (size-- > 0) + *str++ = c; + while (i < precision--) + *str++ = '0'; + while (i-- > 0) + *str++ = tmp[i]; + while (size-- > 0) + *str++ = ' '; + return str; } -int vsprintf(char *buf, const char *fmt, va_list args) -{ - int len; - int i; - char * str; - char *s; - int *ip; +int vsprintf(char *buf, const char *fmt, va_list args) { + int len; + int i; + char * str; + char *s; + int *ip; - int flags; /* flags to number() */ + int flags; /* flags to number() */ - int field_width; /* width of output field */ - int precision; /* min. # of digits for integers; max - number of chars for from string */ - int qualifier; /* 'h', 'l', or 'L' for integer fields */ + int field_width; /* width of output field */ + int precision; /* min. # of digits for integers; max + number of chars for from string */ + int qualifier; /* 'h', 'l', or 'L' for integer fields */ - for (str=buf ; *fmt ; ++fmt) { - if (*fmt != '%') { - *str++ = *fmt; - continue; - } - - /* process flags */ - flags = 0; - repeat: - ++fmt; /* this also skips first '%' */ - switch (*fmt) { - case '-': flags |= LEFT; goto repeat; - case '+': flags |= PLUS; goto repeat; - case ' ': flags |= SPACE; goto repeat; - case '#': flags |= SPECIAL; goto repeat; - case '0': flags |= ZEROPAD; goto repeat; - } - - /* get field width */ - field_width = -1; - if (is_digit(*fmt)) - field_width = skip_atoi(&fmt); - else if (*fmt == '*') { - /* it's the next argument */ - field_width = va_arg(args, int); - if (field_width < 0) { - field_width = -field_width; - flags |= LEFT; - } - } + for (str = buf; *fmt; ++fmt) { + if (*fmt != '%') { + *str++ = *fmt; + continue; + } - /* get the precision */ - precision = -1; - if (*fmt == '.') { - ++fmt; - if (is_digit(*fmt)) - precision = skip_atoi(&fmt); - else if (*fmt == '*') { - /* it's the next argument */ - precision = va_arg(args, int); - } - if (precision < 0) - precision = 0; - } + /* process flags */ + flags = 0; + repeat: ++fmt; /* this also skips first '%' */ + switch (*fmt) { + case '-': + flags |= LEFT; + goto repeat; + case '+': + flags |= PLUS; + goto repeat; + case ' ': + flags |= SPACE; + goto repeat; + case '#': + flags |= SPECIAL; + goto repeat; + case '0': + flags |= ZEROPAD; + goto repeat; + } - /* get the conversion qualifier */ - qualifier = -1; - if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L') { - qualifier = *fmt; - ++fmt; - } + /* get field width */ + field_width = -1; + if (is_digit(*fmt)) + field_width = skip_atoi(&fmt); + else if (*fmt == '*') { + /* it's the next argument */ + field_width = va_arg(args, int); + if (field_width < 0) { + field_width = -field_width; + flags |= LEFT; + } + } - switch (*fmt) { - case 'c': - if (!(flags & LEFT)) - while (--field_width > 0) - *str++ = ' '; - *str++ = (unsigned char) va_arg(args, int); - while (--field_width > 0) - *str++ = ' '; - break; + /* get the precision */ + precision = -1; + if (*fmt == '.') { + ++fmt; + if (is_digit(*fmt)) + precision = skip_atoi(&fmt); + else if (*fmt == '*') { + /* it's the next argument */ + precision = va_arg(args, int); + } + if (precision < 0) + precision = 0; + } - case 's': - s = va_arg(args, char *); - len = strlen(s); - if (precision < 0) - precision = len; - else if (len > precision) - len = precision; + /* get the conversion qualifier */ + qualifier = -1; + if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L') { + qualifier = *fmt; + ++fmt; + } - if (!(flags & LEFT)) - while (len < field_width--) - *str++ = ' '; - for (i = 0; i < len; ++i) - *str++ = *s++; - while (len < field_width--) - *str++ = ' '; - break; + switch (*fmt) { + case 'c': + if (!(flags & LEFT)) + while (--field_width > 0) + *str++ = ' '; + *str++ = (unsigned char) va_arg(args, int); + while (--field_width > 0) + *str++ = ' '; + break; - case 'o': - str = number(str, va_arg(args, unsigned long), 8, - field_width, precision, flags); - break; + case 's': + s = va_arg(args, char *); + len = strlen(s); + if (precision < 0) + precision = len; + else if (len > precision) + len = precision; - case 'p': - if (field_width == -1) { - field_width = 8; - flags |= ZEROPAD; - } - str = number(str, - (unsigned long) va_arg(args, void *), 16, - field_width, precision, flags); - break; + if (!(flags & LEFT)) + while (len < field_width--) + *str++ = ' '; + for (i = 0; i < len; ++i) + *str++ = *s++; + while (len < field_width--) + *str++ = ' '; + break; - case 'x': - flags |= SMALL; - case 'X': - str = number(str, va_arg(args, unsigned long), 16, - field_width, precision, flags); - break; + case 'o': + str = number(str, va_arg(args, unsigned long), 8, field_width, precision, flags); + break; - case 'd': - case 'i': - flags |= SIGN; - case 'u': - str = number(str, va_arg(args, unsigned long), 10, - field_width, precision, flags); - break; + case 'p': + if (field_width == -1) { + field_width = 8; + flags |= ZEROPAD; + } + str = number(str, (unsigned long) va_arg(args, void *), 16, field_width, precision, flags); + break; - case 'n': - ip = va_arg(args, int *); - *ip = (str - buf); - break; + case 'x': + flags |= SMALL; + case 'X': + str = number(str, va_arg(args, unsigned long), 16, field_width, precision, flags); + break; - default: - if (*fmt != '%') - *str++ = '%'; - if (*fmt) - *str++ = *fmt; - else - --fmt; - break; - } - } - *str = '\0'; - return str-buf; + case 'd': + case 'i': + flags |= SIGN; + case 'u': + str = number(str, va_arg(args, unsigned long), 10, field_width, precision, flags); + break; + + case 'n': + ip = va_arg(args, int *); + *ip = (str - buf); + break; + + default: + if (*fmt != '%') + *str++ = '%'; + if (*fmt) + *str++ = *fmt; + else + --fmt; + break; + } + } + *str = '\0'; + return str - buf; } /*** diff --git a/sys/mpi/message.c b/sys/mpi/message.c index 33e7862..59f55a1 100644 --- a/sys/mpi/message.c +++ b/sys/mpi/message.c @@ -1,63 +1,62 @@ -/***************************************************************************************** - 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: message.c 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include -void sysMpiCreateMbox(uInt32 *status,char *name) { +void sysMpiCreateMbox(uInt32 *status, char *name) { if (status && name) - *status = mpi_createMbox(name); + *status = mpi_createMbox(name); return; - } +} -void sysMpiDestroyMbox(uInt32 *status,char *name) { +void sysMpiDestroyMbox(uInt32 *status, char *name) { if (status && name) *status = mpi_destroyMbox(name); return; - } +} -void sysMpiPostMessage(char *name,uInt32 *type,mpi_message_t *data) { +void sysMpiPostMessage(char *name, uInt32 *type, mpi_message_t *data) { if (type && name && data) - *type = mpi_postMessage(name,*type,data); + *type = mpi_postMessage(name, *type, data); return; - } +} -void sysMpiFetchMessage(char *name,mpi_message_t *msg,uInt32 *status) { +void sysMpiFetchMessage(char *name, mpi_message_t *msg, uInt32 *status) { if (status && name && msg) - *status = mpi_fetchMessage(name,msg); + *status = mpi_fetchMessage(name, msg); return; - } +} -void sysMpiSpam(uInt32 type,void *data,uInt32 *status) { +void sysMpiSpam(uInt32 type, void *data, uInt32 *status) { if (status && data) - *status = mpi_spam(type,data); + *status = mpi_spam(type, data); return; - } +} /*** $Log: message.c,v $ diff --git a/sys/mpi/system.c b/sys/mpi/system.c index f80b3f6..4d683ea 100644 --- a/sys/mpi/system.c +++ b/sys/mpi/system.c @@ -1,39 +1,38 @@ -/***************************************************************************************** - Copyright (c) 2002-2005 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: system.c 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include #include #include -static mpi_mbox_t *mboxList = 0x0; -static struct spinLock mpiSpinLock = SPIN_LOCK_INITIALIZER; +static mpi_mbox_t *mboxList = 0x0; +static struct spinLock mpiSpinLock = SPIN_LOCK_INITIALIZER; /***************************************************************************************** @@ -43,58 +42,58 @@ Notes: This function is not task-safe! Lock must be done before call. -*****************************************************************************************/ + *****************************************************************************************/ static mpi_mbox_t * mpi_findMbox(char *name) { mpi_mbox_t *mbox = 0x0; - - for (mbox = mboxList;mbox;mbox = mbox->next) { - if (!strcmp(mbox->name,name)) { - return(mbox); - } - } - return(0x0); + for (mbox = mboxList; mbox; mbox = mbox->next) { + if (!strcmp(mbox->name, name)) { + return (mbox); + } } + return (0x0); +} + /***************************************************************************************** Function: int mpiCreateMbox(char *name) Description: This function will create a new mailbox if it fails it will return -1 - otherwise it returns 0x0 + otherwise it returns 0x0 Notes: -*****************************************************************************************/ + *****************************************************************************************/ int mpi_createMbox(char *name) { mpi_mbox_t *mbox = 0x0; spinLock(&mpiSpinLock); if (mpi_findMbox(name) != 0x0) { spinUnlock(&mpiSpinLock); - return(-1); - } + return (-1); + } - mbox = (mpi_mbox_t *)kmalloc(sizeof(mpi_mbox_t)); + mbox = (mpi_mbox_t *) kmalloc(sizeof(mpi_mbox_t)); - sprintf(mbox->name,name); + sprintf(mbox->name, name); mbox->pid = _current->id; if (mboxList == 0x0) { mbox->prev = 0x0; mbox->next = 0x0; - mboxList = mbox; - } + mboxList = mbox; + } else { - mbox->next = mboxList; - mbox->prev = 0x0; + mbox->next = mboxList; + mbox->prev = 0x0; mboxList->prev = mbox; - mboxList = mbox; - } + mboxList = mbox; + } spinUnlock(&mpiSpinLock); - return(0x0); - } + return (0x0); +} /***************************************************************************************** @@ -104,32 +103,32 @@ Notes: -*****************************************************************************************/ -int mpi_spam(uInt32 type,void *data) { - mpi_mbox_t *mbox = 0x0; + *****************************************************************************************/ +int mpi_spam(uInt32 type, void *data) { + mpi_mbox_t *mbox = 0x0; mpi_message_t *message = 0x0; - + spinLock(&mpiSpinLock); - for (mbox = mboxList;mbox;mbox = mbox->next) { - message = (mpi_message_t *)kmalloc(sizeof(mpi_message_t)); + for (mbox = mboxList; mbox; mbox = mbox->next) { + message = (mpi_message_t *) kmalloc(sizeof(mpi_message_t)); message->header = type; - memcpy(message->data,data,MESSAGE_LENGTH); + memcpy(message->data, data, MESSAGE_LENGTH); message->next = 0x0; if (mbox->msg == 0x0) { - mbox->msg = message; - } + mbox->msg = message; + } else { mbox->msgLast->next = message; - mbox->msgLast = message; - } + mbox->msgLast = message; } + } spinUnlock(&mpiSpinLock); - return(0x0); - } + return (0x0); +} /***************************************************************************************** @@ -139,9 +138,9 @@ Notes: -*****************************************************************************************/ -int mpi_postMessage(char *name,uInt32 type,mpi_message_t *msg) { - mpi_mbox_t *mbox = 0x0; + *****************************************************************************************/ +int mpi_postMessage(char *name, uInt32 type, mpi_message_t *msg) { + mpi_mbox_t *mbox = 0x0; mpi_message_t *message = 0x0; spinLock(&mpiSpinLock); @@ -150,33 +149,34 @@ if (mbox == 0x0) { spinUnlock(&mpiSpinLock); - return(0x1); - } + return (0x1); + } - message = (mpi_message_t *)kmalloc(sizeof(mpi_message_t)); + message = (mpi_message_t *) kmalloc(sizeof(mpi_message_t)); message->header = msg->header; - memcpy(message->data,msg->data,MESSAGE_LENGTH); - message->pid = _current->id; + memcpy(message->data, msg->data, MESSAGE_LENGTH); + message->pid = _current->id; message->next = 0x0; if (mbox->msg == 0x0) { - mbox->msg = message; - } + mbox->msg = message; + } else { mbox->msgLast->next = message; - mbox->msgLast = message; - } + mbox->msgLast = message; + } spinUnlock(&mpiSpinLock); - + if (type == 0x2) { - while (mbox->msgLast != 0x0); - } - - return(0x0); + while (mbox->msgLast != 0x0) + ; } + return (0x0); +} + /***************************************************************************************** Function: int mpiFetchMessage(char *name,mpiMessage_t *msg) @@ -185,9 +185,9 @@ Notes: -*****************************************************************************************/ -int mpi_fetchMessage(char *name,mpi_message_t *msg) { - mpi_mbox_t *mbox = 0x0; + *****************************************************************************************/ +int mpi_fetchMessage(char *name, mpi_message_t *msg) { + mpi_mbox_t *mbox = 0x0; mpi_message_t *tmpMsg = 0x0; spinLock(&mpiSpinLock); @@ -196,31 +196,31 @@ if (mbox == 0x0) { spinUnlock(&mpiSpinLock); - return(-1); - } + return (-1); + } if (mbox->msg == 0x0) { spinUnlock(&mpiSpinLock); - return(-1); - } + return (-1); + } if (mbox->pid != _current->id) { spinUnlock(&mpiSpinLock); - return(-1); - } + return (-1); + } msg->header = mbox->msg->header; - memcpy(msg->data,mbox->msg->data,MESSAGE_LENGTH); - msg->pid = mbox->msg->pid; + memcpy(msg->data, mbox->msg->data, MESSAGE_LENGTH); + msg->pid = mbox->msg->pid; - tmpMsg = mbox->msg; + tmpMsg = mbox->msg; mbox->msg = mbox->msg->next; - + kfree(tmpMsg); spinUnlock(&mpiSpinLock); - return(0x0); - } + return (0x0); +} /***************************************************************************************** @@ -230,29 +230,29 @@ Notes: -*****************************************************************************************/ + *****************************************************************************************/ int mpi_destroyMbox(char *name) { - mpi_mbox_t *mbox = 0x0; + mpi_mbox_t *mbox = 0x0; spinLock(&mpiSpinLock); - for (mbox = mboxList;mbox;mbox=mbox->next) { - if (!strcmp(mbox->name,name)) { + for (mbox = mboxList; mbox; mbox = mbox->next) { + if (!strcmp(mbox->name, name)) { if (mbox->pid != _current->id) { spinUnlock(&mpiSpinLock); - return(-1); - } + return (-1); + } mbox->prev->next = mbox->next; mbox->next->prev = mbox->prev; kfree(mbox); spinUnlock(&mpiSpinLock); - return(0x0); - } + return (0x0); } + } spinUnlock(&mpiSpinLock); - return(-1); - } + return (-1); +} /*** END diff --git a/sys/pci/hd.c b/sys/pci/hd.c index 5d2ce27..3ca0180 100644 --- a/sys/pci/hd.c +++ b/sys/pci/hd.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - Copyright (c) 2002-2004, 2016 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: hd.c 130 2016-01-14 15:45:44Z reddawg $ - - *****************************************************************************************/ +/*- + * 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. + */ #include #include @@ -96,7 +95,8 @@ if (gptread(&freebsd_ufs_uuid, devInfo, secbuf) == -1) { kprintf("%s: unable to load GPT\n", "KERNEL"); //return (-1); - } else { + } + else { devInfo2 = (struct device_interface *) kmalloc(sizeof(struct device_interface)); hdd2 = (struct driveInfo *) kmalloc(sizeof(struct driveInfo)); memcpy(devInfo2, devInfo, sizeof(struct device_interface)); @@ -121,7 +121,8 @@ } } - } else { + } + else { for (i = 0x0; i < 0x4; i++) { @@ -254,41 +255,41 @@ retVal = tmp[0x2F] & 0xFF; switch (retVal) { - case 0: - hdd->hdShift = 0; - hdd->hdMulti = 1; + case 0: + hdd->hdShift = 0; + hdd->hdMulti = 1; break; - case 2: - hdd->hdShift = 1; - hdd->hdMulti = retVal; + case 2: + hdd->hdShift = 1; + hdd->hdMulti = retVal; break; - case 4: - hdd->hdShift = 2; - hdd->hdMulti = retVal; + case 4: + hdd->hdShift = 2; + hdd->hdMulti = retVal; break; - case 8: - hdd->hdShift = 3; - hdd->hdMulti = retVal; + case 8: + hdd->hdShift = 3; + hdd->hdMulti = retVal; break; - case 16: - hdd->hdShift = 4; - hdd->hdMulti = retVal; + case 16: + hdd->hdShift = 4; + hdd->hdMulti = retVal; break; - case 32: - hdd->hdShift = 5; - hdd->hdMulti = retVal; + case 32: + hdd->hdShift = 5; + hdd->hdMulti = retVal; break; - case 64: - hdd->hdShift = 6; - hdd->hdMulti = retVal; + case 64: + hdd->hdShift = 6; + hdd->hdMulti = retVal; break; - case 128: - hdd->hdShift = 7; - hdd->hdMulti = retVal; + case 128: + hdd->hdShift = 7; + hdd->hdMulti = retVal; break; - default: - kprintf("Error BLOCK Mode Unavailable: [%x]\n", retVal); - return (1); + default: + kprintf("Error BLOCK Mode Unavailable: [%x]\n", retVal); + return (1); } if (hdd->ata_identify->command_set_enabled1 & ATA_IDENTIFY_COMMAND_SET_SUPPORTED1_48BIT_ENABLE) { @@ -301,7 +302,8 @@ hdd->lba_low |= hdd->ata_identify->max_48bit_lba[2] << 16; hdd->lba_low |= hdd->ata_identify->max_48bit_lba[1] << 8; hdd->lba_low |= hdd->ata_identify->max_48bit_lba[0]; - } else { + } + else { hdd->lba_high = 0; hdd->lba_low = hdd->ata_identify->total_num_sectors[3] << 24; hdd->lba_low |= hdd->ata_identify->total_num_sectors[2] << 16; @@ -315,7 +317,8 @@ hdd->sector_size |= hdd->ata_identify->words_per_logical_sector[2] << 16; hdd->sector_size |= hdd->ata_identify->words_per_logical_sector[1] << 8; hdd->sector_size |= hdd->ata_identify->words_per_logical_sector[0]; - } else { + } + else { // Default the sector size to 512 bytes hdd->sector_size = 512; } @@ -347,7 +350,7 @@ if (hdd->lba_start == 0) startSector += hdd->parOffset; else - startSector += hdd->lba_start; + startSector += hdd->lba_start; if (hdd->hdEnable == 0x0) { kprintf("Invalid Drive\n"); @@ -356,7 +359,8 @@ if ((sectorCount >> hdd->hdShift) == 0x0) { hdd->hdCalc = sectorCount; /* hdd->hdMask; */ transactionCount = 1; - } else { + } + else { hdd->hdCalc = hdd->hdMulti; transactionCount = sectorCount >> hdd->hdShift; } @@ -411,8 +415,6 @@ startSector += hdd->parOffset; startSector += hdd->lba_start; - - if (hdd->hdEnable == 0x0) { kprintf("Invalid Drive\n"); return (1); @@ -420,7 +422,8 @@ if ((sectorCount >> hdd->hdShift) == 0x0) { hdd->hdCalc = sectorCount; /* hdd->hdMask); */ transactionCount = 1; - } else { + } + else { hdd->hdCalc = hdd->hdMulti; transactionCount = sectorCount >> hdd->hdShift; } diff --git a/sys/pci/lnc.c b/sys/pci/lnc.c index 97b8ce1..f9dfeb6 100644 --- a/sys/pci/lnc.c +++ b/sys/pci/lnc.c @@ -1,27 +1,29 @@ /*- - * Copyright (c) 2002, 2017 The UbixOS Project + * 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: + * This was developed by Christopher W. Olsen for the UbixOS Project. * - * 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. + * 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 COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY - * THIS 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. + * 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. */ #include @@ -96,7 +98,6 @@ lnc->bufferSize = 1548; lnc->ioAddr = 0xD020; - lnc->nic.ic = lnc_probe(lnc); //kprintf("ID: %i\n", lnc->nic.ic); @@ -251,22 +252,22 @@ //kprintf("\nINTR\n"); //while ((csr0 = lnc_readCSR32(lnc, CSR0)) & INTR) { - //kprintf("CSR0: [0x%X]\n", csr0); - if (csr0 & ERR) { - kprintf("Error: [0x%X]\n", csr0); - } - if (csr0 & RINT) { - asm("nop"); - //lnc_rxINT(); - } - if (csr0 & TINT) { - asm("nop"); - //kprintf("TINT"); - //lnc_txINT(); - } - // kprintf("CSR0.1: [0x%X]\n", lnc_readCSR32(lnc, CSR0)); + //kprintf("CSR0: [0x%X]\n", csr0); + if (csr0 & ERR) { + kprintf("Error: [0x%X]\n", csr0); + } + if (csr0 & RINT) { + asm("nop"); + //lnc_rxINT(); + } + if (csr0 & TINT) { + asm("nop"); + //kprintf("TINT"); + //lnc_txINT(); + } + // kprintf("CSR0.1: [0x%X]\n", lnc_readCSR32(lnc, CSR0)); // } - lnc_writeCSR32(lnc, CSR0, 0x7940);//csr0); + lnc_writeCSR32(lnc, CSR0, 0x7940); //csr0); // kprintf("INT DONE"); } @@ -274,97 +275,95 @@ int i = 0; if (tmpBuf == 0x0) { - tmpBuf = (struct nicBuffer *)kmalloc(sizeof(struct nicBuffer)); - memset(tmpBuf,0x0,sizeof(struct nicBuffer)); + tmpBuf = (struct nicBuffer *) kmalloc(sizeof(struct nicBuffer)); + memset(tmpBuf, 0x0, sizeof(struct nicBuffer)); } else { - memset(tmpBuf,0x0,sizeof(struct nicBuffer)); + memset(tmpBuf, 0x0, sizeof(struct nicBuffer)); } -kprintf("STARTING THREAD LNC"); + kprintf("STARTING THREAD LNC"); while (1) { - while (lnc_driverOwnsRX(lnc)) { - //uint16_t plen = 0 + (uint16_t)lnc->rxRing[lnc->rxPtr].md[2]; - int plen = (lnc->rxRing[lnc->rxPtr].md[2] & 0x0fff ) - 4; -/* - if (plen > 0) - kprintf("plen.0: [0x%X]", plen); -*/ + while (lnc_driverOwnsRX(lnc)) { + //uint16_t plen = 0 + (uint16_t)lnc->rxRing[lnc->rxPtr].md[2]; + int plen = (lnc->rxRing[lnc->rxPtr].md[2] & 0x0fff) - 4; + /* + if (plen > 0) + kprintf("plen.0: [0x%X]", plen); + */ - tmpBuf->length = plen; - tmpBuf->buffer = (void *)(lnc->rxBuffer + (lnc->rxPtr * lnc->bufferSize)); //(char *)kmalloc(length); + tmpBuf->length = plen; + tmpBuf->buffer = (void *) (lnc->rxBuffer + (lnc->rxPtr * lnc->bufferSize)); //(char *)kmalloc(length); - // kprintf("RINT2\n"); - ethernetif_input(&lnc_netif); - //kprintf("RINT3\n"); - //kprintf("RINT-LOOP[%i][0x%X][0x%X]", lnc->rxPtr,lnc->rxRing[lnc->rxPtr].md[1],plen); - lnc->rxRing[lnc->rxPtr].md[1] = 0x80; - //kprintf("RINT-LOOP[%i][0x%X][0x%X]", lnc->rxPtr,lnc->rxRing[lnc->rxPtr].md[1],plen); - lnc_nextRxPtr(lnc); - //kprintf("RINT-LOOP[%i][0x%X][0x%X]\n", lnc->rxPtr,lnc->rxRing[lnc->rxPtr].md[1],plen); - } + // kprintf("RINT2\n"); + ethernetif_input(&lnc_netif); + //kprintf("RINT3\n"); + //kprintf("RINT-LOOP[%i][0x%X][0x%X]", lnc->rxPtr,lnc->rxRing[lnc->rxPtr].md[1],plen); + lnc->rxRing[lnc->rxPtr].md[1] = 0x80; + //kprintf("RINT-LOOP[%i][0x%X][0x%X]", lnc->rxPtr,lnc->rxRing[lnc->rxPtr].md[1],plen); + lnc_nextRxPtr(lnc); + //kprintf("RINT-LOOP[%i][0x%X][0x%X]\n", lnc->rxPtr,lnc->rxRing[lnc->rxPtr].md[1],plen); + } // kprintf("RINT-DONE[%i][0x%X]\n", lnc->rxPtr,lnc->rxRing[lnc->rxPtr].md[1]); - sched_yield(); + sched_yield(); } } - void lnc_rxINT() { int i = 0; if (tmpBuf == 0x0) { - tmpBuf = (struct nicBuffer *)kmalloc(sizeof(struct nicBuffer)); - memset(tmpBuf,0x0,sizeof(struct nicBuffer)); + tmpBuf = (struct nicBuffer *) kmalloc(sizeof(struct nicBuffer)); + memset(tmpBuf, 0x0, sizeof(struct nicBuffer)); } else { - memset(tmpBuf,0x0,sizeof(struct nicBuffer)); + memset(tmpBuf, 0x0, sizeof(struct nicBuffer)); } while (lnc_driverOwnsRX(lnc)) { //uint16_t plen = 0 + (uint16_t)lnc->rxRing[lnc->rxPtr].md[2]; - int plen = (lnc->rxRing[lnc->rxPtr].md[2] & 0x0fff ) - 4; -/* - if (plen > 0) - kprintf("plen.0: [0x%X]", plen); -*/ + int plen = (lnc->rxRing[lnc->rxPtr].md[2] & 0x0fff) - 4; + /* + if (plen > 0) + kprintf("plen.0: [0x%X]", plen); + */ tmpBuf->length = plen; - tmpBuf->buffer = (void *)(lnc->rxBuffer + (lnc->rxPtr * lnc->bufferSize)); //(char *)kmalloc(length); + tmpBuf->buffer = (void *) (lnc->rxBuffer + (lnc->rxPtr * lnc->bufferSize)); //(char *)kmalloc(length); - // kprintf("RINT2\n"); + // kprintf("RINT2\n"); //ethernetif_input(netif_default); - //kprintf("RINT3\n"); - //kprintf("RINT-LOOP[%i][0x%X][0x%X]", lnc->rxPtr,lnc->rxRing[lnc->rxPtr].md[1],plen); + //kprintf("RINT3\n"); + //kprintf("RINT-LOOP[%i][0x%X][0x%X]", lnc->rxPtr,lnc->rxRing[lnc->rxPtr].md[1],plen); lnc->rxRing[lnc->rxPtr].md[1] = 0x80; - //kprintf("RINT-LOOP[%i][0x%X][0x%X]", lnc->rxPtr,lnc->rxRing[lnc->rxPtr].md[1],plen); + //kprintf("RINT-LOOP[%i][0x%X][0x%X]", lnc->rxPtr,lnc->rxRing[lnc->rxPtr].md[1],plen); lnc_nextRxPtr(lnc); - //kprintf("RINT-LOOP[%i][0x%X][0x%X]\n", lnc->rxPtr,lnc->rxRing[lnc->rxPtr].md[1],plen); + //kprintf("RINT-LOOP[%i][0x%X][0x%X]\n", lnc->rxPtr,lnc->rxRing[lnc->rxPtr].md[1],plen); } - // kprintf("RINT-DONE[%i][0x%X]\n", lnc->rxPtr,lnc->rxRing[lnc->rxPtr].md[1]); + // kprintf("RINT-DONE[%i][0x%X]\n", lnc->rxPtr,lnc->rxRing[lnc->rxPtr].md[1]); //while(1); - + } void lnc_txINT() { uint16_t status = 0x0; - kprintf("TINT\n"); - status = lnc->txRing[lnc->txPtr].md[1] + (lnc->txRing[lnc->txPtr].md[1] << 16); + status = lnc->txRing[lnc->txPtr].md[1] + (lnc->txRing[lnc->txPtr].md[1] << 16); kprintf("Status: [0x%X]\n", status); while (!lnc_driverOwnsTX(lnc)) { - status = lnc->txRing[lnc->txPtr].md[1] + (lnc->txRing[lnc->txPtr].md[1] << 16); - kprintf("md[1]: 0x%X(%i)[0x%X]\n", lnc->txRing[lnc->txPtr].md[1], lnc->txPtr, status); - lnc->txRing[lnc->txPtr].md[1] = 0x0; - lnc_nextTxPtr(lnc); + status = lnc->txRing[lnc->txPtr].md[1] + (lnc->txRing[lnc->txPtr].md[1] << 16); + kprintf("md[1]: 0x%X(%i)[0x%X]\n", lnc->txRing[lnc->txPtr].md[1], lnc->txPtr, status); + lnc->txRing[lnc->txPtr].md[1] = 0x0; + lnc_nextTxPtr(lnc); } kprintf("TINT-DONE\n"); } void lncInt() { while (1) { - kprintf("Finished!!!\n"); + kprintf("Finished!!!\n"); } outportByte(0x20, 0x20); return; @@ -525,7 +524,7 @@ lnc->txPtr = ret; - return(0); + return (0); } int lnc_nextRxPtr(struct lncInfo *lnc) { @@ -537,10 +536,9 @@ lnc->rxPtr = ret; - return(0); + return (0); } - int lnc_sendPacket(struct lncInfo *lnc, void *packet, size_t len, uint8_t *dest) { //kprintf("SEND PACKET1![%i]\n", lnc->txPtr); if (!lnc_driverOwnsTX(lnc)) { diff --git a/sys/pci/pci.c b/sys/pci/pci.c index 7b44a9f..e7b446b 100644 --- a/sys/pci/pci.c +++ b/sys/pci/pci.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: pci.c 79 2016-01-11 16:21:27Z reddawg $ - - *****************************************************************************************/ +/*- + * 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. + */ #include #include @@ -145,7 +144,7 @@ cfg = kmalloc(sizeof(struct pciConfig)); memset(cfg, 0x0, sizeof(struct pciConfig)); - uint32_t *word = (uint32_t *)cfg; + uint32_t *word = (uint32_t *) cfg; for (i = 0; i < 4; i++) { word[i] = pciRead(bus, dev, func, 4 * i, 4); @@ -175,13 +174,13 @@ cfg->func = func; /* - if (cfg->vendorID == 0x1022) - pciWrite(bus, dev, func, 0x3C, 0x5,1); - */ + if (cfg->vendorID == 0x1022) + pciWrite(bus, dev, func, 0x3C, 0x5,1); + */ - switch(cfg->headerType & 0x7F) { + switch (cfg->headerType & 0x7F) { case 0x0: /* normal device */ - for (i = 4;i<=16;i++) { + for (i = 4; i <= 16; i++) { word[i] = pciRead(bus, dev, func, 4 * i, 4); } if (cfg->vendorID == 0x1022) { @@ -190,57 +189,56 @@ kprintf(" * Status: %X Command: %X BIST/Type/Lat/CLS: %X/%X/%X/%X\n", cfg->status, cfg->command, cfg->bist, cfg->headerType, cfg->latencyTimer, cfg->cacheLineSize); kprintf(" * IRQ: 0x%X.0x%X, BAR[0]: 0x%X\n", cfg->intLine, cfg->intPin, cfg->bar[0]); } - break; + break; case 0x1: kprintf(" * PCI <-> PCI Bridge\n"); - break; + break; case 0x2: kprintf(" * PCI <-> CardBus Bridge\n"); - break; + break; default: kprintf(" * Unknown Header Type\n"); - break; + break; } - /* - switch (cfg->headerType & 0x7F) { - case 0: // normal device - for (i = 0; i < 6; i++) { - v = pciRead(bus, dev, func, i * 4 + 0x10, 4); - if (v) { - int v2; - pciWrite(bus, dev, func, i * 4 + 0x10, 0xffffffff, 4); - v2 = pciRead(bus, dev, func, i * 4 + 0x10, 4) & 0xfffffff0; - pciWrite(bus, dev, func, i * 4 + 0x10, v, 4); - v2 = 1 + ~v2; - if (v & 1) { - cfg->base[i] = v & 0xffff; - cfg->size[i] = v2 & 0xffff; - } - else { - cfg->base[i] = v; - cfg->size[i] = v2; - } - } - else { - cfg->base[i] = 0; - cfg->size[i] = 0; - } - } - v = pciRead(bus, dev, func, 0x3c, 1); - cfg->irq = (v == 0xff ? 0 : v); - v = pciRead(bus, dev, func, 0x40, 1); - cfg->irqLine = (v == 0xff ? 0 : v); - break; - case 1: + switch (cfg->headerType & 0x7F) { + case 0: // normal device + for (i = 0; i < 6; i++) { + v = pciRead(bus, dev, func, i * 4 + 0x10, 4); + if (v) { + int v2; + pciWrite(bus, dev, func, i * 4 + 0x10, 0xffffffff, 4); + v2 = pciRead(bus, dev, func, i * 4 + 0x10, 4) & 0xfffffff0; + pciWrite(bus, dev, func, i * 4 + 0x10, v, 4); + v2 = 1 + ~v2; + if (v & 1) { + cfg->base[i] = v & 0xffff; + cfg->size[i] = v2 & 0xffff; + } + else { + cfg->base[i] = v; + cfg->size[i] = v2; + } + } + else { + cfg->base[i] = 0; + cfg->size[i] = 0; + } + } + v = pciRead(bus, dev, func, 0x3c, 1); + cfg->irq = (v == 0xff ? 0 : v); + v = pciRead(bus, dev, func, 0x40, 1); + cfg->irqLine = (v == 0xff ? 0 : v); + break; + case 1: - } - */ + } + */ - return ((uint32_t)cfg); + return ((uint32_t) cfg); } int pci_init() { @@ -251,9 +249,9 @@ struct pciConfig *pcfg; for (bus = 0x0; bus < 0x2; bus++) { - for (dev = 0; dev < 32; dev++) { + for (dev = 0; dev < 32; dev++) { for (func = 0; func < 8; func++) { - pcfg = (struct pciConfig *)pciProbe(bus, dev, func); + pcfg = (struct pciConfig *) pciProbe(bus, dev, func); if (pcfg != 0x0) { for (i = 0x0; i < countof(pciClasses); i++) { if (pcfg->classCode == pciClasses[i].baseClass && pcfg->subClass == pciClasses[i].subClass && pcfg->progIf == pciClasses[i].interface) { diff --git a/sys/sde/colours.cc b/sys/sde/colours.cc index 8526456..edc030f 100644 --- a/sys/sde/colours.cc +++ b/sys/sde/colours.cc @@ -1,142 +1,121 @@ -/***************************************************************************************** - Copyright (c) 2002 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. - - $Log: colours.cc,v $ - Revision 1.1.1.1 2006/06/01 12:46:16 reddawg - ubix2 - - Revision 1.2 2005/10/12 00:13:37 reddawg - Removed - - Revision 1.1.1.1 2005/09/26 17:24:36 reddawg - no message - - Revision 1.2 2004/05/19 17:09:50 flameshadow - chg: Undid previous renaming. This now restores me as the EOOUIAD. - - Revision 1.1.1.1 2004/04/15 12:07:16 reddawg - UbixOS v1.0 - - Revision 1.23 2004/04/13 16:36:33 reddawg - Changed our copyright, it is all now under a BSD-Style license - - - - $Id: colours.cc 89 2016-01-12 00:20:40Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include #include extern "C" { - #include - #include - #include - #include - #include - #include - #include - } +#include +#include +#include +#include +#include +#include +#include +} extern "C" { -void sdeTestThread() { + void sdeTestThread() { // uInt32 count, i = 0x0; - uInt8 r, g, b; - ogSurface *screen = 0x0; - ogPoint2d points[4]; - ogRGBA8 colours[4]; - r = g = b = 0; - while (screen == 0x0) { - screen = (ogDisplay_UbixOS *)systemVitals->screen; + uInt8 r, g, b; + ogSurface *screen = 0x0; + ogPoint2d points[4]; + ogRGBA8 colours[4]; + r = g = b = 0; + while (screen == 0x0) { + screen = (ogDisplay_UbixOS *) systemVitals->screen; } - while (!screen->ogAvail()); + while (!screen->ogAvail()) + ; - points[0].x = screen->ogGetMaxX() - 150; - points[0].y = 0; - points[1].x = screen->ogGetMaxX(); - points[1].y = 0; - points[2].x = screen->ogGetMaxX(); - points[2].y = 150; - points[3].x = screen->ogGetMaxX() - 250; - points[3].y = 250; + points[0].x = screen->ogGetMaxX() - 150; + points[0].y = 0; + points[1].x = screen->ogGetMaxX(); + points[1].y = 0; + points[2].x = screen->ogGetMaxX(); + points[2].y = 150; + points[3].x = screen->ogGetMaxX() - 250; + points[3].y = 250; - colours[0].red = 255; - colours[0].green = 0; - colours[0].blue = 0; - colours[0].alpha = 255; - colours[1].red = 0; - colours[1].green = 255; - colours[1].blue = 128; - colours[1].alpha = 255; - colours[2].red = 128; - colours[2].green = 255; - colours[2].blue = 128; - colours[2].alpha = 255; - colours[3].red = 63; - colours[3].green = 63; - colours[3].blue = 63; - colours[3].alpha = 255; - screen->ogSetAntiAliasing(true); + colours[0].red = 255; + colours[0].green = 0; + colours[0].blue = 0; + colours[0].alpha = 255; + colours[1].red = 0; + colours[1].green = 255; + colours[1].blue = 128; + colours[1].alpha = 255; + colours[2].red = 128; + colours[2].green = 255; + colours[2].blue = 128; + colours[2].alpha = 255; + colours[3].red = 63; + colours[3].green = 63; + colours[3].blue = 63; + colours[3].alpha = 255; + screen->ogSetAntiAliasing(true); - while (true) { + while (true) { #if 0 - for (count = 150; count > 0; count--) { - screen->Line(screen->GetMaxX() / 2, screen->GetMaxY() / 2, - screen->GetMaxX(), count*8, - screen->RGB(r, g, b)); - screen->FillCircle(screen->GetMaxX() - 50, 50, count, - screen->RGB(r, g, b)); - + for (count = 150; count > 0; count--) { + screen->Line(screen->GetMaxX() / 2, screen->GetMaxY() / 2, + screen->GetMaxX(), count*8, + screen->RGB(r, g, b)); + screen->FillCircle(screen->GetMaxX() - 50, 50, count, + screen->RGB(r, g, b)); + // screen->FillRect(screen->GetMaxX() - 50 - count, count, // screen->GetMaxX() - count, 100 - count, // screen->RGB(r, g, b)); - r -= 8; - g += 8; - b -= 8; - } // for + r -= 8; + g += 8; + b -= 8; + } // for #endif - screen->ogFillGouraudPolygon(4, points, colours); - //kprintf("colours(0)[0x%X]\n",colours[0]); - colours[0].red -= 8; - colours[0].green += 8; - colours[0].blue -= 8; - colours[1].red += 8; - colours[1].green += 8; - colours[1].blue -= 8; - colours[2].red += 8; - colours[2].green -= 8; - colours[2].blue += 8; - colours[3].red += 8; - colours[3].green += 8; - colours[3].blue += 8; + screen->ogFillGouraudPolygon(4, points, colours); + //kprintf("colours(0)[0x%X]\n",colours[0]); + colours[0].red -= 8; + colours[0].green += 8; + colours[0].blue -= 8; + colours[1].red += 8; + colours[1].green += 8; + colours[1].blue -= 8; + colours[2].red += 8; + colours[2].green -= 8; + colours[2].blue += 8; + colours[3].red += 8; + colours[3].green += 8; + colours[3].blue += 8; - } // while + } // while -} // sdeTestThread + } // sdeTestThread } diff --git a/sys/sde/main.cc b/sys/sde/main.cc index 9d0c05f..6656340 100644 --- a/sys/sde/main.cc +++ b/sys/sde/main.cc @@ -1,63 +1,38 @@ -/***************************************************************************************** - Copyright (c) 2002 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. - - $Log: main.cc,v $ - Revision 1.1.1.1 2006/06/01 12:46:16 reddawg - ubix2 - - Revision 1.2 2005/10/12 00:13:37 reddawg - Removed - - Revision 1.1.1.1 2005/09/26 17:24:36 reddawg - no message - - Revision 1.3 2004/11/16 18:38:27 reddawg - Oh Man - - Revision 1.2 2004/05/19 17:09:50 flameshadow - chg: Undid previous renaming. This now restores me as the EOOUIAD. - - Revision 1.1.1.1 2004/04/15 12:07:16 reddawg - UbixOS v1.0 - - Revision 1.29 2004/04/13 16:36:33 reddawg - Changed our copyright, it is all now under a BSD-Style license - - - - $Id: main.cc 89 2016-01-12 00:20:40Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ extern "C" { - #include - #include - #include - #include - #include - } +#include +#include +#include +#include +#include +} #include #include @@ -67,79 +42,79 @@ extern "C" void sdeThread() { ogSurface *screen = new ogDisplay_UbixOS(); struct sdeWindows *tmp = 0x0; - ogSurface *buf = 0x0; + ogSurface *buf = 0x0; ogBitFont * font = new ogBitFont(); - font->Load("ROM8X14.DPF",0); + font->Load("ROM8X14.DPF", 0); font->SetFGColor(255, 255, 255, 255); font->SetBGColor(0, 0, 0, 255); printOff = 0x1; - screen->ogCreate(800,600,OG_PIXFMT_16BPP); - screen->ogClear(screen->ogPack(122,140,163)); + screen->ogCreate(800, 600, OG_PIXFMT_16BPP); + screen->ogClear(screen->ogPack(122, 140, 163)); systemVitals->screen = screen; - systemVitals->font = font; + systemVitals->font = font; - ogprintOff = (int)0x0; + ogprintOff = (int) 0x0; screen->ogSetAntiAliasing(false); - + while (1) { - for (tmp = windows;tmp;tmp=tmp->next) { + for (tmp = windows; tmp; tmp = tmp->next) { switch (tmp->status) { case registerWindow: - buf = (ogSurface *)tmp->buf; - buf->buffer = (void *)vmmMapFromTask(tmp->pid,buf->buffer,buf->bSize); + buf = (ogSurface *) tmp->buf; + buf->buffer = (void *) vmmMapFromTask(tmp->pid, buf->buffer, buf->bSize); if (buf->buffer == 0x0) { kprintf("Error: buf->buffer\n"); - while (1); - } - buf->lineOfs = (uInt32 *)vmmMapFromTask(tmp->pid,buf->lineOfs,buf->lSize); + while (1) + ; + } + buf->lineOfs = (uInt32 *) vmmMapFromTask(tmp->pid, buf->lineOfs, buf->lSize); if (buf->lineOfs == 0x0) { kprintf("Error: buf->lineOfs\n"); - while (1); - } + while (1) + ; + } tmp->status = windowReady; //kprintf("Window Registered!\n"); - break; + break; case drawWindow: - buf = (ogSurface *)tmp->buf; - screen->ogCopyBuf(screen->ogGetMaxX() - buf->ogGetMaxX(), - screen->ogGetMaxY() - buf->ogGetMaxY(), *buf,0, 0, - buf->ogGetMaxX(), buf->ogGetMaxY()); + buf = (ogSurface *) tmp->buf; + screen->ogCopyBuf(screen->ogGetMaxX() - buf->ogGetMaxX(), screen->ogGetMaxY() - buf->ogGetMaxY(), *buf, 0, 0, buf->ogGetMaxX(), buf->ogGetMaxY()); tmp->status = windowReady; //kprintf("Draw Window Routines Here\n"); - break; + break; case killWindow: //kprintf("Killed Window\n"); if (tmp->next != 0x0) { tmp->next->prev = tmp->prev; if (tmp->prev != 0x0) tmp->prev->next = tmp->next; - } + } else if (tmp->prev != 0x0) { tmp->prev->next = tmp->next; if (tmp->next != 0x0) tmp->next->prev = tmp->prev; - } + } else { windows = 0x0; - } - vmm_unmapPages(buf->buffer,buf->bSize); - vmm_unmapPages(buf->lineOfs,buf->lSize); - // kfree(tmp->buf); + } + vmm_unmapPages(buf->buffer, buf->bSize); + vmm_unmapPages(buf->lineOfs, buf->lSize); + // kfree(tmp->buf); kfree(tmp); tmp = 0x0; - break; + break; default: - break; - } + break; } - //sched_yield(); } + //sched_yield(); } +} /*** END diff --git a/sys/sde/ogDisplay_UbixOS.cc b/sys/sde/ogDisplay_UbixOS.cc index 6175f1b..886c193 100755 --- a/sys/sde/ogDisplay_UbixOS.cc +++ b/sys/sde/ogDisplay_UbixOS.cc @@ -1,72 +1,44 @@ -/***************************************************************************************** - Copyright (c) 2002 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. - - $Log: ogDisplay_UbixOS.cc,v $ - Revision 1.1.1.1 2006/06/01 12:46:17 reddawg - ubix2 - - Revision 1.2 2005/10/12 00:13:37 reddawg - Removed - - Revision 1.1.1.1 2005/09/26 17:24:37 reddawg - no message - - Revision 1.3 2004/07/28 15:05:43 reddawg - Major: - Pages now have strict security enforcement. - Many null dereferences have been resolved. - When apps loaded permissions set for pages rw and ro - - Revision 1.2 2004/05/19 17:09:50 flameshadow - chg: Undid previous renaming. This now restores me as the EOOUIAD. - - Revision 1.1.1.1 2004/04/15 12:07:17 reddawg - UbixOS v1.0 - - Revision 1.20 2004/04/13 16:36:33 reddawg - Changed our copyright, it is all now under a BSD-Style license - - - - $Id: ogDisplay_UbixOS.cc 89 2016-01-12 00:20:40Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include #include extern "C" { - #include - #include - #include - #include - #include - #include - #include - } +#include +#include +#include +#include +#include +#include +#include +} /* * @@ -74,10 +46,9 @@ * */ -void -initVESAMode(uInt16 mode) { +void initVESAMode(uInt16 mode) { //kprintf("Pre-initVESAMode\n"); - biosCall(0x10,0x4F02,mode,0x0,0x0,0x0,0x0,0x0,0x0); + biosCall(0x10, 0x4F02, mode, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0); //kprintf("Post-initVESAMode\n"); return; } @@ -88,45 +59,43 @@ pal = new ogRGBA8[256]; attributes = new ogAttributes(); - VESAInfo = (ogVESAInfo *)0x11000; - modeInfo = (ogModeInfo *)0x11200; + VESAInfo = (ogVESAInfo *) 0x11000; + modeInfo = (ogModeInfo *) 0x11200; GetVESAInfo(); return; } // ogDisplay_UbixOS::ogDisplay_UbixOS -void -ogDisplay_UbixOS::GetModeInfo(uInt16 mode) { +void ogDisplay_UbixOS::GetModeInfo(uInt16 mode) { //kprintf("Pre-getModeInfo\n"); - biosCall(0x10,0x4F01,0x0,mode,0x0,0x0,0x0,0x1120,0x0); + biosCall(0x10, 0x4F01, 0x0, mode, 0x0, 0x0, 0x0, 0x1120, 0x0); //kprintf("Post-getModeInfo\n"); return; } // ogDisplay_UbixOS::GetModeInfo -void -ogDisplay_UbixOS::GetVESAInfo(void) { +void ogDisplay_UbixOS::GetVESAInfo(void) { VESAInfo->VBESignature[0] = 'V'; // First off initialize the structure. VESAInfo->VBESignature[1] = 'B'; VESAInfo->VBESignature[2] = 'E'; VESAInfo->VBESignature[3] = '2'; //kprintf("Pre-getVESAInfo\n"); - biosCall(0x10,0x4F00,0x0,0x0,0x0,0x0,0x0,0x1100,0x0); + biosCall(0x10, 0x4F00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1100, 0x0); //kprintf("Post-getVESAInfo\n"); return; - } // ogDisplay_UbixOS::GetVESAInfo +} // ogDisplay_UbixOS::GetVESAInfo -uInt16 -ogDisplay_UbixOS::FindMode(uInt32 _xRes, uInt32 _yRes, uInt32 _BPP) { +uInt16 ogDisplay_UbixOS::FindMode(uInt32 _xRes, uInt32 _yRes, uInt32 _BPP) { uInt16 mode; - if ((_xRes == 320) && (_yRes == 200) && (_BPP == 8)) return 0x13; + if ((_xRes == 320) && (_yRes == 200) && (_BPP == 8)) + return 0x13; // if ((VESAInfo==NULL) || (VESAInfo->videoModePtr==NULL)) return 0; - if (modeInfo == NULL) return 0; + if (modeInfo == NULL) + return 0; for (mode = 0x100; mode < 0x1FF; mode++) { GetModeInfo(mode); - if ((modeInfo->xRes >= _xRes) && (modeInfo->yRes >= _yRes) && - (modeInfo->bitsPerPixel == _BPP)) + if ((modeInfo->xRes >= _xRes) && (modeInfo->yRes >= _yRes) && (modeInfo->bitsPerPixel == _BPP)) return mode; } @@ -136,21 +105,21 @@ void ogDisplay_UbixOS::SetMode(uInt16 mode) { uInt32 size = 0x0, count = 0x0, i = 0x0; - + if (mode == 0x13) { - + xRes = 320; yRes = 200; maxX = 319; maxY = 199; - BPP = 8; + BPP = 8; bytesPerPix = 1; redFieldPosition = 0; greenFieldPosition = 0; blueFieldPosition = 0; alphaFieldPosition = 0; - + redShifter = 0; greenShifter = 0; blueShifter = 0; @@ -159,40 +128,40 @@ // UBU, THIS IS NULL BECAUSE WE DON'T EVER USE 320x200x256c! // THIS COMMENT WILL COME BACK TO BITE YOU ON THE ASS buffer = NULL; - - } else { + + } + else { buffer = NULL; mode |= 0x4000; // attempt lfb GetModeInfo(mode); - if (modeInfo->physBasePtr == 0) return; - buffer = (void *)modeInfo->physBasePtr; - size = (modeInfo->yRes*modeInfo->bytesPerLine+4095); - + if (modeInfo->physBasePtr == 0) + return; + buffer = (void *) modeInfo->physBasePtr; + size = (modeInfo->yRes * modeInfo->bytesPerLine + 4095); + xRes = modeInfo->bytesPerLine; yRes = modeInfo->yRes; - maxX = modeInfo->xRes-1; - maxY = yRes-1; + maxX = modeInfo->xRes - 1; + maxY = yRes - 1; BPP = modeInfo->bitsPerPixel; bytesPerPix = (BPP + 7) >> 3; - redFieldPosition = modeInfo->redFieldPosition; + redFieldPosition = modeInfo->redFieldPosition; greenFieldPosition = modeInfo->greenFieldPosition; - blueFieldPosition = modeInfo->blueFieldPosition; + blueFieldPosition = modeInfo->blueFieldPosition; alphaFieldPosition = modeInfo->alphaFieldPosition; if (bytesPerPix == 4) { modeInfo->alphaMaskSize = 8; - while ((alphaFieldPosition == redFieldPosition) || - (alphaFieldPosition == greenFieldPosition) || - (alphaFieldPosition == blueFieldPosition)) + while ((alphaFieldPosition == redFieldPosition) || (alphaFieldPosition == greenFieldPosition) || (alphaFieldPosition == blueFieldPosition)) alphaFieldPosition += 8; } // if - - redShifter = 8-modeInfo->redMaskSize; - greenShifter = 8-modeInfo->greenMaskSize; - blueShifter = 8-modeInfo->blueMaskSize; - alphaShifter = 8-modeInfo->alphaMaskSize; + + redShifter = 8 - modeInfo->redMaskSize; + greenShifter = 8 - modeInfo->greenMaskSize; + blueShifter = 8 - modeInfo->blueMaskSize; + alphaShifter = 8 - modeInfo->alphaMaskSize; if (modeInfo->alphaMaskSize != 0) alphaMasker = ~(OG_MASKS[modeInfo->alphaMaskSize] << alphaFieldPosition); @@ -200,10 +169,10 @@ alphaMasker = ~0; } // else not mode 0x13 - + printOff = 0; - for (i = 0x0; i < ((size)/4096); i++) { - if ((vmm_remapPage(modeInfo->physBasePtr + (i * 0x1000),modeInfo->physBasePtr + (i * 0x1000),KERNEL_PAGE_DEFAULT)) == 0x0) + for (i = 0x0; i < ((size) / 4096); i++) { + if ((vmm_remapPage(modeInfo->physBasePtr + (i * 0x1000), modeInfo->physBasePtr + (i * 0x1000), KERNEL_PAGE_DEFAULT)) == 0x0) kpanic("Error: vmm_remapPage failed\n"); } // for i @@ -212,41 +181,43 @@ initVESAMode(mode); - if ((lineOfs != NULL) && (lSize != 0)) delete [] lineOfs; - lSize = yRes*sizeof(uInt32); - lineOfs = new uInt32[yRes];; - if (lineOfs == NULL) return; - + if ((lineOfs != NULL) && (lSize != 0)) + delete[] lineOfs; + lSize = yRes * sizeof(uInt32); + lineOfs = new uInt32[yRes]; + ; + if (lineOfs == NULL) + return; + lineOfs[0] = 0; for (count = 1; count < yRes; count++) - lineOfs[count] = lineOfs[count-1]+xRes; + lineOfs[count] = lineOfs[count - 1] + xRes; if (1 == bytesPerPix) { pixFmtID = 0x08080808; - } else { - pixFmtID = (redFieldPosition) | - (greenFieldPosition << 8) | - (blueFieldPosition << 16) | - (alphaFieldPosition << 24); + } + else { + pixFmtID = (redFieldPosition) | (greenFieldPosition << 8) | (blueFieldPosition << 16) | (alphaFieldPosition << 24); } // else ogSetAntiAliasing(BPP > 8); - if (pal == NULL) pal = new ogRGBA8[256]; + if (pal == NULL) + pal = new ogRGBA8[256]; ogSetPalette(DEFAULT_PALETTE); - + return; } // ogDisplay_UbixOS::SetMode -void -ogDisplay_UbixOS::ogSetPalette(const ogRGBA8 newPal[256]) { +void ogDisplay_UbixOS::ogSetPalette(const ogRGBA8 newPal[256]) { ogSurface::ogSetPalette(newPal); SetPal(); return; } // ogDisplay_UbixOS::ogSetPalette void ogDisplay_UbixOS::SetPal(void) { - if (bytesPerPix != 1) return; - outportByte(0x3c8,0); + if (bytesPerPix != 1) + return; + outportByte(0x3c8, 0); for (uInt32 c = 0; c < 256; c++) { outportByte(0x3c9, pal[c].red >> 2); outportByte(0x3c9, pal[c].green >> 2); @@ -255,71 +226,65 @@ return; } // ogDisplay_UbixOS::SetPal -bool -ogDisplay_UbixOS::ogAlias(ogSurface& SrcObject, uInt32 x1, - uInt32 y1, uInt32 x2, uInt32 y2) { +bool ogDisplay_UbixOS::ogAlias(ogSurface& SrcObject, uInt32 x1, uInt32 y1, uInt32 x2, uInt32 y2) { ogSetLastError(ogNoAliasing); return false; } // ogDisplay_UbixOS::ogAlias -bool -ogDisplay_UbixOS::ogCreate(uInt32 _xRes, uInt32 _yRes,ogPixelFmt _pixFormat) { +bool ogDisplay_UbixOS::ogCreate(uInt32 _xRes, uInt32 _yRes, ogPixelFmt _pixFormat) { uInt16 mode; mode = 0x114; // was 0x111 SetMode(mode); /* - mode = FindMode(_xRes, _yRes, _pixFormat.BPP); - if ((mode == 0) && ((_pixFormat.BPP==24) || (_pixFormat.BPP==32))) { - if (_pixFormat.BPP==24) _pixFormat.BPP=32; else _pixFormat.BPP=24; - mode=FindMode(_xRes,_yRes,_pixFormat.BPP); - } // if - if (mode!=0) SetMode(mode); - */ - return (mode!=0); + mode = FindMode(_xRes, _yRes, _pixFormat.BPP); + if ((mode == 0) && ((_pixFormat.BPP==24) || (_pixFormat.BPP==32))) { + if (_pixFormat.BPP==24) _pixFormat.BPP=32; else _pixFormat.BPP=24; + mode=FindMode(_xRes,_yRes,_pixFormat.BPP); + } // if + if (mode!=0) SetMode(mode); + */ + return (mode != 0); } // ogDisplay_UbixOS::ogCreate -bool -ogDisplay_UbixOS::ogClone(ogSurface& SrcObject) { +bool ogDisplay_UbixOS::ogClone(ogSurface& SrcObject) { ogSetLastError(ogNoCloning); return false; } // ogDisplay_UbixOS::ogClone -void -ogDisplay_UbixOS::ogCopyPalette(ogSurface& SrcObject) { +void ogDisplay_UbixOS::ogCopyPalette(ogSurface& SrcObject) { ogSurface::ogCopyPalette(SrcObject); SetPal(); return; } // ogDisplay_UbixOS::ogCopyPalette -bool -ogDisplay_UbixOS::ogLoadPalette(const char *palfile) { +bool ogDisplay_UbixOS::ogLoadPalette(const char *palfile) { bool result; - if ((result = ogSurface::ogLoadPalette(palfile))==true) SetPal(); + if ((result = ogSurface::ogLoadPalette(palfile)) == true) + SetPal(); return result; } // ogDisplay_UbixOS::ogLoadPalette -void -ogDisplay_UbixOS::ogSetPalette(uInt8 colour, uInt8 red, uInt8 green, uInt8 blue) { - if (pal == NULL) return; +void ogDisplay_UbixOS::ogSetPalette(uInt8 colour, uInt8 red, uInt8 green, uInt8 blue) { + if (pal == NULL) + return; ogSurface::ogSetPalette(colour, red, green, blue); outportByte(0x3c8, colour); outportByte(0x3c9, red >> 2); outportByte(0x3c9, green >> 2); outportByte(0x3c9, blue >> 2); - + return; } // ogDisplay_UbixOS::ogSetPalette -void -ogDisplay_UbixOS::ogSetPalette(uInt8 colour, uInt8 red, uInt8 green, - uInt8 blue, uInt8 alpha) { - if (pal == NULL) return; +void ogDisplay_UbixOS::ogSetPalette(uInt8 colour, uInt8 red, uInt8 green, uInt8 blue, uInt8 alpha) { + if (pal == NULL) + return; ogSurface::ogSetPalette(colour, red, green, blue, alpha); outportByte(0x3c8, colour); outportByte(0x3c9, red >> 2); outportByte(0x3c9, green >> 2); outportByte(0x3c9, blue >> 2); - + return; } // ogDisplay_UbixOS::ogSetPalette diff --git a/sys/sde/sde.cc b/sys/sde/sde.cc index 2848a58..cf31b55 100644 --- a/sys/sde/sde.cc +++ b/sys/sde/sde.cc @@ -1,89 +1,64 @@ -/***************************************************************************************** - Copyright (c) 2002 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. - - $Log: sde.cc,v $ - Revision 1.1.1.1 2006/06/01 12:46:17 reddawg - ubix2 - - Revision 1.2 2005/10/12 00:13:37 reddawg - Removed - - Revision 1.1.1.1 2005/09/26 17:24:37 reddawg - no message - - Revision 1.3 2004/08/21 23:47:50 reddawg - *** empty log message *** - - Revision 1.2 2004/05/19 04:07:43 reddawg - kmalloc(size,pid) no more it is no kmalloc(size); the way it should of been - - Revision 1.1.1.1 2004/04/15 12:07:17 reddawg - UbixOS v1.0 - - Revision 1.12 2004/04/13 16:36:33 reddawg - Changed our copyright, it is all now under a BSD-Style license - - - - $Id: sde.cc 89 2016-01-12 00:20:40Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ extern "C" { - #include - #include - #include - #include - #include - #include - #include - #include +#include +#include +#include +#include +#include +#include +#include +#include } #include struct sdeWindows *windows = 0x0; -extern "C" void sysSDE(uInt32 cmd,void *ptr) { +extern "C" void sysSDE(uInt32 cmd, void *ptr) { ogSurface *newBuf = 0x0; - ogSurface *oldBuf = (ogSurface *)ptr; + ogSurface *oldBuf = (ogSurface *) ptr; struct sdeWindows *tmp = 0x0; - - for (tmp=windows;tmp;tmp=tmp->next) { - if (tmp->pid == (int)_current->id) + + for (tmp = windows; tmp; tmp = tmp->next) { + if (tmp->pid == (int) _current->id) break; - } - + } + if (tmp != 0x0) { while (tmp->status != windowReady) asm("hlt"); - //sched_yield(); - } + //sched_yield(); + } else if (tmp == 0x0 && cmd != registerWindow) { kprintf("Invalid Window\n"); return; - } + } switch (cmd) { case drawWindow: @@ -91,64 +66,64 @@ while (tmp->status != windowReady) { //sched(); //asm("hlt"); - } - break; + } + break; case killWindow: tmp->status = killWindow; - break; + break; case registerWindow: if (oldBuf->buffer != 0x0) { - newBuf = new ogSurface(); - newBuf->version = oldBuf->version; - newBuf->buffer = oldBuf->buffer; - newBuf->owner = oldBuf->owner; - newBuf->lineOfs = oldBuf->lineOfs; - newBuf->pal = oldBuf->pal; - newBuf->attributes = oldBuf->attributes; - newBuf->xRes = oldBuf->xRes; - newBuf->yRes = oldBuf->yRes; - newBuf->maxX = oldBuf->maxX; - newBuf->maxY = oldBuf->maxY; - newBuf->bSize = oldBuf->bSize; - newBuf->lSize = oldBuf->lSize; - newBuf->BPP = oldBuf->BPP; - newBuf->bytesPerPix = oldBuf->bytesPerPix; - newBuf->pixFmtID = oldBuf->pixFmtID; - newBuf->redFieldPosition = oldBuf->redFieldPosition; + newBuf = new ogSurface(); + newBuf->version = oldBuf->version; + newBuf->buffer = oldBuf->buffer; + newBuf->owner = oldBuf->owner; + newBuf->lineOfs = oldBuf->lineOfs; + newBuf->pal = oldBuf->pal; + newBuf->attributes = oldBuf->attributes; + newBuf->xRes = oldBuf->xRes; + newBuf->yRes = oldBuf->yRes; + newBuf->maxX = oldBuf->maxX; + newBuf->maxY = oldBuf->maxY; + newBuf->bSize = oldBuf->bSize; + newBuf->lSize = oldBuf->lSize; + newBuf->BPP = oldBuf->BPP; + newBuf->bytesPerPix = oldBuf->bytesPerPix; + newBuf->pixFmtID = oldBuf->pixFmtID; + newBuf->redFieldPosition = oldBuf->redFieldPosition; newBuf->greenFieldPosition = oldBuf->greenFieldPosition; - newBuf->blueFieldPosition = oldBuf->blueFieldPosition; + newBuf->blueFieldPosition = oldBuf->blueFieldPosition; newBuf->alphaFieldPosition = oldBuf->alphaFieldPosition; - newBuf->redShifter = oldBuf->redShifter; - newBuf->greenShifter = oldBuf->greenShifter; - newBuf->blueShifter = oldBuf->blueShifter; - newBuf->alphaShifter = oldBuf->alphaShifter; - newBuf->lastError = oldBuf->lastError; - newBuf->dataState = oldBuf->dataState; - tmp = (struct sdeWindows *)kmalloc(sizeof(struct sdeWindows)); - tmp->buf = newBuf; + newBuf->redShifter = oldBuf->redShifter; + newBuf->greenShifter = oldBuf->greenShifter; + newBuf->blueShifter = oldBuf->blueShifter; + newBuf->alphaShifter = oldBuf->alphaShifter; + newBuf->lastError = oldBuf->lastError; + newBuf->dataState = oldBuf->dataState; + tmp = (struct sdeWindows *) kmalloc(sizeof(struct sdeWindows)); + tmp->buf = newBuf; tmp->status = registerWindow; - tmp->pid = _current->id; - tmp->prev = 0x0; + tmp->pid = _current->id; + tmp->prev = 0x0; if (windows == 0x0) { - windows = tmp; + windows = tmp; tmp->next = 0x0; - } + } else { tmp->next = windows; windows->prev = tmp; windows = tmp; - } } + } else { kprintf("Invalid Window\n"); - } - break; + } + break; default: - kprintf("Invalid SDE Command [0x%X]\n",ptr); - break; - } - return; + kprintf("Invalid SDE Command [0x%X]\n", ptr); + break; } + return; +} /*** END diff --git a/sys/sys/device.c b/sys/sys/device.c index 1239459..7ea9c68 100644 --- a/sys/sys/device.c +++ b/sys/sys/device.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - Copyright (c) 2002-2005 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: device.c 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include @@ -47,30 +46,29 @@ 05/19/2004 - Improving Upon the spec -*****************************************************************************************/ -int device_add(int minor,char type,struct device_interface *devInfo) { + *****************************************************************************************/ +int device_add(int minor, char type, struct device_interface *devInfo) { struct device_node *tmpDev = 0x0; - - - tmpDev = (struct device_node *)kmalloc(sizeof(struct device_node)); - if(tmpDev == NULL) - kprintf("Error Adding Device: memory failure\n"); - tmpDev->prev = 0x0; - tmpDev->minor = minor; - tmpDev->type = type; + tmpDev = (struct device_node *) kmalloc(sizeof(struct device_node)); + if (tmpDev == NULL) + kprintf("Error Adding Device: memory failure\n"); + + tmpDev->prev = 0x0; + tmpDev->minor = minor; + tmpDev->type = type; tmpDev->devInfo = devInfo; spinLock(&deviceSpinLock); - tmpDev->next = devices; - devices = tmpDev; + tmpDev->next = devices; + devices = tmpDev; spinUnlock(&deviceSpinLock); if (tmpDev->devInfo->initialized == 0x0) - return(tmpDev->devInfo->init(tmpDev)); + return (tmpDev->devInfo->init(tmpDev)); else - return(0x0); - } + return (0x0); +} /***************************************************************************************** @@ -82,69 +80,62 @@ 05/19/2004 - Improving Upon the spec -*****************************************************************************************/ -struct device_node *device_find(int major,int minor) { + *****************************************************************************************/ +struct device_node *device_find(int major, int minor) { struct device_node *tmpDev = 0x0; - + spinLock(&deviceSpinLock); - for (tmpDev = devices;tmpDev;tmpDev=tmpDev->next) { + for (tmpDev = devices; tmpDev; tmpDev = tmpDev->next) { if ((tmpDev->devInfo->major == major) && (tmpDev->minor == minor)) { spinUnlock(&deviceSpinLock); - return(tmpDev); - } + return (tmpDev); } + } spinUnlock(&deviceSpinLock); - return(0x0); - } - + return (0x0); +} /******************************************************************************************** -Function: int deviceRemove(struct *device_node); + Function: int deviceRemove(struct *device_node); -Description: This will remove a device based on it's pointer + Description: This will remove a device based on it's pointer -*********************************************************************************************/ -int device_remove(struct device_node *deviceToDelete) -{ -struct device_node *current, *previous; + *********************************************************************************************/ +int device_remove(struct device_node *deviceToDelete) { + struct device_node *current, *previous; - -current = devices; -previous=NULL; -spinLock(&deviceSpinLock); - while(current != NULL) - { - if(current==deviceToDelete) break; - else - { - previous = current; - current = current->next; - } - } - if(current == NULL) - { - spinUnlock(&deviceSpinLock); - return 1; - } - else - { - if(current == devices) - devices = devices->next; - else - previous->next = current->next; - kfree(current); - spinUnlock(&deviceSpinLock); - return 1; - } + current = devices; + previous = NULL; + spinLock(&deviceSpinLock); + while (current != NULL) { + if (current == deviceToDelete) + break; + else { + previous = current; + current = current->next; + } + } + if (current == NULL) { + spinUnlock(&deviceSpinLock); + return 1; + } + else { + if (current == devices) + devices = devices->next; + else + previous->next = current->next; + kfree(current); + spinUnlock(&deviceSpinLock); + return 1; + } spinUnlock(&deviceSpinLock); -return 0x0; + return 0x0; } - /*** END ***/ diff --git a/sys/sys/dma.c b/sys/sys/dma.c index 1128036..d6b6615 100644 --- a/sys/sys/dma.c +++ b/sys/sys/dma.c @@ -1,61 +1,60 @@ -/***************************************************************************************** - Copyright (c) 2002-2005 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: dma.c 79 2016-01-11 16:21:27Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include #define lowByte(x) (x & 0x00FF) #define highByte(x) ((x & 0xFF00) >> 8) - -static uInt8 maskReg[8] = { 0x0A, 0x0A, 0x0A, 0x0A, 0xD4, 0xD4, 0xD4, 0xD4 }; -static uInt8 clearReg[8] = { 0x0C, 0x0C, 0x0C, 0x0C, 0xD8, 0xD8, 0xD8, 0xD8 }; -static uInt8 modeReg[8] = { 0x0B, 0x0B, 0x0B, 0x0B, 0xD6, 0xD6, 0xD6, 0xD6 }; -static uInt8 addrPort[8] = { 0x00, 0x02, 0x04, 0x06, 0xC0, 0xC4, 0xC8, 0xCC }; -static uInt8 pagePort[8] = { 0x87, 0x83, 0x81, 0x82, 0x8F, 0x8B, 0x89, 0x8A }; + +static uInt8 maskReg[8] = { 0x0A, 0x0A, 0x0A, 0x0A, 0xD4, 0xD4, 0xD4, 0xD4 }; +static uInt8 clearReg[8] = { 0x0C, 0x0C, 0x0C, 0x0C, 0xD8, 0xD8, 0xD8, 0xD8 }; +static uInt8 modeReg[8] = { 0x0B, 0x0B, 0x0B, 0x0B, 0xD6, 0xD6, 0xD6, 0xD6 }; +static uInt8 addrPort[8] = { 0x00, 0x02, 0x04, 0x06, 0xC0, 0xC4, 0xC8, 0xCC }; +static uInt8 pagePort[8] = { 0x87, 0x83, 0x81, 0x82, 0x8F, 0x8B, 0x89, 0x8A }; static uInt8 countPort[8] = { 0x01, 0x03, 0x05, 0x07, 0xC2, 0xC6, 0xCA, 0xCE }; -void dmaXfer(uInt8 channel,uInt32 address,uInt length,uInt8 read) { - unsigned char page=0, mode=0; +void dmaXfer(uInt8 channel, uInt32 address, uInt length, uInt8 read) { + unsigned char page = 0, mode = 0; unsigned int offset = 0; if (read) { mode = 0x48 + channel; - } + } else { mode = 0x44 + channel; - } + } page = address >> 16; offset = address & 0xFFFF; length--; _dmaXfer(channel, page, offset, length, mode); - } +} -void _dmaXfer(uInt8 dmaChannel,uInt8 page,uInt offset,uInt length,uInt8 mode) { +void _dmaXfer(uInt8 dmaChannel, uInt8 page, uInt offset, uInt length, uInt8 mode) { //asm("cli"); outportByte(maskReg[dmaChannel], 0x04 | dmaChannel); outportByte(clearReg[dmaChannel], 0x00); @@ -67,7 +66,7 @@ outportByte(countPort[dmaChannel], highByte(length)); outportByte(maskReg[dmaChannel], dmaChannel); //asm("sti"); - } +} /*** END diff --git a/sys/sys/elf.c b/sys/sys/elf.c index d32a3b1..abd1941 100644 --- a/sys/sys/elf.c +++ b/sys/sys/elf.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - Copyright (c) 2002-2005 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: device.c 54 2016-01-11 01:29:55Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include diff --git a/sys/sys/idt.c b/sys/sys/idt.c index f69ec88..c50fb36 100644 --- a/sys/sys/idt.c +++ b/sys/sys/idt.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - Copyright (c) 2002-2005 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: idt.c 135 2016-01-15 22:22:55Z reddawg $ - - *****************************************************************************************/ +/*- + * 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. + */ #include #include @@ -67,42 +66,42 @@ /* Set up default vector table for all possible 256 interrupts */ - for ( i = 0x0; i < 256; i++ ) { - setVector( intNull, i, dPresent + dTrap + dDpl3 ); + for (i = 0x0; i < 256; i++) { + setVector(intNull, i, dPresent + dTrap + dDpl3); } /* Load the IDT into the system */ asm volatile( - "cli \n" - "lidt (%0) \n" /* Load the IDT */ - "pushfl \n" /* Clear the NT flag */ - "andl $0xffffbfff,(%%esp) \n" - "popfl \n" - "sti \n" - : - : "r" ((char *)&loadidt) + "cli \n" + "lidt (%0) \n" /* Load the IDT */ + "pushfl \n" /* Clear the NT flag */ + "andl $0xffffbfff,(%%esp) \n" + "popfl \n" + "sti \n" + : + : "r" ((char *)&loadidt) ); /* Set up the basic vectors for the reserved ints */ - setVector( _int0, 0, dPresent + dInt + dDpl0 ); - setVector( _int1, 1, dPresent + dInt + dDpl0 ); - setVector( _int2, 2, dPresent + dInt + dDpl0 ); - setVector( _int3, 3, dPresent + dInt + dDpl0 ); - setVector( _int4, 4, dPresent + dInt + dDpl0 ); - setVector( _int5, 5, dPresent + dInt + dDpl0 ); - setVector( _int6, 6, dPresent + dTrap + dDpl0 ); - setVector( _int7, 7, dPresent + dInt + dDpl0 ); - setTaskVector( 8, dPresent + dTask + dDpl0, 0x40 ); - setVector( _int9, 9, dPresent + dInt + dDpl0 ); - setVector( _int10, 10, dPresent + dInt + dDpl0 ); - setVector( _int11, 11, dPresent + dInt + dDpl0 ); - setVector( _int12, 12, dPresent + dInt + dDpl0 ); - setTaskVector( 13, dPresent + dTask + dDpl0, 0x38 ); - setVector( _vmm_pageFault, 14, dPresent + dInt + dDpl0 ); - setVector( _sysCall, 0x80, dPresent + dTrap + dDpl3 ); - setVector( _sysCall_new, 0x81, dPresent + dTrap + dDpl3 ); + setVector(_int0, 0, dPresent + dInt + dDpl0); + setVector(_int1, 1, dPresent + dInt + dDpl0); + setVector(_int2, 2, dPresent + dInt + dDpl0); + setVector(_int3, 3, dPresent + dInt + dDpl0); + setVector(_int4, 4, dPresent + dInt + dDpl0); + setVector(_int5, 5, dPresent + dInt + dDpl0); + setVector(_int6, 6, dPresent + dTrap + dDpl0); + setVector(_int7, 7, dPresent + dInt + dDpl0); + setTaskVector(8, dPresent + dTask + dDpl0, 0x40); + setVector(_int9, 9, dPresent + dInt + dDpl0); + setVector(_int10, 10, dPresent + dInt + dDpl0); + setVector(_int11, 11, dPresent + dInt + dDpl0); + setVector(_int12, 12, dPresent + dInt + dDpl0); + setTaskVector(13, dPresent + dTask + dDpl0, 0x38); + setVector(_vmm_pageFault, 14, dPresent + dInt + dDpl0); + setVector(_sysCall, 0x80, dPresent + dTrap + dDpl3); + setVector(_sysCall_new, 0x81, dPresent + dTrap + dDpl3); //setVector(_sysCallNew, 0x90, dPresent + dTrap + dDpl3); - setVector( timerInt, 0x68, (dInt + dPresent + dDpl0) ); + setVector(timerInt, 0x68, (dInt + dPresent + dDpl0)); gpfTSS->back_link = 0x0; gpfTSS->esp0 = 0x0; @@ -128,7 +127,7 @@ gpfTSS->trace_bitmap = 0x0000; gpfTSS->io_map = 0x8000; - memset( sfTSS, 0x0, sizeof(struct tssStruct) ); + memset(sfTSS, 0x0, sizeof(struct tssStruct)); sfTSS->cr3 = (unsigned int) kernelPageDirectory; sfTSS->eip = (unsigned int) &_int8; sfTSS->eflags = 0x206; @@ -143,14 +142,14 @@ sfTSS->io_map = 0x8000; /* Print out information for the IDT */ - kprintf( "idt0 - Address: [0x%X]\n", &ubixIDT ); + kprintf("idt0 - Address: [0x%X]\n", &ubixIDT); /* Return so we know all went well */ return (0x0); } /* Sets Up IDT Vector */ -void setVector( void *handler, unsigned char interrupt, unsigned short controlMajor ) { +void setVector(void *handler, unsigned char interrupt, unsigned short controlMajor) { unsigned short codesegment = 0x08; asm volatile ("movw %%cs,%0":"=g" (codesegment)); @@ -167,7 +166,7 @@ Notes: ************************************************************************/ -void setTaskVector( uInt8 interrupt, uInt16 controlMajor, uInt8 selector ) { +void setTaskVector(uInt8 interrupt, uInt16 controlMajor, uInt8 selector) { uInt16 codesegment = 0x08; asm volatile ("movw %%cs,%0":"=g" (codesegment)); @@ -179,7 +178,7 @@ /* Null Intterupt Descriptor */ void intNull() { - kprintf( "Invalid Interrupt[%i]\n", _current->id ); + kprintf("Invalid Interrupt[%i]\n", _current->id); /* kpanic("Invalid Interrupt[%i]\n",_current->id); while (1); @@ -189,38 +188,38 @@ } void _int0() { - kpanic( "int0: Divide-by-Zero [%i]\n", _current->id ); - endTask( _current->id ); + kpanic("int0: Divide-by-Zero [%i]\n", _current->id); + endTask(_current->id); sched_yield(); } void _int1() { - kpanic( "int1: Debug exception [%i]\n", _current->id ); - endTask( _current->id ); + kpanic("int1: Debug exception [%i]\n", _current->id); + endTask(_current->id); sched_yield(); } void _int2() { - kpanic( "int2: unknown error [%i]\n", _current->id ); - endTask( _current->id ); + kpanic("int2: unknown error [%i]\n", _current->id); + endTask(_current->id); sched_yield(); } void _int3() { - kpanic( "int3: Breakpoint [%i]\n", _current->id ); - endTask( _current->id ); + kpanic("int3: Breakpoint [%i]\n", _current->id); + endTask(_current->id); sched_yield(); } void _int4() { - kpanic( "int4: Overflow [%i]\n", _current->id ); - endTask( _current->id ); + kpanic("int4: Overflow [%i]\n", _current->id); + endTask(_current->id); sched_yield(); } void _int5() { - kpanic( "int5: Bounds check [%i]\n", _current->id ); - endTask( _current->id ); + kpanic("int5: Bounds check [%i]\n", _current->id); + endTask(_current->id); sched_yield(); } @@ -244,18 +243,17 @@ " iret \n" /* Exit interrupt */ ); - void __int6(struct trapframe *frame) { - die_if_kernel("invalid_op",frame,6); + die_if_kernel("invalid_op", frame, 6); //kprintf("tf_gs: 0x%X, tf_fs: 0x%X, tf_es: 0x%X, tf_ds: 0x%X\n", frame->tf_gs, frame->tf_fs, frame->tf_es, frame->tf_ds); //kpanic( "int6: Invalid opcode! [%i:0x%X:0x%X]\n", _current->id, _current->tss.eip, frame->tf_eip ); - endTask( _current->id ); + endTask(_current->id); sched_yield(); } void _int8() { struct tssStruct *sfTSS = (struct tssStruct *) 0x6200; - kpanic( "int8: Double Fault! [%i]\n", _current->id ); + kpanic("int8: Double Fault! [%i]\n", _current->id); sfTSS->cr3 = (unsigned int) kernelPageDirectory; sfTSS->eip = (unsigned int) &_int8; sfTSS->eflags = 0x206; @@ -268,31 +266,31 @@ sfTSS->fs = 0x10; sfTSS->gs = 0x10; sfTSS->io_map = 0x8000; - while ( 1 ) + while (1) asm("nop"); } void _int9() { - kpanic( "int9: Coprocessor Segment Overrun! [%i]\n", _current->id ); - endTask( _current->id ); + kpanic("int9: Coprocessor Segment Overrun! [%i]\n", _current->id); + endTask(_current->id); sched_yield(); } void _int10() { - kpanic( "int10: Invalid TSS! [%i]\n", _current->id ); - endTask( _current->id ); + kpanic("int10: Invalid TSS! [%i]\n", _current->id); + endTask(_current->id); sched_yield(); } void _int11() { - kpanic( "int11: Segment Not Present! [%i]\n", _current->id ); - endTask( _current->id ); + kpanic("int11: Segment Not Present! [%i]\n", _current->id); + endTask(_current->id); sched_yield(); } void _int12() { - kpanic( "int12: Stack-Segment Fault! [%i]\n", _current->id ); - endTask( _current->id ); + kpanic("int12: Stack-Segment Fault! [%i]\n", _current->id); + endTask(_current->id); sched_yield(); } @@ -303,161 +301,161 @@ bool isOperand32 = FALSE, isAddress32 = FALSE; struct tssStruct *gpfTSS = (struct tssStruct *) 0x4200; - irqDisable( 0x0 ); + irqDisable(0x0); gpfTSS->eip = (unsigned int) &_int13; gpfTSS->esp = 0x1D000; gpfTSS->ebp = 0x1D000; gpfTSS->eflags = 0x206; - ip = FP_TO_LINEAR( _current->tss.cs, _current->tss.eip ); + ip = FP_TO_LINEAR(_current->tss.cs, _current->tss.eip); ivt = (uInt16 *) 0x0; - stack = (uInt16 *) FP_TO_LINEAR( _current->tss.ss, _current->tss.esp ); + stack = (uInt16 *) FP_TO_LINEAR(_current->tss.ss, _current->tss.esp); stack32 = (uInt32 *) stack; - gpfStart: switch ( ip[0] ) { - case 0xCD: /* INT n */ - switch ( ip[1] ) { - case 0x69: - kprintf( "Exit Bios [0x%X]\n", _current->id ); + gpfStart: switch (ip[0]) { + case 0xCD: /* INT n */ + switch (ip[1]) { + case 0x69: + kprintf("Exit Bios [0x%X]\n", _current->id); + _current->state = DEAD; + break; + case 0x20: + case 0x21: + kpanic("GPF OP 0x20/0x21\n"); + break; + default: + stack -= 3; + _current->tss.esp = ((_current->tss.esp & 0xffff) - 6) & 0xffff; + stack[0] = (uInt16) (_current->tss.eip + 2); + stack[1] = _current->tss.cs; + stack[2] = (uInt16) _current->tss.eflags; + if (_current->oInfo.v86If) + stack[2] |= EFLAG_IF; + else + stack[2] &= ~EFLAG_IF; + _current->tss.cs = ivt[ip[1] * 2 + 1] & 0xFFFF; + _current->tss.eip = ivt[ip[1] * 2] & 0xFFFF; + break; + } + break; + case 0x66: + isOperand32 = TRUE; + ip++; + _current->tss.eip = (uInt16) (_current->tss.eip + 1); + goto gpfStart; + break; + case 0x67: + isAddress32 = TRUE; + ip++; + _current->tss.eip = (uInt16) (_current->tss.eip + 1); + goto gpfStart; + break; + case 0xF0: + _current->tss.eip = (uInt16) (_current->tss.eip + 1); + kpanic("GPF OP 0xF0\n"); + break; + case 0x9C: + if (isOperand32 == TRUE) { + _current->tss.esp = ((_current->tss.esp & 0xffff) - 4) & 0xffff; + stack32--; + stack32[0] = _current->tss.eflags & 0xDFF; + if (_current->oInfo.v86If == TRUE) + stack32[0] |= EFLAG_IF; + else + stack32[0] &= ~EFLAG_IF; + } + else { + _current->tss.esp = ((_current->tss.esp & 0xffff) - 2) & 0xffff; + stack--; + + stack[0] = (uInt16) _current->tss.eflags; + if (_current->oInfo.v86If == TRUE) + stack[0] |= EFLAG_IF; + else + stack[0] &= ~EFLAG_IF; + _current->tss.eip = (uInt16) (_current->tss.eip + 1); + + } + break; + case 0x9D: + if (isOperand32 == TRUE) { + _current->tss.eflags = EFLAG_IF | EFLAG_VM | (stack32[0] & 0xDFF); + _current->oInfo.v86If = (stack32[0] & EFLAG_IF) != 0; + _current->tss.esp = ((_current->tss.esp & 0xffff) + 4) & 0xffff; + } + else { + _current->tss.eflags = EFLAG_IF | EFLAG_VM | stack[0]; + _current->oInfo.v86If = (stack[0] & EFLAG_IF) != 0; + _current->tss.esp = ((_current->tss.esp & 0xffff) + 2) & 0xffff; + } + _current->tss.eip = (uInt16) (_current->tss.eip + 1); + /* kprintf("popf [0x%X]\n",_current->id); */ + break; + case 0xFA: + _current->oInfo.v86If = FALSE; + _current->tss.eflags &= ~EFLAG_IF; + _current->tss.eip = (uInt16) (_current->tss.eip + 1); + _current->oInfo.timer = 0x1; + break; + case 0xFB: + _current->oInfo.v86If = TRUE; + _current->tss.eflags |= EFLAG_IF; + _current->tss.eip = (uInt16) (_current->tss.eip + 1); + _current->oInfo.timer = 0x0; + /* kprintf("sti [0x%X]\n",_current->id); */ + break; + case 0xCF: + _current->tss.eip = stack[0]; + _current->tss.cs = stack[1]; + _current->tss.eflags = EFLAG_IF | EFLAG_VM | stack[2]; + _current->oInfo.v86If = (stack[2] & EFLAG_IF) != 0; + _current->tss.esp = ((_current->tss.esp & 0xffff) + 6) & 0xffff; + /* kprintf("iret [0x%X]\n",_current->id); */ + break; + case 0xEC: /* IN AL,DX */ + _current->tss.eax = (_current->tss.eax & ~0xFF) | inportByte(_current->tss.edx); + _current->tss.eip = (uInt16) (_current->tss.eip + 1); + break; + case 0xED: /* IN AX,DX */ + _current->tss.eax = (_current->tss.eax & ~0xFFFF) | inportWord(_current->tss.edx); + _current->tss.eip = (uInt16) (_current->tss.eip + 1); + break; + case 0xEE: /* OUT DX,AL */ + outportByte(_current->tss.edx, _current->tss.eax & 0xFF); + _current->tss.eip = (uInt16) (_current->tss.eip + 1); + break; + case 0xEF: + outportWord(_current->tss.edx, _current->tss.eax); + _current->tss.eip = (uInt16) (_current->tss.eip + 1); + break; + case 0xF4: + _current->tss.eip = (uInt16) (_current->tss.eip + 1); + break; + default: /* something wrong */ + kprintf("NonHandled OpCode [0x%X:0x%X]\n", _current->id, ip[0]); _current->state = DEAD; - break; - case 0x20: - case 0x21: - kpanic( "GPF OP 0x20/0x21\n" ); - break; - default: - stack -= 3; - _current->tss.esp = ((_current->tss.esp & 0xffff) - 6) & 0xffff; - stack[0] = (uInt16)( _current->tss.eip + 2 ); - stack[1] = _current->tss.cs; - stack[2] = (uInt16) _current->tss.eflags; - if ( _current->oInfo.v86If ) - stack[2] |= EFLAG_IF; - else - stack[2] &= ~EFLAG_IF; - _current->tss.cs = ivt[ip[1] * 2 + 1] & 0xFFFF; - _current->tss.eip = ivt[ip[1] * 2] & 0xFFFF; - break; - } - break; - case 0x66: - isOperand32 = TRUE; - ip++; - _current->tss.eip = (uInt16)( _current->tss.eip + 1 ); - goto gpfStart; - break; - case 0x67: - isAddress32 = TRUE; - ip++; - _current->tss.eip = (uInt16)( _current->tss.eip + 1 ); - goto gpfStart; - break; - case 0xF0: - _current->tss.eip = (uInt16)( _current->tss.eip + 1 ); - kpanic( "GPF OP 0xF0\n" ); - break; - case 0x9C: - if ( isOperand32 == TRUE ) { - _current->tss.esp = ((_current->tss.esp & 0xffff) - 4) & 0xffff; - stack32--; - stack32[0] = _current->tss.eflags & 0xDFF; - if ( _current->oInfo.v86If == TRUE ) - stack32[0] |= EFLAG_IF; - else - stack32[0] &= ~EFLAG_IF; - } - else { - _current->tss.esp = ((_current->tss.esp & 0xffff) - 2) & 0xffff; - stack--; - - stack[0] = (uInt16) _current->tss.eflags; - if ( _current->oInfo.v86If == TRUE ) - stack[0] |= EFLAG_IF; - else - stack[0] &= ~EFLAG_IF; - _current->tss.eip = (uInt16)( _current->tss.eip + 1 ); - - } - break; - case 0x9D: - if ( isOperand32 == TRUE ) { - _current->tss.eflags = EFLAG_IF | EFLAG_VM | (stack32[0] & 0xDFF); - _current->oInfo.v86If = (stack32[0] & EFLAG_IF) != 0; - _current->tss.esp = ((_current->tss.esp & 0xffff) + 4) & 0xffff; - } - else { - _current->tss.eflags = EFLAG_IF | EFLAG_VM | stack[0]; - _current->oInfo.v86If = (stack[0] & EFLAG_IF) != 0; - _current->tss.esp = ((_current->tss.esp & 0xffff) + 2) & 0xffff; - } - _current->tss.eip = (uInt16)( _current->tss.eip + 1 ); - /* kprintf("popf [0x%X]\n",_current->id); */ - break; - case 0xFA: - _current->oInfo.v86If = FALSE; - _current->tss.eflags &= ~EFLAG_IF; - _current->tss.eip = (uInt16)( _current->tss.eip + 1 ); - _current->oInfo.timer = 0x1; - break; - case 0xFB: - _current->oInfo.v86If = TRUE; - _current->tss.eflags |= EFLAG_IF; - _current->tss.eip = (uInt16)( _current->tss.eip + 1 ); - _current->oInfo.timer = 0x0; - /* kprintf("sti [0x%X]\n",_current->id); */ - break; - case 0xCF: - _current->tss.eip = stack[0]; - _current->tss.cs = stack[1]; - _current->tss.eflags = EFLAG_IF | EFLAG_VM | stack[2]; - _current->oInfo.v86If = (stack[2] & EFLAG_IF) != 0; - _current->tss.esp = ((_current->tss.esp & 0xffff) + 6) & 0xffff; - /* kprintf("iret [0x%X]\n",_current->id); */ - break; - case 0xEC: /* IN AL,DX */ - _current->tss.eax = (_current->tss.eax & ~0xFF) | inportByte( _current->tss.edx ); - _current->tss.eip = (uInt16)( _current->tss.eip + 1 ); - break; - case 0xED: /* IN AX,DX */ - _current->tss.eax = (_current->tss.eax & ~0xFFFF) | inportWord( _current->tss.edx ); - _current->tss.eip = (uInt16)( _current->tss.eip + 1 ); - break; - case 0xEE: /* OUT DX,AL */ - outportByte( _current->tss.edx, _current->tss.eax & 0xFF ); - _current->tss.eip = (uInt16)( _current->tss.eip + 1 ); - break; - case 0xEF: - outportWord( _current->tss.edx, _current->tss.eax ); - _current->tss.eip = (uInt16)( _current->tss.eip + 1 ); - break; - case 0xF4: - _current->tss.eip = (uInt16)( _current->tss.eip + 1 ); - break; - default: /* something wrong */ - kprintf( "NonHandled OpCode [0x%X:0x%X]\n", _current->id, ip[0] ); - _current->state = DEAD; break; } - irqEnable( 0 ); - while ( 1 ) + irqEnable(0); + while (1) ; } /* Removed static however this is the only place it's called from */ void mathStateRestore() { - if ( _usedMath != 0x0 ) { + if (_usedMath != 0x0) { asm( - "fnsave %0" - : - : "m" (_usedMath->i387) + "fnsave %0" + : + : "m" (_usedMath->i387) ); } - if ( _current->usedMath != 0x0 ) { + if (_current->usedMath != 0x0) { asm( - "frstor %0" - : - : "m" (_current->i387) + "frstor %0" + : + : "m" (_current->i387) ); } else { @@ -473,17 +471,17 @@ void _int7(); asm( - ".globl _int7 \n" - "_int7: \n" - " pushl %eax \n" - " clts \n" - " movl _current,%eax \n" - " cmpl _usedMath,%eax \n" - " je mathDone \n" - " call mathStateRestore \n" - "mathDone: \n" - " popl %eax \n" - " iret \n" + ".globl _int7 \n" + "_int7: \n" + " pushl %eax \n" + " clts \n" + " movl _current,%eax \n" + " cmpl _usedMath,%eax \n" + " je mathDone \n" + " call mathStateRestore \n" + "mathDone: \n" + " popl %eax \n" + " iret \n" ); /*** diff --git a/sys/sys/io.c b/sys/sys/io.c index 82f3207..fbc3f51 100644 --- a/sys/sys/io.c +++ b/sys/sys/io.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - Copyright (c) 2002-2005, 2016 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: io.c 88 2016-01-12 00:11:29Z reddawg $ - - *****************************************************************************************/ +/*- + * 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. + */ #include @@ -36,12 +35,12 @@ * \return returns unsigned char value * */ -unsigned char inportByte( unsigned int port ) { +unsigned char inportByte(unsigned int port) { unsigned char retVal; asm volatile( - "inb %%dx,%%al" - : "=a" (retVal) - : "d" (port) + "inb %%dx,%%al" + : "=a" (retVal) + : "d" (port) ); return (retVal); } @@ -53,12 +52,12 @@ * \return returns unsigned short value * */ -unsigned short inportWord( unsigned int port ) { +unsigned short inportWord(unsigned int port) { unsigned short retVal; asm volatile( - "inw %%dx,%%ax" - : "=a" (retVal) - : "d" (port) + "inw %%dx,%%ax" + : "=a" (retVal) + : "d" (port) ); return (retVal); } @@ -70,11 +69,11 @@ * \param value byte to output to port * */ -void outportByte( unsigned int port, unsigned char value ) { +void outportByte(unsigned int port, unsigned char value) { asm volatile( - "outb %%al,%%dx" - : - : "d" (port), "a" (value) + "outb %%al,%%dx" + : + : "d" (port), "a" (value) ); } @@ -85,12 +84,12 @@ * \param value byte to output to port * */ -void outportByteP( unsigned int port, unsigned char value ) { +void outportByteP(unsigned int port, unsigned char value) { asm volatile( - "outb %%al,%%dx\n" - "outb %%al,$0x80\n" - : - : "d" (port), "a" (value) + "outb %%al,%%dx\n" + "outb %%al,$0x80\n" + : + : "d" (port), "a" (value) ); } @@ -101,11 +100,11 @@ * \param value word to output to port * */ -void outportWord( unsigned int port, unsigned short value ) { +void outportWord(unsigned int port, unsigned short value) { asm volatile( - "outw %%ax,%%dx" - : - : "d" (port), "a" (value) + "outw %%ax,%%dx" + : + : "d" (port), "a" (value) ); } @@ -116,11 +115,11 @@ * \param value double word to output to port * */ -void outportDWord( unsigned int port, unsigned long value ) { +void outportDWord(unsigned int port, unsigned long value) { asm volatile( - "outl %%eax,%%dx" - : - : "d" (port), "a" (value) + "outl %%eax,%%dx" + : + : "d" (port), "a" (value) ); } @@ -131,12 +130,12 @@ * \return returns unsigned double word value * */ -unsigned long inportDWord( unsigned int port ) { +unsigned long inportDWord(unsigned int port) { unsigned long retVal; asm volatile( - "inl %%dx,%%eax" - : "=a" (retVal) - : "d" (port) + "inl %%dx,%%eax" + : "=a" (retVal) + : "d" (port) ); return (retVal); } diff --git a/sys/sys/video.c b/sys/sys/video.c index c35911a..4f3019b 100644 --- a/sys/sys/video.c +++ b/sys/sys/video.c @@ -1,40 +1,38 @@ -/***************************************************************************************** - Copyright (c) 2002-2005 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: video.c 79 2016-01-11 16:21:27Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include #include #include -static unsigned char *videoBuffer = (unsigned char *)0xB8000; -int printColor = defaultColor; - +static unsigned char *videoBuffer = (unsigned char *) 0xB8000; +int printColor = defaultColor; void backSpace() { uInt32 bufferOffset = 0x0; @@ -46,62 +44,59 @@ bufferOffset <<= 0x1; /* Shift Address Left 1 Bits */ videoBuffer[bufferOffset--] = 0x20; videoBuffer[bufferOffset--] = printColor; - videoBuffer[bufferOffset] = 0x20; + videoBuffer[bufferOffset] = 0x20; bufferOffset >>= 0x1; - tty_foreground->tty_x = (bufferOffset & 0xFF); + tty_foreground->tty_x = (bufferOffset & 0xFF); tty_foreground->tty_y = (bufferOffset >> 0x8); outportByte(0x3D4, 0x0f); outportByte(0x3D5, tty_foreground->tty_x); outportByte(0x3D4, 0x0e); outportByte(0x3D5, tty_foreground->tty_y); return; - } +} -void -kprint(char *string) -{ +void kprint(char *string) { - unsigned int bufferOffset = 0x0, character = 0x0, i = 0x0; + unsigned int bufferOffset = 0x0, character = 0x0, i = 0x0; /* Short circuit if we're in tty mode */ - if (NULL != tty_foreground) - { - tty_print(string,tty_find(0)); - return; + if (NULL != tty_foreground) { + tty_print(string, tty_find(0)); + return; } /* We Need To Get The Y Position */ outportByte(0x3D4, 0x0e); bufferOffset = inportByte(0x3D5); - bufferOffset <<= 8; /* Shift Address Left 8 Bits */ + bufferOffset <<= 8; /* Shift Address Left 8 Bits */ /* Then We Need To Add The X Position */ outportByte(0x3D4, 0x0f); bufferOffset += inportByte(0x3D5); - bufferOffset <<= 1; /* Shift Address Left 1 Bits */ + bufferOffset <<= 1; /* Shift Address Left 1 Bits */ while ((character = *string++)) { switch (character) { - case '\n': - bufferOffset = (bufferOffset / 160) * 160 + 160; + case '\n': + bufferOffset = (bufferOffset / 160) * 160 + 160; break; - default: - videoBuffer[bufferOffset++] = character; - videoBuffer[bufferOffset++] = printColor; + default: + videoBuffer[bufferOffset++] = character; + videoBuffer[bufferOffset++] = printColor; break; - } /* switch */ + } /* switch */ /* Check To See If We Are Out Of Bounds */ if (bufferOffset >= 160 * 25) { for (i = 0; i < 160 * 24; i++) { - videoBuffer[i] = videoBuffer[i + 160]; - } /* for */ + videoBuffer[i] = videoBuffer[i + 160]; + } /* for */ for (i = 0; i < 80; i++) { - videoBuffer[(160 * 24) + (i * 2)] = 0x20; - videoBuffer[(160 * 24) + (i * 2) + 1] = printColor; - } /* for */ + videoBuffer[(160 * 24) + (i * 2)] = 0x20; + videoBuffer[(160 * 24) + (i * 2) + 1] = printColor; + } /* for */ bufferOffset -= 160; - } /* if */ - } /* while */ - bufferOffset >>= 1; /* Set the new cursor position */ + } /* if */ + } /* while */ + bufferOffset >>= 1; /* Set the new cursor position */ outportByte(0x3D4, 0x0f); outportByte(0x3D5, ((bufferOffset & 0x0ff) & 0xFF)); outportByte(0x3D4, 0x0e); @@ -117,12 +112,12 @@ for (i = 0x0; i < (80 * 25); i++) { videoBuffer[i * 2] = 0x20; videoBuffer[i * 2 + 1] = defaultColor; - } + } outportByte(0x3D4, 0x0f); outportByte(0x3D5, 0); outportByte(0x3D4, 0x0e); outportByte(0x3D5, 0); - } +} /*** END diff --git a/sys/vmm/copyvirtualspace.c b/sys/vmm/copyvirtualspace.c index e843351..717d368 100644 --- a/sys/vmm/copyvirtualspace.c +++ b/sys/vmm/copyvirtualspace.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: copyvirtualspace.c 232 2016-01-24 01:47:12Z reddawg $ - - *****************************************************************************************/ +/*- + * 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. + */ #include #include diff --git a/sys/vmm/createvirtualspace.c b/sys/vmm/createvirtualspace.c index feecaac..113b329 100644 --- a/sys/vmm/createvirtualspace.c +++ b/sys/vmm/createvirtualspace.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - Copyright (c) 2002, 2016 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: createvirtualspace.c 232 2016-01-24 01:47:12Z reddawg $ - - *****************************************************************************************/ +/*- + * 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. + */ #include diff --git a/sys/vmm/freevirtualpage.c b/sys/vmm/freevirtualpage.c index 11dc32d..d42638b 100644 --- a/sys/vmm/freevirtualpage.c +++ b/sys/vmm/freevirtualpage.c @@ -1,5 +1,33 @@ +/*- + * 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. + */ + #include int vmm_freeVirtualPage(uint32_t addr) { - return(0); + return (0); } diff --git a/sys/vmm/getfreepage.c b/sys/vmm/getfreepage.c index 39a6679..b406cc4 100644 --- a/sys/vmm/getfreepage.c +++ b/sys/vmm/getfreepage.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - Copyright (c) 2002 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: getfreepage.c 188 2016-01-23 03:09:10Z reddawg $ - - *****************************************************************************************/ +/*- + * 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. + */ #include #include @@ -44,34 +43,34 @@ 07/30/02 - This Returns A Free Page In The Top 1GB For The Kernel ************************************************************************/ -void *vmm_getFreePage( pidType pid ) { +void *vmm_getFreePage(pidType pid) { uInt16 x = 0x0, y = 0x0; uInt32 *pageTableSrc = 0x0; - spinLock( &vmmGFPlock ); + spinLock(&vmmGFPlock); /* Lets Search For A Free Page */ - for ( x = 768; x < 1024; x++ ) { + for (x = 768; x < 1024; x++) { /* Set Page Table Address */ pageTableSrc = (uInt32 *) (PT_BASE_ADDR + (0x1000 * x)); - for ( y = 0x0; y < 1024; y++ ) { + for (y = 0x0; y < 1024; y++) { /* Loop Through The Page Table Find An UnAllocated Page */ - if ( (uInt32) pageTableSrc[y] == (uInt32) 0x0 ) { + if ((uInt32) pageTableSrc[y] == (uInt32) 0x0) { /* Map A Physical Page To The Virtual Page */ - if ( (vmm_remapPage( vmm_findFreePage( pid ), ((x * 0x400000) + (y * 0x1000)), KERNEL_PAGE_DEFAULT, pid )) == 0x0 ) - kpanic( "vmmRemapPage: vmm_getFreePage\n" ); + if ((vmm_remapPage(vmm_findFreePage(pid), ((x * 0x400000) + (y * 0x1000)), KERNEL_PAGE_DEFAULT, pid)) == 0x0) + kpanic("vmmRemapPage: vmm_getFreePage\n"); /* Clear This Page So No Garbage Is There */ - vmm_clearVirtualPage( (uInt32)( (x * 0x400000) + (y * 0x1000) ) ); + vmm_clearVirtualPage((uInt32) ((x * 0x400000) + (y * 0x1000))); /* Return The Address Of The Newly Allocate Page */ - spinUnlock( &vmmGFPlock ); + spinUnlock(&vmmGFPlock); return ((void *) ((x * 0x400000) + (y * 0x1000))); } } } /* If No Free Page Was Found Return NULL */ - spinUnlock( &vmmGFPlock ); + spinUnlock(&vmmGFPlock); return (0x0); } diff --git a/sys/vmm/getfreevirtualpage.c b/sys/vmm/getfreevirtualpage.c index ff0fcec..e20a802 100644 --- a/sys/vmm/getfreevirtualpage.c +++ b/sys/vmm/getfreevirtualpage.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: getfreevirtualpage.c 230 2016-01-24 01:36:51Z reddawg $ - - *****************************************************************************************/ +/*- + * 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. + */ #include #include @@ -46,30 +45,30 @@ 08/11/02 - This Will Return Next Avilable Free Page Of Tasks VM Space ************************************************************************/ -void *vmm_getFreeVirtualPage( pidType pid, int count, int type ) { +void *vmm_getFreeVirtualPage(pidType pid, int count, int type) { int y = 0, counter = 0, pdI = 0x0, ptI = 0x0; uint32_t *pageTableSrc = 0x0; uint32_t *pageDir = 0x0; uint32_t start_page = 0x0; - spinLock( &fvpSpinLock ); + spinLock(&fvpSpinLock); pageDir = (uInt32 *) PD_BASE_ADDR; /* Lets Search For A Free Page */ - if ( _current->oInfo.vmStart <= 0x100000 ) - kpanic( "Invalid vmStart\n" ); + if (_current->oInfo.vmStart <= 0x100000) + kpanic("Invalid vmStart\n"); /* Get Our Starting Address */ - if ( type == VM_THRD ) { - start_page = (uint32_t)( _current->td.vm_daddr + ctob( _current->td.vm_dsize ) ); + if (type == VM_THRD) { + start_page = (uint32_t) (_current->td.vm_daddr + ctob(_current->td.vm_dsize)); } - else if ( type == VM_TASK ) { + else if (type == VM_TASK) { //kprintf("vmStart"); start_page = _current->oInfo.vmStart; } else - K_PANIC( "Invalid Type" ); + K_PANIC("Invalid Type"); //kprintf( "Entering MMAP: Type: %i, Returning %i Pages At Address: 0x%X\n", type, count, start_page ); @@ -83,13 +82,13 @@ * Lets Start Allocating Pages */ - for ( counter = 0; counter < count; counter++ ) { + for (counter = 0; counter < count; counter++) { /* Locate Initial Page Table */ pdI = ((start_page + (counter * 0x1000)) / 0x400000); /* If Page Directory Is Not Yet Allocated Allocate It */ - if ( (pageDir[pdI] & PAGE_PRESENT) != PAGE_PRESENT ) { - pageDir[pdI] = (uInt32) vmm_findFreePage( _current->id ) | PAGE_DEFAULT; + if ((pageDir[pdI] & PAGE_PRESENT) != PAGE_PRESENT) { + pageDir[pdI] = (uInt32) vmm_findFreePage(_current->id) | PAGE_DEFAULT; /* Also Add It To Virtual Space So We Can Make Changes Later */ pageTableSrc = (uInt32 *) (PT_BASE_ADDR + (4096 * 767)); @@ -97,14 +96,14 @@ /* Reload Page Directory */ asm( - "movl %cr3,%eax\n" - "movl %eax,%cr3\n" + "movl %cr3,%eax\n" + "movl %eax,%cr3\n" ); pageTableSrc = (uInt32 *) (PT_BASE_ADDR + (0x1000 * pdI)); /* Initialize The New Page Table To Prevent Dirty Bits */ - for ( y = 0x0; y < PD_ENTRIES; y++ ) { + for (y = 0x0; y < PD_ENTRIES; y++) { pageTableSrc[y] = (uInt32) 0x0; } @@ -115,31 +114,31 @@ ptI = ((start_page - (pdI * 0x400000)) / 0x1000); - for ( y = ptI; y < 1024 && counter < count; y++ ) { + for (y = ptI; y < 1024 && counter < count; y++) { /* Loop Through The Page Table Find An UnAllocated Page */ - if ( (pageTableSrc[y] & PAGE_COW) == PAGE_COW ) { - kprintf( "COW PAGE NOT CLEANED!" ); + if ((pageTableSrc[y] & PAGE_COW) == PAGE_COW) { + kprintf("COW PAGE NOT CLEANED!"); } - else if ( (uInt32) pageTableSrc[y] == (uInt32) 0x0 ) { - if ( (vmm_remapPage( (uInt32) vmm_findFreePage( pid ), ((pdI * (1024 * 4096)) + (y * 4096)), PAGE_DEFAULT, pid )) == 0x0 ) - kpanic( "vmmRemapPage: getFreeVirtualPage-1: (%i)[0x%X]\n", type, ((pdI * (1024 * 4096)) + (y * 4096)) ); - vmm_clearVirtualPage( (uInt32)( (pdI * (1024 * 4096)) + (y * 4096) ) ); + else if ((uInt32) pageTableSrc[y] == (uInt32) 0x0) { + if ((vmm_remapPage((uInt32) vmm_findFreePage(pid), ((pdI * (1024 * 4096)) + (y * 4096)), PAGE_DEFAULT, pid)) == 0x0) + kpanic("vmmRemapPage: getFreeVirtualPage-1: (%i)[0x%X]\n", type, ((pdI * (1024 * 4096)) + (y * 4096))); + vmm_clearVirtualPage((uInt32) ((pdI * (1024 * 4096)) + (y * 4096))); } else { - kprintf( "-> y: %i, ptI: 0x%X, pdI: 0x%X pTS: 0x%X ??\n", y, ptI, pdI, pageTableSrc[y] ); - K_PANIC( "UHM HOW DO WE HAVE AN ALLOCATED PAGE HERE!!\n" ); + kprintf("-> y: %i, ptI: 0x%X, pdI: 0x%X pTS: 0x%X ??\n", y, ptI, pdI, pageTableSrc[y]); + K_PANIC("UHM HOW DO WE HAVE AN ALLOCATED PAGE HERE!!\n"); } counter++; } } - if ( type == VM_THRD ) { - _current->td.vm_dsize += btoc( count * 0x1000 ); + if (type == VM_THRD) { + _current->td.vm_dsize += btoc(count * 0x1000); //kprintf( "vm_dsize: [0x%X]][0x%X]\n", ctob( _current->td.vm_dsize ), _current->td.vm_dsize ); } - else if ( type == VM_TASK ) + else if (type == VM_TASK) _current->oInfo.vmStart += count * 0x1000; /* @@ -148,7 +147,7 @@ //kprintf( "mmap: [0x%x]\n", start_page ); /* If No Free Page Was Found Return NULL */ - spinUnlock( &fvpSpinLock ); + spinUnlock(&fvpSpinLock); return (start_page); } diff --git a/sys/vmm/getphysicaladdr.c b/sys/vmm/getphysicaladdr.c index 1ccdb86..6e91501 100644 --- a/sys/vmm/getphysicaladdr.c +++ b/sys/vmm/getphysicaladdr.c @@ -1,61 +1,59 @@ -/***************************************************************************************** - 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: getphysicaladdr.c 188 2016-01-23 03:09:10Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include /*! -Function: void *vmmGetPhysicalAddr(); -Description: Returns The Physical Address Of The Virtual Page -Notes: + Function: void *vmmGetPhysicalAddr(); + Description: Returns The Physical Address Of The Virtual Page + Notes: -*/ + */ uint32_t vmm_getPhysicalAddr(uInt32 pageAddr) { - int pageDirectoryIndex = 0x0, pageTableIndex = 0x0; - uInt32 *pageTable = 0x0; + int pageDirectoryIndex = 0x0, pageTableIndex = 0x0; + uInt32 *pageTable = 0x0; //Calculate The Page Directory Index pageDirectoryIndex = (pageAddr >> 22); - + //Calculate The Page Table Index pageTableIndex = ((pageAddr >> 12) & 0x3FF); - + /* Set pageTable To The Virtual Address Of Table */ pageTable = (uInt32 *) (PT_BASE_ADDR + (0x1000 * pageDirectoryIndex)); /* Return The Physical Address Of The Page */ - return ((uInt32)(pageTable[pageTableIndex] & 0xFFFFF000)); - } - + return ((uInt32) (pageTable[pageTableIndex] & 0xFFFFF000)); +} uint32_t vmm_getRealAddr(uint32_t addr) { - int pageDirectoryIndex = 0x0, pageTableIndex = 0x0; + int pageDirectoryIndex = 0x0, pageTableIndex = 0x0; uint32_t *pageTable = 0x0; //Calculate The Page Directory Index @@ -67,8 +65,8 @@ /* Set pageTable To The Virtual Address Of Table */ pageTable = (uint32_t *) (PT_BASE_ADDR + (0x1000 * pageDirectoryIndex)); /* Return The Physical Address Of The Page */ - return ((uint32_t)(pageTable[pageTableIndex] & 0xFFFFF000) + (addr & 0xFFF)); - } + return ((uint32_t) (pageTable[pageTableIndex] & 0xFFFFF000) + (addr & 0xFFF)); +} /*** END diff --git a/sys/vmm/page_fault.S b/sys/vmm/page_fault.S index 8cd19e0..5facca2 100644 --- a/sys/vmm/page_fault.S +++ b/sys/vmm/page_fault.S @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: page_fault.S 205 2016-01-23 19:18:59Z reddawg $ - - *****************************************************************************************/ +/*- + * 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. + */ /* Page fault wrapper this will aquire some values we need for later use diff --git a/sys/vmm/pagefault.c b/sys/vmm/pagefault.c index c63ca3f..072ddb8 100644 --- a/sys/vmm/pagefault.c +++ b/sys/vmm/pagefault.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - Copyright (c) 2002 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: pagefault.c 230 2016-01-24 01:36:51Z reddawg $ - - *****************************************************************************************/ +/*- + * 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. + */ #include #include @@ -62,7 +61,7 @@ uint32_t memAddr = cr2; //MrOlsen 2017-12-15 - -kprintf("CR2: [0x%X], EIP: 0x%X, ERR: 0x%X\n", cr2, frame->tf_eip, frame->tf_err); + kprintf("CR2: [0x%X], EIP: 0x%X, ERR: 0x%X\n", cr2, frame->tf_eip, frame->tf_err); /* Try to aquire lock otherwise spin till we do */ spinLock(&pageFaultSpinLock); @@ -87,7 +86,8 @@ kprintf("Segfault At Address: [0x%X][0x%X][%i][0x%X], Not A Valid Page Table\n", memAddr, esp, _current->id, eip); spinUnlock(&pageFaultSpinLock); endTask(_current->id); - } else { + } + else { /* Set pageTable To Point To Virtual Address Of Page Table */ pageTable = (uInt32 *) (PT_BASE_ADDR + (0x1000 * pageDirectoryIndex)); @@ -108,17 +108,20 @@ pageTable[pageTableIndex] = (uInt32) (vmm_getPhysicalAddr((uInt32) dst) | (memAddr & 0xFFF)); /* Unlink From Memory Map Allocated Page */ vmm_unmapPage((uInt32) dst, 1); - } else if (pageTable[pageTableIndex] != 0x0) { + } + else if (pageTable[pageTableIndex] != 0x0) { kprintf("Security failed pagetable not user permission\n"); kprintf("pageDir: [0x%X]\n", pageDir[pageDirectoryIndex]); kprintf("pageTable: [0x%X:0x%X:0x%X:0x%X]\n", pageTable[pageTableIndex], pageTableIndex, pageDirectoryIndex, eip); kprintf("Segfault At Address: [0x%X][0x%X][%i][0x%X] Non Mapped\n", memAddr, esp, _current->id, eip); spinUnlock(&pageFaultSpinLock); endTask(_current->id); - } else if (memAddr < (_current->td.vm_dsize + _current->td.vm_daddr)) { -kprintf("THIS IS BAD"); + } + else if (memAddr < (_current->td.vm_dsize + _current->td.vm_daddr)) { + kprintf("THIS IS BAD"); pageTable[pageTableIndex] = (uInt32) vmm_findFreePage(_current->id) | PAGE_DEFAULT; - } else { + } + else { spinUnlock(&pageFaultSpinLock); /* Need To Create A Routine For Attempting To Access Non Mapped Memory */ kprintf("pageDir: [0x%X]\n", pageDir[pageDirectoryIndex]); @@ -130,13 +133,13 @@ } } asm volatile( - "movl %cr3,%eax\n" - "movl %eax,%cr3\n" + "movl %cr3,%eax\n" + "movl %eax,%cr3\n" ); /* Release the spin lock */ spinUnlock(&pageFaultSpinLock); -kprintf("CR2-RET"); + kprintf("CR2-RET"); return; } diff --git a/sys/vmm/paging.c b/sys/vmm/paging.c index e565c14..c8e173d 100644 --- a/sys/vmm/paging.c +++ b/sys/vmm/paging.c @@ -1,27 +1,29 @@ /*- - * Copyright (c) 2002-2004, 2016, 2017 The UbixOS Project + * 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: + * This was developed by Christopher W. Olsen for the UbixOS Project. * - * 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. + * 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 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. + * 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. */ #include @@ -206,7 +208,7 @@ perms = KERNEL_PAGE_DEFAULT; /* Set Pointer pageDirectory To Point To The Virtual Mapping Of The Page Directory */ - pageDir = (uint32_t *)PD_BASE_ADDR; + pageDir = (uint32_t *) PD_BASE_ADDR; /* Get Index Into The Page Directory */ destPageDirectoryIndex = PD_INDEX(dest); @@ -221,7 +223,7 @@ pageTable = (uint32_t *) (PT_BASE_ADDR + (PD_INDEX( PT_BASE_ADDR ) * 0x1000)); /* Table that maps that 4b */ pageTable[destPageDirectoryIndex] = (pageDir[destPageDirectoryIndex] & 0xFFFFF000) | PAGE_DEFAULT; /* Is This Why Page Needs To Be User As Well? */ - pageTable = (uint32_t *)(PT_BASE_ADDR + (destPageDirectoryIndex * 0x1000)); + pageTable = (uint32_t *) (PT_BASE_ADDR + (destPageDirectoryIndex * 0x1000)); /* Need To Figure Out invlpg */ asm volatile( diff --git a/sys/vmm/setpageattributes.c b/sys/vmm/setpageattributes.c index ccb690c..894e626 100644 --- a/sys/vmm/setpageattributes.c +++ b/sys/vmm/setpageattributes.c @@ -1,71 +1,70 @@ -/***************************************************************************************** - Copyright (c) 2002 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: setpageattributes.c 188 2016-01-23 03:09:10Z reddawg $ - -*****************************************************************************************/ +/*- + * 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. + */ #include #include /************************************************************************ -Function: void vmmSetPageAttributes(uInt32 pageAddr,int attributes; -Description: This Function Will Set The Page Attributes Such As - A Read Only Page, Stack Page, COW Page, ETC. -Notes: + Function: void vmmSetPageAttributes(uInt32 pageAddr,int attributes; + Description: This Function Will Set The Page Attributes Such As + A Read Only Page, Stack Page, COW Page, ETC. + Notes: -************************************************************************/ -int vmm_setPageAttributes(uInt32 memAddr,uInt16 attributes) { - uInt16 directoryIndex = 0x0, tableIndex = 0x0; - uInt32 *pageTable = 0x0; + ************************************************************************/ +int vmm_setPageAttributes(uInt32 memAddr, uInt16 attributes) { + uInt16 directoryIndex = 0x0, tableIndex = 0x0; + uInt32 *pageTable = 0x0; /* Calculate The Page Directory Index */ directoryIndex = (memAddr >> 22); - + /* Calculate The Page Table Index */ tableIndex = ((memAddr >> 12) & 0x3FF); /* Set Table Pointer */ if ((pageTable = (uInt32 *) (PT_BASE_ADDR + (0x1000 * directoryIndex))) == 0x0) - kpanic("Error: pageTable == NULL, File: %s, Line: %i\n",__FILE__,__LINE__); - + kpanic("Error: pageTable == NULL, File: %s, Line: %i\n", __FILE__, __LINE__); + /* Set Attribute If Page Is Mapped */ if (pageTable[tableIndex] != 0x0) pageTable[tableIndex] = ((pageTable[tableIndex] & 0xFFFFF000) | attributes); /* Reload The Page Table; */ asm volatile( - "push %eax \n" - "movl %cr3,%eax\n" - "movl %eax,%cr3\n" - "pop %eax \n" - ); + "push %eax \n" + "movl %cr3,%eax\n" + "movl %eax,%cr3\n" + "pop %eax \n" + ); /* Return */ - return(0x0); - } + return (0x0); +} /*** $Log: setpageattributes.c,v $ @@ -80,9 +79,9 @@ Revision 1.4 2004/07/28 15:05:43 reddawg Major: - Pages now have strict security enforcement. - Many null dereferences have been resolved. - When apps loaded permissions set for pages rw and ro + Pages now have strict security enforcement. + Many null dereferences have been resolved. + When apps loaded permissions set for pages rw and ro Revision 1.3 2004/07/20 22:29:55 reddawg assert: remade assert diff --git a/sys/vmm/unmappage.c b/sys/vmm/unmappage.c index 4282e1e..b89ddc0 100644 --- a/sys/vmm/unmappage.c +++ b/sys/vmm/unmappage.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - 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: unmappage.c 188 2016-01-23 03:09:10Z reddawg $ - - *****************************************************************************************/ +/*- + * 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. + */ #include diff --git a/sys/vmm/vmm_init.c b/sys/vmm/vmm_init.c index 24ea4ae..379bff4 100644 --- a/sys/vmm/vmm_init.c +++ b/sys/vmm/vmm_init.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - Copyright (c) 2002-2004, 2016 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: vmm_init.c 54 2016-01-11 01:29:55Z reddawg $ - - *****************************************************************************************/ +/*- + * 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. + */ #include #include diff --git a/sys/vmm/vmm_memory.c b/sys/vmm/vmm_memory.c index 0d80c52..4db1487 100644 --- a/sys/vmm/vmm_memory.c +++ b/sys/vmm/vmm_memory.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - Copyright (c) 2002-2004, 2016 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: vmm_memory.c 230 2016-01-24 01:36:51Z reddawg $ - - *****************************************************************************************/ +/*- + * 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. + */ #include #include diff --git a/sys/vmm/vmm_mmap.c b/sys/vmm/vmm_mmap.c index 158be12..f42b57a 100644 --- a/sys/vmm/vmm_mmap.c +++ b/sys/vmm/vmm_mmap.c @@ -1,31 +1,30 @@ -/***************************************************************************************** - Copyright (c) 2002 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: getfreepage.c 54 2016-01-11 01:29:55Z reddawg $ - - *****************************************************************************************/ +/*- + * 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. + */ #include #include @@ -36,8 +35,8 @@ #include /* MrOlsen (2016-01-15) TEMP: Put These somewhere else */ -typedef __uint32_t __vm_size_t; -typedef __vm_size_t vm_size_t; +typedef __uint32_t __vm_size_t; typedef __vm_size_t +vm_size_t; #define EINVAL 22 /* Invalid argument */ #define MAP_ALIGNED(n) ((n) << MAP_ALIGNMENT_SHIFT) #define MAP_ALIGNMENT_SHIFT 24 @@ -118,7 +117,8 @@ if (flags & MAP_FIXED) { kprintf("FIXED NOT SUPPORTED YET"); return (EINVAL); - } else { + } + else { /* At Some Point I Need To Proc Lock Incase It's Threaded */ /* MrOlsen (2016-01-15) Temporary comment out if ( addr == 0 || (addr >= round_page( (vm_offset_t) vms->vm_taddr ) && addr < round_page( (vm_offset_t) vms->vm_daddr + lim_max( td->td_proc, RLIMIT_DATA ) )) ) @@ -142,7 +142,8 @@ K_PANIC("remap Failed"); } kprintf("td->vm_dsize should be adjust but isn't"); - } else { + } + else { /* Mapping File */ kprintf("File Mapping Not Supported Yet"); return (EINVAL); @@ -161,7 +162,7 @@ if (uap->addr != 0x0) { kprintf("Address hints are not supported yet.\n"); td->td_retval[0] = 0x0; - return(-1); + return (-1); } if (uap->fd == -1) { diff --git a/tools/format.c b/tools/format.c index 8de1291..afc82c5 100644 --- a/tools/format.c +++ b/tools/format.c @@ -1,3 +1,31 @@ +/*- + * 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. + */ + #include #include #include @@ -7,150 +35,149 @@ #define typeContainer 2 #define typeDirectory 4 - //Michelle My Bell struct blockAllocationTableEntry *BAT = 0x0; -int findFreeBlock(int cBlock,int size) { +int findFreeBlock(int cBlock, int size) { int i = 0x0; - for (i=1;isize = (size/512); - partInfo->startSector = (startSector+1); - partInfo->blockAllocationTable = (startSector+1); - partInfo->rootDirectory = ((startSector+1) + (batSize/512)); - partInfo->rootDirectorySize = 0x4000/512; - fseek(driveFd,(startSector * 512),0); - fwrite(partInfo,512,1,driveFd); + structSize *= (size / 4096); + batSize = (((structSize + 511) / 512) * 512); + BAT = (struct blockAllocationTableEntry *) malloc(structSize); + dirEntry = (struct directoryEntry *) malloc(0x4000); + memset(dirEntry, 0x0, 0x4000); + partInfo = (struct partitionInformation *) malloc(512); + partInfo->size = (size / 512); + partInfo->startSector = (startSector + 1); + partInfo->blockAllocationTable = (startSector + 1); + partInfo->rootDirectory = ((startSector + 1) + (batSize / 512)); + partInfo->rootDirectorySize = 0x4000 / 512; + fseek(driveFd, (startSector * 512), 0); + fwrite(partInfo, 512, 1, driveFd); startSector++; - dirEntry[0].attributes = typeDirectory; - dirEntry[0].permissions = 0xEAA; - dirEntry[0].gid = 0x0; - dirEntry[0].uid = 0x0; + dirEntry[0].attributes = typeDirectory; + dirEntry[0].permissions = 0xEAA; + dirEntry[0].gid = 0x0; + dirEntry[0].uid = 0x0; dirEntry[0].startCluster = 0x0; - dirEntry[0].size = 0x4000; - sprintf(dirEntry[0].fileName,"/"); - dirEntry[1].attributes = typeDirectory; - dirEntry[1].permissions = 0xEAA; - dirEntry[1].gid = 0x0; - dirEntry[1].uid = 0x0; + dirEntry[0].size = 0x4000; + sprintf(dirEntry[0].fileName, "/"); + dirEntry[1].attributes = typeDirectory; + dirEntry[1].permissions = 0xEAA; + dirEntry[1].gid = 0x0; + dirEntry[1].uid = 0x0; dirEntry[1].startCluster = 0x0; - dirEntry[1].size = 0x4000; - sprintf(dirEntry[1].fileName,".."); - BAT[0].nextBlock = 0x1; + dirEntry[1].size = 0x4000; + sprintf(dirEntry[1].fileName, ".."); + BAT[0].nextBlock = 0x1; BAT[0].attributes = 1; - BAT[0].realSector = (batSize/512); - BAT[1].nextBlock = 0x2; + BAT[0].realSector = (batSize / 512); + BAT[1].nextBlock = 0x2; BAT[1].attributes = 1; - BAT[1].realSector = ((batSize/512) + 1 * 8); - BAT[2].nextBlock = 0x3; + BAT[1].realSector = ((batSize / 512) + 1 * 8); + BAT[2].nextBlock = 0x3; BAT[2].attributes = 1; - BAT[2].realSector = ((batSize/512) + 2 * 8); - BAT[3].nextBlock = -1; + BAT[2].realSector = ((batSize / 512) + 2 * 8); + BAT[3].nextBlock = -1; BAT[3].attributes = 1; - BAT[3].realSector = ((batSize/512) + 3 * 8); - - for (i=4;i<(size/4096);i++) { - BAT[i].nextBlock = -1; + BAT[3].realSector = ((batSize / 512) + 3 * 8); + + for (i = 4; i < (size / 4096); i++) { + BAT[i].nextBlock = -1; BAT[i].attributes = 0x0; - BAT[i].realSector = ((batSize/512) + (i*8)); - BAT[i].reserved = 0x0; - } + BAT[i].realSector = ((batSize / 512) + (i * 8)); + BAT[i].reserved = 0x0; + } file = 0x2; while (x < argc) { counter = 0x0; blockCount = 0x0; - fileFd = fopen(argv[x],"rb"); - block = findFreeBlock(-1,(size/4096)); + fileFd = fopen(argv[x], "rb"); + block = findFreeBlock(-1, (size / 4096)); dirEntry[file].startCluster = block; - dirEntry[file].attributes = typeFile; - dirEntry[file].permissions = atoi(argv[x+1]); + dirEntry[file].attributes = typeFile; + dirEntry[file].permissions = atoi(argv[x + 1]); rewind(driveFd); /* fseek(driveFd,((BAT[startSector].realSector * 512) + ((batSize/512)+(BAT[block].realSector*4096))),0); */ - fseek(driveFd,((startSector + BAT[block].realSector) * 512),0); + fseek(driveFd, ((startSector + BAT[block].realSector) * 512), 0); while (!feof(fileFd)) { if (4096 == (counter - (blockCount * 4096))) { - block = findFreeBlock(block,(size/4096)); - printf("Block: [%i][%s]\n",block,argv[x]); + block = findFreeBlock(block, (size / 4096)); + printf("Block: [%i][%s]\n", block, argv[x]); rewind(driveFd); /* fseek(driveFd,((startSector * 512) + ((batSize/512)+(BAT[block].realSector*4096))),0); */ - fseek(driveFd,((startSector + BAT[block].realSector) * 512),0); + fseek(driveFd, ((startSector + BAT[block].realSector) * 512), 0); blockCount++; - } - fputc(fgetc(fileFd),driveFd); + } + fputc(fgetc(fileFd), driveFd); counter++; - } + } i = 0; - while((counter + i)%512) { - fputc(0x0,driveFd); + while ((counter + i) % 512) { + fputc(0x0, driveFd); i++; - } + } fclose(fileFd); dirEntry[file].size = (counter - 1); - dirEntry[file].uid = 0x0; - dirEntry[file].gid = 0x0; - sprintf(dirEntry[file].fileName,"%s",argv[x]); + dirEntry[file].uid = 0x0; + dirEntry[file].gid = 0x0; + sprintf(dirEntry[file].fileName, "%s", argv[x]); x += 2; file++; - } - dirEntry[1].attributes = typeDirectory; - dirEntry[1].permissions = 0xEAA; - dirEntry[1].gid = 0x0; - dirEntry[1].uid = 0x0; + } + dirEntry[1].attributes = typeDirectory; + dirEntry[1].permissions = 0xEAA; + dirEntry[1].gid = 0x0; + dirEntry[1].uid = 0x0; dirEntry[1].startCluster = 0x0; - dirEntry[1].size = 0x4000; - sprintf(dirEntry[1].fileName,"fakeDir"); - rewind(driveFd); - fseek(driveFd,(long)(((startSector) * 512) + batSize),0); - fwrite(dirEntry,0x4000,1,driveFd); + dirEntry[1].size = 0x4000; + sprintf(dirEntry[1].fileName, "fakeDir"); rewind(driveFd); - fseek(driveFd,((startSector) * 512),0); - if (fwrite(BAT,batSize,1,driveFd) >= 1) { -/* - * printf("size [%i]\n",partInfo->size); - * printf("startSector: [%i]\n",partInfo->startSector); - * printf("bat: [%i]\n",partInfo->blockAllocationTable); - * printf("rootDir: [%i]\n",partInfo->rootDirectory); - * printf("sizeof: [%i]\n",sizeof(struct blockAllocationTableEntry)); - * printf("size: [%i]\n",(size/4096)); - */ + fseek(driveFd, (long) (((startSector) * 512) + batSize), 0); + fwrite(dirEntry, 0x4000, 1, driveFd); + rewind(driveFd); + fseek(driveFd, ((startSector) * 512), 0); + if (fwrite(BAT, batSize, 1, driveFd) >= 1) { + /* + * printf("size [%i]\n",partInfo->size); + * printf("startSector: [%i]\n",partInfo->startSector); + * printf("bat: [%i]\n",partInfo->blockAllocationTable); + * printf("rootDir: [%i]\n",partInfo->rootDirectory); + * printf("sizeof: [%i]\n",sizeof(struct blockAllocationTableEntry)); + * printf("size: [%i]\n",(size/4096)); + */ printf("Formatted!\n"); - } + } else { printf("Error Formatting!!\n"); - } - fclose(driveFd); - return(0); } + fclose(driveFd); + return (0); +} diff --git a/tools/makeuser.c b/tools/makeuser.c index 2214c3d..5041dd7 100644 --- a/tools/makeuser.c +++ b/tools/makeuser.c @@ -1,53 +1,81 @@ +/*- + * 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. + */ + #include #include struct passwd { char username[32]; char passwd[32]; - int uid; - int gid; + int uid; + int gid; char shell[128]; char realname[256]; char path[256]; - }; +}; -int main(int argc,char **argv) { +int main(int argc, char **argv) { int i = 0x0; struct passwd *password = 0x0; FILE *out; - password = (struct passwd *)malloc(4096); - out = fopen("./userdb","wbb"); - sprintf(password[0].username,"root"); - sprintf(password[0].passwd,"user"); - sprintf(password[0].shell,"sys:/bin/shell"); - sprintf(password[0].realname,"Root User"); - sprintf(password[0].path,"root"); + password = (struct passwd *) malloc(4096); + out = fopen("./userdb", "wbb"); + sprintf(password[0].username, "root"); + sprintf(password[0].passwd, "user"); + sprintf(password[0].shell, "sys:/bin/shell"); + sprintf(password[0].realname, "Root User"); + sprintf(password[0].path, "root"); password[0].uid = 0; password[0].gid = 0; - sprintf(password[1].username,"guest"); - sprintf(password[1].passwd,"user"); - sprintf(password[1].shell,"sys:/bin/shell"); - sprintf(password[1].realname,"Guest User"); - sprintf(password[1].path,"guest"); + sprintf(password[1].username, "guest"); + sprintf(password[1].passwd, "user"); + sprintf(password[1].shell, "sys:/bin/shell"); + sprintf(password[1].realname, "Guest User"); + sprintf(password[1].path, "guest"); password[1].uid = 1; password[1].gid = 1; - sprintf(password[2].username,"reddawg"); - sprintf(password[2].passwd,"temp123"); - sprintf(password[2].shell,"sys:/bin/shell"); - sprintf(password[2].realname,"Christopher"); - sprintf(password[2].path,"reddawg"); + sprintf(password[2].username, "reddawg"); + sprintf(password[2].passwd, "temp123"); + sprintf(password[2].shell, "sys:/bin/shell"); + sprintf(password[2].realname, "Christopher"); + sprintf(password[2].path, "reddawg"); password[2].uid = 1000; password[2].gid = 1000; - fwrite(password,4096,1,out); + fwrite(password, 4096, 1, out); fclose(out); - for (i=0;i<3;i++) { - printf("User: [%s]\n",password[i].username); - printf("Pass: [%s]\n",password[i].passwd); - printf("UID: [%i]\n",password[i].uid); - printf("GID: [%i]\n",password[i].gid); - printf("Shell: [%s]\n",password[i].shell); - printf("Name: [%s]\n",password[i].realname); - printf("Path: [%s]\n",password[i].path); - } - return(0); + for (i = 0; i < 3; i++) { + printf("User: [%s]\n", password[i].username); + printf("Pass: [%s]\n", password[i].passwd); + printf("UID: [%i]\n", password[i].uid); + printf("GID: [%i]\n", password[i].gid); + printf("Shell: [%s]\n", password[i].shell); + printf("Name: [%s]\n", password[i].realname); + printf("Path: [%s]\n", password[i].path); } + return (0); +} diff --git a/tools/test.c b/tools/test.c index 1d320c9..a7cd2cb 100644 --- a/tools/test.c +++ b/tools/test.c @@ -1,6 +1,32 @@ +/*- + * 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. + */ #include - -int main(int argc,char **argv) { +int main(int argc, char **argv) { printf("A\n"); - } +} diff --git a/tools/ubixfs.h b/tools/ubixfs.h index bda471c..3607158 100644 --- a/tools/ubixfs.h +++ b/tools/ubixfs.h @@ -1,78 +1,82 @@ -/************************************************************************************** - Copyright (c) 2002 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: ubixfs.h 89 2016-01-12 00:20:40Z reddawg $ - -**************************************************************************************/ +/*- + * 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 _UBIXFS_H #define _UBIXFS_H -typedef unsigned long uLong; +typedef unsigned long uLong; typedef unsigned short uShort; -typedef unsigned char uChar; -typedef unsigned int uInt; +typedef unsigned char uChar; +typedef unsigned int uInt; //Partition Information struct partitionInformation { - uLong size; //Size In Sectors - uLong startSector; //Base Sector Of Partition - uLong blockAllocationTable; //Base Sector Of BAT - uLong rootDirectory; //Base Sector Of Root Directory - uLong rootDirectorySize; /* Size In Sectors Of Root Directory */ - }; + uLong size; //Size In Sectors + uLong startSector; //Base Sector Of Partition + uLong blockAllocationTable; //Base Sector Of BAT + uLong rootDirectory; //Base Sector Of Root Directory + uLong rootDirectorySize; /* Size In Sectors Of Root Directory */ +}; //Block Allocation Table Entry struct blockAllocationTableEntry { - long attributes; //Block Attributes - long realSector; //Real Sector - long nextBlock; //Sector Of Next Block - long reserved; //Reserved - }; + long attributes; //Block Attributes + long realSector; //Real Sector + long nextBlock; //Sector Of Next Block + long reserved; //Reserved +}; //UbixFS Directory Entry struct directoryEntry { - uLong startCluster; //Starting Cluster Of File - uLong size; //Size Of File - uLong creationDate; //Date Created - uLong lastModified; //Date Last Modified - uLong uid; //UID Of Owner - uLong gid; //GID Of Owner - uShort attributes; //Files Attributes - uShort permissions; //Files Permissions - char fileName[256]; //File Name - }; - + uLong startCluster; //Starting Cluster Of File + uLong size; //Size Of File + uLong creationDate; //Date Created + uLong lastModified; //Date Last Modified + uLong uid; //UID Of Owner + uLong gid; //GID Of Owner + uShort attributes; //Files Attributes + uShort permissions; //Files Permissions + char fileName[256]; //File Name +}; struct bootSect { - uChar jmp[4]; - uChar id[6]; - uShort version; - uShort tmp; - uShort fsStart; - uShort tmp2; - uLong krnl_start; - uInt BytesPerSector; - uInt SectersPerTrack; - uInt TotalHeads; - uLong TotalSectors; - uChar code[479]; - }; + uChar jmp[4]; + uChar id[6]; + uShort version; + uShort tmp; + uShort fsStart; + uShort tmp2; + uLong krnl_start; + uInt BytesPerSector; + uInt SectersPerTrack; + uInt TotalHeads; + uLong TotalSectors; + uChar code[479]; +}; #endif diff --git a/tools/user.c b/tools/user.c index 3004172..0ebfa79 100644 --- a/tools/user.c +++ b/tools/user.c @@ -1,32 +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. + */ + #include #include struct passwd { char username[32]; char passwd[32]; - int uid; - int gid; + int uid; + int gid; char shell[128]; char realname[256]; char path[256]; - }; +}; -int main(int argc,char **argv) { +int main(int argc, char **argv) { int i = 0x0; struct passwd *password = 0x0; FILE *in; - password = (struct passwd *)malloc(4096); - in = fopen("./userdb","rb"); - fread(password,4096,1,in); + password = (struct passwd *) malloc(4096); + in = fopen("./userdb", "rb"); + fread(password, 4096, 1, in); fclose(in); - for (i=0;i<3;i++) { - printf("User: [%s]\n",password[i].username); - printf("Pass: [%s]\n",password[i].passwd); - printf("UID: [%i]\n",password[i].uid); - printf("GID: [%i]\n",password[i].gid); - printf("Shell: [%s]\n",password[i].shell); - printf("Name: [%s]\n",password[i].realname); - printf("Path: [%s]\n",password[i].path); - } - return(0); + for (i = 0; i < 3; i++) { + printf("User: [%s]\n", password[i].username); + printf("Pass: [%s]\n", password[i].passwd); + printf("UID: [%i]\n", password[i].uid); + printf("GID: [%i]\n", password[i].gid); + printf("Shell: [%s]\n", password[i].shell); + printf("Name: [%s]\n", password[i].realname); + printf("Path: [%s]\n", password[i].path); } + return (0); +}