Skip to content
Permalink
Browse files

Additional fixes to build for Genode target successfully.

  • Loading branch information
valerius2k committed Jul 27, 2020
1 parent 842b117 commit 328f3547d1dffa00c45371c445fdcb0470eb1b98
@@ -71,6 +71,7 @@ run B 480
runserver B 480
segment_gdt_get_entry_offset T
segment_gdt_set T
segment_ldt_set T
set B 2400
skiplist D 8
strupr T
@@ -6,7 +6,7 @@ SRC_CC = main.cc kal/thread2.cc
SRC_C = initdone.c api/api.c kal/thread.c \
kal/util.c kal/start.c kal/kal.c kal/dl.c
# disable dead code elimination
LIBS = base libc compat os2srv os2fs os2exec
LIBS = base libc compat os2srv os2fs os2exec handle

ifeq ($(filter-out $(SPECS),x86_32),)
SRC_C += kal/arch/x86_32/tramp.c
@@ -4,6 +4,13 @@
#include <os3/thread.h>
#include <os3/segment.h>

extern "C" void
segment_ldt_set(void *desc, unsigned int size,
unsigned int entry_number_start,
l4_os3_thread_t tid)
{
}

extern "C" void
segment_gdt_set(void *desc, unsigned int size,
unsigned int entry_number_start,
@@ -1,14 +1,14 @@
--- kernel/fiasco/src/kern/shared/thread-ia32-amd64-o.cpp 2020-05-16 03:16:31.056641275 +0300
+++ kernel/fiasco/src/kern/shared/thread-ia32-amd64.cpp 2020-05-16 03:18:36.200644249 +0300
@@ -730,11 +730,12 @@
--- kernel/fiasco/src/kern/shared/thread-ia32-amd64-o.cpp 2020-06-28 02:55:21.896433829 +0300
+++ kernel/fiasco/src/kern/shared/thread-ia32-amd64.cpp 2020-06-28 02:59:57.594869313 +0300
@@ -730,12 +730,12 @@
// Allocate the memory if needed
// LDT maximum size is one page, anything else causes too much headache
if (!s->ldt_addr())
- s->ldt_addr(Mapped_allocator::allocator()->alloc(Config::PAGE_SHIFT));
+ s->ldt_addr(Mapped_allocator::allocator()->alloc(Config::PAGE_SHIFT + 4));

// size is hardcoded
- if (entry_number * Cpu::Ldt_entry_size + size > Config::PAGE_SIZE)
+ // size is hardcoded
+ if (entry_number * Cpu::Ldt_entry_size + size > Config::PAGE_SIZE * 16)
{
- WARN("set_ldt: LDT size exceeds one page, not supported.");
@@ -98,14 +98,14 @@ module $(B)/simple_file_server -v 14
# module $(B)/os2/cut.exe
# module $(B)/os2/putmsg.exe
# module $(B)/os2/ansi.exe
# module $(B)/os2/sed.exe
module $(B)/os2/sed.exe
module $(B)/os2/awk.exe
module $(B)/os2/makeini.exe
module $(B)/os2/vp.exe
# module $(B)/os2/fp.exe
# module $(B)/os2/fc.exe
# module $(B)/os2/more.exe
module $(B)/os2/file-open-test.exe
# module $(B)/os2/file-open-test.exe
module $(B)/os2/ver.exe
# module $(B)/os2/comp.exe
# module $(B)/os2/wasm.exe
@@ -27,7 +27,7 @@
#include <os3/fs.h>
#include <os3/app.h>

#include <l4/util/util.h>
//#include <l4/util/util.h>

/* libc includes*/
#include <unistd.h>
@@ -648,11 +648,14 @@ long attach_module (ULONG hmod, unsigned long long area)
flags |= DATASPACE_WRITE;
}

#ifdef __l4env__
if (! rc)
io_log("ds %u attached at %x, area %x, flags %x\n",
ds.ds.id, addr, area, flags);
//else if (rc != -L4_EUSED)
else if (rc != ERROR_ALREADY_USED)
else
#endif
if (rc != ERROR_ALREADY_USED)
{
io_log("attach_ds_area returned %d\n", rc);
break;
@@ -684,8 +687,10 @@ long attach_module (ULONG hmod, unsigned long long area)
i = (unsigned long)addr >> 16;

base = i << 16;
#ifdef __l4env__
io_log("ds %x @ %x, size %u\n", ds.ds.id, addr, size);
io_log("base=%x\n", base);
#endif

desc.limit_lo = (size - 1) & 0xffff; desc.limit_hi = (size - 1) >> 16;
desc.acc_lo = acc; desc.acc_hi = acc2;
@@ -714,8 +719,10 @@ long attach_module (ULONG hmod, unsigned long long area)
}
else
{
#ifdef __l4env__
io_log("WARNING: trying to attach dataspace %u where %u is attached\n",
ds.ds.id, area_ds.ds.id);
#endif
rc = NO_ERROR;
break;
}
@@ -2775,14 +2782,8 @@ KalGetTIDNative(l4_os3_thread_t id, TID *pthid)
//rc = os2server_dos_GetTIDNative_call(&os2srv, &id, pthid, &env);
//rc = CPClientGetTIDNative(&id, pthid);

io_log("$$$ id.thread.id.task=%u, id.thread.id.lthread=%u\n",
id.thread.id.task, id.thread.id.lthread);

for (i = 0; i < MAX_TID; i++)
{
io_log("$$$ ptid[%u].thread.id.task=%u, ptid[%u].thread.id.lthread=%u\n",
i, ptid[i].thread.id.task, i, ptid[i].thread.id.lthread);

if ( ThreadEqual(ptid[i], id) )
break;
}
@@ -83,7 +83,7 @@ trampoline(struct param *param)
io_log("stack top: %x\n", param->esp);

/* We have changed the stack so it now points to our LX image. */
enter_kdebug("debug");
//enter_kdebug("debug");
old_sel = tramp(argv, envp, hmod, tib_sel, param->eip);

STKOUT
@@ -244,9 +244,6 @@ APIRET CDECL KalStartApp(struct options *opts, char *pszLoadError, ULONG cbLoadE

ptid[0] = KalNativeID();

io_log("@@@ ptid[0].thread.id.task=%u, ptid[0].thread.id.lthread=%u\n",
ptid[0].thread.id.task, ptid[0].thread.id.lthread);

// initialize TIDs array
for (i = 1; i < MAX_TID; i++)
ptid[i] = INVALID_THREAD;
@@ -41,7 +41,7 @@ void *allocmem(unsigned long long area,
return NULL;
}

io_log("alloc dataspace %u, size %u at 0x%x\n", (*ds).ds.id, size, addr);
//io_log("alloc dataspace %u, size %u at 0x%x\n", (*ds).ds.id, size, addr);
return addr;

base = base;
@@ -66,7 +66,7 @@ extern void *_prog_img_start;
struct module_rec modulehandles[1024];

slist_t *next_slist (slist_t *s);
void getline (char **from, char *to);
void get_line (char **from, char *to);
int dl_get_funcs (int *numentries, IXFMODULEENTRY **entries);
int lcase(char* dest, const char* src);

@@ -221,7 +221,7 @@ next_slist (slist_t *s)
}

void
getline (char **from, char *to)
get_line (char **from, char *to)
{
char *p, *q = to;

@@ -254,7 +254,7 @@ dl_get_funcs (int *numentries, IXFMODULEENTRY **entries)

p = (char *)addr;

getline(&p, line);
get_line(&p, line);

n = atol(line);

@@ -264,7 +264,7 @@ dl_get_funcs (int *numentries, IXFMODULEENTRY **entries)

for (i = 0; i < n; i++)
{
getline(&p, line);
get_line(&p, line);
sscanf(line, "%llx %s", &funcaddr, s);
funcname = (char *)malloc(strlen(s) + 1);
if (!funcname) return 1;
@@ -1108,7 +1108,7 @@ unsigned long ModQueryProcAddr(unsigned long hmod,

if (ordinal > 0)
{ // Search by ordinal
int i;
//int i;
//io_log("ixfModule=%x\n", ixfModule);
//io_log("ordinal=%u\n", ordinal);
//io_log("ixfModule->Entries=%x\n", ixfModule->Entries);
@@ -1245,9 +1245,9 @@ void ModLinkModule (IXFModule *ixfModule, unsigned long *phmod)
io_log("src=%x, dst=%x\n",(ixfModule->Fixups[imports_counter].SrcAddress) , (ixfModule->Fixups[imports_counter].ImportEntry.Address));
}

relative_jmp = (ixfModule->Fixups[imports_counter].ImportEntry.Address) - (unsigned long)(ixfModule->Fixups[imports_counter].SrcAddress) - 4;
absolute_jmp = ixfModule->Fixups[imports_counter].ImportEntry.Address;
src_off = ixfModule->Fixups[imports_counter].SrcVmAddress;
relative_jmp = (int)((ixfModule->Fixups[imports_counter].ImportEntry.Address) - (unsigned long)(ixfModule->Fixups[imports_counter].SrcAddress) - 4);
absolute_jmp = (int)ixfModule->Fixups[imports_counter].ImportEntry.Address;
src_off = (unsigned long)ixfModule->Fixups[imports_counter].SrcVmAddress;

switch (ixfModule->Fixups[imports_counter].flags)
{

0 comments on commit 328f354

Please sign in to comment.