vaseboot/include/VasEBoot/i386/relocator.h

101 lines
2.7 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_CPU_HEADER
#define VasEBoot_RELOCATOR_CPU_HEADER 1
#include <VasEBoot/types.h>
#include <VasEBoot/err.h>
#include <VasEBoot/relocator.h>
struct VasEBoot_relocator32_state
{
VasEBoot_uint32_t esp;
VasEBoot_uint32_t ebp;
VasEBoot_uint32_t eax;
VasEBoot_uint32_t ebx;
VasEBoot_uint32_t ecx;
VasEBoot_uint32_t edx;
VasEBoot_uint32_t eip;
VasEBoot_uint32_t esi;
VasEBoot_uint32_t edi;
};
struct VasEBoot_relocator16_state
{
VasEBoot_uint16_t cs;
VasEBoot_uint16_t ds;
VasEBoot_uint16_t es;
VasEBoot_uint16_t fs;
VasEBoot_uint16_t gs;
VasEBoot_uint16_t ss;
VasEBoot_uint16_t sp;
VasEBoot_uint16_t ip;
VasEBoot_uint32_t ebx;
VasEBoot_uint32_t edx;
VasEBoot_uint32_t esi;
VasEBoot_uint32_t ebp;
int a20;
};
struct VasEBoot_relocator64_state
{
VasEBoot_uint64_t rsp;
VasEBoot_uint64_t rax;
VasEBoot_uint64_t rbx;
VasEBoot_uint64_t rcx;
VasEBoot_uint64_t rdx;
VasEBoot_uint64_t rip;
VasEBoot_uint64_t rsi;
VasEBoot_addr_t cr3;
};
#ifdef VasEBoot_MACHINE_EFI
#ifdef __x86_64__
struct VasEBoot_relocator64_efi_state
{
VasEBoot_uint64_t rax;
VasEBoot_uint64_t rbx;
VasEBoot_uint64_t rcx;
VasEBoot_uint64_t rdx;
VasEBoot_uint64_t rip;
VasEBoot_uint64_t rsi;
};
#endif
#endif
VasEBoot_err_t VasEBoot_relocator16_boot (struct VasEBoot_relocator *rel,
struct VasEBoot_relocator16_state state);
VasEBoot_err_t VasEBoot_relocator32_boot (struct VasEBoot_relocator *rel,
struct VasEBoot_relocator32_state state,
int avoid_efi_bootservices);
VasEBoot_err_t VasEBoot_relocator64_boot (struct VasEBoot_relocator *rel,
struct VasEBoot_relocator64_state state,
VasEBoot_addr_t min_addr, VasEBoot_addr_t max_addr);
#ifdef VasEBoot_MACHINE_EFI
#ifdef __x86_64__
VasEBoot_err_t VasEBoot_relocator64_efi_boot (struct VasEBoot_relocator *rel,
struct VasEBoot_relocator64_efi_state state);
#endif
#endif
#endif /* ! VasEBoot_RELOCATOR_CPU_HEADER */