diff options
author | sjg <sjg@FreeBSD.org> | 2013-09-05 20:18:59 +0000 |
---|---|---|
committer | sjg <sjg@FreeBSD.org> | 2013-09-05 20:18:59 +0000 |
commit | 62bb1062226d3ce6a2350808256a25508978352d (patch) | |
tree | 22b131dceb13c3df96da594fbaadb693504797c7 /lib/libstand | |
parent | 72ab90509b3a51ab361bf710338f2ef44a4e360d (diff) | |
parent | 04932445481c2cb89ff69a83b961bdef3d64757e (diff) | |
download | FreeBSD-src-62bb1062226d3ce6a2350808256a25508978352d.zip FreeBSD-src-62bb1062226d3ce6a2350808256a25508978352d.tar.gz |
Merge from head
Diffstat (limited to 'lib/libstand')
-rw-r--r-- | lib/libstand/Makefile | 7 | ||||
-rw-r--r-- | lib/libstand/arm/_setjmp.S | 106 | ||||
-rw-r--r-- | lib/libstand/ext2fs.c | 2 | ||||
-rw-r--r-- | lib/libstand/mips/_setjmp.S | 81 | ||||
-rw-r--r-- | lib/libstand/nfs.c | 5 |
5 files changed, 34 insertions, 167 deletions
diff --git a/lib/libstand/Makefile b/lib/libstand/Makefile index 2886e92..506b564 100644 --- a/lib/libstand/Makefile +++ b/lib/libstand/Makefile @@ -36,6 +36,9 @@ CFLAGS+= -m32 -I. .if ${MACHINE_CPUARCH} == "arm" CFLAGS+= -msoft-float -D_STANDALONE .endif +.if ${MACHINE_CPUARCH} == "mips" +CFLAGS+= -G0 -fno-pic -mno-abicalls +.endif # standalone components and stuff we have modified locally SRCS+= gzguts.h zutil.h __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \ @@ -51,9 +54,7 @@ SRCS+= ntoh.c # string functions from libc .PATH: ${.CURDIR}/../libc/string -.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "powerpc" || \ - ${MACHINE_CPUARCH} == "sparc64" || ${MACHINE_CPUARCH} == "amd64" || \ - ${MACHINE_CPUARCH} == "arm" +.if ${MACHINE_CPUARCH} != "ia64" SRCS+= bcmp.c bcopy.c bzero.c ffs.c memccpy.c memchr.c memcmp.c memcpy.c \ memmove.c memset.c qdivrem.c strcat.c strchr.c strcmp.c strcpy.c \ strcspn.c strlen.c strncat.c strncmp.c strncpy.c strpbrk.c \ diff --git a/lib/libstand/arm/_setjmp.S b/lib/libstand/arm/_setjmp.S deleted file mode 100644 index 631213f..0000000 --- a/lib/libstand/arm/_setjmp.S +++ /dev/null @@ -1,106 +0,0 @@ -/* $NetBSD: _setjmp.S,v 1.5 2003/04/05 23:08:51 bjh21 Exp $ */ - -/* - * Copyright (c) 1997 Mark Brinicombe - * 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. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Mark Brinicombe - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * 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$"); - -#define SOFTFLOAT /* XXX */ -/* - * C library -- _setjmp, _longjmp - * - * _longjmp(a,v) - * will generate a "return(v)" from the last call to - * _setjmp(a) - * by restoring registers from the stack. - * The previous signal state is NOT restored. - * - * Note: r0 is the return value - * r1-r3 are scratch registers in functions - */ - -ENTRY(_setjmp) - ldr r1, .L_setjmp_magic - str r1, [r0], #4 -#ifdef SOFTFLOAT - add r0, r0, #52 -#else - /* Store fp registers */ - sfm f4, 4, [r0], #48 - /* Store fpsr */ - rfs r1 - str r1, [r0], #0x0004 -#endif /* SOFTFLOAT */ - /* Store integer registers */ - stmia r0, {r4-r14} - - mov r0, #0x00000000 - mov r15, r14 - -.L_setjmp_magic: - .word _JB_MAGIC__SETJMP - -ENTRY(_longjmp) - ldr r2, .L_setjmp_magic - ldr r3, [r0], #4 - teq r2, r3 - bne botch - -#ifdef SOFTFLOAT - add r0, r0, #52 -#else - /* Restore fp registers */ - lfm f4, 4, [r0], #48 - /* Restore fpsr */ - ldr r4, [r0], #0x0004 - wfs r4 -#endif /* SOFTFLOAT */ - /* Restore integer registers */ - ldmia r0, {r4-r14} - - /* Validate sp and r14 */ - teq sp, #0 - teqne r14, #0 - beq botch - - /* Set return value */ - mov r0, r1 - teq r0, #0x00000000 - moveq r0, #0x00000001 - mov r15, r14 - - /* validation failed, die die die. */ -botch: - bl PIC_SYM(_C_LABEL(longjmperror), PLT) - bl PIC_SYM(_C_LABEL(abort), PLT) - b . - 8 /* Cannot get here */ diff --git a/lib/libstand/ext2fs.c b/lib/libstand/ext2fs.c index 1bd78e2..e0afb3e 100644 --- a/lib/libstand/ext2fs.c +++ b/lib/libstand/ext2fs.c @@ -536,6 +536,7 @@ ext2fs_open(const char *upath, struct open_file *f) * Found terminal component. */ error = 0; + fp->f_seekp = 0; out: if (buf) free(buf); @@ -584,6 +585,7 @@ read_inode(ino_t inumber, struct open_file *f) for (level = 0; level < NIADDR; level++) fp->f_blkno[level] = -1; fp->f_buf_blkno = -1; + fp->f_seekp = 0; out: free(buf); diff --git a/lib/libstand/mips/_setjmp.S b/lib/libstand/mips/_setjmp.S index 2ec7516..0289b0e 100644 --- a/lib/libstand/mips/_setjmp.S +++ b/lib/libstand/mips/_setjmp.S @@ -59,33 +59,19 @@ LEAF(_setjmp) .set noreorder - li v0, 0xACEDBADE # sigcontext magic number - sw ra, (2 * 4)(a0) # sc_pc = return address - sw v0, (3 * 4)(a0) # saved in sc_regs[0] - sw s0, ((S0 + 3) * 4)(a0) - sw s1, ((S1 + 3) * 4)(a0) - sw s2, ((S2 + 3) * 4)(a0) - sw s3, ((S3 + 3) * 4)(a0) - sw s4, ((S4 + 3) * 4)(a0) - sw s5, ((S5 + 3) * 4)(a0) - sw s6, ((S6 + 3) * 4)(a0) - sw s7, ((S7 + 3) * 4)(a0) - sw sp, ((SP + 3) * 4)(a0) - sw s8, ((S8 + 3) * 4)(a0) - cfc1 v0, $31 # too bad cant check if FP used - swc1 $f20, ((20 + 38) * 4)(a0) - swc1 $f21, ((21 + 38) * 4)(a0) - swc1 $f22, ((22 + 38) * 4)(a0) - swc1 $f23, ((23 + 38) * 4)(a0) - swc1 $f24, ((24 + 38) * 4)(a0) - swc1 $f25, ((25 + 38) * 4)(a0) - swc1 $f26, ((26 + 38) * 4)(a0) - swc1 $f27, ((27 + 38) * 4)(a0) - swc1 $f28, ((28 + 38) * 4)(a0) - swc1 $f29, ((29 + 38) * 4)(a0) - swc1 $f30, ((30 + 38) * 4)(a0) - swc1 $f31, ((31 + 38) * 4)(a0) - sw v0, ((32 + 38) * 4)(a0) + REG_LI v0, 0xACEDBADE # sigcontext magic number + REG_S ra, (2 * SZREG)(a0) # sc_pc = return address + REG_S v0, (3 * SZREG)(a0) # saved in sc_regs[0] + REG_S s0, ((S0 + 3) * SZREG)(a0) + REG_S s1, ((S1 + 3) * SZREG)(a0) + REG_S s2, ((S2 + 3) * SZREG)(a0) + REG_S s3, ((S3 + 3) * SZREG)(a0) + REG_S s4, ((S4 + 3) * SZREG)(a0) + REG_S s5, ((S5 + 3) * SZREG)(a0) + REG_S s6, ((S6 + 3) * SZREG)(a0) + REG_S s7, ((S7 + 3) * SZREG)(a0) + REG_S sp, ((SP + 3) * SZREG)(a0) + REG_S s8, ((S8 + 3) * SZREG)(a0) j ra move v0, zero END(_setjmp) @@ -96,38 +82,21 @@ LEAF(_longjmp) .cprestore 16 #endif .set noreorder - lw v0, (3 * 4)(a0) # get magic number - lw ra, (2 * 4)(a0) + REG_L v0, (3 * SZREG)(a0) # get magic number + REG_L ra, (2 * SZREG)(a0) bne v0, 0xACEDBADE, botch # jump if error addu sp, sp, 32 # does not matter, sanity - lw s0, ((S0 + 3) * 4)(a0) - lw s1, ((S1 + 3) * 4)(a0) - lw s2, ((S2 + 3) * 4)(a0) - lw s3, ((S3 + 3) * 4)(a0) - lw s4, ((S4 + 3) * 4)(a0) - lw s5, ((S5 + 3) * 4)(a0) - lw s6, ((S6 + 3) * 4)(a0) - lw s7, ((S7 + 3) * 4)(a0) - lw v0, ((32 + 38) * 4)(a0) # get fpu status - lw sp, ((SP + 3) * 4)(a0) - lw s8, ((S8 + 3) * 4)(a0) -/* Octeon does not have an FPU */ -#if !defined(_MIPS_ARCH_OCTEON) - ctc1 v0, $31 - lwc1 $f20, ((20 + 38) * 4)(a0) - lwc1 $f21, ((21 + 38) * 4)(a0) - lwc1 $f22, ((22 + 38) * 4)(a0) - lwc1 $f23, ((23 + 38) * 4)(a0) - lwc1 $f24, ((24 + 38) * 4)(a0) - lwc1 $f25, ((25 + 38) * 4)(a0) - lwc1 $f26, ((26 + 38) * 4)(a0) - lwc1 $f27, ((27 + 38) * 4)(a0) - lwc1 $f28, ((28 + 38) * 4)(a0) - lwc1 $f29, ((29 + 38) * 4)(a0) - lwc1 $f30, ((30 + 38) * 4)(a0) - lwc1 $f31, ((31 + 38) * 4)(a0) -#endif /* _MIPS_ARCH_OCTEON */ + REG_L s0, ((S0 + 3) * SZREG)(a0) + REG_L s1, ((S1 + 3) * SZREG)(a0) + REG_L s2, ((S2 + 3) * SZREG)(a0) + REG_L s3, ((S3 + 3) * SZREG)(a0) + REG_L s4, ((S4 + 3) * SZREG)(a0) + REG_L s5, ((S5 + 3) * SZREG)(a0) + REG_L s6, ((S6 + 3) * SZREG)(a0) + REG_L s7, ((S7 + 3) * SZREG)(a0) + REG_L sp, ((SP + 3) * SZREG)(a0) + REG_L s8, ((S8 + 3) * SZREG)(a0) j ra move v0, a1 diff --git a/lib/libstand/nfs.c b/lib/libstand/nfs.c index a7a7ccb..adb0a11 100644 --- a/lib/libstand/nfs.c +++ b/lib/libstand/nfs.c @@ -1465,8 +1465,9 @@ nfs_readdir(struct open_file *f, struct dirent *d) d->d_name[d->d_namlen] = '\0'; pos = roundup(d->d_namlen, sizeof(uint32_t)) / sizeof(uint32_t); - fp->off = cookie = ((uint64_t)ntohl(rent->nameplus[pos++]) << 32) | - ntohl(rent->nameplus[pos++]); + fp->off = cookie = ((uint64_t)ntohl(rent->nameplus[pos]) << 32) | + ntohl(rent->nameplus[pos + 1]); + pos += 2; buf = (u_char *)&rent->nameplus[pos]; return (0); } |