Skip to content

Instantly share code, notes, and snippets.

@benmezger
Last active January 20, 2020 01:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benmezger/cc66b8271700487ae5db3aa1769bdcb7 to your computer and use it in GitHub Desktop.
Save benmezger/cc66b8271700487ae5db3aa1769bdcb7 to your computer and use it in GitHub Desktop.
/* Move section to .init that is allocatable and executable. */
.section .init, "ax"
.align 2
.global _start
_start:
.cfi_startproc
.cfi_undefined ra
# _setup_mtrap if interrupt is not enabled
#csrr t0, mstatus
#beqz t0, _setup_mtrap
.option push
.option norelax
la gp, __global_pointer$
.option pop
la sp, __stack_top
add s0, sp, zero
# a0 contains the hartid
# a1 contains a pointer to the machine description (FDT)
jal initialize_hart
jal _setup_mtrap
jal zero, main
.cfi_endproc
.end
struct fdt_node *
scan_node(uint32_t *dt_struct)
{
struct device _dv;
int i;
int len = sizeof(device_tbl) / sizeof(device_tbl[0]);
for (i = 0; i < len; i++) {
if (strcmp(device_tbl[i].name, (const char *)dt_struct + 1)) {
struct fdt_node *node;
node->name = dt_struct + 1;
....
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment