TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

TempleOS Reverse Engineering

63 点作者 elvis7011 个月前

8 条评论

RIMR11 个月前
This is fun, but TempleOS is fully open sourced, and even has actively maintained forks.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;Zeal-Operating-System&#x2F;ZealOS">https:&#x2F;&#x2F;github.com&#x2F;Zeal-Operating-System&#x2F;ZealOS</a><p><a href="https:&#x2F;&#x2F;github.com&#x2F;tinkeros&#x2F;TinkerOS">https:&#x2F;&#x2F;github.com&#x2F;tinkeros&#x2F;TinkerOS</a>
open59211 个月前
This says that Terry didn&#x27;t release the source code for the kernel or the bootloader. I&#x27;m not sure if I&#x27;m reading that correctly, since the entirety of TempleOS was built within TempleOS:<p>- Kernel: <a href="https:&#x2F;&#x2F;github.com&#x2F;cia-foundation&#x2F;TempleOS&#x2F;tree&#x2F;archive&#x2F;Kernel">https:&#x2F;&#x2F;github.com&#x2F;cia-foundation&#x2F;TempleOS&#x2F;tree&#x2F;archive&#x2F;Kern...</a><p>- Bootloader: <a href="https:&#x2F;&#x2F;github.com&#x2F;cia-foundation&#x2F;TempleOS&#x2F;tree&#x2F;archive&#x2F;Adam&#x2F;Opt&#x2F;Boot">https:&#x2F;&#x2F;github.com&#x2F;cia-foundation&#x2F;TempleOS&#x2F;tree&#x2F;archive&#x2F;Adam...</a><p>- Bootloader documentation: <a href="https:&#x2F;&#x2F;github.com&#x2F;cia-foundation&#x2F;TempleOS&#x2F;blob&#x2F;archive&#x2F;Doc&#x2F;Boot.DD">https:&#x2F;&#x2F;github.com&#x2F;cia-foundation&#x2F;TempleOS&#x2F;blob&#x2F;archive&#x2F;Doc&#x2F;...</a>
评论 #40682644 未加载
rep_lodsb11 个月前
The boot sector moves <i>itself</i> to segment 96C0h:<p><pre><code> 0000:7c69 e8 00 00 CALL LAB_0000_7c6c </code></pre> pushes the address of the following instruction (7C6C) on the stack.<p><pre><code> 0000:7c6c 5b POP BX=&gt;DAT_9000_6ffe 0000:7c6d 83 eb 6c SUB BX,0x6c </code></pre> BX is now 7C00, the beginning of the boot sector. This is a common trick to get the address of your own code when you don&#x27;t know where it was loaded in memory. No idea why he did this though, since the PC BIOS boot process always uses the same address.<p><pre><code> 0000:7c70 c1 eb 04 SHR BX,0x4 0000:7c73 66 8c c8 MOV AX,CS 0000:7c76 03 c3 ADD AX,BX 0000:7c78 66 8e d8 MOV DS,AX </code></pre> DS:0000 now points to the boot sector. Note that this would fail if it were loaded at some address that isn&#x27;t a multiple of 16, but of course this is never the case.<p><pre><code> 0000:7c7b b9 00 02 MOV CX,0x200 0000:7c7e 33 f6 XOR SI,SI 0000:7c80 33 ff XOR DI,DI 0000:7c82 f3 a4 MOVSB.REP ES:DI,SI </code></pre> Copy the 512 byte boot sector to segment 96C0<p><pre><code> 0000:7c84 b8 c0 96 MOV AX,0x96c0 0000:7c87 66 8e d8 MOV DS,AX 0000:7c8a ea a2 00 c0 96 JMPF LAB_9000_6ca2 </code></pre> Jump to rest of code starting at offset 00A2.<p>The 0000Kernel.BIN.C file isn&#x27;t loaded yet at this point, and would likely end up at a different address. I haven&#x27;t looked at the rest of the code, but it seems to be not nearly enough there to parse any filesystem structures. It probably loads the second stage starting from a fixed sector number.<p>This may sound like blasphemy to some, but honestly, I&#x27;m not that impressed with the quality of this code. There are also superfluous 66h prefixes on the segment load instructions.<p>[edit:] the actual source code is available here: <a href="https:&#x2F;&#x2F;github.com&#x2F;cia-foundation&#x2F;TempleOS&#x2F;blob&#x2F;archive&#x2F;Adam&#x2F;Opt&#x2F;Boot&#x2F;BootHD.HC">https:&#x2F;&#x2F;github.com&#x2F;cia-foundation&#x2F;TempleOS&#x2F;blob&#x2F;archive&#x2F;Adam...</a>
mbonnet11 个月前
This is a good way to get the wrath of God rained down upon thee.
tombert11 个月前
It doesn&#x27;t quite apply but I think it kind of does: I consider TempleOS to be a form of &quot;outsider art&quot;.<p>Terry obviously was a trained engineer, but he still effectively taught himself a lot of the stuff to build a kernel and operating system and compiler and a few dozen games. He was also obviously extremely mentally ill, but that&#x27;s also kind of what makes TempleOS fascinating. It&#x27;s an extremely bizarre thing to play with, and it can be a surprisingly big time sink if you really decide to get into it, and I don&#x27;t think all the ideas in there are bad.<p>For the most part, it doesn&#x27;t feel like there are a ton of original operating systems anymore; most people seem happy enough to use a dialect Linux of FreeBSD if you need something specialized, or Windows and macOS for general purpose. I don&#x27;t blame these people, that&#x27;s certainly what I would do too, but I have to give credit to Terry for deciding to do his own thing from scratch in assembly code. He was sort of a relic of a bygone era in that regard.<p>I certainly don&#x27;t want to engage in any apologetics for Terry&#x27;s outright racism and conspiracy theories, that stuff is horrible and I have no nice things to say about it, but he will always be a figure that I&#x27;m a little fascinated by.
评论 #40682474 未加载
评论 #40683190 未加载
hit8run11 个月前
Only idiots keep order, a genius controls the chaos.
markus_zhang11 个月前
I hope Terry rest in peace. He had a tormented mind.
benignslime11 个月前
I look forward to more analysis. Watching this guy on youtube play with his mangled toy is always going to be a part of my outlook as an engineer. We really could sit down and build it all again from scratch, and yeah we might go crazy, but we learn so much in the process.