- Add m68k pendant of: r27529 & r27778 - handle skipIframes parameter
r27530 - allow faults with ints disabled if there is a handler r27648 - call the end-of-interrupt thread callback r27718 - add <asm_defs.h>, not used yet r27722 - register the commpage as image and symbols (but we don't use it yet) - remove dupped call to thread_get_current_thread() - use 16MB iospace for now, 4MB seems too small. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27999 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
5bb2204e46
commit
5222f12a32
|
@ -0,0 +1,17 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2008, François Revol, revol@free.fr.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#ifndef SYSTEM_ARCH_M68K_ASM_DEFS_H
|
||||||
|
#define SYSTEM_ARCH_M68K_ASM_DEFS_H
|
||||||
|
|
||||||
|
|
||||||
|
#define SYMBOL(name) .global name; name
|
||||||
|
#define SYMBOL_END(name) 1: .size name, 1b - name
|
||||||
|
#define STATIC_FUNCTION(name) .type name, @function; name
|
||||||
|
#define FUNCTION(name) .global name; .type name, @function; name
|
||||||
|
#define FUNCTION_END(name) 1: .size name, 1b - name
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* SYSTEM_ARCH_M68K_ASM_DEFS_H */
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include <KernelExport.h>
|
#include <KernelExport.h>
|
||||||
|
|
||||||
#include <cpu.h>
|
#include <cpu.h>
|
||||||
|
#include <elf.h>
|
||||||
#include <smp.h>
|
#include <smp.h>
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,6 +21,9 @@ arch_commpage_init(void)
|
||||||
{
|
{
|
||||||
/* no optimized memcpy or anything yet */
|
/* no optimized memcpy or anything yet */
|
||||||
/* we don't use it for syscall yet either */
|
/* we don't use it for syscall yet either */
|
||||||
|
// add syscall to the commpage image
|
||||||
|
image_id image = get_commpage_image();
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
#include <arch_thread.h>
|
#include <arch_thread.h>
|
||||||
#include <arch/cpu.h>
|
#include <arch/cpu.h>
|
||||||
#include <boot/kernel_args.h>
|
#include <boot/kernel_args.h>
|
||||||
|
#include <commpage.h>
|
||||||
|
#include <elf.h>
|
||||||
|
|
||||||
extern struct m68k_cpu_ops cpu_ops_030;
|
extern struct m68k_cpu_ops cpu_ops_030;
|
||||||
extern struct m68k_cpu_ops cpu_ops_040;
|
extern struct m68k_cpu_ops cpu_ops_040;
|
||||||
|
@ -93,6 +95,9 @@ arch_cpu_init_post_vm(kernel_args *args)
|
||||||
status_t
|
status_t
|
||||||
arch_cpu_init_post_modules(kernel_args *args)
|
arch_cpu_init_post_modules(kernel_args *args)
|
||||||
{
|
{
|
||||||
|
// add the functions to the commpage image
|
||||||
|
image_id image = get_commpage_image();
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -284,18 +284,32 @@ arch_debug_get_caller(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*! Captures a stack trace (the return addresses) of the current thread.
|
||||||
|
\param returnAddresses The array the return address shall be written to.
|
||||||
|
\param maxCount The maximum number of return addresses to be captured.
|
||||||
|
\param skipIframes The number of interrupt frames that shall be skipped. If
|
||||||
|
greater than 0, \a skipFrames is ignored.
|
||||||
|
\param skipFrames The number of stack frames that shall be skipped.
|
||||||
|
\param userOnly If \c true, only userland return addresses are captured.
|
||||||
|
\return The number of return addresses written to the given array.
|
||||||
|
*/
|
||||||
int32
|
int32
|
||||||
arch_debug_get_stack_trace(addr_t* returnAddresses, int32 maxCount,
|
arch_debug_get_stack_trace(addr_t* returnAddresses, int32 maxCount,
|
||||||
int32 skipIframes, int32 skipFrames, bool userOnly)
|
int32 skipIframes, int32 skipFrames, bool userOnly)
|
||||||
{
|
{
|
||||||
// TODO: Support skipIframes!
|
|
||||||
struct iframe_stack *frameStack;
|
struct iframe_stack *frameStack;
|
||||||
addr_t framePointer;
|
addr_t framePointer;
|
||||||
int32 count = 0;
|
int32 count = 0;
|
||||||
int32 i, num = 0, last = 0;
|
int32 i, num = 0, last = 0;
|
||||||
|
|
||||||
|
// Keep skipping normal stack frames until we've skipped the iframes we're
|
||||||
|
// supposed to skip.
|
||||||
|
if (skipIframes > 0) {
|
||||||
|
skipFrames = INT_MAX;
|
||||||
|
} else {
|
||||||
// always skip our own frame
|
// always skip our own frame
|
||||||
skipFrames++;
|
skipFrames++;
|
||||||
|
}
|
||||||
|
|
||||||
struct thread* thread = thread_get_current_thread();
|
struct thread* thread = thread_get_current_thread();
|
||||||
framePointer = (addr_t)get_current_stack_frame();
|
framePointer = (addr_t)get_current_stack_frame();
|
||||||
|
@ -323,6 +337,11 @@ arch_debug_get_stack_trace(addr_t* returnAddresses, int32 maxCount,
|
||||||
if (frame) {
|
if (frame) {
|
||||||
ip = frame->cpu.pc;
|
ip = frame->cpu.pc;
|
||||||
nextFrame = frame->a[6];
|
nextFrame = frame->a[6];
|
||||||
|
|
||||||
|
if (skipIframes > 0) {
|
||||||
|
if (--skipIframes == 0)
|
||||||
|
skipFrames = 0;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (get_next_frame(framePointer, &nextFrame, &ip) != B_OK)
|
if (get_next_frame(framePointer, &nextFrame, &ip) != B_OK)
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -168,6 +168,7 @@ m68k_exception_entry(struct iframe *iframe)
|
||||||
{
|
{
|
||||||
int vector = iframe->cpu.vector >> 2;
|
int vector = iframe->cpu.vector >> 2;
|
||||||
int ret = B_HANDLED_INTERRUPT;
|
int ret = B_HANDLED_INTERRUPT;
|
||||||
|
bool hardwareInterrupt = false;
|
||||||
|
|
||||||
if (vector != -1) {
|
if (vector != -1) {
|
||||||
dprintf("m68k_exception_entry: time %lld vector 0x%x, iframe %p, "
|
dprintf("m68k_exception_entry: time %lld vector 0x%x, iframe %p, "
|
||||||
|
@ -193,7 +194,6 @@ m68k_exception_entry(struct iframe *iframe)
|
||||||
|
|
||||||
if (kernelDebugger) {
|
if (kernelDebugger) {
|
||||||
// if this thread has a fault handler, we're allowed to be here
|
// if this thread has a fault handler, we're allowed to be here
|
||||||
struct thread *thread = thread_get_current_thread();
|
|
||||||
if (thread && thread->fault_handler != 0) {
|
if (thread && thread->fault_handler != 0) {
|
||||||
iframe->cpu.pc = thread->fault_handler;
|
iframe->cpu.pc = thread->fault_handler;
|
||||||
break;
|
break;
|
||||||
|
@ -206,6 +206,17 @@ m68k_exception_entry(struct iframe *iframe)
|
||||||
(void *)iframe->cpu.pc);
|
(void *)iframe->cpu.pc);
|
||||||
break;
|
break;
|
||||||
} else if ((iframe->cpu.sr & SR_IP_MASK) != 0) {
|
} else if ((iframe->cpu.sr & SR_IP_MASK) != 0) {
|
||||||
|
// interrupts disabled
|
||||||
|
|
||||||
|
// If a page fault handler is installed, we're allowed to be here.
|
||||||
|
// TODO: Now we are generally allowing user_memcpy() with interrupts
|
||||||
|
// disabled, which in most cases is a bug. We should add some thread
|
||||||
|
// flag allowing to explicitly indicate that this handling is desired.
|
||||||
|
if (thread && thread->fault_handler != 0) {
|
||||||
|
iframe->cpu.pc = thread->fault_handler;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// if the interrupts were disabled, and we are not running the
|
// if the interrupts were disabled, and we are not running the
|
||||||
// kernel startup the page fault was not allowed to happen and
|
// kernel startup the page fault was not allowed to happen and
|
||||||
// we must panic
|
// we must panic
|
||||||
|
@ -265,6 +276,7 @@ dprintf("handling I/O interrupts...\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
dprintf("handling I/O interrupts done\n");
|
dprintf("handling I/O interrupts done\n");
|
||||||
|
hardwareInterrupt = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,6 +300,14 @@ dprintf("handling I/O interrupts done\n");
|
||||||
scheduler_reschedule();
|
scheduler_reschedule();
|
||||||
RELEASE_THREAD_LOCK();
|
RELEASE_THREAD_LOCK();
|
||||||
restore_interrupts(state);
|
restore_interrupts(state);
|
||||||
|
} else if (hardwareInterrupt && thread->post_interrupt_callback != NULL) {
|
||||||
|
void (*callback)(void*) = thread->post_interrupt_callback;
|
||||||
|
void* data = thread->post_interrupt_data;
|
||||||
|
|
||||||
|
thread->post_interrupt_callback = NULL;
|
||||||
|
thread->post_interrupt_data = NULL;
|
||||||
|
|
||||||
|
callback(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// pop iframe
|
// pop iframe
|
||||||
|
|
|
@ -66,7 +66,8 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// 4 MB of iospace
|
// 4 MB of iospace
|
||||||
#define IOSPACE_SIZE (4*1024*1024)
|
//#define IOSPACE_SIZE (4*1024*1024)
|
||||||
|
#define IOSPACE_SIZE (16*1024*1024)
|
||||||
// 256K = 2^6*4K
|
// 256K = 2^6*4K
|
||||||
#define IOSPACE_CHUNK_SIZE (NUM_PAGEENT_PER_TBL*B_PAGE_SIZE)
|
#define IOSPACE_CHUNK_SIZE (NUM_PAGEENT_PER_TBL*B_PAGE_SIZE)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue