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
xv6 installation in WSL (Ubuntu 20.04 LTS)
I have been trying to install xv6 using the following commands:
sudo apt-get install qemu
sudo apt-get install libc6-dev-i386
tar xzvf xv6-rev11.tar.gz
cd xv6-public
make
make qemu
I get the following error while running make qemu…

cryogene
- 45
- 3
2
votes
2 answers
Use of __attribute__((noreturn)) for the exit function declaration in 'user.h' of the xv6 source code?
In the user.h
https://github.com/mit-pdos/xv6-riscv/blob/a1da53a5a12e21b44a2c79d962a437fa2107627c/user/user.h#L6
exit is only syscall defined this way
int exit(int) __attribute__((noreturn));
why this is needed for the exit function declaration?

pav
- 47
- 4
2
votes
1 answer
What is the use of stat.h in cat.c file of the xv6 os?
What is the use of the stat.h header in cat.c?
Here you have the cat.c
https://github.com/mit-pdos/xv6-riscv/blob/riscv/user/cat.c
Here you have the stat.h
https://github.com/mit-pdos/xv6-riscv/blob/riscv/kernel/stat.h
I do not see any direct use of…

pav
- 47
- 4
2
votes
3 answers
@echo in Makefile always causes error " *** missing separator. Stop."
I put
@echo "============= $(TOOLPREFIX) ================="
in line 34 of Makefile of xv6 used by many OS courses, in hope of printing out the value of variable TOOLPREFIX. But I always got error
Makefile:37: *** missing separator. Stop.
This…

zzzhhh
- 291
- 3
- 10
2
votes
0 answers
create/add a child to a child using fork in xv6
THIS IS xv6
I’m working on an assignment where we are instructed on testing an implementation of the method ps. ps prints all of the active processes, their process id, parent id, state, and name. For the first test, we are to assign 8 children to a…

Relby Bry
- 21
- 2
2
votes
0 answers
Maintaining History of Commands in xv6
I tried to maintain history of commands in xv6 which can be accessed using up and down arrow keys. I tried to maintain a history of 16 commands at time. I tried to start implementing it by starting from console.c but ended up getting confused. How…

coder_01
- 83
- 3
2
votes
1 answer
In this case, isn't the process always unable to be killed?
The problem involves relatively fragmented code, here I give the main code.
Full code: syscall.c
static uint64
argraw(int n)
{
struct proc *p = myproc();
switch (n) {
case 0:
return p->tf->a0;
case 1:
return p->tf->a1;
case 2:
…

RecharBao
- 371
- 2
- 10
2
votes
1 answer
Why in xv6 there's sizeof(gdt)-1 in gdtdesc
In bootasm.S
.p2align 2 # force 4 byte alignment
gdt:
SEG_NULLASM # null seg
SEG_ASM(STA_X|STA_R, 0x0, 0xffffffff) # code seg
SEG_ASM(STA_W, 0x0, 0xffffffff) # data…

rapiz
- 117
- 11
2
votes
1 answer
Double Acquire a Spinlock in XV6
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…

Daneshvar Amrollahi
- 73
- 9
2
votes
1 answer
I can't understand this line of code in xv6
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…

RecharBao
- 371
- 2
- 10
2
votes
0 answers
Two questions about TSS involvement when an interrupt occurs
The questions arose when I am reading xv6 (x86 version) about how registers of user process are saved. The situation is that while a common user program is running, a hardware interrupt occurs like timer. From my reading of xv6 code and its book, my…

zzzhhh
- 319
- 1
- 8
2
votes
1 answer
can anyone explain about this XV6 inline asm validateint() test function that uses a pointer as ESP for a system call?
Hi~ I'm working on xv6 and I'm stuck on the validate test in usertests.c. There is asm code and I'm quite confused about what exactly is going on here. Would you like to explain that for me?
// try to crash the kernel by passing in a badly placed…

MusicalChicken
- 119
- 10
2
votes
1 answer
XV6 locking of process table in scheduler
I'm confused about the acquire and release relating to the lock on the ptable used in the function below (yield() from proc.c).
My instructor says the lock on ptable is acquired to avoid race conditions with other CPUs that might access the ptable…

sakana
- 97
- 1
- 5
2
votes
0 answers
xv6 system panic when attempt to read big file
This is the old task of implementing double-indirect inodes for the xv6 system. In double indirect a file can have 16523 blocks (11 direct-pointer + 1 single-indirect-pointer*128 + 1 double-indirect-pointer*128*128), and my implementation satisfies…

Z E Nir
- 332
- 1
- 2
- 15
2
votes
2 answers
xv6 makefile says undefined reference to __printf_chk
I'm trying to add a user space program in xv6, but when I try to compile it gives error: "/usr/include/bits/stdio2.h:104: undefined reference to __printf_chk". Any help?
My user program:
#include
#include
#include…

Syed
- 57
- 1
- 6