Skip to content

Commit

Permalink
WIP: ld: add drivers section
Browse files Browse the repository at this point in the history
JIRA: RTOS-848
  • Loading branch information
Gerard Swiderski authored and gerard5 committed Jun 25, 2024
1 parent 320e253 commit ed09ef9
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 0 deletions.
9 changes: 9 additions & 0 deletions devices/devs.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ struct {
} devs_common;


/* Anchors for section which contains driver entries */
extern const dev_t __dev_start[];
extern const dev_t __dev_end[];


void devs_register(unsigned int major, unsigned int nb, const dev_t *dev)
{
unsigned int minor;
Expand All @@ -49,6 +54,10 @@ void devs_init(void)
unsigned int major;
unsigned int minor;

for (const dev_t *dev = __dev_start; dev < __dev_end; dev++) {
dev->init(0);
}

for (major = 0; major < SIZE_MAJOR; ++major) {
for (minor = 0; minor < SIZE_MINOR; ++minor) {
dev = devs_common.devs[major][minor];
Expand Down
7 changes: 7 additions & 0 deletions ld/common/plo-arm.lds
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ SECTIONS
__cmd_end = .;
} > PLO_IMAGE

/* section dedicated for PLO drivers */
.drivers : ALIGN(4) {
__dev_start = .;
KEEP (*(SORT_BY_NAME(drivers)))
__dev_end = .;
} > PLO_IMAGE

/* put .ARM.ex* the sections containing information for unwinding the stack */
.ARM.extab : {
PROVIDE_HIDDEN(__extab_start = .);
Expand Down
7 changes: 7 additions & 0 deletions ld/common/plo-ia32.lds
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ SECTIONS
__cmd_end = .;
} > PLO_IMAGE

/* section dedicated for PLO drivers */
.drivers : ALIGN(4) {
__dev_start = .;
KEEP (*(SORT_BY_NAME(drivers)))
__dev_end = .;
} > PLO_IMAGE

.eh_frame_hdr : { *(.eh_frame_hdr) *(.eh_frame_entry .eh_frame_entry.*) } > PLO_IMAGE
.eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) *(.eh_frame.*) } > PLO_IMAGE

Expand Down
7 changes: 7 additions & 0 deletions ld/common/plo-riscv64.lds
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ SECTIONS
__cmd_end = .;
} > PLO_IMAGE

/* section dedicated for PLO drivers */
.drivers : ALIGN(8) {
__dev_start = .;
KEEP (*(SORT_BY_NAME(drivers)))
__dev_end = .;
} > PLO_IMAGE

.eh_frame_hdr : { *(.eh_frame_hdr) *(.eh_frame_entry .eh_frame_entry.*) } > PLO_IMAGE
.eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) *(.eh_frame.*) } > PLO_IMAGE

Expand Down
7 changes: 7 additions & 0 deletions ld/common/plo-sparc.lds
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ SECTIONS
__cmd_end = .;
} > PLO_IMAGE

/* section dedicated for PLO drivers */
.drivers : ALIGN(4) {
__dev_start = .;
KEEP (*(SORT_BY_NAME(drivers)))
__dev_end = .;
} > PLO_IMAGE

.eh_frame_hdr : { *(.eh_frame_hdr) *(.eh_frame_entry .eh_frame_entry.*) } > PLO_IMAGE
.eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) *(.eh_frame.*) } > PLO_IMAGE

Expand Down

0 comments on commit ed09ef9

Please sign in to comment.