Date: Fri, 18 Jul 2014 08:20:31 GMT From: op@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r271058 - in soc2014/op/freebsd-base/sys: conf kern sys x86/include x86/x86 Message-ID: <201407180820.s6I8KVuQ031526@socsvn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: op Date: Fri Jul 18 08:20:31 2014 New Revision: 271058 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=271058 Log: KSP: create abstraction for MD parts git: https://github.com/opntr/opBSD/tree/op/gsoc2014/kpatch Signed-off-by: Oliver Pinter <oliver.pntr@gmail.com> --- sys/conf/files.amd64 | 1 + sys/kern/kern_selfpatch.c | 2 ++ sys/sys/selfpatch.h | 9 +++++++++ sys/x86/include/_selfpatch.h | 34 ++++++++++++++++++++++++++++++++++ sys/x86/x86/selfpatch_machdep.c | 40 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 86 insertions(+) create mode 100644 sys/x86/include/_selfpatch.h create mode 100644 sys/x86/x86/selfpatch_machdep.c Added: soc2014/op/freebsd-base/sys/x86/include/_selfpatch.h soc2014/op/freebsd-base/sys/x86/x86/selfpatch_machdep.c Modified: soc2014/op/freebsd-base/sys/conf/files.amd64 soc2014/op/freebsd-base/sys/kern/kern_selfpatch.c soc2014/op/freebsd-base/sys/sys/selfpatch.h Modified: soc2014/op/freebsd-base/sys/conf/files.amd64 ============================================================================== --- soc2014/op/freebsd-base/sys/conf/files.amd64 Fri Jul 18 07:52:35 2014 (r271057) +++ soc2014/op/freebsd-base/sys/conf/files.amd64 Fri Jul 18 08:20:31 2014 (r271058) @@ -554,6 +554,7 @@ x86/x86/nexus.c standard x86/x86/tsc.c standard x86/x86/delay.c standard +x86/x86/selfpatch.c standard x86/xen/hvm.c optional xenhvm x86/xen/xen_intr.c optional xen | xenhvm x86/xen/pv.c optional xenhvm Modified: soc2014/op/freebsd-base/sys/kern/kern_selfpatch.c ============================================================================== --- soc2014/op/freebsd-base/sys/kern/kern_selfpatch.c Fri Jul 18 07:52:35 2014 (r271057) +++ soc2014/op/freebsd-base/sys/kern/kern_selfpatch.c Fri Jul 18 08:20:31 2014 (r271058) @@ -37,3 +37,5 @@ #include <sys/linker_set.h> #include <sys/selfpatch.h> + + Modified: soc2014/op/freebsd-base/sys/sys/selfpatch.h ============================================================================== --- soc2014/op/freebsd-base/sys/sys/selfpatch.h Fri Jul 18 07:52:35 2014 (r271057) +++ soc2014/op/freebsd-base/sys/sys/selfpatch.h Fri Jul 18 08:20:31 2014 (r271058) @@ -26,6 +26,11 @@ * $FreeBSD$ */ +#ifndef __SELFPATH_H__ +#define __SELFPATH_H__ + +#include <machine/_selfpatch.h> + typedef struct lf_selfpatch { void *patchable; void *patch; @@ -33,3 +38,7 @@ int feature; char *comment; } lf_selfpatch_t; + +extern char *selfpatch_nop_table[]; + +#endif /* __SELFPATH_H__ */ Added: soc2014/op/freebsd-base/sys/x86/include/_selfpatch.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2014/op/freebsd-base/sys/x86/include/_selfpatch.h Fri Jul 18 08:20:31 2014 (r271058) @@ -0,0 +1,34 @@ +/*- + * Copyright (c) 2014, by Oliver Pinter <oliver.pntr at gmail.com> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __X86_SELFPATH_H__ +#define __X86_SELFPATH_H__ + +extern char *md_selfpatch_nop_table[]; + +#endif /* __X86_SELFPATH_H__ */ Added: soc2014/op/freebsd-base/sys/x86/x86/selfpatch_machdep.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2014/op/freebsd-base/sys/x86/x86/selfpatch_machdep.c Fri Jul 18 08:20:31 2014 (r271058) @@ -0,0 +1,40 @@ +/*- + * Copyright (c) 2014, by Oliver Pinter <oliver.pntr at gmail.com> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include <sys/cdefs.h> + +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/types.h> +#include <sys/kernel.h> + +#include <sys/linker.h> +#include <sys/linker_set.h> + +#include <sys/selfpatch.h> +
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201407180820.s6I8KVuQ031526>