Skip to content

Commit

Permalink
xnu-1699.22.81
Browse files Browse the repository at this point in the history
  • Loading branch information
Darwin authored and das committed Jun 4, 2017
1 parent 6ea1e3d commit 31b714e
Show file tree
Hide file tree
Showing 8 changed files with 119 additions and 9 deletions.
2 changes: 1 addition & 1 deletion bsd/crypto/aes/i386/aes_modes_hw.s
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion bsd/crypto/aes/test/tstaes.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
88 changes: 84 additions & 4 deletions bsd/hfs/hfs_vnops.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -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);
}
}

/*
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion config/MasterVersion
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
22 changes: 21 additions & 1 deletion iokit/Kernel/IOPMrootDomain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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)
Expand Down
9 changes: 9 additions & 0 deletions iokit/Kernel/IOServicePM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
{
Expand Down
1 change: 1 addition & 0 deletions iokit/Kernel/IOServicePMPrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion osfmk/i386/AT386/model_dep.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 31b714e

Please sign in to comment.