diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2010-12-29 10:52:03 +0000 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2010-12-29 10:52:03 +0000 |
commit | 47b0230107675dbed34aefb34b0a0edc85c0ca93 (patch) | |
tree | 1d2597d1748e196577ee5c2e99c06781cb7da984 /c | |
parent | 2010-12-29 Sebastian Huber <sebastian.huber@embedded-brains.de> (diff) | |
download | rtems-47b0230107675dbed34aefb34b0a0edc85c0ca93.tar.bz2 |
2010-12-29 Sebastian Huber <sebastian.huber@embedded-brains.de>
* shared/include/start.h, shared/src/bsp-start-zero.S: New files.
Diffstat (limited to 'c')
-rw-r--r-- | c/src/lib/libbsp/powerpc/ChangeLog | 4 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/shared/include/start.h | 86 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/shared/src/bsp-start-zero.S | 102 |
3 files changed, 192 insertions, 0 deletions
diff --git a/c/src/lib/libbsp/powerpc/ChangeLog b/c/src/lib/libbsp/powerpc/ChangeLog index 0fae102710..18aa49f72c 100644 --- a/c/src/lib/libbsp/powerpc/ChangeLog +++ b/c/src/lib/libbsp/powerpc/ChangeLog @@ -1,3 +1,7 @@ +2010-12-29 Sebastian Huber <sebastian.huber@embedded-brains.de> + + * shared/include/start.h, shared/src/bsp-start-zero.S: New files. + 2010-08-25 Till Straumann <strauman@slac.stanford.edu> PR 1689/bsps diff --git a/c/src/lib/libbsp/powerpc/shared/include/start.h b/c/src/lib/libbsp/powerpc/shared/include/start.h new file mode 100644 index 0000000000..18574e4ba9 --- /dev/null +++ b/c/src/lib/libbsp/powerpc/shared/include/start.h @@ -0,0 +1,86 @@ +/** + * @file + * + * @ingroup bsp_start + * + * @brief System low level start. + */ + +/* + * Copyright (c) 2010 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Obere Lagerstr. 30 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * 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. + * + * $Id$ + */ + +#ifndef LIBBSP_POWERPC_SHARED_START_H +#define LIBBSP_POWERPC_SHARED_START_H + +#include <stddef.h> + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/** + * @defgroup bsp_start System Start + * + * @ingroup bsp_kit + * + * @brief System low level start. + * + * @{ + */ + +#define BSP_START_TEXT_SECTION __attribute__((section(".bsp_start_text"))) + +#define BSP_START_DATA_SECTION __attribute__((section(".bsp_start_data"))) + +/** +* @brief System start entry. +*/ +void _start(void); + +/** + * Zeros @a byte_count bytes starting at @a begin. + * + * It wraps around in case of an address overflow. The stack will not be used. + * The code is position independent. It uses the data cache block zero + * instruction in case the data cache is enabled. There are no alignment + * constains for @a begin and @a byte_count. + * + * @see bsp_start_zero_begin, bsp_start_zero_end, and bsp_start_zero_size. + */ +void BSP_START_TEXT_SECTION bsp_start_zero(void *begin, size_t byte_count); + +/** + * @brief Symbol which equals the bsp_start_zero() code begin. + */ +extern char bsp_start_zero_begin []; + +/** + * @brief Symbol which equals the bsp_start_zero() code end. + */ +extern char bsp_start_zero_end []; + +/** + * @brief Symbol which equals the bsp_start_zero() code size. + */ +extern char bsp_start_zero_size []; + +/** @} */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* LIBBSP_POWERPC_SHARED_START_H */ diff --git a/c/src/lib/libbsp/powerpc/shared/src/bsp-start-zero.S b/c/src/lib/libbsp/powerpc/shared/src/bsp-start-zero.S new file mode 100644 index 0000000000..cc05608452 --- /dev/null +++ b/c/src/lib/libbsp/powerpc/shared/src/bsp-start-zero.S @@ -0,0 +1,102 @@ +/** + * @file + * + * @ingroup bsp_start + * + * @brief bsp_start_zero() implementation. + */ + +/* + * Copyright (c) 2010 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Obere Lagerstr. 30 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * 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. + * + * $Id$ + */ + +#include <rtems/asm.h> +#include <bspopts.h> + + .globl bsp_start_zero + .globl bsp_start_zero_begin + .globl bsp_start_zero_end + .globl bsp_start_zero_size + + .section ".bsp_start_text", "ax" + .type bsp_start_zero, @function +bsp_start_zero: +bsp_start_zero_begin: + li r0, 0 + subi r11, r3, 1 + clrrwi r11, r11, 5 + addi r10, r11, 32 + subf r11, r3, r10 + cmplw cr7, r11, r4 + add r9, r3, r4 + ble- cr7, head_end_done + mr r10, r9 +head_end_done: + subf r11, r3, r10 + addi r11, r11, 1 + mtctr r11 + + /* Head loop */ + b head_loop_update +head_loop_begin: + stb r0, 0(r3) + addi r3, r3, 1 +head_loop_update: + bdnz+ head_loop_begin + + subf r11, r3, r9 + srwi r11, r11, 5 + addi r11, r11, 1 + mtctr r11 + + /* Main loop */ + b main_loop_update +main_loop_begin: +#ifdef DATA_CACHE_ENABLE + dcbz r0, r3 + dcbf r0, r3 +#else + stw r0, 0(r3) + stw r0, 4(r3) + stw r0, 8(r3) + stw r0, 12(r3) + stw r0, 16(r3) + stw r0, 20(r3) + stw r0, 24(r3) + stw r0, 28(r3) +#endif + addi r3, r3, 32 +main_loop_update: + bdnz+ main_loop_begin + + subf r9, r3, r9 + addi r9, r9, 1 + mtctr r9 + + /* Tail loop */ + b tail_loop_update +tail_loop_begin: + stb r0, 0(r3) + addi r3, r3, 1 +tail_loop_update: + bdnz+ tail_loop_begin + + /* Return */ + sync + isync + blr + +bsp_start_zero_end: + .set bsp_start_zero_size, bsp_start_zero_end - bsp_start_zero_begin |