mirror of https://github.com/flysand7/ciabatta.git
Get windows build working
This commit is contained in:
parent
8c0590e517
commit
2954ad3b63
2
build.py
2
build.py
|
@ -261,4 +261,4 @@ if args.test:
|
||||||
if target == 'linux':
|
if target == 'linux':
|
||||||
compile([args.test, cia_lib, crt_lib], 'a', '-pie')
|
compile([args.test, cia_lib, crt_lib], 'a', '-pie')
|
||||||
elif target == 'windows':
|
elif target == 'windows':
|
||||||
compile([args.test, cia_lib, crt_lib], 'a', '-lkernel32.lib')
|
compile([args.test, cia_lib, crt_lib], 'a.exe', '-lkernel32.lib')
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
|
|
||||||
static void *_pool_buffer_freelist_add(Cia_Pool *pool, u8 *buffer) {
|
static void _pool_buffer_freelist_add(Cia_Pool *pool, u8 *buffer) {
|
||||||
Cia_Pool_Buffer_Header *header = (Cia_Pool_Buffer_Header *)buffer;
|
Cia_Pool_Buffer_Header *header = (Cia_Pool_Buffer_Header *)buffer;
|
||||||
u64 header_size = sizeof(Cia_Pool_Buffer_Header);
|
u64 header_size = sizeof(Cia_Pool_Buffer_Header);
|
||||||
u64 header_size_aligned = cia_size_alignf(header_size, pool->alignment);
|
u64 header_size_aligned = cia_size_alignf(header_size, pool->alignment);
|
||||||
u8 *buckets = buffer + header_size_aligned;
|
u8 *buckets = buffer + header_size_aligned;
|
||||||
u64 remaining_size = pool->buffer_size - header_size_aligned;
|
u64 remaining_size = pool->buffer_size - header_size_aligned;
|
||||||
u64 buckets_count = remaining_size / pool->bucket_size;
|
u64 buckets_count = remaining_size / pool->bucket_size;
|
||||||
header->free_buckets_count = buckets_count;
|
|
||||||
u64 buckets_size = buckets_count * pool->bucket_size;
|
u64 buckets_size = buckets_count * pool->bucket_size;
|
||||||
// Initialize every bucket as free
|
// Initialize every bucket as free
|
||||||
u64 bucket_offset = header_size_aligned + buckets_size;
|
u64 bucket_offset = header_size_aligned + buckets_size;
|
||||||
|
|
|
@ -8,9 +8,9 @@ static Cia_Pool _file_pool;
|
||||||
|
|
||||||
static void _fileapi_init() {
|
static void _fileapi_init() {
|
||||||
cia_pool_create(&_file_pool, cia_allocator_pages(), 0x1000, sizeof(FILE), 16);
|
cia_pool_create(&_file_pool, cia_allocator_pages(), 0x1000, sizeof(FILE), 16);
|
||||||
FILE *stdin = cia_pool_alloc(&_file_pool);
|
stdin = cia_pool_alloc(&_file_pool);
|
||||||
FILE *stdout = cia_pool_alloc(&_file_pool);
|
stdout = cia_pool_alloc(&_file_pool);
|
||||||
FILE *stderr = cia_pool_alloc(&_file_pool);
|
stderr = cia_pool_alloc(&_file_pool);
|
||||||
_rt_file_std_handles_init();
|
_rt_file_std_handles_init();
|
||||||
stdin->rt_file = _rt_file_stdin;
|
stdin->rt_file = _rt_file_stdin;
|
||||||
stdout->rt_file = _rt_file_stdout;
|
stdout->rt_file = _rt_file_stdout;
|
||||||
|
|
|
@ -83,7 +83,7 @@ static _RT_Status _rt_mem_alloc(void *optional_desired_addr, u64 min_size, void
|
||||||
return _RT_STATUS_OK;
|
return _RT_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static _RT_Status _rt_mem_free(void *addr) {
|
static _RT_Status _rt_mem_free(void *addr, u64 size) {
|
||||||
BOOL ok = VirtualFree(addr, 0, MEM_RELEASE);
|
BOOL ok = VirtualFree(addr, 0, MEM_RELEASE);
|
||||||
if(!ok) {
|
if(!ok) {
|
||||||
return _RT_ERROR_GENERIC;
|
return _RT_ERROR_GENERIC;
|
||||||
|
|
Loading…
Reference in New Issue