1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:17:44 +00:00

Kernel: Remove the "kernel info page" used for fast gettimeofday()

We stopped using gettimeofday() in Core::EventLoop a while back,
in favor of clock_gettime() for monotonic time.

Maintaining an optimization for a syscall we're not using doesn't make
a lot of sense, so let's go back to the old-style sys$gettimeofday().
This commit is contained in:
Andreas Kling 2020-05-16 11:18:04 +02:00
parent 4e27c58be7
commit 3a92d0828d
6 changed files with 7 additions and 46 deletions

View file

@ -51,17 +51,8 @@ time_t time(time_t* tloc)
int gettimeofday(struct timeval* __restrict__ tv, void* __restrict__)
{
static volatile KernelInfoPage* kernel_info;
if (!kernel_info)
kernel_info = (volatile KernelInfoPage*)syscall(SC_get_kernel_info_page);
for (;;) {
auto serial = kernel_info->serial;
*tv = const_cast<struct timeval&>(kernel_info->now);
if (serial == kernel_info->serial)
break;
}
return 0;
int rc = syscall(SC_gettimeofday, tv);
__RETURN_WITH_ERRNO(rc, rc, -1);
}
char* ctime(const time_t* t)