summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2024-12-09 22:47:41 -0700
committerLuke T. Shumaker <lukeshu@lukeshu.com>2024-12-09 22:51:11 -0700
commit17d625361a18106d804cd63b018a1a7acd2485af (patch)
tree6a87b4e87848f2d9fcc89a51721ef3dc869dc63a
parentf17b5684568e3cb5f733367fc812b9972d7eefc9 (diff)
build-aux/stack.c.gen: Read a bunch of pico-sdk assembly
-rwxr-xr-xbuild-aux/stack.c.gen67
1 files changed, 63 insertions, 4 deletions
diff --git a/build-aux/stack.c.gen b/build-aux/stack.c.gen
index 30dbc45..22b18d5 100755
--- a/build-aux/stack.c.gen
+++ b/build-aux/stack.c.gen
@@ -461,13 +461,65 @@ def main(
return call == "_out_buffer"
return False
+ # src/rp2_common/hardware_divider/include/hardware/divider_helper.S
+ save_div_state_and_lr = 5 * 4
+ # src/rp2_common/pico_divider/divider_hardware.S
+ save_div_state_and_lr_64 = 5 * 4
pico_nodes: list[Node] = [
# src/rp2_common/pico_int64_ops/pico_int64_ops_aeabi.S
synthetic_node("__aeabi_lmul", 4),
# src/rp2_common/pico_divider/divider_hardware.S
- synthetic_node("__aeabi_uidiv", 0, {"__aeabi_uidivmod"}),
- synthetic_node("__aeabi_uidivmod", 0), # TODO
- synthetic_node("__aeabi_uldivmod", 0), # TODO
+ # s32 aliases
+ synthetic_node("div_s32s32", 0, {"divmod_s32s32"}),
+ synthetic_node("__aeabi_idiv", 0, {"divmod_s32s32"}),
+ synthetic_node("__aeabi_idivmod", 0, {"divmod_s32s32"}),
+ # s32 impl
+ synthetic_node("divmod_s32s32", 0, {"divmod_s32s32_savestate"}),
+ synthetic_node(
+ "divmod_s32s32_savestate", save_div_state_and_lr, {"divmod_s32s32_unsafe"}
+ ),
+ synthetic_node("divmod_s32s32_unsafe", 2 * 4, {"__aeabi_idiv0"}),
+ # u32 aliases
+ synthetic_node("div_u32u32", 0, {"divmod_u32u32"}),
+ synthetic_node("__aeabi_uidiv", 0, {"divmod_u32u32"}),
+ synthetic_node("__aeabi_uidivmod", 0, {"divmod_u32u32"}),
+ # u32 impl
+ synthetic_node("divmod_u32u32", 0, {"divmod_u32u32_savestate"}),
+ synthetic_node(
+ "divmod_u32u32_savestate", save_div_state_and_lr, {"divmod_u32u32_unsafe"}
+ ),
+ synthetic_node("divmod_u32u32_unsafe", 2 * 4, {"__aeabi_idiv0"}),
+ # s64 aliases
+ synthetic_node("div_s64s64", 0, {"divmod_s64s64"}),
+ synthetic_node("__aeabi_ldiv", 0, {"divmod_s64s64"}),
+ synthetic_node("__aeabi_ldivmod", 0, {"divmod_s64s64"}),
+ # s64 impl
+ synthetic_node("divmod_s64s64", 0, {"divmod_s64s64_savestate"}),
+ synthetic_node(
+ "divmod_s64s64_savestate",
+ save_div_state_and_lr_64 + (2 * 4),
+ {"divmod_s64s64_unsafe"},
+ ),
+ synthetic_node(
+ "divmod_s64s64_unsafe", 4, {"divmod_u64u64_unsafe", "__aeabi_ldiv0"}
+ ),
+ # u64 aliases
+ synthetic_node("div_u64u64", 0, {"divmod_u64u64"}),
+ synthetic_node("__aeabi_uldiv", 0, {"divmod_u64u64"}),
+ synthetic_node("__aeabi_uldivmod", 0, {"divmod_u64u64"}),
+ # u64 impl
+ synthetic_node("divmod_u64u64", 0, {"divmod_u64u64_savestate"}),
+ synthetic_node(
+ "divmod_u64u64_savestate",
+ save_div_state_and_lr_64 + (2 * 4),
+ {"divmod_u64u64_unsafe"},
+ ),
+ synthetic_node(
+ "divmod_u64u64_unsafe", (1 + 1 + 2 + 5 + 5 + 2) * 4, {"__aeabi_ldiv0"}
+ ),
+ # *_rem
+ synthetic_node("divod_s64s64_rem", 2 * 4, {"divmod_s64s64"}),
+ synthetic_node("divod_u64u64_rem", 2 * 4, {"divmod_u64u64"}),
# src/rp2040/boot_stage2/boot2_${name,,}.S for name=W25Q080,
# controlled by `#define PICO_BOOT_STAGE2_{name} 1` in
# src/boards/include/boards/pico.h
@@ -581,6 +633,13 @@ def main(
synthetic_node("random", 0), # TODO
]
+ # libgcc #########################################################
+
+ gcc_nodes: list[Node] = [
+ synthetic_node("__aeabi_idiv0", 0), # TODO
+ synthetic_node("__aeabi_ldiv0", 0), # TODO
+ ]
+
# main ###########################################################
def thread_filter(name: str) -> bool:
@@ -624,7 +683,7 @@ def main(
analyze(
ci_fnames=arg_ci_fnames,
- extra_nodes=pico_nodes + newlib_nodes,
+ extra_nodes=pico_nodes + newlib_nodes + gcc_nodes,
app_func_filters={
"Threads": thread_filter,
"Interrupt handlers": intrhandler_filter,