Skip to main content
Filter by
Sorted by
Tagged with
1 vote
1 answer
69 views

I am struggling to get printf to work for me in NASM while linking to ucrt.dll, It works 0 problems when I link to msvcrt.dll for printf, but I am trying to practice with something a little newer. I ...
Charley Blecker's user avatar
Advice
0 votes
1 replies
71 views

While analyzing the Spectre vulnerability, I ran into a question about how branch prediction training works. My understanding is that the CPU accumulates prediction history for a specific conditional ...
Nikolay Isaev's user avatar
5 votes
1 answer
133 views

I am debugging a simple program that prints the string "Hello, world!" three times. In the information about the registers that the gdb program gives, with the command info register, appear ...
Arthur2e's user avatar
1 vote
0 answers
106 views

I am following an assembly tutorial where they use NASM. They manage to compare a register to a variable's address with cmp rcx, digitSpace, but how can I do the same with GAS? As you know this ...
mx14slh's user avatar
  • 37
2 votes
1 answer
223 views

I am working on a Linux x64 kernel exploitation CTF challenge. I have constructed a ROP chain to execute commit_creds(prepare_kernel_cred(0)). However, I am encountering a major inconsistency between ...
Curio's user avatar
  • 1,401
1 vote
0 answers
186 views

How could I get past it if the code is compiled as 64-bit? There’s no need to obtain a root shell; it’s sufficient to just verify that the address was guessed correctly. In my assignment, to bypass ...
강신호's user avatar
27 votes
2 answers
2k views

Consider this C (not C++!) code: int g(); int f() { return g(); } Clang (with any optimization level above zero) compiles this to: f: xor eax, eax jmp g@PLT I am trying ...
Brennan Vincent's user avatar
Advice
3 votes
5 replies
92 views

I'm looking for an assembly language manual for x86_64 architecture that uses the AT&T style. Is such manual available directly by AT&T? What I found was from [Oracle](https://docs.oracle.com/...
mltm's user avatar
  • 595
6 votes
1 answer
157 views

My code is ... fragment1 // compares several regions in D1$ to D1$/D3$ __atomic_fetch_add(&lock,-1,__ATOMIC_ACQ_REL); // stmt A fragment2 // moves several regions from D1$/D3$ to D1$ ...
Henry Rich's user avatar
Advice
0 votes
4 replies
225 views

Title: Why does GCC transform a >= 4 into a > 3 at -O0? JG seems more complex than JGE I'm analyzing a simple C code on godbolt and found GCC's code generation puzzling: long a; a = a >= 4; ...
Alexandr's user avatar
Best practices
1 vote
2 replies
108 views

My assembly program reads characters in a text file by loading them one by one in register 'al'. However I sometime need to use rax fully, and I think this causes a partial register stall. Now I think ...
Kun Xiang's user avatar
3 votes
2 answers
141 views

I am working on a small os with a custom boot loader targeting BIOS. For this, I need to map the kernel to its canonical high address space (0xFFFFFFFF80000000) and jump to its entry point. For this, ...
Holz's user avatar
  • 133
0 votes
0 answers
50 views

I have been customizing QGroundControl and have successfully built it for my Ubuntu system (x86_64 architecture) using Qt 6.8.3. I utilized the provided shell scripts and Dockerfiles located in the ...
user9262680's user avatar
Advice
1 vote
2 replies
165 views

I was curious and wondering how many registers are on an x64 processor. I know there are 16 general purpose registers available to the user, but there are supposedly general purpose alias registers ...
misInformationSpreader's user avatar
2 votes
1 answer
185 views

I am trying to call idiv r/m8 using MSVC2022's current Microsoft Visual C++ Compiler 17.4.33403.182 and C++. Using the most straightforward approach: struct cdiv_t { // char std::int8_t quot; ...
JohannesWilde's user avatar
2 votes
2 answers
150 views

Using CMAKE_BUILD_TYPE="Debug" my MSVC 2022 [17.4.33403.182] produced one idiv call for the quotient and an identical idiv call for the remainder. The code was simply [see here for the ...
JohannesWilde's user avatar
3 votes
1 answer
154 views

I'm experimenting with measuring CPU's instructions latency and throughput on P and E cores using RDPMC on Win 11, something like that: MOV ECX, 0x40000000 ; Instructions Counter RDPMC ; Read ...
Andrey Dmitriev's user avatar
-1 votes
1 answer
152 views

writing some simple assembly code, the program segfaults at the second call of subroutine _printint. This only happens if i remove push rdx and pop rdx from either the _printint subroutine or the ...
idkmanjustfixmycode's user avatar
2 votes
0 answers
80 views

I'm having trouble writing what should be a simple character counting program. Here's the file with the .data section, as given by the author of Learn to Program with Assembly, which I'm following (I ...
Andrew Boone's user avatar
2 votes
2 answers
129 views

I'm writing a little toy program to try to help myself better understand this language (AT&T syntax, x86_64 assembly language). Consider this code, if you'll be so kind: .section .data mystring: ....
Andrew Boone's user avatar
0 votes
1 answer
93 views

You all were kind enough to help me recently with understanding this language a bit better. I'm working on AT&T syntax x86_64 assembly language through an Apress book. The author gives this code, ...
Andrew Boone's user avatar
2 votes
0 answers
97 views

I am running simple Ping/Pong between two processes A, B with shared memory: shm_A and shm_B are in separate cache lines. Allocated with separate calls to shm_open, so probably in different pages, ...
Samuel Hapak's user avatar
  • 7,284
0 votes
0 answers
88 views

I'm making an assembly program that is supposed to get the mac address of the specified interface, however, when I try to assemble it, I get this error. gethwaddress.s:12: warning: multi-line macro `...
Virtual Wizard's user avatar
17 votes
3 answers
1k views

I'm reading a GNU as introductory book for programs running on top of an OS. I'm at the stack memory part and I was curious how the stack looks like in a freestanding environment. I'm guessing that ...
mltm's user avatar
  • 595
3 votes
4 answers
238 views

Novice here, with a frustratingly simple question. I'm trying to learn assembly and this has been a stumbling block for me for so long, I would really appreciate help with these concepts. Thanks so ...
Andrew Boone's user avatar
-4 votes
1 answer
106 views

im following a udemy course on making an operating system from scratch, but i have run into a very bizarre error: Makefile: DISK = os.img KERNEL = kernel.bin BOOTSECTOR = bootsector NASM = nasm QEMU =...
AutisticCoder's user avatar
2 votes
0 answers
85 views

I try to code the transition from protected mode to IA-32e mode. It's a task in college. The problem that I can't debug 32 bit bootloader. I can only run QEMU and tell based on its output whether this ...
chav1s's user avatar
  • 41
1 vote
2 answers
232 views

I have written a very basic int main program as shown below: #include <stdio.h> #include <windows.h> int main(int argc, char** argv) { char buffer[500]; strcpy(buffer, argv[1]); ...
blogger13's user avatar
  • 305
4 votes
0 answers
154 views

I am executing shell-code in executable stack memory: xor rax,rax ; push rax ; mov rbx,0x68732f2f6e69622f ; push rbx mov rdi,rsp ; ...
Joshua Singla's user avatar
1 vote
0 answers
89 views

So, this piece of C++ code: /* * Compile on 64-bit Linux or Solaris (I guess it will probably also work on * FreeBSD), like this: * g++ -o bin2dec bin2dec.cpp -std=c++11 #Don't put -O3 * here, as ...
FlatAssembler's user avatar
5 votes
1 answer
148 views

On x86-64, the syscall instruction causes a privilege-level change from user mode to kernel mode. According to the Intel manual (Vol. 2A, SYSCALL—Fast System Call), during execution: CS is loaded ...
klezki's user avatar
  • 197
0 votes
1 answer
79 views

I have code that is comparing a keyboard input which will be a number/ integer. However when I test it, it doesn't jmp if equal. I am not sure what value it is tested against. For example I have tried ...
Robert Imber's user avatar
0 votes
0 answers
109 views

I've been given an assignment to store and write out a user-inputted string stored in buffer. My professor said that the number of bytes read is stored in rax after the user inputs the string into ...
Anthony's user avatar
1 vote
0 answers
118 views

I don't seem to be able to fix this dynamic linking error I am getting. I am on ARCH Linux, Garuda Mokka to be precise. This is how I compile my project: clang++ -v -lclang `llvm-config --cxxflags --...
Fi Li Ppo's user avatar
  • 310
7 votes
1 answer
228 views

I'm experimenting with the IMUL r64, r64 instruction on an Intel Xeon E5-1620 v3 (Haswell architecture, base clock 3.5 GHz, turbo boost up to 3.6 GHz, Hyper Threading is enabled). My test loop is ...
Andrey Dmitriev's user avatar
6 votes
2 answers
177 views

It has been my observation that compiling the same code using gcc 12.2.0 on both Raspberry Pi OS Bookworm aarch64 and Debian Bookworm x86_64, always results in a much smaller executable on the latter. ...
user avatar
10 votes
2 answers
124 views

I was going through the System V AMD64 ABI and couldn’t find a clear explanation for why the AL field (which tracks how many floating-point registers are used) is necessary. From my understanding, ...
OODAX's user avatar
  • 159
2 votes
2 answers
329 views

I am trying to port some code from linux to windows. I need to assemble a jump to an absolute address, using nasm, such that the same bytes will jump to the same address, no matter where the code is ...
pm100's user avatar
  • 50.7k
2 votes
0 answers
73 views

I see this in int-ll64.h when building for -m64 __extension__ typedef unsigned long long __u64; does this mean it's 128 bits instead of 64. The compiler certain complains that the definition of: ...
user3161924's user avatar
  • 2,567
4 votes
1 answer
185 views

Crashes when run on a Windows version and CPU that supports CET (verified on Win11 23H2, i7-1365U). Works fine on a CPU that doesn't support CET (verified on Win11 23H2, i7-10750H). Works fine ...
wmjdgla's user avatar
  • 602
8 votes
1 answer
211 views

I have a project that has to use GCC 14 which does not have #embed support. I attempted to simulate it as follows. namespace { namespace { extern "C" { extern std::...
Jeremy Richards's user avatar
29 votes
1 answer
4k views

I noticed that modern C compilers typically use push instructions to save caller-saved registers, rather than explicit mov + sub sequences. However, based on llvm-mca simulations, the mov approach ...
Moi5t's user avatar
  • 465
5 votes
1 answer
218 views

The goal is to guarantee that r10 and r11 are set to certain values before a call to an assembly function: template<typename Args...> int wrapper(int val1, int val2, Args... args) { // somehow ...
 sentientbottleofwine's user avatar
5 votes
1 answer
281 views

I mainly use clang, but I have also explored other compilers during my experiments, such as MinGW GCC and MSVC, but they all have this problem. E:\code\test>clang -v clang version 20.1.7 Target: ...
Moi5t's user avatar
  • 465
10 votes
3 answers
1k views

I mainly use Clang, but I have also explored other compilers during my experiments, such as MinGW GCC and MSVC, but they all have this problem. cd C:\Users\Moi5t clang -v Output: clang version 20.1.7 ...
Moi5t's user avatar
  • 465
1 vote
1 answer
182 views

The following code attempts to create a simple stackful coroutine. It allocates a stack frame in the heap space by setting the rsp register and then calling a function. Afterwards, it exits the ...
algae's user avatar
  • 151
1 vote
0 answers
106 views

Some context behind the question. I tried writing a simple exit call like this .data .equ EXIT, 60 .equ STATUS, 0 .text movq EXIT, %rax movq STATUS, %rdi syscall however the code fails with a ...
Benjamin Floyd's user avatar
0 votes
1 answer
78 views

I have assembly code that appears to be working however when exe is run the window does not appear. I have Windows 11, 64-bit, x64 based processor Assembler: NASM ; Linker: GoLink I have essentially ...
Dave's user avatar
  • 76
-1 votes
0 answers
36 views

Why are two messages being printed together before user input in my x86_64 Assembly program? I'm just starting to learn x86_64 Assembly on Linux, and I'm working on a simple program that should: ...
d4v1l44's user avatar
1 vote
0 answers
70 views

The following is my SASM x86-64 code: section .data promptInput db "Enter two doubles: ", 10, 0 scanformat db "%lf", 0 printOpeOne db "OperandOne: %lf", 10, 0 ...
VVV's user avatar
  • 11

1
2 3 4 5
149