summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/powerpc/shared/startup/zerobss.c
blob: b3ab1ad9d96edb227388a367dbb3ecd165614c52 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
 *  zero the various bss areas.
 */

/*
 *  COPYRIGHT (c) 1989-2014.
 *  On-Line Applications Research Corporation (OAR).
 *
 *  The license and distribution terms for this file may be
 *  found in the file LICENSE in this distribution or at
 *  http://www.rtems.org/license/LICENSE.
 *
 *  Modified to support the MCP750.
 *  Modifications Copyright (C) 1999 Eric Valette. valette@crf.canon.fr
 */

#include <string.h>
#include <bsp.h>

/* prevent these from being accessed in the short data areas */
extern unsigned long __bss_start[], __SBSS_START__[], __SBSS_END__[];
extern unsigned long __SBSS2_START__[], __SBSS2_END__[];
extern unsigned long __bss_end[];

void zero_bss(void)
{
  memset(
    __SBSS_START__,
    0,
    ((unsigned) __SBSS_END__) - ((unsigned)__SBSS_START__)
  );
  memset(
    __SBSS2_START__,
    0,
    ((unsigned) __SBSS2_END__) - ((unsigned)__SBSS2_START__)
  );
  memset(
    __bss_start,
    0,
    ((unsigned) __bss_end) - ((unsigned)__bss_start)
  );
}