From patchwork Thu May 2 21:42:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamas K Lengyel X-Patchwork-Id: 10927665 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 5350714DB for ; Thu, 2 May 2019 21:44:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 42F14266F3 for ; Thu, 2 May 2019 21:44:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 343B7268AE; Thu, 2 May 2019 21:44:23 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EDCC1266F3 for ; Thu, 2 May 2019 21:44:21 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hMJTB-0003Zw-2r; Thu, 02 May 2019 21:42:21 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hMJT9-0003Zq-Dg for xen-devel@lists.xenproject.org; Thu, 02 May 2019 21:42:19 +0000 X-Inumbo-ID: 223e3364-6d23-11e9-9a75-4ba27bc8b96e Received: from mail-io1-f66.google.com (unknown [209.85.166.66]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 223e3364-6d23-11e9-9a75-4ba27bc8b96e; Thu, 02 May 2019 21:42:08 +0000 (UTC) Received: by mail-io1-f66.google.com with SMTP id u12so3598848iop.0 for ; Thu, 02 May 2019 14:42:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=X6EvVJ/w2bXkMpc64qDCumNgNlaHKshVM6UsuE6fF2c=; b=EzLfpBunH6zGEN2iXF/1DqOL/rvTMCAgLHzqAoxzCuNMCRVi+xnOh6hWRqUU+9kjWr w/4vs9CASZxjvBw4JFqA9VMzLz2An0YtuSM5/TNO/qgfZavmX3wibgRBMZN5E+T7dJeM 2uGuGGtAS6ZaDbLHAydBhld3HDpZ4SpnH0J5Kjc8Km5MleQLxWs8Qws4J/sgLaoJfkrV c247UjwV1Uwh+sxZq3DJuRukKylxqcZ/RnBoVkDzfSAWnsqbxHb6uokO/jLjqBV/W6HS 8XmjjkMPZ2QZPsHH1z6TB2HSQ/89klDKN02dDiF0Dc9Kwwi0XfSUbipceqgT/Idcmk4O sZOw== X-Gm-Message-State: APjAAAXCoiryHxIW1POQpx8zJfIxqvtx+EpR+x+vfdluRCasPNm+xkf7 5GN6Ljir5XvQ51RJKF5bgUr33EV7 X-Google-Smtp-Source: APXvYqwXJaE8RWC7P1OhieYaOu5NaSZTrx+iH3mORzWnONZP5Lq5zFuK3gNY7UTol8F15S2HkCX7Ng== X-Received: by 2002:a05:6602:21d3:: with SMTP id c19mr4125521ioc.233.1556833327132; Thu, 02 May 2019 14:42:07 -0700 (PDT) Received: from localhost.localdomain (c-71-205-12-124.hsd1.co.comcast.net. [71.205.12.124]) by smtp.gmail.com with ESMTPSA id v134sm180986ita.16.2019.05.02.14.42.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 May 2019 14:42:05 -0700 (PDT) From: Tamas K Lengyel To: xen-devel@lists.xenproject.org Date: Thu, 2 May 2019 15:42:03 -0600 Message-Id: <20190502214203.17279-1-tamas@tklengyel.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v2] x86/vm_event: add gdtr_base to the vm_event structure X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Tamas K Lengyel , Wei Liu , Razvan Cojocaru , Andrew Cooper , Jan Beulich , Roger Pau Monne Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Receiving this register is useful for introspecting 32-bit Windows when the event being trapped happened while in ring3. Signed-off-by: Tamas K Lengyel Cc: Razvan Cojocaru Cc: Tamas K Lengyel Cc: Jan Beulich Cc: Andrew Cooper Cc: Wei Liu Cc: Roger Pau Monne Acked-by: Razvan Cojocaru --- v2: add gdtr limit --- xen/arch/x86/vm_event.c | 6 ++++++ xen/include/public/vm_event.h | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/vm_event.c b/xen/arch/x86/vm_event.c index 51c3493b1d..52c2a71fa0 100644 --- a/xen/arch/x86/vm_event.c +++ b/xen/arch/x86/vm_event.c @@ -179,6 +179,11 @@ static void vm_event_pack_segment_register(enum x86_segment segment, reg->es_sel = seg.sel; break; + case x86_seg_gdtr: + reg->gdtr_base = seg.base; + reg->gdtr_limit = seg.limit; + break; + default: ASSERT_UNREACHABLE(); } @@ -238,6 +243,7 @@ void vm_event_fill_regs(vm_event_request_t *req) vm_event_pack_segment_register(x86_seg_ss, &req->data.regs.x86); vm_event_pack_segment_register(x86_seg_ds, &req->data.regs.x86); vm_event_pack_segment_register(x86_seg_es, &req->data.regs.x86); + vm_event_pack_segment_register(x86_seg_gdtr, &req->data.regs.x86); req->data.regs.x86.shadow_gs = ctxt.shadow_gs; req->data.regs.x86.dr6 = ctxt.dr6; diff --git a/xen/include/public/vm_event.h b/xen/include/public/vm_event.h index b2bafc0d77..959083d8c4 100644 --- a/xen/include/public/vm_event.h +++ b/xen/include/public/vm_event.h @@ -29,7 +29,7 @@ #include "xen.h" -#define VM_EVENT_INTERFACE_VERSION 0x00000004 +#define VM_EVENT_INTERFACE_VERSION 0x00000005 #if defined(__XEN__) || defined(__XEN_TOOLS__) @@ -198,6 +198,7 @@ struct vm_event_regs_x86 { uint64_t msr_efer; uint64_t msr_star; uint64_t msr_lstar; + uint64_t gdtr_base; uint32_t cs_base; uint32_t ss_base; uint32_t ds_base; @@ -211,13 +212,14 @@ struct vm_event_regs_x86 { struct vm_event_x86_selector_reg fs; struct vm_event_x86_selector_reg gs; uint64_t shadow_gs; + uint16_t gdtr_limit; uint16_t cs_sel; uint16_t ss_sel; uint16_t ds_sel; uint16_t es_sel; uint16_t fs_sel; uint16_t gs_sel; - uint32_t _pad; + uint16_t _pad; }; /*