bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Gnumach cleanup Round 4


From: Barry deFreese
Subject: Gnumach cleanup Round 4
Date: Sun, 12 Nov 2006 21:19:06 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050513 Debian/1.7.8-1

Heya gang.

OK, I was working on a much bigger patch but got hung up on some of the
chario / tty stuff.  So I am sending what I have for now.

  * i386/i386/locore.h  New file
  * i386/i386/pcb.h  New file
  * i386/i386/spl.h  Add function declarations
  * i386/i386at/kd_event.h  New file
  * i386/i386at/kd_mouse.h  New file
  * i386/i386at/model_dep.h  New file
  * i386/i386at/kd.c  Include new kd_event.h and kd_mouse.h.
  * i386/i386at/kd.h  Remove prototypes for splx() and spltty().
  * i386/i386at/lpr.c  Remove prototypes for splx() and spltty().
  * ipc/mach_msg.c  Include new locore.h and pcb.h
  * kern/debug.c  Include new i386at/model_dep.h
  * kern/mach_clock.h  New file
  * kern/mach_clock.c  New includes:
    * i386at/model_dep.h
    * kern/mach_clock.h
    * kern/queue.h
    * kern/timer.h
  * kern/mach_factor.h  New file
  * kern/sched_prim.c  New includes:
    * i386at/model_dep.h
    * kern/mach_factor.h
  * kern/thread.c  Include new i386/pcb.h

Thanks!

Barry deFreese (aka bddebian)

Index: i386/i386/locore.h
===================================================================
RCS file: i386/i386/locore.h
diff -N i386/i386/locore.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ i386/i386/locore.h  12 Nov 2006 20:21:57 -0000
@@ -0,0 +1,39 @@
+/*
+ * 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 <sys/types.h>
+#include <stdarg.h>
+
+#include <kern/sched_prim.h>
+
+extern int copyin (const void *userbuf, void *driverbuf, size_t cn);
+
+extern int copyinmsg (vm_offset_t userbuf, vm_offset_t driverbuf, size_t cn);
+
+extern int copyout (const void *userbuf, void *driverbuf, size_t cn);
+
+extern int copyoutmsg (vm_offset_t userbuf, vm_offset_t driverbuf, size_t cn);
+
+extern int call_continuation (continuation_t continuation);
+
+#endif /* _MACHINE__LOCORE_H_ */
+
Index: i386/i386/pcb.h
===================================================================
RCS file: i386/i386/pcb.h
diff -N i386/i386/pcb.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ i386/i386/pcb.h     12 Nov 2006 20:21:57 -0000
@@ -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 <sys/types.h>
+
+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_ */
Index: i386/i386/spl.h
===================================================================
RCS file: /cvsroot/hurd/gnumach/i386/i386/spl.h,v
retrieving revision 1.2
diff -u -p -r1.2 spl.h
--- i386/i386/spl.h     26 Apr 1999 05:26:12 -0000      1.2
+++ i386/i386/spl.h     12 Nov 2006 20:21:57 -0000
@@ -48,6 +48,28 @@ extern spl_t (spldcm)(void);
 
 extern spl_t   (spl6)(void);
 
+extern int spl0 (void);
+
+extern int splsched (void);
+
+extern int splx (int n);
+
+extern int splsoftclock (void);
+
+extern void splon (int n);
+
+extern int 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 <i386/ipl.h>
 
Index: i386/i386at/kd.c
===================================================================
RCS file: /cvsroot/hurd/gnumach/i386/i386at/Attic/kd.c,v
retrieving revision 1.5.2.9
diff -u -p -r1.5.2.9 kd.c
--- i386/i386at/kd.c    11 Nov 2006 00:54:05 -0000      1.5.2.9
+++ i386/i386at/kd.c    12 Nov 2006 20:21:59 -0000
@@ -91,6 +91,8 @@ WITH THE USE OR PERFORMANCE OF THIS SOFT
 #include <i386/pio.h>
 #include <i386at/cram.h>
 #include <i386at/kd.h>
+#include <i386at/kd_event.h>
+#include <i386at/kd_mouse.h>
 #include <i386at/kdsoft.h>
 #include <device/cons.h>
 
Index: i386/i386at/kd.h
===================================================================
RCS file: /cvsroot/hurd/gnumach/i386/i386at/Attic/kd.h,v
retrieving revision 1.3.2.1
diff -u -p -r1.3.2.1 kd.h
--- i386/i386at/kd.h    2 Feb 2004 21:44:40 -0000       1.3.2.1
+++ i386/i386at/kd.h    12 Nov 2006 20:21:59 -0000
@@ -567,8 +567,6 @@ extern u_char       key_map[NUMKEYS][WIDTH_KMA
 
 #ifdef KERNEL
 #include <i386/machspl.h>
-extern void splx();
-extern spl_t spltty();
 #define SPLKD  spltty
 #endif /* KERNEL */
 
Index: i386/i386at/kd_event.h
===================================================================
RCS file: i386/i386at/kd_event.h
diff -N i386/i386at/kd_event.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ i386/i386at/kd_event.h      12 Nov 2006 20:21:59 -0000
@@ -0,0 +1,35 @@
+/*
+ * 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_
+
+#include <sys/types.h>
+
+extern void X_kdb_enter (void);
+
+extern void X_kdb_exit (void);
+
+#endif /* _KD_EVENT_H_ */
Index: i386/i386at/kd_mouse.h
===================================================================
RCS file: i386/i386at/kd_mouse.h
diff -N i386/i386at/kd_mouse.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ i386/i386at/kd_mouse.h      12 Nov 2006 20:21:59 -0000
@@ -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 <sys/types.h>
+
+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_ */
Index: i386/i386at/lpr.c
===================================================================
RCS file: /cvsroot/hurd/gnumach/i386/i386at/Attic/lpr.c,v
retrieving revision 1.1.1.1.4.7
diff -u -p -r1.1.1.1.4.7 lpr.c
--- i386/i386at/lpr.c   11 Nov 2006 00:54:05 -0000      1.1.1.1.4.7
+++ i386/i386at/lpr.c   12 Nov 2006 20:21:59 -0000
@@ -57,8 +57,6 @@
 #include <chips/busses.h>
 #include <i386at/lprreg.h>
   
-extern void    splx();
-extern spl_t   spltty();
 extern void    timeout();
 extern void    ttrstrt();
 
Index: i386/i386at/model_dep.h
===================================================================
RCS file: i386/i386at/model_dep.h
diff -N i386/i386at/model_dep.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ i386/i386at/model_dep.h     12 Nov 2006 20:21:59 -0000
@@ -0,0 +1,86 @@
+/*
+ * Arch dependent functions
+ * 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.
+ */
+/*
+ *     Arch dependent functions.
+ *
+ */
+
+#ifndef _I386AT_MODEL_DEP_H_
+#define _I386AT_MODEL_DEP_H_
+
+#include <sys/types.h>
+#include <mach/std_types.h>
+
+/*
+ * Find devices.  The system is alive.
+ */
+extern void machine_init (void);
+
+/* Conserve power on processor CPU.  */
+extern void machine_idle (int cpu);
+
+/*
+ * Halt a cpu.
+ */
+extern void halt_cpu (void);
+
+/*
+ * Halt the system or reboot.
+ */
+extern void halt_all_cpus (boolean_t reboot);
+
+/*
+ * Compute physical memory size and other parameters.
+ */
+extern void mem_size_init (void);
+
+/*
+ * Basic PC VM initialization.
+ * Turns on paging and changes the kernel segments to use high linear addresse$
+ */
+extern void i386at_init (void);
+
+/*
+ *  C boot entrypoint - called by boot_entry in boothdr.S.
+ *  Running in 32-bit flat mode, but without paging yet.
+ */
+extern void c_boot_entry(vm_offset_t bi);
+
+extern void inittodr (void);
+
+extern void resettodr (void);
+
+extern unsigned int pmap_free_pages (void);
+
+/* Always returns page-aligned regions.  */
+extern boolean_t
+init_alloc_aligned(vm_size_t size, vm_offset_t *addrp);
+
+extern boolean_t pmap_next_page (vm_offset_t addrp);
+
+/* Grab a physical page:
+   the standard memory allocation mechanism
+   during system initialization.  */
+extern vm_offset_t pmap_grab_page (void);
+
+extern boolean_t pmap_valid_page(vm_offset_t x);
+
+#endif /* _I386AT_MODEL_DEP_H_ */
Index: ipc/mach_msg.c
===================================================================
RCS file: /cvsroot/hurd/gnumach/ipc/mach_msg.c,v
retrieving revision 1.2.2.5
diff -u -p -r1.2.2.5 mach_msg.c
--- ipc/mach_msg.c      10 Nov 2006 01:22:58 -0000      1.2.2.5
+++ ipc/mach_msg.c      12 Nov 2006 20:22:00 -0000
@@ -58,8 +58,8 @@
 #include <ipc/ipc_thread.h>
 #include <ipc/ipc_entry.h>
 #include <ipc/mach_msg.h>
-
-
+#include <machine/locore.h>
+#include <machine/pcb.h>
 
 extern void exception_raise_continue();
 extern void exception_raise_continue_fast();
Index: kern/debug.c
===================================================================
RCS file: /cvsroot/hurd/gnumach/kern/Attic/debug.c,v
retrieving revision 1.3.2.4
diff -u -p -r1.3.2.4 debug.c
--- kern/debug.c        9 Nov 2006 23:33:45 -0000       1.3.2.4
+++ kern/debug.c        12 Nov 2006 20:22:00 -0000
@@ -27,6 +27,7 @@
 #include <kern/printf.h>
 #include <stdarg.h>
 
+#include <i386at/model_dep.h>
 #include "cpu_number.h"
 #include <kern/lock.h>
 #include <kern/thread.h>
Index: kern/mach_clock.c
===================================================================
RCS file: /cvsroot/hurd/gnumach/kern/mach_clock.c,v
retrieving revision 1.4.2.4
diff -u -p -r1.4.2.4 mach_clock.c
--- kern/mach_clock.c   10 Nov 2006 01:22:58 -0000      1.4.2.4
+++ kern/mach_clock.c   12 Nov 2006 20:22:00 -0000
@@ -42,17 +42,21 @@
 #include <mach/vm_param.h>
 #include <mach/vm_prot.h>
 #include <kern/counters.h>
+#include <i386at/model_dep.h>
 #include "cpu_number.h"
 #include <kern/debug.h>
 #include <kern/host.h>
 #include <kern/lock.h>
+#include <kern/mach_clock.h>
 #include <kern/mach_param.h>
 #include <kern/processor.h>
+#include <kern/queue.h>
 #include <kern/sched.h>
 #include <kern/sched_prim.h>
 #include <kern/thread.h>
 #include <kern/time_out.h>
 #include <kern/time_stamp.h>
+#include <kern/timer.h>
 #include <vm/vm_kern.h>
 #include <sys/time.h>
 #include <machine/mach_param.h>        /* HZ */
Index: kern/mach_clock.h
===================================================================
RCS file: kern/mach_clock.h
diff -N kern/mach_clock.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ kern/mach_clock.h   12 Nov 2006 20:22:00 -0000
@@ -0,0 +1,66 @@
+/*
+ *
+ * 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 <sys/types.h>
+
+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_ */
Index: kern/mach_factor.h
===================================================================
RCS file: kern/mach_factor.h
diff -N kern/mach_factor.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ kern/mach_factor.h  12 Nov 2006 20:22:00 -0000
@@ -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 <sys/types.h>
+
+extern void compute_mach_factor();
+
+#endif /* _KERN_MACH_FACTOR_H_ */
Index: kern/sched_prim.c
===================================================================
RCS file: /cvsroot/hurd/gnumach/kern/sched_prim.c,v
retrieving revision 1.2.2.4
diff -u -p -r1.2.2.4 sched_prim.c
--- kern/sched_prim.c   10 Nov 2006 01:22:59 -0000      1.2.2.4
+++ kern/sched_prim.c   12 Nov 2006 20:22:01 -0000
@@ -32,6 +32,7 @@
  *
  */
 
+#include <i386at/model_dep.h>
 #include <kern/printf.h>
 #include <mach/machine.h>
 #include <kern/ast.h>
@@ -39,6 +40,7 @@
 #include <kern/cpu_number.h>
 #include <kern/debug.h>
 #include <kern/lock.h>
+#include <kern/mach_factor.h>
 #include <kern/macro_help.h>
 #include <kern/processor.h>
 #include <kern/queue.h>
Index: kern/thread.c
===================================================================
RCS file: /cvsroot/hurd/gnumach/kern/thread.c,v
retrieving revision 1.3.4.6
diff -u -p -r1.3.4.6 thread.c
--- kern/thread.c       10 Nov 2006 01:22:59 -0000      1.3.4.6
+++ kern/thread.c       12 Nov 2006 20:22:02 -0000
@@ -57,6 +57,7 @@
 #include <ipc/ipc_port.h>
 #include <ipc/mach_msg.h>
 #include <machine/machspl.h>           /* for splsched */
+#include <machine/pcb.h>
 #include <machine/thread.h>            /* for MACHINE_STACK */
 
 thread_t active_threads[NCPUS];

reply via email to

[Prev in Thread] Current Thread [Next in Thread]