Skip to content

carabina/swift-project1

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

project1 - Using Swift for lowlevel kernel programming

What is it?

A test to see how easy it is to write lowlevel code in Swift. There is short writeup about it here.

What does it do?

  • Boots up (Under QEMU, Bochs or VMWare)
  • Scans ACPI/SMBIOS tables
  • Installs interrupts and exception/fault handlers
  • Sets up paging
  • Scans PCI bus
  • Initialises timer and keyboard

How to build it

Curently it only builds on linux. It requires:

  • clang
  • xorriso
  • mtools
  • nasm (known to work with 2.11.09rc1 but earlier should be ok)

Swift 3.0 is also required along with a special version to disable the red zone. See here to build a swift compiler and stdlib with red-zone disabled.

If you install the swift compiler into a different directory to ~/usr then edit SWIFTDIR in Makedefs

then:

$ make kernel iso
$ qemu-system-x86_64 -hda disk_image

There is a bochsrc to specify the HD image so it can be run with:
$ bochs -q  (then press 'c' to run)

Screenshot

Copyright (c) 2015 Simon Evans

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

Technical exercise to evaluate Swift as a systems programming language

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 55.2%
  • Swift 30.5%
  • Assembly 11.5%
  • Makefile 1.9%
  • C++ 0.9%