|
| 1 | +// Copyright © 2020, Oracle and/or its affiliates. |
| 2 | +// |
| 3 | +/* |
| 4 | + * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 5 | + * of this software and associated documentation files (the "Software"), to |
| 6 | + * deal in the Software without restriction, including without limitation the |
| 7 | + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
| 8 | + * sell copies of the Software, and to permit persons to whom the Software is |
| 9 | + * furnished to do so, subject to the following conditions: |
| 10 | + * |
| 11 | + * The above copyright notice and this permission notice shall be included in |
| 12 | + * all copies or substantial portions of the Software. |
| 13 | + * |
| 14 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 15 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 16 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 17 | + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 18 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 19 | + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 20 | + * DEALINGS IN THE SOFTWARE. |
| 21 | + * |
| 22 | + * Copyright (c) 2016, Citrix Systems, Inc. |
| 23 | + */ |
| 24 | + |
| 25 | +/* |
| 26 | + * A canonical version of this file is provided by Xen's |
| 27 | + * xen/include/public/arch-x86/hvm/start_info.h |
| 28 | + * |
| 29 | + * Start of day structure passed to PVH guests and to HVM guests in %ebx. |
| 30 | + * |
| 31 | + * NOTE: nothing will be loaded at physical address 0, so a 0 value in any |
| 32 | + * of the address fields should be treated as not present. |
| 33 | + * |
| 34 | + * 0 +----------------+ |
| 35 | + * | magic | Contains the magic value XEN_HVM_START_MAGIC_VALUE |
| 36 | + * | | ("xEn3" with the 0x80 bit of the "E" set). |
| 37 | + * 4 +----------------+ |
| 38 | + * | version | Version of this structure. Current version is 1. New |
| 39 | + * | | versions are guaranteed to be backwards-compatible. |
| 40 | + * 8 +----------------+ |
| 41 | + * | flags | SIF_xxx flags. |
| 42 | + * 12 +----------------+ |
| 43 | + * | nr_modules | Number of modules passed to the kernel. |
| 44 | + * 16 +----------------+ |
| 45 | + * | modlist_paddr | Physical address of an array of modules |
| 46 | + * | | (layout of the structure below). |
| 47 | + * 24 +----------------+ |
| 48 | + * | cmdline_paddr | Physical address of the command line, |
| 49 | + * | | a zero-terminated ASCII string. |
| 50 | + * 32 +----------------+ |
| 51 | + * | rsdp_paddr | Physical address of the RSDP ACPI data structure. |
| 52 | + * 40 +----------------+ |
| 53 | + * | memmap_paddr | Physical address of the (optional) memory map. Only |
| 54 | + * | | present in version 1 and newer of the structure. |
| 55 | + * 48 +----------------+ |
| 56 | + * | memmap_entries | Number of entries in the memory map table. Zero |
| 57 | + * | | if there is no memory map being provided. Only |
| 58 | + * | | present in version 1 and newer of the structure. |
| 59 | + * 52 +----------------+ |
| 60 | + * | reserved | Version 1 and newer only. |
| 61 | + * 56 +----------------+ |
| 62 | + * |
| 63 | + * The layout of each entry in the module structure is the following: |
| 64 | + * |
| 65 | + * 0 +----------------+ |
| 66 | + * | paddr | Physical address of the module. |
| 67 | + * 8 +----------------+ |
| 68 | + * | size | Size of the module in bytes. |
| 69 | + * 16 +----------------+ |
| 70 | + * | cmdline_paddr | Physical address of the command line, |
| 71 | + * | | a zero-terminated ASCII string. |
| 72 | + * 24 +----------------+ |
| 73 | + * | reserved | |
| 74 | + * 32 +----------------+ |
| 75 | + * |
| 76 | + * The layout of each entry in the memory map table is as follows: |
| 77 | + * |
| 78 | + * 0 +----------------+ |
| 79 | + * | addr | Base address |
| 80 | + * 8 +----------------+ |
| 81 | + * | size | Size of mapping in bytes |
| 82 | + * 16 +----------------+ |
| 83 | + * | type | Type of mapping as defined between the hypervisor |
| 84 | + * | | and guest. |
| 85 | + * 20 +----------------| |
| 86 | + * | reserved | |
| 87 | + * 24 +----------------+ |
| 88 | + * |
| 89 | + * The address and sizes are always a 64bit little endian unsigned integer. |
| 90 | + */ |
| 91 | + |
| 92 | +// Rust definitions needed to enable PVH boot protocol |
| 93 | +#[repr(C)] |
| 94 | +#[derive(Debug, Copy, Clone, Default)] |
| 95 | +pub struct hvm_start_info { |
| 96 | + pub magic: u32, |
| 97 | + pub version: u32, |
| 98 | + pub flags: u32, |
| 99 | + pub nr_modules: u32, |
| 100 | + pub modlist_paddr: u64, |
| 101 | + pub cmdline_paddr: u64, |
| 102 | + pub rsdp_paddr: u64, |
| 103 | + pub memmap_paddr: u64, |
| 104 | + pub memmap_entries: u32, |
| 105 | + pub reserved: u32, |
| 106 | +} |
| 107 | + |
| 108 | +#[repr(C)] |
| 109 | +#[derive(Debug, Copy, Clone, Default)] |
| 110 | +pub struct hvm_mmap_table_entry { |
| 111 | + pub addr: u64, |
| 112 | + pub size: u64, |
| 113 | + pub type_: u32, |
| 114 | + pub reserved: u32, |
| 115 | +} |
0 commit comments