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.  MIPS version.
00002    Copyright (C) 1996, 1997 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 <mach/thread_status.h>
00023 
00024 
00025 /* Set up STATE to do the equivalent of `longjmp (ENV, VAL);'.  */
00026 
00027 void
00028 _hurd_longjmp_thread_state (void *state, jmp_buf env, int val)
00029 {
00030   struct mips_thread_state *ts = state;
00031 
00032   ts->r16 = env[0].__jmpbuf[0].__regs[0];
00033   ts->r17 = env[0].__jmpbuf[0].__regs[1];
00034   ts->r18 = env[0].__jmpbuf[0].__regs[2];
00035   ts->r19 = env[0].__jmpbuf[0].__regs[3];
00036   ts->r20 = env[0].__jmpbuf[0].__regs[4];
00037   ts->r21 = env[0].__jmpbuf[0].__regs[5];
00038   ts->r22 = env[0].__jmpbuf[0].__regs[6];
00039   ts->r23 = env[0].__jmpbuf[0].__regs[7];
00040   ts->r28 = (int) env[0].__jmpbuf[0].__gp;
00041   ts->r29 = (int) env[0].__jmpbuf[0].__sp;
00042   ts->r30 = (int) env[0].__jmpbuf[0].__fp;
00043   ts->pc = (int) env[0].__jmpbuf[0].__pc;
00044   ts->r2 = val ?: 1;
00045 }