initial commit

This commit is contained in:
gaailiunas committed 2025-07-25 19:35:34 +03:00
commit f38b4e28b3
5 files changed
+45

No files matched your search

+1
View File
@@ -0,0 +1 @@
build/
+6
View File
@@ -0,0 +1,6 @@
cmake_minimum_required(VERSION 3.10)
project(disasm)
add_executable(disasm
src/main.c
src/disasm.c
)
+5
View File
@@ -0,0 +1,5 @@
#include "disasm.h"
void disasm(const unsigned char *instructions, size_t len)
{
}
+8
View File
@@ -0,0 +1,8 @@
#ifndef DISASM_H
#define DISASM_H
#include <stddef.h>
void disasm(const unsigned char *instructions, size_t len);
#endif // DISASM_H
+25
View File
@@ -0,0 +1,25 @@
#include <stdio.h>
#include "disasm.h"
int main(void)
{
const unsigned char instructions[] = {
0x55, // push rbp
0x48, 0x89, 0xe5, // mov rbp, rsp
0x48, 0x83, 0xec, 0x10, // sub rsp, 0x10
0xe8, 0xe8, 0xff, 0xff, 0xff, // call 1139
0x89, 0x45, 0xfc, // mov [rbp-0x4], eax
0x8b, 0x45, 0xfc, // mov eax, [rbp-0x4]
0x48, 0x8d, 0x15, 0xa6, 0x0e, 0x00, 0x00, // lea rdx, [rip+0xea6]
0x89, 0xc6, // mov esi, eax
0x48, 0x89, 0xd7, // mov rdi, rdx
0xb8, 0x00, 0x00, 0x00, 0x00, // mov eax, 0x0
0xe8, 0xc3, 0xfe, 0xff, 0xff, // call 1030
0xb8, 0x00, 0x00, 0x00, 0x00, // mov eax, 0x0
0xc9, // leave
0xc3 // ret
};
disasm(instructions, sizeof(instructions));
return 0;
}