]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/i386/pal_routines.c
xnu-3789.70.16.tar.gz
[apple/xnu.git] / osfmk / i386 / pal_routines.c
index 34e5bd0a57536adb6493fa20b7e8d2fea500581f..b11aaf462b4abef18605e6267faafb341a2a8001 100644 (file)
@@ -64,12 +64,7 @@ struct pal_apic_table *apic_table = NULL;
 
 decl_simple_lock_data(static , pal_efi_lock);
 #ifdef __x86_64__
-#define PML4_PROT      (INTEL_PTE_VALID | INTEL_PTE_WRITE)
-#define INIT_PDPT_BASE (INITPT_SEG_BASE + PAGE_SIZE)
-static pml4_entry_t IDPML4[PTE_PER_PAGE] __attribute__ ((aligned (4096))) = {
-       [0]                 = (uint64_t)(INIT_PDPT_BASE | PML4_PROT),
-       [KERNEL_PML4_INDEX] = (uint64_t)(INIT_PDPT_BASE | PML4_PROT),
-};
+static pml4_entry_t IDPML4[PTE_PER_PAGE] __attribute__ ((aligned (4096)));
 uint64_t       pal_efi_saved_cr0;
 uint64_t       pal_efi_saved_cr3;
 #endif
@@ -82,10 +77,18 @@ pal_serial_init(void)
        return serial_init();
 }
 
+void
+pal_serial_putc_nocr(char c)
+{
+       serial_putc(c);
+}
+
 void
 pal_serial_putc(char c)
 {
        serial_putc(c);
+       if (c == '\n')
+               serial_putc('\r');
 }
 
 int
@@ -168,6 +171,14 @@ pal_efi_call_in_64bit_mode(uint64_t func,
         return KERN_NOT_SUPPORTED;
     }
 
+    if (func < VM_MIN_KERNEL_ADDRESS) {
+        /*
+         * EFI Runtime Services must be mapped in our address
+         * space at an appropriate location.
+         */
+        return KERN_INVALID_ADDRESS;
+    }
+
     _pal_efi_call_in_64bit_mode_asm(func,
                                     efi_reg,
                                     stack_contents,
@@ -245,6 +256,8 @@ pal_efi_call_in_32bit_mode(uint32_t func,
     MARK_CPU_IDLE(cpu_number());
     pal_efi_saved_cr3 = get_cr3_raw();
     pal_efi_saved_cr0 = get_cr0();
+    IDPML4[KERNEL_PML4_INDEX] = IdlePML4[KERNEL_PML4_INDEX];
+    IDPML4[0]                = IdlePML4[KERNEL_PML4_INDEX];
     clear_ts();
     set_cr3_raw((uint64_t) ID_MAP_VTOP(IDPML4));
     
@@ -342,8 +355,3 @@ void
 pal_preemption_assert(void)
 {
 }
-
-void
-hibernate_pal_prepare(void)
-{
-}