vxBoot - 1.2.5 : Patch NULL translation in the UTLB

@update
<> CMakelist.txt :
   | dump project version
<> builtin/hw :
   | allow the argument "patch" which will invalidate the UTLB page that
   | redirect the NULL

@add
<> hardware/get_info
   | add the hardware_utlb_patch() which invalidate the UTLB "NULL" page

@fix
<> loader/entry
   | GOT log text
   | force patch the UTLB to invalidate the "NULL" page
master
Yann MAGNIN 4 months ago
parent 41d8b2a505
commit 81bf1a43f2
  1. 2
      CMakeLists.txt
  2. 2
      include/vxBoot/hardware.h
  3. 14
      src/builtin/hw.c
  4. 18
      src/hardware/get_info.c
  5. 5
      src/loader/entry.c

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.15)
project(vxBoot VERSION 1.2.4 LANGUAGES C)
project(vxBoot VERSION 1.2.5 LANGUAGES C)
include(GenerateG1A)
include(GenerateG3A)

@ -24,5 +24,7 @@ struct hwinfo {
/* hardware_get_info() : get hardware information */
extern int hardware_get_info(struct hwinfo * const hwinfo);
/* hardware_utlb_patch() : patch the UTLB NULL page set by Casio */
extern void hardware_utlb_patch(void);
#endif /*__VXBOOT_HARDWARE_H__*/

@ -2,6 +2,7 @@
#include "vxBoot/terminal.h"
#include "vxBoot/hardware.h"
#include <string.h>
/* hw_main() : hw builtin entry */
int hw_main(int argc, char **argv)
@ -12,6 +13,19 @@ int hw_main(int argc, char **argv)
(void)argc;
(void)argv;
#ifdef FXCG50
if (argc >= 1) {
if (strcmp(argv[1], "patch") == 0) {
terminal_write("try to invalidate the NULL page...");
hardware_utlb_patch();
terminal_write("OK\n");
return (0);
}
terminal_write("invalide argument\n");
return (84);
}
#endif
hardware_get_info(&hwinfo);
terminal_write(
"- user RAM physical addr: %p\n"

@ -37,3 +37,21 @@ int hardware_get_info(struct hwinfo * const hwinfo)
hwinfo->ram.available -= hwinfo->ram.physical.kernel_addr & 0x00ffffff;
return (0);
}
/* hardware_utlb_patch() : patch the UTLB NULL page set by Casio */
void hardware_utlb_patch(void)
{
for (int i = 0; i < 64; ++i) {
utlb_addr_t *addr = (void*)utlb_addr(i);
utlb_data_t *data = (void*)utlb_data(i);
if(!addr->V || !data->V) continue;
uintptr_t vaddr = addr->VPN << 10;
if (vaddr == 0x00000000) {
addr->V = 0;
data->V = 0;
return;
}
}
}

@ -61,9 +61,12 @@ int loader(struct smemfs_inode const * restrict const inode, int mode)
terminal_write("> relocalize symbols...\n");
loader_rela_patch(&kernel);
terminal_write("> path the GOT table...\n");
terminal_write("> patch the GOT table...\n");
loader_got_patch(&kernel);
terminal_write("> patch the UTLB...\n");
hardware_utlb_patch();
terminal_write("%s successfully loaded !\n", inode->name);
if (mode == LOADER_DUMP || mode == LOADER_CHECK) {
terminal_write(

Loading…
Cancel
Save