msrs.py revision 5149
15149Sgblack@eecs.umich.edu# Copyright (c) 2007 The Hewlett-Packard Development Company
25149Sgblack@eecs.umich.edu# All rights reserved.
35149Sgblack@eecs.umich.edu#
45149Sgblack@eecs.umich.edu# Redistribution and use of this software in source and binary forms,
55149Sgblack@eecs.umich.edu# with or without modification, are permitted provided that the
65149Sgblack@eecs.umich.edu# following conditions are met:
75149Sgblack@eecs.umich.edu#
85149Sgblack@eecs.umich.edu# The software must be used only for Non-Commercial Use which means any
95149Sgblack@eecs.umich.edu# use which is NOT directed to receiving any direct monetary
105149Sgblack@eecs.umich.edu# compensation for, or commercial advantage from such use.  Illustrative
115149Sgblack@eecs.umich.edu# examples of non-commercial use are academic research, personal study,
125149Sgblack@eecs.umich.edu# teaching, education and corporate research & development.
135149Sgblack@eecs.umich.edu# Illustrative examples of commercial use are distributing products for
145149Sgblack@eecs.umich.edu# commercial advantage and providing services using the software for
155149Sgblack@eecs.umich.edu# commercial advantage.
165149Sgblack@eecs.umich.edu#
175149Sgblack@eecs.umich.edu# If you wish to use this software or functionality therein that may be
185149Sgblack@eecs.umich.edu# covered by patents for commercial use, please contact:
195149Sgblack@eecs.umich.edu#     Director of Intellectual Property Licensing
205149Sgblack@eecs.umich.edu#     Office of Strategy and Technology
215149Sgblack@eecs.umich.edu#     Hewlett-Packard Company
225149Sgblack@eecs.umich.edu#     1501 Page Mill Road
235149Sgblack@eecs.umich.edu#     Palo Alto, California  94304
245149Sgblack@eecs.umich.edu#
255149Sgblack@eecs.umich.edu# Redistributions of source code must retain the above copyright notice,
265149Sgblack@eecs.umich.edu# this list of conditions and the following disclaimer.  Redistributions
275149Sgblack@eecs.umich.edu# in binary form must reproduce the above copyright notice, this list of
285149Sgblack@eecs.umich.edu# conditions and the following disclaimer in the documentation and/or
295149Sgblack@eecs.umich.edu# other materials provided with the distribution.  Neither the name of
305149Sgblack@eecs.umich.edu# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
315149Sgblack@eecs.umich.edu# contributors may be used to endorse or promote products derived from
325149Sgblack@eecs.umich.edu# this software without specific prior written permission.  No right of
335149Sgblack@eecs.umich.edu# sublicense is granted herewith.  Derivatives of the software and
345149Sgblack@eecs.umich.edu# output created using the software may be prepared, but only for
355149Sgblack@eecs.umich.edu# Non-Commercial Uses.  Derivatives of the software may be shared with
365149Sgblack@eecs.umich.edu# others provided: (i) the others agree to abide by the list of
375149Sgblack@eecs.umich.edu# conditions herein which includes the Non-Commercial Use restrictions;
385149Sgblack@eecs.umich.edu# and (ii) such Derivatives of the software include the above copyright
395149Sgblack@eecs.umich.edu# notice to acknowledge the contribution from this software where
405149Sgblack@eecs.umich.edu# applicable, this list of conditions and the disclaimer below.
415149Sgblack@eecs.umich.edu#
425149Sgblack@eecs.umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
435149Sgblack@eecs.umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
445149Sgblack@eecs.umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
455149Sgblack@eecs.umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
465149Sgblack@eecs.umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
475149Sgblack@eecs.umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
485149Sgblack@eecs.umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
495149Sgblack@eecs.umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
505149Sgblack@eecs.umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
515149Sgblack@eecs.umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
525149Sgblack@eecs.umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
535149Sgblack@eecs.umich.edu#
545149Sgblack@eecs.umich.edu# Authors: Gabe Black
555149Sgblack@eecs.umich.edu
565149Sgblack@eecs.umich.edumicrocode = '''
575149Sgblack@eecs.umich.edudef macroop WRMSR
585149Sgblack@eecs.umich.edu{
595149Sgblack@eecs.umich.edu    limm t1, "IntAddrPrefixMSR >> 3"
605149Sgblack@eecs.umich.edu    ld t2, intseg, [8, t1, rcx], dataSize=8, addressSize=4
615149Sgblack@eecs.umich.edu    mov rax, rax, t2, dataSize=4
625149Sgblack@eecs.umich.edu    srli t2, t2, 32, dataSize=8
635149Sgblack@eecs.umich.edu    mov rdx, rdx, t2, dataSize=4
645149Sgblack@eecs.umich.edu};
655149Sgblack@eecs.umich.edu
665149Sgblack@eecs.umich.edudef macroop RDMSR
675149Sgblack@eecs.umich.edu{
685149Sgblack@eecs.umich.edu    limm t1, "IntAddrPrefixMSR >> 3"
695149Sgblack@eecs.umich.edu    mov t2, t2, rdx, dataSize=4
705149Sgblack@eecs.umich.edu    slli t2, t2, 32, dataSize=8
715149Sgblack@eecs.umich.edu    mov t2, t2, rax, dataSize=4
725149Sgblack@eecs.umich.edu    st t2, intseg, [8, t1, rcx], dataSize=8, addressSize=4
735149Sgblack@eecs.umich.edu};
745149Sgblack@eecs.umich.edu'''
75