kern

view src/regs.S @ 49:50730d42d2d3

fuck yeah, now do priviledge levels and TSS
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 30 Jul 2011 07:21:54 +0300
parents 6c9138a87e02
children
line source
1 .text
2 .align 4
4 .globl get_regs
5 get_regs:
6 pushl %ebp
7 movl %esp, %ebp
9 pushl %edx
10 movl 8(%ebp), %edx
12 movl %eax, (%edx)
13 movl %ebx, 4(%edx)
14 movl %ecx, 8(%edx)
16 /* juggle edx */
17 movl %edx, %eax
18 popl %edx
19 movl %edx, 12(%eax)
20 pushl %edx
21 movl %eax, %edx
23 /* those two are pointless in a function */
24 movl %esp, 16(%edx)
25 movl %ebp, 20(%edx)
27 movl %esi, 24(%edx)
28 movl %edi, 28(%edx)
30 pushf
31 popl %eax
32 movl %eax, 32(%edx)
34 movw %cs, 36(%edx)
35 movw %ss, 40(%edx)
36 movw %ds, 44(%edx)
37 movw %es, 48(%edx)
38 movw %fs, 52(%edx)
39 movw %gs, 56(%edx)
41 pushl %ebx
42 movl %cr0, %ebx
43 movl %ebx, 60(%edx)
44 /*movl %cr1, %ebx
45 movl %ebx, 64(%edx)*/
46 movl %cr2, %ebx
47 movl %ebx, 68(%edx)
48 movl %cr3, %ebx
49 movl %ebx, 72(%edx)
50 popl %ebx
52 popl %edx
53 popl %ebp
54 ret