/usr/src/blcr-0.8.5/vmadump4/vmadump_sparc.c is in blcr-dkms 0.8.5-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | /*-------------------------------------------------------------------------
* vmadump_sparc.c: sparc specific dumping/undumping routines
*
* Copyright (C) 1999-2001 by Erik Hendriks <erik@hendriks.cx>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* $Id: vmadump_sparc.c,v 1.4 2008/12/02 00:57:12 phargrov Exp $
*
* THIS VERSION MODIFIED FOR BLCR <http://ftg.lbl.gov/checkpoint>
*
* Experimental SPARC support contributed to BLCR by Vincentius Robby
* <vincentius@umich.edu> and Andrea Pellegrini <apellegr@umich.edu>.
*-----------------------------------------------------------------------*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/sched.h>
#include <asm/processor.h>
#define __VMADUMP_INTERNAL__
#include "vmadump.h"
long vmadump_store_cpu(cr_chkpt_proc_req_t *ctx, struct file *file,
struct pt_regs *regs) {
long bytes = 0, r;
/* Store struct pt_regs */
r = write_kern(ctx, file, regs, sizeof(*regs));
if (r != sizeof(*regs)) goto err;
bytes += r;
return bytes;
// apellegrini@umich.edu
// 2008/08/28
// No FPU support at this point
err:
if (r >= 0) r = -EIO;
return r;
}
int vmadump_restore_cpu(cr_rstrt_proc_req_t *ctx, struct file *file,
struct pt_regs *regs) {
struct pt_regs regtmp;
int r;
r = read_kern(ctx, file, ®tmp, sizeof(regtmp));
if (r != sizeof(regtmp)) goto bad_read;
/* Only allow chages to certain bits of PSR/TSTATE */
#if defined(__arch64__)
regtmp.tstate &= (TSTATE_ASI | TSTATE_ICC | TSTATE_XCC);
regtmp.tstate |= (regs->tstate & ~(TSTATE_ASI | TSTATE_ICC | TSTATE_XCC));
#else
regtmp.psr &= (PSR_ICC | PSR_EF);
regtmp.psr |= (regs->psr & ~(PSR_ICC | PSR_EF));
#endif
memcpy(regs, ®tmp, sizeof(regtmp));
return 0;
bad_read:
if (r >= 0) r = -EIO;
return r;
}
|