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 |
|
|
public class HandleModeChangeLayer extends Layer {
|
30 |
|
|
public HandleModeChangeLayer(long cr0_pe, long vm, long cs_rpl, long cs_p, long cs_s, long cs_type) {
|
31 |
|
|
if(cr0_pe == 1 && vm == 1) {
|
32 |
|
|
this.cs_rpl = 3;
|
33 |
|
|
this.cs_p = cs_p;
|
34 |
|
|
this.cs_s = cs_s;
|
35 |
|
|
this.cs_type= cs_type;
|
36 |
|
|
}
|
37 |
|
|
else if(cr0_pe == 0) {
|
38 |
|
|
this.cs_rpl = 0;
|
39 |
|
|
this.cs_p = 1;
|
40 |
|
|
this.cs_s = 1;
|
41 |
|
|
this.cs_type= 3; // data read write accessed
|
42 |
|
|
}
|
43 |
|
|
else {
|
44 |
|
|
this.cs_rpl = cs_rpl;
|
45 |
|
|
this.cs_p = cs_p;
|
46 |
|
|
this.cs_s = cs_s;
|
47 |
|
|
this.cs_type= cs_type;
|
48 |
|
|
}
|
49 |
|
|
}
|
50 |
|
|
|
51 |
|
|
public long cs_p() { return cs_p; }
|
52 |
|
|
public long cs_s() { return cs_s; }
|
53 |
|
|
public long cs_type(){ return cs_type; }
|
54 |
|
|
public long cs_rpl() { return cs_rpl; }
|
55 |
|
|
|
56 |
|
|
long cs_p, cs_s;
|
57 |
|
|
long cs_type, cs_rpl;
|
58 |
|
|
}
|