2N/A/* Mmap management. */
2N/A/*
2N/A * GRUB -- GRand Unified Bootloader
2N/A * Copyright (C) 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#include <grub/symbol.h>
2N/A
2N/A#define DS(x) ((x) - LOCAL (segstart))
2N/A
2N/ALOCAL (segstart):
2N/AVARIABLE(grub_machine_mmaphook_start)
2N/A .code16
2N/AVARIABLE(grub_machine_mmaphook_int12)
2N/A push %ds
2N/A push %cs
2N/A pop %ds
2N/A movw DS (LOCAL (kblow)), %ax
2N/A pop %ds
2N/A iret
2N/A
2N/AVARIABLE(grub_machine_mmaphook_int15)
2N/A pushf
2N/A cmpw $0xe801, %ax
2N/A jz LOCAL (e801)
2N/A cmpw $0xe820, %ax
2N/A jz LOCAL (e820)
2N/A cmpb $0x88, %ah
2N/A jz LOCAL (h88)
2N/A popf
2N/A /* ljmp */
2N/A .byte 0xea
2N/AVARIABLE (grub_machine_mmaphook_int15offset)
2N/A .word 0
2N/AVARIABLE (grub_machine_mmaphook_int15segment)
2N/A .word 0
2N/A
2N/ALOCAL (e801):
2N/A popf
2N/A push %ds
2N/A push %cs
2N/A pop %ds
2N/A movw DS (LOCAL (kbin16mb)), %ax
2N/A movw DS (LOCAL (m64kbin4gb)), %bx
2N/A movw %ax, %cx
2N/A movw %bx, %dx
2N/A pop %ds
2N/A clc
2N/A jmp LOCAL (iret_cf)
2N/A
2N/ALOCAL (h88):
2N/A popf
2N/A push %ds
2N/A push %cs
2N/A pop %ds
2N/A movw DS (LOCAL (kbin16mb)), %ax
2N/A pop %ds
2N/A clc
2N/A jmp LOCAL (iret_cf)
2N/A
2N/ALOCAL (e820):
2N/A popf
2N/A push %ds
2N/A push %cs
2N/A pop %ds
2N/A cmpw $20, %cx
2N/A jb LOCAL (errexit)
2N/A cmpw DS (LOCAL (mmap_num)), %bx
2N/A jae LOCAL (errexit)
2N/A cmp $0x534d4150, %edx
2N/A jne LOCAL (errexit)
2N/A push %si
2N/A push %di
2N/A movw $20, %cx
2N/A movw $(DS(LOCAL (mmaphook_mmap))), %si
2N/A mov %bx, %ax
2N/A imul $20, %ax
2N/A add %ax, %si
2N/A rep movsb
2N/A pop %di
2N/A pop %si
2N/A movl $20, %ecx
2N/A inc %bx
2N/A cmpw DS(LOCAL (mmap_num)), %bx
2N/A jb LOCAL (noclean)
2N/A xor %bx, %bx
2N/ALOCAL (noclean):
2N/A mov $0x534d4150, %eax
2N/A pop %ds
2N/A clc
2N/A jmp LOCAL (iret_cf)
2N/ALOCAL (errexit):
2N/A mov $0x534d4150, %eax
2N/A pop %ds
2N/A xor %bx, %bx
2N/A stc
2N/A
2N/ALOCAL (iret_cf):
2N/A push %bp
2N/A mov %sp, %bp
2N/A setc 6(%bp)
2N/A pop %bp
2N/A iret
2N/A
2N/AVARIABLE(grub_machine_mmaphook_mmap_num)
2N/ALOCAL (mmap_num):
2N/A .word 0
2N/AVARIABLE(grub_machine_mmaphook_kblow)
2N/ALOCAL (kblow):
2N/A .word 0
2N/AVARIABLE (grub_machine_mmaphook_kbin16mb)
2N/ALOCAL (kbin16mb):
2N/A .word 0
2N/AVARIABLE (grub_machine_mmaphook_64kbin4gb)
2N/ALOCAL (m64kbin4gb):
2N/A .word 0
2N/ALOCAL (mmaphook_mmap):
2N/A /* Memory map is placed just after the interrupt handlers. */
2N/AVARIABLE(grub_machine_mmaphook_end)
2N/A .byte 0