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]
This commit is contained in:
Andrew Turner 2014-10-18 13:38:04 +00:00
parent 5817298f31
commit 5c8f95d56d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=273251
3 changed files with 49 additions and 0 deletions

36
sys/arm/arm/elf_note.S Normal file
View File

@ -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);

View File

@ -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 */

View File

@ -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