aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tbi/screen.c
blob: 7eb9ac25fc0d77537667639a8e232e1753806ae6 (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
#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)
	);

	return scr;
}

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

	FreePool(scr);
}