2019-09-18 14:56:27 +00:00
|
|
|
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
|
|
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
#ifndef RUNTIME_VM_BSS_RELOCS_H_
|
|
|
|
#define RUNTIME_VM_BSS_RELOCS_H_
|
|
|
|
|
2020-03-24 16:58:25 +00:00
|
|
|
#include "platform/allocation.h"
|
2019-09-18 14:56:27 +00:00
|
|
|
|
|
|
|
namespace dart {
|
|
|
|
class Thread;
|
|
|
|
|
|
|
|
class BSS : public AllStatic {
|
|
|
|
public:
|
2020-05-26 08:47:30 +00:00
|
|
|
// Entries found in both the VM and isolate BSS come first. Each has its own
|
|
|
|
// portion of the BSS segment, so just the indices are shared, not the values
|
|
|
|
// stored at the index.
|
2019-09-18 14:56:27 +00:00
|
|
|
enum class Relocation : intptr_t {
|
2020-05-26 08:47:30 +00:00
|
|
|
InstructionsRelocatedAddress,
|
|
|
|
// End of shared entries.
|
|
|
|
DRT_GetThreadForNativeCallback,
|
|
|
|
// End of isolate-only entries.
|
2019-09-18 14:56:27 +00:00
|
|
|
};
|
|
|
|
|
2020-05-26 08:47:30 +00:00
|
|
|
static constexpr intptr_t kVmEntryCount =
|
|
|
|
static_cast<intptr_t>(Relocation::InstructionsRelocatedAddress) + 1;
|
|
|
|
|
|
|
|
static constexpr intptr_t kIsolateEntryCount =
|
|
|
|
static_cast<intptr_t>(Relocation::DRT_GetThreadForNativeCallback) + 1;
|
|
|
|
|
|
|
|
static constexpr intptr_t RelocationIndex(Relocation reloc) {
|
2019-09-18 14:56:27 +00:00
|
|
|
return static_cast<intptr_t>(reloc);
|
|
|
|
}
|
|
|
|
|
2020-05-26 08:47:30 +00:00
|
|
|
static void Initialize(Thread* current, uword* bss, bool vm);
|
|
|
|
|
|
|
|
// Currently only used externally by LoadedElf::ResolveSymbols() to set the
|
|
|
|
// relocated address without changing the embedder interface.
|
|
|
|
static void InitializeBSSEntry(BSS::Relocation relocation,
|
|
|
|
uword new_value,
|
|
|
|
uword* bss_start);
|
2019-09-18 14:56:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dart
|
|
|
|
|
|
|
|
#endif // RUNTIME_VM_BSS_RELOCS_H_
|