system_call.c

来自「别人的根据linux0.11改的一个小的操作系统」· C语言 代码 · 共 57 行

C
57
字号
/*
 * system_call.c
 *
 * There have some routines that is used for system call.
 */
#include <def.h>
#include <sched.h>

/********************************************
 *those routines be used for system call
 *they are not visible to user
 ********************************************/

void _clrscr();				/*clear screen*/
void _scr_up();				/*make the screen scroll up 1 row*/

void _clrscr()
{
	asm(
		"pushw	%%es;"
		"movw	$0x18,%%ax;"
		"movw	%%ax,%%es;"
		"movl	$1000,%%ecx;"
		"xorl	%%eax,%%eax;"
		"xorl	%%edi,%%edi;"
		"cld;"
		"rep	stosl;"
		"popw	%%es;"
		::
		:"%eax","%ecx","%edi");
	setCursor(0,0);
}

void _scr_up()
{
	asm(
		"pushw	%%ds;"
		"pushw	%%es;"
		"movw	$0x18,%%ax;"
		"movw	%%ax,%%ds;"
		"movw	%%ax,%%es;"
		"movl	$160,%%esi;"
		"xorl	%%edi,%%edi;"
		"movl	$960,%%ecx;"
		"cld;"
		"rep	movsl;"
		"movl	$40,%%ecx;"
		"xorl	%%eax,%%eax;"
		"rep	stosl;"
		"popw	%%es;"
		"popw	%%ds;"
		::
		:"%eax","%ecx","%esi","%edi");
	setCursor(0,24);
}

⌨️ 快捷键说明

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