mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-22 19:44:24 +08:00
[bsp][x86] update x86 with Kconfig and newlib toolchains.
This commit is contained in:
@@ -1,11 +1,7 @@
|
||||
/*
|
||||
* File : __udivsi3.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006, RT-Thread Develop Team
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://openlab.rt-thread.com/license/LICENSE
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
/*
|
||||
* File : __umodsi3.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006, RT-Thread Develop Team
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://openlab.rt-thread.com/license/LICENSE
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
/*
|
||||
* File : backtrace.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006, 2008 RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://openlab.rt-thread.com/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2008-07-29 Bernard first version
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
|
||||
void rt_hw_backtrace(rt_uint32_t *fp, rt_uint32_t thread_entry)
|
||||
{
|
||||
/* no implementation */
|
||||
}
|
||||
@@ -1,11 +1,7 @@
|
||||
/*
|
||||
* File : context_gcc.S
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
@@ -83,31 +79,3 @@ rt_hw_context_switch_to:
|
||||
pop %ds
|
||||
add $4, %esp /* skip irqno */
|
||||
iret
|
||||
|
||||
/*
|
||||
* void rt_hw_context_switch_interrupt(rt_uint32 from, rt_uint32 to);
|
||||
*/
|
||||
.globl rt_thread_switch_interrupt_flag
|
||||
.globl rt_interrupt_from_thread
|
||||
.globl rt_interrupt_to_thread
|
||||
.globl rt_hw_context_switch_interrupt
|
||||
rt_hw_context_switch_interrupt:
|
||||
pushl %ebp
|
||||
movl %esp, %ebp
|
||||
movl 0xc(%ebp), %eax
|
||||
movl 0x8(%ebp), %ebx
|
||||
|
||||
movl $rt_thread_switch_interrupt_flag, %ecx
|
||||
movl (%ecx), %edx
|
||||
cmp $0x1, %edx
|
||||
jz _reswitch
|
||||
|
||||
movl $0x1, %edx /*set rt_thread_switch_interrupt_flag to 1*/
|
||||
movl %edx, (%ecx)
|
||||
movl $rt_interrupt_from_thread, %edx /*set rt_interrupt_from_thread*/
|
||||
movl %ebx, (%edx)
|
||||
_reswitch:
|
||||
movl $rt_interrupt_to_thread, %edx /*set rt_interrupt_to_thread*/
|
||||
movl %eax, (%edx)
|
||||
leave
|
||||
ret
|
||||
|
||||
@@ -1,24 +1,43 @@
|
||||
/*
|
||||
* File : stack.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://openlab.rt-thread.com/license/LICENSE
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2021/02/19 Bernard Implement rt_hw_context_switch_interrupt in C
|
||||
*/
|
||||
|
||||
#include <rthw.h>
|
||||
#include <rtthread.h>
|
||||
|
||||
#include <i386.h>
|
||||
volatile rt_ubase_t rt_interrupt_from_thread = 0;
|
||||
volatile rt_ubase_t rt_interrupt_to_thread = 0;
|
||||
volatile rt_uint32_t rt_thread_switch_interrupt_flag = 0;
|
||||
|
||||
/**
|
||||
* @addtogroup I386
|
||||
*/
|
||||
/*@{*/
|
||||
rt_base_t rt_hw_interrupt_disable(void)
|
||||
{
|
||||
rt_base_t level;
|
||||
|
||||
__asm__ __volatile__("pushfl ; popl %0 ; cli":"=g" (level): :"memory");
|
||||
return level;
|
||||
}
|
||||
|
||||
void rt_hw_interrupt_enable(rt_base_t level)
|
||||
{
|
||||
__asm__ __volatile__("pushl %0 ; popfl": :"g" (level):"memory", "cc");
|
||||
}
|
||||
|
||||
void rt_hw_context_switch_interrupt(rt_ubase_t from, rt_ubase_t to)
|
||||
{
|
||||
if (rt_thread_switch_interrupt_flag == 0)
|
||||
rt_interrupt_from_thread = from;
|
||||
|
||||
rt_interrupt_to_thread = to;
|
||||
rt_thread_switch_interrupt_flag = 1;
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will initialize thread stack
|
||||
@@ -56,4 +75,3 @@ rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter,
|
||||
/* return task's current stack address */
|
||||
return (rt_uint8_t *)stk;
|
||||
}
|
||||
/*@}*/
|
||||
@@ -1,11 +1,7 @@
|
||||
/*
|
||||
* File : hdisr_gcc.S
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
+37
-74
@@ -1,38 +1,20 @@
|
||||
/*
|
||||
* File : interrupt.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2015, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2015/9/15 Bernard Update to new interrupt framework.
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <rthw.h>
|
||||
#include <rtthread.h>
|
||||
|
||||
#include <bsp.h>
|
||||
|
||||
extern rt_uint32_t rt_interrupt_nest;
|
||||
extern void rt_hw_idt_init(void);
|
||||
|
||||
rt_uint32_t rt_interrupt_from_thread, rt_interrupt_to_thread;
|
||||
rt_uint32_t rt_thread_switch_interrupt_flag;
|
||||
|
||||
/* exception and interrupt handler table */
|
||||
struct rt_irq_desc irq_desc[MAX_HANDLERS];
|
||||
|
||||
@@ -50,45 +32,39 @@ void rt_hw_interrupt_handle(int vector, void* param);
|
||||
*/
|
||||
void rt_hw_pic_init()
|
||||
{
|
||||
outb(IO_PIC1, 0x11);
|
||||
outb(IO_PIC1+1, IRQ_OFFSET);
|
||||
outb(IO_PIC1+1, 1<<IRQ_SLAVE);
|
||||
outb(IO_PIC1+1, 0x3);
|
||||
outb(IO_PIC1+1, 0xff);
|
||||
outb(IO_PIC1, 0x68);
|
||||
outb(IO_PIC1, 0x0a);
|
||||
outb(IO_PIC2, 0x11);
|
||||
outb(IO_PIC2+1, IRQ_OFFSET + 8);
|
||||
outb(IO_PIC2+1, IRQ_SLAVE);
|
||||
outb(IO_PIC2+1, 0x3);
|
||||
outb(IO_PIC2+1, 0xff);
|
||||
outb(IO_PIC2, 0x68);
|
||||
outb(IO_PIC2, 0x0a);
|
||||
outb(IO_PIC1, 0x11);
|
||||
outb(IO_PIC1+1, IRQ_OFFSET);
|
||||
outb(IO_PIC1+1, 1<<IRQ_SLAVE);
|
||||
outb(IO_PIC1+1, 0x3);
|
||||
outb(IO_PIC1+1, 0xff);
|
||||
outb(IO_PIC1, 0x68);
|
||||
outb(IO_PIC1, 0x0a);
|
||||
outb(IO_PIC2, 0x11);
|
||||
outb(IO_PIC2+1, IRQ_OFFSET + 8);
|
||||
outb(IO_PIC2+1, IRQ_SLAVE);
|
||||
outb(IO_PIC2+1, 0x3);
|
||||
outb(IO_PIC2+1, 0xff);
|
||||
outb(IO_PIC2, 0x68);
|
||||
outb(IO_PIC2, 0x0a);
|
||||
|
||||
if (irq_mask_8259A != 0xFFFF)
|
||||
{
|
||||
outb(IO_PIC1+1, (char)irq_mask_8259A);
|
||||
outb(IO_PIC2+1, (char)(irq_mask_8259A >> 8));
|
||||
}
|
||||
|
||||
/* init interrupt nest, and context */
|
||||
rt_interrupt_nest = 0;
|
||||
rt_interrupt_from_thread = 0;
|
||||
rt_interrupt_to_thread = 0;
|
||||
rt_thread_switch_interrupt_flag = 0;
|
||||
if (irq_mask_8259A != 0xFFFF)
|
||||
{
|
||||
outb(IO_PIC1+1, (char)irq_mask_8259A);
|
||||
outb(IO_PIC2+1, (char)(irq_mask_8259A >> 8));
|
||||
}
|
||||
}
|
||||
|
||||
void rt_hw_interrupt_handle(int vector, void* param)
|
||||
{
|
||||
rt_kprintf("Unhandled interrupt %d occured!!!\n", vector);
|
||||
rt_kprintf("Unhandled interrupt %d occured!!!\n", vector);
|
||||
}
|
||||
|
||||
void rt_hw_isr(int vector)
|
||||
{
|
||||
if (vector < MAX_HANDLERS)
|
||||
{
|
||||
irq_desc[vector].handler(vector, irq_desc[vector].param);
|
||||
}
|
||||
if (vector < MAX_HANDLERS)
|
||||
{
|
||||
irq_desc[vector].handler(vector, irq_desc[vector].param);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -97,10 +73,10 @@ void rt_hw_isr(int vector)
|
||||
*/
|
||||
void rt_hw_interrupt_init(void)
|
||||
{
|
||||
int idx;
|
||||
|
||||
rt_hw_idt_init();
|
||||
rt_hw_pic_init();
|
||||
int idx;
|
||||
|
||||
rt_hw_idt_init();
|
||||
rt_hw_pic_init();
|
||||
|
||||
/* init exceptions table */
|
||||
for(idx=0; idx < MAX_HANDLERS; idx++)
|
||||
@@ -116,16 +92,16 @@ void rt_hw_interrupt_init(void)
|
||||
|
||||
void rt_hw_interrupt_umask(int vector)
|
||||
{
|
||||
irq_mask_8259A = irq_mask_8259A&~(1<<vector);
|
||||
outb(IO_PIC1+1, (char)irq_mask_8259A);
|
||||
outb(IO_PIC2+1, (char)(irq_mask_8259A >> 8));
|
||||
irq_mask_8259A = irq_mask_8259A&~(1<<vector);
|
||||
outb(IO_PIC1+1, (char)irq_mask_8259A);
|
||||
outb(IO_PIC2+1, (char)(irq_mask_8259A >> 8));
|
||||
}
|
||||
|
||||
void rt_hw_interrupt_mask(int vector)
|
||||
{
|
||||
irq_mask_8259A = irq_mask_8259A | (1<<vector);
|
||||
outb(IO_PIC1+1, (char)irq_mask_8259A);
|
||||
outb(IO_PIC2+1, (char)(irq_mask_8259A >> 8));
|
||||
irq_mask_8259A = irq_mask_8259A | (1<<vector);
|
||||
outb(IO_PIC1+1, (char)irq_mask_8259A);
|
||||
outb(IO_PIC2+1, (char)(irq_mask_8259A >> 8));
|
||||
}
|
||||
|
||||
rt_isr_handler_t rt_hw_interrupt_install(int vector,
|
||||
@@ -152,17 +128,4 @@ rt_isr_handler_t rt_hw_interrupt_install(int vector,
|
||||
return old_handler;
|
||||
}
|
||||
|
||||
rt_base_t rt_hw_interrupt_disable(void)
|
||||
{
|
||||
rt_base_t level;
|
||||
|
||||
__asm__ __volatile__("pushfl ; popl %0 ; cli":"=g" (level): :"memory");
|
||||
return level;
|
||||
}
|
||||
|
||||
void rt_hw_interrupt_enable(rt_base_t level)
|
||||
{
|
||||
__asm__ __volatile__("pushl %0 ; popfl": :"g" (level):"memory", "cc");
|
||||
}
|
||||
|
||||
/*@}*/
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* File : showmem.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006, 2008 RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://openlab.rt-thread.com/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2008-07-29 Bernard first version from QiuYi implementation
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
|
||||
void rt_hw_show_memory(rt_uint32_t addr, rt_uint32_t size)
|
||||
{
|
||||
int i = 0, j =0;
|
||||
|
||||
RT_ASSERT(addr);
|
||||
|
||||
addr = addr & ~0xF;
|
||||
size = 4*((size + 3)/4);
|
||||
|
||||
while(i < size)
|
||||
{
|
||||
rt_kprintf("0x%08x: ", addr );
|
||||
|
||||
for(j=0; j<4; j++)
|
||||
{
|
||||
rt_kprintf("0x%08x ", *(rt_uint32_t *)addr);
|
||||
|
||||
addr += 4;
|
||||
i++;
|
||||
}
|
||||
|
||||
rt_kprintf("\n");
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
+7
-11
@@ -1,11 +1,7 @@
|
||||
/*
|
||||
* File : start.S
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
@@ -52,8 +48,8 @@ multiboot_entry:
|
||||
pushl $0
|
||||
popf
|
||||
|
||||
/*rebuild globe describe table*/
|
||||
lgdt mygdtdesc
|
||||
/* rebuild globe describe table */
|
||||
lgdt __gdtdesc
|
||||
|
||||
movl $0x10,%eax
|
||||
movw %ax,%ds
|
||||
@@ -77,7 +73,7 @@ spin:
|
||||
|
||||
.data
|
||||
.p2align 2
|
||||
mygdt:
|
||||
__gdt:
|
||||
.word 0,0,0,0
|
||||
|
||||
.word 0x07FF /* 8Mb - limit=2047 */
|
||||
@@ -90,8 +86,8 @@ mygdt:
|
||||
.word 0x9200 /* data read/write */
|
||||
.word 0x00C0
|
||||
|
||||
mygdtdesc:
|
||||
__gdtdesc:
|
||||
.word 0x17
|
||||
.long mygdt
|
||||
.long __gdt
|
||||
|
||||
/*@}*/
|
||||
|
||||
+7
-10
@@ -1,18 +1,14 @@
|
||||
/*
|
||||
* File : trap.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://openlab.rt-thread.com/license/LICENSE
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
|
||||
#include <rthw.h>
|
||||
#include <rtthread.h>
|
||||
|
||||
#include <bsp.h>
|
||||
|
||||
@@ -29,6 +25,7 @@ struct Pseudodesc idt_pd =
|
||||
extern rt_isr_handler_t isr_table[];
|
||||
extern rt_isr_handler_t trap_func[];
|
||||
extern rt_isr_handler_t hdinterrupt_func[];
|
||||
extern void rt_hw_interrupt_handle(int vector, void* param);
|
||||
|
||||
/**
|
||||
* @addtogroup I386
|
||||
@@ -41,7 +38,7 @@ extern rt_isr_handler_t hdinterrupt_func[];
|
||||
*/
|
||||
void rt_hw_idt_init(void)
|
||||
{
|
||||
extern void Xdefault;
|
||||
extern void Xdefault(void);
|
||||
int i, j, func;
|
||||
|
||||
// install a default handler
|
||||
@@ -92,7 +89,7 @@ void rt_hw_trap_irq(int trapno)
|
||||
rt_kprintf("General protection interrupt\n");
|
||||
RT_ASSERT(0);
|
||||
case T_DEFAULT:
|
||||
rt_hw_interrupt_handle(T_DEFAULT);
|
||||
rt_hw_interrupt_handle(T_DEFAULT, RT_NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+12
-14
@@ -1,11 +1,7 @@
|
||||
/*
|
||||
* File : trapisr_gcc.S
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
@@ -22,6 +18,7 @@
|
||||
.globl proc;\
|
||||
.type proc,@function;\
|
||||
proc:
|
||||
|
||||
#define TRAPFNC(name,num)\
|
||||
ENTRY(name)\
|
||||
pushl $(num);\
|
||||
@@ -29,6 +26,7 @@
|
||||
.data;\
|
||||
.long name;\
|
||||
.text
|
||||
|
||||
#define TRAPFNC_NOEC(name,num)\
|
||||
ENTRY(name)\
|
||||
pushl $0;\
|
||||
@@ -54,17 +52,17 @@ TRAPFNC_NOEC(Xoflow, 4)
|
||||
TRAPFNC_NOEC(Xbound, 5)
|
||||
TRAPFNC_NOEC(Xillop, 6)
|
||||
TRAPFNC_NOEC(Xdevice, 7)
|
||||
TRAPFNC (Xdblflt, 8)
|
||||
TRAPFNC (Xtss, 9)
|
||||
TRAPFNC (Xsegnp, 10)
|
||||
TRAPFNC (Xstack, 11)
|
||||
TRAPFNC (Xgpflt, 12)
|
||||
TRAPFNC (Xpgflt, 13)
|
||||
TRAPFNC (Xdblflt, 8)
|
||||
TRAPFNC (Xtss, 9)
|
||||
TRAPFNC (Xsegnp, 10)
|
||||
TRAPFNC (Xstack, 11)
|
||||
TRAPFNC (Xgpflt, 12)
|
||||
TRAPFNC (Xpgflt, 13)
|
||||
TRAPFNC_NOEC(Xfperr, 14)
|
||||
TRAPFNC (Xalign, 15)
|
||||
TRAPFNC (Xalign, 15)
|
||||
|
||||
/* default handler -- not for any specific trap */
|
||||
TRAPFNC (Xdefault, 500)
|
||||
TRAPFNC (Xdefault, 500)
|
||||
|
||||
.p2align 4,0x90
|
||||
.globl _traps
|
||||
|
||||
Reference in New Issue
Block a user