setos

拙OS
Log | Files | Refs | LICENSE

kernel.c (799B)


      1 #include "uefi.h"
      2 
      3 typedef unsigned char          uint8_t;
      4 typedef unsigned int           uint32_t;
      5 typedef unsigned long long int uint64_t;
      6 
      7 // Argument order is to interface to the MS-ABI
      8 void
      9 kernel_main(void *dummy0, void *dummy1, void *dummy2,
     10 	EFI_GRAPHICS_OUTPUT_PROTOCOL *gop)
     11 {
     12 	uint32_t *fb_base = (uint32_t *)gop->Mode->FrameBufferBase;
     13 	uint32_t hrez = gop->Mode->Info->HorizontalResolution;
     14 	uint32_t vrez = gop->Mode->Info->VerticalResolution;
     15 	uint32_t sl = gop->Mode->Info->PixelsPerScanLine;
     16 	uint32_t cx = hrez / 2;
     17 	uint32_t cy = vrez / 2;
     18 	for (int i = 0; i < vrez; i++) {
     19 		for (int j = 0; j < hrez; j++) {
     20 			if ((cx-j)*(cx-j) + (cy-i)*(cy-i) < (vrez/3) * (vrez/3)) {
     21 				fb_base[i * sl + j] = 0xff << 16;
     22 			} else {
     23 				fb_base[i * sl + j] = 0xffffff;
     24 			}
     25 		}
     26 	}
     27 	for(;;);
     28 }