Category "assembly"

Decoding PHP obfuscated payload

Recently I found a malicious PHP payload on my company's server. The code seems to be encoded into two strings claster and x64. The claster string decodes to th

Why doesn't instruction opcode 0xBB exists? [duplicate]

I'm currently writing a virtual machine and I've realised that 0xBB is not a valid instruction when it should be. I tried using shellstorm wit

In Assembler AT&T context: What does movl do in this specified line?

i have a some simple lines of code in C and wanted to disassemble it: #include <stdio.h> int main(){ int i=42; } After compiling it and starting gdb, i

Assembly: Modify a odd number generator into a prime number generator

I have written a PROC to find all odd numbers. I want to transition the existing code into a prime number generator. The intent of the entire program is to take

is the register the only place the where arithmetic calculation operand come from? [duplicate]

(1) I wonder if the is register the only place the arithmetic calculation can happen? It looks like: add BYTE PTR [var], 10 — add 10 to

Including C headers from assembly

I've been writing assembly on linux for a while and I often find myself in need of including C headers which contain macro, enum and struct definitions (but cle

masm directive option prologue:none has no effect

I'm learning how to use masm using MS's official docs, but there's almost nothing written on the option directive (https://docs.microsoft.com/en-us/cpp/assemble

How to increment %eax register and output in a c callable function?

#include <stdio.h> extern int count(char *string, char c); int main(void) { char s[100]; char c; printf("Enter a string of characters:\n"); scanf

mold and lld not linking against libc correctly

I've been writing some x64 assembly on linux - exactly what it is is not relevant - and I've come across a strange problem. In my assembly code, I've declared p

What is the Program Segment Prefix (PSP)?

What exactly is Program Segment Prefix (PSP)? I searched in Google but couldn't find any clean and straight answers to help me completely understand it. What d

Most insanely fastest way to convert 9 char digits into an int or unsigned int

#include <stdio.h> #include <iostream> #include <string> #include <chrono> #include <memory> #include <cstdlib> #include <

x86 Assembly Question - Can anyone determine what is happening below?

I downloaded a modification for a 20+ year old game I play, which is written in assembly code. It adds a fog effect, and then varies the grip levels based on th

Why is calling snprintf() so slow?

Our internal program is written in C and makes extensive use of snprintf() for many pieces, and I noticed that during debugging with perf record/report, it's sp

Compile and run assembly on macbook

I'm taking a course on computer structure and I'm lost. I was given the following file: Hello.s: #This is a simple "Hello World!" program .section .rodat

How Do I Convert This ATT assembly to Intel Syntax? Jump to a non-relative address without using registers

I was reading this article " assembly-challenge-jump-to-a-non-relative-address-without-using-registers ". I need to do exactly what he suggests here (Jump to a

Break down the logic for a C for-loop into something I can implement in MIPS? (count number occurrences in an array)

Hi all i am converting my C code to MIPS but problem is here i couldn't make correct logic for this for (int i=0;i<count;i++) { h[a[i]]++; } as

How I can include .asm file properly?

When studying assembler at the university, I encountered the following problem: I have 3 files (all of them oversimplified, they were much bigger): main.asm .58

How to switch from 32-bit to PAE paging directly?

I'm developing a microkernel for my personal research. I have chosen to run my kernel at 0xf0000000, leaving 3.75 GiB for user space programs. When my kernel st

How can I call a rust function in rust inline asm module

I try to call my function just like the example code: use std::arch::asm; extern "C" fn foo(arg: i32) -> i32 { println!("arg = {}", arg); arg * 2 }

How does the EBP register get saved?

I couldn't find much information or specification that suits me, so I have no choice but to ask here. When we call some function with the call instruction and t