Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 6483 → Rev 6484

/programs/system/cpuid/trunk/CPUID
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/system/cpuid/trunk/CPUID.ASM
432,18 → 432,25
shr ecx, 16
mov [L2],ecx
 
movzx edx, dl ;not sure
mov [linel3], eax
;CACHE3: edx provides l3
 
mov eax, edx
mov eax, 80000006h
cpuid
 
and eax,00FF0000h
shr eax, 16
mov [wayl3], eax
movzx eax, cl ;mov cl to eax, zero extend; cl is counter reg for loop,shifts
mov dword[linel3], eax
 
shr edx, 24
mov [L3], edx
push edx
shr edx, 12+1
and edx, 0x7
mov eax, 1
shl eax, cl
mov dword [wayl3], eax
pop edx
 
shr edx, 18
mov [L3],ecx
 
cmp [f], $5
jz .fiv
cmp [f], $6
1164,6 → 1171,7
jz I26
cmp [em],$1C ;Pineview/Silverthorne
jz I1C
jnz no_known
 
Inewunknown:
jmp MMXtest
3904,6 → 3912,8
db 'Pineview',0
P1Clen:
 
no_known:
db 'SORRY, CODENAME IS NOT SUPPORTED YET '
 
;---------AMD
 
/programs/system/cpuid/trunk/FASM.EXE
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/system/cpuid/trunk/HISTORY.TXT
37,6 → 37,37
; improve support of Vortex86
;******************************************************************************
;HISTORY:
;2.5: CPUID 15/08/2016 (not finished)
;Authors:
; Manasi Thakkar aka mat1854
;Features:
; (+) added saving of features from fork version 2.26pre in log
; (+) fixed redraw bug, which appears if user execute save dialog
; Known issues: Sempron marked as AthlonXP
; second window doesn't closed when you close main window
; incorrect cache detection for several models of newest Intel CPU, because they designed for another cache detection approach
;-----------------------------------------------------------------------------
;2.4: CPUID 09/08/2016
;Authors:
; Artem Azhbakov aka marting422
; Nikita Moiseev aka Powerdogesss
; Manasi Thakkar aka mat1854
; Sergey Kuzmin aka Wildwest <kuzmin_serg@list.ru>
;Features:
; (+) added detection of Intel Arrandale
; (+) save log in text file;
; (+) use Extended models to turn off multiplier detection for CPU's, which aren't supported;
; (+) show multiplier numbers, if we detect something and show n/a, if we don't;
; (+) merging of different versions from GSOC students;
; (+) added detection of codenames for new Intel CPUs: IvyBridge, SandyBridge-E, Gulftown, Westmere-EX, Clarksfield, Bloomfield,Nehalem-EX, Yorkfield, Dunnington, Clovertown, Merom Conroe, Cedar Mill, Nocona Irwindale, NoconaIrwindale, Dothan, Cedarview, Lincroft and Pineview.
; (+) added detection of AMD k-10 series: AMD Athlon 7750 Black Edition, Opteron 2300-series, Opteron 8300-series, Phenom X4, Phenom X3, Athlon X2, Sempron, Opteron (Shanghai) 2387, Opteron (Magny-Cours), Opteron (Shanghai) 8300 series, Turion II.
; (+) fixed duplication in txt file
; (+) save Codename in text file;
; (+) fixed abstact examples in visualisation block for RSA encoding performance test
;Known issues: Sempron marked as AthlonXP
; second window doesn't closed when you close main window
; incorrect cache detection for several models of newest Intel CPU, because they designed for another cache detection approach
;-----------------------------------------------------------------------------
;2.3: CPUID 12/10/2014 (not finished)
;Authors: Sergey Kuzmin aka Wildwest <kuzmin_serg@list.ru>
; Pavel Rymovskiy aka Heavyiron <Heavyiron@pisem.net>
/programs/system/cpuid/trunk/config.inc
0,0 → 1,5
 
 
__CPU_type fix p5
 
/programs/system/cpuid/trunk/gif2img.inc
0,0 → 1,301
COLOR_ORDER equ MENUETOS
gif_hash_offset = gif_hash_area
 
macro gif2img gifsrc,imgsrc
{
local hasharea, ReadGIF, nextblock,_null
local globalColor, img_count, cur_info, img_start
local codesize, compsize, bit_count, CC, EOI, Palette
local block_ofs, table_ptr, gifmacend
local no_gc, block_skip, no_comm, noextblock, uselocal
local setPal, filltable, reinit, cycle, zadd, noinc
local notintable, er, zend, nxt, continue, ex, Gif_skipmap
local Gif_get_sym, shift, nextbl, noblock, loop1, exx
local Gif_output, next, loop2
 
_null fix 0x1000 ; 0x1000
 
if ~gifsrc eq esi
mov esi,gifsrc
end if
if ~imgsrc eq edi
mov edi,imgsrc
end if
 
if defined gif_hash_offset
mov eax,gif_hash_offset
else
mov eax,hasharea
end if
 
call ReadGIF
jmp gifmacend
 
if defined gif_hash_offset
else
hasharea:
times 4096 dd 0 ;4096
end if
 
ReadGIF:
push esi edi
mov [table_ptr],eax
mov [cur_info],edi
xor eax,eax
mov [globalColor],eax
mov [img_count],eax
inc eax
cmp dword[esi],'GIF8'
jne er ; signature
mov ecx,[esi+0xa]
inc eax
add esi,0xd
mov edi,esi
bt ecx,7
jnc nextblock
mov [globalColor],esi
call Gif_skipmap
nextblock:
cmp byte[edi],0x21
jne noextblock
inc edi
cmp byte[edi],0xf9 ; Graphic Control Ext
jne no_gc
add edi,7
jmp nextblock
no_gc:
cmp byte[edi],0xfe ; Comment Ext
jne no_comm
inc edi
block_skip:
movzx eax,byte[edi]
lea edi,[edi+eax+1]
cmp byte[edi],0
jnz block_skip
inc edi
jmp nextblock
no_comm:
cmp byte[edi],0xff ; Application Ext
jne nextblock
add edi,13
jmp block_skip
noextblock:
cmp byte[edi],0x2c ; image beginning
jne er
inc [img_count]
inc edi
mov esi,[cur_info]
xchg esi,edi
; movsd
; movsd
 
mov bp,word[esi+4]
movzx ebx,bp
mov [edi],ebx
 
mov bp,word[esi+6]
movzx ebx,bp
mov [edi+4],ebx
 
add edi,8
add esi,8
 
push edi
movzx ecx,word[esi]
inc esi
bt ecx,7
jc uselocal
push [globalColor]
mov edi,esi
jmp setPal
uselocal:
call Gif_skipmap
push esi
setPal:
movzx ecx,byte[edi]
inc ecx
mov [codesize],ecx
dec ecx
pop [Palette]
lea esi,[edi+1]
mov edi,[table_ptr]
xor eax,eax
cld
lodsb ; eax - block_count
add eax,esi
mov [block_ofs],eax
mov [bit_count],8
mov eax,1
shl eax,cl
mov [CC],eax
inc eax
mov [EOI],eax
lea ecx,[eax-1]
mov eax, _null shl 16
filltable:
stosd
inc eax
loop filltable
pop edi
mov [img_start],edi
reinit:
mov edx,[EOI]
inc edx
push [codesize]
pop [compsize]
call Gif_get_sym
cmp eax,[CC]
je reinit
call Gif_output
cycle:
movzx ebx,ax
call Gif_get_sym
cmp eax,edx
jae notintable
cmp eax,[CC]
je reinit
cmp eax,[EOI]
je zend
call Gif_output
zadd:
push eax
mov eax,[table_ptr]
mov [eax+edx*4],ebx
pop eax
cmp edx,0xFFF
jae cycle
inc edx
bsr ebx,edx
cmp ebx,[compsize]
jne noinc
inc [compsize]
noinc:
jmp cycle
notintable:
push eax
mov eax,ebx
call Gif_output
push ebx
movzx eax,bx
call Gif_output
pop ebx eax
jmp zadd
er:
pop edi
jmp ex
zend:
; mov eax,[.cur_info] ; skip offset to next frame
; mov [eax],edi
mov [cur_info],edi
add esi,2
xchg esi,edi
nxt:
cmp byte[edi],0
jnz continue
inc edi
jmp nxt
continue:
; cmp byte[edi],0x3b ;read next frame
; jne nextblock
xor eax,eax
stosd
mov ecx,[img_count]
ex:
pop edi esi
ret
 
Gif_skipmap:
; in: ecx - image descriptor, esi - pointer to colormap
; out: edi - pointer to area after colormap
 
and ecx,111b
inc ecx ; color map size
mov ebx,1
shl ebx,cl
lea ebx,[ebx*2+ebx]
lea edi,[esi+ebx]
ret
 
Gif_get_sym:
mov ecx,[compsize]
push ecx
xor eax,eax
shift:
ror byte[esi],1
rcr eax,1
dec [bit_count]
jnz loop1
inc esi
cmp esi,[block_ofs]
jb noblock
push eax
xor eax,eax
lodsb
test eax,eax
jnz nextbl
mov eax,[EOI]
sub esi,2
add esp,8
jmp exx
nextbl:
add eax,esi
mov [block_ofs],eax
pop eax
noblock:
mov [bit_count],8
loop1:
loop shift
pop ecx
rol eax,cl
exx:
xor ecx,ecx
ret
 
Gif_output:
push esi eax edx
mov edx,[table_ptr]
next:
push word[edx+eax*4]
mov ax,word[edx+eax*4+2]
inc ecx
cmp ax,_null
jnz next
shl ebx,16
mov bx,[esp]
loop2:
pop ax
 
lea esi,[eax+eax*2]
add esi,[Palette]
 
if COLOR_ORDER eq MENUETOS
mov esi,[esi]
bswap esi
shr esi,8
mov [edi],esi
add edi,3
else
movsw
movsb
end if
 
loop loop2
pop edx eax esi
ret
 
globalColor dd 1
img_count dd 1
cur_info dd 1 ; image table pointer
img_start dd 1
codesize dd 1
compsize dd 1
bit_count dd 1
CC dd 1
EOI dd 1
Palette dd 1
block_ofs dd 1
table_ptr dd 1
 
gifmacend:
}
 
/programs/system/cpuid/trunk/knopka2.bmp
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/system/cpuid/trunk/knopka2.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/system/cpuid/trunk/lang.inc
0,0 → 1,0
lang fix en
/programs/system/cpuid/trunk/load_lib.mac
0,0 → 1,617
;13.03.2013 - use @notify
;08.06.2010 - new macros @use_library_mem
;08.05.2009 - bugfix
;14.04.2009 - a macros for code load library the box_lib.obj from '/sys/lib/' or current dirrectory.
; The macros for load any library/libraries:
; Copyright (c) 2009, <Lrz>
; All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions are met:
; * Redistributions of source code must retain the above copyright
; notice, this list of conditions and the following disclaimer.
; * Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in the
; documentation and/or other materials provided with the distribution.
; * Neither the name of the <organization> nor the
; names of its contributors may be used to endorse or promote products
; derived from this software without specific prior written permission.
;
; THIS SOFTWARE IS PROVIDED BY Alexey Teplov aka <Lrz> ''AS IS'' AND ANY
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
; DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;*****************************************************************************
; This macros based on source code:
; <Lrz> - Alexey Teplov / €«¥ªá¥© ’¥¯«®¢
; Mario79, Mario - Marat Zakiyanov / Œ à â ‡ ª¨ï­®¢
; Diamondz - Evgeny Grechnikov / …¢£¥­¨© ƒà¥ç­¨ª®¢
;------------------------
; DESCRIPTION
; Macro load_library
; Logick of work.
; A first time we must to check system path, where I belive find a system library. System path is "/sys/lib/".
; If I cannot found my library, i must to check second way. Second way is current dirrectory.
; If we cannot load library, we must show the error message:
; "I'm sorry,the programm cannot found system library box_lib.obj."
; "The find was make on 2 ways: /sys/lib/ and current dirrectory."
;
;
;---------------------------------------------------------------------
; Macro sys_load_library
; A first time we must to check own path in current dirrectory the program, where I belive find a system library.
; If I cannot found my library, i must to check second way. Second way is system path a "/sys/lib/".
; If we cannot load library, we must show the error message:
; "I'm sorry,the programm cannot found system library box_lib.obj."
; "The find was make on 2 ways: /sys/lib/ and current dirrectory."
;
;---------------------------------------------------------------------
; How can I use it?
;---------------------------------------------------------------------
;-Example using single load library
;-universal load library/librarys
;load_library library_name__, cur_dir_path__, library_path__, system_path__, \
;err_message_found_lib__, head_f_l__, myimport, err_message_import__, head_f_i__
;-if return code =-1 then exit, else normally work
; cmp eax,-1
; jz exit
;- Well, if you get
;
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;DATA ¤ ­­ë¥
;‚ᥣ¤  ᮡ«î¤ âì ¯®á«¥¤®¢ â¥«ì­®áâì ¢ ¨¬¥­¨.
;system_path__ db '/sys/lib/'
;library_name__ db 'box_lib.obj',0
; …᫨ ¥áâì ¦¥« ­¨¥ ࠧꥤ¨­¨âì, â® ­ã¦­® ¨á¯®«ì§®¢ âì á«¥¤ãîé¨î ª®­áâàãªæ¨î
;system_path__ db '/sys/lib/box_lib.obj',0
;... «î¡ ï ¯®á«¥¤®¢ â¥«ì­®áâì ¤àã£¨å ª®¬ ­¤ ¨ ®¯à¥¤¥«¥­¨©.
;library_name__ db 'box_lib.obj',0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
;err_message_found_lib__ db 'Sorry I cannot found library box_lib.obj',0
;head_f_i__:
;head_f_l__ db 'System error',0
;err_message_import__ db 'Error on load import library box_lib.obj',0
 
;myimport:
;
;edit_box_draw dd aEdit_box_draw
;edit_box_key dd aEdit_box_key
;edit_box_mouse dd aEdit_box_mouse
;version_ed dd aVersion_ed
;
;check_box_draw dd aCheck_box_draw
;check_box_mouse dd aCheck_box_mouse
;version_ch dd aVersion_ch
;
;option_box_draw dd aOption_box_draw
;option_box_mouse dd aOption_box_mouse
;version_op dd aVersion_op
 
; dd 0
; dd 0
;
;aEdit_box_draw db 'edit_box',0
;aEdit_box_key db 'edit_box_key',0
;aEdit_box_mouse db 'edit_box_mouse',0
;aVersion_ed db 'version_ed',0
 
;aCheck_box_draw db 'check_box_draw',0
;aCheck_box_mouse db 'check_box_mouse',0
;aVersion_ch db 'version_ch',0
 
;aOption_box_draw db 'option_box_draw',0
;aOption_box_mouse db 'option_box_mouse',0
;aVersion_op db 'version_op',0
 
;---------------------------------------------------------------------
macro @use_library
{
local lp1
local lp2
local lp3
local lp4
local lp5
local lp6
local file_name
 
library_fun_memory_alloc equ 0 ;­¥ ¨á¯®«ì§®¢ âì ¢ ¬ ªà®á å ¯à®¢¥àªã ­  ä㭪樨 'lib_init'
 
align 4
arrea_xx dd 0
file_name db '/rd/1/@notify',0
 
align 4
run_notify_struct:
.Function dd 7
.Position dd 0
.Flags dd ?
.Count dd 0
.Buffer dd 0
db 0
.FileName dd file_name
;---------------------------------------------------------------------
 
@library_name equ dword [esp+16]
@cur_dir_path equ dword [esp+12]
@library_path equ dword [esp+8]
@point_dir_name equ dword [esp+4]
 
align 4
@copy_path:
mov esi,@cur_dir_path
mov edi,@library_path
xor eax,eax
cld
align 4
.lp1:
lodsb
stosb
test eax,eax
jnz .lp1
mov esi,edi
dec esi ;¯¥à¥å®¤ ­  ᨬ¢®« ª®­æ  áâப¨ @cur_dir_path
std
align 4
.lp2:
lodsb
cmp al,'/'
jnz .lp2
mov edi,esi
add edi,2
cld
mov esi,@point_dir_name
test esi,esi
jz .str_lp4
 
;¯à®¢¥àª  ®â­®á¨â¥«ì­ëå ¯ã⥩ c ¤¢ã¬ï â®çª ¬¨ '../'
cmp word[esi],'..'
jne .lp3
dec edi ;¤«ï ¯¥à¥å®¤  ­  '/'
.lp6:
add esi,3 ;¯à®¯ã᪠¥¬ ®¤­® ¯®¤­ï⨥ '../'
.lp5:
dec edi ;¨¤¥¬ ¯® ¯ ¯ª ¬
cmp byte[edi],'/'
jnz .lp5
cmp word[esi],'..'
je .lp6
inc edi ;¤«ï ¯¥à¥å®¤  ­  '/'
 
;ª®¯¨à®¢ ­¨¥ ®â­®á¨â¥«ì­®£® ¯ãâ¨
align 4
.lp3:
lodsb
stosb
test eax,eax
jnz .lp3
dec edi
.str_lp4:
mov esi,@library_name
align 4
.lp4:
lodsb
stosb
test eax,eax
jnz .lp4
;---------------------------------------------------------------------
ret
}
 
 
 
macro @use_library_mem mem_alloc,mem_free,mem_realloc,dll_load
{
@use_library
library_fun_memory_alloc equ mem_alloc
library_fun_memory_free equ mem_free
library_fun_memory_realloc equ mem_realloc
library_fun_dll_load equ dll_load
}
 
 
macro sys_load_library library_name__, cur_dir_path__, library_path__, system_path__, err_message_found_lib__, head_f_l__, myimport, err_message_import__, head_f_i__,point_dir_name__
{
local end_steep
local exit
;---------------------------------------------------------------------
; loading Box_Lib library
 
mcall 68,19,system_path__ ; load of sys directory
test eax,eax
jnz end_steep
 
if point_dir_name__ eq
copy_path library_name__, cur_dir_path__, library_path__,0x0
else
copy_path library_name__, cur_dir_path__, library_path__,point_dir_name__ ;the macros making way /current pach a program/+ name system library
end if
mcall 68,19,library_path__ ; load of alternative
test eax,eax
jnz end_steep
show_error_window err_message_found_lib__, head_f_l__ ;show error message /create window
jmp exit
 
 
align 4
end_steep:
 
import_boxlib myimport, err_message_import__, head_f_i__ ;import
exit:
test eax,eax
jz @f
 
notify_window_run [arrea_xx] ; ᮧ¤ ¥¬ ®ª­® @notify
or eax,-1
@@:
 
;---------------------------------------------------------------------
}
 
 
macro load_library library_name__, cur_dir_path__, library_path__, system_path__, err_message_found_lib__, head_f_l__, myimport, err_message_import__, head_f_i__,point_dir_name__
{
local end_steep
local exit
;---------------------------------------------------------------------
; loading Box_Lib library
 
if point_dir_name__ eq
copy_path library_name__, cur_dir_path__, library_path__,0x0
else
copy_path library_name__, cur_dir_path__, library_path__,point_dir_name__ ;the macros making way /current pach a program/+ name system library
end if
 
mcall 68,19,library_path__ ; load of alternative
test eax,eax
jnz end_steep
mcall 68,19,system_path__ ; load of sys directory
test eax,eax
jnz end_steep
 
show_error_window err_message_found_lib__, head_f_l__ ;show error message /create window
jmp exit
 
align 4
end_steep:
 
import_boxlib myimport, err_message_import__, head_f_i__ ;import
exit:
test eax,eax
jz @f
 
notify_window_run [arrea_xx] ; ᮧ¤ ¥¬ ®ª­® @notify
or eax,-1
@@:
;---------------------------------------------------------------------
}
macro sys_load_libraries _start,_end
{
local exit_lp2
local lp2
local lp
local end_steep
local next
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
library_name__ equ [ebp]
cur_dir_path__ equ [ebp+4]
library_path__ equ [ebp+8]
system_path__ equ [ebp+12]
err_message_found_lib__ equ [ebp+16]
head_f_l__ equ [ebp+20]
my_import equ [ebp+24]
err_message_import__ equ [ebp+28]
head_f_i__ equ [ebp+32]
point_dir_name__ equ [ebp+36]
adr_load_lib equ dword [ebp+40]
status_lib equ dword [ebp+44]
 
mov ebp,_start
mov ecx,((_end-_start)/ll_struc_size)
 
align 4
lp: push ecx
mcall 68,19,system_path__ ; load of sys directory
test eax,eax
jnz end_steep
 
copy_path library_name__, cur_dir_path__, library_path__,point_dir_name__ ;the macros making way /current pach a program/+ name system library
mcall 68,19,library_path__ ; load of alternative
test eax,eax
jnz end_steep
 
or status_lib,0x1 ; status of code - enable error - not found library
 
show_error_window err_message_found_lib__, head_f_l__, ;show error message /create window
jmp next
 
align 4
end_steep:
mov adr_load_lib,eax ;save adr lib in memory
import_boxlib my_import, err_message_import__, head_f_i__ ;import
 
test eax,eax
jz next
 
or status_lib,0x2 ; status of code - enable error - import error
 
next:
pop ecx
add ebp,ll_struc_size
dec ecx
jnz lp
 
;----------------------------------
mov ebp,_start
mov ecx,((_end-_start)/ll_struc_size)
 
align 4
lp2:
mov eax,status_lib
test eax,eax
jz @f
 
notify_window_run [arrea_xx] ; ᮧ¤ ¥¬ ®ª­® @notify
or eax,-1
jmp exit_lp2
 
@@:
add ebp,ll_struc_size
dec ecx
jnz lp2
exit_lp2:
}
 
macro load_libraries _start,_end
{
local lp2
local exit_lp2
local lp
local end_steep
local next
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
library_name__ equ [ebp]
cur_dir_path__ equ [ebp+4]
library_path__ equ [ebp+8]
system_path__ equ [ebp+12]
err_message_found_lib__ equ [ebp+16]
head_f_l__ equ [ebp+20]
my_import equ [ebp+24]
err_message_import__ equ [ebp+28]
head_f_i__ equ [ebp+32]
point_dir_name__ equ [ebp+36]
adr_load_lib equ dword [ebp+40]
status_lib equ dword [ebp+44]
 
mov ebp,_start
mov ecx,((_end-_start)/ll_struc_size)
 
align 4
lp: push ecx
 
copy_path library_name__, cur_dir_path__, library_path__,point_dir_name__ ;the macros making way /current pach a program/+ name system library
 
mcall 68,19,library_path__ ; load of alternative
test eax,eax
jnz end_steep
mcall 68,19,system_path__ ; load of sys directory
test eax,eax
jnz end_steep
 
or status_lib,0x1 ; status of code - enable error - not found library
 
show_error_window err_message_found_lib__, head_f_l__ ;show error message /create window
jmp next
 
align 4
end_steep:
mov adr_load_lib,eax ;save adr lib in memory
 
import_boxlib my_import, err_message_import__, head_f_i__ ;import
 
test eax,eax
jz next
 
or status_lib,0x2 ; status of code - enable error - import error
 
next:
pop ecx
add ebp,ll_struc_size
dec ecx
jnz lp
 
;-----------------------------------------------
mov ebp,_start
mov ecx,((_end-_start)/ll_struc_size)
 
align 4
lp2:
mov eax,status_lib
test eax,eax
jz @f
 
notify_window_run [arrea_xx] ; ᮧ¤ ¥¬ ®ª­® @notify
or eax,-1
jmp exit_lp2
 
@@:
add ebp,ll_struc_size
dec ecx
jnz lp2
exit_lp2:
 
}
 
 
macro copy_path lib_name,dir_path,lib_path,point_dir_name
{
pushad ;save all registers
push dword lib_name
push dword dir_path
push dword lib_path
push dword point_dir_name
call @copy_path
 
add esp,16
;notify_window_run lib_path ;unblok for test load path
popad ;restore all registers
}
 
; £®â®¢¨¬ ⥪áâ ¤«ï ¯®ª §  ç¥à¥§ @notify:
; 1) ¢ë¤¥«ï¥¬ ¯ ¬ïâì ¢ [arrea_xx]
; 2) ª®¯¨à㥬 err_message ¨ head ¢ [arrea_xx]
macro show_error_window err_message, head
{
local lp0
local lp1
 
pushad
mcall 68,11
mcall 68,12,4096
push eax
pop dword [arrea_xx]
 
mov edi,eax
mov esi,dword head
cld
align 4
lp0:
movsb
cmp byte[esi],0
jne lp0
mov word[edi],'. '
add edi,2
mov esi,dword err_message
align 4
lp1:
movsb
cmp byte[esi],0
jne lp1
mov byte[edi],0
popad
or eax,-1 ;ã¢ë
}
 
; ¢ª«îç ¥¬ ¯®ª § á®®¡é¥­¨ï ç¥à¥§ @notify:
macro notify_window_run message
{
push eax ebx
mov eax,message ;¯ à ¬¥âàë ¤«ï ª®¬ ­¤­®© áâப¨
mov [run_notify_struct.Flags], eax
mov eax,70 ;run @notify
mov ebx,run_notify_struct
int 0x40
pop ebx eax
}
 
 
;¢å®¤­ë¥ ¯ à ¬¥âàë:
;eax -  ¤à¥á ¡¨¡«¨®â¥ª¨ ¢ ¯ ¬ïâ¨
;myimport - ¨¬¯®àâ¨àã¥¬ë¥ ä㭪樨
macro import_boxlib myimport, err_message_import__, head_f_i__
{
local import_loop
local import_find
local lp
local import_find_next
local import_found
local import_done
local exit
local e.exit
local import_not_found
; initialize import
mov edx, eax
mov esi,myimport
import_loop:
lodsd ;mov eax,dword[esi] ;add esi,4 ;¯®«ãç ¥¬ ¢ eax 㪠§ â¥«ì ­  ¨¬ï ¨¬¯®àâ¨à㥬®© ä㭪樨
test eax, eax
jz import_done ;¥á«¨ 㪠§ â¥«ì ­  ¨¬ï ä㭪樨 = 0 (¢ ¯®«ì§®¢ â¥«ì᪮© ¯à®£à ¬¬¥)
push edx ;á®å࠭塞 ­ ç «® ¡¨¡«¨®â¥ç­ëå 㪠§ â¥«¥© ­  ä㭪樨
import_find:
mov ebx, [ds:edx]
test ebx, ebx
jz import_not_found ;¥á«¨ 㪠§ â¥«ì ­  ¨¬ï ä㭪樨 = 0 (¢ ¡¨¡«¨®â¥ª¥)
push eax ;eax - 㪠§ â¥«ì ­  ¨¬ï íªá¯®àâ¨à㥬®© ä㭪樨 (¢ ¯®«ì§®¢ â¥«ì᪮© ¯à®£à ¬¬¥)
lp:
mov cl, [ds:eax]
cmp cl, [ds:ebx] ;áà ¢­¨¢ ¥¬ ¨¬¥­  ä㭪権 ¢ ¡¨¡«¨®â¥ª¥ ¨ ¢ ¯®«ì§®¢ â¥«ì᪮© ¯à®£à ¬¬¥
jnz import_find_next ;¥á«¨ ­ §¢ ­¨ï ­¥ ᮢ¯ «¨
test cl, cl
jz import_found ;¥á«¨ ­ §¢ ­¨ï ᮢ¯ «¨, ¨ 㦥 ª®­¥æ áâப¨ (cl=0)
inc eax
inc ebx
jmp lp
import_find_next:
pop eax
add edx, 8 ;8 = 4 ¡ ©â  㪠§ â¥«ì ­  ­ §¢ ­¨¥ ¨ 4 ¡ ©â  㪠§ â¥«ì ­  äã­ªæ¨î
jmp import_find
import_found:
pop ebx ;¢®áâ ­ ¢«¨¢ ¥¬ 㪠§ â¥«ì ­  ¨¬ï ä㭪樨 (ª®â®àë© ¡ë« ¢ eax) ¨ ®á¢®¡®¦¤ ¥¬ á⥪
mov eax, [ds:edx+4] ;eax = 㪠§ â¥«ì ­  äã­ªæ¨î (¢ ¡¨¡«¨®â¥ª¥)
mov [esi-4], eax ;ª®¯¨à㥬 㪠§ â¥«ì (­  äã­ªæ¨î) ¢ ¯à®£à ¬¬ã, -4 áâ ¢¨¬ ¯®â®¬ã çâ® esi ¡ë«® ᤢ¨­ãâ® ª®¬ ­¤®© lodsd
pop edx ;ãáâ ­ ¢«¨¢ ¥¬ edx ­  ­ ç «® ¡¨¡«¨®â¥ç­ëå ä㭪権
;--- ¯à®¢¥à塞 ᮢ¯ ¤ ¥â «¨ ¨¬ï íªá¯®àâ¨à®¢ ­­®© ä㭪樨 á 'lib_init'
if library_fun_memory_alloc eq 0
else
cmp dword[ebx],'lib_'
jne import_loop
cmp dword[ebx+4],'init'
jne import_loop
;--- ¥á«¨ ¨¬ï ä㭪樨 ᮢ¯ «® á 'lib_init' ¯®¯ ¤ ¥¬ á
;¯®¤ª«î祭¨¥ ä㭪権 ¤«ï à ¡®âë á ¯ ¬ïâìî
;push eax
;call dll.Init
pushad
mov esi,eax
mov eax,library_fun_memory_alloc
mov ebx,library_fun_memory_free
mov ecx,library_fun_memory_realloc
mov edx,library_fun_dll_load
call dword esi
popad
end if
jmp import_loop
import_not_found:
add esp,4
show_error_window err_message_import__, head_f_i__ ;show error message /create window
jmp e.exit
import_done:
xor eax,eax ;=0 ¢á¥ § £à㧨«®áì 㤠筮
e.exit:
;---------------------------------------------------------------------
}
ll_struc_size = 48;($-library_name__) ; constant size of struct
struc l_libs library_name__, cur_dir_path__, library_path__, system_path__, err_message_found_lib__, head_f_l__, my_import, err_message_import__, head_f_i__,point_dir_name; struct for loading libraries
{
.library_name__ dd library_name__ ; ¨¬ï § £à㦠¥¬®© ¡¨¡«¨®â¥ª¨
.cur_dir_path__ dd cur_dir_path__ ; 㪠§ â¥«ì ­  ¡ãä¥à ¢ ª®â®à®¬ ᮤ¥à¦¨âìáï ¯ãâì ®â ªã¤  ¡ë«  § ¯ã饭  ¯à®£à ¬¬ 
.library_path__ dd library_path__ ; 㪠§ â¥«ì ­  ¡ãä¥à ¢ ª®â®à®¬ ¡ã¤¥â á®ä®à¨¬¨à®¢ ­ ¯ãâì ª ¡¨¡«¨®â¥ª¨, ¥á«¨ ­ã¦­® ¢ëç¨á«¨âì ¯ãâì ¤® «¨¡ë á ¬¥áâ  § ¯ã᪠ ¯à®£à ¬¬ë, ®¡ëç­® ­ã¦­®, ¢ á«ãç ïå, ¥á«¨ «¨¡  à á¯®«®¦¥­  ¢ ⮩ ¦¥ ¯ ¯ª¥
.complete_path dd system_path__ ; ¯ãâì ª®â®àë© ç¥âª® ᮤ¥à¦¨â ¯ãâì
 
.err_message_found_lib__ dd err_message_found_lib__
.head_f_l__ dd head_f_l__
.my_import dd my_import
.err_message_import__ dd err_message_import__
.head_f_i__ dd head_f_i__
if point_dir_name eq
.point_dir_name__ dd 0x0
else
.point_dir_name__ dd point_dir_name ; ¨¬ï ¢«®¦¥­­®© ¤¨à४â®à¨¨ ¢ ªâ®à®© åà ­ïâìáï ¯®¤£à㦠¥¬ë¥ ¬®¤ã«¨.
end if
.adr_load_lib dd 0x0
.status_lib dd 0x0 ;status of load library
;
}
/programs/system/cpuid/trunk/logos.inc
22,3 → 22,5
knopka:
file 'knopka.gif' ;include gif file
 
knopka2:
file 'knopka2.gif' ;gif button Save in file
/programs/system/cpuid/trunk/macros.inc
0,0 → 1,532
 
 
@^ fix macro comment {
^@ fix }
; -------------------------
macro library [lname,fname]
{
forward
dd __#lname#_library_table__,__#lname#_library_name__
common
dd 0
forward
align 4
__#lname#_library_name__ db fname,0
}
macro import lname,[name,sname]
{
common
align 4
__#lname#_library_table__:
forward
if used name
name dd __#name#_import_name__
end if
common
dd 0
forward
if used name
align 4
__#name#_import_name__ db sname,0
end if
}
macro export [name,sname]
{
forward
dd __#name#_export_name__,name
common
dd 0
forward
align 4
__#name#_export_name__ db sname,0
}
; -------------------------
macro m2m dest,src {
push src
pop dest
}
macro iglobal {
IGlobals equ IGlobals,
macro __IGlobalBlock { }
macro uglobal {
UGlobals equ UGlobals,
macro __UGlobalBlock { }
endg fix } ; Use endg for ending iglobal and uglobal blocks.
macro IncludeIGlobals{
macro IGlobals dummy,[n] \{ __IGlobalBlock
purge __IGlobalBlock \}
match I, IGlobals \{ I \} }
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
iglobal
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:
IncludeIGlobals
}
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:
}
MEOS_APP_END fix meos_app_end
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
; 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 szZ name,[data] { ; same as sz, but with 0 at the end of line (ASCIIZ string) [dunkaist]
common
if used name
name db data,0
.size = $-name-1
end if
}
sz0 fix szZ
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
forward
virtual at 0
db data
s = $
end virtual
d#elsz s
if m < s
m = s
end if
db data
common
.size = $-name
.maxl = m
end if
}
macro lszc name,elsz,[lng,data] { ; from MFAR [mike.dld]
common
local s,m,c
m = 0
c = 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
c = c+1
end if
common
.size = $-name
.maxl = m
.count = c
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,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
include 'config.inc'
;__CPU_type equ p5
SYSENTER_VAR equ 0
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:
;diff16 `name,0,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) | (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
}
macro RGB [a] {
common
match (r=,g=,b),a \{
\dd ((r) shl 16) or ((g) shl 8) or (b)
\}
}
struc POINT _t,_dx,_dy {
.x _t _dx
.y _t _dy
}
; structure definition helper
include 'struct.inc'
struct RECT
left dd ?
top dd ?
right dd ?
bottom dd ?
ends
struct BOX
left dd ?
top dd ?
width dd ?
height dd ?
ends
; structures used in KolibriOS
struct process_information
cpu_usage dd ? ; +0
window_stack_position dw ? ; +4
window_stack_value dw ? ; +6
dw ? ; +8
process_name rb 12 ; +10
memory_start dd ? ; +22
used_memory dd ? ; +26
PID dd ? ; +30
box BOX ; +34
slot_state dw ? ; +50
dw ? ; +52
client_box BOX ; +54
wnd_state db ? ; +70
rb (1024-71)
ends
struct system_colors
frame dd ?
grab dd ?
grab_button dd ?
grab_button_text dd ?
grab_text dd ?
work dd ?
work_button dd ?
work_button_text dd ?
work_text dd ?
work_graph dd ?
ends
struct FILEDATE
Second db ?
Minute db ?
Hour db ?
db ?
Day db ?
Month db ?
Year dw ?
ends
struct FILEINFO
Attributes dd ?
IsUnicode db ?
db 3 dup(?)
DateCreate FILEDATE
DateAccess FILEDATE
DateModify FILEDATE
Size dq ?
ends
; 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
 
/programs/system/cpuid/trunk/struct.inc
0,0 → 1,184
 
 
; Macroinstructions for defining data structures
macro struct name
{ fields@struct equ name
match child parent, name \{ fields@struct equ child,fields@\#parent \}
sub@struct equ
struc db [val] \{ \common fields@struct equ fields@struct,.,db,<val> \}
struc dw [val] \{ \common fields@struct equ fields@struct,.,dw,<val> \}
struc du [val] \{ \common fields@struct equ fields@struct,.,du,<val> \}
struc dd [val] \{ \common fields@struct equ fields@struct,.,dd,<val> \}
struc dp [val] \{ \common fields@struct equ fields@struct,.,dp,<val> \}
struc dq [val] \{ \common fields@struct equ fields@struct,.,dq,<val> \}
struc dt [val] \{ \common fields@struct equ fields@struct,.,dt,<val> \}
struc rb count \{ fields@struct equ fields@struct,.,db,count dup (?) \}
struc rw count \{ fields@struct equ fields@struct,.,dw,count dup (?) \}
struc rd count \{ fields@struct equ fields@struct,.,dd,count dup (?) \}
struc rp count \{ fields@struct equ fields@struct,.,dp,count dup (?) \}
struc rq count \{ fields@struct equ fields@struct,.,dq,count dup (?) \}
struc rt count \{ fields@struct equ fields@struct,.,dt,count dup (?) \}
macro db [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,db,<val> \}
macro dw [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,dw,<val> \}
macro du [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,du,<val> \}
macro dd [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,dd,<val> \}
macro dp [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,dp,<val> \}
macro dq [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,dq,<val> \}
macro dt [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,dt,<val> \}
macro rb count \{ \local anonymous
fields@struct equ fields@struct,anonymous,db,count dup (?) \}
macro rw count \{ \local anonymous
fields@struct equ fields@struct,anonymous,dw,count dup (?) \}
macro rd count \{ \local anonymous
fields@struct equ fields@struct,anonymous,dd,count dup (?) \}
macro rp count \{ \local anonymous
fields@struct equ fields@struct,anonymous,dp,count dup (?) \}
macro rq count \{ \local anonymous
fields@struct equ fields@struct,anonymous,dq,count dup (?) \}
macro rt count \{ \local anonymous
fields@struct equ fields@struct,anonymous,dt,count dup (?) \}
macro union \{ fields@struct equ fields@struct,,union,<
sub@struct equ union \}
macro struct \{ fields@struct equ fields@struct,,substruct,<
sub@struct equ substruct \}
virtual at 0 }
macro ends
{ match , sub@struct \{ restruc db,dw,du,dd,dp,dq,dt
restruc rb,rw,rd,rp,rq,rt
purge db,dw,du,dd,dp,dq,dt
purge rb,rw,rd,rp,rq,rt
purge union,struct
match name=,fields,fields@struct \\{ fields@struct equ
make@struct name,fields
fields@\\#name equ fields \\}
end virtual \}
match any, sub@struct \{ fields@struct equ fields@struct> \}
restore sub@struct }
macro make@struct name,[field,type,def]
{ common
if $
display 'Error: definition of ',`name,' contains illegal instructions.',0Dh,0Ah
err
end if
local define
define equ name
forward
local sub
match , field \{ make@substruct type,name,sub def
define equ define,.,sub, \}
match any, field \{ define equ define,.#field,type,<def> \}
common
match fields, define \{ define@struct fields \} }
macro define@struct name,[field,type,def]
{ common
local list
list equ
forward
if ~ field eq .
name#field type def
sizeof.#name#field = $ - name#field
else
rb sizeof.#type
end if
local value
match any, list \{ list equ list, \}
list equ list <value>
common
sizeof.#name = $
restruc name
match values, list \{
struc name value \\{
match any, fields@struct \\\{ fields@struct equ fields@struct,.,name,<values> \\\}
match , fields@struct \\\{ label .
forward
match , value \\\\{ field type def \\\\}
match any, value \\\\{ field type value
if ~ field eq .
rb sizeof.#name#field - ($-field)
end if \\\\}
common \\\} \\} \} }
macro enable@substruct
{ macro make@substruct substruct,parent,name,[field,type,def]
\{ \common
\local define
define equ parent,name
\forward
\local sub
match , field \\{ match any, type \\\{ enable@substruct
make@substruct type,name,sub def
purge make@substruct
define equ define,.,sub, \\\} \\}
match any, field \\{ define equ define,.\#field,type,<def> \\}
\common
match fields, define \\{ define@\#substruct fields \\} \} }
enable@substruct
macro define@union parent,name,[field,type,def]
{ common
virtual at 0
forward
if ~ field eq .
virtual at 0
parent#field type def
sizeof.#parent#field = $ - parent#field
end virtual
if sizeof.#parent#field > $
rb sizeof.#parent#field - $
end if
else if sizeof.#type > $
rb sizeof.#type - $
end if
common
sizeof.#name = $
end virtual
struc name [value] \{ \common
label .\#name
last@union equ
forward
match any, last@union \\{ virtual at .\#name
field type def
end virtual \\}
match , last@union \\{ match , value \\\{ field type def \\\}
match any, value \\\{ field type value \\\} \\}
last@union equ field
common rb sizeof.#name - ($ - .\#name) \} }
macro define@substruct parent,name,[field,type,def]
{ common
virtual at 0
forward
if ~ field eq .
parent#field type def
sizeof.#parent#field = $ - parent#field
else
rb sizeof.#type
end if
local value
common
sizeof.#name = $
end virtual
struc name value \{
label .\#name
forward
match , value \\{ field type def \\}
match any, value \\{ field type value
if ~ field eq .
rb sizeof.#parent#field - ($-field)
end if \\}
common \} }