diff options
author | Andrew Turner <andrew@FreeBSD.org> | 2012-04-08 04:36:27 +0000 |
---|---|---|
committer | Andrew Turner <andrew@FreeBSD.org> | 2012-04-08 04:36:27 +0000 |
commit | fcb6e7147b001b6627ad831f307f081d6f54176a (patch) | |
tree | 06ddbf7983bd027d3fb464e711bc929b86e9effe /lib/libc/arm/gen | |
parent | 72c3f707a4b02206369bd7ad267e8adf5fc1c459 (diff) |
Unlike other functions __aeabi_read_tp function must preserve r1-r3. The
currently generated code clobbers r3. Fix this by loading ARM_TP_ADDRESS
using inline assembly.
Approved by: imp (mentor)
Notes
Notes:
svn path=/head/; revision=234014
Diffstat (limited to 'lib/libc/arm/gen')
-rw-r--r-- | lib/libc/arm/gen/__aeabi_read_tp.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/libc/arm/gen/__aeabi_read_tp.c b/lib/libc/arm/gen/__aeabi_read_tp.c index 39b5fb798b7e..c2dd9789ef54 100644 --- a/lib/libc/arm/gen/__aeabi_read_tp.c +++ b/lib/libc/arm/gen/__aeabi_read_tp.c @@ -1,5 +1,6 @@ /*- * Copyright (c) 2012 Oleksandr Tymoshenko + * Copyright (c) 2012 Andrew Turner * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -36,7 +37,9 @@ __FBSDID("$FreeBSD$"); void * __aeabi_read_tp() { - void **_tp = (void **)ARM_TP_ADDRESS; + void *_tp; - return (*_tp); + asm("ldr %0, [%1]\n" : "=r"(_tp) : "r"(ARM_TP_ADDRESS)); + + return _tp; } |