aboutsummaryrefslogtreecommitdiff
path: root/i386/i386at/model_dep.c
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2024-02-05 23:22:00 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2024-02-05 23:22:00 +0100
commit429762dca4d313140067d14e1c448ee68d1644d2 (patch)
treeb91e1abc297e58440894855007f80023b8f385ef /i386/i386at/model_dep.c
parente211bdce3388a3c9e3dafab903dd53374f6d9759 (diff)
downloadgnumach-429762dca4d313140067d14e1c448ee68d1644d2.tar.gz
gnumach-429762dca4d313140067d14e1c448ee68d1644d2.tar.bz2
gnumach-429762dca4d313140067d14e1c448ee68d1644d2.zip
apboot: avoid self-modifying code
self-modifying code is generally frowned upon, Intel largely says the support is model-dependent. We can as well just relocate from the C code like we did for the temporary gdt.
Diffstat (limited to 'i386/i386at/model_dep.c')
-rw-r--r--i386/i386at/model_dep.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/i386/i386at/model_dep.c b/i386/i386at/model_dep.c
index e0995c96..173b99f5 100644
--- a/i386/i386at/model_dep.c
+++ b/i386/i386at/model_dep.c
@@ -129,6 +129,9 @@ extern char version[];
/* Realmode temporary GDT */
extern struct pseudo_descriptor gdt_descr_tmp;
+/* Realmode relocated jmp */
+extern uint32_t apboot_jmp_offset;
+
/* If set, reboot the system on ctrl-alt-delete. */
boolean_t rebootflag = FALSE; /* exported to kdintr */
@@ -221,9 +224,11 @@ void machine_init(void)
assert (apboot_addr < 0x100000);
/*
- * Patch the realmode gdt with the correct offset
+ * Patch the realmode gdt with the correct offset and the first jmp to
+ * protected mode with the correct target.
*/
gdt_descr_tmp.linear_base += apboot_addr;
+ apboot_jmp_offset += apboot_addr;
#endif
}