Skip to content

Commit 071025b

Browse files
committed
define sanity check/testing as macros
1 parent 03ab1a1 commit 071025b

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

kernel/kernel.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "string.h"
88
#include "irq.h"
99

10+
1011
static const char *banner[] = {
1112
"========================================\r\n",
1213
" AstraKernel v0.1.0\r\n",
@@ -36,12 +37,12 @@ static void init_message(void)
3637
void irq_sanity_check(void)
3738
{
3839
irq_disable();
39-
unsigned before = irq_count;
40+
unsigned before = tick;
4041

4142
irq_enable();
4243
irq_disable();
4344

44-
unsigned after = irq_count;
45+
unsigned after = tick;
4546

4647
if (before == after)
4748
{
@@ -53,13 +54,20 @@ void irq_sanity_check(void)
5354
}
5455
}
5556

57+
/* The following macros are for testing purposes. */
58+
#define SANITY_CHECK irq_sanity_check()
59+
#define CALL_SVC_0 __asm__ volatile ("svc #0")
60+
5661
// Entry point for the kernel
5762
void kernel_main(void)
5863
{
5964
clear();
6065

61-
irq_sanity_check();
62-
__asm__ volatile ("svc #0");
66+
/* TEST */
67+
SANITY_CHECK;
68+
CALL_SVC_0;
69+
70+
/* Back to normal operations */
6371
init_message();
6472

6573
char input_buffer[100];

0 commit comments

Comments
 (0)