-
Notifications
You must be signed in to change notification settings - Fork 73
Expand file tree
/
Copy pathdbg.c
More file actions
62 lines (54 loc) · 1.1 KB
/
dbg.c
File metadata and controls
62 lines (54 loc) · 1.1 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
* Copyright 2021, Breakaway Consulting Pty. Ltd.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <microkit.h>
#include <sel4/sel4.h>
void microkit_dbg_putc(int c)
{
#if defined(CONFIG_PRINTING)
seL4_DebugPutChar(c);
#endif
}
void microkit_dbg_puts(const char *s)
{
while (*s) {
microkit_dbg_putc(*s);
s++;
}
}
void microkit_dbg_put8(seL4_Uint8 x)
{
char tmp[4];
unsigned i = 3;
tmp[3] = 0;
do {
seL4_Uint8 c = x % 10;
tmp[--i] = '0' + c;
x /= 10;
} while (x);
microkit_dbg_puts(&tmp[i]);
}
void microkit_dbg_put32(seL4_Uint32 x)
{
char tmp[11];
unsigned i = 10;
tmp[10] = 0;
do {
seL4_Uint8 c = x % 10;
tmp[--i] = '0' + c;
x /= 10;
} while (x);
microkit_dbg_puts(&tmp[i]);
}
void __assert_fail(const char *str, const char *file, int line, const char *function)
{
microkit_dbg_puts("assert failed: ");
microkit_dbg_puts(str);
microkit_dbg_puts(" ");
microkit_dbg_puts(file);
microkit_dbg_puts(" ");
microkit_dbg_puts(function);
microkit_dbg_puts("\n");
}