x86

Why do virtual memory addresses for linux binaries start at 0x8048000?

Disassembling an ELF binary on a Ubuntu x86 system I couldn't help but notice that the code(.text) section starts from the virtual address 0x8048000 and all lower memory addresses seem to be unused. This seems to be rather wasteful and all Google turns up is either folklore involving STACK_TOP or protection against null-pointer derefer...

Launch x64 Windows application in C# while the project is set to x86

Hi all I'm trying to launch the osk.exe and I keep getting "Could not start osk" message. The problem is that my project is set to x86 (i'm using a ms access database). If I switch to x64 or Any CPU everything works fine but the database will no longer work. I tried this using System.Diagnostics; private void btnOSK_Click(object sender...

Recursion in assembly?

I'm trying to get a better grasp of assembly, and I am a little confused about how to recursively call functions when I have to deal with registers, popping/pushing, etc. I am embedding x86 assembly in C++. Here I am trying to make a method which given an array of integers will build a linked list containing these integers in the order...

i386 assembly question: why do I need to meddle with the stack pointer?

Hello everyone, I decided it would be fun to learn x86 assembly during the summer break. So I started with a very simple hello world program, borrowing on free examples gcc -S could give me. I ended up with this: HELLO: .ascii "Hello, world!\12\0" .text .globl _main _main: pushl %ebp # 1. puts the base stack addre...

x86 Assembly Question about outputting

My code looks like this _declspec(naked) void f(unsigned int input,unsigned int *output) { __asm{ push dword ptr[esp+4] call factorial pop ecx mov [output], eax //copy result ret } } __declspec(naked) unsigned int factorial(unsigned int n) { __asm{ push esi mov esi, dword ptr [esp+8] cmp esi, 1 jg RECURSE m...

[Assembly] dword ptr? What does that mean?

Could someone explain what this means? (Intel Syntax, x86, Windows) and dword ptr [ebp-4], 0 ...

Accessing PCI Device from user space programs

I have a device which would be interface with my processor through pcie. I have written driver for it using the existing pci file operations. Now my problem is how do I access it from user space programs? PCI File operations do not have IOCTL support and hence I cant make an ioctl call unlike other char devices. I cannot use pci_config...

Delay On Assembler?

Hey, I want to know how i can do delay (Timer) on assembler 16 bit on PC. Thank You for helping, Norm. OS: Windows CODE: delay: inc bx cmp bx,WORD ptr[time] je delay2 jmp delay delay2: inc dx cmp dx,WORD ptr[time2] je delay3 jmp delay mov bx,0 delay3: inc cx cmp cx,WORD ptr[tim...

8 bit music type can play in Assembler 16 bit PC?

Possible Duplicate: Building a music player with assembly If it's avilable, how i can do that? OS:Windos. Sorry on the bad English.. ...

How to convert an integer to a floating point value in x86 ASM?

I need to multiply an integer (two's compliment) by a floating point constant. Here is what I have: .data pi dd 3.14 int dd 0ah .code fld pi ??? fmul ST(1), ST How can I convert int to a floating point value for multiplying against pi? ...

How to move value from the stack to ST(0)?

I am having trouble believing the following code is the most efficient way to move a value from the stack to ST(0): .data var dd 4.2 tmp dd ? .code mov EAX, var push EAX ; top of stack now contains a value ; move it to ST(0) pop EAX mov tmp, EAX fld tmp Is the temporary variable really necessary? Further, is there an easier way to g...

Open x64 'SOFTWARE' registry key in C#

I am trying to read the 64-bit HKLM\SOFTWARE registry key from a 32-bit (C#) application. This, of course, keeps redirecting my view to HKLM\SOFTWARE\Wow6432Node. According to what I've found this is doable, but I can't seem to find a .NET example anywhere. I just need to read; not write. Anyone ran across this before? ...

C inline assembly of x86 fbstp instruction

Was wondering how to inline a usage of fbstp on a 32 bit I86 architecture. I tried something like int main( ) { double foo = 100.0; long bar = 0; asm( "pushl %1; fbstp %0" : "=m"(bar) : "r"(foo) ); ... But bar is unchanged. I have tried reading everything I can find on this but most example ...

Interrupt №13 (ah=48) - not working

I want fetch the parameters of my hard disk. Using the technique described here. This is code showing normal parameters of floppy disk: mov dl,00h mov ah,08h int 13h This is code, showing not valid parameters of hard disk (may be, my hard disk space is big (LBA)): mov dl,80h mov ah,08h int 13h And I've written this code: mov dl,...

Substracting 64bit numbers in x86 assembler?

How can I substract 64 bit numbers using 386 assembler? ...

Problem with stack based implementation of function 0x42 of int 0x13

I'm trying a new approach to int 0x13 (just to learn more about the way the system works): using stack to create a DAP.. Assuming that DL contains the disk number, AX contains the address of the bootable entry in PT, DS is updated to the right segment and the stack is correctly set, this is the code: push DWORD 0x00000000 add ax, 0x00...

Flags on Instruction pointer overflow in 8086/8088

Hey guys, Im new to the 8086 architecture and have not been able to find much on Google related to the following: On the i8086 or i8088 (ie 16bit, segmented addressing) what happens if an instruction fetch occurs with the instruction pointer (program counter) at 0xFFFF? I assume the CPU increments the IP and it overflows and becomes 0x0...

How do I load all 1's into a mmx register? Why doesn't this work?

Hi, couldn't seem to find anything besides opinion questions on 64/32 bit stuff when I searched. __asm__ { mov rbx, 0xFFFFffffFFFFffffull movq mm2, rbx } After these 2 instructions the mm2 register holds the value 0x30500004ffffffff according to my xcode debugger (this is inline asm in C++). Now I am new to x86 assembly and my a...

check if carry flag is set

Using inline assembler [gcc, intel, c], how to check if the carry flag is set after an operation? ...

On a multicore x86, is a LOCK necessary as a prefix to XCHG?

If mem is a shared memory location, do I need: XCHG EAX,mem or: LOCK XCHG EAX,mem to do the exchange atomically? Googling this yields both yes and no answers. Does anyone know this definitively? ...