implement kernel panic
This commit is contained in:
4
common.c
4
common.c
@@ -84,7 +84,9 @@ char *strcpy(char *dst, const char *src) {
|
|||||||
*d++ = *src++;
|
*d++ = *src++;
|
||||||
*d = '\0';
|
*d = '\0';
|
||||||
return dst;
|
return dst;
|
||||||
}
|
} // The strcpy function continues copying even if
|
||||||
|
// src is longer than the memory area of dst.
|
||||||
|
// This can easily lead to bugs and vulnerabilities
|
||||||
|
|
||||||
int strcmp(const char *s1, const char *s2) {
|
int strcmp(const char *s1, const char *s2) {
|
||||||
while (*s1 && *s2) {
|
while (*s1 && *s2) {
|
||||||
|
15
kernel.c
15
kernel.c
@@ -27,12 +27,17 @@ void putchar(char ch) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void kernel_main(void) {
|
void kernel_main(void) {
|
||||||
printf("\n\nHello %s\n", "RETARD!");
|
// printf("\n\nHello %s\n", "friend :3");
|
||||||
printf("60 + 9 = %d, %x\n", 60 + 9, 0x1234abcd);
|
// printf("60 + 9 = %d, %x\n", 60 + 9, 0x1234abcd);
|
||||||
|
//
|
||||||
|
// for (;;) {
|
||||||
|
// __asm__ __volatile__("wfi");
|
||||||
|
// }
|
||||||
|
|
||||||
|
memset(__bss, 0, (size_t) __bss_end - (size_t) __bss);
|
||||||
|
|
||||||
for (;;) {
|
PANIC("BOOOO!!! GET INFECTED WITH BOOTKID YOU SKID! 0x1337h@x0r");
|
||||||
__asm__ __volatile__("wfi");
|
printf("you lucky bitch got away\n");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
__attribute__((section(".text.boot")))
|
__attribute__((section(".text.boot")))
|
||||||
|
Reference in New Issue
Block a user