Index: head/sys/riscv/include/vmparam.h =================================================================== --- head/sys/riscv/include/vmparam.h +++ head/sys/riscv/include/vmparam.h @@ -223,10 +223,7 @@ #define VM_INITIAL_PAGEIN 16 #endif -/* - * RISCVTODO - * #define UMA_MD_SMALL_ALLOC - */ +#define UMA_MD_SMALL_ALLOC #ifndef LOCORE extern vm_paddr_t dmap_phys_base; Index: head/sys/riscv/riscv/uma_machdep.c =================================================================== --- head/sys/riscv/riscv/uma_machdep.c +++ head/sys/riscv/riscv/uma_machdep.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -44,13 +45,39 @@ uma_small_alloc(uma_zone_t zone, vm_size_t bytes, int domain, u_int8_t *flags, int wait) { + vm_page_t m; + vm_paddr_t pa; + void *va; - panic("uma_small_alloc"); + *flags = UMA_SLAB_PRIV; + m = vm_page_alloc_domain(NULL, 0, domain, + malloc2vm_flags(wait) | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED); + if (m == NULL) + return (NULL); + pa = m->phys_addr; +#if 0 + /* RISCVTODO: minidump */ + if ((wait & M_NODUMP) == 0) + dump_add_page(pa); +#endif + va = (void *)PHYS_TO_DMAP(pa); + if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0) + bzero(va, PAGE_SIZE); + return (va); } void uma_small_free(void *mem, vm_size_t size, u_int8_t flags) { + vm_page_t m; + vm_paddr_t pa; - panic("uma_small_free"); + pa = DMAP_TO_PHYS((vm_offset_t)mem); +#if 0 + /* RISCVTODO: minidump */ + dump_drop_page(pa); +#endif + m = PHYS_TO_VM_PAGE(pa); + vm_page_unwire_noq(m); + vm_page_free(m); }