Skip to content

lincketheo/unnamed-os

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

0. Usage

0.0. Setup

0.0.0. Cross compiler

You need a cross compiler installed on your system, specifically for the i686 system (other CC's might work, I think i386 does, see Virtualization for my intended setup and architecture description to figure out if your desired CC works). Currently, it is not in my roadmap (yet) to support lots of architectures.

I followed these instructions to install my cross compiler in ~/opt/cross. If you already have a cross compiler, just change CROSS_COMPILER_ROOT in the Makefile to your root and associated commands.

0.0.1. Virtualization

This all should work fine on i386 target if you happen to compile gcc for i386 target instead of i686.

I'm not sure when i686 instructions are going to break i386 cpus (both are 32 bit cpus). I tried this a few times and everything worked. Someday I would like to know (TODO)

My setup, overall, is:

  • 64 bit CPU
  • 32 bit OS (compiled using i686 cross compiler)
  • 32 bit applications will be able to be run

Note

  • You wouldn't be able to write a 64 bit application using my OS unless you switched to 64 bit mode in the OS. I'll do that one day, but for now I'm keeping things simple and using 32 bit.

0.0.2. Dependencies

Qemu:

$ sudo apt-get install qemu-system

NASM:

$ sudo apt install nasm

A bunch of other stuff, like build essentials, make etc. I'll list them some day, but if you have qemu and make installed, you can probably figure out what you don't have installed just by running the below commands in Building and running

0.1. Building and running

I've been running this on a virtualized x86_64 processor. (see my note in Terminology about backwards compatability between x86_64 and x86, e.g. i686)

Pretty simple:

$ make clean
$ make
$ qemu-system-x86_64 build/os.bin 

1. Terminology

1.0. CPU architecture jargon words

Here's a nice summary of intel cpu architecture (chapter 2.1). Although, often in the intel software development manuals you can't just search for jargon terms, so the list below is a bit of a cross reference for each jargon-y word and a word you can search for in the intel manual:

Here's another nice explanation of i related jargon

TLDR, intel's names make no sense :). Frequently, these words are just missused / loaded and it's just best to understand the history.

  • x86: (2.1.1) Refers to a processors in the 8086 family. (80186 80286 80386 80486...). Usually, it means compatability with the 80386 32 bit instruction set because 16 bit only is so old (TODO - this isn't perfectly accurate)
  • i686: (2.1.6) Intel686. P6 Family Microarchitecture on the Pentium Pro. One of the 6th generation of x86 processor.
  • i386: (2.1.3) Intel386. AKA 80386. First 32 bit (TODO - fact check)
  • x86_64 The 64-bit instruction set (sometimes called amd64) brother of x86
    • backwards compatible to x86 (ie x86 instructions can run on x86_64 processors)

32 bit and 64 bit:

- A 32-bit OS will run on a 32-bit or 64-bit processor without any problem.

- A 32-bit application will run on a 32-bit or 64-bit OS without any problem.

- But a 64-bit application will only run on a 64-bit OS and a 64-bit OS will only run on a 64-bit processor

1.1. The mega mebi tera tebi... confusion

Clearing things up because I haven't seen it stated in the official Intel manuals

  • An official mega byte (MB) is 1000^2 bytes.
  • An official mebi byte (MiB) is 1024^2 bytes

Intel says MB in their reference manuals because MiB wasn't introduced until later and they didn't want to change all their manuals / references. For all intents and purposes, in the intel manuals, MB means 1024^2, which conforms with intuition (e.g. 4 GBytes is 4x2^30 bytes, or 2^2x2^30=2^32 bytes, which fits on a 32 bit number).

2. References I've been using

3. TODO

  • (Search for TODO's in code base for minor improvements)
  • Set paging bit in cr0 and re work bootloader to implement paging
  • Study what comes after the bootloader.
  • VGA driver and standard print library support
    • printing to the screen
    • setting the screen graphics
    • robust-ness

About

I haven't thought of a name yet. TBD

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published