#include <linux/static_call_types.h>
#include <linux/string.h>
-struct alternative {
- struct alternative *next;
- struct instruction *insn;
-};
-
static unsigned long nr_cfi, nr_cfi_reused, nr_cfi_cache;
static struct cfi_init_state initial_func_cfi;
struct list_head special_alts;
struct instruction *orig_insn, *new_insn;
struct special_alt *special_alt, *tmp;
+ enum alternative_type alt_type;
struct alternative *alt;
if (special_get_alts(file->elf, &special_alts))
if (handle_group_alt(file, special_alt, orig_insn, &new_insn))
return -1;
+ alt_type = ALT_TYPE_INSTRUCTIONS;
+
} else if (special_alt->jump_or_nop) {
if (handle_jump_alt(file, special_alt, orig_insn, &new_insn))
return -1;
+
+ alt_type = ALT_TYPE_JUMP_TABLE;
+ } else {
+ alt_type = ALT_TYPE_EX_TABLE;
}
alt = calloc(1, sizeof(*alt));
alt->insn = new_insn;
alt->next = orig_insn->alts;
+ alt->type = alt_type;
orig_insn->alts = alt;
list_del(&special_alt->list);
bool ignore;
};
+enum alternative_type {
+ ALT_TYPE_INSTRUCTIONS,
+ ALT_TYPE_JUMP_TABLE,
+ ALT_TYPE_EX_TABLE,
+};
+
+struct alternative {
+ struct alternative *next;
+ struct instruction *insn;
+ enum alternative_type type;
+};
+
#define INSN_CHUNK_BITS 8
#define INSN_CHUNK_SIZE (1 << INSN_CHUNK_BITS)
#define INSN_CHUNK_MAX (INSN_CHUNK_SIZE - 1)