/*#*
*#* $Log$
+ *#* Revision 1.6 2006/02/24 01:17:05 bernie
+ *#* Update for new emulator.
+ *#*
*#* Revision 1.5 2005/11/04 16:20:02 bernie
*#* Fix reference to README.devlib in header.
*#*
}
#define MONITOR_NODE_TO_PROCESS(node) \
- (struct Process*)((char*)(node) - offsetof(struct Process, monitor.link))
+ (struct Process *)((char *)(node) - offsetof(struct Process, monitor.link))
-size_t monitor_check_stack(cpustack_t* stack_base, size_t stack_size)
+size_t monitor_checkStack(cpustack_t* stack_base, size_t stack_size)
{
cpustack_t* beg;
cpustack_t* cur;
struct Process* p;
int i;
- if (ISLISTEMPTY(&MonitorProcs))
+ if (LIST_EMPTY(&MonitorProcs))
{
kputs("No stacks registered in the monitor\n");
return;
}
- kprintf("%-24s %-6s%-8s%-8s%-8s\n", "Process name", "TCB", "SPbase", "SPsize", "SPfree");
+ kprintf("%-24s%-8s%-8s%-8s%-8s\n", "Process name", "TCB", "SPbase", "SPsize", "SPfree");
for (i=0;i<56;i++)
kputchar('-');
kputchar('\n');
- for (p = MONITOR_NODE_TO_PROCESS(MonitorProcs.head);
+ for (p = MONITOR_NODE_TO_PROCESS(LIST_HEAD(&MonitorProcs));
p->monitor.link.succ;
p = MONITOR_NODE_TO_PROCESS(p->monitor.link.succ))
{
- size_t free = monitor_check_stack(p->monitor.stack_base, p->monitor.stack_size);
- kprintf("%-24s %04x %04x %4x %4x\n", p->monitor.name, (uint16_t)p, (uint16_t)p->monitor.stack_base, (uint16_t)p->monitor.stack_size, (uint16_t)free);
+ size_t free = monitor_checkStack(p->monitor.stack_base, p->monitor.stack_size);
+ kprintf("%-24s%8p%8p%8lx%8lx\n",
+ p->monitor.name, p, p->monitor.stack_base, p->monitor.stack_size, free);
}
}
-static void monitor(void)
+static void NORETURN monitor(void)
{
struct Process* p;
while (1)
{
- for (p = MONITOR_NODE_TO_PROCESS(MonitorProcs.head);
+ for (p = MONITOR_NODE_TO_PROCESS(LIST_HEAD(&MonitorProcs));
p->monitor.link.succ;
p = MONITOR_NODE_TO_PROCESS(p->monitor.link.succ))
{
- size_t free = monitor_check_stack(p->monitor.stack_base, p->monitor.stack_size);
+ size_t free = monitor_checkStack(p->monitor.stack_base, p->monitor.stack_size);
if (free < 0x20)
{
/*#*
*#* $Log$
+ *#* Revision 1.4 2006/02/24 01:17:05 bernie
+ *#* Update for new emulator.
+ *#*
*#* Revision 1.3 2005/11/04 16:20:02 bernie
*#* Fix reference to README.devlib in header.
*#*
#define KERN_MONITOR_H
#include <cfg/cpu.h>
-#include <cfg/config_kern.h>
+#include <config_kern.h>
#if CONFIG_KERN_MONITOR
* \note For this function to work, the stack must have been filled at startup with
* CONFIG_KERN_STACKFILLCODE.
*/
-size_t monitor_check_stack(cpustack_t* stack_base, size_t stack_size);
+size_t monitor_checkStack(cpustack_t *stack_base, size_t stack_size);
/*! Print a report of the stack status through kdebug */
/*#*
*#* $Log$
+ *#* Revision 1.29 2006/02/24 01:17:05 bernie
+ *#* Update for new emulator.
+ *#*
*#* Revision 1.28 2006/02/21 16:06:55 bernie
*#* Cleanup/update process scheduling.
*#*
/* Remember old process to save its context later */
old_process = CurrentProcess;
+#ifdef IRQ_RUNNING
/* Scheduling in interrupts is a nono. */
ASSERT(!IRQ_RUNNING());
+#endif
/* Poll on the ready queue for the first ready process */
IRQ_SAVE_DISABLE(flags);
- while (!(CurrentProcess = (struct Process *)REMHEAD(&ProcReadyList)))
+ while (!(CurrentProcess = (struct Process *)list_remHead(&ProcReadyList)))
{
/*
* Make sure we physically reenable interrupts here, no matter what
/*#*
*#* $Log$
+ *#* Revision 1.11 2006/02/24 01:17:05 bernie
+ *#* Update for new emulator.
+ *#*
*#* Revision 1.10 2005/11/04 16:20:02 bernie
*#* Fix reference to README.devlib in header.
*#*
*#*/
#include "sem.h"
-#include "proc.h"
-#include "proc_p.h"
-#include "signal.h"
-#include "hw.h"
+#include <kern/proc.h>
+#include <kern/proc_p.h>
+#include <kern/signal.h>
#include <cfg/debug.h>
INLINE void sem_verify(struct Semaphore *s)
}
else
{
- ASSERT(ISLISTEMPTY(&s->wait_queue));
+ ASSERT(LIST_EMPTY(&s->wait_queue));
/* The semaphore was free: lock it */
s->owner = CurrentProcess;
s->owner = NULL;
/* Give semaphore to the first applicant, if any */
- if (UNLIKELY((proc = (Process *)REMHEAD(&s->wait_queue))))
+ if (UNLIKELY((proc = (Process *)list_remHead(&s->wait_queue))))
{
s->nest_count = 1;
s->owner = proc;
/*#*
*#* $Log$
+ *#* Revision 1.13 2006/02/24 01:17:05 bernie
+ *#* Update for new emulator.
+ *#*
*#* Revision 1.12 2005/11/04 16:20:02 bernie
*#* Fix reference to README.devlib in header.
*#*
*#*/
#include "signal.h"
-#include "proc.h"
-#include "proc_p.h"
-#include "hw.h"
+
+#include <kern/proc.h>
+#include <kern/proc_p.h>
#include <cfg/debug.h>
#if CONFIG_KERN_SIGNALS
/*#*
*#* $Log$
+ *#* Revision 1.6 2006/02/24 01:17:05 bernie
+ *#* Update for new emulator.
+ *#*
*#* Revision 1.5 2005/11/04 16:20:02 bernie
*#* Fix reference to README.devlib in header.
*#*
move y1,x:(SP)+
move x:<$3F,y1
move y1,x:(SP)
-
- ;
+
+ ;
; Switch stacks
nop
move SP, x:(R3)
/*
* $Log$
+ * Revision 1.2 2006/02/24 01:17:05 bernie
+ * Update for new emulator.
+ *
* Revision 1.1 2005/11/27 03:06:15 bernie
* Add x86_64 task switching (to be updated to new-style scheduler).
*
*
*/
-!!!!!! THIS FILE HAS NOT BEEN REVISED FOR THE NEW SCHEDULER API !!!!!!
-
/* I know it's ugly... */
#.intel_syntax
-/* void AsmSwitchContext(void * new_sp, void ** save_sp) */
+/* void AsmSwitchContext(void **new_sp, void **save_sp) */
+/* %rdi %rsi
.globl AsmSwitchContext
AsmSwitchContext:
pushq %rax
pushq %rdi
pushq %rbp
movq %rsp,(%rsi) /* *save_sp = rsp */
- movq %rdi,%rsp /* rsp = new_sp */
+ movq (%rdi),%rsp /* rsp = *new_sp */
popq %rbp
popq %rdi
popq %rsi
popq %rax
ret
-/* void AsmReplaceContext(void * new_sp, void ** dummy) */
-.globl AsmReplaceContext
-AsmReplaceContext:
- movq %rdi,%rsp /* rsp = new_sp */
- popq %rbp
- popq %rdi
- popq %rsi
- popq %rdx
- popq %rcx
- popq %rbx
- popq %rax
+/* int asm_switch_version(void) */
+.globl asm_switch_version
+asm_switch_version:
+ mov $1,%rax
ret
/*#*
*#* $Log$
+ *#* Revision 1.6 2006/02/24 01:17:44 bernie
+ *#* Update for new emulator.
+ *#*
*#* Revision 1.5 2006/02/24 00:26:21 bernie
*#* Fix header name.
*#*
#if CONFIG_KERNEL
#include <config_kern.h>
#if defined(CONFIG_KERN_SIGNALS) && CONFIG_KERN_SIGNALS
- #include "signal.h"
+ #include <kern/signal.h>
#endif
#endif