xv6 | xv6 - my fork of MIT 's xv6 unix system
kandi X-RAY | xv6 Summary
kandi X-RAY | xv6 Summary
This is my fork of the xv6 Unix system. I'm considering it as a base for my Rune userland.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of xv6
xv6 Key Features
xv6 Examples and Code Snippets
Community Discussions
Trending Discussions on xv6
QUESTION
Now I am trying to access makefile variable in my user program in xv6. In other linux system, it can be easily achieved by doing that
- in makefile, define
gcc -D MYVARIABLE=1 ...
- in my linux user program, by defining
#include
, I can accessMYVARIABLE
.
but in xv6, there is no . so I can't access MYVARIABLE
.
How can I do for access MYVARIABLE
??
ANSWER
Answered 2022-Apr-05 at 12:05Guessing you use this repo: https://github.com/mit-pdos/xv6-public, you can define MYVARIABLE
in CFLAGS
declaration, near line 83.
QUESTION
now I try to understand xv6 code. and I found below code.
I think this code is related to assembly, but I couldn't find what it means.
especially, I found the front part of asm volatile(:)
means assembly opeation set and what is the eflags, but I couldn't find what the back of this("=r" (eflags)) means.
So my question is.. what does the below code mean? If you can give me some answer or advice, I'll really thank you for your sharing. Thank you :)
...ANSWER
Answered 2022-Mar-19 at 08:15To answer your last question, the "=r" (eflags)
part is the way in which one specifies in GCC inline assembly¹ what variable to use with a storage "location" and in what manner (https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html). Locations are numbered from 0, and multiple locations can be specified. %0
hence being the first one.
pushfl
pushes the contents of the EFLAGS
register onto the stack, and pop %0
removes the topmost value, i.e. the EFLAGS
value and places it in location %0
, which would be the eflags
variable. It is done this way, because the IA-32 instruction set does not contain an instruction to read EFLAGS
directly.
1: also used by LLVM, but not MSVC – inline assembly is not standardized!
QUESTION
i have cloned the xv6-public repository in ubuntu virtual box and i have used the commands
...ANSWER
Answered 2022-Mar-02 at 09:23I've learned this solution from somebody named Amrollahi.
Try these steps, if your current step works, don't try the rest of it.
QUESTION
The output of the following code is just "hello!", which is confusing because when I do make qemu to start xv6 everything compiles well, but obviously something goes wrong with the function getiocounts.
I am new to sys calls, so there might be something obvios I'm missing. Please help! Thank you!
...ANSWER
Answered 2022-Feb-17 at 13:50Some mistakes in your kernel code:
- Your system call is not correctly defined: its parameters prototype should be
(void)
- Your parameter reading is wrong: you must read the first parameter:
argptr( 0, ...
QUESTION
ANSWER
Answered 2022-Feb-05 at 16:50When dealing with paging the golden rule is "never store physical addresses in any kind of pointer". The reasons are:
a) They aren't virtual addresses and can't be dereferenced, so it's better to make bugs obvious by ensuring you get compile time errors if you try to use a physical address as a pointer.
b) In some cases physical addresses are a different size to virtual addresses (e.g. "PAE paging" in 80x86 where virtual addresses are still 32-bit but physical addresses are potentially up to 52 bits); and it's better (for portability - e.g. so that PAE support can be added to XV6 easier at some point).
With this in mind your first line of code is an obvious bug (it breaks the "golden rule"). It should either be pde_t physPgDir = V2P(p->pgdir);
or pde_t * pgDir = p->pgdir;
. I'll let you figure out which (as I suspect it's homework, and I'm confident that by adhering to the "golden rule" you'll solve your own problem).
QUESTION
I have been trying to install xv6 using the following commands:
...ANSWER
Answered 2022-Jan-24 at 07:29You need to install the package containing qemu-system-i386
.
After a little search on https://packages.ubuntu.com, you can find the right package: qemu-system-x86.
To install the missing package, type
QUESTION
In the user/usys.S
here a fragment which is generate by the usys.pl script
ANSWER
Answered 2021-Dec-22 at 19:20Let's just talk about sleep
. In one of your earlier questions, you posted a link to the user.h header file.
That header file tells your C compiler what arguments the function takes and what the function returns, on this line:
QUESTION
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?
ANSWER
Answered 2021-Dec-21 at 18:50I don't think the noreturn
attribute is strictly required, but it helps.
The noreturn
attribute tells the compiler that the exit
function will never return. In theory, this allows the compiler to better understand the possible code paths of any code that calls exit
, so it can display more accurate warnings and optimize the code better.
QUESTION
I'm currently doing an assignment for university and I'm having a couple of issues with a couple of system calls that I have to create for Xv6.
The purpose of these system call is to draw in 0x13 mode from a user program.
My issues are:
- There's a system call that receives some coordinates to save for another system call to use. How and where to I actually store these coordinates (Two int values).
- On a system call to actually draw a line I need to set the value of a pixel to a colour, calling the system call to set a pixel from the first system call doesn't do anything, is it possible to make a system call from another system call?
If tried to just create two int global variables on the sysproc.c file but I'm not sure that they are being stored.
...ANSWER
Answered 2021-Dec-20 at 08:23There's a system call that receives some coordinates to save for another system call to use. How and where to I actually store these coordinates (Two int values).
You can create a new pair of static variables, you can find some examples of such in kernel, for instance struct superblock sb;
in fs.c
, or int nextpid = 1;
in proc.c
So in your case, you can have something like:
QUESTION
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 the stat
struct in the cat.c
so I wonder if there is an indirect one.
ANSWER
Answered 2021-Dec-19 at 13:38It was added in this commit probably because user.h uses the struct stat *
datatype
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install xv6
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page