mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-30 16:28:30 +00:00
[metal] Allow programs larger than 440 KiB to run in bare metal mode (#685)
* [metal] Copy program pages to extended memory at startup * [metal] Reclaim base memory pages for later app use * [metal] Load program pages beyond 1st 440 KiB to extended memory o//examples/hellolua.com now runs correctly under QEMU (in legacy BIOS mode). * [metal] Place GDT in read/write segment The CPU absolutely needs to alter the GDT when loading the task register (via ltr). To account for this, I move the GDT into a read/write data section. There is still a "rump" read-only GDT in the text section that is used by the real mode bootloader. We also delay the loading of the task register (ltr) until after the IDT and TSS are finally set up. * [metal] Get examples/vga2.c serial output working for UEFI boot * [metal] Get examples/vga2.c VGA output working for UEFI boot * [metal] Allow munmap() to reclaim dynamically allocated pages * Place TLS sections right after .text, not after embedded zip file Co-authored-by: tkchia <tkchia-cosmo@gmx.com>
This commit is contained in:
parent
120079b0a6
commit
0da47c51de
16 changed files with 725 additions and 191 deletions
|
@ -109,8 +109,7 @@ __excep0_isr:
|
|||
isr_init:
|
||||
testb IsMetal()
|
||||
jz 9f
|
||||
ezlea _tss+0x24,di # fill up TSS, we already loaded
|
||||
# task register in ape/ape.S
|
||||
ezlea _tss+0x24,di # fill up TSS
|
||||
ezlea _isr_stk_1+ISR_STK_SZ,ax
|
||||
and $-ISR_STK_ALIGN,%al # be paranoid & enforce correct
|
||||
stosq # alignment of stack pointers
|
||||
|
@ -142,6 +141,8 @@ isr_init:
|
|||
stosq
|
||||
add $__excep1_isr-__excep0_isr,%rdx
|
||||
loop 1b
|
||||
mov $GDT_LONG_TSS,%cl # load task register (cx = 0 here)
|
||||
ltr %cx
|
||||
9: ret
|
||||
|
||||
// String constants.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue