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
; Copyright 1996 Acorn Computers Ltd
;
; Licensed under the Apache License, Version 2.0 (the "License");
; you may not use this file except in compliance with the License.
; You may obtain a copy of the License at
;
; http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing, software
; distributed under the License is distributed on an "AS IS" BASIS,
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
;
; > s.mapsome
; handle mapping in of some of slot
; (used to implement 'mapenoughslot' for Wimp_TransferBlock)
; entry:
; R0 = &103 (reason code 3, bit 8 set for mapsome)
; R1 = start (logical address)
; R2 = handle
; R3 = offset to start of mapping (pages into slot)
; R4 = no. of pages to map
mapsome
Push "R0-R7,LR"
CMP R1,#0
MOVEQ R1,#ApplicationStart
[ ValidateAMBHandles
;validate handle
LDR R0,AMBNhandles
CMP R2,R0
BGT badmapsome
CMP R2,#1
BLT badmapsome
]
LDR R0,AMBNodeHandles ; R0 -> handle array
LDR R0,[R0,R2,LSL #2] ; R0 -> node
[ ValidateAMBHandles
;check we have a proper id for node handle
LDR R6,=AMBMagicNodeID
LDR LR,[R0,#AMBNode_id]
CMP LR,R6
BNE badmapsome
]
LDR R6,[R0,#AMBNode_Npages]
ADD LR,R3,R4
CMP LR,R6
BGT badmssize
MOV R7,R3
MOV R3,R4
ADD R4,R0,#AMBNode_pages
ADD R4,R4,R7,LSL #2
MOV R5,R1
CMP R5,#-1
MOVEQ R6,#AP_Duff
MOVNE R6,#0
;entry: R3 = no. of pages, R4 -> list of page entries,
; R5 := start logical address, R6 = PPL
BL AMB_SetMemMapEntries
Pull "R0-R7,LR"
B SLVK
LTORG
badmssize
;return with V set but no error block (Wimp handles that)
Pull "R0-R7,LR"
B SLVK_SetV
[ ValidateAMBHandles
badmapsome
Pull "R0-R7,LR"
B badhandle
]
END