return (NULL != gIOPolledCoreFileVars);
}
+kern_return_t kdp_polled_corefile_error(void)
+{
+ return gIOPolledCoreFileOpenRet;
+}
#if CONFIG_EMBEDDED
/*
* Whenever we start a coredump, make sure the buffers
case KDP_DATA:
err = IOPolledFileWrite(gIOPolledCoreFileVars, data, length, NULL);
if (kIOReturnSuccess != err) {
- kern_coredump_log(NULL, "IOPolledFileWrite(gIOPolledCoreFileVars, 0x%p, 0x%llx, NULL) returned 0x%x\n",
+ kern_coredump_log(NULL, "IOPolledFileWrite(gIOPolledCoreFileVars, %p, 0x%llx, NULL) returned 0x%x\n",
data, length, err);
break;
}
{
if ((ret = (*vars->outproc)(KDP_DATA, NULL, len, buf)) != kIOReturnSuccess)
{
- kern_coredump_log(NULL, "(kdp_core_zoutput) outproc(KDP_DATA, NULL, 0x%x, 0x%p) returned 0x%x\n",
+ kern_coredump_log(NULL, "(kdp_core_zoutput) outproc(KDP_DATA, NULL, 0x%x, %p) returned 0x%x\n",
len, buf, ret);
vars->error = ret;
}
vars->outlen - vars->outremain,
vars->outbuf)) != kIOReturnSuccess)
{
- kern_coredump_log(NULL, "(kdp_core_zoutputbuf) outproc(KDP_DATA, NULL, 0x%x, 0x%p) returned 0x%x\n",
+ kern_coredump_log(NULL, "(kdp_core_zoutputbuf) outproc(KDP_DATA, NULL, 0x%x, %p) returned 0x%x\n",
(vars->outlen - vars->outremain), vars->outbuf, ret);
vars->error = ret;
}
vincr = kdp_core_ramdisk_size;
}
else
-#if defined(__arm64__)
+#if defined(__arm64__) && defined(CONFIG_XNUPOST)
if (vaddr == _COMM_HIGH_PAGE64_BASE_ADDRESS)
{
/* not readable */
ppn = VM_PAGE_GET_PHYS_PAGE(m);
break;
}
- m = (vm_page_t)vm_page_queue_next(&m->listq);
- }
- vcur = phystokv(ptoa(ppn));
- if (vcur != vprev)
- {
- ret = callback(vcurstart, vprev, context);
- lastvavalid = FALSE;
+ m = (vm_page_t)vm_page_queue_next(&m->vmp_listq);
}
vincr = PAGE_SIZE_64;
if (ppn == atop(avail_end))
{
vm_object_unlock(&pmap_object_store);
m = VM_PAGE_NULL;
+ // avail_end is not a valid physical address,
+ // so phystokv(avail_end) may not produce the expected result.
+ vcur = phystokv(avail_start) + (avail_end - avail_start);
+ } else {
+ m = (vm_page_t)vm_page_queue_next(&m->vmp_listq);
+ vcur = phystokv(ptoa(ppn));
+ }
+ if (vcur != vprev)
+ {
+ ret = callback(vcurstart, vprev, context);
+ lastvavalid = FALSE;
}
- else
- m = (vm_page_t)vm_page_queue_next(&m->listq);
}
if (m == VM_PAGE_NULL)
ppn = kernel_pmap_present_mapping(vcur, &vincr, NULL);
/* Write the file header -- first seek to the beginning of the file */
foffset = 0;
if ((ret = (outvars->outproc)(KDP_SEEK, NULL, sizeof(foffset), &foffset)) != kIOReturnSuccess) {
- kern_coredump_log(NULL, "(kern_dump_update_header) outproc(KDP_SEEK, NULL, %lu, 0x%p) foffset = 0x%llx returned 0x%x\n",
+ kern_coredump_log(NULL, "(kern_dump_update_header) outproc(KDP_SEEK, NULL, %lu, %p) foffset = 0x%llx returned 0x%x\n",
sizeof(foffset), &foffset, foffset, ret);
return ret;
}
if ((ret = (outvars->outproc)(KDP_DATA, NULL, sizeof(kdp_core_header), &kdp_core_header)) != kIOReturnSuccess) {
- kern_coredump_log(NULL, "(kern_dump_update_header) outproc(KDP_DATA, NULL, %lu, 0x%p) returned 0x%x\n",
+ kern_coredump_log(NULL, "(kern_dump_update_header) outproc(KDP_DATA, NULL, %lu, %p) returned 0x%x\n",
sizeof(kdp_core_header), &kdp_core_header, ret);
return ret;
}
int ret;
if ((ret = (outvars->outproc)(KDP_SEEK, NULL, sizeof(next_file_offset), &next_file_offset)) != kIOReturnSuccess) {
- kern_coredump_log(NULL, "(kern_dump_seek_to_next_file) outproc(KDP_SEEK, NULL, %lu, 0x%p) foffset = 0x%llx returned 0x%x\n",
+ kern_coredump_log(NULL, "(kern_dump_seek_to_next_file) outproc(KDP_SEEK, NULL, %lu, %p) foffset = 0x%llx returned 0x%x\n",
sizeof(next_file_offset), &next_file_offset, next_file_offset, ret);
}
/* Seek the calculated offset (we'll scrollback later to flush the logs and header) */
if ((ret = (*outproc)(KDP_SEEK, NULL, sizeof(foffset), &foffset)) != kIOReturnSuccess) {
- kern_coredump_log(NULL, "(do_kern_dump seek begin) outproc(KDP_SEEK, NULL, %lu, 0x%p) foffset = 0x%llx returned 0x%x\n",
+ kern_coredump_log(NULL, "(do_kern_dump seek begin) outproc(KDP_SEEK, NULL, %lu, %p) foffset = 0x%llx returned 0x%x\n",
sizeof(foffset), &foffset, foffset, ret);
dump_succeeded = FALSE;
goto exit;
kern_coredump_log(NULL, "Failed to reset outvars for stackshot with len 0x%zx, returned 0x%x\n", panic_stackshot_len, ret);
dump_succeeded = FALSE;
} else if ((ret = kdp_core_output(&outvars, panic_stackshot_len, (void *)panic_stackshot_buf)) != KERN_SUCCESS) {
- kern_coredump_log(NULL, "Failed to write panic stackshot to file, kdp_coreoutput(outvars, %lu, 0x%p) returned 0x%x\n",
+ kern_coredump_log(NULL, "Failed to write panic stackshot to file, kdp_coreoutput(outvars, %lu, %p) returned 0x%x\n",
panic_stackshot_len, (void *) panic_stackshot_buf, ret);
dump_succeeded = FALSE;
} else if ((ret = kdp_core_output(&outvars, 0, NULL)) != KERN_SUCCESS) {
- kern_coredump_log(NULL, "Failed to flush stackshot data : kdp_core_output(0x%p, 0, NULL) returned 0x%x\n", &outvars, ret);
+ kern_coredump_log(NULL, "Failed to flush stackshot data : kdp_core_output(%p, 0, NULL) returned 0x%x\n", &outvars, ret);
dump_succeeded = FALSE;
} else if ((ret = kern_dump_record_file(&outvars, "panic_stackshot.kcdata", foffset, &compressed_stackshot_len)) != KERN_SUCCESS) {
kern_coredump_log(NULL, "Failed to record panic stackshot in corefile header, kern_dump_record_file returned 0x%x\n", ret);
/* Write the debug log -- first seek to the end of the corefile header */
foffset = KERN_COREDUMP_HEADERSIZE;
if ((ret = (*outproc)(KDP_SEEK, NULL, sizeof(foffset), &foffset)) != kIOReturnSuccess) {
- kern_coredump_log(NULL, "(do_kern_dump seek logfile) outproc(KDP_SEEK, NULL, %lu, 0x%p) foffset = 0x%llx returned 0x%x\n",
+ kern_coredump_log(NULL, "(do_kern_dump seek logfile) outproc(KDP_SEEK, NULL, %lu, %p) foffset = 0x%llx returned 0x%x\n",
sizeof(foffset), &foffset, foffset, ret);
dump_succeeded = FALSE;
goto exit;
*/
buf = debug_buf_base;
if ((ret = (*outproc)(KDP_DATA, NULL, existing_log_size, buf)) != kIOReturnSuccess) {
- kern_coredump_log(NULL, "(do_kern_dump paniclog) outproc(KDP_DATA, NULL, %lu, 0x%p) returned 0x%x\n",
+ kern_coredump_log(NULL, "(do_kern_dump paniclog) outproc(KDP_DATA, NULL, %lu, %p) returned 0x%x\n",
existing_log_size, buf, ret);
dump_succeeded = FALSE;
goto exit;
/* Write the coredump log */
if ((ret = (*outproc)(KDP_DATA, NULL, new_log_len, buf)) != kIOReturnSuccess) {
- kern_coredump_log(NULL, "(do_kern_dump coredump log) outproc(KDP_DATA, NULL, %lu, 0x%p) returned 0x%x\n",
+ kern_coredump_log(NULL, "(do_kern_dump coredump log) outproc(KDP_DATA, NULL, %lu, %p) returned 0x%x\n",
new_log_len, buf, ret);
dump_succeeded = FALSE;
goto exit;
}
#if CONFIG_EMBEDDED
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wmissing-noreturn"
void
panic_spin_shmcon()
{
-#pragma clang diagnostic pop
+ if (hwsd_info == NULL) {
+ kern_coredump_log(NULL, "handshake structure not initialized\n");
+ return;
+ }
+
kern_coredump_log(NULL, "\nPlease go to https://panic.apple.com to report this panic\n");
kern_coredump_log(NULL, "Waiting for hardware shared memory debugger, handshake structure is at virt: %p, phys %p\n",
hwsd_info, (void *)kvtophys((vm_offset_t)hwsd_info));
- assert(hwsd_info != NULL);
hwsd_info->xhsdci_status = XHSDCI_STATUS_KERNEL_READY;
hwsd_info->xhsdci_seq_no = 0;
FlushPoC_DcacheRegion((vm_offset_t) hwsd_info, sizeof(*hwsd_info));