Git Product home page Git Product logo

dragonos-community / dragonos Goto Github PK

View Code? Open in Web Editor NEW
818.0 18.0 132.0 9.89 MB

使用Rust从0自研内核,具有Linux兼容性的操作系统,面向云计算轻量化场景而设计。DragonOS is an operating system developed from scratch using Rust, with Linux compatibility. It is designed for lightweight cloud computing scenarios.

Home Page: https://dragonos.org

License: GNU General Public License v2.0

Assembly 0.79% Shell 1.40% C 4.74% Makefile 0.90% GDB 0.01% Python 0.04% Rust 92.07% Dockerfile 0.06%
os operating-system rust

dragonos's Introduction

dragonos-logo

打造完全自主可控的数字化未来!

官网 bbs


DragonOS

Languages 中文|English

 

  DragonOS龙操作系统是一个面向云计算轻量化场景的,完全自主内核的,提供Linux二进制兼容性的64位操作系统。它使用Rust语言进行开发,以提供更好的可靠性。目前在Rust操作系统领域,DragonOS在Github排行全国稳居前三位。

  DragonOS开源社区成立于2022年7月,它完全商业中立。我们的目标是,构建一个完全独立自主的、开源的、高性能及高可靠性的服务器操作系统,打造完全自主可控的数字化未来!

  DragonOS具有优秀的、完善的架构设计。相比于同体量的其他系统,DragonOS支持虚拟化,并在设备模型、调度子系统等方面具有一定优势。当前正在大力推进云平台支持、riscv支持等工作,以及编译器、应用软件的移植。力求在5年内实现生产环境大规模应用。

  DragonOS目前在社区驱动下正在快速发展中,目前DragonOS已经实现了约1/4的Linux接口,在未来我们将提供对Linux的100%兼容性,并且提供新特性。

关于DragonOS,你想了解的都在这儿 - DragonOS

网站

如何运行?

  运行DragonOS的步骤非常简单,您可以参考以下几个资料,在最短15分钟内运行DragonOS!

系统特性

  请参见文档:系统特性

如何加入?

  如果你愿意加入我们,你可以查看issue,并在issue下发表讨论、想法,或者访问DragonOS的论坛,了解开发动态、开发任务: https://bbs.dragonos.org.cn

  你也可以带着你的创意与想法,和社区的小伙伴一起讨论,为DragonOS创造一些新的功能。

如何与社区建立联系?

  你可以发邮件给Maintainer: longjin,邮件地址是 [email protected]

  或者是加入我们的开发交流QQ群:115763565

  对于正式问题的讨论,请在 https://bbs.dragonos.org.cn 上的对应板块,使用正式的语言发帖讨论。亦或者是在本仓库的issue下提出问题。

贡献者名单

Contributors to DragonOS-Community/DragonOS · GitHub

联系我们

社区对外联系邮箱:[email protected]

社区负责人邮箱:[email protected]

赞助

  DragonOS是一个公益性质的开源项目,但是它的发展离不开资金的支持,如果您愿意的话,可以通过 赞助 - DragonOS ,从而促进这个项目的发展。所有的赞助者的名单都会被公示。您的每一分赞助,都会为DragonOS的发展作出贡献!

赞助的资金都会被用到哪里?

我们保证,所有赞助的资金及物品,将会用于:

  • 为活跃的社区开发者发放补贴或设备支持

  • DragonOS的云服务开支

  • 设备购置

  • 任何有助于DragonOS发展建设的用途

赞助商列表

  • **雅云 雅安数字经济运营有限公司为DragonOS提供了云服务器支持。

个人赞赏者列表

开放源代码声明

本项目采用GPLv2协议进行开源,欢迎您在遵守开源协议的基础之上,使用本项目的代码!

我们支持:遵守协议的情况下,利用此项目,创造更大的价值,并为本项目贡献代码。

我们谴责:任何不遵守开源协议的行为。包括但不限于:剽窃该项目的代码作为你的毕业设计等学术不端行为以及商业闭源使用而不付费。

若您发现了任何违背开源协议的使用行为,我们欢迎您发邮件反馈!让我们共同建设诚信的开源社区。

参考资料

  本项目参考了以下资料,我对这些项目、书籍、文档的作者表示感谢!

dragonos's People

Contributors

1037827920 avatar 2447742618 avatar albertsanoe avatar ccrysisa avatar chiichen avatar dajiyuqia avatar donjuanplatinum avatar fslongjin avatar gnociyeh avatar guanjinquan avatar hanjiezhou avatar hoshuchiu avatar houmkh avatar jomocool avatar kkkkkong avatar laokengwt avatar luojia65 avatar matrikslee avatar memoryshore avatar sun5etop avatar tingshub avatar ttaq avatar wang904 avatar xiaolin2004 avatar yjwu2023 avatar yuyi2439 avatar zhaoyao73 avatar zwb0x00 avatar zzjjwarth avatar zzy666-hw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dragonos's Issues

如何贡献代码

Hi,看了下这个repo感觉十分感兴趣,但是自己对于操作系统方面的知识比较匮乏,想问下如何共享代码

[BUG] field `bus_device_function` is never read

描述错误
我使用vscode阅读代码,发现在文件transport_pci.rs中报错了
具体内容如下

warning: field `bus_device_function` is never read
  --> src/driver/virtio/transport_pci.rs:80:5
   |
77 | pub struct PciTransport {
   |            ------------ field in this struct
...
80 |     bus_device_function: BusDeviceFunction,
   |     ^^^^^^^^^^^^^^^^^^^
   |
   = note: `PciTransport` has derived impls for the traits `Clone` and `Debug`, but these are intentionally ignored during dead code analysis
   = note: `#[warn(dead_code)]` on by default

请填写您的电脑的信息:

  • DragonOS版本:863a3cff

修复方法
我觉得把bus_device_function重命名为_bus_device_function能解决这个问题

[BUG] 显示大量字符时会出现严重错误(估计是stdio的问题)

描述错误
显示大约18907(serial_opt.txt的长度)个字符时就会崩溃,在这之后系统的stdout就会出错,无法输出字符(包括'\b')
但是shell中添加的光标是可以显示的(光标用的是put_string),但因为此错误导致无法输出'\b'(printf),所以无法清除上一个光标

请填写您的电脑的信息:

  • 操作系统及版本:[例如,Ubuntu 22.04]
  • DragonOS版本:[版本号或git提交哈希值]
  • DADK版本:[通过dadk --version获取]
  • Rust版本:[在DragonOS目录下使用rustc --version获取]

重现步骤
重现行为的步骤:

  1. 启动系统
  2. 想办法输出大量字符(一直按回车,或者cat /usr/include/下面的文件)

期望行为
正常输出字符

系统日志
在进入shell后无任何报错

Todo: 编写tty的实际功能

  1. 在键盘中断后,将键盘数据传给tty驱动程序
  2. tty向textui输出字符
  3. 基于devfs实现的用户态接口

bug: 在仅支持xapic的物理机/bochs虚拟机上启动时,遇到中断异常问题

bug: 在仅支持xapic的物理机或bochs虚拟机上启动时,当apic初始化完毕后,会收到未知的中断。出现在irq.h的apic_init()函数中,sti()后将收到该中断。
经分析,该中断来源于连接着类8259PIC的时钟。
但是问题在于:
初始化apic时,已向0x21、0xa1端口写入了0xff以屏蔽中断。但貌似这些屏蔽没有用。

[FEATURE] 添加sscanf()函数

您的功能请求是否与问题/故障有关?请描述一下。
我希望使用sscanf()函数来便捷的实现free指令(因为需要从meminfo文件中读取并格式化数据

描述您想要的解决方案
在stdio.h中添加sscanf()函数

[BUG] 关于time.h 的vma错误

错误描述

使用正常方式调用time.h中的usleep函数
usleep(500000)
出现错误,但是休眠功能完好,确实暂停了

环境:docker

错误信息(照片):

debug_text

test.elf 源代码:

#include<libc/stdio.h>
#include<libc/time.h>
int main(){
    usleep(500000);
    printf("HelloStop!\n");
    return 0;
}

通过手动编译安装qemu所需要的依赖包

sudo apt install autoconf automake autotools-dev curl libmpc-dev libmpfr-dev libgmp-dev \
              gawk build-essential bison flex texinfo gperf libtool patchutils bc \
              zlib1g-dev libexpat-dev pkg-config  libglib2.0-dev libpixman-1-dev libsdl2-dev \
              git tmux python3 python3-pip ninja-build

Crash happened when pressing space key and enter key at the same time.

Forgive me for typing this in English, due to missing Chinese input method in my development environment for OS :(
I remembered once a comrade in qq group has mentioned that crash would happened when pressing random times of enter key.
This might be a certain way to reappear it, effective whenever kernel initializing program is running or user land program has successfully booted.
Whole serial port output is pasted here:

uart init
Video driver initialized.
textui_install_handlertextui_enable_handler
text ui initialized
[ INFO ] Kernel Starting...

[ DEBUG ] (main.c:79)	_stack_start=0xffff800000278000

[ INFO ] Initializing memory management unit...

[ INFO ] Total amounts of RAM : 4580352 bytes

[ INFO ] Total amounts of 2M pages : 254.

[ INFO ] Memory management unit initialize complete!

[ INFO ] Initializing SLAB...

[ INFO ] SLAB initialized successfully!

[ INFO ] Re-Initializing page table...

[ INFO ] Page table Initialized. Affects:254

[ INFO ] mmio_init success

[ INFO ] Re-mapping VBE frame buffer...

[ INFO ] VBE frame buffer successfully Re-mapped!

[ INFO ] Initializing ACPI...

[ DEBUG ] (acpi.c:196)	rsdpv1->RsdtAddress=0x000000001ffe196e

[ DEBUG ] (acpi.c:207)	RSDT mapped!

RSDT Length=52bytes.

RSDT Entry num=4

[ INFO ] ACPI module initialized!

[ DEBUG ] (src/sched/rt.rs:28)	rt scheduler init

[ DEBUG ] (apic/apic.c:374)	8259A Masked.

[ DEBUG ] (apic/apic.c:290)	This computer support APIC&xAPIC

[ DEBUG ] (apic/apic.c:304)	This computer support x2APIC

[ INFO ] xAPIC & x2APIC enabled!

[ INFO ] APIC Software Enabled.

[ DEBUG ] (apic/apic.c:240)	local APIC Version:0x00000014,Max LVT Entry:0x00000006,SVR(Suppress EOI Broadcast):0x00	

[ DEBUG ] (apic/apic.c:246)	Integrated APIC.

[ DEBUG ] (apic/apic.c:266)	All LVT Masked

[ DEBUG ] (apic/apic.c:104)	IO APIC Version=17, Max Redirection Entries=24

[ WARN ] Cannot get RCBA address. RCBA_phys=0xffffffff

[ INFO ] Initializing syscall...

[ DEBUG ] (timer.c:32)	timer func initialized.

[ DEBUG ] (smp.c:57)	total_processor_num=2

[ DEBUG ] (smp.c:68)	[core 0] acpi processor UID=0, APIC ID=0, flags=0x00000001

[ DEBUG ] (smp.c:68)	[core 1] acpi processor UID=1, APIC ID=1, flags=0x00000001

[ SUCCESS ] AP core 1 successfully started!

[ INFO ] [ INFO ] Initializing AP-core's local apic...Cleaning page table remapping...



[ INFO ] [ DEBUG ] (smp.c:139)	xAPIC & x2APIC enabled!

init proc's preempt_count=0[ INFO ] 

APIC Software Enabled.[ INFO ] Successfully cleaned page table remapping!



[ DEBUG ] (apic/apic.c:240)	[ INFO ] ProcFS mounted.

local APIC Version:0x00000014,Max LVT Entry:0x00000006,SVR(Suppress EOI Broadcast):0x00	[ INFO ] DevFS mounted.


[ INFO ] Successfully initialized VFS!

[ DEBUG ] (apic/apic.c:246)	[ INFO ] CPU manufacturer: GenuineIntel

Integrated APIC.[ INFO ] CPU Brand Name: Intel Xeon E3-12xx v2 (Ivy Bridge)


[ DEBUG ] (apic/apic.c:266)	[ INFO ] All LVT MaskedFamily ID=0x6	 Extended Family ID=0x0	 Processor Type=0x0	


[ INFO ] Model ID=0xa	 Extended Model ID=0x3	Stepping ID=0x9	

[ INFO ] Cpu_max_phys_addrline_size = 40

[ INFO ] Cpu_max_linear_addrline_size = 48

[ INFO ] Max basic mop=0x014

[ INFO ] Max extended mop=0x8000000a

[ INFO ] ps/2 keyboard registered.

[ INFO ] Initializing PCI bus...

[ INFO ] Checking all devices in PCI bus...

[ INFO ] Total pci device and function num = 5

[ INFO ] [ pci device 0 ] class code = 6	subclass=0	status=0x00000000	

[ INFO ] [ pci device 1 ] class code = 12	subclass=3	status=0x00000010	cap_pointer=0x00000090	bar5=0x00000000, vendor=0x001b36, device id=0x00000d

[ INFO ] [ pci device 2 ] class code = 1	subclass=6	status=0x00000010	cap_pointer=0x00000080	bar5=0xfeb95000, vendor=0x008086, device id=0x002922

[ INFO ] [ pci device 3 ] class code = 2	subclass=0	status=0x00000010	cap_pointer=0x00000084	bar5=0x00000000, vendor=0x001af4, device id=0x001000

[ INFO ] [ pci device 4 ] class code = 3	subclass=0	status=0x00000000	

[ INFO ] PCI bus initialized.

[ INFO ] Initializing HPET...

[ DEBUG ] (HPET/HPET.c:272)	hpet_table->address=0x00000000fed00000

[ DEBUG ] (HPET/HPET.c:274)	HPET_REG_BASE=0xffffa000fed00000

[ DEBUG ] (HPET/HPET.c:283)	HPET_COUNTER_CLK_PERIOD=0x0000000000989680

[ INFO ] Total HPET timers: 2

[ INFO ] HPET driver Initialized.

[ INFO ] Measuring local APIC timer's frequency...

[ INFO ] Local APIC timer's freq: 329797 ticks/ms.

[ INFO ] TSC frequency: 2826MHz

[ INFO ] Initializing process...

[ DEBUG ] (process.c:708)	Initial process to init files

[ DEBUG ] (process.c:710)	Initial process init files ok

[ INFO ] Initializing kthread mechanism...

[ INFO ] HPET0 enabled.

[ INFO ] Initializing apic timer for cpu 0

[ INFO ] Initializing apic timer for cpu 1(test_timer)

[ INFO ] kthread daemon started![ INFO ] 

initial proc running...	arg:0x000000000000000a, vruntime=0

##init double buffer##
##to change double buffer##
[ DEBUG ] (src/exception/softirq.rs:228)	SOftirq: unregister 1

[ DEBUG ] (src/exception/softirq.rs:228)	SOftirq: unregister 1

##initialized double buffer##
[ INFO ] Initializing AHCI...

[ DEBUG ] (pci.c:492)	[2]  class_code=1, sub_class=6, progIF=1, bar5=0xfeb95000

[ INFO ] ABAR mapped!

[ DEBUG ] (src/driver/disk/ahci/mod.rs:106)	<ahci_rust_init> Find a SATA type Disk.

[ DEBUG ] (src/driver/disk/ahci/mod.rs:136)	start register ahci device

[ DEBUG ] (src/driver/disk/ahci/mod.rs:100)	<ahci_rust_init> Find a None type Disk.

[ DEBUG ] (src/driver/disk/ahci/mod.rs:100)	<ahci_rust_init> Find a None type Disk.

[ DEBUG ] (src/driver/disk/ahci/mod.rs:100)	<ahci_rust_init> Find a None type Disk.

[ DEBUG ] (src/driver/disk/ahci/mod.rs:100)	<ahci_rust_init> Find a None type Disk.

[ DEBUG ] (src/driver/disk/ahci/mod.rs:100)	<ahci_rust_init> Find a None type Disk.

[ INFO ] Try to mount FAT32 as root fs...

[ INFO ] VFS: Migrating filesystems...

[ INFO ] VFS: Migrate filesystems done!

[ INFO ] Successfully migrate rootfs to FAT32!

[ DEBUG ] (pci.c:492)	[3]  class_code=2, sub_class=0, progIF=0, bar5=0x00000000

[ DEBUG ] (src/driver/pci/pci.rs:438)	pci_device_bar:

Bar0:I/O space at 0x0000c020, size 32

 Bar1:Unused bar

 Bar2:Unused bar

 Bar3:Unused bar

Bar4:Memory space at 0xfe000000, size 16384, type Width64, prefetchable true,mapped at 0xffffa1ffffbfc000

Bar5:Unused bar

[ DEBUG ] (src/driver/virtio/virtio.rs:22)	Detected virtio PCI device with device type Network, features 0x0000000130bf8024

[ DEBUG ] (src/driver/virtio/virtio.rs:85)	Virtio-net driver init successfully.

[ DEBUG ] (src/driver/virtio/virtio.rs:101)	Virtio-net can send

[ DEBUG ] (src/driver/virtio/virtio.rs:120)	virtio_net send success

[ DEBUG ] (src/driver/virtio/virtio.rs:129)	virtio_net MAC=[82, 84, 0, 18, 52, 86]

[ DEBUG ] (src/driver/virtio/virtio.rs:130)	virtio-net test finished

[ INFO ] LZ4 lib Version=1.9.3

__rust_demo_func()

[ DEBUG ] (process.c:593)	in initial_kernel_thread: flags=4



 ____                                      ___   ____ 

|  _ \  _ __   __ _   __ _   ___   _ __   / _ \ / ___| 

| | | || '__| / _` | / _` | / _ \ | '_ \ | | | |\___ \  

| |_| || |   | (_| || (_| || (_) || | | || |_| | ___) |

|____/ |_|    \__,_| \__, | \___/ |_| |_| \___/ |____/ 

                     |___/     



[DragonOS] / #  �

[DragonOS] / #  �

[DragonOS] / #  �

[DragonOS] / #  �

[DragonOS] / #  �

[DragonOS] / #  �

[DragonOS] / #  �

[DragonOS] / #  �

[DragonOS] / #  �

[DragonOS] / #  �

[DragonOS] / #  �

[DragonOS] / #  �

[DragonOS] / #  �

[DragonOS] / #  �  �[ ERROR ] do_page_fault(14),Error code :0x0000000000000004,RSP:0x00006ffff09ffd00, RBP=0x00006ffff09ffd28, RIP:0x0000000000803fde CPU:0, pid=1


[ ERROR ] regs->rax = 0x0000000000801a63


Page Not-Present,	Read Cause Fault,	Fault in user(3)	

CR2:0x0000000000000000

Kernel traceback: Fault in userland. pid=1, rbp=0x00006ffff09ffd28

Wish you good luck for debugging~

启动时画面有几率卡死

画面输出会卡死在这一行:

initial proc running...	arg:0x000000000000000a, vruntime=0[ INFO ] 

以下是串口输出的全文(后面一直在死循环,太长了就不放了):

uart init
Video driver initialized.
textui_install_handlertextui_enable_handler
text ui initialized
[ INFO ] Kernel Starting...

[ DEBUG ] (main.c:80)	_stack_start=0xffff800000278000

[ INFO ] Initializing memory management unit...

[ INFO ] Total amounts of RAM : 4580352 bytes

[ INFO ] Total amounts of 2M pages : 254.

[ INFO ] Memory management unit initialize complete!

[ INFO ] Initializing SLAB...

[ INFO ] SLAB initialized successfully!

[ INFO ] Re-Initializing page table...

[ INFO ] Page table Initialized. Affects:254

[ INFO ] mmio_init success

[ INFO ] Re-mapping VBE frame buffer...

[ INFO ] VBE frame buffer successfully Re-mapped!

[ INFO ] Initializing ACPI...

[ DEBUG ] (acpi.c:196)	rsdpv1->RsdtAddress=0x000000001ffe196e

[ DEBUG ] (acpi.c:207)	RSDT mapped!

RSDT Length=52bytes.

RSDT Entry num=4

[ INFO ] ACPI module initialized!

[ DEBUG ] (src/sched/rt.rs:28)	rt scheduler init

[ DEBUG ] (apic/apic.c:374)	8259A Masked.

[ DEBUG ] (apic/apic.c:290)	This computer support APIC&xAPIC

[ DEBUG ] (apic/apic.c:304)	This computer support x2APIC

[ INFO ] xAPIC & x2APIC enabled!

[ INFO ] APIC Software Enabled.

[ DEBUG ] (apic/apic.c:240)	local APIC Version:0x00000014,Max LVT Entry:0x00000006,SVR(Suppress EOI Broadcast):0x00	

[ DEBUG ] (apic/apic.c:246)	Integrated APIC.

[ DEBUG ] (apic/apic.c:266)	All LVT Masked

[ DEBUG ] (apic/apic.c:104)	IO APIC Version=17, Max Redirection Entries=24

[ WARN ] Cannot get RCBA address. RCBA_phys=0xffffffff

[ INFO ] Initializing softirq...

[ INFO ] Initializing syscall...

[ DEBUG ] (src/time/timer.rs:177)	timer initiated successfully

[ DEBUG ] (smp.c:57)	total_processor_num=2

[ DEBUG ] (smp.c:68)	[core 0] acpi processor UID=0, APIC ID=0, flags=0x00000001

[ DEBUG ] (smp.c:68)	[core 1] acpi processor UID=1, APIC ID=1, flags=0x00000001

[ SUCCESS ] AP core 1 successfully started!

[ INFO ] [ INFO ] Initializing AP-core's local apic...Cleaning page table remapping...



[ DEBUG ] (smp.c:139)	[ INFO ] init proc's preempt_count=0xAPIC & x2APIC enabled!


[ INFO ] [ INFO ] APIC Software Enabled.Successfully cleaned page table remapping!



[ DEBUG ] (apic/apic.c:240)	[ INFO ] ProcFS mounted.

local APIC Version:0x00000014,Max LVT Entry:0x00000006,SVR(Suppress EOI Broadcast):0x00	[ INFO ] DevFS mounted.


[ INFO ] Successfully initialized VFS!

[ DEBUG ] (apic/apic.c:246)	[ INFO ] Integrated APIC.CPU manufacturer: GenuineIntel


[ DEBUG ] (apic/apic.c:266)	[ INFO ] All LVT MaskedCPU Brand Name: Intel Xeon E3-12xx v2 (Ivy Bridge)


[ INFO ] Family ID=0x6	 Extended Family ID=0x0	 Processor Type=0x0	

[ INFO ] Model ID=0xa	 Extended Model ID=0x3	Stepping ID=0x9	

[ INFO ] Cpu_max_phys_addrline_size = 40

[ INFO ] Cpu_max_linear_addrline_size = 48

[ INFO ] Max basic mop=0x014

[ INFO ] Max extended mop=0x8000000a

[ INFO ] ps/2 keyboard registered.

[ INFO ] Initializing PCI bus...

[ INFO ] Checking all devices in PCI bus...

[ INFO ] Total pci device and function num = 5

[ INFO ] [ pci device 0 ] class code = 6	subclass=0	status=0x00000000	

[ INFO ] [ pci device 1 ] class code = 12	subclass=3	status=0x00000010	cap_pointer=0x00000090	bar5=0x00000000, vendor=0x001b36, device id=0x00000d

[ INFO ] [ pci device 2 ] class code = 1	subclass=6	status=0x00000010	cap_pointer=0x00000080	bar5=0xfeb95000, vendor=0x008086, device id=0x002922

[ INFO ] [ pci device 3 ] class code = 2	subclass=0	status=0x00000010	cap_pointer=0x00000084	bar5=0x00000000, vendor=0x001af4, device id=0x001000

[ INFO ] [ pci device 4 ] class code = 3	subclass=0	status=0x00000000	

[ INFO ] PCI bus initialized.

[ INFO ] Initializing HPET...

[ DEBUG ] (HPET/HPET.c:272)	hpet_table->address=0x00000000fed00000

[ DEBUG ] (HPET/HPET.c:274)	HPET_REG_BASE=0xffffa000fed00000

[ DEBUG ] (HPET/HPET.c:283)	HPET_COUNTER_CLK_PERIOD=0x0000000000989680

[ INFO ] Total HPET timers: 2

[ INFO ] HPET driver Initialized.

[ INFO ] Measuring local APIC timer's frequency...

[ INFO ] Local APIC timer's freq: 324283 ticks/ms.

[ INFO ] TSC frequency: 2806MHz

[ INFO ] Initializing process...

[ DEBUG ] (process.c:708)	Initial process to init files

[ DEBUG ] (process.c:710)	Initial process init files ok

[ INFO ] Initializing kthread mechanism...

[ INFO ] HPET0 enabled.

[ INFO ] Initializing apic timer for cpu 0

[ INFO ] Initializing apic timer for cpu 1[ INFO ] 

initial proc running...	arg:0x000000000000000a, vruntime=0[ INFO ] 

##kitnhirt edaoudb ldea ebmuofnf esrt#a#r
t#e#dt!o
 c
hange double buffer##
[ DEBUG ] (video.c:148)	register softirq video done

#[# iEnRiRtOiRa l]i dzoe_dp daoubgele_ fbuafufelr#t#(1
4),Error code :0x0000000000000000,RSP:0xffff80000182ff80, RBP=0xffff80000182ffb0, RIP:0xffff800000133afd CPU:1, pid=3

[ INFO ] 

Initializing AHCI...[ 

ERROR[ DEBUG ] (pci.c:492)	 ] [2]  class_code=1, sub_class=6, progIF=1, bar5=0xfeb95000regs->rax = 0x0000000000000000



[ INFO ] Page Not-Present,	ABAR mapped!Read Cause Fault,	

Fault in supervisor(0,1,2)	[ DEBUG ] (src/driver/disk/ahci/mod.rs:106)	<ahci_rust_init> Find a SATA type Disk.


[ DEBUG ] (src/driver/disk/ahci/mod.rs:136)	start register ahci device

CR2:0x0000000000000000

[ DEBUG ] (src/driver/disk/ahci/mod.rs:100)	<ahci_rust_init> Find a None type Disk.

======== Kernel traceback =======

[ DEBUG ] (src/driver/disk/ahci/mod.rs:100)	<ahci_rust_init> Find a None type Disk.

function:video_refresh_daemon() 	(+) 0105 address:0xffff800000133afd

[ DEBUG ] (src/driver/disk/ahci/mod.rs:100)	<ahci_rust_init> Find a None type Disk.

rbp:0xffff80000182ffb0,*rbp:0xffff80000182fff0

[ DEBUG ] (src/driver/disk/ahci/mod.rs:100)	<ahci_rust_init> Find a None type Disk.


[ DEBUG ] (src/driver/disk/ahci/mod.rs:100)	<ahci_rust_init> Find a None type Disk.

function:kthread() 	(+) 0153 address:0xffff800000147884

[ INFO ] Try to mount FAT32 as root fs...

rbp:0xffff80000182fff0,*rbp:0x0000000000000000

[ INFO ] VFS: Migrating filesystems...


function:kernel_thread_func() 	(+) 0045 address:0xffff80000014a0d9

[ INFO ] VFS: Migrate filesystems done!

======== Kernel traceback end =======

[ INFO ] Successfully migrate rootfs to FAT32!

[ [ DEBUG ] (pci.c:492)	[3]  class_code=2, sub_class=0, progIF=0, bar5=0x00000000

[ DEBUG ] (src/driver/pci/pci.rs:438)	pci_device_bar:

Bar0:I/O space at 0x0000c020, size 32

 Bar1:Unused bar

 Bar2:Unused bar

 Bar3:Unused bar

Bar4:Memory space at 0xfe000000, size 16384, type Width64, prefetchable true,mapped at 0xffffa1ffffbfc000

Bar5:Unused bar

[ DEBUG ] (src/driver/virtio/virtio.rs:22)	Detected virtio PCI device with device type Network, features 0x0000000130bf8024

[ DEBUG ] (src/driver/virtio/virtio.rs:85)	Virtio-net driver init successfully.

[ DEBUG ] (src/driver/virtio/virtio.rs:129)	virtio_net MAC=[82, 84, 0, 18, 52, 86]

[ DEBUG ] (src/driver/virtio/virtio.rs:130)	virtio-net test finished

[ INFO ] LZ4 lib Version=1.9.3

__rust_demo_func()

[ DEBUG ] (process.c:593)	in initial_kernel_thread: flags=4



 ____                                      ___   ____ 

|  _ \  _ __   __ _   __ _   ___   _ __   / _ \ / ___| 

| | | || '__| / _` | / _` | / _ \ | 'ERR_O R\  ]| d o|_ pa| ge|_\_f_aul_t( 14\) , Er

r|o r |c_o|d e| |: 0|x 0 0 0|0 0(0_0|0 0|0|0 0(0_0|00 ,|R|S P(:_0x)ff f|f8|0 0|00 18|2 f|f|80 ,| _R|BP =| 0_x_f_f)f f|8

0|0_0_0_1_8/2 ff|b_0|,   R I P\:_0_x,f_ff|f 8\000_0_0,1 3|3 af\d_ C_P_U/:1 , |p_i|d =|3_

|

 [\ _E_R_R/O R| _]_ _r_e/g s

- > r a x   =   0 x 0 00 00 00 0 0 0 0 00 0 00 


|P_a_g_e/  N o t-P r e

s

e

n[tD,r	aRgeoandO SC]a u/s e#  Fault,	 Fault in supervisor(0,1,2)	

CR2:0x0000000000000000

======== Kernel traceback =======

function:video_refresh_daemon() 	(+) 0105 address:0xffff800000133afd

rbp:0xffff80000182ffb0,*rbp:0xffff80000182fff0


function:kthread() 	(+) 0153 address:0xffff800000147884

rbp:0xffff80000182fff0,*rbp:0x0000000000000000


function:kernel_thread_func() 	(+) 0045 address:0xffff80000014a0d9

======== Kernel traceback end =======

[ ERROR ] do_page_fault(14),Error code :0x0000000000000000,RSP:0xffff80000182ff80, RBP=0xffff80000182ffb0, RIP:0xffff800000133afd CPU:1, pid=3


[ ERROR ] regs->rax = 0x0000000000000000


Page Not-Present,	Read Cause Fault,	Fault in supervisor(0,1,2)	

CR2:0x0000000000000000

======== Kernel traceback =======

function:video_refresh_daemon() 	(+) 0105 address:0xffff800000133afd

rbp:0xffff80000182ffb0,*rbp:0xffff80000182fff0


function:kthread() 	(+) 0153 address:0xffff800000147884

rbp:0xffff80000182fff0,*rbp:0x0000000000000000


function:kernel_thread_func() 	(+) 0045 address:0xffff80000014a0d9

======== Kernel traceback end =======

[ ERROR ] do_page_fault(14),Error code :0x0000000000000000,RSP:0xffff80000182ff80, RBP=0xffff80000182ffb0, RIP:0xffff800000133afd CPU:1, pid=3


[ ERROR ] regs->rax = 0x0000000000000000


Page Not-Present,	Read Cause Fault,	Fault in supervisor(0,1,2)	

CR2:0x0000000000000000

======== Kernel traceback =======

function:video_refresh_daemon() 	(+) 0105 address:0xffff800000133afd

rbp:0xffff80000182ffb0,*rbp:0xffff80000182fff0


function:kthread() 	(+) 0153 address:0xffff800000147884

rbp:0xffff80000182fff0,*rbp:0x0000000000000000

[BUG] 进程退出后,相关的socket没有被释放。

描述错误
进程被kill后,如果它监听了网络端口,相关的socket没有被释放。

请填写您的电脑的信息:

  • 操作系统及版本:Ubuntu 22.04
  • DragonOS版本:91e9d4a
  • DADK版本:0.1.6
  • Rust版本:2023-08-15

重现步骤
重现行为的步骤:

  1. 终端执行 http_server &
  2. kill掉刚才那个http_server进程
  3. 再次运行步骤1
  4. 报错提示bind failed: Address already in use

期望行为
第二次运行能够正常启动http_server

屏幕截图

image

[BUG] cmd.c好像没有stdbool.h

描述错误
我注意到cmd.c里面有关于bool的代码,但是没有包含stdbool.h

请填写您的电脑的信息:

  • 操作系统及版本:wsl2-Ubuntu 22.04
  • DragonOS版本:863a3cf
  • DADK版本:dadk 0.1.2
  • Rust版本:rustc 1.74.0-nightly (59a829484 2023-08-30)

切换目录的时候与..相关的若干bug

示例:

  • cd bin/..会跳转到一个提示为bin/..的目录下,该目录执行ls会输出一个名为c的文件
  • 执行cd ../..的时候,如果目录深度足够,则会跳转到{dir}/../..,如果目录深度不足则报错

总之需要对..进行额外检查

另外cd //会跳转到//下,ls显示正常,此时cd bin/..会跳转到///bin/..下

关于xHCI中断处理的一个问题

问题

在xhci中断处理最后向Event Ring Dequeue Pointer Register(ERDP)寄存器中写入的值是否正确?

描述

在参阅xhci.c源码时发现在xhci_hc_irq_handler中断处理函数中,当结束对event ring中event trb的处理后,向ERDP寄存器写入了新的dequeue pointer值,写入的新值为virt_2_phys(last_event_ring_vaddr),即最后一个处理完的event trb的地址。

            last_event_ring_vaddr = xhci_hc[cid].current_event_ring_vaddr;
            xhci_hc[cid].current_event_ring_vaddr += sizeof(struct xhci_TRB_t);
            ......
            xhci_write_intr_reg64(cid, 0, XHCI_IR_DEQUEUE, virt_2_phys(last_event_ring_vaddr) | (1 << 3));

但是,我在参阅其他XHCI相应源码时发现,其向中断处理后向ERDP写入的值是下一个要处理的event trb地址,以上述代码为例应该是如下所示:

            xhci_hc[cid].current_event_ring_vaddr += sizeof(struct xhci_TRB_t);
            ......
            xhci_write_intr_reg64(cid, 0, XHCI_IR_DEQUEUE, virt_2_phys( xhci_hc[cid].current_event_ring_vaddr) | (1 << 3));

以下是我参阅的其他XHCI源码:

//[haikuOS]:src/add-ons/kernel/busses/usb/xhci.cpp:ProcessEvents()
	......
	uint16 i = fEventIdx;
	......
	HandleXXX(&fEventRing[i]);
	......
	i++;
	fEventIdx = i;
	......
	uint64 addr = fErst->rs_addr + i * sizeof(xhci_trb);
	WriteRunReg32(XHCI_ERDP_LO(0), (uint32)addr | ERDP_BUSY);
	WriteRunReg32(XHCI_ERDP_HI(0), (uint32)(addr >> 32));
//[linux2.6.39]:drivers/usb/host/xhci-ring.c:xhci_irq(struct usb_hcd *hcd)
	......
	event_ring_deq = xhci->event_ring->dequeue;
	xhci_handle_event(xhci);
	temp_64 = xhci_read_64(xhci, &xhci->ir_set->erst_dequeue);
	if (event_ring_deq != xhci->event_ring->dequeue) {
		deq = xhci_trb_virt_to_dma(xhci->event_ring->deq_seg,
				xhci->event_ring->dequeue);
		if (deq == 0)
			xhci_warn(xhci, "WARN something wrong with SW event "
					"ring dequeue ptr.\n");
		/* Update HC event ring dequeue pointer */
		temp_64 &= ERST_PTR_MASK;
		temp_64 |= ((u64) deq & (u64) ~ERST_PTR_MASK);
	}

	/* Clear the event handler busy flag (RW1C); event ring is empty. */
	temp_64 |= ERST_EHB;
	xhci_write_64(xhci, temp_64, &xhci->ir_set->erst_dequeue);
//[CherryUSB]:port/xhci/usb_hc_xhci.c:USBH_IRQHandler(void)
        /* move ring index, notify xhci */
        nidx++; /* head to next trb */
        if (nidx == XHCI_RING_ITEMS) {
            nidx = 0; /* roll-back if reach end of list */
            cs = cs ? 0 : 1;
            evts->cs = cs; /* sw toggle cycle state */
        }
        evts->nidx = nidx;
        uint64_t erdp = (uint64_t)(evts->ring + nidx);
        writeq(xhci->ir + XHCI_REG_RT_IR_ERDP, erdp | XHCI_REG_RT_IR_ERDP_EHB); /* bit[63:4] update current event ring dequeue pointer */

XHCI文档中的说明

4.9.4 Event Ring Management

If the Cycle bit of the Event TRB pointed to by
the Event Ring Dequeue Pointer equals CCS, then the Event TRB is a valid event,
software processes it and advances the Event Ring Dequeue Poi nter. If the Event
TRB Cycle bit is not equal to CCS, then software stops processing Event TRBs
and waits for an interrupt from the xHC for the Event Ring. When the interrupt
occurs, software picks up where it left off, checking the Cycle bit of the Event
TRB pointed to by the Event Ring Dequeue Pointer against its CCS bit.

这里的陈述可以得知ERDP指向的trb是下一个要处理的trb。
但是:
5.5.2.3.3 Event Ring Dequeue Pointer Register (ERDP)

Dequeue ERST Segment Index (DESI) usage:
When software finishes processing an Event TRB, it will write the address of that
Event TRB to the ERDP. Before enqueuing an Event, the xHC shall check that
space is available on the Event Ring. This check can be skipped if the xHC is
currently enqueuing Event TRBs in a different ERST segment than the one that
software is using to dequeue Events.

这里的一段又说将处理完的trb地址填入ERDP中。

wrong file descriptor, when make run

hello, wrong file descriptor, when make run

nm -n /lyndon/iProject/rustpath/src/github.com/DragonOS/kernel/src/kernel | ./kallsyms > kallsyms.S
/home/zxh/opt/dragonos-gcc/gcc-x86_64-unknown-none/bin/x86_64-elf-gcc -c kallsyms.S -o kallsyms.o
Kallsyms generated.
make[4]: 离开目录“/lyndon/iProject/rustpath/src/github.com/DragonOS/kernel/src/debug”
Re-Linking kernel...
./main.o ./head.o ./time/timer.o ./time/sleep.o ./common/math/pow.o ./common/math/fabs.o ./common/math/round.o ./filesystem/MBR.c.o ./filesystem/procfs/procfs.c.o ./filesystem/devfs/chardev.c.o ./filesystem/devfs/devfs.c.o ./filesystem/vfs/dcache.c.o ./filesystem/vfs/VFS.c.o ./filesystem/vfs/mount.c.o ./filesystem/block.c.o ./filesystem/rootfs/rootfs.c.o ./filesystem/fat32/fat_ent.c.o ./filesystem/fat32/fat32.c.o ./driver/video/video.o ./driver/timers/HPET/HPET.o ./driver/interrupt/pic.o ./driver/interrupt/apic/apic_timer.o ./driver/keyboard/ps2_keyboard.o ./driver/disk/ata.o ./driver/disk/ahci/ahci.o ./driver/acpi/acpi.o ./driver/usb/xhci/xhci.o ./driver/usb/usb.o ./driver/hid/hidparse.c.o ./driver/hid/hidstrings.c.o ./driver/multiboot2/multiboot2.o ./driver/pci/msi.o ./driver/pci/pci.o ./driver/mouse/ps2_mouse.o ./driver/tty/tty.o ./syscall/syscall.o ./process/fork.c.o ./process/process.c.o ./process/procs.o ./process/kthread.c.o ./ktest/test-bitree.o ./ktest/test-kfifo.o ./ktest/ktest.o ./ktest/test-mutex.o ./ktest/test-idr.o ./sched/completion.c.o ./sched/core.c.o ./libs/cpu.c.o ./libs/printk.c.o ./libs/crc32.c.o ./libs/libELF/elf.o ./libs/kfifo.c.o ./libs/crc16.c.o ./libs/libUI/textui.o ./libs/libUI/textui-render.o ./libs/libUI/screen_manager.o ./libs/crc64.c.o ./libs/bitree.c.o ./libs/idr.c.o ./libs/crc7.c.o ./libs/wait_queue.c.o ./libs/glib.c.o ./libs/unistd.c.o ./libs/lz4.c.o ./libs/semaphore.c.o ./libs/string.c.o ./libs/mutex.c.o ./libs/stdlib.c.o ./libs/lockref.c.o ./libs/sys/wait.c.o ./libs/crc8.c.o ./libs/wait_queue_head.c.o ./mm/vma.o ./mm/slab.o ./mm/utils.o ./mm/mmio.o ./mm/mmio-buddy.o ./mm/mm-stat.o ./mm/mmap.o ./mm/mm.o ./arch/x86_64/ia64_msi.c.o ./arch/x86_64/x86_64_ipi.c.o ./arch/x86_64/asm/cmpxchg.c.o ./arch/x86_64/asm/spinlock.c.o ./exception/entry.o ./exception/trap.o ./exception/irq.o ./smp/apu_boot.o ./smp/smp.o ./debug/traceback/traceback.o ./io/block/block_io_scheduler.c.o ./ipc/pipe.o
ld -b elf64-x86-64 -z muldefs -o kernel head.o main.o ./main.o ./head.o ./time/timer.o ./time/sleep.o ./common/math/pow.o ./common/math/fabs.o ./common/math/round.o ./filesystem/MBR.c.o ./filesystem/procfs/procfs.c.o ./filesystem/devfs/chardev.c.o ./filesystem/devfs/devfs.c.o ./filesystem/vfs/dcache.c.o ./filesystem/vfs/VFS.c.o ./filesystem/vfs/mount.c.o ./filesystem/block.c.o ./filesystem/rootfs/rootfs.c.o ./filesystem/fat32/fat_ent.c.o ./filesystem/fat32/fat32.c.o ./driver/video/video.o ./driver/timers/HPET/HPET.o ./driver/interrupt/pic.o ./driver/interrupt/apic/apic_timer.o ./driver/keyboard/ps2_keyboard.o ./driver/disk/ata.o ./driver/disk/ahci/ahci.o ./driver/acpi/acpi.o ./driver/usb/xhci/xhci.o ./driver/usb/usb.o ./driver/hid/hidparse.c.o ./driver/hid/hidstrings.c.o ./driver/multiboot2/multiboot2.o ./driver/pci/msi.o ./driver/pci/pci.o ./driver/mouse/ps2_mouse.o ./driver/tty/tty.o ./syscall/syscall.o ./process/fork.c.o ./process/process.c.o ./process/procs.o ./process/kthread.c.o ./ktest/test-bitree.o ./ktest/test-kfifo.o ./ktest/ktest.o ./ktest/test-mutex.o ./ktest/test-idr.o ./sched/completion.c.o ./sched/core.c.o ./libs/cpu.c.o ./libs/printk.c.o ./libs/crc32.c.o ./libs/libELF/elf.o ./libs/kfifo.c.o ./libs/crc16.c.o ./libs/libUI/textui.o ./libs/libUI/textui-render.o ./libs/libUI/screen_manager.o ./libs/crc64.c.o ./libs/bitree.c.o ./libs/idr.c.o ./libs/crc7.c.o ./libs/wait_queue.c.o ./libs/glib.c.o ./libs/unistd.c.o ./libs/lz4.c.o ./libs/semaphore.c.o ./libs/string.c.o ./libs/mutex.c.o ./libs/stdlib.c.o ./libs/lockref.c.o ./libs/sys/wait.c.o ./libs/crc8.c.o ./libs/wait_queue_head.c.o ./mm/vma.o ./mm/slab.o ./mm/utils.o ./mm/mmio.o ./mm/mmio-buddy.o ./mm/mm-stat.o ./mm/mmap.o ./mm/mm.o ./arch/x86_64/ia64_msi.c.o ./arch/x86_64/x86_64_ipi.c.o ./arch/x86_64/asm/cmpxchg.c.o ./arch/x86_64/asm/spinlock.c.o ./exception/entry.o ./exception/trap.o ./exception/irq.o ./smp/apu_boot.o ./smp/smp.o ./debug/traceback/traceback.o ./io/block/block_io_scheduler.c.o ./ipc/pipe.o ../target/x86_64-unknown-none/release/libdragonos_kernel.a ./debug/kallsyms.o  -T link.lds
Generating kernel ELF file...
/home/zxh/opt/dragonos-gcc/gcc-x86_64-unknown-none/bin/x86_64-elf-objcopy -I elf64-x86-64 -O elf64-x86-64 -R ".comment" -R ".eh_frame" kernel ../../bin/kernel/kernel.elf
/home/zxh/opt/dragonos-gcc/gcc-x86_64-unknown-none/bin/x86_64-elf-objcopy: ../../bin/kernel/kernel.elf: 错误的文件描述符
make[3]: *** [Makefile:51:all] 错误 1
make[3]: 离开目录“/lyndon/iProject/rustpath/src/github.com/DragonOS/kernel/src”
make[2]: *** [Makefile:4:all] 错误 2
make[2]: 离开目录“/lyndon/iProject/rustpath/src/github.com/DragonOS/kernel”
内核编译失败
make[1]: *** [Makefile:48:kernel] 错误 1
make[1]: 离开目录“/lyndon/iProject/rustpath/src/github.com/DragonOS”
make: *** [Makefile:106:run] 错误 2

【重构】内存管理模块

简介

由于之前的内存管理模块是C写的,并且代码比较emm难以描述的丑,以及没有考虑到处理器架构可移植性的问题,因此我们从4月开始对它进行重构。

重构的代码在patch-refactor-mm分支。可以在代码搜索引擎中查看:https://opengrok.ringotek.cn/xref/DragonOS-patch-refactor-mm/

内存管理重构目前已经接近尾声,主要是在调试各种bug.

工作计划

内容 开发 测试 合并dev分支 负责人
bump分配器 @kkkkkong mailto: [email protected]
buddy分配器 @kkkkkong mailto: [email protected] @fslongjin mailto: [email protected]
slab分配器 @kkkkkong mailto: [email protected]
硬件抽象层 @fslongjin mailto: [email protected]
内核空间映射管理 @fslongjin mailto: [email protected]
用户空间映射管理 @fslongjin mailto: [email protected]
系统调用层 @fslongjin mailto: [email protected]
新的二进制程序加载器 @fslongjin mailto: [email protected]
C兼容层 @fslongjin mailto: [email protected]

涉及的帖子

bug: 编译错误时make的返回码为0

问题:编译错误时,make命令的返回码为0。并且,编译错误时,sudo bash run.sh仍能启动虚拟机
复现:

  1. 在代码中随便加入一些乱码
  2. 执行make命令
  3. 执行echo $?,发现输出的上一命令返回值为0

[FEATURE] 支持shell中的free指令

错误原因
21号系统调用被移除

请填写您的电脑的信息:

  • DragonOS版本:863a3cff06e618a5f0fc03920dfd5732452344c9

期望行为
成功执行free,查看内存使用情况

需求
我希望了解如何修复该bug,实现free

[BUG] 通过pipe命令执行 cmd_test中的 shell_pipe_test方法时产生错误

描述错误
通过pipe命令执行 cmd_test中的 shell_pipe_test方法时产生错误 ,图一在等待子进程退出的过程中,在调用wait4方法时出错,图二还未确定具体错误发生地点

请填写您的电脑的信息:

  • 操作系统及版本:Ubuntu 22.04
  • DragonOS版本:[版本号或git提交哈希值]
  • DADK版本:dadk 0.1.1
  • Rust版本:rustc 1.68.0-nightly

重现步骤

make run之后在命令行执行pipe指令

期望行为
应当在输出 parent exist 和 child exist 后退出

屏幕截图
6AdKSokMks

image

[BUG] relibc fork 无法正常调用

描述错误
old libc 中可以调用fork,在 relibc 中无法调用,猜测应该跟 fork 还没写到 syscall 的系统调用中有关

请填写您的电脑的信息:

  • 操作系统及版本:Ubuntu 22.04
  • DragonOS版本: 821bb9a
  • DADK版本:dadk 0.1.1
  • Rust版本:rustc 1.68.0-nightly

重现步骤
重现行为的步骤:

编写一段父子进程分别打印hello的代码,链接old libc库时能正常运行,链接 relibc 库时报错

屏幕截图

image

[BUG] 当qemu内存设置为2G时,ACPI模块无法获取old rsdp信息,卡在multiboot2模块内

描述错误
当qemu内存设置为2G时,ACPI模块无法获取old rsdp信息,卡在multiboot2模块内,一直循环出不来.

卡住时,使用make gdb命令,然后在gdb输入backtrace命令,能够看到下面的调用栈:
image

请填写您的电脑的信息:

  • 操作系统及版本:Ubuntu 22.04
  • DragonOS版本:729a96e
  • DADK版本:0.1.2
  • Rust版本:rustc 1.68.0-nightly (5ce39f42b 2023-01-20)

重现步骤
重现行为的步骤:

  1. 使用指定代码编译
  2. 在tools/run-qemu.sh中,将512M改为1G
  3. 运行make run-vnc

就会系统起来之后,卡住在Initializing ACPI...,并且按照上方的步骤,使用gdb能够看到调用栈。用gdb多次重复continue、暂停,发现持续卡在获取相关结构的地方。

如果把kernel/Cargo.toml里面的debug = false改为debug = true,系统则能正常启动。

期望行为
系统能正常运行

屏幕截图
image

其他上下文
在此处添加有关问题的任何其他上下文。

系统日志

uart init
Video driver to map.
Video driver initialized.
textui_install_handler
textui_enable_handler
textui_enable_handler
text ui initialized
[ INFO ] Kernel Starting...

[ DEBUG ] (main.c:82)	_stack_start=0xffff800000320000

mm_init
mm_init() called

[ DEBUG ] (src/arch/x86_64/mm/mod.rs:269)	NO_EXECUTE_ENABLE is false, set XD_RESERVED to true

init_memory_area_from_multiboot2 begin
init_memory_area_from_multiboot2 2
init_memory_area_from_multiboot2 end
[ INFO ] (src/arch/x86_64/mm/mod.rs:259)	Total memory size: 2047 MB, total areas from multiboot2: 9, valid areas: 2

x86 64 init end
[ DEBUG ] (src/arch/x86_64/mm/mod.rs:309)	bootstrap info: Some(kernel_code_start: ffff800000140000, kernel_code_end: ffff800000178be4, kernel_data_end: ffff8000002c2700, kernel_rodata_end: ffff800000317d0e, start_brk: ffff8000003624b8)

[ DEBUG ] (src/arch/x86_64/mm/mod.rs:310)	phys[0]=virt[0xffff800000000000]

[ DEBUG ] (src/arch/x86_64/mm/mod.rs:327)	PhysArea[0..10] = [PhysMemoryArea { base: PhysAddr(0x0), size: 654336 }, PhysMemoryArea { base: PhysAddr(0x100000), size: 2146299904 }, PhysMemoryArea { base: PhysAddr(0x0), size: 0 }, PhysMemoryArea { base: PhysAddr(0x0), size: 0 }, PhysMemoryArea { base: PhysAddr(0x0), size: 0 }, PhysMemoryArea { base: PhysAddr(0x0), size: 0 }, PhysMemoryArea { base: PhysAddr(0x0), size: 0 }, PhysMemoryArea { base: PhysAddr(0x0), size: 0 }, PhysMemoryArea { base: PhysAddr(0x0), size: 0 }, PhysMemoryArea { base: PhysAddr(0x0), size: 0 }]

[ DEBUG ] (src/arch/x86_64/mm/mod.rs:330)	BumpAllocator created, offset=3551232

[ DEBUG ] (src/arch/x86_64/mm/mod.rs:351)	PageMapper created

[ DEBUG ] (src/arch/x86_64/mm/mod.rs:363)	Successfully emptied page table

[ DEBUG ] (src/arch/x86_64/mm/mod.rs:387)	After mapping all physical memory, DragonOS used: 7652 KB

[ DEBUG ] (src/mm/allocator/buddy.rs:78)	Free pages before init buddy: PageFrameCount(522342)

[ DEBUG ] (src/mm/allocator/buddy.rs:79)	Buddy entries: 510

[ DEBUG ] (src/mm/allocator/buddy.rs:121)	pages_to_buddy PageFrameCount(522323)

[ INFO ] (src/arch/x86_64/mm/mod.rs:397)	Successfully initialized buddy allocator

textui_disable_handler
[ DEBUG ] (src/arch/x86_64/mm/mod.rs:406)	To enable new page table.
[ DEBUG ] (src/arch/x86_64/mm/mod.rs:416)	New page table enabled
[ DEBUG ] (src/arch/x86_64/mm/mod.rs:418)	Successfully enabled new page table
[ INFO ] Re-mapping VBE frame buffer...
[ INFO ] VBE frame buffer successfully Re-mapped!
textui_enable_handler
[ DEBUG ] (src/arch/x86_64/mm/mod.rs:428)	Text UI enabled

[ DEBUG ] (src/mm/mmio_buddy.rs:618)	Initializing MMIO buddy memory pool...

[ DEBUG ] (src/mm/mmio_buddy.rs:70)	MMIO buddy pool init: created

[ DEBUG ] (src/mm/mmio_buddy.rs:74)	total 1G blocks: 1024

[ DEBUG ] (src/mm/mmio_buddy.rs:86)	MMIO buddy pool init success

[ INFO ] (src/mm/mmio_buddy.rs:624)	MMIO buddy memory pool init done

[ INFO ] Initializing ACPI...

Todo: OS统一驱动接口

OS统一驱动接口需要实现的效果:

  1. 方便扩展驱动
  2. 将散落在各处的驱动程序代码整合在一起
  3. 明确各种驱动的依赖关系,降低耦合性

如何创建磁盘镜像

运行DragonOS
​ 在运行DragonOS之前,需要先使用tools目录下的脚本,创建一至少为16MB磁盘镜像(类型选择raw)。并建立MBR分区表,然后将第一个分区格式化为FAT32分区。

这步不知道怎么操了

[BUG] 多次调用exec bin/test_gettimeofday报错

描述错误
process.c 中第836行调用process_exit_mm()后,在使用默认编译器的情况下,多次调用exec bin/test_gettimeofday报错,输出mm->pgd发现其出现相同值。目前将其暂时注释。

请填写您的电脑的信息:

  • 操作系统及版本:[Ubuntu 22.04]
  • DragonOS版本:[f21d90b]
  • DADK版本:[dadk 0.1.1]
  • Rust版本:[rustc 1.68.0-nightly]

重现步骤
重现行为的步骤:

  1. make run
  2. 多次执行exec bin/test_gettimeofday
  3. 看到错误

屏幕截图
截图 2023-06-13 11-32-12

[BUG] 当系统未安装unzip时会出错

描述错误
当系统未安装unzip时会出错

重现步骤
重现行为的步骤:

  1. clone一个新的项目
  2. 安装好环境
  3. make run
  4. 在编译user/apps/test_sqlite3时需要解压压缩包,如果没安装unzip就会重复下载压缩包

期望行为
解压压缩包,接着编译

[BUG] 启动阶段Current PCB 空指针异常

描述错误
启动阶段 Current PCB 空指针异常

请填写您的电脑的信息:

  • 操作系统及版本:WSL2 Ubuntu 22.04.3 LTS
  • DragonOS版本:46e234a
  • DADK版本:dadk 0.1.5
  • Rust版本:rustc 1.73.0-nightly (32303b219 2023-07-29)

重现步骤
重现行为的步骤:
正常使用 make qemu 启动系统,即有概率出现这个错误,大约是1/5到1/10的概率,但是用UEFI启动(make qemu-uefi)暂时没遇到这个问题

屏幕截图
image

系统日志
serial_opt.txt

ToDo:在acpi中使用mmio

把acpi驱动程序里面,mmio用到的虚拟地址空间,改为使用mmio地址空间自动分配机制来获取

## 红黑树

  • create_tree方法
  • delete_tree方法
  • insert方法
  • delete方法
  • query方法

shell历史记录功能的几点改进建议

  • 在linux的shell中,在空行输入命令的时候,哪怕我们按了↑键,再次按↓键时,也会出现之前那个空行。
  • 如果我们改了历史的行的内容的话,上下键切换之后,历史的命令显示也会被更改。
    @wang904

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.