OSDev Wiki:Sandbox: Difference between revisions

From OSDev Wiki
Jump to navigation Jump to search
Line 60: Line 60:
</pre>
</pre>


====(削除) panic.c (削除ここまで)====
====(追記) Best Code in a Box (追記ここまで)====


<source lang="c">
<source lang="c">
#include (削除) "kernel (削除ここまで).h(削除) " (削除ここまで)
#include (追記) <kmem (追記ここまで).h(追記) > (追記ここまで)
(追記) (追記ここまで)
void (削除) panic(const char (削除ここまで)* (削除) error, const char* process) { (削除ここまで)
(追記) extern (追記ここまで)void* (追記) kmalloc (追記ここまで)((追記) int size (追記ここまで))
(削除) scrprint("\n"); (削除ここまで)
{
(削除) scrprint("PANIC: "); (削除ここまで)
(追記) return getFreeMemPtr (追記ここまで)((追記) size (追記ここまで));
(削除) 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>
</source>

Revision as of 18:21, 23 December 2022

Interwiki Link

Testing new interwiki mapping

Lists


  • OS Name - Title or short description.


  • OS Name - Title or short description.
  1. Numbered List
    1. Item
    2. Item
  2. Another Item
    1. SubItem
    2. Are there ones that do Roman, Number and Letter?

Link Types

forum:8

topic:677

OSDev Home

OSDev

Subpages

Sub-page

Sub-sub-page

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);
}

Best Code in a Box

#include<kmem.h>

externvoid*kmalloc(intsize)
{
returngetFreeMemPtr(size);
}

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
Retrieved from "https://wiki.osdev.org/index.php?title=OSDev_Wiki:Sandbox&oldid=27544"