aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tbi/screen.c
blob: ae4f2bee25526dce4491b741bdb55c03d2fa0f5d (plain)
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
#include <Uefi.h>
#include <Library/DebugLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/UefiBootServicesTableLib.h>

#include "screen.h"

struct screen *prepare_screen(VOID)
{
	struct screen *scr;
	scr = AllocateZeroPool(sizeof(struct screen));
	if(!scr)
		return NULL;

	scr->stdin = gST->ConIn;
	scr->stdout = gST->ConOut;
	scr->stderr = gST->StdErr;

	gST->ConOut->QueryMode(
		gST->ConOut,
		gST->ConOut->Mode->Mode,
		&(scr->columns),
		&(scr->lines)
	);
	scr->attr = gST->ConOut->Mode->Attribute;

	return scr;
}

VOID forget_screen(struct screen *scr)
{
	ASSERT(scr != NULL);

	FreePool(scr);
}