Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Matt Taylor
    @64
    well, you would certainly make a better mathematician than i would a medic ;)
    Isaac Woods
    @IsaacWoods
    anyone who can build an OS could be a medic, most of preclinical is looking at legacy systems and wondering why things work like that
    Matt Taylor
    @64
    lol
    Isaac Woods
    @IsaacWoods
    it's just a person instead of a codebase ;)
    Daniel Ivkin
    @ivkin25
    Hey there! I need suggestions for a really good and very informative operating systems book to read - so far, my current options are the books Modern Operating Systems, and Three Easy Pieces (a book recommended by phil-opp), and Operating System Concepts. Thanks!
    Rune Tynan
    @CraftSpider
    Hm, is there a good pattern for 'global drivers'? In the blog (V 0.9), all stuff is done with lazy static, however you can't init a lazy static with function arguments it seems, needed for V 0.10's boot_info. For now I resorted to a static mut I only mutably set during init, then ever after access through a helper as an immutable reference, but I was hoping there was a safer/smarter way to do this that I'm just missing
    Rune Tynan
    @CraftSpider
    Aside from that slight ugliness, I have successfully implemented full text-writing capabilities, so I can now move on to the 'tests' and 'error handling' parts
    Rune Tynan
    @CraftSpider
    Have reached up to interrupts, stuck on trying to get breakpoint working (Also tried double-fault, in case it was the specific interrupt that was the problem). I'm definitely calling load, but all interrupts are still double-faulting. The lidt instruction is appearing in the resultant binary, so I have no clue what is wrong.
    Vincent Hou
    @vincenthouyi
    @ivkin25 probably that’s all the books you need for an entry level of OS knowledge. If you want to know further, I think course materials of Advanced Operating System from all Universities are the best way to start with, then you probably need to read papers or read source code. If you need some detailed info about OS like Linux or Windows, there are a lot of books too, but they are more specific to an implementation intead of general ideas.
    Daniel Ivkin
    @ivkin25
    @vincenthouyi Gotcha! But which book do you recommend starting with?
    Vincent Hou
    @vincenthouyi
    Actually I only thoroughly read the Modern Operating Systems as a textbook back in colledge. I think I only had a glance of Three Easy Pieces. Either one is great book. They basically covering the same topics, but with organized in a different way. Modern Operating Systems is more traditionaly textbook style and you may need to read with a course slides. Three Easy Pieces is easier to read.
    Daniel Ivkin
    @ivkin25
    Thanks a lot! I would be happy to hear more suggestions from everybody :D
    Matt Taylor
    @64
    @ivkin25 honestly something like the xv6 textbook (https://pdos.csail.mit.edu/6.828/2012/xv6/book-rev7.pdf) is a really great introduction to how operating systems work, taking you through a real functioning system and it's only about 100 pages. It doesn't talk so much about the theory and alternate designs but it covers most of the topics that you need to care about for osdev in a good level of detail
    Daniel Ivkin
    @ivkin25
    It really looks great, thanks! I think it is more targeting osdev rather than understanding modern concepts
    Vincent Hou
    @vincenthouyi
    is there a way for gdb to break when my os in qumu write a certain value to memory? I found my user space app’s memory is randomly overwritten by somebody (kernel or parent process I’m not sure). The overwrittent location is random, but the value it writes to is the same. I’m wondering if there is a way to break when the OS writes the value to memory.
    *os in qemu
    Rune Tynan
    @CraftSpider

    Have reached up to interrupts, stuck on trying to get breakpoint working (Also tried double-fault, in case it was the specific interrupt that was the problem). I'm definitely calling load, but all interrupts are still double-faulting. The lidt instruction is appearing in the resultant binary, so I have no clue what is wrong.

    With QEMU -d int, I've determined that it is loading the IDT, but when it hits int3, it immediately page faults, then page faults, then the double fault also page faults, even when there is no code at all in the handlers. Stack misalignment, maybe???

    Rune Tynan
    @CraftSpider
    I decided to move ahead, see if adding a GDT with custom stack would help. After doing so, I run it, and it works. But it doesn't page fault anymore, it just. Works, breakpoint is hit and all
    phil-opp
    @phil-opp:matrix.org
    [m]
    @CraftSpider: You could try to look at the CR2 register and the error code when the page fault occurs (both are printed with QEMU's -d int) to see at which memory access causes the page fault. Maybe it's really a stack overflow.
    Rune Tynan
    @CraftSpider
    CR2 says location is 0x866B, corresponding to... an offset of 8 from the current GDT, which would be GDT::next_free. Error code is 0, which I gather means caused by a read to an unmapped page. This happens when I don't set a GDT myself, so... The GDT the bootloader is setting is in an unmapped location? Unless the bootloader just expects you to always set a GDT yourself, or I'm misunderstanding something :P
    (Also, thank you so much for your help and patience so far)
    Rune Tynan
    @CraftSpider
    Oh, that's fun. After getting all the way through allocation, went back and tried to make my framebuffer double-buffered, and play around with speeding it up. Just found out that &mut self.local_buffer is very slow if local_buffer is a Vec<u8>, but very fast if it's a Box<[u8]>. Like, by a very noticeable amount. My jury-rigged profiling via the time interrupt and counting the IP location at each interrupt says most of the time for the Vec was spent in from_raw_parts_mut, interestingly.
    Conor Manning
    @bythebook
    @CraftSpider About your question last week on globals: in my OS I'm creating type wrappers around UnsafeCell. Then my globals are static (immutable) instances of those. Interior mutability allows initialisation without static mut.
    I got the idea from a rust-lang issue on the topic of deprecating static mut: rust-lang/rust#53639
    1 reply
    Ender Minyard
    @genderev

    DevicePath is different from other protocols in the uefi crate and different from the definition in the edk2 or gnu-efi C libraries. How would you find the path to the network interface controller with the uefi crate?

    In gnu-efi there exists a device path table in which MSG_MAC_ADDR_DPis defined but I'm unsure of how this translates to Rust.

    Ender Minyard
    @genderev
    Alternatively - seeing as the simple network protocol is documented in r-efi, what are the requirements for actually implementing the protocol? Locating a protocol is a documented procedure.
    Tim Peters
    @Darksecond
    Are there any adverse effects of making the kernel a cdylib instead of a elf executable? I want to change the bootloader to load the stack, framebuffer and other locations from an exported symbol in the kernel instead of cargo.toml
    (and it looks like you can't export symbols from a executable, at least not in rust)
    Isaac Woods
    @IsaacWoods
    @Darksecond you should be able to expose symbols from an executable (I do it from a linker script like this)
    Tim Peters
    @Darksecond
    ah, you can do it from a linker script? that's interesting
    Ben
    @Ben-PH
    g'day. How is everyone?
    I'm slowly putting together an OS based on the seL4 microkernel and the AOS course UNSW puts in.
    Vinay Chandra
    @vinaychandra
    I am also working on a sel4 like os here
    https://github.com/vinaychandra/relic-os
    Vincent Hou
    @vincenthouyi
    me too ;)
    phil-opp
    @phil-opp:matrix.org
    [m]

    @CraftSpider:

    CR2 says location is 0x866B, corresponding to... an offset of 8 from the current GDT, which would be GDT::next_free. Error code is 0, which I gather means caused by a read to an unmapped page. This happens when I don't set a GDT myself, so... The GDT the bootloader is setting is in an unmapped location? Unless the bootloader just expects you to always set a GDT yourself, or I'm misunderstanding something :P

    I think this is a bug in the bootloader. It should map the GDT into the kernel address space, but apparently it doesn't. I opened rust-osdev/bootloader#153 for this.

    Oh, that's fun. After getting all the way through allocation, went back and tried to make my framebuffer double-buffered, and play around with speeding it up. Just found out that &mut self.local_buffer is very slow if local_buffer is a Vec<u8>, but very fast if it's a Box<[u8]>. Like, by a very noticeable amount. My jury-rigged profiling via the time interrupt and counting the IP location at each interrupt says most of the time for the Vec was spent in from_raw_parts_mut, interestingly.

    Interesting! The from_raw_parts_mut should be a no-op though (just re-interpreting some pointers), so it shouldn't really take any considerable time.

    Ben
    @Ben-PH
    @vinaychandra cool. Are you hoping to build an OS on top of the microkernel?
    Vinay Chandra
    @vinaychandra
    I'm creating a sel4 like kernel and then build an os on top of it
    Ben
    @Ben-PH
    nice. I'm curious about why build the kernel instead of using seL4?
    Rune Tynan
    @CraftSpider

    Interesting! The from_raw_parts_mut should be a no-op though (just re-interpreting some pointers), so it shouldn't really take any considerable time.

    I realized I was still building in Debug shortly after, Release speeds it up more. I haven't tried switching between Vec and Box in release, they may be equivalent there. If not, it could also be that that specific function isn't the issue, as my trick isn't exactly fanciest profiler strategy.

    Vinay Chandra
    @vinaychandra

    nice. I'm curious about why build the kernel instead of using seL4?

    Just for fun. I wanted to see if i can further simplify seL4 by adding a few assumptions.
    Also, most of the tooling around seL4 for rust is outdated as well

    Ben
    @Ben-PH

    For the AOS project, I'm just compiling a static lib, using aarch64-unknown-linux-musl target, then in the CMakeLists file that needs it add the generated .a file path in the target_link_libraries call

    works well enough. it's a bit of a pain in that I need to manually call the rust build before ninja. I'm sure it's trivial to do it automagically, but... ehhh.

    Tim Peters
    @Darksecond
    does have x86_64 have a 'map_area' kinda function, if it does I can't find it, I can only find the singular 'map_to'
    Hiroki Tokunaga
    @toku-sa-n
    @phil-opp:matrix.org Hi. I want to enable the auto-merge option for the xhci repository, but somehow I can't do it because the setting tab doesn't appear. Will you enable it?
    phil-opp
    @phil-opp:matrix.org
    [m]
    @toku-sa-n Seems like GitHub gave you only write permissions on the repo after transferring it to the rust-osdev org. I just gave you admin access to the repo again, so you should be able to change the settings again. Sorry about that!
    Hiroki Tokunaga
    @toku-sa-n
    @phil-opp:matrix.org No problem, and I confirmed that I could change the repo settings. Thank you!
    phil-opp
    @phil-opp:matrix.org
    [m]
    Great!
    Vincent Hou
    @vincenthouyi

    nice. I'm curious about why build the kernel instead of using seL4?

    Just for fun. I wanted to see if i can further simplify seL4 by adding a few assumptions.
    Also, most of the tooling around seL4 for rust is outdated as well

    How are you going to design your user space? I’m also writing an OS based on seL4, wondering if I can get some ideas

    Vinay Chandra
    @vinaychandra
    The first process is the os behavior process. Pretty much owns everything. It doesn't give away any memory to new processes. Just maps the required memory and provides the caps to those mapped pages. All book keeping is done by the first process
    Similar for all things. The behavior process acts as a mono kernel unless we are designing drivers in which case they can live in another process. Again, this is in Flux and can change as it evolves
    Vincent Hou
    @vincenthouyi
    So like a monolithic kernel in user space? That’s probably the most performant way for a microkernel system! I’m trying to make a multiserver system. Everything runs in its own process, VFS, drivers, etc. Not for performance, just for fun.