Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Dec 02 12:11
    hi-rustin commented #961
  • Nov 29 09:56
    bjorn3 commented #1065
  • Nov 29 03:01
    GraydenH commented #1065
  • Nov 29 02:35
    GraydenH commented #1065
  • Nov 28 07:14
    bjorn3 commented #1065
  • Nov 28 00:00
    GraydenH commented #1065
  • Nov 27 19:41
    bjorn3 commented #1065
  • Nov 27 18:19
    GraydenH commented #1065
  • Nov 27 18:19
    GraydenH commented #1065
  • Nov 27 08:20
    bjorn3 commented #1065
  • Nov 27 06:28
    GraydenH commented #1065
  • Nov 25 12:36
    bjorn3 commented #961
  • Nov 25 12:16
    Salpadding commented #961
  • Nov 25 12:05
    Salpadding commented #961
  • Nov 21 08:14
    bjorn3 commented #1065
  • Nov 21 04:20
    GraydenH commented #1065
  • Nov 21 04:19
    GraydenH opened #1065
  • Nov 20 12:11
    phil-opp commented #1063
  • Nov 17 22:04
    kennystrawnmusic commented #1063
  • Nov 16 01:11
    kennystrawnmusic commented #1063
Philipp Oppermann
@phil-opp
It's great to hear that you're using Rust in your OS course! In my opinion the language is much better suited for OS work than C/C++ and leads to far less frustration, especially for people that are new to OSdev. Happy to hear that my blog was useful in this!
Daniel Ivkin
@ivkin25

Seems like x86_64 crate cannot be compiled now:

error[E0635]: unknown feature const_fn_fn_ptr_basics
--> github.com-1ecc6299db9ec823/x86_64-0.13.1/src/lib.rs:8:43
|
8 | #![cfg_attr(feature = "const_fn", feature(const_fn_fn_ptr_basics))]
| ^^^^^^^^^^^^^^^^^^^^

Philipp Oppermann
@phil-opp
Which Rust nighly version are you using? We test the crate every night in our CI with the latest nightly and it seems to work with rustc 1.51.0-nightly (c8915eebe 2021-01-07): https://github.com/rust-osdev/x86_64/runs/1666849611?check_suite_focus=true
Daniel Ivkin
@ivkin25
For some reason now it works haha, thanks anyways!
Ramon van Sprundel
@ramones156
Hey, I just wanted to say im really thankful for the OS blog. It's gotten me really motivated to learn rust! :)
Philipp Oppermann
@phil-opp
@ramones156 Great to hear that!
Bastien Sevajol
@buxx
Hello ! Is that possible to build ebook from https://github.com/phil-opp/blog_os ? I would like to read it on e-reader.
Ramon van Sprundel
@ramones156
it seems rust nightly 1.52.0 removed the feature const_in_array_and_repeat_expressions, so currently x86_64 isnt working for me
welp, obviously updating fixed it.
Philipp Oppermann
@phil-opp
@buxx I don't have much experience with ebook creation unfortunately and I don't really have time to look into it. If someone knows how to do it and it's not too complicated I'd be happy to implement it of course.
@ramones156 Yeah, this should be fixed in rust-osdev/x86_64#230, which was released as v0.13.2
Daniel Ivkin
@ivkin25
Hey there! I have processes and threads in my OS, but I skipped the part where I give each process its own virtual address space, by giving it a unique CR3. But how can I do that with the x86_64 crate and the allocator from the second edition?
Philipp Oppermann
@phil-opp
First, you need to create a new page table hierarchy for the new process. This can be either from scratch or by copying the currently active page tables (e.g. done by the fork syscall on Linux). Instead of doing the copying directly, you can also implement a copy-on-write scheme by setting all pages as read-only and copying them as soon as they're accessed (by detecting this situation in your page fault handler). Then you can allocate a new stack for the process, map it to the new page table hierarchy, and add the new process to the scheduler. When loading the new process, the scheduler reloads the CR3 register with the level 4 table of the process and then jumps to the defined entry point.
Since processes are isolated from each other, you need separate allocators for them. This isn't a problem for the heap allocator since each process has its own virtual address space that it can freely use. For the physical frame allocator, you need to define some way to share the frames between the processes. One approach could be that you already give the process a number of frames at startup, which it can freely use. Alternatively, you can use some sort of IPS or syscall to request a frame or mapping operation from the main process.
Daniel Ivkin
@ivkin25
I can just create a new page table hierarchy for the new process, instead of copying the existing one, right?
I am just a bit confused on how to do it with the x86_64 crate haha
Philipp Oppermann
@phil-opp
Yeah, you can. First you need to initialize a new PageTable somewhere in memory, which you can then modify using e.g. MappedPageTable. You then need to set up mappings for the code/data/rodata/bss etc sections of the program and a stack.
Ghost
@ghost~60463e2d6da0373984661265
Hi I'm back from here https://github.com/phil-opp/blog_os/discussions/930
Recently you advised me to connect my bootloader to the system I have to compile it as static lib when I do this then you can't do anything about it. Neither use cargo objcopy nor anything else.
Ghost
@ghost~60463e2d6da0373984661265
I can't link the static library to my bootloader via objcopy and the binary ends in .a:
name.a
SEKUN
@imsekun
Hello. Are the blog posts enough to start with as a beginner to OS? Or is this more of an intermediate step?
Ghost
@ghost~60463e2d6da0373984661265
I reread your first edition and now I have a question to what format to compile Assemblerr (to .bin or another?) And how to combine Rust library with Assembler in Windows? Since your first release is for Linux, I can't build it.
Please answear me.
Ghost
@ghost~60463e2d6da0373984661265

Hello. Are the blog posts enough to start with as a beginner to OS? Or is this more of an intermediate step?

it is enough to start

Philipp Oppermann
@phil-opp
@imsekun I try to explain most OS concepts on the blog and my goal is that it is also useful for people without any previous OS building experience. So please let me know if anything is unclear or deserves a more detailed explanation.
Ramon van Sprundel
@ramones156
Is there demand for a dutch translation of blog OS?
Philipp Oppermann
@phil-opp
Hi @ramones156, we're always happy to add new translations!
curtain
@curtainp
hello @phil-opp , are there any Chinese translations of these follow-up posts, if not, i want translations Chinese for it
Philipp Oppermann
@phil-opp
Hi @curtainp, only the first four posts are translated yet and I'm not aware of anyone working on new Chinese translations right now. If you want to translate more posts, you're more than welcome!
Elemental X
@xelemental
Hello people, I am a newbie rustacean and looking forward to write a simple Kernel driver using Rust, your views would be appreciated! :)
Ghost
@ghost~60463e2d6da0373984661265
@phil-opp Apologies for my curiosity, but looking through the third edition folders I saw some folders with interesting names and I'm curious what is planned for the third edition besides pixel-based framebuffer. That's very exciting to me. I look forward to the your answer
Philipp Oppermann
@phil-opp
@JakubGawron23 We will use the APIC for interrupt handling instead of the legacy PIC. I also plan to write a few more posts about creating a simple shell and some small games (probably something like snake) to make the start more interactive. And some post about debugging with GDB and QEMU is planned too.
@xelemental Welcome! With kernel driver you mean a driver for a hobby OS? Or for some existing OS like Linux?
kahirokunn
@kahirokunn_twitter
Nice to meet you!
I'm learning so much from this blog!
Thank you so much!
I would love to read more of this wonderful blog ๐Ÿ˜ข
Are you writing more? ๐Ÿ˜ณ
(gdb)break _start๐Ÿฆ€๐Ÿ”ฉ
@ElementalX2_twitter
Just for some existing OS ( Linux ) @phil-opp ! ๐Ÿ˜ƒ
Sorry for the delay in response!
Philipp Oppermann
@phil-opp
Hi @kahirokunn_twitter , nice to meet you too! Great to hear that you like the blog :). Yes, I'll continue to write on it. My next target is to create a new third edition of the blog, which uses the latest release of the bootloader crate to get UEFI and framebuffer support. After porting over the posts from the second edition, I plan to continue looking into multitasking (threads, processes, etc). However, I'm quite busy right now so it will probably take me some time to get there.
@ElementalX2_twitter No worries! Maybe https://github.com/fishinabarrel/linux-kernel-module-rust and https://github.com/tsgates/rust.ko are useful to you then.
(gdb)break _start๐Ÿฆ€๐Ÿ”ฉ
@ElementalX2_twitter
Thank you very much @phil-opp ๐Ÿ˜ƒ
Oliver Nordbjerg
@onbjerg
Hey! Thanks for putting together the 1st and 2nd edition, they are a delight to read and follow. I am a bit curious though - why was the 2nd edition abandoned?
Philipp Oppermann
@phil-opp

@onbjerg Hey, great to hear that you like the blog! The 2nd edition isn't abandoned, I'm still keeping it updated for the latest Rust nightlies. It won't receive new posts though because I'm working on a new 3rd edition right now.

The 3rd edition is mostly motivated by supporting UEFI, which requires some fundamental changes to the first few posts. The rest of the posts will be very similar to the 2nd edition, so it won't be as different as the 1st edition -> 2nd edition switch. It should also be relatively easy to migrate from the 2nd to the 3rd edition.

Oliver Nordbjerg
@onbjerg
@phil-opp Ah, that makes sense :) I just recently started seriously trying to do OSDev after playing with the idea for a few years. Awaiting the 3rd edition eagerly!
Ethin Probst
@ethindp
So I've managed to convert my kernel to UEFI and its working good so far! (There are a lot of free regions though and no runtime/boot services code/data anywhere -- that definitely surprised me because according to the UEFI spec runtime services should be present). But I'm working on getting my kernel fully booting and I'm nearly done -- it at least starts now! :)
I am suffering this (strange) problem where it (appears) to be triple faulting despite the fact that an IDT and GDT are loaded, so, theoretically, it shouldn't be. I'm running on KVM.
Ethin Probst
@ethindp
Yeah, this is really weird. I'm getting a triple fault but my GDT and IDT are loaded. And I (think) that UEFI leaves the APIC at least enabled, so I should be able to receive interrupts, but I'm not and its like my IDT is being ignored.
Ethin Probst
@ethindp
Question: does the x86_64 crate when creating pagetables automatically set CR3, or does the bootloader do that? If so, does the bootloader automatically map all the pagetables? The triple fault I'm getting occurs when writing to memory address 0x18000003000 or so (something like that anyway). The code that triggers it is x86_64 and its when zeroing pagetable entries.
jwoff78
@jwoff78
so uh I am stuck on cargo install bootimage, can't figure out how to do it on windows or linux. Read through github stuff none of that makes any sense tho, unsure how i can access parent directory.
jwoff78
@jwoff78
Nvm I got it gonna just stick with Mosa tho
InfRandomness
@InfRandomness

Hey everyone, I'm following the guide but I'm stuck at the testing part, not sure what's wrong :thinking:

here's my code :
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=e0e2187ffa87f48144cae5f923bbcf0b

rimasu
@rimasu
Was attempting to add an interrupt handler to catch input from serial port1 - has any body got a working example of this?
rimasu
@rimasu
If I use SERIAL1.lock().receive() in a tight loop I can get the bytes - so confident that I am sending stuff from host os to guest (via named pipes), but so far interrupt handler is never firing