Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {$apptype console}
- program testDrv; uses windows,sysutils;
- var
- r_eax:integer = 0;
- r_ecx:integer = 0;
- r_edx:integer = 0;
- function inb(port:integer):byte;
- asm mov edx, eax
- in al, dx
- end;
- procedure outb (port,val:integer);//val:byte);
- asm xchg eax, edx
- out dx, al
- end;
- procedure cli;
- asm cli
- end;
- const
- BASE = $18A0;
- ClkGen = $D2;
- SMBHSTSTS = 0;
- SMBHSTCNT = 2;
- SMBHSTCMD = 3;
- SMBHSTADD = 4;
- SMBHSTDAT = 5;
- function smb_read_byte_intel(reg:integer):byte;
- var i:integer;
- begin
- outb(BASE + SMBHSTSTS, $01f);// reset SMBus Controller
- outb(base + SMBHSTDAT, $0ff);
- for i := 0 to 100000 do
- begin
- if (inb(base + SMBHSTSTS) and 01) = 0 then break;
- end;
- outb(base + SMBHSTCMD, $80 +reg);
- outb(base + SMBHSTADD, ClkGen or 1);
- outb(base + SMBHSTCNT, $048 );
- for i := 0 to 100000 do
- begin
- if (inb(base + SMBHSTSTS) and 02) = 2 then break;
- end;
- result := inb(base + SMBHSTDAT);
- end;
- function write_pll(reg,val:integer):byte;
- var i:integer;
- begin
- outb(base + SMBHSTSTS, $01f);// reset SMBus Controller
- for i := 0 to 100000 do
- begin
- if (inb(base + SMBHSTSTS) and 01) = 0 then break;
- end;
- outb(base + SMBHSTDAT, val);
- outb(base + SMBHSTCMD, $80+reg); //смещение + регистр
- outb(base + SMBHSTADD, ClkGen);
- outb(base + SMBHSTCNT, $048 );
- for i := 0 to 100000 do
- begin
- if (inb(base + SMBHSTSTS) and 02) = 2 then break;
- end;
- end;
- procedure Ring0;
- begin
- //cli;
- // write_pll($1C,$AB);
- // write_pll($19,$12);
- // write_pll($1A,$34);
- // write_pll($1B,$56);
- //write_pll($1C,$78);
- // write_pll($1C,$78);
- write_pll($00, $67);
- write_pll($0E, $0D);
- write_pll($0F, $90);
- write_pll($10, $3D);
- write_pll($11, $C0);
- r_eax := smb_read_byte_intel ($f);
- end;
- {$I-}
- var
- f:file; proc :pointer;
- begin
- Assign(f,'\\.\\MicroDrv');
- Reset(f,1);
- proc := @ring0;
- BlockWrite(f,proc^,4);
- close(f);
- // readln;
- writeln (inttohex (r_eax,8) );
- // writeln ( r_eax );//shr 16) );
- // writeln ( (r_ecx shr 16) and 1 );
- writeln (inttohex ($D200 shr 8 ,8) );
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement