Support i686 without SSE.

Previously Sortix would initialize SSE unconditionally as part of the
boot process. Since earlier i686 CPUs like Pentium 2 did not include
SSE, Sortix would not run on them. With this SSE is only enabled for
CPUs that include it, which should theoretically allow Sortix to boot on
all i686 CPUs. Additionally, this removes -msse -msse2 compiler flags
from trianglix/Makefile.
This commit is contained in:
Juhani Krekelä 2022-01-09 21:10:54 +02:00
parent ac9c24219b
commit 4e72c78dc1
3 changed files with 15 additions and 3 deletions

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2011, 2014, 2015, 2016, 2018 Jonas 'Sortie' Termansen.
* Copyright (c) 2022 Juhani 'nortti' Krekelä.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -145,7 +146,17 @@ __start:
mov %ecx, %cr0
fninit
# Enable Streaming SIMD Extensions.
# Check for the presence of Streaming SIMD Extensions (SSE).
push %eax
push %ebx
mov $1, %eax
cpuid
pop %ebx
pop %eax
test $(1 << 25), %edx
jz 3f
# Enable Streaming SIMD Extensions (SSE).
mov %cr0, %ecx
and $0xFFFB, %cx
or $0x2, %cx
@ -157,6 +168,7 @@ __start:
ldmxcsr (%esp)
addl $4, %esp
3:
# Store a copy of the initialial floating point registers.
fxsave fpu_initialized_regs

View File

@ -27,7 +27,7 @@ A computer meeting the system requirements.
.Ss System Requirements
.Bl -bullet -compact
.It
32-bit x86 CPU with SSE (i686 release), or 64-bit x86 CPU (x86_64 release).
32-bit x86 CPU (i686 release) or 64-bit x86 CPU (x86_64 release).
.It
1 GiB RAM (recommended) to run iso live environment (including installer) with
all ports loaded, or significantly less if unimportant ports are not loaded.

View File

@ -7,7 +7,7 @@ include ../build-aux/dirs.mak
OPTLEVEL?=-g -O2
CXXFLAGS?=$(OPTLEVEL)
CXXFLAGS:=$(CXXFLAGS) -std=gnu++11 -Wall -Wextra -fno-exceptions -fno-rtti -msse -msse2
CXXFLAGS:=$(CXXFLAGS) -std=gnu++11 -Wall -Wextra -fno-exceptions -fno-rtti
BINARY:=trianglix