From patchwork Thu Jan 10 15:41:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 10756087 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5D2216C2 for ; Thu, 10 Jan 2019 15:43:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4C7C729B06 for ; Thu, 10 Jan 2019 15:43:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 40D5C29B15; Thu, 10 Jan 2019 15:43:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CDAFC29B06 for ; Thu, 10 Jan 2019 15:43:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729653AbfAJPnU (ORCPT ); Thu, 10 Jan 2019 10:43:20 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:49760 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729672AbfAJPnT (ORCPT ); Thu, 10 Jan 2019 10:43:19 -0500 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id x0AFdxDW031838 for ; Thu, 10 Jan 2019 10:43:18 -0500 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0b-001b2d01.pphosted.com with ESMTP id 2px6mbfnsy-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 10 Jan 2019 10:43:17 -0500 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 10 Jan 2019 15:43:15 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 10 Jan 2019 15:43:13 -0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x0AFhCWY44957814 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 10 Jan 2019 15:43:12 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A0F7AA4062; Thu, 10 Jan 2019 15:43:12 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1105FA405F; Thu, 10 Jan 2019 15:43:12 +0000 (GMT) Received: from s38lp20.lnxne.boe (unknown [9.145.49.69]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 10 Jan 2019 15:43:11 +0000 (GMT) From: Janosch Frank To: kvm@vger.kernel.org Cc: linux-s390@vger.kernel.org, david@redhat.com, thuth@redhat.com Subject: [kvm-unit-tests PATCH v5 05/11] s390x: Add BSS clearing for non ELF boot Date: Thu, 10 Jan 2019 16:41:45 +0100 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190110154151.24233-1-frankja@linux.ibm.com> References: <20190110154151.24233-1-frankja@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19011015-0020-0000-0000-0000030476AD X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19011015-0021-0000-0000-000021557B53 Message-Id: <20190110154151.24233-6-frankja@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-01-10_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901100123 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When doing an IPL normal the memory will not be zeroed and hence the BSS section can have any value. We need to clear it by ourselves. Signed-off-by: Janosch Frank Reviewed-by: Thomas Huth Reviewed-by: David Hildenbrand --- s390x/cstart64.S | 22 ++++++++++++++++++++-- s390x/flat.lds | 2 ++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/s390x/cstart64.S b/s390x/cstart64.S index 6622633..dedfe80 100644 --- a/s390x/cstart64.S +++ b/s390x/cstart64.S @@ -39,7 +39,22 @@ start: /* setup initial PSW mask + control registers*/ larl %r1, initial_psw lpswe 0(%r1) -init_psw_cont: +clear_bss_start: + larl %r2, __bss_start + larl %r3, __bss_end + slgr %r3, %r2 # Get sizeof bss + aghi %r3,-1 + srlg %r4,%r3,8 # Calc number of 256 byte chunks + ltgr %r4,%r4 + lgr %r1,%r2 + jz clear_bss_remainder # If none, clear remaining bytes +clear_bss_loop: + xc 0(256,%r1), 0(%r1) # Clear 256 byte chunks via xor + la %r1, 256(%r1) + brctg %r4, clear_bss_loop +clear_bss_remainder: + larl %r2, memsetxc + ex %r3, 0(%r2) /* setup pgm interrupt handler */ larl %r1, pgm_int_psw mvc GEN_LC_PGM_NEW_PSW(16), 0(%r1) @@ -71,6 +86,9 @@ init_psw_cont: /* call exit() */ j exit +memsetxc: + xc 0(1,%r1),0(%r1) + .macro SAVE_REGS /* save grs 0-15 */ stmg %r0, %r15, GEN_LC_SW_INT_GRS @@ -159,7 +177,7 @@ svc_int: .align 8 initial_psw: - .quad 0x0000000180000000, init_psw_cont + .quad 0x0000000180000000, clear_bss_start pgm_int_psw: .quad 0x0000000180000000, pgm_int ext_int_psw: diff --git a/s390x/flat.lds b/s390x/flat.lds index 977af7c..403d967 100644 --- a/s390x/flat.lds +++ b/s390x/flat.lds @@ -40,7 +40,9 @@ SECTIONS . = ALIGN(16); .rodata : { *(.rodata) *(.rodata.*) } . = ALIGN(16); + __bss_start = .; .bss : { *(.bss) } + __bss_end = .; . = ALIGN(64K); edata = .; . += 64K;