Giter Site home page Giter Site logo

cs4414-ps4's Introduction

About Me

๐Ÿ‘จโ€๐Ÿ’ป I'm a Compiler Engineer, working on LLVM-based Toolchains for RISC-V and other embedded platforms. In the past I worked on toolchains for Arm and AArch64.

๐Ÿค” I used to be a programming languages researcher. I worked on Checked C and Idris, as well as other projects and publications.

cs4414-ps4's People

Contributors

aml3 avatar lenary avatar mzweilin avatar nathantypanski avatar wbthomason avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

nathantypanski

cs4414-ps4's Issues

Upside-down

Problem 3. After a particularly long and painful night of kernel-hacking, you are starting to feel like everything is upside-down. To correct this, modify the code so characters are printed upside-down (that is, the letters should appear normal if you turn the screen upside-down). (Hint: this only involves changing one line of code.)

(After you complete problem 3, you may comment out your code and go back to rightside-up characters, but that's up to you which you prefer.)

Filesystem

In order for our commands to actually do anything we need to add a filesystem.

The simplest filesystem just implements a tree, where each branch node is a directory and each leaf node is a file. For now, we'll only support text files. In addition, we'll keep all our files in memory. Writing a driver for a disk is hard and depends on the physical device, but we'll assume the owner of a machine running IronKernel is rich enough to purchase all the memory they need and won't every shut down their machine, so an in-memory filesystem is sufficient!

A simple filesystem provides these calls:

  • read_file(file) - returns the string stored in a given file
  • write_file(file, string) - writes the given string to the given file
  • create_file(directory, name) - creates a file with the given name in the given directory
  • delete_file(directory, name) - deletes the file with the given name in the given directory
  • get_file(directory, name) - gets the file with the given name belonging to the specified directory
  • list_directory(directory) - returns the list of files and directories contained in the specified directory
  • create_directory(parent, name) - creates a directory with the specified name under the given parent directory
  • delete_directory(directory) - deletes the given directory if and only if it is empty
  • get_directory(parent, name) - gets the directory with the given name belonging to the specified parent

Problem 6. Implement a filesystem that provides at least the calls described above.

Once the filesystem calls are implemented, you can use them to implement commands that users could use to manipulate files in your shell.

Improving IronKernel

For the last problem, your goal will be to improve Ironkernel in some way.

Problem 9. Improve your kernel in some interesting way.

Some suggestions include getting the arrow keys to work, getting pipes to work, and implementing ext4's filesystem paradigm, which makes less fragmented files but gives up some speed in accessing files sequentially.

If you want to do an ambitious improvement, you can get started on it for this problem, but make finishing the improvement your final project.

Memory Management

Memory in Ironkernel is done using the Buddy Blocks allocation system. This system treats the whole memory as something akin to a binary tree, where each requestion for a segment of memory would involve traversing down the tree until you find a block just big enough to contain it. For example, if your block of memory was 128kb large and you request for an allocation of 26kb, we would divide the memory space into something akin to:

          32kb    32kb        64kb
        |xxxxxxx|------|----------------|

and the user would be guarenteed the first block for their allocation.

We have provided intial code for the Buddy Block allocation system (which was enough for you to implement the file system using it), but there's a fatal bug in it! Whenever space is reclaimed, our code fails to reclaim it correctly.

Problem 8. Identify the bug with the Buddy Block allocation system and fix it. (Hint: What is the correct behavior of the memory manager when two adjacent blocks are both reclaimed and free?)

Echo

Problem 4. Modfify kernel/sgash.rs to echo whatever you type into the prompt back to you on the second line.

Background:

The first step to having a working shell in our kernel is for it to remember what you typed into it. However, libraries like string formatting are not provided to you on a standalone piece of hardware. In fact, the only thing you get is raw data types like u8, uint, and char. So we have to first implement a simple string library to more easily manipulate what the user types.

sgash>

Problem 1. Modify kernel/sgash.rs to make it prompt you with sgash> whenever the user types enter. (The actual change is simple, but the point of this question is to get you starting to explore the Ironkernel code.)

Color scheme

Problem 2. Change the color scheme of Ironkernel to something cooler. Bonus points if you allow users to change their own colors. Be prepared to explain how characters are drawn to the screen during the demo. (Hint: look in arch/arm/io)

Shell commands for filesystem

Problem 7. Implement ls, cat, cd, rm, mkdir, pwd, mv, and wr as built-in shell commands that use your filesystem.

Commands

Problem 5. Code in some basic commands, so that the system recognizes echo, ls, cat, cd, rm, mkdir, pwd, and a new invented command wr for writing a string to a file. We will implement these commands in a later step.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.