mytest.c

来自「操作系统试验!通过这个试验」· C语言 代码 · 共 91 行

C
91
字号
/** @file 410test.c *  @brief A test file for your drivers. *//* -- Includes -- *//* libc includes. */#include <stdio.h> /* for lprintf_kern() *//* multiboot header file */#include <multiboot.h> /* for boot_info *//* memory includes. */#include <lmm.public.h> /* for lmm_remove_free() *//* x86 specific includes */#include <x86/seg.h> /* for install_user_segs() */#include <x86/pic.h> /* for pic_init() */#include <x86/base_irq.h> /* for base_irq_master/slave */#include <interrupts.h>#include <kerndebug.h>#include <timer_defines.h>#include <console.h>/* Driver includes */#include <kernel_init.h>/* * state for kernel memory allocation. */extern lmm_t malloc_lmm;/* * Info about system gathered by the boot loader */extern struct multiboot_info boot_info;/* --- Kernel entrypoint --- */intmain(){    /*     * Tell the kernel memory allocator which memory it can't use.     * It already knows not to touch kernel image.     */    lmm_remove_free( &malloc_lmm, (void*)USER_MEM_START, USER_MEM_SIZE );    lmm_remove_free( &malloc_lmm, (void*)0, 0x100000 );    kernel_init();    /*     * initialize the PIC so that IRQs and     * exception handlers don't overlap in the IDT.     */    pic_init( BASE_IRQ_MASTER_BASE, BASE_IRQ_SLAVE_BASE );    /* Disable timer interrupts */    pic_disable_irq(0);	/* Implemented you testcases here */	/* ... */    while(1) {    }    return 0;}/* The following 4 functions should never be implemented here!!! */void *GameProcess1(void *argv){	return NULL;}void *GameProcess2(void *argv){	return NULL;}void *GameProcess3(void *argv){	return NULL;}void *GameProcess4(void *argv){	return NULL;}

⌨️ 快捷键说明

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