x86-64

How to use "GS:" in 64-bit Windows Assembly (eg, porting TLS code)

How can an user-space program configure "GS:" under 64-bit Windows (currently XP-64)? (By configure, set GS:0 at an arbitrary 64-bit linear address). I am trying to port a "JIT" environment to X86-64 that was originally developed for Win32. One unfortunate design aspect is that identical code needs to run on multiple user-space threa...

Syscall from inline asm in x86_64 Linux?

Hi, Why does this print garbage instead of exiting my program gracefully? I use system calls this way on BSD, and I wonder what would I need to make it work in Linux. int main(int argc, char **argv) { __asm ("movq $1,%rax; movq $0,%rdi; syscall"); /* exit(0) ? */ return 0; } Thanks. ...

What 64bit target to choose when compiling with Visual Studio (vcvarsall.bat)?

The vcvarsall.bat that does setup de build environment let you choose between x86 | ia64 | amd64 | x86_amd64 | x86_ia64. First option is obvious for 32bit, but the question is: what would be the optimal option between the other 4 if you want to build for 64bit and you want to run on all 64 bit machines. Let say that you don't have ti...

Basic questions about Assembly and Macs

Okay. I want to learn how to assemble programs on my Mac (Early 2009 MBP, Intel Core 2 Duo). So far, I understand only that Assembly languages are comprised of direct one-to-one mnemonics for CPU instructions. After some Googling, I've seen a lot of terms, mostly "x86" and "x86_64". I've also seen MASM, NASM, and GAS, among others. Corr...

Inline assembly error, thwarting gcc compilation attempts.

Greetings, SO. I have some code which I've made attempts at compiling using gcc, but my attempts have been thwarted. Could anyone more versed assist me with the subject, perhaps there's something I'm missing. I'm compiling this code on Linux Kitchen 2.6.28-15-generic #49-Ubuntu SMP Tue Aug 18 19:25:34 UTC 2009 x86_64 GNU/Linux. int ...

compiling 64 bit linux kernel with gcc

While trying to compile a 64 bit linux kernel using gcc, I see the following error : kernel/bounds.c:1: error: code model ‘kernel’ not supported in the 32 bit mode kernel/bounds.c:1: sorry, unimplemented: 64-bit mode not compiled in This is what gcc -v reports : Using built-in specs. Target: i586-redhat-linux Configured with: ../conf...

ffmpeg: same compilations behaving differently across different machines

I am using ffmpeg on two of my Ubuntu hardy boxes. Both of them have same version of pre-compiled binaries of FFMPEG from Medibuntu. When I convert 3GP to FLV, on one machine ffmpeg distorts sound while on the other it works fine. I have checked the version and formats options and they are all identical across the machines. The only d...

PyQt4 on Snow Leopard in 64 bit

I just compiled the latest preview of Qt4.6 on Snow Leopard in 64 bit without any major issues. http://qt.nokia.com/developer/qt-4.6-technology-preview#download-the-qt-4-1 Now, I am trying to do the same for PyQt4.6 with the latest snapshot from the River Bank website. However, the compiler exits with the following issue: g++ -c -pipe...

Book resources for x86/x64 assembly programming on Win platform

Hello, I ran a search for assembly language resources on stackoverflow.com and found some interesting results, but they seemed to boil down to two groups: 1) Assembly references to old ia32 architecture, such as the 80386 to Pentium 2) Windows agnostic books. Most of the commenters make the point that assembler is CPU dependent and tha...

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?...

Clean x86_64 assembly output with gcc?

I've been teaching myself GNU Assembly for a while now by writing statements in C, compiling them with "gcc -S" and studying the output. This works alright on x86 (and compiling with -m32) but on my AMD64 box, for this code (just as an example): int main() { return 0; } GCC gives me: .file "test.c" .text .globl main .type main...

How to find the culprit module or script on huge Apache/PHP resident memory usage ?

System: Centos 5.3 x86_64, with Apache 2.2 and PHP 5.2 as module (with mysql and oracle connectors) How to debug memory usage / leaks ? dmalloc ? Valgrind ? auto_prepend_file ? We're looking at 500+ MB VSZ and 50+ MB RSS for example, but it can be somewhat higher. And as the instances add up, we end up needing much more memory than wit...

Installing files to x64 "Program Files" from x86 msi

I'm creating installer using InstallShield 2010 (basic MSI) that is having two features. First feature consists of: main .NET application compiled as x86, some native x86 third party dlls which are used by main application (x64 versions are unavailable). Second feature contains single component which is an extension for MS Reporting...

Do I need to install both the 64-bit *and* x86 version of .Net SP2?

So I downloaded the .net 2.0 sp2 redistributable "NetFx20SP2_x64.exe" from the following site: http://www.microsoft.com/DOWNLOADS/details.aspx?familyid=5B2C0358-915B-4EB5-9B1D-10E506DA9D0F&displaylang=en Deployed on my x64 win2k3 server from which I run IIS in x86 mode. On the same server I also run services and utilities in x64 b...

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...

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...

Advice for learning Linux x86-64 assembly & documentation

Does anyone have documentation pertaining to learning the fundamentals of Linux x86-64 assembly? I'm not sure whether or not to learn it as is, or to learn x86 first, and learn it later, but being as I have an x86-64 computer and not an x86, I was thinking of learning x86-64 instead ;) Maybe someone could give me some incentive, and di...

Moving from 32-bit to 64-bit development, need clarification regarding .net framework and platform

Hello, Quick background: I develop C# in VS2008 under .net 3.5 on a Vista-x64 machine I recently switched to Vista-x64 and after some searching, I still feel that I do not completely understand interplay between OS and the .net framework. I would like some correction/clarification regarding this. The following is my understanding of t...

How to Tell if a .NET Assembly Was Compiled as x86, x64 or Any CPU

What's the easiest way to discover (without access to the source project) whether a .NET assembly DLL was compiled as 'x86', 'x64' or 'Any CPU'? Update: A command-line utility was sufficient to meet my immediate needs, but just for the sake of completeness, if someone wants to tell me how to do it programmatically then that would be of ...