Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Oct 2014 13:38:05 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r273251 - in head/sys: arm/arm arm/include conf
Message-ID:  <201410181338.s9IDc5NE047022@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andrew
Date: Sat Oct 18 13:38:04 2014
New Revision: 273251
URL: https://svnweb.freebsd.org/changeset/base/273251

Log:
  Add an elf not so kgdb detects the kernel as a FreeBSD elf file. The
  ELFNOTE macro is based on one from the FreeBSD/ARM Xen tree [1].
  
  Obtained from:	Julien Grall <julien.grall AT linaro.org> [1]

Added:
  head/sys/arm/arm/elf_note.S   (contents, props changed)
Modified:
  head/sys/arm/include/asmacros.h
  head/sys/conf/files.arm

Added: head/sys/arm/arm/elf_note.S
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/arm/arm/elf_note.S	Sat Oct 18 13:38:04 2014	(r273251)
@@ -0,0 +1,36 @@
+/*-
+ * Copyright (c) 2014 Andrew Turner <andrew@FreeBSD.org>
+ * 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.
+ *
+ */
+
+#include <machine/asm.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <machine/asmacros.h>
+
+/* An ELF note so GDB detects this as a FreeBSD elf file */
+ELFNOTE(.note.tag, 1, "FreeBSD", .long, __FreeBSD_version);
+

Modified: head/sys/arm/include/asmacros.h
==============================================================================
--- head/sys/arm/include/asmacros.h	Sat Oct 18 12:28:51 2014	(r273250)
+++ head/sys/arm/include/asmacros.h	Sat Oct 18 13:38:04 2014	(r273251)
@@ -45,6 +45,18 @@
 	ldr	tmp, [tmp, #PC_CURTHREAD]
 #endif
 
+#define	ELFNOTE(section, type, vendor, desctype, descdata...)	  \
+	.pushsection section					; \
+	    .balign 4						; \
+	    .long 2f - 1f		/* namesz */		; \
+	    .long 4f - 3f		/* descsz */		; \
+	    .long type			/* type */		; \
+	    1: .asciz vendor		/* vendor name */	; \
+	    2: .balign 4					; \
+	    3:  desctype descdata	/* node */		; \
+	    4: .balign 4					; \
+	.popsection
+
 #endif /* LOCORE */
 
 #endif /* _KERNEL */

Modified: head/sys/conf/files.arm
==============================================================================
--- head/sys/conf/files.arm	Sat Oct 18 12:28:51 2014	(r273250)
+++ head/sys/conf/files.arm	Sat Oct 18 13:38:04 2014	(r273251)
@@ -18,6 +18,7 @@ arm/arm/devmap.c		standard
 arm/arm/disassem.c		optional	ddb
 arm/arm/dump_machdep.c		standard
 arm/arm/elf_machdep.c		standard
+arm/arm/elf_note.S		standard
 arm/arm/exception.S		standard
 arm/arm/fiq.c			standard
 arm/arm/fiq_subr.S		standard



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410181338.s9IDc5NE047022>