[Kernel] Title Update fixup
Co-Authored-By: aerosoul94 <aerosoul94@hotmail.com>
This commit is contained in:
parent
4ea6880532
commit
8153ae0f56
|
@ -120,9 +120,9 @@ const PESection* XexModule::GetPESection(const char* name) {
|
|||
|
||||
uint32_t XexModule::GetProcAddress(uint16_t ordinal) const {
|
||||
// First: Check the xex2 export table.
|
||||
if (xex_security_info()->export_table) {
|
||||
if (*xex_security_info()->export_table) {
|
||||
auto export_table = memory()->TranslateVirtual<const xex2_export_table*>(
|
||||
xex_security_info()->export_table);
|
||||
*xex_security_info()->export_table);
|
||||
|
||||
ordinal -= export_table->base;
|
||||
if (ordinal >= export_table->count) {
|
||||
|
@ -587,7 +587,7 @@ int XexModule::ReadImageBasicCompressed(const void* xex_addr,
|
|||
|
||||
// Calculate the total size of the XEX image from its headers.
|
||||
uint32_t total_size = 0;
|
||||
for (uint32_t i = 0; i < xex_security_info()->page_descriptor_count; i++) {
|
||||
for (uint32_t i = 0; i < *xex_security_info()->page_descriptor_count; i++) {
|
||||
// Byteswap the bitfield manually.
|
||||
xex2_page_descriptor desc;
|
||||
desc.value = xe::byte_swap(xex_security_info()->page_descriptors[i].value);
|
||||
|
@ -891,11 +891,12 @@ bool XexModule::Load(const std::string& name, const std::string& path,
|
|||
|
||||
security_info_.rsa_signature = xex1_sec_info->rsa_signature;
|
||||
security_info_.aes_key = xex1_sec_info->aes_key;
|
||||
security_info_.image_size = xex1_sec_info->image_size;
|
||||
security_info_.image_flags = xex1_sec_info->image_flags;
|
||||
security_info_.export_table = xex1_sec_info->export_table;
|
||||
security_info_.load_address = xex1_sec_info->load_address;
|
||||
security_info_.page_descriptor_count = xex1_sec_info->page_descriptor_count;
|
||||
security_info_.image_size = &xex1_sec_info->image_size;
|
||||
security_info_.image_flags = &xex1_sec_info->image_flags;
|
||||
security_info_.export_table = &xex1_sec_info->export_table;
|
||||
security_info_.load_address = &xex1_sec_info->load_address;
|
||||
security_info_.page_descriptor_count =
|
||||
&xex1_sec_info->page_descriptor_count;
|
||||
security_info_.page_descriptors = xex1_sec_info->page_descriptors;
|
||||
} else if (xex_format_ == kFormatXex2) {
|
||||
const xex2_security_info* xex2_sec_info =
|
||||
|
@ -904,19 +905,18 @@ bool XexModule::Load(const std::string& name, const std::string& path,
|
|||
|
||||
security_info_.rsa_signature = xex2_sec_info->rsa_signature;
|
||||
security_info_.aes_key = xex2_sec_info->aes_key;
|
||||
security_info_.image_size = xex2_sec_info->image_size;
|
||||
security_info_.image_flags = xex2_sec_info->image_flags;
|
||||
security_info_.export_table = xex2_sec_info->export_table;
|
||||
security_info_.load_address = xex2_sec_info->load_address;
|
||||
security_info_.page_descriptor_count = xex2_sec_info->page_descriptor_count;
|
||||
security_info_.image_size = &xex2_sec_info->image_size;
|
||||
security_info_.image_flags = &xex2_sec_info->image_flags;
|
||||
security_info_.export_table = &xex2_sec_info->export_table;
|
||||
security_info_.load_address = &xex2_sec_info->load_address;
|
||||
security_info_.page_descriptor_count =
|
||||
&xex2_sec_info->page_descriptor_count;
|
||||
security_info_.page_descriptors = xex2_sec_info->page_descriptors;
|
||||
}
|
||||
|
||||
auto sec_header = xex_security_info();
|
||||
|
||||
// Try setting our base_address based on XEX_HEADER_IMAGE_BASE_ADDRESS, fall
|
||||
// back to xex_security_info otherwise
|
||||
base_address_ = xex_security_info()->load_address;
|
||||
base_address_ = *xex_security_info()->load_address;
|
||||
xe::be<uint32_t>* base_addr_opt = nullptr;
|
||||
if (GetOptHeader(XEX_HEADER_IMAGE_BASE_ADDRESS, &base_addr_opt))
|
||||
base_address_ = *base_addr_opt;
|
||||
|
@ -971,7 +971,7 @@ bool XexModule::LoadContinue() {
|
|||
high_address_ = 0;
|
||||
|
||||
auto sec_header = xex_security_info();
|
||||
for (uint32_t i = 0, page = 0; i < sec_header->page_descriptor_count; i++) {
|
||||
for (uint32_t i = 0, page = 0; i < *sec_header->page_descriptor_count; i++) {
|
||||
// Byteswap the bitfield manually.
|
||||
xex2_page_descriptor desc;
|
||||
desc.value = xe::byte_swap(sec_header->page_descriptors[i].value);
|
||||
|
@ -1046,7 +1046,7 @@ bool XexModule::LoadContinue() {
|
|||
}
|
||||
|
||||
// Setup memory protection.
|
||||
for (uint32_t i = 0, page = 0; i < sec_header->page_descriptor_count; i++) {
|
||||
for (uint32_t i = 0, page = 0; i < *sec_header->page_descriptor_count; i++) {
|
||||
// Byteswap the bitfield manually.
|
||||
xex2_page_descriptor desc;
|
||||
desc.value = xe::byte_swap(sec_header->page_descriptors[i].value);
|
||||
|
@ -1451,7 +1451,7 @@ bool XexModule::FindSaveRest() {
|
|||
|
||||
auto page_size = base_address_ <= 0x90000000 ? 64 * 1024 : 4 * 1024;
|
||||
auto sec_header = xex_security_info();
|
||||
for (uint32_t i = 0, page = 0; i < sec_header->page_descriptor_count; i++) {
|
||||
for (uint32_t i = 0, page = 0; i < *sec_header->page_descriptor_count; i++) {
|
||||
// Byteswap the bitfield manually.
|
||||
xex2_page_descriptor desc;
|
||||
desc.value = xe::byte_swap(sec_header->page_descriptors[i].value);
|
||||
|
|
|
@ -46,11 +46,11 @@ class XexModule : public xe::cpu::Module {
|
|||
struct SecurityInfoContext {
|
||||
const char* rsa_signature;
|
||||
const char* aes_key;
|
||||
uint32_t image_size;
|
||||
uint32_t image_flags;
|
||||
uint32_t export_table;
|
||||
uint32_t load_address;
|
||||
uint32_t page_descriptor_count;
|
||||
const xe::be<uint32_t>* image_size;
|
||||
const xe::be<uint32_t>* image_flags;
|
||||
const xe::be<uint32_t>* export_table;
|
||||
const xe::be<uint32_t>* load_address;
|
||||
const xe::be<uint32_t>* page_descriptor_count;
|
||||
const xex2_page_descriptor* page_descriptors;
|
||||
};
|
||||
enum XexFormat {
|
||||
|
@ -76,7 +76,7 @@ class XexModule : public xe::cpu::Module {
|
|||
// Calculate the new total size of the XEX image from its headers.
|
||||
auto heap = memory()->LookupHeap(base_address_);
|
||||
uint32_t total_size = 0;
|
||||
for (uint32_t i = 0; i < xex_security_info()->page_descriptor_count; i++) {
|
||||
for (uint32_t i = 0; i < *xex_security_info()->page_descriptor_count; i++) {
|
||||
// Byteswap the bitfield manually.
|
||||
xex2_page_descriptor desc;
|
||||
desc.value =
|
||||
|
|
|
@ -272,7 +272,7 @@ X_STATUS UserModule::LoadXexContinue() {
|
|||
|
||||
ldr_data->dll_base = 0; // GetProcAddress will read this.
|
||||
ldr_data->xex_header_base = guest_xex_header_;
|
||||
ldr_data->full_image_size = security_header->image_size;
|
||||
ldr_data->full_image_size = *security_header->image_size;
|
||||
ldr_data->image_base = this->xex_module()->base_address();
|
||||
ldr_data->entry_point = entry_point_;
|
||||
|
||||
|
@ -453,13 +453,13 @@ void UserModule::Dump() {
|
|||
auto security_info = xex_module()->xex_security_info();
|
||||
sb.AppendFormat("Security Header:\n");
|
||||
sb.AppendFormat(" Image Flags: %.8X\n",
|
||||
(uint32_t)security_info->image_flags);
|
||||
(uint32_t)*security_info->image_flags);
|
||||
sb.AppendFormat(" Load Address: %.8X\n",
|
||||
(uint32_t)security_info->load_address);
|
||||
(uint32_t)*security_info->load_address);
|
||||
sb.AppendFormat(" Image Size: %.8X\n",
|
||||
(uint32_t)security_info->image_size);
|
||||
(uint32_t)*security_info->image_size);
|
||||
sb.AppendFormat(" Export Table: %.8X\n",
|
||||
(uint32_t)security_info->export_table);
|
||||
(uint32_t)*security_info->export_table);
|
||||
|
||||
// Optional headers
|
||||
sb.AppendFormat("Optional Header Count: %d\n",
|
||||
|
@ -703,7 +703,7 @@ void UserModule::Dump() {
|
|||
}
|
||||
|
||||
sb.AppendFormat("Sections:\n");
|
||||
for (uint32_t i = 0, page = 0; i < security_info->page_descriptor_count;
|
||||
for (uint32_t i = 0, page = 0; i < *security_info->page_descriptor_count;
|
||||
i++) {
|
||||
// Manually byteswap the bitfield data.
|
||||
xex2_page_descriptor page_descriptor;
|
||||
|
|
Loading…
Reference in New Issue