blob: a1412f3e307ed778a4976bd3c65f2407ad2dd2dd (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
/*[
verw.c
LOCAL CHAR SccsID[]="@(#)verw.c 1.5 02/09/94";
VERW CPU Functions.
-------------------
]*/
#include <insignia.h>
#include <host_def.h>
#include <xt.h>
#include <c_main.h>
#include <c_addr.h>
#include <c_bsic.h>
#include <c_prot.h>
#include <c_seg.h>
#include <c_stack.h>
#include <c_xcptn.h>
#include <c_reg.h>
#include <verw.h>
#include <c_page.h>
/*
=====================================================================
EXTERNAL ROUTINES START HERE
=====================================================================
*/
GLOBAL VOID
VERW
IFN1(
IU32, op1 /* src(selector) operand */
)
{
BOOL writeable = FALSE;
IU32 descr;
IU8 AR;
if ( !selector_outside_GDT_LDT((IU16)op1, &descr) )
{
/* get access rights */
AR = spr_read_byte(descr+5);
switch ( descriptor_super_type((IU16)AR) )
{
case INVALID:
case AVAILABLE_TSS:
case LDT_SEGMENT:
case BUSY_TSS:
case CALL_GATE:
case TASK_GATE:
case INTERRUPT_GATE:
case TRAP_GATE:
case XTND_AVAILABLE_TSS:
case XTND_BUSY_TSS:
case XTND_CALL_GATE:
case XTND_INTERRUPT_GATE:
case XTND_TRAP_GATE:
case CONFORM_NOREAD_CODE:
case CONFORM_READABLE_CODE:
case NONCONFORM_NOREAD_CODE:
case NONCONFORM_READABLE_CODE:
case EXPANDUP_READONLY_DATA:
case EXPANDDOWN_READONLY_DATA:
break; /* never writeable */
case EXPANDUP_WRITEABLE_DATA:
case EXPANDDOWN_WRITEABLE_DATA:
/* access depends on privilege, it is required that
DPL >= CPL and DPL >= RPL */
if ( GET_AR_DPL(AR) >= GET_CPL() &&
GET_AR_DPL(AR) >= GET_SELECTOR_RPL(op1) )
writeable = TRUE;
break;
}
}
if ( writeable )
{
SET_ZF(1);
}
else
{
SET_ZF(0);
}
}
|