일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
- thread local storage
- Injection
- linux debugging
- pinpoint
- OSR
- apm
- TLS
- on stack replacement
- v8 optimizing
- pthread
- tracerpid
- android inject
- linux thread
- custom packer
- v8 tracing
- initial-exec
- Linux custom packer
- so inject
- LLVM
- anti debugging
- 난독화
- Obfuscator
- tracing
- uftrace
- on-stack replacement
- Linux packer
- 안티디버깅
- LLVM Obfuscator
- Android
- LLVM 난독화
- Today
- Total
Why should I know this?
ARM Instruction] UBFM, UBFX, UBFIZ, LSR, LSL 본문
UBFM
Syntax
UBFM Wd, Wn, #<immr>, #<imms> ; 32-bit general registers
UBFM Xd, Xn, #<immr>, #<imms> ; 64-bit general registers
Usage
Unsigned Bitfield Move copies any number of low-order bits from a source register into the same number of adjacent bits at any position in the destination register, with zeros in the upper and lower bits.
Important!
UBFM is an instruction that copies by specifying a memory range and can be Translate to UBFX, UBFIZ, LSR, or LSL depending on the range of immr and imms values.
1. imms >= immr
BMFM Translate to UBFX
UBFX
Unsigned Bitfield Extract.
This instruction is an alias of UBFM.
The equivalent instruction is UBFM Wd, Wn, #lsb, #(lsb+width-1).
Syntax
UBFX Wd, Wn, #lsb, #width ; 32-bit general registers
UBFX Xd, Xn, #lsb, #width ; 64-bit general registers
Usage
Unsigned Bitfield Extract extracts any number of adjacent bits at any position from a register, zero-extends them to the size of the register, and writes the result to the destination register.
Specially when imms equals with RegSize then UBFM can be translate to LSR
They are functionally identical.
Example)
2. imms < immr
BMFM Translate to UBFIX
UBFIZ
Unsigned Bitfield Insert in Zero.
This instruction is an alias of UBFM.
The equivalent instruction is UBFM Wd, Wn, #(-lsb MOD 32), #(width-1).
Syntax
UBFIZ Wd, Wn, #lsb, #width ; 32-bit general registers
UBFIZ Xd, Xn, #lsb, #width ; 64-bit general registers
Usage
Unsigned Bitfield Insert in Zero zeros the destination register and copies any number of contiguous bits from a source register into any position in the destination register.
Specially when immr-imms equals with -1 then UBFM can be translate to LSL
They are functionally identical.
example)
SUMMARY
immr >= imms,
it is translated with `UBFX` because it is better to index memory from the bottom.
lsb := immr
width := imms - immr
CopiedValue := M[lsb+width-1 : lsb]
immr < imms
it is translated with `UBFIZ` because it is better to index from the top of the memory.
lsb := RegSize - immr
width = imms + 1
CopiedValue := M[lsb : lsb-width-1]
'LLVM-STUDY > BACKEND' 카테고리의 다른 글
[AArch64] Generate stp for complex repeating constansts#514 (0) | 2024.03.21 |
---|---|
Backend 주요 로직 모음 (0) | 2024.03.19 |