X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/d9a64523371fa019c4575bb400cbbc3a50ac9903..ea3f04195ba4a5034c9c8e9b726d4f7ce96f1832:/osfmk/arm/pcb.c diff --git a/osfmk/arm/pcb.c b/osfmk/arm/pcb.c index 60510d8b2..f42c4f4e1 100644 --- a/osfmk/arm/pcb.c +++ b/osfmk/arm/pcb.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007 Apple Inc. All rights reserved. + * Copyright (c) 2007-2019 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -102,6 +102,12 @@ machine_switch_context( new->machine.CpuDatap = cpu_data_ptr; +#if __SMP__ + /* TODO: Should this be ordered? */ + old->machine.machine_thread_flags &= ~MACHINE_THREAD_FLAGS_ON_CPU; + new->machine.machine_thread_flags |= MACHINE_THREAD_FLAGS_ON_CPU; +#endif /* __SMP__ */ + machine_switch_context_kprintf("old= %x contination = %x new = %x\n", old, continuation, new); retval = Switch_context(old, continuation, new); assert(retval != NULL); @@ -109,6 +115,12 @@ machine_switch_context( return retval; } +boolean_t +machine_thread_on_core(thread_t thread) +{ + return thread->machine.machine_thread_flags & MACHINE_THREAD_FLAGS_ON_CPU; +} + /* * Routine: machine_thread_create * @@ -131,13 +143,12 @@ machine_thread_create( } thread->machine.preemption_count = 0; thread->machine.cthread_self = 0; - thread->machine.cthread_data = 0; #if __ARM_USER_PROTECT__ { struct pmap *new_pmap = vm_map_pmap(task->map); thread->machine.kptw_ttb = ((unsigned int) kernel_pmap->ttep) | TTBR_SETUP; - thread->machine.asid = new_pmap->asid; + thread->machine.asid = new_pmap->hw_asid; if (new_pmap->tte_index_max == NTTES) { thread->machine.uptw_ttc = 2; thread->machine.uptw_ttb = ((unsigned int) new_pmap->ttep) | TTBR_SETUP; @@ -182,6 +193,15 @@ machine_thread_init(void) "arm debug state"); } +/* + * Routine: machine_thread_template_init + * + */ +void +machine_thread_template_init(thread_t __unused thr_template) +{ + /* Nothing to do on this platform. */ +} /* * Routine: get_useraddr @@ -240,6 +260,7 @@ machine_stack_attach( savestate->r[7] = 0x0UL; savestate->r[9] = (uint32_t) NULL; savestate->cpsr = PSR_SVC_MODE | PSR_INTMASK; + vfp_state_initialize(&savestate->VFPdata); machine_stack_attach_kprintf("thread = %x pc = %x, sp = %x\n", thread, savestate->lr, savestate->sp); } @@ -270,6 +291,13 @@ machine_stack_handoff( pmap_set_pmap(new->map->pmap, new); new->machine.CpuDatap = cpu_data_ptr; + +#if __SMP__ + /* TODO: Should this be ordered? */ + old->machine.machine_thread_flags &= ~MACHINE_THREAD_FLAGS_ON_CPU; + new->machine.machine_thread_flags |= MACHINE_THREAD_FLAGS_ON_CPU; +#endif /* __SMP__ */ + machine_set_current_thread(new); thread_initialize_kernel_state(new); @@ -405,3 +433,14 @@ machine_thread_set_tsd_base( return KERN_SUCCESS; } + +void +machine_tecs(__unused thread_t thr) +{ +} + +int +machine_csv(__unused cpuvn_e cve) +{ + return 0; +}