OSDev Wiki:Sandbox: Difference between revisions

From OSDev.wiki
Jump to navigation Jump to search
Content deleted Content added
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>

extern void* kmalloc(int size)
void panic(const char* error, const char* process) {
{
scrprint("\n");
return getFreeMemPtr(size);
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>
</source>

Revision as of 18:21, 23 December 2022

Interwiki Link

Testing new interwiki mapping

Lists


  • 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>
 
extern void* kmalloc(int size)
{
     return getFreeMemPtr(size);
}

panic.h

void panic(const char* error, const char* process);
void panic2(const char* error, const char* 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