-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMicroPython.c
More file actions
70 lines (56 loc) · 1.96 KB
/
MicroPython.c
File metadata and controls
70 lines (56 loc) · 1.96 KB
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
/** @file
Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include "MicroPython.h"
extern int main (int argc, char **argv);
SBL_SERVICE sbl_service_tbl;
SBL_SERVICE *sbl_service;
void *serivce_map_tbl[] = {
"DebugPrint", &sbl_service_tbl.DebugPrint,
"ConsoleInit", &sbl_service_tbl.ConsoleInit,
"ConsolePoll", &sbl_service_tbl.ConsolePoll,
"ConsoleRead", &sbl_service_tbl.ConsoleRead,
"ConsoleWrite", &sbl_service_tbl.ConsoleWrite,
"MicroSecondDelay", &sbl_service_tbl.MicroSecondDelay,
"AllocatePages", &sbl_service_tbl.AllocatePages,
"FreePages", &sbl_service_tbl.FreePages,
"DrawFrameBuffer", &sbl_service_tbl.DrawFrameBuffer,
"SerialPortWrite", &sbl_service_tbl.SerialPortWrite,
"LoadFile", &sbl_service_tbl.LoadFile,
"BuildConfigData", &sbl_service_tbl.BuildConfigData,
"SaveConfigData", &sbl_service_tbl.SaveConfigData,
"PlatformReset", &sbl_service_tbl.PlatformReset,
};
/**
Payload main entry.
This function will continue Payload execution with a new memory based stack.
@param Param parameter passed from SwitchStack().
**/
VOID
EFIAPI
SecStartup (
IN VOID *HobList,
IN PLD_MOD_PARAM *PldModParam
)
{
int idx;
VOID *func;
PLD_MOD_PARAM pld_mod;
CopyMem (&pld_mod, PldModParam, sizeof(PLD_MOD_PARAM));
sbl_service = &sbl_service_tbl;
for (idx = 0; idx < sizeof(serivce_map_tbl) / sizeof(serivce_map_tbl[0]); idx += 2) {
func = pld_mod.GetProcAddress (serivce_map_tbl[idx]);
if (func == NULL) {
if (idx > 0) {
assert (func != NULL);
} else {
CpuDeadLoop ();
}
}
*(VOID **)serivce_map_tbl[idx + 1] = func;
}
DEBUG ((DEBUG_INFO, "Starting MicroPython ...\n"));
main (1, &pld_mod.CmdLineBuf);
CpuDeadLoop ();
}