Created gencore() and minor aestetical changes.

modified:   executer/kernel/mcctrl.h
	modified:   executer/kernel/syscall.c
	modified:   kernel/include/syscall.h
	modified:   kernel/mem.c
This commit is contained in:
Naoki Hamada
2014-07-02 16:23:32 +09:00
parent fd6f0c4075
commit ed9da789e6
4 changed files with 36 additions and 31 deletions

View File

@ -57,7 +57,7 @@
struct coretable { struct coretable {
int len; int len;
void *addr; unsigned long addr;
}; };
struct ikc_scd_packet { struct ikc_scd_packet {

View File

@ -1198,7 +1198,7 @@ static int writecore(ihk_os_t os, unsigned long rcoretable, int chunks) {
coretable = ihk_device_map_virtual(dev, tablephys, tablesize, NULL, 0); coretable = ihk_device_map_virtual(dev, tablephys, tablesize, NULL, 0);
for (i = 0; i < chunks; i++) { for (i = 0; i < chunks; i++) {
/* map and write the chunk out */ /* map and write the chunk out */
rphys = (unsigned long) coretable[i].addr; rphys = coretable[i].addr;
size = coretable[i].len; size = coretable[i].len;
phys = ihk_device_map_memory(dev, rphys, size); phys = ihk_device_map_memory(dev, rphys, size);
pt = ihk_device_map_virtual(dev, phys, size, NULL, 0); pt = ihk_device_map_virtual(dev, phys, size, NULL, 0);

View File

@ -224,9 +224,9 @@ enum {
#undef SYSCALL_DELEGATED #undef SYSCALL_DELEGATED
#define __NR_coredump 999 /* pseudo syscall for coredump */ #define __NR_coredump 999 /* pseudo syscall for coredump */
struct coretable { struct coretable { /* table entry for a core chunk */
int len; int len; /* length of the chunk */
void *addr; unsigned long addr; /* physical addr of the chunk */
}; };
#endif #endif

View File

@ -34,7 +34,7 @@
#include <cls.h> #include <cls.h>
#include <page.h> #include <page.h>
//#define DEBUG_PRINT_MEM #define DEBUG_PRINT_MEM
#ifdef DEBUG_PRINT_MEM #ifdef DEBUG_PRINT_MEM
#define dkprintf(...) kprintf(__VA_ARGS__) #define dkprintf(...) kprintf(__VA_ARGS__)
@ -166,6 +166,34 @@ static struct ihk_mc_interrupt_handler query_free_mem_handler = {
void set_signal(int sig, void *regs); void set_signal(int sig, void *regs);
void check_signal(unsigned long rc, void *regs); void check_signal(unsigned long rc, void *regs);
int gencore(struct process *, void *, struct coretable **, int *);
static void coredump(struct process *proc, void *regs)
{
/* xxx */
struct syscall_request request IHK_DMA_ALIGN;
int ret;
struct coretable *coretable;
int chunks;
ret = gencore(proc, regs, &coretable, &chunks);
if (ret != 0) {
dkprintf("could not generate a core file image\n");
return;
}
request.number = __NR_coredump;
request.args[0] = chunks;
request.args[1] = virt_to_phys(coretable);
/* no data for now */
ret = do_syscall(&request, proc->uctx,
proc->cpu_id, proc->pid);
if (ret == 0) {
kprintf("dumped core.\n");
} else {
kprintf("core dump failed.\n");
}
kfree(coretable);
}
static void unhandled_page_fault(struct process *proc, void *fault_addr, void *regs) static void unhandled_page_fault(struct process *proc, void *fault_addr, void *regs)
{ {
@ -206,32 +234,9 @@ static void unhandled_page_fault(struct process *proc, void *fault_addr, void *r
/* TODO */ /* TODO */
ihk_mc_debug_show_interrupt_context(regs); ihk_mc_debug_show_interrupt_context(regs);
{
/* xxx */
/* core dump framework test */
struct syscall_request request IHK_DMA_ALIGN;
int ret;
struct coretable coreentry[3];
coreentry[0].len = 8; dkprintf("now dump a core file\n");
coreentry[0].addr = virt_to_phys("this is "); coredump(proc, regs);
coreentry[1].len = 7;
coreentry[1].addr = virt_to_phys("a test ");
coreentry[2].len = 15;
coreentry[2].addr = virt_to_phys("for coredump.\n");
request.number = __NR_coredump;
request.args[0] = 3;
request.args[1] = virt_to_phys(&coreentry);
/* no data for now */
ret = do_syscall(&request, proc->uctx,
proc->cpu_id, proc->pid);
if (ret == 0) {
kprintf("dumped core.\n");
} else {
kprintf("core dump failed.\n");
}
}
#ifdef DEBUG_PRINT_MEM #ifdef DEBUG_PRINT_MEM
{ {