From: Mukesh Rathor <mukesh.rathor@oracle.com>
To: Xen-devel@lists.xensource.com
Subject: [PATCH 04/24] PVH xen: add params to read_segment_register
Date: Wed, 17 Jul 2013 19:32:48 -0700 [thread overview]
Message-ID: <1374114788-27652-5-git-send-email-mukesh.rathor@oracle.com> (raw)
In-Reply-To: <1374114788-27652-1-git-send-email-mukesh.rathor@oracle.com>
In this preparatory patch, read_segment_register macro is changed to take
vcpu and regs parameters. No functionality change.
Changes in V2: None
Changes in V3:
- Replace read_sreg with read_segment_register
Changes in V7:
- Don't make emulate_privileged_op() public here.
Signed-off-by: Mukesh Rathor <mukesh.rathor@oracle.com>
---
xen/arch/x86/domain.c | 8 ++++----
xen/arch/x86/traps.c | 26 ++++++++++++--------------
xen/arch/x86/x86_64/traps.c | 16 ++++++++--------
xen/include/asm-x86/system.h | 2 +-
4 files changed, 25 insertions(+), 27 deletions(-)
diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 73ddad7..5de5e49 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1221,10 +1221,10 @@ static void save_segments(struct vcpu *v)
struct cpu_user_regs *regs = &v->arch.user_regs;
unsigned int dirty_segment_mask = 0;
- regs->ds = read_segment_register(ds);
- regs->es = read_segment_register(es);
- regs->fs = read_segment_register(fs);
- regs->gs = read_segment_register(gs);
+ regs->ds = read_segment_register(v, regs, ds);
+ regs->es = read_segment_register(v, regs, es);
+ regs->fs = read_segment_register(v, regs, fs);
+ regs->gs = read_segment_register(v, regs, gs);
if ( regs->ds )
dirty_segment_mask |= DIRTY_DS;
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 57dbd0c..378ef0a 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1831,8 +1831,6 @@ static inline uint64_t guest_misc_enable(uint64_t val)
} \
(eip) += sizeof(_x); _x; })
-#define read_sreg(regs, sr) read_segment_register(sr)
-
static int is_cpufreq_controller(struct domain *d)
{
return ((cpufreq_controller == FREQCTL_dom0_kernel) &&
@@ -1877,7 +1875,7 @@ static int emulate_privileged_op(struct cpu_user_regs *regs)
goto fail;
/* emulating only opcodes not allowing SS to be default */
- data_sel = read_sreg(regs, ds);
+ data_sel = read_segment_register(v, regs, ds);
/* Legacy prefixes. */
for ( i = 0; i < 8; i++, rex == opcode || (rex = 0) )
@@ -1895,17 +1893,17 @@ static int emulate_privileged_op(struct cpu_user_regs *regs)
data_sel = regs->cs;
continue;
case 0x3e: /* DS override */
- data_sel = read_sreg(regs, ds);
+ data_sel = read_segment_register(v, regs, ds);
continue;
case 0x26: /* ES override */
- data_sel = read_sreg(regs, es);
+ data_sel = read_segment_register(v, regs, es);
continue;
case 0x64: /* FS override */
- data_sel = read_sreg(regs, fs);
+ data_sel = read_segment_register(v, regs, fs);
lm_ovr = lm_seg_fs;
continue;
case 0x65: /* GS override */
- data_sel = read_sreg(regs, gs);
+ data_sel = read_segment_register(v, regs, gs);
lm_ovr = lm_seg_gs;
continue;
case 0x36: /* SS override */
@@ -1952,7 +1950,7 @@ static int emulate_privileged_op(struct cpu_user_regs *regs)
if ( !(opcode & 2) )
{
- data_sel = read_sreg(regs, es);
+ data_sel = read_segment_register(v, regs, es);
lm_ovr = lm_seg_none;
}
@@ -2685,22 +2683,22 @@ static void emulate_gate_op(struct cpu_user_regs *regs)
ASSERT(opnd_sel);
continue;
case 0x3e: /* DS override */
- opnd_sel = read_sreg(regs, ds);
+ opnd_sel = read_segment_register(v, regs, ds);
if ( !opnd_sel )
opnd_sel = dpl;
continue;
case 0x26: /* ES override */
- opnd_sel = read_sreg(regs, es);
+ opnd_sel = read_segment_register(v, regs, es);
if ( !opnd_sel )
opnd_sel = dpl;
continue;
case 0x64: /* FS override */
- opnd_sel = read_sreg(regs, fs);
+ opnd_sel = read_segment_register(v, regs, fs);
if ( !opnd_sel )
opnd_sel = dpl;
continue;
case 0x65: /* GS override */
- opnd_sel = read_sreg(regs, gs);
+ opnd_sel = read_segment_register(v, regs, gs);
if ( !opnd_sel )
opnd_sel = dpl;
continue;
@@ -2753,7 +2751,7 @@ static void emulate_gate_op(struct cpu_user_regs *regs)
switch ( modrm & 7 )
{
default:
- opnd_sel = read_sreg(regs, ds);
+ opnd_sel = read_segment_register(v, regs, ds);
break;
case 4: case 5:
opnd_sel = regs->ss;
@@ -2781,7 +2779,7 @@ static void emulate_gate_op(struct cpu_user_regs *regs)
break;
}
if ( !opnd_sel )
- opnd_sel = read_sreg(regs, ds);
+ opnd_sel = read_segment_register(v, regs, ds);
switch ( modrm & 7 )
{
case 0: case 2: case 4:
diff --git a/xen/arch/x86/x86_64/traps.c b/xen/arch/x86/x86_64/traps.c
index bcd7609..9e0571d 100644
--- a/xen/arch/x86/x86_64/traps.c
+++ b/xen/arch/x86/x86_64/traps.c
@@ -122,10 +122,10 @@ void show_registers(struct cpu_user_regs *regs)
fault_crs[0] = read_cr0();
fault_crs[3] = read_cr3();
fault_crs[4] = read_cr4();
- fault_regs.ds = read_segment_register(ds);
- fault_regs.es = read_segment_register(es);
- fault_regs.fs = read_segment_register(fs);
- fault_regs.gs = read_segment_register(gs);
+ fault_regs.ds = read_segment_register(v, regs, ds);
+ fault_regs.es = read_segment_register(v, regs, es);
+ fault_regs.fs = read_segment_register(v, regs, fs);
+ fault_regs.gs = read_segment_register(v, regs, gs);
}
print_xen_info();
@@ -240,10 +240,10 @@ void do_double_fault(struct cpu_user_regs *regs)
crs[2] = read_cr2();
crs[3] = read_cr3();
crs[4] = read_cr4();
- regs->ds = read_segment_register(ds);
- regs->es = read_segment_register(es);
- regs->fs = read_segment_register(fs);
- regs->gs = read_segment_register(gs);
+ regs->ds = read_segment_register(current, regs, ds);
+ regs->es = read_segment_register(current, regs, es);
+ regs->fs = read_segment_register(current, regs, fs);
+ regs->gs = read_segment_register(current, regs, gs);
printk("CPU: %d\n", cpu);
_show_registers(regs, crs, CTXT_hypervisor, NULL);
diff --git a/xen/include/asm-x86/system.h b/xen/include/asm-x86/system.h
index 6ab7d56..9bb22cb 100644
--- a/xen/include/asm-x86/system.h
+++ b/xen/include/asm-x86/system.h
@@ -4,7 +4,7 @@
#include <xen/lib.h>
#include <xen/bitops.h>
-#define read_segment_register(name) \
+#define read_segment_register(vcpu, regs, name) \
({ u16 __sel; \
asm volatile ( "movw %%" STR(name) ",%0" : "=r" (__sel) ); \
__sel; \
--
1.7.2.3
next prev parent reply other threads:[~2013-07-18 2:32 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-18 2:32 [PATCH 00/24][V8]PVH xen: Phase I, Version 8 patches Mukesh Rathor
2013-07-18 2:32 ` [PATCH 01/24] PVH xen: Add readme docs/misc/pvh-readme.txt Mukesh Rathor
2013-07-18 10:09 ` Ian Campbell
2013-07-18 18:21 ` Mukesh Rathor
2013-07-19 9:16 ` Ian Campbell
2013-07-19 21:33 ` Mukesh Rathor
2013-07-22 18:21 ` Ian Campbell
2013-07-18 10:32 ` Jan Beulich
2013-07-18 10:40 ` Ian Campbell
2013-07-22 19:29 ` Konrad Rzeszutek Wilk
2013-07-18 2:32 ` [PATCH 02/24] PVH xen: update __XEN_LATEST_INTERFACE_VERSION__ Mukesh Rathor
2013-07-18 10:33 ` Jan Beulich
2013-07-18 2:32 ` [PATCH 03/24] PVH xen: turn gdb_frames/gdt_ents into union Mukesh Rathor
2013-07-22 19:22 ` Konrad Rzeszutek Wilk
2013-07-18 2:32 ` Mukesh Rathor [this message]
2013-07-18 2:32 ` [PATCH 05/24] PVH xen: Move e820 fields out of pv_domain struct Mukesh Rathor
2013-07-18 2:32 ` [PATCH 06/24] PVH xen: hvm related preparatory changes for PVH Mukesh Rathor
2013-07-18 10:37 ` Jan Beulich
2013-07-18 2:32 ` [PATCH 07/24] PVH xen: vmx " Mukesh Rathor
2013-07-18 12:29 ` Jan Beulich
2013-07-18 2:32 ` [PATCH 08/24] PVH xen: vmcs " Mukesh Rathor
2013-07-18 12:32 ` Jan Beulich
2013-07-18 2:32 ` [PATCH 09/24] PVH xen: Introduce PVH guest type and some basic changes Mukesh Rathor
2013-07-18 12:43 ` Jan Beulich
2013-07-18 18:28 ` Mukesh Rathor
2013-07-18 2:32 ` [PATCH 10/24] PVH xen: introduce pvh_set_vcpu_info() and vmx_pvh_set_vcpu_info() Mukesh Rathor
2013-07-18 13:14 ` Jan Beulich
2013-07-18 18:37 ` Mukesh Rathor
2013-07-18 2:32 ` [PATCH 11/24] PVH xen: domain create, schedular related code changes Mukesh Rathor
2013-07-18 13:16 ` Jan Beulich
2013-07-18 2:32 ` [PATCH 12/24] PVH xen: support invalid op emulation for PVH Mukesh Rathor
2013-07-18 13:17 ` Jan Beulich
2013-07-18 2:32 ` [PATCH 13/24] PVH xen: Support privileged " Mukesh Rathor
2013-07-18 13:29 ` Jan Beulich
2013-07-18 2:32 ` [PATCH 14/24] PVH xen: interrupt/event-channel delivery to PVH Mukesh Rathor
2013-07-22 19:21 ` Konrad Rzeszutek Wilk
2013-07-18 2:32 ` [PATCH 15/24] PVH xen: additional changes to support PVH guest creation and execution Mukesh Rathor
2013-07-22 19:25 ` Konrad Rzeszutek Wilk
2013-07-18 2:33 ` [PATCH 16/24] PVH xen: mapcache and show registers Mukesh Rathor
2013-07-18 2:33 ` [PATCH 17/24] PVH xen: mtrr, tsc, grant changes Mukesh Rathor
2013-07-18 2:33 ` [PATCH 18/24] PVH xen: Checks, asserts, and limitations for PVH Mukesh Rathor
2013-07-18 13:49 ` Jan Beulich
2013-07-18 2:33 ` [PATCH 19/24] PVH xen: add hypercall support " Mukesh Rathor
2013-07-18 13:56 ` Jan Beulich
2013-07-18 2:33 ` [PATCH 20/24] PVH xen: vmcs related changes Mukesh Rathor
2013-07-18 2:33 ` [PATCH 21/24] PVH xen: HVM support of PVH guest creation/destruction Mukesh Rathor
2013-07-22 19:22 ` Konrad Rzeszutek Wilk
2013-07-18 2:33 ` [PATCH 22/24] PVH xen: VMX " Mukesh Rathor
2013-07-22 19:15 ` Konrad Rzeszutek Wilk
2013-07-18 2:33 ` [PATCH 23/24] PVH xen: preparatory patch for the pvh vmexit handler patch Mukesh Rathor
2013-07-22 19:24 ` Konrad Rzeszutek Wilk
2013-07-18 2:33 ` [PATCH 24/24] PVH xen: introduce vmexit handler for PVH Mukesh Rathor
2013-07-18 10:47 ` [PATCH 00/24][V8]PVH xen: Phase I, Version 8 patches Roger Pau Monné
2013-07-19 1:23 ` Mukesh Rathor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1374114788-27652-5-git-send-email-mukesh.rathor@oracle.com \
--to=mukesh.rathor@oracle.com \
--cc=Xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).