]>
Commit | Line | Data |
---|---|---|
14c7c974 | 1 | /* |
57c72a9a | 2 | * Copyright (c) 1999-2003 Apple Computer, Inc. All rights reserved. |
14c7c974 A |
3 | * |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
57c72a9a | 6 | * Portions Copyright (c) 1999-2003 Apple Computer, Inc. All Rights |
4f6e3300 A |
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 | |
57c72a9a | 9 | * Source License Version 2.0 (the "License"). You may not use this file |
4f6e3300 A |
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. | |
14c7c974 A |
13 | * |
14 | * The Original Code and all software distributed under the License are | |
4f6e3300 | 15 | * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER |
14c7c974 A |
16 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
17 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
4f6e3300 A |
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. | |
14c7c974 A |
21 | * |
22 | * @APPLE_LICENSE_HEADER_END@ | |
23 | */ | |
24 | ||
25 | #ifndef __BOOT_MEMORY_H | |
26 | #define __BOOT_MEMORY_H | |
27 | ||
28 | /* Memory addresses used by booter and friends */ | |
29 | ||
75b89a82 | 30 | #define BASE_SEG 0x2000 |
57c72a9a | 31 | #define STACK_SEG 0x5000 |
75b89a82 A |
32 | #define STACK_OFS 0xFFF0 // stack pointer |
33 | ||
f083c6c3 A |
34 | #define BOOT1U_SEG 0x1000 |
35 | #define BOOT1U_OFS 0x0200 | |
36 | ||
75b89a82 A |
37 | #define BOOT2_SEG BASE_SEG |
38 | #define BOOT2_OFS 0x0200 // 512 byte disk sector offset | |
39 | ||
57c72a9a A |
40 | #define BIOS_ADDR 0x8000 // BIOS disk I/O buffer |
41 | #define BIOS_LEN 0x8000 // 32K - divisible by 512 and 2048 | |
42 | ||
43 | #define BOOT0_ADDR 0x7E00 // boot0 gets loaded here | |
44 | ||
75b89a82 | 45 | |
14c7c974 A |
46 | /* These are all "virtual" addresses... |
47 | * which are physical addresses plus MEMBASE. | |
48 | */ | |
75b89a82 A |
49 | #define ADDR32(seg, ofs) (((seg) << 4 ) + (ofs)) |
50 | ||
51 | #define MEMBASE 0x0 | |
52 | ||
57c72a9a A |
53 | #define BOOTSTRUCT_ADDR 0x00011000 // it's slightly smaller |
54 | #define BOOTSTRUCT_LEN 0x0000F000 | |
75b89a82 A |
55 | |
56 | #define BASE_ADDR ADDR32(BASE_SEG, 0) | |
f083c6c3 A |
57 | #define BASE1U_ADDR ADDR32(BOOT1U_SEG, 0) |
58 | #define BOOT1U_ADDR ADDR32(BOOT1U_SEG, BOOT1U_OFS) | |
75b89a82 A |
59 | #define BOOT2_ADDR ADDR32(BOOT2_SEG, BOOT2_OFS) |
60 | ||
57c72a9a A |
61 | #define HIB_ADDR 0x00040000 // special hibernation area |
62 | #define HIB_LEN 0x00060000 | |
63 | ||
64 | #define VIDEO_ADDR 0x000A0000 // unusable space | |
65 | #define VIDEO_LEN 0x00060000 | |
75b89a82 | 66 | |
57c72a9a A |
67 | #define KERNEL_ADDR 0x00100000 // 64M kernel + drivers |
68 | #define KERNEL_LEN 0x04000000 | |
75b89a82 | 69 | |
bba600dd A |
70 | #define ZALLOC_ADDR 0x04100000 // 39M zalloc area |
71 | #define ZALLOC_LEN 0x02700000 | |
75b89a82 | 72 | |
bba600dd A |
73 | #define LOAD_ADDR 0x06800000 // 24M File load buffer |
74 | #define LOAD_LEN 0x01800000 | |
75b89a82 A |
75 | |
76 | #define TFTP_ADDR LOAD_ADDR // tftp download buffer | |
77 | #define TFTP_LEN LOAD_LEN | |
78 | ||
79 | #define kLoadAddr LOAD_ADDR | |
80 | #define kLoadSize LOAD_LEN | |
81 | ||
82 | #define CONVENTIONAL_LEN 0x0A0000 // 640k | |
83 | #define EXTENDED_ADDR 0x100000 // 1024k | |
84 | ||
85 | #define ptov(paddr) ((paddr) - MEMBASE) | |
86 | #define vtop(vaddr) ((vaddr) + MEMBASE) | |
87 | ||
88 | /* | |
89 | * Extract segment/offset from a linear address. | |
90 | */ | |
91 | #define OFFSET16(addr) ((addr) - BASE_ADDR) | |
f083c6c3 | 92 | #define OFFSET1U16(addr) ((addr) - BASE1U_ADDR) |
75b89a82 A |
93 | #define OFFSET(addr) ((addr) & 0xFFFF) |
94 | #define SEGMENT(addr) (((addr) & 0xF0000) >> 4) | |
95 | ||
96 | /* | |
97 | * We need a minimum of 32MB of system memory. | |
98 | */ | |
99 | #define MIN_SYS_MEM_KB (32 * 1024) | |
14c7c974 A |
100 | |
101 | /* | |
75b89a82 | 102 | * The number of descriptor entries in the GDT. |
14c7c974 | 103 | */ |
75b89a82 | 104 | #define NGDTENT 7 |
14c7c974 | 105 | |
47b0a8bd | 106 | /* |
75b89a82 A |
107 | * The total size of the GDT in bytes. |
108 | * Each descriptor entry require 8 bytes. | |
47b0a8bd | 109 | */ |
75b89a82 | 110 | #define GDTLIMIT ( NGDTENT * 8 ) |
14c7c974 A |
111 | |
112 | #endif /* !__BOOT_MEMORY_H */ |