Rev 3022 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3022 | Rev 4055 | ||
---|---|---|---|
Line 24... | Line 24... | ||
24 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | # |
27 | # |
28 | 28 | ||
29 | #define IREGISTER_SPACE 120 |
29 | #define IREGISTER_SPACE 72 |
30 | 30 | ||
31 | #define IOFFSET_RAX 0x0 |
31 | #define IOFFSET_RAX 0x0 |
32 | #define IOFFSET_RBX 0x8 |
32 | #define IOFFSET_RCX 0x8 |
33 | #define IOFFSET_RCX 0x10 |
33 | #define IOFFSET_RDX 0x10 |
34 | #define IOFFSET_RDX 0x18 |
34 | #define IOFFSET_RSI 0x18 |
35 | #define IOFFSET_RSI 0x20 |
35 | #define IOFFSET_RDI 0x20 |
36 | #define IOFFSET_RDI 0x28 |
36 | #define IOFFSET_R8 0x28 |
37 | #define IOFFSET_R8 0x30 |
- | |
38 | #define IOFFSET_R9 0x38 |
37 | #define IOFFSET_R9 0x30 |
39 | #define IOFFSET_R10 0x40 |
38 | #define IOFFSET_R10 0x38 |
40 | #define IOFFSET_R11 0x48 |
39 | #define IOFFSET_R11 0x40 |
41 | #define IOFFSET_R12 0x50 |
- | |
42 | #define IOFFSET_R13 0x58 |
- | |
43 | #define IOFFSET_R14 0x60 |
- | |
44 | #define IOFFSET_R15 0x68 |
- | |
45 | #define IOFFSET_RBP 0x70 |
- | |
46 | 40 | ||
47 | # Mask for interrupts 0 - 31 (bits 0 - 31) where 0 means that int has no error word |
41 | # Mask for interrupts 0 - 31 (bits 0 - 31) where 0 means that int has no error word |
48 | # and 1 means interrupt with error word |
42 | # and 1 means interrupt with error word |
49 | #define ERROR_WORD_INTERRUPT_LIST 0x00027D00 |
43 | #define ERROR_WORD_INTERRUPT_LIST 0x00027D00 |
50 | 44 | ||
Line 63... | Line 57... | ||
63 | .global cpuid |
57 | .global cpuid |
64 | .global has_cpuid |
58 | .global has_cpuid |
65 | .global get_cycle |
59 | .global get_cycle |
66 | .global read_efer_flag |
60 | .global read_efer_flag |
67 | .global set_efer_flag |
61 | .global set_efer_flag |
- | 62 | .global memsetb |
|
- | 63 | .global memsetw |
|
68 | .global memcpy |
64 | .global memcpy |
69 | .global memcpy_from_uspace |
65 | .global memcpy_from_uspace |
70 | .global memcpy_to_uspace |
66 | .global memcpy_to_uspace |
71 | .global memcpy_from_uspace_failover_address |
67 | .global memcpy_from_uspace_failover_address |
72 | .global memcpy_to_uspace_failover_address |
68 | .global memcpy_to_uspace_failover_address |
73 | 69 | ||
- | 70 | # Wrapper for generic memsetb |
|
- | 71 | memsetb: |
|
- | 72 | jmp _memsetb |
|
- | 73 | ||
- | 74 | # Wrapper for generic memsetw |
|
- | 75 | memsetw: |
|
- | 76 | jmp _memsetw |
|
- | 77 | ||
74 | #define MEMCPY_DST %rdi |
78 | #define MEMCPY_DST %rdi |
75 | #define MEMCPY_SRC %rsi |
79 | #define MEMCPY_SRC %rsi |
76 | #define MEMCPY_SIZE %rdx |
80 | #define MEMCPY_SIZE %rdx |
77 | 81 | ||
78 | /** |
82 | /** |
Line 86... | Line 90... | ||
86 | * |
90 | * |
87 | * @param MEMCPY_DST Destination address. |
91 | * @param MEMCPY_DST Destination address. |
88 | * @param MEMCPY_SRC Source address. |
92 | * @param MEMCPY_SRC Source address. |
89 | * @param MEMCPY_SIZE Number of bytes to copy. |
93 | * @param MEMCPY_SIZE Number of bytes to copy. |
90 | * |
94 | * |
91 | * @retrun MEMCPY_SRC on success, 0 on failure. |
95 | * @retrun MEMCPY_DST on success, 0 on failure. |
92 | */ |
96 | */ |
93 | memcpy: |
97 | memcpy: |
94 | memcpy_from_uspace: |
98 | memcpy_from_uspace: |
95 | memcpy_to_uspace: |
99 | memcpy_to_uspace: |
96 | movq MEMCPY_SRC, %rax |
100 | movq MEMCPY_DST, %rax |
97 | 101 | ||
98 | movq MEMCPY_SIZE, %rcx |
102 | movq MEMCPY_SIZE, %rcx |
99 | shrq $3, %rcx /* size / 8 */ |
103 | shrq $3, %rcx /* size / 8 */ |
100 | 104 | ||
101 | rep movsq /* copy as much as possible word by word */ |
105 | rep movsq /* copy as much as possible word by word */ |
Line 161... | Line 165... | ||
161 | read_efer_flag: |
165 | read_efer_flag: |
162 | movq $0xc0000080, %rcx |
166 | movq $0xc0000080, %rcx |
163 | rdmsr |
167 | rdmsr |
164 | ret |
168 | ret |
165 | 169 | ||
166 | # Push all general purpose registers on stack except %rbp, %rsp |
170 | # Push all volatile general purpose registers on stack |
167 | .macro save_all_gpr |
171 | .macro save_all_gpr |
168 | movq %rax, IOFFSET_RAX(%rsp) |
172 | movq %rax, IOFFSET_RAX(%rsp) |
169 | movq %rcx, IOFFSET_RCX(%rsp) |
173 | movq %rcx, IOFFSET_RCX(%rsp) |
170 | movq %rdx, IOFFSET_RDX(%rsp) |
174 | movq %rdx, IOFFSET_RDX(%rsp) |
171 | movq %rsi, IOFFSET_RSI(%rsp) |
175 | movq %rsi, IOFFSET_RSI(%rsp) |
172 | movq %rdi, IOFFSET_RDI(%rsp) |
176 | movq %rdi, IOFFSET_RDI(%rsp) |
173 | movq %r8, IOFFSET_R8(%rsp) |
177 | movq %r8, IOFFSET_R8(%rsp) |
174 | movq %r9, IOFFSET_R9(%rsp) |
178 | movq %r9, IOFFSET_R9(%rsp) |
175 | movq %r10, IOFFSET_R10(%rsp) |
179 | movq %r10, IOFFSET_R10(%rsp) |
176 | movq %r11, IOFFSET_R11(%rsp) |
180 | movq %r11, IOFFSET_R11(%rsp) |
177 | #ifdef CONFIG_DEBUG_ALLREGS |
- | |
178 | movq %rbx, IOFFSET_RBX(%rsp) |
- | |
179 | movq %rbp, IOFFSET_RBP(%rsp) |
- | |
180 | movq %r12, IOFFSET_R12(%rsp) |
- | |
181 | movq %r13, IOFFSET_R13(%rsp) |
- | |
182 | movq %r14, IOFFSET_R14(%rsp) |
- | |
183 | movq %r15, IOFFSET_R15(%rsp) |
- | |
184 | #endif |
- | |
185 | .endm |
181 | .endm |
186 | 182 | ||
187 | .macro restore_all_gpr |
183 | .macro restore_all_gpr |
188 | movq IOFFSET_RAX(%rsp), %rax |
184 | movq IOFFSET_RAX(%rsp), %rax |
189 | movq IOFFSET_RCX(%rsp), %rcx |
185 | movq IOFFSET_RCX(%rsp), %rcx |
Line 192... | Line 188... | ||
192 | movq IOFFSET_RDI(%rsp), %rdi |
188 | movq IOFFSET_RDI(%rsp), %rdi |
193 | movq IOFFSET_R8(%rsp), %r8 |
189 | movq IOFFSET_R8(%rsp), %r8 |
194 | movq IOFFSET_R9(%rsp), %r9 |
190 | movq IOFFSET_R9(%rsp), %r9 |
195 | movq IOFFSET_R10(%rsp), %r10 |
191 | movq IOFFSET_R10(%rsp), %r10 |
196 | movq IOFFSET_R11(%rsp), %r11 |
192 | movq IOFFSET_R11(%rsp), %r11 |
197 | #ifdef CONFIG_DEBUG_ALLREGS |
- | |
198 | movq IOFFSET_RBX(%rsp), %rbx |
- | |
199 | movq IOFFSET_RBP(%rsp), %rbp |
- | |
200 | movq IOFFSET_R12(%rsp), %r12 |
- | |
201 | movq IOFFSET_R13(%rsp), %r13 |
- | |
202 | movq IOFFSET_R14(%rsp), %r14 |
- | |
203 | movq IOFFSET_R15(%rsp), %r15 |
- | |
204 | #endif |
- | |
205 | .endm |
193 | .endm |
206 | 194 | ||
207 | #ifdef CONFIG_DEBUG_ALLREGS |
- | |
208 | # define INTERRUPT_ALIGN 256 |
- | |
209 | #else |
- | |
210 | # define INTERRUPT_ALIGN 128 |
195 | #define INTERRUPT_ALIGN 128 |
211 | #endif |
- | |
212 | 196 | ||
213 | ## Declare interrupt handlers |
197 | ## Declare interrupt handlers |
214 | # |
198 | # |
215 | # Declare interrupt handlers for n interrupt |
199 | # Declare interrupt handlers for n interrupt |
216 | # vectors starting at vector i. |
200 | # vectors starting at vector i. |