[Solved] How is shellcode generated from C? – With code example

[ad_1] The problem with creating shellcode from C programs is not that you cannot control the assembly generated, nor something related with the code generation. The problem with creating shellcode from C programs is symbols resolution or relocation, call it whatever you like. You approach, for what I have understand, is right, you are just … Read more

[Solved] Is it possible to create the low-level grapics API (similar to OpenGL)? [closed]

[ad_1] No, implementing something like OpenGL is not possible. Since the time OpenGL has decended from the heavens complete, writing something like it was forbidden by all common religions. But really, what you’ll actually need is about 21 years of work, a few thousands of developers and broad support from all industry leaders, so yea, … Read more

[Solved] How mingw32-g++ compiler know where to inject system calls in the WIN32 machine executable?

[ad_1] To quote the gcc manual: If no init section is available, when GCC compiles any function called main (or more accurately, any function designated as a program entry point by the language front end calling expand_main_function), it inserts a procedure call to __main as the first executable code after the function prologue. The __main … Read more

[Solved] Worst case memory access in 80×86 assembly

[ad_1] From memory, the instruction has an opcode byte (“add”), an address mode byte, an offset for x (4 bytes) and the constant (4 bytes) ==> 10 bytes. I assume the 486 fetches 4 bytes at a time from memory with a bus address aligned to 4 byte DWORD boundaries. So 10 bytes arguably takes … Read more

[Solved] How to declare local variables in macro asm of gas like decalaring it in macro asm with %local in macro asm of nasm or local in macro asm of masm?

[ad_1] gas is primarily intended as a compiler backend, not for human use. As such, it’s lacking some features, among others this one. You can of course try to make a macro to do this, something along these lines: .intel_syntax noprefix .globl main .macro local head, tail:vararg # assume dwords for simplicity .set localsize, localsize … Read more

[Solved] error c2400 found new line

[ad_1] I guess the thread will be soon on hold (“off topic”), so let me show quickly the corrected code: #include<stdio.h> int main (void) { char y = 10; char* format = “%d”; __asm { movzx eax, y add eax,1 push eax push format call printf add esp, 8 } return 0; } 1 [ad_2] … Read more

[Solved] Does AT&T syntax work on intel platform?

[ad_1] att vs intel syntax has been covered many times, here and other places. Assembly language is a language defined by the assembler, the particular program used to convert the ASCII assembly language into machine code for the particular target you are interested in. Unlike say a C or C++ compiler where there is a … Read more

[Solved] Data Structure of Class [closed]

[ad_1] The compiler assigns offsets to all members, and includes these in all load/store operations on members: struct foo { uint32_t bar; uint32_t baz; uint32_t get_baz() { return baz; } }; uint32_t get_baz_from_foo(foo *f) { return f->baz; } becomes (ARM assembler code used for simplicity): foo__get_baz: ; calling convention: this pointer in r3 ; load … Read more