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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [hal/] [m68k/] [arch/] [v2_0/] [src/] [hal_arch.S] - Blame information for rev 565

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

Line No. Rev Author Line
1 27 unneback
##=============================================================================
2
#####ECOSGPLCOPYRIGHTBEGIN####
3
## -------------------------------------------
4
## This file is part of eCos, the Embedded Configurable Operating System.
5
## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
6
##
7
## eCos is free software; you can redistribute it and/or modify it under
8
## the terms of the GNU General Public License as published by the Free
9
## Software Foundation; either version 2 or (at your option) any later version.
10
##
11
## eCos is distributed in the hope that it will be useful, but WITHOUT ANY
12
## WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14
## for more details.
15
##
16
## You should have received a copy of the GNU General Public License along
17
## with eCos; if not, write to the Free Software Foundation, Inc.,
18
## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
19
##
20
## As a special exception, if other files instantiate templates or use macros
21
## or inline functions from this file, or you compile this file and link it
22
## with other works to produce a work based on this file, this file does not
23
## by itself cause the resulting work to be covered by the GNU General Public
24
## License. However the source code for this file must still be made available
25
## in accordance with section (3) of the GNU General Public License.
26
##
27
## This exception does not invalidate any other reasons why a work based on
28
## this file might be covered by the GNU General Public License.
29
##
30
## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
31
## at http://sources.redhat.com/ecos/ecos-license/
32
## -------------------------------------------
33
#####ECOSGPLCOPYRIGHTEND####
34
##=============================================================================
35
/*****************************************************************************
36
hal_arch.S -- m68k architecture code
37
*****************************************************************************/
38
 
39
#include 
40
 
41
/*****************************************************************************
42
FUNC_START -- Function declaration macro
43
*****************************************************************************/
44
#define FUNC_START(name)                        \
45
        .text;                                  \
46
        .even;                                  \
47
        .globl name;                            \
48
name:
49
 
50
/*****************************************************************************
51
     The following routines assume the hal_jmp_buf structure is defined  as
52
shown below.
53
 
54
typedef struct {
55
    cyg_uint32 d2;
56
    cyg_uint32 d3;
57
    cyg_uint32 d4;
58
    cyg_uint32 d5;
59
    cyg_uint32 d6;
60
    cyg_uint32 d7;
61
    cyg_uint32 a2;
62
    cyg_uint32 a3;
63
    cyg_uint32 a4;
64
    cyg_uint32 a5;
65
    cyg_uint32 a6;
66
    cyg_uint32 sp;
67
    cyg_uint32 pc;
68
} hal_jmp_buf_t;
69
typedef cyg_uint32 hal_jmp_buf[sizeof(hal_jmp_buf_t) / sizeof(cyg_uint32)];
70
*****************************************************************************/
71
 
72
/*****************************************************************************
73
hal_m68k_setjmp -- Generic setjmp for the m68k architecture
74
 
75
externC int hal_m68k_setjmp(hal_jmp_buf env);
76
 
77
INPUT:
78
 
79
     0(%sp): return address
80
 
81
     4(%sp): env - address of a hal_jmp_buf structure
82
 
83
OUTPUT:
84
 
85
     d0, d1, a0, a1 are ours to abuse.
86
 
87
RETURN VALUE:
88
 
89
     This routine always returns zero in d0.l.
90
 
91
*****************************************************************************/
92
FUNC_START(hal_m68k_setjmp)
93
 
94
    lea.l   4(%sp),%a1                  /*   Get a pointer to the  position */
95
                                        /* of the stack pointer before this */
96
                                        /* call was  made.  IMPORTANT:  The */
97
                                        /* longjmp    routine    and    the */
98
                                        /* exception  handler  assume  that */
99
                                        /* saved stack  pointers  point  to */
100
                                        /* the location of the stack before */
101
                                        /* the routine/exception occurred.  */
102
 
103
    move.l  (%a1),%a0                   /*   Get a pointer to the buffer to */
104
                                        /* save our state into.             */
105
 
106
    movem.l %d2-%d7/%a2-%a6,(%a0)       /*   Write  all  of  the  preserved */
107
    lea     (11*4)(%a0),%a0             /* registers,  the  stack  pointer, */
108
    move.l  %a1,(%a0)+                  /* and the return address into  the */
109
    move.l  (%sp),(%a0)                 /* structure.                       */
110
 
111
    moveq.l #0,%d0                      /*   Load a zero  return value  and */
112
    rts                                 /* return.                          */
113
 
114
/*****************************************************************************
115
hal_m68k_longjmp -- Generic longjmp for the m68k architecture
116
 
117
externC void hal_m68k_longjmp(hal_jmp_buf env, int val);
118
 
119
INPUT:
120
 
121
     0(%sp): return address
122
 
123
     4(%sp): env - address of a hal_jmp_buf structure
124
 
125
     8(%sp): val - the non-zero value to return
126
 
127
OUTPUT:
128
 
129
     d0, d1, a0, a1 are ours to abuse.
130
 
131
RETURN VALUE:
132
 
133
     This routine always returns the value  from the val parameter in  d0.l
134
and to the location of the PC in the env structure.
135
 
136
*****************************************************************************/
137
FUNC_START(hal_m68k_longjmp)
138
 
139
    move.l  8(%sp),%d0                  /*   Load    the    return    value */
140
                                        /* parameter.                       */
141
 
142
    move.l  4(%sp),%a0                  /*   Get a pointer to the buffer to */
143
                                        /* read our state from.             */
144
 
145
    movem.l (%a0),%d2-%d7/%a2-%a6       /*   Load our preserved  registers, */
146
    lea     (11*4)(%a0),%a0             /* stack pointer and return address */
147
    move.l  (%a0)+,%d1                  /* from the structure.              */
148
    move.l  (%a0),%a1
149
 
150
    move.l  %d1,%sp                     /*   Set the stack pointer from the */
151
    jmp     (%a1)                       /* structure as  out current  stack */
152
                                        /* pointer and jump  to the  return */
153
                                        /* address from the structure.      */
154
 
155
 
156
 

powered by: WebSVN 2.1.0

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