Top Banner
MATRIX
39

MATRIX. Goal To implement a basic structure of a kernel (generic) incorporating Essential features.

Mar 26, 2015

Download

Documents

Caleb Hicks
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: MATRIX. Goal To implement a basic structure of a kernel (generic) incorporating Essential features.

MATRIX

MATRIX

Page 2: MATRIX. Goal To implement a basic structure of a kernel (generic) incorporating Essential features.

MATRIX

Goal

To implement a basic structure of a kernel (generic) incorporating

Essential features.

Page 3: MATRIX. Goal To implement a basic structure of a kernel (generic) incorporating Essential features.

MATRIX

• Real Mode• 16 bit • x86

• I/O• File Handling• File system

– Fat 12 – Fat 32

MATRIX Features

•Security- protect bin files- encryption- priority level

•Booting

•Memory

•Program Execution

Page 4: MATRIX. Goal To implement a basic structure of a kernel (generic) incorporating Essential features.

MATRIX

• Networking -- message transfer- file transfer- ping- listen

• IO control– Key Board– Monitor– Floppy– Hard disk– Port

• Error handling• Shell

- CLI- Multi page- Multi user Environment

• support for GUI

• multithreading

Page 5: MATRIX. Goal To implement a basic structure of a kernel (generic) incorporating Essential features.

MATRIX

Methodology

1) From Scratch

2) Oops

3) Turbo C++

4) Nasm

Page 6: MATRIX. Goal To implement a basic structure of a kernel (generic) incorporating Essential features.

MATRIX

Boot Process

• Supply On• Bios code at FFF0h is loaded• POST• Video Card detect • Device detect • Startup Screen• System Inventory• Boot sequence BIOS setting• Master Boot Record• Load Boot Loader at 7C00h

Page 7: MATRIX. Goal To implement a basic structure of a kernel (generic) incorporating Essential features.

MATRIX

Registers

Segment Registers

CS Code, DS Data ,SS Stack, ES Extra Segment.

Pointer Registers

IP,SP,BP

General-Purpose Registers

AX Accumulator BX Base

CX Count DX Data

Index Registers

SI

DI

Page 8: MATRIX. Goal To implement a basic structure of a kernel (generic) incorporating Essential features.

MATRIX

Memory Map

• Interrupt Vector Table 00000 • BIOS Data Area 00400• PrtScr Status / Unused 00500 • Image Load Address 00600• Global Data Area 02000• Application Space 06000• Boot Loader 07C00• Available Memory nnnn • 2KB Boot Stack A0000 - 512 - 2KB

• Boot Sector A0000 – 512• Boot Loader A0000

Page 9: MATRIX. Goal To implement a basic structure of a kernel (generic) incorporating Essential features.

MATRIX

Boot Loader

• Loaded at 7c00h

• Control passed by bios

• Basic Stack Allocation

• Load OS at 50h

• Control Transfer

• Support for both bin, com and exe format

Page 10: MATRIX. Goal To implement a basic structure of a kernel (generic) incorporating Essential features.

MATRIX

Application Loading

Aim

To load an executable(binary)

I

Procedure

Save CS ,IP and Registers

si di for tcc

II

Call loader

parm CS, IP

Page 11: MATRIX. Goal To implement a basic structure of a kernel (generic) incorporating Essential features.

MATRIX

III

Search the file

Copy to memory (pre defined memory loc) MM

IV

Pass control to MM

V

Restore CS IP //int

IP = addr(exit funtion cret())

Cret() performs restoring of

Registers ,si and di

Page 12: MATRIX. Goal To implement a basic structure of a kernel (generic) incorporating Essential features.

MATRIX

Loader

Define the Load segment -600h

Save CS & IP -200h

Copy file to Load segment

Check the file Signature

if COM or binary

-

if Exe

-perform relocation

-load sp, ss, cs, ip

Restore Registers and return

Page 13: MATRIX. Goal To implement a basic structure of a kernel (generic) incorporating Essential features.

MATRIX

User Authentication

Shell

- Get user command - Interpret - Process - Error Handling - Multi page Support

Flow Of Control

Page 14: MATRIX. Goal To implement a basic structure of a kernel (generic) incorporating Essential features.

MATRIX

IO Control

• Support for IO primitives

• Support for Higher level IO features

• CMOS

• History

Page 15: MATRIX. Goal To implement a basic structure of a kernel (generic) incorporating Essential features.

MATRIX

Bios Routines For IO Control

Interrupt

10H

16H

15H

19H

1AH

Functions

Video Support Routines

Keyboard Support Routines

Delay Support Routines

Reboot Functions

CMOS Support Routines

Page 16: MATRIX. Goal To implement a basic structure of a kernel (generic) incorporating Essential features.

MATRIX

Memory Map

• Interrupt Vector Table 00000 • BIOS Data Area 00400• PrtScr Status / Unused 00500 • Image Load Address 00600• Global Data Area 02000• Application Space 06000• Boot Loader 07C00• Available Memory nnnn • 2KB Boot Stack A0000 - 512 - 2KB

• Boot Sector A0000 – 512• Boot Loader A0000

Page 17: MATRIX. Goal To implement a basic structure of a kernel (generic) incorporating Essential features.

MATRIX

Boot Sector + Reserved Regions

FAT (store usage of clusters)

Root Directory

User data area (addressable by cluster)

Disk Space

Clusters

FAT 12

Page 18: MATRIX. Goal To implement a basic structure of a kernel (generic) incorporating Essential features.

MATRIX

Boot Sector

Page 19: MATRIX. Goal To implement a basic structure of a kernel (generic) incorporating Essential features.

MATRIX

File Allocation Table

Structure of the Directory Entries

Page 20: MATRIX. Goal To implement a basic structure of a kernel (generic) incorporating Essential features.

MATRIX

FAT32 File system

Structure of hard disk

Side (Head)Cylinder (Track/Side)TrackSectors/TrackCluster1 Sector = 512 BytesCapacity = Cylinder x Side x Sector x 512 Bytes

Sectors = 64

Head = 256

Tracks = 1024

Capacity = 8GB

Page 21: MATRIX. Goal To implement a basic structure of a kernel (generic) incorporating Essential features.

MATRIX

Primary and Extended partitions

MBR

Partition TableExtended

Partition Table

Primary Partitions

Extended Partitions

Logical drives

Page 22: MATRIX. Goal To implement a basic structure of a kernel (generic) incorporating Essential features.

MATRIX

MBR

Partition Entry (Part of MBR)

Page 23: MATRIX. Goal To implement a basic structure of a kernel (generic) incorporating Essential features.

MATRIX

Features supported

• Similar features which is supported by fat12

• Support for multi-partition

• Multi-hard disk support

• Developed in OOP Technology

Page 24: MATRIX. Goal To implement a basic structure of a kernel (generic) incorporating Essential features.

MATRIX

Serial Communication

• Uses RS232 com ports for communication

• Transfer of messages

• Ping

Page 25: MATRIX. Goal To implement a basic structure of a kernel (generic) incorporating Essential features.

MATRIX

RS232 Connections

Page 26: MATRIX. Goal To implement a basic structure of a kernel (generic) incorporating Essential features.

MATRIX

Null Modems

• A Null Modem is used to connect two DTE's together • It mainly only requires 3 wires (TD, RD & SG) to be

wired straight through. The aim is to make to computer think it is talking to a modem rather than another computer. Any data transmitted from the first computer must be received by the second thus TD is connected to RD. The second computer must have the same set-up thus RD is connected to TD. Signal Ground (SG) must also be connected so both grounds are common to each computer.

• The connection of other wires depends on whether handshake is needed or not.

Page 27: MATRIX. Goal To implement a basic structure of a kernel (generic) incorporating Essential features.

MATRIX

Connect RX1 to TX2 and vice versa, GND1 to GND2. In addition to this, connect RTS to CTS & DCD and connect DTR to DSR at each end

Name Pin Full name Remark---------------------------------------------------------------------------------------------------------- TxD 3 Transmit Data Data RxD 2 Receive Data Data RTS 7 Request To Send Handshaking CTS 8 Clear To Send Handshaking DTR 4 Data Terminal Ready Status DSR 6 Data Set Ready Status RI 9 Ring Indicator Status DCD 1 Data Carrier Detect Status GND 5 Signal ground Reference level

Page 28: MATRIX. Goal To implement a basic structure of a kernel (generic) incorporating Essential features.

MATRIX

1st 2nd 3rd 4th Offs. Register--------------------------------------------------------------------------------------------------------------------3F8h 2F8h 3E8h 2E8h +0 RBR Receive Buffer Register (read only) or THR Transmitter Holding Register (write only)3F9h 2F9h 3E9h 2E9h +1 IER Interrupt Enable Register3F8h 2F8h 3E8h 2E8h +0 DL Divisor Latch (LSB) 3F9h 2F9h 3E9h 2E9h +1 DL Divisor Latch (MSB) These registers can be accessed as word3FAh 2FAh 3EAh 2EAh +2 IIR Interrupt Identification Register 3FBh 2FBh 3EBh 2EBh +3 LCR Line Control Register3FCh 2FCh 3ECh 2ECh +4 MCR Modem Control Register3FDh 2FDh 3EDh 2EDh +5 LSR Line Status Register3FEh 2FEh 3EEh 2EEh +6 MSR Modem Status Register

Controls And Status Registers

Page 29: MATRIX. Goal To implement a basic structure of a kernel (generic) incorporating Essential features.

MATRIX

Initialize - Set baud rate in DL - Set word length and parity in LCR

Transmit - Set DTR and RTS bit in MCR to request for permission to send - Check 6th bit in LSR to check whether THRE is empty or not - If empty then send the character to THR

Receive - Check status of RTS and DTR to find for any requests - Check for any input data - Stops all incoming data - Get received data from THR

Page 30: MATRIX. Goal To implement a basic structure of a kernel (generic) incorporating Essential features.

MATRIX

Applications

• Send messages from one computer to another computer

• Check for connection with another computer (ping) using sid

Page 31: MATRIX. Goal To implement a basic structure of a kernel (generic) incorporating Essential features.

MATRIX

Security

• Encryption• Priority Levels• Protection

Page 32: MATRIX. Goal To implement a basic structure of a kernel (generic) incorporating Essential features.

MATRIX

,

Encryption

• Combination of 2 classical encryption techniques are used– Transposition– Substitution

• In transposition technique the ordering of characters in the text is changed without changing the character.

• In substitution technique the character is changed without changing there relative order in the text

• In our encryption algorithm the relative ordering as well as the characters are changed

• The process starts by first arranging the text into blocks and then within each block the order of the letters is changed according to the alphabetic order of the key.

• Then polyalphabetic substitution is done by adding to each character a specific number given by the pseudorandom series.

• By following the above said procedure encryption of user name and passwords are done.

• Encrypted user name and password are stored in a fixed place in the hard disk.• No user is given direct access to this place.

Page 33: MATRIX. Goal To implement a basic structure of a kernel (generic) incorporating Essential features.

MATRIX

Priority levels- We use two priority levels one for the root and another for the user.- By these priority levels different protection schemes can be introduced.

Protection- A user is not allowed to add or remove any new users This permission is only given to the root.- Protection of system files are done by not allowing any user to view, add, modify or delete these files.

Page 34: MATRIX. Goal To implement a basic structure of a kernel (generic) incorporating Essential features.

MATRIX

Multithreading

Class

*process-param(no:,function specific values)

-status(active,exit)

-next

-identification

-function

Eg: function()-Display Random Number Generator

Page 35: MATRIX. Goal To implement a basic structure of a kernel (generic) incorporating Essential features.

MATRIX

Class

*process_scheduler

-no_process,

-deact

-cur_proc_no,

-halt,

-*cur_process;

struct {

int process_quantom,process_counter;

bool act;

}process_table[X];

Page 36: MATRIX. Goal To implement a basic structure of a kernel (generic) incorporating Essential features.

MATRIX

void quantom_checker(PROC *proc)

PROC *next_process(PROC *proc)

Function-Thread()

Set no. of porcesses

Create linked-list

Call quantom_checker()

Page 37: MATRIX. Goal To implement a basic structure of a kernel (generic) incorporating Essential features.

MATRIX

Mode and Enhancements

Real And Protected Modes

Features:32 bit,4 GB

Benifits

-Multitasking,Virtual Memory

-security:process and memory

Page 38: MATRIX. Goal To implement a basic structure of a kernel (generic) incorporating Essential features.

MATRIX

Conclusion

• The source code is available as OPEN SOURCE - CODE so that OS develepers can modify/upgrade and enhance the project in the future

• Future Enhancements that can be done:

-Networking

-File systems

-Optimisation

-Device Drivers

• Network Booting in devolopment phases

Page 39: MATRIX. Goal To implement a basic structure of a kernel (generic) incorporating Essential features.

MATRIX