:: commit ea615eb9c80227b589ba100603b24b63d52aadce

pitust <piotr@stelmaszek.com> — 2021-11-27 11:01

parents: 47bb8ce3fa

fix my tabs

diff --git a/stage23/drivers/fwcfg.s2.c b/stage23/drivers/fwcfg.s2.c
index 1c23e114..b20c7fa5 100644
--- a/stage23/drivers/fwcfg.s2.c
+++ b/stage23/drivers/fwcfg.s2.c
@@ -12,10 +12,10 @@ struct dma_descr {
 };
 
 struct fw_cfg_file {
-	uint32_t size;
-	uint16_t select;
-	uint16_t reserved;
-	char name[56];
+    uint32_t size;
+    uint16_t select;
+    uint16_t reserved;
+    char name[56];
 };
 struct fw_cfg_files {
     uint32_t count;
@@ -23,78 +23,78 @@ struct fw_cfg_files {
 };
 
 static uint16_t bswap16(uint16_t value) {
-	uint8_t* value_ptr = (uint8_t*)&value;
-	return value_ptr[0]<<8|value_ptr[1];
+    uint8_t* value_ptr = (uint8_t*)&value;
+    return value_ptr[0]<<8|value_ptr[1];
 }
 
 static uint32_t bswap32(uint32_t value) {
-	uint8_t* value_ptr = (uint8_t*)&value;
-	return value_ptr[0]<<24|value_ptr[1]<<16|value_ptr[2]<<8|value_ptr[3];
+    uint8_t* value_ptr = (uint8_t*)&value;
+    return value_ptr[0]<<24|value_ptr[1]<<16|value_ptr[2]<<8|value_ptr[3];
 }
 
 static void fwcfg_disp_read(uint16_t sel, uint32_t outsz, uint8_t* outbuf) {
-	outw(0x510, sel);
-	for (uint32_t i = 0;i < outsz;i++) outbuf[i] = inb(0x511);
+    outw(0x510, sel);
+    for (uint32_t i = 0;i < outsz;i++) outbuf[i] = inb(0x511);
 }
 
 static struct fw_cfg_files* filebuf = NULL;
 static const char* simple_mode_config = 
-	"TIMEOUT=0\n"
-	":simple mode config\n"
-	"KERNEL_PATH=fwcfg:///opt/org.limine-bootloader.kernel";
+    "TIMEOUT=0\n"
+    ":simple mode config\n"
+    "KERNEL_PATH=fwcfg:///opt/org.limine-bootloader.kernel";
 
 static const char* simple_mode_bg_config = 
-	"TIMEOUT=0\n"
-	"GRAPHICS=yes\n"
-	"THEME_BACKGROUND=50000000\n"
-	"BACKGROUND_PATH=fwcfg:///opt/org.limine-bootloader.background\n"
-	"BACKGROUND_STYLE=stretched\n"
-	":simple mode config\n"
-	"KERNEL_PATH=fwcfg:///opt/org.limine-bootloader.kernel";
+    "TIMEOUT=0\n"
+    "GRAPHICS=yes\n"
+    "THEME_BACKGROUND=50000000\n"
+    "BACKGROUND_PATH=fwcfg:///opt/org.limine-bootloader.background\n"
+    "BACKGROUND_STYLE=stretched\n"
+    ":simple mode config\n"
+    "KERNEL_PATH=fwcfg:///opt/org.limine-bootloader.kernel";
 
 static bool simple_mode = false;
 
-bool fwcfg_open(struct file_handle *handle, const char *name) {	
-	char sig[5] = { 0 };
-	fwcfg_disp_read(/* signature */ 0x0000, 4, (uint8_t*)sig);
-	if (strcmp(sig, "QEMU")) return false;
-	
-	uint32_t count;
-	fwcfg_disp_read(0x0019, 4, (uint8_t*)&count);
-	count = bswap32(count);
-	
-	if (!filebuf) {
-		filebuf = (struct fw_cfg_files*)ext_mem_alloc(count * 64 + 4);
-		fwcfg_disp_read(0x0019, count * 64 + 4, (uint8_t*)filebuf);
-	}
+bool fwcfg_open(struct file_handle *handle, const char *name) {
+    char sig[5] = { 0 };
+    fwcfg_disp_read(/* signature */ 0x0000, 4, (uint8_t*)sig);
+    if (strcmp(sig, "QEMU")) return false;
+    
+    uint32_t count;
+    fwcfg_disp_read(0x0019, 4, (uint8_t*)&count);
+    count = bswap32(count);
+    
+    if (!filebuf) {
+        filebuf = (struct fw_cfg_files*)ext_mem_alloc(count * 64 + 4);
+        fwcfg_disp_read(0x0019, count * 64 + 4, (uint8_t*)filebuf);
+    }
 
-	bool has_kernel = false, has_background = false;
-	for (uint32_t i = 0;i < count;i++) {
-		if (!strncmp(filebuf->f[i].name, name, 56)) {
-			uint16_t sel = bswap16(filebuf->f[i].select);
-    		handle->size = bswap32(filebuf->f[i].size);
-   	 		handle->is_memfile = true;
-			uint8_t* buf = (uint8_t*)(handle->fd = ext_mem_alloc(handle->size));
-			fwcfg_disp_read(sel, handle->size, buf);
-			return true;
-		}
-		if (!strncmp(filebuf->f[i].name, "opt/org.limine-bootloader.background", 56)) {
-			has_background = true;
-		}
-		if (!strncmp(filebuf->f[i].name, "opt/org.limine-bootloader.kernel", 56)) {
-			has_kernel = true;
-		}
-	}
-	
-	if (has_kernel && !strcmp(name, "opt/org.limine-bootloader.config")) {
-    	const char* conf = has_background ? simple_mode_bg_config : simple_mode_config;
-		handle->size = strlen(conf);
-   	 	handle->is_memfile = true;
-		char* buf = (char*)(handle->fd = ext_mem_alloc(handle->size + 1));
-		strcpy(buf, conf);
-		simple_mode = true;
-		return true;
-	}
+    bool has_kernel = false, has_background = false;
+    for (uint32_t i = 0;i < count;i++) {
+        if (!strncmp(filebuf->f[i].name, name, 56)) {
+            uint16_t sel = bswap16(filebuf->f[i].select);
+            handle->size = bswap32(filebuf->f[i].size);
+                handle->is_memfile = true;
+            uint8_t* buf = (uint8_t*)(handle->fd = ext_mem_alloc(handle->size));
+            fwcfg_disp_read(sel, handle->size, buf);
+            return true;
+        }
+        if (!strncmp(filebuf->f[i].name, "opt/org.limine-bootloader.background", 56)) {
+            has_background = true;
+        }
+        if (!strncmp(filebuf->f[i].name, "opt/org.limine-bootloader.kernel", 56)) {
+            has_kernel = true;
+        }
+    }
+    
+    if (has_kernel && !strcmp(name, "opt/org.limine-bootloader.config")) {
+        const char* conf = has_background ? simple_mode_bg_config : simple_mode_config;
+        handle->size = strlen(conf);
+            handle->is_memfile = true;
+        char* buf = (char*)(handle->fd = ext_mem_alloc(handle->size + 1));
+        strcpy(buf, conf);
+        simple_mode = true;
+        return true;
+    }
 
-	return false;
+    return false;
 }
diff --git a/stage23/lib/config.c b/stage23/lib/config.c
index 1e8a8717..9be23996 100644
--- a/stage23/lib/config.c
+++ b/stage23/lib/config.c
@@ -23,7 +23,7 @@ int init_config_disk(struct volume *part) {
     if ((f = fopen(part, "/limine.cfg")) == NULL
      && (f = fopen(part, "/boot/limine.cfg")) == NULL
      && (f = fopen(part, "/EFI/BOOT/limine.cfg")) == NULL
-	 && (f = uri_open("fwcfg:///opt/org.limine-bootloader.config")) == NULL) {
+     && (f = uri_open("fwcfg:///opt/org.limine-bootloader.config")) == NULL) {
         return -1;
     }
 
tab: 248 wrap: offon