kernel_c.c

来自「John Fine的OS模型// 源代码// C & ASM// 英文」· C语言 代码 · 共 21 行

C
21
字号
// When started from bootf we get to this code with a temporary GDT,
// a temporary stack, temporary page tables, no TSS, no IDT and interrupts
// disabled.
//
// There is a fair amount of ASM work to be done before we can do much safely
// in C;  But ignoring all that we execute some C code just to prove we got
// here.

char message[] = "Executing the C code";
void test(void) {
	char *source = message;
	char *destination = (char *)0xB8000;

	while (*source) {
		*destination++ = *source++;
		*destination++ = 7; }

	for (;;) ; // Hang:  There is nowhere to return to
}

⌨️ 快捷键说明

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