views:

201

answers:

2

I am beginning to port a program which is written in C and have several pieces of code written in assembly with instructions for a 32 bit machine - like ljmp - to a 64 bits machine.

Is there a place/document that have the instructions, in assembly, for a 32 bit machine and its counterpart for a 64 one? If not, where can I find a document that lists all the instructions for a 32 bit and a 64 bit machine?


As it's is pretty obvious, I am a newbie for the situation. Let's clarify some points.

I am porting a OS in its very early days. It was written with a x86 machine in mind. Now, I want it to run at a x86_64.

It is written in a Linux box with UNIX in mind. I am almost sure that the original author is writing it at a Intel machine. I am also on Intel but I would like to run the OS in AMD too.

The compiler used is gcc.

+2  A: 

Read this first: http://x86asm.net/articles/x86-64-tour-of-intel-manuals/index.html.

Then download the instruction set reference here: http://developer.intel.com/products/processor/manuals/index.htm.

Bastien Léonard
this is assuming the OP is actually working on an x86 CPU
jalf
The fact the original question did not specify almost implies it'll be x86-64 that he's after. Even so, it'd be great if this questions could collect references for other applicable architectures too :)
jerryjvl
+3  A: 

You haven't offered any background, or even the type of CPU, but I'm going to suggest thay maybe you should take this 64-bit port as an opportunity to reconsider having used assembly language. While it certainly has its place, I would recommend recoding the routine in C++ and benchmarking the compiler's optimized output to see if it's really any slower. In many cases, it won't be.

Steven Sudit