<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>change log for rtems (2011-01-31)</title>
</head>
<body text='#000000' bgcolor='#ffffff'>
<a name='cs1'></a>
<table border='0' cellspacing='0' cellpadding='5' width='100%' bgcolor='#eeeeee'>
<tr><td colspan='3' bgcolor='#dddddd'>
 <font color='#bb2222'><strong>sh</strong></font>
</td></tr>
<tr><td colspan='3' bgcolor='#dddddd'><pre>2011-01-31 Sebastian Huber <sebastian.huber@embedded-brains.de>

        * new-exceptions/bspsupport/ppc_exc.S,
        new-exceptions/bspsupport/ppc_exc_asm_macros.h,
        new-exceptions/bspsupport/ppc_exc_naked.S,
        new-exceptions/bspsupport/ppc_exc_prologue.c: Branch targets are now
        global for all minimal prologues.  Generate branch instruction in
        minimal prologues.
</pre></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libcpu/powerpc/ChangeLog.diff?r1=text&tr1=1.371&r2=text&tr2=1.372&diff_format=h">M</a></td><td width='1%'>1.372</td><td width='100%'>c/src/lib/libcpu/powerpc/ChangeLog</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc.S.diff?r1=text&tr1=1.8&r2=text&tr2=1.9&diff_format=h">M</a></td><td width='1%'>1.9</td><td width='100%'>c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc.S</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_asm_macros.h.diff?r1=text&tr1=1.12&r2=text&tr2=1.13&diff_format=h">M</a></td><td width='1%'>1.13</td><td width='100%'>c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_asm_macros.h</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_naked.S.diff?r1=text&tr1=1.2&r2=text&tr2=1.3&diff_format=h">M</a></td><td width='1%'>1.3</td><td width='100%'>c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_naked.S</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_prologue.c.diff?r1=text&tr1=1.4&r2=text&tr2=1.5&diff_format=h">M</a></td><td width='1%'>1.5</td><td width='100%'>c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_prologue.c</td></tr>
</table>
<pre>
<font color='#006600'>diff -u rtems/c/src/lib/libcpu/powerpc/ChangeLog:1.371 rtems/c/src/lib/libcpu/powerpc/ChangeLog:1.372
--- rtems/c/src/lib/libcpu/powerpc/ChangeLog:1.371      Mon Jan 31 09:48:22 2011
+++ rtems/c/src/lib/libcpu/powerpc/ChangeLog    Mon Jan 31 10:12:24 2011
</font><font color='#997700'>@@ -1,5 +1,14 @@
</font> 2011-01-31        Sebastian Huber <sebastian.huber@embedded-brains.de>
 
<font color='#000088'>+   * new-exceptions/bspsupport/ppc_exc.S,
+       new-exceptions/bspsupport/ppc_exc_asm_macros.h,
+       new-exceptions/bspsupport/ppc_exc_naked.S,
+       new-exceptions/bspsupport/ppc_exc_prologue.c: Branch targets are now
+       global for all minimal prologues.  Generate branch instruction in
+       minimal prologues.
+
+2011-01-31     Sebastian Huber <sebastian.huber@embedded-brains.de>
+
</font>   * e500/mmu/mmu.c: Use common defines.
 
 2011-01-28     Joel Sherrill <joel.sherrilL@OARcorp.com>

<font color='#006600'>diff -u rtems/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc.S:1.8 rtems/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc.S:1.9
--- rtems/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc.S:1.8      Wed Dec 29 03:51:18 2010
+++ rtems/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc.S  Mon Jan 31 10:12:24 2011
</font><font color='#997700'>@@ -66,7 +66,14 @@
</font>   stwu    r1, -EXCEPTION_FRAME_END(r1)
        stw     VECTOR_REGISTER, VECTOR_OFFSET(r1)
        mflr    VECTOR_REGISTER
<font color='#880000'>-   bla     wrap_auto
</font><font color='#000088'>+
+       /*
+        * We store the absolute branch target address here.  It will be used
+        * to generate the branch operation in ppc_exc_make_prologue().
+        *
+        * We add one to request the link in the generated branch instruction.
+        */
+       .int    ppc_exc_wrap_auto + 1
</font> 
        .global ppc_exc_tgpr_clr_prolog_size
 ppc_exc_tgpr_clr_prolog_size = . - ppc_exc_tgpr_clr_prolog
<font color='#997700'>@@ -87,7 +94,14 @@
</font>   stw     r1, ppc_exc_lock_std@sdarel(r13)
        stw     VECTOR_REGISTER, ppc_exc_vector_register_std@sdarel(r13)
        mflr    VECTOR_REGISTER
<font color='#880000'>-   bla     wrap_auto_async
</font><font color='#000088'>+
+       /*
+        * We store the absolute branch target address here.  It will be used
+        * to generate the branch operation in ppc_exc_make_prologue().
+        *
+        * We add one to request the link in the generated branch instruction.
+        */
+       .int    ppc_exc_wrap_auto_async + 1
</font> 
 /******************************************************/
 /*  WRAPPERS                                          */
<font color='#997700'>@@ -119,7 +133,8 @@
</font>   WRAP    _FLVR=e500_mchk _PRI=mchk _SRR0=mcsrr0 _SRR1=mcsrr1 _RFI=rfmci
 
        /* LR holds vector, VECTOR_REGISTER holds orig. LR */
<font color='#880000'>-wrap_auto:
</font><font color='#000088'>+        .global ppc_exc_wrap_auto
+ppc_exc_wrap_auto:
</font>   stw     FRAME_REGISTER, FRAME_OFFSET(r1)
 
        /* Find address where we jumped from */
<font color='#997700'>@@ -138,7 +153,8 @@
</font>    */
        b       wrap_no_save_frame_register_std
 
<font color='#880000'>-wrap_auto_async:
</font><font color='#000088'>+        .global ppc_exc_wrap_auto_async
+ppc_exc_wrap_auto_async:
</font>   stwu    r1, -EXCEPTION_FRAME_END(r1)
        stw     FRAME_REGISTER, FRAME_OFFSET(r1)
        /* find address where we jumped from */

<font color='#006600'>diff -u rtems/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_asm_macros.h:1.12 rtems/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_asm_macros.h:1.13
--- rtems/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_asm_macros.h:1.12  Tue Jun 29 14:44:06 2010
+++ rtems/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_asm_macros.h       Mon Jan 31 10:12:24 2011
</font><font color='#997700'>@@ -106,9 +106,12 @@
</font>   /*      Load vector.
         */
        li      VECTOR_REGISTER, ( \_VEC | 0xffff8000 )
<font color='#880000'>-   /*      Branch (must be within 32MB)
</font><font color='#000088'>+
+       /*
+        * We store the absolute branch target address here.  It will be used
+        * to generate the branch operation in ppc_exc_make_prologue().
</font>    */
<font color='#880000'>-   ba      wrap_\_FLVR
</font><font color='#000088'>+      .int    ppc_exc_wrap_\_FLVR
</font> 
        .endm
 
<font color='#997700'>@@ -129,7 +132,12 @@
</font>   stwu    r1, -EXCEPTION_FRAME_END(r1)
        stw     VECTOR_REGISTER, VECTOR_OFFSET(r1)
        li      VECTOR_REGISTER, \_VEC
<font color='#880000'>-   ba      wrap_nopush_\_FLVR
</font><font color='#000088'>+
+       /*
+        * We store the absolute branch target address here.  It will be used
+        * to generate the branch operation in ppc_exc_make_prologue().
+        */
+       .int    ppc_exc_wrap_nopush_\_FLVR
</font> 
        .endm
 
<font color='#997700'>@@ -374,12 +382,14 @@
</font>  */
        .macro  WRAP _FLVR _PRI _SRR0 _SRR1 _RFI
 
<font color='#880000'>-wrap_\_FLVR:
</font><font color='#000088'>+      .global ppc_exc_wrap_\_FLVR
+ppc_exc_wrap_\_FLVR:
</font> 
        /* Push exception frame */
        stwu    r1, -EXCEPTION_FRAME_END(r1)
 
<font color='#880000'>-wrap_nopush_\_FLVR:
</font><font color='#000088'>+      .global ppc_exc_wrap_nopush_\_FLVR
+ppc_exc_wrap_nopush_\_FLVR:
</font> 
        /* Save frame register */
        stw     FRAME_REGISTER, FRAME_OFFSET(r1)

<font color='#006600'>diff -u rtems/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_naked.S:1.2 rtems/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_naked.S:1.3
--- rtems/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_naked.S:1.2        Sun Nov 29 23:07:54 2009
+++ rtems/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_naked.S    Mon Jan 31 10:12:24 2011
</font><font color='#997700'>@@ -28,9 +28,15 @@
</font>   stwu    r1, -EXCEPTION_FRAME_END(r1)
        stw     VECTOR_REGISTER, VECTOR_OFFSET(r1)
        li      VECTOR_REGISTER, 0
<font color='#880000'>-   ba      wrap_naked
</font> 
<font color='#880000'>-wrap_naked:
</font><font color='#000088'>+      /*
+        * We store the absolute branch target address here.  It will be used
+        * to generate the branch operation in ppc_exc_make_prologue().
+        */
+       .int    ppc_exc_wrap_naked
+
+        .global ppc_exc_wrap_naked
+ppc_exc_wrap_naked:
</font> 
        /* Save scratch registers */
        stw     SCRATCH_REGISTER_0, SCRATCH_REGISTER_0_OFFSET(r1)

<font color='#006600'>diff -u rtems/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_prologue.c:1.4 rtems/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_prologue.c:1.5
--- rtems/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_prologue.c:1.4     Fri Jan 28 14:38:13 2011
+++ rtems/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_prologue.c Mon Jan 31 10:12:24 2011
</font><font color='#997700'>@@ -62,6 +62,44 @@
</font>   [PPC_EXC_NAKED] = ppc_exc_min_prolog_tmpl_naked
 };
 
<font color='#000088'>+static bool ppc_exc_create_branch_op(
+  unsigned vector,
+  uint32_t *prologue,
+  size_t prologue_size
+)
+{
+  static const uintptr_t BRANCH_OP_CODE = 18 << 26;
+  static const uintptr_t BRANCH_OP_LINK = 0x1;
+  static const uintptr_t BRANCH_OP_ABS = 0x2;
+  static const uintptr_t BRANCH_OP_MSK = 0x3ffffff;
+  size_t branch_op_index = prologue_size / 4 - 1;
+  uintptr_t vector_address = (uintptr_t) ppc_exc_vector_address(vector);
+  uintptr_t branch_op_address = vector_address + 4 * branch_op_index;
+
+  /* This value may have BRANCH_OP_LINK set */
+  uintptr_t target_address = prologue [branch_op_index];
+
+  uintptr_t branch_target_address = target_address - branch_op_address;
+
+  /*
+   * We prefer to use a relative branch.  This has the benefit that custom
+   * minimal prologues in a read-only area are relocatable.
+   */
+  if ((branch_target_address & ~BRANCH_OP_MSK) != 0) {
+    /* Target to far for relative branch (PC ± 32M) */
+    if (target_address >= 0xfe000001 || target_address < 0x01fffffd) {
+      /* Can use an absolute branch */
+      branch_target_address = (target_address | BRANCH_OP_ABS) & BRANCH_OP_MSK;
+    } else {
+      return false;
+    }
+  }
+
+  prologue [branch_op_index] = BRANCH_OP_CODE | branch_target_address;
+
+  return true;
+}
+
</font> rtems_status_code ppc_exc_make_prologue(
   unsigned vector,
   ppc_exc_category category,
<font color='#997700'>@@ -71,7 +109,6 @@
</font> {
   const uint32_t *prologue_template = NULL;
   size_t prologue_template_size = 0;
<font color='#880000'>-  uintptr_t vector_address = (uintptr_t) ppc_exc_vector_address(vector);
</font>   bool fixup_vector = false;
 
   if (!ppc_exc_is_valid_category(category)) {
<font color='#997700'>@@ -104,6 +141,10 @@
</font> 
     memcpy(prologue, prologue_template, prologue_template_size);
 
<font color='#000088'>+    if (!ppc_exc_create_branch_op(vector, prologue, prologue_template_size)) {
+      return RTEMS_INVALID_ADDRESS;
+    }
+
</font>     if (fixup_vector) {
       if (vector <= 0x7fffU) {
         prologue [PPC_EXC_PROLOG_VEC_OFFSET] =
</pre>
<p> </p>
<a name='cs2'></a>
<table border='0' cellspacing='0' cellpadding='5' width='100%' bgcolor='#eeeeee'>
<tr><td colspan='3' bgcolor='#dddddd'>
 <font color='#bb2222'><strong>ralf</strong></font>
</td></tr>
<tr><td colspan='3' bgcolor='#dddddd'><pre>2011-01-31 Ralf Corsepius <ralf.corsepius@rtems.org>

        * libmisc/stringto/stringtoint.c,
        libmisc/stringto/stringtounsignedint.c,
        libmisc/stringto/stringtounsignedchar.c: Rework.
</pre></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/ChangeLog.diff?r1=text&tr1=1.2682&r2=text&tr2=1.2683&diff_format=h">M</a></td><td width='1%'>1.2683</td><td width='100%'>cpukit/ChangeLog</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/libmisc/stringto/stringtoint.c.diff?r1=text&tr1=1.2&r2=text&tr2=1.3&diff_format=h">M</a></td><td width='1%'>1.3</td><td width='100%'>cpukit/libmisc/stringto/stringtoint.c</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/libmisc/stringto/stringtounsignedchar.c.diff?r1=text&tr1=1.2&r2=text&tr2=1.3&diff_format=h">M</a></td><td width='1%'>1.3</td><td width='100%'>cpukit/libmisc/stringto/stringtounsignedchar.c</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/libmisc/stringto/stringtounsignedint.c.diff?r1=text&tr1=1.2&r2=text&tr2=1.3&diff_format=h">M</a></td><td width='1%'>1.3</td><td width='100%'>cpukit/libmisc/stringto/stringtounsignedint.c</td></tr>
</table>
<pre>
<font color='#006600'>diff -u rtems/cpukit/ChangeLog:1.2682 rtems/cpukit/ChangeLog:1.2683
--- rtems/cpukit/ChangeLog:1.2682       Mon Jan 31 10:03:16 2011
+++ rtems/cpukit/ChangeLog      Mon Jan 31 10:25:13 2011
</font><font color='#997700'>@@ -1,5 +1,9 @@
</font> 2011-01-31        Ralf Corsepius <ralf.corsepius@rtems.org>
 
<font color='#000088'>+   * libmisc/stringto/stringtoint.c,
+       libmisc/stringto/stringtounsignedint.c,
+       libmisc/stringto/stringtounsignedchar.c: Rework.
+
</font>   * libmisc/stringto/stringtopointer.c: Rework.
 
 2011-01-28     Joel Sherrill <joel.sherrilL@OARcorp.com>

<font color='#006600'>diff -u rtems/cpukit/libmisc/stringto/stringtoint.c:1.2 rtems/cpukit/libmisc/stringto/stringtoint.c:1.3
--- rtems/cpukit/libmisc/stringto/stringtoint.c:1.2     Sun Mar 28 10:20:32 2010
+++ rtems/cpukit/libmisc/stringto/stringtoint.c Mon Jan 31 10:25:13 2011
</font><font color='#997700'>@@ -2,6 +2,8 @@
</font>  *  COPYRIGHT (c) 2009.
  *  On-Line Applications Research Corporation (OAR).
  *
<font color='#000088'>+ *  Copyright (c) 2011  Ralf Corsépius, Ulm, Germany.
+ *
</font>  *  The license and distribution terms for this file may be
  *  found in the file LICENSE in this distribution or at
  *  http://www.rtems.com/license/LICENSE.
<font color='#997700'>@@ -13,12 +15,61 @@
</font> #include "config.h"
 #endif
 
<font color='#000088'>+#include <errno.h>
+#include <stdlib.h>
+#include <limits.h>
+
+#include <rtems/stringto.h>
+
</font> /*
  *  Instantiate an error checking wrapper for strtol (int)
  */
<font color='#880000'>-#define STRING_TO_INTEGER
-#define STRING_TO_TYPE int
-#define STRING_TO_NAME rtems_string_to_int
-#define STRING_TO_METHOD strtol
-#define STRING_TO_MAX LONG_MAX
-#include "stringto_template.h"
</font><font color='#000088'>+
+rtems_status_code rtems_string_to_int (
+  const char *s,
+  int *n,
+  char **endptr,
+  int base
+)
+{
+  long result;
+  char *end;
+
+  if ( !n )
+    return RTEMS_INVALID_ADDRESS;
+
+  errno = 0;
+  *n = 0;
+
+  result = strtol( s, &end, base );
+
+  if ( endptr )
+    *endptr = end;
+
+  if ( end == s )
+    return RTEMS_NOT_DEFINED;
+
+  if ( (result == LONG_MAX) && (errno == ERANGE) )
+    return RTEMS_INVALID_NUMBER;
+
+  if ( (result == LONG_MIN) && (errno == ERANGE) )
+    return RTEMS_INVALID_NUMBER;
+
+#if (INT_MAX < LONG_MAX)
+  if ( result > INT_MAX ) {
+    errno = ERANGE;
+    return RTEMS_INVALID_NUMBER;
+  }
+#endif
+
+#if (INT_MIN < LONG_MIN)
+  if ( result < INT_MIN ) {
+    errno = ERANGE;
+    return RTEMS_INVALID_NUMBER;
+  }
+#endif
+
+  *n = result;
+
+  return RTEMS_SUCCESSFUL;
+}
</font>
<font color='#006600'>diff -u rtems/cpukit/libmisc/stringto/stringtounsignedchar.c:1.2 rtems/cpukit/libmisc/stringto/stringtounsignedchar.c:1.3
--- rtems/cpukit/libmisc/stringto/stringtounsignedchar.c:1.2    Sun Mar 28 10:20:32 2010
+++ rtems/cpukit/libmisc/stringto/stringtounsignedchar.c        Mon Jan 31 10:25:13 2011
</font><font color='#997700'>@@ -2,6 +2,8 @@
</font>  *  COPYRIGHT (c) 2009.
  *  On-Line Applications Research Corporation (OAR).
  *
<font color='#000088'>+ *  Copyright (c) 2011  Ralf Corsépius, Ulm, Germany.
+ *
</font>  *  The license and distribution terms for this file may be
  *  found in the file LICENSE in this distribution or at
  *  http://www.rtems.com/license/LICENSE.
<font color='#997700'>@@ -13,12 +15,54 @@
</font> #include "config.h"
 #endif
 
<font color='#000088'>+#include <errno.h>
+#include <stdlib.h>
+#include <limits.h>
+
+#include <rtems/stringto.h>
+
</font> /*
<font color='#880000'>- *  Instantiate an error checking wrapper for strtol (unsigned char)
</font><font color='#000088'>+ *  Instantiate an error checking wrapper for strtoul (unsigned char)
</font>  */
<font color='#880000'>-#define STRING_TO_INTEGER
-#define STRING_TO_TYPE unsigned char
-#define STRING_TO_NAME rtems_string_to_unsigned_char
-#define STRING_TO_METHOD strtoul
-#define STRING_TO_MAX ULONG_MAX
-#include "stringto_template.h"
</font><font color='#000088'>+
+rtems_status_code rtems_string_to_unsigned_char (
+  const char *s,
+  unsigned char *n,
+  char **endptr,
+  int base
+)
+{
+  unsigned long result;
+  char *end;
+
+  if ( !n )
+    return RTEMS_INVALID_ADDRESS;
+
+  errno = 0;
+  *n = 0;
+
+  result = strtoul( s, &end, base );
+
+  if ( endptr )
+    *endptr = end;
+
+  if ( end == s )
+    return RTEMS_NOT_DEFINED;
+
+  if ( (result == ULONG_MAX) && (errno == ERANGE) )
+    return RTEMS_INVALID_NUMBER;
+
+  if ( (result == 0) && (errno == ERANGE) )
+    return RTEMS_INVALID_NUMBER;
+
+#if (UCHAR_MAX < ULONG_MAX)
+  if ( result > UCHAR_MAX ) {
+    errno = ERANGE;
+    return RTEMS_INVALID_NUMBER;
+  }
+#endif
+
+  *n = result;
+
+  return RTEMS_SUCCESSFUL;
+}
</font>
<font color='#006600'>diff -u rtems/cpukit/libmisc/stringto/stringtounsignedint.c:1.2 rtems/cpukit/libmisc/stringto/stringtounsignedint.c:1.3
--- rtems/cpukit/libmisc/stringto/stringtounsignedint.c:1.2     Sun Mar 28 10:20:32 2010
+++ rtems/cpukit/libmisc/stringto/stringtounsignedint.c Mon Jan 31 10:25:13 2011
</font><font color='#997700'>@@ -2,6 +2,8 @@
</font>  *  COPYRIGHT (c) 2009.
  *  On-Line Applications Research Corporation (OAR).
  *
<font color='#000088'>+ *  Copyright (c) 2011  Ralf Corsépius, Ulm, Germany.
+ *
</font>  *  The license and distribution terms for this file may be
  *  found in the file LICENSE in this distribution or at
  *  http://www.rtems.com/license/LICENSE.
<font color='#997700'>@@ -13,12 +15,54 @@
</font> #include "config.h"
 #endif
 
<font color='#000088'>+#include <errno.h>
+#include <stdlib.h>
+#include <limits.h>
+
+#include <rtems/stringto.h>
+
</font> /*
  *  Instantiate an error checking wrapper for strtoul (unsigned int)
  */
<font color='#880000'>-#define STRING_TO_INTEGER
-#define STRING_TO_TYPE unsigned int
-#define STRING_TO_NAME rtems_string_to_unsigned_int
-#define STRING_TO_METHOD strtoul
-#define STRING_TO_MAX ULONG_MAX
-#include "stringto_template.h"
</font><font color='#000088'>+
+rtems_status_code rtems_string_to_unsigned_int (
+  const char *s,
+  unsigned int *n,
+  char **endptr,
+  int base
+)
+{
+  unsigned long result;
+  char *end;
+
+  if ( !n )
+    return RTEMS_INVALID_ADDRESS;
+
+  errno = 0;
+  *n = 0;
+
+  result = strtoul( s, &end, base );
+
+  if ( endptr )
+    *endptr = end;
+
+  if ( end == s )
+    return RTEMS_NOT_DEFINED;
+
+  if ( (result == ULONG_MAX) && (errno == ERANGE) )
+    return RTEMS_INVALID_NUMBER;
+
+  if ( (result == 0) && (errno == ERANGE) )
+    return RTEMS_INVALID_NUMBER;
+
+#if (UINT_MAX < ULONG_MAX)
+  if ( result > UINT_MAX ) {
+    errno = ERANGE;
+    return RTEMS_INVALID_NUMBER;
+  }
+#endif
+
+  *n = result;
+
+  return RTEMS_SUCCESSFUL;
+}
</font></pre>
<p> </p>

<p>--<br />
<small>Generated by <a href="http://www.codewiz.org/projects/index.html#loginfo">Deluxe Loginfo</a> 2.122 by Bernardo Innocenti <bernie@develer.com></small></p>
</body>
</html>