From: Apple Date: Fri, 19 Aug 2011 15:06:14 +0000 (+0000) Subject: xnu-1699.22.81.tar.gz X-Git-Tag: mac-os-x-1071^0 X-Git-Url: https://git.saurik.com/apple/xnu.git/commitdiff_plain/7ee9d059c4eecf68ae4f8b0fb99ae2471eda79af xnu-1699.22.81.tar.gz --- diff --git a/bsd/crypto/aes/i386/aes_modes_hw.s b/bsd/crypto/aes/i386/aes_modes_hw.s index 401fd3dd9..574ee3c72 100644 --- a/bsd/crypto/aes/i386/aes_modes_hw.s +++ b/bsd/crypto/aes/i386/aes_modes_hw.s @@ -74,7 +74,7 @@ The idea was actually described in the Intel AES Instruction Set White Paper (Rev. 2.0 page 53-55) This modification interleaves the aesdec/aesdeclast instructions for 4 blocks in cbc mode. - On a K18 (2.4GHz core-i5/2.66GHz core-i7), the x86_64 decrypt throughput (in xnu-iokit) has been improved + On a 2.4GHz core-i5/2.66GHz core-i7, the x86_64 decrypt throughput (in xnu-iokit) has been improved from 1180/1332 to 1667/1858 MBytes/sec. This is approximately 1.40 times speedup in the decryption. The encrypt throughput is not changed. diff --git a/bsd/crypto/aes/test/tstaes.c b/bsd/crypto/aes/test/tstaes.c index cbe364ed7..9d186ee77 100644 --- a/bsd/crypto/aes/test/tstaes.c +++ b/bsd/crypto/aes/test/tstaes.c @@ -46,7 +46,7 @@ uint32_t data_size; cpu_freq = getFreq(); if (cpu_freq == 0) { - fprintf(stderr, "this appears to be an N90 device, where cpu_freq can not be detected. set to 800MHz.\n"); + fprintf(stderr, "this appears to be an iPhone device, where cpu_freq can not be detected. set to 800MHz.\n"); cpu_freq = 800000000; } else { fprintf(stderr, "device max CPU clock rate = %.2f MHz\n", cpu_freq/1.e6); diff --git a/bsd/hfs/hfs_vnops.c b/bsd/hfs/hfs_vnops.c index 4c526f77b..03c113475 100644 --- a/bsd/hfs/hfs_vnops.c +++ b/bsd/hfs/hfs_vnops.c @@ -3416,6 +3416,8 @@ hfs_vnop_rename(ap) int lockflags; int error; time_t orig_from_ctime, orig_to_ctime; + int emit_rename = 1; + int emit_delete = 1; orig_from_ctime = VTOC(fvp)->c_ctime; if (tvp && VTOC(tvp)) { @@ -3424,10 +3426,55 @@ hfs_vnop_rename(ap) orig_to_ctime = ~0; } - check_for_tracked_file(fvp, orig_from_ctime, NAMESPACE_HANDLER_RENAME_OP, NULL); + hfsmp = VTOHFS(tdvp); + /* + * Do special case checks here. If fvp == tvp then we need to check the + * cnode with locks held. + */ + if (fvp == tvp) { + int is_hardlink = 0; + /* + * In this case, we do *NOT* ever emit a DELETE event. + * We may not necessarily emit a RENAME event + */ + emit_delete = 0; + if ((error = hfs_lock(VTOC(fvp), HFS_SHARED_LOCK))) { + return error; + } + /* Check to see if the item is a hardlink or not */ + is_hardlink = (VTOC(fvp)->c_flag & C_HARDLINK); + hfs_unlock (VTOC(fvp)); + + /* + * If the item is not a hardlink, then case sensitivity must be off, otherwise + * two names should not resolve to the same cnode unless they were case variants. + */ + if (is_hardlink) { + emit_rename = 0; + /* + * Hardlinks are a little trickier. We only want to emit a rename event + * if the item is a hardlink, the parent directories are the same, case sensitivity + * is off, and the case folded names are the same. See the fvp == tvp case below for more + * info. + */ + + if ((fdvp == tdvp) && ((hfsmp->hfs_flags & HFS_CASE_SENSITIVE) == 0)) { + if (hfs_namecmp((const u_int8_t *)fcnp->cn_nameptr, fcnp->cn_namelen, + (const u_int8_t *)tcnp->cn_nameptr, tcnp->cn_namelen) == 0) { + /* Then in this case only it is ok to emit a rename */ + emit_rename = 1; + } + } + } + } + if (emit_rename) { + check_for_tracked_file(fvp, orig_from_ctime, NAMESPACE_HANDLER_RENAME_OP, NULL); + } if (tvp && VTOC(tvp)) { - check_for_tracked_file(tvp, orig_to_ctime, NAMESPACE_HANDLER_DELETE_OP, NULL); + if (emit_delete) { + check_for_tracked_file(tvp, orig_to_ctime, NAMESPACE_HANDLER_DELETE_OP, NULL); + } } /* @@ -3533,7 +3580,6 @@ hfs_vnop_rename(ap) fcp = VTOC(fvp); tdcp = VTOC(tdvp); tcp = tvp ? VTOC(tvp) : NULL; - hfsmp = VTOHFS(tdvp); /* Ensure we didn't race src or dst parent directories with rmdir. */ if (fdcp->c_flag & (C_NOEXISTS | C_DELETED)) { @@ -3799,14 +3845,48 @@ hfs_vnop_rename(ap) */ if (fvp == tvp) { if (!(fcp->c_flag & C_HARDLINK)) { + /* + * If they're not hardlinks, then fvp == tvp must mean we + * are using case-insensitive HFS because case-sensitive would + * not use the same vnode for both. In this case we just update + * the catalog for: a -> A + */ goto skip_rm; /* simple case variant */ - } else if ((fdvp != tdvp) || + } + /* For all cases below, we must be using hardlinks */ + else if ((fdvp != tdvp) || (hfsmp->hfs_flags & HFS_CASE_SENSITIVE)) { + /* + * If the parent directories are not the same, AND the two items + * are hardlinks, posix says to do nothing: + * dir1/fred <-> dir2/bob and the op was mv dir1/fred -> dir2/bob + * We just return 0 in this case. + * + * If case sensitivity is on, and we are using hardlinks + * then renaming is supposed to do nothing. + * dir1/fred <-> dir2/FRED, and op == mv dir1/fred -> dir2/FRED + */ goto out; /* matching hardlinks, nothing to do */ } else if (hfs_namecmp((const u_int8_t *)fcnp->cn_nameptr, fcnp->cn_namelen, (const u_int8_t *)tcnp->cn_nameptr, tcnp->cn_namelen) == 0) { + /* + * If we get here, then the following must be true: + * a) We are running case-insensitive HFS+. + * b) Both paths 'fvp' and 'tvp' are in the same parent directory. + * c) the two names are case-variants of each other. + * + * In this case, we are really only dealing with a single catalog record + * whose name is being updated. + * + * op is dir1/fred -> dir1/FRED + * + * We need to special case the name matching, because if + * dir1/fred <-> dir1/bob were the two links, and the + * op was dir1/fred -> dir1/bob + * That would fail/do nothing. + */ goto skip_rm; /* case-variant hardlink in the same dir */ } else { goto out; /* matching hardlink, nothing to do */ diff --git a/config/MasterVersion b/config/MasterVersion index 8f5b9dd34..20db06b5d 100644 --- a/config/MasterVersion +++ b/config/MasterVersion @@ -1,4 +1,4 @@ -11.0.0 +11.1.0 # The first line of this file contains the master version number for the kernel. # All other instances of the kernel version in xnu are derived from this file. diff --git a/iokit/Kernel/IOPMrootDomain.cpp b/iokit/Kernel/IOPMrootDomain.cpp index e6146bb24..81c6478e1 100644 --- a/iokit/Kernel/IOPMrootDomain.cpp +++ b/iokit/Kernel/IOPMrootDomain.cpp @@ -268,6 +268,7 @@ static UInt32 gPagingOff = 0; static UInt32 gSleepWakeUUIDIsSet = false; static uint32_t gAggressivesState = 0; static uint32_t gDarkWakeFlags = kDarkWakeFlagHIDTickleNone; +static bool gRAMDiskImageBoot = false; struct timeval gIOLastSleepTime; struct timeval gIOLastWakeTime; @@ -845,6 +846,17 @@ bool IOPMrootDomain::start( IOService * nub ) }; PE_parse_boot_argn("darkwake", &gDarkWakeFlags, sizeof(gDarkWakeFlags)); + + IORegistryEntry * chosenEntry = IORegistryEntry::fromPath("/chosen", gIODTPlane); + if (chosenEntry) + { + if (chosenEntry->getProperty("boot-ramdmg-size") && + chosenEntry->getProperty("boot-ramdmg-extents")) + { + gRAMDiskImageBoot = true; + } + chosenEntry->release(); + } queue_init(&aggressivesQueue); aggressivesThreadCall = thread_call_allocate(handleAggressivesFunction, this); @@ -4360,6 +4372,13 @@ void IOPMrootDomain::overridePowerChangeForUIService( } } + if (gRAMDiskImageBoot && + (actions->parameter & kPMActionsFlagIsDisplayWrangler)) + { + // Tag devices subject to power suppression. + *inOutChangeFlags |= kIOPMPowerSuppressed; + } + if (actions->parameter & kPMActionsFlagLimitPower) { uint32_t maxPowerState = (uint32_t)(-1); @@ -4369,7 +4388,8 @@ void IOPMrootDomain::overridePowerChangeForUIService( // Enforce limit for system power/cap transitions. maxPowerState = 0; - if (actions->parameter & kPMActionsFlagIsDisplayWrangler) + if ((actions->parameter & kPMActionsFlagIsDisplayWrangler) && + (!gRAMDiskImageBoot || (service->getPowerState() > 0))) { // Forces a 3->1 transition sequence if (changeFlags & kIOPMDomainWillChange) diff --git a/iokit/Kernel/IOServicePM.cpp b/iokit/Kernel/IOServicePM.cpp index bd7bcd002..11efcab25 100644 --- a/iokit/Kernel/IOServicePM.cpp +++ b/iokit/Kernel/IOServicePM.cpp @@ -4019,6 +4019,15 @@ void IOService::all_done ( void ) ((fHeadNoteChangeFlags & kIOPMDomainDidChange) && (fCurrentPowerState < fHeadNotePowerState))) { + if ((fHeadNoteChangeFlags & kIOPMPowerSuppressed) && + (fHeadNotePowerState != fCurrentPowerState) && + (fHeadNotePowerState == fDesiredPowerState)) + { + // Power changed, and desired power state restored. + // Clear any prior power desire while in suppressed state. + requestDomainPower(fHeadNotePowerState); + } + // did power raise? if ( fCurrentPowerState < fHeadNotePowerState ) { diff --git a/iokit/Kernel/IOServicePMPrivate.h b/iokit/Kernel/IOServicePMPrivate.h index 96e5bfacc..00f53cdfe 100644 --- a/iokit/Kernel/IOServicePMPrivate.h +++ b/iokit/Kernel/IOServicePMPrivate.h @@ -442,6 +442,7 @@ the ack timer is ticking every tenth of a second. #define kIOPMSyncNoChildNotify 0x0200 // sync root domain only, not entire tree #define kIOPMSyncTellPowerDown 0x0400 // send the ask/will power off messages #define kIOPMSyncCancelPowerDown 0x0800 // sleep cancel for maintenance wake +#define kIOPMPowerSuppressed 0x1000 // power suppressed for dark wake enum { kDriverCallInformPreChange, diff --git a/osfmk/i386/AT386/model_dep.c b/osfmk/i386/AT386/model_dep.c index c21012552..b020ed419 100644 --- a/osfmk/i386/AT386/model_dep.c +++ b/osfmk/i386/AT386/model_dep.c @@ -968,7 +968,7 @@ panic_print_macho_symbol_name(kernel_mach_header_t *mh, vm_address_t search, con orig_le = orig_sg; else if (strncmp("", orig_sg->segname, sizeof(orig_sg->segname)) == 0) - orig_ts = orig_sg; /* pre-Barolo i386 kexts have a single unnamed segment */ + orig_ts = orig_sg; /* pre-Lion i386 kexts have a single unnamed segment */ } else if (cmd->cmd == LC_SYMTAB) orig_st = (struct symtab_command *) cmd;