This changes pocket index calculation to support more than two pockets.
As an example default number of pockets is set to 4.
This should ease nesting more than two levels using pockets as
temporary storage.
Signed-off-by: Igor Kovalenko <igor.v.kovalenko(a)gmail.com>
--
Kind regards,
Igor V. Kovalenko
Author: blueswirl
Date: 2009-05-22 19:15:48 +0200 (Fri, 22 May 2009)
New Revision: 494
Modified:
trunk/openbios-devel/forth/bootstrap/bootstrap.fs
Log:
forth: add more pockets
This changes pocket index calculation to support more than two pockets.
As an example default number of pockets is set to 4.
This should ease nesting more than two levels using pockets as
temporary storage.
Signed-off-by: Igor Kovalenko <igor.v.kovalenko(a)gmail.com>
Modified: trunk/openbios-devel/forth/bootstrap/bootstrap.fs
===================================================================
--- trunk/openbios-devel/forth/bootstrap/bootstrap.fs 2009-05-22 17:14:10 UTC (rev 493)
+++ trunk/openbios-devel/forth/bootstrap/bootstrap.fs 2009-05-22 17:15:48 UTC (rev 494)
@@ -622,18 +622,19 @@
\ pockets implementation for 7.3.4.1
100 constant pocketsize
+4 constant numpockets
variable pockets 0 pockets !
variable whichpocket 0 whichpocket !
-\ allocate 2 pockets to begin with
+\ allocate 4 pockets to begin with
: init-pockets ( -- )
- pocketsize 2* alloc-mem pockets !
+ pocketsize numpockets * alloc-mem pockets !
;
: pocket ( ?? -- ?? )
pocketsize whichpocket @ *
pockets @ +
- 1 whichpocket @ -
+ whichpocket @ 1 + numpockets mod
whichpocket !
;
Wrong encoding of "#address-cells" property can lead to a failure
fetching correct value in my-#acells method. According to docs
properties must be encoded with "encode-int". I spent some time
looking at the docs and it is clear that encode-int produces
quad-sized result (of size /l bytes).
This patch fixes pci helpers to encode to 32bit instead of 64bit values,
and correctes my-address and my-unit methods to read 32bit data
to match encode-int rules
modules/bindings.c: also fixed set_int_property and get_int_property
to match encode-int rules
Signed-off-by: Igor Kovalenko <igor.v.kovalenko(a)gmail.com>
--
Kind regards,
Igor V. Kovalenko
Hi everyone,
This patch fixes the b(do)...b(leaves)...b(loop)/b(+loop) structures by
marking them as immediate rather then compile-only. Without this in
place, the loop addresses would be calculated incorrectly which would
cause the Fcode evaluator to jump to the wrong location for each loop
iteration. I've confirmed that this change does not break
do...leaves...loop in immediate mode either.
For reference, here are the test cases I used:
\ Test Fcode do...loop
\ Forth: 3 0 do i . cr loop
here
cc c, \ offset16
a8 c, \ 3
a5 c, \ 0
17 c, 00 c, 08 c, \ b(do)
19 c, \ i
9d c, \ .
92 c, \ cr
15 c, ff c, fc c, \ b(loop)
00 c, \ end
\ Test Fcode do...+loop
\ Forth: 10 0 do i . cr 2 +loop
here
cc c, \ offset16
10 c, 00 c, 00 c, 00 c, 10 c, \ b(lit) 0x10
a5 c, \ 0
17 c, 00 c, 09 c, \ b(do)
19 c, \ i
9d c, \ .
92 c, \ cr
a7 c, \ 2
16 c, ff c, fb c, \ b(+loop)
00 c, \ end
\ Test Fcode do...leave...loop
\ Forth: a 0 do i dup . 3 = if leave then loop
here
cc c, \ offset16
10 c, 00 c, 00 c, 00 c, 0a c, \ b(lit) 0xA
a5 c, \ 0
17 c, 00 c, 0f c, \ b(do)
19 c, \ i
47 c, \ dup
9d c, \ .
a8 c, \ 3
3c c, \ =
14 c, 00 c, 04 c, \ b?branch
1b c, \ b(leave)
b2 c, \ b(>resolve)
15 c, ff c, f5 c, \ b(loop)
00 c, \ end
With these last 2 patches and diag-switch? set to true, the Fcode
evaluator will now finish executing my SPARC64 disk image without
crashing giving the following output:
OpenBIOS for Sparc64
Configuration device id QEMU version 1 machine id 0
CPUs: 1 x SUNW,UltraSPARC-II
UUID: 00000000-0000-0000-0000-000000000000
Welcome to OpenBIOS v1.0 built on May 21 2009 19:09
Type 'help' for detailed information
[sparc64] Booting file 'disk' with parameters ''
Not a bootable ELF image
Not a Linux kernel image
Not a bootable a.out image
Loading FCode image...
Loaded 5936 bytes
entry point is 0x4000
Evaluating FCode...
reserved fcode word.
Loading package 1.4 04 Aug 1995 13:02:54.
reserved fcode word.
reserved fcode word.
reserved fcode word.
FCode UFS Reader 1.12 00/07/17 15:48:16.
Loading: /platform//ufsboot
Loading: /platform/sun4u/ufsboot
Boot load failed.
byte-load: stack overflow, diff -2
0 >
It looks as if the next stage is to implement the missing
push-package/pop-package forth words to ensure that the ufs-file-system
package is located at the correct point in the tree - I'll see if I can
come up with something over the next few days.
ATB,
Mark.
--
Mark Cave-Ayland - Senior Technical Architect
PostgreSQL - PostGIS
Sirius Corporation plc - control through freedom
http://www.siriusit.co.uk
t: +44 870 608 0063
Hi everyone,
When trying to boot a SPARC64 disk image under QEMU, extra diagnostic
information can be made available on the console if diagnostic-mode?
returns true. This patch implements the simple step of reading the
diag-switch? NVRAM parameter and using this to determine whether
diagnostic mode is enabled or disabled.
ATB,
Mark.
--
Mark Cave-Ayland - Senior Technical Architect
PostgreSQL - PostGIS
Sirius Corporation plc - control through freedom
http://www.siriusit.co.uk
t: +44 870 608 0063