浏览代码

about APP: adjust copyright info (#76)

* 修正文档错误

* buffix: 在释放kthread struct之前,先判断是否为kthread

* 修改about应用中的版权声明
login 2 年之前
父节点
当前提交
fd8ba5749d
共有 3 个文件被更改,包括 19 次插入13 次删除
  1. 1 1
      docs/kernel/sched/waiting.md
  2. 4 6
      kernel/process/process.c
  3. 14 6
      user/apps/about/about.c

+ 1 - 1
docs/kernel/sched/waiting.md

@@ -9,7 +9,7 @@
   当您需要等待一个事件完成时,使用wait_queue机制能减少进程同步的开销。相比于滥用自旋锁以及信号量,或者是循环使用usleep(1000)这样的函数来完成同步,wait_queue是一个高效的解决方案。
 
 :::{warning}
-`wait_queue.h`中的等待队列的实现并没有把队列头独立出来,同时没有考虑为等待队列加锁。所以在后来的开发中加入了`wait_queue_head.h`的队列头实现,实质上就是链表+自锁。它与`wait_queue.h`中的队列是兼容的,当你使用`struct wait_queue_head`作为队列头时,你同样可以使用等待队列添加节点的函数。
+`wait_queue.h`中的等待队列的实现并没有把队列头独立出来,同时没有考虑为等待队列加锁。所以在后来的开发中加入了`wait_queue_head.h`的队列头实现,实质上就是链表+自锁。它与`wait_queue.h`中的队列是兼容的,当你使用`struct wait_queue_head`作为队列头时,你同样可以使用等待队列添加节点的函数。
 
 但是在之后的版本中可能会把两者合并,目前仍然没有进行,且存在头文件相互引用的问题: 
  - "spin_lock.h" 引用了 "wait_queue.h"

+ 4 - 6
kernel/process/process.c

@@ -136,10 +136,8 @@ void __switch_to(struct process_control_block *prev, struct process_control_bloc
     //           initial_tss[0].ist2, initial_tss[0].ist3, initial_tss[0].ist4, initial_tss[0].ist5,
     //           initial_tss[0].ist6, initial_tss[0].ist7);
 
-    __asm__ __volatile__("movq	%%fs,	%0 \n\t"
-                         : "=a"(prev->thread->fs));
-    __asm__ __volatile__("movq	%%gs,	%0 \n\t"
-                         : "=a"(prev->thread->gs));
+    __asm__ __volatile__("movq	%%fs,	%0 \n\t" : "=a"(prev->thread->fs));
+    __asm__ __volatile__("movq	%%gs,	%0 \n\t" : "=a"(prev->thread->gs));
 
     __asm__ __volatile__("movq	%0,	%%fs \n\t" ::"a"(next->thread->fs));
     __asm__ __volatile__("movq	%0,	%%gs \n\t" ::"a"(next->thread->gs));
@@ -1176,8 +1174,8 @@ int process_release_pcb(struct process_control_block *pcb)
 {
     // 释放子进程的页表
     process_exit_mm(pcb);
-    // 释放子进程的pcb
-    free_kthread_struct(pcb);
+    if ((pcb->flags & PF_KTHREAD))  // 释放内核线程的worker private结构体
+        free_kthread_struct(pcb);
     kfree(pcb);
     return 0;
 }

+ 14 - 6
user/apps/about/about.c

@@ -1,8 +1,8 @@
+#include <libc/math.h>
 #include <libc/stdio.h>
 #include <libc/stdlib.h>
-#include <libc/unistd.h>
 #include <libc/time.h>
-#include <libc/math.h>
+#include <libc/unistd.h>
 
 void print_ascii_logo()
 {
@@ -16,19 +16,27 @@ void print_ascii_logo()
 void print_copyright()
 {
     printf(" DragonOS - An opensource operating system.\n");
-    printf(" Copyright: fslongjin. 2022, All rights reserved.\n");
+    printf(" Copyright: fslongjin & DragonOS Community. 2022, All rights reserved.\n");
+    printf(" Version: ");
+    put_string("V0.1.0 - 20221106\n", COLOR_GREEN, COLOR_BLACK);
     printf(" You can visit the project via:\n");
     printf("\n");
-    put_string("    https://github.com/fslongjin/DragonOS\n", COLOR_ORANGE, COLOR_BLACK);
+    put_string("    Official Website: https://DragonOS.org\n", COLOR_INDIGO, COLOR_BLACK);
+    put_string("    GitHub: https://github.com/fslongjin/DragonOS\n", COLOR_ORANGE, COLOR_BLACK);
     printf("\n");
-    printf("    Email: longjin@RinGoTek.cn\n");
+    printf(" Maintainer: longjin <longjin@RinGoTek.cn>\n");
+    printf(" Get contact with the community: <contact@DragonOS.org>\n");
+    printf("\n");
+    printf(" If you find any problems during use, please visit:\n");
+    put_string("    https://bbs.DragonOS.org\n", COLOR_ORANGE, COLOR_BLACK);
     printf("\n");
 }
+
 int main()
 {
     // printf("Hello World!\n");
     print_ascii_logo();
-    
+
     print_copyright();
     // exit(0);
     // while (1)