Category "x86"

Do UEFI DXE Drivers operate in real-mode? What about "ring -2" or "ring -3" code?

I asked a question referencing a mode sometimes referred to as ring -2 (System Management Mode) which can be exploited to create rootkits. There's also even a r

Is it possible to read a value from memory being written by another thread, so that it's neither the original nor final?

Suppose we have a variable in memory, which is constantly being updated by a thread of execution by doing something like MOV into it with alternating values (si

How to get the beginning address of a string instead of the address of a whole string

SORRY if i make you confuse about the question, but i don't know a better to describe it i'm trying to write a NASM program to reverse a string in place. i ha

Correctly disable Hardware Prefetching with MSR in Skylake

I am trying to disable hardware prefetching on my machine: CPU family: 6 Model: 78 Model name: Intel(R) Core(TM) i5-6200U CPU

Bit-twiddling Wizardry for Index of Min or Max Element in XMM/YMM/ZMM

Is there an instruction or efficient branchless sequence of instructions to figure out the INDEX of (not the value of) the largest (or smallest) element of an u

What are my available march/mtune options?

Is there a way to get gcc to output the available -march=arch options? I'm getting build errors (tried -march=x86_64) and I don't know what my options are. The

Does mmap changes flags stored in the page table?

To the best of my knowledge, MMAP can be used to change a protection of mapped memory region. For example, If I want to add executable permission to one of m

Null bytes in shellcode? Why does mov eax,1 machine code have bytes that are 00?

Going through the shellcode article on wikipedia, it gives an example as follows: B8 01000000 MOV EAX,1 // Set the register EAX to 0x000000001 To

relocation truncated to fit r_386_8 against .bss'

When I try to build my source into a 32-bit static executable for Linux with nasm -f elf -F dwarf -g loop.asm ld -m elf_i386 -o loop loop.o I get this R_386_

Can modern x86 implementations store-forward from more than one prior store?

In the case that a load overlaps two earlier stores (and the load is not fully contained in the oldest store), can modern Intel or AMD x86 implementations forwa

Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures?

I'm doing micro-optimization on a performance critical part of my code and came across the sequence of instructions (in AT&T syntax): add %rax, %rbx mov %r

Generating 1 random number within 0-256 range in x86 8086 tasm(16 bit) [duplicate]

At this point i have been learning assembly for about 6 months. My current project is a random number generator. I need to generate 1 random n

Converting ASCII hex number to 32-bit binary integer in x86

So im reading the user's 8-digit input, and saving it into a variable. for example: Enter an 8-digit hex number: 1ABC5678 So, then i loop through the 1ABC5678 h

What is the difference, if any, between LONG and FAR jumps in Assembly?

I'm looking at some practice code for assembly, and the assignment is basically to replace one jump point with another. The original jmp is a SHORT jmp, and th

Can x86's MOV really be "free"? Why can't I reproduce this at all?

I keep seeing people claim that the MOV instruction can be free in x86, because of register renaming. For the life of me, I can't verify this in a single tes

How to configure IOMMU protection for my hypervisor?

I'm developing my own bare-metal hypervisor over intel vt-x technology. My goal is to make it inaccessible to the OS I'm running over my hypervisor in any way,

Adding 2D arrays in Assembly (x86)

I have to add two 3*3 arrays of words and store the result in another array. Here is my code: .data a1 WORD 1,2,3 WORD 4,2,3 WORD 1,4,3 a2 WORD 4, 3, 8

Micro fusion and addressing modes

I have found something unexpected (to me) using the Intel® Architecture Code Analyzer (IACA). The following instruction using [base+index] addressing add

How to add two numbers, integer and a float in NASM?

I have this code that is suppose to add two numbers, a float(3.25) and a integer(2). EDITED: extern _printf, _scanf global _main section .bss num1: resb 4 s

Unable to compile XINU source code after adding a new function in assembly language

I have added a file function.S in sys folder in XINU. .text .globl zfunction zfunction: <x86 code> equivalent C code for this function is long