diff --git a/src/crt0/src/lib.rs b/src/crt0/src/lib.rs index 17f813e510..c4ad4072b6 100644 --- a/src/crt0/src/lib.rs +++ b/src/crt0/src/lib.rs @@ -6,15 +6,18 @@ use core::arch::global_asm; #[cfg(target_arch = "aarch64")] -global_asm!(" +global_asm!( + " .globl _start _start: mov x0, sp bl relibc_start -"); +" +); #[cfg(target_arch = "x86")] -global_asm!(" +global_asm!( + " .globl _start .type _start, @function _start: @@ -30,10 +33,12 @@ _start: push esp call relibc_start .size _start, . - _start -"); +" +); #[cfg(target_arch = "x86_64")] -global_asm!(" +global_asm!( + " .globl _start .type _start, @function _start: @@ -51,7 +56,8 @@ _start: call relibc_start .size _start, . - _start -"); +" +); #[linkage = "weak"] #[no_mangle] diff --git a/src/header/stdlib/mod.rs b/src/header/stdlib/mod.rs index 39793092ec..e6d3695332 100644 --- a/src/header/stdlib/mod.rs +++ b/src/header/stdlib/mod.rs @@ -853,7 +853,13 @@ pub unsafe extern "C" fn seed48(seed16v: *mut c_ushort) -> *mut c_ushort { rand48::SEED48_XSUBI.as_mut_ptr() } -unsafe fn copy_kv(existing: *mut c_char, key: *const c_char, value: *const c_char, key_len: usize, value_len: usize) { +unsafe fn copy_kv( + existing: *mut c_char, + key: *const c_char, + value: *const c_char, + key_len: usize, + value_len: usize, +) { core::ptr::copy_nonoverlapping(key, existing, key_len); core::ptr::write(existing.add(key_len), b'=' as c_char); core::ptr::copy_nonoverlapping(value, existing.add(key_len + 1), value_len); @@ -862,8 +868,8 @@ unsafe fn copy_kv(existing: *mut c_char, key: *const c_char, value: *const c_cha #[no_mangle] pub unsafe extern "C" fn setenv( - mut key: *const c_char, - mut value: *const c_char, + key: *const c_char, + value: *const c_char, overwrite: c_int, ) -> c_int { let key_len = strlen(key); @@ -883,13 +889,13 @@ pub unsafe extern "C" fn setenv( core::ptr::write(existing.add(value_len), 0); } else { // Reuse platform::environ slot, but allocate a new pointer. - let mut ptr = platform::alloc(key_len as usize + 1 + value_len as usize + 1) as *mut c_char; + let ptr = platform::alloc(key_len as usize + 1 + value_len as usize + 1) as *mut c_char; copy_kv(ptr, key, value, key_len, value_len); platform::environ.add(i).write(ptr); } } else { // Expand platform::environ and allocate a new pointer. - let mut ptr = platform::alloc(key_len as usize + 1 + value_len as usize + 1) as *mut c_char; + let ptr = platform::alloc(key_len as usize + 1 + value_len as usize + 1) as *mut c_char; copy_kv(ptr, key, value, key_len, value_len); put_new_env(ptr); } @@ -1165,7 +1171,12 @@ pub unsafe extern "C" fn unsetenv(key: *const c_char) -> c_int { platform::environ = platform::OUR_ENVIRON.as_mut_ptr(); } else { platform::OUR_ENVIRON.clear(); - platform::OUR_ENVIRON.extend(platform::environ_iter().enumerate().filter(|&(j, _)| j != i).map(|(_, v)| v)); + platform::OUR_ENVIRON.extend( + platform::environ_iter() + .enumerate() + .filter(|&(j, _)| j != i) + .map(|(_, v)| v), + ); platform::OUR_ENVIRON.push(core::ptr::null_mut()); platform::environ = platform::OUR_ENVIRON.as_mut_ptr(); } diff --git a/src/header/sys_types/mod.rs b/src/header/sys_types/mod.rs index c348094fca..caa9abf16d 100644 --- a/src/header/sys_types/mod.rs +++ b/src/header/sys_types/mod.rs @@ -1,2 +1 @@ //! sys/types.h -use crate::platform::types::*; diff --git a/src/header/time/mod.rs b/src/header/time/mod.rs index c29d0874db..947bc241d3 100644 --- a/src/header/time/mod.rs +++ b/src/header/time/mod.rs @@ -3,7 +3,7 @@ use core::convert::{TryFrom, TryInto}; use crate::{ - header::errno::{EIO, EOVERFLOW}, + header::errno::EOVERFLOW, platform::{self, types::*, Pal, Sys}, }; @@ -117,16 +117,17 @@ pub unsafe extern "C" fn asctime_r(tm: *const tm, buf: *mut c_char) -> *mut c_ch * message for all fields. */ const OUT_OF_RANGE_MESSAGE: &str = "tm member out of range"; - assert!(0 <= tm_sec && tm_sec <= 99, OUT_OF_RANGE_MESSAGE); - assert!(0 <= tm_min && tm_min <= 99, OUT_OF_RANGE_MESSAGE); - assert!(0 <= tm_hour && tm_hour <= 99, OUT_OF_RANGE_MESSAGE); - assert!(-99 <= tm_mday && tm_mday <= 999, OUT_OF_RANGE_MESSAGE); - assert!(0 <= tm_mon && tm_mon <= 11, OUT_OF_RANGE_MESSAGE); + assert!(0 <= tm_sec && tm_sec <= 99, "{}", OUT_OF_RANGE_MESSAGE); + assert!(0 <= tm_min && tm_min <= 99, "{}", OUT_OF_RANGE_MESSAGE); + assert!(0 <= tm_hour && tm_hour <= 99, "{}", OUT_OF_RANGE_MESSAGE); + assert!(-99 <= tm_mday && tm_mday <= 999, "{}", OUT_OF_RANGE_MESSAGE); + assert!(0 <= tm_mon && tm_mon <= 11, "{}", OUT_OF_RANGE_MESSAGE); assert!( -999 - 1900 <= tm_year && tm_year <= 9999 - 1900, + "{}", OUT_OF_RANGE_MESSAGE ); - assert!(0 <= tm_wday && tm_wday <= 6, OUT_OF_RANGE_MESSAGE); + assert!(0 <= tm_wday && tm_wday <= 6, "{}", OUT_OF_RANGE_MESSAGE); // At this point, we can safely use the values as given. let write_result = core::fmt::write( @@ -382,10 +383,10 @@ pub unsafe extern "C" fn mktime(t: *mut tm) -> time_t { day += MONTH_DAYS[leap][month as usize] as i64; } - (day * (60 * 60 * 24) + day * (60 * 60 * 24) + ((*t).tm_hour as i64) * (60 * 60) + ((*t).tm_min as i64) * 60 - + (*t).tm_sec as i64) + + (*t).tm_sec as i64 } } diff --git a/src/header/wctype/alpha.rs b/src/header/wctype/alpha.rs index b7f3faba8c..9cae98893b 100644 --- a/src/header/wctype/alpha.rs +++ b/src/header/wctype/alpha.rs @@ -6,7 +6,7 @@ use crate::platform::types::*; pub fn is(wc: usize) -> c_uchar { if wc < 0x20000 { - return (table[(table[wc>>8] as usize)*32+((wc&255)>>3)]>>(wc&7))&1; + return (table[(table[wc >> 8] as usize) * 32 + ((wc & 255) >> 3)] >> (wc & 7)) & 1; } if wc < 0x2fffe { return 1; @@ -15,176 +15,179 @@ pub fn is(wc: usize) -> c_uchar { } const table: [c_uchar; 3904] = [ - 18,17,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,17,34,35,36,17,37,38,39,40, - 41,42,43,44,17,45,46,47,16,16,48,16,16,16,16,16,16,16,49,50,51,16,52,53,16,16, - 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,54, - 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17, - 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17, - 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17, - 17,17,17,55,17,17,17,17,56,17,57,58,59,60,61,62,17,17,17,17,17,17,17,17,17,17, - 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17, - 17,17,17,17,17,17,17,63,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, - 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,64,65,17,66,67, - 68,69,70,71,72,73,74,17,75,76,77,78,79,80,81,16,82,83,84,85,86,87,88,89,90,91, - 92,93,16,94,95,96,16,17,17,17,97,98,99,16,16,16,16,16,16,16,16,16,16,17,17,17, - 17,100,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,101,16,16,16,16,16, - 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, - 16,16,17,17,102,103,16,16,104,105,17,17,17,17,17,17,17,17,17,17,17,17,17,17, - 17,17,17,17,17,17,17,17,17,106,17,17,107,16,16,16,16,16,16,16,16,16,16,16,16, - 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17, - 108,109,16,16,16,16,16,16,16,16,16,110,16,16,16,16,16,16,16,16,16,16,16,16,16, - 16,16,16,16,16,16,16,16,16,16,111,112,113,114,16,16,16,16,16,16,16,16,115,116, - 117,16,16,16,16,16,118,119,16,16,16,16,120,16,16,121,16,16,16,16,16,16,16,16, - 16,16,16,16,16, - 16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255, - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,254,255,255,7,254, - 255,255,7,0,0,0,0,0,4,32,4,255,255,127,255,255,255,127,255,255,255,255,255, - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, - 255,195,255,3,0,31,80,0,0,0,0,0,0,0,0,0,0,32,0,0,0,0,0,223,188,64,215,255,255, - 251,255,255,255,255,255,255,255,255,255,191,255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255,255,3,252,255,255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255,255,255,255,254,255,255,255,127,2,255,255,255, - 255,255,1,0,0,0,0,255,191,182,0,255,255,255,135,7,0,0,0,255,7,255,255,255,255, - 255,255,255,254,255,195,255,255,255,255,255,255,255,255,255,255,255,255,239, - 31,254,225,255, - 159,0,0,255,255,255,255,255,255,0,224,255,255,255,255,255,255,255,255,255,255, - 255,255,3,0,255,255,255,255,255,7,48,4,255,255,255,252,255,31,0,0,255,255,255, - 1,255,7,0,0,0,0,0,0,255,255,223,63,0,0,240,255,248,3,255,255,255,255,255,255, - 255,255,255,239,255,223,225,255,207,255,254,255,239,159,249,255,255,253,197, - 227,159,89,128,176,207,255,3,16,238,135,249,255,255,253,109,195,135,25,2,94, - 192,255,63,0,238,191,251,255,255,253,237,227,191,27,1,0,207,255,0,30,238,159, - 249,255,255,253,237,227,159,25,192,176,207,255,2,0,236,199,61,214,24,199,255, - 195,199,29,129,0,192,255,0,0,239,223,253,255,255,253,255,227,223,29,96,7,207, - 255,0,0,239,223,253,255,255,253,239,227,223,29,96,64,207,255,6,0,239,223,253, - 255,255,255,255,231,223,93,240,128,207,255,0,252,236,255,127,252,255,255,251, - 47,127,128,95,255,192,255,12,0,254,255,255,255,255,127,255,7,63,32,255,3,0,0, - 0,0,214,247,255,255,175,255,255,59,95,32,255,243,0,0,0, - 0,1,0,0,0,255,3,0,0,255,254,255,255,255,31,254,255,3,255,255,254,255,255,255, - 31,0,0,0,0,0,0,0,0,255,255,255,255,255,255,127,249,255,3,255,255,255,255,255, - 255,255,255,255,63,255,255,255,255,191,32,255,255,255,255,255,247,255,255,255, - 255,255,255,255,255,255,61,127,61,255,255,255,255,255,61,255,255,255,255,61, - 127,61,255,127,255,255,255,255,255,255,255,61,255,255,255,255,255,255,255,255, - 7,0,0,0,0,255,255,0,0,255,255,255,255,255,255,255,255,255,255,63,63,254,255, - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, - 255,255,255,255,255,159,255,255,254,255,255,7,255,255,255,255,255,255,255,255, - 255,199,255,1,255,223,15,0,255,255,15,0,255,255,15,0,255,223,13,0,255,255,255, - 255,255,255,207,255,255,1,128,16,255,3,0,0,0,0,255,3,255,255,255,255,255,255, - 255,255,255,255,255,1,255,255,255,255,255,7,255,255,255,255,255,255,255,255, - 63, - 0,255,255,255,127,255,15,255,1,192,255,255,255,255,63,31,0,255,255,255,255, - 255,15,255,255,255,3,255,3,0,0,0,0,255,255,255,15,255,255,255,255,255,255,255, - 127,254,255,31,0,255,3,255,3,128,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255, - 255,239,255,239,15,255,3,0,0,0,0,255,255,255,255,255,243,255,255,255,255,255, - 255,191,255,3,0,255,255,255,255,255,255,127,0,255,227,255,255,255,255,255,63, - 255,1,255,255,255,255,255,231,0,0,0,0,0,222,111,4,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0, - 128,255,31,0,255,255,63,63,255,255,255,255,63,63,255,170,255,255,255,63,255, - 255,255,255,255,255,223,95,220,31,207,15,255,31,220,31,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,2,128,0,0,255,31,0,0,0,0,0,0,0,0,0,0,0,0,132,252,47,62,80,189,255,243, - 224,67,0,0,255,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,255,255,255,255,255,255,3,0, - 0,255,255,255,255,255,127,255,255,255,255,255,127,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255,255,31,120,12,0,255,255,255,255,191,32,255, - 255,255,255,255,255,255,128,0,0,255,255,127,0,127,127,127,127,127,127,127,127, - 255,255,255,255,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,224,0,0,0,254,3,62,31,254,255,255,255,255,255,255,255,255,255,127,224,254, - 255,255,255,255,255,255,255,255,255,255,247,224,255,255,255,255,255,254,255, - 255,255,255,255,255,255,255,255,255,127,0,0,255,255,255,7,0,0,0,0,0,0,255,255, - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, - 255,255,255,63,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0, - 0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,31,0,0, - 0,0,0,0,0,0,255,255,255,255,255,63,255,31,255,255,255,15,0,0,255,255,255,255, - 255,127,240,143,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0, - 0,128,255,252,255,255,255,255,255,255,255,255,255,255,255,255,249,255,255,255, - 255,255,255,124,0,0,0,0,0,128,255,191,255,255,255,255,0,0,0,255,255,255,255, - 255,255,15,0,255,255,255,255,255,255,255,255,47,0,255,3,0,0,252,232,255,255, - 255,255,255,7,255,255,255,255,7,0,255,255,255,31,255,255,255,255,255,255,247, - 255,0,128,255,3,255,255,255,127,255,255,255,255,255,255,127,0,255,63,255,3, - 255,255,127,252,255,255,255,255,255,255,255,127,5,0,0,56,255,255,60,0,126,126, - 126,0,127,127,255,255,255,255,255,247,255,0,255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,7,255,3,255,255,255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255,255,255,15,0,255,255,127,248,255,255,255,255, - 255, - 15,255,255,255,255,255,255,255,255,255,255,255,255,255,63,255,255,255,255,255, - 255,255,255,255,255,255,255,255,3,0,0,0,0,127,0,248,224,255,253,127,95,219, - 255,255,255,255,255,255,255,255,255,255,255,255,255,3,0,0,0,248,255,255,255, - 255,255,255,255,255,255,255,255,255,63,0,0,255,255,255,255,255,255,255,255, - 252,255,255,255,255,255,255,0,0,0,0,0,255,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,223, - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,31,0,0,255,3, - 254,255,255,7,254,255,255,7,192,255,255,255,255,255,255,255,255,255,255,127, - 252,252,252,28,0,0,0,0,255,239,255,255,127,255,255,183,255,63,255,63,0,0,0,0, - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,7,0,0,0,0,0,0,0,0, - 255,255,255,255,255,255,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,255,255,255,31,255,255,255,255,255,255,1,0,0,0,0, - 0,255,255,255,255,0,224,255,255,255,7,255,255,255,255,255,7,255,255,255,63, - 255,255,255,255,15,255,62,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255,255,63,255,3,255,255,255,255,15,255,255,255, - 255,15,255,255,255,255,255,0,255,255,255,255,255,255,15,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,255,255,255,255,255,255,127,0,255,255,63,0,255,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,63,253,255,255,255,255,191,145,255,255,63,0,255,255, - 127,0,255,255,255,127,0,0,0,0,0,0,0,0,255,255,55,0,255,255,63,0,255,255,255,3, - 0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,192,0,0,0,0,0,0,0,0,111,240,239, - 254,255,255,63,0,0,0,0,0,255,255,255,31,255,255,255,31,0,0,0,0,255,254,255, - 255,31,0,0,0,255,255,255,255,255,255,63,0,255,255,63,0,255,255,7,0,255,255,3, - 0,0,0,0,0,0,0,0,0,0,0,0, - 0,255,255,255,255,255,255,255,255,255,1,0,0,0,0,0,0,255,255,255,255,255,255,7, - 0,255,255,255,255,255,255,7,0,255,255,255,255,255,0,255,3,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,31,128,0,255,255,63,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,255,255,127,0,255,255,255,255,255,255,255,255,63,0,0,0, - 192,255,0,0,252,255,255,255,255,255,255,1,0,0,255,255,255,1,255,3,255,255,255, - 255,255,255,199,255,112,0,255,255,255,255,71,0,255,255,255,255,255,255,255, - 255,30,0,255,23,0,0,0,0,255,255,251,255,255,255,159,64,0,0,0,0,0,0,0,0,127, - 189,255,191,255,1,255,255,255,255,255,255,255,1,255,3,239,159,249,255,255,253, - 237,227,159,25,129,224,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255, - 255,255,255,255,255,187,7,255,131,0,0,0,0,255,255,255,255,255,255,255,255,179, - 0,255,3,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,63,127,0,0,0,63,0,0, - 0,0,255,255,255,255,255,255,255,127,17,0,255,3,0,0,0,0,255,255,255,255,255, - 255,63,1,255,3,0,0,0,0,0,0,255,255,255,231,255,7,255,3,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0, - 0,255,255,255,255,255,255,255,255,255,3,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,255,252,255,255,255,255,255,252,26,0,0,0,255,255,255,255,255,255,231, - 127,0,0,255,255,255,255,255,255,255,255,255,32,0,0,0,0,255,255,255,255,255, - 255,255,1,255,253,255,255,255,255,127,127,1,0,255,3,0,0,252,255,255,255,252, - 255,255,254,127,0,0,0,0,0,0,0,0,0,127,251,255,255,255,255,127,180,203,0,255,3, - 191,253,255,255,255,127,123,1,255,3,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,127,0,255, - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,3,0,0, - 0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,127,0, - 0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, - 255,255,255,255,255,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255, - 255,255,255,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255, - 255,255,255,255,255,255,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255, - 255,255,255,255,255,255,1,255,255,255,127,255,3,0,0,0,0,0,0,0,0,0,0,0,0,255, - 255,255,63,0,0,255,255,255,255,255,255,0,0,15,0,255,3,248,255,255,224,255,255, - 0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,255,255,255,255,255,255,255,255,255,135,255,255,255,255,255,255,255,128, - 255,255,0,0,0,0,0,0,0,0,11,0,0,0,255,255,255,255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, - 255,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255,255,255,255,255,7,0,255,255,255,127,0,0,0,0,0, - 0,7,0,240,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,15,255,255,255,255, - 255,255,255,255,255,255,255,255,255,7,255,31,255,1,255,67,0,0,0,0,0,0,0,0,0,0, - 0,0,255,255,255,255,255,255,255,255,255,255,223,255,255,255,255,255,255,255, - 255,223,100,222,255,235,239,255,255,255,255,255,255, - 255,191,231,223,223,255,255,255,123,95,252,253,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,63,255,255,255, - 253,255,255,247,255,255,255,247,255,255,223,255,255,255,223,255,255,127,255, - 255,255,127,255,255,255,253,255,255,255,253,255,255,247,207,255,255,255,255, - 255,255,127,255,255,249,219,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,255,255,255,255,255,31,128,63,255,67,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255, - 15,255,3,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,31,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255, - 143,8,255,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,239,255,255,255,150,254,247,10,132,234,150,170,150,247,247,94,255,251,255, - 15,238,251,255,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,3,255,255,255,3,255, - 255,255,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 18, 17, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 17, 34, 35, 36, 17, 37, 38, + 39, 40, 41, 42, 43, 44, 17, 45, 46, 47, 16, 16, 48, 16, 16, 16, 16, 16, 16, 16, 49, 50, 51, 16, + 52, 53, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 54, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 55, 17, 17, 17, 17, 56, 17, 57, 58, + 59, 60, 61, 62, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 63, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 64, 65, 17, 66, 67, 68, 69, 70, 71, 72, 73, 74, 17, 75, + 76, 77, 78, 79, 80, 81, 16, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 16, 94, 95, 96, 16, + 17, 17, 17, 97, 98, 99, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 100, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 101, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 17, 17, 102, 103, 16, 16, 104, 105, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 106, 17, 17, 107, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 17, 108, 109, 16, 16, 16, 16, 16, 16, 16, 16, 16, 110, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 111, 112, 113, 114, 16, 16, + 16, 16, 16, 16, 16, 16, 115, 116, 117, 16, 16, 16, 16, 16, 118, 119, 16, 16, 16, 16, 120, 16, + 16, 121, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 254, 255, 255, 7, 254, 255, 255, 7, + 0, 0, 0, 0, 0, 4, 32, 4, 255, 255, 127, 255, 255, 255, 127, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 195, + 255, 3, 0, 31, 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0, 223, 188, 64, 215, 255, + 255, 251, 255, 255, 255, 255, 255, 255, 255, 255, 255, 191, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 3, 252, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 254, 255, 255, 255, 127, 2, + 255, 255, 255, 255, 255, 1, 0, 0, 0, 0, 255, 191, 182, 0, 255, 255, 255, 135, 7, 0, 0, 0, 255, + 7, 255, 255, 255, 255, 255, 255, 255, 254, 255, 195, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 239, 31, 254, 225, 255, 159, 0, 0, 255, 255, 255, 255, 255, 255, 0, 224, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 3, 0, 255, 255, 255, 255, 255, 7, + 48, 4, 255, 255, 255, 252, 255, 31, 0, 0, 255, 255, 255, 1, 255, 7, 0, 0, 0, 0, 0, 0, 255, 255, + 223, 63, 0, 0, 240, 255, 248, 3, 255, 255, 255, 255, 255, 255, 255, 255, 255, 239, 255, 223, + 225, 255, 207, 255, 254, 255, 239, 159, 249, 255, 255, 253, 197, 227, 159, 89, 128, 176, 207, + 255, 3, 16, 238, 135, 249, 255, 255, 253, 109, 195, 135, 25, 2, 94, 192, 255, 63, 0, 238, 191, + 251, 255, 255, 253, 237, 227, 191, 27, 1, 0, 207, 255, 0, 30, 238, 159, 249, 255, 255, 253, + 237, 227, 159, 25, 192, 176, 207, 255, 2, 0, 236, 199, 61, 214, 24, 199, 255, 195, 199, 29, + 129, 0, 192, 255, 0, 0, 239, 223, 253, 255, 255, 253, 255, 227, 223, 29, 96, 7, 207, 255, 0, 0, + 239, 223, 253, 255, 255, 253, 239, 227, 223, 29, 96, 64, 207, 255, 6, 0, 239, 223, 253, 255, + 255, 255, 255, 231, 223, 93, 240, 128, 207, 255, 0, 252, 236, 255, 127, 252, 255, 255, 251, 47, + 127, 128, 95, 255, 192, 255, 12, 0, 254, 255, 255, 255, 255, 127, 255, 7, 63, 32, 255, 3, 0, 0, + 0, 0, 214, 247, 255, 255, 175, 255, 255, 59, 95, 32, 255, 243, 0, 0, 0, 0, 1, 0, 0, 0, 255, 3, + 0, 0, 255, 254, 255, 255, 255, 31, 254, 255, 3, 255, 255, 254, 255, 255, 255, 31, 0, 0, 0, 0, + 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 127, 249, 255, 3, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 63, 255, 255, 255, 255, 191, 32, 255, 255, 255, 255, 255, 247, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 61, 127, 61, 255, 255, 255, 255, 255, 61, 255, 255, 255, 255, 61, 127, + 61, 255, 127, 255, 255, 255, 255, 255, 255, 255, 61, 255, 255, 255, 255, 255, 255, 255, 255, 7, + 0, 0, 0, 0, 255, 255, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 63, 63, 254, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 159, 255, 255, 254, 255, 255, 7, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 199, 255, 1, 255, 223, 15, 0, 255, 255, 15, 0, 255, 255, 15, 0, 255, 223, 13, 0, 255, + 255, 255, 255, 255, 255, 207, 255, 255, 1, 128, 16, 255, 3, 0, 0, 0, 0, 255, 3, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 1, 255, 255, 255, 255, 255, 7, 255, 255, 255, 255, 255, + 255, 255, 255, 63, 0, 255, 255, 255, 127, 255, 15, 255, 1, 192, 255, 255, 255, 255, 63, 31, 0, + 255, 255, 255, 255, 255, 15, 255, 255, 255, 3, 255, 3, 0, 0, 0, 0, 255, 255, 255, 15, 255, 255, + 255, 255, 255, 255, 255, 127, 254, 255, 31, 0, 255, 3, 255, 3, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 255, 255, 255, 255, 255, 255, 239, 255, 239, 15, 255, 3, 0, 0, 0, 0, 255, 255, 255, 255, + 255, 243, 255, 255, 255, 255, 255, 255, 191, 255, 3, 0, 255, 255, 255, 255, 255, 255, 127, 0, + 255, 227, 255, 255, 255, 255, 255, 63, 255, 1, 255, 255, 255, 255, 255, 231, 0, 0, 0, 0, 0, + 222, 111, 4, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 128, 255, 31, 0, 255, 255, 63, 63, 255, + 255, 255, 255, 63, 63, 255, 170, 255, 255, 255, 63, 255, 255, 255, 255, 255, 255, 223, 95, 220, + 31, 207, 15, 255, 31, 220, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 128, 0, 0, 255, 31, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 132, 252, 47, 62, 80, 189, 255, 243, 224, 67, 0, 0, 255, + 255, 255, 255, 255, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 192, 255, 255, 255, 255, 255, 255, 3, 0, 0, 255, 255, 255, + 255, 255, 127, 255, 255, 255, 255, 255, 127, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 31, 120, 12, 0, 255, 255, 255, 255, 191, 32, 255, 255, 255, 255, + 255, 255, 255, 128, 0, 0, 255, 255, 127, 0, 127, 127, 127, 127, 127, 127, 127, 127, 255, 255, + 255, 255, 0, 0, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 224, 0, 0, 0, 254, 3, 62, 31, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 127, 224, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 247, 224, 255, 255, 255, 255, + 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 127, 0, 0, 255, 255, 255, 7, 0, 0, + 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 31, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 63, 255, 31, 255, + 255, 255, 15, 0, 0, 255, 255, 255, 255, 255, 127, 240, 143, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 128, 255, 252, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 249, 255, 255, 255, 255, 255, 255, 124, 0, 0, 0, 0, 0, 128, 255, + 191, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 15, 0, 255, 255, 255, 255, 255, + 255, 255, 255, 47, 0, 255, 3, 0, 0, 252, 232, 255, 255, 255, 255, 255, 7, 255, 255, 255, 255, + 7, 0, 255, 255, 255, 31, 255, 255, 255, 255, 255, 255, 247, 255, 0, 128, 255, 3, 255, 255, 255, + 127, 255, 255, 255, 255, 255, 255, 127, 0, 255, 63, 255, 3, 255, 255, 127, 252, 255, 255, 255, + 255, 255, 255, 255, 127, 5, 0, 0, 56, 255, 255, 60, 0, 126, 126, 126, 0, 127, 127, 255, 255, + 255, 255, 255, 247, 255, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 7, 255, 3, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 15, 0, 255, 255, 127, 248, 255, 255, 255, 255, 255, 15, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 63, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 3, 0, 0, 0, 0, 127, 0, 248, 224, 255, 253, 127, 95, 219, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 3, 0, 0, 0, 248, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 63, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 252, + 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 255, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 223, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 31, 0, 0, + 255, 3, 254, 255, 255, 7, 254, 255, 255, 7, 192, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 127, 252, 252, 252, 28, 0, 0, 0, 0, 255, 239, 255, 255, 127, 255, 255, 183, 255, 63, 255, + 63, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 7, + 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 31, 255, 255, + 255, 255, 255, 255, 1, 0, 0, 0, 0, 0, 255, 255, 255, 255, 0, 224, 255, 255, 255, 7, 255, 255, + 255, 255, 255, 7, 255, 255, 255, 63, 255, 255, 255, 255, 15, 255, 62, 0, 0, 0, 0, 0, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 63, 255, + 3, 255, 255, 255, 255, 15, 255, 255, 255, 255, 15, 255, 255, 255, 255, 255, 0, 255, 255, 255, + 255, 255, 255, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, + 255, 255, 127, 0, 255, 255, 63, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 63, 253, 255, 255, 255, 255, 191, 145, 255, 255, 63, 0, 255, 255, 127, 0, 255, 255, 255, + 127, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 55, 0, 255, 255, 63, 0, 255, 255, 255, 3, 0, 0, 0, 0, 0, + 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 192, 0, 0, 0, 0, 0, 0, 0, 0, 111, 240, 239, 254, + 255, 255, 63, 0, 0, 0, 0, 0, 255, 255, 255, 31, 255, 255, 255, 31, 0, 0, 0, 0, 255, 254, 255, + 255, 31, 0, 0, 0, 255, 255, 255, 255, 255, 255, 63, 0, 255, 255, 63, 0, 255, 255, 7, 0, 255, + 255, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 1, + 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 7, 0, 255, 255, 255, 255, 255, 255, 7, 0, 255, + 255, 255, 255, 255, 0, 255, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 255, 255, 255, 31, 128, 0, 255, 255, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 255, 255, 127, 0, 255, 255, 255, 255, 255, 255, 255, 255, 63, 0, 0, 0, 192, 255, 0, + 0, 252, 255, 255, 255, 255, 255, 255, 1, 0, 0, 255, 255, 255, 1, 255, 3, 255, 255, 255, 255, + 255, 255, 199, 255, 112, 0, 255, 255, 255, 255, 71, 0, 255, 255, 255, 255, 255, 255, 255, 255, + 30, 0, 255, 23, 0, 0, 0, 0, 255, 255, 251, 255, 255, 255, 159, 64, 0, 0, 0, 0, 0, 0, 0, 0, 127, + 189, 255, 191, 255, 1, 255, 255, 255, 255, 255, 255, 255, 1, 255, 3, 239, 159, 249, 255, 255, + 253, 237, 227, 159, 25, 129, 224, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 255, 255, 255, 255, 187, 7, 255, 131, 0, 0, 0, 0, 255, 255, 255, 255, 255, + 255, 255, 255, 179, 0, 255, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, + 255, 255, 255, 255, 255, 63, 127, 0, 0, 0, 63, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, + 127, 17, 0, 255, 3, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 63, 1, 255, 3, 0, 0, 0, 0, 0, 0, + 255, 255, 255, 231, 255, 7, 255, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 3, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 255, 252, 255, 255, 255, 255, 255, 252, 26, 0, 0, 0, 255, 255, 255, 255, 255, 255, + 231, 127, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 32, 0, 0, 0, 0, 255, 255, 255, + 255, 255, 255, 255, 1, 255, 253, 255, 255, 255, 255, 127, 127, 1, 0, 255, 3, 0, 0, 252, 255, + 255, 255, 252, 255, 255, 254, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 127, 251, 255, 255, 255, 255, + 127, 180, 203, 0, 255, 3, 191, 253, 255, 255, 255, 127, 123, 1, 255, 3, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, + 255, 127, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 127, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 127, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, + 255, 255, 1, 255, 255, 255, 127, 255, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 63, + 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 15, 0, 255, 3, 248, 255, 255, 224, 255, 255, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, + 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 135, 255, 255, 255, 255, 255, 255, 255, 128, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, + 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 7, 0, 255, 255, 255, 127, 0, 0, 0, 0, 0, 0, 7, 0, 240, 0, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 7, 255, 31, 255, 1, 255, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 223, 255, 255, 255, 255, 255, 255, 255, 255, 223, + 100, 222, 255, 235, 239, 255, 255, 255, 255, 255, 255, 255, 191, 231, 223, 223, 255, 255, 255, + 123, 95, 252, 253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 63, 255, 255, 255, 253, 255, 255, 247, 255, 255, 255, 247, + 255, 255, 223, 255, 255, 255, 223, 255, 255, 127, 255, 255, 255, 127, 255, 255, 255, 253, 255, + 255, 255, 253, 255, 255, 247, 207, 255, 255, 255, 255, 255, 255, 127, 255, 255, 249, 219, 7, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, + 255, 31, 128, 63, 255, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, + 15, 255, 3, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 31, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, + 255, 255, 143, 8, 255, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 239, 255, + 255, 255, 150, 254, 247, 10, 132, 234, 150, 170, 150, 247, 247, 94, 255, 251, 255, 15, 238, + 251, 255, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 3, 255, 255, 255, 3, + 255, 255, 255, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ]; diff --git a/src/header/wctype/mod.rs b/src/header/wctype/mod.rs index ca82b0a48e..005bca0447 100644 --- a/src/header/wctype/mod.rs +++ b/src/header/wctype/mod.rs @@ -1,11 +1,7 @@ //! wchar implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/wctype.h.html -use crate::{ - c_str::CStr, - header::ctype, - platform::types::*, -}; use self::casecmp::casemap; +use crate::{c_str::CStr, header::ctype, platform::types::*}; mod alpha; mod casecmp; @@ -63,7 +59,7 @@ pub unsafe extern "C" fn wctype(name: *const c_char) -> wctype_t { b"space" => WCTYPE_SPACE, b"upper" => WCTYPE_UPPER, b"xdigit" => WCTYPE_XDIGIT, - _ => 0 + _ => 0, } } @@ -85,10 +81,10 @@ pub extern "C" fn iswblank(wc: wint_t) -> c_int { #[no_mangle] pub extern "C" fn iswcntrl(wc: wint_t) -> c_int { c_int::from( - wc < 32 || - wc.wrapping_sub(0x7f) < 33 || - wc.wrapping_sub(0x2028) < 2 || - wc.wrapping_sub(0xfff9) < 3 + wc < 32 + || wc.wrapping_sub(0x7f) < 33 + || wc.wrapping_sub(0x2028) < 2 + || wc.wrapping_sub(0xfff9) < 3, ) } @@ -110,13 +106,13 @@ pub extern "C" fn iswlower(wc: wint_t) -> c_int { #[no_mangle] pub extern "C" fn iswprint(wc: wint_t) -> c_int { if wc < 0xff { - c_int::from((wc+1 & 0x7f) >= 0x21) + c_int::from((wc + 1 & 0x7f) >= 0x21) } else if wc < 0x2028 - || wc.wrapping_sub(0x202a) < 0xd800-0x202a - || wc.wrapping_sub(0xe000) < 0xfff9-0xe000 { + || wc.wrapping_sub(0x202a) < 0xd800 - 0x202a + || wc.wrapping_sub(0xe000) < 0xfff9 - 0xe000 + { 1 - } else if wc.wrapping_sub(0xfffc) > 0x10ffff-0xfffc - || (wc&0xfffe)==0xfffe { + } else if wc.wrapping_sub(0xfffc) > 0x10ffff - 0xfffc || (wc & 0xfffe) == 0xfffe { 0 } else { 1 @@ -130,13 +126,32 @@ pub extern "C" fn iswpunct(wc: wint_t) -> c_int { #[no_mangle] pub extern "C" fn iswspace(wc: wint_t) -> c_int { - c_int::from([ - ' ' as wint_t, '\t' as wint_t, '\n' as wint_t, '\r' as wint_t, - 11, 12, 0x0085, - 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, - 0x2006, 0x2008, 0x2009, 0x200a, - 0x2028, 0x2029, 0x205f, 0x3000 - ].contains(&wc)) + c_int::from( + [ + ' ' as wint_t, + '\t' as wint_t, + '\n' as wint_t, + '\r' as wint_t, + 11, + 12, + 0x0085, + 0x2000, + 0x2001, + 0x2002, + 0x2003, + 0x2004, + 0x2005, + 0x2006, + 0x2008, + 0x2009, + 0x200a, + 0x2028, + 0x2029, + 0x205f, + 0x3000, + ] + .contains(&wc), + ) } #[no_mangle] @@ -146,10 +161,7 @@ pub extern "C" fn iswupper(wc: wint_t) -> c_int { #[no_mangle] pub extern "C" fn iswxdigit(wc: wint_t) -> c_int { - c_int::from( - wc.wrapping_sub('0' as wint_t) < 10 || - (wc|32).wrapping_sub('a' as wint_t) < 6 - ) + c_int::from(wc.wrapping_sub('0' as wint_t) < 10 || (wc | 32).wrapping_sub('a' as wint_t) < 6) } #[no_mangle] diff --git a/src/header/wctype/punct.rs b/src/header/wctype/punct.rs index f1098eb510..9d47abe5b0 100644 --- a/src/header/wctype/punct.rs +++ b/src/header/wctype/punct.rs @@ -5,152 +5,162 @@ use crate::platform::types::*; pub fn is(wc: usize) -> c_uchar { - if wc<0x20000 { - return (table[(table[wc>>8] as usize)*32+((wc&255)>>3)]>>(wc&7))&1; + if wc < 0x20000 { + return (table[(table[wc >> 8] as usize) * 32 + ((wc & 255) >> 3)] >> (wc & 7)) & 1; } return 0; } const table: [c_uchar; 4000] = [ - 18,16,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,16,16,34,35,16,36,37,38,39, - 40,41,42,43,16,44,45,46,17,17,47,17,17,17,17,17,17,48,49,50,51,52,53,54,55,17, - 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,56, - 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, - 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, - 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, - 16,16,16,16,16,16,16,16,57,16,58,59,60,61,62,63,16,16,16,16,16,16,16,16,16,16, - 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, - 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,64,16,16,16,16,16,16,16,16,16, - 16,16,16,16,16,16,16,16,16,16,16,16,16,16,65,16,16,66,16,67,68, - 69,16,70,71,72,16,73,16,16,74,75,76,77,78,16,79,80,81,82,83,84,85,86,87,88,89, - 90,91,16,92,93,94,95,16,16,16,16,96,16,16,16,16,16,16,16,16,16,16,16,16,16,16, - 16,97,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, - 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, - 16,16,16,98,99,16,16,100,101,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, - 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, - 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, - 16,16,16,16,16,16,16,16,102,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, - 16,16,16,103,104,105,106,16,16,107,108,17,17,109,16,16,16,16,16,16,110,111,16, - 16,16,16,16,112,113,16,16,114,115,116,16,117,118,119,17,17,17,120,121,122,123, - 124,16,16,16,16, - 16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255, - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,254,255,0,252,1,0,0,248,1, - 0,0,120,0,0,0,0,255,251,223,251,0,0,128,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,60,0,252,255,224,175,255,255,255,255,255,255,255,255, - 255,255,223,255,255,255,255,255,32,64,176,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,252,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,252,0,0,0,0,0,230,254,255,255,255,0,64,73,0,0,0,0,0,24,0,255,255,0,216, - 0,0,0,0,0,0,0,1,0,60,0,0,0,0,0,0,0,0,0,0,0,0,16,224,1,30,0, - 96,255,191,0,0,0,0,0,0,255,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,248,207, - 227,0,0,0,3,0,32,255,127,0,0,0,78,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,7,252,0,0,0, - 0,0,0,0,0,0,16,0,32,30,0,48,0,1,0,0,0,0,0,0,0,0,16,0,32,0,0,0,0,252,111,0,0,0, - 0,0,0,0,16,0,32,0,0,0,0,64,0,0,0,0,0,0,0,0,16,0,32,0,0,0,0,3,224,0,0,0,0,0,0, - 0,16,0,32,0,0,0,0,253,0,0,0,0,0,0,0,0,0,0,32,0,0,0,0,255,7,16,0,0,0,0,0,0,0,0, - 32,0,0,0,0,128,255,16,0,0,0,0,0,0,16,0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,24,0,160, - 0,127,0,0,255,3,0,0,0,0,0,0,0,0,0,4,0,0,0,0,16,0,0,0,0,0,0,128,0,128,192,223, - 0,12,0,0,0,0,0,0,0,0,0,0,0,4,0,31,0,0,0,0,0, - 0,254,255,255,255,0,252,255,255,0,0,0,0,0,0,0,0,252,0,0,0,0,0,0,192,255,223, - 255,7,0,0,0,0,0,0,0,0,0,0,128,6,0,252,0,0,0,0,0,0,0,0,0,192,0,0,0,0,0,0,0,0,0, - 0,0,8,0,0,0,0,0,0,0,0,0,0,0,224,255,255,255,31,0,0,255,3,0,0,0,0,0,0,0,0,0,0, - 0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,96,0,0,1,0,0,24,0,0,0,0,0,0,0,0,0,56,0,0,0,0,16,0,0,0,112,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,48,0,0,254,127,47,0,0,255,3,255,127,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,49,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,196,255,255,255, - 255,0,0,0,192,0,0,0,0,0,0,0,0,1,0,224,159,0,0,0,0,127,63,255,127,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,16,0,16,0,0,252,255,255,255,31,0,0,0,0,0,12,0,0,0,0,0,0,64,0, - 12,240,0,0,0,0,0,0,128,248,0,0,0,0,0,0,0,192,0,0,0,0,0,0,0,0,255,0,255,255, - 255,33,144,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255, - 127,0,224,251,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,3,224,0,224,0, - 224,0,96,128,248,255,255,255,252,255,255,255,255,255,127,223,255,241,127,255, - 127,0,0,255,255,255,255,0,0,255,255,255,255,1,0,123,3,208,193,175,66,0,12,31, - 188,255,255,0,0,0,0,0,14,255,255,255,255,255,255,255,255,255,255,255,255,255, - 255,255,255,255,255,127,0,0,0,255,7,0,0,255,255,255,255,255,255,255,255,255, - 255,63,0,0,0,0,0,0,252,255, - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,207,255,255,255, - 63,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,224,135,3,254,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, - 128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,127,255,255,255,255,0, - 0,0,0,0,0,255,255,255,251,255,255,255,255,255,255,255,255,255,255,15,0,255, - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,63,0,0,0,255,15,30,255,255,255,1,252,193,224,0,0,0,0, - 0,0,0,0,0,0,0,30,1,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 255,255,0,0,0,0,255,255,255,255,15,0,0,0,255,255,255,127,255,255,255,255,255, - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, - 255,255,255, - 255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255, - 255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,127,0,0,0, - 0,0,0,192,0,224,0,0,0,0,0,0,0,0,0,0,0,128,15,112,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 255,0,255,255,127,0,3,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 64,0,0,0,0,15,255,3,0,0,0,0,0,0,240,0,0,0,0,0,0,0,0,0,16,192,0,0,255,255,3,23, - 0,0,0,0,0,248,0,0,0,0,8,128,0,0,0,0,0,0,0,0,0,0,8,0,255,63,0,192,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,240,0,0,128,3,0,0,0,0,0,0,0,128,2,0,0,192,0,0,67,0,0,0,0,0, - 0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,56,0, - 0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,2,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,252,255,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,255,255,255,3,255,255,255,255,255,255,247, - 255,127,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,254,255,0,252,1,0,0,248,1,0, - 0,248,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,127,0,48,135,255,255,255,255,255, - 143,255,0,0,0,0,0,0,224,255,255,127,255,15,1,0,0,0,0,0,255,255,255,255,255,63, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255, - 15,0,0,0,0,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 128,255,0,0,128,255,0,0,0,0,128,255,0,0,0,0,0,0,0,0,0,248,0,0,192,143,0,0,0, - 128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,255,255,252,255,255,255,255,255,0,0,0,0, - 0,0,0,135,255,1,255,1,0,0,0,224,0,0,0,224,0,0,0,0,0,1,0,0,96,248,127,0,0,0,0, - 0,0,0,0,254,0,0,0,255,0,0,0,255,0,0,0,30,0,254,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252,0,0,0,0,0,0,0,0,0,0,0, - 0,255,255,255,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,224,127,0,0,0,192,255,255,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,192,63,252,255,63,0,0,128,3,0,0,0,0,0,0,254,3,32,0,0,0,0,0,0,0, - 0,0,0,0,0,24,0,15,0,0,0,0,0,56,0,0,0,0,0,0,0,0,0,225,63,0,232,254,255,31,0,0, - 0,0,0,0,0,96,63,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0, - 24,0,32,0,0,192,31,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,68, - 248,0,104,0,0,0,0,0,0,0,0,0,0,0,0,76,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,128,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,128,14,0,0,0,255, - 31,0,0,0,0,0,0,0,0,192,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,8,0,252,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252,7,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,24,128,255,0,0,0,0,0, - 0,0,0,0,0,223,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,62,0,0,252,255,31,3,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,52,0,0,0,0,0,0,0,0,0,128,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,128,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255, - 255,3, - 128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,63,0,0,0,0,0,0,0,255,255,48,0,0,248, - 3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255, - 255,255,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,176,15,0,0,0,0,0,0, - 0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255,255,255,255,255,255,63, - 0,255,255,255,255,127,254,255,255,255,255,255,255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255,255,255,1,0,0,255,255,255,255,255,255,255,255, - 63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,15,0,255,255,255,255,255,255, - 255,255,255,255,127,0,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,8,0,0,0,8,0,0,32,0,0,0,32,0,0,128, - 0,0,0,128,0,0,0,2,0,0,0,2,0,0,8,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255,255,15,0,248,254,255,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,127,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,240,0, - 128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,127,0,0,0,0,0,0,0, - 0,0,0,0,0,0,112,7,0,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,254,255,255,255,255,255,255,255,31,0,0,0,0,0,0,0,0,0,254,255, - 255,255,255,255,255,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,255,255,255,255,255, - 15,255,255,255,255,255,255,255,255,255,255,255,255,15,0,255,127,254,255,254, - 255,254,255,255,255,63,0,255,31,255,255,255,255,0,0,0,252,0,0,0,28,0,0,0,252, - 255,255,255,31,0,0,0,0,0,0,192,255,255,255,7,0,255,255,255,255,255,15,255,1,3, - 0,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,63,0,255,31,255,7,255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,15,0,255,255,255,255,255,255,255,255,255,255,255,1, - 255,15,0,0,255,15,255,255,255,255,255,255,255,0,255,3,255,255,255,255,255,0, - 255,255,255,63,0,0,0,0,0,0,0,0,0,0,255,239,255,255,255,255,255,255,255,255, - 255,255,255,255,123,252,255,255,255,255,231,199,255,255,255,231,255,255,255, - 255,255,255,255,255,255,255,255,255,255,255,255,255,15,0,255,63,15,7,7,0,63,0, - 0,0,0,0,0,0,0,0,0,0,0,0, + 18, 16, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 16, 16, 34, 35, 16, 36, 37, + 38, 39, 40, 41, 42, 43, 16, 44, 45, 46, 17, 17, 47, 17, 17, 17, 17, 17, 17, 48, 49, 50, 51, 52, + 53, 54, 55, 17, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 56, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 57, 16, 58, 59, + 60, 61, 62, 63, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 64, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 65, 16, 16, 66, 16, 67, 68, 69, 16, 70, 71, 72, 16, 73, 16, 16, + 74, 75, 76, 77, 78, 16, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 16, 92, 93, 94, 95, + 16, 16, 16, 16, 96, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 97, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 98, 99, 16, 16, 100, 101, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 102, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 103, 104, 105, 106, 16, 16, 107, 108, 17, 17, 109, 16, + 16, 16, 16, 16, 16, 110, 111, 16, 16, 16, 16, 16, 112, 113, 16, 16, 114, 115, 116, 16, 117, + 118, 119, 17, 17, 17, 120, 121, 122, 123, 124, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 254, 255, 0, 252, 1, 0, 0, 248, 1, 0, 0, + 120, 0, 0, 0, 0, 255, 251, 223, 251, 0, 0, 128, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 252, 255, 224, 175, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 223, 255, 255, 255, 255, 255, 32, 64, 176, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 252, 3, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 252, 0, 0, 0, 0, 0, 230, 254, 255, 255, + 255, 0, 64, 73, 0, 0, 0, 0, 0, 24, 0, 255, 255, 0, 216, 0, 0, 0, 0, 0, 0, 0, 1, 0, 60, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 224, 1, 30, 0, 96, 255, 191, 0, 0, 0, 0, 0, 0, 255, 7, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 248, 207, 227, 0, 0, 0, 3, 0, 32, 255, 127, 0, + 0, 0, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 7, 252, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 16, 0, 32, 30, 0, 48, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 32, 0, 0, 0, 0, 252, 111, 0, 0, 0, + 0, 0, 0, 0, 16, 0, 32, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 32, 0, 0, 0, 0, 3, 224, + 0, 0, 0, 0, 0, 0, 0, 16, 0, 32, 0, 0, 0, 0, 253, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, + 255, 7, 16, 0, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 128, 255, 16, 0, 0, 0, 0, 0, 0, 16, 0, 32, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 160, 0, 127, 0, 0, 255, 3, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 4, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 128, 0, 128, 192, 223, 0, 12, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 4, 0, 31, 0, 0, 0, 0, 0, 0, 254, 255, 255, 255, 0, 252, 255, 255, 0, 0, 0, 0, 0, 0, + 0, 0, 252, 0, 0, 0, 0, 0, 0, 192, 255, 223, 255, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 6, 0, + 252, 0, 0, 0, 0, 0, 0, 0, 0, 0, 192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 224, 255, 255, 255, 31, 0, 0, 255, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 96, 0, 0, 1, 0, 0, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 56, 0, 0, 0, 0, + 16, 0, 0, 0, 112, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 0, 0, 254, 127, 47, 0, 0, + 255, 3, 255, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 196, 255, 255, 255, 255, 0, 0, 0, 192, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 224, 159, 0, 0, 0, 0, 127, + 63, 255, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 16, 0, 0, 252, 255, 255, 255, + 31, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 64, 0, 12, 240, 0, 0, 0, 0, 0, 0, 128, 248, 0, 0, 0, + 0, 0, 0, 0, 192, 0, 0, 0, 0, 0, 0, 0, 0, 255, 0, 255, 255, 255, 33, 144, 3, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 127, 0, 224, 251, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 160, 3, 224, 0, 224, 0, 224, + 0, 96, 128, 248, 255, 255, 255, 252, 255, 255, 255, 255, 255, 127, 223, 255, 241, 127, 255, + 127, 0, 0, 255, 255, 255, 255, 0, 0, 255, 255, 255, 255, 1, 0, 123, 3, 208, 193, 175, 66, 0, + 12, 31, 188, 255, 255, 0, 0, 0, 0, 0, 14, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 127, 0, 0, 0, 255, 7, 0, 0, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 63, 0, 0, 0, 0, 0, 0, 252, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 207, 255, 255, 255, 63, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 224, 135, 3, 254, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 128, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 127, 255, 255, 255, 255, + 0, 0, 0, 0, 0, 0, 255, 255, 255, 251, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 0, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 63, 0, 0, 0, 255, 15, 30, 255, 255, 255, 1, 252, 193, 224, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 15, 0, 0, 0, 255, + 255, 255, 127, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 127, 0, 0, 0, 0, 0, 0, 192, + 0, 224, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 15, 112, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 255, 0, 255, 255, 127, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 15, 255, 3, 0, 0, 0, 0, 0, 0, 240, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 16, 192, 0, 0, 255, 255, 3, 23, 0, 0, 0, 0, 0, 248, 0, 0, 0, 0, 8, 128, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 8, 0, 255, 63, 0, 192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 240, 0, 0, 128, 3, 0, + 0, 0, 0, 0, 0, 0, 128, 2, 0, 0, 192, 0, 0, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 56, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 252, 255, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 192, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 255, 255, 255, 3, 255, 255, + 255, 255, 255, 255, 247, 255, 127, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, + 254, 255, 0, 252, 1, 0, 0, 248, 1, 0, 0, 248, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 127, 127, 0, 48, 135, 255, 255, 255, 255, 255, 143, 255, 0, 0, 0, 0, 0, 0, 224, 255, 255, 127, + 255, 15, 1, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 15, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 128, 255, 0, 0, 128, 255, 0, 0, 0, 0, 128, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 248, 0, 0, + 192, 143, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 255, 255, 252, 255, + 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 135, 255, 1, 255, 1, 0, 0, 0, 224, 0, 0, 0, 224, 0, 0, + 0, 0, 0, 1, 0, 0, 96, 248, 127, 0, 0, 0, 0, 0, 0, 0, 0, 254, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, + 0, 30, 0, 254, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 252, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, + 255, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 224, 127, 0, 0, 0, 192, 255, + 255, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 192, 63, 252, 255, 63, 0, 0, 128, 3, 0, 0, 0, 0, 0, 0, 254, 3, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 24, 0, 15, 0, 0, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 225, 63, 0, 232, 254, 255, + 31, 0, 0, 0, 0, 0, 0, 0, 96, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, + 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 32, 0, 0, 192, 31, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 248, 0, 104, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 76, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, + 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 14, 0, 0, 0, 255, 31, 0, 0, 0, 0, 0, 0, + 0, 0, 192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 252, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 252, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 128, 255, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 223, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 62, 0, 0, + 252, 255, 31, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 52, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 3, 128, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 255, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 63, + 0, 0, 0, 0, 0, 0, 0, 255, 255, 48, 0, 0, 248, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 7, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 176, 15, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 63, 0, 255, 255, + 255, 255, 127, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 1, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 63, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 15, 0, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 127, 0, 255, 255, 255, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 8, 0, 0, 0, + 8, 0, 0, 32, 0, 0, 0, 32, 0, 0, 128, 0, 0, 0, 128, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 8, 0, 0, 0, 0, + 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 15, 0, 248, 254, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 127, 0, 0, 128, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 240, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 255, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 112, 7, 0, 192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 254, 255, 255, 255, 255, 255, 255, 255, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 254, 255, 255, 255, 255, 255, 255, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 3, 0, 255, 255, 255, 255, 255, 15, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 15, 0, 255, 127, 254, 255, 254, 255, 254, 255, 255, 255, 63, 0, 255, 31, 255, 255, + 255, 255, 0, 0, 0, 252, 0, 0, 0, 28, 0, 0, 0, 252, 255, 255, 255, 31, 0, 0, 0, 0, 0, 0, 192, + 255, 255, 255, 7, 0, 255, 255, 255, 255, 255, 15, 255, 1, 3, 0, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 63, 0, 255, 31, 255, 7, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 0, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 1, 255, 15, 0, 0, 255, 15, 255, 255, 255, 255, 255, 255, + 255, 0, 255, 3, 255, 255, 255, 255, 255, 0, 255, 255, 255, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 255, 239, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 123, 252, 255, 255, 255, + 255, 231, 199, 255, 255, 255, 231, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 15, 0, 255, 63, 15, 7, 7, 0, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ]; diff --git a/src/ld_so/dso.rs b/src/ld_so/dso.rs index f09d5df900..3161c3af9a 100644 --- a/src/ld_so/dso.rs +++ b/src/ld_so/dso.rs @@ -16,10 +16,6 @@ use core::{ mem::{size_of, transmute}, ptr, slice, }; -use goblin::{ - elf::Elf, - error::{Error, Result}, -}; #[cfg(target_pointer_width = "32")] use goblin::elf32::{ header::ET_DYN, @@ -36,6 +32,10 @@ use goblin::elf64::{ section_header::{SHN_UNDEF, SHT_FINI_ARRAY, SHT_INIT_ARRAY}, sym, }; +use goblin::{ + elf::Elf, + error::{Error, Result}, +}; /// Use to represent a library as well as all the symbols that is loaded withen it. #[derive(Default)] diff --git a/src/ld_so/linker.rs b/src/ld_so/linker.rs index ab52f6375c..ba052f6419 100644 --- a/src/ld_so/linker.rs +++ b/src/ld_so/linker.rs @@ -28,8 +28,7 @@ use super::{ debug::{RTLDState, _dl_debug_state, _r_debug}, dso::{is_pie_enabled, DSO}, tcb::{round_up, Master, Tcb}, - ExpectTlsFree, - PATH_SEP, + ExpectTlsFree, PATH_SEP, }; #[derive(Clone, Copy, Debug)] @@ -84,9 +83,10 @@ impl Linker { obj.use_count += 1; return Ok(*id); } else { - let parent_runpath = &self.objects.get(&root_id).and_then(|parent| { - parent.runpath.clone() - }); + let parent_runpath = &self + .objects + .get(&root_id) + .and_then(|parent| parent.runpath.clone()); let lib_id = self.next_object_id; self.load_object(name, parent_runpath, None, true)?; @@ -350,7 +350,10 @@ impl Linker { if let Some((s, strong)) = lookup_obj.get_sym(name) { trace!( "symbol {} from {} found in {} ({})", - name, obj.name, lookup_obj.name, if strong { "strong" } else { "weak" } + name, + obj.name, + lookup_obj.name, + if strong { "strong" } else { "weak" } ); symbol = Some(s); t = lookup_obj.tls_offset; @@ -486,7 +489,10 @@ impl Linker { for obj in objects.iter().rev() { if let Some((symbol, true)) = obj.get_sym("__relibc_init_environ") { unsafe { - symbol.as_ptr().cast::<*mut *mut c_char>().write(platform::environ); + symbol + .as_ptr() + .cast::<*mut *mut c_char>() + .write(platform::environ); } } diff --git a/src/ld_so/mod.rs b/src/ld_so/mod.rs index 01819030fa..f9c474f839 100644 --- a/src/ld_so/mod.rs +++ b/src/ld_so/mod.rs @@ -47,7 +47,10 @@ impl ExpectTlsFree for Result { fn expect_notls(self, msg: &str) -> T { match self { Ok(t) => t, - Err(err) => panic_notls(format_args!("{}: expect failed for Result with err: {:?}", msg, err)), + Err(err) => panic_notls(format_args!( + "{}: expect failed for Result with err: {:?}", + msg, err + )), } } } @@ -122,9 +125,9 @@ pub fn static_init(sp: &'static Stack) { let tcb = Tcb::new(vsize).expect_notls("failed to allocate TCB"); tcb.masters_ptr = &mut STATIC_TCB_MASTER; tcb.masters_len = mem::size_of::(); - tcb.copy_masters().expect_notls("failed to copy TLS master data"); + tcb.copy_masters() + .expect_notls("failed to copy TLS master data"); tcb.activate(); - } //TODO: Warning on multiple TLS sections? @@ -155,11 +158,13 @@ pub unsafe fn init(sp: &'static Stack) { { let mut env = syscall::EnvRegisters::default(); - let file = syscall::open("thisproc:current/regs/env", syscall::O_CLOEXEC | syscall::O_RDONLY) - .expect_notls("failed to open handle for process registers"); + let file = syscall::open( + "thisproc:current/regs/env", + syscall::O_CLOEXEC | syscall::O_RDONLY, + ) + .expect_notls("failed to open handle for process registers"); - let _ = syscall::read(file, &mut env) - .expect_notls("failed to read gsbase"); + let _ = syscall::read(file, &mut env).expect_notls("failed to read gsbase"); let _ = syscall::close(file); @@ -169,11 +174,13 @@ pub unsafe fn init(sp: &'static Stack) { { let mut env = syscall::EnvRegisters::default(); - let file = syscall::open("thisproc:current/regs/env", syscall::O_CLOEXEC | syscall::O_RDONLY) - .expect_notls("failed to open handle for process registers"); + let file = syscall::open( + "thisproc:current/regs/env", + syscall::O_CLOEXEC | syscall::O_RDONLY, + ) + .expect_notls("failed to open handle for process registers"); - let _ = syscall::read(file, &mut env) - .expect_notls("failed to read fsbase"); + let _ = syscall::read(file, &mut env).expect_notls("failed to read fsbase"); let _ = syscall::close(file); diff --git a/src/ld_so/start.rs b/src/ld_so/start.rs index 4a395ffec4..29a88d740a 100644 --- a/src/ld_so/start.rs +++ b/src/ld_so/start.rs @@ -10,8 +10,8 @@ use alloc::{ use crate::{ c_str::CStr, - header::{sys_auxv::AT_NULL, unistd}, - platform::{get_auxvs, get_auxv, new_mspace, types::c_char}, + header::unistd, + platform::{get_auxv, get_auxvs, new_mspace, types::c_char}, start::Stack, sync::mutex::Mutex, ALLOCATOR, @@ -155,17 +155,21 @@ pub extern "C" fn relibc_ld_so_start(sp: &'static mut Stack, ld_entry: usize) -> }; unsafe { - crate::platform::OUR_ENVIRON = envs.iter().map(|(k, v)| { - let mut var = Vec::with_capacity(k.len() + v.len() + 2); - var.extend(k.as_bytes()); - var.push(b'='); - var.extend(v.as_bytes()); - var.push(b'\0'); - let mut var = var.into_boxed_slice(); - let ptr = var.as_mut_ptr(); - core::mem::forget(var); - ptr.cast() - }).chain(core::iter::once(core::ptr::null_mut())).collect::>(); + crate::platform::OUR_ENVIRON = envs + .iter() + .map(|(k, v)| { + let mut var = Vec::with_capacity(k.len() + v.len() + 2); + var.extend(k.as_bytes()); + var.push(b'='); + var.extend(v.as_bytes()); + var.push(b'\0'); + let mut var = var.into_boxed_slice(); + let ptr = var.as_mut_ptr(); + core::mem::forget(var); + ptr.cast() + }) + .chain(core::iter::once(core::ptr::null_mut())) + .collect::>(); crate::platform::environ = crate::platform::OUR_ENVIRON.as_mut_ptr(); } diff --git a/src/ld_so/tcb.rs b/src/ld_so/tcb.rs index 7b7f1f2307..51f0784182 100644 --- a/src/ld_so/tcb.rs +++ b/src/ld_so/tcb.rs @@ -1,11 +1,10 @@ -use core::{mem, ptr, slice}; -use core::arch::asm; use alloc::vec::Vec; +use core::{arch::asm, mem, ptr, slice}; use goblin::error::{Error, Result}; use crate::{ header::sys_mman, - ld_so::{linker::Linker, ExpectTlsFree}, + ld_so::linker::Linker, platform::{Pal, Sys}, sync::mutex::Mutex, }; @@ -195,7 +194,9 @@ impl Tcb { /// OS specific code to create a new TLS and TCB - Linux and Redox #[cfg(any(target_os = "linux", target_os = "redox"))] - unsafe fn os_new(size: usize) -> Result<(&'static mut [u8], &'static mut [u8], &'static mut [u8])> { + unsafe fn os_new( + size: usize, + ) -> Result<(&'static mut [u8], &'static mut [u8], &'static mut [u8])> { let page_size = Sys::getpagesize(); let abi_tls_tcb = Self::map(page_size + size + page_size)?; let (abi, tls_tcb) = abi_tls_tcb.split_at_mut(page_size); @@ -271,16 +272,17 @@ impl Tcb { unsafe fn os_arch_activate(tls_end: usize, _tls_len: usize) { let mut env = syscall::EnvRegisters::default(); - let file = syscall::open("thisproc:current/regs/env", syscall::O_CLOEXEC | syscall::O_RDWR) - .expect_notls("failed to open handle for process registers"); + let file = syscall::open( + "thisproc:current/regs/env", + syscall::O_CLOEXEC | syscall::O_RDWR, + ) + .expect_notls("failed to open handle for process registers"); - let _ = syscall::read(file, &mut env) - .expect_notls("failed to read gsbase"); + let _ = syscall::read(file, &mut env).expect_notls("failed to read gsbase"); env.gsbase = tls_end as u32; - let _ = syscall::write(file, &env) - .expect_notls("failed to write gsbase"); + let _ = syscall::write(file, &env).expect_notls("failed to write gsbase"); let _ = syscall::close(file); } @@ -290,16 +292,17 @@ impl Tcb { unsafe fn os_arch_activate(tls_end: usize, _tls_len: usize) { let mut env = syscall::EnvRegisters::default(); - let file = syscall::open("thisproc:current/regs/env", syscall::O_CLOEXEC | syscall::O_RDWR) - .expect_notls("failed to open handle for process registers"); + let file = syscall::open( + "thisproc:current/regs/env", + syscall::O_CLOEXEC | syscall::O_RDWR, + ) + .expect_notls("failed to open handle for process registers"); - let _ = syscall::read(file, &mut env) - .expect_notls("failed to read fsbase"); + let _ = syscall::read(file, &mut env).expect_notls("failed to read fsbase"); env.fsbase = tls_end as u64; - let _ = syscall::write(file, &env) - .expect_notls("failed to write fsbase"); + let _ = syscall::write(file, &env).expect_notls("failed to write fsbase"); let _ = syscall::close(file); } diff --git a/src/platform/allocator/dlmalloc.rs b/src/platform/allocator/dlmalloc.rs index 329df7389a..c942685598 100644 --- a/src/platform/allocator/dlmalloc.rs +++ b/src/platform/allocator/dlmalloc.rs @@ -12,10 +12,10 @@ extern "C" { fn mspace_memalign(msp: usize, alignment: size_t, bytes: size_t) -> *mut c_void; fn mspace_realloc(msp: usize, oldmem: *mut c_void, bytes: size_t) -> *mut c_void; fn mspace_free(msp: usize, mem: *mut c_void); -//fn dlmalloc(bytes: size_t) -> *mut c_void; -//fn dlmemalign(alignment: size_t, bytes: size_t) -> *mut c_void; -//fn dlrealloc(oldmem: *mut c_void, bytes: size_t) -> *mut c_void; -//fn dlfree(mem: *mut c_void); + //fn dlmalloc(bytes: size_t) -> *mut c_void; + //fn dlmemalign(alignment: size_t, bytes: size_t) -> *mut c_void; + //fn dlrealloc(oldmem: *mut c_void, bytes: size_t) -> *mut c_void; + //fn dlfree(mem: *mut c_void); } pub struct Allocator { diff --git a/src/platform/mod.rs b/src/platform/mod.rs index 09d4e7986b..b6e7918d1e 100644 --- a/src/platform/mod.rs +++ b/src/platform/mod.rs @@ -1,6 +1,5 @@ use crate::io::{self, Read, Write}; -use alloc::boxed::Box; -use alloc::vec::Vec; +use alloc::{boxed::Box, vec::Vec}; use core::{fmt, ptr}; pub use self::allocator::*; @@ -283,7 +282,10 @@ pub unsafe fn get_auxvs(mut ptr: *const usize) -> Box<[[usize; 2]]> { auxvs.into_boxed_slice() } pub fn get_auxv(auxvs: &[[usize; 2]], key: usize) -> Option { - auxvs.binary_search_by_key(&key, |[entry_key, _]| *entry_key).ok().map(|idx| auxvs[idx][1]) + auxvs + .binary_search_by_key(&key, |[entry_key, _]| *entry_key) + .ok() + .map(|idx| auxvs[idx][1]) } #[cold] @@ -291,8 +293,12 @@ pub fn get_auxv(auxvs: &[[usize; 2]], key: usize) -> Option { pub fn init(auxvs: Box<[[usize; 2]]>) { use self::auxv_defs::*; - if let (Some(cwd_ptr), Some(cwd_len)) = (get_auxv(&auxvs, AT_REDOX_INITIALCWD_PTR), get_auxv(&auxvs, AT_REDOX_INITIALCWD_LEN)) { - let cwd_bytes: &'static [u8] = unsafe { core::slice::from_raw_parts(cwd_ptr as *const u8, cwd_len) }; + if let (Some(cwd_ptr), Some(cwd_len)) = ( + get_auxv(&auxvs, AT_REDOX_INITIALCWD_PTR), + get_auxv(&auxvs, AT_REDOX_INITIALCWD_LEN), + ) { + let cwd_bytes: &'static [u8] = + unsafe { core::slice::from_raw_parts(cwd_ptr as *const u8, cwd_len) }; if let Ok(cwd) = core::str::from_utf8(cwd_bytes) { self::sys::path::setcwd_manual(cwd.into()); } diff --git a/src/platform/pte.rs b/src/platform/pte.rs index b8a774d69c..02a08bbdf8 100644 --- a/src/platform/pte.rs +++ b/src/platform/pte.rs @@ -347,7 +347,7 @@ pub unsafe extern "C" fn pte_osSemaphorePend( handle: pte_osSemaphoreHandle, pTimeout: *mut c_uint, ) -> pte_osResult { - let timeout_opt = if ! pTimeout.is_null() { + let timeout_opt = if !pTimeout.is_null() { let timeout = *pTimeout as i64; let tv_sec = timeout / 1000; let tv_nsec = (timeout % 1000) * 1000000; diff --git a/src/platform/redox/clone.rs b/src/platform/redox/clone.rs index 40dc9f66fe..05c0a90cfc 100644 --- a/src/platform/redox/clone.rs +++ b/src/platform/redox/clone.rs @@ -1,13 +1,13 @@ -use core::arch::global_asm; -use core::mem::size_of; +use core::{arch::global_asm, mem::size_of}; -use alloc::boxed::Box; -use alloc::vec::Vec; +use alloc::{boxed::Box, vec::Vec}; -use syscall::data::Map; -use syscall::flag::{MapFlags, O_CLOEXEC}; -use syscall::error::{Error, Result, EINVAL, ENAMETOOLONG}; -use syscall::SIGCONT; +use syscall::{ + data::Map, + error::{Error, Result, EINVAL, ENAMETOOLONG}, + flag::{MapFlags, O_CLOEXEC}, + SIGCONT, +}; use super::extra::{create_set_addr_space_buf, FdGuard}; @@ -25,7 +25,15 @@ pub unsafe fn pte_clone_impl(stack: *mut usize) -> Result { const SIGSTACK_SIZE: usize = 1024 * 256; // TODO: Put sigstack at high addresses? - let target_sigstack = syscall::fmap(!0, &Map { address: 0, flags: MapFlags::PROT_READ | MapFlags::PROT_WRITE | MapFlags::MAP_PRIVATE, offset: 0, size: SIGSTACK_SIZE })? + SIGSTACK_SIZE; + let target_sigstack = syscall::fmap( + !0, + &Map { + address: 0, + flags: MapFlags::PROT_READ | MapFlags::PROT_WRITE | MapFlags::MAP_PRIVATE, + offset: 0, + size: SIGSTACK_SIZE, + }, + )? + SIGSTACK_SIZE; let _ = syscall::write(*sigstack_fd, &usize::to_ne_bytes(target_sigstack))?; } @@ -37,7 +45,11 @@ pub unsafe fn pte_clone_impl(stack: *mut usize) -> Result { let cur_addr_space_fd = FdGuard::new(syscall::dup(*cur_pid_fd, b"addrspace")?); let new_addr_space_sel_fd = FdGuard::new(syscall::dup(*new_pid_fd, b"current-addrspace")?); - let buf = create_set_addr_space_buf(*cur_addr_space_fd, __relibc_internal_pte_clone_ret as usize, stack as usize); + let buf = create_set_addr_space_buf( + *cur_addr_space_fd, + __relibc_internal_pte_clone_ret as usize, + stack as usize, + ); let _ = syscall::write(*new_addr_space_sel_fd, &buf)?; } @@ -46,7 +58,10 @@ pub unsafe fn pte_clone_impl(stack: *mut usize) -> Result { let cur_filetable_fd = FdGuard::new(syscall::dup(*cur_pid_fd, b"filetable")?); let new_filetable_sel_fd = FdGuard::new(syscall::dup(*new_pid_fd, b"current-filetable")?); - let _ = syscall::write(*new_filetable_sel_fd, &usize::to_ne_bytes(*cur_filetable_fd))?; + let _ = syscall::write( + *new_filetable_sel_fd, + &usize::to_ne_bytes(*cur_filetable_fd), + )?; } // Reuse sigactions (on Linux, CLONE_THREAD requires CLONE_SIGHAND which implies the sigactions @@ -55,7 +70,10 @@ pub unsafe fn pte_clone_impl(stack: *mut usize) -> Result { let cur_sigaction_fd = FdGuard::new(syscall::dup(*cur_pid_fd, b"sigactions")?); let new_sigaction_sel_fd = FdGuard::new(syscall::dup(*new_pid_fd, b"current-sigactions")?); - let _ = syscall::write(*new_sigaction_sel_fd, &usize::to_ne_bytes(*cur_sigaction_fd))?; + let _ = syscall::write( + *new_sigaction_sel_fd, + &usize::to_ne_bytes(*cur_sigaction_fd), + )?; } copy_env_regs(*cur_pid_fd, *new_pid_fd)?; @@ -72,7 +90,8 @@ extern "C" { } #[cfg(target_arch = "aarch64")] -core::arch::global_asm!(" +core::arch::global_asm!( + " .globl __relibc_internal_pte_clone_ret .type __relibc_internal_pte_clone_ret, @function .p2align 6 @@ -91,10 +110,12 @@ __relibc_internal_pte_clone_ret: ret .size __relibc_internal_pte_clone_ret, . - __relibc_internal_pte_clone_ret -"); +" +); #[cfg(target_arch = "x86")] -core::arch::global_asm!(" +core::arch::global_asm!( + " .globl __relibc_internal_pte_clone_ret .type __relibc_internal_pte_clone_ret, @function .p2align 6 @@ -116,10 +137,12 @@ __relibc_internal_pte_clone_ret: ret .size __relibc_internal_pte_clone_ret, . - __relibc_internal_pte_clone_ret -"); +" +); #[cfg(target_arch = "x86_64")] -core::arch::global_asm!(" +core::arch::global_asm!( + " .globl __relibc_internal_pte_clone_ret .type __relibc_internal_pte_clone_ret, @function .p2align 6 @@ -147,4 +170,5 @@ __relibc_internal_pte_clone_ret: ret .size __relibc_internal_pte_clone_ret, . - __relibc_internal_pte_clone_ret -"); \ No newline at end of file +" +); diff --git a/src/platform/redox/exec.rs b/src/platform/redox/exec.rs index 3ddd9a34d7..a8b97ec9ff 100644 --- a/src/platform/redox/exec.rs +++ b/src/platform/redox/exec.rs @@ -1,15 +1,26 @@ -use crate::c_str::{CStr, CString}; -use crate::core_io::{BufReader, prelude::*, SeekFrom}; -use crate::fs::File; -use crate::header::{fcntl, string::strlen}; -use crate::platform::{sys::{S_ISUID, S_ISGID}, types::*}; +use crate::{ + c_str::{CStr, CString}, + core_io::{prelude::*, BufReader, SeekFrom}, + fs::File, + header::{fcntl, string::strlen}, + platform::{ + sys::{S_ISGID, S_ISUID}, + types::*, + }, +}; -use syscall::data::Stat; -use syscall::flag::*; -use syscall::error::*; -use redox_exec::{FdGuard, ExtraInfo, FexecResult}; +use redox_exec::{ExtraInfo, FdGuard, FexecResult}; +use syscall::{data::Stat, error::*, flag::*}; -fn fexec_impl(file: File, path: &[u8], args: &[&[u8]], envs: &[&[u8]], total_args_envs_size: usize, extrainfo: &ExtraInfo, interp_override: Option) -> Result { +fn fexec_impl( + file: File, + path: &[u8], + args: &[&[u8]], + envs: &[&[u8]], + total_args_envs_size: usize, + extrainfo: &ExtraInfo, + interp_override: Option, +) -> Result { let fd = *file; core::mem::forget(file); let image_file = FdGuard::new(fd as usize); @@ -17,9 +28,24 @@ fn fexec_impl(file: File, path: &[u8], args: &[&[u8]], envs: &[&[u8]], total_arg let open_via_dup = FdGuard::new(syscall::open("thisproc:current/open_via_dup", 0)?); let memory = FdGuard::new(syscall::open("memory:", 0)?); - let addrspace_selection_fd = match redox_exec::fexec_impl(image_file, open_via_dup, &memory, path, args.iter().rev(), envs.iter().rev(), total_args_envs_size, extrainfo, interp_override)? { + let addrspace_selection_fd = match redox_exec::fexec_impl( + image_file, + open_via_dup, + &memory, + path, + args.iter().rev(), + envs.iter().rev(), + total_args_envs_size, + extrainfo, + interp_override, + )? { FexecResult::Normal { addrspace_handle } => addrspace_handle, - FexecResult::Interp { image_file, open_via_dup, path, interp_override: new_interp_override } => { + FexecResult::Interp { + image_file, + open_via_dup, + path, + interp_override: new_interp_override, + } => { drop(image_file); drop(open_via_dup); drop(memory); @@ -28,7 +54,15 @@ fn fexec_impl(file: File, path: &[u8], args: &[&[u8]], envs: &[&[u8]], total_arg // null-terminated. Violating this should therefore give the "format error" ENOEXEC. let path_cstr = CStr::from_bytes_with_nul(&path).map_err(|_| Error::new(ENOEXEC))?; - return execve(path_cstr, ArgEnv::Parsed { total_args_envs_size, args, envs }, Some(new_interp_override)); + return execve( + path_cstr, + ArgEnv::Parsed { + total_args_envs_size, + args, + envs, + }, + Some(new_interp_override), + ); } }; drop(memory); @@ -39,10 +73,21 @@ fn fexec_impl(file: File, path: &[u8], args: &[&[u8]], envs: &[&[u8]], total_arg unreachable!(); } pub enum ArgEnv<'a> { - C { argv: *const *mut c_char, envp: *const *mut c_char }, - Parsed { args: &'a [&'a [u8]], envs: &'a [&'a [u8]], total_args_envs_size: usize }, + C { + argv: *const *mut c_char, + envp: *const *mut c_char, + }, + Parsed { + args: &'a [&'a [u8]], + envs: &'a [&'a [u8]], + total_args_envs_size: usize, + }, } -pub fn execve(path: &CStr, arg_env: ArgEnv, interp_override: Option) -> Result { +pub fn execve( + path: &CStr, + arg_env: ArgEnv, + interp_override: Option, +) -> Result { // NOTE: We must omit O_CLOEXEC and close manually, otherwise it will be closed before we // have even read it! let mut image_file = File::open(path, O_RDONLY as c_int).map_err(|_| Error::new(ENOENT))?; @@ -85,7 +130,7 @@ pub fn execve(path: &CStr, arg_env: ArgEnv, interp_override: Option len = args.len(), } @@ -98,7 +143,10 @@ pub fn execve(path: &CStr, arg_env: ArgEnv, interp_override: Option break, i => read += i, } @@ -122,7 +170,9 @@ pub fn execve(path: &CStr, arg_env: ArgEnv, interp_override: Option, Vec<_>) = match arg_env { @@ -166,16 +218,23 @@ pub fn execve(path: &CStr, arg_env: ArgEnv, interp_override: Option { + ( + args_envs_size_without_nul + args.len() + envs.len(), + args, + envs, + ) + }, + ArgEnv::Parsed { + args: new_args, + envs, + total_args_envs_size, + } => { let prev_size: usize = args.iter().map(|a| a.len()).sum(); args.extend(new_args); (total_args_envs_size + prev_size, args, Vec::from(envs)) } }; - // Close all O_CLOEXEC file descriptors. TODO: close_range? { // NOTE: This approach of implementing O_CLOEXEC will not work in multithreaded @@ -238,10 +297,21 @@ pub fn execve(path: &CStr, arg_env: ArgEnv, interp_override: Option(iter: impl IntoIterator) -> Box<[u8]> where T: AsRef<[u8]> { +fn flatten_with_nul(iter: impl IntoIterator) -> Box<[u8]> +where + T: AsRef<[u8]>, +{ let mut vec = Vec::new(); for item in iter { vec.extend(item.as_ref()); diff --git a/src/platform/redox/mod.rs b/src/platform/redox/mod.rs index de3ac1453a..c6f66a8ca1 100644 --- a/src/platform/redox/mod.rs +++ b/src/platform/redox/mod.rs @@ -1,11 +1,9 @@ -use core::{mem, ptr, result::Result as CoreResult, slice, str}; -use core::convert::TryFrom; -use core::arch::asm; +use core::{arch::asm, convert::TryFrom, mem, ptr, result::Result as CoreResult, slice, str}; use syscall::{ self, data::{Map, Stat as redox_stat, StatVfs as redox_statvfs, TimeSpec as redox_timespec}, - PtraceEvent, Result, Error, EMFILE, + Error, PtraceEvent, Result, EMFILE, }; use crate::{ @@ -217,12 +215,12 @@ impl Pal for Sys { loop {} } - unsafe fn execve( - path: &CStr, - argv: *const *mut c_char, - envp: *const *mut c_char, - ) -> c_int { - e(self::exec::execve(path, self::exec::ArgEnv::C { argv, envp }, None)) as c_int + unsafe fn execve(path: &CStr, argv: *const *mut c_char, envp: *const *mut c_char) -> c_int { + e(self::exec::execve( + path, + self::exec::ArgEnv::C { argv, envp }, + None, + )) as c_int } fn fchdir(fd: c_int) -> c_int { @@ -364,13 +362,17 @@ impl Pal for Sys { let buf_slice = unsafe { slice::from_raw_parts_mut(buf as *mut u8, size as usize) }; if buf_slice.is_empty() { - unsafe { errno = EINVAL; } + unsafe { + errno = EINVAL; + } return ptr::null_mut(); } if path::getcwd(buf_slice).is_none() { - unsafe { errno = ERANGE; } - return ptr::null_mut() + unsafe { + errno = ERANGE; + } + return ptr::null_mut(); } buf @@ -712,16 +714,17 @@ impl Pal for Sys { fn open(path: &CStr, oflag: c_int, mode: mode_t) -> c_int { let path = path_from_c_str!(path); - match path::open(path, ((oflag as usize) & 0xFFFF_0000) | ((mode as usize) & 0xFFFF)) { - Ok(fd) => { - match c_int::try_from(fd) { - Ok(c_fd) => c_fd, - Err(_) => { - let _ = syscall::close(fd); - e(Err(Error::new(EMFILE))) as c_int - } + match path::open( + path, + ((oflag as usize) & 0xFFFF_0000) | ((mode as usize) & 0xFFFF), + ) { + Ok(fd) => match c_int::try_from(fd) { + Ok(c_fd) => c_fd, + Err(_) => { + let _ = syscall::close(fd); + e(Err(Error::new(EMFILE))) as c_int } - } + }, Err(error) => e(Err(error)) as c_int, } } @@ -747,7 +750,10 @@ impl Pal for Sys { } fn readlink(pathname: &CStr, out: &mut [u8]) -> ssize_t { - match File::open(pathname, fcntl::O_RDONLY | fcntl::O_SYMLINK | fcntl::O_CLOEXEC) { + match File::open( + pathname, + fcntl::O_RDONLY | fcntl::O_SYMLINK | fcntl::O_CLOEXEC, + ) { Ok(file) => Self::read(*file, out), Err(_) => return -1, } diff --git a/src/platform/redox/path.rs b/src/platform/redox/path.rs index fd2cc613ba..31d2537554 100644 --- a/src/platform/redox/path.rs +++ b/src/platform/redox/path.rs @@ -1,11 +1,11 @@ -use syscall::data::Stat; -use syscall::error::*; -use syscall::flag::*; +use syscall::{data::Stat, error::*, flag::*}; -use alloc::borrow::{Cow, ToOwned}; -use alloc::boxed::Box; -use alloc::string::String; -use alloc::vec::Vec; +use alloc::{ + borrow::{Cow, ToOwned}, + boxed::Box, + string::String, + vec::Vec, +}; use super::FdGuard; use crate::sync::Mutex; @@ -25,7 +25,7 @@ pub fn canonicalize_using_cwd<'a>(cwd_opt: Option<&str>, path: &'a str) -> Optio let mut canon = if !path.starts_with('/') { let mut c = cwd.to_owned(); - if ! c.ends_with('/') { + if !c.ends_with('/') { c.push('/'); } c @@ -41,7 +41,8 @@ pub fn canonicalize_using_cwd<'a>(cwd_opt: Option<&str>, path: &'a str) -> Optio // NOTE: assumes the scheme does not include anything like "../" or "./" let mut result = { - let parts = canon.split('/') + let parts = canon + .split('/') .rev() .scan(0, |nskip, part| { if part == "." { @@ -50,8 +51,8 @@ pub fn canonicalize_using_cwd<'a>(cwd_opt: Option<&str>, path: &'a str) -> Optio *nskip += 1; Some(None) } else if *nskip > 0 { - *nskip -= 1; - Some(None) + *nskip -= 1; + Some(None) } else { Some(Some(part)) } @@ -59,21 +60,17 @@ pub fn canonicalize_using_cwd<'a>(cwd_opt: Option<&str>, path: &'a str) -> Optio .filter_map(|x| x) .filter(|x| !x.is_empty()) .collect::>(); - parts - .iter() - .rev() - .fold(String::new(), |mut string, &part| { - string.push_str(part); - string.push('/'); - string - }) + parts.iter().rev().fold(String::new(), |mut string, &part| { + string.push_str(part); + string.push('/'); + string + }) }; result.pop(); // remove extra '/' // replace with the root of the scheme if it's empty Some(if result.is_empty() { - let pos = canon.find(':') - .map_or(canon.len(), |p| p + 1); + let pos = canon.find(':').map_or(canon.len(), |p| p + 1); canon.truncate(pos); canon } else { @@ -94,7 +91,8 @@ pub fn chdir(path: &str) -> Result<()> { let _siglock = SignalMask::lock(); let mut cwd_guard = CWD.lock(); - let canonicalized = canonicalize_using_cwd(cwd_guard.as_deref(), path).ok_or(Error::new(ENOENT))?; + let canonicalized = + canonicalize_using_cwd(cwd_guard.as_deref(), path).ok_or(Error::new(ENOENT))?; let fd = syscall::open(&canonicalized, O_STAT | O_CLOEXEC)?; let mut stat = Stat::default(); @@ -122,7 +120,9 @@ pub fn getcwd(buf: &mut [u8]) -> Option { let cwd = cwd_guard.as_deref().unwrap_or("").as_bytes(); // But is already checked not to be empty. - if buf.len() - 1 < cwd.len() { return None; } + if buf.len() - 1 < cwd.len() { + return None; + } buf[..cwd.len()].copy_from_slice(&cwd); buf[cwd.len()..].fill(0_u8); @@ -153,7 +153,8 @@ pub struct SignalMask { impl SignalMask { pub fn lock() -> Self { let mut oldset = [0; 2]; - syscall::sigprocmask(syscall::SIG_SETMASK, Some(&[!0, !0]), Some(&mut oldset)).expect("failed to run sigprocmask"); + syscall::sigprocmask(syscall::SIG_SETMASK, Some(&[!0, !0]), Some(&mut oldset)) + .expect("failed to run sigprocmask"); Self { oldset } } } @@ -180,11 +181,14 @@ pub fn open(path: &str, flags: usize) -> Result { let bytes_read = syscall::read(*resolve_fd, &mut resolve_buf)?; // TODO: make resolve_buf PATH_MAX + 1 bytes? - if bytes_read == resolve_buf.len() { return Err(Error::new(ENAMETOOLONG)); } + if bytes_read == resolve_buf.len() { + return Err(Error::new(ENAMETOOLONG)); + } // If the symbolic link path is non-UTF8, it cannot be opened, and is thus // considered a "dangling symbolic link". - path = core::str::from_utf8(&resolve_buf[..bytes_read]).map_err(|_| Error::new(ENOENT))?; + path = core::str::from_utf8(&resolve_buf[..bytes_read]) + .map_err(|_| Error::new(ENOENT))?; } Err(other_error) => return Err(other_error), } diff --git a/src/platform/redox/ptrace.rs b/src/platform/redox/ptrace.rs index e1020845cf..4216922180 100644 --- a/src/platform/redox/ptrace.rs +++ b/src/platform/redox/ptrace.rs @@ -53,7 +53,9 @@ pub fn init_state() -> &'static State { } pub fn is_traceme(pid: pid_t) -> bool { // Skip special PIDs (<=0) - if pid <= 0 { return false; } + if pid <= 0 { + return false; + } File::open( &CString::new(format!("chan:ptrace-relibc/{}/traceme", pid)).unwrap(), fcntl::O_PATH, diff --git a/src/platform/test/epoll.rs b/src/platform/test/epoll.rs index 58c750d197..8b13789179 100644 --- a/src/platform/test/epoll.rs +++ b/src/platform/test/epoll.rs @@ -1 +1 @@ -use crate::platform::{PalEpoll, Sys}; + diff --git a/src/platform/test/mod.rs b/src/platform/test/mod.rs index 0bcab03711..f8abdfb0f0 100644 --- a/src/platform/test/mod.rs +++ b/src/platform/test/mod.rs @@ -8,7 +8,7 @@ mod epoll; #[test] fn access() { - use crate::header::{errno, unistd}; + use crate::header::unistd; //TODO: create test files assert_eq!(Sys::access(c_str!("not a file!"), unistd::F_OK), !0); @@ -69,7 +69,7 @@ fn clock_gettime() { #[test] fn getrandom() { - use crate::{header::sys_random, platform::types::ssize_t}; + use crate::platform::types::ssize_t; let mut arrays = [[0; 32]; 32]; for i in 1..arrays.len() { diff --git a/src/start.rs b/src/start.rs index c03af9c56b..9f3f94e257 100644 --- a/src/start.rs +++ b/src/start.rs @@ -133,10 +133,27 @@ fn io_init() { fn setup_sigstack() { use syscall::{Map, MapFlags}; const SIGSTACK_SIZE: usize = 1024 * 256; - let sigstack = unsafe { syscall::fmap(!0, &Map { address: 0, offset: 0, flags: MapFlags::MAP_PRIVATE | MapFlags::PROT_READ | MapFlags::PROT_WRITE, size: SIGSTACK_SIZE }) }.expect("failed to allocate sigstack") + SIGSTACK_SIZE; + let sigstack = unsafe { + syscall::fmap( + !0, + &Map { + address: 0, + offset: 0, + flags: MapFlags::MAP_PRIVATE | MapFlags::PROT_READ | MapFlags::PROT_WRITE, + size: SIGSTACK_SIZE, + }, + ) + } + .expect("failed to allocate sigstack") + + SIGSTACK_SIZE; - let fd = syscall::open("thisproc:current/sigstack", syscall::O_WRONLY | syscall::O_CLOEXEC).expect("failed to open thisproc:current/sigstack"); - syscall::write(fd, &usize::to_ne_bytes(sigstack)).expect("failed to write to thisproc:current/sigstack"); + let fd = syscall::open( + "thisproc:current/sigstack", + syscall::O_WRONLY | syscall::O_CLOEXEC, + ) + .expect("failed to open thisproc:current/sigstack"); + syscall::write(fd, &usize::to_ne_bytes(sigstack)) + .expect("failed to write to thisproc:current/sigstack"); let _ = syscall::close(fd); } diff --git a/src/sync/mod.rs b/src/sync/mod.rs index dee4ac1831..0ba9373917 100644 --- a/src/sync/mod.rs +++ b/src/sync/mod.rs @@ -8,8 +8,10 @@ pub use self::{ semaphore::Semaphore, }; -use crate::header::time::timespec; -use crate::platform::{types::*, Pal, Sys}; +use crate::{ + header::time::timespec, + platform::{types::*, Pal, Sys}, +}; use core::{ cell::UnsafeCell, ops::Deref, @@ -38,14 +40,19 @@ impl AtomicLock { } } pub fn notify_one(&self) { - Sys::futex(unsafe { &mut *self.atomic.get() }.get_mut(), FUTEX_WAKE, 1, 0); + Sys::futex( + unsafe { &mut *self.atomic.get() }.get_mut(), + FUTEX_WAKE, + 1, + 0, + ); } pub fn notify_all(&self) { Sys::futex( unsafe { &mut *self.atomic.get() }.get_mut(), FUTEX_WAKE, c_int::max_value(), - 0 + 0, ); } pub fn wait_if(&self, value: c_int, timeout_opt: Option<×pec>) { @@ -53,7 +60,7 @@ impl AtomicLock { unsafe { &mut *self.atomic.get() }.get_mut(), FUTEX_WAIT, value, - timeout_opt.map_or(0, |timeout| timeout as *const timespec as usize) + timeout_opt.map_or(0, |timeout| timeout as *const timespec as usize), ); } diff --git a/src/sync/semaphore.rs b/src/sync/semaphore.rs index b4997a99a6..b9b00b4f82 100644 --- a/src/sync/semaphore.rs +++ b/src/sync/semaphore.rs @@ -2,9 +2,11 @@ //TODO: improve implementation use super::AtomicLock; -use crate::header::time::timespec; -use crate::platform::{types::*, Pal, Sys}; -use core::hint::spin_loop; +use crate::{ + header::time::timespec, + platform::{types::*, Pal, Sys}, +}; + use core::sync::atomic::Ordering; pub struct Semaphore { @@ -25,7 +27,10 @@ impl Semaphore { pub fn wait(&self, timeout_opt: Option<×pec>) { if let Some(timeout) = timeout_opt { - println!("semaphore wait tv_sec: {}, tv_nsec: {}", timeout.tv_sec, timeout.tv_nsec); + println!( + "semaphore wait tv_sec: {}, tv_nsec: {}", + timeout.tv_sec, timeout.tv_nsec + ); } loop { while self.lock.load(Ordering::Acquire) < 1 {