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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib/] [libgloss/] [sparc/] [crt0.s] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 39 lampret
! Copyright (c) 1995 Cygnus Support
2
!
3
! The authors hereby grant permission to use, copy, modify, distribute,
4
! and license this software and its documentation for any purpose, provided
5
! that existing copyright notices are retained in all copies and that this
6
! notice is included verbatim in any distributions. No written agreement,
7
! license, or royalty fee is required for any of the authorized uses.
8
! Modifications to this software may be copyrighted by their authors
9
! and need not follow the licensing terms described here, provided that
10
! the new terms are clearly indicated on the first page of each file where
11
! they apply.
12
!
13
! C startup code for the Fujitsu SPARClite demo board
14
 
15
        .text
16
        .align 8
17
 
18
win_ovf_trap:
19
        sethi %hi(win_ovf), %l3
20
        jmpl %lo(win_ovf)+%l3, %g0
21
        mov %wim, %l0
22
        nop
23
 
24
win_unf_trap:
25
        sethi %hi(win_unf), %l3
26
        jmpl %lo(win_unf)+%l3, %g0
27
        mov %wim, %l0
28
        nop
29
 
30
no_fpu_trap:            ! Come here when no fpu exists.  This just skips the
31
        jmpl %l2, %g0   ! offending instruction.
32
        rett %l2+4
33
 
34
        .globl start
35
        .globl _start
36
 
37
start:
38
_start:
39
 
40
! First, copy prom & trap vectors to sram
41
 
42
        set 0x30000000, %l0
43
        set 0xfff8, %l1
44
        tst %l1                         ! Set condition codes
45
 
46
copyloop:
47
        ldd [%l1], %l2
48
        std %l2, [%l0 + %l1]
49
        bg copyloop
50
        deccc 8, %l1
51
 
52
        set 0x30000000, %l0             ! Base of new trap vector
53
        mov %l0, %tbr                   ! Install the new tbr
54
 
55
        set win_ovf_trap, %l1           ! Setup window overflow trap
56
        ldd [%l1], %l2
57
        std %l2, [%l0 + 5 * 16]
58
        ldd [%l1 + 8], %l2
59
        std %l2, [%l0 + 5 * 16 + 8]
60
 
61
        set win_unf_trap, %l1           ! Setup window underflow trap
62
        ldd [%l1], %l2
63
        std %l2, [%l0 + 6 * 16]
64
        ldd [%l1 + 8], %l2
65
        std %l2, [%l0 + 6 * 16 + 8]
66
 
67
! Try enabling the FPU by setting EF.  If that causes a trap, then we probably
68
! don't have an FPU.
69
 
70
        ldd [%l0 + 2 * 16], %l4         ! Save original trap routine
71
        set no_fpu_trap, %l1            ! Install new one
72
        ldd [%l1], %l2
73
        std %l2, [%l0 + 2 * 16]
74
 
75
        mov %psr, %l0
76
        sethi %hi(0x1000), %l1
77
        bset %l1, %l0
78
!       mov %l0, %psr
79
 
80
        std %l4, [2 * 16]               ! Restore original trap routine
81
 
82
        call _main
83
        nop

powered by: WebSVN 2.1.0

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