↓ Skip to main content
  1. Tags/

操作系统

2016

geekos project 1 (ELF文件相关)

·987 words·2 mins
一、目的 熟悉 ELF 文件格式,了解 GeekOS 系统如何将 ELF 格式的可执行程序装入到内存,建立内核进程并运行的实现技术。 二、流程 1、修改 /geekos/elf.c 文件:在函数 Parse_ELF_Executable( ) 中添加代码,分析 ELF 格式的可执行文件(包括分析得出 ELF 文件头、程序头,获取可执行文件长度,代码段、数据段等信息),并填充 Exe_Format 数据结构中的域值。 2、在 Linux 环境下编译系统得到 GeekOS 镜像文件。 3、编写一个相应的 bochs 配置文件。 4、在 bochs 中运行 GeekOS 系统显示结果。

geek OS project 0 (下)

·690 words·2 mins
现在我们环境已经搭好了,参考 geekos实验环境的搭建 在main.c中新加个函数,命名为projecto,函数的代码如下: 代码实现 1/* 2 * GeekOS C code entry point 3 * Copyright (c) 2001,2003,2004 David H. Hovemeyer <daveho@cs.umd.edu> 4 * Copyright (c) 2003, Jeffrey K. Hollingsworth <hollings@cs.umd.edu> 5 * Copyright (c) 2004, Iulian Neamtiu <neamtiu@cs.umd.edu> 6 * $Revision: 1.51 $ 7 * 8 * This is free software. You are permitted to use, 9 * redistribute, and modify it as specified in the file "COPYING". 10 */ 11 12#include <geekos/bootinfo.h> 13#include <geekos/string.h> 14#include <geekos/screen.h> 15#include <geekos/mem.h> 16#include <geekos/crc32.h> 17#include <geekos/tss.h> 18#include <geekos/int.h> 19#include <geekos/kthread.h> 20#include <geekos/trap.h> 21#include <geekos/timer.h> 22#include <geekos/keyboard.h> 23 24//added by 111qqz for project 0 25void project0() 26{ 27 Print("To Exit hit Ctrl + d.\n"); 28 Print("Hello from 111qqz !\n"); 29 Print("This is a test of project0 !\n"); 30 31 32 33 Keycode keycode; 34 while(1) 35 { 36 if( Read_Key(&keycode) ) //读取键盘按键状态 37 { 38 if(!( (keycode & KEY_SPECIAL_FLAG) || (keycode & KEY_RELEASE_FLAG)) ) //只处理非特殊按键的按下事件 39 { 40 int asciiCode = keycode & 0xff; //低8位为Ascii码 41 42 if( (keycode & KEY_CTRL_FLAG)==KEY_CTRL_FLAG && asciiCode=='d') //按下Ctrl键 43 { 44 Print("\n---------BYE!--------\n"); 45 Exit(1); 46 }else 47 { 48 Print("%c",(asciiCode=='\r') ? '\n' : asciiCode); 49 } 50 } 51 } 52 } 53} 54 55 56/* 57 * Kernel C code entry point. 58 * Initializes kernel subsystems, mounts filesystems, 59 * and spawns init process. 60 */ 61void Main(struct Boot_Info* bootInfo) 62{ 63 Init_BSS(); 64 Init_Screen(); 65 Init_Mem(bootInfo); 66 Init_CRC32(); 67 Init_TSS(); 68 Init_Interrupts(); 69 Init_Scheduler(); 70 Init_Traps(); 71 Init_Timer(); 72 Init_Keyboard(); 73 74 75 Set_Current_Attr(ATTRIB(BLACK, GREEN|BRIGHT)); 76 Print("Welcome 111qqz to GeekOS!\n"); 77 Set_Current_Attr(ATTRIB(BLACK, GRAY)); 78 79 80 81 // TODO("Start a kernel thread to echo pressed keys and print counts"); 82 //added by 111qqz for project 0 83 struct Kernel_Thread *thread; 84 thread = Start_Kernel_Thread(&project0,0,PRIORITY_NORMAL,false); 85 // added for project 0 end 86 87 88 /* Now this thread is done. */ 89 Exit(0); 90} 再修改Main函数,将TODO(“…..这一行替换为以下代码:

geekok project0(上)(实验环境的搭建)

·1948 words·4 mins
apt-get install build-essential apt-get install bochs bochs-x nasm 此处下载的 bochs 应该是比较新的…如果之后遇到 failed assertion in init_idt :g_handlersizenoterr == g_handlersizeerr 这个错误,建议安装比较老的 nasm 版本,比如 2.08.02链接 下载 geekos-0.3 软件包,地址为: geekOS 下载地址 然后解压到 ~/work 目录。

OS课设之geek os 非最终版

·674 words·2 mins
参考了这篇博客 流程部分不再具体描述,可以参考上面的博客。 只详细给出我遇到的问题。 我的pc环境是:Linux 111qqz-ThinkPad-X200 3.16.0-38-generic #52~14.04.1-Ubuntu SMP Fri May 8 09:43:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux linux mint 17.2 cinnamon 1apt-get install build-essential 2apt-get install bochs bochs-x nasm http://sourceforge.net/projects/geekos/files/ 下载geekos软件包并且解压