From f387d24c7d59cfd219c3b795a512981347240380 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sun, 12 Nov 2006 23:45:07 +0000 Subject: 2006-11-13 Barry deFreese * i386/i386/locore.h: New file. * i386/i386/pcb.h: New file. * i386/i386/pcb.c: Include `pcb.h'. * i386/i386/pit.c (clkstart): Fix type of s into unsigned long. * i386/i386/spl.h (spl0, splsched, splx, splsoftclock, splon, sploff) (splhigh, splimp, spltty, splclock, setsoftclock): Add prototype. * i386/i386at/kd_event.h: New file. * i386/i386at/kd_event.c: Include `kd_event.h'. * i386/i386at/kd_mouse.h: New file. * i386/i386at/kd_mouse.c: Include `kd_mouse.h'. (mouseclose): Fix call of `serial_mouse_close' function. * i386/i386at/kd.c: Include `kd_event.h' and `kd_mouse.h'. * i386/i386at/kd.h (splx, spltty): Remove prototypes.h * i386/i386at/lpr.c: Likewise. * ipc/mach_msg.c: Include `machine/locore.h' and `machine/pcb.h'. * kern/mach_clock.h: New file. * kern/mach_clock.c: Include `kern/queue.h', `kern/timer.h' and `mach_clock.h'. * kern/mach_factor.h: New file. * kern/mach_factor.c: Include `mach_factor.h'. * kern/sched_prim.c: Include `kern/mach_factor.h'. * kern/thread.c: Include `machine/pcb.h'. --- ChangeLog | 25 +++++++++++++++++++ i386/i386/locore.h | 38 ++++++++++++++++++++++++++++ i386/i386/pcb.c | 1 + i386/i386/pcb.h | 61 ++++++++++++++++++++++++++++++++++++++++++++ i386/i386/pit.c | 2 +- i386/i386/spl.h | 22 ++++++++++++++++ i386/i386at/kd.c | 2 ++ i386/i386at/kd.h | 2 -- i386/i386at/kd_event.c | 2 ++ i386/i386at/kd_event.h | 33 ++++++++++++++++++++++++ i386/i386at/kd_mouse.c | 4 ++- i386/i386at/kd_mouse.h | 57 ++++++++++++++++++++++++++++++++++++++++++ i386/i386at/lpr.c | 2 -- ipc/mach_msg.c | 4 +-- kern/mach_clock.c | 3 +++ kern/mach_clock.h | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++ kern/mach_factor.c | 1 + kern/mach_factor.h | 32 ++++++++++++++++++++++++ kern/sched_prim.c | 1 + kern/thread.c | 1 + 20 files changed, 353 insertions(+), 8 deletions(-) create mode 100644 i386/i386/locore.h create mode 100644 i386/i386/pcb.h create mode 100644 i386/i386at/kd_event.h create mode 100644 i386/i386at/kd_mouse.h create mode 100644 kern/mach_clock.h create mode 100644 kern/mach_factor.h diff --git a/ChangeLog b/ChangeLog index 41457b4..778abb7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,28 @@ +2006-11-13 Barry deFreese + + * i386/i386/locore.h: New file. + * i386/i386/pcb.h: New file. + * i386/i386/pcb.c: Include `pcb.h'. + * i386/i386/pit.c (clkstart): Fix type of s into unsigned long. + * i386/i386/spl.h (spl0, splsched, splx, splsoftclock, splon, sploff) + (splhigh, splimp, spltty, splclock, setsoftclock): Add prototype. + * i386/i386at/kd_event.h: New file. + * i386/i386at/kd_event.c: Include `kd_event.h'. + * i386/i386at/kd_mouse.h: New file. + * i386/i386at/kd_mouse.c: Include `kd_mouse.h'. + (mouseclose): Fix call of `serial_mouse_close' function. + * i386/i386at/kd.c: Include `kd_event.h' and `kd_mouse.h'. + * i386/i386at/kd.h (splx, spltty): Remove prototypes.h + * i386/i386at/lpr.c: Likewise. + * ipc/mach_msg.c: Include `machine/locore.h' and `machine/pcb.h'. + * kern/mach_clock.h: New file. + * kern/mach_clock.c: Include `kern/queue.h', `kern/timer.h' and + `mach_clock.h'. + * kern/mach_factor.h: New file. + * kern/mach_factor.c: Include `mach_factor.h'. + * kern/sched_prim.c: Include `kern/mach_factor.h'. + * kern/thread.c: Include `machine/pcb.h'. + 2006-11-11 Thomas Schwinge * Makefile.am (gnumach-undef-bad): Depend on the Makefile. diff --git a/i386/i386/locore.h b/i386/i386/locore.h new file mode 100644 index 0000000..ca3467d --- /dev/null +++ b/i386/i386/locore.h @@ -0,0 +1,38 @@ +/* + * Header file for printf type functions. + * Copyright (C) 2006 Free Software Foundation. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef _MACHINE_LOCORE_H_ +#define _MACHINE_LOCORE_H_ + +#include + +#include + +extern int copyin (const void *userbuf, void *kernelbuf, size_t cn); + +extern int copyinmsg (vm_offset_t userbuf, vm_offset_t kernelbuf, size_t cn); + +extern int copyout (const void *kernelbuf, void *userbuf, size_t cn); + +extern int copyoutmsg (vm_offset_t kernelbuf, vm_offset_t userbuf, size_t cn); + +extern int call_continuation (continuation_t continuation); + +#endif /* _MACHINE__LOCORE_H_ */ + diff --git a/i386/i386/pcb.c b/i386/i386/pcb.c index a660357..f431e89 100644 --- a/i386/i386/pcb.c +++ b/i386/i386/pcb.c @@ -50,6 +50,7 @@ #include "gdt.h" #include "ldt.h" #include "ktss.h" +#include "pcb.h" #if NCPUS > 1 #include diff --git a/i386/i386/pcb.h b/i386/i386/pcb.h new file mode 100644 index 0000000..e7d3363 --- /dev/null +++ b/i386/i386/pcb.h @@ -0,0 +1,61 @@ +/* + * + * Copyright (C) 2006 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Author: Barry deFreese. + */ +/* + * + * + */ + +#ifndef _I386_PCB_H_ +#define _I386_PCB_H_ + +#include + +extern void pcb_init (thread_t thread); + +extern void pcb_terminate (thread_t thread); + +extern void pcb_collect (thread_t thread); + +extern kern_return_t thread_setstatus ( + thread_t thread, + int flavor, + thread_state_t tstate, + unsigned int count); + +extern kern_return_t thread_getstatus ( + thread_t thread, + int flavor, + thread_state_t tstate, + unsigned int *count); + +extern void thread_set_syscall_return ( + thread_t thread, + kern_return_t retval); + +extern vm_offset_t user_stack_low (vm_size_t stack_size); + +extern vm_offset_t set_user_regs ( + vm_offset_t stack_base, + vm_offset_t stack_size, + struct exec_info *exec_info, + vm_size_t arg_size); + +#endif /* _I386_PCB_H_ */ diff --git a/i386/i386/pit.c b/i386/i386/pit.c index b9d71db..5c927c3 100644 --- a/i386/i386/pit.c +++ b/i386/i386/pit.c @@ -68,7 +68,7 @@ unsigned int clknumb = CLKNUM; /* interrupt interval for timer 0 */ clkstart() { unsigned char byte; - int s; + unsigned long s; intpri[0] = SPLHI; form_pic_mask(); diff --git a/i386/i386/spl.h b/i386/i386/spl.h index 7208ac8..8552e11 100644 --- a/i386/i386/spl.h +++ b/i386/i386/spl.h @@ -34,6 +34,8 @@ typedef int spl_t; extern spl_t (splhi)(void); +extern spl_t (spl0)(void); + extern spl_t (spl1)(void); extern spl_t (spl2)(void); @@ -48,6 +50,26 @@ extern spl_t (spldcm)(void); extern spl_t (spl6)(void); +extern spl_t (splsched)(void); + +extern spl_t (splx)(spl_t n); + +extern spl_t (splsoftclock)(void); + +extern void splon (unsigned long n); + +extern unsigned long sploff (void); + +extern spl_t splhigh (void); + +extern spl_t splimp (void); + +extern spl_t spltty (void); + +extern spl_t splclock (void); + +extern void setsoftclock (void); + /* XXX Include each other... */ #include diff --git a/i386/i386at/kd.c b/i386/i386at/kd.c index b8249c2..144b87a 100644 --- a/i386/i386at/kd.c +++ b/i386/i386at/kd.c @@ -91,6 +91,8 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include #include +#include +#include #include #include diff --git a/i386/i386at/kd.h b/i386/i386at/kd.h index 9abea8e..2e8f831 100644 --- a/i386/i386at/kd.h +++ b/i386/i386at/kd.h @@ -567,8 +567,6 @@ extern u_char key_map[NUMKEYS][WIDTH_KMAP]; #ifdef KERNEL #include -extern void splx(); -extern spl_t spltty(); #define SPLKD spltty #endif /* KERNEL */ diff --git a/i386/i386at/kd_event.c b/i386/i386at/kd_event.c index ff70ce0..993dc44 100644 --- a/i386/i386at/kd_event.c +++ b/i386/i386at/kd_event.c @@ -77,6 +77,8 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include +#include "kd_event.h" + /* * Code for /dev/kbd. The interrupt processing is done in kd.c, * which calls into this module to enqueue scancode events when diff --git a/i386/i386at/kd_event.h b/i386/i386at/kd_event.h new file mode 100644 index 0000000..677af99 --- /dev/null +++ b/i386/i386at/kd_event.h @@ -0,0 +1,33 @@ +/* + * Keyboard event handlers + * Copyright (C) 2006 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Author: Barry deFreese. + */ +/* + * Keyboard event handling functions. + * + */ + +#ifndef _KD_EVENT_H_ +#define _KD_EVENT_H_ + +extern void X_kdb_enter (void); + +extern void X_kdb_exit (void); + +#endif /* _KD_EVENT_H_ */ diff --git a/i386/i386at/kd_mouse.c b/i386/i386at/kd_mouse.c index b02e792..5e8b858 100644 --- a/i386/i386at/kd_mouse.c +++ b/i386/i386at/kd_mouse.c @@ -87,6 +87,8 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include +#include "kd_mouse.h" + static int (*oldvect)(); /* old interrupt vector */ static int oldunit; static spl_t oldspl; @@ -263,7 +265,7 @@ mouseclose(dev, flags) case MICROSOFT_MOUSE7: case MOUSE_SYSTEM_MOUSE: case LOGITECH_TRACKMAN: - serial_mouse_close(dev); + serial_mouse_close(dev, flags); break; case IBM_MOUSE: ibm_ps2_mouse_close(dev); diff --git a/i386/i386at/kd_mouse.h b/i386/i386at/kd_mouse.h new file mode 100644 index 0000000..baa51c8 --- /dev/null +++ b/i386/i386at/kd_mouse.h @@ -0,0 +1,57 @@ +/* + * Mouse event handlers + * Copyright (C) 2006 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Author: Barry deFreese. + */ +/* + * Mouse event handling functions. + * + */ + +#ifndef _KD_MOUSE_H_ +#define _KD_MOUSE_H_ + +#include + +extern void mouse_button (kev_type which, u_char direction); + +extern void mouse_enqueue (kd_event *ev); + +extern void mouse_moved (struct mouse_motion where); + +extern void mouse_handle_byte (u_char ch); + +extern void serial_mouse_open (dev_t dev); + +extern void serial_mouse_close (dev_t dev, int flags); + +extern void kd_mouse_open (dev_t dev, int mouse_pic); + +extern void kd_mouse_close (dev_t dev, int mouse_pic); + +extern void ibm_ps2_mouse_open (dev_t dev); + +extern void ibm_ps2_mouse_close (dev_t dev); + +extern void mouse_packet_microsoft_mouse (u_char *mousebuf); + +extern void mouse_packet_mouse_system_mouse (u_char *mousebuf); + +extern void mouse_packet_ibm_ps2_mouse (u_char *mousebuf); + +#endif /* _KD_MOUSE_H_ */ diff --git a/i386/i386at/lpr.c b/i386/i386at/lpr.c index d68313d..f2fa032 100644 --- a/i386/i386at/lpr.c +++ b/i386/i386at/lpr.c @@ -57,8 +57,6 @@ #include #include -extern void splx(); -extern spl_t spltty(); extern void timeout(); extern void ttrstrt(); diff --git a/ipc/mach_msg.c b/ipc/mach_msg.c index 593cf19..5824d8d 100644 --- a/ipc/mach_msg.c +++ b/ipc/mach_msg.c @@ -58,8 +58,8 @@ #include #include #include - - +#include +#include extern void exception_raise_continue(); extern void exception_raise_continue_fast(); diff --git a/kern/mach_clock.c b/kern/mach_clock.c index 3c1ccdb..5491e88 100644 --- a/kern/mach_clock.c +++ b/kern/mach_clock.c @@ -48,11 +48,13 @@ #include #include #include +#include #include #include #include #include #include +#include #include #include #include /* HZ */ @@ -62,6 +64,7 @@ #include #endif +#include "mach_clock.h" void softclock(); /* forward */ diff --git a/kern/mach_clock.h b/kern/mach_clock.h new file mode 100644 index 0000000..e6f746b --- /dev/null +++ b/kern/mach_clock.h @@ -0,0 +1,68 @@ +/* + * + * Copyright (C) 2006 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Author: Barry deFreese. + */ +/* + * + */ + +#ifndef _KERN_MACH_CLOCK_H_ +#define _KERN_MACH_CLOCK_H_ + +#include +#include +#include + +extern void clock_interrupt( + int usec, + boolean_t usermode, + boolean_t basepri); + +extern void softclock(); + +extern void set_timeout( + timer_elt_t telt, + unsigned int interval); + +extern boolean_t reset_timeout(timer_elt_t telt); + +extern void init_timeout(); + +extern void record_time_stamp (time_value_t *stamp); + +extern kern_return_t host_get_time( + host_t host, + time_value_t *current_time); + +extern kern_return_t host_set_time( + host_t host, + time_value_t new_time); + +extern kern_return_t host_adjust_time( + host_t host, + time_value_t new_adjustment, + time_value_t *old_adjustment); + +extern void mapable_time_init(); + +extern void timeout(int (*fcn)(), char *param, int interval); + +extern boolean_t untimeout(int (*fcn)(), char *param); + +#endif /* _KERN_MACH_CLOCK_H_ */ diff --git a/kern/mach_factor.c b/kern/mach_factor.c index d9e0465..16ca1f4 100644 --- a/kern/mach_factor.c +++ b/kern/mach_factor.c @@ -41,6 +41,7 @@ #include #endif /* MACH_KERNEL */ +#include "mach_factor.h" long avenrun[3] = {0, 0, 0}; long mach_factor[3] = {0, 0, 0}; diff --git a/kern/mach_factor.h b/kern/mach_factor.h new file mode 100644 index 0000000..81624bb --- /dev/null +++ b/kern/mach_factor.h @@ -0,0 +1,32 @@ +/* + * + * Copyright (C) 2006 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Author: Barry deFreese. + */ +/* + * + */ + +#ifndef _KERN_MACH_FACTOR_H_ +#define _KERN_MACH_FACTOR_H_ + +#include + +extern void compute_mach_factor(); + +#endif /* _KERN_MACH_FACTOR_H_ */ diff --git a/kern/sched_prim.c b/kern/sched_prim.c index 37f6291..69888e8 100644 --- a/kern/sched_prim.c +++ b/kern/sched_prim.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include diff --git a/kern/thread.c b/kern/thread.c index c90acda..8c08dc4 100644 --- a/kern/thread.c +++ b/kern/thread.c @@ -57,6 +57,7 @@ #include #include #include /* for splsched */ +#include #include /* for MACHINE_STACK */ thread_t active_threads[NCPUS]; -- cgit v1.2.3