Skip to content
This repository has been archived by the owner on May 22, 2023. It is now read-only.

Commit

Permalink
xnu-4570.51.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Darwin authored and das committed Dec 10, 2018
1 parent b2785e9 commit 5bbb823
Show file tree
Hide file tree
Showing 571 changed files with 14,678 additions and 35,280 deletions.
12 changes: 11 additions & 1 deletion Makefile
Expand Up @@ -238,7 +238,7 @@ endif # CURRENT_BUILD_CONFIG


endif # all other RC_ProjectName endif # all other RC_ProjectName


installhdrs_libkdd install_libkdd: installapi_libkdd installhdrs_libkdd install_libkdd:
cd libkdd; \ cd libkdd; \
xcodebuild -target libkdd $(subst _libkdd,,$@) \ xcodebuild -target libkdd $(subst _libkdd,,$@) \
"SRCROOT=$(SRCROOT)/libkdd" \ "SRCROOT=$(SRCROOT)/libkdd" \
Expand All @@ -248,6 +248,16 @@ installhdrs_libkdd install_libkdd:
"SDKROOT=$(SDKROOT)" "SDKROOT=$(SDKROOT)"




installapi_libkdd_host installhdrs_libkdd_host install_libkdd_host:
cd libkdd; \
xcodebuild -target kdd.framework $(subst _libkdd_host,,$@) \
"SRCROOT=$(SRCROOT)/libkdd" \
"OBJROOT=$(OBJROOT)" \
"SYMROOT=$(SYMROOT)" \
"DSTROOT=$(DSTROOT)" \
"SDKROOT=$(SDKROOT)"


# "xnu_tests" and "testbots" are targets that can be invoked via a standalone # "xnu_tests" and "testbots" are targets that can be invoked via a standalone
# "make xnu_tests" or via buildit/XBS with the RC_ProjectName=xnu_tests. # "make xnu_tests" or via buildit/XBS with the RC_ProjectName=xnu_tests.
# Define the target here in the outermost scope of the initial Makefile # Define the target here in the outermost scope of the initial Makefile
Expand Down
10 changes: 5 additions & 5 deletions README.md
@@ -1,9 +1,9 @@
What is XNU? What is XNU?
=========== ===========


XNU kernel is part of the Darwin operating system for use in OS X and iOS operating systems. XNU is an acronym for XNU is Not Unix. XNU kernel is part of the Darwin operating system for use in macOS and iOS operating systems. XNU is an acronym for X is Not Unix.
XNU is a hybrid kernel combining the Mach kernel developed at Carnegie Mellon University with components from FreeBSD and C++ API for writing drivers called IOKit. XNU is a hybrid kernel combining the Mach kernel developed at Carnegie Mellon University with components from FreeBSD and C++ API for writing drivers called IOKit.
XNU runs on I386, X86_64 for both single processor and multi-processor configurations. XNU runs on x86_64 for both single processor and multi-processor configurations.


XNU Source Tree XNU Source Tree
=============== ===============
Expand Down Expand Up @@ -35,9 +35,9 @@ Here is the syntax:


Where: Where:


* \<sdkroot>: path to MacOS SDK on disk. (defaults to `/`) * \<sdkroot>: path to macOS SDK on disk. (defaults to `/`)
* \<variant>: can be `debug`, `development`, `release`, `profile` and configures compilation flags and asserts throughout kernel code. * \<variant>: can be `debug`, `development`, `release`, `profile` and configures compilation flags and asserts throughout kernel code.
* \<arch> : can be valid arch to build for. (E.g. `i386` or `X86_64`) * \<arch> : can be valid arch to build for. (E.g. `X86_64`)


To build a kernel for the same architecture as running OS, just type To build a kernel for the same architecture as running OS, just type


Expand Down Expand Up @@ -69,7 +69,7 @@ Building FAT kernel binary


Define architectures in your environment or when running a make command. Define architectures in your environment or when running a make command.


$ make ARCH_CONFIGS="I386 X86_64" exporthdrs all $ make ARCH_CONFIGS="X86_64" exporthdrs all


Other makefile options Other makefile options
---------------------- ----------------------
Expand Down
1 change: 0 additions & 1 deletion bsd/bsm/audit_kevents.h
Expand Up @@ -700,7 +700,6 @@
#define AUE_BSDTHREADCREATE AUE_NULL #define AUE_BSDTHREADCREATE AUE_NULL
#define AUE_BSDTHREADTERMINATE AUE_NULL #define AUE_BSDTHREADTERMINATE AUE_NULL
#define AUE_BSDTHREADREGISTER AUE_NULL #define AUE_BSDTHREADREGISTER AUE_NULL
#define AUE_CHUD AUE_NULL
#define AUE_CSOPS AUE_NULL #define AUE_CSOPS AUE_NULL
#define AUE_DUP AUE_NULL #define AUE_DUP AUE_NULL
#define AUE_FDATASYNC AUE_NULL #define AUE_FDATASYNC AUE_NULL
Expand Down
3 changes: 1 addition & 2 deletions bsd/conf/files
Expand Up @@ -217,6 +217,7 @@ bsd/net/ntstat.c optional networking
bsd/net/net_perf.c optional networking bsd/net/net_perf.c optional networking
bsd/net/if_gif.c optional gif bsd/net/if_gif.c optional gif
bsd/net/if_stf.c optional stf bsd/net/if_stf.c optional stf
bsd/net/if_ports_used.c optional networking
bsd/net/kpi_interface.c optional networking bsd/net/kpi_interface.c optional networking
bsd/net/kpi_protocol.c optional networking bsd/net/kpi_protocol.c optional networking
bsd/net/kpi_interfacefilter.c optional networking bsd/net/kpi_interfacefilter.c optional networking
Expand Down Expand Up @@ -488,8 +489,6 @@ bsd/uxkern/ux_exception.c standard
bsd/conf/param.c standard bsd/conf/param.c standard
./ioconf.c standard ./ioconf.c standard


bsd/dev/chud/chud_process.c standard

bsd/kern/imageboot.c optional config_imageboot bsd/kern/imageboot.c optional config_imageboot


osfmk/kperf/kperfbsd.c optional kperf osfmk/kperf/kperfbsd.c optional kperf
Expand Down
29 changes: 23 additions & 6 deletions bsd/dev/arm/cpu_in_cksum.s
@@ -1,12 +1,29 @@
/* /*
* Copyright (c) 2009-2017 Apple Inc. All rights reserved. * Copyright (c) 2009-2018 Apple Inc. All rights reserved.
* *
* This document is the property of Apple Inc. * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
* It is considered confidential and proprietary.
* *
* This document may not be reproduced or transmitted in any form, * This file contains Original Code and/or Modifications of Original Code
* in whole or in part, without the express written permission of * as defined in and that are subject to the Apple Public Source License
* Apple Inc. * Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/ */


/* $NetBSD: cpu_in_cksum.S,v 1.2 2008/01/27 16:58:05 chris Exp $ */ /* $NetBSD: cpu_in_cksum.S,v 1.2 2008/01/27 16:58:05 chris Exp $ */
Expand Down
29 changes: 23 additions & 6 deletions bsd/dev/arm64/cpu_in_cksum.s
@@ -1,12 +1,29 @@
/* /*
* Copyright (c) 2012-2017 Apple Inc. All rights reserved. * Copyright (c) 2012-2018 Apple Inc. All rights reserved.
* *
* This document is the property of Apple Inc. * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
* It is considered confidential and proprietary.
* *
* This document may not be reproduced or transmitted in any form, * This file contains Original Code and/or Modifications of Original Code
* in whole or in part, without the express written permission of * as defined in and that are subject to the Apple Public Source License
* Apple Inc. * Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/ */


/* /*
Expand Down
36 changes: 0 additions & 36 deletions bsd/dev/chud/chud_process.c

This file was deleted.

62 changes: 34 additions & 28 deletions bsd/dev/dtrace/dtrace.c
Expand Up @@ -105,6 +105,8 @@
#include <machine/monotonic.h> #include <machine/monotonic.h>
#endif /* MONOTONIC */ #endif /* MONOTONIC */


#include <IOKit/IOPlatformExpert.h>

#include <kern/cpu_data.h> #include <kern/cpu_data.h>
extern uint32_t pmap_find_phys(void *, uint64_t); extern uint32_t pmap_find_phys(void *, uint64_t);
extern boolean_t pmap_valid_page(uint32_t); extern boolean_t pmap_valid_page(uint32_t);
Expand Down Expand Up @@ -12155,57 +12157,61 @@ dtrace_dof_copyin_from_proc(proc_t* p, user_addr_t uarg, int *errp)
return (dof); return (dof);
} }


static void
dtrace_dof_destroy(dof_hdr_t *dof)
{
dt_kmem_free_aligned(dof, dof->dofh_loadsz);
}

static dof_hdr_t * static dof_hdr_t *
dtrace_dof_property(const char *name) dtrace_dof_property(const char *name)
{ {
uchar_t *buf; unsigned int len;
uint64_t loadsz;
unsigned int len, i;
dof_hdr_t *dof; dof_hdr_t *dof;


/* if (dtrace_is_restricted() && !dtrace_are_restrictions_relaxed()) {
* Unfortunately, array of values in .conf files are always (and return NULL;
* only) interpreted to be integer arrays. We must read our DOF }
* as an integer array, and then squeeze it into a byte array.
*/
if (ddi_prop_lookup_int_array(DDI_DEV_T_ANY, dtrace_devi, 0,
name, (int **)&buf, &len) != DDI_PROP_SUCCESS)
return (NULL);


for (i = 0; i < len; i++) if (!PEReadNVRAMProperty(name, NULL, &len)) {
buf[i] = (uchar_t)(((int *)buf)[i]); return NULL;
}

dof = dt_kmem_alloc_aligned(len, 8, KM_SLEEP);

if (!PEReadNVRAMProperty(name, dof, &len)) {
dtrace_dof_destroy(dof);
dtrace_dof_error(NULL, "unreadable DOF");
return NULL;
}


if (len < sizeof (dof_hdr_t)) { if (len < sizeof (dof_hdr_t)) {
ddi_prop_free(buf); dtrace_dof_destroy(dof);
dtrace_dof_error(NULL, "truncated header"); dtrace_dof_error(NULL, "truncated header");
return (NULL); return (NULL);
} }


if (len < (loadsz = ((dof_hdr_t *)buf)->dofh_loadsz)) { if (len < dof->dofh_loadsz) {
ddi_prop_free(buf); dtrace_dof_destroy(dof);
dtrace_dof_error(NULL, "truncated DOF"); dtrace_dof_error(NULL, "truncated DOF");
return (NULL); return (NULL);
} }


if (loadsz >= (uint64_t)dtrace_dof_maxsize) { if (len != dof->dofh_loadsz) {
ddi_prop_free(buf); dtrace_dof_destroy(dof);
dtrace_dof_error(NULL, "oversized DOF"); dtrace_dof_error(NULL, "invalid DOF size");
return (NULL); return (NULL);
} }


dof = dt_kmem_alloc_aligned(loadsz, 8, KM_SLEEP); if (dof->dofh_loadsz >= (uint64_t)dtrace_dof_maxsize) {
bcopy(buf, dof, loadsz); dtrace_dof_destroy(dof);
ddi_prop_free(buf); dtrace_dof_error(NULL, "oversized DOF");
return (NULL);
}


return (dof); return (dof);
} }


static void
dtrace_dof_destroy(dof_hdr_t *dof)
{
dt_kmem_free_aligned(dof, dof->dofh_loadsz);
}

/* /*
* Return the dof_sec_t pointer corresponding to a given section index. If the * Return the dof_sec_t pointer corresponding to a given section index. If the
* index is not valid, dtrace_dof_error() is called and NULL is returned. If * index is not valid, dtrace_dof_error() is called and NULL is returned. If
Expand Down
54 changes: 2 additions & 52 deletions bsd/dev/dtrace/dtrace_glue.c
Expand Up @@ -586,63 +586,13 @@ ddi_report_dev(dev_info_t *devi)
#pragma unused(devi) #pragma unused(devi)
} }



static unsigned int gRegisteredProps = 0;
static struct {
char name[32]; /* enough for "dof-data-" + digits */
int *data;
uint_t nelements;
} gPropTable[16];

kern_return_t _dtrace_register_anon_DOF(char *, uchar_t *, uint_t); kern_return_t _dtrace_register_anon_DOF(char *, uchar_t *, uint_t);


kern_return_t kern_return_t
_dtrace_register_anon_DOF(char *name, uchar_t *data, uint_t nelements) _dtrace_register_anon_DOF(char *name, uchar_t *data, uint_t nelements)
{ {
if (gRegisteredProps < sizeof(gPropTable)/sizeof(gPropTable[0])) { #pragma unused(name, data, nelements)
int *p = (int *)_MALLOC(nelements*sizeof(int), M_TEMP, M_WAITOK); return KERN_FAILURE;

if (NULL == p)
return KERN_FAILURE;

strlcpy(gPropTable[gRegisteredProps].name, name, sizeof(gPropTable[0].name));
gPropTable[gRegisteredProps].nelements = nelements;
gPropTable[gRegisteredProps].data = p;

while (nelements-- > 0) {
*p++ = (int)(*data++);
}

gRegisteredProps++;
return KERN_SUCCESS;
}
else
return KERN_FAILURE;
}

int
ddi_prop_lookup_int_array(dev_t match_dev, dev_info_t *dip, uint_t flags,
const char *name, int **data, uint_t *nelements)
{
#pragma unused(match_dev,dip,flags)
unsigned int i;
for (i = 0; i < gRegisteredProps; ++i)
{
if (0 == strncmp(name, gPropTable[i].name,
sizeof(gPropTable[i].name))) {
*data = gPropTable[i].data;
*nelements = gPropTable[i].nelements;
return DDI_SUCCESS;
}
}
return DDI_FAILURE;
}

int
ddi_prop_free(void *buf)
{
_FREE(buf, M_TEMP);
return DDI_SUCCESS;
} }


int int
Expand Down

0 comments on commit 5bbb823

Please sign in to comment.