/usr/src/blcr-0.8.5/vmadump4/vmadump.h is in blcr-dkms 0.8.5-2.1.
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 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 | /*-------------------------------------------------------------------------
* vmadump.h: Definitions for VMADump
*
* 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.h,v 1.47.4.2 2012/12/18 18:32:09 phargrov Exp $
*
* THIS VERSION MODIFIED FOR BLCR <http://ftg.lbl.gov/checkpoint>
*-----------------------------------------------------------------------*/
#ifndef _VMADUMP_H
#define _VMADUMP_H
/* Everything past this struct is architecture dependent */
struct vmadump_header {
unsigned char magic[3];
unsigned char fmt_vers; /* version of dump format */
unsigned char arch;
unsigned char major; /* Kernel rev dumped from */
unsigned char minor;
unsigned char patch;
};
struct vmadump_vma_header {
unsigned long start; /* ~0 = end of list */
unsigned long end;
unsigned long flags;
unsigned long namelen; /* 0 = data follows */
unsigned long pgoff; /* file offset for mmap, in page units */
};
struct vmadump_page_header {
unsigned long start; /* ~0 = end of list */
unsigned int num_pages;
};
struct vmadump_mm_info {
unsigned long start_code, end_code;
unsigned long start_data, end_data;
unsigned long start_brk, brk;
unsigned long start_stack;
unsigned long arg_start, arg_end;
unsigned long env_start, env_end;
};
struct vmadump_page_list_header {
unsigned int fill;
/* May add hash list or other data here later */
};
#define VMAD_CHUNKHEADER_SIZE PAGE_SIZE
#define VMAD_CHUNKHEADER_MIN sizeof(struct vmadump_page_header)
#define VMAD_END_OF_CHUNKS ~0UL
#define VMAD_HOOK_TAG_LEN 16
struct vmadump_hook_header {
char tag[VMAD_HOOK_TAG_LEN];
long size; /* NOT including the header */
};
#define VMAD_MAGIC {0x56,0x4d,0x41}
#define VMAD_FMT_VERS 6
#define VMAD_ARCH_i386 1
#define VMAD_ARCH_sparc 2
#define VMAD_ARCH_alpha 3
#define VMAD_ARCH_ppc 4
#define VMAD_ARCH_x86_64 5
#define VMAD_ARCH_ppc64 6
#define VMAD_ARCH_arm 7
#define VMAD_ARCH_sparc64 8
#if defined(__i386__)
#define VMAD_ARCH VMAD_ARCH_i386
#define HAVE_BINFMT_VMADUMP 1
#elif defined(__sparc__) && defined(__arch64__)
#define VMAD_ARCH VMAD_ARCH_sparc64
#elif defined(__sparc__)
#define VMAD_ARCH VMAD_ARCH_sparc
#define HAVE_BINFMT_VMADUMP 1
#elif defined(__alpha__)
#define VMAD_ARCH VMAD_ARCH_alpha
/* Alpha execve doesn't save enough state on the way into the kernel
* to support complete state restoration, so no binfmt_vmadump on
* alpha. */
#undef HAVE_BINFMT_VMADUMP
#elif defined(powerpc)
#define VMAD_ARCH VMAD_ARCH_ppc
#define HAVE_BINFMT_VMADUMP 1
#elif defined(__x86_64__)
#define VMAD_ARCH VMAD_ARCH_x86_64
/* The complications of syscall return in the mixed mode world make
* this one not worth it... */
#undef HAVE_BINFMT_VMADUMP
#elif defined(__powerpc64__)
#define VMAD_ARCH VMAD_ARCH_ppc64
#define HAVE_BINFMT_VMADUMP 1
#elif defined(__arm__)
#define VMAD_ARCH VMAD_ARCH_arm
#define HAVE_BINFMT_VMADUMP 1
#else
#error VMADUMP does not support this architecture
#endif
/* Defs for the syscall interface */
#define VMAD_DO_DUMP 0x00
#define VMAD_DO_UNDUMP 0x01
#define VMAD_DO_EXECDUMP 0x02
#define VMAD_LIB_CLEAR 0x30
#define VMAD_LIB_ADD 0x31
#define VMAD_LIB_DEL 0x32
#define VMAD_LIB_LIST 0x33
#define VMAD_LIB_SIZE 0x34
/*--- Flags for dump/undump ---*/
#define VMAD_DUMP_LIBS 1
#define VMAD_DUMP_EXEC 2
#define VMAD_DUMP_OTHER 4
#define VMAD_DUMP_ALL 7
#define VMAD_FLAG_BPROC 8
/* These are the flags that the user is allowed to set */
#define VMAD_FLAG_USER_MASK 0x7
struct vmadump_execdump_args {
const char *arg0;
char * const *argv;
char * const *envp;
int fd;
int flags;
};
#include "blcr_vmadump.h"
#ifdef __KERNEL__
#include <cr_module.h>
extern int vmadump_init_module(void);
extern void vmadump_cleanup_module(void);
#if 0 /* BLCR uses its own "proc_req" structures in place of this structure */
struct vmadump_map_ctx {
/* map_open:
* given a file, open it. The file should be opened with
* the given flags. The filename argument is a kernel space pointer.
* The semantics should be identical to:
* filp_open(filename, flags);
*
* map_name:
* given a file structure, return the canonical name for it. The
* semantics should be identical to:
* d_path(file->f_dentry, file->f_vfsmnt, buffer, size);
*
* read_file, write_file:
* Alternate file read/write routines. These should have the
* same semantics as a blocking sys_read and sys_write. */
struct file *(*map_open) (struct vmadump_map_ctx *ctx,
const char *filename, int flags);
char *(*map_name) (struct vmadump_map_ctx *ctx, struct file *,
char *buffer, int size);
ssize_t (*read_file) (struct vmadump_map_ctx *, struct file *,
void *, size_t);
ssize_t (*write_file)(struct vmadump_map_ctx *, struct file *,
const void *, size_t);
void *private;
};
#endif
extern loff_t vmadump_store_page_list(cr_chkpt_proc_req_t *ctx, struct file *file,
unsigned long start, unsigned long end);
extern loff_t vmadump_store_dirty_page_list(cr_chkpt_proc_req_t *ctx, struct file *file,
unsigned long start, unsigned long end);
extern int vmadump_load_page_list(cr_rstrt_proc_req_t *ctx,
struct file *file, int is_exec);
extern loff_t vmadump_freeze_proc(cr_chkpt_proc_req_t *, struct file *file,
struct pt_regs *regs, int flags);
extern long vmadump_thaw_proc (cr_rstrt_proc_req_t *, struct file *file,
struct pt_regs *regs, int flags);
extern long vmad_remap(cr_rstrt_proc_req_t *ctx, unsigned long from_addr,
unsigned long to_addr, unsigned long len);
#if 0 /* Neither used nor maintened in BLCR */
extern long do_vmadump (long op, long arg0, long arg1, struct pt_regs *regs);
#endif
#if 0 /* Neither used nor maintened in BLCR */
/*--- Interface for modules installing vmadump hooks ---------------*/
struct vmadump_hook_handle;
struct vmadump_hook {
char *tag; /* name */
/* freeze:
*
* return value - total number of bytes written INCLUDING header(s)
*
*
*/
long (*freeze)(struct vmadump_hook_handle *h, struct pt_regs *regs,
int flags);
int (*thaw )(struct vmadump_hook_handle *h,
struct vmadump_hook_header *hh,
struct pt_regs *regs);
};
extern int vmadump_add_hook(struct vmadump_hook *hook);
extern int vmadump_del_hook(struct vmadump_hook *hook);
/* Read/write routines for hooks */
extern ssize_t vmadump_read_u (struct vmadump_hook_handle *h,
void *buf, size_t count);
extern ssize_t vmadump_read_k (struct vmadump_hook_handle *h,
void *buf, size_t count);
extern ssize_t vmadump_write_u (struct vmadump_hook_handle *h,
const void *buf, size_t count);
extern ssize_t vmadump_write_k (struct vmadump_hook_handle *h,
const void *buf, size_t count);
#endif
#ifdef __VMADUMP_INTERNAL__
#if 0
#if defined(__i386__)
#define reg_arg0(r) ((r)->ebx)
#define reg_arg1(r) ((r)->ecx)
#define reg_arg2(r) ((r)->edx)
#elif defined(__sparc__)
#define reg_arg0(r) ((r)->u_regs[((r)->u_regs[UREG_G1]==0?1:0)+UREG_I0])
#define reg_arg1(r) ((r)->u_regs[((r)->u_regs[UREG_G1]==0?1:0)+UREG_I1])
#define reg_arg2(r) ((r)->u_regs[((r)->u_regs[UREG_G1]==0?1:0)+UREG_I2])
#elif defined(__alpha__)
#define reg_arg0(r) ((r)->trap_a0)
#define reg_arg1(r) ((r)->trap_a1)
#define reg_arg2(r) ((r)->trap_a2)
#elif defined(powerpc)
#define reg_arg0(r) ((r)->gpr[3])
#define reg_arg1(r) ((r)->gpr[4])
#define reg_arg2(r) ((r)->gpr[5])
#elif defined(__x86_64__)
#define reg_arg0(r) ((r)->rdi)
#define reg_arg1(r) ((r)->rsi)
#define reg_arg2(r) ((r)->rdx)
#elif defined(__arm__)
#define reg_arg0(r) ((r)->uregs[ 0 ])
#define reg_arg1(r) ((r)->uregs[ 1 ])
#define reg_arg2(r) ((r)->uregs[ 2 ])
#else
#error reg_arg[0-2] needs to be defined for this arch
#endif
#endif
#define CR_ERR_CTX CR_ERR_PROC_REQ
#define CR_WARN_CTX CR_WARN_PROC_REQ
int vmadump_arch_init (void);
void vmadump_arch_cleanup(void);
long vmadump_store_cpu (cr_chkpt_proc_req_t *ctx, struct file *file,
struct pt_regs *regs);
int vmadump_restore_cpu(cr_rstrt_proc_req_t *ctx, struct file *file,
struct pt_regs *regs);
#if 0 /* BLCR uses its own I/O paths */
extern ssize_t write_kern(struct vmadump_map_ctx *ctx, struct file *file,
const void *buf, size_t count);
extern ssize_t read_kern(struct vmadump_map_ctx *ctx,
struct file *file, void *buf, size_t count);
#else
/* Wrapper for I/O error reporting from vmadump. */
#define io_wrap(_op,_ctx,_file,_buf,_count) \
cr_##_op((_ctx)->req->errbuf,(_file),(_buf),(_count))
#define write_kern(_ctx,_file,_buf,_count) io_wrap(kwrite,_ctx,_file,_buf,_count)
#define read_kern(_ctx,_file,_buf,_count) io_wrap(kread,_ctx,_file,_buf,_count)
#define write_user(_ctx,_file,_buf,_count) io_wrap(uwrite,_ctx,_file,_buf,_count)
#define read_user(_ctx,_file,_buf,_count) io_wrap(uread,_ctx,_file,_buf,_count)
#endif
#if VMAD_HAVE_ARCH_MAPS
extern loff_t vmad_store_arch_map(cr_chkpt_proc_req_t *ctx,
struct file *file,
struct vm_area_struct *map, int flags);
extern int vmad_load_arch_map(cr_rstrt_proc_req_t *ctx,
struct file *file,
struct vmadump_vma_header *head);
#endif /* if VMAD_HAVE_ARCH_MAPS */
#endif /* ifdef __VMADUMP_INTERNAL__ */
#endif /* ifdef __KERNEL__ */
#endif
/*
* Local variables:
* c-basic-offset: 4
* End:
*/
|