Search
lxdream.org :: lxdream :: r1198:407659e01ef0
lxdream 0.9.1
released Jun 29
Download Now
changeset1198:407659e01ef0
parent1197:904fba59a705
child1199:62d0a21fac1c
authorNathan Keynes <nkeynes@lxdream.org>
dateFri Dec 16 10:08:45 2011 +1000 (12 years ago)
Add volatile qualifier to return-address frobbing - works around optimizer
bug in GCC versions after 4.2
acinclude.m4
configure
src/sh4/mmu.c
src/sh4/sh4x86.in
src/sh4/shadow.c
1.1 --- a/acinclude.m4 Wed Dec 14 23:23:32 2011 +1000
1.2 +++ b/acinclude.m4 Fri Dec 16 10:08:45 2011 +1000
1.3 @@ -51,7 +51,7 @@
1.4 int __attribute__((noinline)) foo( int arg, void *exc )
1.5 {
1.6 if( arg < 2 ) {
1.7 - *(((void **)__builtin_frame_address(0))+1) = exc;
1.8 + *(((void * volatile *)__builtin_frame_address(0))+1) = exc;
1.9 }
1.10 return 0;
1.11 }
2.1 --- a/configure Wed Dec 14 23:23:32 2011 +1000
2.2 +++ b/configure Fri Dec 16 10:08:45 2011 +1000
2.3 @@ -8203,7 +8203,7 @@
2.4 int __attribute__((noinline)) foo( int arg, void *exc )
2.5 {
2.6 if( arg < 2 ) {
2.7 - *(((void **)__builtin_frame_address(0))+1) = exc;
2.8 + *(((void * volatile *)__builtin_frame_address(0))+1) = exc;
2.9 }
2.10 return 0;
2.11 }
3.1 --- a/src/sh4/mmu.c Wed Dec 14 23:23:32 2011 +1000
3.2 +++ b/src/sh4/mmu.c Fri Dec 16 10:08:45 2011 +1000
3.3 @@ -1199,7 +1199,7 @@
3.4
3.5 /********************** TLB Direct-Access Regions ***************************/
3.6 #ifdef HAVE_FRAME_ADDRESS
3.7 -#define EXCEPTION_EXIT() do{ *(((void **)__builtin_frame_address(0))+1) = exc; } while(0)
3.8 +#define EXCEPTION_EXIT() do{ *(((void * volatile *)__builtin_frame_address(0))+1) = exc; } while(0)
3.9 #else
3.10 #define EXCEPTION_EXIT() sh4_core_exit(CORE_EXIT_EXCEPTION)
3.11 #endif
4.1 --- a/src/sh4/sh4x86.in Wed Dec 14 23:23:32 2011 +1000
4.2 +++ b/src/sh4/sh4x86.in Fri Dec 16 10:08:45 2011 +1000
4.3 @@ -604,7 +604,7 @@
4.4 *(void **)(backpatch+5) = XLAT_BLOCK_FOR_CODE(target)->use_list;
4.5 XLAT_BLOCK_FOR_CODE(target)->use_list = backpatch;
4.6
4.7 - uint8_t **retptr = ((uint8_t **)__builtin_frame_address(0))+1;
4.8 + uint8_t * volatile *retptr = ((uint8_t * volatile *)__builtin_frame_address(0))+1;
4.9 assert( *retptr == ((uint8_t *)__builtin_return_address(0)) );
4.10 *retptr = backpatch;
4.11 }
5.1 --- a/src/sh4/shadow.c Wed Dec 14 23:23:32 2011 +1000
5.2 +++ b/src/sh4/shadow.c Fri Dec 16 10:08:45 2011 +1000
5.3 @@ -31,7 +31,7 @@
5.4 #ifdef HAVE_FRAME_ADDRESS
5.5 static FASTCALL __attribute__((noinline)) void *__first_arg(void *a, void *b) { return a; }
5.6 #define INIT_EXCEPTIONS(label) goto *__first_arg(&&fnstart,&&label); fnstart:
5.7 -#define EXCEPTION_EXIT(exc) do{ *(((void **)__builtin_frame_address(0))+1) = exc; } while(0)
5.8 +#define EXCEPTION_EXIT(exc) do{ *(((void * volatile *)__builtin_frame_address(0))+1) = exc; } while(0)
5.9 #else
5.10 #define INIT_EXCEPTIONS(label)
5.11 #define EXCEPTION_EXIT() sh4_core_exit(CORE_EXIT_EXCEPTION)
.