From owner-p4-projects@FreeBSD.ORG Sun Apr 14 17:30:29 2013 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 328BEEBD; Sun, 14 Apr 2013 17:30:29 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E8B0EEBB for ; Sun, 14 Apr 2013 17:30:28 +0000 (UTC) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:1900:2254:2068::682:0]) by mx1.freebsd.org (Postfix) with ESMTP id D9EC9A3D for ; Sun, 14 Apr 2013 17:30:28 +0000 (UTC) Received: from skunkworks.freebsd.org ([127.0.1.74]) by skunkworks.freebsd.org (8.14.6/8.14.6) with ESMTP id r3EHUSwI077843 for ; Sun, 14 Apr 2013 17:30:28 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.6/8.14.6/Submit) id r3EHUS2J077840 for perforce@freebsd.org; Sun, 14 Apr 2013 17:30:28 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Sun, 14 Apr 2013 17:30:28 GMT Message-Id: <201304141730.r3EHUS2J077840@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson Subject: PERFORCE change 227709 for review To: Perforce Change Reviews Precedence: bulk X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.14 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Apr 2013 17:30:29 -0000 http://p4web.freebsd.org/@@227709?ac=10 Change 227709 by rwatson@rwatson_zenith_cl_cam_ac_uk on 2013/04/14 17:30:12 Integrate bz's @227630 from FreeBSD/BERI to CheriBSD: Implement soft reset setting sr in sr and just in case loop endlessly afterwards. X-TODO: revisit for cheri2/SMP. Affected files ... .. //depot/projects/ctsrd/cheribsd/src/sys/mips/beri/beri_machdep.c#7 integrate Differences ... ==== //depot/projects/ctsrd/cheribsd/src/sys/mips/beri/beri_machdep.c#7 (text+ko) ==== @@ -116,14 +116,19 @@ /* * Perform a board-level soft-reset. - * - * XXXRW: BERI doesn't yet have a board-level soft-reset. */ void platform_reset(void) { - panic("%s: not yet", __func__); + /* XXX SMP will likely require us to do more. */ + __asm__ __volatile__( + "mfc0 $k0, $12\n\t" + "li $k1, 0x00100000\n\t" + "or $k0, $k0, $k1\n\t" + "mtc0 $k0, $12\n"); + for( ; ; ) + __asm__ __volatile("wait"); } void From owner-p4-projects@FreeBSD.ORG Mon Apr 15 14:21:14 2013 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 51D41ADA; Mon, 15 Apr 2013 14:21:14 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 0FBE8AD8 for ; Mon, 15 Apr 2013 14:21:14 +0000 (UTC) (envelope-from prw35@FreeBSD.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:1900:2254:2068::682:0]) by mx1.freebsd.org (Postfix) with ESMTP id 022992A8 for ; Mon, 15 Apr 2013 14:21:14 +0000 (UTC) Received: from skunkworks.freebsd.org ([127.0.1.74]) by skunkworks.freebsd.org (8.14.6/8.14.6) with ESMTP id r3FELDxT014039 for ; Mon, 15 Apr 2013 14:21:13 GMT (envelope-from prw35@FreeBSD.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.6/8.14.6/Submit) id r3FELDAg014036 for perforce@freebsd.org; Mon, 15 Apr 2013 14:21:13 GMT (envelope-from prw35@FreeBSD.org) Date: Mon, 15 Apr 2013 14:21:13 GMT Message-Id: <201304151421.r3FELDAg014036@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to prw35@FreeBSD.org using -f From: Philip Withnall Subject: PERFORCE change 227731 for review To: Perforce Change Reviews Precedence: bulk X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.14 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Apr 2013 14:21:14 -0000 http://p4web.freebsd.org/@@227731?ac=10 Change 227731 by prw35@pwithnall_zenith on 2013/04/15 14:20:28 Force 32-byte stack alignment in GCC on MIPS This is necessary for CHERI, where capabilities must be 32-byte aligned, so the stack must always be 32-byte aligned to allow capabilities to be stored there. Affected files ... .. //depot/projects/ctsrd/cheribsd/src/contrib/gcc/config/mips/mips.h#2 edit Differences ... ==== //depot/projects/ctsrd/cheribsd/src/contrib/gcc/config/mips/mips.h#2 (text+ko) ==== @@ -2000,9 +2000,10 @@ #define EPILOGUE_USES(REGNO) ((REGNO) == 31) /* Treat LOC as a byte offset from the stack pointer and round it up - to the next fully-aligned offset. */ -#define MIPS_STACK_ALIGN(LOC) \ - (TARGET_NEWABI ? ((LOC) + 15) & -16 : ((LOC) + 7) & -8) + to the next fully-aligned offset. + For CHERI, this has to be 32 bytes to allow capabilities to be + stored on the stack. */ +#define MIPS_STACK_ALIGN(LOC) (((LOC) + 31) & -32) /* Implement `va_start' for varargs and stdarg. */ From owner-p4-projects@FreeBSD.ORG Mon Apr 15 20:44:18 2013 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id DCB9AC0D; Mon, 15 Apr 2013 20:44:17 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 9A612C0B for ; Mon, 15 Apr 2013 20:44:17 +0000 (UTC) (envelope-from brooks@freebsd.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:1900:2254:2068::682:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8B8761AAF for ; Mon, 15 Apr 2013 20:44:17 +0000 (UTC) Received: from skunkworks.freebsd.org ([127.0.1.74]) by skunkworks.freebsd.org (8.14.6/8.14.6) with ESMTP id r3FKiHBc055277 for ; Mon, 15 Apr 2013 20:44:17 GMT (envelope-from brooks@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.6/8.14.6/Submit) id r3FKiHXa055274 for perforce@freebsd.org; Mon, 15 Apr 2013 20:44:17 GMT (envelope-from brooks@freebsd.org) Date: Mon, 15 Apr 2013 20:44:17 GMT Message-Id: <201304152044.r3FKiHXa055274@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to brooks@freebsd.org using -f From: Brooks Davis Subject: PERFORCE change 227750 for review To: Perforce Change Reviews Precedence: bulk X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.14 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Apr 2013 20:44:18 -0000 http://p4web.freebsd.org/@@227750?ac=10 Change 227750 by brooks@brooks_zenith on 2013/04/15 20:43:21 Reset the exec indicator global on each use so we don't make all images red after the first exec backdoor is used. Reported by: rwatson Affected files ... .. //depot/projects/ctsrd/cheribsd/src/ctsrd-lib/libimagebox/decode_png.c#7 edit Differences ... ==== //depot/projects/ctsrd/cheribsd/src/ctsrd-lib/libimagebox/decode_png.c#7 (text+ko) ==== @@ -55,6 +55,8 @@ png_infop end_info = NULL; png_bytep *rows = NULL; + png_exec_triggered = 0; + ids->is->times[1] = sysarch(MIPS_GET_COUNT, 0); if ((png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, From owner-p4-projects@FreeBSD.ORG Mon Apr 15 23:18:09 2013 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 95851A2C; Mon, 15 Apr 2013 23:18:09 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 56218A2A for ; Mon, 15 Apr 2013 23:18:09 +0000 (UTC) (envelope-from brooks@freebsd.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:1900:2254:2068::682:0]) by mx1.freebsd.org (Postfix) with ESMTP id 46D351F95 for ; Mon, 15 Apr 2013 23:18:09 +0000 (UTC) Received: from skunkworks.freebsd.org ([127.0.1.74]) by skunkworks.freebsd.org (8.14.6/8.14.6) with ESMTP id r3FNI8eT070494 for ; Mon, 15 Apr 2013 23:18:08 GMT (envelope-from brooks@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.6/8.14.6/Submit) id r3FNI8nn070491 for perforce@freebsd.org; Mon, 15 Apr 2013 23:18:08 GMT (envelope-from brooks@freebsd.org) Date: Mon, 15 Apr 2013 23:18:08 GMT Message-Id: <201304152318.r3FNI8nn070491@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to brooks@freebsd.org using -f From: Brooks Davis Subject: PERFORCE change 227753 for review To: Perforce Change Reviews Precedence: bulk X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.14 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Apr 2013 23:18:09 -0000 http://p4web.freebsd.org/@@227753?ac=10 Change 227753 by brooks@brooks_zenith on 2013/04/15 23:17:28 Use setusercontext() to more throughly set up the terminal context. The useful effect of this change is that PATH is set to a useful value. Reported by: rwatson Affected files ... .. //depot/projects/ctsrd/cheribsd/src/ctsrd/pictview/pictview.c#10 edit Differences ... ==== //depot/projects/ctsrd/cheribsd/src/ctsrd/pictview/pictview.c#10 (text+ko) ==== @@ -43,7 +43,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -193,6 +195,8 @@ start_keyboard_shell(void) { int pmaster, pslave; + login_cap_t *lcap = NULL; + struct passwd *pwd = NULL; if (openpty(&pmaster, &pslave, NULL, NULL, NULL) == -1) err(1, "openpty"); @@ -208,6 +212,15 @@ syslog(LOG_ALERT, "login_tty failed in child: %s", strerror(errno)); err(1, "tty_login"); } + + if ((pwd = getpwuid(getuid())) == NULL) + err(1, "getpwuid: %s", getuid()); + if ((lcap = login_getpwclass(pwd)) == NULL) + err(1, "login_getpwclass"); + if (setusercontext(lcap, pwd, pwd->pw_uid, + LOGIN_SETALL & ~LOGIN_SETGROUP & ~LOGIN_SETLOGIN) != 0) + err(1, "setusercontext"); + execl("/bin/sh", "sh", NULL); syslog(LOG_ALERT, "exec of /bin/sh failed: %s", strerror(errno)); err(1, "execl()"); From owner-p4-projects@FreeBSD.ORG Tue Apr 16 13:55:09 2013 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 491A2CB0; Tue, 16 Apr 2013 13:55:09 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 09E53CAE for ; Tue, 16 Apr 2013 13:55:09 +0000 (UTC) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:1900:2254:2068::682:0]) by mx1.freebsd.org (Postfix) with ESMTP id D28B3D7F for ; Tue, 16 Apr 2013 13:55:08 +0000 (UTC) Received: from skunkworks.freebsd.org ([127.0.1.74]) by skunkworks.freebsd.org (8.14.6/8.14.6) with ESMTP id r3GDt8sr063295 for ; Tue, 16 Apr 2013 13:55:08 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.6/8.14.6/Submit) id r3GDt8fF063292 for perforce@freebsd.org; Tue, 16 Apr 2013 13:55:08 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Tue, 16 Apr 2013 13:55:08 GMT Message-Id: <201304161355.r3GDt8fF063292@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson Subject: PERFORCE change 227765 for review To: Perforce Change Reviews Precedence: bulk X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.14 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 13:55:09 -0000 http://p4web.freebsd.org/@@227765?ac=10 Change 227765 by rwatson@rwatson_zenith_cl_cam_ac_uk on 2013/04/16 13:54:52 More firmly trim FP support from libstand's MIPS setjmp/longjmp, as apparently it doesn't really belong there in the first place. Affected files ... .. //depot/projects/ctsrd/beribsd/src/lib/libstand/mips/_setjmp.S#5 edit Differences ... ==== //depot/projects/ctsrd/beribsd/src/lib/libstand/mips/_setjmp.S#5 (text+ko) ==== @@ -72,22 +72,6 @@ REG_S s7, ((S7 + 3) * SZREG)(a0) REG_S sp, ((SP + 3) * SZREG)(a0) REG_S s8, ((S8 + 3) * SZREG)(a0) -/* XXXRW: Don't try to save/restore FP in libstand. */ -#if 0 - cfc1 v0, $31 # too bad cant check if FP used - FP_S $f20, ((20 + 38) * SZREG)(a0) - FP_S $f21, ((21 + 38) * SZREG)(a0) - FP_S $f22, ((22 + 38) * SZREG)(a0) - FP_S $f23, ((23 + 38) * SZREG)(a0) - FP_S $f24, ((24 + 38) * SZREG)(a0) - FP_S $f25, ((25 + 38) * SZREG)(a0) - FP_S $f26, ((26 + 38) * SZREG)(a0) - FP_S $f27, ((27 + 38) * SZREG)(a0) - FP_S $f28, ((28 + 38) * SZREG)(a0) - FP_S $f29, ((29 + 38) * SZREG)(a0) - FP_S $f30, ((30 + 38) * SZREG)(a0) - FP_S $f31, ((31 + 38) * SZREG)(a0) -#endif REG_S v0, ((32 + 38) * SZREG)(a0) j ra move v0, zero @@ -115,25 +99,6 @@ REG_L v0, ((32 + 38) * SZREG)(a0) # get fpu status REG_L sp, ((SP + 3) * SZREG)(a0) REG_L s8, ((S8 + 3) * SZREG)(a0) -/* XXXRW: Don't try to save/restore FP in libstand. */ -#if 0 -/* Octeon does not have an FPU */ -#if !defined(_MIPS_ARCH_OCTEON) - ctc1 v0, $31 - FP_L $f20, ((20 + 38) * SZREG)(a0) - FP_L $f21, ((21 + 38) * SZREG)(a0) - FP_L $f22, ((22 + 38) * SZREG)(a0) - FP_L $f23, ((23 + 38) * SZREG)(a0) - FP_L $f24, ((24 + 38) * SZREG)(a0) - FP_L $f25, ((25 + 38) * SZREG)(a0) - FP_L $f26, ((26 + 38) * SZREG)(a0) - FP_L $f27, ((27 + 38) * SZREG)(a0) - FP_L $f28, ((28 + 38) * SZREG)(a0) - FP_L $f29, ((29 + 38) * SZREG)(a0) - FP_L $f30, ((30 + 38) * SZREG)(a0) - FP_L $f31, ((31 + 38) * SZREG)(a0) -#endif /* _MIPS_ARCH_OCTEON */ -#endif j ra move v0, a1 From owner-p4-projects@FreeBSD.ORG Wed Apr 17 13:21:47 2013 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 959A9D50; Wed, 17 Apr 2013 13:21:47 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 45112D4E for ; Wed, 17 Apr 2013 13:21:47 +0000 (UTC) (envelope-from prw35@FreeBSD.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:1900:2254:2068::682:0]) by mx1.freebsd.org (Postfix) with ESMTP id 365BD8C5 for ; Wed, 17 Apr 2013 13:21:47 +0000 (UTC) Received: from skunkworks.freebsd.org ([127.0.1.74]) by skunkworks.freebsd.org (8.14.6/8.14.6) with ESMTP id r3HDLkwa017874 for ; Wed, 17 Apr 2013 13:21:46 GMT (envelope-from prw35@FreeBSD.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.6/8.14.6/Submit) id r3HDLkmM017870 for perforce@freebsd.org; Wed, 17 Apr 2013 13:21:46 GMT (envelope-from prw35@FreeBSD.org) Date: Wed, 17 Apr 2013 13:21:46 GMT Message-Id: <201304171321.r3HDLkmM017870@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to prw35@FreeBSD.org using -f From: Philip Withnall Subject: PERFORCE change 227808 for review To: Perforce Change Reviews Precedence: bulk X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.14 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 13:21:48 -0000 http://p4web.freebsd.org/@@227808?ac=10 Change 227808 by prw35@pwithnall_zenith on 2013/04/17 13:21:22 Align the stack to a 32-byte boundary on program initialisation in csu This is necessary for CHERI, as capabilities must be 32-byte aligned. This changelist splits crt1.c into two files: crt1_s.S and crt1_c.c. The former contains __start: a thin assembly stub which re-aligns the stack then calls _start1 using normal calling conventions. _start1 is in crt1_c.c, and it performs the rest of the program initialisation, handing off to main() in the end. This is based on the stack re-alignment code in csu's i386 backend. Affected files ... .. //depot/projects/ctsrd/cheribsd/src/lib/csu/mips/Makefile#4 edit .. //depot/projects/ctsrd/cheribsd/src/lib/csu/mips/crt1.c#4 delete .. //depot/projects/ctsrd/cheribsd/src/lib/csu/mips/crt1_c.c#1 add .. //depot/projects/ctsrd/cheribsd/src/lib/csu/mips/crt1_s.S#1 add Differences ... ==== //depot/projects/ctsrd/cheribsd/src/lib/csu/mips/Makefile#4 (text+ko) ==== @@ -2,43 +2,73 @@ .PATH: ${.CURDIR}/../common -SRCS= crt1.c crti.S crtn.S -OBJS= ${SRCS:N*.h:R:S/$/.o/g} -OBJS+= Scrt1.o gcrt1.o +SRCS= crti.S crtn.S +FILES= ${SRCS:N*.h:R:S/$/.o/g} gcrt1.o crt1.o Scrt1.o +FILESOWN= ${LIBOWN} +FILESGRP= ${LIBGRP} +FILESMODE= ${LIBMODE} +FILESDIR= ${LIBDIR} CFLAGS+= -I${.CURDIR}/../common \ - -I${.CURDIR}/../../libc/include + -I${.CURDIR}/../../libc/include \ + -DCHERI # XXX: this should be a build system option +CLEANFILES= ${FILES} crt1_c.o crt1_s.o gcrt1_c.o Scrt1_c.o +CLEANFILES+= crt1_c.s gcrt1_c.s Scrt1_c.s -all: ${OBJS} - -CLEANFILES= ${OBJS} -CLEANFILES+= crt1.s gcrt1.s Scrt1.s - -# See the comment in lib/csu/common/crtbrand.c for the reason crt1.c is not +# crt1 is split into an assembly part (crt1_s.s) and a C part (crt1_c.c) so +# that raw assembly can be used to re-align the stack to be 32-byte aligned. +# This is necessary for CHERI because capabilities must be 32-byte aligned. +# crt1_s.s contains the __start symbol, which re-aligns the stack and then +# calls __start1 in crt1_c.c, which is a normal C function using normal calling +# conventions, which finishes off program initialisation. +# +# See the comment in lib/csu/common/crtbrand.c for the reason crt1_c.c is not # directly compiled to .o files. +# +# crt1 is compiled three times: +# - gcrt1 is non-position-independent, with profiling support +# - crt1 is non-position-independent, without profiling support +# - Scrt1 is position-independent, without profiling support -crt1.s: crt1.c - ${CC} ${CFLAGS} -S -o ${.TARGET} ${.CURDIR}/crt1.c +# Compile crt1_c.c with -DGCRT +gcrt1_c.s: crt1_c.c + ${CC} ${CFLAGS} -DGCRT -S -o ${.TARGET} ${.CURDIR}/crt1_c.c sed ${SED_FIX_NOTE} ${.TARGET} + cp ${.TARGET} /tmp + +gcrt1_c.o: gcrt1_c.s + ${CC} ${ACFLAGS} -c -o ${.TARGET} gcrt1_c.s + cp ${.TARGET} /tmp -crt1.o: crt1.s - ${CC} ${ACFLAGS} -c -o ${.TARGET} crt1.s +gcrt1.o: gcrt1_c.o crt1_s.o + ${LD} ${LDFLAGS} -o gcrt1.o -r crt1_s.o gcrt1_c.o + cp ${.TARGET} /tmp -gcrt1.s: crt1.c - ${CC} ${CFLAGS} -DGCRT -S -o ${.TARGET} ${.CURDIR}/crt1.c +# Compile crt1_c.c without -DGCRT +crt1_c.s: crt1_c.c + ${CC} ${CFLAGS} -S -o ${.TARGET} ${.CURDIR}/crt1_c.c sed ${SED_FIX_NOTE} ${.TARGET} + cp ${.TARGET} /tmp + +crt1_c.o: crt1_c.s + ${CC} ${ACFLAGS} -c -o ${.TARGET} crt1_c.s + cp ${.TARGET} /tmp -gcrt1.o: gcrt1.s - ${CC} ${ACFLAGS} -c -o ${.TARGET} gcrt1.s +crt1.o: crt1_c.o crt1_s.o + ${LD} ${LDFLAGS} -o crt1.o -r crt1_s.o crt1_c.o + cp ${.TARGET} /tmp -Scrt1.s: crt1.c - ${CC} ${CFLAGS} -fPIC -DPIC -S -o ${.TARGET} ${.CURDIR}/crt1.c +# Compile crt1_c.c with -fPIC -DPIC +Scrt1_c.s: crt1_c.c + ${CC} ${CFLAGS} -fPIC -DPIC -S -o ${.TARGET} ${.CURDIR}/crt1_c.c sed ${SED_FIX_NOTE} ${.TARGET} + cp ${.TARGET} /tmp -Scrt1.o: Scrt1.s - ${CC} ${ACFLAGS} -c -o ${.TARGET} Scrt1.s +Scrt1_c.o: Scrt1_c.s + ${CC} ${ACFLAGS} -c -o ${.TARGET} Scrt1_c.s + cp ${.TARGET} /tmp -realinstall: - ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ - ${OBJS} ${DESTDIR}${LIBDIR} +Scrt1.o: Scrt1_c.o crt1_s.o + ${LD} ${LDFLAGS} -o Scrt1.o -r crt1_s.o Scrt1_c.o + cp ${.TARGET} /tmp -.include +.include From owner-p4-projects@FreeBSD.ORG Wed Apr 17 22:19:33 2013 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 0288FE28; Wed, 17 Apr 2013 22:19:33 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id BB4EEE26 for ; Wed, 17 Apr 2013 22:19:32 +0000 (UTC) (envelope-from brooks@freebsd.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:1900:2254:2068::682:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9D163A3C for ; Wed, 17 Apr 2013 22:19:32 +0000 (UTC) Received: from skunkworks.freebsd.org ([127.0.1.74]) by skunkworks.freebsd.org (8.14.6/8.14.6) with ESMTP id r3HMJWUT076632 for ; Wed, 17 Apr 2013 22:19:32 GMT (envelope-from brooks@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.6/8.14.6/Submit) id r3HMJWae076629 for perforce@freebsd.org; Wed, 17 Apr 2013 22:19:32 GMT (envelope-from brooks@freebsd.org) Date: Wed, 17 Apr 2013 22:19:32 GMT Message-Id: <201304172219.r3HMJWae076629@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to brooks@freebsd.org using -f From: Brooks Davis Subject: PERFORCE change 227821 for review To: Perforce Change Reviews Precedence: bulk X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.14 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 22:19:33 -0000 http://p4web.freebsd.org/@@227821?ac=10 Change 227821 by brooks@brooks_zenith on 2013/04/17 22:18:52 Improve generic_bs_*_8 implementation with issues found while submitting for revew and as a result of review. Affected files ... .. //depot/projects/ctsrd/beribsd/src/sys/mips/include/cpufunc.h#6 edit .. //depot/projects/ctsrd/beribsd/src/sys/mips/mips/bus_space_generic.c#11 edit Differences ... ==== //depot/projects/ctsrd/beribsd/src/sys/mips/include/cpufunc.h#6 (text+ko) ==== @@ -354,11 +354,15 @@ #define readb(va) (*(volatile uint8_t *) (va)) #define readw(va) (*(volatile uint16_t *) (va)) #define readl(va) (*(volatile uint32_t *) (va)) -#define readd(va) mips3_ld(va) +#if defined(__GNUC__) && !defined(__mips_o32) +#define readq(a) (*(volatile uint64_t *)(a)) +#endif #define writeb(va, d) (*(volatile uint8_t *) (va) = (d)) #define writew(va, d) (*(volatile uint16_t *) (va) = (d)) #define writel(va, d) (*(volatile uint32_t *) (va) = (d)) -#define writed(va, d) mips3_sd((va), (d)) +#if defined(__GNUC__) && !defined(__mips_o32) +#define writeq(va, d) (*(volatile uint64_t *) (va) = (d)) +#endif #endif /* !_MACHINE_CPUFUNC_H_ */ ==== //depot/projects/ctsrd/beribsd/src/sys/mips/mips/bus_space_generic.c#11 (text+ko) ==== @@ -219,11 +219,15 @@ #define rd8(a) readb(a) #define rd16(a) readw(a) #define rd32(a) readl(a) -#define rd64(a) readd(a) +#ifdef readq +#define rd64(a) readq((a)) +#endif #define wr8(a, v) writeb(a, v) #define wr16(a, v) writew(a, v) #define wr32(a, v) writel(a, v) -#define wr64(a, v) writed(a, v) +#ifdef writeq +#define wr64(a, v) writeq(a, v) +#endif #endif /* generic bus_space tag */ @@ -441,7 +445,7 @@ uint64_t value) { -#ifdef rd64 +#ifdef wr64 wr64(bsh + offset, value); #else panic("%s: not implemented", __func__); @@ -486,7 +490,7 @@ generic_bs_wm_8(void *t, bus_space_handle_t bsh, bus_size_t offset, const uint64_t *addr, size_t count) { -#ifdef rd64 +#ifdef wr64 bus_addr_t baddr = bsh + offset; while (count--) @@ -540,7 +544,7 @@ generic_bs_wr_8(void *t, bus_space_handle_t bsh, bus_size_t offset, const uint64_t *addr, size_t count) { -#ifdef rd64 +#ifdef wr64 bus_addr_t baddr = bsh + offset; while (count--) { @@ -590,7 +594,7 @@ generic_bs_sm_8(void *t, bus_space_handle_t bsh, bus_size_t offset, uint64_t value, size_t count) { -#ifdef rd64 +#ifdef wr64 bus_addr_t addr = bsh + offset; while (count--) @@ -638,7 +642,7 @@ generic_bs_sr_8(void *t, bus_space_handle_t bsh, bus_size_t offset, uint64_t value, size_t count) { -#ifdef rd64 +#ifdef wr64 bus_addr_t addr = bsh + offset; for (; count != 0; count--, addr += 8) @@ -716,7 +720,7 @@ generic_bs_c_8(void *t, bus_space_handle_t bsh1, bus_size_t off1, bus_space_handle_t bsh2, bus_size_t off2, size_t count) { -#ifdef rd64 +#if defined(rd64) && defined(wr64) bus_addr_t addr1 = bsh1 + off1; bus_addr_t addr2 = bsh2 + off2; From owner-p4-projects@FreeBSD.ORG Wed Apr 17 22:22:37 2013 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 3534FF45; Wed, 17 Apr 2013 22:22:37 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E820BF43 for ; Wed, 17 Apr 2013 22:22:36 +0000 (UTC) (envelope-from brooks@freebsd.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:1900:2254:2068::682:0]) by mx1.freebsd.org (Postfix) with ESMTP id BF446A58 for ; Wed, 17 Apr 2013 22:22:36 +0000 (UTC) Received: from skunkworks.freebsd.org ([127.0.1.74]) by skunkworks.freebsd.org (8.14.6/8.14.6) with ESMTP id r3HMMZBO077264 for ; Wed, 17 Apr 2013 22:22:35 GMT (envelope-from brooks@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.6/8.14.6/Submit) id r3HMMZ9V077261 for perforce@freebsd.org; Wed, 17 Apr 2013 22:22:35 GMT (envelope-from brooks@freebsd.org) Date: Wed, 17 Apr 2013 22:22:35 GMT Message-Id: <201304172222.r3HMMZ9V077261@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to brooks@freebsd.org using -f From: Brooks Davis Subject: PERFORCE change 227822 for review To: Perforce Change Reviews Precedence: bulk X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.14 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 22:22:37 -0000 http://p4web.freebsd.org/@@227822?ac=10 Change 227822 by brooks@brooks_zenith on 2013/04/17 22:22:04 When we find configured interupt sources during attach, clear the config. It will be reestablished later if a driver is configured. Affected files ... .. //depot/projects/ctsrd/beribsd/src/sys/mips/beri/beri_pic.c#4 edit Differences ... ==== //depot/projects/ctsrd/beribsd/src/sys/mips/beri/beri_pic.c#4 (text+ko) ==== @@ -56,7 +56,6 @@ static void bp_write_cfg(struct beripic_softc *, int, uint64_t); static void bp_detach_resources(device_t); static char *bp_strconfig(uint64_t, char *, size_t); -static void bp_print_config(device_t); static void bp_config_source(device_t, int, int, u_long, u_long); #ifdef __mips__ static void bp_set_counter_name(device_t, device_t, int); @@ -217,29 +216,6 @@ } static void -bp_print_config(device_t dev) -{ - char configstr[64]; - struct beripic_softc *sc; - int src; - uint64_t config; - - sc = device_get_softc(dev); - - for (src = 0; src < sc->bp_nsrcs; src++) { - config = bp_read_cfg(sc, src); - if (config == 0) - continue; - - device_printf(dev, "src %d: %s\n", src, - bp_strconfig(config, configstr, sizeof(configstr))); - if (config & BP_CFG_RESERVED) - device_printf(dev, "reserved bits not 0: 0x%016jx\n", - (uintmax_t) config); - } -} - -static void bp_config_source(device_t ic, int src, int enable, u_long tid, u_long irq) { char configstr[64]; @@ -292,11 +268,13 @@ static int beripic_fdt_attach(device_t dev) { + char configstr[64]; struct beripic_softc *sc; struct fdt_ic *fic; pcell_t nhard, nsoft; phandle_t ph; - int error, i; + int error, i, src; + uint64_t config; sc = device_get_softc(dev); sc->bp_dev = dev; @@ -442,10 +420,22 @@ sc->bp_clear_bst = rman_get_bustag(sc->bp_clear_res); sc->bp_clear_bsh = rman_get_bushandle(sc->bp_clear_res); - if (bootverbose) - bp_print_config(dev); + for (src = 0; src < sc->bp_nsrcs; src++) { + config = bp_read_cfg(sc, src); + if (config == 0) + continue; + + if (bootverbose) { + device_printf(dev, "initial config: src %d: %s\n", src, + bp_strconfig(config, configstr, sizeof(configstr))); + if (config & BP_CFG_RESERVED) + device_printf(dev, + "reserved bits not 0: 0x%016jx\n", + (uintmax_t) config); + } - /* XXX: ensure values match reset config */ + bp_config_source(dev, src, 0, 0, 0); + } fic = malloc(sizeof(*fic), M_BERIPIC, M_WAITOK|M_ZERO); fic->iph = ph; From owner-p4-projects@FreeBSD.ORG Wed Apr 17 22:24:38 2013 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id C6720D3; Wed, 17 Apr 2013 22:24:38 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 8739DD1 for ; Wed, 17 Apr 2013 22:24:38 +0000 (UTC) (envelope-from brooks@freebsd.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:1900:2254:2068::682:0]) by mx1.freebsd.org (Postfix) with ESMTP id 78556A67 for ; Wed, 17 Apr 2013 22:24:38 +0000 (UTC) Received: from skunkworks.freebsd.org ([127.0.1.74]) by skunkworks.freebsd.org (8.14.6/8.14.6) with ESMTP id r3HMOcwZ077361 for ; Wed, 17 Apr 2013 22:24:38 GMT (envelope-from brooks@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.6/8.14.6/Submit) id r3HMOcCG077358 for perforce@freebsd.org; Wed, 17 Apr 2013 22:24:38 GMT (envelope-from brooks@freebsd.org) Date: Wed, 17 Apr 2013 22:24:38 GMT Message-Id: <201304172224.r3HMOcCG077358@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to brooks@freebsd.org using -f From: Brooks Davis Subject: PERFORCE change 227823 for review To: Perforce Change Reviews Precedence: bulk X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.14 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 22:24:39 -0000 http://p4web.freebsd.org/@@227823?ac=10 Change 227823 by brooks@brooks_zenith on 2013/04/17 22:23:51 IF beribsd. Affected files ... .. //depot/projects/ctsrd/cheribsd/src/lib/libstand/mips/_setjmp.S#4 integrate .. //depot/projects/ctsrd/cheribsd/src/sys/boot/mips/Makefile#4 integrate .. //depot/projects/ctsrd/cheribsd/src/sys/mips/beri/beri_pic.c#3 integrate .. //depot/projects/ctsrd/cheribsd/src/sys/mips/include/cpufunc.h#6 edit .. //depot/projects/ctsrd/cheribsd/src/sys/mips/mips/bus_space_generic.c#7 edit Differences ... ==== //depot/projects/ctsrd/cheribsd/src/lib/libstand/mips/_setjmp.S#4 (text+ko) ==== @@ -72,22 +72,6 @@ REG_S s7, ((S7 + 3) * SZREG)(a0) REG_S sp, ((SP + 3) * SZREG)(a0) REG_S s8, ((S8 + 3) * SZREG)(a0) -/* XXXRW: Don't try to save/restore FP in libstand. */ -#if 0 - cfc1 v0, $31 # too bad cant check if FP used - FP_S $f20, ((20 + 38) * SZREG)(a0) - FP_S $f21, ((21 + 38) * SZREG)(a0) - FP_S $f22, ((22 + 38) * SZREG)(a0) - FP_S $f23, ((23 + 38) * SZREG)(a0) - FP_S $f24, ((24 + 38) * SZREG)(a0) - FP_S $f25, ((25 + 38) * SZREG)(a0) - FP_S $f26, ((26 + 38) * SZREG)(a0) - FP_S $f27, ((27 + 38) * SZREG)(a0) - FP_S $f28, ((28 + 38) * SZREG)(a0) - FP_S $f29, ((29 + 38) * SZREG)(a0) - FP_S $f30, ((30 + 38) * SZREG)(a0) - FP_S $f31, ((31 + 38) * SZREG)(a0) -#endif REG_S v0, ((32 + 38) * SZREG)(a0) j ra move v0, zero @@ -115,25 +99,6 @@ REG_L v0, ((32 + 38) * SZREG)(a0) # get fpu status REG_L sp, ((SP + 3) * SZREG)(a0) REG_L s8, ((S8 + 3) * SZREG)(a0) -/* XXXRW: Don't try to save/restore FP in libstand. */ -#if 0 -/* Octeon does not have an FPU */ -#if !defined(_MIPS_ARCH_OCTEON) - ctc1 v0, $31 - FP_L $f20, ((20 + 38) * SZREG)(a0) - FP_L $f21, ((21 + 38) * SZREG)(a0) - FP_L $f22, ((22 + 38) * SZREG)(a0) - FP_L $f23, ((23 + 38) * SZREG)(a0) - FP_L $f24, ((24 + 38) * SZREG)(a0) - FP_L $f25, ((25 + 38) * SZREG)(a0) - FP_L $f26, ((26 + 38) * SZREG)(a0) - FP_L $f27, ((27 + 38) * SZREG)(a0) - FP_L $f28, ((28 + 38) * SZREG)(a0) - FP_L $f29, ((29 + 38) * SZREG)(a0) - FP_L $f30, ((30 + 38) * SZREG)(a0) - FP_L $f31, ((31 + 38) * SZREG)(a0) -#endif /* _MIPS_ARCH_OCTEON */ -#endif j ra move v0, a1 ==== //depot/projects/ctsrd/cheribsd/src/sys/boot/mips/Makefile#4 (text+ko) ==== ==== //depot/projects/ctsrd/cheribsd/src/sys/mips/beri/beri_pic.c#3 (text+ko) ==== @@ -56,7 +56,6 @@ static void bp_write_cfg(struct beripic_softc *, int, uint64_t); static void bp_detach_resources(device_t); static char *bp_strconfig(uint64_t, char *, size_t); -static void bp_print_config(device_t); static void bp_config_source(device_t, int, int, u_long, u_long); #ifdef __mips__ static void bp_set_counter_name(device_t, device_t, int); @@ -217,29 +216,6 @@ } static void -bp_print_config(device_t dev) -{ - char configstr[64]; - struct beripic_softc *sc; - int src; - uint64_t config; - - sc = device_get_softc(dev); - - for (src = 0; src < sc->bp_nsrcs; src++) { - config = bp_read_cfg(sc, src); - if (config == 0) - continue; - - device_printf(dev, "src %d: %s\n", src, - bp_strconfig(config, configstr, sizeof(configstr))); - if (config & BP_CFG_RESERVED) - device_printf(dev, "reserved bits not 0: 0x%016jx\n", - (uintmax_t) config); - } -} - -static void bp_config_source(device_t ic, int src, int enable, u_long tid, u_long irq) { char configstr[64]; @@ -292,11 +268,13 @@ static int beripic_fdt_attach(device_t dev) { + char configstr[64]; struct beripic_softc *sc; struct fdt_ic *fic; pcell_t nhard, nsoft; phandle_t ph; - int error, i; + int error, i, src; + uint64_t config; sc = device_get_softc(dev); sc->bp_dev = dev; @@ -442,10 +420,22 @@ sc->bp_clear_bst = rman_get_bustag(sc->bp_clear_res); sc->bp_clear_bsh = rman_get_bushandle(sc->bp_clear_res); - if (bootverbose) - bp_print_config(dev); + for (src = 0; src < sc->bp_nsrcs; src++) { + config = bp_read_cfg(sc, src); + if (config == 0) + continue; + + if (bootverbose) { + device_printf(dev, "initial config: src %d: %s\n", src, + bp_strconfig(config, configstr, sizeof(configstr))); + if (config & BP_CFG_RESERVED) + device_printf(dev, + "reserved bits not 0: 0x%016jx\n", + (uintmax_t) config); + } - /* XXX: ensure values match reset config */ + bp_config_source(dev, src, 0, 0, 0); + } fic = malloc(sizeof(*fic), M_BERIPIC, M_WAITOK|M_ZERO); fic->iph = ph; ==== //depot/projects/ctsrd/cheribsd/src/sys/mips/include/cpufunc.h#6 (text+ko) ==== @@ -354,11 +354,15 @@ #define readb(va) (*(volatile uint8_t *) (va)) #define readw(va) (*(volatile uint16_t *) (va)) #define readl(va) (*(volatile uint32_t *) (va)) -#define readd(va) mips3_ld(va) +#if defined(__GNUC__) && !defined(__mips_o32) +#define readq(a) (*(volatile uint64_t *)(a)) +#endif #define writeb(va, d) (*(volatile uint8_t *) (va) = (d)) #define writew(va, d) (*(volatile uint16_t *) (va) = (d)) #define writel(va, d) (*(volatile uint32_t *) (va) = (d)) -#define writed(va, d) mips3_sd((va), (d)) +#if defined(__GNUC__) && !defined(__mips_o32) +#define writeq(va, d) (*(volatile uint64_t *) (va) = (d)) +#endif #endif /* !_MACHINE_CPUFUNC_H_ */ ==== //depot/projects/ctsrd/cheribsd/src/sys/mips/mips/bus_space_generic.c#7 (text+ko) ==== @@ -219,11 +219,15 @@ #define rd8(a) readb(a) #define rd16(a) readw(a) #define rd32(a) readl(a) -#define rd64(a) readd(a) +#ifdef readq +#define rd64(a) readq((a)) +#endif #define wr8(a, v) writeb(a, v) #define wr16(a, v) writew(a, v) #define wr32(a, v) writel(a, v) -#define wr64(a, v) writed(a, v) +#ifdef writeq +#define wr64(a, v) writeq(a, v) +#endif #endif /* generic bus_space tag */ @@ -441,7 +445,7 @@ uint64_t value) { -#ifdef rd64 +#ifdef wr64 wr64(bsh + offset, value); #else panic("%s: not implemented", __func__); @@ -486,7 +490,7 @@ generic_bs_wm_8(void *t, bus_space_handle_t bsh, bus_size_t offset, const uint64_t *addr, size_t count) { -#ifdef rd64 +#ifdef wr64 bus_addr_t baddr = bsh + offset; while (count--) @@ -540,7 +544,7 @@ generic_bs_wr_8(void *t, bus_space_handle_t bsh, bus_size_t offset, const uint64_t *addr, size_t count) { -#ifdef rd64 +#ifdef wr64 bus_addr_t baddr = bsh + offset; while (count--) { @@ -590,7 +594,7 @@ generic_bs_sm_8(void *t, bus_space_handle_t bsh, bus_size_t offset, uint64_t value, size_t count) { -#ifdef rd64 +#ifdef wr64 bus_addr_t addr = bsh + offset; while (count--) @@ -638,7 +642,7 @@ generic_bs_sr_8(void *t, bus_space_handle_t bsh, bus_size_t offset, uint64_t value, size_t count) { -#ifdef rd64 +#ifdef wr64 bus_addr_t addr = bsh + offset; for (; count != 0; count--, addr += 8) @@ -716,7 +720,7 @@ generic_bs_c_8(void *t, bus_space_handle_t bsh1, bus_size_t off1, bus_space_handle_t bsh2, bus_size_t off2, size_t count) { -#ifdef rd64 +#if defined(rd64) && defined(wr64) bus_addr_t addr1 = bsh1 + off1; bus_addr_t addr2 = bsh2 + off2;