[okl4-developer] [okl4-developer ] Problem with the configuration of a shared memory segment....
Hannes Payer
hannes.payer at cs.uni-salzburg.at
Tue May 12 20:40:51 EST 2009
Hi,
I had the same problem. For me the cloned cross-cell-demo worked
after using the SHMEM_CAP capability key for the shared memory
segment (in cross_cell_demo.c), as defined in the configuration.
- shmem = okl4_env_get_segment("MAIN_SHMEM");
+ shmem = okl4_env_get_segment("SHMEM_CAP");
Best,
Hannes
Hugues Balp wrote:
>
>
> Dear all,
>
> just a first word to say that I have solved the compilations problems of
> my preceding post.
>
> Now I wonder how to configure correctly a shared memory segment.
>
> In order to better understand the cross-cell-demo example, I have cloned
> and renamed the
>
> example "decrypt" into "mydecrypt" in the okl4_3.0/examples repository.
>
> In order to enable the build of this copy example, I have also edited
> the file okl4_3.0/projects/examples/SConstruct.
>
> A patch of okl4_3.0.tar.gz including the resulting modifications is
> joined to this mail.
>
> The build command I use to compile the test is the following:
>
> ./tools/build.py machine=versatile project=examples pyfreeze=false
> EXAMPLE=oklinux,mydecrypt LINUX_APPS=cross-cell-demo kdb_serial=True
> TOOLCHAIN=gnu_arm_eabi_toolchain pistachio.TOOLCHAIN=gnu_arm_toolchain
>
> The system boot properly but the following assertion is raised when I
> run the executable "cross-cell-demo":
>
> Assertion failed: shmem != NULL, function cross_cell_open, file
>
> /home/hugues/tools/okl4/okl4_3.0/linux/kernel-2.6.24-v2/arch/l4/drivers/cross_cell_demo.c,
> line 102.
>
> The related source code is:
>
> shmem = okl4_env_get_segment("MAIN_SHMEM");
> assert(shmem != NULL);
>
> This problem occurs only when I use the "mydecrypt" example and not when
> I use the original one.
>
> So I suppose that the SHMEM segment is well configured when I use the
> "decrypt" example and not when
>
> I use its copy, but I wonder why. There is some kind of hidden
> dependency that I don't understand....
>
> When I search for the strings "MAIN_SHMEM" and "SHMEM" I just see them
> in SConscript files
>
> or in source code within a call like "okl4_env_get_segment()"....
>
> The only differences in the file weaver.xml are the name of the
> directory used for the shmem ( decrypt on one
>
> side and mydecrypt on the other )....
>
> I would appreciate any help on this subject.
>
> Best regards,
>
> Hugues Balp.
>
>
>
>
>
>
>
> diff -rupN original/okl4_3.0/examples/mydecrypt/SConscript
> modified/okl4_3.0/examples/mydecrypt/SConscript
> --- original/okl4_3.0/examples/mydecrypt/SConscript 1970-01-01
> 01:00:00.000000000 +0100
> +++ modified/okl4_3.0/examples/mydecrypt/SConscript 2008-12-09
> 16:32:39.000000000 +0100
> @@ -0,0 +1,27 @@
> +#
> +# @LICENCE("Public", "2008")@
> +#
> +
> +Import("*")
> +
> +libs = ["atomic_ops", "c", "okl4", "l4", "mutex"]
> +
> +try:
> + if args["serial_driver"]:
> + libs.append(args["serial_driver"])
> + libs.append("serial")
> + #env.Append(CPPDEFINES=[("SERIAL_DRIVER",
> args["serial_driver"])])
> +except:
> + pass
> +
> +print env.kernel
> +ms = env.Memsection("shmem", None, 0x1000, "rw")
> +env.add_memsections(None, [ms])
> +
> +env.Append(CPPDEFINES=[("DECRYPT_MASK", 0x34)])
> +
> +obj = env.KengeProgram("mydecrypt", LIBS=libs)
> +
> +env.set_program(obj, heap=0x100000)
> +
> +Return("obj")
> diff -rupN original/okl4_3.0/examples/mydecrypt/src/main.c
> modified/okl4_3.0/examples/mydecrypt/src/main.c
> --- original/okl4_3.0/examples/mydecrypt/src/main.c 1970-01-01
> 01:00:00.000000000 +0100
> +++ modified/okl4_3.0/examples/mydecrypt/src/main.c 2008-12-09
> 16:32:25.000000000 +0100
> @@ -0,0 +1,41 @@
> +/* @LICENCE("Public", "2008")@ */
> +
> +#include <okl4/env.h>
> +#include <okl4/init.h>
> +#include <okl4/notify.h>
> +
> +int
> +main(int argc, char **argv)
> +{
> + okl4_env_segment_t *ms;
> + okl4_kcap_t linux_cap;
> + okl4_word_t mask, shift;
> + char *c, tmp;
> +
> + okl4_init_thread();
> +
> + ms = okl4_env_get_segment("MAIN_SHMEM");
> + assert(ms != NULL);
> +
> + shift = *(okl4_word_t *)okl4_env_get("CAESAR_CIPHER_SHIFT");
> +
> + linux_cap = *(okl4_kcap_t *)okl4_env_get("ROOT_CELL_CAP");
> +
> +
> + while (1) {
> + okl4_notify_wait(DECRYPT_MASK, &mask);
> +
> + c = (char *)ms->virt_addr;
> +
> + while (*c != '\0') {
> + tmp = *c - shift;
> + if ((tmp < 65 && (*c >= 65 && *c <= 90)) || (tmp < 97 && (*c
> >= 97 && *c <= 122))) {
> + tmp += 26;
> + }
> + *c = tmp;
> + c++;
> + }
> +
> + okl4_notify_send(linux_cap, DECRYPT_MASK);
> + }
> +}
> diff -rupN original/okl4_3.0/projects/examples/SConstruct
> modified/okl4_3.0/projects/examples/SConstruct
> --- original/okl4_3.0/projects/examples/SConstruct 2008-10-20
> 05:03:51.000000000 +0200
> +++ modified/okl4_3.0/projects/examples/SConstruct 2008-12-09
> 16:37:46.000000000 +0100
> @@ -72,7 +72,7 @@ kcell = build.Kernel()
>
> # Create a cell for each example, ensure valid multi-cell setup
>
> -valid_examples = ["hello", "args", "pds_zones", "pingpong", "echo",
> "chatterbox", "decrypt", "oklinux", "empty"]
> +valid_examples = ["hello", "args", "pds_zones", "pingpong", "echo",
> "chatterbox", "decrypt", "mydecrypt", "oklinux", "empty"]
>
> # Do not add reverse lookups! The names in the valid_multicell lookup
> # are the names of cells which have ownership of the serial driver.
> @@ -80,7 +80,7 @@ valid_examples = ["hello", "args", "pds_
> # eg. echo has serial, chatterbox does not
> valid_multicell = {
> "echo" : ["chatterbox", "decrypt"],
> - "oklinux" : ["decrypt"] }
> + "oklinux" : ["decrypt", "mydecrypt" ] }
>
> serial_lookup = {
> "hello" : True,
> @@ -91,6 +91,7 @@ serial_lookup = {
> "chatterbox" : False,
> "oklinux" : True,
> "decrypt" : False,
> + "mydecrypt" : False,
> "empty" : False
> }
>
> @@ -152,7 +153,7 @@ for example in example_list:
> cell.env_append(None,
> key = "ROOT_CELL_CAP",
> cap = "/%s/main" % root_cell)
> - if example == "decrypt":
> + if example == "decrypt" or example == "mydecrypt":
> cell.env_append(None,
> key = "CAESAR_CIPHER_SHIFT",
> value = 1)
> @@ -163,7 +164,13 @@ for example in example_list:
> cell.env_append(None,
> key = "DECRYPT_CELL_CAP",
> cap = "/decrypt/main")
> -
> + if example == root_cell and 'mydecrypt' in example_list:
> + cell.env_append(None,
> + key = "SHMEM_CAP",
> + cap = "/mydecrypt/shmem")
> + cell.env_append(None,
> + key = "DECRYPT_CELL_CAP",
> + cap = "/mydecrypt/main")
> if build.kernel == "nano":
> num_spaces = 1
> else: # Share the spaces between the cells
>
> _______________________________________________
> Developer mailing list
> Developer at okl4.org
> https://lists.okl4.org/mailman/listinfo/developer
>
>
--
View this message in context: http://n2.nabble.com/-okl4-developer---Problem-with-the-configuration-of-a-shared-memory-segment....-tp1634738p2868430.html
Sent from the OKL4 Community Forum mailing list archive at Nabble.com.
More information about the Developer
mailing list