@@ -31,15 +31,12 @@ mod user;
31
31
32
32
use core:: sync:: atomic:: { AtomicBool , Ordering } ;
33
33
34
- use polyhal:: addr:: { PhysPage , VirtPage } ;
35
- use polyhal:: {
36
- disable_irq, enable_irq, get_mem_areas, PageAlloc , TrapFrame , TrapFrameArgs , TrapType ,
37
- VIRT_ADDR_START ,
38
- } ;
39
34
use devices:: { self , get_int_device} ;
40
35
use executor:: current_task;
41
36
use frame_allocator:: { self , frame_alloc_persist, frame_unalloc} ;
42
- use hal;
37
+ use polyhal:: addr:: { PhysPage , VirtPage } ;
38
+ use polyhal:: irq:: IRQ ;
39
+ use polyhal:: { get_mem_areas, PageAlloc , TrapFrame , TrapFrameArgs , TrapType , VIRT_ADDR_START } ;
43
40
use tasks:: UserTask ;
44
41
use user:: user_cow_int;
45
42
use vfscore:: OpenFlags ;
@@ -139,9 +136,12 @@ fn kernel_interrupt(cx_ref: &mut TrapFrame, trap_type: TrapType) {
139
136
#[ polyhal:: arch_entry]
140
137
fn main ( hart_id : usize ) {
141
138
static BOOT_CORE_FLAGS : AtomicBool = AtomicBool :: new ( false ) ;
142
- disable_irq ( ) ;
139
+ IRQ :: int_disable ( ) ;
143
140
// Ensure this is the first core
144
- if BOOT_CORE_FLAGS . compare_exchange ( false , true , Ordering :: Acquire , Ordering :: Relaxed ) . is_ok ( ) {
141
+ if BOOT_CORE_FLAGS
142
+ . compare_exchange ( false , true , Ordering :: Acquire , Ordering :: Relaxed )
143
+ . is_ok ( )
144
+ {
145
145
extern "C" {
146
146
fn start ( ) ;
147
147
fn end ( ) ;
@@ -157,6 +157,7 @@ fn main(hart_id: usize) {
157
157
158
158
polyhal:: init ( & PageAllocImpl ) ;
159
159
get_mem_areas ( ) . into_iter ( ) . for_each ( |( start, size) | {
160
+ info ! ( "memory area: {:#x} - {:#x}" , start, start + size) ;
160
161
frame_allocator:: add_frame_map ( start, start + size) ;
161
162
} ) ;
162
163
@@ -175,12 +176,11 @@ fn main(hart_id: usize) {
175
176
}
176
177
}
177
178
178
- // initialize interrupt
179
- hal:: interrupt:: init ( ) ;
180
-
181
179
// get devices and init
182
180
devices:: regist_devices_irq ( ) ;
183
181
182
+ polyhal:: instruction:: Instruction :: ebreak ( ) ;
183
+
184
184
// initialize filesystem
185
185
fs:: init ( ) ;
186
186
{
@@ -204,7 +204,7 @@ fn main(hart_id: usize) {
204
204
}
205
205
206
206
// enable interrupts
207
- enable_irq ( ) ;
207
+ IRQ :: int_enable ( ) ;
208
208
209
209
// cache task with task templates
210
210
// crate::syscall::cache_task_template("/bin/busybox").expect("can't cache task");
@@ -228,11 +228,7 @@ fn main(hart_id: usize) {
228
228
} else {
229
229
println ! ( "run kernel @ hart {}" , hart_id) ;
230
230
231
- // initialize interrupt
232
- hal:: interrupt:: init ( ) ;
233
-
234
- // enable_irq();
235
- enable_irq ( ) ;
231
+ IRQ :: int_enable ( ) ;
236
232
// loop { arch::wfi() }
237
233
tasks:: run_tasks ( ) ;
238
234
info ! ( "shutdown ap core" ) ;
0 commit comments