1 |
2 |
alfik |
/*
|
2 |
|
|
* Copyright (c) 2014, Aleksander Osman
|
3 |
|
|
* All rights reserved.
|
4 |
|
|
*
|
5 |
|
|
* Redistribution and use in source and binary forms, with or without
|
6 |
|
|
* modification, are permitted provided that the following conditions are met:
|
7 |
|
|
*
|
8 |
|
|
* * Redistributions of source code must retain the above copyright notice, this
|
9 |
|
|
* list of conditions and the following disclaimer.
|
10 |
|
|
*
|
11 |
|
|
* * Redistributions in binary form must reproduce the above copyright notice,
|
12 |
|
|
* this list of conditions and the following disclaimer in the documentation
|
13 |
|
|
* and/or other materials provided with the distribution.
|
14 |
|
|
*
|
15 |
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
16 |
|
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
17 |
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
18 |
|
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
19 |
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
20 |
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
21 |
|
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
22 |
|
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
23 |
|
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
24 |
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
25 |
|
|
*/
|
26 |
|
|
|
27 |
|
|
package ao486.test.layers;
|
28 |
|
|
|
29 |
|
|
import java.util.Random;
|
30 |
|
|
|
31 |
|
|
public class OtherLayer extends Layer {
|
32 |
|
|
public OtherLayer(Random random) {
|
33 |
|
|
this(Type.RANDOM, random);
|
34 |
|
|
}
|
35 |
|
|
public OtherLayer(Type type, Random random) {
|
36 |
|
|
this.random = random;
|
37 |
|
|
|
38 |
|
|
cr0_pe = (type == Type.REAL)? false :
|
39 |
|
|
(type == Type.PROTECTED_OR_V8086)? true :
|
40 |
|
|
random.nextBoolean();
|
41 |
|
|
cr0_mp = false;
|
42 |
|
|
cr0_em = false;
|
43 |
|
|
cr0_ts = false;
|
44 |
|
|
cr0_ne = false;
|
45 |
|
|
cr0_wp = false;
|
46 |
|
|
cr0_am = false;
|
47 |
|
|
cr0_nw = true;
|
48 |
|
|
cr0_cd = true;
|
49 |
|
|
cr0_pg = false;
|
50 |
|
|
|
51 |
|
|
cr2 = 0;
|
52 |
|
|
cr3 = 0;
|
53 |
|
|
|
54 |
|
|
cs_d_b = random.nextBoolean();
|
55 |
|
|
}
|
56 |
|
|
public enum Type {
|
57 |
|
|
RANDOM,
|
58 |
|
|
REAL,
|
59 |
|
|
PROTECTED_OR_V8086
|
60 |
|
|
}
|
61 |
|
|
|
62 |
|
|
public long get_test_type() { return 0; }
|
63 |
|
|
|
64 |
|
|
public long ldtr_limit() { return 0xFFFF; }
|
65 |
|
|
public long ldtr_s() { return 0; }
|
66 |
|
|
public long ldtr_type() { return 2; } //LDT
|
67 |
|
|
|
68 |
|
|
public long tr_limit() { return 0xFFFF; }
|
69 |
|
|
public long tr_s() { return 0; }
|
70 |
|
|
public long tr_type() { return 0xB; } //BUSY 386 TSS
|
71 |
|
|
|
72 |
|
|
public long gdtr_base() { return 0; }
|
73 |
|
|
public long gdtr_limit() { return 0xFFFF; }
|
74 |
|
|
|
75 |
|
|
public long idtr_base() { return 0; }
|
76 |
|
|
public long idtr_limit() { return 0xFFFF; }
|
77 |
|
|
|
78 |
|
|
public long cr0_pe() { return cr0_pe? 1 : 0; }
|
79 |
|
|
public long cr0_mp() { return cr0_mp? 1 : 0; }
|
80 |
|
|
public long cr0_em() { return cr0_em? 1 : 0; }
|
81 |
|
|
public long cr0_ts() { return cr0_ts? 1 : 0; }
|
82 |
|
|
public long cr0_ne() { return cr0_ne? 1 : 0; }
|
83 |
|
|
public long cr0_wp() { return cr0_wp? 1 : 0; }
|
84 |
|
|
public long cr0_am() { return cr0_am? 1 : 0; }
|
85 |
|
|
public long cr0_nw() { return cr0_nw? 1 : 0; }
|
86 |
|
|
public long cr0_cd() { return cr0_cd? 1 : 0; }
|
87 |
|
|
public long cr0_pg() { return cr0_pg? 1 : 0; }
|
88 |
|
|
|
89 |
|
|
public long cs_d_b() { return cs_d_b? 1 : 0; }
|
90 |
|
|
|
91 |
|
|
public long cr2() { return cr2; }
|
92 |
|
|
public long cr3() { return cr3; }
|
93 |
|
|
|
94 |
|
|
public long dr0() { return 0; }
|
95 |
|
|
public long dr1() { return 0; }
|
96 |
|
|
public long dr2() { return 0; }
|
97 |
|
|
public long dr3() { return 0; }
|
98 |
|
|
|
99 |
|
|
public long dr6() { return 0; }
|
100 |
|
|
public long dr7() { return 0; }
|
101 |
|
|
|
102 |
|
|
boolean cr0_pe, cr0_mp, cr0_em, cr0_ts, cr0_ne, cr0_wp, cr0_am, cr0_nw, cr0_cd, cr0_pg;
|
103 |
|
|
boolean cs_d_b;
|
104 |
|
|
|
105 |
|
|
int cr2, cr3;
|
106 |
|
|
}
|