2 Implement ReadOnly Variable Services required by PEIM and install PEI
3 ReadOnly Varaiable2 PPI. These services operates the non-volatile
6 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
7 This program and the accompanying materials
8 are licensed and made available under the terms and conditions of the BSD License
9 which accompanies this distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
23 EFI_PEI_READ_ONLY_VARIABLE2_PPI mVariablePpi
= {
25 PeiGetNextVariableName
28 EFI_PEI_PPI_DESCRIPTOR mPpiListVariable
= {
29 (EFI_PEI_PPI_DESCRIPTOR_PPI
| EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST
),
30 &gEfiPeiReadOnlyVariable2PpiGuid
,
35 Provide the functionality of the variable services.
37 @param FileHandle Handle of the file being invoked.
38 Type EFI_PEI_FILE_HANDLE is defined in FfsFindNextFile().
39 @param PeiServices General purpose services available to every PEIM.
41 @retval EFI_SUCCESS If the interface could be successfully installed
42 @retval Others Returned from PeiServicesInstallPpi()
46 PeimInitializeVariableServices (
47 IN EFI_PEI_FILE_HANDLE FileHandle
,
48 IN CONST EFI_PEI_SERVICES
**PeiServices
51 return PeiServicesInstallPpi (&mPpiListVariable
);
56 Gets the pointer to the first variable header in given variable store area.
58 @param VarStoreHeader Pointer to the Variable Store Header.
60 @return Pointer to the first variable header
65 IN VARIABLE_STORE_HEADER
*VarStoreHeader
69 // The end of variable store
71 return (VARIABLE_HEADER
*) HEADER_ALIGN (VarStoreHeader
+ 1);
76 This code gets the pointer to the last variable memory pointer byte.
78 @param VarStoreHeader Pointer to the Variable Store Header.
80 @return VARIABLE_HEADER* pointer to last unavailable Variable Header.
85 IN VARIABLE_STORE_HEADER
*VarStoreHeader
89 // The end of variable store
91 return (VARIABLE_HEADER
*) HEADER_ALIGN ((UINTN
) VarStoreHeader
+ VarStoreHeader
->Size
);
96 This code checks if variable header is valid or not.
98 @param Variable Pointer to the Variable Header.
100 @retval TRUE Variable header is valid.
101 @retval FALSE Variable header is not valid.
105 IsValidVariableHeader (
106 IN VARIABLE_HEADER
*Variable
109 if (Variable
== NULL
|| Variable
->StartId
!= VARIABLE_DATA
) {
118 This code gets the size of name of variable.
120 @param Variable Pointer to the Variable Header.
122 @return Size of variable in bytes in type UINTN.
127 IN VARIABLE_HEADER
*Variable
130 if (Variable
->State
== (UINT8
) (-1) ||
131 Variable
->DataSize
== (UINT32
) (-1) ||
132 Variable
->NameSize
== (UINT32
) (-1) ||
133 Variable
->Attributes
== (UINT32
) (-1)) {
136 return (UINTN
) Variable
->NameSize
;
141 This code gets the size of data of variable.
143 @param Variable Pointer to the Variable Header.
145 @return Size of variable in bytes in type UINTN.
150 IN VARIABLE_HEADER
*Variable
153 if (Variable
->State
== (UINT8
) (-1) ||
154 Variable
->DataSize
== (UINT32
) (-1) ||
155 Variable
->NameSize
== (UINT32
) (-1) ||
156 Variable
->Attributes
== (UINT32
) (-1)) {
159 return (UINTN
) Variable
->DataSize
;
163 This code gets the pointer to the variable name.
165 @param Variable Pointer to the Variable Header.
167 @return A CHAR16* pointer to Variable Name.
172 IN VARIABLE_HEADER
*Variable
176 return (CHAR16
*) (Variable
+ 1);
181 This code gets the pointer to the variable data.
183 @param Variable Pointer to the Variable Header.
185 @return A UINT8* pointer to Variable Data.
190 IN VARIABLE_HEADER
*Variable
196 // Be careful about pad size for alignment
198 Value
= (UINTN
) GetVariableNamePtr (Variable
);
199 Value
+= NameSizeOfVariable (Variable
);
200 Value
+= GET_PAD_SIZE (NameSizeOfVariable (Variable
));
202 return (UINT8
*) Value
;
207 This code gets the pointer to the next variable header.
209 @param Variable Pointer to the Variable Header.
211 @return A VARIABLE_HEADER* pointer to next variable header.
216 IN VARIABLE_HEADER
*Variable
221 if (!IsValidVariableHeader (Variable
)) {
225 Value
= (UINTN
) GetVariableDataPtr (Variable
);
226 Value
+= DataSizeOfVariable (Variable
);
227 Value
+= GET_PAD_SIZE (DataSizeOfVariable (Variable
));
230 // Be careful about pad size for alignment
232 return (VARIABLE_HEADER
*) HEADER_ALIGN (Value
);
236 This code gets the pointer to the variable name.
238 @param VarStoreHeader Pointer to the Variable Store Header.
240 @retval EfiRaw Variable store is raw
241 @retval EfiValid Variable store is valid
242 @retval EfiInvalid Variable store is invalid
245 VARIABLE_STORE_STATUS
246 GetVariableStoreStatus (
247 IN VARIABLE_STORE_HEADER
*VarStoreHeader
251 if (CompareGuid (&VarStoreHeader
->Signature
, &gEfiAuthenticatedVariableGuid
) &&
252 VarStoreHeader
->Format
== VARIABLE_STORE_FORMATTED
&&
253 VarStoreHeader
->State
== VARIABLE_STORE_HEALTHY
259 if (((UINT32
*)(&VarStoreHeader
->Signature
))[0] == 0xffffffff &&
260 ((UINT32
*)(&VarStoreHeader
->Signature
))[1] == 0xffffffff &&
261 ((UINT32
*)(&VarStoreHeader
->Signature
))[2] == 0xffffffff &&
262 ((UINT32
*)(&VarStoreHeader
->Signature
))[3] == 0xffffffff &&
263 VarStoreHeader
->Size
== 0xffffffff &&
264 VarStoreHeader
->Format
== 0xff &&
265 VarStoreHeader
->State
== 0xff
276 This function compares a variable with variable entries in database.
278 @param Variable Pointer to the variable in our database
279 @param VariableName Name of the variable to compare to 'Variable'
280 @param VendorGuid GUID of the variable to compare to 'Variable'
281 @param PtrTrack Variable Track Pointer structure that contains Variable Information.
283 @retval EFI_SUCCESS Found match variable
284 @retval EFI_NOT_FOUND Variable not found
288 CompareWithValidVariable (
289 IN VARIABLE_HEADER
*Variable
,
290 IN CONST CHAR16
*VariableName
,
291 IN CONST EFI_GUID
*VendorGuid
,
292 OUT VARIABLE_POINTER_TRACK
*PtrTrack
297 if (VariableName
[0] == 0) {
298 PtrTrack
->CurrPtr
= Variable
;
302 // Don't use CompareGuid function here for performance reasons.
303 // Instead we compare the GUID a UINT32 at a time and branch
304 // on the first failed comparison.
306 if ((((INT32
*) VendorGuid
)[0] == ((INT32
*) &Variable
->VendorGuid
)[0]) &&
307 (((INT32
*) VendorGuid
)[1] == ((INT32
*) &Variable
->VendorGuid
)[1]) &&
308 (((INT32
*) VendorGuid
)[2] == ((INT32
*) &Variable
->VendorGuid
)[2]) &&
309 (((INT32
*) VendorGuid
)[3] == ((INT32
*) &Variable
->VendorGuid
)[3])
311 ASSERT (NameSizeOfVariable (Variable
) != 0);
312 Point
= (VOID
*) GetVariableNamePtr (Variable
);
313 if (CompareMem (VariableName
, Point
, NameSizeOfVariable (Variable
)) == 0) {
314 PtrTrack
->CurrPtr
= Variable
;
320 return EFI_NOT_FOUND
;
324 Return the variable store header and the index table based on the Index.
326 @param Type The type of the variable store.
327 @param IndexTable Return the index table.
329 @return Pointer to the variable store header.
331 VARIABLE_STORE_HEADER
*
333 IN VARIABLE_STORE_TYPE Type
,
334 OUT VARIABLE_INDEX_TABLE
**IndexTable OPTIONAL
337 EFI_HOB_GUID_TYPE
*GuidHob
;
338 EFI_FIRMWARE_VOLUME_HEADER
*FvHeader
;
339 VARIABLE_STORE_HEADER
*VariableStoreHeader
;
341 if (IndexTable
!= NULL
) {
344 VariableStoreHeader
= NULL
;
346 case VariableStoreTypeHob
:
347 GuidHob
= GetFirstGuidHob (&gEfiAuthenticatedVariableGuid
);
348 if (GuidHob
!= NULL
) {
349 VariableStoreHeader
= (VARIABLE_STORE_HEADER
*) GET_GUID_HOB_DATA (GuidHob
);
353 case VariableStoreTypeNv
:
354 if (GetBootModeHob () != BOOT_IN_RECOVERY_MODE
) {
356 // The content of NV storage for variable is not reliable in recovery boot mode.
358 FvHeader
= (EFI_FIRMWARE_VOLUME_HEADER
*) (UINTN
) (PcdGet64 (PcdFlashNvStorageVariableBase64
) != 0 ?
359 PcdGet64 (PcdFlashNvStorageVariableBase64
) :
360 PcdGet32 (PcdFlashNvStorageVariableBase
)
364 // Check if the Firmware Volume is not corrupted
366 if ((FvHeader
->Signature
!= EFI_FVH_SIGNATURE
) || (!CompareGuid (&gEfiSystemNvDataFvGuid
, &FvHeader
->FileSystemGuid
))) {
367 DEBUG ((EFI_D_ERROR
, "Firmware Volume for Variable Store is corrupted\n"));
371 VariableStoreHeader
= (VARIABLE_STORE_HEADER
*) ((UINT8
*) FvHeader
+ FvHeader
->HeaderLength
);
373 if (IndexTable
!= NULL
) {
374 GuidHob
= GetFirstGuidHob (&gEfiVariableIndexTableGuid
);
375 if (GuidHob
!= NULL
) {
376 *IndexTable
= GET_GUID_HOB_DATA (GuidHob
);
379 // If it's the first time to access variable region in flash, create a guid hob to record
380 // VAR_ADDED type variable info.
381 // Note that as the resource of PEI phase is limited, only store the limited number of
382 // VAR_ADDED type variables to reduce access time.
384 *IndexTable
= BuildGuidHob (&gEfiVariableIndexTableGuid
, sizeof (VARIABLE_INDEX_TABLE
));
385 (*IndexTable
)->Length
= 0;
386 (*IndexTable
)->StartPtr
= GetStartPointer (VariableStoreHeader
);
387 (*IndexTable
)->EndPtr
= GetEndPointer (VariableStoreHeader
);
388 (*IndexTable
)->GoneThrough
= 0;
399 return VariableStoreHeader
;
403 Find the variable in the specified variable store.
405 @param VariableStoreHeader Pointer to the variable store header.
406 @param IndexTable Pointer to the index table.
407 @param VariableName Name of the variable to be found
408 @param VendorGuid Vendor GUID to be found.
409 @param PtrTrack Variable Track Pointer structure that contains Variable Information.
411 @retval EFI_SUCCESS Variable found successfully
412 @retval EFI_NOT_FOUND Variable not found
413 @retval EFI_INVALID_PARAMETER Invalid variable name
418 IN VARIABLE_STORE_HEADER
*VariableStoreHeader
,
419 IN VARIABLE_INDEX_TABLE
*IndexTable
,
420 IN CONST CHAR16
*VariableName
,
421 IN CONST EFI_GUID
*VendorGuid
,
422 OUT VARIABLE_POINTER_TRACK
*PtrTrack
425 VARIABLE_HEADER
*Variable
;
426 VARIABLE_HEADER
*LastVariable
;
427 VARIABLE_HEADER
*MaxIndex
;
432 if (VariableStoreHeader
== NULL
) {
433 return EFI_INVALID_PARAMETER
;
436 if (GetVariableStoreStatus (VariableStoreHeader
) != EfiValid
) {
437 return EFI_UNSUPPORTED
;
440 if (~VariableStoreHeader
->Size
== 0) {
441 return EFI_NOT_FOUND
;
444 PtrTrack
->StartPtr
= GetStartPointer (VariableStoreHeader
);
445 PtrTrack
->EndPtr
= GetEndPointer (VariableStoreHeader
);
448 // No Variable Address equals zero, so 0 as initial value is safe.
452 if (IndexTable
!= NULL
) {
454 // traverse the variable index table to look for varible.
455 // The IndexTable->Index[Index] records the distance of two neighbouring VAR_ADDED type variables.
457 for (Offset
= 0, Index
= 0; Index
< IndexTable
->Length
; Index
++) {
458 ASSERT (Index
< sizeof (IndexTable
->Index
) / sizeof (IndexTable
->Index
[0]));
459 Offset
+= IndexTable
->Index
[Index
];
460 MaxIndex
= (VARIABLE_HEADER
*) ((UINT8
*) IndexTable
->StartPtr
+ Offset
);
461 if (CompareWithValidVariable (MaxIndex
, VariableName
, VendorGuid
, PtrTrack
) == EFI_SUCCESS
) {
466 if (IndexTable
->GoneThrough
!= 0) {
468 // If the table has all the existing variables indexed and we still cannot find it.
470 return EFI_NOT_FOUND
;
474 if (MaxIndex
!= NULL
) {
476 // HOB exists but the variable cannot be found in HOB
477 // If not found in HOB, then let's start from the MaxIndex we've found.
479 Variable
= GetNextVariablePtr (MaxIndex
);
480 LastVariable
= MaxIndex
;
483 // Start Pointers for the variable.
484 // Actual Data Pointer where data can be written.
486 Variable
= PtrTrack
->StartPtr
;
487 LastVariable
= PtrTrack
->StartPtr
;
491 // Find the variable by walk through non-volatile variable store
494 while ((Variable
< PtrTrack
->EndPtr
) && IsValidVariableHeader (Variable
)) {
495 if (Variable
->State
== VAR_ADDED
) {
497 // Record Variable in VariableIndex HOB
499 if ((IndexTable
!= NULL
) && !StopRecord
) {
500 Offset
= (UINTN
) Variable
- (UINTN
) LastVariable
;
501 if ((Offset
> 0x0FFFF) || (IndexTable
->Length
== sizeof (IndexTable
->Index
) / sizeof (IndexTable
->Index
[0]))) {
503 // Stop to record if the distance of two neighbouring VAR_ADDED variable is larger than the allowable scope(UINT16),
504 // or the record buffer is full.
508 IndexTable
->Index
[IndexTable
->Length
++] = (UINT16
) Offset
;
509 LastVariable
= Variable
;
513 if (CompareWithValidVariable (Variable
, VariableName
, VendorGuid
, PtrTrack
) == EFI_SUCCESS
) {
518 Variable
= GetNextVariablePtr (Variable
);
521 // If gone through the VariableStore, that means we never find in Firmware any more.
523 if ((IndexTable
!= NULL
) && !StopRecord
) {
524 IndexTable
->GoneThrough
= 1;
527 PtrTrack
->CurrPtr
= NULL
;
529 return EFI_NOT_FOUND
;
533 Find the variable in HOB and Non-Volatile variable storages.
535 @param VariableName Name of the variable to be found
536 @param VendorGuid Vendor GUID to be found.
537 @param PtrTrack Variable Track Pointer structure that contains Variable Information.
539 @retval EFI_SUCCESS Variable found successfully
540 @retval EFI_NOT_FOUND Variable not found
541 @retval EFI_INVALID_PARAMETER Invalid variable name
545 IN CONST CHAR16
*VariableName
,
546 IN CONST EFI_GUID
*VendorGuid
,
547 OUT VARIABLE_POINTER_TRACK
*PtrTrack
551 VARIABLE_STORE_HEADER
*VariableStoreHeader
;
552 VARIABLE_INDEX_TABLE
*IndexTable
;
553 VARIABLE_STORE_TYPE Type
;
555 if (VariableName
[0] != 0 && VendorGuid
== NULL
) {
556 return EFI_INVALID_PARAMETER
;
559 for (Type
= (VARIABLE_STORE_TYPE
) 0; Type
< VariableStoreTypeMax
; Type
++) {
560 VariableStoreHeader
= GetVariableStore (Type
, &IndexTable
);
561 Status
= FindVariableEx (
568 if (!EFI_ERROR (Status
)) {
573 return EFI_NOT_FOUND
;
577 This service retrieves a variable's value using its name and GUID.
579 Read the specified variable from the UEFI variable store. If the Data
580 buffer is too small to hold the contents of the variable, the error
581 EFI_BUFFER_TOO_SMALL is returned and DataSize is set to the required buffer
582 size to obtain the data.
584 @param This A pointer to this instance of the EFI_PEI_READ_ONLY_VARIABLE2_PPI.
585 @param VariableName A pointer to a null-terminated string that is the variable's name.
586 @param VariableGuid A pointer to an EFI_GUID that is the variable's GUID. The combination of
587 VariableGuid and VariableName must be unique.
588 @param Attributes If non-NULL, on return, points to the variable's attributes.
589 @param DataSize On entry, points to the size in bytes of the Data buffer.
590 On return, points to the size of the data returned in Data.
591 @param Data Points to the buffer which will hold the returned variable value.
593 @retval EFI_SUCCESS The variable was read successfully.
594 @retval EFI_NOT_FOUND The variable could not be found.
595 @retval EFI_BUFFER_TOO_SMALL The DataSize is too small for the resulting data.
596 DataSize is updated with the size required for
597 the specified variable.
598 @retval EFI_INVALID_PARAMETER VariableName, VariableGuid, DataSize or Data is NULL.
599 @retval EFI_DEVICE_ERROR The variable could not be retrieved because of a device error.
605 IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI
*This
,
606 IN CONST CHAR16
*VariableName
,
607 IN CONST EFI_GUID
*VariableGuid
,
608 OUT UINT32
*Attributes
,
609 IN OUT UINTN
*DataSize
,
613 VARIABLE_POINTER_TRACK Variable
;
617 if (VariableName
== NULL
|| VariableGuid
== NULL
|| DataSize
== NULL
) {
618 return EFI_INVALID_PARAMETER
;
622 // Find existing variable
624 Status
= FindVariable (VariableName
, VariableGuid
, &Variable
);
625 if (EFI_ERROR (Status
)) {
631 VarDataSize
= DataSizeOfVariable (Variable
.CurrPtr
);
632 if (*DataSize
>= VarDataSize
) {
634 return EFI_INVALID_PARAMETER
;
637 CopyMem (Data
, GetVariableDataPtr (Variable
.CurrPtr
), VarDataSize
);
639 if (Attributes
!= NULL
) {
640 *Attributes
= Variable
.CurrPtr
->Attributes
;
643 *DataSize
= VarDataSize
;
646 *DataSize
= VarDataSize
;
647 return EFI_BUFFER_TOO_SMALL
;
652 Return the next variable name and GUID.
654 This function is called multiple times to retrieve the VariableName
655 and VariableGuid of all variables currently available in the system.
656 On each call, the previous results are passed into the interface,
657 and, on return, the interface returns the data for the next
658 interface. When the entire variable list has been returned,
659 EFI_NOT_FOUND is returned.
661 @param This A pointer to this instance of the EFI_PEI_READ_ONLY_VARIABLE2_PPI.
663 @param VariableNameSize On entry, points to the size of the buffer pointed to by VariableName.
664 On return, the size of the variable name buffer.
665 @param VariableName On entry, a pointer to a null-terminated string that is the variable's name.
666 On return, points to the next variable's null-terminated name string.
667 @param VariableGuid On entry, a pointer to an EFI_GUID that is the variable's GUID.
668 On return, a pointer to the next variable's GUID.
670 @retval EFI_SUCCESS The variable was read successfully.
671 @retval EFI_NOT_FOUND The variable could not be found.
672 @retval EFI_BUFFER_TOO_SMALL The VariableNameSize is too small for the resulting
673 data. VariableNameSize is updated with the size
674 required for the specified variable.
675 @retval EFI_INVALID_PARAMETER VariableName, VariableGuid or
676 VariableNameSize is NULL.
677 @retval EFI_DEVICE_ERROR The variable could not be retrieved because of a device error.
682 PeiGetNextVariableName (
683 IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI
*This
,
684 IN OUT UINTN
*VariableNameSize
,
685 IN OUT CHAR16
*VariableName
,
686 IN OUT EFI_GUID
*VariableGuid
689 VARIABLE_STORE_TYPE Type
;
690 VARIABLE_POINTER_TRACK Variable
;
691 VARIABLE_POINTER_TRACK VariableInHob
;
694 VARIABLE_STORE_HEADER
*VariableStoreHeader
[VariableStoreTypeMax
];
696 if (VariableName
== NULL
|| VariableGuid
== NULL
|| VariableNameSize
== NULL
) {
697 return EFI_INVALID_PARAMETER
;
700 Status
= FindVariable (VariableName
, VariableGuid
, &Variable
);
701 if (Variable
.CurrPtr
== NULL
|| Status
!= EFI_SUCCESS
) {
705 if (VariableName
[0] != 0) {
707 // If variable name is not NULL, get next variable
709 Variable
.CurrPtr
= GetNextVariablePtr (Variable
.CurrPtr
);
712 VariableStoreHeader
[VariableStoreTypeHob
] = GetVariableStore (VariableStoreTypeHob
, NULL
);
713 VariableStoreHeader
[VariableStoreTypeNv
] = GetVariableStore (VariableStoreTypeNv
, NULL
);
717 // Switch from HOB to Non-Volatile.
719 while ((Variable
.CurrPtr
>= Variable
.EndPtr
) ||
720 (Variable
.CurrPtr
== NULL
) ||
721 !IsValidVariableHeader (Variable
.CurrPtr
)
724 // Find current storage index
726 for (Type
= (VARIABLE_STORE_TYPE
) 0; Type
< VariableStoreTypeMax
; Type
++) {
727 if ((VariableStoreHeader
[Type
] != NULL
) && (Variable
.StartPtr
== GetStartPointer (VariableStoreHeader
[Type
]))) {
731 ASSERT (Type
< VariableStoreTypeMax
);
733 // Switch to next storage
735 for (Type
++; Type
< VariableStoreTypeMax
; Type
++) {
736 if (VariableStoreHeader
[Type
] != NULL
) {
741 // Capture the case that
742 // 1. current storage is the last one, or
743 // 2. no further storage
745 if (Type
== VariableStoreTypeMax
) {
746 return EFI_NOT_FOUND
;
748 Variable
.StartPtr
= GetStartPointer (VariableStoreHeader
[Type
]);
749 Variable
.EndPtr
= GetEndPointer (VariableStoreHeader
[Type
]);
750 Variable
.CurrPtr
= Variable
.StartPtr
;
753 if (Variable
.CurrPtr
->State
== VAR_ADDED
) {
756 // Don't return NV variable when HOB overrides it
758 if ((VariableStoreHeader
[VariableStoreTypeHob
] != NULL
) && (VariableStoreHeader
[VariableStoreTypeNv
] != NULL
) &&
759 (Variable
.StartPtr
== GetStartPointer (VariableStoreHeader
[VariableStoreTypeNv
]))
761 Status
= FindVariableEx (
762 VariableStoreHeader
[VariableStoreTypeHob
],
764 GetVariableNamePtr (Variable
.CurrPtr
),
765 &Variable
.CurrPtr
->VendorGuid
,
768 if (!EFI_ERROR (Status
)) {
769 Variable
.CurrPtr
= GetNextVariablePtr (Variable
.CurrPtr
);
774 VarNameSize
= NameSizeOfVariable (Variable
.CurrPtr
);
775 ASSERT (VarNameSize
!= 0);
777 if (VarNameSize
<= *VariableNameSize
) {
778 CopyMem (VariableName
, GetVariableNamePtr (Variable
.CurrPtr
), VarNameSize
);
780 CopyMem (VariableGuid
, &Variable
.CurrPtr
->VendorGuid
, sizeof (EFI_GUID
));
782 Status
= EFI_SUCCESS
;
784 Status
= EFI_BUFFER_TOO_SMALL
;
787 *VariableNameSize
= VarNameSize
;
793 Variable
.CurrPtr
= GetNextVariablePtr (Variable
.CurrPtr
);