libk  Diff

Differences From Artifact [3d67513f54]:

To Artifact [fd2ee0e61b]:


    29     29   
    30     30   	if (header -> kind != kmkind_heap) return kmcond_mismatch;
    31     31   #	ifdef KFenv_posix
    32     32   		/* currently allocation is handled on posix by naive use
    33     33   		 * of MAP_ANONYMOUS. munmap needs to be told the size of
    34     34   		 * the region to unmap (free), which kmheapa() stores at
    35     35   		 * (ptr - sizeof sz). see kmheap.c for details. */
           36  +		k_platform_syscall_arg args[] = { (sz)header, total };
           37  +		struct k_platform_syscall_answer r = k_platform_syscall
           38  +			(k_platform_syscall_munmap, Kmsz(args), args);
    36     39   
    37         -		if(kmem_platform_munmap(header, total) == -1) {
    38         -			/* we don't need to bother recovering errno;
    39         -			 * there's only one possible munmap error */
           40  +		if(r.error==0) {
           41  +			/* we don't need to bother recovering the error
           42  +			 * code, there's only one possible munmap error */
    40     43   			return kmcond_bad_address;
    41     44   		}
    42     45   
    43     46   #	else
    44     47   		Knoimpl(kmheapf,KVos);
    45     48   #		error missing implementation
    46     49   #	endif
    47     50   	return kmcond_ok;
    48     51   }