• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

tathougies/hos: The functional Haskell kernel

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

tathougies/hos

开源软件地址(OpenSource Url):

https://github.com/tathougies/hos

开源编程语言(OpenSource Language):

C 61.0%

开源软件介绍(OpenSource Introduction):

Hos: A Haskell operating system

The kernel is written in mainly JHC Haskell, with fallbacks to C where necessary (biggest one being the garbage collector and rts). JHC was chosen because it produces ANSI C code which is easy to compile with a cross-compiler.

There are some bugs with monad transformers in JHC which make the compiler crash. You may see a funny idiom where we bind monadic calls to variables x1, x2, etc. and then seq them together before returning. This prevents an over-eager optimization from running which messes up the compile. At some point, I will spend time to patch JHC, but until then, the code compiles and seems to run.

Dependencies

  • Latest version of the JHC compiler.
  • GNU Xorriso (tested on 1.3.8)
  • GNU compatible make
  • A clang cross-compiler
  • GNU binutils (needed to run ld linker scripts)

Build System

The regular JHC make system is useless to us, because it wasn't designed to compile operating systems (duh!). Instead, we use the JHC -C flag to create ANSI C sources from the kernel and user-space haskell sources. We then compile these sources using a clang cross-compiler, and finally link them together to produce the output.

If you have everything necessary to build, modify build.opts to make sure everything points to the right locations, and type make at the top-level. Get a cup of tea, because JHC takes its time.

Run it

The easiest way to run Hos for testing is to use the supplied ISO. Hos has been tested only on VirtualBox. Currently, it only produces output via the serial port, which isn't very exciting, but it is what it is. If someone would like to write a text or graphics subsystem, we're looking for volunteers!

Steps to set it up with VirtualBox:

  1. Open VirtualBox, and hit 'New'
  2. Name the virtual machine, choose 'Other' as the type, and choose 'Other/Unknown (64-bit)' as the version.
  3. Give it at least 256 MB to play with.
  4. Create a new hard drive in any format, and make it 2GB in size. WE currently don't use it but our ATA driver presumes the existence of one
  5. Hit settings to set the serial port information.
  6. Open the 'ports' pane and select 'Enable serial port' for COM1. The IRQ should be 4 and the port should be 0x3f8
  7. Change 'Port Mode' to 'Raw file' and set 'Port/File Path' to a suitable output file location (you'll have to type it in).
  8. Hit run. Since your VM has no hard drive, VirtualBox should prompt you to choose an ISO
  9. Hit the browse button and choose the hos.iso from github
  10. Open your terminal and run 'tail -f name-of-serial-port-output'
  11. Hit enter in the virtual box window, if all goes well you should see text streaming out of the file. If all goes well it should end with a message that the kernel has completed.

Voilà, you've run a Haskell kernel!




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap