📄 main.cxx
字号:
/* * Copyright (C) 1998, 1999, Jonathan S. Shapiro. * * This file is part of the EROS Operating System. * * This program 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 2, * or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */#include <eros/target.h>#include <eros/i486/io.h>#include <disk/LowVolume.hxx>#include <kerninc/BootInfo.h>#include "boot.h"#include "boot-asm.h"#include "debug.h"extern "C" { extern DiskKey IplKey;}intmain(){ BootInfo *bi; /* This used to be after the geometry probe, but there should be no * impediment to doing it immediately. */ gateA20(); bi = ProbeMemory(); CaptureBootDisk(bi); int vidmode = GetDisplayMode(); printf("Video mode is 0x%x\n", vidmode); Interact(bi); bi->volFlags = VolFlags; /* copy stuff to BootInfo */ bi->iplSysId = IplSysId; memcpy(&bi->iplKey, &IplKey, sizeof(IplKey)); if (VolFlags & VolHdr::VF_RAMDISK) { LoadRamDisk(bi); } else if (VolFlags & VolHdr::VF_COMPRESSED) { printf("Compressed volumes must be marked for ramdisk load.\n"); halt(); } if (CND_DEBUG(step)) { printf("Press any key to continue\n"); waitkbd(); } PreloadDivisions(bi); if (CND_DEBUG(step)) { printf("Press any key to continue\n"); waitkbd(); }#if 0 if (VolFlags & VolHdr::VF_DEBUG) { printf("Press any key to load kernel\n"); waitkbd(); }#endif LoadKernel(bi); /* AFTER LoadKernel can no longer do disk I/O */ if (CND_DEBUG(step)) { printf("Press any key to continue\n"); waitkbd(); } /* spin down floppy drive to minimize wear. 0x3f2 is the floppy * controller's device output register. 0x08 says spin everything * down. It would be better to do this with a BIOS call, but I * don't have my BIOS reference handy at the moment. */ outb(0x08, 0x3f2);#if 0 if (VolFlags & VolHdr::VF_DEBUG) { printf("Press any key to start kernel\n"); waitkbd(); }#endif ShowMemory(bi); ShowDivisions(bi);#if 0 printf("\nPress any key to start kernel\n"); waitkbd();#endif printf("\nStarting kernel with bi=0x%08x\n", BOOT2PA(bi, BootInfo *)); /* Fix up the pointers in the BootInfo structure to be absolute * physical addresses. */ bi->memInfo = BOOT2PA(bi->memInfo, MemInfo *); bi->divInfo = BOOT2PA(bi->divInfo, DivisionInfo *); StartKernel(KERNBOOTBASE, BOOT2PA(bi, BootInfo *));}voidInteract(BootInfo * /* si */){ DEBUG(unimpl) printf("Interact() not implemented\n");}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -