hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

+aarch64.ha (1402B)


      1 // SPDX-License-Identifier: MPL-2.0
      2 // (c) Hare authors <https://harelang.org>
      3 
      4 // #define __ADDR_BND_PKEY_PAD (_Alignof(void *) < sizeof(short) ? sizeof(short) : _Alignof(void *))
      5 def __ADDR_BND_PKEY_PAD: size = 8;
      6 
      7 // Returns the new PID to the parent, void to the child, or errno if something
      8 // goes wrong.
      9 export fn clone(
     10 	stack: nullable *opaque,
     11 	flags: int,
     12 	parent_tid: nullable *int,
     13 	child_tid: nullable *int,
     14 	tls: u64,
     15 ) (int | void | errno) = {
     16 	match (wrap_return(syscall5(SYS_clone,
     17 			flags: u64,
     18 			stack: uintptr: u64,
     19 			parent_tid: uintptr: u64,
     20 			tls,
     21 			child_tid: uintptr: u64))) {
     22 	case let u: u64 =>
     23 		switch (u) {
     24 		case 0 =>
     25 			return void;
     26 		case =>
     27 			return u: int;
     28 		};
     29 	case let err: errno =>
     30 		return err;
     31 	};
     32 };
     33 
     34 export def O_DIRECTORY: int = 0o40000;
     35 export def O_DIRECT: int = 0o200000;
     36 
     37 export type cmsghdr = struct {
     38 	cmsg_len: socklen_t,
     39 	_padding: int,
     40 	cmsg_level: int,
     41 	cmsg_type: int,
     42 };
     43 
     44 export def EDEADLOCK: int = EDEADLK;
     45 
     46 export type epoll_event = struct {
     47 	events: u32,
     48 	data: epoll_data,
     49 };
     50 
     51 export type cpu_set = struct {
     52 	__bits: [16]u64,
     53 };
     54 
     55 export type ucontext = struct {
     56 	uc_flags: u64,
     57 	uc_link: *ucontext,
     58 	uc_stack: stack_t,
     59 	uc_sigmask: sigset,
     60 	_u8: [1024 / 8 - size(sigset)]u8,
     61 	uc_mcontext: sigcontext,
     62 };
     63 
     64 export type sigcontext = struct {
     65 	fault_address: u64,
     66 	sp: u64,
     67 	regs: [31]u64,
     68 	pc: u64,
     69 	pstate: u64,
     70 	reserved: [4096]u8,
     71 };