From owner-freebsd-sparc64@FreeBSD.ORG Sat Aug 27 13:20:19 2005 Return-Path: X-Original-To: freebsd-sparc64@freebsd.org Delivered-To: freebsd-sparc64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E34D016A41F for ; Sat, 27 Aug 2005 13:20:18 +0000 (GMT) (envelope-from imura@ryu16.org) Received: from mail.ryu16.org (221x249x107x69.ap221.ftth.ucom.ne.jp [221.249.107.69]) by mx1.FreeBSD.org (Postfix) with ESMTP id E0DDA43D45 for ; Sat, 27 Aug 2005 13:20:17 +0000 (GMT) (envelope-from imura@ryu16.org) Received: from redeye.xt.ryu16.org (localhost [127.0.0.1]) by mail.ryu16.org (8.12.9p1/8.12.9) with ESMTP id j7RDK9gr029093; Sat, 27 Aug 2005 22:20:09 +0900 (JST) (envelope-from imura@redeye.xt.ryu16.org) Received: (from imura@localhost) by redeye.xt.ryu16.org (8.12.9p1/8.12.9/Submit) id j7RDK8Ws029092; Sat, 27 Aug 2005 22:20:08 +0900 (JST) (envelope-from imura) Date: Sat, 27 Aug 2005 22:20:08 +0900 From: "R. Imura" To: Marius Strobl Message-ID: <20050827132008.GA28954%imura@ryu16.org> References: <200508110931.13802.john@jnielsen.net> <200508201453.40439.jhb@FreeBSD.org> <20050823081517.GB4956@rndsoft.co.kr> <200508230911.18163.john@jnielsen.net> <20050824010147.GD4956@rndsoft.co.kr> <20050824143940.GA65078%imura@ryu16.org> <20050824191437.A36508@newtrinity.zeist.de> <20050827055841.GB83681%imura@ryu16.org> <20050827145503.G19225@newtrinity.zeist.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050827145503.G19225@newtrinity.zeist.de> User-Agent: Mutt/1.4.1i-ja.1 Cc: John Nielsen , freebsd-sparc64@freebsd.org Subject: Re: "fast data access mmu miss" on kernels w/o "makeoptions DEBUG=-g" X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Aug 2005 13:20:19 -0000 On Sat, Aug 27, 2005 at 02:55:03PM +0200, Marius Strobl wrote: > On Sat, Aug 27, 2005 at 02:58:41PM +0900, R. Imura wrote: > > Hi, > > > > On Wed, Aug 24, 2005 at 07:14:37PM +0200, Marius Strobl wrote: > > > > > smbfs does not work on sparc64 as smbfs assumes it runs on > > > > > architectures that allow on-aligned memory access. It also needs > > > > > big-endian clean up too.(See sys/mchain.h) > > > > > > > > To begin with, you might want this patch. :) > > > > > > > > > > You probably should go the NetBSD route and change the consumers > > > of these macros to use the byteorder(9) functions like htole16(9) > > > directly. Btw., NetBSD seems to also have fixed the alignment > > > issues. > > > > I was too rushed that these macros in my patch are no longer used > > in our system, so we can safe to remove them. > > > > Fixes are done in 3 years ago. > > http://docs.freebsd.org/cgi/mid.cgi?200212161620.gBGGK6uX080655 > > > > That commit only dealt with the kernel part, these macros are still > used in the userland part: > > grep -r htoles /usr/src/contrib/smbfs/* > /usr/src/contrib/smbfs/lib/smb/nb_name.c:#define NBENCODE(c) (htoles((u_short)(((u_char)(c) >> 4) | \ > > Marius I see. :) Then, could you test this patch? Index: contrib/smbfs/lib/smb/mbuf.c =================================================================== RCS file: /home/ncvs/src/contrib/smbfs/lib/smb/mbuf.c,v retrieving revision 1.2 diff -u -r1.2 mbuf.c --- contrib/smbfs/lib/smb/mbuf.c 19 Oct 2004 17:44:31 -0000 1.2 +++ contrib/smbfs/lib/smb/mbuf.c 27 Aug 2005 13:07:14 -0000 @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD: src/contrib/smbfs/lib/smb/mbuf.c,v 1.2 2004/10/19 17:44:31 obrien Exp $"); #include +#include #include #include #include @@ -268,7 +269,7 @@ mb_put_int64be(struct mbdata *mbp, int64_t x) { MB_PUT(int64_t); - *p = htobeq(x); + *p = htobe64(x); return 0; } @@ -276,7 +277,7 @@ mb_put_int64le(struct mbdata *mbp, int64_t x) { MB_PUT(int64_t); - *p = htoleq(x); + *p = htole64(x); return 0; } @@ -367,7 +368,7 @@ u_int16_t v; int error = mb_get_uint16(mbp, &v); - *x = letohs(v); + *x = le16toh(v); return error; } @@ -376,7 +377,7 @@ u_int16_t v; int error = mb_get_uint16(mbp, &v); - *x = betohs(v); + *x = be16toh(v); return error; } @@ -393,7 +394,7 @@ int error; error = mb_get_uint32(mbp, &v); - *x = betohl(v); + *x = be32toh(v); return error; } @@ -404,7 +405,7 @@ int error; error = mb_get_uint32(mbp, &v); - *x = letohl(v); + *x = le32toh(v); return error; } @@ -421,7 +422,7 @@ int error; error = mb_get_int64(mbp, &v); - *x = betohq(v); + *x = be64toh(v); return error; } @@ -432,7 +433,7 @@ int error; error = mb_get_int64(mbp, &v); - *x = letohq(v); + *x = le64toh(v); return error; } Index: contrib/smbfs/lib/smb/nb_name.c =================================================================== RCS file: /home/ncvs/src/contrib/smbfs/lib/smb/nb_name.c,v retrieving revision 1.1.1.2 diff -u -r1.1.1.2 nb_name.c --- contrib/smbfs/lib/smb/nb_name.c 20 Dec 2001 16:16:25 -0000 1.1.1.2 +++ contrib/smbfs/lib/smb/nb_name.c 27 Aug 2005 13:08:13 -0000 @@ -31,9 +31,9 @@ * * $Id: nb_name.c,v 1.2 2001/08/22 03:31:36 bp Exp $ */ +#include #include #include -#include /* for endiand macros */ #include #include @@ -139,7 +139,7 @@ return len; } -#define NBENCODE(c) (htoles((u_short)(((u_char)(c) >> 4) | \ +#define NBENCODE(c) (htole16((u_short)(((u_char)(c) >> 4) | \ (((u_char)(c) & 0xf) << 8)) + 0x4141)) static void Index: contrib/smbfs/lib/smb/rap.c =================================================================== RCS file: /home/ncvs/src/contrib/smbfs/lib/smb/rap.c,v retrieving revision 1.4 diff -u -r1.4 rap.c --- contrib/smbfs/lib/smb/rap.c 19 Jun 2004 19:03:01 -0000 1.4 +++ contrib/smbfs/lib/smb/rap.c 27 Aug 2005 13:10:08 -0000 @@ -35,6 +35,7 @@ * This is very simple implementation of RAP protocol. */ #include +#include #include #include #include @@ -45,8 +46,6 @@ #include #include -#include - #include #include #include @@ -290,7 +289,7 @@ return error; switch (ptype) { case 'h': - *value = letohs(*(u_int16_t*)rap->r_npbuf); + *value = le16toh(*(u_int16_t*)rap->r_npbuf); break; default: return EINVAL; @@ -320,8 +319,8 @@ if (error) return error; rp = (u_int16_t*)rap->r_pbuf; - rap->r_result = letohs(*rp++); - conv = letohs(*rp++); + rap->r_result = le16toh(*rp++); + conv = le16toh(*rp++); rap->r_npbuf = (char*)rp; rap->r_entries = entries = 0; done = 0; @@ -329,7 +328,7 @@ ptype = *p; switch (ptype) { case 'e': - rap->r_entries = entries = letohs(*(u_int16_t*)rap->r_npbuf); + rap->r_entries = entries = le16toh(*(u_int16_t*)rap->r_npbuf); rap->r_npbuf += 2; p++; break; Index: sys/sys/mchain.h =================================================================== RCS file: /home/ncvs/src/sys/sys/mchain.h,v retrieving revision 1.9 diff -u -r1.9 mchain.h --- sys/sys/mchain.h 29 Jul 2005 13:22:36 -0000 1.9 +++ sys/sys/mchain.h 27 Aug 2005 13:13:05 -0000 @@ -34,54 +34,6 @@ #ifndef _SYS_MCHAIN_H_ #define _SYS_MCHAIN_H_ -#include - -#ifndef _KERNEL -/* - * This macros probably belongs to the endian.h - */ -#if (BYTE_ORDER == LITTLE_ENDIAN) - -#define htoles(x) ((u_int16_t)(x)) -#define letohs(x) ((u_int16_t)(x)) -#define htolel(x) ((u_int32_t)(x)) -#define letohl(x) ((u_int32_t)(x)) -#define htoleq(x) ((int64_t)(x)) -#define letohq(x) ((int64_t)(x)) - -#define htobes(x) (__htons(x)) -#define betohs(x) (__ntohs(x)) -#define htobel(x) (__htonl(x)) -#define betohl(x) (__ntohl(x)) - -static __inline int64_t -htobeq(int64_t x) -{ - return (int64_t)__htonl((u_int32_t)(x >> 32)) | - (int64_t)__htonl((u_int32_t)(x & 0xffffffff)) << 32; -} - -static __inline int64_t -betohq(int64_t x) -{ - return (int64_t)__ntohl((u_int32_t)(x >> 32)) | - (int64_t)__ntohl((u_int32_t)(x & 0xffffffff)) << 32; -} - -#else /* (BYTE_ORDER == LITTLE_ENDIAN) */ - -#error "Macros for Big-Endians are incomplete" - -/* -#define htoles(x) ((u_int16_t)(x)) -#define letohs(x) ((u_int16_t)(x)) -#define htolel(x) ((u_int32_t)(x)) -#define letohl(x) ((u_int32_t)(x)) -*/ -#endif /* (BYTE_ORDER == LITTLE_ENDIAN) */ -#endif /* _KERNEL */ - - #ifdef _KERNEL /* Regards, - R. Imura