x86

Is there any kind of standard for 8086 multiprocessing?

Back when I made an 8086 emulator I noticed that there was the LOCK prefix intended for synchonization in a multiprocessor environment. Yet the only multitasking I know of for the x86 arch. involves use of the APIC which didn't come around until either the Pentiums or 486s. Was there any kind of standard for 8086 multitasking or was it...

Help translating from assembly to C

I have some code from a function subl $24, %esp movl 8(%ebp), %eax cmpl 12(%ebp), %eax Before the code is just the 'ENTER' command and afterwards there's an if statement to return 1 if ebp > eax or 0 if it's less. I'm assuming cmpl means compare, but I can't tell what the concrete values are. Can anyone tell me what's happening? ...

Problem with asm program (nasm)

org 0x100 SEGMENT .CODE mov ah,0x9 mov dx, Msg1 int 0x21 ;string input mov ah,0xA mov dx,buff int 0x21 mov ax,0 mov al,[buff+1]; length ;string UPPERCASE mov cl, al mov si, buff cld loop1: lodsb; cmp al, 'a' jnb upper loop loop1 ;output mov ah,0x9 mov dx, buff int 0...

Can't edit and continue when using Visual Studio 2010 on a 64 bit machine, app targets x86

I'm having some problems with Edit and Continue when using Visual Studio 2010 on a Windows 7 64 bit machine. I've ensured the following Edit and Continue is enabled under Tools>Options>Debugging>Edit and Continue My solution platform is set to x86 My solution configuration is set to Debug All my projects are building for Debug and x86 ...

Referencing a x86 assembly in a 64bit one

In one project we have a dependency on a legacy system and its .Net assembly which is delivered as a 'x86' and they do not provide a 'Any CPU' and/or 64bit one. Now the project itself juggles with lots of data and we hit the limitations we have with a forced x86 on the whole project due to that one assembly (if we used 64bit/any cpu it w...

How To Create Your Own x86 Operating System for Modern PC Computers

I'd like to create a new operating system for x86 PC computers. I'd like it to be 64-bit but possibly run as 32-bit as well. I have these kinds of questions: What kinds of things do you start working on first? Knowing where to start in writing your own operating system seems to me to be a tricky subject, so I am interested in your inpu...

Doubts in System call mechanism in linux

We transit from ring3 to ring0 using 'int' or the new 'syscall/sysenter' instruction. Does that mean that the page tables and other stuffs that needs to be modified for the kernel is automatically done by the 'int' instruction or the interrupt handler for the 'int 0x80' will do the required stuff and jump to the respective system call. ...

How to catch a tab press in x86 assembly?

Hi, I'm working on a project in x86 assembly on Windows (MASM), and I need to somehow catch tab presses, but I'm not sure how to do that in assembly (I'm new to it). I can get get user input with int 21h, but as far as I can tell that only works if the users types the data, then presses enter. What I need is a way so that if the user ...

How is a relative JMP (x86) implemented in an Assembler?

While building my assembler for the x86 platform I encountered some problems with encoding the JMP instruction: OPCODE INSTRUCTION SIZE EB cb JMP rel8 2 E9 cw JMP rel16 4 (because of 0x66 16-bit prefix) E9 cd JMP rel32 5 ... (from my favourite x86 instruction website, http://siyobik.info/index.php?module=...

Compile Assembly Output generated by VC++?

I have a simple hello world C program and compile it with /FA. As a consequence, the compiler also generates the corresponding assembly listing. Now I want to use masm/link to assemble an executable from the generated .asm listing. The following command line yields 3 linker errors: \masm32\bin\ml /I"C:\Program Files (x86)\Microsoft Vis...

using in-line asm to write a for loop with 2 comparisons

I want to convert the for loop in the following code into assembly but i am not sure how to start. An explanation of how to do it and why it works would be appreciated. I am using VS2010, C++, writing for the x86. The code is as follows: for (n = 0; norm2 < 4.0 && n < N; ++n) { __asm{ ///a*a - b*b + x fld a // a ...

Why is FLD1 loading NaN instead?

I have a one-liner C function that is just return value * pow(1.+rate, -delay); - it discounts a future value to a present value. The interesting part of the disassembly is 0x080555b9 : neg %eax 0x080555bb : push %eax 0x080555bc : fildl (%esp) 0x080555bf : lea 0x4(%esp),%esp 0x080555c3 : fldl 0xffff...

Acquiring an operand from an instruction

Given the following x86 assembly instructions: mov esi, offset off_A cmp esi, offset off_B how would I get the offsets (the second operand) at runtime ? This is the scenario: A program (injected into the process at runtime) replaces the offsets with a few of its own, resulting in: mov esi, offset off_X cmp esi, offset...

x86 linux - how to create custom malloc with address hint

Hi, I want to create a custom malloc which allocates memory blocks within a given address range. I am writing a pthreads application in which threads are bound to unique cores on a many-core machine. The memory controllers are statically mapped, so that certain range of addresses on main memory are electrically closer to a core. I want...

WiX installer that always installs to "Program Files" directory on both x86 and x64

I have a .NET application that runs on both x86 and x64. I'd like to have a 32 bit WiX installer that will work on both platforms but I'd like it to install to /Program Files/ rather than /Program Files (x86)/ on 64 bit operating systems. How do you go about doing this? Update: My idea was to assign the ProgramFilesFolder or ProgramFi...

x86 assembler question

Hi, I have 2 simple, but maybe tricky questions. Let´s say I have assembler instruction: MOV EAX,[ebx+6*7] - what I am curious is, does this instruction really actually translates into opcode as it stands,so computation of code in brackets is encoded into opcode, or is this just pseudo intruction for compiler, not CPU, so that compiler ...

Call/Ret in x86 assembly embedded in C++

This is probably trivial, but for some reason I can't it to work. Its supposed to be a simple function that changes the last byte of a dword to 'AA' (10101010), but nothing happens when I call the function. It just returns my original dword. __declspec(naked) long function(unsigned long inputDWord, unsigned long *outputDWord) {...

How can I convert a number in a string to any base in assembly?

How can I convert a number contained in a string from any base to any other base? Bases can be anything i.e.: 2, 16, 10, 4, 8, 9. I'm expecting the user to enter the base number. The user will enter the output base (the base to be converted to). The user will enter the number he wants to convert. Pre thoughts: I will save the input b...

Assembly Language Question: Counting upper case and lower case letter from a string

Write an Assembly Language program named “count letters” that counts the occurrences of all small and capital letters in given below string and then prints the result in the format (Caps, count:: Small, count). String is “bcAdBDeCEad” and it should print this result (Caps, 5:: Small, 6). The program should take address of the source stri...

x86 instruction encoding tables

I'm in middle of rewriting my assembler. While at it I'm curious about implementing disassembly as well. I want to make it simple and compact, and there's concepts I can exploit while doing so. It is possible to determine rest of the x86 instruction encoding from opcode (maybe prefix bytes are required too, a bit). I know many people ha...