comparison agent/src/share/classes/sun/jvm/hotspot/debugger/win32/Win32LDTEntry.java @ 0:a61af66fc99e jdk7-b24

Initial load
author duke
date Sat, 01 Dec 2007 00:00:00 +0000
parents
children c18cbe5936b8
comparison
equal deleted inserted replaced
-1:000000000000 0:a61af66fc99e
1 /*
2 * Copyright 2001 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 * have any questions.
22 *
23 */
24
25 package sun.jvm.hotspot.debugger.win32;
26
27 import java.io.Serializable;
28
29 /** Describes an LDT entry. (Some of the descriptions are taken
30 directly from Microsoft's documentation and are copyrighted by
31 Microsoft.) */
32
33 class Win32LDTEntry implements Serializable {
34 private short limitLow;
35 private short baseLow;
36 private byte baseMid;
37 private byte flags1;
38 private byte flags2;
39 private byte baseHi;
40
41 private Win32LDTEntry() {}
42
43 public Win32LDTEntry(short limitLow,
44 short baseLow,
45 byte baseMid,
46 byte flags1,
47 byte flags2,
48 byte baseHi) {
49 this.limitLow = limitLow;
50 this.baseLow = baseLow;
51 this.baseMid = baseMid;
52 this.flags1 = flags1;
53 this.flags2 = flags2;
54 this.baseHi = baseHi;
55 }
56
57 /** Returns base address of segment */
58 public long getBase() { return ( (baseLow & 0xFFFF) |
59 ((baseMid & 0xFF) << 16) |
60 ((baseHi & 0xFF) << 24)) & 0xFFFFFFFF; }
61
62 public short getLimitLow() { return limitLow; }
63 public short getBaseLow() { return baseLow; }
64 public byte getBaseMid() { return baseMid; }
65 public byte getBaseHi() { return baseHi; }
66
67 // FIXME: must verify mask and shift are correct
68 /** Describes type of segment. See TYPE_ portion of {@link
69 sun.jvm.hotspot.debugger.win32.Win32LDTEntryConstants}. */
70 public int getType() { return (flags1 & 0x1F); }
71
72 // FIXME: verify mask and shift are correct
73 /** Privilege level of descriptor: 0 = most privileged, 3 = least privileged */
74 public int getPrivilegeLevel() { return ((flags1 & 0x60) >> 5); }
75
76 // FIXME: verify mask is correct
77 /** Is segment present in physical memory? */
78 public boolean isSegmentPhysical() { return ((flags1 & 0x70) != 0); }
79
80 // FIXME: verify mask and shift are correct
81 /** High bits (16-19) of the address of the last byte of the segment */
82 public int getLimitHi() { return (flags2 & 0x0F); }
83
84 // FIXME: verify mask is correct
85 /** <P> Size of segment. If the segment is a data segment, this
86 member contains 1 if the segment is larger than 64 kilobytes (K)
87 or 0 if the segment is smaller than or equal to 64K. </P>
88
89 <P> If the segment is a code segment, this member contains 1 if
90 the segment is a code segment and runs with the default (native
91 mode) instruction set. This member contains 0 if the code
92 segment is an 80286 code segment and runs with 16-bit offsets
93 and the 80286-compatible instruction set. </P> */
94 public boolean isDefaultBig() { return ((flags2 & 0x40) != 0); }
95
96 // FIXME: verify mask is correct
97 /** Returns true if segment is page granular, false if byte
98 granular. */
99 public boolean isPageGranular() { return ((flags2 & 0x80) != 0); }
100 }