Skip to contentSkip to conversation

x86: emulate read/write access to cr8

PATCH Applied Joerg Roedel 2 participants 5 messages Dec 6, 2007 3 messages not in the archive KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: emulate read/write access to cr8

From: Joerg Roedel <jroedel-Ug2OvFXVNAT2eFz/[email protected]>

This patch adds code to emulate the access to the cr8 register to the x86 instruction emulator in kvm.

---
 drivers/kvm/x86.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
drivers/kvm/x86.c +5 -0
index 6deb052..9db4e32 100644
@@ -2236,6 +2236,8 @@ unsigned long realmode_get_cr(struct kvm_vcpu *vcpu, int cr)
 		return vcpu->cr3;
 	case 4:
 		return vcpu->cr4;
+	case 8:
+		return get_cr8(vcpu);
 	default:
 		vcpu_printf(vcpu, "%s: unexpected cr %u\n", __FUNCTION__, cr);
 		return 0;
@@ -2259,6 +2261,9 @@ void realmode_set_cr(struct kvm_vcpu *vcpu, int cr, unsigned long val,
 	case 4:
 		set_cr4(vcpu, mk_cr_64(vcpu->cr4, val));
 		break;
+	case 8:
+		set_cr8(vcpu, val & 0xfUL);
+		break;
 	default:
 		vcpu_printf(vcpu, "%s: unexpected cr %u\n", __FUNCTION__, cr);
 	}
Signature · 10 lines
1.5.2.5




-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4

A message that is not in the archive (sent off-list or not yet received): 1196952412156-git-send-email-joerg.roedel-5C7GfCeVMHo@public.gmane.org

Applied
#2 lore raw
Quoted 3 lines · Joerg Roedel

This patch adds code to emulate the access to the cr8 register to the x86 instruction emulator in kvm.

Applied, thanks.

Signature · 8 lines
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
#3 lore raw
In reply to a message not in the archive
Quoted 6 lines · Joerg Roedel

From: Joerg Roedel <jroedel-Ug2OvFXVNAT2eFz/[email protected]>

This patch adds code to emulate the access to the cr8 register to the x86 instruction emulator in kvm.

I wrote a unit test for 'mov cr8', and it passes!

Seems we aren't trapping cr8 access at all for svm.

Signature · 8 lines
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4

A message that is not in the archive (sent off-list or not yet received): 47583398.1080303-atKUWr5tajBWk0Htik3J/[email protected]

#5 lore raw
Quoted 10 lines · Avi Kivity
Quoted 7 lines · Joerg Roedel

From: Joerg Roedel <jroedel-Ug2OvFXVNAT2eFz/[email protected]>

This patch adds code to emulate the access to the cr8 register to the x86 instruction emulator in kvm.

Quoted 5 lines

I wrote a unit test for 'mov cr8', and it passes!

Seems we aren't trapping cr8 access at all for svm.

Okay, I added mov cr8 trapping to svm.c.

Signature · 8 lines
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4

A message that is not in the archive (sent off-list or not yet received): 475836B5.5070505-atKUWr5tajBWk0Htik3J/[email protected]

#7 lore raw
Quoted 10 lines · Avi Kivity
Quoted 9 lines · Avi Kivity
Quoted 6 lines · Joerg Roedel

From: Joerg Roedel <jroedel-Ug2OvFXVNAT2eFz/[email protected]>

This patch adds code to emulate the access to the cr8 register to the x86 instruction emulator in kvm.

Quoted 7 lines
Quoted 5 lines

I wrote a unit test for 'mov cr8', and it passes!

Seems we aren't trapping cr8 access at all for svm.

Okay, I added mov cr8 trapping to svm.c.

I have cr8 access intercepted here, but this is not sufficient for getting Vista 64bit running. Therefore I have not sent the patch yet.

Signature · 14 lines
           |           AMD Saxony Limited Liability Company & Co. KG
 Operating |         Wilschdorfer Landstr. 101, 01109 Dresden, Germany
 System    |                  Register Court Dresden: HRA 4896
 Research  |              General Partner authorized to represent:
 Center    |             AMD Saxony LLC (Wilmington, Delaware, US)
           | General Manager of AMD Saxony LLC: Dr. Hans-R. Deppe, Thomas McCoy



-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4