x86

How could an assembly OUTB function cause a triple fault?

In my systems programming class we are working on a small, simple hobby OS. Personally I have been working on an ATA hard disk driver. I have discovered that a single line of code seems to cause a fault which then immediately reboots the system. The code in question is at the end of my interrupt service routine for the IDE interrupts. Si...

Why would an end-of-interrupt for the master PIC cause a triple fault (reboot)?

Ok, in school we are developing an operating system. My project has been to develop an ATA hard disk driver. I thought I had my interrupt service routine working quite well when my professor pointed out that I was only sending end-of-interrupt commands to the slave PIC, and not the master as well. My problem is that whenever I send the ...

Are there any good VB/C# x86 disassembler libraries?

I'm looking for a library that will disassemble x86 code into some sort of object model that I can then use to write routines that analyze the code. I'm not interested in a library that converts x86 code to text disassembly--I've found more than a few of those, but they're not that useful since I want to do some work on top of the code t...

Ada and assembly

I'm looking at making a hardware debug tool that runs on the bare CPU (x86), 32-bit protected mode and no OS. Due to time constraints, I won't be writing the tool all in x86 assembly. I like the Ada language (but am inexperienced with it) and thought it might be interesting to use Ada rather than C for this project. With C one can use ...

Why are x86 registers named the way they are?

For example, the accumulator is named EAX and, while the instruction pointer is called IP. I also know that there are bytes called CL and DH. I know there must be a convention to all of the names, but what is it? ...

Create x86 and x64 installers using the same vdproj file?

I want to build an x86 msi package as well as an x64 package using the same Visual Studio 2008 deployment project. I see a TargetPlatform in the project properties dialog and I know I can use this to select either x86 or x64 (or Itanium for that matter). The problem is that I cannot seem to associate this property with a project config...

How to write a disassembler?

I'm interested in writing an x86 dissembler as an educational project. The only real resource I have found is Spiral Space's, "How to write a disassembler". While this gives a nice high level description of the various components of a disassembler, I'm interested in some more detailed resources. I've also taken a quick look at NASM'...

x86 code generator framework for Delphi

Has anyone come across a framework or library for Delphi to simplify the generation of x86 code? I am not looking for an assembler, but rather a framework that abstracts the code generation process above the low level bits and bytes. Ideally I would like to build on top of an existing library or framework rather than hardcode the logic o...

assembly x86 implementation of stack

i need to implement a stack in x86 assembly so i wrote this: section .bss my_stack: resb 5 but the data inside this address disappear after i continuing with my program there is a better way i can implement the stack????? ...

Why is such a small assembly program so slow?

I have the following assembly program which displays the letter 'z' and then exits: mov dl, 'z' mov ah, 2h int 21h mov ah, 4Ch int 21h I assembled it with NASM and the resulting file only contains those instructions. (10 bytes) I put 1000 calls to this program in a batch file, and then 1000 calls to echo z and the echos run about 1...

What does the PIC register (%ebx) do?

I have written a "dangerous" program in C++ that jumps back and forth from one stack frame to another. The goal is to be jump from the lowest level of a call stack to a caller, do something, and then jump back down again, each time skipping all the calls inbetween. I do this by manually changing the stack base address (setting %ebp) and...

Are there any advantages to compiling an assembly as x64?

Suppose I have a .Net Framework 3.5 SP1/CLR 2.0 application which needs to run on both x86 and x64 platforms. Suppose as well that for whatever reason, I need to create separate x86 and x64 installation programs. As I have an x64-specific installer anyway, would there be any benefit to recompiling the application itself as x64 rather th...

How does this piece of assembly work?

Hi, I recently needed to debug a program at assembly level. I don't have a lot of assembler experience, so I figured I'd write some simple C programs and single-step through them in order to get a feeling for the language before I'd start debugging other peoples code. However, I really don't get what gcc made of these two lines (compile...

Using software floating point on x86 linux

Is it (easily) possible to use software floating point on i386 linux without incurring the expense of trapping into the kernel on each call? I've tried -msoft-float, but it seems the normal (ubuntu) C libraries don't have a FP library included: $ gcc -m32 -msoft-float -lm -o test test.c /tmp/cc8RXn8F.o: In function `main': test.c:(.text...

What kind of projects (besides the obvious OS stuff) use assembly language?

Seemingly, no one uses assembly nowadays other than to develop device drivers, or the very core of OS kernels etc. Anyone has knowledge of it being currently used for other things? I mean PC-style and bigger hardware, not embedded stuff with teeny tiny processors. ...

x86 inline assembler flag

Hi Silly question, but I just can not find the necessary flag in gcc. Basically, I have in my C program the following inline assembler code asm volatile ("lea ebx, [timings] \n\t"); When compiling, I get an errormessage which says: Error: invalid char '[' beginning operand 2 `[timings]' Now I remember that a long time ago I used some...

Installer question: "Program Files" or "Program Files (x86)"?

I am installing a .NET (C#) application that is 100% managed code. The installer (InnoSetup) always wants to install the application to the "Program Files (x86)" folder in Vista x64, which I'm assuming is because the installer itself is only 32bit. (please correct me if I am wrong) Here are my questions: Does being in the x86 folder af...

Memory alignment on a 32-bit Intel processor

Intel's 32-bit processors such as Pentium have 64-bit wide data bus and therefore fetch 8 bytes per access. Based on this, I'm assuming that the physical addresses that these processors emit on the address bus are always multiples of 8. Firstly, is this conclusion correct? Secondly, if it is correct, then one should align data structu...

Stack allocation, padding, and alignment

I've been trying to gain a deeper understanding of how compilers generate machine code, and more specifically how GCC deals with the stack. In doing so I've been writing simple C programs, compiling them into assembly and trying my best to understand the outcome. Here's a simple program and the output it generates: asmtest.c: void main...

What does this little bit of x86 doing with cr3?

So, I'm disassembling a bit of code for fun and no profit (other than the joy of knowledge, that is), and I come across this bit: mov eax, cr3 mov cr3, eax Is this doing anything other than just masturbating with cr3? If so, what? This is x86 low-level (bios/firmware/before boot loader) intialization code. We haven't even setup up ...