amd64-bf

所属分类:嵌入式/单片机/硬件编程
开发工具:C
文件大小:132KB
下载次数:0
上传日期:2015-09-27 14:58:14
上 传 者sh-1993
说明:  系统程序员头脑风暴
(Brainfuck for systems programmers)

文件列表:
LICENSE (11932, 2015-09-27)
Makefile (863, 2015-09-27)
bold.c (4881, 2015-09-27)
debian (0, 2015-09-27)
debian\changelog (135, 2015-09-27)
debian\compat (2, 2015-09-27)
debian\control (492, 2015-09-27)
debian\copyright (242, 2015-09-27)
debian\rules (85, 2015-09-27)
elf-bf.h (205, 2015-09-27)
hello.bf (535, 2015-09-27)
interp.c (4991, 2015-09-27)
kitty.jpg (121946, 2015-09-27)
start.S (709, 2015-09-27)

# amd***-bf: Brain*** for systems programmers This is an extension of brain*** to facilitate system programming. It includes a link editor, `bold`, and a dynamic loader, `ld-bf.so`. For now, it works exclusively on amd*** (aka x86_***) machines. At program startup all cells will contain zero, except for the cell directly left of the starting cell which will contain its own address. Accessing cells further left results in undefined behaviour. All cells are *** bits wide. Command reference: + Increase value of current cell - Decrease value of current cell > Go right < Go left [ Start loop ] End loop . Write Character to stdout , Read Character from stdin ! Do a syscall and store the result in the current cell. Before doing the call, the values of the next seven cells beginning at the current are stored into %rax, %rdi, %rsi, %rdx, %r10, %r8 and %r9, in that order. = Copy cell contents. Can be chained. (i.e. === -> copy value of current cell 3 cells to the right) * Interpret cell value as memory addres, and load # FAQ ### Q: Why not just use a compiler? A: After compiling, we are left with assembler which is hard to read for many people. With this method the original source code will be preserved, which makes debugging easier. ### Q: Raw syscalls are annoying, how about a way to call C functions? A: By reusing library code, bugs and bad design choices made by the library implementer are propagated into user code. The only way to ensure bug-free and maintainable code is to write everything from scratch. ### Q: I want to do crypto though, surely I should not implement that myself? A: That's right. Fortunately, this package makes loading of libraries very easy. Just write a small C++-wrapper to call the desired function, implement a C++-compiler and linker to create an executable file, and call that binary using `execv()`. ### Q: What are the benefits of having a dynamic loader that doesn't do relocations and works completely statically? A: Before I can answer this, I need cover some prerequisites...hey, look at this cute kitten over there! ![](https://github.com/lava/amd64-bf/blob/master/./kitty.jpg) (Picture by [Mel](https://github.com/lava/amd64-bf/blob/master/https://www.flickr.com/photos/karamell/), CC BY-ND 2.0) # Remarks * Thread-local storage isn't properly implemented (yet?) * `bold` should probably support a `-static` flag. Or any flag at all. * I will be very impressed if someone manages to write a program that properly daemonizes and accepts incoming connections on a socket.

近期下载者

相关文件


收藏者