x86

Microsoft ASM interview question?

I was looking online through samples of interview questions asked in the past by Microsoft and came across this one: The following asm block performs a common math function, what is it? cwd xor ax, dx sub ax, dx Can somebody please answer this and explain the answer to me? Thanks!! Update : okay, so its computes the absolute ...

Implementing math.h functions in assembler

Hello, I have used gdb to step through the assembler code that implement the standard C sin() function in the standard C math library (-lm -march=pentium3 -mfpmath=387). There is a lot of stub there and I don't know why they have not simply inlined the fsin assembler instruction. The same happens with other mathematic functions. Why they...

how to allow .com in a url path using IIS6 on Win2003 R2 x64?

it seems IIS6 on Win2003 R2 Enterprise x64 SP2 will not allow you to use .com in a url path. e.g if i create a folder foo.com in my web root, containing a default.htm, this url results in a 404: http://localhost/foo.com/default.htm however, following the exact same steps on Win2003 R2 Standard x86 SP2, and IIS6 will serve up the file ...

How un-portable is assembly language, /really/?

I understand that writing anything in assembly, or adding assembly to any program harms its portability. But, how bad? I mean, basically all PC's are x86 or x64 these days, right? So, if I embed assembly into a C program, why wouldn't it still compile no matter where it went? Does this notion of un-portability just refer to when you rea...

Convert Inline C Assembler (Intel syntax to AT&T)

I am trying to convert this function from MSVC++ to MINGW (this is the original MSVC function) VOID __declspec(naked) BNSTUB() { __asm { pushad; call OnChatPacketReceived; TEST EAX,EAX; popad; jnz oldCall; MOV EAX,0; MOV DWORD PTR DS:[EBX+0x6FF3EBA0],1 ret; oldCall: C...

Porting 32 bit C++ code to 64 bit - is it worth it? Why?

I am aware of some the obvious gains of the x64 architecture (higher addressable RAM addresses, ect)... but: What if my program has no real need to run in native 64 bit mode. Should I port it anyway? Are there any foreseeable deadlines for ending 32 bit support? Would my application run faster / better / more secure as native x64 code?...

What is the practical difference between the SI and DI registers?

I don't get what is the difference. ...

Assembly and multicore CPUs

What x86-64 instructions are used to enable/disable other cores/processors and how does one start executing code on them? Is there documentation somewhere on how this is done by the operating system? ...

Are there any instructions in x86 assembly that exist only in 64-bit mode?

Some old x86 instructions are undefined in 64-bit mode. For instance LDS, LES and LSS, or short opcodes of the INC r16 (40 + rw) and INC r32 (40 + rd) instructions. Are there any instructions that are defined only in 64-bit mode, and not in 32-bit protected mode? Edit: The context is development of an x86 processor. I want to make s...

Whats a good place to start learning assembly?

I need to learn assembly using SSE instructions and need gcc to link the ASM code with c code. I have no idea where to start and google hasn't helped. ...

Disable Hardware & Software Interrupts

Hello! Is it possible to disable all interrupts with a ASM/C/C++ program to get full control about the processor? If yes -> how? If not -> how do "atomic" operation system calls work (for example entering a critical section)? Sorry for my English! Thanks for your help! ...

Why is SSE scalar sqrt(x) slower than rsqrt(x) * x?

I've been profiling some of our core math on an Intel Core Duo, and while looking at various approaches to square root I've noticed something odd: using the SSE scalar operations, it is faster to take a reciprocal square root and multiply it to get the sqrt, than it is to use the native sqrt opcode! I'm testing it with a loop something ...

using 32 bit installshield for packaging 64 bit binaries

Hi, iam using 32 bit installshield to package 64 bit binaries. everything works fine but default location is pointing to c:\program files(x86)\companyname\productname. even though i've selected 64bit at every possible place, somehow it is defaulting to x86 programfiles folder. Any kind of help would be appreciated... ...

XORing at the address stored in EAX

How can you XOR the value stored in EAX? The problem is at this line: xor eax, key EAX contains the address of the value i want to XOR. How can I accomplish this? I though it would be something along the lines of: xor [eax], key but that doesn't work (syntax error) decrypt proc startAddress:DWORD , sizeOfSegment:DWORD , key:DWOR...

Can I atomically increment a 16 bit counter on x86/x86_64?

I want to save memory by converting an existing 32 bit counter to a 16 bit counter. This counter is atomically incremented/decremented. If I do this: What instructions do I use for atomic_inc(uint16_t x) on x86/x86_64? Is this reliable in multi-processor x86/x86_64 machines? Is there a performance penalty to pay on any of these a...

[ASM] JMP to absolute address (op codes)

I'm trying to code a exe packer/protector as a way of learning more about assembler, c++, and how PE files work. I've currently got it working so the section containing the EP is XORed with a key and a new section is created that contains my decryption code. Everything works out great except when I try and JMP to the original EP after de...

Best program you have written in assembly language, so far?

Back to the golden days of Assembly language. As we know, assembly language is a low-level language with many hidden powers in it. If one can program well in it, many powerful and useful application can be developed from it. Which was your best application or program that you have developed so far, or even one you are currently develo...

Loading kernel from assembly (NASM)

I've been stuck with this for weeks now and have no idea where I'm going wrong because NASM hasn't given me any errors. The code is pretty self explanatory because of the comments. this is the code that is loaded from the BIOS ;-------------------------------------------- ; 'boot.asm' ; loaded from BIOS [org 0x7C00] [bits 16] ;...

How to compile multiple files together with ml in assembly x86?

Hi, I'm working in x86 assembly in 16bits. I have three files that need to share 'variables between them' - basically, the data segment. When I compile them, as in the following: ml file1.asm,file2.asm,file3.asm io.lib They cannot access each other's variables How do I share a data segment, and thus variables between the files? Thank ...

SQL Server CE "module could not be found" Crash

We are getting following error message in one Windows XP - X86 Exception Source: System.Data.SqlServerCe Exception Type: System.DllNotFoundException Exception Message: Unable to load DLL 'sqlceme35.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E) Exception Target Site: DllAddRef SQL S...