From f01c3da0f289f631061875780103f76074b6b981 Mon Sep 17 00:00:00 2001 From: hidnplayr Date: Tue, 27 Jul 2010 16:10:11 +0000 Subject: [PATCH] Made Netstat application run on P5 processors git-svn-id: svn://kolibrios.org@1528 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/branches/net/applications/macros.inc | 117 +++++++++++------- .../net/applications/netstat/netstat.asm | 36 +++--- 2 files changed, 85 insertions(+), 68 deletions(-) diff --git a/kernel/branches/net/applications/macros.inc b/kernel/branches/net/applications/macros.inc index d4689a5d31..99b09676fe 100644 --- a/kernel/branches/net/applications/macros.inc +++ b/kernel/branches/net/applications/macros.inc @@ -1,47 +1,47 @@ @^ 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 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 @@ -57,7 +57,7 @@ macro uglobal { UGlobals equ UGlobals, macro __UGlobalBlock { } -endg fix } ; Use endg for ending iglobal and uglobal blocks. +endg fix } ; Use endg for ending iglobal and uglobal blocks. macro IncludeIGlobals{ @@ -176,7 +176,7 @@ struc mls [sstring] db ssize db sstring common - db -1 ; mod + db -1 ; mod } @@ -280,7 +280,7 @@ macro __mov reg,a,b { ; mike.dld include 'config.inc' -;__CPU_type equ p5 +;__CPU_type equ p5 SYSENTER_VAR equ 0 macro mcall a,b,c,d,e,f { ; mike.dld, updated by Ghost for Fast System Calls @@ -481,7 +481,7 @@ struct process_information slot_state dw ? ; +50 dw ? ; +52 client_box BOX ; +54 - wnd_state db ? ; +70 + wnd_state db ? ; +70 rb (1024-71) ends @@ -518,6 +518,31 @@ struct FILEINFO Size dq ? ends + +if __CPU_type eq p5 ; CMOVcc isnt supported on the P5 + +cmove fix cmovz +macro cmovz reg1, reg2 { + +local .jumpaddr + + jnz .jumpaddr + mov reg1, reg2 + .jumpaddr: +} + +cmovne fix cmovnz +macro cmovnz reg1, reg2 { + +local .jumpaddr + + jz .jumpaddr + mov reg1, reg2 + .jumpaddr: +} + +end if + ; constants ; events @@ -540,4 +565,4 @@ EVM_EXIT = 1000b EVM_BACKGROUND = 10000b EVM_MOUSE = 100000b EVM_IPC = 1000000b -EVM_STACK = 10000000b +EVM_STACK = 10000000b diff --git a/kernel/branches/net/applications/netstat/netstat.asm b/kernel/branches/net/applications/netstat/netstat.asm index ad683d03ef..dd58325663 100644 --- a/kernel/branches/net/applications/netstat/netstat.asm +++ b/kernel/branches/net/applications/netstat/netstat.asm @@ -11,7 +11,7 @@ use32 db 'MENUET01' ; 8 byte id dd 0x01 ; header version dd START ; start of code - dd IM_END ; size of image + dd I_END ; size of image dd (I_END+0x100) ; memory for app dd (I_END+0x100) ; esp dd I_PARAM , 0x0 ; I_Param , I_Icon @@ -25,14 +25,12 @@ include '..\debug-fdo.inc' START: ; start of execution ; TODO: check Parameters - DEBUGF 1, 'Hello!\n' - + DEBUGF 1, 'Netstat application loaded!\n' redraw: - mcall 12, 1 - mcall 0, 100 shl 16 + 520, 100 shl 16 + 240, 0x34bcbcbc, ,name + mcall 0, 100 shl 16 + 520, 100 shl 16 + 240, 0x34bcbcbc , , name mov edx, 101 mov esi, 0x00aaaaff @@ -42,7 +40,7 @@ START: ; start of execution cmove esi, edi mcall 8, 25 shl 16 + 65, 25 shl 16 + 20 - @@: + .morebuttons: inc edx add ebx, 75 shl 16 mov esi, 0x00aaaaff @@ -52,12 +50,12 @@ START: ; start of execution mcall cmp edx, 105 - jle @r + jle .morebuttons mcall 4, 28 shl 16 + 31, 0x80000000, modes cmp [mode], 101 - jne @f + jne .no_eth mcall 4, 20 shl 16 + 75, 0x80000000, str_packets_tx add ebx, 18 @@ -89,10 +87,10 @@ START: ; start of execution call draw_mac jmp end_of_draw - @@: + .no_eth: cmp [mode], 102 - jne @f + jne .no_ip mcall 4, 20 shl 16 + 75, 0x80000000, str_packets_tx add ebx, 18 @@ -146,10 +144,10 @@ START: ; start of execution jmp end_of_draw - @@: + .no_ip: cmp [mode], 103 - jne @f + jne .no_arp mcall 4, 20 shl 16 + 75, 0x80000000, str_packets_tx add ebx, 18 @@ -161,7 +159,7 @@ START: ; start of execution jmp end_of_draw - @@: + .no_arp: mcall 4, 20 shl 16 + 75, 0x80000000, str_packets_tx add ebx, 18 @@ -176,7 +174,7 @@ START: ; start of execution mainloop: - mcall 23,50 ; wait for event with timeout (0,5 s) + mcall 23,500 ; wait for event with timeout (0,5 s) cmp eax, 1 je redraw @@ -461,11 +459,9 @@ draw_mac: add edx, 15 shl 16 mcall - mov eax, [esp] - add esp, 6+4 sub edx, 5*15 shl 16 - jmp eax + ret 6 draw_ip: @@ -493,15 +489,11 @@ draw_ip: mcall sub edx, 3*30 shl 16 - mov eax, [esp] - add esp, 8 - jmp eax + ret 4 ; DATA AREA -IM_END: - name db 'Netstat',0 mode db 101 device db 0