merge mainline to ia64
This commit is contained in:
commit
0f35c665e6
595 changed files with 62746 additions and 9109 deletions
|
@ -21,6 +21,7 @@
|
|||
#include <grub/machine/time.h>
|
||||
#include <grub/machine/memory.h>
|
||||
#include <grub/machine/console.h>
|
||||
#include <grub/offsets.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/dl.h>
|
||||
|
@ -64,8 +65,10 @@ grub_machine_init (void)
|
|||
/* Initialize the console as early as possible. */
|
||||
grub_vga_text_init ();
|
||||
|
||||
auto int NESTED_FUNC_ATTR heap_init (grub_uint64_t, grub_uint64_t, grub_uint32_t);
|
||||
int NESTED_FUNC_ATTR heap_init (grub_uint64_t addr, grub_uint64_t size, grub_uint32_t type)
|
||||
auto int NESTED_FUNC_ATTR heap_init (grub_uint64_t, grub_uint64_t,
|
||||
grub_memory_type_t);
|
||||
int NESTED_FUNC_ATTR heap_init (grub_uint64_t addr, grub_uint64_t size,
|
||||
grub_memory_type_t type)
|
||||
{
|
||||
#if GRUB_CPU_SIZEOF_VOID_P == 4
|
||||
/* Restrict ourselves to 32-bit memory space. */
|
||||
|
@ -75,7 +78,7 @@ grub_machine_init (void)
|
|||
size = GRUB_ULONG_MAX - addr;
|
||||
#endif
|
||||
|
||||
if (type != GRUB_MACHINE_MEMORY_AVAILABLE)
|
||||
if (type != GRUB_MEMORY_AVAILABLE)
|
||||
return 0;
|
||||
|
||||
/* Avoid the lower memory. */
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
*/
|
||||
|
||||
#include <grub/machine/memory.h>
|
||||
#include <grub/machine/lbio.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/misc.h>
|
||||
|
@ -74,7 +75,7 @@ signature_found:
|
|||
}
|
||||
|
||||
grub_err_t
|
||||
grub_machine_mmap_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t))
|
||||
grub_machine_mmap_iterate (grub_memory_hook_t hook)
|
||||
{
|
||||
mem_region_t mem_region;
|
||||
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
*/
|
||||
|
||||
#include <grub/symbol.h>
|
||||
/* For stack parameters. */
|
||||
#include <grub/i386/pc/memory.h>
|
||||
#include <grub/machine/memory.h>
|
||||
#include <grub/cpu/linux.h>
|
||||
#include <grub/offsets.h>
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
*/
|
||||
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/machine/memory.h>
|
||||
#include <grub/offsets.h>
|
||||
#include <grub/cpu/linux.h>
|
||||
#include <multiboot.h>
|
||||
#include <multiboot2.h>
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
#include <grub/err.h>
|
||||
#include <grub/misc.h>
|
||||
|
||||
grub_size_t grub_lower_mem, grub_upper_mem;
|
||||
|
||||
/* A pointer to the MBI in its initial location. */
|
||||
struct multiboot_info *startup_multiboot_info;
|
||||
|
||||
|
@ -56,21 +54,10 @@ grub_machine_mmap_init ()
|
|||
}
|
||||
grub_memmove (mmap_entries, (void *) kern_multiboot_info.mmap_addr, kern_multiboot_info.mmap_length);
|
||||
kern_multiboot_info.mmap_addr = (grub_uint32_t) mmap_entries;
|
||||
|
||||
if ((kern_multiboot_info.flags & MULTIBOOT_INFO_MEMORY) == 0)
|
||||
{
|
||||
grub_lower_mem = GRUB_MEMORY_MACHINE_LOWER_USABLE;
|
||||
grub_upper_mem = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
grub_lower_mem = kern_multiboot_info.mem_lower * 1024;
|
||||
grub_upper_mem = kern_multiboot_info.mem_upper * 1024;
|
||||
}
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
grub_machine_mmap_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t))
|
||||
grub_machine_mmap_iterate (grub_memory_hook_t hook)
|
||||
{
|
||||
struct multiboot_mmap_entry *entry = (void *) kern_multiboot_info.mmap_addr;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include <grub/kernel.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/machine/boot.h>
|
||||
#include <grub/machine/init.h>
|
||||
#include <grub/i386/floppy.h>
|
||||
#include <grub/machine/memory.h>
|
||||
#include <grub/machine/console.h>
|
||||
#include <grub/machine/kernel.h>
|
||||
|
@ -171,11 +171,6 @@ grub_machine_init (void)
|
|||
if (grub_lower_mem < GRUB_MEMORY_MACHINE_RESERVED_END)
|
||||
grub_fatal ("too small memory");
|
||||
|
||||
#if 0
|
||||
/* Turn on Gate A20 to access >1MB. */
|
||||
grub_gate_a20 (1);
|
||||
#endif
|
||||
|
||||
/* FIXME: This prevents loader/i386/linux.c from using low memory. When our
|
||||
heap implements support for requesting a chunk in low memory, this should
|
||||
no longer be a problem. */
|
||||
|
@ -186,8 +181,10 @@ grub_machine_init (void)
|
|||
grub_lower_mem - GRUB_MEMORY_MACHINE_RESERVED_END);
|
||||
#endif
|
||||
|
||||
auto int NESTED_FUNC_ATTR hook (grub_uint64_t, grub_uint64_t, grub_uint32_t);
|
||||
int NESTED_FUNC_ATTR hook (grub_uint64_t addr, grub_uint64_t size, grub_uint32_t type)
|
||||
auto int NESTED_FUNC_ATTR hook (grub_uint64_t, grub_uint64_t,
|
||||
grub_memory_type_t);
|
||||
int NESTED_FUNC_ATTR hook (grub_uint64_t addr, grub_uint64_t size,
|
||||
grub_memory_type_t type)
|
||||
{
|
||||
/* Avoid the lower memory. */
|
||||
if (addr < 0x100000)
|
||||
|
@ -200,7 +197,7 @@ grub_machine_init (void)
|
|||
}
|
||||
|
||||
/* Ignore >4GB. */
|
||||
if (addr <= 0xFFFFFFFF && type == GRUB_MACHINE_MEMORY_AVAILABLE)
|
||||
if (addr <= 0xFFFFFFFF && type == GRUB_MEMORY_AVAILABLE)
|
||||
{
|
||||
grub_size_t len;
|
||||
|
||||
|
|
|
@ -77,69 +77,6 @@
|
|||
#define RepLenCoder (LenCoder + kNumLenProbs)
|
||||
#define Literal (RepLenCoder + kNumLenProbs)
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
DbgOut:
|
||||
pushf
|
||||
pushl %ebp
|
||||
pushl %edi
|
||||
pushl %esi
|
||||
pushl %edx
|
||||
pushl %ecx
|
||||
pushl %ebx
|
||||
pushl %eax
|
||||
|
||||
call _DebugPrint
|
||||
|
||||
popl %eax
|
||||
popl %ebx
|
||||
popl %ecx
|
||||
popl %edx
|
||||
popl %esi
|
||||
popl %edi
|
||||
popl %ebp
|
||||
popf
|
||||
|
||||
ret
|
||||
|
||||
|
||||
/*
|
||||
* int LzmaDecodeProperties(CLzmaProperties *propsRes,
|
||||
* const unsigned char *propsData,
|
||||
* int size);
|
||||
*/
|
||||
|
||||
_LzmaDecodePropertiesA:
|
||||
movb (%edx), %dl
|
||||
|
||||
xorl %ecx, %ecx
|
||||
1:
|
||||
cmpb $45, %dl
|
||||
jb 2f
|
||||
incl %ecx
|
||||
subb $45, %dl
|
||||
jmp 1b
|
||||
2:
|
||||
movl %ecx, 8(%eax) /* pb */
|
||||
xorl %ecx, %ecx
|
||||
1:
|
||||
cmpb $9, %dl
|
||||
jb 2f
|
||||
incl %ecx
|
||||
subb $9, %dl
|
||||
2:
|
||||
movl %ecx, 4(%eax) /* lp */
|
||||
movb %dl, %cl
|
||||
movl %ecx, (%eax) /* lc */
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef ASM_FILE
|
||||
xorl %eax, %eax
|
||||
#endif
|
||||
ret
|
||||
|
||||
#define out_size 8(%ebp)
|
||||
|
||||
#define now_pos -4(%ebp)
|
||||
|
|
|
@ -16,13 +16,26 @@
|
|||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/machine/init.h>
|
||||
#include <grub/machine/int.h>
|
||||
#include <grub/machine/memory.h>
|
||||
#include <grub/machine/int.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/misc.h>
|
||||
|
||||
struct grub_machine_mmap_entry
|
||||
{
|
||||
grub_uint32_t size;
|
||||
grub_uint64_t addr;
|
||||
grub_uint64_t len;
|
||||
#define GRUB_MACHINE_MEMORY_AVAILABLE 1
|
||||
#define GRUB_MACHINE_MEMORY_RESERVED 2
|
||||
#define GRUB_MACHINE_MEMORY_ACPI 3
|
||||
#define GRUB_MACHINE_MEMORY_NVS 4
|
||||
#define GRUB_MACHINE_MEMORY_BADRAM 5
|
||||
grub_uint32_t type;
|
||||
} __attribute__((packed));
|
||||
|
||||
|
||||
/*
|
||||
* grub_get_ext_memsize() : return the extended memory size in KB.
|
||||
* BIOS call "INT 15H, AH=88H" to get extended memory size
|
||||
|
@ -110,7 +123,7 @@ grub_get_mmap_entry (struct grub_machine_mmap_entry *entry,
|
|||
}
|
||||
|
||||
grub_err_t
|
||||
grub_machine_mmap_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t))
|
||||
grub_machine_mmap_iterate (grub_memory_hook_t hook)
|
||||
{
|
||||
grub_uint32_t cont;
|
||||
struct grub_machine_mmap_entry *entry
|
||||
|
@ -125,9 +138,9 @@ grub_machine_mmap_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uin
|
|||
do
|
||||
{
|
||||
if (hook (entry->addr, entry->len,
|
||||
/* Multiboot mmaps have been defined to match with the E820 definition.
|
||||
/* GRUB mmaps have been defined to match with the E820 definition.
|
||||
Therefore, we can just pass type through. */
|
||||
entry->type))
|
||||
((entry->type <= GRUB_MACHINE_MEMORY_BADRAM) && (entry->type >= GRUB_MACHINE_MEMORY_AVAILABLE)) ? entry->type : GRUB_MEMORY_RESERVED))
|
||||
break;
|
||||
|
||||
if (! cont)
|
||||
|
@ -144,11 +157,12 @@ grub_machine_mmap_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uin
|
|||
|
||||
if (eisa_mmap)
|
||||
{
|
||||
if (hook (0x100000, (eisa_mmap & 0xFFFF) << 10, GRUB_MACHINE_MEMORY_AVAILABLE) == 0)
|
||||
hook (0x1000000, eisa_mmap & ~0xFFFF, GRUB_MACHINE_MEMORY_AVAILABLE);
|
||||
if (hook (0x100000, (eisa_mmap & 0xFFFF) << 10,
|
||||
GRUB_MEMORY_AVAILABLE) == 0)
|
||||
hook (0x1000000, eisa_mmap & ~0xFFFF, GRUB_MEMORY_AVAILABLE);
|
||||
}
|
||||
else
|
||||
hook (0x100000, grub_get_ext_memsize () << 10, GRUB_MACHINE_MEMORY_AVAILABLE);
|
||||
hook (0x100000, grub_get_ext_memsize () << 10, GRUB_MEMORY_AVAILABLE);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -100,6 +100,8 @@ VARIABLE(grub_install_dos_part)
|
|||
.long 0xFFFFFFFF
|
||||
VARIABLE(grub_install_bsd_part)
|
||||
.long 0xFFFFFFFF
|
||||
reed_solomon_redundancy:
|
||||
.long 0
|
||||
|
||||
#ifdef APPLE_CC
|
||||
bss_start:
|
||||
|
@ -107,7 +109,56 @@ bss_start:
|
|||
bss_end:
|
||||
.long 0
|
||||
#endif
|
||||
/*
|
||||
* This is the area for all of the special variables.
|
||||
*/
|
||||
|
||||
VARIABLE(grub_boot_drive)
|
||||
.byte 0
|
||||
|
||||
/* the real mode code continues... */
|
||||
LOCAL (codestart):
|
||||
cli /* we're not safe here! */
|
||||
|
||||
/* set up %ds, %ss, and %es */
|
||||
xorw %ax, %ax
|
||||
movw %ax, %ds
|
||||
movw %ax, %ss
|
||||
movw %ax, %es
|
||||
|
||||
/* set up the real mode/BIOS stack */
|
||||
movl $GRUB_MEMORY_MACHINE_REAL_STACK, %ebp
|
||||
movl %ebp, %esp
|
||||
|
||||
sti /* we're safe again */
|
||||
|
||||
/* save the boot drive */
|
||||
ADDR32 movb %dl, EXT_C(grub_boot_drive)
|
||||
|
||||
/* reset disk system (%ah = 0) */
|
||||
int $0x13
|
||||
|
||||
/* transition to protected mode */
|
||||
DATA32 call real_to_prot
|
||||
|
||||
/* The ".code32" directive takes GAS out of 16-bit mode. */
|
||||
.code32
|
||||
|
||||
incl %eax
|
||||
call grub_gate_a20
|
||||
|
||||
movl EXT_C(grub_compressed_size), %edx
|
||||
addl $(GRUB_KERNEL_MACHINE_RAW_SIZE - GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART), %edx
|
||||
movl reed_solomon_redundancy, %ecx
|
||||
leal _start + GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART, %eax
|
||||
call EXT_C (grub_reed_solomon_recover)
|
||||
jmp post_reed_solomon
|
||||
|
||||
#include <rs_decoder.S>
|
||||
|
||||
.text
|
||||
|
||||
. = _start + GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART
|
||||
/*
|
||||
* Support for booting GRUB from a Multiboot boot loader (e.g. GRUB itself).
|
||||
* This uses the a.out kludge to load raw binary to the area starting at 1MB,
|
||||
|
@ -171,38 +222,9 @@ multiboot_trampoline:
|
|||
movb $0xFF, %dh
|
||||
/* enter the usual booting */
|
||||
call prot_to_real
|
||||
.code16
|
||||
jmp LOCAL (codestart)
|
||||
|
||||
/* the real mode code continues... */
|
||||
LOCAL (codestart):
|
||||
cli /* we're not safe here! */
|
||||
|
||||
/* set up %ds, %ss, and %es */
|
||||
xorw %ax, %ax
|
||||
movw %ax, %ds
|
||||
movw %ax, %ss
|
||||
movw %ax, %es
|
||||
|
||||
/* set up the real mode/BIOS stack */
|
||||
movl $GRUB_MEMORY_MACHINE_REAL_STACK, %ebp
|
||||
movl %ebp, %esp
|
||||
|
||||
sti /* we're safe again */
|
||||
|
||||
/* save the boot drive */
|
||||
ADDR32 movb %dl, EXT_C(grub_boot_drive)
|
||||
|
||||
/* reset disk system (%ah = 0) */
|
||||
int $0x13
|
||||
|
||||
/* transition to protected mode */
|
||||
DATA32 call real_to_prot
|
||||
|
||||
/* The ".code32" directive takes GAS out of 16-bit mode. */
|
||||
.code32
|
||||
|
||||
incl %eax
|
||||
call EXT_C(grub_gate_a20)
|
||||
post_reed_solomon:
|
||||
|
||||
#ifdef ENABLE_LZMA
|
||||
movl $GRUB_MEMORY_MACHINE_DECOMPRESSION_ADDR, %edi
|
||||
|
@ -271,15 +293,6 @@ LOCAL (codestart):
|
|||
*/
|
||||
call EXT_C(grub_main)
|
||||
|
||||
/*
|
||||
* This is the area for all of the special variables.
|
||||
*/
|
||||
|
||||
VARIABLE(grub_boot_drive)
|
||||
.byte 0
|
||||
|
||||
.p2align 2 /* force 4-byte alignment */
|
||||
|
||||
#include "../realmode.S"
|
||||
|
||||
/*
|
||||
|
@ -292,7 +305,7 @@ VARIABLE(grub_boot_drive)
|
|||
* It also eats any keystrokes in the keyboard buffer. :-(
|
||||
*/
|
||||
|
||||
FUNCTION(grub_gate_a20)
|
||||
grub_gate_a20:
|
||||
movl %eax, %edx
|
||||
|
||||
gate_a20_test_current_state:
|
||||
|
@ -478,7 +491,7 @@ FUNCTION(grub_chainloader_real_boot)
|
|||
|
||||
/* Turn off Gate A20 */
|
||||
xorl %eax, %eax
|
||||
call EXT_C(grub_gate_a20)
|
||||
call grub_gate_a20
|
||||
|
||||
/* set up to pass boot drive */
|
||||
popl %edx
|
||||
|
@ -576,64 +589,32 @@ FUNCTION(grub_console_putchar)
|
|||
ret
|
||||
|
||||
|
||||
LOCAL(bypass_table):
|
||||
.word 0x011b, 0x0f00 | '\t', 0x0e00 | '\b', 0x1c00 | '\r'
|
||||
.word 0x1c00 | '\n'
|
||||
LOCAL(bypass_table_end):
|
||||
|
||||
/*
|
||||
* int grub_console_getkey (void)
|
||||
* if there is a character pending, return it; otherwise return -1
|
||||
* BIOS call "INT 16H Function 01H" to check whether a character is pending
|
||||
* Call with %ah = 0x1
|
||||
* Return:
|
||||
* If key waiting to be input:
|
||||
* %ah = keyboard scan code
|
||||
* %al = ASCII character
|
||||
* Zero flag = clear
|
||||
* else
|
||||
* Zero flag = set
|
||||
* BIOS call "INT 16H Function 00H" to read character from keyboard
|
||||
* Call with %ah = 0x0
|
||||
* Return: %ah = keyboard scan code
|
||||
* %al = ASCII character
|
||||
*/
|
||||
|
||||
/* this table is used in translate_keycode below */
|
||||
LOCAL (translation_table):
|
||||
.word GRUB_CONSOLE_KEY_LEFT, GRUB_TERM_LEFT
|
||||
.word GRUB_CONSOLE_KEY_RIGHT, GRUB_TERM_RIGHT
|
||||
.word GRUB_CONSOLE_KEY_UP, GRUB_TERM_UP
|
||||
.word GRUB_CONSOLE_KEY_DOWN, GRUB_TERM_DOWN
|
||||
.word GRUB_CONSOLE_KEY_HOME, GRUB_TERM_HOME
|
||||
.word GRUB_CONSOLE_KEY_END, GRUB_TERM_END
|
||||
.word GRUB_CONSOLE_KEY_DC, GRUB_TERM_DC
|
||||
.word GRUB_CONSOLE_KEY_BACKSPACE, GRUB_TERM_BACKSPACE
|
||||
.word GRUB_CONSOLE_KEY_PPAGE, GRUB_TERM_PPAGE
|
||||
.word GRUB_CONSOLE_KEY_NPAGE, GRUB_TERM_NPAGE
|
||||
.word 0
|
||||
|
||||
/*
|
||||
* translate_keycode translates the key code %dx to an ascii code.
|
||||
*/
|
||||
.code16
|
||||
|
||||
translate_keycode:
|
||||
pushw %bx
|
||||
pushw %si
|
||||
|
||||
#ifdef __APPLE__
|
||||
movw $(ABS(LOCAL (translation_table)) - 0x10000), %si
|
||||
#else
|
||||
movw $ABS(LOCAL (translation_table)), %si
|
||||
#endif
|
||||
|
||||
1: lodsw
|
||||
/* check if this is the end */
|
||||
testw %ax, %ax
|
||||
jz 2f
|
||||
/* load the ascii code into %ax */
|
||||
movw %ax, %bx
|
||||
lodsw
|
||||
/* check if this matches the key code */
|
||||
cmpw %bx, %dx
|
||||
jne 1b
|
||||
/* translate %dx, if successful */
|
||||
movw %ax, %dx
|
||||
|
||||
2: popw %si
|
||||
popw %bx
|
||||
ret
|
||||
|
||||
.code32
|
||||
|
||||
FUNCTION(grub_console_getkey)
|
||||
pushl %ebp
|
||||
pushl %edi
|
||||
|
||||
call prot_to_real
|
||||
.code16
|
||||
|
@ -645,70 +626,56 @@ FUNCTION(grub_console_getkey)
|
|||
* INT 16/AH = 1 before calling INT 16/AH = 0.
|
||||
*/
|
||||
|
||||
1:
|
||||
movb $1, %ah
|
||||
int $0x16
|
||||
jnz 2f
|
||||
hlt
|
||||
jmp 1b
|
||||
|
||||
2:
|
||||
jz notpending
|
||||
|
||||
movb $0, %ah
|
||||
int $0x16
|
||||
|
||||
xorl %edx, %edx
|
||||
movw %ax, %dx /* real_to_prot uses %eax */
|
||||
call translate_keycode
|
||||
|
||||
DATA32 call real_to_prot
|
||||
.code32
|
||||
|
||||
movw %dx, %ax
|
||||
|
||||
popl %ebp
|
||||
ret
|
||||
|
||||
|
||||
/*
|
||||
* int grub_console_checkkey (void)
|
||||
* if there is a character pending, return it; otherwise return -1
|
||||
* BIOS call "INT 16H Function 01H" to check whether a character is pending
|
||||
* Call with %ah = 0x1
|
||||
* Return:
|
||||
* If key waiting to be input:
|
||||
* %ah = keyboard scan code
|
||||
* %al = ASCII character
|
||||
* Zero flag = clear
|
||||
* else
|
||||
* Zero flag = set
|
||||
*/
|
||||
FUNCTION(grub_console_checkkey)
|
||||
pushl %ebp
|
||||
xorl %edx, %edx
|
||||
|
||||
call prot_to_real /* enter real mode */
|
||||
.code16
|
||||
|
||||
movb $0x1, %ah
|
||||
int $0x16
|
||||
|
||||
jz notpending
|
||||
|
||||
movw %ax, %dx
|
||||
DATA32 jmp pending
|
||||
|
||||
notpending:
|
||||
decl %edx
|
||||
|
||||
pending:
|
||||
DATA32 call real_to_prot
|
||||
.code32
|
||||
movl $0xff, %eax
|
||||
testl %eax, %edx
|
||||
jz 1f
|
||||
|
||||
andl %edx, %eax
|
||||
cmpl $0x20, %eax
|
||||
jae 2f
|
||||
movl %edx, %eax
|
||||
leal LOCAL(bypass_table), %edi
|
||||
movl $((LOCAL(bypass_table_end) - LOCAL(bypass_table)) >> 1), %ecx
|
||||
repne scasw
|
||||
jz 3f
|
||||
|
||||
andl $0xff, %eax
|
||||
addl $(('a' - 1) | GRUB_TERM_CTRL), %eax
|
||||
jmp 2f
|
||||
3:
|
||||
andl $0xff, %eax
|
||||
jmp 2f
|
||||
|
||||
1: movl %edx, %eax
|
||||
shrl $8, %eax
|
||||
orl $GRUB_TERM_EXTENDED, %eax
|
||||
2:
|
||||
popl %edi
|
||||
popl %ebp
|
||||
ret
|
||||
|
||||
notpending:
|
||||
.code16
|
||||
DATA32 call real_to_prot
|
||||
.code32
|
||||
#if GRUB_TERM_NO_KEY != 0
|
||||
#error Fix this asm code
|
||||
#endif
|
||||
jmp 2b
|
||||
|
||||
|
||||
/*
|
||||
* grub_uint16_t grub_console_getxy (void)
|
||||
|
@ -852,6 +819,10 @@ FUNCTION(grub_console_setcursor)
|
|||
DATA32 call real_to_prot
|
||||
.code32
|
||||
|
||||
cmp %cl, %ch
|
||||
jb 3f
|
||||
movw $0x0d0e, %cx
|
||||
3:
|
||||
movw %cx, console_cursor_shape
|
||||
1:
|
||||
/* set %cx to the designated cursor shape */
|
||||
|
|
|
@ -16,12 +16,14 @@
|
|||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/i386/memory.h>
|
||||
#include <grub/machine/memory.h>
|
||||
#include <grub/machine/boot.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/cmos.h>
|
||||
#include <grub/offsets.h>
|
||||
|
||||
#define QEMU_CMOS_MEMSIZE_HIGH 0x35
|
||||
#define QEMU_CMOS_MEMSIZE_LOW 0x34
|
||||
|
@ -60,38 +62,38 @@ grub_machine_mmap_init ()
|
|||
}
|
||||
|
||||
grub_err_t
|
||||
grub_machine_mmap_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t))
|
||||
grub_machine_mmap_iterate (grub_memory_hook_t hook)
|
||||
{
|
||||
if (hook (0x0,
|
||||
(grub_addr_t) _start,
|
||||
GRUB_MACHINE_MEMORY_AVAILABLE))
|
||||
GRUB_MEMORY_AVAILABLE))
|
||||
return 1;
|
||||
|
||||
if (hook ((grub_addr_t) _end,
|
||||
0xa0000 - (grub_addr_t) _end,
|
||||
GRUB_MACHINE_MEMORY_AVAILABLE))
|
||||
GRUB_MEMORY_AVAILABLE))
|
||||
return 1;
|
||||
|
||||
if (hook (GRUB_MEMORY_MACHINE_UPPER,
|
||||
0x100000 - GRUB_MEMORY_MACHINE_UPPER,
|
||||
GRUB_MACHINE_MEMORY_RESERVED))
|
||||
GRUB_MEMORY_RESERVED))
|
||||
return 1;
|
||||
|
||||
/* Everything else is free. */
|
||||
if (hook (0x100000,
|
||||
min (mem_size, (grub_uint32_t) -GRUB_BOOT_MACHINE_SIZE) - 0x100000,
|
||||
GRUB_MACHINE_MEMORY_AVAILABLE))
|
||||
GRUB_MEMORY_AVAILABLE))
|
||||
return 1;
|
||||
|
||||
/* Protect boot.img, which contains the gdt. It is mapped at the top of memory
|
||||
(it is also mapped below 0x100000, but we already reserved that area). */
|
||||
if (hook ((grub_uint32_t) -GRUB_BOOT_MACHINE_SIZE,
|
||||
GRUB_BOOT_MACHINE_SIZE,
|
||||
GRUB_MACHINE_MEMORY_RESERVED))
|
||||
GRUB_MEMORY_RESERVED))
|
||||
return 1;
|
||||
|
||||
if (above_4g != 0 && hook (0x100000000ULL, above_4g,
|
||||
GRUB_MACHINE_MEMORY_AVAILABLE))
|
||||
GRUB_MEMORY_AVAILABLE))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
#include <config.h>
|
||||
#include <grub/symbol.h>
|
||||
|
||||
#include <grub/i386/pc/memory.h>
|
||||
#include <grub/machine/memory.h>
|
||||
#include <grub/machine/kernel.h>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue