Skip to content

Commit

Permalink
xnu-4903.231.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Darwin authored and das committed Jan 11, 2021
1 parent a449c6a commit cecb6e5
Show file tree
Hide file tree
Showing 39 changed files with 443 additions and 387 deletions.
8 changes: 4 additions & 4 deletions bsd/dev/monotonic.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,8 @@ int thread_selfcounts(__unused struct proc *p,
{
switch (uap->type) {
case 1: {
uint64_t counts[2] = {};
uint64_t thread_counts[MT_CORE_NFIXED];
uint64_t counts[2] = { 0 };
uint64_t thread_counts[MT_CORE_NFIXED] = { 0 };

mt_cur_thread_fixed_counts(thread_counts);

Expand Down Expand Up @@ -338,8 +338,8 @@ static int
mt_sysctl SYSCTL_HANDLER_ARGS
{
#pragma unused(oidp, arg2)
uint64_t start[MT_CORE_NFIXED], end[MT_CORE_NFIXED];
uint64_t counts[2] = {};
uint64_t start[MT_CORE_NFIXED] = { 0 }, end[MT_CORE_NFIXED] = { 0 };
uint64_t counts[2] = { 0 };

switch ((enum mt_sysctl)arg1) {
case MT_SUPPORTED:
Expand Down
4 changes: 3 additions & 1 deletion bsd/kern/kern_descrip.c
Original file line number Diff line number Diff line change
Expand Up @@ -4749,7 +4749,9 @@ fdexec(proc_t p, short flags, int self_exec)
msleep(&p->p_fpdrainwait, &p->p_fdmlock, PRIBIO,
"fpdrain", NULL);
}

if (fp->f_flags & FP_WAITEVENT) {
(void)waitevent_close(p, fp);
}
closef_locked(fp, fp->f_fglob, p);

fileproc_free(fp);
Expand Down
8 changes: 6 additions & 2 deletions bsd/kern/kern_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -8595,7 +8595,11 @@ kevent_copyout_proc_dynkqids(void *proc, user_addr_t ubuf, uint32_t ubufsize,
goto out;
}
kq_ids = kalloc(bufsize);
assert(kq_ids != NULL);
if (!kq_ids) {
err = ENOMEM;
goto out;
}
bzero(kq_ids, bufsize);
}

kqhash_lock(p);
Expand All @@ -8618,7 +8622,7 @@ kevent_copyout_proc_dynkqids(void *proc, user_addr_t ubuf, uint32_t ubufsize,

if (kq_ids) {
size_t copysize;
if (os_mul_overflow(sizeof(kqueue_id_t), min(ubuflen, nkqueues), &copysize)) {
if (os_mul_overflow(sizeof(kqueue_id_t), min(buflen, nkqueues), &copysize)) {
err = ERANGE;
goto out;
}
Expand Down
4 changes: 4 additions & 0 deletions bsd/kern/posix_sem.c
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,10 @@ sem_close(proc_t p, struct sem_close_args *uap, __unused int32_t *retval)
proc_fdunlock(p);
return(error);
}
if (fp->f_type != DTYPE_PSXSEM) {
proc_fdunlock(p);
return(EBADF);
}
procfdtbl_markclosefd(p, fd);
fileproc_drain(p, fp);
fdrelse(p, fd);
Expand Down
11 changes: 8 additions & 3 deletions bsd/kern/posix_shm.c
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,7 @@ pshm_mmap(__unused proc_t p, struct mmap_args *uap, user_addr_t *retval, struct
vm_map_offset_t user_start_addr;
vm_map_size_t map_size, mapped_size;
int prot = uap->prot;
int max_prot = VM_PROT_DEFAULT;
int flags = uap->flags;
vm_object_offset_t file_pos = (vm_object_offset_t)uap->pos;
vm_object_offset_t map_pos;
Expand All @@ -887,8 +888,12 @@ pshm_mmap(__unused proc_t p, struct mmap_args *uap, user_addr_t *retval, struct
return(EINVAL);


if ((prot & PROT_WRITE) && ((fp->f_flag & FWRITE) == 0)) {
return(EPERM);
/* Can't allow write permission if the shm_open() didn't */
if (!(fp->f_flag & FWRITE)) {
if (prot & VM_PROT_WRITE) {
return EPERM;
}
max_prot &= ~VM_PROT_WRITE;
}

if (((pnode = (struct pshmnode *)fp->f_data)) == PSHMNODE_NULL )
Expand Down Expand Up @@ -1000,7 +1005,7 @@ pshm_mmap(__unused proc_t p, struct mmap_args *uap, user_addr_t *retval, struct
file_pos - map_pos,
docow,
prot,
VM_PROT_DEFAULT,
max_prot,
VM_INHERIT_SHARE);
if (kret != KERN_SUCCESS)
goto out;
Expand Down
4 changes: 2 additions & 2 deletions bsd/kern/sysv_shm.c
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ shmctl(__unused struct proc *p, struct shmctl_args *uap, int32_t *retval)
}

if (IS_64BIT_PROCESS(p)) {
struct user_shmid_ds shmid_ds;
struct user_shmid_ds shmid_ds = {};
memcpy(&shmid_ds, &shmseg->u, sizeof(struct user_shmid_ds));

/* Clear kernel reserved pointer before copying to user space */
Expand Down Expand Up @@ -1046,7 +1046,7 @@ shminit(void)
return ENOMEM;
}

MALLOC(shmsegs, struct shmid_kernel *, sz, M_SHM, M_WAITOK);
MALLOC(shmsegs, struct shmid_kernel *, sz, M_SHM, M_WAITOK | M_ZERO);
if (shmsegs == NULL) {
return ENOMEM;
}
Expand Down
3 changes: 3 additions & 0 deletions bsd/net/necp.c
Original file line number Diff line number Diff line change
Expand Up @@ -8826,6 +8826,9 @@ necp_socket_is_allowed_to_send_recv_internal(struct inpcb *inp, struct sockaddr
if (return_route_rule_id) {
*return_route_rule_id = inp->inp_policyresult.results.route_rule_id;
}
if (return_skip_policy_id) {
*return_skip_policy_id = inp->inp_policyresult.skip_policy_id;
}
}
lck_rw_done(&necp_kernel_policy_lock);
goto done;
Expand Down
6 changes: 1 addition & 5 deletions bsd/netinet/flow_divert.c
Original file line number Diff line number Diff line change
Expand Up @@ -1186,7 +1186,7 @@ flow_divert_create_connect_packet(struct flow_divert_pcb *fd_cb, struct sockaddr
if (fd_cb->local_address != NULL) {
/* socket is bound. */
error = flow_divert_packet_append_tlv(connect_packet, FLOW_DIVERT_TLV_LOCAL_ADDR,
sizeof(struct sockaddr_storage), fd_cb->local_address);
fd_cb->local_address->sa_len, fd_cb->local_address);
if (error) {
goto done;
}
Expand Down Expand Up @@ -2017,10 +2017,6 @@ flow_divert_handle_data(struct flow_divert_pcb *fd_cb, mbuf_t packet, size_t off
}
}
socket_unlock(fd_cb->so, 0);

if (data != NULL) {
mbuf_freem(data);
}
}
FDUNLOCK(fd_cb);
}
Expand Down
2 changes: 2 additions & 0 deletions bsd/netinet/mptcp_subr.c
Original file line number Diff line number Diff line change
Expand Up @@ -774,8 +774,10 @@ mptcp_trigger_cell_bringup(struct mptses *mpte)
uuid_string_t uuidstr;
int err;

mpte_unlock(mpte);
err = necp_client_assert_bb_radio_manager(mpsotomppcb(mp_so)->necp_client_uuid,
TRUE);
mpte_lock(mpte);

if (err == 0)
mpte->mpte_triggered_cell = 1;
Expand Down
11 changes: 7 additions & 4 deletions config/MASTER.arm64
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@
# FILESYS_DEV = [ FILESYS_BASE fdesc ]
# FILESYS_DEBUG = [ FILESYS_BASE fdesc ]
# NFS = [ nfsclient nfsserver ]
# NETWORKING = [ inet tcpdrop_synfin bpfilter inet6 ipv6send if_bridge traffic_mgt dummynet ah_all_crypto packet_mangler if_fake ]
# NETWORKING = [ inet tcpdrop_synfin bpfilter inet6 ipv6send if_bridge traffic_mgt dummynet ah_all_crypto if_fake ]
# NETWORKING_RELEASE = [ NETWORKING ]
# NETWORKING_DEV = [ NETWORKING_RELEASE packet_mangler ]
# NETWORKING_DEBUG = [ NETWORKING_DEV ]
# VPN = [ ipsec flow_divert necp content_filter ]
# PF = [ pf ]
# MULTIPATH = [ multipath mptcp ]
Expand Down Expand Up @@ -58,9 +61,9 @@
# VM_DEV = [ VM_BASE dynamic_codesigning ]
# VM_DEBUG = [ VM_BASE dynamic_codesigning ]
# SECURITY = [ config_macf kernel_integrity ]
# RELEASE = [ KERNEL_RELEASE BSD_RELEASE FILESYS_RELEASE SKYWALK_RELEASE NETWORKING PF MULTIPATH VPN IOKIT_RELEASE LIBKERN_RELEASE PERF_DBG_RELEASE MACH_RELEASE SCHED_RELEASE VM_RELEASE SECURITY ]
# DEVELOPMENT = [ KERNEL_DEV BSD_DEV FILESYS_DEV NFS SKYWALK_DEV NETWORKING PF MULTIPATH VPN IOKIT_DEV LIBKERN_DEV PERF_DBG_DEV MACH_DEV SCHED_DEV VM_DEV SECURITY ]
# DEBUG = [ KERNEL_DEBUG BSD_DEBUG FILESYS_DEBUG SKYWALK_DEBUG NETWORKING PF MULTIPATH VPN IOKIT_DEBUG LIBKERN_DEBUG PERF_DBG_DEBUG MACH_DEBUG SCHED_DEBUG VM_DEBUG SECURITY ]
# RELEASE = [ KERNEL_RELEASE BSD_RELEASE FILESYS_RELEASE SKYWALK_RELEASE NETWORKING_RELEASE PF MULTIPATH VPN IOKIT_RELEASE LIBKERN_RELEASE PERF_DBG_RELEASE MACH_RELEASE SCHED_RELEASE VM_RELEASE SECURITY ]
# DEVELOPMENT = [ KERNEL_DEV BSD_DEV FILESYS_DEV NFS SKYWALK_DEV NETWORKING_DEV PF MULTIPATH VPN IOKIT_DEV LIBKERN_DEV PERF_DBG_DEV MACH_DEV SCHED_DEV VM_DEV SECURITY ]
# DEBUG = [ KERNEL_DEBUG BSD_DEBUG FILESYS_DEBUG SKYWALK_DEBUG NETWORKING_DEBUG PF MULTIPATH VPN IOKIT_DEBUG LIBKERN_DEBUG PERF_DBG_DEBUG MACH_DEBUG SCHED_DEBUG VM_DEBUG SECURITY ]
# KASAN = [ DEVELOPMENT ]
#
######################################################################
Expand Down
11 changes: 7 additions & 4 deletions config/MASTER.arm64.bcm2837
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@
# FILESYS_DEV = [ FILESYS_BASE fdesc ]
# FILESYS_DEBUG = [ FILESYS_BASE fdesc ]
# NFS = [ nfsclient nfsserver ]
# NETWORKING = [ inet tcpdrop_synfin bpfilter inet6 ipv6send if_bridge traffic_mgt dummynet ah_all_crypto packet_mangler if_fake ]
# NETWORKING = [ inet tcpdrop_synfin bpfilter inet6 ipv6send if_bridge traffic_mgt dummynet ah_all_crypto if_fake ]
# NETWORKING_RELEASE = [ NETWORKING ]
# NETWORKING_DEV = [ NETWORKING_RELEASE packet_mangler ]
# NETWORKING_DEBUG = [ NETWORKING_DEV ]
# VPN = [ ipsec flow_divert necp content_filter ]
# PF = [ pf ]
# MULTIPATH = [ multipath mptcp ]
Expand Down Expand Up @@ -58,9 +61,9 @@
# VM_DEV = [ VM_BASE dynamic_codesigning ]
# VM_DEBUG = [ VM_BASE dynamic_codesigning ]
# SECURITY = [ config_macf kernel_integrity ]
# RELEASE = [ KERNEL_RELEASE BSD_RELEASE FILESYS_RELEASE SKYWALK_RELEASE NETWORKING PF MULTIPATH VPN IOKIT_RELEASE LIBKERN_RELEASE PERF_DBG_RELEASE MACH_RELEASE SCHED_RELEASE VM_RELEASE SECURITY ]
# DEVELOPMENT = [ KERNEL_DEV BSD_DEV FILESYS_DEV NFS SKYWALK_DEV NETWORKING PF MULTIPATH VPN IOKIT_DEV LIBKERN_DEV PERF_DBG_DEV MACH_DEV SCHED_DEV VM_DEV SECURITY ]
# DEBUG = [ KERNEL_DEBUG BSD_DEBUG FILESYS_DEBUG SKYWALK_DEBUG NETWORKING PF MULTIPATH VPN IOKIT_DEBUG LIBKERN_DEBUG PERF_DBG_DEBUG MACH_DEBUG SCHED_DEBUG VM_DEBUG SECURITY ]
# RELEASE = [ KERNEL_RELEASE BSD_RELEASE FILESYS_RELEASE SKYWALK_RELEASE NETWORKING_RELEASE PF MULTIPATH VPN IOKIT_RELEASE LIBKERN_RELEASE PERF_DBG_RELEASE MACH_RELEASE SCHED_RELEASE VM_RELEASE SECURITY ]
# DEVELOPMENT = [ KERNEL_DEV BSD_DEV FILESYS_DEV NFS SKYWALK_DEV NETWORKING_DEV PF MULTIPATH VPN IOKIT_DEV LIBKERN_DEV PERF_DBG_DEV MACH_DEV SCHED_DEV VM_DEV SECURITY ]
# DEBUG = [ KERNEL_DEBUG BSD_DEBUG FILESYS_DEBUG SKYWALK_DEBUG NETWORKING_DEBUG PF MULTIPATH VPN IOKIT_DEBUG LIBKERN_DEBUG PERF_DBG_DEBUG MACH_DEBUG SCHED_DEBUG VM_DEBUG SECURITY ]
# KASAN = [ DEVELOPMENT ]
#
######################################################################
Expand Down
11 changes: 7 additions & 4 deletions config/MASTER.x86_64
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@
# FILESYS_DEV = [ FILESYS_BASE ]
# FILESYS_DEBUG = [ FILESYS_BASE ]
# NFS = [ nfsclient nfsserver ]
# NETWORKING = [ inet inet6 ipv6send tcpdrop_synfin bpfilter dummynet traffic_mgt sendfile ah_all_crypto bond vlan gif stf ifnet_input_chk config_mbuf_jumbo if_bridge ipcomp_zlib MULTIPATH packet_mangler if_fake ]
# NETWORKING = [ inet inet6 ipv6send tcpdrop_synfin bpfilter dummynet traffic_mgt sendfile ah_all_crypto bond vlan gif stf ifnet_input_chk config_mbuf_jumbo if_bridge ipcomp_zlib MULTIPATH if_fake ]
# NETWORKING_RELEASE = [ NETWORKING ]
# NETWORKING_DEV = [ NETWORKING_RELEASE packet_mangler ]
# NETWORKING_DEBUG = [ NETWORKING_DEV ]
# VPN = [ ipsec flow_divert necp content_filter ]
# PF = [ pf pflog ]
# MULTIPATH = [ multipath mptcp ]
Expand All @@ -52,9 +55,9 @@
# SCHED_DEBUG = [ SCHED_BASE config_sched_grrr config_sched_proto ]
# VM = [ vm_pressure_events memorystatus dynamic_codesigning config_code_decryption encrypted_swap phantom_cache config_background_queue]
# SECURITY = [ config_macf config_audit config_csr ]
# RELEASE = [ KERNEL_RELEASE BSD_RELEASE FILESYS_RELEASE NFS SKYWALK_RELEASE NETWORKING PF VPN IOKIT_RELEASE LIBKERN_RELEASE PERF_DBG MACH_RELEASE SCHED_RELEASE VM SECURITY ]
# DEVELOPMENT = [ KERNEL_DEV BSD_DEV FILESYS_DEV NFS SKYWALK_DEV NETWORKING PF VPN IOKIT_DEV LIBKERN_DEV PERF_DBG MACH_DEV SCHED_DEV VM SECURITY ]
# DEBUG = [ KERNEL_DEBUG BSD_DEBUG FILESYS_DEBUG NFS SKYWALK_DEBUG NETWORKING PF VPN IOKIT_DEBUG LIBKERN_DEBUG PERF_DBG MACH_DEBUG SCHED_DEBUG VM SECURITY ]
# RELEASE = [ KERNEL_RELEASE BSD_RELEASE FILESYS_RELEASE NFS SKYWALK_RELEASE NETWORKING_RELEASE PF VPN IOKIT_RELEASE LIBKERN_RELEASE PERF_DBG MACH_RELEASE SCHED_RELEASE VM SECURITY ]
# DEVELOPMENT = [ KERNEL_DEV BSD_DEV FILESYS_DEV NFS SKYWALK_DEV NETWORKING_DEV PF VPN IOKIT_DEV LIBKERN_DEV PERF_DBG MACH_DEV SCHED_DEV VM SECURITY ]
# DEBUG = [ KERNEL_DEBUG BSD_DEBUG FILESYS_DEBUG NFS SKYWALK_DEBUG NETWORKING_DEBUG PF VPN IOKIT_DEBUG LIBKERN_DEBUG PERF_DBG MACH_DEBUG SCHED_DEBUG VM SECURITY ]
# KASAN = [ DEVELOPMENT ]
#
######################################################################
Expand Down
1 change: 1 addition & 0 deletions config/Unsupported.exports
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ _mach_make_memory_entry_64
_mach_memory_entry_page_op
_mach_memory_entry_range_op
_mach_msg_rpc_from_kernel_proper
_mach_msg_destroy_from_kernel_proper
_mach_vm_region
_max_mem
_mem_size
Expand Down
90 changes: 90 additions & 0 deletions iokit/Kernel/IOPMrootDomain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,51 @@ static void pmEventTimeStamp(uint64_t *recordTS);
static const OSSymbol *sleepSupportedPEFunction = NULL;
static const OSSymbol *sleepMessagePEFunction = NULL;

static const OSSymbol * gIOPMPSExternalConnectedKey;
static const OSSymbol * gIOPMPSExternalChargeCapableKey;
static const OSSymbol * gIOPMPSBatteryInstalledKey;
static const OSSymbol * gIOPMPSIsChargingKey;
static const OSSymbol * gIOPMPSAtWarnLevelKey;
static const OSSymbol * gIOPMPSAtCriticalLevelKey;
static const OSSymbol * gIOPMPSCurrentCapacityKey;
static const OSSymbol * gIOPMPSMaxCapacityKey;
static const OSSymbol * gIOPMPSDesignCapacityKey;
static const OSSymbol * gIOPMPSTimeRemainingKey;
static const OSSymbol * gIOPMPSAmperageKey;
static const OSSymbol * gIOPMPSVoltageKey;
static const OSSymbol * gIOPMPSCycleCountKey;
static const OSSymbol * gIOPMPSMaxErrKey;
static const OSSymbol * gIOPMPSAdapterInfoKey;
static const OSSymbol * gIOPMPSLocationKey;
static const OSSymbol * gIOPMPSErrorConditionKey;
static const OSSymbol * gIOPMPSManufacturerKey;
static const OSSymbol * gIOPMPSManufactureDateKey;
static const OSSymbol * gIOPMPSModelKey;
static const OSSymbol * gIOPMPSSerialKey;
static const OSSymbol * gIOPMPSLegacyBatteryInfoKey;
static const OSSymbol * gIOPMPSBatteryHealthKey;
static const OSSymbol * gIOPMPSHealthConfidenceKey;
static const OSSymbol * gIOPMPSCapacityEstimatedKey;
static const OSSymbol * gIOPMPSBatteryChargeStatusKey;
static const OSSymbol * gIOPMPSBatteryTemperatureKey;
static const OSSymbol * gIOPMPSAdapterDetailsKey;
static const OSSymbol * gIOPMPSChargerConfigurationKey;
static const OSSymbol * gIOPMPSAdapterDetailsIDKey;
static const OSSymbol * gIOPMPSAdapterDetailsWattsKey;
static const OSSymbol * gIOPMPSAdapterDetailsRevisionKey;
static const OSSymbol * gIOPMPSAdapterDetailsSerialNumberKey;
static const OSSymbol * gIOPMPSAdapterDetailsFamilyKey;
static const OSSymbol * gIOPMPSAdapterDetailsAmperageKey;
static const OSSymbol * gIOPMPSAdapterDetailsDescriptionKey;
static const OSSymbol * gIOPMPSAdapterDetailsPMUConfigurationKey;
static const OSSymbol * gIOPMPSAdapterDetailsSourceIDKey;
static const OSSymbol * gIOPMPSAdapterDetailsErrorFlagsKey;
static const OSSymbol * gIOPMPSAdapterDetailsSharedSourceKey;
static const OSSymbol * gIOPMPSAdapterDetailsCloakedKey;
static const OSSymbol * gIOPMPSInvalidWakeSecondsKey;
static const OSSymbol * gIOPMPSPostChargeWaitSecondsKey;
static const OSSymbol * gIOPMPSPostDishargeWaitSecondsKey;

#define kIOSleepSupportedKey "IOSleepSupported"
#define kIOPMSystemCapabilitiesKey "System Capabilities"

Expand Down Expand Up @@ -9591,6 +9636,51 @@ static IOPMPowerState patriarchPowerStates[2] =

void IORootParent::initialize( void )
{

gIOPMPSExternalConnectedKey = OSSymbol::withCStringNoCopy(kIOPMPSExternalConnectedKey);
gIOPMPSExternalChargeCapableKey = OSSymbol::withCStringNoCopy(kIOPMPSExternalChargeCapableKey);
gIOPMPSBatteryInstalledKey = OSSymbol::withCStringNoCopy(kIOPMPSBatteryInstalledKey);
gIOPMPSIsChargingKey = OSSymbol::withCStringNoCopy(kIOPMPSIsChargingKey);
gIOPMPSAtWarnLevelKey = OSSymbol::withCStringNoCopy(kIOPMPSAtWarnLevelKey);
gIOPMPSAtCriticalLevelKey = OSSymbol::withCStringNoCopy(kIOPMPSAtCriticalLevelKey);
gIOPMPSCurrentCapacityKey = OSSymbol::withCStringNoCopy(kIOPMPSCurrentCapacityKey);
gIOPMPSMaxCapacityKey = OSSymbol::withCStringNoCopy(kIOPMPSMaxCapacityKey);
gIOPMPSDesignCapacityKey = OSSymbol::withCStringNoCopy(kIOPMPSDesignCapacityKey);
gIOPMPSTimeRemainingKey = OSSymbol::withCStringNoCopy(kIOPMPSTimeRemainingKey);
gIOPMPSAmperageKey = OSSymbol::withCStringNoCopy(kIOPMPSAmperageKey);
gIOPMPSVoltageKey = OSSymbol::withCStringNoCopy(kIOPMPSVoltageKey);
gIOPMPSCycleCountKey = OSSymbol::withCStringNoCopy(kIOPMPSCycleCountKey);
gIOPMPSMaxErrKey = OSSymbol::withCStringNoCopy(kIOPMPSMaxErrKey);
gIOPMPSAdapterInfoKey = OSSymbol::withCStringNoCopy(kIOPMPSAdapterInfoKey);
gIOPMPSLocationKey = OSSymbol::withCStringNoCopy(kIOPMPSLocationKey);
gIOPMPSErrorConditionKey = OSSymbol::withCStringNoCopy(kIOPMPSErrorConditionKey);
gIOPMPSManufacturerKey = OSSymbol::withCStringNoCopy(kIOPMPSManufacturerKey);
gIOPMPSManufactureDateKey = OSSymbol::withCStringNoCopy(kIOPMPSManufactureDateKey);
gIOPMPSModelKey = OSSymbol::withCStringNoCopy(kIOPMPSModelKey);
gIOPMPSSerialKey = OSSymbol::withCStringNoCopy(kIOPMPSSerialKey);
gIOPMPSLegacyBatteryInfoKey = OSSymbol::withCStringNoCopy(kIOPMPSLegacyBatteryInfoKey);
gIOPMPSBatteryHealthKey = OSSymbol::withCStringNoCopy(kIOPMPSBatteryHealthKey);
gIOPMPSHealthConfidenceKey = OSSymbol::withCStringNoCopy(kIOPMPSHealthConfidenceKey);
gIOPMPSCapacityEstimatedKey = OSSymbol::withCStringNoCopy(kIOPMPSCapacityEstimatedKey);
gIOPMPSBatteryChargeStatusKey = OSSymbol::withCStringNoCopy(kIOPMPSBatteryChargeStatusKey);
gIOPMPSBatteryTemperatureKey = OSSymbol::withCStringNoCopy(kIOPMPSBatteryTemperatureKey);
gIOPMPSAdapterDetailsKey = OSSymbol::withCStringNoCopy(kIOPMPSAdapterDetailsKey);
gIOPMPSChargerConfigurationKey = OSSymbol::withCStringNoCopy(kIOPMPSChargerConfigurationKey);
gIOPMPSAdapterDetailsIDKey = OSSymbol::withCStringNoCopy(kIOPMPSAdapterDetailsIDKey);
gIOPMPSAdapterDetailsWattsKey = OSSymbol::withCStringNoCopy(kIOPMPSAdapterDetailsWattsKey);
gIOPMPSAdapterDetailsRevisionKey = OSSymbol::withCStringNoCopy(kIOPMPSAdapterDetailsRevisionKey);
gIOPMPSAdapterDetailsSerialNumberKey = OSSymbol::withCStringNoCopy(kIOPMPSAdapterDetailsSerialNumberKey);
gIOPMPSAdapterDetailsFamilyKey = OSSymbol::withCStringNoCopy(kIOPMPSAdapterDetailsFamilyKey);
gIOPMPSAdapterDetailsAmperageKey = OSSymbol::withCStringNoCopy(kIOPMPSAdapterDetailsAmperageKey);
gIOPMPSAdapterDetailsDescriptionKey = OSSymbol::withCStringNoCopy(kIOPMPSAdapterDetailsDescriptionKey);
gIOPMPSAdapterDetailsPMUConfigurationKey = OSSymbol::withCStringNoCopy(kIOPMPSAdapterDetailsPMUConfigurationKey);
gIOPMPSAdapterDetailsSourceIDKey = OSSymbol::withCStringNoCopy(kIOPMPSAdapterDetailsSourceIDKey);
gIOPMPSAdapterDetailsErrorFlagsKey = OSSymbol::withCStringNoCopy(kIOPMPSAdapterDetailsErrorFlagsKey);
gIOPMPSAdapterDetailsSharedSourceKey = OSSymbol::withCStringNoCopy(kIOPMPSAdapterDetailsSharedSourceKey);
gIOPMPSAdapterDetailsCloakedKey = OSSymbol::withCStringNoCopy(kIOPMPSAdapterDetailsCloakedKey);
gIOPMPSInvalidWakeSecondsKey = OSSymbol::withCStringNoCopy(kIOPMPSInvalidWakeSecondsKey);
gIOPMPSPostChargeWaitSecondsKey = OSSymbol::withCStringNoCopy(kIOPMPSPostChargeWaitSecondsKey);
gIOPMPSPostDishargeWaitSecondsKey = OSSymbol::withCStringNoCopy(kIOPMPSPostDishargeWaitSecondsKey);
}

bool IORootParent::start( IOService * nub )
Expand Down
2 changes: 2 additions & 0 deletions osfmk/arm/machine_routines.c
Original file line number Diff line number Diff line change
Expand Up @@ -1009,6 +1009,8 @@ ml_delay_should_spin(uint64_t interval)
}
}

void ml_delay_on_yield(void) {}

boolean_t ml_thread_is64bit(thread_t thread)
{
return (thread_is_64bit_addr(thread));
Expand Down
2 changes: 2 additions & 0 deletions osfmk/arm/machine_routines.h
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,8 @@ void ml_init_lock_timeout(void);

boolean_t ml_delay_should_spin(uint64_t interval);

void ml_delay_on_yield(void);

uint32_t ml_get_decrementer(void);

#if !CONFIG_SKIP_PRECISE_USER_KERNEL_TIME
Expand Down
9 changes: 9 additions & 0 deletions osfmk/arm64/machine_routines.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ uint32_t LockTimeOutUsec;
uint64_t MutexSpin;
boolean_t is_clock_configured = FALSE;

uint32_t yield_delay_us = 42; /* Less than cpu_idle_latency to ensure ml_delay_should_spin is true */

extern int mach_assert;
extern volatile uint32_t debug_enabled;

Expand Down Expand Up @@ -438,6 +440,8 @@ machine_startup(__unused boot_args * args)
default_bg_preemption_rate = boot_arg;
}

PE_parse_boot_argn("yield_delay_us", &yield_delay_us, sizeof (yield_delay_us));

machine_conf();

/*
Expand Down Expand Up @@ -1811,6 +1815,11 @@ ml_delay_should_spin(uint64_t interval)
}
}

void
ml_delay_on_yield(void)
{
}

boolean_t ml_thread_is64bit(thread_t thread) {
return (thread_is_64bit_addr(thread));
}
Expand Down
Loading

0 comments on commit cecb6e5

Please sign in to comment.