From 6d31d460246a4e912759ff9f28ffa81c0fc7e4a8 Mon Sep 17 00:00:00 2001
From: Matthew Fernandez <matthew.fernandez@nicta.com.au>
Date: Tue, 21 Oct 2014 13:32:42 +1100
Subject: [PATCH] trivial: Standardise on 32-bit unsigned variables for domain
 values.

Domains are unnecessarily treated explicitly as 8-bit values within boot info.
Though there are existing proof constraints that limit the maximum domain value
to 8 bits, most of the code would permit domain values up to 32 bits. The
maximum value is unnecessarily constrained in boot info, a restriction which
this commit removes.

Closes VER-341
---
 include/bootinfo.h              | 2 +-
 libsel4/include/sel4/bootinfo.h | 2 +-
 src/kernel/boot.c               | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/bootinfo.h b/include/bootinfo.h
index 02322e1e6..3c0f90559 100644
--- a/include/bootinfo.h
+++ b/include/bootinfo.h
@@ -68,7 +68,7 @@ typedef struct bi {
     uint8_t       it_cnode_size_bits; /* initial thread's root CNode size (2^n slots) */
     uint32_t      num_dev_regs;       /* number of device regions */
     bi_dev_reg_t  dev_reg_list[CONFIG_MAX_NUM_BOOTINFO_DEVICE_REGIONS]; /* device regions */
-    uint8_t       it_domain;       /* initial thread's domain ID */
+    dom_t         it_domain;       /* initial thread's domain ID */
 } bi_t;
 
 /* adjust constants in config.h if this assert fails */
diff --git a/libsel4/include/sel4/bootinfo.h b/libsel4/include/sel4/bootinfo.h
index 8c678a433..476aa41d2 100644
--- a/libsel4/include/sel4/bootinfo.h
+++ b/libsel4/include/sel4/bootinfo.h
@@ -60,7 +60,7 @@ typedef struct {
     uint8_t           initThreadCNodeSizeBits; /* initial thread's root CNode size (2^n slots) */
     seL4_Word         numDeviceRegions;        /* number of device regions */
     seL4_DeviceRegion deviceRegions[CONFIG_MAX_NUM_BOOTINFO_DEVICE_REGIONS]; /* device regions */
-    uint8_t           initThreadDomain; /* Initial thread's domain ID */
+    uint32_t          initThreadDomain; /* Initial thread's domain ID */
 } seL4_BootInfo;
 
 /* function declarations */
diff --git a/src/kernel/boot.c b/src/kernel/boot.c
index a7700c8f5..1d00419d0 100644
--- a/src/kernel/boot.c
+++ b/src/kernel/boot.c
@@ -265,7 +265,7 @@ allocate_bi_frame(
     BI_PTR(pptr)->num_iopt_levels = 0;
     BI_PTR(pptr)->ipcbuf_vptr = ipcbuf_vptr;
     BI_PTR(pptr)->it_cnode_size_bits = CONFIG_ROOT_CNODE_SIZE_BITS;
-    BI_PTR(pptr)->it_domain = (uint8_t)ksDomSchedule[ksDomScheduleIdx].domain;
+    BI_PTR(pptr)->it_domain = ksDomSchedule[ksDomScheduleIdx].domain;
 
     return pptr;
 }
-- 
GitLab