TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Asmttpd – Web server for Linux written in amd64 assembly

159 pointsby pykelloalmost 10 years ago

15 comments

ndesaulniersalmost 10 years ago
I&#x27;ll try and get this building for OSX.<p>For the uninitiated, might I recommend my: <a href="http:&#x2F;&#x2F;nickdesaulniers.github.io&#x2F;blog&#x2F;2014&#x2F;04&#x2F;18&#x2F;lets-write-some-x86-64&#x2F;" rel="nofollow">http:&#x2F;&#x2F;nickdesaulniers.github.io&#x2F;blog&#x2F;2014&#x2F;04&#x2F;18&#x2F;lets-write-...</a><p>Though, this is written in yasm syntax, which is slightly different.<p>Also, keep an eye out for a blog post on Interpreters, Compilers, and JITs I&#x27;m working on (cleaning it up and getting it peer reviewed this or next week)!<p><i></i>update 1<i></i> Actually, would the syscall&#x27;s be different between Linux and OSX? Let&#x27;s find out, once this builds! <i>hammers away</i><p><i></i>update 2<i></i> Got it building and linking. bus error when run, debugging with gdb.<p><i></i>update3<i></i> Can&#x27;t generate dwarf2 debug symbols for OSX? $ yasm -g dwarf2<p><i></i>update 4<i></i> Careful, this tries to listen on port 80 [0] (0x5000 (LE) == 5*16^1 == 80), I would never run any assembly program off the web with elevated privileges. I recommend 0xB8B0 (LE, port 3000).<p>update 5<p>&gt; Actually, would the syscall&#x27;s be different between Linux and OSX?<p>Looks like yes: <a href="http:&#x2F;&#x2F;unix.stackexchange.com&#x2F;a&#x2F;3350" rel="nofollow">http:&#x2F;&#x2F;unix.stackexchange.com&#x2F;a&#x2F;3350</a> These might be close to shim out (OSX and Linux at least share a calling convention, unlink Windows). I&#x27;ll upstream what I have.<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;nemasu&#x2F;asmttpd&#x2F;blob&#x2F;master&#x2F;main.asm#L24" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;nemasu&#x2F;asmttpd&#x2F;blob&#x2F;master&#x2F;main.asm#L24</a>
评论 #9574932 未加载
pavlovalmost 10 years ago
It&#x27;s been closer to 20 years since I last read a complete program in x86 assembly, so this is quite fun to look at.<p>I&#x27;m somehow disappointed (quite unreasonably, of course) that the code uses plain old zero-terminated C strings instead of something more exotic. One of the fun things about assembly is that you get to reinvent basic language features on the fly -- calling conventions, data layout, strings, everything.
评论 #9572220 未加载
评论 #9572310 未加载
评论 #9573073 未加载
kragenalmost 10 years ago
I wrote httpdito, a web server for Linux in 386 assembly, a couple of years ago (mostly outdated discussion is at <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=6908064;" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=6908064;</a> a README is at <a href="http:&#x2F;&#x2F;canonical.org&#x2F;~kragen&#x2F;sw&#x2F;dev3&#x2F;httpdito-readme" rel="nofollow">http:&#x2F;&#x2F;canonical.org&#x2F;~kragen&#x2F;sw&#x2F;dev3&#x2F;httpdito-readme</a>) and I was happy to get the executable under 2000 bytes. I actually used it the other day to test a SPA, although for some things its built-in set of MIME-types leaves something to be desired.<p>But it doesn&#x27;t have default documents, different kinds of error responses, TCP_CORK, sendfile() usage, content-range handling, or even request logging. So asmttpd is <i>way</i> more full-featured than httpdito, and it&#x27;s still under 6K.<p>(...httpdito possibly doesn&#x27;t have any bugs, either, though ☺)
yellowapplealmost 10 years ago
Relevant: <a href="http:&#x2F;&#x2F;i.imgur.com&#x2F;INBvStO.png" rel="nofollow">http:&#x2F;&#x2F;i.imgur.com&#x2F;INBvStO.png</a>
baroslalmost 10 years ago
Days ago I saw a lightweight httpd written in C here, yesterday a C++ header-only httpd library caught my mind, and now an httpd in assembly. I&#x27;m curious what would come next...
评论 #9573775 未加载
评论 #9574234 未加载
评论 #9573781 未加载
wycalmost 10 years ago
Shameless plug for a companion IRC bot in ARM assembly: <a href="https:&#x2F;&#x2F;github.com&#x2F;wyc&#x2F;armbot" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;wyc&#x2F;armbot</a>
voidiacalmost 10 years ago
The name is confusing, the first thing i thought of was an SMTP-server.
e12ealmost 10 years ago
A little strange to see: &quot;Sendfile can hang if GET is cancelled.&quot; in the readme and no corresponding issue. Not even one closed as &quot;wontfix&quot;. Sounds like DOS?
marioptalmost 10 years ago
Why would someone write a web server in assembly? just for fun?
评论 #9573208 未加载
评论 #9573606 未加载
评论 #9573590 未加载
lelfalmost 10 years ago
Maybe it&#x27;s just me, but I honestly don&#x27;t know what this is doing near the HN top. It&#x27;s more or less literal translation from C.
评论 #9572306 未加载
评论 #9573383 未加载
polarbaeralmost 10 years ago
No dependencies at all, runs on Docker &#x27;FROM scratch&#x27;, Nice! - <a href="https:&#x2F;&#x2F;registry.hub.docker.com&#x2F;u&#x2F;0xff&#x2F;asmttpd&#x2F;" rel="nofollow">https:&#x2F;&#x2F;registry.hub.docker.com&#x2F;u&#x2F;0xff&#x2F;asmttpd&#x2F;</a>
kryptisktalmost 10 years ago
I propose that a web framework be called Assembly on Ambulator.
评论 #9572647 未加载
markus2012almost 10 years ago
benchmarks?<p>:-)
评论 #9574886 未加载
评论 #9573665 未加载
sagargvalmost 10 years ago
What&#x27;s the performance like?
SteveBertaalmost 10 years ago
Amazing!