2009-11-28 Vladimir Serbinenko Relocator framework * loader/i386/xnu_helper.S: Removed. All users updated. * conf/i386.rmk (pkglib_MODULES): Add relocator.mod. (relocator_mod_SOURCES): New variable. (relocator_mod_CFLAGS): Likewise. (relocator_mod_LDFLAGS): Likewise. (relocator_mod_ASFLAGS): Likewise. * conf/x86_64.rmk: Likewise. * include/grub/i386/multiboot.h (grub_multiboot_payload_orig): Removed. (grub_multiboot_payload_entry_offset): Likewise. (grub_multiboot_forward_relocator): Likewise. (grub_multiboot_forward_relocator_end): Likewise. (grub_multiboot_backward_relocator): Likewise. (grub_multiboot_backward_relocator_end): Likewise. (grub_multiboot_payload_eip): New variable. (grub_multiboot_payload_orig): Likewise. (GRUB_MULTIBOOT_STACK_SIZE): New definition. * include/grub/i386/pc/memory.h: Include grub/i386/memory.h. (GRUB_MEMORY_MACHINE_CR0_PE_ON): Move from here ... * include/grub/i386/memory.h (GRUB_MEMORY_CPU_CR0_PE_ON): ... to here (GRUB_MEMORY_CPU_CR4_PAE_ON): New definition. (GRUB_MEMORY_CPU_CR0_PAGING_ON): Likewise. (GRUB_MEMORY_CPU_AMD64_MSR): Likewise. (GRUB_MEMORY_CPU_AMD64_MSR_ON): Likewise. * include/grub/i386/relocator.h: New file. * include/grub/x86_64/relocator.h: Likewise. * include/grub/i386/xnu.h: Include grub/cpu/relocator.h. (XNU_RELOCATOR): New macro. (grub_xnu_launcher_start): Remove. (grub_xnu_launcher_end): Likewise. * include/grub/xnu.h (grub_xnu_boot_resume): New prototype. (grub_xnu_heap_real_start): Remove. (grub_xnu_heap_start): Change to void *. All users updated. * kern/i386/realmode.S (real_to_prot): Use GRUB_MEMORY_CPU_CR0_PE_ON. * lib/i386/relocator.c: New file. * lib/i386/relocator_asm.S: Likewise. * lib/i386/relocator_backward.S: Likewise. * lib/mips/relocator.c: Likewise. * lib/mips/relocator_asm.S: Likewise. * lib/relocator.c: Likewise. * loader/i386/multiboot.c: Include grub/i386/relocator.h. (entry): Removed. (playground): Likewise. (grub_multiboot_payload_orig): New variable. (grub_multiboot_payload_dest): Likewise. (grub_multiboot_payload_size): Likewise. (grub_multiboot_payload_eip): Likewise. (grub_multiboot_payload_esp): Likewise. (grub_multiboot_boot): Use grub_relocator32_boot. (grub_multiboot_unload): Free relocators. (grub_multiboot): Setup stack. Use relocators. * loader/i386/multiboot_elfxx.c: Include grub/i386/relocator.h. (grub_multiboot_load_elfXX): Use relocators. * loader/i386/multiboot_helper.S (grub_multiboot_payload_orig): Removed. (grub_multiboot_payload_size): Likewise. (grub_multiboot_payload_dest): Likewise. (grub_multiboot_payload_entry_offset): Likewise. (grub_multiboot_forward_relocator): Likewise. (grub_multiboot_backward_relocator): Likewise. (grub_multiboot_real_boot): Likewise. * loader/i386/xnu.c (grub_xnu_heap_will_be_at): New variable. (grub_xnu_entry_point): Likewise. (grub_xnu_arg1): Likewise. (grub_xnu_stack): Likewise. (grub_xnu_launch): Removed. (grub_xnu_boot_resume): New function. (grub_xnu_boot): Use relocators. * loader/i386/xnu_helper.S: Removed. * loader/xnu.c (grub_xnu_heap_start): New variable. (grub_xnu_heap_size): Likewise. (grub_xnu_heap_malloc): Use relocators. * loader/xnu_resume.c (grub_xnu_resume): Use relocators.