* [PATCH] symbol instead of constant in kvm_show_code()
@ 2007-06-03 9:54 Nguyen Anh Quynh
[not found] ` <9cde8bff0706030254r33945255t42c0b0b6c86cf5ca-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Nguyen Anh Quynh @ 2007-06-03 9:54 UTC (permalink / raw)
To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
[-- Attachment #1: Type: text/plain, Size: 169 bytes --]
This patch uses symbol rather than a constant in kvm_show_code(), so
more readable :-)
Signed-off-by: Nguyen Anh Quynh <aquynh-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
[-- Attachment #2: patch7.patch --]
[-- Type: application/octet-stream, Size: 965 bytes --]
diff --git a/user/kvmctl.c b/user/kvmctl.c
index 82d1926..b97c7d2 100644
--- a/user/kvmctl.c
+++ b/user/kvmctl.c
@@ -666,6 +666,7 @@ void kvm_show_regs(kvm_context_t kvm, int vcpu)
static void kvm_show_code(kvm_context_t kvm, int vcpu)
{
+#define CR0_PE_MASK (1ULL<<0)
int fd = kvm->vcpu_fd[vcpu];
struct kvm_regs regs;
struct kvm_sregs sregs;
@@ -674,18 +675,19 @@ static void kvm_show_code(kvm_context_t kvm, int vcpu)
char code_str[sizeof(code) * 3 + 1];
unsigned long rip;
- r = ioctl(fd, KVM_GET_REGS, ®s);
- if (r == -1) {
- perror("KVM_GET_REGS");
- return;
- }
r = ioctl(fd, KVM_GET_SREGS, &sregs);
if (r == -1) {
perror("KVM_GET_SREGS");
return;
}
- if (sregs.cr0 & 1)
+ if (sregs.cr0 & CR0_PE_MASK)
return;
+
+ r = ioctl(fd, KVM_GET_REGS, ®s);
+ if (r == -1) {
+ perror("KVM_GET_REGS");
+ return;
+ }
rip = sregs.cs.base * 16 + regs.rip;
memcpy(code, kvm->physical_memory + rip, sizeof code);
*code_str = 0;
[-- Attachment #3: Type: text/plain, Size: 286 bytes --]
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
[-- Attachment #4: Type: text/plain, Size: 186 bytes --]
_______________________________________________
kvm-devel mailing list
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/kvm-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] symbol instead of constant in kvm_show_code()
[not found] ` <9cde8bff0706030254r33945255t42c0b0b6c86cf5ca-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2007-06-03 9:59 ` Avi Kivity
0 siblings, 0 replies; 2+ messages in thread
From: Avi Kivity @ 2007-06-03 9:59 UTC (permalink / raw)
To: Nguyen Anh Quynh; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
Nguyen Anh Quynh wrote:
> This patch uses symbol rather than a constant in kvm_show_code(), so
> more readable :-)
Applied, thanks.
--
error compiling committee.c: too many arguments to function
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-06-03 9:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-03 9:54 [PATCH] symbol instead of constant in kvm_show_code() Nguyen Anh Quynh
[not found] ` <9cde8bff0706030254r33945255t42c0b0b6c86cf5ca-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-06-03 9:59 ` Avi Kivity
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox