OLD | NEW |
1 ;; Copyright (C) 2013 Google Inc. All rights reserved. | 1 ;; Copyright (C) 2013 Google Inc. All rights reserved. |
2 ;; | 2 ;; |
3 ;; Redistribution and use in source and binary forms, with or without | 3 ;; Redistribution and use in source and binary forms, with or without |
4 ;; modification, are permitted provided that the following conditions are | 4 ;; modification, are permitted provided that the following conditions are |
5 ;; met: | 5 ;; met: |
6 ;; | 6 ;; |
7 ;; * Redistributions of source code must retain the above copyright | 7 ;; * Redistributions of source code must retain the above copyright |
8 ;; notice, this list of conditions and the following disclaimer. | 8 ;; notice, this list of conditions and the following disclaimer. |
9 ;; * Redistributions in binary form must reproduce the above | 9 ;; * Redistributions in binary form must reproduce the above |
10 ;; copyright notice, this list of conditions and the following disclaimer | 10 ;; copyright notice, this list of conditions and the following disclaimer |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 ;; Pop the callee-saved registers. None of them were | 94 ;; Pop the callee-saved registers. None of them were |
95 ;; modified so no restoring is needed. | 95 ;; modified so no restoring is needed. |
96 add rsp, 56 | 96 add rsp, 56 |
97 ret | 97 ret |
98 | 98 |
99 %elif X64WIN | 99 %elif X64WIN |
100 | 100 |
101 mangle(pushAllRegisters): | 101 mangle(pushAllRegisters): |
102 ;; Push all callee-saves registers to get them | 102 ;; Push all callee-saves registers to get them |
103 ;; on the stack for conservative stack scanning. | 103 ;; on the stack for conservative stack scanning. |
| 104 ;; There is an 8-byte return address on the stack and we push |
| 105 ;; 72 bytes which maintains the required 16-byte stack alignment |
| 106 ;; at the call. |
| 107 push 0 |
104 push rsi | 108 push rsi |
105 push rdi | 109 push rdi |
106 push rbx | 110 push rbx |
107 push rbp | 111 push rbp |
108 push r12 | 112 push r12 |
109 push r13 | 113 push r13 |
110 push r14 | 114 push r14 |
111 push r15 | 115 push r15 |
112 ;; Pass the two first arguments unchanged (rcx, rdx) | 116 ;; Pass the two first arguments unchanged (rcx, rdx) |
113 ;; and the stack pointer after pushing callee-saved | 117 ;; and the stack pointer after pushing callee-saved |
114 ;; registers to the callback. | 118 ;; registers to the callback. |
115 mov r9, r8 | 119 mov r9, r8 |
116 mov r8, rsp | 120 mov r8, rsp |
117 call r9 | 121 call r9 |
118 ;; Pop the callee-saved registers. None of them were | 122 ;; Pop the callee-saved registers. None of them were |
119 ;; modified so no restoring is needed. | 123 ;; modified so no restoring is needed. |
120 add rsp, 64 | 124 add rsp, 72 |
121 ret | 125 ret |
122 | 126 |
123 %elif IA32 | 127 %elif IA32 |
124 | 128 |
125 mangle(pushAllRegisters): | 129 mangle(pushAllRegisters): |
126 ;; Push all callee-saves registers to get them | 130 ;; Push all callee-saves registers to get them |
127 ;; on the stack for conservative stack scanning. | 131 ;; on the stack for conservative stack scanning. |
128 ;; We maintain 16-byte alignment at calls (required on | 132 ;; We maintain 16-byte alignment at calls (required on |
129 ;; Mac). There is a 4-byte return address on the stack | 133 ;; Mac). There is a 4-byte return address on the stack |
130 ;; and we push 28 bytes which maintains 16-byte alignment | 134 ;; and we push 28 bytes which maintains 16-byte alignment |
(...skipping 15 matching lines...) Expand all Loading... |
146 ;; so we do not need to restore them. | 150 ;; so we do not need to restore them. |
147 add esp, 28 | 151 add esp, 28 |
148 ret | 152 ret |
149 | 153 |
150 | 154 |
151 %elif ARM | 155 %elif ARM |
152 %error "Yasm does not support arm. Use SaveRegisters_arm.S on arm." | 156 %error "Yasm does not support arm. Use SaveRegisters_arm.S on arm." |
153 %else | 157 %else |
154 %error "Unsupported platform." | 158 %error "Unsupported platform." |
155 %endif | 159 %endif |
OLD | NEW |