I want to compile a C program so simple I can explain all of the assembly
11–20 of 39 posts
Re: I want to compile a C program so simple I can explain all of the assembly
#12This tutorial walks you through making a kernel image that GRUB can load, and shows how to poke bytes into video memory to print characters to the screen:
Re: I want to compile a C program so simple I can explain all of the assembly
#13If you really want to write code that you can understand all the way down I suggest starting from as close to bare metal as your level of masochism allows. For me, that's GRUB. This tutorial walks you through making a kernel image that GRUB can load, and shows how to poke bytes into video memory to print characters to the screen: http://wiki.osdev.org/Bare_bones
Re: I want to compile a C program so simple I can explain all of the assembly
#14The executable was 736 bytes: http://rythie.com/labs/cpuid.php
Re: I want to compile a C program so simple I can explain all of the assembly
#15That was a really cool article, anyone with more knowledge on the subject want to comment on how sound the author's thought process is? Thanks.
The article is quite sound and doing all this is standard practice in the embedded world where you can't afford the size of glibc. The article is a bit incomplete, but presumably he'll address the rest in his next installment. As a preview, to provide the correct C ABI to main() you need to zero the BSS (this is how your static variables get initialized), maybe copy the initalized data, call the constructors and dest…
by Jessica McKellar
Re: I want to compile a C program so simple I can explain all of the assembly
#16Earlier quoted context omitted.
The article is quite sound and doing all this is standard practice in the embedded world where you can't afford the size of glibc. The article is a bit incomplete, but presumably he'll address the rest in his next installment. As a preview, to provide the correct C ABI to main() you need to zero the BSS (this is how your static variables get initialized), maybe copy the initalized data, call the constructors and dest…
> presumably he'll address the rest in his by Jessica McKellar
Re: I want to compile a C program so simple I can explain all of the assembly
#17As long as those abstractions don't leak, it isn't a big deal, but when they do you had better know what's going on down below.
Re: I want to compile a C program so simple I can explain all of the assembly
#18Re: I want to compile a C program so simple I can explain all of the assembly
#19There was an example I read recently of doing this in Windows that I liked more -- perhaps because the setup and tear-down was more interesting.
Re: I want to compile a C program so simple I can explain all of the assembly
#20If you really want to write code that you can understand all the way down I suggest starting from as close to bare metal as your level of masochism allows. For me, that's GRUB. This tutorial walks you through making a kernel image that GRUB can load, and shows how to poke bytes into video memory to print characters to the screen: http://wiki.osdev.org/Bare_bones
And then buy an FPGA and bust out some Verilog and write the metal yourself.
While a little masochistic I find I still call upon what I learned back then while writing in C and to a lesser extent higher level languages.