file_write_read.c: move from cpp-cheat

Improve README C section with example tree.
This commit is contained in:
Ciro Santilli 六四事件 法轮功
2019-06-07 00:00:03 +00:00
parent 2a27157dbf
commit 9fba97740c
6 changed files with 178 additions and 11 deletions

View File

@@ -11659,6 +11659,8 @@ One "downside" of glibc is that it exercises much more kernel functionality on i
This section contains userland content, such as <<c>>, <<cpp>> and <<posix>> examples.
Userland assembly content is located at: <<userland-assembly>>. It was split from this section basically becase we were hitting the HTML `h6` limit, stupid web :-)
This content makes up the bulk of the link:userland/[] directory.
Getting started at: <<userland-setup>>
@@ -11671,14 +11673,30 @@ This section was originally moved in here from: https://github.com/cirosantilli/
Programs under link:userland/c/[] are examples of link:https://en.wikipedia.org/wiki/ANSI_C[ANSI C] programming:
* link:userland/c/hello.c[]
* main` and environment
** link:userland/c/return0.c[]
** link:userland/c/return1.c[]
** link:userland/c/return2.c[]
** link:userland/c/exit0.c[]
** link:userland/c/exit1.c[]
** link:userland/c/exit2.c[]
** link:userland/c/print_argv.c[]
* Standard library
** assert.h
** `assert.h`
*** link:userland/c/assert_fail.c[]
** `stdlib.h`
*** Exit related
*** exit
**** link:userland/c/abort.c[]
Userland assembly content is located at: <<userland-assembly>>. It was split from this section basically becase we were hitting the HTML `h6` limit, stupid web :-)
*** malloc
**** link:userland/c/out_of_memory.c[]
** `stdio.h`
*** link:userland/c/stderr.c[]
*** link:userland/c/getchar.c[]
*** File IO
**** link:userland/c/file_write_read.c[]
* Fun
** link:userland/c/infinite_loop.c[]
==== GCC C extensions
@@ -13084,7 +13102,7 @@ Note how Sn is weirdly packed inside Dn, and Dn weirdly packed inside Qn, likely
And you can't access the higher bytes at D16 or greater with Sn.
===== ARM vadd instruction
===== ARM VADD instruction
* link:userland/arch/arm/vadd_scalar.S[]: see also: <<floating-point-assembly>>
* link:userland/arch/arm/vadd_vector.S[]: see also: <<simd-assembly>>
@@ -13203,20 +13221,20 @@ link:userland/arch/aarch64/add_vector.S[]
Good first instruction to learn SIMD: <<simd-assembly>>
===== ARMv8 aarch64 fadd instruction
===== ARMv8 aarch64 FADD instruction
* link:userland/arch/aarch64/fadd_vector.S[]: see also: <<simd-assembly>>
* link:userland/arch/aarch64/fadd_scalar.S[]: see also: <<floating-point-assembly>>
====== ARM fadd vs vadd
====== ARM FADD vs VADD
It is very confusing, but `fadds` and `faddd` in Aarch32 are <<gnu-gas-assembler-arm-unified-syntax,pre-UAL>> for `vadd.f32` and `vadd.f64` which we use in this tutorial: <<arm-vadd-instruction>>
The same goes for most ARMv7 mnemonics: `f*` is old, and `v*` is the newer better syntax.
But then, in ARMv8, they decided to use <<armv8-aarch64-fadd-instruction>> as the main floating point add name, and get rid of `vadd`!
But then, in ARMv8, they decided to use <<armv8-aarch64-fadd-instruction>> as the main floating point add name, and get rid of VADD!
Also keep in mind that fused multiply add is `fmadd`.
Also keep in mind that fused multiply add is FMADD.
Examples at: <<simd-assembly>>