aboutsummaryrefslogtreecommitdiff
path: root/asm.s
diff options
context:
space:
mode:
authorGravatar bors[bot] <26634292+bors[bot]@users.noreply.github.com> 2019-09-13 13:03:45 +0000
committerGravatar GitHub <noreply@github.com> 2019-09-13 13:03:45 +0000
commit718cd17aadda36edf3dff761e55a580e54e355df (patch)
tree855d9442a20d9cec496925f4c664e702ad106e06 /asm.s
parentb4d2e9ed192fd289adff440d26641cadf274a940 (diff)
parent3d1fd33d4b387732a0878f356c8346e1e6c30368 (diff)
downloadcortex-m-718cd17aadda36edf3dff761e55a580e54e355df.tar.gz
cortex-m-718cd17aadda36edf3dff761e55a580e54e355df.tar.zst
cortex-m-718cd17aadda36edf3dff761e55a580e54e355df.zip
Merge #164
164: Allow writing to the CONTROL register r=adamgreig a=jonas-schievink This allows entering unprivileged mode. Part of https://github.com/rust-embedded/cortex-m/issues/58 Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
Diffstat (limited to 'asm.s')
-rw-r--r--asm.s14
1 files changed, 11 insertions, 3 deletions
diff --git a/asm.s b/asm.s
index 1ad6fed..fd2c7fa 100644
--- a/asm.s
+++ b/asm.s
@@ -5,13 +5,21 @@ __bkpt:
bkpt
bx lr
- .section .text.__control
- .global __control
+ .section .text.__control_r
+ .global __control_r
.thumb_func
-__control:
+__control_r:
mrs r0, CONTROL
bx lr
+ .section .text.__control_w
+ .global __control_w
+ .thumb_func
+__control_w:
+ msr CONTROL, r0
+ bx lr
+
+
.section .text.__cpsid
.global __cpsid
.thumb_func