Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thread local storage #339

Merged
merged 26 commits into from
Aug 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
6c489ef
Kernel: TLS allocation
Orycterope Jun 8, 2019
7664199
Kernel: GDT array, fixed descriptors
Orycterope Jun 9, 2019
f2e7bda
Kernel: thread entrypoint fastcall ABI
Orycterope Jun 13, 2019
c47c047
Kernel: thread argument ABI + main thread handle
Orycterope Jun 14, 2019
d1b9b6f
Libuser: threads module
Orycterope Jun 13, 2019
145e24c
Libuser: save main thread's handle in TLS
Orycterope Jun 17, 2019
497f027
Shell: fix test_threads
Orycterope Jun 14, 2019
fdae89f
Kernel: MAIN_TSS safety
Orycterope Jul 9, 2019
c610eb9
Kernel: use 2 TLS segments
Orycterope Jul 9, 2019
03472ce
Kernel: panic takes a panic origin
Orycterope Jul 12, 2019
d391598
Kernel: generate_trap_gate_handler! macro
Orycterope Jul 17, 2019
1b10702
Kernel: syscalls use generate_trap_gate_handler!
Orycterope Jul 18, 2019
6ec33cd
Kernel: irqs use generate_trap_gate_handler!
Orycterope Jul 18, 2019
cbdda3f
Kernel: cpu_locals
Orycterope Jul 18, 2019
984b4a0
Kernel: CURRENT_THREAD is cpu-local
Orycterope Jul 20, 2019
f801f18
Libuser: #[thread_local]
Orycterope Jul 20, 2019
36db582
Merge remote-tracking branch 'upstream/master' into thread_local_storage
Orycterope Aug 1, 2019
55ccdf9
Kernel: fixup trap_gate_asm! constraint
Orycterope Jul 22, 2019
526810c
Kernel: open issue "per-cpu TSS / GDT"
Orycterope Jul 30, 2019
23b7729
Kernel: document MAIN_TASK locking guarantees
Orycterope Jul 31, 2019
0ee8da1
Kernel: open issue read_cr3 arch-independent
Orycterope Jul 31, 2019
e9420ca
Libuser: remove __start_tls__ from module_header
Orycterope Aug 5, 2019
aa1b5eb
TLS: safety notices
Orycterope Aug 5, 2019
7727135
Merge branch 'master' into thread_local_storage
Orycterope Aug 5, 2019
7c4efbb
TLS: fixup safety notices
Orycterope Aug 12, 2019
722e53f
Libuser: svcCreateThread is unsafe
Orycterope Aug 12, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions ahci/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ capabilities!(CAPABILITIES = Capabilities {
sunrise_libuser::syscalls::nr::CloseHandle,
sunrise_libuser::syscalls::nr::WaitSynchronization,
sunrise_libuser::syscalls::nr::OutputDebugString,
sunrise_libuser::syscalls::nr::SetThreadArea,

sunrise_libuser::syscalls::nr::SetHeapSize,
sunrise_libuser::syscalls::nr::QueryMemory,
Expand Down
3 changes: 2 additions & 1 deletion i386-unknown-none-user.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"env": "user",
"position-independent-executables": true,
"dynamic-linking": false,
"has-elf-tls": false,
"has-elf-tls": true,
"tls-model": "initial-exec",
"has-rpath": false,
"features": "-mmx,-sse,+soft-float",
"disable-redzone": true,
Expand Down
2 changes: 2 additions & 0 deletions i386-unknown-none.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
},
"relocation-model": "static",
"executables": true,
"has-elf-tls": true,
"tls-model": "initial-exec",
"features": "-mmx,-sse,+soft-float",
"disable-redzone": true,
"panic-strategy": "abort"
Expand Down
1 change: 1 addition & 0 deletions kernel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ rustc-demangle = "0.1"
failure = { version = "0.1", default-features = false, features = ["derive"] }
bitfield = { git = "https://github.com/sunriseos/rust-bitfield" }
mashup = "0.1.9"
tinybmp = "0.1.0"
acpi = { git = "https://github.com/sunriseos/acpi.git" }

[dependencies.smallvec]
Expand Down
Binary file added kernel/res/bsod.bmp
Binary file not shown.
Binary file added kernel/res/cpu_locals_segmentation_doc.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
55 changes: 55 additions & 0 deletions kernel/res/double_fault.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@


.
...

. ....',;:::cccclllllcccc::;,'''..
...';:loodxO0KKXNWWWMMMMMMMMMMMMMMMWWWNXX0x'
..';cox0KNNWMMMMMMMMMMMMWWMMMMMMMMMMMMMMMMMMMMWWO'
..,:ok0XNWMMMMWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWMMMWWk.
..;lx0NWWMMWMMMMMMMMMWWWNXK0OkdollllcccclloodxO0XNWMMMMMMd.
.. .. ..,ckKNMMWWMWWMMMMMWXKOkdc:;,'... . ..';cok0NWWo.
.. . .,lOXWMMMMWWMMWNX0kdl:'... . .,c:'. ..;lx:.
..'lOXWMMMWMMWNXOdc;'.. . . .dWWX0xoc,... ..
. . .:kXWMMWWWMWXOo:'. .. . . .kMWWMMMWN0kdc,. ..
.. .'lONWMWMMMWKx:.. .. . ... 'OWWMMMMMMMMWWN0d:'.. ..
..l0WMMWMMWXkc.. .. .. ... . .lO0k, 'x0KXXNWMMWMMMMMMWXOo'. ..
..c0NMMMMMWKo,. . .. ...... ,0MMX: ....'';:ldxOKNWMMMMMWXk:.
.;ONWWMMMW0l.. . . . .;dO0K0xo;. . .OMMNc... ...,cdOXWMMWWNk;.
.oXMWMMMWKo. . . .':c:,. . ,kNWWWWMMMK; .. .,kMMWl . .,cxXWWWWXd. . ..
. . ,kNWWMMWNx'. .... .lOXWWWXo..,0MNOo:kMWWWx. .;xKNWMWo. .'l0WWWWO, . ..
. .;0WMWMWNO;. .. .ok0d. .xNWN00WMK,.xMWx..'kMWWWO' .lXWOxNMWd. . 'oKWWW0;... .
. . .:0MMMMW0c. . . ;KWWK; .xWWWk'cNWO..d0d;:kXNMWMM0,.lNMK;,0MMd. . .:KMMW0, .
. . ,0MMMWWk, . . '0MMK; cNMWNc,0WK; ..,kNKoxNMWWX:'OWMx.,0WMx. . .. . . .lNMMWx. .
.. 'kWMMMNx. . ...,OMMX;.xWMWXxOWO; ,OWNl.:XWWWMl'OMMd,kNMMx. . . .OMMMNc ..
. . .oNWMMWx... . .;dKNMMN:.OWWMN0kl..',..oWWXooKWMMMMx'xWWKK0OXMk. . .,codl;. . oWWWMk. .
. ,KWMMWk' .oXWOkWWWc.kMMWk'..:ONNc.oNWWWWWWWWWWO',kKKd''dkc. .';,. .:kXWMMWXl. ;KWWMK, .
oWWWMX: . .dNM0,:NMWl.dWWWk,'xXWWK: .cxkxoc:okOOo. .'.. .. 'dXWK; .lXMMKx0WWk. ,0MMMK;
.kMMMWx. . ,KMWd.;XMWo ,0WWWKXWWNO;... .. ......'...,dl,. 'OWWWo.:NMMNl.xWNd. ... '0MMMX;
,KMMMX: . ,KMNo;kWMWd. ,dKNNXXOc. . ... . .'o0Xk,:KWNd. .. .xWMWo.kMMMO,lXWx' .. '0MMMK,
;XWMMO' . '0MWKKOONWd. .';,,'. ... ..lKWWW0;.cdc. . .,OMMWocXMWM0kNXo. . . ;XMMW0' .
. :XWMMk. . . .cOKKo.,kk;. . .. ..:lod'.;dOx, .dKNWWNO, .codl. .:OXNWMWdoNMMWXOd,..;'. . lWMMMx. .
;KMMMx. . .''. ... 'x0xcxNWWNxxXWWW0;lNMMWXl.. ,0MMK; .dXWkoXWWxoNMWXl. .l0NK: .kMMMNc .
'OMMMk. .. .. . .. .lXWO;oWWWMWNWWWWNkkNWMW0:.. .OWMX:.dWW0;,0WMx:0MMNl.;OWMW0, . cNMMMO'
.xMWM0, ...;l;.cNMMMNdcOWWMKc:lxKNX0x:.dMWNc,0WWd.,0WMk'oNMWNKXWWNk,.. ,0WWMWo.
lWWWNc .. . .:O0Xl:KWMMO' cNMWNl 'oKMWNkOWWWl;KMWd,kWWWO..l0WWWNXk:. ,OWMMWO,
. ,0WWMk. cNWWk;OWMMd. '0MMWd. . .xMMMXOXMMo'kMWXKOkXWO' ..;::,'. ;0WWWMX:.
..lNMMNl. . ;KWWO;xWMMd. .dWWWk. .oNMMXl;0WNx.:0XKx''xOl. . . ..cXMWWWXl. .
'OWMMK:. 'OWM0;oWMMx. .:XWWO' 'kNMW0: .d0x; .'.. .... .:ONMMWWXl. . .
. ;0WWMK:. .. . .kWWX;cNWWk. .'kWW0:'dWWXx' .... .. .,xXMMWWW0;.
. .. ;0WWWXl. . oWMNc;KMWk. .,od:..;c:,. . .;xXWMWWWNx'
. 'xNWWNk;. .. . cNWK:.:ol,. .. . . ...cONMMMMWN0:. .
. .. .cKWWWXx;. . .. .. .ll;. .. . . .;o0WMMMMMWKl.
.'oKWMMNkc'. ... . . ..;o0NMMMWWMW0l' ..
.. .'oKWMMWKkc'. ... .. ..,lxKNMMMMWMWXk:..
.'lONMWWWXOdc,... ..,:ok0NWMMMMMMMN0d;. ... ..
. .;d0NWWMMWNKOxol:;'.... ...',:loxOKNMMMMMWWMMMN0d;. . .. ..
..:d0NWWWWWMWWWNXK0OOkxddooooooodddxxkO0KXWWMMMMMMMMMWWWN0xl,..
..;ldOXWWWWMMWWMMMMMMMMMMMMMMMMMMMMMMMMMMMWWMMWWWKOdc,..
. .':lxOKXWMMMMMMMMMMMMWWMMMMMMWMMMWWNNX0kxl:,.. ...
.. ..';clodxOOO000KKK000OOkkxdolc;,...
................ .




40 changes: 40 additions & 0 deletions kernel/res/kernel_fault.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

````` ` ``` ```````
``` ````````````````````````````` ``````````` ````````````
``` ``````` ``````````````` `````````` ```````````````` ``` ```` `````
```````````` ``` ````` ++. .#@@@@ ```````` ````` `` ``` ``````````
``````` ````` ``````` :@@@@@@@@@@@@@@@@@@@@@@::::::,:,,:::: `````` .@@:
```` ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@,,:`````````.::@@@@##@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#';,,@@@@@@@@@@@@@@@:::`````````.: @@@@@@@@@@@@@@@@
@@@@@@@@@@@@ @@@@@@@@@@@@@@@:::`` ``````,:`@@@@@@@@@@@@@@@@
@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@,::```` ````:: @@@@@@@@@@@@@@@@
@@@@@@ #@@@@ @@@@@@@@#@@@@@@@@@ @@@@@@@@@@@@@@@:::`````` ``,, @@@@@@@@@@@@@@@@
@@@@@ @@@@ @@@@@` @@@@@@@ :;; @@@@@@@@@@@@@@@:::`````````:, @@@@@@@@@@ @@@@@
@@@@ @@@ @@@` +@@@ @@ ;;;:. ;,#@@@@@@@@@@@:::````` `` :: @@@@@@@@@@ ;@@@
@@@ @@@ @@` @@@@ @@: :;;:#@@@@@@@@@@@:,:,,,,,,.`:::+@@@@@@@@@@+ #@@
@@ `@@@ @ @@@ ;;;;;;;;`.::: @@@@@@@@`:::::::::::: @@@@@@@@@@@@ @@
@@ @@@ ' @@: ;;;:. ::;;;; ,`+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@' @@
+ ' @@@ ''; @ ;' @ ::;.`::;.@@ @@@@@@@@@@@@@@@@@@@,@@@@@@@@@ #
' @,@ ''' ''' :.@++@ : @ .@@@@@@@@@@@@@@@@@ @@@@@@@@@
' @@ ., ''''' '' ;@, @ .#@ ` .@@@@@@@: `@@@@@@@@ ;
`' @@ `'''''''; '' ;@ @`;:.;;;;: @@@@@@ ` @@@@@@@ ''
' ' @@ ;''''''''' :.@@@# ::;:;;;;:: @@@@@# ', .@@@@@` `''. '
'' '' @' ''''''''; ;;;;;;;;;:.``;::::;;..@'@@@ ' ......` @ ;''' ''
''''' .@ '''''''.,, `::;;;;;:;:;;;: @@++#@@@ @@ '' ': .' ++ '''''''
''''' @ '''''';.,, , :;;::;::;;;;;;; @@@@@@@ @ ` '''`'++++++ ''@@@@@@@@@
''''' ` ''''''',,, , ::: : :;;;;;;::, @@@@@+ ''@@ '++++++ ,@@@@@@@@@@
''''', ' ''''';;.,, , :::.: :;;;;;;;::,@@@@@, ; :@@@@ ;++++'+ @@@@@@@@@@@
'''''' ' ;;;;;;' ,, ,,,::;.:`;;;:;;;:.;'@@@@; '' ''@@@@@@@@@@@@@@@@@@@@@@@
''''''; '' ;;;;;;; ,,,,. ,:::`:, ,`;` `@@@# ;''''''''''+''''''''''''''''
'''''''. ''' ::::,,'; ,,,,,, `:::::` :: ,,`;:@'@# .'''''''''''''''''''''''''''
'''' ''';''; ;;;;''';;; ,,,,,,,,,,,, :;;` :;:: + `''''''''+''+'' ''''''''''
'''':''''''; ;;;; '';;' ```` :;::` ` @@ '''''''' `` ````````
'''';''''''' ,;; ;;;;;;;`,,..... `` ` ''' ''' ```````
'''''''''''' ; ;';;;;.,,.;;'' ,,;. ;;; '': ; '''' `````` ;
'':''.''''''' , ';' '';,,.;;;; ,,;, ;;';;;;;' `.;'` ````` .'
''.'' ''`' ''' ' ' ;;;,,.;;;' ,,;; ;;;;;;;;;;;; ` .' ```` ''
''''':'';'''''' '' ;;;,,.;;;; ,,;; ;;;;;;;';;` ''' `` '''
'''''',''`':''''; '''` ;;;` ;;;;;'; ,,;; ';;;;;;;;: :'''' ;''''
''''''''''''''''''''''' ``;'';;;;;;;;';;;;;;;;;;;;;;' ` ;'''''; '''''''
''''''''''''''''''''''', ;;;;;;;;;;;';;;;;;;;;;;;;;' '''''''', '''''''''
'''''''''''''''''''''; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;' ''''''''''':`''''''''''
Binary file added kernel/res/kernel_panic_doc.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading