aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2020-04-27 21:08:04 +1000
committerOliver O'Halloran <oohall@gmail.com>2020-06-11 12:52:55 +1000
commit0deffc80773cc63386846b794b7f1e702212b8f1 (patch)
tree48931e6ca05ff8a6883d356320fedbc195e64bdc /core
parent2cc897067b87d9983250776739c0a4b2e44578f3 (diff)
downloadskiboot-0deffc80773cc63386846b794b7f1e702212b8f1.zip
skiboot-0deffc80773cc63386846b794b7f1e702212b8f1.tar.gz
skiboot-0deffc80773cc63386846b794b7f1e702212b8f1.tar.bz2
move opal_branch_table, opal_num_args to .rodata section
.head is for code and data which must reside at a fixed low address, mainly entry points. These are moved into .rodata. Despite being modified at runtime, this facilitates these tables being write-protected in a later patch. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Diffstat (limited to 'core')
-rw-r--r--core/opal.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/core/opal.c b/core/opal.c
index 64fdfe6..46518c4 100644
--- a/core/opal.c
+++ b/core/opal.c
@@ -28,10 +28,10 @@
uint64_t opal_pending_events;
/* OPAL dispatch table defined in head.S */
-extern uint64_t opal_branch_table[];
+extern const uint64_t opal_branch_table[];
/* Number of args expected for each call. */
-static u8 opal_num_args[OPAL_LAST+1];
+static const u8 opal_num_args[OPAL_LAST+1];
/* OPAL anchor node */
struct dt_node *opal_node;
@@ -53,8 +53,8 @@ void opal_table_init(void)
prlog(PR_DEBUG, "OPAL table: %p .. %p, branch table: %p\n",
s, e, opal_branch_table);
while(s < e) {
- opal_branch_table[s->token] = function_entry_address(s->func);
- opal_num_args[s->token] = s->nargs;
+ ((uint64_t *)opal_branch_table)[s->token] = function_entry_address(s->func);
+ ((u8 *)opal_num_args)[s->token] = s->nargs;
s++;
}
}
@@ -321,8 +321,8 @@ void __opal_register(uint64_t token, void *func, unsigned int nargs)
{
assert(token <= OPAL_LAST);
- opal_branch_table[token] = function_entry_address(func);
- opal_num_args[token] = nargs;
+ ((uint64_t *)opal_branch_table)[token] = function_entry_address(func);
+ ((u8 *)opal_num_args)[token] = nargs;
}
/*