Exemple #1
0
    def test_merge(self):
        a = capdl.TCB('foo')
        b = capdl.TCB('bar')

        spec1 = capdl.Spec()
        spec2 = capdl.Spec()
        spec1.merge(spec2)
        assert len(spec1.objs) == 0

        spec1 = capdl.Spec()
        spec1.add_object(a)
        spec2 = capdl.Spec()
        spec1.merge(spec2)
        assert spec1.objs == set([a])

        spec1 = capdl.Spec()
        spec1.add_object(a)
        spec2 = capdl.Spec()
        spec2.add_object(b)
        spec1.merge(spec2)
        assert spec1.objs == set([a, b])
# This software may be distributed and modified according to the terms of
# the BSD 2-Clause license. Note that NO WARRANTY is provided.
# See "LICENSE_BSD2.txt" for details.
#
# @TAG(DATA61_BSD)
#

from __future__ import absolute_import, division, print_function, \
    unicode_literals

# Add the root directory of this repository to your PYTHONPATH environment
# variable to enable the following import.
import capdl

# Let's make a TCB:
tcb = capdl.TCB('my_tcb')

# Set some relevant properties of it:
tcb.ip = 0x8000
tcb.sp = 0xdeadbeef
tcb.init += [0xcafe, 0xdeaf]

# Create an endpoint:
ep = capdl.Endpoint('my_ep')

# Let's set that endpoint as the TCB's fault EP:
ep_cap = capdl.Cap(ep)
tcb['fault_ep'] = ep_cap

# Let's setup a CSpace and VSpace for the TCB:
cspace = capdl.CNode('my_cnode', 28)  # <-- size in bits
Exemple #3
0
# Commonwealth Scientific and Industrial Research Organisation (CSIRO)
# ABN 41 687 119 230.
#
# This software may be distributed and modified according to the terms of
# the BSD 2-Clause license. Note that NO WARRANTY is provided.
# See "LICENSE_BSD2.txt" for details.
#
# @TAG(DATA61_BSD)
#

from __future__ import absolute_import, division, print_function, \
    unicode_literals

import capdl

a = capdl.TCB('foo')
b = capdl.TCB('bar')

spec1 = capdl.Spec()
spec2 = capdl.Spec()
spec1.merge(spec2)
assert len(spec1.objs) == 0

spec1 = capdl.Spec()
spec1.add_object(a)
spec2 = capdl.Spec()
spec1.merge(spec2)
assert spec1.objs == set([a])

spec1 = capdl.Spec()
spec1.add_object(a)