Activity

239873059

I have made PCIe work. But limine somehow doesn’t map PCIe mmios. So I stil need an elegant way to map it manually.

Attachment
0
239873059

Shipped this project!

I thought this project would be easy, because I have written many OS projects, and my goal is to make it run a simple shell and a file system. But turned out it was far more difficult than I expected. I was forced to learn about loongarch64 more deeply, and I finally learnt how to debug the kernel with rust-lldb. However, I’m proud to say that my OS might have the best loongarch64 support in all rust-written operating systems!

239873059

Now I have finally added a terminal, and I will add pcie and a keyboard driver.

Attachment
0
239873059

I really don’t know why this is broken, maybe I need the frame buffer to test sys_write_vmo.

Attachment
0
239873059

I removed some members in ProcessStartInfo, so that user programs can load other programs more easily.

Attachment
0
239873059

I have added exit syscall, and the bug of timer is made sure to be fixed. I just realized that the performance of software simulation is not that good, so using periodic mode isn’t very reasonable, because operations in the kernel requires a lot of time, so after entering user mode, it might immediately interrupt and exit from it.

Attachment
0
239873059

Although the kernel can run 11 syscalls normally now, enabling interrupt in user mode is causing a great issue. This makes QEMU run really slowly, and I can’t have realized that it is indeed running if I didn’t print ip. I don’t understand what is happening, because the timer implementation for loongarch is QEMU is very similar to other timers for other platforms.

Attachment
0
239873059

Now I can be sure that multitask and user mode support is robust enough! I added idle thread and improved performance slightly.

Attachment
0
239873059

I’ve tried hard, but power off and reboot simply don’t work. After looking up in Linux’s source code, I learnt that in LoongArch, you are not supposed to use ACPI to shutdown the machine. Instead, you should just kill all the process, and then simply idle. But I don’t understand why reboot is not working. I even added instructions to write back caches manually.

Attachment
0
239873059

After a lot of hard work, I finally made user boot work! But now the code is really messy, with cfg everywhere. I think I will clean up the code before I push it onto the repository.

Attachment
0
239873059

I’ve added a -d or –debug option for builder’s run sub command, so that you can debug the kernel.

Attachment
Attachment
0
239873059

I removed makefile and used xtask instead. And I have implemented multitask. Tomorrow I will add user space support.

Attachment
0
239873059

I have added heap, acpi and a trap handler to kernel_hal. But now kernel_hal is really messy. I think I should clean up the code.

Attachment
0
239873059

I’ve removed the makefile and rewrote builder to support the functionalities. This requires less dependencies.

Attachment
Attachment
Attachment
0
239873059

After trying really hard, I’ve given up fixing build system with cargo, so I wrote a make file. Now it works perfectly.

Attachment
Attachment
Attachment
0
239873059

I successfully made kernel run again. Then I shall start to fix build system and implement multitask.

Attachment
0
239873059

I tried really hard to make syscall work, but it’s just not working. So I am giving up further support of libOS, and I’m going to leave it as some simple implementation to make unit test work.

Attachment
0
239873059

I have added a syscall handler. Tomorrow I will start to implement syscalls.

Attachment
Attachment
0
239873059

I found many bugs when I tried to add a vDSO mapper. Now, after hard work, I successfully fixed all the bugs I found out and added a vDSO mapper. All the tests are passing now.

Attachment
Attachment
0
239873059

I have added vdso, and I am trying to support loading it. After that, we will be able to provide user programs with syscalls, and that we can start to make more kernel objects and writing userboot.

Attachment
Attachment
0
239873059

I have added multitask support for libOS! This is based on async rust. Next I will start to learn about vDSO and provide syscalls!

Attachment
0
239873059

I refactored kernel object declarations to improve flexibility. And I have also added Thread kernel object, and I will start to implement simple multitask tomorrow.

Attachment
Attachment
0
239873059

I have added VMAR children support, so it should be user-friendly now.

Attachment
0
239873059

I’ve added VMAR and VMO, but they still require more functionalities to become user-friendly. Anyway, racaOS is now supported to run as a libOS on Linux!

Attachment
Attachment
0
239873059

I am going to support LibOS! This will enable us to test our operating system on linux, and it avoids breaking unit tests.

Attachment
0
239873059

I’ve fixed the problem of LLVM Backend. Now it works normally.

Attachment
0
239873059

We’ve added two kernel objects, process and channel. The next step will to implement more functions, and we will make use of kernel-hal tomorrow.

Attachment
0
239873059

I turned back to rust. Now I am going to implement my design.

Attachment
0
239873059

I’m trying really hard to parse ACPI tables. But the address of the first sdt is invalid for some unknown reasons.

Attachment
0
239873059

Now we no longer need a semicolon after expressions like for and if!

Attachment
0
239873059

The llvm backend is now more robust. More tests will be added in the future to ensure it works well. Now you can use continue and break freely!

Attachment
0
239873059

Cara has break & continue now! But I think I need to wrap the creation of a basic block. The current version requires a lot of testing to avoid bugs.

Attachment
0
239873059

Now you can pass functions as values! And you don’t need to worry if the compiler compiles the function several times.

Attachment
0
239873059

Shipped this project!

Hours: 25.71
Cookies: 🍪 591
Multiplier: 22.98 cookies/hr

This is a compiler which support multiple files and namespace! You can also compile to other platforms. It’s highly inspired by rustc.

239873059

We can build cara for other platforms now! And type inferring will be implemented tomorrow.

Attachment
1

Comments

aloyak
aloyak about 2 months ago

love your project!

239873059

I have added usize and isize, which involves the support of more targets. Now, in theory, you can build cara for more platforms.

Attachment
0
239873059

To easily support typed AST, I refactored expressions, which allows analyzer to create a HashMap that stores all the type info.

Attachment
0
239873059

After working really hard, I have finally made github actions work. Now we can build releases easily.

Attachment
0
239873059

Cara has a lexer now! This improves the stability of parser, and will allow us to create procedural macros!

Attachment
1

Comments

wenxuanjun
wenxuanjun 2 months ago

that’s so impressive :P

239873059

Now we support multiple files! I will refactor parser and analyzer next, then we can introduce procedural macros and a usable LSP!

Attachment
0
239873059

Now we can access constants in the same namespaces easily, and further support shall be done tomorrow. Also, another analyzer which checks namespaces should be built.

Attachment
0
239873059

After working hard, I have successfully fixed many bugs of the compiler, and we are now able to create functions in a struct, and access them like A::b! We will implement more features such as better namespaces later.

Attachment
0
239873059

Cara has structure support now! But I haven’t used a lexer yet, because I don’t want to drop the parser written in peg I have now.

Attachment
0
239873059

I have tried and tried, but the parser is still broken. Maybe I should create a lexer tomorrow, which should simplify the work.

Attachment
0
239873059

I have finally implemented a good type checker, and I shall start OOP.

Attachment
0
239873059

I have implemented expression type checkers. And more checks will be implemented tomorrow.

Attachment
0
239873059

The basic structure of analyzer is built, and I will implement a full-featured analyzer in the next few days.

Attachment
0
239873059

Now the symbol table is written in a separate crate, so that I don’t need to write so much duplicated code.

Attachment
0
239873059

I have added type cast, which allows the followings:
int -> int
ptr -> ptr
int -> ptr
ptr -> int.
More shall be added in the next days of development.

Attachment
0
239873059

Broke the ExpVisitor trait, since it’s too long. I think methods in visitor traits shall be classified better, and I will do it tomorrow.

Attachment
0
239873059

Added prototypes. This allows cara to extern C functions like printf. Now we can print things freely.

Attachment
0
239873059

Add while, loop and for blocks. Currently they requires ;. I would fix that tomorrow.

Attachment
0