1.0.3.44: x86-64 print vop preserves 16-byte stack alignment
[sbcl.git] / src / compiler / x86-64 / show.lisp
1 ;;;; VOPs which are useful for following the progress of the system
2 ;;;; early in boot
3
4 ;;;; This software is part of the SBCL system. See the README file for
5 ;;;; more information.
6 ;;;;
7 ;;;; This software is derived from the CMU CL system, which was
8 ;;;; written at Carnegie Mellon University and released into the
9 ;;;; public domain. The software is in the public domain and is
10 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
11 ;;;; files for more information.
12
13 (in-package "SB!VM")
14
15 ;;; FIXME: should probably become conditional on #!+SB-SHOW
16 ;;; FIXME: should be called DEBUG-PRINT or COLD-PRINT
17 (define-vop (print)
18   (:args (object :scs (descriptor-reg any-reg)))
19   (:temporary (:sc unsigned-reg
20                :offset rax-offset
21                :target result
22                :from :eval
23                :to (:result 0))
24               rax)
25   (:temporary (:sc unsigned-reg) call-target)
26   (:results (result :scs (descriptor-reg)))
27   (:save-p t)
28   (:generator 100
29     (move rax object)
30     (inst push rbp-tn)
31     (inst mov rbp-tn rsp-tn)
32     (inst push rbp-tn)
33     (inst and rsp-tn -16)
34     (storew rax rsp-tn)
35     (inst lea rax (make-fixup "debug_print" :foreign))
36     (inst lea call-target
37           (make-ea :qword
38                    :disp (make-fixup "call_into_c" :foreign)))
39     (inst call call-target)
40     (inst mov rsp-tn rbp-tn)
41     (inst pop rbp-tn)
42     (move result rax)))