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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib/] [newlib/] [libc/] [sys/] [cygwin/] [crt0.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 56 joel
 
2
#ifdef __PPC__
3
/* For the PowerPC, we want to make this function have its structured
4
   exception table exception function point to something we control.  */
5
 
6
extern void __cygwin_exception_handler();
7
extern void mainCRTStartup(void) __attribute__((__exception__(__cygwin_exception_handler)));
8
#endif
9
 
10
/* In the following ifdef'd i386 code, the FPU precision is set to 80 bits
11
   and all FPU exceptions are masked.  The former is needed to make long
12
   doubles work correctly.  The latter causes the FPU to generate NaNs and
13
   Infinities instead of signals for certain operations.
14
*/
15
 
16
#ifdef __i386__
17
#define FPU_RESERVED 0xF0C0
18
#define FPU_DEFAULT  0x033f
19
 
20
/* For debugging on *#!$@ windbg.  bp for breakpoint.  */
21
int __cygwin_crt0_bp = 0;
22
#endif
23
 
24
extern int main (int argc, char **argv);
25
 
26
void
27
mainCRTStartup ()
28
{
29
#ifdef __i386__
30
  if (__cygwin_crt0_bp)
31
    asm volatile ("int3");
32
 
33
  {
34
    volatile unsigned short cw;
35
 
36
    /* Get Control Word */
37
    __asm__ volatile ("fnstcw %0" : "=m" (cw) : );
38
 
39
    /* mask in */
40
    cw &= FPU_RESERVED;
41
    cw |= FPU_DEFAULT;
42
 
43
    /* set cw */
44
    __asm__ volatile ("fldcw %0" :: "m" (cw));
45
  }
46
#endif
47
 
48
  cygwin_crt0 (main);
49
}

powered by: WebSVN 2.1.0

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