source: rtems/bsps/powerpc/motorola_powerpc/bootloader/lib.c @ eb36d11

5
Last change on this file since eb36d11 was 03e1d837, checked in by Sebastian Huber <sebastian.huber@…>, on 04/24/18 at 05:06:36

bsps/powerpc: Move bootloader to bsps

This bootloader is only used by the motorola_powerpc BSP.

This patch is a part of the BSP source reorganization.

Update #3285.

  • Property mode set to 100644
File size: 1.3 KB
RevLine 
[acc25ee]1/* lib.c
2 *
3 *  This file contains the implementation of functions that are unresolved
4 *  in the bootloader.  Unfortunately it  shall not use any object code
5 *  from newlib or rtems  because they are not compiled with the right option!!!
6 *
7 *  You've been warned!!!.
[4abbc567]8 */
9
10/*
11 *  Copyright (C) 1998, 1999 valette@crf.canon.fr
[acc25ee]12 *
13 *  The license and distribution terms for this file may be
[0c875c6a]14 *  found in the file LICENSE in this distribution or at
[c499856]15 *  http://www.rtems.org/license/LICENSE.
[acc25ee]16 */
17
[4abbc567]18
19/*
20 * Provide our own prototypes to avoid warnings and risk getting inlined
21 * conflicts from the normal header files.
22 */
23void* memset(void *p, int c, unsigned int n);
24void* memcpy(void *dst, const void * src, unsigned int n);
25char* strcat(char * dest, const char * src);
26int strlen(const char* string);
27
[acc25ee]28void* memset(void *p, int c, unsigned int n)
29{
30  char *q =p;
31  for(; n>0; --n) *q++=c;
32  return p;
33}
34
35void* memcpy(void *dst, const void * src, unsigned int n)
36{
37  unsigned char *d=dst;
38  const unsigned char *s=src;
[6128a4a]39
[acc25ee]40  while(n-- > 0) *d++=*s++;
41  return dst;
42}
[6128a4a]43
[acc25ee]44char* strcat(char * dest, const char * src)
45{
46  char *tmp = dest;
47
48  while (*dest)
49    dest++;
50  while ((*dest++ = *src++) != '\0')
51    ;
52  return tmp;
53}
54
55int strlen(const char* string)
56{
57  register int i = 0;
58
59  while (string[i] != '\0')
60    ++i;
61  return i;
62}
Note: See TracBrowser for help on using the repository browser.