2N/A/* memory.h - describe the memory map */
2N/A/*
2N/A * GRUB -- GRand Unified Bootloader
2N/A * Copyright (C) 2002,2007,2008,2009 Free Software Foundation, Inc.
2N/A *
2N/A * GRUB is free software: you can redistribute it and/or modify
2N/A * it under the terms of the GNU General Public License as published by
2N/A * the Free Software Foundation, either version 3 of the License, or
2N/A * (at your option) any later version.
2N/A *
2N/A * GRUB is distributed in the hope that it will be useful,
2N/A * but WITHOUT ANY WARRANTY; without even the implied warranty of
2N/A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2N/A * GNU General Public License for more details.
2N/A *
2N/A * You should have received a copy of the GNU General Public License
2N/A * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
2N/A */
2N/A
2N/A#ifndef GRUB_MEMORY_MACHINE_HEADER
2N/A#define GRUB_MEMORY_MACHINE_HEADER 1
2N/A
2N/A#include <grub/symbol.h>
2N/A#ifndef ASM_FILE
2N/A#include <grub/types.h>
2N/A#include <grub/err.h>
2N/A#include <grub/memory.h>
2N/A#endif
2N/A
2N/A#include <grub/i386/memory.h>
2N/A
2N/A#include <grub/offsets.h>
2N/A
2N/A/* The scratch buffer used in real mode code. */
2N/A#define GRUB_MEMORY_MACHINE_SCRATCH_ADDR 0x68000
2N/A#define GRUB_MEMORY_MACHINE_SCRATCH_SEG (GRUB_MEMORY_MACHINE_SCRATCH_ADDR >> 4)
2N/A#define GRUB_MEMORY_MACHINE_SCRATCH_SIZE 0x10000
2N/A
2N/A/* The real mode stack. */
2N/A#define GRUB_MEMORY_MACHINE_REAL_STACK (0x2000 - 0x10)
2N/A
2N/A/* The size of the protect mode stack. */
2N/A#define GRUB_MEMORY_MACHINE_PROT_STACK_SIZE 0x8000
2N/A
2N/A/* The protected mode stack. */
2N/A#define GRUB_MEMORY_MACHINE_PROT_STACK \
2N/A (GRUB_MEMORY_MACHINE_SCRATCH_ADDR + GRUB_MEMORY_MACHINE_SCRATCH_SIZE \
2N/A + GRUB_MEMORY_MACHINE_PROT_STACK_SIZE - 0x10)
2N/A
2N/A/* The memory area where GRUB uses its own purpose. This part is not added
2N/A into free memory for dynamic allocations. */
2N/A#define GRUB_MEMORY_MACHINE_RESERVED_START \
2N/A GRUB_MEMORY_MACHINE_SCRATCH_ADDR
2N/A#define GRUB_MEMORY_MACHINE_RESERVED_END \
2N/A (GRUB_MEMORY_MACHINE_PROT_STACK + 0x10)
2N/A
2N/A/* The area where GRUB is decompressed at early startup. */
2N/A#define GRUB_MEMORY_MACHINE_DECOMPRESSION_ADDR 0x100000
2N/A
2N/A/* The address of a partition table passed to another boot loader. */
2N/A#define GRUB_MEMORY_MACHINE_PART_TABLE_ADDR 0x7be
2N/A
2N/A/* The address where another boot loader is loaded. */
2N/A#define GRUB_MEMORY_MACHINE_BOOT_LOADER_ADDR 0x7c00
2N/A
2N/A/* The code segment of the protected mode. */
2N/A#define GRUB_MEMORY_MACHINE_PROT_MODE_CSEG 0x8
2N/A
2N/A/* The data segment of the protected mode. */
2N/A#define GRUB_MEMORY_MACHINE_PROT_MODE_DSEG 0x10
2N/A
2N/A/* The code segment of the pseudo real mode. */
2N/A#define GRUB_MEMORY_MACHINE_PSEUDO_REAL_CSEG 0x18
2N/A
2N/A/* The data segment of the pseudo real mode. */
2N/A#define GRUB_MEMORY_MACHINE_PSEUDO_REAL_DSEG 0x20
2N/A
2N/A#define GRUB_MEMORY_MACHINE_BIOS_DATA_AREA_ADDR 0x400
2N/A
2N/A#ifndef ASM_FILE
2N/A
2N/A/* See http://heim.ifi.uio.no/~stanisls/helppc/bios_data_area.html for a
2N/A description of the BIOS Data Area layout. */
2N/Astruct grub_machine_bios_data_area
2N/A{
2N/A grub_uint8_t unused1[0x17];
2N/A grub_uint8_t keyboard_flag_lower; /* 0x17 */
2N/A grub_uint8_t unused2[0xf0 - 0x18];
2N/A};
2N/A
2N/Agrub_err_t grub_machine_mmap_register (grub_uint64_t start, grub_uint64_t size,
2N/A int type, int handle);
2N/Agrub_err_t grub_machine_mmap_unregister (int handle);
2N/A
2N/A#endif
2N/A
2N/A#endif /* ! GRUB_MEMORY_MACHINE_HEADER */