diff options
author | Marvin Borner | 2021-04-27 23:01:51 +0200 |
---|---|---|
committer | Marvin Borner | 2021-04-27 23:01:51 +0200 |
commit | 51a80930a9bc25fae0728994cab1e0df3b63ef48 (patch) | |
tree | e08c4f8fdc3a73cca3a291ab901c2bcf6dac453e /kernel/drivers | |
parent | 977e62973abda3dd9fe5cb3462fc87d273ba63e3 (diff) |
Huge compositor, timer and yielding improvements
Diffstat (limited to 'kernel/drivers')
-rw-r--r-- | kernel/drivers/rtc.c | 2 | ||||
-rw-r--r-- | kernel/drivers/timer.c | 18 |
2 files changed, 16 insertions, 4 deletions
diff --git a/kernel/drivers/rtc.c b/kernel/drivers/rtc.c index 01d65f4..2da61da 100644 --- a/kernel/drivers/rtc.c +++ b/kernel/drivers/rtc.c @@ -66,6 +66,6 @@ struct rtc rtc_read(void) u32 rtc_stamp(void) { struct rtc rtc = rtc_read(); - return timer_get() + rtc.second + rtc.minute * 60 + rtc.hour * 360 + rtc.day * 360 * 24 + + return rtc.second + rtc.minute * 60 + rtc.hour * 360 + rtc.day * 360 * 24 + rtc.year * 360 * 24 * 365; } diff --git a/kernel/drivers/timer.c b/kernel/drivers/timer.c index 294df84..176b499 100644 --- a/kernel/drivers/timer.c +++ b/kernel/drivers/timer.c @@ -57,14 +57,26 @@ CLEAR void scheduler_disable(void) irq_install_handler(0, timer_handler); } +static struct timer timer_struct(void) +{ + struct proc *proc = proc_current(); + struct timer timer = { + .rtc = rtc_stamp(), + .ticks.user = proc->ticks.user, + .ticks.kernel = proc->ticks.kernel, + .time = timer_get(), + }; + return timer; +} + static res timer_read(void *buf, u32 offset, u32 count) { UNUSED(offset); - u32 stamp = rtc_stamp(); - memcpy_user(buf, &stamp, MIN(count, sizeof(stamp))); + struct timer timer = timer_struct(); + memcpy_user(buf, &timer, MIN(count, sizeof(timer))); - return MIN(count, sizeof(stamp)); + return MIN(count, sizeof(timer)); } // Install timer handler into IRQ0 |