diff --git a/contrib/kolibri-libc/LICENSE b/contrib/kolibri-libc/LICENSE deleted file mode 100644 index d159169d10..0000000000 --- a/contrib/kolibri-libc/LICENSE +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. diff --git a/contrib/kolibri-libc/source/crt/crt0.asm b/contrib/kolibri-libc/source/crt/crt0.asm index 90a41bd54a..008a5cf50c 100644 --- a/contrib/kolibri-libc/source/crt/crt0.asm +++ b/contrib/kolibri-libc/source/crt/crt0.asm @@ -5,9 +5,9 @@ public start as '_start' ;extrn mf_init extrn main ;include 'debug2.inc' -include 'inc/proc32.inc' -include 'inc/macros.inc' -include 'inc/dll.inc' +include '../../../../programs/proc32.inc' +include '../../../../programs/macros.inc' +include '../../../../programs/dll.inc' __DEBUG__=0 ;start_: diff --git a/contrib/kolibri-libc/source/crt/inc/config.inc b/contrib/kolibri-libc/source/crt/inc/config.inc deleted file mode 100644 index dc70bf9760..0000000000 --- a/contrib/kolibri-libc/source/crt/inc/config.inc +++ /dev/null @@ -1 +0,0 @@ -__CPU_type fix p5 diff --git a/contrib/kolibri-libc/source/crt/inc/dll.inc b/contrib/kolibri-libc/source/crt/inc/dll.inc deleted file mode 100644 index 151c374e7b..0000000000 --- a/contrib/kolibri-libc/source/crt/inc/dll.inc +++ /dev/null @@ -1,158 +0,0 @@ -;----------------------------------------------------------------------------- -; load one or more DLL file in COFF format and try to import functions by our list -; if first function in import list begins with 'lib_', call it as DLL initialization -; return eax = 1 as fail, if anyone of .obj file not found in /sys/lib -; return 0 if all fine, but 0 not garantees in succesfull import - see dll.Link comment -; dirties all registers! eax, ebx, ecx, edx, esi, edi -proc dll.Load, import_table:dword - mov esi, [import_table] - .next_lib: - mov edx, [esi] - or edx, edx - jz .exit - push esi - mov esi, [esi + 4] - mov edi, s_libdir.fname - @@: - lodsb - stosb - or al, al - jnz @b - mcall 68, 19, s_libdir - or eax, eax - jz .fail - stdcall dll.Link, eax, edx - push eax - mov eax, [eax] - cmp dword[eax], 'lib_' - pop eax - jnz @f - stdcall dll.Init, [eax + 4] - @@: - pop esi - add esi, 8 - jmp .next_lib - .exit: - xor eax, eax - ret - .fail: - add esp, 4 - xor eax, eax - inc eax - ret -endp -;----------------------------------------------------------------------------- -; scans dll export table for a functions we want to import -; break scan on first unresolved import -; no return value -proc dll.Link, exp:dword, imp:dword - push eax - mov esi, [imp] - test esi, esi - jz .done - .next: - lodsd - test eax, eax - jz .done - stdcall dll.GetProcAddress, [exp], eax - or eax, eax - jz @f - mov [esi - 4], eax - jmp .next - @@: - mov dword[esp], 0 - .done: - pop eax - ret -endp -;----------------------------------------------------------------------------- -; calls lib_init with predefined parameters -; no return value -proc dll.Init, dllentry:dword - pushad - mov eax, mem.Alloc - mov ebx, mem.Free - mov ecx, mem.ReAlloc - mov edx, dll.Load - stdcall [dllentry] - popad - ret -endp -;----------------------------------------------------------------------------- -; scans export table for a sz_name function -; returns in eax function address or 0 if not found -proc dll.GetProcAddress, exp:dword, sz_name:dword - mov edx, [exp] - xor eax, eax - .next: - or edx, edx - jz .end - cmp dword[edx], 0 - jz .end - stdcall strcmp, [edx], [sz_name] - test eax, eax - jz .ok - add edx, 8 - jmp .next - .ok: - mov eax, [edx + 4] - .end: - cmp eax, -1 - jnz @f - xor eax, eax - @@: - ret -endp -;----------------------------------------------------------------------------- -; compares strings -; returns eax = 0 if equal, -1 otherwise -proc strcmp, str1:dword, str2:dword - push esi edi - mov esi, [str1] - mov edi, [str2] - xor eax, eax - @@: - lodsb - scasb - jne .fail - or al, al - jnz @b - jmp .ok - .fail: - or eax, -1 - .ok: - pop edi esi - ret -endp -;----------------------------------------------------------------------------- -if defined dll.Load -s_libdir: - db '/sys/lib/' - .fname rb 32 -end if -;----------------------------------------------------------------------------- -proc mem.Alloc, size - push ebx ecx - mov ecx, [size] - mcall 68, 12 - pop ecx ebx - ret -endp -;----------------------------------------------------------------------------- -proc mem.ReAlloc, mptr, size - push ebx ecx edx - mov ecx, [size] - mov edx, [mptr] - mcall 68, 20 - pop edx ecx ebx - ret -endp -;----------------------------------------------------------------------------- -proc mem.Free, mptr - push ebx ecx - mov ecx,[mptr] - mcall 68, 13 - pop ecx ebx - ret -endp -;----------------------------------------------------------------------------- diff --git a/contrib/kolibri-libc/source/crt/inc/macros.inc b/contrib/kolibri-libc/source/crt/inc/macros.inc deleted file mode 100644 index feb72aebe7..0000000000 --- a/contrib/kolibri-libc/source/crt/inc/macros.inc +++ /dev/null @@ -1,597 +0,0 @@ -@^ 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 -KOS_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 -KOS_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] { ; [mike.dld] - common - if used name - name db data - .size = $-name - end if -} - -macro szZ name,[data] { ; same as sz, but for zero terminated string [dunkaist] - common - if used name - name db data,0 - .size = $-name-1 - end if -} -sz0 fix szZ - -macro lsz name,[lng,data] { ; [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] { ; [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] { ; [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,g { ; [mike.dld], [Ghost] - local ..ret_point - __mov eax,a - __mov ebx,b - __mov ecx,c - __mov edx,d - __mov esi,e - __mov edi,f - __mov ebp,g - - if __CPU_type eq p5 - int 0x40 - else - if __CPU_type eq p6 - push ebp - mov ebp, esp - push ..ret_point ; it may be 2 or 5 byte - sysenter - ..ret_point: - pop edx - pop ecx - - else - if __CPU_type eq k6 - push ecx - syscall - pop ecx - else - display 'ERROR : unknown CPU type (set to p5)', 10, 13 - __CPU_type equ p5 - int 0x40 - end if - end if - end if -} - - -; ------------------------- -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 -} - -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 - } - - -macro movi arg1,arg2 -{ -if (arg1 in ) & ((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) <= 127 - 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 ? ;nonset1 - grab dd ? ;nonset2 - work_dark dd ? - work_light dd ? - grab_text dd ? ;window_title - 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 - -cmove fix cmovz - -macro cmovz reg1, reg2 { - - local ..jumpaddr - -if __CPU_type eq p5 ; CMOVcc isnt supported on the P5 - jnz ..jumpaddr - mov reg1, reg2 - ..jumpaddr: -else - cmovz reg1, reg2 -end if - -} - -cmovne fix cmovnz - -macro cmovnz reg1, reg2 { - - local ..jumpaddr - -if __CPU_type eq p5 ; CMOVcc isnt supported on the P5 - jz ..jumpaddr - mov reg1, reg2 - ..jumpaddr: -else - cmovnz reg1, reg2 -end if - -} - -macro cmovg reg1, reg2 { - - local ..jumpaddr - -if __CPU_type eq p5 ; CMOVcc isnt supported on the P5 - jle ..jumpaddr - mov reg1, reg2 - ..jumpaddr: -else - cmovg reg1, reg2 -end if -} - -macro cmovl reg1, reg2 { - - local ..jumpaddr - -if __CPU_type eq p5 ; CMOVcc isnt supported on the P5 - jge ..jumpaddr - mov reg1, reg2 - ..jumpaddr: -else - cmovl reg1, reg2 -end if -} - -; replaces /programs/cmp.inc -irp cond, e, ne, g, ng, l, nl, ge, le { - macro cmp#cond a, b, c\{ - cmp a, b - j#cond c - \} -} - -; 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 -EVM_DEBUG = 100000000b -EVM_STACK2 = 1000000000b - -EVM_MOUSE_FILTER = 0x80000000 -EVM_CURSOR_FILTER = 0x40000000 diff --git a/contrib/kolibri-libc/source/crt/inc/proc32.inc b/contrib/kolibri-libc/source/crt/inc/proc32.inc deleted file mode 100644 index 762826cbbb..0000000000 --- a/contrib/kolibri-libc/source/crt/inc/proc32.inc +++ /dev/null @@ -1,301 +0,0 @@ - -; Macroinstructions for defining and calling procedures - -macro stdcall proc,[arg] ; directly call STDCALL procedure - { common - if ~ arg eq - reverse - pushd arg - common - end if - call proc } - -macro invoke proc,[arg] ; indirectly call STDCALL procedure - { common - if ~ arg eq - reverse - pushd arg - common - end if - call [proc] } - -macro ccall proc,[arg] ; directly call CDECL procedure - { common - size@ccall = 0 - if ~ arg eq - reverse - pushd arg - size@ccall = size@ccall+4 - common - end if - call proc - if size@ccall - add esp,size@ccall - end if } - -macro cinvoke proc,[arg] ; indirectly call CDECL procedure - { common - size@ccall = 0 - if ~ arg eq - reverse - pushd arg - size@ccall = size@ccall+4 - common - end if - call [proc] - if size@ccall - add esp,size@ccall - end if } - -macro proc [args] ; define procedure - { common - match name params, args> - \{ define@proc name, \{ prologue name,flag,parmbytes,localbytes,reglist \} - virtual at parmbase@proc - match =,args, params \{ defargs@proc args \} - match =args@proc args, args@proc params \{ defargs@proc args \} - parmbytes = $-(parmbase@proc) - end virtual - name # % = parmbytes/4 - all@vars equ - current = 0 - macro locals - \{ virtual at localbase@proc+current - macro label def \\{ match . type,def> \\\{ deflocal@proc .,label, \\\{ epilogue name,flag,parmbytes,localbytes,reglist \\\} \\} \} - macro finish@proc - \{ localbytes = current - match close:reglist, close@proc: \\{ close name,flag,parmbytes,localbytes,reglist \\} - end if \} } - -macro defargs@proc [arg] - { common - if ~ arg eq - forward - local ..arg,current@arg - match argname:type, arg - \{ current@arg equ argname - label ..arg type - argname equ ..arg - if qqword eq type - dd ?,?,?,?,?,?,?,? - else if dqword eq type - dd ?,?,?,? - else if tbyte eq type - dd ?,?,? - else if qword eq type | pword eq type - dd ?,? - else - dd ? - end if \} - match =current@arg,current@arg - \{ current@arg equ arg - arg equ ..arg - ..arg dd ? \} - common - args@proc equ current@arg - forward - restore current@arg - common - end if } - -macro deflocal@proc name,def,[val] { name def val } - -macro deflocal@proc name,def,[val] - { common - match vars, all@vars \{ all@vars equ all@vars, \} - all@vars equ all@vars name - forward - local ..var,..tmp - ..var def val - match =?, val \{ ..tmp equ \} - match any =?, val \{ ..tmp equ \} - match any (=?), val \{ ..tmp equ \} - match =label, def \{ ..tmp equ \} - match tmp : value, ..tmp : val - \{ tmp: end virtual - initlocal@proc ..var,def value - virtual at tmp\} - common - match first rest, ..var, \{ name equ first \} } - -struc label type { label . type } - -macro initlocal@proc name,def - { virtual at name - def - size@initlocal = $ - name - end virtual - position@initlocal = 0 - while size@initlocal > position@initlocal - virtual at name - def - if size@initlocal - position@initlocal < 2 - current@initlocal = 1 - load byte@initlocal byte from name+position@initlocal - else if size@initlocal - position@initlocal < 4 - current@initlocal = 2 - load word@initlocal word from name+position@initlocal - else - current@initlocal = 4 - load dword@initlocal dword from name+position@initlocal - end if - end virtual - if current@initlocal = 1 - mov byte [name+position@initlocal],byte@initlocal - else if current@initlocal = 2 - mov word [name+position@initlocal],word@initlocal - else - mov dword [name+position@initlocal],dword@initlocal - end if - position@initlocal = position@initlocal + current@initlocal - end while } - -macro endp - { purge ret,locals,endl - finish@proc - purge finish@proc - restore regs@proc - match all,args@proc \{ restore all \} - restore args@proc - match all,all@vars \{ restore all \} } - -macro local [var] - { common - locals - forward done@local equ - match varname[count]:vartype, var - \{ match =BYTE, vartype \\{ varname rb count - restore done@local \\} - match =WORD, vartype \\{ varname rw count - restore done@local \\} - match =DWORD, vartype \\{ varname rd count - restore done@local \\} - match =PWORD, vartype \\{ varname rp count - restore done@local \\} - match =QWORD, vartype \\{ varname rq count - restore done@local \\} - match =TBYTE, vartype \\{ varname rt count - restore done@local \\} - match =DQWORD, vartype \\{ label varname dqword - rq count*2 - restore done@local \\} - match =QQWORD, vartype \\{ label varname qqword - rq count*4 - restore done@local \\} - match =XWORD, vartype \\{ label varname xword - rq count*2 - restore done@local \\} - match =YWORD, vartype \\{ label varname yword - rq count*4 - restore done@local \\} - match , done@local \\{ virtual - varname vartype - end virtual - rb count*sizeof.\#vartype - restore done@local \\} \} - match :varname:vartype, done@local:var - \{ match =BYTE, vartype \\{ varname db ? - restore done@local \\} - match =WORD, vartype \\{ varname dw ? - restore done@local \\} - match =DWORD, vartype \\{ varname dd ? - restore done@local \\} - match =PWORD, vartype \\{ varname dp ? - restore done@local \\} - match =QWORD, vartype \\{ varname dq ? - restore done@local \\} - match =TBYTE, vartype \\{ varname dt ? - restore done@local \\} - match =DQWORD, vartype \\{ label varname dqword - dq ?,? - restore done@local \\} - match =QQWORD, vartype \\{ label varname qqword - dq ?,?,?,? - restore done@local \\} - match =XWORD, vartype \\{ label varname xword - dq ?,? - restore done@local \\} - match =YWORD, vartype \\{ label varname yword - dq ?,?,?,? - restore done@local \\} - match , done@local \\{ varname vartype - restore done@local \\} \} - match ,done@local - \{ var - restore done@local \} - common - endl } diff --git a/contrib/kolibri-libc/source/crt/inc/struct.inc b/contrib/kolibri-libc/source/crt/inc/struct.inc deleted file mode 100644 index 789dd17976..0000000000 --- a/contrib/kolibri-libc/source/crt/inc/struct.inc +++ /dev/null @@ -1,240 +0,0 @@ - -; Macroinstructions for defining data structures - -macro struct name - { virtual at 0 - fields@struct equ name - match child parent, name \{ fields@struct equ child,fields@\#parent \} - sub@struct equ - struc db [val] \{ \common define field@struct .,db, - fields@struct equ fields@struct,field@struct \} - struc dw [val] \{ \common define field@struct .,dw, - fields@struct equ fields@struct,field@struct \} - struc du [val] \{ \common define field@struct .,du, - fields@struct equ fields@struct,field@struct \} - struc dd [val] \{ \common define field@struct .,dd, - fields@struct equ fields@struct,field@struct \} - struc dp [val] \{ \common define field@struct .,dp, - fields@struct equ fields@struct,field@struct \} - struc dq [val] \{ \common define field@struct .,dq, - fields@struct equ fields@struct,field@struct \} - struc dt [val] \{ \common define field@struct .,dt, - fields@struct equ fields@struct,field@struct \} - struc rb count \{ define field@struct .,db,count dup (?) - fields@struct equ fields@struct,field@struct \} - struc rw count \{ define field@struct .,dw,count dup (?) - fields@struct equ fields@struct,field@struct \} - struc rd count \{ define field@struct .,dd,count dup (?) - fields@struct equ fields@struct,field@struct \} - struc rp count \{ define field@struct .,dp,count dup (?) - fields@struct equ fields@struct,field@struct \} - struc rq count \{ define field@struct .,dq,count dup (?) - fields@struct equ fields@struct,field@struct \} - struc rt count \{ define field@struct .,dt,count dup (?) - fields@struct equ fields@struct,field@struct \} - macro db [val] \{ \common \local anonymous - define field@struct anonymous,db, - fields@struct equ fields@struct,field@struct \} - macro dw [val] \{ \common \local anonymous - define field@struct anonymous,dw, - fields@struct equ fields@struct,field@struct \} - macro du [val] \{ \common \local anonymous - define field@struct anonymous,du, - fields@struct equ fields@struct,field@struct \} - macro dd [val] \{ \common \local anonymous - define field@struct anonymous,dd, - fields@struct equ fields@struct,field@struct \} - macro dp [val] \{ \common \local anonymous - define field@struct anonymous,dp, - fields@struct equ fields@struct,field@struct \} - macro dq [val] \{ \common \local anonymous - define field@struct anonymous,dq, - fields@struct equ fields@struct,field@struct \} - macro dt [val] \{ \common \local anonymous - define field@struct anonymous,dt, - fields@struct equ fields@struct,field@struct \} - macro rb count \{ \local anonymous - define field@struct anonymous,db,count dup (?) - fields@struct equ fields@struct,field@struct \} - macro rw count \{ \local anonymous - define field@struct anonymous,dw,count dup (?) - fields@struct equ fields@struct,field@struct \} - macro rd count \{ \local anonymous - define field@struct anonymous,dd,count dup (?) - fields@struct equ fields@struct,field@struct \} - macro rp count \{ \local anonymous - define field@struct anonymous,dp,count dup (?) - fields@struct equ fields@struct,field@struct \} - macro rq count \{ \local anonymous - define field@struct anonymous,dq,count dup (?) - fields@struct equ fields@struct,field@struct \} - macro rt count \{ \local anonymous - define field@struct anonymous,dt,count dup (?) - fields@struct equ fields@struct,field@struct \} - macro union \{ fields@struct equ fields@struct,,union,< - sub@struct equ union \} - macro struct \{ fields@struct equ fields@struct,,substruct,< - sub@struct equ substruct \} } - -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 tail,fields@struct, \\{ if $ - display 'Error: definition of ',\\`name,' contains illegal instructions.',0Dh,0Ah - err - end if \\} - match name=,fields,fields@struct \\{ fields@struct equ - make@struct name,fields - define fields@\\#name fields \\} - end virtual \} - match any, sub@struct \{ fields@struct equ fields@struct> \} - restore sub@struct } - -macro make@struct name,[field,type,def] - { common - 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, \} - common - match fields, define \{ define@struct fields \} } - -macro define@struct name,[field,type,def] - { common - virtual - db `name - load initial@struct byte from 0 - if initial@struct = '.' - display 'Error: name of structure should not begin with a dot.',0Dh,0Ah - err - end if - end virtual - local list - list equ - forward - if ~ field eq . - name#field type def - sizeof.#name#field = $ - name#field - else - label name#.#type - rb sizeof.#type - end if - local value - match any, list \{ list equ list, \} - list equ list - common - sizeof.#name = $ - restruc name - match values, list \{ - struc name value \\{ \\local \\..base - match any, fields@struct \\\{ fields@struct equ fields@struct,.,name, \\\} - match , fields@struct \\\{ label \\..base - forward - match , value \\\\{ field type def \\\\} - match any, value \\\\{ field type value - if ~ field eq . - rb sizeof.#name#field - ($-field) - end if \\\\} - common label . at \\..base \\\} - \\} - macro name value \\{ - match any, fields@struct \\\{ \\\local anonymous - fields@struct equ fields@struct,anonymous,name, \\\} - match , fields@struct \\\{ - forward - match , value \\\\{ type def \\\\} - match any, value \\\\{ \\\\local ..field - ..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,parent,sub def - purge make@substruct - define equ define,.,sub, \\\} \\} - match any, field \\{ define equ define,.\#field,type, \\} - \common - match fields, define \\{ define@\#substruct fields \\} \} } - -enable@substruct - -macro define@union parent,name,[field,type,def] - { common - virtual at parent#.#name - forward - if ~ field eq . - virtual at parent#.#name - parent#field type def - sizeof.#parent#field = $ - parent#field - end virtual - if sizeof.#parent#field > $ - parent#.#name - rb sizeof.#parent#field - ($ - parent#.#name) - end if - else - virtual at parent#.#name - label parent#.#type - type def - end virtual - label name#.#type at parent#.#name - if sizeof.#type > $ - parent#.#name - rb sizeof.#type - ($ - parent#.#name) - end if - end if - common - sizeof.#name = $ - parent#.#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 name [value] \{ \common \local ..anonymous - ..anonymous name value \} } - -macro define@substruct parent,name,[field,type,def] - { common - virtual at parent#.#name - forward - if ~ field eq . - parent#field type def - sizeof.#parent#field = $ - parent#field - else - label parent#.#type - rb sizeof.#type - end if - common - sizeof.#name = $ - parent#.#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 \} - macro name value \{ \local ..anonymous - ..anonymous name \} }