spinlock和sleeplock锁的使用及其注意事项
锁的使用 本文默认读者有对应的编程经验,过多细节不再赘述 在写FrostVistaOS的时候,在 OS 初始化早期,由于调度器尚未启动、进程尚未建立,会导致依赖进程上下文的睡眠锁无法正常工作。所以,我打算还是专门写一篇博客用来讲解锁的使用,因为我的锁的编写借鉴了xv6的代码,所以,理论上与xv6的锁的使用是通用的。 spinlock struct spinlock { uint lo...
Read moreMarkdown to HTML
A tiny, fast Markdown blog for GitHub Pages.
Posts grouped in this category.
锁的使用 本文默认读者有对应的编程经验,过多细节不再赘述 在写FrostVistaOS的时候,在 OS 初始化早期,由于调度器尚未启动、进程尚未建立,会导致依赖进程上下文的睡眠锁无法正常工作。所以,我打算还是专门写一篇博客用来讲解锁的使用,因为我的锁的编写借鉴了xv6的代码,所以,理论上与xv6的锁的使用是通用的。 spinlock struct spinlock { uint lo...
Read more一次FrostVista的排错 前言 那几天在尝试使用gdb来追踪OS的运行流程的时候发现,自己的OS无法在-O0优化下运行(无优化),但是可以在-O2优化下运行,这就让我感到很奇怪,这是为什么?同一套代码竟然会在不同的优化下产生这么大的差异? 优化 1. -O0:零优化(默认级别) 核心目标:最快的编译速度,最好的调试体验。 特点: 如果你在编译时不加任何 -O 参数,编译器默认使用...
Read moreArceOS 2026训练营题目解析 前言 本文依赖ArceOS Breakdown of the Startup Process,若有部分跳过的地方可以查看此文章。 练习 print_with_color 本题的问题很简单,给我们输出的内容上颜色,我们可以随便加一个ASCII的颜色即可通过。 ... println!("\x1b[32m[WithColor]: Hello, Arce...
Read moreArceos 启动流程拆解 前言 注:本文默认读者已具备基础的 RISC-V 体系结构及常规操作系统理论知识,底层硬件常识将不再赘述。 于我而言,写项目前,完整了解项目前期的启动及相关的内容是及其必要,可以完整了解整个项目的运转方式,掌握开发流程。 所以下文是简单的对ArceOS的架构解析,只针对RISCV。 Makefile分析 ArceOS并不是一个大型或者中型的项目,所以,可以直接来...
Read more这几天一直都在参加rcore的比赛,这几天的赛段是写ArceOS中的题目 尽管自己无权评判他人的设计思路,但是这些只是我的个人感受,并无恶意。 前几天在写rcore的时候,给我的感觉就是,rust不太适合拿来做操作系统,他的抽象过多,不适合项目的维护,(不知道为什么,感觉rust要是做大型项目的话,感觉也不太合适,不知道是我自己没有参加过中型或大型项目的原因)。 在看ArceOS的时候,很多的库也...
Read moreFrostVista: Minimal U-mode implementation 本文主要讲述在实现简单的U-mode时可能遇到的问题,以及一些疑问。 本文主要讲解思路而非代码,本文中的代码也仅仅是我实现所用的代码,仅供参考。 需要使用到以下文件: RISCV_ABI.pdf RISCV-Privileged.pdf 涉及到的章节: ABI: Chapter 1.1 Integer Re...
Read moreImplementing Minimal U Mode in FrostVista OS: Addressing Forgotten Issues and Overcoming Challenges
Read moreFrostVista Tutorial -- (2) UART驱动编写 我们在上一章中已经说明完如何进入OS并启动了,现在我们要做的事情就是要让OS可以开口说话,也就是UART驱动的编写。 要知道,在正常的OS中,是没人帮你配置好简单的UART的,所以,我们需要自己编写一个UART驱动,来完成这个功能。 而且只有实现了UART驱动,才能让OS开口说话,我们也可以正常的打印错误日志,消息等,否则的话...
Read moreA beginner-friendly guide to building a minimal RISC-V OS boot framework with linker scripts, assembly startup code, UART output, and Makefile configuration.
Read moreAnalysis of xv6 trampoline implementation, page table switching, and sfence.vma usage in U/S mode transitions.
Read moreImplementing UART TX interrupts with buffer management, LSR register handling, and debugging ebreak interrupt issues.
Read more本文主要讲述我在实现SBI调用链实现CLINT中断定时时遇到的问题,以及如何解决。
Read moreImplementing CLINT timer interrupts with RISC-V privilege mode handling, mscratch usage, and interrupt delegation challenges.
Read moreClarifying IP vs IE interrupt concepts in RISC-V, hardware configuration issues, and trap entry point implementation lessons.
Read moreAddressing chicken-and-egg problems in high-address mapping, PTE allocation misconceptions, and implementing ekalloc for boot-time memory management.
Read moreChallenges in implementing high-half kernel mapping, modifying kalloc for pre/post-paging allocation strategies.
Read moreUnderstanding VA2PA translation in sv39 three-level page tables and building minimal MVP with xv6 reference.
Read moreExploring RISC-V privilege architecture for Sv39 paging, PMP configuration, and trap delegation from M-mode to S-mode.
Read moreBrief note on implementing cyclic lists with sentinel nodes for memory allocator modification.
Read moreDevelopment log covering directory structure setup, printf encapsulation challenges, and LD linker issues in kernel development.
Read moreDetailed analysis of UART 16650 registers in xv6's uart.c implementation, covering IER, FCR, LCR configurations and their manual specifications.
Read more实现UNIX find命令:递归遍历目录树查找指定文件,解析文件系统结构、目录项和inode操作。
Read more实现进程间通信的ping-pong程序:使用管道和fork创建父子进程,通过双向管道传递消息。
Read more实现质数筛选器:使用管道和递归进程创建筛选管道,每个进程过滤当前质数的倍数。
Read more实现sleep命令:解析命令行参数,调用系统调用暂停进程指定时间,深入分析系统调用机制。
Read more实现xargs命令:从标准输入读取参数,为每行参数创建子进程执行命令,深入理解进程创建和参数传递。
Read more