type ksymmap = Virt_mem_mmap.addr Ksymmap.t
(** Kernel symbol table (map of kernel symbols to addresses). *)
-(** {2 Kernel images and associated data} *)
+(** {2 Kernel memory images and associated metadata}
-type image = {
+ The kimage structure captures everything known about a kernel
+ image, including the source domain details, kernel address, kernel
+ symbols, kernel memory map, and all the kernel structures parsed
+ out of the memory map.
+*)
+
+type utsname = {
+ uts_kernel_name : string;
+ uts_nodename : string;
+ uts_kernel_release : string;
+ uts_kernel_version : string;
+ uts_machine : string;
+ uts_domainname : string;
+}
+ (** Kernel version, from utsname structure in the kernel. *)
+
+type kimage = {
dom : Libvirt.ro Libvirt.Domain.t option; (** Domain, if known. *)
domname : string; (** Domain name. *)
arch : Virt_mem_utils.architecture; (** Architecture, eg. i386. *)
- mem : ([`Wordsize], [`Endian], [`HasMapping]) Virt_mem_mmap.t;
- (** Memory map. *)
+
kernel_min : Virt_mem_mmap.addr; (** Minimum addr of kernel pointers. *)
kernel_max : Virt_mem_mmap.addr; (** Maximum addr of kernel pointers. *)
-}
- (** A basic kernel image. *)
-type utsname = {
- kernel_name : string;
- nodename : string;
- kernel_release : string;
- kernel_version : string;
- machine : string;
- domainname : string;
-}
- (** Kernel version, from utsname structure in the kernel. *)
+ mem : ([`Wordsize], [`Endian], [`HasMapping]) Virt_mem_mmap.t;
+ (** Memory map. *)
-type kdata = {
- ksyms : ksymmap option; (** Kernel symbol lookup function. *)
- utsname : utsname option; (** Kernel version. *)
- tasks : Virt_mem_mmap.addr option; (** Linked list of tasks (processes)
- starting at the address of
- init_task (swapper). *)
-}
- (** Optional data derived from the raw kernel image by the main
- program and passed to the tools' [~run] functions.
+ addrmap : Kernel.addrmap; (** Parsed kernel structures. *)
- What fields get filled in is controlled by the [~needs_*]
- options passed when tools register themselves, and also of
- course by what we are able to find out about the memory image.
+ ksyms : ksymmap; (** Kernel symbol table *)
- Note there is significant cost to filling in some of these
- fields.
-*)
+ have_ksyms : bool; (** True if we were able to load
+ the kernel symbols. *)
+ have_kallsyms : bool; (** True if we were able to load
+ the kallsyms from the kernel. *)
+
+ utsname : utsname option; (** Kernel version, if we were able
+ to find it. *)
+
+ have_tasks : bool; (** True if we were able to load
+ the kernel task_struct list. *)
+ have_net_devices : bool; (** True if we were able to load
+ the kernel net_device structures.*)
+}
+ (** A basic kernel image. *)
-(** {2 Load kernel memory} *)
+(** {2 Functions to load kernel memory} *)
type load_memory_error =
| AddressOutOfRange (** Address not in [kernel_min..kernel_max] *)
- | DomIsNull (** image.dom = None *)
+ | DomIsNull (** kimage.dom = None *)
exception LoadMemoryError of load_memory_error * string
-val load_memory : image -> Virt_mem_mmap.addr -> int -> image
+val load_memory : kimage -> Virt_mem_mmap.addr -> int -> kimage
(** [load_memory img start size] tries to load [size] bytes from
the start address into the memory map. If the memory was loaded
previously, then it is not requested again.
arch:Virt_mem_utils.architecture ->
wordsize:Virt_mem_utils.wordsize -> endian:Bitstring.endian ->
kernel_min:Virt_mem_mmap.addr -> kernel_max:Virt_mem_mmap.addr ->
- Virt_mem_mmap.addr -> int -> image
- (** [load_static_memory ~dom (*...*) start size] creates an [image0]
+ Virt_mem_mmap.addr -> int -> kimage
+ (** [load_static_memory ~dom (*...*) start size] creates a [kimage]
object, and initializes it with static kernel memory loaded
from the [start] address and [size] of [dom].