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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [uClibc/] [libc/] [sysdeps/] [linux/] [e1/] [longjmp.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1325 phoenix
/*  This file is lisenced under LGPL
2
 *  Copyright (C) 2002-2003,    George Thanos <george.thanos@gdt.gr>
3
 *                              Yannis Mitsos <yannis.mitsos@gdt.gr>
4
 */
5
 
6
#include <syscall.h>
7
#include <setjmp.h>
8
#include <stdio.h>
9
#include <signal.h>
10
 
11
#define __NR_e1newSP  224
12
static inline _syscall1(int, e1newSP, unsigned long, SavedSP )
13
 
14
unsigned long jmpbuf_ptr;
15
 
16
void longjmp(jmp_buf state, int value )
17
{
18
        if(!value)
19
                state->__jmpbuf->ReturnValue = 1;
20
        else
21
                state->__jmpbuf->ReturnValue = value;
22
 
23
        jmpbuf_ptr = (unsigned long)state;
24
        e1newSP(state->__jmpbuf->SavedSP);
25
 
26
#define _state_ ((struct __jmp_buf_tag*)jmpbuf_ptr)
27
        asm volatile("mov L0, %0\n\t"
28
                     "mov L1, %1\n\t"
29
                     "mov L2, %2\n\t"
30
                     "mov G3, %3\n\t"
31
                     "mov G4, %4\n\t"
32
                     "ret PC, L1\n\t"
33
                     :/*no output*/
34
                     :"l"(_state_->__jmpbuf->ReturnValue),
35
                      "l"(_state_->__jmpbuf->SavedPC),
36
                      "l"(_state_->__jmpbuf->SavedSR),
37
                      "l"(_state_->__jmpbuf->G3),
38
                      "l"(_state_->__jmpbuf->G4)
39
                     :"%G3", "%G4", "%L0", "%L1" );
40
#undef _state_
41
}
42
 
43
void siglongjmp(sigjmp_buf state, int value )
44
{
45
        if( state->__mask_was_saved )
46
                sigprocmask(SIG_SETMASK, &state->__saved_mask, NULL);
47
 
48
        if(!value)
49
                state->__jmpbuf->ReturnValue = 1;
50
        else
51
                state->__jmpbuf->ReturnValue = value;
52
 
53
        jmpbuf_ptr = (unsigned long)state;
54
        e1newSP(state->__jmpbuf->SavedSP);
55
 
56
 
57
#define _state_ ((struct __jmp_buf_tag*)jmpbuf_ptr)
58
        asm volatile("mov L0, %0\n\t"
59
                     "mov L1, %1\n\t"
60
                     "mov L2, %2\n\t"
61
                     "mov G3, %3\n\t"
62
                     "mov G4, %4\n\t"
63
                     "ret PC, L1\n\t"
64
                     :/*no output*/
65
                     :"l"(_state_->__jmpbuf->ReturnValue),
66
                      "l"(_state_->__jmpbuf->SavedPC),
67
                      "l"(_state_->__jmpbuf->SavedSR),
68
                      "l"(_state_->__jmpbuf->G3),
69
                      "l"(_state_->__jmpbuf->G4)
70
                     :"%G3", "%G4", "%L0", "%L1" );
71
#undef _state_
72
}

powered by: WebSVN 2.1.0

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