From d03c5256539116066daaa8a515d759593b3f8117 Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Sun, 19 Jun 2011 11:53:48 -0700 Subject: [PATCH] Punt fpu inits in i386/x86-64 assembler; add to savres.scm. --- src/microcode/cmpauxmd/i386.m4 | 6 ----- src/microcode/cmpauxmd/x86-64.m4 | 18 ------------- src/microcode/cmpintmd/x86-64.c | 2 -- src/runtime/savres.scm | 46 +++++++++++++++++--------------- 4 files changed, 24 insertions(+), 48 deletions(-) diff --git a/src/microcode/cmpauxmd/i386.m4 b/src/microcode/cmpauxmd/i386.m4 index 9d1273e4d..5e56c13ee 100644 --- a/src/microcode/cmpauxmd/i386.m4 +++ b/src/microcode/cmpauxmd/i386.m4 @@ -406,12 +406,6 @@ ifdef(`VALGRIND_MODE',`',` jne i386_initialize_no_fp ') OP(inc,l) REG(eax) # 387 available - OP(sub,l) TW(IMM(4),REG(esp)) - fclex - fnstcw WOF(-2,REG(ebp)) - OP(and,w) TW(IMM(HEX(f0e0)),WOF(-2,REG(ebp))) - OP(or,w) TW(IMM(FP_CONTROL_WORD),WOF(-2,REG(ebp))) - fldcw WOF(-2,REG(ebp)) i386_initialize_no_fp: ') OP(mov,l) TW(REG(eax),ABS(EVR(i387_presence))) diff --git a/src/microcode/cmpauxmd/x86-64.m4 b/src/microcode/cmpauxmd/x86-64.m4 index 864f416e1..19010da73 100644 --- a/src/microcode/cmpauxmd/x86-64.m4 +++ b/src/microcode/cmpauxmd/x86-64.m4 @@ -356,24 +356,6 @@ define_double(flonum_one,1.0) DECLARE_CODE_SEGMENT() declare_alignment(2) -define_c_label(x86_64_interface_initialize) - OP(push,q) REG(rbp) - OP(mov,q) TW(REG(rsp),REG(rbp)) - OP(sub,q) TW(IMM(8),REG(rsp)) - stmxcsr IND(REG(rsp)) - # Clear 7 (invalid operation mask) - # 8 (denormalized operand mask) - # 9 (zero-divide exception mask) - # 10 (overflow exception mask) - # 11 (underflow exception mask) - # 15 (flush-to-zero (if set, gives non-IEEE semantics)) - OP(and,l) TW(IMM(HEX(ffff707f)),IND(REG(rsp))) - # Set 12 (precision exception mask) - OP(or,l) TW(IMM(HEX(1000)),IND(REG(rsp))) - ldmxcsr IND(REG(rsp)) - leave - ret - # Call a function (rdi) with an argument (rsi) and a stack pointer and # frame pointer from inside C. When it returns, restore the original # stack pointer. This kludge is necessary for operating system diff --git a/src/microcode/cmpintmd/x86-64.c b/src/microcode/cmpintmd/x86-64.c index e642ba1fc..e9f3b1b10 100644 --- a/src/microcode/cmpintmd/x86-64.c +++ b/src/microcode/cmpintmd/x86-64.c @@ -224,8 +224,6 @@ x86_64_reset_hook (void) int offset = (COMPILER_REGBLOCK_N_FIXED * (sizeof (SCHEME_OBJECT))); unsigned char * rsi_value = ((unsigned char *) Registers); - x86_64_interface_initialize (); - /* These must match machines/x86-64/lapgen.scm */ SETUP_REGISTER (asm_scheme_to_interface); /* 0 */ diff --git a/src/runtime/savres.scm b/src/runtime/savres.scm index de8f3fa7c..0310f95fc 100644 --- a/src/runtime/savres.scm +++ b/src/runtime/savres.scm @@ -52,28 +52,30 @@ USA. (lambda () (call-with-current-continuation (lambda (continuation) - ;; GC cannot be allowed before the fixed-objects-vector - ;; is reset after restoring. - (with-absolutely-no-interrupts - (lambda () - (let ((fixed-objects (get-fixed-objects-vector))) - ((ucode-primitive call-with-current-continuation) - (lambda (restart) - (with-interrupt-mask interrupt-mask/gc-ok - (lambda (interrupt-mask) - interrupt-mask - (gc-flip) - (do () - (((ucode-primitive dump-band) restart filename)) - (with-simple-restart 'RETRY "Try again." - (lambda () - (error "Disk save failed:" filename)))) - (continuation - (lambda () - (set! time-world-saved time) - (if (string? id) unspecific #f))))))) - ((ucode-primitive set-fixed-objects-vector!) fixed-objects)))) - (read-microcode-tables!) + (let ((float-env (flo:environment))) + ;; GC cannot be allowed before the fixed-objects-vector + ;; is reset after restoring. + (with-absolutely-no-interrupts + (lambda () + (let ((fixed-objects (get-fixed-objects-vector))) + ((ucode-primitive call-with-current-continuation) + (lambda (restart) + (with-interrupt-mask interrupt-mask/gc-ok + (lambda (interrupt-mask) + interrupt-mask + (gc-flip) + (do () + (((ucode-primitive dump-band) restart filename)) + (with-simple-restart 'RETRY "Try again." + (lambda () + (error "Disk save failed:" filename)))) + (continuation + (lambda () + (set! time-world-saved time) + (if (string? id) unspecific #f))))))) + ((ucode-primitive set-fixed-objects-vector!) fixed-objects)))) + (read-microcode-tables!) + (flo:set-environment! float-env)) (lambda () (set! time-world-saved time) (fluid-let ((*within-restore-window?* #t)) -- 2.25.1