Search
lxdream.org :: lxdream/src/sh4/ia64abi.h :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/sh4/ia64abi.h
changeset 580:508dc852a8eb
prev577:a181aeacd6e8
author nkeynes
date Tue Jan 15 02:20:30 2008 +0000 (12 years ago)
branchlxdream-mmu
permissions -rw-r--r--
last change Fix x86-64 support for mmu changes
file annotate diff log raw
1.1 --- a/src/sh4/ia64abi.h Mon Jan 14 10:23:49 2008 +0000
1.2 +++ b/src/sh4/ia64abi.h Tue Jan 15 02:20:30 2008 +0000
1.3 @@ -20,6 +20,7 @@
1.4 #ifndef __lxdream_x86_64abi_H
1.5 #define __lxdream_x86_64abi_H 1
1.6
1.7 +#include <unwind.h>
1.8
1.9 #define load_ptr( reg, ptr ) load_imm64( reg, (uint64_t)ptr );
1.10
1.11 @@ -159,7 +160,7 @@
1.12 ADD_sh4r_r32( R_PC, R_ECX );
1.13 store_spreg( R_ECX, REG_OFFSET(pc) ); // 3
1.14 if( IS_IN_ICACHE(pc) ) {
1.15 - MOV_moff32_EAX( xlat_get_lut_entry(GET_ICACHE_PHYS(pc)) ); // 5
1.16 + REXW(); MOV_moff32_EAX( xlat_get_lut_entry(GET_ICACHE_PHYS(pc)) ); // 5
1.17 } else if( sh4_x86.tlb_on ) {
1.18 call_func1(xlat_get_code_by_vma,R_ECX);
1.19 } else {
1.20 @@ -235,27 +236,24 @@
1.21 }
1.22 }
1.23
1.24 +_Unwind_Reason_Code xlat_check_frame( struct _Unwind_Context *context, void *arg )
1.25 +{
1.26 + void *rbp = (void *)_Unwind_GetGR(context, 6);
1.27 + if( rbp == (void *)&sh4r ) {
1.28 + void **result = (void **)arg;
1.29 + *result = (void *)_Unwind_GetIP(context);
1.30 + return _URC_NORMAL_STOP;
1.31 + }
1.32 +
1.33 + return _URC_NO_REASON;
1.34 +}
1.35
1.36 void *xlat_get_native_pc()
1.37 {
1.38 + struct _Unwind_Exception exc;
1.39 +
1.40 void *result = NULL;
1.41 - asm(
1.42 - "mov %%rbp, %%rax\n\t"
1.43 - "mov $0x8, %%ecx\n\t"
1.44 - "mov %1, %%rdx\n"
1.45 -"frame_loop: test %%rax, %%rax\n\t"
1.46 - "je frame_not_found\n\t"
1.47 - "cmpq (%%rax), %%rdx\n\t"
1.48 - "je frame_found\n\t"
1.49 - "sub $0x1, %%ecx\n\t"
1.50 - "je frame_not_found\n\t"
1.51 - "movq (%%rax), %%rax\n\t"
1.52 - "jmp frame_loop\n"
1.53 -"frame_found: movq 0x4(%%rax), %0\n"
1.54 -"frame_not_found:"
1.55 - : "=r" (result)
1.56 - : "r" (&sh4r)
1.57 - : "rax", "rcx", "rdx" );
1.58 + _Unwind_Backtrace( xlat_check_frame, &result );
1.59 return result;
1.60 }
1.61
.