.syntax unified
.thumb
.cpu cortex-m4
.arch armv7e-m
.fpu fpv4-sp-d16
/* Changes from unprivileged to privileged mode. */
.thumb_func
.section .kernel
.global raise_privilege
.type raise_privilege, %function
raise_privilege:
mrs r0, control
bic r0, r0, #1
msr control, r0
dsb
isb
bx lr
this is part of arm assembly code. I can check chip manual to figure out the meaning of the instructions. But I don't know how to figure out the behavior of assembler directives like .thumb_func
. What's more, I also don't know how to use this part code, it doesn't' look like regular function. So I don't know how to "call" it.
Beau Carnes. Assembly language is a low-level programming language for a computer or other programmable device that is closest to the machine language. It is often specific to a particular computer architecture so there are multiple types of assembly languages. ARM is an increasingly popular assembly language.
The ALIGN directive aligns the current location to a specified boundary by padding with zeros or NOP instructions.
Reading from a FilePut the system call sys_read() number 3, in the EAX register. Put the file descriptor in the EBX register. Put the pointer to the input buffer in the ECX register. Put the buffer size, i.e., the number of bytes to read, in the EDX register.
ARM has a very complex set of instructions. Not because it has a lot, but mostly because it is extremely difficult to know what are the core instructions which are in most of the versions of the instruction set.
.
are really assembler directives. You can look them up in GAS: ARM machine directives
.syntax unified
signals the use of unified ARM / Thumb assembly syntax. The concept is explained here and here..thumb_func
signals the start of a Thumb mode function for ARM-Thumb interwork. The concept is explained here and here.raise_privilege
looks exactly like a void raise_privilege(void)
leaf function (i.e. it doesn't call other functions) in C to me. Call it with:bl raise_privilege
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With