Skip to content

Can we remove the need for the linker script to declare '__sel4_ipc_buffer_obj'? #451

@midnightveil

Description

@midnightveil

Brought up related to #450, but we don't see any need for the linker script of the various targets to declare an IPC buffer. We believe we should be able to do exactly what we do for the stack: that is, allocate them at an arbitrary virtual address in the tool and use setvar.

microkit tool finding ipc buffer
        let ipcbuf_frame_obj_id = capdl_util_make_frame_obj(
            self,
            Fill {
                entries: [].to_vec(),
            },
            &format!("ipcbuf_{pd_name}"),
            None,
            PageSize::Small.fixed_size_bits(sel4_config) as u8,
        );
        let ipcbuf_frame_cap =
            capdl_util_make_frame_cap(ipcbuf_frame_obj_id, true, true, false, true);
        // We need to clone the IPC buf cap because in addition to mapping the frame into the VSpace, we need to bind
        // this frame to the TCB as well.
        let ipcbuf_frame_cap_for_tcb = ipcbuf_frame_cap.clone();
        let ipcbuf_vaddr = elf
            .find_symbol(SYMBOL_IPC_BUFFER)
            .unwrap_or_else(|_| panic!("Could not find {SYMBOL_IPC_BUFFER}"))
            .0;
        match map_page(
            self,
            sel4_config,
            pd_name,
            vspace_obj_id,
            ipcbuf_frame_cap,
            PageSize::Small as u64,
            ipcbuf_vaddr,
        ) {
            Ok(_) => {}
            Err(map_err_reason) => {
                return Err(format!(
                    "build_capdl_spec(): failed to map ipc buffer frame to {pd_name} because: {map_err_reason}"
                ))
            }
        };

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions