[cmucl-cvs] [git] CMU Common Lisp branch master updated. snapshot-2012-07-6-g5e57578
Raymond Toy
rtoy at common-lisp.net
Wed Jul 18 02:35:30 UTC 2012
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMU Common Lisp".
The branch, master has been updated
via 5e57578ad6f1d02d86379986f79755e993ce2c72 (commit)
via ea2dae80bcc9be55607ce8d9b62c268db53e98c5 (commit)
from 5a06638f9d7e8309d4bb8eee49436489d5ce525f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 5e57578ad6f1d02d86379986f79755e993ce2c72
Author: Raymond Toy <toy.raymond at gmail.com>
Date: Tue Jul 17 19:35:23 2012 -0700
Fix possible stack corruption caused by possibly not allocating enough
stack space to hold the SSE2 state. (Forgot to add extra bytes for
16-byte alignment!)
diff --git a/src/lisp/x86-assem.S b/src/lisp/x86-assem.S
index 34c1ef0..57b69c0 100644
--- a/src/lisp/x86-assem.S
+++ b/src/lisp/x86-assem.S
@@ -172,7 +172,11 @@ FUNCDEF(call_into_lisp)
cmp $2, %eax # SSE2 mode?
jne x87_save
movl %esp, %eax # Remember the current stack pointer
- subl $512,%esp # Make room for the SSE state
+ /*
+ * The SSE state is 512 bytes, but we need 16 more because we
+ * need 16-byte alignment.
+ */
+ subl $512+16,%esp
andl $-16, %esp # fxsave needs 16-byte alignment
fxsave (%esp)
pushl %eax # Save the old stack pointer
@@ -194,7 +198,7 @@ x87_save:
fldcw (%esp) # Recover modes
popl %eax
npx_save_done:
-
+ /* Is this still necessary with sse2? */
fldz # insure no FP regs are empty
fldz
fldz
commit ea2dae80bcc9be55607ce8d9b62c268db53e98c5
Author: Raymond Toy <toy.raymond at gmail.com>
Date: Tue Jul 17 19:32:17 2012 -0700
Clean up and correct some comments.
diff --git a/src/compiler/x86/macros.lisp b/src/compiler/x86/macros.lisp
index 21b68e4..ca2c267 100644
--- a/src/compiler/x86/macros.lisp
+++ b/src/compiler/x86/macros.lisp
@@ -140,22 +140,25 @@
(defun inline-allocation (alloc-tn size)
(let ((ok (gen-label))
(done (gen-label)))
- ;;
+
;; Load the size first so that the size can be in the same
;; register as alloc-tn.
(load-size alloc-tn alloc-tn size)
- ;;
+
+ ;; Try inline allocation, incrementing the
+ ;; current-region-free-pointer by the size. If we didn't pass the
+ ;; end of the region, then inline allocation succeeded, and we're
+ ;; done.
(inst add alloc-tn
(make-symbol-value-ea '*current-region-free-pointer*))
(inst cmp alloc-tn
(make-symbol-value-ea '*current-region-end-addr*))
(inst jmp :be OK)
- ;; Inline allocation didn't work so we need to call alloc, carefully.
-
- ;; Recompute the size. Can't just reload size because it might
- ;; have already been destroyed if size = alloc-tn (which does
- ;; happen).
+ ;; Inline allocation didn't work so we need to call alloc,
+ ;; carefully. Need to recompute the size because we can't just
+ ;; reload size because it might have already been destroyed if
+ ;; size = alloc-tn (which does happen).
(inst sub alloc-tn (make-symbol-value-ea '*current-region-free-pointer*))
(case (tn-offset alloc-tn)
(#.eax-offset
@@ -169,7 +172,7 @@
(inst call (make-fixup (extern-alien-name #-sse2 "alloc_overflow_x87"
#+sse2 "alloc_overflow_sse2")
:foreign))
- (inst mov alloc-tn eax-tn) ; Save allocated address in alloc-tn
+ (inst mov alloc-tn eax-tn) ; Put allocated address in alloc-tn
(inst pop eax-tn) ; Restore old value of eax
(inst jmp done)))
@@ -181,8 +184,7 @@
(values))
(defun not-inline-allocation (alloc-tn size)
- ;; C call to allocate via dispatch routines. Each destination has a
- ;; special entry point. The size may be a register or a constant.
+ ;; C call to allocate. The size may be a register or a constant.
(load-size alloc-tn alloc-tn size)
(case (tn-offset alloc-tn)
(#.eax-offset
diff --git a/src/lisp/x86-assem.S b/src/lisp/x86-assem.S
index 9583e84..34c1ef0 100644
--- a/src/lisp/x86-assem.S
+++ b/src/lisp/x86-assem.S
@@ -484,7 +484,7 @@ FUNCDEF(alloc_overflow_sse2)
movl %ecx, 8(%esp) # Save ecx and edx registers
movl %edx, 4(%esp)
stmxcsr 12(%esp) # Save MXCSR
- /* Clear the exceptions that might occurred */
+ /* Clear the exceptions that might have occurred */
movl 12(%esp), %edx
and $-64, %edx # Clear the exceptions
movl %edx, 16(%esp)
-----------------------------------------------------------------------
Summary of changes:
src/compiler/x86/macros.lisp | 22 ++++++++++++----------
src/lisp/x86-assem.S | 10 +++++++---
2 files changed, 19 insertions(+), 13 deletions(-)
hooks/post-receive
--
CMU Common Lisp
More information about the cmucl-cvs
mailing list