mirror of
https://github.com/Interlisp/maiko.git
synced 2026-01-18 17:07:24 +00:00
Update memory allocator function (#434)
* Missing include unistd.h for getpagesize() * Update from valloc() to posix_memalign() for large aligned allocations
This commit is contained in:
parent
a15de4df10
commit
c3f79872f1
@ -172,8 +172,7 @@ int sysout_loader(const char *sysout_file_name, int sys_size) {
|
||||
|
||||
/* allocate Virtual Memory Space */
|
||||
|
||||
lispworld_scratch = valloc(sys_size * MBYTE);
|
||||
if (lispworld_scratch == NULL) {
|
||||
if (posix_memalign((void *)&lispworld_scratch, getpagesize(), sys_size * MBYTE) != 0) {
|
||||
fprintf(stderr, "sysout_loader: can't allocate Lisp %dMBytes VM \n", sys_size);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/file.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "lispemul.h"
|
||||
#include "lispmap.h"
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
#include <stdio.h>
|
||||
#include <sys/mman.h>
|
||||
#include <pixrect/pixrect_hs.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "lispemul.h"
|
||||
#include "lsptypes.h"
|
||||
@ -309,7 +310,6 @@ void truecolor_before_exit() {
|
||||
|
||||
} /* truecolor_before_exit */
|
||||
|
||||
char *valloc();
|
||||
char *HideOverlayRegion;
|
||||
#ifdef VIDEO
|
||||
char *HideVideoEnableRegion;
|
||||
@ -323,8 +323,8 @@ void truecolor_before_raid() {
|
||||
if (Inited_TrueColor) {
|
||||
size = ((displaywidth * displayheight / 8 + (getpagesize() - 1)) & -getpagesize());
|
||||
|
||||
if ((HideOverlayRegion = valloc(size)) == 0) {
|
||||
printf("can't valloc hide space\n");
|
||||
if (posix_memalign((void *)&HideOverlayRegion, getpagesize(), size) != 0) {
|
||||
printf("can't allocate hide space\n");
|
||||
return (-1);
|
||||
} /* end if( HideOverlayRegion ) */
|
||||
|
||||
@ -343,8 +343,8 @@ void truecolor_before_raid() {
|
||||
#ifdef VIDEO
|
||||
if (Inited_Video) {
|
||||
if ((video_onoff = Video_OnOff_Flg)) Video_OnOff(FALSE);
|
||||
if ((HideVideoEnableRegion = valloc(size)) == 0) {
|
||||
printf("can't valloc hide space\n");
|
||||
if (posix_memalign((void *)&HideVideoEnableRegion, getpagesize(), size) != 0) {
|
||||
printf("can't allocate hide space\n");
|
||||
return (-1);
|
||||
} /* end if( HideVideoEnableRegion ) */
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user