Clean code to match nxstyle requirements
Signed-off-by: Brennan Ashton <bashton@brennanashton.com>
This commit is contained in:
parent
2405901bf2
commit
aea90e7cf0
@ -231,7 +231,7 @@
|
||||
# define IOAPIC_REG_ID 0x00 /* Register index: ID */
|
||||
# define IOAPIC_REG_VER 0x01 /* Register index: version */
|
||||
# define IOAPIC_REG_TABLE 0x10 /* Redirection table base */
|
||||
# define IOAPIC_PIN_DISABLE (1 << 16) /* Disable */
|
||||
# define IOAPIC_PIN_DISABLE (1 << 16) /* Disable */
|
||||
|
||||
/* PIC related Definitions */
|
||||
|
||||
@ -257,8 +257,9 @@
|
||||
/* IDT data structures ******************************************************
|
||||
*
|
||||
* The Interrupt Descriptor Table (IDT) is a data structure used by the x86
|
||||
* architecture to implement an interrupt vector table. The IDT is used by the
|
||||
* processor to determine the correct response to interrupts and exceptions.
|
||||
* architecture to implement an interrupt vector table. The IDT is used by
|
||||
* the processor to determine the correct response to interrupts and
|
||||
* exceptions.
|
||||
*/
|
||||
|
||||
begin_packed_struct struct idt_entry_s
|
||||
@ -286,7 +287,8 @@ begin_packed_struct struct idt_ptr_s
|
||||
*
|
||||
* The Global Descriptor Table (GDT) is a data structure used by the x86
|
||||
* architecture to implement segments and privilege levels. The GDT is used
|
||||
* by the processor to determine current privilege level and memory access right.
|
||||
* by the processor to determine current privilege level and memory access
|
||||
* right.
|
||||
*/
|
||||
|
||||
begin_packed_struct struct gdt_entry_s
|
||||
@ -321,8 +323,8 @@ begin_packed_struct struct gdt_ptr_s
|
||||
/* IST data structures ******************************************************
|
||||
*
|
||||
* The Interrupt Stack Table (GDT) is a data structure used by the x86-64
|
||||
* architecture to automatically switch stack on interrupt and privilege change.
|
||||
* It allows setting up to 7 different stack for interrupts.
|
||||
* architecture to automatically switch stack on interrupt and privilege
|
||||
* change. It allows setting up to 7 different stack for interrupts.
|
||||
*/
|
||||
|
||||
begin_packed_struct struct ist_s
|
||||
@ -342,7 +344,7 @@ begin_packed_struct struct ist_s
|
||||
uint64_t reserved3; /* reserved */
|
||||
uint64_t reserved4; /* reserved */
|
||||
uint16_t reserved5; /* reserved */
|
||||
uint16_t IOPB_offset; /* IOPB_offset */
|
||||
uint16_t IOPB_OFFSET; /* IOPB_offset */
|
||||
} end_packed_struct;
|
||||
|
||||
/****************************************************************************
|
||||
@ -560,7 +562,9 @@ extern volatile uint8_t gdt64_low;
|
||||
extern volatile uint8_t gdt64_ist_low;
|
||||
extern volatile uint8_t gdt64_low_end;
|
||||
|
||||
/* The actual address of the page table and gdt/ist after mapping the kernel in high address*/
|
||||
/* The actual address of the page table and gdt/ist after mapping the kernel
|
||||
* in high address
|
||||
*/
|
||||
|
||||
extern volatile uint64_t *pdpt;
|
||||
extern volatile uint64_t *pd;
|
||||
|
@ -136,8 +136,14 @@ uint64_t *isr_handler(uint64_t *regs, uint64_t irq)
|
||||
{
|
||||
#ifdef CONFIG_SUPPRESS_INTERRUPTS
|
||||
board_autoled_on(LED_INIRQ);
|
||||
PANIC(); /* Doesn't return */
|
||||
return regs; /* To keep the compiler happy */
|
||||
|
||||
/* Doesn't return */
|
||||
|
||||
PANIC();
|
||||
|
||||
/* To keep the compiler happy */
|
||||
|
||||
return regs;
|
||||
#else
|
||||
|
||||
DEBUGASSERT(g_current_regs == NULL);
|
||||
@ -191,8 +197,14 @@ uint64_t *irq_handler(uint64_t *regs, uint64_t irq_no)
|
||||
{
|
||||
#ifdef CONFIG_SUPPRESS_INTERRUPTS
|
||||
board_autoled_on(LED_INIRQ);
|
||||
PANIC(); /* Doesn't return */
|
||||
return regs; /* To keep the compiler happy */
|
||||
|
||||
/* Doesn't return */
|
||||
|
||||
PANIC();
|
||||
|
||||
/* To keep the compiler happy */
|
||||
|
||||
return regs;
|
||||
#else
|
||||
uint64_t *ret;
|
||||
int irq;
|
||||
|
@ -41,7 +41,9 @@
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/* The actual address of the page table and gdt/ist after mapping the kernel in high address*/
|
||||
/* The actual address of the page table and gdt/ist after mapping the kernel
|
||||
* in high address.
|
||||
*/
|
||||
|
||||
volatile uint64_t *pdpt;
|
||||
volatile uint64_t *pd;
|
||||
@ -69,11 +71,11 @@ volatile struct gdt_entry_s *gdt64;
|
||||
|
||||
void up_lowsetup(void)
|
||||
{
|
||||
/* we should be in long mode at this point*/
|
||||
/* we should be in long mode at this point */
|
||||
|
||||
/* GDT is loaded with 64bit GDT */
|
||||
|
||||
/* Paging is enabled*/
|
||||
/* Paging is enabled */
|
||||
|
||||
/* Setup pointers for accessing Page table and GDT in high address */
|
||||
|
||||
|
@ -70,7 +70,7 @@ static const struct file_operations g_rngops =
|
||||
{
|
||||
0, /* open */
|
||||
0, /* close */
|
||||
x86_rngread, /* read */
|
||||
x86_rngread, /* read */
|
||||
0, /* write */
|
||||
0, /* seek */
|
||||
0 /* ioctl */
|
||||
|
@ -176,8 +176,9 @@ static void up_ist_init(void)
|
||||
memset(&tss_l, 0, sizeof(tss_l));
|
||||
memset(&tss_h, 0, sizeof(tss_h));
|
||||
|
||||
tss_l.limit_low = (((104 - 1) & 0xffff)); /* Segment limit = TSS size - 1 */
|
||||
tss_l.base_low = ((uintptr_t)ist64 & 0x00ffffff); /* Low address 1 */
|
||||
tss_l.limit_low = (((104 - 1) & 0xffff)); /* Segment limit = TSS size - 1 */
|
||||
|
||||
tss_l.base_low = ((uintptr_t)ist64 & 0x00ffffff); /* Low address 1 */
|
||||
tss_l.base_high = (((uintptr_t)ist64 & 0xff000000) >> 24); /* Low address 2 */
|
||||
|
||||
tss_l.P = 1;
|
||||
@ -193,7 +194,8 @@ static void up_ist_init(void)
|
||||
|
||||
/* memcpy used to handle type punning compiler warning */
|
||||
|
||||
memcpy((void *)&gdt64[X86_GDT_ISTH_SEL_NUM], (void *)&tss_h, sizeof(gdt64[0]));
|
||||
memcpy((void *)&gdt64[X86_GDT_ISTH_SEL_NUM],
|
||||
(void *)&tss_h, sizeof(gdt64[0]));
|
||||
|
||||
ist64->IST1 = (uintptr_t)g_interrupt_stack_end;
|
||||
ist64->IST2 = (uintptr_t)g_isr_stack_end;
|
||||
@ -317,7 +319,8 @@ static void up_apic_init(void)
|
||||
* Name: legacy_pic_irq_handler
|
||||
*
|
||||
* Description:
|
||||
* This function will capture will legacy 8259 PIC IRQ using virtual wire mode
|
||||
* This function will capture will legacy 8259 PIC IRQ using virtual wire
|
||||
* mode
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@ -375,8 +378,8 @@ static void up_idtentry(unsigned int index, uint64_t base, uint16_t sel,
|
||||
entry->sel = sel;
|
||||
entry->zero = 0;
|
||||
|
||||
/* We must uncomment the OR below when we get to using user-mode. It sets the
|
||||
* interrupt gate's privilege level to 3.
|
||||
/* We must uncomment the OR below when we get to using user-mode. It sets
|
||||
* the interrupt gate's privilege level to 3.
|
||||
*/
|
||||
|
||||
entry->flags = flags; /* | 0x60 */
|
||||
|
@ -74,7 +74,6 @@ void print_mem(void *sp, size_t size)
|
||||
void backtrace(uint64_t rbp)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
|
||||
_alert("Frame Dump (64 bytes):\n");
|
||||
|
||||
@ -101,12 +100,8 @@ void backtrace(uint64_t rbp)
|
||||
|
||||
void up_registerdump(uint64_t *regs)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
uint64_t mxcsr;
|
||||
uint64_t cr2;
|
||||
uint64_t rbp;
|
||||
char buf[9];
|
||||
|
||||
asm volatile ("stmxcsr %0"::"m"(mxcsr):"memory");
|
||||
asm volatile ("mov %%cr2, %%rax; mov %%rax, %0"::"m"(cr2):"memory", "rax");
|
||||
@ -138,11 +133,12 @@ void up_registerdump(uint64_t *regs)
|
||||
|
||||
if (regs[REG_RSP] > 0 && regs[REG_RSP] < 0x1000000)
|
||||
{
|
||||
print_mem(regs[REG_RSP] - 512, 128 * 0x200000 - regs[REG_RSP] + 512);
|
||||
print_mem((void *)regs[REG_RSP] - 512,
|
||||
128 * 0x200000 - regs[REG_RSP] + 512);
|
||||
}
|
||||
else
|
||||
{
|
||||
print_mem(regs[REG_RSP] - 512, 1024);
|
||||
print_mem((void *)regs[REG_RSP] - 512, 1024);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_DEBUG_NOOPT
|
||||
|
@ -79,9 +79,6 @@
|
||||
|
||||
void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype)
|
||||
{
|
||||
struct vma_s *ptr;
|
||||
int i;
|
||||
|
||||
/* Is there a stack allocated? */
|
||||
|
||||
if (dtcb->stack_alloc_ptr)
|
||||
|
Loading…
Reference in New Issue
Block a user