hotspot/agent/src/os/win32/Message.hpp
author never
Mon, 04 May 2009 22:06:47 -0700
changeset 2744 57f0579fbe09
parent 1 489c9b5090e2
child 5547 f4b087cbb361
permissions -rw-r--r--
6837224: libsaproc.so on linux needs version of 6799141 Reviewed-by: kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
     2
 * Copyright 2000-2001 Sun Microsystems, Inc.  All Rights Reserved.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    19
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    20
 * CA 95054 USA or visit www.sun.com if you need additional information or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    21
 * have any questions.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
489c9b5090e2 Initial load
duke
parents:
diff changeset
    25
#ifndef _MESSAGE_
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
#define _MESSAGE_
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
// These are the commands sent from the server to the child processes
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
// over the child processes' stdin pipes. A subset of the commands
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
// understood by the overall system, these require responses from the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
// child process. Having a data structure rather than sending text
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
// simplifies parsing on the child side. The child replies by sending
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
// back fully-formatted replies which are copied by the server process
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
// to the clients' sockets.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
struct PeekArg {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
  DWORD address;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
  DWORD numBytes;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
// NOTE: when sending a PokeArg to the child process, we handle the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
// buffer specially
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
struct PokeArg {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
  DWORD address;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
  DWORD numBytes;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  void* data;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
// Used for continueevent
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
struct BoolArg {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
  bool val;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
// Used for duphandle, closehandle, and getcontext
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
struct HandleArg {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  HANDLE handle;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
// Used for setcontext
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
const int NUM_REGS_IN_CONTEXT = 22;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
struct SetContextArg {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
  HANDLE handle;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  DWORD  Eax;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  DWORD  Ebx;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  DWORD  Ecx;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
  DWORD  Edx;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
  DWORD  Esi;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  DWORD  Edi;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
  DWORD  Ebp;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
  DWORD  Esp;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  DWORD  Eip;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
  DWORD  Ds;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  DWORD  Es;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
  DWORD  Fs;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  DWORD  Gs;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  DWORD  Cs;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
  DWORD  Ss;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  DWORD  EFlags;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  DWORD  Dr0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
  DWORD  Dr1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
  DWORD  Dr2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
  DWORD  Dr3;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
  DWORD  Dr6;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
  DWORD  Dr7;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
// Used for selectorentry
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
struct SelectorEntryArg {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
  HANDLE handle;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
  DWORD  selector;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
struct Message {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  typedef enum {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
    ATTACH,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
    DETACH,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
    LIBINFO,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
    PEEK,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
    POKE,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
    THREADLIST,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
    DUPHANDLE,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
    CLOSEHANDLE,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
    GETCONTEXT,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
    SETCONTEXT,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
    SELECTORENTRY,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
    SUSPEND,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
    RESUME,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
    POLLEVENT,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
    CONTINUEEVENT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  } Type;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
  Type type;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
  union {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
    PeekArg          peekArg;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
    PokeArg          pokeArg;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
    BoolArg          boolArg;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
    HandleArg        handleArg;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
    SetContextArg    setContextArg;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
    SelectorEntryArg selectorArg;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
#endif  // #defined _MESSAGE_