This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] libgloss: bfin: add clear_cache_range support (for gcc)


i've committed this patch to libgloss.

2011-12-18  Mike Frysinger  <vapier@gentoo.org>

	* bfin/clear_cache_range.c: New file.
	* bfin/Makefile.in (SIM_OBJS): Add clear_cache_range.o.
	(BOARD_OBJS): Likewise.
	(BOARD_BSP): Set to libbfinbsp.a.
	(${BOARD_BSP}): New rule.

--- bfin/Makefile.in
+++ bfin/Makefile.in
@@ -55,7 +55,7 @@
 SIM_LDFLAGS	=
 SIM_BSP		= libsim.a
 SIM_CRT0	= crt0.o
-SIM_OBJS	= syscalls.o
+SIM_OBJS	= syscalls.o clear_cache_range.o
 SIM_TEST	= sim-test
 SIM_INSTALL	= install-sim
 
@@ -71,10 +71,10 @@
 	bf561.ld bf561a.ld bf561b.ld bf561m.ld \
 	bf592.ld
 BOARD_LDFLAGS	=
-BOARD_BSP	= # We actually use libnosys.a
+BOARD_BSP	= libbfinbsp.a
 BOARD_CRT0S	= basiccrt.o basiccrts.o
 BOARD_CRT0S	+= basiccrt561.o basiccrt561s.o basiccrt561b.o
-BOARD_OBJS	=
+BOARD_OBJS	= clear_cache_range.o
 BOARD_TEST	=
 BOARD_INSTALL	= install-board
 
@@ -91,6 +91,10 @@
 #
 # here's where we build the board support packages for each target
 #
+${BOARD_BSP}: ${OBJS} ${BOARD_OBJS}
+	${AR} ${ARFLAGS} $@ $^
+	${RANLIB} $@
+
 ${SIM_BSP}: ${OBJS} ${SIM_OBJS}
 	${AR} ${ARFLAGS} ${SIM_BSP} ${SIM_OBJS} ${OBJS}
 	${RANLIB} ${SIM_BSP}
--- /dev/null
+++ bfin/clear_cache_range.c
@@ -0,0 +1,33 @@
+/*
+ * C library support files for the Blackfin processor
+ *
+ * Copyright (C) 2010 Analog Devices, Inc.
+ *
+ * The authors hereby grant permission to use, copy, modify, distribute,
+ * and license this software and its documentation for any purpose, provided
+ * that existing copyright notices are retained in all copies and that this
+ * notice is included verbatim in any distributions. No written agreement,
+ * license, or royalty fee is required for any of the authorized uses.
+ * Modifications to this software may be copyrighted by their authors
+ * and need not follow the licensing terms described here, provided that
+ * the new terms are clearly indicated on the first page of each file where
+ * they apply.
+ */
+
+/* This is a callback which gcc itself wants to flush jump tables.
+
+   Map it into L1 Text because of anomalies 05-00-0312 and 05-00-0419.  */
+
+__attribute__ ((l1_text))
+void __clear_cache_range (char *beg, char *end)
+{
+  char *ptr = beg;
+  do {
+    __asm__ __volatile__ ("FLUSH [%0++];" : "+a" (ptr) : : "memory");
+  } while (ptr <= end);
+  ptr = beg;
+  __asm__ __volatile__ ("SSYNC;");
+  do {
+    __asm__ __volatile__ ("IFLUSH [%0++];" : "+a" (ptr) : : "memory");
+  } while (ptr <= end);
+}

Attachment: signature.asc
Description: This is a digitally signed message part.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]