From patchwork Tue Dec 4 13:48:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 10711787 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 77EF214BD for ; Tue, 4 Dec 2018 13:49:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6AE1C288F7 for ; Tue, 4 Dec 2018 13:49:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5E53E2B919; Tue, 4 Dec 2018 13:49:35 +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 07614288F7 for ; Tue, 4 Dec 2018 13:49:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726400AbeLDNtd (ORCPT ); Tue, 4 Dec 2018 08:49:33 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:60828 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725863AbeLDNtd (ORCPT ); Tue, 4 Dec 2018 08:49:33 -0500 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wB4Dn0ve121966 for ; Tue, 4 Dec 2018 08:49:32 -0500 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2p5sr8k78b-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 04 Dec 2018 08:49:31 -0500 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 4 Dec 2018 13:49:29 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 4 Dec 2018 13:49:28 -0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id wB4DnRFA48169108 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 4 Dec 2018 13:49:27 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 12C4FAE053; Tue, 4 Dec 2018 13:49:27 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D4812AE055; Tue, 4 Dec 2018 13:49:26 +0000 (GMT) Received: from s38lp20.lnxne.boe (unknown [9.152.224.44]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 4 Dec 2018 13:49:26 +0000 (GMT) From: Janosch Frank To: kvm@vger.kernel.org Cc: qemu-s390x@nongnu.org, david@redhat.com, thuth@redhat.com Subject: [kvm-unit-tests PATCH 3/5] s390x: Add BSS clearing for non ELF boot Date: Tue, 4 Dec 2018 14:48:36 +0100 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20181204134838.5841-1-frankja@linux.ibm.com> References: <20181204134838.5841-1-frankja@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18120413-4275-0000-0000-000002EBDE61 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18120413-4276-0000-0000-000037F8E689 Message-Id: <20181204134838.5841-4-frankja@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-12-04_07:,, 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=738 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1812040117 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 --- s390x/cstart64.S | 22 ++++++++++++++++++++++ s390x/flat.lds | 2 ++ 2 files changed, 24 insertions(+) diff --git a/s390x/cstart64.S b/s390x/cstart64.S index 80dbcba..cf22b0d 100644 --- a/s390x/cstart64.S +++ b/s390x/cstart64.S @@ -36,7 +36,26 @@ start64: /* setup initial PSW mask + control registers */ larl %r1, initial_psw lpswe 0(%r1) + + init_psw_cont: + larl %r2, __bss_start + larl %r3, __bss_end + slgr %r3, %r2 # get sizeof bss + ltgr %r3,%r3 # bss empty? + jz init_psw_cont + aghi %r3,-1 + srlg %r4,%r3,8 + ltgr %r4,%r4 + lgr %r1,%r2 + jz remainder +loop: + xc 0(256,%r1), 0(%r1) + la %r1, 256(%r1) + brctg %r4, loop +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) @@ -68,6 +87,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 diff --git a/s390x/flat.lds b/s390x/flat.lds index 7cfd9f9..fb229ce 100644 --- a/s390x/flat.lds +++ b/s390x/flat.lds @@ -35,7 +35,9 @@ SECTIONS . = ALIGN(16); .rodata : { *(.rodata) *(.rodata.*) } . = ALIGN(16); + __bss_start = .; .bss : { *(.bss) } + __bss_end = .; . = ALIGN(64K); edata = .; . += 64K;