#include <sys/exec.h>
#include <sys/module.h>
#include <core-elf.h>
+#include <dprintf.h>
#include "getkey.h"
#include "menu.h"
void clear_screen(void)
{
- //mp("enter");
+ //dprintf("enter");
fputs("\033e\033%@\033)0\033(B\1#0\033[?25l\033[2J", stdout);
}
clock_t tto, to;
int key;
- //mp("enter");
+ //dprintf("enter");
if (!totaltimeout)
return get_key(stdin, timeout);
totaltimeout -= t;
if (key != KEY_NONE) {
- //mp("get key 0x%x", key);
+ //dprintf("get key 0x%x", key);
return key;
}
if (timeout) {
if (timeout <= t) {
- //mp("timeout");
+ //dprintf("timeout");
return KEY_NONE;
}
list_add(&(comm->list), &cli_history_head);
}
- // mp("raw cmd = %s", cmd);
+ // dprintf("raw cmd = %s", cmd);
strcpy(temp_cmd, cmd);
module_name = strtok(cmd, COMMAND_DELIM);
len_mn = strlen(module_name);
if (!strcmp(module_name + len_mn - 4, ".c32")) {
if (module_find(module_name) != NULL) {
/* make module re-enterable */
- // mp("Module %s is already running");
+ // dprintf("Module %s is already running");
}
do {
argv[0] = module_name;
#include <syslinux/adv.h>
#include <syslinux/config.h>
#include <core-elf.h>
+#include <dprintf.h>
#include "menu.h"
#include "config.h"
struct menu *m = calloc(1, sizeof(struct menu));
int i;
- //mp("enter: menu_label = %s", label);
+ //dprintf("enter: menu_label = %s", label);
m->label = label;
m->title = refstr_get(empty_string);
{
struct menu_entry *me;
- //mp("enter, call from menu %s", m->label);
+ //dprintf("enter, call from menu %s", m->label);
if (m->nentries >= m->nentries_space) {
if (!m->nentries_space)
else
rsprintf(&me->cmdline, ".%s %s%s%s%s",
kernel_types[ld->type], ld->kernel, s, a, ipoptions);
- mp("type = %s, cmd = %s", kernel_types[ld->type], me->cmdline);
+ dprintf("type = %s, cmd = %s", kernel_types[ld->type], me->cmdline);
break;
case MA_GOTO_UNRES:
refstr_put(append);
append = a;
}
- //mp("we got a append: %s", a);
+ //dprintf("we got a append: %s", a);
} else if (looking_at(p, "initrd")) {
const char *a = refstrdup(skipspace(p + 6));
if (ld.label) {
refstr_put(ld.kernel);
ld.kernel = refstrdup(skipspace(ep));
ld.type = type;
- //mp("got a kernel: %s, type = %d", ld.kernel, ld.type);
+ //dprintf("got a kernel: %s, type = %d", ld.kernel, ld.type);
}
} else if (looking_at(p, "timeout")) {
m->timeout = (atoi(skipspace(p + 7)) * CLK_TCK + 9) / 10;
static void dump_menu(struct menu *menu)
{
- mp("will dump menu for %s:", menu->label);
+ dprintf("will dump menu for %s:", menu->label);
printf("entries num: %d\n", menu->nentries);
printf("defentry: %d, nam = %s\n",
menu->defentry, menu->menu_entries[menu->defentry]->label);
struct menu *m;
struct menu_entry *me;
char *cmdline;
- mp("enter");
+ dprintf("enter");
empty_string = refstrdup("");
parse_one_config("~");
} else {
while ((filename = *argv++)) {
- mp("Parsing config: %s", filename);
+ dprintf("Parsing config: %s", filename);
parse_one_config(filename);
}
}
/* Handle global default */
//if (has_ui && globaldefault) {
if (globaldefault) {
- mp("gloabldefault = %s", globaldefault);
+ dprintf("gloabldefault = %s", globaldefault);
me = find_label(globaldefault);
if (me && me->menu != hide_menu) {
me->menu->defentry = me->entry;
#include <syslinux/adv.h>
#include <sys/module.h>
#include <core-elf.h>
+#include <dprintf.h>
#include "menu.h"
#include "cli.h"
static void dump_menu(struct menu *menu)
{
- mp("will dump menu for %s:", menu->label);
+ dprintf("will dump menu for %s:", menu->label);
printf("entries num: %d\n", menu->nentries);
printf("defentry: %d, nam = %s\n",
menu->defentry, menu->menu_entries[menu->defentry]->label);
printf("\033[?25h\033[%d;1H\033[0m", END_ROW);
if (cmdline) {
- mp("cmdline = %s", cmdline);
+ dprintf("cmdline = %s", cmdline);
execute(cmdline, KT_NONE);
if (cm->onerror)
execute(cm->onerror, KT_NONE);
#include <syslinux/loadfile.h>
#include <syslinux/linux.h>
#include <sys/module.h>
+#include <dprintf.h>
//const char *progname = "test.c32";
if (initramfs_load_archive(initramfs, "initrd.gz"))
- mp("initrd load failure\n");
+ dprintf("initrd load failure\n");
else
- mp("initrd load success\n");
+ dprintf("initrd load success\n");
- mp("1111");
+ dprintf("1111");
/* This should not return... */
syslinux_boot_linux(kernel_data, kernel_len, initramfs, cmdline);
static inline void dump_elf_module(struct elf_module *module)
{
/*
- mp("module name = %s", module->name);
+ dprintf("module name = %s", module->name);
printf("base_addr = 0x%p, module_size = %d\n", module->base_addr, module->module_size);
printf("hash tlb = 0x%p, ghash tbl = 0x%p\n", module->hash_table, module->ghash_table);
printf("str tbl = 0x%p, size = %d\n", module->str_table, module->strtable_size);
#include <string.h>
#include <stdio.h>
#include <elf.h>
+#include <dprintf.h>
#include <linux/list.h>
#include <sys/module.h>
// Perform the relocations
resolve_symbols(module);
- //mp("module->symtable_size = %d\n", module->symtable_size);
+ //dprintf("module->symtable_size = %d\n", module->symtable_size);
//print_elf_symbols(module);
#include <setjmp.h>
#include <setjmp.h>
#include <alloca.h>
+#include <dprintf.h>
-#define DBG_PRINT(fmt, args...) fprintf(stderr, "[EXEC] " fmt, ##args)
+#define DBG_PRINT(fmt, args...) dprintf("[EXEC] " fmt, ##args)
static struct elf_module *mod_root = NULL;
struct elf_module *__syslinux_current = NULL;
int type;
- mp("enter: name = %s", name);
+ dprintf("enter: name = %s", name);
if (module == NULL)
return -1;
if (!strcmp(cur_module->name, module->name)) {
- mp("We is running this module %s already!", module->name);
+ dprintf("We is running this module %s already!", module->name);
/*
* If we're already running the module and it's of
prev_module = cur_module;
cur_module = module;
- mp("type = %d, prev = %s, cur = %s",
+ dprintf("type = %d, prev = %s, cur = %s",
type, prev_module->name, cur_module->name);
if(type==LIB_MODULE)
while (line[i] != '\n')
aux[j++] = line[i++];
aux[j] = '\0';
- //mp("found dependency: temp_name = %s, aux = %s, name = %s", temp_name, aux, name);
+ //dprintf("found dependency: temp_name = %s, aux = %s, name = %s", temp_name, aux, name);
break;
}
}
i = 0;
while (aux[i]) {
sscanf(aux + i, "%s", temp_name);
- //mp("load module: %s", temp_name);
+ //dprintf("load module: %s", temp_name);
i += strlen(temp_name);
i++; /* skip a space */
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
+#include <dprintf.h>
#include <com32.h>
#include "core-elf.h"
strcpy(q, p);
- mp("kernel is %s, args = %s type = %d \n", kernel, args, type);
+ dprintf("kernel is %s, args = %s type = %d \n", kernel, args, type);
if (kernel[0] == '.' && type == KT_NONE) {
/* It might be a type specifier */
#include <stdio.h>
#include <string.h>
#include <console.h>
+#include <dprintf.h>
#include <syslinux/loadfile.h>
#include <syslinux/linux.h>
#include <syslinux/pxe.h>
char cmdline_buf[256], *cmdline;
int i;
- mp("okernel = %s, ocmdline = %s", okernel, ocmdline);
+ dprintf("okernel = %s, ocmdline = %s", okernel, ocmdline);
cmdline = cmdline_buf;
initramfs_load_archive(initramfs, initrd_name);
}
- //mp("loading initrd done");
+ //dprintf("loading initrd done");
/* This should not return... */
syslinux_boot_linux(kernel_data, kernel_len, initramfs, cmdline);
#include <stdlib.h>
#include <errno.h>
#include <string.h>
+#include <dprintf.h>
#include "malloc.h"
#include <stdio.h>
struct free_arena_header *fp;
addr_t end;
- mp("start = %x, len = %x, is_ram = %d", start, len, is_ram);
+ dprintf("start = %x, len = %x, is_ram = %d", start, len, is_ram);
if (start < 0x100000 || start > E820_MEM_MAX
|| !is_ram)
fp = (struct free_arena_header *)start;
fp->a.attrs = ARENA_TYPE_USED | (HEAP_MAIN << ARENA_HEAP_POS);
ARENA_SIZE_SET(fp->a.attrs, len);
- mp("will inject a block start:0x%x size 0x%x", start, len);
+ dprintf("will inject a block start:0x%x size 0x%x", start, len);
__inject_free_block(fp);
}
int i;
uint16_t *bios_free_mem = (uint16_t *)0x413;
- //mp("enter");
+ //dprintf("enter");
/* Initialize the head nodes */
fp = &__core_malloc_head[0];
fp++;
}
- //mp("__lowmem_heap = 0x%p bios_free = 0x%p",
+ //dprintf("__lowmem_heap = 0x%p bios_free = 0x%p",
// __lowmem_heap, *bios_free_mem);
/* Initialize the lowmem heap */