summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorandrew <andrew@FreeBSD.org>2012-04-08 04:36:27 +0000
committerandrew <andrew@FreeBSD.org>2012-04-08 04:36:27 +0000
commitbc587058f9edfe90b3b0c442ec3d468ea7af2888 (patch)
tree06ddbf7983bd027d3fb464e711bc929b86e9effe /lib/libc
parentdad11110002a6b84d85da8ce28a358f51cad2d51 (diff)
downloadFreeBSD-src-bc587058f9edfe90b3b0c442ec3d468ea7af2888.zip
FreeBSD-src-bc587058f9edfe90b3b0c442ec3d468ea7af2888.tar.gz
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)
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/arm/gen/__aeabi_read_tp.c7
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 39b5fb7..c2dd978 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;
}
OpenPOWER on IntegriCloud