Giter Site home page Giter Site logo

Comments (12)

rinilnath avatar rinilnath commented on June 29, 2024 1

Hi Pyves !

We found that this way is not practical for our requirement, because we eventually have to end up in re writing 18 Assembly programs that was built on COBOL Zos architecture to be compatible Windows just for sake of local testing and then it cannot be put them back into production.

We proceeded my manually coding the logic in Java and plug off the old Assembly codes

But your tweak i will test it soon and comment the results !

from javassembly.

PyvesB avatar PyvesB commented on June 29, 2024

Hello @rinilnath,

It should work on Windows as well, even though I haven't actually tried. The NASM assembler is also distributed on Windows and I would suggest giving MinGW a try rather than Clang/native GCC. Let me know if you manage to get things running! 😉

Cheers,

Pyves

from javassembly.

rinilnath avatar rinilnath commented on June 29, 2024

Hi There!

I tried with GCC , the .SO file got generated, but on running the Java program.
I am getting the EXCEPTION_ACCESS_VIOLATION. I have attached the log and error screen shot.
hs_err_pid6632.log
ErrorFatal

Have you ever seen this before, please help !

from javassembly.

PyvesB avatar PyvesB commented on June 29, 2024

Interesting. In the build script, did you replace elf64 by win64?

from javassembly.

rinilnath avatar rinilnath commented on June 29, 2024

yes.. i did it . :)
I made another correction in gcc
gcc -shared -o libArraySum.so ArraySum.o

because for my windows -z and -noexecstack was throwing invalid parameters errors
so i removed both. I dont know what it specifically does though

from javassembly.

PyvesB avatar PyvesB commented on June 29, 2024

I'll try to find some time to give a try on my Windows machine over the weekend.

from javassembly.

rinilnath avatar rinilnath commented on June 29, 2024

Thanks Much, please do let me know. I guess the problem is with the file object loading that library arraysum.so,

from javassembly.

rinilnath avatar rinilnath commented on June 29, 2024

I wondered does that .so file shared object is only meant to Linux world and not used in windows.
It needs to be like .dll right ?
Will that gcc can make that object file into the dll library. What you think ?

from javassembly.

PyvesB avatar PyvesB commented on June 29, 2024

Yes, it probably needs to be a .dll, but I wouldn't expect the GCC command to be much different.

Not needed when using MinGW on Windows.

from javassembly.

rinilnath avatar rinilnath commented on June 29, 2024

I tried in DLL , still same error

from javassembly.

PyvesB avatar PyvesB commented on June 29, 2024

Okay, mystery solved! For some reason, I had the idea that calling conventions for registers were architecture-specific. Turns out they're also OS-specific. On Windows, one must follow the conventions as documented here. In particular:

  • arguments are passed in rcx, rdx, r8, r9 and subsequent ones on the stack rather than rdi, rsi, rdx, rcx, r8, r9 and subsequent ones on the stack.
  • a four-parameter stack space must be allocated and the stack must be 16-bit aligned before performing a JNI function call.

In others words, when run on Windows, the assembly was trying to perform function calls at pretty much random positions in memory, hence the EXCEPTION_ACCESS_VIOLATION errors you were getting.

I've committed a slightly different version of the assembly code alongside a small .bat script, it runs successfully on my Windows machine. Let me know if this makes sense and if the revised Windows code works for you as well!

from javassembly.

PyvesB avatar PyvesB commented on June 29, 2024

Any luck with my help @rinilnath?

from javassembly.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.