From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web08.10383.1634024606319649260 for ; Tue, 12 Oct 2021 00:43:26 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fXYQv3rt; spf=pass (domain: redhat.com, ip: 170.10.133.124, mailfrom: kraxel@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634024605; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=XBQNpaO0M9qVsrf1RAPjZlbU1bVcfb6Emn8fXvO1FkA=; b=fXYQv3rt5dUxPxOt78QiDQbZOia3iMaCB9b6zkDq17Ot+8486OHcZ9hFJC7aB122jx1pcW 9Df1dABIGZPrTcdhPpiDnxRJKv5iERVKmH6wZlFS5s1hgRRAbn7p0z9vVUVAkCk4U6r/xY 8tI7gmTDAqVXYefmHzlhRIv0KqaOXxg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-386-pNtFhN0mNI-hmXaLm1ZGDA-1; Tue, 12 Oct 2021 03:43:22 -0400 X-MC-Unique: pNtFhN0mNI-hmXaLm1ZGDA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 01450100C662; Tue, 12 Oct 2021 07:43:21 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.193.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 895855DA2D; Tue, 12 Oct 2021 07:43:20 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id C6B3D1800393; Tue, 12 Oct 2021 09:43:18 +0200 (CEST) Date: Tue, 12 Oct 2021 09:43:18 +0200 From: "Gerd Hoffmann" To: Min Xu Cc: devel@edk2.groups.io, Ard Biesheuvel , Jordan Justen , Brijesh Singh , Erdem Aktas , James Bottomley , Jiewen Yao , Tom Lendacky Subject: Re: [PATCH V9 4/4] OvmfPkg: Enable TDX in ResetVector Message-ID: <20211012074318.evyxxk67jbbauv57@sirius.home.kraxel.org> References: MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, > +; Load the GDT and set the CR0. > +; > +; Modified: EAX, EBX, CR0, CR4, DS, ES, FS, GS, SS, CS > +; > +ReloadFlat32: > + > + cli > + mov ebx, ADDR_OF(gdtr) > + lgdt [ebx] No need to modify ebx here, eax should do fine. > + mov eax, SEC_DEFAULT_CR0 > + mov cr0, eax > + > + jmp LINEAR_CODE_SEL:dword ADDR_OF(jumpToFlat32BitAndLandHere) > + > +jumpToFlat32BitAndLandHere: Strictly speaking this is not correct, you are already in Flat32 mode, so this only loads cs. > +InitTdx: > + ; > + ; Save EBX in EBP because EBX will be changed in ReloadFlat32 > + ; > + mov ebp, ebx See above, there is no need to modify ebx in ReloadFlat32. Also: seems ebx is never restored ... take care, Gerd