From e626668c98178efecf50512b7dc6b6a89d6ebbd5 Mon Sep 17 00:00:00 2001 From: "Artem Jerdev (art_zh)" Date: Mon, 5 Nov 2012 20:19:33 +0000 Subject: [PATCH] A-version of GMON git-svn-id: svn://kolibrios.org@3007 a494cfbc-eb01-0410-851d-a64ba20cac60 --- .../Kolibri-A/utilities/amon/HISTORY.txt | 51 ++ .../Kolibri-A/utilities/amon/HWM_HUDSON.INC | 300 ++++++++++ .../Kolibri-A/utilities/amon/SMBus.inc | 72 +++ kernel/branches/Kolibri-A/utilities/amon/amon | Bin 0 -> 5488 bytes .../Kolibri-A/utilities/amon/amon.asm | 564 ++++++++++++++++++ .../Kolibri-A/utilities/amon/config.inc | 13 + .../Kolibri-A/utilities/amon/diag.inc | 63 ++ .../branches/Kolibri-A/utilities/amon/hwm.inc | 150 +++++ .../Kolibri-A/utilities/amon/macros.inc | 366 ++++++++++++ .../Kolibri-A/utilities/amon/readme.txt | 58 ++ .../Kolibri-A/utilities/amon/system.inc | 476 +++++++++++++++ .../Kolibri-A/utilities/amon/tab_about.inc | 26 + .../Kolibri-A/utilities/amon/tab_conf.inc | 54 ++ .../Kolibri-A/utilities/amon/tab_info.inc | 138 +++++ .../Kolibri-A/utilities/amon/tab_test.inc | 144 +++++ .../Kolibri-A/utilities/amon/tests.inc | 242 ++++++++ 16 files changed, 2717 insertions(+) create mode 100644 kernel/branches/Kolibri-A/utilities/amon/HISTORY.txt create mode 100644 kernel/branches/Kolibri-A/utilities/amon/HWM_HUDSON.INC create mode 100644 kernel/branches/Kolibri-A/utilities/amon/SMBus.inc create mode 100644 kernel/branches/Kolibri-A/utilities/amon/amon create mode 100644 kernel/branches/Kolibri-A/utilities/amon/amon.asm create mode 100644 kernel/branches/Kolibri-A/utilities/amon/config.inc create mode 100644 kernel/branches/Kolibri-A/utilities/amon/diag.inc create mode 100644 kernel/branches/Kolibri-A/utilities/amon/hwm.inc create mode 100644 kernel/branches/Kolibri-A/utilities/amon/macros.inc create mode 100644 kernel/branches/Kolibri-A/utilities/amon/readme.txt create mode 100644 kernel/branches/Kolibri-A/utilities/amon/system.inc create mode 100644 kernel/branches/Kolibri-A/utilities/amon/tab_about.inc create mode 100644 kernel/branches/Kolibri-A/utilities/amon/tab_conf.inc create mode 100644 kernel/branches/Kolibri-A/utilities/amon/tab_info.inc create mode 100644 kernel/branches/Kolibri-A/utilities/amon/tab_test.inc create mode 100644 kernel/branches/Kolibri-A/utilities/amon/tests.inc diff --git a/kernel/branches/Kolibri-A/utilities/amon/HISTORY.txt b/kernel/branches/Kolibri-A/utilities/amon/HISTORY.txt new file mode 100644 index 0000000000..6ec6e0cdb3 --- /dev/null +++ b/kernel/branches/Kolibri-A/utilities/amon/HISTORY.txt @@ -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 - начало + +Эй! У меня нет много времени. \ No newline at end of file diff --git a/kernel/branches/Kolibri-A/utilities/amon/HWM_HUDSON.INC b/kernel/branches/Kolibri-A/utilities/amon/HWM_HUDSON.INC new file mode 100644 index 0000000000..6368d71dee --- /dev/null +++ b/kernel/branches/Kolibri-A/utilities/amon/HWM_HUDSON.INC @@ -0,0 +1,300 @@ +; +; Ghost Monitor - гвЁ«Ёв  (бваҐбб) вҐбвЁа®ў ­Ёп Ё ¬®­Ёв®аЁ­Ј  бЁб⥬л +; Copyright (C) 2005, 2006, 2007 Mihailov Ilia (ghost.nsk@mail.ru) +; All Right Reserved + +; +; ЃЁЎ«Ё®вҐЄ  ¤«п зЁЇ®ў 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: +; Џа®ўҐаЄ  ­ «ЁзЁп Ё Ё­ЁжЁ «Ё§ жЁп +; 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 + + + ; Џа®ўҐаЄ  ⥬ЇҐа вгал, ¤ взЁЄЁ б 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 + + + diff --git a/kernel/branches/Kolibri-A/utilities/amon/SMBus.inc b/kernel/branches/Kolibri-A/utilities/amon/SMBus.inc new file mode 100644 index 0000000000..f4687d8592 --- /dev/null +++ b/kernel/branches/Kolibri-A/utilities/amon/SMBus.inc @@ -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 +;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= diff --git a/kernel/branches/Kolibri-A/utilities/amon/amon b/kernel/branches/Kolibri-A/utilities/amon/amon new file mode 100644 index 0000000000000000000000000000000000000000..9ef2b9228af459de16030bb7e88a1c65bbffe356 GIT binary patch literal 5488 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 literal 0 HcmV?d00001 diff --git a/kernel/branches/Kolibri-A/utilities/amon/amon.asm b/kernel/branches/Kolibri-A/utilities/amon/amon.asm new file mode 100644 index 0000000000..364a8b990a --- /dev/null +++ b/kernel/branches/Kolibri-A/utilities/amon/amon.asm @@ -0,0 +1,564 @@ +; +; Ghost Monitor - гвЁ«Ёв  (бваҐбб) вҐбвЁа®ў ­Ёп Ё ¬®­Ёв®аЁ­Ј  бЁб⥬л +; Copyright (C) 2005, 2006, 2007 Mihailov Ilia (ghost.nsk@mail.ru) +; AMD fusion version 2012 +; All Right Reserved +; +; ‚Ћ‡ЊЋ†ЌЂ ЏЋђ—Ђ ЋЃЋђ“„Ћ‚ЂЌ€џ! +; €‘ЏЋ‹њ‡“‰’… ЌЂ ‘‚Ћ‰ ‘’ђЂ• € ђ€‘Љ! +; +; ‡ ¬ҐвЄЁ : +; „®ЇЁб вм § ЇгбЄ вҐбв®ў (rtst) (­Ґв ॠЄжЁЁ ­  ®иЁЎЄг § ЇгбЄ ) +; ЏҐаҐ¤Ґ« вм ®Ў­®ў«Ґ­ЁҐ Ја дЁЄ  (ᤥ« вм ®в¤Ґ«м­л¬ Їа®жҐбᮬ) +; „®Ў ўЁвм ॠЄжЁо ­  Ї а ¬Ґвал ¤ взЁЄ®ў +; + +; ‚­Ґи­ЁҐ д ©«л : +; 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 ; <-- ®иЁЎЄ  § ЇгбЄ  вҐбв , Џ…ђ…Џ€‘Ђ’њ + 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 + + ; ЏЁиЁ¬ ­ §ў ­Ёп Ї а ¬Ґва®ў (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 + + ; ђЁб㥬 Є­®ЇЄЁ ᬥ­л жўҐв  + 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 + + ; ЏЁиЁ¬ § Јаг§Єг Їа®жҐбб®а  + 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 + + ; ЏЁиЁ¬ ЁбЇ®«м§гҐ¬го Ї ¬пвм + 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 + ; ЌҐв ¤ взЁЄ®ў - ЇЁиҐ¬ 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 + + ;--------------------------- + ; Ќ ЇагЈЁ + 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 + ; ЏЁиЁ¬ ­ §ў ­Ёп ўЄ« ¤®Є + 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 ; Ќ®¬Ґа  ЄвЁў­®© ўЄ« ¤ЄЁ +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 diff --git a/kernel/branches/Kolibri-A/utilities/amon/config.inc b/kernel/branches/Kolibri-A/utilities/amon/config.inc new file mode 100644 index 0000000000..1d554bf593 --- /dev/null +++ b/kernel/branches/Kolibri-A/utilities/amon/config.inc @@ -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 + diff --git a/kernel/branches/Kolibri-A/utilities/amon/diag.inc b/kernel/branches/Kolibri-A/utilities/amon/diag.inc new file mode 100644 index 0000000000..16e41c4410 --- /dev/null +++ b/kernel/branches/Kolibri-A/utilities/amon/diag.inc @@ -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 diff --git a/kernel/branches/Kolibri-A/utilities/amon/hwm.inc b/kernel/branches/Kolibri-A/utilities/amon/hwm.inc new file mode 100644 index 0000000000..fd20847d5b --- /dev/null +++ b/kernel/branches/Kolibri-A/utilities/amon/hwm.inc @@ -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: +; Џа®ўҐаЄ  ­ «ЁзЁп Ё Ё­ЁжЁ «Ё§ жЁп + 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: +; Ќ е®¤Ё¬ ­г¦­л© зЁЇ +; 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 diff --git a/kernel/branches/Kolibri-A/utilities/amon/macros.inc b/kernel/branches/Kolibri-A/utilities/amon/macros.inc new file mode 100644 index 0000000000..96accce350 --- /dev/null +++ b/kernel/branches/Kolibri-A/utilities/amon/macros.inc @@ -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 + +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 \ No newline at end of file diff --git a/kernel/branches/Kolibri-A/utilities/amon/readme.txt b/kernel/branches/Kolibri-A/utilities/amon/readme.txt new file mode 100644 index 0000000000..8dd07082eb --- /dev/null +++ b/kernel/branches/Kolibri-A/utilities/amon/readme.txt @@ -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", и автор не несет ответственности за возможный ущерб, причиненный +программой. \ No newline at end of file diff --git a/kernel/branches/Kolibri-A/utilities/amon/system.inc b/kernel/branches/Kolibri-A/utilities/amon/system.inc new file mode 100644 index 0000000000..c0369c1b52 --- /dev/null +++ b/kernel/branches/Kolibri-A/utilities/amon/system.inc @@ -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 diff --git a/kernel/branches/Kolibri-A/utilities/amon/tab_about.inc b/kernel/branches/Kolibri-A/utilities/amon/tab_about.inc new file mode 100644 index 0000000000..9134891c6c --- /dev/null +++ b/kernel/branches/Kolibri-A/utilities/amon/tab_about.inc @@ -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 ***' diff --git a/kernel/branches/Kolibri-A/utilities/amon/tab_conf.inc b/kernel/branches/Kolibri-A/utilities/amon/tab_conf.inc new file mode 100644 index 0000000000..03e31f5bb2 --- /dev/null +++ b/kernel/branches/Kolibri-A/utilities/amon/tab_conf.inc @@ -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 \ No newline at end of file diff --git a/kernel/branches/Kolibri-A/utilities/amon/tab_info.inc b/kernel/branches/Kolibri-A/utilities/amon/tab_info.inc new file mode 100644 index 0000000000..efaddbca4f --- /dev/null +++ b/kernel/branches/Kolibri-A/utilities/amon/tab_info.inc @@ -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)' diff --git a/kernel/branches/Kolibri-A/utilities/amon/tab_test.inc b/kernel/branches/Kolibri-A/utilities/amon/tab_test.inc new file mode 100644 index 0000000000..b5d43a8272 --- /dev/null +++ b/kernel/branches/Kolibri-A/utilities/amon/tab_test.inc @@ -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 \ No newline at end of file diff --git a/kernel/branches/Kolibri-A/utilities/amon/tests.inc b/kernel/branches/Kolibri-A/utilities/amon/tests.inc new file mode 100644 index 0000000000..2bc489fb16 --- /dev/null +++ b/kernel/branches/Kolibri-A/utilities/amon/tests.inc @@ -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 + \ No newline at end of file