xv6 is a small Unix-like teaching operating system made by MIT for its 6.828 OS course. It is inspired by Unix Version 6.
Questions tagged [xv6]
326 questions
2
votes
1 answer
In xv6, what does the uvm and kvm in switchuvm / switchkvm stand for?
I have not been successful in finding out what uvm or kvm stands for in xv6. I will need it for an exam on explaining each part of a section of a code, and I would love to be able to say its definition also. Is here anyone who can tell me? I'm…

Ali Öztürk
- 113
- 2
- 9
2
votes
1 answer
Implementing lseek in xv6
First off I need to say it's completely possible I'm missing something.
My assignment is to essentially implement 'fprintf'. Now while appending to the file isn't required, I like to go above and beyond.
My issue is, I can't find a definition for…

Flacarile
- 69
- 5
2
votes
2 answers
xv6: reading ticks directly without taking the ticks lock?
I'm working on an assignment in operating system course on Xv6. I need to implement a data status structure for a process for its creation time, termination time, sleep time, etc...
As of now I decided to use the ticks variable directly without…

Adam Jensen
- 49
- 1
- 5
2
votes
3 answers
How to install xv6 on virtualbox or vmware?
I'm trying to run xv6 operating system on VirtualBox or VMWare in a Linux host. The official instructions said how to run the OS on qemu only. However, the official page (https://pdos.csail.mit.edu/6.828/2014/xv6.html) mentioned that xv6 can be…

Abhik Bose
- 161
- 3
- 7
2
votes
2 answers
Xcode: Type 'struct dirent' has incompatible definitions in different translation units
I am trying to build a program with xv6's fs.h header file.
I only have three files in my Xcode project: type.h(unmodified), fs.h(unmodified) and main.c as below.
#include
#include "types.h"
#include "fs.h"
int main(int argc, const char *…

Jay Wang
- 2,650
- 4
- 25
- 51
2
votes
1 answer
How does deallocuvm work in Xv6?
By the comments in source code, deallocate does deallocating user pages to bring the process size from oldsz to newsz
My question is when pte not existed, it should continue searching next page directory entry, but why PGADDR(PDX(a) + 1, 0, 0)…

brianmeowmeow
- 35
- 1
- 3
2
votes
1 answer
How to link standard library to a cross-compiler?
I want to build xv6 on macOS, so I installed the cross-compiler toolchain i386-elf-gcc and i386-elf-gcc from a Homebrew Tap.
The problem is i386-elf-gcc cant link standard libraries while compiling. I tested on a simple c file, and got the following…

Jay Wang
- 2,650
- 4
- 25
- 51
2
votes
1 answer
How to implement clone for kernel level threads in xv6
While attempting to test my clone syscall (code below), I keep getting the following errors:
pid 4 thread_test: trap 13 err 0 on cpu 1 eip 0xc54 addr 0x0--kill proc
pid 5 thread_test: trap 14 err 4 on cpu 1 eip 0x0 addr 0x28ec83e5--kill proc
Which…

Turtle
- 1,369
- 1
- 17
- 32
2
votes
1 answer
Restoring Stackframe in x86
I am trying to write a program that implements signals into xv6
I have figured out how to manipulate the stack (I think) and I am just having trouble restoring it. Here is my code for signal deliver:
This function adds the signal frame ot the…

bkennedy
- 403
- 1
- 4
- 17
2
votes
0 answers
Lottery scheduler in xv6 - random number generator causing kernel to fail
I am trying to implement lottery scheduling in xv6, and I seem to face an error. I need help with the debugging directions. Here is my code:
In proc.c
I modified function void scheduler and added a new function for random number generation:
unsigned…

Preethameranki
- 21
- 5
2
votes
2 answers
What is context in xv6?
what is the usage of context in xv6 OS ?
what is the job of each register in context ?
struct context {
uint edi;
uint esi;
uint ebx;
uint ebp;
uint eip;
};

Mohammad Mahdi KouchakYazdi
- 1,318
- 2
- 21
- 28
2
votes
2 answers
How to run a c program in xv6 operating system
I'm new to xv6 OS,I wanted to run a C program in xv6, is there a command or something in it to compile and run a C program?

HanSol
- 51
- 1
- 10
2
votes
2 answers
Create, write, read file in proc.c XV6 OS
I want to create a file in proc.c (kernel mode) and write something to it but the provided system call (open) is for user mode in user.h header and I can't include user.h in proc.c, Is there any other way to do this in proc.c?

Siavash
- 308
- 5
- 17
2
votes
1 answer
Bad file descriptor when running cat command in a shell
I'm trying to implement I/O redirection in a shell that I'm writing for a Unix-like OS (xV6). In the manual that I'm reading for the OS, I found the following code that would run in the shell for the execution of the cat command:
char…

loremIpsum1771
- 2,497
- 5
- 40
- 87
2
votes
2 answers
Shell seems to recognize commands but doesn't execute them
I am trying to implement basic command execution in a shell program for the unix-like xv6 OS. The part of the shell code that I am editing is the runcmd function where I am using the execvp command to execute the commands used in the terminal. The…

loremIpsum1771
- 2,497
- 5
- 40
- 87