Prev: How to use __readmsr(int address) to get MSR of CPU
Next: How to convert "\Device\HarddiskVolume1\" to "C:\"
From: hypervista on 27 Dec 2006 17:01 I need to perform cpuid, rdmsr, and edit a variety of control registers. I'm writing a software only device driver (my first) beause many of these actions require ring 0 privelege. I have a basic driver working and am in the process of coding the inline assembly portions. I've started with the cpuid code. I want to do some kernel debug printing to check that all is going well. I'm haivng difficulty with "call KdPrint(("blah blah\n")) in my inline assembly code. I'm getting build errors when the "call KdPrint" is included. Everything builds properly without the call KdPrint. Any help will be greatly appreciated.
From: Don Burn on 27 Dec 2006 17:12 Well it doesn't help that KdPrint is a #define not a routine. Also, of course you realize that inline assembler only works on 32-bit and so your driver is limited. Finally, you mention editing control registers, this typically results in crashes or security breaches. -- Don Burn (MVP, Windows DDK) Windows 2k/XP/2k3 Filesystem and Driver Consulting http://www.windrvr.com Remove StopSpam from the email to reply "hypervista(a)newsgroups.nospam" <hypervistanewsgroupsnospam(a)discussions.microsoft.com> wrote in message news:6BB3CBA5-6B27-4683-A7DF-DCE4FA483EC5(a)microsoft.com... >I need to perform cpuid, rdmsr, and edit a variety of control registers. >I'm > writing a software only device driver (my first) beause many of these > actions > require ring 0 privelege. > I have a basic driver working and am in the process of coding the inline > assembly portions. I've started with the cpuid code. I want to do some > kernel debug printing to check that all is going well. I'm haivng > difficulty > with "call KdPrint(("blah blah\n")) in my inline assembly code. I'm > getting > build errors when the "call KdPrint" is included. Everything builds > properly > without the call KdPrint. > Any help will be greatly appreciated.
From: hypervista on 27 Dec 2006 17:26 Thanks. That explains why call KdPrint doesn't work. Perhaps I need to provide more explaination .... I'm experimenting with the VMX features of the new Intel processors. I have to check and perhaps set a particular bit in CR4. I also have to check several MSRs (rdmsr) before finally calling VMXON. Can you point me in the right direction given inline assembly limits me to 32-bit drivers and how can I safely perform the necessary steps in getting to VMXON? Thank you for such a quick reply to my first question, Don. "Don Burn" wrote: > Well it doesn't help that KdPrint is a #define not a routine. Also, of > course you realize that inline assembler only works on 32-bit and so your > driver is limited. Finally, you mention editing control registers, this > typically results in crashes or security breaches. > > > -- > Don Burn (MVP, Windows DDK) > Windows 2k/XP/2k3 Filesystem and Driver Consulting > http://www.windrvr.com > Remove StopSpam from the email to reply > > > > "hypervista(a)newsgroups.nospam" > <hypervistanewsgroupsnospam(a)discussions.microsoft.com> wrote in message > news:6BB3CBA5-6B27-4683-A7DF-DCE4FA483EC5(a)microsoft.com... > >I need to perform cpuid, rdmsr, and edit a variety of control registers. > >I'm > > writing a software only device driver (my first) beause many of these > > actions > > require ring 0 privelege. > > I have a basic driver working and am in the process of coding the inline > > assembly portions. I've started with the cpuid code. I want to do some > > kernel debug printing to check that all is going well. I'm haivng > > difficulty > > with "call KdPrint(("blah blah\n")) in my inline assembly code. I'm > > getting > > build errors when the "call KdPrint" is included. Everything builds > > properly > > without the call KdPrint. > > Any help will be greatly appreciated. > > >
From: Don Burn on 27 Dec 2006 17:47 I haven't looked at the VMX capability, but in general if you need to muck at that level, make yourself some simple primatives, that do just the function involved. For instance, things to read an MSR, and read/write CR4. Then use C for the code around the primatives, this keeps things simple enough if you need to move to x64 you can rewrite these small functions to an assembler file. -- Don Burn (MVP, Windows DDK) Windows 2k/XP/2k3 Filesystem and Driver Consulting http://www.windrvr.com Remove StopSpam from the email to reply "hypervista(a)newsgroups.nospam" <hypervistanewsgroupsnospam(a)discussions.microsoft.com> wrote in message news:A2703F92-5DBF-4D6D-8B85-8F20C39CD623(a)microsoft.com... > Thanks. That explains why call KdPrint doesn't work. > > Perhaps I need to provide more explaination .... > > I'm experimenting with the VMX features of the new Intel processors. I > have > to check and perhaps set a particular bit in CR4. I also have to check > several MSRs (rdmsr) before finally calling VMXON. > > Can you point me in the right direction given inline assembly limits me > to > 32-bit drivers and how can I safely perform the necessary steps in > getting to > VMXON? > > Thank you for such a quick reply to my first question, Don. > > "Don Burn" wrote: > >> Well it doesn't help that KdPrint is a #define not a routine. Also, of >> course you realize that inline assembler only works on 32-bit and so >> your >> driver is limited. Finally, you mention editing control registers, this >> typically results in crashes or security breaches. >> >> >> -- >> Don Burn (MVP, Windows DDK) >> Windows 2k/XP/2k3 Filesystem and Driver Consulting >> http://www.windrvr.com >> Remove StopSpam from the email to reply >> >> >> >> "hypervista(a)newsgroups.nospam" >> <hypervistanewsgroupsnospam(a)discussions.microsoft.com> wrote in message >> news:6BB3CBA5-6B27-4683-A7DF-DCE4FA483EC5(a)microsoft.com... >> >I need to perform cpuid, rdmsr, and edit a variety of control >> >registers. >> >I'm >> > writing a software only device driver (my first) beause many of these >> > actions >> > require ring 0 privelege. >> > I have a basic driver working and am in the process of coding the >> > inline >> > assembly portions. I've started with the cpuid code. I want to do >> > some >> > kernel debug printing to check that all is going well. I'm haivng >> > difficulty >> > with "call KdPrint(("blah blah\n")) in my inline assembly code. I'm >> > getting >> > build errors when the "call KdPrint" is included. Everything builds >> > properly >> > without the call KdPrint. >> > Any help will be greatly appreciated. >> >> >>
From: hypervista on 27 Dec 2006 18:11
Thanks Don. I'll do that! I appreciate the guidance. "Don Burn" wrote: > I haven't looked at the VMX capability, but in general if you need to muck > at that level, make yourself some simple primatives, that do just the > function involved. For instance, things to read an MSR, and read/write > CR4. Then use C for the code around the primatives, this keeps things > simple enough if you need to move to x64 you can rewrite these small > functions to an assembler file. > > > -- > Don Burn (MVP, Windows DDK) > Windows 2k/XP/2k3 Filesystem and Driver Consulting > http://www.windrvr.com > Remove StopSpam from the email to reply > > > "hypervista(a)newsgroups.nospam" > <hypervistanewsgroupsnospam(a)discussions.microsoft.com> wrote in message > news:A2703F92-5DBF-4D6D-8B85-8F20C39CD623(a)microsoft.com... > > Thanks. That explains why call KdPrint doesn't work. > > > > Perhaps I need to provide more explaination .... > > > > I'm experimenting with the VMX features of the new Intel processors. I > > have > > to check and perhaps set a particular bit in CR4. I also have to check > > several MSRs (rdmsr) before finally calling VMXON. > > > > Can you point me in the right direction given inline assembly limits me > > to > > 32-bit drivers and how can I safely perform the necessary steps in > > getting to > > VMXON? > > > > Thank you for such a quick reply to my first question, Don. > > > > "Don Burn" wrote: > > > >> Well it doesn't help that KdPrint is a #define not a routine. Also, of > >> course you realize that inline assembler only works on 32-bit and so > >> your > >> driver is limited. Finally, you mention editing control registers, this > >> typically results in crashes or security breaches. > >> > >> > >> -- > >> Don Burn (MVP, Windows DDK) > >> Windows 2k/XP/2k3 Filesystem and Driver Consulting > >> http://www.windrvr.com > >> Remove StopSpam from the email to reply > >> > >> > >> > >> "hypervista(a)newsgroups.nospam" > >> <hypervistanewsgroupsnospam(a)discussions.microsoft.com> wrote in message > >> news:6BB3CBA5-6B27-4683-A7DF-DCE4FA483EC5(a)microsoft.com... > >> >I need to perform cpuid, rdmsr, and edit a variety of control > >> >registers. > >> >I'm > >> > writing a software only device driver (my first) beause many of these > >> > actions > >> > require ring 0 privelege. > >> > I have a basic driver working and am in the process of coding the > >> > inline > >> > assembly portions. I've started with the cpuid code. I want to do > >> > some > >> > kernel debug printing to check that all is going well. I'm haivng > >> > difficulty > >> > with "call KdPrint(("blah blah\n")) in my inline assembly code. I'm > >> > getting > >> > build errors when the "call KdPrint" is included. Everything builds > >> > properly > >> > without the call KdPrint. > >> > Any help will be greatly appreciated. > >> > >> > >> > > > |