Code: Select all
mov edx, 0x0534D4150 ; Place "SMAP" into edx
Sorry if this is a trivial question. I'm not that confident yet in editing the wiki, so I'm asking for confirmation here. This does concern my OS development too.
Code: Select all
mov edx, 0x0534D4150 ; Place "SMAP" into edx
Code: Select all
// SMAP magic value.Code: Select all
// "RSD PTR "Code: Select all
mov eax,'ABCD'
mov ebx,"ABCD"
Code: Select all
mov eax,"RSD PTR " ; <---- error
Code: Select all
mov rax,"RSD PTR "
Wouldn't little-endian mean 'R' in the low address and 'T' in the high address?
Again, this would depend on the assembler. Let's look at it a little different.
Code: Select all
mov eax,0x12345678
Code: Select all
mov edx, 0x0534D4150 ; Place "SMAP" into edx
A comment or documentation stating to placing "SMAP" (which is short for "System Map", if memory serves) into 'edx' relies 100% on endianness of the assembler. That same comment or documentation stating to place 0x534D4150 into 'edx' only relies on the endianness of the architecture and not the assembler. I believe we both agree on this statement.Since x86 is little endian, wouldn't the magic value be "PAMS", not "SMAP"?
Code: Select all
mov edx,"SMAP" ; Place "SMAP" into edx
Code: Select all
mov eax,[some_offset_where_we_read_the_SMAP_value]
cmp eax,"SMAP"
Code: Select all
mov eax,[some_offset_where_we_read_the_SMAP_value]
cmp eax,"PAMS"
You asked about the string literal's endianness, not the value's endianness.Since x86 is little endian, wouldn't the magic value be 0x534D4150, not 0x50414D53?
Code: Select all
mov edx,'SMAP' ; Place 0x534D4150 into edx
mov edx,"SMAP" ; Place 0x50414D53 into edx
Code: Select all
mov edx,'SMAP'
Code: Select all
mov edx,'PAMS'
Code: Select all
cmp dword ptr [ebx+123], 'SMAP' ; does the little-endian signature match what we want?
cmp dword ptr [ebx+123], "SMAP" ; does the big-endian signature match what we want?
Code: Select all
mov edx,"SMAP" ; Place "SMAP" into edx
Code: Select all
auto m0 = 'abcd'; // int, value 0x61626364
Code: Select all
auto m0 = 'abcd'; // int, value 0x61626364The 'auto', the 'abcd', or both? :-)iansjack wrote: ↑Fri Jul 25, 2025 1:56 amWell, to my mind that is extremely poor code and you deserve any consequent confusion.Code: Select all
auto m0 = 'abcd'; // int, value 0x61626364
BenLunt, you have explained the confusion occuring in the quote above, and I think I understand what you are saying. However, I'm still of the opinion, that you are using the tem "endianness" in an unappropriate context. That's what caused the confusion in the first place, I believe. I think it would be better to speak of byte order, not endianness, in the context of an assembler.