top of page

CEG 4350/5350 – Operating Systems Internals and Design Solution

Writer's picture: R K GaurR K Gaur

Get expert assistance with assignments and projects for Wright State University's CEG 4350/5350 – Operating Systems Internals and Design. Enhance your understanding of OS design with personalized support and solutions.


Note - On request only, Plagiarism and AI free, manually developed solution will be delivered, Contact only serious person please, Don't wate time.


Project Requirements:

Project 1 – Writing Your First Operating System

Learning Objectives

● Learn the basics of writing a simple operating system and interface with hardware.

Overview

In this project you will become familiar with writing low level OS code, bootloaders, and printing to the display.

Required Setup

To complete this project some setup is required. This setup will also be used in future projects. For future projects refer to this setup section if you must reinstall or need a refresh on the setup procedure.

Required software (Windows users):

● Windows Subsystem for Linux

○ Runs Linux commands easily on Windows

○ Make

■ Builds binary object files

○ GCC

■ C compiler

○ NASM

■ Assembles assembly language

● Bochs x86 PCEmulator

○ Emulates our i386 hardware

● Visual Studio Code

○ Text editor and manages project

Setting Up Windows Subsystem for Linux (WSL) (Windows users):

WSL is required for Windows users to make executing Linux programs and commands easy.

If you have a Mac or a Linux machine to develop with, you don’t have to worry about most of this. You are still required to install g++, build-essential, make, and nasm.

1. Run Powershell on Windows:

a. Search for Powershell in Start menu

b. Right click, select “Run as Administrator”

c. wsl --install


2. Restart computer


3. Create username and password (do not forget it)

a. You should be prompted to create a username and password after you have restarted your computer


4. Run Powershell on Windows:

a. Right click, select “Run as Administrator”

b. wsl sudo apt update

c. wsl sudo apt upgrade

d. wsl sudo apt install g++

e. wsl sudo apt install build-essential

f. wsl sudo apt install make

g. wsl sudo apt install nasm


Setting Up Your Project:

This folder will contain all of your OS source code and image files. Over the semester we will build upon the project in this folder. Do not lose it and keep backups after each project submission.

1. On your computer, create a folder at C:\CEG4350

2. Extract the OS starter code (in Pilot) to this folder

a. The starter code includes a basic bootloader and an empty kernel

b. Inside the CEG4350 folder there should now be one folder called “WSOS”


Setting Up Visual Studio Code:

Visual Studio Code (VS Code) is a helpful interface for editing large programming projects. If you prefer to use a different code editor or IDE you may.

If you have never used VS Code before there are numerous beginner tutorials online that you can reference, here is one: https://www.youtube.com/watch?v=B-s71n0dHUk

1. Install VS Code

2. Open your OS project and install extensions:

a. Open VS Code

b. “Open Folder” -> C:\CEG4350\WSOS\OS

c. Install “Extensions” -> nasm x86 syntax highlighting by Lucian Irsigler

3. Compile the OS:

a. “Terminal” -> “New Terminal”

b. wsl make


Setting Up Bochs (Windows users):

Bochs provides helpful debugging tools which makes OS development easier. If you prefer to use a different emulator or virtual machine interface you may.

1. Install Bochs x86 PC Emulator

b. Scroll down to “Files Page on SF”

c. Open latest version folder (currently 2.7)

d. Download latest win64 release (currently Bochs-win64-2.7.exe)

e. Run the installer to install Bochs

i. Just click next until done, no changes to the installer required


2. Run Bochs

3. Add the OS image to Bochs

a. Open “Bochs Start Menu” -> “Edit Options” -> “Disk & Boot”

b. In “Floppy Options”:

i. Set “First floppy image/device” to your OS’s image (os.img is located in C:\CEG4350\WSOS\OS\build\os.img after you compile your OS)

ii. Set “Type of floppy media” to “1.44M”

iii. Set “Status” to “inserted”

c. Click “OK”

4. Save the Bochs configuration

a. Open “Bochs Start Menu” -> “Save”

b. Save the configuration inside C:\CEG4350\WSOS\OS\ so it is easy to find

5. Load the Bochs configuration

a. Open “Bochs Start Menu” -> “Save”

b. Open your “bochsrc.bxrc” configuration file

c. This load configuration step must be done every time you start Bochs

6. Run the OS

a. Open “Bochs Start Menu” -> “Start”

b. Your OS should now boot and a debug command line should be visible in a separate window

If you have completed the setup process successfully your Bochs window should show this:

Contents of New Project

Now that the setup procedure is complete, you can start writing custom code for your OS.

Look through the project files and you will notice 4 folders, these are their uses:

● asm

○ NASM assembly language files (.asm)

○ Contains the bootloader that sets up your system and loads your kernel

● build

○ All compiled object and binary files (.o, .bin, .img)

○ When you write new .c files and you compile your OS, their object files will appear here

● include

○ C header files (.h)

○ When you write new .c files, create a new .h file for function declarations and macro definitions (see example)

● src

○ C source files (.c)

○ This is the bulk of your operating system, you will write C code .c files here to expand the functionality of your OS

Hello World

For this first project you have 3 milestones that will allow you to print “Hello World!” to the display. After you have made changes to your code and you want to test your code run “wsl make” in the terminal in VS Code, then add the image to Bochs and start your OS.

1. Modify bootloader.asm to disable the blinking cursor. The blinking cursor is the flashing underline that appears after “Booting From Floppy…”. You must use a BIOS interrupt to do this.

2. Modify io.c and io.h to implement 4 functions:

a. void setcursor(int x, int y) must set the current cursor position using the global variables cursorCol and cursorRow. There will not be any visual indication that anything has changed but printf and putchar should now use cursorCol and cursorRow to print at this location on the display. If int x exceeds the screen’s width, continue to the next row, if int y exceeds the screen’s height, continue from the top of the screen. This can be easily accomplished using the % operator. The cursor position variables cursorCol and cursorRow should always be in the range of (0 to 79) and (0 to 24), respectively.

i. int x - the column (horizontal) position on the display to set the cursor

ii. int y - the row (vertical) position on the display to set the cursor to

iii. returns nothing

b. char putchar(char character) must print the character to the display wherever specified by int x and int y is pointing at using color TEXT_COLOR provided in io.h. If a newline character (‘\n’) is passed as an input, the cursor should move to the next row, column 0.

i. char character - the character to be printed to the display

ii. returns the character printed

c. int printf(char string[]) must print the string to the display wherever the current cursor is pointing at. After printing the string the cursor must be set to the end of the string.

i. char string[] - the string to be printed to the display

ii. returns the number of characters printed to the display

d. void clearscreen() must remove all text from the screen and reset cursor position to 0, 0. This can be accomplished by overwriting all video memory locations with a space ‘ ‘ character.

e. Hint: You can reuse your functions inside of your other functions. For example, instead of writing putchar() and printf() separately, simply let printf() call putchar() multiple times to print the string. Also inside of putchar() you can increment the cursor position with setcursor().

f. Hint: When writing your own OS, you do not have access to any standard libraries (i.e. stdio.h for printf()). For this reason, we must write printf() from scratch. Do not waste time trying to use standard C libraries. Trying to use them will leave you frustrated because they will not work. If you need something for your code, you probably have to write it from scratch.

3. Modify kernel.c to accomplish the following (using your functions written in io.c):

a. Clear the screen of all characters.

b. Print “Hello World!” to the display.

If your OS implements what is described above you will see this result:

How to Submit

Submit your full source code (all .asm, .h, .c, and make files) and OS image (i.e. os.img) as a single zip file (.zip) to the Pilot dropbox before the due date. You can do this by zipping your entire OS folder. Submissions that are not zipped or that are missing source code or OS image will not be accepted.


Grading

This lab is worth 6.00 points, distributed as follows:

Task Points

OS compiles without errors (warnings are ok) 0.50

OS boots without errors (warnings are ok) 0.50

Blinking cursor mode is disabled 0.50

setcursor() is implemented 0.50

putchar() is implemented 1.00

printf() is implemented 1.00

clearscreen() is implemented 1.00

Kernel clears the screen and displays “Hello World!” 1.00

Total 6.00


We will happy to assist You:

Please call at : +91-995 3141 035

OR Leave a WhatsApp message at : +91-995 3141 035 (For quick response)


Solution Includes: AI writing Detection and Plagiarism report with 100% Accuracy.



CEG 4350/5350 – Operating Systems Internals and Design Solution


15 views0 comments

Recent Posts

See All

Comments


INDIA : +91-995-314-1035                                             

USA: +1-628-888-9041

                 Rights Reserved - VARCHAS IT SYSTEMS PVT.LTD 

                  Terms of Service  |   Privacy Policy

  • Facebook
  • Twitter
  • YouTube
bottom of page