+ double save_fp20;
+ double save_fp21;
+ double save_fp22;
+ double save_fp23;
+
+ double save_fp24;
+ double save_fp25;
+ double save_fp26;
+ double save_fp27;
+
+ double save_fp28;
+ double save_fp29;
+ double save_fp30;
+ double save_fp31;
+ /* offset 0x180 */
+ unsigned int save_180[8];
+ unsigned int save_1A0[8];
+ unsigned int save_1C0[8];
+ unsigned int save_1E0[8];
+ unsigned int save_200[8];
+ unsigned int save_220[8];
+ unsigned int save_240[8];
+ unsigned int save_260[8];
+
+ /* offset 0x280 */
+} savearea_fpu;
+#pragma pack()
+
+
+
+/*
+ * This type of savearea contains all of the vector context.
+ */
+
+#pragma pack(4) /* Make sure the structure stays as we defined it */
+typedef struct savearea_vec {
+
+ savearea_comm save_hdr; /* Stuff common to all saveareas */
+
+ unsigned int save_060[7]; /* Fill 32 bytes */
+ unsigned int save_vrvalid; /* Valid registers in saved context */
+
+ /* offset 0x0080 */
+ unsigned int save_vr0[4];
+ unsigned int save_vr1[4];
+ unsigned int save_vr2[4];
+ unsigned int save_vr3[4];
+ unsigned int save_vr4[4];
+ unsigned int save_vr5[4];
+ unsigned int save_vr6[4];
+ unsigned int save_vr7[4];
+ unsigned int save_vr8[4];
+ unsigned int save_vr9[4];
+ unsigned int save_vr10[4];
+ unsigned int save_vr11[4];
+ unsigned int save_vr12[4];
+ unsigned int save_vr13[4];
+ unsigned int save_vr14[4];
+ unsigned int save_vr15[4];
+ unsigned int save_vr16[4];
+ unsigned int save_vr17[4];
+ unsigned int save_vr18[4];
+ unsigned int save_vr19[4];
+ unsigned int save_vr20[4];
+ unsigned int save_vr21[4];
+ unsigned int save_vr22[4];
+ unsigned int save_vr23[4];
+ unsigned int save_vr24[4];
+ unsigned int save_vr25[4];
+ unsigned int save_vr26[4];
+ unsigned int save_vr27[4];
+ unsigned int save_vr28[4];
+ unsigned int save_vr29[4];
+ unsigned int save_vr30[4];
+ unsigned int save_vr31[4];
+
+ /* offset 0x280 */
+} savearea_vec;
+#pragma pack()
+#endif /* MACH_KERNEL_PRIVATE || BSD_KERNEL_PRIVATE */
+
+#ifdef MACH_KERNEL_PRIVATE
+
+#pragma pack(4) /* Make sure the structure stays as we defined it */
+struct Saveanchor {
+
+/*
+ * Note that this force aligned in aligned_data.s and must be in V=R storage.
+ * Also, all addresses in chains are physical. This structure can only be
+ * updated with translation and interrupts disabled. This is because it is
+ * locked during exception processing and if we were to take a PTE miss while the
+ * lock were held, well, that would be very bad now wouldn't it?
+ * Note that the first 24 bytes must be the same format as a savearea header.
+ */
+
+ unsigned int savelock; /* 000 Lock word for savearea free list manipulation */
+ int saveRSVD4; /* 004 reserved */
+ addr64_t savepoolfwd; /* 008 Forward anchor for the free pool */
+ addr64_t savepoolbwd; /* 010 Backward anchor for the free pool */
+ volatile addr64_t savefree; /* 018 Anchor for the global free list */
+ volatile unsigned int savefreecnt; /* 020 Number of saveareas on global free list */
+ volatile int saveadjust; /* 024 If 0 number of saveareas is ok, otherwise # to change (pos means grow, neg means shrink */
+ volatile int saveinuse; /* 028 Number of areas in use counting those on the local free list */
+ unsigned int savetarget; /* 02C Number of saveareas needed */
+ int savemaxcount; /* 030 Maximum saveareas ever allocated */
+ unsigned int saveinusesnapshot; /* 034 snapshot inuse count */
+ volatile addr64_t savefreesnapshot; /* 038 snapshot global free list header */
+/* 040 */
+};
+#pragma pack()
+
+extern struct Saveanchor saveanchor; /* Aliged savearea anchor */
+
+#define sac_cnt (4096 / sizeof(struct savearea)) /* Number of saveareas per page */
+#define sac_empty (0xFFFFFFFF << (32 - sac_cnt)) /* Mask with all entries empty */
+#define sac_perm 0x40000000 /* Page permanently assigned */
+#define sac_permb 1 /* Page permanently assigned - bit position */
+
+#define LocalSaveTarget (((8 + sac_cnt - 1) / sac_cnt) * sac_cnt) /* Target for size of local savearea free list */
+#define LocalSaveMin (LocalSaveTarget / 2) /* Min size of local savearea free list before we grow */
+#define LocalSaveMax (LocalSaveTarget * 2) /* Max size of local savearea free list before we trim */
+
+#define FreeListMin (2 * LocalSaveTarget) /* Always make sure there are enough to fill local list twice per processor */
+#define SaveLowHysteresis LocalSaveTarget /* The number off from target before we adjust upwards */
+#define SaveHighHysteresis (2 * FreeListMin) /* The number off from target before we adjust downwards */
+#define InitialSaveAreas (2 * FreeListMin) /* The number of saveareas to make at boot time */
+#define InitialSaveTarget FreeListMin /* The number of saveareas for an initial target. This should be the minimum ever needed. */
+#define InitialSaveBloks (InitialSaveAreas + sac_cnt - 1) / sac_cnt /* The number of savearea blocks to allocate at boot */
+#define BackPocketSaveBloks 8 /* Number of pages of back pocket saveareas */
+
+void save_queue(ppnum_t); /* Add a new savearea block to the free list */
+addr64_t save_get_init(void); /* special savearea-get for cpu initialization (returns physical address) */
+struct savearea *save_get(void); /* Obtains a savearea from the free list (returns virtual address) */
+reg64_t save_get_phys_32(void); /* Obtains a savearea from the free list (returns phys addr in r3) */
+reg64_t save_get_phys_64(void); /* Obtains a savearea from the free list (returns phys addr in r3) */
+struct savearea *save_alloc(void); /* Obtains a savearea and allocates blocks if needed */
+struct savearea *save_cpv(addr64_t); /* Converts a physical savearea address to virtual */
+void save_ret(struct savearea *); /* Returns a savearea to the free list by virtual address */
+void save_ret_wMSR(struct savearea *, reg64_t); /* returns a savearea and restores an MSR */
+void save_ret_phys(reg64_t); /* Returns a savearea to the free list by physical address */
+void save_adjust(void); /* Adjust size of the global free list */
+struct savearea_comm *save_trim_free(void); /* Remove free pages from savearea pool */
+int save_recover(void); /* returns nonzero if we can recover enough from the free pool */
+void savearea_init(vm_offset_t addr); /* Boot-time savearea initialization */
+
+void save_fake_zone_info( /* report savearea usage statistics as fake zone info */
+ int *count,
+ vm_size_t *cur_size,
+ vm_size_t *max_size,
+ vm_size_t *elem_size,
+ vm_size_t *alloc_size,
+ int *collectable,
+ int *exhaustable);
+
+void save_snapshot(void);
+void save_snapshot_restore(void);
+void save_release(struct savearea *);
+
+#endif /* MACH_KERNEL_PRIVATE */
+#endif /* __APPLE_API_PRIVATE */
+
+#endif /* ndef ASSEMBLER */
+
+#define SAVattach 0x80000000 /* Savearea has valid context */
+#define SAVrststk 0x00010000 /* Indicates that the current stack should be reset to empty */
+#define SAVsyscall 0x00020000 /* Indicates that the savearea is associated with a syscall */
+#define SAVredrive 0x00040000 /* Indicates that the low-level fault handler associated */
+#define SAVredriveb 13 /* Indicates that the low-level fault handler associated */
+#define SAVinstrument 0x00080000 /* Indicates that we should return instrumentation data */
+#define SAVinstrumentb 12 /* Indicates that we should return instrumentation data */
+#define SAVeat 0x00100000 /* Indicates that interruption should be ignored */
+#define SAVeatb 11 /* Indicates that interruption should be ignored */
+#define SAVinject 0x00200000 /* Indicates that save_instr contains code to inject */
+#define SAVinjectb 10 /* Indicates that save_instr contains code to inject */
+#define SAVtype 0x0000FF00 /* Shows type of savearea */
+#define SAVtypeshft 8 /* Shift to position type */
+#define SAVempty 0x86 /* Savearea is on free list */
+#define SAVgeneral 0x01 /* Savearea contains general context */
+#define SAVfloat 0x02 /* Savearea contains floating point context */
+#define SAVvector 0x03 /* Savearea contains vector context */
+
+
+
+#endif /* _PPC_SAVEAREA_H_ */