aboutsummaryrefslogtreecommitdiff
path: root/src/userspace/programs/sh.c
diff options
context:
space:
mode:
authorMarvin Borner2020-05-11 19:14:20 +0200
committerMarvin Borner2020-05-11 19:14:20 +0200
commitd00e6a08ededb16e5d075ce28d7d797763e25c55 (patch)
tree1ab924d955056c342d21e1632251c4899bf8f11c /src/userspace/programs/sh.c
parent6abd515c051b6dcb545e1033ff129aaaf7293917 (diff)
Some very small fixes in several files
Diffstat (limited to 'src/userspace/programs/sh.c')
-rw-r--r--src/userspace/programs/sh.c23
1 files changed, 23 insertions, 0 deletions
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) { */