summaryrefslogtreecommitdiff
path: root/Kernel/panel.cpp
blob: 2a127619a65746836d3783e1184fd96e2fec08b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "types.h"
#include "Task.h"
#include "VGA.h"
#include "system.h"
#include "i386.h"
#include "i8253.h"
#include "kmalloc.h"

PUBLIC void panel_main() NORETURN;

PUBLIC void
panel_main()
{
    WORD c;
    BYTE a;

    for( ;; )
    {
        c = vga_get_cursor();
        a = vga_get_attr();

        /* HACK: Avoid getting interrupted while painting since
         *       that could lead to fugly artifacts ;P */
        disableInterrupts();

        vga_set_attr( 0x17 );
        vga_set_cursor( 80 * 24 );

        kprintf(
            " Uptime: %u -- %u tasks (%u blocked)   kmalloc: %u/%u          ",
            system.uptime / TICKS_PER_SECOND,
            system.nprocess,
            system.nblocked,
            sum_alloc,
            sum_free
        );

        vga_set_attr( a );
        vga_set_cursor( c );

        /* HACK cont.d */
        enableInterrupts();

        sleep( 1 * TICKS_PER_SECOND );
    }
}