summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiklas Halle <niklas@niklashalle.net>2020-05-05 17:27:45 +0200
committerNiklas Halle <niklas@niklashalle.net>2020-05-05 17:27:45 +0200
commit06606fef1127717d031eea6b519cc6e43e715394 (patch)
tree99b9a9abd2177288c59c063becf63d914f079201
parent88d3bc5df1933b2753f33e5436b49e37a193abe1 (diff)
downloadbetriebssysteme-06606fef1127717d031eea6b519cc6e43e715394.tar.gz
betriebssysteme-06606fef1127717d031eea6b519cc6e43e715394.zip
done
-rw-r--r--01_exercise/bootloader.c39
1 files changed, 36 insertions, 3 deletions
diff --git a/01_exercise/bootloader.c b/01_exercise/bootloader.c
index bc7d807..afd4d96 100644
--- a/01_exercise/bootloader.c
+++ b/01_exercise/bootloader.c
@@ -60,9 +60,42 @@ void sleep(short ms) {
}
void main(void) {
- print("Hello!");
- print("\n\r > ");
+ print("Hello!\n\r");
while (1) {
- putc(getc());
+ char buf[9];
+ for (unsigned char i = 0; i < 8; i++) {
+ char c = getc();
+ if (c == '\r') {
+ if (i == 0) { // empty entry
+ print("Reboot!");
+ /*asm volatile(
+ "mov $0x5307, %%ax;" // TURN OFF SYSTEM:
+ // http://www.ctyme.com/intr/rb-1356.htm
+ "mov $0x0001, %%bx;"
+ "mov $0x0003, %%cx;"
+ "int $0x15" ::
+ : "ax", "bx", "cx");*/
+ asm volatile("xor %%eax, %%eax\n"
+ "push %%eax\n"
+ "push %%ax\n"
+ "lidt (%%esp)\n"
+ "mov %%ss, %%eax" ::
+ : "eax");
+ return;
+ } else {
+ break;
+ }
+ }
+ buf[i] = c;
+ putc('*');
+ }
+ buf[8] = '\0';
+ while (1) {
+ if (getc() == '\r')
+ break;
+ }
+ print("\n\r");
+ print(buf);
+ print("\n\r");
}
} \ No newline at end of file