OSDev Wiki:Sandbox: Difference between revisions
From OSDev Wiki
Jump to navigation
Jump to search
m (Reverted edits by David23x (talk) to last revision by Johnburger)
Line 60:
Line 60:
</pre>
</pre>
====(削除) Best Code in a Box (削除ここまで)====
====(追記) panic.c (追記ここまで)====
<source lang="c">
<source lang="c">
#include (削除) <kmem (削除ここまで).h>
#include (追記) "kernel (追記ここまで).h(追記) " (追記ここまで)
(追記) void panic(const char* error, const char* process) { (追記ここまで)
(追記) scrprint("\n"); (追記ここまで)
(追記) scrprint("PANIC: "); (追記ここまで)
(追記) scrprint(error); (追記ここまで)
(追記) scrprint("\nThis error was caused by running process "); (追記ここまで)
(追記) scrprint(process); (追記ここまで)
(追記) scrprint(". You may open a bug report at <bugrepot (追記ここまで)>(追記) \n"); (追記ここまで)
(追記) scrprint("Its safe to hold/press the power button now."); (追記ここまで)
(追記) __asm__ volatile ("hlt"); (追記ここまで)
(追記) } (追記ここまで)
void (追記) panic2(const char (追記ここまで)* (追記) error, const char* process) { (追記ここまで)
(追記) scrprint("\n"); (追記ここまで)
(追記) scrprint("PANIC: "); (追記ここまで)
(追記) scrprint(error); (追記ここまで)
(追記) scrprint("\nThis error was caused by running process "); (追記ここまで)
(追記) scrprint (追記ここまで)((追記) process (追記ここまで))(追記) ; (追記ここまで)
(追記) scrprint(". You may open a bug report at <bugrepot>!\n"); (追記ここまで)
(追記) scrprint (追記ここまで)((追記) "Its safe to hold/press the power button now." (追記ここまで));
(追記) // panic handlers may add a custom halt function. (追記ここまで)
}
}
(追記) </source> (追記ここまで)
(追記) (追記ここまで)
(追記) ====panic.h==== (追記ここまで)
(追記) (追記ここまで)
(追記) <source lang="c"> (追記ここまで)
(追記) void panic(const char* error, const char* process); (追記ここまで)
(追記) void panic2(const char* error, const char* process); (追記ここまで)
</source>
</source>
Revision as of 18:20, 23 December 2022
Interwiki Link
Testing new interwiki mapping
Lists
- OS Name - Title or short description.
- Architecture: x86
- Languages: Assembly, C
- Source code: Yes,GPL
- URL: http://www.osdev.org
- OS Name - Title or short description.
- Contact: Chase (chase AT osdev.org)
- URL: http://www.osdev.org
- Numbered List
- Item
- Item
- Another Item
- SubItem
- Are there ones that do Roman, Number and Letter?
Link Types
Subpages
Code in a Box
#include <kmem.h>
extern void* kmalloc(int size)
{
return getFreeMemPtr(size);
}
Better Code in a Box
#include <kmem.h>
extern void* kmalloc(int size)
{
return getFreeMemPtr(size);
}
panic.c
#include"kernel.h" voidpanic(constchar*error,constchar*process){ scrprint("\n"); scrprint("PANIC: "); scrprint(error); scrprint("\nThis error was caused by running process "); scrprint(process); scrprint(". You may open a bug report at <bugrepot>\n"); scrprint("Its safe to hold/press the power button now."); __asm__volatile("hlt"); } voidpanic2(constchar*error,constchar*process){ scrprint("\n"); scrprint("PANIC: "); scrprint(error); scrprint("\nThis error was caused by running process "); scrprint(process); scrprint(". You may open a bug report at <bugrepot>!\n"); scrprint("Its safe to hold/press the power button now."); // panic handlers may add a custom halt function. }
panic.h
voidpanic(constchar*error,constchar*process); voidpanic2(constchar*error,constchar*process);
Table 1
| Column 1 | Column 2 |
|---|---|
| Item | Item |
| Item 2 | Item 2 |
Advanced Table
| Column 1 | Column 2 | Column 3 | |
|---|---|---|---|
| Item | No | Yes | No |
| Item 2 | Yes | Yes | Yes |
Complex Table
| Column 1 | Column 2 | ||
|---|---|---|---|
| Foo1 | Foo2 | ||
| Item 2 | Yes | Yes | Yes |