⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 4.txt

📁 对I386硬件平台的详尽分析,对LINUX内核学习有很大帮助
💻 TXT
字号:
如果您希望在载入 QEMM386 後还能正常进入保护模式的话 ,则必需透过 VCPI 
  
  的命令来切入保护模式 ,详情可翻阅 VCPI 的书籍。 
  -- 软蛀 -- 
  
  
  
  example.ASM: 
  
  
  code segment 
  
  assume cs:code,ds:code 
  
  start proc near 
  
  jmp next 
  
  
  
  buffer1 db 18h,00h,00h,00h,00h,00h 
  
  ; ---+--- ------+-------- 
  
  ; | | 
  
  ; | | 
  
  ; | GDT 表的记忆体位址 
  
  ; | 
  
  ; +----------GDT 表的长度 
  
  ; 
  
  ; 
  
  buffer2 db 000h,000h,000h,000h,000h,000h,000h,000h ;保留段 
  
  db 0ffh,0ffh,000h,000h,000h,09bh,000h,000h ;程式段code:0 
  
  db 0ffh,0ffh,000h,080h,00bh,093h,000h,000h ;萤幕段B800:0 
  
  db 0100h dup (0) 
  
  ; ------+------- 
  
  ; | 
  
  ; | 
  
  ; 线性记忆体位址 
  
  ; 
  
  msg_1 db 'Enter Protect Mode !' 
  
  msg_2 db 0dh,0ah,'Return Real Mode !',0dh,0ah,'$' 
  
  .386p 
  
  next : 
  
  mov ax,0600h ; 
  
  mov bx,0700h ; 
  
  mov cx,0000h ; 
  
  mov dx,184fh ; 
  
  int 10h ; CLS 
  
  mov ah,02h ; 
  
  mov bh,00h ; 
  
  mov dx,0100h ; 
  
  int 10h ; 
  
  mov ax,cs 
  
  mov ds,ax 
  
  mov es,ax 
  
  xor eax,eax 
  
  xor ebx,ebx 
  
  mov ax,cs 
  
  mov cl,04h 
  
  shl eax,cl 
  
  mov bx,offset buffer2 
  
  add eax,ebx 
  
  mov bx,offset buffer1+2 
  
  mov cs:[bx],eax ;GDT 位址设定 
  
  NOP 
  
  xor eax,eax 
  
  xor ebx,ebx 
  
  mov ax,cs 
  
  mov cl,04h 
  
  shl eax,cl 
  
  add eax,ebx 
  
  mov bx,offset buffer2 
  
  mov cs:[bx+0ah],eax ;GDT Table 设定 
  
  mov byte ptr cs:[bx+0dh],9bh ;存取权 
  
  mov ax,cs 
  
  mov ds,ax 
  
  mov es,ax 
  
  mov bx,offset buffer1 
  
  xor ecx,ecx 
  
  cli 
  
  cli 
  
  lgdt cs:[bx] ;载入GDT 
  
  mov eax,cr0 
  
  or eax,01h 
  
  mov cr0,eax 
  
  jmp protection ;进入保护模式 
  
  protection : 
  
  db 66h 
  
  mov ax,code 
  
  mov ds,ax 
  
  mov si,offset msg_1 
  
  mov bx,0010h 
  
  mov es,bx 
  
  mov di,0000h 
  
  mov cx,0014h 
  
  mov ah,70h 
  
  show : 
  
  cld ;将CS:MSG_1搬到 0010:00000000 
  
  lodsb ;(0010的区段=B8000 请参考GDT 
  
  stosw ; 表) 
  
  loop show ; 
  
  mov eax,cr0 
  
  and al,not 1 
  
  mov cr0,eax 
  
  db 0eah 
  
  dw real_mode,code ;返回真实模式 
  
  real_mode : 
  
  sti 
  
  mov ax,cs 
  
  mov ds,ax 
  
  mov ah,09h 
  
  mov dx,offset msg_2 
  
  int 21h 
  
  mov ax,4cffh 
  
  int 21h 
  
  start endp 
  
  code ends 
  
  end start 
  
  
  
  > 
  > 
  > ┌┐┌┐∞ 
  > 【 80386保护模式简介二 】 ┘└┘└┘ 
  > -------------------------------------------------------------------------- 
  > 进入保护模式可以得到很多好处 ,让你的程式不再有 640K 限制 ,可以ㄔ 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -