KeystoneAssembler.hpp 888 B

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