From a9c84e00da6824d43126b1e221e6e6e95cc276c8 Mon Sep 17 00:00:00 2001 From: jhb Date: Sat, 10 Feb 2001 02:20:34 +0000 Subject: - Make astpending and need_resched process attributes rather than CPU attributes. This is needed for AST's to be properly posted in a preemptive kernel. They are backed by two new flags in p_sflag: PS_ASTPENDING and PS_NEEDRESCHED. They are still accesssed by their old macros: aston(), astoff(), etc. For completeness, an astpending() macro has been added to check for a pending AST, and clear_resched() has been added to clear need_resched(). - Rename syscall2() on the x86 back to syscall() to be consistent with other architectures. --- sys/amd64/include/cpu.h | 44 +++++++------------------------------------- 1 file changed, 7 insertions(+), 37 deletions(-) (limited to 'sys/amd64/include/cpu.h') diff --git a/sys/amd64/include/cpu.h b/sys/amd64/include/cpu.h index 0b99ec6..e644b50 100644 --- a/sys/amd64/include/cpu.h +++ b/sys/amd64/include/cpu.h @@ -59,32 +59,17 @@ #define cpu_getstack(p) ((p)->p_md.md_regs->tf_esp) #define cpu_setstack(p, ap) ((p)->p_md.md_regs->tf_esp = (ap)) +#define TRAPF_USERMODE(framep) \ + ((ISPL((framep)->tf_cs) == SEL_UPL) || ((framep)->tf_eflags & PSL_VM)) +#define TRAPF_PC(framep) ((framep)->tf_eip) + #define CLKF_USERMODE(framep) \ - ((ISPL((framep)->cf_cs) == SEL_UPL) || (framep->cf_eflags & PSL_VM)) + ((ISPL((framep)->cf_cs) == SEL_UPL) || ((framep)->cf_eflags & PSL_VM)) #define CLKF_INTR(framep) (curproc->p_intr_nesting_level >= 2) #define CLKF_PC(framep) ((framep)->cf_eip) /* - * astpending bits - */ -#define AST_PENDING 0x00000001 -#define AST_RESCHED 0x00000002 - -/* - * Preempt the current process if in interrupt from user mode, - * or after the current trap/syscall if in system mode. - * - * XXX: if astpending is later changed to an |= here due to more flags being - * added, we will have an atomicy problem. The type of atomicy we need is - * a non-locked orl. - */ -#define need_resched() do { \ - PCPU_SET(astpending, AST_RESCHED|AST_PENDING); \ -} while (0) -#define resched_wanted() (PCPU_GET(astpending) & AST_RESCHED) - -/* * Arrange to handle pending profiling ticks before returning to user mode. * * XXX this is now poorly named and implemented. It used to handle only a @@ -92,28 +77,13 @@ * counter in the proc table and flag isn't really necessary. */ #define need_proftick(p) do { \ - mtx_lock_spin(&sched_lock); \ + mtx_lock_spin(&sched_lock); \ (p)->p_sflag |= PS_OWEUPC; \ - mtx_unlock_spin(&sched_lock); \ aston(); \ + mtx_unlock_spin(&sched_lock); \ } while (0) /* - * Notify the current process (p) that it has a signal pending, - * process as soon as possible. - * - * XXX: aston() really needs to be an atomic (not locked, but an orl), - * in case need_resched() is set by an interrupt. But with astpending a - * per-cpu variable this is not trivial to do efficiently. For now we blow - * it off (asynchronous need_resched() conflicts are not critical). - */ -#define signotify(p) aston() -#define aston() do { \ - PCPU_SET(astpending, PCPU_GET(astpending) | AST_PENDING); \ -} while (0) -#define astoff() - -/* * CTL_MACHDEP definitions. */ #define CPU_CONSDEV 1 /* dev_t: console terminal device */ -- cgit v1.1