/***************************************************************************************** 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$ *****************************************************************************************/ #include <ubixos/init.h> #include <sys/gdt.h> #include <sys/video.h> #include <sys/tss.h> #include <ubixos/exec.h> #include <ubixos/kpanic.h> #include <ubixos/systemtask.h> #include <vfs/mount.h> #include <lib/kprintf.h> #include <lib/kmalloc.h> #include <assert.h> /***************************************************************************************** Desc: The Kernels Descriptor table: 0x00 - Dummy Entry 0x08 - Ring 0 CS 0x10 - Ring 0 DS 0x18 - Dummy LDT 0x20 - Scheduler TSS 0x28 - Ring 3 CS 0x30 - Ring 3 DS 0x38 - GPF TSS 0x40 - Stack Fault TSS Notes: *****************************************************************************************/ ubixDescriptorTable(ubixGDT,9) { {dummy:0}, ubixStandardDescriptor(0x0, 0xFFFFF, (dCode + dRead + dBig + dBiglim)), ubixStandardDescriptor(0x0, 0xFFFFF, (dData + dWrite + dBig + dBiglim)), ubixStandardDescriptor(0x0, 0xFFFFF, (dLdt)), ubixStandardDescriptor(0x4200, (sizeof(struct tssStruct)), (dTss + dDpl3)), ubixStandardDescriptor(0x0, 0xFFFFF, (dCode + dWrite + dBig + dBiglim + dDpl3)), ubixStandardDescriptor(0x0, 0xFFFFF, (dData + dWrite + dBig + dBiglim + dDpl3)), ubixStandardDescriptor(0x4200, (sizeof(struct tssStruct)), (dTss)), ubixStandardDescriptor(0x6200, (sizeof(struct tssStruct)), (dTss)), }; struct { unsigned short limit __attribute__ ((packed)); union descriptorTableUnion *gdt __attribute__ ((packed)); } loadGDT = { (9 * sizeof(union descriptorTableUnion) - 1), ubixGDT }; /***************************************************************************************** Functoin: int main() Desc: This is the entry point into the os where all of the kernels sub systems are started up. Notes: *****************************************************************************************/ int main() { int i = 0x0; /* Do A Clear Screen Just To Make The TEXT Buffer Nice And Empty */ clearScreen(); /* Modify src/sys/include/ubixos/init.h to add a startup routine */ for (i=0x0;i<init_tasksTotal;i++) { assert(init_tasks[i]); if (init_tasks[i]() != 0x0) { kpanic("Error: Initializing System.\n"); } } /* Do our mounting */ if (vfs_mount(0x0,0x0,0x0,0x0,"sys","rw") != 0x0) { kprintf("Problem Mounting sys Mount Point\n"); } if (vfs_mount(0x0,0x0,0x1,0x0,"tmp","rw") != 0x0) { kprintf("Problem Mounting tmp Mount Point\n"); } /* if (vfs_mount(0x1,0x1,0x0,0x0,"hd","rw") != 0x0) { kprintf("Problem Mounting HD Mount Point\n"); } */ initHardDisk(); /* Initialize the system */ //kprintf("0"); execThread(systemTask,(kmalloc(0x2000)+0x2000),0x0); //kprintf("1"); execFile("sys:/init",0x0,0x0,0x1); /* execFile("sys:/login",0x0,0x0,0x1); */ //kprintf("2"); execFile("sys:/login",0x0,0x0,0x2); //kprintf("3"); execFile("sys:/login",0x0,0x0,0x3); //kprintf("4"); execFile("sys:/login",0x0,0x0,0x4); kprintf("Free Pages: [%i]\n",systemVitals->freePages); kprintf("MemoryMap: [0x%X]\n",vmmMemoryMap); kprintf("Starting Os\n"); irqEnable(0x0); while (0x1) asm("nop"); return(0x0); } /*** $Log$ Revision 1.85 2004/09/14 21:51:24 reddawg Debug info Revision 1.84 2004/09/11 12:26:07 reddawg We now initialize all needed daemons Revision 1.83 2004/09/11 12:11:11 reddawg Cleaning up the VFS more changes to follow... Revision 1.82 2004/09/07 21:54:38 reddawg ok reverted back to old scheduling for now.... Revision 1.81 2004/09/07 20:58:35 reddawg time to roll back i can't think straight by friday Revision 1.80 2004/09/06 15:13:25 reddawg Last commit before FreeBSD 6.0 Revision 1.79 2004/08/25 22:02:41 reddawg task switching - We now are using software switching to be consistant with the rest of the world because all of this open source freaks gave me a hard time about something I liked. There doesn't seem to be any gain in performance but it is working fine and flawlessly Revision 1.78 2004/08/24 23:33:45 reddawg Fixed Revision 1.77 2004/08/24 05:24:37 reddawg TCA Is A BONER!!!! Revision 1.76 2004/08/21 23:47:50 reddawg *** empty log message *** Revision 1.75 2004/08/21 20:06:28 reddawg ok check out exec.c Revision 1.74 2004/08/21 17:36:57 reddawg updates: converted to software task switching however it is not working yet Revision 1.73 2004/08/15 00:33:02 reddawg Wow the ide driver works again Revision 1.72 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.71 2004/08/14 11:23:02 reddawg Changes Revision 1.70 2004/08/09 12:58:05 reddawg let me know when you got the surce Revision 1.69 2004/08/06 22:43:04 reddawg ok Revision 1.68 2004/08/04 08:17:57 reddawg tty: we have primative ttys try f1-f5 so it is easier to use and debug ubixos Revision 1.67 2004/08/03 18:31:19 reddawg virtual terms Revision 1.66 2004/08/03 00:05:52 reddawg com cvs comi comi cvs comiits sc sfix fb bug Revision 1.65 2004/07/29 21:32:16 reddawg My quick lunchs breaks worth of updates.... Revision 1.64 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. Things affected: malloc,kmalloc,getfreepage,getfreevirtualpage,pagefault,fork,exec,ld,ld.so,exec,file Revision 1.63 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.62 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.61 2004/07/21 23:05:05 reddawg last round of fixed main.c: removed kernel stack start.S: added kernel stack thanks to tip off from BJ about .comm init.h: re-enabled ipStack Revision 1.60 2004/07/21 22:01:24 reddawg Fixed Revision 1.59 2004/07/21 21:37:04 reddawg Changed startup code Revision 1.58 2004/07/20 19:43:37 reddawg *** empty log message *** Revision 1.57 2004/07/19 02:08:28 reddawg Cleaned out the rest of debuging code also temporarily disabled the ip stack to improve boot time Revision 1.56 2004/07/17 15:54:52 reddawg kmalloc: added assert() bioscall: fixed some potential problem by not making 16bit code paging: added assert() Revision 1.55 2004/07/17 03:38:38 reddawg Going to laptop to finish up Revision 1.54 2004/07/17 02:38:31 reddawg Fixed a few problems Revision 1.53 2004/07/14 12:49:42 reddawg Fixed a typo missing a > on #include <sde/sde.h Revision 1.52 2004/07/14 12:42:46 reddawg fdc: fdcInit to fdc_init Changed Startup Routines Revision 1.49 2004/07/14 12:03:50 reddawg ne2k: ne2kInit to ne2k_init Changed Startup Routines Revision 1.48 2004/07/14 02:25:40 reddawg net: netInit to net_init Changed startup routines Revision 1.47 2004/07/09 13:37:30 reddawg time: timeInit to time_init Adjusted initialization routines Revision 1.39 2004/07/09 12:31:15 reddawg Updating Initialization Procedures Revision 1.38 2004/07/09 12:18:19 reddawg Updating Initialization Procedures Revision 1.36 2004/07/08 02:47:36 reddawg Tuuned afew things adding ufs support to ubixos Revision 1.35 2004/06/28 23:12:58 reddawg file format now container:/path/to/file Revision 1.34 2004/06/25 17:25:52 reddawg I am cleaning too Revision 1.33 2004/06/25 13:16:23 reddawg Made kernel stack static to prevent corruptions Revision 1.32 2004/06/04 17:33:33 reddawg Changed idle task to system task Revision 1.31 2004/06/04 10:19:42 reddawg notes: we compile again, thank g-d anyways i was about to cry Revision 1.30 2004/05/25 18:38:55 reddawg Removed sample code Revision 1.29 2004/05/25 15:50:43 reddawg mpiSpam() test Revision 1.28 2004/05/23 01:10:35 reddawg Fixes: Started to fix re-entrancy issues many more to look into Revision 1.27 2004/05/21 21:15:04 reddawg Fixed a few bugs which prevented the system from loadin Revision 1.26 2004/05/20 22:54:02 reddawg Cleaned Up Warrnings Revision 1.25 2004/05/19 17:28:28 reddawg Added the correct endTask Procedure Revision 1.24 2004/05/19 04:07:42 reddawg kmalloc(size,pid) no more it is no kmalloc(size); the way it should of been Revision 1.23 2004/05/19 03:35:02 reddawg Fixed A Few Ordering Issues In The Service Startup Routine Revision 1.22 2004/05/19 01:21:29 reddawg Tweaked Revision 1.21 2004/05/18 10:45:41 reddawg Bug Fix Revision 1.20 2004/05/10 02:23:24 reddawg Minor Changes To Source Code To Prepare It For Open Source Release Revision 1.19 2004/05/08 19:06:24 reddawg Going to impliment FSTAB Revision 1.18 2004/05/04 23:38:24 reddawg make clean all install Revision 1.17 2004/05/04 23:31:01 reddawg Ok Mark Cleaned Up Boot This Revision 1.16 2004/05/02 14:34:21 reddawg SMP Support Thanks To Some Help From Slowcoder now to make it interface well with the rest of the kernel Revision 1.15 2004/04/30 17:04:23 reddawg Ok GUI is back on Revision 1.14 2004/04/30 16:58:37 reddawg Turned On PCI Detections Revision 1.13 2004/04/30 16:29:34 reddawg Turned Off Gui Revision 1.12 2004/04/30 13:40:34 reddawg Just doing spring cleaning for the new members Revision 1.7 2004/04/26 22:27:36 reddawg Now mounts our harddrive I need to either impliment fstab or do something similar Revision 1.6 2004/04/25 04:35:50 reddawg Minor bug fixes to set default partition information Revision 1.107 2004/04/13 16:36:33 reddawg Changed our copyright, it is all now under a BSD-Style license END ***/