diff options
-rwxr-xr-x | hyra-build.sh | 17 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/machdep.c | 10 | ||||
-rw-r--r-- | sys/include/arch/amd64/cpu.h | 7 |
3 files changed, 28 insertions, 6 deletions
diff --git a/hyra-build.sh b/hyra-build.sh index 1ebc3bb..ab19724 100755 --- a/hyra-build.sh +++ b/hyra-build.sh @@ -34,6 +34,7 @@ set -e RAMFS_TOOL="tools/omar/bin/omar" RAMFS_NAME="ramfs.omar" install_flag="false" +NTHREADS="-j$(nproc)" ############################### # Generate sysroot skeleton @@ -85,6 +86,17 @@ gen_isofs() { stand/limine/limine bios-install $1 } +build() { + echo "-- Building libs --" + make libs + + echo "-- Building world --" + make $NTHREADS sbin bin + + echo "-- Building kernel --" + make $NTHREADS base/boot/hyra.krq +} + #################################### # Stage 1 - build production media #################################### @@ -93,7 +105,7 @@ stage1() { sysroot_skel echo "[*] stage1: Build kernel" - make + build echo "[*] stage1: Generate stage 1 RAMFS via OMAR" $RAMFS_TOOL -i base/ -o $RAMFS_NAME @@ -123,7 +135,8 @@ stage2() { echo "[*] stage2: Build kernel" gen_iso_root - make KBUILD_ARGS="-D_INSTALL_MEDIA=1" + export KBUILD_ARGS="-D_INSTALL_MEDIA=1" + build echo "[*] stage2: Generate stage 2 ISOFS (installer)" gen_isofs "Hyra-install.iso" diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c index 6408ad3..3338caa 100644 --- a/sys/arch/amd64/amd64/machdep.c +++ b/sys/arch/amd64/amd64/machdep.c @@ -306,7 +306,7 @@ cpu_get_vendor(struct cpu_info *ci) static void cpu_get_info(struct cpu_info *ci) { - uint32_t eax, ebx, ecx, unused; + uint32_t unused, eax, ebx, ecx, edx; uint8_t ext_model, ext_family; /* Get the vendor information */ @@ -322,6 +322,14 @@ cpu_get_info(struct cpu_info *ci) ci->feat |= CPU_FEAT_UMIP; /* + * Processor power management information bits as well + * as bits describing RAS capabilities + */ + CPUID(0x80000007, unused, unused, unused, edx); + if (ISSET(edx, BIT(8))) + ci->feat |= CPU_FEAT_TSCINV; + + /* * Processor info and feature bits */ CPUID(0x01, eax, unused, unused, unused); diff --git a/sys/include/arch/amd64/cpu.h b/sys/include/arch/amd64/cpu.h index 3dadebd..6ed675e 100644 --- a/sys/include/arch/amd64/cpu.h +++ b/sys/include/arch/amd64/cpu.h @@ -42,9 +42,10 @@ #define CPU_IRQ(IRQ_N) (BIT((IRQ_N)) & 0xFF) /* Feature bits */ -#define CPU_FEAT_SMAP BIT(0) -#define CPU_FEAT_SMEP BIT(1) -#define CPU_FEAT_UMIP BIT(2) +#define CPU_FEAT_SMAP BIT(0) +#define CPU_FEAT_SMEP BIT(1) +#define CPU_FEAT_UMIP BIT(2) +#define CPU_FEAT_TSCINV BIT(3) /* TSC invariant */ /* CPU vendors */ #define CPU_VENDOR_OTHER 0x00000000 |