linux0.11内核源代码,学习内核入门必看

源代码在线查看: printk.c

软件大小: 193 K
上传用户: xiaoluya54
关键词: linux 0.11 内核 源代码
下载地址: 免注册下载 普通下载 VIP

相关代码

				/*				 *  linux/kernel/printk.c				 *				 *  (C) 1991  Linus Torvalds				 */								/*				 * When in kernel-mode, we cannot use printf, as fs is liable to				 * point to 'interesting' things. Make a printf with fs-saving, and				 * all is well.				 */				#include 				#include 								#include 								static char buf[1024];								extern int vsprintf(char * buf, const char * fmt, va_list args);								int printk(const char *fmt, ...)				{					va_list args;					int i;									va_start(args, fmt);					i=vsprintf(buf,fmt,args);					va_end(args);					__asm__("push %%fs\n\t"						"push %%ds\n\t"						"pop %%fs\n\t"						"pushl %0\n\t"						"pushl $_buf\n\t"						"pushl $0\n\t"						"call _tty_write\n\t"						"addl $8,%%esp\n\t"						"popl %0\n\t"						"pop %%fs"						::"r" (i):"ax","cx","dx");					return i;				}							

相关资源