lua 64-bit transitioning issue - 64-bit

I really hope there is some help to get on this subject. Has anyone ever used lua in an application that needs to have both 32-bit and 64-bit support? We are currently transitioning to 64-bit but are having trouble with client compiled lua scripts that we can't recompile ourselves using the 64-bit version. So in effect we need to be able to load bytecode files compiled using 32-bit lua in a 64-bit application. When we try to do so we receive an error message:
virtual machine mismatch in test.bin.lua: size of size_t is 8 but read 4
Well of course this is a clear 64bit transitioning problem. The hard thing is just to figure out what to do about it without the ability to recompile the binaries.
Thanks

It's not hard to adapt lundump.c to read 32-bit bytecode files. I've posted a roadmap for this in the Lua mailing list. If you have problems, please send me email.

You could try LuaDec: "LuaDec is a decompiler for the Lua language." I don't know much about it, and the website states that it targets Lua 5.0.2. So, it may not work out of the box, but it's better than starting from scratch.

Related

OpenMP in windows and Linux(CentOS)

I have a pretty big piece of code written in C++ and integrated into MATLAB via mex functionality. It was originally written in a windows machine but now that I run it on the Linux machine, it gives wrong result.
Is anyone aware of any difference between how Linux and Windows handles OS. It usually involves
#omp pragma for
I couldn't post the code here. I would really appreciate some insights into what might be wrong .

How can I convert Linux (PowerPC-based) Shared Library To X86 or X64 Linux?

I have an (xxx.so) shared library file and its based on powerpc linux.
now i want to use it in our project but first we need to convert it to X86 or X64 shared library for pc linux.
anyone can help me about this? Is it possible?
You can't: a binary file resulting from compilation of a C/C++ program is compiled for a specific Instruction Set Architecture. Since the two platforms have different instructions sets, you cannot convert the library of an architecture to the other. You need therefore to recompile the library.
First I would say that if you are trying to use functions from a library on one linux to another then there is a very good chance the library is available (somewhere) for your target machine. The odds are that the source code should be available.
If the library is specific to tat version of Linux then you should not be using it for cross platform work.
That said in principle you can :
Run the powerpc version of linux on an x86 or x64 system using a VM.
Try the the decompile-recompile route already suggested to you.
Write your own equivalent library for the target.
See if anyone has written a binary translation application for this purpose.
But if the library you want to use is simply not available for the system you are targeting, then you quite simply should not be trying to use it. It's practically suicidal programming practice.

Native windows Linux

I know about several projects for cross compiling between linux and Windows.
The Wine project is great for running windows application inside Linux.
andLinux is a linux running inside Windows.
My question is, can we compile a complete linux OS with a Windows compiler (like mingw32, visual studio , ...) in order to get a linux system which is fully compatible with the Windows PE executable format ?
As wine demonstrates, the PE format isn't really the problem with compatibility.
PE only defines how the program is pieced together at load time. Under windows, RUNDLL interprets it, loads all the program sections to memory, loads all the supporting dlls to memory and patches up the function pointers so that there is a program sitting in memory ready to go. (See http://msdn.microsoft.com/en-us/library/ms809762.aspx for more details. Its a good read!)
There is little stopping you writing a kernel module to do all of this. With the details in the page linked above it may not be to hard and someone may already have done it.
The real issue is the fundamentals of the operating system. Even if linux could load a PE, there would be problems around the fundamental difference in file names (\ or /) as well as the permissions model which is different and the windows registry which doesn't exist under linux. That's before you get into the different windowing model for GUIs.
Therefore the task of getting a windows program to run under linux is less about the program loader and much more about emulating all of the windows DLLs under Linux. As i understand it, this is the main heart of wine.

Is there any way to recompile binaries from x86 to ARM on linux?

I'd like to collect some ideas about the solution of following problem.
I've got a TOF camera, and its driver for linux x86/64. It works fine. But in fact the camera would be used on an ARM based embedded device if that's possible.
Questions:
should I have to decompile the driver binaries and recompile with ARM compiler? is there any available decompiler tool?
is there any ARM>>x86 emulator which is available?
any other ideas?
ps: the pure source is very expensive, so I don't like to purchase it anyway :)
AFAIK, as of today, there's no such decompiler that will generate compilable code from machine code. You will have to manually fix (usually a LOT of fixes) the generated code. You can check this question for Linux decompilers.
Check QEmu. Underlying architecture is not relevant as long as you can execute it ;)
There's not much besides what you've stated.
What you're attempting is (in part) reverse engineering. RE is a complex process and requires great knowledge in the thing you're attempting to reverse; in your case camera drivers. If you have knowledge in this area, go ahead. If you don't, I wouldn't waste my time on it (or get the knowledge first ;))
See the following answer for details. It lists some of the problems you could encounter attempting to automate such a translation:
Convert object file to another architecture
Recently created Eltechs ExaGear Server, available on ARM as A Service, runs x86 applications on ARM devices.
It is new and proprietary, but it does exist.
If your driver is a kernel object, there is no emulator (to my knowledge) capable of running x86 kernel code inside ARM kernel. If your "driver" is in fact a userspace library hacked on top of a generic driver (v4l2, etc.), you may have luck with QEMU or Exagear mentioned here. As a side note, you will probably end up with an x86 application software, too, as calling an x86 library from ARM code is not supported by QEMU or Exagear out of the box.

DDK/WDM developing problem ... driver won't load on x64 windows platform

I am a beginner at DDK/WDM driver developing field.
I have a task which involves porting a virtual device driver from x86 to x64 (intel).
I got the source code, I modified it a bit and compiled it succesfuly with DDK (build environments). But when I tried to load it on a ia64 Windows7 machine it didn't want to load.
Then I tried some simple examples of device drivers from
--http://www.codeproject.com/KB/system/driverdev.aspx (I put '--' to be able to post the hyperlink) and from other links but still the same problem.
I hear on a forum that some libraries that you use to link are not compatible with the new machines and suggested to link to another similar libraries...but still didn't worked.
When I build I use "-cefw" command line parameters as suggested.
I do not have an *.inf file asociated but I'm copying it in system32/drivers and I'm using WinObj to see if next restart it's loaded into the memory.
I also tried this program ( http://www.codeproject.com/KB/system/tdriver.aspx ) to load the driver into the memory but still didn't worked for me.
Please please help me...I'm stuck on this and my deadline already passed.
I feel I'driving nuts in here trying to discover what am I doing wrong.
So, to summarize everything:
You need to build for the corect architecture (x64 for Intel/AMD CPUs).
You MUST sign your driver. You must do this even in test mode with a self signed certificate. There is no alternative.
You MUST use an .inf file to install. If the driver is non-pnp then you don't need an .inf file, but it is very unlikely that the driver is non-pnp. In that case you need to manually create the associated service for the driver in the service control manager with sc.exe or programmatically with the SCM API. If the driver isw pnp (most likely) you must install it via an .inf file (with devcon.exe or other way). Also, installing it is not the same as loading it. For that, the appropriate hardware must be present or you must enumerate it in software (with devcon.exe for exemple).
I did not wrote a driver, but on the basis on what I hear from colleagues: Are your driver digitaly signed? If not, look for information on loading unsigned drivers on 64bit systems.
Two things:
You mention both x64 (also called x86-64, AMD64, or EMT64) and IA64 (Itanium). You understand they are two completely different architectures, right? Do you have an Itanium System? If not, you should not be compiling anything using the IA-64 build environment. It won't run on a standard PC (32 or 64).
Under 64-bit, the driver must digitally signed for production use. You will need to get an Authenticode certificate from Verisign or similar. For testing purposes, you can bypass the signature check by pressing F8 at boot time. You can also sign with a test certificate.
http://www.microsoft.com/whdc/winlogo/drvsign/drvsign.mspx

Resources