xv6 | Working through OS development course

 by   sam46 C Version: Current License: Non-SPDX

kandi X-RAY | xv6 Summary

kandi X-RAY | xv6 Summary

xv6 is a C library. xv6 has no bugs, it has no vulnerabilities and it has low support. However xv6 has a Non-SPDX License. You can download it from GitHub.

Working through OS development course
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              xv6 has a low active ecosystem.
              It has 6 star(s) with 4 fork(s). There are 2 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              xv6 has no issues reported. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of xv6 is current.

            kandi-Quality Quality

              xv6 has no bugs reported.

            kandi-Security Security

              xv6 has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              xv6 has a Non-SPDX License.
              Non-SPDX licenses can be open source with a non SPDX compliant license, or non open source licenses, and you need to review them closely before use.

            kandi-Reuse Reuse

              xv6 releases are not available. You will need to build from source code and install.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of xv6
            Get all kandi verified functions for this library.

            xv6 Key Features

            No Key Features are available at this moment for xv6.

            xv6 Examples and Code Snippets

            No Code Snippets are available at this moment for xv6.

            Community Discussions

            QUESTION

            Double Acquire a Spinlock in XV6
            Asked 2021-Jun-10 at 09:15

            As we know, xv6 doesn't let a spinlock be acquired twice (even by a process itself).

            I am trying to add this feature which lets a process to acquire a lock more than once. In order to reach this, I am adding an attribute called lock_holder_pid to the struct spinlock which is supposed to hold the pid of the process which has acquired this lock.

            The only file I have changed is spinlock.c

            Here is my new acquire() function:

            ...

            ANSWER

            Answered 2021-Jun-10 at 09:15

            This is simply because you are trying to have access to a field of a null struct (myproc()->pid).

            As you may know, myproc() returns a process running on the current processor. If you look at main.c, you may notice that the bootstrap processor starts running there. Therefore, if we can find a function which calls the acquire() function before setting up the first process, the problem will be solved.

            If you take a close look at the kinit1 function, you can realize that the acquire function is called in it. Consequently, we found a function that uses the acquire function, even before initializing the ptable struct. Therefore, when you try to access the myproc() value, it is not initialized yet.

            Source https://stackoverflow.com/questions/67890874

            QUESTION

            I can't understand this line of code in xv6
            Asked 2021-Jun-04 at 13:21

            Despite consulting the documentation, I still can't understand this line:swtch(&c->scheduler, &p->context);.

            My question: I know this line is to switch p->context, including save registers and restore registers, but I can't understand the pc change in this process, that is what execution order of this code? After theswtch(&c->scheduler, &p->context); is executed, is it immedidate to execute c->proc = 0;, then the effect of executing c->proc=p; disappears? I am confused now.

            code link: https://github.com/mit-pdos/xv6-riscv/blob/riscv/kernel/proc.c line 456

            ...

            ANSWER

            Answered 2021-Jun-04 at 13:21

            This is literally the code that was so confusing that its original authors wrote "You are not expected to understand this" in the comments, so don't feel bad for not understanding it.

            The key thing you may have missed is that p->context contains an address where swtch is to resume execution of process p. It's set up, for instance, here:

            Source https://stackoverflow.com/questions/67836212

            QUESTION

            pipe examples between child and parent in Linux C
            Asked 2021-Apr-11 at 06:32

            This looks really simple, a pipe between, parent will write to a pipe at write end of the pipe, and the child will read from the pipe in a while loop, and print what has read, but my program failed to stop...

            ...

            ANSWER

            Answered 2021-Apr-11 at 06:32

            It did stop — the parent exited and produced the prompt from the shell in the messed up output before the child printed "The number is 3 from the child 4":

            Source https://stackoverflow.com/questions/67041452

            QUESTION

            Ask for clarification about "the segment registers continue to point to the same linear addresses as in real address mode"
            Asked 2021-Apr-07 at 04:43

            The question is about persistent validity of code segment selector while switching from real mode to protected mode on intel i386. The switching code is as follows (excerpted from bootasm.S of xv6 x86 version):

            ...

            ANSWER

            Answered 2021-Apr-07 at 04:43

            The modern reference is the Intel Software Developer's Manual, Volume 3A, Section 9.9.1, "Switching to protected mode".

            Intel isn't big on explaining how magic works internally. What it says, and all you need to know, is that if your movl %eax, %cr0 is immediately followed by a far jump or far call, then everything will work. If you put any other instruction there, then "random failures can occur" (their wording).

            As it says, %cs continues to hold its previous value, and presumably that's the value that would be pushed on the stack if you did a far call as the instruction after movl %eax, %cr0. (Where the stack would be is another interesting question - I think everyone uses the jump instead so it rarely comes up.) But for this one instruction it evidently isn't used as a selector in the usual way.

            One guess as to how it might work: we know that in protected mode, there are hidden registers that store the segment attributes, and are reloaded from the descriptor table when you load a segment register. So the movl %eax, %cr0 might cause the hidden register corresponding to %cs to be loaded with attributes of a segment whose base address is the linear address of the current 16-bit segment: e.g. if %cs contained 0x1234 then it could be a segment with base address 0x12340. But the %cs register itself could be left alone, temporarily not matching its hidden counterpart. Then if the high bits of %eip are zeroed, the next instruction would be fetched from the right place. That instruction is required to be the long jump which will reload %cs as well as the hidden segment attribute register.

            It's also possible that it just sets some internal flag that says "even though in protected mode, fetch the next instruction according to real-mode address translation". Then this flag gets cleared when a far jump occurs, or after one instruction has been fetched, or something like that.

            Source https://stackoverflow.com/questions/66979276

            QUESTION

            gdb dose not work with xv6: freeze after qemu-nox-gdb
            Asked 2021-Mar-30 at 01:14

            I'm using VMware Workstation 15 Pro on Windows 10. The guest OS is Linux 18.04.5 LTS. In guest Linux, I downloaded xv6 using command: git clone git://github.com/mit-pdos/xv6-public.git. After building xv6 using make, I run make qemu-nox-gdb. However, the xv6 freezes inside qemu. No prompt printed out. No response to any key input. But if I remove gdb, everything works well. output image

            PS: I have update and upgrade everything in Linux, including qemu, git, gdb, nasm, etc.

            ...

            ANSWER

            Answered 2021-Mar-29 at 18:07

            That QEMU commandline tells QEMU "don't run anything, instead, stop and wait for a connection from gdb". The makefile printed a message for you: "Now run 'gdb'". Have you run gdb and connected it to QEMU? (Probably there should be some tutorial or other info with xv6 that explains more about how to do this.)

            Source https://stackoverflow.com/questions/66851317

            QUESTION

            Need help understanding Makefile in xv6
            Asked 2021-Mar-25 at 21:59

            I have been reading the makefile of xv6 project. I want to put all the user programs into a folder to keep the project tidy. I can not find where it compiles the user programs. I know that when i run: make fs.img; it will compile the user programs, but i can not find any commands to do so. I also want all the kernel code to go into a directory called "kernel".
            Is there a feature in make that allows automatic compilation or is there just something I'm not seeing. And could anyone suggest any make docs to help me understand this makefile.

            My Makefile:

            ...

            ANSWER

            Answered 2021-Mar-25 at 12:30

            All make systems (as required by POSIX) have a number of built-in rules including rules that know how to compile object files from C files.

            For information on GNU make's built-in rules you can review the manual.

            Source https://stackoverflow.com/questions/66795490

            QUESTION

            qemu-system-riscv64 is not found in package qemu-system-misc
            Asked 2021-Mar-20 at 12:23

            I'm trying to set up xv6 on Ubuntu 18.04.5 but there is an error during make qemu:

            ...

            ANSWER

            Answered 2021-Mar-20 at 12:23

            Everything went right after I upgraded Ubuntu to version 20.04.2 :)

            Source https://stackoverflow.com/questions/66718225

            QUESTION

            make qemu on xv6-riscv gets stucked at qemu-system-riscv64 ... command
            Asked 2021-Mar-20 at 06:47

            On Ubuntu 20.04, I installed the xv6 project using the page Tools Used in 6.828

            ...

            ANSWER

            Answered 2021-Mar-20 at 06:47

            This has been mentioned in Tools Used in 6.S081

            At this moment in time, it seems that the package qemu-system-misc has received an update that breaks its compatibility with our kernel. If you run make qemu and the script appears to hang after

            Source https://stackoverflow.com/questions/66390948

            QUESTION

            Debugging xv6 kernel with gdb - Selected architecture i386 is not compatible with reported target architecture
            Asked 2020-Oct-11 at 15:21

            I'm running on Ubuntu 20.04 host and try to remote debug xv6 kernel running locally under qemu emulator.

            I run :

            1. gdb kernel
            2. target remote localhost:26000

            I get :

            Remote debugging using localhost:26000 warning: Selected architecture i386 is not compatible with reported target architecture i386:x86-64 warning: Architecture rejected target-supplied description Remote 'g' packet reply is too long (expected 312 bytes, got 608 bytes): 0000000000000000000000000000000000000000000000006306000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f0ff0000000000000200000000f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007f0300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000801f0000 (gdb)

            Any idea how can I solve this problem ?

            Thanks!

            Gil

            ...

            ANSWER

            Answered 2020-Oct-11 at 15:21

            Use the following command in gdb:

            Source https://stackoverflow.com/questions/63550156

            QUESTION

            qemu-nox throws errors in cat.c file in xv6 while running make qemu-nox
            Asked 2020-Aug-31 at 03:19

            I'm trying to implement ps command in xv6 (adding system call), I have followed the process of making one and in the end while using the command "make qemu-nox" to finally test the system call i get the following errors

            ...

            ANSWER

            Answered 2020-Aug-30 at 17:23

            The compiler is claiming that you're in a function named "cps()" on line 9 of your file cat.c, which is obviously not what that function is named. It's also complaining about an issue in user.h itself. This is the clue that the problem is not directly in your cat.c file, but somewhere in the headers it is including (probably in user.h).

            Source https://stackoverflow.com/questions/63656684

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install xv6

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/sam46/xv6.git

          • CLI

            gh repo clone sam46/xv6

          • sshUrl

            git@github.com:sam46/xv6.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link