Trace32
Trace32 OS awareness
Trace32’s OS awareness means it can recognize all tasks and flows of the operating system.
The process broadly involves MMU setup, TASK config, and MENU reprograming.
Trace32 Linux Awareness
To implement Linux awareness,
proceed sequentially with MMU setup, Task config, and Menu reprogramming.
MMU setup
In B::SYStem , check MMUSPACES or use the command B::SYStem.Option.MMUSPACES ON
to enable the MMUSPACES option.
Use B::y.list to find the text symbol, which is the starting point of the code.
The starting virtual address is 0xFFFF8000800000000 .
Find the end address of the virtual address, which is 0xFFFF800082030000 .
Use the B::MMU.List.PageTable or B::MMU.List.EL1PageTable command to check the MMU VA-to-PA mapping table.
You can also see why there’s a slight difference from the text virtual address (0xFFFF8000800000000).
This is because it’s not the exact starting address.
Use B::sYmbol.List.Section to check the .head.text address.
Now you can confirm the exact starting address.
Match the VA starting address with the PA starting address to set up OS awareness.
To set up MMU translation, find the swapper_pg_dir symbol.
Use the command:
B::MMU.FORMAT LINUXSWAP3 {swapper symbol}
Here, input it as follows:
B::MMU.FORMAT LINUXSWAP3 \\vmlinux\Global\swapper_pg_dir
For translation,
input the symbol’s starting virtual address, ending virtual address, and starting physical address:
B::TRANSlation.Create {symbol start virtual address}—{symbol end virtual address - 1} {symbol start physical address}
Here, input it as follows:
B::TRANSlation.Create 0xFFFF8000000000000—0xFFFF80008202FFFF a:0x1A000D000
Since manually entering these addresses can be difficult,
referencing symbols works just as well:
B::TRANSlation.Create (\\vmlinux\Global\_text)--(\\vmlinux\Global\_end-1) a:0x1A000D000
Next, set the entire virtual address range:
B::TRANSlation.COMMON {virtual address system start address}—{virtual address system end address}
Here, input it as follows:
B::TRANSlation.COMMON 0xFFFF000000000000—0xFFFFFFFFFFFFFFFF
Once the setup is complete, enable translation:
B::TRANSlation.TableWalk ON
B::TRANSlation.ON
The commands can be summarized as follows:
B::MMU.FORMAT LINUXSWAP3 \\vmlinux\Global\swapper_pg_dir
B::TRANSlation.Create (\\vmlinux\Global\_text)--(\\vmlinux\Global\_end-1) A:0x1A000D000
B::TRANSlation.COMMON 0xFFFF000000000000—0xFFFFFFFFFFFFFFFF
B::TRANSlation.TableWalk ON
B::TRANSlation.ON
With this, the MMU setup is complete.
While MMU setup is complex, TASK setup and MENU addition are not as difficult.
Task config
Using B::TASK.CONFIG {task file} to proceed.
Just like when loading an ELF file,
you can either directly specify the file path or use * to select the file manually.
For reference, in the image, the file was written with a relative path.
Using B::cd will display the current path where the program is running.
You can confirm that a new ‘linux’ toolbar has been created.
Using B::MENU.REPROGRAM {menu file} to proceed.
Just like when loading an ELF file,
you can either directly specify the file path or use * to select the file manually.
For reference, in the image, the file was written with a relative path.
Using B::cd will display the current path where the program is running.
Summary
To summarize all the commands for Linux awareness,
B::MMU.FORMAT LINUXSWAP3 \\vmlinux\Global\swapper_pg_dir
B::TRANSlation.create (\\vmlinux\Global\_text)--(\\vmlinux\Global\_end-1) a:0x1A000D000
B::TRANSlation.COMMON 0xFFFF000000000000—0xFFFFFFFFFFFFFFFF
B::TRANSlation.TableWalk ON
B::TRANSlation.ON
B::TASK.CONFIG ~~/demo/arm/kernel/linux/awareness/linux.t32
B::menu.ReProgram ~~/demo/arm/kernel/linux/awareness/linux.men
Now, through the ‘linux’ menu, you can use various powerful awareness features.
You can debug on a task-by-task basis or verify things in the debugging program
that can also be checked on the system.
Like this, you can check the currently running processes,
Like this, you can also check kernel messages.