mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-22 20:41:20 +00:00
[util] Implement Sys_Free for windows
And get the tests so they can (sort of) be run.
This commit is contained in:
parent
0a847f92f1
commit
1078bd9efa
4 changed files with 12 additions and 6 deletions
|
@ -121,7 +121,7 @@ void Sys_Init_Cvars (void);
|
|||
//
|
||||
void Sys_MakeCodeWriteable (uintptr_t startaddr, size_t length);
|
||||
void Sys_PageIn (void *ptr, size_t size);
|
||||
long Sys_PageSize (void);
|
||||
size_t Sys_PageSize (void);
|
||||
void *Sys_Alloc (size_t size);
|
||||
void Sys_Free (void *mem, size_t size);
|
||||
|
||||
|
|
|
@ -618,7 +618,7 @@ Sys_PageIn (void *ptr, size_t size)
|
|||
//#endif
|
||||
}
|
||||
|
||||
VISIBLE long
|
||||
VISIBLE size_t
|
||||
Sys_PageSize (void)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
|
@ -657,7 +657,7 @@ Sys_Free (void *mem, size_t size)
|
|||
size_t page_mask = page_size - 1;
|
||||
size = (size + page_mask) & ~page_mask;
|
||||
#ifdef _WIN32
|
||||
# error implement Sys_Free for windows
|
||||
VirtualFree (mem, 0, MEM_RELEASE | MEM_DECOMMIT);
|
||||
#else
|
||||
munmap (mem, size);
|
||||
#endif
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
@ -5,6 +8,7 @@
|
|||
|
||||
#include "QF/cmem.h"
|
||||
#include "QF/set.h"
|
||||
#include "QF/sys.h"
|
||||
|
||||
#define SUPER_LINES (sizeof (memsuper_t) / MEM_LINE_SIZE)
|
||||
|
||||
|
@ -564,9 +568,9 @@ main (void)
|
|||
fprintf (stderr, "super block not cache aligned: %p\n", super);
|
||||
return 1;
|
||||
}
|
||||
if (super->page_size != (size_t) sysconf (_SC_PAGESIZE)) {
|
||||
if (super->page_size != Sys_PageSize ()) {
|
||||
fprintf (stderr, "page size not equal to system page size: %zd, %zd\n",
|
||||
super->page_size, (size_t) sysconf (_SC_PAGESIZE));
|
||||
super->page_size, Sys_PageSize ());
|
||||
return 1;
|
||||
}
|
||||
if (!super->page_size || (super->page_size & (super->page_size - 1))) {
|
||||
|
|
|
@ -18,9 +18,11 @@ struct {
|
|||
{0x0001, 5.9604644775390625e-08f},
|
||||
{0x0000, 0.0f},
|
||||
{0x8000, -0.0f},
|
||||
#if __GNUC_PREREQ(3,3)
|
||||
#if defined(__GNUC_PREREQ)
|
||||
# if __GNUC_PREREQ(3,3)
|
||||
{0x7c00, __builtin_huge_val ()},
|
||||
{0xfc00, -__builtin_huge_val ()},
|
||||
# endif
|
||||
#endif
|
||||
{0x3555, 0.333251953125f},
|
||||
{0x3e00, 1.5f},
|
||||
|
|
Loading…
Reference in a new issue