Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Use a pointer instead of u32 for initial_stack_pointer #87

Open
ikskuh opened this issue Feb 9, 2023 · 0 comments
Open

Use a pointer instead of u32 for initial_stack_pointer #87

ikskuh opened this issue Feb 9, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@ikskuh
Copy link

ikskuh commented Feb 9, 2023

See this code:

extern var __microzig_end_of_stack: anyopaque;

const Table = extern struct {
    initial_stack_pointer: *anyopaque,
    reset: *const fn() callconv(.C) void,
    nmi: *const fn() callconv(.C) void,
};

export const vector_table: Table = .{
    .initial_stack_pointer = &__microzig_end_of_stack,
    .reset = _reset,
    .nmi = _nmi,
};

fn _reset() callconv(.C) void { }
fn _nmi() callconv(.C) void { }

which will then generate

example._nmi:
        ret

vector_table:
        .quad   __microzig_end_of_stack
        .quad   example._nmi
        .quad   example._nmi

as the generated assembly. this will allow us to fully configure the stack size and location from the linker script and don't require any weird shenanigans with address offsetting

@ikskuh ikskuh added the enhancement New feature or request label Feb 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant