-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
B0 self lock before jump #20110
base: main
Are you sure you want to change the base?
B0 self lock before jump #20110
Conversation
CI InformationTo view the history of this post, clich the 'edited' button above Inputs:Sources:sdk-nrf: PR head: e12aa788d4cecaa28a9df2fbab070db7960a49ea more detailssdk-nrf:
Github labels
List of changed files detected by CI (2)
Outputs:ToolchainVersion: 342151af73 Test Spec & Results: ✅ Success; ❌ Failure; 🟠 Queued; 🟡 Progress; ◻️ Skipped;
|
You can find the documentation preview for this PR at this link. Note: This comment is automatically posted by the Documentation Publish GitHub Action. |
b064fa9
to
056c521
Compare
2abe768
to
60d24dd
Compare
rebase |
c1e69e4
to
cf1c54a
Compare
Disables read and execute on memory containing NSIB right before jumping to application. Signed-off-by: Mateusz Michalek <[email protected]>
cf1c54a
to
e12aa78
Compare
: | ||
: "r" (vector_table[1]), "i" (CONFIG_SRAM_BASE_ADDRESS), | ||
"i" (CONFIG_SRAM_SIZE * 1024), "i" (0) | ||
: "r0", "r1", "r2", "r3", "memory" | ||
); | ||
#elif defined(CONFIG_SB_DISABLE_SELF_R_X) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#elif defined(CONFIG_SB_DISABLE_SELF_R_X) | |
#if defined(CONFIG_SB_DISABLE_SELF_R_X) |
This option is not supposed to be an alternative to CONFIG_SB_CLEANUP_RAM.
: | ||
: "r" (vector_table[1]), "i" (CONFIG_SRAM_BASE_ADDRESS), | ||
"i" (CONFIG_SRAM_SIZE * 1024), "i" (0) | ||
: "r0", "r1", "r2", "r3", "memory" | ||
); | ||
#elif defined(CONFIG_SB_DISABLE_SELF_R_X) | ||
|
||
relocate_bootconf_disable_r_x_and_jump()(vector_table[1]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strange syntax. Is that r0 might contain value of reset_vector, if not (vector_table[1]) does the job of populating r0?
I would rather create two alternatives of relocate_bootconf_disable_r_x_and_jump()
function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that might be a problem since at the point of execution of the relocate_bootconf_disable_r_x_and_jump, the vector_table, which is not constant, has already been wiped.
I think the relocate_bootconf_disable_r_x_and_jump should combine both the cleanup and lock.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch.
); | ||
} | ||
|
||
static ram_fn_ptr relocate_bootconf_disable_r_x_and_jump(void) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how this function preserves r0
value?
@@ -174,13 +223,18 @@ void bl_boot(const struct fw_info *fw_info) | |||
" b clear\n" | |||
"out:\n" | |||
" dsb\n" | |||
#ifndef CONFIG_SB_DISABLE_SELF_R_X |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you disable the jump to vector, r0 is not needed here so the line 211 can be commented out and in line 233 the r0 does not have to be on list. I suspect that impact on size is not that great, but code will get uglier.
Disables read and execute on memory containing NSIB
right before jumping to application.