Skip to content

Commit

Permalink
OS/2 personality enhancements: Move l4_alloc_mem to a platform-indepe…
Browse files Browse the repository at this point in the history
…ndent code and rename it to allocmem.
  • Loading branch information
valerius2k committed Feb 19, 2019
1 parent e14302b commit 4aba073
Show file tree
Hide file tree
Showing 11 changed files with 170 additions and 486 deletions.
20 changes: 20 additions & 0 deletions include/os3/allocmem.h
@@ -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__ */
20 changes: 0 additions & 20 deletions include/os3/l4_alloc_mem.h

This file was deleted.

8 changes: 8 additions & 0 deletions include/os3/rm.h
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions platform/genode/lib/mk/lx.mk
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions platform/genode/src/lib/compat/rm.cc
Expand Up @@ -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,
Expand Down
64 changes: 0 additions & 64 deletions platform/genode/src/lib/ixf/lx/l4alloc_mem.cc

This file was deleted.

46 changes: 46 additions & 0 deletions platform/l4env/src/lib/compat/rm.c
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion platform/l4env/src/server/ixf/lx/Makefile
Expand Up @@ -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
Expand Down

0 comments on commit 4aba073

Please sign in to comment.