diff options
author | Marvin Borner | 2020-05-11 19:14:20 +0200 |
---|---|---|
committer | Marvin Borner | 2020-05-11 19:14:20 +0200 |
commit | d00e6a08ededb16e5d075ce28d7d797763e25c55 (patch) | |
tree | 1ab924d955056c342d21e1632251c4899bf8f11c /src/userspace/programs | |
parent | 6abd515c051b6dcb545e1033ff129aaaf7293917 (diff) |
Some very small fixes in several files
Diffstat (limited to 'src/userspace/programs')
-rw-r--r-- | src/userspace/programs/init.c | 10 | ||||
-rw-r--r-- | src/userspace/programs/sh.c | 23 |
2 files changed, 28 insertions, 5 deletions
diff --git a/src/userspace/programs/init.c b/src/userspace/programs/init.c index 306aee6..019e5c3 100644 --- a/src/userspace/programs/init.c +++ b/src/userspace/programs/init.c @@ -21,10 +21,10 @@ int interrupts_enabled() void main() { - if (get_pid() != 1) { - printf("Wrong PID!\n"); - exit(1); - } + /* if (get_pid() != 1) { */ + /* printf("Wrong PID!\n"); */ + /* exit(1); */ + /* } */ if (interrupts_enabled()) printf("INTs enabled :)\n"); @@ -44,6 +44,6 @@ void main() printf("INTs disabled :(\n"); while (1) { - //printf("B"); + printf("B"); }; }
\ No newline at end of file diff --git a/src/userspace/programs/sh.c b/src/userspace/programs/sh.c index ba6ba8f..db8543d 100644 --- a/src/userspace/programs/sh.c +++ b/src/userspace/programs/sh.c @@ -11,8 +11,31 @@ void test(u8 *data) printf("."); } +u32 cpu_flags() +{ + u32 flags; + asm volatile("pushf\n" + "pop %0\n" + : "=rm"(flags)::"memory"); + return flags; +} + +int interrupts_enabled() +{ + return (cpu_flags() & 0x200) == 0x200; +} + void main() { + /* if (get_pid() != 1) { */ + /* printf("Wrong PID!\n"); */ + /* exit(1); */ + /* } */ + + if (interrupts_enabled()) + printf("INTs enabled :)\n"); + else + printf("INTs disabled :(\n"); printf("[~] "); /* while (1) { */ |