Jacqueline – 一个用 Pascal 编写的精简的 i386 内核
Jacqueline – A minimal i386 kernel written in Pascal (2019)

原始链接: https://github.com/danirod/jacqueline

Jacqueline是一个用Free Pascal为i386架构创建的业余启动加载程序,纯粹是为了个人挑战而构建。作者无意在成功创建一个可在模拟器中启动的镜像之外积极开发它。 尽管Pascal传统上不用于低级系统编程,但Free Pascal提供了使其成为可能的功能——包括指针、内存地址访问和内联汇编——与C、C++和Rust等语言相匹敌。Free Pascal编译为标准目标文件(PE/ELF),允许与用其他语言编写的代码互操作。 该项目需要一个i386-elf工具链、一个32位Free Pascal发行版(ppc386)和一个构建系统(如Make),最终利用QEMU来测试内核。它展示了Free Pascal在裸机开发方面的惊人能力。

## Jacqueline:一个基于Pascal的i386内核 一个名为Jacqueline的极简i386内核,用Pascal编写,最近在Hacker News上重新出现。该项目由danirod于2019年创建,旨在展示直接启动PC进入非C/Rust环境。作者解释说,这是一个原型,用于证明概念——需要控制符号导出和链接——并在显示“Hello World”后即被认为完成。 这次讨论引发了其他用户对类似操作系统项目的回忆,包括用Pascal编写的引导加载程序和早期操作系统,突出了Pascal在操作系统开发中的历史用途(如早期的Mac OS和Unix系统)。一些评论员辩论了Pascal相对于C的优点,引用了Brian Kernighan在1981年的批评以及Modula-2和Turbo Pascal等后期方言提供的改进。 最终,Jacqueline作为一个低级编程的有趣实验,并提醒人们操作系统开发并不局限于C或Rust。i386架构也被赞扬为爱好操作系统项目的良好平台。
相关文章

原文

Jacqueline is an experimental bootloader written in Pascal (Free Pascal dialect) written for the i386 architecture, just because. Note that, unlike NativeOS, I have no plans to further develop Jacqueline once the system compiles and I'm able to start the image using an emulator.

Even while Pascal wasn't written with low-level programming in mind, it is nonetheless possible to do low-level systems programming with the Free Pascal dialect, as it supports features that are present in other low-level languages such as C, C++ or even Rust in unsafe mode, such as:

  • Pointers, using the ^ operator (such as var intptr: ^integer).
  • Memory addresses, using the @ operator (let var foo: integer, then @foo yields the memory address of foo as an ^integer.
  • Inline assembly interfacing, through the asm keyword, à la C. In fact, I find more intuitive to move data between registers and variables in Free Pascal than in GNU C.

Free Pascal is able to generate standard object files (*.o), encoded in popular executable file formats such as PE and ELF, and thus, it is possible to make object files written originally in diverse languages such as C, Pascal or Assembly to interface each other.

  • An i386-elf toolchain (required for compiling the Assembly code and linking the final kernel image).
  • A Free Pascal distribution with 32 bit support (i.e., ppc386 is provided).
  • BSD make or GNU make.
  • QEMU to run the kernel.

make qemu

联系我们 contact @ memedata.com