OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.18.0/] [newlib/] [libc/] [sys/] [z8ksim/] [crt0.c] - Blame information for rev 258

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 207 jeremybenn
extern char _start_bss;
2
extern char _end_bss;
3
extern int main(int argc, char **argv, char **environ);
4
void __main();
5
 
6
static void
7
enter()
8
{
9
#if defined(__Z8002__)
10
  __main();
11
#endif
12
  exit(main(0,0,0));
13
}
14
start()
15
{
16
  char *p;
17
#if defined(__Z8002__)
18
  asm("ld       r15,#__stack_top");
19
  asm("ld       r10,r15");
20
#endif
21
#if defined(__Z8001__)
22
  asm("ldl      rr14,#__stack_top");
23
  asm("ldl      rr10,rr14");
24
#endif
25
 
26
 
27
  /* zero bss */
28
  p = &_start_bss;
29
  while (p < & _end_bss)
30
  {
31
    *p++ = 0;
32
  }
33
  enter();
34
}
35
 
36
#if defined(__Z8002__)
37
void __do_global_ctors ()
38
{
39
  typedef void (*pfunc)();
40
  extern pfunc __ctors[];
41
  extern pfunc __ctors_end[];
42
  pfunc *p;
43
  for (p = __ctors_end; p > __ctors; )
44
    {
45
      (*--p)();
46
    }
47
}
48
 
49
void __main()
50
{
51
  static int initialized;
52
  if (! initialized)
53
    {
54
      initialized = 1;
55
      __do_global_ctors ();
56
    }
57
}
58
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.