blob: 0827cb54dfdce385e33333a7a53dbedccb04e95d [file] [log] [blame]
// Copyright 2017 The Fuchsia Authors
//
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT
#include <lib/code_patching.h>
#include <arch/ops.h>
#include <lk/init.h>
extern const CodePatchInfo __start_code_patch_table[];
extern const CodePatchInfo __stop_code_patch_table[];
static void apply_startup_code_patches(uint level) {
for (const CodePatchInfo* patch = __start_code_patch_table; patch < __stop_code_patch_table;
++patch) {
patch->apply_func(patch);
arch_sync_cache_range((vaddr_t)patch->dest_addr, patch->dest_size);
}
}
LK_INIT_HOOK(code_patching, apply_startup_code_patches, LK_INIT_LEVEL_PLATFORM_PREVM)