[my own compiler] Make a.out binary
[my own compiler] Make a.out binary
At begin, sorry for my english
Hi all
I am makeing my own compiler for some months. Now I am in point there I must do somethink with code I can generate Assembler code, and using NAMS to building binaries, but I really want to learn building binaries myself
So I am looking for some documents about preparing x86 a.out binary files. I know about structure of a.out, but I do not know how to make a binary code.
Can you put here some links what you knows? Or help my on any way
?
Helo O.o7
Best Regards
yonami
- AndrewAPrice
- Member
- Posts: 2299
- Joined: Mon Jun 05, 2006 11:00 pm
- Location: USA (and Australia)
Order the Intel manuals (free including delivery) specifically volume 2A & 2B. They list every instruction along with Intel assembly syntax and machine opcodes.
A binary file is basically a file full of instructions written as opcodes followed by their parameters. I imagine there would be a website out that (maybe even a tutorial) explaining this better, but I've yet to find one.
I'll repeat it again, get the Intel manuals!! It's free and they delivery world wide (I'm in Australia). There are more instructions than you'd imagine, and writing an assembler will be a long and tedious process.
Good luck!
A binary file is basically a file full of instructions written as opcodes followed by their parameters. I imagine there would be a website out that (maybe even a tutorial) explaining this better, but I've yet to find one.
I'll repeat it again, get the Intel manuals!! It's free and they delivery world wide (I'm in Australia). There are more instructions than you'd imagine, and writing an assembler will be a long and tedious process.
Good luck!
For my compiler, I used
http://www.sandpile.org
Maybe it's a bit difficult to read at first, but I prefer this to the Intel Manuals. There are some basics, for example "modRM-Byte", you need to know, but if you understand the principe it's very easy to look up the binary code for an instruction.
http://www.sandpile.org
Maybe it's a bit difficult to read at first, but I prefer this to the Intel Manuals. There are some basics, for example "modRM-Byte", you need to know, but if you understand the principe it's very easy to look up the binary code for an instruction.
i dont find the intel manuals to be any harder, and all those charts and tables that sandpile uses, are extracted from the intel manuals (and easily found by searching the intel PDF)
a better map is the instruction encodings (not sure if its on sandpile -- though it probably is, im just dont use that site enough to know where) is appendix B -- table B-13 contains every general purpose non-64bit instruction in alphabetical order, and the binary encodings for it (its in section B.2, and on page B-9 in revision 19US), with other sections for other catagories (64bit, FPU, SSE, etc)
plus, each instruction gets its own section in the intel manuals, explaining in detail how it works, and how to use it, and how to encode it
in the end, its up to you which you use, but either way you should order the intel manuals, and download the PDFs -- which are kept more up-to-date (and are searchable)
the opcode tables are ripped straight from the intel manuals, vol 2(b) appendix A.3 table A-2, A-3, A-4, and A-5 (currently blank) with the group tables in A4.2 table A-6 with escape ops in section A.5Maybe it's a bit difficult to read at first, but I prefer this to the Intel Manuals. There are some basics, for example "modRM-Byte", you need to know, but if you understand the principe it's very easy to look up the binary code for an instruction.
a better map is the instruction encodings (not sure if its on sandpile -- though it probably is, im just dont use that site enough to know where) is appendix B -- table B-13 contains every general purpose non-64bit instruction in alphabetical order, and the binary encodings for it (its in section B.2, and on page B-9 in revision 19US), with other sections for other catagories (64bit, FPU, SSE, etc)
plus, each instruction gets its own section in the intel manuals, explaining in detail how it works, and how to use it, and how to encode it
in the end, its up to you which you use, but either way you should order the intel manuals, and download the PDFs -- which are kept more up-to-date (and are searchable)