Skip to content

Commit e08d355

Browse files
wipawel82marbag
authored andcommitted
setup: add option to enable FPU via cmdline
This is needed by libpfm. Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
1 parent f73df53 commit e08d355

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

common/setup.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ bool_cmd("apic_timer", opt_apic_timer);
7474
bool opt_hpet = false;
7575
bool_cmd("hpet", opt_hpet);
7676

77+
bool opt_fpu = false;
78+
bool_cmd("fpu", opt_fpu);
79+
7780
io_port_t __data_rmode com_ports[2] = {COM1_PORT, COM2_PORT};
7881

7982
boot_flags_t boot_flags;
@@ -303,6 +306,11 @@ void __noreturn __text_init kernel_start(uint32_t multiboot_magic,
303306
if (opt_keyboard)
304307
init_keyboard(get_bsp_cpu_id());
305308

309+
if (opt_fpu) {
310+
printk("Enabling FPU instructions support\n");
311+
enable_fpu();
312+
}
313+
306314
#ifdef KTF_PMU
307315
printk("Initializing PFM library\n");
308316

include/lib.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ static inline unsigned long ipow(int base, unsigned int exp) {
421421
return result;
422422
}
423423

424-
static inline void enable_sse(void) {
424+
static inline void enable_fpu(void) {
425425
write_cr0((read_cr0() & ~X86_CR0_EM) | X86_CR0_MP);
426426
write_cr4(read_cr4() | X86_CR4_OSFXSR | X86_CR4_OSXMMEXCPT);
427427
}

0 commit comments

Comments
 (0)