@@ -14,7 +14,11 @@ pub type AddressType = *mut ::libc::c_void;
1414 target_os = "linux" ,
1515 any(
1616 all(
17- any( target_arch = "x86_64" , target_arch = "aarch64" ) ,
17+ any(
18+ target_arch = "x86_64" ,
19+ target_arch = "aarch64" ,
20+ target_arch = "loongarch64" ,
21+ ) ,
1822 any( target_env = "gnu" , target_env = "musl" )
1923 ) ,
2024 all( target_arch = "x86" , target_env = "gnu" ) ,
@@ -179,6 +183,7 @@ libc_enum! {
179183 target_arch = "x86" ,
180184 target_arch = "aarch64" ,
181185 target_arch = "riscv64" ,
186+ target_arch = "loongarch64" ,
182187 )
183188) ) ]
184189libc_enum ! {
@@ -202,6 +207,7 @@ libc_enum! {
202207 target_arch = "x86" ,
203208 target_arch = "aarch64" ,
204209 target_arch = "riscv64" ,
210+ target_arch = "loongarch64" ,
205211 )
206212) ) ]
207213/// Represents register set areas, such as general-purpose registers or
@@ -227,6 +233,7 @@ pub unsafe trait RegisterSet {
227233 target_arch = "x86" ,
228234 target_arch = "aarch64" ,
229235 target_arch = "riscv64" ,
236+ target_arch = "loongarch64" ,
230237 )
231238) ) ]
232239/// Register sets used in [`getregset`] and [`setregset`]
@@ -254,6 +261,8 @@ pub mod regset {
254261 type Regs = libc:: user_fpsimd_struct ;
255262 #[ cfg( target_arch = "riscv64" ) ]
256263 type Regs = libc:: __riscv_mc_d_ext_state ;
264+ #[ cfg( target_arch = "loongarch64" ) ]
265+ type Regs = libc:: user_fp_struct ;
257266 }
258267}
259268
@@ -335,10 +344,20 @@ pub fn getregs(pid: Pid) -> Result<user_regs_struct> {
335344 target_os = "linux" ,
336345 any(
337346 all(
338- target_arch = "aarch64" ,
339- any( target_env = "gnu" , target_env = "musl" )
347+ target_env = "musl" ,
348+ any(
349+ target_arch = "aarch64" ,
350+ target_arch = "loongarch64" ,
351+ )
340352 ) ,
341- all( target_arch = "riscv64" , target_env = "gnu" )
353+ all(
354+ target_env = "gnu" ,
355+ any(
356+ target_arch = "aarch64" ,
357+ target_arch = "loongarch64" ,
358+ target_arch = "riscv64" ,
359+ )
360+ )
342361 )
343362) ) ]
344363pub fn getregs ( pid : Pid ) -> Result < user_regs_struct > {
@@ -355,10 +374,18 @@ pub fn getregs(pid: Pid) -> Result<user_regs_struct> {
355374 target_arch = "x86_64" ,
356375 target_arch = "x86" ,
357376 target_arch = "aarch64" ,
358- target_arch = "riscv64"
377+ target_arch = "riscv64" ,
378+ target_arch = "loongarch64" ,
379+
359380 )
360381 ) ,
361- all( target_env = "musl" , target_arch = "aarch64" )
382+ all(
383+ target_env = "musl" ,
384+ any(
385+ target_arch = "aarch64" ,
386+ target_arch = "loongarch64" ,
387+ )
388+ )
362389 )
363390) ) ]
364391pub fn getregset < S : RegisterSet > ( pid : Pid ) -> Result < S :: Regs > {
@@ -420,9 +447,19 @@ pub fn setregs(pid: Pid, regs: user_regs_struct) -> Result<()> {
420447 any(
421448 all(
422449 target_env = "gnu" ,
423- any( target_arch = "aarch64" , target_arch = "riscv64" )
450+ any(
451+ target_arch = "aarch64" ,
452+ target_arch = "riscv64" ,
453+ target_arch = "loongarch64" ,
454+ )
424455 ) ,
425- all( target_env = "musl" , target_arch = "aarch64" )
456+ all(
457+ target_env = "musl" ,
458+ any(
459+ target_arch = "aarch64" ,
460+ target_arch = "loongarch64" ,
461+ )
462+ )
426463 )
427464) ) ]
428465pub fn setregs ( pid : Pid , regs : user_regs_struct ) -> Result < ( ) > {
@@ -439,10 +476,17 @@ pub fn setregs(pid: Pid, regs: user_regs_struct) -> Result<()> {
439476 target_arch = "x86_64" ,
440477 target_arch = "x86" ,
441478 target_arch = "aarch64" ,
442- target_arch = "riscv64"
479+ target_arch = "riscv64" ,
480+ target_arch = "loongarch64"
443481 )
444482 ) ,
445- all( target_env = "musl" , target_arch = "aarch64" )
483+ all(
484+ target_env = "musl" ,
485+ any(
486+ target_arch = "aarch64" ,
487+ target_arch = "loongarch64"
488+ )
489+ )
446490 )
447491) ) ]
448492pub fn setregset < S : RegisterSet > ( pid : Pid , mut regs : S :: Regs ) -> Result < ( ) > {
0 commit comments