summaryrefslogtreecommitdiff
path: root/util/smmstoretool/utils.h
blob: a1cefc1748ad0de2eb0325f7aa3a11c13bcf968e (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
/* SPDX-License-Identifier: GPL-2.0-or-later */

#ifndef SMMSTORETOOL__UTILS_H__
#define SMMSTORETOOL__UTILS_H__

#include <stddef.h>
#include <stdbool.h>
#include <stdint.h>

#include "udk2017.h"

struct mem_range_t {
	uint8_t *start;
	size_t length;
};

void *xmalloc(size_t size);

char *to_chars(const CHAR16 uchars[], size_t size);

CHAR16 *to_uchars(const char chars[], size_t *size);

bool str_eq(const char lhs[], const char rhs[]);

struct mem_range_t map_file(const char path[], bool rw);

void unmap_file(struct mem_range_t store);

#endif // SMMSTORETOOL__UTILS_H__