Subversion Repositories HelenOS

Rev

Rev 2131 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2131 Rev 2307
Line 33... Line 33...
33
 */
33
 */
34
 
34
 
35
#include <print.h>
35
#include <print.h>
36
#include <printf/printf_core.h>
36
#include <printf/printf_core.h>
37
#include <putchar.h>
37
#include <putchar.h>
-
 
38
#include <synch/spinlock.h>
-
 
39
#include <arch/asm.h>
-
 
40
 
-
 
41
SPINLOCK_INITIALIZE(printf_lock);           /**< vprintf spinlock */
38
 
42
 
39
static int vprintf_write(const char *str, size_t count, void *unused)
43
static int vprintf_write(const char *str, size_t count, void *unused)
40
{
44
{
41
    size_t i;
45
    size_t i;
42
    for (i = 0; i < count; i++)
46
    for (i = 0; i < count; i++)
Line 53... Line 57...
53
}
57
}
54
 
58
 
55
int vprintf(const char *fmt, va_list ap)
59
int vprintf(const char *fmt, va_list ap)
56
{
60
{
57
    struct printf_spec ps = {(int(*)(void *, size_t, void *)) vprintf_write, NULL};
61
    struct printf_spec ps = {(int(*)(void *, size_t, void *)) vprintf_write, NULL};
-
 
62
   
-
 
63
    int irqpri = interrupts_disable();
-
 
64
    spinlock_lock(&printf_lock);
-
 
65
   
58
    return printf_core(fmt, &ps, ap);
66
    int ret = printf_core(fmt, &ps, ap);
-
 
67
   
-
 
68
    spinlock_unlock(&printf_lock);
-
 
69
    interrupts_restore(irqpri);
59
 
70
   
-
 
71
    return ret;
60
}
72
}
61
 
73
 
62
/** @}
74
/** @}
63
 */
75
 */