Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 8 Apr 2012 04:36:27 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r234014 - head/lib/libc/arm/gen
Message-ID:  <201204080436.q384aRXS093116@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andrew
Date: Sun Apr  8 04:36:27 2012
New Revision: 234014
URL: http://svn.freebsd.org/changeset/base/234014

Log:
  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)

Modified:
  head/lib/libc/arm/gen/__aeabi_read_tp.c

Modified: head/lib/libc/arm/gen/__aeabi_read_tp.c
==============================================================================
--- head/lib/libc/arm/gen/__aeabi_read_tp.c	Sun Apr  8 04:22:09 2012	(r234013)
+++ head/lib/libc/arm/gen/__aeabi_read_tp.c	Sun Apr  8 04:36:27 2012	(r234014)
@@ -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;
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201204080436.q384aRXS093116>