]>
git.saurik.com Git - apple/xnu.git/blob - tools/lldbmacros/scheduler.py
5 # TODO: write scheduler related macros here
7 # Macro: showinterrupts
8 @lldb_command('showinterrupts')
9 def ShowInterrupts(cmd_args
=None):
10 """ Prints IRQ, IPI and TMR counts for each CPU
12 bcdata
= kern
.GetValueFromAddress(kern
.GetLoadAddressForSymbol('BootCpuData'), 'cpu_data_t *')
13 print "CPU 0 IRQ: {:d}\n".format(bcdata
.cpu_stat
.irq_ex_cnt
)
14 print "CPU 0 IPI: {:d}\n".format(bcdata
.cpu_stat
.ipi_cnt
)
15 print "CPU 0 TMR: {:d}\n".format(bcdata
.cpu_stat
.timer_cnt
)
16 if (kern
.globals.machine_info
.physical_cpu
== 2):
17 if kern
.arch
== 'arm':
18 cdentries
= kern
.GetValueFromAddress(kern
.GetLoadAddressForSymbol('CpuDataEntries') + 20, 'uintptr_t *')
19 cpu_data_entry
= Cast(dereference(cdentries
), 'cpu_data_t *')
20 print "CPU 1 IRQ: {:d}\n".format(cpu_data_entry
.cpu_stat
.irq_ex_cnt
)
21 print "CPU 1 IPI: {:d}\n".format(cpu_data_entry
.cpu_stat
.ipi_cnt
)
22 print "CPU 1 TMR: {:d}\n".format(cpu_data_entry
.cpu_stat
.timer_cnt
)
24 # EndMacro: showinterrupts
26 # Macro: showactiveinterrupts
27 @lldb_command('showactiveinterrupts')
28 def ShowActiveInterrupts(cmd_args
=None):
29 """ Prints the interrupts that are unmasked & active with the Interrupt Controller
30 Usage: showactiveinterrupts <address of Interrupt Controller object>
33 print "No arguments passed"
34 print ShowActiveInterrupts
.__doc
__
36 aic
= kern
.GetValueFromAddress(cmd_args
[0], 'AppleInterruptController *')
38 print "unknown arguments:", str(cmd_args
)
41 aic_base
= unsigned(aic
._aicBaseAddress
)
43 aic_imc_base
= aic_base
+ 0x4180
45 current_pointer
= aic_imc_base
46 unmasked
= dereference(kern
.GetValueFromAddress(current_pointer
, 'uintptr_t *'))
47 active
= dereference(kern
.GetValueFromAddress(current_pointer
+ aic_him_offset
, 'uintptr_t *'))
50 while current_interrupt
< 192:
51 if (((unmasked
& mask
) == 0) and (active
& mask
)):
52 print "Interrupt {:d} unmasked and active\n".format(current_interrupt
)
53 current_interrupt
= current_interrupt
+ 1
54 if (current_interrupt
% 32 == 0):
56 group_count
= group_count
+ 1
57 unmasked
= dereference(kern
.GetValueFromAddress(current_pointer
+ (4 * group_count
), 'uintptr_t *'))
58 active
= dereference(kern
.GetValueFromAddress((current_pointer
+ aic_him_offset
) + (4 * group_count
), 'uintptr_t *'))
62 # EndMacro: showactiveinterrupts