| OLD | NEW |
| 1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 * Use of this source code is governed by a BSD-style license that can be | 2 * Use of this source code is governed by a BSD-style license that can be |
| 3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
| 4 * | 4 * |
| 5 * Functions for loading a kernel from disk. | 5 * Functions for loading a kernel from disk. |
| 6 * (Firmware portion) | 6 * (Firmware portion) |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "vboot_kernel.h" | 9 #include "vboot_kernel.h" |
| 10 | 10 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 gptdata->secondary_header)) | 101 gptdata->secondary_header)) |
| 102 return 1; | 102 return 1; |
| 103 } | 103 } |
| 104 Free(gptdata->secondary_header); | 104 Free(gptdata->secondary_header); |
| 105 } | 105 } |
| 106 | 106 |
| 107 /* Success */ | 107 /* Success */ |
| 108 return 0; | 108 return 0; |
| 109 } | 109 } |
| 110 | 110 |
| 111 /* disable MSVC warning on const logical expression (as in } while(0);) */ |
| 112 __pragma(warning(disable: 4127)) |
| 111 | 113 |
| 112 int LoadKernel(LoadKernelParams* params) { | 114 int LoadKernel(LoadKernelParams* params) { |
| 113 | 115 |
| 114 VbPublicKey* kernel_subkey = (VbPublicKey*)params->header_sign_key_blob; | 116 VbPublicKey* kernel_subkey = (VbPublicKey*)params->header_sign_key_blob; |
| 115 | 117 |
| 116 GptData gpt; | 118 GptData gpt; |
| 117 uint64_t part_start, part_size; | 119 uint64_t part_start, part_size; |
| 118 uint64_t blba = params->bytes_per_lba; | 120 uint64_t blba = params->bytes_per_lba; |
| 119 uint64_t kbuf_sectors = KBUF_SIZE / blba; | 121 uint64_t kbuf_sectors = KBUF_SIZE / blba; |
| 120 uint8_t* kbuf = NULL; | 122 uint8_t* kbuf = NULL; |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 /* Success! */ | 386 /* Success! */ |
| 385 return LOAD_KERNEL_SUCCESS; | 387 return LOAD_KERNEL_SUCCESS; |
| 386 } | 388 } |
| 387 | 389 |
| 388 // Handle error cases | 390 // Handle error cases |
| 389 if (found_partitions) | 391 if (found_partitions) |
| 390 return LOAD_KERNEL_INVALID; | 392 return LOAD_KERNEL_INVALID; |
| 391 else | 393 else |
| 392 return LOAD_KERNEL_NOT_FOUND; | 394 return LOAD_KERNEL_NOT_FOUND; |
| 393 } | 395 } |
| OLD | NEW |