Subversion Repositories HelenOS

Rev

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

Rev 4226 Rev 4252
Line 39... Line 39...
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/irq.h>
42
#include <ddi/irq.h>
43
#include <ddi/ddi.h>
43
#include <ddi/ddi.h>
44
#include <event/event.h>
44
#include <ipc/event.h>
45
#include <ipc/irq.h>
45
#include <ipc/irq.h>
46
#include <arch.h>
46
#include <arch.h>
47
#include <func.h>
47
#include <func.h>
48
#include <print.h>
48
#include <print.h>
49
#include <putchar.h>
49
#include <putchar.h>
50
#include <atomic.h>
50
#include <atomic.h>
51
#include <syscall/copy.h>
51
#include <syscall/copy.h>
52
#include <errno.h>
52
#include <errno.h>
53
#include <string.h>
53
#include <string.h>
54
 
54
 
55
#define KLOG_SIZE     PAGE_SIZE
55
#define KLOG_PAGES    4
56
#define KLOG_LENGTH   (KLOG_SIZE / sizeof(wchar_t))
56
#define KLOG_LENGTH   (KLOG_PAGES * PAGE_SIZE / sizeof(wchar_t))
57
#define KLOG_LATENCY  8
57
#define KLOG_LATENCY  8
58
 
58
 
59
/** Kernel log cyclic buffer */
59
/** Kernel log cyclic buffer */
60
static wchar_t klog[KLOG_LENGTH] __attribute__ ((aligned (PAGE_SIZE)));
60
static wchar_t klog[KLOG_LENGTH] __attribute__ ((aligned (PAGE_SIZE)));
61
 
61
 
Line 93... Line 93...
93
void klog_init(void)
93
void klog_init(void)
94
{
94
{
95
    void *faddr = (void *) KA2PA(klog);
95
    void *faddr = (void *) KA2PA(klog);
96
   
96
   
97
    ASSERT((uintptr_t) faddr % FRAME_SIZE == 0);
97
    ASSERT((uintptr_t) faddr % FRAME_SIZE == 0);
98
    ASSERT(KLOG_SIZE % FRAME_SIZE == 0);
-
 
99
   
98
   
100
    klog_parea.pbase = (uintptr_t) faddr;
99
    klog_parea.pbase = (uintptr_t) faddr;
101
    klog_parea.frames = SIZE2FRAMES(sizeof(klog));
100
    klog_parea.frames = SIZE2FRAMES(sizeof(klog));
102
    ddi_parea_register(&klog_parea);
101
    ddi_parea_register(&klog_parea);
103
   
102
   
104
    sysinfo_set_item_val("klog.faddr", NULL, (unative_t) faddr);
103
    sysinfo_set_item_val("klog.faddr", NULL, (unative_t) faddr);
105
    sysinfo_set_item_val("klog.pages", NULL, SIZE2FRAMES(sizeof(klog)));
104
    sysinfo_set_item_val("klog.pages", NULL, KLOG_PAGES);
106
   
105
   
107
    spinlock_lock(&klog_lock);
106
    spinlock_lock(&klog_lock);
108
    klog_inited = true;
107
    klog_inited = true;
109
    spinlock_unlock(&klog_lock);
108
    spinlock_unlock(&klog_lock);
110
}
109
}