Skip to content
Permalink
Browse files

OS/2 personality enhancements: Move l4_alloc_mem to a platform-indepe…

…ndent code and rename it to allocmem.
  • Loading branch information...
valerius2k committed Feb 19, 2019
1 parent e14302b commit 4aba073d545e6e89b43514894ae17e744d02d982
@@ -0,0 +1,20 @@
#ifndef __ALLOCMEM_H__
#define __ALLOCMEM_H__

#ifdef __cplusplus
extern "C" {
#endif

/* osFree internal */
#include <os3/dataspace.h>

void *allocmem(unsigned long long area, int base, int size, int flags,
unsigned long PIC, l4_os3_dataspace_t *ds);

int translate_os2_flags(int flags);

#ifdef __cplusplus
}
#endif

#endif /* __ALLOCMEM_H__ */

This file was deleted.

@@ -64,6 +64,14 @@ long RegAttachToRegion(void **start,
unsigned long offset,
unsigned char align);

long RegAreaAttach(void **addr,
unsigned long size,
unsigned long long area,
unsigned long flags,
l4_os3_dataspace_t ds,
unsigned long offset,
unsigned char align);

long RegAreaAttachToRegion(void *start,
unsigned long size,
unsigned long long area,
@@ -2,8 +2,8 @@ include $(REP_DIR)/mk/osfree.mk

CC_CXX_WARN_STRICT =
SHARED_LIB = yes
SRC_C = debug.c fixup.c load.c loadobj.c lx.c mod.c
SRC_CC = l4alloc_mem.cc
SRC_C = debug.c fixup.c load.c \
loadobj.c lx.c mod.c allocmem.c
LIBS = base libc compat

vpath %.cc $(REP_DIR)/src/lib/ixf/lx
@@ -263,6 +263,18 @@ long RegAreaReserve(unsigned long size,
return RegAreaReserveInArea(size, flags, addr, area);
}

extern "C"
long RegAreaAttach(void **addr,
unsigned long size,
unsigned long long area,
unsigned long flags,
l4_os3_dataspace_t ds,
unsigned long offset,
unsigned char align)
{
return 0;
}

extern "C"
long RegAreaAttachToRegion(void *start,
unsigned long size,

This file was deleted.

@@ -190,6 +190,52 @@ long RegAreaReserve(unsigned long size,
return RegAreaReserveInArea(size, flags, addr, area);
}

long RegAreaAttach(void **addr,
unsigned long size,
unsigned long long area,
unsigned long flags,
l4_os3_dataspace_t ds,
unsigned long offset,
unsigned char align)
{
ULONG rights = 0;
int rc = NO_ERROR;

if (flags & DATASPACE_READ)
rights |= L4DM_READ;
if (flags & DATASPACE_WRITE)
rights |= L4DM_WRITE;

rc = l4rm_area_attach(&ds.ds, (unsigned long)area, size, offset, rights, addr);

if (rc < 0)
{
switch (-rc)
{
case L4_EINVAL:
rc = ERROR_INVALID_DATASPACE;
break;

case L4_EUSED:
rc = ERROR_ALREADY_USED;
break;

case L4_ENOMEM:
rc = ERROR_NOT_ENOUGH_MEMORY;
break;

case L4_ENOMAP:
rc = ERROR_NO_MAPPING;
break;

case L4_EIPC:
rc = ERROR_IPC;
}
}

return rc;
}

long RegAreaAttachToRegion(void *start,
unsigned long size,
unsigned long long area,
@@ -7,7 +7,8 @@ TARGET = liblx.s.so
TRG = lx.ixf
MODE = l4env
SYSTEMS = x86-l4v2
SRC_C = lx.c mod.c load.c loadobj.c fixup.c debug.c l4alloc_mem.c
SRC_C = lx.c mod.c load.c loadobj.c \
fixup.c debug.c allocmem.c
CFLAGS += -I$(PKGDIR)/include

NO_DEFAULT_RELOC= 1

0 comments on commit 4aba073

Please sign in to comment.
You can’t perform that action at this time.