From owner-freebsd-mips@FreeBSD.ORG Sun Sep 29 15:33:57 2013 Return-Path: Delivered-To: mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id AA53C3EE for ; Sun, 29 Sep 2013 15:33:57 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from mail-ee0-f44.google.com (mail-ee0-f44.google.com [74.125.83.44]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 323D32BBB for ; Sun, 29 Sep 2013 15:33:56 +0000 (UTC) Received: by mail-ee0-f44.google.com with SMTP id b47so2170795eek.17 for ; Sun, 29 Sep 2013 08:33:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:content-type:subject:date:message-id :to:mime-version; bh=AFM2qEYuzCaBxC91y/cqGxYSyrkyJAWSgJENFt/rTZo=; b=C1dxvnz3MtTxK8B0eKIBfQtIshRmwlRdS8VNt7x6kRh33uPCkTaWXZKHn2l/osmpZz DqSUTs7C8NxA3Orn9Bztfpba3zmbHMky67kN234MM9wdIR8LihgsB08bUSHwN3tlOStq YwyECo6lINB/mBDxf0azWhI1ihzZIDYQjkS4Qt//Cz5rlu3MYYUTNCsuZ1Y7i0kSxouV 9Yaxj4N4tYPjMBWkg2VJihoClPbYson8T0/L+7wKZPAcUrAXk+6MwKI1iiJK+PR3vkum C0l813eCe90wxWM/WqUZcaKrStqzvsAzfVhAaTsikC44HjfoIAUH6yrVEwlXwH2LCimP tU2Q== X-Gm-Message-State: ALoCoQkfn6nbKRVl0w9AQyzvrmfn8YRbfyXVmbKSslxbMiGv8//o+xrTmm2Wihx+W4B7rZrGn7Or X-Received: by 10.15.67.131 with SMTP id u3mr28818561eex.34.1380465321022; Sun, 29 Sep 2013 07:35:21 -0700 (PDT) Received: from ?IPv6:2a02:dd0:3:100:129a:ddff:feb5:90b2? ([2a02:dd0:3:100:129a:ddff:feb5:90b2]) by mx.google.com with ESMTPSA id h45sm40048503eeg.5.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 29 Sep 2013 07:35:20 -0700 (PDT) Sender: Warner Losh From: Warner Losh Content-Type: multipart/mixed; boundary=Apple-Mail-4-578676191 Subject: Minor cleanup Date: Sun, 29 Sep 2013 16:35:18 +0200 Message-Id: <768FD7A4-CC9B-4034-8FAF-2C98A2095B6C@bsdimp.com> To: "freebsd-mips@FreeBSD.org" Mime-Version: 1.0 (Apple Message framework v1085) X-Mailer: Apple Mail (2.1085) X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Sep 2013 15:33:57 -0000 --Apple-Mail-4-578676191 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Greetings, Looking for someone to review this minor cleanup on mips. I've moved a = few little things from asm.h, where they don't belong, into pcb.h where = they do. I've also moved a little duplication out of swtch.S and = exception.S into pcb.h. http://people.freebsd.org/~imp/mips-1.diff Warner --Apple-Mail-4-578676191 Content-Disposition: attachment; filename=mips-1.diff Content-Type: application/octet-stream; name="mips-1.diff" Content-Transfer-Encoding: 7bit Index: sys/mips/include/asm.h =================================================================== --- sys/mips/include/asm.h (revision 255930) +++ sys/mips/include/asm.h (working copy) @@ -262,38 +262,6 @@ .align 3 /* - * Call ast if required - * - * XXX Do we really need to disable interrupts? - */ -#define DO_AST \ -44: \ - mfc0 t0, MIPS_COP_0_STATUS ;\ - and a0, t0, MIPS_SR_INT_IE ;\ - xor t0, a0, t0 ;\ - mtc0 t0, MIPS_COP_0_STATUS ;\ - COP0_SYNC ;\ - GET_CPU_PCPU(s1) ;\ - PTR_L s3, PC_CURPCB(s1) ;\ - PTR_L s1, PC_CURTHREAD(s1) ;\ - lw s2, TD_FLAGS(s1) ;\ - li s0, TDF_ASTPENDING | TDF_NEEDRESCHED;\ - and s2, s0 ;\ - mfc0 t0, MIPS_COP_0_STATUS ;\ - or t0, a0, t0 ;\ - mtc0 t0, MIPS_COP_0_STATUS ;\ - COP0_SYNC ;\ - beq s2, zero, 4f ;\ - nop ;\ - PTR_LA s0, _C_LABEL(ast) ;\ - jalr s0 ;\ - PTR_ADDU a0, s3, U_PCB_REGS ;\ - j 44b ;\ - nop ;\ -4: - - -/* * XXX retain dialects XXX */ #define ALEAF(x) XLEAF(x) Index: sys/mips/include/pcb.h =================================================================== --- sys/mips/include/pcb.h (revision 255930) +++ sys/mips/include/pcb.h (working copy) @@ -79,6 +79,56 @@ void makectx(struct trapframe *, struct pcb *); int savectx(struct pcb *) __returns_twice; + +/* + * Call ast if required + * + * XXX Do we really need to disable interrupts? + */ +#define DO_AST \ +44: \ + mfc0 t0, MIPS_COP_0_STATUS ;\ + and a0, t0, MIPS_SR_INT_IE ;\ + xor t0, a0, t0 ;\ + mtc0 t0, MIPS_COP_0_STATUS ;\ + COP0_SYNC ;\ + GET_CPU_PCPU(s1) ;\ + PTR_L s3, PC_CURPCB(s1) ;\ + PTR_L s1, PC_CURTHREAD(s1) ;\ + lw s2, TD_FLAGS(s1) ;\ + li s0, TDF_ASTPENDING | TDF_NEEDRESCHED;\ + and s2, s0 ;\ + mfc0 t0, MIPS_COP_0_STATUS ;\ + or t0, a0, t0 ;\ + mtc0 t0, MIPS_COP_0_STATUS ;\ + COP0_SYNC ;\ + beq s2, zero, 4f ;\ + nop ;\ + PTR_LA s0, _C_LABEL(ast) ;\ + jalr s0 ;\ + PTR_ADDU a0, s3, U_PCB_REGS ;\ + j 44b ;\ + nop ;\ +4: + +#define SAVE_U_PCB_REG(reg, offs, base) \ + REG_S reg, U_PCB_REGS + (SZREG * offs) (base) + +#define RESTORE_U_PCB_REG(reg, offs, base) \ + REG_L reg, U_PCB_REGS + (SZREG * offs) (base) + +#define SAVE_U_PCB_FPREG(reg, offs, base) \ + FP_S reg, U_PCB_FPREGS + (SZFPREG * offs) (base) + +#define RESTORE_U_PCB_FPREG(reg, offs, base) \ + FP_L reg, U_PCB_FPREGS + (SZFPREG * offs) (base) + +#define SAVE_U_PCB_FPSR(reg, offs, base) \ + REG_S reg, U_PCB_FPREGS + (SZFPREG * offs) (base) + +#define RESTORE_U_PCB_FPSR(reg, offs, base) \ + REG_L reg, U_PCB_FPREGS + (SZFPREG * offs) (base) + #endif #endif Index: sys/mips/mips/exception.S =================================================================== --- sys/mips/mips/exception.S (revision 255930) +++ sys/mips/mips/exception.S (working copy) @@ -61,6 +61,7 @@ #include #include #include +#include #include "assym.s" @@ -411,12 +412,6 @@ END(MipsKernGenException) -#define SAVE_U_PCB_REG(reg, offs, base) \ - REG_S reg, U_PCB_REGS + (SZREG * offs) (base) - -#define RESTORE_U_PCB_REG(reg, offs, base) \ - REG_L reg, U_PCB_REGS + (SZREG * offs) (base) - /*---------------------------------------------------------------------------- * * MipsUserGenException -- Index: sys/mips/mips/swtch.S =================================================================== --- sys/mips/mips/swtch.S (revision 255930) +++ sys/mips/mips/swtch.S (working copy) @@ -68,31 +68,6 @@ .set noreorder # Noreorder is default style! -#define SAVE_U_PCB_REG(reg, offs, base) \ - REG_S reg, U_PCB_REGS + (SZREG * offs) (base) - -#define RESTORE_U_PCB_REG(reg, offs, base) \ - REG_L reg, U_PCB_REGS + (SZREG * offs) (base) - -#define SAVE_U_PCB_FPREG(reg, offs, base) \ - FP_S reg, U_PCB_FPREGS + (SZFPREG * offs) (base) - -#define RESTORE_U_PCB_FPREG(reg, offs, base) \ - FP_L reg, U_PCB_FPREGS + (SZFPREG * offs) (base) - -#define SAVE_U_PCB_FPSR(reg, offs, base) \ - REG_S reg, U_PCB_FPREGS + (SZFPREG * offs) (base) - -#define RESTORE_U_PCB_FPSR(reg, offs, base) \ - REG_L reg, U_PCB_FPREGS + (SZFPREG * offs) (base) - -#define SAVE_U_PCB_CONTEXT(reg, offs, base) \ - REG_S reg, U_PCB_CONTEXT + (SZREG * offs) (base) - -#define RESTORE_U_PCB_CONTEXT(reg, offs, base) \ - REG_L reg, U_PCB_CONTEXT + (SZREG * offs) (base) - - /* * Setup for and return to user. */ --Apple-Mail-4-578676191--