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

Subversion Repositories or1k

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

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

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

powered by: WebSVN 2.1.0

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