summaryrefslogtreecommitdiffstats
path: root/sys/arm
diff options
context:
space:
mode:
authorian <ian@FreeBSD.org>2016-01-24 21:04:06 +0000
committerian <ian@FreeBSD.org>2016-01-24 21:04:06 +0000
commit33902405d5bbd7b2931c254ec445012ce3f55107 (patch)
tree33c17616598fc9b12d795c2df7df3c15d2707e86 /sys/arm
parentde82ecaee5587ea2f8c5c4d0713862530513329c (diff)
downloadFreeBSD-src-33902405d5bbd7b2931c254ec445012ce3f55107.zip
FreeBSD-src-33902405d5bbd7b2931c254ec445012ce3f55107.tar.gz
MFC r293045, r293046:
Make the 'env' directive described in config(5) work on all architectures, providing compiled-in static environment data that is used instead of any data passed in from a boot loader. Previously 'env' worked only on i386 and arm xscale systems, because it required the MD startup code to examine the global envmode variable and decide whether to use static_env or an environment obtained from the boot loader, and set the global kern_envp accordingly. Most startup code wasn't doing so. Making things even more complex, some mips startup code uses an alternate scheme that involves calling init_static_kenv() to pass an empty buffer and its size, then uses a series of kern_setenv() calls to populate that buffer. Now all MD startup code calls init_static_kenv(), and that routine provides a single point where envmode is checked and the decision is made whether to use the compiled-in static_kenv or the values provided by the MD code. The routine also continues to serve its original purpose for mips; if a non-zero buffer size is passed the routine installs the empty buffer ready to accept kern_setenv() values. Now if the size is zero, the provided buffer full of existing env data is installed. A NULL pointer can be passed if the boot loader provides no env data; this allows the static env to be installed if envmode is set to do so. Most of the work here is a near-mechanical change to call the init function instead of directly setting kern_envp. A notable exception is in xen/pv.c; that code was originally installing a buffer full of preformatted env data along with its non-zero size (like mips code does), which would have allowed kern_setenv() calls to wipe out the preformatted data. Now it passes a zero for the size so that the buffer of data it installs is treated as non-writeable. Also, revert accidental change that snuck into r293045.
Diffstat (limited to 'sys/arm')
-rw-r--r--sys/arm/arm/machdep.c6
-rw-r--r--sys/arm/xscale/ixp425/avila_machdep.c8
2 files changed, 7 insertions, 7 deletions
diff --git a/sys/arm/arm/machdep.c b/sys/arm/arm/machdep.c
index a59ecbb..443cc5b 100644
--- a/sys/arm/arm/machdep.c
+++ b/sys/arm/arm/machdep.c
@@ -826,6 +826,8 @@ fake_preload_metadata(struct arm_boot_params *abp __unused)
fake_preload[i] = 0;
preload_metadata = (void *)fake_preload;
+ init_static_kenv(NULL, 0);
+
return (lastaddr);
}
@@ -901,6 +903,8 @@ linux_parse_boot_param(struct arm_boot_params *abp)
bcopy(atag_list, atags,
(char *)walker - (char *)atag_list + ATAG_SIZE(walker));
+ init_static_kenv(NULL, 0);
+
return fake_preload_metadata(abp);
}
#endif
@@ -929,7 +933,7 @@ freebsd_parse_boot_param(struct arm_boot_params *abp)
return 0;
boothowto = MD_FETCH(kmdp, MODINFOMD_HOWTO, int);
- kern_envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *);
+ init_static_kenv(MD_FETCH(kmdp, MODINFOMD_ENVP, char *), 0);
lastaddr = MD_FETCH(kmdp, MODINFOMD_KERNEND, vm_offset_t);
#ifdef DDB
ksym_start = MD_FETCH(kmdp, MODINFOMD_SSYM, uintptr_t);
diff --git a/sys/arm/xscale/ixp425/avila_machdep.c b/sys/arm/xscale/ixp425/avila_machdep.c
index b1d6734..e72798a 100644
--- a/sys/arm/xscale/ixp425/avila_machdep.c
+++ b/sys/arm/xscale/ixp425/avila_machdep.c
@@ -223,8 +223,8 @@ initarm(struct arm_boot_params *abp)
pcpu_init(pcpup, 0, sizeof(struct pcpu));
PCPU_SET(curthread, &thread0);
- if (envmode == 1)
- kern_envp = static_env;
+ init_static_kenv(NULL, 0);
+
/* Do basic tuning, hz etc */
init_param1();
@@ -420,10 +420,6 @@ initarm(struct arm_boot_params *abp)
init_param2(physmem);
kdb_init();
- /* use static kernel environment if so configured */
- if (envmode == 1)
- kern_envp = static_env;
-
return ((void *)(kernelstack.pv_va + USPACE_SVC_STACK_TOP -
sizeof(struct pcb)));
#undef next_page
OpenPOWER on IntegriCloud