repo_id
stringlengths
5
115
size
int64
590
5.01M
file_path
stringlengths
4
212
content
stringlengths
590
5.01M
guntas-13/cs330_labs
3,233
kern/src/init/init.s
// #define EL0 0b00 // #define EL1 0b01 // #define EL2 0b10 // #define EL3 0b11 .section .text.init .global _start _start: // read cpu affinity, start core 0, halt rest mrs x1, MPIDR_EL1 and x1, x1, #3 cbz x1, setup halt: // core affinity != 0, halt it wfe b halt setup: // store the desired EL1 stack pointer in x1 adr x1, _start // read the current exception level into x0 (ref: C5.2.1) mrs x0, CurrentEL and x0, x0, #0b1100 lsr x0, x0, #2 switch_to_el2: // switch to EL2 if we're in EL3. otherwise switch to EL1 cmp x0, 0b11 // EL3 bne switch_to_el1 // set-up SCR_EL3 (bits 0, 4, 5, 7, 8, 10) (A53: 4.3.42) mov x2, #0x5b1 msr SCR_EL3, x2 // set-up SPSR and PL switch! (bits 0, 3, 6, 7, 8, 9) (ref: C5.2.20) mov x2, #0x3c9 msr SPSR_EL3, x2 adr x2, switch_to_el1 msr ELR_EL3, x2 eret switch_to_el1: // switch to EL1 if we're not already in EL1. otherwise continue with start cmp x0, 0b01 // EL1 beq set_stack // set the stack-pointer for EL1 msr SP_EL1, x1 // enable CNTP for EL1/EL0 (ref: D7.5.2, D7.5.13) // NOTE: This doesn't actually enable the counter stream. mrs x0, CNTHCTL_EL2 orr x0, x0, #0b11 msr CNTHCTL_EL2, x0 msr CNTVOFF_EL2, xzr // enable AArch64 in EL1 (A53: 4.3.36) mov x0, #(1 << 31) // Enable AArch64 for EL1 orr x0, x0, #(1 << 1) // RES1 on A-53 msr HCR_EL2, x0 mrs x0, HCR_EL2 // enable floating point and SVE (SIMD) (A53: 4.3.38, 4.3.34) msr CPTR_EL2, xzr // don't trap accessing SVE registers mrs x0, CPACR_EL1 orr x0, x0, #(0b11 << 20) msr CPACR_EL1, x0 // Set SCTLR to known state (RES1: 11, 20, 22, 23, 28, 29) (A53: 4.3.30) mov x2, #0x0800 movk x2, #0x30d0, lsl #16 msr SCTLR_EL1, x2 // set up exception handlers // FIXME: load `_vectors` addr into appropriate register (guide: 10.4) // change execution level to EL1 (ref: C5.2.19) mov x2, #0x3c5 msr SPSR_EL2, x2 // FIXME: Return to EL1 at `set_stack`. set_stack: // set the current stack pointer mov sp, x1 // zero_bss: // // load the start address and number of bytes in BSS section // ldr x1, =__bss_start // ldr x2, =__bss_length // zero_bss_loop: // // zero out the BSS section, 64-bits at a time // cbz x2, go_kmain // str xzr, [x1], #8 // sub x2, x2, #8 // cbnz x2, zero_bss_loop go_kmain: // jump to kmain, which shouldn't return. halt if it does bl kinit b halt context_save: // FIXME: Save the remaining context to the stack. .global context_restore context_restore: // FIXME: Restore the context from the stack. ret // #define HANDLER(source, kind) \ // .align 7; \ // stp lr, x0, [SP, #-16]!; \ // mov x0, ##source; \ // movk x0, ##kind, LSL #16; \ // bl context_save; \ // ldp lr, x0, [SP], #16; \ // eret .align 11 _vectors: // FIXME: Setup the 16 exception vectors.
guntas-13/cs330_labs
418
boot/src/init/init.s
.section .text.init .global _start _start: // read cpu affinity, start core 0, halt rest mrs x1, mpidr_el1 and x1, x1, #3 cbz x1, 2f 1: // core affinity != 0, halt it wfe b 1b 2: // set the stack to start before our boot code adr x1, _start mov sp, x1 // jump to kinit, which shouldn't return. halt if it does bl kinit b 1b
H09X/CSCCTFv5
5,280
reverse/CraigV2/chall.s
.file "chall.c" .text .globl getlen .type getlen, @function getlen: .LFB309: .cfi_startproc pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -24(%rbp) movl $0, -4(%rbp) jmp .L2 .L3: addl $1, -4(%rbp) .L2: movl -4(%rbp), %eax movslq %eax, %rdx movq -24(%rbp), %rax addq %rdx, %rax movzbl (%rax), %eax testb %al, %al jne .L3 movl -4(%rbp), %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE309: .size getlen, .-getlen .globl validate .type validate, @function validate: .LFB310: .cfi_startproc pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $4368, %rsp movq %rdi, -4344(%rbp) movq %rsi, -4352(%rbp) movq %rdx, -4360(%rbp) leaq -4224(%rbp), %rdx movl $0, %eax movl $524, %ecx movq %rdx, %rdi rep stosq movl $0, -4224(%rbp) movl $1, -4220(%rbp) movl $2, -4216(%rbp) movl $10, -4212(%rbp) movl $19, -4208(%rbp) movl $5, -4204(%rbp) movl $41, -4200(%rbp) movl $0, -4192(%rbp) movl $63, -4188(%rbp) movl $34, -4184(%rbp) movl $45, -4180(%rbp) movl $53, -4176(%rbp) movl $36, -4172(%rbp) movl $59, -4168(%rbp) movl $52, -4164(%rbp) movl $109, -4160(%rbp) movl $124, -4156(%rbp) movl $111, -4152(%rbp) movl $8, -4148(%rbp) movl $52, -4144(%rbp) movl $48, -4140(%rbp) movl $55, -4136(%rbp) movl $44, -4132(%rbp) movl $43, -4128(%rbp) movl $43, -4124(%rbp) movl $38, -4120(%rbp) movl $47, -4116(%rbp) call EVP_MD_CTX_new@PLT movq %rax, -16(%rbp) call EVP_sha256@PLT movq %rax, -24(%rbp) cmpq $0, -16(%rbp) jne .L6 movl $0, %eax jmp .L15 .L6: movq -24(%rbp), %rcx movq -16(%rbp), %rax movl $0, %edx movq %rcx, %rsi movq %rax, %rdi call EVP_DigestInit_ex@PLT cmpl $1, %eax je .L8 movl $0, %eax jmp .L15 .L8: movq -4344(%rbp), %rax movq %rax, %rdi call strlen@PLT movq %rax, %rdx movq -4344(%rbp), %rcx movq -16(%rbp), %rax movq %rcx, %rsi movq %rax, %rdi call EVP_DigestUpdate@PLT cmpl $1, %eax je .L9 movq -16(%rbp), %rax movq %rax, %rdi call EVP_MD_CTX_free@PLT movl $0, %eax jmp .L15 .L9: leaq -4292(%rbp), %rdx leaq -4288(%rbp), %rcx movq -16(%rbp), %rax movq %rcx, %rsi movq %rax, %rdi call EVP_DigestFinal_ex@PLT cmpl $1, %eax je .L10 movq -16(%rbp), %rax movq %rax, %rdi call EVP_MD_CTX_free@PLT movl $0, %eax jmp .L15 .L10: movq -16(%rbp), %rax movq %rax, %rdi call EVP_MD_CTX_free@PLT movabsq $-1579856855009041498, %rax movabsq $-4317265538333496602, %rdx movq %rax, -4336(%rbp) movq %rdx, -4328(%rbp) movabsq $3551782715010313895, %rax movabsq $-4283370361391506976, %rdx movq %rax, -4320(%rbp) movq %rdx, -4312(%rbp) movl -4292(%rbp), %eax movl %eax, %edx leaq -4336(%rbp), %rcx leaq -4288(%rbp), %rax movq %rcx, %rsi movq %rax, %rdi call memcmp@PLT testl %eax, %eax je .L11 movl $0, %eax jmp .L15 .L11: movq -4352(%rbp), %rax movq %rax, %rdi call getlen movl %eax, -28(%rbp) movl $0, -4(%rbp) jmp .L12 .L13: movq -4344(%rbp), %rax movq %rax, %rdi call getlen movl %eax, %esi movl -4(%rbp), %eax cltd idivl %esi movl %edx, %ecx movl %ecx, %eax movslq %eax, %rdx movq -4344(%rbp), %rax addq %rdx, %rax movzbl (%rax), %eax movsbl %al, %eax movl %eax, %edi call toupper@PLT movl %eax, %esi movl -4(%rbp), %eax cltq movl -4224(%rbp,%rax,1), %eax movl %eax, %ecx movl -4(%rbp), %eax movslq %eax, %rdx movq -4360(%rbp), %rax addq %rdx, %rax xorl %ecx, %esi movl %esi, %edx movb %dl, (%rax) addl $1, -4(%rbp) .L12: movl -4(%rbp), %eax cmpl -28(%rbp), %eax jl .L13 movq -4352(%rbp), %rdx movq -4360(%rbp), %rax movq %rdx, %rsi movq %rax, %rdi call strcmp@PLT testl %eax, %eax jne .L14 movl $1, %eax jmp .L15 .L14: movl $0, %eax .L15: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE310: .size validate, .-validate .section .rodata .align 8 .LC1: .ascii "Welcome to secret poets society!\000" .LC2: .ascii "Please enter your credentials to login\000" .LC3: .ascii "Username:\000" .LC4: .ascii "%s\000" .LC5: .ascii "Password:\000" .LC6: .ascii "Access Granted!\012Welcome Back Craig\000" .LC7: .ascii "Access Denied!\000" .text .globl main .type main, @function main: .LFB311: .cfi_startproc pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $3168, %rsp leaq .LC0(%rip), %rax movq %rax, %rdi call puts@PLT leaq .LC1(%rip), %rax movq %rax, %rdi call puts@PLT leaq .LC2(%rip), %rax movq %rax, %rdi call puts@PLT leaq -1056(%rbp), %rax movq %rax, %rsi leaq .LC3(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT leaq .LC4(%rip), %rax movq %rax, %rdi call puts@PLT leaq -2112(%rbp), %rax movq %rax, %rsi leaq .LC3(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT leaq -3168(%rbp), %rdx leaq -2112(%rbp), %rcx leaq -1056(%rbp), %rax movq %rcx, %rsi movq %rax, %rdi call validate testl %eax, %eax je .L17 leaq .LC5(%rip), %rax movq %rax, %rdi call puts@PLT jmp .L18 .L17: leaq .LC6(%rip), %rax movq %rax, %rdi call puts@PLT .L18: movl $0, %eax leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE311: .size main, .-main .ident "GCC: (Debian 13.2.0-4) 13.2.0" .section .note.GNU-stack,"",@progbits
hadrian-reppas/csil_arena
194
go_player/internal/wasi/sockets/udp/empty.s
// This file exists for testing this package without WebAssembly, // allowing empty function bodies with a //go:wasmimport directive. // See https://pkg.go.dev/cmd/compile for more information.
hadrian-reppas/csil_arena
194
go_player/internal/wasi/sockets/ip-name-lookup/empty.s
// This file exists for testing this package without WebAssembly, // allowing empty function bodies with a //go:wasmimport directive. // See https://pkg.go.dev/cmd/compile for more information.
hadrian-reppas/csil_arena
194
go_player/internal/wasi/sockets/instance-network/empty.s
// This file exists for testing this package without WebAssembly, // allowing empty function bodies with a //go:wasmimport directive. // See https://pkg.go.dev/cmd/compile for more information.
hadrian-reppas/csil_arena
194
go_player/internal/wasi/sockets/network/empty.s
// This file exists for testing this package without WebAssembly, // allowing empty function bodies with a //go:wasmimport directive. // See https://pkg.go.dev/cmd/compile for more information.
hadrian-reppas/csil_arena
194
go_player/internal/wasi/sockets/tcp-create-socket/empty.s
// This file exists for testing this package without WebAssembly, // allowing empty function bodies with a //go:wasmimport directive. // See https://pkg.go.dev/cmd/compile for more information.
hadrian-reppas/csil_arena
194
go_player/internal/wasi/sockets/tcp/empty.s
// This file exists for testing this package without WebAssembly, // allowing empty function bodies with a //go:wasmimport directive. // See https://pkg.go.dev/cmd/compile for more information.
hadrian-reppas/csil_arena
194
go_player/internal/wasi/sockets/udp-create-socket/empty.s
// This file exists for testing this package without WebAssembly, // allowing empty function bodies with a //go:wasmimport directive. // See https://pkg.go.dev/cmd/compile for more information.
hadrian-reppas/csil_arena
194
go_player/internal/wasi/io/error/empty.s
// This file exists for testing this package without WebAssembly, // allowing empty function bodies with a //go:wasmimport directive. // See https://pkg.go.dev/cmd/compile for more information.
hadrian-reppas/csil_arena
194
go_player/internal/wasi/io/streams/empty.s
// This file exists for testing this package without WebAssembly, // allowing empty function bodies with a //go:wasmimport directive. // See https://pkg.go.dev/cmd/compile for more information.
hadrian-reppas/csil_arena
194
go_player/internal/wasi/io/poll/empty.s
// This file exists for testing this package without WebAssembly, // allowing empty function bodies with a //go:wasmimport directive. // See https://pkg.go.dev/cmd/compile for more information.
hadrian-reppas/csil_arena
194
go_player/internal/wasi/cli/stderr/empty.s
// This file exists for testing this package without WebAssembly, // allowing empty function bodies with a //go:wasmimport directive. // See https://pkg.go.dev/cmd/compile for more information.
hadrian-reppas/csil_arena
194
go_player/internal/wasi/cli/terminal-stderr/empty.s
// This file exists for testing this package without WebAssembly, // allowing empty function bodies with a //go:wasmimport directive. // See https://pkg.go.dev/cmd/compile for more information.
hadrian-reppas/csil_arena
194
go_player/internal/wasi/cli/terminal-output/empty.s
// This file exists for testing this package without WebAssembly, // allowing empty function bodies with a //go:wasmimport directive. // See https://pkg.go.dev/cmd/compile for more information.
hadrian-reppas/csil_arena
194
go_player/internal/wasi/cli/terminal-input/empty.s
// This file exists for testing this package without WebAssembly, // allowing empty function bodies with a //go:wasmimport directive. // See https://pkg.go.dev/cmd/compile for more information.
hadrian-reppas/csil_arena
194
go_player/internal/wasi/cli/stdout/empty.s
// This file exists for testing this package without WebAssembly, // allowing empty function bodies with a //go:wasmimport directive. // See https://pkg.go.dev/cmd/compile for more information.
hadrian-reppas/csil_arena
194
go_player/internal/wasi/cli/terminal-stdout/empty.s
// This file exists for testing this package without WebAssembly, // allowing empty function bodies with a //go:wasmimport directive. // See https://pkg.go.dev/cmd/compile for more information.
hadrian-reppas/csil_arena
194
go_player/internal/wasi/cli/exit/empty.s
// This file exists for testing this package without WebAssembly, // allowing empty function bodies with a //go:wasmimport directive. // See https://pkg.go.dev/cmd/compile for more information.
hadrian-reppas/csil_arena
194
go_player/internal/wasi/cli/terminal-stdin/empty.s
// This file exists for testing this package without WebAssembly, // allowing empty function bodies with a //go:wasmimport directive. // See https://pkg.go.dev/cmd/compile for more information.
hadrian-reppas/csil_arena
194
go_player/internal/wasi/cli/environment/empty.s
// This file exists for testing this package without WebAssembly, // allowing empty function bodies with a //go:wasmimport directive. // See https://pkg.go.dev/cmd/compile for more information.
hadrian-reppas/csil_arena
194
go_player/internal/wasi/cli/stdin/empty.s
// This file exists for testing this package without WebAssembly, // allowing empty function bodies with a //go:wasmimport directive. // See https://pkg.go.dev/cmd/compile for more information.
hadrian-reppas/csil_arena
194
go_player/internal/wasi/filesystem/types/empty.s
// This file exists for testing this package without WebAssembly, // allowing empty function bodies with a //go:wasmimport directive. // See https://pkg.go.dev/cmd/compile for more information.
hadrian-reppas/csil_arena
194
go_player/internal/wasi/filesystem/preopens/empty.s
// This file exists for testing this package without WebAssembly, // allowing empty function bodies with a //go:wasmimport directive. // See https://pkg.go.dev/cmd/compile for more information.
hadrian-reppas/csil_arena
194
go_player/internal/wasi/random/insecure/empty.s
// This file exists for testing this package without WebAssembly, // allowing empty function bodies with a //go:wasmimport directive. // See https://pkg.go.dev/cmd/compile for more information.
hadrian-reppas/csil_arena
194
go_player/internal/wasi/random/random/empty.s
// This file exists for testing this package without WebAssembly, // allowing empty function bodies with a //go:wasmimport directive. // See https://pkg.go.dev/cmd/compile for more information.
hadrian-reppas/csil_arena
194
go_player/internal/wasi/random/insecure-seed/empty.s
// This file exists for testing this package without WebAssembly, // allowing empty function bodies with a //go:wasmimport directive. // See https://pkg.go.dev/cmd/compile for more information.
hadrian-reppas/csil_arena
194
go_player/internal/wasi/clocks/wall-clock/empty.s
// This file exists for testing this package without WebAssembly, // allowing empty function bodies with a //go:wasmimport directive. // See https://pkg.go.dev/cmd/compile for more information.
hadrian-reppas/csil_arena
194
go_player/internal/wasi/clocks/monotonic-clock/empty.s
// This file exists for testing this package without WebAssembly, // allowing empty function bodies with a //go:wasmimport directive. // See https://pkg.go.dev/cmd/compile for more information.
hadrian-reppas/csil_arena
194
go_player/internal/csil/arena/api/empty.s
// This file exists for testing this package without WebAssembly, // allowing empty function bodies with a //go:wasmimport directive. // See https://pkg.go.dev/cmd/compile for more information.
hainakus/gpu-rust-miner
5,802
src/keccakf1600_x86-64-osx.s
# Source: https://github.com/dot-asm/cryptogams/blob/master/x86_64/keccak1600-x86_64.pl .text .p2align 5 __KeccakF1600: .cfi_startproc .byte 0xf3,0x0f,0x1e,0xfa movq 60(%rdi),%rax movq 68(%rdi),%rbx movq 76(%rdi),%rcx movq 84(%rdi),%rdx movq 92(%rdi),%rbp jmp L$oop .p2align 5 L$oop: movq -100(%rdi),%r8 movq -52(%rdi),%r9 movq -4(%rdi),%r10 movq 44(%rdi),%r11 xorq -84(%rdi),%rcx xorq -76(%rdi),%rdx xorq %r8,%rax xorq -92(%rdi),%rbx xorq -44(%rdi),%rcx xorq -60(%rdi),%rax movq %rbp,%r12 xorq -68(%rdi),%rbp xorq %r10,%rcx xorq -20(%rdi),%rax xorq -36(%rdi),%rdx xorq %r9,%rbx xorq -28(%rdi),%rbp xorq 36(%rdi),%rcx xorq 20(%rdi),%rax xorq 4(%rdi),%rdx xorq -12(%rdi),%rbx xorq 12(%rdi),%rbp movq %rcx,%r13 rolq $1,%rcx xorq %rax,%rcx xorq %r11,%rdx rolq $1,%rax xorq %rdx,%rax xorq 28(%rdi),%rbx rolq $1,%rdx xorq %rbx,%rdx xorq 52(%rdi),%rbp rolq $1,%rbx xorq %rbp,%rbx rolq $1,%rbp xorq %r13,%rbp xorq %rcx,%r9 xorq %rdx,%r10 rolq $44,%r9 xorq %rbp,%r11 xorq %rax,%r12 rolq $43,%r10 xorq %rbx,%r8 movq %r9,%r13 rolq $21,%r11 orq %r10,%r9 xorq %r8,%r9 rolq $14,%r12 xorq (%r15),%r9 leaq 8(%r15),%r15 movq %r12,%r14 andq %r11,%r12 movq %r9,-100(%rsi) xorq %r10,%r12 notq %r10 movq %r12,-84(%rsi) orq %r11,%r10 movq 76(%rdi),%r12 xorq %r13,%r10 movq %r10,-92(%rsi) andq %r8,%r13 movq -28(%rdi),%r9 xorq %r14,%r13 movq -20(%rdi),%r10 movq %r13,-68(%rsi) orq %r8,%r14 movq -76(%rdi),%r8 xorq %r11,%r14 movq 28(%rdi),%r11 movq %r14,-76(%rsi) xorq %rbp,%r8 xorq %rdx,%r12 rolq $28,%r8 xorq %rcx,%r11 xorq %rax,%r9 rolq $61,%r12 rolq $45,%r11 xorq %rbx,%r10 rolq $20,%r9 movq %r8,%r13 orq %r12,%r8 rolq $3,%r10 xorq %r11,%r8 movq %r8,-36(%rsi) movq %r9,%r14 andq %r13,%r9 movq -92(%rdi),%r8 xorq %r12,%r9 notq %r12 movq %r9,-28(%rsi) orq %r11,%r12 movq -44(%rdi),%r9 xorq %r10,%r12 movq %r12,-44(%rsi) andq %r10,%r11 movq 60(%rdi),%r12 xorq %r14,%r11 movq %r11,-52(%rsi) orq %r10,%r14 movq 4(%rdi),%r10 xorq %r13,%r14 movq 52(%rdi),%r11 movq %r14,-60(%rsi) xorq %rbp,%r10 xorq %rax,%r11 rolq $25,%r10 xorq %rdx,%r9 rolq $8,%r11 xorq %rbx,%r12 rolq $6,%r9 xorq %rcx,%r8 rolq $18,%r12 movq %r10,%r13 andq %r11,%r10 rolq $1,%r8 notq %r11 xorq %r9,%r10 movq %r10,-12(%rsi) movq %r12,%r14 andq %r11,%r12 movq -12(%rdi),%r10 xorq %r13,%r12 movq %r12,-4(%rsi) orq %r9,%r13 movq 84(%rdi),%r12 xorq %r8,%r13 movq %r13,-20(%rsi) andq %r8,%r9 xorq %r14,%r9 movq %r9,12(%rsi) orq %r8,%r14 movq -60(%rdi),%r9 xorq %r11,%r14 movq 36(%rdi),%r11 movq %r14,4(%rsi) movq -68(%rdi),%r8 xorq %rcx,%r10 xorq %rdx,%r11 rolq $10,%r10 xorq %rbx,%r9 rolq $15,%r11 xorq %rbp,%r12 rolq $36,%r9 xorq %rax,%r8 rolq $56,%r12 movq %r10,%r13 orq %r11,%r10 rolq $27,%r8 notq %r11 xorq %r9,%r10 movq %r10,28(%rsi) movq %r12,%r14 orq %r11,%r12 xorq %r13,%r12 movq %r12,36(%rsi) andq %r9,%r13 xorq %r8,%r13 movq %r13,20(%rsi) orq %r8,%r9 xorq %r14,%r9 movq %r9,52(%rsi) andq %r14,%r8 xorq %r11,%r8 movq %r8,44(%rsi) xorq -84(%rdi),%rdx xorq -36(%rdi),%rbp rolq $62,%rdx xorq 68(%rdi),%rcx rolq $55,%rbp xorq 12(%rdi),%rax rolq $2,%rcx xorq 20(%rdi),%rbx xchgq %rsi,%rdi rolq $39,%rax rolq $41,%rbx movq %rdx,%r13 andq %rbp,%rdx notq %rbp xorq %rcx,%rdx movq %rdx,92(%rdi) movq %rax,%r14 andq %rbp,%rax xorq %r13,%rax movq %rax,60(%rdi) orq %rcx,%r13 xorq %rbx,%r13 movq %r13,84(%rdi) andq %rbx,%rcx xorq %r14,%rcx movq %rcx,76(%rdi) orq %r14,%rbx xorq %rbp,%rbx movq %rbx,68(%rdi) movq %rdx,%rbp movq %r13,%rdx testq $255,%r15 jnz L$oop leaq -192(%r15),%r15 .byte 0xf3,0xc3 .cfi_endproc .globl _KeccakF1600 .p2align 5 _KeccakF1600: .cfi_startproc .byte 0xf3,0x0f,0x1e,0xfa pushq %rbx .cfi_adjust_cfa_offset 8 .cfi_offset %rbx,-16 pushq %rbp .cfi_adjust_cfa_offset 8 .cfi_offset %rbp,-24 pushq %r12 .cfi_adjust_cfa_offset 8 .cfi_offset %r12,-32 pushq %r13 .cfi_adjust_cfa_offset 8 .cfi_offset %r13,-40 pushq %r14 .cfi_adjust_cfa_offset 8 .cfi_offset %r14,-48 pushq %r15 .cfi_adjust_cfa_offset 8 .cfi_offset %r15,-56 leaq 100(%rdi),%rdi subq $200,%rsp .cfi_adjust_cfa_offset 200 notq -92(%rdi) notq -84(%rdi) notq -36(%rdi) notq -4(%rdi) notq 36(%rdi) notq 60(%rdi) leaq iotas(%rip),%r15 leaq 100(%rsp),%rsi call __KeccakF1600 notq -92(%rdi) notq -84(%rdi) notq -36(%rdi) notq -4(%rdi) notq 36(%rdi) notq 60(%rdi) leaq -100(%rdi),%rdi addq $200,%rsp .cfi_adjust_cfa_offset -200 popq %r15 .cfi_adjust_cfa_offset -8 .cfi_restore %r15 popq %r14 .cfi_adjust_cfa_offset -8 .cfi_restore %r14 popq %r13 .cfi_adjust_cfa_offset -8 .cfi_restore %r13 popq %r12 .cfi_adjust_cfa_offset -8 .cfi_restore %r12 popq %rbp .cfi_adjust_cfa_offset -8 .cfi_restore %rbp popq %rbx .cfi_adjust_cfa_offset -8 .cfi_restore %rbx .byte 0xf3,0xc3 .cfi_endproc .p2align 8 .quad 0,0,0,0,0,0,0,0 iotas: .quad 0x0000000000000001 .quad 0x0000000000008082 .quad 0x800000000000808a .quad 0x8000000080008000 .quad 0x000000000000808b .quad 0x0000000080000001 .quad 0x8000000080008081 .quad 0x8000000000008009 .quad 0x000000000000008a .quad 0x0000000000000088 .quad 0x0000000080008009 .quad 0x000000008000000a .quad 0x000000008000808b .quad 0x800000000000008b .quad 0x8000000000008089 .quad 0x8000000000008003 .quad 0x8000000000008002 .quad 0x8000000000000080 .quad 0x000000000000800a .quad 0x800000008000000a .quad 0x8000000080008081 .quad 0x8000000000008080 .quad 0x0000000080000001 .quad 0x8000000080008008 .byte 75,101,99,99,97,107,45,49,54,48,48,32,97,98,115,111,114,98,32,97,110,100,32,115,113,117,101,101,122,101,32,102,111,114,32,120,56,54,95,54,52,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
hainakus/gpu-rust-miner
6,073
src/keccakf1600_x86-64.s
# Source: https://github.com/dot-asm/cryptogams/blob/master/x86_64/keccak1600-x86_64.pl .text .type __KeccakF1600,@function .align 32 __KeccakF1600: .cfi_startproc .byte 0xf3,0x0f,0x1e,0xfa movq 60(%rdi),%rax movq 68(%rdi),%rbx movq 76(%rdi),%rcx movq 84(%rdi),%rdx movq 92(%rdi),%rbp jmp .Loop .align 32 .Loop: movq -100(%rdi),%r8 movq -52(%rdi),%r9 movq -4(%rdi),%r10 movq 44(%rdi),%r11 xorq -84(%rdi),%rcx xorq -76(%rdi),%rdx xorq %r8,%rax xorq -92(%rdi),%rbx xorq -44(%rdi),%rcx xorq -60(%rdi),%rax movq %rbp,%r12 xorq -68(%rdi),%rbp xorq %r10,%rcx xorq -20(%rdi),%rax xorq -36(%rdi),%rdx xorq %r9,%rbx xorq -28(%rdi),%rbp xorq 36(%rdi),%rcx xorq 20(%rdi),%rax xorq 4(%rdi),%rdx xorq -12(%rdi),%rbx xorq 12(%rdi),%rbp movq %rcx,%r13 rolq $1,%rcx xorq %rax,%rcx xorq %r11,%rdx rolq $1,%rax xorq %rdx,%rax xorq 28(%rdi),%rbx rolq $1,%rdx xorq %rbx,%rdx xorq 52(%rdi),%rbp rolq $1,%rbx xorq %rbp,%rbx rolq $1,%rbp xorq %r13,%rbp xorq %rcx,%r9 xorq %rdx,%r10 rolq $44,%r9 xorq %rbp,%r11 xorq %rax,%r12 rolq $43,%r10 xorq %rbx,%r8 movq %r9,%r13 rolq $21,%r11 orq %r10,%r9 xorq %r8,%r9 rolq $14,%r12 xorq (%r15),%r9 leaq 8(%r15),%r15 movq %r12,%r14 andq %r11,%r12 movq %r9,-100(%rsi) xorq %r10,%r12 notq %r10 movq %r12,-84(%rsi) orq %r11,%r10 movq 76(%rdi),%r12 xorq %r13,%r10 movq %r10,-92(%rsi) andq %r8,%r13 movq -28(%rdi),%r9 xorq %r14,%r13 movq -20(%rdi),%r10 movq %r13,-68(%rsi) orq %r8,%r14 movq -76(%rdi),%r8 xorq %r11,%r14 movq 28(%rdi),%r11 movq %r14,-76(%rsi) xorq %rbp,%r8 xorq %rdx,%r12 rolq $28,%r8 xorq %rcx,%r11 xorq %rax,%r9 rolq $61,%r12 rolq $45,%r11 xorq %rbx,%r10 rolq $20,%r9 movq %r8,%r13 orq %r12,%r8 rolq $3,%r10 xorq %r11,%r8 movq %r8,-36(%rsi) movq %r9,%r14 andq %r13,%r9 movq -92(%rdi),%r8 xorq %r12,%r9 notq %r12 movq %r9,-28(%rsi) orq %r11,%r12 movq -44(%rdi),%r9 xorq %r10,%r12 movq %r12,-44(%rsi) andq %r10,%r11 movq 60(%rdi),%r12 xorq %r14,%r11 movq %r11,-52(%rsi) orq %r10,%r14 movq 4(%rdi),%r10 xorq %r13,%r14 movq 52(%rdi),%r11 movq %r14,-60(%rsi) xorq %rbp,%r10 xorq %rax,%r11 rolq $25,%r10 xorq %rdx,%r9 rolq $8,%r11 xorq %rbx,%r12 rolq $6,%r9 xorq %rcx,%r8 rolq $18,%r12 movq %r10,%r13 andq %r11,%r10 rolq $1,%r8 notq %r11 xorq %r9,%r10 movq %r10,-12(%rsi) movq %r12,%r14 andq %r11,%r12 movq -12(%rdi),%r10 xorq %r13,%r12 movq %r12,-4(%rsi) orq %r9,%r13 movq 84(%rdi),%r12 xorq %r8,%r13 movq %r13,-20(%rsi) andq %r8,%r9 xorq %r14,%r9 movq %r9,12(%rsi) orq %r8,%r14 movq -60(%rdi),%r9 xorq %r11,%r14 movq 36(%rdi),%r11 movq %r14,4(%rsi) movq -68(%rdi),%r8 xorq %rcx,%r10 xorq %rdx,%r11 rolq $10,%r10 xorq %rbx,%r9 rolq $15,%r11 xorq %rbp,%r12 rolq $36,%r9 xorq %rax,%r8 rolq $56,%r12 movq %r10,%r13 orq %r11,%r10 rolq $27,%r8 notq %r11 xorq %r9,%r10 movq %r10,28(%rsi) movq %r12,%r14 orq %r11,%r12 xorq %r13,%r12 movq %r12,36(%rsi) andq %r9,%r13 xorq %r8,%r13 movq %r13,20(%rsi) orq %r8,%r9 xorq %r14,%r9 movq %r9,52(%rsi) andq %r14,%r8 xorq %r11,%r8 movq %r8,44(%rsi) xorq -84(%rdi),%rdx xorq -36(%rdi),%rbp rolq $62,%rdx xorq 68(%rdi),%rcx rolq $55,%rbp xorq 12(%rdi),%rax rolq $2,%rcx xorq 20(%rdi),%rbx xchgq %rsi,%rdi rolq $39,%rax rolq $41,%rbx movq %rdx,%r13 andq %rbp,%rdx notq %rbp xorq %rcx,%rdx movq %rdx,92(%rdi) movq %rax,%r14 andq %rbp,%rax xorq %r13,%rax movq %rax,60(%rdi) orq %rcx,%r13 xorq %rbx,%r13 movq %r13,84(%rdi) andq %rbx,%rcx xorq %r14,%rcx movq %rcx,76(%rdi) orq %r14,%rbx xorq %rbp,%rbx movq %rbx,68(%rdi) movq %rdx,%rbp movq %r13,%rdx testq $255,%r15 jnz .Loop leaq -192(%r15),%r15 .byte 0xf3,0xc3 .cfi_endproc .size __KeccakF1600,.-__KeccakF1600 .globl KeccakF1600 .type KeccakF1600,@function .align 32 KeccakF1600: .cfi_startproc .byte 0xf3,0x0f,0x1e,0xfa pushq %rbx .cfi_adjust_cfa_offset 8 .cfi_offset %rbx,-16 pushq %rbp .cfi_adjust_cfa_offset 8 .cfi_offset %rbp,-24 pushq %r12 .cfi_adjust_cfa_offset 8 .cfi_offset %r12,-32 pushq %r13 .cfi_adjust_cfa_offset 8 .cfi_offset %r13,-40 pushq %r14 .cfi_adjust_cfa_offset 8 .cfi_offset %r14,-48 pushq %r15 .cfi_adjust_cfa_offset 8 .cfi_offset %r15,-56 leaq 100(%rdi),%rdi subq $200,%rsp .cfi_adjust_cfa_offset 200 notq -92(%rdi) notq -84(%rdi) notq -36(%rdi) notq -4(%rdi) notq 36(%rdi) notq 60(%rdi) leaq iotas(%rip),%r15 leaq 100(%rsp),%rsi call __KeccakF1600 notq -92(%rdi) notq -84(%rdi) notq -36(%rdi) notq -4(%rdi) notq 36(%rdi) notq 60(%rdi) leaq -100(%rdi),%rdi addq $200,%rsp .cfi_adjust_cfa_offset -200 popq %r15 .cfi_adjust_cfa_offset -8 .cfi_restore %r15 popq %r14 .cfi_adjust_cfa_offset -8 .cfi_restore %r14 popq %r13 .cfi_adjust_cfa_offset -8 .cfi_restore %r13 popq %r12 .cfi_adjust_cfa_offset -8 .cfi_restore %r12 popq %rbp .cfi_adjust_cfa_offset -8 .cfi_restore %rbp popq %rbx .cfi_adjust_cfa_offset -8 .cfi_restore %rbx .byte 0xf3,0xc3 .cfi_endproc .size KeccakF1600,.-KeccakF1600 .align 256 .quad 0,0,0,0,0,0,0,0 .type iotas,@object iotas: .quad 0x0000000000000001 .quad 0x0000000000008082 .quad 0x800000000000808a .quad 0x8000000080008000 .quad 0x000000000000808b .quad 0x0000000080000001 .quad 0x8000000080008081 .quad 0x8000000000008009 .quad 0x000000000000008a .quad 0x0000000000000088 .quad 0x0000000080008009 .quad 0x000000008000000a .quad 0x000000008000808b .quad 0x800000000000008b .quad 0x8000000000008089 .quad 0x8000000000008003 .quad 0x8000000000008002 .quad 0x8000000000000080 .quad 0x000000000000800a .quad 0x800000008000000a .quad 0x8000000080008081 .quad 0x8000000000008080 .quad 0x0000000080000001 .quad 0x8000000080008008 .size iotas,.-iotas .byte 75,101,99,99,97,107,45,49,54,48,48,32,97,98,115,111,114,98,32,97,110,100,32,115,113,117,101,101,122,101,32,102,111,114,32,120,56,54,95,54,52,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0 .section .note.gnu.property,"a",@note .long 4,2f-1f,5 .byte 0x47,0x4E,0x55,0 1: .long 0xc0000002,4,3 .align 8 2:
hainakus/Xenomorph-miner
5,802
src/keccakf1600_x86-64-osx.s
# Source: https://github.com/dot-asm/cryptogams/blob/master/x86_64/keccak1600-x86_64.pl .text .p2align 5 __KeccakF1600: .cfi_startproc .byte 0xf3,0x0f,0x1e,0xfa movq 60(%rdi),%rax movq 68(%rdi),%rbx movq 76(%rdi),%rcx movq 84(%rdi),%rdx movq 92(%rdi),%rbp jmp L$oop .p2align 5 L$oop: movq -100(%rdi),%r8 movq -52(%rdi),%r9 movq -4(%rdi),%r10 movq 44(%rdi),%r11 xorq -84(%rdi),%rcx xorq -76(%rdi),%rdx xorq %r8,%rax xorq -92(%rdi),%rbx xorq -44(%rdi),%rcx xorq -60(%rdi),%rax movq %rbp,%r12 xorq -68(%rdi),%rbp xorq %r10,%rcx xorq -20(%rdi),%rax xorq -36(%rdi),%rdx xorq %r9,%rbx xorq -28(%rdi),%rbp xorq 36(%rdi),%rcx xorq 20(%rdi),%rax xorq 4(%rdi),%rdx xorq -12(%rdi),%rbx xorq 12(%rdi),%rbp movq %rcx,%r13 rolq $1,%rcx xorq %rax,%rcx xorq %r11,%rdx rolq $1,%rax xorq %rdx,%rax xorq 28(%rdi),%rbx rolq $1,%rdx xorq %rbx,%rdx xorq 52(%rdi),%rbp rolq $1,%rbx xorq %rbp,%rbx rolq $1,%rbp xorq %r13,%rbp xorq %rcx,%r9 xorq %rdx,%r10 rolq $44,%r9 xorq %rbp,%r11 xorq %rax,%r12 rolq $43,%r10 xorq %rbx,%r8 movq %r9,%r13 rolq $21,%r11 orq %r10,%r9 xorq %r8,%r9 rolq $14,%r12 xorq (%r15),%r9 leaq 8(%r15),%r15 movq %r12,%r14 andq %r11,%r12 movq %r9,-100(%rsi) xorq %r10,%r12 notq %r10 movq %r12,-84(%rsi) orq %r11,%r10 movq 76(%rdi),%r12 xorq %r13,%r10 movq %r10,-92(%rsi) andq %r8,%r13 movq -28(%rdi),%r9 xorq %r14,%r13 movq -20(%rdi),%r10 movq %r13,-68(%rsi) orq %r8,%r14 movq -76(%rdi),%r8 xorq %r11,%r14 movq 28(%rdi),%r11 movq %r14,-76(%rsi) xorq %rbp,%r8 xorq %rdx,%r12 rolq $28,%r8 xorq %rcx,%r11 xorq %rax,%r9 rolq $61,%r12 rolq $45,%r11 xorq %rbx,%r10 rolq $20,%r9 movq %r8,%r13 orq %r12,%r8 rolq $3,%r10 xorq %r11,%r8 movq %r8,-36(%rsi) movq %r9,%r14 andq %r13,%r9 movq -92(%rdi),%r8 xorq %r12,%r9 notq %r12 movq %r9,-28(%rsi) orq %r11,%r12 movq -44(%rdi),%r9 xorq %r10,%r12 movq %r12,-44(%rsi) andq %r10,%r11 movq 60(%rdi),%r12 xorq %r14,%r11 movq %r11,-52(%rsi) orq %r10,%r14 movq 4(%rdi),%r10 xorq %r13,%r14 movq 52(%rdi),%r11 movq %r14,-60(%rsi) xorq %rbp,%r10 xorq %rax,%r11 rolq $25,%r10 xorq %rdx,%r9 rolq $8,%r11 xorq %rbx,%r12 rolq $6,%r9 xorq %rcx,%r8 rolq $18,%r12 movq %r10,%r13 andq %r11,%r10 rolq $1,%r8 notq %r11 xorq %r9,%r10 movq %r10,-12(%rsi) movq %r12,%r14 andq %r11,%r12 movq -12(%rdi),%r10 xorq %r13,%r12 movq %r12,-4(%rsi) orq %r9,%r13 movq 84(%rdi),%r12 xorq %r8,%r13 movq %r13,-20(%rsi) andq %r8,%r9 xorq %r14,%r9 movq %r9,12(%rsi) orq %r8,%r14 movq -60(%rdi),%r9 xorq %r11,%r14 movq 36(%rdi),%r11 movq %r14,4(%rsi) movq -68(%rdi),%r8 xorq %rcx,%r10 xorq %rdx,%r11 rolq $10,%r10 xorq %rbx,%r9 rolq $15,%r11 xorq %rbp,%r12 rolq $36,%r9 xorq %rax,%r8 rolq $56,%r12 movq %r10,%r13 orq %r11,%r10 rolq $27,%r8 notq %r11 xorq %r9,%r10 movq %r10,28(%rsi) movq %r12,%r14 orq %r11,%r12 xorq %r13,%r12 movq %r12,36(%rsi) andq %r9,%r13 xorq %r8,%r13 movq %r13,20(%rsi) orq %r8,%r9 xorq %r14,%r9 movq %r9,52(%rsi) andq %r14,%r8 xorq %r11,%r8 movq %r8,44(%rsi) xorq -84(%rdi),%rdx xorq -36(%rdi),%rbp rolq $62,%rdx xorq 68(%rdi),%rcx rolq $55,%rbp xorq 12(%rdi),%rax rolq $2,%rcx xorq 20(%rdi),%rbx xchgq %rsi,%rdi rolq $39,%rax rolq $41,%rbx movq %rdx,%r13 andq %rbp,%rdx notq %rbp xorq %rcx,%rdx movq %rdx,92(%rdi) movq %rax,%r14 andq %rbp,%rax xorq %r13,%rax movq %rax,60(%rdi) orq %rcx,%r13 xorq %rbx,%r13 movq %r13,84(%rdi) andq %rbx,%rcx xorq %r14,%rcx movq %rcx,76(%rdi) orq %r14,%rbx xorq %rbp,%rbx movq %rbx,68(%rdi) movq %rdx,%rbp movq %r13,%rdx testq $255,%r15 jnz L$oop leaq -192(%r15),%r15 .byte 0xf3,0xc3 .cfi_endproc .globl _KeccakF1600 .p2align 5 _KeccakF1600: .cfi_startproc .byte 0xf3,0x0f,0x1e,0xfa pushq %rbx .cfi_adjust_cfa_offset 8 .cfi_offset %rbx,-16 pushq %rbp .cfi_adjust_cfa_offset 8 .cfi_offset %rbp,-24 pushq %r12 .cfi_adjust_cfa_offset 8 .cfi_offset %r12,-32 pushq %r13 .cfi_adjust_cfa_offset 8 .cfi_offset %r13,-40 pushq %r14 .cfi_adjust_cfa_offset 8 .cfi_offset %r14,-48 pushq %r15 .cfi_adjust_cfa_offset 8 .cfi_offset %r15,-56 leaq 100(%rdi),%rdi subq $200,%rsp .cfi_adjust_cfa_offset 200 notq -92(%rdi) notq -84(%rdi) notq -36(%rdi) notq -4(%rdi) notq 36(%rdi) notq 60(%rdi) leaq iotas(%rip),%r15 leaq 100(%rsp),%rsi call __KeccakF1600 notq -92(%rdi) notq -84(%rdi) notq -36(%rdi) notq -4(%rdi) notq 36(%rdi) notq 60(%rdi) leaq -100(%rdi),%rdi addq $200,%rsp .cfi_adjust_cfa_offset -200 popq %r15 .cfi_adjust_cfa_offset -8 .cfi_restore %r15 popq %r14 .cfi_adjust_cfa_offset -8 .cfi_restore %r14 popq %r13 .cfi_adjust_cfa_offset -8 .cfi_restore %r13 popq %r12 .cfi_adjust_cfa_offset -8 .cfi_restore %r12 popq %rbp .cfi_adjust_cfa_offset -8 .cfi_restore %rbp popq %rbx .cfi_adjust_cfa_offset -8 .cfi_restore %rbx .byte 0xf3,0xc3 .cfi_endproc .p2align 8 .quad 0,0,0,0,0,0,0,0 iotas: .quad 0x0000000000000001 .quad 0x0000000000008082 .quad 0x800000000000808a .quad 0x8000000080008000 .quad 0x000000000000808b .quad 0x0000000080000001 .quad 0x8000000080008081 .quad 0x8000000000008009 .quad 0x000000000000008a .quad 0x0000000000000088 .quad 0x0000000080008009 .quad 0x000000008000000a .quad 0x000000008000808b .quad 0x800000000000008b .quad 0x8000000000008089 .quad 0x8000000000008003 .quad 0x8000000000008002 .quad 0x8000000000000080 .quad 0x000000000000800a .quad 0x800000008000000a .quad 0x8000000080008081 .quad 0x8000000000008080 .quad 0x0000000080000001 .quad 0x8000000080008008 .byte 75,101,99,99,97,107,45,49,54,48,48,32,97,98,115,111,114,98,32,97,110,100,32,115,113,117,101,101,122,101,32,102,111,114,32,120,56,54,95,54,52,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
hainakus/Xenomorph-miner
6,073
src/keccakf1600_x86-64.s
# Source: https://github.com/dot-asm/cryptogams/blob/master/x86_64/keccak1600-x86_64.pl .text .type __KeccakF1600,@function .align 32 __KeccakF1600: .cfi_startproc .byte 0xf3,0x0f,0x1e,0xfa movq 60(%rdi),%rax movq 68(%rdi),%rbx movq 76(%rdi),%rcx movq 84(%rdi),%rdx movq 92(%rdi),%rbp jmp .Loop .align 32 .Loop: movq -100(%rdi),%r8 movq -52(%rdi),%r9 movq -4(%rdi),%r10 movq 44(%rdi),%r11 xorq -84(%rdi),%rcx xorq -76(%rdi),%rdx xorq %r8,%rax xorq -92(%rdi),%rbx xorq -44(%rdi),%rcx xorq -60(%rdi),%rax movq %rbp,%r12 xorq -68(%rdi),%rbp xorq %r10,%rcx xorq -20(%rdi),%rax xorq -36(%rdi),%rdx xorq %r9,%rbx xorq -28(%rdi),%rbp xorq 36(%rdi),%rcx xorq 20(%rdi),%rax xorq 4(%rdi),%rdx xorq -12(%rdi),%rbx xorq 12(%rdi),%rbp movq %rcx,%r13 rolq $1,%rcx xorq %rax,%rcx xorq %r11,%rdx rolq $1,%rax xorq %rdx,%rax xorq 28(%rdi),%rbx rolq $1,%rdx xorq %rbx,%rdx xorq 52(%rdi),%rbp rolq $1,%rbx xorq %rbp,%rbx rolq $1,%rbp xorq %r13,%rbp xorq %rcx,%r9 xorq %rdx,%r10 rolq $44,%r9 xorq %rbp,%r11 xorq %rax,%r12 rolq $43,%r10 xorq %rbx,%r8 movq %r9,%r13 rolq $21,%r11 orq %r10,%r9 xorq %r8,%r9 rolq $14,%r12 xorq (%r15),%r9 leaq 8(%r15),%r15 movq %r12,%r14 andq %r11,%r12 movq %r9,-100(%rsi) xorq %r10,%r12 notq %r10 movq %r12,-84(%rsi) orq %r11,%r10 movq 76(%rdi),%r12 xorq %r13,%r10 movq %r10,-92(%rsi) andq %r8,%r13 movq -28(%rdi),%r9 xorq %r14,%r13 movq -20(%rdi),%r10 movq %r13,-68(%rsi) orq %r8,%r14 movq -76(%rdi),%r8 xorq %r11,%r14 movq 28(%rdi),%r11 movq %r14,-76(%rsi) xorq %rbp,%r8 xorq %rdx,%r12 rolq $28,%r8 xorq %rcx,%r11 xorq %rax,%r9 rolq $61,%r12 rolq $45,%r11 xorq %rbx,%r10 rolq $20,%r9 movq %r8,%r13 orq %r12,%r8 rolq $3,%r10 xorq %r11,%r8 movq %r8,-36(%rsi) movq %r9,%r14 andq %r13,%r9 movq -92(%rdi),%r8 xorq %r12,%r9 notq %r12 movq %r9,-28(%rsi) orq %r11,%r12 movq -44(%rdi),%r9 xorq %r10,%r12 movq %r12,-44(%rsi) andq %r10,%r11 movq 60(%rdi),%r12 xorq %r14,%r11 movq %r11,-52(%rsi) orq %r10,%r14 movq 4(%rdi),%r10 xorq %r13,%r14 movq 52(%rdi),%r11 movq %r14,-60(%rsi) xorq %rbp,%r10 xorq %rax,%r11 rolq $25,%r10 xorq %rdx,%r9 rolq $8,%r11 xorq %rbx,%r12 rolq $6,%r9 xorq %rcx,%r8 rolq $18,%r12 movq %r10,%r13 andq %r11,%r10 rolq $1,%r8 notq %r11 xorq %r9,%r10 movq %r10,-12(%rsi) movq %r12,%r14 andq %r11,%r12 movq -12(%rdi),%r10 xorq %r13,%r12 movq %r12,-4(%rsi) orq %r9,%r13 movq 84(%rdi),%r12 xorq %r8,%r13 movq %r13,-20(%rsi) andq %r8,%r9 xorq %r14,%r9 movq %r9,12(%rsi) orq %r8,%r14 movq -60(%rdi),%r9 xorq %r11,%r14 movq 36(%rdi),%r11 movq %r14,4(%rsi) movq -68(%rdi),%r8 xorq %rcx,%r10 xorq %rdx,%r11 rolq $10,%r10 xorq %rbx,%r9 rolq $15,%r11 xorq %rbp,%r12 rolq $36,%r9 xorq %rax,%r8 rolq $56,%r12 movq %r10,%r13 orq %r11,%r10 rolq $27,%r8 notq %r11 xorq %r9,%r10 movq %r10,28(%rsi) movq %r12,%r14 orq %r11,%r12 xorq %r13,%r12 movq %r12,36(%rsi) andq %r9,%r13 xorq %r8,%r13 movq %r13,20(%rsi) orq %r8,%r9 xorq %r14,%r9 movq %r9,52(%rsi) andq %r14,%r8 xorq %r11,%r8 movq %r8,44(%rsi) xorq -84(%rdi),%rdx xorq -36(%rdi),%rbp rolq $62,%rdx xorq 68(%rdi),%rcx rolq $55,%rbp xorq 12(%rdi),%rax rolq $2,%rcx xorq 20(%rdi),%rbx xchgq %rsi,%rdi rolq $39,%rax rolq $41,%rbx movq %rdx,%r13 andq %rbp,%rdx notq %rbp xorq %rcx,%rdx movq %rdx,92(%rdi) movq %rax,%r14 andq %rbp,%rax xorq %r13,%rax movq %rax,60(%rdi) orq %rcx,%r13 xorq %rbx,%r13 movq %r13,84(%rdi) andq %rbx,%rcx xorq %r14,%rcx movq %rcx,76(%rdi) orq %r14,%rbx xorq %rbp,%rbx movq %rbx,68(%rdi) movq %rdx,%rbp movq %r13,%rdx testq $255,%r15 jnz .Loop leaq -192(%r15),%r15 .byte 0xf3,0xc3 .cfi_endproc .size __KeccakF1600,.-__KeccakF1600 .globl KeccakF1600 .type KeccakF1600,@function .align 32 KeccakF1600: .cfi_startproc .byte 0xf3,0x0f,0x1e,0xfa pushq %rbx .cfi_adjust_cfa_offset 8 .cfi_offset %rbx,-16 pushq %rbp .cfi_adjust_cfa_offset 8 .cfi_offset %rbp,-24 pushq %r12 .cfi_adjust_cfa_offset 8 .cfi_offset %r12,-32 pushq %r13 .cfi_adjust_cfa_offset 8 .cfi_offset %r13,-40 pushq %r14 .cfi_adjust_cfa_offset 8 .cfi_offset %r14,-48 pushq %r15 .cfi_adjust_cfa_offset 8 .cfi_offset %r15,-56 leaq 100(%rdi),%rdi subq $200,%rsp .cfi_adjust_cfa_offset 200 notq -92(%rdi) notq -84(%rdi) notq -36(%rdi) notq -4(%rdi) notq 36(%rdi) notq 60(%rdi) leaq iotas(%rip),%r15 leaq 100(%rsp),%rsi call __KeccakF1600 notq -92(%rdi) notq -84(%rdi) notq -36(%rdi) notq -4(%rdi) notq 36(%rdi) notq 60(%rdi) leaq -100(%rdi),%rdi addq $200,%rsp .cfi_adjust_cfa_offset -200 popq %r15 .cfi_adjust_cfa_offset -8 .cfi_restore %r15 popq %r14 .cfi_adjust_cfa_offset -8 .cfi_restore %r14 popq %r13 .cfi_adjust_cfa_offset -8 .cfi_restore %r13 popq %r12 .cfi_adjust_cfa_offset -8 .cfi_restore %r12 popq %rbp .cfi_adjust_cfa_offset -8 .cfi_restore %rbp popq %rbx .cfi_adjust_cfa_offset -8 .cfi_restore %rbx .byte 0xf3,0xc3 .cfi_endproc .size KeccakF1600,.-KeccakF1600 .align 256 .quad 0,0,0,0,0,0,0,0 .type iotas,@object iotas: .quad 0x0000000000000001 .quad 0x0000000000008082 .quad 0x800000000000808a .quad 0x8000000080008000 .quad 0x000000000000808b .quad 0x0000000080000001 .quad 0x8000000080008081 .quad 0x8000000000008009 .quad 0x000000000000008a .quad 0x0000000000000088 .quad 0x0000000080008009 .quad 0x000000008000000a .quad 0x000000008000808b .quad 0x800000000000008b .quad 0x8000000000008089 .quad 0x8000000000008003 .quad 0x8000000000008002 .quad 0x8000000000000080 .quad 0x000000000000800a .quad 0x800000008000000a .quad 0x8000000080008081 .quad 0x8000000000008080 .quad 0x0000000080000001 .quad 0x8000000080008008 .size iotas,.-iotas .byte 75,101,99,99,97,107,45,49,54,48,48,32,97,98,115,111,114,98,32,97,110,100,32,115,113,117,101,101,122,101,32,102,111,114,32,120,56,54,95,54,52,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0 .section .note.gnu.property,"a",@note .long 4,2f-1f,5 .byte 0x47,0x4E,0x55,0 1: .long 0xc0000002,4,3 .align 8 2:
hainakus/xenom-miner
5,802
src/keccakf1600_x86-64-osx.s
# Source: https://github.com/dot-asm/cryptogams/blob/master/x86_64/keccak1600-x86_64.pl .text .p2align 5 __KeccakF1600: .cfi_startproc .byte 0xf3,0x0f,0x1e,0xfa movq 60(%rdi),%rax movq 68(%rdi),%rbx movq 76(%rdi),%rcx movq 84(%rdi),%rdx movq 92(%rdi),%rbp jmp L$oop .p2align 5 L$oop: movq -100(%rdi),%r8 movq -52(%rdi),%r9 movq -4(%rdi),%r10 movq 44(%rdi),%r11 xorq -84(%rdi),%rcx xorq -76(%rdi),%rdx xorq %r8,%rax xorq -92(%rdi),%rbx xorq -44(%rdi),%rcx xorq -60(%rdi),%rax movq %rbp,%r12 xorq -68(%rdi),%rbp xorq %r10,%rcx xorq -20(%rdi),%rax xorq -36(%rdi),%rdx xorq %r9,%rbx xorq -28(%rdi),%rbp xorq 36(%rdi),%rcx xorq 20(%rdi),%rax xorq 4(%rdi),%rdx xorq -12(%rdi),%rbx xorq 12(%rdi),%rbp movq %rcx,%r13 rolq $1,%rcx xorq %rax,%rcx xorq %r11,%rdx rolq $1,%rax xorq %rdx,%rax xorq 28(%rdi),%rbx rolq $1,%rdx xorq %rbx,%rdx xorq 52(%rdi),%rbp rolq $1,%rbx xorq %rbp,%rbx rolq $1,%rbp xorq %r13,%rbp xorq %rcx,%r9 xorq %rdx,%r10 rolq $44,%r9 xorq %rbp,%r11 xorq %rax,%r12 rolq $43,%r10 xorq %rbx,%r8 movq %r9,%r13 rolq $21,%r11 orq %r10,%r9 xorq %r8,%r9 rolq $14,%r12 xorq (%r15),%r9 leaq 8(%r15),%r15 movq %r12,%r14 andq %r11,%r12 movq %r9,-100(%rsi) xorq %r10,%r12 notq %r10 movq %r12,-84(%rsi) orq %r11,%r10 movq 76(%rdi),%r12 xorq %r13,%r10 movq %r10,-92(%rsi) andq %r8,%r13 movq -28(%rdi),%r9 xorq %r14,%r13 movq -20(%rdi),%r10 movq %r13,-68(%rsi) orq %r8,%r14 movq -76(%rdi),%r8 xorq %r11,%r14 movq 28(%rdi),%r11 movq %r14,-76(%rsi) xorq %rbp,%r8 xorq %rdx,%r12 rolq $28,%r8 xorq %rcx,%r11 xorq %rax,%r9 rolq $61,%r12 rolq $45,%r11 xorq %rbx,%r10 rolq $20,%r9 movq %r8,%r13 orq %r12,%r8 rolq $3,%r10 xorq %r11,%r8 movq %r8,-36(%rsi) movq %r9,%r14 andq %r13,%r9 movq -92(%rdi),%r8 xorq %r12,%r9 notq %r12 movq %r9,-28(%rsi) orq %r11,%r12 movq -44(%rdi),%r9 xorq %r10,%r12 movq %r12,-44(%rsi) andq %r10,%r11 movq 60(%rdi),%r12 xorq %r14,%r11 movq %r11,-52(%rsi) orq %r10,%r14 movq 4(%rdi),%r10 xorq %r13,%r14 movq 52(%rdi),%r11 movq %r14,-60(%rsi) xorq %rbp,%r10 xorq %rax,%r11 rolq $25,%r10 xorq %rdx,%r9 rolq $8,%r11 xorq %rbx,%r12 rolq $6,%r9 xorq %rcx,%r8 rolq $18,%r12 movq %r10,%r13 andq %r11,%r10 rolq $1,%r8 notq %r11 xorq %r9,%r10 movq %r10,-12(%rsi) movq %r12,%r14 andq %r11,%r12 movq -12(%rdi),%r10 xorq %r13,%r12 movq %r12,-4(%rsi) orq %r9,%r13 movq 84(%rdi),%r12 xorq %r8,%r13 movq %r13,-20(%rsi) andq %r8,%r9 xorq %r14,%r9 movq %r9,12(%rsi) orq %r8,%r14 movq -60(%rdi),%r9 xorq %r11,%r14 movq 36(%rdi),%r11 movq %r14,4(%rsi) movq -68(%rdi),%r8 xorq %rcx,%r10 xorq %rdx,%r11 rolq $10,%r10 xorq %rbx,%r9 rolq $15,%r11 xorq %rbp,%r12 rolq $36,%r9 xorq %rax,%r8 rolq $56,%r12 movq %r10,%r13 orq %r11,%r10 rolq $27,%r8 notq %r11 xorq %r9,%r10 movq %r10,28(%rsi) movq %r12,%r14 orq %r11,%r12 xorq %r13,%r12 movq %r12,36(%rsi) andq %r9,%r13 xorq %r8,%r13 movq %r13,20(%rsi) orq %r8,%r9 xorq %r14,%r9 movq %r9,52(%rsi) andq %r14,%r8 xorq %r11,%r8 movq %r8,44(%rsi) xorq -84(%rdi),%rdx xorq -36(%rdi),%rbp rolq $62,%rdx xorq 68(%rdi),%rcx rolq $55,%rbp xorq 12(%rdi),%rax rolq $2,%rcx xorq 20(%rdi),%rbx xchgq %rsi,%rdi rolq $39,%rax rolq $41,%rbx movq %rdx,%r13 andq %rbp,%rdx notq %rbp xorq %rcx,%rdx movq %rdx,92(%rdi) movq %rax,%r14 andq %rbp,%rax xorq %r13,%rax movq %rax,60(%rdi) orq %rcx,%r13 xorq %rbx,%r13 movq %r13,84(%rdi) andq %rbx,%rcx xorq %r14,%rcx movq %rcx,76(%rdi) orq %r14,%rbx xorq %rbp,%rbx movq %rbx,68(%rdi) movq %rdx,%rbp movq %r13,%rdx testq $255,%r15 jnz L$oop leaq -192(%r15),%r15 .byte 0xf3,0xc3 .cfi_endproc .globl _KeccakF1600 .p2align 5 _KeccakF1600: .cfi_startproc .byte 0xf3,0x0f,0x1e,0xfa pushq %rbx .cfi_adjust_cfa_offset 8 .cfi_offset %rbx,-16 pushq %rbp .cfi_adjust_cfa_offset 8 .cfi_offset %rbp,-24 pushq %r12 .cfi_adjust_cfa_offset 8 .cfi_offset %r12,-32 pushq %r13 .cfi_adjust_cfa_offset 8 .cfi_offset %r13,-40 pushq %r14 .cfi_adjust_cfa_offset 8 .cfi_offset %r14,-48 pushq %r15 .cfi_adjust_cfa_offset 8 .cfi_offset %r15,-56 leaq 100(%rdi),%rdi subq $200,%rsp .cfi_adjust_cfa_offset 200 notq -92(%rdi) notq -84(%rdi) notq -36(%rdi) notq -4(%rdi) notq 36(%rdi) notq 60(%rdi) leaq iotas(%rip),%r15 leaq 100(%rsp),%rsi call __KeccakF1600 notq -92(%rdi) notq -84(%rdi) notq -36(%rdi) notq -4(%rdi) notq 36(%rdi) notq 60(%rdi) leaq -100(%rdi),%rdi addq $200,%rsp .cfi_adjust_cfa_offset -200 popq %r15 .cfi_adjust_cfa_offset -8 .cfi_restore %r15 popq %r14 .cfi_adjust_cfa_offset -8 .cfi_restore %r14 popq %r13 .cfi_adjust_cfa_offset -8 .cfi_restore %r13 popq %r12 .cfi_adjust_cfa_offset -8 .cfi_restore %r12 popq %rbp .cfi_adjust_cfa_offset -8 .cfi_restore %rbp popq %rbx .cfi_adjust_cfa_offset -8 .cfi_restore %rbx .byte 0xf3,0xc3 .cfi_endproc .p2align 8 .quad 0,0,0,0,0,0,0,0 iotas: .quad 0x0000000000000001 .quad 0x0000000000008082 .quad 0x800000000000808a .quad 0x8000000080008000 .quad 0x000000000000808b .quad 0x0000000080000001 .quad 0x8000000080008081 .quad 0x8000000000008009 .quad 0x000000000000008a .quad 0x0000000000000088 .quad 0x0000000080008009 .quad 0x000000008000000a .quad 0x000000008000808b .quad 0x800000000000008b .quad 0x8000000000008089 .quad 0x8000000000008003 .quad 0x8000000000008002 .quad 0x8000000000000080 .quad 0x000000000000800a .quad 0x800000008000000a .quad 0x8000000080008081 .quad 0x8000000000008080 .quad 0x0000000080000001 .quad 0x8000000080008008 .byte 75,101,99,99,97,107,45,49,54,48,48,32,97,98,115,111,114,98,32,97,110,100,32,115,113,117,101,101,122,101,32,102,111,114,32,120,56,54,95,54,52,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
hainakus/xenom-miner
6,073
src/keccakf1600_x86-64.s
# Source: https://github.com/dot-asm/cryptogams/blob/master/x86_64/keccak1600-x86_64.pl .text .type __KeccakF1600,@function .align 32 __KeccakF1600: .cfi_startproc .byte 0xf3,0x0f,0x1e,0xfa movq 60(%rdi),%rax movq 68(%rdi),%rbx movq 76(%rdi),%rcx movq 84(%rdi),%rdx movq 92(%rdi),%rbp jmp .Loop .align 32 .Loop: movq -100(%rdi),%r8 movq -52(%rdi),%r9 movq -4(%rdi),%r10 movq 44(%rdi),%r11 xorq -84(%rdi),%rcx xorq -76(%rdi),%rdx xorq %r8,%rax xorq -92(%rdi),%rbx xorq -44(%rdi),%rcx xorq -60(%rdi),%rax movq %rbp,%r12 xorq -68(%rdi),%rbp xorq %r10,%rcx xorq -20(%rdi),%rax xorq -36(%rdi),%rdx xorq %r9,%rbx xorq -28(%rdi),%rbp xorq 36(%rdi),%rcx xorq 20(%rdi),%rax xorq 4(%rdi),%rdx xorq -12(%rdi),%rbx xorq 12(%rdi),%rbp movq %rcx,%r13 rolq $1,%rcx xorq %rax,%rcx xorq %r11,%rdx rolq $1,%rax xorq %rdx,%rax xorq 28(%rdi),%rbx rolq $1,%rdx xorq %rbx,%rdx xorq 52(%rdi),%rbp rolq $1,%rbx xorq %rbp,%rbx rolq $1,%rbp xorq %r13,%rbp xorq %rcx,%r9 xorq %rdx,%r10 rolq $44,%r9 xorq %rbp,%r11 xorq %rax,%r12 rolq $43,%r10 xorq %rbx,%r8 movq %r9,%r13 rolq $21,%r11 orq %r10,%r9 xorq %r8,%r9 rolq $14,%r12 xorq (%r15),%r9 leaq 8(%r15),%r15 movq %r12,%r14 andq %r11,%r12 movq %r9,-100(%rsi) xorq %r10,%r12 notq %r10 movq %r12,-84(%rsi) orq %r11,%r10 movq 76(%rdi),%r12 xorq %r13,%r10 movq %r10,-92(%rsi) andq %r8,%r13 movq -28(%rdi),%r9 xorq %r14,%r13 movq -20(%rdi),%r10 movq %r13,-68(%rsi) orq %r8,%r14 movq -76(%rdi),%r8 xorq %r11,%r14 movq 28(%rdi),%r11 movq %r14,-76(%rsi) xorq %rbp,%r8 xorq %rdx,%r12 rolq $28,%r8 xorq %rcx,%r11 xorq %rax,%r9 rolq $61,%r12 rolq $45,%r11 xorq %rbx,%r10 rolq $20,%r9 movq %r8,%r13 orq %r12,%r8 rolq $3,%r10 xorq %r11,%r8 movq %r8,-36(%rsi) movq %r9,%r14 andq %r13,%r9 movq -92(%rdi),%r8 xorq %r12,%r9 notq %r12 movq %r9,-28(%rsi) orq %r11,%r12 movq -44(%rdi),%r9 xorq %r10,%r12 movq %r12,-44(%rsi) andq %r10,%r11 movq 60(%rdi),%r12 xorq %r14,%r11 movq %r11,-52(%rsi) orq %r10,%r14 movq 4(%rdi),%r10 xorq %r13,%r14 movq 52(%rdi),%r11 movq %r14,-60(%rsi) xorq %rbp,%r10 xorq %rax,%r11 rolq $25,%r10 xorq %rdx,%r9 rolq $8,%r11 xorq %rbx,%r12 rolq $6,%r9 xorq %rcx,%r8 rolq $18,%r12 movq %r10,%r13 andq %r11,%r10 rolq $1,%r8 notq %r11 xorq %r9,%r10 movq %r10,-12(%rsi) movq %r12,%r14 andq %r11,%r12 movq -12(%rdi),%r10 xorq %r13,%r12 movq %r12,-4(%rsi) orq %r9,%r13 movq 84(%rdi),%r12 xorq %r8,%r13 movq %r13,-20(%rsi) andq %r8,%r9 xorq %r14,%r9 movq %r9,12(%rsi) orq %r8,%r14 movq -60(%rdi),%r9 xorq %r11,%r14 movq 36(%rdi),%r11 movq %r14,4(%rsi) movq -68(%rdi),%r8 xorq %rcx,%r10 xorq %rdx,%r11 rolq $10,%r10 xorq %rbx,%r9 rolq $15,%r11 xorq %rbp,%r12 rolq $36,%r9 xorq %rax,%r8 rolq $56,%r12 movq %r10,%r13 orq %r11,%r10 rolq $27,%r8 notq %r11 xorq %r9,%r10 movq %r10,28(%rsi) movq %r12,%r14 orq %r11,%r12 xorq %r13,%r12 movq %r12,36(%rsi) andq %r9,%r13 xorq %r8,%r13 movq %r13,20(%rsi) orq %r8,%r9 xorq %r14,%r9 movq %r9,52(%rsi) andq %r14,%r8 xorq %r11,%r8 movq %r8,44(%rsi) xorq -84(%rdi),%rdx xorq -36(%rdi),%rbp rolq $62,%rdx xorq 68(%rdi),%rcx rolq $55,%rbp xorq 12(%rdi),%rax rolq $2,%rcx xorq 20(%rdi),%rbx xchgq %rsi,%rdi rolq $39,%rax rolq $41,%rbx movq %rdx,%r13 andq %rbp,%rdx notq %rbp xorq %rcx,%rdx movq %rdx,92(%rdi) movq %rax,%r14 andq %rbp,%rax xorq %r13,%rax movq %rax,60(%rdi) orq %rcx,%r13 xorq %rbx,%r13 movq %r13,84(%rdi) andq %rbx,%rcx xorq %r14,%rcx movq %rcx,76(%rdi) orq %r14,%rbx xorq %rbp,%rbx movq %rbx,68(%rdi) movq %rdx,%rbp movq %r13,%rdx testq $255,%r15 jnz .Loop leaq -192(%r15),%r15 .byte 0xf3,0xc3 .cfi_endproc .size __KeccakF1600,.-__KeccakF1600 .globl KeccakF1600 .type KeccakF1600,@function .align 32 KeccakF1600: .cfi_startproc .byte 0xf3,0x0f,0x1e,0xfa pushq %rbx .cfi_adjust_cfa_offset 8 .cfi_offset %rbx,-16 pushq %rbp .cfi_adjust_cfa_offset 8 .cfi_offset %rbp,-24 pushq %r12 .cfi_adjust_cfa_offset 8 .cfi_offset %r12,-32 pushq %r13 .cfi_adjust_cfa_offset 8 .cfi_offset %r13,-40 pushq %r14 .cfi_adjust_cfa_offset 8 .cfi_offset %r14,-48 pushq %r15 .cfi_adjust_cfa_offset 8 .cfi_offset %r15,-56 leaq 100(%rdi),%rdi subq $200,%rsp .cfi_adjust_cfa_offset 200 notq -92(%rdi) notq -84(%rdi) notq -36(%rdi) notq -4(%rdi) notq 36(%rdi) notq 60(%rdi) leaq iotas(%rip),%r15 leaq 100(%rsp),%rsi call __KeccakF1600 notq -92(%rdi) notq -84(%rdi) notq -36(%rdi) notq -4(%rdi) notq 36(%rdi) notq 60(%rdi) leaq -100(%rdi),%rdi addq $200,%rsp .cfi_adjust_cfa_offset -200 popq %r15 .cfi_adjust_cfa_offset -8 .cfi_restore %r15 popq %r14 .cfi_adjust_cfa_offset -8 .cfi_restore %r14 popq %r13 .cfi_adjust_cfa_offset -8 .cfi_restore %r13 popq %r12 .cfi_adjust_cfa_offset -8 .cfi_restore %r12 popq %rbp .cfi_adjust_cfa_offset -8 .cfi_restore %rbp popq %rbx .cfi_adjust_cfa_offset -8 .cfi_restore %rbx .byte 0xf3,0xc3 .cfi_endproc .size KeccakF1600,.-KeccakF1600 .align 256 .quad 0,0,0,0,0,0,0,0 .type iotas,@object iotas: .quad 0x0000000000000001 .quad 0x0000000000008082 .quad 0x800000000000808a .quad 0x8000000080008000 .quad 0x000000000000808b .quad 0x0000000080000001 .quad 0x8000000080008081 .quad 0x8000000000008009 .quad 0x000000000000008a .quad 0x0000000000000088 .quad 0x0000000080008009 .quad 0x000000008000000a .quad 0x000000008000808b .quad 0x800000000000008b .quad 0x8000000000008089 .quad 0x8000000000008003 .quad 0x8000000000008002 .quad 0x8000000000000080 .quad 0x000000000000800a .quad 0x800000008000000a .quad 0x8000000080008081 .quad 0x8000000000008080 .quad 0x0000000080000001 .quad 0x8000000080008008 .size iotas,.-iotas .byte 75,101,99,99,97,107,45,49,54,48,48,32,97,98,115,111,114,98,32,97,110,100,32,115,113,117,101,101,122,101,32,102,111,114,32,120,56,54,95,54,52,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0 .section .note.gnu.property,"a",@note .long 4,2f-1f,5 .byte 0x47,0x4E,0x55,0 1: .long 0xc0000002,4,3 .align 8 2:
hainakus/pico_kid
5,802
crypto/muhash/src/keccakf1600_x86-64-osx.s
# Source: https://github.com/dot-asm/cryptogams/blob/master/x86_64/keccak1600-x86_64.pl .text .p2align 5 __KeccakF1600: .cfi_startproc .byte 0xf3,0x0f,0x1e,0xfa movq 60(%rdi),%rax movq 68(%rdi),%rbx movq 76(%rdi),%rcx movq 84(%rdi),%rdx movq 92(%rdi),%rbp jmp L$oop .p2align 5 L$oop: movq -100(%rdi),%r8 movq -52(%rdi),%r9 movq -4(%rdi),%r10 movq 44(%rdi),%r11 xorq -84(%rdi),%rcx xorq -76(%rdi),%rdx xorq %r8,%rax xorq -92(%rdi),%rbx xorq -44(%rdi),%rcx xorq -60(%rdi),%rax movq %rbp,%r12 xorq -68(%rdi),%rbp xorq %r10,%rcx xorq -20(%rdi),%rax xorq -36(%rdi),%rdx xorq %r9,%rbx xorq -28(%rdi),%rbp xorq 36(%rdi),%rcx xorq 20(%rdi),%rax xorq 4(%rdi),%rdx xorq -12(%rdi),%rbx xorq 12(%rdi),%rbp movq %rcx,%r13 rolq $1,%rcx xorq %rax,%rcx xorq %r11,%rdx rolq $1,%rax xorq %rdx,%rax xorq 28(%rdi),%rbx rolq $1,%rdx xorq %rbx,%rdx xorq 52(%rdi),%rbp rolq $1,%rbx xorq %rbp,%rbx rolq $1,%rbp xorq %r13,%rbp xorq %rcx,%r9 xorq %rdx,%r10 rolq $44,%r9 xorq %rbp,%r11 xorq %rax,%r12 rolq $43,%r10 xorq %rbx,%r8 movq %r9,%r13 rolq $21,%r11 orq %r10,%r9 xorq %r8,%r9 rolq $14,%r12 xorq (%r15),%r9 leaq 8(%r15),%r15 movq %r12,%r14 andq %r11,%r12 movq %r9,-100(%rsi) xorq %r10,%r12 notq %r10 movq %r12,-84(%rsi) orq %r11,%r10 movq 76(%rdi),%r12 xorq %r13,%r10 movq %r10,-92(%rsi) andq %r8,%r13 movq -28(%rdi),%r9 xorq %r14,%r13 movq -20(%rdi),%r10 movq %r13,-68(%rsi) orq %r8,%r14 movq -76(%rdi),%r8 xorq %r11,%r14 movq 28(%rdi),%r11 movq %r14,-76(%rsi) xorq %rbp,%r8 xorq %rdx,%r12 rolq $28,%r8 xorq %rcx,%r11 xorq %rax,%r9 rolq $61,%r12 rolq $45,%r11 xorq %rbx,%r10 rolq $20,%r9 movq %r8,%r13 orq %r12,%r8 rolq $3,%r10 xorq %r11,%r8 movq %r8,-36(%rsi) movq %r9,%r14 andq %r13,%r9 movq -92(%rdi),%r8 xorq %r12,%r9 notq %r12 movq %r9,-28(%rsi) orq %r11,%r12 movq -44(%rdi),%r9 xorq %r10,%r12 movq %r12,-44(%rsi) andq %r10,%r11 movq 60(%rdi),%r12 xorq %r14,%r11 movq %r11,-52(%rsi) orq %r10,%r14 movq 4(%rdi),%r10 xorq %r13,%r14 movq 52(%rdi),%r11 movq %r14,-60(%rsi) xorq %rbp,%r10 xorq %rax,%r11 rolq $25,%r10 xorq %rdx,%r9 rolq $8,%r11 xorq %rbx,%r12 rolq $6,%r9 xorq %rcx,%r8 rolq $18,%r12 movq %r10,%r13 andq %r11,%r10 rolq $1,%r8 notq %r11 xorq %r9,%r10 movq %r10,-12(%rsi) movq %r12,%r14 andq %r11,%r12 movq -12(%rdi),%r10 xorq %r13,%r12 movq %r12,-4(%rsi) orq %r9,%r13 movq 84(%rdi),%r12 xorq %r8,%r13 movq %r13,-20(%rsi) andq %r8,%r9 xorq %r14,%r9 movq %r9,12(%rsi) orq %r8,%r14 movq -60(%rdi),%r9 xorq %r11,%r14 movq 36(%rdi),%r11 movq %r14,4(%rsi) movq -68(%rdi),%r8 xorq %rcx,%r10 xorq %rdx,%r11 rolq $10,%r10 xorq %rbx,%r9 rolq $15,%r11 xorq %rbp,%r12 rolq $36,%r9 xorq %rax,%r8 rolq $56,%r12 movq %r10,%r13 orq %r11,%r10 rolq $27,%r8 notq %r11 xorq %r9,%r10 movq %r10,28(%rsi) movq %r12,%r14 orq %r11,%r12 xorq %r13,%r12 movq %r12,36(%rsi) andq %r9,%r13 xorq %r8,%r13 movq %r13,20(%rsi) orq %r8,%r9 xorq %r14,%r9 movq %r9,52(%rsi) andq %r14,%r8 xorq %r11,%r8 movq %r8,44(%rsi) xorq -84(%rdi),%rdx xorq -36(%rdi),%rbp rolq $62,%rdx xorq 68(%rdi),%rcx rolq $55,%rbp xorq 12(%rdi),%rax rolq $2,%rcx xorq 20(%rdi),%rbx xchgq %rsi,%rdi rolq $39,%rax rolq $41,%rbx movq %rdx,%r13 andq %rbp,%rdx notq %rbp xorq %rcx,%rdx movq %rdx,92(%rdi) movq %rax,%r14 andq %rbp,%rax xorq %r13,%rax movq %rax,60(%rdi) orq %rcx,%r13 xorq %rbx,%r13 movq %r13,84(%rdi) andq %rbx,%rcx xorq %r14,%rcx movq %rcx,76(%rdi) orq %r14,%rbx xorq %rbp,%rbx movq %rbx,68(%rdi) movq %rdx,%rbp movq %r13,%rdx testq $255,%r15 jnz L$oop leaq -192(%r15),%r15 .byte 0xf3,0xc3 .cfi_endproc .globl _KeccakF1600 .p2align 5 _KeccakF1600: .cfi_startproc .byte 0xf3,0x0f,0x1e,0xfa pushq %rbx .cfi_adjust_cfa_offset 8 .cfi_offset %rbx,-16 pushq %rbp .cfi_adjust_cfa_offset 8 .cfi_offset %rbp,-24 pushq %r12 .cfi_adjust_cfa_offset 8 .cfi_offset %r12,-32 pushq %r13 .cfi_adjust_cfa_offset 8 .cfi_offset %r13,-40 pushq %r14 .cfi_adjust_cfa_offset 8 .cfi_offset %r14,-48 pushq %r15 .cfi_adjust_cfa_offset 8 .cfi_offset %r15,-56 leaq 100(%rdi),%rdi subq $200,%rsp .cfi_adjust_cfa_offset 200 notq -92(%rdi) notq -84(%rdi) notq -36(%rdi) notq -4(%rdi) notq 36(%rdi) notq 60(%rdi) leaq iotas(%rip),%r15 leaq 100(%rsp),%rsi call __KeccakF1600 notq -92(%rdi) notq -84(%rdi) notq -36(%rdi) notq -4(%rdi) notq 36(%rdi) notq 60(%rdi) leaq -100(%rdi),%rdi addq $200,%rsp .cfi_adjust_cfa_offset -200 popq %r15 .cfi_adjust_cfa_offset -8 .cfi_restore %r15 popq %r14 .cfi_adjust_cfa_offset -8 .cfi_restore %r14 popq %r13 .cfi_adjust_cfa_offset -8 .cfi_restore %r13 popq %r12 .cfi_adjust_cfa_offset -8 .cfi_restore %r12 popq %rbp .cfi_adjust_cfa_offset -8 .cfi_restore %rbp popq %rbx .cfi_adjust_cfa_offset -8 .cfi_restore %rbx .byte 0xf3,0xc3 .cfi_endproc .p2align 8 .quad 0,0,0,0,0,0,0,0 iotas: .quad 0x0000000000000001 .quad 0x0000000000008082 .quad 0x800000000000808a .quad 0x8000000080008000 .quad 0x000000000000808b .quad 0x0000000080000001 .quad 0x8000000080008081 .quad 0x8000000000008009 .quad 0x000000000000008a .quad 0x0000000000000088 .quad 0x0000000080008009 .quad 0x000000008000000a .quad 0x000000008000808b .quad 0x800000000000008b .quad 0x8000000000008089 .quad 0x8000000000008003 .quad 0x8000000000008002 .quad 0x8000000000000080 .quad 0x000000000000800a .quad 0x800000008000000a .quad 0x8000000080008081 .quad 0x8000000000008080 .quad 0x0000000080000001 .quad 0x8000000080008008 .byte 75,101,99,99,97,107,45,49,54,48,48,32,97,98,115,111,114,98,32,97,110,100,32,115,113,117,101,101,122,101,32,102,111,114,32,120,56,54,95,54,52,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
hainakus/pico_kid
6,073
crypto/muhash/src/keccakf1600_x86-64.s
# Source: https://github.com/dot-asm/cryptogams/blob/master/x86_64/keccak1600-x86_64.pl .text .type __KeccakF1600,@function .align 32 __KeccakF1600: .cfi_startproc .byte 0xf3,0x0f,0x1e,0xfa movq 60(%rdi),%rax movq 68(%rdi),%rbx movq 76(%rdi),%rcx movq 84(%rdi),%rdx movq 92(%rdi),%rbp jmp .Loop .align 32 .Loop: movq -100(%rdi),%r8 movq -52(%rdi),%r9 movq -4(%rdi),%r10 movq 44(%rdi),%r11 xorq -84(%rdi),%rcx xorq -76(%rdi),%rdx xorq %r8,%rax xorq -92(%rdi),%rbx xorq -44(%rdi),%rcx xorq -60(%rdi),%rax movq %rbp,%r12 xorq -68(%rdi),%rbp xorq %r10,%rcx xorq -20(%rdi),%rax xorq -36(%rdi),%rdx xorq %r9,%rbx xorq -28(%rdi),%rbp xorq 36(%rdi),%rcx xorq 20(%rdi),%rax xorq 4(%rdi),%rdx xorq -12(%rdi),%rbx xorq 12(%rdi),%rbp movq %rcx,%r13 rolq $1,%rcx xorq %rax,%rcx xorq %r11,%rdx rolq $1,%rax xorq %rdx,%rax xorq 28(%rdi),%rbx rolq $1,%rdx xorq %rbx,%rdx xorq 52(%rdi),%rbp rolq $1,%rbx xorq %rbp,%rbx rolq $1,%rbp xorq %r13,%rbp xorq %rcx,%r9 xorq %rdx,%r10 rolq $44,%r9 xorq %rbp,%r11 xorq %rax,%r12 rolq $43,%r10 xorq %rbx,%r8 movq %r9,%r13 rolq $21,%r11 orq %r10,%r9 xorq %r8,%r9 rolq $14,%r12 xorq (%r15),%r9 leaq 8(%r15),%r15 movq %r12,%r14 andq %r11,%r12 movq %r9,-100(%rsi) xorq %r10,%r12 notq %r10 movq %r12,-84(%rsi) orq %r11,%r10 movq 76(%rdi),%r12 xorq %r13,%r10 movq %r10,-92(%rsi) andq %r8,%r13 movq -28(%rdi),%r9 xorq %r14,%r13 movq -20(%rdi),%r10 movq %r13,-68(%rsi) orq %r8,%r14 movq -76(%rdi),%r8 xorq %r11,%r14 movq 28(%rdi),%r11 movq %r14,-76(%rsi) xorq %rbp,%r8 xorq %rdx,%r12 rolq $28,%r8 xorq %rcx,%r11 xorq %rax,%r9 rolq $61,%r12 rolq $45,%r11 xorq %rbx,%r10 rolq $20,%r9 movq %r8,%r13 orq %r12,%r8 rolq $3,%r10 xorq %r11,%r8 movq %r8,-36(%rsi) movq %r9,%r14 andq %r13,%r9 movq -92(%rdi),%r8 xorq %r12,%r9 notq %r12 movq %r9,-28(%rsi) orq %r11,%r12 movq -44(%rdi),%r9 xorq %r10,%r12 movq %r12,-44(%rsi) andq %r10,%r11 movq 60(%rdi),%r12 xorq %r14,%r11 movq %r11,-52(%rsi) orq %r10,%r14 movq 4(%rdi),%r10 xorq %r13,%r14 movq 52(%rdi),%r11 movq %r14,-60(%rsi) xorq %rbp,%r10 xorq %rax,%r11 rolq $25,%r10 xorq %rdx,%r9 rolq $8,%r11 xorq %rbx,%r12 rolq $6,%r9 xorq %rcx,%r8 rolq $18,%r12 movq %r10,%r13 andq %r11,%r10 rolq $1,%r8 notq %r11 xorq %r9,%r10 movq %r10,-12(%rsi) movq %r12,%r14 andq %r11,%r12 movq -12(%rdi),%r10 xorq %r13,%r12 movq %r12,-4(%rsi) orq %r9,%r13 movq 84(%rdi),%r12 xorq %r8,%r13 movq %r13,-20(%rsi) andq %r8,%r9 xorq %r14,%r9 movq %r9,12(%rsi) orq %r8,%r14 movq -60(%rdi),%r9 xorq %r11,%r14 movq 36(%rdi),%r11 movq %r14,4(%rsi) movq -68(%rdi),%r8 xorq %rcx,%r10 xorq %rdx,%r11 rolq $10,%r10 xorq %rbx,%r9 rolq $15,%r11 xorq %rbp,%r12 rolq $36,%r9 xorq %rax,%r8 rolq $56,%r12 movq %r10,%r13 orq %r11,%r10 rolq $27,%r8 notq %r11 xorq %r9,%r10 movq %r10,28(%rsi) movq %r12,%r14 orq %r11,%r12 xorq %r13,%r12 movq %r12,36(%rsi) andq %r9,%r13 xorq %r8,%r13 movq %r13,20(%rsi) orq %r8,%r9 xorq %r14,%r9 movq %r9,52(%rsi) andq %r14,%r8 xorq %r11,%r8 movq %r8,44(%rsi) xorq -84(%rdi),%rdx xorq -36(%rdi),%rbp rolq $62,%rdx xorq 68(%rdi),%rcx rolq $55,%rbp xorq 12(%rdi),%rax rolq $2,%rcx xorq 20(%rdi),%rbx xchgq %rsi,%rdi rolq $39,%rax rolq $41,%rbx movq %rdx,%r13 andq %rbp,%rdx notq %rbp xorq %rcx,%rdx movq %rdx,92(%rdi) movq %rax,%r14 andq %rbp,%rax xorq %r13,%rax movq %rax,60(%rdi) orq %rcx,%r13 xorq %rbx,%r13 movq %r13,84(%rdi) andq %rbx,%rcx xorq %r14,%rcx movq %rcx,76(%rdi) orq %r14,%rbx xorq %rbp,%rbx movq %rbx,68(%rdi) movq %rdx,%rbp movq %r13,%rdx testq $255,%r15 jnz .Loop leaq -192(%r15),%r15 .byte 0xf3,0xc3 .cfi_endproc .size __KeccakF1600,.-__KeccakF1600 .globl KeccakF1600 .type KeccakF1600,@function .align 32 KeccakF1600: .cfi_startproc .byte 0xf3,0x0f,0x1e,0xfa pushq %rbx .cfi_adjust_cfa_offset 8 .cfi_offset %rbx,-16 pushq %rbp .cfi_adjust_cfa_offset 8 .cfi_offset %rbp,-24 pushq %r12 .cfi_adjust_cfa_offset 8 .cfi_offset %r12,-32 pushq %r13 .cfi_adjust_cfa_offset 8 .cfi_offset %r13,-40 pushq %r14 .cfi_adjust_cfa_offset 8 .cfi_offset %r14,-48 pushq %r15 .cfi_adjust_cfa_offset 8 .cfi_offset %r15,-56 leaq 100(%rdi),%rdi subq $200,%rsp .cfi_adjust_cfa_offset 200 notq -92(%rdi) notq -84(%rdi) notq -36(%rdi) notq -4(%rdi) notq 36(%rdi) notq 60(%rdi) leaq iotas(%rip),%r15 leaq 100(%rsp),%rsi call __KeccakF1600 notq -92(%rdi) notq -84(%rdi) notq -36(%rdi) notq -4(%rdi) notq 36(%rdi) notq 60(%rdi) leaq -100(%rdi),%rdi addq $200,%rsp .cfi_adjust_cfa_offset -200 popq %r15 .cfi_adjust_cfa_offset -8 .cfi_restore %r15 popq %r14 .cfi_adjust_cfa_offset -8 .cfi_restore %r14 popq %r13 .cfi_adjust_cfa_offset -8 .cfi_restore %r13 popq %r12 .cfi_adjust_cfa_offset -8 .cfi_restore %r12 popq %rbp .cfi_adjust_cfa_offset -8 .cfi_restore %rbp popq %rbx .cfi_adjust_cfa_offset -8 .cfi_restore %rbx .byte 0xf3,0xc3 .cfi_endproc .size KeccakF1600,.-KeccakF1600 .align 256 .quad 0,0,0,0,0,0,0,0 .type iotas,@object iotas: .quad 0x0000000000000001 .quad 0x0000000000008082 .quad 0x800000000000808a .quad 0x8000000080008000 .quad 0x000000000000808b .quad 0x0000000080000001 .quad 0x8000000080008081 .quad 0x8000000000008009 .quad 0x000000000000008a .quad 0x0000000000000088 .quad 0x0000000080008009 .quad 0x000000008000000a .quad 0x000000008000808b .quad 0x800000000000008b .quad 0x8000000000008089 .quad 0x8000000000008003 .quad 0x8000000000008002 .quad 0x8000000000000080 .quad 0x000000000000800a .quad 0x800000008000000a .quad 0x8000000080008081 .quad 0x8000000000008080 .quad 0x0000000080000001 .quad 0x8000000080008008 .size iotas,.-iotas .byte 75,101,99,99,97,107,45,49,54,48,48,32,97,98,115,111,114,98,32,97,110,100,32,115,113,117,101,101,122,101,32,102,111,114,32,120,56,54,95,54,52,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0 .section .note.gnu.property,"a",@note .long 4,2f-1f,5 .byte 0x47,0x4E,0x55,0 1: .long 0xc0000002,4,3 .align 8 2:
hainakus/pico_kid
5,802
crypto/hashes/src/keccakf1600_x86-64-osx.s
# Source: https://github.com/dot-asm/cryptogams/blob/master/x86_64/keccak1600-x86_64.pl .text .p2align 5 __KeccakF1600: .cfi_startproc .byte 0xf3,0x0f,0x1e,0xfa movq 60(%rdi),%rax movq 68(%rdi),%rbx movq 76(%rdi),%rcx movq 84(%rdi),%rdx movq 92(%rdi),%rbp jmp L$oop .p2align 5 L$oop: movq -100(%rdi),%r8 movq -52(%rdi),%r9 movq -4(%rdi),%r10 movq 44(%rdi),%r11 xorq -84(%rdi),%rcx xorq -76(%rdi),%rdx xorq %r8,%rax xorq -92(%rdi),%rbx xorq -44(%rdi),%rcx xorq -60(%rdi),%rax movq %rbp,%r12 xorq -68(%rdi),%rbp xorq %r10,%rcx xorq -20(%rdi),%rax xorq -36(%rdi),%rdx xorq %r9,%rbx xorq -28(%rdi),%rbp xorq 36(%rdi),%rcx xorq 20(%rdi),%rax xorq 4(%rdi),%rdx xorq -12(%rdi),%rbx xorq 12(%rdi),%rbp movq %rcx,%r13 rolq $1,%rcx xorq %rax,%rcx xorq %r11,%rdx rolq $1,%rax xorq %rdx,%rax xorq 28(%rdi),%rbx rolq $1,%rdx xorq %rbx,%rdx xorq 52(%rdi),%rbp rolq $1,%rbx xorq %rbp,%rbx rolq $1,%rbp xorq %r13,%rbp xorq %rcx,%r9 xorq %rdx,%r10 rolq $44,%r9 xorq %rbp,%r11 xorq %rax,%r12 rolq $43,%r10 xorq %rbx,%r8 movq %r9,%r13 rolq $21,%r11 orq %r10,%r9 xorq %r8,%r9 rolq $14,%r12 xorq (%r15),%r9 leaq 8(%r15),%r15 movq %r12,%r14 andq %r11,%r12 movq %r9,-100(%rsi) xorq %r10,%r12 notq %r10 movq %r12,-84(%rsi) orq %r11,%r10 movq 76(%rdi),%r12 xorq %r13,%r10 movq %r10,-92(%rsi) andq %r8,%r13 movq -28(%rdi),%r9 xorq %r14,%r13 movq -20(%rdi),%r10 movq %r13,-68(%rsi) orq %r8,%r14 movq -76(%rdi),%r8 xorq %r11,%r14 movq 28(%rdi),%r11 movq %r14,-76(%rsi) xorq %rbp,%r8 xorq %rdx,%r12 rolq $28,%r8 xorq %rcx,%r11 xorq %rax,%r9 rolq $61,%r12 rolq $45,%r11 xorq %rbx,%r10 rolq $20,%r9 movq %r8,%r13 orq %r12,%r8 rolq $3,%r10 xorq %r11,%r8 movq %r8,-36(%rsi) movq %r9,%r14 andq %r13,%r9 movq -92(%rdi),%r8 xorq %r12,%r9 notq %r12 movq %r9,-28(%rsi) orq %r11,%r12 movq -44(%rdi),%r9 xorq %r10,%r12 movq %r12,-44(%rsi) andq %r10,%r11 movq 60(%rdi),%r12 xorq %r14,%r11 movq %r11,-52(%rsi) orq %r10,%r14 movq 4(%rdi),%r10 xorq %r13,%r14 movq 52(%rdi),%r11 movq %r14,-60(%rsi) xorq %rbp,%r10 xorq %rax,%r11 rolq $25,%r10 xorq %rdx,%r9 rolq $8,%r11 xorq %rbx,%r12 rolq $6,%r9 xorq %rcx,%r8 rolq $18,%r12 movq %r10,%r13 andq %r11,%r10 rolq $1,%r8 notq %r11 xorq %r9,%r10 movq %r10,-12(%rsi) movq %r12,%r14 andq %r11,%r12 movq -12(%rdi),%r10 xorq %r13,%r12 movq %r12,-4(%rsi) orq %r9,%r13 movq 84(%rdi),%r12 xorq %r8,%r13 movq %r13,-20(%rsi) andq %r8,%r9 xorq %r14,%r9 movq %r9,12(%rsi) orq %r8,%r14 movq -60(%rdi),%r9 xorq %r11,%r14 movq 36(%rdi),%r11 movq %r14,4(%rsi) movq -68(%rdi),%r8 xorq %rcx,%r10 xorq %rdx,%r11 rolq $10,%r10 xorq %rbx,%r9 rolq $15,%r11 xorq %rbp,%r12 rolq $36,%r9 xorq %rax,%r8 rolq $56,%r12 movq %r10,%r13 orq %r11,%r10 rolq $27,%r8 notq %r11 xorq %r9,%r10 movq %r10,28(%rsi) movq %r12,%r14 orq %r11,%r12 xorq %r13,%r12 movq %r12,36(%rsi) andq %r9,%r13 xorq %r8,%r13 movq %r13,20(%rsi) orq %r8,%r9 xorq %r14,%r9 movq %r9,52(%rsi) andq %r14,%r8 xorq %r11,%r8 movq %r8,44(%rsi) xorq -84(%rdi),%rdx xorq -36(%rdi),%rbp rolq $62,%rdx xorq 68(%rdi),%rcx rolq $55,%rbp xorq 12(%rdi),%rax rolq $2,%rcx xorq 20(%rdi),%rbx xchgq %rsi,%rdi rolq $39,%rax rolq $41,%rbx movq %rdx,%r13 andq %rbp,%rdx notq %rbp xorq %rcx,%rdx movq %rdx,92(%rdi) movq %rax,%r14 andq %rbp,%rax xorq %r13,%rax movq %rax,60(%rdi) orq %rcx,%r13 xorq %rbx,%r13 movq %r13,84(%rdi) andq %rbx,%rcx xorq %r14,%rcx movq %rcx,76(%rdi) orq %r14,%rbx xorq %rbp,%rbx movq %rbx,68(%rdi) movq %rdx,%rbp movq %r13,%rdx testq $255,%r15 jnz L$oop leaq -192(%r15),%r15 .byte 0xf3,0xc3 .cfi_endproc .globl _KeccakF1600 .p2align 5 _KeccakF1600: .cfi_startproc .byte 0xf3,0x0f,0x1e,0xfa pushq %rbx .cfi_adjust_cfa_offset 8 .cfi_offset %rbx,-16 pushq %rbp .cfi_adjust_cfa_offset 8 .cfi_offset %rbp,-24 pushq %r12 .cfi_adjust_cfa_offset 8 .cfi_offset %r12,-32 pushq %r13 .cfi_adjust_cfa_offset 8 .cfi_offset %r13,-40 pushq %r14 .cfi_adjust_cfa_offset 8 .cfi_offset %r14,-48 pushq %r15 .cfi_adjust_cfa_offset 8 .cfi_offset %r15,-56 leaq 100(%rdi),%rdi subq $200,%rsp .cfi_adjust_cfa_offset 200 notq -92(%rdi) notq -84(%rdi) notq -36(%rdi) notq -4(%rdi) notq 36(%rdi) notq 60(%rdi) leaq iotas(%rip),%r15 leaq 100(%rsp),%rsi call __KeccakF1600 notq -92(%rdi) notq -84(%rdi) notq -36(%rdi) notq -4(%rdi) notq 36(%rdi) notq 60(%rdi) leaq -100(%rdi),%rdi addq $200,%rsp .cfi_adjust_cfa_offset -200 popq %r15 .cfi_adjust_cfa_offset -8 .cfi_restore %r15 popq %r14 .cfi_adjust_cfa_offset -8 .cfi_restore %r14 popq %r13 .cfi_adjust_cfa_offset -8 .cfi_restore %r13 popq %r12 .cfi_adjust_cfa_offset -8 .cfi_restore %r12 popq %rbp .cfi_adjust_cfa_offset -8 .cfi_restore %rbp popq %rbx .cfi_adjust_cfa_offset -8 .cfi_restore %rbx .byte 0xf3,0xc3 .cfi_endproc .p2align 8 .quad 0,0,0,0,0,0,0,0 iotas: .quad 0x0000000000000001 .quad 0x0000000000008082 .quad 0x800000000000808a .quad 0x8000000080008000 .quad 0x000000000000808b .quad 0x0000000080000001 .quad 0x8000000080008081 .quad 0x8000000000008009 .quad 0x000000000000008a .quad 0x0000000000000088 .quad 0x0000000080008009 .quad 0x000000008000000a .quad 0x000000008000808b .quad 0x800000000000008b .quad 0x8000000000008089 .quad 0x8000000000008003 .quad 0x8000000000008002 .quad 0x8000000000000080 .quad 0x000000000000800a .quad 0x800000008000000a .quad 0x8000000080008081 .quad 0x8000000000008080 .quad 0x0000000080000001 .quad 0x8000000080008008 .byte 75,101,99,99,97,107,45,49,54,48,48,32,97,98,115,111,114,98,32,97,110,100,32,115,113,117,101,101,122,101,32,102,111,114,32,120,56,54,95,54,52,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
hainakus/pico_kid
6,073
crypto/hashes/src/keccakf1600_x86-64.s
# Source: https://github.com/dot-asm/cryptogams/blob/master/x86_64/keccak1600-x86_64.pl .text .type __KeccakF1600,@function .align 32 __KeccakF1600: .cfi_startproc .byte 0xf3,0x0f,0x1e,0xfa movq 60(%rdi),%rax movq 68(%rdi),%rbx movq 76(%rdi),%rcx movq 84(%rdi),%rdx movq 92(%rdi),%rbp jmp .Loop .align 32 .Loop: movq -100(%rdi),%r8 movq -52(%rdi),%r9 movq -4(%rdi),%r10 movq 44(%rdi),%r11 xorq -84(%rdi),%rcx xorq -76(%rdi),%rdx xorq %r8,%rax xorq -92(%rdi),%rbx xorq -44(%rdi),%rcx xorq -60(%rdi),%rax movq %rbp,%r12 xorq -68(%rdi),%rbp xorq %r10,%rcx xorq -20(%rdi),%rax xorq -36(%rdi),%rdx xorq %r9,%rbx xorq -28(%rdi),%rbp xorq 36(%rdi),%rcx xorq 20(%rdi),%rax xorq 4(%rdi),%rdx xorq -12(%rdi),%rbx xorq 12(%rdi),%rbp movq %rcx,%r13 rolq $1,%rcx xorq %rax,%rcx xorq %r11,%rdx rolq $1,%rax xorq %rdx,%rax xorq 28(%rdi),%rbx rolq $1,%rdx xorq %rbx,%rdx xorq 52(%rdi),%rbp rolq $1,%rbx xorq %rbp,%rbx rolq $1,%rbp xorq %r13,%rbp xorq %rcx,%r9 xorq %rdx,%r10 rolq $44,%r9 xorq %rbp,%r11 xorq %rax,%r12 rolq $43,%r10 xorq %rbx,%r8 movq %r9,%r13 rolq $21,%r11 orq %r10,%r9 xorq %r8,%r9 rolq $14,%r12 xorq (%r15),%r9 leaq 8(%r15),%r15 movq %r12,%r14 andq %r11,%r12 movq %r9,-100(%rsi) xorq %r10,%r12 notq %r10 movq %r12,-84(%rsi) orq %r11,%r10 movq 76(%rdi),%r12 xorq %r13,%r10 movq %r10,-92(%rsi) andq %r8,%r13 movq -28(%rdi),%r9 xorq %r14,%r13 movq -20(%rdi),%r10 movq %r13,-68(%rsi) orq %r8,%r14 movq -76(%rdi),%r8 xorq %r11,%r14 movq 28(%rdi),%r11 movq %r14,-76(%rsi) xorq %rbp,%r8 xorq %rdx,%r12 rolq $28,%r8 xorq %rcx,%r11 xorq %rax,%r9 rolq $61,%r12 rolq $45,%r11 xorq %rbx,%r10 rolq $20,%r9 movq %r8,%r13 orq %r12,%r8 rolq $3,%r10 xorq %r11,%r8 movq %r8,-36(%rsi) movq %r9,%r14 andq %r13,%r9 movq -92(%rdi),%r8 xorq %r12,%r9 notq %r12 movq %r9,-28(%rsi) orq %r11,%r12 movq -44(%rdi),%r9 xorq %r10,%r12 movq %r12,-44(%rsi) andq %r10,%r11 movq 60(%rdi),%r12 xorq %r14,%r11 movq %r11,-52(%rsi) orq %r10,%r14 movq 4(%rdi),%r10 xorq %r13,%r14 movq 52(%rdi),%r11 movq %r14,-60(%rsi) xorq %rbp,%r10 xorq %rax,%r11 rolq $25,%r10 xorq %rdx,%r9 rolq $8,%r11 xorq %rbx,%r12 rolq $6,%r9 xorq %rcx,%r8 rolq $18,%r12 movq %r10,%r13 andq %r11,%r10 rolq $1,%r8 notq %r11 xorq %r9,%r10 movq %r10,-12(%rsi) movq %r12,%r14 andq %r11,%r12 movq -12(%rdi),%r10 xorq %r13,%r12 movq %r12,-4(%rsi) orq %r9,%r13 movq 84(%rdi),%r12 xorq %r8,%r13 movq %r13,-20(%rsi) andq %r8,%r9 xorq %r14,%r9 movq %r9,12(%rsi) orq %r8,%r14 movq -60(%rdi),%r9 xorq %r11,%r14 movq 36(%rdi),%r11 movq %r14,4(%rsi) movq -68(%rdi),%r8 xorq %rcx,%r10 xorq %rdx,%r11 rolq $10,%r10 xorq %rbx,%r9 rolq $15,%r11 xorq %rbp,%r12 rolq $36,%r9 xorq %rax,%r8 rolq $56,%r12 movq %r10,%r13 orq %r11,%r10 rolq $27,%r8 notq %r11 xorq %r9,%r10 movq %r10,28(%rsi) movq %r12,%r14 orq %r11,%r12 xorq %r13,%r12 movq %r12,36(%rsi) andq %r9,%r13 xorq %r8,%r13 movq %r13,20(%rsi) orq %r8,%r9 xorq %r14,%r9 movq %r9,52(%rsi) andq %r14,%r8 xorq %r11,%r8 movq %r8,44(%rsi) xorq -84(%rdi),%rdx xorq -36(%rdi),%rbp rolq $62,%rdx xorq 68(%rdi),%rcx rolq $55,%rbp xorq 12(%rdi),%rax rolq $2,%rcx xorq 20(%rdi),%rbx xchgq %rsi,%rdi rolq $39,%rax rolq $41,%rbx movq %rdx,%r13 andq %rbp,%rdx notq %rbp xorq %rcx,%rdx movq %rdx,92(%rdi) movq %rax,%r14 andq %rbp,%rax xorq %r13,%rax movq %rax,60(%rdi) orq %rcx,%r13 xorq %rbx,%r13 movq %r13,84(%rdi) andq %rbx,%rcx xorq %r14,%rcx movq %rcx,76(%rdi) orq %r14,%rbx xorq %rbp,%rbx movq %rbx,68(%rdi) movq %rdx,%rbp movq %r13,%rdx testq $255,%r15 jnz .Loop leaq -192(%r15),%r15 .byte 0xf3,0xc3 .cfi_endproc .size __KeccakF1600,.-__KeccakF1600 .globl KeccakF1600 .type KeccakF1600,@function .align 32 KeccakF1600: .cfi_startproc .byte 0xf3,0x0f,0x1e,0xfa pushq %rbx .cfi_adjust_cfa_offset 8 .cfi_offset %rbx,-16 pushq %rbp .cfi_adjust_cfa_offset 8 .cfi_offset %rbp,-24 pushq %r12 .cfi_adjust_cfa_offset 8 .cfi_offset %r12,-32 pushq %r13 .cfi_adjust_cfa_offset 8 .cfi_offset %r13,-40 pushq %r14 .cfi_adjust_cfa_offset 8 .cfi_offset %r14,-48 pushq %r15 .cfi_adjust_cfa_offset 8 .cfi_offset %r15,-56 leaq 100(%rdi),%rdi subq $200,%rsp .cfi_adjust_cfa_offset 200 notq -92(%rdi) notq -84(%rdi) notq -36(%rdi) notq -4(%rdi) notq 36(%rdi) notq 60(%rdi) leaq iotas(%rip),%r15 leaq 100(%rsp),%rsi call __KeccakF1600 notq -92(%rdi) notq -84(%rdi) notq -36(%rdi) notq -4(%rdi) notq 36(%rdi) notq 60(%rdi) leaq -100(%rdi),%rdi addq $200,%rsp .cfi_adjust_cfa_offset -200 popq %r15 .cfi_adjust_cfa_offset -8 .cfi_restore %r15 popq %r14 .cfi_adjust_cfa_offset -8 .cfi_restore %r14 popq %r13 .cfi_adjust_cfa_offset -8 .cfi_restore %r13 popq %r12 .cfi_adjust_cfa_offset -8 .cfi_restore %r12 popq %rbp .cfi_adjust_cfa_offset -8 .cfi_restore %rbp popq %rbx .cfi_adjust_cfa_offset -8 .cfi_restore %rbx .byte 0xf3,0xc3 .cfi_endproc .size KeccakF1600,.-KeccakF1600 .align 256 .quad 0,0,0,0,0,0,0,0 .type iotas,@object iotas: .quad 0x0000000000000001 .quad 0x0000000000008082 .quad 0x800000000000808a .quad 0x8000000080008000 .quad 0x000000000000808b .quad 0x0000000080000001 .quad 0x8000000080008081 .quad 0x8000000000008009 .quad 0x000000000000008a .quad 0x0000000000000088 .quad 0x0000000080008009 .quad 0x000000008000000a .quad 0x000000008000808b .quad 0x800000000000008b .quad 0x8000000000008089 .quad 0x8000000000008003 .quad 0x8000000000008002 .quad 0x8000000000000080 .quad 0x000000000000800a .quad 0x800000008000000a .quad 0x8000000080008081 .quad 0x8000000000008080 .quad 0x0000000080000001 .quad 0x8000000080008008 .size iotas,.-iotas .byte 75,101,99,99,97,107,45,49,54,48,48,32,97,98,115,111,114,98,32,97,110,100,32,115,113,117,101,101,122,101,32,102,111,114,32,120,56,54,95,54,52,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0 .section .note.gnu.property,"a",@note .long 4,2f-1f,5 .byte 0x47,0x4E,0x55,0 1: .long 0xc0000002,4,3 .align 8 2:
halseth/factors-rs
752
src/asm/init.s
.section .text._start; .globl _start; _start: .option push; .option norelax; la gp, __global_pointer$; .option pop; la sp, 0x00200400 jal ra, __start; j _sys_halt __start: addi sp,sp,-32 # allocate 32 bytes on the stack sw ra,28(sp) # store ra on the stack sw s0,24(sp) # store s0 on the stack addi s0,sp,32 # store old stack pointer into s0 call runcontract # call runcontract with x=a0 sw a0,-24(s0) # store a0=y (return value from runcontract) on the stack add a7,a0,zero // hack load return value into a7 lw ra,28(sp) # load original ra from stack lw s0,24(sp) # load original s0 from stack addi sp,sp,32 # deallocate 32 bytes from stack jr ra # return _sys_halt: add a1,sp,24 addi a0,zero,0 li t0,0 ecall
halseth/zkfibonacci-rs
752
src/asm/init.s
.section .text._start; .globl _start; _start: .option push; .option norelax; la gp, __global_pointer$; .option pop; la sp, 0x00200400 jal ra, __start; j _sys_halt __start: addi sp,sp,-32 # allocate 32 bytes on the stack sw ra,28(sp) # store ra on the stack sw s0,24(sp) # store s0 on the stack addi s0,sp,32 # store old stack pointer into s0 call runcontract # call runcontract with x=a0 sw a0,-24(s0) # store a0=y (return value from runcontract) on the stack add a7,a0,zero // hack load return value into a7 lw ra,28(sp) # load original ra from stack lw s0,24(sp) # load original s0 from stack addi sp,sp,32 # deallocate 32 bytes from stack jr ra # return _sys_halt: add a1,sp,24 addi a0,zero,0 li t0,0 ecall
hanifeee535/rust_scheduler
1,473
context_switch.s
.syntax unified .cpu cortex-m4 .thumb .global PendSV_Handler .type PendSV_Handler, %function PendSV_Handler: /* Save context of current task */ //1. get current running task's psp value mrs r0, psp //2. Using that psp value, store SF2 (R4 to R11) stmdb r0!, {r4-r11} push {lr} //3. Save the current value of PSP bl save_psp_value /* Retrieve the context of next task */ //1. Decide next task to run bl update_to_next_task //2. get its past psp value bl get_psp_value //3. Using that PSP value retrieve SF2 (R4 to R11) ldmia r0!, {r4-r11} //3. Update PSP and exit msr psp, r0 pop {lr} bx lr .global switch_sp_to_psp .type switch_sp_to_psp, %function switch_sp_to_psp: //initialize the psp with task1 stack start //because we are first going to lunch task 1 push {lr} // to get back to the rtos_init function, we need to preserve LR. because in the next line it will call another function named get_psp_value. After this, we will pop it back bl get_psp_value //get the value of psp of current task msr psp, r0 //initialize psp pop {lr} //pop back LR //Change sp to psp using control register mov r0, #0x02 msr control, r0 bx lr .global init_scheduler_stack .type init_scheduler_stack, %function init_scheduler_stack: // Argument in r0 = top_of_stack msr msp, r0 // Load R0 value (top_of_stack variable) into MSP bx lr // Return from function
hanifeee535/rust_os
1,968
kernel/src/os_assembly.s
.syntax unified .cpu cortex-m4 .thumb .fpu fpv4-sp-d16 .global PendSV_Handler .type PendSV_Handler, %function PendSV_Handler: // Save current task context //1. get current running task's psp value mrs r0, psp //2. Using that psp value, store SF2 (R4 to R11) stmdb r0!, {r4-r11} // Save R4–R11 to PSP push {lr} //3. Save the current value of PSP bl save_psp_value // Retrieve the context of next task //1. Decide next task to run bl update_to_next_task //2. get its past psp value bl get_psp_value //3. Using that PSP value retrieve SF2 (R4 to R11) ldmia r0!, {r4-r11} //3. Update PSP and exit msr psp, r0 // Update PSP pop {lr} bx lr // Exception return → restores R0–R3,R12,LR,PC,xPSR //------------------------------------------------------ .global switch_sp_to_psp .type switch_sp_to_psp, %function switch_sp_to_psp: //initialize the psp with task1 stack start //because we are first going to lunch task 1 push {lr} // to get back to the previous function from where it called, we need to preserve LR. because in the next line it will call another function named get_psp_value. After this, we will pop it back bl get_psp_value //get the value of psp of current task msr psp, r0 //initialize psp pop {lr} //pop back LR //Change stack pointer to psp using control register mov r0, #0x02 // Use PSP in Thread mode, privileged msr control, r0 bx lr //------------------------------------------------------ // Set MSP (Main Stack Pointer) for the scheduler .global init_scheduler_stack .type init_scheduler_stack, %function init_scheduler_stack: msr msp, r0 // Load R0 value (top_of_stack variable) into MSP bx lr // Return from function
Hansika-Prabodini/different-languages
4,407
msa.S
/* * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * MIPS SIMD Architecture (MSA) context handling code for KVM. * * Copyright (C) 2015 Imagination Technologies Ltd. */ #include <asm/asm.h> #include <asm/asm-offsets.h> #include <asm/asmmacro.h> #include <asm/regdef.h> .set noreorder .set noat LEAF(__kvm_save_msa) st_d 0, VCPU_FPR0, a0 st_d 1, VCPU_FPR1, a0 st_d 2, VCPU_FPR2, a0 st_d 3, VCPU_FPR3, a0 st_d 4, VCPU_FPR4, a0 st_d 5, VCPU_FPR5, a0 st_d 6, VCPU_FPR6, a0 st_d 7, VCPU_FPR7, a0 st_d 8, VCPU_FPR8, a0 st_d 9, VCPU_FPR9, a0 st_d 10, VCPU_FPR10, a0 st_d 11, VCPU_FPR11, a0 st_d 12, VCPU_FPR12, a0 st_d 13, VCPU_FPR13, a0 st_d 14, VCPU_FPR14, a0 st_d 15, VCPU_FPR15, a0 st_d 16, VCPU_FPR16, a0 st_d 17, VCPU_FPR17, a0 st_d 18, VCPU_FPR18, a0 st_d 19, VCPU_FPR19, a0 st_d 20, VCPU_FPR20, a0 st_d 21, VCPU_FPR21, a0 st_d 22, VCPU_FPR22, a0 st_d 23, VCPU_FPR23, a0 st_d 24, VCPU_FPR24, a0 st_d 25, VCPU_FPR25, a0 st_d 26, VCPU_FPR26, a0 st_d 27, VCPU_FPR27, a0 st_d 28, VCPU_FPR28, a0 st_d 29, VCPU_FPR29, a0 st_d 30, VCPU_FPR30, a0 st_d 31, VCPU_FPR31, a0 jr ra nop END(__kvm_save_msa) LEAF(__kvm_restore_msa) ld_d 0, VCPU_FPR0, a0 ld_d 1, VCPU_FPR1, a0 ld_d 2, VCPU_FPR2, a0 ld_d 3, VCPU_FPR3, a0 ld_d 4, VCPU_FPR4, a0 ld_d 5, VCPU_FPR5, a0 ld_d 6, VCPU_FPR6, a0 ld_d 7, VCPU_FPR7, a0 ld_d 8, VCPU_FPR8, a0 ld_d 9, VCPU_FPR9, a0 ld_d 10, VCPU_FPR10, a0 ld_d 11, VCPU_FPR11, a0 ld_d 12, VCPU_FPR12, a0 ld_d 13, VCPU_FPR13, a0 ld_d 14, VCPU_FPR14, a0 ld_d 15, VCPU_FPR15, a0 ld_d 16, VCPU_FPR16, a0 ld_d 17, VCPU_FPR17, a0 ld_d 18, VCPU_FPR18, a0 ld_d 19, VCPU_FPR19, a0 ld_d 20, VCPU_FPR20, a0 ld_d 21, VCPU_FPR21, a0 ld_d 22, VCPU_FPR22, a0 ld_d 23, VCPU_FPR23, a0 ld_d 24, VCPU_FPR24, a0 ld_d 25, VCPU_FPR25, a0 ld_d 26, VCPU_FPR26, a0 ld_d 27, VCPU_FPR27, a0 ld_d 28, VCPU_FPR28, a0 ld_d 29, VCPU_FPR29, a0 ld_d 30, VCPU_FPR30, a0 ld_d 31, VCPU_FPR31, a0 jr ra nop END(__kvm_restore_msa) .macro kvm_restore_msa_upper wr, off, base .set push .set noat #ifdef CONFIG_64BIT ld $1, \off(\base) insert_d \wr, 1 #elif defined(CONFIG_CPU_LITTLE_ENDIAN) lw $1, \off(\base) insert_w \wr, 2 lw $1, (\off+4)(\base) insert_w \wr, 3 #else /* CONFIG_CPU_BIG_ENDIAN */ lw $1, (\off+4)(\base) insert_w \wr, 2 lw $1, \off(\base) insert_w \wr, 3 #endif .set pop .endm LEAF(__kvm_restore_msa_upper) kvm_restore_msa_upper 0, VCPU_FPR0 +8, a0 kvm_restore_msa_upper 1, VCPU_FPR1 +8, a0 kvm_restore_msa_upper 2, VCPU_FPR2 +8, a0 kvm_restore_msa_upper 3, VCPU_FPR3 +8, a0 kvm_restore_msa_upper 4, VCPU_FPR4 +8, a0 kvm_restore_msa_upper 5, VCPU_FPR5 +8, a0 kvm_restore_msa_upper 6, VCPU_FPR6 +8, a0 kvm_restore_msa_upper 7, VCPU_FPR7 +8, a0 kvm_restore_msa_upper 8, VCPU_FPR8 +8, a0 kvm_restore_msa_upper 9, VCPU_FPR9 +8, a0 kvm_restore_msa_upper 10, VCPU_FPR10+8, a0 kvm_restore_msa_upper 11, VCPU_FPR11+8, a0 kvm_restore_msa_upper 12, VCPU_FPR12+8, a0 kvm_restore_msa_upper 13, VCPU_FPR13+8, a0 kvm_restore_msa_upper 14, VCPU_FPR14+8, a0 kvm_restore_msa_upper 15, VCPU_FPR15+8, a0 kvm_restore_msa_upper 16, VCPU_FPR16+8, a0 kvm_restore_msa_upper 17, VCPU_FPR17+8, a0 kvm_restore_msa_upper 18, VCPU_FPR18+8, a0 kvm_restore_msa_upper 19, VCPU_FPR19+8, a0 kvm_restore_msa_upper 20, VCPU_FPR20+8, a0 kvm_restore_msa_upper 21, VCPU_FPR21+8, a0 kvm_restore_msa_upper 22, VCPU_FPR22+8, a0 kvm_restore_msa_upper 23, VCPU_FPR23+8, a0 kvm_restore_msa_upper 24, VCPU_FPR24+8, a0 kvm_restore_msa_upper 25, VCPU_FPR25+8, a0 kvm_restore_msa_upper 26, VCPU_FPR26+8, a0 kvm_restore_msa_upper 27, VCPU_FPR27+8, a0 kvm_restore_msa_upper 28, VCPU_FPR28+8, a0 kvm_restore_msa_upper 29, VCPU_FPR29+8, a0 kvm_restore_msa_upper 30, VCPU_FPR30+8, a0 kvm_restore_msa_upper 31, VCPU_FPR31+8, a0 jr ra nop END(__kvm_restore_msa_upper) LEAF(__kvm_restore_msacsr) lw t0, VCPU_MSA_CSR(a0) /* * The ctcmsa must stay at this offset in __kvm_restore_msacsr. * See kvm_mips_csr_die_notify() which handles t0 containing a value * which triggers an MSA FP Exception, which must be stepped over and * ignored since the set cause bits must remain there for the guest. */ _ctcmsa MSA_CSR, t0 jr ra nop END(__kvm_restore_msacsr)
HarderHeng/Rust-Riscv
330
src/deprecated/_entry.S
# entry.s - RISC-V 64 裸机启动代码 .section .text.entry .globl _start # 假设你的 RAM 从 0x8000_0000 开始,栈从高地址向下增长 .equ STACK_START, 0x80000000 + 0x4000 # 16KB 栈空间 _start: # 1. 初始化栈指针 sp li sp, STACK_START # 2. 清除 s0(帧指针) mv s0, x0 # 3. 跳转到 Rust 入口(即你现有的 _start) j _start_rust # 无限循环,防止返回 hang: wfi j hang
HaZ-K/ArceOS
1,827
arceos/modules/axhal/linker.lds.S
OUTPUT_ARCH(%ARCH%) BASE_ADDRESS = %KERNEL_BASE%; ENTRY(_start) SECTIONS { . = BASE_ADDRESS; _skernel = .; .text : ALIGN(4K) { _stext = .; *(.text.boot) *(.text .text.*) . = ALIGN(4K); _etext = .; } .rodata : ALIGN(4K) { _srodata = .; *(.rodata .rodata.*) *(.srodata .srodata.*) *(.sdata2 .sdata2.*) . = ALIGN(4K); _erodata = .; } .data : ALIGN(4K) { _sdata = .; *(.data.boot_page_table) . = ALIGN(4K); *(.data .data.*) *(.sdata .sdata.*) *(.got .got.*) } .tdata : ALIGN(0x10) { _stdata = .; *(.tdata .tdata.*) _etdata = .; } .tbss : ALIGN(0x10) { _stbss = .; *(.tbss .tbss.*) *(.tcommon) _etbss = .; } . = ALIGN(4K); _percpu_start = .; _percpu_end = _percpu_start + SIZEOF(.percpu); .percpu 0x0 : AT(_percpu_start) { _percpu_load_start = .; *(.percpu .percpu.*) _percpu_load_end = .; . = _percpu_load_start + ALIGN(64) * %SMP%; } . = _percpu_end; . = ALIGN(4K); _edata = .; .bss : ALIGN(4K) { boot_stack = .; *(.bss.stack) . = ALIGN(4K); boot_stack_top = .; _sbss = .; *(.bss .bss.*) *(.sbss .sbss.*) *(COMMON) . = ALIGN(4K); _ebss = .; } _ekernel = .; /DISCARD/ : { *(.comment) *(.gnu*) *(.note*) *(.eh_frame*) } } SECTIONS { linkme_IRQ : { *(linkme_IRQ) } linkm2_IRQ : { *(linkm2_IRQ) } linkme_PAGE_FAULT : { *(linkme_PAGE_FAULT) } linkm2_PAGE_FAULT : { *(linkm2_PAGE_FAULT) } linkme_SYSCALL : { *(linkme_SYSCALL) } linkm2_SYSCALL : { *(linkm2_SYSCALL) } } INSERT AFTER .tbss;
HaZ-K/ArceOS
3,437
arceos/modules/riscv_vcpu/src/mem_extable.S
// Copyright (c) 2022 by Rivos Inc. // Licensed under the Apache License, Version 2.0, see LICENSE for details. // SPDX-License-Identifier: Apache-2.0 // Very unoptimized memcpy() to/from guest memory functions, using the HLV/HSV instructions. // Adds the instruction at 'lbl' to the exception table. .macro add_extable lbl .pushsection .extable, "a" .balign 8 .quad \lbl .popsection .endm .option push .option arch, +h .section .text // memcpy() to a guest physical address using HSV. .global _copy_to_guest _copy_to_guest: // handle_trap assumes t0 holds the address of where we want to jump to when we encounter // a fault and will stick SCAUSE in t1. la t0, _ret_from_copy // _ret_from_copy assumes the return value is in t2. mv t2, zero 1: beq t2, a2, _ret_from_copy lb t3, (a1) 2: hsv.b t3, (a0) add_extable 2b addi a0, a0, 1 addi a1, a1, 1 addi t2, t2, 1 j 1b // memcpy() from a guest physical address using HLV. .global _copy_from_guest _copy_from_guest: // handle_trap assumes t0 holds the address of where we want to jump to when we encounter // a fault and will stick SCAUSE in t1. la t0, _ret_from_copy // _ret_from_copy assumes the return value is in t2. mv t2, zero 1: beq t2, a2, _ret_from_copy 2: hlv.b t3, (a1) add_extable 2b sb t3, (a0) addi a0, a0, 1 addi a1, a1, 1 addi t2, t2, 1 j 1b // Fetch an instruction from guest memory using HLVX. Only supports 2 or 4 byte instructions. // // Arguments: // A0: Guest address of the instruction to fetch, using the translation modes/tables currently // programmed in HGATP and VSATP. // A1: Pointer to a u32 where the instruction will be written. // // Returns -1 on error. .global _fetch_guest_instruction _fetch_guest_instruction: // handle_trap assumes t0 holds the address of where we want to jump to when we encounter // a fault and will stick SCAUSE in t1. la t0, 4f 1: hlvx.hu t2, (a0) add_extable 1b sh t2, (a1) addi a0, a0, 2 addi a1, a1, 2 // If it's a compressed instrution (bits [1:0] != 'b11) then we're done. li t3, 3 and t2, t2, t3 bne t2, t3, 3f // Load the next half-word. 2: hlvx.hu t2, (a0) add_extable 2b sh t2, (a1) 3: mv a0, zero ret 4: // Took a fault, return -1. not a0, zero ret // memcpy() to a user address. .global _copy_to_user _copy_to_user: // handle_trap assumes t0 holds the address of where we want to jump to when we encounter // a fault and will stick SCAUSE in t1. la t0, _ret_from_copy // _ret_from_copy assumes the return value is in t2. mv t2, zero 1: beq t2, a2, _ret_from_copy lb t3, (a1) 2: sb t3, (a0) add_extable 2b addi a0, a0, 1 addi a1, a1, 1 addi t2, t2, 1 j 1b // memcpy() from a user address. .global _copy_from_user _copy_from_user: // handle_trap assumes t0 holds the address of where we want to jump to when we encounter // a fault and will stick SCAUSE in t1. la t0, _ret_from_copy // _ret_from_copy assumes the return value is in t2. mv t2, zero 1: beq t2, a2, _ret_from_copy 2: lb t3, (a1) add_extable 2b sb t3, (a0) addi a0, a0, 1 addi a1, a1, 1 addi t2, t2, 1 j 1b .align 2 _ret_from_copy: mv a0, t2 ret .option pop
HaZ-K/ArceOS
4,857
arceos/modules/riscv_vcpu/src/guest.S
/// Enter the guest given in `VmCpuRegisters` from `a0` .global _run_guest _run_guest: /* Save hypervisor state */ /* Save hypervisor GPRs (except T0-T6 and a0, which is GuestInfo and stashed in sscratch) */ sd ra, ({hyp_ra})(a0) sd gp, ({hyp_gp})(a0) sd tp, ({hyp_tp})(a0) sd s0, ({hyp_s0})(a0) sd s1, ({hyp_s1})(a0) sd a1, ({hyp_a1})(a0) sd a2, ({hyp_a2})(a0) sd a3, ({hyp_a3})(a0) sd a4, ({hyp_a4})(a0) sd a5, ({hyp_a5})(a0) sd a6, ({hyp_a6})(a0) sd a7, ({hyp_a7})(a0) sd s2, ({hyp_s2})(a0) sd s3, ({hyp_s3})(a0) sd s4, ({hyp_s4})(a0) sd s5, ({hyp_s5})(a0) sd s6, ({hyp_s6})(a0) sd s7, ({hyp_s7})(a0) sd s8, ({hyp_s8})(a0) sd s9, ({hyp_s9})(a0) sd s10, ({hyp_s10})(a0) sd s11, ({hyp_s11})(a0) sd sp, ({hyp_sp})(a0) /* Swap in guest CSRs. */ ld t1, ({guest_sstatus})(a0) csrrw t1, sstatus, t1 sd t1, ({hyp_sstatus})(a0) ld t1, ({guest_hstatus})(a0) csrrw t1, hstatus, t1 ld t1, ({guest_scounteren})(a0) csrrw t1, scounteren, t1 sd t1, ({hyp_scounteren})(a0) ld t1, ({guest_sepc})(a0) csrw sepc, t1 /* Set stvec so that hypervisor resumes after the sret when the guest exits. */ la t1, _guest_exit csrrw t1, stvec, t1 sd t1, ({hyp_stvec})(a0) /* Save sscratch and replace with pointer to GuestInfo. */ csrrw t1, sscratch, a0 sd t1, ({hyp_sscratch})(a0) /* Restore the gprs from this GuestInfo */ ld ra, ({guest_ra})(a0) ld gp, ({guest_gp})(a0) ld tp, ({guest_tp})(a0) ld s0, ({guest_s0})(a0) ld s1, ({guest_s1})(a0) ld a1, ({guest_a1})(a0) ld a2, ({guest_a2})(a0) ld a3, ({guest_a3})(a0) ld a4, ({guest_a4})(a0) ld a5, ({guest_a5})(a0) ld a6, ({guest_a6})(a0) ld a7, ({guest_a7})(a0) ld s2, ({guest_s2})(a0) ld s3, ({guest_s3})(a0) ld s4, ({guest_s4})(a0) ld s5, ({guest_s5})(a0) ld s6, ({guest_s6})(a0) ld s7, ({guest_s7})(a0) ld s8, ({guest_s8})(a0) ld s9, ({guest_s9})(a0) ld s10, ({guest_s10})(a0) ld s11, ({guest_s11})(a0) ld t0, ({guest_t0})(a0) ld t1, ({guest_t1})(a0) ld t2, ({guest_t2})(a0) ld t3, ({guest_t3})(a0) ld t4, ({guest_t4})(a0) ld t5, ({guest_t5})(a0) ld t6, ({guest_t6})(a0) ld sp, ({guest_sp})(a0) ld a0, ({guest_a0})(a0) sret .align 2 _guest_exit: /* Pull GuestInfo out of sscratch, swapping with guest's a0 */ csrrw a0, sscratch, a0 /* Save guest GPRs. */ sd ra, ({guest_ra})(a0) sd gp, ({guest_gp})(a0) sd tp, ({guest_tp})(a0) sd s0, ({guest_s0})(a0) sd s1, ({guest_s1})(a0) sd a1, ({guest_a1})(a0) sd a2, ({guest_a2})(a0) sd a3, ({guest_a3})(a0) sd a4, ({guest_a4})(a0) sd a5, ({guest_a5})(a0) sd a6, ({guest_a6})(a0) sd a7, ({guest_a7})(a0) sd s2, ({guest_s2})(a0) sd s3, ({guest_s3})(a0) sd s4, ({guest_s4})(a0) sd s5, ({guest_s5})(a0) sd s6, ({guest_s6})(a0) sd s7, ({guest_s7})(a0) sd s8, ({guest_s8})(a0) sd s9, ({guest_s9})(a0) sd s10, ({guest_s10})(a0) sd s11, ({guest_s11})(a0) sd t0, ({guest_t0})(a0) sd t1, ({guest_t1})(a0) sd t2, ({guest_t2})(a0) sd t3, ({guest_t3})(a0) sd t4, ({guest_t4})(a0) sd t5, ({guest_t5})(a0) sd t6, ({guest_t6})(a0) sd sp, ({guest_sp})(a0) /* Save Guest a0 after recovering from sscratch. */ csrr t0, sscratch sd t0, ({guest_a0})(a0) _restore_csrs: /* Swap in hypervisor CSRs. */ ld t1, ({hyp_sstatus})(a0) csrrw t1, sstatus, t1 sd t1, ({guest_sstatus})(a0) csrr t1, hstatus sd t1, ({guest_hstatus})(a0) ld t1, ({hyp_scounteren})(a0) csrrw t1, scounteren, t1 sd t1, ({guest_scounteren})(a0) ld t1, ({hyp_stvec})(a0) csrw stvec, t1 ld t1, ({hyp_sscratch})(a0) csrw sscratch, t1 /* Save guest EPC. */ csrr t1, sepc sd t1, ({guest_sepc})(a0) /* Restore hypervisor GPRs. */ ld ra, ({hyp_ra})(a0) ld gp, ({hyp_gp})(a0) ld tp, ({hyp_tp})(a0) ld s0, ({hyp_s0})(a0) ld s1, ({hyp_s1})(a0) ld a1, ({hyp_a1})(a0) ld a2, ({hyp_a2})(a0) ld a3, ({hyp_a3})(a0) ld a4, ({hyp_a4})(a0) ld a5, ({hyp_a5})(a0) ld a6, ({hyp_a6})(a0) ld a7, ({hyp_a7})(a0) ld s2, ({hyp_s2})(a0) ld s3, ({hyp_s3})(a0) ld s4, ({hyp_s4})(a0) ld s5, ({hyp_s5})(a0) ld s6, ({hyp_s6})(a0) ld s7, ({hyp_s7})(a0) ld s8, ({hyp_s8})(a0) ld s9, ({hyp_s9})(a0) ld s10, ({hyp_s10})(a0) ld s11, ({hyp_s11})(a0) ld sp, ({hyp_sp})(a0) ret
HaZ-K/ArceOS
1,839
arceos/modules/axhal/src/arch/riscv/trap.S
.macro SAVE_REGS, from_user addi sp, sp, -{trapframe_size} PUSH_GENERAL_REGS csrr t0, sepc csrr t1, sstatus csrrw t2, sscratch, zero // save sscratch (sp) and zero it STR t0, sp, 31 // tf.sepc STR t1, sp, 32 // tf.sstatus STR t2, sp, 1 // tf.regs.sp .if \from_user == 1 LDR t0, sp, 2 // load supervisor gp LDR t1, sp, 3 // load supervisor tp STR gp, sp, 2 // save user gp and tp STR tp, sp, 3 mv gp, t0 mv tp, t1 .endif .endm .macro RESTORE_REGS, from_user .if \from_user == 1 LDR t1, sp, 2 // load user gp and tp LDR t0, sp, 3 STR gp, sp, 2 // save supervisor gp STR tp, sp, 3 // save supervisor gp and tp mv gp, t1 mv tp, t0 addi t0, sp, {trapframe_size} // put supervisor sp to scratch csrw sscratch, t0 .endif LDR t0, sp, 31 LDR t1, sp, 32 csrw sepc, t0 csrw sstatus, t1 POP_GENERAL_REGS LDR sp, sp, 1 // load sp from tf.regs.sp .endm .section .text .balign 4 .global trap_vector_base trap_vector_base: // sscratch == 0: trap from S mode // sscratch != 0: trap from U mode csrrw sp, sscratch, sp // swap sscratch and sp bnez sp, .Ltrap_entry_u csrr sp, sscratch // put supervisor sp back j .Ltrap_entry_s .Ltrap_entry_s: SAVE_REGS 0 mv a0, sp li a1, 0 call riscv_trap_handler RESTORE_REGS 0 sret .Ltrap_entry_u: SAVE_REGS 1 mv a0, sp li a1, 1 call riscv_trap_handler RESTORE_REGS 1 sret
HaZ-K/ArceOS
2,415
arceos/modules/axhal/src/arch/aarch64/trap.S
.macro SAVE_REGS sub sp, sp, 34 * 8 stp x0, x1, [sp] stp x2, x3, [sp, 2 * 8] stp x4, x5, [sp, 4 * 8] stp x6, x7, [sp, 6 * 8] stp x8, x9, [sp, 8 * 8] stp x10, x11, [sp, 10 * 8] stp x12, x13, [sp, 12 * 8] stp x14, x15, [sp, 14 * 8] stp x16, x17, [sp, 16 * 8] stp x18, x19, [sp, 18 * 8] stp x20, x21, [sp, 20 * 8] stp x22, x23, [sp, 22 * 8] stp x24, x25, [sp, 24 * 8] stp x26, x27, [sp, 26 * 8] stp x28, x29, [sp, 28 * 8] mrs x9, sp_el0 mrs x10, elr_el1 mrs x11, spsr_el1 stp x30, x9, [sp, 30 * 8] stp x10, x11, [sp, 32 * 8] .endm .macro RESTORE_REGS ldp x10, x11, [sp, 32 * 8] ldp x30, x9, [sp, 30 * 8] msr sp_el0, x9 msr elr_el1, x10 msr spsr_el1, x11 ldp x28, x29, [sp, 28 * 8] ldp x26, x27, [sp, 26 * 8] ldp x24, x25, [sp, 24 * 8] ldp x22, x23, [sp, 22 * 8] ldp x20, x21, [sp, 20 * 8] ldp x18, x19, [sp, 18 * 8] ldp x16, x17, [sp, 16 * 8] ldp x14, x15, [sp, 14 * 8] ldp x12, x13, [sp, 12 * 8] ldp x10, x11, [sp, 10 * 8] ldp x8, x9, [sp, 8 * 8] ldp x6, x7, [sp, 6 * 8] ldp x4, x5, [sp, 4 * 8] ldp x2, x3, [sp, 2 * 8] ldp x0, x1, [sp] add sp, sp, 34 * 8 .endm .macro INVALID_EXCP, kind, source .p2align 7 SAVE_REGS mov x0, sp mov x1, \kind mov x2, \source bl invalid_exception b .Lexception_return .endm .macro HANDLE_SYNC .p2align 7 SAVE_REGS mov x0, sp bl handle_sync_exception b .Lexception_return .endm .macro HANDLE_IRQ .p2align 7 SAVE_REGS mov x0, sp bl handle_irq_exception b .Lexception_return .endm .section .text .p2align 11 .global exception_vector_base exception_vector_base: // current EL, with SP_EL0 INVALID_EXCP 0 0 INVALID_EXCP 1 0 INVALID_EXCP 2 0 INVALID_EXCP 3 0 // current EL, with SP_ELx HANDLE_SYNC HANDLE_IRQ INVALID_EXCP 2 1 INVALID_EXCP 3 1 // lower EL, aarch64 HANDLE_SYNC HANDLE_IRQ INVALID_EXCP 2 2 INVALID_EXCP 3 2 // lower EL, aarch32 INVALID_EXCP 0 3 INVALID_EXCP 1 3 INVALID_EXCP 2 3 INVALID_EXCP 3 3 .Lexception_return: RESTORE_REGS eret
HaZ-K/ArceOS
1,505
arceos/modules/axhal/src/arch/x86_64/trap.S
.equ NUM_INT, 256 .altmacro .macro DEF_HANDLER, i .Ltrap_handler_\i: .if \i == 8 || (\i >= 10 && \i <= 14) || \i == 17 # error code pushed by CPU push \i # interrupt vector jmp .Ltrap_common .else push 0 # fill in error code in TrapFrame push \i # interrupt vector jmp .Ltrap_common .endif .endm .macro DEF_TABLE_ENTRY, i .quad .Ltrap_handler_\i .endm .section .text .code64 _trap_handlers: .set i, 0 .rept NUM_INT DEF_HANDLER %i .set i, i + 1 .endr .Ltrap_common: test byte ptr [rsp + 3 * 8], 3 # swap GS if it comes from user space jz 1f swapgs 1: push r15 push r14 push r13 push r12 push r11 push r10 push r9 push r8 push rdi push rsi push rbp push rbx push rdx push rcx push rax mov rdi, rsp call x86_trap_handler pop rax pop rcx pop rdx pop rbx pop rbp pop rsi pop rdi pop r8 pop r9 pop r10 pop r11 pop r12 pop r13 pop r14 pop r15 test byte ptr [rsp + 3 * 8], 3 # swap GS back if return to user space jz 2f swapgs 2: add rsp, 16 # pop vector, error_code iretq .section .rodata .global trap_handler_table trap_handler_table: .set i, 0 .rept NUM_INT DEF_TABLE_ENTRY %i .set i, i + 1 .endr
HaZ-K/ArceOS
1,965
arceos/modules/axhal/src/platform/x86_pc/ap_start.S
# Boot application processors into the protected mode. # Each non-boot CPU ("AP") is started up in response to a STARTUP # IPI from the boot CPU. Section B.4.2 of the Multi-Processor # Specification says that the AP will start in real mode with CS:IP # set to XY00:0000, where XY is an 8-bit value sent with the # STARTUP. Thus this code must start at a 4096-byte boundary. # # Because this code sets DS to zero, it must sit # at an address in the low 2^16 bytes. .equ pa_ap_start32, ap_start32 - ap_start + {start_page_paddr} .equ pa_ap_gdt, .Lap_tmp_gdt - ap_start + {start_page_paddr} .equ pa_ap_gdt_desc, .Lap_tmp_gdt_desc - ap_start + {start_page_paddr} .equ stack_ptr, {start_page_paddr} + 0xff0 .equ entry_ptr, {start_page_paddr} + 0xff8 # 0x6000 .section .text .code16 .p2align 12 .global ap_start ap_start: cli wbinvd xor ax, ax mov ds, ax mov es, ax mov ss, ax mov fs, ax mov gs, ax # load the 64-bit GDT lgdt [pa_ap_gdt_desc] # switch to protected-mode mov eax, cr0 or eax, (1 << 0) mov cr0, eax # far jump to 32-bit code. 0x8 is code32 segment selector ljmp 0x8, offset pa_ap_start32 .code32 ap_start32: mov esp, [stack_ptr] mov eax, [entry_ptr] jmp eax .balign 8 # .type multiboot_header, STT_OBJECT .Lap_tmp_gdt_desc: .short .Lap_tmp_gdt_end - .Lap_tmp_gdt - 1 # limit .long pa_ap_gdt # base .balign 16 .Lap_tmp_gdt: .quad 0x0000000000000000 # 0x00: null .quad 0x00cf9b000000ffff # 0x08: code segment (base=0, limit=0xfffff, type=32bit code exec/read, DPL=0, 4k) .quad 0x00af9b000000ffff # 0x10: code segment (base=0, limit=0xfffff, type=64bit code exec/read, DPL=0, 4k) .quad 0x00cf93000000ffff # 0x18: data segment (base=0, limit=0xfffff, type=32bit data read/write, DPL=0, 4k) .Lap_tmp_gdt_end: # 0x7000 .p2align 12 .global ap_end ap_end:
HaZ-K/ArceOS
4,307
arceos/modules/axhal/src/platform/x86_pc/multiboot.S
# Bootstrapping from 32-bit with the Multiboot specification. # See https://www.gnu.org/software/grub/manual/multiboot/multiboot.html .section .text.boot .code32 .global _start _start: mov edi, eax # arg1: magic: 0x2BADB002 mov esi, ebx # arg2: multiboot info jmp bsp_entry32 .balign 4 .type multiboot_header, STT_OBJECT multiboot_header: .int {mb_hdr_magic} # magic: 0x1BADB002 .int {mb_hdr_flags} # flags .int -({mb_hdr_magic} + {mb_hdr_flags}) # checksum .int multiboot_header - {offset} # header_addr .int _skernel - {offset} # load_addr .int _edata - {offset} # load_end .int _ebss - {offset} # bss_end_addr .int _start - {offset} # entry_addr # Common code in 32-bit, prepare states to enter 64-bit. .macro ENTRY32_COMMON # set data segment selectors mov ax, 0x18 mov ss, ax mov ds, ax mov es, ax mov fs, ax mov gs, ax # set PAE, PGE bit in CR4 mov eax, {cr4} mov cr4, eax # load the temporary page table lea eax, [.Ltmp_pml4 - {offset}] mov cr3, eax # set LME, NXE bit in IA32_EFER mov ecx, {efer_msr} mov edx, 0 mov eax, {efer} wrmsr # set protected mode, write protect, paging bit in CR0 mov eax, {cr0} mov cr0, eax .endm # Common code in 64-bit .macro ENTRY64_COMMON # clear segment selectors xor ax, ax mov ss, ax mov ds, ax mov es, ax mov fs, ax mov gs, ax .endm .code32 bsp_entry32: lgdt [.Ltmp_gdt_desc - {offset}] # load the temporary GDT ENTRY32_COMMON ljmp 0x10, offset bsp_entry64 - {offset} # 0x10 is code64 segment .code32 .global ap_entry32 ap_entry32: ENTRY32_COMMON ljmp 0x10, offset ap_entry64 - {offset} # 0x10 is code64 segment .code64 bsp_entry64: ENTRY64_COMMON # set RSP to boot stack movabs rsp, offset {boot_stack} add rsp, {boot_stack_size} # call rust_entry(magic, mbi) movabs rax, offset {entry} call rax jmp .Lhlt .code64 ap_entry64: ENTRY64_COMMON # set RSP to high address (already set in ap_start.S) mov rax, {offset} add rsp, rax # call rust_entry_secondary(magic) mov rdi, {mb_magic} movabs rax, offset {entry_secondary} call rax jmp .Lhlt .Lhlt: hlt jmp .Lhlt .section .rodata .balign 8 .Ltmp_gdt_desc: .short .Ltmp_gdt_end - .Ltmp_gdt - 1 # limit .long .Ltmp_gdt - {offset} # base .section .data .balign 16 .Ltmp_gdt: .quad 0x0000000000000000 # 0x00: null .quad 0x00cf9b000000ffff # 0x08: code segment (base=0, limit=0xfffff, type=32bit code exec/read, DPL=0, 4k) .quad 0x00af9b000000ffff # 0x10: code segment (base=0, limit=0xfffff, type=64bit code exec/read, DPL=0, 4k) .quad 0x00cf93000000ffff # 0x18: data segment (base=0, limit=0xfffff, type=32bit data read/write, DPL=0, 4k) .Ltmp_gdt_end: .balign 4096 .Ltmp_pml4: # 0x0000_0000 ~ 0xffff_ffff .quad .Ltmp_pdpt_low - {offset} + 0x3 # PRESENT | WRITABLE | paddr(tmp_pdpt) .zero 8 * 510 # 0xffff_ff80_0000_0000 ~ 0xffff_ff80_ffff_ffff .quad .Ltmp_pdpt_high - {offset} + 0x3 # PRESENT | WRITABLE | paddr(tmp_pdpt) # FIXME: may not work on macOS using hvf as the CPU does not support 1GB page (pdpe1gb) .Ltmp_pdpt_low: .quad 0x0000 | 0x83 # PRESENT | WRITABLE | HUGE_PAGE | paddr(0x0) .quad 0x40000000 | 0x83 # PRESENT | WRITABLE | HUGE_PAGE | paddr(0x4000_0000) .quad 0x80000000 | 0x83 # PRESENT | WRITABLE | HUGE_PAGE | paddr(0x8000_0000) .quad 0xc0000000 | 0x83 # PRESENT | WRITABLE | HUGE_PAGE | paddr(0xc000_0000) .zero 8 * 508 .Ltmp_pdpt_high: .quad 0x0000 | 0x83 # PRESENT | WRITABLE | HUGE_PAGE | paddr(0x0) .quad 0x40000000 | 0x83 # PRESENT | WRITABLE | HUGE_PAGE | paddr(0x4000_0000) .quad 0x80000000 | 0x83 # PRESENT | WRITABLE | HUGE_PAGE | paddr(0x8000_0000) .quad 0xc0000000 | 0x83 # PRESENT | WRITABLE | HUGE_PAGE | paddr(0xc000_0000) .zero 8 * 508
HaZ-K/ArceOS
4,857
arceos/tour/h_1_0/src/guest.S
/// Enter the guest given in `VmCpuRegisters` from `a0` .global _run_guest _run_guest: /* Save hypervisor state */ /* Save hypervisor GPRs (except T0-T6 and a0, which is GuestInfo and stashed in sscratch) */ sd ra, ({hyp_ra})(a0) sd gp, ({hyp_gp})(a0) sd tp, ({hyp_tp})(a0) sd s0, ({hyp_s0})(a0) sd s1, ({hyp_s1})(a0) sd a1, ({hyp_a1})(a0) sd a2, ({hyp_a2})(a0) sd a3, ({hyp_a3})(a0) sd a4, ({hyp_a4})(a0) sd a5, ({hyp_a5})(a0) sd a6, ({hyp_a6})(a0) sd a7, ({hyp_a7})(a0) sd s2, ({hyp_s2})(a0) sd s3, ({hyp_s3})(a0) sd s4, ({hyp_s4})(a0) sd s5, ({hyp_s5})(a0) sd s6, ({hyp_s6})(a0) sd s7, ({hyp_s7})(a0) sd s8, ({hyp_s8})(a0) sd s9, ({hyp_s9})(a0) sd s10, ({hyp_s10})(a0) sd s11, ({hyp_s11})(a0) sd sp, ({hyp_sp})(a0) /* Swap in guest CSRs. */ ld t1, ({guest_sstatus})(a0) csrrw t1, sstatus, t1 sd t1, ({hyp_sstatus})(a0) ld t1, ({guest_hstatus})(a0) csrrw t1, hstatus, t1 ld t1, ({guest_scounteren})(a0) csrrw t1, scounteren, t1 sd t1, ({hyp_scounteren})(a0) ld t1, ({guest_sepc})(a0) csrw sepc, t1 /* Set stvec so that hypervisor resumes after the sret when the guest exits. */ la t1, _guest_exit csrrw t1, stvec, t1 sd t1, ({hyp_stvec})(a0) /* Save sscratch and replace with pointer to GuestInfo. */ csrrw t1, sscratch, a0 sd t1, ({hyp_sscratch})(a0) /* Restore the gprs from this GuestInfo */ ld ra, ({guest_ra})(a0) ld gp, ({guest_gp})(a0) ld tp, ({guest_tp})(a0) ld s0, ({guest_s0})(a0) ld s1, ({guest_s1})(a0) ld a1, ({guest_a1})(a0) ld a2, ({guest_a2})(a0) ld a3, ({guest_a3})(a0) ld a4, ({guest_a4})(a0) ld a5, ({guest_a5})(a0) ld a6, ({guest_a6})(a0) ld a7, ({guest_a7})(a0) ld s2, ({guest_s2})(a0) ld s3, ({guest_s3})(a0) ld s4, ({guest_s4})(a0) ld s5, ({guest_s5})(a0) ld s6, ({guest_s6})(a0) ld s7, ({guest_s7})(a0) ld s8, ({guest_s8})(a0) ld s9, ({guest_s9})(a0) ld s10, ({guest_s10})(a0) ld s11, ({guest_s11})(a0) ld t0, ({guest_t0})(a0) ld t1, ({guest_t1})(a0) ld t2, ({guest_t2})(a0) ld t3, ({guest_t3})(a0) ld t4, ({guest_t4})(a0) ld t5, ({guest_t5})(a0) ld t6, ({guest_t6})(a0) ld sp, ({guest_sp})(a0) ld a0, ({guest_a0})(a0) sret .align 2 _guest_exit: /* Pull GuestInfo out of sscratch, swapping with guest's a0 */ csrrw a0, sscratch, a0 /* Save guest GPRs. */ sd ra, ({guest_ra})(a0) sd gp, ({guest_gp})(a0) sd tp, ({guest_tp})(a0) sd s0, ({guest_s0})(a0) sd s1, ({guest_s1})(a0) sd a1, ({guest_a1})(a0) sd a2, ({guest_a2})(a0) sd a3, ({guest_a3})(a0) sd a4, ({guest_a4})(a0) sd a5, ({guest_a5})(a0) sd a6, ({guest_a6})(a0) sd a7, ({guest_a7})(a0) sd s2, ({guest_s2})(a0) sd s3, ({guest_s3})(a0) sd s4, ({guest_s4})(a0) sd s5, ({guest_s5})(a0) sd s6, ({guest_s6})(a0) sd s7, ({guest_s7})(a0) sd s8, ({guest_s8})(a0) sd s9, ({guest_s9})(a0) sd s10, ({guest_s10})(a0) sd s11, ({guest_s11})(a0) sd t0, ({guest_t0})(a0) sd t1, ({guest_t1})(a0) sd t2, ({guest_t2})(a0) sd t3, ({guest_t3})(a0) sd t4, ({guest_t4})(a0) sd t5, ({guest_t5})(a0) sd t6, ({guest_t6})(a0) sd sp, ({guest_sp})(a0) /* Save Guest a0 after recovering from sscratch. */ csrr t0, sscratch sd t0, ({guest_a0})(a0) _restore_csrs: /* Swap in hypervisor CSRs. */ ld t1, ({hyp_sstatus})(a0) csrrw t1, sstatus, t1 sd t1, ({guest_sstatus})(a0) csrr t1, hstatus sd t1, ({guest_hstatus})(a0) ld t1, ({hyp_scounteren})(a0) csrrw t1, scounteren, t1 sd t1, ({guest_scounteren})(a0) ld t1, ({hyp_stvec})(a0) csrw stvec, t1 ld t1, ({hyp_sscratch})(a0) csrw sscratch, t1 /* Save guest EPC. */ csrr t1, sepc sd t1, ({guest_sepc})(a0) /* Restore hypervisor GPRs. */ ld ra, ({hyp_ra})(a0) ld gp, ({hyp_gp})(a0) ld tp, ({hyp_tp})(a0) ld s0, ({hyp_s0})(a0) ld s1, ({hyp_s1})(a0) ld a1, ({hyp_a1})(a0) ld a2, ({hyp_a2})(a0) ld a3, ({hyp_a3})(a0) ld a4, ({hyp_a4})(a0) ld a5, ({hyp_a5})(a0) ld a6, ({hyp_a6})(a0) ld a7, ({hyp_a7})(a0) ld s2, ({hyp_s2})(a0) ld s3, ({hyp_s3})(a0) ld s4, ({hyp_s4})(a0) ld s5, ({hyp_s5})(a0) ld s6, ({hyp_s6})(a0) ld s7, ({hyp_s7})(a0) ld s8, ({hyp_s8})(a0) ld s9, ({hyp_s9})(a0) ld s10, ({hyp_s10})(a0) ld s11, ({hyp_s11})(a0) ld sp, ({hyp_sp})(a0) ret
HaZ-K/ArceOS
2,544
arceos/tools/raspi4/chainloader/src/_arch/aarch64/cpu/boot.s
// SPDX-License-Identifier: MIT OR Apache-2.0 // // Copyright (c) 2021-2022 Andre Richter <andre.o.richter@gmail.com> //-------------------------------------------------------------------------------------------------- // Definitions //-------------------------------------------------------------------------------------------------- // Load the address of a symbol into a register, PC-relative. // // The symbol must lie within +/- 4 GiB of the Program Counter. // // # Resources // // - https://sourceware.org/binutils/docs-2.36/as/AArch64_002dRelocations.html .macro ADR_REL register, symbol adrp \register, \symbol add \register, \register, #:lo12:\symbol .endm // Load the address of a symbol into a register, absolute. // // # Resources // // - https://sourceware.org/binutils/docs-2.36/as/AArch64_002dRelocations.html .macro ADR_ABS register, symbol movz \register, #:abs_g2:\symbol movk \register, #:abs_g1_nc:\symbol movk \register, #:abs_g0_nc:\symbol .endm //-------------------------------------------------------------------------------------------------- // Public Code //-------------------------------------------------------------------------------------------------- .section .text._start //------------------------------------------------------------------------------ // fn _start() //------------------------------------------------------------------------------ _start: // Only proceed on the boot core. Park it otherwise. mrs x0, MPIDR_EL1 and x0, x0, {CONST_CORE_ID_MASK} ldr x1, BOOT_CORE_ID // provided by bsp/__board_name__/cpu.rs cmp x0, x1 b.ne .L_parking_loop // If execution reaches here, it is the boot core. // Initialize DRAM. ADR_ABS x0, __bss_start ADR_ABS x1, __bss_end_exclusive .L_bss_init_loop: cmp x0, x1 b.eq .L_relocate_binary stp xzr, xzr, [x0], #16 b .L_bss_init_loop // Next, relocate the binary. .L_relocate_binary: ADR_REL x0, __binary_nonzero_start // The address the binary got loaded to. ADR_ABS x1, __binary_nonzero_start // The address the binary was linked to. ADR_ABS x2, __binary_nonzero_end_exclusive .L_copy_loop: ldr x3, [x0], #8 str x3, [x1], #8 cmp x1, x2 b.lo .L_copy_loop // Prepare the jump to Rust code. // Set the stack pointer. ADR_ABS x0, __boot_core_stack_end_exclusive mov sp, x0 // Jump to the relocated Rust code. ADR_ABS x1, _start_rust br x1 // Infinitely wait for events (aka "park the core"). .L_parking_loop: wfe b .L_parking_loop .size _start, . - _start .type _start, function .global _start
HaZ-K/ArceOS
4,857
arceos/exercises/simple_hv/src/guest.S
/// Enter the guest given in `VmCpuRegisters` from `a0` .global _run_guest _run_guest: /* Save hypervisor state */ /* Save hypervisor GPRs (except T0-T6 and a0, which is GuestInfo and stashed in sscratch) */ sd ra, ({hyp_ra})(a0) sd gp, ({hyp_gp})(a0) sd tp, ({hyp_tp})(a0) sd s0, ({hyp_s0})(a0) sd s1, ({hyp_s1})(a0) sd a1, ({hyp_a1})(a0) sd a2, ({hyp_a2})(a0) sd a3, ({hyp_a3})(a0) sd a4, ({hyp_a4})(a0) sd a5, ({hyp_a5})(a0) sd a6, ({hyp_a6})(a0) sd a7, ({hyp_a7})(a0) sd s2, ({hyp_s2})(a0) sd s3, ({hyp_s3})(a0) sd s4, ({hyp_s4})(a0) sd s5, ({hyp_s5})(a0) sd s6, ({hyp_s6})(a0) sd s7, ({hyp_s7})(a0) sd s8, ({hyp_s8})(a0) sd s9, ({hyp_s9})(a0) sd s10, ({hyp_s10})(a0) sd s11, ({hyp_s11})(a0) sd sp, ({hyp_sp})(a0) /* Swap in guest CSRs. */ ld t1, ({guest_sstatus})(a0) csrrw t1, sstatus, t1 sd t1, ({hyp_sstatus})(a0) ld t1, ({guest_hstatus})(a0) csrrw t1, hstatus, t1 ld t1, ({guest_scounteren})(a0) csrrw t1, scounteren, t1 sd t1, ({hyp_scounteren})(a0) ld t1, ({guest_sepc})(a0) csrw sepc, t1 /* Set stvec so that hypervisor resumes after the sret when the guest exits. */ la t1, _guest_exit csrrw t1, stvec, t1 sd t1, ({hyp_stvec})(a0) /* Save sscratch and replace with pointer to GuestInfo. */ csrrw t1, sscratch, a0 sd t1, ({hyp_sscratch})(a0) /* Restore the gprs from this GuestInfo */ ld ra, ({guest_ra})(a0) ld gp, ({guest_gp})(a0) ld tp, ({guest_tp})(a0) ld s0, ({guest_s0})(a0) ld s1, ({guest_s1})(a0) ld a1, ({guest_a1})(a0) ld a2, ({guest_a2})(a0) ld a3, ({guest_a3})(a0) ld a4, ({guest_a4})(a0) ld a5, ({guest_a5})(a0) ld a6, ({guest_a6})(a0) ld a7, ({guest_a7})(a0) ld s2, ({guest_s2})(a0) ld s3, ({guest_s3})(a0) ld s4, ({guest_s4})(a0) ld s5, ({guest_s5})(a0) ld s6, ({guest_s6})(a0) ld s7, ({guest_s7})(a0) ld s8, ({guest_s8})(a0) ld s9, ({guest_s9})(a0) ld s10, ({guest_s10})(a0) ld s11, ({guest_s11})(a0) ld t0, ({guest_t0})(a0) ld t1, ({guest_t1})(a0) ld t2, ({guest_t2})(a0) ld t3, ({guest_t3})(a0) ld t4, ({guest_t4})(a0) ld t5, ({guest_t5})(a0) ld t6, ({guest_t6})(a0) ld sp, ({guest_sp})(a0) ld a0, ({guest_a0})(a0) sret .align 2 _guest_exit: /* Pull GuestInfo out of sscratch, swapping with guest's a0 */ csrrw a0, sscratch, a0 /* Save guest GPRs. */ sd ra, ({guest_ra})(a0) sd gp, ({guest_gp})(a0) sd tp, ({guest_tp})(a0) sd s0, ({guest_s0})(a0) sd s1, ({guest_s1})(a0) sd a1, ({guest_a1})(a0) sd a2, ({guest_a2})(a0) sd a3, ({guest_a3})(a0) sd a4, ({guest_a4})(a0) sd a5, ({guest_a5})(a0) sd a6, ({guest_a6})(a0) sd a7, ({guest_a7})(a0) sd s2, ({guest_s2})(a0) sd s3, ({guest_s3})(a0) sd s4, ({guest_s4})(a0) sd s5, ({guest_s5})(a0) sd s6, ({guest_s6})(a0) sd s7, ({guest_s7})(a0) sd s8, ({guest_s8})(a0) sd s9, ({guest_s9})(a0) sd s10, ({guest_s10})(a0) sd s11, ({guest_s11})(a0) sd t0, ({guest_t0})(a0) sd t1, ({guest_t1})(a0) sd t2, ({guest_t2})(a0) sd t3, ({guest_t3})(a0) sd t4, ({guest_t4})(a0) sd t5, ({guest_t5})(a0) sd t6, ({guest_t6})(a0) sd sp, ({guest_sp})(a0) /* Save Guest a0 after recovering from sscratch. */ csrr t0, sscratch sd t0, ({guest_a0})(a0) _restore_csrs: /* Swap in hypervisor CSRs. */ ld t1, ({hyp_sstatus})(a0) csrrw t1, sstatus, t1 sd t1, ({guest_sstatus})(a0) csrr t1, hstatus sd t1, ({guest_hstatus})(a0) ld t1, ({hyp_scounteren})(a0) csrrw t1, scounteren, t1 sd t1, ({guest_scounteren})(a0) ld t1, ({hyp_stvec})(a0) csrw stvec, t1 ld t1, ({hyp_sscratch})(a0) csrw sscratch, t1 /* Save guest EPC. */ csrr t1, sepc sd t1, ({guest_sepc})(a0) /* Restore hypervisor GPRs. */ ld ra, ({hyp_ra})(a0) ld gp, ({hyp_gp})(a0) ld tp, ({hyp_tp})(a0) ld s0, ({hyp_s0})(a0) ld s1, ({hyp_s1})(a0) ld a1, ({hyp_a1})(a0) ld a2, ({hyp_a2})(a0) ld a3, ({hyp_a3})(a0) ld a4, ({hyp_a4})(a0) ld a5, ({hyp_a5})(a0) ld a6, ({hyp_a6})(a0) ld a7, ({hyp_a7})(a0) ld s2, ({hyp_s2})(a0) ld s3, ({hyp_s3})(a0) ld s4, ({hyp_s4})(a0) ld s5, ({hyp_s5})(a0) ld s6, ({hyp_s6})(a0) ld s7, ({hyp_s7})(a0) ld s8, ({hyp_s8})(a0) ld s9, ({hyp_s9})(a0) ld s10, ({hyp_s10})(a0) ld s11, ({hyp_s11})(a0) ld sp, ({hyp_sp})(a0) ret
hboissel/kfs1
453
arch/x86/start.s
.set ALIGN, 1<<0 .set MEMINFO, 1<<1 .set FLAGS, ALIGN | MEMINFO .set MAGIC, 0x1BADB002 .set CHECKSUM, -(MAGIC + FLAGS) .section .multiboot .align 4 .long MAGIC .long FLAGS .long CHECKSUM .section .bss .align 16 stack_bottom: .skip 16384 # 16 KiB stack_top: .section .text .global _start .type _start, @function _start: mov $stack_top, %esp call kmain cli 1: hlt jmp 1b .size _start, . - _start .section .note.GNU-stack,"",@progbits
hbuxiaofei/Starry-old
1,771
modules/axhal/linker.lds.S
OUTPUT_ARCH(%ARCH%) BASE_ADDRESS = %KERNEL_BASE%; ENTRY(_start) SECTIONS { . = BASE_ADDRESS; _skernel = .; .text : ALIGN(4K) { _stext = .; *(.text.boot) . = ALIGN(4K); *(.text.signal_trampoline) . = ALIGN(4K); *(.text .text.*) . = ALIGN(4K); _etext = .; } .rodata : ALIGN(4K) { _srodata = .; *(.rodata .rodata.*) *(.srodata .srodata.*) *(.sdata2 .sdata2.*) . = ALIGN(4K); _erodata = .; } .data : ALIGN(4K) { _sdata = .; *(.data.boot_page_table) . = ALIGN(4K); _img_start = .; . = ALIGN(4K); _img_end = .; . = ALIGN(4K); *(.data .data.*) *(.sdata .sdata.*) *(.got .got.*) } .tdata : ALIGN(0x10) { _stdata = .; *(.tdata .tdata.*) _etdata = .; } .tbss : ALIGN(0x10) { _stbss = .; *(.tbss .tbss.*) *(.tcommon) _etbss = .; } . = ALIGN(4K); _percpu_start = .; .percpu 0x0 : AT(_percpu_start) { _percpu_load_start = .; *(.percpu .percpu.*) _percpu_load_end = .; . = ALIGN(64); _percpu_size_aligned = .; . = _percpu_load_start + _percpu_size_aligned * %SMP%; } . = _percpu_start + SIZEOF(.percpu); _percpu_end = .; . = ALIGN(4K); _edata = .; .bss : ALIGN(4K) { boot_stack = .; *(.bss.stack) . = ALIGN(4K); boot_stack_top = .; _sbss = .; *(.bss .bss.*) *(.sbss .sbss.*) *(COMMON) . = ALIGN(4K); _ebss = .; } _ekernel = .; /DISCARD/ : { *(.comment) *(.gnu*) *(.note*) *(.eh_frame*) } }
hbuxiaofei/Starry-old
121
modules/axdriver/image.S
.section .data .global img_start .global img_end .align 16 img_start: .incbin "./disk.img" img_end:
hbuxiaofei/Starry-old
210
modules/axhal/src/arch/riscv/signal.S
# To create the sigreturn trampoline .equ __NR_sigreturn, 139 .section .text.signal_trampoline .balign 4 .global start_signal_trampoline start_signal_trampoline: li a7, __NR_sigreturn li a0, 0 ecall
hbuxiaofei/Starry-old
2,325
modules/axhal/src/arch/riscv/trap.S
.macro SAVE_REGS, from_user addi sp, sp, -{trapframe_size} PUSH_GENERAL_REGS csrr t0, sepc csrr t1, sstatus csrrw t2, sscratch, zero // save sscratch (sp) and zero it STR t0, sp, 31 // tf.sepc STR t1, sp, 32 // tf.sstatus STR t2, sp, 1 // tf.regs.sp .short 0xa622 // fsd fs0,264(sp) .short 0xaa26 // fsd fs1,272(sp) .if \from_user == 1 LDR t1, sp, 2 // load user gp with CPU ID LDR t0, sp, 3 // load supervisor tp STR gp, sp, 2 // save user gp and tp STR tp, sp, 3 mv gp, t1 mv tp, t0 .endif .endm .macro RESTORE_REGS, from_user .if \from_user == 1 LDR t1, sp, 2 LDR t0, sp, 3 STR gp, sp, 2 // load user gp and tp STR tp, sp, 3 // save supervisor tp mv gp, t1 mv tp, t0 addi t0, sp, {trapframe_size} // put supervisor sp to scratch csrw sscratch, t0 .endif LDR t0, sp, 31 LDR t1, sp, 32 csrw sepc, t0 csrw sstatus, t1 .short 0x2432 // fld fs0,264(sp) .short 0x24d2 // fld fs1,272(sp) POP_GENERAL_REGS LDR sp, sp, 1 // load sp from tf.regs.sp .endm .section .text .balign 4 .global trap_vector_base trap_vector_base: // sscratch == 0: trap from S mode // sscratch != 0: trap from U mode csrrw sp, sscratch, sp // switch sscratch and sp bnez sp, .Ltrap_entry_u csrr sp, sscratch // put supervisor sp back j .Ltrap_entry_s .Ltrap_entry_s: SAVE_REGS 0 mv a0, sp li a1, 0 call riscv_trap_handler RESTORE_REGS 0 sret .Ltrap_entry_u: SAVE_REGS 1 mv a0, sp li a1, 1 call riscv_trap_handler RESTORE_REGS 1 sret .altmacro .macro COPY n ld t2, (\n)*8(a0) sd t2, (\n)*8(a1) .endm .section .text .globl __copy __copy: # __copy( # frame_address: *const TrapFrame, # kernel_base: *mut T # ) .set n, 0 .rept 33 COPY %n .set n, n + 1 .endr ret
hbuxiaofei/Starry-old
223
modules/axhal/src/arch/aarch64/signal.S
# To create the sigreturn trampoline .equ __NR_sigreturn, 139 .section .text.signal_trampoline .balign 4 .global start_signal_trampoline start_signal_trampoline: mov x8, #139 // 设置系统调用号为 139 svc #0 // 触发系统调用
hbuxiaofei/Starry-old
4,138
modules/axhal/src/arch/aarch64/trap.S
.macro clear_gp_regs .irp n,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29 mov x\n, xzr .endr .endm .macro SAVE_REGS, el stp x0, x1, [sp] stp x2, x3, [sp, 2 * 8] stp x4, x5, [sp, 4 * 8] stp x6, x7, [sp, 6 * 8] stp x8, x9, [sp, 8 * 8] stp x10, x11, [sp, 10 * 8] stp x12, x13, [sp, 12 * 8] stp x14, x15, [sp, 14 * 8] stp x16, x17, [sp, 16 * 8] stp x18, x19, [sp, 18 * 8] stp x20, x21, [sp, 20 * 8] stp x22, x23, [sp, 22 * 8] stp x24, x25, [sp, 24 * 8] stp x26, x27, [sp, 26 * 8] stp x28, x29, [sp, 28 * 8] str x30, [sp, 30 * 8] mrs x10, elr_el1 mrs x11, spsr_el1 stp x10, x11, [sp, 32 * 8] .if \el == 0 clear_gp_regs mrs x12, tpidr_el0 // save user tls pointer ldr x13, [sp, 31 * 8] // restore current ktask ptr mrs x9, sp_el0 // save user stack pointer */ msr sp_el0, x13 // restore kernel task ptr .else mov x9, sp mov x12, xzr .endif str x12, [sp, 34 * 8] // save tpidr_el0 str x9, [sp, 31 * 8] // save user sp .endm .macro RESTORE_REGS, el ldp x30, x9, [sp, 30 * 8] // load user sp_el0 ldp x10, x11, [sp, 32 * 8] // load ELR, SPSR msr elr_el1, x10 msr spsr_el1, x11 ldr x12, [sp, 34 * 8] .if \el == 0 msr tpidr_el0, x12 // restore user tls pointer mrs x13, sp_el0 // save current ktask ptr str x13, [sp, 31 * 8] msr sp_el0, x9 // restore user sp .endif ldp x28, x29, [sp, 28 * 8] ldp x26, x27, [sp, 26 * 8] ldp x24, x25, [sp, 24 * 8] ldp x22, x23, [sp, 22 * 8] ldp x20, x21, [sp, 20 * 8] ldp x18, x19, [sp, 18 * 8] ldp x16, x17, [sp, 16 * 8] ldp x14, x15, [sp, 14 * 8] ldp x12, x13, [sp, 12 * 8] ldp x10, x11, [sp, 10 * 8] ldp x8, x9, [sp, 8 * 8] ldp x6, x7, [sp, 6 * 8] ldp x4, x5, [sp, 4 * 8] ldp x2, x3, [sp, 2 * 8] ldp x0, x1, [sp] add sp, sp, 35 * 8 .endm .macro HANDLE_TRAP, el, ht, regsize, label .p2align 7 b handle_el\el\ht\()_\regsize\()_\label .endm .macro HANDLE, el, ht, regsize, label .section .text handle_el\el\ht\()_\regsize\()_\label: sub sp, sp, 35 * 8 SAVE_REGS \el mov x0, sp bl handle_el\el\ht\()_\regsize\()_\label\()_exception .if \el == 1 b ret_to_kernel .else b ret_to_user .endif .endm .section .text .p2align 11 .global exception_vector_base exception_vector_base: // current EL, with SP_EL0 HANDLE_TRAP 1, t, 64, sync HANDLE_TRAP 1, t, 64, irq HANDLE_TRAP 1, t, 64, fiq HANDLE_TRAP 1, t, 64, error // current EL, with SP_ELx HANDLE_TRAP 1, h, 64, sync HANDLE_TRAP 1, h, 64, irq HANDLE_TRAP 1, h, 64, fiq HANDLE_TRAP 1, h, 64, error // lower EL, aarch64 with SP_EL0 HANDLE_TRAP 0, t, 64, sync HANDLE_TRAP 0, t, 64, irq HANDLE_TRAP 0, t, 64, fiq HANDLE_TRAP 0, t, 64, error // lower EL, aarch32 HANDLE_TRAP 0, t, 32, sync HANDLE_TRAP 0, t, 32, irq HANDLE_TRAP 0, t, 32, fiq HANDLE_TRAP 0, t, 32, error /* * used to create handle_el_label_trap */ // current EL, with SP_EL0 HANDLE 1, t, 64, sync HANDLE 1, t, 64, irq HANDLE 1, t, 64, fiq HANDLE 1, t, 64, error // current EL, with SP_ELx HANDLE 1, h, 64, sync HANDLE 1, h, 64, irq HANDLE 1, h, 64, fiq HANDLE 1, h, 64, error // lower EL, aarch64 with SP_EL0 HANDLE 0, t, 64, sync HANDLE 0, t, 64, irq HANDLE 0, t, 64, fiq HANDLE 0, t, 64, error // lower EL, aarch32 HANDLE 0, t, 32, sync HANDLE 0, t, 32, irq HANDLE 0, t, 32, fiq HANDLE 0, t, 32, error .section .text .global ret_to_kernel ret_to_kernel: RESTORE_REGS 1 eret .section .text .global ret_to_user ret_to_user: RESTORE_REGS 0 eret .section .text .global ret_to_first_user ret_to_first_user: mov sp, x0 b ret_to_user
hbuxiaofei/Starry-old
190
modules/axhal/src/arch/x86_64/signal.S
# To create the sigreturn trampoline .section .text.signal_trampoline .code64 .global start_signal_trampoline start_signal_trampoline: # syscall id rdi = 15 mov rax, 0xf syscall
hbuxiaofei/Starry-old
1,143
modules/axhal/src/arch/x86_64/syscall.S
.section .text syscall_entry: swapgs mov gs:[offset __PERCPU_USER_RSP_OFFSET], rsp mov rsp, gs:[offset __PERCPU_KERNEL_RSP_OFFSET] sub rsp, 8 // skip user_ss push gs:[offset __PERCPU_USER_RSP_OFFSET] // user_rsp push r11 // rflags mov [rsp - 2 * 8], rcx // rip sub rsp, 4 * 8 // skip until general registers push r15 push r14 push r13 push r12 push r11 push r10 push r9 push r8 push rdi push rsi push rbp push rbx push rdx push rcx push rax mov rdi, rsp call x86_syscall_handler pop rax pop rcx pop rdx pop rbx pop rbp pop rsi pop rdi pop r8 pop r9 pop r10 pop r11 pop r12 pop r13 pop r14 pop r15 add rsp, 7 * 8 mov rcx, [rsp - 5 * 8] // rip mov r11, [rsp - 3 * 8] // rflags mov rsp, [rsp - 2 * 8] // user_rsp swapgs sysretq
hbuxiaofei/Starry-old
1,505
modules/axhal/src/arch/x86_64/trap.S
.equ NUM_INT, 256 .altmacro .macro DEF_HANDLER, i .Ltrap_handler_\i: .if \i == 8 || (\i >= 10 && \i <= 14) || \i == 17 # error code pushed by CPU push \i # interrupt vector jmp .Ltrap_common .else push 0 # fill in error code in TrapFrame push \i # interrupt vector jmp .Ltrap_common .endif .endm .macro DEF_TABLE_ENTRY, i .quad .Ltrap_handler_\i .endm .section .text .code64 _trap_handlers: .set i, 0 .rept NUM_INT DEF_HANDLER %i .set i, i + 1 .endr .Ltrap_common: test byte ptr [rsp + 3 * 8], 3 # swap GS if it comes from user space jz 1f swapgs 1: push r15 push r14 push r13 push r12 push r11 push r10 push r9 push r8 push rdi push rsi push rbp push rbx push rdx push rcx push rax mov rdi, rsp call x86_trap_handler pop rax pop rcx pop rdx pop rbx pop rbp pop rsi pop rdi pop r8 pop r9 pop r10 pop r11 pop r12 pop r13 pop r14 pop r15 test byte ptr [rsp + 3 * 8], 3 # swap GS back if return to user space jz 2f swapgs 2: add rsp, 16 # pop vector, error_code iretq .section .rodata .global trap_handler_table trap_handler_table: .set i, 0 .rept NUM_INT DEF_TABLE_ENTRY %i .set i, i + 1 .endr
hbuxiaofei/Starry-old
1,965
modules/axhal/src/platform/x86_pc/ap_start.S
# Boot application processors into the protected mode. # Each non-boot CPU ("AP") is started up in response to a STARTUP # IPI from the boot CPU. Section B.4.2 of the Multi-Processor # Specification says that the AP will start in real mode with CS:IP # set to XY00:0000, where XY is an 8-bit value sent with the # STARTUP. Thus this code must start at a 4096-byte boundary. # # Because this code sets DS to zero, it must sit # at an address in the low 2^16 bytes. .equ pa_ap_start32, ap_start32 - ap_start + {start_page_paddr} .equ pa_ap_gdt, .Lap_tmp_gdt - ap_start + {start_page_paddr} .equ pa_ap_gdt_desc, .Lap_tmp_gdt_desc - ap_start + {start_page_paddr} .equ stack_ptr, {start_page_paddr} + 0xff0 .equ entry_ptr, {start_page_paddr} + 0xff8 # 0x6000 .section .text .code16 .p2align 12 .global ap_start ap_start: cli wbinvd xor ax, ax mov ds, ax mov es, ax mov ss, ax mov fs, ax mov gs, ax # load the 64-bit GDT lgdt [pa_ap_gdt_desc] # switch to protected-mode mov eax, cr0 or eax, (1 << 0) mov cr0, eax # far jump to 32-bit code. 0x8 is code32 segment selector ljmp 0x8, offset pa_ap_start32 .code32 ap_start32: mov esp, [stack_ptr] mov eax, [entry_ptr] jmp eax .balign 8 # .type multiboot_header, STT_OBJECT .Lap_tmp_gdt_desc: .short .Lap_tmp_gdt_end - .Lap_tmp_gdt - 1 # limit .long pa_ap_gdt # base .balign 16 .Lap_tmp_gdt: .quad 0x0000000000000000 # 0x00: null .quad 0x00cf9b000000ffff # 0x08: code segment (base=0, limit=0xfffff, type=32bit code exec/read, DPL=0, 4k) .quad 0x00af9b000000ffff # 0x10: code segment (base=0, limit=0xfffff, type=64bit code exec/read, DPL=0, 4k) .quad 0x00cf93000000ffff # 0x18: data segment (base=0, limit=0xfffff, type=32bit data read/write, DPL=0, 4k) .Lap_tmp_gdt_end: # 0x7000 .p2align 12 .global ap_end ap_end:
hbuxiaofei/Starry-old
4,307
modules/axhal/src/platform/x86_pc/multiboot.S
# Bootstrapping from 32-bit with the Multiboot specification. # See https://www.gnu.org/software/grub/manual/multiboot/multiboot.html .section .text.boot .code32 .global _start _start: mov edi, eax # arg1: magic: 0x2BADB002 mov esi, ebx # arg2: multiboot info jmp bsp_entry32 .balign 4 .type multiboot_header, STT_OBJECT multiboot_header: .int {mb_hdr_magic} # magic: 0x1BADB002 .int {mb_hdr_flags} # flags .int -({mb_hdr_magic} + {mb_hdr_flags}) # checksum .int multiboot_header - {offset} # header_addr .int _skernel - {offset} # load_addr .int _edata - {offset} # load_end .int _ebss - {offset} # bss_end_addr .int _start - {offset} # entry_addr # Common code in 32-bit, prepare states to enter 64-bit. .macro ENTRY32_COMMON # set data segment selectors mov ax, 0x18 mov ss, ax mov ds, ax mov es, ax mov fs, ax mov gs, ax # set PAE, PGE bit in CR4 mov eax, {cr4} mov cr4, eax # load the temporary page table lea eax, [.Ltmp_pml4 - {offset}] mov cr3, eax # set LME, NXE bit in IA32_EFER mov ecx, {efer_msr} mov edx, 0 mov eax, {efer} wrmsr # set protected mode, write protect, paging bit in CR0 mov eax, {cr0} mov cr0, eax .endm # Common code in 64-bit .macro ENTRY64_COMMON # clear segment selectors xor ax, ax mov ss, ax mov ds, ax mov es, ax mov fs, ax mov gs, ax .endm .code32 bsp_entry32: lgdt [.Ltmp_gdt_desc - {offset}] # load the temporary GDT ENTRY32_COMMON ljmp 0x10, offset bsp_entry64 - {offset} # 0x10 is code64 segment .code32 .global ap_entry32 ap_entry32: ENTRY32_COMMON ljmp 0x10, offset ap_entry64 - {offset} # 0x10 is code64 segment .code64 bsp_entry64: ENTRY64_COMMON # set RSP to boot stack movabs rsp, offset {boot_stack} add rsp, {boot_stack_size} # call rust_entry(magic, mbi) movabs rax, offset {entry} call rax jmp .Lhlt .code64 ap_entry64: ENTRY64_COMMON # set RSP to high address (already set in ap_start.S) mov rax, {offset} add rsp, rax # call rust_entry_secondary(magic) mov rdi, {mb_magic} movabs rax, offset {entry_secondary} call rax jmp .Lhlt .Lhlt: hlt jmp .Lhlt .section .rodata .balign 8 .Ltmp_gdt_desc: .short .Ltmp_gdt_end - .Ltmp_gdt - 1 # limit .long .Ltmp_gdt - {offset} # base .section .data .balign 16 .Ltmp_gdt: .quad 0x0000000000000000 # 0x00: null .quad 0x00cf9b000000ffff # 0x08: code segment (base=0, limit=0xfffff, type=32bit code exec/read, DPL=0, 4k) .quad 0x00af9b000000ffff # 0x10: code segment (base=0, limit=0xfffff, type=64bit code exec/read, DPL=0, 4k) .quad 0x00cf93000000ffff # 0x18: data segment (base=0, limit=0xfffff, type=32bit data read/write, DPL=0, 4k) .Ltmp_gdt_end: .balign 4096 .Ltmp_pml4: # 0x0000_0000 ~ 0xffff_ffff .quad .Ltmp_pdpt_low - {offset} + 0x3 # PRESENT | WRITABLE | paddr(tmp_pdpt) .zero 8 * 510 # 0xffff_ff80_0000_0000 ~ 0xffff_ff80_ffff_ffff .quad .Ltmp_pdpt_high - {offset} + 0x3 # PRESENT | WRITABLE | paddr(tmp_pdpt) # FIXME: may not work on macOS using hvf as the CPU does not support 1GB page (pdpe1gb) .Ltmp_pdpt_low: .quad 0x0000 | 0x83 # PRESENT | WRITABLE | HUGE_PAGE | paddr(0x0) .quad 0x40000000 | 0x83 # PRESENT | WRITABLE | HUGE_PAGE | paddr(0x4000_0000) .quad 0x80000000 | 0x83 # PRESENT | WRITABLE | HUGE_PAGE | paddr(0x8000_0000) .quad 0xc0000000 | 0x83 # PRESENT | WRITABLE | HUGE_PAGE | paddr(0xc000_0000) .zero 8 * 508 .Ltmp_pdpt_high: .quad 0x0000 | 0x83 # PRESENT | WRITABLE | HUGE_PAGE | paddr(0x0) .quad 0x40000000 | 0x83 # PRESENT | WRITABLE | HUGE_PAGE | paddr(0x4000_0000) .quad 0x80000000 | 0x83 # PRESENT | WRITABLE | HUGE_PAGE | paddr(0x8000_0000) .quad 0xc0000000 | 0x83 # PRESENT | WRITABLE | HUGE_PAGE | paddr(0xc000_0000) .zero 8 * 508
HectorGetFree/OSTEP
510
homework/threads-locks/yield.s
.var mutex .var count .main .top .acquire mov $1, %ax xchg %ax, mutex # atomic swap of 1 and mutex test $0, %ax # if we get 0 back: lock is free! je .acquire_done yield # if not, yield and try again j .acquire .acquire_done # critical section mov count, %ax # get the value at the address add $1, %ax # increment it mov %ax, count # store it back # release lock mov $0, mutex # see if we're still looping sub $1, %bx test $0, %bx jgt .top halt
HectorGetFree/OSTEP
461
homework/threads-locks/ticket.s
.var ticket .var turn .var count .main .top .acquire mov $1, %ax fetchadd %ax, ticket # grab a ticket .tryagain mov turn, %cx # check if it's your turn test %cx, %ax jne .tryagain # critical section mov count, %ax # get the value at the address add $1, %ax # increment it mov %ax, count # store it back # release lock mov $1, %ax fetchadd %ax, turn # see if we're still looping sub $1, %bx test $0, %bx jgt .top halt
HectorGetFree/OSTEP
121
homework/threads-locks/simple-race.s
.main mov 2000, %ax # get the value at the address add $1, %ax # increment it mov %ax, 2000 # store it back halt
HectorGetFree/OSTEP
1,210
homework/threads-locks/peterson.s
# array of 2 integers (each size 4 bytes) # load address of flag into fx register # access flag[] with 0(%fx,%index,4) # where %index is a register holding 0 or 1 # index reg contains 0 -> flag[0], if 1->flag[1] .var flag 2 # global turn variable .var turn # global count .var count .main # put address of flag into fx lea flag, %fx # assume thread ID is in bx (0 or 1, scale by 4 to get proper flag address) mov %bx, %cx # bx: self, now copies to cx neg %cx # cx: - self add $1, %cx # cx: 1 - self .acquire mov $1, 0(%fx,%bx,4) # flag[self] = 1 mov %cx, turn # turn = 1 - self .spin1 mov 0(%fx,%cx,4), %ax # flag[1-self] test $1, %ax jne .fini # if flag[1-self] != 1, skip past loop to .fini .spin2 # just labeled for fun, not needed mov turn, %ax test %cx, %ax # compare 'turn' and '1 - self' je .spin1 # if turn==1-self, go back and start spin again # fall out of spin .fini # do critical section now mov count, %ax add $1, %ax mov %ax, count .release mov $0, 0(%fx,%bx,4) # flag[self] = 0 # end case: make sure it's other's turn mov %cx, turn # turn = 1 - self halt
HectorGetFree/OSTEP
454
homework/threads-locks/test-and-set.s
.var mutex .var count .main .top .acquire mov $1, %ax xchg %ax, mutex # atomic swap of 1 and mutex test $0, %ax # if we get 0 back: lock is free! jne .acquire # if not, try again # critical section mov count, %ax # get the value at the address add $1, %ax # increment it mov %ax, count # store it back # release lock mov $0, mutex # see if we're still looping sub $1, %bx test $0, %bx jgt .top halt
HectorGetFree/OSTEP
496
homework/threads-locks/test-and-test-and-set.s
.var mutex .var count .main .top .acquire mov mutex, %ax test $0, %ax jne .acquire mov $1, %ax xchg %ax, mutex # atomic swap of 1 and mutex test $0, %ax # if we get 0 back: lock is free! jne .acquire # if not, try again # critical section mov count, %ax # get the value at the address add $1, %ax # increment it mov %ax, count # store it back # release lock mov $0, mutex # see if we're still looping sub $1, %bx test $0, %bx jgt .top halt
HectorGetFree/OSTEP
480
homework/threads-locks/flag.s
.var flag .var count .main .top .acquire mov flag, %ax # get flag test $0, %ax # if we get 0 back: lock is free! jne .acquire # if not, try again mov $1, flag # store 1 into flag # critical section mov count, %ax # get the value at the address add $1, %ax # increment it mov %ax, count # store it back # release lock mov $0, flag # clear the flag now # see if we're still looping sub $1, %bx test $0, %bx jgt .top halt
HectorGetFree/OSTEP
727
homework/threads-locks/flag-withcallret.s
.var mutex .var count .main .top mov %sp, %bp lea mutex, %ax push %ax call .lock pop # critical section mov count, %ax # get the value at the address add $1, %ax # increment it mov %ax, count # store it back # release lock lea mutex, %ax push %ax call .unlock pop # see if we're still looping sub $1, %bx test $0, %bx jgt .top halt .lock .acquire push %bp mov %sp, %bp mov 8(%bp), %ax # get addr of flag mov (%ax), %cx # get value of flag test $0, %cx # if we get 0 back: lock is free! jne .acquire # if not, try again mov $1, (%cx) # store 1 into flag pop %bp ret .unlock mov 8(%bp), %ax # all done: release lock by clearing it mov $0, (%ax) # clear ret
HectorGetFree/OSTEP
65
homework/threads-locks/loop.s
.main .top sub $1,%dx test $0,%dx jgt .top halt
HectorGetFree/OSTEP
641
homework/threads-locks/looping-race-withlock-withcallret.s
.var mutex .var count .main .top push mutex call .lock pop # critical section mov count, %ax # get the value at the address add $1, %ax # increment it mov %ax, count # store it back # release lock push mutex call .unlock pop # see if we're still looping sub $1, %bx test $0, %bx jgt .top halt .lock .acquire mov -4(%sp), %ax # get addr of flag mov $1, %cx # xchg %cx, (%ax) # atomic swap of 1 and flag test $0, %cx # if we get 0 back: lock is free! jne .acquire # if not, try again ret .unlock mov -4(%sp), %ax # all done: release lock by clearing it mov $0, (%ax) # ret
HectorGetFree/OSTEP
654
homework/threads-locks/test-mov.s
.var flag 2 .var turn .var count .main # put address of flag into %cx lea flag, %cx # assume thread ID is in %cx (0 or 1, scale by 4 to get proper flag address) mov %ax, %bx # ax: self sub $1, %bx # bx: 1 - self .acquire mov 16(%dx,%cx),%bx mov 16(%dx,%cx,4),%bx mov 16 ( %dx , %cx,3) , %bx mov 16(%dx,%cx),%bx mov %bx, (%dx,%cx) mov %bx, (%dx,%cx,3) mov (%dx,%cx),%bx mov 16(,%cx,2),%bx mov 16(,,2),%bx mov 16( %ax,,2),%bx mov (%dx),%bx mov 16,%bx mov - 16 (%dx,%cx,4),%bx mov -16 (%dx,%cx,4),%bx mov $-100,%cx mov -16 (%dx,%cx, -4), %bx mov -16 (%dx,%cx, - 4 ), %bx .spin1 .release # mov $0, 0(%dx,%cx,4) halt
HectorGetFree/OSTEP
245
homework/threads-intro/looping-race-nolock.s
# assumes %bx has loop count in it .main .top # critical section mov 2000, %ax # get 'value' at address 2000 add $1, %ax # increment it mov %ax, 2000 # store it back # see if we're still looping sub $1, %bx test $0, %bx jgt .top halt
HectorGetFree/OSTEP
165
homework/threads-intro/simple-race.s
.main # this is a critical section mov 2000(%bx), %ax # get the value at the address add $1, %ax # increment it mov %ax, 2000(%bx) # store it back halt
HectorGetFree/OSTEP
166
homework/threads-intro/wait-for-me.s
.main test $1, %ax # ax should be 1 (signaller) or 0 (waiter) je .signaller .waiter mov 2000, %cx test $1, %cx jne .waiter halt .signaller mov $1, 2000 halt
HectorGetFree/OSTEP
64
homework/threads-intro/loop.s
.main .top sub $1,%dx test $0,%dx jgte .top halt
Heliosly/LingOS
17,376
os/riscv/asm.S
#include "asm.h" .section .text.__ebreak .global __ebreak __ebreak: ebreak ret .section .text.__wfi .global __wfi __wfi: wfi ret .section .text.__sfence_vma_all .global __sfence_vma_all __sfence_vma_all: sfence.vma ret .section .text.__sfence_vma .global __sfence_vma __sfence_vma: sfence.vma a0, a1 ret // RISC-V hypervisor instructions. // The switch for enabling LLVM support for asm generation. // #define LLVM_RISCV_HYPERVISOR_EXTENSION_SUPPORT .section .text.__hfence_gvma .global __hfence_gvma __hfence_gvma: #ifdef LLVM_RISCV_HYPERVISOR_EXTENSION_SUPPORT hfence.gvma a0, a1 #else .word 1656029299 #endif ret .section .text.__hfence_vvma .global __hfence_vvma __hfence_vvma: #ifdef LLVM_RISCV_HYPERVISOR_EXTENSION_SUPPORT hfence.vvma a0, a1 #else .word 582287475 #endif ret .section .text.__hlv_b .global __hlv_b __hlv_b: #ifdef LLVM_RISCV_HYPERVISOR_EXTENSION_SUPPORT hlv.b a0, a0 #else .word 1610958195 #endif ret .section .text.__hlv_bu .global __hlv_bu __hlv_bu: #ifdef LLVM_RISCV_HYPERVISOR_EXTENSION_SUPPORT hlv.bu a0, a0 #else .word 1612006771 #endif ret .section .text.__hlv_h .global __hlv_h __hlv_h: #ifdef LLVM_RISCV_HYPERVISOR_EXTENSION_SUPPORT hlv.h a0, a0 #else .word 1678067059 #endif ret .section .text.__hlv_hu .global __hlv_hu __hlv_hu: #ifdef LLVM_RISCV_HYPERVISOR_EXTENSION_SUPPORT hlv.hu a0, a0 #else .word 1679115635 #endif ret .section .text.__hlvx_hu .global __hlvx_hu __hlvx_hu: #ifdef LLVM_RISCV_HYPERVISOR_EXTENSION_SUPPORT hlvx.hu a0, a0 #else .word 1681212787 #endif ret .section .text.__hlv_w .global __hlv_w __hlv_w: #ifdef LLVM_RISCV_HYPERVISOR_EXTENSION_SUPPORT hlv.w a0, a0 #else .word 1745175923 #endif ret .section .text.__hlvx_wu .global __hlvx_wu __hlvx_wu: #ifdef LLVM_RISCV_HYPERVISOR_EXTENSION_SUPPORT hlvx.wu a0, a0 #else .word 1748321651 #endif ret .section .text.__hsv_b .global __hsv_b __hsv_b: #ifdef LLVM_RISCV_HYPERVISOR_EXTENSION_SUPPORT hsv.b a0, a1 #else .word 1656045683 #endif ret .section .text.__hsv_h .global __hsv_h __hsv_h: #ifdef LLVM_RISCV_HYPERVISOR_EXTENSION_SUPPORT hsv.h a0, a1 #else .word 1723154547 #endif ret .section .text.__hsv_w .global __hsv_w __hsv_w: #ifdef LLVM_RISCV_HYPERVISOR_EXTENSION_SUPPORT hsv.w a0, a1 #else .word 1790263411 #endif ret .section .text.__hlv_wu .global __hlv_wu __hlv_wu: #ifdef LLVM_RISCV_HYPERVISOR_EXTENSION_SUPPORT hlv.wu a0, a0 #else .word 1746224499 #endif ret .section .text.__hlv_d .global __hlv_d __hlv_d: #ifdef LLVM_RISCV_HYPERVISOR_EXTENSION_SUPPORT hlv.d a0, a0 #else .word 1812284787 #endif ret .section .text.__hsv_d .global __hsv_d __hsv_d: #ifdef LLVM_RISCV_HYPERVISOR_EXTENSION_SUPPORT hsv.d a0, a1 #else .word 1857372275 #endif ret // User Trap Setup RW(0x000, ustatus) // User status register RW(0x004, uie) // User interrupt-enable register RW(0x005, utvec) // User trap handler base address // User Trap Handling RW(0x040, uscratch) // Scratch register for user trap handlers RW(0x041, uepc) // User exception program counter RW(0x042, ucause) // User trap cause RW(0x043, utval) // User bad address or instruction RW(0x044, uip) // User interrupt pending // User Floating-Point CSRs RW(0x001, fflags) // Floating-Point Accrued Exceptions RW(0x002, frm) // Floating-Point Dynamic Rounding Mode RW(0x003, fcsr) // Floating-Point Control and Status Register (frm + fflags) // User Counter/Timers RO( 0xC00, cycle) // Cycle counter for RDCYCLE instruction RO( 0xC01, time) // Timer for RDTIME instruction RO( 0xC02, instret) // Instructions-retired counter for RDINSTRET instruction RO( 0xC03, hpmcounter3) // Performance-monitoring counter RO( 0xC04, hpmcounter4) // Performance-monitoring counter RO( 0xC05, hpmcounter5) // Performance-monitoring counter RO( 0xC06, hpmcounter6) // Performance-monitoring counter RO( 0xC07, hpmcounter7) // Performance-monitoring counter RO( 0xC08, hpmcounter8) // Performance-monitoring counter RO( 0xC09, hpmcounter9) // Performance-monitoring counter RO( 0xC0A, hpmcounter10) // Performance-monitoring counter RO( 0xC0B, hpmcounter11) // Performance-monitoring counter RO( 0xC0C, hpmcounter12) // Performance-monitoring counter RO( 0xC0D, hpmcounter13) // Performance-monitoring counter RO( 0xC0E, hpmcounter14) // Performance-monitoring counter RO( 0xC0F, hpmcounter15) // Performance-monitoring counter RO( 0xC10, hpmcounter16) // Performance-monitoring counter RO( 0xC11, hpmcounter17) // Performance-monitoring counter RO( 0xC12, hpmcounter18) // Performance-monitoring counter RO( 0xC13, hpmcounter19) // Performance-monitoring counter RO( 0xC14, hpmcounter20) // Performance-monitoring counter RO( 0xC15, hpmcounter21) // Performance-monitoring counter RO( 0xC16, hpmcounter22) // Performance-monitoring counter RO( 0xC17, hpmcounter23) // Performance-monitoring counter RO( 0xC18, hpmcounter24) // Performance-monitoring counter RO( 0xC19, hpmcounter25) // Performance-monitoring counter RO( 0xC1A, hpmcounter26) // Performance-monitoring counter RO( 0xC1B, hpmcounter27) // Performance-monitoring counter RO( 0xC1C, hpmcounter28) // Performance-monitoring counter RO( 0xC1D, hpmcounter29) // Performance-monitoring counter RO( 0xC1E, hpmcounter30) // Performance-monitoring counter RO( 0xC1F, hpmcounter31) // Performance-monitoring counter RO32(0xC80, cycleh) // Upper 32 bits of cycle, RV32I only RO32(0xC81, timeh) // Upper 32 bits of time, RV32I only RO32(0xC82, instreth) // Upper 32 bits of instret, RV32I only RO32(0xC83, hpmcounter3h) // Upper 32 bits of hpmcounter3, RV32I only RO32(0xC84, hpmcounter4h) RO32(0xC85, hpmcounter5h) RO32(0xC86, hpmcounter6h) RO32(0xC87, hpmcounter7h) RO32(0xC88, hpmcounter8h) RO32(0xC89, hpmcounter9h) RO32(0xC8A, hpmcounter10h) RO32(0xC8B, hpmcounter11h) RO32(0xC8C, hpmcounter12h) RO32(0xC8D, hpmcounter13h) RO32(0xC8E, hpmcounter14h) RO32(0xC8F, hpmcounter15h) RO32(0xC90, hpmcounter16h) RO32(0xC91, hpmcounter17h) RO32(0xC92, hpmcounter18h) RO32(0xC93, hpmcounter19h) RO32(0xC94, hpmcounter20h) RO32(0xC95, hpmcounter21h) RO32(0xC96, hpmcounter22h) RO32(0xC97, hpmcounter23h) RO32(0xC98, hpmcounter24h) RO32(0xC99, hpmcounter25h) RO32(0xC9A, hpmcounter26h) RO32(0xC9B, hpmcounter27h) RO32(0xC9C, hpmcounter28h) RO32(0xC9D, hpmcounter29h) RO32(0xC9E, hpmcounter30h) RO32(0xC9F, hpmcounter31h) // Supervisor Trap Setup RW(0x100, sstatus) // Supervisor status register RW(0x102, sedeleg) // Supervisor exception delegation register RW(0x103, sideleg) // Supervisor interrupt delegation register RW(0x104, sie) // Supervisor interrupt-enable register RW(0x105, stvec) // Supervisor trap handler base address RW(0x106, scounteren) // Supervisor counter enable // Supervisor Trap Handling RW(0x140, sscratch) // Scratch register for supervisor trap handlers RW(0x141, sepc) // Supervisor exception program counter RW(0x142, scause) // Supervisor trap cause RW(0x143, stval) // Supervisor bad address or instruction RW(0x144, sip) // Supervisor interrupt pending // Supervisor Protection and Translation RW(0x180, satp) // Supervisor address translation and protection // Machine Information Registers RO(0xF11, mvendorid) // Vendor ID RO(0xF12, marchid) // Architecture ID RO(0xF13, mimpid) // Implementation ID RO(0xF14, mhartid) // Hardware thread ID // Machine Trap Setup RW(0x300, mstatus) // Machine status register RW(0x301, misa) // ISA and extensions RW(0x302, medeleg) // Machine exception delegation register RW(0x303, mideleg) // Machine interrupt delegation register RW(0x304, mie) // Machine interrupt-enable register RW(0x305, mtvec) // Machine trap handler base address RW(0x306, mcounteren) // Machine counter enable // Machine Trap Handling RW(0x340, mscratch) // Scratch register for machine trap handlers RW(0x341, mepc) // Machine exception program counter RW(0x342, mcause) // Machine trap cause RW(0x343, mtval) // Machine bad address or instruction RW(0x344, mip) // Machine interrupt pending // Machine Protection and Translation RW( 0x3A0, pmpcfg0) // Physical memory protection configuration RW32(0x3A1, pmpcfg1) // Physical memory protection configuration, RV32 only RW( 0x3A2, pmpcfg2) // Physical memory protection configuration RW32(0x3A3, pmpcfg3) // Physical memory protection configuration, RV32 only RW( 0x3B0, pmpaddr0) // Physical memory protection address register RW( 0x3B1, pmpaddr1) // Physical memory protection address register RW( 0x3B2, pmpaddr2) // Physical memory protection address register RW( 0x3B3, pmpaddr3) // Physical memory protection address register RW( 0x3B4, pmpaddr4) // Physical memory protection address register RW( 0x3B5, pmpaddr5) // Physical memory protection address register RW( 0x3B6, pmpaddr6) // Physical memory protection address register RW( 0x3B7, pmpaddr7) // Physical memory protection address register RW( 0x3B8, pmpaddr8) // Physical memory protection address register RW( 0x3B9, pmpaddr9) // Physical memory protection address register RW( 0x3BA, pmpaddr10) // Physical memory protection address register RW( 0x3BB, pmpaddr11) // Physical memory protection address register RW( 0x3BC, pmpaddr12) // Physical memory protection address register RW( 0x3BD, pmpaddr13) // Physical memory protection address register RW( 0x3BE, pmpaddr14) // Physical memory protection address register RW( 0x3BF, pmpaddr15) // Physical memory protection address register // Machine Counter/Timers RO( 0xB00, mcycle) // Machine cycle counter RO( 0xB02, minstret) // Machine instructions-retired counter RO( 0xB03, mhpmcounter3) // Machine performance-monitoring counter RO( 0xB04, mhpmcounter4) // Machine performance-monitoring counter RO( 0xB05, mhpmcounter5) // Machine performance-monitoring counter RO( 0xB06, mhpmcounter6) // Machine performance-monitoring counter RO( 0xB07, mhpmcounter7) // Machine performance-monitoring counter RO( 0xB08, mhpmcounter8) // Machine performance-monitoring counter RO( 0xB09, mhpmcounter9) // Machine performance-monitoring counter RO( 0xB0A, mhpmcounter10) // Machine performance-monitoring counter RO( 0xB0B, mhpmcounter11) // Machine performance-monitoring counter RO( 0xB0C, mhpmcounter12) // Machine performance-monitoring counter RO( 0xB0D, mhpmcounter13) // Machine performance-monitoring counter RO( 0xB0E, mhpmcounter14) // Machine performance-monitoring counter RO( 0xB0F, mhpmcounter15) // Machine performance-monitoring counter RO( 0xB10, mhpmcounter16) // Machine performance-monitoring counter RO( 0xB11, mhpmcounter17) // Machine performance-monitoring counter RO( 0xB12, mhpmcounter18) // Machine performance-monitoring counter RO( 0xB13, mhpmcounter19) // Machine performance-monitoring counter RO( 0xB14, mhpmcounter20) // Machine performance-monitoring counter RO( 0xB15, mhpmcounter21) // Machine performance-monitoring counter RO( 0xB16, mhpmcounter22) // Machine performance-monitoring counter RO( 0xB17, mhpmcounter23) // Machine performance-monitoring counter RO( 0xB18, mhpmcounter24) // Machine performance-monitoring counter RO( 0xB19, mhpmcounter25) // Machine performance-monitoring counter RO( 0xB1A, mhpmcounter26) // Machine performance-monitoring counter RO( 0xB1B, mhpmcounter27) // Machine performance-monitoring counter RO( 0xB1C, mhpmcounter28) // Machine performance-monitoring counter RO( 0xB1D, mhpmcounter29) // Machine performance-monitoring counter RO( 0xB1E, mhpmcounter30) // Machine performance-monitoring counter RO( 0xB1F, mhpmcounter31) // Machine performance-monitoring counter RO32(0xB80, mcycleh) // Upper 32 bits of mcycle, RV32I only RO32(0xB82, minstreth) // Upper 32 bits of minstret, RV32I only RO32(0xB83, mhpmcounter3h) // Upper 32 bits of mhpmcounter3, RV32I only RO32(0xB84, mhpmcounter4h) RO32(0xB85, mhpmcounter5h) RO32(0xB86, mhpmcounter6h) RO32(0xB87, mhpmcounter7h) RO32(0xB88, mhpmcounter8h) RO32(0xB89, mhpmcounter9h) RO32(0xB8A, mhpmcounter10h) RO32(0xB8B, mhpmcounter11h) RO32(0xB8C, mhpmcounter12h) RO32(0xB8D, mhpmcounter13h) RO32(0xB8E, mhpmcounter14h) RO32(0xB8F, mhpmcounter15h) RO32(0xB90, mhpmcounter16h) RO32(0xB91, mhpmcounter17h) RO32(0xB92, mhpmcounter18h) RO32(0xB93, mhpmcounter19h) RO32(0xB94, mhpmcounter20h) RO32(0xB95, mhpmcounter21h) RO32(0xB96, mhpmcounter22h) RO32(0xB97, mhpmcounter23h) RO32(0xB98, mhpmcounter24h) RO32(0xB99, mhpmcounter25h) RO32(0xB9A, mhpmcounter26h) RO32(0xB9B, mhpmcounter27h) RO32(0xB9C, mhpmcounter28h) RO32(0xB9D, mhpmcounter29h) RO32(0xB9E, mhpmcounter30h) RO32(0xB9F, mhpmcounter31h) RW(0x323, mhpmevent3) // Machine performance-monitoring event selector RW(0x324, mhpmevent4) // Machine performance-monitoring event selector RW(0x325, mhpmevent5) // Machine performance-monitoring event selector RW(0x326, mhpmevent6) // Machine performance-monitoring event selector RW(0x327, mhpmevent7) // Machine performance-monitoring event selector RW(0x328, mhpmevent8) // Machine performance-monitoring event selector RW(0x329, mhpmevent9) // Machine performance-monitoring event selector RW(0x32A, mhpmevent10) // Machine performance-monitoring event selector RW(0x32B, mhpmevent11) // Machine performance-monitoring event selector RW(0x32C, mhpmevent12) // Machine performance-monitoring event selector RW(0x32D, mhpmevent13) // Machine performance-monitoring event selector RW(0x32E, mhpmevent14) // Machine performance-monitoring event selector RW(0x32F, mhpmevent15) // Machine performance-monitoring event selector RW(0x330, mhpmevent16) // Machine performance-monitoring event selector RW(0x331, mhpmevent17) // Machine performance-monitoring event selector RW(0x332, mhpmevent18) // Machine performance-monitoring event selector RW(0x333, mhpmevent19) // Machine performance-monitoring event selector RW(0x334, mhpmevent20) // Machine performance-monitoring event selector RW(0x335, mhpmevent21) // Machine performance-monitoring event selector RW(0x336, mhpmevent22) // Machine performance-monitoring event selector RW(0x337, mhpmevent23) // Machine performance-monitoring event selector RW(0x338, mhpmevent24) // Machine performance-monitoring event selector RW(0x339, mhpmevent25) // Machine performance-monitoring event selector RW(0x33A, mhpmevent26) // Machine performance-monitoring event selector RW(0x33B, mhpmevent27) // Machine performance-monitoring event selector RW(0x33C, mhpmevent28) // Machine performance-monitoring event selector RW(0x33D, mhpmevent29) // Machine performance-monitoring event selector RW(0x33E, mhpmevent30) // Machine performance-monitoring event selector RW(0x33F, mhpmevent31) // Machine performance-monitoring event selector // Debug/Trace Registers (shared with Debug Mode) RW(0x7A0, tselect) // Debug/Trace trigger register select RW(0x7A1, tdata1) // First Debug/Trace trigger data register RW(0x7A2, tdata2) // Second Debug/Trace trigger data register RW(0x7A3, tdata3) // Third Debug/Trace trigger data register // Debug Mode Registers RW(0x7B0, dcsr) // Debug control and status register RW(0x7B1, dpc) // Debug PC RW(0x7B2, dscratch) // Debug scratch register // Hypervisor Trap Setup RW(0x600, hstatus) // Hypervisor status register RW(0x602, hedeleg) // Hypervisor exception delegation register RW(0x603, hideleg) // Hypervisor interrupt delegation register RW(0x604, hie) // Hypervisor interrupt-enable register RW(0x606, hcounteren) // Hypervisor counter enable RW(0x607, hgeie) // Hypervisor guest external interrupt-enable register // Hypervisor Trap Handling RW(0x643, htval) // Hypervisor bad guest physical address RW(0x644, hip) // Hypervisor interrupt pending RW(0x645, hvip) // Hypervisor virtual interrupt pending RW(0x64a, htinst) // Hypervisor trap instruction (transformed) RW(0xe12, hgeip) // Hypervisor guest external interrupt pending // Hypervisor Protection and Translation RO(0x680, hgatp) // Hypervisor guest address translation and protection // Debug/Trace Registers RW(0x6a8, hcontext) // Hypervisor-mode context register // Hypervisor Counter/Timer Virtualization Registers RW(0x605, htimedelta) // Delta for VS/VU-mode timer RW32(0x615, htimedeltah) // Upper 32 bits of {\tt htimedelta}, RV32 only // Virtual Supervisor Registers RW(0x200, vsstatus) // Virtual supervisor status register RW(0x204, vsie) // Virtual supervisor interrupt-enable register RW(0x205, vstvec) // Virtual supervisor trap handler base address RW(0x240, vsscratch) // Virtual supervisor scratch register RW(0x241, vsepc) // Virtual supervisor exception program counter RW(0x242, vscause) // Virtual supervisor trap cause RW(0x243, vstval) // Virtual supervisor bad address or instruction RW(0x244, vsip) // Virtual supervisor interrupt pending RW(0x280, vsatp) // Virtual supervisor address translation and protection
Heliosly/LingOS
1,964
os/src/polyhal-boot/src/arch/x86_64/ap_start.S
# Boot application processors into the protected mode. # Each non-boot CPU ("AP") is started up in response to a STARTUP # IPI from the boot CPU. Section B.4.2 of the Multi-Processor # Specification says that the AP will start in real mode with CS:IP # set to XY00:0000, where XY is an 8-bit value sent with the # STARTUP. Thus this code must start at a 4096-byte boundary. # # Because this code sets DS to zero, it must sit # at an address in the low 2^16 bytes. .equ pa_ap_start32, ap_start32 - ap_start + {start_page_paddr} .equ pa_ap_gdt, .Lap_tmp_gdt - ap_start + {start_page_paddr} .equ pa_ap_gdt_desc, .Lap_tmp_gdt_desc - ap_start + {start_page_paddr} .equ stack_ptr, {start_page_paddr} + 0xff0 .equ entry_ptr, {start_page_paddr} + 0xff8 # 0x6000 .section .text .code16 .p2align 12 .global ap_start ap_start: cli wbinvd xor ax, ax mov ds, ax mov es, ax mov ss, ax mov fs, ax mov gs, ax # load the 64-bit GDT lgdt [pa_ap_gdt_desc] # switch to protected-mode mov eax, cr0 or eax, (1 << 0) mov cr0, eax # far jump to 32-bit code. 0x8 is code32 segment selector ljmp 0x8, offset pa_ap_start32 .code32 ap_start32: mov esp, [stack_ptr] mov eax, [entry_ptr] jmp eax .balign 8 # .type multiboot_header, STT_OBJECT .Lap_tmp_gdt_desc: .short .Lap_tmp_gdt_end - .Lap_tmp_gdt - 1 # limit .long pa_ap_gdt # base .balign 16 .Lap_tmp_gdt: .quad 0x0000000000000000 # 0x00: null .quad 0x00cf9b000000ffff # 0x08: code segment (base=0, limit=0xfffff, type=32bit code exec/read, DPL=0, 4k) .quad 0x00af9b000000ffff # 0x10: code segment (base=0, limit=0xfffff, type=64bit code exec/read, DPL=0, 4k) .quad 0x00cf93000000ffff # 0x18: data segment (base=0, limit=0xfffff, type=32bit data read/write, DPL=0, 4k) .Lap_tmp_gdt_end: # 0x7000 .p2align 12 .global ap_end ap_end:
Heliosly/LingOS
5,404
os/src/polyhal-boot/src/arch/x86_64/multiboot.S
# Bootstrapping from 32-bit with the Multiboot specification. # See https://www.gnu.org/software/grub/manual/multiboot/multiboot.html # Build the 2M Table Mapper. .macro Page2MTable base .set n, \base .rept 512 .quad n + 0x83 .set n, n + 0x200000 .endr .endm .macro MapAll2MPage name, addr \name: Page2MTable \addr .endm .macro Page1GHugeTable before, until .set n, \before * 0x40000000 .rept \until - \before .quad n + 0x83 .set n, n + 0x40000000 .endr .endm .section .multiboot .balign 4 .type multiboot_header, STT_OBJECT multiboot_header: .int {mb_hdr_magic} # magic: 0x1BADB002 .int {mb_hdr_flags} # flags .int -({mb_hdr_magic} + {mb_hdr_flags}) # checksum .int multiboot_header - {kernel_offset} # header_addr .int _skernel - {kernel_offset} # load_addr .int _load_end - {kernel_offset} # load_end .int _end - {kernel_offset} # bss_end_addr .int _start - {kernel_offset} # entry_addr .int {graphic} # graphic mode .int 0 # graphic pixel width .int 0 # graphic pixel height .int 32 # graphic pixel color bits # Common code in 32-bit, prepare states to enter 64-bit. .code32 .global _start .global _secondary_start _start: mov edi, eax # arg1: magic: 0x2BADB002 mov esi, ebx # arg2: multiboot info lgdt [.Ltmp_gdt_desc - {kernel_offset}] # load the temporary GDT # set data segment selectors mov ax, 0x18 mov ss, ax mov ds, ax mov es, ax mov fs, ax mov gs, ax # set PAE, PGE bit in CR4 mov eax, cr4 or eax, {cr4} mov cr4, eax # load the temporary page table lea eax, [_boot_page_table - {kernel_offset}] mov cr3, eax # set LME, NXE bit in IA32_EFER mov ecx, {efer_msr} rdmsr or eax, {efer} wrmsr # set protected mode, write protect, paging bit in CR0 mov eax, cr0 or eax, {cr0} mov cr0, eax ljmp 0x10, offset bsp_entry64 - {kernel_offset} # 0x10 is code64 segment _secondary_start: # set data segment selectors mov ax, 0x18 mov ss, ax mov ds, ax mov es, ax mov fs, ax mov gs, ax # set PAE, PGE bit in CR4 mov eax, {cr4} mov cr4, eax # load the temporary page table lea eax, [_boot_page_table - {kernel_offset}] mov cr3, eax # set LME, NXE bit in IA32_EFER mov ecx, {efer_msr} mov edx, 0 mov eax, {efer} wrmsr # set protected mode, write protect, paging bit in CR0 mov eax, {cr0} mov cr0, eax ljmp 0x10, offset ap_entry64 - {kernel_offset} # 0x10 is code64 segment .code64 bsp_entry64: # clear segment selectors xor ax, ax mov ss, ax mov ds, ax mov es, ax mov fs, ax mov gs, ax # set RSP to boot stack movabs rsp, offset bstack_top # call rust_entry(magic, mbi) movabs rax, offset {entry} call rax jmp .Lhlt ap_entry64: xor ax, ax mov ss, ax mov ds, ax mov es, ax mov fs, ax mov gs, ax # set RSP to high address (already set in ap_start.S) mov rax, {kernel_offset} add rsp, rax # call rust_entry_secondary(magic) movabs rax, offset {entry_secondary} call rax jmp .Lhlt .Lhlt: hlt jmp .Lhlt .section .rodata .balign 8 .Ltmp_gdt_desc: .short .Ltmp_gdt_end - .Ltmp_gdt - 1 # limit .long .Ltmp_gdt - {kernel_offset} # base .section .data .balign 16 .Ltmp_gdt: .quad 0x0000000000000000 # 0x00: null .quad 0x00cf9b000000ffff # 0x08: code segment (base=0, limit=0xfffff, type=32bit code exec/read, DPL=0, 4k) .quad 0x00af9b000000ffff # 0x10: code segment (base=0, limit=0xfffff, type=64bit code exec/read, DPL=0, 4k) .quad 0x00cf93000000ffff # 0x18: data segment (base=0, limit=0xfffff, type=32bit data read/write, DPL=0, 4k) .Ltmp_gdt_end: .balign 4096 .global _boot_page_table _boot_page_table: # 0x0000_0000 ~ 0xffff_ffff .quad _boot_mapping_pdpt - {kernel_offset} + 0x3 # PRESENT | WRITABLE | paddr(tmp_pdpt) .zero 8 * 255 .quad _boot_mapping_pdpt - {kernel_offset} + 0x3 # PRESENT | WRITABLE | paddr(tmp_pdpt) .zero 8 * 255 .balign 4096 .global _boot_mapping_pdpt # FIXME: may not work on macOS using hvf as the CPU does not support 1GB page (pdpe1gb) _boot_mapping_pdpt: .quad .Lboot_pd1 - {kernel_offset} + 0x3 # PRESENT | WRITABLE | paddr(0x0) .quad .Lboot_pd2 - {kernel_offset} + 0x3 # PRESENT | WRITABLE | HUGE_PAGE | paddr(0x4000_0000) .quad .Lboot_pd3 - {kernel_offset} + 0x3 # PRESENT | WRITABLE | HUGE_PAGE | paddr(0x8000_0000) .quad .Lboot_pd4 - {kernel_offset} + 0x3 # PRESENT | WRITABLE | HUGE_PAGE | paddr(0xc000_0000) Page1GHugeTable 4, 512 .balign 4096 MapAll2MPage .Lboot_pd1, 0x00000000 MapAll2MPage .Lboot_pd2, 0x40000000 MapAll2MPage .Lboot_pd3, 0x80000000 MapAll2MPage .Lboot_pd4, 0xc0000000
Heliosly/LingOS
249
os/src/arch/riscv64/signal.S
# To create the sigreturn trampoline .equ __NR_sigreturn, 139 .section .text.signal_trampoline, "ax" # "ax": allocatable+executable .globl start_signal_trampoline .balign 4 start_signal_trampoline: li a7, __NR_sigreturn li a0, 0 ecall
Heliosly/LingOS
6,073
os/src/arch/riscv64/trap.S
.attribute arch, "rv64gc" .altmacro .equ FP_START, 50 .equ TRAPFRAME_SIZE, 688 .macro SAVE_GP n sd x\n, \n*8(sp) .endm .macro LOAD_GP n ld x\n, \n*8(sp) .endm .macro SAVE_FP n, m fsd f\n, \m*8(sp) .endm .macro LOAD_FP n, m fld f\n, \m*8(sp) .endm #Push 所有 general purpose registers 到 TrapContext.x[0..31] .macro PUSH_GENERAL_REGS sd ra, 0*8(sp) sd t0, 4*8(sp) sd t1, 5*8(sp) sd t2, 6*8(sp) sd s0, 7*8(sp) sd s1, 8*8(sp) sd a0, 9*8(sp) sd a1, 10*8(sp) sd a2, 11*8(sp) sd a3, 12*8(sp) sd a4, 13*8(sp) sd a5, 14*8(sp) sd a6, 15*8(sp) sd a7, 16*8(sp) sd s2, 17*8(sp) sd s3, 18*8(sp) sd s4, 19*8(sp) sd s5, 20*8(sp) sd s6, 21*8(sp) sd s7, 22*8(sp) sd s8, 23*8(sp) sd s9, 24*8(sp) sd s10,25*8(sp) sd s11,26*8(sp) sd t3, 27*8(sp) sd t4, 28*8(sp) sd t5, 29*8(sp) sd t6, 30*8(sp) # 注意:x31 是 zero 寄存器,不需要存储,通常跳过 .endm #从 TrapContext.x[0..31] 恢复所有通用寄存器 .macro POP_GENERAL_REGS ld ra, 0*8(sp) ld t0, 4*8(sp) ld t1, 5*8(sp) ld t2, 6*8(sp) ld s0, 7*8(sp) ld s1, 8*8(sp) ld a0, 9*8(sp) ld a1, 10*8(sp) ld a2, 11*8(sp) ld a3, 12*8(sp) ld a4, 13*8(sp) ld a5, 14*8(sp) ld a6, 15*8(sp) ld a7, 16*8(sp) ld s2, 17*8(sp) ld s3, 18*8(sp) ld s4, 19*8(sp) ld s5, 20*8(sp) ld s6, 21*8(sp) ld s7, 22*8(sp) ld s8, 23*8(sp) ld s9, 24*8(sp) ld s10,25*8(sp) ld s11,26*8(sp) ld t3, 27*8(sp) ld t4, 28*8(sp) ld t5, 29*8(sp) ld t6, 30*8(sp) # 同样,x31 不恢复 .endm # ---------------------------------------------------------------- # SAVE_REGS:把 x1–x31, f0–f31, fcsr, a0, sstatus, sepc, sscratch(sp) 全都存到 TrapContext # TrapContext 布局里: # x1..x31 → 偏移 1*8 … 31*8 # sscratch → 存到 2*8 # original a0 → 50*8 # sstatus → 32*8 # sepc → 33*8 # f0..f31 → m=FP_START*8 … (FP_START+31)*8 # fcsr → 83*8 .macro SAVE_REGS PUSH_GENERAL_REGS csrr t0, sepc csrr t1, sstatus csrrw t2, sscratch, zero # 保存 sscratch 到 t2,并清空它 sd t0, 32*8(sp) # tf.sepc sd t1, 31*8(sp) # tf.sstatus sd t2, 1*8(sp) # tf.regs.sp #—— save浮点寄存器 f0..f31 .set n, 0 .set m, FP_START .rept 32 SAVE_FP %n, %m .set n, n+1 .set m, m+1 .endr csrr t0, scause csrr t1, stval sd t0, 83*8(sp) # tf.scause sd t1, 84*8(sp) # tf.stval li t0, 1 sd t0, 85*8(sp) # tf.trap_status = 1 .endm # ---------------------------------------------------------------- # RESTORE_REGS:把 TrapContext 里的 sstatus, sepc, fcsr, f0..f31, x1..x31, sscratch(sp) 全恢复 .macro RESTORE_REGS # 载入 sepc 和 sstatus 并恢复 ld t0, 32*8(sp) # LDR t0, sp, 31 ld t1, 31*8(sp) # LDR t1, sp, 32 csrw sepc, t0 csrw sstatus, t1 # 恢复浮点寄存器 POP_GENERAL_REGS #—— 恢复浮点寄存器 f0..f31 .set n, 0 .set m, FP_START .rept 32 LOAD_FP %n, %m .set n, n+1 .set m, m+1 .endr # 恢复原来的 sp(内核或用户栈) ld sp, 1*8(sp) # LDR sp, sp, 1 .endm .section .text .globl trap_vector_base .globl trap_return1 .globl user_return1 .align 2 .align 2 trap_vector_base: # —— 交换 sp 和 sscratch csrrw sp, sscratch, sp # sscratch(旧 sp)非零:用户态 trap;为零:内核态 trap bnez sp, user_trap # sscratch == 0,跳到内核态处理 j kernel_trap kernel_trap: # 内核态陷入:sscratch 中保存了原来的 sp csrr sp, sscratch addi sp, sp, -TRAPFRAME_SIZE # 在内核栈上为 TrapFrame 腾出空间 SAVE_REGS # 保存寄存器、sepc、sstatus、sp、fs0、fs1…… mv a0, sp # 第一个参数:TrapFrame 指针 li a1, 1 # 第二个参数:通过 trap 进入 trampoline li a2, 0 # 第三个参数:在内核态发生 Trap call trampoline RESTORE_REGS # 恢复寄存器 sret # 从陷阱返回 # ---------------------------------------------------------------- # 用户态陷入分支 user_trap: SAVE_REGS # sp 已是 TrapFrame 指针,sscratch 保存了原 sp # 假设以下偏移按字节展开 ld t1, 2*8(sp) ld t0, 3*8(sp) sd gp, 2*8(sp) sd tp, 3*8(sp) mv gp, t1 mv tp, t0 li a0, 1 sd a0, 85*8(sp) # TrapFrame[37]=1,表示任务优先处理 Trap mv a0, sp # 参数1:TrapFrame 指针 li a1, 1 # 参数2:通过 trap 进入 trampoline li a2, 1 # 参数3:由用户态进入 ld sp, 33*8(sp) # 从 TrapFrame[38] 恢复内核栈顶指针 call trampoline # 不会返回,最终在 trampoline 中走 trap_return .size trap_vector_base, .-trap_vector_base # void trap_return(TrapContext* ctx); trap_return1: # 参数 a0 是 TrapContext*,先设 sp = a0 mv sp, a0 # 恢复浮点寄存器 fs0, fs1TODO # 恢复 sepc / sstatus ld t0, 32*8(sp) # sepc ld t1, 31*8(sp) # sstatus csrw sepc, t0 csrw sstatus, t1 # 恢复通用寄存器 x1..x31(x0 固定为 0) POP_GENERAL_REGS # 恢复内核栈指针 ld sp, 33*8(sp) # kernel_sp sret #void user_return(TrapContext* ctx); user_return1: mv sp, a0 # 恢复浮点寄存器 # 交换 gp <-> x3 (TrapContext.x[2]) ld t0, 2*8(sp) sd gp, 2*8(sp) mv gp, t0 # 交换 tp <-> x4 (TrapContext.x[3]) ld t0, 3*8(sp) sd tp, 3*8(sp) mv tp, t0 # 存一份 ctx 到 sscratch,便于 trap handler 使用 csrw sscratch, a0 # 恢复 sepc / sstatus ld t0, 32*8(sp) ld t1, 31*8(sp) csrw sepc, t0 csrw sstatus, t1 # 恢复通用寄存器 POP_GENERAL_REGS # 恢复用户态 sp(x2) ld sp, 1*8(sp) sret
Heliosly/LingOS
271
os/src/arch/loongarch64/signal.S
# To create the sigreturn trampoline .equ __NR_sigreturn, 139 .section .text.signal_trampoline, "ax" # "ax": allocatable+executable .globl start_signal_trampoline .balign 4 start_signal_trampoline: ori $a7, $zero, __NR_sigreturn ori $a0, $zero, 0 syscall 0
Heliosly/LingOS
4,652
os/src/arch/loongarch64/trap.S
.equ TRAPFRAME_SIZE, 688 .equ KSAVE_USP, 0x502 .macro SAVE_GP n st.d $r\n, $sp, \n*8 .endm .macro LOAD_GP n ld.d $r\n, $sp, \n*8 .endm .macro SAVE_FP n, m fst.d $f\n, $sp, \m*8 .endm .macro LOAD_FP n, m fld.d $f\n, $sp, \m*8 .endm .macro PUSH_GENERAL_REGS st.d $r1, $sp, 0*8 st.d $r4, $sp, 3*8 st.d $r5, $sp, 4*8 st.d $r6, $sp, 5*8 st.d $r7, $sp, 6*8 st.d $r8, $sp, 7*8 st.d $r9, $sp, 8*8 st.d $r10, $sp, 9*8 st.d $r11, $sp, 10*8 st.d $r12, $sp, 11*8 st.d $r13, $sp, 12*8 st.d $r14, $sp, 13*8 st.d $r15, $sp, 14*8 st.d $r16, $sp, 15*8 st.d $r17, $sp, 16*8 st.d $r18, $sp, 17*8 st.d $r19, $sp, 18*8 st.d $r20, $sp, 19*8 st.d $r22, $sp, 21*8 st.d $r23, $sp, 22*8 st.d $r24, $sp, 23*8 st.d $r25, $sp, 24*8 st.d $r26, $sp, 25*8 st.d $r27, $sp, 26*8 st.d $r28, $sp, 27*8 st.d $r29, $sp, 28*8 st.d $r30, $sp, 29*8 st.d $r31, $sp, 30*8 .endm .macro POP_GENERAL_REGS ld.d $r1, $sp, 0*8 ld.d $r4, $sp, 3*8 ld.d $r5, $sp, 4*8 ld.d $r6, $sp, 5*8 ld.d $r7, $sp, 6*8 ld.d $r8, $sp, 7*8 ld.d $r9, $sp, 8*8 ld.d $r10, $sp, 9*8 ld.d $r11, $sp, 10*8 ld.d $r12, $sp, 11*8 ld.d $r13, $sp, 12*8 ld.d $r14, $sp, 13*8 ld.d $r15, $sp, 14*8 ld.d $r16, $sp, 15*8 ld.d $r17, $sp, 16*8 ld.d $r18, $sp, 17*8 ld.d $r19, $sp, 18*8 ld.d $r20, $sp, 19*8 ld.d $r22, $sp, 21*8 ld.d $r23, $sp, 22*8 ld.d $r24, $sp, 23*8 ld.d $r25, $sp, 24*8 ld.d $r26, $sp, 25*8 ld.d $r27, $sp, 26*8 ld.d $r28, $sp, 27*8 ld.d $r29, $sp, 28*8 ld.d $r30, $sp, 29*8 ld.d $r31, $sp, 30*8 .endm .macro SAVE_REGS PUSH_GENERAL_REGS csrrd $t2, KSAVE_USP # 读取 KSAVE_USP 到 $t0 csrwr $zero, KSAVE_USP # 清零 KSAVE_USP st.d $t2, $sp, 2*8 # ERA csrrd $t0, 0x6 st.d $t0, $sp, 32*8 # PRMD csrrd $t0, 0x1 st.d $t0, $sp, 31*8 # ESTAT csrrd $t0, 0x5 st.d $t0, $sp, 83*8 # BADV csrrd $t0, 0x7 st.d $t0, $sp, 84*8 # trap_status = 1 ori $t0, $zero, 1 st.d $t0, $sp, 85*8 .endm .macro RESTORE_REGS # ERA ld.d $t0, $sp, 32*8 csrwr $t0, 0x6 # PRMD ld.d $t0, $sp, 31*8 csrwr $t0, 0x1 POP_GENERAL_REGS .endm .section .text .globl trap_vector_base .globl trap_return1 .globl user_return1 .align 12 trap_vector_base: csrwr $sp, KSAVE_USP # CSR_PRMD bnez $sp, user_trap b kernel_trap kernel_trap: # 内核态异常处理 addi.d $sp, $sp, -TRAPFRAME_SIZE SAVE_REGS or $a0, $sp, $zero ori $a1, $zero, 1 # has_trap = true ori $a2, $zero, 0 # from_user = false bl trampoline RESTORE_REGS ertn user_trap: SAVE_REGS # sp 已是 TrapFrame 指针,sscratch 保存了原 sp # 读取 sp(x3)和 tp(x4)保存的槽位 ld.d $t1, $sp, 20*8 # TrapFrame[20] -> 保存的是 sp ld.d $t0, $sp, 1*8 # TrapFrame[1] -> 保存的是 tp # 把当前 gp($r3)和 tp($r4)写回 TrapFrame st.d $r21, $sp, 20*8 # gp 写回 TrapFrame[2] st.d $tp, $sp, 1*8 # tp 写回 TrapFrame[3] # 恢复 gp 和 tp or $r21, $t1, $zero # 恢复 gp or $tp, $t0, $zero # 恢复 tp # 设置 TrapFrame[85] = 1,表示任务优先处理 trap ori $a0, $zero, 1 st.d $a0, $sp, 85*8 # 设置 trampoline 参数 or $a0, $sp, $zero # 参数1:TrapFrame 指针 ori $a1, $zero, 1 # 参数2:通过 trap 进入 trampoline ori $a2, $zero, 1 # 参数3:由用户态进入 # 切换内核栈 ld.d $sp, $sp, 33*8 # 从 TrapFrame[38] 恢复内核栈顶指针 bl trampoline # 不会返回,最终从 trampoline 走 trap_return trap_return1: or $sp, $a0, $zero ld.d $t0, $sp, 32*8 # ERA ld.d $t1, $sp, 31*8 # PRMD csrwr $t0, 0x6 csrwr $t1, 0x1 POP_GENERAL_REGS ld.d $sp, $sp, 33*8 ertn user_return1: # 参数 a0 是 TrapContext 指针,设 sp = a0 or $sp, $a0, $zero # 交换 gp <-> x3 (TrapContext.x[20]) ld.d $t0, $sp, 20*8 st.d $r21, $sp, 20*8 or $r21, $t0, $zero # 交换 tp <-> x4 (TrapContext.x[1]) ld.d $t0, $sp, 1*8 st.d $tp, $sp, 1*8 or $tp, $t0, $zero # 存一份 TrapContext 指针到 KSAVE_USP,方便 trap handler 使用 csrwr $a0 , KSAVE_USP # 恢复 era(相当于 sepc)和 prmd(相当于 sstatus) ld.d $t0, $sp, 32*8 # TrapContext.sepc ld.d $t1, $sp, 31*8 # TrapContext.sstatus csrwr $t0 , 0x6 # era csrwr $t1 , 0x1 # prmd POP_GENERAL_REGS # 恢复用户态 sp(x3) ld.d $sp, $sp, 2*8 ertn
Heliosly/LingOS
3,479
os/src/polyhal-trap/src/trap/aarch64/trap.S
.macro INVALID_EXCP, kind, source .p2align 7 msr daifset, #2 sub sp, sp, 35 * 8 stp x0, x1, [sp] stp x2, x3, [sp, 2 * 8] stp x4, x5, [sp, 4 * 8] stp x6, x7, [sp, 6 * 8] stp x8, x9, [sp, 8 * 8] stp x10, x11, [sp, 10 * 8] stp x12, x13, [sp, 12 * 8] stp x14, x15, [sp, 14 * 8] stp x16, x17, [sp, 16 * 8] stp x18, x19, [sp, 18 * 8] stp x20, x21, [sp, 20 * 8] stp x22, x23, [sp, 22 * 8] stp x24, x25, [sp, 24 * 8] stp x26, x27, [sp, 26 * 8] stp x28, x29, [sp, 28 * 8] mrs x9, sp_el0 mrs x10, elr_el1 mrs x11, spsr_el1 mrs x12, tpidr_el0 stp x30, x9, [sp, 30 * 8] stp x10, x11, [sp, 32 * 8] str x12, [sp, 34 * 8] mov x0, sp mov x1, \kind mov x2, \source bl handle_exception b .Lexception_return .endm .macro USER_TRAP, kind .p2align 7 msr daifset, #2 str x1, [sp, 17 * 8] ldr x1, [sp, 16 * 8] stp x0, x1, [x1] stp x2, x3, [x1, 2 * 8] stp x4, x5, [x1, 4 * 8] stp x6, x7, [x1, 6 * 8] stp x8, x9, [x1, 8 * 8] stp x10, x11, [x1, 10 * 8] stp x12, x13, [x1, 12 * 8] stp x14, x15, [x1, 14 * 8] stp x16, x17, [x1, 16 * 8] stp x18, x19, [x1, 18 * 8] stp x20, x21, [x1, 20 * 8] stp x22, x23, [x1, 22 * 8] stp x24, x25, [x1, 24 * 8] stp x26, x27, [x1, 26 * 8] stp x28, x29, [x1, 28 * 8] mov x0, \kind b .Luser_trap_external .endm .section .text .p2align 12 .global exception_vector_base exception_vector_base: // current EL, with SP_EL0 INVALID_EXCP 0 0 INVALID_EXCP 1 0 INVALID_EXCP 2 0 INVALID_EXCP 3 0 // current EL, with SP_ELx INVALID_EXCP 0 1 INVALID_EXCP 1 1 INVALID_EXCP 2 1 INVALID_EXCP 3 1 // lower EL, aarch64 USER_TRAP 0 USER_TRAP 1 USER_TRAP 2 USER_TRAP 3 // lower EL, aarch32 INVALID_EXCP 0 3 INVALID_EXCP 1 3 INVALID_EXCP 2 3 INVALID_EXCP 3 3 .Luser_trap_external: mrs x9, sp_el0 mrs x10, elr_el1 mrs x11, spsr_el1 mrs x12, tpidr_el0 stp x30, x9, [x1, 30 * 8] stp x10, x11, [x1, 32 * 8] str x12, [x1, 34 * 8] ldr x3, [sp, 17 * 8] str x3, [x1, 1 * 8] ldp x8, x16, [sp] ldp x17, x18, [sp, 2 * 8] ldp x19, x20, [sp, 4 * 8] ldp x21, x22, [sp, 6 * 8] ldp x23, x24, [sp, 8 * 8] ldp x25, x26, [sp, 10 * 8] ldp x27, x28, [sp, 12 * 8] ldp x29, x30, [sp, 14 * 8] add sp, sp, 18 * 8 ret .Lexception_return: ldr x12, [sp, 34 * 8] ldp x10, x11, [sp, 32 * 8] ldp x30, x9, [sp, 30 * 8] msr sp_el0, x9 msr elr_el1, x10 msr spsr_el1, x11 msr tpidr_el0, x12 ldp x28, x29, [sp, 28 * 8] ldp x26, x27, [sp, 26 * 8] ldp x24, x25, [sp, 24 * 8] ldp x22, x23, [sp, 22 * 8] ldp x20, x21, [sp, 20 * 8] ldp x18, x19, [sp, 18 * 8] ldp x16, x17, [sp, 16 * 8] ldp x14, x15, [sp, 14 * 8] ldp x12, x13, [sp, 12 * 8] ldp x10, x11, [sp, 10 * 8] ldp x8, x9, [sp, 8 * 8] ldp x6, x7, [sp, 6 * 8] ldp x4, x5, [sp, 4 * 8] ldp x2, x3, [sp, 2 * 8] ldp x0, x1, [sp] add sp, sp, 35 * 8 eret
Heliosly/LingOS
766
os/src/polyhal-trap/src/trap/x86_64/trap.S
.equ NUM_INT, 256 .altmacro .macro DEF_HANDLER, i .Ltrap_handler_\i: .if \i == 8 || (\i >= 10 && \i <= 14) || \i == 17 # error code pushed by CPU push \i # interrupt vector jmp .Ltrap_common .else push 0 # fill in error code in TrapFrame push \i # interrupt vector jmp .Ltrap_common .endif .endm .macro DEF_TABLE_ENTRY, i .quad .Ltrap_handler_\i .endm .section .text .code64 _trap_handlers: .set i, 0 .rept NUM_INT DEF_HANDLER %i .set i, i + 1 .endr .Ltrap_common: test byte ptr [rsp + 3 * 8], 3 jnz uservec jmp kernelvec .section .rodata .global trap_handler_table trap_handler_table: .set i, 0 .rept NUM_INT DEF_TABLE_ENTRY %i .set i, i + 1 .endr
heqichen/qcpilot
24,549
panda/board/stm32f4/startup_stm32f413xx.s
/** ****************************************************************************** * @file startup_stm32f413xx.s * @author MCD Application Team * @version V2.6.0 * @date 04-November-2016 * @brief STM32F413xx Devices vector table for GCC based toolchains. * This module performs: * - Set the initial SP * - Set the initial PC == Reset_Handler, * - Set the vector table entries with the exceptions ISR address * - Branches to main in the C library (which eventually * calls main()). * After Reset the Cortex-M4 processor is in Thread mode, * priority is Privileged, and the Stack is set to Main. ****************************************************************************** * @attention * * <h2><center>&copy; COPYRIGHT 2016 STMicroelectronics</center></h2> * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. Neither the name of STMicroelectronics nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************** */ .syntax unified .cpu cortex-m4 .fpu softvfp .thumb .global g_pfnVectors .global Default_Handler /* start address for the initialization values of the .data section. defined in linker script */ .word _sidata /* start address for the .data section. defined in linker script */ .word _sdata /* end address for the .data section. defined in linker script */ .word _edata /* start address for the .bss section. defined in linker script */ .word _sbss /* end address for the .bss section. defined in linker script */ .word _ebss /* stack used for SystemInit_ExtMemCtl; always internal RAM used */ /** * @brief This is the code that gets called when the processor first * starts execution following a reset event. Only the absolutely * necessary set is performed, after which the application * supplied main() routine is called. * @param None * @retval : None */ .section .text.Reset_Handler .weak Reset_Handler .type Reset_Handler, %function Reset_Handler: ldr sp, =_estack /* set stack pointer */ bl __initialize_hardware_early /* Copy the data segment initializers from flash to SRAM */ movs r1, #0 b LoopCopyDataInit CopyDataInit: ldr r3, =_sidata ldr r3, [r3, r1] str r3, [r0, r1] adds r1, r1, #4 LoopCopyDataInit: ldr r0, =_sdata ldr r3, =_edata adds r2, r0, r1 cmp r2, r3 bcc CopyDataInit ldr r2, =_sbss b LoopFillZerobss /* Zero fill the bss segment. */ FillZerobss: movs r3, #0 str r3, [r2], #4 LoopFillZerobss: ldr r3, = _ebss cmp r2, r3 bcc FillZerobss /* Call the clock system intitialization function.*/ /* bl SystemInit */ /* Call static constructors */ /* bl __libc_init_array */ /* Call the application's entry point.*/ bl main bx lr .size Reset_Handler, .-Reset_Handler /** * @brief This is the code that gets called when the processor receives an * unexpected interrupt. This simply enters an infinite loop, preserving * the system state for examination by a debugger. * @param None * @retval None */ .section .text.Default_Handler,"ax",%progbits Default_Handler: Infinite_Loop: b Infinite_Loop .size Default_Handler, .-Default_Handler /****************************************************************************** * * The minimal vector table for a Cortex M3. Note that the proper constructs * must be placed on this to ensure that it ends up at physical address * 0x0000.0000. * *******************************************************************************/ .section .isr_vector,"a",%progbits .type g_pfnVectors, %object .size g_pfnVectors, .-g_pfnVectors g_pfnVectors: .word _estack .word Reset_Handler .word NMI_Handler .word HardFault_Handler .word MemManage_Handler .word BusFault_Handler .word UsageFault_Handler .word 0 .word 0 .word 0 .word 0 .word SVC_Handler .word DebugMon_Handler .word 0 .word PendSV_Handler .word SysTick_Handler /* External Interrupts */ .word WWDG_IRQHandler /* Window WatchDog */ .word PVD_IRQHandler /* PVD through EXTI Line detection */ .word TAMP_STAMP_IRQHandler /* Tamper and TimeStamps through the EXTI line */ .word RTC_WKUP_IRQHandler /* RTC Wakeup through the EXTI line */ .word FLASH_IRQHandler /* FLASH */ .word RCC_IRQHandler /* RCC */ .word EXTI0_IRQHandler /* EXTI Line0 */ .word EXTI1_IRQHandler /* EXTI Line1 */ .word EXTI2_IRQHandler /* EXTI Line2 */ .word EXTI3_IRQHandler /* EXTI Line3 */ .word EXTI4_IRQHandler /* EXTI Line4 */ .word DMA1_Stream0_IRQHandler /* DMA1 Stream 0 */ .word DMA1_Stream1_IRQHandler /* DMA1 Stream 1 */ .word DMA1_Stream2_IRQHandler /* DMA1 Stream 2 */ .word DMA1_Stream3_IRQHandler /* DMA1 Stream 3 */ .word DMA1_Stream4_IRQHandler /* DMA1 Stream 4 */ .word DMA1_Stream5_IRQHandler /* DMA1 Stream 5 */ .word DMA1_Stream6_IRQHandler /* DMA1 Stream 6 */ .word ADC_IRQHandler /* ADC1, ADC2 and ADC3s */ .word CAN1_TX_IRQHandler /* CAN1 TX */ .word CAN1_RX0_IRQHandler /* CAN1 RX0 */ .word CAN1_RX1_IRQHandler /* CAN1 RX1 */ .word CAN1_SCE_IRQHandler /* CAN1 SCE */ .word EXTI9_5_IRQHandler /* External Line[9:5]s */ .word TIM1_BRK_TIM9_IRQHandler /* TIM1 Break and TIM9 */ .word TIM1_UP_TIM10_IRQHandler /* TIM1 Update and TIM10 */ .word TIM1_TRG_COM_TIM11_IRQHandler /* TIM1 Trigger and Commutation and TIM11 */ .word TIM1_CC_IRQHandler /* TIM1 Capture Compare */ .word TIM2_IRQHandler /* TIM2 */ .word TIM3_IRQHandler /* TIM3 */ .word TIM4_IRQHandler /* TIM4 */ .word I2C1_EV_IRQHandler /* I2C1 Event */ .word I2C1_ER_IRQHandler /* I2C1 Error */ .word I2C2_EV_IRQHandler /* I2C2 Event */ .word I2C2_ER_IRQHandler /* I2C2 Error */ .word SPI1_IRQHandler /* SPI1 */ .word SPI2_IRQHandler /* SPI2 */ .word USART1_IRQHandler /* USART1 */ .word USART2_IRQHandler /* USART2 */ .word USART3_IRQHandler /* USART3 */ .word EXTI15_10_IRQHandler /* External Line[15:10]s */ .word RTC_Alarm_IRQHandler /* RTC Alarm (A and B) through EXTI Line */ .word OTG_FS_WKUP_IRQHandler /* USB OTG FS Wakeup through EXTI line */ .word TIM8_BRK_TIM12_IRQHandler /* TIM8 Break and TIM12 */ .word TIM8_UP_TIM13_IRQHandler /* TIM8 Update and TIM13 */ .word TIM8_TRG_COM_TIM14_IRQHandler /* TIM8 Trigger and Commutation and TIM14 */ .word TIM8_CC_IRQHandler /* TIM8 Capture Compare */ .word DMA1_Stream7_IRQHandler /* DMA1 Stream7 */ .word FSMC_IRQHandler /* FSMC */ .word SDIO_IRQHandler /* SDIO */ .word TIM5_IRQHandler /* TIM5 */ .word SPI3_IRQHandler /* SPI3 */ .word UART4_IRQHandler /* UART4 */ .word UART5_IRQHandler /* UART5 */ .word TIM6_DAC_IRQHandler /* TIM6, DAC1 and DAC2 */ .word TIM7_IRQHandler /* TIM7 */ .word DMA2_Stream0_IRQHandler /* DMA2 Stream 0 */ .word DMA2_Stream1_IRQHandler /* DMA2 Stream 1 */ .word DMA2_Stream2_IRQHandler /* DMA2 Stream 2 */ .word DMA2_Stream3_IRQHandler /* DMA2 Stream 3 */ .word DMA2_Stream4_IRQHandler /* DMA2 Stream 4 */ .word DFSDM1_FLT0_IRQHandler /* DFSDM1 Filter0 */ .word DFSDM1_FLT1_IRQHandler /* DFSDM1 Filter1 */ .word CAN2_TX_IRQHandler /* CAN2 TX */ .word CAN2_RX0_IRQHandler /* CAN2 RX0 */ .word CAN2_RX1_IRQHandler /* CAN2 RX1 */ .word CAN2_SCE_IRQHandler /* CAN2 SCE */ .word OTG_FS_IRQHandler /* USB OTG FS */ .word DMA2_Stream5_IRQHandler /* DMA2 Stream 5 */ .word DMA2_Stream6_IRQHandler /* DMA2 Stream 6 */ .word DMA2_Stream7_IRQHandler /* DMA2 Stream 7 */ .word USART6_IRQHandler /* USART6 */ .word I2C3_EV_IRQHandler /* I2C3 event */ .word I2C3_ER_IRQHandler /* I2C3 error */ .word CAN3_TX_IRQHandler /* CAN3 TX */ .word CAN3_RX0_IRQHandler /* CAN3 RX0 */ .word CAN3_RX1_IRQHandler /* CAN3 RX1 */ .word CAN3_SCE_IRQHandler /* CAN3 SCE */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word RNG_IRQHandler /* RNG */ .word FPU_IRQHandler /* FPU */ .word UART7_IRQHandler /* UART7 */ .word UART8_IRQHandler /* UART8 */ .word SPI4_IRQHandler /* SPI4 */ .word SPI5_IRQHandler /* SPI5 */ .word 0 /* Reserved */ .word SAI1_IRQHandler /* SAI1 */ .word UART9_IRQHandler /* UART9 */ .word UART10_IRQHandler /* UART10 */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word QUADSPI_IRQHandler /* QuadSPI */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word FMPI2C1_EV_IRQHandler /* FMPI2C1 Event */ .word FMPI2C1_ER_IRQHandler /* FMPI2C1 Error */ .word LPTIM1_IRQHandler /* LPTIM1 */ .word DFSDM2_FLT0_IRQHandler /* DFSDM2 Filter0 */ .word DFSDM2_FLT1_IRQHandler /* DFSDM2 Filter1 */ .word DFSDM2_FLT2_IRQHandler /* DFSDM2 Filter2 */ .word DFSDM2_FLT3_IRQHandler /* DFSDM2 Filter3 */ /******************************************************************************* * * Provide weak aliases for each Exception handler to the Default_Handler. * As they are weak aliases, any function with the same name will override * this definition. * *******************************************************************************/ .weak NMI_Handler .thumb_set NMI_Handler,Default_Handler .weak HardFault_Handler .thumb_set HardFault_Handler,Default_Handler .weak MemManage_Handler .thumb_set MemManage_Handler,Default_Handler .weak BusFault_Handler .thumb_set BusFault_Handler,Default_Handler .weak UsageFault_Handler .thumb_set UsageFault_Handler,Default_Handler .weak SVC_Handler .thumb_set SVC_Handler,Default_Handler .weak DebugMon_Handler .thumb_set DebugMon_Handler,Default_Handler .weak PendSV_Handler .thumb_set PendSV_Handler,Default_Handler .weak SysTick_Handler .thumb_set SysTick_Handler,Default_Handler .weak WWDG_IRQHandler .thumb_set WWDG_IRQHandler,Default_Handler .weak PVD_IRQHandler .thumb_set PVD_IRQHandler,Default_Handler .weak TAMP_STAMP_IRQHandler .thumb_set TAMP_STAMP_IRQHandler,Default_Handler .weak RTC_WKUP_IRQHandler .thumb_set RTC_WKUP_IRQHandler,Default_Handler .weak FLASH_IRQHandler .thumb_set FLASH_IRQHandler,Default_Handler .weak RCC_IRQHandler .thumb_set RCC_IRQHandler,Default_Handler .weak EXTI0_IRQHandler .thumb_set EXTI0_IRQHandler,Default_Handler .weak EXTI1_IRQHandler .thumb_set EXTI1_IRQHandler,Default_Handler .weak EXTI2_IRQHandler .thumb_set EXTI2_IRQHandler,Default_Handler .weak EXTI3_IRQHandler .thumb_set EXTI3_IRQHandler,Default_Handler .weak EXTI4_IRQHandler .thumb_set EXTI4_IRQHandler,Default_Handler .weak DMA1_Stream0_IRQHandler .thumb_set DMA1_Stream0_IRQHandler,Default_Handler .weak DMA1_Stream1_IRQHandler .thumb_set DMA1_Stream1_IRQHandler,Default_Handler .weak DMA1_Stream2_IRQHandler .thumb_set DMA1_Stream2_IRQHandler,Default_Handler .weak DMA1_Stream3_IRQHandler .thumb_set DMA1_Stream3_IRQHandler,Default_Handler .weak DMA1_Stream4_IRQHandler .thumb_set DMA1_Stream4_IRQHandler,Default_Handler .weak DMA1_Stream5_IRQHandler .thumb_set DMA1_Stream5_IRQHandler,Default_Handler .weak DMA1_Stream6_IRQHandler .thumb_set DMA1_Stream6_IRQHandler,Default_Handler .weak ADC_IRQHandler .thumb_set ADC_IRQHandler,Default_Handler .weak CAN1_TX_IRQHandler .thumb_set CAN1_TX_IRQHandler,Default_Handler .weak CAN1_RX0_IRQHandler .thumb_set CAN1_RX0_IRQHandler,Default_Handler .weak CAN1_RX1_IRQHandler .thumb_set CAN1_RX1_IRQHandler,Default_Handler .weak CAN1_SCE_IRQHandler .thumb_set CAN1_SCE_IRQHandler,Default_Handler .weak EXTI9_5_IRQHandler .thumb_set EXTI9_5_IRQHandler,Default_Handler .weak TIM1_BRK_TIM9_IRQHandler .thumb_set TIM1_BRK_TIM9_IRQHandler,Default_Handler .weak TIM1_UP_TIM10_IRQHandler .thumb_set TIM1_UP_TIM10_IRQHandler,Default_Handler .weak TIM1_TRG_COM_TIM11_IRQHandler .thumb_set TIM1_TRG_COM_TIM11_IRQHandler,Default_Handler .weak TIM1_CC_IRQHandler .thumb_set TIM1_CC_IRQHandler,Default_Handler .weak TIM2_IRQHandler .thumb_set TIM2_IRQHandler,Default_Handler .weak TIM3_IRQHandler .thumb_set TIM3_IRQHandler,Default_Handler .weak TIM4_IRQHandler .thumb_set TIM4_IRQHandler,Default_Handler .weak I2C1_EV_IRQHandler .thumb_set I2C1_EV_IRQHandler,Default_Handler .weak I2C1_ER_IRQHandler .thumb_set I2C1_ER_IRQHandler,Default_Handler .weak I2C2_EV_IRQHandler .thumb_set I2C2_EV_IRQHandler,Default_Handler .weak I2C2_ER_IRQHandler .thumb_set I2C2_ER_IRQHandler,Default_Handler .weak SPI1_IRQHandler .thumb_set SPI1_IRQHandler,Default_Handler .weak SPI2_IRQHandler .thumb_set SPI2_IRQHandler,Default_Handler .weak USART1_IRQHandler .thumb_set USART1_IRQHandler,Default_Handler .weak USART2_IRQHandler .thumb_set USART2_IRQHandler,Default_Handler .weak USART3_IRQHandler .thumb_set USART3_IRQHandler,Default_Handler .weak EXTI15_10_IRQHandler .thumb_set EXTI15_10_IRQHandler,Default_Handler .weak RTC_Alarm_IRQHandler .thumb_set RTC_Alarm_IRQHandler,Default_Handler .weak OTG_FS_WKUP_IRQHandler .thumb_set OTG_FS_WKUP_IRQHandler,Default_Handler .weak TIM8_BRK_TIM12_IRQHandler .thumb_set TIM8_BRK_TIM12_IRQHandler,Default_Handler .weak TIM8_UP_TIM13_IRQHandler .thumb_set TIM8_UP_TIM13_IRQHandler,Default_Handler .weak TIM8_TRG_COM_TIM14_IRQHandler .thumb_set TIM8_TRG_COM_TIM14_IRQHandler,Default_Handler .weak TIM8_CC_IRQHandler .thumb_set TIM8_CC_IRQHandler,Default_Handler .weak DMA1_Stream7_IRQHandler .thumb_set DMA1_Stream7_IRQHandler,Default_Handler .weak FSMC_IRQHandler .thumb_set FSMC_IRQHandler,Default_Handler .weak SDIO_IRQHandler .thumb_set SDIO_IRQHandler,Default_Handler .weak TIM5_IRQHandler .thumb_set TIM5_IRQHandler,Default_Handler .weak SPI3_IRQHandler .thumb_set SPI3_IRQHandler,Default_Handler .weak UART4_IRQHandler .thumb_set UART4_IRQHandler,Default_Handler .weak UART5_IRQHandler .thumb_set UART5_IRQHandler,Default_Handler .weak TIM6_DAC_IRQHandler .thumb_set TIM6_DAC_IRQHandler,Default_Handler .weak TIM7_IRQHandler .thumb_set TIM7_IRQHandler,Default_Handler .weak DMA2_Stream0_IRQHandler .thumb_set DMA2_Stream0_IRQHandler,Default_Handler .weak DMA2_Stream1_IRQHandler .thumb_set DMA2_Stream1_IRQHandler,Default_Handler .weak DMA2_Stream2_IRQHandler .thumb_set DMA2_Stream2_IRQHandler,Default_Handler .weak DMA2_Stream3_IRQHandler .thumb_set DMA2_Stream3_IRQHandler,Default_Handler .weak DMA2_Stream4_IRQHandler .thumb_set DMA2_Stream4_IRQHandler,Default_Handler .weak DFSDM1_FLT0_IRQHandler .thumb_set DFSDM1_FLT0_IRQHandler,Default_Handler .weak DFSDM1_FLT1_IRQHandler .thumb_set DFSDM1_FLT1_IRQHandler,Default_Handler .weak CAN2_TX_IRQHandler .thumb_set CAN2_TX_IRQHandler,Default_Handler .weak CAN2_RX0_IRQHandler .thumb_set CAN2_RX0_IRQHandler,Default_Handler .weak CAN2_RX1_IRQHandler .thumb_set CAN2_RX1_IRQHandler,Default_Handler .weak CAN2_SCE_IRQHandler .thumb_set CAN2_SCE_IRQHandler,Default_Handler .weak OTG_FS_IRQHandler .thumb_set OTG_FS_IRQHandler,Default_Handler .weak DMA2_Stream5_IRQHandler .thumb_set DMA2_Stream5_IRQHandler,Default_Handler .weak DMA2_Stream6_IRQHandler .thumb_set DMA2_Stream6_IRQHandler,Default_Handler .weak DMA2_Stream7_IRQHandler .thumb_set DMA2_Stream7_IRQHandler,Default_Handler .weak USART6_IRQHandler .thumb_set USART6_IRQHandler,Default_Handler .weak I2C3_EV_IRQHandler .thumb_set I2C3_EV_IRQHandler,Default_Handler .weak I2C3_ER_IRQHandler .thumb_set I2C3_ER_IRQHandler,Default_Handler .weak CAN3_TX_IRQHandler .thumb_set CAN3_TX_IRQHandler,Default_Handler .weak CAN3_RX0_IRQHandler .thumb_set CAN3_RX0_IRQHandler,Default_Handler .weak CAN3_RX1_IRQHandler .thumb_set CAN3_RX1_IRQHandler,Default_Handler .weak CAN3_SCE_IRQHandler .thumb_set CAN3_SCE_IRQHandler,Default_Handler .weak RNG_IRQHandler .thumb_set RNG_IRQHandler,Default_Handler .weak FPU_IRQHandler .thumb_set FPU_IRQHandler,Default_Handler .weak UART7_IRQHandler .thumb_set UART7_IRQHandler,Default_Handler .weak UART8_IRQHandler .thumb_set UART8_IRQHandler,Default_Handler .weak SPI4_IRQHandler .thumb_set SPI4_IRQHandler,Default_Handler .weak SPI5_IRQHandler .thumb_set SPI5_IRQHandler,Default_Handler .weak SAI1_IRQHandler .thumb_set SAI1_IRQHandler,Default_Handler .weak UART9_IRQHandler .thumb_set UART9_IRQHandler,Default_Handler .weak UART10_IRQHandler .thumb_set UART10_IRQHandler,Default_Handler .weak QUADSPI_IRQHandler .thumb_set QUADSPI_IRQHandler,Default_Handler .weak FMPI2C1_EV_IRQHandler .thumb_set FMPI2C1_EV_IRQHandler,Default_Handler .weak FMPI2C1_ER_IRQHandler .thumb_set FMPI2C1_ER_IRQHandler,Default_Handler .weak LPTIM1_IRQHandler .thumb_set LPTIM1_IRQHandler,Default_Handler .weak DFSDM2_FLT0_IRQHandler .thumb_set DFSDM2_FLT0_IRQHandler,Default_Handler .weak DFSDM2_FLT1_IRQHandler .thumb_set DFSDM2_FLT1_IRQHandler,Default_Handler .weak DFSDM2_FLT2_IRQHandler .thumb_set DFSDM2_FLT2_IRQHandler,Default_Handler .weak DFSDM2_FLT3_IRQHandler .thumb_set DFSDM2_FLT3_IRQHandler,Default_Handler /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
heqichen/qcpilot
30,560
panda/board/stm32h7/startup_stm32h7x5xx.s
/** ****************************************************************************** * @file startup_stm32h735xx.s * @author MCD Application Team * @brief STM32H735xx Devices vector table for GCC based toolchain. * This module performs: * - Set the initial SP * - Set the initial PC == Reset_Handler, * - Set the vector table entries with the exceptions ISR address * - Branches to main in the C library (which eventually * calls main()). * After Reset the Cortex-M processor is in Thread mode, * priority is Privileged, and the Stack is set to Main. ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics. * All rights reserved.</center></h2> * * This software component is licensed by ST under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** */ .syntax unified .cpu cortex-m7 .fpu softvfp .thumb .global g_pfnVectors .global Default_Handler /* start address for the initialization values of the .data section. defined in linker script */ .word _sidata /* start address for the .data section. defined in linker script */ .word _sdata /* end address for the .data section. defined in linker script */ .word _edata /* start address for the .bss section. defined in linker script */ .word _sbss /* end address for the .bss section. defined in linker script */ .word _ebss /* stack used for SystemInit_ExtMemCtl; always internal RAM used */ /** * @brief This is the code that gets called when the processor first * starts execution following a reset event. Only the absolutely * necessary set is performed, after which the application * supplied main() routine is called. * @param None * @retval : None */ .section .text.Reset_Handler .weak Reset_Handler .type Reset_Handler, %function Reset_Handler: ldr sp, =_estack /* set stack pointer */ bl __initialize_hardware_early /* Copy the data segment initializers from flash to SRAM */ ldr r0, =_sdata ldr r1, =_edata ldr r2, =_sidata movs r3, #0 b LoopCopyDataInit CopyDataInit: ldr r4, [r2, r3] str r4, [r0, r3] adds r3, r3, #4 LoopCopyDataInit: adds r4, r0, r3 cmp r4, r1 bcc CopyDataInit /* Zero fill the bss segment. */ ldr r2, =_sbss ldr r4, =_ebss movs r3, #0 b LoopFillZerobss FillZerobss: str r3, [r2] adds r2, r2, #4 LoopFillZerobss: cmp r2, r4 bcc FillZerobss /* Call the clock system intitialization function.*/ /* bl SystemInit */ /* Call static constructors */ /* bl __libc_init_array */ /* Call the application's entry point.*/ bl main bx lr .size Reset_Handler, .-Reset_Handler /** * @brief This is the code that gets called when the processor receives an * unexpected interrupt. This simply enters an infinite loop, preserving * the system state for examination by a debugger. * @param None * @retval None */ .section .text.Default_Handler,"ax",%progbits Default_Handler: Infinite_Loop: b Infinite_Loop .size Default_Handler, .-Default_Handler /****************************************************************************** * * The minimal vector table for a Cortex M. Note that the proper constructs * must be placed on this to ensure that it ends up at physical address * 0x0000.0000. * *******************************************************************************/ .section .isr_vector,"a",%progbits .type g_pfnVectors, %object .size g_pfnVectors, .-g_pfnVectors g_pfnVectors: .word _estack .word Reset_Handler .word NMI_Handler .word HardFault_Handler .word MemManage_Handler .word BusFault_Handler .word UsageFault_Handler .word 0 .word 0 .word 0 .word 0 .word SVC_Handler .word DebugMon_Handler .word 0 .word PendSV_Handler .word SysTick_Handler /* External Interrupts */ .word WWDG_IRQHandler /* Window WatchDog */ .word PVD_AVD_IRQHandler /* PVD/AVD through EXTI Line detection */ .word TAMP_STAMP_IRQHandler /* Tamper and TimeStamps through the EXTI line */ .word RTC_WKUP_IRQHandler /* RTC Wakeup through the EXTI line */ .word FLASH_IRQHandler /* FLASH */ .word RCC_IRQHandler /* RCC */ .word EXTI0_IRQHandler /* EXTI Line0 */ .word EXTI1_IRQHandler /* EXTI Line1 */ .word EXTI2_IRQHandler /* EXTI Line2 */ .word EXTI3_IRQHandler /* EXTI Line3 */ .word EXTI4_IRQHandler /* EXTI Line4 */ .word DMA1_Stream0_IRQHandler /* DMA1 Stream 0 */ .word DMA1_Stream1_IRQHandler /* DMA1 Stream 1 */ .word DMA1_Stream2_IRQHandler /* DMA1 Stream 2 */ .word DMA1_Stream3_IRQHandler /* DMA1 Stream 3 */ .word DMA1_Stream4_IRQHandler /* DMA1 Stream 4 */ .word DMA1_Stream5_IRQHandler /* DMA1 Stream 5 */ .word DMA1_Stream6_IRQHandler /* DMA1 Stream 6 */ .word ADC_IRQHandler /* ADC1, ADC2 and ADC3s */ .word FDCAN1_IT0_IRQHandler /* FDCAN1 interrupt line 0 */ .word FDCAN2_IT0_IRQHandler /* FDCAN2 interrupt line 0 */ .word FDCAN1_IT1_IRQHandler /* FDCAN1 interrupt line 1 */ .word FDCAN2_IT1_IRQHandler /* FDCAN2 interrupt line 1 */ .word EXTI9_5_IRQHandler /* External Line[9:5]s */ .word TIM1_BRK_IRQHandler /* TIM1 Break interrupt */ .word TIM1_UP_IRQHandler /* TIM1 Update interrupt */ .word TIM1_TRG_COM_IRQHandler /* TIM1 Trigger and Commutation interrupt */ .word TIM1_CC_IRQHandler /* TIM1 Capture Compare */ .word TIM2_IRQHandler /* TIM2 */ .word TIM3_IRQHandler /* TIM3 */ .word TIM4_IRQHandler /* TIM4 */ .word I2C1_EV_IRQHandler /* I2C1 Event */ .word I2C1_ER_IRQHandler /* I2C1 Error */ .word I2C2_EV_IRQHandler /* I2C2 Event */ .word I2C2_ER_IRQHandler /* I2C2 Error */ .word SPI1_IRQHandler /* SPI1 */ .word SPI2_IRQHandler /* SPI2 */ .word USART1_IRQHandler /* USART1 */ .word USART2_IRQHandler /* USART2 */ .word USART3_IRQHandler /* USART3 */ .word EXTI15_10_IRQHandler /* External Line[15:10]s */ .word RTC_Alarm_IRQHandler /* RTC Alarm (A and B) through EXTI Line */ .word 0 /* Reserved */ .word TIM8_BRK_TIM12_IRQHandler /* TIM8 Break and TIM12 */ .word TIM8_UP_TIM13_IRQHandler /* TIM8 Update and TIM13 */ .word TIM8_TRG_COM_TIM14_IRQHandler /* TIM8 Trigger and Commutation and TIM14 */ .word TIM8_CC_IRQHandler /* TIM8 Capture Compare */ .word DMA1_Stream7_IRQHandler /* DMA1 Stream7 */ .word FMC_IRQHandler /* FMC */ .word SDMMC1_IRQHandler /* SDMMC1 */ .word TIM5_IRQHandler /* TIM5 */ .word SPI3_IRQHandler /* SPI3 */ .word UART4_IRQHandler /* UART4 */ .word UART5_IRQHandler /* UART5 */ .word TIM6_DAC_IRQHandler /* TIM6 and DAC1&2 underrun errors */ .word TIM7_IRQHandler /* TIM7 */ .word DMA2_Stream0_IRQHandler /* DMA2 Stream 0 */ .word DMA2_Stream1_IRQHandler /* DMA2 Stream 1 */ .word DMA2_Stream2_IRQHandler /* DMA2 Stream 2 */ .word DMA2_Stream3_IRQHandler /* DMA2 Stream 3 */ .word DMA2_Stream4_IRQHandler /* DMA2 Stream 4 */ .word ETH_IRQHandler /* Ethernet */ .word ETH_WKUP_IRQHandler /* Ethernet Wakeup through EXTI line */ .word FDCAN_CAL_IRQHandler /* FDCAN calibration unit interrupt*/ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word DMA2_Stream5_IRQHandler /* DMA2 Stream 5 */ .word DMA2_Stream6_IRQHandler /* DMA2 Stream 6 */ .word DMA2_Stream7_IRQHandler /* DMA2 Stream 7 */ .word USART6_IRQHandler /* USART6 */ .word I2C3_EV_IRQHandler /* I2C3 event */ .word I2C3_ER_IRQHandler /* I2C3 error */ .word OTG_HS_EP1_OUT_IRQHandler /* USB OTG HS End Point 1 Out */ .word OTG_HS_EP1_IN_IRQHandler /* USB OTG HS End Point 1 In */ .word OTG_HS_WKUP_IRQHandler /* USB OTG HS Wakeup through EXTI */ .word OTG_HS_IRQHandler /* USB OTG HS */ .word DCMI_PSSI_IRQHandler /* DCMI, PSSI */ .word CRYP_IRQHandler /* CRYP */ .word HASH_RNG_IRQHandler /* Hash and Rng */ .word FPU_IRQHandler /* FPU */ .word UART7_IRQHandler /* UART7 */ .word UART8_IRQHandler /* UART8 */ .word SPI4_IRQHandler /* SPI4 */ .word SPI5_IRQHandler /* SPI5 */ .word SPI6_IRQHandler /* SPI6 */ .word SAI1_IRQHandler /* SAI1 */ .word LTDC_IRQHandler /* LTDC */ .word LTDC_ER_IRQHandler /* LTDC error */ .word DMA2D_IRQHandler /* DMA2D */ .word 0 /* Reserved */ .word OCTOSPI1_IRQHandler /* OCTOSPI1 */ .word LPTIM1_IRQHandler /* LPTIM1 */ .word CEC_IRQHandler /* HDMI_CEC */ .word I2C4_EV_IRQHandler /* I2C4 Event */ .word I2C4_ER_IRQHandler /* I2C4 Error */ .word SPDIF_RX_IRQHandler /* SPDIF_RX */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word DMAMUX1_OVR_IRQHandler /* DMAMUX1 Overrun interrupt */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word DFSDM1_FLT0_IRQHandler /* DFSDM Filter0 Interrupt */ .word DFSDM1_FLT1_IRQHandler /* DFSDM Filter1 Interrupt */ .word DFSDM1_FLT2_IRQHandler /* DFSDM Filter2 Interrupt */ .word DFSDM1_FLT3_IRQHandler /* DFSDM Filter3 Interrupt */ .word 0 /* Reserved */ .word SWPMI1_IRQHandler /* Serial Wire Interface 1 global interrupt */ .word TIM15_IRQHandler /* TIM15 global Interrupt */ .word TIM16_IRQHandler /* TIM16 global Interrupt */ .word TIM17_IRQHandler /* TIM17 global Interrupt */ .word MDIOS_WKUP_IRQHandler /* MDIOS Wakeup Interrupt */ .word MDIOS_IRQHandler /* MDIOS global Interrupt */ .word 0 /* Reserved */ .word MDMA_IRQHandler /* MDMA global Interrupt */ .word 0 /* Reserved */ .word SDMMC2_IRQHandler /* SDMMC2 global Interrupt */ .word HSEM1_IRQHandler /* HSEM1 global Interrupt */ .word 0 /* Reserved */ .word ADC3_IRQHandler /* ADC3 global Interrupt */ .word DMAMUX2_OVR_IRQHandler /* DMAMUX Overrun interrupt */ .word BDMA_Channel0_IRQHandler /* BDMA Channel 0 global Interrupt */ .word BDMA_Channel1_IRQHandler /* BDMA Channel 1 global Interrupt */ .word BDMA_Channel2_IRQHandler /* BDMA Channel 2 global Interrupt */ .word BDMA_Channel3_IRQHandler /* BDMA Channel 3 global Interrupt */ .word BDMA_Channel4_IRQHandler /* BDMA Channel 4 global Interrupt */ .word BDMA_Channel5_IRQHandler /* BDMA Channel 5 global Interrupt */ .word BDMA_Channel6_IRQHandler /* BDMA Channel 6 global Interrupt */ .word BDMA_Channel7_IRQHandler /* BDMA Channel 7 global Interrupt */ .word COMP1_IRQHandler /* COMP1 global Interrupt */ .word LPTIM2_IRQHandler /* LP TIM2 global interrupt */ .word LPTIM3_IRQHandler /* LP TIM3 global interrupt */ .word LPTIM4_IRQHandler /* LP TIM4 global interrupt */ .word LPTIM5_IRQHandler /* LP TIM5 global interrupt */ .word LPUART1_IRQHandler /* LP UART1 interrupt */ .word 0 /* Reserved */ .word CRS_IRQHandler /* Clock Recovery Global Interrupt */ .word ECC_IRQHandler /* ECC diagnostic Global Interrupt */ .word SAI4_IRQHandler /* SAI4 global interrupt */ .word DTS_IRQHandler /* Digital Temperature Sensor interrupt */ .word 0 /* Reserved */ .word WAKEUP_PIN_IRQHandler /* Interrupt for all 6 wake-up pins */ .word OCTOSPI2_IRQHandler /* OCTOSPI2 Interrupt */ .word OTFDEC1_IRQHandler /* OTFDEC1 Interrupt */ .word OTFDEC2_IRQHandler /* OTFDEC2 Interrupt */ .word FMAC_IRQHandler /* FMAC Interrupt */ .word CORDIC_IRQHandler /* CORDIC Interrupt */ .word UART9_IRQHandler /* UART9 Interrupt */ .word USART10_IRQHandler /* UART10 Interrupt */ .word I2C5_EV_IRQHandler /* I2C5 Event Interrupt */ .word I2C5_ER_IRQHandler /* I2C5 Error Interrupt */ .word FDCAN3_IT0_IRQHandler /* FDCAN3 interrupt line 0 */ .word FDCAN3_IT1_IRQHandler /* FDCAN3 interrupt line 1 */ .word TIM23_IRQHandler /* TIM23 global interrupt */ .word TIM24_IRQHandler /* TIM24 global interrupt */ /******************************************************************************* * * Provide weak aliases for each Exception handler to the Default_Handler. * As they are weak aliases, any function with the same name will override * this definition. * *******************************************************************************/ .weak NMI_Handler .thumb_set NMI_Handler,Default_Handler .weak HardFault_Handler .thumb_set HardFault_Handler,Default_Handler .weak MemManage_Handler .thumb_set MemManage_Handler,Default_Handler .weak BusFault_Handler .thumb_set BusFault_Handler,Default_Handler .weak UsageFault_Handler .thumb_set UsageFault_Handler,Default_Handler .weak SVC_Handler .thumb_set SVC_Handler,Default_Handler .weak DebugMon_Handler .thumb_set DebugMon_Handler,Default_Handler .weak PendSV_Handler .thumb_set PendSV_Handler,Default_Handler .weak SysTick_Handler .thumb_set SysTick_Handler,Default_Handler .weak WWDG_IRQHandler .thumb_set WWDG_IRQHandler,Default_Handler .weak PVD_AVD_IRQHandler .thumb_set PVD_AVD_IRQHandler,Default_Handler .weak TAMP_STAMP_IRQHandler .thumb_set TAMP_STAMP_IRQHandler,Default_Handler .weak RTC_WKUP_IRQHandler .thumb_set RTC_WKUP_IRQHandler,Default_Handler .weak FLASH_IRQHandler .thumb_set FLASH_IRQHandler,Default_Handler .weak RCC_IRQHandler .thumb_set RCC_IRQHandler,Default_Handler .weak EXTI0_IRQHandler .thumb_set EXTI0_IRQHandler,Default_Handler .weak EXTI1_IRQHandler .thumb_set EXTI1_IRQHandler,Default_Handler .weak EXTI2_IRQHandler .thumb_set EXTI2_IRQHandler,Default_Handler .weak EXTI3_IRQHandler .thumb_set EXTI3_IRQHandler,Default_Handler .weak EXTI4_IRQHandler .thumb_set EXTI4_IRQHandler,Default_Handler .weak DMA1_Stream0_IRQHandler .thumb_set DMA1_Stream0_IRQHandler,Default_Handler .weak DMA1_Stream1_IRQHandler .thumb_set DMA1_Stream1_IRQHandler,Default_Handler .weak DMA1_Stream2_IRQHandler .thumb_set DMA1_Stream2_IRQHandler,Default_Handler .weak DMA1_Stream3_IRQHandler .thumb_set DMA1_Stream3_IRQHandler,Default_Handler .weak DMA1_Stream4_IRQHandler .thumb_set DMA1_Stream4_IRQHandler,Default_Handler .weak DMA1_Stream5_IRQHandler .thumb_set DMA1_Stream5_IRQHandler,Default_Handler .weak DMA1_Stream6_IRQHandler .thumb_set DMA1_Stream6_IRQHandler,Default_Handler .weak ADC_IRQHandler .thumb_set ADC_IRQHandler,Default_Handler .weak FDCAN1_IT0_IRQHandler .thumb_set FDCAN1_IT0_IRQHandler,Default_Handler .weak FDCAN2_IT0_IRQHandler .thumb_set FDCAN2_IT0_IRQHandler,Default_Handler .weak FDCAN1_IT1_IRQHandler .thumb_set FDCAN1_IT1_IRQHandler,Default_Handler .weak FDCAN2_IT1_IRQHandler .thumb_set FDCAN2_IT1_IRQHandler,Default_Handler .weak EXTI9_5_IRQHandler .thumb_set EXTI9_5_IRQHandler,Default_Handler .weak TIM1_BRK_IRQHandler .thumb_set TIM1_BRK_IRQHandler,Default_Handler .weak TIM1_UP_IRQHandler .thumb_set TIM1_UP_IRQHandler,Default_Handler .weak TIM1_TRG_COM_IRQHandler .thumb_set TIM1_TRG_COM_IRQHandler,Default_Handler .weak TIM1_CC_IRQHandler .thumb_set TIM1_CC_IRQHandler,Default_Handler .weak TIM2_IRQHandler .thumb_set TIM2_IRQHandler,Default_Handler .weak TIM3_IRQHandler .thumb_set TIM3_IRQHandler,Default_Handler .weak TIM4_IRQHandler .thumb_set TIM4_IRQHandler,Default_Handler .weak I2C1_EV_IRQHandler .thumb_set I2C1_EV_IRQHandler,Default_Handler .weak I2C1_ER_IRQHandler .thumb_set I2C1_ER_IRQHandler,Default_Handler .weak I2C2_EV_IRQHandler .thumb_set I2C2_EV_IRQHandler,Default_Handler .weak I2C2_ER_IRQHandler .thumb_set I2C2_ER_IRQHandler,Default_Handler .weak SPI1_IRQHandler .thumb_set SPI1_IRQHandler,Default_Handler .weak SPI2_IRQHandler .thumb_set SPI2_IRQHandler,Default_Handler .weak USART1_IRQHandler .thumb_set USART1_IRQHandler,Default_Handler .weak USART2_IRQHandler .thumb_set USART2_IRQHandler,Default_Handler .weak USART3_IRQHandler .thumb_set USART3_IRQHandler,Default_Handler .weak EXTI15_10_IRQHandler .thumb_set EXTI15_10_IRQHandler,Default_Handler .weak RTC_Alarm_IRQHandler .thumb_set RTC_Alarm_IRQHandler,Default_Handler .weak TIM8_BRK_TIM12_IRQHandler .thumb_set TIM8_BRK_TIM12_IRQHandler,Default_Handler .weak TIM8_UP_TIM13_IRQHandler .thumb_set TIM8_UP_TIM13_IRQHandler,Default_Handler .weak TIM8_TRG_COM_TIM14_IRQHandler .thumb_set TIM8_TRG_COM_TIM14_IRQHandler,Default_Handler .weak TIM8_CC_IRQHandler .thumb_set TIM8_CC_IRQHandler,Default_Handler .weak DMA1_Stream7_IRQHandler .thumb_set DMA1_Stream7_IRQHandler,Default_Handler .weak FMC_IRQHandler .thumb_set FMC_IRQHandler,Default_Handler .weak SDMMC1_IRQHandler .thumb_set SDMMC1_IRQHandler,Default_Handler .weak TIM5_IRQHandler .thumb_set TIM5_IRQHandler,Default_Handler .weak SPI3_IRQHandler .thumb_set SPI3_IRQHandler,Default_Handler .weak UART4_IRQHandler .thumb_set UART4_IRQHandler,Default_Handler .weak UART5_IRQHandler .thumb_set UART5_IRQHandler,Default_Handler .weak TIM6_DAC_IRQHandler .thumb_set TIM6_DAC_IRQHandler,Default_Handler .weak TIM7_IRQHandler .thumb_set TIM7_IRQHandler,Default_Handler .weak DMA2_Stream0_IRQHandler .thumb_set DMA2_Stream0_IRQHandler,Default_Handler .weak DMA2_Stream1_IRQHandler .thumb_set DMA2_Stream1_IRQHandler,Default_Handler .weak DMA2_Stream2_IRQHandler .thumb_set DMA2_Stream2_IRQHandler,Default_Handler .weak DMA2_Stream3_IRQHandler .thumb_set DMA2_Stream3_IRQHandler,Default_Handler .weak DMA2_Stream4_IRQHandler .thumb_set DMA2_Stream4_IRQHandler,Default_Handler .weak ETH_IRQHandler .thumb_set ETH_IRQHandler,Default_Handler .weak ETH_WKUP_IRQHandler .thumb_set ETH_WKUP_IRQHandler,Default_Handler .weak FDCAN_CAL_IRQHandler .thumb_set FDCAN_CAL_IRQHandler,Default_Handler .weak DMA2_Stream5_IRQHandler .thumb_set DMA2_Stream5_IRQHandler,Default_Handler .weak DMA2_Stream6_IRQHandler .thumb_set DMA2_Stream6_IRQHandler,Default_Handler .weak DMA2_Stream7_IRQHandler .thumb_set DMA2_Stream7_IRQHandler,Default_Handler .weak USART6_IRQHandler .thumb_set USART6_IRQHandler,Default_Handler .weak I2C3_EV_IRQHandler .thumb_set I2C3_EV_IRQHandler,Default_Handler .weak I2C3_ER_IRQHandler .thumb_set I2C3_ER_IRQHandler,Default_Handler .weak OTG_HS_EP1_OUT_IRQHandler .thumb_set OTG_HS_EP1_OUT_IRQHandler,Default_Handler .weak OTG_HS_EP1_IN_IRQHandler .thumb_set OTG_HS_EP1_IN_IRQHandler,Default_Handler .weak OTG_HS_WKUP_IRQHandler .thumb_set OTG_HS_WKUP_IRQHandler,Default_Handler .weak OTG_HS_IRQHandler .thumb_set OTG_HS_IRQHandler,Default_Handler .weak DCMI_PSSI_IRQHandler .thumb_set DCMI_PSSI_IRQHandler,Default_Handler .weak CRYP_IRQHandler .thumb_set CRYP_IRQHandler,Default_Handler .weak HASH_RNG_IRQHandler .thumb_set HASH_RNG_IRQHandler,Default_Handler .weak FPU_IRQHandler .thumb_set FPU_IRQHandler,Default_Handler .weak UART7_IRQHandler .thumb_set UART7_IRQHandler,Default_Handler .weak UART8_IRQHandler .thumb_set UART8_IRQHandler,Default_Handler .weak SPI4_IRQHandler .thumb_set SPI4_IRQHandler,Default_Handler .weak SPI5_IRQHandler .thumb_set SPI5_IRQHandler,Default_Handler .weak SPI6_IRQHandler .thumb_set SPI6_IRQHandler,Default_Handler .weak SAI1_IRQHandler .thumb_set SAI1_IRQHandler,Default_Handler .weak LTDC_IRQHandler .thumb_set LTDC_IRQHandler,Default_Handler .weak LTDC_ER_IRQHandler .thumb_set LTDC_ER_IRQHandler,Default_Handler .weak DMA2D_IRQHandler .thumb_set DMA2D_IRQHandler,Default_Handler .weak OCTOSPI1_IRQHandler .thumb_set OCTOSPI1_IRQHandler,Default_Handler .weak LPTIM1_IRQHandler .thumb_set LPTIM1_IRQHandler,Default_Handler .weak CEC_IRQHandler .thumb_set CEC_IRQHandler,Default_Handler .weak I2C4_EV_IRQHandler .thumb_set I2C4_EV_IRQHandler,Default_Handler .weak I2C4_ER_IRQHandler .thumb_set I2C4_ER_IRQHandler,Default_Handler .weak SPDIF_RX_IRQHandler .thumb_set SPDIF_RX_IRQHandler,Default_Handler .weak DMAMUX1_OVR_IRQHandler .thumb_set DMAMUX1_OVR_IRQHandler,Default_Handler .weak DFSDM1_FLT0_IRQHandler .thumb_set DFSDM1_FLT0_IRQHandler,Default_Handler .weak DFSDM1_FLT1_IRQHandler .thumb_set DFSDM1_FLT1_IRQHandler,Default_Handler .weak DFSDM1_FLT2_IRQHandler .thumb_set DFSDM1_FLT2_IRQHandler,Default_Handler .weak DFSDM1_FLT3_IRQHandler .thumb_set DFSDM1_FLT3_IRQHandler,Default_Handler .weak SWPMI1_IRQHandler .thumb_set SWPMI1_IRQHandler,Default_Handler .weak TIM15_IRQHandler .thumb_set TIM15_IRQHandler,Default_Handler .weak TIM16_IRQHandler .thumb_set TIM16_IRQHandler,Default_Handler .weak TIM17_IRQHandler .thumb_set TIM17_IRQHandler,Default_Handler .weak MDIOS_WKUP_IRQHandler .thumb_set MDIOS_WKUP_IRQHandler,Default_Handler .weak MDIOS_IRQHandler .thumb_set MDIOS_IRQHandler,Default_Handler .weak MDMA_IRQHandler .thumb_set MDMA_IRQHandler,Default_Handler .weak SDMMC2_IRQHandler .thumb_set SDMMC2_IRQHandler,Default_Handler .weak HSEM1_IRQHandler .thumb_set HSEM1_IRQHandler,Default_Handler .weak ADC3_IRQHandler .thumb_set ADC3_IRQHandler,Default_Handler .weak DMAMUX2_OVR_IRQHandler .thumb_set DMAMUX2_OVR_IRQHandler,Default_Handler .weak BDMA_Channel0_IRQHandler .thumb_set BDMA_Channel0_IRQHandler,Default_Handler .weak BDMA_Channel1_IRQHandler .thumb_set BDMA_Channel1_IRQHandler,Default_Handler .weak BDMA_Channel2_IRQHandler .thumb_set BDMA_Channel2_IRQHandler,Default_Handler .weak BDMA_Channel3_IRQHandler .thumb_set BDMA_Channel3_IRQHandler,Default_Handler .weak BDMA_Channel4_IRQHandler .thumb_set BDMA_Channel4_IRQHandler,Default_Handler .weak BDMA_Channel5_IRQHandler .thumb_set BDMA_Channel5_IRQHandler,Default_Handler .weak BDMA_Channel6_IRQHandler .thumb_set BDMA_Channel6_IRQHandler,Default_Handler .weak BDMA_Channel7_IRQHandler .thumb_set BDMA_Channel7_IRQHandler,Default_Handler .weak COMP1_IRQHandler .thumb_set COMP1_IRQHandler,Default_Handler .weak LPTIM2_IRQHandler .thumb_set LPTIM2_IRQHandler,Default_Handler .weak LPTIM3_IRQHandler .thumb_set LPTIM3_IRQHandler,Default_Handler .weak LPTIM4_IRQHandler .thumb_set LPTIM4_IRQHandler,Default_Handler .weak LPTIM5_IRQHandler .thumb_set LPTIM5_IRQHandler,Default_Handler .weak LPUART1_IRQHandler .thumb_set LPUART1_IRQHandler,Default_Handler .weak CRS_IRQHandler .thumb_set CRS_IRQHandler,Default_Handler .weak ECC_IRQHandler .thumb_set ECC_IRQHandler,Default_Handler .weak SAI4_IRQHandler .thumb_set SAI4_IRQHandler,Default_Handler .weak DTS_IRQHandler .thumb_set DTS_IRQHandler,Default_Handler .weak WAKEUP_PIN_IRQHandler .thumb_set WAKEUP_PIN_IRQHandler,Default_Handler .weak OCTOSPI2_IRQHandler .thumb_set OCTOSPI2_IRQHandler,Default_Handler .weak OTFDEC1_IRQHandler .thumb_set OTFDEC1_IRQHandler,Default_Handler .weak OTFDEC2_IRQHandler .thumb_set OTFDEC2_IRQHandler,Default_Handler .weak FMAC_IRQHandler .thumb_set FMAC_IRQHandler,Default_Handler .weak CORDIC_IRQHandler .thumb_set CORDIC_IRQHandler,Default_Handler .weak UART9_IRQHandler .thumb_set UART9_IRQHandler,Default_Handler .weak USART10_IRQHandler .thumb_set USART10_IRQHandler,Default_Handler .weak I2C5_EV_IRQHandler .thumb_set I2C5_EV_IRQHandler,Default_Handler .weak I2C5_ER_IRQHandler .thumb_set I2C5_ER_IRQHandler,Default_Handler .weak FDCAN3_IT0_IRQHandler .thumb_set FDCAN3_IT0_IRQHandler,Default_Handler .weak FDCAN3_IT1_IRQHandler .thumb_set FDCAN3_IT1_IRQHandler,Default_Handler .weak TIM23_IRQHandler .thumb_set TIM23_IRQHandler,Default_Handler .weak TIM24_IRQHandler .thumb_set TIM24_IRQHandler,Default_Handler /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
heqichen/qcpilot
2,508
tinygrad_repo/extra/assembly/rocm/rdna3/prog.s
.global _start _start: .rodata .align 0x10 .global code.kd .type code.kd,STT_OBJECT # amd_kernel_code_t (must be at 0x440 for kernel_code_entry_byte_offset to be right) code.kd: # amd_kernel_..., amd_machine_... .long 0,0,0,0 # kernel_code_entry_byte_offset, kernel_code_prefetch_byte_offset .long 0x00000bc0,0x00000000,0x00000000,0x00000000 # kernel_code_prefetch_byte_size, max_scratch_backing_memory_byte_size .long 0,0,0,0 # compute_pgm_rsrc1, compute_pgm_rsrc2, kernel_code_properties, workitem_private_segment_byte_size .long 0x60af0000,0x0000009e,0x00000408,0x00000000 # compute_pgm_rsrc1 |= AMD_COMPUTE_PGM_RSRC_ONE_FLOAT_DENORM_MODE_32 | AMD_COMPUTE_PGM_RSRC_ONE_FLOAT_DENORM_MODE_16_64 # compute_pgm_rsrc1 |= AMD_COMPUTE_PGM_RSRC_ONE_ENABLE_DX10_CLAMP | AMD_COMPUTE_PGM_RSRC_ONE_ENABLE_IEEE_MODE # compute_pgm_rsrc2 |= AMD_COMPUTE_PGM_RSRC_TWO_USER_SGPR_COUNT = 0xF # compute_pgm_rsrc2 |= AMD_COMPUTE_PGM_RSRC_TWO_ENABLE_SGPR_WORKGROUP_ID_X # kernel_code_properties |= AMD_KERNEL_CODE_PROPERTIES_ENABLE_SGPR_KERNARG_SEGMENT_PTR = 1 # kernel_code_properties |= AMD_KERNEL_CODE_PROPERTIES_RESERVED1 = 1 .text .global code .type code,STT_FUNC code: # https://llvm.org/docs/AMDGPUUsage.html#initial-kernel-execution-state # s[0:1] contains the kernarg_address # TODO: can we use s[2:3] if this was really a wave since we only alloced 2 SGPRs? s_load_b64 s[2:3], s[0:1], null s_mov_b32 s8, 0 loop: s_addk_i32 s8, 1 s_cmp_eq_u32 s8, 100000 // FLOPS s_cbranch_scc0 loop # wait for the s_load_b64 s_waitcnt lgkmcnt(0) v_dual_mov_b32 v0, 4 :: v_dual_mov_b32 v1, 2.0 global_store_b32 v0, v1, s[2:3] # Deallocate all VGPRs for this wave. Use only when next instruction is S_ENDPGM. s_sendmsg sendmsg(MSG_DEALLOC_VGPRS) s_endpgm s_code_end .amdgpu_metadata amdhsa.kernels: - .args: - .address_space: global .name: a .offset: 0 .size: 8 .type_name: 'float*' .value_kind: global_buffer .group_segment_fixed_size: 0 .kernarg_segment_align: 8 .kernarg_segment_size: 8 .language: OpenCL C .language_version: - 1 - 2 .max_flat_workgroup_size: 256 .name: code .private_segment_fixed_size: 0 .sgpr_count: 2 .sgpr_spill_count: 0 .symbol: code.kd .uses_dynamic_stack: false .vgpr_count: 256 .vgpr_spill_count: 0 .wavefront_size: 32 amdhsa.target: amdgcn-amd-amdhsa--gfx1100 amdhsa.version: - 1 - 2 .end_amdgpu_metadata
Hexancer/loongarch_vcpu
4,928
src/trap.S
/// Enter the guest given in `VmCpuRegisters` from `a0` .global _run_guest _run_guest: /* Save hypervisor state */ /* Save hypervisor GPRs (except T0-T6 and a0, which is GuestInfo and stashed in sscratch) */ sd ra, ({hyp_ra})(a0) sd gp, ({hyp_gp})(a0) sd tp, ({hyp_tp})(a0) sd s0, ({hyp_s0})(a0) sd s1, ({hyp_s1})(a0) sd a1, ({hyp_a1})(a0) sd a2, ({hyp_a2})(a0) sd a3, ({hyp_a3})(a0) sd a4, ({hyp_a4})(a0) sd a5, ({hyp_a5})(a0) sd a6, ({hyp_a6})(a0) sd a7, ({hyp_a7})(a0) sd s2, ({hyp_s2})(a0) sd s3, ({hyp_s3})(a0) sd s4, ({hyp_s4})(a0) sd s5, ({hyp_s5})(a0) sd s6, ({hyp_s6})(a0) sd s7, ({hyp_s7})(a0) sd s8, ({hyp_s8})(a0) sd s9, ({hyp_s9})(a0) sd s10, ({hyp_s10})(a0) sd s11, ({hyp_s11})(a0) sd sp, ({hyp_sp})(a0) /* Swap in guest CSRs. */ ld t1, ({guest_sstatus})(a0) csrrw t1, sstatus, t1 sd t1, ({hyp_sstatus})(a0) ld t1, ({guest_hstatus})(a0) csrrw t1, hstatus, t1 sd t1, ({hyp_hstatus})(a0) ld t1, ({guest_scounteren})(a0) csrrw t1, scounteren, t1 sd t1, ({hyp_scounteren})(a0) ld t1, ({guest_sepc})(a0) csrw sepc, t1 /* Set stvec so that hypervisor resumes after the sret when the guest exits. */ la t1, _guest_exit csrrw t1, stvec, t1 sd t1, ({hyp_stvec})(a0) /* Save sscratch and replace with pointer to GuestInfo. */ csrrw t1, sscratch, a0 sd t1, ({hyp_sscratch})(a0) /* Restore the gprs from this GuestInfo */ ld ra, ({guest_ra})(a0) ld gp, ({guest_gp})(a0) ld tp, ({guest_tp})(a0) ld s0, ({guest_s0})(a0) ld s1, ({guest_s1})(a0) ld a1, ({guest_a1})(a0) ld a2, ({guest_a2})(a0) ld a3, ({guest_a3})(a0) ld a4, ({guest_a4})(a0) ld a5, ({guest_a5})(a0) ld a6, ({guest_a6})(a0) ld a7, ({guest_a7})(a0) ld s2, ({guest_s2})(a0) ld s3, ({guest_s3})(a0) ld s4, ({guest_s4})(a0) ld s5, ({guest_s5})(a0) ld s6, ({guest_s6})(a0) ld s7, ({guest_s7})(a0) ld s8, ({guest_s8})(a0) ld s9, ({guest_s9})(a0) ld s10, ({guest_s10})(a0) ld s11, ({guest_s11})(a0) ld t0, ({guest_t0})(a0) ld t1, ({guest_t1})(a0) ld t2, ({guest_t2})(a0) ld t3, ({guest_t3})(a0) ld t4, ({guest_t4})(a0) ld t5, ({guest_t5})(a0) ld t6, ({guest_t6})(a0) ld sp, ({guest_sp})(a0) ld a0, ({guest_a0})(a0) sret .align 2 _guest_exit: /* Pull GuestInfo out of sscratch, swapping with guest's a0 */ csrrw a0, sscratch, a0 /* Save guest GPRs. */ sd ra, ({guest_ra})(a0) sd gp, ({guest_gp})(a0) sd tp, ({guest_tp})(a0) sd s0, ({guest_s0})(a0) sd s1, ({guest_s1})(a0) sd a1, ({guest_a1})(a0) sd a2, ({guest_a2})(a0) sd a3, ({guest_a3})(a0) sd a4, ({guest_a4})(a0) sd a5, ({guest_a5})(a0) sd a6, ({guest_a6})(a0) sd a7, ({guest_a7})(a0) sd s2, ({guest_s2})(a0) sd s3, ({guest_s3})(a0) sd s4, ({guest_s4})(a0) sd s5, ({guest_s5})(a0) sd s6, ({guest_s6})(a0) sd s7, ({guest_s7})(a0) sd s8, ({guest_s8})(a0) sd s9, ({guest_s9})(a0) sd s10, ({guest_s10})(a0) sd s11, ({guest_s11})(a0) sd t0, ({guest_t0})(a0) sd t1, ({guest_t1})(a0) sd t2, ({guest_t2})(a0) sd t3, ({guest_t3})(a0) sd t4, ({guest_t4})(a0) sd t5, ({guest_t5})(a0) sd t6, ({guest_t6})(a0) sd sp, ({guest_sp})(a0) /* Save Guest a0 after recovering from sscratch. */ csrr t0, sscratch sd t0, ({guest_a0})(a0) _restore_csrs: /* Swap in hypervisor CSRs. */ ld t1, ({hyp_sstatus})(a0) csrrw t1, sstatus, t1 sd t1, ({guest_sstatus})(a0) ld t1, ({hyp_hstatus})(a0) csrrw t1, hstatus, t1 sd t1, ({guest_hstatus})(a0) ld t1, ({hyp_scounteren})(a0) csrrw t1, scounteren, t1 sd t1, ({guest_scounteren})(a0) ld t1, ({hyp_stvec})(a0) csrw stvec, t1 ld t1, ({hyp_sscratch})(a0) csrw sscratch, t1 /* Save guest EPC. */ csrr t1, sepc sd t1, ({guest_sepc})(a0) /* Restore hypervisor GPRs. */ ld ra, ({hyp_ra})(a0) ld gp, ({hyp_gp})(a0) ld tp, ({hyp_tp})(a0) ld s0, ({hyp_s0})(a0) ld s1, ({hyp_s1})(a0) ld a1, ({hyp_a1})(a0) ld a2, ({hyp_a2})(a0) ld a3, ({hyp_a3})(a0) ld a4, ({hyp_a4})(a0) ld a5, ({hyp_a5})(a0) ld a6, ({hyp_a6})(a0) ld a7, ({hyp_a7})(a0) ld s2, ({hyp_s2})(a0) ld s3, ({hyp_s3})(a0) ld s4, ({hyp_s4})(a0) ld s5, ({hyp_s5})(a0) ld s6, ({hyp_s6})(a0) ld s7, ({hyp_s7})(a0) ld s8, ({hyp_s8})(a0) ld s9, ({hyp_s9})(a0) ld s10, ({hyp_s10})(a0) ld s11, ({hyp_s11})(a0) ld sp, ({hyp_sp})(a0) ret
Hexancer/loongarch_vcpu
3,433
src/trap_la.S
.section .text .global _hyp_trap_vector _hyp_trap_vector: // 保存 host 寄存器状态 csrwr $r3, 0x502 // 保存 r3 到 DESAVE CSR csrrd $r3, 0x33 // 从 SAVE3 CSR 获取上下文指针 // 保存 host 通用寄存器 st.d $r0, $r3, 0 st.d $r1, $r3, 8 st.d $r2, $r3, 16 st.d $r4, $r3, 32 st.d $r5, $r3, 40 st.d $r6, $r3, 48 st.d $r7, $r3, 56 st.d $r8, $r3, 64 st.d $r9, $r3, 72 st.d $r10, $r3, 80 st.d $r11, $r3, 88 st.d $r12, $r3, 96 st.d $r13, $r3, 104 st.d $r14, $r3, 112 st.d $r15, $r3, 120 st.d $r16, $r3, 128 st.d $r17, $r3, 136 st.d $r18, $r3, 144 st.d $r19, $r3, 152 st.d $r20, $r3, 160 st.d $r21, $r3, 168 st.d $r22, $r3, 176 st.d $r23, $r3, 184 st.d $r24, $r3, 192 st.d $r25, $r3, 200 st.d $r26, $r3, 208 st.d $r27, $r3, 216 st.d $r28, $r3, 224 st.d $r29, $r3, 232 st.d $r30, $r3, 240 st.d $r31, $r3, 248 // 保存 host CSR 寄存器 csrrd $r4, 0x6 // ERA st.d $r4, $r3, 256 // 保存 guest 通用寄存器 gcsrrd $r4, 0x0 // GCSR_CRMD st.d $r4, $r3, 256+8*1 gcsrrd $r4, 0x1 // GCSR_PRMD st.d $r4, $r3, 256+8*2 gcsrrd $r4, 0x2 // GCSR_EUEN st.d $r4, $r3, 256+8*3 gcsrrd $r4, 0x3 // GCSR_MISC st.d $r4, $r3, 256+8*4 gcsrrd $r4, 0x4 // GCSR_ECTL st.d $r4, $r3, 256+8*5 gcsrrd $r4, 0x5 // GCSR_ESTAT st.d $r4, $r3, 256+8*6 gcsrrd $r4, 0x6 // GCSR_ERA st.d $r4, $r3, 256+8*7 gcsrrd $r4, 0x7 // GCSR_BADV st.d $r4, $r3, 256+8*8 gcsrrd $r4, 0x8 // GCSR_BADI st.d $r4, $r3, 256+8*9 // 调用 Rust 处理函数 move $r4, $r3 // 传递上下文指针 bl trap_handler // 恢复 guest CSR 寄存器 ld.d $r4, $r3, 256+8*1 gcsrwr $r4, 0x0 // GCSR_CRMD ld.d $r4, $r3, 256+8*2 gcsrwr $r4, 0x1 // GCSR_PRMD ld.d $r4, $r3, 256+8*3 gcsrwr $r4, 0x2 // GCSR_EUEN ld.d $r4, $r3, 256+8*4 gcsrwr $r4, 0x3 // GCSR_MISC ld.d $r4, $r3, 256+8*5 gcsrwr $r4, 0x4 // GCSR_ECTL ld.d $r4, $r3, 256+8*6 gcsrwr $r4, 0x5 // GCSR_ESTAT ld.d $r4, $r3, 256+8*7 gcsrwr $r4, 0x6 // GCSR_ERA ld.d $r4, $r3, 256+8*8 gcsrwr $r4, 0x7 // GCSR_BADV ld.d $r4, $r3, 256+8*9 gcsrwr $r4, 0x8 // GCSR_BADI // 恢复 host CSR 寄存器 ld.d $r4, $r3, 256 // ERA csrwr $r4, 0x6 // 恢复 host 通用寄存器 ld.d $r0, $r3, 0 ld.d $r1, $r3, 8 ld.d $r2, $r3, 16 ld.d $r4, $r3, 32 ld.d $r5, $r3, 40 ld.d $r6, $r3, 48 ld.d $r7, $r3, 56 ld.d $r8, $r3, 64 ld.d $r9, $r3, 72 ld.d $r10, $r3, 80 ld.d $r11, $r3, 88 ld.d $r12, $r3, 96 ld.d $r13, $r3, 104 ld.d $r14, $r3, 112 ld.d $r15, $r3, 120 ld.d $r16, $r3, 128 ld.d $r17, $r3, 136 ld.d $r18, $r3, 144 ld.d $r19, $r3, 152 ld.d $r20, $r3, 160 ld.d $r21, $r3, 168 ld.d $r22, $r3, 176 ld.d $r23, $r3, 184 ld.d $r24, $r3, 192 ld.d $r25, $r3, 200 ld.d $r26, $r3, 208 ld.d $r27, $r3, 216 ld.d $r28, $r3, 224 ld.d $r29, $r3, 232 ld.d $r30, $r3, 240 ld.d $r31, $r3, 248 // 恢复 r3 csrrd $r3, 0x502 ertn
Hexancer/loongarch64-axvisor
1,868
scripts/lds/linker.lds.S
OUTPUT_ARCH(%ARCH%) BASE_ADDRESS = %KERNEL_BASE%; ENTRY(_start) SECTIONS { . = BASE_ADDRESS; _skernel = .; .text : ALIGN(4K) { _stext = .; *(.text.boot) *(.text .text.*) . = ALIGN(4K); _etext = .; } .rodata : ALIGN(4K) { _srodata = .; *(.rodata .rodata.*) *(.srodata .srodata.*) *(.sdata2 .sdata2.*) . = ALIGN(4K); _erodata = .; } .data : ALIGN(4K) { _sdata = .; *(.data.boot_page_table) . = ALIGN(4K); *(.data .data.*) *(.sdata .sdata.*) *(.got .got.*) } .tdata : ALIGN(0x10) { _stdata = .; *(.tdata .tdata.*) _etdata = .; } .tbss : ALIGN(0x10) { _stbss = .; *(.tbss .tbss.*) *(.tcommon) _etbss = .; } . = ALIGN(4K); _percpu_start = .; _percpu_end = _percpu_start + SIZEOF(.percpu); .percpu 0x0 : AT(_percpu_start) { _percpu_load_start = .; *(.percpu .percpu.*) _percpu_load_end = .; . = _percpu_load_start + ALIGN(64) * %SMP%; } . = _percpu_end; . = ALIGN(4K); _edata = .; .bss : ALIGN(4K) { boot_stack = .; *(.bss.stack) . = ALIGN(4K); boot_stack_top = .; _sbss = .; *(.bss .bss.*) *(.sbss .sbss.*) *(COMMON) . = ALIGN(4K); _ebss = .; } _ekernel = .; /DISCARD/ : { *(.comment) *(.gnu*) *(.note*) *(.eh_frame*) } } SECTIONS { linkme_IRQ : { *(linkme_IRQ) } linkm2_IRQ : { *(linkm2_IRQ) } linkme_PAGE_FAULT : { *(linkme_PAGE_FAULT) } linkm2_PAGE_FAULT : { *(linkm2_PAGE_FAULT) } linkme_SYSCALL : { *(linkme_SYSCALL) } linkm2_SYSCALL : { *(linkm2_SYSCALL) } axns_resource : { *(axns_resource) } } INSERT AFTER .tbss;