FreeBSD Bugzilla – Attachment 197705 Details for
Bug 231873
Early usages of bzeor/memset/&c broke when switching to ifunc
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Initial patch
file_231873.txt (text/plain), 3.17 KB, created by
Roger Pau Monné
on 2018-10-02 08:28:34 UTC
(
hide
)
Description:
Initial patch
Filename:
MIME Type:
Creator:
Roger Pau Monné
Created:
2018-10-02 08:28:34 UTC
Size:
3.17 KB
patch
obsolete
>diff --git a/sys/amd64/amd64/support.S b/sys/amd64/amd64/support.S >index 6fdb71cb9207..1e675443d96f 100644 >--- a/sys/amd64/amd64/support.S >+++ b/sys/amd64/amd64/support.S >@@ -200,6 +200,7 @@ END(memcmp) > * Adapted from bcopy written by: > * ws@tools.de (Wolfgang Solfrank, TooLs GmbH) +49-228-985800 > */ >+ENTRY(memmove_early) > ENTRY(memmove_std) > PUSH_FRAME_POINTER > movq %rdi,%rax >@@ -249,6 +250,7 @@ ENTRY(memmove_std) > POP_FRAME_POINTER > ret > END(memmove_std) >+END(memmove_early) > > ENTRY(memmove_erms) > PUSH_FRAME_POINTER >@@ -284,6 +286,7 @@ END(memmove_erms) > * > * Note: memcpy does not support overlapping copies > */ >+ENTRY(memcpy_early) > ENTRY(memcpy_std) > PUSH_FRAME_POINTER > movq %rdi,%rax >@@ -305,6 +308,7 @@ ENTRY(memcpy_std) > POP_FRAME_POINTER > ret > END(memcpy_std) >+END(memcpy_early) > > ENTRY(memcpy_erms) > PUSH_FRAME_POINTER >@@ -320,6 +324,7 @@ END(memcpy_erms) > * memset(dst, c, len) > * rdi, rsi, rdx > */ >+ENTRY(memset_early) > ENTRY(memset_std) > PUSH_FRAME_POINTER > movq %rdi,%r9 >@@ -346,6 +351,7 @@ ENTRY(memset_std) > POP_FRAME_POINTER > ret > END(memset_std) >+END(memset_early) > > ENTRY(memset_erms) > PUSH_FRAME_POINTER >diff --git a/sys/sys/systm.h b/sys/sys/systm.h >index ab8a925715d0..f9cc175df940 100644 >--- a/sys/sys/systm.h >+++ b/sys/sys/systm.h >@@ -324,6 +324,10 @@ void *memmove(void * _Nonnull dest, const void * _Nonnull src, size_t n); > int memcmp(const void *b1, const void *b2, size_t len); > #define memcmp(b1, b2, len) __builtin_memcmp((b1), (b2), (len)) > >+void *memset_early(void * _Nonnull buf, int c, size_t len); >+void *memcpy_early(void * _Nonnull to, const void * _Nonnull from, size_t len); >+void *memmove_early(void * _Nonnull dest, const void * _Nonnull src, size_t n); >+ > int copystr(const void * _Nonnull __restrict kfaddr, > void * _Nonnull __restrict kdaddr, size_t len, > size_t * __restrict lencopied); >diff --git a/sys/x86/x86/ucode.c b/sys/x86/x86/ucode.c >index 50a5cbe4462b..7f97ff4a3302 100644 >--- a/sys/x86/x86/ucode.c >+++ b/sys/x86/x86/ucode.c >@@ -355,8 +355,7 @@ ucode_load_bsp(uintptr_t free) > if (match != NULL) { > addr = map_ucode(free, len); > /* We can't use memcpy() before ifunc resolution. */ >- for (i = 0; i < len; i++) >- addr[i] = ((volatile uint8_t *)match)[i]; >+ memcpy_early(addr, match, len); > match = addr; > > error = ucode_loader->load(match, false, &nrev, &orev); >diff --git a/sys/x86/xen/pv.c b/sys/x86/xen/pv.c >index 4505907172c0..5cffcd9f116a 100644 >--- a/sys/x86/xen/pv.c >+++ b/sys/x86/xen/pv.c >@@ -259,7 +259,7 @@ hammer_time_xen_legacy(start_info_t *si, uint64_t xenstack) > */ > kenv = (void *)(physfree + KERNBASE); > physfree += PAGE_SIZE; >- bzero(kenv, PAGE_SIZE); >+ memset_early(kenv, 0, PAGE_SIZE); > init_static_kenv(kenv, PAGE_SIZE); > > /* Set the hooks for early functions that diverge from bare metal */ >@@ -320,7 +320,7 @@ hammer_time_xen(vm_paddr_t start_info_paddr) > */ > kenv = (void *)(physfree + KERNBASE); > physfree += PAGE_SIZE; >- bzero(kenv, PAGE_SIZE); >+ memset_early(kenv, 0, PAGE_SIZE); > init_static_kenv(kenv, PAGE_SIZE); > > if (start_info->modlist_paddr != 0) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 231873
: 197705