filename | src/sh4/ia32asm.s |
changeset | 571:9bc09948d0f2 |
author | nkeynes |
date | Mon Jan 14 09:08:58 2008 +0000 (16 years ago) |
branch | lxdream-mmu |
permissions | -rw-r--r-- |
last change | Fix TRAPA in emulator core |
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 %ebp, %eax
16 mov $0x8, %ecx
17 mov $sh4r, %edx
19 frame_loop:
20 test %eax, %eax
21 je frame_not_found
22 cmp (%eax), %edx
23 je frame_found
24 sub $0x1, %ecx
25 je frame_not_found
26 movl (%eax), %eax
27 jmp frame_loop
29 frame_found:
30 movl 0x4(%eax), %eax
31 ret
32 frame_not_found:
33 xor %eax, %eax
34 ret
.