libk  Check-in [f37ee769c9]

Overview
Comment:add tests for linear allocators, fix dumb bug in kmheapf() that caused it to return an error on success
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: f37ee769c91b088425abf2df679370c4c9d82a0d738c1f4d37902a2c65b82bd8
User & Date: lexi on 2019-08-22 08:52:25
Other Links: manifest | tags
Context
2019-08-22
20:04
fix typo check-in: 957b5fa848 user: lexi tags: trunk
08:52
add tests for linear allocators, fix dumb bug in kmheapf() that caused it to return an error on success check-in: f37ee769c9 user: lexi tags: trunk
08:45
check in missing files check-in: 269baab90a user: lexi tags: trunk
Changes

Modified mod/kcore/testbin.exe.c from [2c9c964882] to [175e42b805].

    26     26   	if (alloc.cond != kmcond_ok) return kbad_mem;
    27     27   	
    28     28   	void* region = alloc.raw;
    29     29   	kmzero(region,2048);
    30     30   
    31     31   	if (kmheapf(region) >= kmcond_fail) return kbad_mem;
    32     32   
           33  +	void* top = kmlini();
           34  +	kmres rst = kmlina(1230);
           35  +	if(rst.cond != kmcond_ok) return kbad_mem;
           36  +
           37  +	kmres rst2 = kmlina(789);
           38  +	if(rst2.cond != kmcond_ok) return kbad_mem;
           39  +
    33     40   	return kbad_ok;
    34     41   }

Modified mod/kmem/heapf.fn.c from [fd2ee0e61b] to [868113c60d].

    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     36   		k_platform_syscall_arg args[] = { (sz)header, total };
    37     37   		struct k_platform_syscall_answer r = k_platform_syscall
    38     38   			(k_platform_syscall_munmap, Kmsz(args), args);
    39     39   
    40         -		if(r.error==0) {
           40  +		if(r.error!=0) {
    41     41   			/* we don't need to bother recovering the error
    42     42   			 * code, there's only one possible munmap error */
    43     43   			return kmcond_bad_address;
    44     44   		}
    45     45   
    46     46   #	else
    47     47   		Knoimpl(kmheapf,KVos);
    48     48   #		error missing implementation
    49     49   #	endif
    50     50   	return kmcond_ok;
    51     51   }