Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

64-bit long mode compatability with 32-bit instructions-GAS (Developers)

posted by RayeR(R) Homepage, CZ, 22.01.2014, 23:44

in my multiplatform C code (I use GCC) I have a few lines of inline assembler. I tried it to recompile under 64-bit Linux and I got an error from gcc/gas that some instructions has invalid suffix, e.g.:
" pushfl ; "
" popl %%eax ; "
I searched for solution and found that I have to use 64-bit extended instructions instead so I used:
#ifdef __x86_64__
" pushfq ; "
" popq %%rax ; "
Now it seems to work. Do I really need to make branching for 32-bit and 64-bit platform? Does it mean that if CPU is in long mode it is not compatible with 32b (and 16b) instructions? Then how does 64-bit windows run older 32-bit apps without recompiling? I know that it use some WoW64 layer but I don't know what it is exactly doing. If I would use long mode under DOS then do I need to write all in 64-bit asm (otherwise will I got invalid opcode exception)?

DOS gives me freedom to unlimited HW access.


Complete thread:

Back to the forum
Board view  Mix view
15273 Postings in 1373 Threads, 253 registered users, 16 users online (0 registered, 16 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum