forked from Imagelibrary/rtems
2010-12-29 Sebastian Huber <sebastian.huber@embedded-brains.de>
* shared/include/start.h, shared/src/bsp-start-zero.S: New files.
This commit is contained in:
@@ -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
|
||||
|
||||
86
c/src/lib/libbsp/powerpc/shared/include/start.h
Normal file
86
c/src/lib/libbsp/powerpc/shared/include/start.h
Normal file
@@ -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 */
|
||||
102
c/src/lib/libbsp/powerpc/shared/src/bsp-start-zero.S
Normal file
102
c/src/lib/libbsp/powerpc/shared/src/bsp-start-zero.S
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user