====== E Task Project -- System Calls ====== You have to present the E2 and E3 tasks personally. E0 and E1 are evaluated automatically by the Upload System. ''WARNING: This information might be out of date. This version is up-to-date for the summer term 2016.'' ===== Task E0: Fibonacci number computation (x86) ===== Your task is to create a program in assembly language (x86) for computing [[https://en.wikipedia.org/wiki/Fibonacci_number|Fibonacci number]] without using any other libraries. For reading a value from stdin and printing the result use "int 0x80" system call. Details are in the PDF provided. [[http://labe.felk.cvut.cz/~stepan/33OSD/files/e0/cfibo.c|cfibo.c -- Reference implementation in C language]] [[http://labe.felk.cvut.cz/~stepan/33OSD/files/e0/cfibo_errchk.c|cfibo_errchk.c -- Reference implementation in C language with error checking]] [[http://labe.felk.cvut.cz/~stepan/33OSD/files/e0/Makefile|Makefile for E0 task]] Please upload only ''.s'' file with assembly code. [[http://labe.felk.cvut.cz/~stepan/33OSD/files/e0-asm-syscalls.pdf|E0_Syscalls (PDF)]] ===== Task E1: System Calls from Userspace (x86) ===== [[http://labe.felk.cvut.cz/~stepan/33OSD/files/syscalls.pdf|Support information and specification (PDF)]] [[http://labe.felk.cvut.cz/~stepan/33OSD/files/e1-syscalls-inline-asm.pdf|Inline assembly info (PDF)]] [[https://github.com/0xAX/linux-insides/blob/master/Theory/asm.md|Inline assembly at linux-insides]] Create a program that: * opens a (text) file named ''file.txt'' (in the current directory) * reads the first 100 characters from the file (or the whole file if it is shorter) * prints the first line read to the ''stdout'' (a line is terminated by the ''EOL'' character) * executes a program ''/bin/date'' (using a syscall ''execve()'') Implement the program using system calls //only//. Do not use standard C libraries -- Use gcc parameters ''-nostdlib -nostdinc'' for compilation. Implement the task in one ''.c'' file. You can eventually create a few other included files ''.h''. Upload the solution file (single ''.c'' in a ''ZIP'' archive) using the [[http://cw.felk.cvut.cz/upload|Upload System]]. If you copied the code from PDF slides and have not been able to compile it, you probably need to correct the quotes around the ''memory'' keyword. ===== Task E2: Nova OS, user/kernel context switch, execution of ELF executable ===== [[http://labe.felk.cvut.cz/~stepan/33OSD/files/osd-e2-kernel.pdf|Support materials and E2 task specs (PDF)]] [[http://labe.felk.cvut.cz/~stepan/33OSD/files/osd-e2.tar.gz|OS kernel source (tar.gz)]] [[http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html|GCC inline assembler howto (online)]] Upload only changed files to the [[http://cw.felk.cvut.cz/upload|Upload System]], i.e. only ''ec.cc''. * If you cannot compile the code, you probably need the ''g++'' compiler (package) installed. * If the hypervisor does not execute, you probably need the ''qemu'' emulator (package) installed. If you have lost your mouse cursor, it has been grabbed by the ''QEMU'' console. Press ''Ctrl+Alt'' to release it. ===== Task E3: User processes, system calls from kernel side ===== [[http://labe.felk.cvut.cz/~stepan/33OSD/files/osd-e3-kern-syscall.pdf|E3 specification (PDF)]]