Author: wmb Date: 2009-05-03 10:46:13 +0200 (Sun, 03 May 2009) New Revision: 1167
Modified: cpu/x86/dtacc.fth cpu/x86/pc/biosload/addrs.fth cpu/x86/pc/biosload/fw.bth cpu/x86/pc/biosload/linux.fth cpu/x86/pc/biosload/ofw.bth cpu/x86/pc/linux.fth cpu/x86/pc/mmusetup.fth cpu/x86/pc/olpc/addrs.fth Log: Biosload version - fixed it so it will boot Linux.
Modified: cpu/x86/dtacc.fth =================================================================== --- cpu/x86/dtacc.fth 2009-05-03 08:44:29 UTC (rev 1166) +++ cpu/x86/dtacc.fth 2009-05-03 08:46:13 UTC (rev 1167) @@ -41,7 +41,7 @@ ;
stand-init: Exceptions - make-idt stand-set-idt move-gdt + make-idt stand-set-idt ( move-gdt) true to hardware-step? ;
Modified: cpu/x86/pc/biosload/addrs.fth =================================================================== --- cpu/x86/pc/biosload/addrs.fth 2009-05-03 08:44:29 UTC (rev 1166) +++ cpu/x86/pc/biosload/addrs.fth 2009-05-03 08:46:13 UTC (rev 1167) @@ -96,7 +96,7 @@
\ Where OFW initially loads an OS that is is going to boot
-h# 80.0000 constant def-load-base \ Convenient for initrd +h# 100.0000 constant def-load-base \ Convenient for initrd
fload ${BP}/cpu/x86/pc/virtaddr.fth
Modified: cpu/x86/pc/biosload/fw.bth =================================================================== --- cpu/x86/pc/biosload/fw.bth 2009-05-03 08:44:29 UTC (rev 1166) +++ cpu/x86/pc/biosload/fw.bth 2009-05-03 08:46:13 UTC (rev 1167) @@ -158,7 +158,11 @@ fload ${BP}/cpu/x86/pc/reenter.fth \ Various entries into Forth
headerless +[ifdef] virtual-mode +: (initial-heap) ( -- adr len ) sp0 @ ps-size - dict-limit tuck - ; +[else] : (initial-heap) ( -- adr len ) heap-base heap-size ; +[then] ' (initial-heap) is initial-heap headers
@@ -207,6 +211,7 @@ fload ${BP}/cpu/x86/pc/mscal.fth [then] fload ${BP}/cpu/x86/pc/boot.fth +fload ${BP}/cpu/x86/pc/linux.fth
hex \ If there is a PCI ethernet adapter, use it as the default net device, @@ -353,6 +358,9 @@
fload ${BP}/forth/lib/selstr.fth
+\needs ramdisk " " d# 128 config-string ramdisk +" console=tty0 console=ttyS0,115200" ' boot-file set-config-string-default + [ifdef] pc-linux " a:\initrd.imz" d# 128 config-string ramdisk " root=/dev/ram0 mount_ramdisk=1" ' boot-file set-config-string-default @@ -361,9 +369,10 @@ \ Also try " console=/dev/ttyS0,9600 console=/dev/tty0" in boot-file [then]
-[ifdef] linux-support -fload ${BP}/cpu/x86/pc/biosload/linux.fth -[then] +\ XXX delete me +\ [ifdef] linux-support +\ fload ${BP}/cpu/x86/pc/biosload/linux.fth +\ [then]
fload ${BP}/cpu/x86/pc/biosload/vmdoor.fth \ VMware interfaces
Modified: cpu/x86/pc/biosload/linux.fth =================================================================== --- cpu/x86/pc/biosload/linux.fth 2009-05-03 08:44:29 UTC (rev 1166) +++ cpu/x86/pc/biosload/linux.fth 2009-05-03 08:46:13 UTC (rev 1167) @@ -158,6 +158,11 @@ \ Add some entries to the GDT for Linux : amend-gdt ( -- ) gdtr@ drop ( va ) + h# 0000.ffff over h# 10 + l! ( va ) \ user 4 GB code at 0 + h# 00cf.fa00 over h# 14 + l! ( va ) + h# 0000.ffff over h# 18 + l! ( va ) \ user 4 GB data at 0 + h# 00cf.f200 over h# 1c + l! ( va ) + h# 0000.ffff over h# 20 + l! ( va ) \ user 4 GB code at 0 h# 00cf.fa00 over h# 24 + l! ( va ) h# 0000.ffff over h# 28 + l! ( va ) \ user 4 GB data at 0
Modified: cpu/x86/pc/biosload/ofw.bth =================================================================== --- cpu/x86/pc/biosload/ofw.bth 2009-05-03 08:44:29 UTC (rev 1166) +++ cpu/x86/pc/biosload/ofw.bth 2009-05-03 08:46:13 UTC (rev 1167) @@ -4,6 +4,7 @@ \ in: biostart.img in: reset.di in: start.di +in: ${BP}/cpu/x86/pc/biosload/build/paging.di in: fw.img in: ${BP}/dev/usb2/hcd/ohci/build/ohci.fc in: ${BP}/dev/usb2/hcd/uhci/build/uhci.fc @@ -84,6 +85,7 @@ [then] " reset.di" $add-file " start.di" $add-file + " paging.di" $add-file " ${BP}/cpu/x86/build/inflate.bin" " inflate" $add-dropin " fw.img" " firmware" $add-deflated-dropin " ${BP}/dev/pci/build/pcibridg.fc" " class060400" $add-deflated-dropin
Modified: cpu/x86/pc/linux.fth =================================================================== --- cpu/x86/pc/linux.fth 2009-05-03 08:44:29 UTC (rev 1166) +++ cpu/x86/pc/linux.fth 2009-05-03 08:46:13 UTC (rev 1167) @@ -115,6 +115,7 @@
0 h# 1ff +lp c! \ Aux device - set to AA if PS2 mouse present /ramdisk 0<> h# 210 +lp c! \ loader type - set non0 to enable ramdisk info + h# 211 +lp dup c@ h# 40 or swap c! \ Set the "KEEP_SEGMENTS" bit (new as of about 2.6.29) \ h# 100000 h# 214 +lp l! \ kernel start - unused ramdisk-adr h# 218 +lp l! \ initrd start /ramdisk h# 21c +lp l! \ initrd size @@ -148,9 +149,25 @@ ; [then]
+\ Add some entries to the GDT for Linux +: amend-gdt ( -- ) + gdtr@ drop ( va ) + h# 0000.ffff over h# 10 + l! ( va ) \ user 4 GB code at 0 + h# 00cf.9a00 over h# 14 + l! ( va ) + h# 0000.ffff over h# 18 + l! ( va ) \ user 4 GB data at 0 + h# 00cf.9200 over h# 1c + l! ( va ) + + h# 0000.ffff over h# 20 + l! ( va ) \ user 4 GB code at 0 + h# 00cf.9a00 over h# 24 + l! ( va ) + h# 0000.ffff over h# 28 + l! ( va ) \ user 4 GB data at 0 + h# 00cf.9200 over h# 2c + l! ( va ) + drop +; + : linux-fixup ( -- ) [ifdef] linux-logo linux-logo [then] args-buf cscount set-parameters ( ) + amend-gdt ( ) h# ff h# 21 pc! \ Squelch the timer interrupt and others
linux-base linux-params (init-program) @@ -206,7 +223,10 @@
: claim-params ( -- ) [ifdef] virtual-mode - 0 0 1meg -1 mmu-map ( ) \ Make the parameter area accessible +\ We don't need this because we assume that low memory is already mapped 1-1 +\ If low mem is mapped with 4M pages, mmu-map will overwrite the page at 0 +\ because the MMU methods don't handle 4M pages correctly. +\ 0 0 1meg -1 mmu-map ( ) \ Make the parameter area accessible [then] 0 +lp h# 1000 0 mem-claim drop \ Play nice with memory reporting ;
Modified: cpu/x86/pc/mmusetup.fth =================================================================== --- cpu/x86/pc/mmusetup.fth 2009-05-03 08:44:29 UTC (rev 1166) +++ cpu/x86/pc/mmusetup.fth 2009-05-03 08:46:13 UTC (rev 1167) @@ -4,7 +4,12 @@ \ The code in this file depends in detail on the initial MMU setup \ established by initmmu.fth
-: (memory?) ( adr -- flag ) h# 1000.0000 u< ; +[ifdef] total-ram +: (memory?) ( adr -- flag ) total-ram u< ; +[else] +h# 8000.0000 value ram-boundary +: (memory?) ( adr -- flag ) ram-boundary u< ; +[then] ' (memory?) is memory?
dev /mmu
Modified: cpu/x86/pc/olpc/addrs.fth =================================================================== --- cpu/x86/pc/olpc/addrs.fth 2009-05-03 08:44:29 UTC (rev 1166) +++ cpu/x86/pc/olpc/addrs.fth 2009-05-03 08:46:13 UTC (rev 1167) @@ -58,8 +58,6 @@ h# fe02.8000 constant camera-pci-base h# fe02.c000 constant uoc-pci-base
-h# 9.fc00 constant 'ebda \ Extended BIOS Data Area, which we co-opt for our real-mode workspace - h# e0000 constant rsdp-adr h# e0040 constant rsdt-adr h# e0080 constant fadt-adr
openfirmware@openfirmware.info