/**************************************************************************************
Copyright (c) 2002 The UbixOS Project
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are prohibited.
$Id$
**************************************************************************************/
#include <ubixos/gdt.h>
#include <ubixos/schedule.h>
#include <ubixos/idt.h>
#include <ubixos/exec.h>
#include <ubixos/idlethread.h>
#include <drivers/video.h>
#include <drivers/8259.h>
#include <drivers/keyboard.h>
#include <drivers/fdc.h>
#include <version/version.h>
#include <vmm/paging.h>
#include <ubixfs/ubixfs.h>
#include <ubixfs/file.h>
int testVal=0;
descriptorTable(GDT,5) {
{dummy:0},
standardDescriptor(0, 0xFFFFF, (dCode + dRead + dBig + dBiglim)),
standardDescriptor(0, 0xFFFFF, (dData + dWrite + dBig + dBiglim)),
standardDescriptor(0, 0xFFFFF, (dLdt)),
standardDescriptor(100000, (sizeof(struct tssStruct)-1), (dTss)),
};
struct {
unsigned short limit __attribute__ ((packed));
union descriptorTableunion *gdt __attribute__ ((packed));
} loadGdt = { (5 * sizeof(union descriptorTableunion) - 1), GDT };
int main();
void _start(void) {
countMemory();
asm(
"lgdtl (loadGdt) \n"
"movw $0x10,%ax \n"
"movw %ax,%ds \n"
"movw %ax,%es \n"
"movw %ax,%fs \n"
"movw %ax,%gs \n"
"movw %ax,%ss \n"
"movl $0xFFFF,%esp \n"
"mov $0x18,%ax \n" //Set up dummy LDT
"lldt %ax \n"
"mov $0x20,%ax \n" // Set up dummy TSS
"ltr %ax \n" // Loads dummy TSS
);
main(); //Start Of Kernel Functionality
while(1);
}
int test() {
// disableIrq(0);
// execFile("shell");
// enableIrq(0);
while (1) {
kprintf("Kernel Test Thread\n");
}
}
int main() {
clearScreen();
outputVersion(); //Display Version Info
init8259(); //Initialize PIC
initIdt(); //Initialize IDT
initPaging(); //Initialize Paging System
initMmap(); //Initialize Memory Map
initKeyboard(); //Initialize Keyboard
initScheduler(); //Initialize Scheduler
initFloppy(); //Initialize Floppy Controller
initUbixFS();
execThread(idleThread,0xBFFF,"Idle Thread");
execThread(test,0xAFFF,"test");
execFile("shell");
//execThread(test,0xCFFF,"Test");
/*
while(1) {
fd = fopen("COPYRIGHT",1);
while (ch != -1) {
ch = getFileByte(fd,i);
kprintf("%c",ch);
i++;
}
fclose(fd);
}
*/
enableIrq(0);
while (1);
}