모두의 코드
CPUID (Intel x86/64 assembly instruction)

작성일 : 2020-09-01 이 글은 2080 번 읽혔습니다.

CPUID

CPU Identification

참고 사항

아래 표를 해석하는 방법은 x86-64 명령어 레퍼런스 읽는 법 글을 참조하시기 바랍니다.

Opcode

Instruction

Op/
En

64-Bit
Mode

Compat/
Leg Mode

Description

0F A2

CPUID

NP

Valid

Valid

Returns processor identification and feature information to the EAX, EBX, ECX, and EDX registers, as determined by input entered in EAX (in some cases, ECX as well).

Instruction Operand Encoding

Op/En

Operand 1

Operand 2

Operand 3

Operand 4

NP

NA

NA

NA

NA

Description

The ID flag (bit 21) in the EFLAGS register indicates support for the CPUID instruction. If a software procedure can set and clear this flag, the processor executing the procedure supports the CPUID instruction. This instruction oper-ates the same in non-64-bit modes and 64-bit mode.

CPUID returns processor identification and feature information in the EAX, EBX, ECX, and EDX registers.1 The instruction's output is dependent on the contents of the EAX register upon execution (in some cases, ECX as well). For example, the following pseudocode loads EAX with 00H and causes CPUID to return a Maximum Return Value and the Vendor Identification String in the appropriate registers:

MOV EAX, 00H

CPUID

Table 3-8 shows information returned, depending on the initial value loaded into the EAX register.

Two types of information are returned: basic and extended function information. If a value entered for CPUID.EAX is higher than the maximum input value for basic or extended function for that processor then the data for the highest basic information leaf is returned. For example, using the Intel Core i7 processor, the following is true:

CPUID.EAX = 05H (\esc{*} Returns MONITOR/MWAIT leaf. \esc{*})

CPUID.EAX = 0AH (\esc{*} Returns Architectural Performance Monitoring leaf. \esc{*})

CPUID.EAX = 0BH (\esc{*} Returns Extended Topology Enumeration leaf. \esc{*})

CPUID.EAX = 0CH (\esc{*} INVALID: Returns the same information as CPUID.EAX = 0BH. \esc{*})

CPUID.EAX = 80000008H (\esc{*} Returns linear/physical address size data. \esc{*})

CPUID.EAX = 8000000AH (\esc{*} INVALID: Returns same information as CPUID.EAX = 0BH. \esc{*})

If a value entered for CPUID.EAX is less than or equal to the maximum input value and the leaf is not supported on that processor then 0 is returned in all the registers.

When CPUID returns the highest basic leaf information as a result of an invalid input EAX value, any dependence on input ECX value in the basic leaf is honored.

CPUID can be executed at any privilege level to serialize instruction execution. Serializing instruction execution guarantees that any modifications to flags, registers, and memory for previous instructions are completed before the next instruction is fetched and executed.

See also:

"Serializing Instructions" in Chapter 8, "Multiple-Processor Management," in the Intel(R) 64 and IA-32 Architectures Software Developer's Manual, Volume 3A.

"Caching Translation Information" in Chapter 4, "Paging," in the Intel(R) 64 and IA-32 Architectures Software Devel-oper's Manual, Volume 3A.

`sidenote

  1. On Intel 64 processors, CPUID clears the high 32 bits of the RAX/RBX/RCX/RDX registers in all modes.

    embed

    <figure>

    <svg viewBox="0 0 379.679993 414.779999">

    <rect x="0.000000" y="10.000000" width="0.480000" height="316.619995" fill-rule="nonzero" fill=" rgb(0,0,0) " stroke="black" />

    <rect x="379.200012" y="10.000000" width="0.479980" height="316.619995" fill-rule="nonzero" fill=" rgb(0,0,0) " stroke="black" />

    <rect x="0.000000" y="9.520020" width="379.679993" height="0.479980" fill-rule="nonzero" fill=" rgb(0,0,0) " stroke="black" />

    <rect x="0.000000" y="326.619965" width="379.679993" height="0.480010" fill-rule="nonzero" fill=" rgb(0,0,0) " stroke="black" />

    <rect x="20.039993" y="26.739990" width="318.600006" height="288.600006" fill-rule="nonzero" fill=" rgb(255,255,255) " stroke="black" />

    <path d="M21.600006,106.239990 L83.820007,77.020020 L146.039993,106.239990 L83.820007,135.459961 L21.600006,106.239990" fill-rule="evenodd" fill=" rgb(255,255,255) " stroke="black" />

    <path d="M21.600006,106.239990 L83.820007,77.020020 L146.039993,106.239990 L83.820007,135.459961 L21.600006,106.239990" stoke="black" stroke=" rgb(0,0,0) " fill="white" fill-opacity="0" />

    <path d="M83.820007,47.799988 L83.820007,73.659973" stoke="black" stroke=" rgb(0,0,0) " fill="white" fill-opacity="0" />

    <path d="M83.820007,77.020020 L81.660004,72.640015 C83.040009 73.300049,84.600006 73.300049,86.040009 72.640015 L83.820007,77.020020" fill-rule="evenodd" fill=" rgb(0,0,0) " stroke="black" />

    <path d="M21.600006,269.380005 L83.820007,240.160004 L146.039993,269.380005 L83.820007,298.600006 L21.600006,269.380005" fill-rule="evenodd" fill=" rgb(255,255,255) " stroke="black" />

    <path d="M21.600006,269.380005 L83.820007,240.160004 L146.039993,269.380005 L83.820007,298.600006 L21.600006,269.380005" stoke="black" stroke=" rgb(0,0,0) " fill="white" fill-opacity="0" />

    <path d="M83.820007,210.940002 L83.820007,236.799988" stoke="black" stroke=" rgb(0,0,0) " fill="white" fill-opacity="0" />

    <path d="M83.820007,240.160004 L81.660004,235.720001 C83.040009 236.440002,84.600006 236.440002,86.040009 235.720001 L83.820007,240.160004" fill-rule="evenodd" fill=" rgb(0,0,0) " stroke="black" />

    <path d="M83.820007,135.459961 L83.820007,178.359985" stoke="black" stroke=" rgb(0,0,0) " fill="white" fill-opacity="0" />

    <path d="M83.820007,181.719971 L81.660004,177.279968 C83.040009 178.000000,84.600006 178.000000,86.040009 177.279968 L83.820007,181.719971" fill-rule="evenodd" fill=" rgb(0,0,0) " stroke="black" />

    <rect x="35.940002" y="181.719971" width="95.760002" height="36.540001" fill-rule="nonzero" fill=" rgb(255,255,255) " stroke="black" />

    <rect x="35.940002" y="181.719971" width="95.760002" height="36.540001" stoke="black" fill=" rgb(0,0,0) " stroke="black" />

    <rect x="35.940002" y="28.360046" width="95.760002" height="29.219999" fill-rule="nonzero" fill=" rgb(255,255,255) " stroke="black" />

    <rect x="35.940002" y="28.360046" width="95.760002" height="29.219999" stoke="black" fill=" rgb(0,0,0) " stroke="black" />

    <rect x="232.199997" y="88.000000" width="95.699997" height="36.480000" fill-rule="nonzero" fill=" rgb(255,255,255) " stroke="black" />

    <rect x="232.199997" y="88.000000" width="95.699997" height="36.480000" stoke="black" fill=" rgb(0,0,0) " stroke="black" />

    <path d="M146.039993,106.239990 L228.899979,106.239990" stoke="black" stroke=" rgb(0,0,0) " fill="white" fill-opacity="0" />

    <path d="M232.199997,106.239990 L227.819992,108.459961 C228.539993 107.080017,228.539993 105.459961,227.819992 104.080017 L232.199997,106.239990" fill-rule="evenodd" fill=" rgb(0,0,0) " stroke="black" />

    <rect x="232.199997" y="251.079987" width="95.699997" height="36.540001" fill-rule="nonzero" fill=" rgb(255,255,255) " stroke="black" />

    <rect x="232.199997" y="251.079987" width="95.699997" height="36.540001" stoke="black" fill=" rgb(0,0,0) " stroke="black" />

    <path d="M146.039993,269.380005 L228.899979,269.380005" stoke="black" stroke=" rgb(0,0,0) " fill="white" fill-opacity="0" />

    <path d="M232.199997,269.380005 L227.819992,271.600006 C228.539993 270.160004,228.539993 268.540009,227.819992 267.160004 L232.199997,269.380005" fill-rule="evenodd" fill=" rgb(0,0,0) " stroke="black" />

    <text x="193.920151" y="264.519989" textLength="4.963746" font-size="8px">e</text>

    <text x="189.121567" y="264.519989" textLength="4.963746" font-size="8px">u</text>

    <text x="307.973083" y="278.319855" textLength="4.963746" font-size="8px">d</text>

    <text x="283.257019" y="278.319855" textLength="4.963746" font-size="8px">p</text>

    <text x="278.458435" y="278.319855" textLength="4.963746" font-size="8px">u</text>

    <text x="260.939819" y="278.319855" textLength="4.963746" font-size="8px">n</text>

    <text x="253.739731" y="278.319855" textLength="2.481873" font-size="8px">t</text>

    <text x="248.159988" y="278.319855" textLength="5.954709" font-size="8px">S</text>

    <text x="307.194702" y="267.759979" textLength="4.963746" font-size="8px">d</text>

    <text x="302.396118" y="267.759979" textLength="4.963746" font-size="8px">n</text>

    <text x="297.597534" y="267.759979" textLength="4.963746" font-size="8px">a</text>

    <text x="294.417480" y="267.759979" textLength="2.972891" font-size="8px">r</text>

    <text x="288.837769" y="267.759979" textLength="5.954709" font-size="8px">B</text>

    <text x="286.436218" y="267.759979" textLength="2.481873" font-size="8px"> </text>

    <text x="278.457642" y="267.759979" textLength="4.963746" font-size="8px">o</text>

    <text x="274.497314" y="267.759979" textLength="4.463800" font-size="8px">s</text>

    <text x="270.477234" y="267.759979" textLength="4.463800" font-size="8px">s</text>

    <text x="256.919739" y="267.759979" textLength="4.963746" font-size="8px">o</text>

    <text x="248.159988" y="267.759979" textLength="5.954709" font-size="8px">P</text>

    <text x="190.738693" y="101.380005" textLength="4.463800" font-size="8px">s</text>

    <text x="290.455383" y="120.099548" textLength="4.963746" font-size="8px">e</text>

    <text x="284.873840" y="120.099548" textLength="2.972891" font-size="8px">r</text>

    <text x="280.075256" y="120.099548" textLength="4.963746" font-size="8px">o</text>

    <text x="275.276672" y="120.099548" textLength="4.963746" font-size="8px">p</text>

    <text x="270.478088" y="120.099548" textLength="4.963746" font-size="8px">p</text>

    <text x="265.679504" y="120.099548" textLength="4.963746" font-size="8px">u</text>

    <text x="260.099731" y="120.099548" textLength="5.954709" font-size="8px">S</text>

    <text x="296.815369" y="110.319885" textLength="2.481873" font-size="8px">t</text>

    <text x="283.257019" y="110.319885" textLength="2.481873" font-size="8px"> </text>

    <text x="278.458435" y="110.319885" textLength="4.963746" font-size="8px">g</text>

    <text x="272.101135" y="110.319885" textLength="1.981927" font-size="8px">i</text>

    <text x="260.939819" y="110.319885" textLength="5.954709" font-size="8px">S</text>

    <text x="307.194702" y="99.760010" textLength="4.963746" font-size="8px">d</text>

    <text x="302.396118" y="99.760010" textLength="4.963746" font-size="8px">n</text>

    <text x="297.597534" y="99.760010" textLength="4.963746" font-size="8px">a</text>

    <text x="294.417480" y="99.760010" textLength="2.972891" font-size="8px">r</text>

    <text x="274.497314" y="99.760010" textLength="4.463800" font-size="8px">s</text>

    <text x="270.477234" y="99.760010" textLength="4.463800" font-size="8px">s</text>

    <text x="265.678650" y="99.760010" textLength="4.963746" font-size="8px">e</text>

    <text x="261.718323" y="99.760010" textLength="4.463800" font-size="8px">c</text>

    <text x="256.919739" y="99.760010" textLength="4.963746" font-size="8px">o</text>

    <text x="248.159988" y="99.760010" textLength="5.954709" font-size="8px">P</text>

    <text x="103.009140" y="51.099854" textLength="4.963746" font-size="8px">0</text>

    <text x="98.210556" y="51.099854" textLength="4.963746" font-size="8px">0</text>

    <text x="83.874619" y="51.099854" textLength="4.963746" font-size="8px">0</text>

    <text x="88.613388" y="51.099854" textLength="4.963746" font-size="8px">0</text>

    <text x="74.277451" y="51.099854" textLength="4.963746" font-size="8px">0</text>

    <text x="65.518585" y="51.099854" textLength="4.463800" font-size="8px">x</text>

    <text x="288.055603" y="278.319855" textLength="4.963746" font-size="8px">p</text>

    <text x="60.720001" y="51.099854" textLength="4.963746" font-size="8px">0</text>

    <text x="106.200745" y="40.539978" textLength="2.481873" font-size="8px"> </text>

    <text x="286.436218" y="99.760010" textLength="2.481873" font-size="8px"> </text>

    <text x="101.371811" y="40.539978" textLength="5.213718" font-size="8px">=</text>

    <text x="90.231949" y="40.539978" textLength="5.954709" font-size="8px">A</text>

    <text x="84.662018" y="40.539978" textLength="5.954709" font-size="8px">E</text>

    <text x="268.921082" y="110.319885" textLength="2.972891" font-size="8px">r</text>

    <text x="70.318436" y="72.159973" textLength="6.445727" font-size="8px">D</text>

    <text x="61.501648" y="214.239746" textLength="4.963746" font-size="8px">u</text>

    <text x="115.740295" y="270.220001" textLength="4.963746" font-size="8px">u</text>

    <text x="98.218170" y="214.239746" textLength="4.963746" font-size="8px">d</text>

    <text x="63.899231" y="159.039856" textLength="2.481873" font-size="8px">t</text>

    <text x="253.739731" y="267.759979" textLength="2.972891" font-size="8px">r</text>

    <text x="261.718323" y="267.759979" textLength="4.463800" font-size="8px">c</text>

    <text x="96.601929" y="153.339905" textLength="2.972891" font-size="8px">r</text>

    <text x="189.120132" y="101.380005" textLength="1.981927" font-size="8px">l</text>

    <text x="91.020386" y="153.339905" textLength="5.454763" font-size="8px">T</text>

    <text x="98.999344" y="193.119995" textLength="4.963746" font-size="8px">a</text>

    <text x="59.100998" y="203.679871" textLength="2.481873" font-size="8px"> </text>

    <text x="265.678650" y="267.759979" textLength="4.963746" font-size="8px">e</text>

    <text x="117.355377" y="193.119995" textLength="5.213718" font-size="8px">=</text>

    <text x="83.884933" y="109.539978" textLength="4.463800" font-size="8px">x</text>

    <text x="51.119736" y="193.119995" textLength="5.954709" font-size="8px">A</text>

    <text x="303.174500" y="278.319855" textLength="4.963746" font-size="8px">e</text>

    <text x="180.360001" y="264.519989" textLength="5.454763" font-size="8px">T</text>

    <text x="79.086349" y="109.539978" textLength="4.963746" font-size="8px">0</text>

    <text x="69.478867" y="51.099854" textLength="4.963746" font-size="8px">8</text>

    <text x="68.698715" y="148.479980" textLength="2.481873" font-size="8px">I</text>

    <text x="80.636993" y="280.779877" textLength="4.963746" font-size="8px">0</text>

    <text x="95.032745" y="280.779877" textLength="4.963746" font-size="8px">0</text>

    <text x="184.381363" y="101.380005" textLength="4.963746" font-size="8px">a</text>

    <text x="273.659851" y="110.319885" textLength="4.963746" font-size="8px">n</text>

    <text x="55.924500" y="270.220001" textLength="5.954709" font-size="8px">E</text>

    <text x="39.180008" y="109.539978" textLength="2.481873" font-size="8px">I</text>

    <text x="71.100601" y="193.119995" textLength="4.963746" font-size="8px">e</text>

    <text x="99.781937" y="153.339905" textLength="4.963746" font-size="8px">u</text>

    <text x="92.643799" y="109.539978" textLength="4.963746" font-size="8px">0</text>

    <text x="292.016785" y="110.319885" textLength="4.963746" font-size="8px">o</text>

    <text x="67.082260" y="203.679871" textLength="4.463800" font-size="8px">x</text>

    <text x="125.337463" y="270.220001" textLength="2.481873" font-size="8px"> </text>

    <text x="297.592957" y="278.319855" textLength="2.972891" font-size="8px">r</text>

    <text x="73.503876" y="203.679871" textLength="4.963746" font-size="8px">e</text>

    <text x="270.477173" y="278.319855" textLength="2.481873" font-size="8px"> </text>

    <text x="185.941544" y="264.519989" textLength="2.972891" font-size="8px">r</text>

    <text x="87.845215" y="109.539978" textLength="4.963746" font-size="8px">8</text>

    <text x="110.940536" y="153.339905" textLength="0.000000" font-size="8px">

첫 댓글을 달아주세요!
프로필 사진 없음
강좌에 관련 없이 궁금한 내용은 여기를 사용해주세요

    댓글을 불러오는 중입니다..