1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 21:17:45 +00:00

Kernel: Merge the x86 and x86_64 boot code into a single file

They're mostly the same apart from some x86_64-specific parts.
This commit is contained in:
Gunnar Beutner 2021-07-05 00:55:09 +02:00 committed by Andreas Kling
parent ce6658acc1
commit 040fe0054b
6 changed files with 414 additions and 600 deletions

View file

@ -74,18 +74,19 @@
# define PAGE_SIZE sysconf(_SC_PAGESIZE)
#endif
#ifndef _BOOTLOADER
ALWAYS_INLINE int count_trailing_zeroes_32(unsigned int val)
{
#if defined(__GNUC__) || defined(__clang__)
# if defined(__GNUC__) || defined(__clang__)
return __builtin_ctz(val);
#else
# else
for (u8 i = 0; i < 32; ++i) {
if ((val >> i) & 1) {
return i;
}
}
return 0;
#endif
# endif
}
ALWAYS_INLINE int count_trailing_zeroes_32_safe(unsigned int val)
@ -94,6 +95,7 @@ ALWAYS_INLINE int count_trailing_zeroes_32_safe(unsigned int val)
return 32;
return count_trailing_zeroes_32(val);
}
#endif
#ifdef AK_OS_BSD_GENERIC
# define CLOCK_MONOTONIC_COARSE CLOCK_MONOTONIC