Questions tagged [x86]

x86 is an architecture derived from the Intel 8086 CPU. The x86 family includes the 32-bit IA-32 and 64-bit x86-64 architectures, as well as legacy 16-bit architectures. Questions about the latter should be tagged [x86-16] and/or [emu8086]. Use the [x86-64] tag if your question is specific to 64-bit x86-64. For the x86 FPU, use the tag [x87]. For SSE1/2/3/4 / AVX* also use [sse], and any of [avx] / [avx2] / [avx512] that apply

x86
Filter by
Sorted by
Tagged with
2 votes
2 answers
183 views

what does the _mm_mfence() function do

Looking into the Intel Intrinsics documentation, the synopsis for _mm_mfence is as follows Perform a serializing operation on all load-from-memory and store-to-memory instructions that were issued ...
koiboi's user avatar
  • 133
2 votes
1 answer
188 views

osdev - VGA in protected mode initializing weirdly

So, I have been trying to make a simple OS, that enters mode 13h (using my previously used code that should work on protected mode (it atleast did on my previous OS using grub as bootloader) The code ...
Stigl's user avatar
  • 51
0 votes
0 answers
38 views

How do I print characters to the console while inputting in x86 assembly with irvine

I am required to write a login function that takes username and password and checks it for validity. The problem is I want to display the * character on the console when the user enters the password ...
Mark's user avatar
  • 1
0 votes
1 answer
60 views

At what memory address is local variable arg2 stored?

I am working on a procedure call problem with this code where initially %ebp = 0x800060, and %esp = 0x800040. I'm trying to find what memory address arg2 is stored at. C Code: int caller() { int ...
kornbot's user avatar
  • 15
0 votes
0 answers
40 views

Writing interrupt-driven I/O in C on COM1, output interrupts are triggering just fine but keyboard input never triggers an interrupt. Why?

I'm working with simple operating system concepts, and currently working on writing a simple interrupt-driven serial driver in C. I have serial writing down, triggering interrupts when it's supposed ...
mlb0066's user avatar
  • 11
0 votes
0 answers
46 views

Assembly, accessing bytes in eax [duplicate]

How can I adress a specific byte in eax. I know that I can access byte 0 and 1 via ah and al but how can I access byte 2 and 3?
Marlon Müller's user avatar
2 votes
1 answer
101 views

WinDBG under VMware Workstation Pro 16.2.3 zeros x87 FPUInstructionPointer when single-stepping

Objective I am learning exploit development and one of the topics is on writing shellcode. Typically, msfvenom would do the job well with shikata ga nai encoding. The shellcode generated will also ...
balapoopi's user avatar
2 votes
1 answer
98 views

Overwriting segfaulting instructions with NOPs doesn't fix segfault in gdb

I thought it would be cool to add a command to gdb that will look at the instruction pointer and overwrite the current instruction with NOPs. The idea being that if you are debugging, and your program ...
Joseph Garvin's user avatar
1 vote
1 answer
88 views

Is there a way to make GDB disassemble all memory in a specific range, without regard for instruction boundaries?

x/16i 0xdeadbeef yields: 0x80481be <_init+22>: shlb $0x3a,-0x18(%ebp,%eax,1) 0x80481c3 <_init+27>: jle 0x80481c0 <_init+24> 0x80481c5 <_init+29>: .byte ...
brunge's user avatar
  • 13
0 votes
0 answers
43 views

Secugen FingerPrint Windows .NET Exception

Im using Secugen Fingerprint U20 model, and develop a .NET desktop application, we use “Secugen.FDxSDKPro.Windows dll (ver 1.0.0)” in our application, but sometimes we cannot verify fingerprint and ...
orcunor's user avatar
  • 61
3 votes
1 answer
93 views

Why does using the %ebx register cause a segmentation fault in my assembly code

I'm working on a small piece of i386 assembly code and encountered a segmentation fault when using the %ebx register. I would appreciate some insights into why this is happening. I have two versions ...
Seizh7's user avatar
  • 31
1 vote
0 answers
50 views

Cannot import tensorflow module and libtensorflow.so on linux x86

I have a python code using tensorflow and also calling a C++ dll which need tensorflow dll. The python run fine when I call only import tensorflow as tf, it also run fine when calling tensorflowdll = ...
Nathan's user avatar
  • 21
0 votes
0 answers
68 views

how to get contents of textbox in masm

I am trying to create a simple desktop application in masm, which swaps the text of two textboxes when a button is pressed. So far I have been able to create the application window, text entry boxes ...
ChinchBug's user avatar
0 votes
1 answer
109 views

Which one performs better: load(memory_order_seq_cst) or atomic_fetch_add(0, memory_order_relaxed) on X86?

Question 1: I have a variable primarily used for counting, only concerned with its own value. Which of the following two approaches has better performance? Approach 1: Read: aaa.fetch_add(0, ...
likecpp's user avatar
  • 21
0 votes
0 answers
83 views

x86 Performance difference between Shift and Add when packing bits?

Originally I was benchmarking some C code that looked something like: #include <stdio.h> #include <inttypes.h> #include <time.h> #define NANOSEC_PER_SEC 1000000000LL static inline ...
Will Ayd's user avatar
  • 6,953
1 vote
0 answers
101 views

C to assembly issue , I do not know why my function is not working and I always get 0xFFFFFFFE 0x0000000C

I need to "translate " the function ChangeVector to assembly without using variables (I have to use for example push ebp..mov ebp, esp ... but my problem is that the original code works ...
Leah M's user avatar
  • 31
0 votes
2 answers
135 views

I am stuck on solving the segmentation fault on the Nasm asm code for bits 32

I am green with the asm programming. I have been trying to solve some tasks as way of learning. two of the tasks run well but two are failing with segmentation fault. I have gone through a lot of ...
Code In's user avatar
  • 11
0 votes
0 answers
57 views

Understanding fcmovb instruction in x86

I'm not understanding why fcmovb st(0) st(4) is not acting the way I expect. afaiu it will set st0 = st4 if the CF flag is set. Before: gdb> i r eflags st0 st4 eflags 0x282 [ SF IF ] st0 0 (raw ...
bogardon's user avatar
  • 915
1 vote
3 answers
147 views

Why the compiler doesn't simply move data from edi to eax in unoptimized debug builds?

I was observing the assembly created for the following function here. int square(int num) { return num; } This is the assembly generated for the function above: square: push rbp ...
Amir reza Riahi's user avatar
2 votes
1 answer
89 views

The overhead-free monitor codes in the AMD CPU significantly increases the total synchronization duration

I am conducting a test to measure the message synchronization latency between different cores of a CPU. Specifically, I am measuring how many clock cycles it takes for CPU2 to detect changes in the ...
foool's user avatar
  • 1,512
1 vote
0 answers
67 views

Crash when enabling Interrupts while using an Interrupt Descriptor Table

My qemu emulation just crashes after running init_idt() and then enable_interrupts(). I cant find the error, did i setup the IDT wrong or am i missing something. I am in 32bit protected mode on a x86 ...
Endrix's user avatar
  • 31
3 votes
0 answers
88 views

Why is the "mov" with complex addressing faster than the corresponding "lea"? [duplicate]

I looked up in the instruction tables and found that in Coffee Lake, the RThroughput of the lea with 3 components is 1. I think it’s very slow, so I guessed that the RThroughput of the mov with ...
platelet's user avatar
  • 175
3 votes
1 answer
119 views

Stack alignment when using SIMD instructions

In the book about assembly that I am reading, we are told for any function we write, if it's a branching function and will call other functions, it must maintain stack alignment. This is done so that ...
Tim's user avatar
  • 145
2 votes
1 answer
97 views

NASM ways to create symbols local to a function and how they behave in case of recursion

From what I have learned, I could very well be wrong, to have local variables for a function in NASM we can either: Use an offset with the function's base pointer and space on the stack to act as ...
Tim's user avatar
  • 145
0 votes
0 answers
113 views

Why does accessing an initialised array cause a segfault?

I'm making a compiler for brainfuck and I've made the ELF header and 2 program headers, the relevant header is this: Program_Header dataHeader = { 1, ...
Been's user avatar
  • 9
-2 votes
1 answer
84 views

Moving from friendly UI (Emu8086) to real x86 assembly

I am a expert of the emu8086 emulator assembly (this is what we are taught in university) but obviously the emu8086 emulator is NOT real assembly language and im trying to learn the x86 Assembly ...
Root Groves's user avatar
0 votes
0 answers
31 views

Assembly x86 Linux Not Reading User Input For One Specific Part

The initial syscall to read user input is working perfectly fine, but for some reason when I call for a second read later in the code, it doesn't work properly. It just terminates the program before ...
Ghosttxii's user avatar
2 votes
1 answer
515 views

'https://deb.nodesource.com/node_20.x nodistro InRelease' doesn't support architecture 'i386'

I install nodejs using NodeSource repository, I followed instruction mention on deb.nodesource.com (on home page), after installing whenever I am running sudo apt update I am getting this warning at ...
Nitin C's user avatar
  • 23
2 votes
0 answers
288 views

How does Linux with CONFIG_NO_HZ_FULL=y update the system clock

I'm trying to understand how timekeeping works in the Linux kernel, specifically how the system clock is updated. I'm running kernel v6.5 with these configurations from /proc/config.gz # # Timers ...
Olmarq's user avatar
  • 21
1 vote
0 answers
59 views

What is the difference between ISR registered via the IDT and an "IRQ line" regsitered using `request_irq()`?

The kernel code suggests "IRQ vector layout" never changes, but offers a function called request_irq() which supposedly adds an "IRQ line". What is IRQ line in this context? What ...
ashidc's user avatar
  • 41
0 votes
0 answers
57 views

Assembly: cause of segmentation fault

I'm very new to assembly language, so i don't have that much knowledge. I was just trying to read some message from user, then output "Hello, World!\n" and then output message that user ...
cMard's user avatar
  • 1
4 votes
1 answer
100 views

Can modern x86 CPUs do ideal out of order execution?

My mental model for out of order execution is to think of it as like a sliding window on the instruction stream, where if there are any instructions in the window that are ready (their inputs have ...
Joseph Garvin's user avatar
0 votes
0 answers
38 views

Exception thrown at 0x001036CA in 14423 Lab 05 COAL.exe: 0xC0000005: Access violation reading location 0x000FFFFE

INCLUDE Irvine32.inc .data Message BYTE "Enter Number ",0 Arr DWORD 5 DUP(0) Divi DWORD 4 GreaterNum DWORD 0 Outerloopholder DWORD 0 .code main PROC mov ecx, 1 ...
Shareef Mughal's user avatar
4 votes
1 answer
113 views

How much of this is needed to read ticks from the BIOS (8086)?

I have the following function (C with assembly) that reads BIOS ticks: static clock_t clock(void); #pragma aux clock = \ "pushf" \ "push ds" \ "cli" \ "mov ax, ...
Benjamin Penney's user avatar
0 votes
0 answers
51 views

Trying to run MASM code for a few different operations to run, but Keep getting the error A2074 cannot access label through segment register

This is my assignment: make sure you installed MASM correctly and that you can run/debug your simple assembly language. Run the following calculations using MASM and assign the result to the same or ...
Fraz Naqvi's user avatar
6 votes
0 answers
233 views

How reproducible are floating point CPU operations on x86-64?

Note: this question is about CPU instructions, not high-level languages (where you are at the mercy of the compiler) From a popular answer: The same floating-point operations, run on the same ...
MWB's user avatar
  • 12k
1 vote
1 answer
59 views

How to show symbol with 16h BIOS

This program has to get and show the symbol. But instead I have this strange array of strange symbols org 100h org 100h section .text _start: mov ah, 0 int 16h mov [...
Bimbowka's user avatar
3 votes
0 answers
152 views

Is there a mask-and-compare instruction for the x86_64 architecture?

Implementations of programming languages that need to preserve type information at runtime often use some bits of an integer value as tagging bits. A typical expression in the C programming language ...
Marc's user avatar
  • 4,447
0 votes
0 answers
84 views

Segmentation fault with CR2 from kernel and RIP in userspace

I have a few segfaults with a similar state on Linux x86_64: [pid 35742] [time 1699532462] signal caught: Segmentation fault si_signo: 11 si_code: SEGV_MAPERR si_errno: 0 si_pid: ...
user1641854's user avatar
0 votes
0 answers
58 views

x86 cdecl calling convention, why bother cleaning the stack?

This wikipedia page shows an example assembly code of a caller-clean up convention, where the caller cleans the arguments from the stack. Note: I've removed the provided comments and added my own int ...
qwerty_url's user avatar
0 votes
0 answers
124 views

Different behaviour of double to integer in different architectures and unit tests [duplicate]

I'm trying to understand how to avoid a different behaviour on different archs when working with double precision math and using integers as a way to "trunc/round" them... Here is a minimal ...
gabry's user avatar
  • 1,390
2 votes
1 answer
140 views

x86 - Switching from 32-bit to 64-bit via RETF

I was looking at some anti-disassembler techniques and came across the following snippet: push 0x33 call $+5 add [esp+0x10+var_10], 5 retf ; next instruction here So in a nutshell, this would ...
IRP_HANDLER's user avatar
0 votes
0 answers
101 views

How to interpret particularities of Intel x86 assembly?

Consider this simple piece of C code: #include <stdio.h> int add(int a, int b) { return a + b; } int main() { int var = 6; int var2 = 5; int var3 = add(var, var2); return ...
DocDriven's user avatar
  • 3,874
2 votes
1 answer
374 views

How to differentiate between Intel CPU generations in C++ at runtime?

SIMD has had an initialisation cost on Intel CPUs in the past. Because of this, I am looking for a way to distinguish at runtime in C++ which generation of Intel CPU is running my program. Is there a ...
Norgannon's user avatar
  • 519
0 votes
0 answers
57 views

instruction pointer in near jump 8086

how the result of IP=5 is reached ? shouldn't we add IP(new)=IP(current)+disp = 002+ 002=04 or does the new IP is calculated after the jump instructions end (start of next ) IP(new)=IP(next ...
Hussien Mostafa Elkholy's user avatar
2 votes
1 answer
97 views

x86 assembly 64-bit values with 32-bit program

If we multiply two very large 32-bit values the result can end up in registers EDX and EAX, with EDX holding the higher bits. How do we perform operations on these 64-bit values and print them to the ...
Tim's user avatar
  • 145
1 vote
0 answers
22 views

How to count the number of data loaded into the cache but not used?

The following two situations may cause data to be loaded into the cache but not used: Incorrect prefetch judgment Partial access of cacheline Both of these situations may have negative impact on ...
Frontier_Setter's user avatar
0 votes
0 answers
79 views

x86: Instruction reorder related with `cmpxchg` (without lock prefix)?

Could a memory write instruction (mov reg to memory) after cmpxchg (without lock prefix) be recordered and executed before cmpxchg for x86? EX1: // try_cmpxchg_local(&local.pos, &tail, ...
matt's user avatar
  • 51
4 votes
1 answer
110 views

No intrinsics for x86 BMI instructions BLSI & BLSR in Clang?

I wanted to try out some intrinsics for the x86 BMI set. The grep bmi /proc/cpuinfo shows both bmi1 and bmi2 in my AMD Ryzen CPU. But I cannot get clang to compile some of the instructions, in ...
xealits's user avatar
  • 4,364
1 vote
1 answer
40 views

How do I check two different conditions in MASM?

I need to check if a user input (negative integer) is within two ranges either between [-200, -100] or [-50, -1]. UPPER = -100 LOWER = -200 UPPER2 = -1 LOWER2 = -50 getData: mov eax, ...
Thai Le's user avatar
  • 11

1
4 5
6
7 8
353