[PATCH 3/3] libc_elf_mips: specific auxiliary vector handling for MIPS

Carmelo AMOROSO carmelo.amoroso at st.com
Mon May 2 16:44:03 UTC 2011


Extend aux vect handling for MIPS to retrieve DCache shape information
and platform string.

Signed-off-by: Carmelo Amoroso <carmelo.amoroso at st.com>
---
 libc/misc/elf/mips/dl-support.c        |   27 +++++++++++++++++++++++++++
 libc/sysdeps/linux/mips/bits/auxvect.h |   14 ++++++++++++++
 2 files changed, 41 insertions(+), 0 deletions(-)
 create mode 100644 libc/misc/elf/mips/dl-support.c
 create mode 100644 libc/sysdeps/linux/mips/bits/auxvect.h

diff --git a/libc/misc/elf/mips/dl-support.c b/libc/misc/elf/mips/dl-support.c
new file mode 100644
index 0000000..a6d0664
--- /dev/null
+++ b/libc/misc/elf/mips/dl-support.c
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2011 STMicroelectronics Ltd
+ * Author: Carmelo Amoroso <carmelo.amoroso at st.com>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ *
+ * It contains the SH arch specific part of aux vect code handling
+ * aimed to retrieve cache shape information
+ */
+
+#include <elf.h>
+
+/* Bits 0-3 contains associativity; bits 4-7 contains log2 of line size */
+attribute_hidden int __l1d_cache_shape = 0;
+
+attribute_hidden const char* __platform  = NULL;
+
+/* Retrieve arch specific data */
+#define DL_PLATFORM_AUXV													   \
+	case AT_L1D_CACHESHAPE:													   \
+		__l1d_cache_shape = (int) av[AT_L1D_CACHESHAPE].a_un.a_val;			   \
+		break;																   \
+	case AT_PLATFORM:														   \
+		__platform = (const char*) av[AT_PLATFORM].a_un.a_val;		   		   \
+		break;
+
+#include <libc/misc/elf/dl-support.c>
diff --git a/libc/sysdeps/linux/mips/bits/auxvect.h b/libc/sysdeps/linux/mips/bits/auxvect.h
new file mode 100644
index 0000000..617c663
--- /dev/null
+++ b/libc/sysdeps/linux/mips/bits/auxvect.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright (C) 2011 STMicroelectronics Ltd
+ * Author: Carmelo Amoroso <carmelo.amoroso at st.com>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ *
+ * It contains the MIPS arch specific macros of the aux vect code handling
+ * aimed to retrieve platform and cache shape information
+ */
+
+#include <elf.h>
+
+/* We need to get more entries from the auxvec up to L1D_CACHESHAPE */
+#define AT_EXTRA_UPTO		AT_L1D_CACHESHAPE
-- 
1.7.4.4



More information about the uClibc mailing list