Пример #1
0
// Starts the kernel's idle process. This process has kernel permissions.
int idle_main(int argc, char ** params) {
	
	int i = 0;
	char a[] = { ' ', 0x07 };
	
	for(; i < 2000; ++i)	{
		memcpy((char*)0xb8000 + i * 2, a, 2);
	}
	
	// The funny message, windows says starting windows... why shouldn't we? D:
	char start_msg[][2] =	{ 
		{ 'S', 0x07 },
		{ 't', 0x08 },
		{ 'a', 0x09 },
		{ 'r', 0x0a },
		{ 't', 0x0b },
		{ 'i', 0x0c },
		{ 'n', 0x0d },
		{ 'g', 0x0e },
		{ ' ', 0x0f },
		{ 'M', 0x02 },
		{ 'o', 0x03 },
		{ 'n', 0x04 },
		{ 'i', 0x05 },
		{ 'x', 0x06 },
		{ ' ', 0x0f },
		{ '\001', 0x5f },
	};
	
	i = 0;
	for(; i < 16; ++i)	{
		memcpy((char*)0xb8000 + i * 2, start_msg[i], 2);
		_setCursor(i);
	}
	
	Cli();
	make_atomic();

	mount();					// Mount or start the FS

	tty_init(0);				// Load up the TTY's
	tty_init(1);
	tty_init(2);
	tty_init(3);
	tty_init(4);
	tty_init(5);		
	
	setready(); 				// Set the kernel as ready and the FS as loaded
	users_init();				// Init the users
	
	fs_finish();

	release_atomic();	
	Sti();


	while(1) {
		_Halt(); // Now set to idle.
	}
}
Пример #2
0
// This call is done outside the kernel, since we had maaaaaaaany problems with it inside #nofun
// Fires a signal after a syscall, only if the kernel has been set to do so.
void signal_on_demand() {
	if (kernel_buffer[KERNEL_RETURN - 1] != 0) {
		
		if (kernel_buffer[0] == KILL) {
			make_atomic();
			int sigcode = kernel_buffer[KERNEL_RETURN - 1];
			int pid = kernel_buffer[KERNEL_RETURN - 2];
		
			sg_handle(sigcode, pid);
			release_atomic();
		}
		kernel_buffer[KERNEL_RETURN - 1] = 0; // SIGCODE
		kernel_buffer[KERNEL_RETURN - 2] = 0; // PID
	}

}
Пример #3
0
void video_write_c(char * data) {
	make_atomic();
	char a[] = { *data, defaultStyle };
	char c = *data;

	if (c == '\r') {
		backSpace();
	} else if (c == '\n') {
		newLine();
	} else if (c == 0x0f || c == '\t') {
		if (getCursorX() % 4 == 0) {
			int i = 0;
			for (i = 0; i < 4; ++i) {
				putChar(' ');
				*a = ' ';
				video_write(a, 2);
			}
		} else
			while (getCursorX() % 4 != 0) {
				putChar(' ');
				*a = ' ';
				video_write(a,2);
				incrementCursor();
			}
	} else if (c != 0) {
		putChar(c);
		if(current_video_mode->visible)	{
			video_write(a,2);
			incrementCursor();
		} else {
			setCursor(FALSE);
			incrementCursor();
			setCursor(TRUE);
		}
	}
	release_atomic();
}