Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2012-01

assembler memory addressing in 64-bit mode

4 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Torsten

Hi,

i don't understand the follow error message in 64-bit mode:

assemblercode

asm
addpd xmm0, [EAX]
end;

fpc 2.7.1: not ok "16 or 32 Bit references not supported" nasm 2.09.10: ok

Intel® 64 and IA-32 Architectures
Software Developer’s Manual
Volume 1:
Basic Architecture:

3.7.5.1 Specifying an Offset in 64-Bit Mode
The offset part of a memory address in 64-bit mode can be specified directly as a
static value or through an address computation made up of one or more of the following components:
• Displacement — An 8-bit, 16-bit, or 32-bit value. • Base — The value in a 32-bit (or 64-bit if REX.W is set) general-purpose register.
• Index — The value in a 32-bit (or 64-bit if REX.W is set) general-purpose register.
• Scale factor — A value of 2, 4, or 8 that is multiplied by the index value.

I think this is a bug.

regards

Torsten

Reply by email

Jonas Maebe
to Torsten
Torsten wrote 10 lines
i don't understand the follow error message in 64-bit mode: assemblercode asm addpd xmm0, [EAX] end; fpc 2.7.1: not ok "16 or 32 Bit references not supported"

Are you 100% certain that your address lies in the first 4GB of memory? At least on Mac OS X, the above would always crash because it does not put any code/data within the first 4GB of memory on 64 bit systems (to make pointer truncation bugs as easy to spot as possible).

Jonas

Reply by email

Florian Klämpfl
to Torsten: i don't understand the follow error message in 64-bit mode: assemblercode asm addpd xmm0,…
Torsten wrote 13 lines
Hi, i don't understand the follow error message in 64-bit mode: assemblercode asm addpd xmm0, [EAX] end; I think this is a bug.

While in theory, it might be possible to write such code, I'am still prefer the error of FPC: in 99.9% of the use cases using a 32 bit reference in 64 bit mode is an error and crashes anyways on run time. If such code is really needed, it still can be encoded manually using .byte or if it's a bigger part, an external assembler can be used.

Reply by email

Torsten
to Florian Klämpfl

Hi Florian,

Florian Klämpfl wrote 19 lines
Am 06.01.2012 11:16, schrieb Torsten: > Hi, > > i don't understand the follow error message in 64-bit mode: > > > assemblercode > > asm > addpd xmm0, [EAX] > end; > > > I think this is a bug. While in theory, it might be possible to write such code, I'am still prefer the error of FPC: in 99.9% of the use cases using a 32 bit reference in 64 bit mode is an error and crashes anyways on run time. If such code is really needed, it still can be encoded manually using .byte or if it's a bigger part, an external assembler can be used.

I am working on the AVX-support for the fp-compiler and i make tests with different memory references.

It is ok for me. I ignore all 32-bit register memory references in my tests.

Show quoted text 5 lines
_______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email