# HG changeset patch # User Paul Boddie # Date 1709847700 -3600 # Node ID ff536e5b5cf66acdba11d14dc38e5d5f754a6c44 # Parent fa9f8e29a2dac5f919dea1819355db9cc1207325 Introduced distinct region mapper flags and offset types. diff -r fa9f8e29a2da -r ff536e5b5cf6 libexec/include/exec/external_pager.h --- a/libexec/include/exec/external_pager.h Tue Mar 05 00:18:00 2024 +0100 +++ b/libexec/include/exec/external_pager.h Thu Mar 07 22:41:40 2024 +0100 @@ -1,7 +1,7 @@ /* * A system pager implementation residing in a separate task. * - * Copyright (C) 2022, 2023 Paul Boddie + * Copyright (C) 2022, 2023, 2024 Paul Boddie * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -103,8 +103,8 @@ /* Region manager/mapper methods. */ - virtual long attach(address_t *start, address_t size, map_flags_t flags, - l4_cap_idx_t ds, address_t offset, unsigned char align); + virtual long attach(address_t *start, address_t size, rm_flags_t flags, + l4_cap_idx_t ds, rm_offset_t offset, unsigned char align); /* Parent methods. */ diff -r fa9f8e29a2da -r ff536e5b5cf6 libexec/include/exec/internal_pager.h --- a/libexec/include/exec/internal_pager.h Tue Mar 05 00:18:00 2024 +0100 +++ b/libexec/include/exec/internal_pager.h Thu Mar 07 22:41:40 2024 +0100 @@ -1,7 +1,7 @@ /* * A system pager implementation residing in the same task as a program. * - * Copyright (C) 2022, 2023 Paul Boddie + * Copyright (C) 2022, 2023, 2024 Paul Boddie * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -56,13 +56,13 @@ /* Region manager/mapper methods. */ - virtual long attach(address_t *start, address_t size, map_flags_t flags, - l4_cap_idx_t ds, address_t offset, unsigned char align); + virtual long attach(address_t *start, address_t size, rm_flags_t flags, + l4_cap_idx_t ds, rm_offset_t offset, unsigned char align); - virtual long detach(address_t addr, address_t size, map_flags_t flags, + virtual long detach(address_t addr, address_t size, rm_flags_t flags, address_t *start, address_t *rsize, l4_cap_idx_t *ds); - virtual long reserve_area(address_t *start, address_t size, map_flags_t flags, + virtual long reserve_area(address_t *start, address_t size, rm_flags_t flags, unsigned char align); }; diff -r fa9f8e29a2da -r ff536e5b5cf6 libexec/lib/src/external_pager.cc --- a/libexec/lib/src/external_pager.cc Tue Mar 05 00:18:00 2024 +0100 +++ b/libexec/lib/src/external_pager.cc Thu Mar 07 22:41:40 2024 +0100 @@ -232,8 +232,8 @@ the initialisation of a program by the C library which requires a region mapper. */ -long ExternalPager::attach(address_t *start, address_t size, map_flags_t flags, - l4_cap_idx_t ds, address_t offset, +long ExternalPager::attach(address_t *start, address_t size, rm_flags_t flags, + l4_cap_idx_t ds, rm_offset_t offset, unsigned char align) { // NOTE: Determine the purpose of offset. diff -r fa9f8e29a2da -r ff536e5b5cf6 libexec/lib/src/internal_pager.cc --- a/libexec/lib/src/internal_pager.cc Tue Mar 05 00:18:00 2024 +0100 +++ b/libexec/lib/src/internal_pager.cc Thu Mar 07 22:41:40 2024 +0100 @@ -1,7 +1,7 @@ /* * A system pager implementation residing in the same task as a program. * - * Copyright (C) 2022, 2023 Paul Boddie + * Copyright (C) 2022, 2023, 2024 Paul Boddie * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -137,8 +137,8 @@ the initialisation of a program by the C library which requires a region mapper. */ -long InternalPager::attach(address_t *start, address_t size, map_flags_t flags, - l4_cap_idx_t ds, address_t offset, +long InternalPager::attach(address_t *start, address_t size, rm_flags_t flags, + l4_cap_idx_t ds, rm_offset_t offset, unsigned char align) { /* NOTE: The offset apparently indicates the offset within the dataspace of @@ -160,7 +160,7 @@ return err; } -long InternalPager::detach(address_t addr, address_t size, map_flags_t flags, +long InternalPager::detach(address_t addr, address_t size, rm_flags_t flags, address_t *start, address_t *rsize, l4_cap_idx_t *ds) { (void) size; (void) flags; @@ -183,7 +183,7 @@ } long InternalPager::reserve_area(address_t *start, address_t size, - map_flags_t flags, unsigned char align) + rm_flags_t flags, unsigned char align) { MemoryArea *area; long err = ExecPager::find(start, &size, flags, align, &area); diff -r fa9f8e29a2da -r ff536e5b5cf6 libsystypes/idl/region_mapper.idl --- a/libsystypes/idl/region_mapper.idl Tue Mar 05 00:18:00 2024 +0100 +++ b/libsystypes/idl/region_mapper.idl Thu Mar 07 22:41:40 2024 +0100 @@ -1,5 +1,5 @@ #include /* L4RE_PROTO_RM */ -#include /* address_t */ +#include /* address_t, rm_flags_t, rm_offset_t */ /* A region mapper/manager interface. See: pkg/l4re-core/l4re/util/include/region_mapping_svr_2 */ @@ -11,8 +11,8 @@ address to search for a suitable address for the region. */ [opcode(0)] void attach(inout address_t start, in address_t size, - in map_flags_t flags, in cap ds, - in address_t offset, in unsigned char align); + in rm_flags_t flags, in cap ds, + in rm_offset_t offset, in unsigned char align); /* Detach memory from the task, searching from the given address for a region of the given size. Return the start address, region size and dataspace. @@ -24,20 +24,20 @@ This is not obvious from the L4Re definitions and the IPC type system. */ [opcode(1)] void detach(in address_t addr, in address_t size, - in map_flags_t flags, out address_t start, + in rm_flags_t flags, out address_t start, out address_t rsize, out l4_cap_idx_t ds); /* Find a region starting from the given address and having the given size. Return the start address, region size and dataspace. */ [opcode(2)] void find(inout address_t addr, inout address_t size, - out map_flags_t flags, out address_t offset, + out rm_flags_t flags, out rm_offset_t offset, out cap ds); /* Reserve an area in the region map. */ [opcode(3)] void reserve_area(inout address_t start, in address_t size, - in map_flags_t flags, in unsigned char align); + in rm_flags_t flags, in unsigned char align); /* Free (or unreserve) an area in the region map. */ diff -r fa9f8e29a2da -r ff536e5b5cf6 libsystypes/include/systypes/base.h --- a/libsystypes/include/systypes/base.h Tue Mar 05 00:18:00 2024 +0100 +++ b/libsystypes/include/systypes/base.h Thu Mar 07 22:41:40 2024 +0100 @@ -1,7 +1,7 @@ /* * Base types used by various other types. * - * Copyright (C) 2019, 2021, 2022, 2023 Paul Boddie + * Copyright (C) 2019, 2021, 2022, 2023, 2024 Paul Boddie * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -34,6 +34,12 @@ typedef l4_uint64_t offset_t; typedef l4_addr_t address_t; /* unsigned long */ +/* Region mapper types. + See: pkg/l4re-core/l4re_c/include/rm.h */ + +typedef l4_uint32_t rm_flags_t; +typedef l4_uint64_t rm_offset_t; + /* Dataspace mapping flags. See: pkg/l4re-core/l4re_c/include/dataspace.h */