+
+ if kern.arch == 'x86_64':
+ panic_buf = Cast(kern.globals.panic_info, 'char *')
+ panic_log_magic = unsigned(kern.globals.panic_info.mph_magic)
+ panic_log_begin_offset = unsigned(kern.globals.panic_info.mph_panic_log_offset)
+ panic_log_len = unsigned(kern.globals.panic_info.mph_panic_log_len)
+ other_log_begin_offset = unsigned(kern.globals.panic_info.mph_other_log_offset)
+ other_log_len = unsigned(kern.globals.panic_info.mph_other_log_len)
+ cur_debug_buf_ptr_offset = (unsigned(kern.globals.debug_buf_ptr) - unsigned(kern.globals.panic_info))
+ if other_log_begin_offset != 0 and (other_log_len == 0 or other_log_len < (cur_debug_buf_ptr_offset - other_log_begin_offset)):
+ other_log_len = cur_debug_buf_ptr_offset - other_log_begin_offset
+ expected_panic_magic = xnudefines.MACOS_PANIC_MAGIC
+ else:
+ panic_buf = Cast(kern.globals.panic_info, 'char *')
+ panic_log_magic = unsigned(kern.globals.panic_info.eph_magic)
+ panic_log_begin_offset = unsigned(kern.globals.panic_info.eph_panic_log_offset)
+ panic_log_len = unsigned(kern.globals.panic_info.eph_panic_log_len)
+ other_log_begin_offset = unsigned(kern.globals.panic_info.eph_other_log_offset)
+ other_log_len = unsigned(kern.globals.panic_info.eph_other_log_len)
+ expected_panic_magic = xnudefines.EMBEDDED_PANIC_MAGIC
+
+ if panic_log_begin_offset == 0:
+ return
+
+ if panic_log_magic != 0 and panic_log_magic != expected_panic_magic:
+ warn_str += "BAD MAGIC! Found 0x%x expected 0x%x".format(panic_log_magic,
+ expected_panic_magic)
+
+ if panic_log_begin_offset == 0:
+ if warn_str:
+ print "\n %s" % warn_str
+ return
+
+ panic_log_curindex = 0
+ while panic_log_curindex < panic_log_len:
+ p_char = str(panic_buf[(panic_log_begin_offset + panic_log_curindex)])