Executing a bunch of instructions!

Very hacky module startup code, but can now start XEXs! Time to start
implementing kernel stuff.
This commit is contained in:
Ben Vanik
2013-01-27 22:14:24 -08:00
parent 92a3e19cd9
commit 46d5a0b51d
10 changed files with 57 additions and 46 deletions

View File

@@ -13,6 +13,7 @@
using namespace xe;
using namespace xe::cpu;
using namespace xe::kernel;
@@ -131,13 +132,11 @@ XECLEANUP:
}
void Runtime::LaunchModule(UserModule* user_module) {
//const xe_xex2_header_t *xex_header = xe_module_get_xex_header(module);
const xe_xex2_header_t *xex_header = user_module->xex_header();
// TODO(benvanik): set as main module/etc
// xekXexExecutableModuleHandle = xe_module_get_handle(module);
// XEEXPECTTRUE(XECPUPrepareModule(XEGetCPU(), module->xex, module->pe, module->address_space, module->address_space_size));
// Setup the heap (and TLS?).
// xex_header->exe_heap_size;
@@ -149,6 +148,19 @@ void Runtime::LaunchModule(UserModule* user_module) {
// Wait until thread completes.
// XLARGE_INTEGER timeout = XINFINITE;
// xekNtWaitForSingleObjectEx(thread_handle, TRUE, &timeout);
// Simulate a thread.
uint32_t stack_size = xex_header->exe_stack_size;
if (stack_size < 16 * 1024 * 1024) {
stack_size = 16 * 1024 * 1024;
}
ThreadState* thread_state = processor_->AllocThread(
0x80000000, stack_size);
// Execute test.
processor_->Execute(thread_state, xex_header->exe_entry_point);
processor_->DeallocThread(thread_state);
}
UserModule* Runtime::GetModule(const xechar_t* path) {