|
|
1.1 root 1: /*
2: * When in kernel-mode, we cannot use printf, as fs is liable to
3: * point to 'interesting' things. Make a printf with fs-saving, and
4: * all is well.
5: */
6: #include <stdarg.h>
7: #include <stddef.h>
8:
9: #include <linux/kernel.h>
10:
1.1.1.2 ! root 11: extern int vsprintf();
1.1 root 12: static char buf[1024];
13:
14: int printk(const char *fmt, ...)
15: {
16: va_list args;
17: int i;
18:
19: va_start(args, fmt);
20: i=vsprintf(buf,fmt,args);
21: va_end(args);
22: __asm__("push %%fs\n\t"
23: "push %%ds\n\t"
24: "pop %%fs\n\t"
25: "pushl %0\n\t"
1.1.1.2 ! root 26: "pushl $buf\n\t"
1.1 root 27: "pushl $0\n\t"
1.1.1.2 ! root 28: "call tty_write\n\t"
1.1 root 29: "addl $8,%%esp\n\t"
30: "popl %0\n\t"
31: "pop %%fs"
32: ::"r" (i):"ax","cx","dx");
33: return i;
34: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.