2014-04-09 2 views

답변

7

64 비트 capabillities를 사용하려면 CPU를 장시간 모드로 전환해야합니다.

64 비트 x86 프로세서 (- 64)에 긴 모드를 시작하려면 :

If paging is enabled, disable paging. 
If CR4.PAE is not already set, set it. 
Set IA32_EFER.LME = 1. 
Load CR3 with a valid PML4 table. 
Enable paging. 
At this point you will be in compatibility mode. A far jump may be executed to switch to long mode. However, the offset must not exceed 32-bit. 
+0

공식 문서 : [인텔 ® 64 및 IA-32 아키텍처 소프트웨어 개발자 설명서, 볼륨 3A : 시스템 프로그래밍 안내서 :] (https://www.intel.com/content/www/us/en/architecture-and- technology-64-ia-32-architectures- 소프트웨어 개발자 -vol-3a-part-1-manual.html) "9.8.5 IA-32e 모드 초기화" –

2

OSDev는 낮은 수준의 86에 대한 정보 (및 다른 아키텍처에 비트)를위한 좋은 자원이다.

모두에서 수행 할 수 긴 모드를 입력 롱 모드

입력 : 예를 들어, this article는 롱 모드와 방법을 입력하는 방법에 꽤 좋은 작성자는 보호 모드에서 직접 리얼 모드에서 모두이다 실제 모드 및 보호 모드, 그러나 보호 모드는 Intel 및 AMD64 설명서에서 다룹니다. 초기 AMD 문서에서는이 프로세스가 리얼 모드에서 으로 잘 작동한다고 설명합니다. 64 비트 모드로 직접 이동하려면

2

, 당신은 같은 것을 할 수 있습니다 : 코드 위

%xdefine PML4_BASE 0x70000  ; Address of PML4-table. 
%xdefine CR0_PE  1 << 0 
%xdefine CR0_PG  1 << 31 
%xdefine CR4_PAE 1 << 5 
%xdefine CR4_PGE 1 << 7 
%xdefine EFER_LME 1 << 8 

mov eax, CR4_PAE | CR4_PGE  ; Set PAE- (Physical Address Extensions) and 
mov cr4, eax     ; PGE- (Page Global Enable). 
mov eax, PML4_BASE    ; Address of PML4. 
mov cr3, eax     ; Point CR3 to PML4. 
mov ecx, 0xC0000080   ; EFER MSR selector. 
rdmsr       ; Read from model specific register. 
or eax, EFER_LME    ; Set LME (Long Mode Enable). 
wrmsr       ; Write to model specific register. 
mov ebx, cr0     ; Get CR0. 
or ebx, CR0_PG | CR0_PE  ; Set PG (Paging) and PE (Protection Enabled). 
mov cr0, ebx     ; Set flags to CR0. 
lgdt [GDT.ptr]     ; Load global descriptor table. 
jmp GDT.code_0:long_mode_entry ; Jump to long mode. 

이미 설정 페이지 테이블과 글로벌 디스크립터 테이블이 필요합니다.

관련 문제