Subversion Repositories HelenOS

Rev

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

Rev 1952 Rev 2017
Line 40... Line 40...
40
#include <console/console.h>
40
#include <console/console.h>
41
#include <arch/hypercall.h>
41
#include <arch/hypercall.h>
42
 
42
 
43
#define MASK_INDEX(index, ring) ((index) & (sizeof(ring) - 1))
43
#define MASK_INDEX(index, ring) ((index) & (sizeof(ring) - 1))
44
 
44
 
45
static bool asynchronous = false;
-
 
46
static void xen_putchar(chardev_t *d, const char ch);
45
static void xen_putchar(chardev_t *d, const char ch);
47
 
46
 
48
chardev_t xen_console;
47
chardev_t xen_console;
49
static chardev_operations_t xen_ops = {
48
static chardev_operations_t xen_ops = {
50
    .write = xen_putchar
49
    .write = xen_putchar
Line 52... Line 51...
52
 
51
 
53
void xen_console_init(void)
52
void xen_console_init(void)
54
{
53
{
55
    chardev_initialize("xen_out", &xen_console, &xen_ops);
54
    chardev_initialize("xen_out", &xen_console, &xen_ops);
56
    stdout = &xen_console;
55
    stdout = &xen_console;
57
    if (!(start_info.flags & SIF_INITDOMAIN))
-
 
58
        asynchronous = true;
-
 
59
}
56
}
60
 
57
 
61
void xen_putchar(chardev_t *d, const char ch)
58
void xen_putchar(chardev_t *d, const char ch)
62
{
59
{
63
    if (asynchronous) {
60
    if (start_info.console.domU.evtchn != 0) {
64
        uint32_t cons = console_page.out_cons;
61
        uint32_t cons = console_page.out_cons;
65
        uint32_t prod = console_page.out_prod;
62
        uint32_t prod = console_page.out_prod;
66
       
63
       
67
        memory_barrier();
64
        memory_barrier();
68
       
65
       
Line 75... Line 72...
75
       
72
       
76
        write_barrier();
73
        write_barrier();
77
       
74
       
78
        console_page.out_prod = prod;
75
        console_page.out_prod = prod;
79
       
76
       
80
        xen_notify_remote(start_info.console_evtchn);
77
        xen_notify_remote(start_info.console.domU.evtchn);
81
    } else
78
    } else
82
        xen_console_io(CONSOLE_IO_WRITE, 1, &ch);
79
        xen_console_io(CONSOLE_IO_WRITE, 1, &ch);
83
}
80
}
84
 
81
 
85
/** @}
82
/** @}