Xyris  0.5
EarlyPanic.cpp File Reference
+ Include dependency graph for EarlyPanic.cpp:

Go to the source code of this file.

Macros

#define TTY_WIDTH   80
 
#define TTY_HEIGHT   25
 
#define VGA_COLOR(bg, fg)   (uint16_t)(((bg)<<4)|((fg)&0xF))
 
#define VGA_CHAR(ch, co)   (uint16_t)((ch)|((co)<<8))
 

Enumerations

enum  bios_color : uint16_t {
  BIOS_Black = 0, BIOS_Blue = 1, BIOS_Green = 2, BIOS_Cyan = 3,
  BIOS_Red = 4, BIOS_Magenta = 5, BIOS_Brown = 6, BIOS_LightGrey = 7,
  BIOS_DarkGrey = 8, BIOS_LightBlue = 9, BIOS_LightGreen = 10, BIOS_LightCyan = 11,
  BIOS_LightRed = 12, BIOS_LightMagenta = 13, BIOS_Yellow = 14, BIOS_White = 15
}
 

Functions

 __attribute__ ((section(".early_text"))) void EarlyPanic(const char *str)
 

Macro Definition Documentation

◆ TTY_HEIGHT

#define TTY_HEIGHT   25

Definition at line 18 of file EarlyPanic.cpp.

◆ TTY_WIDTH

#define TTY_WIDTH   80

Definition at line 17 of file EarlyPanic.cpp.

◆ VGA_CHAR

#define VGA_CHAR (   ch,
  co 
)    (uint16_t)((ch)|((co)<<8))

Definition at line 20 of file EarlyPanic.cpp.

◆ VGA_COLOR

#define VGA_COLOR (   bg,
  fg 
)    (uint16_t)(((bg)<<4)|((fg)&0xF))

Definition at line 19 of file EarlyPanic.cpp.

Enumeration Type Documentation

◆ bios_color

enum bios_color : uint16_t
Enumerator
BIOS_Black 
BIOS_Blue 
BIOS_Green 
BIOS_Cyan 
BIOS_Red 
BIOS_Magenta 
BIOS_Brown 
BIOS_LightGrey 
BIOS_DarkGrey 
BIOS_LightBlue 
BIOS_LightGreen 
BIOS_LightCyan 
BIOS_LightRed 
BIOS_LightMagenta 
BIOS_Yellow 
BIOS_White 

Definition at line 22 of file EarlyPanic.cpp.

22  : uint16_t {
23  BIOS_Black = 0,
24  BIOS_Blue = 1,
25  BIOS_Green = 2,
26  BIOS_Cyan = 3,
27  BIOS_Red = 4,
28  BIOS_Magenta = 5,
29  BIOS_Brown = 6,
30  BIOS_LightGrey = 7,
31  BIOS_DarkGrey = 8,
32  BIOS_LightBlue = 9,
33  BIOS_LightGreen = 10,
34  BIOS_LightCyan = 11,
35  BIOS_LightRed = 12,
36  BIOS_LightMagenta = 13,
37  BIOS_Yellow = 14,
38  BIOS_White = 15
39 };

Function Documentation

◆ __attribute__()

__attribute__ ( (section(".early_text"))  ) const

Map bootloader information into the higher half of memory so that the kernel can access it and parse it.

Stivale2 protocol kernel stage 1 entry. Stage 1 is responsible for providing an entry point for the bootloader in C, performing any necessary bootstrappign and then calling into the C++ stage 2.

identity map from 0x00000000 -> LOWMEM_END

Map kernel memory into the higher half of memory See linker.ld for details on where the kernel should be mapped.

Definition at line 42 of file EarlyPanic.cpp.

44 {
45  volatile uint16_t* where;
46  uint16_t* biosVGABuffer = (uint16_t*)0x000B8000;
47  int x = 0;
48  int y = 0;
49  // Clear the screen
50  for (int i = 0; i < TTY_WIDTH; i++) {
51  for (int j = 0; j < TTY_HEIGHT; j++) {
52  where = biosVGABuffer + (j * TTY_WIDTH + i);
53  *where = VGA_CHAR(' ', VGA_COLOR(BIOS_Black, BIOS_White));
54  }
55  }
56  // For each character in the string
57  for (int i = 0; str[i] != '\0'; ++i) {
58  switch (str[i]) {
59  // Newline
60  case '\n':
61  x = 0;
62  y++;
63  break;
64  // Anything else
65  default:
66  where = biosVGABuffer + (y * TTY_WIDTH + x);
67  *where = VGA_CHAR(str[i], VGA_COLOR(BIOS_Red, BIOS_White));
68  x++;
69  break;
70  }
71  }
72 
74 }
+ Here is the call graph for this function:
VGA_CHAR
#define VGA_CHAR(ch, co)
Definition: EarlyPanic.cpp:20
BIOS_LightGreen
@ BIOS_LightGreen
Definition: EarlyPanic.cpp:33
BIOS_DarkGrey
@ BIOS_DarkGrey
Definition: EarlyPanic.cpp:31
BIOS_Magenta
@ BIOS_Magenta
Definition: EarlyPanic.cpp:28
TTY_HEIGHT
#define TTY_HEIGHT
Definition: EarlyPanic.cpp:18
BIOS_LightBlue
@ BIOS_LightBlue
Definition: EarlyPanic.cpp:32
BIOS_Blue
@ BIOS_Blue
Definition: EarlyPanic.cpp:24
BIOS_LightMagenta
@ BIOS_LightMagenta
Definition: EarlyPanic.cpp:36
BIOS_Brown
@ BIOS_Brown
Definition: EarlyPanic.cpp:29
BIOS_LightRed
@ BIOS_LightRed
Definition: EarlyPanic.cpp:35
VGA_COLOR
#define VGA_COLOR(bg, fg)
Definition: EarlyPanic.cpp:19
BIOS_Yellow
@ BIOS_Yellow
Definition: EarlyPanic.cpp:37
Arch::haltAndCatchFire
void haltAndCatchFire()
Disable interrupts and halts execution.
Definition: Arch.hpp:42
TTY_WIDTH
#define TTY_WIDTH
Definition: EarlyPanic.cpp:17
BIOS_White
@ BIOS_White
Definition: EarlyPanic.cpp:38
BIOS_Black
@ BIOS_Black
Definition: EarlyPanic.cpp:23
BIOS_Cyan
@ BIOS_Cyan
Definition: EarlyPanic.cpp:26
BIOS_LightCyan
@ BIOS_LightCyan
Definition: EarlyPanic.cpp:34
BIOS_Red
@ BIOS_Red
Definition: EarlyPanic.cpp:27
BIOS_LightGrey
@ BIOS_LightGrey
Definition: EarlyPanic.cpp:30
BIOS_Green
@ BIOS_Green
Definition: EarlyPanic.cpp:25