-/* prototypes not exported by osfmk. */
-extern void kmem_free(vm_map_t, vm_offset_t, vm_size_t);
-extern kern_return_t kmem_alloc_wired(vm_map_t, vm_offset_t *, vm_size_t);
-
-
-/* Globals */
-static off_t imagesizelimit = (4 * 4096);
-
-/* Information about the current panic image */
-static int image_bits = 32; /* Bitdepth */
-
-static char *image_pathname = NULL; /* path to it */
-static size_t image_pathlen = 0; /* and the length of the pathname */
-
-static vm_offset_t image_ptr = NULL; /* the image itself */
-static off_t image_size = 0; /* and the imagesize */
-
-
-__private_extern__ void
-get_panicimage(vm_offset_t *imageptr, vm_size_t *imagesize, int *imagebits)
-{
- *imageptr = image_ptr;
- *imagesize = image_size;
- *imagebits = image_bits;
-}
-
-static int
-panicimage_from_file(
- char *imname,
- off_t sizelimit,
- vm_offset_t *image,
- off_t *filesize,
- struct proc *p)
-{
- int error = 0;
- int error1 = 0;
- int aresid;
- struct nameidata nd;
- struct vattr vattr;
- struct vnode * vp;
- kern_return_t kret;
- struct pcred *pcred = p->p_cred;
- struct ucred *cred = pcred->pc_ucred;
- vm_offset_t iobuf;
-
- /* Open the file */
- NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, imname, p);
- error = vn_open(&nd, FREAD, S_IRUSR);
- if (error)
- return (error);
- vp = nd.ni_vp;
-
- if (vp->v_type != VREG) {
- error = EFAULT;
- goto out;
- }