+
+#if CONFIG_SLEEP
+ /* Becase we don't save the bootstrap page, and we share it
+ * between sleep and mp slave init, we need to recreate it
+ * after coming back from sleep or hibernate */
+ install_real_mode_bootstrap(slave_pstart);
+#endif
+}
+
+extern char real_mode_bootstrap_end[];
+extern char real_mode_bootstrap_base[];
+
+void
+install_real_mode_bootstrap(void *prot_entry)
+{
+ /*
+ * Copy the boot entry code to the real-mode vector area REAL_MODE_BOOTSTRAP_OFFSET.
+ * This is in page 1 which has been reserved for this purpose by
+ * machine_startup() from the boot processor.
+ * The slave boot code is responsible for switching to protected
+ * mode and then jumping to the common startup, _start().
+ */
+ bcopy_phys(kvtophys((vm_offset_t) real_mode_bootstrap_base),
+ (addr64_t) REAL_MODE_BOOTSTRAP_OFFSET,
+ real_mode_bootstrap_end-real_mode_bootstrap_base);
+
+ /*
+ * Set the location at the base of the stack to point to the
+ * common startup entry.
+ */
+ ml_phys_write_word(
+ PROT_MODE_START+REAL_MODE_BOOTSTRAP_OFFSET,
+ (unsigned int)kvtophys((vm_offset_t)prot_entry));
+
+ /* Flush caches */
+ __asm__("wbinvd");