change log for rtems (2011-01-31)
rtems-vc at rtems.org
rtems-vc at rtems.org
Mon Jan 31 17:10:29 UTC 2011
*sh*:
2011-01-31 Sebastian Huber <sebastian.huber at 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.
M 1.372 c/src/lib/libcpu/powerpc/ChangeLog
M 1.9 c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc.S
M 1.13 c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_asm_macros.h
M 1.3 c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_naked.S
M 1.5 c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_prologue.c
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
@@ -1,5 +1,14 @@
2011-01-31 Sebastian Huber <sebastian.huber at 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.
+
+2011-01-31 Sebastian Huber <sebastian.huber at embedded-brains.de>
+
* e500/mmu/mmu.c: Use common defines.
2011-01-28 Joel Sherrill <joel.sherrilL at OARcorp.com>
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
@@ -66,7 +66,14 @@
stwu r1, -EXCEPTION_FRAME_END(r1)
stw VECTOR_REGISTER, VECTOR_OFFSET(r1)
mflr VECTOR_REGISTER
- bla wrap_auto
+
+ /*
+ * 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
.global ppc_exc_tgpr_clr_prolog_size
ppc_exc_tgpr_clr_prolog_size = . - ppc_exc_tgpr_clr_prolog
@@ -87,7 +94,14 @@
stw r1, ppc_exc_lock_std at sdarel(r13)
stw VECTOR_REGISTER, ppc_exc_vector_register_std at sdarel(r13)
mflr VECTOR_REGISTER
- bla wrap_auto_async
+
+ /*
+ * 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
/******************************************************/
/* WRAPPERS */
@@ -119,7 +133,8 @@
WRAP _FLVR=e500_mchk _PRI=mchk _SRR0=mcsrr0 _SRR1=mcsrr1 _RFI=rfmci
/* LR holds vector, VECTOR_REGISTER holds orig. LR */
-wrap_auto:
+ .global ppc_exc_wrap_auto
+ppc_exc_wrap_auto:
stw FRAME_REGISTER, FRAME_OFFSET(r1)
/* Find address where we jumped from */
@@ -138,7 +153,8 @@
*/
b wrap_no_save_frame_register_std
-wrap_auto_async:
+ .global ppc_exc_wrap_auto_async
+ppc_exc_wrap_auto_async:
stwu r1, -EXCEPTION_FRAME_END(r1)
stw FRAME_REGISTER, FRAME_OFFSET(r1)
/* find address where we jumped from */
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
@@ -106,9 +106,12 @@
/* Load vector.
*/
li VECTOR_REGISTER, ( \_VEC | 0xffff8000 )
- /* Branch (must be within 32MB)
+
+ /*
+ * We store the absolute branch target address here. It will be used
+ * to generate the branch operation in ppc_exc_make_prologue().
*/
- ba wrap_\_FLVR
+ .int ppc_exc_wrap_\_FLVR
.endm
@@ -129,7 +132,12 @@
stwu r1, -EXCEPTION_FRAME_END(r1)
stw VECTOR_REGISTER, VECTOR_OFFSET(r1)
li VECTOR_REGISTER, \_VEC
- ba wrap_nopush_\_FLVR
+
+ /*
+ * 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
.endm
@@ -374,12 +382,14 @@
*/
.macro WRAP _FLVR _PRI _SRR0 _SRR1 _RFI
-wrap_\_FLVR:
+ .global ppc_exc_wrap_\_FLVR
+ppc_exc_wrap_\_FLVR:
/* Push exception frame */
stwu r1, -EXCEPTION_FRAME_END(r1)
-wrap_nopush_\_FLVR:
+ .global ppc_exc_wrap_nopush_\_FLVR
+ppc_exc_wrap_nopush_\_FLVR:
/* Save frame register */
stw FRAME_REGISTER, FRAME_OFFSET(r1)
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
@@ -28,9 +28,15 @@
stwu r1, -EXCEPTION_FRAME_END(r1)
stw VECTOR_REGISTER, VECTOR_OFFSET(r1)
li VECTOR_REGISTER, 0
- ba wrap_naked
-wrap_naked:
+ /*
+ * 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:
/* Save scratch registers */
stw SCRATCH_REGISTER_0, SCRATCH_REGISTER_0_OFFSET(r1)
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
@@ -62,6 +62,44 @@
[PPC_EXC_NAKED] = ppc_exc_min_prolog_tmpl_naked
};
+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;
+}
+
rtems_status_code ppc_exc_make_prologue(
unsigned vector,
ppc_exc_category category,
@@ -71,7 +109,6 @@
{
const uint32_t *prologue_template = NULL;
size_t prologue_template_size = 0;
- uintptr_t vector_address = (uintptr_t) ppc_exc_vector_address(vector);
bool fixup_vector = false;
if (!ppc_exc_is_valid_category(category)) {
@@ -104,6 +141,10 @@
memcpy(prologue, prologue_template, prologue_template_size);
+ if (!ppc_exc_create_branch_op(vector, prologue, prologue_template_size)) {
+ return RTEMS_INVALID_ADDRESS;
+ }
+
if (fixup_vector) {
if (vector <= 0x7fffU) {
prologue [PPC_EXC_PROLOG_VEC_OFFSET] =
*ralf*:
2011-01-31 Ralf Corsepius <ralf.corsepius at rtems.org>
* libmisc/stringto/stringtoint.c,
libmisc/stringto/stringtounsignedint.c,
libmisc/stringto/stringtounsignedchar.c: Rework.
M 1.2683 cpukit/ChangeLog
M 1.3 cpukit/libmisc/stringto/stringtoint.c
M 1.3 cpukit/libmisc/stringto/stringtounsignedchar.c
M 1.3 cpukit/libmisc/stringto/stringtounsignedint.c
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
@@ -1,5 +1,9 @@
2011-01-31 Ralf Corsepius <ralf.corsepius at rtems.org>
+ * libmisc/stringto/stringtoint.c,
+ libmisc/stringto/stringtounsignedint.c,
+ libmisc/stringto/stringtounsignedchar.c: Rework.
+
* libmisc/stringto/stringtopointer.c: Rework.
2011-01-28 Joel Sherrill <joel.sherrilL at OARcorp.com>
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
@@ -2,6 +2,8 @@
* COPYRIGHT (c) 2009.
* On-Line Applications Research Corporation (OAR).
*
+ * Copyright (c) 2011 Ralf Corsépius, Ulm, Germany.
+ *
* 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.
@@ -13,12 +15,61 @@
#include "config.h"
#endif
+#include <errno.h>
+#include <stdlib.h>
+#include <limits.h>
+
+#include <rtems/stringto.h>
+
/*
* Instantiate an error checking wrapper for strtol (int)
*/
-#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"
+
+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;
+}
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
@@ -2,6 +2,8 @@
* COPYRIGHT (c) 2009.
* On-Line Applications Research Corporation (OAR).
*
+ * Copyright (c) 2011 Ralf Corsépius, Ulm, Germany.
+ *
* 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.
@@ -13,12 +15,54 @@
#include "config.h"
#endif
+#include <errno.h>
+#include <stdlib.h>
+#include <limits.h>
+
+#include <rtems/stringto.h>
+
/*
- * Instantiate an error checking wrapper for strtol (unsigned char)
+ * Instantiate an error checking wrapper for strtoul (unsigned char)
*/
-#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"
+
+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;
+}
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
@@ -2,6 +2,8 @@
* COPYRIGHT (c) 2009.
* On-Line Applications Research Corporation (OAR).
*
+ * Copyright (c) 2011 Ralf Corsépius, Ulm, Germany.
+ *
* 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.
@@ -13,12 +15,54 @@
#include "config.h"
#endif
+#include <errno.h>
+#include <stdlib.h>
+#include <limits.h>
+
+#include <rtems/stringto.h>
+
/*
* Instantiate an error checking wrapper for strtoul (unsigned int)
*/
-#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"
+
+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;
+}
--
Generated by Deluxe Loginfo [http://www.codewiz.org/projects/index.html#loginfo] 2.122 by Bernardo Innocenti <bernie at develer.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/vc/attachments/20110131/b9258614/attachment-0001.html>
More information about the vc
mailing list