ChangeLog:

- big commit.
This commit is contained in:
2026-06-10 10:35:48 +03:00
parent f87b52bb7f
commit 858e5755ad
20 changed files with 411 additions and 1347 deletions
+28 -4
View File
@@ -47,23 +47,47 @@
* n : 1..255
* ret : blk_id (1..255) on success; 0 on failure with errno set.
* The id is opaque — pass it to mem_get_page() and mem_free_block(). */
uint8_t mem_alloc_pages(uint8_t n);
uint8_t mem_alloc_pages_estex(uint8_t n);
uint8_t mem_alloc_pages_bios(uint8_t n);
/* Release a block previously returned by mem_alloc_pages().
* On error errno is set (e.g. EINVAL for unknown id). Double-free is
* NOT idempotent: the second call sets errno. */
void mem_free_block(uint8_t blk_id);
void mem_free_block_estex(uint8_t blk_id);
void mem_free_block_bios(uint8_t blk_id);
/* Translate (block, page-index) into a physical page number suitable
* for sprinter_page_w1/w2/w3() or the bank_*() helpers below.
* blk_id: from mem_alloc_pages()
* idx : 0..(n-1)
* ret : physical page (1..255) on success; 0 on failure (errno set). */
uint8_t mem_get_page(uint8_t blk_id, uint8_t idx);
uint8_t mem_get_page_bios(uint8_t blk_id, uint8_t idx);
/* Query the EMM allocator state. Both pointers must be non-NULL.
* Cannot fail (no error path). */
void mem_info(uint16_t *total, uint16_t *free_pages);
void mem_info_estex(uint16_t *total, uint16_t *free_pages);
void mem_info_bios(uint16_t *total, uint16_t *free_pages);
#define MEM_MANAGE_MODE_BIOS
#ifdef MEM_MANAGE_MODE_ESTEX
#define mem_alloc_pages mem_alloc_pages_estex
#define mem_free_block mem_free_block_estex
#define mem_info mem_info_estex
#define mem_get_page mem_get_page_bios
#elif defined MEM_MANAGE_MODE_BIOS
#define mem_alloc_pages mem_alloc_pages_bios
#define mem_free_block mem_free_block_bios
#define mem_info mem_info_bios
#define mem_get_page mem_get_page_bios
#endif
/* ===================================================================
* Far-page accessors via window 3 (base 0xC000, port 0xE2)