Skip to content

Commit e460cb8

Browse files
committed
shellblocks: src: Add utils_asm header for assembly primitives
1 parent 9e93820 commit e460cb8

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

shellblocks/src/utils_asm.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#ifndef SHELLCODE_BLOCKS_UTILS_ASM_H
2+
#define SHELLCODE_BLOCKS_UTILS_ASM_H
3+
4+
#define GET_PC(dst) \
5+
bal get_ip_reference; \
6+
nop; \
7+
get_ip_reference: \
8+
move dst, $ra
9+
10+
#define GET_ADDRESS(dst, label, base) \
11+
move dst, base; \
12+
addiu dst, (label - get_ip_reference)
13+
14+
#endif // !SHELLCODE_BLOCKS_UTILS_ASM_H

0 commit comments

Comments
 (0)