40 ms·
Why do you trust the assembler you got from somewhere any more than a compiler?
by drfuchs 4y ago
Why do you trust the assembler you got from somewhere any more than a compiler?
- randyrand 4y agoBecause hand written assembly is readable!
- chongli 4y agoI believe GP used assembler to refer to the program which reads your hand-written assembly and produces a binary. That program was presumably given to you so you need to trust it. No, the only way to solve this problem is to start with a computer entirely devoid of code and bit-bang your assembler into the machine with switches, the way the first users of the MITS Altair did it.
- ByteJockey 4y agoYou can also bootstrap the way lisp did and write the fist compiler in the language and get a bunch of grad students to hand-compile it. But, yeah if you don't have a bunch of grad students at the ready, an assembler hand-written in machine code is the only option if you want to trust the entire stack. Though I'm not sure what that would get you. I don't know of any higher language compilers that are written directly in assembly these days, so you'd never be able to compile your C/C++ compiler.
- chongli 4y agoThere was a C compiler written in assembly posted on HN 4 years ago [1]! So yeah, if you wanted to, you could bit-bang an assembler capable of assembling a simple C compiler, then in your simple subset of C you could implement a full C compiler, and from there you can do anything you want! The grad student approach also sounds interesting. A basic Lisp interpreter can easily fit on a single letter-sized sheet of paper. A single person could hand-compile that, it would just take longer. But, if you're living alone in a cabin in the woods with your own hand-built computer and a personal library of computer books in hard copy, that would be a totally feasible project. [1] https://news.ycombinator.com/item?id=17851311 https://news.ycombinator.com/item?id=17851311
- ByteJockey 4y agoI wasn't aware that there were any existing C compilers made in asm for modern architectures. I guess I shouldn't be too surprised. That's cool, thanks for showing me.
- pjmlp 4y agoIt might be, but have you also validated the microcode executing it? Or the Verilog/VHDL for the logic gates used by the CPU, for that matter?
- randyrand 4y agoSecurity is multifaceted. Ideally, yes. But you still will be more secure than having multiple security holes.