jit_stream_flash.h

Include dependency graph for jit_stream_flash.h:

digraph { graph [bgcolor="#00000000"] node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2] edge [color="#1414CE"] "4" [label="atom.h" tooltip="atom.h"] "6" [label="atom_table.h" tooltip="atom_table.h"] "34" [label="bitstring.h" tooltip="bitstring.h"] "32" [label="context.h" tooltip="context.h"] "12" [label="erl_nif.h" tooltip="erl_nif.h"] "16" [label="ets.h" tooltip="ets.h"] "36" [label="exportedfunction.h" tooltip="exportedfunction.h"] "2" [label="globalcontext.h" tooltip="globalcontext.h"] "23" [label="intn.h" tooltip="intn.h"] "33" [label="jit.h" tooltip="jit.h"] "1" [label="/__w/AtomVM/AtomVM/src/libAtomVM/jit_stream_flash.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/jit_stream_flash.h" fillcolor="#BFBFBF"] "17" [label="list.h" tooltip="list.h"] "27" [label="mailbox.h" tooltip="mailbox.h"] "24" [label="memory.h" tooltip="memory.h"] "31" [label="module.h" tooltip="module.h"] "25" [label="refc_binary.h" tooltip="refc_binary.h"] "26" [label="resources.h" tooltip="resources.h"] "19" [label="smp.h" tooltip="smp.h"] "18" [label="synclist.h" tooltip="synclist.h"] "20" [label="term.h" tooltip="term.h"] "13" [label="term_typedef.h" tooltip="term_typedef.h"] "28" [label="timer_list.h" tooltip="timer_list.h"] "35" [label="unicode.h" tooltip="unicode.h"] "8" [label="utils.h" tooltip="utils.h"] "29" [label="valueshashtable.h" tooltip="valueshashtable.h"] "14" [label="assert.h" tooltip="assert.h"] "9" [label="inttypes.h" tooltip="inttypes.h"] "30" [label="jit_stream_flash_platform.h" tooltip="jit_stream_flash_platform.h"] "15" [label="limits.h" tooltip="limits.h"] "7" [label="stdbool.h" tooltip="stdbool.h"] "10" [label="stddef.h" tooltip="stddef.h"] "3" [label="stdint.h" tooltip="stdint.h"] "11" [label="stdio.h" tooltip="stdio.h"] "5" [label="stdlib.h" tooltip="stdlib.h"] "22" [label="string.h" tooltip="string.h"] "21" [label="sys/types.h" tooltip="sys/types.h"] "4" -> "3" [dir=forward tooltip="include"] "4" -> "5" [dir=forward tooltip="include"] "6" -> "7" [dir=forward tooltip="include"] "6" -> "4" [dir=forward tooltip="include"] "6" -> "8" [dir=forward tooltip="include"] "34" -> "23" [dir=forward tooltip="include"] "34" -> "20" [dir=forward tooltip="include"] "34" -> "35" [dir=forward tooltip="include"] "34" -> "7" [dir=forward tooltip="include"] "34" -> "3" [dir=forward tooltip="include"] "32" -> "2" [dir=forward tooltip="include"] "32" -> "33" [dir=forward tooltip="include"] "32" -> "17" [dir=forward tooltip="include"] "32" -> "27" [dir=forward tooltip="include"] "32" -> "19" [dir=forward tooltip="include"] "32" -> "20" [dir=forward tooltip="include"] "32" -> "28" [dir=forward tooltip="include"] "12" -> "13" [dir=forward tooltip="include"] "16" -> "17" [dir=forward tooltip="include"] "16" -> "18" [dir=forward tooltip="include"] "16" -> "20" [dir=forward tooltip="include"] "36" -> "20" [dir=forward tooltip="include"] "2" -> "3" [dir=forward tooltip="include"] "2" -> "4" [dir=forward tooltip="include"] "2" -> "6" [dir=forward tooltip="include"] "2" -> "12" [dir=forward tooltip="include"] "2" -> "16" [dir=forward tooltip="include"] "2" -> "17" [dir=forward tooltip="include"] "2" -> "27" [dir=forward tooltip="include"] "2" -> "19" [dir=forward tooltip="include"] "2" -> "18" [dir=forward tooltip="include"] "2" -> "20" [dir=forward tooltip="include"] "2" -> "28" [dir=forward tooltip="include"] "2" -> "29" [dir=forward tooltip="include"] "23" -> "7" [dir=forward tooltip="include"] "23" -> "22" [dir=forward tooltip="include"] "23" -> "8" [dir=forward tooltip="include"] "33" -> "34" [dir=forward tooltip="include"] "33" -> "36" [dir=forward tooltip="include"] "33" -> "20" [dir=forward tooltip="include"] "33" -> "13" [dir=forward tooltip="include"] "33" -> "7" [dir=forward tooltip="include"] "1" -> "2" [dir=forward tooltip="include"] "1" -> "30" [dir=forward tooltip="include"] "1" -> "31" [dir=forward tooltip="include"] "1" -> "7" [dir=forward tooltip="include"] "1" -> "3" [dir=forward tooltip="include"] "17" -> "7" [dir=forward tooltip="include"] "27" -> "7" [dir=forward tooltip="include"] "27" -> "17" [dir=forward tooltip="include"] "27" -> "13" [dir=forward tooltip="include"] "27" -> "8" [dir=forward tooltip="include"] "24" -> "3" [dir=forward tooltip="include"] "24" -> "5" [dir=forward tooltip="include"] "24" -> "12" [dir=forward tooltip="include"] "24" -> "13" [dir=forward tooltip="include"] "24" -> "8" [dir=forward tooltip="include"] "31" -> "7" [dir=forward tooltip="include"] "31" -> "3" [dir=forward tooltip="include"] "31" -> "4" [dir=forward tooltip="include"] "31" -> "6" [dir=forward tooltip="include"] "31" -> "32" [dir=forward tooltip="include"] "31" -> "36" [dir=forward tooltip="include"] "31" -> "2" [dir=forward tooltip="include"] "31" -> "33" [dir=forward tooltip="include"] "31" -> "20" [dir=forward tooltip="include"] "25" -> "7" [dir=forward tooltip="include"] "25" -> "5" [dir=forward tooltip="include"] "25" -> "17" [dir=forward tooltip="include"] "25" -> "26" [dir=forward tooltip="include"] "26" -> "5" [dir=forward tooltip="include"] "26" -> "12" [dir=forward tooltip="include"] "26" -> "17" [dir=forward tooltip="include"] "26" -> "27" [dir=forward tooltip="include"] "26" -> "24" [dir=forward tooltip="include"] "26" -> "18" [dir=forward tooltip="include"] "19" -> "7" [dir=forward tooltip="include"] "18" -> "11" [dir=forward tooltip="include"] "18" -> "17" [dir=forward tooltip="include"] "18" -> "19" [dir=forward tooltip="include"] "20" -> "21" [dir=forward tooltip="include"] "20" -> "7" [dir=forward tooltip="include"] "20" -> "3" [dir=forward tooltip="include"] "20" -> "11" [dir=forward tooltip="include"] "20" -> "5" [dir=forward tooltip="include"] "20" -> "22" [dir=forward tooltip="include"] "20" -> "4" [dir=forward tooltip="include"] "20" -> "23" [dir=forward tooltip="include"] "20" -> "24" [dir=forward tooltip="include"] "20" -> "25" [dir=forward tooltip="include"] "20" -> "8" [dir=forward tooltip="include"] "20" -> "13" [dir=forward tooltip="include"] "13" -> "14" [dir=forward tooltip="include"] "13" -> "15" [dir=forward tooltip="include"] "13" -> "9" [dir=forward tooltip="include"] "13" -> "3" [dir=forward tooltip="include"] "28" -> "7" [dir=forward tooltip="include"] "28" -> "3" [dir=forward tooltip="include"] "28" -> "17" [dir=forward tooltip="include"] "35" -> "7" [dir=forward tooltip="include"] "35" -> "10" [dir=forward tooltip="include"] "35" -> "3" [dir=forward tooltip="include"] "8" -> "9" [dir=forward tooltip="include"] "8" -> "7" [dir=forward tooltip="include"] "8" -> "10" [dir=forward tooltip="include"] "8" -> "11" [dir=forward tooltip="include"] "8" -> "5" [dir=forward tooltip="include"] "29" -> "10" [dir=forward tooltip="include"] "29" -> "3" [dir=forward tooltip="include"] }

This graph shows which files directly or indirectly include jit_stream_flash.h:

digraph { graph [bgcolor="#00000000"] node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2] edge [color="#1414CE"] "2" [label="/__w/AtomVM/AtomVM/src/libAtomVM/jit_stream_flash.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/jit_stream_flash.c"] "1" [label="/__w/AtomVM/AtomVM/src/libAtomVM/jit_stream_flash.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/jit_stream_flash.h" fillcolor="#BFBFBF"] "1" -> "2" [dir=back tooltip="include"] }

JIT code caching in flash memory - common implementation.

Functions

void jit_stream_flash_init(GlobalContext *global)

Initialize JIT stream flash subsystem.

Parameters:
  • global – Global context

const struct Nif *jit_stream_flash_get_nif(const char *nifname)

Get NIF for jit_stream_flash operations.

Parameters:
  • nifname – NIF name

Returns:

NIF pointer or NULL

ModuleNativeEntryPoint jit_stream_flash_entry_point(Context *ctx, term jit_stream)

Get entry point from jit_stream_flash. Called by jit_stream_entry_point

Parameters:
  • ctxContext

  • jit_stream – JIT stream term

Returns:

Entry point or NULL

void globalcontext_set_cache_native_code(GlobalContext *global, Module *mod, uint16_t version, ModuleNativeEntryPoint entry_point, uint32_t labels)

Finalize flash operation by marking an entry point as valid for a given module. This is called by sys_set_cache_native_code.

Parameters:
  • global – Global context

  • modModule

  • versionModule version

  • entry_point – Entry point

  • labels – Number of labels

struct JSFlashPlatformContext *jit_stream_flash_platform_init(void)

Initialize platform flash context.

Returns:

Platform flash context, or NULL on error

void jit_stream_flash_platform_destroy(struct JSFlashPlatformContext *pf_ctx)

Destroy platform flash context.

Parameters:
  • pf_ctx – Platform flash context to destroy

bool jit_stream_flash_platform_erase_sector(struct JSFlashPlatformContext *pf_ctx, uintptr_t addr)

Erase a flash sector at the given address.

Parameters:
  • pf_ctx – Platform flash context

  • addr – Virtual address of the sector to erase (must be sector-aligned)

Returns:

true on success, false on error

bool jit_stream_flash_platform_write_page(struct JSFlashPlatformContext *pf_ctx, uintptr_t addr, const uint8_t *data)

Write a page to flash.

Parameters:
  • pf_ctx – Platform flash context

  • addr – Virtual address to write to (must be page-aligned)

  • data – Data to write (must be FLASH_PAGE_SIZE bytes)

Returns:

true on success, false on error

uintptr_t jit_stream_flash_platform_ptr_to_executable(uintptr_t addr)

Convert data bus address to instruction bus address.

Parameters:
  • addr – Data bus address

Returns:

Instruction bus address (executable pointer)

uintptr_t jit_stream_flash_platform_executable_to_ptr(uintptr_t addr)

Convert instruction bus address to data bus address.

Parameters:
  • addr – Instruction bus address (executable pointer)

Returns:

Data bus address