Changeset 139
- Timestamp:
- Dec 10, 2010 5:09:57 AM (2 years ago)
- File:
-
- 1 edited
-
trunk/filo/i386/linux_load.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/filo/i386/linux_load.c
r138 r139 58 58 u8 setup_sects; /* 0x1f1 */ 59 59 u16 root_flags; /* 0x1f2 */ 60 u8 reserved2[6]; /* 0x1f4 */ 60 u32 syssize; /* 0x1f4 (2.04+) */ 61 u8 reserved2[2]; /* 0x1f8 */ 61 62 u16 vid_mode; /* 0x1fa */ 62 63 u16 root_dev; /* 0x1fc */ … … 83 84 /* 2.03+ */ 84 85 u32 initrd_addr_max; /* 0x22c */ 86 /* 2.05+ */ 87 u32 kernel_alignment; /* 0x230 */ 88 u8 relocatable_kernel; /* 0x234 */ 89 u8 min_alignment; /* 0x235 (2.10+) */ 90 u8 reserved6[2]; /* 0x236 */ 91 /* 2.06+ */ 92 u32 cmdline_size; /* 0x238 */ 93 /* 2.07+ */ 94 u32 hardware_subarch; /* 0x23c */ 95 u64 hardware_subarch_data;/* 0x240 */ 96 /* 2.08+ */ 97 u32 payload_offset; /* 0x248 */ 98 u32 payload_length; /* 0x24c */ 99 /* 2.09+ */ 100 u64 setup_data; /* 0x250 */ 101 /* 2.10+ */ 102 u64 pref_address; /* 0x258 */ 103 u32 init_size; /* 0x260 */ 85 104 } __attribute__ ((packed)); 86 105 … … 161 180 u8 reserved12_5[8]; /* 0x220 */ 162 181 u32 cmd_line_ptr; /* 0x228 */ 163 u8 reserved13[164]; /* 0x22c */ 182 u32 initrd_addr_max; /* 0x22c */ 183 u32 kernel_alignment; /* 0x230 */ 184 u8 relocatable_kernel; /* 0x234 */ 185 u8 reserved13[155]; /* 0x22c */ 164 186 struct e820entry e820_map[E820MAX]; /* 0x2d0 */ 165 187 u8 reserved16[688]; /* 0x550 */ … … 177 199 static u32 load_linux_header(struct linux_header *hdr) 178 200 { 201 u32 kern_addr = 0; 179 202 int load_high; 180 u32 kern_addr;181 203 182 204 if (file_read(hdr, sizeof *hdr) != sizeof *hdr) { … … 222 244 load_high = hdr->loadflags & 1; 223 245 } 246 247 /* determine kernel load address */ 248 if (hdr->protocol_version >= 0x20a) { 249 if (hdr->pref_address >> 32) { 250 debug(" (ignoring 64bit pref_address)"); 251 } else { 252 kern_addr = hdr->pref_address; 253 } 254 } 255 256 if (hdr->protocol_version >= 0x205 && hdr->relocatable_kernel) { 257 printf(" relocatable"); 258 } 259 224 260 if (load_high) { 225 261 printf(" bzImage"); 226 kern_addr = 0x100000; 262 if (kern_addr == 0) 263 kern_addr = 0x100000; 227 264 } else { 228 265 printf(" zImage or Image"); 229 kern_addr = 0x1000; 266 if (kern_addr == 0) 267 kern_addr = 0x1000; 230 268 } 231 269 … … 258 296 259 297 params->loader_type = 0xff; /* Unregistered Linux loader */ 298 299 /* copy alignment fields for relocatable kernels */ 300 if (hdr->protocol_version >= 0x205) { 301 params->relocatable_kernel = hdr->relocatable_kernel; 302 params->kernel_alignment = hdr->kernel_alignment; 303 } 260 304 } 261 305 … … 677 721 ctx->eip = kern_addr; 678 722 723 /* set this field in any case to support relocatable kernels */ 724 params->kernel_start = kern_addr; 725 679 726 debug("EIP=%#x\n", kern_addr); 680 727 printf("Jumping to entry point...\n");
Note: See TracChangeset
for help on using the changeset viewer.
