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

'proc' undefined when trying to add a system call to xv6

I'm trying to add a "clone" system call to the xv6 os. The call creates a new kernel thread which shares the calling process’s address space. The following is my code in proc.c int clone(void(*fcn)(void*), void* arg, void* stack) { int i,…
nhlyoung
  • 67
  • 2
  • 8
0
votes
1 answer

Can two process share same physical page?

Can OS map same physical page to different processes page tables? Can processes share same physical page? If they share same page, can one process can corrupt other processes data and code?
anandthegreat
  • 61
  • 1
  • 9
0
votes
2 answers

How does xv6 knows where last element of p->pgdir is?

In xv6 each process has a struct called proc which stores the process's state. it has a field called pgdir which point to it's page directory. My question is that: It should store the index of the last element in its page directory. I mean if it…
Kamran Hosseini
  • 478
  • 5
  • 25
0
votes
1 answer

Are Two Different Processes Trying to Execute Pipe Instruction segment?

This is how the shell in xv6 handles PIPE command (From xv6-source code). 8650 case PIPE: 8651 pcmd = (struct pipecmd*)cmd; 8652 if(pipe(p) < 0) 8653 panic("pipe"); 8654 if(fork1() == 0){ 8655 close(1); 8656 …
0
votes
1 answer

How to fix linker error when compiling XV6?

I have three files in my XV6: testmain.c, foo.h, and foo.c : foo.h : extern void myfunction(void) foo.c: #include "foo.h" void myfunction(void){ printf(1, "HelloWorld"); } testmain.c: #include "foo.h" int main(void){ myfunction(); …
mohammed
  • 21
  • 2
0
votes
1 answer

What does 0xa55a mean in cga_init() in xv6 source code?

What does 0xa55a mean here? Code: *cp = (uint16_t) 0xA55A; if (*cp != 0xA55A) { /* 0xa55a means that? */ cp = (uint16_t*) (KERNBASE + MONO_BUF); addr_6845 = MONO_BASE; }
Alex Liu
  • 95
  • 1
  • 8
0
votes
1 answer

xv6: bootmain.c readseg() "round down to sector boundary"

Code from xv6's bootmain.c: // Read 'count' bytes at 'offset' from kernel into physical address 'pa'. // Might copy more than asked. void readseg(uchar* pa, uint count, uint offset) { uchar* epa; epa = pa + count; // Round down to…
0
votes
2 answers

Fork() in XV6, does the process child execute in kernel or user mode?

In XV6, when a fork() is called, does the child execute in kernel mode or user mode? This is the fork code in XV6: // Create a new process copying p as the parent. // Sets up stack to return as if from system call. // Caller must set state of…
Nicolò Gasparini
  • 2,228
  • 2
  • 24
  • 53
0
votes
0 answers

How to step C statements in GDB after going into bootmain() from bootasm.S in xv6?

I am using gdb to debug boot loader code in xv6. In bootasm.S, I can use gdb to debug assembly code as expected. Then at the end of bootasm.S, we will call bootmain (line 9168, call bootmain) and the execution will go into the bootmain function of…
user5280911
  • 723
  • 1
  • 8
  • 21
0
votes
1 answer

Cannot boot xv6 after adding some codes to the kernel

I only made a little bit changes to the xv6 kernel to support shared memory. After compiling, I cannot boot it under qemu. It just halts at "booting from the disk...". But I didn't do anything to the bootloader. Can somebody tell me what's…
0
votes
1 answer

fork() not behaving as expected

I'm expecting my fork() to allow my child processes to print where they are in the loop to test my round robin scheduling algorithm, but the count is never printed. More specifically, the parent process executes all and I never see a print from my…
Cody Berry
  • 263
  • 3
  • 14
0
votes
2 answers

Array of strings gets entirely rewrote when I try to append - C (xv6)

I am declaring an array of strings by using: char *commands[100]; I then proceed to enter a while loop that reads commands input from the user: while(getcmd(buf, sizeof(buf), cmd_count) >= 0){ printf(2, "cmd_count: %d\n",…
Kenta
  • 369
  • 1
  • 10
  • 30
0
votes
1 answer

Following xv6/Linux forking and waitpid processes

int main() { int count = 0; int pid; if ( !(pid=fork())) { while (((count<2) && (pid=fork()) ) { count++; printf("%d",count) } if(count>0) { printf("%d", count); …
Aleka
  • 242
  • 1
  • 15
0
votes
1 answer

how sysproc.c and sysfile.c are linked to xv6

I am trying to add a set of system calls to support semaphore in xv6. I added a syssemaphore.c file(which will be instored with functions that will path the user arguments from the ustack using argptr, argint, etc..) and noticed that I cant find the…
0
votes
1 answer

How can we distinguish different part of process memory?

I am trying to dump the memory of process and distinguish the different part, such as code page, guard page, stack, and heap. I can dump the process memory by call a adding system call, and in this system call I use memmove to dump the process…