Feat: lab 3 w/o adv 2
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include <logger.h>
|
||||
#include <timer.h>
|
||||
#include <kmalloc.h>
|
||||
#include <uart.h>
|
||||
#include <dtb.h>
|
||||
@@ -35,11 +36,38 @@ void init(void *dtb, file_node_t **initrd_root)
|
||||
mman_init();
|
||||
}
|
||||
|
||||
static inline
|
||||
void _print_time(uint64_t)
|
||||
{
|
||||
uint64_t cntpct_el0, cntfrq_el0;
|
||||
R_SYSREG(cntpct_el0, cntpct_el0);
|
||||
R_SYSREG(cntfrq_el0, cntfrq_el0);
|
||||
DEBUG_EXCEP(cntpct_el0 / cntpct_el0);
|
||||
}
|
||||
|
||||
void main(void *dtb)
|
||||
{
|
||||
file_node_t *initrd_root = 0x0;
|
||||
init(dtb, &initrd_root);
|
||||
|
||||
LOG("system booting in");
|
||||
_print_time(0x0);
|
||||
|
||||
uint64_t cntpct_el0, cntfrq_el0;
|
||||
R_SYSREG(cntpct_el0, cntpct_el0);
|
||||
R_SYSREG(cntfrq_el0, cntfrq_el0);
|
||||
|
||||
task_t task = {
|
||||
.firing_tick = cntpct_el0 + 2 * cntfrq_el0,
|
||||
.interval = 2 * cntfrq_el0,
|
||||
.repeat = 1,
|
||||
|
||||
.func = _print_time,
|
||||
.param = 0x0,
|
||||
};
|
||||
|
||||
add_task(task);
|
||||
|
||||
uint64_t el;
|
||||
R_SYSREG(el, CurrentEL);
|
||||
INFOR(el);
|
||||
|
||||
Reference in New Issue
Block a user