OpenBIOS
Threads by month
- ----- 2026 -----
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2000 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1999 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1998 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1997 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1996 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1995 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1994 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1993 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1992 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1991 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1990 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1989 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1988 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1987 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1986 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1985 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1984 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1983 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1982 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1981 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1980 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1979 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1978 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1977 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1976 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1975 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1974 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1973 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1972 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1971 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1970 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1969 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1968 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1967 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1966 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1965 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1964 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1963 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1962 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1961 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1960 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1959 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1958 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1957 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1956 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1955 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1954 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1953 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1952 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1951 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1950 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1949 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1948 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1947 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1946 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1945 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1944 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1943 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1942 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1941 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1940 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1939 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1938 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1937 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1936 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1935 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1934 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1933 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1932 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1931 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1930 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1929 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1928 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1927 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1926 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1925 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1924 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1923 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1922 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1921 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1920 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1919 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1918 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1917 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1916 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1915 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1914 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1913 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1912 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1911 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1910 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1909 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1908 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1907 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1906 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1905 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1904 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
September 2007
- 3 participants
- 60 discussions
Author: wmb
Date: 2007-09-30 20:03:33 +0200 (Sun, 30 Sep 2007)
New Revision: 655
Modified:
cpu/x86/build/builder.dic
cpu/x86/disassem.fth
forth/lib/util.fth
Log:
Fixed address calculation bug in disassembler (16-bit mode only),
made dis16 and dis32 appear in the forth vocabulary,
add "mib" and "kib" for convenience.
Modified: cpu/x86/build/builder.dic
===================================================================
(Binary files differ)
Modified: cpu/x86/disassem.fth
===================================================================
--- cpu/x86/disassem.fth 2007-09-29 20:03:38 UTC (rev 654)
+++ cpu/x86/disassem.fth 2007-09-30 18:03:33 UTC (rev 655)
@@ -21,11 +21,14 @@
: op16@ ( -- w ) op8@ op8@ bwjoin ;
: op32@ ( -- l ) op16@ op16@ wljoin ;
+: bext ( b -- l ) d# 24 << d# 24 >>a ;
+: wext ( w -- l ) d# 16 << d# 16 >>a ;
+
\ change size of data
true value op32?
: opv@ ( -- l | w ) op32? if op32@ else op16@ then ;
true value ad32?
-: adv@ ( -- l | w ) ad32? if op32@ else op16@ then ;
+: adv@ ( -- l | w ) ad32? if op32@ else op16@ wext then ;
: dis16 ( -- ) false is op32? false is ad32? ;
: dis32 ( -- ) true is op32? true is ad32? ;
\ XXX We should also change the register names e.g. from "eax" to "ax"
@@ -42,9 +45,6 @@
: midbits ( -- n ) 3 3 ibits ;
: hibits ( -- n ) 6 2 ibits ;
-: bext ( b -- l ) d# 24 << d# 24 >>a ;
-: wext ( w -- l ) d# 16 << d# 16 >>a ;
-
hex
: ., ( -- ) ." ," ;
@@ -594,6 +594,8 @@
alias pc!dis1 pc!dis1
alias +dis +dis
alias dis dis
+alias dis16 dis16
+alias dis32 dis32
previous previous previous definitions
\ LICENSE_BEGIN
Modified: forth/lib/util.fth
===================================================================
--- forth/lib/util.fth 2007-09-29 20:03:38 UTC (rev 654)
+++ forth/lib/util.fth 2007-09-30 18:03:33 UTC (rev 655)
@@ -72,6 +72,9 @@
: bits ( n bit# #bits -- bits ) -rot rshift swap lowbits ;
: bit ( n bit# -- ) 1 bits ;
+: kib ( n -- nkib ) d# 10 lshift ; \ Convert to kilobytes
+: mib ( n -- nmib ) d# 20 lshift ; \ Convert to megabytes
+
: log2 ( n -- log2-of-n )
0 begin ( n log )
swap 2/ ( log n' )
1
0
Release early, release often.
Openfirmware seems to insist on virtual-mode when loading a Linux/x86 kernel
as plain ELF binary (vmlinu_x_). Here's my proposed fix to load and launch it
when virtual-mode is not defined. Qemu+gdb confirms the loaded kernel makes
it to the halt after panic, at least. I'll have to see yet what's wrong with
earlyprintk.
Signed-off-by: Torsten Duwe <duwe(a)lst.de>
1
0
Author: wmb
Date: 2007-09-29 22:03:38 +0200 (Sat, 29 Sep 2007)
New Revision: 654
Modified:
cpu/x86/pc/olpc/crypto.bth
Log:
OLPC build scripts - Corrected the name of bios_hash.
Modified: cpu/x86/pc/olpc/crypto.bth
===================================================================
--- cpu/x86/pc/olpc/crypto.bth 2007-09-29 19:40:22 UTC (rev 653)
+++ cpu/x86/pc/olpc/crypto.bth 2007-09-29 20:03:38 UTC (rev 654)
@@ -6,7 +6,7 @@
fload ${BP}/cpu/x86/pc/olpc/versions.fth
" wget http://dev.laptop.org/pub/firmware/crypto/bios_verify-${CRYPTO_VERSION}.img -O verify.img" expand$ $sh
-" wget http://dev.laptop.org/pub/firmware/crypto/bios_hasher-${CRYPTO_VERSION}.img -O hasher.img" expand$ $sh
+" wget http://dev.laptop.org/pub/firmware/crypto/bios_hash-${CRYPTO_VERSION}.img -O hasher.img" expand$ $sh
" wget http://dev.laptop.org/pub/firmware/crypto/testkeys/os.public -O os.public" expand$ $sh
" wget http://dev.laptop.org/pub/firmware/crypto/testkeys/fw.public -O fw.public" expand$ $sh
" wget http://dev.laptop.org/pub/firmware/crypto/testkeys/lease.public -O lease.public" expand$ $sh
1
0
Author: wmb
Date: 2007-09-29 21:40:22 +0200 (Sat, 29 Sep 2007)
New Revision: 653
Added:
cpu/x86/pc/olpc/devsmall.fth
cpu/x86/pc/olpc/fwsmall.bth
cpu/x86/pc/olpc/smallconfig.fth
cpu/x86/small.bth
Log:
Check in experimental small-Forth build scripts to avoid losing them.
Added: cpu/x86/pc/olpc/devsmall.fth
===================================================================
--- cpu/x86/pc/olpc/devsmall.fth (rev 0)
+++ cpu/x86/pc/olpc/devsmall.fth 2007-09-29 19:40:22 UTC (rev 653)
@@ -0,0 +1,223 @@
+\ See license at end of file
+purpose: Load device drivers according to configuration definitions
+
+: gx? ( -- flag ) h# 4c000017 msr@ drop 4 rshift 2 = ;
+: lx? ( -- flag ) h# 4c000017 msr@ drop 4 rshift 3 = ;
+
+fload ${BP}/cpu/x86/pc/isaio.fth
+
+fload ${BP}/cpu/x86/pc/olpc/vsapci.fth \ PCI configuration access with some hacks
+
+0 0 " " " /" begin-package
+ fload ${BP}/cpu/x86/pc/mappci.fth \ Map PCI to root
+ fload ${BP}/dev/pcibus.fth \ Generic PCI bus package
+ fload ${BP}/cpu/x86/pc/olpc/pcinode.fth \ System-specific words for PCI
+end-package
+stand-init: PCI host bridge
+ " /pci" " init" execute-device-method drop
+;
+
+fload ${BP}/dev/pciprobe.fth \ Generic PCI probing
+
+\ Use the CPU chip's Time Stamp Counter for timing; it does just what we want
+fload ${BP}/cpu/x86/tsc.fth
+
+stand-init:
+ d# 1000 rounded-/ dup to ms-factor ( cpu-clock-khz )
+ d# 1000 rounded-/ to us-factor ( )
+;
+
+[ifdef] use-root-isa
+0 0 " " " /" begin-package
+ fload ${BP}/cpu/x86/pc/isabus.fth \ ISA Bus Bridge under root node
+end-package
+[then]
+
+[ifdef] use-pci-isa
+
+[ifdef] addresses-assigned
+[ifdef] use-pci-isa
+\ This must precede isamisc.fth in the load file, to execute it first
+fload ${BP}/cpu/x86/pc/moveisa.fth
+[then]
+[then]
+
+0 0 " 0" " /pci" begin-package
+ fload ${BP}/dev/pci/isa.fth \ ISA bus bridge under PCI node
+ fload ${BP}/dev/pci/isamisc.fth
+end-package
+
+[then]
+
+1 [if]
+dev /interrupt-controller
+h# 20 to vector-base0
+h# 28 to vector-base1
+device-end
+
+warning @ warning off
+: probe-pci ( -- )
+ probe-pci
+ " /pci" " make-interrupt-map" execute-device-method drop
+;
+warning !
+
+0 0 dropin-base <# u#s u#> " /" begin-package
+ " flash" device-name
+
+ h# 10.0000
+ dup value /device
+ constant /device-phys
+ my-address my-space /device-phys reg
+ fload ${BP}/cpu/x86/pc/flashpkg.fth
+
+ : init ( comp$ /device -- )
+ to /device 2>r
+ 0 0 encode-bytes
+ 2r> encode-string encode+
+ " rom" encode-string encode+
+ " compatible" property
+[ifdef] enable-flash-select
+ /device /device-phys <> if enable-flash-select then
+[then]
+ ;
+
+end-package
+" rom" dropin-base <# u#s " /flash@" hold$ u#> $devalias
+
+: foo-save-state here 5 + ; ' foo-save-state to save-state
+
+fload ${BP}/cpu/x86/forthint.fth \ Low-level interrupt handling code
+fload ${BP}/dev/isa/irq.fth \ ISA interrupt dispatcher
+fload ${BP}/cpu/x86/pc/isatick.fth \ Use ISA timer as the alarm tick timer
+
+[ifdef] resident-packages
+support-package: 16550
+fload ${BP}/dev/16550pkg/16550.fth \ Serial port support package
+end-support-package
+[then]
+
+fload ${BP}/dev/pci/isaall.fth
+devalias com1 /isa/serial@i3f8:115200
+devalias sd /sd/disk
+
+
+dev /8042
+ patch false ctlr-selftest open
+device-end
+
+0 [if]
+0 0 " i70" " /isa" begin-package \ Real-time clock node
+ fload ${BP}/dev/ds1385r.fth
+ 8 encode-int 0 encode-int encode+ " interrupts" property
+ 2 encode-int " device#" property
+end-package
+[then]
+
+fload ${BP}/cpu/x86/pc/cpunode.fth
+
+fload ${BP}/cpu/x86/pc/olpc/cmos.fth \ CMOS RAM indices are 1f..ff , above RTC
+
+[if] 0
+[ifdef] use-null-nvram
+fload ${BP}/cpu/x86/pc/nullnv.fth
+stand-init: Null-NVRAM
+ " /null-nvram" open-dev to nvram-node
+ ['] init-config-vars catch drop
+;
+[then]
+[then]
+
+fload ${BP}/cpu/x86/inoutstr.fth \ Multiple I/O port read/write
+fload ${BP}/dev/isa/diaguart.fth \ ISA COM port driver
+\ : inituarts ascii G uemit ascii o uemit ; \ They are already on
+
+h# 3f8 is uart-base
+fload ${BP}/forth/lib/sysuart.fth \ Use UART for key and emit
+
+[ifndef] save-flash
+: save-flash ;
+: restore-flash ;
+[then]
+
+\needs md5init fload ${BP}/ofw/ppp/md5.fth \ MD5 hash
+
+fload ${BP}/dev/olpc/kb3700/ecspi.fth \ EC chip SPI FLASH access
+
+warning @ warning off
+: stand-init stand-init h# fff0.0000 to flash-base ;
+warning !
+
+fload ${BP}/dev/olpc/kb3700/ecserial.fth \ Serial access to EC chip
+
+fload ${BP}/dev/olpc/kb3700/ecio.fth \ I/O space access to EC chip
+
+fload ${BP}/cpu/x86/pc/olpc/boardrev.fth \ Board revision decoding
+
+fload ${BP}/cpu/x86/pc/olpc/mfgdata.fth \ Manufacturing data
+
+fload ${BP}/dev/olpc/spiflash/spiflash.fth \ SPI FLASH programming
+fload ${BP}/dev/olpc/spiflash/spiui.fth \ User interface for SPI FLASH programming
+fload ${BP}/dev/olpc/spiflash/recover.fth \ XO-to-XO SPI FLASH recovery
+: ofw-fw-filename$ " disk:\boot\olpc.rom" ;
+' ofw-fw-filename$ to fw-filename$
+
+: +i encode-int encode+ ; : 0+i 0 +i ;
+
+fload ${BP}/cpu/x86/fb16-ops.fth
+fload ${BP}/ofw/termemu/fb16.fth
+0 0 " 1,1" " /pci" begin-package
+ fload ${BP}/dev/olpc/dcon/dconsmb.fth \ SMB access to DCON chip
+ fload ${BP}/dev/olpc/dcon/dcon.fth \ DCON control
+ fload ${BP}/dev/geode/display/loadpkg.fth \ Geode display
+
+ 0 0 encode-bytes
+ h# 8200.0910 +i 0+i h# fd00.0000 +i 0+i h# 0080.0000 +i \ Frame buffer
+ h# 8200.0914 +i 0+i h# fe00.0000 +i 0+i h# 0000.4000 +i \ GP
+ h# 8200.0918 +i 0+i h# fe00.4000 +i 0+i h# 0000.4000 +i \ DC
+ h# 8200.091c +i 0+i h# fe00.8000 +i 0+i h# 0000.4000 +i \ VP
+ h# 8200.0920 +i 0+i h# fe00.c000 +i 0+i h# 0000.4000 +i \ VIP (LX only)
+ " assigned-addresses" property
+
+end-package
+devalias screen /display
+
+0 0 " c,1" " /pci" begin-package
+ fload ${BP}/dev/mmc/sdhci/sdhci.fth \ SD host controller
+.( Gots to do init in sdhci.fth) cr
+ new-device
+ fload ${BP}/dev/mmc/sdhci/sdmmc.fth
+ finish-device
+end-package
+
+
+\ fload ${BP}/dev/geode/acpi.fth \ Power management
+
+[ifdef] rom-loaded
+fload ${BP}/cpu/x86/pc/olpc/gpioinit.fth
+fload ${BP}/cpu/x86/pc/olpc/chipinit.fth
+[then]
+
+\ LICENSE_BEGIN
+\ Copyright (c) 2006 FirmWorks
+\
+\ Permission is hereby granted, free of charge, to any person obtaining
+\ a copy of this software and associated documentation files (the
+\ "Software"), to deal in the Software without restriction, including
+\ without limitation the rights to use, copy, modify, merge, publish,
+\ distribute, sublicense, and/or sell copies of the Software, and to
+\ permit persons to whom the Software is furnished to do so, subject to
+\ the following conditions:
+\
+\ The above copyright notice and this permission notice shall be
+\ included in all copies or substantial portions of the Software.
+\
+\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+\
+\ LICENSE_END
Added: cpu/x86/pc/olpc/fwsmall.bth
===================================================================
--- cpu/x86/pc/olpc/fwsmall.bth (rev 0)
+++ cpu/x86/pc/olpc/fwsmall.bth 2007-09-29 19:40:22 UTC (rev 653)
@@ -0,0 +1,324 @@
+purpose: Build Open Firmware for OLPC
+\ See license at end of file
+
+dictionary: ${BP}/cpu/x86/build/kernel.dic
+command: &x86forth &dictionary &this
+in: builton.fth
+build-now
+
+
+fload ${BP}/cpu/x86/small.bth
+
+hex
+' $report-name is include-hook
+
+fload ${BP}/cpu/x86/pc/olpc/smallconfig.fth
+
+: headerless ; : headers ; : headerless0 ;
+
+' (quit) to quit
+
+create debug-startup
+: \Tags [compile] \ ; immediate
+: \NotTags [compile] \ ; immediate
+
+fload ${BP}/cpu/x86/pc/segments.fth \ Segment selectors (address spaces)
+
+: RAMbase ( -- adr ) fw-virt-base ;
+: RAMtop ( -- adr ) RAMbase /fw-ram + ;
+
+h# 00.0000 value dp-loc \ Set in patchboot
+: stacktop ( -- adr ) RAMtop ;
+: dict-limit ( -- adr ) RAMtop h# 06.0000 - ;
+
+\ XXX What we should do is pass in the top address in SP, and have
+\ boot.fth allocate the user area by subtracting user-size. But
+\ we need some way of finding it again for exception re-entry.
+\ prom-main-task is used in arch/pc/boot.fth . The constant
+\ value is wired into the assembly code
+stacktop user-size - constant prom-main-task \ user area for main task
+
+0 value load-limit \ Top address of area at load-base
+' 2drop to sync-cache
+
+def-load-base to load-base
+
+fload ${BP}/cpu/x86/msr.fth \ Access to machine specific registers
+
+h# 1000 to pagesize
+d# 12 to pageshift
+
+dev /
+1 encode-int " #address-cells" property
+device-end
+
+\ Memory management services
+fload ${BP}/ofw/core/memlist.fth \ Resource list common routines
+fload ${BP}/ofw/core/showlist.fth \ Linked list display tool
+fload ${BP}/ofw/core/allocph1.fth \ S Physical memory allocator
+fload ${BP}/ofw/core/availpm.fth \ Available memory list
+
+fload ${BP}/cpu/x86/pc/rootnode.fth \ Platform-specific root node changes
+
+fload ${BP}/cpu/x86/pc/olpc/gpio.fth \ Rudimentary GPIO driver
+fload ${BP}/cpu/x86/pc/olpc/probemem.fth \ Memory probing
+
+[ifdef] virtual-mode
+fload ${BP}/cpu/x86/loadvmem.fth \ /mmu node
+
+stand-init: MMU
+ " /mmu" open-dev mmu-node !
+;
+fload ${BP}/cpu/x86/pc/initdict.fth \ Dynamic dictionary allocation
+[then]
+
+fload ${BP}/cpu/x86/crc32.fth \ Assembly language Zip CRC calculation
+fload ${BP}/forth/lib/crc32.fth \ High-level portion of CRC calculation
+
+[ifdef] resident-packages
+
+[ifdef] linux-support
+support-package: ext2-file-system
+ fload ${BP}/ofw/fs/ext2fs/ext2fs.fth \ Linux file system
+end-support-package
+[then]
+
+[ifdef] jffs2-support
+support-package: jffs2-file-system
+ fload ${BP}/ofw/fs/jffs2/jffs2.fth \ Journaling flash file system 2
+end-support-package
+[then]
+
+support-package: zip-file-system
+ fload ${BP}/ofw/fs/zipfs.fth \ Zip file system
+end-support-package
+[then]
+
+\ Load file format handlers
+
+: call32 ;
+
+: release-load-area ( boundary-adr -- ) drop ;
+
+headerless
+[ifdef] virtual-mode
+: (initial-heap) ( -- adr len ) sp0 @ ps-size - dict-limit tuck - ;
+[else]
+: (initial-heap) ( -- adr len ) RAMtop heap-size ;
+[then]
+' (initial-heap) is initial-heap
+headers
+
+[ifdef] virtual-mode
+fload ${BP}/cpu/x86/pc/mmusetup.fth \ Initial values for MMU lists
+dev /mmu
+: claim-rom ( -- )
+ (initial-claim)
+ rom-pa h# ffff.0000 over - claim-virtual drop \ ROM 1-1 map
+;
+' claim-rom to initial-claim
+dend
+[then]
+
+fload ${BP}/cpu/x86/pc/olpc/devsmall.fth
+
+\ fload ${BP}/cpu/x86/pc/olpc/countdwn.fth \ Startup countdown
+
+fload ${BP}/cpu/x86/pc/boot.fth
+
+[ifdef] use-usb
+: usb-port-power-map ( -- n )
+[ifdef] lx-devel
+ h# 3ea exit \ USB4:PWR2 USB3:PWR1 USB2:PWR1 USB1:PWR1
+[then]
+ board-revision h# b10 h# b2f between if \ B1 and B2
+ h# 3ab \ USB4:PWR1 USB3:PWR1 USB2:PWR1 USB1:PWR2
+ else
+ \ A-test doesn't switch USB power, so the value doesn't matter.
+ \ preB3 and presumably later use this value
+ h# 3aa \ USB4:PWR1 USB3:PWR1 USB2:PWR1 USB1:PWR1
+ then
+;
+fload ${BP}/cpu/x86/pc/olpc/usb.fth
+[then]
+
+\ false to stand-init-debug?
+true to stand-init-debug?
+
+hex
+: i-key-wait ( ms -- pressed? )
+ cr ." Type 'i' to interrupt stand-init sequence" cr
+ 0 do
+ key? if
+ key upc ascii I = if true unloop exit then
+ then
+ 1 ms
+ loop
+ false
+;
+
+\ stand-init-debug? [if]
+warning @ warning off
+: init
+\ initial-heap add-memory
+ init
+
+ standalone? if
+ disable-interrupts
+ d# 300
+ i-key-wait if
+ ." Interacting" cr hex interact
+ then
+
+ setup
+ then
+;
+\ warning !
+[then]
+
+' noop to .firmware
+
+: probe-all ( -- )
+ probe-pci
+[ifdef] use-usb
+ probe-usb
+[then]
+;
+
+[ifdef] linux-support
+fload ${BP}/cpu/x86/pc/olpc/linux.fth
+[then]
+
+fload ${BP}/dev/null.fth
+
+[ifdef] olpc
+\ fload ${BP}/cpu/x86/pc/olpc/crypto.fth \ Cryptographic image validation
+\ fload ${BP}/cpu/x86/pc/olpc/lzip.fth \ Access zip images from memory
+\ fload ${BP}/cpu/x86/pc/olpc/security.fth
+[then]
+
+\ Eliminate 4 second delay in install console for the case where
+\ there is no keyboard. The delay is unnecessary because the screen
+\ does not go blank when the device is closed.
+patch drop ms install-console
+
+: dcon-reset-all ( -- )
+ " screen" " dcon-off" ['] execute-device-method catch if
+ 2drop 2drop
+ then
+
+ 1. h# 5140.0017 wrmsr \ DIVIL_SOFT_RESET MSR, 5536 page 367
+ begin again
+;
+' dcon-reset-all to reset-all
+
+alias reboot bye
+
+alias crcgen drop ( crc byte -- crc' )
+fload ${BP}/cpu/x86/pc/saveabs.fth
+
+\ fload ${BP}/cpu/x86/pc/report.fth
+fload ${BP}/ofw/core/dualconsole.fth
+
+0 value game-key-mask
+
+: read-game-keys ( -- )
+ board-revision h# b20 < if
+ h# 100 to game-key-mask
+ exit
+ then
+
+ game-key@ dup to game-key-mask if
+ ." Release the game key to continue" cr
+ begin d# 100 ms game-key@ 0= until
+ then
+;
+
+: interpreter-init ( -- )
+ hex
+ warning on
+ only forth also definitions
+
+ install-alarm
+
+ #line off
+
+\ .built cr
+;
+
+: console-start ( -- )
+[ifdef] rom-loaded
+ video-map cr
+[then]
+ " screen" open-dev ?dup if
+ set-stdout
+\ logo-banner drop
+\ close-dev
+\ 0 stdout !
+ then
+
+ install-dual-console
+
+\ ." nvramrc" cr
+\ use-nvramrc? if nvramrc safe-evaluate then
+;
+: optional-startup ( -- )
+[ifdef] use-usb
+ probe-usb
+ ?usb-keyboard
+[then]
+;
+
+: open-keyboard ( -- )
+ " keyboard" open-dev ?dup if set-stdin then
+;
+
+
+: startup ( -- )
+ standalone? 0= if exit then
+
+ console-start
+ read-game-keys
+ banner
+ probe-pci
+ open-keyboard
+ optional-startup
+ interpreter-init
+ \ do-update
+
+ quit
+;
+
+.( --- Saving smallfw.dic ...)
+" smallfw.dic" $save-forth cr
+
+\ patch foo decimal cold
+
+[ifndef] notdef
+.( --- Saving fw.img ...)
+" smallfw.img" RAMbase save-abs-rom cr
+[then]
+
+\ LICENSE_BEGIN
+\ Copyright (c) 2006 FirmWorks
+\
+\ Permission is hereby granted, free of charge, to any person obtaining
+\ a copy of this software and associated documentation files (the
+\ "Software"), to deal in the Software without restriction, including
+\ without limitation the rights to use, copy, modify, merge, publish,
+\ distribute, sublicense, and/or sell copies of the Software, and to
+\ permit persons to whom the Software is furnished to do so, subject to
+\ the following conditions:
+\
+\ The above copyright notice and this permission notice shall be
+\ included in all copies or substantial portions of the Software.
+\
+\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+\
+\ LICENSE_END
Added: cpu/x86/pc/olpc/smallconfig.fth
===================================================================
--- cpu/x86/pc/olpc/smallconfig.fth (rev 0)
+++ cpu/x86/pc/olpc/smallconfig.fth 2007-09-29 19:40:22 UTC (rev 653)
@@ -0,0 +1,77 @@
+\ See license at end of file
+purpose: Establish configuration definitions
+
+create olpc \ OLPC-specific build
+
+\ --- The environment that "boots" us ---
+\ - Image Format - Example Media - previous stage bootloader
+
+\ - OBMD format - ROM - direct boot from ROM
+create rom-loaded
+
+\ - ELF format (no pheader) - ROM - LinuxBIOS direct
+\ create linuxbios-loaded
+
+\ - Linux kernel format - USB Key w/ FAT FS - LinuxBIOS w/ stripped Linux payload
+\ create bzimage-loaded
+
+\ - ELF format w/ Multiboot signature - various - GRUB
+\ create grub-loaded
+
+\ - (Syslinux) COM32 format - USB Key w/ FAT FS - Syslinux
+\ create syslinux-loaded
+
+
+\ create virtual-mode
+create addresses-assigned \ Define if base addresses are already assigned
+\ create serial-console \ Define to default to serial port for console
+create pc
+\ create linux-support
+\ create jffs2-support
+\ create use-elf
+
+\ create use-timestamp-counter \ Use CPU's timestamp counter for timing ...
+ \ ... this is worthwhile if your CPU has one.
+
+create resident-packages
+\ create use-watch-all
+\ create use-root-isa
+create no-floppy-node
+create no-com2-node
+create no-lpt-node
+create use-pci-isa
+create basic-isa
+create isa-dma-only
+
+create use-null-nvram
+
+\ Uncomment this to compile for the LX development board
+\ It's not possible to use one ROM image for both OLPC and
+\ the LX board, because of the ROM size difference.
+\ create lx-devel \ Support for the LX development board
+
+fload ${BP}/cpu/x86/pc/olpc/addrs.fth
+
+\ LICENSE_BEGIN
+\ Copyright (c) 2006 FirmWorks
+\
+\ Permission is hereby granted, free of charge, to any person obtaining
+\ a copy of this software and associated documentation files (the
+\ "Software"), to deal in the Software without restriction, including
+\ without limitation the rights to use, copy, modify, merge, publish,
+\ distribute, sublicense, and/or sell copies of the Software, and to
+\ permit persons to whom the Software is furnished to do so, subject to
+\ the following conditions:
+\
+\ The above copyright notice and this permission notice shall be
+\ included in all copies or substantial portions of the Software.
+\
+\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+\
+\ LICENSE_END
Added: cpu/x86/small.bth
===================================================================
--- cpu/x86/small.bth (rev 0)
+++ cpu/x86/small.bth 2007-09-29 19:40:22 UTC (rev 653)
@@ -0,0 +1,235 @@
+\ See license at end of file
+purpose: Load file for Forth toolkit, without firmware
+
+dictionary: ${BP}/cpu/x86/build/kernel.dic
+command: &x86forth &dictionary &this
+build-now
+
+ ' noop is include-hook
+\ ' $report-name is include-hook
+\ : rn (cr 2dup type 15 spaces ; ' rn is include-hook
+
+create no-tools
+create no-heads
+create resident-packages
+
+fload ${BP}/forth/lib/fwsetup.fth
+
+: dot hex transtart . transize . there . ouser . hedge . limit . cr decimal ;
+.( after: ) dot
+
+transient
+
+\ Variables controlling inclusion of optional packages.
+
+[ifdef] no-heads
+false
+[else]
+true
+[then]
+value assembler? \ 5280 bytes
+true value forth-debug? \ 1064 bytes
+
+resident
+
+[ifndef] partial-no-heads transient [then]
+fload ${BP}/forth/lib/filetool.fth \ needed for dispose, savefort.fth
+
+\NotTags fload ${BP}/forth/lib/dispose.fth
+[ifndef] partial-no-heads resident [then]
+
+[ifndef] partial-no-heads transient [then]
+\NotTags fload ${BP}/forth/lib/headless.fth
+\NotTags fload ${BP}/forth/lib/showspac.fth
+[ifndef] partial-no-heads resident [then]
+
+fload ${BP}/forth/lib/romable.fth
+
+fload ${BP}/forth/lib/hidden.fth
+
+fload ${BP}/forth/kernel/hashcach.fth
+
+fload ${BP}/forth/lib/th.fth
+\ fload ${BP}/forth/lib/ansiterm.fth
+
+fload ${BP}/forth/kernel/splits.fth
+fload ${BP}/forth/kernel/endian.fth
+
+fload ${BP}/forth/lib/strings.fth
+fload ${BP}/forth/lib/stringop.fth
+
+fload ${BP}/forth/lib/fastspac.fth
+
+fload ${BP}/forth/lib/patch.fth
+fload ${BP}/forth/lib/cirstack.fth \ Circular stack
+\ fload ${BP}/forth/lib/pseudors.fth \ Interpretable >r and r>
+
+\ fload ${BP}/forth/lib/headtool.fth
+
+fload ${BP}/forth/lib/needs.fth
+
+\ fload ${BP}/forth/lib/suspend.fth
+alias exit? false
+
+fload ${BP}/forth/lib/util.fth
+\ fload ${BP}/forth/lib/format.fth
+: to-column ( column# -- ) drop space ;
+
+fload ${BP}/forth/lib/stringar.fth
+
+fload ${BP}/forth/lib/parses1.fth \ String parsing
+
+\ fload ${BP}/forth/lib/dump.fth
+\ fload ${BP}/forth/lib/words.fth
+\ fload ${BP}/forth/lib/decomp.fth
+
+\ Uses over-vocabulary from words.fth
+[ifndef] partial-no-heads transient [then]
+\ \NotTags fload ${BP}/forth/lib/dumphead.fth
+[ifndef] partial-no-heads resident [then]
+
+\ fload ${BP}/forth/lib/seechain.fth
+
+\ fload ${BP}/forth/lib/loadedit.fth \ Command line editor module
+
+\ fload ${BP}/forth/lib/caller.fth
+
+\ fload ${BP}/forth/lib/callfind.fth
+fload ${BP}/forth/lib/substrin.fth
+\ fload ${BP}/forth/lib/sift.fth
+
+fload ${BP}/forth/lib/array.fth
+
+fload ${BP}/forth/lib/linklist.fth \ Linked list routines
+
+fload ${BP}/forth/lib/lex.fth
+
+\ fload ${BP}/forth/lib/autold.fth \ Autoload mechanism
+
+[ifndef] partial-no-heads transient [then]
+fload ${BP}/forth/lib/initsave.fth \ Common code for save-forth et al
+fload ${BP}/forth/lib/reminder.fth \ Reminders
+[ifndef] partial-no-heads resident [then]
+
+assembler? [if]
+fload ${BP}/cpu/x86/assem.fth
+fload ${BP}/cpu/x86/code.fth
+fload ${BP}/forth/lib/loclabel.fth
+[else]
+transient fload ${BP}/cpu/x86/assem.fth resident
+fload ${BP}/cpu/x86/code.fth
+transient fload ${BP}/forth/lib/loclabel.fth resident
+[then]
+fload ${BP}/cpu/x86/asmspec.fth \ Special registers
+
+\ fload ${BP}/cpu/x86/decompm.fth
+
+
+: be-l, ( l -- ) here set-swap-bit here 4 allot be-l! ;
+
+[ifndef] partial-no-heads transient [then]
+fload ${BP}/cpu/x86/saveexp.fth
+fload ${BP}/cpu/x86/savefort.fth
+[ifndef] partial-no-heads resident [then]
+alias $save-forth $save-forth
+
+\ [ifdef] resident-packages
+\ fload ${BP}/cpu/x86/disassem.fth
+\ [else]
+\ autoload: disassem.fth
+\ defines: dis
+\ defines: +dis
+\ defines: pc!dis1
+\ [then]
+
+\ fload ${BP}/forth/lib/instdis.fth
+
+fload ${BP}/cpu/x86/objsup.fth
+fload ${BP}/forth/lib/objects.fth
+
+\ fload ${BP}/cpu/x86/cpustate.fth
+\ fload ${BP}/cpu/x86/register.fth
+
+\ fload ${BP}/forth/lib/savedstk.fth
+\ fload ${BP}/forth/lib/rstrace.fth
+\ fload ${BP}/cpu/x86/ftrace.fth
+\ fload ${BP}/cpu/x86/ctrace.fth
+\ fload ${BP}/cpu/x86/showcras.fth
+
+\ forth-debug? [if]
+\ fload ${BP}/cpu/x86/debugm.fth \ Forth debugger support
+\ fload ${BP}/forth/lib/debug.fth \ Forth debugger
+\ [then]
+
+\ start-module \ Breakpointing
+\ fload ${BP}/cpu/x86/cpubpsup.fth \ Breakpoint support
+\ fload ${BP}/forth/lib/breakpt.fth
+\ fload ${BP}/cpu/x86/Linux/catchexc.fth \ OS signal handling
+\ end-module
+
+: edit-file ( adr len maxlen -- len' ) drop nip ;
+: edit-line ( adr len maxlen -- len' ) drop nip ;
+defer light ' noop to light
+alias cancel noop
+: vsift? ( adr len voc-xt -- adr len exit? ) drop true ;
+alias .in noop
+defer .voc ' noop is .voc
+alias save-state-common noop
+defer save-state
+alias init-exceptions noop
+defer deny-history?
+alias not-dark noop
+alias (debug drop
+alias cpeek c@
+alias wpeek w@
+alias lpeek l@
+alias cpoke c!
+alias wpoke w!
+alias lpoke l!
+0 value load-base
+variable file-size
+: loaded load-base file-size @ ;
+: !load-size file-size ! ;
+defer ?inflate-loaded ' noop is ?inflate-loaded
+alias external noop
+
+\needs no-heads create no-heads
+fload ${BP}/cpu/x86/basefw.bth
+
+: reg ( phys.. size ) encode-reg " reg" property ;
+: ($callback) ( nargs name$ -- error? ) 2drop 0 ?do drop loop true ;
+: memory-test-suite ( adr len -- error? ) 2drop false ;
+: byte-load ( adr stride -- ) 2drop ;
+: model " model" string-property ;
+
+[ifndef] no-heads
+resident dispose 0 0 set-transize \ true is suppress-transient
+\ .( zeroed: ) dot
+
+' noop is include-hook ' noop is include-exit-hook
+.( --- Saving small.dic --- ) " small.dic" $save-forth cr
+[then]
+
+\ LICENSE_BEGIN
+\ Copyright (c) 2006 FirmWorks
+\
+\ Permission is hereby granted, free of charge, to any person obtaining
+\ a copy of this software and associated documentation files (the
+\ "Software"), to deal in the Software without restriction, including
+\ without limitation the rights to use, copy, modify, merge, publish,
+\ distribute, sublicense, and/or sell copies of the Software, and to
+\ permit persons to whom the Software is furnished to do so, subject to
+\ the following conditions:
+\
+\ The above copyright notice and this permission notice shall be
+\ included in all copies or substantial portions of the Software.
+\
+\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+\
+\ LICENSE_END
1
0
Author: wmb
Date: 2007-09-29 21:36:29 +0200 (Sat, 29 Sep 2007)
New Revision: 652
Removed:
cpu/x86/Linux/graphics/
Log:
Deleted mistakenly-added directory.
1
0
Author: wmb
Date: 2007-09-29 21:34:52 +0200 (Sat, 29 Sep 2007)
New Revision: 651
Removed:
cpu/x86/Linux/graphics/graphdev.fth
cpu/x86/Linux/graphics/run
Log:
Deleted redundant files
Deleted: cpu/x86/Linux/graphics/graphdev.fth
===================================================================
--- cpu/x86/Linux/graphics/graphdev.fth 2007-09-29 19:33:09 UTC (rev 650)
+++ cpu/x86/Linux/graphics/graphdev.fth 2007-09-29 19:34:52 UTC (rev 651)
@@ -1,42 +0,0 @@
-purpose: Simulation of OFW graphics using X
-
-dev / new-device
- " xgraphics" device-name
- : open ( -- okay? ) d# 1200 d# 900 d# 392 syscall 2drop retval 0= ;
- : close ( -- ) d# 396 syscall ;
-
- : fill-rectangle ( color565 x y w h -- ) d# 404 syscall 4drop drop ;
-finish-device
-
-: get-color ( r g b -- color )
- d# 400 syscall 3drop retval
-;
-
-: open-screen
- " /xgraphics" open-dev to screen-ih
-;
-
-0 value xred
-0 value xgreen
-0 value xblue
-0 value xmagenta
-0 value xblack
-0 value xmagenta
-
-: demo ( -- )
- open-screen
-
- h# ff h# 00 h# 00 get-color to xred
- h# 00 h# ff h# 00 get-color to xgreen
- h# 00 h# 00 h# ff get-color to xblue
- h# ff h# 00 h# ff get-color to xmagenta
- 0 0 0 get-color to xblack
- h# ff h# ff h# ff get-color to xmagenta
-
- d# 500 0 do i xred show-state loop
- d# 1000 d# 500 do i xblue show-state loop
- d# 1500 d# 1000 do i xgreen show-state loop
- d# 2000 d# 1500 do i xmagenta show-state loop
-
- xblack d# 400 d# 300 d# 50 d# 60 " fill-rectangle" $call-screen
-;
Deleted: cpu/x86/Linux/graphics/run
===================================================================
--- cpu/x86/Linux/graphics/run 2007-09-29 19:33:09 UTC (rev 650)
+++ cpu/x86/Linux/graphics/run 2007-09-29 19:34:52 UTC (rev 651)
@@ -1,2 +0,0 @@
-#!/bin/sh
-./forth fw.dic graphdev.fth -
1
0
Author: wmb
Date: 2007-09-29 21:33:09 +0200 (Sat, 29 Sep 2007)
New Revision: 650
Added:
cpu/x86/Linux/graphics/
cpu/x86/Linux/graphics/graphdev.fth
cpu/x86/Linux/graphics/run
Log:
Added X graphics support for use under Linux.
Added: cpu/x86/Linux/graphics/graphdev.fth
===================================================================
--- cpu/x86/Linux/graphics/graphdev.fth (rev 0)
+++ cpu/x86/Linux/graphics/graphdev.fth 2007-09-29 19:33:09 UTC (rev 650)
@@ -0,0 +1,42 @@
+purpose: Simulation of OFW graphics using X
+
+dev / new-device
+ " xgraphics" device-name
+ : open ( -- okay? ) d# 1200 d# 900 d# 392 syscall 2drop retval 0= ;
+ : close ( -- ) d# 396 syscall ;
+
+ : fill-rectangle ( color565 x y w h -- ) d# 404 syscall 4drop drop ;
+finish-device
+
+: get-color ( r g b -- color )
+ d# 400 syscall 3drop retval
+;
+
+: open-screen
+ " /xgraphics" open-dev to screen-ih
+;
+
+0 value xred
+0 value xgreen
+0 value xblue
+0 value xmagenta
+0 value xblack
+0 value xmagenta
+
+: demo ( -- )
+ open-screen
+
+ h# ff h# 00 h# 00 get-color to xred
+ h# 00 h# ff h# 00 get-color to xgreen
+ h# 00 h# 00 h# ff get-color to xblue
+ h# ff h# 00 h# ff get-color to xmagenta
+ 0 0 0 get-color to xblack
+ h# ff h# ff h# ff get-color to xmagenta
+
+ d# 500 0 do i xred show-state loop
+ d# 1000 d# 500 do i xblue show-state loop
+ d# 1500 d# 1000 do i xgreen show-state loop
+ d# 2000 d# 1500 do i xmagenta show-state loop
+
+ xblack d# 400 d# 300 d# 50 d# 60 " fill-rectangle" $call-screen
+;
Added: cpu/x86/Linux/graphics/run
===================================================================
--- cpu/x86/Linux/graphics/run (rev 0)
+++ cpu/x86/Linux/graphics/run 2007-09-29 19:33:09 UTC (rev 650)
@@ -0,0 +1,2 @@
+#!/bin/sh
+./forth fw.dic graphdev.fth -
Property changes on: cpu/x86/Linux/graphics/run
___________________________________________________________________
Name: svn:executable
+ *
1
0
Author: wmb
Date: 2007-09-29 21:26:47 +0200 (Sat, 29 Sep 2007)
New Revision: 649
Added:
cpu/x86/pc/olpc/gamekeys.fth
Log:
Moved game-key support from fw.bth into separate file.
Added: cpu/x86/pc/olpc/gamekeys.fth
===================================================================
--- cpu/x86/pc/olpc/gamekeys.fth (rev 0)
+++ cpu/x86/pc/olpc/gamekeys.fth 2007-09-29 19:26:47 UTC (rev 649)
@@ -0,0 +1,27 @@
+purpose: Access to game keys (buttons on front panel)
+
+h# 1 constant button-square
+h# 2 constant button-check
+h# 4 constant rocker-up
+h# 8 constant rocker-down
+h# 10 constant rocker-left
+h# 20 constant rocker-right
+h# 40 constant button-rotate
+h# 80 constant button-o
+h# 100 constant button-x
+
+0 value game-key-mask
+
+: read-game-keys ( -- )
+[ifdef] lx-devel false exit [then]
+ board-revision h# b18 < if
+ button-x to game-key-mask \ Force slow boot
+ exit
+ then
+
+ game-key@ dup to game-key-mask if
+ ." Release the game key to continue" cr
+ begin d# 100 ms game-key@ 0= until
+ then
+;
+: game-key? ( mask -- flag ) game-key-mask and 0<> ;
1
0
Author: wmb
Date: 2007-09-29 21:26:04 +0200 (Sat, 29 Sep 2007)
New Revision: 648
Modified:
cpu/x86/pc/olpc/copynand.fth
Log:
copy-nand - support reloading files saved with dump-nand, with OOB data inline.
Modified: cpu/x86/pc/olpc/copynand.fth
===================================================================
--- cpu/x86/pc/olpc/copynand.fth 2007-09-29 19:25:03 UTC (rev 647)
+++ cpu/x86/pc/olpc/copynand.fth 2007-09-29 19:26:04 UTC (rev 648)
@@ -90,7 +90,10 @@
h# 100 buffer: crc-name-buf
: crc-name$ ( -- adr len ) crc-name-buf count ;
+0 value img-has-oob?
+
: ?open-crcs ( -- )
+ img-has-oob? if exit then
image-name$ + 4 - " .img" caps-comp 0= if
image-name$ crc-name-buf place
" crc" crc-name$ + 3 - swap move
@@ -98,6 +101,10 @@
then
#crc-records if
." Check file is " crc-name$ type cr
+
+ #image-eblocks if
+ #image-eblocks #crc-records <> " CRC file length is wrong" ?nand-abort
+ then
then
;
@@ -106,13 +113,26 @@
: open-img ( "devspec" -- )
image-name$ open-dev to fileih
fileih 0= " Can't open NAND image file" ?nand-abort
- " size" fileih $call-method /nand-block um/mod ( residue #eblocks )
- to #image-eblocks ( residue )
- 0<> " Image file size is not a multiple of the NAND erase block size" ?nand-abort
+ " size" fileih $call-method ( d.size )
+ 2dup /nand-block um/mod swap if ( d.size #eblocks )
+ \ Wrong size for the no-oob data format; try the dump-nand format
+ drop ( d.size #eblocks )
+ h# 21100 um/mod swap ( #eblocks residue )
+ 0<> " Image file size is not a multiple of the NAND erase block size" ?nand-abort
+ true to img-has-oob?
+ else ( d.size #eblocks )
+ false to img-has-oob?
+ nip nip ( #eblocks )
+ then ( #eblocks )
+ to #image-eblocks
+
#image-eblocks 0= " Image file is empty" ?nand-abort
+;
- #crc-records if
- #image-eblocks #crc-records <> " CRC file length is wrong" ?nand-abort
+: ?skip-oob ( -- )
+ img-has-oob? if
+ load-base h# 1100 " read" fileih $call-method ( len )
+ h# 1100 <> " Bad read of OOB data in .img file" ?nand-abort ( )
then
;
@@ -181,8 +201,8 @@
: copy-nand ( "devspec" -- )
open-nand
get-img-filename
+ open-img
?open-crcs
- open-img
['] noop to show-progress
@@ -198,6 +218,7 @@
i ?check-crc
load-base " copy-block" $call-nand ( page# error? )
" Error writing to NAND FLASH" ?nand-abort ( page# )
+ ?skip-oob
nand-pages/block / show-written ( )
loop
@@ -233,8 +254,8 @@
hex
open-nand close-nand-ihs \ To set sizes
get-img-filename
+ open-img
?open-crcs
- open-img
#crc-records 0= " No CRC file" ?nand-abort
['] noop to show-progress
1
0
r647 - cpu/x86/pc/olpc cpu/x86/pc/olpc/images dev/geode/display dev/video/common ofw/termemu
by svn@openbios.org Sept. 29, 2007
by svn@openbios.org Sept. 29, 2007
Sept. 29, 2007
Author: wmb
Date: 2007-09-29 21:25:03 +0200 (Sat, 29 Sep 2007)
New Revision: 647
Added:
cpu/x86/pc/olpc/images/check.565
cpu/x86/pc/olpc/images/check.bmp
cpu/x86/pc/olpc/images/darkdot.565
cpu/x86/pc/olpc/images/darkdot.bmp
cpu/x86/pc/olpc/images/develkey.565
cpu/x86/pc/olpc/images/develkey.bmp
cpu/x86/pc/olpc/images/lightdot.565
cpu/x86/pc/olpc/images/lightdot.bmp
cpu/x86/pc/olpc/images/lock.565
cpu/x86/pc/olpc/images/lock.bmp
cpu/x86/pc/olpc/images/minus.565
cpu/x86/pc/olpc/images/minus.bmp
cpu/x86/pc/olpc/images/plus.565
cpu/x86/pc/olpc/images/plus.bmp
cpu/x86/pc/olpc/images/sad.565
cpu/x86/pc/olpc/images/sad.bmp
cpu/x86/pc/olpc/images/topkey.565
cpu/x86/pc/olpc/images/topkey.bmp
cpu/x86/pc/olpc/images/unlock.565
cpu/x86/pc/olpc/images/unlock.bmp
cpu/x86/pc/olpc/images/x.565
cpu/x86/pc/olpc/images/x.bmp
cpu/x86/pc/olpc/images/xogray.565
cpu/x86/pc/olpc/images/xogray.bmp
cpu/x86/pc/olpc/images/yellowdot.565
cpu/x86/pc/olpc/images/yellowdot.bmp
Modified:
cpu/x86/pc/olpc/crypto.bth
cpu/x86/pc/olpc/crypto.fth
cpu/x86/pc/olpc/fw.bth
cpu/x86/pc/olpc/gui.fth
cpu/x86/pc/olpc/images/sd.565
cpu/x86/pc/olpc/images/sd.bmp
cpu/x86/pc/olpc/loaddropins.fth
cpu/x86/pc/olpc/security.fth
dev/geode/display/gxfb.fth
dev/video/common/rectangle16.fth
ofw/termemu/fb16.fth
Log:
New pretty-boot scheme tied in with security (omnibus checkin of many files)
Modified: cpu/x86/pc/olpc/crypto.bth
===================================================================
--- cpu/x86/pc/olpc/crypto.bth 2007-09-29 19:16:30 UTC (rev 646)
+++ cpu/x86/pc/olpc/crypto.bth 2007-09-29 19:25:03 UTC (rev 647)
@@ -6,6 +6,7 @@
fload ${BP}/cpu/x86/pc/olpc/versions.fth
" wget http://dev.laptop.org/pub/firmware/crypto/bios_verify-${CRYPTO_VERSION}.img -O verify.img" expand$ $sh
+" wget http://dev.laptop.org/pub/firmware/crypto/bios_hasher-${CRYPTO_VERSION}.img -O hasher.img" expand$ $sh
" wget http://dev.laptop.org/pub/firmware/crypto/testkeys/os.public -O os.public" expand$ $sh
" wget http://dev.laptop.org/pub/firmware/crypto/testkeys/fw.public -O fw.public" expand$ $sh
" wget http://dev.laptop.org/pub/firmware/crypto/testkeys/lease.public -O lease.public" expand$ $sh
Modified: cpu/x86/pc/olpc/crypto.fth
===================================================================
--- cpu/x86/pc/olpc/crypto.fth 2007-09-29 19:16:30 UTC (rev 646)
+++ cpu/x86/pc/olpc/crypto.fth 2007-09-29 19:25:03 UTC (rev 647)
@@ -5,18 +5,24 @@
h# d0000 constant verify-bss \ The address the code is linked to run at
h# 10000 constant /verify-bss
-0 [if]
-h# c0000 constant hasher-base \ The address the code is linked to run at
+1 [if]
+h# 70000 constant hasher-base \ The address the code is linked to run at
+h# 80000 constant hasher-bss
+h# 18000 constant /hasher-bss
variable hashlen
d# 128 buffer: hashbuf
+: get-hasher ( -- )
+ " hasher" find-drop-in 0= if 4drop true exit then ( prog$ )
+ 2dup hasher-base swap move free-mem ( hashname$ )
+;
+
: hash ( data$ hashname$ -- result$ )
- " hasher" find-drop-in 0= if 4drop true exit then ( data$ hashname$ prog$ )
- 2dup hasher-base swap move free-mem ( data$ hashname$ )
-
d# 128 hashlen !
- 2>r swap hashlen hashbuf 2swap 2r> $cstr ( &reslen resbuf datalen databuf hashname-cstr )
+ $cstr hashbuf hashlen ( databuf datalen hashname-cstr resbuf &reslen )
+ hasher-bss /hasher-bss erase
+
hasher-base dup h# 10 - sp-call abort" Hash failed" drop 4drop ( )
hashbuf hashlen @
;
@@ -25,7 +31,9 @@
0 value crypto-loaded?
: load-crypto ( -- error? )
crypto-loaded? if false exit then
- " verify" find-drop-in 0= if true exit then ( prog$ )
+ " verify" find-drop-in 0= if
+ ." Can't find crypto code" cr true exit
+ then ( prog$ )
2dup verify-base swap move free-mem ( )
true to crypto-loaded?
false
Modified: cpu/x86/pc/olpc/fw.bth
===================================================================
--- cpu/x86/pc/olpc/fw.bth 2007-09-29 19:16:30 UTC (rev 646)
+++ cpu/x86/pc/olpc/fw.bth 2007-09-29 19:25:03 UTC (rev 647)
@@ -272,7 +272,7 @@
." Interacting due to botched resume" cr hex interact
then
i-key-wait if
- " patch false fast-boot? startup" eval
+\ " patch false fast-boot? startup" eval
." Interacting" cr hex interact
then
[ifdef] lx-devel
@@ -335,6 +335,7 @@
\ fload ${BP}/cpu/x86/pc/olpc/carousel.fth \ Carouseled NAND writing
fload ${BP}/cpu/x86/pc/olpc/crypto.fth \ Cryptographic image validation
fload ${BP}/cpu/x86/pc/olpc/lzip.fth \ Access zip images from memory
+fload ${BP}/cpu/x86/pc/olpc/gamekeys.fth
fload ${BP}/cpu/x86/pc/olpc/security.fth
fload ${BP}/cpu/x86/pc/olpc/setwp.fth
fload ${BP}/ofw/gui/ofpong.fth
@@ -438,23 +439,9 @@
\ fload ${BP}/cpu/x86/pc/report.fth
fload ${BP}/ofw/core/dualconsole.fth
-0 value game-key-mask
-
-: read-game-keys ( -- )
-[ifdef] lx-devel false exit [then]
- board-revision h# b18 < if
- h# 100 to game-key-mask
- exit
- then
-
- game-key@ dup to game-key-mask if
- ." Release the game key to continue" cr
- begin d# 100 ms game-key@ 0= until
- then
-;
: fast-boot? ( -- flag )
[ifdef] rom-loaded
- game-key-mask h# 120 and 0=
+ button-x game-key? 0=
[else]
false
[then]
@@ -506,11 +493,6 @@
then
;
-: optional-startup ( -- )
- probe-usb
- ?usb-keyboard
-;
-
: go-hook-freeze
[ ' go-hook behavior compile, ]
0 " set-source" $call-screen
@@ -519,13 +501,13 @@
: unfreeze ( -- ) ['] usb-quiet to go-hook ;
: ?sound ( -- )
- game-key-mask h# 40 and 0= if sound then
+ button-rotate game-key? 0= if sound then
;
: ?freeze ( -- )
- game-key-mask h# 40 and 0= if freeze then
+ button-rotate game-key? 0= if freeze then
;
: ?games ( -- )
- game-key-mask h# 20 and if
+ rocker-right game-key? if
time&date 5drop 1 and if pong else life-demo then
then
;
@@ -540,36 +522,51 @@
console-start
read-game-keys
+[ifdef] notdef
fast-boot? if
- stdout off
+( D) stdout off \ banner
probe-pci
?sound
open-keyboard
+( D) \ ?games
?freeze
- ['] false to interrupt-auto-boot?
+\ ['] false to interrupt-auto-boot?
probe-usb
\ " nand" $dev-update-flash
interpreter-init
-[ifndef] lx-devel
- enable-power-button
-[then]
- auto-boot
- screen-ih stdout !
- ?usb-keyboard
+ secure-startup
+( D) screen-ih stdout ! \
+( D) ?usb-keyboard \
else
- banner
+( D) banner \ stdout off
probe-pci
?sound
open-keyboard
+( D) ?games \
+ ?freeze
+ probe-usb
+( D) ?usb-keyboard \
+ interpreter-init
+ secure-startup
+ then
+[else]
+ stdout off \
+ probe-pci
+ ?sound
+ open-keyboard
?games
?freeze
- optional-startup
+ ['] false to interrupt-auto-boot?
+ probe-usb
+\ " nand" $dev-update-flash
interpreter-init
-[ifndef] lx-devel
- enable-power-button
+ secure-startup
+ ['] (interrupt-auto-boot?) to interrupt-auto-boot?
+ screen-ih stdout !
+ banner
+ ?usb-keyboard
[then]
- auto-boot
- then
+ auto-boot
blue-letters ." Type 'help' for more information." black-letters
cr cr
Modified: cpu/x86/pc/olpc/gui.fth
===================================================================
--- cpu/x86/pc/olpc/gui.fth 2007-09-29 19:16:30 UTC (rev 646)
+++ cpu/x86/pc/olpc/gui.fth 2007-09-29 19:25:03 UTC (rev 647)
@@ -3,6 +3,7 @@
d# 0 d# 0 2value first-icon-xy
0 0 2value icon-xy
+0 0 2value last-xy
0 value text-y
: ?next-row ( -- )
@@ -14,15 +15,15 @@
then
;
-: show-565 ( image-adr,len -- )
+: prep-565 ( image-adr,len -- bits-adr x y w h )
drop
dup " C565" comp abort" Not in C565 format"
dup 4 + le-w@ to image-width
dup 6 + le-w@ to image-height
8 +
?next-row
+ icon-xy to last-xy
icon-xy image-width image-height
- " draw-rectangle" $call-screen
;
: $get-image ( filename$ -- true | adr,len false )
@@ -34,13 +35,21 @@
;
: $show ( filename$ -- )
not-screen? if 2drop exit then
- $get-image if exit then 2dup show-565 free-mem
+ 0 to image-width \ In case $show fails
+ $get-image if exit then
+ 2dup prep-565 " draw-transparent-rectangle" $call-screen
+ free-mem
;
-: $show&advance ( filename$ -- )
- 0 to image-width \ In case $show fails
- $show
+: $show-opaque ( filename$ -- )
+ not-screen? if 2drop exit then
+ $get-image if exit then
+ 2dup prep-565 " draw-rectangle" $call-screen
+ free-mem
+;
+: advance ( -- )
icon-xy image-width 0 d+ to icon-xy
;
+: $show&advance ( filename$ -- ) $show advance ;
: fix-cursor ( -- ) cursor-on ['] user-ok to (ok) user-ok ;
@@ -247,7 +256,7 @@
\ Make the terminal emulator use a region that avoids the logo area
: avoid-logo ( -- )
- 0 h# f ( fg-color bg-color )
+ screen-ih package( foreground-color background-color )package ( fg-color bg-color )
screen-wh drop char-wh drop d# 80 * - 2/ ( fg-color bg-color x )
text-y ( fg-color bg-color x y )
char-wh drop d# 80 * ( fg-color bg-color x y w )
@@ -309,7 +318,9 @@
avoid-logo
0 to image-width 0 to image-height \ In case $show-bmp fails
- " rom:olpc.565" $show&advance
+[ifdef] old-way
+ " rom:olpc.565" $show&advance
+[then]
icon-xy to first-icon-xy
@@ -347,13 +358,13 @@
h# 32 buffer: icon-name
-: show-icon-file ( basename$ -- )
+: show-icon ( basename$ -- )
" rom:" icon-name pack $cat ( )
" .565" icon-name $cat ( )
- icon-name count $show&advance ( )
+ icon-name count $show ( )
;
-: ?show-icon ( adr len -- )
+: ?show-package-icon ( adr len -- )
locate-device if exit then ( phandle )
" icon" 2 pick get-package-property 0= if ( phandle prop$ )
@@ -362,19 +373,19 @@
then ( phandle )
" iconname" 2 pick get-package-property 0= if ( phandle prop$ )
- get-encoded-string show-icon-file ( phandle )
+ get-encoded-string show-icon advance ( phandle )
drop exit
then ( phandle )
" name" 2 pick get-package-property 0= if ( phandle prop$ )
- get-encoded-string show-icon-file ( phandle )
+ get-encoded-string show-icon advance ( phandle )
drop exit
then ( phandle )
drop
;
: (?show-device) ( adr len -- adr len )
- not-screen? 0= if 2dup ?show-icon then
+ not-screen? 0= if 2dup ?show-package-icon then
;
' (?show-device) to ?show-device
Added: cpu/x86/pc/olpc/images/check.565
===================================================================
(Binary files differ)
Property changes on: cpu/x86/pc/olpc/images/check.565
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: cpu/x86/pc/olpc/images/check.bmp
===================================================================
(Binary files differ)
Property changes on: cpu/x86/pc/olpc/images/check.bmp
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: cpu/x86/pc/olpc/images/darkdot.565
===================================================================
(Binary files differ)
Property changes on: cpu/x86/pc/olpc/images/darkdot.565
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: cpu/x86/pc/olpc/images/darkdot.bmp
===================================================================
(Binary files differ)
Property changes on: cpu/x86/pc/olpc/images/darkdot.bmp
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: cpu/x86/pc/olpc/images/develkey.565
===================================================================
(Binary files differ)
Property changes on: cpu/x86/pc/olpc/images/develkey.565
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: cpu/x86/pc/olpc/images/develkey.bmp
===================================================================
(Binary files differ)
Property changes on: cpu/x86/pc/olpc/images/develkey.bmp
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: cpu/x86/pc/olpc/images/lightdot.565
===================================================================
(Binary files differ)
Property changes on: cpu/x86/pc/olpc/images/lightdot.565
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: cpu/x86/pc/olpc/images/lightdot.bmp
===================================================================
(Binary files differ)
Property changes on: cpu/x86/pc/olpc/images/lightdot.bmp
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: cpu/x86/pc/olpc/images/lock.565
===================================================================
(Binary files differ)
Property changes on: cpu/x86/pc/olpc/images/lock.565
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: cpu/x86/pc/olpc/images/lock.bmp
===================================================================
(Binary files differ)
Property changes on: cpu/x86/pc/olpc/images/lock.bmp
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: cpu/x86/pc/olpc/images/minus.565
===================================================================
(Binary files differ)
Property changes on: cpu/x86/pc/olpc/images/minus.565
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: cpu/x86/pc/olpc/images/minus.bmp
===================================================================
(Binary files differ)
Property changes on: cpu/x86/pc/olpc/images/minus.bmp
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: cpu/x86/pc/olpc/images/plus.565
===================================================================
(Binary files differ)
Property changes on: cpu/x86/pc/olpc/images/plus.565
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: cpu/x86/pc/olpc/images/plus.bmp
===================================================================
(Binary files differ)
Property changes on: cpu/x86/pc/olpc/images/plus.bmp
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: cpu/x86/pc/olpc/images/sad.565
===================================================================
(Binary files differ)
Property changes on: cpu/x86/pc/olpc/images/sad.565
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: cpu/x86/pc/olpc/images/sad.bmp
===================================================================
(Binary files differ)
Property changes on: cpu/x86/pc/olpc/images/sad.bmp
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Modified: cpu/x86/pc/olpc/images/sd.565
===================================================================
(Binary files differ)
Modified: cpu/x86/pc/olpc/images/sd.bmp
===================================================================
(Binary files differ)
Added: cpu/x86/pc/olpc/images/topkey.565
===================================================================
(Binary files differ)
Property changes on: cpu/x86/pc/olpc/images/topkey.565
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: cpu/x86/pc/olpc/images/topkey.bmp
===================================================================
(Binary files differ)
Property changes on: cpu/x86/pc/olpc/images/topkey.bmp
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: cpu/x86/pc/olpc/images/unlock.565
===================================================================
(Binary files differ)
Property changes on: cpu/x86/pc/olpc/images/unlock.565
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: cpu/x86/pc/olpc/images/unlock.bmp
===================================================================
(Binary files differ)
Property changes on: cpu/x86/pc/olpc/images/unlock.bmp
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: cpu/x86/pc/olpc/images/x.565
===================================================================
(Binary files differ)
Property changes on: cpu/x86/pc/olpc/images/x.565
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: cpu/x86/pc/olpc/images/x.bmp
===================================================================
(Binary files differ)
Property changes on: cpu/x86/pc/olpc/images/x.bmp
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: cpu/x86/pc/olpc/images/xogray.565
===================================================================
(Binary files differ)
Property changes on: cpu/x86/pc/olpc/images/xogray.565
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: cpu/x86/pc/olpc/images/xogray.bmp
===================================================================
(Binary files differ)
Property changes on: cpu/x86/pc/olpc/images/xogray.bmp
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: cpu/x86/pc/olpc/images/yellowdot.565
===================================================================
(Binary files differ)
Property changes on: cpu/x86/pc/olpc/images/yellowdot.565
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: cpu/x86/pc/olpc/images/yellowdot.bmp
===================================================================
(Binary files differ)
Property changes on: cpu/x86/pc/olpc/images/yellowdot.bmp
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Modified: cpu/x86/pc/olpc/loaddropins.fth
===================================================================
--- cpu/x86/pc/olpc/loaddropins.fth 2007-09-29 19:16:30 UTC (rev 646)
+++ cpu/x86/pc/olpc/loaddropins.fth 2007-09-29 19:25:03 UTC (rev 647)
@@ -28,13 +28,34 @@
" ${BP}/ofw/inet/telnetd.fth" " telnetd" $add-deflated-dropin
- " ${BP}/cpu/x86/pc/olpc/images/olpclogo.565" " olpc.565" $add-deflated-dropin
- " ${BP}/cpu/x86/pc/olpc/images/laptop.565" " nandflash.565" $add-deflated-dropin
+ " ${BP}/cpu/x86/pc/olpc/images/lightdot.565" " lightdot.565" $add-deflated-dropin
+ " ${BP}/cpu/x86/pc/olpc/images/yellowdot.565" " yellowdot.565" $add-deflated-dropin
+ " ${BP}/cpu/x86/pc/olpc/images/darkdot.565" " darkdot.565" $add-deflated-dropin
+ " ${BP}/cpu/x86/pc/olpc/images/lock.565" " lock.565" $add-deflated-dropin
+ " ${BP}/cpu/x86/pc/olpc/images/unlock.565" " unlock.565" $add-deflated-dropin
+ " ${BP}/cpu/x86/pc/olpc/images/plus.565" " plus.565" $add-deflated-dropin
+ " ${BP}/cpu/x86/pc/olpc/images/minus.565" " minus.565" $add-deflated-dropin
+ " ${BP}/cpu/x86/pc/olpc/images/x.565" " x.565" $add-deflated-dropin
+ " ${BP}/cpu/x86/pc/olpc/images/sad.565" " sad.565" $add-deflated-dropin
+
+\ " ${BP}/cpu/x86/pc/olpc/images/topkey.565" " topkey.565" $add-deflated-dropin
+\ " ${BP}/cpu/x86/pc/olpc/images/dot0.565" " mark0.565" $add-deflated-dropin
+\ " ${BP}/cpu/x86/pc/olpc/images/dot1.565" " mark1.565" $add-deflated-dropin
+\ " ${BP}/cpu/x86/pc/olpc/images/dot2.565" " mark2.565" $add-deflated-dropin
+\ " ${BP}/cpu/x86/pc/olpc/images/dot3.565" " mark3.565" $add-deflated-dropin
+\ " ${BP}/cpu/x86/pc/olpc/images/lock2.565" " lock2.565" $add-deflated-dropin
+\ " ${BP}/cpu/x86/pc/olpc/images/unlock2.565" " unlock2.565" $add-deflated-dropin
+ " ${BP}/cpu/x86/pc/olpc/images/check.565" " check.565" $add-deflated-dropin
+\ " ${BP}/cpu/x86/pc/olpc/images/leasekey.565" " leasekey.565" $add-deflated-dropin
+ " ${BP}/cpu/x86/pc/olpc/images/xogray.565" " xogray.565" $add-deflated-dropin
+\ " ${BP}/cpu/x86/pc/olpc/images/olpclogo.565" " olpc.565" $add-deflated-dropin
+ " ${BP}/cpu/x86/pc/olpc/images/laptop.565" " nand.565" $add-deflated-dropin
+ " ${BP}/cpu/x86/pc/olpc/images/laptop.565" " fastnand.565" $add-deflated-dropin
" ${BP}/cpu/x86/pc/olpc/images/ethernet.565" " ethernet.565" $add-deflated-dropin
- " ${BP}/cpu/x86/pc/olpc/images/usbkey.565" " usbdisk.565" $add-deflated-dropin
+ " ${BP}/cpu/x86/pc/olpc/images/usbkey.565" " disk.565" $add-deflated-dropin
" ${BP}/cpu/x86/pc/olpc/images/wireless.565" " wlan.565" $add-deflated-dropin
" ${BP}/cpu/x86/pc/olpc/images/xo.565" " xo.565" $add-deflated-dropin
- " ${BP}/cpu/x86/pc/olpc/images/sd.565" " sdmmc.565" $add-deflated-dropin
+ " ${BP}/cpu/x86/pc/olpc/images/sd.565" " sd.565" $add-deflated-dropin
" ${BP}/ofw/termemu/gallant.obf" " font" $add-deflated-dropin
@@ -43,3 +64,5 @@
" fw.public" " fwpubkey" $add-dropin \ Incompressible
" lease.public" " leasepubkey" $add-dropin \ Incompressible
" developer.public" " develpubkey" $add-dropin \ Incompressible
+
+ " hasher.img" " hasher" $add-deflated-dropin
Modified: cpu/x86/pc/olpc/security.fth
===================================================================
--- cpu/x86/pc/olpc/security.fth 2007-09-29 19:16:30 UTC (rev 646)
+++ cpu/x86/pc/olpc/security.fth 2007-09-29 19:25:03 UTC (rev 647)
@@ -3,7 +3,11 @@
\ Specs at http://wiki.laptop.org/go/Firmware_Security
-: developer-device-list " disk sd nand" ;
+: security-failure ( -- )
+ ." Security failure" cr
+ d# 10000 ms power-off
+;
+
: boot-device-list " disk sd nand" ;
true value debug-security?
@@ -131,7 +135,8 @@
\ bundle whose name is constructed from the current settings of the
\ device (DN), path (PN), filename head (CN), and filename body (FN).
-: bundle-present? ( -- flag )
+: bundle-present? ( fn$ -- flag )
+ fn-buf place
bundle-name$
" Trying " ?lease-debug 2dup ?lease-debug-cr
['] (boot-read) catch if 2drop false exit then
@@ -166,6 +171,11 @@
hashname place ( data$ sig$ )
pubkey$ hashname count signature-bad? 0= ( okay? )
+ dup if
+ " Signature valid" ?lease-debug-cr
+ else
+ " Signature invalid" ?lease-debug-cr
+ then
;
\ earliest is the earliest acceptable date value (in seconds).
@@ -374,12 +384,6 @@
4drop -1 exit
then ( sig$ expiration$ )
check-machine-signature ( -1|1 )
-
- dup 0< if
- " has bad signature" ?lease-debug-cr
- else
- " valid" ?lease-debug-cr
- then
;
\ lease-valid? tries to read a lease file from the currently-selected
@@ -391,6 +395,7 @@
" ${DN}:\security\lease.sig" expand$ ( name$ )
" Trying " ?lease-debug 2dup ?lease-debug-cr
r/o open-file if drop false exit then ( ih )
+ load-started
>r ( r: ih )
" Lease " ?lease-debug ( r: ih )
leasekey$ to pubkey$ ( r: ih )
@@ -400,8 +405,8 @@
then ( actual -eof? )
while ( actual )
sec-line-buf swap check-lease case ( -1|0|1 )
- 1 of r> close-file drop true exit endof
- -1 of r> close-file drop false exit endof
+ 1 of r> close-file drop " unlock" show-icon true exit endof
+ -1 of r> close-file drop " lock" show-icon false exit endof
endcase
repeat
r> close-file drop false
@@ -414,7 +419,7 @@
\ present) or "actos.zip" (the activation version of the OS).
: ?leased ( -- )
- lease-valid? if " run" else " act" then cn-buf place
+ lease-valid? if " run" else " act" then cn-buf place
;
\ olpc-load-image is factor that is close the top level of the
@@ -425,22 +430,18 @@
\ "runos.zip" according to whether or not a valid lease for
\ this machine is present on the same device.
-: olpc-load-image ( list$ dirname$ -- okay? )
- pn-buf place ( list$ )
+: olpc-load-image ( list$ -- okay? )
begin dup while ( list$ )
bl left-parse-string ( list$ devname$ )
dn-buf place ( list$' )
?leased ( list$ )
- bundle-present? if ( list$ )
+ " os" bundle-present? if ( list$ )
" OS found - " ?lease-debug
0 hashname c!
oskey$ to pubkey$
img$ sig$ valid? if
- " Signature valid" ?lease-debug-cr
img$ tuck load-base swap move !load-size
2drop true exit
- else
- " Signature invalid" ?lease-debug-cr
then
then ( list$ )
repeat ( list$ )
@@ -453,21 +454,41 @@
\ the NAND FLASH for an alternate OS image.
: secure-load ( -- okay? )
- load-crypto if ( )
- ." Can't get crypto code" cr ( )
- false exit
- then ( )
+ load-crypto if false exit then
get-my-sn if false exit then
get-date if false exit then
- " os" fn-buf place
-
- boot-device-list " \boot" olpc-load-image if true exit then
- " nand" " \boot-alt" olpc-load-image if true exit then
+ " \boot" pn-buf place boot-device-list olpc-load-image if true exit then
+ " \boot-alt" pn-buf place " nand" olpc-load-image if true exit then
false
;
+0 value alternate?
+: set-alternate ( -- )
+ button-o game-key? if true to alternate? exit then
+ h# 82 cmos@ [char] A = if
+ [char] N h# 82 cmos!
+ true to alternate? exit
+ then
+ false to alternate?
+;
+
+0 0 2value base-xy
+: show-check ( -- )
+ icon-xy base-xy to icon-xy " check" show-icon to icon-xy
+;
+: +icon-xy ( delta-x,y -- ) icon-xy d+ to icon-xy ;
+
+: show-dot ( -- )
+ alternate? if " yellowdot" else " lightdot" then show-icon
+;
+: show-x ( -- ) " x" show-icon ;
+: show-sad ( -- ) " sad" show-icon ;
+: show-lock ( -- ) " lock" show-icon ;
+: show-unlock ( -- ) " unlock" show-icon ;
+
+
\ secure-load-ramdisk is called during the process of preparing an
\ OS image for execution. It looks for an initrd bundle file on
\ the same device where the OS image was found, in a file named
@@ -490,27 +511,28 @@
['] load-path behavior >r ( r: xt )
['] ramdisk-buf to load-path ( r: xt )
- " rd" fn-buf place
- bundle-present? if
+ d# 16 0 +icon-xy show-dot
+ \ cn-buf is already set as a result of the ?leased that
+ \ happened before loading the OS file
+ " rd" bundle-present? if
r> to load-path
" RD found - " ?lease-debug
0 hashname c!
img$ sig$ valid? if
- " Signature valid" ?lease-debug-cr
+ show-unlock
load-base to ramdisk-adr
img$ dup to /ramdisk ( adr len )
load-base swap move ( )
exit
else
- " Signature invalid" ?lease-debug-cr
+ show-unlock
fail-load
then
then
r> to load-path
;
-
\ secure-boot performs the secure boot process
: secure-boot ( -- )
@@ -527,12 +549,12 @@
" wp" find-tag if 2drop true to secure? then
;
-\ ?secure-boot performs either the secure boot algorithm or the
+\ do-secure-boot performs either the secure boot algorithm or the
\ historical boot algorithm depending on the presence of a "wp"
\ manufacturing data tag.
-: ?secure-boot ( -- ) secure? if secure-boot else boot then ;
-" ?secure-boot" ' boot-command set-config-string-default
+: do-secure-boot ( -- ) secure? if secure-boot else boot then ;
+\ " do-secure-boot" ' boot-command set-config-string-default
\ check-devel-key tests the developer signature string "dev01$".
@@ -559,8 +581,10 @@
: has-developer-key? ( -- flag )
" ${DN}:\security\develop.sig" expand$ ( name$ )
+ " Trying " ?lease-debug 2dup ?lease-debug-cr
r/o open-file if drop false exit then ( ih )
>r
+ load-started
begin
sec-line-buf /sec-line-max r@ read-line if ( actual -eof? )
2drop r> close-file drop false exit
@@ -577,71 +601,153 @@
\ developer? searches a list of devices (given by "developer-device-list")
\ for a valid developer key
-: developer? ( -- flag )
- get-my-sn if false exit then
+: checked-load-started ( -- )
+ not-screen? if exit then
+ show-check
+;
+\ ' checked-load-started to load-started
+\ noop to load-started
- load-crypto if ( )
- ." Can't get crypt code" cr ( )
- false exit
- then ( )
+: ?toggle-secure ( -- ) button-x game-key? if secure? 0= to secure? then ;
- developer-device-list ( list$ )
- begin dup while ( list$ )
- bl left-parse-string dn-buf place ( list$' )
- has-developer-key? if ( list$' )
- 2drop true exit
- then ( list$ )
- repeat ( list$ )
- 2drop false
+6 buffer: fw#buf
+: (fw-version) ( base-adr -- n )
+ h# f.ffc7 + fw#buf 5 move
+ fw#buf 4 + c@ bl = if [char] 0 fw#buf 4 + c! then
+ base @ >r d# 36 base !
+ fw#buf 5 $number if
+ show-x
+ ." Invalid firmware version number" security-failure
+ then
+ pop-base
;
+: firmware-up-to-date? ( img$ -- )
+ /flash <> if show-x ." Invalid Firmware image" security-failure then ( adr )
+ (fw-version) ( file-version# )
+ rom-pa (fw-version) ( file-version# rom-version# )
+ u<=
+;
-fexit
+: load-from-device ( devname$ -- done? )
-Firmware security use cases:
+ d# 16 0 +icon-xy show-dot
+ null$ cn-buf place
+ " bootfw" bundle-present? if
+ " FW found - " ?lease-debug
-a) load image signing:
+ img$ firmware-up-to-date? if
+ " plus" show-icon
+ " current FW is up-to-date" ?lease-debug-cr
+ else
+ " minus" show-icon
+ " new - " ?lease-debug
+ 0 hashname c!
+ fwkey$ to pubkey$
+ img$ sig$ valid? if
+ img$ tuck flash-buf swap move ( len )
+ ?image-valid ( )
+ true to file-loaded?
+ " Updating firmware" ?lease-debug
-Package: {run,act}{os,rd}.zip
-Expiration: none
-Signed object: OS or RD image file in .zip file
-Signature: sha256_rsa256.sig in .zip file
-Verification Algorithm: sha256 -> rsa256
-Verification Key: OLPC-run-public-key
+ \ Latch alternate? flag for next startup
+ alternate? if [char] A h# 82 cmos! then
-Rule: Don't run the image if the signature fails
+ reflash \ Should power-off and reboot
+ show-x
+ ." Reflash returned, unexpectedly" cr
+ security-failure
+ then
+ show-lock
+ then
+ then
-b) Firmware update key
+ d# 16 0 +icon-xy show-dot
+ ?leased \ Sets cn-buf
-Package: /boot/bootfw.zip
-Expiration: none (but should be versioned to avoid repeated updates)
-Signed object: image in .zip file
-Signature1: sha255.rsa in .zip file
-Signature2: whirl.rsa in .zip file
-Verification Algorithm: sha256 -> rsa256, whirlpool -> rsa256
-Verification Key: OLPC-fw-public-key
+ d# 16 0 +icon-xy show-dot
+ " os" bundle-present? if
+ " OS found - " ?lease-debug
+ 0 hashname c!
+ oskey$ to pubkey$
+ img$ sig$ valid? if
+ img$ tuck load-base swap move !load-size
+ show-unlock
+ true exit
+ then
+ show-lock
+ then
+ false ( done? )
+;
-Rule: If the developer key is valid, enter unlocked firmware state
+: filesystem-present? ( -- flag )
+ " ${DN}:\" expand$ ( name$ )
+ open-dev dup if dup close-dev then
+ 0<>
+;
-c) Developer key
+0 0 2value next-xy
+: load-from-list ( list$ -- devkey? )
+ begin dup while ( list$ )
+ bl left-parse-string ( list$ devname$ )
+ 2dup dn-buf place ( list$ devname$ )
-Package: /security/develop.key
-Expiration: none
-Signed object: <serial#>:<uuid>:00000000T000000Z (representing the machine)
-Signature: rsa256 data in sig01 line
-Verification Algorithm: rsa256
-Verification Key: OLPC-devel-public-key
+ show-icon ( list$ xy )
+ icon-xy to base-xy
+ icon-xy image-width 0 d+ to next-xy ( list$ )
-Rule: If the developer key is valid, enter unlocked firmware state
+ filesystem-present? if
-d) Activation lease
+ d# 5 d# 77 +icon-xy show-dot
+ has-developer-key? if
+ show-unlock
+ true exit
+ then
-Package: /security/lease
-Expiration: Yes - time on signature line
-Signed object: <serial#>:<uuid>:<expiration time> (representing the machine)
-Signature: rsa256 data in sig01 line
-Verification Algorithm: rsa256
-Verification Key: OLPC-act-public-key
+ load-from-device if
+ 2drop
+ ['] secure-load-ramdisk to load-ramdisk
+ " init-program" $find if execute go then
+ show-x
+ security-failure
+ then
+ then
-Rule: If the lease is invalid, invoke act{os,rd}.zip instead of run{os,rd}.zip
+ next-xy to icon-xy
+ repeat ( list$ )
+ " sad" show-icon
+ 2drop false
+;
+: text-on screen-ih stdout ! ;
+: persistent-devkey? ( -- flag ) " dk" find-tag dup if nip nip then ;
+
+: all-devices$ ( -- list$ ) " disk sd fastnand nand" ;
+: secure-startup ( -- )
+ ['] noop to ?show-device
+ ['] noop to load-done
+ ['] noop to load-started
+
+ set-alternate
+
+ d# 552 d# 383 to icon-xy " rom:xogray.565" $show-opaque
+ d# 410 d# 540 to icon-xy \ For boot progress reports
+
+ button-check game-key? if text-on then
+ ?toggle-secure
+
+ secure? 0= if exit then
+
+ persistent-devkey? if exit then
+
+ get-my-sn if ." No serial number" cr show-sad security-failure then
+ get-date if ." Invalid system date" cr show-sad security-failure then
+
+ load-crypto if show-sad security-failure then ( )
+
+ alternate? if " \boot-alt" else " \boot" then pn-buf place
+
+ all-devices$ load-from-list if exit then \ Returns only if no images found
+
+ ." Boot failed" cr show-sad security-failure
+;
Modified: dev/geode/display/gxfb.fth
===================================================================
--- dev/geode/display/gxfb.fth 2007-09-29 19:16:30 UTC (rev 646)
+++ dev/geode/display/gxfb.fth 2007-09-29 19:25:03 UTC (rev 647)
@@ -555,9 +555,10 @@
map-frame-buffer
bytes/pixel case
1 of frame-buffer-adr /fb h# 0f fill endof
- 2 of frame-buffer-adr /fb h# ffff wfill endof
+ 2 of frame-buffer-adr /fb h# c0 dup dup rgb>565 wfill endof
4 of frame-buffer-adr /fb h# ffff.ffff lfill endof
endcase
+ 7 to background-color
;
: display-remove ( -- )
Modified: dev/video/common/rectangle16.fth
===================================================================
--- dev/video/common/rectangle16.fth 2007-09-29 19:16:30 UTC (rev 646)
+++ dev/video/common/rectangle16.fth 2007-09-29 19:25:03 UTC (rev 647)
@@ -29,6 +29,24 @@
loop ( adr' wbytes fbadr' )
3drop
;
+
+: draw-transparent-rectangle ( adr x y w h -- )
+ rectangle-setup ( adr wbytes fbadr h )
+ >r rot r> ( wbytes fbadr adr h )
+ 0 ?do ( wbytes fbadr adr )
+ 2 pick 0 ?do ( wbytes fbadr adr )
+ dup w@ >r wa1+ r> ( wbytes fbadr adr' color )
+ dup h# ffff = if ( wbytes fbadr adr color )
+ drop ( wbytes fbadr adr )
+ else ( wbytes fbadr adr color )
+ 2 pick i + w! ( wbytes fbadr adr )
+ then ( wbytes fbadr adr )
+ /w +loop ( wbytes fbadr adr )
+ swap /scanline + swap ( wbytes fbadr' adr )
+ loop ( wbytes fbadr' adr' )
+ 3drop
+;
+
: read-rectangle ( adr x y w h -- )
rectangle-setup 0 ?do ( adr wbytes fbadr )
3dup -rot move ( adr wbytes fbadr )
Modified: ofw/termemu/fb16.fth
===================================================================
--- ofw/termemu/fb16.fth 2007-09-29 19:16:30 UTC (rev 646)
+++ ofw/termemu/fb16.fth 2007-09-29 19:25:03 UTC (rev 647)
@@ -93,7 +93,8 @@
aa 00 00 rgb>565 , \ Dark red
aa 00 aa rgb>565 , \ Dark magenta
aa 55 aa rgb>565 , \ Brown
- aa aa aa rgb>565 , \ Light gray
+\ aa aa aa rgb>565 , \ Light gray
+ c0 c0 c0 rgb>565 , \ Light gray (OLPC background)
55 55 55 rgb>565 , \ Dark gray
55 55 ff rgb>565 , \ Light blue
55 ff 55 rgb>565 , \ Light green
@@ -117,7 +118,7 @@
text-foreground16 screen-background16 fb16-invert
;
: fb16-erase-screen ( -- )
- frame-buffer-adr bytes/line16 screen-height * screen-background16 fb-fill
+ frame-buffer-adr bytes/line16 screen-height * screen-background16 wfill
;
: fb16-blink-screen ( -- ) \ Better done by poking the DAC
fb16-invert-screen fb16-invert-screen
@@ -156,7 +157,7 @@
headerless
: move-line16 ( src-line-adr dst-line-adr -- ) emu-bytes/line fb-move ;
-: erase-line16 ( line-adr -- ) emu-bytes/line screen-background16 fb-fill ;
+: erase-line16 ( line-adr -- ) emu-bytes/line screen-background16 wfill ;
: erase-lines16 ( last-line first-line -- )
?do i erase-line16 bytes/line16 +loop
;
@@ -208,7 +209,7 @@
: erase-chars16 ( #chars start-col# -- )
swap char-width 2* * swap ( #bytes start-col# )
column-adr16 char-height 0 do ( #bytes adr )
- 2dup swap text-background16 fb-fill ( #bytes adr )
+ 2dup swap text-background16 wfill ( #bytes adr )
bytes/line16 + ( #bytes adr' )
loop 2drop ( )
;
1
0