Module Name: src
Committed By: tls
Date: Sun Aug 10 06:56:02 UTC 2014
Modified Files:
src/sys/lib/libkern [tls-earlyentropy]: Makefile.libkern libkern.h
src/sys/lib/libsa [tls-earlyentropy]: Makefile
src/sys/lib/libunwind [tls-earlyentropy]: AddressSpace.hpp
DwarfInstructions.hpp DwarfParser.hpp Makefile.inc Registers.hpp
UnwindCursor.hpp libunwind.cxx unwind_registers.S
src/sys/lib/libz [tls-earlyentropy]: Makefile
Added Files:
src/sys/lib/libgnuefi [tls-earlyentropy]: Makefile Makefile.inc
src/sys/lib/libsa [tls-earlyentropy]: bootcfg.c bootcfg.h
Log Message:
Rebase.
To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1.6.2 src/sys/lib/libgnuefi/Makefile \
src/sys/lib/libgnuefi/Makefile.inc
cvs rdiff -u -r1.32.2.3 -r1.32.2.4 src/sys/lib/libkern/Makefile.libkern
cvs rdiff -u -r1.113.2.2 -r1.113.2.3 src/sys/lib/libkern/libkern.h
cvs rdiff -u -r1.81 -r1.81.2.1 src/sys/lib/libsa/Makefile
cvs rdiff -u -r0 -r1.1.2.2 src/sys/lib/libsa/bootcfg.c \
src/sys/lib/libsa/bootcfg.h
cvs rdiff -u -r1.4 -r1.4.2.1 src/sys/lib/libunwind/AddressSpace.hpp
cvs rdiff -u -r1.3 -r1.3.2.1 src/sys/lib/libunwind/DwarfInstructions.hpp
cvs rdiff -u -r1.2 -r1.2.2.1 src/sys/lib/libunwind/DwarfParser.hpp \
src/sys/lib/libunwind/UnwindCursor.hpp
cvs rdiff -u -r1.5 -r1.5.2.1 src/sys/lib/libunwind/Makefile.inc
cvs rdiff -u -r1.8 -r1.8.2.1 src/sys/lib/libunwind/Registers.hpp \
src/sys/lib/libunwind/unwind_registers.S
cvs rdiff -u -r1.7 -r1.7.2.1 src/sys/lib/libunwind/libunwind.cxx
cvs rdiff -u -r1.18 -r1.18.26.1 src/sys/lib/libz/Makefile
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/lib/libkern/Makefile.libkern
diff -u src/sys/lib/libkern/Makefile.libkern:1.32.2.3 src/sys/lib/libkern/Makefile.libkern:1.32.2.4
--- src/sys/lib/libkern/Makefile.libkern:1.32.2.3 Sat Aug 9 07:45:03 2014
+++ src/sys/lib/libkern/Makefile.libkern Sun Aug 10 06:56:02 2014
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.libkern,v 1.32.2.3 2014/08/09 07:45:03 tls Exp $
+# $NetBSD: Makefile.libkern,v 1.32.2.4 2014/08/10 06:56:02 tls Exp $
#
# Variable definitions for libkern.
@@ -44,7 +44,7 @@ CPPFLAGS+= -I${KERNDIR}/../../../common/
.endif
.if !defined(RUMPKERNEL)
-.include ".${PARSEDIR}/Makefile.compiler-rt"
+.include "${.PARSEDIR}/Makefile.compiler-rt"
.endif
# Other stuff
@@ -79,8 +79,8 @@ SRCS+= random.c
SRCS+= rngtest.c
SRCS+= memchr.c
-SRCS+= strcat.c strcmp.c strcpy.c strlen.c strnlen.c
-SRCS+= strncat.c strncmp.c strncpy.c
+SRCS+= strcat.c strcmp.c strcpy.c strcspn.c strlen.c strnlen.c
+SRCS+= strncat.c strncmp.c strncpy.c strpbrk.c strspn.c
SRCS+= strcasecmp.c strncasecmp.c
SRCS+= xlat_mbr_fstype.c
Index: src/sys/lib/libkern/libkern.h
diff -u src/sys/lib/libkern/libkern.h:1.113.2.2 src/sys/lib/libkern/libkern.h:1.113.2.3
--- src/sys/lib/libkern/libkern.h:1.113.2.2 Sat Aug 9 07:45:03 2014
+++ src/sys/lib/libkern/libkern.h Sun Aug 10 06:56:02 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: libkern.h,v 1.113.2.2 2014/08/09 07:45:03 tls Exp $ */
+/* $NetBSD: libkern.h,v 1.113.2.3 2014/08/10 06:56:02 tls Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -61,8 +61,13 @@ LIBKERN_INLINE int isascii(int) __unused
LIBKERN_INLINE int isupper(int) __unused;
LIBKERN_INLINE int islower(int) __unused;
LIBKERN_INLINE int isalpha(int) __unused;
+LIBKERN_INLINE int isalnum(int) __unused;
LIBKERN_INLINE int isdigit(int) __unused;
LIBKERN_INLINE int isxdigit(int) __unused;
+LIBKERN_INLINE int iscntrl(int) __unused;
+LIBKERN_INLINE int isgraph(int) __unused;
+LIBKERN_INLINE int isprint(int) __unused;
+LIBKERN_INLINE int ispunct(int) __unused;
LIBKERN_INLINE int toupper(int) __unused;
LIBKERN_INLINE int tolower(int) __unused;
@@ -163,6 +168,12 @@ isalpha(int ch)
}
LIBKERN_INLINE int
+isalnum(int ch)
+{
+ return (isalpha(ch) || isdigit(ch));
+}
+
+LIBKERN_INLINE int
isdigit(int ch)
{
return (ch >= '0' && ch <= '9');
@@ -177,6 +188,30 @@ isxdigit(int ch)
}
LIBKERN_INLINE int
+iscntrl(int ch)
+{
+ return ((ch >= 0x00 && ch <= 0x1F) || ch == 0x7F);
+}
+
+LIBKERN_INLINE int
+isgraph(int ch)
+{
+ return (ch != ' ' && isprint(ch));
+}
+
+LIBKERN_INLINE int
+isprint(int ch)
+{
+ return (ch >= 0x20 && ch <= 0x7E);
+}
+
+LIBKERN_INLINE int
+ispunct(int ch)
+{
+ return (isprint(ch) && ch != ' ' && !isalnum(ch));
+}
+
+LIBKERN_INLINE int
toupper(int ch)
{
if (islower(ch))
@@ -312,13 +347,15 @@ char *strsep(char **, const char *);
/* These exist in GCC 3.x, but we don't bother. */
char *strcat(char *, const char *);
+size_t strcspn(const char *, const char *);
char *strncpy(char *, const char *, size_t);
char *strncat(char *, const char *, size_t);
int strncmp(const char *, const char *, size_t);
char *strchr(const char *, int);
char *strrchr(const char *, int);
-
char *strstr(const char *, const char *);
+char *strpbrk(const char *, const char *);
+size_t strspn(const char *, const char *);
/*
* ffs is an instruction on vax.
Index: src/sys/lib/libsa/Makefile
diff -u src/sys/lib/libsa/Makefile:1.81 src/sys/lib/libsa/Makefile:1.81.2.1
--- src/sys/lib/libsa/Makefile:1.81 Wed Mar 26 18:02:24 2014
+++ src/sys/lib/libsa/Makefile Sun Aug 10 06:56:02 2014
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.81 2014/03/26 18:02:24 christos Exp $
+# $NetBSD: Makefile,v 1.81.2.1 2014/08/10 06:56:02 tls Exp $
LIB= sa
LIBISPRIVATE?= yes
@@ -28,6 +28,8 @@ SRCS+= alloc.c errno.c exit.c files.c \
panic.c printf.c qsort.c snprintf.c strerror.c \
subr_prf.c twiddle.c checkpasswd.c
+SRCS+= bootcfg.c
+
# string routines
.if ${MACHINE_ARCH} != "i386" && ${MACHINE_ARCH} != "x86_64"
SRCS+= memcmp.c memcpy.c memmove.c memset.c strchr.c
@@ -84,6 +86,6 @@ lib${LIB}.o:: ${OBJS}
CPPFLAGS+= -Wno-pointer-sign
-.if defined(HAVE_GCC) && ${HAVE_GCC} >= 45 && ${MACHINE_ARCH} == "vax"
+.if defined(HAVE_GCC) && ${MACHINE_ARCH} == "vax"
COPTS.bootp.c+= -O0
.endif
Index: src/sys/lib/libunwind/AddressSpace.hpp
diff -u src/sys/lib/libunwind/AddressSpace.hpp:1.4 src/sys/lib/libunwind/AddressSpace.hpp:1.4.2.1
--- src/sys/lib/libunwind/AddressSpace.hpp:1.4 Wed Apr 2 22:22:37 2014
+++ src/sys/lib/libunwind/AddressSpace.hpp Sun Aug 10 06:56:02 2014
@@ -41,7 +41,6 @@ struct unw_proc_info_t {
uintptr_t lsda; // Address of Language Specific Data Area
uintptr_t handler; // Personality routine
uintptr_t extra_args; // Extra stack space for frameless routines
- uint32_t unwind_info_size; // Size of DWARF unwind info
uintptr_t unwind_info; // Address of DWARF unwind info
};
@@ -295,7 +294,7 @@ public:
n->last_pc = pcEnd;
n->data_base = 0;
n->ehframe_base = 0;
- if (rb_tree_insert_node(&segmentTree, n) == n) {
+ if (static_cast<Range *>(rb_tree_insert_node(&segmentTree, n)) == n) {
pthread_rwlock_unlock(&fdeTreeLock);
return true;
}
@@ -306,7 +305,7 @@ public:
bool removeFDE(pint_t pcStart, pint_t pcEnd, pint_t fde) {
pthread_rwlock_wrlock(&fdeTreeLock);
- Range *n = (Range *)rb_tree_find_node(&segmentTree, &pcStart);
+ Range *n = static_cast<Range *>(rb_tree_find_node(&segmentTree, &pcStart));
if (n == NULL) {
pthread_rwlock_unlock(&fdeTreeLock);
return false;
@@ -403,7 +402,7 @@ private:
n->data_base = data_base;
n->ehframe_base = ehframe_base;
- if (rb_tree_insert_node(&segmentTree, n) != n) {
+ if (static_cast<Range *>(rb_tree_insert_node(&segmentTree, n)) != n) {
free(n);
return;
}
Index: src/sys/lib/libunwind/DwarfInstructions.hpp
diff -u src/sys/lib/libunwind/DwarfInstructions.hpp:1.3 src/sys/lib/libunwind/DwarfInstructions.hpp:1.3.2.1
--- src/sys/lib/libunwind/DwarfInstructions.hpp:1.3 Tue Mar 11 23:57:42 2014
+++ src/sys/lib/libunwind/DwarfInstructions.hpp Sun Aug 10 06:56:02 2014
@@ -48,9 +48,6 @@ private:
const typename CFI_Parser<A, R>::RegisterLocation &);
static int lastRestoreReg(const R &) { return R::LAST_RESTORE_REG; }
- static bool isReturnAddressRegister(int regno, const R &) {
- return regno == R::RETURN_REG;
- }
static pint_t getCFA(A &addressSpace,
const typename CFI_Parser<A, R>::PrologInfo &prolog,
@@ -139,7 +136,7 @@ step_result DwarfInstructions<A, R>::ste
for (int i = 0; i <= lastRestoreReg(newRegisters); ++i) {
if (prolog.savedRegisters[i].location == CFI_Parser<A, R>::kRegisterUnused)
continue;
- if (isReturnAddressRegister(i, registers))
+ if (i == (int)cieInfo.returnAddressRegister)
returnAddress = getSavedRegister(addressSpace, registers, cfa,
prolog.savedRegisters[i]);
else if (registers.validRegister(i))
@@ -156,7 +153,7 @@ step_result DwarfInstructions<A, R>::ste
// The CFA is defined as the stack pointer at the call site.
// Therefore the SP is restored by setting it to the CFA.
newRegisters.setSP(cfa);
- newRegisters.setIP(returnAddress);
+ newRegisters.setIP(returnAddress + R::RETURN_OFFSET);
// Now replace register set with the working copy.
registers = newRegisters;
Index: src/sys/lib/libunwind/DwarfParser.hpp
diff -u src/sys/lib/libunwind/DwarfParser.hpp:1.2 src/sys/lib/libunwind/DwarfParser.hpp:1.2.2.1
--- src/sys/lib/libunwind/DwarfParser.hpp:1.2 Tue Mar 11 23:52:17 2014
+++ src/sys/lib/libunwind/DwarfParser.hpp Sun Aug 10 06:56:02 2014
@@ -43,6 +43,7 @@ public:
uint8_t personalityOffsetInCIE;
bool isSignalFrame;
bool fdesHaveAugmentationData;
+ uint8_t returnAddressRegister;
};
/// Information about an FDE (Frame Description Entry)
@@ -238,7 +239,7 @@ bool CFI_Parser<A, R>::parseCIE(A &addre
// Parse data alignment factor
cieInfo->dataAlignFactor = addressSpace.getSLEB128(p, cieContentEnd);
// Parse return address register
- addressSpace.getULEB128(p, cieContentEnd);
+ cieInfo->returnAddressRegister = (uint8_t)addressSpace.getULEB128(p, cieContentEnd);
// Parse augmentation data based on augmentation string.
if (addressSpace.get8(strStart) == 'z') {
// parse augmentation data length
@@ -460,6 +461,8 @@ CFI_Parser<A, R>::parseInstructions(A &a
reg = R::dwarf2regno(addressSpace.getULEB128(p, instructionsEnd));
offset =
addressSpace.getULEB128(p, instructionsEnd) * cieInfo.dataAlignFactor;
+ if (reg > kMaxRegisterNumber)
+ return false;
results->savedRegisters[reg].location = kRegisterOffsetFromCFA;
results->savedRegisters[reg].value = offset;
break;
@@ -481,6 +484,20 @@ CFI_Parser<A, R>::parseInstructions(A &a
length = addressSpace.getULEB128(p, instructionsEnd);
p += length;
break;
+ case DW_CFA_GNU_window_save:
+#if defined(__sparc__)
+ for (reg = 8; reg < 16; ++reg) {
+ results->savedRegisters[reg].location = kRegisterInRegister;
+ results->savedRegisters[reg].value = reg + 16;
+ }
+ for (reg = 16; reg < 32; ++reg) {
+ results->savedRegisters[reg].location = kRegisterInCFA;
+ results->savedRegisters[reg].value = (reg - 16) * sizeof(typename R::reg_t);
+ }
+ break;
+#else
+ return false;
+#endif
case DW_CFA_GNU_args_size:
offset = addressSpace.getULEB128(p, instructionsEnd);
results->spExtraArgSize = offset;
Index: src/sys/lib/libunwind/UnwindCursor.hpp
diff -u src/sys/lib/libunwind/UnwindCursor.hpp:1.2 src/sys/lib/libunwind/UnwindCursor.hpp:1.2.2.1
--- src/sys/lib/libunwind/UnwindCursor.hpp:1.2 Thu Mar 20 01:35:45 2014
+++ src/sys/lib/libunwind/UnwindCursor.hpp Sun Aug 10 06:56:02 2014
@@ -135,7 +135,6 @@ void UnwindCursor<A, R>::setInfoBasedOnI
fInfo.handler = cieInfo.personality;
fInfo.extra_args = prolog.spExtraArgSize;
fInfo.unwind_info = fdeInfo.fdeStart;
- fInfo.unwind_info_size = fdeInfo.fdeLength;
}
}; // namespace _Unwind
Index: src/sys/lib/libunwind/Makefile.inc
diff -u src/sys/lib/libunwind/Makefile.inc:1.5 src/sys/lib/libunwind/Makefile.inc:1.5.2.1
--- src/sys/lib/libunwind/Makefile.inc:1.5 Wed Mar 19 16:46:23 2014
+++ src/sys/lib/libunwind/Makefile.inc Sun Aug 10 06:56:02 2014
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.5 2014/03/19 16:46:23 joerg Exp $
+# $NetBSD: Makefile.inc,v 1.5.2.1 2014/08/10 06:56:02 tls Exp $
.PATH: ${NETBSDSRCDIR}/sys/lib/libunwind
@@ -7,15 +7,11 @@ SRCS+= libunwind.cxx \
INCS+= unwind.h
-.if ${HAVE_GCC:U48} == "4"
-CLEANFILES+= cstdint
-DPSRCS+= cstdint
-
-cstdint:
- echo '#include <stdint.h>' > ${.TARGET}
-
-COPTS.libunwind.cxx+= "-D__builtin_unreachable()=abort()"
-.else
COPTS.libunwind.cxx+= ${${ACTIVE_CXX} == "gcc":? -std=c++0x : -std=c++11 }
+COPTS.libunwind.cxx+= -funwind-tables -fno-rtti
+COPTS.libunwind.cxx+= -fno-exceptions -fvisibility=hidden
+COPTS.libunwind.cxx+= -Wno-old-style-cast
+
+.if ${MACHINE_CPU} == "arm"
+AFLAGS.unwind_registers.S+= ${${ACTIVE_CC} == "clang":? -no-integrated-as :}
.endif
-COPTS.libunwind.cxx+= -funwind-tables -fno-rtti -fno-exceptions -fvisibility=hidden -Wno-old-style-cast
Index: src/sys/lib/libunwind/Registers.hpp
diff -u src/sys/lib/libunwind/Registers.hpp:1.8 src/sys/lib/libunwind/Registers.hpp:1.8.2.1
--- src/sys/lib/libunwind/Registers.hpp:1.8 Wed Apr 2 22:34:29 2014
+++ src/sys/lib/libunwind/Registers.hpp Sun Aug 10 06:56:02 2014
@@ -34,7 +34,7 @@ public:
enum {
LAST_REGISTER = REGNO_X86_EIP,
LAST_RESTORE_REG = REGNO_X86_EIP,
- RETURN_REG = REGNO_X86_EIP,
+ RETURN_OFFSET = 0,
};
__dso_hidden Registers_x86();
@@ -99,7 +99,7 @@ public:
enum {
LAST_REGISTER = REGNO_X86_64_RIP,
LAST_RESTORE_REG = REGNO_X86_64_RIP,
- RETURN_REG = REGNO_X86_64_RIP,
+ RETURN_OFFSET = 0,
};
__dso_hidden Registers_x86_64();
@@ -167,7 +167,7 @@ public:
enum {
LAST_REGISTER = REGNO_PPC32_V31,
LAST_RESTORE_REG = REGNO_PPC32_V31,
- RETURN_REG = REGNO_PPC32_LR,
+ RETURN_OFFSET = 0,
};
__dso_hidden Registers_ppc32();
@@ -240,22 +240,25 @@ enum {
DWARF_ARM32_R0 = 0,
DWARF_ARM32_R15 = 15,
DWARF_ARM32_SPSR = 128,
- DWARF_ARM32_D0 = 256, // VFP-v3/Neon
+ DWARF_ARM32_OLD_S0 = 64,
+ DWARF_ARM32_OLD_S31 = 91,
+ DWARF_ARM32_D0 = 256,
DWARF_ARM32_D31 = 287,
REGNO_ARM32_R0 = 0,
REGNO_ARM32_SP = 13,
REGNO_ARM32_R15 = 15,
REGNO_ARM32_SPSR = 16,
- REGNO_ARM32_D0 = 0,
- REGNO_ARM32_D31 = 31,
+ REGNO_ARM32_D0 = 17,
+ REGNO_ARM32_D15 = 32,
+ REGNO_ARM32_D31 = 48,
};
class Registers_arm32 {
public:
enum {
LAST_REGISTER = REGNO_ARM32_D31,
- LAST_RESTORE_REG = REGNO_ARM32_SPSR,
- RETURN_REG = REGNO_ARM32_SPSR,
+ LAST_RESTORE_REG = REGNO_ARM32_D31,
+ RETURN_OFFSET = 0,
};
__dso_hidden Registers_arm32();
@@ -263,15 +266,19 @@ public:
static int dwarf2regno(int num) {
if (num >= DWARF_ARM32_R0 && num <= DWARF_ARM32_R15)
return REGNO_ARM32_R0 + (num - DWARF_ARM32_R0);
- if (num >= DWARF_ARM32_D0 && num <= DWARF_ARM32_D31)
- return REGNO_ARM32_D0 + (num - DWARF_ARM32_D0);
if (num == DWARF_ARM32_SPSR)
return REGNO_ARM32_SPSR;
+ if (num >= DWARF_ARM32_D0 && num <= DWARF_ARM32_D31)
+ return REGNO_ARM32_D0 + (num - DWARF_ARM32_D0);
+ if (num >= DWARF_ARM32_OLD_S0 && num <= DWARF_ARM32_OLD_S31) {
+ assert(num % 2 == 0);
+ return REGNO_ARM32_D0 + (num - DWARF_ARM32_OLD_S0) / 2;
+ }
return LAST_REGISTER + 1;
}
bool validRegister(int num) const {
- return num >= 0 && num <= LAST_RESTORE_REG;
+ return num >= 0 && num <= REGNO_ARM32_SPSR;
}
uint64_t getRegister(int num) const {
@@ -297,14 +304,28 @@ public:
}
void copyFloatVectorRegister(int num, uint64_t addr_) {
+ if (num <= REGNO_ARM32_D15) {
+ if ((flags & 1) == 0) {
+ lazyVFP1();
+ flags |= 1;
+ }
+ } else {
+ if ((flags & 2) == 0) {
+ lazyVFP3();
+ flags |= 2;
+ }
+ }
const void *addr = reinterpret_cast<const void *>(addr_);
memcpy(fpreg + (num - REGNO_ARM32_D0), addr, sizeof(fpreg[0]));
}
+ __dso_hidden void lazyVFP1();
+ __dso_hidden void lazyVFP3();
__dso_hidden void jumpto() const __dead;
private:
uint32_t reg[REGNO_ARM32_SPSR + 1];
+ uint32_t flags;
uint64_t fpreg[32];
};
@@ -324,7 +345,7 @@ public:
enum {
LAST_REGISTER = REGNO_VAX_PSW,
LAST_RESTORE_REG = REGNO_VAX_PSW,
- RETURN_REG = REGNO_VAX_R15,
+ RETURN_OFFSET = 0,
};
__dso_hidden Registers_vax();
@@ -395,7 +416,7 @@ public:
enum {
LAST_REGISTER = REGNO_M68K_FP7,
LAST_RESTORE_REG = REGNO_M68K_FP7,
- RETURN_REG = REGNO_M68K_PC,
+ RETURN_OFFSET = 0,
};
__dso_hidden Registers_M68K();
@@ -471,7 +492,7 @@ public:
enum {
LAST_REGISTER = REGNO_SH3_PR,
LAST_RESTORE_REG = REGNO_SH3_PR,
- RETURN_REG = REGNO_SH3_PR,
+ RETURN_OFFSET = 0,
};
__dso_hidden Registers_SH3();
@@ -518,6 +539,439 @@ private:
uint32_t reg[REGNO_SH3_PR + 1];
};
+enum {
+ DWARF_SPARC64_R0 = 0,
+ DWARF_SPARC64_R31 = 31,
+ DWARF_SPARC64_PC = 32,
+
+ REGNO_SPARC64_R0 = 0,
+ REGNO_SPARC64_R14 = 14,
+ REGNO_SPARC64_R15 = 15,
+ REGNO_SPARC64_R31 = 31,
+ REGNO_SPARC64_PC = 32,
+};
+
+class Registers_SPARC64 {
+public:
+ enum {
+ LAST_REGISTER = REGNO_SPARC64_PC,
+ LAST_RESTORE_REG = REGNO_SPARC64_PC,
+ RETURN_OFFSET = 8,
+ };
+ typedef uint64_t reg_t;
+
+ __dso_hidden Registers_SPARC64();
+
+ static int dwarf2regno(int num) {
+ if (num >= DWARF_SPARC64_R0 && num <= DWARF_SPARC64_R31)
+ return REGNO_SPARC64_R0 + (num - DWARF_SPARC64_R0);
+ if (num == DWARF_SPARC64_PC)
+ return REGNO_SPARC64_PC;
+ return LAST_REGISTER + 1;
+ }
+
+ bool validRegister(int num) const {
+ return num >= 0 && num <= REGNO_SPARC64_PC;
+ }
+
+ uint64_t getRegister(int num) const {
+ assert(validRegister(num));
+ return reg[num];
+ }
+
+ void setRegister(int num, uint64_t value) {
+ assert(validRegister(num));
+ reg[num] = value;
+ }
+
+ uint64_t getIP() const { return reg[REGNO_SPARC64_PC]; }
+
+ void setIP(uint64_t value) { reg[REGNO_SPARC64_PC] = value; }
+
+ uint64_t getSP() const { return reg[REGNO_SPARC64_R14]; }
+
+ void setSP(uint64_t value) { reg[REGNO_SPARC64_R14] = value; }
+
+ bool validFloatVectorRegister(int num) const { return false; }
+
+ void copyFloatVectorRegister(int num, uint64_t addr_) {}
+
+ __dso_hidden void jumpto() const __dead;
+
+private:
+ uint64_t reg[REGNO_SPARC64_PC + 1];
+};
+
+enum {
+ DWARF_SPARC_R0 = 0,
+ DWARF_SPARC_R31 = 31,
+ DWARF_SPARC_PC = 32,
+
+ REGNO_SPARC_R0 = 0,
+ REGNO_SPARC_R14 = 14,
+ REGNO_SPARC_R15 = 15,
+ REGNO_SPARC_R31 = 31,
+ REGNO_SPARC_PC = 32,
+};
+
+class Registers_SPARC {
+public:
+ enum {
+ LAST_REGISTER = REGNO_SPARC_PC,
+ LAST_RESTORE_REG = REGNO_SPARC_PC,
+ RETURN_OFFSET = 8,
+ };
+ typedef uint32_t reg_t;
+
+ __dso_hidden Registers_SPARC();
+
+ static int dwarf2regno(int num) {
+ if (num >= DWARF_SPARC_R0 && num <= DWARF_SPARC_R31)
+ return REGNO_SPARC_R0 + (num - DWARF_SPARC_R0);
+ if (num == DWARF_SPARC_PC)
+ return REGNO_SPARC_PC;
+ return LAST_REGISTER + 1;
+ }
+
+ bool validRegister(int num) const {
+ return num >= 0 && num <= REGNO_SPARC_PC;
+ }
+
+ uint64_t getRegister(int num) const {
+ assert(validRegister(num));
+ return reg[num];
+ }
+
+ void setRegister(int num, uint64_t value) {
+ assert(validRegister(num));
+ reg[num] = value;
+ }
+
+ uint64_t getIP() const { return reg[REGNO_SPARC_PC]; }
+
+ void setIP(uint64_t value) { reg[REGNO_SPARC_PC] = value; }
+
+ uint64_t getSP() const { return reg[REGNO_SPARC_R14]; }
+
+ void setSP(uint64_t value) { reg[REGNO_SPARC_R14] = value; }
+
+ bool validFloatVectorRegister(int num) const { return false; }
+
+ void copyFloatVectorRegister(int num, uint64_t addr_) {}
+
+ __dso_hidden void jumpto() const __dead;
+
+private:
+ uint32_t reg[REGNO_SPARC_PC + 1];
+};
+
+enum {
+ DWARF_ALPHA_R0 = 0,
+ DWARF_ALPHA_R30 = 30,
+ DWARF_ALPHA_F0 = 32,
+ DWARF_ALPHA_F30 = 62,
+
+ REGNO_ALPHA_R0 = 0,
+ REGNO_ALPHA_R26 = 26,
+ REGNO_ALPHA_R30 = 30,
+ REGNO_ALPHA_PC = 31,
+ REGNO_ALPHA_F0 = 32,
+ REGNO_ALPHA_F30 = 62,
+};
+
+class Registers_Alpha {
+public:
+ enum {
+ LAST_REGISTER = REGNO_ALPHA_F30,
+ LAST_RESTORE_REG = REGNO_ALPHA_F30,
+ RETURN_OFFSET = 0,
+ };
+ typedef uint32_t reg_t;
+
+ __dso_hidden Registers_Alpha();
+
+ static int dwarf2regno(int num) { return num; }
+
+ bool validRegister(int num) const {
+ return num >= 0 && num <= REGNO_ALPHA_PC;
+ }
+
+ uint64_t getRegister(int num) const {
+ assert(validRegister(num));
+ return reg[num];
+ }
+
+ void setRegister(int num, uint64_t value) {
+ assert(validRegister(num));
+ reg[num] = value;
+ }
+
+ uint64_t getIP() const { return reg[REGNO_ALPHA_PC]; }
+
+ void setIP(uint64_t value) { reg[REGNO_ALPHA_PC] = value; }
+
+ uint64_t getSP() const { return reg[REGNO_ALPHA_R30]; }
+
+ void setSP(uint64_t value) { reg[REGNO_ALPHA_R30] = value; }
+
+ bool validFloatVectorRegister(int num) const {
+ return num >= REGNO_ALPHA_F0 && num <= REGNO_ALPHA_F30;
+ }
+
+ void copyFloatVectorRegister(int num, uint64_t addr_) {
+ assert(validFloatVectorRegister(num));
+ const void *addr = reinterpret_cast<const void *>(addr_);
+ memcpy(fpreg + (num - REGNO_ALPHA_F0), addr, sizeof(fpreg[0]));
+ }
+
+ __dso_hidden void jumpto() const __dead;
+
+private:
+ uint64_t reg[REGNO_ALPHA_PC + 1];
+ uint64_t fpreg[31];
+};
+
+enum {
+ DWARF_HPPA_R1 = 1,
+ DWARF_HPPA_R31 = 31,
+ DWARF_HPPA_FR4L = 32,
+ DWARF_HPPA_FR31H = 87,
+
+ REGNO_HPPA_PC = 0,
+ REGNO_HPPA_R1 = 1,
+ REGNO_HPPA_R2 = 2,
+ REGNO_HPPA_R30 = 30,
+ REGNO_HPPA_R31 = 31,
+ REGNO_HPPA_FR4L = 32,
+ REGNO_HPPA_FR31H = 87,
+};
+
+class Registers_HPPA {
+public:
+ enum {
+ LAST_REGISTER = REGNO_HPPA_FR31H,
+ LAST_RESTORE_REG = REGNO_HPPA_FR31H,
+ RETURN_OFFSET = -3, // strictly speaking, this is a mask
+ };
+
+ __dso_hidden Registers_HPPA();
+
+ static int dwarf2regno(int num) {
+ if (num >= DWARF_HPPA_R1 && num <= DWARF_HPPA_R31)
+ return REGNO_HPPA_R1 + (num - DWARF_HPPA_R1);
+ if (num >= DWARF_HPPA_FR4L && num <= DWARF_HPPA_FR31H)
+ return REGNO_HPPA_FR4L + (num - DWARF_HPPA_FR31H);
+ return LAST_REGISTER + 1;
+ }
+
+ bool validRegister(int num) const {
+ return num >= REGNO_HPPA_PC && num <= REGNO_HPPA_R31;
+ }
+
+ uint64_t getRegister(int num) const {
+ assert(validRegister(num));
+ return reg[num];
+ }
+
+ void setRegister(int num, uint64_t value) {
+ assert(validRegister(num));
+ reg[num] = value;
+ }
+
+ uint64_t getIP() const { return reg[REGNO_HPPA_PC]; }
+
+ void setIP(uint64_t value) { reg[REGNO_HPPA_PC] = value; }
+
+ uint64_t getSP() const { return reg[REGNO_HPPA_R30]; }
+
+ void setSP(uint64_t value) { reg[REGNO_HPPA_R30] = value; }
+
+ bool validFloatVectorRegister(int num) const {
+ return num >= REGNO_HPPA_FR4L && num <= REGNO_HPPA_FR31H;
+ }
+
+ void copyFloatVectorRegister(int num, uint64_t addr_) {
+ assert(validFloatVectorRegister(num));
+ const void *addr = reinterpret_cast<const void *>(addr_);
+ memcpy(fpreg + (num - REGNO_HPPA_FR4L), addr, sizeof(fpreg[0]));
+ }
+
+ __dso_hidden void jumpto() const __dead;
+
+private:
+ uint32_t reg[REGNO_HPPA_R31 + 1];
+ uint32_t fpreg[56];
+};
+
+enum {
+ DWARF_MIPS_R1 = 0,
+ DWARF_MIPS_R31 = 31,
+ DWARF_MIPS_F0 = 32,
+ DWARF_MIPS_F31 = 63,
+
+ REGNO_MIPS_PC = 0,
+ REGNO_MIPS_R1 = 0,
+ REGNO_MIPS_R29 = 29,
+ REGNO_MIPS_R31 = 31,
+ REGNO_MIPS_F0 = 33,
+ REGNO_MIPS_F31 = 64
+};
+
+class Registers_MIPS {
+public:
+ enum {
+ LAST_REGISTER = REGNO_MIPS_F31,
+ LAST_RESTORE_REG = REGNO_MIPS_F31,
+ RETURN_OFFSET = 0,
+ };
+
+ __dso_hidden Registers_MIPS();
+
+ static int dwarf2regno(int num) {
+ if (num >= DWARF_MIPS_R1 && num <= DWARF_MIPS_R31)
+ return REGNO_MIPS_R1 + (num - DWARF_MIPS_R1);
+ if (num >= DWARF_MIPS_F0 && num <= DWARF_MIPS_F31)
+ return REGNO_MIPS_F0 + (num - DWARF_MIPS_F0);
+ return LAST_REGISTER + 1;
+ }
+
+ bool validRegister(int num) const {
+ return num >= REGNO_MIPS_PC && num <= REGNO_MIPS_R31;
+ }
+
+ uint64_t getRegister(int num) const {
+ assert(validRegister(num));
+ return reg[num];
+ }
+
+ void setRegister(int num, uint64_t value) {
+ assert(validRegister(num));
+ reg[num] = value;
+ }
+
+ uint64_t getIP() const { return reg[REGNO_MIPS_PC]; }
+
+ void setIP(uint64_t value) { reg[REGNO_MIPS_PC] = value; }
+
+ uint64_t getSP() const { return reg[REGNO_MIPS_R29]; }
+
+ void setSP(uint64_t value) { reg[REGNO_MIPS_R29] = value; }
+
+ bool validFloatVectorRegister(int num) const {
+ return num >= DWARF_MIPS_F0 && num <= DWARF_MIPS_F31;
+ }
+
+ void copyFloatVectorRegister(int num, uint64_t addr_) {
+ assert(validFloatVectorRegister(num));
+ const void *addr = reinterpret_cast<const void *>(addr_);
+ memcpy(fpreg + (num - REGNO_MIPS_F0), addr, sizeof(fpreg[0]));
+ }
+
+ __dso_hidden void jumpto() const __dead;
+
+private:
+ uint32_t reg[REGNO_MIPS_R31 + 1];
+ uint64_t fpreg[32];
+};
+
+enum {
+ DWARF_MIPS64_R1 = 0,
+ DWARF_MIPS64_R31 = 31,
+ DWARF_MIPS64_F0 = 32,
+ DWARF_MIPS64_F31 = 63,
+
+ REGNO_MIPS64_PC = 0,
+ REGNO_MIPS64_R1 = 0,
+ REGNO_MIPS64_R29 = 29,
+ REGNO_MIPS64_R31 = 31,
+ REGNO_MIPS64_F0 = 33,
+ REGNO_MIPS64_F31 = 64
+};
+
+class Registers_MIPS64 {
+public:
+ enum {
+ LAST_REGISTER = REGNO_MIPS64_F31,
+ LAST_RESTORE_REG = REGNO_MIPS64_F31,
+ RETURN_OFFSET = 0,
+ };
+
+ __dso_hidden Registers_MIPS64();
+
+ static int dwarf2regno(int num) {
+ if (num >= DWARF_MIPS64_R1 && num <= DWARF_MIPS64_R31)
+ return REGNO_MIPS64_R1 + (num - DWARF_MIPS64_R1);
+ if (num >= DWARF_MIPS64_F0 && num <= DWARF_MIPS64_F31)
+ return REGNO_MIPS64_F0 + (num - DWARF_MIPS64_F0);
+ return LAST_REGISTER + 1;
+ }
+
+ bool validRegister(int num) const {
+ return num >= REGNO_MIPS64_PC && num <= REGNO_MIPS64_R31;
+ }
+
+ uint64_t getRegister(int num) const {
+ assert(validRegister(num));
+ return reg[num];
+ }
+
+ void setRegister(int num, uint64_t value) {
+ assert(validRegister(num));
+ reg[num] = value;
+ }
+
+ uint64_t getIP() const { return reg[REGNO_MIPS64_PC]; }
+
+ void setIP(uint64_t value) { reg[REGNO_MIPS64_PC] = value; }
+
+ uint64_t getSP() const { return reg[REGNO_MIPS64_R29]; }
+
+ void setSP(uint64_t value) { reg[REGNO_MIPS64_R29] = value; }
+
+ bool validFloatVectorRegister(int num) const {
+ return num >= DWARF_MIPS64_F0 && num <= DWARF_MIPS64_F31;
+ }
+
+ void copyFloatVectorRegister(int num, uint64_t addr_) {
+ assert(validFloatVectorRegister(num));
+ const void *addr = reinterpret_cast<const void *>(addr_);
+ memcpy(fpreg + (num - REGNO_MIPS64_F0), addr, sizeof(fpreg[0]));
+ }
+
+ __dso_hidden void jumpto() const __dead;
+
+private:
+ uint64_t reg[REGNO_MIPS64_R31 + 1];
+ uint64_t fpreg[32];
+};
+
+#if __i386__
+typedef Registers_x86 NativeUnwindRegisters;
+#elif __x86_64__
+typedef Registers_x86_64 NativeUnwindRegisters;
+#elif __powerpc__
+typedef Registers_ppc32 NativeUnwindRegisters;
+#elif __arm__
+typedef Registers_arm32 NativeUnwindRegisters;
+#elif __vax__
+typedef Registers_vax NativeUnwindRegisters;
+#elif __m68k__
+typedef Registers_M68K NativeUnwindRegisters;
+#elif __mips_n64 || __mips_n32
+typedef Registers_MIPS64 NativeUnwindRegisters;
+#elif __mips__
+typedef Registers_MIPS NativeUnwindRegisters;
+#elif __sh3__
+typedef Registers_SH3 NativeUnwindRegisters;
+#elif __sparc64__
+typedef Registers_SPARC64 NativeUnwindRegisters;
+#elif __sparc__
+typedef Registers_SPARC NativeUnwindRegisters;
+#elif __alpha__
+typedef Registers_Alpha NativeUnwindRegisters;
+#elif __hppa__
+typedef Registers_HPPA NativeUnwindRegisters;
+#endif
} // namespace _Unwind
#endif // __REGISTERS_HPP__
Index: src/sys/lib/libunwind/unwind_registers.S
diff -u src/sys/lib/libunwind/unwind_registers.S:1.8 src/sys/lib/libunwind/unwind_registers.S:1.8.2.1
--- src/sys/lib/libunwind/unwind_registers.S:1.8 Wed Apr 2 22:34:29 2014
+++ src/sys/lib/libunwind/unwind_registers.S Sun Aug 10 06:56:02 2014
@@ -269,20 +269,46 @@ ENTRY(_ZNK7_Unwind15Registers_ppc326jump
bctr
#endif
-#if defined(__arm__) && !defined(__ARM_EABI__)
+#if defined(__arm__)
+ .fpu vfpv3
.hidden _ZN7_Unwind15Registers_arm32C1Ev
ENTRY(_ZN7_Unwind15Registers_arm32C1Ev)
stmia r0, {r0-r14}
-
str lr, [r0, #60] /* PC */
mrs r1, cpsr
str r1, [r0, #64] /* CPSR */
-
+ mov r1, #0
+ str r1, [r0, #68]
RET
END(_ZN7_Unwind15Registers_arm32C1Ev)
+ .hidden _ZN7_Unwind15Registers_arm328lazyVFP1Ev
+ENTRY(_ZN7_Unwind15Registers_arm328lazyVFP1Ev)
+ add r0, #72
+ vstmia r0, {d0-d15}
+ RET
+END(_ZN7_Unwind15Registers_arm328lazyVFP1Ev)
+
+ .hidden _ZN7_Unwind15Registers_arm328lazyVFP3Ev
+ENTRY(_ZN7_Unwind15Registers_arm328lazyVFP3Ev)
+ add r0, #200
+ vstmia r0, {d16-d31}
+ RET
+END(_ZN7_Unwind15Registers_arm328lazyVFP3Ev)
+
.hidden _ZNK7_Unwind15Registers_arm326jumptoEv
ENTRY(_ZNK7_Unwind15Registers_arm326jumptoEv)
+ ldrb r1, [r0, #68]
+ tst r1, #1
+ beq .Lnovfp1
+ add r2, r0, #72
+ vldmia r2, {d0-d15}
+.Lnovfp1:
+ tst r1, #2
+ beq .Lnovfp3
+ add r2, r0, #200
+ vldmia r2, {d16-d31}
+.Lnovfp3:
ldr r1, [r0, #64]
msr cpsr_sxc, r1
ldmia r0, {r0-r15}
@@ -421,3 +447,740 @@ ENTRY(_ZNK7_Unwind13Registers_SH36jumpto
nop
SET_ENTRY_SIZE(_ZNK7_Unwind13Registers_SH36jumptoEv)
#endif
+
+#if defined(__sparc64__)
+#include <machine/trap.h>
+ .register %g2, #ignore
+ .register %g3, #ignore
+ .register %g6, #ignore
+ .register %g7, #ignore
+ .hidden _ZN7_Unwind17Registers_SPARC64C1Ev
+ENTRY(_ZN7_Unwind17Registers_SPARC64C1Ev)
+ t ST_FLUSHWIN
+ stx %g0, [%o0 + 0]
+ stx %g1, [%o0 + 8]
+ stx %g2, [%o0 + 16]
+ stx %g3, [%o0 + 24]
+ stx %g4, [%o0 + 32]
+ stx %g5, [%o0 + 40]
+ stx %g6, [%o0 + 48]
+ stx %g7, [%o0 + 56]
+ stx %o0, [%o0 + 64]
+ stx %o1, [%o0 + 72]
+ stx %o2, [%o0 + 80]
+ stx %o3, [%o0 + 88]
+ stx %o4, [%o0 + 96]
+ stx %o5, [%o0 + 104]
+ stx %o6, [%o0 + 112]
+ stx %o7, [%o0 + 120]
+ stx %l0, [%o0 + 128]
+ stx %l1, [%o0 + 136]
+ stx %l2, [%o0 + 144]
+ stx %l3, [%o0 + 152]
+ stx %l4, [%o0 + 160]
+ stx %l5, [%o0 + 168]
+ stx %l6, [%o0 + 176]
+ stx %l7, [%o0 + 184]
+ stx %i0, [%o0 + 192]
+ stx %i1, [%o0 + 200]
+ stx %i2, [%o0 + 208]
+ stx %i3, [%o0 + 216]
+ stx %i4, [%o0 + 224]
+ stx %i5, [%o0 + 232]
+ stx %i6, [%o0 + 240]
+ stx %i7, [%o0 + 248]
+ add %o7, 8, %g1
+ retl
+ stx %g1, [%o0 + 256]
+END(_ZN7_Unwind17Registers_SPARC64C1Ev)
+
+ .hidden _ZNK7_Unwind17Registers_SPARC646jumptoEv
+ENTRY(_ZNK7_Unwind17Registers_SPARC646jumptoEv)
+ t ST_FLUSHWIN
+ ldx [%o0 + 0], %g0
+ ldx [%o0 + 8], %g1
+ ldx [%o0 + 16], %g2
+ ldx [%o0 + 24], %g3
+ ldx [%o0 + 32], %g4
+ ldx [%o0 + 40], %g5
+ ldx [%o0 + 48], %g6
+ ldx [%o0 + 56], %g7
+ ldx [%o0 + 72], %o1
+ ldx [%o0 + 80], %o2
+ ldx [%o0 + 88], %o3
+ ldx [%o0 + 96], %o4
+ ldx [%o0 + 104], %o5
+ ldx [%o0 + 112], %g1
+ sub %g1, 2047, %o6
+ ldx [%o0 + 120], %o7
+ ldx [%o0 + 128], %l0
+ ldx [%o0 + 136], %l1
+ ldx [%o0 + 144], %l2
+ ldx [%o0 + 152], %l3
+ ldx [%o0 + 160], %l4
+ ldx [%o0 + 168], %l5
+ ldx [%o0 + 176], %l6
+ ldx [%o0 + 184], %l7
+ ldx [%o0 + 192], %i0
+ ldx [%o0 + 200], %i1
+ ldx [%o0 + 208], %i2
+ ldx [%o0 + 216], %i3
+ ldx [%o0 + 224], %i4
+ ldx [%o0 + 232], %i5
+ ldx [%o0 + 240], %i6
+ ldx [%o0 + 248], %i7
+ ldx [%o0 + 256], %g1
+ jmpl %g1, %g0
+ ldx [%o0 + 64], %o0
+END(_ZNK7_Unwind17Registers_SPARC646jumptoEv)
+#elif defined(__sparc__)
+#include <machine/trap.h>
+
+ .hidden _ZN7_Unwind15Registers_SPARCC1Ev
+ENTRY(_ZN7_Unwind15Registers_SPARCC1Ev)
+ t ST_FLUSHWIN
+ st %g0, [%o0 + 0]
+ st %g1, [%o0 + 4]
+ st %g2, [%o0 + 8]
+ st %g3, [%o0 + 12]
+ st %g4, [%o0 + 16]
+ st %g5, [%o0 + 20]
+ st %g6, [%o0 + 24]
+ st %g7, [%o0 + 28]
+ st %o0, [%o0 + 32]
+ st %o1, [%o0 + 36]
+ st %o2, [%o0 + 40]
+ st %o3, [%o0 + 44]
+ st %o4, [%o0 + 48]
+ st %o5, [%o0 + 52]
+ st %o6, [%o0 + 56]
+ st %o7, [%o0 + 60]
+ st %l0, [%o0 + 64]
+ st %l1, [%o0 + 68]
+ st %l2, [%o0 + 72]
+ st %l3, [%o0 + 76]
+ st %l4, [%o0 + 80]
+ st %l5, [%o0 + 84]
+ st %l6, [%o0 + 88]
+ st %l7, [%o0 + 92]
+ st %i0, [%o0 + 96]
+ st %i1, [%o0 + 100]
+ st %i2, [%o0 + 104]
+ st %i3, [%o0 + 108]
+ st %i4, [%o0 + 112]
+ st %i5, [%o0 + 116]
+ st %i6, [%o0 + 120]
+ st %i7, [%o0 + 124 ]
+ add %o7, 8, %g1
+ retl
+ st %g1, [%o0 + 128]
+END(_ZN7_Unwind15Registers_SPARCC1Ev)
+
+ .hidden _ZNK7_Unwind15Registers_SPARC6jumptoEv
+ENTRY(_ZNK7_Unwind15Registers_SPARC6jumptoEv)
+ t ST_FLUSHWIN
+ ld [%o0 + 0], %g0
+ ld [%o0 + 4], %g1
+ ld [%o0 + 8], %g2
+ ld [%o0 + 12], %g3
+ ld [%o0 + 16], %g4
+ ld [%o0 + 20], %g5
+ ld [%o0 + 24], %g6
+ ld [%o0 + 28], %g7
+ ld [%o0 + 36], %o1
+ ld [%o0 + 40], %o2
+ ld [%o0 + 44], %o3
+ ld [%o0 + 48], %o4
+ ld [%o0 + 52], %o5
+ ld [%o0 + 56], %o6
+ ld [%o0 + 60], %o7
+ ld [%o0 + 64], %l0
+ ld [%o0 + 68], %l1
+ ld [%o0 + 72], %l2
+ ld [%o0 + 76], %l3
+ ld [%o0 + 80], %l4
+ ld [%o0 + 84], %l5
+ ld [%o0 + 88], %l6
+ ld [%o0 + 92], %l7
+ ld [%o0 + 96], %i0
+ ld [%o0 + 100], %i1
+ ld [%o0 + 104], %i2
+ ld [%o0 + 108], %i3
+ ld [%o0 + 112], %i4
+ ld [%o0 + 116], %i5
+ ld [%o0 + 120], %i6
+ ld [%o0 + 124], %i7
+ ld [%o0 + 128], %g1
+ jmpl %g1, %g0
+ ld [%o0 + 32], %o0
+END(_ZNK7_Unwind15Registers_SPARC6jumptoEv)
+#endif
+
+#if defined(__alpha__)
+ .set nomacro
+ .set noat
+ .hidden _ZN7_Unwind15Registers_AlphaC1Ev
+LEAF_NOPROFILE(_ZN7_Unwind15Registers_AlphaC1Ev, 1)
+ stq $0, 0($16)
+ stq $1, 8($16)
+ stq $2, 16($16)
+ stq $3, 24($16)
+ stq $4, 32($16)
+ stq $5, 40($16)
+ stq $6, 48($16)
+ stq $7, 56($16)
+ stq $8, 64($16)
+ stq $9, 72($16)
+ stq $10, 80($16)
+ stq $11, 88($16)
+ stq $12, 96($16)
+ stq $13, 104($16)
+ stq $14, 112($16)
+ stq $15, 120($16)
+ stq $16, 128($16)
+ stq $17, 136($16)
+ stq $18, 144($16)
+ stq $19, 152($16)
+ stq $20, 160($16)
+ stq $21, 168($16)
+ stq $22, 176($16)
+ stq $23, 184($16)
+ stq $24, 192($16)
+ stq $25, 200($16)
+ stq $26, 208($16)
+ stq $27, 216($16)
+ stq $28, 224($16)
+ stq $29, 232($16)
+ stq $30, 240($16)
+ stq $26, 248($16)
+
+ stt $f0, 256($16)
+ stt $f1, 264($16)
+ stt $f2, 272($16)
+ stt $f3, 280($16)
+ stt $f4, 288($16)
+ stt $f5, 296($16)
+ stt $f6, 304($16)
+ stt $f7, 312($16)
+ stt $f8, 320($16)
+ stt $f9, 328($16)
+ stt $f10, 336($16)
+ stt $f11, 344($16)
+ stt $f12, 352($16)
+ stt $f13, 360($16)
+ stt $f14, 368($16)
+ stt $f15, 376($16)
+ stt $f16, 384($16)
+ stt $f17, 392($16)
+ stt $f18, 400($16)
+ stt $f19, 408($16)
+ stt $f20, 416($16)
+ stt $f21, 424($16)
+ stt $f22, 432($16)
+ stt $f23, 440($16)
+ stt $f24, 448($16)
+ stt $f25, 456($16)
+ stt $f26, 464($16)
+ stt $f27, 472($16)
+ stt $f28, 480($16)
+ stt $f29, 488($16)
+ stt $f30, 496($16)
+ ret $31, ($26), 1
+END(_ZN7_Unwind15Registers_AlphaC1Ev)
+
+ .set nomacro
+ .set noat
+ .hidden _ZNK7_Unwind15Registers_Alpha6jumptoEv
+LEAF_NOPROFILE(_ZNK7_Unwind15Registers_Alpha6jumptoEv, 1)
+ ldq $0, 0($16)
+ ldq $1, 8($16)
+ ldq $2, 16($16)
+ ldq $3, 24($16)
+ ldq $4, 32($16)
+ ldq $5, 40($16)
+ ldq $6, 48($16)
+ ldq $7, 56($16)
+ ldq $8, 64($16)
+ ldq $9, 72($16)
+ ldq $10, 80($16)
+ ldq $11, 88($16)
+ ldq $12, 96($16)
+ ldq $13, 104($16)
+ ldq $14, 112($16)
+ ldq $15, 120($16)
+ ldq $17, 136($16)
+ ldq $18, 144($16)
+ ldq $19, 152($16)
+ ldq $20, 160($16)
+ ldq $21, 168($16)
+ ldq $22, 176($16)
+ ldq $23, 184($16)
+ ldq $24, 192($16)
+ ldq $25, 200($16)
+ ldq $27, 216($16)
+ ldq $28, 224($16)
+ ldq $29, 232($16)
+ ldq $30, 240($16)
+ ldq $26, 248($16)
+
+ ldt $f0, 256($16)
+ ldt $f1, 264($16)
+ ldt $f2, 272($16)
+ ldt $f3, 280($16)
+ ldt $f4, 288($16)
+ ldt $f5, 296($16)
+ ldt $f6, 304($16)
+ ldt $f7, 312($16)
+ ldt $f8, 320($16)
+ ldt $f9, 328($16)
+ ldt $f10, 336($16)
+ ldt $f11, 344($16)
+ ldt $f12, 352($16)
+ ldt $f13, 360($16)
+ ldt $f14, 368($16)
+ ldt $f15, 376($16)
+ ldt $f16, 384($16)
+ ldt $f17, 392($16)
+ ldt $f18, 400($16)
+ ldt $f19, 408($16)
+ ldt $f20, 416($16)
+ ldt $f21, 424($16)
+ ldt $f22, 432($16)
+ ldt $f23, 440($16)
+ ldt $f24, 448($16)
+ ldt $f25, 456($16)
+ ldt $f26, 464($16)
+ ldt $f27, 472($16)
+ ldt $f28, 480($16)
+ ldt $f29, 488($16)
+ ldt $f30, 496($16)
+ ldq $16, 128($16)
+ ret $31, ($26), 1
+END(_ZNK7_Unwind15Registers_Alpha6jumptoEv)
+#endif
+
+#if defined(__mips_n64) || defined(__mips_n32)
+ .set noat
+LEAF(_ZN7_Unwind16Registers_MIPS64C1Ev)
+#if 0
+ FP_S $f0, 256($4)
+ FP_S $f1, 264($4)
+ FP_S $f2, 272($4)
+ FP_S $f3, 280($4)
+ FP_S $f4, 288($4)
+ FP_S $f5, 296($4)
+ FP_S $f6, 304($4)
+ FP_S $f7, 312($4)
+ FP_S $f8, 320($4)
+ FP_S $f9, 328($4)
+ FP_S $f10, 336($4)
+ FP_S $f11, 344($4)
+ FP_S $f12, 352($4)
+ FP_S $f13, 360($4)
+ FP_S $f14, 368($4)
+ FP_S $f15, 376($4)
+ FP_S $f16, 384($4)
+ FP_S $f17, 392($4)
+ FP_S $f18, 400($4)
+ FP_S $f19, 408($4)
+ FP_S $f20, 416($4)
+ FP_S $f21, 424($4)
+ FP_S $f22, 432($4)
+ FP_S $f23, 440($4)
+ FP_S $f24, 448($4)
+ FP_S $f25, 456($4)
+ FP_S $f26, 464($4)
+ FP_S $f27, 472($4)
+ FP_S $f28, 480($4)
+ FP_S $f29, 488($4)
+ FP_S $f30, 496($4)
+ FP_S $f31, 504($4)
+#endif
+ sd $31, 0($4)
+ sd $1, 4($4)
+ sd $2, 8($4)
+ sd $3, 12($4)
+ sd $4, 16($4)
+ sd $5, 20($4)
+ sd $6, 24($4)
+ sd $7, 28($4)
+ sd $8, 32($4)
+ sd $9, 36($4)
+ sd $10, 40($4)
+ sd $11, 44($4)
+ sd $12, 48($4)
+ sd $13, 52($4)
+ sd $14, 56($4)
+ sd $15, 60($4)
+ sd $16, 64($4)
+ sd $17, 68($4)
+ sd $18, 72($4)
+ sd $19, 76($4)
+ sd $20, 80($4)
+ sd $21, 84($4)
+ sd $22, 88($4)
+ sd $23, 92($4)
+ sd $24, 96($4)
+ sd $25, 100($4)
+ sd $26, 104($4)
+ sd $27, 108($4)
+ sd $28, 112($4)
+ sd $29, 116($4)
+ sd $30, 120($4)
+ sd $31, 124($4)
+ jr $31
+ nop
+END(_ZN7_Unwind16Registers_MIPS64C1Ev)
+
+LEAF(_ZNK7_Unwind16Registers_MIPS646jumptoEv)
+#if 0
+ FP_L $f0, 256($4)
+ FP_L $f1, 264($4)
+ FP_L $f2, 272($4)
+ FP_L $f3, 280($4)
+ FP_L $f4, 288($4)
+ FP_L $f5, 296($4)
+ FP_L $f6, 304($4)
+ FP_L $f7, 312($4)
+ FP_L $f8, 320($4)
+ FP_L $f9, 328($4)
+ FP_L $f10, 336($4)
+ FP_L $f11, 344($4)
+ FP_L $f12, 352($4)
+ FP_L $f13, 360($4)
+ FP_L $f14, 368($4)
+ FP_L $f15, 376($4)
+ FP_L $f16, 384($4)
+ FP_L $f17, 392($4)
+ FP_L $f18, 400($4)
+ FP_L $f19, 408($4)
+ FP_L $f20, 416($4)
+ FP_L $f21, 424($4)
+ FP_L $f22, 432($4)
+ FP_L $f23, 440($4)
+ FP_L $f24, 448($4)
+ FP_L $f25, 456($4)
+ FP_L $f26, 464($4)
+ FP_L $f27, 472($4)
+ FP_L $f28, 480($4)
+ FP_L $f29, 488($4)
+ FP_L $f30, 496($4)
+ FP_L $f31, 504($4)
+#endif
+
+ ld $31, 0($4)
+ ld $1, 8($4)
+ ld $2, 16($4)
+ ld $3, 24($4)
+ ld $5, 40($4)
+ ld $6, 48($4)
+ ld $7, 56($4)
+ ld $8, 64($4)
+ ld $9, 72($4)
+ ld $10, 80($4)
+ ld $11, 88($4)
+ ld $12, 96($4)
+ ld $13, 104($4)
+ ld $14, 112($4)
+ ld $15, 120($4)
+ ld $16, 128($4)
+ ld $17, 136($4)
+ ld $18, 144($4)
+ ld $19, 152($4)
+ ld $20, 160($4)
+ ld $21, 168($4)
+ ld $22, 176($4)
+ ld $23, 184($4)
+ ld $24, 192($4)
+ ld $25, 200($4)
+ ld $26, 208($4)
+ ld $27, 216($4)
+ ld $28, 224($4)
+ ld $29, 232($4)
+ ld $30, 240($4)
+ ld $4, 32($4)
+ jr $31
+ nop
+END(_ZNK7_Unwind16Registers_MIPS646jumptoEv)
+#elif defined(__mips__)
+ .set noat
+LEAF(_ZN7_Unwind14Registers_MIPSC1Ev)
+#if 0
+#if __mips > 1
+ FP_S $f0, 128($4)
+ FP_S $f1, 136($4)
+ FP_S $f2, 144($4)
+ FP_S $f3, 152($4)
+ FP_S $f4, 160($4)
+ FP_S $f5, 168($4)
+ FP_S $f6, 176($4)
+ FP_S $f7, 184($4)
+ FP_S $f8, 192($4)
+ FP_S $f9, 200($4)
+ FP_S $f10, 208($4)
+ FP_S $f11, 216($4)
+ FP_S $f12, 224($4)
+ FP_S $f13, 232($4)
+ FP_S $f14, 240($4)
+ FP_S $f15, 248($4)
+ FP_S $f16, 256($4)
+ FP_S $f17, 264($4)
+ FP_S $f18, 272($4)
+ FP_S $f19, 280($4)
+ FP_S $f20, 288($4)
+ FP_S $f21, 296($4)
+ FP_S $f22, 304($4)
+ FP_S $f23, 312($4)
+ FP_S $f24, 320($4)
+ FP_S $f25, 328($4)
+ FP_S $f26, 336($4)
+ FP_S $f27, 344($4)
+ FP_S $f28, 352($4)
+ FP_S $f29, 360($4)
+ FP_S $f30, 368($4)
+ FP_S $f31, 376($4)
+#endif
+#endif
+ sw $31, 0($4)
+ sw $1, 4($4)
+ sw $2, 8($4)
+ sw $3, 12($4)
+ sw $4, 16($4)
+ sw $5, 20($4)
+ sw $6, 24($4)
+ sw $7, 28($4)
+ sw $8, 32($4)
+ sw $9, 36($4)
+ sw $10, 40($4)
+ sw $11, 44($4)
+ sw $12, 48($4)
+ sw $13, 52($4)
+ sw $14, 56($4)
+ sw $15, 60($4)
+ sw $16, 64($4)
+ sw $17, 68($4)
+ sw $18, 72($4)
+ sw $19, 76($4)
+ sw $20, 80($4)
+ sw $21, 84($4)
+ sw $22, 88($4)
+ sw $23, 92($4)
+ sw $24, 96($4)
+ sw $25, 100($4)
+ sw $26, 104($4)
+ sw $27, 108($4)
+ sw $28, 112($4)
+ sw $29, 116($4)
+ sw $30, 120($4)
+ sw $31, 124($4)
+ jr $31
+ nop
+END(_ZN7_Unwind14Registers_MIPSC1Ev)
+
+LEAF(_ZNK7_Unwind14Registers_MIPS6jumptoEv)
+#if 0
+#if __mips > 1
+ FP_L $f0, 128($4)
+ FP_L $f1, 136($4)
+ FP_L $f2, 144($4)
+ FP_L $f3, 152($4)
+ FP_L $f4, 160($4)
+ FP_L $f5, 168($4)
+ FP_L $f6, 176($4)
+ FP_L $f7, 184($4)
+ FP_L $f8, 192($4)
+ FP_L $f9, 200($4)
+ FP_L $f10, 208($4)
+ FP_L $f11, 216($4)
+ FP_L $f12, 224($4)
+ FP_L $f13, 232($4)
+ FP_L $f14, 240($4)
+ FP_L $f15, 248($4)
+ FP_L $f16, 256($4)
+ FP_L $f17, 264($4)
+ FP_L $f18, 272($4)
+ FP_L $f19, 280($4)
+ FP_L $f20, 288($4)
+ FP_L $f21, 296($4)
+ FP_L $f22, 304($4)
+ FP_L $f23, 312($4)
+ FP_L $f24, 320($4)
+ FP_L $f25, 328($4)
+ FP_L $f26, 336($4)
+ FP_L $f27, 344($4)
+ FP_L $f28, 352($4)
+ FP_L $f29, 360($4)
+ FP_L $f30, 368($4)
+ FP_L $f31, 376($4)
+#endif
+#endif
+
+ lw $31, 0($4)
+ lw $1, 4($4)
+ lw $2, 8($4)
+ lw $3, 12($4)
+ lw $5, 20($4)
+ lw $6, 24($4)
+ lw $7, 28($4)
+ lw $8, 32($4)
+ lw $9, 36($4)
+ lw $10, 40($4)
+ lw $11, 44($4)
+ lw $12, 48($4)
+ lw $13, 52($4)
+ lw $14, 56($4)
+ lw $15, 60($4)
+ lw $16, 64($4)
+ lw $17, 68($4)
+ lw $18, 72($4)
+ lw $19, 76($4)
+ lw $20, 80($4)
+ lw $21, 84($4)
+ lw $22, 88($4)
+ lw $23, 92($4)
+ lw $24, 96($4)
+ lw $25, 100($4)
+ lw $26, 104($4)
+ lw $27, 108($4)
+ lw $28, 112($4)
+ lw $29, 116($4)
+ lw $30, 120($4)
+ lw $4, 16($4)
+ jr $31
+ nop
+END(_ZNK7_Unwind14Registers_MIPS6jumptoEv)
+#endif
+
+#if defined(__hppa__)
+LEAF_ENTRY_NOPROFILE(_ZN7_Unwind14Registers_HPPAC1Ev)
+ stw %r2, 0(%r26)
+ stw %r1, 4(%r26)
+ stw %r2, 8(%r26)
+ stw %r3, 12(%r26)
+ stw %r4, 16(%r26)
+ stw %r5, 20(%r26)
+ stw %r6, 24(%r26)
+ stw %r7, 28(%r26)
+ stw %r8, 32(%r26)
+ stw %r9, 36(%r26)
+ stw %r10, 40(%r26)
+ stw %r11, 44(%r26)
+ stw %r12, 48(%r26)
+ stw %r13, 52(%r26)
+ stw %r14, 56(%r26)
+ stw %r15, 60(%r26)
+ stw %r16, 64(%r26)
+ stw %r17, 68(%r26)
+ stw %r18, 72(%r26)
+ stw %r19, 76(%r26)
+ stw %r20, 80(%r26)
+ stw %r21, 84(%r26)
+ stw %r22, 88(%r26)
+ stw %r23, 92(%r26)
+ stw %r24, 96(%r26)
+ stw %r25, 100(%r26)
+ stw %r26, 104(%r26)
+ stw %r27, 108(%r26)
+ stw %r28, 112(%r26)
+ stw %r29, 116(%r26)
+ stw %r30, 120(%r26)
+ stw %r31, 124(%r26)
+ ldi 128, %r19
+ addl %r19, %r26, %r19
+ fstds,ma %fr4, 8(%r19)
+ fstds,ma %fr5, 8(%r19)
+ fstds,ma %fr6, 8(%r19)
+ fstds,ma %fr7, 8(%r19)
+ fstds,ma %fr8, 8(%r19)
+ fstds,ma %fr9, 8(%r19)
+ fstds,ma %fr10, 8(%r19)
+ fstds,ma %fr11, 8(%r19)
+ fstds,ma %fr12, 8(%r19)
+ fstds,ma %fr13, 8(%r19)
+ fstds,ma %fr14, 8(%r19)
+ fstds,ma %fr15, 8(%r19)
+ fstds,ma %fr16, 8(%r19)
+ fstds,ma %fr17, 8(%r19)
+ fstds,ma %fr18, 8(%r19)
+ fstds,ma %fr19, 8(%r19)
+ fstds,ma %fr20, 8(%r19)
+ fstds,ma %fr21, 8(%r19)
+ fstds,ma %fr22, 8(%r19)
+ fstds,ma %fr23, 8(%r19)
+ fstds,ma %fr24, 8(%r19)
+ fstds,ma %fr25, 8(%r19)
+ fstds,ma %fr19, 8(%r19)
+ fstds,ma %fr27, 8(%r19)
+ fstds,ma %fr28, 8(%r19)
+ fstds,ma %fr29, 8(%r19)
+ fstds,ma %fr30, 8(%r19)
+ fstds,ma %fr31, 8(%r19)
+ ldw 76(%r26), %r19
+ bv,n %r0(%r2)
+EXIT(_ZN7_Unwind14Registers_HPPAC1Ev)
+
+LEAF_ENTRY_NOPROFILE(_ZNK7_Unwind14Registers_HPPA6jumptoEv)
+ ldi 128, %r19
+ addl %r19, %r26, %r19
+ fldds,ma 8(%r19), %fr4
+ fldds,ma 8(%r19), %fr5
+ fldds,ma 8(%r19), %fr6
+ fldds,ma 8(%r19), %fr7
+ fldds,ma 8(%r19), %fr8
+ fldds,ma 8(%r19), %fr9
+ fldds,ma 8(%r19), %fr10
+ fldds,ma 8(%r19), %fr11
+ fldds,ma 8(%r19), %fr12
+ fldds,ma 8(%r19), %fr13
+ fldds,ma 8(%r19), %fr14
+ fldds,ma 8(%r19), %fr15
+ fldds,ma 8(%r19), %fr16
+ fldds,ma 8(%r19), %fr17
+ fldds,ma 8(%r19), %fr18
+ fldds,ma 8(%r19), %fr19
+ fldds,ma 8(%r19), %fr20
+ fldds,ma 8(%r19), %fr21
+ fldds,ma 8(%r19), %fr22
+ fldds,ma 8(%r19), %fr23
+ fldds,ma 8(%r19), %fr24
+ fldds,ma 8(%r19), %fr25
+ fldds,ma 8(%r19), %fr26
+ fldds,ma 8(%r19), %fr27
+ fldds,ma 8(%r19), %fr28
+ fldds,ma 8(%r19), %fr29
+ fldds,ma 8(%r19), %fr30
+ fldds,ma 8(%r19), %fr31
+ ldw 0(%r26), %r2
+ ldw 4(%r26), %r1
+ ldw 12(%r26), %r3
+ ldw 16(%r26), %r4
+ ldw 20(%r26), %r5
+ ldw 24(%r26), %r6
+ ldw 28(%r26), %r7
+ ldw 32(%r26), %r8
+ ldw 36(%r26), %r9
+ ldw 40(%r26), %r10
+ ldw 44(%r26), %r11
+ ldw 48(%r26), %r12
+ ldw 52(%r26), %r13
+ ldw 56(%r26), %r14
+ ldw 60(%r26), %r15
+ ldw 64(%r26), %r16
+ ldw 68(%r26), %r17
+ ldw 72(%r26), %r18
+ ldw 76(%r26), %r19
+ ldw 80(%r26), %r20
+ ldw 84(%r26), %r21
+ ldw 88(%r26), %r22
+ ldw 92(%r26), %r23
+ ldw 96(%r26), %r24
+ ldw 100(%r26), %r25
+ ldw 108(%r26), %r27
+ ldw 112(%r26), %r28
+ ldw 116(%r26), %r29
+ ldw 120(%r26), %r30
+ ldw 124(%r26), %r31
+ ldw 104(%r26), %r26
+ bv,n %r0(%r2)
+EXIT(_ZNK7_Unwind14Registers_HPPA6jumptoEv)
+#endif
Index: src/sys/lib/libunwind/libunwind.cxx
diff -u src/sys/lib/libunwind/libunwind.cxx:1.7 src/sys/lib/libunwind/libunwind.cxx:1.7.2.1
--- src/sys/lib/libunwind/libunwind.cxx:1.7 Wed Apr 2 22:34:29 2014
+++ src/sys/lib/libunwind/libunwind.cxx Sun Aug 10 06:56:02 2014
@@ -17,30 +17,12 @@
using namespace _Unwind;
-#if __i386__
-typedef Registers_x86 ThisUnwindRegisters;
-#elif __x86_64__
-typedef Registers_x86_64 ThisUnwindRegisters;
-#elif __powerpc__
-typedef Registers_ppc32 ThisUnwindRegisters;
-#elif __arm__ && !defined(__ARM_EABI__)
-typedef Registers_arm32 ThisUnwindRegisters;
-#elif __vax__
-typedef Registers_vax ThisUnwindRegisters;
-#elif __m68k__
-typedef Registers_M68K ThisUnwindRegisters;
-#elif __sh3__
-typedef Registers_SH3 ThisUnwindRegisters;
-#else
-#error Unsupported architecture
-#endif
-
-typedef CFI_Parser<LocalAddressSpace, ThisUnwindRegisters> MyCFIParser;
+typedef CFI_Parser<LocalAddressSpace, NativeUnwindRegisters> MyCFIParser;
// Internal object representing the address space of this process.
static LocalAddressSpace sThisAddressSpace(MyCFIParser::findPCRange);
-typedef UnwindCursor<LocalAddressSpace, ThisUnwindRegisters> ThisUnwindCursor;
+typedef UnwindCursor<LocalAddressSpace, NativeUnwindRegisters> ThisUnwindCursor;
static _Unwind_Reason_Code unwind_phase1(ThisUnwindCursor &cursor,
struct _Unwind_Exception *exc) {
@@ -205,7 +187,7 @@ static _Unwind_Reason_Code unwind_phase2
}
_Unwind_Reason_Code _Unwind_RaiseException(struct _Unwind_Exception *exc) {
- ThisUnwindRegisters registers;
+ NativeUnwindRegisters registers;
ThisUnwindCursor cursor1(registers, sThisAddressSpace);
ThisUnwindCursor cursor2(registers, sThisAddressSpace);
@@ -224,7 +206,7 @@ _Unwind_Reason_Code _Unwind_RaiseExcepti
_Unwind_Reason_Code _Unwind_ForcedUnwind(struct _Unwind_Exception *exc,
_Unwind_Stop_Fn stop, void *stop_arg) {
- ThisUnwindRegisters registers;
+ NativeUnwindRegisters registers;
ThisUnwindCursor cursor(registers, sThisAddressSpace);
// Mark this as forced unwind for _Unwind_Resume().
@@ -235,7 +217,7 @@ _Unwind_Reason_Code _Unwind_ForcedUnwind
}
void _Unwind_Resume(struct _Unwind_Exception *exc) {
- ThisUnwindRegisters registers;
+ NativeUnwindRegisters registers;
ThisUnwindCursor cursor(registers, sThisAddressSpace);
if (exc->private_1 != 0)
@@ -310,7 +292,7 @@ uintptr_t _Unwind_GetLanguageSpecificDat
}
_Unwind_Reason_Code _Unwind_Backtrace(_Unwind_Trace_Fn callback, void *ref) {
- ThisUnwindRegisters registers;
+ NativeUnwindRegisters registers;
ThisUnwindCursor cursor(registers, sThisAddressSpace);
cursor.setInfoBasedOnIPRegister();
@@ -336,7 +318,7 @@ uintptr_t _Unwind_GetCFA(struct _Unwind_
}
void *_Unwind_FindEnclosingFunction(void *pc) {
- ThisUnwindRegisters registers;
+ NativeUnwindRegisters registers;
ThisUnwindCursor cursor(registers, sThisAddressSpace);
unw_proc_info_t info;
Index: src/sys/lib/libz/Makefile
diff -u src/sys/lib/libz/Makefile:1.18 src/sys/lib/libz/Makefile:1.18.26.1
--- src/sys/lib/libz/Makefile:1.18 Sun Oct 30 00:28:57 2011
+++ src/sys/lib/libz/Makefile Sun Aug 10 06:56:02 2014
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.18 2011/10/30 00:28:57 mrg Exp $
+# $NetBSD: Makefile,v 1.18.26.1 2014/08/10 06:56:02 tls Exp $
LIB= z
LIBISPRIVATE= yes
@@ -29,6 +29,6 @@ lib${LIB}.o:: ${OBJS}
@rm -f lib${LIB}.o
@${LD} -r -o lib${LIB}.o `lorder ${OBJS} | tsort`
-.if defined(HAVE_GCC) && ${HAVE_GCC} >= 45 && ${MACHINE_ARCH} == "vax"
+.if defined(HAVE_GCC) && ${MACHINE_ARCH} == "vax"
COPTS.inftrees.c+= -O0
.endif
Added files:
Index: src/sys/lib/libgnuefi/Makefile
diff -u /dev/null src/sys/lib/libgnuefi/Makefile:1.1.6.2
--- /dev/null Sun Aug 10 06:56:02 2014
+++ src/sys/lib/libgnuefi/Makefile Sun Aug 10 06:56:02 2014
@@ -0,0 +1,47 @@
+# $NetBSD: Makefile,v 1.1.6.2 2014/08/10 06:56:02 tls Exp $
+
+LIB= gnuefi
+LIBISPRIVATE?= yes
+
+GNUEFI_USE_CREAD?= no # Read compressed kernels
+GNUEFI_INCLUDE_NET?= yes # Netboot via TFTP, NFS
+GNUEFI_USE_LOADFILE?= no # Generic executable loading support
+GNUEFI_ENABLE_LS_OP?= no # Filesystems ls operation
+
+CPPFLAGS= -I${GNUEFIDIR} ${GNUEFICPPFLAGS} ${GNUEFIMISCCPPFLAGS}
+
+.if ${MACHINE_ARCH} == "i386"
+GNUEFIARCH=ia32
+.else
+GNUEFIARCH=${MACHINE_ARCH}
+.endif
+
+.if defined(GNUEFI_EXTRADIR)
+.-include "${GNUEFI_EXTRADIR}/Makefile.inc"
+.endif
+
+.include <bsd.own.mk>
+
+.PATH.c: ${GNUEFIDIR} ${GNUEFIDIR}/../../external/bsd/gnu-efi/dist/lib/${GNUEFIARCH} ${GNUEFIDIR}/../../external/bsd/gnu-efi/dist/lib ${GNUEFIDIR}/../../external/bsd/gnu-efi/dist/lib/runtime
+
+SRCS+= boxdraw.c smbios.c console.c crc.c data.c debug.c dpath.c \
+ error.c event.c guid.c hand.c hw.c init.c lock.c \
+ misc.c print.c sread.c str.c \
+ rtlock.c efirtlib.c rtstr.c vm.c rtdata.c \
+ initplat.c math.c
+
+COPTS.boxdraw.c= -Wno-missing-field-initializers
+COPTS.guid.c= -Wno-missing-field-initializers
+COPTS.smbios.c= -Wno-int-to-pointer-cast
+COPTS.dpath.c= -Wno-missing-prototypes
+COPTS.print.c= -Wno-missing-prototypes
+COPTS.hw.c= -Wno-shadow
+
+.include <bsd.lib.mk>
+
+lib${LIB}.o:: ${OBJS}
+ @echo building standard ${LIB} library
+ @rm -f lib${LIB}.o
+ @${LD} -r -o lib${LIB}.o `lorder ${OBJS} | tsort`
+
+CPPFLAGS+= -Wno-pointer-sign
Index: src/sys/lib/libgnuefi/Makefile.inc
diff -u /dev/null src/sys/lib/libgnuefi/Makefile.inc:1.1.6.2
--- /dev/null Sun Aug 10 06:56:02 2014
+++ src/sys/lib/libgnuefi/Makefile.inc Sun Aug 10 06:56:02 2014
@@ -0,0 +1,87 @@
+# $NetBSD: Makefile.inc,v 1.1.6.2 2014/08/10 06:56:02 tls Exp $
+#
+# Configuration variables (default values are below):
+#
+# S must be set to the top of the 'sys' tree.
+# GNUEFIDST may be set to the location of the directory where library
+# objects are to be built. Defaults to ${.OBJDIR}/lib/gnuefi.
+# GNUEFI_AS may be set to 'obj' to build a object from the library's
+# object files. (Otherwise, a library will be built.)
+# Defaults to 'library'.
+# GNUEFIMISCCPPFLAGS
+# Miscellaneous cpp flags to be passed to the library's Makefile
+# when building.
+# GNUEFIMISCMAKEFLAGS
+# Miscellaneous flags to be passed to the library's Makefile when
+# building. See library's Makefile for more details about
+# supported flags and their default values.
+
+# Default values:
+GNUEFIDST?= ${.OBJDIR}/lib/gnuefi
+GNUEFI_AS?= library
+GNUEFIDOTDIR?= ../../.
+
+CWARNFLAGS.clang+= -Wno-format-extra-args
+
+GNUEFIDIR= ${S:S@^.@${GNUEFIDOTDIR}@:Q}/lib/libgnuefi
+.if (${GNUEFI_AS} == "obj")
+GNUEFILIB= ${GNUEFIDST}/libgnuefi.o
+GNUEFILIB_PROF= ${GNUEFIDST}/libgnuefi.po
+.else
+GNUEFILIB= ${GNUEFIDST}/libgnuefi.a
+GNUEFILIB_PROF= ${GNUEFIDST}/libgnuefi_p.a
+.endif
+ZLIBSRCDIR:= ${.PARSEDIR}/../../../common/dist/zlib
+GNUEFIMISCCPPFLAGS+=-I${ZLIBSRCDIR}
+
+GNUEFIMAKE= \
+ cd ${GNUEFIDST} && ${MAKE} -f ${GNUEFIDIR:Q}/Makefile \
+ GNUEFIDIR=${GNUEFIDIR:Q} \
+ CC=${CC:Q} CFLAGS=${CFLAGS:Q} CPUFLAGS= \
+ AS=${AS:Q} AFLAGS=${AFLAGS:Q} \
+ LORDER=${LORDER:Q} \
+ TSORT=${TSORT:Q} \
+ LD=${LD:Q} STRIP=${STRIP:Q} \
+ AR=${AR:Q} NM=${NM:Q} \
+ RANLIB=${RANLIB:Q} SIZE=${SIZE:Q} \
+ MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH:Q} \
+ GNUEFICPPFLAGS=${CPPFLAGS:S@^-I.@-I${GNUEFIDOTDIR}@g:Q} \
+ GNUEFIMISCCPPFLAGS=${GNUEFIMISCCPPFLAGS:Q} \
+ ${GNUEFIMISCMAKEFLAGS}
+
+${GNUEFILIB}: .NOTMAIN .MAKE __always_make_gnuefilib
+ @echo making sure the gnuefi library is up to date...
+.if (${GNUEFI_AS} == "library")
+ @${GNUEFIMAKE} libgnuefi.a
+.else
+ @${GNUEFIMAKE} libgnuefi.o
+.endif
+
+${GNUEFILIB_PROF}: .NOTMAIN .MAKE __always_make_gnuefilib
+ @echo making sure the profiled gnuefi library is up to date...
+.if (${GNUEFI_AS} == "library")
+ @${GNUEFIMAKE} libgnuefi_p.a
+.else
+ @${GNUEFIMAKE} libgnuefi.po
+.endif
+
+clean: .NOTMAIN cleangnuefilib
+cleangnuefilib: .NOTMAIN
+ @echo cleaning the gnuefi library objects
+ @if [ -d "${GNUEFIDST}" ]; then ${GNUEFIMAKE} clean; fi
+
+cleandir distclean: .NOTMAIN cleandirgnuefilib
+cleandirgnuefilib: .NOTMAIN
+ @echo cleandiring the gnuefi library objects
+ @if [ -d "${GNUEFIDST}" ]; then ${GNUEFIMAKE} cleandir; fi
+
+dependall depend: .NOTMAIN dependgnuefilib
+dependgnuefilib: .NOTMAIN .MAKE __always_make_gnuefilib
+ @echo depending the gnuefi library objects
+ @${GNUEFIMAKE} depend
+
+__always_make_gnuefilib: .NOTMAIN
+ @mkdir -p ${GNUEFIDST}
+
+.PHONY: __always_make_gnuefilib
+.PHONY: cleangnuefilib cleandirgnuefilib dependgnuefilib
Index: src/sys/lib/libsa/bootcfg.c
diff -u /dev/null src/sys/lib/libsa/bootcfg.c:1.1.2.2
--- /dev/null Sun Aug 10 06:56:02 2014
+++ src/sys/lib/libsa/bootcfg.c Sun Aug 10 06:56:02 2014
@@ -0,0 +1,292 @@
+/* $NetBSD: bootcfg.c,v 1.1.2.2 2014/08/10 06:56:02 tls Exp $ */
+
+/*-
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 <sys/types.h>
+#include <sys/reboot.h>
+
+#include <lib/libsa/stand.h>
+#include <lib/libsa/bootcfg.h>
+#include <lib/libkern/libkern.h>
+
+static int atoi(const char *);
+
+#define isnum(c) ((c) >= '0' && (c) <= '9')
+
+#define MENUFORMAT_AUTO 0
+#define MENUFORMAT_NUMBER 1
+#define MENUFORMAT_LETTER 2
+
+#define DEFAULT_FORMAT MENUFORMAT_AUTO
+#define DEFAULT_TIMEOUT 10
+
+struct bootcfg_def bootcfg_info;
+
+int
+atoi(const char *in)
+{
+ char *c;
+ int ret;
+
+ ret = 0;
+ c = (char *)in;
+ if (*c == '-')
+ c++;
+ for (; isnum(*c); c++)
+ ret = (ret * 10) + (*c - '0');
+
+ return (*in == '-') ? -ret : ret;
+}
+
+void
+bootcfg_do_noop(const char *cmd, char *arg)
+{
+ /* noop, do nothing */
+}
+
+/*
+ * This function parses a boot.cfg file in the root of the filesystem
+ * (if present) and populates the global boot configuration.
+ *
+ * The file consists of a number of lines each terminated by \n
+ * The lines are in the format keyword=value. There should not be spaces
+ * around the = sign.
+ *
+ * perform_bootcfg(conf, command, maxsz)
+ *
+ * conf Path to boot.cfg to be passed verbatim to open()
+ *
+ * command Pointer to a function that will be called when
+ * perform_bootcfg() encounters a key (command) it does not
+ * recognize.
+ * The command function is provided both the keyword and
+ * value parsed as arguments to the function.
+ *
+ * maxsz Limit the size of the boot.cfg perform_bootcfg() will parse.
+ * - If maxsz is < 0 boot.cfg will not be processed.
+ * - If maxsz is = 0 no limit will be imposed but parsing may
+ * fail due to platform or other constraints e.g. maximum
+ * segment size.
+ * - If 0 < maxsz and boot.cfg exceeds maxsz it will not be
+ * parsed, otherwise it will be parsed.
+ *
+ * The recognised keywords are:
+ * banner: text displayed instead of the normal welcome text
+ * menu: Descriptive text:command to use
+ * timeout: Timeout in seconds (overrides that set by installboot)
+ * default: the default menu option to use if Return is pressed
+ * consdev: the console device to use
+ * format: how menu choices are displayed: (a)utomatic, (n)umbers or (l)etters
+ * clear: whether to clear the screen or not
+ *
+ * Example boot.cfg file:
+ * banner=Welcome to NetBSD
+ * banner=Please choose the boot type from the following menu
+ * menu=Boot NetBSD:boot netbsd
+ * menu=Boot into single user mode:boot netbsd -s
+ * menu=:boot hd1a:netbsd -cs
+ * menu=Goto boot comand line:prompt
+ * timeout=10
+ * consdev=com0
+ * default=1
+*/
+void
+perform_bootcfg(const char *conf, bootcfg_command command, const off_t maxsz)
+{
+ char *bc, *c;
+ int cmenu, cbanner, len;
+ int fd, err, off;
+ struct stat st;
+ char *next, *key, *value, *v2;
+
+ /* clear bootcfg structure */
+ memset(&bootcfg_info, 0, sizeof(bootcfg_info));
+
+ /* set default timeout */
+ bootcfg_info.timeout = DEFAULT_TIMEOUT;
+
+ /* automatically switch between letter and numbers on menu */
+ bootcfg_info.menuformat = DEFAULT_FORMAT;
+
+ fd = open(conf, 0);
+ if (fd < 0)
+ return;
+
+ err = fstat(fd, &st);
+ if (err == -1) {
+ close(fd);
+ return;
+ }
+
+ /* if a maximum size is being requested for the boot.cfg enforce it. */
+ if (0 < maxsz && st.st_size > maxsz) {
+ close(fd);
+ return;
+ }
+
+ bc = alloc(st.st_size + 1);
+ if (bc == NULL) {
+ printf("Could not allocate memory for boot configuration\n");
+ close(fd);
+ return;
+ }
+
+ /*
+ * XXX original code, assumes error or eof return from read()
+ * results in the entire boot.cfg being buffered.
+ * - should bail out on read() failing.
+ * - assumption is made that the file size doesn't change between
+ * fstat() and read()ing. probably safe in this context
+ * arguably should check that reading the file won't overflow
+ * the storage anyway.
+ */
+ off = 0;
+ do {
+ len = read(fd, bc + off, 1024);
+ if (len <= 0)
+ break;
+ off += len;
+ } while (len > 0);
+ bc[off] = '\0';
+
+ close(fd);
+
+ /* bc is now assumed to contain the whole boot.cfg file (see above) */
+
+ cmenu = 0;
+ cbanner = 0;
+ for (c = bc; *c; c = next) {
+ key = c;
+ /* find end of line */
+ for (; *c && *c != '\n'; c++)
+ /* zero terminate line on start of comment */
+ if (*c == '#')
+ *c = 0;
+ /* zero terminate line */
+ if (*(next = c))
+ *next++ = 0;
+ /* Look for = separator between key and value */
+ for (c = key; *c && *c != '='; c++)
+ continue;
+ /* Ignore lines with no key=value pair */
+ if (*c == '\0')
+ continue;
+
+ /* zero terminate key which points to keyword */
+ *c++ = 0;
+ value = c;
+ /* Look for end of line (or file) and zero terminate value */
+ for (; *c && *c != '\n'; c++)
+ continue;
+ *c = 0;
+
+ if (!strncmp(key, "menu", 4)) {
+ /*
+ * Parse "menu=<description>:<command>". If the
+ * description is empty ("menu=:<command>)",
+ * then re-use the command as the description.
+ * Note that the command may contain embedded
+ * colons.
+ */
+ if (cmenu >= BOOTCFG_MAXMENU)
+ continue;
+ bootcfg_info.desc[cmenu] = value;
+ for (v2 = value; *v2 && *v2 != ':'; v2++)
+ continue;
+ if (*v2) {
+ *v2++ = 0;
+ bootcfg_info.command[cmenu] = v2;
+ if (! *value)
+ bootcfg_info.desc[cmenu] = v2;
+ cmenu++;
+ } else {
+ /* No delimiter means invalid line */
+ bootcfg_info.desc[cmenu] = NULL;
+ }
+ } else if (!strncmp(key, "banner", 6)) {
+ if (cbanner < BOOTCFG_MAXBANNER)
+ bootcfg_info.banner[cbanner++] = value;
+ } else if (!strncmp(key, "timeout", 7)) {
+ if (!isnum(*value))
+ bootcfg_info.timeout = -1;
+ else
+ bootcfg_info.timeout = atoi(value);
+ } else if (!strncmp(key, "default", 7)) {
+ bootcfg_info.def = atoi(value) - 1;
+ } else if (!strncmp(key, "consdev", 7)) {
+ bootcfg_info.consdev = value;
+ } else if (!strncmp(key, BOOTCFG_CMD_LOAD, 4)) {
+ command(BOOTCFG_CMD_LOAD, value);
+ } else if (!strncmp(key, "format", 6)) {
+ printf("value:%c\n", *value);
+ switch (*value) {
+ case 'a':
+ case 'A':
+ bootcfg_info.menuformat = MENUFORMAT_AUTO;
+ break;
+
+ case 'n':
+ case 'N':
+ case 'd':
+ case 'D':
+ bootcfg_info.menuformat = MENUFORMAT_NUMBER;
+ break;
+
+ case 'l':
+ case 'L':
+ bootcfg_info.menuformat = MENUFORMAT_LETTER;
+ break;
+ }
+ } else if (!strncmp(key, "clear", 5)) {
+ bootcfg_info.clear = !!atoi(value);
+ } else if (!strncmp(key, BOOTCFG_CMD_USERCONF, 8)) {
+ command(BOOTCFG_CMD_USERCONF, value);
+ } else {
+ command(key, value);
+ }
+ }
+
+ switch (bootcfg_info.menuformat) {
+ case MENUFORMAT_AUTO:
+ if (cmenu > 9 && bootcfg_info.timeout > 0)
+ bootcfg_info.menuformat = MENUFORMAT_LETTER;
+ else
+ bootcfg_info.menuformat = MENUFORMAT_NUMBER;
+ break;
+
+ case MENUFORMAT_NUMBER:
+ if (cmenu > 9 && bootcfg_info.timeout > 0)
+ cmenu = 9;
+ break;
+ }
+
+ bootcfg_info.nummenu = cmenu;
+ if (bootcfg_info.def < 0)
+ bootcfg_info.def = 0;
+ if (bootcfg_info.def >= cmenu)
+ bootcfg_info.def = cmenu - 1;
+}
Index: src/sys/lib/libsa/bootcfg.h
diff -u /dev/null src/sys/lib/libsa/bootcfg.h:1.1.2.2
--- /dev/null Sun Aug 10 06:56:02 2014
+++ src/sys/lib/libsa/bootcfg.h Sun Aug 10 06:56:02 2014
@@ -0,0 +1,56 @@
+/* $NetBSD: bootcfg.h,v 1.1.2.2 2014/08/10 06:56:02 tls Exp $ */
+
+/*-
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+#ifndef _BOOTCFG_H
+#define _BOOTCFG_H
+
+#define BOOTCFG_FILENAME "boot.cfg"
+#define BOOTCFG_MAXMENU 20
+#define BOOTCFG_MAXBANNER 12
+
+#define BOOTCFG_CMD_LOAD "load"
+#define BOOTCFG_CMD_USERCONF "userconf"
+
+typedef void (*bootcfg_command)(const char *cmd, char *arg);
+
+struct bootcfg_def {
+ char *banner[BOOTCFG_MAXBANNER]; /* Banner text */
+ char *command[BOOTCFG_MAXMENU]; /* Menu commands per entry*/
+ char *consdev; /* Console device */
+ int def; /* Default menu option */
+ char *desc[BOOTCFG_MAXMENU]; /* Menu text per entry */
+ int nummenu; /* Number of menu items */
+ int timeout; /* Timeout in seconds */
+ int menuformat; /* Letters instead of numbers */
+ int clear; /* Clear the screen? */
+} extern bootcfg_info;
+
+void perform_bootcfg(const char *, bootcfg_command, const off_t);
+void bootcfg_do_noop(const char *, char *);
+
+#endif /* !_BOOTCFG_H */