x86

How to calculate DS:[0040207A] manually?

How to get the result 77D507EA manually from DS:[0040207A] according to register info above? UPDATE ...

Hex values of registers? x86

MOV DL,AL "MOV DL" = B2 But what is the hex byte value for AL? Where are these listed? I just realized it must be another opcode! Can anyone point me in the right direction? ...

How to import a function from libc6 into an ELF executable?

I am creating an i386 ELF executable that needs to import a function from libc6. (It's printf, by the way.) I have created a very small ELF executable that prints "Hello, world!" to the console by using the Linux kernel interrupt 0x80. This is not optimal and I would like to have the application make use of libc instead. Here is what I...

Printing Hexadecimal Digits with Assembly

I'm trying to learn NASM assembly, but I seem to be struggling with what seems to simply in high level languages. All of the textbooks which I am using discuss using strings -- in fact, that seems to be one of their favorite things. Printing hello world, changing from uppercase to lowercase, etc. However, I'm trying to understand how t...

Memory corruption in assembly?

I currently have an assembly program which is modeled after the hexdump system function in Linux. Essentially, it prints the current line number, converts the binary values to hexadecimal strings and also shows the current ASCII associated with the hexadecimal string. I'm experiencing a problem with my system of printing line numbers. T...

BitBlt function produces empty bitmap when compiled for x86 in .NET 2.0 VB app.

Hi All, I have a BitBlt wrapper function in my VB project. It works just fine when compiled as Any CPU, but when I aim it at x86 it creates an empty bitmap. I must use x86 as other parts of the app require it. Any ideas what could be wrong? Here is the code: Imports System.Drawing.Imaging ''' <summary> ''' Provides the static meth...

Can't start Eclipse 3.5.2?

Hi, I'm running Windows Vista x64, and I have JDK 1.6.0_21 (x64 version, I believe) installed. I recently downloaded Eclipse 3.5.2 because I want to do some Android development (apparently you can't use 3.6 yet due to bugs...), but I keep running into the same error message whenever I try to start Eclipse: http://img42.imageshack.us/img...

GCC Inline Assembly Multiplication

I'm trying to learn GCC inline assembly on Linux (x86), and my first experiment was to try and implement integer overflow detection for multiplication. It seems easy enough, but it is having side effects which I don't understand. So, here I want to multiply two unsigned 8-bit integers, and see if the result overflows. Basically I just...

What x86 register denotes source location in movsb instruction?

What x86 register denotes source location in movsb instruction? ...

FileNotFoundException thrown when calling Assembly.GetExportedTypes()

I'm getting this error when running a .net 2.0 app on a stripped-down XP SP3 x86 virtual machine, even if .net 2.0 framework runtime has already been installed prior to installing the app. Exception Source: mscorlib Exception Type: System.IO.FileNotFoundException Exception Message: Could not load file or assembly 'Windo...

Is there a way of forcing a variable to stay cached in x86(/_64)?

With Blackfin processors, I can declare a variable with "l1_data" attribute in gcc, and that variable stays in L1 data SRAM. Is there a way to do this on x86 or x86_64? ...

Causing a divide overflow error (x86)

I have a few questions about divide overflow errors on x86 or x86_64 architecture. Lately I've been reading about integer overflows. Usually, when an arithmetic operation results in an integer overflow, the carry bit or overflow bit in the FLAGS register is set. But apparently, according to this article, overflows resulting from divis...

Divide and Get Remainder at the same time?

Apparently, x86 (and probably a lot of other instruction sets) put both the quotient and the remainder of a divide operation in separate registers. Now, we can probably trust compilers to optimize a code such as this to use only one call to divide: ( X / 6 ) ( x % 6 ) And they probably do. Still, do any languages (or libraries, but m...

How are numbers greater than 2^32 handled by a 32 bit machine?

I am trying to understand how calculations involving numbers greater than 232 happen on a 32 bit machine. C code $ cat size.c #include<stdio.h> #include<math.h> int main() { printf ("max unsigned long long = %llu\n", (unsigned long long)(pow(2, 64) - 1)); } $ gcc output $ gcc size.c -o size $ ./size max unsigned long long ...

A reference for AT&T syntax assembly floating point arithmetic

I've been trying for the past week to find a decent resource on floating point arithmetic for x86 assembly using AT&T syntax. Ideally, a list of the opcodes, what they do, and where the floats are stored. I am familiar with IEEE 754 representation. I am not familiar with the floating point stack, and any assembly referring to floating po...

x86 masm hello world

I am trying to compile a hello world on windows with the ML and LINK that ship with VS 2010. .MODEL FLAT .STACK 4096 .data msg db "Hello World!",0 .code INCLUDELIB MSVCRT EXTRN printf:NEAR EXTRN exit:NEAR PUBLIC _main _main PROC mov eax, offset msg push eax call printf mov eax,0 push eax call exit _main ENDP END _main I keep getting ...

Assembly tutorial

I am trying to learn assembly language. I tried few tutorials, videos and pdfs but unable to understand much. Since last three days , I am struggling on this. Can anybody please give me a link to good assembly tutorial or ebook? Thanks in advance. EDIT: I tried the vtc video tutorials on assembly first. After that I searched for assembl...

Why does this code cause an access violation exception?

_memcpy_r SEGMENT memcpy_r PROC mov r10, rdi mov r11, rsi mov rdi, rcx mov rsi, rdx mov rcx, r8 shr rcx, 3 rep movsq mov rcx, r8 and rcx, 7 rep movsb mov rsi, r11 mov rdi, r10 ret memcpy_r ENDP _memcpy_r ENDS END I have the above code in a .asm file which I'm using in a Visual Studio 2010 project. It's set to compile us...

x86 Assembly: INC and DEC instruction and overflow flag

In x86 assembly, the overflow flag is set when an add or sub operation on a signed integer overflows, and the carry flag is set when an operation on an unsigned integer overflows. However, when it comes to the inc and dec instructions, the situation seems to be somewhat different. According to this website, the inc instruction does not...

What type should I use for iterator difference to eliminate "possible loss of data" warnings?

I need a common rule for warnings in x64 mode. Which way is better? Consider the following lines of some code const int N = std::max_element(cont.begin(), cont.end()) - cont.begin(); or const int ARR_SIZE = 1024; char arr[ARR_SIZE]; //... const int N = std::max_element(arr, arr + ARR_SIZE) - arr; It is my usual code. I have no pr...