* grub-core/boot/i386/pc/startup_raw.S [__APPLE__]: Add Apple assembly
version. * grub-core/commands/i386/pc/drivemap_int13h.S [__APPLE__]: Likewise. * grub-core/kern/i386/pc/startup.S [__APPLE__]: Likewise. * grub-core/lib/i386/relocator16.S [__APPLE__]: Likewise. * grub-core/lib/i386/relocator_common.S [__APPLE__]: Likewise. * grub-core/mmap/i386/pc/mmap_helper.S [__APPLE__]: Likewise.
This commit is contained in:
parent
e6ad0555e4
commit
f7143efe1b
7 changed files with 163 additions and 0 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2012-05-28 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* grub-core/boot/i386/pc/startup_raw.S [__APPLE__]: Add Apple assembly
|
||||||
|
version.
|
||||||
|
* grub-core/commands/i386/pc/drivemap_int13h.S [__APPLE__]: Likewise.
|
||||||
|
* grub-core/kern/i386/pc/startup.S [__APPLE__]: Likewise.
|
||||||
|
* grub-core/lib/i386/relocator16.S [__APPLE__]: Likewise.
|
||||||
|
* grub-core/lib/i386/relocator_common.S [__APPLE__]: Likewise.
|
||||||
|
* grub-core/mmap/i386/pc/mmap_helper.S [__APPLE__]: Likewise.
|
||||||
|
|
||||||
2012-05-28 Vladimir Serbinenko <phcoder@gmail.com>
|
2012-05-28 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
* grub-core/efiemu/runtime/efiemu.c: Replace APPLE_CC with __APPLE__.
|
* grub-core/efiemu/runtime/efiemu.c: Replace APPLE_CC with __APPLE__.
|
||||||
|
|
|
@ -105,7 +105,12 @@ LOCAL (codestart):
|
||||||
call grub_gate_a20
|
call grub_gate_a20
|
||||||
|
|
||||||
movl LOCAL(compressed_size), %edx
|
movl LOCAL(compressed_size), %edx
|
||||||
|
#ifdef __APPLE__
|
||||||
|
addl $decompressor_end, %edx
|
||||||
|
subl $(LOCAL(reed_solomon_part)), %edx
|
||||||
|
#else
|
||||||
addl $(LOCAL(decompressor_end) - LOCAL(reed_solomon_part)), %edx
|
addl $(LOCAL(decompressor_end) - LOCAL(reed_solomon_part)), %edx
|
||||||
|
#endif
|
||||||
movl reed_solomon_redundancy, %ecx
|
movl reed_solomon_redundancy, %ecx
|
||||||
leal LOCAL(reed_solomon_part), %eax
|
leal LOCAL(reed_solomon_part), %eax
|
||||||
cld
|
cld
|
||||||
|
@ -303,8 +308,16 @@ multiboot_entry:
|
||||||
movl %ebp, %esp
|
movl %ebp, %esp
|
||||||
|
|
||||||
/* relocate the code */
|
/* relocate the code */
|
||||||
|
#ifdef __APPLE__
|
||||||
|
LOCAL(compressed_size_offset) = LOCAL(compressed_size) - LOCAL(base)
|
||||||
|
movl $0x200, %ecx
|
||||||
|
addl $decompressor_end, %ecx
|
||||||
|
subl $LOCAL(base), %ecx
|
||||||
|
addl LOCAL(compressed_size_offset) + 0x100000 + 0x200, %ecx
|
||||||
|
#else
|
||||||
movl $(LOCAL(decompressor_end) - _start + 0x200), %ecx
|
movl $(LOCAL(decompressor_end) - _start + 0x200), %ecx
|
||||||
addl LOCAL(compressed_size) - _start + 0x100000 + 0x200, %ecx
|
addl LOCAL(compressed_size) - _start + 0x100000 + 0x200, %ecx
|
||||||
|
#endif
|
||||||
movl $0x100000, %esi
|
movl $0x100000, %esi
|
||||||
movl $GRUB_BOOT_MACHINE_KERNEL_ADDR, %edi
|
movl $GRUB_BOOT_MACHINE_KERNEL_ADDR, %edi
|
||||||
cld
|
cld
|
||||||
|
@ -328,7 +341,11 @@ post_reed_solomon:
|
||||||
|
|
||||||
#ifdef ENABLE_LZMA
|
#ifdef ENABLE_LZMA
|
||||||
movl $GRUB_MEMORY_MACHINE_DECOMPRESSION_ADDR, %edi
|
movl $GRUB_MEMORY_MACHINE_DECOMPRESSION_ADDR, %edi
|
||||||
|
#ifdef __APPLE__
|
||||||
|
movl $decompressor_end, %esi
|
||||||
|
#else
|
||||||
movl $LOCAL(decompressor_end), %esi
|
movl $LOCAL(decompressor_end), %esi
|
||||||
|
#endif
|
||||||
pushl %edi
|
pushl %edi
|
||||||
movl LOCAL (uncompressed_size), %ecx
|
movl LOCAL (uncompressed_size), %ecx
|
||||||
leal (%edi, %ecx), %ebx
|
leal (%edi, %ecx), %ebx
|
||||||
|
@ -352,5 +369,9 @@ post_reed_solomon:
|
||||||
|
|
||||||
.p2align 4
|
.p2align 4
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
.zerofill __DATA, __aa_before_bss, decompressor_end, 10, 0
|
||||||
|
#else
|
||||||
.bss
|
.bss
|
||||||
LOCAL(decompressor_end):
|
LOCAL(decompressor_end):
|
||||||
|
#endif
|
||||||
|
|
|
@ -36,7 +36,12 @@ LOCAL (base):
|
||||||
/* Map the drive number (always in DL). */
|
/* Map the drive number (always in DL). */
|
||||||
push %ax
|
push %ax
|
||||||
push %bx
|
push %bx
|
||||||
|
#ifdef __APPLE__
|
||||||
|
LOCAL(mapstart_offset) = INT13H_OFFSET(LOCAL (mapstart))
|
||||||
|
movw $LOCAL(mapstart_offset), %bx
|
||||||
|
#else
|
||||||
movw $INT13H_OFFSET(LOCAL (mapstart)), %bx
|
movw $INT13H_OFFSET(LOCAL (mapstart)), %bx
|
||||||
|
#endif
|
||||||
|
|
||||||
more_remaining:
|
more_remaining:
|
||||||
movw %cs:(%bx), %ax
|
movw %cs:(%bx), %ax
|
||||||
|
@ -62,7 +67,12 @@ not_found:
|
||||||
popf
|
popf
|
||||||
pushf
|
pushf
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
LOCAL(oldhandler_offset) = INT13H_OFFSET (LOCAL (oldhandler))
|
||||||
|
lcall *%cs:LOCAL(oldhandler_offset)
|
||||||
|
#else
|
||||||
lcall *%cs:INT13H_OFFSET (LOCAL (oldhandler))
|
lcall *%cs:INT13H_OFFSET (LOCAL (oldhandler))
|
||||||
|
#endif
|
||||||
|
|
||||||
push %bp
|
push %bp
|
||||||
mov %sp, %bp
|
mov %sp, %bp
|
||||||
|
@ -85,7 +95,11 @@ norestore:
|
||||||
popf
|
popf
|
||||||
pushf
|
pushf
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
lcall *%cs:LOCAL(oldhandler_offset)
|
||||||
|
#else
|
||||||
lcall *%cs:INT13H_OFFSET (LOCAL (oldhandler))
|
lcall *%cs:INT13H_OFFSET (LOCAL (oldhandler))
|
||||||
|
#endif
|
||||||
|
|
||||||
push %bp
|
push %bp
|
||||||
mov %sp, %bp
|
mov %sp, %bp
|
||||||
|
|
|
@ -44,6 +44,9 @@
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <grub/symbol.h>
|
#include <grub/symbol.h>
|
||||||
#include <multiboot.h>
|
#include <multiboot.h>
|
||||||
|
#ifdef __APPLE__
|
||||||
|
#include <grub/i386/pc/memory.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
.file "startup.S"
|
.file "startup.S"
|
||||||
|
|
||||||
|
@ -53,6 +56,9 @@
|
||||||
start:
|
start:
|
||||||
_start:
|
_start:
|
||||||
__start:
|
__start:
|
||||||
|
#ifdef __APPLE__
|
||||||
|
LOCAL(start):
|
||||||
|
#endif
|
||||||
.code32
|
.code32
|
||||||
|
|
||||||
movl %ecx, (LOCAL(real_to_prot_addr) - _start) (%esi)
|
movl %ecx, (LOCAL(real_to_prot_addr) - _start) (%esi)
|
||||||
|
@ -60,7 +66,12 @@ __start:
|
||||||
movl %eax, (EXT_C(grub_realidt) - _start) (%esi)
|
movl %eax, (EXT_C(grub_realidt) - _start) (%esi)
|
||||||
|
|
||||||
/* copy back the decompressed part (except the modules) */
|
/* copy back the decompressed part (except the modules) */
|
||||||
|
#ifdef __APPLE__
|
||||||
|
movl $EXT_C(_edata), %ecx
|
||||||
|
subl $LOCAL(start), %ecx
|
||||||
|
#else
|
||||||
movl $(_edata - _start), %ecx
|
movl $(_edata - _start), %ecx
|
||||||
|
#endif
|
||||||
movl $(_start), %edi
|
movl $(_start), %edi
|
||||||
rep
|
rep
|
||||||
movsb
|
movsb
|
||||||
|
@ -84,11 +95,19 @@ LOCAL(cont):
|
||||||
movsb
|
movsb
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
/* clean out the bss */
|
||||||
|
movl $EXT_C(_edata), %edi
|
||||||
|
|
||||||
|
/* compute the bss length */
|
||||||
|
movl $GRUB_MEMORY_MACHINE_SCRATCH_ADDR, %ecx
|
||||||
|
#else
|
||||||
/* clean out the bss */
|
/* clean out the bss */
|
||||||
movl $BSS_START_SYMBOL, %edi
|
movl $BSS_START_SYMBOL, %edi
|
||||||
|
|
||||||
/* compute the bss length */
|
/* compute the bss length */
|
||||||
movl $END_SYMBOL, %ecx
|
movl $END_SYMBOL, %ecx
|
||||||
|
#endif
|
||||||
subl %edi, %ecx
|
subl %edi, %ecx
|
||||||
|
|
||||||
/* clean out */
|
/* clean out */
|
||||||
|
@ -182,6 +201,13 @@ FUNCTION(grub_pxe_call)
|
||||||
VARIABLE(grub_realidt)
|
VARIABLE(grub_realidt)
|
||||||
.long 0
|
.long 0
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
.globl EXT_C(_edata)
|
||||||
|
.globl EXT_C(grub_boot_device)
|
||||||
|
.zerofill __DATA, __aa_before_bss, EXT_C(_edata), 1, 0
|
||||||
|
.zerofill __DATA, __bss, EXT_C(grub_boot_device), 4, 2
|
||||||
|
#else
|
||||||
.bss
|
.bss
|
||||||
VARIABLE(grub_boot_device)
|
VARIABLE(grub_boot_device)
|
||||||
.long 0
|
.long 0
|
||||||
|
#endif
|
||||||
|
|
|
@ -35,10 +35,19 @@
|
||||||
VARIABLE(grub_relocator16_start)
|
VARIABLE(grub_relocator16_start)
|
||||||
PREAMBLE
|
PREAMBLE
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
LOCAL(cs_base_bytes12_offset) = LOCAL (cs_base_bytes12) - LOCAL (base)
|
||||||
|
LOCAL(cs_base_byte3_offset) = LOCAL (cs_base_byte3) - LOCAL (base)
|
||||||
|
movl %esi, %eax
|
||||||
|
movw %ax, (LOCAL(cs_base_bytes12_offset)) (RSI, 1)
|
||||||
|
shrl $16, %eax
|
||||||
|
movb %al, (LOCAL (cs_base_byte3_offset)) (RSI, 1)
|
||||||
|
#else
|
||||||
movl %esi, %eax
|
movl %esi, %eax
|
||||||
movw %ax, (LOCAL (cs_base_bytes12) - LOCAL (base)) (RSI, 1)
|
movw %ax, (LOCAL (cs_base_bytes12) - LOCAL (base)) (RSI, 1)
|
||||||
shrl $16, %eax
|
shrl $16, %eax
|
||||||
movb %al, (LOCAL (cs_base_byte3) - LOCAL (base)) (RSI, 1)
|
movb %al, (LOCAL (cs_base_byte3) - LOCAL (base)) (RSI, 1)
|
||||||
|
#endif
|
||||||
|
|
||||||
RELOAD_GDT
|
RELOAD_GDT
|
||||||
.code32
|
.code32
|
||||||
|
@ -75,12 +84,23 @@ VARIABLE(grub_relocator16_start)
|
||||||
|
|
||||||
movl %esi, %eax
|
movl %esi, %eax
|
||||||
shrl $4, %eax
|
shrl $4, %eax
|
||||||
|
#ifdef __APPLE_
|
||||||
|
LOCAL(segment_offset) = LOCAL (segment) - LOCAL (base)
|
||||||
|
LOCAL(idt_offset) = LOCAL(relocator16_idt) - LOCAL (base)
|
||||||
|
LOCAL(cont2_offset) = LOCAL (cont2) - LOCAL(base)
|
||||||
|
movw %ax, LOCAL(segment_offset) (%esi, 1)
|
||||||
|
lidt LOCAL(idt_offset) (%esi, 1)
|
||||||
|
|
||||||
|
/* jump to a 16 bit segment */
|
||||||
|
ljmp $PSEUDO_REAL_CSEG, $(LOCAL(cont2_offset))
|
||||||
|
#else
|
||||||
movw %ax, (LOCAL (segment) - LOCAL (base)) (%esi, 1)
|
movw %ax, (LOCAL (segment) - LOCAL (base)) (%esi, 1)
|
||||||
|
|
||||||
lidt (EXT_C(grub_relocator16_idt) - LOCAL (base)) (%esi, 1)
|
lidt (EXT_C(grub_relocator16_idt) - LOCAL (base)) (%esi, 1)
|
||||||
|
|
||||||
/* jump to a 16 bit segment */
|
/* jump to a 16 bit segment */
|
||||||
ljmp $PSEUDO_REAL_CSEG, $(LOCAL (cont2) - LOCAL(base))
|
ljmp $PSEUDO_REAL_CSEG, $(LOCAL (cont2) - LOCAL(base))
|
||||||
|
#endif
|
||||||
LOCAL(cont2):
|
LOCAL(cont2):
|
||||||
.code16
|
.code16
|
||||||
|
|
||||||
|
@ -92,7 +112,12 @@ LOCAL(cont2):
|
||||||
/* flush prefetch queue, reload %cs */
|
/* flush prefetch queue, reload %cs */
|
||||||
/* ljmp */
|
/* ljmp */
|
||||||
.byte 0xea
|
.byte 0xea
|
||||||
|
#ifdef __APPLE__
|
||||||
|
LOCAL(cont3_offset) = LOCAL(cont3) - LOCAL(base)
|
||||||
|
.word LOCAL(cont3_offset)
|
||||||
|
#else
|
||||||
.word LOCAL(cont3)-LOCAL(base)
|
.word LOCAL(cont3)-LOCAL(base)
|
||||||
|
#endif
|
||||||
LOCAL(segment):
|
LOCAL(segment):
|
||||||
.word 0
|
.word 0
|
||||||
|
|
||||||
|
@ -108,7 +133,12 @@ VARIABLE(grub_relocator16_keep_a20_enabled)
|
||||||
|
|
||||||
movw %cs, %ax
|
movw %cs, %ax
|
||||||
movw %ax, %ss
|
movw %ax, %ss
|
||||||
|
#ifdef __APPLE__
|
||||||
|
LOCAL(relocator16_end_offset) = LOCAL(relocator16_end) - LOCAL(base)
|
||||||
|
leaw LOCAL(relocator16_end_offset), %sp
|
||||||
|
#else
|
||||||
leaw LOCAL(relocator16_end) - LOCAL(base), %sp
|
leaw LOCAL(relocator16_end) - LOCAL(base), %sp
|
||||||
|
#endif
|
||||||
addw $GRUB_RELOCATOR16_STACK_SIZE, %sp
|
addw $GRUB_RELOCATOR16_STACK_SIZE, %sp
|
||||||
|
|
||||||
/* second, try a BIOS call */
|
/* second, try a BIOS call */
|
||||||
|
@ -282,6 +312,9 @@ LOCAL(cs_base_byte3):
|
||||||
.byte 0, 0x92, 0, 0
|
.byte 0, 0x92, 0, 0
|
||||||
LOCAL(gdt_end):
|
LOCAL(gdt_end):
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
LOCAL(relocator16_idt):
|
||||||
|
#endif
|
||||||
VARIABLE(grub_relocator16_idt)
|
VARIABLE(grub_relocator16_idt)
|
||||||
.word 0
|
.word 0
|
||||||
.long 0
|
.long 0
|
||||||
|
|
|
@ -42,12 +42,40 @@ LOCAL(base):
|
||||||
/* %rax contains now our new 'base'. */
|
/* %rax contains now our new 'base'. */
|
||||||
mov RAX, RSI
|
mov RAX, RSI
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
LOCAL(cont0_offset) = LOCAL(cont0) - LOCAL(base)
|
||||||
|
add $LOCAL(cont0_offset), RAX
|
||||||
|
#else
|
||||||
add $(LOCAL(cont0) - LOCAL(base)), RAX
|
add $(LOCAL(cont0) - LOCAL(base)), RAX
|
||||||
|
#endif
|
||||||
jmp *RAX
|
jmp *RAX
|
||||||
LOCAL(cont0):
|
LOCAL(cont0):
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
.macro RELOAD_GDT
|
.macro RELOAD_GDT
|
||||||
|
#ifdef __APPLE__
|
||||||
|
LOCAL(cont1_offset) = LOCAL(cont1) - LOCAL(base)
|
||||||
|
LOCAL(jump_vector_offset) = LOCAL(jump_vector) - LOCAL(base)
|
||||||
|
LOCAL(gdt_offset) = LOCAL(gdt) - LOCAL(base)
|
||||||
|
LOCAL(gdt_addr_offset) = LOCAL(gdt_addr) - LOCAL(base)
|
||||||
|
LOCAL(gdtdesc_offset) = LOCAL(gdt_addr) - LOCAL(base)
|
||||||
|
|
||||||
|
lea LOCAL(cont1_offset) (RSI, 1), RAX
|
||||||
|
movl %eax, LOCAL(jump_vector_offset) (RSI, 1)
|
||||||
|
|
||||||
|
lea LOCAL(gdt_offset) (RSI, 1), RAX
|
||||||
|
mov RAX, (LOCAL(gdt_addr_offset)) (RSI, 1)
|
||||||
|
|
||||||
|
/* Switch to compatibility mode. */
|
||||||
|
lgdt (LOCAL(gdtdesc_offset)) (RSI, 1)
|
||||||
|
|
||||||
|
/* Update %cs. */
|
||||||
|
ljmp *(LOCAL(jump_vector_offset)) (RSI, 1)
|
||||||
|
.p2align 4
|
||||||
|
LOCAL(gdtdesc):
|
||||||
|
LOCAL(gdtsize) = LOCAL(gdt_end) - LOCAL(gdt)
|
||||||
|
.word LOCAL(gdtsize)
|
||||||
|
#else
|
||||||
lea (LOCAL(cont1) - LOCAL(base)) (RSI, 1), RAX
|
lea (LOCAL(cont1) - LOCAL(base)) (RSI, 1), RAX
|
||||||
movl %eax, (LOCAL(jump_vector) - LOCAL(base)) (RSI, 1)
|
movl %eax, (LOCAL(jump_vector) - LOCAL(base)) (RSI, 1)
|
||||||
|
|
||||||
|
@ -63,6 +91,7 @@ LOCAL(cont0):
|
||||||
.p2align 4
|
.p2align 4
|
||||||
LOCAL(gdtdesc):
|
LOCAL(gdtdesc):
|
||||||
.word LOCAL(gdt_end) - LOCAL(gdt)
|
.word LOCAL(gdt_end) - LOCAL(gdt)
|
||||||
|
#endif
|
||||||
LOCAL(gdt_addr):
|
LOCAL(gdt_addr):
|
||||||
#ifdef __x86_64__
|
#ifdef __x86_64__
|
||||||
/* Filled by the code. */
|
/* Filled by the code. */
|
||||||
|
|
|
@ -28,7 +28,12 @@ VARIABLE(grub_machine_mmaphook_int12)
|
||||||
push %ds
|
push %ds
|
||||||
push %cs
|
push %cs
|
||||||
pop %ds
|
pop %ds
|
||||||
|
#ifdef __APPLE__
|
||||||
|
LOCAL(kblow_offset) = DS (LOCAL (kblow))
|
||||||
|
movw LOCAL(kblow_offset), %ax
|
||||||
|
#else
|
||||||
movw DS (LOCAL (kblow)), %ax
|
movw DS (LOCAL (kblow)), %ax
|
||||||
|
#endif
|
||||||
pop %ds
|
pop %ds
|
||||||
iret
|
iret
|
||||||
|
|
||||||
|
@ -53,8 +58,15 @@ LOCAL (e801):
|
||||||
push %ds
|
push %ds
|
||||||
push %cs
|
push %cs
|
||||||
pop %ds
|
pop %ds
|
||||||
|
#ifdef __APPLE__
|
||||||
|
LOCAL(kbin16mb_offset) = DS (LOCAL (kbin16mb))
|
||||||
|
LOCAL(m64kbin4gb_offset) = DS (LOCAL (m64kbin4gb))
|
||||||
|
movw LOCAL(kbin16mb_offset), %ax
|
||||||
|
movw LOCAL(m64kbin4gb_offset), %bx
|
||||||
|
#else
|
||||||
movw DS (LOCAL (kbin16mb)), %ax
|
movw DS (LOCAL (kbin16mb)), %ax
|
||||||
movw DS (LOCAL (m64kbin4gb)), %bx
|
movw DS (LOCAL (m64kbin4gb)), %bx
|
||||||
|
#endif
|
||||||
movw %ax, %cx
|
movw %ax, %cx
|
||||||
movw %bx, %dx
|
movw %bx, %dx
|
||||||
pop %ds
|
pop %ds
|
||||||
|
@ -66,7 +78,11 @@ LOCAL (h88):
|
||||||
push %ds
|
push %ds
|
||||||
push %cs
|
push %cs
|
||||||
pop %ds
|
pop %ds
|
||||||
|
#ifdef __APPLE__
|
||||||
|
movw LOCAL(kbin16mb_offset), %ax
|
||||||
|
#else
|
||||||
movw DS (LOCAL (kbin16mb)), %ax
|
movw DS (LOCAL (kbin16mb)), %ax
|
||||||
|
#endif
|
||||||
pop %ds
|
pop %ds
|
||||||
clc
|
clc
|
||||||
jmp LOCAL (iret_cf)
|
jmp LOCAL (iret_cf)
|
||||||
|
@ -78,14 +94,24 @@ LOCAL (e820):
|
||||||
pop %ds
|
pop %ds
|
||||||
cmpw $20, %cx
|
cmpw $20, %cx
|
||||||
jb LOCAL (errexit)
|
jb LOCAL (errexit)
|
||||||
|
#ifdef __APPLE__
|
||||||
|
LOCAL(mmap_num_offset) = DS (LOCAL (mmap_num))
|
||||||
|
cmpw LOCAL(mmap_num_offset), %bx
|
||||||
|
#else
|
||||||
cmpw DS (LOCAL (mmap_num)), %bx
|
cmpw DS (LOCAL (mmap_num)), %bx
|
||||||
|
#endif
|
||||||
jae LOCAL (errexit)
|
jae LOCAL (errexit)
|
||||||
cmp $0x534d4150, %edx
|
cmp $0x534d4150, %edx
|
||||||
jne LOCAL (errexit)
|
jne LOCAL (errexit)
|
||||||
push %si
|
push %si
|
||||||
push %di
|
push %di
|
||||||
movw $20, %cx
|
movw $20, %cx
|
||||||
|
#ifdef __APPLE__
|
||||||
|
LOCAL(mmaphook_map_offset) = DS(LOCAL (mmaphook_mmap))
|
||||||
|
movw $LOCAL(mmaphook_map_offset), %si
|
||||||
|
#else
|
||||||
movw $(DS(LOCAL (mmaphook_mmap))), %si
|
movw $(DS(LOCAL (mmaphook_mmap))), %si
|
||||||
|
#endif
|
||||||
mov %bx, %ax
|
mov %bx, %ax
|
||||||
imul $20, %ax
|
imul $20, %ax
|
||||||
add %ax, %si
|
add %ax, %si
|
||||||
|
@ -94,7 +120,11 @@ LOCAL (e820):
|
||||||
pop %si
|
pop %si
|
||||||
movl $20, %ecx
|
movl $20, %ecx
|
||||||
inc %bx
|
inc %bx
|
||||||
|
#ifdef __APPLE__
|
||||||
|
cmpw LOCAL(mmap_num_offset), %bx
|
||||||
|
#else
|
||||||
cmpw DS(LOCAL (mmap_num)), %bx
|
cmpw DS(LOCAL (mmap_num)), %bx
|
||||||
|
#endif
|
||||||
jb LOCAL (noclean)
|
jb LOCAL (noclean)
|
||||||
xor %bx, %bx
|
xor %bx, %bx
|
||||||
LOCAL (noclean):
|
LOCAL (noclean):
|
||||||
|
|
Loading…
Reference in a new issue