可以GET到PCIE值了,但是還有一個顯示的問題,請多多指教

qoocc1 2008-12-18 11:41:08
請問 mov esi, 0E0000040h
mov dword ptr eax,fs:[esi]
這個指令不是可以get 4BYTE的值嗎?可是我螢幕只有顯示一個值,請多多指教。


CODE如下:

.model small
.586p

DSEG SEGMENT USE16

DESC STRUC
LimitL DW 0 ;段界限(BIT0-15)
BaseL DW 0 ;段基地址(BIT0-15)
BaseM DB 0 ;段基地址(BIT16-23)
Attributes DB 0 ;段屬性
LimitH DB 0 ;段界限(BIT16-19)
BaseH DB 0 ;段基地址(BIT24-31)
DESC ENDS

PDesc STRUC
Limit DW 0 ;16位界限
Base DD 0 ;32位基地址
PDesc ENDS

GDT_def Label Fword
Null_Desc DESC < 0h, 0h, 00h, 00h, 000h, 0>
Data_Desc DESC < 0FFFFh, 0h, 00h, 92h, 08Fh, 0>

GDT_Addr PDesc <$-GDT_def-1>;
DSEG ENDS

CSEG SEGMENT USE16
ASSUME CS:CSEG,DS:DSEG


.Startup
call Set4gb
;
;

mov esi, 0E0000040h
mov dword ptr eax,fs:[esi];問題處
mov ah,al
mov cl,4
shr ah,cl
mov cl,al
.if ah >= 10
add ah,'A'-10
.else
add ah,'0'
.endif
mov dl,ah
mov ah,2
int 21h

and cl,00001111b
.if cl >= 10
add cl,'A'-10
.else
add cl,'0'
.endif
mov dl,cl
mov ah,2
int 21h





; write your code in here.
;
.exit

Set4gb PROC NEAR
mov eax, ds
shl eax, 4
xor ebx, ebx
mov bx, offset GDT_def
add eax, ebx
mov dword ptr GDT_Addr+2, eax
lgdt fword ptr GDT_Addr


cli

; mov word ptr GDT_Addr, (2*8-1);



in al, 92h
or al, 002
out 092h, al
out 0edh, al

mov bx, 8
mov eax, cr0
or al, 1
mov cr0, eax

jmp pMod
pMod:

mov fs, bx
mov gs, bx
and al, 0FEh
mov cr0, eax

jmp rMod
rMod:

mov ax, 0
mov fs, ax
mov gs, ax


sti
ret
Set4gb ENDP

CSEG ENDS
end
...全文
101 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
qqlpp 2008-12-19
  • 打赏
  • 举报
回复
不懂,up
wap21 2008-12-19
  • 打赏
  • 举报
回复
友情up
qoocc1 2008-12-19
  • 打赏
  • 举报
回复
謝謝xtdumpling大大,還有幾個問題請各位請教各位,謝謝。

(1) GDT_def Label Fword
定義成6個byte,但是如何裝入8個byte呢?

(2) mov dword ptr GDT_Addr+2, eax
lgdt fword ptr GDT_Addr

為什麼GDT_Addr+2要加2呢?加2的意義為何?
lgdt fword ptr GDT_Addr
lgdt fword為什麼只LOAD 6個BYTE不用QWORD全部lOAD進去呢?

(3) 有哪個指令可以跳過CR0這一行呢?用T都會REBOOT
xtdumpling 2008-12-18
  • 打赏
  • 举报
回复
.model small 
.586p

DSEG SEGMENT USE16

DESC STRUC
LimitL DW 0 ;段界限(BIT0-15)
BaseL DW 0 ;段基地址(BIT0-15)
BaseM DB 0 ;段基地址(BIT16-23)
Attributes DB 0 ;段屬性
LimitH DB 0 ;段界限(BIT16-19)
BaseH DB 0 ;段基地址(BIT24-31)
DESC ENDS

PDesc STRUC
Limit DW 0 ;16位界限
Base DD 0 ;32位基地址
PDesc ENDS

GDT_def Label Fword
Null_Desc DESC < 0h, 0h, 00h, 00h, 000h, 0>
Data_Desc DESC < 0FFFFh, 0h, 00h, 92h, 08Fh, 0>

GDT_Addr PDesc <$-GDT_def-1>;
DSEG ENDS

CSEG SEGMENT USE16
ASSUME CS:CSEG,DS:DSEG


.Startup
call Set4gb
;
;

mov esi, 0E0000040h
mov dword ptr eax,fs:[esi];問題處

bswap eax
mov cx,4
@@:
push cx
push eax
mov ah,al
mov cl,4
shr ah,cl
mov cl,al
.if ah >= 10
add ah,'A'-10
.else
add ah,'0'
.endif
mov dl,ah
mov ah,2
int 21h

and cl,00001111b
.if cl >= 10
add cl,'A'-10
.else
add cl,'0'
.endif
mov dl,cl
mov ah,2
int 21h

pop eax
mov cl,8
ror eax,cl
pop cx
loop @b

; write your code in here.
;
.exit

Set4gb PROC NEAR
mov eax, ds
shl eax, 4
xor ebx, ebx
mov bx, offset GDT_def
add eax, ebx
mov dword ptr GDT_Addr+2, eax
lgdt fword ptr GDT_Addr


cli

; mov word ptr GDT_Addr, (2*8-1);



in al, 92h
or al, 002
out 092h, al
out 0edh, al

mov bx, 8
mov eax, cr0
or al, 1
mov cr0, eax

jmp pMod
pMod:

mov fs, bx
mov gs, bx
and al, 0FEh
mov cr0, eax

jmp rMod
rMod:

mov ax, 0
mov fs, ax
mov gs, ax


sti
ret
Set4gb ENDP

CSEG ENDS
end
**Prototype** **int dcmi\_get\_pcie\_info\(int card\_id, int device\_id, struct dcmi\
**Prototype** **int dcmi\_get\_device\_pcie\_info\_v2\(int card\_id, int device\_id, struct dcmi\_pcie\_info\_all

21,500

社区成员

发帖
与我相关
我的任务
社区描述
汇编语言(Assembly Language)是任何一种用于电子计算机、微处理器、微控制器或其他可编程器件的低级语言,亦称为符号语言。
社区管理员
  • 汇编语言
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧