forked from Imagelibrary/rtems
Patch from Erik Ivanenko <erik.ivanenko@utoronto.ca>:
Please find attached a start.s that includes a cli prior to the hlt
instruction. This ensures that external interrupts cannot restart
the system after returning to the startup code. ( According to the hlt
docs, they will! )
Also find a new timer.c. ( I forgot to update the countdowm value
in the timer when I changed the PSCLK frequency in start.s) . This
improves timer accuracy.
The raw_idt_notify messages are no longer infinite, I tested sp11 and
sp05, both which were bad, and I have seen the message print once in
one test. I think it's ok if it prints out once. In fact, I don't
think you can effectively stop it!
This commit is contained in:
@@ -65,7 +65,6 @@ SYM(Interrupt_descriptor_table): /* Now in data section */
|
|||||||
END_DATA
|
END_DATA
|
||||||
|
|
||||||
BEGIN_DATA
|
BEGIN_DATA
|
||||||
/* .section .gdt */
|
|
||||||
PUBLIC (_Global_descriptor_table)
|
PUBLIC (_Global_descriptor_table)
|
||||||
|
|
||||||
SYM(GDTR): DESC3( GDT_TABLE, 0x1f ); # one less than the size
|
SYM(GDTR): DESC3( GDT_TABLE, 0x1f ); # one less than the size
|
||||||
@@ -345,20 +344,6 @@ SYM(SetUCS1):
|
|||||||
* So, move the whole data section down.
|
* So, move the whole data section down.
|
||||||
********************************************************/
|
********************************************************/
|
||||||
|
|
||||||
/* SYM(xfer_gdt):
|
|
||||||
movw $ _ram_gdt_offset , di
|
|
||||||
movw $ _ram_gdt_segment , cx
|
|
||||||
mov cx , es
|
|
||||||
|
|
||||||
movw $ _gdt_size , cx
|
|
||||||
movw $ _rom_gdt_segment , ax
|
|
||||||
movw $ _rom_gdt_offset , si
|
|
||||||
mov ax , ds
|
|
||||||
|
|
||||||
repne
|
|
||||||
movsb
|
|
||||||
*/
|
|
||||||
|
|
||||||
movw $ _ram_data_offset , di
|
movw $ _ram_data_offset , di
|
||||||
movw $ _ram_data_segment, cx
|
movw $ _ram_data_segment, cx
|
||||||
mov cx , es
|
mov cx , es
|
||||||
@@ -376,14 +361,10 @@ SYM(SetUCS1):
|
|||||||
* Table Register
|
* Table Register
|
||||||
****************************/
|
****************************/
|
||||||
|
|
||||||
/* movw $ _ram_gdt_segment, ax */
|
|
||||||
|
|
||||||
#ifdef NEXT_GAS
|
#ifdef NEXT_GAS
|
||||||
data32
|
data32
|
||||||
addr32
|
addr32
|
||||||
#endif
|
#endif
|
||||||
/* lgdt _ram_gdt_offset # location of GDT */
|
|
||||||
|
|
||||||
lgdt SYM(GDTR) # location of GDT
|
lgdt SYM(GDTR) # location of GDT
|
||||||
|
|
||||||
|
|
||||||
@@ -405,13 +386,11 @@ SYM(SetUCS):
|
|||||||
* and load CS selector
|
* and load CS selector
|
||||||
*********************/
|
*********************/
|
||||||
|
|
||||||
/* ljmpl $ GDT_CODE_PTR , $ SYM(_copy_data) # sets the code selector*/
|
|
||||||
ljmpl $ GDT_CODE_PTR , $ SYM(_load_segment_registers) # sets the code selector
|
ljmpl $ GDT_CODE_PTR , $ SYM(_load_segment_registers) # sets the code selector
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copy the data section down to RAM
|
* Load the segment registers
|
||||||
*/
|
*/
|
||||||
/*SYM(_copy_data): */
|
|
||||||
SYM(_load_segment_registers):
|
SYM(_load_segment_registers):
|
||||||
.code32
|
.code32
|
||||||
pLOAD_SEGMENT( GDT_DATA_PTR, fs)
|
pLOAD_SEGMENT( GDT_DATA_PTR, fs)
|
||||||
@@ -420,12 +399,6 @@ SYM(_load_segment_registers):
|
|||||||
pLOAD_SEGMENT( GDT_DATA_PTR, ds)
|
pLOAD_SEGMENT( GDT_DATA_PTR, ds)
|
||||||
pLOAD_SEGMENT( GDT_DATA_PTR, es)
|
pLOAD_SEGMENT( GDT_DATA_PTR, es)
|
||||||
|
|
||||||
/* movl $ SYM(_data_start) , edi # ram destination
|
|
||||||
movl $ SYM(_rom_data_start) , esi # rom data source
|
|
||||||
movl $ SYM(_data_size) , ecx # amount to move
|
|
||||||
repne # while ecx != 0
|
|
||||||
movsb # move a byte
|
|
||||||
*/
|
|
||||||
/*
|
/*
|
||||||
* Set up the stack
|
* Set up the stack
|
||||||
*/
|
*/
|
||||||
@@ -460,7 +433,8 @@ SYM (zero_bss):
|
|||||||
call SYM(boot_card)
|
call SYM(boot_card)
|
||||||
addl $12,esp
|
addl $12,esp
|
||||||
|
|
||||||
hlt
|
cli # stops interrupts from being processed after hlt!
|
||||||
|
hlt # shutdown
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ void TimerOn(const rtems_raw_irq_connect_data* used)
|
|||||||
Ttimer_val = 0; /* clear timer ISR count */
|
Ttimer_val = 0; /* clear timer ISR count */
|
||||||
|
|
||||||
outport_byte ( TMRCON , 0xb0 ); /* select tmr2, stay in mode 0 */
|
outport_byte ( TMRCON , 0xb0 ); /* select tmr2, stay in mode 0 */
|
||||||
outport_byte ( TMR1 , 0xd2 ); /* set to 250 usec interval */
|
outport_byte ( TMR1 , 0xfa ); /* set to 250 usec interval */
|
||||||
outport_byte ( TMR1 , 0x00 );
|
outport_byte ( TMR1 , 0x00 );
|
||||||
outport_byte ( TMRCON , 0x64 ); /* change to mode 2 ( starts timer ) */
|
outport_byte ( TMRCON , 0x64 ); /* change to mode 2 ( starts timer ) */
|
||||||
/* interrupts ARE enabled */
|
/* interrupts ARE enabled */
|
||||||
@@ -78,7 +78,7 @@ static rtems_raw_irq_connect_data timer_raw_irq_data = {
|
|||||||
void Timer_exit()
|
void Timer_exit()
|
||||||
{
|
{
|
||||||
if (!i386_delete_idt_entry(&timer_raw_irq_data)) {
|
if (!i386_delete_idt_entry(&timer_raw_irq_data)) {
|
||||||
printk("Timer raw handler deconnexion failed\n");
|
printk("Timer_exit:Timer raw handler removal failed\n");
|
||||||
rtems_fatal_error_occurred(1);
|
rtems_fatal_error_occurred(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -94,7 +94,7 @@ void Timer_initialize()
|
|||||||
|
|
||||||
atexit(Timer_exit); /* Try not to hose the system at exit. */
|
atexit(Timer_exit); /* Try not to hose the system at exit. */
|
||||||
if (!i386_set_idt_entry (&timer_raw_irq_data)) {
|
if (!i386_set_idt_entry (&timer_raw_irq_data)) {
|
||||||
printk("raw handler connexion failed\n");
|
printk("Timer_initialize: raw handler installation failed\n");
|
||||||
rtems_fatal_error_occurred(1);
|
rtems_fatal_error_occurred(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user