it is, eax is 32-bit part of RAX, maybe TASM or pascal assembler does not support mov with 32-bit regs (eax, ecx etc) in 64-bit mode (if so that is flawed)
so if mov eax, _EAX does not work try either:
movd eax, _EAX
or
mov rax, dword _EAX
it is, eax is 32-bit part of RAX, maybe TASM or pascal assembler does not support mov with 32-bit regs (eax, ecx etc) in 64-bit mode (if so that is flawed)
so if mov eax, _EAX does not work try either:
movd eax, _EAX
or
mov rax, dword _EAX
Last edited by Colin; 18-03-2013 at 06:12 PM.
Download the Ziron Assembler
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
It is even worse, "push esi" isn't known either. I added the compiler directive {$asmmode intel}. Now the problems are:
Another problem causes this piece of code (it's obviously Pascal, but i don't know to solve it either):Chip.pas(2041,13) Error: Asm: [push reg32] invalid combination of opcode and operands
Chip.pas(2042,13) Error: Asm: [push reg32] invalid combination of opcode and operands
Chip.pas(2066,12) Error: Asm: [pop reg32] invalid combination of opcode and operands
Chip.pas(2067,12) Error: Asm: [pop reg32] invalid combination of opcode and operands
Error:Code:args.outVal.n.sbuf:=basicstring(resvalue); basicstring(resvalue):=''
With a 32 bit FPC it compiles ... BTW, the complete source of Chip.pas can be found on: http://xmojmr.ohmygod.cz/software/Chip/Chip.pas.htmChip.pas(2076,27) Error: Illegal type conversion: "LongInt" to "AnsiString"
Chip.pas(2077,7) Error: Illegal type conversion: "LongInt" to "AnsiString"
Best regards,
Cybermonkey
I guess the assembler does some checking for stack alignment to prevent problems with other 64-bit libs, this is an issue with the assembler unless it has an override option, maybe try
as for the other code, does basicstring return a pchar/pointer? if so tryCode:[32BIT] push edi push .. etc
better still:Code:basicstring(resvalue)^ := ''
Code:var p: PAnsiChar;Code:p := basicstring(resvalue); args.outVal.n.sbuf := p; p^ := ''
Last edited by Colin; 18-03-2013 at 08:02 PM.
Download the Ziron Assembler
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
I'm glad you're here, I got as far as "ahh, it's pushing params onto the stack for the routine that's called", I'd worked out we'd need to see more of the code to understand the context, the function that's called etc meanwhile you've already sorted it
When the moon hits your eye like a big pizza pie - that's an extinction level impact event.
1 other thing to try is the pop's, try:
etcCode:pop dword edi
if all else fails you can always manually solve this by replacing the pop's with something like
EDITCode:mov rdi, dword ptr [rsp+4] mov rsi, dword ptr [rsp] add rsp, 8
but actually hehe, i'm tired, anyways you just need to keep edi etc so in this case we can solve it easily..
your code:
so try this:Code:asm push esi push edi sub esp, StkUsage // make room on stack mov edi, esp // set destination of mem copy, it is the stack mov esi, StkAdr // set source of mem copy, it is Addr(ExtStk) mov ecx, StkUsage // prepare ecx to copy StkUsage bytes shr ecx, 2 // divide by 4 to perform DWORD-copy (is faster) //add edi, StkUsage; //sub edi,4 //add esi, StkUsage; //sub esi,4 cld // choose copy direction rep movsd // do DWORD-copy cmp RegCall, true jnz @@EXEC mov EAX, _EAX mov EDX, _EDX mov ECX, _ECX @@EXEC: call Adr // execute the external function // esp is restored by the external function // (except for cdecl-convention) pop edi // restore edi... pop esi // ...and esi mov _EAX,eax end; // asm
for 64-bit you want to change _EAX etc to int64 and then remove dword casts. Note that this is only valid for fastcall, stdcall would be a big trouble for stack alignment across 32/64 bitCode:asm push rsi push rdi sub rsp, StkUsage // make room on stack mov rdi, rsp // set destination of mem copy, it is the stack mov rsi, StkAdr // set source of mem copy, it is Addr(ExtStk) mov rcx, StkUsage // prepare ecx to copy StkUsage bytes shr rcx, 4 // divide by 8 to perform QWORD-copy (is faster) cld // choose copy direction rep movsq // do QWORD-copy cmp RegCall, true jnz @@EXEC mov RAX, dword _EAX mov RDX, dword _EDX mov RCX, dword _ECX @@EXEC: call Adr // execute the external function // esp is restored by the external function // (except for cdecl-convention) pop rdi // restore edi... pop rsi // ...and esi mov _EAX,eax end; // asm
Last edited by Colin; 18-03-2013 at 08:44 PM.
Download the Ziron Assembler
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Okay, I changed the code as proposed. This is the [32BIT] part:
Now the error from this code:Chip.pas(2042,8) Error: Unrecognized opcode
Chip.pas(2042,8) Error: Assembler syntax error
Chip.pas(2042,9) Error: Error converting binary 32
Code:p := basicstring(resvalue); args.outVal.n.sbuf := p; p^ := ''(1st and 3rd line)Chip.pas(2078,9) Error: Illegal type conversion: "LongInt" to "AnsiString"
Chip.pas(2080,5) Error: Illegal qualifier
Best regards,
Cybermonkey
for assembly, see above as for the error i've just checked that source you posted (the link)
seems basicstring is a record, so i think you need to check the function "basicstring2string"
Download the Ziron Assembler
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Bookmarks