Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Oct 19 09:43
    lifeengines opened #310
  • Oct 18 22:53
    kobalicek labeled #309
  • Oct 18 22:53
    kobalicek commented #309
  • Oct 18 17:29
    AndroDevcd commented #309
  • Oct 18 17:22
    AndroDevcd commented #309
  • Oct 18 17:21
    AndroDevcd commented #309
  • Oct 18 17:14
    AndroDevcd edited #309
  • Oct 18 16:52
    AndroDevcd opened #309
  • Oct 17 20:02
    kobalicek labeled #304
  • Oct 17 20:01
    kobalicek commented #306
  • Oct 17 19:59
    kobalicek labeled #308
  • Oct 17 19:58
    kobalicek commented #308
  • Oct 17 19:06
    Nekotekina opened #308
  • Oct 17 18:29
    Nekotekina closed #307
  • Oct 17 18:29
    Nekotekina commented #307
  • Oct 17 17:59
    kobalicek commented #307
  • Oct 17 17:33
    Nekotekina opened #307
  • Oct 07 14:50

    kobalicek on master

    [CMake] Include GNUInstallDirs … (compare)

  • Oct 05 01:33
    vogelsgesang opened #306
  • Oct 05 01:06
    vogelsgesang commented #296
ζeh Matt
@ZehMatt
:+1:
shuang
@linghushuang
Hi, every one, I would like to know that how do I to write a pushad asm insn under the win64 platform assembler. I think here need a macro to control this, but I see all the examples and get no results. who know this question? Thanks very much.
Petr Kobalicek
@kobalicek
There is no pushad in 64-bit mode, you cannot encode it
shuang
@linghushuang
Thanks, got it, I forgot my program to run the x64 environment, so pushad couldnot execute correct.
shuang
@linghushuang
@kobalicek I still have the a questtion that does asmjit project have the macro of controling x86/x64 instuctions, because I would like to encode instructions of both x86 and x64 only in one x64 environment.
Petr Kobalicek
@kobalicek
There are no compile-time macros, asmjit has a full cross-compiling support that can be controlled via Environment.
Environment env;
env.setArch(Environment::kArchX86); // 32-bit

CodeHolder code;
code.init(env);

x86::Assembler a(code);
// you have a 32-bit x86 assembler even if you are on ARM.
shuang
@linghushuang
@kobalicek Got it and thanks again.
Petr Kobalicek
@kobalicek
Welcome!
Иван Сердюк
@oceanfish81_twitter
is it possible to configure a more straightforward arch. config.?

$ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_FLAGS=' -stdlib=libc++ ' -G Ninja ..
CMake Warning (dev) at /usr/share/cmake-3.18/Modules/GNUInstallDirs.cmake:225 (message):
Unable to determine default CMAKE_INSTALL_LIBDIR directory because no
target architecture is known. Please enable at least one language before
including GNUInstallDirs.
Call Stack (most recent call first):
CMakeLists.txt:14 (include)
This warning is for project developers. Use -Wno-dev to suppress it.

-- The CXX compiler identification is Clang 12.0.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CxxFlagfno_threadsafe_statics
-- Performing Test CxxFlagfno_threadsafe_statics - Success
-- Performing Test CxxFlagfno_semantic_interposition
-- Performing Test CxxFlagfno_semantic_interposition - Success
-- Performing Test CxxFlagfmerge_all_constants
-- Performing Test CxxFlagfmerge_all_constants - Success
-- Performing Test CxxFlagfno_enforce_eh_specs
-- Performing Test CxxFlagfno_enforce_eh_specs - Failed
AsmJit Summary
ASMJIT_DIR=/home/oceanfish81/asmjit
ASMJIT_TEST=FALSE
ASMJIT_TARGET_TYPE=SHARED
ASMJIT_DEPS=pthread;rt
ASMJIT_LIBS=asmjit;pthread;rt
ASMJIT_CFLAGS=
ASMJIT_PRIVATE_CFLAGS=-Wall;-Wextra;-Wconversion;-fno-math-errno;-fno-threadsafe-statics;-fno-semantic-interposition
ASMJIT_PRIVATE_CFLAGS_DBG=
ASMJIT_PRIVATE_CFLAGS_REL=-O2;-fmerge-all-constants
-- Configuring done
-- Generating done
-- Build files have been written to: /home/oceanfish81/asmjit/build

Petr Kobalicek
@kobalicek
I think moving the two includes after project(...) would be the best for now?
Pushed
fred26
@fred26
Quick question, how can you call an external function? Let's say memcpy or a win32 such as MessageBox? Thanks
Petr Kobalicek
@kobalicek
it depends what tool do you use, with Assembler/Builder you would have to assemble that call, with Compiler you can use the invoke() helper to do that
fred26
@fred26
do you have link to a working snippet with the Assembler approach?
thanks for the help
Petr Kobalicek
@kobalicek
Well it depends on architecture and operating system. As you said, you can always mov, push, etc, but you have to be careful with registers and stack.
fred26
@fred26
ok thanks
Petr Kobalicek
@kobalicek
Calling arbitrary functions is not that easy, some calling conventions are pretty complex
fred26
@fred26
ok thanks. I am revising this link:
a.call(asmjit::imm_ptr(puts));
this actually makes the call to the puts pointer?
Petr Kobalicek
@kobalicek
I would recommend moving the address to a register first
you would be okay in 64-bit mode
fred26
@fred26
ok thanks
Petr Kobalicek
@kobalicek
a.mov(reg, imm(puts));
a.call(reg);
fred26
@fred26
thanks @kobalicek
Petr Kobalicek
@kobalicek
that's a safe way of doing the call, you can still use the call(ptr), but it has some downsides and it may require to put that address in memory
which AsmJit would do automatically, but it's good to know
fred26
@fred26
great, thanks
Petr Kobalicek
@kobalicek
btw don't forget to read about calling conventions that you target, it's better than figuring out why the app crashed 100 instructions after the call, for example
I was there :)
fred26
@fred26
Ok good. I am working with x64 Windows ABI
so it is straightforward. Thanks
Tehc
@TehcJS
Am I able to use this as some kind of runtime decompiler/AST?
Petr Kobalicek
@kobalicek
AsmJit is not a disassembler, so I guess not
A. Tammy
@epsilon-0
hello :)
i was wondering if there was any plans on making releases?
currently it is a bit hard to package this for repositories
Petr Kobalicek
@kobalicek
I don't know to be honest - What about year.month.day - like 2020.10.11 would be today's release?
At the moment AsmJit states it's 1.4.0 - but it's been like that for years
SunViero
@SunViero
Hello :) I want testing Arch64. I have code for x86, which is interesting to port to ARM. I will be glad to provide feedback and support in finding errors and inconveniences
Petr Kobalicek
@kobalicek
@SunViero There is aarch64 branch that provides the initial impl, let me know if you find any problems
Buckell
@Buckell
I was messing around and I came up with this code (https://pastebin.com/eKL6x3kM) to try and get a value from a map using a string as an index. Though, whenever I run it, I get a InvalidVirtId (31) error thrown by finalize(). Looking at the documentation, all I can see is the error is caused by an "invalid virtual register id." Can someone tell me exactly what that means and how I would go about fixing it if it's a bug in my code? (I'm using the latest AsmJit code from the master branch on GitHub, VS2019 w/ MSVC++ 14.27, Windows 10, and C++17; if any of that helps.)
Petr Kobalicek
@kobalicek
You should only use virtual registers with Compiler - there is documentation and tests that should explain how virtual registers are created and used.
Buckell
@Buckell
Alright, thank you
dennis
@nagolove

I misspoke; I'm including windows.h before x86.h. Either way, it would be nice if I could eliminate the warning without having to #undef THIS.

I had the same issue with includes order.

Petr Kobalicek
@kobalicek
Which warning?
SunViero
@SunViero
@kobalicek Ok, thanks