Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions arch/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ config ARCH_X86_64
select ARCH_HAVE_SETJMP
select ARCH_HAVE_PERF_EVENTS
select ARCH_HAVE_POWEROFF
select ARCH_HAVE_SYSCALL if LIB_SYSCALL
---help---
x86-64 architectures.

Expand Down Expand Up @@ -611,6 +612,12 @@ config ARCH_HAVE_RTC_SUBSECONDS
bool
default n

config ARCH_HAVE_SYSCALL
bool
default n
---help---
Indicates that the architecture provides the system call interface.

config ARCH_HAVE_SYSCALL_HOOKS
bool
default n
Expand Down
10 changes: 10 additions & 0 deletions arch/x86_64/src/common/x86_64_addrenv.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@

#include <nuttx/spinlock.h>

#include <arch/arch.h>

#include "addrenv.h"
#include "pgalloc.h"
#include "x86_64_mmu.h"
Expand Down Expand Up @@ -192,10 +194,18 @@ static int create_spgtables(arch_addrenv_t *addrenv)
static void copy_kernel_mappings(arch_addrenv_t *addrenv)
{
uintptr_t *pdpt = (uintptr_t *)x86_64_pgvaddr(addrenv->spgtables[1]);
int i;

/* Kernel mapping - lower 1GB maps to 4GB-5GB */

pdpt[4] = X86_PDPT_KERNEL_MAP;

/* Inherit the boot identity mapping of the low 4GB. */

for (i = 0; i < X86_MMU_LOWMEM_PDPTS; i++)
{
pdpt[i] = g_pdpt[i];
}
}

/****************************************************************************
Expand Down
4 changes: 4 additions & 0 deletions arch/x86_64/src/common/x86_64_mmu.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@
#define X86_MMU_VADDR_INDEX(vaddr, ptlevel) \
((vaddr >> X86_MMU_VADDR_SHIFT(ptlevel)) & X86_MMU_VPN_MASK)

/* Number of PDPT entries in the boot low-memory identity mapping. */

#define X86_MMU_LOWMEM_PDPTS 4

/****************************************************************************
* Public Function Prototypes
****************************************************************************/
Expand Down
4 changes: 4 additions & 0 deletions arch/x86_64/src/intel64/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ config ARCH_INTEL64_TSC

config ARCH_INTEL64_HPET_ALARM
bool "HPET timer alarm support"
select INTEL64_ONESHOT
select ONESHOT
select ONESHOT_COUNT
select ONESHOT_FAST_DIVISION
select ALARM_ARCH
---help---
With this option you can enable ALARM_ARCH features that works on top of
Expand Down
2 changes: 2 additions & 0 deletions arch/x86_64/src/intel64/intel64_freq.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,12 @@ void x86_64_timer_calibrate_freq(void)
g_x86_64_timer_freq = CONFIG_ARCH_INTEL64_APIC_FREQ_KHZ * 1000ul;
#endif

#ifdef CONFIG_ARCH_INTEL64_HAVE_TSC
if (g_x86_64_timer_freq == 0)
{
/* The TSC frequency is not available */

PANIC();
}
#endif
}
6 changes: 5 additions & 1 deletion arch/x86_64/src/intel64/intel64_oneshot_lower.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,14 @@ static void intel64_timer_start_absolute(struct oneshot_lowerhalf_s *lower,
(struct intel64_oneshot_lowerhalf_s *)lower;
irqstate_t flags = spin_lock_irqsave(&g_oneshotlow_spin);
int ret = intel64_oneshot_current(&priv->oneshot, &current_us);
uint64_t delta_us = expected - current_us;
uint64_t delta_us;

DEBUGASSERT(ret == OK);

/* Use the shortest delay when the deadline has passed. */

delta_us = expected > current_us ? expected - current_us : 0;

ts.tv_sec = delta_us / USEC_PER_SEC;
ts.tv_nsec = delta_us % USEC_PER_SEC * 1000ull;
ret = intel64_oneshot_start(&priv->oneshot, intel64_oneshot_handler,
Expand Down
6 changes: 4 additions & 2 deletions arch/x86_64/src/intel64/intel64_pgalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,17 @@ void up_allocate_pgheap(void **heap_start, size_t *heap_size)
{
DEBUGASSERT(heap_start && heap_size);

/* The page allocator uses physical addresses. */

#ifndef CONFIG_ARCH_PGPOOL_MAPPING
/* pgheap at the end of RAM */

*heap_start = (void *)(X86_64_PGPOOL_BASE + X86_64_LOAD_OFFSET);
*heap_start = (void *)X86_64_PGPOOL_BASE;
*heap_size = (size_t)X86_64_PGPOOL_SIZE;
#else
/* pgheap defined with Kconfig options */

*heap_start = (void *)CONFIG_ARCH_PGPOOL_VBASE;
*heap_start = (void *)CONFIG_ARCH_PGPOOL_PBASE;
*heap_size = (size_t)CONFIG_ARCH_PGPOOL_SIZE;
#endif
}
Loading