Leonardo Lopes Pereira, le lun. 06 avril 2026 16:42:43 +0200, a ecrit:
> TTD (Target Transport Debugger) was hardwired to 0 in configfrag.ac.

That's not a good reason :)

But I don't see it that useful nowadays indeed, we usually just use kdb
over a serial port.

So applied, thanks!

Samuel

> Remove kttd_interface.c and all MACH_TTD blocks from trap.c, locore.S,
> spl.S, net_io.c and autoconf.c.
> ---
>  configfrag.ac              |   3 -
>  device/net_io.c            |  26 --
>  i386/Makefrag_x86.am       |   1 -
>  i386/i386/kttd_interface.c | 574 -------------------------------------
>  i386/i386/locore.S         |  81 +-----
>  i386/i386/spl.S            |   8 +-
>  i386/i386/trap.c           |  28 --
>  i386/i386at/autoconf.c     |   6 -
>  x86_64/locore.S            |  86 +-----
>  x86_64/spl.S               |   8 +-
>  10 files changed, 14 insertions(+), 807 deletions(-)
>  delete mode 100644 i386/i386/kttd_interface.c
> 
> diff --git a/configfrag.ac b/configfrag.ac
> index d38519f6..81384847 100644
> --- a/configfrag.ac
> +++ b/configfrag.ac
> @@ -108,9 +108,6 @@ AC_ARG_ENABLE([kernsample],
>    AC_DEFINE([MACH_KERNSAMPLE], [0], [MACH_KERNSAMPLE])
>  [fi]
>  
> -# TTD Remote Kernel Debugging.
> -AC_DEFINE([MACH_TTD], [0], [MACH_TTD])
> -
>  # VM debugging calls.
>  AC_DEFINE([MACH_VM_DEBUG], [1], [MACH_VM_DEBUG])
>  
> diff --git a/device/net_io.c b/device/net_io.c
> index 01c6a707..7b5c3e74 100644
> --- a/device/net_io.c
> +++ b/device/net_io.c
> @@ -66,13 +66,6 @@
>  
>  #include <machine/spl.h>
>  
> -#if  MACH_TTD
> -#include <ttd/ttd_stub.h>
> -#endif       /* MACH_TTD */
> -
> -#if  MACH_TTD
> -int kttd_async_counter= 0;
> -#endif       /* MACH_TTD */
>  
>  
>  /*
> @@ -637,25 +630,6 @@ net_packet(
>  {
>       boolean_t awake;
>  
> -#if  MACH_TTD
> -     /*
> -      * Do a quick check to see if it is a kernel TTD packet.
> -      *
> -      * Only check if KernelTTD is enabled, ie. the current
> -      * device driver supports TTD, and the bootp succeeded.
> -      */
> -     if (kttd_enabled && kttd_handle_async(kmsg)) {
> -             /* 
> -              * Packet was a valid ttd packet and
> -              * doesn't need to be passed up to filter.
> -              * The ttd code put the used kmsg buffer
> -              * back onto the free list.
> -              */
> -             if (kttd_debug)
> -                     printf("**%x**", kttd_async_counter++);
> -             return;
> -     }
> -#endif       /* MACH_TTD */
>  
>       kmsg->ikm_header.msgh_remote_port = (mach_port_t) ifp;
>       net_kmsg(kmsg)->net_rcv_msg_packet_count = count;
> diff --git a/i386/Makefrag_x86.am b/i386/Makefrag_x86.am
> index a6c7a5c8..56bcf2a8 100644
> --- a/i386/Makefrag_x86.am
> +++ b/i386/Makefrag_x86.am
> @@ -39,7 +39,6 @@ libkernel_a_SOURCES += \
>       i386/i386/ipl.h \
>       i386/i386/ktss.c \
>       i386/i386/ktss.h \
> -     i386/i386/kttd_interface.c \
>       i386/i386/kttd_machdep.h \
>       i386/i386/ldt.c \
>       i386/i386/ldt.h \
> diff --git a/i386/i386/kttd_interface.c b/i386/i386/kttd_interface.c
> deleted file mode 100644
> index f48fe8eb..00000000
> --- a/i386/i386/kttd_interface.c
> +++ /dev/null
> @@ -1,574 +0,0 @@
> -/*
> - * Mach Operating System
> - * Copyright (c) 1993,1992 Carnegie Mellon University
> - * All Rights Reserved.
> - *
> - * Permission to use, copy, modify and distribute this software and its
> - * documentation is hereby granted, provided that both the copyright
> - * notice and this permission notice appear in all copies of the
> - * software, derivative works or modified versions, and any portions
> - * thereof, and that both notices appear in supporting documentation.
> - *
> - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
> - * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
> - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
> - *
> - * Carnegie Mellon requests users of this software to return to
> - *
> - *  Software Distribution Coordinator  or  [email protected]
> - *  School of Computer Science
> - *  Carnegie Mellon University
> - *  Pittsburgh PA 15213-3890
> - *
> - * any improvements or extensions that they make and grant Carnegie Mellon
> - * the rights to redistribute these changes.
> - */
> -
> -#if MACH_TTD
> -
> -#include <sys/types.h>
> -#include <kern/printf.h>
> -
> -#include <mach/machine/eflags.h>
> -
> -#include <kern/thread.h>
> -#include <kern/processor.h>
> -#include <mach/thread_status.h>
> -#include <mach/vm_param.h>
> -#include <i386/seg.h>
> -
> -#include <ttd/ttd_types.h>
> -#include <ttd/ttd_stub.h>
> -#include <machine/kttd_machdep.h>
> -
> -/*
> - * Shamelessly copied from the ddb sources:
> - */
> -struct        i386_saved_state *kttd_last_saved_statep;
> -struct        i386_saved_state kttd_nested_saved_state;
> -unsigned last_kttd_sp;
> -
> -struct i386_saved_state kttd_regs;   /* was ddb_regs */
> -
> -extern int           kttd_debug;
> -extern boolean_t     kttd_enabled;
> -extern vm_offset_t   virtual_end;
> -
> -#define      I386_BREAKPOINT 0xcc
> -
> -/*
> - *   kernel map
> - */
> -extern vm_map_t      kernel_map;
> -
> -boolean_t kttd_console_init(void)
> -{
> -     /*
> -      * Get local machine's IP address via bootp.
> -      */
> -     return(ttd_ip_bootp());
> -}
> -
> -/*
> - *   Execute a break instruction that will invoke ttd
> - */
> -void kttd_break(void)
> -{
> -     if (!kttd_enabled)
> -             return;
> -     asm("int3");
> -}
> -
> -/*
> - * Halt all processors on the 386at (not really applicable).
> - */
> -void kttd_halt_processors(void)
> -{
> -     /* XXX Fix for Sequent!!! */
> -     /* Only one on AT386, so ignore for now... */
> -}
> -
> -/*
> - * Determine whether or not the ehternet device driver supports
> - * ttd.
> - */
> -boolean_t kttd_supported(void)
> -{
> -     return ((int)ttd_get_packet != NULL);
> -}
> -
> -/*
> - * Return the ttd machine type for the i386at
> - */
> -ttd_machine_type get_ttd_machine_type(void)
> -{
> -     return TTD_AT386;
> -}
> -
> -void kttd_machine_getregs(struct i386_gdb_register_state *ttd_state)
> -{
> -     ttd_state->gs = kttd_regs.gs;
> -     ttd_state->fs = kttd_regs.fs;
> -     ttd_state->es = kttd_regs.es;
> -     ttd_state->ds = kttd_regs.ds;
> -     ttd_state->edi = kttd_regs.edi;
> -     ttd_state->esi = kttd_regs.esi;
> -     ttd_state->ebp = kttd_regs.ebp;
> -
> -     /*
> -      * This is set up to point to the right place in
> -      * kttd_trap and .
> -      */
> -     ttd_state->esp = kttd_regs.uesp;
> -
> -     ttd_state->ebx = kttd_regs.ebx;
> -     ttd_state->edx = kttd_regs.edx;
> -     ttd_state->ecx = kttd_regs.ecx;
> -     ttd_state->eax = kttd_regs.eax;
> -     ttd_state->eip = kttd_regs.eip;
> -     ttd_state->cs = kttd_regs.cs;
> -     ttd_state->efl = kttd_regs.efl;
> -     ttd_state->ss = kttd_regs.ss;
> -}
> -
> -void kttd_machine_setregs(struct i386_gdb_register_state *ttd_state)
> -{
> -     if (kttd_regs.gs != ttd_state->gs) {
> -             if (kttd_debug)
> -                     printf("gs 0x%x:0x%x, ", kttd_regs.gs, ttd_state->gs);
> -             kttd_regs.gs = ttd_state->gs;
> -     }
> -     if (kttd_regs.fs != ttd_state->fs) {
> -             if (kttd_debug)
> -                     printf("fs 0x%x:0x%x, ", kttd_regs.fs, ttd_state->fs);
> -             kttd_regs.fs = ttd_state->fs;
> -     }
> -     if (kttd_regs.es != ttd_state->es) {
> -             if (kttd_debug)
> -                     printf("es 0x%x:0x%x, ", kttd_regs.es, ttd_state->es);
> -             kttd_regs.es = ttd_state->es;
> -     }
> -     if (kttd_regs.ds != ttd_state->ds) {
> -             if (kttd_debug)
> -                     printf("ds 0x%x:0x%x, ", kttd_regs.ds, ttd_state->ds);
> -             kttd_regs.ds = ttd_state->ds;
> -     }
> -     if (kttd_regs.edi != ttd_state->edi) {
> -             if (kttd_debug)
> -                     printf("edi 0x%x:0x%x, ", kttd_regs.edi, 
> ttd_state->edi);
> -             kttd_regs.edi = ttd_state->edi;
> -     }
> -     if (kttd_regs.esi != ttd_state->esi) {
> -             if (kttd_debug)
> -                     printf("esi 0x%x:0x%x, ", kttd_regs.esi, 
> ttd_state->esi);
> -             kttd_regs.esi = ttd_state->esi;
> -     }
> -     if (kttd_regs.ebp != ttd_state->ebp) {
> -             if (kttd_debug)
> -                     printf("ebp 0x%x:0x%x, ", kttd_regs.ebp, 
> ttd_state->ebp);
> -             kttd_regs.ebp = ttd_state->ebp;
> -     }
> -     if (kttd_regs.ebx != ttd_state->ebx) {
> -             if (kttd_debug)
> -                     printf("ebx 0x%x:0x%x, ", kttd_regs.ebx, 
> ttd_state->ebx);
> -             kttd_regs.ebx = ttd_state->ebx;
> -     }
> -     if (kttd_regs.edx != ttd_state->edx) {
> -             if (kttd_debug)
> -                     printf("edx 0x%x:0x%x, ", kttd_regs.edx, 
> ttd_state->edx);
> -             kttd_regs.edx = ttd_state->edx;
> -     }
> -     if (kttd_regs.ecx != ttd_state->ecx) {
> -             if (kttd_debug)
> -                     printf("ecx 0x%x:0x%x, ", kttd_regs.ecx, 
> ttd_state->ecx);
> -             kttd_regs.ecx = ttd_state->ecx;
> -     }
> -     if (kttd_regs.eax != ttd_state->eax) {
> -             if (kttd_debug)
> -                     printf("eax 0x%x:0x%x, ", kttd_regs.eax, 
> ttd_state->eax);
> -             kttd_regs.eax = ttd_state->eax;
> -     }
> -     if (kttd_regs.eip != ttd_state->eip) {
> -             if (kttd_debug)
> -                     printf("eip 0x%x:0x%x, ", kttd_regs.eip, 
> ttd_state->eip);
> -             kttd_regs.eip = ttd_state->eip;
> -     }
> -     if (kttd_regs.cs != ttd_state->cs) {
> -             if (kttd_debug)
> -                     printf("cs 0x%x:0x%x, ", kttd_regs.cs, ttd_state->cs);
> -             kttd_regs.cs = ttd_state->cs;
> -     }
> -     if (kttd_regs.efl != ttd_state->efl) {
> -             if (kttd_debug)
> -                     printf("efl 0x%x:0x%x, ", kttd_regs.efl, 
> ttd_state->efl);
> -             kttd_regs.efl = ttd_state->efl;
> -     }
> -#if  0
> -     /*
> -      * We probably shouldn't mess with the uesp or the ss? XXX
> -      */
> -     if (kttd_regs.ss != ttd_state->ss) {
> -             if (kttd_debug)
> -                     printf("ss 0x%x:0x%x, ", kttd_regs.ss, ttd_state->ss);
> -             kttd_regs.ss = ttd_state->ss;
> -     }
> -#endif       /* 0 */
> -
> -}
> -
> -/*
> - *   Enable a page for access, faulting it in if necessary
> - */
> -boolean_t kttd_mem_access(vm_offset_t offset, vm_prot_t access)
> -{
> -     kern_return_t   code;
> -
> -     /*
> -      *      VM_MIN_KERNEL_ADDRESS if the beginning of equiv
> -      *      mapped kernel memory.  virtual_end is the end.
> -      *      If it's in between it's always accessible
> -      */
> -     if (offset >= VM_MIN_KERNEL_ADDRESS && offset < virtual_end)
> -             return TRUE;
> -
> -     if (offset >= virtual_end) {
> -             /*
> -              *      fault in the memory just to make sure we can access it
> -              */
> -             if (kttd_debug)
> -                     printf(">>>>>>>>>>Faulting in memory: 0x%x, 0x%x\n",
> -                            trunc_page(offset), access);
> -             code = vm_fault(kernel_map, trunc_page(offset), access, FALSE,
> -                             FALSE, (void (*)()) 0);
> -     } else {
> -             /*
> -              * Check for user thread
> -              */
> -#if  1
> -             if ((current_thread() != THREAD_NULL) &&
> -                 (current_thread()->task->map->pmap != kernel_pmap) &&
> -                 (current_thread()->task->map->pmap != PMAP_NULL)) {
> -                     code = vm_fault(current_thread()->task->map,
> -                                     trunc_page(offset), access, FALSE,
> -                                     FALSE, (void (*)()) 0);
> -             }else{
> -                     /*
> -                      * Invalid kernel address (below VM_MIN_KERNEL_ADDRESS)
> -                      */
> -                     return FALSE;
> -             }
> -#else
> -             if (kttd_debug)
> -                     printf("==========Would've tried to map in user area 
> 0x%x\n",
> -                            trunc_page(offset));
> -             return FALSE;
> -#endif       /* 0 */
> -     }
> -
> -     return (code == KERN_SUCCESS);
> -}
> -
> -/*
> - *   See if we modified the kernel text and if so flush the caches.
> - *   This routine is never called with a range that crosses a page
> - *   boundary.
> - */
> -void kttd_flush_cache(vm_offset_t offset, vm_size_t length)
> -{
> -     /* 386 doesn't need this */
> -     return;
> -}
> -
> -/*
> - * Insert a breakpoint into memory.
> - */
> -boolean_t kttd_insert_breakpoint(vm_address_t address,
> -                              ttd_saved_inst *saved_inst)
> -{
> -     /*
> -      * Saved old memory data:
> -      */
> -     *saved_inst = *(unsigned char *)address;
> -
> -     /*
> -      * Put in a Breakpoint:
> -      */
> -     *(unsigned char *)address = I386_BREAKPOINT;
> -
> -     return TRUE;
> -}
> -
> -/*
> - * Remove breakpoint from memory.
> - */
> -boolean_t kttd_remove_breakpoint(vm_address_t address,
> -                              ttd_saved_inst saved_inst)
> -{
> -     /*
> -      * replace it:
> -      */
> -     *(unsigned char *)address = (saved_inst & 0xff);
> -
> -     return TRUE;
> -}
> -
> -/*
> - * Set single stepping mode.  Assumes that program counter is set
> - * to the location where single stepping is to begin.  The 386 is
> - * an easy single stepping machine, ie. built into the processor.
> - */
> -boolean_t kttd_set_machine_single_step(void)
> -{
> -     /* Turn on Single Stepping */
> -     kttd_regs.efl |= EFL_TF;
> -
> -     return TRUE;
> -}
> -
> -/*
> - * Clear single stepping mode.
> - */
> -boolean_t kttd_clear_machine_single_step(void)
> -{
> -     /* Turn off the trace flag */
> -     kttd_regs.efl &= ~EFL_TF;
> -
> -     return TRUE;
> -}
> -
> -
> -/*
> - * kttd_type_to_ttdtrap:
> - *
> - * Fills in the task and thread info structures with the reason
> - * for entering the Teledebugger (bp, single step, pg flt, etc.)
> - *
> - */
> -void kttd_type_to_ttdtrap(int type)
> -{
> -     /* XXX Fill this in sometime for i386 */
> -}
> -
> -/*
> - * kttd_trap:
> - *
> - *  This routine is called from the trap or interrupt handler when a
> - * breakpoint instruction is encountered or a single step operation
> - * completes. The argument is a pointer to a machine dependent
> - * saved_state structure that was built on the interrupt or kernel stack.
> - *
> - */
> -boolean_t kttd_trap(int      type, int code, struct i386_saved_state *regs)
> -{
> -     int s;
> -
> -     if (kttd_debug)
> -             printf("kttd_TRAP, before splhigh()\n");
> -
> -     /*
> -      * TTD isn't supported by the driver.
> -      *
> -      * Try to switch off to kdb if it is resident.
> -      * Otherwise just hang (this might be panic).
> -      *
> -      * Check to make sure that TTD is supported.
> -      * (Both by the machine's driver's, and bootp if using ether).
> -      */
> -     if (!kttd_supported()) {
> -             kttd_enabled = FALSE;
> -             return FALSE;
> -     }
> -
> -     s = splhigh();
> -
> -     /*
> -      * We are already in TTD!
> -      */
> -     if (++kttd_active > MAX_KTTD_ACTIVE) {
> -             printf("kttd_trap: RE-ENTERED!!!\n");
> -     }
> -
> -     if (kttd_debug)
> -             printf("kttd_TRAP, after splhigh()\n");
> -
> -     /*  Should switch to kttd's own stack here. */
> -
> -     kttd_regs = *regs;
> -
> -     if ((regs->cs & 0x3) == KERNEL_RING) {
> -         /*
> -          * Kernel mode - esp and ss not saved
> -          */
> -         kttd_regs.uesp = (int)&regs->uesp;  /* kernel stack pointer */
> -         kttd_regs.ss   = KERNEL_DS;
> -     }
> -
> -     /*
> -      * If this was not entered via an interrupt (type != -1)
> -      * then we've entered via a bpt, single, etc. and must
> -      * set the globals.
> -      *
> -      * Setup the kttd globals for entry....
> -      */
> -     if (type != -1) {
> -             kttd_current_request = NULL;
> -             kttd_current_length = 0;
> -             kttd_current_kmsg = NULL;
> -             kttd_run_status = FULL_STOP;
> -     }else{
> -             /*
> -              * We know that we can only get here if we did a kttd_intr
> -              * since it's the way that we are called with type -1 (via
> -              * the trampoline), so we don't have to worry about entering
> -              * from Cntl-Alt-D like the mips does.
> -              */
> -             /*
> -              * Perform sanity check!
> -              */
> -             if ((kttd_current_request == NULL) ||
> -                 (kttd_current_length == 0) ||
> -                 (kttd_current_kmsg == NULL) ||
> -                 (kttd_run_status != ONE_STOP)) {
> -
> -                     printf("kttd_trap: INSANITY!!!\n");
> -             }
> -     }
> -
> -     kttd_task_trap(type, code, (regs->cs & 0x3) != 0);
> -
> -     regs->eip    = kttd_regs.eip;
> -     regs->efl    = kttd_regs.efl;
> -     regs->eax    = kttd_regs.eax;
> -     regs->ecx    = kttd_regs.ecx;
> -     regs->edx    = kttd_regs.edx;
> -     regs->ebx    = kttd_regs.ebx;
> -     if ((regs->cs & 0x3) != KERNEL_RING) {
> -         /*
> -          * user mode - saved esp and ss valid
> -          */
> -         regs->uesp = kttd_regs.uesp;                /* user stack pointer */
> -         regs->ss   = kttd_regs.ss & 0xffff; /* user stack segment */
> -     }
> -     regs->ebp    = kttd_regs.ebp;
> -     regs->esi    = kttd_regs.esi;
> -     regs->edi    = kttd_regs.edi;
> -     regs->es     = kttd_regs.es & 0xffff;
> -     regs->cs     = kttd_regs.cs & 0xffff;
> -     regs->ds     = kttd_regs.ds & 0xffff;
> -     regs->fs     = kttd_regs.fs & 0xffff;
> -     regs->gs     = kttd_regs.gs & 0xffff;
> -
> -     if (--kttd_active < MIN_KTTD_ACTIVE)
> -             printf("ttd_trap: kttd_active < 0\n");
> -
> -     if (kttd_debug) {
> -             printf("Leaving kttd_trap, kttd_active = %d\n", kttd_active);
> -     }
> -
> -     /*
> -      * Only reset this if we entered kttd_trap via an async trampoline.
> -      */
> -     if (type == -1) {
> -             if (kttd_run_status == RUNNING)
> -                     printf("kttd_trap: $$$$$ run_status already RUNNING! 
> $$$$$\n");
> -             kttd_run_status = RUNNING;
> -     }
> -
> -     /* Is this right? XXX */
> -     kttd_run_status = RUNNING;
> -
> -     (void) splx(s);
> -
> -     /*
> -      * Return true, that yes we handled the trap.
> -      */
> -     return TRUE;
> -}
> -
> -/*
> - *   Enter KTTD through a network packet trap.
> - *   We show the registers as of the network interrupt
> - *   instead of those at its call to KDB.
> - */
> -struct int_regs {
> -     int     edi;
> -     int     esi;
> -     int     ebp;
> -     int     ebx;
> -     struct i386_interrupt_state *is;
> -};
> -
> -void
> -kttd_netentry(struct int_regs *int_regs)
> -{
> -     struct i386_interrupt_state *is = int_regs->is;
> -     int     s;
> -
> -     if (kttd_debug)
> -             printf("kttd_NETENTRY before slphigh()\n");
> -
> -     s = splhigh();
> -
> -     if (kttd_debug)
> -             printf("kttd_NETENTRY after slphigh()\n");
> -
> -     if ((is->cs & 0x3) != KERNEL_RING) {
> -         /*
> -          * Interrupted from User Space
> -          */
> -         kttd_regs.uesp = ((int *)(is+1))[0];
> -         kttd_regs.ss   = ((int *)(is+1))[1];
> -     }
> -     else {
> -         /*
> -          * Interrupted from Kernel Space
> -          */
> -         kttd_regs.ss  = KERNEL_DS;
> -         kttd_regs.uesp= (int)(is+1);
> -     }
> -     kttd_regs.efl = is->efl;
> -     kttd_regs.cs  = is->cs;
> -     kttd_regs.eip = is->eip;
> -     kttd_regs.eax = is->eax;
> -     kttd_regs.ecx = is->ecx;
> -     kttd_regs.edx = is->edx;
> -     kttd_regs.ebx = int_regs->ebx;
> -     kttd_regs.ebp = int_regs->ebp;
> -     kttd_regs.esi = int_regs->esi;
> -     kttd_regs.edi = int_regs->edi;
> -     kttd_regs.ds  = is->ds;
> -     kttd_regs.es  = is->es;
> -     kttd_regs.fs  = is->fs;
> -     kttd_regs.gs  = is->gs;
> -
> -     kttd_active++;
> -     kttd_task_trap(-1, 0, (kttd_regs.cs & 0x3) != 0);
> -     kttd_active--;
> -
> -     if ((kttd_regs.cs & 0x3) != KERNEL_RING) {
> -         ((int *)(is+1))[0] = kttd_regs.uesp;
> -         ((int *)(is+1))[1] = kttd_regs.ss & 0xffff;
> -     }
> -     is->efl = kttd_regs.efl;
> -     is->cs  = kttd_regs.cs & 0xffff;
> -     is->eip = kttd_regs.eip;
> -     is->eax = kttd_regs.eax;
> -     is->ecx = kttd_regs.ecx;
> -     is->edx = kttd_regs.edx;
> -     int_regs->ebx = kttd_regs.ebx;
> -     int_regs->ebp = kttd_regs.ebp;
> -     int_regs->esi = kttd_regs.esi;
> -     int_regs->edi = kttd_regs.edi;
> -     is->ds  = kttd_regs.ds & 0xffff;
> -     is->es  = kttd_regs.es & 0xffff;
> -     is->fs  = kttd_regs.fs & 0xffff;
> -     is->gs  = kttd_regs.gs & 0xffff;
> -
> -     if (kttd_run_status == RUNNING)
> -             printf("kttd_netentry: %%%%% run_status already RUNNING! 
> %%%%%\n");
> -     kttd_run_status = RUNNING;
> -
> -     (void) splx(s);
> -}
> -
> -#endif /* MACH_TTD */
> diff --git a/i386/i386/locore.S b/i386/i386/locore.S
> index 905e1af9..dc761991 100644
> --- a/i386/i386/locore.S
> +++ b/i386/i386/locore.S
> @@ -583,7 +583,7 @@ _kret_iret:
>   * Trap from kernel mode.  No need to switch stacks.
>   */
>  trap_from_kernel:
> -#if  MACH_KDB || MACH_TTD
> +#if  MACH_KDB
>       movl    %esp,%ebx               /* save current stack */
>       movl    %esp,%edx               /* on an interrupt stack? */
>  
> @@ -606,12 +606,12 @@ trap_from_kernel:
>       call    EXT(kernel_trap)        /* to kernel trap routine */
>       addl    $4,%esp                 /* pop parameter */
>       popl    %esp                    /* return to old stack */
> -#else        /* MACH_KDB || MACH_TTD */
> +#else        /* MACH_KDB */
>  
>       pushl   %esp                    /* pass parameter */
>       call    EXT(kernel_trap)        /* to kernel trap routine */
>       addl    $4,%esp                 /* pop parameter */
> -#endif       /* MACH_KDB || MACH_TTD */
> +#endif       /* MACH_KDB */
>  
>       jmp     _return_from_kernel
>  
> @@ -995,81 +995,6 @@ kdb_from_iret_i:                 /* on interrupt stack */
>  
>  #endif       /* MACH_KDB */
>  
> -#if  MACH_TTD
> -/*
> - * Same code as that above for the keyboard entry into kdb.
> - */
> -ENTRY(kttd_intr)
> -     movl    %ebp,%eax               /* save caller`s frame pointer */
> -     movl    $EXT(return_to_iret),%ecx       /* interrupt return address 1 */
> -     movl    $_return_to_iret_i,%edx /* interrupt return address 2 */
> -
> -0:   cmpl    16(%eax),%ecx           /* does this frame return to */
> -                                     /* interrupt handler (1)? */
> -     je      1f
> -     cmpl    16(%eax),%edx           /* interrupt handler (2)? */
> -     je      2f                      /* if not: */
> -     movl    (%eax),%eax             /* try next frame */
> -     jmp     0b
> -
> -1:   movl    $ttd_from_iret,16(%eax) /* returns to kernel/user stack */
> -     ret
> -
> -2:   movl    $ttd_from_iret_i,16(%eax)
> -                                     /* returns to interrupt stack */
> -     ret
> -
> -/*
> - * On return from keyboard interrupt, we will execute
> - * ttd_from_iret_i
> - *   if returning to an interrupt on the interrupt stack
> - * ttd_from_iret
> - *   if returning to an interrupt on the user or kernel stack
> - */
> -ttd_from_iret:
> -                                     /* save regs in known locations */
> -#if  STAT_TIME
> -     pushl   %ebx                    /* caller`s %ebx is in reg */
> -#else
> -     movl    4(%esp),%eax            /* get caller`s %ebx */
> -     pushl   %eax                    /* push on stack */
> -#endif
> -     pushl   %ebp
> -     pushl   %esi
> -     pushl   %edi
> -     pushl   %esp                    /* pass regs */
> -     call    _kttd_netentry          /* to kdb */
> -     addl    $4,%esp                 /* pop parameters */
> -     popl    %edi                    /* restore registers */
> -     popl    %esi
> -     popl    %ebp
> -#if  STAT_TIME
> -     popl    %ebx
> -#else
> -     popl    %eax
> -     movl    %eax,4(%esp)
> -#endif
> -     jmp     EXT(return_to_iret)     /* normal interrupt return */
> -
> -ttd_from_iret_i:                     /* on interrupt stack */
> -     pop     %edx                    /* restore saved registers */
> -     pop     %ecx
> -     pop     %eax
> -     pushl   $0                      /* zero error code */
> -     pushl   $0                      /* zero trap number */
> -     pusha                           /* save general registers */
> -     PUSH_SEGMENTS_ISR               /* save segment registers */
> -     pushl   %esp                    /* pass regs, */
> -     pushl   $0                      /* code, */
> -     pushl   $-1                     /* type to kdb */
> -     call    _kttd_trap
> -     addl    $12,%esp                /* remove parameters */
> -     POP_SEGMENTS_ISR                /* restore segment registers */
> -     popa                            /* restore general registers */
> -     addl    $8,%esp
> -     iret
> -
> -#endif       /* MACH_TTD */
>  
>  /*
>   * System call enters through a call gate.  Flags are not saved -
> diff --git a/i386/i386/spl.S b/i386/i386/spl.S
> index 2f2c8e3a..1a831edb 100644
> --- a/i386/i386/spl.S
> +++ b/i386/i386/spl.S
> @@ -131,7 +131,7 @@ ENTRY(spl7)
>  ENTRY(splx)
>       movl    S_ARG0,%edx             /* get ipl */
>       CPU_NUMBER(%eax)
> -#if (MACH_KDB || MACH_TTD) && !defined(MACH_XEN)
> +#if MACH_KDB && !defined(MACH_XEN)
>       /* First make sure that if we're exitting from ipl7, IF is still 
> cleared */
>       cmpl    $SPL7,CX(EXT(curr_ipl),%eax)    /* from ipl7? */
>       jne     0f
> @@ -142,7 +142,7 @@ ENTRY(splx)
>       int3                            /* Oops, interrupts got enabled?! */
>  
>  0:
> -#endif       /* (MACH_KDB || MACH_TTD) && !MACH_XEN */
> +#endif       /* MACH_KDB && !MACH_XEN */
>       testl   %edx,%edx               /* spl0? */
>       jz      EXT(spl0)               /* yes, handle specially */
>       CPU_NUMBER(%eax)
> @@ -214,7 +214,7 @@ splx_cli:
>       .globl  spl
>  spl:
>       CPU_NUMBER(%eax)
> -#if (MACH_KDB || MACH_TTD) && !defined(MACH_XEN)
> +#if MACH_KDB && !defined(MACH_XEN)
>       /* First make sure that if we're exitting from ipl7, IF is still 
> cleared */
>       cmpl    $SPL7,CX(EXT(curr_ipl),%eax)    /* from ipl7? */
>       jne     0f
> @@ -225,7 +225,7 @@ spl:
>       int3                            /* Oops, interrupts got enabled?! */
>  
>  0:
> -#endif       /* (MACH_KDB || MACH_TTD) && !MACH_XEN */
> +#endif       /* MACH_KDB && !MACH_XEN */
>       cmpl    $SPL7,%edx              /* spl7? */
>       je      EXT(spl7)               /* yes, handle specially */
>  #ifdef MACH_XEN
> diff --git a/i386/i386/trap.c b/i386/i386/trap.c
> index de52de76..2f3a3b61 100644
> --- a/i386/i386/trap.c
> +++ b/i386/i386/trap.c
> @@ -86,10 +86,6 @@ thread_kdb_return(void)
>  }
>  #endif       /* MACH_KDB */
>  
> -#if  MACH_TTD
> -extern boolean_t kttd_enabled;
> -boolean_t debug_all_traps_with_kttd = TRUE;
> -#endif       /* MACH_TTD */
>  
>  static void
>  user_page_fault_continue(kern_return_t kr)
> @@ -339,10 +335,6 @@ dump_ss(regs);
>               else
>                       printf("trap %ld", type);
>               printf(", eip 0x%lx, code %lx, cr2 %lx\n", regs->eip, code, 
> regs->cr2);
> -#if  MACH_TTD
> -             if (kttd_enabled && kttd_trap(type, code, regs))
> -                     return;
> -#endif       /* MACH_TTD */
>  #if  MACH_KDB
>               if (kdb_trap(type, code, regs))
>                   return;
> @@ -395,12 +387,6 @@ int user_trap(struct i386_saved_state *regs)
>               break;
>  
>           case T_DEBUG:
> -#if  MACH_TTD
> -             if (kttd_enabled && kttd_in_single_step()) {
> -                     if (kttd_trap(type, regs->err, regs))
> -                             return 0;
> -             }
> -#endif       /* MACH_TTD */
>  #if  MACH_KDB
>               if (db_in_single_step()) {
>                   if (kdb_trap(type, regs->err, regs))
> @@ -417,11 +403,6 @@ int user_trap(struct i386_saved_state *regs)
>               break;
>  
>           case T_INT3:
> -#if  MACH_TTD
> -             if (kttd_enabled && kttd_trap(type, regs->err, regs))
> -                     return 0;
> -             break;
> -#endif       /* MACH_TTD */
>  #if  MACH_KDB
>           {
>               if (db_find_breakpoint_here(
> @@ -554,10 +535,6 @@ int user_trap(struct i386_saved_state *regs)
>               return 0;
>  
>           default:
> -#if  MACH_TTD
> -             if (kttd_enabled && kttd_trap(type, regs->err, regs))
> -                     return 0;
> -#endif       /* MACH_TTD */
>  #if  MACH_KDB
>               if (kdb_trap(type, regs->err, regs))
>                   return 0;
> @@ -570,11 +547,6 @@ int user_trap(struct i386_saved_state *regs)
>               return 0;
>       }
>  
> -#if  MACH_TTD
> -     if ((debug_all_traps_with_kttd || thread->task->essential) &&
> -         kttd_trap(type, regs->err, regs))
> -             return 0;
> -#endif       /* MACH_TTD */
>  #if  MACH_KDB
>       if ((debug_all_traps_with_kdb || thread->task->essential) &&
>           kdb_trap(type, regs->err, regs))
> diff --git a/i386/i386at/autoconf.c b/i386/i386at/autoconf.c
> index 5c69988f..388197c2 100644
> --- a/i386/i386at/autoconf.c
> +++ b/i386/i386at/autoconf.c
> @@ -119,12 +119,6 @@ void probeio(void)
>                       i++;
>       }
>  
> -#if  MACH_TTD
> -     /*
> -      * Initialize Remote kernel debugger.
> -      */
> -     ttd_init();
> -#endif       /* MACH_TTD */
>  }
>  
>  void take_dev_irq(
> diff --git a/x86_64/locore.S b/x86_64/locore.S
> index fad0d73c..dd35d2f8 100644
> --- a/x86_64/locore.S
> +++ b/x86_64/locore.S
> @@ -733,7 +733,7 @@ _kret_iret:
>   * Trap from kernel mode.  No need to switch stacks.
>   */
>  trap_from_kernel:
> -#if  MACH_KDB || MACH_TTD
> +#if  MACH_KDB
>       movq    %rsp,%rbx               /* save current stack */
>       movq    %rsp,%rdx               /* on an interrupt stack? */
>  
> @@ -756,12 +756,12 @@ trap_from_kernel:
>       call    EXT(kernel_trap)        /* to kernel trap routine */
>  
>       popq    %rsp                    /* return to old stack */
> -#else        /* MACH_KDB || MACH_TTD */
> +#else        /* MACH_KDB */
>  
>       movq    %rsp,%rdi               /* pass parameter */
>       call    EXT(kernel_trap)        /* to kernel trap routine */
>  
> -#endif       /* MACH_KDB || MACH_TTD */
> +#endif       /* MACH_KDB */
>  
>       jmp     _return_from_kernel
>  
> @@ -1150,86 +1150,6 @@ ud2
>  
>  #endif       /* MACH_KDB */
>  
> -#if  MACH_TTD
> -/*
> - * Same code as that above for the keyboard entry into kdb.
> - */
> -ENTRY(kttd_intr)
> -// TODO: test it before dropping ud2
> -ud2
> -     movq    %rbp,%rax               /* save caller`s frame pointer */
> -     movq    $EXT(return_to_iret),%rcx       /* interrupt return address 1 */
> -     movq    $_return_to_iret_i,%rdx /* interrupt return address 2 */
> -
> -0:   cmpq    32(%rax),%rcx           /* does this frame return to */
> -                                     /* interrupt handler (1)? */
> -     je      1f
> -     cmpq    32(%rax),%rdx           /* interrupt handler (2)? */
> -     je      2f                      /* if not: */
> -     movq    (%rax),%rax             /* try next frame */
> -     jmp     0b
> -
> -1:   movq    $ttd_from_iret,32(%rax) /* returns to kernel/user stack */
> -     ret
> -
> -2:   movq    $ttd_from_iret_i,32(%rax)
> -                                     /* returns to interrupt stack */
> -     ret
> -
> -/*
> - * On return from keyboard interrupt, we will execute
> - * ttd_from_iret_i
> - *   if returning to an interrupt on the interrupt stack
> - * ttd_from_iret
> - *   if returning to an interrupt on the user or kernel stack
> - */
> -ttd_from_iret:
> -                                     /* save regs in known locations */
> -#if  STAT_TIME
> -     pushq   %rbx                    /* caller`s %ebx is in reg */
> -#else
> -     movq    8(%rsp),%rax            /* get caller`s %ebx */
> -     pushq   %rax                    /* push on stack */
> -#endif
> -     pushq   %rbp
> -     pushq   %rsi
> -     pushq   %rdi
> -     movq    %rsp,%rdi               /* pass regs */
> -     call    _kttd_netentry          /* to kdb */
> -     popq    %rdi                    /* restore registers */
> -     popq    %rsi
> -     popq    %rbp
> -#if  STAT_TIME
> -     popq    %rbx
> -#else
> -     popq    %rax
> -     movq    %rax,8(%rsp)
> -#endif
> -     jmp     EXT(return_to_iret)     /* normal interrupt return */
> -
> -ttd_from_iret_i:                     /* on interrupt stack */
> -     pop     %rdx                    /* restore saved registers */
> -     pop     %rcx
> -     pop     %rax
> -     pushq   $0                      /* zero error code */
> -     pushq   $0                      /* zero trap number */
> -     pusha                           /* save general registers */
> -     PUSH_SEGMENTS_ISR(%rdx)         /* save segment registers */
> -     ud2     // TEST it
> -     movq    %rsp,%rdx               /* pass regs, */
> -     movq    $0,%rsi                 /* code, */
> -     movq    $-1,%rdi                /* type to kdb */
> -     call    _kttd_trap
> -     POP_SEGMENTS_ISR(%rdx)          /* restore segment registers */
> -     popa                            /* restore general registers */
> -     addq    $16,%rsp
> -
> -// TODO: test it before dropping ud2
> -movq (%rsp),%rax
> -ud2
> -     iretq
> -
> -#endif       /* MACH_TTD */
>  
>  #ifdef USER32
>  /*
> diff --git a/x86_64/spl.S b/x86_64/spl.S
> index 28a17e22..5fdf977c 100644
> --- a/x86_64/spl.S
> +++ b/x86_64/spl.S
> @@ -130,7 +130,7 @@ ENTRY(spl7)
>  ENTRY(splx)
>       movq    S_ARG0,%rdx             /* get ipl */
>       CPU_NUMBER(%eax)
> -#if (MACH_KDB || MACH_TTD) && !defined(MACH_XEN)
> +#if MACH_KDB && !defined(MACH_XEN)
>       /* First make sure that if we're exitting from ipl7, IF is still 
> cleared */
>       cmpl    $SPL7,CX(EXT(curr_ipl),%rax)    /* from ipl7? */
>       jne     0f
> @@ -141,7 +141,7 @@ ENTRY(splx)
>       int3                            /* Oops, interrupts got enabled?! */
>  
>  0:
> -#endif       /* (MACH_KDB || MACH_TTD) && !MACH_XEN */
> +#endif       /* MACH_KDB && !MACH_XEN */
>       testl   %edx,%edx               /* spl0? */
>       jz      EXT(spl0)               /* yes, handle specially */
>       CPU_NUMBER(%eax)
> @@ -214,7 +214,7 @@ splx_cli:
>       .globl  spl
>  spl:
>       CPU_NUMBER(%eax)
> -#if (MACH_KDB || MACH_TTD) && !defined(MACH_XEN)
> +#if MACH_KDB && !defined(MACH_XEN)
>       /* First make sure that if we're exitting from ipl7, IF is still 
> cleared */
>       cmpl    $SPL7,CX(EXT(curr_ipl),%rax)    /* from ipl7? */
>       jne     0f
> @@ -225,7 +225,7 @@ spl:
>       int3                            /* Oops, interrupts got enabled?! */
>  
>  0:
> -#endif       /* (MACH_KDB || MACH_TTD) && !MACH_XEN */
> +#endif       /* MACH_KDB && !MACH_XEN */
>       cmpl    $SPL7,%edx              /* spl7? */
>       je      EXT(spl7)               /* yes, handle specially */
>  #ifdef MACH_XEN
> -- 
> 2.53.0
> 
> 

-- 
Samuel
<s> je la connaissais pas celle la : "make: Entering an unknown directory"
 -+- #ens-mim -+-

Reply via email to