From 07e44df26ab1ae8a5d7b4864c8f1e54196f5553f Mon Sep 17 00:00:00 2001 From: xiaoyi1212 Date: Sun, 1 Sep 2024 20:21:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BA=86sys=5Finfo=E7=9A=84?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/include/cpos.h | 8 ++++++++ apps/shell/neofetch.c | 10 ++++++++-- src/kernel/syscall.c | 20 ++++++++++++++++---- 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/apps/include/cpos.h b/apps/include/cpos.h index c896bb2..68e6ccf 100644 --- a/apps/include/cpos.h +++ b/apps/include/cpos.h @@ -1,6 +1,8 @@ #ifndef CRASHPOWEROS_CPOS_H #define CRASHPOWEROS_CPOS_H +#include "ctype.h" + struct sysinfo{ char* osname; char* kenlname; @@ -10,6 +12,12 @@ struct sysinfo{ unsigned int pci_device; unsigned int frame_width; unsigned int frame_height; + uint32_t year; + uint32_t mon; + uint32_t day; + uint32_t hour; + uint32_t min; + uint32_t sec; }; #include "syscall.h" diff --git a/apps/shell/neofetch.c b/apps/shell/neofetch.c index e892b3a..ecabcd9 100644 --- a/apps/shell/neofetch.c +++ b/apps/shell/neofetch.c @@ -16,7 +16,7 @@ void print_info(){ " &@@@@@@@@@@@@@&=. #@@@@@@@@@@@@@@@@@#:.= Console: CPOS_USER_SHELL\n" " *@@@@@@@@@@@@@- #@@@@@@@@@@@@@@@#:.=@@+ PCI Device: %d\n" ":@@@@@@@@@@@@&. #@@@@@@@@@@@@@#: =@@@@@. Resolution: %d x %d\n" - "#@@@@@@@@@@@@. #@@@@@@@@@@@#: =@@@@@@@+\n" + "#@@@@@@@@@@@@. #@@@@@@@@@@@#: =@@@@@@@+ Time: %d/%d/%d %d:%d\n" "@@@@@@@@@@@@+ *&&&&&&&&&#- =@@@@@@@@@&\n" "@@@@@@@@@@@@- :@@@@@@@@@@@@\n" "@@@@@@@@@@@@+ #@@@@@@@@@@@&\n" @@ -38,7 +38,13 @@ void print_info(){ info->phy_mem_size, info->pci_device, info->frame_width, - info->frame_height); + info->frame_height, + info->year, + info->mon, + info->day, + info->hour, + info->min, + info->sec); free_info(info); } \ No newline at end of file diff --git a/src/kernel/syscall.c b/src/kernel/syscall.c index 6be70fd..f4cbd4c 100644 --- a/src/kernel/syscall.c +++ b/src/kernel/syscall.c @@ -69,10 +69,16 @@ struct sysinfo{ char* kenlname; char* cpu_vendor; char* cpu_name; - unsigned int phy_mem_size; - unsigned int pci_device; - unsigned int frame_width; - unsigned int frame_height; + uint32_t phy_mem_size; + uint32_t pci_device; + uint32_t frame_width; + uint32_t frame_height; + uint32_t year; + uint32_t mon; + uint32_t day; + uint32_t hour; + uint32_t min; + uint32_t sec; }; static void* syscall_sysinfo(uint32_t ebx,uint32_t ecx,uint32_t edx,uint32_t esi,uint32_t edi){ @@ -98,6 +104,12 @@ static void* syscall_sysinfo(uint32_t ebx,uint32_t ecx,uint32_t edx,uint32_t esi info->pci_device = PCI_NUM; info->frame_width = width; info->frame_height = height; + info->year = get_year(); + info->mon = get_mon(); + info->day = get_day_of_month(); + info->hour = get_hour(); + info->min = get_min(); + info->sec = get_sec(); return info; }