main.c
ubixos/init.h
sys/gdt.h
sys/video.h
sys/tss.h
ubixos/exec.h
ubixos/kpanic.h
ubixos/systemtask.h
vfs/mount.h
lib/kprintf.h
lib/kmalloc.h
ufs/ufs.h
sys/thread.h
ubixos/kpanic.h
pci/pci.h
ubixos/sched.h
sys/device.old.h
isa/ne2k.h
devfs/devfs.h
ubixos/vitals.h
ubixos/systemtask.h
ubixos/types.h
sys/_types.h
sys/video.h
vmm/paging.h
ubixos/time.h
vfs/file.h
sys/tss.h
lib/kmalloc.h
sys/kern_sysctl.h
vmm/vmm.h
mpi/mpi.h
sys/idt.h
vfs/vfs.h
vfs/mount.h
lib/kprintf.h
src/sys/init/main.c
ubixfs/ubixfs.h
isa/atkbd.h
sys/gdt.h
net/net.h
isa/pit.h
ubixos/ubthread.h
ubixfs/dirCache.h
ubixos/exec.h
pci/hd.h
ubixos/init.h
isa/fdc.h
sys/sysproto.h
sys/signal.h
ubixos/tty.h
sys/io.h
isa/8259.h
ubixos/static.h
sys/device.h
B_ADAPTOR
val
(((val) >> B_ADAPTORSHIFT) & B_ADAPTORMASK)
kmain
B_ADAPTORMASK
0x0f
B_ADAPTORSHIFT
24
B_CONTROLLER
val
(((val)>>B_CONTROLLERSHIFT) & B_CONTROLLERMASK)
kmain
B_CONTROLLERMASK
0xf
B_CONTROLLERSHIFT
20
B_PARTITION
val
(((val) >> B_PARTITIONSHIFT) & B_PARTITIONMASK)
kmain
B_PARTITIONMASK
0xff
B_PARTITIONSHIFT
8
B_SLICE
val
(((val)>>B_SLICESHIFT) & B_SLICEMASK)
kmain
B_SLICEMASK
0xff
B_SLICESHIFT
20
B_TYPE
val
(((val) >> B_TYPESHIFT) & B_TYPEMASK)
kmain
B_TYPEMASK
0xff
B_TYPESHIFT
0
B_UNIT
val
(((val) >> B_UNITSHIFT) & B_UNITMASK)
kmain
B_UNITMASK
0xf
B_UNITSHIFT
16
int int kmain (uInt32 rootdev) kmain uInt32 rootdev

This is the entry point into the os where all of the kernels sub systems are started up.

rootdev

address of root device structure

B_ADAPTOR
B_CONTROLLER
B_PARTITION
B_SLICE
B_TYPE
B_UNIT
clearScreen
execFile
execThread
vitalsStruct::freePages
init_tasks
init_tasksTotal
irqEnable
kmalloc
kpanic
kprint
kprintf
NULL
systemTask
systemVitals
vfs_mount
vmmMemoryMap
x1
x2000
ubixDescriptorTable
(ubixGDT, 9)
ubixDescriptorTable
ubixGDT
9
dBig
dBiglim
dCode
dData
dDpl3
dLdt
dRead
dTss
dWrite
ubixStandardDescriptor
@2 struct @2 loadGDT loadGDT

    /*****************************************************************************************
    Copyright(c)2002-2004,2005TheUbixOSProject
    Allrightsreserved.

    Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are
    permittedprovidedthatthefollowingconditionsaremet:

    Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof
    conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary
    formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing
    disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided
    withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits
    contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware
    withoutspecificpriorwrittenpermission.

    THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY
    EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF
    MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL
    THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,
    SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT
    OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION)
    HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR
    TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS
    SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE.

    $Id: main_8c.xml 88 2016-01-12 00:11:29Z reddawg $

    *****************************************************************************************/

    #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>

    #defineB_ADAPTORSHIFT24
    #defineB_ADAPTORMASK0x0f
    #defineB_ADAPTOR(val)(((val)>>B_ADAPTORSHIFT)&B_ADAPTORMASK)
    #defineB_CONTROLLERSHIFT20
    #defineB_CONTROLLERMASK0xf
    #defineB_CONTROLLER(val)(((val)>>B_CONTROLLERSHIFT)&B_CONTROLLERMASK)
    #defineB_SLICESHIFT20
    #defineB_SLICEMASK0xff
    #defineB_SLICE(val)(((val)>>B_SLICESHIFT)&B_SLICEMASK)
    #defineB_UNITSHIFT16
    #defineB_UNITMASK0xf
    #defineB_UNIT(val)(((val)>>B_UNITSHIFT)&B_UNITMASK)
    #defineB_PARTITIONSHIFT8
    #defineB_PARTITIONMASK0xff
    #defineB_PARTITION(val)(((val)>>B_PARTITIONSHIFT)&B_PARTITIONMASK)
    #defineB_TYPESHIFT0
    #defineB_TYPEMASK0xff
    #defineB_TYPE(val)(((val)>>B_TYPESHIFT)&B_TYPEMASK)

    /*****************************************************************************************
    Desc:TheKernelsDescriptortable:
    0x00-DummyEntry
    0x08-Ring0CS
    0x10-Ring0DS
    0x18-DummyLDT
    0x20-SchedulerTSS
    0x28-Ring3CS
    0x30-Ring3DS
    0x38-GPFTSS
    0x40-StackFaultTSS

    Notes:

    *****************************************************************************************/
    ubixDescriptorTable(ubixGDT,9){
    {dummy:0},
    ubixStandardDescriptor(0x0000,0xFFFFF,(dCode+dRead+dBig+dBiglim)),
    ubixStandardDescriptor(0x0000,0xFFFFF,(dData+dWrite+dBig+dBiglim)),
    ubixStandardDescriptor(0x0000,0xFFFFF,(dLdt)),
    ubixStandardDescriptor(0x4200,(sizeof(structtssStruct)),(dTss+dDpl3)),
    ubixStandardDescriptor(0x0000,0xFFFFF,(dCode+dWrite+dBig+dBiglim+dDpl3)),
    ubixStandardDescriptor(0x0000,0xFFFFF,(dData+dWrite+dBig+dBiglim+dDpl3)),
    ubixStandardDescriptor(0x4200,(sizeof(structtssStruct)),(dTss)),
    ubixStandardDescriptor(0x6200,(sizeof(structtssStruct)),(dTss)),
    };
    struct{
    unsignedshortlimit__attribute__((packed));
    uniondescriptorTableUnion*gdt__attribute__((packed));
    }loadGDT={(9*sizeof(uniondescriptorTableUnion)-1),ubixGDT};

    intkmain(uInt32rootdev){
    /*Setupcounterforstartuproutine*/
    inti=0x0;
    uInt32*sysTask=0x0;

    /*DoAClearScreenJustToMakeTheTEXTBufferNiceAndEmpty*/
    clearScreen();
    kprint("AAA");
    kprint("BBB");
    kprintf("TEST");
    /*Modifysrc/sys/include/ubixos/init.htoaddastartuproutine*/
    for(i=0x0;i<init_tasksTotal;i++){
    if(init_tasks[i]()!=0x0){
    kpanic("Error:InitializingSystem.\n");
    }
    }

    /*NewRootMountPoint*/
    //Old2new10
    kprintf("[0xX][0x%X:0x%X:0x%X:0x%X:0x%X:0x%X]\n",B_ADAPTOR(rootdev),B_CONTROLLER(rootdev),B_SLICE(rootdev),B_UNIT(rootdev),B_PARTITION(rootdev),B_TYPE(rootdev));
    if(vfs_mount(0x1,B_PARTITION(rootdev)+2,0x0,0xAA,"sys","rw")!=0x0){
    kprintf("ProblemMountingsysMountPoint\n");
    }

    /*Doourmounting*/
    /*
    if(vfs_mount(0x0,0x0,0x0,0x0,"sys","rw")!=0x0){
    kprintf("ProblemMountingsysMountPoint\n");
    }
    if(vfs_mount(0x0,0x0,0x1,0x0,"tmp","rw")!=0x0){
    kprintf("ProblemMountingtmpMountPoint\n");
    }
    */

    /*Initializethesystem*/
    kprintf("FreePages:[%i]\n",systemVitals->freePages);

    kprintf("MemoryMap:[0x%X]\n",vmmMemoryMap);
    kprintf("StartingOS\n");

    sysTask=kmalloc(0x2000);
    if(sysTask==NULL)
    kprintf("OS:Unabletoallocatememory\n");

    execThread(systemTask,(uInt32)sysTask+0x2000,0x0);

    execFile("sys:/bin/init",0x0,0x0,0x0);/*OSInitializer*/

    irqEnable(0x0);

    while(0x1)
    asm("hlt");/*Keephaultinguntiltheschedulerreacts*/

    /*Returntostarthoweverweshouldnevergetthisfar*/
    return(0x0);
    }

    /***
    END
    ***/