Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 4346 → Rev 4345

/branches/dynload/kernel/generic/src/debug/symtab.c
41,19 → 41,18
#include <print.h>
#include <arch/types.h>
#include <typedefs.h>
#include <errno.h>
 
/** Get name of symbol that seems most likely to correspond to address.
/** Return entry that seems most likely to correspond to argument.
*
* @param addr Address.
* @param name Place to store pointer to the symbol name.
* Return entry that seems most likely to correspond
* to address passed in the argument.
*
* @return Zero on success or negative error code, ENOENT if not found,
* ENOTSUP if symbol table not available.
* @param addr Address.
*
* @return Pointer to respective symbol string on success, NULL otherwise.
*/
int symtab_name_lookup(unative_t addr, char **name)
char * get_symtab_entry(unative_t addr)
{
#ifdef CONFIG_SYMTAB
count_t i;
 
for (i = 1; symbol_table[i].address_le; ++i) {
60,44 → 59,11
if (addr < uint64_t_le2host(symbol_table[i].address_le))
break;
}
if (addr >= uint64_t_le2host(symbol_table[i - 1].address_le)) {
*name = symbol_table[i - 1].symbol_name;
return EOK;
}
 
*name = NULL;
return ENOENT;
#else
*name = NULL;
return ENOTSUP;
#endif
if (addr >= uint64_t_le2host(symbol_table[i - 1].address_le))
return symbol_table[i - 1].symbol_name;
return NULL;
}
 
/** Lookup symbol by address and format for display.
*
* Returns name of closest corresponding symbol, "Not found" if none exists
* or "N/A" if no symbol information is available.
*
* @param addr Address.
* @param name Place to store pointer to the symbol name.
*
* @return Pointer to a human-readable string.
*/
char *symtab_fmt_name_lookup(unative_t addr)
{
int rc;
char *name;
 
rc = symtab_name_lookup(addr, &name);
switch (rc) {
case EOK: return name;
case ENOENT: return "Not found";
default: return "N/A";
}
}
 
#ifdef CONFIG_SYMTAB
 
/** Find symbols that match the parameter forward and print them.
*
* @param name - search string
136,22 → 102,17
return NULL;
}
 
#endif
 
/** Return address that corresponds to the entry
*
* Search symbol table, and if there is one match, return it
*
* @param name Name of the symbol
* @param addr Place to store symbol address
*
* @return Zero on success, ENOENT - not found, EOVERFLOW - duplicate
* symbol, ENOTSUP - no symbol information available.
* @param name Name of the symbol
* @return 0 - Not found, -1 - Duplicate symbol, other - address of symbol
*/
int symtab_addr_lookup(const char *name, uintptr_t *addr)
uintptr_t get_symbol_addr(const char *name)
{
#ifdef CONFIG_SYMTAB
count_t found = 0;
uintptr_t addr = NULL;
char *hint;
int i;
 
158,25 → 119,19
i = 0;
while ((hint = symtab_search_one(name, &i))) {
if (!strlen(hint)) {
*addr = uint64_t_le2host(symbol_table[i].address_le);
addr = uint64_t_le2host(symbol_table[i].address_le);
found++;
}
i++;
}
if (found > 1)
return EOVERFLOW;
if (found < 1)
return ENOENT;
return EOK;
#else
return ENOTSUP;
#endif
return ((uintptr_t) -1);
return addr;
}
 
/** Find symbols that match parameter and prints them */
void symtab_print_search(const char *name)
{
#ifdef CONFIG_SYMTAB
int i;
uintptr_t addr;
char *realname;
189,9 → 144,6
printf("%p: %s\n", addr, realname);
i++;
}
#else
printf("No symbol information available.\n");
#endif
}
 
/** Symtab completion
201,7 → 153,6
*/
int symtab_compl(char *input)
{
#ifdef CONFIG_SYMTAB
char output[MAX_SYMBOL_NAME + 1];
int startpos = 0;
char *foundtxt;
245,9 → 196,7
}
strncpy(input, output, MAX_SYMBOL_NAME);
return found;
#else
return 0;
#endif
}
 
/** @}
/branches/dynload/kernel/generic/src/console/cmd.c
53,6 → 53,7
#include <string.h>
#include <macros.h>
#include <debug.h>
#include <symtab.h>
#include <cpu.h>
#include <mm/tlb.h>
#include <arch/mm/tlb.h>
64,8 → 65,6
#include <proc/task.h>
#include <ipc/ipc.h>
#include <ipc/irq.h>
#include <symtab.h>
#include <errno.h>
 
#ifdef CONFIG_TEST
#include <test.h>
80,6 → 79,12
.argc = 0
};
 
static cmd_info_t exit_info = {
.name = "exit",
.description = "Exit kconsole.",
.argc = 0
};
 
static int cmd_reboot(cmd_arg_t *argv);
static cmd_info_t reboot_info = {
.name = "reboot",
452,6 → 457,7
&continue_info,
&cpus_info,
&desc_info,
&exit_info,
&reboot_info,
&uptime_info,
&halt_info,
621,24 → 627,20
char *symbol;
unative_t (*fnc)(void);
fncptr_t fptr;
int rc;
 
symbol = (char *) argv->buffer;
rc = symtab_addr_lookup(symbol, &symaddr);
 
if (rc == ENOENT)
printf("Symbol %s not found.\n", symbol);
else if (rc == EOVERFLOW) {
symtab_print_search(symbol);
symaddr = get_symbol_addr((char *) argv->buffer);
if (!symaddr)
printf("Symbol %s not found.\n", argv->buffer);
else if (symaddr == (uintptr_t) -1) {
symtab_print_search((char *) argv->buffer);
printf("Duplicate symbol, be more specific.\n");
} else if (rc == EOK) {
fnc = (unative_t (*)(void)) arch_construct_function(&fptr,
(void *) symaddr, (void *) cmd_call0);
} else {
symbol = get_symtab_entry(symaddr);
fnc = (unative_t (*)(void)) arch_construct_function(&fptr, (void *) symaddr, (void *) cmd_call0);
printf("Calling %s() (%p)\n", symbol, symaddr);
printf("Result: %#" PRIxn "\n", fnc());
} else {
printf("No symbol information available.\n");
}
return 1;
}
 
679,24 → 681,20
unative_t (*fnc)(unative_t, ...);
unative_t arg1 = argv[1].intval;
fncptr_t fptr;
int rc;
 
symbol = (char *) argv->buffer;
rc = symtab_addr_lookup(symbol, &symaddr);
 
if (rc == ENOENT) {
printf("Symbol %s not found.\n", symbol);
} else if (rc == EOVERFLOW) {
symtab_print_search(symbol);
symaddr = get_symbol_addr((char *) argv->buffer);
if (!symaddr)
printf("Symbol %s not found.\n", argv->buffer);
else if (symaddr == (uintptr_t) -1) {
symtab_print_search((char *) argv->buffer);
printf("Duplicate symbol, be more specific.\n");
} else if (rc == EOK) {
} else {
symbol = get_symtab_entry(symaddr);
fnc = (unative_t (*)(unative_t, ...)) arch_construct_function(&fptr, (void *) symaddr, (void *) cmd_call1);
printf("Calling f(%#" PRIxn "): %p: %s\n", arg1, symaddr, symbol);
printf("Result: %#" PRIxn "\n", fnc(arg1));
} else {
printf("No symbol information available.\n");
}
 
return 1;
}
 
709,24 → 707,21
unative_t arg1 = argv[1].intval;
unative_t arg2 = argv[2].intval;
fncptr_t fptr;
int rc;
 
symbol = (char *) argv->buffer;
rc = symtab_addr_lookup(symbol, &symaddr);
 
if (rc == ENOENT) {
printf("Symbol %s not found.\n", symbol);
} else if (rc == EOVERFLOW) {
symtab_print_search(symbol);
symaddr = get_symbol_addr((char *) argv->buffer);
if (!symaddr)
printf("Symbol %s not found.\n", argv->buffer);
else if (symaddr == (uintptr_t) -1) {
symtab_print_search((char *) argv->buffer);
printf("Duplicate symbol, be more specific.\n");
} else if (rc == EOK) {
} else {
symbol = get_symtab_entry(symaddr);
fnc = (unative_t (*)(unative_t, unative_t, ...)) arch_construct_function(&fptr, (void *) symaddr, (void *) cmd_call2);
printf("Calling f(%#" PRIxn ", %#" PRIxn "): %p: %s\n",
arg1, arg2, symaddr, symbol);
printf("Result: %#" PRIxn "\n", fnc(arg1, arg2));
} else {
printf("No symbol information available.\n");
}
return 1;
}
 
740,24 → 735,21
unative_t arg2 = argv[2].intval;
unative_t arg3 = argv[3].intval;
fncptr_t fptr;
int rc;
symbol = (char *) argv->buffer;
rc = symtab_addr_lookup(symbol, &symaddr);
 
if (rc == ENOENT) {
printf("Symbol %s not found.\n", symbol);
} else if (rc == EOVERFLOW) {
symtab_print_search(symbol);
symaddr = get_symbol_addr((char *) argv->buffer);
if (!symaddr)
printf("Symbol %s not found.\n", argv->buffer);
else if (symaddr == (uintptr_t) -1) {
symtab_print_search((char *) argv->buffer);
printf("Duplicate symbol, be more specific.\n");
} else if (rc == EOK) {
} else {
symbol = get_symtab_entry(symaddr);
fnc = (unative_t (*)(unative_t, unative_t, unative_t, ...)) arch_construct_function(&fptr, (void *) symaddr, (void *) cmd_call3);
printf("Calling f(%#" PRIxn ",%#" PRIxn ", %#" PRIxn "): %p: %s\n",
arg1, arg2, arg3, symaddr, symbol);
printf("Result: %#" PRIxn "\n", fnc(arg1, arg2, arg3));
} else {
printf("No symbol information available.\n");
}
return 1;
}
 
807,34 → 799,30
/** Write 4 byte value to address */
int cmd_set4(cmd_arg_t *argv)
{
uintptr_t addr;
uint32_t *addr;
uint32_t arg1 = argv[1].intval;
bool pointer = false;
int rc;
 
if (((char *)argv->buffer)[0] == '*') {
rc = symtab_addr_lookup((char *) argv->buffer + 1, &addr);
addr = (uint32_t *) get_symbol_addr((char *) argv->buffer + 1);
pointer = true;
} else if (((char *) argv->buffer)[0] >= '0' &&
((char *)argv->buffer)[0] <= '9') {
rc = EOK;
addr = atoi((char *)argv->buffer);
} else {
rc = symtab_addr_lookup((char *) argv->buffer, &addr);
}
((char *)argv->buffer)[0] <= '9')
addr = (uint32_t *)atoi((char *)argv->buffer);
else
addr = (uint32_t *)get_symbol_addr((char *) argv->buffer);
 
if (rc == ENOENT)
if (!addr)
printf("Symbol %s not found.\n", argv->buffer);
else if (rc == EOVERFLOW) {
else if (addr == (uint32_t *) -1) {
symtab_print_search((char *) argv->buffer);
printf("Duplicate symbol, be more specific.\n");
} else if (rc == EOK) {
} else {
if (pointer)
addr = *(uintptr_t *) addr;
addr = (uint32_t *)(*(unative_t *)addr);
printf("Writing %#" PRIx64 " -> %p\n", arg1, addr);
*(uint32_t *) addr = arg1;
} else {
printf("No symbol information available.\n");
*addr = arg1;
}
return 1;
/branches/dynload/kernel/generic/src/console/kconsole.c
50,11 → 50,10
#include <debug.h>
#include <func.h>
#include <string.h>
#include <symtab.h>
#include <macros.h>
#include <sysinfo/sysinfo.h>
#include <ddi/device.h>
#include <symtab.h>
#include <errno.h>
 
/** Simple kernel console.
*
259,7 → 258,7
*/
static int cmdtab_compl(char *name)
{
static char output[/*MAX_SYMBOL_NAME*/128 + 1];
static char output[MAX_SYMBOL_NAME + 1];
link_t *startpos = NULL;
const char *foundtxt;
int found = 0;
291,11 → 290,12
startpos = startpos->next;
}
}
strncpy(name, output, 128/*MAX_SYMBOL_NAME*/);
strncpy(name, output, MAX_SYMBOL_NAME);
return found;
}
 
static char *clever_readline(const char *prompt, indev_t *input)
static char *clever_readline(const char *prompt, chardev_t *input)
{
static int histposition = 0;
 
456,11 → 456,6
return current;
}
 
bool kconsole_check_poll(void)
{
return check_poll(stdin);
}
 
/** Kernel console prompt.
*
* @param prompt Kernel console prompt (e.g kconsole/panic).
474,7 → 469,7
cmd_info_t *cmd_info;
count_t len;
char *cmdline;
 
if (!stdin) {
LOG("No stdin for kernel console");
return;
485,8 → 480,6
if (kcon)
_getc(stdin);
else
printf("Type \"exit\" to leave the console.\n");
while (true) {
cmdline = clever_readline((char *) prompt, stdin);
494,13 → 487,14
if (!len)
continue;
if ((!kcon) && (len == 4) && (strncmp(cmdline, "exit", 4) == 0))
break;
cmd_info = parse_cmdline(cmdline, len);
if (!cmd_info)
continue;
if ((!kcon)
&& (strncmp(cmd_info->name, "exit", min(strlen(cmd_info->name), 5)) == 0))
break;
(void) cmd_info->func(cmd_info->argv);
}
}
515,12 → 509,10
 
static int parse_int_arg(char *text, size_t len, unative_t *result)
{
static char symname[MAX_SYMBOL_NAME];
uintptr_t symaddr;
bool isaddr = false;
bool isptr = false;
int rc;
 
static char symname[MAX_SYMBOL_NAME];
/* If we get a name, try to find it in symbol table */
if (text[0] == '&') {
534,20 → 526,16
}
if (text[0] < '0' || text[0] > '9') {
strncpy(symname, text, min(len + 1, MAX_SYMBOL_NAME));
rc = symtab_addr_lookup(symname, &symaddr);
switch (rc) {
case ENOENT:
symaddr = get_symbol_addr(symname);
if (!symaddr) {
printf("Symbol %s not found.\n", symname);
return -1;
case EOVERFLOW:
}
if (symaddr == (uintptr_t) -1) {
printf("Duplicate symbol %s.\n", symname);
symtab_print_search(symname);
return -1;
default:
printf("No symbol information available.\n");
return -1;
}
 
if (isaddr)
*result = (unative_t)symaddr;
else if (isptr)
/branches/dynload/kernel/generic/src/console/console.c
74,16 → 74,47
/** Physical memory area used for klog buffer */
static parea_t klog_parea;
 
/** Standard input and output character devices */
indev_t *stdin = NULL;
outdev_t *stdout = NULL;
/*
* For now, we use 0 as INR.
* However, it is therefore desirable to have architecture specific
* definition of KLOG_VIRT_INR in the future.
*/
#define KLOG_VIRT_INR 0
 
static irq_t klog_irq;
 
static chardev_operations_t null_stdout_ops = {
.suspend = NULL,
.resume = NULL,
.write = NULL,
.read = NULL
};
 
chardev_t null_stdout = {
.name = "null",
.op = &null_stdout_ops
};
 
/** Allways refuse IRQ ownership.
*
* This is not a real IRQ, so we always decline.
*
* @return Always returns IRQ_DECLINE.
*/
static irq_ownership_t klog_claim(irq_t *irq)
{
return IRQ_DECLINE;
}
 
/** Standard input character device */
chardev_t *stdin = NULL;
chardev_t *stdout = &null_stdout;
 
/** Initialize kernel logging facility
*
* The shared area contains kernel cyclic buffer. Userspace application may
* be notified on new data with indication of position and size
* of the data within the circular buffer.
*
*/
void klog_init(void)
{
91,20 → 122,24
ASSERT((uintptr_t) faddr % FRAME_SIZE == 0);
ASSERT(KLOG_SIZE % FRAME_SIZE == 0);
 
devno_t devno = device_assign_devno();
klog_parea.pbase = (uintptr_t) faddr;
klog_parea.frames = SIZE2FRAMES(KLOG_SIZE);
ddi_parea_register(&klog_parea);
 
sysinfo_set_item_val("klog.faddr", NULL, (unative_t) faddr);
sysinfo_set_item_val("klog.pages", NULL, SIZE2FRAMES(KLOG_SIZE));
sysinfo_set_item_val("klog.devno", NULL, devno);
sysinfo_set_item_val("klog.inr", NULL, KLOG_VIRT_INR);
 
irq_initialize(&klog_irq);
klog_irq.devno = devno;
klog_irq.inr = KLOG_VIRT_INR;
klog_irq.claim = klog_claim;
irq_register(&klog_irq);
//irq_initialize(&klog_irq);
//klog_irq.devno = devno;
//klog_irq.inr = KLOG_VIRT_INR;
//klog_irq.claim = klog_claim;
//irq_register(&klog_irq);
spinlock_lock(&klog_lock);
klog_inited = true;
spinlock_unlock(&klog_lock);
122,73 → 157,64
arch_release_console();
}
 
bool check_poll(indev_t *indev)
{
if (indev == NULL)
return false;
if (indev->op == NULL)
return false;
return (indev->op->poll != NULL);
}
 
/** Get character from input character device. Do not echo character.
/** Get character from character device. Do not echo character.
*
* @param indev Input character device.
* @param chardev Character device.
*
* @return Character read.
*
*/
uint8_t _getc(indev_t *indev)
uint8_t _getc(chardev_t *chardev)
{
uint8_t ch;
ipl_t ipl;
 
if (atomic_get(&haltstate)) {
/* If we are here, we are hopefully on the processor that
/* If we are here, we are hopefully on the processor, that
* issued the 'halt' command, so proceed to read the character
* directly from input
*/
if (check_poll(indev))
return indev->op->poll(indev);
/* No other way of interacting with user */
interrupts_disable();
if (chardev->op->read)
return chardev->op->read(chardev);
/* no other way of interacting with user, halt */
if (CPU)
printf("cpu%u: ", CPU->id);
else
printf("cpu: ");
printf("halted (no polling input)\n");
printf("halted (no kconsole)\n");
cpu_halt();
}
waitq_sleep(&indev->wq);
ipl_t ipl = interrupts_disable();
spinlock_lock(&indev->lock);
uint8_t ch = indev->buffer[(indev->index - indev->counter) % INDEV_BUFLEN];
indev->counter--;
spinlock_unlock(&indev->lock);
 
waitq_sleep(&chardev->wq);
ipl = interrupts_disable();
spinlock_lock(&chardev->lock);
ch = chardev->buffer[(chardev->index - chardev->counter) % CHARDEV_BUFLEN];
chardev->counter--;
spinlock_unlock(&chardev->lock);
interrupts_restore(ipl);
 
chardev->op->resume(chardev);
 
return ch;
}
 
/** Get string from input character device.
/** Get string from character device.
*
* Read characters from input character device until first occurrence
* Read characters from character device until first occurrence
* of newline character.
*
* @param indev Input character device.
* @param buf Buffer where to store string terminated by '\0'.
* @param chardev Character device.
* @param buf Buffer where to store string terminated by '\0'.
* @param buflen Size of the buffer.
*
* @return Number of characters read.
*
*/
count_t gets(indev_t *indev, char *buf, size_t buflen)
count_t gets(chardev_t *chardev, char *buf, size_t buflen)
{
index_t index = 0;
char ch;
while (index < buflen) {
char ch = _getc(indev);
ch = _getc(chardev);
if (ch == '\b') {
if (index > 0) {
index--;
207,14 → 233,15
}
buf[index++] = ch;
}
return (count_t) index;
}
 
/** Get character from input device & echo it to screen */
uint8_t getc(indev_t *indev)
/** Get character from device & echo it to screen */
uint8_t getc(chardev_t *chardev)
{
uint8_t ch = _getc(indev);
uint8_t ch;
 
ch = _getc(chardev);
putchar(ch);
return ch;
}
223,10 → 250,10
{
spinlock_lock(&klog_lock);
// if ((klog_inited) && (klog_irq.notif_cfg.notify) && (klog_uspace > 0)) {
// ipc_irq_send_msg_3(&klog_irq, klog_start, klog_len, klog_uspace);
// klog_uspace = 0;
// }
if ((klog_inited) && (klog_irq.notif_cfg.notify) && (klog_uspace > 0)) {
ipc_irq_send_msg_3(&klog_irq, klog_start, klog_len, klog_uspace);
klog_uspace = 0;
}
spinlock_unlock(&klog_lock);
}
235,7 → 262,7
{
spinlock_lock(&klog_lock);
if ((klog_stored > 0) && (stdout) && (stdout->op->write)) {
if ((klog_stored > 0) && (stdout->op->write)) {
/* Print charaters stored in kernel log */
index_t i;
for (i = klog_len - klog_stored; i < klog_len; i++)
250,7 → 277,7
else
klog_start = (klog_start + 1) % KLOG_SIZE;
if ((stdout) && (stdout->op->write))
if (stdout->op->write)
stdout->op->write(stdout, c, silent);
else {
/* The character is just in the kernel log */
/branches/dynload/kernel/generic/src/console/chardev.c
37,62 → 37,42
#include <synch/waitq.h>
#include <synch/spinlock.h>
 
/** Initialize input character device.
/** Initialize character device.
*
* @param indev Input character device.
* @param op Implementation of input character device operations.
*
* @param chardev Character device.
* @param op Implementation of character device operations.
*/
void indev_initialize(char *name, indev_t *indev,
indev_operations_t *op)
void chardev_initialize(char *name, chardev_t *chardev,
chardev_operations_t *op)
{
indev->name = name;
waitq_initialize(&indev->wq);
spinlock_initialize(&indev->lock, "indev");
indev->counter = 0;
indev->index = 0;
indev->op = op;
chardev->name = name;
 
waitq_initialize(&chardev->wq);
spinlock_initialize(&chardev->lock, "chardev");
chardev->counter = 0;
chardev->index = 0;
chardev->op = op;
}
 
/** Push character read from input character device.
*
* @param indev Input character device.
* @param ch Character being pushed.
*
* @param chardev Character device.
* @param ch Character being pushed.
*/
void indev_push_character(indev_t *indev, uint8_t ch)
void chardev_push_character(chardev_t *chardev, uint8_t ch)
{
ASSERT(indev);
spinlock_lock(&indev->lock);
if (indev->counter == INDEV_BUFLEN - 1) {
/* Buffer full */
spinlock_unlock(&indev->lock);
return;
spinlock_lock(&chardev->lock);
chardev->counter++;
if (chardev->counter == CHARDEV_BUFLEN - 1) {
/* buffer full => disable device interrupt */
chardev->op->suspend(chardev);
}
indev->counter++;
indev->buffer[indev->index++] = ch;
/* Index modulo size of buffer */
indev->index = indev->index % INDEV_BUFLEN;
waitq_wakeup(&indev->wq, WAKEUP_FIRST);
spinlock_unlock(&indev->lock);
chardev->buffer[chardev->index++] = ch;
chardev->index = chardev->index % CHARDEV_BUFLEN; /* index modulo size of buffer */
waitq_wakeup(&chardev->wq, WAKEUP_FIRST);
spinlock_unlock(&chardev->lock);
}
 
/** Initialize output character device.
*
* @param outdev Output character device.
* @param op Implementation of output character device operations.
*
*/
void outdev_initialize(char *name, outdev_t *outdev,
outdev_operations_t *op)
{
outdev->name = name;
spinlock_initialize(&outdev->lock, "outdev");
outdev->op = op;
}
 
/** @}
*/
/branches/dynload/kernel/generic/src/lib/func.c
47,7 → 47,7
 
/** Halt wrapper
*
* Set halt flag and halt the CPU.
* Set halt flag and halt the cpu.
*
*/
void halt()
54,7 → 54,7
{
#ifdef CONFIG_DEBUG
bool rundebugger = false;
 
if (!atomic_get(&haltstate)) {
atomic_set(&haltstate, 1);
rundebugger = true;
62,12 → 62,12
#else
atomic_set(&haltstate, 1);
#endif
 
interrupts_disable();
#if (defined(CONFIG_DEBUG)) && (defined(CONFIG_KCONSOLE))
if ((rundebugger) && (kconsole_check_poll()))
kconsole("panic", "\nLast resort kernel console ready.\n", false);
if (rundebugger)
kconsole("panic", "\nLast resort kernel console ready\n", false);
#endif
if (CPU)
74,7 → 74,6
printf("cpu%u: halted\n", CPU->id);
else
printf("cpu: halted\n");
cpu_halt();
}
 
/branches/dynload/kernel/generic/src/ipc/sysipc.c
936,21 → 936,11
/* Include phone address('id') of the caller in the request,
* copy whole call->data, not only call->data.args */
if (STRUCT_TO_USPACE(calldata, &call->data)) {
/*
* The callee will not receive this call and no one else has
* a chance to answer it. Reply with the EPARTY error code.
/* XXX
* To avoid deadlocks in synchronous calls
* this should be replaced by discarding
* the call and notifying the caller.
*/
ipc_data_t saved_data;
int saveddata = 0;
 
if (answer_need_old(call)) {
memcpy(&saved_data, &call->data, sizeof(call->data));
saveddata = 1;
}
IPC_SET_RETVAL(call->data, EPARTY);
(void) answer_preprocess(call, saveddata ? &saved_data : NULL);
ipc_answer(&TASK->answerbox, call);
return 0;
}
return (unative_t)call;
/branches/dynload/kernel/generic/src/mm/frame.c
160,7 → 160,6
* @return Total number of available frames.
*
*/
#ifdef CONFIG_DEBUG
static count_t total_frames_free(void)
{
count_t total = 0;
170,7 → 169,6
return total;
}
#endif
 
/** Find a zone with a given frames.
*
290,12 → 288,15
frame->buddy_order));
bool is_left = IS_BUDDY_LEFT_BLOCK_ABS(zone, frame);
bool is_right = IS_BUDDY_RIGHT_BLOCK_ABS(zone, frame);
ASSERT(is_left ^ is_right);
index_t index;
if (is_left) {
index = (frame_index(zone, frame)) +
(1 << frame->buddy_order);
} else { /* is_right */
} else { /* if (is_right) */
index = (frame_index(zone, frame)) -
(1 << frame->buddy_order);
}
482,9 → 483,7
if (frame->refcount)
return;
link_t *link __attribute__ ((unused));
link = buddy_system_alloc_block(zone->buddy_system,
link_t *link = buddy_system_alloc_block(zone->buddy_system,
&frame->buddy_link);
ASSERT(link);
609,9 → 608,8
|| (pfn >= zones.info[znum].base + zones.info[znum].count))
return;
frame_t *frame __attribute__ ((unused));
 
frame = &zones.info[znum].frames[pfn - zones.info[znum].base];
frame_t *frame
= &zones.info[znum].frames[pfn - zones.info[znum].base];
ASSERT(!frame->buddy_order);
count_t i;
/branches/dynload/kernel/generic/src/synch/spinlock.c
76,6 → 76,7
void spinlock_lock_debug(spinlock_t *sl)
{
count_t i = 0;
char *symbol;
bool deadlock_reported = false;
 
preemption_disable();
105,10 → 106,12
continue;
#endif
if (i++ > DEADLOCK_THRESHOLD) {
printf("cpu%u: looping on spinlock %" PRIp ":%s, "
"caller=%" PRIp "(%s)", CPU->id, sl, sl->name,
CALLER, symtab_fmt_name_lookup(CALLER));
 
printf("cpu%u: looping on spinlock %" PRIp ":%s, caller=%" PRIp,
CPU->id, sl, sl->name, CALLER);
symbol = get_symtab_entry(CALLER);
if (symbol)
printf("(%s)", symbol);
printf("\n");
i = 0;
deadlock_reported = true;
}
/branches/dynload/kernel/generic/src/interrupt/interrupt.c
42,6 → 42,7
#include <debug.h>
#include <console/kconsole.h>
#include <console/console.h>
#include <console/chardev.h>
#include <console/cmd.h>
#include <panic.h>
#include <print.h>
67,13 → 68,13
iroutine old;
spinlock_lock(&exctbl_lock);
 
old = exc_table[n].f;
exc_table[n].f = f;
exc_table[n].name = name;
spinlock_unlock(&exctbl_lock);
 
spinlock_unlock(&exctbl_lock);
 
return old;
}
 
130,7 → 131,9
#endif
for (i = 0; i < IVT_ITEMS; i++) {
symbol = symtab_fmt_name_lookup((unative_t) exc_table[i].f);
symbol = get_symtab_entry((unative_t) exc_table[i].f);
if (!symbol)
symbol = "not found";
 
#ifdef __32_BITS__
printf("%-3u %-20s %10p %s\n", i + IVT_FIRST, exc_table[i].name,
145,7 → 148,7
if (((i + 1) % 20) == 0) {
printf(" -- Press any key to continue -- ");
spinlock_unlock(&exctbl_lock);
_getc(stdin);
getc(stdin);
spinlock_lock(&exctbl_lock);
printf("\n");
}