diff options
author | Jan Beulich <jbeulich@suse.com> | 2011-12-13 09:47:13 +0100 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2011-12-13 09:47:13 +0100 |
commit | 87a009882b3df64bfb0029d439509e234d7bef2a (patch) | |
tree | 9f3a1e62526b6f12a3809ae5219cb6683a8dd0b5 /xen/arch/x86/microcode.c | |
parent | 1d15e942c685825de98fb8d791826d679f800375 (diff) | |
download | xen-87a009882b3df64bfb0029d439509e234d7bef2a.tar.gz xen-87a009882b3df64bfb0029d439509e234d7bef2a.tar.bz2 xen-87a009882b3df64bfb0029d439509e234d7bef2a.zip |
x86/microcode: Allow "ucode=" argument to be negative
... to indicate counting from the end of the modules list.
Suggested by Tim Deegan.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/arch/x86/microcode.c')
-rw-r--r-- | xen/arch/x86/microcode.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/xen/arch/x86/microcode.c b/xen/arch/x86/microcode.c index d9e6a4c58d..c3a8472e3b 100644 --- a/xen/arch/x86/microcode.c +++ b/xen/arch/x86/microcode.c @@ -41,7 +41,7 @@ static module_t __initdata ucode_mod; static void *(*__initdata ucode_mod_map)(const module_t *); -static unsigned int __initdata ucode_mod_idx; +static signed int __initdata ucode_mod_idx; static bool_t __initdata ucode_mod_forced; static cpumask_t __initdata init_mask; @@ -54,7 +54,7 @@ void __init microcode_set_module(unsigned int idx) static void __init parse_ucode(char *s) { if ( !ucode_mod_forced ) - ucode_mod_idx = simple_strtoul(s, NULL, 0); + ucode_mod_idx = simple_strtol(s, NULL, 0); } custom_param("ucode", parse_ucode); @@ -65,7 +65,9 @@ void __init microcode_grab_module( { module_t *mod = (module_t *)__va(mbi->mods_addr); - if ( !ucode_mod_idx || ucode_mod_idx >= mbi->mods_count || + if ( ucode_mod_idx < 0 ) + ucode_mod_idx += mbi->mods_count; + if ( ucode_mod_idx <= 0 || ucode_mod_idx >= mbi->mods_count || !__test_and_clear_bit(ucode_mod_idx, module_map) ) return; ucode_mod = mod[ucode_mod_idx]; |