#include "patch.h"
#include "loader_mbi.h"
#include "startup.h"
+#include "koptions.h"
#if defined (ARCH_x86) || defined(ARCH_amd64)
#include "ARCH-x86/serial.h"
#endif
static l4util_mb_vbe_ctrl_t __mb_ctrl;
#endif
-l4_kip_kernel_uart_info kip_kernel_uart_info;
+static L4_kernel_options::Uart kuart;
+static unsigned int kuart_flags;
/*
* IMAGE_MODE means that all boot modules are linked together to one
return k;
}
+static
+L4_kernel_options::Options *find_kopts(void *kip)
+{
+ unsigned long a = (unsigned long)kip + sizeof(l4_kernel_info_t);
+
+ // kernel-option directly follow the KIP page
+ a = (a + 4096 - 1) & ~0xfff;
+
+ L4_kernel_options::Options *ko = (L4_kernel_options::Options *)a;
+
+ if (ko->magic != L4_kernel_options::Magic)
+ panic("Could not find kernel options page");
+
+ return ko;
+}
+
const char *get_cmdline(l4util_mb_info_t *mbi)
{
if (mbi && mbi->flags & L4UTIL_MB_CMDLINE)
#if defined(ARCH_x86) || defined(ARCH_amd64)
const char *s;
int comport = -1;
+ int comirq = -1;
int pci = 0;
+ if ((s = check_arg(mbi, "-comirq")))
+ {
+ s += 8;
+ comirq = strtoul(s, 0, 0);
+ }
+
if ((s = check_arg(mbi, "-comport")))
{
- char const *a = s + 9;
- if (!strncmp(a, "pci:", 4))
- {
- pci = 1;
- a = a + 4;
- }
-
- comport = strtoul(a, 0, 0);
+ s += 9;
+ if ((pci = !strncmp(s, "pci:", 4)))
+ s += 4;
+
+ comport = strtoul(s, 0, 0);
}
- if (check_arg(mbi, "-serial"))
+ if (!check_arg(mbi, "-noserial"))
{
if (pci)
{
if (comport == -1)
comport = 1;
- com_cons_init(comport);
+ com_cons_init(comport, comirq, &kuart, &kuart_flags);
}
#else
(void)mbi;
#endif
-
}
#ifdef ARCH_arm
fill_mem(fill_value);
}
+ L4_kernel_options::Options *lko = find_kopts(l4i);
+ kcmdline_parse(L4_CONST_CHAR_PTR(mb_mod[kernel_module].cmdline), lko);
+ lko->uart = kuart;
+ lko->flags |= kuart_flags;
+
+
/* setup the L4 kernel info page before booting the L4 microkernel:
* patch ourselves into the booter task addresses */
unsigned long api_version = get_api_version(l4i);
case 0x03: // Version X.0 and X.1
case 0x87: // Fiasco
init_kip_v2(l4i, &boot_info, mb_info, &ram, ®ions);
- //init_kip_kuart_info(l4i, &kip_kernel_uart_info);
break;
case 0x84:
case 0x04: