PageRenderTime 14ms CodeModel.GetById 7ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 1ms

/arch/ppc/xmon/setjmp.c

https://bitbucket.org/evzijst/gittest
C | 29 lines | 21 code | 2 blank | 6 comment | 2 complexity | 757d3155cff0db3f733cf8c6fc839cbc MD5 | raw file
 1/*
 2 * Copyright (C) 1996 Paul Mackerras.
 3 *
 4 * NB this file must be compiled with -O2.
 5 */
 6
 7int
 8xmon_setjmp(long *buf)
 9{
10    asm ("mflr 0; stw 0,0(%0);"
11	 "stw 1,4(%0); stw 2,8(%0);"
12	 "mfcr 0; stw 0,12(%0);"
13	 "stmw 13,16(%0)"
14	 : : "r" (buf));
15    /* XXX should save fp regs as well */
16    return 0;
17}
18
19void
20xmon_longjmp(long *buf, int val)
21{
22    if (val == 0)
23	val = 1;
24    asm ("lmw 13,16(%0);"
25	 "lwz 0,12(%0); mtcrf 0x38,0;"
26	 "lwz 0,0(%0); lwz 1,4(%0); lwz 2,8(%0);"
27	 "mtlr 0; mr 3,%1"
28	 : : "r" (buf), "r" (val));
29}