def is_kernel_running(cpu_index): """ Returns True if the corresponding CPU is executing in Ring 0 :param cpu_index: CPU index that we want to query. Each CPU might be executing a different address space :type cpu_index: int :return: True if the corresponding CPU is executing in Ring 0, False otherwise :rtype: bool """ import c_api #If this function call fails, it will raise an exception. #Given that the exception is self explanatory, we just let it propagate upwards return c_api.is_kernel_running(cpu_index)
def is_kernel_running(cpu_index=0): """ Returns True if the corresponding CPU is executing in Ring 0 :param cpu_index: CPU index that we want to query. Each CPU might be executing a different address space :type cpu_index: int :return: True if the corresponding CPU is executing in Ring 0, False otherwise :rtype: bool """ import c_api # If this function call fails, it will raise an exception. # Given that the exception is self explanatory, we just let it propagate # upwards if cpu_index >= get_num_cpus(): raise ValueError("Incorrect cpu index specified") return c_api.is_kernel_running(cpu_index)