mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
26 lines
555 B
ArmAsm
26 lines
555 B
ArmAsm
/* https://github.com/cirosantilli/linux-kernel-module-cheat#gnu-gas-assembler-char-literals */
|
|
|
|
#include <lkmc.h>
|
|
|
|
LKMC_PROLOGUE
|
|
mov $0, %r12
|
|
|
|
/* Memory. */
|
|
mov mychar, %r12b
|
|
LKMC_ASSERT_EQ(%r12, $0x61)
|
|
|
|
/* Immediate. Without the `$`, does a memory access, and segfaults! */
|
|
mov $'b, %r12b
|
|
LKMC_ASSERT_EQ(%r12, $0x62)
|
|
|
|
/* Space character works. */
|
|
mov $' , %r12b
|
|
LKMC_ASSERT_EQ(%r12, $0x20)
|
|
|
|
/* Backslash escapes work. */
|
|
mov $'\n , %r12b
|
|
LKMC_ASSERT_EQ(%r12, $0x0A)
|
|
LKMC_EPILOGUE
|
|
mychar:
|
|
.byte 'a
|