summaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2021-10-07 08:48:59 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2021-10-07 08:48:59 +0200
commitd917404de6a1cecb8f069a067cd50efd0986123a (patch)
tree3b37a4e3622d62166f5a6fa4f5be27bf6ed040ef /Documentation
parentdc9f4c29bece2cc66946f56cef9c5868afa92838 (diff)
parent76bced6fe146f2d9f36b21c37e24288701baec28 (diff)
downloadbarebox-d917404de6a1cecb8f069a067cd50efd0986123a.tar.gz
barebox-d917404de6a1cecb8f069a067cd50efd0986123a.tar.xz
Merge branch 'for-next/arm'
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/devel/porting.rst21
1 files changed, 21 insertions, 0 deletions
diff --git a/Documentation/devel/porting.rst b/Documentation/devel/porting.rst
index 97b787327c..1abaabc03a 100644
--- a/Documentation/devel/porting.rst
+++ b/Documentation/devel/porting.rst
@@ -169,6 +169,27 @@ Looking at other boards you might see some different patterns:
needs to be done at start. If a board similar to yours does this, you probably
want to do likewise.
+ - ``__naked``: All functions called before stack is correctly initialized must be
+ marked with this attribute. Otherwise, function prologue and epilogue may access
+ the uninitialized stack. If the compiler for the target architecture doesn't
+ support the attribute, stack must be set up in non-inline assembly:
+ Either a barebox assembly entry point or in earlier firmware.
+ The compiler may still spill excess local C variables used in a naked function
+ to the stack before it was initialized.
+ A naked function should thus preferably only contain inline assembly, set up a
+ stack and jump directly after to a ``noinline`` non naked function where the
+ stack is then normally usable.
+
+ - ``noinline``: Compiler code inlining is oblivious to stack manipulation in
+ inline assembly. If you want to ensure a new function has its own stack frame
+ (e.g. after setting up the stack in a ``__naked`` function), you must jump to
+ a ``__noreturn noinline`` function.
+
+ - ``arm_setup_stack``: For 32-bit ARM, ``arm_setup_stack`` initializes the stack
+ top when called from a naked C function, which allows to write the entry point
+ directly in C. The stack pointer will be decremented before pushing values.
+ Avoid interleaving with C-code. See ``__naked`` above for more details.
+
- ``__dtb_z_my_board_start[];``: Because the PBL normally doesn't parse anything out
of the device tree blob, boards can benefit from keeping the device tree blob
compressed and only unpack it in barebox proper. Such LZO-compressed device trees