Skip to content

Commit eaad58b

Browse files
committed
Initial commit.
0 parents  commit eaad58b

20 files changed

Lines changed: 1686 additions & 0 deletions

File tree

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
*~
2+
*.o
3+
*.a
4+
*.efi
5+
fs
6+
GPATH
7+
GRTAGS
8+
GSYMS
9+
GTAGS

A03_allocatepages/Makefile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
CC = x86_64-w64-mingw32-gcc
2+
OBJCOPY = x86_64-w64-mingw32-objcopy
3+
CFLAGS = -Wall -Wextra
4+
CFLAGS += -nostdinc -nostdlib -fno-builtin
5+
CFLAGS += -Wl,--subsystem,10
6+
7+
poiboot.efi: poiboot.o libuefi/libuefi.a
8+
$(CC) $(CFLAGS) -e efi_main -o $@ $+
9+
10+
poiboot.o: poiboot.c
11+
$(CC) $(CFLAGS) -Iinclude -c -o $@ $<
12+
13+
libuefi/libuefi.a:
14+
make -C libuefi CC=$(CC) CFLAGS="$(CFLAGS)"
15+
16+
deploy: poiboot.efi
17+
mkdir -p ../fs/EFI/BOOT
18+
cp $< ../fs/EFI/BOOT/BOOTX64.EFI
19+
20+
run:
21+
qemu-system-x86_64 -bios OVMF.fd -hda fat:../fs -m 2G -nographic
22+
23+
clean:
24+
rm -f *~ *.o *.efi
25+
make -C libuefi clean
26+
27+
.PHONY: clean run

A03_allocatepages/include/common.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#ifndef _COMMON_H_
2+
#define _COMMON_H_
3+
4+
#define NULL (void *)0
5+
#define TRUE 1
6+
#define FALSE 0
7+
#define SC_OFS 0x1680
8+
#define SC_ESC (SC_OFS + 0x0017)
9+
10+
void putc(unsigned short c);
11+
void puts(unsigned short *s);
12+
void puth(unsigned long long val, unsigned char num_digits);
13+
unsigned short getc(void);
14+
unsigned int gets(unsigned short *buf, unsigned int buf_size);
15+
int strcmp(const unsigned short *s1, const unsigned short *s2);
16+
void strncpy(unsigned short *dst, unsigned short *src, unsigned long long n);
17+
unsigned long long strlen(unsigned short *str);
18+
unsigned char check_warn_error(unsigned long long status, unsigned short *name);
19+
void assert(unsigned long long status, unsigned short *message);
20+
21+
#endif

0 commit comments

Comments
 (0)