Subversion Repositories HelenOS

Rev

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

Rev 4087 Rev 4146
Line 37... Line 37...
37
#include <console/chardev.h>
37
#include <console/chardev.h>
38
#include <sysinfo/sysinfo.h>
38
#include <sysinfo/sysinfo.h>
39
#include <synch/waitq.h>
39
#include <synch/waitq.h>
40
#include <synch/spinlock.h>
40
#include <synch/spinlock.h>
41
#include <arch/types.h>
41
#include <arch/types.h>
42
#include <ddi/device.h>
-
 
43
#include <ddi/irq.h>
42
#include <ddi/irq.h>
44
#include <ddi/ddi.h>
43
#include <ddi/ddi.h>
45
#include <ipc/irq.h>
44
#include <ipc/irq.h>
46
#include <arch.h>
45
#include <arch.h>
47
#include <func.h>
46
#include <func.h>
48
#include <print.h>
47
#include <print.h>
49
#include <atomic.h>
48
#include <atomic.h>
-
 
49
#include <syscall/copy.h>
-
 
50
#include <errno.h>
50
 
51
 
51
#define KLOG_SIZE PAGE_SIZE
52
#define KLOG_SIZE PAGE_SIZE
52
#define KLOG_LATENCY 8
53
#define KLOG_LATENCY 8
53
 
54
 
54
/** Kernel log cyclic buffer */
55
/** Kernel log cyclic buffer */
Line 120... Line 121...
120
{
121
{
121
    silent = true;
122
    silent = true;
122
    arch_release_console();
123
    arch_release_console();
123
}
124
}
124
 
125
 
-
 
126
/** Tell kernel to get keyboard/console access again */
-
 
127
unative_t sys_debug_enable_console(void)
-
 
128
{
-
 
129
#ifdef CONFIG_KCONSOLE
-
 
130
    grab_console();
-
 
131
    return true;
-
 
132
#else
-
 
133
    return false;
-
 
134
#endif
-
 
135
}
-
 
136
 
-
 
137
/** Tell kernel to relinquish keyboard/console access */
-
 
138
unative_t sys_debug_disable_console(void)
-
 
139
{
-
 
140
    release_console();
-
 
141
    return true;
-
 
142
}
-
 
143
 
125
bool check_poll(indev_t *indev)
144
bool check_poll(indev_t *indev)
126
{
145
{
127
    if (indev == NULL)
146
    if (indev == NULL)
128
        return false;
147
        return false;
129
   
148
   
Line 273... Line 292...
273
   
292
   
274
    if (update)
293
    if (update)
275
        klog_update();
294
        klog_update();
276
}
295
}
277
 
296
 
-
 
297
/** Print using kernel facility
-
 
298
 *
-
 
299
 * Print to kernel log.
-
 
300
 *
-
 
301
 */
-
 
302
unative_t sys_klog(int fd, const void * buf, size_t count)
-
 
303
{
-
 
304
    char *data;
-
 
305
    int rc;
-
 
306
 
-
 
307
    if (count > PAGE_SIZE)
-
 
308
        return ELIMIT;
-
 
309
   
-
 
310
    if (count > 0) {
-
 
311
        data = (char *) malloc(count + 1, 0);
-
 
312
        if (!data)
-
 
313
            return ENOMEM;
-
 
314
       
-
 
315
        rc = copy_from_uspace(data, buf, count);
-
 
316
        if (rc) {
-
 
317
            free(data);
-
 
318
            return rc;
-
 
319
        }
-
 
320
        data[count] = 0;
-
 
321
       
-
 
322
        printf("%s", data);
-
 
323
        free(data);
-
 
324
    } else
-
 
325
        klog_update();
-
 
326
   
-
 
327
    return count;
-
 
328
}
-
 
329
 
278
/** @}
330
/** @}
279
 */
331
 */