30
30
#include <grub/i386/memory.h>
32
#include <grub/offsets.h>
32
34
/* The scratch buffer used in real mode code. */
33
35
#define GRUB_MEMORY_MACHINE_SCRATCH_ADDR 0x68000
34
36
#define GRUB_MEMORY_MACHINE_SCRATCH_SEG (GRUB_MEMORY_MACHINE_SCRATCH_ADDR >> 4)
40
42
/* The size of the protect mode stack. */
41
43
#define GRUB_MEMORY_MACHINE_PROT_STACK_SIZE 0x8000
43
/* The upper memory area (starting at 640 kiB). */
44
#define GRUB_MEMORY_MACHINE_UPPER 0xa0000
46
45
/* The protected mode stack. */
47
46
#define GRUB_MEMORY_MACHINE_PROT_STACK \
48
47
(GRUB_MEMORY_MACHINE_SCRATCH_ADDR + GRUB_MEMORY_MACHINE_SCRATCH_SIZE \
89
88
grub_uint8_t unused2[0xf0 - 0x18];
92
struct grub_machine_mmap_entry
97
#define GRUB_MACHINE_MEMORY_AVAILABLE 1
98
#define GRUB_MACHINE_MEMORY_RESERVED 2
99
#define GRUB_MACHINE_MEMORY_ACPI 3
100
#define GRUB_MACHINE_MEMORY_NVS 4
101
#define GRUB_MACHINE_MEMORY_MAX_TYPE 4
102
/* This one is special: it's used internally but is never reported
104
#define GRUB_MACHINE_MEMORY_HOLE 5
107
} __attribute__((packed));
109
grub_err_t EXPORT_FUNC(grub_machine_mmap_iterate)
110
(int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t));
112
grub_uint64_t grub_mmap_get_post64 (void);
113
grub_uint64_t grub_mmap_get_upper (void);
114
grub_uint64_t grub_mmap_get_lower (void);
116
#define GRUB_MMAP_MALLOC_LOW 1
118
#ifdef GRUB_MACHINE_PCBIOS
119
91
grub_err_t grub_machine_mmap_register (grub_uint64_t start, grub_uint64_t size,
120
92
int type, int handle);
121
93
grub_err_t grub_machine_mmap_unregister (int handle);
123
static inline grub_err_t
124
grub_machine_mmap_register (grub_uint64_t start __attribute__ ((unused)),
125
grub_uint64_t size __attribute__ ((unused)),
126
int type __attribute__ ((unused)),
127
int handle __attribute__ ((unused)))
129
return GRUB_ERR_NONE;
131
static inline grub_err_t
132
grub_machine_mmap_unregister (int handle __attribute__ ((unused)))
134
return GRUB_ERR_NONE;