flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
revolution
It is possible, but you need support from the OS to switch modes. Also be aware that the addressing would likely need to all be below the 4G limit and the page tables would need to match. I have no idea if Linux supports such a scheme as this:
http://board.flatassembler.net/topic.php?p=140791#140791 |
|||
![]() |
|
JohnFound
Maybe I have to explain more detailed what I actually need. It is known that 64bit Linux can run 32 bit applications natively but only if they does not use shared libraries. 32bit system calls are kernel supported.
There is a 32bit compatibility package that contains all needed 32bit libraries but it have to be installed. Otherwise, LD linker will not be able to find needed libraries and will fail to load application. On the other hand, in FreshLib, because of its architecture, I have wrapper functions for all needed functions imported from the shared libraries. So, I can make Linux64 layer that to import directly from 64bit libraries and this way to allow FreshLib applications to run on 64bit Linux without installing 32bit compatibility package. Another way is to implement all needed functionality using only system calls, what is possible, but not practical in this moment. |
|||
![]() |
|
revolution
How would your asm file look? Like this?
Code: use64 start64: ;wrapper code for 64-bit shared library access jmp seg32:start32 shared_library_func_1: call shared_library_func retf finished: mov rax,something int 0x80 use32 start32: call seg64:shared_library_func_1 ;... call seg64:finished |
|||
![]() |
|
JohnFound
Well, I have no experience in 64 bit programming. Maybe something like:
Code: use32 proc GetMem, .size begin ; switch to 64bit , call libc64 "alloc" use64 ;something more??? invoke64 alloc, [.size] use32 ; switch back to 32bit and return the address in 32bit (if possible) return endp start: stdcall GetMem, 1024 stdcall FreeMem, eax stdcall Terminate, 0 |
|||
![]() |
|
revolution
You have to get cooperation from the OS to switch operating mode. You can't do it only with user mode code. You have to either change the current segment descriptor or select another descriptor that is already prepared.
Also, if you allocate memory in 64-bit mode then how do you ensure it is accessible in 32-bit mode? The memory regions might be very different. |
|||
![]() |
|
JohnFound
Yes, I am sure that this is what I have to do. Maybe Linux64 has some syscall about changing modes?
|
|||
![]() |
|
LocoDelAssembly
Sorry I can´t give a thorough look into this so this link may not be helpful: http://en.wikipedia.org/wiki/X32_ABI (also notice that perhaps this is not here yet)
|
|||
![]() |
|
revolution
LocoDelAssembly wrote: Sorry I can´t give a thorough look into this so this link may not be helpful: http://en.wikipedia.org/wiki/X32_ABI (also notice that perhaps this is not here yet) |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.