File tree Expand file tree Collapse file tree 4 files changed +22
-10
lines changed
userland/apps/aero_shell/src Expand file tree Collapse file tree 4 files changed +22
-10
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ impl lai::Host for LaiHost {
36
36
fn sleep ( & self , ms : u64 ) {
37
37
scheduler:: get_scheduler ( )
38
38
. inner
39
- . sleep ( Some ( ms as usize * 1_000_000 ) )
39
+ . sleep ( Some ( ms as usize / 1000 ) )
40
40
. expect ( "lai: unexpected signal during sleep" )
41
41
}
42
42
@@ -88,6 +88,14 @@ impl lai::Host for LaiHost {
88
88
let header = PciHeader :: new ( bus, slot, fun) ;
89
89
unsafe { header. read :: < u32 > ( offset as u32 ) }
90
90
}
91
+
92
+ // Memory functions:
93
+ #[ inline]
94
+ fn map ( & self , address : usize , _count : usize ) -> * mut u8 {
95
+ PhysAddr :: new ( address as u64 )
96
+ . as_hhdm_virt ( )
97
+ . as_mut_ptr :: < u8 > ( )
98
+ }
91
99
}
92
100
93
101
pub fn init_lai ( ) {
@@ -98,7 +106,6 @@ pub fn init_lai() {
98
106
lai:: create_namespace ( ) ;
99
107
100
108
lai:: enable_acpi ( 1 ) ;
101
- lai:: enter_sleep ( 5 ) ;
102
109
}
103
110
104
111
crate :: module_init!( init_lai) ;
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ use crate::fs::Path;
28
28
use crate :: mem:: paging:: VirtAddr ;
29
29
use crate :: userland:: scheduler;
30
30
use crate :: userland:: signals:: SignalEntry ;
31
+ use crate :: utils:: sync:: IrqGuard ;
31
32
32
33
static HOSTNAME : Once < Mutex < String > > = Once :: new ( ) ;
33
34
@@ -309,6 +310,8 @@ pub fn shutdown() -> ! {
309
310
fs:: cache:: clear_inode_cache ( ) ;
310
311
fs:: cache:: clear_dir_cache ( ) ;
311
312
312
- // TODO
313
- loop { }
313
+ let _guard = IrqGuard :: new ( ) ;
314
+ lai:: enter_sleep ( 5 ) ;
315
+
316
+ unreachable ! ( "aml: failed to shutdown (enter state S5)" )
314
317
}
Original file line number Diff line number Diff line change @@ -85,9 +85,9 @@ pub unsafe fn inb(port: u16) -> u8 {
85
85
#[ inline]
86
86
pub unsafe fn outw ( port : u16 , value : u16 ) {
87
87
asm ! (
88
- "out dx, eax " ,
88
+ "out dx, ax " ,
89
89
in( "dx" ) port,
90
- in( "eax " ) value,
90
+ in( "ax " ) value,
91
91
options( preserves_flags, nomem, nostack)
92
92
) ;
93
93
}
@@ -114,7 +114,7 @@ pub unsafe fn inl(port: u16) -> u32 {
114
114
"in eax, dx" ,
115
115
in( "dx" ) port,
116
116
out( "eax" ) ret,
117
- options( preserves_flags , nomem, nostack)
117
+ options( nomem, nostack, preserves_flags )
118
118
) ;
119
119
120
120
ret
@@ -127,10 +127,10 @@ pub unsafe fn inw(port: u16) -> u16 {
127
127
let ret: u16 ;
128
128
129
129
asm ! (
130
- "in eax , dx" ,
131
- out( "eax " ) ret,
130
+ "in ax , dx" ,
131
+ out( "ax " ) ret,
132
132
in( "dx" ) port,
133
- options( preserves_flags , nomem, nostack)
133
+ options( nomem, nostack, preserves_flags )
134
134
) ;
135
135
136
136
ret
Original file line number Diff line number Diff line change @@ -157,6 +157,8 @@ fn repl(history: &mut Vec<String>) -> Result<(), AeroSyscallError> {
157
157
sys_sleep ( & timespec) ?;
158
158
}
159
159
160
+ "shutdown" => sys_shutdown ( ) ,
161
+
160
162
"doom" => {
161
163
let child = sys_fork ( ) ?;
162
164
You can’t perform that action at this time.
0 commit comments