[prev in list] [next in list] [prev in thread] [next in thread]
List: openbios
Subject: Re: [OpenBIOS] [PATCH] Adds filll word to dictionary
From: Programmingkid <programmingkidx () gmail ! com>
Date: 2012-12-02 18:12:21
Message-ID: B68E668A-2FC2-46E9-BCC9-7FAECF718953 () gmail ! com
[Download RAW message or body]
On Nov 24, 2012, at 1:08 PM, Mark Cave-Ayland wrote:
> On 20/11/12 03:35, Programmingkid wrote:
>
> > The filll word fills a region of memory with a 4 byte value. This word is \
> > different from fill because fill is used to fill a region of memory with a 1 byte \
> > value.
> > This word is needed by bootx to boot Mac OS X.
> >
> > Here are some test results comparing Apple's implementation to mine.
> >
> > Apple's implementation:
> >
> > 0> 100 buffer: mybuffer ok
> > 0> mybuffer 100 87654321 filll ok
> > 0> mybuffer 100 dump
> > ffbc8800: 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 |.eC!.eC!.eC!.eC!|
> > ffbc8810: 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 |.eC!.eC!.eC!.eC!|
> > ffbc8820: 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 |.eC!.eC!.eC!.eC!|
> > ffbc8830: 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 |.eC!.eC!.eC!.eC!|
> > ffbc8840: 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 |.eC!.eC!.eC!.eC!|
> > ffbc8850: 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 |.eC!.eC!.eC!.eC!|
> > ffbc8860: 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 |.eC!.eC!.eC!.eC!|
> > ffbc8870: 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 |.eC!.eC!.eC!.eC!|
> > ffbc8880: 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 |.eC!.eC!.eC!.eC!|
> > ffbc8890: 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 |.eC!.eC!.eC!.eC!|
> > ffbc88a0: 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 |.eC!.eC!.eC!.eC!|
> > ffbc88b0: 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 |.eC!.eC!.eC!.eC!|
> > ffbc88c0: 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 |.eC!.eC!.eC!.eC!|
> > ffbc88d0: 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 |.eC!.eC!.eC!.eC!|
> > ffbc88e0: 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 |.eC!.eC!.eC!.eC!|
> > ffbc88f0: 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 |.eC!.eC!.eC!.eC!|
> >
> >
> >
> > My patch:
> >
> > 0> mybuffer 100 87654321 filll ok
> > 0> mybuffer 100 dump
> > fff771e0 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 ?eC!?eC!?eC!?eC!
> > fff771f0 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 ?eC!?eC!?eC!?eC!
> > fff77200 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 ?eC!?eC!?eC!?eC!
> > fff77210 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 ?eC!?eC!?eC!?eC!
> > fff77220 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 ?eC!?eC!?eC!?eC!
> > fff77230 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 ?eC!?eC!?eC!?eC!
> > fff77240 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 ?eC!?eC!?eC!?eC!
> > fff77250 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 ?eC!?eC!?eC!?eC!
> > fff77260 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 ?eC!?eC!?eC!?eC!
> > fff77270 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 ?eC!?eC!?eC!?eC!
> > fff77280 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 ?eC!?eC!?eC!?eC!
> > fff77290 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 ?eC!?eC!?eC!?eC!
> > fff772a0 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 ?eC!?eC!?eC!?eC!
> > fff772b0 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 ?eC!?eC!?eC!?eC!
> > fff772c0 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 ?eC!?eC!?eC!?eC!
> > fff772d0 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 ?eC!?eC!?eC!?eC!
> >
> >
> > The results are the same. This indicates the patch will work.
> >
> > After I applied this patch, bootx continued booting a little further than before.
> >
> >
> > signed-off-by: John Arbuckle<programmingkidx@gmail.com>
> >
> > Index: kernel/bootstrap.c
> > ===================================================================
> > --- kernel/bootstrap.c (revision 1067)
> > +++ kernel/bootstrap.c (working copy)
> > @@ -89,7 +89,7 @@
> > "here", "here!", "dobranch", "do?branch", "unaligned-w@",
> > "unaligned-w!", "unaligned-l@", "unaligned-l!", "ioc@", "iow@",
> > "iol@", "ioc!", "iow!", "iol!", "i", "j", "call", "sys-debug",
> > - "$include", "$encode-file", "(debug", "(debug-off)"
> > + "$include", "$encode-file", "(debug", "(debug-off)", "filll"
> > };
> >
> > /*
> > Index: kernel/forth.c
> > ===================================================================
> > --- kernel/forth.c (revision 1067)
> > +++ kernel/forth.c (working copy)
> > @@ -1611,6 +1611,24 @@
> > }
> >
> >
> > +// filll ( addr len long-number -- )
> > +
> > +static void filll(void)
> > +{
> > + int * location;
> > + int length, fillNumber, index;
> > +
> > + fillNumber = POP();
> > + length = POP();
> > + location = (int *) POP();
> > +
> > + for(index = 0; index<= length; index++)
> > + {
> > + location[index] = fillNumber;
> > + }
> > +}
> > +
> > +
> > /*
> > * unaligned-w@ ( addr -- w )
> > */
> > @@ -1963,4 +1981,5 @@
> > do_encode_file, /* $encode-file */
> > do_debug_xt, /* (debug */
> > do_debug_off, /* (debug-off) */
> > + filll, /* filll */
> > };
> >
> >
>
> I can see that the patch works, but in order to commit it I'd like to see the \
> following changes:
> 1) Move the filll C function somewhere under arch/ppc/qemu/ and use bind_func() \
> somewhere in an initialiser to "hook" it into Forth. This is to ensure that we keep \
> the non-IEEE standard words separate from the core project.
I don't see any advantage to doing this. Is there a filll (3 l's) word on any other \
platform?
Is this how the bind_func call would look like: bind_func("filll", filll); ? Where \
should I place this call?
>
> 2) Make the method for filling the memory work better on other architectures. The \
> problem with the above is that you're assuming that sizeof(int) == 4 which may not \
> always be the case (think PPC64). Take a look at lstore() in kernel/forth.c to see \
> how this should be done in a multi-arch friendly way for 32-bit values.
Sounds like a good suggestion.
--
OpenBIOS http://openbios.org/
Mailinglist: http://lists.openbios.org/mailman/listinfo
Free your System - May the Forth be with you
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic