Bug 2068219 - Import minidump-writer Isolated Processes Parts 10-15.5 r=supply-chain-reviewers,firefox-build-system-reviewers,gsvelto,afranchuk,sylvestre,ahochheiden
Differential Revision: https://phabricator.services.mozilla.com/D322715
This commit is contained in:
committed by
cmartin@mozilla.com
parent
4204e30a2b
commit
1dcfd37094
@@ -124,9 +124,9 @@ replace-with = "vendored-sources"
|
||||
git = "https://github.com/mozilla/nss-rs"
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
[source."git+https://github.com/rust-minidump/minidump-writer.git?rev=ee5b9d59d85bea1d4c6845f6b854e04fe204adf2"]
|
||||
[source."git+https://github.com/rust-minidump/minidump-writer.git?rev=6744feee58804a78730d176cdcc31bb4f3021107"]
|
||||
git = "https://github.com/rust-minidump/minidump-writer.git"
|
||||
rev = "ee5b9d59d85bea1d4c6845f6b854e04fe204adf2"
|
||||
rev = "6744feee58804a78730d176cdcc31bb4f3021107"
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
[source."git+https://github.com/servo/rust-cssparser?rev=ddccc070a0261cb94195ed0f74095c67b86a8550"]
|
||||
|
||||
Generated
+24
-21
@@ -358,7 +358,7 @@ dependencies = [
|
||||
"dbus",
|
||||
"libc",
|
||||
"log",
|
||||
"mach2",
|
||||
"mach2 0.4.999",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
@@ -1314,13 +1314,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "crash-context"
|
||||
version = "0.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b85cef661eeca0c6675116310936972c520ebb0a33ddef16fd7efc957f4c1288"
|
||||
version = "0.8.0"
|
||||
source = "git+https://github.com/rust-minidump/minidump-writer.git?rev=6744feee58804a78730d176cdcc31bb4f3021107#6744feee58804a78730d176cdcc31bb4f3021107"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"mach2",
|
||||
"mach2 0.6.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1329,7 +1328,7 @@ version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"crash_helper_common",
|
||||
"mach2",
|
||||
"mach2 0.6.0",
|
||||
"minidump-writer",
|
||||
"nix",
|
||||
"num-derive",
|
||||
@@ -1346,7 +1345,7 @@ dependencies = [
|
||||
"getrandom 0.3.3",
|
||||
"linked-hash-map",
|
||||
"log",
|
||||
"mach2",
|
||||
"mach2 0.6.0",
|
||||
"minidump-writer",
|
||||
"mozannotation_server",
|
||||
"mozbuild",
|
||||
@@ -1620,7 +1619,7 @@ dependencies = [
|
||||
"cubeb-backend",
|
||||
"float-cmp",
|
||||
"libc",
|
||||
"mach2",
|
||||
"mach2 0.4.999",
|
||||
"num",
|
||||
"ringbuf",
|
||||
"triple_buffer",
|
||||
@@ -4537,13 +4536,17 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "mach2"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6d0d1830bcd151a6fc4aea1369af235b36c1528fe976b8ff678683c9995eade8"
|
||||
version = "0.4.999"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"mach2 0.6.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mach2"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dae608c151f68243f2b000364e1f7b186d9c29845f7d2d85bd31b9ad77ad552b"
|
||||
|
||||
[[package]]
|
||||
name = "macho-unwind-info"
|
||||
version = "0.5.0"
|
||||
@@ -4867,8 +4870,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "minidump-writer"
|
||||
version = "0.12.0"
|
||||
source = "git+https://github.com/rust-minidump/minidump-writer.git?rev=ee5b9d59d85bea1d4c6845f6b854e04fe204adf2#ee5b9d59d85bea1d4c6845f6b854e04fe204adf2"
|
||||
version = "0.13.0"
|
||||
source = "git+https://github.com/rust-minidump/minidump-writer.git?rev=6744feee58804a78730d176cdcc31bb4f3021107#6744feee58804a78730d176cdcc31bb4f3021107"
|
||||
dependencies = [
|
||||
"bitflags 2.10.0",
|
||||
"byteorder",
|
||||
@@ -4879,9 +4882,10 @@ dependencies = [
|
||||
"goblin 0.9.2",
|
||||
"libc",
|
||||
"log",
|
||||
"mach2",
|
||||
"mach2 0.6.0",
|
||||
"memmap2",
|
||||
"minidump-common",
|
||||
"plain",
|
||||
"process-backend",
|
||||
"procfs-core 0.18.0",
|
||||
"scroll",
|
||||
@@ -6490,11 +6494,10 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "process-backend"
|
||||
version = "0.0.0"
|
||||
source = "git+https://github.com/rust-minidump/minidump-writer.git?rev=ee5b9d59d85bea1d4c6845f6b854e04fe204adf2#ee5b9d59d85bea1d4c6845f6b854e04fe204adf2"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/rust-minidump/minidump-writer.git?rev=6744feee58804a78730d176cdcc31bb4f3021107#6744feee58804a78730d176cdcc31bb4f3021107"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"log",
|
||||
"process-reader",
|
||||
"serde",
|
||||
"thiserror 2.0.12",
|
||||
@@ -6502,8 +6505,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "process-reader"
|
||||
version = "0.0.0"
|
||||
source = "git+https://github.com/rust-minidump/minidump-writer.git?rev=ee5b9d59d85bea1d4c6845f6b854e04fe204adf2#ee5b9d59d85bea1d4c6845f6b854e04fe204adf2"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/rust-minidump/minidump-writer.git?rev=6744feee58804a78730d176cdcc31bb4f3021107#6744feee58804a78730d176cdcc31bb4f3021107"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"serde",
|
||||
@@ -6516,7 +6519,7 @@ dependencies = [
|
||||
"goblin 0.9.2",
|
||||
"libc",
|
||||
"log",
|
||||
"mach2",
|
||||
"mach2 0.6.0",
|
||||
"memoffset 0.9.0",
|
||||
"mozilla-central-workspace-hack",
|
||||
"scroll",
|
||||
|
||||
@@ -439,3 +439,6 @@ jxl_simd = { path = "third_party/rust/jxl_simd" }
|
||||
gleam = { git = "https://github.com/jamienicol/gleam", rev = "68ca4e5cc31135b843af07ff213a94b9ddce64cf" }
|
||||
# gl_generator 0.14.0 + https://github.com/rust-windowing/gl-rs/pull/566
|
||||
gl_generator = { git = "https://github.com/jamienicol/gl-rs", rev = "71c792dbfe0ec5caeb242fc90937e19098386342" }
|
||||
|
||||
# Implement mach2 0.4 in terms of 0.6
|
||||
mach2 = { path = "build/rust/mach2" }
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
[package]
|
||||
name = "mach2"
|
||||
version = "0.4.999"
|
||||
edition = "2024"
|
||||
license = "Mozilla Public License 2.0"
|
||||
|
||||
[lib]
|
||||
path = "lib.rs"
|
||||
|
||||
[dependencies]
|
||||
mach2 = "0.6.0"
|
||||
@@ -0,0 +1,5 @@
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
pub use mach2::*;
|
||||
@@ -17,7 +17,7 @@ who = "John M. Schanck <jschanck@mozilla.com>"
|
||||
criteria = "safe-to-deploy"
|
||||
user-id = 175410 # John Schanck (jschanck)
|
||||
start = "2022-11-15"
|
||||
end = "2026-09-25"
|
||||
end = "2027-09-01"
|
||||
notes = "Maintained by the CryptoEng team at Mozilla."
|
||||
|
||||
[[wildcard-audits.bhttp]]
|
||||
@@ -33,7 +33,7 @@ who = "Alex Franchuk <afranchuk@mozilla.com>"
|
||||
criteria = "safe-to-deploy"
|
||||
user-id = 72814 # Gabriele Svelto (gabrielesvelto)
|
||||
start = "2022-11-30"
|
||||
end = "2026-02-01"
|
||||
end = "2027-09-01"
|
||||
notes = "This crate is written and maintained by mozilla employees."
|
||||
|
||||
[[wildcard-audits.cachemap2]]
|
||||
@@ -366,7 +366,7 @@ who = "Alex Franchuk <afranchuk@mozilla.com>"
|
||||
criteria = "safe-to-deploy"
|
||||
user-id = 72814 # Gabriele Svelto (gabrielesvelto)
|
||||
start = "2022-11-30"
|
||||
end = "2026-02-01"
|
||||
end = "2027-09-01"
|
||||
notes = "This crate is written and maintained by mozilla employees."
|
||||
|
||||
[[wildcard-audits.minidump-common]]
|
||||
@@ -374,7 +374,7 @@ who = "Alex Franchuk <afranchuk@mozilla.com>"
|
||||
criteria = "safe-to-deploy"
|
||||
user-id = 72814 # Gabriele Svelto (gabrielesvelto)
|
||||
start = "2022-11-30"
|
||||
end = "2026-02-01"
|
||||
end = "2027-09-01"
|
||||
notes = "This crate is written and maintained by mozilla employees."
|
||||
|
||||
[[wildcard-audits.minidump-unwind]]
|
||||
@@ -382,7 +382,7 @@ who = "Alex Franchuk <afranchuk@mozilla.com>"
|
||||
criteria = "safe-to-deploy"
|
||||
user-id = 72814 # Gabriele Svelto (gabrielesvelto)
|
||||
start = "2023-05-17"
|
||||
end = "2026-02-01"
|
||||
end = "2027-09-01"
|
||||
notes = "This crate is written and maintained by mozilla employees."
|
||||
|
||||
[[wildcard-audits.mozdevice]]
|
||||
@@ -1775,6 +1775,17 @@ who = "Gabriele Svelto <gsvelto@mozilla.com>"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "0.6.0 -> 0.6.1"
|
||||
|
||||
[[audits.crash-context]]
|
||||
who = "Chris Martin <marti4d@live.ca>"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "0.6.1 -> 0.8.0"
|
||||
|
||||
[[audits.crash-context]]
|
||||
who = "Chris Martin <marti4d@live.ca>"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "0.8.0 -> 0.8.0@git:6744feee58804a78730d176cdcc31bb4f3021107"
|
||||
importable = false
|
||||
|
||||
[[audits.crc32fast]]
|
||||
who = "Alex Franchuk <afranchuk@mozilla.com>"
|
||||
criteria = "safe-to-deploy"
|
||||
@@ -4751,8 +4762,15 @@ delta = "0.11.0 -> 0.12.0"
|
||||
[[audits.minidump-writer]]
|
||||
who = "Chris Martin <marti4d@live.ca>"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "0.12.0 -> 0.12.0@git:ee5b9d59d85bea1d4c6845f6b854e04fe204adf2"
|
||||
delta = "0.12.0 -> 0.13.0"
|
||||
notes = "This crate is mostly maintained by Mozilla staff"
|
||||
|
||||
[[audits.minidump-writer]]
|
||||
who = "Chris Martin <marti4d@live.ca>"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "0.13.0 -> 0.13.0@git:6744feee58804a78730d176cdcc31bb4f3021107"
|
||||
importable = false
|
||||
notes = "This crate is mostly maintained by Mozilla staff."
|
||||
|
||||
[[audits.miniz_oxide]]
|
||||
who = "Mike Hommey <mh+mozilla@glandium.org>"
|
||||
@@ -9093,6 +9111,12 @@ user-id = 2915 # Amanieu d'Antras (Amanieu)
|
||||
start = "2019-05-04"
|
||||
end = "2024-05-05"
|
||||
|
||||
[[trusted.mach2]]
|
||||
criteria = "safe-to-deploy"
|
||||
trusted-publisher = "github:JohnTitor/mach2"
|
||||
start = "2025-11-16"
|
||||
end = "2027-09-01"
|
||||
|
||||
[[trusted.memchr]]
|
||||
criteria = "safe-to-deploy"
|
||||
user-id = 189 # Andrew Gallant (BurntSushi)
|
||||
|
||||
@@ -43,6 +43,9 @@ notes = "This is the upstream code plus a fix for https://github.com/rust-lang/c
|
||||
audit-as-crates-io = true
|
||||
notes = "This is upstream plus a warning fix from bug 1823866."
|
||||
|
||||
[policy."crash-context:0.8.0@git:6744feee58804a78730d176cdcc31bb4f3021107"]
|
||||
audit-as-crates-io = true
|
||||
|
||||
[policy.cssparser]
|
||||
audit-as-crates-io = true
|
||||
notes = "Upstream not yet published changes"
|
||||
@@ -251,7 +254,7 @@ audit-as-crates-io = false
|
||||
[policy.peek-poke-derive]
|
||||
audit-as-crates-io = false
|
||||
|
||||
[policy."process-backend:0.0.0@git:ee5b9d59d85bea1d4c6845f6b854e04fe204adf2"]
|
||||
[policy."process-backend:0.1.0@git:6744feee58804a78730d176cdcc31bb4f3021107"]
|
||||
audit-as-crates-io = false
|
||||
notes = """
|
||||
This was originally intended to be a minidump-writer internal crate (and thus
|
||||
@@ -259,6 +262,9 @@ audited as part of minidump-writer), however an author accidentally published
|
||||
it publicly (so it is on crates.io now).
|
||||
"""
|
||||
|
||||
[policy."process-reader:0.1.0@git:6744feee58804a78730d176cdcc31bb4f3021107"]
|
||||
audit-as-crates-io = false
|
||||
|
||||
[policy.pulse]
|
||||
audit-as-crates-io = false
|
||||
notes = "This is a first-party crate which is entirely unrelated to the crates.io package of the same name."
|
||||
|
||||
@@ -409,6 +409,11 @@ user-id = 2915
|
||||
user-login = "Amanieu"
|
||||
user-name = "Amanieu d'Antras"
|
||||
|
||||
[[publisher.mach2]]
|
||||
version = "0.6.0"
|
||||
when = "2025-11-16"
|
||||
trusted-publisher = "github:JohnTitor/mach2"
|
||||
|
||||
[[publisher.macho-unwind-info]]
|
||||
version = "0.5.0"
|
||||
when = "2024-12-06"
|
||||
@@ -3813,63 +3818,6 @@ who = "Ameer Ghani <inahga@letsencrypt.org>"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "0.5.1 -> 0.5.2"
|
||||
|
||||
[[audits.mozilla.wildcard-audits.uniffi]]
|
||||
who = "Jan-Erik Rediger <jrediger@mozilla.com>"
|
||||
criteria = "safe-to-deploy"
|
||||
user-id = 111105 # Mark Hammond (mhammond)
|
||||
start = "2021-11-22"
|
||||
end = "2027-01-08"
|
||||
aggregated-from = "https://raw.githubusercontent.com/mozilla/glean/main/supply-chain/audits.toml"
|
||||
|
||||
[[audits.mozilla.wildcard-audits.uniffi_bindgen]]
|
||||
who = "Jan-Erik Rediger <jrediger@mozilla.com>"
|
||||
criteria = "safe-to-deploy"
|
||||
user-id = 111105 # Mark Hammond (mhammond)
|
||||
start = "2021-11-22"
|
||||
end = "2027-01-08"
|
||||
aggregated-from = "https://raw.githubusercontent.com/mozilla/glean/main/supply-chain/audits.toml"
|
||||
|
||||
[[audits.mozilla.wildcard-audits.uniffi_build]]
|
||||
who = "Jan-Erik Rediger <jrediger@mozilla.com>"
|
||||
criteria = "safe-to-deploy"
|
||||
user-id = 111105 # Mark Hammond (mhammond)
|
||||
start = "2021-11-22"
|
||||
end = "2027-01-08"
|
||||
aggregated-from = "https://raw.githubusercontent.com/mozilla/glean/main/supply-chain/audits.toml"
|
||||
|
||||
[[audits.mozilla.wildcard-audits.uniffi_core]]
|
||||
who = "Jan-Erik Rediger <jrediger@mozilla.com>"
|
||||
criteria = "safe-to-deploy"
|
||||
user-id = 111105 # Mark Hammond (mhammond)
|
||||
start = "2023-11-20"
|
||||
end = "2027-01-08"
|
||||
aggregated-from = "https://raw.githubusercontent.com/mozilla/glean/main/supply-chain/audits.toml"
|
||||
|
||||
[[audits.mozilla.wildcard-audits.uniffi_macros]]
|
||||
who = "Jan-Erik Rediger <jrediger@mozilla.com>"
|
||||
criteria = "safe-to-deploy"
|
||||
user-id = 111105 # Mark Hammond (mhammond)
|
||||
start = "2021-11-22"
|
||||
end = "2027-01-08"
|
||||
aggregated-from = "https://raw.githubusercontent.com/mozilla/glean/main/supply-chain/audits.toml"
|
||||
|
||||
[[audits.mozilla.wildcard-audits.uniffi_meta]]
|
||||
who = "Jan-Erik Rediger <jrediger@mozilla.com>"
|
||||
criteria = "safe-to-deploy"
|
||||
user-id = 111105 # Mark Hammond (mhammond)
|
||||
start = "2023-11-20"
|
||||
end = "2027-01-08"
|
||||
aggregated-from = "https://raw.githubusercontent.com/mozilla/glean/main/supply-chain/audits.toml"
|
||||
|
||||
[[audits.mozilla.wildcard-audits.uniffi_pipeline]]
|
||||
who = "Jan-Erik Rediger <jrediger@mozilla.com>"
|
||||
criteria = "safe-to-deploy"
|
||||
user-id = 111105 # Mark Hammond (mhammond)
|
||||
start = "2025-10-08"
|
||||
end = "2027-01-14"
|
||||
notes = "Maintained by the Glean and Application Services teams"
|
||||
aggregated-from = "https://raw.githubusercontent.com/mozilla/glean/main/supply-chain/audits.toml"
|
||||
|
||||
[[audits.mozilla.wildcard-audits.uniffi_testing]]
|
||||
who = "Jan-Erik Rediger <jrediger@mozilla.com>"
|
||||
criteria = "safe-to-deploy"
|
||||
@@ -3878,14 +3826,6 @@ start = "2023-11-20"
|
||||
end = "2027-01-08"
|
||||
aggregated-from = "https://raw.githubusercontent.com/mozilla/glean/main/supply-chain/audits.toml"
|
||||
|
||||
[[audits.mozilla.wildcard-audits.uniffi_udl]]
|
||||
who = "Jan-Erik Rediger <jrediger@mozilla.com>"
|
||||
criteria = "safe-to-deploy"
|
||||
user-id = 111105 # Mark Hammond (mhammond)
|
||||
start = "2023-11-20"
|
||||
end = "2027-01-08"
|
||||
aggregated-from = "https://raw.githubusercontent.com/mozilla/glean/main/supply-chain/audits.toml"
|
||||
|
||||
[[audits.mozilla.wildcard-audits.weedle2]]
|
||||
who = "Jan-Erik Rediger <jrediger@mozilla.com>"
|
||||
criteria = "safe-to-deploy"
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"files":{".cargo_vcs_info.json":"6ed7b69d2ca6fd1aaf962ffee20012e30364afee54eb73015bae5053181dc62b","CHANGELOG.md":"843168dabb93f6bc42076d4924040cd8c8a268f03cb02856b55691b5e9a873e1","Cargo.toml":"94c36b790e888c511e093c2b20ade75157daa86fad994d508d071bd4c049223a","Cargo.toml.orig":"27429894b157ef179ff40f155a12c7e81ceec7eaf03c883e86a8d03d592ff7e9","LICENSE-APACHE":"8173d5c29b4f956d532781d2b86e4e30f83e6b7878dce18c919451d6ba707c90","LICENSE-MIT":"090a294a492ab2f41388252312a65cf2f0e423330b721a68c6665ac64766753b","README.md":"f91ee04dfaa356214af7ac68e4cfa1d6c8674f7fea08d65275f3fafde28301df","release.toml":"287ba3b6c89e3b289eae59827d36d6eb6e27b88cc2ada2c0d9a663c8b487117e","src/lib.rs":"26957a6a2555ab82aa9b6d3d1f24efaf20753d6c5eb1510395789283890ac1d1","src/linux.rs":"cf05c1217709a60adeea08e8623438f68a18dea66758b194de0e07ff398b090d","src/linux/getcontext.rs":"4164236732556d71cbb9e04bf4f2b41fd6f51f9bb94dfb974158cc5f49c3c789","src/linux/getcontext/aarch64.rs":"1193e68f06f7f2f4d3e64d80a196804e6cdfd03643ac50332c7af10928a5eccb","src/linux/getcontext/arm.rs":"682f163f4a96c21930e37427a6d687efc68199cbd8a9125b34d99a81280dd31b","src/linux/getcontext/x86.rs":"7c585ec44835910f99801cbb3ac34153e8d687b5dcbc682f9b7768873655c4a0","src/linux/getcontext/x86_64.rs":"db63a1c05e2c7c5b998f3c57b399972fc4e756eb36bcd119a99419c94470444a","src/mac.rs":"13d25443466d387eabf28adae361708f4b6297949c7eeb5bf1b38cb0ca13a418","src/mac/guard.rs":"115d1e8d5ac7bd9ecc666b11a0c584ed1e997160aacb0a1cc0f215ff5a1e9803","src/mac/ipc.rs":"2fc139ee5b70964bd726a30853d7fe9f74f7a6e0f8cf3d150e72a2ac802c1fba","src/mac/resource.rs":"8289db9294a45d6148329d537530512913c456a182783059a832767e39c67295","src/windows.rs":"c6c043cf56cf0840cc1373edc4bd39cf829566d181e50589174745629ab2ad37","tests/capture_context.rs":"899e94c522cd015fd1f45230aff5c8970346ba20623da46cd34da892bbd07f7e"},"package":"b85cef661eeca0c6675116310936972c520ebb0a33ddef16fd7efc957f4c1288"}
|
||||
{"files":{"CHANGELOG.md":"43797a4e27141f566a1b921e88b329d34e0839eb1bb2bcccb8befa154aba4990","Cargo.toml":"5f7ddf844c6a78ccbe409fa378eae172dd9f5cd9e553ee896e90c89705b06d32","LICENSE-APACHE":"8173d5c29b4f956d532781d2b86e4e30f83e6b7878dce18c919451d6ba707c90","LICENSE-MIT":"090a294a492ab2f41388252312a65cf2f0e423330b721a68c6665ac64766753b","README.md":"57796e5f6ef2e5ba3825648b9efc8be22a13eeedb2ec99d23578bb7caac6531b","release.toml":"4ad4d174316dd8e71c381358ed79651354da7117c5737641ca8a5d904b64cc98","src/lib.rs":"26957a6a2555ab82aa9b6d3d1f24efaf20753d6c5eb1510395789283890ac1d1","src/linux.rs":"82ebc969c367294291259e5c70f4674ca2f348d11786eece4b17b54f3b619ff8","src/linux/getcontext.rs":"698e687ac0341e4f48ddd5d5b5284a69c6e4f666e9090dbb87199600747ca025","src/linux/getcontext/aarch64.rs":"1193e68f06f7f2f4d3e64d80a196804e6cdfd03643ac50332c7af10928a5eccb","src/linux/getcontext/arm.rs":"d7f4b94acabfbbd332d3d56975d4bbd4302abfc8f5da1ca15d8d954bdc9fc785","src/linux/getcontext/loongarch64.rs":"5cb9e57d061523ca5376daeff249fe396337f1363f24367466f01003779ffc16","src/linux/getcontext/riscv64.rs":"ef675a729951f2b636a6b33a26d1cfac30b4ab7ada6df435e3f0d762bc71ae23","src/linux/getcontext/s390x.rs":"d6489e346bdc1b61ef91125439d9b90e02d65e6df96be3acb7bfc97f2587840c","src/linux/getcontext/x86.rs":"7c585ec44835910f99801cbb3ac34153e8d687b5dcbc682f9b7768873655c4a0","src/linux/getcontext/x86_64.rs":"bf2067bb2b9274488f55aa64a8bfda60024f2070f2252195cfe489d6f9fb5231","src/mac.rs":"13d25443466d387eabf28adae361708f4b6297949c7eeb5bf1b38cb0ca13a418","src/mac/guard.rs":"115d1e8d5ac7bd9ecc666b11a0c584ed1e997160aacb0a1cc0f215ff5a1e9803","src/mac/ipc.rs":"98db18243a090c03132e75693bf396352eb63cbef87809e4fe3642706639866a","src/mac/resource.rs":"152dba61569b698e08c4a96b83edc0016126775ef0bc3ae3aa476605b81106f8","src/windows.rs":"2a38f4143e9423f738ac8b5fe06a4ccd8b3a5c22d0f2bf40e9fd839dde15b0e4","tests/capture_context.rs":"899e94c522cd015fd1f45230aff5c8970346ba20623da46cd34da892bbd07f7e"},"package":null}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"git": {
|
||||
"sha1": "16c2545f2a46b6b21d1e401cfeaf0d5b9a130b08"
|
||||
},
|
||||
"path_in_vcs": "crash-context"
|
||||
}
|
||||
+28
-1
@@ -9,6 +9,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
<!-- next-header -->
|
||||
## [Unreleased] - ReleaseDate
|
||||
## [0.8.0] - 2026-07-17
|
||||
### Added
|
||||
- [PR#113](https://github.com/EmbarkStudios/crash-handling/pull/113) added support for loongarch64 `getcontext`.
|
||||
|
||||
### Changed
|
||||
- [PR#190](https://github.com/rust-minidump/minidump-writer/pull/190) moved this crate from <https://github.com/EmbarkStudios/crash-handling>.
|
||||
|
||||
## [0.7.0] - 2026-01-13
|
||||
### Added
|
||||
- [PR#102](https://github.com/EmbarkStudios/crash-handling/pull/102) added support for RISCV64 `getcontext`.
|
||||
- [PR#109](https://github.com/EmbarkStudios/crash-handling/pull/102) added support for s390x `getcontext`.
|
||||
|
||||
### Changed
|
||||
- [PR#111](https://github.com/EmbarkStudios/crash-handling/pull/111) updated MSRV to 1.85.0.
|
||||
|
||||
## [0.6.3] - 2024-07-25
|
||||
### Fixed
|
||||
- [PR#89](https://github.com/EmbarkStudios/crash-handling/pull/89) fixed compilation for `arm-unknown-linux-gnueabihf`...again.
|
||||
|
||||
## [0.6.2] - 2024-06-08
|
||||
### Changed
|
||||
- Update MSRV to 1.62.0
|
||||
|
||||
## [0.6.1] - 2023-06-19
|
||||
### Added
|
||||
- [PR#76](https://github.com/EmbarkStudios/crash-handling/pull/76) added support for `i686-linux-android` and `x86_64-linux-android`. Thanks [@gabrielesvelto](https://github.com/gabrielesvelto)!
|
||||
@@ -68,7 +91,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Initial pass of crash-context, Linux only
|
||||
|
||||
<!-- next-url -->
|
||||
[Unreleased]: https://github.com/EmbarkStudios/crash-handling/compare/crash-context-0.6.1...HEAD
|
||||
[Unreleased]: https://github.com/rust-minidump/minidump-writer/compare/crash-context-0.8.0...HEAD
|
||||
[0.8.0]: https://github.com/EmbarkStudios/crash-handling/compare/crash-context-0.7.0...crash-context-0.8.0
|
||||
[0.7.0]: https://github.com/EmbarkStudios/crash-handling/compare/{{tag_name}}...crash-context-0.7.0
|
||||
[0.6.3]: https://github.com/EmbarkStudios/crash-handling/compare/crash-context-0.6.2...{{tag_name}}
|
||||
[0.6.2]: https://github.com/EmbarkStudios/crash-handling/compare/crash-context-0.6.1...crash-context-0.6.2
|
||||
[0.6.1]: https://github.com/EmbarkStudios/crash-handling/compare/crash-context-0.6.0...crash-context-0.6.1
|
||||
[0.6.0]: https://github.com/EmbarkStudios/crash-handling/compare/crash-context-0.5.1...crash-context-0.6.0
|
||||
[0.5.1]: https://github.com/EmbarkStudios/crash-handling/compare/crash-context-0.5.0...crash-context-0.5.1
|
||||
|
||||
+25
-14
@@ -10,16 +10,19 @@
|
||||
# See Cargo.toml.orig for the original contents.
|
||||
|
||||
[package]
|
||||
edition = "2021"
|
||||
rust-version = "1.59.0"
|
||||
edition = "2024"
|
||||
rust-version = "1.88.0"
|
||||
name = "crash-context"
|
||||
version = "0.6.1"
|
||||
authors = [
|
||||
"Embark <opensource@embark-studios.com>",
|
||||
"Jake Shadle <jake.shadle@embark-studios.com>",
|
||||
]
|
||||
version = "0.8.0"
|
||||
authors = ["Jake Shadle <jake.shadle@embark-studios.com>"]
|
||||
build = false
|
||||
autolib = false
|
||||
autobins = false
|
||||
autoexamples = false
|
||||
autotests = false
|
||||
autobenches = false
|
||||
description = "Provides portable types containing target specific contextual information at the time of a crash"
|
||||
homepage = "https://github.com/EmbarkStudios/crash-handling/tree/main/crash-context"
|
||||
homepage = "https://github.com/rust-minidump/minidump-writer/tree/main/crates/crash-context"
|
||||
documentation = "https://docs.rs/crash-context"
|
||||
readme = "README.md"
|
||||
keywords = [
|
||||
@@ -28,15 +31,23 @@ keywords = [
|
||||
"getcontext",
|
||||
]
|
||||
categories = ["external-ffi-bindings"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
repository = "https://github.com/EmbarkStudios/crash-handling"
|
||||
resolver = "1"
|
||||
license = "MIT"
|
||||
repository = "https://github.com/rust-minidump/minidump-writer"
|
||||
|
||||
[lib]
|
||||
name = "crash_context"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[[test]]
|
||||
name = "capture_context"
|
||||
path = "tests/capture_context.rs"
|
||||
|
||||
[dependencies.cfg-if]
|
||||
version = "1.0"
|
||||
|
||||
[target."cfg(any(target_os = \"linux\", target_os = \"android\"))".dependencies.libc]
|
||||
[target.'cfg(any(target_os = "linux", target_os = "android"))'.dependencies.libc]
|
||||
version = "0.2"
|
||||
default-features = false
|
||||
|
||||
[target."cfg(target_os = \"macos\")".dependencies.mach2]
|
||||
version = "0.4"
|
||||
[target.'cfg(target_os = "macos")'.dependencies.mach2]
|
||||
version = "0.6"
|
||||
|
||||
-28
@@ -1,28 +0,0 @@
|
||||
[package]
|
||||
name = "crash-context"
|
||||
version = "0.6.1"
|
||||
description = "Provides portable types containing target specific contextual information at the time of a crash"
|
||||
repository = "https://github.com/EmbarkStudios/crash-handling"
|
||||
authors = [
|
||||
"Embark <opensource@embark-studios.com>",
|
||||
"Jake Shadle <jake.shadle@embark-studios.com>",
|
||||
]
|
||||
edition = "2021"
|
||||
license = "MIT OR Apache-2.0"
|
||||
readme = "README.md"
|
||||
documentation = "https://docs.rs/crash-context"
|
||||
homepage = "https://github.com/EmbarkStudios/crash-handling/tree/main/crash-context"
|
||||
categories = ["external-ffi-bindings"]
|
||||
keywords = ["crash", "libc", "getcontext"]
|
||||
rust-version = "1.59.0" # We use `global_asm!`
|
||||
|
||||
[dependencies]
|
||||
# Nicer cfg handling
|
||||
cfg-if = "1.0"
|
||||
|
||||
[target.'cfg(any(target_os = "linux", target_os = "android"))'.dependencies]
|
||||
libc = "0.2"
|
||||
|
||||
[target.'cfg(target_os = "macos")'.dependencies]
|
||||
# provides bindings to mach specifics
|
||||
mach2 = "0.4"
|
||||
+4
-15
@@ -10,12 +10,10 @@
|
||||
|
||||
**Provides portable types containing target specific contextual information at the time of a crash**
|
||||
|
||||
[](https://embark.dev)
|
||||
[](https://discord.gg/dAuKfZS)
|
||||
[](https://crates.io/crates/crash-context)
|
||||
[](https://docs.rs/crash-context)
|
||||
[](https://deps.rs/repo/github/EmbarkStudios/crash-handling)
|
||||
[](https://github.com/EmbarkStudios/crash-handling/actions)
|
||||
[](https://deps.rs/repo/github/rust-minidump/minidump-writer)
|
||||
[](https://github.com/rust-minidump/minidump-writer/actions)
|
||||
|
||||
</div>
|
||||
|
||||
@@ -31,23 +29,14 @@
|
||||
- `i686-linux-android`
|
||||
- `i686-unknown-linux-gnu`
|
||||
- `i686-unknown-linux-musl`
|
||||
- `loongarch64-unknown-linux-gnu`
|
||||
- `loongarch64-unknown-linux-musl`
|
||||
- `x86_64-apple-darwin`
|
||||
- `x86_64-linux-android`
|
||||
- `x86_64-pc-windows-msvc`
|
||||
- `x86_64-unknown-linux-gnu`
|
||||
- `x86_64-unknown-linux-musl`
|
||||
|
||||
## Contribution
|
||||
|
||||
[](../CODE_OF_CONDUCT.md)
|
||||
|
||||
We welcome community contributions to this project.
|
||||
|
||||
Please read our [Contributor Guide](../CONTRIBUTING.md) for more information on how to get started.
|
||||
Please also read our [Contributor Terms](../CONTRIBUTING.md#contributor-terms) before you make any contributions.
|
||||
|
||||
Any contribution intentionally submitted for inclusion in an Embark Studios project, shall comply with the Rust standard licensing model (MIT OR Apache 2.0) and therefore be dual licensed as described below, without any additional terms or conditions:
|
||||
|
||||
### License
|
||||
|
||||
This contribution is dual licensed under EITHER OF
|
||||
|
||||
+1
-1
@@ -6,5 +6,5 @@ pre-release-replacements = [
|
||||
{ file = "CHANGELOG.md", search = "\\.\\.\\.HEAD", replace = "...{{tag_name}}" },
|
||||
{ file = "CHANGELOG.md", search = "ReleaseDate", replace = "{{date}}" },
|
||||
{ file = "CHANGELOG.md", search = "<!-- next-header -->", replace = "<!-- next-header -->\n## [Unreleased] - ReleaseDate" },
|
||||
{ file = "CHANGELOG.md", search = "<!-- next-url -->", replace = "<!-- next-url -->\n[Unreleased]: https://github.com/EmbarkStudios/crash-handling/compare/{{tag_name}}...HEAD" },
|
||||
{ file = "CHANGELOG.md", search = "<!-- next-url -->", replace = "<!-- next-url -->\n[Unreleased]: https://github.com/rust-minidump/minidump-writer/compare/{{tag_name}}...HEAD" },
|
||||
]
|
||||
|
||||
+173
-2
@@ -10,7 +10,7 @@ pub struct CrashContext {
|
||||
///
|
||||
/// Note that we use [`crate::ucontext_t`] instead of [`libc::ucontext_t`]
|
||||
/// as libc's differs between glibc and musl <https://github.com/rust-lang/libc/pull/1646>
|
||||
/// even though the ucontext_t received from a signal will be the same
|
||||
/// even though the `ucontext_t` received from a signal will be the same
|
||||
/// regardless of the libc implementation used as it is only arch specific
|
||||
/// and not libc specific
|
||||
///
|
||||
@@ -52,7 +52,7 @@ impl CrashContext {
|
||||
return None;
|
||||
}
|
||||
|
||||
unsafe { Some((*bytes.as_ptr().cast::<Self>()).clone()) }
|
||||
unsafe { Some(std::ptr::read_unaligned(bytes.as_ptr().cast::<Self>())) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,6 +87,8 @@ cfg_if::cfg_if! {
|
||||
pub uc_mcontext: mcontext_t,
|
||||
pub uc_sigmask: sigset_t,
|
||||
__private: [u8; 512],
|
||||
/// Shadow stack
|
||||
__ssp: [u64; 4],
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
@@ -256,6 +258,175 @@ cfg_if::cfg_if! {
|
||||
pub arm_cpsr: u32,
|
||||
pub fault_address: u32,
|
||||
}
|
||||
} else if #[cfg(target_arch = "riscv64")] {
|
||||
#[repr(C)]
|
||||
#[derive(Clone)]
|
||||
#[doc(hidden)]
|
||||
pub struct ucontext_t {
|
||||
pub __uc_flags: u64,
|
||||
pub uc_link: *mut ucontext_t,
|
||||
pub uc_stack: stack_t,
|
||||
pub uc_sigmask: sigset_t,
|
||||
pub uc_mcontext: mcontext_t,
|
||||
}
|
||||
|
||||
#[repr(C, align(16))]
|
||||
#[derive(Clone)]
|
||||
#[doc(hidden)]
|
||||
pub struct mcontext_t {
|
||||
pub __gregs: [u64; 32],
|
||||
pub __fpregs: __riscv_mc_fp_state,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy)]
|
||||
#[doc(hidden)]
|
||||
pub union __riscv_mc_fp_state {
|
||||
pub __f: __riscv_mc_f_ext_state,
|
||||
pub __d: __riscv_mc_d_ext_state,
|
||||
pub __q: __riscv_mc_q_ext_state,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy)]
|
||||
#[doc(hidden)]
|
||||
pub struct __riscv_mc_f_ext_state {
|
||||
pub __f: [u32; 32],
|
||||
pub __fcsr: u32,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy)]
|
||||
#[doc(hidden)]
|
||||
pub struct __riscv_mc_d_ext_state {
|
||||
pub __f: [u64; 32],
|
||||
pub __fcsr: u32,
|
||||
}
|
||||
|
||||
#[repr(C, align(16))]
|
||||
#[derive(Clone, Copy)]
|
||||
#[doc(hidden)]
|
||||
pub struct __riscv_mc_q_ext_state {
|
||||
pub __f: [u64; 64],
|
||||
pub __fcsr: u32,
|
||||
pub __reserved: [u32; 3],
|
||||
}
|
||||
|
||||
pub type fpregset_t = __riscv_mc_fp_state;
|
||||
} else if #[cfg(target_arch = "s390x")] {
|
||||
#[repr(C)]
|
||||
#[derive(Clone)]
|
||||
#[doc(hidden)]
|
||||
pub struct ucontext_t {
|
||||
pub uc_flags: u64,
|
||||
pub uc_link: *mut ucontext_t,
|
||||
pub uc_stack: stack_t,
|
||||
pub uc_mcontext: mcontext_t,
|
||||
pub uc_sigmask: sigset_t,
|
||||
}
|
||||
|
||||
#[repr(C, align(8))]
|
||||
#[derive(Clone,Copy)]
|
||||
#[doc(hidden)]
|
||||
pub struct mcontext_t {
|
||||
pub psw: psw_t,
|
||||
pub gregs: [u64; 16],
|
||||
pub aregs: [u32; 16],
|
||||
pub __fpregs: fpregset_t,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone,Copy)]
|
||||
#[doc(hidden)]
|
||||
pub struct fpregset_t {
|
||||
pub fpc: u32,
|
||||
__pad: u32,
|
||||
pub fprs: [fpreg_t; 16],
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone,Copy)]
|
||||
#[doc(hidden)]
|
||||
pub struct fpreg_t {
|
||||
pub d: f64,
|
||||
// pub f: f32,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone,Copy)]
|
||||
#[doc(hidden)]
|
||||
pub struct psw_t {
|
||||
pub mask: u64,
|
||||
pub addr: u64,
|
||||
}
|
||||
} else if #[cfg(target_arch = "loongarch64")] {
|
||||
pub const SC_USED_FP: u32 = 1;
|
||||
pub const FPU_CTX_MAGIC: u32 = 0x46505501;
|
||||
pub const FPU_CTX_ALIGN: usize = 8;
|
||||
pub const LSX_CTX_MAGIC: u32 = 0x53580001;
|
||||
pub const LSX_CTX_ALIGN: usize = 16;
|
||||
pub const LASX_CTX_MAGIC: u32 = 0x41535801;
|
||||
pub const LASX_CTX_ALIGN: usize = 32;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone)]
|
||||
#[doc(hidden)]
|
||||
pub struct ucontext_t {
|
||||
pub uc_flags: u64,
|
||||
pub uc_link: *mut ucontext_t,
|
||||
pub uc_stack: stack_t,
|
||||
pub uc_sigmask: sigset_t,
|
||||
pub uc_mcontext: mcontext_t,
|
||||
}
|
||||
|
||||
#[repr(C, align(16))]
|
||||
#[derive(Clone,Copy)]
|
||||
#[doc(hidden)]
|
||||
pub struct mcontext_t {
|
||||
pub __pc: u64,
|
||||
pub __gregs: [u64; 32],
|
||||
pub __flags: u32,
|
||||
pub __extcontext: [u64; 0],
|
||||
}
|
||||
|
||||
#[repr(C, align(16))]
|
||||
#[derive(Clone,Copy)]
|
||||
#[doc(hidden)]
|
||||
pub struct sctx_info {
|
||||
pub magic: u32,
|
||||
pub size: u32,
|
||||
padding: u64,
|
||||
}
|
||||
|
||||
#[repr(C, align(8))]
|
||||
#[derive(Clone,Copy)]
|
||||
#[doc(hidden)]
|
||||
pub struct fpu_context {
|
||||
pub regs: [u64; 32],
|
||||
pub fcc: u64,
|
||||
pub fcsr: u32,
|
||||
}
|
||||
|
||||
#[repr(C, align(16))]
|
||||
#[derive(Clone,Copy)]
|
||||
#[doc(hidden)]
|
||||
pub struct lsx_context {
|
||||
pub regs: [u64; 2*32],
|
||||
pub fcc: u64,
|
||||
pub fcsr: u32,
|
||||
}
|
||||
|
||||
#[repr(C, align(32))]
|
||||
#[derive(Clone,Copy)]
|
||||
#[doc(hidden)]
|
||||
pub struct lasx_context {
|
||||
pub regs: [u64; 4*32],
|
||||
pub fcc: u64,
|
||||
pub fcsr: u32,
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
pub type fpregset_t = fpu_context;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+7
-1
@@ -1,6 +1,6 @@
|
||||
//! Implementation of [`getcontext`](https://man7.org/linux/man-pages/man3/getcontext.3.html)
|
||||
|
||||
extern "C" {
|
||||
unsafe extern "C" {
|
||||
/// A portable implementation of [`getcontext`](https://man7.org/linux/man-pages/man3/getcontext.3.html)
|
||||
/// since it is not supported by all libc implementations, namely `musl`, as
|
||||
/// it has been deprecated from POSIX for over a decade
|
||||
@@ -20,5 +20,11 @@ cfg_if::cfg_if! {
|
||||
mod aarch64;
|
||||
} else if #[cfg(target_arch = "arm")] {
|
||||
mod arm;
|
||||
} else if #[cfg(target_arch = "riscv64")] {
|
||||
mod riscv64;
|
||||
} else if #[cfg(target_arch = "s390x")] {
|
||||
mod s390x;
|
||||
} else if #[cfg(target_arch = "loongarch64")] {
|
||||
mod loongarch64;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ std::arch::global_asm! {
|
||||
|
||||
// Return 0
|
||||
"mov r0, #0",
|
||||
"bx lr",
|
||||
"mov pc, lr",
|
||||
|
||||
".fnend",
|
||||
".size crash_context_getcontext, . - crash_context_getcontext",
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
std::arch::global_asm! {
|
||||
".text",
|
||||
".global crash_context_getcontext",
|
||||
".hidden crash_context_getcontext",
|
||||
".type crash_context_getcontext, @function",
|
||||
".align 4",
|
||||
".cfi_startproc",
|
||||
"crash_context_getcontext:",
|
||||
|
||||
// Save general registers
|
||||
"st.d $ra, $a0, 176",
|
||||
"st.d $zero, $a0, 184",
|
||||
"st.d $ra, $a0, 192",
|
||||
"st.d $tp, $a0, 200",
|
||||
"st.d $sp, $a0, 208",
|
||||
"st.d $a0, $a0, 216",
|
||||
"st.d $a1, $a0, 224",
|
||||
"st.d $a2, $a0, 232",
|
||||
"st.d $a3, $a0, 240",
|
||||
"st.d $a4, $a0, 248",
|
||||
"st.d $a5, $a0, 256",
|
||||
"st.d $a6, $a0, 264",
|
||||
"st.d $a7, $a0, 272",
|
||||
"st.d $t0, $a0, 280",
|
||||
"st.d $t1, $a0, 288",
|
||||
"st.d $t2, $a0, 296",
|
||||
"st.d $t3, $a0, 304",
|
||||
"st.d $t4, $a0, 312",
|
||||
"st.d $t5, $a0, 320",
|
||||
"st.d $t6, $a0, 328",
|
||||
"st.d $t7, $a0, 336",
|
||||
"st.d $t8, $a0, 344",
|
||||
"st.d $r21, $a0, 352",
|
||||
"st.d $fp, $a0, 360",
|
||||
"st.d $s0, $a0, 368",
|
||||
"st.d $s1, $a0, 376",
|
||||
"st.d $s2, $a0, 384",
|
||||
"st.d $s3, $a0, 392",
|
||||
"st.d $s4, $a0, 400",
|
||||
"st.d $s5, $a0, 408",
|
||||
"st.d $s6, $a0, 416",
|
||||
"st.d $s7, $a0, 424",
|
||||
"st.d $s8, $a0, 432",
|
||||
|
||||
"li.w $t0, 0", // mcontext_t.__flags
|
||||
"st.w $t0, $a0, 440",
|
||||
"li.w $t0, 0", // sctx_info.magic
|
||||
"st.w $t0, $a0, 448",
|
||||
"li.w $t0, 0", // sctx_info.size
|
||||
"st.w $t0, $a0, 452",
|
||||
|
||||
"move $a1, $zero", // NULL
|
||||
"addi.d $a2, $a0, 40", // UCONTEXT_SIGMASK_OFFSET
|
||||
"li.w $a3, 8", // _NSIG8
|
||||
"move $a0, $zero", // SIG_BLOCK
|
||||
"li.w $a7, 135", // __NR_rt_sigprocmask
|
||||
"syscall 0",
|
||||
|
||||
"move $a0, $zero",
|
||||
"ret",
|
||||
|
||||
".cfi_endproc",
|
||||
".size crash_context_getcontext, . - crash_context_getcontext",
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
// UCONTEXT_SIGMASK_OFFSET = 40
|
||||
// MCONTEXT_GREGS_OFFSET = 168
|
||||
// MCONTEXT_GREGS_SIZE = 8
|
||||
|
||||
std::arch::global_asm! {
|
||||
".text",
|
||||
".attribute arch, \"rv64gc\"",
|
||||
".globl crash_context_getcontext",
|
||||
".hidden crash_context_getcontext",
|
||||
".type crash_context_getcontext, @function",
|
||||
".align 0",
|
||||
".cfi_startproc",
|
||||
"crash_context_getcontext:",
|
||||
|
||||
// Save general registers
|
||||
"sd ra, 0xa8(a0)",
|
||||
"sd ra, 0xb0(a0)",
|
||||
"sd sp, 0xb8(a0)",
|
||||
"sd gp, 0xc0(a0)",
|
||||
"sd tp, 0xc8(a0)",
|
||||
"sd t0, 0xd0(a0)",
|
||||
"sd t1, 0xd8(a0)",
|
||||
"sd t2, 0xe0(a0)",
|
||||
"sd s0, 0xe8(a0)",
|
||||
"sd s1, 0xf0(a0)",
|
||||
"sd a0, 0xf8(a0)",
|
||||
"sd a1, 0x100(a0)",
|
||||
"sd a2, 0x108(a0)",
|
||||
"sd a3, 0x110(a0)",
|
||||
"sd a4, 0x118(a0)",
|
||||
"sd a5, 0x120(a0)",
|
||||
"sd a6, 0x128(a0)",
|
||||
"sd a7, 0x130(a0)",
|
||||
"sd s2, 0x138(a0)",
|
||||
"sd s3, 0x140(a0)",
|
||||
"sd s4, 0x148(a0)",
|
||||
"sd s5, 0x150(a0)",
|
||||
"sd s6, 0x158(a0)",
|
||||
"sd s7, 0x160(a0)",
|
||||
"sd s8, 0x168(a0)",
|
||||
"sd s9, 0x170(a0)",
|
||||
"sd s10, 0x178(a0)",
|
||||
"sd s11, 0x180(a0)",
|
||||
"sd t3, 0x188(a0)",
|
||||
"sd t4, 0x190(a0)",
|
||||
"sd t5, 0x198(a0)",
|
||||
"sd t6 , 0x1a0(a0)",
|
||||
|
||||
// Save floating point registers
|
||||
"frsr a1", // Save CSR
|
||||
"fsd ft0, 0x1a8(a0)",
|
||||
"fsd ft1, 0x1b0(a0)",
|
||||
"fsd ft2, 0x1b8(a0)",
|
||||
"fsd ft3, 0x1c0(a0)",
|
||||
"fsd ft4, 0x1c8(a0)",
|
||||
"fsd ft5, 0x1d0(a0)",
|
||||
"fsd ft6, 0x1d8(a0)",
|
||||
"fsd ft7, 0x1e0(a0)",
|
||||
"fsd fs0, 0x1e8(a0)",
|
||||
"fsd fs1, 0x1f0(a0)",
|
||||
"fsd fa0, 0x1f8(a0)",
|
||||
"fsd fa1, 0x200(a0)",
|
||||
"fsd fa2, 0x208(a0)",
|
||||
"fsd fa3, 0x210(a0)",
|
||||
"fsd fa4, 0x218(a0)",
|
||||
"fsd fa5, 0x220(a0)",
|
||||
"fsd fa6, 0x228(a0)",
|
||||
"fsd fa7, 0x230(a0)",
|
||||
"fsd fs2, 0x238(a0)",
|
||||
"fsd fs3, 0x240(a0)",
|
||||
"fsd fs4, 0x248(a0)",
|
||||
"fsd fs5, 0x250(a0)",
|
||||
"fsd fs6, 0x258(a0)",
|
||||
"fsd fs7, 0x260(a0)",
|
||||
"fsd fs8, 0x268(a0)",
|
||||
"fsd fs9, 0x270(a0)",
|
||||
"fsd fs10, 0x278(a0)",
|
||||
"fsd fs11, 0x280(a0)",
|
||||
"fsd ft8, 0x288(a0)",
|
||||
"fsd ft9, 0x290(a0)",
|
||||
"fsd ft10, 0x298(a0)",
|
||||
"fsd ft11, 0x2a0(a0)",
|
||||
"sw a1, 0x2a8(a0)",
|
||||
|
||||
"mv a1, zero",
|
||||
"add a2, a0, 40", // UCONTEXT_SIGMASK_OFFSET
|
||||
"li a3, 8", // _NSIG8
|
||||
"mv a0, zero",
|
||||
"li a7, 135", // __NR_rt_sigprocmask
|
||||
"ecall",
|
||||
|
||||
"mv a0, zero",
|
||||
"ret",
|
||||
|
||||
".cfi_endproc",
|
||||
".size crash_context_getcontext, . - crash_context_getcontext",
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
std::arch::global_asm! {
|
||||
".text",
|
||||
".global crash_context_getcontext",
|
||||
".hidden crash_context_getcontext",
|
||||
".type crash_context_getcontext, @function",
|
||||
".align 8",
|
||||
".cfi_startproc",
|
||||
"crash_context_getcontext:",
|
||||
|
||||
"lgr %r0,%r2",
|
||||
|
||||
/* rt_sigprocmask (SIG_BLOCK, NULL, &sc->sc_mask, sigsetsize). */
|
||||
"la %r4,384(%r2)",
|
||||
"la %r2,0",
|
||||
"slgr %r3,%r3",
|
||||
"lghi %r5,8",
|
||||
"lghi %r1,175",
|
||||
"svc 0",
|
||||
|
||||
/* Store fpu context. */
|
||||
"lgr %r1,%r0",
|
||||
"stfpc 248(%r1)",
|
||||
"std %f0,256(%r1)",
|
||||
"std %f1,264(%r1)",
|
||||
"std %f2,272(%r1)",
|
||||
"std %f3,280(%r1)",
|
||||
"std %f4,288(%r1)",
|
||||
"std %f5,296(%r1)",
|
||||
"std %f6,304(%r1)",
|
||||
"std %f7,312(%r1)",
|
||||
"std %f8,320(%r1)",
|
||||
"std %f9,328(%r1)",
|
||||
"std %f10,336(%r1)",
|
||||
"std %f11,344(%r1)",
|
||||
"std %f12,352(%r1)",
|
||||
"std %f13,360(%r1)",
|
||||
"std %f14,368(%r1)",
|
||||
"std %f15,376(%r1)",
|
||||
|
||||
/* Set __getcontext return value to 0. */
|
||||
"slgr %r2,%r2",
|
||||
|
||||
/* Store access registers. */
|
||||
"stam %a0,%a15,184(%r1)",
|
||||
|
||||
/* Store general purpose registers. */
|
||||
"stmg %r0,%r15,56(%r1)",
|
||||
|
||||
/* Store psw mask to 0x0 and addr to return address. Then the address
|
||||
can be retrieved from the ucontext structure in the same way as if it
|
||||
is created by kernel and passed to a signal-handler. */
|
||||
"stg %r2,40(%r1)",
|
||||
"stg %r14,48(%r1)",
|
||||
"br %r14",
|
||||
|
||||
".cfi_endproc",
|
||||
".size crash_context_getcontext, . - crash_context_getcontext",
|
||||
}
|
||||
@@ -32,7 +32,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
// adding certain lines/blocks of asm based using cfg https://github.com/rust-lang/rust/issues/15701
|
||||
// and they're not really inputs, just literals, so...yah
|
||||
|
||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
#![cfg(any(target_os = "linux", target_os = "android"))]
|
||||
|
||||
// Unfortunately, the asm! macro has a few really annoying limitations at the
|
||||
// moment
|
||||
|
||||
+53
-44
@@ -15,13 +15,13 @@
|
||||
use crate::CrashContext;
|
||||
use mach2::{
|
||||
bootstrap, kern_return::KERN_SUCCESS, mach_port, message as msg, port, task,
|
||||
traps::mach_task_self,
|
||||
task_special_ports::TASK_BOOTSTRAP_PORT, traps::mach_task_self,
|
||||
};
|
||||
pub use mach2::{kern_return::kern_return_t, message::mach_msg_return_t};
|
||||
use std::{ffi::CStr, time::Duration};
|
||||
|
||||
extern "C" {
|
||||
/// From <usr/include/mach/mach_traps.h>, there is no binding for this in mach2
|
||||
unsafe extern "C" {
|
||||
/// From `<usr/include/mach/mach_traps.h>`, there is no binding for this in mach2
|
||||
pub fn pid_for_task(task: port::mach_port_name_t, pid: *mut i32) -> kern_return_t;
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ struct CrashContextMessage {
|
||||
/// The optional exception subcode
|
||||
exception_subcode: u64,
|
||||
/// We don't actually send this, but it's tacked on by the kernel :(
|
||||
trailer: MachMsgTrailer,
|
||||
_trailer: MachMsgTrailer,
|
||||
}
|
||||
|
||||
const FLAG_HAS_EXCEPTION: u32 = 0x1;
|
||||
@@ -110,6 +110,7 @@ const FLAG_HAS_SUBCODE: u32 = 0x2;
|
||||
struct AcknowledgementMessage {
|
||||
head: MachMsgHeader,
|
||||
result: u32,
|
||||
_trailer: MachMsgTrailer,
|
||||
}
|
||||
|
||||
/// An error that can occur while interacting with mach ports
|
||||
@@ -175,7 +176,7 @@ impl Client {
|
||||
let mut task_bootstrap_port = 0;
|
||||
kern!(task::task_get_special_port(
|
||||
mach_task_self(),
|
||||
task::TASK_BOOTSTRAP_PORT,
|
||||
TASK_BOOTSTRAP_PORT,
|
||||
&mut task_bootstrap_port
|
||||
));
|
||||
|
||||
@@ -235,7 +236,8 @@ impl Client {
|
||||
head: MachMsgHeader {
|
||||
bits: msg::MACH_MSG_TYPE_COPY_SEND | msg::MACH_MSGH_BITS_COMPLEX,
|
||||
// We don't send the trailer, that's added by the kernel
|
||||
size: std::mem::size_of::<CrashContextMessage>() as u32 - 8,
|
||||
size: std::mem::size_of::<CrashContextMessage>() as u32
|
||||
- std::mem::size_of::<MachMsgTrailer>() as u32,
|
||||
remote_port: self.port,
|
||||
local_port: port::MACH_PORT_NULL,
|
||||
voucher_port: port::MACH_PORT_NULL,
|
||||
@@ -257,7 +259,7 @@ impl Client {
|
||||
exception_subcode,
|
||||
// We don't actually send this but I didn't feel like making
|
||||
// two types
|
||||
trailer: MachMsgTrailer { kind: 0, size: 8 },
|
||||
_trailer: MachMsgTrailer { kind: 0, size: 8 },
|
||||
};
|
||||
|
||||
// Try to actually send the message to the Server
|
||||
@@ -314,7 +316,7 @@ impl Server {
|
||||
let mut task_bootstrap_port = 0;
|
||||
kern!(task::task_get_special_port(
|
||||
mach_task_self(),
|
||||
task::TASK_BOOTSTRAP_PORT,
|
||||
TASK_BOOTSTRAP_PORT,
|
||||
&mut task_bootstrap_port
|
||||
));
|
||||
|
||||
@@ -441,13 +443,15 @@ impl Acknowledger {
|
||||
let mut msg = AcknowledgementMessage {
|
||||
head: MachMsgHeader {
|
||||
bits: msg::MACH_MSG_TYPE_COPY_SEND,
|
||||
size: std::mem::size_of::<AcknowledgementMessage>() as u32,
|
||||
size: std::mem::size_of::<AcknowledgementMessage>() as u32
|
||||
- std::mem::size_of::<MachMsgTrailer>() as u32,
|
||||
remote_port: port,
|
||||
local_port: port::MACH_PORT_NULL,
|
||||
voucher_port: port::MACH_PORT_NULL,
|
||||
id: 0,
|
||||
},
|
||||
result: ack,
|
||||
_trailer: MachMsgTrailer { kind: 0, size: 8 },
|
||||
};
|
||||
|
||||
// Try to actually send the message
|
||||
@@ -487,21 +491,23 @@ impl AckReceiver {
|
||||
/// Performs syscalls. Only used internally hence the entire function being
|
||||
/// marked unsafe.
|
||||
unsafe fn new() -> Result<Self, Error> {
|
||||
let mut port = 0;
|
||||
kern!(mach_port::mach_port_allocate(
|
||||
mach_task_self(),
|
||||
port::MACH_PORT_RIGHT_RECEIVE,
|
||||
&mut port
|
||||
));
|
||||
unsafe {
|
||||
let mut port = 0;
|
||||
kern!(mach_port::mach_port_allocate(
|
||||
mach_task_self(),
|
||||
port::MACH_PORT_RIGHT_RECEIVE,
|
||||
&mut port
|
||||
));
|
||||
|
||||
kern!(mach_port::mach_port_insert_right(
|
||||
mach_task_self(),
|
||||
port,
|
||||
port,
|
||||
msg::MACH_MSG_TYPE_MAKE_SEND
|
||||
));
|
||||
kern!(mach_port::mach_port_insert_right(
|
||||
mach_task_self(),
|
||||
port,
|
||||
port,
|
||||
msg::MACH_MSG_TYPE_MAKE_SEND
|
||||
));
|
||||
|
||||
Ok(Self { port })
|
||||
Ok(Self { port })
|
||||
}
|
||||
}
|
||||
|
||||
/// Waits for the specified duration to receive a result from the [`Server`]
|
||||
@@ -516,30 +522,33 @@ impl AckReceiver {
|
||||
/// Performs syscalls. Only used internally hence the entire function being
|
||||
/// marked unsafe.
|
||||
unsafe fn recv_ack(&mut self, timeout: Option<Duration>) -> Result<u32, Error> {
|
||||
let mut ack = AcknowledgementMessage {
|
||||
head: MachMsgHeader {
|
||||
bits: 0,
|
||||
size: std::mem::size_of::<AcknowledgementMessage>() as u32,
|
||||
remote_port: port::MACH_PORT_NULL,
|
||||
local_port: self.port,
|
||||
voucher_port: port::MACH_PORT_NULL,
|
||||
id: 0,
|
||||
},
|
||||
result: 0,
|
||||
};
|
||||
unsafe {
|
||||
let mut ack = AcknowledgementMessage {
|
||||
head: MachMsgHeader {
|
||||
bits: 0,
|
||||
size: std::mem::size_of::<AcknowledgementMessage>() as u32,
|
||||
remote_port: port::MACH_PORT_NULL,
|
||||
local_port: self.port,
|
||||
voucher_port: port::MACH_PORT_NULL,
|
||||
id: 0,
|
||||
},
|
||||
result: 0,
|
||||
_trailer: MachMsgTrailer { kind: 0, size: 8 },
|
||||
};
|
||||
|
||||
// Wait for a response from the Server
|
||||
msg!(msg::mach_msg(
|
||||
((&mut ack.head) as *mut MachMsgHeader).cast(),
|
||||
msg::MACH_RCV_MSG | msg::MACH_RCV_TIMEOUT,
|
||||
0,
|
||||
ack.head.size,
|
||||
self.port,
|
||||
timeout.map(|t| t.as_millis() as u32).unwrap_or_default(),
|
||||
port::MACH_PORT_NULL
|
||||
));
|
||||
// Wait for a response from the Server
|
||||
msg!(msg::mach_msg(
|
||||
((&mut ack.head) as *mut MachMsgHeader).cast(),
|
||||
msg::MACH_RCV_MSG | msg::MACH_RCV_TIMEOUT,
|
||||
0,
|
||||
ack.head.size,
|
||||
self.port,
|
||||
timeout.map(|t| t.as_millis() as u32).unwrap_or_default(),
|
||||
port::MACH_PORT_NULL
|
||||
));
|
||||
|
||||
Ok(ack.result)
|
||||
Ok(ack.result)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -17,7 +17,7 @@ pub enum ResourceException {
|
||||
Cpu(CpuResourceException),
|
||||
/// This is sent by the kernel when the platform idle wakeups monitor is tripped. Possibly fatal.
|
||||
Wakeups(WakeupsResourceException),
|
||||
/// This is sent by the kernel when a task crosses its high watermark memory limit. Never fatal at least on current MacOS versions.
|
||||
/// This is sent by the kernel when a task crosses its high watermark memory limit. Never fatal at least on current `MacOS` versions.
|
||||
Memory(MemoryResourceException),
|
||||
/// This is sent by the kernel when a task crosses its I/O limits. Never fatal.
|
||||
Io(IoResourceException),
|
||||
@@ -27,7 +27,7 @@ pub enum ResourceException {
|
||||
/// filled its port space. Always fatal.
|
||||
Ports(PortsResourceException),
|
||||
/// An unknown resource kind due to an addition to the set of possible
|
||||
/// resource exception kinds in exc_resource.h
|
||||
/// resource exception kinds in `exc_resource.h`
|
||||
Unknown { kind: u8, flavor: u8 },
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -5,7 +5,7 @@ pub struct CrashContext {
|
||||
/// Note that this is a pointer into the actual memory of the crashed process,
|
||||
/// and is a pointer to an [EXCEPTION_POINTERS](https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-exception_pointers)
|
||||
pub exception_pointers: *const EXCEPTION_POINTERS,
|
||||
/// The top level exception code from the exception_pointers. This is provided
|
||||
/// The top level exception code from the `exception_pointers`. This is provided
|
||||
/// so that external processes don't need to use `ReadProcessMemory` to inspect
|
||||
/// the exception code
|
||||
pub exception_code: i32,
|
||||
@@ -16,7 +16,7 @@ pub struct CrashContext {
|
||||
}
|
||||
|
||||
#[link(name = "kernel32")]
|
||||
extern "system" {
|
||||
unsafe extern "system" {
|
||||
#[link_name = "RtlCaptureContext"]
|
||||
pub fn capture_context(ctx_rec: *mut CONTEXT);
|
||||
}
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"git": {
|
||||
"sha1": "11476e373ca8ab203234b67788ae00e703112a41"
|
||||
"sha1": "74fabb1965ef580abfcbf5aa75368c5930caebb8"
|
||||
},
|
||||
"path_in_vcs": ""
|
||||
}
|
||||
+2
-11
@@ -1,16 +1,7 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.126"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836"
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "mach2"
|
||||
version = "0.4.1"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
version = "0.6.0"
|
||||
|
||||
Vendored
+12
-9
@@ -10,14 +10,20 @@
|
||||
# See Cargo.toml.orig for the original contents.
|
||||
|
||||
[package]
|
||||
edition = "2015"
|
||||
edition = "2024"
|
||||
name = "mach2"
|
||||
version = "0.4.1"
|
||||
version = "0.6.0"
|
||||
build = false
|
||||
include = [
|
||||
"src/**/*",
|
||||
"LICENSE-*",
|
||||
"README.md",
|
||||
]
|
||||
autolib = false
|
||||
autobins = false
|
||||
autoexamples = false
|
||||
autotests = false
|
||||
autobenches = false
|
||||
description = "A Rust interface to the user-space API of the Mach 3.0 kernel that underlies OSX."
|
||||
readme = "README.md"
|
||||
keywords = [
|
||||
@@ -35,15 +41,12 @@ license = "BSD-2-Clause OR MIT OR Apache-2.0"
|
||||
repository = "https://github.com/JohnTitor/mach2"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
default-target = "x86_64-apple-darwin"
|
||||
default-target = "aarch64-apple-darwin"
|
||||
|
||||
[features]
|
||||
default = []
|
||||
unstable = []
|
||||
|
||||
[target."cfg(any(target_os = \"macos\", target_os = \"ios\"))".dependencies.libc]
|
||||
version = "0.2"
|
||||
default-features = false
|
||||
|
||||
[badges.maintenance]
|
||||
status = "passively-maintained"
|
||||
[lib]
|
||||
name = "mach2"
|
||||
path = "src/lib.rs"
|
||||
|
||||
+3
-9
@@ -1,21 +1,15 @@
|
||||
[package]
|
||||
name = "mach2"
|
||||
version = "0.4.1"
|
||||
version = "0.6.0"
|
||||
license = "BSD-2-Clause OR MIT OR Apache-2.0"
|
||||
description = "A Rust interface to the user-space API of the Mach 3.0 kernel that underlies OSX."
|
||||
repository = "https://github.com/JohnTitor/mach2"
|
||||
readme = "README.md"
|
||||
keywords = ["kernel", "macos", "darwin"]
|
||||
categories = ["api-bindings", "external-ffi-bindings", "no-std", "os"]
|
||||
edition = "2015"
|
||||
edition = "2024"
|
||||
include = ["src/**/*", "LICENSE-*", "README.md"]
|
||||
|
||||
[badges]
|
||||
maintenance = { status = "passively-maintained" }
|
||||
|
||||
[target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies]
|
||||
libc = { version = "0.2", default-features = false }
|
||||
|
||||
[features]
|
||||
default = []
|
||||
# Uses newer APIs
|
||||
@@ -25,4 +19,4 @@ unstable = []
|
||||
members = ["mach-test"]
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
default-target = "x86_64-apple-darwin"
|
||||
default-target = "aarch64-apple-darwin"
|
||||
|
||||
Vendored
+35
-11
@@ -8,7 +8,7 @@ A Rust interface to the **user-space** API of the Mach 3.0 kernel exposed in
|
||||
|
||||
This library does not expose the **kernel-space** API of the Mach 3.0 kernel
|
||||
exposed in
|
||||
`SDK/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/mach`.
|
||||
`SDK/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/mach`.
|
||||
|
||||
That is, if you are writing a kernel-resident device drivers or some other
|
||||
kernel extensions you have to use something else. The user-space kernel API is
|
||||
@@ -22,8 +22,8 @@ Add the following to your `Cargo.toml` to conditionally include mach on those
|
||||
platforms that support it.
|
||||
|
||||
```toml
|
||||
[target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies.mach]
|
||||
version = "0.4"
|
||||
[target.'cfg(target_vendor = "apple")'.dependencies.mach]
|
||||
version = "0.6"
|
||||
```
|
||||
|
||||
Available crate feature:
|
||||
@@ -31,7 +31,6 @@ Available crate feature:
|
||||
* **unstable** (disabled by default): Exposes newly changed APIs. Enabling this may
|
||||
bring breaking changes (see the breaking change policy).
|
||||
|
||||
|
||||
### Breaking change policy
|
||||
|
||||
We do the following steps when an item is changed/removed on latest toolchain:
|
||||
@@ -46,17 +45,42 @@ we expose the newer one, i.e. `4`, under `unstable` first.
|
||||
So the `unstable` users should notice the change on the first release since deprecating.
|
||||
After a month or more, all the users should notice it.
|
||||
|
||||
## Examples
|
||||
|
||||
Examples can be found in the [examples](./examples) directory of this repository.
|
||||
|
||||
Since [`examples/dump_process_registers.rs`](./examples/dump_process_registers.rs) makes use of the `task_for_pid()` function, which requires elevated privileges, it is necessary to disable System Integrity Protection (SIP) and to be part of the `admin` or `_developer` group in order to run the example. However, do note that disabling SIP is in no way encouraged, and should only be done for development/debugging purposes.
|
||||
|
||||
1. Reboot macOS in recovery mode.
|
||||
2. Click on `Options`.
|
||||
3. Log in to your user.
|
||||
4. In the menu click on `Utilities` and then `Terminal`.
|
||||
5. In the terminal type the following command to disable SIP: `csrutil disable` (`csrutil enable` to re-enable SIP).
|
||||
6. Reboot your machine.
|
||||
|
||||
To run the example, build it as follows:
|
||||
|
||||
```
|
||||
cargo b --example dump_process_registers
|
||||
```
|
||||
|
||||
Then run it using `sudo`:
|
||||
|
||||
```
|
||||
sudo ./target/debug/examples/dump_process_registers
|
||||
```
|
||||
|
||||
## Platform support
|
||||
|
||||
The following table describes the current CI set-up:
|
||||
|
||||
| Target | Min. Rust | XCode | build | ctest | run |
|
||||
|-------------------------|-----------|-----------------|-------|-------|-----|
|
||||
| `x86_64-apple-darwin` | 1.33.0 | 10.3.0 - 13.1.0 | ✓ | ✓ | ✓ |
|
||||
| `aarch64-apple-darwin` | nightly | 13.1.0 | ✓ | - | - |
|
||||
| `aarch64-apple-ios` | nightly | 13.1.0 | ✓ | - | - |
|
||||
| `aarch64-apple-ios-sim` | nightly | 13.1.0 | ✓ | - | - |
|
||||
| `x86_64-apple-ios` | nightly | 13.1.0 | ✓ | - | - |
|
||||
| Target | XCode | build | ctest | run |
|
||||
|-------------------------|--------|-------|-------|-----|
|
||||
| `x86_64-apple-darwin` | 26.1.0 | ✓ | ✓ | ✓ |
|
||||
| `aarch64-apple-darwin` | 26.1.0 | ✓ | ✓ | ✓ |
|
||||
| `aarch64-apple-ios` | 26.1.0 | ✓ | - | - |
|
||||
| `aarch64-apple-ios-sim` | 26.1.0 | ✓ | - | - |
|
||||
| `x86_64-apple-ios` | 26.1.0 | ✓ | - | - |
|
||||
|
||||
## License
|
||||
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
//! This module corresponds to `mach/i386/boolean.h`.
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
pub type boolean_t = ::libc::c_uint;
|
||||
pub type boolean_t = core::ffi::c_uint;
|
||||
|
||||
#[cfg(not(target_arch = "x86_64"))]
|
||||
pub type boolean_t = ::libc::c_int;
|
||||
pub type boolean_t = core::ffi::c_int;
|
||||
|
||||
+31
-30
@@ -1,42 +1,43 @@
|
||||
//! This module corresponds to `bootstrap.h`
|
||||
|
||||
use boolean::boolean_t;
|
||||
use kern_return::kern_return_t;
|
||||
use port::mach_port_t;
|
||||
use crate::boolean::boolean_t;
|
||||
use crate::kern_return::kern_return_t;
|
||||
use crate::port::mach_port_t;
|
||||
use core::ffi::{c_char, c_int, c_uint};
|
||||
|
||||
pub const BOOTSTRAP_MAX_NAME_LEN: ::libc::c_uint = 128;
|
||||
pub const BOOTSTRAP_MAX_CMD_LEN: ::libc::c_uint = 512;
|
||||
pub const BOOTSTRAP_MAX_NAME_LEN: c_uint = 128;
|
||||
pub const BOOTSTRAP_MAX_CMD_LEN: c_uint = 512;
|
||||
|
||||
pub const BOOTSTRAP_MAX_LOOKUP_COUNT: ::libc::c_uint = 20;
|
||||
pub const BOOTSTRAP_MAX_LOOKUP_COUNT: c_uint = 20;
|
||||
|
||||
pub const BOOTSTRAP_SUCCESS: ::libc::c_uint = 0;
|
||||
pub const BOOTSTRAP_NOT_PRIVILEGED: ::libc::c_uint = 1100;
|
||||
pub const BOOTSTRAP_NAME_IN_USE: ::libc::c_uint = 1101;
|
||||
pub const BOOTSTRAP_UNKNOWN_SERVICE: ::libc::c_uint = 1102;
|
||||
pub const BOOTSTRAP_SERVICE_ACTIVE: ::libc::c_uint = 1103;
|
||||
pub const BOOTSTRAP_BAD_COUNT: ::libc::c_uint = 1104;
|
||||
pub const BOOTSTRAP_NO_MEMORY: ::libc::c_uint = 1105;
|
||||
pub const BOOTSTRAP_NO_CHILDREN: ::libc::c_uint = 1106;
|
||||
pub const BOOTSTRAP_SUCCESS: c_uint = 0;
|
||||
pub const BOOTSTRAP_NOT_PRIVILEGED: c_uint = 1100;
|
||||
pub const BOOTSTRAP_NAME_IN_USE: c_uint = 1101;
|
||||
pub const BOOTSTRAP_UNKNOWN_SERVICE: c_uint = 1102;
|
||||
pub const BOOTSTRAP_SERVICE_ACTIVE: c_uint = 1103;
|
||||
pub const BOOTSTRAP_BAD_COUNT: c_uint = 1104;
|
||||
pub const BOOTSTRAP_NO_MEMORY: c_uint = 1105;
|
||||
pub const BOOTSTRAP_NO_CHILDREN: c_uint = 1106;
|
||||
|
||||
pub const BOOTSTRAP_STATUS_INACTIVE: ::libc::c_uint = 0;
|
||||
pub const BOOTSTRAP_STATUS_ACTIVE: ::libc::c_uint = 1;
|
||||
pub const BOOTSTRAP_STATUS_ON_DEMAND: ::libc::c_uint = 2;
|
||||
pub const BOOTSTRAP_STATUS_INACTIVE: c_uint = 0;
|
||||
pub const BOOTSTRAP_STATUS_ACTIVE: c_uint = 1;
|
||||
pub const BOOTSTRAP_STATUS_ON_DEMAND: c_uint = 2;
|
||||
|
||||
pub type name_t = [::libc::c_char; 128];
|
||||
pub type cmd_t = [::libc::c_char; 512];
|
||||
pub type name_t = [c_char; 128];
|
||||
pub type cmd_t = [c_char; 512];
|
||||
pub type name_array_t = *mut name_t;
|
||||
pub type bootstrap_status_t = ::libc::c_int;
|
||||
pub type bootstrap_status_t = c_int;
|
||||
pub type bootstrap_status_array_t = *mut bootstrap_status_t;
|
||||
pub type bootstrap_property_t = ::libc::c_uint;
|
||||
pub type bootstrap_property_t = c_uint;
|
||||
pub type bootstrap_property_array_t = *mut bootstrap_property_t;
|
||||
pub type bool_array_t = *mut boolean_t;
|
||||
|
||||
extern "C" {
|
||||
unsafe extern "C" {
|
||||
pub static bootstrap_port: mach_port_t;
|
||||
pub fn bootstrap_create_server(
|
||||
bp: mach_port_t,
|
||||
server_cmd: *mut ::libc::c_char,
|
||||
server_uid: ::libc::uid_t,
|
||||
server_cmd: *mut c_char,
|
||||
server_uid: c_uint,
|
||||
on_demand: boolean_t,
|
||||
server_port: *mut mach_port_t,
|
||||
) -> kern_return_t;
|
||||
@@ -49,28 +50,28 @@ extern "C" {
|
||||
pub fn bootstrap_parent(bp: mach_port_t, parent_port: *mut mach_port_t) -> kern_return_t;
|
||||
pub fn bootstrap_register(
|
||||
bp: mach_port_t,
|
||||
service_name: *mut ::libc::c_char,
|
||||
service_name: *mut c_char,
|
||||
sp: mach_port_t,
|
||||
) -> kern_return_t;
|
||||
pub fn bootstrap_create_service(
|
||||
bp: mach_port_t,
|
||||
service_name: *mut ::libc::c_char,
|
||||
service_name: *mut c_char,
|
||||
sp: *mut mach_port_t,
|
||||
) -> kern_return_t;
|
||||
pub fn bootstrap_check_in(
|
||||
bp: mach_port_t,
|
||||
service_name: *const ::libc::c_char,
|
||||
service_name: *const c_char,
|
||||
sp: *mut mach_port_t,
|
||||
) -> kern_return_t;
|
||||
pub fn bootstrap_look_up(
|
||||
bp: mach_port_t,
|
||||
service_name: *const ::libc::c_char,
|
||||
service_name: *const c_char,
|
||||
sp: *mut mach_port_t,
|
||||
) -> kern_return_t;
|
||||
pub fn bootstrap_status(
|
||||
bp: mach_port_t,
|
||||
service_name: *mut ::libc::c_char,
|
||||
service_name: *mut c_char,
|
||||
service_active: *mut bootstrap_status_t,
|
||||
) -> kern_return_t;
|
||||
pub fn bootstrap_strerror(r: kern_return_t) -> *const ::libc::c_char;
|
||||
pub fn bootstrap_strerror(r: kern_return_t) -> *const c_char;
|
||||
}
|
||||
|
||||
Vendored
+7
-7
@@ -1,13 +1,13 @@
|
||||
//! This module roughly corresponds to `mach/clock.h`.
|
||||
use crate::clock_types::{alarm_type_t, clock_attr_t, clock_flavor_t, mach_timespec_t};
|
||||
use crate::kern_return::kern_return_t;
|
||||
use crate::mach_types::{clock_reply_t, clock_serv_t};
|
||||
use crate::message::mach_msg_type_number_t;
|
||||
use core::ffi::c_uint;
|
||||
|
||||
pub const clock_MSG_COUNT: ::libc::c_uint = 3;
|
||||
pub const clock_MSG_COUNT: c_uint = 3;
|
||||
|
||||
use clock_types::{alarm_type_t, clock_attr_t, clock_flavor_t, mach_timespec_t};
|
||||
use kern_return::kern_return_t;
|
||||
use mach_types::{clock_reply_t, clock_serv_t};
|
||||
use message::mach_msg_type_number_t;
|
||||
|
||||
extern "C" {
|
||||
unsafe extern "C" {
|
||||
pub fn clock_get_time(
|
||||
clock_serv: clock_serv_t,
|
||||
cur_time: *mut mach_timespec_t,
|
||||
|
||||
+5
-5
@@ -1,11 +1,11 @@
|
||||
//! This module roughly corresponds to `mach/clock_priv.h`.
|
||||
|
||||
use clock_types::{clock_attr_t, clock_flavor_t, mach_timespec_t};
|
||||
use kern_return::kern_return_t;
|
||||
use mach_types::clock_ctrl_t;
|
||||
use message::mach_msg_type_number_t;
|
||||
use crate::clock_types::{clock_attr_t, clock_flavor_t, mach_timespec_t};
|
||||
use crate::kern_return::kern_return_t;
|
||||
use crate::mach_types::clock_ctrl_t;
|
||||
use crate::message::mach_msg_type_number_t;
|
||||
|
||||
extern "C" {
|
||||
unsafe extern "C" {
|
||||
pub fn clock_set_time(clock_ctrl: clock_ctrl_t, new_time: mach_timespec_t) -> kern_return_t;
|
||||
pub fn clock_set_attributes(
|
||||
clock_ctrl: clock_ctrl_t,
|
||||
|
||||
+5
-5
@@ -1,11 +1,11 @@
|
||||
//! This module roughly corresponds to `mach/clock_reply.h`.
|
||||
|
||||
use clock_types::{alarm_type_t, mach_timespec_t};
|
||||
use kern_return::kern_return_t;
|
||||
use mach_types::clock_reply_t;
|
||||
use message::mach_msg_type_name_t;
|
||||
use crate::clock_types::{alarm_type_t, mach_timespec_t};
|
||||
use crate::kern_return::kern_return_t;
|
||||
use crate::mach_types::clock_reply_t;
|
||||
use crate::message::mach_msg_type_name_t;
|
||||
|
||||
extern "C" {
|
||||
unsafe extern "C" {
|
||||
pub fn clock_alarm_reply(
|
||||
alarm_port: clock_reply_t,
|
||||
alarm_portPoly: mach_msg_type_name_t,
|
||||
|
||||
+29
-28
@@ -1,55 +1,56 @@
|
||||
//! This module roughly corresponds to `mach/clock_types.h`.
|
||||
use core::ffi::{c_int, c_uint, c_ulonglong};
|
||||
|
||||
pub type alarm_type_t = ::libc::c_int;
|
||||
pub type sleep_type_t = ::libc::c_int;
|
||||
pub type clock_id_t = ::libc::c_int;
|
||||
pub type clock_flavor_t = ::libc::c_int;
|
||||
pub type clock_attr_t = *mut ::libc::c_int;
|
||||
pub type clock_res_t = ::libc::c_int;
|
||||
pub type alarm_type_t = c_int;
|
||||
pub type sleep_type_t = c_int;
|
||||
pub type clock_id_t = c_int;
|
||||
pub type clock_flavor_t = c_int;
|
||||
pub type clock_attr_t = *mut c_int;
|
||||
pub type clock_res_t = c_int;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct mach_timespec {
|
||||
pub tv_sec: ::libc::c_uint,
|
||||
pub tv_sec: c_uint,
|
||||
pub tv_nsec: clock_res_t,
|
||||
}
|
||||
pub type mach_timespec_t = mach_timespec;
|
||||
|
||||
pub const SYSTEM_CLOCK: ::libc::c_uint = 0;
|
||||
pub const CALENDAR_CLOCK: ::libc::c_uint = 1;
|
||||
pub const REALTIME_CLOCK: ::libc::c_uint = 0;
|
||||
pub const SYSTEM_CLOCK: c_uint = 0;
|
||||
pub const CALENDAR_CLOCK: c_uint = 1;
|
||||
pub const REALTIME_CLOCK: c_uint = 0;
|
||||
|
||||
pub const CLOCK_GET_TIME_RES: ::libc::c_uint = 1;
|
||||
pub const CLOCK_ALARM_CURRES: ::libc::c_uint = 3;
|
||||
pub const CLOCK_ALARM_MINRES: ::libc::c_uint = 4;
|
||||
pub const CLOCK_ALARM_MAXRES: ::libc::c_uint = 5;
|
||||
pub const CLOCK_GET_TIME_RES: c_uint = 1;
|
||||
pub const CLOCK_ALARM_CURRES: c_uint = 3;
|
||||
pub const CLOCK_ALARM_MINRES: c_uint = 4;
|
||||
pub const CLOCK_ALARM_MAXRES: c_uint = 5;
|
||||
|
||||
pub const NSEC_PER_USEC: ::libc::c_ulonglong = 1000;
|
||||
pub const USEC_PER_SEC: ::libc::c_ulonglong = 1_000_000;
|
||||
pub const NSEC_PER_SEC: ::libc::c_ulonglong = 1_000_000_000;
|
||||
pub const NSEC_PER_MSEC: ::libc::c_ulonglong = 1_000_000;
|
||||
pub const NSEC_PER_USEC: c_ulonglong = 1000;
|
||||
pub const USEC_PER_SEC: c_ulonglong = 1_000_000;
|
||||
pub const NSEC_PER_SEC: c_ulonglong = 1_000_000_000;
|
||||
pub const NSEC_PER_MSEC: c_ulonglong = 1_000_000;
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
pub fn BAD_MACH_TIMESPEC(t: mach_timespec) -> bool {
|
||||
t.tv_nsec < 0 || (t.tv_nsec as ::libc::c_ulonglong) >= NSEC_PER_SEC
|
||||
t.tv_nsec < 0 || (t.tv_nsec as c_ulonglong) >= NSEC_PER_SEC
|
||||
}
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
pub fn CMP_MACH_TIMESPEC(t1: &mach_timespec, t2: &mach_timespec) -> ::libc::c_ulonglong {
|
||||
pub fn CMP_MACH_TIMESPEC(t1: &mach_timespec, t2: &mach_timespec) -> c_ulonglong {
|
||||
if t1.tv_sec > t2.tv_sec {
|
||||
return NSEC_PER_SEC;
|
||||
}
|
||||
if t1.tv_sec < t2.tv_sec {
|
||||
return !NSEC_PER_SEC;
|
||||
}
|
||||
(t1.tv_nsec as ::libc::c_ulonglong) - (t2.tv_nsec as ::libc::c_ulonglong)
|
||||
(t1.tv_nsec as c_ulonglong) - (t2.tv_nsec as c_ulonglong)
|
||||
}
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
pub fn ADD_MACH_TIMESPEC(t1: &mut mach_timespec, t2: &mach_timespec) {
|
||||
t1.tv_nsec += t2.tv_nsec;
|
||||
if (t1.tv_nsec as ::libc::c_ulonglong) >= NSEC_PER_SEC {
|
||||
t1.tv_nsec = (t1.tv_nsec as ::libc::c_ulonglong - NSEC_PER_SEC) as clock_res_t;
|
||||
if (t1.tv_nsec as c_ulonglong) >= NSEC_PER_SEC {
|
||||
t1.tv_nsec = (t1.tv_nsec as c_ulonglong - NSEC_PER_SEC) as clock_res_t;
|
||||
t1.tv_sec += 1;
|
||||
}
|
||||
t1.tv_sec += t2.tv_sec;
|
||||
@@ -59,17 +60,17 @@ pub fn ADD_MACH_TIMESPEC(t1: &mut mach_timespec, t2: &mach_timespec) {
|
||||
pub fn SUB_MACH_TIMESPEC(t1: &mut mach_timespec, t2: &mach_timespec) {
|
||||
t1.tv_nsec -= t2.tv_nsec;
|
||||
if t1.tv_nsec < 0 {
|
||||
t1.tv_nsec = (t1.tv_nsec as ::libc::c_ulonglong + NSEC_PER_SEC) as clock_res_t;
|
||||
t1.tv_nsec = (t1.tv_nsec as c_ulonglong + NSEC_PER_SEC) as clock_res_t;
|
||||
t1.tv_sec -= 1;
|
||||
}
|
||||
t1.tv_sec -= t2.tv_sec;
|
||||
}
|
||||
|
||||
pub const ALRMTYPE: ::libc::c_uint = 0xff;
|
||||
pub const TIME_ABSOLUTE: ::libc::c_uint = 0x00;
|
||||
pub const TIME_RELATIVE: ::libc::c_uint = 0x01;
|
||||
pub const ALRMTYPE: c_uint = 0xff;
|
||||
pub const TIME_ABSOLUTE: c_uint = 0x00;
|
||||
pub const TIME_RELATIVE: c_uint = 0x01;
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
pub fn BAD_ALRMTYPE(t: ::libc::c_uint) -> bool {
|
||||
pub fn BAD_ALRMTYPE(t: c_uint) -> bool {
|
||||
t & (!TIME_RELATIVE) != 0
|
||||
}
|
||||
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
//! This module roughly corresponds to `mach-o/dyld.h`.
|
||||
|
||||
use crate::loader::mach_header;
|
||||
use core::ffi::c_char;
|
||||
|
||||
unsafe extern "C" {
|
||||
pub fn _dyld_image_count() -> u32;
|
||||
pub fn _dyld_get_image_header(image_index: u32) -> *const mach_header;
|
||||
pub fn _dyld_get_image_vmaddr_slide(image_index: u32) -> isize;
|
||||
pub fn _dyld_get_image_name(image_index: u32) -> *const c_char;
|
||||
}
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
//! This module roughly corresponds to `mach/dyld_kernel.h`.
|
||||
|
||||
use boolean::boolean_t;
|
||||
use mach_types::{fsid_t, fsobj_id_t, uuid_t};
|
||||
use crate::boolean::boolean_t;
|
||||
use crate::mach_types::{fsid_t, fsobj_id_t, uuid_t};
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
|
||||
Vendored
+57
@@ -0,0 +1,57 @@
|
||||
//! This module corresponds to `mach/error.h`.
|
||||
|
||||
use crate::kern_return::kern_return_t;
|
||||
use core::ffi::c_int;
|
||||
|
||||
pub type mach_error_t = kern_return_t;
|
||||
pub type mach_error_fn_t = Option<unsafe extern "C" fn() -> mach_error_t>;
|
||||
|
||||
pub const err_none: mach_error_t = 0;
|
||||
pub const ERR_SUCCESS: mach_error_t = err_none;
|
||||
pub const ERR_ROUTINE_NIL: mach_error_fn_t = None;
|
||||
|
||||
#[inline]
|
||||
pub const fn err_system(x: c_int) -> mach_error_t {
|
||||
(((x as u32) & 0x3f) << 26) as mach_error_t
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub const fn err_sub(x: c_int) -> mach_error_t {
|
||||
(((x as u32) & 0xfff) << 14) as mach_error_t
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub const fn err_get_system(err: mach_error_t) -> c_int {
|
||||
(((err as u32) >> 26) & 0x3f) as c_int
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub const fn err_get_sub(err: mach_error_t) -> c_int {
|
||||
(((err as u32) >> 14) & 0xfff) as c_int
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub const fn err_get_code(err: mach_error_t) -> c_int {
|
||||
((err as u32) & 0x3fff) as c_int
|
||||
}
|
||||
|
||||
pub const system_emask: mach_error_t = err_system(0x3f);
|
||||
pub const sub_emask: mach_error_t = err_sub(0xfff);
|
||||
pub const code_emask: mach_error_t = 0x3fff;
|
||||
|
||||
pub const err_kern: mach_error_t = err_system(0x0);
|
||||
pub const err_us: mach_error_t = err_system(0x1);
|
||||
pub const err_server: mach_error_t = err_system(0x2);
|
||||
pub const err_ipc: mach_error_t = err_system(0x3);
|
||||
pub const err_mach_ipc: mach_error_t = err_system(0x4);
|
||||
pub const err_dipc: mach_error_t = err_system(0x7);
|
||||
pub const err_vm: mach_error_t = err_system(0x8);
|
||||
pub const err_local: mach_error_t = err_system(0x3e);
|
||||
pub const err_ipc_compat: mach_error_t = err_system(0x3f);
|
||||
|
||||
pub const err_max_system: c_int = 0x3f;
|
||||
|
||||
#[inline]
|
||||
pub const fn unix_err(errno: mach_error_t) -> mach_error_t {
|
||||
err_kern | err_sub(3) | errno
|
||||
}
|
||||
Vendored
+39
-9
@@ -1,14 +1,19 @@
|
||||
//! This module roughly corresponds to `mach/exc.h`.
|
||||
|
||||
use exception_types::{exception_data_t, exception_type_t};
|
||||
use kern_return::kern_return_t;
|
||||
use message::mach_msg_type_number_t;
|
||||
use port::mach_port_t;
|
||||
use thread_status::thread_state_t;
|
||||
use crate::exception_types::{exception_data_t, exception_type_t};
|
||||
use crate::kern_return::kern_return_t;
|
||||
use crate::message::{
|
||||
mach_msg_body_t, mach_msg_header_t, mach_msg_port_descriptor_t, mach_msg_type_number_t,
|
||||
};
|
||||
use crate::ndr::NDR_record_t;
|
||||
use crate::port::mach_port_t;
|
||||
use crate::thread_status::thread_state_t;
|
||||
use crate::vm_types::integer_t;
|
||||
use core::ffi::{c_int, c_uint};
|
||||
|
||||
pub const exc_MSG_COUNT: ::libc::c_uint = 3;
|
||||
pub const exc_MSG_COUNT: c_uint = 3;
|
||||
|
||||
extern "C" {
|
||||
unsafe extern "C" {
|
||||
pub fn exception_raise(
|
||||
exception_port: mach_port_t,
|
||||
thread: mach_port_t,
|
||||
@@ -22,7 +27,7 @@ extern "C" {
|
||||
exception: exception_type_t,
|
||||
code: exception_data_t,
|
||||
codeCnt: mach_msg_type_number_t,
|
||||
flavor: *mut ::libc::c_int,
|
||||
flavor: *mut c_int,
|
||||
old_state: thread_state_t,
|
||||
old_stateCnt: mach_msg_type_number_t,
|
||||
new_state: thread_state_t,
|
||||
@@ -35,10 +40,35 @@ extern "C" {
|
||||
exception: exception_type_t,
|
||||
code: exception_data_t,
|
||||
codeCnt: mach_msg_type_number_t,
|
||||
flavor: *mut ::libc::c_int,
|
||||
flavor: *mut c_int,
|
||||
old_state: thread_state_t,
|
||||
old_stateCnt: mach_msg_type_number_t,
|
||||
new_state: thread_state_t,
|
||||
new_stateCnt: *mut mach_msg_type_number_t,
|
||||
) -> kern_return_t;
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[allow(dead_code, non_snake_case)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub struct __Request__exception_raise_t {
|
||||
pub Head: mach_msg_header_t,
|
||||
/* start of the kernel processed data */
|
||||
pub msgh_body: mach_msg_body_t,
|
||||
pub thread: mach_msg_port_descriptor_t,
|
||||
pub task: mach_msg_port_descriptor_t,
|
||||
/* end of the kernel processed data */
|
||||
pub NDR: NDR_record_t,
|
||||
pub exception: exception_type_t,
|
||||
pub codeCnt: mach_msg_type_number_t,
|
||||
pub code: [integer_t; 2],
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[allow(dead_code, non_snake_case)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub struct __Reply__exception_raise_t {
|
||||
pub Head: mach_msg_header_t,
|
||||
pub NDR: NDR_record_t,
|
||||
pub RetCode: kern_return_t,
|
||||
}
|
||||
|
||||
+42
-42
@@ -1,53 +1,53 @@
|
||||
//! This module roughly corresponds to `mach/exception_types.h`.
|
||||
|
||||
use port::mach_port_t;
|
||||
use thread_status::thread_state_flavor_t;
|
||||
use vm_types::integer_t;
|
||||
use crate::port::mach_port_t;
|
||||
use crate::thread_status::thread_state_flavor_t;
|
||||
use crate::vm_types::integer_t;
|
||||
use core::ffi::{c_int, c_uint};
|
||||
|
||||
pub const EXC_BAD_ACCESS: ::libc::c_uint = 1;
|
||||
pub const EXC_BAD_INSTRUCTION: ::libc::c_uint = 2;
|
||||
pub const EXC_ARITHMETIC: ::libc::c_uint = 3;
|
||||
pub const EXC_EMULATION: ::libc::c_uint = 4;
|
||||
pub const EXC_SOFTWARE: ::libc::c_uint = 5;
|
||||
pub const EXC_BREAKPOINT: ::libc::c_uint = 6;
|
||||
pub const EXC_SYSCALL: ::libc::c_uint = 7;
|
||||
pub const EXC_MACH_SYSCALL: ::libc::c_uint = 8;
|
||||
pub const EXC_RPC_ALERT: ::libc::c_uint = 9;
|
||||
pub const EXC_CRASH: ::libc::c_uint = 10;
|
||||
pub const EXC_RESOURCE: ::libc::c_uint = 11;
|
||||
pub const EXC_GUARD: ::libc::c_uint = 12;
|
||||
pub const EXC_CORPSE_NOTIFY: ::libc::c_uint = 13;
|
||||
pub const EXC_CORPSE_VARIANT_BIT: ::libc::c_uint = 256;
|
||||
pub const EXCEPTION_DEFAULT: ::libc::c_uint = 1;
|
||||
pub const EXCEPTION_STATE: ::libc::c_uint = 2;
|
||||
pub const EXCEPTION_STATE_IDENTITY: ::libc::c_uint = 3;
|
||||
pub const MACH_EXCEPTION_CODES: ::libc::c_uint = 2_147_483_648;
|
||||
pub const EXC_MASK_BAD_ACCESS: ::libc::c_uint = 2;
|
||||
pub const EXC_MASK_BAD_INSTRUCTION: ::libc::c_uint = 4;
|
||||
pub const EXC_MASK_ARITHMETIC: ::libc::c_uint = 8;
|
||||
pub const EXC_MASK_EMULATION: ::libc::c_uint = 16;
|
||||
pub const EXC_MASK_SOFTWARE: ::libc::c_uint = 32;
|
||||
pub const EXC_MASK_BREAKPOINT: ::libc::c_uint = 64;
|
||||
pub const EXC_MASK_SYSCALL: ::libc::c_uint = 128;
|
||||
pub const EXC_MASK_MACH_SYSCALL: ::libc::c_uint = 256;
|
||||
pub const EXC_MASK_RPC_ALERT: ::libc::c_uint = 512;
|
||||
pub const EXC_MASK_CRASH: ::libc::c_uint = 1024;
|
||||
pub const EXC_MASK_RESOURCE: ::libc::c_uint = 2048;
|
||||
pub const EXC_MASK_GUARD: ::libc::c_uint = 4096;
|
||||
pub const EXC_MASK_CORPSE_NOTIFY: ::libc::c_uint = 8192;
|
||||
pub const EXC_MASK_ALL: ::libc::c_uint = 7166;
|
||||
pub const FIRST_EXCEPTION: ::libc::c_uint = 1;
|
||||
pub const EXC_SOFT_SIGNAL: ::libc::c_uint = 65_539;
|
||||
pub const EXC_MACF_MIN: ::libc::c_uint = 131_072;
|
||||
pub const EXC_MACF_MAX: ::libc::c_uint = 196_607;
|
||||
pub const EXC_BAD_ACCESS: c_uint = 1;
|
||||
pub const EXC_BAD_INSTRUCTION: c_uint = 2;
|
||||
pub const EXC_ARITHMETIC: c_uint = 3;
|
||||
pub const EXC_EMULATION: c_uint = 4;
|
||||
pub const EXC_SOFTWARE: c_uint = 5;
|
||||
pub const EXC_BREAKPOINT: c_uint = 6;
|
||||
pub const EXC_SYSCALL: c_uint = 7;
|
||||
pub const EXC_MACH_SYSCALL: c_uint = 8;
|
||||
pub const EXC_RPC_ALERT: c_uint = 9;
|
||||
pub const EXC_CRASH: c_uint = 10;
|
||||
pub const EXC_RESOURCE: c_uint = 11;
|
||||
pub const EXC_GUARD: c_uint = 12;
|
||||
pub const EXC_CORPSE_NOTIFY: c_uint = 13;
|
||||
pub const EXCEPTION_DEFAULT: c_uint = 1;
|
||||
pub const EXCEPTION_STATE: c_uint = 2;
|
||||
pub const EXCEPTION_STATE_IDENTITY: c_uint = 3;
|
||||
pub const MACH_EXCEPTION_CODES: c_uint = 2_147_483_648;
|
||||
pub const EXC_MASK_BAD_ACCESS: c_uint = 2;
|
||||
pub const EXC_MASK_BAD_INSTRUCTION: c_uint = 4;
|
||||
pub const EXC_MASK_ARITHMETIC: c_uint = 8;
|
||||
pub const EXC_MASK_EMULATION: c_uint = 16;
|
||||
pub const EXC_MASK_SOFTWARE: c_uint = 32;
|
||||
pub const EXC_MASK_BREAKPOINT: c_uint = 64;
|
||||
pub const EXC_MASK_SYSCALL: c_uint = 128;
|
||||
pub const EXC_MASK_MACH_SYSCALL: c_uint = 256;
|
||||
pub const EXC_MASK_RPC_ALERT: c_uint = 512;
|
||||
pub const EXC_MASK_CRASH: c_uint = 1024;
|
||||
pub const EXC_MASK_RESOURCE: c_uint = 2048;
|
||||
pub const EXC_MASK_GUARD: c_uint = 4096;
|
||||
pub const EXC_MASK_CORPSE_NOTIFY: c_uint = 8192;
|
||||
pub const EXC_MASK_ALL: c_uint = 7166;
|
||||
pub const FIRST_EXCEPTION: c_uint = 1;
|
||||
pub const EXC_SOFT_SIGNAL: c_uint = 65_539;
|
||||
pub const EXC_MACF_MIN: c_uint = 131_072;
|
||||
pub const EXC_MACF_MAX: c_uint = 196_607;
|
||||
|
||||
pub type exception_type_t = ::libc::c_int;
|
||||
pub type exception_type_t = c_int;
|
||||
pub type exception_data_type_t = integer_t;
|
||||
pub type mach_exception_data_type_t = i64;
|
||||
pub type exception_behavior_t = ::libc::c_int;
|
||||
pub type exception_behavior_t = c_int;
|
||||
pub type exception_data_t = *mut exception_data_type_t;
|
||||
pub type mach_exception_data_t = *mut mach_exception_data_type_t;
|
||||
pub type exception_mask_t = ::libc::c_uint;
|
||||
pub type exception_mask_t = c_uint;
|
||||
pub type exception_mask_array_t = *mut exception_mask_t;
|
||||
pub type exception_behavior_array_t = *mut exception_behavior_t;
|
||||
pub type exception_flavor_array_t = *mut thread_state_flavor_t;
|
||||
|
||||
+5
-3
@@ -1,7 +1,9 @@
|
||||
//! This module corresponds to `mach/kern_return.h` and
|
||||
//! `mach/i386/kern_return.h`.
|
||||
//! This module corresponds to `mach/kern_return.h`.
|
||||
use core::ffi::c_int;
|
||||
|
||||
pub type kern_return_t = ::libc::c_int;
|
||||
// ...Except for this particular type, which is taken from `mach/i386/kern_return.h` and
|
||||
// `mach/arm/kern_return.h` (also used for aarch64): it is the same type in both header files.
|
||||
pub type kern_return_t = c_int;
|
||||
|
||||
pub const KERN_SUCCESS: kern_return_t = 0;
|
||||
pub const KERN_INVALID_ADDRESS: kern_return_t = 1;
|
||||
|
||||
Vendored
+20
-6
@@ -10,10 +10,8 @@
|
||||
)]
|
||||
#![no_std]
|
||||
|
||||
#[cfg(not(any(target_os = "macos", target_os = "ios")))]
|
||||
compile_error!("mach requires macOS or iOS");
|
||||
|
||||
extern crate libc;
|
||||
#[cfg(not(target_vendor = "apple"))]
|
||||
compile_error!("mach requires macOS, iOS, tvOS, watchOS or visionOS");
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use core::{clone, cmp, default, fmt, hash, marker, mem, option};
|
||||
@@ -23,25 +21,41 @@ pub mod bootstrap;
|
||||
pub mod clock;
|
||||
pub mod clock_priv;
|
||||
pub mod clock_reply;
|
||||
pub mod clock_types; // TODO: test
|
||||
pub mod clock_types;
|
||||
pub mod dyld;
|
||||
pub mod dyld_kernel;
|
||||
// pub mod error; // TODO
|
||||
pub mod error;
|
||||
pub mod exc;
|
||||
pub mod exception_types;
|
||||
pub mod kern_return;
|
||||
pub mod loader;
|
||||
pub mod mach_debug;
|
||||
pub mod mach_init;
|
||||
pub mod mach_port;
|
||||
pub mod mach_time;
|
||||
pub mod mach_types;
|
||||
pub mod mach_voucher_types;
|
||||
pub mod memory_object_types;
|
||||
pub mod message;
|
||||
pub mod mig;
|
||||
pub mod ndr;
|
||||
pub mod notify;
|
||||
pub mod policy;
|
||||
pub mod port;
|
||||
pub mod semaphore;
|
||||
pub mod structs;
|
||||
pub mod sync_policy;
|
||||
pub mod task;
|
||||
pub mod task_info;
|
||||
pub mod task_inspect;
|
||||
pub mod task_special_ports;
|
||||
pub mod thread_act;
|
||||
pub mod thread_policy;
|
||||
pub mod thread_special_ports;
|
||||
pub mod thread_state;
|
||||
pub mod thread_status;
|
||||
pub mod thread_switch;
|
||||
pub mod time_value;
|
||||
pub mod traps;
|
||||
pub mod vm;
|
||||
pub mod vm_attributes;
|
||||
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
//! This module roughly corresponds to `mach-o/loader.h`.
|
||||
use core::ffi::c_int;
|
||||
|
||||
pub type cpu_type_t = c_int;
|
||||
pub type cpu_subtype_t = c_int;
|
||||
|
||||
#[repr(C)]
|
||||
#[allow(dead_code, non_snake_case)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub struct mach_header {
|
||||
pub magic: u32,
|
||||
pub cputype: cpu_type_t,
|
||||
pub cpusubtype: cpu_subtype_t,
|
||||
pub filetype: u32,
|
||||
pub ncmds: u32,
|
||||
pub sizeofcmds: u32,
|
||||
pub flags: u32,
|
||||
}
|
||||
+124
@@ -0,0 +1,124 @@
|
||||
//! This module corresponds to `mach_debug/ipc_info.h`.
|
||||
|
||||
use crate::port::{mach_port_name_t, mach_port_type_t, mach_port_urefs_t};
|
||||
use crate::vm_types::{integer_t, natural_t};
|
||||
|
||||
pub type ipc_info_object_type_t = natural_t;
|
||||
|
||||
pub const IPC_OTYPE_NONE: ipc_info_object_type_t = 0;
|
||||
pub const IPC_OTYPE_THREAD_CONTROL: ipc_info_object_type_t = 1;
|
||||
pub const IPC_OTYPE_TASK_CONTROL: ipc_info_object_type_t = 2;
|
||||
pub const IPC_OTYPE_HOST: ipc_info_object_type_t = 3;
|
||||
pub const IPC_OTYPE_HOST_PRIV: ipc_info_object_type_t = 4;
|
||||
pub const IPC_OTYPE_PROCESSOR: ipc_info_object_type_t = 5;
|
||||
pub const IPC_OTYPE_PROCESSOR_SET: ipc_info_object_type_t = 6;
|
||||
pub const IPC_OTYPE_PROCESSOR_SET_NAME: ipc_info_object_type_t = 7;
|
||||
pub const IPC_OTYPE_TIMER: ipc_info_object_type_t = 8;
|
||||
pub const IPC_OTYPE_PORT_SUBST_ONCE: ipc_info_object_type_t = 9;
|
||||
pub const IPC_OTYPE_MIG: ipc_info_object_type_t = 10;
|
||||
pub const IPC_OTYPE_MEMORY_OBJECT: ipc_info_object_type_t = 11;
|
||||
pub const IPC_OTYPE_XMM_PAGER: ipc_info_object_type_t = 12;
|
||||
pub const IPC_OTYPE_XMM_KERNEL: ipc_info_object_type_t = 13;
|
||||
pub const IPC_OTYPE_XMM_REPLY: ipc_info_object_type_t = 14;
|
||||
pub const IPC_OTYPE_UND_REPLY: ipc_info_object_type_t = 15;
|
||||
pub const IPC_OTYPE_HOST_NOTIFY: ipc_info_object_type_t = 16;
|
||||
pub const IPC_OTYPE_HOST_SECURITY: ipc_info_object_type_t = 17;
|
||||
pub const IPC_OTYPE_LEDGER: ipc_info_object_type_t = 18;
|
||||
pub const IPC_OTYPE_MAIN_DEVICE: ipc_info_object_type_t = 19;
|
||||
pub const IPC_OTYPE_TASK_NAME: ipc_info_object_type_t = 20;
|
||||
pub const IPC_OTYPE_SUBSYSTEM: ipc_info_object_type_t = 21;
|
||||
pub const IPC_OTYPE_IO_DONE_QUEUE: ipc_info_object_type_t = 22;
|
||||
pub const IPC_OTYPE_SEMAPHORE: ipc_info_object_type_t = 23;
|
||||
pub const IPC_OTYPE_LOCK_SET: ipc_info_object_type_t = 24;
|
||||
pub const IPC_OTYPE_CLOCK: ipc_info_object_type_t = 25;
|
||||
pub const IPC_OTYPE_CLOCK_CTRL: ipc_info_object_type_t = 26;
|
||||
pub const IPC_OTYPE_IOKIT_IDENT: ipc_info_object_type_t = 27;
|
||||
pub const IPC_OTYPE_NAMED_ENTRY: ipc_info_object_type_t = 28;
|
||||
pub const IPC_OTYPE_IOKIT_CONNECT: ipc_info_object_type_t = 29;
|
||||
pub const IPC_OTYPE_IOKIT_OBJECT: ipc_info_object_type_t = 30;
|
||||
pub const IPC_OTYPE_UPL: ipc_info_object_type_t = 31;
|
||||
pub const IPC_OTYPE_MEM_OBJ_CONTROL: ipc_info_object_type_t = 32;
|
||||
pub const IPC_OTYPE_AU_SESSIONPORT: ipc_info_object_type_t = 33;
|
||||
pub const IPC_OTYPE_FILEPORT: ipc_info_object_type_t = 34;
|
||||
pub const IPC_OTYPE_LABELH: ipc_info_object_type_t = 35;
|
||||
pub const IPC_OTYPE_TASK_RESUME: ipc_info_object_type_t = 36;
|
||||
pub const IPC_OTYPE_VOUCHER: ipc_info_object_type_t = 37;
|
||||
pub const IPC_OTYPE_VOUCHER_ATTR_CONTROL: ipc_info_object_type_t = 38;
|
||||
pub const IPC_OTYPE_WORK_INTERVAL: ipc_info_object_type_t = 39;
|
||||
pub const IPC_OTYPE_UX_HANDLER: ipc_info_object_type_t = 40;
|
||||
pub const IPC_OTYPE_UEXT_OBJECT: ipc_info_object_type_t = 41;
|
||||
pub const IPC_OTYPE_ARCADE_REG: ipc_info_object_type_t = 42;
|
||||
pub const IPC_OTYPE_EVENTLINK: ipc_info_object_type_t = 43;
|
||||
pub const IPC_OTYPE_TASK_INSPECT: ipc_info_object_type_t = 44;
|
||||
pub const IPC_OTYPE_TASK_READ: ipc_info_object_type_t = 45;
|
||||
pub const IPC_OTYPE_THREAD_INSPECT: ipc_info_object_type_t = 46;
|
||||
pub const IPC_OTYPE_THREAD_READ: ipc_info_object_type_t = 47;
|
||||
pub const IPC_OTYPE_SUID_CRED: ipc_info_object_type_t = 48;
|
||||
pub const IPC_OTYPE_HYPERVISOR: ipc_info_object_type_t = 49;
|
||||
pub const IPC_OTYPE_TASK_ID_TOKEN: ipc_info_object_type_t = 50;
|
||||
pub const IPC_OTYPE_TASK_FATAL: ipc_info_object_type_t = 51;
|
||||
pub const IPC_OTYPE_KCDATA: ipc_info_object_type_t = 52;
|
||||
pub const IPC_OTYPE_EXCLAVES_RESOURCE: ipc_info_object_type_t = 53;
|
||||
pub const IPC_OTYPE_UNKNOWN: ipc_info_object_type_t = !0;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct ipc_info_space {
|
||||
pub iis_genno_mask: natural_t,
|
||||
pub iis_table_size: natural_t,
|
||||
pub iis_table_next: natural_t,
|
||||
pub iis_tree_size: natural_t,
|
||||
pub iis_tree_small: natural_t,
|
||||
pub iis_tree_hash: natural_t,
|
||||
}
|
||||
|
||||
pub type ipc_info_space_t = ipc_info_space;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct ipc_info_space_basic {
|
||||
pub iisb_genno_mask: natural_t,
|
||||
pub iisb_table_size: natural_t,
|
||||
pub iisb_table_next: natural_t,
|
||||
pub iisb_table_inuse: natural_t,
|
||||
pub iisb_reserved: [natural_t; 2],
|
||||
}
|
||||
|
||||
pub type ipc_info_space_basic_t = ipc_info_space_basic;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct ipc_info_name {
|
||||
pub iin_name: mach_port_name_t,
|
||||
pub iin_collision: integer_t,
|
||||
pub iin_type: mach_port_type_t,
|
||||
pub iin_urefs: mach_port_urefs_t,
|
||||
pub iin_object: natural_t,
|
||||
pub iin_next: natural_t,
|
||||
pub iin_hash: natural_t,
|
||||
}
|
||||
|
||||
pub type ipc_info_name_t = ipc_info_name;
|
||||
pub type ipc_info_name_array_t = *mut ipc_info_name_t;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct ipc_info_tree_name {
|
||||
pub iitn_name: ipc_info_name_t,
|
||||
pub iitn_lchild: mach_port_name_t,
|
||||
pub iitn_rchild: mach_port_name_t,
|
||||
}
|
||||
|
||||
pub type ipc_info_tree_name_t = ipc_info_tree_name;
|
||||
pub type ipc_info_tree_name_array_t = *mut ipc_info_tree_name_t;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct ipc_info_port {
|
||||
pub iip_port_object: natural_t,
|
||||
pub iip_receiver_object: natural_t,
|
||||
}
|
||||
|
||||
pub type ipc_info_port_t = ipc_info_port;
|
||||
pub type exception_port_info_array_t = *mut ipc_info_port_t;
|
||||
pub type exception_handler_info_array_t = *mut ipc_info_port_t;
|
||||
@@ -0,0 +1,2 @@
|
||||
pub mod ipc_info;
|
||||
pub mod zone_info;
|
||||
+139
@@ -0,0 +1,139 @@
|
||||
//! This module corresponds to `mach_debug/zone_info.h`.
|
||||
|
||||
use crate::vm_types::{integer_t, vm_size_t};
|
||||
use core::ffi::c_char;
|
||||
|
||||
pub const ZONE_NAME_MAX_LEN: usize = 80;
|
||||
pub const MACH_ZONE_NAME_MAX_LEN: usize = 80;
|
||||
pub const MACH_MEMORY_INFO_NAME_MAX_LEN: usize = 80;
|
||||
pub const MAX_ZTRACE_DEPTH: usize = 15;
|
||||
|
||||
pub const ZOP_ALLOC: u32 = 1;
|
||||
pub const ZOP_FREE: u32 = 0;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub struct zone_name {
|
||||
pub zn_name: [c_char; ZONE_NAME_MAX_LEN],
|
||||
}
|
||||
|
||||
pub type zone_name_t = zone_name;
|
||||
pub type zone_name_array_t = *mut zone_name_t;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct zone_info {
|
||||
pub zi_count: integer_t,
|
||||
pub zi_cur_size: vm_size_t,
|
||||
pub zi_max_size: vm_size_t,
|
||||
pub zi_elem_size: vm_size_t,
|
||||
pub zi_alloc_size: vm_size_t,
|
||||
pub zi_pageable: integer_t,
|
||||
pub zi_sleepable: integer_t,
|
||||
pub zi_exhaustible: integer_t,
|
||||
pub zi_collectable: integer_t,
|
||||
}
|
||||
|
||||
pub type zone_info_t = zone_info;
|
||||
pub type zone_info_array_t = *mut zone_info_t;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub struct mach_zone_name {
|
||||
pub mzn_name: [c_char; ZONE_NAME_MAX_LEN],
|
||||
}
|
||||
|
||||
pub type mach_zone_name_t = mach_zone_name;
|
||||
pub type mach_zone_name_array_t = *mut mach_zone_name_t;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct mach_zone_info_data {
|
||||
pub mzi_count: u64,
|
||||
pub mzi_cur_size: u64,
|
||||
pub mzi_max_size: u64,
|
||||
pub mzi_elem_size: u64,
|
||||
pub mzi_alloc_size: u64,
|
||||
pub mzi_sum_size: u64,
|
||||
pub mzi_exhaustible: u64,
|
||||
pub mzi_collectable: u64,
|
||||
}
|
||||
|
||||
pub type mach_zone_info_t = mach_zone_info_data;
|
||||
pub type mach_zone_info_array_t = *mut mach_zone_info_t;
|
||||
|
||||
#[inline]
|
||||
pub const fn get_mzi_collectable_bytes(val: u64) -> u64 {
|
||||
val >> 1
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub const fn get_mzi_collectable_flag(val: u64) -> u64 {
|
||||
val & 1
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn set_mzi_collectable_bytes(val: &mut u64, size: u64) {
|
||||
*val = (*val & 1) | (size << 1);
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn set_mzi_collectable_flag(val: &mut u64, flag: bool) {
|
||||
if flag {
|
||||
*val |= 1;
|
||||
} else {
|
||||
*val &= !1;
|
||||
}
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct task_zone_info_data {
|
||||
pub tzi_count: u64,
|
||||
pub tzi_cur_size: u64,
|
||||
pub tzi_max_size: u64,
|
||||
pub tzi_elem_size: u64,
|
||||
pub tzi_alloc_size: u64,
|
||||
pub tzi_sum_size: u64,
|
||||
pub tzi_exhaustible: u64,
|
||||
pub tzi_collectable: u64,
|
||||
pub tzi_caller_acct: u64,
|
||||
pub tzi_task_alloc: u64,
|
||||
pub tzi_task_free: u64,
|
||||
}
|
||||
|
||||
pub type task_zone_info_t = task_zone_info_data;
|
||||
pub type task_zone_info_array_t = *mut task_zone_info_t;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[allow(non_snake_case)]
|
||||
pub struct mach_memory_info {
|
||||
pub flags: u64,
|
||||
pub site: u64,
|
||||
pub size: u64,
|
||||
pub free: u64,
|
||||
pub largest: u64,
|
||||
pub collectable_bytes: u64,
|
||||
pub mapped: u64,
|
||||
pub peak: u64,
|
||||
pub tag: u16,
|
||||
pub zone: u16,
|
||||
pub _resvA: [u16; 2],
|
||||
pub _resv: [u64; 3],
|
||||
pub name: [c_char; MACH_MEMORY_INFO_NAME_MAX_LEN],
|
||||
}
|
||||
|
||||
pub type mach_memory_info_t = mach_memory_info;
|
||||
pub type mach_memory_info_array_t = *mut mach_memory_info_t;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub struct zone_btrecord {
|
||||
pub ref_count: u32,
|
||||
pub operation_type: u32,
|
||||
pub bt: [u64; MAX_ZTRACE_DEPTH],
|
||||
}
|
||||
|
||||
pub type zone_btrecord_t = zone_btrecord;
|
||||
pub type zone_btrecord_array_t = *mut zone_btrecord_t;
|
||||
+5
-4
@@ -1,15 +1,16 @@
|
||||
//! This module corresponds to `mach/mach_init.h`.
|
||||
|
||||
use mach_types::thread_port_t;
|
||||
use crate::mach_types::thread_port_t;
|
||||
|
||||
extern "C" {
|
||||
unsafe extern "C" {
|
||||
pub fn mach_thread_self() -> thread_port_t;
|
||||
pub fn mach_host_self() -> thread_port_t;
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use mach_init::*;
|
||||
use port::*;
|
||||
use crate::mach_init::*;
|
||||
use crate::port::*;
|
||||
|
||||
#[test]
|
||||
fn mach_thread_self_test() {
|
||||
|
||||
+20
-5
@@ -1,11 +1,14 @@
|
||||
//! This module corresponds to `mach/mach_port.h`
|
||||
|
||||
use kern_return::kern_return_t;
|
||||
use mach_types::ipc_space_t;
|
||||
use message::mach_msg_type_name_t;
|
||||
use port::{mach_port_delta_t, mach_port_name_t, mach_port_right_t, mach_port_t};
|
||||
use crate::kern_return::kern_return_t;
|
||||
use crate::mach_types::ipc_space_t;
|
||||
use crate::message::mach_msg_type_name_t;
|
||||
use crate::port::{
|
||||
mach_port_delta_t, mach_port_name_t, mach_port_options_t, mach_port_right_t, mach_port_t,
|
||||
};
|
||||
use crate::vm_types::mach_port_context_t;
|
||||
|
||||
extern "C" {
|
||||
unsafe extern "C" {
|
||||
pub fn mach_port_allocate(
|
||||
task: ipc_space_t,
|
||||
right: mach_port_right_t,
|
||||
@@ -32,4 +35,16 @@ extern "C" {
|
||||
right: mach_port_right_t,
|
||||
delta: mach_port_delta_t,
|
||||
) -> kern_return_t;
|
||||
pub fn mach_port_construct(
|
||||
task: ipc_space_t,
|
||||
options: *mut mach_port_options_t,
|
||||
context: mach_port_context_t,
|
||||
name: *mut mach_port_name_t,
|
||||
) -> kern_return_t;
|
||||
pub fn mach_port_destruct(
|
||||
task: ipc_space_t,
|
||||
name: mach_port_name_t,
|
||||
srdelta: mach_port_delta_t,
|
||||
guard: mach_port_context_t,
|
||||
) -> kern_return_t;
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
//! This module corresponds to `mach/mach_time.h`
|
||||
use kern_return::kern_return_t;
|
||||
use crate::kern_return::kern_return_t;
|
||||
pub type mach_timebase_info_t = *mut mach_timebase_info;
|
||||
pub type mach_timebase_info_data_t = mach_timebase_info;
|
||||
|
||||
@@ -10,7 +10,7 @@ pub struct mach_timebase_info {
|
||||
pub denom: u32,
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
unsafe extern "C" {
|
||||
pub fn mach_timebase_info(info: mach_timebase_info_t) -> kern_return_t;
|
||||
pub fn mach_wait_until(deadline: u64) -> kern_return_t;
|
||||
pub fn mach_absolute_time() -> u64;
|
||||
|
||||
+32
-3
@@ -1,13 +1,23 @@
|
||||
//! This module corresponds to `mach/mach_types.h`
|
||||
|
||||
use port::mach_port_t;
|
||||
use crate::port::mach_port_t;
|
||||
use core::ffi::{c_long, c_uchar};
|
||||
|
||||
pub type task_t = mach_port_t;
|
||||
pub type task_name_t = mach_port_t;
|
||||
pub type task_policy_set_t = mach_port_t;
|
||||
pub type task_policy_get_t = mach_port_t;
|
||||
pub type task_inspect_t = mach_port_t;
|
||||
pub type task_read_t = mach_port_t;
|
||||
pub type task_suspension_token_t = mach_port_t;
|
||||
pub type task_id_token_t = mach_port_t;
|
||||
pub type thread_t = mach_port_t;
|
||||
pub type thread_act_t = mach_port_t;
|
||||
pub type thread_inspect_t = mach_port_t;
|
||||
pub type thread_read_t = mach_port_t;
|
||||
pub type ipc_space_t = mach_port_t;
|
||||
pub type ipc_space_read_t = mach_port_t;
|
||||
pub type ipc_space_inspect_t = mach_port_t;
|
||||
pub type coalition_t = mach_port_t;
|
||||
pub type host_t = mach_port_t;
|
||||
pub type host_priv_t = mach_port_t;
|
||||
@@ -21,6 +31,11 @@ pub type ledger_t = mach_port_t;
|
||||
pub type alarm_t = mach_port_t;
|
||||
pub type clock_serv_t = mach_port_t;
|
||||
pub type clock_ctrl_t = mach_port_t;
|
||||
pub type arcade_register_t = mach_port_t;
|
||||
pub type ipc_eventlink_t = mach_port_t;
|
||||
pub type eventlink_port_pair_t = [mach_port_t; 2];
|
||||
pub type mach_eventlink_t = mach_port_t;
|
||||
pub type kcdata_object_t = mach_port_t;
|
||||
|
||||
pub type processor_set_name_t = processor_set_t;
|
||||
|
||||
@@ -30,6 +45,7 @@ pub type mem_entry_name_port_t = mach_port_t;
|
||||
pub type exception_handler_t = mach_port_t;
|
||||
pub type exception_handler_array_t = *mut exception_handler_t;
|
||||
pub type vm_task_entry_t = mach_port_t;
|
||||
pub type io_main_t = mach_port_t;
|
||||
pub type io_master_t = mach_port_t;
|
||||
pub type UNDServerRef = mach_port_t;
|
||||
|
||||
@@ -68,10 +84,16 @@ pub type exception_port_arrary_t = exception_handler_array_t;
|
||||
|
||||
pub const TASK_NULL: task_t = 0;
|
||||
pub const TASK_NAME_NULL: task_name_t = 0;
|
||||
pub const TASK_INSPECT_NULL: task_inspect_t = 0;
|
||||
pub const TASK_READ_NULL: task_read_t = 0;
|
||||
pub const THREAD_NULL: thread_t = 0;
|
||||
pub const THREAD_INSPECT_NULL: thread_inspect_t = 0;
|
||||
pub const THREAD_READ_NULL: thread_read_t = 0;
|
||||
pub const TID_NULL: u64 = 0;
|
||||
pub const THR_ACT_NULL: thread_act_t = 0;
|
||||
pub const IPC_SPACE_NULL: ipc_space_t = 0;
|
||||
pub const IPC_SPACE_READ_NULL: ipc_space_read_t = 0;
|
||||
pub const IPC_SPACE_INSPECT_NULL: ipc_space_inspect_t = 0;
|
||||
pub const COALITION_NULL: coalition_t = 0;
|
||||
pub const HOST_NULL: host_t = 0;
|
||||
pub const HOST_PRIV_NULL: host_priv_t = 0;
|
||||
@@ -82,11 +104,18 @@ pub const SEMAPHORE_NULL: semaphore_t = 0;
|
||||
pub const LOCK_SET_NULL: lock_set_t = 0;
|
||||
pub const LEDGER_NULL: ledger_t = 0;
|
||||
pub const ALARM_NULL: alarm_t = 0;
|
||||
pub const CLOCK_NULL: ::libc::clock_t = 0;
|
||||
pub type clock_t = c_long;
|
||||
|
||||
pub const CLOCK_NULL: clock_t = 0;
|
||||
pub const UND_SERVER_NULL: UNDServerRef = 0;
|
||||
pub const ARCADE_REG_NULL: arcade_register_t = 0;
|
||||
pub const MACH_EVENTLINK_NULL: mach_eventlink_t = 0;
|
||||
pub const IPC_EVENTLINK_NULL: ipc_eventlink_t = 0;
|
||||
pub const TASK_ID_TOKEN_NULL: task_id_token_t = 0;
|
||||
pub const KCDATA_OBJECT_NULL: kcdata_object_t = 0;
|
||||
|
||||
// <sys/_types.h>: typedef unsigned char __darwin_uuid_t[16];
|
||||
pub type uuid_t = [::libc::c_uchar; 16];
|
||||
pub type uuid_t = [c_uchar; 16];
|
||||
|
||||
// <sys/_types/_fsid_t.h>
|
||||
#[repr(C)]
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
//! This module corresponds to `mach/mach_voucher_types.h`.
|
||||
|
||||
use crate::message::mach_msg_type_number_t;
|
||||
use crate::port::{mach_port_name_t, mach_port_t};
|
||||
|
||||
pub type mach_voucher_t = mach_port_t;
|
||||
pub const MACH_VOUCHER_NULL: mach_voucher_t = 0;
|
||||
|
||||
pub type mach_voucher_name_t = mach_port_name_t;
|
||||
pub const MACH_VOUCHER_NAME_NULL: mach_voucher_name_t = 0;
|
||||
|
||||
pub type mach_voucher_name_array_t = *mut mach_voucher_name_t;
|
||||
pub const MACH_VOUCHER_NAME_ARRAY_NULL: mach_voucher_name_array_t = core::ptr::null_mut();
|
||||
|
||||
pub type ipc_voucher_t = mach_voucher_t;
|
||||
pub const IPC_VOUCHER_NULL: ipc_voucher_t = 0;
|
||||
|
||||
pub type mach_voucher_selector_t = u32;
|
||||
pub const MACH_VOUCHER_SELECTOR_CURRENT: mach_voucher_selector_t = 0;
|
||||
pub const MACH_VOUCHER_SELECTOR_EFFECTIVE: mach_voucher_selector_t = 1;
|
||||
|
||||
pub type mach_voucher_attr_key_t = u32;
|
||||
pub type mach_voucher_attr_key_array_t = *mut mach_voucher_attr_key_t;
|
||||
|
||||
pub const MACH_VOUCHER_ATTR_KEY_ALL: mach_voucher_attr_key_t = !0;
|
||||
pub const MACH_VOUCHER_ATTR_KEY_NONE: mach_voucher_attr_key_t = 0;
|
||||
pub const MACH_VOUCHER_ATTR_KEY_ATM: mach_voucher_attr_key_t = 1;
|
||||
pub const MACH_VOUCHER_ATTR_KEY_IMPORTANCE: mach_voucher_attr_key_t = 2;
|
||||
pub const MACH_VOUCHER_ATTR_KEY_BANK: mach_voucher_attr_key_t = 3;
|
||||
pub const MACH_VOUCHER_ATTR_KEY_PTHPRIORITY: mach_voucher_attr_key_t = 4;
|
||||
pub const MACH_VOUCHER_ATTR_KEY_USER_DATA: mach_voucher_attr_key_t = 7;
|
||||
pub const MACH_VOUCHER_ATTR_KEY_BITS: mach_voucher_attr_key_t = MACH_VOUCHER_ATTR_KEY_USER_DATA;
|
||||
pub const MACH_VOUCHER_ATTR_KEY_TEST: mach_voucher_attr_key_t = 8;
|
||||
pub const MACH_VOUCHER_ATTR_KEY_NUM_WELL_KNOWN: mach_voucher_attr_key_t =
|
||||
MACH_VOUCHER_ATTR_KEY_TEST;
|
||||
|
||||
pub type mach_voucher_attr_content_t = *mut u8;
|
||||
pub type mach_voucher_attr_content_size_t = u32;
|
||||
|
||||
pub type mach_voucher_attr_command_t = u32;
|
||||
pub type mach_voucher_attr_recipe_command_t = u32;
|
||||
pub type mach_voucher_attr_recipe_command_array_t = *mut mach_voucher_attr_recipe_command_t;
|
||||
|
||||
pub const MACH_VOUCHER_ATTR_NOOP: mach_voucher_attr_recipe_command_t = 0;
|
||||
pub const MACH_VOUCHER_ATTR_COPY: mach_voucher_attr_recipe_command_t = 1;
|
||||
pub const MACH_VOUCHER_ATTR_REMOVE: mach_voucher_attr_recipe_command_t = 2;
|
||||
pub const MACH_VOUCHER_ATTR_SET_VALUE_HANDLE: mach_voucher_attr_recipe_command_t = 3;
|
||||
pub const MACH_VOUCHER_ATTR_AUTO_REDEEM: mach_voucher_attr_recipe_command_t = 4;
|
||||
pub const MACH_VOUCHER_ATTR_SEND_PREPROCESS: mach_voucher_attr_recipe_command_t = 5;
|
||||
pub const MACH_VOUCHER_ATTR_REDEEM: mach_voucher_attr_recipe_command_t = 10;
|
||||
pub const MACH_VOUCHER_ATTR_IMPORTANCE_SELF: mach_voucher_attr_recipe_command_t = 200;
|
||||
pub const MACH_VOUCHER_ATTR_USER_DATA_STORE: mach_voucher_attr_recipe_command_t = 211;
|
||||
pub const MACH_VOUCHER_ATTR_BITS_STORE: mach_voucher_attr_recipe_command_t =
|
||||
MACH_VOUCHER_ATTR_USER_DATA_STORE;
|
||||
pub const MACH_VOUCHER_ATTR_TEST_STORE: mach_voucher_attr_recipe_command_t =
|
||||
MACH_VOUCHER_ATTR_USER_DATA_STORE;
|
||||
|
||||
pub type mach_voucher_attr_recipe_size_t = mach_msg_type_number_t;
|
||||
|
||||
pub type mach_voucher_attr_raw_recipe_t = *mut u8;
|
||||
pub type mach_voucher_attr_raw_recipe_array_t = mach_voucher_attr_raw_recipe_t;
|
||||
pub type mach_voucher_attr_raw_recipe_size_t = mach_msg_type_number_t;
|
||||
pub type mach_voucher_attr_raw_recipe_array_size_t = mach_msg_type_number_t;
|
||||
|
||||
pub const MACH_VOUCHER_ATTR_MAX_RAW_RECIPE_ARRAY_SIZE: mach_msg_type_number_t = 5120;
|
||||
pub const MACH_VOUCHER_TRAP_STACK_LIMIT: mach_msg_type_number_t = 256;
|
||||
|
||||
pub type mach_voucher_attr_manager_t = mach_port_t;
|
||||
pub const MACH_VOUCHER_ATTR_MANAGER_NULL: mach_voucher_attr_manager_t = 0;
|
||||
|
||||
pub type mach_voucher_attr_control_t = mach_port_t;
|
||||
pub const MACH_VOUCHER_ATTR_CONTROL_NULL: mach_voucher_attr_control_t = 0;
|
||||
|
||||
pub type ipc_voucher_attr_manager_t = mach_port_t;
|
||||
pub type ipc_voucher_attr_control_t = mach_port_t;
|
||||
pub const IPC_VOUCHER_ATTR_MANAGER_NULL: ipc_voucher_attr_manager_t = 0;
|
||||
pub const IPC_VOUCHER_ATTR_CONTROL_NULL: ipc_voucher_attr_control_t = 0;
|
||||
|
||||
pub type mach_voucher_attr_value_handle_t = u64;
|
||||
pub type mach_voucher_attr_value_handle_array_t = *mut mach_voucher_attr_value_handle_t;
|
||||
pub type mach_voucher_attr_value_handle_array_size_t = mach_msg_type_number_t;
|
||||
|
||||
pub const MACH_VOUCHER_ATTR_VALUE_MAX_NESTED: mach_voucher_attr_value_handle_array_size_t = 4;
|
||||
|
||||
pub type mach_voucher_attr_value_reference_t = u32;
|
||||
pub type mach_voucher_attr_value_flags_t = u32;
|
||||
pub const MACH_VOUCHER_ATTR_VALUE_FLAGS_NONE: mach_voucher_attr_value_flags_t = 0;
|
||||
pub const MACH_VOUCHER_ATTR_VALUE_FLAGS_PERSIST: mach_voucher_attr_value_flags_t = 1;
|
||||
|
||||
pub type mach_voucher_attr_control_flags_t = u32;
|
||||
pub const MACH_VOUCHER_ATTR_CONTROL_FLAGS_NONE: mach_voucher_attr_control_flags_t = 0;
|
||||
|
||||
pub const MACH_VOUCHER_IMPORTANCE_ATTR_ADD_EXTERNAL: u32 = 1;
|
||||
pub const MACH_VOUCHER_IMPORTANCE_ATTR_DROP_EXTERNAL: u32 = 2;
|
||||
pub type mach_voucher_attr_importance_refs = u32;
|
||||
|
||||
pub const MACH_ACTIVITY_ID_COUNT_MAX: u32 = 16;
|
||||
+5
-4
@@ -1,9 +1,10 @@
|
||||
//! This module roughly corresponds to `mach/memory_object_types.h`.
|
||||
|
||||
use vm_types::natural_t;
|
||||
use crate::vm_types::natural_t;
|
||||
use core::ffi::c_ulonglong;
|
||||
|
||||
pub type memory_object_offset_t = ::libc::c_ulonglong;
|
||||
pub type memory_object_size_t = ::libc::c_ulonglong;
|
||||
pub type memory_object_offset_t = c_ulonglong;
|
||||
pub type memory_object_size_t = c_ulonglong;
|
||||
pub type memory_object_cluster_size_t = natural_t;
|
||||
pub type memory_object_fault_info_t = *mut natural_t;
|
||||
pub type vm_object_id_t = ::libc::c_ulonglong;
|
||||
pub type vm_object_id_t = c_ulonglong;
|
||||
|
||||
+112
-14
@@ -1,21 +1,24 @@
|
||||
//! This module corresponds to `mach/message.h`.
|
||||
|
||||
use kern_return::kern_return_t;
|
||||
use port::{mach_port_name_t, mach_port_t};
|
||||
use vm_types::{integer_t, natural_t};
|
||||
use crate::kern_return::kern_return_t;
|
||||
use crate::port::{mach_port_name_t, mach_port_seqno_t, mach_port_t};
|
||||
use crate::vm_types::{integer_t, natural_t};
|
||||
use core::ffi::{c_uint, c_void};
|
||||
|
||||
pub type mach_msg_timeout_t = natural_t;
|
||||
|
||||
pub type mach_msg_bits_t = ::libc::c_uint;
|
||||
pub type mach_msg_bits_t = c_uint;
|
||||
pub type mach_msg_id_t = integer_t;
|
||||
pub type mach_msg_size_t = natural_t;
|
||||
|
||||
pub type mach_msg_copy_options_t = ::libc::c_uint;
|
||||
pub type mach_msg_descriptor_type_t = ::libc::c_uint;
|
||||
pub type mach_msg_type_name_t = ::libc::c_uint;
|
||||
pub type mach_msg_copy_options_t = c_uint;
|
||||
pub type mach_msg_descriptor_type_t = c_uint;
|
||||
pub type mach_msg_type_name_t = c_uint;
|
||||
|
||||
pub type mach_msg_trailer_type_t = ::libc::c_uint;
|
||||
pub type mach_msg_trailer_size_t = ::libc::c_uint;
|
||||
pub type mach_msg_guard_flags_t = c_uint;
|
||||
|
||||
pub type mach_msg_trailer_type_t = c_uint;
|
||||
pub type mach_msg_trailer_size_t = c_uint;
|
||||
|
||||
pub type mach_msg_option_t = integer_t;
|
||||
|
||||
@@ -59,10 +62,16 @@ pub const MACH_MSG_PHYSICAL_COPY: mach_msg_copy_options_t = 0;
|
||||
pub const MACH_MSG_VIRTUAL_COPY: mach_msg_copy_options_t = 1;
|
||||
pub const MACH_MSG_ALLOCATE: mach_msg_copy_options_t = 2;
|
||||
|
||||
pub const MACH_MSG_GUARD_FLAGS_NONE: mach_msg_guard_flags_t = 0;
|
||||
pub const MACH_MSG_GUARD_FLAGS_IMMOVABLE_RECEIVE: mach_msg_guard_flags_t = 1;
|
||||
pub const MACH_MSG_GUARD_FLAGS_UNGUARDED_ON_SEND: mach_msg_guard_flags_t = 2;
|
||||
pub const MACH_MSG_GUARD_FLAGS_MASK: mach_msg_guard_flags_t = 3;
|
||||
|
||||
pub const MACH_MSG_PORT_DESCRIPTOR: mach_msg_descriptor_type_t = 0;
|
||||
pub const MACH_MSG_OOL_DESCRIPTOR: mach_msg_descriptor_type_t = 1;
|
||||
pub const MACH_MSG_OOL_PORTS_DESCRIPTOR: mach_msg_descriptor_type_t = 2;
|
||||
pub const MACH_MSG_OOL_VOLATILE_DESCRIPTOR: mach_msg_descriptor_type_t = 3;
|
||||
pub const MACH_MSG_GUARDED_PORT_DESCRIPTOR: mach_msg_descriptor_type_t = 4;
|
||||
|
||||
pub const MACH_MSG_OPTION_NONE: mach_msg_option_t = 0x0000_0000;
|
||||
|
||||
@@ -73,19 +82,37 @@ pub const MACH_RCV_LARGE: mach_msg_option_t = 0x0000_0004;
|
||||
pub const MACH_RCV_LARGE_IDENTITY: mach_msg_option_t = 0x0000_0008;
|
||||
|
||||
pub const MACH_SEND_TIMEOUT: mach_msg_option_t = 0x0000_0010;
|
||||
pub const MACH_SEND_OVERRIDE: mach_msg_option_t = 0x0000_0020;
|
||||
pub const MACH_SEND_INTERRUPT: mach_msg_option_t = 0x0000_0040;
|
||||
pub const MACH_SEND_NOTIFY: mach_msg_option_t = 0x0000_0080;
|
||||
pub const MACH_SEND_ALWAYS: mach_msg_option_t = 0x0001_0000;
|
||||
pub const MACH_SEND_FILTER_NONFATAL: mach_msg_option_t = 0x0001_0000;
|
||||
pub const MACH_SEND_TRAILER: mach_msg_option_t = 0x0002_0000;
|
||||
pub const MACH_SEND_NOIMPORTANCE: mach_msg_option_t = 0x0004_0000;
|
||||
pub const MACH_SEND_NODENAP: mach_msg_option_t = MACH_SEND_NOIMPORTANCE;
|
||||
pub const MACH_SEND_IMPORTANCE: mach_msg_option_t = 0x0008_0000;
|
||||
pub const MACH_SEND_SYNC_OVERRIDE: mach_msg_option_t = 0x0010_0000;
|
||||
pub const MACH_SEND_PROPAGATE_QOS: mach_msg_option_t = 0x0020_0000;
|
||||
pub const MACH_SEND_SYNC_USE_THRPRI: mach_msg_option_t = MACH_SEND_PROPAGATE_QOS;
|
||||
|
||||
pub const MACH_RCV_TIMEOUT: mach_msg_option_t = 0x0000_0100;
|
||||
pub const MACH_RCV_NOTIFY: mach_msg_option_t = 0x0000_0000;
|
||||
pub const MACH_RCV_INTERRUPT: mach_msg_option_t = 0x0000_0400;
|
||||
pub const MACH_RCV_VOUCHER: mach_msg_option_t = 0x0000_0800;
|
||||
pub const MACH_RCV_OVERWRITE: mach_msg_option_t = 0x0000_0000;
|
||||
pub const MACH_RCV_GUARDED_DESC: mach_msg_option_t = 0x0000_1000;
|
||||
pub const MACH_RCV_SYNC_WAIT: mach_msg_option_t = 0x0000_4000;
|
||||
pub const MACH_RCV_SYNC_PEEK: mach_msg_option_t = 0x0000_8000;
|
||||
|
||||
pub const MACH_MSG_STRICT_REPLY: mach_msg_option_t = 0x0000_0200;
|
||||
|
||||
pub const MACH_RCV_TRAILER_NULL: mach_msg_trailer_type_t = 0;
|
||||
pub const MACH_RCV_TRAILER_SEQNO: mach_msg_trailer_type_t = 1;
|
||||
pub const MACH_RCV_TRAILER_SENDER: mach_msg_trailer_type_t = 2;
|
||||
pub const MACH_RCV_TRAILER_AUDIT: mach_msg_trailer_type_t = 3;
|
||||
pub const MACH_RCV_TRAILER_CTX: mach_msg_trailer_type_t = 4;
|
||||
pub const MACH_RCV_TRAILER_AV: mach_msg_trailer_type_t = 7;
|
||||
pub const MACH_RCV_TRAILER_LABELS: mach_msg_trailer_type_t = 8;
|
||||
|
||||
pub const MACH_MSG_SUCCESS: mach_msg_return_t = 0x0000_0000;
|
||||
|
||||
@@ -111,7 +138,10 @@ pub const MACH_SEND_TOO_LARGE: mach_msg_return_t = 0x1000_000e;
|
||||
pub const MACH_SEND_INVALID_TYPE: mach_msg_return_t = 0x1000_000f;
|
||||
pub const MACH_SEND_INVALID_HEADER: mach_msg_return_t = 0x1000_0010;
|
||||
pub const MACH_SEND_INVALID_TRAILER: mach_msg_return_t = 0x1000_0011;
|
||||
pub const MACH_SEND_INVALID_CONTEXT: mach_msg_return_t = 0x1000_0012;
|
||||
pub const MACH_SEND_INVALID_RT_OOL_SIZE: mach_msg_return_t = 0x1000_0015;
|
||||
pub const MACH_SEND_NO_GRANT_DEST: mach_msg_return_t = 0x1000_0016;
|
||||
pub const MACH_SEND_MSG_FILTERED: mach_msg_return_t = 0x1000_0017;
|
||||
|
||||
pub const MACH_RCV_IN_PROGRESS: mach_msg_return_t = 0x1000_4001;
|
||||
pub const MACH_RCV_INVALID_NAME: mach_msg_return_t = 0x1000_4002;
|
||||
@@ -129,6 +159,7 @@ pub const MACH_RCV_INVALID_TYPE: mach_msg_return_t = 0x1000_400d;
|
||||
pub const MACH_RCV_SCATTER_SMALL: mach_msg_return_t = 0x1000_400e;
|
||||
pub const MACH_RCV_INVALID_TRAILER: mach_msg_return_t = 0x1000_400f;
|
||||
pub const MACH_RCV_IN_PROGRESS_TIMED: mach_msg_return_t = 0x1000_4011;
|
||||
pub const MACH_RCV_INVALID_REPLY: mach_msg_return_t = 0x1000_4012;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
@@ -163,6 +194,54 @@ pub struct mach_msg_trailer_t {
|
||||
pub msgh_trailer_size: mach_msg_trailer_size_t,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct mach_msg_seqno_trailer_t {
|
||||
pub msgh_trailer_type: mach_msg_trailer_type_t,
|
||||
pub msgh_trailer_size: mach_msg_trailer_size_t,
|
||||
pub msgh_seqno: mach_port_seqno_t,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct security_token_t {
|
||||
pub val: [c_uint; 2],
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct mach_msg_security_trailer_t {
|
||||
pub msgh_trailer_type: mach_msg_trailer_type_t,
|
||||
pub msgh_trailer_size: mach_msg_trailer_size_t,
|
||||
pub msgh_seqno: mach_port_seqno_t,
|
||||
pub msgh_sender: security_token_t,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct audit_token_t {
|
||||
pub val: [c_uint; 8],
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct mach_msg_audit_trailer_t {
|
||||
pub msgh_trailer_type: mach_msg_trailer_type_t,
|
||||
pub msgh_trailer_size: mach_msg_trailer_size_t,
|
||||
pub msgh_seqno: mach_port_seqno_t,
|
||||
pub msgh_sender: security_token_t,
|
||||
pub msgh_audit: audit_token_t,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct mach_msg_type_descriptor_t {
|
||||
pub pad1: natural_t,
|
||||
pub pad2: mach_msg_size_t,
|
||||
pub pad3: [u8; 3],
|
||||
pub type_: u8, // mach_msg_descriptor_type_t bitfield
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct mach_msg_port_descriptor_t {
|
||||
@@ -188,7 +267,7 @@ impl mach_msg_port_descriptor_t {
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct mach_msg_ool_descriptor_t {
|
||||
pub address: *mut ::libc::c_void,
|
||||
pub address: *mut c_void,
|
||||
#[cfg(not(target_pointer_width = "64"))]
|
||||
pub size: mach_msg_size_t,
|
||||
pub deallocate: u8, // boolean_t bitfield
|
||||
@@ -201,10 +280,10 @@ pub struct mach_msg_ool_descriptor_t {
|
||||
|
||||
impl mach_msg_ool_descriptor_t {
|
||||
pub fn new(
|
||||
address: *mut ::libc::c_void,
|
||||
address: *mut c_void,
|
||||
deallocate: bool,
|
||||
copy: mach_msg_copy_options_t,
|
||||
size: u32,
|
||||
size: mach_msg_size_t,
|
||||
) -> Self {
|
||||
Self {
|
||||
address,
|
||||
@@ -220,7 +299,7 @@ impl mach_msg_ool_descriptor_t {
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct mach_msg_ool_ports_descriptor_t {
|
||||
pub address: *mut ::libc::c_void,
|
||||
pub address: *mut c_void,
|
||||
#[cfg(not(target_pointer_width = "64"))]
|
||||
pub count: mach_msg_size_t,
|
||||
pub deallocate: u8, // boolean_t bitfield
|
||||
@@ -231,7 +310,26 @@ pub struct mach_msg_ool_ports_descriptor_t {
|
||||
pub count: mach_msg_size_t,
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
impl mach_msg_ool_ports_descriptor_t {
|
||||
pub fn new(
|
||||
address: *mut c_void,
|
||||
deallocate: bool,
|
||||
copy: mach_msg_copy_options_t,
|
||||
disposition: mach_msg_type_name_t,
|
||||
count: mach_msg_size_t,
|
||||
) -> Self {
|
||||
Self {
|
||||
address,
|
||||
deallocate: if deallocate { 1 } else { 0 },
|
||||
copy: copy as u8,
|
||||
disposition: disposition as u8,
|
||||
type_: MACH_MSG_OOL_PORTS_DESCRIPTOR as u8,
|
||||
count,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsafe extern "C" {
|
||||
pub fn mach_msg(
|
||||
msg: *mut mach_msg_header_t,
|
||||
option: mach_msg_option_t,
|
||||
|
||||
Vendored
+74
@@ -0,0 +1,74 @@
|
||||
//! This module corresponds to `mach/mig.h`.
|
||||
|
||||
use crate::kern_return::kern_return_t;
|
||||
use crate::message::{
|
||||
mach_msg_header_t, mach_msg_id_t, mach_msg_size_t, mach_msg_type_descriptor_t,
|
||||
};
|
||||
use crate::port::mach_port_t;
|
||||
use crate::vm_types::{vm_address_t, vm_size_t};
|
||||
use core::ffi::{c_char, c_int, c_uint};
|
||||
use core::ptr;
|
||||
|
||||
pub type mig_stub_routine_t =
|
||||
Option<unsafe extern "C" fn(*mut mach_msg_header_t, *mut mach_msg_header_t)>;
|
||||
pub type mig_routine_t = mig_stub_routine_t;
|
||||
pub type mig_server_routine_t =
|
||||
Option<unsafe extern "C" fn(*mut mach_msg_header_t) -> mig_routine_t>;
|
||||
pub type mig_impl_routine_t = Option<unsafe extern "C" fn() -> kern_return_t>;
|
||||
|
||||
pub type routine_arg_descriptor_t = *mut mach_msg_type_descriptor_t;
|
||||
pub type mig_routine_arg_descriptor_t = *mut mach_msg_type_descriptor_t;
|
||||
|
||||
pub const MIG_ROUTINE_ARG_DESCRIPTOR_NULL: mig_routine_arg_descriptor_t = ptr::null_mut();
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub struct routine_descriptor {
|
||||
pub impl_routine: mig_impl_routine_t,
|
||||
pub stub_routine: mig_stub_routine_t,
|
||||
pub argc: c_uint,
|
||||
pub descr_count: c_uint,
|
||||
pub arg_descr: routine_arg_descriptor_t,
|
||||
pub max_reply_msg: c_uint,
|
||||
}
|
||||
|
||||
pub type routine_descriptor_t = *mut routine_descriptor;
|
||||
pub type mig_routine_descriptor = routine_descriptor;
|
||||
pub type mig_routine_descriptor_t = *mut mig_routine_descriptor;
|
||||
|
||||
pub const MIG_ROUTINE_DESCRIPTOR_NULL: mig_routine_descriptor_t = ptr::null_mut();
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub struct mig_subsystem {
|
||||
pub server: mig_server_routine_t,
|
||||
pub start: mach_msg_id_t,
|
||||
pub end: mach_msg_id_t,
|
||||
pub maxsize: mach_msg_size_t,
|
||||
pub reserved: vm_address_t,
|
||||
pub routine: [mig_routine_descriptor; 1],
|
||||
}
|
||||
|
||||
pub type mig_subsystem_t = *mut mig_subsystem;
|
||||
|
||||
pub const MIG_SUBSYSTEM_NULL: mig_subsystem_t = ptr::null_mut();
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub struct mig_symtab {
|
||||
pub ms_routine_name: *mut c_char,
|
||||
pub ms_routine_number: c_int,
|
||||
pub ms_routine: Option<unsafe extern "C" fn()>,
|
||||
}
|
||||
|
||||
pub type mig_symtab_t = mig_symtab;
|
||||
|
||||
unsafe extern "C" {
|
||||
pub fn mig_get_reply_port() -> mach_port_t;
|
||||
pub fn mig_dealloc_reply_port(reply_port: mach_port_t);
|
||||
pub fn mig_put_reply_port(reply_port: mach_port_t);
|
||||
pub fn mig_strncpy(dest: *mut c_char, src: *const c_char, len: c_int) -> c_int;
|
||||
pub fn mig_strncpy_zerofill(dest: *mut c_char, src: *const c_char, len: c_int) -> c_int;
|
||||
pub fn mig_allocate(address: *mut vm_address_t, size: vm_size_t);
|
||||
pub fn mig_deallocate(address: vm_address_t, size: vm_size_t);
|
||||
}
|
||||
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
//! This module roughly corresponds to `mach/ndr.h`.
|
||||
|
||||
use core::ffi::c_uchar;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[allow(dead_code)]
|
||||
pub struct NDR_record_t {
|
||||
mig_vers: c_uchar,
|
||||
if_vers: c_uchar,
|
||||
reserved1: c_uchar,
|
||||
mig_encoding: c_uchar,
|
||||
int_rep: c_uchar,
|
||||
char_rep: c_uchar,
|
||||
float_rep: c_uchar,
|
||||
reserved32: c_uchar,
|
||||
}
|
||||
|
||||
unsafe extern "C" {
|
||||
pub static NDR_record: NDR_record_t;
|
||||
}
|
||||
Vendored
+77
@@ -0,0 +1,77 @@
|
||||
//! This module corresponds to `mach/notify.h`.
|
||||
|
||||
use crate::message::{
|
||||
mach_msg_body_t, mach_msg_header_t, mach_msg_port_descriptor_t, mach_msg_security_trailer_t,
|
||||
mach_msg_type_number_t,
|
||||
};
|
||||
use crate::ndr::NDR_record_t;
|
||||
use crate::port::mach_port_name_t;
|
||||
use crate::port::mach_port_t;
|
||||
use core::ffi::c_int;
|
||||
|
||||
pub const MACH_NOTIFY_FIRST: c_int = 0o100;
|
||||
pub const MACH_NOTIFY_PORT_DELETED: c_int = MACH_NOTIFY_FIRST + 0o01;
|
||||
pub const MACH_NOTIFY_SEND_POSSIBLE: c_int = MACH_NOTIFY_FIRST + 0o02;
|
||||
pub const MACH_NOTIFY_PORT_DESTROYED: c_int = MACH_NOTIFY_FIRST + 0o05;
|
||||
pub const MACH_NOTIFY_NO_SENDERS: c_int = MACH_NOTIFY_FIRST + 0o06;
|
||||
pub const MACH_NOTIFY_SEND_ONCE: c_int = MACH_NOTIFY_FIRST + 0o07;
|
||||
pub const MACH_NOTIFY_DEAD_NAME: c_int = MACH_NOTIFY_FIRST + 0o10;
|
||||
pub const MACH_NOTIFY_LAST: c_int = MACH_NOTIFY_FIRST + 0o15;
|
||||
|
||||
pub type notify_port_t = mach_port_t;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[allow(non_snake_case)]
|
||||
pub struct mach_port_deleted_notification_t {
|
||||
pub not_header: mach_msg_header_t,
|
||||
pub NDR: NDR_record_t,
|
||||
pub not_port: mach_port_name_t,
|
||||
pub trailer: mach_msg_security_trailer_t,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[allow(non_snake_case)]
|
||||
pub struct mach_send_possible_notification_t {
|
||||
pub not_header: mach_msg_header_t,
|
||||
pub NDR: NDR_record_t,
|
||||
pub not_port: mach_port_name_t,
|
||||
pub trailer: mach_msg_security_trailer_t,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub struct mach_port_destroyed_notification_t {
|
||||
pub not_header: mach_msg_header_t,
|
||||
pub not_body: mach_msg_body_t,
|
||||
pub not_port: mach_msg_port_descriptor_t,
|
||||
pub trailer: mach_msg_security_trailer_t,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[allow(non_snake_case)]
|
||||
pub struct mach_no_senders_notification_t {
|
||||
pub not_header: mach_msg_header_t,
|
||||
pub NDR: NDR_record_t,
|
||||
pub not_count: mach_msg_type_number_t,
|
||||
pub trailer: mach_msg_security_trailer_t,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub struct mach_send_once_notification_t {
|
||||
pub not_header: mach_msg_header_t,
|
||||
pub trailer: mach_msg_security_trailer_t,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[allow(non_snake_case)]
|
||||
pub struct mach_dead_name_notification_t {
|
||||
pub not_header: mach_msg_header_t,
|
||||
pub NDR: NDR_record_t,
|
||||
pub not_port: mach_port_name_t,
|
||||
pub trailer: mach_msg_security_trailer_t,
|
||||
}
|
||||
Vendored
+147
@@ -0,0 +1,147 @@
|
||||
//! This module corresponds to `mach/policy.h`.
|
||||
|
||||
use crate::boolean::boolean_t;
|
||||
use crate::message::mach_msg_type_number_t;
|
||||
use crate::vm_types::integer_t;
|
||||
use core::ffi::c_int;
|
||||
use core::mem;
|
||||
|
||||
pub type policy_t = c_int;
|
||||
pub type policy_info_t = *mut integer_t;
|
||||
pub type policy_base_t = *mut integer_t;
|
||||
pub type policy_limit_t = *mut integer_t;
|
||||
|
||||
pub const POLICY_NULL: policy_t = 0;
|
||||
pub const POLICY_TIMESHARE: policy_t = 1;
|
||||
pub const POLICY_RR: policy_t = 2;
|
||||
pub const POLICY_FIFO: policy_t = 4;
|
||||
|
||||
pub const POLICYCLASS_FIXEDPRI: policy_t = POLICY_RR | POLICY_FIFO;
|
||||
|
||||
#[inline]
|
||||
pub const fn invalid_policy(policy: policy_t) -> bool {
|
||||
!(policy == POLICY_TIMESHARE || policy == POLICY_RR || policy == POLICY_FIFO)
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq)]
|
||||
pub struct policy_timeshare_base {
|
||||
pub base_priority: integer_t,
|
||||
}
|
||||
|
||||
pub type policy_timeshare_base_t = *mut policy_timeshare_base;
|
||||
pub type policy_timeshare_base_data_t = policy_timeshare_base;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq)]
|
||||
pub struct policy_timeshare_limit {
|
||||
pub max_priority: integer_t,
|
||||
}
|
||||
|
||||
pub type policy_timeshare_limit_t = *mut policy_timeshare_limit;
|
||||
pub type policy_timeshare_limit_data_t = policy_timeshare_limit;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq)]
|
||||
pub struct policy_timeshare_info {
|
||||
pub max_priority: integer_t,
|
||||
pub base_priority: integer_t,
|
||||
pub cur_priority: integer_t,
|
||||
pub depressed: boolean_t,
|
||||
pub depress_priority: integer_t,
|
||||
}
|
||||
|
||||
pub type policy_timeshare_info_t = *mut policy_timeshare_info;
|
||||
pub type policy_timeshare_info_data_t = policy_timeshare_info;
|
||||
|
||||
pub const POLICY_TIMESHARE_BASE_COUNT: mach_msg_type_number_t =
|
||||
(mem::size_of::<policy_timeshare_base_data_t>() / mem::size_of::<integer_t>())
|
||||
as mach_msg_type_number_t;
|
||||
pub const POLICY_TIMESHARE_LIMIT_COUNT: mach_msg_type_number_t =
|
||||
(mem::size_of::<policy_timeshare_limit_data_t>() / mem::size_of::<integer_t>())
|
||||
as mach_msg_type_number_t;
|
||||
pub const POLICY_TIMESHARE_INFO_COUNT: mach_msg_type_number_t =
|
||||
(mem::size_of::<policy_timeshare_info_data_t>() / mem::size_of::<integer_t>())
|
||||
as mach_msg_type_number_t;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq)]
|
||||
pub struct policy_rr_base {
|
||||
pub base_priority: integer_t,
|
||||
pub quantum: integer_t,
|
||||
}
|
||||
|
||||
pub type policy_rr_base_t = *mut policy_rr_base;
|
||||
pub type policy_rr_base_data_t = policy_rr_base;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq)]
|
||||
pub struct policy_rr_limit {
|
||||
pub max_priority: integer_t,
|
||||
}
|
||||
|
||||
pub type policy_rr_limit_t = *mut policy_rr_limit;
|
||||
pub type policy_rr_limit_data_t = policy_rr_limit;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq)]
|
||||
pub struct policy_rr_info {
|
||||
pub max_priority: integer_t,
|
||||
pub base_priority: integer_t,
|
||||
pub quantum: integer_t,
|
||||
pub depressed: boolean_t,
|
||||
pub depress_priority: integer_t,
|
||||
}
|
||||
|
||||
pub type policy_rr_info_t = *mut policy_rr_info;
|
||||
pub type policy_rr_info_data_t = policy_rr_info;
|
||||
|
||||
pub const POLICY_RR_BASE_COUNT: mach_msg_type_number_t = (mem::size_of::<policy_rr_base_data_t>()
|
||||
/ mem::size_of::<integer_t>())
|
||||
as mach_msg_type_number_t;
|
||||
pub const POLICY_RR_LIMIT_COUNT: mach_msg_type_number_t = (mem::size_of::<policy_rr_limit_data_t>()
|
||||
/ mem::size_of::<integer_t>())
|
||||
as mach_msg_type_number_t;
|
||||
pub const POLICY_RR_INFO_COUNT: mach_msg_type_number_t = (mem::size_of::<policy_rr_info_data_t>()
|
||||
/ mem::size_of::<integer_t>())
|
||||
as mach_msg_type_number_t;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq)]
|
||||
pub struct policy_fifo_base {
|
||||
pub base_priority: integer_t,
|
||||
}
|
||||
|
||||
pub type policy_fifo_base_t = *mut policy_fifo_base;
|
||||
pub type policy_fifo_base_data_t = policy_fifo_base;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq)]
|
||||
pub struct policy_fifo_limit {
|
||||
pub max_priority: integer_t,
|
||||
}
|
||||
|
||||
pub type policy_fifo_limit_t = *mut policy_fifo_limit;
|
||||
pub type policy_fifo_limit_data_t = policy_fifo_limit;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq)]
|
||||
pub struct policy_fifo_info {
|
||||
pub max_priority: integer_t,
|
||||
pub base_priority: integer_t,
|
||||
pub depressed: boolean_t,
|
||||
pub depress_priority: integer_t,
|
||||
}
|
||||
|
||||
pub type policy_fifo_info_t = *mut policy_fifo_info;
|
||||
pub type policy_fifo_info_data_t = policy_fifo_info;
|
||||
|
||||
pub const POLICY_FIFO_BASE_COUNT: mach_msg_type_number_t =
|
||||
(mem::size_of::<policy_fifo_base_data_t>() / mem::size_of::<integer_t>())
|
||||
as mach_msg_type_number_t;
|
||||
pub const POLICY_FIFO_LIMIT_COUNT: mach_msg_type_number_t =
|
||||
(mem::size_of::<policy_fifo_limit_data_t>() / mem::size_of::<integer_t>())
|
||||
as mach_msg_type_number_t;
|
||||
pub const POLICY_FIFO_INFO_COUNT: mach_msg_type_number_t =
|
||||
(mem::size_of::<policy_fifo_info_data_t>() / mem::size_of::<integer_t>())
|
||||
as mach_msg_type_number_t;
|
||||
Vendored
+44
-8
@@ -1,16 +1,12 @@
|
||||
//! This module corresponds to `mach/port.h`
|
||||
|
||||
use vm_types::{integer_t, natural_t};
|
||||
use crate::vm_types::{integer_t, natural_t};
|
||||
use core::ffi::c_uint;
|
||||
|
||||
pub type mach_port_name_t = natural_t;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct ipc_port;
|
||||
|
||||
pub type ipc_port_t = *mut ipc_port;
|
||||
|
||||
pub type mach_port_t = ::libc::c_uint;
|
||||
pub type mach_port_t = c_uint;
|
||||
pub type mach_port_array_t = *mut mach_port_t;
|
||||
|
||||
pub const MACH_PORT_NULL: mach_port_t = 0;
|
||||
pub const MACH_PORT_DEAD: mach_port_t = !0;
|
||||
@@ -25,4 +21,44 @@ pub const MACH_PORT_RIGHT_DEAD_NAME: mach_port_right_t = 4;
|
||||
pub const MACH_PORT_RIGHT_LABELH: mach_port_right_t = 5;
|
||||
pub const MACH_PORT_RIGHT_NUMBER: mach_port_right_t = 6;
|
||||
|
||||
pub type mach_port_type_t = natural_t;
|
||||
|
||||
pub type mach_port_urefs_t = natural_t;
|
||||
pub type mach_port_delta_t = integer_t;
|
||||
|
||||
pub type mach_port_seqno_t = natural_t;
|
||||
pub type mach_port_mscount_t = natural_t;
|
||||
pub type mach_port_msgcount_t = natural_t;
|
||||
pub type mach_port_rights_t = natural_t;
|
||||
|
||||
pub const MACH_PORT_QLIMIT_ZERO: mach_port_msgcount_t = 0;
|
||||
pub const MACH_PORT_QLIMIT_BASIC: mach_port_msgcount_t = 5;
|
||||
pub const MACH_PORT_QLIMIT_SMALL: mach_port_msgcount_t = 16;
|
||||
pub const MACH_PORT_QLIMIT_LARGE: mach_port_msgcount_t = 1024;
|
||||
pub const MACH_PORT_QLIMIT_KERNEL: mach_port_msgcount_t = 65534;
|
||||
pub const MACH_PORT_QLIMIT_MIN: mach_port_msgcount_t = MACH_PORT_QLIMIT_ZERO;
|
||||
pub const MACH_PORT_QLIMIT_DEFAULT: mach_port_msgcount_t = MACH_PORT_QLIMIT_BASIC;
|
||||
pub const MACH_PORT_QLIMIT_MAX: mach_port_msgcount_t = MACH_PORT_QLIMIT_LARGE;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct mach_port_limits_t {
|
||||
pub mpl_qlimit: mach_port_msgcount_t,
|
||||
}
|
||||
|
||||
pub const MPO_CONTEXT_AS_GUARD: u32 = 1;
|
||||
pub const MPO_QLIMIT: u32 = 2;
|
||||
pub const MPO_TEMPOWNER: u32 = 4;
|
||||
pub const MPO_IMPORTANCE_RECEIVER: u32 = 8;
|
||||
pub const MPO_INSERT_SEND_RIGHT: u32 = 0x10;
|
||||
pub const MPO_STRICT: u32 = 0x20;
|
||||
pub const MPO_DENAP_RECEIVER: u32 = 0x40;
|
||||
pub const MPO_IMMOVABLE_RECEIVE: u32 = 0x80;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct mach_port_options_t {
|
||||
pub flags: u32,
|
||||
pub mpl: mach_port_limits_t,
|
||||
pub reserved: [u64; 2],
|
||||
}
|
||||
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
//! This module corresponds to `mach/semaphore.h`
|
||||
|
||||
use crate::clock_types::mach_timespec_t;
|
||||
use crate::kern_return::kern_return_t;
|
||||
use crate::mach_types::{semaphore_t, task_t};
|
||||
use crate::sync_policy::sync_policy_t;
|
||||
use core::ffi::c_int;
|
||||
|
||||
unsafe extern "C" {
|
||||
pub fn semaphore_create(
|
||||
task: task_t,
|
||||
semaphore: *mut semaphore_t,
|
||||
policy: sync_policy_t,
|
||||
value: c_int,
|
||||
) -> kern_return_t;
|
||||
pub fn semaphore_signal(semaphore: *mut semaphore_t) -> kern_return_t;
|
||||
pub fn semaphore_wait(semaphore: *mut semaphore_t) -> kern_return_t;
|
||||
pub fn semaphore_timedwait(
|
||||
semaphore: *mut semaphore_t,
|
||||
timeout: mach_timespec_t,
|
||||
) -> kern_return_t;
|
||||
pub fn semaphore_destroy(task: task_t, semaphore: *mut semaphore_t) -> kern_return_t;
|
||||
}
|
||||
+31
-27
@@ -1,8 +1,33 @@
|
||||
//! This module corresponds to `mach/_structs.h`.
|
||||
//! This module corresponds to `mach/i386/_structs.h` and `mach/arm/_structs.h`.
|
||||
|
||||
use mem;
|
||||
use message::mach_msg_type_number_t;
|
||||
use crate::message::mach_msg_type_number_t;
|
||||
use core::ffi::c_int;
|
||||
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct arm_thread_state64_t {
|
||||
pub __x: [u64; 29],
|
||||
pub __fp: u64,
|
||||
pub __lr: u64,
|
||||
pub __sp: u64,
|
||||
pub __pc: u64,
|
||||
pub __cpsr: u32,
|
||||
pub __pad: u32,
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
impl arm_thread_state64_t {
|
||||
pub fn new() -> Self {
|
||||
Default::default()
|
||||
}
|
||||
|
||||
pub fn count() -> mach_msg_type_number_t {
|
||||
(core::mem::size_of::<Self>() / core::mem::size_of::<c_int>()) as mach_msg_type_number_t
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct x86_thread_state64_t {
|
||||
@@ -29,34 +54,13 @@ pub struct x86_thread_state64_t {
|
||||
pub __gs: u64,
|
||||
}
|
||||
|
||||
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
|
||||
impl x86_thread_state64_t {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
__rax: 0,
|
||||
__rbx: 0,
|
||||
__rcx: 0,
|
||||
__rdx: 0,
|
||||
__rdi: 0,
|
||||
__rsi: 0,
|
||||
__rbp: 0,
|
||||
__rsp: 0,
|
||||
__r8: 0,
|
||||
__r9: 0,
|
||||
__r10: 0,
|
||||
__r11: 0,
|
||||
__r12: 0,
|
||||
__r13: 0,
|
||||
__r14: 0,
|
||||
__r15: 0,
|
||||
__rip: 0,
|
||||
__rflags: 0,
|
||||
__cs: 0,
|
||||
__fs: 0,
|
||||
__gs: 0,
|
||||
}
|
||||
Default::default()
|
||||
}
|
||||
|
||||
pub fn count() -> mach_msg_type_number_t {
|
||||
(mem::size_of::<Self>() / mem::size_of::<::libc::c_int>()) as mach_msg_type_number_t
|
||||
(core::mem::size_of::<Self>() / core::mem::size_of::<c_int>()) as mach_msg_type_number_t
|
||||
}
|
||||
}
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
//! This module corresponds to `mach/sync_policy.h`
|
||||
use core::ffi::c_int;
|
||||
|
||||
pub type sync_policy_t = c_int;
|
||||
|
||||
pub const SYNC_POLICY_FIFO: sync_policy_t = 0x0;
|
||||
pub const SYNC_POLICY_FIXED_PRIORITY: sync_policy_t = 0x1;
|
||||
pub const SYNC_POLICY_REVERSED: sync_policy_t = 0x2;
|
||||
pub const SYNC_POLICY_ORDER_MASK: sync_policy_t = 0x3;
|
||||
pub const SYNC_POLICY_LIFO: sync_policy_t = SYNC_POLICY_FIFO | SYNC_POLICY_REVERSED;
|
||||
Vendored
+972
-18
File diff suppressed because it is too large
Load Diff
+304
-28
@@ -1,40 +1,158 @@
|
||||
//! This module roughly corresponds to `mach/task_info.h`.
|
||||
|
||||
use vm_types::{integer_t, mach_vm_address_t, mach_vm_size_t, natural_t};
|
||||
use crate::message::{audit_token_t, security_token_t};
|
||||
use crate::policy::policy_t;
|
||||
use crate::time_value::time_value_t;
|
||||
use crate::vm_statistics::{vm_extmod_statistics_data_t, vm_purgeable_info};
|
||||
use crate::vm_types::{integer_t, mach_vm_address_t, mach_vm_size_t, natural_t, vm_size_t};
|
||||
use core::ffi::{c_uchar, c_uint};
|
||||
use core::mem;
|
||||
|
||||
pub const TASK_INFO_MAX: ::libc::c_uint = 1024;
|
||||
pub const TASK_BASIC_INFO_32: ::libc::c_uint = 4;
|
||||
pub const TASK_BASIC2_INFO_32: ::libc::c_uint = 6;
|
||||
pub const TASK_BASIC_INFO_64: ::libc::c_uint = 5;
|
||||
pub const TASK_INFO_MAX: c_uint = 1024;
|
||||
pub const TASK_BASIC_INFO_32: c_uint = 4;
|
||||
pub const TASK_BASIC2_INFO_32: c_uint = 6;
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
pub const TASK_BASIC_INFO: ::libc::c_uint = 5;
|
||||
pub const TASK_BASIC_INFO_64: c_uint = 5;
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
pub const TASK_BASIC_INFO_64: c_uint = 18;
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
pub const TASK_BASIC_INFO: c_uint = 5;
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
pub const TASK_BASIC_INFO: c_uint = 18;
|
||||
#[cfg(target_arch = "x86")]
|
||||
pub const TASK_BASIC_INFO: ::libc::c_uint = 4;
|
||||
pub const TASK_EVENTS_INFO: ::libc::c_uint = 2;
|
||||
pub const TASK_THREAD_TIMES_INFO: ::libc::c_uint = 3;
|
||||
pub const TASK_ABSOLUTETIME_INFO: ::libc::c_uint = 1;
|
||||
pub const TASK_KERNELMEMORY_INFO: ::libc::c_uint = 7;
|
||||
pub const TASK_SECURITY_TOKEN: ::libc::c_uint = 13;
|
||||
pub const TASK_AUDIT_TOKEN: ::libc::c_uint = 15;
|
||||
pub const TASK_AFFINITY_TAG_INFO: ::libc::c_uint = 16;
|
||||
pub const TASK_DYLD_INFO: ::libc::c_uint = 17;
|
||||
pub const TASK_DYLD_ALL_IMAGE_INFO_32: ::libc::c_uint = 0;
|
||||
pub const TASK_DYLD_ALL_IMAGE_INFO_64: ::libc::c_uint = 1;
|
||||
pub const TASK_EXTMOD_INFO: ::libc::c_uint = 19;
|
||||
pub const MACH_TASK_BASIC_INFO: ::libc::c_uint = 20;
|
||||
pub const TASK_POWER_INFO: ::libc::c_uint = 21;
|
||||
pub const TASK_VM_INFO: ::libc::c_uint = 22;
|
||||
pub const TASK_VM_INFO_PURGEABLE: ::libc::c_uint = 23;
|
||||
pub const TASK_TRACE_MEMORY_INFO: ::libc::c_uint = 24;
|
||||
pub const TASK_WAIT_STATE_INFO: ::libc::c_uint = 25;
|
||||
pub const TASK_POWER_INFO_V2: ::libc::c_uint = 26;
|
||||
pub const TASK_VM_INFO_PURGEABLE_ACCOUNT: ::libc::c_uint = 27;
|
||||
pub const TASK_FLAGS_INFO: ::libc::c_uint = 28;
|
||||
pub const TASK_DEBUG_INFO_INTERNAL: ::libc::c_uint = 29;
|
||||
pub const TASK_BASIC_INFO: c_uint = 4;
|
||||
pub const TASK_EVENTS_INFO: c_uint = 2;
|
||||
pub const TASK_THREAD_TIMES_INFO: c_uint = 3;
|
||||
pub const TASK_ABSOLUTETIME_INFO: c_uint = 1;
|
||||
pub const TASK_KERNELMEMORY_INFO: c_uint = 7;
|
||||
pub const TASK_SECURITY_TOKEN: c_uint = 13;
|
||||
pub const TASK_AUDIT_TOKEN: c_uint = 15;
|
||||
pub const TASK_AFFINITY_TAG_INFO: c_uint = 16;
|
||||
pub const TASK_DYLD_INFO: c_uint = 17;
|
||||
pub const TASK_DYLD_ALL_IMAGE_INFO_32: c_uint = 0;
|
||||
pub const TASK_DYLD_ALL_IMAGE_INFO_64: c_uint = 1;
|
||||
pub const TASK_EXTMOD_INFO: c_uint = 19;
|
||||
pub const MACH_TASK_BASIC_INFO: c_uint = 20;
|
||||
pub const TASK_POWER_INFO: c_uint = 21;
|
||||
pub const TASK_VM_INFO: c_uint = 22;
|
||||
pub const TASK_VM_INFO_PURGEABLE: c_uint = 23;
|
||||
pub const TASK_TRACE_MEMORY_INFO: c_uint = 24;
|
||||
pub const TASK_WAIT_STATE_INFO: c_uint = 25;
|
||||
pub const TASK_POWER_INFO_V2: c_uint = 26;
|
||||
pub const TASK_VM_INFO_PURGEABLE_ACCOUNT: c_uint = 27;
|
||||
pub const TASK_FLAGS_INFO: c_uint = 28;
|
||||
pub const TASK_DEBUG_INFO_INTERNAL: c_uint = 29;
|
||||
|
||||
pub type task_flavor_t = natural_t;
|
||||
pub type task_info_t = *mut integer_t;
|
||||
|
||||
#[repr(C, packed(4))]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct task_basic_info_32 {
|
||||
pub suspend_count: integer_t,
|
||||
pub virtual_size: natural_t,
|
||||
pub resident_size: natural_t,
|
||||
pub user_time: time_value_t,
|
||||
pub system_time: time_value_t,
|
||||
pub policy: policy_t,
|
||||
}
|
||||
|
||||
pub const TASK_BASIC_INFO_32_COUNT: u32 =
|
||||
(mem::size_of::<task_basic_info_32>() / mem::size_of::<natural_t>()) as u32;
|
||||
|
||||
#[repr(C, packed(4))]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct task_basic_info_64 {
|
||||
pub suspend_count: integer_t,
|
||||
pub virtual_size: mach_vm_size_t,
|
||||
pub resident_size: mach_vm_size_t,
|
||||
pub user_time: time_value_t,
|
||||
pub system_time: time_value_t,
|
||||
pub policy: policy_t,
|
||||
}
|
||||
|
||||
pub const TASK_BASIC_INFO_64_COUNT: u32 =
|
||||
(mem::size_of::<task_basic_info_64>() / mem::size_of::<natural_t>()) as u32;
|
||||
|
||||
#[repr(C, packed(4))]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct task_basic_info {
|
||||
pub suspend_count: integer_t,
|
||||
pub virtual_size: vm_size_t,
|
||||
pub resident_size: vm_size_t,
|
||||
pub user_time: time_value_t,
|
||||
pub system_time: time_value_t,
|
||||
pub policy: policy_t,
|
||||
}
|
||||
|
||||
pub const TASK_BASIC_INFO_COUNT: u32 =
|
||||
(mem::size_of::<task_basic_info>() / mem::size_of::<natural_t>()) as u32;
|
||||
|
||||
#[repr(C, packed(4))]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct task_events_info {
|
||||
pub faults: integer_t,
|
||||
pub pageins: integer_t,
|
||||
pub cow_faults: integer_t,
|
||||
pub messages_sent: integer_t,
|
||||
pub messages_received: integer_t,
|
||||
pub syscalls_mach: integer_t,
|
||||
pub syscalls_unix: integer_t,
|
||||
pub csw: integer_t,
|
||||
}
|
||||
|
||||
pub const TASK_EVENTS_INFO_COUNT: u32 =
|
||||
(mem::size_of::<task_events_info>() / mem::size_of::<natural_t>()) as u32;
|
||||
|
||||
#[repr(C, packed(4))]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct task_thread_times_info {
|
||||
pub user_time: time_value_t,
|
||||
pub system_time: time_value_t,
|
||||
}
|
||||
|
||||
pub const TASK_THREAD_TIMES_INFO_COUNT: u32 =
|
||||
(mem::size_of::<task_thread_times_info>() / mem::size_of::<natural_t>()) as u32;
|
||||
|
||||
#[repr(C, packed(4))]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct task_absolutetime_info {
|
||||
pub total_user: u64,
|
||||
pub total_system: u64,
|
||||
pub threads_user: u64,
|
||||
pub threads_system: u64,
|
||||
}
|
||||
|
||||
pub const TASK_ABSOLUTETIME_INFO_COUNT: u32 =
|
||||
(mem::size_of::<task_absolutetime_info>() / mem::size_of::<natural_t>()) as u32;
|
||||
|
||||
#[repr(C, packed(4))]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct task_kernelmemory_info {
|
||||
pub total_palloc: u64,
|
||||
pub total_pfree: u64,
|
||||
pub total_salloc: u64,
|
||||
pub total_sfree: u64,
|
||||
}
|
||||
|
||||
pub const TASK_KERNELMEMORY_INFO_COUNT: u32 =
|
||||
(mem::size_of::<task_kernelmemory_info>() / mem::size_of::<natural_t>()) as u32;
|
||||
|
||||
pub const TASK_SECURITY_TOKEN_COUNT: u32 =
|
||||
(mem::size_of::<security_token_t>() / mem::size_of::<natural_t>()) as u32;
|
||||
|
||||
pub const TASK_AUDIT_TOKEN_COUNT: u32 =
|
||||
(mem::size_of::<audit_token_t>() / mem::size_of::<natural_t>()) as u32;
|
||||
|
||||
#[repr(C, packed(4))]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct task_affinity_tag_info {
|
||||
pub set_count: integer_t,
|
||||
pub min: integer_t,
|
||||
pub max: integer_t,
|
||||
pub task_count: integer_t,
|
||||
}
|
||||
|
||||
#[repr(C, packed(4))]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct task_dyld_info {
|
||||
@@ -42,3 +160,161 @@ pub struct task_dyld_info {
|
||||
pub all_image_info_size: mach_vm_size_t,
|
||||
pub all_image_info_format: integer_t,
|
||||
}
|
||||
|
||||
pub const TASK_DYLD_INFO_COUNT: u32 =
|
||||
(mem::size_of::<task_dyld_info>() / mem::size_of::<natural_t>()) as u32;
|
||||
|
||||
#[repr(C, packed(4))]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct task_extmod_info {
|
||||
pub task_uuid: [c_uchar; 16usize],
|
||||
pub extmod_statistics: vm_extmod_statistics_data_t,
|
||||
}
|
||||
|
||||
pub const TASK_EXTMOD_INFO_COUNT: u32 =
|
||||
(mem::size_of::<task_extmod_info>() / mem::size_of::<natural_t>()) as u32;
|
||||
|
||||
#[repr(C, packed(4))]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct task_power_info {
|
||||
pub total_user: u64,
|
||||
pub total_system: u64,
|
||||
pub task_interrupt_wakeups: u64,
|
||||
pub task_platform_idle_wakeups: u64,
|
||||
pub task_timer_wakeups_bin_1: u64,
|
||||
pub task_timer_wakeups_bin_2: u64,
|
||||
}
|
||||
|
||||
pub const TASK_POWER_INFO_COUNT: u32 =
|
||||
(mem::size_of::<task_power_info>() / mem::size_of::<natural_t>()) as u32;
|
||||
|
||||
#[repr(C, packed(4))]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct task_vm_info {
|
||||
pub virtual_size: mach_vm_size_t,
|
||||
pub region_count: integer_t,
|
||||
pub page_size: integer_t,
|
||||
pub resident_size: mach_vm_size_t,
|
||||
pub resident_size_peak: mach_vm_size_t,
|
||||
pub device: mach_vm_size_t,
|
||||
pub device_peak: mach_vm_size_t,
|
||||
pub internal: mach_vm_size_t,
|
||||
pub internal_peak: mach_vm_size_t,
|
||||
pub external: mach_vm_size_t,
|
||||
pub external_peak: mach_vm_size_t,
|
||||
pub reusable: mach_vm_size_t,
|
||||
pub reusable_peak: mach_vm_size_t,
|
||||
pub purgeable_volatile_pmap: mach_vm_size_t,
|
||||
pub purgeable_volatile_resident: mach_vm_size_t,
|
||||
pub purgeable_volatile_virtual: mach_vm_size_t,
|
||||
pub compressed: mach_vm_size_t,
|
||||
pub compressed_peak: mach_vm_size_t,
|
||||
pub compressed_lifetime: mach_vm_size_t,
|
||||
pub phys_footprint: mach_vm_size_t,
|
||||
pub min_address: mach_vm_address_t,
|
||||
pub max_address: mach_vm_address_t,
|
||||
pub ledger_phys_footprint_peak: i64,
|
||||
pub ledger_purgeable_nonvolatile: i64,
|
||||
pub ledger_purgeable_novolatile_compressed: i64,
|
||||
pub ledger_purgeable_volatile: i64,
|
||||
pub ledger_purgeable_volatile_compressed: i64,
|
||||
pub ledger_tag_network_nonvolatile: i64,
|
||||
pub ledger_tag_network_nonvolatile_compressed: i64,
|
||||
pub ledger_tag_network_volatile: i64,
|
||||
pub ledger_tag_network_volatile_compressed: i64,
|
||||
pub ledger_tag_media_footprint: i64,
|
||||
pub ledger_tag_media_footprint_compressed: i64,
|
||||
pub ledger_tag_media_nofootprint: i64,
|
||||
pub ledger_tag_media_nofootprint_compressed: i64,
|
||||
pub ledger_tag_graphics_footprint: i64,
|
||||
pub ledger_tag_graphics_footprint_compressed: i64,
|
||||
pub ledger_tag_graphics_nofootprint: i64,
|
||||
pub ledger_tag_graphics_nofootprint_compressed: i64,
|
||||
pub ledger_tag_neural_footprint: i64,
|
||||
pub ledger_tag_neural_footprint_compressed: i64,
|
||||
pub ledger_tag_neural_nofootprint: i64,
|
||||
pub ledger_tag_neural_nofootprint_compressed: i64,
|
||||
pub limit_bytes_remaining: u64,
|
||||
pub decompressions: integer_t,
|
||||
pub ledger_swapins: i64,
|
||||
pub ledger_tag_neural_nofootprint_total: i64,
|
||||
pub ledger_tag_neural_nofootprint_peak: i64,
|
||||
}
|
||||
|
||||
#[repr(C, packed(4))]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct mach_task_basic_info {
|
||||
pub virtual_size: mach_vm_size_t,
|
||||
pub resident_size: mach_vm_size_t,
|
||||
pub resident_size_max: mach_vm_size_t,
|
||||
pub user_time: time_value_t,
|
||||
pub system_time: time_value_t,
|
||||
pub policy: policy_t,
|
||||
pub suspend_count: integer_t,
|
||||
}
|
||||
|
||||
pub const MACH_TASK_BASIC_INFO_COUNT: u32 =
|
||||
(mem::size_of::<mach_task_basic_info>() / mem::size_of::<natural_t>()) as u32;
|
||||
|
||||
#[repr(C, packed(4))]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct task_trace_memory_info {
|
||||
pub user_memory_address: u64,
|
||||
pub buffer_size: u64,
|
||||
pub mailbox_array_size: u64,
|
||||
}
|
||||
|
||||
#[repr(C, packed(4))]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct task_wait_state_info {
|
||||
pub total_wait_state_time: u64,
|
||||
pub total_wait_sfi_state_time: u64,
|
||||
pub _reserved: [u32; 4],
|
||||
}
|
||||
|
||||
#[repr(C, packed(4))]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct gpu_energy_data {
|
||||
pub task_gpu_utilisation: u64,
|
||||
pub task_gpu_stat_reserved0: u64,
|
||||
pub task_gpu_stat_reserved1: u64,
|
||||
pub task_gpu_stat_reserved2: u64,
|
||||
}
|
||||
|
||||
#[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
|
||||
#[repr(C, packed(4))]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct task_power_info_v2 {
|
||||
pub cpu_energy: task_power_info,
|
||||
pub gpu_energy: gpu_energy_data,
|
||||
pub task_energy: u64,
|
||||
pub task_ptime: u64,
|
||||
pub task_pset_switches: u64,
|
||||
}
|
||||
|
||||
#[cfg(not(any(target_arch = "arm", target_arch = "aarch64")))]
|
||||
#[repr(C, packed(4))]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct task_power_info_v2 {
|
||||
pub cpu_energy: task_power_info,
|
||||
pub gpu_energy: gpu_energy_data,
|
||||
pub task_ptime: u64,
|
||||
pub task_pset_switches: u64,
|
||||
}
|
||||
|
||||
pub const TASK_POWER_INFO_V2_COUNT: u32 =
|
||||
(mem::size_of::<task_power_info_v2>() / mem::size_of::<natural_t>()) as u32;
|
||||
|
||||
pub type task_purgable_info_t = vm_purgeable_info;
|
||||
|
||||
pub type task_exc_guard_behavior_t = u32;
|
||||
pub type task_corpse_forking_behavior_t = u32;
|
||||
|
||||
#[repr(C, packed(4))]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct task_flags_info {
|
||||
pub flags: u32,
|
||||
}
|
||||
|
||||
pub const TASK_FLAGS_INFO_COUNT: u32 =
|
||||
(mem::size_of::<task_flags_info>() / mem::size_of::<natural_t>()) as u32;
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
//! This module corresponds to `mach/task_inspect.h`.
|
||||
|
||||
use crate::vm_types::{integer_t, natural_t};
|
||||
use core::mem;
|
||||
|
||||
pub type task_inspect_flavor_t = natural_t;
|
||||
pub const TASK_INSPECT_BASIC_COUNTS: task_inspect_flavor_t = 1;
|
||||
pub const TASK_INSPECT_BASIC_COUNTS_COUNT: u32 =
|
||||
(mem::size_of::<task_inspect_basic_counts>() / mem::size_of::<natural_t>()) as u32;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct task_inspect_basic_counts {
|
||||
pub instructions: u64,
|
||||
pub cycles: u64,
|
||||
}
|
||||
|
||||
pub type task_inspect_basic_counts_data_t = task_inspect_basic_counts;
|
||||
pub type task_inspect_basic_counts_t = *mut task_inspect_basic_counts;
|
||||
|
||||
pub type task_inspect_info_t = *mut integer_t;
|
||||
@@ -0,0 +1,80 @@
|
||||
//! This module corresponds to `mach/task_special_ports.h`.
|
||||
|
||||
use crate::kern_return::kern_return_t;
|
||||
use crate::mach_types::task_t;
|
||||
use crate::port::mach_port_t;
|
||||
use core::ffi::c_int;
|
||||
|
||||
pub type task_special_port_t = c_int;
|
||||
|
||||
pub const TASK_KERNEL_PORT: task_special_port_t = 1;
|
||||
pub const TASK_HOST_PORT: task_special_port_t = 2;
|
||||
pub const TASK_NAME_PORT: task_special_port_t = 3;
|
||||
pub const TASK_BOOTSTRAP_PORT: task_special_port_t = 4;
|
||||
pub const TASK_INSPECT_PORT: task_special_port_t = 5;
|
||||
pub const TASK_READ_PORT: task_special_port_t = 6;
|
||||
pub const TASK_ACCESS_PORT: task_special_port_t = 9;
|
||||
pub const TASK_DEBUG_CONTROL_PORT: task_special_port_t = 10;
|
||||
pub const TASK_RESOURCE_NOTIFY_PORT: task_special_port_t = 11;
|
||||
|
||||
pub const TASK_MAX_SPECIAL_PORT: task_special_port_t = TASK_RESOURCE_NOTIFY_PORT;
|
||||
|
||||
#[inline]
|
||||
#[allow(clippy::missing_safety_doc)]
|
||||
pub unsafe fn task_get_kernel_port(task: task_t, port: *mut mach_port_t) -> kern_return_t {
|
||||
unsafe { crate::task::task_get_special_port(task, TASK_KERNEL_PORT, port) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[allow(clippy::missing_safety_doc)]
|
||||
pub unsafe fn task_set_kernel_port(task: task_t, port: mach_port_t) -> kern_return_t {
|
||||
unsafe { crate::task::task_set_special_port(task, TASK_KERNEL_PORT, port) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[allow(clippy::missing_safety_doc)]
|
||||
pub unsafe fn task_get_host_port(task: task_t, port: *mut mach_port_t) -> kern_return_t {
|
||||
unsafe { crate::task::task_get_special_port(task, TASK_HOST_PORT, port) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[allow(clippy::missing_safety_doc)]
|
||||
pub unsafe fn task_set_host_port(task: task_t, port: mach_port_t) -> kern_return_t {
|
||||
unsafe { crate::task::task_set_special_port(task, TASK_HOST_PORT, port) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[allow(clippy::missing_safety_doc)]
|
||||
pub unsafe fn task_get_bootstrap_port(task: task_t, port: *mut mach_port_t) -> kern_return_t {
|
||||
unsafe { crate::task::task_get_special_port(task, TASK_BOOTSTRAP_PORT, port) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[allow(clippy::missing_safety_doc)]
|
||||
pub unsafe fn task_set_bootstrap_port(task: task_t, port: mach_port_t) -> kern_return_t {
|
||||
unsafe { crate::task::task_set_special_port(task, TASK_BOOTSTRAP_PORT, port) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[allow(clippy::missing_safety_doc)]
|
||||
pub unsafe fn task_get_debug_control_port(task: task_t, port: *mut mach_port_t) -> kern_return_t {
|
||||
unsafe { crate::task::task_get_special_port(task, TASK_DEBUG_CONTROL_PORT, port) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[allow(clippy::missing_safety_doc)]
|
||||
pub unsafe fn task_set_task_debug_control_port(task: task_t, port: mach_port_t) -> kern_return_t {
|
||||
unsafe { crate::task::task_set_special_port(task, TASK_DEBUG_CONTROL_PORT, port) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[allow(clippy::missing_safety_doc)]
|
||||
pub unsafe fn task_get_task_access_port(task: task_t, port: *mut mach_port_t) -> kern_return_t {
|
||||
unsafe { crate::task::task_get_special_port(task, TASK_ACCESS_PORT, port) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[allow(clippy::missing_safety_doc)]
|
||||
pub unsafe fn task_set_task_access_port(task: task_t, port: mach_port_t) -> kern_return_t {
|
||||
unsafe { crate::task::task_set_special_port(task, TASK_ACCESS_PORT, port) }
|
||||
}
|
||||
+23
-10
@@ -1,23 +1,36 @@
|
||||
//! This module corresponds to `mach/thread_act.defs`.
|
||||
|
||||
use kern_return::kern_return_t;
|
||||
use mach_types::thread_act_t;
|
||||
use message::mach_msg_type_number_t;
|
||||
use thread_status::{thread_state_flavor_t, thread_state_t};
|
||||
use crate::exception_types::{exception_behavior_t, exception_mask_t};
|
||||
use crate::kern_return::kern_return_t;
|
||||
use crate::mach_types::{thread_act_t, thread_port_t};
|
||||
use crate::message::mach_msg_type_number_t;
|
||||
use crate::port::mach_port_t;
|
||||
use crate::thread_status::{thread_state_flavor_t, thread_state_t};
|
||||
|
||||
extern "C" {
|
||||
unsafe extern "C" {
|
||||
pub fn thread_get_state(
|
||||
target_act: thread_act_t,
|
||||
flavor: thread_state_flavor_t,
|
||||
old_state: thread_state_t,
|
||||
old_state_count: *mut mach_msg_type_number_t,
|
||||
) -> kern_return_t;
|
||||
|
||||
pub fn thread_set_state(
|
||||
target_act: thread_port_t,
|
||||
flavor: thread_state_flavor_t,
|
||||
new_state: thread_state_t,
|
||||
new_state_count: *mut mach_msg_type_number_t,
|
||||
new_stateCnt: mach_msg_type_number_t,
|
||||
) -> kern_return_t;
|
||||
|
||||
pub fn thread_set_exception_ports(
|
||||
thread: thread_port_t,
|
||||
exception_mask: exception_mask_t,
|
||||
new_port: mach_port_t,
|
||||
behavior: exception_behavior_t,
|
||||
new_flavor: thread_state_flavor_t,
|
||||
) -> kern_return_t;
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
pub fn thread_suspend(target_act: thread_act_t) -> kern_return_t;
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
pub fn thread_resume(target_act: thread_act_t) -> kern_return_t;
|
||||
}
|
||||
|
||||
+8
-9
@@ -1,11 +1,12 @@
|
||||
//! This module corresponds to `mach/thread_policy.h`.
|
||||
|
||||
use boolean::boolean_t;
|
||||
use kern_return::kern_return_t;
|
||||
use libc::thread_policy_t;
|
||||
use mach_types::thread_t;
|
||||
use message::mach_msg_type_number_t;
|
||||
use vm_types::{integer_t, natural_t};
|
||||
use crate::boolean::boolean_t;
|
||||
use crate::kern_return::kern_return_t;
|
||||
use crate::mach_types::thread_t;
|
||||
use crate::message::mach_msg_type_number_t;
|
||||
use crate::vm_types::{integer_t, natural_t};
|
||||
|
||||
pub type thread_policy_t = *mut integer_t;
|
||||
|
||||
pub type thread_policy_flavor_t = natural_t;
|
||||
|
||||
@@ -101,16 +102,14 @@ pub const THREAD_LATENCY_QOS_POLICY_COUNT: mach_msg_type_number_t =
|
||||
pub const THREAD_THROUGHPUT_QOS_POLICY_COUNT: mach_msg_type_number_t =
|
||||
(core::mem::size_of::<thread_throughput_qos_policy>() / core::mem::size_of::<integer_t>()) as _;
|
||||
|
||||
extern "C" {
|
||||
unsafe extern "C" {
|
||||
pub fn thread_policy_set(
|
||||
thread: thread_t,
|
||||
flavor: thread_policy_flavor_t,
|
||||
policy_info: thread_policy_t,
|
||||
count: mach_msg_type_number_t,
|
||||
) -> kern_return_t;
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
pub fn thread_policy_get(
|
||||
thread: thread_t,
|
||||
flavor: thread_policy_flavor_t,
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
//! This module corresponds to `mach/thread_special_ports.h`.
|
||||
use core::ffi::c_int;
|
||||
|
||||
pub const THREAD_KERNEL_PORT: c_int = 1;
|
||||
pub const THREAD_INSPECT_PORT: c_int = 2;
|
||||
pub const THREAD_READ_PORT: c_int = 3;
|
||||
pub const THREAD_MAX_SPECIAL_PORT: c_int = THREAD_READ_PORT;
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
//! This module corresponds to `mach/thread_state.h`.
|
||||
|
||||
use crate::kern_return::kern_return_t;
|
||||
use crate::mach_types::thread_t;
|
||||
|
||||
unsafe extern "C" {
|
||||
pub fn thread_get_register_pointer_values(
|
||||
thread: thread_t,
|
||||
sp: *mut usize,
|
||||
length: *mut usize,
|
||||
values: *mut usize,
|
||||
) -> kern_return_t;
|
||||
}
|
||||
+49
-18
@@ -1,23 +1,54 @@
|
||||
//! This module corresponds to `mach/thread_status.h`.
|
||||
|
||||
use vm_types::natural_t;
|
||||
use crate::vm_types::natural_t;
|
||||
use core::ffi::c_int;
|
||||
|
||||
pub type thread_state_t = *mut natural_t;
|
||||
pub type thread_state_flavor_t = ::libc::c_int;
|
||||
pub type thread_state_flavor_t = c_int;
|
||||
|
||||
pub static x86_THREAD_STATE32: thread_state_flavor_t = 1;
|
||||
pub static x86_FLOAT_STATE32: thread_state_flavor_t = 2;
|
||||
pub static x86_EXCEPTION_STATE32: thread_state_flavor_t = 3;
|
||||
pub static x86_THREAD_STATE64: thread_state_flavor_t = 4;
|
||||
pub static x86_FLOAT_STATE64: thread_state_flavor_t = 5;
|
||||
pub static x86_EXCEPTION_STATE64: thread_state_flavor_t = 6;
|
||||
pub static x86_THREAD_STATE: thread_state_flavor_t = 7;
|
||||
pub static x86_FLOAT_STATE: thread_state_flavor_t = 8;
|
||||
pub static x86_EXCEPTION_STATE: thread_state_flavor_t = 9;
|
||||
pub static x86_DEBUG_STATE32: thread_state_flavor_t = 10;
|
||||
pub static x86_DEBUG_STATE64: thread_state_flavor_t = 11;
|
||||
pub static x86_DEBUG_STATE: thread_state_flavor_t = 12;
|
||||
pub static THREAD_STATE_NONE: thread_state_flavor_t = 13;
|
||||
pub static x86_AVX_STATE32: thread_state_flavor_t = 16;
|
||||
pub static x86_AVX_STATE64: thread_state_flavor_t = 17;
|
||||
pub static x86_AVX_STATE: thread_state_flavor_t = 18;
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
mod aarch64 {
|
||||
use super::thread_state_flavor_t;
|
||||
|
||||
pub static ARM_THREAD_STATE: thread_state_flavor_t = 1;
|
||||
pub static ARM_UNIFIED_THREAD_STATE: thread_state_flavor_t = ARM_THREAD_STATE;
|
||||
pub static ARM_VFP_STATE: thread_state_flavor_t = 2;
|
||||
pub static ARM_EXCEPTION_STATE: thread_state_flavor_t = 3;
|
||||
pub static ARM_DEBUG_STATE: thread_state_flavor_t = 4;
|
||||
pub static THREAD_STATE_NONE: thread_state_flavor_t = 5;
|
||||
pub static ARM_THREAD_STATE64: thread_state_flavor_t = 6;
|
||||
pub static ARM_EXCEPTION_STATE64: thread_state_flavor_t = 7;
|
||||
pub static ARM_DEBUG_STATE32: thread_state_flavor_t = 14;
|
||||
pub static ARM_DEBUG_STATE64: thread_state_flavor_t = 15;
|
||||
pub static ARM_NEON_STATE: thread_state_flavor_t = 16;
|
||||
pub static ARM_NEON_STATE64: thread_state_flavor_t = 17;
|
||||
pub static ARM_CPMU_STATE64: thread_state_flavor_t = 18;
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
pub use self::aarch64::*;
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
mod x86_64 {
|
||||
use super::thread_state_flavor_t;
|
||||
|
||||
pub static x86_THREAD_STATE32: thread_state_flavor_t = 1;
|
||||
pub static x86_FLOAT_STATE32: thread_state_flavor_t = 2;
|
||||
pub static x86_EXCEPTION_STATE32: thread_state_flavor_t = 3;
|
||||
pub static x86_THREAD_STATE64: thread_state_flavor_t = 4;
|
||||
pub static x86_FLOAT_STATE64: thread_state_flavor_t = 5;
|
||||
pub static x86_EXCEPTION_STATE64: thread_state_flavor_t = 6;
|
||||
pub static x86_THREAD_STATE: thread_state_flavor_t = 7;
|
||||
pub static x86_FLOAT_STATE: thread_state_flavor_t = 8;
|
||||
pub static x86_EXCEPTION_STATE: thread_state_flavor_t = 9;
|
||||
pub static x86_DEBUG_STATE32: thread_state_flavor_t = 10;
|
||||
pub static x86_DEBUG_STATE64: thread_state_flavor_t = 11;
|
||||
pub static x86_DEBUG_STATE: thread_state_flavor_t = 12;
|
||||
pub static THREAD_STATE_NONE: thread_state_flavor_t = 13;
|
||||
pub static x86_AVX_STATE32: thread_state_flavor_t = 16;
|
||||
pub static x86_AVX_STATE64: thread_state_flavor_t = 17;
|
||||
pub static x86_AVX_STATE: thread_state_flavor_t = 18;
|
||||
}
|
||||
|
||||
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
|
||||
pub use self::x86_64::*;
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
//! This module corresponds to `mach/thread_switch.h`.
|
||||
use core::ffi::c_int;
|
||||
|
||||
pub const SWITCH_OPTION_NONE: c_int = 0;
|
||||
pub const SWITCH_OPTION_DEPRESS: c_int = 1;
|
||||
pub const SWITCH_OPTION_WAIT: c_int = 2;
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
use crate::vm_types::integer_t;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct time_value {
|
||||
pub seconds: integer_t,
|
||||
pub microseconds: integer_t,
|
||||
}
|
||||
pub type time_value_t = time_value;
|
||||
|
||||
pub const TIME_MICROS_MAX: integer_t = 1000000;
|
||||
Vendored
+9
-8
@@ -1,30 +1,31 @@
|
||||
//! This module corresponds to `mach/mach_traps.h`.
|
||||
use kern_return::kern_return_t;
|
||||
use port::{mach_port_name_t, mach_port_t};
|
||||
use crate::kern_return::kern_return_t;
|
||||
use crate::port::{mach_port_name_t, mach_port_t};
|
||||
use core::ffi::c_int;
|
||||
|
||||
extern "C" {
|
||||
unsafe extern "C" {
|
||||
static mach_task_self_: mach_port_t;
|
||||
pub fn task_for_pid(
|
||||
target_tport: mach_port_name_t,
|
||||
pid: ::libc::c_int,
|
||||
pid: c_int,
|
||||
tn: *mut mach_port_name_t,
|
||||
) -> kern_return_t;
|
||||
}
|
||||
|
||||
#[allow(clippy::missing_safety_doc)] // FIXME
|
||||
pub unsafe fn mach_task_self() -> mach_port_t {
|
||||
mach_task_self_
|
||||
unsafe { mach_task_self_ }
|
||||
}
|
||||
|
||||
#[allow(clippy::missing_safety_doc)] // FIXME
|
||||
pub unsafe fn current_task() -> mach_port_t {
|
||||
mach_task_self()
|
||||
unsafe { mach_task_self() }
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use port::*;
|
||||
use traps::*;
|
||||
use crate::port::*;
|
||||
use crate::traps::*;
|
||||
|
||||
#[test]
|
||||
fn mach_task_self_sanity() {
|
||||
|
||||
Vendored
+27
-26
@@ -1,33 +1,34 @@
|
||||
//! This module roughly corresponds to `mach/mach_vm.defs`.
|
||||
|
||||
use boolean::boolean_t;
|
||||
use kern_return::kern_return_t;
|
||||
use mach_types::{mem_entry_name_port_t, vm_task_entry_t};
|
||||
use memory_object_types::{memory_object_offset_t, memory_object_size_t};
|
||||
use message::mach_msg_type_number_t;
|
||||
use port::mach_port_t;
|
||||
use vm_attributes::{vm_machine_attribute_t, vm_machine_attribute_val_t};
|
||||
use vm_behavior::vm_behavior_t;
|
||||
use vm_inherit::vm_inherit_t;
|
||||
use vm_prot::vm_prot_t;
|
||||
use vm_purgable::vm_purgable_t;
|
||||
use vm_region::mach_vm_read_entry_t;
|
||||
use vm_region::{
|
||||
use crate::boolean::boolean_t;
|
||||
use crate::kern_return::kern_return_t;
|
||||
use crate::mach_types::{mem_entry_name_port_t, vm_task_entry_t};
|
||||
use crate::memory_object_types::{memory_object_offset_t, memory_object_size_t};
|
||||
use crate::message::mach_msg_type_number_t;
|
||||
use crate::port::mach_port_t;
|
||||
use crate::vm_attributes::{vm_machine_attribute_t, vm_machine_attribute_val_t};
|
||||
use crate::vm_behavior::vm_behavior_t;
|
||||
use crate::vm_inherit::vm_inherit_t;
|
||||
use crate::vm_prot::vm_prot_t;
|
||||
use crate::vm_purgable::vm_purgable_t;
|
||||
use crate::vm_region::mach_vm_read_entry_t;
|
||||
use crate::vm_region::{
|
||||
vm_page_info_flavor_t, vm_page_info_t, vm_region_flavor_t, vm_region_info_t,
|
||||
vm_region_recurse_info_t,
|
||||
};
|
||||
use vm_sync::vm_sync_t;
|
||||
use vm_types::{
|
||||
use crate::vm_sync::vm_sync_t;
|
||||
use crate::vm_types::{
|
||||
integer_t, mach_vm_address_t, mach_vm_offset_t, mach_vm_size_t, natural_t, vm_map_t,
|
||||
vm_offset_t, vm_size_t,
|
||||
};
|
||||
use core::ffi::c_int;
|
||||
|
||||
extern "C" {
|
||||
unsafe extern "C" {
|
||||
pub fn mach_vm_allocate(
|
||||
target: vm_task_entry_t,
|
||||
address: *mut mach_vm_address_t,
|
||||
size: mach_vm_size_t,
|
||||
flags: ::libc::c_int,
|
||||
flags: c_int,
|
||||
) -> kern_return_t;
|
||||
|
||||
pub fn mach_vm_deallocate(
|
||||
@@ -107,7 +108,7 @@ extern "C" {
|
||||
inout: *mut mach_vm_address_t,
|
||||
size: mach_vm_size_t,
|
||||
mask: mach_vm_offset_t,
|
||||
flags: ::libc::c_int,
|
||||
flags: c_int,
|
||||
object: mem_entry_name_port_t,
|
||||
offset: memory_object_offset_t,
|
||||
copy: boolean_t,
|
||||
@@ -129,7 +130,7 @@ extern "C" {
|
||||
target_address: *mut mach_vm_address_t,
|
||||
size: mach_vm_size_t,
|
||||
mask: mach_vm_offset_t,
|
||||
flags: ::libc::c_int,
|
||||
flags: c_int,
|
||||
src_task: vm_task_entry_t,
|
||||
src_address: mach_vm_address_t,
|
||||
copy: boolean_t,
|
||||
@@ -186,7 +187,7 @@ extern "C" {
|
||||
target_task: vm_task_entry_t,
|
||||
address: mach_vm_address_t,
|
||||
control: vm_purgable_t,
|
||||
state: *mut ::libc::c_int,
|
||||
state: *mut c_int,
|
||||
) -> kern_return_t;
|
||||
|
||||
pub fn mach_vm_page_info(
|
||||
@@ -201,9 +202,9 @@ extern "C" {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use kern_return::KERN_SUCCESS;
|
||||
use traps::mach_task_self;
|
||||
use vm_statistics::VM_FLAGS_ANYWHERE;
|
||||
use crate::kern_return::KERN_SUCCESS;
|
||||
use crate::traps::mach_task_self;
|
||||
use crate::vm_statistics::VM_FLAGS_ANYWHERE;
|
||||
|
||||
#[test]
|
||||
fn mach_vm_allocate_sanity() {
|
||||
@@ -222,9 +223,9 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn mach_vm_region_sanity() {
|
||||
use mem;
|
||||
use vm_prot::{VM_PROT_EXECUTE, VM_PROT_READ};
|
||||
use vm_region::{vm_region_basic_info_64, VM_REGION_BASIC_INFO_64};
|
||||
use crate::vm_prot::{VM_PROT_EXECUTE, VM_PROT_READ};
|
||||
use crate::vm_region::{VM_REGION_BASIC_INFO_64, vm_region_basic_info_64};
|
||||
use core::mem;
|
||||
unsafe {
|
||||
let mut size = 0x10;
|
||||
let mut object_name = 0;
|
||||
|
||||
+3
-2
@@ -1,12 +1,13 @@
|
||||
//! This module corresponds to `mach/vm_attributes.h`.
|
||||
use core::ffi::{c_int, c_uint};
|
||||
|
||||
pub type vm_machine_attribute_t = ::libc::c_uint;
|
||||
pub type vm_machine_attribute_t = c_uint;
|
||||
|
||||
pub const MATTR_CACHE: vm_machine_attribute_t = 1;
|
||||
pub const MATTR_MIGRATE: vm_machine_attribute_t = 1 << 1;
|
||||
pub const MATTR_REPLICATE: vm_machine_attribute_t = 1 << 2;
|
||||
|
||||
pub type vm_machine_attribute_val_t = ::libc::c_int;
|
||||
pub type vm_machine_attribute_val_t = c_int;
|
||||
|
||||
pub const MATTR_VAL_OFF: vm_machine_attribute_val_t = 0;
|
||||
pub const MATTR_VAL_ON: vm_machine_attribute_val_t = 1;
|
||||
|
||||
+5
-1
@@ -1,6 +1,7 @@
|
||||
//! This module corresponds to `mach/vm_behavior.h`.
|
||||
use core::ffi::c_int;
|
||||
|
||||
pub type vm_behavior_t = ::libc::c_int;
|
||||
pub type vm_behavior_t = c_int;
|
||||
|
||||
pub const VM_BEHAVIOR_DEFAULT: vm_behavior_t = 0;
|
||||
pub const VM_BEHAVIOR_RANDOM: vm_behavior_t = 1;
|
||||
@@ -13,3 +14,6 @@ pub const VM_BEHAVIOR_ZERO_WIRED_PAGES: vm_behavior_t = 7;
|
||||
pub const VM_BEHAVIOR_REUSABLE: vm_behavior_t = 8;
|
||||
pub const VM_BEHAVIOR_REUSE: vm_behavior_t = 9;
|
||||
pub const VM_BEHAVIOR_CAN_REUSE: vm_behavior_t = 10;
|
||||
pub const VM_BEHAVIOR_PAGEOUT: vm_behavior_t = 11;
|
||||
pub const VM_BEHAVIOR_ZERO: vm_behavior_t = 12;
|
||||
pub const VM_BEHAVIOR_LAST_VALID: vm_behavior_t = VM_BEHAVIOR_ZERO;
|
||||
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
//! This module corresponds to `mach/vm_inherit.h`.
|
||||
use core::ffi::c_uint;
|
||||
|
||||
pub type vm_inherit_t = ::libc::c_uint;
|
||||
pub type vm_inherit_t = c_uint;
|
||||
|
||||
pub const VM_INHERIT_SHARE: vm_inherit_t = 0;
|
||||
pub const VM_INHERIT_COPY: vm_inherit_t = 1;
|
||||
|
||||
+31
-8
@@ -1,27 +1,40 @@
|
||||
//! This module roughly corresponds to `mach/vm_page_size.h`
|
||||
use crate::vm_types::{mach_vm_offset_t, mach_vm_size_t, vm_size_t};
|
||||
use core::ffi::c_int;
|
||||
|
||||
use vm_types::{mach_vm_offset_t, mach_vm_size_t, vm_size_t};
|
||||
|
||||
extern "C" {
|
||||
unsafe extern "C" {
|
||||
pub static vm_page_size: vm_size_t;
|
||||
pub static vm_page_mask: vm_size_t;
|
||||
pub static vm_page_shift: ::libc::c_int;
|
||||
pub static vm_page_shift: c_int;
|
||||
pub static vm_kernel_page_size: vm_size_t;
|
||||
pub static vm_kernel_page_mask: vm_size_t;
|
||||
pub static vm_kernel_page_shift: c_int;
|
||||
}
|
||||
|
||||
#[allow(clippy::missing_safety_doc)] // FIXME
|
||||
pub unsafe fn vm_trunc_page(x: vm_size_t) -> vm_size_t {
|
||||
unsafe { x & !(vm_page_size - 1) }
|
||||
}
|
||||
|
||||
#[allow(clippy::missing_safety_doc)] // FIXME
|
||||
pub unsafe fn vm_round_page(x: vm_size_t) -> vm_size_t {
|
||||
unsafe { vm_trunc_page(x + (vm_page_size - 1)) }
|
||||
}
|
||||
|
||||
#[allow(clippy::missing_safety_doc)] // FIXME
|
||||
pub unsafe fn mach_vm_trunc_page(x: mach_vm_offset_t) -> mach_vm_offset_t {
|
||||
x & !(vm_page_mask as mach_vm_size_t)
|
||||
unsafe { x & !(vm_page_mask as mach_vm_size_t) }
|
||||
}
|
||||
|
||||
#[allow(clippy::missing_safety_doc)] // FIXME
|
||||
pub unsafe fn mach_vm_round_page(x: mach_vm_offset_t) -> mach_vm_offset_t {
|
||||
(x + vm_page_mask as mach_vm_size_t) & !(vm_page_mask as mach_vm_size_t)
|
||||
unsafe { (x + vm_page_mask as mach_vm_size_t) & !(vm_page_mask as mach_vm_size_t) }
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use vm_page_size::*;
|
||||
use vm_types::mach_vm_size_t;
|
||||
use crate::vm_page_size::*;
|
||||
use crate::vm_types::mach_vm_size_t;
|
||||
|
||||
#[test]
|
||||
fn page_size() {
|
||||
@@ -38,3 +51,13 @@ mod tests {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::missing_safety_doc)] // FIXME
|
||||
pub unsafe fn trunc_page_kernel(x: vm_size_t) -> vm_size_t {
|
||||
unsafe { x & !vm_kernel_page_mask }
|
||||
}
|
||||
|
||||
#[allow(clippy::missing_safety_doc)] // FIXME
|
||||
pub unsafe fn round_page_kernel(x: vm_size_t) -> vm_size_t {
|
||||
unsafe { trunc_page_kernel(x + vm_kernel_page_mask) }
|
||||
}
|
||||
|
||||
+16
-4
@@ -1,13 +1,25 @@
|
||||
//! This module corresponds to `mach/vm_prot.h`.
|
||||
use core::ffi::c_int;
|
||||
|
||||
pub type vm_prot_t = ::libc::c_int;
|
||||
pub type vm_prot_t = c_int;
|
||||
|
||||
pub const VM_PROT_NONE: vm_prot_t = 0;
|
||||
pub const VM_PROT_READ: vm_prot_t = 1;
|
||||
pub const VM_PROT_WRITE: vm_prot_t = 1 << 1;
|
||||
pub const VM_PROT_EXECUTE: vm_prot_t = 1 << 2;
|
||||
pub const VM_PROT_NO_CHANGE: vm_prot_t = 1 << 3;
|
||||
pub const VM_PROT_COPY: vm_prot_t = 1 << 4;
|
||||
pub const VM_PROT_WANTS_COPY: vm_prot_t = 1 << 4;
|
||||
pub const VM_PROT_NO_CHANGE_LEGACY: vm_prot_t = 0x08;
|
||||
pub const VM_PROT_NO_CHANGE: vm_prot_t = 0x0100_0000;
|
||||
pub const VM_PROT_COPY: vm_prot_t = 0x10;
|
||||
pub const VM_PROT_WANTS_COPY: vm_prot_t = VM_PROT_COPY;
|
||||
pub const VM_PROT_DEFAULT: vm_prot_t = VM_PROT_READ | VM_PROT_WRITE;
|
||||
pub const VM_PROT_ALL: vm_prot_t = VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE;
|
||||
pub const VM_PROT_IS_MASK: vm_prot_t = 0x40;
|
||||
pub const VM_PROT_STRIP_READ: vm_prot_t = 0x80;
|
||||
pub const VM_PROT_EXECUTE_ONLY: vm_prot_t = VM_PROT_EXECUTE | VM_PROT_STRIP_READ;
|
||||
pub const VM_PROT_TPRO: vm_prot_t = 0x200;
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
pub const VM_PROT_UEXEC: vm_prot_t = 0x8;
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
pub const VM_PROT_ALLEXEC: vm_prot_t = VM_PROT_EXECUTE | VM_PROT_UEXEC;
|
||||
#[cfg(not(target_arch = "x86_64"))]
|
||||
pub const VM_PROT_ALLEXEC: vm_prot_t = VM_PROT_EXECUTE;
|
||||
|
||||
+50
-31
@@ -1,42 +1,61 @@
|
||||
//! This module corresponds to `mach/vm_purgable.h`.
|
||||
use core::ffi::c_int;
|
||||
|
||||
pub type vm_purgable_t = ::libc::c_int;
|
||||
pub type vm_purgable_t = c_int;
|
||||
|
||||
pub const VM_PURGABLE_SET_STATE: vm_purgable_t = 0;
|
||||
pub const VM_PURGABLE_GET_STATE: vm_purgable_t = 1;
|
||||
pub const VM_PURGABLE_PURGE_ALL: vm_purgable_t = 2;
|
||||
pub const VM_PURGABLE_SET_STATE_FROM_KERNEL: vm_purgable_t = 3;
|
||||
|
||||
pub const VM_VOLATILE_GROUP_SHIFT: ::libc::c_int = 8;
|
||||
pub const VM_VOLATILE_GROUP_MASK: ::libc::c_int = 7 << VM_VOLATILE_GROUP_SHIFT;
|
||||
pub const VM_VOLATILE_GROUP_DEFAULT: ::libc::c_int = VM_VOLATILE_GROUP_0;
|
||||
pub const VM_PURGABLE_NO_AGING_SHIFT: c_int = 16;
|
||||
pub const VM_PURGABLE_NO_AGING_MASK: c_int = 1 << VM_PURGABLE_NO_AGING_SHIFT;
|
||||
pub const VM_PURGABLE_NO_AGING: c_int = 1 << VM_PURGABLE_NO_AGING_SHIFT;
|
||||
|
||||
pub const VM_VOLATILE_GROUP_0: ::libc::c_int = 0 << VM_VOLATILE_GROUP_SHIFT;
|
||||
pub const VM_VOLATILE_GROUP_1: ::libc::c_int = 1 << VM_VOLATILE_GROUP_SHIFT;
|
||||
pub const VM_VOLATILE_GROUP_2: ::libc::c_int = 2 << VM_VOLATILE_GROUP_SHIFT;
|
||||
pub const VM_VOLATILE_GROUP_3: ::libc::c_int = 3 << VM_VOLATILE_GROUP_SHIFT;
|
||||
pub const VM_VOLATILE_GROUP_4: ::libc::c_int = 4 << VM_VOLATILE_GROUP_SHIFT;
|
||||
pub const VM_VOLATILE_GROUP_5: ::libc::c_int = 5 << VM_VOLATILE_GROUP_SHIFT;
|
||||
pub const VM_VOLATILE_GROUP_6: ::libc::c_int = 6 << VM_VOLATILE_GROUP_SHIFT;
|
||||
pub const VM_VOLATILE_GROUP_7: ::libc::c_int = 7 << VM_VOLATILE_GROUP_SHIFT;
|
||||
pub const VM_PURGABLE_DEBUG_SHIFT: c_int = 12;
|
||||
pub const VM_PURGABLE_DEBUG_MASK: c_int = 0x3 << VM_PURGABLE_DEBUG_SHIFT;
|
||||
pub const VM_PURGABLE_DEBUG_EMPTY: c_int = 0x1 << VM_PURGABLE_DEBUG_SHIFT;
|
||||
pub const VM_PURGABLE_DEBUG_FAULT: c_int = 0x2 << VM_PURGABLE_DEBUG_SHIFT;
|
||||
|
||||
pub const VM_PURGABLE_BEHAVIOR_SHIFT: ::libc::c_int = 6;
|
||||
pub const VM_PURGABLE_BEHAVIOR_MASK: ::libc::c_int = 1 << VM_PURGABLE_BEHAVIOR_SHIFT;
|
||||
pub const VM_PURGABLE_BEHAVIOR_FIFO: ::libc::c_int = 0 << VM_PURGABLE_BEHAVIOR_SHIFT;
|
||||
pub const VM_PURGABLE_BEHAVIOR_LIFO: ::libc::c_int = 1 << VM_PURGABLE_BEHAVIOR_SHIFT;
|
||||
pub const VM_VOLATILE_GROUP_SHIFT: c_int = 8;
|
||||
pub const VM_VOLATILE_GROUP_MASK: c_int = 7 << VM_VOLATILE_GROUP_SHIFT;
|
||||
pub const VM_VOLATILE_GROUP_DEFAULT: c_int = VM_VOLATILE_GROUP_0;
|
||||
|
||||
pub const VM_PURGABLE_ORDERING_SHIFT: ::libc::c_int = 5;
|
||||
pub const VM_PURGABLE_ORDERING_MASK: ::libc::c_int = 1 << VM_PURGABLE_ORDERING_SHIFT;
|
||||
pub const VM_PURGABLE_ORDERING_OBSOLETE: ::libc::c_int = 1 << VM_PURGABLE_ORDERING_SHIFT;
|
||||
pub const VM_PURGABLE_ORDERING_NORMAL: ::libc::c_int = 0 << VM_PURGABLE_ORDERING_SHIFT;
|
||||
pub const VM_VOLATILE_GROUP_0: c_int = 0 << VM_VOLATILE_GROUP_SHIFT;
|
||||
pub const VM_VOLATILE_GROUP_1: c_int = 1 << VM_VOLATILE_GROUP_SHIFT;
|
||||
pub const VM_VOLATILE_GROUP_2: c_int = 2 << VM_VOLATILE_GROUP_SHIFT;
|
||||
pub const VM_VOLATILE_GROUP_3: c_int = 3 << VM_VOLATILE_GROUP_SHIFT;
|
||||
pub const VM_VOLATILE_GROUP_4: c_int = 4 << VM_VOLATILE_GROUP_SHIFT;
|
||||
pub const VM_VOLATILE_GROUP_5: c_int = 5 << VM_VOLATILE_GROUP_SHIFT;
|
||||
pub const VM_VOLATILE_GROUP_6: c_int = 6 << VM_VOLATILE_GROUP_SHIFT;
|
||||
pub const VM_VOLATILE_GROUP_7: c_int = 7 << VM_VOLATILE_GROUP_SHIFT;
|
||||
|
||||
pub const VM_VOLATILE_ORDER_SHIFT: ::libc::c_int = 4;
|
||||
pub const VM_VOLATILE_ORDER_MASK: ::libc::c_int = 1 << VM_VOLATILE_ORDER_SHIFT;
|
||||
pub const VM_VOLATILE_MAKE_FIRST_IN_GROUP: ::libc::c_int = 1 << VM_VOLATILE_ORDER_SHIFT;
|
||||
pub const VM_VOLATILE_MAKE_LAST_IN_GROUP: ::libc::c_int = 0 << VM_VOLATILE_ORDER_SHIFT;
|
||||
pub const VM_PURGABLE_BEHAVIOR_SHIFT: c_int = 6;
|
||||
pub const VM_PURGABLE_BEHAVIOR_MASK: c_int = 1 << VM_PURGABLE_BEHAVIOR_SHIFT;
|
||||
pub const VM_PURGABLE_BEHAVIOR_FIFO: c_int = 0 << VM_PURGABLE_BEHAVIOR_SHIFT;
|
||||
pub const VM_PURGABLE_BEHAVIOR_LIFO: c_int = 1 << VM_PURGABLE_BEHAVIOR_SHIFT;
|
||||
|
||||
pub const VM_PURGABLE_STATE_MIN: ::libc::c_int = 0;
|
||||
pub const VM_PURGABLE_STATE_MAX: ::libc::c_int = 3;
|
||||
pub const VM_PURGABLE_STATE_MASK: ::libc::c_int = 3;
|
||||
pub const VM_PURGABLE_NONVOLATILE: ::libc::c_int = 0;
|
||||
pub const VM_PURGABLE_VOLATILE: ::libc::c_int = 1;
|
||||
pub const VM_PURGABLE_EMPTY: ::libc::c_int = 2;
|
||||
pub const VM_PURGABLE_DENY: ::libc::c_int = 3;
|
||||
pub const VM_PURGABLE_ORDERING_SHIFT: c_int = 5;
|
||||
pub const VM_PURGABLE_ORDERING_MASK: c_int = 1 << VM_PURGABLE_ORDERING_SHIFT;
|
||||
pub const VM_PURGABLE_ORDERING_OBSOLETE: c_int = 1 << VM_PURGABLE_ORDERING_SHIFT;
|
||||
pub const VM_PURGABLE_ORDERING_NORMAL: c_int = 0 << VM_PURGABLE_ORDERING_SHIFT;
|
||||
|
||||
pub const VM_VOLATILE_ORDER_SHIFT: c_int = 4;
|
||||
pub const VM_VOLATILE_ORDER_MASK: c_int = 1 << VM_VOLATILE_ORDER_SHIFT;
|
||||
pub const VM_VOLATILE_MAKE_FIRST_IN_GROUP: c_int = 1 << VM_VOLATILE_ORDER_SHIFT;
|
||||
pub const VM_VOLATILE_MAKE_LAST_IN_GROUP: c_int = 0 << VM_VOLATILE_ORDER_SHIFT;
|
||||
|
||||
pub const VM_PURGABLE_STATE_MIN: c_int = 0;
|
||||
pub const VM_PURGABLE_STATE_MAX: c_int = 3;
|
||||
pub const VM_PURGABLE_STATE_MASK: c_int = 3;
|
||||
pub const VM_PURGABLE_NONVOLATILE: c_int = 0;
|
||||
pub const VM_PURGABLE_VOLATILE: c_int = 1;
|
||||
pub const VM_PURGABLE_EMPTY: c_int = 2;
|
||||
pub const VM_PURGABLE_DENY: c_int = 3;
|
||||
pub const VM_PURGABLE_ALL_MASKS: c_int = VM_PURGABLE_STATE_MASK
|
||||
| VM_VOLATILE_ORDER_MASK
|
||||
| VM_PURGABLE_ORDERING_MASK
|
||||
| VM_PURGABLE_BEHAVIOR_MASK
|
||||
| VM_VOLATILE_GROUP_MASK
|
||||
| VM_PURGABLE_DEBUG_MASK
|
||||
| VM_PURGABLE_NO_AGING_MASK;
|
||||
|
||||
+109
-81
@@ -1,45 +1,69 @@
|
||||
//! This module roughly corresponds to `mach/vm_region.h`.
|
||||
|
||||
use boolean::boolean_t;
|
||||
use mem;
|
||||
use memory_object_types::{memory_object_offset_t, vm_object_id_t};
|
||||
use message::mach_msg_type_number_t;
|
||||
use vm_behavior::vm_behavior_t;
|
||||
use vm_inherit::vm_inherit_t;
|
||||
use vm_prot::vm_prot_t;
|
||||
use vm_types::{mach_vm_address_t, mach_vm_size_t};
|
||||
use crate::boolean::boolean_t;
|
||||
use crate::memory_object_types::{memory_object_offset_t, vm_object_id_t};
|
||||
use crate::message::mach_msg_type_number_t;
|
||||
use crate::vm_behavior::vm_behavior_t;
|
||||
use crate::vm_inherit::vm_inherit_t;
|
||||
use crate::vm_prot::vm_prot_t;
|
||||
use crate::vm_types::{mach_vm_address_t, mach_vm_size_t, natural_t};
|
||||
use core::ffi::{c_int, c_uchar, c_uint, c_ushort};
|
||||
use core::mem;
|
||||
|
||||
pub type vm32_object_id_t = u32;
|
||||
|
||||
pub type vm_region_info_t = *mut ::libc::c_int;
|
||||
pub type vm_region_info_64_t = *mut ::libc::c_int;
|
||||
pub type vm_region_recurse_info_t = *mut ::libc::c_int;
|
||||
pub type vm_region_recurse_info_64_t = *mut ::libc::c_int;
|
||||
pub type vm_region_flavor_t = ::libc::c_int;
|
||||
pub type vm_region_info_data_t = [::libc::c_int; VM_REGION_INFO_MAX as usize];
|
||||
pub type vm_region_info_t = *mut c_int;
|
||||
pub type vm_region_info_64_t = *mut c_int;
|
||||
pub type vm_region_recurse_info_t = *mut c_int;
|
||||
pub type vm_region_recurse_info_64_t = *mut c_int;
|
||||
pub type vm_region_flavor_t = c_int;
|
||||
pub type vm_region_info_data_t = [c_int; VM_REGION_INFO_MAX as usize];
|
||||
|
||||
pub type vm_region_basic_info_64_t = *mut vm_region_basic_info_64;
|
||||
pub type vm_region_basic_info_data_64_t = vm_region_basic_info_64;
|
||||
pub type vm_region_basic_info_t = *mut vm_region_basic_info;
|
||||
pub type vm_region_basic_info_data_t = vm_region_basic_info;
|
||||
pub const VM_REGION_BASIC_INFO_COUNT_64: mach_msg_type_number_t =
|
||||
(mem::size_of::<vm_region_basic_info_data_64_t>() / mem::size_of::<c_int>())
|
||||
as mach_msg_type_number_t;
|
||||
pub const VM_REGION_BASIC_INFO_COUNT: mach_msg_type_number_t =
|
||||
(mem::size_of::<vm_region_basic_info_data_t>() / mem::size_of::<c_int>())
|
||||
as mach_msg_type_number_t;
|
||||
pub type vm_region_extended_info_t = *mut vm_region_extended_info;
|
||||
pub type vm_region_extended_info_data_t = vm_region_extended_info;
|
||||
pub type vm_region_top_info_t = *mut vm_region_top_info;
|
||||
pub type vm_region_top_info_data_t = vm_region_top_info;
|
||||
pub const VM_REGION_EXTENDED_INFO_COUNT: mach_msg_type_number_t =
|
||||
(mem::size_of::<vm_region_extended_info_data_t>() / mem::size_of::<natural_t>())
|
||||
as mach_msg_type_number_t;
|
||||
pub const VM_REGION_TOP_INFO_COUNT: mach_msg_type_number_t =
|
||||
(mem::size_of::<vm_region_top_info_data_t>() / mem::size_of::<natural_t>())
|
||||
as mach_msg_type_number_t;
|
||||
pub type vm_region_submap_info_t = *mut vm_region_submap_info;
|
||||
pub type vm_region_submap_info_data_t = vm_region_submap_info;
|
||||
pub type vm_region_submap_info_64_t = *mut vm_region_submap_info_64;
|
||||
pub type vm_region_submap_info_data_64_t = vm_region_submap_info_64;
|
||||
pub type vm_region_submap_short_info_64_t = *mut vm_region_submap_short_info_64;
|
||||
pub type vm_region_submap_short_info_data_64_t = vm_region_submap_short_info_64;
|
||||
pub type vm_page_info_t = *mut ::libc::c_int;
|
||||
pub type vm_page_info_flavor_t = ::libc::c_int;
|
||||
pub type vm_page_info_t = *mut c_int;
|
||||
pub type vm_page_info_flavor_t = c_int;
|
||||
pub type vm_page_info_basic_t = *mut vm_page_info_basic;
|
||||
pub type vm_page_info_basic_data_t = vm_page_info_basic;
|
||||
pub type mach_vm_read_entry_t = [mach_vm_read_entry; VM_MAP_ENTRY_MAX as usize];
|
||||
pub const VM_REGION_SUBMAP_INFO_COUNT: mach_msg_type_number_t =
|
||||
(mem::size_of::<vm_region_submap_info_data_t>() / mem::size_of::<natural_t>())
|
||||
as mach_msg_type_number_t;
|
||||
pub const VM_REGION_SUBMAP_SHORT_INFO_COUNT_64: mach_msg_type_number_t =
|
||||
(mem::size_of::<vm_region_submap_short_info_data_64_t>() / mem::size_of::<natural_t>())
|
||||
as mach_msg_type_number_t;
|
||||
pub const VM_PAGE_INFO_BASIC_COUNT: mach_msg_type_number_t =
|
||||
(mem::size_of::<vm_page_info_basic_data_t>() / mem::size_of::<c_int>())
|
||||
as mach_msg_type_number_t;
|
||||
pub const VM_REGION_FLAG_JIT_ENABLED: c_ushort = 0x1;
|
||||
pub const VM_REGION_FLAG_TPRO_ENABLED: c_ushort = 0x2;
|
||||
|
||||
pub const VM_REGION_INFO_MAX: ::libc::c_int = 1 << 10;
|
||||
pub const VM_MAP_ENTRY_MAX: ::libc::c_int = 1 << 8;
|
||||
pub const VM_REGION_INFO_MAX: c_int = 1 << 10;
|
||||
pub const VM_MAP_ENTRY_MAX: c_int = 1 << 8;
|
||||
|
||||
pub const VM_PAGE_INFO_BASIC: vm_page_info_flavor_t = 1;
|
||||
|
||||
@@ -48,13 +72,14 @@ pub const VM_REGION_BASIC_INFO: vm_region_flavor_t = 10;
|
||||
pub const VM_REGION_EXTENDED_INFO: vm_region_flavor_t = 13;
|
||||
pub const VM_REGION_TOP_INFO: vm_region_flavor_t = 12;
|
||||
|
||||
pub const SM_COW: ::libc::c_uchar = 1;
|
||||
pub const SM_PRIVATE: ::libc::c_uchar = 2;
|
||||
pub const SM_EMPTY: ::libc::c_uchar = 3;
|
||||
pub const SM_SHARED: ::libc::c_uchar = 4;
|
||||
pub const SM_TRUESHARED: ::libc::c_uchar = 5;
|
||||
pub const SM_PRIVATE_ALIASED: ::libc::c_uchar = 6;
|
||||
pub const SM_SHARED_ALIASED: ::libc::c_uchar = 7;
|
||||
pub const SM_COW: c_uchar = 1;
|
||||
pub const SM_PRIVATE: c_uchar = 2;
|
||||
pub const SM_EMPTY: c_uchar = 3;
|
||||
pub const SM_SHARED: c_uchar = 4;
|
||||
pub const SM_TRUESHARED: c_uchar = 5;
|
||||
pub const SM_PRIVATE_ALIASED: c_uchar = 6;
|
||||
pub const SM_SHARED_ALIASED: c_uchar = 7;
|
||||
pub const SM_LARGE_PAGE: c_uchar = 8;
|
||||
|
||||
#[repr(C, packed(4))]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
@@ -66,12 +91,12 @@ pub struct vm_region_basic_info_64 {
|
||||
pub reserved: boolean_t,
|
||||
pub offset: memory_object_offset_t,
|
||||
pub behavior: vm_behavior_t,
|
||||
pub user_wired_count: ::libc::c_ushort,
|
||||
pub user_wired_count: c_ushort,
|
||||
}
|
||||
|
||||
impl vm_region_basic_info_64 {
|
||||
pub fn count() -> mach_msg_type_number_t {
|
||||
(mem::size_of::<Self>() / mem::size_of::<::libc::c_int>()) as mach_msg_type_number_t
|
||||
(mem::size_of::<Self>() / mem::size_of::<c_int>()) as mach_msg_type_number_t
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,12 +110,12 @@ pub struct vm_region_basic_info {
|
||||
pub reserved: boolean_t,
|
||||
pub offset: u32,
|
||||
pub behavior: vm_behavior_t,
|
||||
pub user_wired_count: ::libc::c_ushort,
|
||||
pub user_wired_count: c_ushort,
|
||||
}
|
||||
|
||||
impl vm_region_basic_info {
|
||||
pub fn count() -> mach_msg_type_number_t {
|
||||
(mem::size_of::<Self>() / mem::size_of::<::libc::c_int>()) as mach_msg_type_number_t
|
||||
(mem::size_of::<Self>() / mem::size_of::<c_int>()) as mach_msg_type_number_t
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,37 +123,37 @@ impl vm_region_basic_info {
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct vm_region_extended_info {
|
||||
pub protection: vm_prot_t,
|
||||
pub user_tag: ::libc::c_uint,
|
||||
pub pages_resident: ::libc::c_uint,
|
||||
pub pages_shared_now_private: ::libc::c_uint,
|
||||
pub pages_swapped_out: ::libc::c_uint,
|
||||
pub pages_dirtied: ::libc::c_uint,
|
||||
pub ref_count: ::libc::c_uint,
|
||||
pub shadow_depth: ::libc::c_ushort,
|
||||
pub external_pager: ::libc::c_uchar,
|
||||
pub share_mode: ::libc::c_uchar,
|
||||
pub pages_reusable: ::libc::c_uint,
|
||||
pub user_tag: c_uint,
|
||||
pub pages_resident: c_uint,
|
||||
pub pages_shared_now_private: c_uint,
|
||||
pub pages_swapped_out: c_uint,
|
||||
pub pages_dirtied: c_uint,
|
||||
pub ref_count: c_uint,
|
||||
pub shadow_depth: c_ushort,
|
||||
pub external_pager: c_uchar,
|
||||
pub share_mode: c_uchar,
|
||||
pub pages_reusable: c_uint,
|
||||
}
|
||||
|
||||
impl vm_region_extended_info {
|
||||
pub fn count() -> mach_msg_type_number_t {
|
||||
(mem::size_of::<Self>() / mem::size_of::<::libc::c_int>()) as mach_msg_type_number_t
|
||||
(mem::size_of::<Self>() / mem::size_of::<c_int>()) as mach_msg_type_number_t
|
||||
}
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct vm_region_top_info {
|
||||
pub obj_id: ::libc::c_uint,
|
||||
pub ref_count: ::libc::c_uint,
|
||||
pub private_pages_resident: ::libc::c_uint,
|
||||
pub shared_pages_resident: ::libc::c_uint,
|
||||
pub share_mode: ::libc::c_uchar,
|
||||
pub obj_id: c_uint,
|
||||
pub ref_count: c_uint,
|
||||
pub private_pages_resident: c_uint,
|
||||
pub shared_pages_resident: c_uint,
|
||||
pub share_mode: c_uchar,
|
||||
}
|
||||
|
||||
impl vm_region_top_info {
|
||||
pub fn count() -> mach_msg_type_number_t {
|
||||
(mem::size_of::<Self>() / mem::size_of::<::libc::c_int>()) as mach_msg_type_number_t
|
||||
(mem::size_of::<Self>() / mem::size_of::<c_int>()) as mach_msg_type_number_t
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,24 +164,24 @@ pub struct vm_region_submap_info {
|
||||
pub max_protection: vm_prot_t,
|
||||
pub inheritance: vm_inherit_t,
|
||||
pub offset: u32,
|
||||
pub user_tag: ::libc::c_uint,
|
||||
pub pages_resident: ::libc::c_uint,
|
||||
pub pages_shared_now_private: ::libc::c_uint,
|
||||
pub pages_swapped_out: ::libc::c_uint,
|
||||
pub pages_dirtied: ::libc::c_uint,
|
||||
pub ref_count: ::libc::c_uint,
|
||||
pub shadow_depth: ::libc::c_ushort,
|
||||
pub external_pager: ::libc::c_uchar,
|
||||
pub share_mode: ::libc::c_uchar,
|
||||
pub user_tag: c_uint,
|
||||
pub pages_resident: c_uint,
|
||||
pub pages_shared_now_private: c_uint,
|
||||
pub pages_swapped_out: c_uint,
|
||||
pub pages_dirtied: c_uint,
|
||||
pub ref_count: c_uint,
|
||||
pub shadow_depth: c_ushort,
|
||||
pub external_pager: c_uchar,
|
||||
pub share_mode: c_uchar,
|
||||
pub is_submap: boolean_t,
|
||||
pub behavior: vm_behavior_t,
|
||||
pub object_id: vm32_object_id_t,
|
||||
pub user_wired_count: ::libc::c_ushort,
|
||||
pub user_wired_count: c_ushort,
|
||||
}
|
||||
|
||||
impl vm_region_submap_info {
|
||||
pub fn count() -> mach_msg_type_number_t {
|
||||
(mem::size_of::<Self>() / mem::size_of::<::libc::c_int>()) as mach_msg_type_number_t
|
||||
(mem::size_of::<Self>() / mem::size_of::<c_int>()) as mach_msg_type_number_t
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,25 +192,27 @@ pub struct vm_region_submap_info_64 {
|
||||
pub max_protection: vm_prot_t,
|
||||
pub inheritance: vm_inherit_t,
|
||||
pub offset: memory_object_offset_t,
|
||||
pub user_tag: ::libc::c_uint,
|
||||
pub pages_resident: ::libc::c_uint,
|
||||
pub pages_shared_now_private: ::libc::c_uint,
|
||||
pub pages_swapped_out: ::libc::c_uint,
|
||||
pub pages_dirtied: ::libc::c_uint,
|
||||
pub ref_count: ::libc::c_uint,
|
||||
pub shadow_depth: ::libc::c_ushort,
|
||||
pub external_pager: ::libc::c_uchar,
|
||||
pub share_mode: ::libc::c_uchar,
|
||||
pub user_tag: c_uint,
|
||||
pub pages_resident: c_uint,
|
||||
pub pages_shared_now_private: c_uint,
|
||||
pub pages_swapped_out: c_uint,
|
||||
pub pages_dirtied: c_uint,
|
||||
pub ref_count: c_uint,
|
||||
pub shadow_depth: c_ushort,
|
||||
pub external_pager: c_uchar,
|
||||
pub share_mode: c_uchar,
|
||||
pub is_submap: boolean_t,
|
||||
pub behavior: vm_behavior_t,
|
||||
pub object_id: vm32_object_id_t,
|
||||
pub user_wired_count: ::libc::c_ushort,
|
||||
pub pages_reusable: ::libc::c_uint,
|
||||
pub user_wired_count: c_ushort,
|
||||
pub flags: c_ushort,
|
||||
pub pages_reusable: c_uint,
|
||||
pub object_id_full: vm_object_id_t,
|
||||
}
|
||||
|
||||
impl vm_region_submap_info_64 {
|
||||
pub fn count() -> mach_msg_type_number_t {
|
||||
(mem::size_of::<Self>() / mem::size_of::<::libc::c_int>()) as mach_msg_type_number_t
|
||||
(mem::size_of::<Self>() / mem::size_of::<c_int>()) as mach_msg_type_number_t
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,37 +223,38 @@ pub struct vm_region_submap_short_info_64 {
|
||||
pub max_protection: vm_prot_t,
|
||||
pub inheritance: vm_inherit_t,
|
||||
pub offset: memory_object_offset_t,
|
||||
pub user_tag: ::libc::c_uint,
|
||||
pub ref_count: ::libc::c_uint,
|
||||
pub shadow_depth: ::libc::c_ushort,
|
||||
pub external_pager: ::libc::c_uchar,
|
||||
pub share_mode: ::libc::c_uchar,
|
||||
pub user_tag: c_uint,
|
||||
pub ref_count: c_uint,
|
||||
pub shadow_depth: c_ushort,
|
||||
pub external_pager: c_uchar,
|
||||
pub share_mode: c_uchar,
|
||||
pub is_submap: boolean_t,
|
||||
pub behavior: vm_behavior_t,
|
||||
pub object_id: vm32_object_id_t,
|
||||
pub user_wired_count: ::libc::c_ushort,
|
||||
pub user_wired_count: c_ushort,
|
||||
pub flags: c_ushort,
|
||||
}
|
||||
|
||||
impl vm_region_submap_short_info_64 {
|
||||
pub fn count() -> mach_msg_type_number_t {
|
||||
(mem::size_of::<Self>() / mem::size_of::<::libc::c_int>()) as mach_msg_type_number_t
|
||||
(mem::size_of::<Self>() / mem::size_of::<c_int>()) as mach_msg_type_number_t
|
||||
}
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct vm_page_info_basic {
|
||||
pub disposition: ::libc::c_int,
|
||||
pub ref_count: ::libc::c_int,
|
||||
pub disposition: c_int,
|
||||
pub ref_count: c_int,
|
||||
pub object_id: vm_object_id_t,
|
||||
pub offset: memory_object_offset_t,
|
||||
pub depth: ::libc::c_int,
|
||||
pub __pad: ::libc::c_int,
|
||||
pub depth: c_int,
|
||||
pub __pad: c_int,
|
||||
}
|
||||
|
||||
impl vm_page_info_basic {
|
||||
pub fn count() -> mach_msg_type_number_t {
|
||||
(mem::size_of::<Self>() / mem::size_of::<::libc::c_int>()) as mach_msg_type_number_t
|
||||
(mem::size_of::<Self>() / mem::size_of::<c_int>()) as mach_msg_type_number_t
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+297
-26
@@ -1,41 +1,256 @@
|
||||
//! This module roughly corresponds to `mach/vm_statistics.h`
|
||||
|
||||
use vm_types::{integer_t, natural_t};
|
||||
use crate::vm_types::{integer_t, natural_t};
|
||||
use core::ffi::{c_int, c_uint};
|
||||
|
||||
pub type vm_statistics_t = *mut vm_statistics;
|
||||
pub type vm_statistics_data_t = vm_statistics;
|
||||
pub type vm_statistics64_t = *mut vm_statistics64;
|
||||
pub type vm_statistics64_data_t = vm_statistics64;
|
||||
pub type vm_extmod_statistics_t = *mut vm_extmod_statistics;
|
||||
pub type vm_extmod_statistics_data_t = vm_extmod_statistics;
|
||||
pub type vm_purgeable_stat_t = vm_purgeable_stat;
|
||||
pub type vm_purgeable_info_t = *mut vm_purgeable_info;
|
||||
|
||||
pub const VM_PAGE_QUERY_PAGE_PRESENT: integer_t = 1;
|
||||
pub const VM_PAGE_QUERY_PAGE_FICTITIOUS: integer_t = 1 << 1;
|
||||
pub const VM_PAGE_QUERY_PAGE_REF: integer_t = 1 << 2;
|
||||
pub const VM_PAGE_QUERY_PAGE_DIRTY: integer_t = 1 << 3;
|
||||
pub const VM_PAGE_QUERY_PAGE_PAGED_OUT: integer_t = 1 << 4;
|
||||
pub const VM_PAGE_QUERY_PAGE_COPIED: integer_t = 1 << 5;
|
||||
pub const VM_PAGE_QUERY_PAGE_SPECULATIVE: integer_t = 1 << 6;
|
||||
pub const VM_PAGE_QUERY_PAGE_EXTERNAL: integer_t = 1 << 7;
|
||||
pub const VM_PAGE_QUERY_PAGE_CS_VALIDATED: integer_t = 1 << 8;
|
||||
pub const VM_PAGE_QUERY_PAGE_CS_TAINTED: integer_t = 1 << 9;
|
||||
pub const VM_PAGE_QUERY_PAGE_CS_NX: integer_t = 1 << 10;
|
||||
pub const VM_PAGE_QUERY_PAGE_REUSABLE: integer_t = 1 << 11;
|
||||
|
||||
pub const VM_MEMORY_MALLOC: ::libc::c_uint = 1;
|
||||
pub const VM_MEMORY_MALLOC_SMALL: ::libc::c_uint = 2;
|
||||
pub const VM_MEMORY_MALLOC_LARGE: ::libc::c_uint = 3;
|
||||
pub const VM_MEMORY_MALLOC_HUGE: ::libc::c_uint = 4;
|
||||
pub const VM_MEMORY_SBRK: ::libc::c_uint = 5;
|
||||
pub const VM_MEMORY_ANALYSIS_TOOL: ::libc::c_uint = 10;
|
||||
pub const VM_MEMORY_MACH_MSG: ::libc::c_uint = 20;
|
||||
pub const VM_MEMORY_IOKIT: ::libc::c_uint = 21;
|
||||
pub const VM_MEMORY_STACK: ::libc::c_uint = 30;
|
||||
pub const VM_MEMORY_GUARD: ::libc::c_uint = 31;
|
||||
pub const VM_MEMORY_SHARED_PMAP: ::libc::c_uint = 32;
|
||||
pub const VM_MEMORY_DYLIB: ::libc::c_uint = 33;
|
||||
pub const VM_MEMORY_APPKIT: ::libc::c_uint = 40;
|
||||
pub const VM_MEMORY_FOUNDATION: ::libc::c_uint = 41;
|
||||
pub const VM_MEMORY_COREGRAPHICS: ::libc::c_uint = 42;
|
||||
pub const VM_MEMORY_CARBON: ::libc::c_uint = 43;
|
||||
pub const VM_MEMORY_JAVA: ::libc::c_uint = 44;
|
||||
pub const VM_MEMORY_ATS: ::libc::c_uint = 50;
|
||||
pub const VM_MEMORY_DYLD: ::libc::c_uint = 60;
|
||||
pub const VM_MEMORY_DYLD_MALLOC: ::libc::c_uint = 61;
|
||||
pub const VM_MEMORY_APPLICATION_SPECIFIC_1: ::libc::c_uint = 240;
|
||||
pub const VM_MEMORY_APPLICATION_SPECIFIC_16: ::libc::c_uint = 255;
|
||||
pub const VM_MEMORY_MALLOC: c_uint = 1;
|
||||
pub const VM_MEMORY_MALLOC_SMALL: c_uint = 2;
|
||||
pub const VM_MEMORY_MALLOC_LARGE: c_uint = 3;
|
||||
pub const VM_MEMORY_MALLOC_HUGE: c_uint = 4;
|
||||
pub const VM_MEMORY_SBRK: c_uint = 5;
|
||||
pub const VM_MEMORY_REALLOC: c_uint = 6;
|
||||
pub const VM_MEMORY_MALLOC_TINY: c_uint = 7;
|
||||
pub const VM_MEMORY_MALLOC_LARGE_REUSABLE: c_uint = 8;
|
||||
pub const VM_MEMORY_MALLOC_LARGE_REUSED: c_uint = 9;
|
||||
pub const VM_MEMORY_ANALYSIS_TOOL: c_uint = 10;
|
||||
pub const VM_MEMORY_MALLOC_NANO: c_uint = 11;
|
||||
pub const VM_MEMORY_MALLOC_MEDIUM: c_uint = 12;
|
||||
pub const VM_MEMORY_MALLOC_PROB_GUARD: c_uint = 13;
|
||||
pub const VM_MEMORY_MACH_MSG: c_uint = 20;
|
||||
pub const VM_MEMORY_IOKIT: c_uint = 21;
|
||||
pub const VM_MEMORY_STACK: c_uint = 30;
|
||||
pub const VM_MEMORY_GUARD: c_uint = 31;
|
||||
pub const VM_MEMORY_SHARED_PMAP: c_uint = 32;
|
||||
pub const VM_MEMORY_DYLIB: c_uint = 33;
|
||||
pub const VM_MEMORY_OBJC_DISPATCHERS: c_uint = 34;
|
||||
pub const VM_MEMORY_UNSHARED_PMAP: c_uint = 35;
|
||||
pub const VM_MEMORY_LIBCHANNEL: c_uint = 36;
|
||||
pub const VM_MEMORY_APPKIT: c_uint = 40;
|
||||
pub const VM_MEMORY_FOUNDATION: c_uint = 41;
|
||||
pub const VM_MEMORY_COREGRAPHICS: c_uint = 42;
|
||||
pub const VM_MEMORY_CORESERVICES: c_uint = 43;
|
||||
pub const VM_MEMORY_CARBON: c_uint = VM_MEMORY_CORESERVICES;
|
||||
pub const VM_MEMORY_JAVA: c_uint = 44;
|
||||
pub const VM_MEMORY_COREDATA: c_uint = 45;
|
||||
pub const VM_MEMORY_COREDATA_OBJECTIDS: c_uint = 46;
|
||||
pub const VM_MEMORY_ATS: c_uint = 50;
|
||||
pub const VM_MEMORY_LAYERKIT: c_uint = 51;
|
||||
pub const VM_MEMORY_CGIMAGE: c_uint = 52;
|
||||
pub const VM_MEMORY_TCMALLOC: c_uint = 53;
|
||||
pub const VM_MEMORY_COREGRAPHICS_DATA: c_uint = 54;
|
||||
pub const VM_MEMORY_COREGRAPHICS_SHARED: c_uint = 55;
|
||||
pub const VM_MEMORY_COREGRAPHICS_FRAMEBUFFERS: c_uint = 56;
|
||||
pub const VM_MEMORY_COREGRAPHICS_BACKINGSTORES: c_uint = 57;
|
||||
pub const VM_MEMORY_COREGRAPHICS_XALLOC: c_uint = 58;
|
||||
pub const VM_MEMORY_COREGRAPHICS_MISC: c_uint = VM_MEMORY_COREGRAPHICS;
|
||||
pub const VM_MEMORY_DYLD: c_uint = 60;
|
||||
pub const VM_MEMORY_DYLD_MALLOC: c_uint = 61;
|
||||
pub const VM_MEMORY_SQLITE: c_uint = 62;
|
||||
pub const VM_MEMORY_JAVASCRIPT_CORE: c_uint = 63;
|
||||
pub const VM_MEMORY_WEBASSEMBLY: c_uint = VM_MEMORY_JAVASCRIPT_CORE;
|
||||
pub const VM_MEMORY_JAVASCRIPT_JIT_EXECUTABLE_ALLOCATOR: c_uint = 64;
|
||||
pub const VM_MEMORY_JAVASCRIPT_JIT_REGISTER_FILE: c_uint = 65;
|
||||
pub const VM_MEMORY_GLSL: c_uint = 66;
|
||||
pub const VM_MEMORY_OPENCL: c_uint = 67;
|
||||
pub const VM_MEMORY_COREIMAGE: c_uint = 68;
|
||||
pub const VM_MEMORY_WEBCORE_PURGEABLE_BUFFERS: c_uint = 69;
|
||||
pub const VM_MEMORY_IMAGEIO: c_uint = 70;
|
||||
pub const VM_MEMORY_COREPROFILE: c_uint = 71;
|
||||
pub const VM_MEMORY_ASSETSD: c_uint = 72;
|
||||
pub const VM_MEMORY_OS_ALLOC_ONCE: c_uint = 73;
|
||||
pub const VM_MEMORY_LIBDISPATCH: c_uint = 74;
|
||||
pub const VM_MEMORY_ACCELERATE: c_uint = 75;
|
||||
pub const VM_MEMORY_COREUI: c_uint = 76;
|
||||
pub const VM_MEMORY_COREUIFILE: c_uint = 77;
|
||||
pub const VM_MEMORY_GENEALOGY: c_uint = 78;
|
||||
pub const VM_MEMORY_RAWCAMERA: c_uint = 79;
|
||||
pub const VM_MEMORY_CORPSEINFO: c_uint = 80;
|
||||
pub const VM_MEMORY_ASL: c_uint = 81;
|
||||
pub const VM_MEMORY_SWIFT_RUNTIME: c_uint = 82;
|
||||
pub const VM_MEMORY_SWIFT_METADATA: c_uint = 83;
|
||||
pub const VM_MEMORY_DHMM: c_uint = 84;
|
||||
pub const VM_MEMORY_DFR: c_uint = 85;
|
||||
pub const VM_MEMORY_SCENEKIT: c_uint = 86;
|
||||
pub const VM_MEMORY_SKYWALK: c_uint = 87;
|
||||
pub const VM_MEMORY_IOSURFACE: c_uint = 88;
|
||||
pub const VM_MEMORY_LIBNETWORK: c_uint = 89;
|
||||
pub const VM_MEMORY_AUDIO: c_uint = 90;
|
||||
pub const VM_MEMORY_VIDEOBITSTREAM: c_uint = 91;
|
||||
pub const VM_MEMORY_CM_XPC: c_uint = 92;
|
||||
pub const VM_MEMORY_CM_RPC: c_uint = 93;
|
||||
pub const VM_MEMORY_CM_MEMORYPOOL: c_uint = 94;
|
||||
pub const VM_MEMORY_CM_READCACHE: c_uint = 95;
|
||||
pub const VM_MEMORY_CM_CRABS: c_uint = 96;
|
||||
pub const VM_MEMORY_QUICKLOOK_THUMBNAILS: c_uint = 97;
|
||||
pub const VM_MEMORY_ACCOUNTS: c_uint = 98;
|
||||
pub const VM_MEMORY_SANITIZER: c_uint = 99;
|
||||
pub const VM_MEMORY_IOACCELERATOR: c_uint = 100;
|
||||
pub const VM_MEMORY_CM_REGWARP: c_uint = 101;
|
||||
pub const VM_MEMORY_EAR_DECODER: c_uint = 102;
|
||||
pub const VM_MEMORY_COREUI_CACHED_IMAGE_DATA: c_uint = 103;
|
||||
pub const VM_MEMORY_COLORSYNC: c_uint = 104;
|
||||
pub const VM_MEMORY_BTINFO: c_uint = 105;
|
||||
pub const VM_MEMORY_CM_HLS: c_uint = 106;
|
||||
pub const VM_MEMORY_COMPOSITOR_SERVICES: c_uint = 107;
|
||||
pub const VM_MEMORY_ROSETTA: c_uint = 230;
|
||||
pub const VM_MEMORY_ROSETTA_THREAD_CONTEXT: c_uint = 231;
|
||||
pub const VM_MEMORY_ROSETTA_INDIRECT_BRANCH_MAP: c_uint = 232;
|
||||
pub const VM_MEMORY_ROSETTA_RETURN_STACK: c_uint = 233;
|
||||
pub const VM_MEMORY_ROSETTA_EXECUTABLE_HEAP: c_uint = 234;
|
||||
pub const VM_MEMORY_ROSETTA_USER_LDT: c_uint = 235;
|
||||
pub const VM_MEMORY_ROSETTA_ARENA: c_uint = 236;
|
||||
pub const VM_MEMORY_ROSETTA_10: c_uint = 239;
|
||||
pub const VM_MEMORY_APPLICATION_SPECIFIC_1: c_uint = 240;
|
||||
pub const VM_MEMORY_APPLICATION_SPECIFIC_2: c_uint = 241;
|
||||
pub const VM_MEMORY_APPLICATION_SPECIFIC_3: c_uint = 242;
|
||||
pub const VM_MEMORY_APPLICATION_SPECIFIC_4: c_uint = 243;
|
||||
pub const VM_MEMORY_APPLICATION_SPECIFIC_5: c_uint = 244;
|
||||
pub const VM_MEMORY_APPLICATION_SPECIFIC_6: c_uint = 245;
|
||||
pub const VM_MEMORY_APPLICATION_SPECIFIC_7: c_uint = 246;
|
||||
pub const VM_MEMORY_APPLICATION_SPECIFIC_8: c_uint = 247;
|
||||
pub const VM_MEMORY_APPLICATION_SPECIFIC_9: c_uint = 248;
|
||||
pub const VM_MEMORY_APPLICATION_SPECIFIC_10: c_uint = 249;
|
||||
pub const VM_MEMORY_APPLICATION_SPECIFIC_11: c_uint = 250;
|
||||
pub const VM_MEMORY_APPLICATION_SPECIFIC_12: c_uint = 251;
|
||||
pub const VM_MEMORY_APPLICATION_SPECIFIC_13: c_uint = 252;
|
||||
pub const VM_MEMORY_APPLICATION_SPECIFIC_14: c_uint = 253;
|
||||
pub const VM_MEMORY_APPLICATION_SPECIFIC_15: c_uint = 254;
|
||||
pub const VM_MEMORY_APPLICATION_SPECIFIC_16: c_uint = 255;
|
||||
pub const VM_MEMORY_COUNT: c_uint = 256;
|
||||
|
||||
pub const VM_FLAGS_FIXED: ::libc::c_int = 0x0;
|
||||
pub const VM_FLAGS_ANYWHERE: ::libc::c_int = 0x1;
|
||||
pub const VM_FLAGS_OVERWRITE: ::libc::c_int = 0x4000;
|
||||
#[inline]
|
||||
pub const fn vm_make_tag(tag: c_uint) -> c_int {
|
||||
(tag as c_int) << 24
|
||||
}
|
||||
|
||||
pub const VM_FLAGS_FIXED: c_int = 0x0;
|
||||
pub const VM_FLAGS_ANYWHERE: c_int = 0x1;
|
||||
pub const VM_FLAGS_PURGABLE: c_int = 0x2;
|
||||
pub const VM_FLAGS_4GB_CHUNK: c_int = 0x4;
|
||||
pub const VM_FLAGS_RANDOM_ADDR: c_int = 0x8;
|
||||
pub const VM_FLAGS_NO_CACHE: c_int = 0x10;
|
||||
pub const VM_FLAGS_RESILIENT_CODESIGN: c_int = 0x20;
|
||||
pub const VM_FLAGS_RESILIENT_MEDIA: c_int = 0x40;
|
||||
pub const VM_FLAGS_PERMANENT: c_int = 0x80;
|
||||
pub const VM_FLAGS_TPRO: c_int = 0x1000;
|
||||
pub const VM_FLAGS_MTE: c_int = 0x2000;
|
||||
pub const VM_FLAGS_OVERWRITE: c_int = 0x4000;
|
||||
pub const VM_FLAGS_SUPERPAGE_MASK: c_int = 0x0007_0000;
|
||||
pub const VM_FLAGS_RETURN_DATA_ADDR: c_int = 0x0010_0000;
|
||||
pub const VM_FLAGS_RETURN_4K_DATA_ADDR: c_int = 0x0080_0000;
|
||||
pub const VM_FLAGS_ALIAS_MASK: c_int = -16_777_216; // 0xFF000000
|
||||
|
||||
pub const VM_FLAGS_HW: c_int = VM_FLAGS_TPRO | VM_FLAGS_MTE;
|
||||
|
||||
pub const VM_FLAGS_USER_ALLOCATE: c_int = VM_FLAGS_FIXED
|
||||
| VM_FLAGS_ANYWHERE
|
||||
| VM_FLAGS_PURGABLE
|
||||
| VM_FLAGS_4GB_CHUNK
|
||||
| VM_FLAGS_RANDOM_ADDR
|
||||
| VM_FLAGS_NO_CACHE
|
||||
| VM_FLAGS_PERMANENT
|
||||
| VM_FLAGS_OVERWRITE
|
||||
| VM_FLAGS_SUPERPAGE_MASK
|
||||
| VM_FLAGS_HW
|
||||
| VM_FLAGS_ALIAS_MASK;
|
||||
pub const VM_FLAGS_USER_MAP: c_int =
|
||||
VM_FLAGS_USER_ALLOCATE | VM_FLAGS_RETURN_4K_DATA_ADDR | VM_FLAGS_RETURN_DATA_ADDR;
|
||||
pub const VM_FLAGS_USER_REMAP: c_int = VM_FLAGS_FIXED
|
||||
| VM_FLAGS_ANYWHERE
|
||||
| VM_FLAGS_RANDOM_ADDR
|
||||
| VM_FLAGS_OVERWRITE
|
||||
| VM_FLAGS_RETURN_DATA_ADDR
|
||||
| VM_FLAGS_RESILIENT_CODESIGN
|
||||
| VM_FLAGS_RESILIENT_MEDIA;
|
||||
|
||||
pub const VM_FLAGS_SUPERPAGE_SHIFT: c_int = 16;
|
||||
pub const SUPERPAGE_NONE: c_int = 0;
|
||||
pub const SUPERPAGE_SIZE_ANY: c_int = 1;
|
||||
pub const VM_FLAGS_SUPERPAGE_NONE: c_int = SUPERPAGE_NONE << VM_FLAGS_SUPERPAGE_SHIFT;
|
||||
pub const VM_FLAGS_SUPERPAGE_SIZE_ANY: c_int = SUPERPAGE_SIZE_ANY << VM_FLAGS_SUPERPAGE_SHIFT;
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
pub const SUPERPAGE_SIZE_2MB: c_int = 2;
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
pub const VM_FLAGS_SUPERPAGE_SIZE_2MB: c_int = SUPERPAGE_SIZE_2MB << VM_FLAGS_SUPERPAGE_SHIFT;
|
||||
|
||||
pub const GUARD_TYPE_VIRT_MEMORY: u32 = 5;
|
||||
|
||||
pub type virtual_memory_guard_exception_code_t = u32;
|
||||
pub const kGUARD_EXC_DEALLOC_GAP: u32 = 1;
|
||||
pub const kGUARD_EXC_RECLAIM_COPYIO_FAILURE: u32 = 2;
|
||||
pub const kGUARD_EXC_RECLAIM_INDEX_FAILURE: u32 = 4;
|
||||
pub const kGUARD_EXC_RECLAIM_DEALLOCATE_FAILURE: u32 = 8;
|
||||
pub const kGUARD_EXC_RECLAIM_ACCOUNTING_FAILURE: u32 = 9;
|
||||
pub const kGUARD_EXC_SEC_IOPL_ON_EXEC_PAGE: u32 = 10;
|
||||
pub const kGUARD_EXC_SEC_EXEC_ON_IOPL_PAGE: u32 = 11;
|
||||
pub const kGUARD_EXC_SEC_UPL_WRITE_ON_EXEC_REGION: u32 = 12;
|
||||
|
||||
pub const kGUARD_EXC_SEC_ACCESS_FAULT: u32 = 98;
|
||||
pub const kGUARD_EXC_SEC_ASYNC_ACCESS_FAULT: u32 = 99;
|
||||
pub const kGUARD_EXC_SEC_COPY_DENIED: u32 = 100;
|
||||
pub const kGUARD_EXC_SEC_SHARING_DENIED: u32 = 101;
|
||||
pub const kGUARD_EXC_MTE_SYNC_FAULT: u32 = 200;
|
||||
pub const kGUARD_EXC_MTE_ASYNC_USER_FAULT: u32 = 201;
|
||||
pub const kGUARD_EXC_MTE_ASYNC_KERN_FAULT: u32 = 202;
|
||||
|
||||
pub const kGUARD_EXC_MTE_SOFT_MODE: u32 = 0x100000;
|
||||
|
||||
pub const __VM_LEDGER_ACCOUNTING_POSTMARK: u64 = 2_019_032_600;
|
||||
pub const VM_LEDGER_TAG_NONE: c_int = 0x0000_0000;
|
||||
pub const VM_LEDGER_TAG_DEFAULT: c_int = 0x0000_0001;
|
||||
pub const VM_LEDGER_TAG_NETWORK: c_int = 0x0000_0002;
|
||||
pub const VM_LEDGER_TAG_MEDIA: c_int = 0x0000_0003;
|
||||
pub const VM_LEDGER_TAG_GRAPHICS: c_int = 0x0000_0004;
|
||||
pub const VM_LEDGER_TAG_NEURAL: c_int = 0x0000_0005;
|
||||
pub const VM_LEDGER_TAG_MAX: c_int = VM_LEDGER_TAG_NEURAL;
|
||||
pub const VM_LEDGER_TAG_UNCHANGED: c_int = -1;
|
||||
pub const VM_LEDGER_FLAG_NO_FOOTPRINT: c_int = 1 << 0;
|
||||
pub const VM_LEDGER_FLAG_NO_FOOTPRINT_FOR_DEBUG: c_int = 1 << 1;
|
||||
pub const VM_LEDGER_FLAG_FROM_KERNEL: c_int = 1 << 2;
|
||||
pub const VM_LEDGER_FLAGS_USER: c_int =
|
||||
VM_LEDGER_FLAG_NO_FOOTPRINT | VM_LEDGER_FLAG_NO_FOOTPRINT_FOR_DEBUG;
|
||||
pub const VM_LEDGER_FLAGS_ALL: c_int = VM_LEDGER_FLAGS_USER | VM_LEDGER_FLAG_FROM_KERNEL;
|
||||
|
||||
#[inline]
|
||||
pub fn vm_statistics_truncate_to_32_bit(value: u64) -> u32 {
|
||||
if value > u32::MAX as u64 {
|
||||
u32::MAX
|
||||
} else {
|
||||
value as u32
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn vm_get_flags_alias(flags: c_int) -> u8 {
|
||||
((flags >> 24) & 0xff) as u8
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn vm_set_flags_alias(flags: &mut c_int, alias: u8) {
|
||||
*flags = (*flags & !VM_FLAGS_ALIAS_MASK) | ((alias as c_int) << 24);
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
@@ -56,3 +271,59 @@ pub struct vm_statistics {
|
||||
pub purges: natural_t,
|
||||
pub speculative_count: natural_t,
|
||||
}
|
||||
|
||||
#[repr(C, packed(8))]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct vm_statistics64 {
|
||||
pub free_count: natural_t,
|
||||
pub active_count: natural_t,
|
||||
pub inactive_count: natural_t,
|
||||
pub wire_count: natural_t,
|
||||
pub zero_fill_count: u64,
|
||||
pub reactivations: u64,
|
||||
pub pageins: u64,
|
||||
pub pageouts: u64,
|
||||
pub faults: u64,
|
||||
pub cow_faults: u64,
|
||||
pub lookups: u64,
|
||||
pub hits: u64,
|
||||
pub purges: u64,
|
||||
pub purgeable_count: natural_t,
|
||||
pub speculative_count: natural_t,
|
||||
pub decompressions: u64,
|
||||
pub compressions: u64,
|
||||
pub swapins: u64,
|
||||
pub swapouts: u64,
|
||||
pub compressor_page_count: natural_t,
|
||||
pub throttled_count: natural_t,
|
||||
pub external_page_count: natural_t,
|
||||
pub internal_page_count: natural_t,
|
||||
pub total_uncompressed_pages_in_compressor: u64,
|
||||
pub swapped_count: u64,
|
||||
}
|
||||
|
||||
#[repr(C, packed(8))]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct vm_extmod_statistics {
|
||||
pub task_for_pid_count: i64,
|
||||
pub task_for_pid_caller_count: i64,
|
||||
pub thread_creation_count: i64,
|
||||
pub thread_creation_caller_count: i64,
|
||||
pub thread_set_state_count: i64,
|
||||
pub thread_set_state_caller_count: i64,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct vm_purgeable_stat {
|
||||
pub count: u64,
|
||||
pub size: u64,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct vm_purgeable_info {
|
||||
pub fifo_data: [vm_purgeable_stat_t; 8usize],
|
||||
pub obsolete_data: vm_purgeable_stat_t,
|
||||
pub lifo_data: [vm_purgeable_stat_t; 8usize],
|
||||
}
|
||||
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
//! This module corresponds to `mach/vm_sync.h`.
|
||||
use core::ffi::c_uint;
|
||||
|
||||
pub type vm_sync_t = ::libc::c_uint;
|
||||
pub type vm_sync_t = c_uint;
|
||||
|
||||
pub const VM_SYNC_ASYNCHRONOUS: vm_sync_t = 1;
|
||||
pub const VM_SYNC_SYNCHRONOUS: vm_sync_t = 1 << 1;
|
||||
|
||||
+7
-6
@@ -1,7 +1,8 @@
|
||||
//! This module roughly corresponds to `mach/i386/vm_types.h`.
|
||||
//! This module roughly corresponds to `mach/i386/vm_types.h` and `mach/arm/vm_types.h` on aarch64.
|
||||
use core::ffi::{c_int, c_uint};
|
||||
|
||||
pub type natural_t = ::libc::c_uint;
|
||||
pub type integer_t = ::libc::c_int;
|
||||
pub type natural_t = c_uint;
|
||||
pub type integer_t = c_int;
|
||||
|
||||
pub type user_addr_t = u64;
|
||||
|
||||
@@ -11,9 +12,9 @@ pub type mach_vm_size_t = u64;
|
||||
pub type vm_map_offset_t = u64;
|
||||
pub type vm_map_address_t = u64;
|
||||
pub type vm_map_size_t = u64;
|
||||
pub type vm_map_t = ::port::mach_port_t;
|
||||
pub type vm_offset_t = ::libc::uintptr_t;
|
||||
pub type vm_size_t = ::libc::uintptr_t;
|
||||
pub type vm_map_t = crate::port::mach_port_t;
|
||||
pub type vm_offset_t = usize;
|
||||
pub type vm_size_t = usize;
|
||||
pub type vm_address_t = vm_offset_t;
|
||||
|
||||
pub type mach_port_context_t = mach_vm_address_t;
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
@@ -3,7 +3,11 @@
|
||||
BINARY=$1
|
||||
shift
|
||||
|
||||
# Cargo doesn't expose the target triple to the runner, so derive it from the
|
||||
# binary path (.../target/<triple>/...).
|
||||
TARGET=$(printf '%s' "$BINARY" | sed -E 's#(.*/)?target/([^/]+)/.*#\2#')
|
||||
|
||||
# Make sure to run the following to copy the test helper binary over.
|
||||
# cargo run --target x86_64-linux-android --bin test
|
||||
# cargo run --target "$TARGET" --bin test
|
||||
adb push "$BINARY" "/data/local/$BINARY"
|
||||
adb shell "chmod 777 /data/local/$BINARY && env TEST_HELPER=/data/local/target/x86_64-linux-android/debug/test /data/local/$BINARY" "$@"
|
||||
adb shell "chmod 777 /data/local/$BINARY && env RUST_BACKTRACE='$RUST_BACKTRACE' TEST_HELPER=/data/local/target/$TARGET/debug/test /data/local/$BINARY" "$@"
|
||||
|
||||
@@ -14,3 +14,9 @@ linker = "x86_64-linux-android30-clang"
|
||||
# By default the linker _doesn't_ generate a build-id, however we want one for our tests.
|
||||
rustflags = ["-C", "link-args=-Wl,--build-id=sha1"]
|
||||
runner = [".cargo/android-runner.sh"]
|
||||
|
||||
[target.aarch64-linux-android]
|
||||
linker = "aarch64-linux-android30-clang"
|
||||
# By default the linker _doesn't_ generate a build-id, however we want one for our tests.
|
||||
rustflags = ["-C", "link-args=-Wl,--build-id=sha1"]
|
||||
runner = [".cargo/android-runner.sh"]
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
* @Jake-Shadle @gabrielesvelto
|
||||
* @gabrielesvelto
|
||||
|
||||
@@ -34,6 +34,7 @@ jobs:
|
||||
job:
|
||||
- { os: ubuntu-24.04, target: x86_64-unknown-linux-gnu, release: true }
|
||||
- { os: ubuntu-24.04, target: x86_64-unknown-linux-musl }
|
||||
- { os: ubuntu-24.04-arm, target: aarch64-unknown-linux-gnu }
|
||||
- { os: windows-2025, target: x86_64-pc-windows-msvc }
|
||||
- { os: macos-15-intel, target: x86_64-apple-darwin }
|
||||
- { os: macos-15, target: aarch64-apple-darwin }
|
||||
@@ -43,10 +44,13 @@ jobs:
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
target: ${{ matrix.job.target }}
|
||||
components: clippy
|
||||
- name: Fetch
|
||||
run: cargo fetch --target ${{ matrix.job.target }}
|
||||
- name: Build
|
||||
run: cargo test --target ${{ matrix.job.target }} --no-run
|
||||
- name: Clippy
|
||||
run: cargo clippy --all-features --all-targets --target ${{ matrix.job.target }} -- -D warnings
|
||||
- name: Test
|
||||
run: cargo test --target ${{ matrix.job.target }}
|
||||
- name: Release test
|
||||
@@ -79,7 +83,6 @@ jobs:
|
||||
matrix:
|
||||
job:
|
||||
- target: i686-unknown-linux-gnu
|
||||
- target: aarch64-unknown-linux-gnu
|
||||
- target: aarch64-unknown-linux-musl
|
||||
- target: arm-unknown-linux-gnueabi
|
||||
- target: arm-unknown-linux-musleabi
|
||||
@@ -137,6 +140,7 @@ jobs:
|
||||
cargo run --target x86_64-linux-android --bin test -- nop
|
||||
# Build and run tests
|
||||
cargo test --target x86_64-linux-android
|
||||
cargo clippy --all-features --all-targets --target x86_64-linux-android -- -D warnings
|
||||
|
||||
deny-check:
|
||||
runs-on: ubuntu-24.04
|
||||
|
||||
+19
-1
@@ -8,6 +8,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
<!-- next-header -->
|
||||
## [Unreleased] - ReleaseDate
|
||||
## [0.13.0] - 2026-07-20
|
||||
### Changed
|
||||
- [PR#174](https://github.com/rust-minidump/minidump-writer/pull/174) and [PR#175](https://github.com/rust-minidump/minidump-writer/pull/175) refactored `src/linux/thread_info`.
|
||||
- [PR#181](https://github.com/rust-minidump/minidump-writer/pull/181) refactored `src/linux/maps_reader` and `src/linux/module_reader`.
|
||||
- [PR#185](https://github.com/rust-minidump/minidump-writer/pull/185) refactored the backend functions to use `libc`.
|
||||
- [PR#186](https://github.com/rust-minidump/minidump-writer/pull/186) removed the `nix` dependency.
|
||||
- [deb17c2](https://github.com/rust-minidump/minidump-writer/commit/deb17c272daa0a20c9327e42526537910bd97882) updated `crash-context` to 0.8, adding `loongarch64`, `riscv`, and `s390x` support, though none of those targets have an implementation in `minidump-writer` itself as of yet.
|
||||
|
||||
### Fixed
|
||||
- [PR#188](https://github.com/rust-minidump/minidump-writer/pull/188) fixed the process reader API that was broken by [PR#181](https://github.com/rust-minidump/minidump-writer/pull/181).
|
||||
|
||||
### Added
|
||||
- [PR#184](https://github.com/rust-minidump/minidump-writer/pull/184) added a `libc` backend.
|
||||
|
||||
### Removed
|
||||
- [PR#177](https://github.com/rust-minidump/minidump-writer/pull/177) and [PR#178](https://github.com/rust-minidump/minidump-writer/pull/178) removed dead/legacy code.
|
||||
|
||||
## [0.12.0] - 2026-05-07
|
||||
### Changed
|
||||
- [PR#169](https://github.com/rust-minidump/minidump-writer/pull/169) updated the crate to edition 2024 and an MSRV of 1.85.0.
|
||||
@@ -186,7 +203,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Initial release, including basic support for `x86_64-unknown-linux-gnu/musl` and `x86_64-pc-windows-msvc`
|
||||
|
||||
<!-- next-url -->
|
||||
[Unreleased]: https://github.com/rust-minidump/minidump-writer/compare/0.12.0...HEAD
|
||||
[Unreleased]: https://github.com/rust-minidump/minidump-writer/compare/0.13.0...HEAD
|
||||
[0.13.0]: https://github.com/rust-minidump/minidump-writer/compare/0.12.0...0.13.0
|
||||
[0.12.0]: https://github.com/rust-minidump/minidump-writer/compare/0.11.0...0.12.0
|
||||
[0.11.0]: https://github.com/rust-minidump/minidump-writer/compare/0.10.2...0.11.0
|
||||
[0.10.2]: https://github.com/rust-minidump/minidump-writer/compare/0.10.1...0.10.2
|
||||
|
||||
+411
-511
File diff suppressed because it is too large
Load Diff
+24
-7
@@ -13,7 +13,7 @@
|
||||
edition = "2024"
|
||||
rust-version = "1.88.0"
|
||||
name = "minidump-writer"
|
||||
version = "0.12.0"
|
||||
version = "0.13.0"
|
||||
authors = ["Martin Sirringhaus"]
|
||||
build = "build.rs"
|
||||
autolib = false
|
||||
@@ -69,14 +69,19 @@ path = "tests/windows_minidump_writer.rs"
|
||||
|
||||
[dependencies]
|
||||
bitflags = "2.10"
|
||||
cfg-if = "1.0"
|
||||
crash-context = "0.6"
|
||||
failspot = "0.2.0"
|
||||
goblin = "0.9.2"
|
||||
minidump-common = "0.26"
|
||||
scroll = "0.12"
|
||||
serde_json = "1.0.116"
|
||||
|
||||
[dependencies.cfg-if]
|
||||
version = "1.0"
|
||||
|
||||
[dependencies.crash-context]
|
||||
version = "0.8"
|
||||
path = "crates/crash-context"
|
||||
|
||||
[dependencies.error-graph]
|
||||
version = "0.1.1"
|
||||
features = ["serde"]
|
||||
@@ -114,7 +119,12 @@ failspot = "0.2.0"
|
||||
version = "0.1.1"
|
||||
features = ["serde"]
|
||||
|
||||
[target.'cfg(any(target_os = "linux", target_os = "android"))'.dependencies.plain]
|
||||
version = "0.2.3"
|
||||
default-features = false
|
||||
|
||||
[target.'cfg(any(target_os = "linux", target_os = "android"))'.dependencies.process-backend]
|
||||
version = "0.1.0"
|
||||
path = "crates/linux/process-backend"
|
||||
features = ["testing"]
|
||||
|
||||
@@ -123,8 +133,8 @@ version = "0.18"
|
||||
features = ["serde1"]
|
||||
default-features = false
|
||||
|
||||
[target.'cfg(target_os = "macos")'.dependencies]
|
||||
mach2 = "0.4"
|
||||
[target.'cfg(target_os = "macos")'.dependencies.mach2]
|
||||
version = "0.6"
|
||||
|
||||
[target.'cfg(target_os = "macos")'.dev-dependencies]
|
||||
similar-asserts = "1.6"
|
||||
@@ -146,11 +156,13 @@ memmap2 = "0.9"
|
||||
|
||||
[target."cfg(unix)".dependencies.libc]
|
||||
version = "0.2"
|
||||
default-features = false
|
||||
|
||||
[workspace]
|
||||
members = [
|
||||
"crates/process-reader",
|
||||
"crates/crash-context",
|
||||
"crates/linux/process-backend",
|
||||
"crates/process-reader",
|
||||
]
|
||||
resolver = "3"
|
||||
|
||||
@@ -162,10 +174,15 @@ edition = "2024"
|
||||
rust-version = "1.88.0"
|
||||
|
||||
[workspace.dependencies]
|
||||
libc = "0.2"
|
||||
cfg-if = "1.0"
|
||||
log = "0.4"
|
||||
mach2 = "0.6"
|
||||
thiserror = "2.0"
|
||||
|
||||
[workspace.dependencies.libc]
|
||||
version = "0.2"
|
||||
default-features = false
|
||||
|
||||
[workspace.dependencies.serde]
|
||||
version = "1.0.208"
|
||||
features = ["derive"]
|
||||
|
||||
+10
-7
@@ -1,12 +1,12 @@
|
||||
[graph]
|
||||
targets = [
|
||||
{ triple = "x86_64-unknown-linux-gnu" },
|
||||
{ triple = "x86_64-unknown-linux-musl" },
|
||||
{ triple = "x86_64-pc-windows-msvc" },
|
||||
{ triple = "x86_64-apple-darwin" },
|
||||
{ triple = "aarch64-apple-darwin" },
|
||||
{ triple = "aarch64-linux-android" },
|
||||
{ triple = "x86_64-linux-android" },
|
||||
"x86_64-unknown-linux-gnu",
|
||||
"x86_64-unknown-linux-musl",
|
||||
"x86_64-pc-windows-msvc",
|
||||
"x86_64-apple-darwin",
|
||||
"aarch64-apple-darwin",
|
||||
"aarch64-linux-android",
|
||||
"x86_64-linux-android",
|
||||
]
|
||||
|
||||
[advisories]
|
||||
@@ -17,6 +17,9 @@ multiple-versions = "deny"
|
||||
deny = [
|
||||
{ crate = "chrono", use-instead = "time", reason = "unneccessary dependency" },
|
||||
]
|
||||
skip = [
|
||||
{ crate = "syn:2.0", reason = "syn 3.0 was released, but naturally most crates will be on 2.0 for a while" },
|
||||
]
|
||||
skip-tree = []
|
||||
|
||||
[licenses]
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
pre-release-commit-message = "Release {{version}}"
|
||||
tag-message = "Release {{version}}"
|
||||
tag-name = "{{version}}"
|
||||
consolidate-commits = false
|
||||
pre-release-replacements = [
|
||||
{ file = "CHANGELOG.md", search = "Unreleased", replace = "{{version}}" },
|
||||
{ file = "CHANGELOG.md", search = "\\.\\.\\.HEAD", replace = "...{{tag_name}}" },
|
||||
|
||||
+42
-34
@@ -10,7 +10,7 @@ mod linux {
|
||||
super::*,
|
||||
error_graph::ErrorList,
|
||||
minidump_writer::{
|
||||
LINUX_GATE_LIBRARY_NAME,
|
||||
LINUX_GATE_LIBRARY_NAME, ProcessReaderKind,
|
||||
minidump_writer::{MinidumpWriter, MinidumpWriterConfig},
|
||||
},
|
||||
std::ptr,
|
||||
@@ -73,7 +73,7 @@ mod linux {
|
||||
use minidump_writer::process_reader::ProcessReader;
|
||||
|
||||
let ppid = getppid();
|
||||
let dumper = fail_on_soft_error!(
|
||||
let mut dumper = fail_on_soft_error!(
|
||||
soft_errors,
|
||||
MinidumpWriterConfig::new(ppid, ppid).build_for_testing(&mut soft_errors)?
|
||||
);
|
||||
@@ -99,25 +99,41 @@ mod linux {
|
||||
|
||||
// virtual mem
|
||||
{
|
||||
validate(ProcessReader::for_virtual_mem(&dumper.process_inspector))
|
||||
dumper
|
||||
.process_inspector
|
||||
.force_process_reader_kind(ProcessReaderKind::VirtualMem)
|
||||
.unwrap();
|
||||
validate(dumper.process_inspector.process_reader())
|
||||
.map_err(|err| format!("failed to validate memory: {err}"))?;
|
||||
}
|
||||
|
||||
// file
|
||||
{
|
||||
let reader = ProcessReader::for_file(&dumper.process_inspector)
|
||||
.map_err(|err| format!("failed to open `/proc/{ppid}/mem`: {err}"))?;
|
||||
validate(reader).map_err(|err| format!("failed to validate memory: {err}"))?;
|
||||
dumper
|
||||
.process_inspector
|
||||
.force_process_reader_kind(ProcessReaderKind::File)
|
||||
.unwrap();
|
||||
validate(dumper.process_inspector.process_reader())
|
||||
.map_err(|err| format!("failed to validate memory: {err}"))?;
|
||||
}
|
||||
|
||||
// ptrace
|
||||
{
|
||||
validate(ProcessReader::for_ptrace(&dumper.process_inspector))
|
||||
dumper
|
||||
.process_inspector
|
||||
.force_process_reader_kind(ProcessReaderKind::Ptrace)
|
||||
.unwrap();
|
||||
validate(dumper.process_inspector.process_reader())
|
||||
.map_err(|err| format!("failed to validate memory: {err}"))?;
|
||||
}
|
||||
|
||||
dumper
|
||||
.process_inspector
|
||||
.force_process_reader_kind(ProcessReaderKind::Unspecified)
|
||||
.unwrap();
|
||||
|
||||
let stack_res = MinidumpWriter::copy_from_process(
|
||||
&dumper.process_inspector,
|
||||
dumper.process_inspector.as_ref(),
|
||||
stack_var,
|
||||
std::mem::size_of::<usize>(),
|
||||
)?;
|
||||
@@ -125,7 +141,7 @@ mod linux {
|
||||
test!(stack_res == expected_stack, "stack var not correct");
|
||||
|
||||
let heap_res = MinidumpWriter::copy_from_process(
|
||||
&dumper.process_inspector,
|
||||
dumper.process_inspector.as_ref(),
|
||||
heap_var,
|
||||
std::mem::size_of::<usize>(),
|
||||
)?;
|
||||
@@ -161,20 +177,17 @@ mod linux {
|
||||
let exe_link = format!("/proc/{ppid}/exe");
|
||||
let exe_name = std::fs::read_link(exe_link)?.into_os_string();
|
||||
|
||||
let mut dumper = fail_on_soft_error!(
|
||||
let dumper = fail_on_soft_error!(
|
||||
soft_errors,
|
||||
MinidumpWriterConfig::new(ppid, ppid).build_for_testing(&mut soft_errors)?
|
||||
);
|
||||
|
||||
let mut found_exe = None;
|
||||
for (idx, mapping) in dumper.mappings.iter().enumerate() {
|
||||
if mapping.name.as_ref().map(|x| x.into()).as_ref() == Some(&exe_name) {
|
||||
found_exe = Some(idx);
|
||||
break;
|
||||
}
|
||||
}
|
||||
let idx = found_exe.unwrap();
|
||||
let id = dumper.build_id_from_process_memory_for_index(idx)?;
|
||||
let exe_mapping = dumper
|
||||
.mappings
|
||||
.iter()
|
||||
.find(|mapping| mapping.name.as_ref().map(|x| x.into()).as_ref() == Some(&exe_name))
|
||||
.unwrap();
|
||||
let id = dumper.build_id_from_process_memory(exe_mapping.start_address)?;
|
||||
|
||||
drop(dumper);
|
||||
|
||||
@@ -210,24 +223,19 @@ mod linux {
|
||||
|
||||
fn test_linux_gate_mapping_id() -> Result<()> {
|
||||
let ppid = getppid();
|
||||
let mut dumper = fail_on_soft_error!(
|
||||
let dumper = fail_on_soft_error!(
|
||||
soft_errors,
|
||||
MinidumpWriterConfig::new(ppid, ppid).build_for_testing(&mut soft_errors)?
|
||||
);
|
||||
let mut found_linux_gate = false;
|
||||
for idx in 0..dumper.mappings.len() {
|
||||
if dumper.mappings[idx].name == Some(LINUX_GATE_LIBRARY_NAME.into()) {
|
||||
found_linux_gate = true;
|
||||
let linux_gate = dumper
|
||||
.mappings
|
||||
.iter()
|
||||
.find(|mapping| mapping.name == Some(LINUX_GATE_LIBRARY_NAME.into()));
|
||||
test!(linux_gate.is_some(), "found no linux_gate");
|
||||
|
||||
let id = dumper.build_id_from_process_memory_for_index(idx)?;
|
||||
|
||||
test!(!id.is_empty(), "id-vec is empty");
|
||||
test!(id.iter().any(|&x| x > 0), "all id elements are 0");
|
||||
drop(dumper);
|
||||
break;
|
||||
}
|
||||
}
|
||||
test!(found_linux_gate, "found no linux_gate");
|
||||
let id = dumper.build_id_from_process_memory(linux_gate.unwrap().start_address)?;
|
||||
test!(!id.is_empty(), "id-vec is empty");
|
||||
test!(id.iter().any(|&x| x > 0), "all id elements are 0");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -492,7 +500,7 @@ mod mac {
|
||||
|
||||
#[inline(never)]
|
||||
pub(super) fn real_main(args: Vec<String>) -> Result<()> {
|
||||
let port_name = args.get(0).ok_or("mach port name not specified")?;
|
||||
let port_name = args.first().ok_or("mach port name not specified")?;
|
||||
let exception: u32 = args.get(1).ok_or("exception code not specified")?.parse()?;
|
||||
|
||||
let client =
|
||||
|
||||
+6
@@ -9,6 +9,9 @@ cfg_if::cfg_if! {
|
||||
ThreadName,
|
||||
SuspendThreads,
|
||||
CpuInfoFileOpen,
|
||||
StackPointerMapping,
|
||||
ThreadStackCopy,
|
||||
CrashingThreadIpCopy,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,3 +35,6 @@ pub mod module_reader;
|
||||
pub mod process_reader;
|
||||
|
||||
mod serializers;
|
||||
|
||||
/// Re-export of crash-context
|
||||
pub use ::crash_context;
|
||||
|
||||
+24
-36
@@ -1,7 +1,7 @@
|
||||
use {
|
||||
super::{
|
||||
maps_reader::MappingInfo, minidump_writer::MinidumpWriter,
|
||||
process_inspection::ProcessInspector, process_reader::CopyFromProcessError,
|
||||
minidump_writer::MinidumpWriter, process_inspection::ProcessInspector,
|
||||
process_reader::CopyFromProcessError,
|
||||
},
|
||||
goblin::elf,
|
||||
};
|
||||
@@ -49,7 +49,7 @@ struct DynVaddresses {
|
||||
}
|
||||
|
||||
fn has_android_packed_relocations(
|
||||
process_inspector: &ProcessInspector,
|
||||
process_inspector: &dyn ProcessInspector,
|
||||
load_bias: usize,
|
||||
vaddrs: DynVaddresses,
|
||||
) -> Result<()> {
|
||||
@@ -71,7 +71,7 @@ fn has_android_packed_relocations(
|
||||
}
|
||||
|
||||
fn get_effective_load_bias(
|
||||
process_inspector: &ProcessInspector,
|
||||
process_inspector: &dyn ProcessInspector,
|
||||
ehdr: &elf_header::Header,
|
||||
address: usize,
|
||||
) -> usize {
|
||||
@@ -91,7 +91,7 @@ fn get_effective_load_bias(
|
||||
}
|
||||
|
||||
fn parse_loaded_elf_program_headers(
|
||||
process_inspector: &ProcessInspector,
|
||||
process_inspector: &dyn ProcessInspector,
|
||||
ehdr: &elf_header::Header,
|
||||
address: usize,
|
||||
) -> DynVaddresses {
|
||||
@@ -130,38 +130,26 @@ fn parse_loaded_elf_program_headers(
|
||||
}
|
||||
}
|
||||
|
||||
pub fn late_process_mappings(
|
||||
process_inspector: &ProcessInspector,
|
||||
mappings: &mut [MappingInfo],
|
||||
) -> Result<()> {
|
||||
// Only consider exec mappings that indicate a file path was mapped, and
|
||||
// where the ELF header indicates a mapped shared library.
|
||||
for map in mappings
|
||||
.iter_mut()
|
||||
.filter(|m| m.is_executable() && m.name_is_path())
|
||||
{
|
||||
let ehdr_opt = MinidumpWriter::copy_from_process(
|
||||
process_inspector,
|
||||
map.start_address,
|
||||
elf_header::SIZEOF_EHDR,
|
||||
)
|
||||
.ok()
|
||||
.and_then(|x| elf_header::Header::parse(&x).ok());
|
||||
/// Compute the effective load base of the ELF library pointed at by `elf_header_addr`.
|
||||
/// In most cases it would be the same as that address, but libraries that use
|
||||
/// Android packed relocations might need some tweaking.
|
||||
pub fn effective_load_base(
|
||||
process_inspector: &dyn ProcessInspector,
|
||||
elf_header_addr: usize,
|
||||
) -> usize {
|
||||
let ehdr = MinidumpWriter::copy_from_process(
|
||||
process_inspector,
|
||||
elf_header_addr,
|
||||
elf_header::SIZEOF_EHDR,
|
||||
)
|
||||
.ok()
|
||||
.and_then(|v| elf_header::Header::parse(&v).ok());
|
||||
|
||||
if let Some(ehdr) = ehdr_opt {
|
||||
if ehdr.e_type == elf_header::ET_DYN {
|
||||
// Compute the effective load bias for this mapped library, and update
|
||||
// the mapping to hold that rather than |start_addr|, at the same time
|
||||
// adjusting |size| to account for the change in |start_addr|. Where
|
||||
// the library does not contain Android packed relocations,
|
||||
// GetEffectiveLoadBias() returns |start_addr| and the mapping entry
|
||||
// is not changed.
|
||||
let load_bias =
|
||||
get_effective_load_bias(process_inspector, &ehdr, map.start_address);
|
||||
map.size += map.start_address - load_bias;
|
||||
map.start_address = load_bias;
|
||||
}
|
||||
match ehdr {
|
||||
// Only a relocatable object can have been packed.
|
||||
Some(ehdr) if ehdr.e_type == elf_header::ET_DYN => {
|
||||
get_effective_load_bias(process_inspector, &ehdr, elf_header_addr)
|
||||
}
|
||||
_ => elf_header_addr,
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
+2
-2
@@ -87,7 +87,7 @@ pub struct AuxvDumpInfo {
|
||||
impl AuxvDumpInfo {
|
||||
pub fn try_filling_missing_info(
|
||||
&mut self,
|
||||
process_inspector: &ProcessInspector,
|
||||
process_inspector: &dyn ProcessInspector,
|
||||
pid: Pid,
|
||||
mut soft_errors: impl WriteErrorList<AuxvError>,
|
||||
) -> Result<(), AuxvError> {
|
||||
@@ -97,7 +97,7 @@ impl AuxvDumpInfo {
|
||||
|
||||
let auxv_path = format!("/proc/{pid}/auxv");
|
||||
let auxv_file = process_inspector
|
||||
.read_file(&auxv_path)
|
||||
.read_file(auxv_path.clone().into())
|
||||
.map_err(|e| AuxvError::OpenError(auxv_path, e))?;
|
||||
|
||||
for pair_result in ProcfsAuxvIter::new(BufReader::new(auxv_file)) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user