kern

diff src/regs.S @ 13:6c9138a87e02

added register dump in panic()
author John Tsiombikas <nuclear@member.fsf.org>
date Wed, 23 Feb 2011 00:12:36 +0200
parents
children a5176aa334c3
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/regs.S	Wed Feb 23 00:12:36 2011 +0200
     1.3 @@ -0,0 +1,54 @@
     1.4 +	.text
     1.5 +	.align 4
     1.6 +
     1.7 +	.globl get_regs
     1.8 +get_regs:
     1.9 +	pushl %ebp
    1.10 +	movl %esp, %ebp
    1.11 +
    1.12 +	pushl %edx
    1.13 +	movl 8(%ebp), %edx
    1.14 +
    1.15 +	movl %eax, (%edx)
    1.16 +	movl %ebx, 4(%edx)
    1.17 +	movl %ecx, 8(%edx)
    1.18 +	
    1.19 +	/* juggle edx */
    1.20 +	movl %edx, %eax
    1.21 +	popl %edx
    1.22 +	movl %edx, 12(%eax)
    1.23 +	pushl %edx
    1.24 +	movl %eax, %edx
    1.25 +	
    1.26 +	/* those two are pointless in a function */
    1.27 +	movl %esp, 16(%edx)
    1.28 +	movl %ebp, 20(%edx)
    1.29 +
    1.30 +	movl %esi, 24(%edx)
    1.31 +	movl %edi, 28(%edx)
    1.32 +
    1.33 +	pushf
    1.34 +	popl %eax
    1.35 +	movl %eax, 32(%edx)
    1.36 +
    1.37 +	movw %cs, 36(%edx)
    1.38 +	movw %ss, 40(%edx)
    1.39 +	movw %ds, 44(%edx)
    1.40 +	movw %es, 48(%edx)
    1.41 +	movw %fs, 52(%edx)
    1.42 +	movw %gs, 56(%edx)
    1.43 +
    1.44 +	pushl %ebx
    1.45 +	movl %cr0, %ebx
    1.46 +	movl %ebx, 60(%edx)
    1.47 +	/*movl %cr1, %ebx
    1.48 +	movl %ebx, 64(%edx)*/
    1.49 +	movl %cr3, %ebx
    1.50 +	movl %ebx, 68(%edx)
    1.51 +	movl %cr4, %ebx
    1.52 +	movl %ebx, 72(%edx)
    1.53 +	popl %ebx
    1.54 +
    1.55 +	popl %edx
    1.56 +	popl %ebp
    1.57 +	ret