|
@@ -3,11 +3,101 @@
|
3
|
3
|
@section SYNOPSIS
|
4
|
4
|
asmsh [OPTIONS]...
|
5
|
5
|
@section DESCRIPTION
|
6
|
|
-A shell designed to run assembly.
|
|
6
|
+A shell designed to run assembly (for the moment only x86_64 is supported).
|
7
|
7
|
|
8
|
8
|
A simple programm is spawned by the shell, and each instructions are runned in the
|
9
|
9
|
subprocess environment.
|
10
|
10
|
|
|
11
|
+@section UI
|
|
12
|
+
|
|
13
|
+For the moment, the UI is implemented using GNU readline with basic support for
|
|
14
|
+completion (using tab).
|
|
15
|
+
|
|
16
|
+The prompt is composed like "asmsh@RIPVAL > " where RIPVAL is the RIP register (
|
|
17
|
+Instruction Pointer ) value in hexadecimal.
|
|
18
|
+
|
|
19
|
+@section INSTRUCTIONS
|
|
20
|
+
|
|
21
|
+The shell uses the GNU as compiler from binutils, the instructions syntax
|
|
22
|
+follows GAS syntax.
|
|
23
|
+
|
|
24
|
+For the moment GAS can only be used with the AT&T syntax.
|
|
25
|
+
|
|
26
|
+Details on x86 syntax can be found in GAS documentation at
|
|
27
|
+<pre>
|
|
28
|
+[https://sourceware.org/binutils/docs-2.40/as.html#i386_002dSyntax]
|
|
29
|
+</pre>
|
|
30
|
+
|
|
31
|
+The list & names of the registers can be found at the same place
|
|
32
|
+<pre>
|
|
33
|
+[https://sourceware.org/binutils/docs-2.40/as.html#i386_002dRegs]
|
|
34
|
+</pre>
|
|
35
|
+
|
|
36
|
+The list & documentation of the instructions for the x86_64 platform can be
|
|
37
|
+found in the 1st volume of "AMD64 Architecture Programmer’s Manual", in section
|
|
38
|
+3.3 Instruction summary
|
|
39
|
+<pre>
|
|
40
|
+[https://www.amd.com/en/support/tech-docs/amd64-architecture-programmers-manual-volumes-1-5]
|
|
41
|
+</pre>
|
|
42
|
+
|
|
43
|
+Or in the Intel's equivalent document, namely the
|
|
44
|
+"Intel® 64 and IA-32 Architectures Software Developer’s Manual"
|
|
45
|
+<pre>
|
|
46
|
+[https://cdrdv2-public.intel.com/774494/325462-sdm-vol-1-2abcd-3abcd.pdf]
|
|
47
|
+</pre>
|
|
48
|
+
|
|
49
|
+@section shell_cmds COMMANDS
|
|
50
|
+
|
|
51
|
+@par .bytecode
|
|
52
|
+Compile an instruction and display it's bytecode
|
|
53
|
+@par .flags
|
|
54
|
+Display the CPU flags
|
|
55
|
+@par .help [COMMAND]
|
|
56
|
+Display the builtin help or the help of the command gioven as argument
|
|
57
|
+@par .maps
|
|
58
|
+Display process memory maps
|
|
59
|
+@par .quit
|
|
60
|
+Exit the shell
|
|
61
|
+@par .regs
|
|
62
|
+Display the CPU registers values
|
|
63
|
+@par .syscalls
|
|
64
|
+Print syscalls names and numbers
|
|
65
|
+@par .reset
|
|
66
|
+Reset the shell (spawn a new process)
|
|
67
|
+
|
|
68
|
+@section EXAMPLES
|
|
69
|
+
|
|
70
|
+@subsection example_exit Exit with a specific status
|
|
71
|
+
|
|
72
|
+<pre>
|
|
73
|
+asmsh@0x7f55d2433000 > mov $60, \%rax
|
|
74
|
+asmsh@0x7f55d2433005 > mov $0x2a, \%rdi
|
|
75
|
+asmsh@0x7f55d243300a > syscall
|
|
76
|
+Child exited with status 42
|
|
77
|
+Exit with status 42
|
|
78
|
+</pre>
|
|
79
|
+
|
|
80
|
+@subsection example_hello Print a message to stdout
|
|
81
|
+
|
|
82
|
+<pre>
|
|
83
|
+asmsh@0x7f6e312e5000 > mov $0x0a6f6c6c, \%rax
|
|
84
|
+asmsh@0x7f6e312e5005 > shl $(8*2), \%rax
|
|
85
|
+asmsh@0x7f6e312e5009 > or $0x6548, \%rax
|
|
86
|
+asmsh@0x7f6e312e500f > push \%rax
|
|
87
|
+asmsh@0x7f6e312e5010 > mov $1, \%rax
|
|
88
|
+asmsh@0x7f6e312e5015 > mov \%rax, \%rdi
|
|
89
|
+asmsh@0x7f6e312e5018 > mov \%rsp, \%rsi
|
|
90
|
+asmsh@0x7f6e312e501b > mov $6, \%rdx
|
|
91
|
+asmsh@0x7f6e312e5020 > syscall
|
|
92
|
+Hello
|
|
93
|
+asmsh@0x7f6e312e5022 >
|
|
94
|
+</pre>
|
|
95
|
+
|
|
96
|
+@section TODO TODOLIST
|
|
97
|
+
|
|
98
|
+@todo Add switch between intel's & AT&T's syntaxes.
|
|
99
|
+@todo Add support for label declarations & references
|
|
100
|
+
|
11
|
101
|
@section AUTHOR
|
12
|
102
|
Written by Yann Weber <yann.weber@members.fsf.org>
|
13
|
103
|
|