2c2
< * Copyright (c) 2010 ARM Limited
---
> * Copyright (c) 2010, 2012 ARM Limited
63a64,69
> }
>
> ArmLiveProcess32::ArmLiveProcess32(LiveProcessParams *params,
> ObjectFile *objFile, ObjectFile::Arch _arch)
> : ArmLiveProcess(params, objFile, _arch)
> {
76a83,99
> ArmLiveProcess64::ArmLiveProcess64(LiveProcessParams *params,
> ObjectFile *objFile, ObjectFile::Arch _arch)
> : ArmLiveProcess(params, objFile, _arch)
> {
> stack_base = 0x7fffff0000L;
>
> // Set pointer for next thread stack. Reserve 8M for main stack.
> next_thread_stack_base = stack_base - (8 * 1024 * 1024);
>
> // Set up break point (Top of Heap)
> brk_point = objFile->dataBase() + objFile->dataSize() + objFile->bssSize();
> brk_point = roundUp(brk_point, VMPageSize);
>
> // Set up region for mmaps. For now, start at bottom of kuseg space.
> mmap_start = mmap_end = 0x4000000000L;
> }
>
78c101
< ArmLiveProcess::initState()
---
> ArmLiveProcess32::initState()
81c104
< argsInit(MachineBytes, VMPageSize);
---
> argsInit<uint32_t>(VMPageSize, INTREG_SP);
97c120
< ArmLiveProcess::argsInit(int intSize, int pageSize)
---
> ArmLiveProcess64::initState()
99c122,147
< typedef AuxVector<uint32_t> auxv_t;
---
> LiveProcess::initState();
> argsInit<uint64_t>(VMPageSize, INTREG_SP0);
> for (int i = 0; i < contextIds.size(); i++) {
> ThreadContext * tc = system->getThreadContext(contextIds[i]);
> CPSR cpsr = tc->readMiscReg(MISCREG_CPSR);
> cpsr.mode = MODE_EL0T;
> tc->setMiscReg(MISCREG_CPSR, cpsr);
> CPACR cpacr = tc->readMiscReg(MISCREG_CPACR_EL1);
> // Enable the floating point coprocessors.
> cpacr.cp10 = 0x3;
> cpacr.cp11 = 0x3;
> tc->setMiscReg(MISCREG_CPACR_EL1, cpacr);
> // Generically enable floating point support.
> FPEXC fpexc = tc->readMiscReg(MISCREG_FPEXC);
> fpexc.en = 1;
> tc->setMiscReg(MISCREG_FPEXC, fpexc);
> }
> }
>
> template <class IntType>
> void
> ArmLiveProcess::argsInit(int pageSize, IntRegIndex spIndex)
> {
> int intSize = sizeof(IntType);
>
> typedef AuxVector<IntType> auxv_t;
136c184
< uint32_t features =
---
> IntType features =
256,265c304,313
< uint32_t sentry_base = stack_base - sentry_size;
< uint32_t aux_data_base = sentry_base - aux_data_size;
< uint32_t env_data_base = aux_data_base - env_data_size;
< uint32_t arg_data_base = env_data_base - arg_data_size;
< uint32_t platform_base = arg_data_base - platform_size;
< uint32_t aux_random_base = platform_base - aux_random_size;
< uint32_t auxv_array_base = aux_random_base - aux_array_size - aux_padding;
< uint32_t envp_array_base = auxv_array_base - envp_array_size;
< uint32_t argv_array_base = envp_array_base - argv_array_size;
< uint32_t argc_base = argv_array_base - argc_size;
---
> IntType sentry_base = stack_base - sentry_size;
> IntType aux_data_base = sentry_base - aux_data_size;
> IntType env_data_base = aux_data_base - env_data_size;
> IntType arg_data_base = env_data_base - arg_data_size;
> IntType platform_base = arg_data_base - platform_size;
> IntType aux_random_base = platform_base - aux_random_size;
> IntType auxv_array_base = aux_random_base - aux_array_size - aux_padding;
> IntType envp_array_base = auxv_array_base - envp_array_size;
> IntType argv_array_base = envp_array_base - argv_array_size;
> IntType argc_base = argv_array_base - argc_size;
282,283c330,331
< uint32_t argc = argv.size();
< uint32_t guestArgc = ArmISA::htog(argc);
---
> IntType argc = argv.size();
> IntType guestArgc = ArmISA::htog(argc);
286c334
< uint32_t sentry_NULL = 0;
---
> IntType sentry_NULL = 0;
305,306c353
< for(int x = 0; x < auxv.size(); x++)
< {
---
> for (int x = 0; x < auxv.size(); x++) {
324c371
< tc->setIntReg(StackPointerReg, stack_min);
---
> tc->setIntReg(spIndex, stack_min);
344a392,393
> pc.aarch64(arch == ObjectFile::Arm64);
> pc.nextAArch64(pc.aarch64());
353c402
< ArmLiveProcess::getSyscallArg(ThreadContext *tc, int &i)
---
> ArmLiveProcess32::getSyscallArg(ThreadContext *tc, int &i)
359,360c408,409
< uint64_t
< ArmLiveProcess::getSyscallArg(ThreadContext *tc, int &i, int width)
---
> ArmISA::IntReg
> ArmLiveProcess64::getSyscallArg(ThreadContext *tc, int &i)
361a411,417
> assert(i < 8);
> return tc->readIntReg(ArgumentReg0 + i++);
> }
>
> ArmISA::IntReg
> ArmLiveProcess32::getSyscallArg(ThreadContext *tc, int &i, int width)
> {
377a434,438
> ArmISA::IntReg
> ArmLiveProcess64::getSyscallArg(ThreadContext *tc, int &i, int width)
> {
> return getSyscallArg(tc, i);
> }
378a440
>
380c442,449
< ArmLiveProcess::setSyscallArg(ThreadContext *tc,
---
> ArmLiveProcess32::setSyscallArg(ThreadContext *tc, int i, ArmISA::IntReg val)
> {
> assert(i < 6);
> tc->setIntReg(ArgumentReg0 + i, val);
> }
>
> void
> ArmLiveProcess64::setSyscallArg(ThreadContext *tc,
383c452
< assert(i < 4);
---
> assert(i < 8);
388c457
< ArmLiveProcess::setSyscallReturn(ThreadContext *tc,
---
> ArmLiveProcess32::setSyscallReturn(ThreadContext *tc,
392a462,468
>
> void
> ArmLiveProcess64::setSyscallReturn(ThreadContext *tc,
> SyscallReturn return_value)
> {
> tc->setIntReg(ReturnValueReg, return_value.value());
> }