VerifyKernelHeader() fills a KernelImage*

Rather than copying individual fields.  More suitable for use in LoadKernel().

Added StatefulSkip(), so that fields in the input stream can be skipped more cleanly.

Review URL: http://codereview.chromium.org/2327001
This commit is contained in:
Randall Spangler
2010-05-27 16:18:35 -07:00
parent ded1cecd36
commit a9f17aa44a
5 changed files with 90 additions and 38 deletions

View File

@@ -12,6 +12,18 @@
#include <stdio.h>
#include <stdlib.h>
void* StatefulSkip(MemcpyState* state, uint64_t len) {
if (state->overrun)
return NULL;
if (len > state->remaining_len) {
state->overrun = 1;
return NULL;
}
state->remaining_buf += len;
state->remaining_len -= len;
return state; // have to return something non-NULL
}
void* StatefulMemcpy(MemcpyState* state, void* dst,
uint64_t len) {
if (state->overrun)