I want to be able to declare function so that they are added to a specific code section and then they are all executed before my start function. Something like this:
void __attribute__((__section__(".driverinit"))) disk_driver_init() {
dev_register(&diskDevice);
}
The purpose is that each of these would add their variable to an array so that the functions contained in it can be processed. I know I can add these functions all globally but I'm trying to avoid that if I can.
The problem is that as soon as the first one returns I don't know how to go to the next function in the set. Or possibly have the functions not generate a "ret" at the end and fall through. Not sure if that's possible.
Here's the disassembly, I would like it to run each function in the code section and then jump to _start at the end if that's possible somehow...
Disassembly of section .driverinit:
0000000000000000 <disk_driver_init>:
0: a9bf7bfd stp x29, x30, [sp, #-16]!
4: 910003fd mov x29, sp
8: d0000040 adrp x0, a000 <FLAG_APP_CMD+0x138>
c: 9128e000 add x0, x0, #0xa38
10: 9400020f bl 84c <dev_register>
14: d503201f nop
18: a8c17bfd ldp x29, x30, [sp], #16
1c: d65f03c0 ret
20: 14000002 b 28 <_start>
24: d65f03c0 ret
Disassembly of section .text.boot:
0000000000000028 <_start>:
28: d53800a0 mrs x0, mpidr_el1
2c: 92401c00 and x0, x0, #0xff
30: b4000040 cbz x0, 38 <startup_proc>
Can someone steer me in the right direction?