Questions tagged [xv6]

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.

326 questions
1
vote
2 answers

qemu-system-riscv64 is not found in package qemu-system-misc

I'm trying to set up xv6 on Ubuntu 18.04.5 but there is an error during make qemu: # outputs... qemu-system-riscv64 -machine virt -bios none -kernel kernel/kernel -m 128M -smp 3 -nographic -drive file=fs.img,if=none,format=raw,id=x0 -device…
1
vote
0 answers

Debugging xv6 using QEMU and GDB: cannot resolve name: nodename nor servname provided, or not known

As stated in the title, I'm trying to use QEMU and GDB to debug xv6 as part of an OS project. I'm able to make qemu and make qemu-nox perfectly, but when I run make qemu-gdb or make qemu-nox-gdb the command hangs and the output is…
Allen Ma
  • 95
  • 7
1
vote
1 answer

XV6: bootmain - loading kernel ELF header

I have been analyzing the code of bootmain.c code in xv6 kernel: void bootmain(void) { struct elfhdr *elf; struct proghdr *ph, *eph; void (*entry)(void); uchar* pa; elf = (struct elfhdr*)0x10000; // scratch space // Read 1st page off…
1
vote
2 answers

Installing xv6 on a macOSX 10.15

I've been trying to install xv6 on my macOSX through terminal. I used the command brew install qemu to install qemu and have hit the codes: sudo port install i386-elf-gcc and after modifying the Makefile from i386-jos-elf to i386-elf- I'm receiving…
LeoWan
  • 23
  • 6
1
vote
0 answers

Why is there a continue statement in xv6's scheduler algorithm?

The first branch in the loop's body has a continue statement, but I'm not exactly sure why. I'm under the impression that a continue statement here is unnecessary, and that having an if-statement like if(p->state == RUNNABLE) with the rest of the…
sbw
  • 46
  • 4
1
vote
0 answers

About fine-grained locking implementation in MIT 6.828 (2018) operating systems engineering course

I am now trying to making progress on the MIT 6.828 (2018) course on Operating Systems Engineering, and I like it a lot. It is fun and challenging. I learned a lot of basic OS knowledge from this. Now I am struggling with this fine-grained locking…
Xin
  • 113
  • 3
  • 9
1
vote
1 answer

XV6 - Pass parameters to systemcall and get return value

I need to write a system call in XV6 that gets a few integers and a few integer pointers as arguments, and I don't understand how to do it. I read about argint and argptr, but I don't understand how to use them. For example, I don't understand if…
Dani
  • 719
  • 1
  • 7
  • 14
1
vote
1 answer

Why disable interrupts in XV6 scheduler?

For the sched() function (proc.c) in XV6 why must we disable interrupts when doing a context switch? Is it because if interrupts are enabled, the sched function can be repeatedly invoked? Why must ncli (the depth of pushcli nesting) be equal to…
sakana
  • 97
  • 1
  • 5
1
vote
1 answer

Dynamic memory allocation in XV6 kernel

I want to implement a Queue struct (using Node struct, similiral to the C code here) in files Queue.c and Queue.h in order to store processes in proc.c in XV6 kernel. I don't know how to to do it, since it requires to use malloc, but I can't use it…
Dani
  • 719
  • 1
  • 7
  • 14
1
vote
0 answers

x86: Triple fault on call instruction after switching page directory

I've been building my version of the xv6 OS, but just as I switch to a newly created page directory and try to call a function, it triple faults. A lot of similar questions have been asked and usually the problem is that a page fault is not…
Ivan Ivanov
  • 2,042
  • 1
  • 19
  • 28
1
vote
1 answer

Why the keyboard input is written back to IO bus in xv6?

I do not understand why the input got from keyboard interrupt is written back to the io bus again: This is the keyboard interrupt handler: void consoleintr(int (*getc)(void)) { // I skipped some code for simplicity default: if(c != 0…
maksadbek
  • 1,508
  • 2
  • 15
  • 28
1
vote
1 answer

In xv6, how can i make child process run first after fork()?

I've seen plenty of related questions and replys, however, no one can provide a good solution, could you help me? Add: we may need to add a system call to determine whether to use this order or not.
1
vote
1 answer

Where to implement fifo and lifo in xv6

I am currently doing a homework with xv6, i need to implement FIFO and LIFO with the following style of code: #define IFO 1 #if IFO==1 DO FIFO HERE #endif #if IFO==2 DO LIFO HERE #endif What xv6 file should i modify to implement those…
Cipher
  • 77
  • 1
  • 9
1
vote
2 answers

XV6: pwd implementation

I was trying to implement pwd command in xv6 system. But i am getting a error in sysfile.c execution. The function is as follows showing the error:- int sys_getcwd(void) { char *p; int n; if(argint(1, &n) < 0 || argptr(0, &p, n) < 0) …
MSD
  • 11
  • 3
1
vote
1 answer

xv6 boot loader: Reading sectors off disk using CHS

I've been trying to wrap my head around the C part of the xv6 boot loader (the question is below the code) void bootmain(void) { struct elfhdr *elf; struct proghdr *ph, *eph; void (*entry)(void); uchar* pa; elf = (struct elfhdr*)0x10000; …
Ivan Ivanov
  • 2,042
  • 1
  • 19
  • 28