KeystoneAssembler.hpp 839 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #pragma once
  2. #include "ExceptionKeystone.hpp"
  3. #include <ResourceOwned.hpp>
  4. #include "ResourceTraitsKeystone.hpp"
  5. #include <vector>
  6. namespace nkg {
  7. class KeystoneEngine;
  8. class KeystoneAssembler {
  9. friend class KeystoneEngine;
  10. private:
  11. const KeystoneEngine& _Engine;
  12. KeystoneAssembler(const KeystoneEngine& Engine) noexcept;
  13. public:
  14. [[nodiscard]]
  15. std::vector<uint8_t> GenerateMachineCode(const char* AssemblyCode, uint64_t Address = 0) const;
  16. };
  17. class KeystoneEngine : private ResourceOwned<KeystoneHandleTraits> {
  18. friend class KeystoneAssembler;
  19. public:
  20. KeystoneEngine(ks_arch ArchType, ks_mode Mode);
  21. void Option(ks_opt_type Type, ks_opt_value Value);
  22. [[nodiscard]]
  23. KeystoneAssembler CreateAssembler() const;
  24. };
  25. }