aboutsummaryrefslogtreecommitdiffstats
path: root/Lessons/Lesson_36/UefiLessonsPkg
diff options
context:
space:
mode:
authorKonstantin Aladyshev <aladyshev22@gmail.com>2021-07-13 11:20:31 +0300
committerKonstantin Aladyshev <aladyshev22@gmail.com>2021-07-13 11:20:31 +0300
commit20a2298b393807c2eba0f6768b2fde5bf2036eb0 (patch)
tree4540ae72d4fea05b0cac945dc91194330c682d12 /Lessons/Lesson_36/UefiLessonsPkg
parent9bcc17aacdb406d44e5e3eb905a391d46f06c5b4 (diff)
downloadUEFI-Lessons-20a2298b393807c2eba0f6768b2fde5bf2036eb0.tar.gz
UEFI-Lessons-20a2298b393807c2eba0f6768b2fde5bf2036eb0.tar.bz2
UEFI-Lessons-20a2298b393807c2eba0f6768b2fde5bf2036eb0.zip
Reorder library lessons
Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
Diffstat (limited to 'Lessons/Lesson_36/UefiLessonsPkg')
-rw-r--r--Lessons/Lesson_36/UefiLessonsPkg/Library/SimpleLibraryWithConstructor/SimpleLibraryWithConstructor.c18
-rw-r--r--Lessons/Lesson_36/UefiLessonsPkg/Library/SimpleLibraryWithConstructor/SimpleLibraryWithConstructor.inf16
-rw-r--r--Lessons/Lesson_36/UefiLessonsPkg/Library/SimpleLibraryWithConstructorAndDestructor/SimpleLibraryWithConstructorAndDestructor.c28
-rw-r--r--Lessons/Lesson_36/UefiLessonsPkg/Library/SimpleLibraryWithConstructorAndDestructor/SimpleLibraryWithConstructorAndDestructor.inf17
-rw-r--r--Lessons/Lesson_36/UefiLessonsPkg/UefiLessonsPkg.dsc5
5 files changed, 83 insertions, 1 deletions
diff --git a/Lessons/Lesson_36/UefiLessonsPkg/Library/SimpleLibraryWithConstructor/SimpleLibraryWithConstructor.c b/Lessons/Lesson_36/UefiLessonsPkg/Library/SimpleLibraryWithConstructor/SimpleLibraryWithConstructor.c
new file mode 100644
index 0000000..5ade80e
--- /dev/null
+++ b/Lessons/Lesson_36/UefiLessonsPkg/Library/SimpleLibraryWithConstructor/SimpleLibraryWithConstructor.c
@@ -0,0 +1,18 @@
+#include <Library/UefiLib.h>
+#include <Library/SimpleLibrary.h>
+
+UINTN Plus2(UINTN number) {
+ return number+2;
+}
+
+EFI_STATUS
+EFIAPI
+SimpleLibraryConstructor(
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ Print(L"Hello from library constructor!\n");
+ return EFI_SUCCESS;
+}
+
diff --git a/Lessons/Lesson_36/UefiLessonsPkg/Library/SimpleLibraryWithConstructor/SimpleLibraryWithConstructor.inf b/Lessons/Lesson_36/UefiLessonsPkg/Library/SimpleLibraryWithConstructor/SimpleLibraryWithConstructor.inf
new file mode 100644
index 0000000..fc56624
--- /dev/null
+++ b/Lessons/Lesson_36/UefiLessonsPkg/Library/SimpleLibraryWithConstructor/SimpleLibraryWithConstructor.inf
@@ -0,0 +1,16 @@
+[Defines]
+ INF_VERSION = 1.25
+ BASE_NAME = SimpleLibraryWithConstructor
+ FILE_GUID = 96952c1e-86a6-4700-96b0-e7303ac3f92d
+ MODULE_TYPE = UEFI_APPLICATION
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = SimpleLibrary | UEFI_APPLICATION
+ CONSTRUCTOR = SimpleLibraryConstructor
+
+[Sources]
+ SimpleLibraryWithConstructor.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ UefiLessonsPkg/UefiLessonsPkg.dec
+
diff --git a/Lessons/Lesson_36/UefiLessonsPkg/Library/SimpleLibraryWithConstructorAndDestructor/SimpleLibraryWithConstructorAndDestructor.c b/Lessons/Lesson_36/UefiLessonsPkg/Library/SimpleLibraryWithConstructorAndDestructor/SimpleLibraryWithConstructorAndDestructor.c
new file mode 100644
index 0000000..f903e99
--- /dev/null
+++ b/Lessons/Lesson_36/UefiLessonsPkg/Library/SimpleLibraryWithConstructorAndDestructor/SimpleLibraryWithConstructorAndDestructor.c
@@ -0,0 +1,28 @@
+#include <Library/UefiLib.h>
+#include <Library/SimpleLibrary.h>
+
+UINTN Plus2(UINTN number) {
+ return number+2;
+}
+
+EFI_STATUS
+EFIAPI
+SimpleLibraryConstructor(
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ Print(L"Hello from library constructor!\n");
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+SimpleLibraryDestructor(
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ Print(L"Hello from library destructor!\n");
+ return EFI_SUCCESS;
+}
diff --git a/Lessons/Lesson_36/UefiLessonsPkg/Library/SimpleLibraryWithConstructorAndDestructor/SimpleLibraryWithConstructorAndDestructor.inf b/Lessons/Lesson_36/UefiLessonsPkg/Library/SimpleLibraryWithConstructorAndDestructor/SimpleLibraryWithConstructorAndDestructor.inf
new file mode 100644
index 0000000..3fc3bbe
--- /dev/null
+++ b/Lessons/Lesson_36/UefiLessonsPkg/Library/SimpleLibraryWithConstructorAndDestructor/SimpleLibraryWithConstructorAndDestructor.inf
@@ -0,0 +1,17 @@
+[Defines]
+ INF_VERSION = 1.25
+ BASE_NAME = SimpleLibraryWithConstructorAndDestructor
+ FILE_GUID = 96952c1e-86a6-4700-96b0-e7303ac3f92d
+ MODULE_TYPE = UEFI_APPLICATION
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = SimpleLibrary | UEFI_APPLICATION
+ CONSTRUCTOR = SimpleLibraryConstructor
+ DESTRUCTOR = SimpleLibraryDestructor
+
+[Sources]
+ SimpleLibraryWithConstructorAndDestructor.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ UefiLessonsPkg/UefiLessonsPkg.dec
+
diff --git a/Lessons/Lesson_36/UefiLessonsPkg/UefiLessonsPkg.dsc b/Lessons/Lesson_36/UefiLessonsPkg/UefiLessonsPkg.dsc
index c42b57d..cdd60c9 100644
--- a/Lessons/Lesson_36/UefiLessonsPkg/UefiLessonsPkg.dsc
+++ b/Lessons/Lesson_36/UefiLessonsPkg/UefiLessonsPkg.dsc
@@ -29,7 +29,9 @@
HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
- SimpleLibrary|UefiLessonsPkg/Library/SimpleLibrary/SimpleLibrary.inf
+ #SimpleLibrary|UefiLessonsPkg/Library/SimpleLibrary/SimpleLibrary.inf
+ #SimpleLibrary|UefiLessonsPkg/Library/SimpleLibraryWithConstructor/SimpleLibraryWithConstructor.inf
+ SimpleLibrary|UefiLessonsPkg/Library/SimpleLibraryWithConstructorAndDestructor/SimpleLibraryWithConstructorAndDestructor.inf
[Components]
UefiLessonsPkg/SimplestApp/SimplestApp.inf
@@ -52,6 +54,7 @@
UefiLessonsPkg/ListPCI/ListPCI.inf
UefiLessonsPkg/PCIRomInfo/PCIRomInfo.inf
UefiLessonsPkg/Library/SimpleLibrary/SimpleLibrary.inf
+ UefiLessonsPkg/Library/SimpleLibraryWithConstructor/SimpleLibraryWithConstructor.inf
UefiLessonsPkg/SimpleLibraryUser/SimpleLibraryUser.inf
[PcdsFixedAtBuild]