]> git.saurik.com Git - apple/xnu.git/blobdiff - pexpert/arm/pe_consistent_debug.c
xnu-7195.101.1.tar.gz
[apple/xnu.git] / pexpert / arm / pe_consistent_debug.c
index e569811d6d0c8454f59b58525d266d5e6833717b..d43130ffe0fb0d4bcbe1cc5711d7bc12499a262b 100644 (file)
@@ -52,16 +52,34 @@ consistent_debug_allocate_entry(void)
        return NULL;
 }
 
+boolean_t
+PE_consistent_debug_lookup_entry(uint64_t record_id, uint64_t *phys_addr, uint64_t *length)
+{
+       assert(phys_addr != NULL);
+       assert(length != NULL);
+
+       for (unsigned int i = 0; i < consistent_debug_registry->top_level_header.num_records; i++) {
+               if (consistent_debug_registry->records[i].record_id == record_id) {
+                       *phys_addr = consistent_debug_registry->records[i].physaddr;
+                       *length = consistent_debug_registry->records[i].length;
+
+                       return true;
+               }
+       }
+
+       return false;
+}
+
 int
 PE_consistent_debug_inherit(void)
 {
        DTEntry         entryP;
-       uintptr_t       *prop_data;
+       uintptr_t const *prop_data;
        uintptr_t       root_pointer = 0;
        uint32_t        size;
 
-       if ((DTLookupEntry(NULL, "/chosen", &entryP) == kSuccess)) {
-               if (DTGetProperty(entryP, "consistent-debug-root", (void **)&prop_data, &size) == kSuccess) {
+       if ((SecureDTLookupEntry(NULL, "/chosen", &entryP) == kSuccess)) {
+               if (SecureDTGetProperty(entryP, "consistent-debug-root", (void const **)&prop_data, &size) == kSuccess) {
                        root_pointer = prop_data[0];
                }
        }