This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos 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]

hal/h8300 update


please commit.

Index: arch/current/ChangeLog
===================================================================
RCS file: /cvsroot/ecos-h8/ecos/packages/hal/h8300/arch/current/ChangeLog,v
retrieving revision 1.1.1.6
retrieving revision 1.10
diff -u -r1.1.1.6 -r1.10
--- arch/current/ChangeLog	12 Jan 2005 02:42:20 -0000	1.1.1.6
+++ arch/current/ChangeLog	27 Jan 2005 14:00:07 -0000	1.10
@@ -1,3 +1,6 @@
+2005-01-27  Yoshinori Sato  <ysato@users.sourceforge.jp>
+	* src/hal_misc.c: hal_lsbit_index / hal_msbit_index cleanup.
+
 2004-05-27  Gary Thomas  <gary@mlbassoc.com>
 
 	* src/redboot_linux_exec.c (do_exec): Be sensitive to value in
Index: hal/h8300/arch/current/src/hal_misc.c
===================================================================
RCS file: /cvsroot/ecos-h8/ecos/packages/hal/h8300/arch/current/src/hal_misc.c,v
retrieving revision 1.1.1.5
retrieving revision 1.7
diff -u -r1.1.1.5 -r1.7
--- hal/h8300/arch/current/src/hal_misc.c	12 Jan 2005 02:42:20 -0000	1.1.1.5
+++ hal/h8300/arch/current/src/hal_misc.c	27 Jan 2005 14:00:08 -0000	1.7
@@ -122,21 +122,28 @@
 cyg_uint32
 hal_lsbit_index(cyg_uint32 mask)
 {
-    cyg_uint32 n = mask;
+    int bit = -1;
+    
+    if (mask == 0)
+	return -1;
+
+    if ((mask & 0xffff) == 0) {
+	mask >>= 16;
+	bit += 16;
+    }
+    if ((mask & 0xff) == 0) {
+	mask >>= 8;
+	bit += 8;
+    }
 
-    static const signed char tab[64] =
-    { -1, 0, 1, 12, 2, 6, 0, 13, 3, 0, 7, 0, 0, 0, 0, 14, 10,
-      4, 0, 0, 8, 0, 0, 25, 0, 0, 0, 0, 0, 21, 27 , 15, 31, 11,
-      5, 0, 0, 0, 0, 0, 9, 0, 0, 24, 0, 0 , 20, 26, 30, 0, 0, 0,
-      0, 23, 0, 19, 29, 0, 22, 18, 28, 17, 16, 0
-    };
-
-    n &= ~(n-1UL);
-    n = (n<<16)-n;
-    n = (n<<6)+n;
-    n = (n<<4)+n;
 
-    return tab[n>>26];
+    __asm__("1:\n\t"
+	    "adds #1,%0\n\t"
+	    "shlr.b %w2\n\t"
+	    "bcc 1b\n\t"
+	    :"=r"(bit):"0"(bit),"r"(mask));
+
+    return bit;
 }
 
 /*------------------------------------------------------------------------*/
@@ -145,23 +152,28 @@
 cyg_uint32
 hal_msbit_index(cyg_uint32 mask)
 {
-    cyg_uint32 x = mask;    
-    cyg_uint32 w;
+    unsigned int bit = 8;
+    
+    if (mask == 0)
+	return -1;
 
-    /* Phase 1: make word with all ones from that one to the right */
-    x |= x >> 16;
-    x |= x >> 8;
-    x |= x >> 4;
-    x |= x >> 2;
-    x |= x >> 1;
-
-    /* Phase 2: calculate number of "1" bits in the word        */
-    w = (x & 0x55555555) + ((x >> 1) & 0x55555555);
-    w = (w & 0x33333333) + ((w >> 2) & 0x33333333);
-    w = w + (w >> 4);
-    w = (w & 0x000F000F) + ((w >> 8) & 0x000F000F);
-    return (cyg_uint32)((w + (w >> 16)) & 0xFF)-1;
+    if ((mask & ~0xffff) != 0)
+	mask >>= 16;
+    else
+	bit += 16;
+
+    if ((mask & 0xff00) != 0)
+	mask >>= 8;
+    else
+	bit += 8;
+
+    __asm__("1:\n\t"
+	    "dec.b %w0\n\t"
+	    "shll.b %w2\n\t"
+	    "bcc 1b\n\t"
+	    :"=r"(bit):"0"(bit),"r"(mask));
 
+    return bit;
 }
 
 /*------------------------------------------------------------------------*/
@@ -174,7 +186,6 @@
 void
 cyg_hal_exception_handler(HAL_SavedRegisters *regs,CYG_WORD vector)
 {
-
 #ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
 
     // Set the pointer to the registers of the current exception
Index: hal/h8300/h8300h/current/ChangeLog
===================================================================
RCS file: /cvsroot/ecos-h8/ecos/packages/hal/h8300/h8300h/current/ChangeLog,v
retrieving revision 1.1.1.7
retrieving revision 1.9
diff -u -r1.1.1.7 -r1.9
--- hal/h8300/h8300h/current/ChangeLog	12 Jan 2005 02:42:20 -0000	1.1.1.7
+++ hal/h8300/h8300h/current/ChangeLog	27 Jan 2005 14:00:28 -0000	1.9
@@ -1,5 +1,10 @@
+2005-01-27  Yoshinori Sato  <ysato@users.sourceforge.jp>
+
+	* src/h8300_h8300h.ld:
+	h8300h_sim target build error fix 
+
 2004-04-22  Jani Monoses <jani@iv.ro>
 
 	 * cdl/hal_h8300_h8300h.cdl :
 	 Invoke tail with stricter syntax that works in latest coreutils. 
 
Index: hal/h8300/h8300h/current/src/h8300_h8300h.ld
===================================================================
RCS file: /cvsroot/ecos-h8/ecos/packages/hal/h8300/h8300h/current/src/h8300_h8300h.ld,v
retrieving revision 1.1.1.8
retrieving revision 1.11
diff -u -r1.1.1.8 -r1.11
--- hal/h8300/h8300h/current/src/h8300_h8300h.ld	12 Jan 2005 02:42:21 -0000	1.1.1.8
+++ hal/h8300/h8300h/current/src/h8300_h8300h.ld	27 Jan 2005 14:00:28 -0000	1.11
@@ -95,7 +95,7 @@
     { FORCE_OUTPUT; *(.gcc_except_table) } \
     > _region_
 
-#if defined(CYGSEM_HAL_H8300_VECTOR_HOOK)
+#if defined(CYGHWR_HAL_H8300_VECTOR_ADDRESS)
 #define SECTION_int_hook_table(_region_, _vma_, _lma_) \
     .int_hook_table CYGHWR_HAL_H8300_VECTOR_ADDRESS : _lma_ \
     { CYG_LABEL_DEFN(__int_hook_start) = ABSOLUTE (.); \
@@ -137,6 +137,15 @@
     CYG_LABEL_DEFN(__bss_end) = ABSOLUTE (.); } \
     > _region_
 
+#define SECTION_2ram(_region_, _vma_, _lma_) \
+    .2ram _vma_ : _lma_ \
+    { CYG_LABEL_DEFN(__iram_start) = ABSOLUTE (.); \
+    *( .2ram.*); \
+    . = ALIGN(4); \
+    CYG_LABEL_DEFN(__iram_end) = ABSOLUTE (.); } \
+    > _region_ \
+    CYG_LABEL_DEFN(__rom_iram_start) = LOADADDR (.2ram);
+
 #define SECTIONS_END . = ALIGN(4); _end = .; PROVIDE (end = .);
 
 #include CYGHWR_MEMORY_LAYOUT_LDI

-- 
Yoshinori Sato
<ysato@users.sourceforge.jp>


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