]> git.saurik.com Git - apple/xnu.git/blobdiff - iokit/IOKit/IOHibernatePrivate.h
xnu-792.13.8.tar.gz
[apple/xnu.git] / iokit / IOKit / IOHibernatePrivate.h
index 01e3b860cbe3d54028ff5513897e09d540639224..07ccb559a8178b184dc6179724aa62b81bb08bb1 100644 (file)
@@ -1,23 +1,31 @@
 /*
  * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
  *
- * @APPLE_LICENSE_HEADER_START@
+ * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
  * 
- * The contents of this file constitute Original Code as defined in and
- * are subject to the Apple Public Source License Version 1.1 (the
- * "License").  You may not use this file except in compliance with the
- * License.  Please obtain a copy of the License at
- * http://www.apple.com/publicsource and read it before using this file.
- * 
- * This Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
- * License for the specific language governing rights and limitations
- * under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
+ * This file contains Original Code and/or Modifications of Original Code 
+ * as defined in and that are subject to the Apple Public Source License 
+ * Version 2.0 (the 'License'). You may not use this file except in 
+ * compliance with the License.  The rights granted to you under the 
+ * License may not be used to create, or enable the creation or 
+ * redistribution of, unlawful or unlicensed copies of an Apple operating 
+ * system, or to circumvent, violate, or enable the circumvention or 
+ * violation of, any terms of an Apple operating system software license 
+ * agreement.
+ *
+ * Please obtain a copy of the License at 
+ * http://www.opensource.apple.com/apsl/ and read it before using this 
+ * file.
+ *
+ * The Original Code and all software distributed under the License are 
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 
+ * Please see the License for the specific language governing rights and 
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
  */
 
 #include <stdint.h>
@@ -65,7 +73,10 @@ struct IOHibernateImageHeader
     uint32_t   signature;
     uint32_t   processorFlags;
 
-    uint8_t    reserved2[24];
+    uint32_t    runtimePages;
+    uint32_t    runtimePageCount;
+
+    uint8_t    reserved2[16];
     
     uint64_t   encryptStart;
     uint64_t   machineSignature;
@@ -75,7 +86,13 @@ struct IOHibernateImageHeader
 
     uint32_t   diag[4];
 
-    uint32_t   reserved[82];           // make sizeof == 512
+    int32_t    graphicsInfoOffset;
+    int32_t    cryptVarsOffset;
+    int32_t    memoryMapOffset;
+    uint32_t    memoryMapSize;
+    uint32_t    systemTableOffset;
+
+    uint32_t   reserved[77];           // make sizeof == 512
 
     uint32_t           fileExtentMapSize;
     IOPolledFileExtent fileExtentMap[2];
@@ -225,15 +242,25 @@ hibernate_vm_lock(void);
 void
 hibernate_vm_unlock(void);
 
+// mark pages not to be saved, based on VM system accounting
 void
 hibernate_page_list_setall(hibernate_page_list_t * page_list,
                           hibernate_page_list_t * page_list_wired,
                           uint32_t * pagesOut);
 
+// mark pages to be saved, or pages not to be saved but available 
+// for scratch usage during restore
 void
 hibernate_page_list_setall_machine(hibernate_page_list_t * page_list,
                                     hibernate_page_list_t * page_list_wired,
                                     uint32_t * pagesOut);
+
+// mark pages not to be saved and not for scratch usage during restore
+void
+hibernate_page_list_set_volatile( hibernate_page_list_t * page_list,
+                                 hibernate_page_list_t * page_list_wired,
+                                 uint32_t * pagesOut);
+
 void
 hibernate_page_list_discard(hibernate_page_list_t * page_list);
 
@@ -243,11 +270,15 @@ hibernate_set_page_state(hibernate_page_list_t * page_list, hibernate_page_list_
 
 void 
 hibernate_page_bitset(hibernate_page_list_t * list, boolean_t set, uint32_t page);
+
 boolean_t 
 hibernate_page_bittst(hibernate_page_list_t * list, uint32_t page);
 
+hibernate_bitmap_t *
+hibernate_page_bitmap_pin(hibernate_page_list_t * list, uint32_t * page);
+
 uint32_t
-hibernate_page_list_count(hibernate_page_list_t *list, uint32_t set, uint32_t page);
+hibernate_page_bitmap_count(hibernate_bitmap_t * bitmap, uint32_t set, uint32_t page);
 
 void 
 hibernate_restore_phys_page(uint64_t src, uint64_t dst, uint32_t len, uint32_t procFlags);
@@ -261,6 +292,10 @@ long
 hibernate_machine_entrypoint(IOHibernateImageHeader * header, void * p2, void * p3, void * p4);
 long
 hibernate_kernel_entrypoint(IOHibernateImageHeader * header, void * p2, void * p3, void * p4);
+void
+hibernate_newruntime_map(void * map, vm_size_t map_size, 
+                           uint32_t system_table_offset);
+
 
 extern uint32_t    gIOHibernateState;
 extern uint32_t    gIOHibernateMode;
@@ -330,6 +365,8 @@ enum
 #define kIOHibernateMemorySignatureEnvKey "mem-sig"
 #define kIOHibernateMachineSignatureKey          "machine-signature"
 
+#define kIOHibernateRTCVariablesKey    "IOHibernateRTCVariables"
+
 #ifdef __cplusplus
 }
 #endif