60 lines
1.9 KiB
C
60 lines
1.9 KiB
C
/*
|
|
* VasEBoot -- GRand Unified Bootloader
|
|
* Copyright (C) 2009 Free Software Foundation, Inc.
|
|
*
|
|
* VasEBoot 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 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* VasEBoot 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 VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef VasEBoot_RELOCATOR_HEADER
|
|
#define VasEBoot_RELOCATOR_HEADER 1
|
|
|
|
#include <VasEBoot/types.h>
|
|
#include <VasEBoot/err.h>
|
|
#include <VasEBoot/memory.h>
|
|
#include <VasEBoot/cpu/memory.h>
|
|
|
|
struct VasEBoot_relocator;
|
|
struct VasEBoot_relocator_chunk;
|
|
typedef const struct VasEBoot_relocator_chunk *VasEBoot_relocator_chunk_t;
|
|
|
|
struct VasEBoot_relocator *VasEBoot_relocator_new (void);
|
|
|
|
VasEBoot_err_t
|
|
VasEBoot_relocator_alloc_chunk_addr (struct VasEBoot_relocator *rel,
|
|
VasEBoot_relocator_chunk_t *out,
|
|
VasEBoot_phys_addr_t target, VasEBoot_size_t size);
|
|
|
|
void *
|
|
get_virtual_current_address (VasEBoot_relocator_chunk_t in);
|
|
VasEBoot_phys_addr_t
|
|
get_physical_target_address (VasEBoot_relocator_chunk_t in);
|
|
|
|
VasEBoot_err_t
|
|
VasEBoot_relocator_alloc_chunk_align (struct VasEBoot_relocator *rel,
|
|
VasEBoot_relocator_chunk_t *out,
|
|
VasEBoot_phys_addr_t min_addr,
|
|
VasEBoot_phys_addr_t max_addr,
|
|
VasEBoot_size_t size, VasEBoot_size_t align,
|
|
int preference,
|
|
int avoid_efi_boot_services);
|
|
|
|
#define VasEBoot_RELOCATOR_PREFERENCE_NONE 0
|
|
#define VasEBoot_RELOCATOR_PREFERENCE_LOW 1
|
|
#define VasEBoot_RELOCATOR_PREFERENCE_HIGH 2
|
|
|
|
void
|
|
VasEBoot_relocator_unload (struct VasEBoot_relocator *rel);
|
|
|
|
#endif
|