Skip to content

Commit

Permalink
Commit start of new GNU-AS based ASM stubs to prepare for AARCH64 sup…
Browse files Browse the repository at this point in the history
…port
  • Loading branch information
realoriginal committed Mar 18, 2024
1 parent dd88635 commit 6001541
Show file tree
Hide file tree
Showing 10 changed files with 127 additions and 204 deletions.
8 changes: 2 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,8 @@ REPLACE_OBF_STRA_MAKE := 's/OBF_STRA_MAKE(\([^)]*\))/\$(REPLACE_FIX){ obf_stra_m
REPLACE_OBF_STRW_MAKE := 's/OBF_STRW_MAKE(\([^)]*\))/\$(REPLACE_FIX){ obf_strw_make( \1 ) }/g'

all: $(SOURCE)
@ nasm -f win64 asm/x64/GetIp.asm -o bin/GetIp.x64.o
@ nasm -f win64 asm/x64/Start.asm -o bin/Start.x64.o
@ nasm -f win32 asm/x86/GetIp.asm -o bin/GetIp.x86.o
@ nasm -f win32 asm/x86/Start.asm -o bin/Start.x86.o
@ $(CC_X64) bin/Start.x64.o bin/GetIp.x64.o bin/*.c crt/*.c -I. $(CFLAGS) $(LFLAGS) -o bin/$(OUTX64)
@ $(CC_X86) bin/Start.x86.o bin/GetIp.x86.o bin/*.c crt/*.c -I. $(CFLAGS) $(LFLAGS) -o bin/$(OUTX86)
@ $(CC_X64) asm/x64/Start.s bin/*.c crt/*.c asm/x64/GetIp.s -I. $(CFLAGS) $(LFLAGS) -o bin/$(OUTX64)
@ $(CC_X86) asm/x86/Start.s bin/*.c crt/*.c asm/x86/GetIp.s -I. $(CFLAGS) $(LFLAGS) -o bin/$(OUTX86)
@ python3 scripts/extract.py -f bin/$(OUTX64) -o $(SHLX64)
@ python3 scripts/extract.py -f bin/$(OUTX86) -o $(SHLX86)

Expand Down
30 changes: 0 additions & 30 deletions Pipe.c

This file was deleted.

42 changes: 0 additions & 42 deletions asm/x64/GetIp.asm

This file was deleted.

31 changes: 31 additions & 0 deletions asm/x64/GetIp.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//
// GRIMREAPER
//
// Austin Hudson
//
// suspicious.actor
//

// Section for our code
.section .text$C, "xr"

// Exported symbol name
.globl GetIp

GetIp:
// execute the next instruction
call _next_instruction

_next_instruction:
// pop the return address off the stack
popq %rax

// subtract the difference between the two labels
subq $(_next_instruction - GetIp), %rax

// return the pointer
ret

Leave:
// Marker
.string "ENDOFCODE"
43 changes: 0 additions & 43 deletions asm/x64/Start.asm

This file was deleted.

33 changes: 33 additions & 0 deletions asm/x64/Start.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//
// GRIMREAPER
//
// Austin Hudson
//
// suspicious.actor
//

// Section for our code
.section .text$A, "xr"

// Exported symbol name
.globl Start

// Imported symbol name
.extern Entry

Start:
// Setup the stack
pushq %rsi
movq %rsp, %rsi
andq $-16, %rsp

// Execute the entrypoint
subq $32, %rsp
call Entry

// Cleanup the stack
movq %rsi, %rsp
popq %rsi

// Return
ret
42 changes: 0 additions & 42 deletions asm/x86/GetIp.asm

This file was deleted.

30 changes: 30 additions & 0 deletions asm/x86/GetIp.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// GRIMREAPER
//
// Austin Hudson
//
// suspicious.actor
//

// Section for our code
.section .text$C, "xr"

// Exported symbol name
.globl _GetIp

_GetIp:
// execute the next instruction
call __next_instruction

__next_instruction:
// pop the return address off the stack
popl %eax

// subtract the difference between the two labels
subl $(__next_instruction - _GetIp), %eax

// return the pointer
ret

_Leave:
.string "ENDOFCODE"
41 changes: 0 additions & 41 deletions asm/x86/Start.asm

This file was deleted.

31 changes: 31 additions & 0 deletions asm/x86/Start.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//
// GRIMREAPER
//
// Austin Hudson
//
// suspicious.actor
//

// Section for our code
.section .text$A, "xr"

// Exported symbol name
.globl _Start

// Imported symbol name
.extern _Entry@0

_Start:
// Setup the stack
pushl %ebp
movl %esp, %ebp

// Execute the entrypoint
call _Entry@0

// Cleanup the stack
movl %ebp, %esp
popl %ebp

// Return
ret

0 comments on commit 6001541

Please sign in to comment.