Fixes bug 173467. Ikarus now probes the cpuid for SSE2 support.

This commit is contained in:
Abdulaziz Ghuloum 2007-12-03 00:29:36 -05:00
parent 54ace976b5
commit 307fb64f84
5 changed files with 49 additions and 4 deletions

View File

@ -1 +1 @@
1174
1175

View File

@ -1,7 +1,7 @@
bin_PROGRAMS = ikarus scheme-script
ikarus_SOURCES = ikarus-collect.c ikarus-exec.c ikarus-fasl.c ikarus-flonums.c ikarus-main.c ikarus-numerics.c ikarus-print.c ikarus-runtime.c ikarus-symbol-table.c ikarus-verify-integrity.c ikarus-weak-pairs.c ikarus-winmmap.c ikarus-data.h ikarus-winmmap.h ikarus-enter.s
ikarus_SOURCES = ikarus-collect.c ikarus-exec.c ikarus-fasl.c ikarus-flonums.c ikarus-main.c ikarus-numerics.c ikarus-print.c ikarus-runtime.c ikarus-symbol-table.c ikarus-verify-integrity.c ikarus-weak-pairs.c ikarus-winmmap.c ikarus-data.h ikarus-winmmap.h ikarus-enter.s cpu_has_sse2.s
scheme_script_SOURCES = scheme-script.c

View File

@ -52,7 +52,8 @@ am_ikarus_OBJECTS = ikarus-collect.$(OBJEXT) ikarus-exec.$(OBJEXT) \
ikarus-print.$(OBJEXT) ikarus-runtime.$(OBJEXT) \
ikarus-symbol-table.$(OBJEXT) \
ikarus-verify-integrity.$(OBJEXT) ikarus-weak-pairs.$(OBJEXT) \
ikarus-winmmap.$(OBJEXT) ikarus-enter.$(OBJEXT)
ikarus-winmmap.$(OBJEXT) ikarus-enter.$(OBJEXT) \
cpu_has_sse2.$(OBJEXT)
nodist_ikarus_OBJECTS =
ikarus_OBJECTS = $(am_ikarus_OBJECTS) $(nodist_ikarus_OBJECTS)
ikarus_LDADD = $(LDADD)
@ -173,7 +174,7 @@ target_os = @target_os@
target_vendor = @target_vendor@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
ikarus_SOURCES = ikarus-collect.c ikarus-exec.c ikarus-fasl.c ikarus-flonums.c ikarus-main.c ikarus-numerics.c ikarus-print.c ikarus-runtime.c ikarus-symbol-table.c ikarus-verify-integrity.c ikarus-weak-pairs.c ikarus-winmmap.c ikarus-data.h ikarus-winmmap.h ikarus-enter.s
ikarus_SOURCES = ikarus-collect.c ikarus-exec.c ikarus-fasl.c ikarus-flonums.c ikarus-main.c ikarus-numerics.c ikarus-print.c ikarus-runtime.c ikarus-symbol-table.c ikarus-verify-integrity.c ikarus-weak-pairs.c ikarus-winmmap.c ikarus-data.h ikarus-winmmap.h ikarus-enter.s cpu_has_sse2.s
scheme_script_SOURCES = scheme-script.c
nodist_ikarus_SOURCES = bootfileloc.h
BUILT_SOURCES = bootfileloc.h

35
src/cpu_has_sse2.s Normal file
View File

@ -0,0 +1,35 @@
# Ikarus Scheme -- A compiler for R6RS Scheme.
# Copyright (C) 2006,2007 Abdulaziz Ghuloum
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
.text
.globl cpu_has_sse2
.globl _cpu_has_sse2
.align 8
cpu_has_sse2:
_cpu_has_sse2:
# callee-save registers are $ebx, %esi, %edi, %esp, $ebp
# cpuid modifies %eax, %ebx, %ecx, %edx
# only %ebx needs to be saved/restored
push %ebx
movl $1, %eax
cpuid
movl %edx, %eax
sarl $26, %eax
andl $1, %eax
pop %ebx
ret

View File

@ -127,7 +127,16 @@ file_exists(char* filename){
return (s == 0);
}
extern int cpu_has_sse2();
int main(int argc, char** argv){
if(! cpu_has_sse2()){
fprintf(stderr, "Ikarus Scheme cannot run on your computer because\n");
fprintf(stderr, "your CPU does not support the SSE2 instruction set.\n");
fprintf(stderr, "Refer to the Ikarus Scheme User's Guide for the\n");
fprintf(stderr, "minimum hardware requirements.\n");
exit(-1);
}
if(get_option0("-h", argc, argv)){
ikarus_usage();
exit(0);