remove dobby

This commit is contained in:
matcool 2022-12-12 21:29:48 -03:00
parent 2c3520f454
commit 5cd199e264
No known key found for this signature in database
GPG key ID: BF58756086D7AB1C
426 changed files with 0 additions and 74247 deletions
loader/dobby
.clang-format
.github/workflows
.gitignoreCMakeLists.txtLICENSEREADME.mdREADME_zh-cn.md
build-workspace
auto-build.sh
prefab
AndroidManifest.xml
modules/dobby
libs
android.arm64-v8a
android.armeabi-v7a
android.x86
android.x86_64
module.json
prefab.json
builtin-plugin

View file

@ -1,18 +0,0 @@
BasedOnStyle: LLVM
IndentWidth: 2
TabWidth: 2
UseTab: Never
ColumnLimit: 120
FixNamespaceComments: true
# default is false
#AlignConsecutiveMacros: true
#AlignConsecutiveAssignments: true
#AlignConsecutiveDeclarations: true
# default is true
ReflowComments: false
SortIncludes : false
AllowShortFunctionsOnASingleLine: false

View file

@ -1,54 +0,0 @@
name: Darwin Auto Build
on:
push:
branches:
- master
jobs:
default:
runs-on: macOS-latest
steps:
- name: checkout master
uses: actions/checkout@master
- name: auto build
run: |
export ANDROID_NDK_DIR=$ANDROID_NDK_18R_PATH
current_date_time="`date +%Y%m%d`";
export DOBBY_BUILD_OUTPUT_NAME=dobby_static_${current_date_time}.tar.gz
./build-workspace/auto-build.sh
echo "DOBBY_BUILD_OUTPUT_NAME=$DOBBY_BUILD_OUTPUT_NAME" >> $GITHUB_ENV
shell: bash
- name: print output
run: |
ls -lha .
echo "output=$DOBBY_BUILD_OUTPUT_NAME"
- name: Delete old release assets
uses: mknejp/delete-release-assets@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: latest
assets: "*.tar.gz"
fail-if-no-assets: false
fail-if-no-release: false
- name: update tag
uses: richardsimko/update-tag@master
with:
tag_name: latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update release
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: latest
name: release ${{ github.ref }}
body: "dobby static library update for darwin and android"
artifacts: "./${{ env.DOBBY_BUILD_OUTPUT_NAME }}"
allowUpdates: true
replacesArtifacts: true

View file

@ -1,80 +0,0 @@
.DS_Store
.idea/
*-build*/
build-output/
CMakeLists.txt.user
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
Makefile
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
_deps
## Build generated
build/
DerivedData/
## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata/
## Other
*.moved-aside
*.xccheckout
*.xcscmblueprint
## Obj-C/Swift specific
*.hmap
*.ipa
*.dSYM.zip
*.dSYM
# Prerequisites
*.d
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Fortran module files
*.mod
*.smod
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app
# Prefab
/prefab/**/*.a
/prefab/**/*.h
/AndroidManifest.xml

View file

@ -1,439 +0,0 @@
cmake_minimum_required(VERSION 3.5)
project(Dobby)
enable_language(ASM)
include(cmake/Util.cmake)
include(cmake/Globals.cmake)
include(cmake/Macros.cmake)
include(cmake/XcodeGenerator.cmake)
include(cmake/AutoFiles.cmake)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_C_STANDARD 11)
AutoFiles("." "CmakeSource" "\\.(cc|cpp|c|h)$")
# :< You Shall Not Pass!
if(0)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror")
endif()
# ===== Handle Option =====
option(DOBBY_GENERATE_SHARED "Build shared library" OFF)
option(DOBBY_DEBUG "Enable debug logging" OFF)
option(NearBranch "Enable Near Branch Trampoline" ON)
option(DynamicBinaryInstrument "Enable Dynamic Binary Instrument" OFF)
option(FullFloatingPointRegisterPack "Save and pack all floating-point registers" OFF)
option(EnableObfuscation "Enable llvm obfuscation" OFF)
option(Plugin.SymbolResolver "Resolve symbol by [DobbySymbolResolver] " OFF)
option(Plugin.GlobalOffsetTableHook "Global Offset Table Hook by [DobbyGlobalOffsetTableReplace] " OFF)
option(Plugin.LinkerLoadCallback "Register image load callback " OFF)
# frida is better choice
option(Plugin.ApplicationEventMonitor "Auto monitor linker, file, etc." OFF)
option(Plugin.Android.BionicLinkerRestriction "Enable android bionic linker restriction" OFF)
# Use native assembly bridge to replace the runtime codegen
# if(CLOSURE_BRIDGE_TEMPLATE)
# SET(CMAKE_ASM_FLAGS "${CMAKE_C_FLAGS}")
# enable_language(ASM)
# add_definitions(-DENABLE_CLOSURE_BRIDGE_TEMPLATE)
# endif()
# Enable debug will log more information
if ((NOT DEFINED CMAKE_BUILD_TYPE) OR (CMAKE_BUILD_TYPE STREQUAL "Debug"))
message(STATUS "[Dobby] Enabling debug logging because CMAKE_BUILD_TYPE is Debug or undefined")
set(DOBBY_DEBUG ON)
endif()
if(DOBBY_DEBUG)
add_definitions(-DDOBBY_DEBUG)
add_definitions(-DLOGGING_DEBUG)
message(STATUS "[Dobby] Enable debug logging")
endif()
# Enable full floating point register pack
# for arm64, allow access q8 - q31
if(FullFloatingPointRegisterPack)
add_definitions(-DFULL_FLOATING_POINT_REGISTER_PACK)
message(STATUS "[Dobby] Save and pack all floating-point registers")
endif()
if(SYSTEM.Darwin)
# -lstdc++
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -stdlib=libc++")
if (NOT DOBBY_DEBUG)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-x -Wl,-S")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-exported_symbol,_log_internal_impl -Wl,-exported_symbol,_log_set_level")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-exported_symbol,_CodePatch")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-exported_symbol,_DobbyBuildVersion -Wl,-exported_symbol,_DobbyHook -Wl,-exported_symbol,_DobbyDestroy")
# set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-exported_symbol,_DobbyGlobalOffsetTableReplace")
# set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-exported_symbol,_DobbySymbolResolver")
# set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-exported_symbol,_intercept_routing_common_bridge_handler")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-exported_symbol,_dobby_enable_near_branch_trampoline -Wl,-exported_symbol,_dobby_disable_near_branch_trampoline")
endif()
elseif(SYSTEM.Android)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fomit-frame-pointer")
if(NOT DOBBY_DEBUG)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffunction-sections -fdata-sections")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--gc-sections -Wl,--exclude-libs,ALL")
endif()
elseif(SYSTEM.Linux)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
elseif(SYSTEM.Windows)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_DEPRECATE)
if(NOT DOBBY_DEBUG)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /export:log_internal_impl")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /export:DobbyHook /export:DobbyDestroy")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /export:dobby_enable_near_branch_trampoline /export:dobby_disable_near_branch_trampoline")
endif()
endif()
if(COMPILER.Clang)
if(NOT DOBBY_DEBUG)
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden")
endif()
if(PROCESSOR.ARM)
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -arch armv7 -x assembler-with-cpp")
elseif(PROCESSOR.AARCH64)
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -arch arm64 -x assembler-with-cpp")
endif()
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS}")
message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
message(STATUS "CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}")
message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
message(STATUS "CMAKE_SHARED_LINKER_FLAGS: ${CMAKE_SHARED_LINKER_FLAGS}")
# arch prefix
if(PROCESSOR.ARM)
set(ARCH1 ARM)
set(arch1 arm)
set(core_arch arm)
elseif(PROCESSOR.AARCH64)
set(ARCH1 ARM64)
set(arch1 arm64)
set(core_arch arm64)
elseif(PROCESSOR.X86)
set(ARCH1 X86)
set(arch1 x86)
set(core_arch ia32)
elseif(PROCESSOR.X86_64)
set(ARCH1 X64)
set(arch1 x64)
set(core_arch x64)
else()
endif()
# system prefix
if(SYSTEM.Darwin OR SYSTEM.iOS OR SYSTEM.macOS)
set(platform1 posix)
set(platform2 Darwin)
elseif(SYSTEM.Linux OR SYSTEM.Android)
set(platform1 posix)
set(platform2 Linux)
elseif(SYSTEM.Windows)
set(platform1 windows)
set(platform2 Windows)
else()
endif()
if(CMAKE_GENERATOR STREQUAL Xcode)
endif()
include(cmake/dobby.xcode.source.cmake)
include_directories(
.
./include
./source
./source/include
./source/UserMode
./external
./external/logging
./external/xnucxx
./external/misc-helper
builtin-plugin
)
set(DOBBY_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(dobby.SOURCE_FILE_LIST ${dobby.SOURCE_FILE_LIST}
# cpu
source/core/arch/CpuFeature.cc
source/core/arch/CpuRegister.cc
# assembler
source/core/modules/assembler/assembler.cc
source/core/modules/assembler/assembler-${core_arch}.cc
# codegen
source/core/modules/codegen/codegen-${core_arch}.cc
# memory kit
source/MemoryAllocator/CodeBuffer/CodeBufferBase.cc
source/MemoryAllocator/CodeBuffer/code-buffer-${arch1}.cc
source/MemoryAllocator/AssemblyCodeBuilder.cc
source/MemoryAllocator/MemoryArena.cc
# instruction relocation
source/InstructionRelocation/${arch1}/${ARCH1}InstructionRelocation.cc
# intercept routing
source/InterceptRouting/InterceptRouting.cpp
# intercept routing trampoline
source/TrampolineBridge/Trampoline/${arch1}/trampoline-${arch1}.cc
# intercept routing plugin (buildin)
source/InterceptRouting/Routing/FunctionInlineReplace/function-inline-replace.cc
source/InterceptRouting/Routing/FunctionInlineReplace/FunctionInlineReplaceExport.cc
# plugin register
source/InterceptRouting/RoutingPlugin/RoutingPlugin.cc
# platform util
source/UserMode/PlatformUtil/${platform2}/ProcessRuntimeUtility.cc
# user mode - platform interface
source/UserMode/UnifiedInterface/platform-${platform1}.cc
# user mode - executable memory
source/UserMode/ExecMemory/code-patch-tool-${platform1}.cc
source/UserMode/ExecMemory/clear-cache-tool-all.c
# main
source/dobby.cpp
source/Interceptor.cpp
)
if (PROCESSOR.X86_64 OR PROCESSOR.X86)
set(NearBranch ON)
if (PROCESSOR.X86_64)
add_definitions(-DDETOURS_X64)
endif()
endif()
if(SYSTEM.Darwin)
include_directories(
source/UserMode/ExecMemory/substrated/include
)
set(dobby.SOURCE_FILE_LIST ${dobby.SOURCE_FILE_LIST}
source/UserMode/ExecMemory/code-patch-tool-darwin.cc
)
endif()
if(SYSTEM.iOS)
add_definitions(-DCODE_PATCH_WITH_SUBSTRATED)
set(dobby.SOURCE_FILE_LIST ${dobby.SOURCE_FILE_LIST}
source/UserMode/ExecMemory/substrated/mach_interface_support/substrated_client.c
)
endif()
if(FunctionWrapper OR DynamicBinaryInstrument)
set(dobby.SOURCE_FILE_LIST ${dobby.SOURCE_FILE_LIST}
# closure trampoline bridge
source/TrampolineBridge/ClosureTrampolineBridge/common-bridge-handler.cc
source/TrampolineBridge/ClosureTrampolineBridge/${arch1}/helper-${arch1}.cc
source/TrampolineBridge/ClosureTrampolineBridge/${arch1}/closure-bridge-${arch1}.cc
source/TrampolineBridge/ClosureTrampolineBridge/${arch1}/${ARCH1}AssemblyClosureTrampoline.cc
# user mode - multi thread support
# source/UserMode/MultiThreadSupport/ThreadSupport.cpp
# source/UserMode/Thread/PlatformThread.cc
# source/UserMode/Thread/platform-thread-${platform1}.cc
)
endif()
if(FunctionWrapper)
message(FATAL_ERROR "[!] FunctionWrapper plugin is not supported")
endif()
if(DynamicBinaryInstrument)
message(STATUS "[Dobby] Enable dynamic binary instrument(hook instruction with register context)")
set(dobby.SOURCE_FILE_LIST ${dobby.SOURCE_FILE_LIST}
source/InterceptRouting/Routing/DynamicBinaryInstrument/dynamic-binary-instrument.cc
source/InterceptRouting/Routing/DynamicBinaryInstrument/DynamicBinaryInstrumentExport.cc
source/InterceptRouting/Routing/DynamicBinaryInstrument/intercept_routing_handler.cc
)
endif()
if(NearBranch)
message(STATUS "[Dobby] Enable near branch trampoline(trampoline within single instruction)")
set(dobby.SOURCE_FILE_LIST ${dobby.SOURCE_FILE_LIST}
source/InterceptRouting/RoutingPlugin/NearBranchTrampoline/NeaBranchTrampoline.cc
source/MemoryAllocator/NearMemoryArena.cc)
endif()
add_subdirectory(external/misc-helper)
get_target_property(misc_helper.SOURCE_FILE_LIST misc_helper SOURCES)
# add logging library
add_subdirectory(external/logging)
get_target_property(logging.SOURCE_FILE_LIST logging SOURCES)
# add xnucxx library
add_subdirectory(external/xnucxx)
get_target_property(xnucxx.SOURCE_FILE_LIST xnucxx SOURCES)
if(Plugin.GlobalOffsetTableHook AND SYSTEM.Darwin)
message(STATUS "[Dobby] Enable global offset table hook")
include_directories(builtin-plugin/GlobalOffsetTableHook)
add_subdirectory(builtin-plugin/GlobalOffsetTableHook)
get_target_property(global_offset_table_hook.SOURCE_FILE_LIST global_offset_table_hook SOURCES)
set(dobby.plugin.SOURCE_FILE_LIST ${dobby.plugin.SOURCE_FILE_LIST}
${global_offset_table_hook.SOURCE_FILE_LIST}
)
endif()
if(Plugin.SymbolResolver)
message(STATUS "[Dobby] Enable symbol resolver")
include_directories(builtin-plugin/SymbolResolver)
add_subdirectory(builtin-plugin/SymbolResolver)
get_target_property(symbol_resolver.SOURCE_FILE_LIST symbol_resolver SOURCES)
set(dobby.plugin.SOURCE_FILE_LIST ${dobby.plugin.SOURCE_FILE_LIST}
${symbol_resolver.SOURCE_FILE_LIST}
)
endif()
if(Plugin.Android.BionicLinkerRestriction)
if(NOT SYSTEM.Android)
message(FATAL_ERROR "[!] Plugin.Android.BionicLinkerRestriction only works on Android.")
endif()
message(STATUS "[Dobby] Enable Plugin.Android.BionicLinkerRestriction")
set(dobby.plugin.SOURCE_FILE_LIST ${dobby.plugin.SOURCE_FILE_LIST}
builtin-plugin/BionicLinkerRestriction/bionic_linker_restriction.cc
)
endif()
if(Plugin.HideSystemCall)
set(dobby.plugin.SOURCE_FILE_LIST ${dobby.plugin.SOURCE_FILE_LIST}
)
endif()
if(Plugin.LinkerLoadCallback)
set(dobby.plugin.SOURCE_FILE_LIST ${dobby.plugin.SOURCE_FILE_LIST}
builtin-plugin/LinkerImageLoadCallback/linker_load_callback.cc
)
endif()
set(dobby.HEADER_FILE_LIST
include/dobby.h
)
# add build version
string(TIMESTAMP TODAY "%Y%m%d")
set(VERSION_REVISION "-${TODAY}")
if (EXISTS "${CMAKE_SOURCE_DIR}/.git")
execute_process(
COMMAND git rev-parse --short --verify HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE VERSION_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(VERSION_COMMIT_HASH)
set(VERSION_REVISION "${VERSION_REVISION}-${VERSION_COMMIT_HASH}")
endif()
endif()
set(DOBBY_BUILD_VERSION "Dobby${VERSION_REVISION}")
add_definitions(-D__DOBBY_BUILD_VERSION__="${DOBBY_BUILD_VERSION}")
message(STATUS "[Dobby] ${DOBBY_BUILD_VERSION}")
if(DOBBY_GENERATE_SHARED)
message(STATUS "[Dobby] Generate shared library")
set(DOBBY_LIBRARY_TYPE SHARED)
else()
message(STATUS "[Dobby] Generate static library")
set(DOBBY_LIBRARY_TYPE STATIC)
endif()
add_library(dobby ${DOBBY_LIBRARY_TYPE} ${dobby.HEADER_FILE_LIST} ${dobby.SOURCE_FILE_LIST} ${logging.SOURCE_FILE_LIST} ${xnucxx.SOURCE_FILE_LIST} ${dobby.plugin.SOURCE_FILE_LIST})
target_include_directories(dobby PUBLIC include)
if(EnableObfuscation)
set(linker_flags "${linker_flags} -Wl,-mllvm -Wl,-obfuscator-conf=all")
endif()
set_target_properties(dobby
PROPERTIES LINK_FLAGS "${linker_flags}"
)
if(SYSTEM.Darwin)
# set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR TRUE)
set(CMAKE_INSTALL_NAME_DIR "@rpath")
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,")
add_library(DobbyX ${DOBBY_LIBRARY_TYPE} ${dobby.HEADER_FILE_LIST} ${dobby.SOURCE_FILE_LIST} ${logging.SOURCE_FILE_LIST} ${xnucxx.SOURCE_FILE_LIST} ${dobby.plugin.SOURCE_FILE_LIST})
set_target_properties(DobbyX
PROPERTIES LINK_FLAGS "${linker_flags}"
)
# set framework property
set_target_properties(DobbyX PROPERTIES
FRAMEWORK TRUE
FRAMEWORK_VERSION A
MACOSX_FRAMEWORK_IDENTIFIER "com.dobby.dobby"
# MACOSX_FRAMEWORK_INFO_PLIST Info.plist
VERSION 1.0.0 # current version
SOVERSION 1.0.0 # compatibility version
PUBLIC_HEADER include/dobby.h
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "Apple Development"
)
# set_target_properties(Dobby PROPERTIES
# LINK_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}"
# )
# message(STATUS "[Dobby] Enable Gollum.framework(iOS: 11.0 <= version, version <= 12.2, version == 12.4 )")
# add_custom_command(TARGET Dobby
# POST_BUILD
# COMMAND mkdir -p $<TARGET_FILE_DIR:${dobby_output_name}>/Frameworks
# COMMAND cp -R ${CMAKE_SOURCE_DIR}/buildin-plugin/Gollum_2019.12.31.framework $<TARGET_FILE_DIR:${dobby_output_name}>/Frameworks/Gollum.framework
# )
endif()
if(SYSTEM.Android)
target_link_libraries(dobby log)
endif()
if(SYSTEM.Linux)
target_link_libraries(dobby dl)
endif()
if(SYSTEM.Darwin)
target_link_libraries(DobbyX
"-framework Foundation")
endif()
if(SYSTEM.Darwin)
install(TARGETS DobbyX
FRAMEWORK DESTINATION Framework)
endif()
install(TARGETS dobby
LIBRARY DESTINATION lib)
if(SYSTEM.Darwin)
add_subdirectory(builtin-plugin/ObjcRuntimeHook)
if(PROCESSOR.AARCH64)
add_subdirectory(builtin-plugin/SupervisorCallMonitor)
endif()
endif()
# add_subdirectory(example)

View file

@ -1,201 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View file

@ -1,45 +0,0 @@
## Dobby
[![Contact me Telegram](https://img.shields.io/badge/Contact%20me-Telegram-blue.svg)](https://t.me/IOFramebuffer) [![Join group Telegram](https://img.shields.io/badge/Join%20group-Telegram-brightgreen.svg)](https://t.me/dobby_group)
Dobby a lightweight, multi-platform, multi-architecture exploit hook framework.
- Minimal and modular library
- Multi-platform support(Windows/macOS/iOS/Android/Linux)
- Multiple architecture support(X86, X86-64, ARM, ARM64)
- Clean code without STL(port to kernel easily)
- Plugin support(SymbolResolver, SupervisorCallMonitor)
- iOS kernel exploit support(Gollum ?)
## Getting started
```
git clone https://github.com/jmpews/Dobby.git --depth=1
cd Dobby/example/
mkdir build; cd build; cmake ..
```
Or download [latest release](https://github.com/jmpews/Dobby/releases/tag/latest)
#### [Build Installation](docs/build-documentation.md)
#### [Getting Started with iOS](docs/get-started-ios.md)
#### [Getting Started with Android](docs/get-started-android.md)
## Documentation
[full Installation documentation site](https://jmpews.github.io/Dobby/#/)
## Download
[download static library](https://github.com/jmpews/Dobby/releases/tag/latest)
## Credits
1. [frida-gum](https://github.com/frida/frida-gum)
2. [minhook](https://github.com/TsudaKageyu/minhook)
3. [substrate](https://github.com/jevinskie/substrate).
4. [v8](https://github.com/v8/v8)
5. [dart](https://github.com/dart-lang/sdk)
6. [vixl](https://git.linaro.org/arm/vixl.git)

View file

@ -1,3 +0,0 @@
## Dobby
**待更新**

View file

@ -1,149 +0,0 @@
#!/bin/sh
# if error, exit
set -
CURRENT_DIR=$(dirname "$0")
SOURCE_DIR=${CURRENT_DIR}/..
compress_dir_array=""
summary_output_dir_name=auto-build-output
rm -rf ${summary_output_dir_name}
# Darwin ================================================================
darwin_library_name=libdobby.a
darwin_fat_library_name=libdobby.a
# build macos x86_64
output_dir_name=auto-build-workspace/darwin-x86_64-build
echo "prepare build ${output_dir_name}"
mkdir -p ${CURRENT_DIR}/${output_dir_name}
cmake -S ${SOURCE_DIR} -B ${output_dir_name} -DCMAKE_BUILD_TYPE=Release \
-DDOBBY_GENERATE_SHARED=OFF -DDOBBY_DEBUG=OFF
cmake --build ${output_dir_name} --parallel 4 --target dobby
mkdir -p ${summary_output_dir_name}/darwin/x86_64
cp -r ${output_dir_name}/${darwin_library_name} ${summary_output_dir_name}/darwin/x86_64
# build iphone arm64
output_dir_name=auto-build-workspace/darwin-arm64-build
compress_dir_array="$compress_dir_array $output_dir_name"
echo "prepare build ${output_dir_name}"
mkdir -p ${CURRENT_DIR}/${output_dir_name}
cmake -S ${SOURCE_DIR} -B ${output_dir_name} -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_SYSTEM_PROCESSOR=arm64 -DCMAKE_OSX_DEPLOYMENT_TARGET=9.3 \
-DDOBBY_GENERATE_SHARED=OFF -DDOBBY_DEBUG=OFF
cmake --build ${output_dir_name} --parallel 4 --target dobby
mkdir -p ${summary_output_dir_name}/darwin/arm64
cp -r ${output_dir_name}/${darwin_library_name} ${summary_output_dir_name}/darwin/arm64
# build iphone arm64e
output_dir_name=auto-build-workspace/darwin-arm64e-build
compress_dir_array="$compress_dir_array $output_dir_name"
echo "prepare build ${output_dir_name}"
mkdir -p ${CURRENT_DIR}/${output_dir_name}
cmake -S ${SOURCE_DIR} -B ${output_dir_name} -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=cmake/ios.toolchain.cmake \
-DPLATFORM=OS64 -DARCHS="arm64e" -DCMAKE_SYSTEM_PROCESSOR=arm64e \
-DENABLE_BITCODE=0 -DENABLE_ARC=0 -DENABLE_VISIBILITY=1 -DDEPLOYMENT_TARGET=9.3 \
-DDOBBY_GENERATE_SHARED=OFF -DDOBBY_DEBUG=OFF
cmake --build ${output_dir_name} --parallel 4 --target dobby
mkdir -p ${summary_output_dir_name}/darwin/arm64e
cp -r ${output_dir_name}/${darwin_library_name} ${summary_output_dir_name}/darwin/arm64e
# build darwin universal
output_dir_name=auto-build-workspace/darwin-universal-build
echo "prepare build ${output_dir_name}"
mkdir -p ${CURRENT_DIR}/${output_dir_name}
cp -r ${summary_output_dir_name}/darwin/arm64/${darwin_library_name} ${output_dir_name}
# create universal fat lib
lipo -create \
${summary_output_dir_name}/darwin/arm64/${darwin_fat_library_name} \
${summary_output_dir_name}/darwin/arm64e/${darwin_fat_library_name} \
${summary_output_dir_name}/darwin/x86_64/${darwin_fat_library_name} \
-output ${output_dir_name}/${darwin_fat_library_name}
mkdir -p ${summary_output_dir_name}/darwin/universal
cp -r ${output_dir_name}/${darwin_library_name} ${summary_output_dir_name}/darwin/universal
# Android ================================================================
android_library_name=libdobby.a
# build android aarch64
output_dir_name=auto-build-workspace/android-arm64-build
compress_dir_array="$compress_dir_array $output_dir_name"
echo "prepare build ${output_dir_name}"
cmake -S ${SOURCE_DIR} -B ${output_dir_name} -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_SYSTEM_NAME=Android -DCMAKE_ANDROID_ARCH_ABI="arm64-v8a" -DCMAKE_ANDROID_NDK=$ANDROID_NDK_DIR -DCMAKE_SYSTEM_VERSION=21 -DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang \
-DDOBBY_GENERATE_SHARED=OFF -DDOBBY_DEBUG=OFF -DPlugin.Android.BionicLinkerRestriction=ON
cmake --build ${output_dir_name} --parallel 4 --target dobby
mkdir -p ${summary_output_dir_name}/android/arm64
mv ${output_dir_name}/${android_library_name} ${summary_output_dir_name}/android/arm64/${android_library_name}
mv ${output_dir_name}/${android_library_name} "prefab/modules/dobby/libs/android.arm64-v8a/${android_library_name}"
# build android armv7
output_dir_name=auto-build-workspace/android-armv7-build
compress_dir_array="$compress_dir_array $output_dir_name"
echo "prepare build ${output_dir_name}"
cmake -S ${SOURCE_DIR} -B ${output_dir_name} -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_SYSTEM_NAME=Android -DCMAKE_ANDROID_ARCH_ABI="armeabi-v7a" -DCMAKE_ANDROID_NDK=$ANDROID_NDK_DIR -DCMAKE_SYSTEM_VERSION=16 -DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang \
-DDOBBY_GENERATE_SHARED=OFF -DDOBBY_DEBUG=OFF -DPlugin.Android.BionicLinkerRestriction=ON
cmake --build ${output_dir_name} --parallel 4 --target dobby
mkdir -p ${summary_output_dir_name}/android/armv7
mv ${output_dir_name}/${android_library_name} ${summary_output_dir_name}/android/armv7/${android_library_name}
mv ${output_dir_name}/${android_library_name} "prefab/modules/dobby/libs/android.armeabi-v7a/${android_library_name}"
# build android x86
output_dir_name=auto-build-workspace/android-x86-build
compress_dir_array="$compress_dir_array $output_dir_name"
echo "prepare build ${output_dir_name}"
cmake -S ${SOURCE_DIR} -B ${output_dir_name} -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_SYSTEM_NAME=Android -DCMAKE_ANDROID_ARCH_ABI="x86" -DCMAKE_ANDROID_NDK=$ANDROID_NDK_DIR -DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang \
-DDOBBY_GENERATE_SHARED=OFF -DDOBBY_DEBUG=OFF -DPlugin.Android.BionicLinkerRestriction=ON
cmake --build ${output_dir_name} --parallel 4 --target dobby
mkdir -p ${summary_output_dir_name}/android/x86
mv ${output_dir_name}/${android_library_name} ${summary_output_dir_name}/android/x86/${android_library_name}
mv ${output_dir_name}/${android_library_name} "prefab/modules/dobby/libs/android.x86/${android_library_name}"
# build android x86_64
output_dir_name=auto-build-workspace/android-x86_64-build
compress_dir_array="$compress_dir_array $output_dir_name"
echo "prepare build ${output_dir_name}"
cmake -S ${SOURCE_DIR} -B ${output_dir_name} -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_SYSTEM_NAME=Android -DCMAKE_ANDROID_ARCH_ABI="x86_64" -DCMAKE_ANDROID_NDK=$ANDROID_NDK_DIR -DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang \
-DDOBBY_GENERATE_SHARED=OFF -DDOBBY_DEBUG=OFF -DPlugin.Android.BionicLinkerRestriction=ON
cmake --build ${output_dir_name} --parallel 4 --target dobby
mkdir -p ${summary_output_dir_name}/android/x86_64
mv ${output_dir_name}/${android_library_name} ${summary_output_dir_name}/android/x86_64/${android_library_name}
#mv ${output_dir_name}/${android_library_name} "prefab/modules/dobby/libs/android.x86_64/${android_library_name}"
## zip android prefab
#mkdir -p prefab/modules/dobby/include
#cp "include/dobby.h" "prefab/modules/dobby/include/"
#cp "builtin-plugin/BionicLinkerRestriction/bionic_linker_restriction.h" "prefab/modules/dobby/include/"
#cp "builtin-plugin/SymbolResolver/dobby_symbol_resolver.h" "prefab/modules/dobby/include/"
#cp "prefab/AndroidManifest.xml" .
#zip -r ${summary_output_dir_name}/android_prefab.aar prefab AndroidManifest.xml -x prefab/AndroidManifest.xml
if [ $DOBBY_BUILD_OUTPUT_NAME ]; then
tar czvf ${DOBBY_BUILD_OUTPUT_NAME} ${summary_output_dir_name}
fi

View file

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.github.jmpews.ndk.dobby" >
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="30" />
</manifest>

View file

@ -1,6 +0,0 @@
{
"abi": "arm64-v8a",
"api": 21,
"ndk": 21,
"stl": "c++_static"
}

View file

@ -1,6 +0,0 @@
{
"abi": "armeabi-v7a",
"api": 16,
"ndk": 21,
"stl": "c++_static"
}

View file

@ -1,6 +0,0 @@
{
"abi": "x86",
"api": 16,
"ndk": 21,
"stl": "c++_static"
}

View file

@ -1,6 +0,0 @@
{
"abi": "x86_64",
"api": 21,
"ndk": 21,
"stl": "c++_static"
}

View file

@ -1,4 +0,0 @@
{
"export_libraries": [],
"android": {}
}

View file

@ -1,5 +0,0 @@
{
"name": "dobby",
"schema_version": 1,
"dependencies": []
}

View file

@ -1,46 +0,0 @@
#include "./dobby_monitor.h"
#include <dlfcn.h>
#include <CoreFoundation/CoreFoundation.h>
#define LOG_TAG "MGCopyAnswer"
static uintptr_t getCallFirstArg(RegisterContext *ctx) {
uintptr_t result;
#if defined(_M_X64) || defined(__x86_64__)
#if defined(_WIN32)
result = ctx->general.regs.rcx;
#else
result = ctx->general.regs.rdi;
#endif
#elif defined(__arm64__) || defined(__aarch64__)
result = ctx->general.regs.x0;
#elif defined(__arm__)
result = ctx->general.regs.r0;
#else
#error "Not Support Architecture."
#endif
return result;
}
void common_handler(RegisterContext *ctx, const HookEntryInfo *info) {
CFStringRef key_ = 0;
key_ = (CFStringRef)getCallFirstArg(ctx);
char str_key[256] = {0};
CFStringGetCString(key_, str_key, 256, kCFStringEncodingUTF8);
LOG("[#] MGCopyAnswer:: %s\n", str_key);
}
#if 0
__attribute__((constructor)) static void ctor() {
void *lib = dlopen("/usr/lib/libMobileGestalt.dylib", RTLD_NOW);
void *MGCopyAnswer_addr = DobbySymbolResolver("libMobileGestalt.dylib", "MGCopyAnswer");
sleep(1);
dobby_enable_near_branch_trampoline();
DobbyInstrument((void *)MGCopyAnswer_addr, common_handler);
dobby_disable_near_branch_trampoline();
}
#endif

View file

@ -1,28 +0,0 @@
#ifndef DOBBY_MONITOR_H
#define DOBBY_MONITOR_H
#include <stdlib.h> /* getenv */
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <fstream>
#include <set>
#include <unordered_map>
#include "dobby.h"
#define LOG printf
#ifdef __cplusplus
extern "C" {
#endif
int DobbyHook(void *function_address, void *replace_call, void **origin_call);
#ifdef __cplusplus
}
#endif
#endif // !1DOBBY_MONITOR

View file

@ -1,94 +0,0 @@
#include <stdlib.h> /* getenv */
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <fstream>
#include <set>
#include <unordered_map>
#include <dlfcn.h>
#include <sys/param.h>
#include "dobby.h"
#include "common_header.h"
#define LOG_TAG "DynamicLoaderMonitor"
std::unordered_map<void *, const char *> traced_dlopen_handle_list;
static void *(*orig_dlopen)(const char *__file, int __mode);
static void *fake_dlopen(const char *__file, int __mode) {
void *result = orig_dlopen(__file, __mode);
if (result != NULL && __file) {
char *traced_filename = (char *)malloc(MAXPATHLEN);
// FIXME: strncpy
strcpy(traced_filename, __file);
LOG(1, "[-] dlopen handle: %s", __file);
traced_dlopen_handle_list.insert(std::make_pair(result, (const char *)traced_filename));
}
return result;
}
static void *(*orig_loader_dlopen)(const char *filename, int flags, const void *caller_addr);
static void *fake_loader_dlopen(const char *filename, int flags, const void *caller_addr) {
void *result = orig_loader_dlopen(filename, flags, caller_addr);
if (result != NULL) {
char *traced_filename = (char *)malloc(MAXPATHLEN);
// FIXME: strncpy
strcpy(traced_filename, filename);
LOG(1, "[-] dlopen handle: %s", filename);
traced_dlopen_handle_list.insert(std::make_pair(result, (const char *)traced_filename));
}
return result;
}
static const char *get_traced_filename(void *handle, bool removed) {
std::unordered_map<void *, const char *>::iterator it;
it = traced_dlopen_handle_list.find(handle);
if (it != traced_dlopen_handle_list.end()) {
if (removed)
traced_dlopen_handle_list.erase(it);
return it->second;
}
return NULL;
}
static void *(*orig_dlsym)(void *__handle, const char *__symbol);
static void *fake_dlsym(void *__handle, const char *__symbol) {
const char *traced_filename = get_traced_filename(__handle, false);
if (traced_filename) {
LOG(1, "[-] dlsym: %s, symbol: %s", traced_filename, __symbol);
}
return orig_dlsym(__handle, __symbol);
}
static int (*orig_dlclose)(void *__handle);
static int fake_dlclose(void *__handle) {
const char *traced_filename = get_traced_filename(__handle, true);
if (traced_filename) {
LOG(1, "[-] dlclose: %s", traced_filename);
free((void *)traced_filename);
}
return orig_dlclose(__handle);
}
#if 0
__attribute__((constructor)) static void ctor() {
#if defined(__ANDROID__)
#if 0
void *dl = dlopen("libdl.so", RTLD_LAZY);
void *__loader_dlopen = dlsym(dl, "__loader_dlopen");
#endif
DobbyHook((void *)DobbySymbolResolver(NULL, "__loader_dlopen"), (void *)fake_loader_dlopen,
(void **)&orig_loader_dlopen);
#else
DobbyHook((void *)DobbySymbolResolver(NULL, "dlopen"), (void *)fake_dlopen, (void **)&orig_dlopen);
#endif
DobbyHook((void *)dlsym, (void *)fake_dlsym, (void **)&orig_dlsym);
DobbyHook((void *)dlclose, (void *)fake_dlclose, (void **)&orig_dlclose);
}
#endif

View file

@ -1,97 +0,0 @@
#include <stdlib.h> /* getenv */
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <fstream>
#include <set>
#include <unordered_map>
#include <sys/param.h>
#include "./dobby_monitor.h"
std::unordered_map<FILE *, const char *> *TracedFopenFileList;
FILE *(*orig_fopen)(const char *filename, const char *mode);
FILE *fake_fopen(const char *filename, const char *mode) {
FILE *result = NULL;
result = orig_fopen(filename, mode);
if (result != NULL) {
char *traced_filename = (char *)malloc(MAXPATHLEN);
// FIXME: strncpy
strcpy(traced_filename, filename);
std::cout << "[-] trace file: " << filename << std::endl;
TracedFopenFileList->insert(std::make_pair(result, traced_filename));
}
return result;
}
static const char *GetFileDescriptorTraced(FILE *stream, bool removed) {
std::unordered_map<FILE *, const char *>::iterator it;
it = TracedFopenFileList->find(stream);
if (it != TracedFopenFileList->end()) {
if (removed)
TracedFopenFileList->erase(it);
return it->second;
}
return NULL;
}
size_t (*orig_fread)(void *ptr, size_t size, size_t count, FILE *stream);
size_t fake_fread(void *ptr, size_t size, size_t count, FILE *stream) {
const char *file_name = GetFileDescriptorTraced(stream, false);
if (file_name) {
LOG("[-] fread: %s, buffer: %p\n", file_name, ptr);
}
return orig_fread(ptr, size, count, stream);
}
size_t (*orig_fwrite)(const void *ptr, size_t size, size_t count, FILE *stream);
size_t fake_fwrite(void *ptr, size_t size, size_t count, FILE *stream) {
const char *file_name = GetFileDescriptorTraced(stream, false);
if (file_name) {
LOG("[-] fwrite %s\n from %p\n", file_name, ptr);
}
return orig_fwrite(ptr, size, count, stream);
}
__attribute__((constructor)) void __main() {
TracedFopenFileList = new std::unordered_map<FILE *, const char *>();
#if defined(__APPLE__)
#include <TargetConditionals.h>
#if (TARGET_OS_IPHONE || TARGET_OS_MAC)
std::ifstream file;
file.open("/System/Library/CoreServices/SystemVersion.plist");
std::cout << file.rdbuf();
#endif
#endif
// DobbyHook((void *)fopen, (void *)fake_fopen, (void **)&orig_fopen);
// DobbyHook((void *)fwrite, (void *)fake_fwrite, (void **)&orig_fwrite);
// DobbyHook((void *)fread, (void *)fake_fread, (void **)&orig_fread);
char *home = getenv("HOME");
char *subdir = (char *)"/Library/Caches/";
std::string filePath = std::string(home) + std::string(subdir) + "temp.log";
char buffer[64];
memset(buffer, 'B', 64);
FILE *fd = fopen(filePath.c_str(), "w+");
if (!fd)
std::cout << "[!] open " << filePath << "failed!\n";
fwrite(buffer, 64, 1, fd);
fflush(fd);
fseek(fd, 0, SEEK_SET);
memset(buffer, 0, 64);
fread(buffer, 64, 1, fd);
return;
}

View file

@ -1,58 +0,0 @@
#include "./dobby_monitor.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
static uintptr_t getCallFirstArg(RegisterContext *ctx) {
uintptr_t result;
#if defined(_M_X64) || defined(__x86_64__)
#if defined(_WIN32)
result = ctx->general.regs.rcx;
#else
result = ctx->general.regs.rdi;
#endif
#elif defined(__arm64__) || defined(__aarch64__)
result = ctx->general.regs.x0;
#elif defined(__arm__)
result = ctx->general.regs.r0;
#else
#error "Not Support Architecture."
#endif
return result;
}
void format_integer_manually(char *buf, uint64_t integer) {
int tmp = 0;
for (tmp = (int)integer; tmp > 0; tmp = (tmp >> 4)) {
buf += (tmp % 16);
buf--;
}
}
// [ATTENTION]:
// printf will call 'malloc' internally, and will crash in a loop.
// so, use 'puts' is a better choice.
void malloc_handler(RegisterContext *ctx, const HookEntryInfo *info) {
size_t size_ = 0;
size_ = getCallFirstArg(ctx);
char *buffer_ = (char *)"[-] function malloc first arg: 0x00000000.\n";
format_integer_manually(strchr(buffer_, '.') - 1, size_);
puts(buffer_);
}
void free_handler(RegisterContext *ctx, const HookEntryInfo *info) {
uintptr_t mem_ptr;
mem_ptr = getCallFirstArg(ctx);
char *buffer = (char *)"[-] function free first arg: 0x00000000.\n";
format_integer_manually(strchr(buffer, '.') - 1, mem_ptr);
puts(buffer);
}
__attribute__((constructor)) static void ctor() {
// DobbyInstrument((void *)mmap, malloc_handler);
// DobbyInstrument((void *)free, free_handler);
return;
}

View file

@ -1,120 +0,0 @@
#include <stdlib.h> /* getenv */
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdarg.h>
#include <dlfcn.h>
#include <iostream>
#include <fstream>
#include <set>
#include <unordered_map>
#include <sys/param.h>
#include "dobby.h"
#include "common_header.h"
#define LOG_TAG "PosixFileOperationMonitor"
std::unordered_map<int, const char *> *posix_file_descriptors;
int (*orig_open)(const char *pathname, int flags, ...);
int fake_open(const char *pathname, int flags, ...) {
mode_t mode = 0;
if (flags & O_CREAT) {
va_list args;
va_start(args, flags);
mode = (mode_t)va_arg(args, int);
va_end(args);
}
int result = orig_open(pathname, flags, mode);
if (result != -1) {
char *traced_filename = (char *)malloc(MAXPATHLEN);
// FIXME: strncpy
strcpy(traced_filename, pathname);
LOG(1, "[-] trace open handle: %s", pathname);
if (posix_file_descriptors == NULL) {
posix_file_descriptors = new std::unordered_map<int, const char *>();
}
posix_file_descriptors->insert(std::make_pair(result, (const char *)traced_filename));
}
return result;
}
int (*orig___open)(const char *pathname, int flags, int mode);
int fake___open(const char *pathname, int flags, int mode) {
char *traced_filename = NULL;
if (pathname) {
traced_filename = (char *)malloc(MAXPATHLEN);
// FIXME: strncpy
strcpy(traced_filename, pathname);
LOG(1, "[-] trace open handle: ", pathname);
}
int result = orig___open(pathname, flags, mode);
if (result != -1) {
if (posix_file_descriptors == NULL) {
posix_file_descriptors = new std::unordered_map<int, const char *>();
}
posix_file_descriptors->insert(std::make_pair(result, (const char *)traced_filename));
}
return result;
}
static const char *get_traced_filename(int fd, bool removed) {
if (posix_file_descriptors == NULL)
return NULL;
std::unordered_map<int, const char *>::iterator it;
it = posix_file_descriptors->find(fd);
if (it != posix_file_descriptors->end()) {
if (removed)
posix_file_descriptors->erase(it);
return it->second;
}
return NULL;
}
ssize_t (*orig_read)(int fd, void *buf, size_t count);
ssize_t fake_read(int fd, void *buf, size_t count) {
const char *traced_filename = get_traced_filename(fd, false);
if (traced_filename) {
LOG(1, "[-] read: %s, buffer: %p, size: %zu", traced_filename, buf, count);
}
return orig_read(fd, buf, count);
}
ssize_t (*orig_write)(int fd, const void *buf, size_t count);
ssize_t fake_write(int fd, const void *buf, size_t count) {
const char *traced_filename = get_traced_filename(fd, false);
if (traced_filename) {
LOG(1, "[-] write: %s, buffer: %p, size: %zu", traced_filename, buf, count);
}
return orig_write(fd, buf, count);
}
int (*orig_close)(int fd);
int fake_close(int fd) {
const char *traced_filename = get_traced_filename(fd, true);
if (traced_filename) {
LOG(1, "[-] close: %s", traced_filename);
free((void *)traced_filename);
}
return orig_close(fd);
}
#if 0
__attribute__((constructor)) static void ctor() {
DobbyHook((void *)DobbySymbolResolver(NULL, "open"), (void *)fake_open, (void **)&orig_open);
DobbyHook((void *)DobbySymbolResolver(NULL, "write"), (void *)fake_write, (void **)&orig_write);
DobbyHook((void *)DobbySymbolResolver(NULL, "read"), (void *)fake_read, (void **)&orig_read);
DobbyHook((void *)DobbySymbolResolver(NULL, "close"), (void *)fake_close, (void **)&orig_close);
}
#endif

View file

@ -1,57 +0,0 @@
#include <stdlib.h> /* getenv */
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <fstream>
#include <set>
#include <unordered_map>
#include <sys/types.h>
#include <sys/socket.h>
std::unordered_map<int, const char *> posix_socket_file_descriptors;
int (*orig_bind)(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
int fake_bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen) {
}
static const char *get_traced_socket(int fd, bool removed) {
std::unordered_map<int, const char *>::iterator it;
it = posix_socket_file_descriptors.find(fd);
if (it != posix_socket_file_descriptors.end()) {
if (removed)
posix_socket_file_descriptors.erase(it);
return it->second;
}
return NULL;
}
int (*orig_connect)(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
int fake_connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen) {
const char *traced_socket = get_traced_socket(sockfd, false);
if (traced_socket) {
LOG(1, "[-] connect: %s\n", traced_socket);
}
return orig_connect(sockfd, addr, addrlen);
}
ssize_t (*orig_send)(int sockfd, const void *buf, size_t len, int flags);
ssize_t fake_send(int sockfd, const void *buf, size_t len, int flags) {
const char *traced_socket = get_traced_socket(sockfd, false);
if (traced_socket) {
LOG(1, "[-] send: %s, buf: %p, len: %zu\n", traced_socket, buf, len);
}
return orig_send(sockfd, buf, len, flags);
}
ssize_t (*orig_recv)(int sockfd, void *buf, size_t len, int flags);
ssize_t fake_recv(int sockfd, void *buf, size_t len, int flags) {
const char *traced_socket = get_traced_socket(sockfd, false);
if (traced_socket) {
LOG(1, "[-] recv: %s, buf: %p, len: %zu\n", traced_socket, buf, len);
}
return orig_recv(sockfd, buf, len, flags);
}

View file

@ -1,197 +0,0 @@
#include "bionic_linker_restriction.h"
#include <elf.h>
#include <jni.h>
#include <string>
#include <dlfcn.h>
#include <link.h>
#include <sys/mman.h>
#include <unistd.h>
#include <fcntl.h>
#include <unordered_map>
#include <vector>
#include <set>
#include "dobby.h"
#include "dobby_symbol_resolver.h"
#include "common_header.h"
#undef LOG_TAG
#define LOG_TAG "AndroidLinkerRestriction"
#undef Q
#define Q 29
// impl at "dobby_symbol_resolver.cc"
extern void *resolve_elf_internal_symbol(const char *library_name, const char *symbol_name);
#include <sys/system_properties.h>
static int get_android_system_version() {
char os_version_str[PROP_VALUE_MAX + 1];
__system_property_get("ro.build.version.release", os_version_str);
int os_version_int = atoi(os_version_str);
return os_version_int;
}
static const char *get_android_linker_path() {
#if __LP64__
if (get_android_system_version() >= Q) {
return (const char *)"/apex/com.android.runtime/bin/linker64";
} else {
return (const char *)"/system/bin/linker64";
}
#else
if (get_android_system_version() >= Q) {
return (const char *)"/apex/com.android.runtime/bin/linker";
} else {
return (const char *)"/system/bin/linker";
}
#endif
}
PUBLIC void *linker_dlopen(const char *filename, int flag) {
typedef void *(*__loader_dlopen_t)(const char *filename, int flags, const void *caller_addr);
static __loader_dlopen_t __loader_dlopen = NULL;
if (!__loader_dlopen)
__loader_dlopen = (__loader_dlopen_t)DobbySymbolResolver(NULL, "__loader_dlopen");
// fake caller address
void *open_ptr = dlsym(RTLD_DEFAULT, "open");
return __loader_dlopen(filename, flag, (const void *)open_ptr);
}
std::vector<soinfo_t> linker_solist;
std::vector<soinfo_t> linker_get_solist() {
if (!linker_solist.empty()) {
linker_solist.clear();
}
static soinfo_t (*solist_get_head)() = NULL;
if (!solist_get_head)
solist_get_head =
(soinfo_t(*)())resolve_elf_internal_symbol(get_android_linker_path(), "__dl__Z15solist_get_headv");
static soinfo_t (*solist_get_somain)() = NULL;
if (!solist_get_somain)
solist_get_somain =
(soinfo_t(*)())resolve_elf_internal_symbol(get_android_linker_path(), "__dl__Z17solist_get_somainv");
static addr_t *solist_head = NULL;
if (!solist_head)
solist_head = (addr_t *)solist_get_head();
static addr_t somain = 0;
if (!somain)
somain = (addr_t)solist_get_somain();
// Generate the name for an offset.
#define PARAM_OFFSET(type_, member_) __##type_##__##member_##__offset_
#define STRUCT_OFFSET PARAM_OFFSET
int STRUCT_OFFSET(solist, next) = 0;
for (size_t i = 0; i < 1024 / sizeof(void *); i++) {
if (*(addr_t *)((addr_t)solist_head + i * sizeof(void *)) == somain) {
STRUCT_OFFSET(solist, next) = i * sizeof(void *);
break;
}
}
linker_solist.push_back(solist_head);
addr_t sonext = 0;
sonext = *(addr_t *)((addr_t)solist_head + STRUCT_OFFSET(solist, next));
while (sonext) {
linker_solist.push_back((void *)sonext);
sonext = *(addr_t *)((addr_t)sonext + STRUCT_OFFSET(solist, next));
}
return linker_solist;
}
char *linker_soinfo_get_realpath(soinfo_t soinfo) {
static char *(*_get_realpath)(soinfo_t) = NULL;
if (!_get_realpath)
_get_realpath =
(char *(*)(soinfo_t))resolve_elf_internal_symbol(get_android_linker_path(), "__dl__ZNK6soinfo12get_realpathEv");
return _get_realpath(soinfo);
}
uintptr_t linker_soinfo_to_handle(soinfo_t soinfo) {
static uintptr_t (*_linker_soinfo_to_handle)(soinfo_t) = NULL;
if (!_linker_soinfo_to_handle)
_linker_soinfo_to_handle =
(uintptr_t(*)(soinfo_t))resolve_elf_internal_symbol(get_android_linker_path(), "__dl__ZN6soinfo9to_handleEv");
return _linker_soinfo_to_handle(soinfo);
}
typedef void *android_namespace_t;
android_namespace_t linker_soinfo_get_primary_namespace(soinfo_t soinfo) {
static android_namespace_t (*_get_primary_namespace)(soinfo_t) = NULL;
if (!_get_primary_namespace)
_get_primary_namespace = (android_namespace_t(*)(soinfo_t))resolve_elf_internal_symbol(
get_android_linker_path(), "__dl__ZN6soinfo21get_primary_namespaceEv");
return _get_primary_namespace(soinfo);
}
void linker_iterate_soinfo(int (*cb)(soinfo_t soinfo)) {
auto solist = linker_get_solist();
for (auto it = solist.begin(); it != solist.end(); it++) {
int ret = cb(*it);
if (ret != 0)
break;
}
}
static int iterate_soinfo_cb(soinfo_t soinfo) {
android_namespace_t ns = NULL;
ns = linker_soinfo_get_primary_namespace(soinfo);
LOG(1, "lib: %s", linker_soinfo_get_realpath(soinfo));
// set is_isolated_ as false
// no need for this actually
int STRUCT_OFFSET(android_namespace_t, is_isolated_) = 0x8;
*(uint8_t *)((addr_t)ns + STRUCT_OFFSET(android_namespace_t, is_isolated_)) = false;
std::vector<std::string> ld_library_paths = {"/system/lib64", "/sytem/lib"};
if (get_android_system_version() >= Q) {
ld_library_paths.push_back("/apex/com.android.runtime/lib64");
ld_library_paths.push_back("/apex/com.android.runtime/lib");
}
int STRUCT_OFFSET(android_namespace_t, ld_library_paths_) = 0x10;
if (*(void **)((addr_t)ns + STRUCT_OFFSET(android_namespace_t, ld_library_paths_))) {
std::vector<std::string> orig_ld_library_paths =
*(std::vector<std::string> *)((addr_t)ns + STRUCT_OFFSET(android_namespace_t, ld_library_paths_));
orig_ld_library_paths.insert(orig_ld_library_paths.end(), ld_library_paths.begin(), ld_library_paths.end());
// remove duplicates
{
std::set<std::string> paths(orig_ld_library_paths.begin(), orig_ld_library_paths.end());
orig_ld_library_paths.assign(paths.begin(), paths.end());
}
} else {
*(std::vector<std::string> *)((addr_t)ns + STRUCT_OFFSET(android_namespace_t, ld_library_paths_)) =
std::move(ld_library_paths);
}
return 0;
}
bool (*orig_linker_namespace_is_is_accessible)(android_namespace_t ns, const std::string &file);
bool linker_namespace_is_is_accessible(android_namespace_t ns, const std::string &file) {
LOG(1, "check %s", file.c_str());
return true;
return orig_linker_namespace_is_is_accessible(ns, file);
}
void linker_disable_namespace_restriction() {
linker_iterate_soinfo(iterate_soinfo_cb);
// no need for this actually
void *linker_namespace_is_is_accessible_ptr = resolve_elf_internal_symbol(
get_android_linker_path(), "__dl__ZN19android_namespace_t13is_accessibleERKNSt3__112basic_"
"stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE");
DobbyHook(linker_namespace_is_is_accessible_ptr, (void *)linker_namespace_is_is_accessible,
(void **)&orig_linker_namespace_is_is_accessible);
LOG(1, "disable namespace restriction done");
}

View file

@ -1,26 +0,0 @@
#ifndef LINKER_RESTRICTION_H
#define LINKER_RESTRICTION_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef void *soinfo_t;
soinfo_t linker_dlopen(const char *filename, int flag);
char *linker_soinfo_get_realpath(soinfo_t soinfo);
uintptr_t linker_soinfo_to_handle(soinfo_t soinfo);
void linker_iterate_soinfo(int (*cb)(soinfo_t soinfo));
void linker_disable_namespace_restriction();
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,36 +0,0 @@
#include "dobby.h"
#include "bionic_linker_restriction.h"
#include "logging/logging.h"
#include <dlfcn.h>
#define LOG_TAG "AndroidLinkerRestriction"
__attribute__((constructor)) static void ctor() {
const char *lib = NULL;
#if defined(__LP64__)
lib = "/system/lib64/libandroid_runtime.so";
#else
lib = "/system/lib/libandroid_runtime.so";
#endif
void *vm = NULL;
vm = DobbySymbolResolver(lib, "_ZN7android14AndroidRuntime7mJavaVME");
LOG(1, "DobbySymbolResolver::vm %p", vm);
#if 0
linker_disable_namespace_restriction();
void *handle = NULL;
handle = dlopen(lib, RTLD_LAZY);
vm = dlsym(handle, "_ZN7android14AndroidRuntime7mJavaVME");
#else
void *handle = NULL;
handle = linker_dlopen(lib, RTLD_LAZY);
vm = dlsym(handle, "_ZN7android14AndroidRuntime7mJavaVME");
#endif
LOG(1, "vm %p", vm);
}

View file

@ -1,3 +0,0 @@
add_library(dyld2_hide_library
dyld2_hide_library.cc
)

View file

@ -1,136 +0,0 @@
#include "Dyld2HideLibrary/dyld2_hide_library.h"
#include <mach-o/dyld.h>
#include <mach-o/loader.h>
#include <mach-o/nlist.h>
#include <mach-o/dyld_images.h>
#include <stdint.h>
#include <stdio.h>
#include <mach/mach.h>
#include <string.h>
#include <vector>
#include "dobby_internal.h"
typedef void ImageLoader;
typedef void ImageLoaderMachO;
static void *(*removeImageFromAllImages)(const struct mach_header *mh) = NULL;
static char *(*ImageLoader__getShortName)(ImageLoader *loader) = NULL;
static struct mach_header *(*ImageLoaderMachO__machHeader)(ImageLoaderMachO *loader) = NULL;
static std::vector<ImageLoader *> *sAllImages = NULL;
std::vector<char *> *g_prepare_remove_array;
static int dobby_hide_library_internal(const char *library_name) {
if (removeImageFromAllImages == NULL) {
removeImageFromAllImages =
(decltype(removeImageFromAllImages))DobbySymbolResolver("dyld", "__Z24removeImageFromAllImagesPK11mach_header");
}
if (ImageLoader__getShortName == NULL) {
ImageLoader__getShortName =
(decltype(ImageLoader__getShortName))DobbySymbolResolver("dyld", "__ZNK11ImageLoader12getShortNameEv");
}
if (ImageLoaderMachO__machHeader == NULL) {
ImageLoaderMachO__machHeader =
(decltype(ImageLoaderMachO__machHeader))DobbySymbolResolver("dyld", "__ZNK16ImageLoaderMachO10machHeaderEv");
}
if (sAllImages == NULL)
sAllImages = (decltype(sAllImages))DobbySymbolResolver("dyld", "__ZN4dyldL10sAllImagesE");
#if 0
if (dyld3__AllImages__imageLoadAddressByIndex == NULL) {
dyld3__AllImages__imageLoadAddressByIndex = (decltype(removeImageFromAllImages))DobbySymbolResolver(
"libdyld.dylib", "__ZNK5dyld39AllImages23imageLoadAddressByIndexEj");
}
if (dyld3_sAllImages == NULL)
dyld3_sAllImages = (decltype(dyld3_sAllImages))DobbySymbolResolver("libdyld.dylib", "__ZN5dyld310gAllImagesE");
#endif
#if 0
typedef void AllImages;
static void(*AllImages__decRefCount)(AllImages *_this, const struct mach_header *mh) = NULL;
if(AllImages__decRefCount == NULL) {
AllImages__decRefCount = (decltype(AllImages__decRefCount))DobbySymbolResolver("libdyld.dylib", "__ZN5dyld39AllImages11decRefCountEPK11mach_header");
}
static AllImages *gAllImages = NULL;
if(gAllImages == NULL) {
gAllImages = (decltype(gAllImages))DobbySymbolResolver("libdyld.dylib", "__ZN5dyld310gAllImagesE");
}
#endif
// int count = _dyld_image_count();
// for (int i = 0; i < count; i++) {
// const char *name = _dyld_get_image_name(i);
// const char *image_name = strrchr(name, '/');
// if (image_name == NULL) {
// continue;
// }
// image_name += 1;
// if (strcmp(image_name, library_name) == 0) {
// const struct mach_header *header = _dyld_get_image_header(i);
// AllImages__decRefCount(gAllImages, header);
// break;
// }
// }
for (std::vector<ImageLoader *>::iterator it = sAllImages->begin(); it != sAllImages->end(); it++) {
char *name = ImageLoader__getShortName(*it);
// LOG(2, "load library : %s", name);
if (strcmp(name, library_name) == 0) {
LOG(2, "strip load library : %s", library_name);
struct mach_header *header = ImageLoaderMachO__machHeader(*it);
removeImageFromAllImages(header);
sAllImages->erase(it);
break;
}
}
return 0;
}
PUBLIC int dyld2_hide_library(const char *library_name) {
#if 1
dobby_hide_library_internal(library_name);
return 0;
#endif
if (g_prepare_remove_array == NULL)
g_prepare_remove_array = new std::vector<char *>();
g_prepare_remove_array->push_back((char *)library_name);
}
static void common_handler(RegisterContext *ctx, const HookEntryInfo *info) {
if (g_prepare_remove_array == nullptr)
return;
for (auto name : *g_prepare_remove_array) {
dobby_hide_library_internal(name);
}
}
__attribute__((constructor)) static void ctor() {
#if 0
void *dyld__notifyMonitoringDyldMain = DobbySymbolResolver("dyld", "__ZN4dyldL24notifyMonitoringDyldMainEv");
DobbyInstrument(dyld__notifyMonitoringDyldMain, common_handler);
#endif
log_switch_to_syslog();
#if defined(DOBBY_DEBUG) && 0
dyld2_hide_library("Dobby");
dyld2_hide_library("liblangid.dylib");
#endif
}

View file

@ -1,11 +0,0 @@
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
int dyld2_hide_library(const char *library_name);
#ifdef __cplusplus
}
#endif

View file

@ -1,13 +0,0 @@
if(SYSTEM.Darwin)
set(SOURCE_FILE_LIST
${CMAKE_CURRENT_SOURCE_DIR}/global_offset_table_hook.cc
)
endif()
add_library(global_offset_table_hook STATIC
${SOURCE_FILE_LIST}
)
include_directories(
.
)

View file

@ -1,192 +0,0 @@
#include "global_offset_table_hook.h"
#include <mach-o/dyld.h>
#include <mach-o/loader.h>
#include <mach-o/nlist.h>
#include <mach-o/dyld_images.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <mach/vm_map.h>
#include <mach/mach.h>
#include <sys/mman.h>
#include <vector>
#include "common_header.h"
#include "logging/logging.h"
#include "PlatformUtil/ProcessRuntimeUtility.h"
#if defined(__LP64__)
typedef struct mach_header_64 mach_header_t;
typedef struct segment_command_64 segment_command_t;
typedef struct section_64 section_t;
typedef struct nlist_64 nlist_t;
#define LC_SEGMENT_ARCH_DEPENDENT LC_SEGMENT_64
#else
typedef struct mach_header mach_header_t;
typedef struct segment_command segment_command_t;
typedef struct section section_t;
typedef struct nlist nlist_t;
#define LC_SEGMENT_ARCH_DEPENDENT LC_SEGMENT
#endif
static void *iterate_indirect_symtab(char *symbol_name, section_t *section, intptr_t slide, nlist_t *symtab,
char *strtab, uint32_t *indirect_symtab) {
const bool is_data_const = strcmp(section->segname, "__DATA_CONST") == 0;
uint32_t *indirect_symbol_indices = indirect_symtab + section->reserved1;
void **indirect_symbol_bindings = (void **)((uintptr_t)slide + section->addr);
vm_prot_t old_protection = VM_PROT_READ;
if (is_data_const) {
mprotect(indirect_symbol_bindings, section->size, PROT_READ | PROT_WRITE);
}
for (uint i = 0; i < section->size / sizeof(void *); i++) {
uint32_t symtab_index = indirect_symbol_indices[i];
if (symtab_index == INDIRECT_SYMBOL_ABS || symtab_index == INDIRECT_SYMBOL_LOCAL ||
symtab_index == (INDIRECT_SYMBOL_LOCAL | INDIRECT_SYMBOL_ABS)) {
continue;
}
uint32_t strtab_offset = symtab[symtab_index].n_un.n_strx;
char *local_symbol_name = strtab + strtab_offset;
bool symbol_name_longer_than_1 = symbol_name[0] && symbol_name[1];
if (strcmp(local_symbol_name, symbol_name) == 0) {
return &indirect_symbol_bindings[i];
}
if (local_symbol_name[0] == '_') {
if (strcmp(symbol_name, &local_symbol_name[1]) == 0) {
return &indirect_symbol_bindings[i];
}
}
}
if (is_data_const && 0) {
int protection = 0;
if (old_protection & VM_PROT_READ) {
protection |= PROT_READ;
}
if (old_protection & VM_PROT_WRITE) {
protection |= PROT_WRITE;
}
if (old_protection & VM_PROT_EXECUTE) {
protection |= PROT_EXEC;
}
mprotect(indirect_symbol_bindings, section->size, protection);
}
return NULL;
}
static void *get_global_offset_table_stub(mach_header_t *header, char *symbol_name) {
segment_command_t *curr_seg_cmd;
segment_command_t *text_segment, *data_segment, *linkedit_segment;
struct symtab_command *symtab_cmd = NULL;
struct dysymtab_command *dysymtab_cmd = NULL;
uintptr_t cur = (uintptr_t)header + sizeof(mach_header_t);
for (uint i = 0; i < header->ncmds; i++, cur += curr_seg_cmd->cmdsize) {
curr_seg_cmd = (segment_command_t *)cur;
if (curr_seg_cmd->cmd == LC_SEGMENT_ARCH_DEPENDENT) {
if (strcmp(curr_seg_cmd->segname, "__LINKEDIT") == 0) {
linkedit_segment = curr_seg_cmd;
} else if (strcmp(curr_seg_cmd->segname, "__DATA") == 0) {
data_segment = curr_seg_cmd;
} else if (strcmp(curr_seg_cmd->segname, "__TEXT") == 0) {
text_segment = curr_seg_cmd;
}
} else if (curr_seg_cmd->cmd == LC_SYMTAB) {
symtab_cmd = (struct symtab_command *)curr_seg_cmd;
} else if (curr_seg_cmd->cmd == LC_DYSYMTAB) {
dysymtab_cmd = (struct dysymtab_command *)curr_seg_cmd;
}
}
if (!symtab_cmd || !linkedit_segment || !linkedit_segment) {
return NULL;
}
uintptr_t slide = (uintptr_t)header - (uintptr_t)text_segment->vmaddr;
uintptr_t linkedit_base = (uintptr_t)slide + linkedit_segment->vmaddr - linkedit_segment->fileoff;
nlist_t *symtab = (nlist_t *)(linkedit_base + symtab_cmd->symoff);
char *strtab = (char *)(linkedit_base + symtab_cmd->stroff);
uint32_t symtab_count = symtab_cmd->nsyms;
uint32_t *indirect_symtab = (uint32_t *)(linkedit_base + dysymtab_cmd->indirectsymoff);
cur = (uintptr_t)header + sizeof(mach_header_t);
for (uint i = 0; i < header->ncmds; i++, cur += curr_seg_cmd->cmdsize) {
curr_seg_cmd = (segment_command_t *)cur;
if (curr_seg_cmd->cmd == LC_SEGMENT_ARCH_DEPENDENT) {
if (strcmp(curr_seg_cmd->segname, "__DATA") != 0 && strcmp(curr_seg_cmd->segname, "__DATA_CONST") != 0) {
continue;
}
for (uint j = 0; j < curr_seg_cmd->nsects; j++) {
section_t *sect = (section_t *)(cur + sizeof(segment_command_t)) + j;
if ((sect->flags & SECTION_TYPE) == S_LAZY_SYMBOL_POINTERS) {
void *stub = iterate_indirect_symtab(symbol_name, sect, slide, symtab, strtab, indirect_symtab);
if (stub)
return stub;
}
if ((sect->flags & SECTION_TYPE) == S_NON_LAZY_SYMBOL_POINTERS) {
void *stub = iterate_indirect_symtab(symbol_name, sect, slide, symtab, strtab, indirect_symtab);
if (stub)
return stub;
}
}
}
}
return NULL;
}
PUBLIC int DobbyGlobalOffsetTableReplace(char *image_name, char *symbol_name, void *fake_func, void **orig_func_ptr) {
std::vector<RuntimeModule> ProcessModuleMap = ProcessRuntimeUtility::GetProcessModuleMap();
for (auto module : ProcessModuleMap) {
if (image_name != NULL && strstr(module.path, image_name) == NULL)
continue;
addr_t header = (addr_t)module.load_address;
size_t slide = 0;
#if 0
if (header) {
if (((struct mach_header *)header)->magic == MH_MAGIC_64)
slide = macho_kit_get_slide64(header);
}
#endif
#if 0
LOG(1, "resolve image: %s", module.path);
#endif
uint32_t nlist_count = 0;
nlist_t *nlist_array = 0;
char *string_pool = 0;
void *stub = get_global_offset_table_stub((mach_header_t *)header, symbol_name);
if (stub) {
void *orig_func;
orig_func = *(void **)stub;
#if __has_feature(ptrauth_calls)
orig_func = ptrauth_strip(orig_func, ptrauth_key_asia);
orig_func = ptrauth_sign_unauthenticated(orig_func, ptrauth_key_asia, 0);
#endif
*orig_func_ptr = orig_func;
#if __has_feature(ptrauth_calls)
fake_func = (void *)ptrauth_strip(fake_func, ptrauth_key_asia);
fake_func = ptrauth_sign_unauthenticated(fake_func, ptrauth_key_asia, stub);
#endif
*(void **)stub = fake_func;
}
if (image_name)
return 0;
}
return -1;
}

View file

@ -1,11 +0,0 @@
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
int DobbyGlobalOffsetTableReplace(char *image_name, char *symbol_name, void *fake_func, void **orig_func);
#ifdef __cplusplus
}
#endif

View file

@ -1 +0,0 @@
private

View file

@ -1,61 +0,0 @@
#include "dobby.h"
#include "common_header.h"
#include <dlfcn.h>
#include <vector>
#define LOG_TAG "LinkerLoadCallback"
std::vector<linker_load_callback_t> *linker_load_callback_array;
static void *(*orig_dlopen)(const char *__file, int __mode);
static void *fake_dlopen(const char *__file, int __mode) {
void *result = orig_dlopen(__file, __mode);
if (result != NULL && __file) {
for (auto &callback : *linker_load_callback_array) {
callback(__file, result);
}
}
return result;
}
static void *(*orig_loader_dlopen)(const char *filename, int flags, const void *caller_addr);
static void *fake_loader_dlopen(const char *filename, int flags, const void *caller_addr) {
void *result = orig_loader_dlopen(filename, flags, caller_addr);
if (result != NULL) {
for (auto &callback : *linker_load_callback_array) {
callback(filename, result);
}
}
return result;
}
PUBLIC void dobby_register_image_load_callback(linker_load_callback_t func) {
if (linker_load_callback_array == NULL)
linker_load_callback_array = new std::vector<linker_load_callback_t>();
linker_load_callback_array->push_back(func);
}
#if defined(DOBBY_DEBUG) && 1
static void monitor_linker_load(const char *image_name, void *handle) {
LOG(1, "load %s at %p", image_name, handle);
}
#endif
__attribute__((constructor)) static void ctor() {
if (linker_load_callback_array == NULL)
linker_load_callback_array = new std::vector<linker_load_callback_t>();
#if defined(__ANDROID__)
void *__loader_dlopen = DobbySymbolResolver(NULL, "__loader_dlopen");
LOG(1, "__loader_dlopen: %p", __loader_dlopen);
DobbyHook(__loader_dlopen, (void *)fake_loader_dlopen, (void **)&orig_loader_dlopen);
#else
DobbyHook((void *)DobbySymbolResolver(NULL, "dlopen"), (void *)fake_dlopen, (void **)&orig_dlopen);
#endif
#if defined(DOBBY_DEBUG) && 1
dobby_register_image_load_callback(monitor_linker_load);
#endif
}

View file

@ -1 +0,0 @@
private

View file

@ -1,3 +0,0 @@
add_library(objc_runtime_hook
objc_runtime_hook.mm
)

View file

@ -1,19 +0,0 @@
#pragma once
#include <stdio.h>
#include <objc/runtime.h>
#include <Foundation/Foundation.h>
#ifdef __cplusplus
extern "C" {
#endif
IMP DobbyObjcReplace(Class _class, SEL _selector, IMP replacement);
void DobbyObjcReplaceEx(const char *class_name, const char *selector_name, void *fake_impl, void **orig_impl);
void *DobbyObjcResolveMethodImp(const char *class_name, const char *selector_name);
#ifdef __cplusplus
}
#endif

View file

@ -1,60 +0,0 @@
#include "ObjcRuntimeHook/objc_runtime_hook.h"
#include "dobby_internal.h"
#include <stdio.h>
#include <objc/runtime.h>
extern "C" {
#include "misc-helper/variable_cache.h"
}
/* clang -rewrite-objc main.m */
IMP DobbyObjcReplace(Class class_, SEL sel_, IMP fake_impl) {
Method method_ = class_getInstanceMethod(class_, sel_);
if (!method_)
method_ = class_getClassMethod(class_, sel_);
if (!method_) {
DLOG(0, "Not found class: %s, selector: %s method\n", class_getName(class_), sel_getName(sel_));
return NULL;
}
return method_setImplementation(method_, (IMP)fake_impl);
}
void DobbyObjcReplaceEx(const char *class_name, const char *selector_name, void *fake_impl, void **out_orig_impl) {
Class class_ = objc_getClass(class_name);
SEL sel_ = sel_registerName(selector_name);
Method method_ = class_getInstanceMethod(class_, sel_);
if (!method_)
method_ = class_getClassMethod(class_, sel_);
if (!method_) {
DLOG(0, "Not found class: %s, selector: %s method\n", class_name, selector_name);
return;
}
void *orig_impl = NULL;
orig_impl = (void *)method_setImplementation(method_, (IMP)fake_impl);
if (out_orig_impl) {
*out_orig_impl = orig_impl;
}
return;
}
void *DobbyObjcResolveMethodImp(const char *class_name, const char *selector_name) {
Class class_ = objc_getClass(class_name);
SEL sel_ = sel_registerName(selector_name);
Method method_ = class_getInstanceMethod(class_, sel_);
if (!method_)
method_ = class_getClassMethod(class_, sel_);
if (!method_) {
DLOG(0, "Not found class: %s, selector: %s method\n", class_name, selector_name);
return NULL;
}
return (void *)method_getImplementation(method_);
}

View file

@ -1,23 +0,0 @@
add_library(supervisor_call_monitor STATIC
mach_system_call_log_handler.cc
system_call_log_handler.cc
supervisor_call_monitor.cc
sensitive_api_monitor.cc
misc_utility.cc
)
target_link_libraries(supervisor_call_monitor
misc_helper
dobby
)
add_library(test_supervisor_call_monitor SHARED
test_supervisor_call_monitor.cc
)
target_link_libraries(test_supervisor_call_monitor
supervisor_call_monitor
)
include_directories(
.
)

View file

@ -1 +0,0 @@
Monitor all supervisor call

View file

@ -1 +0,0 @@
syscalls.c is automatically generated

View file

@ -1,49 +0,0 @@
/*
* Copyright (c) 2004-2008, Apple Inc. All rights reserved.
*
* @APPLE_BSD_LICENSE_HEADER_START@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of Apple Inc. ("Apple") nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* @APPLE_BSD_LICENSE_HEADER_END@
*/
/*
* Interface definition for the audit logging facility.
*/
subsystem
#if KERNEL_USER
KernelUser
#endif /* KERNEL_USER */
audit_triggers 123;
#include <mach/std_types.defs>
#include <mach/mach_types.defs>
simpleroutine audit_triggers(
audit_port : mach_port_t;
in flags : int);

View file

@ -1,88 +0,0 @@
/*
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
/*
* Mach Operating System
* Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
*/
/*
* File: mach/boolean.h
*
* Boolean data type.
*
*/
#ifndef _MACH_BOOLEAN_H_
#define _MACH_BOOLEAN_H_
/*
* Pick up "boolean_t" type definition
*/
#ifndef ASSEMBLER
#include <mach/machine/boolean.h>
#endif /* ASSEMBLER */
/*
* Define TRUE and FALSE if not defined.
*/
#ifndef TRUE
#define TRUE 1
#endif /* TRUE */
#ifndef FALSE
#define FALSE 0
#endif /* FALSE */
#endif /* _MACH_BOOLEAN_H_ */

View file

@ -1,34 +0,0 @@
/*
* Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* Mach bootstrap interfaces (obsolete: header included only for compatibility)
*/
#ifndef _MACH_BOOTSTRAP_H_
#define _MACH_BOOTSTRAP_H_
#endif /* _MACH_BOOTSTRAP_H_ */

View file

@ -1,81 +0,0 @@
/*
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
/*
* File: mach/clock.defs
* Purpose: Kernel clock subsystem definitions. This
* file defines the clock request interface.
*/
subsystem
#if KERNEL_SERVER
KernelServer
#endif /* KERNEL_SERVER */
clock 1000;
#include <mach/std_types.defs>
#include <mach/mach_types.defs>
#include <mach/clock_types.defs>
/*
* References to clock objects are returned by:
* host_get_clock_service(host_t,...)
* host_get_clock_control(host_priv_t,...) - Priviledged subclass
*/
/*
* Get the clock time.
* Available to all.
*/
routine clock_get_time(
clock_serv : clock_serv_t;
out cur_time : mach_timespec_t);
/*
* Get clock attributes.
* Available to all.
*/
routine clock_get_attributes(
clock_serv : clock_serv_t;
in flavor : clock_flavor_t;
out clock_attr : clock_attr_t, CountInOut);
/*
* Setup a clock alarm.
* Available to all.
*/
routine clock_alarm(
clock_serv : clock_serv_t;
alarm_type : alarm_type_t;
alarm_time : mach_timespec_t;
alarm_port : clock_reply_t =
MACH_MSG_TYPE_MAKE_SEND_ONCE|polymorphic);
/* vim: set ft=c : */

View file

@ -1,245 +0,0 @@
#ifndef _clock_user_
#define _clock_user_
/* Module clock */
#include <string.h>
#include <mach/ndr.h>
#include <mach/boolean.h>
#include <mach/kern_return.h>
#include <mach/notify.h>
#include <mach/mach_types.h>
#include <mach/message.h>
#include <mach/mig_errors.h>
#include <mach/port.h>
/* BEGIN MIG_STRNCPY_ZEROFILL CODE */
#if defined(__has_include)
#if __has_include(<mach/mig_strncpy_zerofill_support.h>)
#ifndef USING_MIG_STRNCPY_ZEROFILL
#define USING_MIG_STRNCPY_ZEROFILL
#endif
#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__
#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__
#ifdef __cplusplus
extern "C" {
#endif
extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import));
#ifdef __cplusplus
}
#endif
#endif /* __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ */
#endif /* __has_include(<mach/mig_strncpy_zerofill_support.h>) */
#endif /* __has_include */
/* END MIG_STRNCPY_ZEROFILL CODE */
#ifdef AUTOTEST
#ifndef FUNCTION_PTR_T
#define FUNCTION_PTR_T
typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t);
typedef struct {
char *name;
function_ptr_t function;
} function_table_entry;
typedef function_table_entry *function_table_t;
#endif /* FUNCTION_PTR_T */
#endif /* AUTOTEST */
#ifndef clock_MSG_COUNT
#define clock_MSG_COUNT 3
#endif /* clock_MSG_COUNT */
#include <mach/std_types.h>
#include <mach/mig.h>
#include <mach/mig.h>
#include <mach/mach_types.h>
#include <mach/mach_types.h>
#ifdef __BeforeMigUserHeader
__BeforeMigUserHeader
#endif /* __BeforeMigUserHeader */
#include <sys/cdefs.h>
__BEGIN_DECLS
/* Routine clock_get_time */
#ifdef mig_external
mig_external
#else
extern
#endif /* mig_external */
kern_return_t clock_get_time
(
clock_serv_t clock_serv,
mach_timespec_t *cur_time
);
/* Routine clock_get_attributes */
#ifdef mig_external
mig_external
#else
extern
#endif /* mig_external */
kern_return_t clock_get_attributes
(
clock_serv_t clock_serv,
clock_flavor_t flavor,
clock_attr_t clock_attr,
mach_msg_type_number_t *clock_attrCnt
);
/* Routine clock_alarm */
#ifdef mig_external
mig_external
#else
extern
#endif /* mig_external */
kern_return_t clock_alarm
(
clock_serv_t clock_serv,
alarm_type_t alarm_type,
mach_timespec_t alarm_time,
clock_reply_t alarm_port
);
__END_DECLS
/********************** Caution **************************/
/* The following data types should be used to calculate */
/* maximum message sizes only. The actual message may be */
/* smaller, and the position of the arguments within the */
/* message layout may vary from what is presented here. */
/* For example, if any of the arguments are variable- */
/* sized, and less than the maximum is sent, the data */
/* will be packed tight in the actual message to reduce */
/* the presence of holes. */
/********************** Caution **************************/
/* typedefs for all requests */
#ifndef __Request__clock_subsystem__defined
#define __Request__clock_subsystem__defined
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
} __Request__clock_get_time_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
NDR_record_t NDR;
clock_flavor_t flavor;
mach_msg_type_number_t clock_attrCnt;
} __Request__clock_get_attributes_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
/* start of the kernel processed data */
mach_msg_body_t msgh_body;
mach_msg_port_descriptor_t alarm_port;
/* end of the kernel processed data */
NDR_record_t NDR;
alarm_type_t alarm_type;
mach_timespec_t alarm_time;
} __Request__clock_alarm_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#endif /* !__Request__clock_subsystem__defined */
/* union of all requests */
#ifndef __RequestUnion__clock_subsystem__defined
#define __RequestUnion__clock_subsystem__defined
union __RequestUnion__clock_subsystem {
__Request__clock_get_time_t Request_clock_get_time;
__Request__clock_get_attributes_t Request_clock_get_attributes;
__Request__clock_alarm_t Request_clock_alarm;
};
#endif /* !__RequestUnion__clock_subsystem__defined */
/* typedefs for all replies */
#ifndef __Reply__clock_subsystem__defined
#define __Reply__clock_subsystem__defined
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
NDR_record_t NDR;
kern_return_t RetCode;
mach_timespec_t cur_time;
} __Reply__clock_get_time_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
NDR_record_t NDR;
kern_return_t RetCode;
mach_msg_type_number_t clock_attrCnt;
int clock_attr[1];
} __Reply__clock_get_attributes_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
NDR_record_t NDR;
kern_return_t RetCode;
} __Reply__clock_alarm_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#endif /* !__Reply__clock_subsystem__defined */
/* union of all replies */
#ifndef __ReplyUnion__clock_subsystem__defined
#define __ReplyUnion__clock_subsystem__defined
union __ReplyUnion__clock_subsystem {
__Reply__clock_get_time_t Reply_clock_get_time;
__Reply__clock_get_attributes_t Reply_clock_get_attributes;
__Reply__clock_alarm_t Reply_clock_alarm;
};
#endif /* !__RequestUnion__clock_subsystem__defined */
#ifndef subsystem_to_name_map_clock
#define subsystem_to_name_map_clock \
{ "clock_get_time", 1000 },\
{ "clock_get_attributes", 1001 },\
{ "clock_alarm", 1002 }
#endif
#ifdef __AfterMigUserHeader
__AfterMigUserHeader
#endif /* __AfterMigUserHeader */
#endif /* _clock_user_ */

View file

@ -1,69 +0,0 @@
/*
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
/*
* File: mach/clock_priv.defs
* Purpose: Kernel clock subsystem definitions. This
* file defines the clock request interface.
*/
subsystem
#if KERNEL_SERVER
KernelServer
#endif /* KERNEL_SERVER */
clock_priv 1200;
#include <mach/std_types.defs>
#include <mach/mach_types.defs>
#include <mach/clock_types.defs>
/*
* References to clock_priv objects are returned by:
* host_get_clock_control(host_priv_t,...) - Priviledged subclass
*/
/*
* Set the clock time.
* Privileged.
*/
routine clock_set_time(
clock_ctrl : clock_ctrl_t;
new_time : mach_timespec_t);
/*
* Set clock attributes.
* Privileged.
*/
routine clock_set_attributes(
clock_ctrl : clock_ctrl_t;
in flavor : clock_flavor_t;
in clock_attr : clock_attr_t);
/* vim: set ft=c : */

View file

@ -1,199 +0,0 @@
#ifndef _clock_priv_user_
#define _clock_priv_user_
/* Module clock_priv */
#include <string.h>
#include <mach/ndr.h>
#include <mach/boolean.h>
#include <mach/kern_return.h>
#include <mach/notify.h>
#include <mach/mach_types.h>
#include <mach/message.h>
#include <mach/mig_errors.h>
#include <mach/port.h>
/* BEGIN MIG_STRNCPY_ZEROFILL CODE */
#if defined(__has_include)
#if __has_include(<mach/mig_strncpy_zerofill_support.h>)
#ifndef USING_MIG_STRNCPY_ZEROFILL
#define USING_MIG_STRNCPY_ZEROFILL
#endif
#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__
#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__
#ifdef __cplusplus
extern "C" {
#endif
extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import));
#ifdef __cplusplus
}
#endif
#endif /* __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ */
#endif /* __has_include(<mach/mig_strncpy_zerofill_support.h>) */
#endif /* __has_include */
/* END MIG_STRNCPY_ZEROFILL CODE */
#ifdef AUTOTEST
#ifndef FUNCTION_PTR_T
#define FUNCTION_PTR_T
typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t);
typedef struct {
char *name;
function_ptr_t function;
} function_table_entry;
typedef function_table_entry *function_table_t;
#endif /* FUNCTION_PTR_T */
#endif /* AUTOTEST */
#ifndef clock_priv_MSG_COUNT
#define clock_priv_MSG_COUNT 2
#endif /* clock_priv_MSG_COUNT */
#include <mach/std_types.h>
#include <mach/mig.h>
#include <mach/mig.h>
#include <mach/mach_types.h>
#include <mach/mach_types.h>
#ifdef __BeforeMigUserHeader
__BeforeMigUserHeader
#endif /* __BeforeMigUserHeader */
#include <sys/cdefs.h>
__BEGIN_DECLS
/* Routine clock_set_time */
#ifdef mig_external
mig_external
#else
extern
#endif /* mig_external */
kern_return_t clock_set_time
(
clock_ctrl_t clock_ctrl,
mach_timespec_t new_time
);
/* Routine clock_set_attributes */
#ifdef mig_external
mig_external
#else
extern
#endif /* mig_external */
kern_return_t clock_set_attributes
(
clock_ctrl_t clock_ctrl,
clock_flavor_t flavor,
clock_attr_t clock_attr,
mach_msg_type_number_t clock_attrCnt
);
__END_DECLS
/********************** Caution **************************/
/* The following data types should be used to calculate */
/* maximum message sizes only. The actual message may be */
/* smaller, and the position of the arguments within the */
/* message layout may vary from what is presented here. */
/* For example, if any of the arguments are variable- */
/* sized, and less than the maximum is sent, the data */
/* will be packed tight in the actual message to reduce */
/* the presence of holes. */
/********************** Caution **************************/
/* typedefs for all requests */
#ifndef __Request__clock_priv_subsystem__defined
#define __Request__clock_priv_subsystem__defined
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
NDR_record_t NDR;
mach_timespec_t new_time;
} __Request__clock_set_time_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
NDR_record_t NDR;
clock_flavor_t flavor;
mach_msg_type_number_t clock_attrCnt;
int clock_attr[1];
} __Request__clock_set_attributes_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#endif /* !__Request__clock_priv_subsystem__defined */
/* union of all requests */
#ifndef __RequestUnion__clock_priv_subsystem__defined
#define __RequestUnion__clock_priv_subsystem__defined
union __RequestUnion__clock_priv_subsystem {
__Request__clock_set_time_t Request_clock_set_time;
__Request__clock_set_attributes_t Request_clock_set_attributes;
};
#endif /* !__RequestUnion__clock_priv_subsystem__defined */
/* typedefs for all replies */
#ifndef __Reply__clock_priv_subsystem__defined
#define __Reply__clock_priv_subsystem__defined
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
NDR_record_t NDR;
kern_return_t RetCode;
} __Reply__clock_set_time_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
NDR_record_t NDR;
kern_return_t RetCode;
} __Reply__clock_set_attributes_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#endif /* !__Reply__clock_priv_subsystem__defined */
/* union of all replies */
#ifndef __ReplyUnion__clock_priv_subsystem__defined
#define __ReplyUnion__clock_priv_subsystem__defined
union __ReplyUnion__clock_priv_subsystem {
__Reply__clock_set_time_t Reply_clock_set_time;
__Reply__clock_set_attributes_t Reply_clock_set_attributes;
};
#endif /* !__RequestUnion__clock_priv_subsystem__defined */
#ifndef subsystem_to_name_map_clock_priv
#define subsystem_to_name_map_clock_priv \
{ "clock_set_time", 1200 },\
{ "clock_set_attributes", 1201 }
#endif
#ifdef __AfterMigUserHeader
__AfterMigUserHeader
#endif /* __AfterMigUserHeader */
#endif /* _clock_priv_user_ */

View file

@ -1,56 +0,0 @@
/*
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
/*
* File: clock_reply.defs
* Purpose: Kernel clock subsystem definitions. This
* file defines the clock reply interface.
*/
subsystem
#if KERNEL_USER
KernelUser
#endif /* KERNEL_USER */
clock_reply 3125107; /* Matches up with old value */
#include <mach/std_types.defs>
#include <mach/clock_types.defs>
/*
* Reply routine for clock_alarm.
*/
simpleroutine clock_alarm_reply(
alarm_port : clock_reply_t;
alarm_code : kern_return_t;
alarm_type : alarm_type_t;
alarm_time : mach_timespec_t);
/* vim: set ft=c : */

View file

@ -1,159 +0,0 @@
#ifndef _clock_reply_user_
#define _clock_reply_user_
/* Module clock_reply */
#include <string.h>
#include <mach/ndr.h>
#include <mach/boolean.h>
#include <mach/kern_return.h>
#include <mach/notify.h>
#include <mach/mach_types.h>
#include <mach/message.h>
#include <mach/mig_errors.h>
#include <mach/port.h>
/* BEGIN MIG_STRNCPY_ZEROFILL CODE */
#if defined(__has_include)
#if __has_include(<mach/mig_strncpy_zerofill_support.h>)
#ifndef USING_MIG_STRNCPY_ZEROFILL
#define USING_MIG_STRNCPY_ZEROFILL
#endif
#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__
#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__
#ifdef __cplusplus
extern "C" {
#endif
extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import));
#ifdef __cplusplus
}
#endif
#endif /* __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ */
#endif /* __has_include(<mach/mig_strncpy_zerofill_support.h>) */
#endif /* __has_include */
/* END MIG_STRNCPY_ZEROFILL CODE */
#ifdef AUTOTEST
#ifndef FUNCTION_PTR_T
#define FUNCTION_PTR_T
typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t);
typedef struct {
char *name;
function_ptr_t function;
} function_table_entry;
typedef function_table_entry *function_table_t;
#endif /* FUNCTION_PTR_T */
#endif /* AUTOTEST */
#ifndef clock_reply_MSG_COUNT
#define clock_reply_MSG_COUNT 1
#endif /* clock_reply_MSG_COUNT */
#include <mach/std_types.h>
#include <mach/mig.h>
#include <mach/mach_types.h>
#ifdef __BeforeMigUserHeader
__BeforeMigUserHeader
#endif /* __BeforeMigUserHeader */
#include <sys/cdefs.h>
__BEGIN_DECLS
/* SimpleRoutine clock_alarm_reply */
#ifdef mig_external
mig_external
#else
extern
#endif /* mig_external */
kern_return_t clock_alarm_reply
(
clock_reply_t alarm_port,
mach_msg_type_name_t alarm_portPoly,
kern_return_t alarm_code,
alarm_type_t alarm_type,
mach_timespec_t alarm_time
);
__END_DECLS
/********************** Caution **************************/
/* The following data types should be used to calculate */
/* maximum message sizes only. The actual message may be */
/* smaller, and the position of the arguments within the */
/* message layout may vary from what is presented here. */
/* For example, if any of the arguments are variable- */
/* sized, and less than the maximum is sent, the data */
/* will be packed tight in the actual message to reduce */
/* the presence of holes. */
/********************** Caution **************************/
/* typedefs for all requests */
#ifndef __Request__clock_reply_subsystem__defined
#define __Request__clock_reply_subsystem__defined
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
NDR_record_t NDR;
kern_return_t alarm_code;
alarm_type_t alarm_type;
mach_timespec_t alarm_time;
} __Request__clock_alarm_reply_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#endif /* !__Request__clock_reply_subsystem__defined */
/* union of all requests */
#ifndef __RequestUnion__clock_reply_subsystem__defined
#define __RequestUnion__clock_reply_subsystem__defined
union __RequestUnion__clock_reply_subsystem {
__Request__clock_alarm_reply_t Request_clock_alarm_reply;
};
#endif /* !__RequestUnion__clock_reply_subsystem__defined */
/* typedefs for all replies */
#ifndef __Reply__clock_reply_subsystem__defined
#define __Reply__clock_reply_subsystem__defined
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
NDR_record_t NDR;
kern_return_t RetCode;
} __Reply__clock_alarm_reply_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#endif /* !__Reply__clock_reply_subsystem__defined */
/* union of all replies */
#ifndef __ReplyUnion__clock_reply_subsystem__defined
#define __ReplyUnion__clock_reply_subsystem__defined
union __ReplyUnion__clock_reply_subsystem {
__Reply__clock_alarm_reply_t Reply_clock_alarm_reply;
};
#endif /* !__RequestUnion__clock_reply_subsystem__defined */
#ifndef subsystem_to_name_map_clock_reply
#define subsystem_to_name_map_clock_reply \
{ "clock_alarm_reply", 3125107 }
#endif
#ifdef __AfterMigUserHeader
__AfterMigUserHeader
#endif /* __AfterMigUserHeader */
#endif /* _clock_reply_user_ */

View file

@ -1,73 +0,0 @@
/*
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
/*
* File: clock_types.defs
* Purpose:
* Clock kernel interface type declarations
*/
#ifndef _MACH_CLOCK_TYPES_DEFS_
#define _MACH_CLOCK_TYPES_DEFS_
#include <mach/std_types.defs>
type clock_serv_t = mach_port_t
cusertype: clock_serv_t
#if KERNEL_SERVER
intran: clock_serv_t convert_port_to_clock(mach_port_t)
outtran: mach_port_t convert_clock_to_port(clock_serv_t)
#endif /* KERNEL_SERVER */
;
type clock_ctrl_t = mach_port_t
cusertype: clock_ctrl_t
#if KERNEL_SERVER
intran: clock_ctrl_t convert_port_to_clock_ctrl(mach_port_t)
outtran: mach_port_t convert_clock_ctrl_to_port(clock_ctrl_t)
#endif /* KERNEL_SERVER */
;
type clock_reply_t = polymorphic|MACH_MSG_TYPE_MAKE_SEND_ONCE;
type clock_flavor_t = int;
type clock_attr_t = array[*:1] of int;
type mach_timespec_t = struct[2] of int;
type time_t = int;
type sleep_type_t = int;
type alarm_type_t = int;
type clock_res_t = int;
type clock_id_t = int;
import <mach/mach_types.h>;
#endif /* _MACH_CLOCK_TYPES_DEFS_ */
/* vim: set ft=c : */

View file

@ -1,127 +0,0 @@
/*
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
/*
* File: clock_types.h
* Purpose: Clock facility header definitions. These
* definitons are needed by both kernel and
* user-level software.
*/
/*
* All interfaces defined here are obsolete.
*/
#ifndef _MACH_CLOCK_TYPES_H_
#define _MACH_CLOCK_TYPES_H_
#include <stdint.h>
#include <mach/time_value.h>
/*
* Type definitions.
*/
typedef int alarm_type_t; /* alarm time type */
typedef int sleep_type_t; /* sleep time type */
typedef int clock_id_t; /* clock identification type */
typedef int clock_flavor_t; /* clock flavor type */
typedef int *clock_attr_t; /* clock attribute type */
typedef int clock_res_t; /* clock resolution type */
/*
* Normal time specification used by the kernel clock facility.
*/
struct mach_timespec {
unsigned int tv_sec; /* seconds */
clock_res_t tv_nsec; /* nanoseconds */
};
typedef struct mach_timespec mach_timespec_t;
/*
* Reserved clock id values for default clocks.
*/
#define SYSTEM_CLOCK 0
#define CALENDAR_CLOCK 1
#define REALTIME_CLOCK 0
/*
* Attribute names.
*/
#define CLOCK_GET_TIME_RES 1 /* get_time call resolution */
/* 2 * was map_time call resolution */
#define CLOCK_ALARM_CURRES 3 /* current alarm resolution */
#define CLOCK_ALARM_MINRES 4 /* minimum alarm resolution */
#define CLOCK_ALARM_MAXRES 5 /* maximum alarm resolution */
#define NSEC_PER_USEC 1000ull /* nanoseconds per microsecond */
#define USEC_PER_SEC 1000000ull /* microseconds per second */
#define NSEC_PER_SEC 1000000000ull /* nanoseconds per second */
#define NSEC_PER_MSEC 1000000ull /* nanoseconds per millisecond */
#define BAD_MACH_TIMESPEC(t) \
((t)->tv_nsec < 0 || (t)->tv_nsec >= (long)NSEC_PER_SEC)
/* t1 <=> t2, also (t1 - t2) in nsec with max of +- 1 sec */
#define CMP_MACH_TIMESPEC(t1, t2) \
((t1)->tv_sec > (t2)->tv_sec ? (long) +NSEC_PER_SEC : \
((t1)->tv_sec < (t2)->tv_sec ? (long) -NSEC_PER_SEC : \
(t1)->tv_nsec - (t2)->tv_nsec))
/* t1 += t2 */
#define ADD_MACH_TIMESPEC(t1, t2) \
do { \
if (((t1)->tv_nsec += (t2)->tv_nsec) >= (long) NSEC_PER_SEC) { \
(t1)->tv_nsec -= (long) NSEC_PER_SEC; \
(t1)->tv_sec += 1; \
} \
(t1)->tv_sec += (t2)->tv_sec; \
} while (0)
/* t1 -= t2 */
#define SUB_MACH_TIMESPEC(t1, t2) \
do { \
if (((t1)->tv_nsec -= (t2)->tv_nsec) < 0) { \
(t1)->tv_nsec += (long) NSEC_PER_SEC; \
(t1)->tv_sec -= 1; \
} \
(t1)->tv_sec -= (t2)->tv_sec; \
} while (0)
/*
* Alarm parameter defines.
*/
#define ALRMTYPE 0xff /* type (8-bit field) */
#define TIME_ABSOLUTE 0x00 /* absolute time */
#define TIME_RELATIVE 0x01 /* relative time */
#define BAD_ALRMTYPE(t) (((t) &~ TIME_RELATIVE) != 0)
#endif /* _MACH_CLOCK_TYPES_H_ */

View file

@ -1,66 +0,0 @@
/*
* Copyright (c) 2016 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef _MACH_DYLIB_INFO_H_
#define _MACH_DYLIB_INFO_H_
#include <mach/boolean.h>
#include <stdint.h>
#include <sys/_types/_fsid_t.h>
#include <sys/_types/_u_int32_t.h>
#include <sys/_types/_fsobj_id_t.h>
#include <sys/_types/_uuid_t.h>
/* These definitions must be kept in sync with the ones in
* osfmk/mach/mach_types.defs.
*/
struct dyld_kernel_image_info {
uuid_t uuid;
fsobj_id_t fsobjid;
fsid_t fsid;
uint64_t load_addr;
};
struct dyld_kernel_process_info {
struct dyld_kernel_image_info cache_image_info;
uint64_t timestamp; // mach_absolute_time of last time dyld change to image list
uint32_t imageCount; // number of images currently loaded into process
uint32_t initialImageCount; // number of images statically loaded into process (before any dlopen() calls)
uint8_t dyldState; // one of dyld_process_state_* values
boolean_t no_cache; // process is running without a dyld cache
boolean_t private_cache; // process is using a private copy of its dyld cache
};
/* typedefs so our MIG is sane */
typedef struct dyld_kernel_image_info dyld_kernel_image_info_t;
typedef struct dyld_kernel_process_info dyld_kernel_process_info_t;
typedef dyld_kernel_image_info_t *dyld_kernel_image_info_array_t;
#endif /* _MACH_DYLIB_INFO_H_ */

View file

@ -1,114 +0,0 @@
/*
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
/*
* Mach Operating System
* Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
*/
/*
* File: mach/error.h
* Purpose:
* error module definitions
*
*/
#ifndef _MACH_ERROR_H_
#define _MACH_ERROR_H_
#include <mach/kern_return.h>
/*
* error number layout as follows:
*
* hi lo
* | system(6) | subsystem(12) | code(14) |
*/
#define err_none (mach_error_t)0
#define ERR_SUCCESS (mach_error_t)0
#define ERR_ROUTINE_NIL (mach_error_fn_t)0
#define err_system(x) ((signed)((((unsigned)(x))&0x3f)<<26))
#define err_sub(x) (((x)&0xfff)<<14)
#define err_get_system(err) (((err)>>26)&0x3f)
#define err_get_sub(err) (((err)>>14)&0xfff)
#define err_get_code(err) ((err)&0x3fff)
#define system_emask (err_system(0x3f))
#define sub_emask (err_sub(0xfff))
#define code_emask (0x3fff)
/* major error systems */
#define err_kern err_system(0x0) /* kernel */
#define err_us err_system(0x1) /* user space library */
#define err_server err_system(0x2) /* user space servers */
#define err_ipc err_system(0x3) /* old ipc errors */
#define err_mach_ipc err_system(0x4) /* mach-ipc errors */
#define err_dipc err_system(0x7) /* distributed ipc */
#define err_local err_system(0x3e) /* user defined errors */
#define err_ipc_compat err_system(0x3f) /* (compatibility) mach-ipc errors */
#define err_max_system 0x3f
/* unix errors get lumped into one subsystem */
#define unix_err(errno) (err_kern|err_sub(3)|errno)
typedef kern_return_t mach_error_t;
typedef mach_error_t (* mach_error_fn_t)( void );
#endif /* _MACH_ERROR_H_ */

View file

@ -1,133 +0,0 @@
/*
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
/*
* Mach Operating System
* Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
*/
/*
* Abstract:
* MiG definitions file for Mach exception interface.
*/
subsystem
#if KERNEL_SERVER
KernelServer
#endif /* KERNEL_SERVER */
#if KERNEL_USER
KernelUser
#endif
exc 2401;
#include <mach/std_types.defs>
#include <mach/mach_types.defs>
ServerPrefix catch_;
type exception_data_t = array[*:2] of integer_t;
type exception_type_t = int;
routine exception_raise(
exception_port : mach_port_t;
thread : mach_port_t;
task : mach_port_t;
exception : exception_type_t;
code : exception_data_t
#if EXC_SERVER_SECTOKEN
;
ServerSecToken stoken : security_token_t
#endif
#if EXC_SERVER_AUDITTOKEN
;
ServerAuditToken atoken: audit_token_t
#endif
);
routine exception_raise_state(
exception_port : mach_port_t;
exception : exception_type_t;
code : exception_data_t, const;
inout flavor : int;
old_state : thread_state_t, const;
out new_state : thread_state_t
#if EXC_SERVER_SECTOKEN
;
ServerSecToken stoken : security_token_t
#endif
#if EXC_SERVER_AUDITTOKEN
;
ServerAuditToken atoken: audit_token_t
#endif
);
routine exception_raise_state_identity(
exception_port : mach_port_t;
thread : mach_port_t;
task : mach_port_t;
exception : exception_type_t;
code : exception_data_t;
inout flavor : int;
old_state : thread_state_t;
out new_state : thread_state_t
#if EXC_SERVER_SECTOKEN
;
ServerSecToken stoken : security_token_t
#endif
#if EXC_SERVER_AUDITTOKEN
;
ServerAuditToken atoken: audit_token_t
#endif
);
/* vim: set ft=c : */

View file

@ -1,281 +0,0 @@
#ifndef _exc_user_
#define _exc_user_
/* Module exc */
#include <string.h>
#include <mach/ndr.h>
#include <mach/boolean.h>
#include <mach/kern_return.h>
#include <mach/notify.h>
#include <mach/mach_types.h>
#include <mach/message.h>
#include <mach/mig_errors.h>
#include <mach/port.h>
/* BEGIN MIG_STRNCPY_ZEROFILL CODE */
#if defined(__has_include)
#if __has_include(<mach/mig_strncpy_zerofill_support.h>)
#ifndef USING_MIG_STRNCPY_ZEROFILL
#define USING_MIG_STRNCPY_ZEROFILL
#endif
#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__
#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__
#ifdef __cplusplus
extern "C" {
#endif
extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import));
#ifdef __cplusplus
}
#endif
#endif /* __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ */
#endif /* __has_include(<mach/mig_strncpy_zerofill_support.h>) */
#endif /* __has_include */
/* END MIG_STRNCPY_ZEROFILL CODE */
#ifdef AUTOTEST
#ifndef FUNCTION_PTR_T
#define FUNCTION_PTR_T
typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t);
typedef struct {
char *name;
function_ptr_t function;
} function_table_entry;
typedef function_table_entry *function_table_t;
#endif /* FUNCTION_PTR_T */
#endif /* AUTOTEST */
#ifndef exc_MSG_COUNT
#define exc_MSG_COUNT 3
#endif /* exc_MSG_COUNT */
#include <mach/std_types.h>
#include <mach/mig.h>
#include <mach/mig.h>
#include <mach/mach_types.h>
#ifdef __BeforeMigUserHeader
__BeforeMigUserHeader
#endif /* __BeforeMigUserHeader */
#include <sys/cdefs.h>
__BEGIN_DECLS
/* Routine exception_raise */
#ifdef mig_external
mig_external
#else
extern
#endif /* mig_external */
kern_return_t exception_raise
(
mach_port_t exception_port,
mach_port_t thread,
mach_port_t task,
exception_type_t exception,
exception_data_t code,
mach_msg_type_number_t codeCnt
);
/* Routine exception_raise_state */
#ifdef mig_external
mig_external
#else
extern
#endif /* mig_external */
kern_return_t exception_raise_state
(
mach_port_t exception_port,
exception_type_t exception,
const exception_data_t code,
mach_msg_type_number_t codeCnt,
int *flavor,
const thread_state_t old_state,
mach_msg_type_number_t old_stateCnt,
thread_state_t new_state,
mach_msg_type_number_t *new_stateCnt
);
/* Routine exception_raise_state_identity */
#ifdef mig_external
mig_external
#else
extern
#endif /* mig_external */
kern_return_t exception_raise_state_identity
(
mach_port_t exception_port,
mach_port_t thread,
mach_port_t task,
exception_type_t exception,
exception_data_t code,
mach_msg_type_number_t codeCnt,
int *flavor,
thread_state_t old_state,
mach_msg_type_number_t old_stateCnt,
thread_state_t new_state,
mach_msg_type_number_t *new_stateCnt
);
__END_DECLS
/********************** Caution **************************/
/* The following data types should be used to calculate */
/* maximum message sizes only. The actual message may be */
/* smaller, and the position of the arguments within the */
/* message layout may vary from what is presented here. */
/* For example, if any of the arguments are variable- */
/* sized, and less than the maximum is sent, the data */
/* will be packed tight in the actual message to reduce */
/* the presence of holes. */
/********************** Caution **************************/
/* typedefs for all requests */
#ifndef __Request__exc_subsystem__defined
#define __Request__exc_subsystem__defined
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
/* start of the kernel processed data */
mach_msg_body_t msgh_body;
mach_msg_port_descriptor_t thread;
mach_msg_port_descriptor_t task;
/* end of the kernel processed data */
NDR_record_t NDR;
exception_type_t exception;
mach_msg_type_number_t codeCnt;
integer_t code[2];
} __Request__exception_raise_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
NDR_record_t NDR;
exception_type_t exception;
mach_msg_type_number_t codeCnt;
integer_t code[2];
int flavor;
mach_msg_type_number_t old_stateCnt;
natural_t old_state[614];
} __Request__exception_raise_state_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
/* start of the kernel processed data */
mach_msg_body_t msgh_body;
mach_msg_port_descriptor_t thread;
mach_msg_port_descriptor_t task;
/* end of the kernel processed data */
NDR_record_t NDR;
exception_type_t exception;
mach_msg_type_number_t codeCnt;
integer_t code[2];
int flavor;
mach_msg_type_number_t old_stateCnt;
natural_t old_state[614];
} __Request__exception_raise_state_identity_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#endif /* !__Request__exc_subsystem__defined */
/* union of all requests */
#ifndef __RequestUnion__exc_subsystem__defined
#define __RequestUnion__exc_subsystem__defined
union __RequestUnion__exc_subsystem {
__Request__exception_raise_t Request_exception_raise;
__Request__exception_raise_state_t Request_exception_raise_state;
__Request__exception_raise_state_identity_t Request_exception_raise_state_identity;
};
#endif /* !__RequestUnion__exc_subsystem__defined */
/* typedefs for all replies */
#ifndef __Reply__exc_subsystem__defined
#define __Reply__exc_subsystem__defined
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
NDR_record_t NDR;
kern_return_t RetCode;
} __Reply__exception_raise_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
NDR_record_t NDR;
kern_return_t RetCode;
int flavor;
mach_msg_type_number_t new_stateCnt;
natural_t new_state[614];
} __Reply__exception_raise_state_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
NDR_record_t NDR;
kern_return_t RetCode;
int flavor;
mach_msg_type_number_t new_stateCnt;
natural_t new_state[614];
} __Reply__exception_raise_state_identity_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#endif /* !__Reply__exc_subsystem__defined */
/* union of all replies */
#ifndef __ReplyUnion__exc_subsystem__defined
#define __ReplyUnion__exc_subsystem__defined
union __ReplyUnion__exc_subsystem {
__Reply__exception_raise_t Reply_exception_raise;
__Reply__exception_raise_state_t Reply_exception_raise_state;
__Reply__exception_raise_state_identity_t Reply_exception_raise_state_identity;
};
#endif /* !__RequestUnion__exc_subsystem__defined */
#ifndef subsystem_to_name_map_exc
#define subsystem_to_name_map_exc \
{ "exception_raise", 2401 },\
{ "exception_raise_state", 2402 },\
{ "exception_raise_state_identity", 2403 }
#endif
#ifdef __AfterMigUserHeader
__AfterMigUserHeader
#endif /* __AfterMigUserHeader */
#endif /* _exc_user_ */

View file

@ -1,62 +0,0 @@
/*
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
/*
* Mach Operating System
* Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
#ifndef _MACH_EXCEPTION_H_
#define _MACH_EXCEPTION_H_
#include <mach/exception_types.h>
#endif /* _MACH_EXCEPTION_H_ */

View file

@ -1,204 +0,0 @@
/*
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
/*
* Mach Operating System
* Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
*/
#ifndef _MACH_EXCEPTION_TYPES_H_
#define _MACH_EXCEPTION_TYPES_H_
#include <mach/machine/exception.h>
/*
* Machine-independent exception definitions.
*/
#define EXC_BAD_ACCESS 1 /* Could not access memory */
/* Code contains kern_return_t describing error. */
/* Subcode contains bad memory address. */
#define EXC_BAD_INSTRUCTION 2 /* Instruction failed */
/* Illegal or undefined instruction or operand */
#define EXC_ARITHMETIC 3 /* Arithmetic exception */
/* Exact nature of exception is in code field */
#define EXC_EMULATION 4 /* Emulation instruction */
/* Emulation support instruction encountered */
/* Details in code and subcode fields */
#define EXC_SOFTWARE 5 /* Software generated exception */
/* Exact exception is in code field. */
/* Codes 0 - 0xFFFF reserved to hardware */
/* Codes 0x10000 - 0x1FFFF reserved for OS emulation (Unix) */
#define EXC_BREAKPOINT 6 /* Trace, breakpoint, etc. */
/* Details in code field. */
#define EXC_SYSCALL 7 /* System calls. */
#define EXC_MACH_SYSCALL 8 /* Mach system calls. */
#define EXC_RPC_ALERT 9 /* RPC alert */
#define EXC_CRASH 10 /* Abnormal process exit */
#define EXC_RESOURCE 11 /* Hit resource consumption limit */
/* Exact resource is in code field. */
#define EXC_GUARD 12 /* Violated guarded resource protections */
#define EXC_CORPSE_NOTIFY 13 /* Abnormal process exited to corpse state */
#define EXC_CORPSE_VARIANT_BIT 0x100 /* bit set for EXC_*_CORPSE variants of EXC_* */
/*
* Machine-independent exception behaviors
*/
# define EXCEPTION_DEFAULT 1
/* Send a catch_exception_raise message including the identity.
*/
# define EXCEPTION_STATE 2
/* Send a catch_exception_raise_state message including the
* thread state.
*/
# define EXCEPTION_STATE_IDENTITY 3
/* Send a catch_exception_raise_state_identity message including
* the thread identity and state.
*/
#define MACH_EXCEPTION_ERRORS 0x40000000
/* include additional exception specific errors, not used yet. */
#define MACH_EXCEPTION_CODES 0x80000000
/* Send 64-bit code and subcode in the exception header */
#define MACH_EXCEPTION_MASK (MACH_EXCEPTION_CODES | MACH_EXCEPTION_ERRORS)
/*
* Masks for exception definitions, above
* bit zero is unused, therefore 1 word = 31 exception types
*/
#define EXC_MASK_BAD_ACCESS (1 << EXC_BAD_ACCESS)
#define EXC_MASK_BAD_INSTRUCTION (1 << EXC_BAD_INSTRUCTION)
#define EXC_MASK_ARITHMETIC (1 << EXC_ARITHMETIC)
#define EXC_MASK_EMULATION (1 << EXC_EMULATION)
#define EXC_MASK_SOFTWARE (1 << EXC_SOFTWARE)
#define EXC_MASK_BREAKPOINT (1 << EXC_BREAKPOINT)
#define EXC_MASK_SYSCALL (1 << EXC_SYSCALL)
#define EXC_MASK_MACH_SYSCALL (1 << EXC_MACH_SYSCALL)
#define EXC_MASK_RPC_ALERT (1 << EXC_RPC_ALERT)
#define EXC_MASK_CRASH (1 << EXC_CRASH)
#define EXC_MASK_RESOURCE (1 << EXC_RESOURCE)
#define EXC_MASK_GUARD (1 << EXC_GUARD)
#define EXC_MASK_CORPSE_NOTIFY (1 << EXC_CORPSE_NOTIFY)
#define EXC_MASK_ALL (EXC_MASK_BAD_ACCESS | \
EXC_MASK_BAD_INSTRUCTION | \
EXC_MASK_ARITHMETIC | \
EXC_MASK_EMULATION | \
EXC_MASK_SOFTWARE | \
EXC_MASK_BREAKPOINT | \
EXC_MASK_SYSCALL | \
EXC_MASK_MACH_SYSCALL | \
EXC_MASK_RPC_ALERT | \
EXC_MASK_RESOURCE | \
EXC_MASK_GUARD | \
EXC_MASK_MACHINE)
#define FIRST_EXCEPTION 1 /* ZERO is illegal */
/*
* Machine independent codes for EXC_SOFTWARE
* Codes 0x10000 - 0x1FFFF reserved for OS emulation (Unix)
* 0x10000 - 0x10002 in use for unix signals
* 0x20000 - 0x2FFFF reserved for MACF
*/
#define EXC_SOFT_SIGNAL 0x10003 /* Unix signal exceptions */
#define EXC_MACF_MIN 0x20000 /* MACF exceptions */
#define EXC_MACF_MAX 0x2FFFF
#ifndef ASSEMBLER
#include <mach/port.h>
#include <mach/thread_status.h>
#include <mach/machine/vm_types.h>
/*
* Exported types
*/
typedef int exception_type_t;
typedef integer_t exception_data_type_t;
typedef int64_t mach_exception_data_type_t;
typedef int exception_behavior_t;
typedef exception_data_type_t *exception_data_t;
typedef mach_exception_data_type_t *mach_exception_data_t;
typedef unsigned int exception_mask_t;
typedef exception_mask_t *exception_mask_array_t;
typedef exception_behavior_t *exception_behavior_array_t;
typedef thread_state_flavor_t *exception_flavor_array_t;
typedef mach_port_t *exception_port_array_t;
typedef mach_exception_data_type_t mach_exception_code_t;
typedef mach_exception_data_type_t mach_exception_subcode_t;
#endif /* ASSEMBLER */
#endif /* _MACH_EXCEPTION_TYPES_H_ */

View file

@ -1,260 +0,0 @@
/*
* Copyright (c) 2000-2015 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
/*
* Mach Operating System
* Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
* File: mach/host_info.h
*
* Definitions for host_info call.
*/
#ifndef _MACH_HOST_INFO_H_
#define _MACH_HOST_INFO_H_
#include <mach/message.h>
#include <mach/vm_statistics.h>
#include <mach/machine.h>
#include <mach/machine/vm_types.h>
#include <mach/time_value.h>
#include <sys/cdefs.h>
/*
* Generic information structure to allow for expansion.
*/
typedef integer_t *host_info_t; /* varying array of int. */
typedef integer_t *host_info64_t; /* varying array of int. */
#define HOST_INFO_MAX (1024) /* max array size */
typedef integer_t host_info_data_t[HOST_INFO_MAX];
#define KERNEL_VERSION_MAX (512)
typedef char kernel_version_t[KERNEL_VERSION_MAX];
#define KERNEL_BOOT_INFO_MAX (4096)
typedef char kernel_boot_info_t[KERNEL_BOOT_INFO_MAX];
/*
* Currently defined information.
*/
/* host_info() */
typedef integer_t host_flavor_t;
#define HOST_BASIC_INFO 1 /* basic info */
#define HOST_SCHED_INFO 3 /* scheduling info */
#define HOST_RESOURCE_SIZES 4 /* kernel struct sizes */
#define HOST_PRIORITY_INFO 5 /* priority information */
#define HOST_SEMAPHORE_TRAPS 7 /* Has semaphore traps */
#define HOST_MACH_MSG_TRAP 8 /* Has mach_msg_trap */
#define HOST_VM_PURGABLE 9 /* purg'e'able memory info */
#define HOST_DEBUG_INFO_INTERNAL 10 /* Used for kernel internal development tests only */
#define HOST_CAN_HAS_DEBUGGER 11
#define HOST_PREFERRED_USER_ARCH 12 /* Get the preferred user-space architecture */
struct host_can_has_debugger_info {
boolean_t can_has_debugger;
};
typedef struct host_can_has_debugger_info host_can_has_debugger_info_data_t;
typedef struct host_can_has_debugger_info *host_can_has_debugger_info_t;
#define HOST_CAN_HAS_DEBUGGER_COUNT ((mach_msg_type_number_t) \
(sizeof(host_can_has_debugger_info_data_t)/sizeof(integer_t)))
#pragma pack(push, 4)
struct host_basic_info {
integer_t max_cpus; /* max number of CPUs possible */
integer_t avail_cpus; /* number of CPUs now available */
natural_t memory_size; /* size of memory in bytes, capped at 2 GB */
cpu_type_t cpu_type; /* cpu type */
cpu_subtype_t cpu_subtype; /* cpu subtype */
cpu_threadtype_t cpu_threadtype; /* cpu threadtype */
integer_t physical_cpu; /* number of physical CPUs now available */
integer_t physical_cpu_max; /* max number of physical CPUs possible */
integer_t logical_cpu; /* number of logical cpu now available */
integer_t logical_cpu_max; /* max number of physical CPUs possible */
uint64_t max_mem; /* actual size of physical memory */
};
#pragma pack(pop)
typedef struct host_basic_info host_basic_info_data_t;
typedef struct host_basic_info *host_basic_info_t;
#define HOST_BASIC_INFO_COUNT ((mach_msg_type_number_t) \
(sizeof(host_basic_info_data_t)/sizeof(integer_t)))
struct host_sched_info {
integer_t min_timeout; /* minimum timeout in milliseconds */
integer_t min_quantum; /* minimum quantum in milliseconds */
};
typedef struct host_sched_info host_sched_info_data_t;
typedef struct host_sched_info *host_sched_info_t;
#define HOST_SCHED_INFO_COUNT ((mach_msg_type_number_t) \
(sizeof(host_sched_info_data_t)/sizeof(integer_t)))
struct kernel_resource_sizes {
natural_t task;
natural_t thread;
natural_t port;
natural_t memory_region;
natural_t memory_object;
};
typedef struct kernel_resource_sizes kernel_resource_sizes_data_t;
typedef struct kernel_resource_sizes *kernel_resource_sizes_t;
#define HOST_RESOURCE_SIZES_COUNT ((mach_msg_type_number_t) \
(sizeof(kernel_resource_sizes_data_t)/sizeof(integer_t)))
struct host_priority_info {
integer_t kernel_priority;
integer_t system_priority;
integer_t server_priority;
integer_t user_priority;
integer_t depress_priority;
integer_t idle_priority;
integer_t minimum_priority;
integer_t maximum_priority;
};
typedef struct host_priority_info host_priority_info_data_t;
typedef struct host_priority_info *host_priority_info_t;
#define HOST_PRIORITY_INFO_COUNT ((mach_msg_type_number_t) \
(sizeof(host_priority_info_data_t)/sizeof(integer_t)))
/* host_statistics() */
#define HOST_LOAD_INFO 1 /* System loading stats */
#define HOST_VM_INFO 2 /* Virtual memory stats */
#define HOST_CPU_LOAD_INFO 3 /* CPU load stats */
/* host_statistics64() */
#define HOST_VM_INFO64 4 /* 64-bit virtual memory stats */
#define HOST_EXTMOD_INFO64 5 /* External modification stats */
#define HOST_EXPIRED_TASK_INFO 6 /* Statistics for expired tasks */
struct host_load_info {
integer_t avenrun[3]; /* scaled by LOAD_SCALE */
integer_t mach_factor[3]; /* scaled by LOAD_SCALE */
};
typedef struct host_load_info host_load_info_data_t;
typedef struct host_load_info *host_load_info_t;
#define HOST_LOAD_INFO_COUNT ((mach_msg_type_number_t) \
(sizeof(host_load_info_data_t)/sizeof(integer_t)))
typedef struct vm_purgeable_info host_purgable_info_data_t;
typedef struct vm_purgeable_info *host_purgable_info_t;
#define HOST_VM_PURGABLE_COUNT ((mach_msg_type_number_t) \
(sizeof(host_purgable_info_data_t)/sizeof(integer_t)))
/* in <mach/vm_statistics.h> */
/* vm_statistics64 */
#define HOST_VM_INFO64_COUNT ((mach_msg_type_number_t) \
(sizeof(vm_statistics64_data_t)/sizeof(integer_t)))
/* size of the latest version of the structure */
#define HOST_VM_INFO64_LATEST_COUNT HOST_VM_INFO64_COUNT
#define HOST_VM_INFO64_REV1_COUNT HOST_VM_INFO64_LATEST_COUNT
/* previous versions: adjust the size according to what was added each time */
#define HOST_VM_INFO64_REV0_COUNT /* added compression and swapper info (14 ints) */ \
((mach_msg_type_number_t) \
(HOST_VM_INFO64_REV1_COUNT - 14))
/* in <mach/vm_statistics.h> */
/* vm_extmod_statistics */
#define HOST_EXTMOD_INFO64_COUNT ((mach_msg_type_number_t) \
(sizeof(vm_extmod_statistics_data_t)/sizeof(integer_t)))
/* size of the latest version of the structure */
#define HOST_EXTMOD_INFO64_LATEST_COUNT HOST_EXTMOD_INFO64_COUNT
/* vm_statistics */
#define HOST_VM_INFO_COUNT ((mach_msg_type_number_t) \
(sizeof(vm_statistics_data_t)/sizeof(integer_t)))
/* size of the latest version of the structure */
#define HOST_VM_INFO_LATEST_COUNT HOST_VM_INFO_COUNT
#define HOST_VM_INFO_REV2_COUNT HOST_VM_INFO_LATEST_COUNT
/* previous versions: adjust the size according to what was added each time */
#define HOST_VM_INFO_REV1_COUNT /* added "speculative_count" (1 int) */ \
((mach_msg_type_number_t) \
(HOST_VM_INFO_REV2_COUNT - 1))
#define HOST_VM_INFO_REV0_COUNT /* added "purgable" info (2 ints) */ \
((mach_msg_type_number_t) \
(HOST_VM_INFO_REV1_COUNT - 2))
struct host_cpu_load_info { /* number of ticks while running... */
natural_t cpu_ticks[CPU_STATE_MAX]; /* ... in the given mode */
};
typedef struct host_cpu_load_info host_cpu_load_info_data_t;
typedef struct host_cpu_load_info *host_cpu_load_info_t;
#define HOST_CPU_LOAD_INFO_COUNT ((mach_msg_type_number_t) \
(sizeof (host_cpu_load_info_data_t) / sizeof (integer_t)))
struct host_preferred_user_arch {
cpu_type_t cpu_type; /* Preferred user-space cpu type */
cpu_subtype_t cpu_subtype; /* Preferred user-space cpu subtype */
};
typedef struct host_preferred_user_arch host_preferred_user_arch_data_t;
typedef struct host_preferred_user_arch *host_preferred_user_arch_t;
#define HOST_PREFERRED_USER_ARCH_COUNT ((mach_msg_type_number_t) \
(sizeof(host_preferred_user_arch_data_t)/sizeof(integer_t)))
#endif /* _MACH_HOST_INFO_H_ */

View file

@ -1,39 +0,0 @@
/*
* Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef _MACH_HOST_NOTIFY_H_
#define _MACH_HOST_NOTIFY_H_
#define HOST_NOTIFY_CALENDAR_CHANGE 0
#define HOST_NOTIFY_CALENDAR_SET 1
#define HOST_NOTIFY_TYPE_MAX 1
#define HOST_CALENDAR_CHANGED_REPLYID 950
#define HOST_CALENDAR_SET_REPLYID 951
#endif /* _MACH_HOST_NOTIFY_H_ */

View file

@ -1,43 +0,0 @@
/*
* Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
subsystem
#if KERNEL_USER
KernelUser
#endif /* KERN_USER */
host_notify_reply 950;
#include <mach/std_types.defs>
simpleroutine host_calendar_changed(
notify_port : mach_port_move_send_once_t);
simpleroutine host_calendar_set(
notify_port : mach_port_move_send_once_t);
/* vim: set ft=c : */

View file

@ -1,359 +0,0 @@
/*
* Copyright (c) 2000-2004 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
/*
* Mach Operating System
* Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
*/
/*
* Matchmaker definitions file for Mach kernel interface.
*/
subsystem
#if KERNEL_USER
KernelUser
#endif /* KERNEL_USER */
#if KERNEL_SERVER
KernelServer
#endif /* KERNEL_SERVER */
host_priv 400;
#ifdef KERNEL_USER
userprefix r_;
#endif /* KERNEL_USER */
#define CONCAT(a,b) a ## b
#if KERNEL_SERVER
#define KERNEL_SERVER_SUFFIX(NAME) CONCAT(NAME, _external)
#else
#define KERNEL_SERVER_SUFFIX(NAME) NAME
#endif
#include <mach/std_types.defs>
#include <mach/mach_types.defs>
#include <mach/clock_types.defs>
#include <mach_debug/mach_debug_types.defs>
/*
* Get boot configuration information from kernel.
*/
routine host_get_boot_info(
host_priv : host_priv_t;
out boot_info : kernel_boot_info_t);
/*
* Reboot this host.
* Only available to privileged users.
*/
routine host_reboot(
host_priv : host_priv_t;
options : int);
/*
* Return privileged statistics from this host.
*/
routine host_priv_statistics(
host_priv : host_priv_t;
flavor : host_flavor_t;
out host_info_out : host_info_t, CountInOut);
/*
* Sets the default memory manager, the port to which
* newly-created temporary memory objects are delivered.
* [See (memory_object_default)memory_object_create.]
* Also sets the default cluster size used for pagein/pageout
* to this port.
* The old memory manager port is returned.
*/
routine host_default_memory_manager(
host_priv : host_priv_t;
inout default_manager : memory_object_default_t =
MACH_MSG_TYPE_MAKE_SEND;
cluster_size : memory_object_cluster_size_t);
/*
* Specify that the range of the virtual address space
* of the target task must not cause page faults for
* the indicated accesses.
*
* [ To unwire the pages, specify VM_PROT_NONE. ]
*/
routine vm_wire(
host_priv : host_priv_t;
task : vm_map_t;
address : vm_address_t;
size : vm_size_t;
desired_access : vm_prot_t);
/*
* Specify that the target thread must always be able
* to run and to allocate memory.
*/
routine thread_wire(
host_priv : host_priv_t;
thread : thread_act_t;
wired : boolean_t);
/*
* Allocate zero-filled, wired, contiguous physical memory
* in the address space of the target task, either at the
* specified address, or wherever space can be found (if
* anywhere is TRUE), of the specified size. The address
* at which the allocation actually took place is returned.
* All pages will be entered into the task's pmap immediately,
* with VM_PROT_ALL.
*
* In addition to all the failure modes of its cousin,
* vm_allocate, this call may also fail if insufficient
* contiguous memory exists to satisfy the request.
*
* Memory obtained from this call should be freed the
* normal way, via vm_deallocate.
*
* N.B. This is an EXPERIMENTAL interface!
*/
routine vm_allocate_cpm(
host_priv : host_priv_t;
task : vm_map_t;
inout address : vm_address_t;
size : vm_size_t;
flags : int);
/*
* Get list of processors on this host.
*/
routine host_processors(
host_priv : host_priv_t;
out out_processor_list : processor_array_t);
/*
* Get control port for a system-wide clock.
* Privileged.
*/
routine host_get_clock_control(
host_priv : host_priv_t;
clock_id : clock_id_t;
out clock_ctrl : clock_ctrl_t);
/*
* kernel module interface (obsolete as of SnowLeopard)
* see mach/kmod.h
*/
/* kmod_ MIG calls now return KERN_NOT_SUPPORTED on PPC/i386/x86_64. */
routine kmod_create(
host_priv : host_priv_t;
info : vm_address_t;
out module : kmod_t);
routine kmod_destroy(
host_priv : host_priv_t;
module : kmod_t);
routine kmod_control(
host_priv : host_priv_t;
module : kmod_t;
flavor : kmod_control_flavor_t;
inout data : kmod_args_t);
/*
* Get a given special port for a given node.
* Special ports are defined in host_special_ports.h;
* examples include the master device port.
* There are a limited number of slots available for system servers.
*/
routine host_get_special_port(
host_priv : host_priv_t;
node : int;
which : int;
out port : mach_port_t);
/*
* Set a given special port for the local node.
* See host_get_special_port.
*/
routine host_set_special_port(
host_priv : host_priv_t;
which : int;
port : mach_port_t);
/*
* Set an exception handler for a host on one or more exception types.
* These handlers are invoked for all threads on the host if there are
* no task or thread-specific exception handlers or those handlers returned
* an error.
*/
routine host_set_exception_ports(
host_priv : host_priv_t;
exception_mask : exception_mask_t;
new_port : mach_port_t;
behavior : exception_behavior_t;
new_flavor : thread_state_flavor_t);
/*
* Lookup some of the old exception handlers for a host
*/
routine host_get_exception_ports(
host_priv : host_priv_t;
exception_mask : exception_mask_t;
out masks : exception_mask_array_t;
out old_handlers : exception_handler_array_t, SameCount;
out old_behaviors : exception_behavior_array_t, SameCount;
out old_flavors : exception_flavor_array_t, SameCount);
/*
* Set an exception handler for a host on one or more exception types.
* At the same time, return the previously defined exception handlers for
* those types.
*/
routine host_swap_exception_ports(
host_priv : host_priv_t;
exception_mask : exception_mask_t;
new_port : mach_port_t;
behavior : exception_behavior_t;
new_flavor : thread_state_flavor_t;
out masks : exception_mask_array_t;
out old_handlerss : exception_handler_array_t, SameCount;
out old_behaviors : exception_behavior_array_t, SameCount;
out old_flavors : exception_flavor_array_t, SameCount);
skip; /* old host_load_symbol_table */
/*
* Specify that the range of the virtual address space
* of the target task must not cause page faults for
* the indicated accesses.
*
* [ To unwire the pages, specify VM_PROT_NONE. ]
*/
routine KERNEL_SERVER_SUFFIX(mach_vm_wire)(
host_priv : host_priv_t;
task : vm_map_t;
address : mach_vm_address_t;
size : mach_vm_size_t;
desired_access : vm_prot_t);
/*
* JMM - Keep all processor_set related items at the end for easy
* removal.
*/
/*
* List all processor sets on host.
*/
routine host_processor_sets(
host_priv : host_priv_t;
out processor_sets : processor_set_name_array_t);
/*
* Get control port for a processor set.
*/
routine host_processor_set_priv(
host_priv : host_priv_t;
set_name : processor_set_name_t;
out set : processor_set_t);
/************************** Warning *************************************/
/* The following routines are going away in a future release */
/* use the appropriate variant of host_set_special_port instead */
/************************************************************************/
skip;/* old set_dp_control_port */
skip;/* old get_dp_control_port */
/*
* Set the UserNotification daemon access port for this host.
* If this value is already set, the kernel will discard its
* reference to the previously registered port.
*/
routine host_set_UNDServer(
host : host_priv_t;
in server : UNDServerRef);
/*
* Get the UserNotification daemon access port for this host.
* This can then be used to communicate with that daemon, which
* in turn communicates with the User through whatever means
* available (pop-up-menus for GUI systems, text for non-GUI, etc..).
*
* Access to this port is restricted to privileged clients because
* it is a special purpose port intended for kernel clients. User
* level clients should go directly to the CFUserNotifcation services.
*/
routine host_get_UNDServer(
host : host_priv_t;
out server : UNDServerRef);
/*
* Perform an operation with a kernel extension, on the kext loading system,
* or request information about loaded kexts or the state of the kext loading
* system.
* Active operations (load, unload, disable/enable) require host_priv/root access.
* Info retrieval does not.
*
* WARNING: THIS ROUTINE IS PRIVATE TO THE KEXT-MANAGEMENT STACK AND IS
* SUBJECT TO CHANGE AT ANY TIME.
*/
routine kext_request(
host_priv : host_priv_t;
in user_log_flags : uint32_t;
in request_data : pointer_t;
out response_data : pointer_t;
out log_data : pointer_t;
out op_result : kern_return_t);
/* vim: set ft=c : */

View file

@ -1,39 +0,0 @@
/*
* Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
#ifndef _MACH_HOST_REBOOT_
#define _MACH_HOST_REBOOT_
#define HOST_REBOOT_HALT 0x0008
#define HOST_REBOOT_UPSDELAY 0x0100
#define HOST_REBOOT_DEBUGGER 0x1000
#endif /* _MACH_HOST_REBOOT_ */

View file

@ -1,101 +0,0 @@
/*
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
/*
* Mach Operating System
* Copyright (c) 1991,1990,1989 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
*/
/*
* File: mach/host_security.defs
*
* Abstract:
* Mach host security operations support.
*/
subsystem
#if KERNEL_SERVER
KernelServer
#endif /* KERNEL_SERVER */
host_security 600;
/*
* Basic types
*/
#include <mach/std_types.defs>
#include <mach/mach_types.defs>
/*
* Create a new task with an explicit security token
*/
routine host_security_create_task_token(
host_security : host_security_t;
parent_task : task_t;
sec_token : security_token_t;
audit_token : audit_token_t;
host : host_t;
ledgers : ledger_array_t;
inherit_memory : boolean_t;
out child_task : task_t);
/*
* Change a task's security token
*/
routine host_security_set_task_token(
host_security : host_security_t;
target_task : task_t;
sec_token : security_token_t;
audit_token : audit_token_t;
host : host_t);
/* vim: set ft=c : */

View file

@ -1,221 +0,0 @@
#ifndef _host_security_user_
#define _host_security_user_
/* Module host_security */
#include <string.h>
#include <mach/ndr.h>
#include <mach/boolean.h>
#include <mach/kern_return.h>
#include <mach/notify.h>
#include <mach/mach_types.h>
#include <mach/message.h>
#include <mach/mig_errors.h>
#include <mach/port.h>
/* BEGIN MIG_STRNCPY_ZEROFILL CODE */
#if defined(__has_include)
#if __has_include(<mach/mig_strncpy_zerofill_support.h>)
#ifndef USING_MIG_STRNCPY_ZEROFILL
#define USING_MIG_STRNCPY_ZEROFILL
#endif
#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__
#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__
#ifdef __cplusplus
extern "C" {
#endif
extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import));
#ifdef __cplusplus
}
#endif
#endif /* __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ */
#endif /* __has_include(<mach/mig_strncpy_zerofill_support.h>) */
#endif /* __has_include */
/* END MIG_STRNCPY_ZEROFILL CODE */
#ifdef AUTOTEST
#ifndef FUNCTION_PTR_T
#define FUNCTION_PTR_T
typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t);
typedef struct {
char *name;
function_ptr_t function;
} function_table_entry;
typedef function_table_entry *function_table_t;
#endif /* FUNCTION_PTR_T */
#endif /* AUTOTEST */
#ifndef host_security_MSG_COUNT
#define host_security_MSG_COUNT 2
#endif /* host_security_MSG_COUNT */
#include <mach/std_types.h>
#include <mach/mig.h>
#include <mach/mig.h>
#include <mach/mach_types.h>
#ifdef __BeforeMigUserHeader
__BeforeMigUserHeader
#endif /* __BeforeMigUserHeader */
#include <sys/cdefs.h>
__BEGIN_DECLS
/* Routine host_security_create_task_token */
#ifdef mig_external
mig_external
#else
extern
#endif /* mig_external */
kern_return_t host_security_create_task_token
(
host_security_t host_security,
task_t parent_task,
security_token_t sec_token,
audit_token_t audit_token,
host_t host,
ledger_array_t ledgers,
mach_msg_type_number_t ledgersCnt,
boolean_t inherit_memory,
task_t *child_task
);
/* Routine host_security_set_task_token */
#ifdef mig_external
mig_external
#else
extern
#endif /* mig_external */
kern_return_t host_security_set_task_token
(
host_security_t host_security,
task_t target_task,
security_token_t sec_token,
audit_token_t audit_token,
host_t host
);
__END_DECLS
/********************** Caution **************************/
/* The following data types should be used to calculate */
/* maximum message sizes only. The actual message may be */
/* smaller, and the position of the arguments within the */
/* message layout may vary from what is presented here. */
/* For example, if any of the arguments are variable- */
/* sized, and less than the maximum is sent, the data */
/* will be packed tight in the actual message to reduce */
/* the presence of holes. */
/********************** Caution **************************/
/* typedefs for all requests */
#ifndef __Request__host_security_subsystem__defined
#define __Request__host_security_subsystem__defined
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
/* start of the kernel processed data */
mach_msg_body_t msgh_body;
mach_msg_port_descriptor_t parent_task;
mach_msg_port_descriptor_t host;
mach_msg_ool_ports_descriptor_t ledgers;
/* end of the kernel processed data */
NDR_record_t NDR;
security_token_t sec_token;
audit_token_t audit_token;
mach_msg_type_number_t ledgersCnt;
boolean_t inherit_memory;
} __Request__host_security_create_task_token_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
/* start of the kernel processed data */
mach_msg_body_t msgh_body;
mach_msg_port_descriptor_t target_task;
mach_msg_port_descriptor_t host;
/* end of the kernel processed data */
NDR_record_t NDR;
security_token_t sec_token;
audit_token_t audit_token;
} __Request__host_security_set_task_token_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#endif /* !__Request__host_security_subsystem__defined */
/* union of all requests */
#ifndef __RequestUnion__host_security_subsystem__defined
#define __RequestUnion__host_security_subsystem__defined
union __RequestUnion__host_security_subsystem {
__Request__host_security_create_task_token_t Request_host_security_create_task_token;
__Request__host_security_set_task_token_t Request_host_security_set_task_token;
};
#endif /* !__RequestUnion__host_security_subsystem__defined */
/* typedefs for all replies */
#ifndef __Reply__host_security_subsystem__defined
#define __Reply__host_security_subsystem__defined
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
/* start of the kernel processed data */
mach_msg_body_t msgh_body;
mach_msg_port_descriptor_t child_task;
/* end of the kernel processed data */
} __Reply__host_security_create_task_token_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
NDR_record_t NDR;
kern_return_t RetCode;
} __Reply__host_security_set_task_token_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#endif /* !__Reply__host_security_subsystem__defined */
/* union of all replies */
#ifndef __ReplyUnion__host_security_subsystem__defined
#define __ReplyUnion__host_security_subsystem__defined
union __ReplyUnion__host_security_subsystem {
__Reply__host_security_create_task_token_t Reply_host_security_create_task_token;
__Reply__host_security_set_task_token_t Reply_host_security_set_task_token;
};
#endif /* !__RequestUnion__host_security_subsystem__defined */
#ifndef subsystem_to_name_map_host_security
#define subsystem_to_name_map_host_security \
{ "host_security_create_task_token", 600 },\
{ "host_security_set_task_token", 601 }
#endif
#ifdef __AfterMigUserHeader
__AfterMigUserHeader
#endif /* __AfterMigUserHeader */
#endif /* _host_security_user_ */

View file

@ -1,281 +0,0 @@
/*
* Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
/*
* Mach Operating System
* Copyright (c) 1991 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
*/
/*
* File: mach/host_special_ports.h
*
* Defines codes for access to host-wide special ports.
*/
#ifndef _MACH_HOST_SPECIAL_PORTS_H_
#define _MACH_HOST_SPECIAL_PORTS_H_
/*
* Cannot be set or gotten from user space
*/
#define HOST_SECURITY_PORT 0
#define HOST_MIN_SPECIAL_PORT HOST_SECURITY_PORT
/*
* Always provided by kernel (cannot be set from user-space).
*/
#define HOST_PORT 1
#define HOST_PRIV_PORT 2
#define HOST_IO_MASTER_PORT 3
#define HOST_MAX_SPECIAL_KERNEL_PORT 7 /* room to grow */
#define HOST_LAST_SPECIAL_KERNEL_PORT HOST_IO_MASTER_PORT
/*
* Not provided by kernel
*/
#define HOST_DYNAMIC_PAGER_PORT (1 + HOST_MAX_SPECIAL_KERNEL_PORT)
#define HOST_AUDIT_CONTROL_PORT (2 + HOST_MAX_SPECIAL_KERNEL_PORT)
#define HOST_USER_NOTIFICATION_PORT (3 + HOST_MAX_SPECIAL_KERNEL_PORT)
#define HOST_AUTOMOUNTD_PORT (4 + HOST_MAX_SPECIAL_KERNEL_PORT)
#define HOST_LOCKD_PORT (5 + HOST_MAX_SPECIAL_KERNEL_PORT)
#define HOST_KTRACE_BACKGROUND_PORT (6 + HOST_MAX_SPECIAL_KERNEL_PORT)
#define HOST_SEATBELT_PORT (7 + HOST_MAX_SPECIAL_KERNEL_PORT)
#define HOST_KEXTD_PORT (8 + HOST_MAX_SPECIAL_KERNEL_PORT)
#define HOST_LAUNCHCTL_PORT (9 + HOST_MAX_SPECIAL_KERNEL_PORT)
#define HOST_UNFREED_PORT (10 + HOST_MAX_SPECIAL_KERNEL_PORT)
#define HOST_AMFID_PORT (11 + HOST_MAX_SPECIAL_KERNEL_PORT)
#define HOST_GSSD_PORT (12 + HOST_MAX_SPECIAL_KERNEL_PORT)
#define HOST_TELEMETRY_PORT (13 + HOST_MAX_SPECIAL_KERNEL_PORT)
#define HOST_ATM_NOTIFICATION_PORT (14 + HOST_MAX_SPECIAL_KERNEL_PORT)
#define HOST_COALITION_PORT (15 + HOST_MAX_SPECIAL_KERNEL_PORT)
#define HOST_SYSDIAGNOSE_PORT (16 + HOST_MAX_SPECIAL_KERNEL_PORT)
#define HOST_XPC_EXCEPTION_PORT (17 + HOST_MAX_SPECIAL_KERNEL_PORT)
#define HOST_CONTAINERD_PORT (18 + HOST_MAX_SPECIAL_KERNEL_PORT)
#define HOST_NODE_PORT (19 + HOST_MAX_SPECIAL_KERNEL_PORT)
#define HOST_RESOURCE_NOTIFY_PORT (20 + HOST_MAX_SPECIAL_KERNEL_PORT)
#define HOST_CLOSURED_PORT (21 + HOST_MAX_SPECIAL_KERNEL_PORT)
#define HOST_SYSPOLICYD_PORT (22 + HOST_MAX_SPECIAL_KERNEL_PORT)
#define HOST_FILECOORDINATIOND_PORT (23 + HOST_MAX_SPECIAL_KERNEL_PORT)
#define HOST_FAIRPLAYD_PORT (24 + HOST_MAX_SPECIAL_KERNEL_PORT)
#define HOST_MAX_SPECIAL_PORT HOST_FAIRPLAYD_PORT
/* MAX = last since rdar://35861175 */
/* obsolete name */
#define HOST_CHUD_PORT HOST_LAUNCHCTL_PORT
/*
* Special node identifier to always represent the local node.
*/
#define HOST_LOCAL_NODE -1
/*
* Definitions for ease of use.
*
* In the get call, the host parameter can be any host, but will generally
* be the local node host port. In the set call, the host must the per-node
* host port for the node being affected.
*/
#define host_get_host_port(host, port) \
(host_get_special_port((host), \
HOST_LOCAL_NODE, HOST_PORT, (port)))
#define host_set_host_port(host, port) (KERN_INVALID_ARGUMENT)
#define host_get_host_priv_port(host, port) \
(host_get_special_port((host), \
HOST_LOCAL_NODE, HOST_PRIV_PORT, (port)))
#define host_set_host_priv_port(host, port) (KERN_INVALID_ARGUMENT)
#define host_get_io_master_port(host, port) \
(host_get_special_port((host), \
HOST_LOCAL_NODE, HOST_IO_MASTER_PORT, (port)))
#define host_set_io_master_port(host, port) (KERN_INVALID_ARGUMENT)
/*
* User-settable special ports.
*/
#define host_get_dynamic_pager_port(host, port) \
(host_get_special_port((host), \
HOST_LOCAL_NODE, HOST_DYNAMIC_PAGER_PORT, (port)))
#define host_set_dynamic_pager_port(host, port) \
(host_set_special_port((host), HOST_DYNAMIC_PAGER_PORT, (port)))
#define host_get_audit_control_port(host, port) \
(host_get_special_port((host), \
HOST_LOCAL_NODE, HOST_AUDIT_CONTROL_PORT, (port)))
#define host_set_audit_control_port(host, port) \
(host_set_special_port((host), HOST_AUDIT_CONTROL_PORT, (port)))
#define host_get_user_notification_port(host, port) \
(host_get_special_port((host), \
HOST_LOCAL_NODE, HOST_USER_NOTIFICATION_PORT, (port)))
#define host_set_user_notification_port(host, port) \
(host_set_special_port((host), HOST_USER_NOTIFICATION_PORT, (port)))
#define host_get_automountd_port(host, port) \
(host_get_special_port((host), \
HOST_LOCAL_NODE, HOST_AUTOMOUNTD_PORT, (port)))
#define host_set_automountd_port(host, port) \
(host_set_special_port((host), HOST_AUTOMOUNTD_PORT, (port)))
#define host_get_lockd_port(host, port) \
(host_get_special_port((host), \
HOST_LOCAL_NODE, HOST_LOCKD_PORT, (port)))
#define host_set_lockd_port(host, port) \
(host_set_special_port((host), HOST_LOCKD_PORT, (port)))
#define host_get_ktrace_background_port(host, port) \
(host_get_special_port((host), \
HOST_LOCAL_NODE, HOST_KTRACE_BACKGROUND_PORT, (port)))
#define host_set_ktrace_background_port(host, port) \
(host_set_special_port((host), HOST_KTRACE_BACKGROUND_PORT, (port)))
#define host_get_kextd_port(host, port) \
(host_get_special_port((host), \
HOST_LOCAL_NODE, HOST_KEXTD_PORT, (port)))
#define host_set_kextd_port(host, port) \
(host_set_special_port((host), HOST_KEXTD_PORT, (port)))
#define host_get_launchctl_port(host, port) \
(host_get_special_port((host), HOST_LOCAL_NODE, HOST_LAUNCHCTL_PORT, \
(port)))
#define host_set_launchctl_port(host, port) \
(host_set_special_port((host), HOST_LAUNCHCTL_PORT, (port)))
#define host_get_chud_port(host, port) host_get_launchctl_port(host, port)
#define host_set_chud_port(host, port) host_set_launchctl_port(host, port)
#define host_get_unfreed_port(host, port) \
(host_get_special_port((host), \
HOST_LOCAL_NODE, HOST_UNFREED_PORT, (port)))
#define host_set_unfreed_port(host, port) \
(host_set_special_port((host), HOST_UNFREED_PORT, (port)))
#define host_get_amfid_port(host, port) \
(host_get_special_port((host), \
HOST_LOCAL_NODE, HOST_AMFID_PORT, (port)))
#define host_set_amfid_port(host, port) \
(host_set_special_port((host), HOST_AMFID_PORT, (port)))
#define host_get_gssd_port(host, port) \
(host_get_special_port((host), \
HOST_LOCAL_NODE, HOST_GSSD_PORT, (port)))
#define host_set_gssd_port(host, port) \
(host_set_special_port((host), HOST_GSSD_PORT, (port)))
#define host_get_telemetry_port(host, port) \
(host_get_special_port((host), \
HOST_LOCAL_NODE, HOST_TELEMETRY_PORT, (port)))
#define host_set_telemetry_port(host, port) \
(host_set_special_port((host), HOST_TELEMETRY_PORT, (port)))
#define host_get_atm_notification_port(host, port) \
(host_get_special_port((host), \
HOST_LOCAL_NODE, HOST_ATM_NOTIFICATION_PORT, (port)))
#define host_set_atm_notification_port(host, port) \
(host_set_special_port((host), HOST_ATM_NOTIFICATION_PORT, (port)))
#define host_get_coalition_port(host, port) \
(host_get_special_port((host), \
HOST_LOCAL_NODE, HOST_COALITION_PORT, (port)))
#define host_set_coalition_port(host, port) \
(host_set_special_port((host), HOST_COALITION_PORT, (port)))
#define host_get_sysdiagnose_port(host, port) \
(host_get_special_port((host), \
HOST_LOCAL_NODE, HOST_SYSDIAGNOSE_PORT, (port)))
#define host_set_sysdiagnose_port(host, port) \
(host_set_special_port((host), HOST_SYSDIAGNOSE_PORT, (port)))
#define host_get_container_port(host, port) \
(host_get_special_port((host), \
HOST_LOCAL_NODE, HOST_CONTAINERD_PORT, (port)))
#define host_set_container_port(host, port) \
(host_set_special_port((host), HOST_CONTAINERD_PORT, (port)))
#define host_get_node_port(host, port) \
(host_get_special_port((host), \
HOST_LOCAL_NODE, HOST_NODE_PORT, (port)))
#define host_set_node_port(host, port) \
(host_set_special_port((host), HOST_NODE_PORT, (port)))
#define host_get_closured_port(host, port) \
(host_get_special_port((host), \
HOST_LOCAL_NODE, HOST_CLOSURED_PORT, (port)))
#define host_set_closured_port(host, port) \
(host_set_special_port((host), HOST_CLOSURED_PORT, (port)))
#define host_get_syspolicyd_port(host, port) \
(host_get_special_port((host), \
HOST_LOCAL_NODE, HOST_SYSPOLICYD_PORT, (port)))
#define host_set_syspolicyd_port(host, port) \
(host_set_special_port((host), HOST_SYSPOLICYD_PORT, (port)))
#define host_get_filecoordinationd_port(host, port) \
(host_get_special_port((host), \
HOST_LOCAL_NODE, HOST_FILECOORDINATIOND_PORT, (port)))
#define host_set_filecoordinationd_port(host, port) \
(host_set_special_port((host), HOST_FILECOORDINATIOND_PORT, (port)))
#define host_get_fairplayd_port(host, port) \
(host_get_special_port((host), \
HOST_LOCAL_NODE, HOST_FAIRPLAYD_PORT, (port)))
#define host_set_fairplayd_port(host, port) \
(host_set_special_port((host), HOST_FAIRPLAYD_PORT, (port)))
/* HOST_RESOURCE_NOTIFY_PORT doesn't #defines these conveniences.
* All lookups go through send_resource_violation()
*/
#endif /* _MACH_HOST_SPECIAL_PORTS_H_ */

View file

@ -1,380 +0,0 @@
/*
* Copyright (c) 2000-2018 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
/*
* Mach Operating System
* Copyright (c) 1991,1990,1989 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
#ifndef _I386_ASM_H_
#define _I386_ASM_H_
#if defined(__i386__)
#define S_PC (%esp)
#define S_ARG0 4(%esp)
#define S_ARG1 8(%esp)
#define S_ARG2 12(%esp)
#define S_ARG3 16(%esp)
#define S_ARG4 20(%esp)
#define FRAME pushl %ebp; movl %esp, %ebp
#define EMARF leave
#define B_LINK (%ebp)
#define B_PC 4(%ebp)
#define B_ARG0 8(%ebp)
#define B_ARG1 12(%ebp)
#define B_ARG2 16(%ebp)
#define B_ARG3 20(%ebp)
#elif defined(__x86_64__)
#define S_PC (%rsp)
#define FRAME pushq %rbp; movq %rsp, %rbp
#define EMARF leave
#define B_LINK (%rbp)
#define B_PC 8(%rbp)
#else
#error unsupported architecture
#endif
/* There is another definition of ALIGN for .c sources */
#ifdef ASSEMBLER
#define ALIGN 4,0x90
#endif /* ASSEMBLER */
#ifndef FALIGN
#define FALIGN ALIGN
#endif
#define LB(x,n) n
#if __STDC__
#ifndef __NO_UNDERSCORES__
#define LCL(x) L ## x
#define EXT(x) _ ## x
#define LEXT(x) _ ## x ## :
#else
#define LCL(x) .L ## x
#define EXT(x) x
#define LEXT(x) x ## :
#endif
#define LBc(x,n) n ## :
#define LBb(x,n) n ## b
#define LBf(x,n) n ## f
#else /* __STDC__ */
#ifndef __NO_UNDERSCORES__
#define LCL(x) L/**/x
#define EXT(x) _/**/x
#define LEXT(x) _/**/x/**/:
#else /* __NO_UNDERSCORES__ */
#define LCL(x) .L/**/x
#define EXT(x) x
#define LEXT(x) x/**/:
#endif /* __NO_UNDERSCORES__ */
#define LBc(x,n) n/**/:
#define LBb(x,n) n/**/b
#define LBf(x,n) n/**/f
#endif /* __STDC__ */
#define SVC .byte 0x9a; .long 0; .word 0x7
#define RPC_SVC .byte 0x9a; .long 0; .word 0xf
#define String .asciz
#define Value .word
#define Times(a,b) (a*b)
#define Divide(a,b) (a/b)
#define INB inb %dx, %al
#define OUTB outb %al, %dx
#define INL inl %dx, %eax
#define OUTL outl %eax, %dx
#define data16 .byte 0x66
#define addr16 .byte 0x67
#define MCOUNT
#if defined(__SHARED__)
#define MCOUNT ; .data;\
.align ALIGN;\
LBc(x, 8) .long 0;\
.text;\
Gpush;\
Gload;\
leal Gotoff(LBb(x,8)),%edx;\
Egaddr(%eax,_mcount_ptr);\
Gpop;\
call *(%eax);
#endif /* __SHARED__ */
#ifdef __ELF__
#define ELF_FUNC(x) .type x,@function
#define ELF_DATA(x) .type x,@object
#define ELF_SIZE(x,s) .size x,s
#else
#define ELF_FUNC(x)
#define ELF_DATA(x)
#define ELF_SIZE(x,s)
#endif
#define Entry(x) .globl EXT(x); ELF_FUNC(EXT(x)); .align FALIGN; LEXT(x)
#define ENTRY(x) Entry(x) MCOUNT
#define ENTRY2(x,y) .globl EXT(x); .globl EXT(y); \
ELF_FUNC(EXT(x)); ELF_FUNC(EXT(y)); \
.align FALIGN; LEXT(x); LEXT(y) \
MCOUNT
#if __STDC__
#define ASENTRY(x) .globl x; .align FALIGN; x ## : ELF_FUNC(x) MCOUNT
#else
#define ASENTRY(x) .globl x; .align FALIGN; x: ELF_FUNC(x) MCOUNT
#endif /* __STDC__ */
#define DATA(x) .globl EXT(x); ELF_DATA(EXT(x)); .align ALIGN; LEXT(x)
#define End(x) ELF_SIZE(x,.-x)
#define END(x) End(EXT(x))
#define ENDDATA(x) END(x)
#define Enddata(x) End(x)
/*
* ELF shared library accessor macros.
* Gpush saves the %ebx register used for the GOT address
* Gpop pops %ebx if we need a GOT
* Gload loads %ebx with the GOT address if shared libraries are used
* Gcall calls an external function.
* Gotoff allows you to reference local labels.
* Gotoff2 allows you to reference local labels with an index reg.
* Gotoff3 allows you to reference local labels with an index reg & size.
* Gaddr loads up a register with an address of an external item.
* Gstack is the number of bytes that Gpush pushes on the stack.
*
* Varients of the above with E or L prefixes do EXT(name) or LCL(name)
* respectively.
*/
#ifndef __SHARED__
#define Gpush
#define Gpop
#define Gload
#define Gcall(func) call func
#define Gotoff(lab) lab
#define Gotoff2(l,r) l(r)
#define Gotoff3(l,r,s) l(,r,s)
#define Gaddr(to,lab) movl $lab,to
#define Gcmp(lab,reg) cmpl $lab,reg
#define Gmemload(lab,reg) movl lab,reg
#define Gmemstore(reg,lab,tmp) movl reg,lab
#define Gstack 0
#else
#ifdef __ELF__ /* ELF shared libraries */
#define Gpush pushl %ebx
#define Gpop popl %ebx
#define Gload call 9f; 9: popl %ebx; addl $_GLOBAL_OFFSET_TABLE_+[.-9b],%ebx
#define Gcall(func) call EXT(func)@PLT
#define Gotoff(lab) lab@GOTOFF(%ebx)
#define Gotoff2(l,r) l@GOTOFF(%ebx,r)
#define Gotoff3(l,r,s) l@GOTOFF(%ebx,r,s)
#define Gaddr(to,lab) movl lab@GOT(%ebx),to
#define Gcmp(lab,reg) cmpl reg,lab@GOT(%ebx)
#define Gmemload(lab,reg) movl lab@GOT(%ebx),reg; movl (reg),reg
#define Gmemstore(reg,lab,tmp) movl lab@GOT(%ebx),tmp; movl reg,(tmp)
#define Gstack 4
#else /* ROSE shared libraries */
#define Gpush
#define Gpop
#define Gload
#define Gcall(func) call *9f; .data; .align ALIGN; 9: .long func; .text
#define Gotoff(lab) lab
#define Gotoff2(l,r) l(r)
#define Gotoff3(l,r,s) l(,r,s)
#define Gaddr(to,lab) movl 9f,to; .data; .align ALIGN; 9: .long lab; .text
#define Gcmp(lab,reg) cmpl reg,9f; .data; .align ALIGN; 9: .long lab; .text
#define Gmemload(lab,reg) movl 9f,reg; movl (reg),reg; .data; .align ALIGN; 9: .long lab; .text
#define Gmemstore(reg,lab,tmp) movl 9f,tmp; movl reg,(tmp); .data; .align ALIGN; 9: .long lab; .text
#define Gstack 0
#endif /* __ELF__ */
#endif /* __SHARED__ */
/* Egotoff is not provided, since external symbols should not use @GOTOFF
relocations. */
#define Egcall(func) Gcall(EXT(func))
#define Egaddr(to,lab) Gaddr(to,EXT(lab))
#define Egcmp(lab,reg) Gcmp(EXT(lab),reg)
#define Egmemload(lab,reg) Gmemload(EXT(lab),reg)
#define Egmemstore(reg,lab,tmp) Gmemstore(reg,EXT(lab),tmp)
#define Lgotoff(lab) Gotoff(LCL(lab))
#define Lgotoff2(l,r) Gotoff2(LCL(l),r)
#define Lgotoff3(l,r,s) Gotoff3(LCL(l),r,s)
#define Lgcmp(lab,reg) Gcmp(LCL(lab),reg)
#define Lgmemload(lab,reg) movl Lgotoff(lab),reg
#define Lgmemstore(reg,lab,tmp) movl reg,Lgotoff(lab)
#ifndef ASSEMBLER
/* These defines are here for .c files that wish to reference global symbols
* within __asm__ statements.
*/
#ifndef __NO_UNDERSCORES__
#define CC_SYM_PREFIX "_"
#else
#define CC_SYM_PREFIX ""
#endif /* __NO_UNDERSCORES__ */
#endif /* ASSEMBLER */
/*
* The following macros make calls into C code.
* They dynamically align the stack to 16 bytes.
*/
#if defined(__i386__)
/*
* Arguments are moved (not pushed) onto the correctly aligned stack.
* NOTE: ESI is destroyed in the process, and hence cannot
* be directly used as a parameter. Users of this macro must
* independently preserve ESI (a non-volatile) if the routine is
* intended to be called from C, for instance.
*/
#define CCALL(fn) \
movl %esp, %esi ;\
andl $0xFFFFFFF0, %esp ;\
call EXT(fn) ;\
movl %esi, %esp
#define CCALL1(fn, arg1) \
movl %esp, %esi ;\
subl $4, %esp ;\
andl $0xFFFFFFF0, %esp ;\
movl arg1, (%esp) ;\
call EXT(fn) ;\
movl %esi, %esp
#define CCALL2(fn, arg1, arg2) \
movl %esp, %esi ;\
subl $8, %esp ;\
andl $0xFFFFFFF0, %esp ;\
movl arg2, 4(%esp) ;\
movl arg1, (%esp) ;\
call EXT(fn) ;\
movl %esi, %esp
/* This variant exists to permit adjustment of the stack by "dtrace" */
#define CCALL1WITHSP(fn, arg1) \
movl %esp, %esi ;\
subl $12, %esp ;\
andl $0xFFFFFFF0, %esp ;\
movl %esi, 8(%esp) ;\
leal 8(%esp), %esi ;\
movl %esi, 4(%esp) ;\
movl arg1, (%esp) ;\
call EXT(fn) ;\
movl 8(%esp), %esp
/*
* CCALL5 is used for callee functions with 3 arguments but
* where arg2 (a3:a2) and arg3 (a5:a4) are 64-bit values.
*/
#define CCALL5(fn, a1, a2, a3, a4, a5) \
movl %esp, %esi ;\
subl $20, %esp ;\
andl $0xFFFFFFF0, %esp ;\
movl a5, 16(%esp) ;\
movl a4, 12(%esp) ;\
movl a3, 8(%esp) ;\
movl a2, 4(%esp) ;\
movl a1, (%esp) ;\
call EXT(fn) ;\
movl %esi, %esp
#elif defined(__x86_64__)
/* This variant exists to permit adjustment of the stack by "dtrace" */
#define CCALLWITHSP(fn) \
mov %rsp, %r12 ;\
sub $8, %rsp ;\
and $0xFFFFFFFFFFFFFFF0, %rsp ;\
mov %r12, (%rsp) ;\
leaq (%rsp), %rsi ;\
call EXT(fn) ;\
mov (%rsp), %rsp
#define CCALL(fn) \
mov %rsp, %r12 ;\
and $0xFFFFFFFFFFFFFFF0, %rsp ;\
call EXT(fn) ;\
mov %r12, %rsp
#define CCALL1(fn, arg1) \
mov arg1, %rdi ;\
CCALL(fn)
#define CCALL2(fn, arg1, arg2) \
mov arg1, %rdi ;\
mov arg2, %rsi ;\
CCALL(fn)
#define CCALL3(fn, arg1, arg2, arg3) \
mov arg1, %rdi ;\
mov arg2, %rsi ;\
mov arg3, %rdx ;\
CCALL(fn)
#else
#error unsupported architecture
#endif
#endif /* _I386_ASM_H_ */

View file

@ -1,74 +0,0 @@
/*
* Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
/*
* Mach Operating System
* Copyright (c) 1991,1990,1989 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
*/
/*
* File: boolean.h
*
* Boolean type, for I386.
*/
#ifndef _MACH_I386_BOOLEAN_H_
#define _MACH_I386_BOOLEAN_H_
#if defined(__x86_64__) && !defined(KERNEL)
typedef unsigned int boolean_t;
#else
typedef int boolean_t;
#endif
#endif /* _MACH_I386_BOOLEAN_H_ */

View file

@ -1,135 +0,0 @@
/*
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
/*
* Mach Operating System
* Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
*/
#ifndef _MACH_I386_EXCEPTION_H_
#define _MACH_I386_EXCEPTION_H_
/*
* No machine dependent types for the 80386
*/
#define EXC_TYPES_COUNT 14 /* incl. illegal exception 0 */
/*
* Codes and subcodes for 80386 exceptions.
*/
#define EXCEPTION_CODE_MAX 2 /* currently code and subcode */
/*
* EXC_BAD_INSTRUCTION
*/
#define EXC_I386_INVOP 1
/*
* EXC_ARITHMETIC
*/
#define EXC_I386_DIV 1
#define EXC_I386_INTO 2
#define EXC_I386_NOEXT 3
#define EXC_I386_EXTOVR 4
#define EXC_I386_EXTERR 5
#define EXC_I386_EMERR 6
#define EXC_I386_BOUND 7
#define EXC_I386_SSEEXTERR 8
/*
* EXC_SOFTWARE
* Note: 0x10000-0x10003 in use for unix signal
*/
/*
* EXC_BAD_ACCESS
*/
/*
* EXC_BREAKPOINT
*/
#define EXC_I386_SGL 1
#define EXC_I386_BPT 2
#define EXC_I386_DIVERR 0 /* divide by 0 eprror */
#define EXC_I386_SGLSTP 1 /* single step */
#define EXC_I386_NMIFLT 2 /* NMI */
#define EXC_I386_BPTFLT 3 /* breakpoint fault */
#define EXC_I386_INTOFLT 4 /* INTO overflow fault */
#define EXC_I386_BOUNDFLT 5 /* BOUND instruction fault */
#define EXC_I386_INVOPFLT 6 /* invalid opcode fault */
#define EXC_I386_NOEXTFLT 7 /* extension not available fault*/
#define EXC_I386_DBLFLT 8 /* double fault */
#define EXC_I386_EXTOVRFLT 9 /* extension overrun fault */
#define EXC_I386_INVTSSFLT 10 /* invalid TSS fault */
#define EXC_I386_SEGNPFLT 11 /* segment not present fault */
#define EXC_I386_STKFLT 12 /* stack fault */
#define EXC_I386_GPFLT 13 /* general protection fault */
#define EXC_I386_PGFLT 14 /* page fault */
#define EXC_I386_EXTERRFLT 16 /* extension error fault */
#define EXC_I386_ALIGNFLT 17 /* Alignment fault */
#define EXC_I386_ENDPERR 33 /* emulated extension error flt */
#define EXC_I386_ENOEXTFLT 32 /* emulated ext not present */
/*
* machine dependent exception masks
*/
#define EXC_MASK_MACHINE 0
#endif /* _MACH_I386_EXCEPTION_H_ */

View file

@ -1,118 +0,0 @@
/*
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
/*
* Mach Operating System
* Copyright (c) 1992-1989 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
*/
#ifndef _I386_FP_SAVE_H_
#define _I386_FP_SAVE_H_
/*
* Control register
*/
#define FPC_IE 0x0001 /* enable invalid operation
* exception */
#define FPC_IM FPC_IE
#define FPC_DE 0x0002 /* enable denormalized operation
* exception */
#define FPC_DM FPC_DE
#define FPC_ZE 0x0004 /* enable zero-divide exception */
#define FPC_ZM FPC_ZE
#define FPC_OE 0x0008 /* enable overflow exception */
#define FPC_OM FPC_OE
#define FPC_UE 0x0010 /* enable underflow exception */
#define FPC_PE 0x0020 /* enable precision exception */
#define FPC_PC 0x0300 /* precision control: */
#define FPC_PC_24 0x0000 /* 24 bits */
#define FPC_PC_53 0x0200 /* 53 bits */
#define FPC_PC_64 0x0300 /* 64 bits */
#define FPC_RC 0x0c00 /* rounding control: */
#define FPC_RC_RN 0x0000 /* round to nearest or even */
#define FPC_RC_RD 0x0400 /* round down */
#define FPC_RC_RU 0x0800 /* round up */
#define FPC_RC_CHOP 0x0c00 /* chop */
#define FPC_IC 0x1000 /* infinity control (obsolete) */
#define FPC_IC_PROJ 0x0000 /* projective infinity */
#define FPC_IC_AFF 0x1000 /* affine infinity (std) */
/*
* Status register
*/
#define FPS_IE 0x0001 /* invalid operation */
#define FPS_DE 0x0002 /* denormalized operand */
#define FPS_ZE 0x0004 /* divide by zero */
#define FPS_OE 0x0008 /* overflow */
#define FPS_UE 0x0010 /* underflow */
#define FPS_PE 0x0020 /* precision */
#define FPS_SF 0x0040 /* stack flag */
#define FPS_ES 0x0080 /* error summary */
#define FPS_C0 0x0100 /* condition code bit 0 */
#define FPS_C1 0x0200 /* condition code bit 1 */
#define FPS_C2 0x0400 /* condition code bit 2 */
#define FPS_TOS 0x3800 /* top-of-stack pointer */
#define FPS_TOS_SHIFT 11
#define FPS_C3 0x4000 /* condition code bit 3 */
#define FPS_BUSY 0x8000 /* FPU busy */
/*
* Kind of floating-point support provided by kernel.
*/
#define FP_NO 0 /* no floating point */
#define FP_SOFT 1 /* software FP emulator */
#define FP_287 2 /* 80287 */
#define FP_387 3 /* 80387 or 80486 */
#define FP_FXSR 4 /* Fast save/restore SIMD Extension */
#endif /* _I386_FP_SAVE_H_ */

View file

@ -1,74 +0,0 @@
/*
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
/*
* Mach Operating System
* Copyright (c) 1991,1990,1989 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
*/
/*
* File: kern_return.h
* Author: Avadis Tevanian, Jr., Michael Wayne Young
* Date: 1985
*
* Machine-dependent kernel return definitions.
*/
#ifndef _MACH_I386_KERN_RETURN_H_
#define _MACH_I386_KERN_RETURN_H_
#ifndef ASSEMBLER
typedef int kern_return_t;
#endif /* ASSEMBLER */
#endif /* _MACH_I386_KERN_RETURN_H_ */

View file

@ -1,45 +0,0 @@
/*
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
/* NDR record for Intel x86s */
#include <mach/ndr.h>
NDR_record_t NDR_record = {
0, /* mig_reserved */
0, /* mig_reserved */
0, /* mig_reserved */
NDR_PROTOCOL_2_0,
NDR_INT_LITTLE_ENDIAN,
NDR_CHAR_ASCII,
NDR_FLOAT_IEEE,
0,
};

View file

@ -1,37 +0,0 @@
/*
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* File: mach/i386/processor_info.h
*
* Data structure definitions for i386 specific processor control
*/
#ifndef _MACH_I386_PROCESSOR_INFO_H_
#define _MACH_I386_PROCESSOR_INFO_H_
#endif /* _MACH_I386_PROCESSOR_INFO_H_ */

View file

@ -1,35 +0,0 @@
/*
* Copyright (c) 2002,2000 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
#ifndef _MACH_I386_RPC_H_
#define _MACH_I386_RPC_H_
#endif /* _MACH_I386_RPC_H_ */

View file

@ -1,414 +0,0 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _MACH_I386_SDT_ISA_H
#define _MACH_I386_SDT_ISA_H
/*
* Only define when testing. This makes the calls into actual calls to
* test functions.
*/
/* #define DTRACE_CALL_TEST */
#define DTRACE_STRINGIFY(s) #s
#define DTRACE_TOSTRING(s) DTRACE_STRINGIFY(s)
#define DTRACE_LABEL(p, n) \
"__dtrace_probe$" DTRACE_TOSTRING(%=__LINE__) DTRACE_STRINGIFY(_##p##___##n) ":" "\n\t"
#ifdef DTRACE_CALL_TEST
#define DTRACE_CALL(p,n) \
DTRACE_LABEL(p,n) \
DTRACE_CALL_INSN(p,n)
#else
#define DTRACE_CALL(p,n) \
DTRACE_LABEL(p,n) \
DTRACE_NOPS
#endif
#ifdef __x86_64__
#define DTRACE_NOPS \
"nop" "\n\t" \
"nop" "\n\t" \
"nop" "\n\t"
#define DTRACE_CALL_INSN(p,n) \
"call _dtracetest" DTRACE_STRINGIFY(_##p##_##n) "\n\t"
#define ARG1_EXTENT 1
#define ARGS2_EXTENT 2
#define ARGS3_EXTENT 3
#define ARGS4_EXTENT 4
#define ARGS5_EXTENT 5
#define ARGS6_EXTENT 6
#define ARGS7_EXTENT 7
#define ARGS8_EXTENT 8
#define ARGS9_EXTENT 9
#define ARGS10_EXTENT 10
#define DTRACE_CALL0ARGS(provider, name) \
asm volatile ( \
DTRACE_CALL(provider, name) \
: \
: \
);
#define DTRACE_CALL1ARG(provider, name) \
asm volatile ("movq\t0x0(%0),%%rdi" "\n\t" \
DTRACE_CALL(provider, name) \
: \
: "r" (__dtrace_args) \
: "memory", "rdi" \
);
#define DTRACE_CALL2ARGS(provider, name) \
asm volatile ("movq\t0x0(%0),%%rdi" "\n\t" \
"movq\t0x8(%0),%%rsi" "\n\t" \
DTRACE_CALL(provider, name) \
: \
: "r" (__dtrace_args) \
: "memory", "rdi", "rsi" \
);
#define DTRACE_CALL3ARGS(provider, name) \
asm volatile ("movq\t0x0(%0),%%rdi" "\n\t" \
"movq\t0x8(%0),%%rsi" "\n\t" \
"movq\t0x10(%0),%%rdx" "\n\t" \
DTRACE_CALL(provider, name) \
: \
: "r" (__dtrace_args) \
: "memory", "rdi", "rsi", "rdx" \
);
#define DTRACE_CALL4ARGS(provider, name) \
asm volatile ("movq\t0x0(%0),%%rdi" "\n\t" \
"movq\t0x8(%0),%%rsi" "\n\t" \
"movq\t0x10(%0),%%rdx" "\n\t" \
"movq\t0x18(%0),%%rcx" "\n\t" \
DTRACE_CALL(provider, name) \
: \
: "r" (__dtrace_args) \
: "memory", "rdi", "rsi", "rdx", "rcx" \
);
#define DTRACE_CALL5ARGS(provider, name) \
asm volatile ("movq\t0x0(%0),%%rdi" "\n\t" \
"movq\t0x8(%0),%%rsi" "\n\t" \
"movq\t0x10(%0),%%rdx" "\n\t" \
"movq\t0x18(%0),%%rcx" "\n\t" \
"movq\t0x20(%0),%%r8" "\n\t" \
DTRACE_CALL(provider, name) \
: \
: "r" (__dtrace_args) \
: "memory", "rdi", "rsi", "rdx", "rcx", "r8" \
);
#define DTRACE_CALL6ARGS(provider, name) \
asm volatile ("movq\t0x0(%0),%%rdi" "\n\t" \
"movq\t0x8(%0),%%rsi" "\n\t" \
"movq\t0x10(%0),%%rdx" "\n\t" \
"movq\t0x18(%0),%%rcx" "\n\t" \
"movq\t0x20(%0),%%r8" "\n\t" \
"movq\t0x28(%0),%%r9" "\n\t" \
DTRACE_CALL(provider, name) \
: \
: "r" (__dtrace_args) \
: "memory", "rdi", "rsi", "rdx", "rcx", "r8", "r9" \
);
#define DTRACE_CALL7ARGS(provider, name) \
asm volatile ("subq\t$0x8,%%rsp" "\n\t" \
"movq\t0x0(%0),%%rdi" "\n\t" \
"movq\t0x8(%0),%%rsi" "\n\t" \
"movq\t0x10(%0),%%rdx" "\n\t" \
"movq\t0x18(%0),%%rcx" "\n\t" \
"movq\t0x20(%0),%%r8" "\n\t" \
"movq\t0x28(%0),%%r9" "\n\t" \
"movq\t0x30(%0),%%rax" "\n\t" \
"movq\t%%rax,0x0(%%rsp)" "\n\t" \
DTRACE_CALL(provider, name) \
"addq\t$0x8,%%rsp" "\n\t" \
: \
: "r" (__dtrace_args) \
: "memory", "rdi", "rsi", "rdx", "rcx", "r8", "r9", "rax" \
);
#endif // __x86_64__
#ifdef __i386__
#define DTRACE_NOPS \
"nop" "\n\t" \
"leal 0(%%esi), %%esi" "\n\t"
#define DTRACE_CALL_INSN(p,n) \
"call _dtracetest" DTRACE_STRINGIFY(_##p##_##n) "\n\t"
#define ARG1_EXTENT 1
#define ARGS2_EXTENT 2
#define ARGS3_EXTENT 4
#define ARGS4_EXTENT 4
#define ARGS5_EXTENT 8
#define ARGS6_EXTENT 8
#define ARGS7_EXTENT 8
#define ARGS8_EXTENT 8
#define ARGS9_EXTENT 12
#define ARGS10_EXTENT 12
/*
* Because this code is used in the kernel, we must not touch any floating point
* or specialized registers. This leaves the following registers:
*
* eax ; volatile, safe to use
* ebx ; PIC register, gcc error when used
* ecx ; volatile, safe to use
* edx ; volatile, safe to use
* esi ; non-volatile, otherwise safe to use
* edi ; non-volatile, otherwise safe to use
*
* Using any of the non volatile register causes a spill to stack which is almost
* certainly a net performance loss. Also, note that the array ref (__dtrace_args)
* consumes one free register. If all three of the volatile regs are used for load/store,
* the compiler will spill a register to hold the array ref.
*
* The end result is that we only pipeline two loads/stores at a time. Blech.
*/
#define DTRACE_CALL0ARGS(provider, name) \
asm volatile ( \
DTRACE_CALL(provider, name) \
"# eat trailing nl +tabfrom DTRACE_CALL" \
: \
: \
);
#define DTRACE_CALL1ARG(provider, name) \
asm volatile ("subl\t$0x10,%%esp" "\n\t" \
"movl\t0x0(%0),%%eax" "\n\t" \
"movl\t%%eax,0x0(%%esp)" "\n\t" \
DTRACE_CALL(provider, name) \
"addl\t$0x10,%%esp" \
: \
: "r" (__dtrace_args) \
: "memory", "eax" \
);
#define DTRACE_CALL2ARGS(provider, name) \
asm volatile ("subl\t$0x10,%%esp" "\n\t" \
"movl\t0x0(%0),%%eax" "\n\t" \
"movl\t0x4(%0),%%edx" "\n\t" \
"movl\t%%eax,0x0(%%esp)" "\n\t" \
"movl\t%%edx,0x4(%%esp)" "\n\t" \
DTRACE_CALL(provider, name) \
"addl\t$0x10,%%esp" \
: \
: "r" (__dtrace_args) \
: "memory", "eax", "edx" \
);
#define DTRACE_CALL3ARGS(provider, name) \
asm volatile ("subl\t$0x10,%%esp" "\n\t" \
"movl\t0x0(%0),%%eax" "\n\t" \
"movl\t0x4(%0),%%edx" "\n\t" \
"movl\t%%eax,0x0(%%esp)" "\n\t" \
"movl\t%%edx,0x4(%%esp)" "\n\t" \
"movl\t0x8(%0),%%eax" "\n\t" \
"movl\t%%eax,0x8(%%esp)" "\n\t" \
DTRACE_CALL(provider, name) \
"addl\t$0x10,%%esp" \
: \
: "r" (__dtrace_args) \
: "memory", "eax", "edx" \
);
#define DTRACE_CALL4ARGS(provider, name) \
asm volatile ("subl\t$0x10,%%esp" "\n\t" \
"movl\t0x0(%0),%%eax" "\n\t" \
"movl\t0x4(%0),%%edx" "\n\t" \
"movl\t%%eax,0x0(%%esp)" "\n\t" \
"movl\t%%edx,0x4(%%esp)" "\n\t" \
"movl\t0x8(%0),%%eax" "\n\t" \
"movl\t0xC(%0),%%edx" "\n\t" \
"movl\t%%eax,0x8(%%esp)" "\n\t" \
"movl\t%%edx,0xC(%%esp)" "\n\t" \
DTRACE_CALL(provider, name) \
"addl\t$0x10,%%esp" \
: \
: "r" (__dtrace_args) \
: "memory", "eax", "edx" \
);
#define DTRACE_CALL5ARGS(provider, name) \
asm volatile ("subl\t$0x20,%%esp" "\n\t" \
"movl\t0x0(%0),%%eax" "\n\t" \
"movl\t0x4(%0),%%edx" "\n\t" \
"movl\t%%eax,0x0(%%esp)" "\n\t" \
"movl\t%%edx,0x4(%%esp)" "\n\t" \
"movl\t0x8(%0),%%eax" "\n\t" \
"movl\t0xC(%0),%%edx" "\n\t" \
"movl\t%%eax,0x8(%%esp)" "\n\t" \
"movl\t%%edx,0xC(%%esp)" "\n\t" \
"movl\t0x10(%0),%%eax" "\n\t" \
"movl\t%%eax,0x10(%%esp)" "\n\t" \
DTRACE_CALL(provider, name) \
"addl\t$0x20,%%esp" \
: \
: "r" (__dtrace_args) \
: "memory", "eax", "edx" \
);
#define DTRACE_CALL6ARGS(provider, name) \
asm volatile ("subl\t$0x20,%%esp" "\n\t" \
"movl\t0x0(%0),%%eax" "\n\t" \
"movl\t0x4(%0),%%edx" "\n\t" \
"movl\t%%eax,0x0(%%esp)" "\n\t" \
"movl\t%%edx,0x4(%%esp)" "\n\t" \
"movl\t0x8(%0),%%eax" "\n\t" \
"movl\t0xC(%0),%%edx" "\n\t" \
"movl\t%%eax,0x8(%%esp)" "\n\t" \
"movl\t%%edx,0xC(%%esp)" "\n\t" \
"movl\t0x10(%0),%%eax" "\n\t" \
"movl\t0x14(%0),%%edx" "\n\t" \
"movl\t%%eax,0x10(%%esp)" "\n\t" \
"movl\t%%edx,0x14(%%esp)" "\n\t" \
DTRACE_CALL(provider, name) \
"addl\t$0x20,%%esp" \
: \
: "r" (__dtrace_args) \
: "memory", "eax", "edx" \
);
#define DTRACE_CALL7ARGS(provider, name) \
asm volatile ("subl\t$0x20,%%esp" "\n\t" \
"movl\t0x0(%0),%%eax" "\n\t" \
"movl\t0x4(%0),%%edx" "\n\t" \
"movl\t%%eax,0x0(%%esp)" "\n\t" \
"movl\t%%edx,0x4(%%esp)" "\n\t" \
"movl\t0x8(%0),%%eax" "\n\t" \
"movl\t0xC(%0),%%edx" "\n\t" \
"movl\t%%eax,0x8(%%esp)" "\n\t" \
"movl\t%%edx,0xC(%%esp)" "\n\t" \
"movl\t0x10(%0),%%eax" "\n\t" \
"movl\t0x14(%0),%%edx" "\n\t" \
"movl\t%%eax,0x10(%%esp)" "\n\t" \
"movl\t%%edx,0x14(%%esp)" "\n\t" \
"movl\t0x18(%0),%%eax" "\n\t" \
"movl\t%%eax,0x18(%%esp)" "\n\t" \
DTRACE_CALL(provider, name) \
"addl\t$0x20,%%esp" \
: \
: "r" (__dtrace_args) \
: "memory", "eax", "edx" \
);
#define DTRACE_CALL8ARGS(provider, name) \
asm volatile ("subl\t$0x20,%%esp" "\n\t" \
"movl\t0x0(%0),%%eax" "\n\t" \
"movl\t0x4(%0),%%edx" "\n\t" \
"movl\t%%eax,0x0(%%esp)" "\n\t" \
"movl\t%%edx,0x4(%%esp)" "\n\t" \
"movl\t0x8(%0),%%eax" "\n\t" \
"movl\t0xC(%0),%%edx" "\n\t" \
"movl\t%%eax,0x8(%%esp)" "\n\t" \
"movl\t%%edx,0xC(%%esp)" "\n\t" \
"movl\t0x10(%0),%%eax" "\n\t" \
"movl\t0x14(%0),%%edx" "\n\t" \
"movl\t%%eax,0x10(%%esp)" "\n\t" \
"movl\t%%edx,0x14(%%esp)" "\n\t" \
"movl\t0x18(%0),%%eax" "\n\t" \
"movl\t0x1C(%0),%%edx" "\n\t" \
"movl\t%%eax,0x18(%%esp)" "\n\t" \
"movl\t%%edx,0x1C(%%esp)" "\n\t" \
DTRACE_CALL(provider, name) \
"addl\t$0x20,%%esp" \
: \
: "r" (__dtrace_args) \
: "memory", "eax", "edx" \
);
#define DTRACE_CALL9ARGS(provider, name) \
asm volatile ("subl\t$0x30,%%esp" "\n\t" \
"movl\t0x0(%0),%%eax" "\n\t" \
"movl\t0x4(%0),%%edx" "\n\t" \
"movl\t%%eax,0x0(%%esp)" "\n\t" \
"movl\t%%edx,0x4(%%esp)" "\n\t" \
"movl\t0x8(%0),%%eax" "\n\t" \
"movl\t0xC(%0),%%edx" "\n\t" \
"movl\t%%eax,0x8(%%esp)" "\n\t" \
"movl\t%%edx,0xC(%%esp)" "\n\t" \
"movl\t0x10(%0),%%eax" "\n\t" \
"movl\t0x14(%0),%%edx" "\n\t" \
"movl\t%%eax,0x10(%%esp)" "\n\t" \
"movl\t%%edx,0x14(%%esp)" "\n\t" \
"movl\t0x18(%0),%%eax" "\n\t" \
"movl\t0x1C(%0),%%edx" "\n\t" \
"movl\t%%eax,0x18(%%esp)" "\n\t" \
"movl\t%%edx,0x1C(%%esp)" "\n\t" \
"movl\t0x20(%0),%%eax" "\n\t" \
"movl\t%%eax,0x20(%%esp)" "\n\t" \
DTRACE_CALL(provider, name) \
"addl\t$0x30,%%esp" \
: \
: "r" (__dtrace_args) \
: "memory", "eax", "edx" \
);
#define DTRACE_CALL10ARGS(provider, name) \
asm volatile ("subl\t$0x30,%%esp" "\n\t" \
"movl\t0x0(%0),%%eax" "\n\t" \
"movl\t0x4(%0),%%edx" "\n\t" \
"movl\t%%eax,0x0(%%esp)" "\n\t" \
"movl\t%%edx,0x4(%%esp)" "\n\t" \
"movl\t0x8(%0),%%eax" "\n\t" \
"movl\t0xC(%0),%%edx" "\n\t" \
"movl\t%%eax,0x8(%%esp)" "\n\t" \
"movl\t%%edx,0xC(%%esp)" "\n\t" \
"movl\t0x10(%0),%%eax" "\n\t" \
"movl\t0x14(%0),%%edx" "\n\t" \
"movl\t%%eax,0x10(%%esp)" "\n\t" \
"movl\t%%edx,0x14(%%esp)" "\n\t" \
"movl\t0x18(%0),%%eax" "\n\t" \
"movl\t0x1C(%0),%%edx" "\n\t" \
"movl\t%%eax,0x18(%%esp)" "\n\t" \
"movl\t%%edx,0x1C(%%esp)" "\n\t" \
"movl\t0x20(%0),%%eax" "\n\t" \
"movl\t0x24(%0),%%edx" "\n\t" \
"movl\t%%eax,0x20(%%esp)" "\n\t" \
"movl\t%%edx,0x24(%%esp)" "\n\t" \
DTRACE_CALL(provider, name) \
"addl\t$0x30,%%esp" \
: \
: "r" (__dtrace_args) \
: "memory", "eax", "edx" \
);
#endif // __i386__
#endif /* _MACH_I386_SDT_ISA_H */

View file

@ -1,42 +0,0 @@
/*
* Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
#ifndef _MACH_I386_THREAD_STATE_H_
#define _MACH_I386_THREAD_STATE_H_
/* Size of maximum exported thread state in words */
#define I386_THREAD_STATE_MAX (614) /* Size of biggest state possible */
#if defined (__i386__) || defined(__x86_64__)
#define THREAD_STATE_MAX I386_THREAD_STATE_MAX
#endif
#endif /* _MACH_I386_THREAD_STATE_H_ */

View file

@ -1,345 +0,0 @@
/*
* Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
/*
* Mach Operating System
* Copyright (c) 1991,1990,1989 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
*/
/*
* File: thread_status.h
* Author: Avadis Tevanian, Jr.
* Date: 1985
*
* This file contains the structure definitions for the thread
* state as applied to I386 processors.
*/
#ifndef _MACH_I386_THREAD_STATUS_H_
#define _MACH_I386_THREAD_STATUS_H_
#include <mach/machine/_structs.h>
#include <mach/message.h>
#include <mach/i386/fp_reg.h>
#include <mach/i386/thread_state.h>
#include <i386/eflags.h>
/*
* the i386_xxxx form is kept for legacy purposes since these types
* are externally known... eventually they should be deprecated.
* our internal implementation has moved to the following naming convention
*
* x86_xxxx32 names are used to deal with 32 bit states
* x86_xxxx64 names are used to deal with 64 bit states
* x86_xxxx names are used to deal with either 32 or 64 bit states
* via a self-describing mechanism
*/
/*
* these are the legacy names which should be deprecated in the future
* they are externally known which is the only reason we don't just get
* rid of them
*/
#define i386_THREAD_STATE 1
#define i386_FLOAT_STATE 2
#define i386_EXCEPTION_STATE 3
/*
* THREAD_STATE_FLAVOR_LIST 0
* these are the supported flavors
*/
#define x86_THREAD_STATE32 1
#define x86_FLOAT_STATE32 2
#define x86_EXCEPTION_STATE32 3
#define x86_THREAD_STATE64 4
#define x86_FLOAT_STATE64 5
#define x86_EXCEPTION_STATE64 6
#define x86_THREAD_STATE 7
#define x86_FLOAT_STATE 8
#define x86_EXCEPTION_STATE 9
#define x86_DEBUG_STATE32 10
#define x86_DEBUG_STATE64 11
#define x86_DEBUG_STATE 12
#define THREAD_STATE_NONE 13
/* 14 and 15 are used for the internal x86_SAVED_STATE flavours */
/* Arrange for flavors to take sequential values, 32-bit, 64-bit, non-specific */
#define x86_AVX_STATE32 16
#define x86_AVX_STATE64 (x86_AVX_STATE32 + 1)
#define x86_AVX_STATE (x86_AVX_STATE32 + 2)
#define x86_AVX512_STATE32 19
#define x86_AVX512_STATE64 (x86_AVX512_STATE32 + 1)
#define x86_AVX512_STATE (x86_AVX512_STATE32 + 2)
#define x86_PAGEIN_STATE 22
#define x86_THREAD_FULL_STATE64 23
/*
* Largest state on this machine:
* (be sure mach/machine/thread_state.h matches!)
*/
#define THREAD_MACHINE_STATE_MAX THREAD_STATE_MAX
/*
* VALID_THREAD_STATE_FLAVOR is a platform specific macro that when passed
* an exception flavor will return if that is a defined flavor for that
* platform. The macro must be manually updated to include all of the valid
* exception flavors as defined above.
*/
#define VALID_THREAD_STATE_FLAVOR(x) \
((x == x86_THREAD_STATE32) || \
(x == x86_FLOAT_STATE32) || \
(x == x86_EXCEPTION_STATE32) || \
(x == x86_DEBUG_STATE32) || \
(x == x86_THREAD_STATE64) || \
(x == x86_THREAD_FULL_STATE64) || \
(x == x86_FLOAT_STATE64) || \
(x == x86_EXCEPTION_STATE64) || \
(x == x86_DEBUG_STATE64) || \
(x == x86_THREAD_STATE) || \
(x == x86_FLOAT_STATE) || \
(x == x86_EXCEPTION_STATE) || \
(x == x86_DEBUG_STATE) || \
(x == x86_AVX_STATE32) || \
(x == x86_AVX_STATE64) || \
(x == x86_AVX_STATE) || \
(x == x86_AVX512_STATE32) || \
(x == x86_AVX512_STATE64) || \
(x == x86_AVX512_STATE) || \
(x == x86_PAGEIN_STATE) || \
(x == THREAD_STATE_NONE))
struct x86_state_hdr {
uint32_t flavor;
uint32_t count;
};
typedef struct x86_state_hdr x86_state_hdr_t;
/*
* Default segment register values.
*/
#define USER_CODE_SELECTOR 0x0017
#define USER_DATA_SELECTOR 0x001f
#define KERN_CODE_SELECTOR 0x0008
#define KERN_DATA_SELECTOR 0x0010
/*
* to be deprecated in the future
*/
typedef _STRUCT_X86_THREAD_STATE32 i386_thread_state_t;
#define i386_THREAD_STATE_COUNT ((mach_msg_type_number_t) \
( sizeof (i386_thread_state_t) / sizeof (int) ))
typedef _STRUCT_X86_THREAD_STATE32 x86_thread_state32_t;
#define x86_THREAD_STATE32_COUNT ((mach_msg_type_number_t) \
( sizeof (x86_thread_state32_t) / sizeof (int) ))
/*
* to be deprecated in the future
*/
typedef _STRUCT_X86_FLOAT_STATE32 i386_float_state_t;
#define i386_FLOAT_STATE_COUNT ((mach_msg_type_number_t) \
(sizeof(i386_float_state_t)/sizeof(unsigned int)))
typedef _STRUCT_X86_FLOAT_STATE32 x86_float_state32_t;
#define x86_FLOAT_STATE32_COUNT ((mach_msg_type_number_t) \
(sizeof(x86_float_state32_t)/sizeof(unsigned int)))
typedef _STRUCT_X86_AVX_STATE32 x86_avx_state32_t;
#define x86_AVX_STATE32_COUNT ((mach_msg_type_number_t) \
(sizeof(x86_avx_state32_t)/sizeof(unsigned int)))
typedef _STRUCT_X86_AVX512_STATE32 x86_avx512_state32_t;
#define x86_AVX512_STATE32_COUNT ((mach_msg_type_number_t) \
(sizeof(x86_avx512_state32_t)/sizeof(unsigned int)))
/*
* to be deprecated in the future
*/
typedef _STRUCT_X86_EXCEPTION_STATE32 i386_exception_state_t;
#define i386_EXCEPTION_STATE_COUNT ((mach_msg_type_number_t) \
( sizeof (i386_exception_state_t) / sizeof (int) ))
typedef _STRUCT_X86_EXCEPTION_STATE32 x86_exception_state32_t;
#define x86_EXCEPTION_STATE32_COUNT ((mach_msg_type_number_t) \
( sizeof (x86_exception_state32_t) / sizeof (int) ))
#define I386_EXCEPTION_STATE_COUNT i386_EXCEPTION_STATE_COUNT
typedef _STRUCT_X86_DEBUG_STATE32 x86_debug_state32_t;
#define x86_DEBUG_STATE32_COUNT ((mach_msg_type_number_t) \
( sizeof (x86_debug_state32_t) / sizeof (int) ))
#define X86_DEBUG_STATE32_COUNT x86_DEBUG_STATE32_COUNT
typedef _STRUCT_X86_THREAD_STATE64 x86_thread_state64_t;
#define x86_THREAD_STATE64_COUNT ((mach_msg_type_number_t) \
( sizeof (x86_thread_state64_t) / sizeof (int) ))
typedef _STRUCT_X86_THREAD_FULL_STATE64 x86_thread_full_state64_t;
#define x86_THREAD_FULL_STATE64_COUNT ((mach_msg_type_number_t) \
( sizeof (x86_thread_full_state64_t) / sizeof (int) ))
typedef _STRUCT_X86_FLOAT_STATE64 x86_float_state64_t;
#define x86_FLOAT_STATE64_COUNT ((mach_msg_type_number_t) \
(sizeof(x86_float_state64_t)/sizeof(unsigned int)))
typedef _STRUCT_X86_AVX_STATE64 x86_avx_state64_t;
#define x86_AVX_STATE64_COUNT ((mach_msg_type_number_t) \
(sizeof(x86_avx_state64_t)/sizeof(unsigned int)))
typedef _STRUCT_X86_AVX512_STATE64 x86_avx512_state64_t;
#define x86_AVX512_STATE64_COUNT ((mach_msg_type_number_t) \
(sizeof(x86_avx512_state64_t)/sizeof(unsigned int)))
typedef _STRUCT_X86_EXCEPTION_STATE64 x86_exception_state64_t;
#define x86_EXCEPTION_STATE64_COUNT ((mach_msg_type_number_t) \
( sizeof (x86_exception_state64_t) / sizeof (int) ))
#define X86_EXCEPTION_STATE64_COUNT x86_EXCEPTION_STATE64_COUNT
typedef _STRUCT_X86_DEBUG_STATE64 x86_debug_state64_t;
#define x86_DEBUG_STATE64_COUNT ((mach_msg_type_number_t) \
( sizeof (x86_debug_state64_t) / sizeof (int) ))
#define X86_DEBUG_STATE64_COUNT x86_DEBUG_STATE64_COUNT
typedef _STRUCT_X86_PAGEIN_STATE x86_pagein_state_t;
#define x86_PAGEIN_STATE_COUNT \
((mach_msg_type_number_t)(sizeof(x86_pagein_state_t) / sizeof(int)))
#define X86_PAGEIN_STATE_COUNT x86_PAGEIN_STATE_COUNT
/*
* Combined thread, float and exception states
*/
struct x86_thread_state {
x86_state_hdr_t tsh;
union {
x86_thread_state32_t ts32;
x86_thread_state64_t ts64;
} uts;
};
struct x86_float_state {
x86_state_hdr_t fsh;
union {
x86_float_state32_t fs32;
x86_float_state64_t fs64;
} ufs;
};
struct x86_exception_state {
x86_state_hdr_t esh;
union {
x86_exception_state32_t es32;
x86_exception_state64_t es64;
} ues;
};
struct x86_debug_state {
x86_state_hdr_t dsh;
union {
x86_debug_state32_t ds32;
x86_debug_state64_t ds64;
} uds;
};
struct x86_avx_state {
x86_state_hdr_t ash;
union {
x86_avx_state32_t as32;
x86_avx_state64_t as64;
} ufs;
};
struct x86_avx512_state {
x86_state_hdr_t ash;
union {
x86_avx512_state32_t as32;
x86_avx512_state64_t as64;
} ufs;
};
typedef struct x86_thread_state x86_thread_state_t;
#define x86_THREAD_STATE_COUNT ((mach_msg_type_number_t) \
( sizeof (x86_thread_state_t) / sizeof (int) ))
typedef struct x86_float_state x86_float_state_t;
#define x86_FLOAT_STATE_COUNT ((mach_msg_type_number_t) \
(sizeof(x86_float_state_t)/sizeof(unsigned int)))
typedef struct x86_exception_state x86_exception_state_t;
#define x86_EXCEPTION_STATE_COUNT ((mach_msg_type_number_t) \
(sizeof(x86_exception_state_t)/sizeof(unsigned int)))
typedef struct x86_debug_state x86_debug_state_t;
#define x86_DEBUG_STATE_COUNT ((mach_msg_type_number_t) \
(sizeof(x86_debug_state_t)/sizeof(unsigned int)))
typedef struct x86_avx_state x86_avx_state_t;
#define x86_AVX_STATE_COUNT ((mach_msg_type_number_t) \
(sizeof(x86_avx_state_t)/sizeof(unsigned int)))
typedef struct x86_avx512_state x86_avx512_state_t;
#define x86_AVX512_STATE_COUNT ((mach_msg_type_number_t) \
(sizeof(x86_avx512_state_t)/sizeof(unsigned int)))
/*
* Machine-independent way for servers and Mach's exception mechanism to
* choose the most efficient state flavor for exception RPC's:
*/
#define MACHINE_THREAD_STATE x86_THREAD_STATE
#define MACHINE_THREAD_STATE_COUNT x86_THREAD_STATE_COUNT
#endif /* _MACH_I386_THREAD_STATUS_H_ */

View file

@ -1,170 +0,0 @@
/*
* Copyright (c) 2000-2012 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
/*
* Mach Operating System
* Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
* Copyright (c) 1994 The University of Utah and
* the Computer Systems Laboratory at the University of Utah (CSL).
* All rights reserved.
*
* Permission to use, copy, modify and distribute this software is hereby
* granted provided that (1) source code retains these copyright, permission,
* and disclaimer notices, and (2) redistributions including binaries
* reproduce the notices in supporting documentation, and (3) all advertising
* materials mentioning features or use of this software display the following
* acknowledgement: ``This product includes software developed by the
* Computer Systems Laboratory at the University of Utah.''
*
* THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
* IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
* ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* CSL requests users of this software to return to csl-dist@cs.utah.edu any
* improvements that they make and grant CSL redistribution rights.
*
*/
/*
* File: vm_param.h
* Author: Avadis Tevanian, Jr.
* Date: 1985
*
* I386 machine dependent virtual memory parameters.
* Most of the declarations are preceeded by I386_ (or i386_)
* which is OK because only I386 specific code will be using
* them.
*/
#ifndef _MACH_I386_VM_PARAM_H_
#define _MACH_I386_VM_PARAM_H_
#define BYTE_SIZE 8 /* byte size in bits */
#define I386_PGBYTES 4096 /* bytes per 80386 page */
#define I386_PGSHIFT 12 /* bitshift for pages */
#define PAGE_SIZE I386_PGBYTES
#define PAGE_SHIFT I386_PGSHIFT
#define PAGE_MASK (PAGE_SIZE - 1)
#define PAGE_MAX_SHIFT PAGE_SHIFT
#define PAGE_MAX_SIZE PAGE_SIZE
#define PAGE_MAX_MASK PAGE_MASK
#define PAGE_MIN_SHIFT PAGE_SHIFT
#define PAGE_MIN_SIZE PAGE_SIZE
#define PAGE_MIN_MASK PAGE_MASK
#define I386_LPGBYTES 2*1024*1024 /* bytes per large page */
#define I386_LPGSHIFT 21 /* bitshift for large pages */
#define I386_LPGMASK (I386_LPGBYTES-1)
/*
* Convert bytes to pages and convert pages to bytes.
* No rounding is used.
*/
#define i386_btop(x) ((ppnum_t)((x) >> I386_PGSHIFT))
#define machine_btop(x) i386_btop(x)
#define i386_ptob(x) (((pmap_paddr_t)(x)) << I386_PGSHIFT)
#define machine_ptob(x) i386_ptob(x)
/*
* Round off or truncate to the nearest page. These will work
* for either addresses or counts. (i.e. 1 byte rounds to 1 page
* bytes.
*/
#define i386_round_page(x) ((((pmap_paddr_t)(x)) + I386_PGBYTES - 1) & \
~(I386_PGBYTES-1))
#define i386_trunc_page(x) (((pmap_paddr_t)(x)) & ~(I386_PGBYTES-1))
#define VM_MIN_ADDRESS64 ((user_addr_t) 0x0000000000000000ULL)
/*
* default top of user stack... it grows down from here
*/
#define VM_USRSTACK64 ((user_addr_t) 0x00007FFEEFC00000ULL)
/*
* XXX TODO: Obsolete?
*/
#define VM_DYLD64 ((user_addr_t) 0x00007FFF5FC00000ULL)
#define VM_LIB64_SHR_DATA ((user_addr_t) 0x00007FFF60000000ULL)
#define VM_LIB64_SHR_TEXT ((user_addr_t) 0x00007FFF80000000ULL)
/*
* the end of the usable user address space , for now about 47 bits.
* the 64 bit commpage is past the end of this
*/
#define VM_MAX_PAGE_ADDRESS ((user_addr_t) 0x00007FFFFFE00000ULL)
/*
* canonical end of user address space for limits checking
*/
#define VM_MAX_USER_PAGE_ADDRESS ((user_addr_t)0x00007FFFFFFFF000ULL)
/* system-wide values */
#define MACH_VM_MIN_ADDRESS ((mach_vm_offset_t) 0)
#define MACH_VM_MAX_ADDRESS ((mach_vm_offset_t) VM_MAX_PAGE_ADDRESS)
/* process-relative values (all 32-bit legacy only for now) */
#define VM_MIN_ADDRESS ((vm_offset_t) 0)
#define VM_USRSTACK32 ((vm_offset_t) 0xC0000000) /* ASLR slides stack down by up to 1 MB */
#define VM_MAX_ADDRESS ((vm_offset_t) 0xFFE00000)
#endif /* _MACH_I386_VM_PARAM_H_ */

View file

@ -1,142 +0,0 @@
/*
* Copyright (c) 2000-2016 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
/*
* Mach Operating System
* Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
*/
/*
* File: vm_types.h
* Author: Avadis Tevanian, Jr.
* Date: 1985
*
* Header file for VM data types. I386 version.
*/
#ifndef _MACH_I386_VM_TYPES_H_
#define _MACH_I386_VM_TYPES_H_
#ifndef ASSEMBLER
#include <i386/_types.h>
#include <mach/i386/vm_param.h>
#include <stdint.h>
/*
* natural_t and integer_t are Mach's legacy types for machine-
* independent integer types (unsigned, and signed, respectively).
* Their original purpose was to define other types in a machine/
* compiler independent way.
*
* They also had an implicit "same size as pointer" characteristic
* to them (i.e. Mach's traditional types are very ILP32 or ILP64
* centric). We support x86 ABIs that do not follow either of
* these models (specifically LP64). Therefore, we had to make a
* choice between making these types scale with pointers or stay
* tied to integers. Because their use is predominantly tied to
* to the size of an integer, we are keeping that association and
* breaking free from pointer size guarantees.
*
* New use of these types is discouraged.
*/
typedef __darwin_natural_t natural_t;
typedef int integer_t;
/*
* A vm_offset_t is a type-neutral pointer,
* e.g. an offset into a virtual memory space.
*/
#ifdef __LP64__
typedef uintptr_t vm_offset_t;
#else /* __LP64__ */
typedef natural_t vm_offset_t;
#endif /* __LP64__ */
/*
* A vm_size_t is the proper type for e.g.
* expressing the difference between two
* vm_offset_t entities.
*/
#ifdef __LP64__
typedef uintptr_t vm_size_t;
#else /* __LP64__ */
typedef natural_t vm_size_t;
#endif /* __LP64__ */
/*
* This new type is independent of a particular vm map's
* implementation size - and represents appropriate types
* for all possible maps. This is used for interfaces
* where the size of the map is not known - or we don't
* want to have to distinguish.
*/
typedef uint64_t mach_vm_address_t;
typedef uint64_t mach_vm_offset_t;
typedef uint64_t mach_vm_size_t;
typedef uint64_t vm_map_offset_t;
typedef uint64_t vm_map_address_t;
typedef uint64_t vm_map_size_t;
typedef mach_vm_address_t mach_port_context_t;
#endif /* ASSEMBLER */
/*
* If composing messages by hand (please do not)
*/
#define MACH_MSG_TYPE_INTEGER_T MACH_MSG_TYPE_INTEGER_32
#endif /* _MACH_I386_VM_TYPES_H_ */

View file

@ -1,330 +0,0 @@
/*
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
/*
* Mach Operating System
* Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
*/
/*
* File: h/kern_return.h
* Author: Avadis Tevanian, Jr.
* Date: 1985
*
* Kernel return codes.
*
*/
#ifndef _MACH_KERN_RETURN_H_
#define _MACH_KERN_RETURN_H_
#include <mach/machine/kern_return.h>
#define KERN_SUCCESS 0
#define KERN_INVALID_ADDRESS 1
/* Specified address is not currently valid.
*/
#define KERN_PROTECTION_FAILURE 2
/* Specified memory is valid, but does not permit the
* required forms of access.
*/
#define KERN_NO_SPACE 3
/* The address range specified is already in use, or
* no address range of the size specified could be
* found.
*/
#define KERN_INVALID_ARGUMENT 4
/* The function requested was not applicable to this
* type of argument, or an argument is invalid
*/
#define KERN_FAILURE 5
/* The function could not be performed. A catch-all.
*/
#define KERN_RESOURCE_SHORTAGE 6
/* A system resource could not be allocated to fulfill
* this request. This failure may not be permanent.
*/
#define KERN_NOT_RECEIVER 7
/* The task in question does not hold receive rights
* for the port argument.
*/
#define KERN_NO_ACCESS 8
/* Bogus access restriction.
*/
#define KERN_MEMORY_FAILURE 9
/* During a page fault, the target address refers to a
* memory object that has been destroyed. This
* failure is permanent.
*/
#define KERN_MEMORY_ERROR 10
/* During a page fault, the memory object indicated
* that the data could not be returned. This failure
* may be temporary; future attempts to access this
* same data may succeed, as defined by the memory
* object.
*/
#define KERN_ALREADY_IN_SET 11
/* The receive right is already a member of the portset.
*/
#define KERN_NOT_IN_SET 12
/* The receive right is not a member of a port set.
*/
#define KERN_NAME_EXISTS 13
/* The name already denotes a right in the task.
*/
#define KERN_ABORTED 14
/* The operation was aborted. Ipc code will
* catch this and reflect it as a message error.
*/
#define KERN_INVALID_NAME 15
/* The name doesn't denote a right in the task.
*/
#define KERN_INVALID_TASK 16
/* Target task isn't an active task.
*/
#define KERN_INVALID_RIGHT 17
/* The name denotes a right, but not an appropriate right.
*/
#define KERN_INVALID_VALUE 18
/* A blatant range error.
*/
#define KERN_UREFS_OVERFLOW 19
/* Operation would overflow limit on user-references.
*/
#define KERN_INVALID_CAPABILITY 20
/* The supplied (port) capability is improper.
*/
#define KERN_RIGHT_EXISTS 21
/* The task already has send or receive rights
* for the port under another name.
*/
#define KERN_INVALID_HOST 22
/* Target host isn't actually a host.
*/
#define KERN_MEMORY_PRESENT 23
/* An attempt was made to supply "precious" data
* for memory that is already present in a
* memory object.
*/
#define KERN_MEMORY_DATA_MOVED 24
/* A page was requested of a memory manager via
* memory_object_data_request for an object using
* a MEMORY_OBJECT_COPY_CALL strategy, with the
* VM_PROT_WANTS_COPY flag being used to specify
* that the page desired is for a copy of the
* object, and the memory manager has detected
* the page was pushed into a copy of the object
* while the kernel was walking the shadow chain
* from the copy to the object. This error code
* is delivered via memory_object_data_error
* and is handled by the kernel (it forces the
* kernel to restart the fault). It will not be
* seen by users.
*/
#define KERN_MEMORY_RESTART_COPY 25
/* A strategic copy was attempted of an object
* upon which a quicker copy is now possible.
* The caller should retry the copy using
* vm_object_copy_quickly. This error code
* is seen only by the kernel.
*/
#define KERN_INVALID_PROCESSOR_SET 26
/* An argument applied to assert processor set privilege
* was not a processor set control port.
*/
#define KERN_POLICY_LIMIT 27
/* The specified scheduling attributes exceed the thread's
* limits.
*/
#define KERN_INVALID_POLICY 28
/* The specified scheduling policy is not currently
* enabled for the processor set.
*/
#define KERN_INVALID_OBJECT 29
/* The external memory manager failed to initialize the
* memory object.
*/
#define KERN_ALREADY_WAITING 30
/* A thread is attempting to wait for an event for which
* there is already a waiting thread.
*/
#define KERN_DEFAULT_SET 31
/* An attempt was made to destroy the default processor
* set.
*/
#define KERN_EXCEPTION_PROTECTED 32
/* An attempt was made to fetch an exception port that is
* protected, or to abort a thread while processing a
* protected exception.
*/
#define KERN_INVALID_LEDGER 33
/* A ledger was required but not supplied.
*/
#define KERN_INVALID_MEMORY_CONTROL 34
/* The port was not a memory cache control port.
*/
#define KERN_INVALID_SECURITY 35
/* An argument supplied to assert security privilege
* was not a host security port.
*/
#define KERN_NOT_DEPRESSED 36
/* thread_depress_abort was called on a thread which
* was not currently depressed.
*/
#define KERN_TERMINATED 37
/* Object has been terminated and is no longer available
*/
#define KERN_LOCK_SET_DESTROYED 38
/* Lock set has been destroyed and is no longer available.
*/
#define KERN_LOCK_UNSTABLE 39
/* The thread holding the lock terminated before releasing
* the lock
*/
#define KERN_LOCK_OWNED 40
/* The lock is already owned by another thread
*/
#define KERN_LOCK_OWNED_SELF 41
/* The lock is already owned by the calling thread
*/
#define KERN_SEMAPHORE_DESTROYED 42
/* Semaphore has been destroyed and is no longer available.
*/
#define KERN_RPC_SERVER_TERMINATED 43
/* Return from RPC indicating the target server was
* terminated before it successfully replied
*/
#define KERN_RPC_TERMINATE_ORPHAN 44
/* Terminate an orphaned activation.
*/
#define KERN_RPC_CONTINUE_ORPHAN 45
/* Allow an orphaned activation to continue executing.
*/
#define KERN_NOT_SUPPORTED 46
/* Empty thread activation (No thread linked to it)
*/
#define KERN_NODE_DOWN 47
/* Remote node down or inaccessible.
*/
#define KERN_NOT_WAITING 48
/* A signalled thread was not actually waiting. */
#define KERN_OPERATION_TIMED_OUT 49
/* Some thread-oriented operation (semaphore_wait) timed out
*/
#define KERN_CODESIGN_ERROR 50
/* During a page fault, indicates that the page was rejected
* as a result of a signature check.
*/
#define KERN_POLICY_STATIC 51
/* The requested property cannot be changed at this time.
*/
#define KERN_INSUFFICIENT_BUFFER_SIZE 52
/* The provided buffer is of insufficient size for the requested data.
*/
#define KERN_RETURN_MAX 0x100
/* Maximum return value allowable
*/
#endif /* _MACH_KERN_RETURN_H_ */

View file

@ -1,180 +0,0 @@
/*
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* NOTICE: This file was modified by SPARTA, Inc. in 2005 to introduce
* support for mandatory and extensible security protections. This notice
* is included in support of clause 2.2 (b) of the Apple Public License,
* Version 2.0.
*/
#ifndef _MACH_KMOD_H_
#define _MACH_KMOD_H_
#include <mach/kern_return.h>
#include <mach/mach_types.h>
#include <sys/cdefs.h>
__BEGIN_DECLS
#if PRAGMA_MARK
#pragma mark Basic macros & typedefs
#endif
/***********************************************************************
* Basic macros & typedefs
***********************************************************************/
#define KMOD_MAX_NAME 64
#define KMOD_RETURN_SUCCESS KERN_SUCCESS
#define KMOD_RETURN_FAILURE KERN_FAILURE
typedef int kmod_t;
struct kmod_info;
typedef kern_return_t kmod_start_func_t(struct kmod_info * ki, void * data);
typedef kern_return_t kmod_stop_func_t(struct kmod_info * ki, void * data);
#if PRAGMA_MARK
#pragma mark Structure definitions
#endif
/***********************************************************************
* Structure definitions
*
* All structures must be #pragma pack(4).
***********************************************************************/
#pragma pack(push, 4)
/* Run-time struct only; never saved to a file */
typedef struct kmod_reference {
struct kmod_reference * next;
struct kmod_info * info;
} kmod_reference_t;
/***********************************************************************
* Warning: Any changes to the kmod_info structure affect the
* KMOD_..._DECL macros below.
***********************************************************************/
/* The kmod_info_t structure is only safe to use inside the running
* kernel. If you need to work with a kmod_info_t structure outside
* the kernel, please use the compatibility definitions below.
*/
typedef struct kmod_info {
struct kmod_info * next;
int32_t info_version; // version of this structure
uint32_t id;
char name[KMOD_MAX_NAME];
char version[KMOD_MAX_NAME];
int32_t reference_count; // # linkage refs to this
kmod_reference_t * reference_list; // who this refs (links on)
vm_address_t address; // starting address
vm_size_t size; // total size
vm_size_t hdr_size; // unwired hdr size
kmod_start_func_t * start;
kmod_stop_func_t * stop;
} kmod_info_t;
/* A compatibility definition of kmod_info_t for 32-bit kexts.
*/
typedef struct kmod_info_32_v1 {
uint32_t next_addr;
int32_t info_version;
uint32_t id;
uint8_t name[KMOD_MAX_NAME];
uint8_t version[KMOD_MAX_NAME];
int32_t reference_count;
uint32_t reference_list_addr;
uint32_t address;
uint32_t size;
uint32_t hdr_size;
uint32_t start_addr;
uint32_t stop_addr;
} kmod_info_32_v1_t;
/* A compatibility definition of kmod_info_t for 64-bit kexts.
*/
typedef struct kmod_info_64_v1 {
uint64_t next_addr;
int32_t info_version;
uint32_t id;
uint8_t name[KMOD_MAX_NAME];
uint8_t version[KMOD_MAX_NAME];
int32_t reference_count;
uint64_t reference_list_addr;
uint64_t address;
uint64_t size;
uint64_t hdr_size;
uint64_t start_addr;
uint64_t stop_addr;
} kmod_info_64_v1_t;
#pragma pack(pop)
#if PRAGMA_MARK
#pragma mark Kmod structure declaration macros
#endif
/***********************************************************************
* Kmod structure declaration macros
***********************************************************************/
#define KMOD_INFO_NAME kmod_info
#define KMOD_INFO_VERSION 1
#define KMOD_DECL(name, version) \
static kmod_start_func_t name ## _module_start; \
static kmod_stop_func_t name ## _module_stop; \
kmod_info_t KMOD_INFO_NAME = { 0, KMOD_INFO_VERSION, -1U, \
{ #name }, { version }, -1, 0, 0, 0, 0, \
name ## _module_start, \
name ## _module_stop };
#define KMOD_EXPLICIT_DECL(name, version, start, stop) \
kmod_info_t KMOD_INFO_NAME = { 0, KMOD_INFO_VERSION, -1U, \
{ #name }, { version }, -1, 0, 0, 0, 0, \
start, stop };
#if PRAGMA_MARK
#pragma mark Kernel private declarations
#endif
/***********************************************************************
* Kernel private declarations.
***********************************************************************/
#if PRAGMA_MARK
#pragma mark Obsolete kmod stuff
#endif
/***********************************************************************
* These 3 should be dropped but they're referenced by MIG declarations.
***********************************************************************/
typedef void * kmod_args_t;
typedef int kmod_control_flavor_t;
typedef kmod_info_t * kmod_info_array_t;
__END_DECLS
#endif /* _MACH_KMOD_H_ */

View file

@ -1,83 +0,0 @@
/*
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*
*/
/*
* File: mach/lock_set.defs
* Author: Joseph CaraDonna
*
* Exported kernel calls
*
*/
subsystem
#if KERNEL_SERVER
KernelServer
#endif /* KERNEL_SERVER */
lock_set 617000;
#include <mach/std_types.defs>
#include <mach/mach_types.defs>
/*
* OBSOLETE interfaces
* a lock_set_t is created and destroyed through the task object.
* lock_set_create(task,&lock_set_t,...);
* lock_set_destroy(task,lock_set_t);
*/
/*
* OBSOLETE interfaces
*/
routine lock_acquire(
lock_set : lock_set_t;
lock_id : int);
routine lock_release(
lock_set : lock_set_t;
lock_id : int);
routine lock_try(
lock_set : lock_set_t;
lock_id : int);
routine lock_make_stable(
lock_set : lock_set_t;
lock_id : int);
routine lock_handoff(
lock_set : lock_set_t;
lock_id : int);
routine lock_handoff_accept(
lock_set : lock_set_t;
lock_id : int);
/* vim: set ft=c : */

View file

@ -1,350 +0,0 @@
#ifndef _lock_set_user_
#define _lock_set_user_
/* Module lock_set */
#include <string.h>
#include <mach/ndr.h>
#include <mach/boolean.h>
#include <mach/kern_return.h>
#include <mach/notify.h>
#include <mach/mach_types.h>
#include <mach/message.h>
#include <mach/mig_errors.h>
#include <mach/port.h>
/* BEGIN MIG_STRNCPY_ZEROFILL CODE */
#if defined(__has_include)
#if __has_include(<mach/mig_strncpy_zerofill_support.h>)
#ifndef USING_MIG_STRNCPY_ZEROFILL
#define USING_MIG_STRNCPY_ZEROFILL
#endif
#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__
#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__
#ifdef __cplusplus
extern "C" {
#endif
extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import));
#ifdef __cplusplus
}
#endif
#endif /* __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ */
#endif /* __has_include(<mach/mig_strncpy_zerofill_support.h>) */
#endif /* __has_include */
/* END MIG_STRNCPY_ZEROFILL CODE */
#ifdef AUTOTEST
#ifndef FUNCTION_PTR_T
#define FUNCTION_PTR_T
typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t);
typedef struct {
char *name;
function_ptr_t function;
} function_table_entry;
typedef function_table_entry *function_table_t;
#endif /* FUNCTION_PTR_T */
#endif /* AUTOTEST */
#ifndef lock_set_MSG_COUNT
#define lock_set_MSG_COUNT 6
#endif /* lock_set_MSG_COUNT */
#include <mach/std_types.h>
#include <mach/mig.h>
#include <mach/mig.h>
#include <mach/mach_types.h>
#ifdef __BeforeMigUserHeader
__BeforeMigUserHeader
#endif /* __BeforeMigUserHeader */
#include <sys/cdefs.h>
__BEGIN_DECLS
/* Routine lock_acquire */
#ifdef mig_external
mig_external
#else
extern
#endif /* mig_external */
kern_return_t lock_acquire
(
lock_set_t lock_set,
int lock_id
);
/* Routine lock_release */
#ifdef mig_external
mig_external
#else
extern
#endif /* mig_external */
kern_return_t lock_release
(
lock_set_t lock_set,
int lock_id
);
/* Routine lock_try */
#ifdef mig_external
mig_external
#else
extern
#endif /* mig_external */
kern_return_t lock_try
(
lock_set_t lock_set,
int lock_id
);
/* Routine lock_make_stable */
#ifdef mig_external
mig_external
#else
extern
#endif /* mig_external */
kern_return_t lock_make_stable
(
lock_set_t lock_set,
int lock_id
);
/* Routine lock_handoff */
#ifdef mig_external
mig_external
#else
extern
#endif /* mig_external */
kern_return_t lock_handoff
(
lock_set_t lock_set,
int lock_id
);
/* Routine lock_handoff_accept */
#ifdef mig_external
mig_external
#else
extern
#endif /* mig_external */
kern_return_t lock_handoff_accept
(
lock_set_t lock_set,
int lock_id
);
__END_DECLS
/********************** Caution **************************/
/* The following data types should be used to calculate */
/* maximum message sizes only. The actual message may be */
/* smaller, and the position of the arguments within the */
/* message layout may vary from what is presented here. */
/* For example, if any of the arguments are variable- */
/* sized, and less than the maximum is sent, the data */
/* will be packed tight in the actual message to reduce */
/* the presence of holes. */
/********************** Caution **************************/
/* typedefs for all requests */
#ifndef __Request__lock_set_subsystem__defined
#define __Request__lock_set_subsystem__defined
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
NDR_record_t NDR;
int lock_id;
} __Request__lock_acquire_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
NDR_record_t NDR;
int lock_id;
} __Request__lock_release_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
NDR_record_t NDR;
int lock_id;
} __Request__lock_try_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
NDR_record_t NDR;
int lock_id;
} __Request__lock_make_stable_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
NDR_record_t NDR;
int lock_id;
} __Request__lock_handoff_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
NDR_record_t NDR;
int lock_id;
} __Request__lock_handoff_accept_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#endif /* !__Request__lock_set_subsystem__defined */
/* union of all requests */
#ifndef __RequestUnion__lock_set_subsystem__defined
#define __RequestUnion__lock_set_subsystem__defined
union __RequestUnion__lock_set_subsystem {
__Request__lock_acquire_t Request_lock_acquire;
__Request__lock_release_t Request_lock_release;
__Request__lock_try_t Request_lock_try;
__Request__lock_make_stable_t Request_lock_make_stable;
__Request__lock_handoff_t Request_lock_handoff;
__Request__lock_handoff_accept_t Request_lock_handoff_accept;
};
#endif /* !__RequestUnion__lock_set_subsystem__defined */
/* typedefs for all replies */
#ifndef __Reply__lock_set_subsystem__defined
#define __Reply__lock_set_subsystem__defined
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
NDR_record_t NDR;
kern_return_t RetCode;
} __Reply__lock_acquire_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
NDR_record_t NDR;
kern_return_t RetCode;
} __Reply__lock_release_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
NDR_record_t NDR;
kern_return_t RetCode;
} __Reply__lock_try_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
NDR_record_t NDR;
kern_return_t RetCode;
} __Reply__lock_make_stable_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
NDR_record_t NDR;
kern_return_t RetCode;
} __Reply__lock_handoff_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
NDR_record_t NDR;
kern_return_t RetCode;
} __Reply__lock_handoff_accept_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#endif /* !__Reply__lock_set_subsystem__defined */
/* union of all replies */
#ifndef __ReplyUnion__lock_set_subsystem__defined
#define __ReplyUnion__lock_set_subsystem__defined
union __ReplyUnion__lock_set_subsystem {
__Reply__lock_acquire_t Reply_lock_acquire;
__Reply__lock_release_t Reply_lock_release;
__Reply__lock_try_t Reply_lock_try;
__Reply__lock_make_stable_t Reply_lock_make_stable;
__Reply__lock_handoff_t Reply_lock_handoff;
__Reply__lock_handoff_accept_t Reply_lock_handoff_accept;
};
#endif /* !__RequestUnion__lock_set_subsystem__defined */
#ifndef subsystem_to_name_map_lock_set
#define subsystem_to_name_map_lock_set \
{ "lock_acquire", 617000 },\
{ "lock_release", 617001 },\
{ "lock_try", 617002 },\
{ "lock_make_stable", 617003 },\
{ "lock_handoff", 617004 },\
{ "lock_handoff_accept", 617005 }
#endif
#ifdef __AfterMigUserHeader
__AfterMigUserHeader
#endif /* __AfterMigUserHeader */
#endif /* _lock_set_user_ */

View file

@ -1,245 +0,0 @@
/*
* Copyright (c) 1999-2014 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* Mach Operating System
* Copyright (c) 1991,1990,1989 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
* Includes all the types that a normal user
* of Mach programs should need
*/
#ifndef _MACH_H_
#define _MACH_H_
#define __MACH30__
#define MACH_IPC_FLAVOR UNTYPED
#include <mach/std_types.h>
#include <mach/mach_types.h>
#include <mach/mach_interface.h>
#include <mach/mach_port.h>
#include <mach/mach_init.h>
#include <mach/mach_host.h>
#include <mach/thread_switch.h>
#include <mach/rpc.h> /* for compatibility only */
#include <mach/mig.h>
#include <mach/mig_errors.h>
#include <mach/mach_error.h>
#include <sys/cdefs.h>
__BEGIN_DECLS
/*
* Standard prototypes
*/
extern void panic_init(mach_port_t);
extern void panic(const char *, ...);
extern void safe_gets(char *,
char *,
int);
extern void slot_name(cpu_type_t,
cpu_subtype_t,
char **,
char **);
extern void mig_reply_setup(mach_msg_header_t *,
mach_msg_header_t *);
__WATCHOS_PROHIBITED __TVOS_PROHIBITED
extern void mach_msg_destroy(mach_msg_header_t *);
__WATCHOS_PROHIBITED __TVOS_PROHIBITED
extern mach_msg_return_t mach_msg_receive(mach_msg_header_t *);
__WATCHOS_PROHIBITED __TVOS_PROHIBITED
extern mach_msg_return_t mach_msg_send(mach_msg_header_t *);
__WATCHOS_PROHIBITED __TVOS_PROHIBITED
extern mach_msg_return_t mach_msg_server_once(boolean_t (*)
(mach_msg_header_t *,
mach_msg_header_t *),
mach_msg_size_t,
mach_port_t,
mach_msg_options_t);
__WATCHOS_PROHIBITED __TVOS_PROHIBITED
extern mach_msg_return_t mach_msg_server(boolean_t (*)
(mach_msg_header_t *,
mach_msg_header_t *),
mach_msg_size_t,
mach_port_t,
mach_msg_options_t);
__WATCHOS_PROHIBITED __TVOS_PROHIBITED
extern mach_msg_return_t mach_msg_server_importance(boolean_t (*)
(mach_msg_header_t *,
mach_msg_header_t *),
mach_msg_size_t,
mach_port_t,
mach_msg_options_t);
/*
* Prototypes for compatibility
*/
extern kern_return_t clock_get_res(mach_port_t,
clock_res_t *);
extern kern_return_t clock_set_res(mach_port_t,
clock_res_t);
extern kern_return_t clock_sleep(mach_port_t,
int,
mach_timespec_t,
mach_timespec_t *);
/*!
* @group voucher_mach_msg Prototypes
*/
#define VOUCHER_MACH_MSG_API_VERSION 20140205
/*!
* @typedef voucher_mach_msg_state_t
*
* @abstract
* Opaque object encapsulating state changed by voucher_mach_msg_adopt().
*/
typedef struct voucher_mach_msg_state_s *voucher_mach_msg_state_t;
/*!
* @const VOUCHER_MACH_MSG_STATE_UNCHANGED
*
* @discussion
* Constant indicating no state change occurred.
*/
#define VOUCHER_MACH_MSG_STATE_UNCHANGED ((voucher_mach_msg_state_t)~0ul)
/*!
* @function voucher_mach_msg_set
*
* @abstract
* Change specified message header to contain current mach voucher with a
* COPY_SEND disposition.
* Does not change message if it already has non-zero MACH_MSGH_BITS_VOUCHER.
*
* @discussion
* Borrows reference to current thread voucher so message should be sent
* immediately (without intervening calls that might change that voucher).
*
* @param msg
* The message to modify.
*
* @result
* True if header was changed.
*/
extern boolean_t voucher_mach_msg_set(mach_msg_header_t *msg);
/*!
* @function voucher_mach_msg_clear
*
* @abstract
* Removes changes made to specified message header by voucher_mach_msg_set()
* and any mach_msg() send operations (successful or not).
* If the message is not needed further, mach_msg_destroy() should be called
* instead.
*
* @discussion
* Not intended to be called if voucher_mach_msg_set() returned false.
* Releases reference to message mach voucher if an extra reference was
* acquired due to an unsuccessful send operation (pseudo-receive).
*
* @param msg
* The message to modify.
*/
extern void voucher_mach_msg_clear(mach_msg_header_t *msg);
/*!
* @function voucher_mach_msg_adopt
*
* @abstract
* Adopt the voucher contained in the specified message on the current thread
* and return the previous thread voucher state.
*
* @discussion
* Ownership of the mach voucher in the message is transferred to the current
* thread and the message header voucher fields are cleared.
*
* @param msg
* The message to query and modify.
*
* @result
* The previous thread voucher state or VOUCHER_MACH_MSG_STATE_UNCHANGED if no
* state change occurred.
*/
extern voucher_mach_msg_state_t voucher_mach_msg_adopt(mach_msg_header_t *msg);
/*!
* @function voucher_mach_msg_revert
*
* @abstract
* Restore thread voucher state previously modified by voucher_mach_msg_adopt().
*
* @discussion
* Current thread voucher reference is released.
* No change to thread voucher state if passed VOUCHER_MACH_MSG_STATE_UNCHANGED.
*
* @param state
* The thread voucher state to restore.
*/
extern void voucher_mach_msg_revert(voucher_mach_msg_state_t state);
__END_DECLS
#endif /* _MACH_H_ */

View file

@ -1,93 +0,0 @@
/*
* Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* Mach Operating System
* Copyright (c) 1991,1990,1989 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
/*
* File: mach_error.h
* Author: Douglas Orr, Carnegie Mellon University
* Date: Mar. 1988
*
* Definitions of routines in mach_error.c
*/
#ifndef _MACH_ERROR_
#define _MACH_ERROR_ 1
#include <mach/error.h>
#include <sys/cdefs.h>
__BEGIN_DECLS
char *mach_error_string(
/*
* Returns a string appropriate to the error argument given
*/
mach_error_t error_value
);
void mach_error(
/*
* Prints an appropriate message on the standard error stream
*/
const char *str,
mach_error_t error_value
);
char *mach_error_type(
/*
* Returns a string with the error system, subsystem and code
*/
mach_error_t error_value
);
__END_DECLS
#endif /* _MACH_ERROR_ */

View file

@ -1,133 +0,0 @@
/*
* Copyright (c) 2006 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
/*
* Mach Operating System
* Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
*/
/*
* Abstract:
* MiG definitions file for Mach exception interface.
*/
subsystem
#if KERNEL_USER
KernelUser
#endif
#if KERNEL_SERVER
KernelServer
#endif /* KERNEL_SERVER */
mach_exc 2405;
#include <mach/std_types.defs>
#include <mach/mach_types.defs>
ServerPrefix catch_;
type mach_exception_data_t = array[*:2] of int64_t;
type exception_type_t = int;
routine mach_exception_raise(
exception_port : mach_port_t;
thread : mach_port_t;
task : mach_port_t;
exception : exception_type_t;
code : mach_exception_data_t
#if MACH_EXC_SERVER_SECTOKEN
;
ServerSecToken stoken : security_token_t
#endif
#if MACH_EXC_SERVER_AUDITTOKEN
;
ServerAuditToken atoken: audit_token_t
#endif
);
routine mach_exception_raise_state(
exception_port : mach_port_t;
exception : exception_type_t;
code : mach_exception_data_t, const;
inout flavor : int;
old_state : thread_state_t, const;
out new_state : thread_state_t
#if MACH_EXC_SERVER_SECTOKEN
;
ServerSecToken stoken : security_token_t
#endif
#if MACH_EXC_SERVER_AUDITTOKEN
;
ServerAuditToken atoken: audit_token_t
#endif
);
routine mach_exception_raise_state_identity(
exception_port : mach_port_t;
thread : mach_port_t;
task : mach_port_t;
exception : exception_type_t;
code : mach_exception_data_t;
inout flavor : int;
old_state : thread_state_t;
out new_state : thread_state_t
#if MACH_EXC_SERVER_SECTOKEN
;
ServerSecToken stoken : security_token_t
#endif
#if MACH_EXC_SERVER_AUDITTOKEN
;
ServerAuditToken atoken: audit_token_t
#endif
);
/* vim: set ft=c : */

View file

@ -1,357 +0,0 @@
/*
* Copyright (c) 2000-2009 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
/*
* Mach Operating System
* Copyright (c) 1991,1990,1989 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
*/
/*
* File: mach/mach_host.defs
*
* Abstract:
* Mach host operations support. Includes processor allocation and
* control.
*/
subsystem
#if KERNEL_SERVER
KernelServer
#endif /* KERNEL_SERVER */
mach_host 200;
/*
* Basic types
*/
#include <mach/std_types.defs>
#include <mach/mach_types.defs>
#include <mach/clock_types.defs>
#include <mach_debug/mach_debug_types.defs>
/*
* References to host objects are returned by:
* mach_host_self() - trap
*/
/*
* Return information about this host.
*/
routine host_info(
host : host_t;
flavor : host_flavor_t;
out host_info_out : host_info_t, CountInOut);
/*
* Get string describing current kernel version.
*/
routine host_kernel_version(
host : host_t;
out kernel_version : kernel_version_t);
/*
* Get host page size
* (compatibility for running old libraries on new kernels -
* host_page_size() is now a library routine based on constants)
*/
routine _host_page_size(
host : host_t;
out out_page_size : vm_size_t);
/*
* Allow pagers to create named entries that point to un-mapped
* abstract memory object. The named entries are generally mappable
* and can be subsetted through the mach_make_memory_entry call
*/
routine mach_memory_object_memory_entry(
host :host_t;
internal :boolean_t;
size :vm_size_t;
permission :vm_prot_t;
pager :memory_object_t;
out entry_handle :mach_port_move_send_t);
/*
* Get processor info for all the processors on this host.
* The returned data is an OOL array of processor info.
*/
routine host_processor_info(
host : host_t;
flavor : processor_flavor_t;
out out_processor_count : natural_t;
out out_processor_info : processor_info_array_t);
/*
* Return host IO master access port
*/
routine host_get_io_master(
host : host_t;
out io_master : io_master_t);
/*
* Get service port for a processor set.
* Available to all.
*/
routine host_get_clock_service(
host : host_t;
clock_id : clock_id_t;
out clock_serv : clock_serv_t);
/*
* kernel module interface (obsolete as of SnowLeopard)
* see mach/kmod.h
*/
/* kmod_ MIG calls now return KERN_NOT_SUPPORTED on PPC/i386/x86_64. */
routine kmod_get_info(
host : host_t;
out modules : kmod_args_t);
skip; /* was host_zone_info */
/*
* Returns information about the global VP table.
* Only supported in MACH_VM_DEBUG kernels,
* otherwise returns KERN_FAILURE.
*/
routine host_virtual_physical_table_info(
host : host_t;
out info : hash_info_bucket_array_t,
Dealloc);
skip; /* was host_ipc_hash_info */
skip; /* was enable_bluebox */
skip; /* was disable_bluebox */
/*
* JMM - Keep processor_set related items at the end for easy
* removal.
*/
/*
* Get default processor set for host.
*/
routine processor_set_default(
host : host_t;
out default_set : processor_set_name_t);
/*
* Create new processor set. Returns real port for manipulations,
* and name port for obtaining information.
*/
routine processor_set_create(
host : host_t;
out new_set : processor_set_t;
out new_name : processor_set_name_t);
/*
* Temporary interfaces for conversion to 64 bit data path
*/
routine mach_memory_object_memory_entry_64(
host :host_t;
internal :boolean_t;
size :memory_object_size_t;
permission :vm_prot_t;
pager :memory_object_t;
out entry_handle :mach_port_move_send_t);
/*
* Return statistics from this host.
*/
routine
#ifdef KERNEL_SERVER
host_statistics_from_user(
#else
host_statistics(
#endif
host_priv : host_t;
flavor : host_flavor_t;
out host_info_out : host_info_t, CountInOut);
routine host_request_notification(
host : host_t;
notify_type : host_flavor_t;
notify_port : mach_port_make_send_once_t);
routine host_lockgroup_info(
host : host_t;
out lockgroup_info : lockgroup_info_array_t,
Dealloc);
/*
* Return 64-bit statistics from this host.
*/
routine
#ifdef KERNEL_SERVER
host_statistics64_from_user(
#else
host_statistics64(
#endif
host_priv : host_t;
flavor : host_flavor_t;
out host_info64_out : host_info64_t, CountInOut);
/*
* Returns information about the memory allocation zones.
* Data returned is compatible with various caller and kernel
* address space sizes.
*/
routine mach_zone_info(
host : host_priv_t;
out names : mach_zone_name_array_t,
Dealloc;
out info : mach_zone_info_array_t,
Dealloc);
skip;
/*
* Create a new voucher by running a series of commands against
* <key, previous-voucher> pairs of resource attributes.
*/
#if !KERNEL && !LIBSYSCALL_INTERFACE
routine _kernelrpc_host_create_mach_voucher(
#else
routine host_create_mach_voucher(
#endif
host : host_t;
recipes : mach_voucher_attr_raw_recipe_array_t;
out voucher : ipc_voucher_t);
/*
* Register a resource manager with the kernel. A new key is selected.
*/
routine host_register_mach_voucher_attr_manager(
host : host_t;
attr_manager : mach_voucher_attr_manager_t;
default_value : mach_voucher_attr_value_handle_t;
out new_key : mach_voucher_attr_key_t;
out new_attr_control: ipc_voucher_attr_control_t);
/*
* Register a resource manager (with a well-known key value) with the kernel.
*/
routine host_register_well_known_mach_voucher_attr_manager(
host : host_t;
attr_manager : mach_voucher_attr_manager_t;
default_value : mach_voucher_attr_value_handle_t;
key : mach_voucher_attr_key_t;
out new_attr_control: ipc_voucher_attr_control_t);
/*
* Update the global ATM diagnostic flag, readable from the commpage
*/
routine host_set_atm_diagnostic_flag(
host : host_t;
in diagnostic_flag : uint32_t);
#if !KERNEL && LIBSYSCALL_INTERFACE
routine host_get_atm_diagnostic_flag(
host : host_t;
out diagnostic_flag : uint32_t);
#else
skip;
#endif
routine mach_memory_info(
host : host_priv_t;
out names : mach_zone_name_array_t,
Dealloc;
out info : mach_zone_info_array_t,
Dealloc;
out memory_info : mach_memory_info_array_t,
Dealloc);
/*
* Update the global multiuser flags, readable from the commpage
*/
routine host_set_multiuser_config_flags(
host_priv : host_priv_t;
in multiuser_flags : uint32_t);
#if !KERNEL && LIBSYSCALL_INTERFACE
routine host_get_multiuser_config_flags(
host : host_t;
out multiuser_flags : uint32_t);
#else
skip;
#endif // !KERNEL && LIBSYSCALL_INTERFACE
#if !KERNEL && LIBSYSCALL_INTERFACE
routine host_check_multiuser_mode(
host : host_t;
out multiuser_mode : uint32_t);
#else
skip;
#endif // !KERNEL && LIBSYSCALL_INTERFACE
/*
* Returns information about a specific zone.
* The zone name is passed in via the argument name,
* info returns the zone info.
*/
routine mach_zone_info_for_zone(
host : host_priv_t;
name : mach_zone_name_t;
out info : mach_zone_info_t);
skip;
skip;
skip;
/* vim: set ft=c : */

View file

@ -1,110 +0,0 @@
/*
* Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* Mach Operating System
* Copyright (c) 1991,1990,1989,1988,1987,1986 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
* Items provided by the Mach environment initialization.
*/
#ifndef _MACH_INIT_
#define _MACH_INIT_ 1
#include <mach/mach_types.h>
#include <mach/vm_page_size.h>
#include <stdarg.h>
#include <sys/cdefs.h>
/*
* Kernel-related ports; how a task/thread controls itself
*/
__BEGIN_DECLS
extern mach_port_t mach_host_self(void);
extern mach_port_t mach_thread_self(void);
extern kern_return_t host_page_size(host_t, vm_size_t *);
extern mach_port_t mach_task_self_;
#define mach_task_self() mach_task_self_
#define current_task() mach_task_self()
__END_DECLS
#include <mach/mach_traps.h>
__BEGIN_DECLS
/*
* Other important ports in the Mach user environment
*/
extern mach_port_t bootstrap_port;
/*
* Where these ports occur in the "mach_ports_register"
* collection... only servers or the runtime library need know.
*/
#define NAME_SERVER_SLOT 0
#define ENVIRONMENT_SLOT 1
#define SERVICE_SLOT 2
#define MACH_PORTS_SLOTS_USED 3
/*
* fprintf_stderr uses vprintf_stderr_func to produce
* error messages, this can be overridden by a user
* application to point to a user-specified output function
*/
extern int (*vprintf_stderr_func)(const char *format, va_list ap);
__END_DECLS
#endif /* _MACH_INIT_ */

View file

@ -1,53 +0,0 @@
/*
* Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* Copyright (C) Apple Computer 1998
* ALL Rights Reserved
*/
/*
* This file represents the interfaces that used to come
* from creating the user headers from the mach.defs file.
* Because mach.defs was decomposed, this file now just
* wraps up all the new interface headers generated from
* each of the new .defs resulting from that decomposition.
*/
#ifndef _MACH_INTERFACE_H_
#define _MACH_INTERFACE_H_
#include <mach/clock_priv.h>
#include <mach/host_priv.h>
#include <mach/host_security.h>
#include <mach/lock_set.h>
#include <mach/processor.h>
#include <mach/processor_set.h>
#include <mach/semaphore.h>
#include <mach/task.h>
#include <mach/thread_act.h>
#include <mach/vm_map.h>
#endif /* _MACH_INTERFACE_H_ */

View file

@ -1,76 +0,0 @@
/*
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
/*
* Mach Operating System
* Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
*/
/*
* File: mach/mach_param.h
* Author: Avadis Tevanian, Jr., Michael Wayne Young
* Date: 1986
*
* Mach system sizing parameters
*/
#ifndef _MACH_MACH_PARAM_H_
#define _MACH_MACH_PARAM_H_
/* Number of "registered" ports */
#define TASK_PORT_REGISTER_MAX 3
/* Number of watchport for task */
#define TASK_MAX_WATCHPORT_COUNT 32
#endif /* _MACH_MACH_PARAM_H_ */

View file

@ -1,676 +0,0 @@
/*
* Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_FREE_COPYRIGHT@
*/
/*
* Mach Operating System
* Copyright (c) 1991,1990,1989 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
*/
/*
* File: mach/mach_port.defs
* Author: Rich Draves
*
* Exported kernel calls.
*/
subsystem
#if KERNEL_SERVER
KernelServer
#endif /* KERNEL_SERVER */
mach_port 3200;
#if !KERNEL && !LIBSYSCALL_INTERFACE
UserPrefix _kernelrpc_;
#endif
#include <mach/std_types.defs>
#include <mach/mach_types.defs>
#include <mach_debug/mach_debug_types.defs>
type kobject_description_t = c_string[*:512];
/*
* Returns the set of port and port set names
* to which the target task has access, along with
* the type (set or port) for each name.
*/
routine mach_port_names(
task : ipc_space_t;
out names : mach_port_name_array_t;
out types : mach_port_type_array_t);
/*
* Returns the type (set or port) for the port name
* within the target task. Also indicates whether
* there is a dead-name request for the name.
*/
routine mach_port_type(
task : ipc_space_t;
name : mach_port_name_t;
out ptype : mach_port_type_t);
/*
* Changes the name by which a port (or port set) is known to
* the target task. The new name can't be in use. The
* old name becomes available for recycling.
*
* This interface is OBSOLETE and will always
* return KERN_NOT_SUPPORTED.
*/
routine mach_port_rename(
task : ipc_space_t;
old_name : mach_port_name_t;
new_name : mach_port_name_t);
/*
* Allocates the specified kind of object, with the given name.
* The right must be one of
* MACH_PORT_RIGHT_RECEIVE
* MACH_PORT_RIGHT_PORT_SET
* MACH_PORT_RIGHT_DEAD_NAME
* New port sets are empty. New ports don't have any
* send/send-once rights or queued messages. The make-send
* count is zero and their queue limit is MACH_PORT_QLIMIT_DEFAULT.
* New sets, ports, and dead names have one user reference.
*/
routine mach_port_allocate_name(
task : ipc_space_t;
right : mach_port_right_t;
name : mach_port_name_t);
/*
* Allocates the specified kind of object.
* The right must be one of
* MACH_PORT_RIGHT_RECEIVE
* MACH_PORT_RIGHT_PORT_SET
* MACH_PORT_RIGHT_DEAD_NAME
* Like port_allocate_name, but the kernel picks a name.
* It can use any name not associated with a right.
*/
routine mach_port_allocate(
task : ipc_space_t;
right : mach_port_right_t;
out name : mach_port_name_t);
/*
* Destroys all rights associated with the name and makes it
* available for recycling immediately. The name can be a
* port (possibly with multiple user refs), a port set, or
* a dead name (again, with multiple user refs).
*/
routine mach_port_destroy(
task : ipc_space_t;
name : mach_port_name_t);
/*
* Releases one send/send-once/dead-name user ref.
* Just like mach_port_mod_refs -1, but deduces the
* correct type of right. This allows a user task
* to release a ref for a port without worrying
* about whether the port has died or not.
*/
routine mach_port_deallocate(
task : ipc_space_t;
name : mach_port_name_t);
/*
* A port set always has one user ref.
* A send-once right always has one user ref.
* A dead name always has one or more user refs.
* A send right always has one or more user refs.
* A receive right always has one user ref.
* The right must be one of
* MACH_PORT_RIGHT_RECEIVE
* MACH_PORT_RIGHT_PORT_SET
* MACH_PORT_RIGHT_DEAD_NAME
* MACH_PORT_RIGHT_SEND
* MACH_PORT_RIGHT_SEND_ONCE
*/
routine mach_port_get_refs(
task : ipc_space_t;
name : mach_port_name_t;
right : mach_port_right_t;
out refs : mach_port_urefs_t);
/*
* The delta is a signed change to the task's
* user ref count for the right. Only dead names
* and send rights can have a positive delta.
* The resulting user ref count can't be negative.
* If it is zero, the right is deallocated.
* If the name isn't a composite right, it becomes
* available for recycling. The right must be one of
* MACH_PORT_RIGHT_RECEIVE
* MACH_PORT_RIGHT_PORT_SET
* MACH_PORT_RIGHT_DEAD_NAME
* MACH_PORT_RIGHT_SEND
* MACH_PORT_RIGHT_SEND_ONCE
*/
routine mach_port_mod_refs(
task : ipc_space_t;
name : mach_port_name_t;
right : mach_port_right_t;
delta : mach_port_delta_t);
/*
* Peek at the message queue for the specified receive
* right and return info about the message with the
* sequence number matching the input. If zero is
* specified as the seqno, the first message in the
* queue will be peeked.
*
* Only the following trailer types are currently supported:
* MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)
*
* or'ed with one of these element types:
* MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_NULL)
* MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SEQNO)
* MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER)
* MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_AUDIT)
*/
routine mach_port_peek(
task : ipc_space_t;
name : mach_port_name_t;
trailer_type : mach_msg_trailer_type_t;
inout request_seqnop : mach_port_seqno_t;
out msg_sizep : mach_msg_size_t;
out msg_idp : mach_msg_id_t;
out trailer_infop : mach_msg_trailer_info_t, CountInOut);
/*
* Only valid for receive rights.
* Sets the make-send count for the port.
*/
routine mach_port_set_mscount(
task : ipc_space_t;
name : mach_port_name_t;
mscount : mach_port_mscount_t);
/*
* Only valid for port sets. Returns a list of
* the members.
*/
routine mach_port_get_set_status(
task : ipc_space_inspect_t;
name : mach_port_name_t;
out members : mach_port_name_array_t);
/*
* Puts the member port (the task must have receive rights)
* into the after port set. If the port is already a member
* of any set(s), it is atomically removed from those sets as
* part of this operation. (If after is MACH_PORT_NULL, the
* port is still removed from all current sets).
*/
routine mach_port_move_member(
task : ipc_space_t;
member : mach_port_name_t;
after : mach_port_name_t);
/*
* Requests a notification from the kernel. The request
* must supply the send-once right which is used for
* the notification. If a send-once right was previously
* registered, it is returned. The msgid must be one of:
* MACH_NOTIFY_PORT_DESTROYED (receive rights)
* MACH_NOTIFY_DEAD_NAME (send/receive/send-once rights)
* MACH_NOTIFY_SEND_POSSIBLE (send/receive/send-once rights)
* MACH_NOTIFY_NO_SENDERS (receive rights)
*
* The sync value specifies whether a notification should
* get sent immediately, if appropriate. The exact meaning
* depends on the notification:
* MACH_NOTIFY_PORT_DESTROYED: must be zero.
* MACH_NOTIFY_DEAD_NAME: if non-zero, then name can be dead,
* and the notification gets sent immediately.
* If zero, then name can't be dead.
* MACH_NOTIFY_SEND_POSSIBLE: if non-zero, will generate a send-
* possible notification as soon as it is possible to send
* to the port. If zero, will generate a send-possible
* notification only after a subsequent failed send
* (with MACH_SEND_NOTIFY option to mach_msg call). Can
* generate a dead-name notification if name is already dead
* or becomes dead before a send-possible notification fires.
* MACH_NOTIFY_NO_SENDERS: the notification gets sent
* immediately if the current mscount is greater
* than or equal to the sync value and there are no
* extant send rights.
*
* If the name is deleted before a successfully registered notification
* is delivered, it is replaced with a port-deleted notification.
*/
routine mach_port_request_notification(
task : ipc_space_t;
name : mach_port_name_t;
msgid : mach_msg_id_t;
sync : mach_port_mscount_t;
notify : mach_port_send_once_t;
out previous : mach_port_move_send_once_t);
/*
* Inserts the specified rights into the target task,
* using the specified name. If inserting send/receive
* rights and the task already has send/receive rights
* for the port, then the names must agree. In any case,
* the task gains a user ref for the port.
*/
routine mach_port_insert_right(
task : ipc_space_t;
name : mach_port_name_t;
poly : mach_port_poly_t);
/*
* Returns the specified right for the named port
* in the target task, extracting that right from
* the target task. The target task loses a user
* ref and the name may be available for recycling.
* msgt_name must be one of
* MACH_MSG_TYPE_MOVE_RECEIVE
* MACH_MSG_TYPE_COPY_SEND
* MACH_MSG_TYPE_MAKE_SEND
* MACH_MSG_TYPE_MOVE_SEND
* MACH_MSG_TYPE_MAKE_SEND_ONCE
* MACH_MSG_TYPE_MOVE_SEND_ONCE
*/
routine mach_port_extract_right(
task : ipc_space_t;
name : mach_port_name_t;
msgt_name : mach_msg_type_name_t;
out poly : mach_port_poly_t);
/*
* Only valid for receive rights.
* Sets the sequence number for the port.
*/
routine mach_port_set_seqno(
task : ipc_space_t;
name : mach_port_name_t;
seqno : mach_port_seqno_t);
/*
* Returns information about a port.
*/
routine mach_port_get_attributes(
task : ipc_space_inspect_t;
name : mach_port_name_t;
flavor : mach_port_flavor_t;
out port_info_out : mach_port_info_t, CountInOut);
/*
* Set attributes of a port
*/
routine mach_port_set_attributes(
task : ipc_space_t;
name : mach_port_name_t;
flavor : mach_port_flavor_t;
port_info : mach_port_info_t);
/*
* Allocates the specified kind of object, qos version.
* The right must be
* MACH_PORT_RIGHT_RECEIVE
* Like port_allocate_name, but the kernel picks a name.
* It can use any name not associated with a right.
*/
routine mach_port_allocate_qos(
task : ipc_space_t;
right : mach_port_right_t;
inout qos : mach_port_qos_t;
out name : mach_port_name_t);
/*
* Generic interface to allocation various kinds of ports.
* Should never be called directly by users (at least not
* unless they are exceedingly masochistic).
*/
routine mach_port_allocate_full(
task : ipc_space_t;
right : mach_port_right_t;
proto : mach_port_t;
inout qos : mach_port_qos_t;
inout name : mach_port_name_t);
/*
* Pre-expand task port name space.
*/
routine task_set_port_space(
task : ipc_space_t;
table_entries : int);
/*
* Returns the exact number of extant send rights
* for the given receive right.
* This call is only valid on MACH_IPC_DEBUG kernels.
* Otherwise, KERN_FAILURE is returned.
*/
routine mach_port_get_srights(
task : ipc_space_t;
name : mach_port_name_t;
out srights : mach_port_rights_t);
/*
* Returns information about an IPC space.
* This call is only valid on MACH_IPC_DEBUG kernels.
* Otherwise, KERN_FAILURE is returned.
*/
routine mach_port_space_info(
task : ipc_space_inspect_t;
out space_info : ipc_info_space_t;
out table_info : ipc_info_name_array_t;
out tree_info : ipc_info_tree_name_array_t);
/*
* Returns information about the dead-name requests
* registered with the named receive right.
* This call is only valid on MACH_IPC_DEBUG kernels.
* Otherwise, KERN_FAILURE is returned.
*/
routine mach_port_dnrequest_info(
task : ipc_space_t;
name : mach_port_name_t;
out dnr_total : unsigned; /* total size of table */
out dnr_used : unsigned); /* amount used */
/*
* Return the type and address of the kernel object
* that the given send/receive right represents.
* This call is only valid on MACH_IPC_DEBUG kernels.
* Otherwise, KERN_FAILURE is returned.
*
* This interface is DEPRECATED in favor of the new
* mach_port_kernel_object64() call (see below).
*/
routine mach_port_kernel_object(
task : ipc_space_inspect_t;
name : mach_port_name_t;
out object_type : unsigned;
out object_addr : unsigned);
/*
* Inserts the specified rights into the portset identified
* by the <task, pset> pair. The results of passing in the
* Poly argument via the supplied disposition must yield a
* receive right.
*
* If the <task,pset> pair does not represent a valid portset
* KERN_INVALID_RIGHT is returned.
*
* If the passed in name argument does not represent a receive
* right, KERN_INVALID_CAPABILITY will be returned.
*
* If the port represented by the receive right is already in
* the portset, KERN_ALREADY_IN_SET is returned.
*/
routine mach_port_insert_member(
task : ipc_space_t;
name : mach_port_name_t;
pset : mach_port_name_t);
/*
* Extracts the specified right from the named portset
* in the target task.
* the target task. The target task loses a user
* ref and the name may be available for recycling.
* msgt_name must be one of
* MACH_MSG_TYPE_MOVE_RECEIVE
* MACH_MSG_TYPE_COPY_SEND
* MACH_MSG_TYPE_MAKE_SEND
* MACH_MSG_TYPE_MOVE_SEND
* MACH_MSG_TYPE_MAKE_SEND_ONCE
* MACH_MSG_TYPE_MOVE_SEND_ONCE
*/
routine mach_port_extract_member(
task : ipc_space_t;
name : mach_port_name_t;
pset : mach_port_name_t);
/*
* Only valid for receive rights.
* Gets the context pointer for the port.
*/
routine mach_port_get_context(
task : ipc_space_inspect_t;
name : mach_port_name_t;
#ifdef LIBSYSCALL_INTERFACE
out context : mach_port_context_t
#else
out context : mach_vm_address_t
#endif
);
/*
* Only valid for receive rights.
* Sets the context pointer for the port.
*/
routine mach_port_set_context(
task : ipc_space_t;
name : mach_port_name_t;
#ifdef LIBSYSCALL_INTERFACE
context : mach_port_context_t
#else
context : mach_vm_address_t
#endif
);
/*
* Return the type and address of the kernel object
* that the given send/receive right represents.
* This call is only valid on MACH_IPC_DEBUG kernels.
* Otherwise, KERN_FAILURE is returned.
*/
routine mach_port_kobject(
task : ipc_space_inspect_t;
name : mach_port_name_t;
out object_type : natural_t;
out object_addr : mach_vm_address_t);
/*
* Constructs a right based on the options passed
* in. Also allows guarding the port as one of the
* options if the requested right is a receive
* right.
*/
routine mach_port_construct(
task : ipc_space_t;
options : mach_port_options_ptr_t;
#ifdef LIBSYSCALL_INTERFACE
context : mach_port_context_t;
#else
context : uint64_t;
#endif
out name : mach_port_name_t);
/*
* Destroys a mach port using the guard provided
* for guarded ports. Also reduces the user ref
* count for send rights as specified by srdelta.
*/
routine mach_port_destruct(
task : ipc_space_t;
name : mach_port_name_t;
srdelta : mach_port_delta_t;
#ifdef LIBSYSCALL_INTERFACE
guard : mach_port_context_t
#else
guard : uint64_t
#endif
);
/*
* Guard an already existing port. Allows guarding
* receive rights only. Uses the context field in the
* port structure to store the guard.
*/
routine mach_port_guard(
task : ipc_space_t;
name : mach_port_name_t;
#ifdef LIBSYSCALL_INTERFACE
guard : mach_port_context_t;
#else
guard : uint64_t;
#endif
strict : boolean_t);
/*
* Unguard a port guarded previously. For unguarded ports
* or incorrect guards passed in it raises an exception
* indicating guarding misbehavior.
*/
routine mach_port_unguard(
task : ipc_space_t;
name : mach_port_name_t;
#ifdef LIBSYSCALL_INTERFACE
guard : mach_port_context_t
#else
guard : uint64_t
#endif
);
/*
* Returns basic information about an IPC space.
* This call is only valid on MACH_IPC_DEBUG kernels.
* Otherwise, KERN_FAILURE is returned.
*/
routine mach_port_space_basic_info(
task : ipc_space_inspect_t;
out basic_info : ipc_info_space_basic_t);
#if KERNEL || !LIBSYSCALL_INTERFACE
/*
* Returns sync ipc turnstile link status
* for special reply ports.
*/
routine mach_port_special_reply_port_reset_link(
task : ipc_space_t;
name : mach_port_name_t;
out srp_lost_link : boolean_t);
#else
skip;
#endif
/*
* Guard an already existing port. Allows guarding
* receive rights only. Uses the context field in the
* port structure to store the guard.
*/
routine mach_port_guard_with_flags(
task : ipc_space_t;
name : mach_port_name_t;
#ifdef LIBSYSCALL_INTERFACE
guard : mach_port_context_t;
#else
guard : uint64_t;
#endif
flags : uint64_t);
/*
* Swap guard value of an existing guarded port. Works
* only if it is not a strict guard.
*/
routine mach_port_swap_guard(
task : ipc_space_t;
name : mach_port_name_t;
#ifdef LIBSYSCALL_INTERFACE
old_guard : mach_port_context_t;
#else
old_guard : uint64_t;
#endif
#ifdef LIBSYSCALL_INTERFACE
new_guard : mach_port_context_t);
#else
new_guard : uint64_t);
#endif
/*
* Return the type and address of the kernel object
* that the given send/receive right represents.
* This call is only valid on MACH_IPC_DEBUG kernels.
* Otherwise, KERN_FAILURE is returned.
*/
routine mach_port_kobject_description(
task : ipc_space_inspect_t;
name : mach_port_name_t;
out object_type : natural_t;
out object_addr : mach_vm_address_t;
out description : kobject_description_t);
/* vim: set ft=c : */

View file

@ -1,37 +0,0 @@
/*
* Copyright (c) 2018 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef __MACH_RIGHT_H
#define __MACH_RIGHT_H
#include <sys/cdefs.h>
#if __has_include(<mach/mach_right_private.h>)
#include <mach/mach_right_private.h>
#endif
#endif // __MACH_RIGHT_H

View file

@ -1,37 +0,0 @@
/*
* Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
#ifndef _MACH_MACH_SYSCALLS_H_
#define _MACH_MACH_SYSCALLS_H_
#include <mach/mach_traps.h>
#endif /* _MACH_MACH_SYSCALLS_H_ */

View file

@ -1,73 +0,0 @@
/*
* Copyright (c) 2001-2005 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef _MACH_MACH_TIME_H_
#define _MACH_MACH_TIME_H_
#include <mach/mach_types.h>
#include <sys/cdefs.h>
#include <Availability.h>
struct mach_timebase_info {
uint32_t numer;
uint32_t denom;
};
typedef struct mach_timebase_info *mach_timebase_info_t;
typedef struct mach_timebase_info mach_timebase_info_data_t;
__BEGIN_DECLS
kern_return_t mach_timebase_info(
mach_timebase_info_t info);
kern_return_t mach_wait_until(
uint64_t deadline);
uint64_t mach_absolute_time(void);
__OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0)
uint64_t mach_approximate_time(void);
/*
* like mach_absolute_time, but advances during sleep
*/
__OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0)
uint64_t mach_continuous_time(void);
/*
* like mach_approximate_time, but advances during sleep
*/
__OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0)
uint64_t mach_continuous_approximate_time(void);
__END_DECLS
#endif /* _MACH_MACH_TIME_H_ */

View file

@ -1,303 +0,0 @@
/*
* Copyright (c) 2000-2019 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
/*
* Mach Operating System
* Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
*/
/*
* Definitions of general Mach system traps.
*
* These are the definitions as seen from user-space.
* The kernel definitions are in <mach/syscall_sw.h>.
* Kernel RPC functions are defined in <mach/mach_interface.h>.
*/
#ifndef _MACH_MACH_TRAPS_H_
#define _MACH_MACH_TRAPS_H_
#include <stdint.h>
#include <mach/std_types.h>
#include <mach/mach_types.h>
#include <mach/kern_return.h>
#include <mach/port.h>
#include <mach/vm_types.h>
#include <mach/clock_types.h>
#include <machine/endian.h>
#include <sys/cdefs.h>
__BEGIN_DECLS
extern kern_return_t clock_sleep_trap(
mach_port_name_t clock_name,
sleep_type_t sleep_type,
int sleep_sec,
int sleep_nsec,
mach_timespec_t *wakeup_time);
extern kern_return_t _kernelrpc_mach_vm_allocate_trap(
mach_port_name_t target,
mach_vm_offset_t *addr,
mach_vm_size_t size,
int flags);
extern kern_return_t _kernelrpc_mach_vm_deallocate_trap(
mach_port_name_t target,
mach_vm_address_t address,
mach_vm_size_t size
);
extern kern_return_t _kernelrpc_mach_vm_protect_trap(
mach_port_name_t target,
mach_vm_address_t address,
mach_vm_size_t size,
boolean_t set_maximum,
vm_prot_t new_protection
);
extern kern_return_t _kernelrpc_mach_vm_map_trap(
mach_port_name_t target,
mach_vm_offset_t *address,
mach_vm_size_t size,
mach_vm_offset_t mask,
int flags,
vm_prot_t cur_protection
);
extern kern_return_t _kernelrpc_mach_vm_purgable_control_trap(
mach_port_name_t target,
mach_vm_offset_t address,
vm_purgable_t control,
int *state);
extern kern_return_t _kernelrpc_mach_port_allocate_trap(
mach_port_name_t target,
mach_port_right_t right,
mach_port_name_t *name
);
extern kern_return_t _kernelrpc_mach_port_destroy_trap(
mach_port_name_t target,
mach_port_name_t name
);
extern kern_return_t _kernelrpc_mach_port_deallocate_trap(
mach_port_name_t target,
mach_port_name_t name
);
extern kern_return_t _kernelrpc_mach_port_mod_refs_trap(
mach_port_name_t target,
mach_port_name_t name,
mach_port_right_t right,
mach_port_delta_t delta
);
extern kern_return_t _kernelrpc_mach_port_move_member_trap(
mach_port_name_t target,
mach_port_name_t member,
mach_port_name_t after
);
extern kern_return_t _kernelrpc_mach_port_insert_right_trap(
mach_port_name_t target,
mach_port_name_t name,
mach_port_name_t poly,
mach_msg_type_name_t polyPoly
);
extern kern_return_t _kernelrpc_mach_port_get_attributes_trap(
mach_port_name_t target,
mach_port_name_t name,
mach_port_flavor_t flavor,
mach_port_info_t port_info_out,
mach_msg_type_number_t *port_info_outCnt
);
extern kern_return_t _kernelrpc_mach_port_insert_member_trap(
mach_port_name_t target,
mach_port_name_t name,
mach_port_name_t pset
);
extern kern_return_t _kernelrpc_mach_port_extract_member_trap(
mach_port_name_t target,
mach_port_name_t name,
mach_port_name_t pset
);
extern kern_return_t _kernelrpc_mach_port_construct_trap(
mach_port_name_t target,
mach_port_options_t *options,
uint64_t context,
mach_port_name_t *name
);
extern kern_return_t _kernelrpc_mach_port_destruct_trap(
mach_port_name_t target,
mach_port_name_t name,
mach_port_delta_t srdelta,
uint64_t guard
);
extern kern_return_t _kernelrpc_mach_port_guard_trap(
mach_port_name_t target,
mach_port_name_t name,
uint64_t guard,
boolean_t strict
);
extern kern_return_t _kernelrpc_mach_port_unguard_trap(
mach_port_name_t target,
mach_port_name_t name,
uint64_t guard
);
extern kern_return_t mach_generate_activity_id(
mach_port_name_t target,
int count,
uint64_t *activity_id
);
extern kern_return_t macx_swapon(
uint64_t filename,
int flags,
int size,
int priority);
extern kern_return_t macx_swapoff(
uint64_t filename,
int flags);
extern kern_return_t macx_triggers(
int hi_water,
int low_water,
int flags,
mach_port_t alert_port);
extern kern_return_t macx_backing_store_suspend(
boolean_t suspend);
extern kern_return_t macx_backing_store_recovery(
int pid);
extern boolean_t swtch_pri(int pri);
extern boolean_t swtch(void);
extern kern_return_t thread_switch(
mach_port_name_t thread_name,
int option,
mach_msg_timeout_t option_time);
extern mach_port_name_t task_self_trap(void);
extern kern_return_t host_create_mach_voucher_trap(
mach_port_name_t host,
mach_voucher_attr_raw_recipe_array_t recipes,
int recipes_size,
mach_port_name_t *voucher);
extern kern_return_t mach_voucher_extract_attr_recipe_trap(
mach_port_name_t voucher_name,
mach_voucher_attr_key_t key,
mach_voucher_attr_raw_recipe_t recipe,
mach_msg_type_number_t *recipe_size);
extern kern_return_t _kernelrpc_mach_port_type_trap(
ipc_space_t task,
mach_port_name_t name,
mach_port_type_t *ptype);
extern kern_return_t _kernelrpc_mach_port_request_notification_trap(
ipc_space_t task,
mach_port_name_t name,
mach_msg_id_t msgid,
mach_port_mscount_t sync,
mach_port_name_t notify,
mach_msg_type_name_t notifyPoly,
mach_port_name_t *previous);
/*
* Obsolete interfaces.
*/
extern kern_return_t task_for_pid(
mach_port_name_t target_tport,
int pid,
mach_port_name_t *t);
extern kern_return_t task_name_for_pid(
mach_port_name_t target_tport,
int pid,
mach_port_name_t *tn);
extern kern_return_t pid_for_task(
mach_port_name_t t,
int *x);
extern kern_return_t debug_control_port_for_pid(
mach_port_name_t target_tport,
int pid,
mach_port_name_t *t);
__END_DECLS
#endif /* _MACH_MACH_TRAPS_H_ */

View file

@ -1,618 +0,0 @@
/*
* Copyright (c) 2000-2016 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
/*
* Mach Operating System
* Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
* NOTICE: This file was modified by McAfee Research in 2004 to introduce
* support for mandatory and extensible security protections. This notice
* is included in support of clause 2.2 (b) of the Apple Public License,
* Version 2.0.
*/
/*
*/
/*
* Mach kernel interface type declarations
*/
#ifndef _MACH_MACH_TYPES_DEFS_
#define _MACH_MACH_TYPES_DEFS_
#include <mach/std_types.defs>
type memory_object_offset_t = uint64_t;
type memory_object_size_t = uint64_t;
type memory_object_cluster_size_t = uint32_t;
type memory_object_fault_info_t = array[16] of integer_t;
type mach_port_status_t = struct[10] of integer_t; /* obsolete */
type mach_port_info_ext_t = struct[17] of integer_t;
/* mach_port_info_t: can hold either a
* mach_port_status_t (9 ints) or a
* mach_port_limits_t (1 int) or a
* mach_port_info_ext_t (17 ints). If new flavors of
* mach_port_{get,set}_attributes are added, the size of
* this array may have to be increased. (See mach/port.h)
*/
type mach_port_flavor_t = int;
type mach_port_info_t = array[*:17] of integer_t;
/*
* mach_msg_max_trailer_t: can hold
* mach_msg_trailer_type_t (1 int)
* mach_msg_trailer_size_t (1 int)
* mach_port_seqno_t (1 int)
* security_token_t (2 ints)
* audit_token_t (8 ints)
* mach_port_context_t (2 ints)
* msgh_ad (1 int)
* msg_labels_t (1 int)
*/
type mach_msg_trailer_type_t = int;
type mach_msg_trailer_info_t = array[*:68] of char;
type task_t = mach_port_t
#if KERNEL_SERVER
intran: task_t convert_port_to_task(mach_port_t)
outtran: mach_port_t convert_task_to_port(task_t)
destructor: task_deallocate(task_t)
#endif /* KERNEL_SERVER */
;
type task_name_t = mach_port_t
#if KERNEL_SERVER
intran: task_name_t convert_port_to_task_name(mach_port_t)
outtran: mach_port_t convert_task_name_to_port(task_name_t)
destructor: task_name_deallocate(task_name_t)
#endif /* KERNEL_SERVER */
;
type task_inspect_t = mach_port_t
#if KERNEL_SERVER
intran: task_inspect_t convert_port_to_task_inspect(mach_port_t)
outtran: mach_port_t convert_task_inspect_to_port(task_inspect_t)
destructor: task_inspect_deallocate(task_inspect_t)
#endif /* KERNEL_SERVER */
;
type thread_t = mach_port_t
#if KERNEL_SERVER
intran: thread_t convert_port_to_thread(mach_port_t)
outtran: mach_port_t convert_thread_to_port(thread_t)
destructor: thread_deallocate(thread_t)
#endif /* KERNEL_SERVER */
;
type thread_inspect_t = mach_port_t
#if KERNEL_SERVER
intran: thread_inspect_t convert_port_to_thread_inspect(mach_port_t)
outtran: mach_port_t convert_thread_inspect_to_port(thread_inspect_t)
destructor: thread_inspect_deallocate(thread_inspect_t)
#endif /* KERNEL_SERVER */
;
type thread_act_t = mach_port_t
#if KERNEL_SERVER
intran: thread_act_t convert_port_to_thread(mach_port_t)
outtran: mach_port_t convert_thread_to_port(thread_act_t)
destructor: thread_deallocate(thread_act_t)
#endif /* KERNEL_SERVER */
;
type thread_act_consume_ref_t = mach_port_move_send_t
cusertype: thread_act_t
#if KERNEL_SERVER
intran: thread_act_t convert_port_to_thread(mach_port_t)
destructor: thread_deallocate(thread_act_t)
#endif /* KERNEL_SERVER */
;
type suid_cred_path_t = c_string[*:1024];
type suid_cred_uid_t = uint32_t;
type suid_cred_t = mach_port_t
#if KERNEL_SERVER
outtran: mach_port_t convert_suid_cred_to_port(suid_cred_t)
#endif /* KERNEL_SERVER */
;
/* thread_state_t: This inline array can hold
* a machine-dependent amount of data, defined in
* mach/machine/???? (currently THREAD_STATE_MAX,
* in mach/thread_state.h)
*/
#include <mach/machine/thread_state.h>
type thread_state_flavor_t = int;
type thread_state_t = array[*:THREAD_STATE_MAX] of natural_t;
type task_array_t = ^array[] of task_t;
type thread_array_t = ^array[] of thread_t;
type thread_act_array_t = ^array[] of thread_act_t;
type act_params_t = array[6] of int;
type vm_map_t = mach_port_t
#if KERNEL_SERVER
intran: vm_map_t convert_port_to_map(mach_port_t)
destructor: vm_map_deallocate(vm_map_t)
#endif /* KERNEL_SERVER */
;
type vm_task_entry_t = mach_port_t
cusertype: vm_map_t
#if KERNEL_SERVER
intran: vm_map_t convert_port_entry_to_map(mach_port_t)
destructor: vm_map_deallocate(vm_map_t)
#endif /* KERNEL_SERVER */
;
type ipc_space_t = mach_port_t
#if KERNEL_SERVER
intran: ipc_space_t convert_port_to_space(mach_port_t)
destructor: space_deallocate(ipc_space_t)
#endif /* KERNEL_SERVER */
;
type ipc_space_inspect_t = mach_port_t
#if KERNEL_SERVER
intran: ipc_space_inspect_t convert_port_to_space_inspect(mach_port_t)
destructor: space_inspect_deallocate(ipc_space_inspect_t)
#endif /* KERNEL_SERVER */
;
type arcade_register_t = mach_port_t
#if KERNEL_SERVER
intran: arcade_register_t convert_port_to_arcade_register(mach_port_t)
#endif /* KERNEL_SERVER */
;
type vm_prot_t = int;
type vm_inherit_t = int;
type vm_purgable_t = int;
type xxx_vm_statistics_data_t = struct[13] of integer_t;
type vm_behavior_t = int;
type vm_statistics_data_t = struct[15] of integer_t;
type vm_machine_attribute_t = int;
type vm_machine_attribute_val_t = int;
type vm_sync_t = int;
/* thread_info_t: this inline array can hold any of:
* thread_basic_info_t (10 ints)
* policy_timeshare_info_t (5 ints)
* policy_fifo_info_t (4 ints)
* policy_rr_info_t (5 ints)
* thread_extended_info (12 ints + 64 chars)
* if other thread_info flavors are added, this
* definition may need to be changed. (See
* mach/thread_info.h and mach/policy.h) */
type thread_flavor_t = int;
type thread_info_t = array[*:32] of integer_t;
type thread_policy_flavor_t = natural_t;
type thread_policy_t = array[*:16] of integer_t;
/* task_info_t: this inline array can hold any of:
* task_basic_info_32_t (8 ints)
* task_basic_info_64_t (10 ints)
* task_events_info_t (8 ints)
* task_thread_times_info_t (4 ints)
* policy_timeshare_info_t (5 ints)
* policy_fifo_info_t (4 ints)
* policy_rr_info_t (5 ints)
* task security token (2 ints)
* task audit token (8 ints)
* dyld info (2 64-bit ints and 1 int)
* task_extmod_info_t (8 64-bit ints)
* task_basic_info_64_2_t
* mach_task_basic_info_t (12 ints)
* task_power_info_t (18 ints)
* task_vm_info_t (87 ints)
* If other task_info flavors are added, this
* definition may need to be changed. (See
* mach/task_info.h and mach/policy.h) */
type task_flavor_t = int;
type task_info_t = array[*:87] of integer_t;
type task_purgable_info_t = struct[68] of integer_t;
type task_policy_flavor_t = natural_t;
type task_policy_t = array[*:16] of integer_t;
type task_inspect_flavor_t = natural_t;
type task_inspect_info_t = array[*:4] of integer_t;
type task_exc_guard_behavior_t = uint32_t;
type mem_entry_name_port_t = mach_port_t
#if KERNEL_SERVER
intran: mem_entry_name_port_t null_conversion(mach_port_t)
outtran: mach_port_t null_conversion(mem_entry_name_port_t)
#endif /* KERNEL_SERVER */
;
type mem_entry_name_port_move_send_t = mach_port_move_send_t
cusertype: mem_entry_name_port_t
#if KERNEL_SERVER
intran: mem_entry_name_port_t null_conversion(mach_port_t)
outtran: mach_port_t null_conversion(mem_entry_name_port_t)
#endif /* KERNEL_SERVER */
;
type memory_object_default_t = mach_port_t
;
type memory_object_t = mach_port_t
;
type memory_object_control_t = mach_port_t
;
type memory_object_name_t = mach_port_t
ctype: mach_port_t
;
type memory_object_copy_strategy_t = int;
type memory_object_return_t = int;
type machine_info_data_t = struct[5] of integer_t;
type machine_slot_data_t = struct[8] of integer_t;
type host_t = mach_port_t
#if KERNEL_SERVER
intran: host_t convert_port_to_host(mach_port_t)
outtran: mach_port_t convert_host_to_port(host_t)
#endif /* KERNEL_SERVER */
;
type host_priv_t = mach_port_t
#if KERNEL_SERVER
intran: host_priv_t convert_port_to_host_priv(mach_port_t)
#endif /* KERNEL_SERVER */
;
type host_security_t = mach_port_t
#if KERNEL_SERVER
intran: host_security_t convert_port_to_host_security(mach_port_t)
#endif /* KERNEL_SERVER */
;
/*
* host_info_t: variable-sized inline array that can contain:
*
* host_basic_info_old_t (5 ints)
* host_basic_info_t (12 ints)
* host_sched_info_t (2 ints)
* kernel_resource_sizes_t (5 ints)
* host_load_info_t (6 ints)
* vm_statistics32_t (15 ints)
* host_purgable_info_t (68 ints)
* host_expired_task_info uses a task_power_info (18 ints)
*
* If other host_info flavors are added, this definition may
* need to be changed. (See mach/{host_info,vm_statistics}.h)
*/
type host_flavor_t = int;
type host_info_t = array[*:68] of integer_t;
/*
* host_info64_t: variable-sized inline array that can contain:
*
* vm_statistics_t (6 ints and 9 longs)
* vm_extmod_statistics_t (6 64-bit ints)
*/
type host_info64_t = array[*:256] of integer_t;
type processor_t = mach_port_t
#if KERNEL_SERVER
intran: processor_t convert_port_to_processor(mach_port_t)
outtran: mach_port_t convert_processor_to_port(processor_t)
#endif /* KERNEL_SERVER */
;
type processor_array_t = ^array[] of processor_t;
/*
* processor_info_t: variable-sized inline array that can
* contain:
*
* - processor_basic_info_t: (5 ints)
* - processor_cpu_load_info_t: (4 ints)
* - processor_machine_info_t: (12 ints)
* - processor_cpu_stat_t: (10 ints)
* - processor_cpu_stat64_t: (20 ints)
*
* If other processor_info flavors are added, this definition
* may need to be changed.
*
* See mach/processor_info.h and mach/arm/processor_info.h.
*/
type processor_flavor_t = int;
type processor_info_t = array[*:20] of integer_t;
type processor_info_array_t = ^array[] of integer_t;
type processor_set_t = mach_port_t
#if KERNEL_SERVER
intran: processor_set_t convert_port_to_pset(mach_port_t)
outtran: mach_port_t convert_pset_to_port(processor_set_t)
destructor: pset_deallocate(processor_set_t)
#endif /* KERNEL_SERVER */
;
type processor_set_array_t = ^array[] of processor_set_t;
type processor_set_name_t = mach_port_t
#if KERNEL_SERVER
intran: processor_set_name_t convert_port_to_pset_name(mach_port_t)
outtran: mach_port_t convert_pset_name_to_port(processor_set_name_t)
destructor: pset_deallocate(processor_set_name_t)
#endif /* KERNEL_SERVER */
;
type processor_set_name_array_t = ^array[] of processor_set_name_t;
/* processor_set_info_t: variable-size inline array
* that can hold:
* processor_set_basic_info (5 ints)
* processor_set_load_info (4 ints)
* policy_timeshare_base_t (1 int)
* policy_fifo_base_t (1 int)
* policy_rr_base_t (1 int)
* policy_timeshare_base_t (1 int)
* policy_fifo_base_t (1 int)
* policy_rr_base_t (1 int)
* policy_t (1 int)
* If other flavors are added, this definition may
* need to be changed. (see mach/processor.h) */
type processor_set_flavor_t = int;
type processor_set_info_t = array[*:5] of integer_t;
type bootstrap_t = mach_port_t;
type kernel_version_t = c_string[*:512];
type kernel_boot_info_t = c_string[*:4096];
type time_value_t = struct[2] of integer_t;
type mach_port_qos_t = struct[2] of integer_t;
type mach_port_options_t = struct[3] of uint64_t;
type mach_port_options_ptr_t = ^ mach_port_options_t;
type emulation_vector_t = ^array[] of vm_offset_t;
type inline_existence_map_t = array[*:512] of char;
type policy_t = int;
/* policy_info_t: variable-size inline array. Can hold:
* policy_timeshare_info_t (5 ints)
* policy_fifo_info_t (4 ints)
* policy_rr_info_t (5 ints) */
type policy_base_t = array[*:5] of integer_t;
type policy_info_t = array[*:2] of integer_t;
type policy_limit_t = array[*:1] of integer_t;
type ledger_t = mach_port_t
#if KERNEL_SERVER
intran: ledger_t convert_port_to_ledger(mach_port_t)
outtran: mach_port_t convert_ledger_to_port(ledger_t)
#endif /* KERNEL_SERVER */
;
type ledger_array_t = ^array[] of ledger_t;
type ledger_item_t = integer_t;
/* DEPRECATED */
type ledger_amount_t = int64_t;
type security_token_t = struct[2] of uint32_t;
type audit_token_t = struct[8] of uint32_t;
type msg_labels_t = mach_port_t;
/* memory_object_info_t: variable-size inline array:
* memory_object_attr_info_t (5 ints)
* XXX actually it's 6 ints temporarily (object_ready!)
* memory_object_behave_info_t (4 ints)
* memory_object_perf_info_t (2 ints)
* old_memory_object_attr_info_t (3 ints)
* If other flavors are added, this definition may
* need to be changed. (see mach/memory_object.h) */
type memory_object_flavor_t = int;
type memory_object_info_t = array[*:6] of int;
/* vm_region_info_t: variable-size inline array that can hold:
* vm_region_basic_info_t (8 ints)
* If other flavors are added, this definition may
* need to be changed. (see mach/vm_region.h) */
type vm_region_flavor_t = int;
type vm_region_info_t = array[*:10] of int;
type vm_region_recurse_info_t = array[*:19] of int;
type vm_page_info_flavor_t = int;
type vm_page_info_t = array[*:32] of int;
type mach_vm_read_entry_t = array[512] of mach_vm_offset_t;
type vm_read_entry_t = array[512] of vm_offset_t;
#ifdef VM32_SUPPORT
type vm32_read_entry_t = array[512] of vm32_offset_t;
#endif
type exception_mask_t = int;
type exception_behavior_t = int;
type exception_handler_t = mach_port_t;
type exception_handler_array_t =
array[*:32] of exception_handler_t;
type exception_behavior_array_t =
array[*:32] of exception_behavior_t;
type exception_flavor_array_t =
array[*:32] of thread_state_flavor_t;
type exception_mask_array_t =
array[*:32] of exception_mask_t;
type semaphore_t = mach_port_t
#if KERNEL_SERVER
intran: semaphore_t convert_port_to_semaphore(mach_port_t)
outtran: mach_port_t convert_semaphore_to_port(semaphore_t)
destructor: semaphore_dereference(semaphore_t)
#endif /* KERNEL_SERVER */
;
type semaphore_consume_ref_t = mach_port_move_send_t
cusertype: semaphore_t
#if KERNEL_SERVER
intran: semaphore_t convert_port_to_semaphore(mach_port_t)
outtran: mach_port_t convert_semaphore_to_port(semaphore_t)
#endif /* KERNEL_SERVER */
;
type lock_set_t = mach_port_t
#if KERNEL_SERVER
intran: lock_set_t convert_port_to_lock_set(mach_port_t)
outtran: mach_port_t convert_lock_set_to_port(lock_set_t)
destructor: lock_set_dereference(lock_set_t)
#endif /* KERNEL_SERVER */
;
type task_suspension_token_t = mach_port_move_send_once_t
#if KERNEL_SERVER
intran: task_suspension_token_t convert_port_to_task_suspension_token(mach_port_t)
outtran: mach_port_t convert_task_suspension_token_to_port(task_suspension_token_t)
#endif /* KERNEL_SERVER */
;
type vfs_path_t = c_string[4096];
type nspace_path_t = c_string[1024]; /* 1024 == PATH_MAX */
/* public voucher types */
/* Mach voucher object */
type mach_voucher_t = mach_port_t;
type mach_voucher_name_t = mach_port_name_t;
type mach_voucher_attr_manager_t = mach_port_t;
type mach_voucher_attr_control_t = mach_port_t;
/* IPC voucher internal object */
type ipc_voucher_t = mach_port_t
#if KERNEL_SERVER
intran: ipc_voucher_t convert_port_to_voucher(mach_port_t)
outtran: mach_port_t convert_voucher_to_port(ipc_voucher_t)
destructor: ipc_voucher_release(ipc_voucher_t)
#endif /* KERNEL_SERVER */
;
/* IPC voucher attribute control internal object */
type ipc_voucher_attr_control_t = mach_port_t
#if KERNEL_SERVER
intran: ipc_voucher_attr_control_t convert_port_to_voucher_attr_control(mach_port_t)
outtran: mach_port_t convert_voucher_attr_control_to_port(ipc_voucher_attr_control_t)
destructor: ipc_voucher_attr_control_release(ipc_voucher_attr_control_t)
#endif /* KERNEL_SERVER */
;
type mach_voucher_attr_key_t = uint32_t;
type mach_voucher_attr_command_t = uint32_t;
type mach_voucher_attr_recipe_command_t = uint32_t;
type mach_voucher_attr_content_size_t = uint32_t;
type mach_voucher_attr_content_t = array[*:4096] of uint8_t;
type mach_voucher_attr_content_array_t = array[*:5120] of uint8_t;
type mach_voucher_attr_raw_recipe_size_t = uint32_t;
type mach_voucher_attr_raw_recipe_t = array[*:4096] of uint8_t;
type mach_voucher_attr_raw_recipe_array_t = array[*:5120] of uint8_t;
type mach_voucher_selector_t = uint32_t;
type mach_voucher_attr_value_handle_t = uint64_t;
type mach_voucher_attr_value_handle_array_t = array[*:4] of mach_voucher_attr_value_handle_t;
type mach_voucher_attr_value_reference_t = uint32_t;
/* kernel module loader */
type kmod_t = int;
type kmod_control_flavor_t = int;
type kmod_args_t = ^array[] of MACH_MSG_TYPE_BYTE
ctype: kmod_args_t;
type io_master_t = mach_port_t;
type UNDServerRef = mach_port_t;
/* These must be kept in sync with definitions in osfmk/mach/dyld_kernel.h */
type dyld_kernel_image_info_t = struct[40] of MACH_MSG_TYPE_BYTE;
type dyld_kernel_image_info_array_t = ^array[] of dyld_kernel_image_info_t;
type dyld_kernel_process_info_t = struct[64] of MACH_MSG_TYPE_BYTE;
#if KERNEL_SERVER
simport <kern/ipc_mig.h>; /* pick up kernel-specific MIG things */
simport <kern/suid_cred.h>;
#endif /* KERNEL_SERVER */
import <mach/mig.h>;
import <mach/mach_types.h>;
#endif /* _MACH_MACH_TYPES_DEFS_ */
/* vim: set ft=c : */

Some files were not shown because too many files have changed in this diff Show more