Search
lxdream.org :: lxdream/src/sh4/ia64asm.s
lxdream 0.9.1
released Jun 29
Download Now
filename src/sh4/ia64asm.s
changeset 571:9bc09948d0f2
author nkeynes
date Tue Jan 22 11:30:37 2008 +0000 (16 years ago)
permissions -rw-r--r--
last change Fix backpatching when the block moves during translation
view annotate diff log raw
     1 # 
     2 # Scan back through the stack until we hit the currently executing
     3 # translation block, and find the call return address to that block.
     4 # 
     5 # Implementation: iterate back through each stack frame until we find
     6 # a frame that has a saved %ebp == sh4r (setup by the xlat blocks).
     7 # The return address is then the stack value immediately before the
     8 # saved %ebp.
     9 #
    10 # At most 8 stack frames are checked, to prevent infinite looping on a
    11 # corrupt stack.
    13 .global xlat_get_native_pc
    14 xlat_get_native_pc:
    15 	mov %rbp, %rax
    16 	mov $0x8, %ecx
    17 	mov $sh4r, %rdx
    19 frame_loop:
    20 	test %rax, %rax
    21 	je frame_not_found
    22 	cmpq (%rax), %rdx
    23 	je frame_found
    24 	sub $0x1, %ecx
    25 	je frame_not_found
    26 	movq (%rax), %rax
    27 	jmp frame_loop
    29 frame_found:
    30 	movl 0x4(%rax), %rax
    31 	ret
    32 frame_not_found:
    33 	xor %rax, %rax
    34 	ret
.