From owner-svn-src-all@FreeBSD.ORG Thu Feb 9 22:33:31 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AECAC1065670; Thu, 9 Feb 2012 22:33:30 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:130:3ffc::401:25]) by mx1.freebsd.org (Postfix) with ESMTP id 330778FC17; Thu, 9 Feb 2012 22:33:30 +0000 (UTC) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 28A4925D3870; Thu, 9 Feb 2012 22:33:29 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 545D3BDB039; Thu, 9 Feb 2012 22:33:28 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id L2P4tXzdsv5v; Thu, 9 Feb 2012 22:33:26 +0000 (UTC) Received: from orange-en1.sbone.de (orange-en1.sbone.de [IPv6:fde9:577b:c1a9:31:cabc:c8ff:fecf:e8e3]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 8A950BDB038; Thu, 9 Feb 2012 22:33:26 +0000 (UTC) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: "Bjoern A. Zeeb" In-Reply-To: <201202092217.q19MHEuU039370@svn.freebsd.org> Date: Thu, 9 Feb 2012 22:33:25 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201202092217.q19MHEuU039370@svn.freebsd.org> To: Oleksandr Tymoshenko X-Mailer: Apple Mail (2.1084) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r231312 - in head/sys/mips: include mips X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Feb 2012 22:33:31 -0000 On 9. Feb 2012, at 22:17 , Oleksandr Tymoshenko wrote: > Author: gonzo > Date: Thu Feb 9 22:17:13 2012 > New Revision: 231312 > URL: http://svn.freebsd.org/changeset/base/231312 >=20 > Log: > - Emulate RDHWR instruction for TLS support >=20 > Reading register $29 with RDHWR is becoming the de-facto standard to > implement TLS. According to linux-mips wiki, MIPS Technologies has > reserved hardware register $29 for ABI use. Furthermore current GCC > makes the following assumptions: > - RDHWR is natively available or otherwise emulated by the kernel > - Register $29 holds the TLS pointer >=20 > Submitted by: Robert Millan mips XLPN32 kernel failed, check _.mips.XLPN32 for details mips XLRN32 kernel failed, check _.mips.XLRN32 for details /scratch/tmp/bz/head.svn/sys/mips/mips/trap.c: In function 'trap': /scratch/tmp/bz/head.svn/sys/mips/mips/trap.c:768: warning: cast to = pointer from integer of different size [-Wint-to-pointer-cast] /scratch/tmp/bz/head.svn/sys/mips/mips/trap.c:776: warning: cast from = pointer to integer of different size [-Wpointer-to-int-cast] >=20 > Modified: > head/sys/mips/include/mips_opcode.h > head/sys/mips/mips/trap.c >=20 > Modified: head/sys/mips/include/mips_opcode.h > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/mips/include/mips_opcode.h Thu Feb 9 22:13:20 2012 = (r231311) > +++ head/sys/mips/include/mips_opcode.h Thu Feb 9 22:17:13 2012 = (r231312) > @@ -176,6 +176,11 @@ typedef union { > #define OP_LDL 032 > #define OP_LDR 033 >=20 > +#define OP_SPECIAL2 034 > +#define OP_JALX 035 > + > +#define OP_SPECIAL3 037 > + > #define OP_LB 040 > #define OP_LH 041 > #define OP_LWL 042 > @@ -389,6 +394,11 @@ typedef union { > #define OP_R_BGEZALL OP_BGEZALL >=20 > /* > + * Values for the 'func' field when 'op' =3D=3D OP_SPECIAL3. > + */ > +#define OP_RDHWR 073 > + > +/* > * Values for the 'rs' field when 'op' =3D=3D OP_COPz. > */ > #define OP_MF 000 >=20 > Modified: head/sys/mips/mips/trap.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/mips/mips/trap.c Thu Feb 9 22:13:20 2012 = (r231311) > +++ head/sys/mips/mips/trap.c Thu Feb 9 22:17:13 2012 = (r231312) > @@ -414,6 +414,7 @@ trap(struct trapframe *trapframe) > intptr_t addr =3D 0; > register_t pc; > int cop; > + register_t *frame_regs; >=20 > trapdebug_enter(trapframe, 0); > =09 > @@ -762,9 +763,29 @@ dofault: > } >=20 > case T_RES_INST + T_USER: > - log_illegal_instruction("RES_INST", trapframe); > - i =3D SIGILL; > - addr =3D trapframe->pc; > + { > + InstFmt inst; > + inst =3D *(InstFmt *)trapframe->pc; > + switch (inst.RType.op) { > + case OP_SPECIAL3: > + switch (inst.RType.func) { > + case OP_RDHWR: > + /* Register 29 used for TLS */ > + if (inst.RType.rd =3D=3D 29) { > + frame_regs =3D = &(trapframe->zero); > + = frame_regs[inst.RType.rt] =3D (register_t)td->td_md.md_tls; > + trapframe->pc +=3D = sizeof(int); > + goto out; > + } > + break; > + } > + break; > + } > + > + log_illegal_instruction("RES_INST", trapframe); > + i =3D SIGILL; > + addr =3D trapframe->pc; > + } > break; > case T_C2E: > case T_C2E + T_USER: --=20 Bjoern A. Zeeb You have to have visions! It does not matter how good you are. It matters what good you do!