From e2999eaedd82021024eb03a05a2fc3d1264e4403 Mon Sep 17 00:00:00 2001 From: CleverMouse Date: Tue, 25 Jan 2011 13:14:35 +0000 Subject: [PATCH] add missing files for r1764 git-svn-id: svn://kolibrios.org@1765 a494cfbc-eb01-0410-851d-a64ba20cac60 --- data/eng/doexe2.asm | 68 +++++++++++++++++++++++++++ data/rus/doexe2.asm | 68 +++++++++++++++++++++++++++ drivers/include/linux/compiler-gcc3.h | 31 ++++++++++++ programs/other/graph/memcpy.asm | 11 +++++ programs/other/graph/memset.asm | 11 +++++ 5 files changed, 189 insertions(+) create mode 100644 data/eng/doexe2.asm create mode 100644 data/rus/doexe2.asm create mode 100644 drivers/include/linux/compiler-gcc3.h create mode 100644 programs/other/graph/memcpy.asm create mode 100644 programs/other/graph/memset.asm diff --git a/data/eng/doexe2.asm b/data/eng/doexe2.asm new file mode 100644 index 0000000000..eaebd8aaf8 --- /dev/null +++ b/data/eng/doexe2.asm @@ -0,0 +1,68 @@ +filename equ '%EXENAME%' + +virtual at 0 +file filename:3Ch,4 +load pehea dword from 0 +file filename:pehea,0F8h+28h*3 +load NumberOfSections word from 4+6 +load SizeOfOptionalHeader word from 4+14h +if NumberOfSections<>3 +error Expected three sections, .text, .bss and .reloc +end if +if SizeOfOptionalHeader<>0E0h +error Nonstandard PE header +end if +load RelocsRVA dword from 4+0A0h +load RelocsSize dword from 4+0A4h +load ImageBase dword from 4+34h +load TextRVA dword from 4+0F8h+0Ch +load TextSize dword from 4+0F8h+8 +load TextOffs dword from 4+0F8h+14h +load BSSSize dword from 4+0F8h+28h+10h +load RelocRVA dword from 4+0F8h+28h*2+0Ch +load RelocOffs dword from 4+0F8h+28h*2+14h +if BSSSize +error Second section expected to be .bss +end if +if RelocRVA<>RelocsRVA +error Third section expected to be .reloc +end if +;file 'test.exe':pehea+0F8h,28h +;load physofs dword from 4+14h +;load mem dword from 4+8 +;file 'test.exe':physofs+16,4 +;load sz dword from $-4 +end virtual + +file filename:TextOffs,TextSize + +while RelocsSize>8 +virtual at 0 +file filename:RelocOffs,8 +load CurRelocPage dword from 0 +load CurRelocChunkSize dword from 4 +end virtual +RelocsSize=RelocsSize-CurRelocChunkSize +CurRelocChunkSize = CurRelocChunkSize-8 +RelocOffs=RelocOffs+8 +while CurRelocChunkSize +virtual at 0 +file filename:RelocOffs,2 +RelocOffs=RelocOffs+2 +CurRelocChunkSize=CurRelocChunkSize-2 +load s word from 0 +end virtual +CurRelocType = s shr 12 +RelocItem = CurRelocPage + (s and 0xFFF) +if CurRelocType=0 +else if CurRelocType=3 +load z dword from RelocItem-TextRVA +store dword z-(TextRVA+ImageBase) at RelocItem-TextRVA +else +error Unexpected relocation type +end if +end while +end while + +store dword TextSize at 10h +store dword RelocRVA-TextRVA at 14h diff --git a/data/rus/doexe2.asm b/data/rus/doexe2.asm new file mode 100644 index 0000000000..eaebd8aaf8 --- /dev/null +++ b/data/rus/doexe2.asm @@ -0,0 +1,68 @@ +filename equ '%EXENAME%' + +virtual at 0 +file filename:3Ch,4 +load pehea dword from 0 +file filename:pehea,0F8h+28h*3 +load NumberOfSections word from 4+6 +load SizeOfOptionalHeader word from 4+14h +if NumberOfSections<>3 +error Expected three sections, .text, .bss and .reloc +end if +if SizeOfOptionalHeader<>0E0h +error Nonstandard PE header +end if +load RelocsRVA dword from 4+0A0h +load RelocsSize dword from 4+0A4h +load ImageBase dword from 4+34h +load TextRVA dword from 4+0F8h+0Ch +load TextSize dword from 4+0F8h+8 +load TextOffs dword from 4+0F8h+14h +load BSSSize dword from 4+0F8h+28h+10h +load RelocRVA dword from 4+0F8h+28h*2+0Ch +load RelocOffs dword from 4+0F8h+28h*2+14h +if BSSSize +error Second section expected to be .bss +end if +if RelocRVA<>RelocsRVA +error Third section expected to be .reloc +end if +;file 'test.exe':pehea+0F8h,28h +;load physofs dword from 4+14h +;load mem dword from 4+8 +;file 'test.exe':physofs+16,4 +;load sz dword from $-4 +end virtual + +file filename:TextOffs,TextSize + +while RelocsSize>8 +virtual at 0 +file filename:RelocOffs,8 +load CurRelocPage dword from 0 +load CurRelocChunkSize dword from 4 +end virtual +RelocsSize=RelocsSize-CurRelocChunkSize +CurRelocChunkSize = CurRelocChunkSize-8 +RelocOffs=RelocOffs+8 +while CurRelocChunkSize +virtual at 0 +file filename:RelocOffs,2 +RelocOffs=RelocOffs+2 +CurRelocChunkSize=CurRelocChunkSize-2 +load s word from 0 +end virtual +CurRelocType = s shr 12 +RelocItem = CurRelocPage + (s and 0xFFF) +if CurRelocType=0 +else if CurRelocType=3 +load z dword from RelocItem-TextRVA +store dword z-(TextRVA+ImageBase) at RelocItem-TextRVA +else +error Unexpected relocation type +end if +end while +end while + +store dword TextSize at 10h +store dword RelocRVA-TextRVA at 14h diff --git a/drivers/include/linux/compiler-gcc3.h b/drivers/include/linux/compiler-gcc3.h new file mode 100644 index 0000000000..d22626732d --- /dev/null +++ b/drivers/include/linux/compiler-gcc3.h @@ -0,0 +1,31 @@ +#ifndef __LINUX_COMPILER_H +#error "Please don't include directly, include instead." +#endif + +#if __GNUC_MINOR__ < 2 +# error Sorry, your compiler is too old - please upgrade it. +#endif + +#if __GNUC_MINOR__ >= 3 +# define __used __attribute__((__used__)) +#else +# define __used __attribute__((__unused__)) +#endif + +#if __GNUC_MINOR__ >= 4 +#define __must_check __attribute__((warn_unused_result)) +#endif + +#ifdef CONFIG_GCOV_KERNEL +# if __GNUC_MINOR__ < 4 +# error "GCOV profiling support for gcc versions below 3.4 not included" +# endif /* __GNUC_MINOR__ */ +#endif /* CONFIG_GCOV_KERNEL */ + +/* + * A trick to suppress uninitialized variable warning without generating any + * code + */ +#define uninitialized_var(x) x = x + +#define __always_inline inline __attribute__((always_inline)) diff --git a/programs/other/graph/memcpy.asm b/programs/other/graph/memcpy.asm new file mode 100644 index 0000000000..48eb78b81c --- /dev/null +++ b/programs/other/graph/memcpy.asm @@ -0,0 +1,11 @@ +format MS COFF +section '.text' code readable executable +public _memcpy +_memcpy: + push esi edi + mov edi, [esp+12] + mov esi, [esp+16] + mov ecx, [esp+20] + rep movsb + pop edi esi + ret diff --git a/programs/other/graph/memset.asm b/programs/other/graph/memset.asm new file mode 100644 index 0000000000..1774128c90 --- /dev/null +++ b/programs/other/graph/memset.asm @@ -0,0 +1,11 @@ +format MS COFF +section '.text' code readable executable +public _memset +_memset: + push edi + mov edi, [esp+8] + mov al, [esp+12] + mov ecx, [esp+16] + rep stosb + pop edi + ret