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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib/] [newlib/] [libc/] [machine/] [i386/] [setjmp.S] - Blame information for rev 1774

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

Line No. Rev Author Line
1 39 lampret
/* This is file is a merger of SETJMP.S and LONGJMP.S */
2
/*
3
 *  This file was modified to use the __USER_LABEL_PREFIX__ and
4
 *  __REGISTER_PREFIX__ macros defined by later versions of GNU cpp by
5
 *  Joel Sherrill (joel@OARcorp.com)
6
 *
7
 ** Copyright (C) 1991 DJ Delorie, 24 Kirsten Ave, Rochester NH 03867-2954
8
 **
9
 ** This file is distributed under the terms listed in the document
10
 ** "copying.dj", available from DJ Delorie at the address above.
11
 ** A copy of "copying.dj" should accompany this file; if not, a copy
12
 ** should be available from where this file was obtained.  This file
13
 ** may not be distributed without a verbatim copy of "copying.dj".
14
 **
15
 ** This file is distributed WITHOUT ANY WARRANTY; without even the implied
16
 ** warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
 */
18
 
19
 /*
20
 **     jmp_buf:
21
 **      eax ebx ecx edx esi edi ebp esp eip
22
 **      0   4   8   12  16  20  24  28  32
23
 */
24
 
25
/* These are predefined by new versions of GNU cpp.  */
26
 
27
#ifndef __USER_LABEL_PREFIX__
28
#define __USER_LABEL_PREFIX__ _
29
#endif
30
 
31
/***************************** TEMPORARY ******************************
32
 *
33
 *  It appears that the i386-coff configuration of gcc 2.6.2 does not
34
 *  do the __REGISTER_PREFIX__ correctly.  Fix this when it does.
35
 **********************************************************************/
36
#define __REGISTER_PREFIX__ %
37
#ifndef __REGISTER_PREFIX__
38
#define __REGISTER_PREFIX__
39
#endif
40
 
41
/* ANSI concatenation macros.  */
42
 
43
#define CONCAT1(a, b) CONCAT2(a, b)
44
#define CONCAT2(a, b) a ## b
45
 
46
/* Use the right prefix for global labels.  */
47
 
48
#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
49
 
50
/* Use the right prefix for registers.  */
51
 
52
#define REG(x) CONCAT1 (__REGISTER_PREFIX__, x)
53
 
54
#define eax REG (eax)
55
#define ebx REG (ebx)
56
#define ecx REG (ecx)
57
#define edx REG (edx)
58
#define esi REG (esi)
59
#define edi REG (edi)
60
#define ebp REG (ebp)
61
#define esp REG (esp)
62
 
63
#define ax REG (ax)
64
#define bx REG (bx)
65
#define cx REG (cx)
66
#define dx REG (dx)
67
 
68
#define ah REG (ah)
69
#define bh REG (bh)
70
#define ch REG (ch)
71
#define dh REG (dh)
72
 
73
#define al REG (al)
74
#define bl REG (bl)
75
#define cl REG (cl)
76
#define dl REG (dl)
77
 
78
        .global SYM (setjmp)
79
        .global SYM (longjmp)
80
 
81
SYM (setjmp):
82
 
83
        pushl   ebp
84
        movl    esp,ebp
85
 
86
        pushl   edi
87
        movl    8 (ebp),edi
88
 
89
        movl    eax,0 (edi)
90
        movl    ebx,4 (edi)
91
        movl    ecx,8 (edi)
92
        movl    edx,12 (edi)
93
        movl    esi,16 (edi)
94
 
95
        movl    -4 (ebp),eax
96
        movl    eax,20 (edi)
97
 
98
        movl    0 (ebp),eax
99
        movl    eax,24 (edi)
100
 
101
        movl    esp,eax
102
        addl    $12,eax
103
        movl    eax,28 (edi)
104
 
105
        movl    4 (ebp),eax
106
        movl    eax,32 (edi)
107
 
108
        popl    edi
109
        movl    $0,eax
110
        leave
111
        ret
112
 
113
SYM (longjmp):
114
        pushl   ebp
115
        movl    esp,ebp
116
 
117
        movl    8(ebp),edi      /* get jmp_buf */
118
        movl    12(ebp),eax     /* store retval in j->eax */
119
        movl    eax,0(edi)
120
 
121
        movl    24(edi),ebp
122
 
123
        cli
124
        movl    28(edi),esp
125
 
126
        pushl   32(edi)
127
 
128
        movl    0(edi),eax
129
        movl    4(edi),ebx
130
        movl    8(edi),ecx
131
        movl    12(edi),edx
132
        movl    16(edi),esi
133
        movl    20(edi),edi
134
        sti
135
 
136
        ret

powered by: WebSVN 2.1.0

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