From 3c1445e6c654b0ef1964528b672b84839de06202 Mon Sep 17 00:00:00 2001 From: pavelyakov Date: Sat, 25 Aug 2018 13:22:48 +0000 Subject: [PATCH] Added KERNEL process git-svn-id: svn://kolibrios.org@7321 a494cfbc-eb01-0410-851d-a64ba20cac60 --- data/Tupfile.lua | 1 + data/common/settings/AUTORUN.DAT | 1 + kernel/trunk/core/syscall.inc | 38 ++++++++++++------------- programs/cmm/KERNEL/Tupfile.lua | 6 ++++ programs/cmm/KERNEL/build.bat | 5 ++++ programs/cmm/KERNEL/kernel.c | 48 ++++++++++++++++++++++++++++++++ 6 files changed, 80 insertions(+), 19 deletions(-) create mode 100644 programs/cmm/KERNEL/Tupfile.lua create mode 100644 programs/cmm/KERNEL/build.bat create mode 100644 programs/cmm/KERNEL/kernel.c diff --git a/data/Tupfile.lua b/data/Tupfile.lua index 57a1edcacd..899d9d4da4 100644 --- a/data/Tupfile.lua +++ b/data/Tupfile.lua @@ -588,6 +588,7 @@ tup.append_table(img_files, { {"MOUSECFG", PROGS .. "/cmm/mousecfg/mousecfg.com"}, {"NETWORK/WEBVIEW", PROGS .. "/cmm/browser/WebView.com"}, {"PANELS_CFG", PROGS .. "/cmm/panels_cfg/panels_cfg.com"}, + {"@KERNEL", PROGS .. "/cmm/KERNEL/kernel.com"}, }) tup.append_table(extra_files, { {"kolibrios/drivers/DRVINST.KEX", PROGS .. "/cmm/drvinst/drvinst.com"}, diff --git a/data/common/settings/AUTORUN.DAT b/data/common/settings/AUTORUN.DAT index 8f9438f7de..e6b1de088e 100644 --- a/data/common/settings/AUTORUN.DAT +++ b/data/common/settings/AUTORUN.DAT @@ -8,6 +8,7 @@ #/SYS/DEVELOP/BOARD "" 0 # Load DEBUG board /SYS/SETUP BOOT 0 # Load device settings /SYS/LOADDRV RDC 0 # videodriver for RDC M2010/M2012 +/SYS/@KERNEL "" 0 # Start modify KERNEL /SYS/@TASKBAR "" 0 # Start taskbar /SYS/@ICON "" 0 # Multithread icon /SYS/ESKIN "" 0 # Set style diff --git a/kernel/trunk/core/syscall.inc b/kernel/trunk/core/syscall.inc index 9a409beed0..be18331d77 100644 --- a/kernel/trunk/core/syscall.inc +++ b/kernel/trunk/core/syscall.inc @@ -191,70 +191,70 @@ endg ; Return Else EAX > 0 success set function align 32 setInt0x40: - + ; !!! kernel security !!! and ebx, 0FFh mov eax, dword [servetable2 + ebx * 4] - cmp eax, undefined_syscall - jne errorSet0x40 +; cmp eax, undefined_syscall +; jne errorSet0x40 ; ----------------------- - + pushad add edx, 16 stdcall kernel_alloc, edx push eax pop dword[tempPointerAlloc] popad - - + + push ebx push dword[tempPointerAlloc] pop eax mov ebx, eax add eax, edx - + push 0 pop dword[hashDataFunction1] push 1 pop dword[hashDataFunction2] - + loopCopyMemory: xor edx, edx - + mov dl, byte[ecx] mov byte[ebx], dl - + ; hash security function add dword[hashDataFunction1], edx mov edx, dword[hashDataFunction1] add dword[hashDataFunction2], edx ;----------------------------- - + inc ebx inc ecx cmp ebx, eax jne loopCopyMemory - + pop ebx - + ; check hash security data ; cmp edi, dword[hashDataFunction1] ; jne errorSet0x40 ; cmp esi, dword[hashDataFunction2] ; jne errorSet0x40 ;------------------------------- - + mov eax, dword[tempPointerAlloc] mov dword [servetable2 + ebx * 4], eax jmp successSet0x40 - + errorSet0x40: xor eax, eax - + successSet0x40: ret - + tempPointerAlloc dd ? -hashDataFunction1 dd ? -hashDataFunction2 dd ? +;hashDataFunction1 dd ? +;hashDataFunction2 dd ? ;------------------- \ No newline at end of file diff --git a/programs/cmm/KERNEL/Tupfile.lua b/programs/cmm/KERNEL/Tupfile.lua new file mode 100644 index 0000000000..e99eed0da2 --- /dev/null +++ b/programs/cmm/KERNEL/Tupfile.lua @@ -0,0 +1,6 @@ +if tup.getconfig("NO_CMM") ~= "" then return end +if tup.getconfig("LANG") == "ru" +then C_LANG = "LANG_RUS" +else C_LANG = "LANG_ENG" -- this includes default case without config +end +tup.rule("kernel.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "kernel.com") diff --git a/programs/cmm/KERNEL/build.bat b/programs/cmm/KERNEL/build.bat new file mode 100644 index 0000000000..5535d0915a --- /dev/null +++ b/programs/cmm/KERNEL/build.bat @@ -0,0 +1,5 @@ +C-- kernel.c +del @KERNEL +rename kernel.com @KERNEL + +pause \ No newline at end of file diff --git a/programs/cmm/KERNEL/kernel.c b/programs/cmm/KERNEL/kernel.c new file mode 100644 index 0000000000..5cf44b985c --- /dev/null +++ b/programs/cmm/KERNEL/kernel.c @@ -0,0 +1,48 @@ +#pragma option OST +#pragma option ON +#pragma option cri- +#pragma option -CPA +#initallvar 0 +#jumptomain FALSE + +#startaddress 0x0000 + + +char os_name[8] = {'M','E','N','U','E','T','0','1'}; +dword os_version = 0x00000001; +dword start_addr = #____INIT____; +dword final_addr = #____STOP____+32; +dword alloc_mem = 4*1024*1024; +dword x86esp_reg = 4*1024*1024; +dword I_Param = #param; +dword I_Path = #program_path; +char param[4096]; +char program_path[4096]; + + +void ExitProcess() +{ + EAX = -1; + $int 0x40 +} + +dword eaxFunctionDestroy(){RETURN 0;} +eaxFunctionDestroyEnd: + +void ____INIT____() +{ + +// Disable door kernel + EAX = 81; + EBX = 81; + ECX = #eaxFunctionDestroy; + EDX = #eaxFunctionDestroyEnd-#eaxFunctionDestroy; + $int 0x40 + + ExitProcess(); +} + +void ____STOP____() +{ + ExitProcess(); +}