Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F102680268
D36574.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
8 KB
Referenced Files
None
Subscribers
None
D36574.diff
View Options
diff --git a/stand/common/metadata.c b/stand/common/metadata.c
--- a/stand/common/metadata.c
+++ b/stand/common/metadata.c
@@ -65,34 +65,6 @@
return(howto);
}
-/*
- * Copy the environment into the load area starting at (addr).
- * Each variable is formatted as <name>=<value>, with a single nul
- * separating each variable, and a double nul terminating the environment.
- */
-static vm_offset_t
-md_copyenv(vm_offset_t addr)
-{
- struct env_var *ep;
-
- /* traverse the environment */
- for (ep = environ; ep != NULL; ep = ep->ev_next) {
- archsw.arch_copyin(ep->ev_name, addr, strlen(ep->ev_name));
- addr += strlen(ep->ev_name);
- archsw.arch_copyin("=", addr, 1);
- addr++;
- if (ep->ev_value != NULL) {
- archsw.arch_copyin(ep->ev_value, addr, strlen(ep->ev_value));
- addr += strlen(ep->ev_value);
- }
- archsw.arch_copyin("", addr, 1);
- addr++;
- }
- archsw.arch_copyin("", addr, 1);
- addr++;
- return(addr);
-}
-
/*
* Load the information expected by a kernel.
*
diff --git a/stand/common/modinfo.h b/stand/common/modinfo.h
--- a/stand/common/modinfo.h
+++ b/stand/common/modinfo.h
@@ -7,5 +7,6 @@
#define COMMON_MODINFO_H
vm_offset_t md_copymodules(vm_offset_t addr, bool kern64);
+vm_offset_t md_copyenv(vm_offset_t addr);
#endif /* COMMON_MODINFO_H */
diff --git a/stand/common/modinfo.c b/stand/common/modinfo.c
--- a/stand/common/modinfo.c
+++ b/stand/common/modinfo.c
@@ -148,3 +148,42 @@
MOD_END(addr, c);
return(addr);
}
+
+/*
+ * Copy the environment into the load area starting at (addr).
+ * Each variable is formatted as <name>=<value>, with a single nul
+ * separating each variable, and a double nul terminating the environment.
+ */
+vm_offset_t
+md_copyenv(vm_offset_t start)
+{
+ struct env_var *ep;
+ vm_offset_t addr, last;
+ size_t len;
+
+ addr = last = start;
+
+ /* Traverse the environment. */
+ for (ep = environ; ep != NULL; ep = ep->ev_next) {
+ len = strlen(ep->ev_name);
+ if ((size_t)archsw.arch_copyin(ep->ev_name, addr, len) != len)
+ break;
+ addr += len;
+ if (archsw.arch_copyin("=", addr, 1) != 1)
+ break;
+ addr++;
+ if (ep->ev_value != NULL) {
+ len = strlen(ep->ev_value);
+ if ((size_t)archsw.arch_copyin(ep->ev_value, addr, len) != len)
+ break;
+ addr += len;
+ }
+ if (archsw.arch_copyin("", addr, 1) != 1)
+ break;
+ last = ++addr;
+ }
+
+ if (archsw.arch_copyin("", last++, 1) != 1)
+ last = start;
+ return(last);
+}
diff --git a/stand/efi/loader/bootinfo.c b/stand/efi/loader/bootinfo.c
--- a/stand/efi/loader/bootinfo.c
+++ b/stand/efi/loader/bootinfo.c
@@ -126,45 +126,6 @@
return (howto);
}
-/*
- * Copy the environment into the load area starting at (addr).
- * Each variable is formatted as <name>=<value>, with a single nul
- * separating each variable, and a double nul terminating the environment.
- */
-static vm_offset_t
-bi_copyenv(vm_offset_t start)
-{
- struct env_var *ep;
- vm_offset_t addr, last;
- size_t len;
-
- addr = last = start;
-
- /* Traverse the environment. */
- for (ep = environ; ep != NULL; ep = ep->ev_next) {
- len = strlen(ep->ev_name);
- if ((size_t)archsw.arch_copyin(ep->ev_name, addr, len) != len)
- break;
- addr += len;
- if (archsw.arch_copyin("=", addr, 1) != 1)
- break;
- addr++;
- if (ep->ev_value != NULL) {
- len = strlen(ep->ev_value);
- if ((size_t)archsw.arch_copyin(ep->ev_value, addr, len) != len)
- break;
- addr += len;
- }
- if (archsw.arch_copyin("", addr, 1) != 1)
- break;
- last = ++addr;
- }
-
- if (archsw.arch_copyin("", last++, 1) != 1)
- last = start;
- return(last);
-}
-
static EFI_STATUS
efi_do_vmap(EFI_MEMORY_DESCRIPTOR *mm, UINTN sz, UINTN mmsz, UINT32 mmver)
{
@@ -408,7 +369,7 @@
/* Copy our environment. */
envp = addr;
- addr = bi_copyenv(addr);
+ addr = md_copyenv(addr);
/* Pad to a page boundary. */
addr = roundup(addr, PAGE_SIZE);
diff --git a/stand/i386/libi386/bootinfo.c b/stand/i386/libi386/bootinfo.c
--- a/stand/i386/libi386/bootinfo.c
+++ b/stand/i386/libi386/bootinfo.c
@@ -103,31 +103,3 @@
boot_howto_to_env(howto);
}
-
-/*
- * Copy the environment into the load area starting at (addr).
- * Each variable is formatted as <name>=<value>, with a single nul
- * separating each variable, and a double nul terminating the environment.
- */
-vm_offset_t
-bi_copyenv(vm_offset_t addr)
-{
- struct env_var *ep;
-
- /* traverse the environment */
- for (ep = environ; ep != NULL; ep = ep->ev_next) {
- archsw.arch_copyin(ep->ev_name, addr, strlen(ep->ev_name));
- addr += strlen(ep->ev_name);
- archsw.arch_copyin("=", addr, 1);
- addr++;
- if (ep->ev_value != NULL) {
- archsw.arch_copyin(ep->ev_value, addr, strlen(ep->ev_value));
- addr += strlen(ep->ev_value);
- }
- archsw.arch_copyin("", addr, 1);
- addr++;
- }
- archsw.arch_copyin("", addr, 1);
- addr++;
- return(addr);
-}
diff --git a/stand/i386/libi386/bootinfo32.c b/stand/i386/libi386/bootinfo32.c
--- a/stand/i386/libi386/bootinfo32.c
+++ b/stand/i386/libi386/bootinfo32.c
@@ -126,7 +126,7 @@
/* copy our environment */
envp = addr;
- addr = bi_copyenv(addr);
+ addr = md_copyenv(addr);
/* pad to a page boundary */
addr = roundup(addr, PAGE_SIZE);
diff --git a/stand/i386/libi386/bootinfo64.c b/stand/i386/libi386/bootinfo64.c
--- a/stand/i386/libi386/bootinfo64.c
+++ b/stand/i386/libi386/bootinfo64.c
@@ -167,7 +167,7 @@
/* copy our environment */
envp = roundup(addr + size, PAGE_SIZE);
- addr = bi_copyenv(envp);
+ addr = md_copyenv(envp);
/* set kernend */
kernend = roundup(addr, PAGE_SIZE);
diff --git a/stand/i386/libi386/libi386.h b/stand/i386/libi386/libi386.h
--- a/stand/i386/libi386/libi386.h
+++ b/stand/i386/libi386/libi386.h
@@ -146,7 +146,6 @@
void bi_load_vbe_data(struct preloaded_file *kfp);
int bi_getboothowto(char *kargs);
void bi_setboothowto(int howto);
-vm_offset_t bi_copyenv(vm_offset_t addr);
int bi_load32(char *args, int *howtop, int *bootdevp, vm_offset_t *bip,
vm_offset_t *modulep, vm_offset_t *kernend);
int bi_load64(char *args, vm_offset_t *modulep,
diff --git a/stand/userboot/userboot/bootinfo.c b/stand/userboot/userboot/bootinfo.c
--- a/stand/userboot/userboot/bootinfo.c
+++ b/stand/userboot/userboot/bootinfo.c
@@ -83,31 +83,3 @@
boot_howto_to_env(howto);
}
-
-/*
- * Copy the environment into the load area starting at (addr).
- * Each variable is formatted as <name>=<value>, with a single nul
- * separating each variable, and a double nul terminating the environment.
- */
-vm_offset_t
-bi_copyenv(vm_offset_t addr)
-{
- struct env_var *ep;
-
- /* traverse the environment */
- for (ep = environ; ep != NULL; ep = ep->ev_next) {
- archsw.arch_copyin(ep->ev_name, addr, strlen(ep->ev_name));
- addr += strlen(ep->ev_name);
- archsw.arch_copyin("=", addr, 1);
- addr++;
- if (ep->ev_value != NULL) {
- archsw.arch_copyin(ep->ev_value, addr, strlen(ep->ev_value));
- addr += strlen(ep->ev_value);
- }
- archsw.arch_copyin("", addr, 1);
- addr++;
- }
- archsw.arch_copyin("", addr, 1);
- addr++;
- return(addr);
-}
diff --git a/stand/userboot/userboot/bootinfo32.c b/stand/userboot/userboot/bootinfo32.c
--- a/stand/userboot/userboot/bootinfo32.c
+++ b/stand/userboot/userboot/bootinfo32.c
@@ -106,7 +106,7 @@
/* copy our environment */
envp = addr;
- addr = bi_copyenv(addr);
+ addr = md_copyenv(addr);
/* pad to a page boundary */
addr = roundup(addr, PAGE_SIZE);
diff --git a/stand/userboot/userboot/bootinfo64.c b/stand/userboot/userboot/bootinfo64.c
--- a/stand/userboot/userboot/bootinfo64.c
+++ b/stand/userboot/userboot/bootinfo64.c
@@ -138,7 +138,7 @@
/* copy our environment */
envp = addr;
- addr = bi_copyenv(addr);
+ addr = md_copyenv(addr);
/* pad to a page boundary */
addr = roundup(addr, PAGE_SIZE);
diff --git a/stand/userboot/userboot/libuserboot.h b/stand/userboot/userboot/libuserboot.h
--- a/stand/userboot/userboot/libuserboot.h
+++ b/stand/userboot/userboot/libuserboot.h
@@ -61,7 +61,6 @@
int bi_getboothowto(char *kargs);
void bi_setboothowto(int howto);
-vm_offset_t bi_copyenv(vm_offset_t addr);
int bi_load32(char *args, int *howtop, int *bootdevp, vm_offset_t *bip,
vm_offset_t *modulep, vm_offset_t *kernend);
int bi_load64(char *args, vm_offset_t *modulep, vm_offset_t *kernend);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 16, 6:57 PM (20 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14663140
Default Alt Text
D36574.diff (8 KB)
Attached To
Mode
D36574: stand: collapse all copies of *copyenv into md_copyenv
Attached
Detach File
Event Timeline
Log In to Comment