Skip to content

Instantly share code, notes, and snippets.

@aras-p
Last active May 26, 2023 04:28
Show Gist options
  • Save aras-p/5389747 to your computer and use it in GitHub Desktop.
Save aras-p/5389747 to your computer and use it in GitHub Desktop.
How to set %gs base on Darwin
# _seems_ to make %gs base point to address in %rdi
# on x86-64 Darwin
#
# (what would be amd64_set_gsbase on FreeBSD, or
# arch_prctl with ARCH_SET_GS on Linux)
#
# Could find exacty zero documentation on this!
movl $0x3000003, %eax;
syscall;
@ultimaweapon
Copy link

Do you know is it possible to set %fs from user-space application?

@aras-p
Copy link
Author

aras-p commented May 26, 2023

No idea!

@ultimaweapon
Copy link

Thank you for your quick response!

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