docs/system/generic-loader: move TODO to source code

Currently we have a "Restrictions and ToDos" section at the bottom of
the document which notes that there's no way to specify a CPU to load
a file through that doesn't also set that CPU's PC.  This is written
as a developer-facing note.  Move this to a TODO comment in the
source code, and provide a shorter user-facing statement of the
current restriction under the specific sub-option that it applies to.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
This commit is contained in:
Peter Maydell
2026-01-15 15:26:30 +00:00
parent 5f8d933407
commit 6b65590f4a
2 changed files with 21 additions and 11 deletions

View File

@@ -99,6 +99,9 @@ shown below:
If this option is not specified, then the data will be loaded via
the address space of the first CPU, and no CPU will have its PC set.
Note that there is currently no way to specify the address space to
load the data without also causing that CPU's PC to be set.
Since it sets the starting PC, this option should only be used for the boot
image.
@@ -111,14 +114,3 @@ shown below:
An example of loading an ELF file which CPU0 will boot is shown below::
-device loader,file=./images/boot.elf,cpu-num=0
Restrictions and ToDos
^^^^^^^^^^^^^^^^^^^^^^
At the moment it is just assumed that if you specify a cpu-num then
you want to set the PC as well. This might not always be the case. In
future the internal state 'set_pc' (which exists in the generic loader
now) should be exposed to the user so that they can choose if the PC
is set or not.

View File

@@ -30,6 +30,24 @@
* separate backend.
*/
/*
* TODO: currently the "load a file" functionality provides no way
* for the user to specify which CPU address space to load the data
* into without also causing that CPU's PC to be set to the start
* address of the file.
*
* We could fix this by having a new suboption set-pc (default: true)
* so the user can say
* -device loader,file=<file>,cpu-num=<cpu-num>
* for the current "use this address space and set the PC" behaviour
* or
* -device loader,file=<file>,cpu-num=<cpu-num>,set-pc=off
* to just pick the address space and not set the PC.
*
* Using set-pc without file= should be handled as an error; otherwise
* it can feed through to what we set s->set_pc to.
*/
#include "qemu/osdep.h"
#include "system/dma.h"
#include "system/reset.h"