Skip to content

Implement support for x86 macOS (i386)#1648

Open
ciciplusplus wants to merge 40 commits into
qilingframework:devfrom
ciciplusplus:macos-x86
Open

Implement support for x86 macOS (i386)#1648
ciciplusplus wants to merge 40 commits into
qilingframework:devfrom
ciciplusplus:macos-x86

Conversation

@ciciplusplus

@ciciplusplus ciciplusplus commented Jul 8, 2026

Copy link
Copy Markdown

Checklist

Which kind of PR do you create?

  • This PR only contains minor fixes.
  • This PR contains major feature update.
  • This PR introduces a new function/api for Qiling Framework.

Coding convention?

  • The new code conforms to Qiling Framework naming convention.
  • The imports are arranged properly.
  • Essential comments are added.
  • The reference of the new code is pointed out.

Extra tests?

  • No extra tests are needed for this PR.
  • I have added enough tests for this PR.
  • Tests will be added after some discussion and review.

Changelog?

  • This PR doesn't need to update Changelog.
  • Changelog will be updated after some proper review.
  • Changelog has been updated in my PR.

Target branch?

  • The target branch is dev branch.

One last thing


Known issues

  • qtool was changed to add /dev/urandom fs mapping. Probably it should be another cli option to define a list of guest to host fs mapping
  • ql_syscall_thread_fast_set_cthread_self implementation for x86 is probably incorrect (i just copied 64 variant)
  • posix open flags for arm64 host were copied from x8664 host. (maybe better to use this instead)
  • Some functions which are suppose to reside in commpage implemented with jump call to my_ prefixed host functions. Could be not the cleanest solution, open to refactoring suggestions/other approaches.

Additional fixes

Below fixes are not necessary related to x86 support and could be merged separately if preferred:

  • GDB now supported on macOS host
  • Fix for GDB instructions step and stepi (which both previously make emu_state STOPPED)
  • Fix ql_syscall_write_nocancel to return number of bytes written
  • Fix ql_syscall_pread
  • Replace mmap2 with mmap on macOS

Dependencies

rootfs/x86_macos should have following files:

Linker

  • /usr/lib/dyld

Dylibs

  • /usr/lib/libgcc_s.1.dylib
  • /usr/lib/libSystem.B.dylib
  • /usr/lib/system/libmathCommon.A.dylib

Run example

% ./qltool run -f examples/rootfs/x86_macos/bin/x86_hello --rootfs examples/rootfs/x86_macos --verbose off
Hello, World!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant