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
2
votes
1 answer

Implementing kernel level threads in xv6

I am trying to implement kernel level threads in xv6. My main problem at the moment is to understand how the CPU gets its information about the current process and how to modify it to point to the current thread instead. I know it is somehow linked…
Shperb
  • 474
  • 7
  • 19
2
votes
3 answers

small c compiler for educational purpose

Is there any small c compiler which follows ansi c extensions and still it has less than 10,000 LOC. Basically 'm trying to port such small compiler to one of such educational OS kernel known as xv6. Thanks.
user2015646
  • 39
  • 1
  • 4
2
votes
1 answer

How to have a guard page between heap and stack?

I have defined an upward stack in xv6 (which had a downward stack) and want to know how I put a guard page between the stack and the heap. Is there any specific system call I can make use of? Also how can I maintain that one page address space to…
Mona Jalal
  • 34,860
  • 64
  • 239
  • 408
2
votes
2 answers

How to find your directory manually in Linux?

I am about to write a command that shows the current directory in linux. I know I can use the "pwd" command, but that's what I need to implement myself!... in other words, when entering the so called "findme" command, I want to return back the…
1
vote
2 answers

Makefile of xv6

I am reading the code of xv6, and find it hard to read the Makefile. Could you tell me how the following statements work: 1. "CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)" 2. "LDFLAGS…
akirast
  • 1,137
  • 1
  • 8
  • 10
1
vote
1 answer

value not ignored "(argaddr(0, &fva)"

I am looking to add xv6 page table functionality. However, for some reason I am getting errors with argaddr and argint. Why? Lab reference: xv6 page table int sys_pgaccess(void){ uint64 fva; int pnum; uint64 abits; int res = 0; pte_t*…
tsosilio
  • 13
  • 2
1
vote
1 answer

xv6 - I'm trying to implement shared memory, but getting a segfault-type usertrap error

I am trying to implement a primitive form of shared memory called “Shrimpy Memory” into my xv6 repo. So far, I’ve gotten xv6 to compile and run, but whenever I try to set a value for anything in that space, it causes an error that I hear is…
1
vote
1 answer

Why does MAXVA in xv6 source code differ from the value in the xv6 textbook?

Why is the MAXVA value defined differently in the xv6 textbook of MIT 6s081 and the xv6 source code? The textbook states that the maximum address is 2^38 - 1 = 0x3fffffffff, while the source code defines MAXVA as (1L << (9 + 9 + 9 + 12 - 1)), which…
Aries Zhao
  • 29
  • 6
1
vote
0 answers

How to pass argument from system call to user space in xv6

I am writing codes on a thrd_stop function. It has similar functionality as the practice lab of chapter 4 in xv6, the alarm. When thrd_stop is called, start a timer and call handler when the timer reaches the inverval. The difference between mine…
Adi_Hsiao_0410
  • 111
  • 2
  • 9
1
vote
2 answers

Order of execution of system call in xv6

When we use the system call (at the user level), we never put the sys_ prefix, but why when we call the system call function, first the system call handler function (which is prefixed with sys_ )is called.Here we called the sleep function, but it…
Satar
  • 37
  • 7
1
vote
0 answers

GDB "cannot find bounds of current function" when stepping into trampoline function at a special address

When I try to debug XV6 (an OS), I find GDB can't reach the assembly code. I want to find out how to trace the executing path in the assembly code. The file kernel/trap.c refers to the assembly code kernel/trampoline.S by the extern keyword, so that…
1
vote
1 answer

Implementing dup2 in xv6

I'm taking an OS class and we have to implement dup2() in xv6. The code I've written should theoretically work, but, when I try to execute tests, it doesn't pass all of them. This is my system call: int sys_dup2(void) { int oldfd, newfd; struct…
1
vote
1 answer

Copy single byte to multiple memory locations in XV6 8086 Assembly 0x13 VGA (Real Mode)

Before anybody tells me that this technology is outdated, I am aware however the scope of the project is very specific. My requirement is to print a filled rectangle to the output by writing directly to the video memory (0x13 in real mode). I have…
1
vote
1 answer

Why do I have different dynamic allocation sizes and output results in xv6?

uint memsize(void){ // Simply insert the memory size of the current process into size and return size uint size; struct proc *p; p = myproc(); size = p->sz; return size; } // test_memsize.c #define SIZE 2048 #include…
y J.
  • 131
  • 4
1
vote
0 answers

cat function not printing the last line of the input file

#include // for close, fork #include #include // for open int main() { char *argv[2]; argv[0] = "cat"; argv[1] = 0; if (fork() == 0) { close(0); open("input.txt", O_RDONLY); …