2018-12-20 18:03:39 +01:00
|
|
|
//----------------------------------------------------------------------------//
|
|
|
|
// GNU GPL OS/K //
|
|
|
|
// //
|
2019-03-08 09:00:55 +01:00
|
|
|
// Desc: Kernel entry point //
|
2018-12-20 18:03:39 +01:00
|
|
|
// //
|
2019-02-16 23:36:33 +01:00
|
|
|
// //
|
|
|
|
// Copyright © 2018-2019 The OS/K Team //
|
|
|
|
// //
|
|
|
|
// This file is part of OS/K. //
|
|
|
|
// //
|
|
|
|
// OS/K is free software: you can redistribute it and/or modify //
|
|
|
|
// it under the terms of the GNU General Public License as published by //
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or //
|
|
|
|
// any later version. //
|
|
|
|
// //
|
|
|
|
// OS/K is distributed in the hope that it will be useful, //
|
|
|
|
// but WITHOUT ANY WARRANTY//without even the implied warranty of //
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
|
|
|
// GNU General Public License for more details. //
|
|
|
|
// //
|
|
|
|
// You should have received a copy of the GNU General Public License //
|
|
|
|
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. //
|
2018-12-20 18:03:39 +01:00
|
|
|
//----------------------------------------------------------------------------//
|
2019-03-18 17:25:44 +01:00
|
|
|
|
2020-01-12 16:53:23 +01:00
|
|
|
#include <mm/gdt.h>
|
|
|
|
#include <mm/map.h>
|
|
|
|
#include <mm/paging.h>
|
2019-05-29 14:34:37 +02:00
|
|
|
#include <mm/heap.h>
|
|
|
|
#include <ke/idt.h>
|
|
|
|
#include <ke/time.h>
|
|
|
|
#include <ke/cpuid.h>
|
2020-02-02 13:37:26 +01:00
|
|
|
#include <ke/sched.h>
|
2019-05-29 14:34:37 +02:00
|
|
|
#include <sh/shell.h>
|
|
|
|
#include <io/vga.h>
|
|
|
|
#include <io/keyb.h>
|
|
|
|
#include <io/cursor.h>
|
2020-02-02 13:33:57 +01:00
|
|
|
#include <io/acpi.h>
|
2019-05-29 14:34:37 +02:00
|
|
|
#include <po/shtdwn.h>
|
|
|
|
#include <init/boot.h>
|
2019-04-24 00:05:03 +02:00
|
|
|
|
2018-12-25 19:09:58 +01:00
|
|
|
//
|
2019-02-16 23:36:33 +01:00
|
|
|
// Entry point of the Kaleid kernel
|
2018-12-25 19:09:58 +01:00
|
|
|
//
|
2019-04-22 20:15:32 +02:00
|
|
|
noreturn void BtStartKern(multiboot_info_t *mbInfo, uint mbMagic, void *codeSeg)
|
2018-12-29 23:51:00 +01:00
|
|
|
{
|
2019-05-19 00:07:01 +02:00
|
|
|
KeDisableIRQs();
|
|
|
|
|
2019-03-29 14:19:29 +01:00
|
|
|
// Initialize the BootInfo_t structure
|
2019-04-22 20:15:32 +02:00
|
|
|
BtInitBootInfo(mbInfo, codeSeg);
|
2019-03-23 23:52:18 +01:00
|
|
|
|
2019-04-04 18:47:30 +02:00
|
|
|
// Screen I/O available from this point on
|
2019-03-29 14:19:29 +01:00
|
|
|
IoInitVGABuffer();
|
2019-04-21 21:18:13 +02:00
|
|
|
IoEnableCursor();
|
|
|
|
IoUpdateCursor(0, 0);
|
|
|
|
|
2019-05-19 00:07:01 +02:00
|
|
|
KernLog("%C%c%c%c OS/K\n\n%C",
|
|
|
|
VGA_COLOR_WHITE,
|
|
|
|
219,
|
|
|
|
219,
|
|
|
|
219,
|
|
|
|
VGA_COLOR_LIGHT_GREY
|
|
|
|
);
|
2019-03-29 14:19:29 +01:00
|
|
|
|
2019-04-21 21:18:13 +02:00
|
|
|
// Sanity checks
|
|
|
|
BtDoSanityChecks(mbMagic);
|
2019-03-19 00:25:22 +01:00
|
|
|
|
2019-05-13 18:07:45 +02:00
|
|
|
// Memory
|
2019-03-29 10:29:05 +01:00
|
|
|
MmInitMemoryMap();
|
2020-02-03 13:43:40 +01:00
|
|
|
MmInitHeap();
|
2020-01-05 20:13:53 +01:00
|
|
|
MmInitGdt();
|
2020-02-03 13:43:40 +01:00
|
|
|
MmInitPaging();
|
2019-05-15 02:26:55 +02:00
|
|
|
|
2020-01-10 13:36:33 +01:00
|
|
|
// Interrupts
|
2019-05-14 11:48:07 +02:00
|
|
|
KeSetupIDT();
|
2019-04-23 17:06:03 +02:00
|
|
|
KeEnableIRQs();
|
2020-01-09 00:31:22 +01:00
|
|
|
|
|
|
|
// Interrupt handlers
|
|
|
|
MmActivatePageHandler();
|
2019-05-14 11:48:07 +02:00
|
|
|
KeEnableRTC();
|
2019-11-14 00:54:34 +01:00
|
|
|
KeEnablePIT();
|
2019-11-14 21:20:06 +01:00
|
|
|
KeGetCpuInfos();
|
2019-11-15 00:09:20 +01:00
|
|
|
IoEnableKeyb();
|
|
|
|
|
2020-02-03 13:43:40 +01:00
|
|
|
// ACPI
|
|
|
|
IoTestAcpi();
|
|
|
|
|
2020-02-02 14:21:15 +01:00
|
|
|
// Scheduler
|
|
|
|
PsInitSched();
|
|
|
|
|
2019-11-15 00:09:20 +01:00
|
|
|
// Command line (kernel mode)
|
2019-05-29 14:34:37 +02:00
|
|
|
ShStartShell();
|
2019-05-08 00:00:45 +02:00
|
|
|
|
2020-01-17 14:09:45 +01:00
|
|
|
//KeCrashSystem();
|
2019-11-15 00:09:20 +01:00
|
|
|
// Exit !
|
2019-05-09 10:27:44 +02:00
|
|
|
PoShutdown();
|
2019-03-18 17:43:41 +01:00
|
|
|
}
|