x86

Hidden features of x86 assembly language?

What are some hidden-features of x86 Assembly Language? What Tips and Tricks do you have for working with x86 Assembly language? ...

Advice for learning Linux x86-64 assembly & documentation

Does anyone have documentation pertaining to learning the fundamentals of Linux x86-64 assembly? I'm not sure whether or not to learn it as is, or to learn x86 first, and learn it later, but being as I have an x86-64 computer and not an x86, I was thinking of learning x86-64 instead ;) Maybe someone could give me some incentive, and di...

Debugging disassembled libraries with gdb

Hello, in Linux and Mac OS X I can use stepi and nexti to debug an application without debugging information. On Mac OS X gdb shows the functions that are called inside the library, although sometimes advancing several assembler instructions in each stepi instruction. On Linux, when I step into a dynamic library gdb gets lost. For ins...

C++ Array size x86 and for x64

Simple question, I'm writting a program that needs to open huge image files (8kx8k) but I'm a little bit confused on how to initialize the huge arrays to hold the images in c++. I been trying something like this: long long SIZE = 8092*8092; ///8096*8096 double* array; array = (double*) malloc(sizeof(double) * SIZE); if (array == NU...

VS2008 pro + seven pro 64bits

Hello. I recently installed W7 pro 64bits on my laptop, and then VS2008 pro with x64 compatibility. If i build any project, will it be built with 32 or 64 bit compatibility natively? And then, is it possible to change from 32 to 64 (or from 64 to 32) ? 'Cause most of my clients only runs 32bits applications, but I'd also liked to kno...

Performance penalty with executing x86 instructions stored in the data segment?

Hi. I have a simple program that first writes some native x86 instructions into a declared buffer, and then sets a function pointer to this buffer and makes a call. I'm noticing a severe performance penalty, however, when that buffer is allocated on the stack (as opposed to on the heap, or even in the globals data area). I verified th...

Storing data in segments with assembly

Hello everyone! I am learning x86 assembly language, and I understand the purpose and usage of segments. Segments hold vital data, and can also be used to store extra data (ie. Memory Segmentation Model). Here is my question though. If segments can be used to store extra data, how can I make sure that my storing data in them won't overwr...

Alter Interrupt in 16 bit Real Mode

I'm trying to alter my interrupt table to take over the keyboard interrupt. My end goal is to write my new interrupt routine, copy myself into RAM and make the real-mode interrupt table point to me. I have found random sample code online but it is missing explanations on how to get the address of the original interrupt. They simply ha...

Addl instruction, x86

You'll have to excuse me, I'm brand new to x86 assembly, and assembly in general. So my question is, I have something like: addl %edx,(%eax) %eax is a register which holds a pointer to some integer. Let's call it xp Does this mean that it's saying: *xp = *xp + %edx? (%edx is an integer) I'm just confused where addl will store the r...

Running code on different processor (x86 assembly)

In real mode on x86, what instructions would need to be used to run the code on a different processor, in a multiprocessor system? (I'm writing some pre-boot code in assembler that needs to set certain CPU registers, and do this on every CPU in the system, before the actual operating system boots.) ...

IRQ Numbering Conflict

From: http://software.intel.com/en-us/articles/introduction-to-pc-architecture/ Exception number 10h corresponds to a "Floating Point Error" but software interrupt 10h also corresponds to "Video support" BIOS interrupts (both in real mode). What am I missing? ...

Linux assembly woes

Is there really no way to print an ascii string in assembly to standard output without using up all four general purpose registers? ...

What is the best way to go about writing a simple x86 assembler?

I'm interested in writing an x86 assembler for a hobby project. At first it seemed fairly straight forward to me but the more I read into it, the more unanswered questions I find myself having. I'm not totally inexperienced: I've used MIPs assembly a fair amount and I've written a toy compiler for a subset of C in school. My goal is...

Memory adressing in asm

Hi, I'm learning asm and here's one of my (many) problems : I'd like to change the value of some index of an array. Let's say that : %eax contains my new value the top of the stack (ie (0)%esp) contains the index of the array -4(%ebp) contains the adress of the array. I've tried movl %eax, (-4(%ebp),0(%esp),4) but it did not work. ...

Examining code generated by the Visual Studio C++ compiler, part 1

Background I'm just learning x86 asm by examining the binary code generated by the compiler. Code compiled using the C++ compiler in Visual Studio 2010 beta 2. Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.21003.01 for 80x86 C code (sandbox.c) int mainCRTStartup() { int x=5;int y=1024; while(x) { x--; y/=2; }...

x86 asm: What's the purpose of the LEA instruction?

For me, it just seems like a funky MOV. What's its purpose and when should I use it? ...

What does OFFSET in 16 bit assembly code mean?

I am going through some example assembly code for 16bit real mode. I've come across the lines: mov bx, cs mov ds, bx mov si, OFFSET value1 pop es mov di, OFFSET value2 what is this doing? What does having 'OFFSET' there do? Sorry if its a very basic question, i'm new at this. ...

Is there a way to drive a today's computer NIC with no underlying OS?

Hi, I would like to write an IO intensive application with no underlying OS, running on x86 architecture and driving any modern network interface controller. By having a look to Linux's drivers source code, I know that thousands lines of codes are required to drive, as an example, an Intel e1000e Gigabit controller. I think that such c...

How does x86 handle store conditional instructions?

I am trying to find out what an x86 processor does when it encounters a store conditional instruction. For instance does it stall the front end of the pipeline and wait for the ROB buffer to become empty before it stops stalling the front end and execute the SC? Basically does it force the processor to become non speculative... Thanks ...

C calling conventions and passed arguments

When making a function call in Linux (or OS X for that matter), can the callee modify the values of the arguments on the stack? I was under the assumption that since the caller is the one that cleans them up, that they should contain the same values after the function call. However I found that GCC with -O2 was modifying parameters tha...