From 5cbb298e24bd6172ddfe106a492270a09cd93deb Mon Sep 17 00:00:00 2001 From: Doczom Date: Sat, 23 Apr 2022 21:37:05 +0000 Subject: [PATCH] add new function - lsmod This function input list loaded drivers. git-svn-id: svn://kolibrios.org@9780 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/system/shell/all.h | 1 + programs/system/shell/cmd/cmd_lsmod.c | 33 ++++++++++++++++++++++ programs/system/shell/globals.h | 1 + programs/system/shell/locale/eng/globals.h | 1 + programs/system/shell/locale/rus/globals.h | 3 +- 5 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 programs/system/shell/cmd/cmd_lsmod.c diff --git a/programs/system/shell/all.h b/programs/system/shell/all.h index 5ae748af68..6c6f5d8d44 100644 --- a/programs/system/shell/all.h +++ b/programs/system/shell/all.h @@ -76,6 +76,7 @@ void get_file_dir_loc(char *filepath, char *dir_path); #include "cmd/cmd_ver.c" #include "cmd/cmd_pwd.c" #include "cmd/cmd_ls.c" +#include "cmd/cmd_lsmod.c" #include "cmd/cmd_ps.c" #include "cmd/cmd_kill.c" #include "cmd/cmd_pkill.c" diff --git a/programs/system/shell/cmd/cmd_lsmod.c b/programs/system/shell/cmd/cmd_lsmod.c new file mode 100644 index 0000000000..fa36f483db --- /dev/null +++ b/programs/system/shell/cmd/cmd_lsmod.c @@ -0,0 +1,33 @@ +struct service_str{ + char name[16]; + struct service_str* fd; + struct service_str* bk; + uint32_t base; // base addreass service for kernel_free + uint32_t entry; //unsigned drvEntry(int action, char *cmdline) + uint32_t srv_proc; // static int __stdcall service_proc(ioctl_t *my_ctl) + //void* srv_proc_kern; + }; + +int cmd_lsmod(char param[]) { + struct service_str* fd; + struct service_str* bk; + struct service_str srv_str; + asm_inline( + "int $0x40" + :"=b"(fd), "=c"(bk) + :"a"(68), "b"(31), "c"(1) + ); + srv_str.fd = fd; + printf("%-*s Hendler Service_proc\n\r", 16, " Name"); + while (1) { + asm_inline( + "int $0x40" + ::"a"(68), "b"(31), "c"(2), "d"(fd), "D"(&srv_str) + ); + printf("%-*s 0x%X 0x%X \n", 16, srv_str.name, fd, srv_str.srv_proc); + if (fd == bk) break; + fd = srv_str.fd; + }; + + return TRUE; +} diff --git a/programs/system/shell/globals.h b/programs/system/shell/globals.h index b1c1f9feef..f45bb08c8e 100644 --- a/programs/system/shell/globals.h +++ b/programs/system/shell/globals.h @@ -54,6 +54,7 @@ int cmd_help(char cmd[]); int cmd_kill(char process[]); int cmd_pkill(char process_name[]); int cmd_ls(char dir[]); +int cmd_lsmod(char param[]); int cmd_mkdir(char dir[]); int cmd_more(char file[]); int cmd_ps(char arg[]); diff --git a/programs/system/shell/locale/eng/globals.h b/programs/system/shell/locale/eng/globals.h index eeb4789c8b..2f6fe63448 100644 --- a/programs/system/shell/locale/eng/globals.h +++ b/programs/system/shell/locale/eng/globals.h @@ -18,6 +18,7 @@ const command_t COMMANDS[]= {"kill", " Stops a running process. Usage:\n\r kill \n\r kill all\n\r", &cmd_kill}, {"pkill", " Kills all processes by name. Usage:\n\r pkill \n\r", &cmd_pkill}, {"ls", " Lists the files in a directory. Usage:\n\r ls ;lists the files in current directory\n\r ls ;lists the files at specified folder\n\r ls -1 ;lists the files in a single column\n\r", &cmd_ls}, + {"lsmod", " list working driver \n\r", &cmd_lsmod}, {"mkdir", " Create directory and parent directories as needed. Usage:\n\r mkdir \n\r", &cmd_mkdir}, {"more", " Displays a file data to the screen. Usage:\n\r more \n\r", &cmd_more}, {"ps", " Lists the current processes running\n\r or shows more info on and save LASTPID\n\r", &cmd_ps}, diff --git a/programs/system/shell/locale/rus/globals.h b/programs/system/shell/locale/rus/globals.h index be8d25995d..ccae6cb251 100644 --- a/programs/system/shell/locale/rus/globals.h +++ b/programs/system/shell/locale/rus/globals.h @@ -19,7 +19,8 @@ const command_t COMMANDS[]= {"kill", " Убивает процесс. Использование:\n\r kill \n\r kill all\n\r", &cmd_kill}, {"pkill", " Убивает все процессы по имени. Использование:\n\r pkill <имя_процесса>\n\r", &cmd_pkill}, {"ls", " Выводит список файлов. Использование:\n\r ls ;список файлов в текущем каталоге\n\r ls <директория> ;список файлов из заданной директории\n\r", &cmd_ls}, - {"mkdir", " Создает каталог и родительские каталоги при необходимости. Использование:\n\r mkdir <имя/папки>", &cmd_mkdir}, + {"lsmod", " list working driver \n\r", &cmd_lsmod}, + {"mkdir", " Создает каталог и родительские каталоги при необходимости. Использование:\n\r mkdir <имя/папки>", &cmd_mkdir}, {"more", " Выводит содержимое файла на экран. Использование:\n\r more <имя файла>\n\r", &cmd_more}, {"ps", " Выводит список процессов\n\r Если указано <имяпроцесса>, показывает больше данных и сохраняет LASTPID\n\r", &cmd_ps}, {"pwd", " Показывает имя текущей директории\n\r", &cmd_pwd},