Subversion Repositories HelenOS

Rev

Rev 3022 | Rev 4296 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3022 Rev 4055
Line 35... Line 35...
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>
38
#include <synch/spinlock.h>
39
#include <arch/asm.h>
39
#include <arch/asm.h>
-
 
40
#include <arch/types.h>
-
 
41
#include <typedefs.h>
40
 
42
 
41
SPINLOCK_INITIALIZE(printf_lock);           /**< vprintf spinlock */
43
SPINLOCK_INITIALIZE(printf_lock);           /**< vprintf spinlock */
42
 
44
 
43
static int vprintf_write(const char *str, size_t count, void *unused)
45
static int vprintf_write(const char *str, size_t count, void *unused)
44
{
46
{
Line 58... Line 60...
58
 
60
 
59
int vprintf(const char *fmt, va_list ap)
61
int vprintf(const char *fmt, va_list ap)
60
{
62
{
61
    struct printf_spec ps = {(int(*)(void *, size_t, void *)) vprintf_write, NULL};
63
    struct printf_spec ps = {(int(*)(void *, size_t, void *)) vprintf_write, NULL};
62
   
64
   
63
    int irqpri = interrupts_disable();
65
    ipl_t ipl = interrupts_disable();
64
    spinlock_lock(&printf_lock);
66
    spinlock_lock(&printf_lock);
65
   
67
   
66
    int ret = printf_core(fmt, &ps, ap);
68
    int ret = printf_core(fmt, &ps, ap);
67
   
69
   
68
    spinlock_unlock(&printf_lock);
70
    spinlock_unlock(&printf_lock);
69
    interrupts_restore(irqpri);
71
    interrupts_restore(ipl);
70
   
72
   
71
    return ret;
73
    return ret;
72
}
74
}
73
 
75
 
74
/** @}
76
/** @}