diff options
-rw-r--r-- | subx/Readme.md | 8 | ||||
-rwxr-xr-x | subx/clean | 1 | ||||
-rwxr-xr-x | subx/edit | 6 | ||||
-rwxr-xr-x | subx/g | 8 | ||||
-rwxr-xr-x | subx/gen | 51 | ||||
-rwxr-xr-x | subx/gg | 8 | ||||
-rwxr-xr-x | subx/ggdiff | 12 | ||||
-rwxr-xr-x | subx/nrun | 6 | ||||
-rwxr-xr-x | subx/run | 6 | ||||
-rw-r--r-- | subx/teensy/Readme | 1 | ||||
-rwxr-xr-x | subx/teensy/test1 | bin | 5584 -> 0 bytes | |||
-rw-r--r-- | subx/teensy/test1.c | 3 | ||||
-rwxr-xr-x | subx/teensy/test2 | bin | 5584 -> 0 bytes | |||
-rw-r--r-- | subx/teensy/test2.s | 9 | ||||
-rwxr-xr-x | subx/teensy/test3 | bin | 4848 -> 0 bytes | |||
-rw-r--r-- | subx/teensy/test3.s | 10 | ||||
-rwxr-xr-x | subx/teensy/test4 | bin | 368 -> 0 bytes | |||
-rw-r--r-- | subx/teensy/test4.s | 10 | ||||
-rwxr-xr-x | subx/teensy/test5 | bin | 96 -> 0 bytes | |||
-rw-r--r-- | subx/teensy/test5.s | 45 | ||||
-rwxr-xr-x | subx/teensy/test6 | bin | 5588 -> 0 bytes | |||
-rw-r--r-- | subx/teensy/test6-global.s | 13 | ||||
-rwxr-xr-x | subx/teensy/test7 | bin | 4100 -> 0 bytes | |||
-rw-r--r-- | subx/teensy/test7-global.s | 58 | ||||
-rw-r--r-- | subx/teensy/vimrc.vim | 12 |
25 files changed, 10 insertions, 257 deletions
diff --git a/subx/Readme.md b/subx/Readme.md index 7e447208..488e249a 100644 --- a/subx/Readme.md +++ b/subx/Readme.md @@ -127,10 +127,10 @@ either of these invariants is broken it's a bug on my part. The binary should also be runnable on a 64-bit Linux system. I can't guarantee it, but I'd appreciate hearing if it doesn't run. -However, there are a few more binaries in the teensy/ directory. They are not -guaranteed to be runnable by `subx`. I'm not building general infrastructure -here for all of the x86 ISA and ELF format. SubX is about programming with a -small, regular subset of 32-bit x86: +However, not all 32-bit Linux binaries are guaranteed to be runnable by +`subx`. I'm not building general infrastructure here for all of the x86 ISA +and ELF format. SubX is about programming with a small, regular subset of +32-bit x86: * Only instructions that operate on the 32-bit E\*X registers. (No floating-point yet.) diff --git a/subx/clean b/subx/clean index cbcf326f..2878ea58 100755 --- a/subx/clean +++ b/subx/clean @@ -5,5 +5,4 @@ set -v rm -rf subx.cc subx_bin* *_list test $# -gt 0 && exit 0 # convenience: 'clean top-level' to leave subsidiary tools alone rm -rf ../enumerate/enumerate ../tangle/tangle ../tangle/*_list ../*/*.dSYM -rm -rf teensy/*.o rm -rf .until diff --git a/subx/edit b/subx/edit index c33ee46b..b33d8212 100755 --- a/subx/edit +++ b/subx/edit @@ -7,10 +7,4 @@ then exit 1 fi -if [[ $1 == 'test'* ]] -then - eval $EDITOR ./teensy/$1*.[cs] - exit $? -fi - eval $EDITOR ./$1.subx diff --git a/subx/g b/subx/g index 25da2232..fcfd8eb7 100755 --- a/subx/g +++ b/subx/g @@ -10,10 +10,4 @@ fi arg=( $* ) target=$arg[${#arg[@]}] unset "arg[${#arg[@]}]" - -if [[ $target == 'test'* ]] -then - git ${arg[@]} ./teensy/$target*.[cs] -else - git ${arg[@]} ./$target*.subx -fi +git ${arg[@]} ./$target*.subx diff --git a/subx/gen b/subx/gen index e551fa3f..c9c5c85d 100755 --- a/subx/gen +++ b/subx/gen @@ -1,52 +1,5 @@ #!/usr/bin/env zsh # Build a specific example. -if [[ $1 == 'ex'* ]] -then - CFLAGS=-g subx translate $1.subx `echo $1 |sed 's/\..*//'` - exit $? -fi - -if [ $1 = test1 ] -then - gcc -Wall -s teensy/test1.c -o teensy/test1 - exit $? -fi - -if [ $1 = test2 ] -then - nasm -f elf teensy/test2.s && gcc -Wall -s teensy/test2.o -o teensy/test2 - exit $? -fi - -if [ $1 = test3 ] -then - nasm -f elf teensy/test3.s && gcc -Wall -s -nostartfiles teensy/test3.o -o teensy/test3 - exit $? -fi - -if [ $1 = test4 ] -then - nasm -f elf teensy/test4.s && gcc -Wall -s -nostdlib teensy/test4.o -o teensy/test4 - exit $? -fi - -if [ $1 = test5 ] -then - nasm -f bin teensy/test5.s -o teensy/test5 && chmod +x teensy/test5 - exit $? -fi - -if [ $1 = test6 ] -then - nasm -f elf teensy/test6-global.s && gcc -Wall -s teensy/test6-global.o -o teensy/test6 - exit $? -fi - -if [ $1 = test7 ] -then - nasm -f bin teensy/test7-global.s -o teensy/test7 && chmod +x teensy/test7 - exit $? -fi - -exit 127 +CFLAGS=-g subx translate $1.subx `echo $1 |sed 's/\..*//'` +exit $? diff --git a/subx/gg b/subx/gg index b733a58d..cafc7864 100755 --- a/subx/gg +++ b/subx/gg @@ -10,10 +10,4 @@ fi arg=( $* ) target=$arg[${#arg[@]}] unset "arg[${#arg[@]}]" - -if [[ $target == 'test'* ]] -then - git ${arg[@]} ./teensy/$target -else - git ${arg[@]} ./$target -fi +git ${arg[@]} ./$target diff --git a/subx/ggdiff b/subx/ggdiff index e2263ec2..0b2f34ca 100755 --- a/subx/ggdiff +++ b/subx/ggdiff @@ -9,14 +9,6 @@ fi target=$1 rev=${2:-HEAD} - tmp=`mktemp` - -if [[ $target == 'test'* ]] -then - git show ${rev}:subx/teensy/$target > $tmp - xdiff $tmp teensy/$target -else - git show ${rev}:subx/$target > $tmp - xdiff $tmp $target -fi +git show ${rev}:subx/$target > $tmp +xdiff $tmp $target diff --git a/subx/nrun b/subx/nrun index 01658574..e8f06df6 100755 --- a/subx/nrun +++ b/subx/nrun @@ -7,11 +7,5 @@ then exit 1 fi -if [[ $1 == 'test'* ]] -then - ./teensy/$1 - exit $? -fi - ./$1 exit $? diff --git a/subx/run b/subx/run index b0eac8df..cd484787 100755 --- a/subx/run +++ b/subx/run @@ -7,11 +7,5 @@ then exit 1 fi -if [[ $1 == 'test'* ]] -then - CFLAGS=-g subx run teensy/$1 - exit $? -fi - CFLAGS=-g subx run $1 exit $? diff --git a/subx/teensy/Readme b/subx/teensy/Readme deleted file mode 100644 index 7de5f3ca..00000000 --- a/subx/teensy/Readme +++ /dev/null @@ -1 +0,0 @@ -Test 32-bit ELF binaries. diff --git a/subx/teensy/test1 b/subx/teensy/test1 deleted file mode 100755 index 699edc0d..00000000 --- a/subx/teensy/test1 +++ /dev/null Binary files differdiff --git a/subx/teensy/test1.c b/subx/teensy/test1.c deleted file mode 100644 index 16a9e9b6..00000000 --- a/subx/teensy/test1.c +++ /dev/null @@ -1,3 +0,0 @@ -// https://www.muppetlabs.com/~breadbox/software/tiny/teensy.html -// gcc -Wall -s test1.c -o test1 -int main() { return 42; } diff --git a/subx/teensy/test2 b/subx/teensy/test2 deleted file mode 100755 index 93b39449..00000000 --- a/subx/teensy/test2 +++ /dev/null Binary files differdiff --git a/subx/teensy/test2.s b/subx/teensy/test2.s deleted file mode 100644 index c25152e5..00000000 --- a/subx/teensy/test2.s +++ /dev/null @@ -1,9 +0,0 @@ -; https://www.muppetlabs.com/~breadbox/software/tiny/teensy.html -; nasm -f elf test2.s -; gcc -Wall -s test2.o -o test2 -BITS 32 -GLOBAL main -SECTION .text -main: - mov eax, 42 - ret diff --git a/subx/teensy/test3 b/subx/teensy/test3 deleted file mode 100755 index 365b9ade..00000000 --- a/subx/teensy/test3 +++ /dev/null Binary files differdiff --git a/subx/teensy/test3.s b/subx/teensy/test3.s deleted file mode 100644 index b00c3cc0..00000000 --- a/subx/teensy/test3.s +++ /dev/null @@ -1,10 +0,0 @@ -; https://www.muppetlabs.com/~breadbox/software/tiny/teensy.html -; nasm -f elf test3.s -; gcc -Wall -s -nostartfiles test3.o -o test3 -BITS 32 -EXTERN _exit -GLOBAL _start -SECTION .text -_start: - push dword 42 - call _exit diff --git a/subx/teensy/test4 b/subx/teensy/test4 deleted file mode 100755 index 50be075e..00000000 --- a/subx/teensy/test4 +++ /dev/null Binary files differdiff --git a/subx/teensy/test4.s b/subx/teensy/test4.s deleted file mode 100644 index 3d7f7f62..00000000 --- a/subx/teensy/test4.s +++ /dev/null @@ -1,10 +0,0 @@ -; https://www.muppetlabs.com/~breadbox/software/tiny/teensy.html -; nasm -f elf test4.s -; gcc -Wall -s -nostdlib test4.o -o test4 -BITS 32 -GLOBAL _start -SECTION .text -_start: - mov ebx, 42 - mov eax, 1 - int 0x80 diff --git a/subx/teensy/test5 b/subx/teensy/test5 deleted file mode 100755 index f3c9730d..00000000 --- a/subx/teensy/test5 +++ /dev/null Binary files differdiff --git a/subx/teensy/test5.s b/subx/teensy/test5.s deleted file mode 100644 index ca7c86e4..00000000 --- a/subx/teensy/test5.s +++ /dev/null @@ -1,45 +0,0 @@ -; https://www.muppetlabs.com/~breadbox/software/tiny/teensy.html -; nasm -f bin test5.s -o test5 -; chmod +x test5 -BITS 32 - - org 0x08048000 - -ehdr: ; Elf32_Ehdr - db 0x7F, "ELF", 1, 1, 1, 0 ; e_ident - times 8 db 0 - dw 2 ; e_type - dw 3 ; e_machine - dd 1 ; e_version - dd _start ; e_entry - dd phdr - $$ ; e_phoff - dd 0 ; e_shoff - dd 0 ; e_flags - dw ehdrsize ; e_ehsize - dw phdrsize ; e_phentsize - dw 1 ; e_phnum - dw 0 ; e_shentsize - dw 0 ; e_shnum - dw 0 ; e_shstrndx -ehdrsize equ $ - ehdr - -phdr: ; Elf32_Phdr - dd 1 ; p_type - # don't copy ehdr or phdr into the first segment. - dd 0x54 ; p_offset - # but you can't save on bytes for them, because p_align. - # messing with the ORG won't help you here. - dd 0x08048054 ; p_vaddr - dd 0x08048054 ; p_paddr - dd codesize ; p_filesz - dd codesize ; p_memsz - dd 5 ; p_flags - dd 0x1000 ; p_align -phdrsize equ $ - phdr - -_start: - mov ebx, 42 - mov eax, 1 - int 0x80 - -codesize equ $ - _start diff --git a/subx/teensy/test6 b/subx/teensy/test6 deleted file mode 100755 index 2d2e146a..00000000 --- a/subx/teensy/test6 +++ /dev/null Binary files differdiff --git a/subx/teensy/test6-global.s b/subx/teensy/test6-global.s deleted file mode 100644 index a09eecae..00000000 --- a/subx/teensy/test6-global.s +++ /dev/null @@ -1,13 +0,0 @@ -; Example with a data segment. -; nasm -f elf test6-global.s -; gcc -Wall -s test6-global.o -o test6 -BITS 32 - -SECTION .data -foo: dd 42 - -SECTION .text -GLOBAL main -main: - mov eax, [foo] - ret diff --git a/subx/teensy/test7 b/subx/teensy/test7 deleted file mode 100755 index 0d44519d..00000000 --- a/subx/teensy/test7 +++ /dev/null Binary files differdiff --git a/subx/teensy/test7-global.s b/subx/teensy/test7-global.s deleted file mode 100644 index 4cb4e8f3..00000000 --- a/subx/teensy/test7-global.s +++ /dev/null @@ -1,58 +0,0 @@ -; https://www.muppetlabs.com/~breadbox/software/tiny/teensy.html -; nasm -f bin test7-global.s -o test7 -; chmod +x test7 -BITS 32 - - org 0x08048000 - -ehdr: ; Elf32_Ehdr - db 0x7F, "ELF", 1, 1, 1, 0 ; e_ident - times 8 db 0 - dw 2 ; e_type - dw 3 ; e_machine - dd 1 ; e_version - dd _start ; e_entry - dd phdr1 - $$ ; e_phoff - dd 0 ; e_shoff - dd 0 ; e_flags - dw ehdrsize ; e_ehsize - dw phdrsize ; e_phentsize - dw 2 ; e_phnum - dw 0 ; e_shentsize - dw 0 ; e_shnum - dw 0 ; e_shstrndx -ehdrsize equ $ - ehdr - -phdr1: ; Elf32_Phdr - dd 1 ; p_type - dd 0 ; p_offset - dd $$ ; p_vaddr - dd $$ ; p_paddr - dd codesize ; p_filesz - dd codesize ; p_memsz - dd 5 ; p_flags = r-x - dd 0x1000 ; p_align -phdrsize equ $ - phdr1 - -phdr2: - dd 1 ; p_type - dd _data - $$ ; p_offset - dd _data ; p_vaddr - dd _data ; p_paddr - dd datasize ; p_filesz - dd datasize ; p_memsz - dd 6 ; p_flags = rw- - dd 0x1000 ; p_align - -_start: - mov ebx, [foo] - mov eax, 1 - int 0x80 - -codesize equ $ - $$ ; TODO: why include the headers?! - -alignb 0x1000 -_data: - foo: dd 42 - -datasize equ $ - _data diff --git a/subx/teensy/vimrc.vim b/subx/teensy/vimrc.vim deleted file mode 100644 index e0fe2c1e..00000000 --- a/subx/teensy/vimrc.vim +++ /dev/null @@ -1,12 +0,0 @@ -" assumes CWD is subx/ -command! -nargs=1 EE call EditSubx(<f-args>) - -function! EditSubx(arg) - " run commands silently because we may get an error loading EditSubx from a - " different directory. - if a:arg =~ "test.*" - exec "silent! vert split teensy/" . a:arg . "*.[cs]" - else - exec "silent! vert split " . a:arg . "*.subx" - endif -endfunction |