mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-25 03:01:36 +01:00
userland: attempt to fix all assembly example links to README
This commit is contained in:
39
README.adoc
39
README.adoc
@@ -9,7 +9,7 @@
|
||||
:toclevels: 6
|
||||
:toc-title:
|
||||
|
||||
The perfect emulation setup to study and develop the <<linux-kernel>> v5.0, kernel modules, <<qemu-buildroot-setup,QEMU>> and x86_64, ARMv7 and ARMv8 <<userland-assembly,userland>> and <<baremetal-setup,baremetal>> assembly. <<gdb>> and <<kgdb>> just work. Powered by <<about-the-qemu-buildroot-setup,Buildroot>> and <<about-the-baremetal-setup,crosstool-NG>>. Highly automated. Thoroughly documented. Automated <<test-this-repo,tests>>. "Tested" in an Ubuntu 18.04 host.
|
||||
The perfect emulation setup to study and develop the <<linux-kernel>> v5.0, kernel modules, <<qemu-buildroot-setup,QEMU>>, <<gem5-buildroot-setup,gem5>> and x86_64, ARMv7 and ARMv8 <<userland-assembly,userland>> and <<baremetal-setup,baremetal>> assembly. <<gdb>> and <<kgdb>> just work. Powered by <<about-the-qemu-buildroot-setup,Buildroot>> and <<about-the-baremetal-setup,crosstool-NG>>. Highly automated. Thoroughly documented. Automated <<test-this-repo,tests>>. "Tested" in an Ubuntu 18.04 host.
|
||||
|
||||
TL;DR: <<qemu-buildroot-setup-getting-started>>
|
||||
|
||||
@@ -373,7 +373,7 @@ Have you ever felt that a single `inc` instruction was not enough? Really? Me to
|
||||
|
||||
So let's hack the <<gnu-gas-assembler>>, which is part of link:https://en.wikipedia.org/wiki/GNU_Binutils[GNU Binutils], to add a new shiny version of `inc` called... `myinc`!
|
||||
|
||||
GCC uses GNU GAS as its backend, so we will test out new mnemonic with an inline assembly test program: link:userland/arch/x86_64/binutils_hack.c[], which is just a copy of link:userland/arch/x86_64/asm_hello.c[] but with `myinc` instead of `inc`.
|
||||
GCC uses GNU GAS as its backend, so we will test out new mnemonic with an <<gcc-inline-assembly>> test program: link:userland/arch/x86_64/binutils_hack.c[], which is just a copy of link:userland/arch/x86_64/asm_hello.c[] but with `myinc` instead of `inc`.
|
||||
|
||||
The inline assembly is disabled with an `#ifdef`, so first modify the source to enable that.
|
||||
|
||||
@@ -955,7 +955,7 @@ Notable userland content included / moving into this repository includes:
|
||||
* <<c>>
|
||||
* <<cpp>>
|
||||
* <<posix>>
|
||||
* https://github.com/cirosantilli/algorithm-cheat will be good to move here for performance analysis
|
||||
* https://github.com/cirosantilli/algorithm-cheat TODO will be good to move here for performance analysis <<gem5-run-benchmark,with gem5>>
|
||||
|
||||
==== Userland setup getting started
|
||||
|
||||
@@ -11685,7 +11685,7 @@ corresponding register field is interpreted as returning zero when read or disca
|
||||
When instructions do not interpret this operand encoding as the zero register, use of the name XZR is an error
|
||||
____
|
||||
|
||||
=== Assembly SIMD
|
||||
=== SIMD assembly
|
||||
|
||||
Much like ADD for non-SIMD, start learning SIMD instructions by looking at the integer and floating point SIMD ADD instructions of each ISA:
|
||||
|
||||
@@ -11980,7 +11980,7 @@ Some of the differences include:
|
||||
|
||||
When reading disassembly, many instructions have either a `.n` or `.w` suffix.
|
||||
|
||||
`.n` means narrow, and stands for the Thumb encoding of an instructions, while `.w` means wide and stands for the ARM encoding.
|
||||
`.n` means narrow, and stands for the <<arm-instruction-encodings,Thumb encoding>> of an instructions, while `.w` means wide and stands for the ARM encoding.
|
||||
|
||||
Bibliography: https://stackoverflow.com/questions/27147043/n-suffix-to-branch-instruction
|
||||
|
||||
@@ -12145,7 +12145,7 @@ Understanding the basics of instruction encodings is fundamental to help you to
|
||||
|
||||
aarch32 has two "instruction sets", which to look just like encodings.
|
||||
|
||||
Some control bit determines which one we are currently on, and userland can switch between them with the <<arm-bx-instruction>>.
|
||||
Some control bit must determine which one we are currently on, and userland can switch between them with the <<arm-bx-instruction>> TODO: details.
|
||||
|
||||
The encodings are:
|
||||
|
||||
@@ -12154,6 +12154,8 @@ The encodings are:
|
||||
+
|
||||
T stands for "Thumb", which is the original name for the technology. The word "Thumb" does not appear on <<armarm8>> however. It does appear on <<armarm7>> though.
|
||||
+
|
||||
Example: link:userland/arch/arm/thumb.S[]
|
||||
+
|
||||
See also: <<armarm8>> F2.1.3 "Instruction encodings".
|
||||
|
||||
Within each instruction set, there can be multiple encodings for a given function, and they are noted simply as:
|
||||
@@ -12188,7 +12190,10 @@ TODO: what to do if we want to jump longer than that?
|
||||
|
||||
Branch if equal based on the status registers.
|
||||
|
||||
Example: link:userland/arch/arm/beq.S[].
|
||||
Examples:
|
||||
|
||||
* link:userland/arch/arm/beq.S[].
|
||||
* link:userland/arch/aarch64/beq.S[].
|
||||
|
||||
The family of instructions includes:
|
||||
|
||||
@@ -12217,13 +12222,13 @@ The current ARM / Thumb mode is encoded in the least significant bit of lr.
|
||||
|
||||
Since `bl` encodes the current ARM / Thumb in the register, `bx` keeps the mode unchanged by default.
|
||||
|
||||
===== ARM ret instruction
|
||||
===== ARMv8 aarch64 ret instruction
|
||||
|
||||
Example: link:userland/arch/aarch64/ret.S[]
|
||||
|
||||
In ARMv8 aarch64:
|
||||
ARMv8 AArch64 only:
|
||||
|
||||
* there is no `bx` since no Thumb to worry about, so it is called just `br`
|
||||
* there is no `bx` in AArch64 since no Thumb to worry about, so it is called just `br`
|
||||
* the `ret` instruction was added in addition to `br`, with the following differences:
|
||||
** provides a hint that this is a function call return
|
||||
** has a default argument `x30` if none is given. This is where `bl` puts the return value.
|
||||
@@ -12388,8 +12393,6 @@ AArch64 loses those instructions, likely because it was not possible anymore to
|
||||
|
||||
Arithmetic:
|
||||
|
||||
* link:userland/arch/arm/add.S[]. We use this simple instruction to explain syntax common to most data processing instructions, so have a good look at that file.
|
||||
** link:userland/arch/aarch64/add.S[]
|
||||
* link:userland/arch/arm/mul.S[]: multiply
|
||||
* link:userland/arch/arm/sub.S[]: subtract
|
||||
* link:userland/arch/arm/rbit.S[]: reverse bit order
|
||||
@@ -12589,6 +12592,18 @@ Bibliography: https://stackoverflow.com/questions/1875491/nop-for-iphone-binarie
|
||||
|
||||
=== ARM SIMD
|
||||
|
||||
==== ARM fadd vs vadd
|
||||
|
||||
It is very confusing, but `fadds` and `faddd` in Aarch32 are <<gnu-gas-assembler-arm-unified-syntax,pre-UAL>> for `vadd.f32` and `vadd.f64`.
|
||||
|
||||
The same goes for most ARMv7 mnemonics: `f*` is old, and `v*` is the newer better syntax.
|
||||
|
||||
But then, in ARMv8, they decided to use `fadd` as the main floating point add name, and get rid of `vadd`!
|
||||
|
||||
Also keep in mind that fused multiply add is `fmadd`.
|
||||
|
||||
Examples at: <<simd-assembly>>
|
||||
|
||||
==== ARM SIMD instructions
|
||||
|
||||
===== ARM vcvt instruction
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#data-processing-instructions */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#userland-assembly */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#assembly-simd
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#simd-assembly
|
||||
*
|
||||
* Add a bunch of integers in one go.
|
||||
*/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#adr */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#arm-adr-instruction */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#adr */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#arm-adr-instruction */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#cbz */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#arm-beq-instruction */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#bfi */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#arm-bfi-instruction */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#inline-assembly-early-clobbers */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#gcc-inline-assembly-early-clobbers */
|
||||
|
||||
#include <assert.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Increment a variable in inline assembly.
|
||||
*
|
||||
* https://github.com/cirosantilli/linux-kernel-module-cheat#inline-assembly
|
||||
* https://github.com/cirosantilli/linux-kernel-module-cheat#gcc-inline-assembly
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#inline-assembly-floating-point-arm */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#gcc-inline-assembly-floating-point-arm */
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#inline-assembly-register-variables */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#gcc-inline-assembly-register-variables */
|
||||
|
||||
#include <assert.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#inline-assembly-register-variables */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#gcc-inline-assembly-register-variables */
|
||||
|
||||
#include <assert.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#cbz */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#arm-cbz-instruction */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#cset */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#arm-cset-instruction */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#assembly-simd
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#simd-assembly
|
||||
*
|
||||
* Add a bunch of floating point numbers in one go.
|
||||
*/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#gas-data-sizes */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#gnu-gas-assembler data sizes */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
/* MInimal sanity check of the C driver. */
|
||||
.text
|
||||
.global asm_main
|
||||
asm_main:
|
||||
asm_main_after_prologue:
|
||||
mov w0, 0
|
||||
ret
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#movk */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#armv8-aarch64-movk-instruction */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#movn */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#armv8-aarch64-movn-instruction */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#bl */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#armv8-aarch64-ret-instruction */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#simd-interleaving */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#arm-simd-interleaving */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#armv8-str */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#armv8-aarch64-str-instruction */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#ubfm */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#arm-ubfm-instruction */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#ubfx */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#arm-ubfx-instruction */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#x31 */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#armv8-aarch64-x31-register */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#data-processing-instructions */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#arm-data-processing-instructions */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#addressing-modes */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#arm-addressing-modes */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#adr */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#arm-adr-instruction */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Bitwise AND. */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#arm-bitwise-instructions */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#b */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#arm-b-instruction */
|
||||
|
||||
#include "common.h"
|
||||
ENTRY
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#beq */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#arm-beq-instruction */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#bfi */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#arm-bfi-instruction */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#bic */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#arm-bic-instruction */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#bl */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#arm-bl-instruction */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* 1 + 2 == 3
|
||||
*
|
||||
* https://github.com/cirosantilli/linux-kernel-module-cheat#inline-assembly
|
||||
* https://github.com/cirosantilli/linux-kernel-module-cheat#gcc-inline-assembly
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/* arm freestanding C inline assemby Linux hello world
|
||||
* https://github.com/cirosantilli/linux-kernel-module-cheat#linux-system-calls
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#linux-system-calls
|
||||
*
|
||||
* arm freestanding C inline assemby Linux hello world.
|
||||
*/
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Increment a variable in inline assembly.
|
||||
*
|
||||
* https://github.com/cirosantilli/linux-kernel-module-cheat#inline-assembly
|
||||
* https://github.com/cirosantilli/linux-kernel-module-cheat#gcc-inline-assembly
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#inline-assembly-floating-point-arm */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#gcc-inline-assembly-floating-point-arm */
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* ldr r0, [sp]
|
||||
* ....
|
||||
*
|
||||
* https://github.com/cirosantilli/linux-kernel-module-cheat#inline-assembly
|
||||
* https://github.com/cirosantilli/linux-kernel-module-cheat#gcc-inline-assembly
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* ldr r0, [r3]
|
||||
* ....
|
||||
*
|
||||
* https://github.com/cirosantilli/linux-kernel-module-cheat#inline-assembly
|
||||
* https://github.com/cirosantilli/linux-kernel-module-cheat#gcc-inline-assembly
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#inline-assembly-register-variables */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#gcc-inline-assembly-register-variables */
|
||||
|
||||
#include <assert.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#data-processing-instructions */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#data-bitwise-instructions */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#conditional-execution */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#arm-conditional-execution */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#gnu-gas-assembler data sizes */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
.data
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
/* Minimal example using driver.
|
||||
*
|
||||
* Controls the exit status of the program.
|
||||
*/
|
||||
|
||||
.syntax unified
|
||||
.text
|
||||
.global asm_main
|
||||
asm_main:
|
||||
asm_main_after_prologue:
|
||||
|
||||
/* Set the return value according to the ARM calling convention. */
|
||||
mov r0, 0
|
||||
|
||||
/* Try some whacky value to see tests break. */
|
||||
/*mov r0, 77*/
|
||||
|
||||
/* Branch to the address at register lr.
|
||||
* That is the return value which was put there by the C driver (likely with a bl).
|
||||
*
|
||||
* X means eXchange encoding from thumb back to ARM, which is what the driver uses.
|
||||
*/
|
||||
bx lr
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#gnu-gas-assembler-immediates */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#arm-gnu-instruction-gas-assembler-immediates */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#loop-over-array */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#arm-loop-instruction-over-array */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#loop-over-array */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#arm-loop-instruction-over-array */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#ldr-pseudo-instruction */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#arm-ldr-instruction-pseudo-instruction */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#ldrh-and-ldrb */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#arm-ldrh-instruction-and-ldrb */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#ldrh-and-ldrb */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#arm-ldrh-instruction-and-ldrb */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#mov */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#arm-mov-instruction */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#movw-and-movt */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#arm-movw-and-movt-instructions */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
/* Multiplication. */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#arm-data-processing-instructions
|
||||
*
|
||||
* Multiplication.
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#nop */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#arm-nop-instruction */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#ldmia */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#arm-ldmia-instruction */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#rbit */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#arm-data-processing-instructions
|
||||
*
|
||||
* Reverse bit order.
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#data-processing-instructions */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#data-processing-instructions
|
||||
*
|
||||
* Reverse byte order.
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#s-suffix */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#arm-s-suffix */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#shift-suffixes */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#arm-shift-suffixes */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
/* Subtraction. */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#arm-data-processing-instructions
|
||||
*
|
||||
* Subtraction.
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
/* Illustrates features that are only available in thumb. */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#arm-instruction-encodings
|
||||
*
|
||||
* Illustrates features that are only available in thumb.
|
||||
* TODO ensure that we are actually inside of thumb.
|
||||
*/
|
||||
|
||||
.syntax unified
|
||||
.text
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
/* Test. Same as ands, but don't store the result, just update flags. */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#arm-data-processing-instructions
|
||||
*
|
||||
* Test. Same as ands, but don't store the result, just update flags.
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#assembly-simd */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#arm-simd-instruction-assembly */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#vcvt */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#arm-vcvt-instruction */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#vcvta */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#arm-vcvta-instruction */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#vcvtrr */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#arm-vcvtrr-instruction */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#inline-assembly */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#gcc-inline-assembly */
|
||||
|
||||
#include <assert.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#inline-assembly */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#gcc-inline-assembly */
|
||||
|
||||
#include <assert.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#inline-assembly-scratch-registers */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#gcc-inline-assembly-scratch-registers */
|
||||
|
||||
#include <assert.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* This is a worse version of scratch.c with hardcoded scratch.
|
||||
* https://github.com/cirosantilli/linux-kernel-module-cheat#inline-assembly-scratch-registers
|
||||
* https://github.com/cirosantilli/linux-kernel-module-cheat#gcc-inline-assembly-scratch-registers
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#gas-data-sizes */
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#gnu-gas-assembler data sizes */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#assembly-simd
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#simd-assembly
|
||||
*
|
||||
* Add a bunch of integers in one go.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user