⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 一个微型操作系统源码
💻 C
字号:
/* * main.c - main kernel entry point * * OSV * Copyright (C) 2002 Ciprian DOSOFTEI <rocksoul@mail.com> * All rights reserved. *  * http://backster.free.fr/osv * * This file is part of the OSV project. OSV is free software, also known as * "open source"; you can redistribute it and/or modify it under the terms  * of the GNU General Public License (GPL), version 2, as published by the Free * Software Foundation (FSF). To explore alternate licensing terms, contact  * the author at rocksoul@mail.com or +40740649907. *  * OSV 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 GPL for more details.  You should have * received a copy of the GPL along with OSV; see the file COPYING.  If * not, write to the FSF, 59 Temple Place #330, Boston, MA 02111-1307, USA. */#include <kernel.h>struct cpuinfo_x86 boot_cpu_data = { 0, 0, 0, 0, -1, 1, 0, 0, -1 };int main(mb_info_t *volatile_bootInfo){    ulong availMem, usedMem;        availMem = get_available_memory(volatile_bootInfo);    usedMem = get_used_memory(volatile_bootInfo);        printk("OSV v%d.%d (%s)\n", VERSION, REVISION, RELEASE);    printk("Copyright (C) %s Ciprian Dosoftei <rocksoul@mail.com>\n", CYEARS);#ifdef DEBUG_MESSAGES    DEBUG("debug messages enabled");#else    printk(" %c debug messages disabled", 0xAF);#endif    identifyCPU(&boot_cpu_data);    DEBUG("identifying CPU(s)...");    displayCPUInfo(&boot_cpu_data);        reprogramPIC(0x20,0x28);    DEBUG("reprogramming PIC");        setupGDT();    DEBUG("setting up GDT...");        setupIDT();    DEBUG("setting up IDT...");        setupExceptions();    DEBUG("setting up exceptions...");        setupMemory(availMem, usedMem);    DEBUG("loading memory pre-manager");    printk(" %c %dMb memory found\n", 0xAF, availMem / 1024 / 1024);        setupPaging(availMem);     DEBUG("setting up paging...");        initTimer();    printk(" %c initializing the timer driver\n", 0xAF);    waitKey();    halt();    return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -