A-version of GMON

git-svn-id: svn://kolibrios.org@3007 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Artem Jerdev (art_zh) 2012-11-05 20:19:33 +00:00
parent b208b80b45
commit e626668c98
16 changed files with 2717 additions and 0 deletions

View File

@ -0,0 +1,51 @@
Ghost Monitor - утилита (стресс) тестирования и мониторинга системы
Copyright (C) 2005, 2006, 2007 Mihailov Ilia (ghost.nsk@mail.ru)
All Right Reserved
30/10/2012 - эта версия только для AMD Fusion, работает с Колибри-А
----- поковырялся art_zh
23/05/2007 - исправлена ошибка в it87_get_fan_speed, найдена SPraid
16/05/2007 - ASCIIZ имена чипов, вынесена история
31/01/2007 - исправлена ошибка внесённая 17/07/06 в определение множителя для Intel NorthWood
26/12/2006 - исправленна глупая ошибка в определении ITE и uGuru
24/12/2006 - ITE chips model id bugfix by Serge
20/12/2006 - W83627DHG, W83627EHF, W83627EHG, mutipliers for AthonXP-M, Athlon64, Athlon64-M,
Intel Dothan, Yonah, Conroe, Merom
25/11/2006 - добавлен ABIT uGuru
10/09/2006 - bugfix
24/08/2006 - добавленна частота процессора
10/08/2006 - начата работа по поддержке SMBus, переписаны функции для чипов мониторинга
--- v 0.4 ---
30/07/2006 - P6 multiplier bugfix
22/07/2006 - P6 multiplier bugfix
18/07/2006 - Уличшил вывод множителя, исправленны множители для P6 Tualatin, config.inc
17/07/2006 - исправленна ошибка определения множителя для P6, добавленны множители
14/07/2006 - исправленны показания -12V для Winbond, осталась пробленма с -5V
13/07/2006 - it87_get_fan_speed bug fix, исправлен вывод чисел с плавающей точкой
12/07/2006 - it87_get_fan_speed bug fix, завершение теста по 18/18
11/07/2006 - Реакция на изменение напруги, оптимизация по размеру
10/07/2006 - добавленны напруги для чипов ITE, множители для AMD K6, Intel P6, P7, оптимизация по размеру
04/07/2006 - Добавленны напруги для чипов Winbond
01/07/2006 - Различие ITE 8705F, ITE 8712F и IT8716F
--- v 0.3 ---
19/04/2006 - Очистка неинициализированных данных
14/04/2006 - Исправил график (jle -> jbe), добавил mem usage, вычисление длинны чисел, закрытие по Esc
30/03/2006 - Оптимизация по размеру версии от 28/03/2006, переписал рисование графика
28/03/2006 - График temp3 и изменение цвета графиков, обработка отрицательных значений графика
25/03/2006 - Вывод трёх температур и трёх вентилей
24/03/2006 - Добавленна поддержка IT8705F, IT8712F и SIS950
--- v 0.2 ---
20/03/2006 - Публикация
17/03/2006 - подсветка изменённых параметров, оптимизация, about
16/03/2006 - оптимизирована по размеру
01/03/2006 - добавленна еще информация с датчиков
10/02/2006 - добавленна еще информация с датчиков, опт. wb_get_chip_name
02/02/2006 - Добавлена настройка времени обновления
30/01/2006 - добавленны графики
09/11/2005 - дописаны тесты (пока нет теста памяти)
04/10/2005 - откомментировал код
09/2005 - начало
Эй! У меня нет много времени.

View File

@ -0,0 +1,300 @@
;
; Ghost Monitor - ã⨫¨â  (áâà¥áá) â¥áâ¨à®¢ ­¨ï ¨ ¬®­¨â®à¨­£  á¨á⥬ë
; Copyright (C) 2005, 2006, 2007 Mihailov Ilia (ghost.nsk@mail.ru)
; All Right Reserved
;
; <20>¨¡«¨®â¥ª  ¤«ï 稯®¢ Hudson
;
;
;
; | Chip name | ID Vin Fanin PWM Temp ISA SMBus
msg_A50: db 'AMD Hudson A50', 0 ; 0x20|0x21 9 3 2 3 + +
msg_A55: db 'AMD Hudson A55', 0 ; 0x20|0x21 9 3 2 3 + +
msg_amdunk: db 'Unknown AMD', 0 ; other, non zero ;-)
uglobal
wb_fans_num db 0
endg
;-----------------------------------
hudson_init:
; <20>஢¥àª  ­ «¨ç¨ï ¨ ¨­¨æ¨ «¨§ æ¨ï
; OUT - CF = 1 - error
mov ebx, 0xF00C3000
mov eax, [ebx]
cmp eax, 0x17031022
jne .not_found ; not a Fusion!
mov byte[wb_fans_num], 3
mov edx, msg_A55
@@: mov [hwm_chip_name], edx
mov dword[hwm_enable],1
mov al, 0xE6
mov bl, 0x0A
call pm2write ; init PWM_Control register
clc
ret
.not_found: stc
ret
;-----------------------------------
hudson_getparam:
call hudson_get_temp
call hudson_get_fan_speed
mov edi, hudson_coeff
call hudson_get_volt
fld dword[V12]
fld dword[hudson_n12v_const]
faddp st1, st0
fstp dword[V12]
ret
;-----------------------------------
hudson_get_temp:
; temp 1
mov ebx, 0xF00C3000
mov eax, [ebx+0xA4]
mov edx, eax
shr edx, 24
mov [hwm_temps], dl ; integer degrees
mov edx, eax
shr edx, 21
and dl, 7 ; 1/8th fractions of degree
cmp dl, 3 ; round 3/8 upto 0.4
jb .corrected
inc dl
cmp dl, 8 ; 7/8 ~ 0.9
jb .corrected
inc dl
.corrected:
mov [hwm_temps + 1], dl
; temp 2 (3 SYSTIN)
xor ebx, ebx
mov al, 0x95
call pm2read
mov bl, al
mov al, 0x96 ; SB internal sensor
call pm2read
mov bh, al
mov [hudson_temp_read], ebx
fild dword[hudson_temp_read]
fmul dword[hudson_temp_coef]
fidiv dword[hudson_int_64]
fadd dword[hudson_temp_offs]
fimul dword[hudson_int_2]
fistp dword[hudson_temp_read]
mov bx, word[hudson_temp_read]
mov ax, bx
xor bh, bh
shr eax, 1
mov byte[hwm_temps + 2], al
or bl, 1
jz @f
mov bh, 5
mov byte[hwm_temps + 3], bh
; temp 3 (VTIN)
xor ebx, ebx
mov al, 0xA1
call pm2read
mov bl, al
mov al, 0xA2 ; temp sensor #2
call pm2read
mov bh, al
mov [hudson_temp_read], ebx
fild dword[hudson_temp_read]
fmul dword[hudson_temp_coef]
fidiv dword[hudson_int_64]
fadd dword[hudson_temp_offs]
fimul dword[hudson_int_2]
fistp dword[hudson_temp_read]
mov bx, word[hudson_temp_read]
mov ax, bx
xor bh, bh
shr eax, 1
mov byte[hwm_temps + 4], al
or bl, 1
jz @f
mov bh, 5
mov byte[hwm_temps + 5], bh
; <20>஢¥àª  ⥬¯¥à âãàë, ¤ â稪¨ á 127.5`C ­¥ ¨á¯®«ì§ãîâáï
mov ecx, 3
mov esi, hwm_temps
hudson_check_temp:
cmp word[esi + ecx * 2 - 2], 0x057F
jne hudson_temp_ok
mov word[esi + ecx * 2 - 2], 0
hudson_temp_ok:
loop hudson_check_temp
ret
;-----------------------------------
hudson_get_fan_speed:
; fan1
mov al, 0x47
call [IO_Read]
and al, 0x30
shr al, 4
mov ebx, 1
mov cl, al
shl ebx, cl ; <- div1
xor eax, eax
mov al, 0x28
call [IO_Read]
cmp al, 255
jne @f
xor eax, eax ; ???
ret ; ???
@@: mul ebx
mov ebx, eax
mov eax, 1350000
xor edx, edx
test ebx, ebx
jz .div0
div ebx
mov [hwm_rpms], eax
mov al, 0x47
call [IO_Read]
shr al, 6
mov ebx, 1
mov cl, al
shl ebx, cl ; <- div2
xor eax, eax
mov al, 0x29
call [IO_Read]
cmp al, 255
jne @f
xor eax, eax
.div0:
ret
@@: mul ebx
mov ebx, eax
mov eax, 1350000
xor edx, edx
test ebx, ebx
jz .div0
div ebx
mov [hwm_rpms + 4], eax
mov al, 0x4B
call [IO_Read]
shr al, 6
mov ebx, 1
mov cl, al
shl ebx, cl ; <- div3
xor eax, eax
mov al, 0x2A
call [IO_Read]
cmp al, 255
jne @f
xor eax, eax
ret
@@: mul ebx
mov ebx, eax
mov eax, 1350000
xor edx, edx
test ebx, ebx
jz .div0
div ebx
mov [hwm_rpms + 8], eax
cmp byte[wb_fans_num], 3
jna .wb_f_e
mov al, 0x59
call [IO_Read]
and al, 3
mov ebx, 1
mov cl, al
shl ebx, cl ; <- div4, ¤®¯¨á âì ãçñâ DIV_B2
xor eax, eax
mov al, 0x3F
call [IO_Read]
cmp al, 255
jne @f
xor eax, eax
ret
@@: mul ebx
mov ebx, eax
mov eax, 1350000
xor edx, edx
test ebx, ebx
jz .div0
div ebx
mov [hwm_rpms + 12], eax
mov al, 0x59
call [IO_Read]
shr al, 2
and al, 3
mov ebx, 1
mov cl, al
shl ebx, cl ; <- div5, ¤®¯¨á âì ãçñâ DIV_B2
xor eax, eax
mov al, 0x4e ; ‚롨ࠥ¬ bank 5
mov bl, 5
call [IO_Write]
mov al, 0x53
call [IO_Read]
cmp al, 255
jne @f
xor eax, eax
ret
@@: mul ebx
mov ebx, eax
mov eax, 1350000
xor edx, edx
test ebx, ebx
jz .wb_f_e
div ebx
mov [hwm_rpms + 16], eax
.wb_f_e:
ret
;-----------------------------------
hudson_get_volt:
;mov edi, wb_coeff ; <-- possible differences for miscellaneous chip
mov esi, hwm_voltages
xor ecx, ecx
@@: mov eax, ecx
add al, 0x20
call [IO_Read]
fld dword [edi + ecx * 4]
push eax
fild dword [esp]
fmulp st1, st0
fstp dword [esi + ecx * 4]
pop eax
inc ecx
cmp ecx, 7
jb @b
ret
align 4
hudson_coeff: dd 0.016 ; Vcore
dd 0.016 ; Vin0
dd 0.016 ; Vin1 (+3.3V)
dd 0.02688 ; AVcc (+5V)
dd 0.0608 ; Vin2 (+12V)
dd 0.0822857142857145 ; -12V
dd -0.02408 ; -5V ; false
hudson_n12v_const dd -14.9142857142857
hudson_temp_offs dd -273.65
hudson_temp_coef dd 0.517
hudson_temp_read dd 0
hudson_int_2 dd 2
hudson_int_64 dd 64

View File

@ -0,0 +1,72 @@
;
; Ghost Monitor - óòèëèòà (ñòðåññ) òåñòèðîâàíèÿ è ìîíèòîðèíãà ñèñòåìû
; Copyright (C) 2005, 2006, 2007 Mihailov Ilia (ghost.nsk@mail.ru)
; All Right Reserved
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
; SMBus interface
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
;include 'smb_nf2.inc'
smb_base dd 0 ; IO port base for SMBus acces
smb_slave dd 0 ; SMBus addres for monitoring chip
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
smbInit:
; Èçìåíèòü, êîä òîëüêî äëÿ òåñòèðîâàíèÿ !!!
; mov dword[IO_Read ], nf2_readb
; mov dword[IO_Write], nf2_writeb
; See pci_pm.c -> pci_pm_smb_prob
.exit_err:
stc
ret
.exit_ok:
clc
ret
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
; pci_bus_num: db 2 ; Íîìåð øèíû
; pci_devfn: db 255
; find_north_bridg:
; mov bl, 6
; xor cl, cl
; nbus: mov bh, [pci_bus_num]
; ndevfn: mov ch, [pci_devfn]
; mov eax, 62
; int 0x40
; cmp eax, 0xffffffff
; je bd_next
;;;;---------
; mov esi, bd_table_end - bd_table - 12
; @@: cmp eax, [bd_table + esi]
; je bd_found
; test esi, esi
; jz bd_next
; sub esi, 12
; jmp @b
;;;;---------
; bd_next:dec byte[pci_devfn]
; jns ndevfn
; mov byte[pci_devfn], 0
; dec byte[pci_bus_num]
; jns nbus
; ret
; bd_found:
; add esi, bd_table + 4
; mov edi, nb_name
; mov ecx, 2
; rep movsd
; mov [bd_id], eax
; ret
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
smbClose:
ret
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Binary file not shown.

View File

@ -0,0 +1,564 @@
;
; Ghost Monitor - ã⨫¨â  (áâà¥áá) â¥áâ¨à®¢ ­¨ï ¨ ¬®­¨â®à¨­£  á¨á⥬ë
; Copyright (C) 2005, 2006, 2007 Mihailov Ilia (ghost.nsk@mail.ru)
; AMD fusion version 2012
; All Right Reserved
;
; Ž‡ŒŽ†<C5BD><20>Ž<EFBFBD>—€ Ž<>Ž<EFBFBD>“„Ž<E2809A>ˆŸ!
; ˆ<CB86>Žœ‡“‰<20>€ ‘‚Ž‰ <E28098>€• ˆ <20>ˆŠ!
;
; ‡ ¬¥âª¨ :
; „®¯¨á âì § ¯ã᪠â¥á⮢ (rtst) (­¥â ॠªæ¨¨ ­  ®è¨¡ªã § ¯ã᪠)
; <20>¥à¥¤¥« âì ®¡­®¢«¥­¨¥ £à ä¨ª  (ᤥ« âì ®â¤¥«ì­ë¬ ¯à®æ¥áᮬ)
; „®¡ ¢¨âì ॠªæ¨î ­  ¯ à ¬¥âàë ¤ â稪®¢
;
; ‚­¥è­¨¥ ä ©«ë :
; hwm*.inc - ¯à®æ¥¤ãàë à ¡®âë á ¤ â稪 ¬¨ ¬®­¨â®à¨­£ 
; system.inc - ¢ëç¨á«¥­¨¥ § £à㧪¨ ¯à®æ¥áá®à , § ¢¥à襭¨¥ â¥áâ , etc...
; tests.inc - â¥áâë ;-)
; diag.inc - ¯®¤¤¥à¦ª  ¤¨ £à ¬
; tab_*.inc - ¯à®æ¥¤ãàë ®âà¨á®¢ª¨ ᮮ⢥âáâ¢ãîè¨å ¢ª« ¤®ª
; ˆ¤¥­â¨ä¨ª â®àë ª­®¯®ª :
; 01 - Exit
; 02 - Info tab
; 03 - Tests tab
; 04 - Config tab
; 05 - About tab
; 06 - P5 test (tab_test.inc)
; 07 - P6 test (tab_test.inc)
; 08 - K6 test (tab_test.inc)
; 09 - K7 test (tab_test.inc)
; 10 - MMX test - not used (tab_test.inc)
; 11 - Update time increment (tab_conf.inc)
; 12 - Update time decriment (tab_conf.inc)
; 13..17 - ˆ§¬¥­¥­¨¥ æ¢¥â  CPU_load, Mem_usage, Temp1, Temp2, Temp3
include 'config.inc'
include 'macros.inc'
tcol equ 0x5080d0
atcol equ 0x4070c0
val_mod equ 0x3090
MEOS_APP_START
include "tests.inc" ; <-- Œ­®£® ¢ëà ¢­¨¢ ­¨©, «ãçè¥ §¤¥áì
CODE
;--- Init ------------------------------------------------------------
; Žç¨é ¥¬ ­¥¨­¨æ¨ «¨§¨à®¢ ­­ë¥ ¤ ­­ë¥
mov ecx, __memory - __udata
mov edi, __udata
xor eax, eax
rep stosb
xor eax, eax
cpuid ; “§­ ñ¬ ¯à®¨§¢®¤¨â¥«ï ¯à®æ 
mov [Vendor + 0], ebx
mov [Vendor + 4], edx
mov [Vendor + 8], ecx
mov eax, 1
cpuid ; …áâì «¨ MMX ?
mov ecx, eax
shr al, 4
and ax, 0x0F0F
mov [CPU_fam], ah
mov [CPU_mod], al
shr edx, 23
and dl, 1
mov [CPU_mmx], dl
shr ecx, 12
and cl, 11b
mov [CPU_type], cl
; ! –¢¥â  ¨§ ¬ áᨢ  colors
mov dword[d_cpu_load], 0xFF00 ; ¨­¨æ¨ «¨§¨à㥬 £à ä¨ª § £à㧪¨ €‹“
mov dword[d_mem_usage], 0x8BA169 ; -- mem usega
mov dword[d_temp1], 0xFF0000 ; -- £à ä¨ª ⥬¯¥à âãàë <>
mov dword[d_temp2], 0xFF ; -- £à ä¨ª ⥬¯¥à âãàë Œ<>
mov dword[d_temp3], 0xFF7E23
call hwm_init ; ˆ­¨æ¨ «¨§¨à㥬 稯 ¬®­¨â®à¨­£ 
jmp draw_window
;--- Wait & translate event ------------------------------------------
wait_for_event:
mov byte[diag_add_v], 0 ; ¤®¡ ¢«ï¥¬ ¤ ­­ë¥ ª £à ä¨ªã ⮫쪮 ¯® â ©¬¥àã
mov ebx, [update_time]
mov eax, 23
int 0x40
test eax, eax
jnz @f
inc byte [diag_add_v]
inc eax ; ¯¥à¥à¨á㥬 ®ª­® (eax := 1)
@@: dec eax ; redraw request ?
jz draw_window
dec eax ; key in buffer ?
jz key
dec eax ; button in buffer ?
jz button
jmp wait_for_event
;--- Key pressed -----------------------------------------------------
key:
mov eax, 2
int 0x40
cmp ah, 27 ; Esc - § ¢¥à襭¨¥ à ¡®âë
je exit
jmp wait_for_event
;--- Button down -----------------------------------------------------
button:
mov eax, 17 ; get id
int 0x40
cmp ah, 1 ; button id == 1 ?
jne noexit
exit: cmp byte[test_id], 0
je @f
call stop_test
@@: mov eax, -1 ; close this program
int 0x40
noexit:
; ª­®¯ª¨ ¢ª« ¤®ª (2 .. 5)
cmp ah, 5
jg no_tabs
mov byte[act_tab], ah
jmp draw_window
no_tabs:
; ª­®¯ª¨ § ¯ã᪠ â¥á⢮ (6 .. 10)
cmp ah, 10
jg no_test_bt
; ¥á«¨ ­¥â § ¯ã饭ëå â¥á⮢ - § ¯ã᪠¥¬ ¢ë¡à ­­ë©
cmp byte[test_id], 0
je run_test
; ¥á«¨ ª­®¯ª   ªâ¨¢­®£® â¥áâ  - ®áâ ­ ¢«¨¢ ¥¬ â¥áâ, ¨­ ç¥ ­¨ç¥£® ­¥ ¤¥« ¥¬
cmp [test_id], ah
jne wait_for_event
call stop_test
jmp draw_window
tsts: dd p5, p6, k6, k7
run_test:
push eax
movzx ecx, ah
mov ecx, [tsts + (ecx * 4) - (6 * 4)]
rtst: mov eax, 51
mov edx, stp
mov ebx, 1
int 0x40
cmp eax, 0xFFFFFFF0 ; -16
je wait_for_event ; <-- ®è¨¡ª  § ¯ã᪠ â¥áâ , <20><EFBFBD><EFBFBD>ˆœ
mov [test_pid], eax
pop eax
mov byte [test_id], ah
jmp draw_window
;-------------------------
; ª­®¯ª¨ ¨§¬¥­¥­¨ï ¢à¥¬¥­¨ ®¡­®¢«¥­¨ï
no_test_bt:
cmp ah, 11
jne no_ut_inc
add dword[update_time], 10
jmp draw_window
no_ut_inc:
cmp ah, 12
jne no_ut_dec
cmp dword[update_time], 10
jng wait_for_event
sub dword[update_time], 10
jmp draw_window
no_ut_dec:
;-------------------------
; ª­®¯ª¨ ¨§¬¥­¥­¨ï æ¢¥â  £à ä¨ª®¢ (13..17)
cmp ah, 17
jg no_change_color
sub ah, 13
movzx ecx, ah
mov esi, [d_colors + ecx * 4]
mov eax, [esi]
mov ecx, (colors_end - colors) / 4 ; ª®«¨ç¥á⢮ 梥⮢
@@: dec ecx
cmp eax, [colors + ecx * 4]
jne @b
mov ebx, [colors + ecx * 4 - 4]
mov [esi], ebx
jmp draw_window
no_change_color:
jmp wait_for_event
;---------------------------------------------------------------------
draw_window:
mov eax,12
mov ebx,1
int 0x40
; ‘®§¤ ñ¬ ®ª­®
xor eax, eax
mov ebx, 300 * 65536 + 309
mov ecx, 150 * 65536 + 450
mov edx, tcol + 0x14000000 ; color of work area RRGGBB,8->color
mov edi, title ; color of frames RRGGBB
int 0x40
; ‘®§¤ ñ¬ à ¬ªã £à ä¨ª 
mov eax, 13
mov ebx, 10 * 65536 + 290
mov ecx, 138 * 65536 + 105
mov edx, atcol
int 0x40
mov ebx, 12 * 65536 + 286
mov ecx, 140 * 65536 + 101
mov edx, tcol
int 0x40
mov eax, 38
mov edx, atcol
mov ebx, 12 * 65536 + 286 + 12
mov ecx, 140 * 65536 + 140
@@: add ecx, 10 * 65536 + 10
int 0x40
cmp cx, 230 ; ¯à¨¢ï§ ­® ª ª®®à¤¨­ â ¬ ®ª­ 
jl @b
; <20>¨è¨¬ ­ §¢ ­¨ï ¯ à ¬¥â஢ (Cpu load, temper, etc...)
mov edx, msgs_mon
mov ebx, 17 * 65536 + 30
call show_text
mov edx, msgs_mon2
mov ebx, 156 * 65536 + 30
call show_text
; <20>¨á㥬 ª­®¯ª¨ ᬥ­ë 梥â 
mov eax, 8
mov ebx, 112 * 65536 + 5
mov ecx, 30 * 65536 + 6
mov edx, 13
@@: mov esi, [d_colors - 13 * 4 + edx * 4]
mov esi, [esi]
int 0x40
add ecx, 10 * 65536
inc edx
cmp edx, 13 + 5 ; 5 ª­®¯®ª
jne @b
; <20>¨è¨¬ § £à㧪㠯à®æ¥áá®à 
call cpu_usage
;--- ¤®¡ ¢«ï¥¬ ­  £à ä¨ª ---
mov esi, d_cpu_load
call d_add
call d_show
;---------------------------
movzx ecx, al
mov eax, 47
mov edx, 121 * 65536 + 30
xor esi, esi
call digit_len
int 0x40
; <20>¨è¨¬ ¨á¯®«ì§ã¥¬ãî ¯ ¬ïâì
call mem_usage
;--- ¤®¡ ¢«ï¥¬ ­  £à ä¨ª ---
mov esi, d_mem_usage
call d_add
call d_show
;---------------------------
movzx ecx, al
mov eax, 47
mov edx, 121 * 65536 + 40
xor esi, esi
call digit_len
int 0x40
cmp byte[hwm_enable], 0
jne show_mon
; <20>¥â ¤ â稪®¢ - ¯¨è¥¬ NO
mov ecx, 8 ;<- ª®«¨ç¥á⢮ ¯ à ¬¥â஢
mov eax, 4
mov ebx, 121 * 65536 + 50
mov edx, msg_no
mov esi, 3
@@: int 0x40
add ebx, 10
loop @b
mov ecx, 7 ;<- ª®«¨ç¥á⢮ ¯ à ¬¥â஢
mov ebx, 260 * 65536 + 30
@@: int 0x40
add ebx, 10
loop @b
jmp no_monitor
show_mon:
;…áâì ¤ â稪¨ ¯¨è¨¬ ¨­äã
call hwm_get_params
;---------------------------
; ’¥¬¯¥à âãàã
mov ecx, 3
mov esi, hwm_temps
mov edx, 121 * 65536 + 50
xor eax, eax
sh_temp:push ecx
lodsw
push esi
; ॠªæ¨ï ­  ¨§¬¥­¥­¨ï
xor esi, esi
cmp [old_t1 + ecx * 4 - 4], eax
je @f
mov [old_t1 + ecx * 4 - 4], eax
mov esi, val_mod
@@: movzx ecx, al
push eax
mov eax, 47
mov ebx, 0x20000
int 0x40
pop eax
mov cl, ah
mov eax, 47
mov ebx, 0x10000
add edx, 15 * 65536
int 0x40
sub edx, 15 * 65536 - 10
pop esi
pop ecx
loop sh_temp
;;--- ¤®¡ ¢«ï¥¬ ­  £à ä¨ª temp1 ---
movzx eax, word[hwm_temps]
sub al, 25
shl al, 1
cmp ah, 5
jb @f
or al, 1
@@:
mov esi, d_temp1
call d_add
call d_show
;;--- ¤®¡ ¢«ï¥¬ ­  £à ä¨ª temp2 ---
movzx eax, word[hwm_temps + 2]
sub al, 25
shl al, 1
cmp ah, 5
jb @f
or al, 1
@@:
mov esi, d_temp2
call d_add
call d_show
;;--- ¤®¡ ¢«ï¥¬ ­  £à ä¨ª temp3 ---
movzx eax, word[hwm_temps + 4]
sub al, 25
shl al, 1
cmp ah, 5
jb @f
or al, 1
@@:
mov esi, d_temp3
call d_add
call d_show
;---------------------------
; ‘ª®à®á⨠¢à è¥­¨ï ¢¥­â¨«¥©
mov ecx, 5
mov esi, hwm_rpms
mov edx, 121 * 65536 + 80
sh_fan: push ecx
lodsd
push esi
;ॠªæ¨ï ­  ¨§¬¥­¥­¨ï
xor esi, esi
cmp [old_f1 + ecx * 4 - 4], eax
je @f
mov [old_f1 + ecx * 4 - 4], eax
mov esi, val_mod
@@: mov ecx, eax
call digit_len
mov eax, 47
int 0x40
add edx, 10
pop esi
pop ecx
loop sh_fan
;---------------------------
; <20> ¯à㣨
mov esi, hwm_voltages
mov edi, old_volts
mov ecx, 7
mov ebx, 260 * 65536 + 30
mov edx, Data_String
volt_nxt:
push ecx
push esi
call ftoa
;ॠªæ¨ï ­  ¨§¬¥­¥­¨ï
xor ecx, ecx
fld dword [esi]
fsub dword [edi]
fabs
; fcomp dword [c_eps] ; bug in MeOsEmul
; fstsw ax
fcom dword [c_eps] ; 0xBADCODE
fstsw ax
finit
sahf
jc @f
mov ecx, val_mod
@@: mov esi, Data_String ; áç¨â ¥¬ ª®«-¢® ᨬ¢®«®¢
@@: lodsb
test al, al
jnz @b
sub esi, Data_String
mov eax, 4
int 0x40
add ebx, 10
pop esi
pop ecx
movsd
loop volt_nxt
no_monitor:
;---------------------------
; ‘®§¤ ñ¬ ª­®¯ª¨ ¢ª« ¤®ª
mov edi, 250 * 65536 + 25
mov ecx, 4
mov eax, 8
mov ebx, 10 * 65536 + 70
mov edx, 2
n_bt: push ecx
mov ecx, edi
mov esi, tcol
cmp byte [act_tab], dl
jne na1
mov esi, atcol
na1: int 0x40
inc edx
add ebx, 73 * 65536
pop ecx
loop n_bt
; <20>¨è¨¬ ­ §¢ ­¨ï ¢ª« ¤®ª
mov eax, 4
mov ebx, 35 * 65536 + 260
mov edx, tab_lab
mov ecx, 0x10000000
mov esi, 39
int 0x40
; ᮧ¤ ñ¬ à ¬ªã ¢­¨§ã íªà ­ 
mov eax, 13
mov ebx, 10 * 65536 + 290
mov ecx, 275 * 65536 + 160
mov edx, atcol
int 0x40
mov ebx, 12 * 65536 + 286
mov ecx, 277 * 65536 + 156
mov edx, tcol
int 0x40
; à¨á㥬 ¢ë¡à ­­ãî ¢ª« ¤ªã
mov al, [act_tab]
cmp al, 2
je info_tab
cmp al, 3
je test_tab
cmp al, 4
je config_tab
jmp about_tab
end_drow_tab:
mov eax, 12
mov ebx, 2
int 0x40
jmp wait_for_event
;--- Drow Info tab ---------------
info_tab:
include "tab_info.inc"
;--- Drow test tab ---------------
test_tab:
include "tab_test.inc"
;--- Drow Config tab -------------
config_tab:
include "tab_conf.inc"
;--- Drow About tab --------------
about_tab:
include "tab_about.inc"
;---------------------------------------------------------------------
include "system.inc"
include "hwm.inc"
include "diag.inc"
DATA
act_tab db 2 ; <20>®¬¥à  ªâ¨¢­®© ¢ª« ¤ª¨
tab_lab db 'Info Tests Configs About'
title db 'Ghost Monitor v0.4 [23/05/07]',0
msgs_mon mls \
'CPU Load (%)',\
'Mem Usage(%)',\
'Temp1',\
'Temp2',\
'Temp3',\
'Fan1',\
'Fan2',\
'Fan3',\
'Fan4',\
'Fan5'
msgs_mon2 mls \
'Vcore',\
'AGP',\
'+3.3V',\
'AVcc (+5V)',\
'+12V',\
'-12V',\
'-5V'
msg_yes db 'Yes'
msg_no db 'N/A'
update_time dd 300 ; ¯¥à¨®¤ ®¡­®¢«¥­¨ï ¢ á®âëå ¤®«ïå ᥪ㭤ë
d_colors dd d_cpu_load, d_mem_usage, d_temp1, d_temp2, d_temp3
c_eps dd 0.01
; –¢¥â  £à ä¨ª®¢
colors: dd 0xff0000, 0xff00, 0xff, 0xffffff, tcol, 0xFF7E23, 0x8BA169, 0xff0000 ; ¯¥à¢ë© ¨ ¯®á«¥¤­¨© à ¢­ë
colors_end:
;---------------------------------------------------------------------
UDATA
test_pid dd ? ; ¥á«¨ test_id == 0 - ­¥ ¨¬¥¥â á¬ëá« 
test_id db ? ; 0 - â¥áâ ­¥ § ¯ã襭 (ᮮ⢥âáâ¢ã¥â ü ª­®¯ª¨ 6..10)
diag_add_v db ? ; 0 - ­¥ ¤®¡ ¢«ïâì ¤ ­­ë¥ ­  £à ä¨ª, !0 - ¤®¡ ¢«ïâì
Vendor: times 12 db ?
CPU_fam: db ?
CPU_mod: db ?
CPU_type: db ?
CPU_mmx: db ?
; „«ï ॠªæ¨¨ ­  ¨§¬¥­¥­¨ï
old_t1: dd ? ; ¯®á«¥¤­¥¥ §­ ç¥­¨¥ temp1
old_t2: dd ? ; ...
old_t3: dd ?
old_f1: dd ?
old_f2: dd ?
old_f3: dd ?
old_volts: times 7 dd ?
; ƒà䨪¨
diag_beg:
d_cpu_load: dd ?
times 286 db ?
d_mem_usage: dd ?
times 286 db ?
d_temp1: dd ?
times 286 db ?
d_temp2: dd ?
times 286 db ?
d_temp3: dd ?
times 286 db ?
diag_end:
; --- á⥪ â¥áâ , ¢®¨§¡¥¦ ­¨¥ £«îª®¢ ­¥ ¯¥à¥­®á¨âì ¢ ¤à㣮¥ ¬¥áâ® ----
th_stack: times 1024 db ?
stp:
;---------------------------------------------------------------------
MEOS_APP_END

View File

@ -0,0 +1,13 @@
;
; Ghost Monitor - утилита (стресс) тестирования и мониторинга системы
; Copyright (C) 2005, 2006, 2007 Mihailov Ilia (ghost.nsk@mail.ru)
; All Right Reserved
; 0x00xx - Menuet 0.xx
; 0x0400 - Kolibi 4 (новое завершение процесса)
; 0x0510 - MSR -> множитель (Kolibri 0.5.1.0)
; 0x0530 - всего/свободно памяти
; 0x0580 - новое завершение процесса
OS_version equ 0x0580
SMBus fix no ; yes

View File

@ -0,0 +1,63 @@
;
; Ghost Monitor - óòèëèòà (ñòðåññ) òåñòèðîâàíèÿ è ìîíèòîðèíãà ñèñòåìû
; Copyright (C) 2005, 2006, 2007 Mihailov Ilia (ghost.nsk@mail.ru)
; All Right Reserved
; struc DiagramData size,color
; {
; .color dd color
; times size db 0 ;;change to value > 100
; }
;------------------------------------------------------
d_show:
; esi - pointer to struct
; åñëè öâåò ôîíà, òî íå ðèñóåì
cmp dword[esi], tcol
jne @f
ret
@@: pusha
mov edx, [esi]
add esi, 4
mov edi, esi
add edi, 285
mov ebx, 12 * 65536 + 13
xor eax, eax
lodsb
mov cx, 240
sub ecx, eax
@@: shl ecx, 16
mov cx, 240
lodsb
sub ecx, eax
mov eax, 38
int 0x40
add ebx, 0x10001
cmp esi, edi
jle @b
popa
ret
;------------------------------------------------------
d_add:
; esi - pointer to struct
; al - value
pusha
cmp byte [diag_add_v], 0 ; äîáàâëÿåì òîëüêî ïî òàéìåðó
je d_add_end
cld
mov ecx, 285
add esi, 4
mov edi, esi
inc esi
rep movsb
cmp al, 100
jbe @f
mov al, 100
@@: mov [edi], al
d_add_end:
popa
ret

View File

@ -0,0 +1,150 @@
;
; Ghost Monitor - ã⨫¨â  (áâà¥áá) â¥áâ¨à®¢ ­¨ï ¨ ¬®­¨â®à¨­£  á¨á⥬ë
; Copyright (C) 2005, 2006, 2007 Mihailov Ilia (ghost.nsk@mail.ru)
; All Right Reserved
;
; HWM abstract interface, provide:
; hwm_init, hwm_get_params, hwm_enable, hwm_temps, hwm_rpms, hwm_voltages, hwm_chip_name
;
if SMBus eq yes
include 'SMBus.inc'
end if
include 'hwm_hudson.inc'
;include 'hwm_it87.inc'
;include 'hwm_uguru.inc'
;include 'hwm_via686.inc'
uglobal
hwm_enable:
dd 1 ; 0 - no, 1 - Hudson, ... see HWMProbe list
hwm_temps:
db 0,0, 0,0, 0,0 ; £à ¤ãá, ¤¥áïâë¥, £à ¤ãá, ...
hwm_rpms:
dd 0, 0, 0, 0, 0 ; fan1, fan2, fan3, ...
hwm_voltages:
Vcore dd 0.0
Vin0 dd 0.0
Vin1 dd 0.0
AVcc dd 0.0
Vin2 dd 0.0
V12 dd 0.0
V5 dd 0.0
vol8 dd 0.0
vol9 dd 0.0
vol10 dd 0.0
vol11 dd 0.0
acc_type db 0 ; 0 - ISA Bus, 1 - SMBus, 2 - other
endg
IO_Read dd pm2read ; In : al - addr, out : al - value
IO_Write dd pm2write ; In : al - addr, bl - value
hwm_unk db 'Not found', 0
hwm_chip_name dd hwm_unk
; NOTE !!!
; HWMProbe - ᯨ᮪, ¯à®æ¥¤ãà ¯à®¢¥àª¨ 稯®¢, § ª ­ç¨¢ ¥âáï
; ­ã«¥¢ë¬ ¤¢®©­ë¬ á«®¢®¬
; HWMGetParam - ᯨ᮪, ¯à®æ¥¤ãà ¯®«ã祭¨ï ¯ à ¬¥â஢
; ®¡  í⨠ᯨ᪠ ¤®«¦­ë ᮮ⢥âá⢮¢ âì ¤à㣠¤àã£ã ¯®
; ¯® ¯®à浪㠯à®æ¥¤ãà
HWMProbe:
dd hudson_init
; dd wb_init
; dd it87_init
; dd uGuru_init
dd 0 ; <- ª®­¥æ ᯨ᪠
HWMGetParam:
dd hudson_getparam
; dd wb_getparam
; dd it87_getparam
; dd uGuru_getparam
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
hwm_init:
; <EFBFBD>஢¥àª  ­ «¨ç¨ï ¨ ¨­¨æ¨ «¨§ æ¨ï
pusha
; ˆé¥¬ ¤ â稪¨ ­  設¥ ISA
; call isaInit
; jc @f
call chips_probe
; cmp byte[hwm_enable], 0
; jne .exit
;@@: call isaClose
; ˆé¥¬ ¤ â稪¨ ­  設¥ SMBus
; inc byte [acc_type]
;if SMBus eq yes
; call smbInit
; jc @f
; call chips_probe
; cmp byte[hwm_enable], 0
; jne .exit
;@@: call smbClose
;end if
; ˆé¥¬ ¤ â稪¨ ­  ᮡá⢥­­®© 設¥ (LPC etc)
; inc byte [acc_type]
; call chips_probe
mov [acc_type], 2 ; bus type = 'other'
.exit: popa
ret
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
chips_probe:
; <EFBFBD> å®¤¨¬ ­ã¦­ë© 稯
; Out : hwm_enable = !0 if found, else hwm_enable not changed
cld ; Paranoia
mov esi, HWMProbe
@@: lodsd
test eax, eax
jz @f ; Š®­¥æ ᯨ᪠
call eax
jc @b
sub esi, HWMProbe
shr esi, 2
mov dword[hwm_enable], esi
@@: ret
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
hwm_get_params:
pusha
mov eax, [hwm_enable]
test eax, eax
jz @f
dec eax
sal eax, 2
call dword[eax + HWMGetParam]
@@: popa
ret
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
; ISA interface
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
pm2read:
push edx
mov dx, 0xCD0 ; 0x295
out dx, al
inc edx
in al, dx
pop edx
ret
pm2write:
push edx
mov dx, 0xCD0 ; 295
out dx, al
inc edx
mov al, bl
out dx, al
pop edx
ret
isaInit:
ret
isaClose:
ret

View File

@ -0,0 +1,366 @@
; language for programs
lang fix en ; ru en fr ge fi
@^ fix macro comment {
^@ fix }
nl equ 0x0d, 0x0a
;~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
macro uglobal {
UGlobals equ UGlobals,
macro __UGlobalBlock { }
endg fix } ; Use endg for ending iglobal and uglobal blocks.
macro IncludeUGlobals{
macro UGlobals dummy,[n] \{
\common
\local begin, size
begin = $
virtual at $
\forward
__UGlobalBlock
purge __UGlobalBlock
\common
size = $ - begin
end virtual
rb size
\}
match U, UGlobals \{ U \} }
uglobal
endg
;~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
; new application structure
macro meos_app_start
{
use32
org 0x0
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
dd 0x0
}
MEOS_APP_START fix meos_app_start
macro code
{
__start:
}
CODE fix code
macro data
{
__data:
}
DATA fix data
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
IncludeUGlobals
}
UDATA fix udata
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
display nl, ' '
}
MEOS_APP_END fix meos_app_end
; macro for defining multiline text data
struc mls [sstring] {
forward
local ssize
virtual at 0
db sstring ; mod
ssize = $
end virtual
db ssize
db sstring
common
db -1 ; mod
}
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
name db data
.size = $-name
end if
}
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
forward
if lang eq lng
db data
end if
common
.size = $-name
end if
}
macro szc name,elsz,[data] { ; from MFAR [mike.dld]
common
local s,m
m = 0
if used name
label name
virtual at 0
db data
s = $
end virtual
d#elsz s
if m < s
m = s
end if
db data
.size = $-name
.maxl = m
end if
}
macro lszc name,elsz,[lng,data] { ; from MFAR [mike.dld]
common
local s,m
m = 0
if used name
label name
forward
if lang eq lng
virtual at 0
db data
s = $
end virtual
d#elsz s
if m < s
m = s
end if
db data
end if
common
.size = $-name
.maxl = m
end if
}
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
;macro __mov reg,a { ; mike.dld
; if ~a eq
; mov reg,a
; end if
;}
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
; -------------------------
macro header a,[b] {
common
use32
org 0
db 'MENUET',a
forward
if b eq
dd 0
else
dd b
end if }
macro section name { align 16
label name }
macro func name {
if ~used name
display 'FUNC NOT USED: ',`name,13,10
else
align 4
name:
;pushad
;pushfd
;dps `name
;newline
;mcall 5,1
;popfd
;popad
}
macro endf { end if }
macro diff16 title,l1,l2
{
local s,d
s = l2-l1
display title,': 0x'
repeat 8
d = '0' + s shr ((8-%) shl 2) and $0F
if d > '9'
d = d + 'A'-'9'-1
end if
display d
end repeat
display 13,10
}
macro diff10 title,l1,l2
{
local s,d,z,m
s = l2-l1
z = 0
m = 1000000000
display title,': '
repeat 10
d = '0' + s / m
s = s - (s/m)*m
m = m / 10
if d <> '0'
z = 1
end if
if z <> 0
display d
end if
end repeat
display 13,10
}
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
macro mov arg1,arg2
{
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
struc POINT _t,_dx,_dy {
.x _t _dx
.y _t _dy
}
; constants
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b

View File

@ -0,0 +1,58 @@
Ghost Monitor
Автор : Михайлов Илья Андреевич aka Ghost
Версия : 0.4
ОС : для полного функционирования скачайте последнне ядро, или последний дистрибутив.
files : svn://kolibrios.org/programs/system/gmon/
http://iam.gorodok.net/Gmon.zip
forum : meos.sysbin.com -> Программы -> GMon
mailto : ghost.nsk@mail.ru
Назначение :
Мониторинг температуры, напряжения и скорости врашения вентиляторов процессора и
материнской платы, стресс тестирование надёжности системы охлаждения и блока
питания компьютера.
Мониторинг :
В настоящее время отображаются загрузка/частота процессора, загрузка памяти, температура,
скорости врашения вентиляторов и напряжение. Поддерживаемые чипы мониторинга :
WinBond chip : W83627HF/THF/THF-A/EHF-A, W83637THF, W83697HF, и аналоги.
Integrated Technology Express (ITE) : IT8705F, IT8712F, IT8716F, и аналоги.
Silicon Integrated Systems Corp. (SiS) : sis950 (аналог IT8705F)
ABIT : uGuru
Функции мониторинга можно проверить в Windows на эмуляторе KlbrInWin, для этого необходимо в
файле настроек написать (пользуйтесь последней версией):
EnablePorts=2e 2f 4e 4f e0-e8 295 296
AllowReadMSR=true
Тесты :
Тесты ориентированы на процессоры P5, P6, K6 и K7, основаны на Robert Redelmeier's CPUburn
[http://pages.sbcglobal.net/redelm/]. Цля тестирования Pentium 4, рекомендую тест для K7, для
остальных процессоров подберите по максимальной температуре (напишите мне об этом).
Внимание! Программа не реагирует на критический порог температуры, поэтому для избежания
порчи оборудования не оставляйте запушенный тест без присмотра! В связи с различием в
реализации функции 18-2, для Menuet и Kolibri необходимы различные реализации программы, по
умолчанию компилируется для Kolibri 0.5.8.0 и старше, при необходимости измените параметр
OS_version в файле config.inc. Тесты работают одинаково эффективно как на реальном оборудовании,
так и на виртуальных машинах, но не рекоммендуется запускать их на эмуляторах (KlbrInWin,
MeOSEmul, etc) в связи с плохой реализацией завершения процесса, что может привести к порче
оборудования.
На будущее :
Новые чипы
Реакция на критический порог температуры
Провека надёжности схем питания
Особая благодарность всем участникам форума.
Найденные ошибки и предложения пишите в форум или на почту.
И напоследок :
ВНИМАНИЕ !!! ВОЗМОЖНА ПОРЧА ОБОРУДОВАНИЯ! ИСПОЛЬЗУЙТЕ НА СВОЙ СТРАХ И РИСК!
Программа распостраняется "as is", и автор не несет ответственности за возможный ущерб, причиненный
программой.

View File

@ -0,0 +1,476 @@
;
; Ghost Monitor - óòèëèòà (ñòðåññ) òåñòèðîâàíèÿ è ìîíèòîðèíãà ñèñòåìû
; Copyright (C) 2005, 2006, 2007 Mihailov Ilia (ghost.nsk@mail.ru)
; All Right Reserved
;--------------------------------------------------------------------
; Çàãðóçêà ïðîöåññîðà
; OUT : AL - çàãðóçêà â ïðîöåíòàõ
cpu_usage:
pusha
mov byte [c_u_t], 0
mov eax, 18 ; TSC / SEC
mov ebx, 5
int 0x40
shr eax, 20
push eax
mov eax, 18 ; IDLE / SEC
mov ebx, 4
int 0x40 ; eax - ïóñòûõ öèêëîâ â ñåêóíäó
shr eax, 20 ; eax = IDLE / 1048576
pop ebx
cmp eax, ebx ; BUG : time to time ICPS > TSCPS
jnl c_u_o
push ebx
xor edx, edx
mov ebx, 100
mul ebx ; eax =(IDLE / 1048576) * 100
xor edx, edx
pop ebx ; ebx = (TSC/1048576)+1
inc ebx
div ebx ; eax = ((IDLE / 1048576) * 100) / ((TSC/1048576)+1)
mov bl, 100
sub bl, al
cmp bl, 101
jnl c_u_o
mov [c_u_t], bl
c_u_o: popa
mov al, [c_u_t]
ret
uglobal
c_u_t: db 0
endg
;--------------------------------------------------------------------
mem_usage:
; Èñïðîëüçîâàíèå ïàìÿòè
; OUT : al - ïðîöåòí èñïðîëüçóåìîé ïàìÿòè
display nl, 'Memory usage : '
if (OS_version >= 0x0530)
display 'yes'
pusha
mov byte [m_u_t], 0
mov eax, 18 ; full mem
mov ebx, 17
int 0x40
shr eax, 10
push eax
mov eax, 18 ; free mem
mov ebx, 16
int 0x40 ; eax - free mem
shr eax, 10 ; eax = fmem / 1024
xor edx, edx
mov ebx, 100
mul ebx ; eax =(free mem / 1024) * 100
xor edx, edx
pop ebx ; ebx = (full mem/1024)+1
inc ebx
div ebx ; eax = ((free mem / 1024) * 100) / ((full mem/1024)+1)
mov bl, 100
sub bl, al
cmp bl, 101
jnb m_u_o
mov [m_u_t], bl
m_u_o: popa
mov al, [m_u_t]
ret
uglobal
m_u_t: db 0
endg
else
display 'no'
xor eax, eax
ret
end if
;#######################################################################
stop_test:
; ïîðòÿòñÿ ðåãèñòðû
display nl, 'Kill process type : '
if (OS_version < 0x0400)
; êîä äëÿ Menuet
display 'Menuet'
mov eax, 18
mov ebx, 2
mov ecx, [test_pid]
int 0x40
mov byte[test_id], 0
ret
; -------------------------------
else if (OS_version >= 0x0400)
if (OS_version < 0x0580)
display 'old Kolibri'
; -- ñëåäóéøèé êîä óáèâàåò ïðîöåññ â Kolibri 4 è ñòàðøå
mov ebx, Buf
xor ecx, ecx
find_th:mov eax, 9
int 0x40
mov edx, dword [Buf + 30]
cmp edx, dword [test_pid]
je kill_t
inc ecx
cmp ecx, eax ; eax - êîëè÷åñòâî ïðîöåññîâ
jle find_th
jmp cl_tinf ; ÎØÈÁÊÀ !!!! ïîòîê íå íàéäåí !!!!
kill_t: mov ebx, 2 ; óáèâàåì òåñòîâûé ïîòîê
mov eax, 18
int 0x40
cl_tinf:
mov byte[test_id], 0
ret
uglobal
Buf: times 1024 db ? ; Áóôåð äëÿ íàõîæäåíèÿ PID`à çàïóùåííîãî òåñòà
endg
else
; -------------------------------
; êîä äëÿ Kolibri 0.5.8.0 è ñòàðøå
display 'Kolibri 0.5.8.0'
mov eax, 18
mov ebx, 18
mov ecx, [test_pid]
int 0x40
mov byte [test_id], 0
ret
; -------------------------------
end if
end if
;#######################################################################
; Âûâîäèò ñòðîêè òåêñòà
; in : edx - óêàçàòåëü íà mls
; ebx - êîîðäèíàòû : X << 16 + Y
show_text:
mov eax, 4
mov ecx, 0x10000000
@@:
movzx esi, byte[edx]
inc edx
int 0x40
add ebx, 10
add edx, esi
cmp byte[edx], -1
jne @b
ret
;---------------------------------------------------------------------
multiplier:
;--- âû÷èñëåíèå êîýôôèöèåíòà óìíîæåíèÿ -
; ïîðòèò ðåãèñòðû
; out : CL = êîýôô.óìíîæåíèÿ * 10, èëè 0
xor ecx, ecx
if (OS_version >= 0x0510)
display nl, 'Multiplier (RDMSR) : yes'
cmp dword [Vendor + 8], 'cAMD' ; Check for Advanced Micro Devices CPU
jne noAMD
cmp byte [CPU_fam], 5
jne noAMDK6
mov eax, 68 ; AMD-K6 (p.30)
mov ebx, 3
mov edx, 0x0C0000087
int 0x40 ; eax - low dword
and eax, 111b
mov cl, [athloncoef3 + eax]
cmp eax, 6
jne @f
cmp byte[CPU_mod], 8
jae @f
mov cl, 20
@@: ret
noAMDK6:cmp byte [CPU_fam], 6
jne noAMDK7
cmp byte [CPU_mod], 5
jna @f
mov eax, 0x80000007
cpuid
and edx, 6 ; voltage ID control & frequency ID control
cmp edx, 6
je AMDK7M
@@: mov eax, 68 ; Athlon/AthlonXP
mov ebx, 3
mov edx, 0x0C0010015
int 0x40
mov ebx, eax
shr ebx, 24
and ebx, 0x0F
shr eax, 20
jnc @f
add bl, 16
@@: mov cl, [athloncoef + ebx]
ret
AMDK7M: mov eax, 68 ; AthonXP-M
mov ebx, 3
mov edx, 0xC0010042
int 0x40
and eax, 0x1F
mov cl, [athlonmcoef + eax]
ret
noAMDK7:
cmp byte [CPU_fam], 0xF
jne AMD_Fusion
mov eax, 0x80000007
cpuid
and edx, 6 ; voltage ID control & frequency ID control
cmp edx, 6
je AMDK8M
mov eax, 68 ; Athon64
mov ebx, 3
mov edx, 0xC0010015
int 0x40
shr eax, 24
and al, 0x3F
shr al, 1
add al, 4
mov dl, 10
mul dl
mov cl, al
ret
AMDK8M: mov eax, 68 ; Athon64-M
mov ebx, 3
mov edx, 0xC0010042
int 0x40
and al, 0x3F
shr al, 1
add al, 4
mov dl, 10
mul dl
mov cl, al
ret
AMD_Fusion:
cmp byte [CPU_fam], 0x14
jne unknownAMD
mov eax, 68 ;
mov ebx, 3
mov edx, 0xC0010071
int 0x40
shr ebx, 17
and ebx, 0x3F
add bl, 16 ; Fmax = 100MHz * (edx[54:49] + 10h)
shl bl, 3
mov edx, ebx
shl edx, 2
add ebx, edx ;) that all was just to multiply ebx by 40
and eax, 0x1ff
mov dl, al
and dl, 3 ; dl = 4*fractional part of the divisor
shr eax, 4
inc eax
shl eax, 2
or al, dl ; ax = 4 * divisor
xchg eax, ebx
div ebx
mov cl, al
ret
noAMD: cmp dword [Vendor + 8], 'ntel' ; Check for International Electronics CPU
jne noIntel
cmp byte[CPU_fam], 0x0F
jne noIntelP4
cmp byte [CPU_type], 6
jne @f
mov eax, 68 ; Pentium M
mov ebx, 3
mov edx, 0x2A
int 0x40
shr eax, 22
and eax, 0x1F
mov dl, 10
mul dl
mov cl, al
ret
@@: cmp byte [CPU_mod], 2
jae @f
mov eax, 68 ; Pentium 4 / Xeon (model < 2) Willamete
mov ebx, 3
mov edx, 0x2A
int 0x40
shr eax, 8
and eax, 0x0F
mov cl, [p4coef + eax]
ret
@@: mov eax, 68 ; Pentium 4 / Xeon (model >= 2) NorthWood
mov ebx, 3
mov edx, 0x2C
int 0x40
shr eax, 24
and eax, 0x1F
mov dl, 10
mul dl
mov cl, al
ret
noIntelP4:
cmp byte[CPU_fam], 6
jne noIntelP6
mov eax, 68 ; Pentium Pro / Pentium II / Pentium III
mov ebx, 3
mov edx, 0x2A
int 0x40
shr eax, 22
test al, 0x20
jz @f
or al, 0x10
@@: and eax, 0x1f
cmp byte[CPU_mod], 0x06 ; ? 7
ja @f
and al, 0x0f
@@:
mov cl, [coppercoeff + eax]
cmp byte[CPU_mod], 0x0B
jb @f
mov cl, [tualatcoeff + eax]
cmp byte[CPU_mod], 0x0B
je @f
mov dl, 10 ; model 0x0C - 0x0F - Dothan / Yonah / Conroe / Merom
mul dl
mov cl, al
@@: ret
noIntel:
noIntelP6:
unknownAMD:
ret
athloncoef db 110, 115, 120, 125, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 120
db 190, 120, 200, 130, 135, 140, 210, 150, 220, 160, 165, 170, 180, 230, 240
athlonmcoef: db 110, 115, 120, 125, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105
db 30, 190, 40, 200, 130, 135, 14, 210, 150, 220, 160, 165, 170, 230, 240
athloncoef3 db 45, 50, 40, 55, 25, 30, 60, 35
p4coef db 160, 170, 180, 190, 200, 210, 220, 230, 80, 90, 100, 110, 120, 130, 140, 150 ; Pentium 4 (Willamete)
coppercoeff db 50, 30, 40, 20, 55, 35, 45, 25, 35, 70, 80, 60, 20, 75, 15, 65, 90, 110, 120, 20, 95, 115, 85, 25, 35, 70, 80, 100, 20, 75, 15, 105
tualatcoeff db 120, 35, 35, 40, 55, 35, 115, 35, 160, 70, 80, 60, 40, 75, 35, 65, 90, 110, 35, 35, 95, 35, 85, 35, 35, 35, 130, 100, 140, 35, 150, 105
else
display nl, 'Multiplier : no'
ret
end if
;---------------------------------------------------------------------
digit_len:
; Âû÷èñëåíèå äëèííû ÷èñëà äëÿ ôóíê. 47
; ecx - ÷èñëî
; ebx - äëèííà * 65536
pusha
xor ebx, ebx
mov eax, ecx
mov esi, 10
@@: xor edx, edx
inc ebx
div esi
test eax, eax
jnz @b
mov [tdl], ebx
popa
mov ebx, [tdl]
shl ebx, 16
ret
uglobal
tdl dd 0
endg
;--------------------------------------------------------------------
ftoa:
; esi - ïðåîáðàçóåìîå ÷èñëî;
; Data_String - ñòðîêà-ðåçóëüòàò.
pusha
mov edi, Data_String
fninit
fld dword [esi]
fmul dword [MConst]
fbstp [Data_BCD]
mov ax, word[Data_BCD + 8]
cmp ax, 0xFFFF
je @@Overflow
mov al, byte[Data_BCD + 9]
and al, al
jz @@NoSign
mov AL,'-'
stosb
@@NoSign:
mov ebx, 8
mov ecx, 9
mov edx, 18 - 2 ; 2 çíàêà ïîñëå çàïÿòîé
@@NextPair:
mov al, byte[Data_BCD + ebx]
mov AH,AL
shr AL,4
add AL,'0'
stosb
dec edx
jnz @@N0
mov AL,'.'
stosb
@@N0: mov AL,AH
and AL,0Fh
add AL,'0'
stosb
dec edx
jnz @@N1
mov AL,'.'
stosb
@@N1: dec ebx
loop @@NextPair
xor al, al
stosb
mov edi, Data_String
mov esi, Data_String
cmp byte[esi], '-'
jne @@N2
inc esi
inc edi
@@N2: mov ecx, 18+1+1
@@N3: cmp byte[esi], '0'
jne @@N4
inc esi
loop @@N3
jmp @@Error
@@N4: rep movsb
jmp @@End
@@Overflow:
@@Error:mov eax, 'ERR'
stosd
@@End: popa
ret
MConst: dd 1.0E2 ; 2 çíàêà ïîñëå çàïÿòîé
uglobal
Data_BCD: DT ?
Data_String: times 20 db 0 ; ASCIIZ ñòîðêà ñ ïðåîáðàçîâàííûì ÷èñëîì
endg
;--------------------------------------------------------------------
ReservePorts:
; In : ecx - first port, edx - last port
; Out : CF = 1 if error
pusha
mov eax, 46
xor ebx, ebx
int 0x40
clc
test eax, eax
jz @f
stc
@@: popa
ret
FreePorts:
; In : ecx - first port, edx - last port
pusha
mov eax, 46 ; îñâîáîæäàåì 0x295 è 0x296 ïîðòû
xor ebx, ebx
inc ebx
int 0x40
popa
ret

View File

@ -0,0 +1,26 @@
;
; Ghost Monitor - óòèëèòà (ñòðåññ) òåñòèðîâàíèÿ è ìîíèòîðèíãà ñèñòåìû
; Copyright (C) 2005, 2006, 2007 Mihailov Ilia (ghost.nsk@mail.ru)
; All Right Reserved
mov edx, msg_about
mov ebx, 17 * 65536 + 285
call show_text
jmp end_drow_tab
msg_about mls \ ; äîëæíà áûòü õîòÿáû îäíà ñòðîêà
' Ghost Monitor',\
'',\
' tool for testing and monitoring hardware',\
'',\
'Supported SuperIO : W83627HF,W83697HF',\
' W83627THF,W83627THF-A,W83627EHF-A,',\
' W83637THF,IT8705F,IT8712F,SiS950',\
' ABIT uGuru',\
'',\
'Tests based on R.J.Redelmeier CPUBurn',\
'',\
'Mailto : ghost.nsk@mail.ru',\
'',\
' *** Use at YOUR own RISK ***'

View File

@ -0,0 +1,54 @@
;
; Ghost Monitor - óòèëèòà (ñòðåññ) òåñòèðîâàíèÿ è ìîíèòîðèíãà ñèñòåìû
; Copyright (C) 2005, 2006, 2007 Mihailov Ilia (ghost.nsk@mail.ru)
; All Right Reserved
;
;
; Âêëàäêà íàñòðîåê
;
; Âðåìÿ îáíîâëåíèÿ
mov eax, 8
mov ebx, 200 * 65536 + 15
mov ecx, 280 * 65536 + 15
mov edx, 11
mov esi, tcol
int 0x40
mov ebx, 217 * 65536 + 15
inc edx
int 0x40
mov eax, 4
mov ebx, 17 * 65536 + 285
mov edx, msg_cf_utime
mov ecx, 0x10000000
mov esi, 11
int 0x40
mov ebx, 205 * 65536 + 285
mov edx, msg_cf_pm
xor ecx, ecx
mov esi, 4
int 0x40
mov ecx, [update_time]
call digit_len
mov edx, 160 * 65536 + 285
xor esi, esi
mov eax, 47
int 0x40
; Ðàññòàâëÿåì äâîåòî÷èÿ
mov eax, 4
mov ebx, 152 * 65536 + 285
mov edx, dub_p
mov esi, 1
mov ecx, 0x10000000
int 0x40
jmp end_drow_tab
msg_cf_utime db 'Update time' ; 11
msg_cf_pm db '+ -' ; 4

View File

@ -0,0 +1,138 @@
;
; Ghost Monitor - óòèëèòà (ñòðåññ) òåñòèðîâàíèÿ è ìîíèòîðèíãà ñèñòåìû
; Copyright (C) 2005, 2006, 2007 Mihailov Ilia (ghost.nsk@mail.ru)
; All Right Reserved
;
;
; Âêëàäêà èíôîðìàöèè î ñèñòåìå
;
; Äîïèñàòü åù¸ ÷òîèòü (ìàëîâàòî áóäåò)
;
;
; Ïèøåì ïàðàìåòðû
mov edx, lab_info_tab
mov ebx, 17 * 65536 + 285
call show_text
; Ïèøåì ïðîèçâîäèòåëÿ ïðîöåññîðà
mov edx, Vendor
mov esi, 12
mov ebx, 160 * 65536 + 285
int 0x40
; Ïîääåðæêà MMX
mov ebx, 160 * 65536 + 305
mov esi, 3
mov edx, msg_yes
cmp byte[CPU_mmx], 1
je mmx_en
mov edx, msg_no
mmx_en: int 0x40
; ×èï ìîíèòîðèíãà
mov edx, [hwm_chip_name]
or ecx, 0x80000000
mov ebx, 160 * 65536 + 325
mov al, 4
int 0x40
; ×àñòîòà ïðîöåññîðà
mov eax, 18
mov ebx, 5
int 0x40
xor edx, edx
mov ebx, 1000000
div ebx
mov ecx, eax
call digit_len
mov eax, 47
mov edx, 160 * 65536 + 295
xor esi, esi
int 0x40
; push eax ; Âåðíóòü êîä ïîñëå èñïðàâëåíèÿ ftoa
; fild dword[esp]
; push 1000;000
; fidiv dword[esp]
; fidiv dword[esp]
; fstp dword[esp]
; mov esi, esp
; call ftoa
; mov ebx, 160 * 65536 + 295
; mov edx, Data_String
; mov eax, 4
; mov esi, 7
; xor ecx, ecx
; int 0x40
; pop eax
; pop eax
; Ñåìåéñòâî è ìîäåëü ïðîöåññîðà
mov eax, 47
mov ebx, 0x10100
xor ecx, ecx
mov cl, [CPU_fam]
mov edx, 250 * 65536 + 285
xor esi, esi
int 0x40
mov cl, [CPU_mod]
add edx, 10 * 65536
int 0x40
; êîýôôèöèåíò óìíîæåíèÿ
call multiplier
test ecx, ecx
jz @f
movzx ecx, cl
push ecx
fild dword[esp]
push 10
fidiv dword[esp]
fstp dword[esp]
mov esi, esp
call ftoa
mov ebx, 160 * 65536 + 315
mov edx, Data_String
mov eax, 4
mov esi, eax
xor ecx, ecx
int 0x40
pop eax
pop eax
@@:
; Ñâîáîäíàÿ ïàìÿòü
if (OS_version >= 0x0530)
mov eax, 18
mov ebx, 16
int 0x40
mov ecx, eax
call digit_len
mov eax, 47
mov edx, 160 * 65536 + 335
xor esi, esi
int 0x40
end if
; Ðàññòàâëÿåì äâîåòî÷èÿ
mov eax, 4
mov ebx, 152 * 65536 + 285
mov edx, dub_p
mov esi, 1
mov ecx, 6 ; <- êîëè÷åñòâî ñòðîê
nxt_dp: push ecx
mov ecx, 0x10000000
int 0x40
add ebx, 10
pop ecx
loop nxt_dp
;---------------------------------------------------------------------
jmp end_drow_tab
dub_p db ':'
lab_info_tab mls \
'CPU Vendor',\
'CPU frequency (MHz)',\
'MMX tehnology',\
'Multiplier',\
'Monitoring chip',\
'Free memory (Kb)'

View File

@ -0,0 +1,144 @@
;
; Ghost Monitor - óòèëèòà (ñòðåññ) òåñòèðîâàíèÿ è ìîíèòîðèíãà ñèñòåìû
; Copyright (C) 2005, 2006, 2007 Mihailov Ilia (ghost.nsk@mail.ru)
; All Right Reserved
;
;
;
; Âêëàäêà òåñòîâ
;
;
;
;
; "GenuineIntel" - International Electronics
; "GenuineTMx86" - Transmeta Processor
; "AuthenticAMD" - Advanced Micro Devices
; "AMD ISBETTER" - Advanced Micro Devices
; "UMC UMC UMC " - United Microelectronics Corporation
; "CyrixInstead" - Cyrix Processor
; "Geode by NSC" - National Semiconductor Processor
; "SiS SiS SiS " - SiS Processor
; "RiseRiseRise" - Rise Processor
; "NexGenDriven" - NexGen Processor (acquired by AMD)
; "CentaurHauls" - IDT/Centaur, now VIA Processor
; Pentium (P5) button
mov eax, 8
mov ebx, 17 * 65536 + 145
mov ecx, 297 * 65536 + 25
mov edx, 6
mov esi, tcol
cmp byte[Vendor + 11], 'l'
jne p5n
cmp byte[CPU_fam], 5
jne p5n
mov esi, atcol
p5n: int 0x40
; Pentium Pro / II / III (P6) button
add ecx, 27 * 65536
inc edx
mov esi, tcol
cmp byte[Vendor + 11], 'l'
jne p6n
cmp byte[CPU_fam], 6
jne p6n
mov esi, atcol
p6n: int 0x40
; AMD K6 button
add ecx, 27 * 65536
inc edx
mov esi, tcol
cmp byte[Vendor], 'A'
jne k6n
cmp byte[CPU_fam], 5
jne k6n
mov esi, atcol
k6n: int 0x40
; AMD K7 (Athlon / Duron)
add ecx, 27 * 65536
inc edx
mov esi, tcol
cmp byte[Vendor], 'A'
jne k7n
cmp byte[CPU_fam], 6
jne k7n
mov esi, atcol
k7n: int 0x40
; MMX òåñò
; add ecx, 27 * 65536
; inc edx
; mov esi, tcol
; cmp byte[CPU_mmx], 1
; jne mmxn
; mov esi, atcol
; mmxn: int 0x40
; Ïèøåì íàçâàíèÿ êíîïîê
mov eax, 4
mov ebx, 30 * 65536 + 307
mov esi, 7
mov edx, tmsg_p ; P5
mov ecx, 0x10000000
cmp byte[test_id], 6
jne nr1
mov ecx, 0x10FF0000
nr1: int 0x40
mov ebx, 30 * 65536 + 307 + 27
mov esi, 20 ; P6
mov ecx, 0x10000000
cmp byte[test_id], 7
jne nr2
mov ecx, 0x10FF0000
nr2: int 0x40
mov ebx, 30 * 65536 + 307 + 2 * 27
mov edx, tmsg_k6 ; K6
mov esi, 13
mov ecx, 0x10000000
cmp byte[test_id], 8
jne nr3
mov ecx, 0x10FF0000
nr3: int 0x40
mov ebx, 30 * 65536 + 307 + 3 * 27
mov edx, tmsg_k7 ; K7
mov esi, 15
mov ecx, 0x10000000
cmp byte[test_id], 9
jne nr4
mov ecx, 0x10FF0000
nr4: int 0x40
; mov ebx, 30 * 65536 + 307 + 4 * 27
; mov edx, tmsg_mmx ; MMX
; mov esi, 12
; mov ecx, 0x10000000
; cmp byte[test_id], 10
; jne nr5
; mov ecx, 0x10FF0000
; nr5: int 0x40
; recommendate
mov ecx, 0x10000000
mov ebx, 190 * 65536 + 420
mov edx, tmsg_rec
mov esi, 14
int 0x40
; read about
mov ebx, 30 * 65536 + 282
mov edx, tmsg_war
mov esi, 34
mov ecx, 0x10FF0000
int 0x40
; recommendate color
mov eax, 13
mov ebx, 170 * 65536 + 10
mov ecx, 418 * 65536 + 10
mov edx, atcol
int 0x40
jmp end_drow_tab
tmsg_p db 'Pentium (Pro/II/III)' ; 7/20
tmsg_k6 db 'K6 (I/II/III)' ; 13
tmsg_k7 db 'K7/Athlon/Duron' ; 15
;tmsg_mmx db 'MMX (memory)' ; 12
tmsg_rec db '--------------' ; 14
tmsg_war db 'May permanent damage your system' ; 34

View File

@ -0,0 +1,242 @@
;
; Ghost Monitor - óòèëèòà (ñòðåññ) òåñòèðîâàíèÿ è ìîíèòîðèíãà ñèñòåìû
; Copyright (C) 2005, 2006, 2007 Mihailov Ilia (ghost.nsk@mail.ru)
; All Right Reserved
;
; k6, k7, p5 & p6 tests based on Robert J. Redelmeier cpuburn-1.4
; Copyright 1999, 2000 Robert J. Redelmeier. All Right Reserved
; Licensed under GNU General Public Licence 2.0. No warrantee.
; adapted by Mihailov Ilia
;
; Çàìåòêè :
; ïåðåïèñòü ðåàêöèþ íà îøèáêè
k6:
finit
push ebp
mov ebp, esp
and ebp, -32
sub esp, 96
fldpi
fld qword [rtt]
fstp qword [ebp - 24]
fld qword [e]
fstp qword [ebp - 32]
mov edx, [half]
mov [ebp - 8], edx
k6_after_check:
xor eax, eax
mov ebx, eax
lea esi, [eax - 1]
mov ecx, 400000000
mov [ebp - 4], ecx
align 32
;rev. eng. win. ver. (lea esi, [esi]) ; Ghost
k6_crunch:
fld qword [ebp+esi*8-16] ; CALC BLOCK
fmul qword [ebp+esi*8-24]
add edx, [half + 9 + esi + esi * 8] ;!!!
jnz $ + 2
faddp
fld qword [ebp+esi*8-16]
dec ebx
sub edx, [half + 9 + esi + esi * 8] ;!!!
jmp $ + 2
fmul qword [ebp+esi*8-24]
inc ebx
dec dword [ebp+esi*8+4]
fsubp
jnz k6_crunch ; time for testing ?
test ebx, ebx ; TEST BLOCK
jnz k6_int_exit
cmp edx, [half]
jnz k6_int_exit
fldpi
fcomp st1
fstsw ax
sahf
jz k6_after_check
dec ebx
k6_int_exit:
dec ebx
add esp, 96
pop ebp
mov eax, -1
int 0x40
;#######################################################################
;#######################################################################
k7: finit
mov ebp, esp
and ebp,-32
sub esp,96
fld qword [rtt]
fstp qword [ebp-40]
fld qword [e]
fstp qword [ebp-32]
fldpi
fldpi
xor eax, eax
xor ebx, ebx
xor ecx, ecx
mov edx, half
lea esi,[eax-1]
mov [ebp-12], eax
mov [ebp-8], edx
k7_after_check:
mov dword[ebp-4], 0x32A9F880;0x850000000 ;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
ALIGN 16
k7_crunch:
fxch ; CALC BLOCK
fld qword [ebp+esi*8-24] ; 17 instr / 6.0 cycles
fmul qword [ebp+esi*8-32]
faddp
dec ecx
fld qword [ebp+esi*8-24]
dec ebx
inc dword [ebp+esi*8-12]
inc ecx
fmul qword [ebp+esi*8-32]
inc ebx
dec dword [ebp+esi*8-4]
jmp $+2
fsubp st2, st0
jnz k7_crunch ; time for testing ?
test ebx, ebx ; TEST BLOCK
jnz k7_int_exit
test ecx, ecx
jnz k7_int_exit
cmp edx, half
jnz k7_int_exit
fcom st1
fstsw ax
sahf
jz k7_after_check
dec ebx
k7_int_exit:
dec ebx
add esp,96
mov eax, -1
int 0x40
;#######################################################################
;#######################################################################
p5: finit
push ebp
mov ebp, esp
and ebp, -32
sub esp, 96
fld qword [half]
fstp qword [ebp - 24]
fld qword [rtt]
fst qword [ebp - 16]
fld st
fld st
p5_after_check:
xor eax, eax
mov eax, ebx
mov ecx, 200000000
align 32
;# MAIN LOOP 16 flops / 18 cycles
p5_crunch:
fmul qword [ebp - 24]
fxch st1
fadd qword [ebp - 16]
fxch st2
fmul qword [ebp - 24]
fxch st1
fadd qword [ebp - 16]
fxch st2
fmul qword [ebp - 24]
fxch st1
fadd qword [ebp - 16]
fxch st2
fmul qword [ebp - 24]
fxch st1
fadd qword [ebp - 16]
fxch st2
fmul qword [ebp - 24]
fxch st1
fadd qword [ebp - 16]
fxch st2
fmul qword [ebp - 24]
fxch st1
fadd qword [ebp - 16]
fxch st2
fmul qword [ebp - 24]
fxch st1
fadd qword [ebp - 16]
fxch st2
fmul qword [ebp - 24]
fxch st1
fadd qword [ebp - 16]
fxch st2
dec ecx
jnz p5_crunch
jmp p5_after_check
;#######################################################################
;#######################################################################
p6: finit
push ebp
mov ebp, esp
and ebp, -32
sub esp, 96
fldpi
fld qword [rtt]
fstp qword [ebp - 24]
fld qword [e]
fstp qword [ebp - 32]
mov edx, [half]
mov [ebp - 8], edx
p6_after_check:
xor eax, eax
mov ebx, eax
lea esi, [eax - 1]
mov ecx, 539000000 ;# check after this count
mov [ebp - 4], ecx
align 32
p6_crunch: ;# MAIN LOOP 21uops / 8.0 clocks
fld qword [ebp+esi*8-16]
fmul qword [ebp+esi*8-24]
add edx, [half]
jnz $ + 2
faddp
fld qword [ebp - 24]
dec ebx
sub edx, [half + 9 + esi + esi*8]
jmp $ + 2
fmul qword [ebp+esi*8-24]
inc ebx
dec dword [ebp+esi*8+4]
fsubp
jnz p6_crunch
test ebx, ebx ;# Testing block
mov ebx, 0
jnz p6_int_exit
cmp edx, [half]
jnz p6_int_exit
fldpi
fcomp st1
fstsw ax
sahf
jz p6_after_check ;# fp result = pi ?
dec ebx
p6_int_exit: ;# error abort
dec ebx
add esp, 96
pop ebp
mov eax, -1
int 0x40
;---------------------------------------------
align 32
half dd 0x7fffffff, 0
e dd 0xffffffff, 0x3fdfffff
rtt dd 0xffffffff, 0x3fefffff