svn commit: r196251 - in stable/7/sys: . contrib/pf dev/cpuctl

Stanislav Sedov stas at FreeBSD.org
Sat Aug 15 15:52:21 UTC 2009


Author: stas
Date: Sat Aug 15 15:52:20 2009
New Revision: 196251
URL: http://svn.freebsd.org/changeset/base/196251

Log:
  - MFC r195081:
    - Don't zero data field in case of MSR write operation.  Before this change
      the value written to MSR register was always 0 regardless of value passed
      by user.
    - Use proper data pointer when performing AMD microcode update.  Previously,
      the pointer to user-space data has been provided instead, which is totally
      incorrect.

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/cpuctl/cpuctl.c

Modified: stable/7/sys/dev/cpuctl/cpuctl.c
==============================================================================
--- stable/7/sys/dev/cpuctl/cpuctl.c	Sat Aug 15 15:48:10 2009	(r196250)
+++ stable/7/sys/dev/cpuctl/cpuctl.c	Sat Aug 15 15:52:20 2009	(r196251)
@@ -223,14 +223,17 @@ cpuctl_do_msr(int cpu, cpuctl_msr_args_t
 	 * Explicitly clear cpuid data to avoid returning stale
 	 * info
 	 */
-	data->data = 0;
 	DPRINTF("[cpuctl,%d]: operating on MSR %#0x for %d cpu\n", __LINE__,
 	    data->msr, cpu);
 	oldcpu = td->td_oncpu;
 	is_bound = cpu_sched_is_bound(td);
 	set_cpu(cpu, td);
-	ret = cmd == CPUCTL_RDMSR ? rdmsr_safe(data->msr, &data->data) :
-	    wrmsr_safe(data->msr, data->data);
+	if (cmd == CPUCTL_RDMSR) {
+		data->data = 0;
+		ret = rdmsr_safe(data->msr, &data->data);
+	} else {
+		ret = wrmsr_safe(data->msr, data->data);
+	}
 	restore_cpu(oldcpu, is_bound, td);
 	return (ret);
 }
@@ -369,7 +372,7 @@ update_amd(int cpu, cpuctl_update_args_t
 	/*
 	 * Perform update.
 	 */
-	wrmsr_safe(MSR_K8_UCODE_UPDATE, (uintptr_t)args->data);
+	wrmsr_safe(MSR_K8_UCODE_UPDATE, (uintptr_t)ptr);
 
 	/*
 	 * Serialize instruction flow.


More information about the svn-src-stable-7 mailing list