The source layout now mirrors the runtime filesystem hierarchy
(docs/danos-file-system-hierarchy-FSH.md): what lives under system/ in the
source is what a running danos represents under /system. Each service and
driver is a sub-project directory that is its own Zig module — cross-project
references go by module name, never by a path into another project's files.
Moves (all git mv, history preserved):
- src/ -> system/ (danos internals; the self-representation)
root.zig -> danos.zig (the kernel<->user contract module)
kernel/arch/ -> kernel/architecture/ (arch -> architecture)
device/ -> devices/ (what /system/devices reflects)
boot/ -> /boot (the loaders, top level)
- sbin/ -> split by role:
init, vfs -> system/services/<name>/<name>.zig
hpetd, busd -> system/drivers/<name>/<name>.zig
vfs-test -> system/services/vfs/vfs-test.zig (inside the vfs project)
- lib/ -> library/runtime/ (room for other libraries beside runtime)
The VFS wire protocol becomes its own module, system/services/vfs/protocol.zig
("vfs-protocol"): the vfs sub-project exposes its interface, and the runtime's
file layer imports it by name. First instance of the "protocol module" pattern
(docs/driver-model.md); usb/block will expose theirs the same way.
Also: fix a naming-standard violation in the protocol — Op -> Operation (and
req -> request, _pad -> _padding). Docs updated: /system/services added to the
FHS doc, a repository-layout section added to the docs index, and stale source
paths swept across comments and docs.
Runtime boot paths are unchanged (the bootloader still loads /sbin/init);
aligning the runtime filesystem to the FHS is a separate follow-up. Suite 35/35
plus host tests green.
53 lines
1.5 KiB
Plaintext
53 lines
1.5 KiB
Plaintext
/* Shared link layout for every user binary (init, servers, drivers).
|
|
*
|
|
* Linked at a fixed user-space virtual base (set by `image_base` in build.zig,
|
|
* inside the kernel's user region). Same discipline as the kernel's script:
|
|
* one PT_LOAD per permission set, every section page-aligned, so the kernel's
|
|
* user-ELF loader can map each segment with exact W^X permissions. Note the
|
|
* linker also emits a read-only PT_LOAD covering the ELF headers at the image
|
|
* base, so the entry point comes from e_entry, not the base address.
|
|
*/
|
|
|
|
ENTRY(_start)
|
|
|
|
/* FLAGS bits: 1=X, 2=W, 4=R. */
|
|
PHDRS {
|
|
text PT_LOAD FLAGS(5); /* R + X */
|
|
rodata PT_LOAD FLAGS(4); /* R */
|
|
data PT_LOAD FLAGS(6); /* R + W */
|
|
}
|
|
|
|
SECTIONS {
|
|
/* The `.large` code model (needed for the >4 GiB image base) emits code and
|
|
* data into .ltext/.lrodata/.ldata/.lbss; fold those into the matching
|
|
* permission segment alongside the normal names. */
|
|
.text ALIGN(4K) : {
|
|
*(.text .text.*)
|
|
*(.ltext .ltext.*)
|
|
} :text
|
|
|
|
.rodata ALIGN(4K) : {
|
|
*(.rodata .rodata.*)
|
|
*(.lrodata .lrodata.*)
|
|
} :rodata
|
|
|
|
.data ALIGN(4K) : {
|
|
*(.data .data.*)
|
|
*(.ldata .ldata.*)
|
|
} :data
|
|
|
|
/* .bss occupies memory but not file space; the loader zeroes the
|
|
* filesz..memsz gap. */
|
|
.bss ALIGN(4K) : {
|
|
*(.bss .bss.*)
|
|
*(.lbss .lbss.*)
|
|
*(COMMON)
|
|
} :data
|
|
|
|
/DISCARD/ : {
|
|
*(.comment)
|
|
*(.note .note.*)
|
|
*(.eh_frame .eh_frame_hdr)
|
|
}
|
|
}
|