Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107878860
D33427.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
5 KB
Referenced Files
None
Subscribers
None
D33427.diff
View Options
diff --git a/stand/common/bootstrap.h b/stand/common/bootstrap.h
--- a/stand/common/bootstrap.h
+++ b/stand/common/bootstrap.h
@@ -232,6 +232,9 @@
#ifdef __amd64__
bool f_kernphys_relocatable;
#endif
+#if defined(__i386__)
+ bool f_tg_kernel_support;
+#endif
};
struct file_format
diff --git a/stand/common/gfx_fb.h b/stand/common/gfx_fb.h
--- a/stand/common/gfx_fb.h
+++ b/stand/common/gfx_fb.h
@@ -219,7 +219,6 @@
uint32_t *tg_shadow_fb; /* units of 4 bytes */
teken_funcs_t *tg_functions;
void *tg_private;
- bool tg_kernel_supported; /* Loaded kernel is supported */
} teken_gfx_t;
extern font_list_t fonts;
diff --git a/stand/common/load_elf.c b/stand/common/load_elf.c
--- a/stand/common/load_elf.c
+++ b/stand/common/load_elf.c
@@ -39,7 +39,6 @@
#include <stand.h>
#define FREEBSD_ELF
#include <sys/link_elf.h>
-#include <gfx_fb.h>
#include "bootstrap.h"
@@ -91,8 +90,6 @@
Elf_Addr p, void *val, size_t len);
static int __elfN(parse_modmetadata)(struct preloaded_file *mp, elf_file_t ef,
Elf_Addr p_start, Elf_Addr p_end);
-static bool __elfN(parse_vt_drv_set)(struct preloaded_file *mp, elf_file_t ef,
- Elf_Addr p_start, Elf_Addr p_end);
static symaddr_fn __elfN(symaddr);
static char *fake_modname(const char *name);
@@ -219,6 +216,43 @@
}
#endif
+#ifdef __i386__
+static bool
+is_tg_kernel_support(struct preloaded_file *fp, elf_file_t ef)
+{
+ Elf_Sym sym;
+ Elf_Addr p_start, p_end, v, p;
+ char vd_name[16];
+ int error;
+
+ if (__elfN(lookup_symbol)(ef, "__start_set_vt_drv_set", &sym, STT_NOTYPE) != 0)
+ return (false);
+ p_start = sym.st_value + ef->off;
+ if (__elfN(lookup_symbol)(ef, "__stop_set_vt_drv_set", &sym, STT_NOTYPE) != 0)
+ return (false);
+ p_end = sym.st_value + ef->off;
+
+ /*
+ * Walk through vt_drv_set, each vt driver structure starts with
+ * static 16 chars for driver name. If we have "vbefb", return true.
+ */
+ for (p = p_start; p < p_end; p += sizeof(Elf_Addr)) {
+ COPYOUT(p, &v, sizeof(v));
+
+ error = __elfN(reloc_ptr)(fp, ef, p, &v, sizeof(v));
+ if (error == EOPNOTSUPP)
+ v += ef->off;
+ else if (error != 0)
+ return (false);
+ COPYOUT(v, &vd_name, sizeof(vd_name));
+ if (strncmp(vd_name, "vbefb", sizeof(vd_name)) == 0)
+ return (true);
+ }
+
+ return (false);
+}
+#endif
+
static int
__elfN(load_elf_header)(char *filename, elf_file_t ef)
{
@@ -448,6 +482,9 @@
err = 0;
#ifdef __amd64__
fp->f_kernphys_relocatable = multiboot || is_kernphys_relocatable(&ef);
+#endif
+#ifdef __i386__
+ fp->f_tg_kernel_support = is_tg_kernel_support(fp, &ef);
#endif
goto out;
@@ -872,18 +909,6 @@
ef->buckets = ef->hashtab + 2;
ef->chains = ef->buckets + ef->nbuckets;
- if (!gfx_state.tg_kernel_supported &&
- __elfN(lookup_symbol)(ef, "__start_set_vt_drv_set", &sym,
- STT_NOTYPE) == 0) {
- p_start = sym.st_value + ef->off;
- if (__elfN(lookup_symbol)(ef, "__stop_set_vt_drv_set", &sym,
- STT_NOTYPE) == 0) {
- p_end = sym.st_value + ef->off;
- gfx_state.tg_kernel_supported =
- __elfN(parse_vt_drv_set)(fp, ef, p_start, p_end);
- }
- }
-
if (__elfN(lookup_symbol)(ef, "__start_set_modmetadata_set", &sym,
STT_NOTYPE) != 0)
return 0;
@@ -1084,36 +1109,6 @@
return (err);
}
-/*
- * Walk through vt_drv_set, each vt driver structure starts with
- * static 16 chars for driver name. If we have "vbefb", return true.
- */
-static bool
-__elfN(parse_vt_drv_set)(struct preloaded_file *fp, elf_file_t ef,
- Elf_Addr p_start, Elf_Addr p_end)
-{
- Elf_Addr v, p;
- char vd_name[16];
- int error;
-
- p = p_start;
- while (p < p_end) {
- COPYOUT(p, &v, sizeof(v));
-
- error = __elfN(reloc_ptr)(fp, ef, p, &v, sizeof(v));
- if (error == EOPNOTSUPP)
- v += ef->off;
- else if (error != 0)
- return (false);
- COPYOUT(v, &vd_name, sizeof(vd_name));
- if (strncmp(vd_name, "vbefb", sizeof(vd_name)) == 0)
- return (true);
- p += sizeof(Elf_Addr);
- }
-
- return (false);
-}
-
int
__elfN(parse_modmetadata)(struct preloaded_file *fp, elf_file_t ef,
Elf_Addr p_start, Elf_Addr p_end)
diff --git a/stand/common/module.c b/stand/common/module.c
--- a/stand/common/module.c
+++ b/stand/common/module.c
@@ -278,8 +278,6 @@
}
loadaddr = 0;
unsetenv("kernelname");
- /* Reset tg_kernel_supported to allow next load to check it again. */
- gfx_state.tg_kernel_supported = false;
}
COMMAND_SET(unload, "unload", "unload all modules", command_unload);
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
@@ -41,7 +41,7 @@
void
bi_load_vbe_data(struct preloaded_file *kfp)
{
- if (!gfx_state.tg_kernel_supported) {
+ if (!kfp->f_tg_kernel_support) {
/*
* Loaded kernel does not have vt/vbe backend,
* switch console to text mode.
diff --git a/stand/loader.mk b/stand/loader.mk
--- a/stand/loader.mk
+++ b/stand/loader.mk
@@ -29,9 +29,6 @@
SRCS+= load_elf64.c reloc_elf64.c
SRCS+= metadata.c
.endif
-# elf loaders set frame buffer things, so add includes for that.
-CFLAGS.load_elf32.c += -I$(SRCTOP)/sys/teken -I${SRCTOP}/contrib/pnglite
-CFLAGS.load_elf64.c += -I$(SRCTOP)/sys/teken -I${SRCTOP}/contrib/pnglite
.if ${LOADER_DISK_SUPPORT:Uyes} == "yes"
CFLAGS.part.c+= -DHAVE_MEMCPY -I${SRCTOP}/sys/contrib/zlib
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Jan 19, 10:58 PM (20 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15964804
Default Alt Text
D33427.diff (5 KB)
Attached To
Mode
D33427: loader: narrow the scope of gfx frame buffer wrt tg supported kernels
Attached
Detach File
Event Timeline
Log In to Comment