Migrate XTLDR modules to C++
This commit is contained in:
@@ -8,8 +8,8 @@ include_directories(
|
||||
|
||||
# Specify list of source code files
|
||||
list(APPEND XTLDR_DUMMY_SOURCE
|
||||
${XTLDR_DUMMY_SOURCE_DIR}/dummy.c
|
||||
${XTLDR_DUMMY_SOURCE_DIR}/globals.c)
|
||||
${XTLDR_DUMMY_SOURCE_DIR}/dummy.cc
|
||||
${XTLDR_DUMMY_SOURCE_DIR}/data.cc)
|
||||
|
||||
# Link module executable
|
||||
add_executable(dummy ${XTLDR_DUMMY_SOURCE})
|
||||
|
@@ -1,16 +1,16 @@
|
||||
/**
|
||||
* PROJECT: ExectOS
|
||||
* COPYRIGHT: See COPYING.md in the top level directory
|
||||
* FILE: xtldr/modules/dummy/globals.c
|
||||
* DESCRIPTION: Dummy XTLDR module global variables
|
||||
* FILE: xtldr/modules/dummy/data.cc
|
||||
* DESCRIPTION: Dummy XTLDR module global and static data
|
||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||
*/
|
||||
|
||||
#include <dummy.h>
|
||||
#include <dummy.hh>
|
||||
|
||||
|
||||
/* XTLDR protocol handler */
|
||||
PXTBL_LOADER_PROTOCOL XtLdrProtocol;
|
||||
|
||||
/* Dummy Boot Protocol handler */
|
||||
XTBL_BOOT_PROTOCOL BlpDummyProtocol;
|
||||
XTBL_BOOT_PROTOCOL Dummy::DummyProtocol;
|
||||
|
||||
/* XTLDR protocol handler */
|
||||
PXTBL_LOADER_PROTOCOL Dummy::XtLdrProtocol;
|
@@ -1,12 +1,12 @@
|
||||
/**
|
||||
* PROJECT: ExectOS
|
||||
* COPYRIGHT: See COPYING.md in the top level directory
|
||||
* FILE: xtldr/modules/dummy/dummy.c
|
||||
* FILE: xtldr/modules/dummy/dummy.cc
|
||||
* DESCRIPTION: XTLDR Dummy Module
|
||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||
*/
|
||||
|
||||
#include <dummy.h>
|
||||
#include <dummy.hh>
|
||||
|
||||
|
||||
/* Dummy module information */
|
||||
@@ -15,6 +15,7 @@ MODULE_DESCRIPTION(L"XTLDR Dummy Module");
|
||||
MODULE_LICENSE(L"GPLv3");
|
||||
MODULE_VERSION(L"0.1");
|
||||
|
||||
|
||||
/**
|
||||
* Stub boot routine.
|
||||
*
|
||||
@@ -27,11 +28,50 @@ MODULE_VERSION(L"0.1");
|
||||
*/
|
||||
XTCDECL
|
||||
EFI_STATUS
|
||||
DmBootSystem(IN PXTBL_BOOT_PARAMETERS Parameters)
|
||||
Dummy::BootSystem(IN PXTBL_BOOT_PARAMETERS Parameters)
|
||||
{
|
||||
return STATUS_EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes DUMMY module by opening XTLDR protocol and installing DUMMY protocol.
|
||||
*
|
||||
* @param ImageHandle
|
||||
* Firmware-allocated handle that identifies the image.
|
||||
*
|
||||
* @param SystemTable
|
||||
* Provides the EFI system table.
|
||||
*
|
||||
* @return This routine returns status code.
|
||||
*
|
||||
* @since XT 1.0
|
||||
*/
|
||||
XTCDECL
|
||||
EFI_STATUS
|
||||
Dummy::InitializeModule(IN EFI_HANDLE ImageHandle,
|
||||
IN PEFI_SYSTEM_TABLE SystemTable)
|
||||
{
|
||||
EFI_GUID DummyGuid = XT_DUMMY_BOOT_PROTOCOL_GUID;
|
||||
EFI_STATUS Status;
|
||||
|
||||
/* Open the XTLDR protocol */
|
||||
Status = BlGetXtLdrProtocol(SystemTable, ImageHandle, &XtLdrProtocol);
|
||||
if(Status != STATUS_EFI_SUCCESS)
|
||||
{
|
||||
/* Failed to open the protocol, return error */
|
||||
return STATUS_EFI_PROTOCOL_ERROR;
|
||||
}
|
||||
|
||||
/* Set boot protocol routines */
|
||||
DummyProtocol.BootSystem = BootSystem;
|
||||
|
||||
/* Register XTOS boot protocol */
|
||||
XtLdrProtocol->Boot.RegisterProtocol(L"DUMMYOS", &DummyGuid);
|
||||
|
||||
/* Register DUMMY protocol as XTOS boot protocol */
|
||||
return XtLdrProtocol->Protocol.Install(&DummyProtocol, &DummyGuid);
|
||||
}
|
||||
|
||||
/**
|
||||
* This routine is the entry point of the XT EFI boot loader module.
|
||||
*
|
||||
@@ -50,23 +90,6 @@ EFI_STATUS
|
||||
XtLdrModuleMain(IN EFI_HANDLE ImageHandle,
|
||||
IN PEFI_SYSTEM_TABLE SystemTable)
|
||||
{
|
||||
EFI_GUID DummyGuid = XT_DUMMY_BOOT_PROTOCOL_GUID;
|
||||
EFI_STATUS Status;
|
||||
|
||||
/* Open the XTLDR protocol */
|
||||
Status = BlGetXtLdrProtocol(SystemTable, ImageHandle, &XtLdrProtocol);
|
||||
if(Status != STATUS_EFI_SUCCESS)
|
||||
{
|
||||
/* Failed to open the protocol, return error */
|
||||
return STATUS_EFI_PROTOCOL_ERROR;
|
||||
}
|
||||
|
||||
/* Set boot protocol routines */
|
||||
BlpDummyProtocol.BootSystem = DmBootSystem;
|
||||
|
||||
/* Register XTOS boot protocol */
|
||||
XtLdrProtocol->Boot.RegisterProtocol(L"DUMMYOS", &DummyGuid);
|
||||
|
||||
/* Register DUMMY protocol as XTOS boot protocol */
|
||||
return XtLdrProtocol->Protocol.Install(&BlpDummyProtocol, &DummyGuid);
|
||||
/* Initialize DUMMY module */
|
||||
return Dummy::InitializeModule(ImageHandle, SystemTable);
|
||||
}
|
@@ -1,26 +0,0 @@
|
||||
/**
|
||||
* PROJECT: ExectOS
|
||||
* COPYRIGHT: See COPYING.md in the top level directory
|
||||
* FILE: xtldr/modules/dummy/includes/dummy.h
|
||||
* DESCRIPTION: XTLDR Dummy Module header file
|
||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||
*/
|
||||
|
||||
#ifndef __XTLDR_DUMMY_DUMMY_H
|
||||
#define __XTLDR_DUMMY_DUMMY_H
|
||||
|
||||
#include <xtblapi.h>
|
||||
#include <globals.h>
|
||||
|
||||
|
||||
/* Dummy module routines forward references */
|
||||
XTCDECL
|
||||
EFI_STATUS
|
||||
DmBootSystem(IN PXTBL_BOOT_PARAMETERS Parameters);
|
||||
|
||||
XTCDECL
|
||||
EFI_STATUS
|
||||
XtLdrModuleMain(IN EFI_HANDLE ImageHandle,
|
||||
IN PEFI_SYSTEM_TABLE SystemTable);
|
||||
|
||||
#endif/* __XTLDR_DUMMY_DUMMY_H */
|
28
xtldr/modules/dummy/includes/dummy.hh
Normal file
28
xtldr/modules/dummy/includes/dummy.hh
Normal file
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* PROJECT: ExectOS
|
||||
* COPYRIGHT: See COPYING.md in the top level directory
|
||||
* FILE: xtldr/modules/dummy/includes/dummy.hh
|
||||
* DESCRIPTION: XTLDR Dummy Module header file
|
||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||
*/
|
||||
|
||||
#ifndef __XTLDR_DUMMY_DUMMY_HH
|
||||
#define __XTLDR_DUMMY_DUMMY_HH
|
||||
|
||||
#include <xtblapi.h>
|
||||
|
||||
|
||||
/* DUMMY module for XTLDR */
|
||||
class Dummy
|
||||
{
|
||||
private:
|
||||
STATIC XTBL_BOOT_PROTOCOL DummyProtocol;
|
||||
STATIC PXTBL_LOADER_PROTOCOL XtLdrProtocol;
|
||||
|
||||
public:
|
||||
STATIC EFI_STATUS BootSystem(IN PXTBL_BOOT_PARAMETERS Parameters);
|
||||
STATIC EFI_STATUS InitializeModule(IN EFI_HANDLE ImageHandle,
|
||||
IN PEFI_SYSTEM_TABLE SystemTable);
|
||||
};
|
||||
|
||||
#endif/* __XTLDR_DUMMY_DUMMY_HH */
|
@@ -1,21 +0,0 @@
|
||||
/**
|
||||
* PROJECT: ExectOS
|
||||
* COPYRIGHT: See COPYING.md in the top level directory
|
||||
* FILE: xtldr/modules/dummy/includes/globals.h
|
||||
* DESCRIPTION: XTLDR Dummy Module global variables
|
||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||
*/
|
||||
|
||||
#ifndef __XTLDR_DUMMY_GLOBALS_H
|
||||
#define __XTLDR_DUMMY_GLOBALS_H
|
||||
|
||||
#include <dummy.h>
|
||||
|
||||
|
||||
/* XTLDR protocol handler */
|
||||
EXTERN PXTBL_LOADER_PROTOCOL XtLdrProtocol;
|
||||
|
||||
/* Dummy Boot Protocol handler */
|
||||
EXTERN XTBL_BOOT_PROTOCOL BlpDummyProtocol;
|
||||
|
||||
#endif/* __XTLDR_DUMMY_GLOBALS_H */
|
Reference in New Issue
Block a user