Annotation of linux/kernel/printk.c, revision 1.1.1.1

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: 
                     11: static char buf[1024];
                     12: 
                     13: int printk(const char *fmt, ...)
                     14: {
                     15:        va_list args;
                     16:        int i;
                     17: 
                     18:        va_start(args, fmt);
                     19:        i=vsprintf(buf,fmt,args);
                     20:        va_end(args);
                     21:        __asm__("push %%fs\n\t"
                     22:                "push %%ds\n\t"
                     23:                "pop %%fs\n\t"
                     24:                "pushl %0\n\t"
                     25:                "pushl $_buf\n\t"
                     26:                "pushl $0\n\t"
                     27:                "call _tty_write\n\t"
                     28:                "addl $8,%%esp\n\t"
                     29:                "popl %0\n\t"
                     30:                "pop %%fs"
                     31:                ::"r" (i):"ax","cx","dx");
                     32:        return i;
                     33: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.