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
1
vote
0 answers
Ubuntu 16.04 freezes everytime I run the command 'make qemu'. How can I solve it?
I searched this solution on the internet but couldn't find much. I am doing my Operating System assignment on XV6. I am using the shell file below every time I need to emulate on qemu.
make clean
make
make qemu
Qemu emulator runs and asks for…

shamiul97
- 315
- 1
- 3
- 13
1
vote
1 answer
What is Omode in Xv6?
when dealing with files in xv6, I can see an integer variable called Omode. what is it? what values could it have?
for example, this is the open system call from Xv6:
int sys_open(void)
{
char *path;
int fd, omode;
struct file *f;
struct…

mohammed
- 21
- 2
1
vote
1 answer
How to understand the following code in xv6 bootstrap code?
Code:
#define SEG(type,base,lim) \
.word (((lim) >> 12) & 0xffff), ((base) & 0xffff); \
.byte (((base) >> 16) & 0xff), (0x90 | (type)), \
(0xC0 | (((lim) >> 28) & 0xf)), (((base) >> 24) & 0xff)
I know it's a segment…

Alex Liu
- 95
- 1
- 8
1
vote
1 answer
What's the mechanism behind P2V, V2P macro in Xv6
I know there is a mapping mechanism in how a virtual address turns out into a physical.
Just like the following, a linear address contains three parts
Page Directory index
Page Table index
Offset
Here is the illustration:
Now, when I take a look…

brianmeowmeow
- 35
- 1
- 3
1
vote
1 answer
How does wakeup(void *chan) works in xv6?
I'm learning about osdev and looking up xv6 code, currently - the console code in particular. Basically, I don't get how the console launches a process.
in console.c there is a function:
void consoleintr(int (*getc)(void)) {
....
while((c =…

S. Ton
- 35
- 6
1
vote
0 answers
What is sector granularity in this case?
I'm studying xv6: unix like operating system.
For exercise quiz, it asks:
Due to sector granularity, the call to readseg in the text is equivalent to readseg((unchar*) 0x100000, 0xb500, 0x1000). In practice, this sloppy behavior tunrs out not to…

merry-go-round
- 4,533
- 10
- 54
- 102
1
vote
0 answers
How to initialize a globe struct in xv6
I am trying to implement a queue in xv6. In proc.c ,I have a structure named
struct pqueue_n
{
struct proc *head;
struct proc *tail;
int lenght;
};
I have also create an array of structure
struct pqueue_n queue[MAX_LL];
The…

Kobina Tetteh Dadzie
- 23
- 5
1
vote
2 answers
Add a generic file in xv6 makefile
I'm currently studying the xv6 OS.
I found out here how to add a system call by modifying the MAKEFILE file.
My question is: how do we add simple text files or any other kind of file to be seen in the xv6 system once it boots?

Nicolò Gasparini
- 2,228
- 2
- 24
- 53
1
vote
2 answers
How to pass a value into system call XV6
I am attempting to create a system call that will increment a number that was added to the cpu struct. However I believe that a sys call has to be void so how can I pass in a value when calling it for example.
incrementNum(3);

user8351474
- 19
- 1
- 4
1
vote
0 answers
Xv6 context switch
This code is the code given for context switching in xv6. Although I am able to understand that the overall code saves the registers from the old context on to the PCB, I am just not able to wrap my head around how each line works.
void swtch(struct…

Ajayv
- 374
- 2
- 13
1
vote
1 answer
Hardware and Sotfware saves during Context Switch in xv6
I'm studying the xv6 context switch on Operating Systems: Three Easy Pieces book. I can not fully understand the Saving and Restoring Context section of Chapter 6 (page 8).
Why there are two types of register saves/restore that happen during the…

xevous
- 31
- 2
1
vote
1 answer
How to pass arguments to system call at xv6?
I am trying to implement a new system call at xv6.
Had some trouble to pass arguments.
Lets say this is my system call.
sys_mySystemcall(int* x ,struct myStruct * y);
How do I get these 2 pointers at sysproc.c?
Thanks,

David
- 733
- 2
- 11
- 30
1
vote
0 answers
How to access to the top of the stack in xv6?
I'm trying to access to the top of the stack for the main process in xv6. How i must do it?
Thanks.

ourobor93
- 372
- 1
- 7
- 21
1
vote
1 answer
Get dinode/inode of directory/file by name in XV6
I am trying to traverse all of the allocated inodes in the filesystem for xv6 and I want to get the dinode of the root directory and go from there, but I have had trouble getting this to work. I tried using 'dirlookup()' but no matter what I…

bs7280
- 1,074
- 3
- 18
- 32
1
vote
1 answer
`-Wa,-divide` option in Clang or LLVM
I am porting xv6 from GCC to Clang, and met the following error message:
clang -m32 -gdwarf-2 -Wa,-divide -c -o swtch.o swtch.S
clang-3.8: error: unsupported argument '-divide' to option 'Wa,'
Note that -Wa is used to pass arguments to the…

Jeehoon Kang
- 311
- 1
- 13