Back to index

glibc  2.9
longjmp-ts.c
Go to the documentation of this file.
00001 /* Perform a `longjmp' on a Mach thread_state.  PowerPC version.
00002    Copyright (C) 1991,94,95,97,2001, 2006 Free Software Foundation, Inc.
00003    This file is part of the GNU C Library.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with the GNU C Library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA.  */
00019 
00020 #include <hurd/signal.h>
00021 #include <setjmp.h>
00022 #include <jmpbuf-offsets.h>
00023 #include <mach/thread_status.h>
00024 
00025 
00026 /* Set up STATE to do the equivalent of `longjmp (ENV, VAL);'.  */
00027 
00028 void
00029 _hurd_longjmp_thread_state (void *state, jmp_buf env, int val)
00030 {
00031   struct ppc_thread_state *ts = state;
00032 
00033   /* XXX should we set up the FPRs as well? And how? */
00034   ts->r1 = env[0].__jmpbuf[JB_GPR1];
00035   ts->r2 = env[0].__jmpbuf[JB_GPR2];
00036   ts->r14 = env[0].__jmpbuf[JB_GPRS+0];
00037   ts->r15 = env[0].__jmpbuf[JB_GPRS+1];
00038   ts->r16 = env[0].__jmpbuf[JB_GPRS+2];
00039   ts->r17 = env[0].__jmpbuf[JB_GPRS+3];
00040   ts->r18 = env[0].__jmpbuf[JB_GPRS+4];
00041   ts->r19 = env[0].__jmpbuf[JB_GPRS+5];
00042   ts->r20 = env[0].__jmpbuf[JB_GPRS+6];
00043   ts->r21 = env[0].__jmpbuf[JB_GPRS+7];
00044   ts->r22 = env[0].__jmpbuf[JB_GPRS+8];
00045   ts->r23 = env[0].__jmpbuf[JB_GPRS+9];
00046   ts->r24 = env[0].__jmpbuf[JB_GPRS+10];
00047   ts->r25 = env[0].__jmpbuf[JB_GPRS+11];
00048   ts->r26 = env[0].__jmpbuf[JB_GPRS+12];
00049   ts->r27 = env[0].__jmpbuf[JB_GPRS+13];
00050   ts->r28 = env[0].__jmpbuf[JB_GPRS+14];
00051   ts->r29 = env[0].__jmpbuf[JB_GPRS+15];
00052   ts->r30 = env[0].__jmpbuf[JB_GPRS+16];
00053   ts->r31 = env[0].__jmpbuf[JB_GPRS+17];
00054   ts->cr = env[0].__jmpbuf[JB_CR];
00055   ts->r3 = val ?: 1;
00056   ts->srr0 = ts->lr = env[0].__jmpbuf[JB_LR];
00057 }