Root/
Source at commit 1312 created 12 years 9 months ago. By meklort, Update malloc_init in i386 boot file | |
---|---|
1 | /*␊ |
2 | * Copyright (c) 1999-2003 Apple Computer, Inc. All rights reserved.␊ |
3 | *␊ |
4 | * @APPLE_LICENSE_HEADER_START@␊ |
5 | * ␊ |
6 | * Portions Copyright (c) 1999-2003 Apple Computer, Inc. All Rights␊ |
7 | * Reserved. This file contains Original Code and/or Modifications of␊ |
8 | * Original Code as defined in and that are subject to the Apple Public␊ |
9 | * Source License Version 2.0 (the "License").␉You may not use this file␊ |
10 | * except in compliance with the License. Please obtain a copy of the␊ |
11 | * License at http://www.apple.com/publicsource and read it before using␊ |
12 | * this file.␊ |
13 | * ␊ |
14 | * The Original Code and all software distributed under the License are␊ |
15 | * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER␊ |
16 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,␊ |
17 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,␊ |
18 | * FITNESS FOR A PARTICULAR PURPOSE OR NON- INFRINGEMENT. Please see the␊ |
19 | * License for the specific language governing rights and limitations␊ |
20 | * under the License.␊ |
21 | * ␊ |
22 | * @APPLE_LICENSE_HEADER_END@␊ |
23 | */␊ |
24 | /* Useful types. */␊ |
25 | ␊ |
26 | #ifndef __LIBSAIO_SAIO_TYPES_H␊ |
27 | #define __LIBSAIO_SAIO_TYPES_H␊ |
28 | ␊ |
29 | #include <sys/reboot.h>␊ |
30 | #include <sys/types.h>␊ |
31 | #include <sys/param.h>␊ |
32 | #include "bios.h"␊ |
33 | ␊ |
34 | #if DEBUG␊ |
35 | #define DEBUG_DISK(x) printf x␊ |
36 | #else␊ |
37 | #define DEBUG_DISK(x)␊ |
38 | #endif␊ |
39 | ␊ |
40 | typedef unsigned long entry_t;␊ |
41 | ␊ |
42 | typedef struct {␊ |
43 | ␉unsigned int sectors:8;␊ |
44 | ␉unsigned int heads:8;␊ |
45 | ␉unsigned int cylinders:16;␊ |
46 | } compact_diskinfo_t;␊ |
47 | ␊ |
48 | struct driveParameters {␊ |
49 | ␉int cylinders;␊ |
50 | ␉int sectors;␊ |
51 | ␉int heads;␊ |
52 | ␉int totalDrives;␊ |
53 | };␊ |
54 | ␊ |
55 | struct Tag {␊ |
56 | ␉long␉␉type;␊ |
57 | ␉char␉ *string;␊ |
58 | ␉long␉␉offset;␊ |
59 | ␉struct Tag *tag;␊ |
60 | ␉struct Tag *tagNext;␊ |
61 | };␊ |
62 | typedef struct Tag Tag, *TagPtr;␊ |
63 | ␊ |
64 | ␊ |
65 | typedef struct FinderInfo {␊ |
66 | ␉unsigned char data[16];␊ |
67 | } FinderInfo;␊ |
68 | ␊ |
69 | struct␉␉ BootVolume;␊ |
70 | typedef struct BootVolume * BVRef;␊ |
71 | typedef struct BootVolume * CICell;␊ |
72 | ␊ |
73 | typedef long (*FSInit)(CICell ih);␊ |
74 | typedef long (*FSLoadFile)(CICell ih, char * filePath);␊ |
75 | typedef long (*FSReadFile)(CICell ih, char *filePath, void *base, uint64_t offset, uint64_t length);␊ |
76 | typedef long (*FSGetFileBlock)(CICell ih, char *filePath, unsigned long long *firstBlock);␊ |
77 | typedef long (*FSGetDirEntry)(CICell ih, char * dirPath, long long * dirIndex,␊ |
78 | ␉␉␉␉␉␉␉ char ** name, long * flags, long * time,␊ |
79 | ␉␉␉␉␉␉␉ FinderInfo * finderInfo, long * infoValid);␊ |
80 | typedef long (*FSGetUUID)(CICell ih, char *uuidStr);␊ |
81 | typedef void (*BVGetDescription)(CICell ih, char * str, long strMaxLen);␊ |
82 | // Can be just pointed to free or a special free function␊ |
83 | typedef void (*BVFree)(CICell ih);␊ |
84 | ␊ |
85 | struct iob {␊ |
86 | ␉unsigned int i_flgs;␉␉␉/* see F_* below */␊ |
87 | ␉unsigned int i_offset;␉␉/* seek byte offset in file */␊ |
88 | ␉int␉␉␉ i_filesize;␉␉/* size of file */␊ |
89 | ␉char *␉␉ i_buf;␉␉␉/* file load address */␊ |
90 | };␊ |
91 | ␊ |
92 | #define BPS␉␉ 512␉␉␉␉/* sector size of the device */␊ |
93 | #define F_READ␉ 0x1␉␉␉␉/* file opened for reading */␊ |
94 | #define F_WRITE␉ 0x2␉␉␉␉/* file opened for writing */␊ |
95 | #define F_ALLOC␉ 0x4␉␉␉␉/* buffer allocated */␊ |
96 | #define F_FILE␉ 0x8␉␉␉␉/* file instead of device */␊ |
97 | #define F_NBSF␉ 0x10␉␉␉␉/* no bad sector forwarding */␊ |
98 | #define F_SSI␉ 0x40␉␉␉␉/* set skip sector inhibit */␊ |
99 | #define F_MEM␉ 0x80␉␉␉␉/* memory instead of file or device */␊ |
100 | ␊ |
101 | struct dirstuff {␊ |
102 | ␉char *␉␉ dir_path;␉␉/* directory path */␊ |
103 | ␉long long␉ dir_index;␉␉/* directory entry index */␊ |
104 | ␉BVRef␉␉ dir_bvr;␉␉␉/* volume reference */␊ |
105 | };␊ |
106 | ␊ |
107 | #define BVSTRLEN 32␊ |
108 | ␊ |
109 | enum {␊ |
110 | ␉kBVFlagPrimary␉␉␉= 0x01,␊ |
111 | ␉kBVFlagNativeBoot␉␉= 0x02,␊ |
112 | ␉kBVFlagForeignBoot␉␉= 0x04,␊ |
113 | ␉kBVFlagBootable␉␉␉= 0x08,␊ |
114 | ␉kBVFlagEFISystem␉␉= 0x10,␊ |
115 | ␉kBVFlagBooter␉␉␉= 0x20,␊ |
116 | ␉kBVFlagSystemVolume␉␉= 0x40␊ |
117 | };␊ |
118 | ␊ |
119 | enum {␊ |
120 | ␉kBIOSDevTypeFloppy␉␉= 0x00,␊ |
121 | ␉kBIOSDevTypeHardDrive␉= 0x80,␊ |
122 | ␉kBIOSDevTypeNetwork␉␉= 0xE0,␊ |
123 | ␉kBIOSDevUnitMask␉␉= 0x0F,␊ |
124 | ␉kBIOSDevTypeMask␉␉= 0xF0,␊ |
125 | ␉kBIOSDevMask␉␉␉= 0xFF␊ |
126 | };␊ |
127 | ␊ |
128 | enum {␊ |
129 | ␉kPartitionTypeHFS␉␉= 0xAF,␊ |
130 | ␉kPartitionTypeHPFS␉␉= 0x07,␊ |
131 | ␉kPartitionTypeFAT16␉␉= 0x06,␊ |
132 | ␉kPartitionTypeFAT32␉␉= 0x0c,␊ |
133 | ␉kPartitionTypeEXT3␉␉= 0x83␊ |
134 | };␊ |
135 | ␊ |
136 | //#define BIOS_DEV_TYPE(d)␉((d) & kBIOSDevTypeMask)␊ |
137 | #define BIOS_DEV_UNIT(bvr)␉((bvr)->biosdev - (bvr)->type)␊ |
138 | ␊ |
139 | /*␊ |
140 | * KernBootStruct device types.␊ |
141 | */␊ |
142 | enum {␊ |
143 | ␉DEV_SD = 0,␊ |
144 | ␉DEV_HD = 1,␊ |
145 | ␉DEV_FD = 2,␊ |
146 | ␉DEV_EN = 3␊ |
147 | };␊ |
148 | ␊ |
149 | /*␊ |
150 | * min/max Macros.␊ |
151 | * counting and rounding Macros.␊ |
152 | *␊ |
153 | * Azi: defined on <sys/param.h>,␊ |
154 | *␉␉i386/include/IOKit/IOLib.h (min/max), and others...␊ |
155 | *␊ |
156 | #ifndef MIN␊ |
157 | #define MIN(a,b) ( ((a) < (b)) ? (a) : (b) )␊ |
158 | #endif␊ |
159 | #ifndef MAX␊ |
160 | #define MAX(a,b) ( ((a) > (b)) ? (a) : (b) )␊ |
161 | #endif␊ |
162 | ␊ |
163 | #define round2(x, m)␉(((x) + (m / 2)) & ~(m - 1))␊ |
164 | #define roundup2(x, m)␉(((x) + m - 1) & ~(m - 1))*/␊ |
165 | ␊ |
166 | enum {␊ |
167 | ␉kNetworkDeviceType = kBIOSDevTypeNetwork,␊ |
168 | ␉kBlockDeviceType = kBIOSDevTypeHardDrive␊ |
169 | }; //gBootFileType_t;␊ |
170 | ␊ |
171 | enum {␊ |
172 | ␉kCursorTypeHidden␉ = 0x0100,␊ |
173 | ␉kCursorTypeUnderline = 0x0607␊ |
174 | };␊ |
175 | ␊ |
176 | #endif /* !__LIBSAIO_SAIO_TYPES_H */␊ |
177 |