mirror of
				https://gitlab.com/qemu-project/qboot.git
				synced 2024-02-13 08:33:40 +08:00 
			
		
		
		
	copy only ~11K down to low memory
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
		
							
								
								
									
										2
									
								
								flat.lds
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								flat.lds
									
									
									
									
									
								
							| @ -14,12 +14,14 @@ SECTIONS | ||||
|     . = ALIGN(16); | ||||
|     edata = .; | ||||
|     . = 1024K - 128; | ||||
|     sinit = .; | ||||
|     .init : { | ||||
| 	*(.init); | ||||
| 	. = 128 - 16; | ||||
|         *(.resetvector); | ||||
| 	. = 128; | ||||
|     } | ||||
|     einit = .; | ||||
| } | ||||
|  | ||||
| ENTRY(main) | ||||
|  | ||||
| @ -85,8 +85,8 @@ static void setup_pic(void) | ||||
| void setup_hw(void) | ||||
| { | ||||
| 	const int bdf = 0; | ||||
| 	const uint8_t *bios_start = (uint8_t *)0xffff0000; | ||||
| 	uint8_t *low_start = (uint8_t *)0xf0000; | ||||
| 	const uint8_t *bios_start = &stext + 0xfff00000; | ||||
| 	const uint8_t *init_start = &sinit + 0xfff00000; | ||||
| 	int pambase; | ||||
|  | ||||
|         uint32_t id = pci_config_readl(bdf, 0); | ||||
| @ -111,7 +111,8 @@ void setup_hw(void) | ||||
| 	// Make ram from 0xf0000-0x100000 read-write and shadow BIOS | ||||
| 	// We're still running from 0xffff0000 | ||||
| 	pci_config_writeb(bdf, pambase, 0x30); | ||||
| 	memcpy(low_start, bios_start, 0x10000); | ||||
| 	memcpy(&stext, bios_start, &edata - &stext); | ||||
| 	memcpy(&sinit, init_start, &einit - &sinit); | ||||
|  | ||||
| 	setup_pic(); | ||||
| } | ||||
|  | ||||
| @ -47,6 +47,11 @@ extern bool boot_from_cbfs(void *base, size_t sz); | ||||
| extern uint16_t e820_seg; | ||||
| extern uint32_t lowmem; | ||||
|  | ||||
| extern uint8_t stext; | ||||
| extern uint8_t edata; | ||||
| extern uint8_t sinit; | ||||
| extern uint8_t einit; | ||||
|  | ||||
| #define ARRAY_SIZE(x)	(sizeof(x) / sizeof(x[0])) | ||||
|  | ||||
| static inline void __attribute__((noreturn)) panic(void) | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Paolo Bonzini
					Paolo Bonzini