repo_id
stringlengths
5
115
size
int64
590
5.01M
file_path
stringlengths
4
212
content
stringlengths
590
5.01M
Wangzhike/HIT-Linux-0.11
12,774
linux-0.11/kernel/chr_drv/keyboard.S
/* * linux/kernel/keyboard.S * * (C) 1991 Linus Torvalds */ /* * Thanks to Alfred Leung for US keyboard patches * Wolfgang Thiel for German keyboard patches * Marc Corsini for the French keyboard */ #include <linux/config.h> .text .globl keyboard_interrupt /* * these are for the keyboard read functions */ size = 1024 /* must be a power of two ! And MUST be the same as in tty_io.c !!!! */ head = 4 tail = 8 proc_list = 12 buf = 16 mode: .byte 0 /* caps, alt, ctrl and shift mode */ leds: .byte 2 /* num-lock, caps, scroll-lock mode (nom-lock on) */ e0: .byte 0 /* * con_int is the real interrupt routine that reads the * keyboard scan-code and converts it into the appropriate * ascii character(s). */ keyboard_interrupt: pushl %eax pushl %ebx pushl %ecx pushl %edx push %ds push %es movl $0x10,%eax mov %ax,%ds mov %ax,%es xor %al,%al /* %eax is scan code */ inb $0x60,%al cmpb $0xe0,%al je set_e0 cmpb $0xe1,%al je set_e1 call key_table(,%eax,4) movb $0,e0 e0_e1: inb $0x61,%al jmp 1f 1: jmp 1f 1: orb $0x80,%al jmp 1f 1: jmp 1f 1: outb %al,$0x61 jmp 1f 1: jmp 1f 1: andb $0x7F,%al outb %al,$0x61 movb $0x20,%al outb %al,$0x20 pushl $0 call do_tty_interrupt addl $4,%esp pop %es pop %ds popl %edx popl %ecx popl %ebx popl %eax iret set_e0: movb $1,e0 jmp e0_e1 set_e1: movb $2,e0 jmp e0_e1 /* * This routine fills the buffer with max 8 bytes, taken from * %ebx:%eax. (%edx is high). The bytes are written in the * order %al,%ah,%eal,%eah,%bl,%bh ... until %eax is zero. */ put_queue: pushl %ecx pushl %edx movl table_list,%edx # read-queue for console movl head(%edx),%ecx 1: movb %al,buf(%edx,%ecx) incl %ecx andl $size-1,%ecx cmpl tail(%edx),%ecx # buffer full - discard everything je 3f shrdl $8,%ebx,%eax je 2f shrl $8,%ebx jmp 1b 2: movl %ecx,head(%edx) movl proc_list(%edx),%ecx testl %ecx,%ecx je 3f movl $0,(%ecx) 3: popl %edx popl %ecx ret ctrl: movb $0x04,%al jmp 1f alt: movb $0x10,%al 1: cmpb $0,e0 je 2f addb %al,%al 2: orb %al,mode ret unctrl: movb $0x04,%al jmp 1f unalt: movb $0x10,%al 1: cmpb $0,e0 je 2f addb %al,%al 2: notb %al andb %al,mode ret lshift: orb $0x01,mode ret unlshift: andb $0xfe,mode ret rshift: orb $0x02,mode ret unrshift: andb $0xfd,mode ret caps: testb $0x80,mode jne 1f xorb $4,leds xorb $0x40,mode orb $0x80,mode set_leds: call kb_wait movb $0xed,%al /* set leds command */ outb %al,$0x60 call kb_wait movb leds,%al outb %al,$0x60 ret uncaps: andb $0x7f,mode ret scroll: xorb $1,leds jmp set_leds num: xorb $2,leds jmp set_leds /* * curosr-key/numeric keypad cursor keys are handled here. * checking for numeric keypad etc. */ cursor: subb $0x47,%al jb 1f cmpb $12,%al ja 1f jne cur2 /* check for ctrl-alt-del */ testb $0x0c,mode je cur2 testb $0x30,mode jne reboot cur2: cmpb $0x01,e0 /* e0 forces cursor movement */ je cur testb $0x02,leds /* not num-lock forces cursor */ je cur testb $0x03,mode /* shift forces cursor */ jne cur xorl %ebx,%ebx movb num_table(%eax),%al jmp put_queue 1: ret cur: movb cur_table(%eax),%al cmpb $'9,%al ja ok_cur movb $'~,%ah ok_cur: shll $16,%eax movw $0x5b1b,%ax xorl %ebx,%ebx jmp put_queue #if defined(KBD_FR) num_table: .ascii "789 456 1230." #else num_table: .ascii "789 456 1230," #endif cur_table: .ascii "HA5 DGC YB623" /* * this routine handles function keys */ func: pushl %eax pushl %ecx pushl %edx call show_stat popl %edx popl %ecx popl %eax subb $0x3B,%al jb end_func cmpb $9,%al jbe ok_func subb $18,%al cmpb $10,%al jb end_func cmpb $11,%al ja end_func ok_func: cmpl $4,%ecx /* check that there is enough room */ jl end_func movl func_table(,%eax,4),%eax xorl %ebx,%ebx jmp put_queue end_func: ret /* * function keys send F1:'esc [ [ A' F2:'esc [ [ B' etc. */ func_table: .long 0x415b5b1b,0x425b5b1b,0x435b5b1b,0x445b5b1b .long 0x455b5b1b,0x465b5b1b,0x475b5b1b,0x485b5b1b .long 0x495b5b1b,0x4a5b5b1b,0x4b5b5b1b,0x4c5b5b1b #if defined(KBD_FINNISH) key_map: .byte 0,27 .ascii "1234567890+'" .byte 127,9 .ascii "qwertyuiop}" .byte 0,13,0 .ascii "asdfghjkl|{" .byte 0,0 .ascii "'zxcvbnm,.-" .byte 0,'*,0,32 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte '-,0,0,0,'+ /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '< .fill 10,1,0 shift_map: .byte 0,27 .ascii "!\"#$%&/()=?`" .byte 127,9 .ascii "QWERTYUIOP]^" .byte 13,0 .ascii "ASDFGHJKL\\[" .byte 0,0 .ascii "*ZXCVBNM;:_" .byte 0,'*,0,32 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte '-,0,0,0,'+ /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '> .fill 10,1,0 alt_map: .byte 0,0 .ascii "\0@\0$\0\0{[]}\\\0" .byte 0,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte '~,13,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte 0,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte 0,0,0,0 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte 0,0,0,0,0 /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '| .fill 10,1,0 #elif defined(KBD_US) key_map: .byte 0,27 .ascii "1234567890-=" .byte 127,9 .ascii "qwertyuiop[]" .byte 13,0 .ascii "asdfghjkl;'" .byte '`,0 .ascii "\\zxcvbnm,./" .byte 0,'*,0,32 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte '-,0,0,0,'+ /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '< .fill 10,1,0 shift_map: .byte 0,27 .ascii "!@#$%^&*()_+" .byte 127,9 .ascii "QWERTYUIOP{}" .byte 13,0 .ascii "ASDFGHJKL:\"" .byte '~,0 .ascii "|ZXCVBNM<>?" .byte 0,'*,0,32 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte '-,0,0,0,'+ /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '> .fill 10,1,0 alt_map: .byte 0,0 .ascii "\0@\0$\0\0{[]}\\\0" .byte 0,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte '~,13,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte 0,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte 0,0,0,0 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte 0,0,0,0,0 /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '| .fill 10,1,0 #elif defined(KBD_GR) key_map: .byte 0,27 .ascii "1234567890\\'" .byte 127,9 .ascii "qwertzuiop@+" .byte 13,0 .ascii "asdfghjkl[]^" .byte 0,'# .ascii "yxcvbnm,.-" .byte 0,'*,0,32 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte '-,0,0,0,'+ /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '< .fill 10,1,0 shift_map: .byte 0,27 .ascii "!\"#$%&/()=?`" .byte 127,9 .ascii "QWERTZUIOP\\*" .byte 13,0 .ascii "ASDFGHJKL{}~" .byte 0,'' .ascii "YXCVBNM;:_" .byte 0,'*,0,32 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte '-,0,0,0,'+ /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '> .fill 10,1,0 alt_map: .byte 0,0 .ascii "\0@\0$\0\0{[]}\\\0" .byte 0,0 .byte '@,0,0,0,0,0,0,0,0,0,0 .byte '~,13,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte 0,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte 0,0,0,0 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte 0,0,0,0,0 /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '| .fill 10,1,0 #elif defined(KBD_FR) key_map: .byte 0,27 .ascii "&{\"'(-}_/@)=" .byte 127,9 .ascii "azertyuiop^$" .byte 13,0 .ascii "qsdfghjklm|" .byte '`,0,42 /* coin sup gauche, don't know, [*|mu] */ .ascii "wxcvbn,;:!" .byte 0,'*,0,32 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte '-,0,0,0,'+ /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '< .fill 10,1,0 shift_map: .byte 0,27 .ascii "1234567890]+" .byte 127,9 .ascii "AZERTYUIOP<>" .byte 13,0 .ascii "QSDFGHJKLM%" .byte '~,0,'# .ascii "WXCVBN?./\\" .byte 0,'*,0,32 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte '-,0,0,0,'+ /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '> .fill 10,1,0 alt_map: .byte 0,0 .ascii "\0~#{[|`\\^@]}" .byte 0,0 .byte '@,0,0,0,0,0,0,0,0,0,0 .byte '~,13,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte 0,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte 0,0,0,0 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte 0,0,0,0,0 /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '| .fill 10,1,0 #else #error "KBD-type not defined" #endif /* * do_self handles "normal" keys, ie keys that don't change meaning * and which have just one character returns. */ do_self: lea alt_map,%ebx testb $0x20,mode /* alt-gr */ jne 1f lea shift_map,%ebx testb $0x03,mode jne 1f lea key_map,%ebx 1: movb (%ebx,%eax),%al orb %al,%al je none testb $0x4c,mode /* ctrl or caps */ je 2f cmpb $'a,%al jb 2f cmpb $'},%al ja 2f subb $32,%al 2: testb $0x0c,mode /* ctrl */ je 3f cmpb $64,%al jb 3f cmpb $64+32,%al jae 3f subb $64,%al 3: testb $0x10,mode /* left alt */ je 4f orb $0x80,%al 4: andl $0xff,%eax xorl %ebx,%ebx call put_queue none: ret /* * minus has a routine of it's own, as a 'E0h' before * the scan code for minus means that the numeric keypad * slash was pushed. */ minus: cmpb $1,e0 jne do_self movl $'/,%eax xorl %ebx,%ebx jmp put_queue /* * This table decides which routine to call when a scan-code has been * gotten. Most routines just call do_self, or none, depending if * they are make or break. */ key_table: .long none,do_self,do_self,do_self /* 00-03 s0 esc 1 2 */ .long do_self,do_self,do_self,do_self /* 04-07 3 4 5 6 */ .long do_self,do_self,do_self,do_self /* 08-0B 7 8 9 0 */ .long do_self,do_self,do_self,do_self /* 0C-0F + ' bs tab */ .long do_self,do_self,do_self,do_self /* 10-13 q w e r */ .long do_self,do_self,do_self,do_self /* 14-17 t y u i */ .long do_self,do_self,do_self,do_self /* 18-1B o p } ^ */ .long do_self,ctrl,do_self,do_self /* 1C-1F enter ctrl a s */ .long do_self,do_self,do_self,do_self /* 20-23 d f g h */ .long do_self,do_self,do_self,do_self /* 24-27 j k l | */ .long do_self,do_self,lshift,do_self /* 28-2B { para lshift , */ .long do_self,do_self,do_self,do_self /* 2C-2F z x c v */ .long do_self,do_self,do_self,do_self /* 30-33 b n m , */ .long do_self,minus,rshift,do_self /* 34-37 . - rshift * */ .long alt,do_self,caps,func /* 38-3B alt sp caps f1 */ .long func,func,func,func /* 3C-3F f2 f3 f4 f5 */ .long func,func,func,func /* 40-43 f6 f7 f8 f9 */ .long func,num,scroll,cursor /* 44-47 f10 num scr home */ .long cursor,cursor,do_self,cursor /* 48-4B up pgup - left */ .long cursor,cursor,do_self,cursor /* 4C-4F n5 right + end */ .long cursor,cursor,cursor,cursor /* 50-53 dn pgdn ins del */ .long none,none,do_self,func /* 54-57 sysreq ? < f11 */ .long func,none,none,none /* 58-5B f12 ? ? ? */ .long none,none,none,none /* 5C-5F ? ? ? ? */ .long none,none,none,none /* 60-63 ? ? ? ? */ .long none,none,none,none /* 64-67 ? ? ? ? */ .long none,none,none,none /* 68-6B ? ? ? ? */ .long none,none,none,none /* 6C-6F ? ? ? ? */ .long none,none,none,none /* 70-73 ? ? ? ? */ .long none,none,none,none /* 74-77 ? ? ? ? */ .long none,none,none,none /* 78-7B ? ? ? ? */ .long none,none,none,none /* 7C-7F ? ? ? ? */ .long none,none,none,none /* 80-83 ? br br br */ .long none,none,none,none /* 84-87 br br br br */ .long none,none,none,none /* 88-8B br br br br */ .long none,none,none,none /* 8C-8F br br br br */ .long none,none,none,none /* 90-93 br br br br */ .long none,none,none,none /* 94-97 br br br br */ .long none,none,none,none /* 98-9B br br br br */ .long none,unctrl,none,none /* 9C-9F br unctrl br br */ .long none,none,none,none /* A0-A3 br br br br */ .long none,none,none,none /* A4-A7 br br br br */ .long none,none,unlshift,none /* A8-AB br br unlshift br */ .long none,none,none,none /* AC-AF br br br br */ .long none,none,none,none /* B0-B3 br br br br */ .long none,none,unrshift,none /* B4-B7 br br unrshift br */ .long unalt,none,uncaps,none /* B8-BB unalt br uncaps br */ .long none,none,none,none /* BC-BF br br br br */ .long none,none,none,none /* C0-C3 br br br br */ .long none,none,none,none /* C4-C7 br br br br */ .long none,none,none,none /* C8-CB br br br br */ .long none,none,none,none /* CC-CF br br br br */ .long none,none,none,none /* D0-D3 br br br br */ .long none,none,none,none /* D4-D7 br br br br */ .long none,none,none,none /* D8-DB br ? ? ? */ .long none,none,none,none /* DC-DF ? ? ? ? */ .long none,none,none,none /* E0-E3 e0 e1 ? ? */ .long none,none,none,none /* E4-E7 ? ? ? ? */ .long none,none,none,none /* E8-EB ? ? ? ? */ .long none,none,none,none /* EC-EF ? ? ? ? */ .long none,none,none,none /* F0-F3 ? ? ? ? */ .long none,none,none,none /* F4-F7 ? ? ? ? */ .long none,none,none,none /* F8-FB ? ? ? ? */ .long none,none,none,none /* FC-FF ? ? ? ? */ /* * kb_wait waits for the keyboard controller buffer to empty. * there is no timeout - if the buffer doesn't empty, we hang. */ kb_wait: pushl %eax 1: inb $0x64,%al testb $0x02,%al jne 1b popl %eax ret /* * This routine reboots the machine by asking the keyboard * controller to pulse the reset-line low. */ reboot: call kb_wait movw $0x1234,0x472 /* don't do memory check */ movb $0xfc,%al /* pulse reset and A20 low */ outb %al,$0x64 die: jmp die
Wangzhike/HIT-Linux-0.11
6,672
linux-0.11/kernel/chr_drv/keyboard.s
# 1 "keyboard.S" # 1 "/home/qiuyu/oslab/linux-0.11/kernel/chr_drv//" # 1 "<built-in>" # 1 "<command line>" # 1 "keyboard.S" # 1 "../../include/linux/config.h" 1 # 36 "../../include/linux/config.h" # 47 "../../include/linux/config.h" # 14 "keyboard.S" 2 .text .globl keyboard_interrupt size = 1024 head = 4 tail = 8 proc_list = 12 buf = 16 mode: .byte 0 leds: .byte 2 e0: .byte 0 keyboard_interrupt: pushl %eax pushl %ebx pushl %ecx pushl %edx push %ds push %es movl $0x10,%eax mov %ax,%ds mov %ax,%es xor %al,%al inb $0x60,%al cmpb $0xe0,%al je set_e0 cmpb $0xe1,%al je set_e1 call key_table(,%eax,4) movb $0,e0 e0_e1: inb $0x61,%al jmp 1f 1: jmp 1f 1: orb $0x80,%al jmp 1f 1: jmp 1f 1: outb %al,$0x61 jmp 1f 1: jmp 1f 1: andb $0x7F,%al outb %al,$0x61 movb $0x20,%al outb %al,$0x20 pushl $0 call do_tty_interrupt addl $4,%esp pop %es pop %ds popl %edx popl %ecx popl %ebx popl %eax iret set_e0: movb $1,e0 jmp e0_e1 set_e1: movb $2,e0 jmp e0_e1 put_queue: pushl %ecx pushl %edx movl table_list,%edx # read-queue for console movl head(%edx),%ecx 1: movb %al,buf(%edx,%ecx) incl %ecx andl $size-1,%ecx cmpl tail(%edx),%ecx # buffer full - discard everything je 3f shrdl $8,%ebx,%eax je 2f shrl $8,%ebx jmp 1b 2: movl %ecx,head(%edx) movl proc_list(%edx),%ecx testl %ecx,%ecx je 3f movl $0,(%ecx) 3: popl %edx popl %ecx ret ctrl: movb $0x04,%al jmp 1f alt: movb $0x10,%al 1: cmpb $0,e0 je 2f addb %al,%al 2: orb %al,mode ret unctrl: movb $0x04,%al jmp 1f unalt: movb $0x10,%al 1: cmpb $0,e0 je 2f addb %al,%al 2: notb %al andb %al,mode ret lshift: orb $0x01,mode ret unlshift: andb $0xfe,mode ret rshift: orb $0x02,mode ret unrshift: andb $0xfd,mode ret caps: testb $0x80,mode jne 1f xorb $4,leds xorb $0x40,mode orb $0x80,mode set_leds: call kb_wait movb $0xed,%al outb %al,$0x60 call kb_wait movb leds,%al outb %al,$0x60 ret uncaps: andb $0x7f,mode ret scroll: xorb $1,leds jmp set_leds num: xorb $2,leds jmp set_leds cursor: subb $0x47,%al jb 1f cmpb $12,%al ja 1f jne cur2 testb $0x0c,mode je cur2 testb $0x30,mode jne reboot cur2: cmpb $0x01,e0 je cur testb $0x02,leds je cur testb $0x03,mode jne cur xorl %ebx,%ebx movb num_table(%eax),%al jmp put_queue 1: ret cur: movb cur_table(%eax),%al cmpb $'9,%al ja ok_cur movb $'~,%ah ok_cur: shll $16,%eax movw $0x5b1b,%ax xorl %ebx,%ebx jmp put_queue num_table: .ascii "789 456 1230," cur_table: .ascii "HA5 DGC YB623" func: pushl %eax pushl %ecx pushl %edx call show_stat popl %edx popl %ecx popl %eax subb $0x3B,%al jb end_func cmpb $9,%al jbe ok_func subb $18,%al cmpb $10,%al jb end_func cmpb $11,%al ja end_func ok_func: cmpl $4,%ecx jl end_func movl func_table(,%eax,4),%eax xorl %ebx,%ebx jmp put_queue end_func: ret func_table: .long 0x415b5b1b,0x425b5b1b,0x435b5b1b,0x445b5b1b .long 0x455b5b1b,0x465b5b1b,0x475b5b1b,0x485b5b1b .long 0x495b5b1b,0x4a5b5b1b,0x4b5b5b1b,0x4c5b5b1b # 294 "keyboard.S" key_map: .byte 0,27 .ascii "1234567890-=" .byte 127,9 .ascii "qwertyuiop[]" .byte 13,0 .ascii "asdfghjkl;'" .byte '`,0 .ascii "\\zxcvbnm,./" .byte 0,'*,0,32 /* 36-39 */ .fill 16,1,0 .byte '-,0,0,0,'+ .byte 0,0,0,0,0,0,0 .byte '< .fill 10,1,0 shift_map: .byte 0,27 .ascii "!@#$%^&*()_+" .byte 127,9 .ascii "QWERTYUIOP{}" .byte 13,0 .ascii "ASDFGHJKL:\"" .byte '~,0 .ascii "|ZXCVBNM<>?" .byte 0,'*,0,32 /* 36-39 */ .fill 16,1,0 .byte '-,0,0,0,'+ .byte 0,0,0,0,0,0,0 .byte '> .fill 10,1,0 alt_map: .byte 0,0 .ascii "\0@\0$\0\0{[]}\\\0" .byte 0,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte '~,13,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte 0,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte 0,0,0,0 .fill 16,1,0 .byte 0,0,0,0,0 .byte 0,0,0,0,0,0,0 .byte '| .fill 10,1,0 # 449 "keyboard.S" do_self: lea alt_map,%ebx testb $0x20,mode jne 1f lea shift_map,%ebx testb $0x03,mode jne 1f lea key_map,%ebx 1: movb (%ebx,%eax),%al orb %al,%al je none testb $0x4c,mode je 2f cmpb $'a,%al jb 2f cmpb $'},%al ja 2f subb $32,%al 2: testb $0x0c,mode je 3f cmpb $64,%al jb 3f cmpb $64+32,%al jae 3f subb $64,%al 3: testb $0x10,mode je 4f orb $0x80,%al 4: andl $0xff,%eax xorl %ebx,%ebx call put_queue none: ret minus: cmpb $1,e0 jne do_self movl $'/,%eax xorl %ebx,%ebx jmp put_queue key_table: .long none,do_self,do_self,do_self .long do_self,do_self,do_self,do_self .long do_self,do_self,do_self,do_self .long do_self,do_self,do_self,do_self .long do_self,do_self,do_self,do_self .long do_self,do_self,do_self,do_self .long do_self,do_self,do_self,do_self .long do_self,ctrl,do_self,do_self .long do_self,do_self,do_self,do_self .long do_self,do_self,do_self,do_self .long do_self,do_self,lshift,do_self .long do_self,do_self,do_self,do_self .long do_self,do_self,do_self,do_self .long do_self,minus,rshift,do_self .long alt,do_self,caps,func .long func,func,func,func .long func,func,func,func .long func,num,scroll,cursor .long cursor,cursor,do_self,cursor .long cursor,cursor,do_self,cursor .long cursor,cursor,cursor,cursor .long none,none,do_self,func .long func,none,none,none .long none,none,none,none .long none,none,none,none .long none,none,none,none .long none,none,none,none .long none,none,none,none .long none,none,none,none .long none,none,none,none .long none,none,none,none .long none,none,none,none .long none,none,none,none .long none,none,none,none .long none,none,none,none .long none,none,none,none .long none,none,none,none .long none,none,none,none .long none,none,none,none .long none,unctrl,none,none .long none,none,none,none .long none,none,none,none .long none,none,unlshift,none .long none,none,none,none .long none,none,none,none .long none,none,unrshift,none .long unalt,none,uncaps,none .long none,none,none,none .long none,none,none,none .long none,none,none,none .long none,none,none,none .long none,none,none,none .long none,none,none,none .long none,none,none,none .long none,none,none,none .long none,none,none,none .long none,none,none,none .long none,none,none,none .long none,none,none,none .long none,none,none,none .long none,none,none,none .long none,none,none,none .long none,none,none,none .long none,none,none,none kb_wait: pushl %eax 1: inb $0x64,%al testb $0x02,%al jne 1b popl %eax ret reboot: call kb_wait movw $0x1234,0x472 movb $0xfc,%al outb %al,$0x64 die: jmp die
Wangzhike/HIT-Linux-0.11
5,473
3-processTrack/linux-0.11/boot/bootsect.s
! ! SYS_SIZE is the number of clicks (16 bytes) to be loaded. ! 0x3000 is 0x30000 bytes = 196kB, more than enough for current ! versions of linux ! SYSSIZE = 0x3000 ! ! bootsect.s (C) 1991 Linus Torvalds ! ! bootsect.s is loaded at 0x7c00 by the bios-startup routines, and moves ! iself out of the way to address 0x90000, and jumps there. ! ! It then loads 'setup' directly after itself (0x90200), and the system ! at 0x10000, using BIOS interrupts. ! ! NOTE! currently system is at most 8*65536 bytes long. This should be no ! problem, even in the future. I want to keep it simple. This 512 kB ! kernel size should be enough, especially as this doesn't contain the ! buffer cache as in minix ! ! The loader has been made as simple as possible, and continuos ! read errors will result in a unbreakable loop. Reboot by hand. It ! loads pretty fast by getting whole sectors at a time whenever possible. .globl begtext, begdata, begbss, endtext, enddata, endbss .text begtext: .data begdata: .bss begbss: .text SETUPLEN = 4 ! nr of setup-sectors BOOTSEG = 0x07c0 ! original address of boot-sector INITSEG = 0x9000 ! we move boot here - out of the way SETUPSEG = 0x9020 ! setup starts here SYSSEG = 0x1000 ! system loaded at 0x10000 (65536). ENDSEG = SYSSEG + SYSSIZE ! where to stop loading ! ROOT_DEV: 0x000 - same type of floppy as boot. ! 0x301 - first partition on first drive etc ROOT_DEV = 0x306 entry _start _start: mov ax,#BOOTSEG mov ds,ax mov ax,#INITSEG mov es,ax mov cx,#256 sub si,si sub di,di rep movw jmpi go,INITSEG go: mov ax,cs mov ds,ax mov es,ax ! put stack at 0x9ff00. mov ss,ax mov sp,#0xFF00 ! arbitrary value >>512 ! load the setup-sectors directly after the bootblock. ! Note that 'es' is already set up. load_setup: mov dx,#0x0000 ! drive 0, head 0 mov cx,#0x0002 ! sector 2, track 0 mov bx,#0x0200 ! address = 512, in INITSEG mov ax,#0x0200+SETUPLEN ! service 2, nr of sectors int 0x13 ! read it jnc ok_load_setup ! ok - continue mov dx,#0x0000 mov ax,#0x0000 ! reset the diskette int 0x13 j load_setup ok_load_setup: ! Get disk drive parameters, specifically nr of sectors/track mov dl,#0x00 mov ax,#0x0800 ! AH=8 is get drive parameters int 0x13 mov ch,#0x00 seg cs mov sectors,cx mov ax,#INITSEG mov es,ax ! Print some inane message call read_cursor mov cx,#2 mov bx,#0x0007 ! page 0, attribute 7 (normal, white color) mov bp,#msg1 mov ax,#0x1301 ! write string, move cursor int 0x10 call read_cursor mov cx, #6 mov bx, #0x0009 ! page 0, attribute 9(bright blue color) mov bp, #msg1+2 mov ax, #0x1301 ! write string, move cursor int 0x10 call read_cursor mov cx, #18 mov bx, #0x0007 ! page 0, attribute 7(normal, white color) mov bp, #msg1+8 mov ax, #0x1301 ! write string, move cursor int 0x10 ! ok, we've written the message, now ! we want to load the system (at 0x10000) mov ax,#SYSSEG mov es,ax ! segment of 0x010000 call read_it call kill_motor ! After that we check which root-device to use. If the device is ! defined (!= 0), nothing is done and the given device is used. ! Otherwise, either /dev/PS0 (2,28) or /dev/at0 (2,8), depending ! on the number of sectors that the BIOS reports currently. seg cs mov ax,root_dev cmp ax,#0 jne root_defined seg cs mov bx,sectors mov ax,#0x0208 ! /dev/ps0 - 1.2Mb cmp bx,#15 je root_defined mov ax,#0x021c ! /dev/PS0 - 1.44Mb cmp bx,#18 je root_defined undef_root: jmp undef_root root_defined: seg cs mov root_dev,ax ! after that (everyting loaded), we jump to ! the setup-routine loaded directly after ! the bootblock: jmpi 0,SETUPSEG ! This routine loads the system at address 0x10000, making sure ! no 64kB boundaries are crossed. We try to load it as fast as ! possible, loading whole tracks whenever we can. ! ! in: es - starting address segment (normally 0x1000) ! sread: .word 1+SETUPLEN ! sectors read of current track head: .word 0 ! current head track: .word 0 ! current track read_it: mov ax,es test ax,#0x0fff die: jne die ! es must be at 64kB boundary xor bx,bx ! bx is starting address within segment rp_read: mov ax,es cmp ax,#ENDSEG ! have we loaded all yet? jb ok1_read ret ok1_read: seg cs mov ax,sectors sub ax,sread mov cx,ax shl cx,#9 add cx,bx jnc ok2_read je ok2_read xor ax,ax sub ax,bx shr ax,#9 ok2_read: call read_track mov cx,ax add ax,sread seg cs cmp ax,sectors jne ok3_read mov ax,#1 sub ax,head jne ok4_read inc track ok4_read: mov head,ax xor ax,ax ok3_read: mov sread,ax shl cx,#9 add bx,cx jnc rp_read mov ax,es add ax,#0x1000 mov es,ax xor bx,bx jmp rp_read read_track: push ax push bx push cx push dx mov dx,track mov cx,sread inc cx mov ch,dl mov dx,head mov dh,dl mov dl,#0 and dx,#0x0100 mov ah,#2 int 0x13 jc bad_rt pop dx pop cx pop bx pop ax ret bad_rt: mov ax,#0 mov dx,#0 int 0x13 pop dx pop cx pop bx pop ax jmp read_track read_cursor: push ax push bx mov ah,#0x03 ! read cursor pos xor bh,bh int 0x10 pop bx pop ax ret !/* ! * This procedure turns off the floppy drive motor, so ! * that we enter the kernel in a known state, and ! * don't have to worry about it later. ! */ kill_motor: push dx mov dx,#0x3f2 mov al,#0 outb pop dx ret sectors: .word 0 msg1: .byte 13,10 .ascii "Qiunix is loading..." .byte 13,10,13,10 .org 508 root_dev: .word ROOT_DEV boot_flag: .word 0xAA55 .text endtext: .data enddata: .bss endbss:
Wangzhike/HIT-Linux-0.11
8,626
3-processTrack/linux-0.11/boot/setup.s
! ! setup.s (C) 1991 Linus Torvalds ! ! setup.s is responsible for getting the system data from the BIOS, ! and putting them into the appropriate places in system memory. ! both setup.s and system has been loaded by the bootblock. ! ! This code asks the bios for memory/disk/other parameters, and ! puts them in a "safe" place: 0x90000-0x901FF, ie where the ! boot-block used to be. It is then up to the protected mode ! system to read them from there before the area is overwritten ! for buffer-blocks. ! ! NOTE! These had better be the same as in bootsect.s! INITSEG = 0x9000 ! we move boot here - out of the way SYSSEG = 0x1000 ! system loaded at 0x10000 (65536). SETUPSEG = 0x9020 ! this is the current segment .globl begtext, begdata, begbss, endtext, enddata, endbss .text begtext: .data begdata: .bss begbss: .text entry start start: ! repeat set stack, although it is done in bootsect.s mov ax, #INITSEG mov ss, ax mov sp, #0xFF00 ! now we are in setup ,print the message. mov ax, #SETUPSEG mov es, ax call read_cursor mov cx, #14 mov bx, #0x0007 ! page 0, attribute 10(bright green) mov bp, #msg mov ax, #0x1301 ! write string, move cursor int 0x10 call read_cursor mov cx, #5 mov bx, #0x000a ! page 0, attribute 7(normal, white color) mov bp, #msg+14 mov ax, #0x1301 int 0x10 call print_nl call print_nl ! ok, the read went well so we get current cursor position and save it for ! posterity. mov ax,#INITSEG ! this is done in bootsect already, but... mov ds,ax mov ah,#0x03 ! read cursor pos xor bh,bh int 0x10 ! save it in known place, con_init fetches mov [0],dx ! it from 0x90000. ! Get memory size (extended mem, kB) mov ax, #INITSEG ! this is done in bootsect already, but... mov ds, ax mov ah,#0x88 int 0x15 mov [2],ax ! Get video-card data: mov ah,#0x0f int 0x10 mov [4],bx ! bh = display page mov [6],ax ! al = video mode, ah = window width ! check for EGA/VGA and some config parameters mov ah,#0x12 mov bl,#0x10 int 0x10 mov [8],ax mov [10],bx mov [12],cx ! Get hd0 data mov ax,#0x0000 mov ds,ax lds si,[4*0x41] mov ax,#INITSEG mov es,ax mov di,#0x0080 mov cx,#0x10 rep movsb ! Get hd1 data mov ax,#0x0000 mov ds,ax lds si,[4*0x46] mov ax,#INITSEG mov es,ax mov di,#0x0090 mov cx,#0x10 rep movsb ! Check that there IS a hd1 :-) mov ax,#0x01500 mov dl,#0x81 int 0x13 jc no_disk1 cmp ah,#3 je is_disk1 no_disk1: mov ax,#INITSEG mov es,ax mov di,#0x0090 mov cx,#0x10 mov ax,#0x00 rep stosb is_disk1: ! now, we have read some system parameters, print thees parameters. mov ax, #INITSEG mov ds, ax mov ax, #SETUPSEG mov es, ax ! print cursor position call read_cursor mov cx, #17 mov bx, #0x000a ! page 0, attribute 10(normal, bright gren color) mov bp, #cursor mov ax, #0x1301 int 0x10 mov bp, #0x0000 call print_hex call print_nl ! print memory size call read_cursor mov cx, #13 mov bx, #0x000a ! page 0, attribue 10(normal, bright green color) mov bp, #memory mov ax, #0x1301 int 0x10 mov ax, [2] add ax, #1024 mov memsize, ax mov bp, #memsize call print_hex call read_cursor mov cx, #2 mov bx, #0x0007 mov bp, #memory+13 mov ax, #0x1301 int 0x10 call print_nl ! print hd0 cylinders call read_cursor mov cx, #15 mov bx, #0x000a ! page 0, attribute 10(normal, bright green color) mov bp, #cylinder mov ax, #0x1301 int 0x10 call read_cursor mov bp, #0x0080 call print_hex call print_nl ! print hd0 heads call read_cursor mov cx, #11 mov bx, #0x000a ! page 0, attribute 10(normal, bright green color) mov bp, #head mov ax, #0x1301 int 0x10 mov bp, #0x0082 call print_hex call print_nl ! print hd0 sectors call read_cursor mov cx, #13 mov bx, #0x000a ! page 0, attribute 10(normal, bright green color) mov bp, #sector mov ax, #0x1301 int 0x10 mov bp, #0x008E call print_hex call print_nl call print_nl ! ok, the read went well so we get current cursor position and save it for ! posterity. mov ax,#INITSEG ! this is done in bootsect already, but... mov ds,ax mov ah,#0x03 ! read cursor pos xor bh,bh int 0x10 ! save it in known place, con_init fetches mov [0],dx ! it from 0x90000. ! Get video-card data: mov ah,#0x0f int 0x10 mov [4],bx ! bh = display page mov [6],ax ! al = video mode, ah = window width ! now we want to move to protected mode ... cli ! no interrupts allowed ! ! first we move the system to it's rightful place mov ax,#0x0000 cld ! 'direction'=0, movs moves forward do_move: mov es,ax ! destination segment add ax,#0x1000 cmp ax,#0x9000 jz end_move mov ds,ax ! source segment sub di,di sub si,si mov cx,#0x8000 rep movsw jmp do_move ! then we load the segment descriptors end_move: mov ax,#SETUPSEG ! right, forgot this at first. didn't work :-) mov ds,ax lidt idt_48 ! load idt with 0,0 lgdt gdt_48 ! load gdt with whatever appropriate ! that was painless, now we enable A20 call empty_8042 mov al,#0xD1 ! command write out #0x64,al call empty_8042 mov al,#0xDF ! A20 on out #0x60,al call empty_8042 ! well, that went ok, I hope. Now we have to reprogram the interrupts :-( ! we put them right after the intel-reserved hardware interrupts, at ! int 0x20-0x2F. There they won't mess up anything. Sadly IBM really ! messed this up with the original PC, and they haven't been able to ! rectify it afterwards. Thus the bios puts interrupts at 0x08-0x0f, ! which is used for the internal hardware interrupts as well. We just ! have to reprogram the 8259's, and it isn't fun. mov al,#0x11 ! initialization sequence out #0x20,al ! send it to 8259A-1 .word 0x00eb,0x00eb ! jmp $+2, jmp $+2 out #0xA0,al ! and to 8259A-2 .word 0x00eb,0x00eb mov al,#0x20 ! start of hardware int's (0x20) out #0x21,al .word 0x00eb,0x00eb mov al,#0x28 ! start of hardware int's 2 (0x28) out #0xA1,al .word 0x00eb,0x00eb mov al,#0x04 ! 8259-1 is master out #0x21,al .word 0x00eb,0x00eb mov al,#0x02 ! 8259-2 is slave out #0xA1,al .word 0x00eb,0x00eb mov al,#0x01 ! 8086 mode for both out #0x21,al .word 0x00eb,0x00eb out #0xA1,al .word 0x00eb,0x00eb mov al,#0xFF ! mask off all interrupts for now out #0x21,al .word 0x00eb,0x00eb out #0xA1,al ! well, that certainly wasn't fun :-(. Hopefully it works, and we don't ! need no steenking BIOS anyway (except for the initial loading :-). ! The BIOS-routine wants lots of unnecessary data, and it's less ! "interesting" anyway. This is how REAL programmers do it. ! ! Well, now's the time to actually move into protected mode. To make ! things as simple as possible, we do no register set-up or anything, ! we let the gnu-compiled 32-bit programs do that. We just jump to ! absolute address 0x00000, in 32-bit protected mode. mov ax,#0x0001 ! protected mode (PE) bit lmsw ax ! This is it! jmpi 0,8 ! jmp offset 0 of segment 8 (cs) ! This routine checks that the keyboard command queue is empty ! No timeout is used - if this hangs there is something wrong with ! the machine, and we probably couldn't proceed anyway. empty_8042: .word 0x00eb,0x00eb in al,#0x64 ! 8042 status port test al,#2 ! is input buffer full? jnz empty_8042 ! yes - loop ret !以16进制方式打印栈顶的16位数 print_hex: push ax push bx push cx push dx mov ax, #0x0e30 ! 0 int 0x10 mov ax, #0x0e78 ! x int 0x10 mov cx, #4 mov dx, (bp) print_digit: rol dx, #4 mov ax, #0x0e0f mov bl, #0x0f ! bright green color and al, dl add al,#0x30 cmp al, #0x3a jl outp ! if less,是一个不大于9的数字 add al, #0x07 ! 是a~f,要加7 outp: int 0x10 loop print_digit pop dx pop cx pop bx pop ax ret print_nl: push ax push bx mov ax, #0x0e0d ! CR int 0x10 mov ax, #0x0e0A ! LR int 0x10 pop bx pop ax ret read_cursor: push ax push bx push cx mov ah, #0x03 ! read cursor pos xor bh, bh int 0x10 pop cx pop bx pop ax ret gdt: .word 0,0,0,0 ! dummy .word 0x07FF ! 8Mb - limit=2047 (2048*4096=8Mb) .word 0x0000 ! base address=0 .word 0x9A00 ! code read/exec .word 0x00C0 ! granularity=4096, 386 .word 0x07FF ! 8Mb - limit=2047 (2048*4096=8Mb) .word 0x0000 ! base address=0 .word 0x9200 ! data read/write .word 0x00C0 ! granularity=4096, 386 idt_48: .word 0 ! idt limit=0 .word 0,0 ! idt base=0L gdt_48: .word 0x800 ! gdt limit=2048, 256 GDT entries .word 512+gdt,0x9 ! gdt base = 0X9xxxx msg: .ascii "Now we are in SETUP" cursor: .ascii "Cursor Position: " .ascii "KB" memory: .ascii "Memory Size: KB" cylinder: .ascii "HD0 cylinders: " head: .ascii "HD0 heads: " sector: .ascii "HD0 sectors: " memsize: .word 0x0000 .text endtext: .data enddata: .bss endbss:
Wangzhike/HIT-Linux-0.11
5,938
3-processTrack/linux-0.11/boot/head.s
/* * linux/boot/head.s * * (C) 1991 Linus Torvalds */ /* * head.s contains the 32-bit startup code. * * NOTE!!! Startup happens at absolute address 0x00000000, which is also where * the page directory will exist. The startup code will be overwritten by * the page directory. */ .text .globl idt,gdt,pg_dir,tmp_floppy_area pg_dir: .globl startup_32 startup_32: movl $0x10,%eax mov %ax,%ds mov %ax,%es mov %ax,%fs mov %ax,%gs lss stack_start,%esp call setup_idt call setup_gdt movl $0x10,%eax # reload all the segment registers mov %ax,%ds # after changing gdt. CS was already mov %ax,%es # reloaded in 'setup_gdt' mov %ax,%fs mov %ax,%gs lss stack_start,%esp xorl %eax,%eax 1: incl %eax # check that A20 really IS enabled movl %eax,0x000000 # loop forever if it isn't cmpl %eax,0x100000 je 1b /* * NOTE! 486 should set bit 16, to check for write-protect in supervisor * mode. Then it would be unnecessary with the "verify_area()"-calls. * 486 users probably want to set the NE (#5) bit also, so as to use * int 16 for math errors. */ movl %cr0,%eax # check math chip andl $0x80000011,%eax # Save PG,PE,ET /* "orl $0x10020,%eax" here for 486 might be good */ orl $2,%eax # set MP movl %eax,%cr0 call check_x87 jmp after_page_tables /* * We depend on ET to be correct. This checks for 287/387. */ check_x87: fninit fstsw %ax cmpb $0,%al je 1f /* no coprocessor: have to set bits */ movl %cr0,%eax xorl $6,%eax /* reset MP, set EM */ movl %eax,%cr0 ret .align 2 1: .byte 0xDB,0xE4 /* fsetpm for 287, ignored by 387 */ ret /* * setup_idt * * sets up a idt with 256 entries pointing to * ignore_int, interrupt gates. It then loads * idt. Everything that wants to install itself * in the idt-table may do so themselves. Interrupts * are enabled elsewhere, when we can be relatively * sure everything is ok. This routine will be over- * written by the page tables. */ setup_idt: lea ignore_int,%edx movl $0x00080000,%eax movw %dx,%ax /* selector = 0x0008 = cs */ movw $0x8E00,%dx /* interrupt gate - dpl=0, present */ lea idt,%edi mov $256,%ecx rp_sidt: movl %eax,(%edi) movl %edx,4(%edi) addl $8,%edi dec %ecx jne rp_sidt lidt idt_descr ret /* * setup_gdt * * This routines sets up a new gdt and loads it. * Only two entries are currently built, the same * ones that were built in init.s. The routine * is VERY complicated at two whole lines, so this * rather long comment is certainly needed :-). * This routine will beoverwritten by the page tables. */ setup_gdt: lgdt gdt_descr ret /* * I put the kernel page tables right after the page directory, * using 4 of them to span 16 Mb of physical memory. People with * more than 16MB will have to expand this. */ .org 0x1000 pg0: .org 0x2000 pg1: .org 0x3000 pg2: .org 0x4000 pg3: .org 0x5000 /* * tmp_floppy_area is used by the floppy-driver when DMA cannot * reach to a buffer-block. It needs to be aligned, so that it isn't * on a 64kB border. */ tmp_floppy_area: .fill 1024,1,0 after_page_tables: pushl $0 # These are the parameters to main :-) pushl $0 pushl $0 pushl $L6 # return address for main, if it decides to. pushl $main jmp setup_paging L6: jmp L6 # main should never return here, but # just in case, we know what happens. /* This is the default interrupt "handler" :-) */ int_msg: .asciz "Unknown interrupt\n\r" .align 2 ignore_int: pushl %eax pushl %ecx pushl %edx push %ds push %es push %fs movl $0x10,%eax mov %ax,%ds mov %ax,%es mov %ax,%fs pushl $int_msg call printk popl %eax pop %fs pop %es pop %ds popl %edx popl %ecx popl %eax iret /* * Setup_paging * * This routine sets up paging by setting the page bit * in cr0. The page tables are set up, identity-mapping * the first 16MB. The pager assumes that no illegal * addresses are produced (ie >4Mb on a 4Mb machine). * * NOTE! Although all physical memory should be identity * mapped by this routine, only the kernel page functions * use the >1Mb addresses directly. All "normal" functions * use just the lower 1Mb, or the local data space, which * will be mapped to some other place - mm keeps track of * that. * * For those with more memory than 16 Mb - tough luck. I've * not got it, why should you :-) The source is here. Change * it. (Seriously - it shouldn't be too difficult. Mostly * change some constants etc. I left it at 16Mb, as my machine * even cannot be extended past that (ok, but it was cheap :-) * I've tried to show which constants to change by having * some kind of marker at them (search for "16Mb"), but I * won't guarantee that's all :-( ) */ .align 2 setup_paging: movl $1024*5,%ecx /* 5 pages - pg_dir+4 page tables */ xorl %eax,%eax xorl %edi,%edi /* pg_dir is at 0x000 */ cld;rep;stosl movl $pg0+7,pg_dir /* set present bit/user r/w */ movl $pg1+7,pg_dir+4 /* --------- " " --------- */ movl $pg2+7,pg_dir+8 /* --------- " " --------- */ movl $pg3+7,pg_dir+12 /* --------- " " --------- */ movl $pg3+4092,%edi movl $0xfff007,%eax /* 16Mb - 4096 + 7 (r/w user,p) */ std 1: stosl /* fill pages backwards - more efficient :-) */ subl $0x1000,%eax jge 1b xorl %eax,%eax /* pg_dir is at 0x0000 */ movl %eax,%cr3 /* cr3 - page directory start */ movl %cr0,%eax orl $0x80000000,%eax movl %eax,%cr0 /* set paging (PG) bit */ ret /* this also flushes prefetch-queue */ .align 2 .word 0 idt_descr: .word 256*8-1 # idt contains 256 entries .long idt .align 2 .word 0 gdt_descr: .word 256*8-1 # so does gdt (not that that's any .long gdt # magic number, but it works for me :^) .align 8 idt: .fill 256,8,0 # idt is uninitialized gdt: .quad 0x0000000000000000 /* NULL descriptor */ .quad 0x00c09a0000000fff /* 16Mb */ .quad 0x00c0920000000fff /* 16Mb */ .quad 0x0000000000000000 /* TEMPORARY - don't use */ .fill 252,8,0 /* space for LDT's and TSS's etc */
Wangzhike/HIT-Linux-0.11
5,276
3-processTrack/linux-0.11/kernel/system_call.s
/* * linux/kernel/system_call.s * * (C) 1991 Linus Torvalds */ /* * system_call.s contains the system-call low-level handling routines. * This also contains the timer-interrupt handler, as some of the code is * the same. The hd- and flopppy-interrupts are also here. * * NOTE: This code handles signal-recognition, which happens every time * after a timer-interrupt and after each system call. Ordinary interrupts * don't handle signal-recognition, as that would clutter them up totally * unnecessarily. * * Stack layout in 'ret_from_system_call': * * 0(%esp) - %eax * 4(%esp) - %ebx * 8(%esp) - %ecx * C(%esp) - %edx * 10(%esp) - %fs * 14(%esp) - %es * 18(%esp) - %ds * 1C(%esp) - %eip * 20(%esp) - %cs * 24(%esp) - %eflags * 28(%esp) - %oldesp * 2C(%esp) - %oldss */ SIG_CHLD = 17 EAX = 0x00 EBX = 0x04 ECX = 0x08 EDX = 0x0C FS = 0x10 ES = 0x14 DS = 0x18 EIP = 0x1C CS = 0x20 EFLAGS = 0x24 OLDESP = 0x28 OLDSS = 0x2C state = 0 # these are offsets into the task-struct. counter = 4 priority = 8 signal = 12 sigaction = 16 # MUST be 16 (=len of sigaction) blocked = (33*16) # offsets within sigaction sa_handler = 0 sa_mask = 4 sa_flags = 8 sa_restorer = 12 nr_system_calls = 74 # origin is 72, now add sys_iam and sys_whoami /* * Ok, I get parallel printer interrupts while using the floppy for some * strange reason. Urgel. Now I just ignore them. */ .globl system_call,sys_fork,timer_interrupt,sys_execve .globl hd_interrupt,floppy_interrupt,parallel_interrupt .globl device_not_available, coprocessor_error .align 2 bad_sys_call: movl $-1,%eax iret .align 2 reschedule: pushl $ret_from_sys_call jmp schedule .align 2 system_call: cmpl $nr_system_calls-1,%eax ja bad_sys_call push %ds push %es push %fs pushl %edx pushl %ecx # push %ebx,%ecx,%edx as parameters pushl %ebx # to the system call movl $0x10,%edx # set up ds,es to kernel space mov %dx,%ds mov %dx,%es movl $0x17,%edx # fs points to local data space mov %dx,%fs call sys_call_table(,%eax,4) pushl %eax movl current,%eax cmpl $0,state(%eax) # state jne reschedule cmpl $0,counter(%eax) # counter je reschedule ret_from_sys_call: movl current,%eax # task[0] cannot have signals cmpl task,%eax je 3f cmpw $0x0f,CS(%esp) # was old code segment supervisor ? jne 3f cmpw $0x17,OLDSS(%esp) # was stack segment = 0x17 ? jne 3f movl signal(%eax),%ebx movl blocked(%eax),%ecx notl %ecx andl %ebx,%ecx bsfl %ecx,%ecx je 3f btrl %ecx,%ebx movl %ebx,signal(%eax) incl %ecx pushl %ecx call do_signal popl %eax 3: popl %eax popl %ebx popl %ecx popl %edx pop %fs pop %es pop %ds iret .align 2 coprocessor_error: push %ds push %es push %fs pushl %edx pushl %ecx pushl %ebx pushl %eax movl $0x10,%eax mov %ax,%ds mov %ax,%es movl $0x17,%eax mov %ax,%fs pushl $ret_from_sys_call jmp math_error .align 2 device_not_available: push %ds push %es push %fs pushl %edx pushl %ecx pushl %ebx pushl %eax movl $0x10,%eax mov %ax,%ds mov %ax,%es movl $0x17,%eax mov %ax,%fs pushl $ret_from_sys_call clts # clear TS so that we can use math movl %cr0,%eax testl $0x4,%eax # EM (math emulation bit) je math_state_restore pushl %ebp pushl %esi pushl %edi call math_emulate popl %edi popl %esi popl %ebp ret .align 2 timer_interrupt: push %ds # save ds,es and put kernel data space push %es # into them. %fs is used by _system_call push %fs pushl %edx # we save %eax,%ecx,%edx as gcc doesn't pushl %ecx # save those across function calls. %ebx pushl %ebx # is saved as we use that in ret_sys_call pushl %eax movl $0x10,%eax mov %ax,%ds mov %ax,%es movl $0x17,%eax mov %ax,%fs incl jiffies movb $0x20,%al # EOI to interrupt controller #1 outb %al,$0x20 movl CS(%esp),%eax andl $3,%eax # %eax is CPL (0 or 3, 0=supervisor) pushl %eax call do_timer # 'do_timer(long CPL)' does everything from addl $4,%esp # task switching to accounting ... jmp ret_from_sys_call .align 2 sys_execve: lea EIP(%esp),%eax pushl %eax call do_execve addl $4,%esp ret .align 2 sys_fork: call find_empty_process testl %eax,%eax js 1f push %gs pushl %esi pushl %edi pushl %ebp pushl %eax call copy_process addl $20,%esp 1: ret hd_interrupt: pushl %eax pushl %ecx pushl %edx push %ds push %es push %fs movl $0x10,%eax mov %ax,%ds mov %ax,%es movl $0x17,%eax mov %ax,%fs movb $0x20,%al outb %al,$0xA0 # EOI to interrupt controller #1 jmp 1f # give port chance to breathe 1: jmp 1f 1: xorl %edx,%edx xchgl do_hd,%edx testl %edx,%edx jne 1f movl $unexpected_hd_interrupt,%edx 1: outb %al,$0x20 call *%edx # "interesting" way of handling intr. pop %fs pop %es pop %ds popl %edx popl %ecx popl %eax iret floppy_interrupt: pushl %eax pushl %ecx pushl %edx push %ds push %es push %fs movl $0x10,%eax mov %ax,%ds mov %ax,%es movl $0x17,%eax mov %ax,%fs movb $0x20,%al outb %al,$0x20 # EOI to interrupt controller #1 xorl %eax,%eax xchgl do_floppy,%eax testl %eax,%eax jne 1f movl $unexpected_floppy_interrupt,%eax 1: call *%eax # "interesting" way of handling intr. pop %fs pop %es pop %ds popl %edx popl %ecx popl %eax iret parallel_interrupt: pushl %eax movb $0x20,%al outb %al,$0x20 popl %eax iret
Wangzhike/HIT-Linux-0.11
2,289
3-processTrack/linux-0.11/kernel/asm.s
/* * linux/kernel/asm.s * * (C) 1991 Linus Torvalds */ /* * asm.s contains the low-level code for most hardware faults. * page_exception is handled by the mm, so that isn't here. This * file also handles (hopefully) fpu-exceptions due to TS-bit, as * the fpu must be properly saved/resored. This hasn't been tested. */ .globl divide_error,debug,nmi,int3,overflow,bounds,invalid_op .globl double_fault,coprocessor_segment_overrun .globl invalid_TSS,segment_not_present,stack_segment .globl general_protection,coprocessor_error,irq13,reserved divide_error: pushl $do_divide_error no_error_code: xchgl %eax,(%esp) pushl %ebx pushl %ecx pushl %edx pushl %edi pushl %esi pushl %ebp push %ds push %es push %fs pushl $0 # "error code" lea 44(%esp),%edx pushl %edx movl $0x10,%edx mov %dx,%ds mov %dx,%es mov %dx,%fs call *%eax addl $8,%esp pop %fs pop %es pop %ds popl %ebp popl %esi popl %edi popl %edx popl %ecx popl %ebx popl %eax iret debug: pushl $do_int3 # _do_debug jmp no_error_code nmi: pushl $do_nmi jmp no_error_code int3: pushl $do_int3 jmp no_error_code overflow: pushl $do_overflow jmp no_error_code bounds: pushl $do_bounds jmp no_error_code invalid_op: pushl $do_invalid_op jmp no_error_code coprocessor_segment_overrun: pushl $do_coprocessor_segment_overrun jmp no_error_code reserved: pushl $do_reserved jmp no_error_code irq13: pushl %eax xorb %al,%al outb %al,$0xF0 movb $0x20,%al outb %al,$0x20 jmp 1f 1: jmp 1f 1: outb %al,$0xA0 popl %eax jmp coprocessor_error double_fault: pushl $do_double_fault error_code: xchgl %eax,4(%esp) # error code <-> %eax xchgl %ebx,(%esp) # &function <-> %ebx pushl %ecx pushl %edx pushl %edi pushl %esi pushl %ebp push %ds push %es push %fs pushl %eax # error code lea 44(%esp),%eax # offset pushl %eax movl $0x10,%eax mov %ax,%ds mov %ax,%es mov %ax,%fs call *%ebx addl $8,%esp pop %fs pop %es pop %ds popl %ebp popl %esi popl %edi popl %edx popl %ecx popl %ebx popl %eax iret invalid_TSS: pushl $do_invalid_TSS jmp error_code segment_not_present: pushl $do_segment_not_present jmp error_code stack_segment: pushl $do_stack_segment jmp error_code general_protection: pushl $do_general_protection jmp error_code
Wangzhike/HIT-Linux-0.11
2,710
3-processTrack/linux-0.11/kernel/chr_drv/rs_io.s
/* * linux/kernel/rs_io.s * * (C) 1991 Linus Torvalds */ /* * rs_io.s * * This module implements the rs232 io interrupts. */ .text .globl rs1_interrupt,rs2_interrupt size = 1024 /* must be power of two ! and must match the value in tty_io.c!!! */ /* these are the offsets into the read/write buffer structures */ rs_addr = 0 head = 4 tail = 8 proc_list = 12 buf = 16 startup = 256 /* chars left in write queue when we restart it */ /* * These are the actual interrupt routines. They look where * the interrupt is coming from, and take appropriate action. */ .align 2 rs1_interrupt: pushl $table_list+8 jmp rs_int .align 2 rs2_interrupt: pushl $table_list+16 rs_int: pushl %edx pushl %ecx pushl %ebx pushl %eax push %es push %ds /* as this is an interrupt, we cannot */ pushl $0x10 /* know that bs is ok. Load it */ pop %ds pushl $0x10 pop %es movl 24(%esp),%edx movl (%edx),%edx movl rs_addr(%edx),%edx addl $2,%edx /* interrupt ident. reg */ rep_int: xorl %eax,%eax inb %dx,%al testb $1,%al jne end cmpb $6,%al /* this shouldn't happen, but ... */ ja end movl 24(%esp),%ecx pushl %edx subl $2,%edx call jmp_table(,%eax,2) /* NOTE! not *4, bit0 is 0 already */ popl %edx jmp rep_int end: movb $0x20,%al outb %al,$0x20 /* EOI */ pop %ds pop %es popl %eax popl %ebx popl %ecx popl %edx addl $4,%esp # jump over _table_list entry iret jmp_table: .long modem_status,write_char,read_char,line_status .align 2 modem_status: addl $6,%edx /* clear intr by reading modem status reg */ inb %dx,%al ret .align 2 line_status: addl $5,%edx /* clear intr by reading line status reg. */ inb %dx,%al ret .align 2 read_char: inb %dx,%al movl %ecx,%edx subl $table_list,%edx shrl $3,%edx movl (%ecx),%ecx # read-queue movl head(%ecx),%ebx movb %al,buf(%ecx,%ebx) incl %ebx andl $size-1,%ebx cmpl tail(%ecx),%ebx je 1f movl %ebx,head(%ecx) 1: pushl %edx call do_tty_interrupt addl $4,%esp ret .align 2 write_char: movl 4(%ecx),%ecx # write-queue movl head(%ecx),%ebx subl tail(%ecx),%ebx andl $size-1,%ebx # nr chars in queue je write_buffer_empty cmpl $startup,%ebx ja 1f movl proc_list(%ecx),%ebx # wake up sleeping process testl %ebx,%ebx # is there any? je 1f movl $0,(%ebx) 1: movl tail(%ecx),%ebx movb buf(%ecx,%ebx),%al outb %al,%dx incl %ebx andl $size-1,%ebx movl %ebx,tail(%ecx) cmpl head(%ecx),%ebx je write_buffer_empty ret .align 2 write_buffer_empty: movl proc_list(%ecx),%ebx # wake up sleeping process testl %ebx,%ebx # is there any? je 1f movl $0,(%ebx) 1: incl %edx inb %dx,%al jmp 1f 1: jmp 1f 1: andb $0xd,%al /* disable transmit interrupt */ outb %al,%dx ret
Wangzhike/HIT-Linux-0.11
12,774
3-processTrack/linux-0.11/kernel/chr_drv/keyboard.S
/* * linux/kernel/keyboard.S * * (C) 1991 Linus Torvalds */ /* * Thanks to Alfred Leung for US keyboard patches * Wolfgang Thiel for German keyboard patches * Marc Corsini for the French keyboard */ #include <linux/config.h> .text .globl keyboard_interrupt /* * these are for the keyboard read functions */ size = 1024 /* must be a power of two ! And MUST be the same as in tty_io.c !!!! */ head = 4 tail = 8 proc_list = 12 buf = 16 mode: .byte 0 /* caps, alt, ctrl and shift mode */ leds: .byte 2 /* num-lock, caps, scroll-lock mode (nom-lock on) */ e0: .byte 0 /* * con_int is the real interrupt routine that reads the * keyboard scan-code and converts it into the appropriate * ascii character(s). */ keyboard_interrupt: pushl %eax pushl %ebx pushl %ecx pushl %edx push %ds push %es movl $0x10,%eax mov %ax,%ds mov %ax,%es xor %al,%al /* %eax is scan code */ inb $0x60,%al cmpb $0xe0,%al je set_e0 cmpb $0xe1,%al je set_e1 call key_table(,%eax,4) movb $0,e0 e0_e1: inb $0x61,%al jmp 1f 1: jmp 1f 1: orb $0x80,%al jmp 1f 1: jmp 1f 1: outb %al,$0x61 jmp 1f 1: jmp 1f 1: andb $0x7F,%al outb %al,$0x61 movb $0x20,%al outb %al,$0x20 pushl $0 call do_tty_interrupt addl $4,%esp pop %es pop %ds popl %edx popl %ecx popl %ebx popl %eax iret set_e0: movb $1,e0 jmp e0_e1 set_e1: movb $2,e0 jmp e0_e1 /* * This routine fills the buffer with max 8 bytes, taken from * %ebx:%eax. (%edx is high). The bytes are written in the * order %al,%ah,%eal,%eah,%bl,%bh ... until %eax is zero. */ put_queue: pushl %ecx pushl %edx movl table_list,%edx # read-queue for console movl head(%edx),%ecx 1: movb %al,buf(%edx,%ecx) incl %ecx andl $size-1,%ecx cmpl tail(%edx),%ecx # buffer full - discard everything je 3f shrdl $8,%ebx,%eax je 2f shrl $8,%ebx jmp 1b 2: movl %ecx,head(%edx) movl proc_list(%edx),%ecx testl %ecx,%ecx je 3f movl $0,(%ecx) 3: popl %edx popl %ecx ret ctrl: movb $0x04,%al jmp 1f alt: movb $0x10,%al 1: cmpb $0,e0 je 2f addb %al,%al 2: orb %al,mode ret unctrl: movb $0x04,%al jmp 1f unalt: movb $0x10,%al 1: cmpb $0,e0 je 2f addb %al,%al 2: notb %al andb %al,mode ret lshift: orb $0x01,mode ret unlshift: andb $0xfe,mode ret rshift: orb $0x02,mode ret unrshift: andb $0xfd,mode ret caps: testb $0x80,mode jne 1f xorb $4,leds xorb $0x40,mode orb $0x80,mode set_leds: call kb_wait movb $0xed,%al /* set leds command */ outb %al,$0x60 call kb_wait movb leds,%al outb %al,$0x60 ret uncaps: andb $0x7f,mode ret scroll: xorb $1,leds jmp set_leds num: xorb $2,leds jmp set_leds /* * curosr-key/numeric keypad cursor keys are handled here. * checking for numeric keypad etc. */ cursor: subb $0x47,%al jb 1f cmpb $12,%al ja 1f jne cur2 /* check for ctrl-alt-del */ testb $0x0c,mode je cur2 testb $0x30,mode jne reboot cur2: cmpb $0x01,e0 /* e0 forces cursor movement */ je cur testb $0x02,leds /* not num-lock forces cursor */ je cur testb $0x03,mode /* shift forces cursor */ jne cur xorl %ebx,%ebx movb num_table(%eax),%al jmp put_queue 1: ret cur: movb cur_table(%eax),%al cmpb $'9,%al ja ok_cur movb $'~,%ah ok_cur: shll $16,%eax movw $0x5b1b,%ax xorl %ebx,%ebx jmp put_queue #if defined(KBD_FR) num_table: .ascii "789 456 1230." #else num_table: .ascii "789 456 1230," #endif cur_table: .ascii "HA5 DGC YB623" /* * this routine handles function keys */ func: pushl %eax pushl %ecx pushl %edx call show_stat popl %edx popl %ecx popl %eax subb $0x3B,%al jb end_func cmpb $9,%al jbe ok_func subb $18,%al cmpb $10,%al jb end_func cmpb $11,%al ja end_func ok_func: cmpl $4,%ecx /* check that there is enough room */ jl end_func movl func_table(,%eax,4),%eax xorl %ebx,%ebx jmp put_queue end_func: ret /* * function keys send F1:'esc [ [ A' F2:'esc [ [ B' etc. */ func_table: .long 0x415b5b1b,0x425b5b1b,0x435b5b1b,0x445b5b1b .long 0x455b5b1b,0x465b5b1b,0x475b5b1b,0x485b5b1b .long 0x495b5b1b,0x4a5b5b1b,0x4b5b5b1b,0x4c5b5b1b #if defined(KBD_FINNISH) key_map: .byte 0,27 .ascii "1234567890+'" .byte 127,9 .ascii "qwertyuiop}" .byte 0,13,0 .ascii "asdfghjkl|{" .byte 0,0 .ascii "'zxcvbnm,.-" .byte 0,'*,0,32 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte '-,0,0,0,'+ /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '< .fill 10,1,0 shift_map: .byte 0,27 .ascii "!\"#$%&/()=?`" .byte 127,9 .ascii "QWERTYUIOP]^" .byte 13,0 .ascii "ASDFGHJKL\\[" .byte 0,0 .ascii "*ZXCVBNM;:_" .byte 0,'*,0,32 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte '-,0,0,0,'+ /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '> .fill 10,1,0 alt_map: .byte 0,0 .ascii "\0@\0$\0\0{[]}\\\0" .byte 0,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte '~,13,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte 0,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte 0,0,0,0 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte 0,0,0,0,0 /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '| .fill 10,1,0 #elif defined(KBD_US) key_map: .byte 0,27 .ascii "1234567890-=" .byte 127,9 .ascii "qwertyuiop[]" .byte 13,0 .ascii "asdfghjkl;'" .byte '`,0 .ascii "\\zxcvbnm,./" .byte 0,'*,0,32 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte '-,0,0,0,'+ /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '< .fill 10,1,0 shift_map: .byte 0,27 .ascii "!@#$%^&*()_+" .byte 127,9 .ascii "QWERTYUIOP{}" .byte 13,0 .ascii "ASDFGHJKL:\"" .byte '~,0 .ascii "|ZXCVBNM<>?" .byte 0,'*,0,32 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte '-,0,0,0,'+ /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '> .fill 10,1,0 alt_map: .byte 0,0 .ascii "\0@\0$\0\0{[]}\\\0" .byte 0,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte '~,13,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte 0,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte 0,0,0,0 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte 0,0,0,0,0 /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '| .fill 10,1,0 #elif defined(KBD_GR) key_map: .byte 0,27 .ascii "1234567890\\'" .byte 127,9 .ascii "qwertzuiop@+" .byte 13,0 .ascii "asdfghjkl[]^" .byte 0,'# .ascii "yxcvbnm,.-" .byte 0,'*,0,32 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte '-,0,0,0,'+ /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '< .fill 10,1,0 shift_map: .byte 0,27 .ascii "!\"#$%&/()=?`" .byte 127,9 .ascii "QWERTZUIOP\\*" .byte 13,0 .ascii "ASDFGHJKL{}~" .byte 0,'' .ascii "YXCVBNM;:_" .byte 0,'*,0,32 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte '-,0,0,0,'+ /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '> .fill 10,1,0 alt_map: .byte 0,0 .ascii "\0@\0$\0\0{[]}\\\0" .byte 0,0 .byte '@,0,0,0,0,0,0,0,0,0,0 .byte '~,13,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte 0,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte 0,0,0,0 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte 0,0,0,0,0 /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '| .fill 10,1,0 #elif defined(KBD_FR) key_map: .byte 0,27 .ascii "&{\"'(-}_/@)=" .byte 127,9 .ascii "azertyuiop^$" .byte 13,0 .ascii "qsdfghjklm|" .byte '`,0,42 /* coin sup gauche, don't know, [*|mu] */ .ascii "wxcvbn,;:!" .byte 0,'*,0,32 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte '-,0,0,0,'+ /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '< .fill 10,1,0 shift_map: .byte 0,27 .ascii "1234567890]+" .byte 127,9 .ascii "AZERTYUIOP<>" .byte 13,0 .ascii "QSDFGHJKLM%" .byte '~,0,'# .ascii "WXCVBN?./\\" .byte 0,'*,0,32 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte '-,0,0,0,'+ /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '> .fill 10,1,0 alt_map: .byte 0,0 .ascii "\0~#{[|`\\^@]}" .byte 0,0 .byte '@,0,0,0,0,0,0,0,0,0,0 .byte '~,13,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte 0,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte 0,0,0,0 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte 0,0,0,0,0 /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '| .fill 10,1,0 #else #error "KBD-type not defined" #endif /* * do_self handles "normal" keys, ie keys that don't change meaning * and which have just one character returns. */ do_self: lea alt_map,%ebx testb $0x20,mode /* alt-gr */ jne 1f lea shift_map,%ebx testb $0x03,mode jne 1f lea key_map,%ebx 1: movb (%ebx,%eax),%al orb %al,%al je none testb $0x4c,mode /* ctrl or caps */ je 2f cmpb $'a,%al jb 2f cmpb $'},%al ja 2f subb $32,%al 2: testb $0x0c,mode /* ctrl */ je 3f cmpb $64,%al jb 3f cmpb $64+32,%al jae 3f subb $64,%al 3: testb $0x10,mode /* left alt */ je 4f orb $0x80,%al 4: andl $0xff,%eax xorl %ebx,%ebx call put_queue none: ret /* * minus has a routine of it's own, as a 'E0h' before * the scan code for minus means that the numeric keypad * slash was pushed. */ minus: cmpb $1,e0 jne do_self movl $'/,%eax xorl %ebx,%ebx jmp put_queue /* * This table decides which routine to call when a scan-code has been * gotten. Most routines just call do_self, or none, depending if * they are make or break. */ key_table: .long none,do_self,do_self,do_self /* 00-03 s0 esc 1 2 */ .long do_self,do_self,do_self,do_self /* 04-07 3 4 5 6 */ .long do_self,do_self,do_self,do_self /* 08-0B 7 8 9 0 */ .long do_self,do_self,do_self,do_self /* 0C-0F + ' bs tab */ .long do_self,do_self,do_self,do_self /* 10-13 q w e r */ .long do_self,do_self,do_self,do_self /* 14-17 t y u i */ .long do_self,do_self,do_self,do_self /* 18-1B o p } ^ */ .long do_self,ctrl,do_self,do_self /* 1C-1F enter ctrl a s */ .long do_self,do_self,do_self,do_self /* 20-23 d f g h */ .long do_self,do_self,do_self,do_self /* 24-27 j k l | */ .long do_self,do_self,lshift,do_self /* 28-2B { para lshift , */ .long do_self,do_self,do_self,do_self /* 2C-2F z x c v */ .long do_self,do_self,do_self,do_self /* 30-33 b n m , */ .long do_self,minus,rshift,do_self /* 34-37 . - rshift * */ .long alt,do_self,caps,func /* 38-3B alt sp caps f1 */ .long func,func,func,func /* 3C-3F f2 f3 f4 f5 */ .long func,func,func,func /* 40-43 f6 f7 f8 f9 */ .long func,num,scroll,cursor /* 44-47 f10 num scr home */ .long cursor,cursor,do_self,cursor /* 48-4B up pgup - left */ .long cursor,cursor,do_self,cursor /* 4C-4F n5 right + end */ .long cursor,cursor,cursor,cursor /* 50-53 dn pgdn ins del */ .long none,none,do_self,func /* 54-57 sysreq ? < f11 */ .long func,none,none,none /* 58-5B f12 ? ? ? */ .long none,none,none,none /* 5C-5F ? ? ? ? */ .long none,none,none,none /* 60-63 ? ? ? ? */ .long none,none,none,none /* 64-67 ? ? ? ? */ .long none,none,none,none /* 68-6B ? ? ? ? */ .long none,none,none,none /* 6C-6F ? ? ? ? */ .long none,none,none,none /* 70-73 ? ? ? ? */ .long none,none,none,none /* 74-77 ? ? ? ? */ .long none,none,none,none /* 78-7B ? ? ? ? */ .long none,none,none,none /* 7C-7F ? ? ? ? */ .long none,none,none,none /* 80-83 ? br br br */ .long none,none,none,none /* 84-87 br br br br */ .long none,none,none,none /* 88-8B br br br br */ .long none,none,none,none /* 8C-8F br br br br */ .long none,none,none,none /* 90-93 br br br br */ .long none,none,none,none /* 94-97 br br br br */ .long none,none,none,none /* 98-9B br br br br */ .long none,unctrl,none,none /* 9C-9F br unctrl br br */ .long none,none,none,none /* A0-A3 br br br br */ .long none,none,none,none /* A4-A7 br br br br */ .long none,none,unlshift,none /* A8-AB br br unlshift br */ .long none,none,none,none /* AC-AF br br br br */ .long none,none,none,none /* B0-B3 br br br br */ .long none,none,unrshift,none /* B4-B7 br br unrshift br */ .long unalt,none,uncaps,none /* B8-BB unalt br uncaps br */ .long none,none,none,none /* BC-BF br br br br */ .long none,none,none,none /* C0-C3 br br br br */ .long none,none,none,none /* C4-C7 br br br br */ .long none,none,none,none /* C8-CB br br br br */ .long none,none,none,none /* CC-CF br br br br */ .long none,none,none,none /* D0-D3 br br br br */ .long none,none,none,none /* D4-D7 br br br br */ .long none,none,none,none /* D8-DB br ? ? ? */ .long none,none,none,none /* DC-DF ? ? ? ? */ .long none,none,none,none /* E0-E3 e0 e1 ? ? */ .long none,none,none,none /* E4-E7 ? ? ? ? */ .long none,none,none,none /* E8-EB ? ? ? ? */ .long none,none,none,none /* EC-EF ? ? ? ? */ .long none,none,none,none /* F0-F3 ? ? ? ? */ .long none,none,none,none /* F4-F7 ? ? ? ? */ .long none,none,none,none /* F8-FB ? ? ? ? */ .long none,none,none,none /* FC-FF ? ? ? ? */ /* * kb_wait waits for the keyboard controller buffer to empty. * there is no timeout - if the buffer doesn't empty, we hang. */ kb_wait: pushl %eax 1: inb $0x64,%al testb $0x02,%al jne 1b popl %eax ret /* * This routine reboots the machine by asking the keyboard * controller to pulse the reset-line low. */ reboot: call kb_wait movw $0x1234,0x472 /* don't do memory check */ movb $0xfc,%al /* pulse reset and A20 low */ outb %al,$0x64 die: jmp die
Wangzhike/HIT-Linux-0.11
5,473
2-syscall/linux-0.11/boot/bootsect.s
! ! SYS_SIZE is the number of clicks (16 bytes) to be loaded. ! 0x3000 is 0x30000 bytes = 196kB, more than enough for current ! versions of linux ! SYSSIZE = 0x3000 ! ! bootsect.s (C) 1991 Linus Torvalds ! ! bootsect.s is loaded at 0x7c00 by the bios-startup routines, and moves ! iself out of the way to address 0x90000, and jumps there. ! ! It then loads 'setup' directly after itself (0x90200), and the system ! at 0x10000, using BIOS interrupts. ! ! NOTE! currently system is at most 8*65536 bytes long. This should be no ! problem, even in the future. I want to keep it simple. This 512 kB ! kernel size should be enough, especially as this doesn't contain the ! buffer cache as in minix ! ! The loader has been made as simple as possible, and continuos ! read errors will result in a unbreakable loop. Reboot by hand. It ! loads pretty fast by getting whole sectors at a time whenever possible. .globl begtext, begdata, begbss, endtext, enddata, endbss .text begtext: .data begdata: .bss begbss: .text SETUPLEN = 4 ! nr of setup-sectors BOOTSEG = 0x07c0 ! original address of boot-sector INITSEG = 0x9000 ! we move boot here - out of the way SETUPSEG = 0x9020 ! setup starts here SYSSEG = 0x1000 ! system loaded at 0x10000 (65536). ENDSEG = SYSSEG + SYSSIZE ! where to stop loading ! ROOT_DEV: 0x000 - same type of floppy as boot. ! 0x301 - first partition on first drive etc ROOT_DEV = 0x306 entry _start _start: mov ax,#BOOTSEG mov ds,ax mov ax,#INITSEG mov es,ax mov cx,#256 sub si,si sub di,di rep movw jmpi go,INITSEG go: mov ax,cs mov ds,ax mov es,ax ! put stack at 0x9ff00. mov ss,ax mov sp,#0xFF00 ! arbitrary value >>512 ! load the setup-sectors directly after the bootblock. ! Note that 'es' is already set up. load_setup: mov dx,#0x0000 ! drive 0, head 0 mov cx,#0x0002 ! sector 2, track 0 mov bx,#0x0200 ! address = 512, in INITSEG mov ax,#0x0200+SETUPLEN ! service 2, nr of sectors int 0x13 ! read it jnc ok_load_setup ! ok - continue mov dx,#0x0000 mov ax,#0x0000 ! reset the diskette int 0x13 j load_setup ok_load_setup: ! Get disk drive parameters, specifically nr of sectors/track mov dl,#0x00 mov ax,#0x0800 ! AH=8 is get drive parameters int 0x13 mov ch,#0x00 seg cs mov sectors,cx mov ax,#INITSEG mov es,ax ! Print some inane message call read_cursor mov cx,#2 mov bx,#0x0007 ! page 0, attribute 7 (normal, white color) mov bp,#msg1 mov ax,#0x1301 ! write string, move cursor int 0x10 call read_cursor mov cx, #6 mov bx, #0x0009 ! page 0, attribute 9(bright blue color) mov bp, #msg1+2 mov ax, #0x1301 ! write string, move cursor int 0x10 call read_cursor mov cx, #18 mov bx, #0x0007 ! page 0, attribute 7(normal, white color) mov bp, #msg1+8 mov ax, #0x1301 ! write string, move cursor int 0x10 ! ok, we've written the message, now ! we want to load the system (at 0x10000) mov ax,#SYSSEG mov es,ax ! segment of 0x010000 call read_it call kill_motor ! After that we check which root-device to use. If the device is ! defined (!= 0), nothing is done and the given device is used. ! Otherwise, either /dev/PS0 (2,28) or /dev/at0 (2,8), depending ! on the number of sectors that the BIOS reports currently. seg cs mov ax,root_dev cmp ax,#0 jne root_defined seg cs mov bx,sectors mov ax,#0x0208 ! /dev/ps0 - 1.2Mb cmp bx,#15 je root_defined mov ax,#0x021c ! /dev/PS0 - 1.44Mb cmp bx,#18 je root_defined undef_root: jmp undef_root root_defined: seg cs mov root_dev,ax ! after that (everyting loaded), we jump to ! the setup-routine loaded directly after ! the bootblock: jmpi 0,SETUPSEG ! This routine loads the system at address 0x10000, making sure ! no 64kB boundaries are crossed. We try to load it as fast as ! possible, loading whole tracks whenever we can. ! ! in: es - starting address segment (normally 0x1000) ! sread: .word 1+SETUPLEN ! sectors read of current track head: .word 0 ! current head track: .word 0 ! current track read_it: mov ax,es test ax,#0x0fff die: jne die ! es must be at 64kB boundary xor bx,bx ! bx is starting address within segment rp_read: mov ax,es cmp ax,#ENDSEG ! have we loaded all yet? jb ok1_read ret ok1_read: seg cs mov ax,sectors sub ax,sread mov cx,ax shl cx,#9 add cx,bx jnc ok2_read je ok2_read xor ax,ax sub ax,bx shr ax,#9 ok2_read: call read_track mov cx,ax add ax,sread seg cs cmp ax,sectors jne ok3_read mov ax,#1 sub ax,head jne ok4_read inc track ok4_read: mov head,ax xor ax,ax ok3_read: mov sread,ax shl cx,#9 add bx,cx jnc rp_read mov ax,es add ax,#0x1000 mov es,ax xor bx,bx jmp rp_read read_track: push ax push bx push cx push dx mov dx,track mov cx,sread inc cx mov ch,dl mov dx,head mov dh,dl mov dl,#0 and dx,#0x0100 mov ah,#2 int 0x13 jc bad_rt pop dx pop cx pop bx pop ax ret bad_rt: mov ax,#0 mov dx,#0 int 0x13 pop dx pop cx pop bx pop ax jmp read_track read_cursor: push ax push bx mov ah,#0x03 ! read cursor pos xor bh,bh int 0x10 pop bx pop ax ret !/* ! * This procedure turns off the floppy drive motor, so ! * that we enter the kernel in a known state, and ! * don't have to worry about it later. ! */ kill_motor: push dx mov dx,#0x3f2 mov al,#0 outb pop dx ret sectors: .word 0 msg1: .byte 13,10 .ascii "Qiunix is loading..." .byte 13,10,13,10 .org 508 root_dev: .word ROOT_DEV boot_flag: .word 0xAA55 .text endtext: .data enddata: .bss endbss:
Wangzhike/HIT-Linux-0.11
8,626
2-syscall/linux-0.11/boot/setup.s
! ! setup.s (C) 1991 Linus Torvalds ! ! setup.s is responsible for getting the system data from the BIOS, ! and putting them into the appropriate places in system memory. ! both setup.s and system has been loaded by the bootblock. ! ! This code asks the bios for memory/disk/other parameters, and ! puts them in a "safe" place: 0x90000-0x901FF, ie where the ! boot-block used to be. It is then up to the protected mode ! system to read them from there before the area is overwritten ! for buffer-blocks. ! ! NOTE! These had better be the same as in bootsect.s! INITSEG = 0x9000 ! we move boot here - out of the way SYSSEG = 0x1000 ! system loaded at 0x10000 (65536). SETUPSEG = 0x9020 ! this is the current segment .globl begtext, begdata, begbss, endtext, enddata, endbss .text begtext: .data begdata: .bss begbss: .text entry start start: ! repeat set stack, although it is done in bootsect.s mov ax, #INITSEG mov ss, ax mov sp, #0xFF00 ! now we are in setup ,print the message. mov ax, #SETUPSEG mov es, ax call read_cursor mov cx, #14 mov bx, #0x0007 ! page 0, attribute 10(bright green) mov bp, #msg mov ax, #0x1301 ! write string, move cursor int 0x10 call read_cursor mov cx, #5 mov bx, #0x000a ! page 0, attribute 7(normal, white color) mov bp, #msg+14 mov ax, #0x1301 int 0x10 call print_nl call print_nl ! ok, the read went well so we get current cursor position and save it for ! posterity. mov ax,#INITSEG ! this is done in bootsect already, but... mov ds,ax mov ah,#0x03 ! read cursor pos xor bh,bh int 0x10 ! save it in known place, con_init fetches mov [0],dx ! it from 0x90000. ! Get memory size (extended mem, kB) mov ax, #INITSEG ! this is done in bootsect already, but... mov ds, ax mov ah,#0x88 int 0x15 mov [2],ax ! Get video-card data: mov ah,#0x0f int 0x10 mov [4],bx ! bh = display page mov [6],ax ! al = video mode, ah = window width ! check for EGA/VGA and some config parameters mov ah,#0x12 mov bl,#0x10 int 0x10 mov [8],ax mov [10],bx mov [12],cx ! Get hd0 data mov ax,#0x0000 mov ds,ax lds si,[4*0x41] mov ax,#INITSEG mov es,ax mov di,#0x0080 mov cx,#0x10 rep movsb ! Get hd1 data mov ax,#0x0000 mov ds,ax lds si,[4*0x46] mov ax,#INITSEG mov es,ax mov di,#0x0090 mov cx,#0x10 rep movsb ! Check that there IS a hd1 :-) mov ax,#0x01500 mov dl,#0x81 int 0x13 jc no_disk1 cmp ah,#3 je is_disk1 no_disk1: mov ax,#INITSEG mov es,ax mov di,#0x0090 mov cx,#0x10 mov ax,#0x00 rep stosb is_disk1: ! now, we have read some system parameters, print thees parameters. mov ax, #INITSEG mov ds, ax mov ax, #SETUPSEG mov es, ax ! print cursor position call read_cursor mov cx, #17 mov bx, #0x000a ! page 0, attribute 10(normal, bright gren color) mov bp, #cursor mov ax, #0x1301 int 0x10 mov bp, #0x0000 call print_hex call print_nl ! print memory size call read_cursor mov cx, #13 mov bx, #0x000a ! page 0, attribue 10(normal, bright green color) mov bp, #memory mov ax, #0x1301 int 0x10 mov ax, [2] add ax, #1024 mov memsize, ax mov bp, #memsize call print_hex call read_cursor mov cx, #2 mov bx, #0x0007 mov bp, #memory+13 mov ax, #0x1301 int 0x10 call print_nl ! print hd0 cylinders call read_cursor mov cx, #15 mov bx, #0x000a ! page 0, attribute 10(normal, bright green color) mov bp, #cylinder mov ax, #0x1301 int 0x10 call read_cursor mov bp, #0x0080 call print_hex call print_nl ! print hd0 heads call read_cursor mov cx, #11 mov bx, #0x000a ! page 0, attribute 10(normal, bright green color) mov bp, #head mov ax, #0x1301 int 0x10 mov bp, #0x0082 call print_hex call print_nl ! print hd0 sectors call read_cursor mov cx, #13 mov bx, #0x000a ! page 0, attribute 10(normal, bright green color) mov bp, #sector mov ax, #0x1301 int 0x10 mov bp, #0x008E call print_hex call print_nl call print_nl ! ok, the read went well so we get current cursor position and save it for ! posterity. mov ax,#INITSEG ! this is done in bootsect already, but... mov ds,ax mov ah,#0x03 ! read cursor pos xor bh,bh int 0x10 ! save it in known place, con_init fetches mov [0],dx ! it from 0x90000. ! Get video-card data: mov ah,#0x0f int 0x10 mov [4],bx ! bh = display page mov [6],ax ! al = video mode, ah = window width ! now we want to move to protected mode ... cli ! no interrupts allowed ! ! first we move the system to it's rightful place mov ax,#0x0000 cld ! 'direction'=0, movs moves forward do_move: mov es,ax ! destination segment add ax,#0x1000 cmp ax,#0x9000 jz end_move mov ds,ax ! source segment sub di,di sub si,si mov cx,#0x8000 rep movsw jmp do_move ! then we load the segment descriptors end_move: mov ax,#SETUPSEG ! right, forgot this at first. didn't work :-) mov ds,ax lidt idt_48 ! load idt with 0,0 lgdt gdt_48 ! load gdt with whatever appropriate ! that was painless, now we enable A20 call empty_8042 mov al,#0xD1 ! command write out #0x64,al call empty_8042 mov al,#0xDF ! A20 on out #0x60,al call empty_8042 ! well, that went ok, I hope. Now we have to reprogram the interrupts :-( ! we put them right after the intel-reserved hardware interrupts, at ! int 0x20-0x2F. There they won't mess up anything. Sadly IBM really ! messed this up with the original PC, and they haven't been able to ! rectify it afterwards. Thus the bios puts interrupts at 0x08-0x0f, ! which is used for the internal hardware interrupts as well. We just ! have to reprogram the 8259's, and it isn't fun. mov al,#0x11 ! initialization sequence out #0x20,al ! send it to 8259A-1 .word 0x00eb,0x00eb ! jmp $+2, jmp $+2 out #0xA0,al ! and to 8259A-2 .word 0x00eb,0x00eb mov al,#0x20 ! start of hardware int's (0x20) out #0x21,al .word 0x00eb,0x00eb mov al,#0x28 ! start of hardware int's 2 (0x28) out #0xA1,al .word 0x00eb,0x00eb mov al,#0x04 ! 8259-1 is master out #0x21,al .word 0x00eb,0x00eb mov al,#0x02 ! 8259-2 is slave out #0xA1,al .word 0x00eb,0x00eb mov al,#0x01 ! 8086 mode for both out #0x21,al .word 0x00eb,0x00eb out #0xA1,al .word 0x00eb,0x00eb mov al,#0xFF ! mask off all interrupts for now out #0x21,al .word 0x00eb,0x00eb out #0xA1,al ! well, that certainly wasn't fun :-(. Hopefully it works, and we don't ! need no steenking BIOS anyway (except for the initial loading :-). ! The BIOS-routine wants lots of unnecessary data, and it's less ! "interesting" anyway. This is how REAL programmers do it. ! ! Well, now's the time to actually move into protected mode. To make ! things as simple as possible, we do no register set-up or anything, ! we let the gnu-compiled 32-bit programs do that. We just jump to ! absolute address 0x00000, in 32-bit protected mode. mov ax,#0x0001 ! protected mode (PE) bit lmsw ax ! This is it! jmpi 0,8 ! jmp offset 0 of segment 8 (cs) ! This routine checks that the keyboard command queue is empty ! No timeout is used - if this hangs there is something wrong with ! the machine, and we probably couldn't proceed anyway. empty_8042: .word 0x00eb,0x00eb in al,#0x64 ! 8042 status port test al,#2 ! is input buffer full? jnz empty_8042 ! yes - loop ret !以16进制方式打印栈顶的16位数 print_hex: push ax push bx push cx push dx mov ax, #0x0e30 ! 0 int 0x10 mov ax, #0x0e78 ! x int 0x10 mov cx, #4 mov dx, (bp) print_digit: rol dx, #4 mov ax, #0x0e0f mov bl, #0x0f ! bright green color and al, dl add al,#0x30 cmp al, #0x3a jl outp ! if less,是一个不大于9的数字 add al, #0x07 ! 是a~f,要加7 outp: int 0x10 loop print_digit pop dx pop cx pop bx pop ax ret print_nl: push ax push bx mov ax, #0x0e0d ! CR int 0x10 mov ax, #0x0e0A ! LR int 0x10 pop bx pop ax ret read_cursor: push ax push bx push cx mov ah, #0x03 ! read cursor pos xor bh, bh int 0x10 pop cx pop bx pop ax ret gdt: .word 0,0,0,0 ! dummy .word 0x07FF ! 8Mb - limit=2047 (2048*4096=8Mb) .word 0x0000 ! base address=0 .word 0x9A00 ! code read/exec .word 0x00C0 ! granularity=4096, 386 .word 0x07FF ! 8Mb - limit=2047 (2048*4096=8Mb) .word 0x0000 ! base address=0 .word 0x9200 ! data read/write .word 0x00C0 ! granularity=4096, 386 idt_48: .word 0 ! idt limit=0 .word 0,0 ! idt base=0L gdt_48: .word 0x800 ! gdt limit=2048, 256 GDT entries .word 512+gdt,0x9 ! gdt base = 0X9xxxx msg: .ascii "Now we are in SETUP" cursor: .ascii "Cursor Position: " .ascii "KB" memory: .ascii "Memory Size: KB" cylinder: .ascii "HD0 cylinders: " head: .ascii "HD0 heads: " sector: .ascii "HD0 sectors: " memsize: .word 0x0000 .text endtext: .data enddata: .bss endbss:
Wangzhike/HIT-Linux-0.11
5,938
2-syscall/linux-0.11/boot/head.s
/* * linux/boot/head.s * * (C) 1991 Linus Torvalds */ /* * head.s contains the 32-bit startup code. * * NOTE!!! Startup happens at absolute address 0x00000000, which is also where * the page directory will exist. The startup code will be overwritten by * the page directory. */ .text .globl idt,gdt,pg_dir,tmp_floppy_area pg_dir: .globl startup_32 startup_32: movl $0x10,%eax mov %ax,%ds mov %ax,%es mov %ax,%fs mov %ax,%gs lss stack_start,%esp call setup_idt call setup_gdt movl $0x10,%eax # reload all the segment registers mov %ax,%ds # after changing gdt. CS was already mov %ax,%es # reloaded in 'setup_gdt' mov %ax,%fs mov %ax,%gs lss stack_start,%esp xorl %eax,%eax 1: incl %eax # check that A20 really IS enabled movl %eax,0x000000 # loop forever if it isn't cmpl %eax,0x100000 je 1b /* * NOTE! 486 should set bit 16, to check for write-protect in supervisor * mode. Then it would be unnecessary with the "verify_area()"-calls. * 486 users probably want to set the NE (#5) bit also, so as to use * int 16 for math errors. */ movl %cr0,%eax # check math chip andl $0x80000011,%eax # Save PG,PE,ET /* "orl $0x10020,%eax" here for 486 might be good */ orl $2,%eax # set MP movl %eax,%cr0 call check_x87 jmp after_page_tables /* * We depend on ET to be correct. This checks for 287/387. */ check_x87: fninit fstsw %ax cmpb $0,%al je 1f /* no coprocessor: have to set bits */ movl %cr0,%eax xorl $6,%eax /* reset MP, set EM */ movl %eax,%cr0 ret .align 2 1: .byte 0xDB,0xE4 /* fsetpm for 287, ignored by 387 */ ret /* * setup_idt * * sets up a idt with 256 entries pointing to * ignore_int, interrupt gates. It then loads * idt. Everything that wants to install itself * in the idt-table may do so themselves. Interrupts * are enabled elsewhere, when we can be relatively * sure everything is ok. This routine will be over- * written by the page tables. */ setup_idt: lea ignore_int,%edx movl $0x00080000,%eax movw %dx,%ax /* selector = 0x0008 = cs */ movw $0x8E00,%dx /* interrupt gate - dpl=0, present */ lea idt,%edi mov $256,%ecx rp_sidt: movl %eax,(%edi) movl %edx,4(%edi) addl $8,%edi dec %ecx jne rp_sidt lidt idt_descr ret /* * setup_gdt * * This routines sets up a new gdt and loads it. * Only two entries are currently built, the same * ones that were built in init.s. The routine * is VERY complicated at two whole lines, so this * rather long comment is certainly needed :-). * This routine will beoverwritten by the page tables. */ setup_gdt: lgdt gdt_descr ret /* * I put the kernel page tables right after the page directory, * using 4 of them to span 16 Mb of physical memory. People with * more than 16MB will have to expand this. */ .org 0x1000 pg0: .org 0x2000 pg1: .org 0x3000 pg2: .org 0x4000 pg3: .org 0x5000 /* * tmp_floppy_area is used by the floppy-driver when DMA cannot * reach to a buffer-block. It needs to be aligned, so that it isn't * on a 64kB border. */ tmp_floppy_area: .fill 1024,1,0 after_page_tables: pushl $0 # These are the parameters to main :-) pushl $0 pushl $0 pushl $L6 # return address for main, if it decides to. pushl $main jmp setup_paging L6: jmp L6 # main should never return here, but # just in case, we know what happens. /* This is the default interrupt "handler" :-) */ int_msg: .asciz "Unknown interrupt\n\r" .align 2 ignore_int: pushl %eax pushl %ecx pushl %edx push %ds push %es push %fs movl $0x10,%eax mov %ax,%ds mov %ax,%es mov %ax,%fs pushl $int_msg call printk popl %eax pop %fs pop %es pop %ds popl %edx popl %ecx popl %eax iret /* * Setup_paging * * This routine sets up paging by setting the page bit * in cr0. The page tables are set up, identity-mapping * the first 16MB. The pager assumes that no illegal * addresses are produced (ie >4Mb on a 4Mb machine). * * NOTE! Although all physical memory should be identity * mapped by this routine, only the kernel page functions * use the >1Mb addresses directly. All "normal" functions * use just the lower 1Mb, or the local data space, which * will be mapped to some other place - mm keeps track of * that. * * For those with more memory than 16 Mb - tough luck. I've * not got it, why should you :-) The source is here. Change * it. (Seriously - it shouldn't be too difficult. Mostly * change some constants etc. I left it at 16Mb, as my machine * even cannot be extended past that (ok, but it was cheap :-) * I've tried to show which constants to change by having * some kind of marker at them (search for "16Mb"), but I * won't guarantee that's all :-( ) */ .align 2 setup_paging: movl $1024*5,%ecx /* 5 pages - pg_dir+4 page tables */ xorl %eax,%eax xorl %edi,%edi /* pg_dir is at 0x000 */ cld;rep;stosl movl $pg0+7,pg_dir /* set present bit/user r/w */ movl $pg1+7,pg_dir+4 /* --------- " " --------- */ movl $pg2+7,pg_dir+8 /* --------- " " --------- */ movl $pg3+7,pg_dir+12 /* --------- " " --------- */ movl $pg3+4092,%edi movl $0xfff007,%eax /* 16Mb - 4096 + 7 (r/w user,p) */ std 1: stosl /* fill pages backwards - more efficient :-) */ subl $0x1000,%eax jge 1b xorl %eax,%eax /* pg_dir is at 0x0000 */ movl %eax,%cr3 /* cr3 - page directory start */ movl %cr0,%eax orl $0x80000000,%eax movl %eax,%cr0 /* set paging (PG) bit */ ret /* this also flushes prefetch-queue */ .align 2 .word 0 idt_descr: .word 256*8-1 # idt contains 256 entries .long idt .align 2 .word 0 gdt_descr: .word 256*8-1 # so does gdt (not that that's any .long gdt # magic number, but it works for me :^) .align 8 idt: .fill 256,8,0 # idt is uninitialized gdt: .quad 0x0000000000000000 /* NULL descriptor */ .quad 0x00c09a0000000fff /* 16Mb */ .quad 0x00c0920000000fff /* 16Mb */ .quad 0x0000000000000000 /* TEMPORARY - don't use */ .fill 252,8,0 /* space for LDT's and TSS's etc */
Wangzhike/HIT-Linux-0.11
5,276
2-syscall/linux-0.11/kernel/system_call.s
/* * linux/kernel/system_call.s * * (C) 1991 Linus Torvalds */ /* * system_call.s contains the system-call low-level handling routines. * This also contains the timer-interrupt handler, as some of the code is * the same. The hd- and flopppy-interrupts are also here. * * NOTE: This code handles signal-recognition, which happens every time * after a timer-interrupt and after each system call. Ordinary interrupts * don't handle signal-recognition, as that would clutter them up totally * unnecessarily. * * Stack layout in 'ret_from_system_call': * * 0(%esp) - %eax * 4(%esp) - %ebx * 8(%esp) - %ecx * C(%esp) - %edx * 10(%esp) - %fs * 14(%esp) - %es * 18(%esp) - %ds * 1C(%esp) - %eip * 20(%esp) - %cs * 24(%esp) - %eflags * 28(%esp) - %oldesp * 2C(%esp) - %oldss */ SIG_CHLD = 17 EAX = 0x00 EBX = 0x04 ECX = 0x08 EDX = 0x0C FS = 0x10 ES = 0x14 DS = 0x18 EIP = 0x1C CS = 0x20 EFLAGS = 0x24 OLDESP = 0x28 OLDSS = 0x2C state = 0 # these are offsets into the task-struct. counter = 4 priority = 8 signal = 12 sigaction = 16 # MUST be 16 (=len of sigaction) blocked = (33*16) # offsets within sigaction sa_handler = 0 sa_mask = 4 sa_flags = 8 sa_restorer = 12 nr_system_calls = 74 # origin is 72, now add sys_iam and sys_whoami /* * Ok, I get parallel printer interrupts while using the floppy for some * strange reason. Urgel. Now I just ignore them. */ .globl system_call,sys_fork,timer_interrupt,sys_execve .globl hd_interrupt,floppy_interrupt,parallel_interrupt .globl device_not_available, coprocessor_error .align 2 bad_sys_call: movl $-1,%eax iret .align 2 reschedule: pushl $ret_from_sys_call jmp schedule .align 2 system_call: cmpl $nr_system_calls-1,%eax ja bad_sys_call push %ds push %es push %fs pushl %edx pushl %ecx # push %ebx,%ecx,%edx as parameters pushl %ebx # to the system call movl $0x10,%edx # set up ds,es to kernel space mov %dx,%ds mov %dx,%es movl $0x17,%edx # fs points to local data space mov %dx,%fs call sys_call_table(,%eax,4) pushl %eax movl current,%eax cmpl $0,state(%eax) # state jne reschedule cmpl $0,counter(%eax) # counter je reschedule ret_from_sys_call: movl current,%eax # task[0] cannot have signals cmpl task,%eax je 3f cmpw $0x0f,CS(%esp) # was old code segment supervisor ? jne 3f cmpw $0x17,OLDSS(%esp) # was stack segment = 0x17 ? jne 3f movl signal(%eax),%ebx movl blocked(%eax),%ecx notl %ecx andl %ebx,%ecx bsfl %ecx,%ecx je 3f btrl %ecx,%ebx movl %ebx,signal(%eax) incl %ecx pushl %ecx call do_signal popl %eax 3: popl %eax popl %ebx popl %ecx popl %edx pop %fs pop %es pop %ds iret .align 2 coprocessor_error: push %ds push %es push %fs pushl %edx pushl %ecx pushl %ebx pushl %eax movl $0x10,%eax mov %ax,%ds mov %ax,%es movl $0x17,%eax mov %ax,%fs pushl $ret_from_sys_call jmp math_error .align 2 device_not_available: push %ds push %es push %fs pushl %edx pushl %ecx pushl %ebx pushl %eax movl $0x10,%eax mov %ax,%ds mov %ax,%es movl $0x17,%eax mov %ax,%fs pushl $ret_from_sys_call clts # clear TS so that we can use math movl %cr0,%eax testl $0x4,%eax # EM (math emulation bit) je math_state_restore pushl %ebp pushl %esi pushl %edi call math_emulate popl %edi popl %esi popl %ebp ret .align 2 timer_interrupt: push %ds # save ds,es and put kernel data space push %es # into them. %fs is used by _system_call push %fs pushl %edx # we save %eax,%ecx,%edx as gcc doesn't pushl %ecx # save those across function calls. %ebx pushl %ebx # is saved as we use that in ret_sys_call pushl %eax movl $0x10,%eax mov %ax,%ds mov %ax,%es movl $0x17,%eax mov %ax,%fs incl jiffies movb $0x20,%al # EOI to interrupt controller #1 outb %al,$0x20 movl CS(%esp),%eax andl $3,%eax # %eax is CPL (0 or 3, 0=supervisor) pushl %eax call do_timer # 'do_timer(long CPL)' does everything from addl $4,%esp # task switching to accounting ... jmp ret_from_sys_call .align 2 sys_execve: lea EIP(%esp),%eax pushl %eax call do_execve addl $4,%esp ret .align 2 sys_fork: call find_empty_process testl %eax,%eax js 1f push %gs pushl %esi pushl %edi pushl %ebp pushl %eax call copy_process addl $20,%esp 1: ret hd_interrupt: pushl %eax pushl %ecx pushl %edx push %ds push %es push %fs movl $0x10,%eax mov %ax,%ds mov %ax,%es movl $0x17,%eax mov %ax,%fs movb $0x20,%al outb %al,$0xA0 # EOI to interrupt controller #1 jmp 1f # give port chance to breathe 1: jmp 1f 1: xorl %edx,%edx xchgl do_hd,%edx testl %edx,%edx jne 1f movl $unexpected_hd_interrupt,%edx 1: outb %al,$0x20 call *%edx # "interesting" way of handling intr. pop %fs pop %es pop %ds popl %edx popl %ecx popl %eax iret floppy_interrupt: pushl %eax pushl %ecx pushl %edx push %ds push %es push %fs movl $0x10,%eax mov %ax,%ds mov %ax,%es movl $0x17,%eax mov %ax,%fs movb $0x20,%al outb %al,$0x20 # EOI to interrupt controller #1 xorl %eax,%eax xchgl do_floppy,%eax testl %eax,%eax jne 1f movl $unexpected_floppy_interrupt,%eax 1: call *%eax # "interesting" way of handling intr. pop %fs pop %es pop %ds popl %edx popl %ecx popl %eax iret parallel_interrupt: pushl %eax movb $0x20,%al outb %al,$0x20 popl %eax iret
Wangzhike/HIT-Linux-0.11
2,289
2-syscall/linux-0.11/kernel/asm.s
/* * linux/kernel/asm.s * * (C) 1991 Linus Torvalds */ /* * asm.s contains the low-level code for most hardware faults. * page_exception is handled by the mm, so that isn't here. This * file also handles (hopefully) fpu-exceptions due to TS-bit, as * the fpu must be properly saved/resored. This hasn't been tested. */ .globl divide_error,debug,nmi,int3,overflow,bounds,invalid_op .globl double_fault,coprocessor_segment_overrun .globl invalid_TSS,segment_not_present,stack_segment .globl general_protection,coprocessor_error,irq13,reserved divide_error: pushl $do_divide_error no_error_code: xchgl %eax,(%esp) pushl %ebx pushl %ecx pushl %edx pushl %edi pushl %esi pushl %ebp push %ds push %es push %fs pushl $0 # "error code" lea 44(%esp),%edx pushl %edx movl $0x10,%edx mov %dx,%ds mov %dx,%es mov %dx,%fs call *%eax addl $8,%esp pop %fs pop %es pop %ds popl %ebp popl %esi popl %edi popl %edx popl %ecx popl %ebx popl %eax iret debug: pushl $do_int3 # _do_debug jmp no_error_code nmi: pushl $do_nmi jmp no_error_code int3: pushl $do_int3 jmp no_error_code overflow: pushl $do_overflow jmp no_error_code bounds: pushl $do_bounds jmp no_error_code invalid_op: pushl $do_invalid_op jmp no_error_code coprocessor_segment_overrun: pushl $do_coprocessor_segment_overrun jmp no_error_code reserved: pushl $do_reserved jmp no_error_code irq13: pushl %eax xorb %al,%al outb %al,$0xF0 movb $0x20,%al outb %al,$0x20 jmp 1f 1: jmp 1f 1: outb %al,$0xA0 popl %eax jmp coprocessor_error double_fault: pushl $do_double_fault error_code: xchgl %eax,4(%esp) # error code <-> %eax xchgl %ebx,(%esp) # &function <-> %ebx pushl %ecx pushl %edx pushl %edi pushl %esi pushl %ebp push %ds push %es push %fs pushl %eax # error code lea 44(%esp),%eax # offset pushl %eax movl $0x10,%eax mov %ax,%ds mov %ax,%es mov %ax,%fs call *%ebx addl $8,%esp pop %fs pop %es pop %ds popl %ebp popl %esi popl %edi popl %edx popl %ecx popl %ebx popl %eax iret invalid_TSS: pushl $do_invalid_TSS jmp error_code segment_not_present: pushl $do_segment_not_present jmp error_code stack_segment: pushl $do_stack_segment jmp error_code general_protection: pushl $do_general_protection jmp error_code
Wangzhike/HIT-Linux-0.11
2,710
2-syscall/linux-0.11/kernel/chr_drv/rs_io.s
/* * linux/kernel/rs_io.s * * (C) 1991 Linus Torvalds */ /* * rs_io.s * * This module implements the rs232 io interrupts. */ .text .globl rs1_interrupt,rs2_interrupt size = 1024 /* must be power of two ! and must match the value in tty_io.c!!! */ /* these are the offsets into the read/write buffer structures */ rs_addr = 0 head = 4 tail = 8 proc_list = 12 buf = 16 startup = 256 /* chars left in write queue when we restart it */ /* * These are the actual interrupt routines. They look where * the interrupt is coming from, and take appropriate action. */ .align 2 rs1_interrupt: pushl $table_list+8 jmp rs_int .align 2 rs2_interrupt: pushl $table_list+16 rs_int: pushl %edx pushl %ecx pushl %ebx pushl %eax push %es push %ds /* as this is an interrupt, we cannot */ pushl $0x10 /* know that bs is ok. Load it */ pop %ds pushl $0x10 pop %es movl 24(%esp),%edx movl (%edx),%edx movl rs_addr(%edx),%edx addl $2,%edx /* interrupt ident. reg */ rep_int: xorl %eax,%eax inb %dx,%al testb $1,%al jne end cmpb $6,%al /* this shouldn't happen, but ... */ ja end movl 24(%esp),%ecx pushl %edx subl $2,%edx call jmp_table(,%eax,2) /* NOTE! not *4, bit0 is 0 already */ popl %edx jmp rep_int end: movb $0x20,%al outb %al,$0x20 /* EOI */ pop %ds pop %es popl %eax popl %ebx popl %ecx popl %edx addl $4,%esp # jump over _table_list entry iret jmp_table: .long modem_status,write_char,read_char,line_status .align 2 modem_status: addl $6,%edx /* clear intr by reading modem status reg */ inb %dx,%al ret .align 2 line_status: addl $5,%edx /* clear intr by reading line status reg. */ inb %dx,%al ret .align 2 read_char: inb %dx,%al movl %ecx,%edx subl $table_list,%edx shrl $3,%edx movl (%ecx),%ecx # read-queue movl head(%ecx),%ebx movb %al,buf(%ecx,%ebx) incl %ebx andl $size-1,%ebx cmpl tail(%ecx),%ebx je 1f movl %ebx,head(%ecx) 1: pushl %edx call do_tty_interrupt addl $4,%esp ret .align 2 write_char: movl 4(%ecx),%ecx # write-queue movl head(%ecx),%ebx subl tail(%ecx),%ebx andl $size-1,%ebx # nr chars in queue je write_buffer_empty cmpl $startup,%ebx ja 1f movl proc_list(%ecx),%ebx # wake up sleeping process testl %ebx,%ebx # is there any? je 1f movl $0,(%ebx) 1: movl tail(%ecx),%ebx movb buf(%ecx,%ebx),%al outb %al,%dx incl %ebx andl $size-1,%ebx movl %ebx,tail(%ecx) cmpl head(%ecx),%ebx je write_buffer_empty ret .align 2 write_buffer_empty: movl proc_list(%ecx),%ebx # wake up sleeping process testl %ebx,%ebx # is there any? je 1f movl $0,(%ebx) 1: incl %edx inb %dx,%al jmp 1f 1: jmp 1f 1: andb $0xd,%al /* disable transmit interrupt */ outb %al,%dx ret
Wangzhike/HIT-Linux-0.11
12,774
2-syscall/linux-0.11/kernel/chr_drv/keyboard.S
/* * linux/kernel/keyboard.S * * (C) 1991 Linus Torvalds */ /* * Thanks to Alfred Leung for US keyboard patches * Wolfgang Thiel for German keyboard patches * Marc Corsini for the French keyboard */ #include <linux/config.h> .text .globl keyboard_interrupt /* * these are for the keyboard read functions */ size = 1024 /* must be a power of two ! And MUST be the same as in tty_io.c !!!! */ head = 4 tail = 8 proc_list = 12 buf = 16 mode: .byte 0 /* caps, alt, ctrl and shift mode */ leds: .byte 2 /* num-lock, caps, scroll-lock mode (nom-lock on) */ e0: .byte 0 /* * con_int is the real interrupt routine that reads the * keyboard scan-code and converts it into the appropriate * ascii character(s). */ keyboard_interrupt: pushl %eax pushl %ebx pushl %ecx pushl %edx push %ds push %es movl $0x10,%eax mov %ax,%ds mov %ax,%es xor %al,%al /* %eax is scan code */ inb $0x60,%al cmpb $0xe0,%al je set_e0 cmpb $0xe1,%al je set_e1 call key_table(,%eax,4) movb $0,e0 e0_e1: inb $0x61,%al jmp 1f 1: jmp 1f 1: orb $0x80,%al jmp 1f 1: jmp 1f 1: outb %al,$0x61 jmp 1f 1: jmp 1f 1: andb $0x7F,%al outb %al,$0x61 movb $0x20,%al outb %al,$0x20 pushl $0 call do_tty_interrupt addl $4,%esp pop %es pop %ds popl %edx popl %ecx popl %ebx popl %eax iret set_e0: movb $1,e0 jmp e0_e1 set_e1: movb $2,e0 jmp e0_e1 /* * This routine fills the buffer with max 8 bytes, taken from * %ebx:%eax. (%edx is high). The bytes are written in the * order %al,%ah,%eal,%eah,%bl,%bh ... until %eax is zero. */ put_queue: pushl %ecx pushl %edx movl table_list,%edx # read-queue for console movl head(%edx),%ecx 1: movb %al,buf(%edx,%ecx) incl %ecx andl $size-1,%ecx cmpl tail(%edx),%ecx # buffer full - discard everything je 3f shrdl $8,%ebx,%eax je 2f shrl $8,%ebx jmp 1b 2: movl %ecx,head(%edx) movl proc_list(%edx),%ecx testl %ecx,%ecx je 3f movl $0,(%ecx) 3: popl %edx popl %ecx ret ctrl: movb $0x04,%al jmp 1f alt: movb $0x10,%al 1: cmpb $0,e0 je 2f addb %al,%al 2: orb %al,mode ret unctrl: movb $0x04,%al jmp 1f unalt: movb $0x10,%al 1: cmpb $0,e0 je 2f addb %al,%al 2: notb %al andb %al,mode ret lshift: orb $0x01,mode ret unlshift: andb $0xfe,mode ret rshift: orb $0x02,mode ret unrshift: andb $0xfd,mode ret caps: testb $0x80,mode jne 1f xorb $4,leds xorb $0x40,mode orb $0x80,mode set_leds: call kb_wait movb $0xed,%al /* set leds command */ outb %al,$0x60 call kb_wait movb leds,%al outb %al,$0x60 ret uncaps: andb $0x7f,mode ret scroll: xorb $1,leds jmp set_leds num: xorb $2,leds jmp set_leds /* * curosr-key/numeric keypad cursor keys are handled here. * checking for numeric keypad etc. */ cursor: subb $0x47,%al jb 1f cmpb $12,%al ja 1f jne cur2 /* check for ctrl-alt-del */ testb $0x0c,mode je cur2 testb $0x30,mode jne reboot cur2: cmpb $0x01,e0 /* e0 forces cursor movement */ je cur testb $0x02,leds /* not num-lock forces cursor */ je cur testb $0x03,mode /* shift forces cursor */ jne cur xorl %ebx,%ebx movb num_table(%eax),%al jmp put_queue 1: ret cur: movb cur_table(%eax),%al cmpb $'9,%al ja ok_cur movb $'~,%ah ok_cur: shll $16,%eax movw $0x5b1b,%ax xorl %ebx,%ebx jmp put_queue #if defined(KBD_FR) num_table: .ascii "789 456 1230." #else num_table: .ascii "789 456 1230," #endif cur_table: .ascii "HA5 DGC YB623" /* * this routine handles function keys */ func: pushl %eax pushl %ecx pushl %edx call show_stat popl %edx popl %ecx popl %eax subb $0x3B,%al jb end_func cmpb $9,%al jbe ok_func subb $18,%al cmpb $10,%al jb end_func cmpb $11,%al ja end_func ok_func: cmpl $4,%ecx /* check that there is enough room */ jl end_func movl func_table(,%eax,4),%eax xorl %ebx,%ebx jmp put_queue end_func: ret /* * function keys send F1:'esc [ [ A' F2:'esc [ [ B' etc. */ func_table: .long 0x415b5b1b,0x425b5b1b,0x435b5b1b,0x445b5b1b .long 0x455b5b1b,0x465b5b1b,0x475b5b1b,0x485b5b1b .long 0x495b5b1b,0x4a5b5b1b,0x4b5b5b1b,0x4c5b5b1b #if defined(KBD_FINNISH) key_map: .byte 0,27 .ascii "1234567890+'" .byte 127,9 .ascii "qwertyuiop}" .byte 0,13,0 .ascii "asdfghjkl|{" .byte 0,0 .ascii "'zxcvbnm,.-" .byte 0,'*,0,32 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte '-,0,0,0,'+ /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '< .fill 10,1,0 shift_map: .byte 0,27 .ascii "!\"#$%&/()=?`" .byte 127,9 .ascii "QWERTYUIOP]^" .byte 13,0 .ascii "ASDFGHJKL\\[" .byte 0,0 .ascii "*ZXCVBNM;:_" .byte 0,'*,0,32 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte '-,0,0,0,'+ /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '> .fill 10,1,0 alt_map: .byte 0,0 .ascii "\0@\0$\0\0{[]}\\\0" .byte 0,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte '~,13,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte 0,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte 0,0,0,0 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte 0,0,0,0,0 /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '| .fill 10,1,0 #elif defined(KBD_US) key_map: .byte 0,27 .ascii "1234567890-=" .byte 127,9 .ascii "qwertyuiop[]" .byte 13,0 .ascii "asdfghjkl;'" .byte '`,0 .ascii "\\zxcvbnm,./" .byte 0,'*,0,32 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte '-,0,0,0,'+ /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '< .fill 10,1,0 shift_map: .byte 0,27 .ascii "!@#$%^&*()_+" .byte 127,9 .ascii "QWERTYUIOP{}" .byte 13,0 .ascii "ASDFGHJKL:\"" .byte '~,0 .ascii "|ZXCVBNM<>?" .byte 0,'*,0,32 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte '-,0,0,0,'+ /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '> .fill 10,1,0 alt_map: .byte 0,0 .ascii "\0@\0$\0\0{[]}\\\0" .byte 0,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte '~,13,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte 0,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte 0,0,0,0 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte 0,0,0,0,0 /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '| .fill 10,1,0 #elif defined(KBD_GR) key_map: .byte 0,27 .ascii "1234567890\\'" .byte 127,9 .ascii "qwertzuiop@+" .byte 13,0 .ascii "asdfghjkl[]^" .byte 0,'# .ascii "yxcvbnm,.-" .byte 0,'*,0,32 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte '-,0,0,0,'+ /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '< .fill 10,1,0 shift_map: .byte 0,27 .ascii "!\"#$%&/()=?`" .byte 127,9 .ascii "QWERTZUIOP\\*" .byte 13,0 .ascii "ASDFGHJKL{}~" .byte 0,'' .ascii "YXCVBNM;:_" .byte 0,'*,0,32 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte '-,0,0,0,'+ /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '> .fill 10,1,0 alt_map: .byte 0,0 .ascii "\0@\0$\0\0{[]}\\\0" .byte 0,0 .byte '@,0,0,0,0,0,0,0,0,0,0 .byte '~,13,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte 0,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte 0,0,0,0 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte 0,0,0,0,0 /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '| .fill 10,1,0 #elif defined(KBD_FR) key_map: .byte 0,27 .ascii "&{\"'(-}_/@)=" .byte 127,9 .ascii "azertyuiop^$" .byte 13,0 .ascii "qsdfghjklm|" .byte '`,0,42 /* coin sup gauche, don't know, [*|mu] */ .ascii "wxcvbn,;:!" .byte 0,'*,0,32 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte '-,0,0,0,'+ /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '< .fill 10,1,0 shift_map: .byte 0,27 .ascii "1234567890]+" .byte 127,9 .ascii "AZERTYUIOP<>" .byte 13,0 .ascii "QSDFGHJKLM%" .byte '~,0,'# .ascii "WXCVBN?./\\" .byte 0,'*,0,32 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte '-,0,0,0,'+ /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '> .fill 10,1,0 alt_map: .byte 0,0 .ascii "\0~#{[|`\\^@]}" .byte 0,0 .byte '@,0,0,0,0,0,0,0,0,0,0 .byte '~,13,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte 0,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte 0,0,0,0 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte 0,0,0,0,0 /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '| .fill 10,1,0 #else #error "KBD-type not defined" #endif /* * do_self handles "normal" keys, ie keys that don't change meaning * and which have just one character returns. */ do_self: lea alt_map,%ebx testb $0x20,mode /* alt-gr */ jne 1f lea shift_map,%ebx testb $0x03,mode jne 1f lea key_map,%ebx 1: movb (%ebx,%eax),%al orb %al,%al je none testb $0x4c,mode /* ctrl or caps */ je 2f cmpb $'a,%al jb 2f cmpb $'},%al ja 2f subb $32,%al 2: testb $0x0c,mode /* ctrl */ je 3f cmpb $64,%al jb 3f cmpb $64+32,%al jae 3f subb $64,%al 3: testb $0x10,mode /* left alt */ je 4f orb $0x80,%al 4: andl $0xff,%eax xorl %ebx,%ebx call put_queue none: ret /* * minus has a routine of it's own, as a 'E0h' before * the scan code for minus means that the numeric keypad * slash was pushed. */ minus: cmpb $1,e0 jne do_self movl $'/,%eax xorl %ebx,%ebx jmp put_queue /* * This table decides which routine to call when a scan-code has been * gotten. Most routines just call do_self, or none, depending if * they are make or break. */ key_table: .long none,do_self,do_self,do_self /* 00-03 s0 esc 1 2 */ .long do_self,do_self,do_self,do_self /* 04-07 3 4 5 6 */ .long do_self,do_self,do_self,do_self /* 08-0B 7 8 9 0 */ .long do_self,do_self,do_self,do_self /* 0C-0F + ' bs tab */ .long do_self,do_self,do_self,do_self /* 10-13 q w e r */ .long do_self,do_self,do_self,do_self /* 14-17 t y u i */ .long do_self,do_self,do_self,do_self /* 18-1B o p } ^ */ .long do_self,ctrl,do_self,do_self /* 1C-1F enter ctrl a s */ .long do_self,do_self,do_self,do_self /* 20-23 d f g h */ .long do_self,do_self,do_self,do_self /* 24-27 j k l | */ .long do_self,do_self,lshift,do_self /* 28-2B { para lshift , */ .long do_self,do_self,do_self,do_self /* 2C-2F z x c v */ .long do_self,do_self,do_self,do_self /* 30-33 b n m , */ .long do_self,minus,rshift,do_self /* 34-37 . - rshift * */ .long alt,do_self,caps,func /* 38-3B alt sp caps f1 */ .long func,func,func,func /* 3C-3F f2 f3 f4 f5 */ .long func,func,func,func /* 40-43 f6 f7 f8 f9 */ .long func,num,scroll,cursor /* 44-47 f10 num scr home */ .long cursor,cursor,do_self,cursor /* 48-4B up pgup - left */ .long cursor,cursor,do_self,cursor /* 4C-4F n5 right + end */ .long cursor,cursor,cursor,cursor /* 50-53 dn pgdn ins del */ .long none,none,do_self,func /* 54-57 sysreq ? < f11 */ .long func,none,none,none /* 58-5B f12 ? ? ? */ .long none,none,none,none /* 5C-5F ? ? ? ? */ .long none,none,none,none /* 60-63 ? ? ? ? */ .long none,none,none,none /* 64-67 ? ? ? ? */ .long none,none,none,none /* 68-6B ? ? ? ? */ .long none,none,none,none /* 6C-6F ? ? ? ? */ .long none,none,none,none /* 70-73 ? ? ? ? */ .long none,none,none,none /* 74-77 ? ? ? ? */ .long none,none,none,none /* 78-7B ? ? ? ? */ .long none,none,none,none /* 7C-7F ? ? ? ? */ .long none,none,none,none /* 80-83 ? br br br */ .long none,none,none,none /* 84-87 br br br br */ .long none,none,none,none /* 88-8B br br br br */ .long none,none,none,none /* 8C-8F br br br br */ .long none,none,none,none /* 90-93 br br br br */ .long none,none,none,none /* 94-97 br br br br */ .long none,none,none,none /* 98-9B br br br br */ .long none,unctrl,none,none /* 9C-9F br unctrl br br */ .long none,none,none,none /* A0-A3 br br br br */ .long none,none,none,none /* A4-A7 br br br br */ .long none,none,unlshift,none /* A8-AB br br unlshift br */ .long none,none,none,none /* AC-AF br br br br */ .long none,none,none,none /* B0-B3 br br br br */ .long none,none,unrshift,none /* B4-B7 br br unrshift br */ .long unalt,none,uncaps,none /* B8-BB unalt br uncaps br */ .long none,none,none,none /* BC-BF br br br br */ .long none,none,none,none /* C0-C3 br br br br */ .long none,none,none,none /* C4-C7 br br br br */ .long none,none,none,none /* C8-CB br br br br */ .long none,none,none,none /* CC-CF br br br br */ .long none,none,none,none /* D0-D3 br br br br */ .long none,none,none,none /* D4-D7 br br br br */ .long none,none,none,none /* D8-DB br ? ? ? */ .long none,none,none,none /* DC-DF ? ? ? ? */ .long none,none,none,none /* E0-E3 e0 e1 ? ? */ .long none,none,none,none /* E4-E7 ? ? ? ? */ .long none,none,none,none /* E8-EB ? ? ? ? */ .long none,none,none,none /* EC-EF ? ? ? ? */ .long none,none,none,none /* F0-F3 ? ? ? ? */ .long none,none,none,none /* F4-F7 ? ? ? ? */ .long none,none,none,none /* F8-FB ? ? ? ? */ .long none,none,none,none /* FC-FF ? ? ? ? */ /* * kb_wait waits for the keyboard controller buffer to empty. * there is no timeout - if the buffer doesn't empty, we hang. */ kb_wait: pushl %eax 1: inb $0x64,%al testb $0x02,%al jne 1b popl %eax ret /* * This routine reboots the machine by asking the keyboard * controller to pulse the reset-line low. */ reboot: call kb_wait movw $0x1234,0x472 /* don't do memory check */ movb $0xfc,%al /* pulse reset and A20 low */ outb %al,$0x64 die: jmp die
Wangzhike/HIT-Linux-0.11
5,473
5-semaphore/linux-0.11/boot/bootsect.s
! ! SYS_SIZE is the number of clicks (16 bytes) to be loaded. ! 0x3000 is 0x30000 bytes = 196kB, more than enough for current ! versions of linux ! SYSSIZE = 0x3000 ! ! bootsect.s (C) 1991 Linus Torvalds ! ! bootsect.s is loaded at 0x7c00 by the bios-startup routines, and moves ! iself out of the way to address 0x90000, and jumps there. ! ! It then loads 'setup' directly after itself (0x90200), and the system ! at 0x10000, using BIOS interrupts. ! ! NOTE! currently system is at most 8*65536 bytes long. This should be no ! problem, even in the future. I want to keep it simple. This 512 kB ! kernel size should be enough, especially as this doesn't contain the ! buffer cache as in minix ! ! The loader has been made as simple as possible, and continuos ! read errors will result in a unbreakable loop. Reboot by hand. It ! loads pretty fast by getting whole sectors at a time whenever possible. .globl begtext, begdata, begbss, endtext, enddata, endbss .text begtext: .data begdata: .bss begbss: .text SETUPLEN = 4 ! nr of setup-sectors BOOTSEG = 0x07c0 ! original address of boot-sector INITSEG = 0x9000 ! we move boot here - out of the way SETUPSEG = 0x9020 ! setup starts here SYSSEG = 0x1000 ! system loaded at 0x10000 (65536). ENDSEG = SYSSEG + SYSSIZE ! where to stop loading ! ROOT_DEV: 0x000 - same type of floppy as boot. ! 0x301 - first partition on first drive etc ROOT_DEV = 0x306 entry _start _start: mov ax,#BOOTSEG mov ds,ax mov ax,#INITSEG mov es,ax mov cx,#256 sub si,si sub di,di rep movw jmpi go,INITSEG go: mov ax,cs mov ds,ax mov es,ax ! put stack at 0x9ff00. mov ss,ax mov sp,#0xFF00 ! arbitrary value >>512 ! load the setup-sectors directly after the bootblock. ! Note that 'es' is already set up. load_setup: mov dx,#0x0000 ! drive 0, head 0 mov cx,#0x0002 ! sector 2, track 0 mov bx,#0x0200 ! address = 512, in INITSEG mov ax,#0x0200+SETUPLEN ! service 2, nr of sectors int 0x13 ! read it jnc ok_load_setup ! ok - continue mov dx,#0x0000 mov ax,#0x0000 ! reset the diskette int 0x13 j load_setup ok_load_setup: ! Get disk drive parameters, specifically nr of sectors/track mov dl,#0x00 mov ax,#0x0800 ! AH=8 is get drive parameters int 0x13 mov ch,#0x00 seg cs mov sectors,cx mov ax,#INITSEG mov es,ax ! Print some inane message call read_cursor mov cx,#2 mov bx,#0x0007 ! page 0, attribute 7 (normal, white color) mov bp,#msg1 mov ax,#0x1301 ! write string, move cursor int 0x10 call read_cursor mov cx, #6 mov bx, #0x0009 ! page 0, attribute 9(bright blue color) mov bp, #msg1+2 mov ax, #0x1301 ! write string, move cursor int 0x10 call read_cursor mov cx, #18 mov bx, #0x0007 ! page 0, attribute 7(normal, white color) mov bp, #msg1+8 mov ax, #0x1301 ! write string, move cursor int 0x10 ! ok, we've written the message, now ! we want to load the system (at 0x10000) mov ax,#SYSSEG mov es,ax ! segment of 0x010000 call read_it call kill_motor ! After that we check which root-device to use. If the device is ! defined (!= 0), nothing is done and the given device is used. ! Otherwise, either /dev/PS0 (2,28) or /dev/at0 (2,8), depending ! on the number of sectors that the BIOS reports currently. seg cs mov ax,root_dev cmp ax,#0 jne root_defined seg cs mov bx,sectors mov ax,#0x0208 ! /dev/ps0 - 1.2Mb cmp bx,#15 je root_defined mov ax,#0x021c ! /dev/PS0 - 1.44Mb cmp bx,#18 je root_defined undef_root: jmp undef_root root_defined: seg cs mov root_dev,ax ! after that (everyting loaded), we jump to ! the setup-routine loaded directly after ! the bootblock: jmpi 0,SETUPSEG ! This routine loads the system at address 0x10000, making sure ! no 64kB boundaries are crossed. We try to load it as fast as ! possible, loading whole tracks whenever we can. ! ! in: es - starting address segment (normally 0x1000) ! sread: .word 1+SETUPLEN ! sectors read of current track head: .word 0 ! current head track: .word 0 ! current track read_it: mov ax,es test ax,#0x0fff die: jne die ! es must be at 64kB boundary xor bx,bx ! bx is starting address within segment rp_read: mov ax,es cmp ax,#ENDSEG ! have we loaded all yet? jb ok1_read ret ok1_read: seg cs mov ax,sectors sub ax,sread mov cx,ax shl cx,#9 add cx,bx jnc ok2_read je ok2_read xor ax,ax sub ax,bx shr ax,#9 ok2_read: call read_track mov cx,ax add ax,sread seg cs cmp ax,sectors jne ok3_read mov ax,#1 sub ax,head jne ok4_read inc track ok4_read: mov head,ax xor ax,ax ok3_read: mov sread,ax shl cx,#9 add bx,cx jnc rp_read mov ax,es add ax,#0x1000 mov es,ax xor bx,bx jmp rp_read read_track: push ax push bx push cx push dx mov dx,track mov cx,sread inc cx mov ch,dl mov dx,head mov dh,dl mov dl,#0 and dx,#0x0100 mov ah,#2 int 0x13 jc bad_rt pop dx pop cx pop bx pop ax ret bad_rt: mov ax,#0 mov dx,#0 int 0x13 pop dx pop cx pop bx pop ax jmp read_track read_cursor: push ax push bx mov ah,#0x03 ! read cursor pos xor bh,bh int 0x10 pop bx pop ax ret !/* ! * This procedure turns off the floppy drive motor, so ! * that we enter the kernel in a known state, and ! * don't have to worry about it later. ! */ kill_motor: push dx mov dx,#0x3f2 mov al,#0 outb pop dx ret sectors: .word 0 msg1: .byte 13,10 .ascii "Qiunix is loading..." .byte 13,10,13,10 .org 508 root_dev: .word ROOT_DEV boot_flag: .word 0xAA55 .text endtext: .data enddata: .bss endbss:
Wangzhike/HIT-Linux-0.11
8,626
5-semaphore/linux-0.11/boot/setup.s
! ! setup.s (C) 1991 Linus Torvalds ! ! setup.s is responsible for getting the system data from the BIOS, ! and putting them into the appropriate places in system memory. ! both setup.s and system has been loaded by the bootblock. ! ! This code asks the bios for memory/disk/other parameters, and ! puts them in a "safe" place: 0x90000-0x901FF, ie where the ! boot-block used to be. It is then up to the protected mode ! system to read them from there before the area is overwritten ! for buffer-blocks. ! ! NOTE! These had better be the same as in bootsect.s! INITSEG = 0x9000 ! we move boot here - out of the way SYSSEG = 0x1000 ! system loaded at 0x10000 (65536). SETUPSEG = 0x9020 ! this is the current segment .globl begtext, begdata, begbss, endtext, enddata, endbss .text begtext: .data begdata: .bss begbss: .text entry start start: ! repeat set stack, although it is done in bootsect.s mov ax, #INITSEG mov ss, ax mov sp, #0xFF00 ! now we are in setup ,print the message. mov ax, #SETUPSEG mov es, ax call read_cursor mov cx, #14 mov bx, #0x0007 ! page 0, attribute 10(bright green) mov bp, #msg mov ax, #0x1301 ! write string, move cursor int 0x10 call read_cursor mov cx, #5 mov bx, #0x000a ! page 0, attribute 7(normal, white color) mov bp, #msg+14 mov ax, #0x1301 int 0x10 call print_nl call print_nl ! ok, the read went well so we get current cursor position and save it for ! posterity. mov ax,#INITSEG ! this is done in bootsect already, but... mov ds,ax mov ah,#0x03 ! read cursor pos xor bh,bh int 0x10 ! save it in known place, con_init fetches mov [0],dx ! it from 0x90000. ! Get memory size (extended mem, kB) mov ax, #INITSEG ! this is done in bootsect already, but... mov ds, ax mov ah,#0x88 int 0x15 mov [2],ax ! Get video-card data: mov ah,#0x0f int 0x10 mov [4],bx ! bh = display page mov [6],ax ! al = video mode, ah = window width ! check for EGA/VGA and some config parameters mov ah,#0x12 mov bl,#0x10 int 0x10 mov [8],ax mov [10],bx mov [12],cx ! Get hd0 data mov ax,#0x0000 mov ds,ax lds si,[4*0x41] mov ax,#INITSEG mov es,ax mov di,#0x0080 mov cx,#0x10 rep movsb ! Get hd1 data mov ax,#0x0000 mov ds,ax lds si,[4*0x46] mov ax,#INITSEG mov es,ax mov di,#0x0090 mov cx,#0x10 rep movsb ! Check that there IS a hd1 :-) mov ax,#0x01500 mov dl,#0x81 int 0x13 jc no_disk1 cmp ah,#3 je is_disk1 no_disk1: mov ax,#INITSEG mov es,ax mov di,#0x0090 mov cx,#0x10 mov ax,#0x00 rep stosb is_disk1: ! now, we have read some system parameters, print thees parameters. mov ax, #INITSEG mov ds, ax mov ax, #SETUPSEG mov es, ax ! print cursor position call read_cursor mov cx, #17 mov bx, #0x000a ! page 0, attribute 10(normal, bright gren color) mov bp, #cursor mov ax, #0x1301 int 0x10 mov bp, #0x0000 call print_hex call print_nl ! print memory size call read_cursor mov cx, #13 mov bx, #0x000a ! page 0, attribue 10(normal, bright green color) mov bp, #memory mov ax, #0x1301 int 0x10 mov ax, [2] add ax, #1024 mov memsize, ax mov bp, #memsize call print_hex call read_cursor mov cx, #2 mov bx, #0x0007 mov bp, #memory+13 mov ax, #0x1301 int 0x10 call print_nl ! print hd0 cylinders call read_cursor mov cx, #15 mov bx, #0x000a ! page 0, attribute 10(normal, bright green color) mov bp, #cylinder mov ax, #0x1301 int 0x10 call read_cursor mov bp, #0x0080 call print_hex call print_nl ! print hd0 heads call read_cursor mov cx, #11 mov bx, #0x000a ! page 0, attribute 10(normal, bright green color) mov bp, #head mov ax, #0x1301 int 0x10 mov bp, #0x0082 call print_hex call print_nl ! print hd0 sectors call read_cursor mov cx, #13 mov bx, #0x000a ! page 0, attribute 10(normal, bright green color) mov bp, #sector mov ax, #0x1301 int 0x10 mov bp, #0x008E call print_hex call print_nl call print_nl ! ok, the read went well so we get current cursor position and save it for ! posterity. mov ax,#INITSEG ! this is done in bootsect already, but... mov ds,ax mov ah,#0x03 ! read cursor pos xor bh,bh int 0x10 ! save it in known place, con_init fetches mov [0],dx ! it from 0x90000. ! Get video-card data: mov ah,#0x0f int 0x10 mov [4],bx ! bh = display page mov [6],ax ! al = video mode, ah = window width ! now we want to move to protected mode ... cli ! no interrupts allowed ! ! first we move the system to it's rightful place mov ax,#0x0000 cld ! 'direction'=0, movs moves forward do_move: mov es,ax ! destination segment add ax,#0x1000 cmp ax,#0x9000 jz end_move mov ds,ax ! source segment sub di,di sub si,si mov cx,#0x8000 rep movsw jmp do_move ! then we load the segment descriptors end_move: mov ax,#SETUPSEG ! right, forgot this at first. didn't work :-) mov ds,ax lidt idt_48 ! load idt with 0,0 lgdt gdt_48 ! load gdt with whatever appropriate ! that was painless, now we enable A20 call empty_8042 mov al,#0xD1 ! command write out #0x64,al call empty_8042 mov al,#0xDF ! A20 on out #0x60,al call empty_8042 ! well, that went ok, I hope. Now we have to reprogram the interrupts :-( ! we put them right after the intel-reserved hardware interrupts, at ! int 0x20-0x2F. There they won't mess up anything. Sadly IBM really ! messed this up with the original PC, and they haven't been able to ! rectify it afterwards. Thus the bios puts interrupts at 0x08-0x0f, ! which is used for the internal hardware interrupts as well. We just ! have to reprogram the 8259's, and it isn't fun. mov al,#0x11 ! initialization sequence out #0x20,al ! send it to 8259A-1 .word 0x00eb,0x00eb ! jmp $+2, jmp $+2 out #0xA0,al ! and to 8259A-2 .word 0x00eb,0x00eb mov al,#0x20 ! start of hardware int's (0x20) out #0x21,al .word 0x00eb,0x00eb mov al,#0x28 ! start of hardware int's 2 (0x28) out #0xA1,al .word 0x00eb,0x00eb mov al,#0x04 ! 8259-1 is master out #0x21,al .word 0x00eb,0x00eb mov al,#0x02 ! 8259-2 is slave out #0xA1,al .word 0x00eb,0x00eb mov al,#0x01 ! 8086 mode for both out #0x21,al .word 0x00eb,0x00eb out #0xA1,al .word 0x00eb,0x00eb mov al,#0xFF ! mask off all interrupts for now out #0x21,al .word 0x00eb,0x00eb out #0xA1,al ! well, that certainly wasn't fun :-(. Hopefully it works, and we don't ! need no steenking BIOS anyway (except for the initial loading :-). ! The BIOS-routine wants lots of unnecessary data, and it's less ! "interesting" anyway. This is how REAL programmers do it. ! ! Well, now's the time to actually move into protected mode. To make ! things as simple as possible, we do no register set-up or anything, ! we let the gnu-compiled 32-bit programs do that. We just jump to ! absolute address 0x00000, in 32-bit protected mode. mov ax,#0x0001 ! protected mode (PE) bit lmsw ax ! This is it! jmpi 0,8 ! jmp offset 0 of segment 8 (cs) ! This routine checks that the keyboard command queue is empty ! No timeout is used - if this hangs there is something wrong with ! the machine, and we probably couldn't proceed anyway. empty_8042: .word 0x00eb,0x00eb in al,#0x64 ! 8042 status port test al,#2 ! is input buffer full? jnz empty_8042 ! yes - loop ret !以16进制方式打印栈顶的16位数 print_hex: push ax push bx push cx push dx mov ax, #0x0e30 ! 0 int 0x10 mov ax, #0x0e78 ! x int 0x10 mov cx, #4 mov dx, (bp) print_digit: rol dx, #4 mov ax, #0x0e0f mov bl, #0x0f ! bright green color and al, dl add al,#0x30 cmp al, #0x3a jl outp ! if less,是一个不大于9的数字 add al, #0x07 ! 是a~f,要加7 outp: int 0x10 loop print_digit pop dx pop cx pop bx pop ax ret print_nl: push ax push bx mov ax, #0x0e0d ! CR int 0x10 mov ax, #0x0e0A ! LR int 0x10 pop bx pop ax ret read_cursor: push ax push bx push cx mov ah, #0x03 ! read cursor pos xor bh, bh int 0x10 pop cx pop bx pop ax ret gdt: .word 0,0,0,0 ! dummy .word 0x07FF ! 8Mb - limit=2047 (2048*4096=8Mb) .word 0x0000 ! base address=0 .word 0x9A00 ! code read/exec .word 0x00C0 ! granularity=4096, 386 .word 0x07FF ! 8Mb - limit=2047 (2048*4096=8Mb) .word 0x0000 ! base address=0 .word 0x9200 ! data read/write .word 0x00C0 ! granularity=4096, 386 idt_48: .word 0 ! idt limit=0 .word 0,0 ! idt base=0L gdt_48: .word 0x800 ! gdt limit=2048, 256 GDT entries .word 512+gdt,0x9 ! gdt base = 0X9xxxx msg: .ascii "Now we are in SETUP" cursor: .ascii "Cursor Position: " .ascii "KB" memory: .ascii "Memory Size: KB" cylinder: .ascii "HD0 cylinders: " head: .ascii "HD0 heads: " sector: .ascii "HD0 sectors: " memsize: .word 0x0000 .text endtext: .data enddata: .bss endbss:
Wangzhike/HIT-Linux-0.11
5,938
5-semaphore/linux-0.11/boot/head.s
/* * linux/boot/head.s * * (C) 1991 Linus Torvalds */ /* * head.s contains the 32-bit startup code. * * NOTE!!! Startup happens at absolute address 0x00000000, which is also where * the page directory will exist. The startup code will be overwritten by * the page directory. */ .text .globl idt,gdt,pg_dir,tmp_floppy_area pg_dir: .globl startup_32 startup_32: movl $0x10,%eax mov %ax,%ds mov %ax,%es mov %ax,%fs mov %ax,%gs lss stack_start,%esp call setup_idt call setup_gdt movl $0x10,%eax # reload all the segment registers mov %ax,%ds # after changing gdt. CS was already mov %ax,%es # reloaded in 'setup_gdt' mov %ax,%fs mov %ax,%gs lss stack_start,%esp xorl %eax,%eax 1: incl %eax # check that A20 really IS enabled movl %eax,0x000000 # loop forever if it isn't cmpl %eax,0x100000 je 1b /* * NOTE! 486 should set bit 16, to check for write-protect in supervisor * mode. Then it would be unnecessary with the "verify_area()"-calls. * 486 users probably want to set the NE (#5) bit also, so as to use * int 16 for math errors. */ movl %cr0,%eax # check math chip andl $0x80000011,%eax # Save PG,PE,ET /* "orl $0x10020,%eax" here for 486 might be good */ orl $2,%eax # set MP movl %eax,%cr0 call check_x87 jmp after_page_tables /* * We depend on ET to be correct. This checks for 287/387. */ check_x87: fninit fstsw %ax cmpb $0,%al je 1f /* no coprocessor: have to set bits */ movl %cr0,%eax xorl $6,%eax /* reset MP, set EM */ movl %eax,%cr0 ret .align 2 1: .byte 0xDB,0xE4 /* fsetpm for 287, ignored by 387 */ ret /* * setup_idt * * sets up a idt with 256 entries pointing to * ignore_int, interrupt gates. It then loads * idt. Everything that wants to install itself * in the idt-table may do so themselves. Interrupts * are enabled elsewhere, when we can be relatively * sure everything is ok. This routine will be over- * written by the page tables. */ setup_idt: lea ignore_int,%edx movl $0x00080000,%eax movw %dx,%ax /* selector = 0x0008 = cs */ movw $0x8E00,%dx /* interrupt gate - dpl=0, present */ lea idt,%edi mov $256,%ecx rp_sidt: movl %eax,(%edi) movl %edx,4(%edi) addl $8,%edi dec %ecx jne rp_sidt lidt idt_descr ret /* * setup_gdt * * This routines sets up a new gdt and loads it. * Only two entries are currently built, the same * ones that were built in init.s. The routine * is VERY complicated at two whole lines, so this * rather long comment is certainly needed :-). * This routine will beoverwritten by the page tables. */ setup_gdt: lgdt gdt_descr ret /* * I put the kernel page tables right after the page directory, * using 4 of them to span 16 Mb of physical memory. People with * more than 16MB will have to expand this. */ .org 0x1000 pg0: .org 0x2000 pg1: .org 0x3000 pg2: .org 0x4000 pg3: .org 0x5000 /* * tmp_floppy_area is used by the floppy-driver when DMA cannot * reach to a buffer-block. It needs to be aligned, so that it isn't * on a 64kB border. */ tmp_floppy_area: .fill 1024,1,0 after_page_tables: pushl $0 # These are the parameters to main :-) pushl $0 pushl $0 pushl $L6 # return address for main, if it decides to. pushl $main jmp setup_paging L6: jmp L6 # main should never return here, but # just in case, we know what happens. /* This is the default interrupt "handler" :-) */ int_msg: .asciz "Unknown interrupt\n\r" .align 2 ignore_int: pushl %eax pushl %ecx pushl %edx push %ds push %es push %fs movl $0x10,%eax mov %ax,%ds mov %ax,%es mov %ax,%fs pushl $int_msg call printk popl %eax pop %fs pop %es pop %ds popl %edx popl %ecx popl %eax iret /* * Setup_paging * * This routine sets up paging by setting the page bit * in cr0. The page tables are set up, identity-mapping * the first 16MB. The pager assumes that no illegal * addresses are produced (ie >4Mb on a 4Mb machine). * * NOTE! Although all physical memory should be identity * mapped by this routine, only the kernel page functions * use the >1Mb addresses directly. All "normal" functions * use just the lower 1Mb, or the local data space, which * will be mapped to some other place - mm keeps track of * that. * * For those with more memory than 16 Mb - tough luck. I've * not got it, why should you :-) The source is here. Change * it. (Seriously - it shouldn't be too difficult. Mostly * change some constants etc. I left it at 16Mb, as my machine * even cannot be extended past that (ok, but it was cheap :-) * I've tried to show which constants to change by having * some kind of marker at them (search for "16Mb"), but I * won't guarantee that's all :-( ) */ .align 2 setup_paging: movl $1024*5,%ecx /* 5 pages - pg_dir+4 page tables */ xorl %eax,%eax xorl %edi,%edi /* pg_dir is at 0x000 */ cld;rep;stosl movl $pg0+7,pg_dir /* set present bit/user r/w */ movl $pg1+7,pg_dir+4 /* --------- " " --------- */ movl $pg2+7,pg_dir+8 /* --------- " " --------- */ movl $pg3+7,pg_dir+12 /* --------- " " --------- */ movl $pg3+4092,%edi movl $0xfff007,%eax /* 16Mb - 4096 + 7 (r/w user,p) */ std 1: stosl /* fill pages backwards - more efficient :-) */ subl $0x1000,%eax jge 1b xorl %eax,%eax /* pg_dir is at 0x0000 */ movl %eax,%cr3 /* cr3 - page directory start */ movl %cr0,%eax orl $0x80000000,%eax movl %eax,%cr0 /* set paging (PG) bit */ ret /* this also flushes prefetch-queue */ .align 2 .word 0 idt_descr: .word 256*8-1 # idt contains 256 entries .long idt .align 2 .word 0 gdt_descr: .word 256*8-1 # so does gdt (not that that's any .long gdt # magic number, but it works for me :^) .align 8 idt: .fill 256,8,0 # idt is uninitialized gdt: .quad 0x0000000000000000 /* NULL descriptor */ .quad 0x00c09a0000000fff /* 16Mb */ .quad 0x00c0920000000fff /* 16Mb */ .quad 0x0000000000000000 /* TEMPORARY - don't use */ .fill 252,8,0 /* space for LDT's and TSS's etc */
Wangzhike/HIT-Linux-0.11
6,691
5-semaphore/linux-0.11/kernel/system_call.s
/* * linux/kernel/system_call.s * * (C) 1991 Linus Torvalds */ /* * system_call.s contains the system-call low-level handling routines. * This also contains the timer-interrupt handler, as some of the code is * the same. The hd- and flopppy-interrupts are also here. * * NOTE: This code handles signal-recognition, which happens every time * after a timer-interrupt and after each system call. Ordinary interrupts * don't handle signal-recognition, as that would clutter them up totally * unnecessarily. * * Stack layout in 'ret_from_system_call': * * 0(%esp) - %eax * 4(%esp) - %ebx * 8(%esp) - %ecx * C(%esp) - %edx * 10(%esp) - %fs * 14(%esp) - %es * 18(%esp) - %ds * 1C(%esp) - %eip * 20(%esp) - %cs * 24(%esp) - %eflags * 28(%esp) - %oldesp * 2C(%esp) - %oldss */ SIG_CHLD = 17 EAX = 0x00 EBX = 0x04 ECX = 0x08 EDX = 0x0C FS = 0x10 ES = 0x14 DS = 0x18 EIP = 0x1C CS = 0x20 EFLAGS = 0x24 OLDESP = 0x28 OLDSS = 0x2C state = 0 # these are offsets into the task-struct. counter = 4 priority = 8 KERNEL_STACK = 12 signal = 16 sigaction = 20 # MUST be 16 (=len of sigaction) blocked = (33*16+4) # offsets within sigaction sa_handler = 0 sa_mask = 4 sa_flags = 8 sa_restorer = 12 nr_system_calls = 78 # origin is 72, now add 6 sys_calls :sys_iam, sys_whoami, sys_sem_open, sys_sem_wait, sys_sem_post, sys_sem_unlink /* * Ok, I get parallel printer interrupts while using the floppy for some * strange reason. Urgel. Now I just ignore them. */ .globl system_call,sys_fork,timer_interrupt,sys_execve .globl hd_interrupt,floppy_interrupt,parallel_interrupt .globl device_not_available, coprocessor_error .globl first_return_from_kernel, switch_to .align 2 bad_sys_call: movl $-1,%eax iret .align 2 reschedule: pushl $ret_from_sys_call jmp schedule .align 2 system_call: cmpl $nr_system_calls-1,%eax ja bad_sys_call push %ds push %es push %fs pushl %edx pushl %ecx # push %ebx,%ecx,%edx as parameters pushl %ebx # to the system call movl $0x10,%edx # set up ds,es to kernel space mov %dx,%ds mov %dx,%es movl $0x17,%edx # fs points to local data space mov %dx,%fs call sys_call_table(,%eax,4) pushl %eax movl current,%eax cmpl $0,state(%eax) # state jne reschedule cmpl $0,counter(%eax) # counter je reschedule ret_from_sys_call: movl current,%eax # task[0] cannot have signals cmpl task,%eax je 3f cmpw $0x0f,CS(%esp) # was old code segment supervisor ? jne 3f cmpw $0x17,OLDSS(%esp) # was stack segment = 0x17 ? jne 3f movl signal(%eax),%ebx movl blocked(%eax),%ecx notl %ecx andl %ebx,%ecx bsfl %ecx,%ecx je 3f btrl %ecx,%ebx movl %ebx,signal(%eax) incl %ecx pushl %ecx call do_signal popl %eax 3: popl %eax popl %ebx popl %ecx popl %edx pop %fs pop %es pop %ds iret .align 2 coprocessor_error: push %ds push %es push %fs pushl %edx pushl %ecx pushl %ebx pushl %eax movl $0x10,%eax mov %ax,%ds mov %ax,%es movl $0x17,%eax mov %ax,%fs pushl $ret_from_sys_call jmp math_error .align 2 device_not_available: push %ds push %es push %fs pushl %edx pushl %ecx pushl %ebx pushl %eax movl $0x10,%eax mov %ax,%ds mov %ax,%es movl $0x17,%eax mov %ax,%fs pushl $ret_from_sys_call clts # clear TS so that we can use math movl %cr0,%eax testl $0x4,%eax # EM (math emulation bit) je math_state_restore pushl %ebp pushl %esi pushl %edi call math_emulate popl %edi popl %esi popl %ebp ret .align 2 timer_interrupt: push %ds # save ds,es and put kernel data space push %es # into them. %fs is used by _system_call push %fs pushl %edx # we save %eax,%ecx,%edx as gcc doesn't pushl %ecx # save those across function calls. %ebx pushl %ebx # is saved as we use that in ret_sys_call pushl %eax movl $0x10,%eax mov %ax,%ds mov %ax,%es movl $0x17,%eax mov %ax,%fs incl jiffies movb $0x20,%al # EOI to interrupt controller #1 outb %al,$0x20 movl CS(%esp),%eax andl $3,%eax # %eax is CPL (0 or 3, 0=supervisor) pushl %eax call do_timer # 'do_timer(long CPL)' does everything from addl $4,%esp # task switching to accounting ... jmp ret_from_sys_call .align 2 sys_execve: lea EIP(%esp),%eax pushl %eax call do_execve addl $4,%esp ret .align 2 sys_fork: call find_empty_process testl %eax,%eax js 1f push %gs pushl %esi pushl %edi pushl %ebp pushl %eax call copy_process addl $20,%esp 1: ret .align 2 switch_to: # 建立堆栈框架 pushl %ebp movl %esp, %ebp pushl %ecx pushl %ebx pushl %eax movl 8(%ebp), %ebx # 取出下一个进程的PCB指针pnext ebx = pnext cmpl %ebx, current # 和current指针作比较 je 1f # 切换PCB movl %ebx, %eax xchgl %eax, current # eax=old_current, so current=pnext # TSS中的内核栈指针的重写 ## 虽然不再使用`ljmp TSS段选择子:不使用的段内偏移`进行任务切换, ## 但Intel的中断处理机制仍需要保持,因为CPU正是依靠这种机制在进行 ## 中断切换时能够找到内核栈并将`SS:ESP, EFLAGS, CS:EPI`这5个寄存器 ## 的值自动压入到内核栈,具体来说:在中断的时候依靠TR寄存器的值找到 ## 当前进程的TSS(TSS用于保存硬件上下文,包括内核栈的地址SS0:EIP0), ## 从TSS中找到内核栈的地址,将用户态下的这5个寄存器压到内核栈中, ## 这是沟通用户栈(用户态)和内核栈(内核态)的关键桥梁 movl tss, %ecx # ecx = tss of pnext, it also the new current addl $4096, %ebx # ebx=the top of current kernel stack(pnext) movl %ebx, 4(%ecx) # 将内核栈的栈顶写入到TSS中用于保存内核栈指针的ESP0 # 切换内核栈 movl %esp, KERNEL_STACK(%eax) movl 8(%ebp), %ebx # 再取一下ebx,因为前面修改了ebx的值 ebx=current(pnext) movl KERNEL_STACK(%ebx), %esp # 切换LDT movl 12(%ebp), %ecx lldt %cx # 切换完LDT之后重新取一下用于访问用户态的数据段寄存器FS的值,为了刷新FS寄存器的隐藏部分:段基地址和段限长 movl $0x17, %ecx mov %cx, %fs cmpl %eax, last_task_used_math # 和后面的`clts`配合来处理协处理器 jne 1f clts # 拆除堆栈框架 1: popl %eax popl %ebx popl %ecx popl %ebp ret first_return_from_kernel: popl %edx popl %edi popl %esi pop %gs pop %fs pop %es pop %ds # pushl $ret_from_sys_call iret hd_interrupt: pushl %eax pushl %ecx pushl %edx push %ds push %es push %fs movl $0x10,%eax mov %ax,%ds mov %ax,%es movl $0x17,%eax mov %ax,%fs movb $0x20,%al outb %al,$0xA0 # EOI to interrupt controller #1 jmp 1f # give port chance to breathe 1: jmp 1f 1: xorl %edx,%edx xchgl do_hd,%edx testl %edx,%edx jne 1f movl $unexpected_hd_interrupt,%edx 1: outb %al,$0x20 call *%edx # "interesting" way of handling intr. pop %fs pop %es pop %ds popl %edx popl %ecx popl %eax iret floppy_interrupt: pushl %eax pushl %ecx pushl %edx push %ds push %es push %fs movl $0x10,%eax mov %ax,%ds mov %ax,%es movl $0x17,%eax mov %ax,%fs movb $0x20,%al outb %al,$0x20 # EOI to interrupt controller #1 xorl %eax,%eax xchgl do_floppy,%eax testl %eax,%eax jne 1f movl $unexpected_floppy_interrupt,%eax 1: call *%eax # "interesting" way of handling intr. pop %fs pop %es pop %ds popl %edx popl %ecx popl %eax iret parallel_interrupt: pushl %eax movb $0x20,%al outb %al,$0x20 popl %eax iret
Wangzhike/HIT-Linux-0.11
2,289
5-semaphore/linux-0.11/kernel/asm.s
/* * linux/kernel/asm.s * * (C) 1991 Linus Torvalds */ /* * asm.s contains the low-level code for most hardware faults. * page_exception is handled by the mm, so that isn't here. This * file also handles (hopefully) fpu-exceptions due to TS-bit, as * the fpu must be properly saved/resored. This hasn't been tested. */ .globl divide_error,debug,nmi,int3,overflow,bounds,invalid_op .globl double_fault,coprocessor_segment_overrun .globl invalid_TSS,segment_not_present,stack_segment .globl general_protection,coprocessor_error,irq13,reserved divide_error: pushl $do_divide_error no_error_code: xchgl %eax,(%esp) pushl %ebx pushl %ecx pushl %edx pushl %edi pushl %esi pushl %ebp push %ds push %es push %fs pushl $0 # "error code" lea 44(%esp),%edx pushl %edx movl $0x10,%edx mov %dx,%ds mov %dx,%es mov %dx,%fs call *%eax addl $8,%esp pop %fs pop %es pop %ds popl %ebp popl %esi popl %edi popl %edx popl %ecx popl %ebx popl %eax iret debug: pushl $do_int3 # _do_debug jmp no_error_code nmi: pushl $do_nmi jmp no_error_code int3: pushl $do_int3 jmp no_error_code overflow: pushl $do_overflow jmp no_error_code bounds: pushl $do_bounds jmp no_error_code invalid_op: pushl $do_invalid_op jmp no_error_code coprocessor_segment_overrun: pushl $do_coprocessor_segment_overrun jmp no_error_code reserved: pushl $do_reserved jmp no_error_code irq13: pushl %eax xorb %al,%al outb %al,$0xF0 movb $0x20,%al outb %al,$0x20 jmp 1f 1: jmp 1f 1: outb %al,$0xA0 popl %eax jmp coprocessor_error double_fault: pushl $do_double_fault error_code: xchgl %eax,4(%esp) # error code <-> %eax xchgl %ebx,(%esp) # &function <-> %ebx pushl %ecx pushl %edx pushl %edi pushl %esi pushl %ebp push %ds push %es push %fs pushl %eax # error code lea 44(%esp),%eax # offset pushl %eax movl $0x10,%eax mov %ax,%ds mov %ax,%es mov %ax,%fs call *%ebx addl $8,%esp pop %fs pop %es pop %ds popl %ebp popl %esi popl %edi popl %edx popl %ecx popl %ebx popl %eax iret invalid_TSS: pushl $do_invalid_TSS jmp error_code segment_not_present: pushl $do_segment_not_present jmp error_code stack_segment: pushl $do_stack_segment jmp error_code general_protection: pushl $do_general_protection jmp error_code
Wangzhike/HIT-Linux-0.11
2,710
5-semaphore/linux-0.11/kernel/chr_drv/rs_io.s
/* * linux/kernel/rs_io.s * * (C) 1991 Linus Torvalds */ /* * rs_io.s * * This module implements the rs232 io interrupts. */ .text .globl rs1_interrupt,rs2_interrupt size = 1024 /* must be power of two ! and must match the value in tty_io.c!!! */ /* these are the offsets into the read/write buffer structures */ rs_addr = 0 head = 4 tail = 8 proc_list = 12 buf = 16 startup = 256 /* chars left in write queue when we restart it */ /* * These are the actual interrupt routines. They look where * the interrupt is coming from, and take appropriate action. */ .align 2 rs1_interrupt: pushl $table_list+8 jmp rs_int .align 2 rs2_interrupt: pushl $table_list+16 rs_int: pushl %edx pushl %ecx pushl %ebx pushl %eax push %es push %ds /* as this is an interrupt, we cannot */ pushl $0x10 /* know that bs is ok. Load it */ pop %ds pushl $0x10 pop %es movl 24(%esp),%edx movl (%edx),%edx movl rs_addr(%edx),%edx addl $2,%edx /* interrupt ident. reg */ rep_int: xorl %eax,%eax inb %dx,%al testb $1,%al jne end cmpb $6,%al /* this shouldn't happen, but ... */ ja end movl 24(%esp),%ecx pushl %edx subl $2,%edx call jmp_table(,%eax,2) /* NOTE! not *4, bit0 is 0 already */ popl %edx jmp rep_int end: movb $0x20,%al outb %al,$0x20 /* EOI */ pop %ds pop %es popl %eax popl %ebx popl %ecx popl %edx addl $4,%esp # jump over _table_list entry iret jmp_table: .long modem_status,write_char,read_char,line_status .align 2 modem_status: addl $6,%edx /* clear intr by reading modem status reg */ inb %dx,%al ret .align 2 line_status: addl $5,%edx /* clear intr by reading line status reg. */ inb %dx,%al ret .align 2 read_char: inb %dx,%al movl %ecx,%edx subl $table_list,%edx shrl $3,%edx movl (%ecx),%ecx # read-queue movl head(%ecx),%ebx movb %al,buf(%ecx,%ebx) incl %ebx andl $size-1,%ebx cmpl tail(%ecx),%ebx je 1f movl %ebx,head(%ecx) 1: pushl %edx call do_tty_interrupt addl $4,%esp ret .align 2 write_char: movl 4(%ecx),%ecx # write-queue movl head(%ecx),%ebx subl tail(%ecx),%ebx andl $size-1,%ebx # nr chars in queue je write_buffer_empty cmpl $startup,%ebx ja 1f movl proc_list(%ecx),%ebx # wake up sleeping process testl %ebx,%ebx # is there any? je 1f movl $0,(%ebx) 1: movl tail(%ecx),%ebx movb buf(%ecx,%ebx),%al outb %al,%dx incl %ebx andl $size-1,%ebx movl %ebx,tail(%ecx) cmpl head(%ecx),%ebx je write_buffer_empty ret .align 2 write_buffer_empty: movl proc_list(%ecx),%ebx # wake up sleeping process testl %ebx,%ebx # is there any? je 1f movl $0,(%ebx) 1: incl %edx inb %dx,%al jmp 1f 1: jmp 1f 1: andb $0xd,%al /* disable transmit interrupt */ outb %al,%dx ret
Wangzhike/HIT-Linux-0.11
12,774
5-semaphore/linux-0.11/kernel/chr_drv/keyboard.S
/* * linux/kernel/keyboard.S * * (C) 1991 Linus Torvalds */ /* * Thanks to Alfred Leung for US keyboard patches * Wolfgang Thiel for German keyboard patches * Marc Corsini for the French keyboard */ #include <linux/config.h> .text .globl keyboard_interrupt /* * these are for the keyboard read functions */ size = 1024 /* must be a power of two ! And MUST be the same as in tty_io.c !!!! */ head = 4 tail = 8 proc_list = 12 buf = 16 mode: .byte 0 /* caps, alt, ctrl and shift mode */ leds: .byte 2 /* num-lock, caps, scroll-lock mode (nom-lock on) */ e0: .byte 0 /* * con_int is the real interrupt routine that reads the * keyboard scan-code and converts it into the appropriate * ascii character(s). */ keyboard_interrupt: pushl %eax pushl %ebx pushl %ecx pushl %edx push %ds push %es movl $0x10,%eax mov %ax,%ds mov %ax,%es xor %al,%al /* %eax is scan code */ inb $0x60,%al cmpb $0xe0,%al je set_e0 cmpb $0xe1,%al je set_e1 call key_table(,%eax,4) movb $0,e0 e0_e1: inb $0x61,%al jmp 1f 1: jmp 1f 1: orb $0x80,%al jmp 1f 1: jmp 1f 1: outb %al,$0x61 jmp 1f 1: jmp 1f 1: andb $0x7F,%al outb %al,$0x61 movb $0x20,%al outb %al,$0x20 pushl $0 call do_tty_interrupt addl $4,%esp pop %es pop %ds popl %edx popl %ecx popl %ebx popl %eax iret set_e0: movb $1,e0 jmp e0_e1 set_e1: movb $2,e0 jmp e0_e1 /* * This routine fills the buffer with max 8 bytes, taken from * %ebx:%eax. (%edx is high). The bytes are written in the * order %al,%ah,%eal,%eah,%bl,%bh ... until %eax is zero. */ put_queue: pushl %ecx pushl %edx movl table_list,%edx # read-queue for console movl head(%edx),%ecx 1: movb %al,buf(%edx,%ecx) incl %ecx andl $size-1,%ecx cmpl tail(%edx),%ecx # buffer full - discard everything je 3f shrdl $8,%ebx,%eax je 2f shrl $8,%ebx jmp 1b 2: movl %ecx,head(%edx) movl proc_list(%edx),%ecx testl %ecx,%ecx je 3f movl $0,(%ecx) 3: popl %edx popl %ecx ret ctrl: movb $0x04,%al jmp 1f alt: movb $0x10,%al 1: cmpb $0,e0 je 2f addb %al,%al 2: orb %al,mode ret unctrl: movb $0x04,%al jmp 1f unalt: movb $0x10,%al 1: cmpb $0,e0 je 2f addb %al,%al 2: notb %al andb %al,mode ret lshift: orb $0x01,mode ret unlshift: andb $0xfe,mode ret rshift: orb $0x02,mode ret unrshift: andb $0xfd,mode ret caps: testb $0x80,mode jne 1f xorb $4,leds xorb $0x40,mode orb $0x80,mode set_leds: call kb_wait movb $0xed,%al /* set leds command */ outb %al,$0x60 call kb_wait movb leds,%al outb %al,$0x60 ret uncaps: andb $0x7f,mode ret scroll: xorb $1,leds jmp set_leds num: xorb $2,leds jmp set_leds /* * curosr-key/numeric keypad cursor keys are handled here. * checking for numeric keypad etc. */ cursor: subb $0x47,%al jb 1f cmpb $12,%al ja 1f jne cur2 /* check for ctrl-alt-del */ testb $0x0c,mode je cur2 testb $0x30,mode jne reboot cur2: cmpb $0x01,e0 /* e0 forces cursor movement */ je cur testb $0x02,leds /* not num-lock forces cursor */ je cur testb $0x03,mode /* shift forces cursor */ jne cur xorl %ebx,%ebx movb num_table(%eax),%al jmp put_queue 1: ret cur: movb cur_table(%eax),%al cmpb $'9,%al ja ok_cur movb $'~,%ah ok_cur: shll $16,%eax movw $0x5b1b,%ax xorl %ebx,%ebx jmp put_queue #if defined(KBD_FR) num_table: .ascii "789 456 1230." #else num_table: .ascii "789 456 1230," #endif cur_table: .ascii "HA5 DGC YB623" /* * this routine handles function keys */ func: pushl %eax pushl %ecx pushl %edx call show_stat popl %edx popl %ecx popl %eax subb $0x3B,%al jb end_func cmpb $9,%al jbe ok_func subb $18,%al cmpb $10,%al jb end_func cmpb $11,%al ja end_func ok_func: cmpl $4,%ecx /* check that there is enough room */ jl end_func movl func_table(,%eax,4),%eax xorl %ebx,%ebx jmp put_queue end_func: ret /* * function keys send F1:'esc [ [ A' F2:'esc [ [ B' etc. */ func_table: .long 0x415b5b1b,0x425b5b1b,0x435b5b1b,0x445b5b1b .long 0x455b5b1b,0x465b5b1b,0x475b5b1b,0x485b5b1b .long 0x495b5b1b,0x4a5b5b1b,0x4b5b5b1b,0x4c5b5b1b #if defined(KBD_FINNISH) key_map: .byte 0,27 .ascii "1234567890+'" .byte 127,9 .ascii "qwertyuiop}" .byte 0,13,0 .ascii "asdfghjkl|{" .byte 0,0 .ascii "'zxcvbnm,.-" .byte 0,'*,0,32 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte '-,0,0,0,'+ /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '< .fill 10,1,0 shift_map: .byte 0,27 .ascii "!\"#$%&/()=?`" .byte 127,9 .ascii "QWERTYUIOP]^" .byte 13,0 .ascii "ASDFGHJKL\\[" .byte 0,0 .ascii "*ZXCVBNM;:_" .byte 0,'*,0,32 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte '-,0,0,0,'+ /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '> .fill 10,1,0 alt_map: .byte 0,0 .ascii "\0@\0$\0\0{[]}\\\0" .byte 0,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte '~,13,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte 0,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte 0,0,0,0 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte 0,0,0,0,0 /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '| .fill 10,1,0 #elif defined(KBD_US) key_map: .byte 0,27 .ascii "1234567890-=" .byte 127,9 .ascii "qwertyuiop[]" .byte 13,0 .ascii "asdfghjkl;'" .byte '`,0 .ascii "\\zxcvbnm,./" .byte 0,'*,0,32 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte '-,0,0,0,'+ /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '< .fill 10,1,0 shift_map: .byte 0,27 .ascii "!@#$%^&*()_+" .byte 127,9 .ascii "QWERTYUIOP{}" .byte 13,0 .ascii "ASDFGHJKL:\"" .byte '~,0 .ascii "|ZXCVBNM<>?" .byte 0,'*,0,32 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte '-,0,0,0,'+ /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '> .fill 10,1,0 alt_map: .byte 0,0 .ascii "\0@\0$\0\0{[]}\\\0" .byte 0,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte '~,13,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte 0,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte 0,0,0,0 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte 0,0,0,0,0 /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '| .fill 10,1,0 #elif defined(KBD_GR) key_map: .byte 0,27 .ascii "1234567890\\'" .byte 127,9 .ascii "qwertzuiop@+" .byte 13,0 .ascii "asdfghjkl[]^" .byte 0,'# .ascii "yxcvbnm,.-" .byte 0,'*,0,32 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte '-,0,0,0,'+ /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '< .fill 10,1,0 shift_map: .byte 0,27 .ascii "!\"#$%&/()=?`" .byte 127,9 .ascii "QWERTZUIOP\\*" .byte 13,0 .ascii "ASDFGHJKL{}~" .byte 0,'' .ascii "YXCVBNM;:_" .byte 0,'*,0,32 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte '-,0,0,0,'+ /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '> .fill 10,1,0 alt_map: .byte 0,0 .ascii "\0@\0$\0\0{[]}\\\0" .byte 0,0 .byte '@,0,0,0,0,0,0,0,0,0,0 .byte '~,13,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte 0,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte 0,0,0,0 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte 0,0,0,0,0 /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '| .fill 10,1,0 #elif defined(KBD_FR) key_map: .byte 0,27 .ascii "&{\"'(-}_/@)=" .byte 127,9 .ascii "azertyuiop^$" .byte 13,0 .ascii "qsdfghjklm|" .byte '`,0,42 /* coin sup gauche, don't know, [*|mu] */ .ascii "wxcvbn,;:!" .byte 0,'*,0,32 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte '-,0,0,0,'+ /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '< .fill 10,1,0 shift_map: .byte 0,27 .ascii "1234567890]+" .byte 127,9 .ascii "AZERTYUIOP<>" .byte 13,0 .ascii "QSDFGHJKLM%" .byte '~,0,'# .ascii "WXCVBN?./\\" .byte 0,'*,0,32 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte '-,0,0,0,'+ /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '> .fill 10,1,0 alt_map: .byte 0,0 .ascii "\0~#{[|`\\^@]}" .byte 0,0 .byte '@,0,0,0,0,0,0,0,0,0,0 .byte '~,13,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte 0,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte 0,0,0,0 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte 0,0,0,0,0 /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '| .fill 10,1,0 #else #error "KBD-type not defined" #endif /* * do_self handles "normal" keys, ie keys that don't change meaning * and which have just one character returns. */ do_self: lea alt_map,%ebx testb $0x20,mode /* alt-gr */ jne 1f lea shift_map,%ebx testb $0x03,mode jne 1f lea key_map,%ebx 1: movb (%ebx,%eax),%al orb %al,%al je none testb $0x4c,mode /* ctrl or caps */ je 2f cmpb $'a,%al jb 2f cmpb $'},%al ja 2f subb $32,%al 2: testb $0x0c,mode /* ctrl */ je 3f cmpb $64,%al jb 3f cmpb $64+32,%al jae 3f subb $64,%al 3: testb $0x10,mode /* left alt */ je 4f orb $0x80,%al 4: andl $0xff,%eax xorl %ebx,%ebx call put_queue none: ret /* * minus has a routine of it's own, as a 'E0h' before * the scan code for minus means that the numeric keypad * slash was pushed. */ minus: cmpb $1,e0 jne do_self movl $'/,%eax xorl %ebx,%ebx jmp put_queue /* * This table decides which routine to call when a scan-code has been * gotten. Most routines just call do_self, or none, depending if * they are make or break. */ key_table: .long none,do_self,do_self,do_self /* 00-03 s0 esc 1 2 */ .long do_self,do_self,do_self,do_self /* 04-07 3 4 5 6 */ .long do_self,do_self,do_self,do_self /* 08-0B 7 8 9 0 */ .long do_self,do_self,do_self,do_self /* 0C-0F + ' bs tab */ .long do_self,do_self,do_self,do_self /* 10-13 q w e r */ .long do_self,do_self,do_self,do_self /* 14-17 t y u i */ .long do_self,do_self,do_self,do_self /* 18-1B o p } ^ */ .long do_self,ctrl,do_self,do_self /* 1C-1F enter ctrl a s */ .long do_self,do_self,do_self,do_self /* 20-23 d f g h */ .long do_self,do_self,do_self,do_self /* 24-27 j k l | */ .long do_self,do_self,lshift,do_self /* 28-2B { para lshift , */ .long do_self,do_self,do_self,do_self /* 2C-2F z x c v */ .long do_self,do_self,do_self,do_self /* 30-33 b n m , */ .long do_self,minus,rshift,do_self /* 34-37 . - rshift * */ .long alt,do_self,caps,func /* 38-3B alt sp caps f1 */ .long func,func,func,func /* 3C-3F f2 f3 f4 f5 */ .long func,func,func,func /* 40-43 f6 f7 f8 f9 */ .long func,num,scroll,cursor /* 44-47 f10 num scr home */ .long cursor,cursor,do_self,cursor /* 48-4B up pgup - left */ .long cursor,cursor,do_self,cursor /* 4C-4F n5 right + end */ .long cursor,cursor,cursor,cursor /* 50-53 dn pgdn ins del */ .long none,none,do_self,func /* 54-57 sysreq ? < f11 */ .long func,none,none,none /* 58-5B f12 ? ? ? */ .long none,none,none,none /* 5C-5F ? ? ? ? */ .long none,none,none,none /* 60-63 ? ? ? ? */ .long none,none,none,none /* 64-67 ? ? ? ? */ .long none,none,none,none /* 68-6B ? ? ? ? */ .long none,none,none,none /* 6C-6F ? ? ? ? */ .long none,none,none,none /* 70-73 ? ? ? ? */ .long none,none,none,none /* 74-77 ? ? ? ? */ .long none,none,none,none /* 78-7B ? ? ? ? */ .long none,none,none,none /* 7C-7F ? ? ? ? */ .long none,none,none,none /* 80-83 ? br br br */ .long none,none,none,none /* 84-87 br br br br */ .long none,none,none,none /* 88-8B br br br br */ .long none,none,none,none /* 8C-8F br br br br */ .long none,none,none,none /* 90-93 br br br br */ .long none,none,none,none /* 94-97 br br br br */ .long none,none,none,none /* 98-9B br br br br */ .long none,unctrl,none,none /* 9C-9F br unctrl br br */ .long none,none,none,none /* A0-A3 br br br br */ .long none,none,none,none /* A4-A7 br br br br */ .long none,none,unlshift,none /* A8-AB br br unlshift br */ .long none,none,none,none /* AC-AF br br br br */ .long none,none,none,none /* B0-B3 br br br br */ .long none,none,unrshift,none /* B4-B7 br br unrshift br */ .long unalt,none,uncaps,none /* B8-BB unalt br uncaps br */ .long none,none,none,none /* BC-BF br br br br */ .long none,none,none,none /* C0-C3 br br br br */ .long none,none,none,none /* C4-C7 br br br br */ .long none,none,none,none /* C8-CB br br br br */ .long none,none,none,none /* CC-CF br br br br */ .long none,none,none,none /* D0-D3 br br br br */ .long none,none,none,none /* D4-D7 br br br br */ .long none,none,none,none /* D8-DB br ? ? ? */ .long none,none,none,none /* DC-DF ? ? ? ? */ .long none,none,none,none /* E0-E3 e0 e1 ? ? */ .long none,none,none,none /* E4-E7 ? ? ? ? */ .long none,none,none,none /* E8-EB ? ? ? ? */ .long none,none,none,none /* EC-EF ? ? ? ? */ .long none,none,none,none /* F0-F3 ? ? ? ? */ .long none,none,none,none /* F4-F7 ? ? ? ? */ .long none,none,none,none /* F8-FB ? ? ? ? */ .long none,none,none,none /* FC-FF ? ? ? ? */ /* * kb_wait waits for the keyboard controller buffer to empty. * there is no timeout - if the buffer doesn't empty, we hang. */ kb_wait: pushl %eax 1: inb $0x64,%al testb $0x02,%al jne 1b popl %eax ret /* * This routine reboots the machine by asking the keyboard * controller to pulse the reset-line low. */ reboot: call kb_wait movw $0x1234,0x472 /* don't do memory check */ movb $0xfc,%al /* pulse reset and A20 low */ outb %al,$0x64 die: jmp die
Wangzhike/HIT-Linux-0.11
5,473
4-processSwitchWithKernelStack/linux-0.11/boot/bootsect.s
! ! SYS_SIZE is the number of clicks (16 bytes) to be loaded. ! 0x3000 is 0x30000 bytes = 196kB, more than enough for current ! versions of linux ! SYSSIZE = 0x3000 ! ! bootsect.s (C) 1991 Linus Torvalds ! ! bootsect.s is loaded at 0x7c00 by the bios-startup routines, and moves ! iself out of the way to address 0x90000, and jumps there. ! ! It then loads 'setup' directly after itself (0x90200), and the system ! at 0x10000, using BIOS interrupts. ! ! NOTE! currently system is at most 8*65536 bytes long. This should be no ! problem, even in the future. I want to keep it simple. This 512 kB ! kernel size should be enough, especially as this doesn't contain the ! buffer cache as in minix ! ! The loader has been made as simple as possible, and continuos ! read errors will result in a unbreakable loop. Reboot by hand. It ! loads pretty fast by getting whole sectors at a time whenever possible. .globl begtext, begdata, begbss, endtext, enddata, endbss .text begtext: .data begdata: .bss begbss: .text SETUPLEN = 4 ! nr of setup-sectors BOOTSEG = 0x07c0 ! original address of boot-sector INITSEG = 0x9000 ! we move boot here - out of the way SETUPSEG = 0x9020 ! setup starts here SYSSEG = 0x1000 ! system loaded at 0x10000 (65536). ENDSEG = SYSSEG + SYSSIZE ! where to stop loading ! ROOT_DEV: 0x000 - same type of floppy as boot. ! 0x301 - first partition on first drive etc ROOT_DEV = 0x306 entry _start _start: mov ax,#BOOTSEG mov ds,ax mov ax,#INITSEG mov es,ax mov cx,#256 sub si,si sub di,di rep movw jmpi go,INITSEG go: mov ax,cs mov ds,ax mov es,ax ! put stack at 0x9ff00. mov ss,ax mov sp,#0xFF00 ! arbitrary value >>512 ! load the setup-sectors directly after the bootblock. ! Note that 'es' is already set up. load_setup: mov dx,#0x0000 ! drive 0, head 0 mov cx,#0x0002 ! sector 2, track 0 mov bx,#0x0200 ! address = 512, in INITSEG mov ax,#0x0200+SETUPLEN ! service 2, nr of sectors int 0x13 ! read it jnc ok_load_setup ! ok - continue mov dx,#0x0000 mov ax,#0x0000 ! reset the diskette int 0x13 j load_setup ok_load_setup: ! Get disk drive parameters, specifically nr of sectors/track mov dl,#0x00 mov ax,#0x0800 ! AH=8 is get drive parameters int 0x13 mov ch,#0x00 seg cs mov sectors,cx mov ax,#INITSEG mov es,ax ! Print some inane message call read_cursor mov cx,#2 mov bx,#0x0007 ! page 0, attribute 7 (normal, white color) mov bp,#msg1 mov ax,#0x1301 ! write string, move cursor int 0x10 call read_cursor mov cx, #6 mov bx, #0x0009 ! page 0, attribute 9(bright blue color) mov bp, #msg1+2 mov ax, #0x1301 ! write string, move cursor int 0x10 call read_cursor mov cx, #18 mov bx, #0x0007 ! page 0, attribute 7(normal, white color) mov bp, #msg1+8 mov ax, #0x1301 ! write string, move cursor int 0x10 ! ok, we've written the message, now ! we want to load the system (at 0x10000) mov ax,#SYSSEG mov es,ax ! segment of 0x010000 call read_it call kill_motor ! After that we check which root-device to use. If the device is ! defined (!= 0), nothing is done and the given device is used. ! Otherwise, either /dev/PS0 (2,28) or /dev/at0 (2,8), depending ! on the number of sectors that the BIOS reports currently. seg cs mov ax,root_dev cmp ax,#0 jne root_defined seg cs mov bx,sectors mov ax,#0x0208 ! /dev/ps0 - 1.2Mb cmp bx,#15 je root_defined mov ax,#0x021c ! /dev/PS0 - 1.44Mb cmp bx,#18 je root_defined undef_root: jmp undef_root root_defined: seg cs mov root_dev,ax ! after that (everyting loaded), we jump to ! the setup-routine loaded directly after ! the bootblock: jmpi 0,SETUPSEG ! This routine loads the system at address 0x10000, making sure ! no 64kB boundaries are crossed. We try to load it as fast as ! possible, loading whole tracks whenever we can. ! ! in: es - starting address segment (normally 0x1000) ! sread: .word 1+SETUPLEN ! sectors read of current track head: .word 0 ! current head track: .word 0 ! current track read_it: mov ax,es test ax,#0x0fff die: jne die ! es must be at 64kB boundary xor bx,bx ! bx is starting address within segment rp_read: mov ax,es cmp ax,#ENDSEG ! have we loaded all yet? jb ok1_read ret ok1_read: seg cs mov ax,sectors sub ax,sread mov cx,ax shl cx,#9 add cx,bx jnc ok2_read je ok2_read xor ax,ax sub ax,bx shr ax,#9 ok2_read: call read_track mov cx,ax add ax,sread seg cs cmp ax,sectors jne ok3_read mov ax,#1 sub ax,head jne ok4_read inc track ok4_read: mov head,ax xor ax,ax ok3_read: mov sread,ax shl cx,#9 add bx,cx jnc rp_read mov ax,es add ax,#0x1000 mov es,ax xor bx,bx jmp rp_read read_track: push ax push bx push cx push dx mov dx,track mov cx,sread inc cx mov ch,dl mov dx,head mov dh,dl mov dl,#0 and dx,#0x0100 mov ah,#2 int 0x13 jc bad_rt pop dx pop cx pop bx pop ax ret bad_rt: mov ax,#0 mov dx,#0 int 0x13 pop dx pop cx pop bx pop ax jmp read_track read_cursor: push ax push bx mov ah,#0x03 ! read cursor pos xor bh,bh int 0x10 pop bx pop ax ret !/* ! * This procedure turns off the floppy drive motor, so ! * that we enter the kernel in a known state, and ! * don't have to worry about it later. ! */ kill_motor: push dx mov dx,#0x3f2 mov al,#0 outb pop dx ret sectors: .word 0 msg1: .byte 13,10 .ascii "Qiunix is loading..." .byte 13,10,13,10 .org 508 root_dev: .word ROOT_DEV boot_flag: .word 0xAA55 .text endtext: .data enddata: .bss endbss:
Wangzhike/HIT-Linux-0.11
8,626
4-processSwitchWithKernelStack/linux-0.11/boot/setup.s
! ! setup.s (C) 1991 Linus Torvalds ! ! setup.s is responsible for getting the system data from the BIOS, ! and putting them into the appropriate places in system memory. ! both setup.s and system has been loaded by the bootblock. ! ! This code asks the bios for memory/disk/other parameters, and ! puts them in a "safe" place: 0x90000-0x901FF, ie where the ! boot-block used to be. It is then up to the protected mode ! system to read them from there before the area is overwritten ! for buffer-blocks. ! ! NOTE! These had better be the same as in bootsect.s! INITSEG = 0x9000 ! we move boot here - out of the way SYSSEG = 0x1000 ! system loaded at 0x10000 (65536). SETUPSEG = 0x9020 ! this is the current segment .globl begtext, begdata, begbss, endtext, enddata, endbss .text begtext: .data begdata: .bss begbss: .text entry start start: ! repeat set stack, although it is done in bootsect.s mov ax, #INITSEG mov ss, ax mov sp, #0xFF00 ! now we are in setup ,print the message. mov ax, #SETUPSEG mov es, ax call read_cursor mov cx, #14 mov bx, #0x0007 ! page 0, attribute 10(bright green) mov bp, #msg mov ax, #0x1301 ! write string, move cursor int 0x10 call read_cursor mov cx, #5 mov bx, #0x000a ! page 0, attribute 7(normal, white color) mov bp, #msg+14 mov ax, #0x1301 int 0x10 call print_nl call print_nl ! ok, the read went well so we get current cursor position and save it for ! posterity. mov ax,#INITSEG ! this is done in bootsect already, but... mov ds,ax mov ah,#0x03 ! read cursor pos xor bh,bh int 0x10 ! save it in known place, con_init fetches mov [0],dx ! it from 0x90000. ! Get memory size (extended mem, kB) mov ax, #INITSEG ! this is done in bootsect already, but... mov ds, ax mov ah,#0x88 int 0x15 mov [2],ax ! Get video-card data: mov ah,#0x0f int 0x10 mov [4],bx ! bh = display page mov [6],ax ! al = video mode, ah = window width ! check for EGA/VGA and some config parameters mov ah,#0x12 mov bl,#0x10 int 0x10 mov [8],ax mov [10],bx mov [12],cx ! Get hd0 data mov ax,#0x0000 mov ds,ax lds si,[4*0x41] mov ax,#INITSEG mov es,ax mov di,#0x0080 mov cx,#0x10 rep movsb ! Get hd1 data mov ax,#0x0000 mov ds,ax lds si,[4*0x46] mov ax,#INITSEG mov es,ax mov di,#0x0090 mov cx,#0x10 rep movsb ! Check that there IS a hd1 :-) mov ax,#0x01500 mov dl,#0x81 int 0x13 jc no_disk1 cmp ah,#3 je is_disk1 no_disk1: mov ax,#INITSEG mov es,ax mov di,#0x0090 mov cx,#0x10 mov ax,#0x00 rep stosb is_disk1: ! now, we have read some system parameters, print thees parameters. mov ax, #INITSEG mov ds, ax mov ax, #SETUPSEG mov es, ax ! print cursor position call read_cursor mov cx, #17 mov bx, #0x000a ! page 0, attribute 10(normal, bright gren color) mov bp, #cursor mov ax, #0x1301 int 0x10 mov bp, #0x0000 call print_hex call print_nl ! print memory size call read_cursor mov cx, #13 mov bx, #0x000a ! page 0, attribue 10(normal, bright green color) mov bp, #memory mov ax, #0x1301 int 0x10 mov ax, [2] add ax, #1024 mov memsize, ax mov bp, #memsize call print_hex call read_cursor mov cx, #2 mov bx, #0x0007 mov bp, #memory+13 mov ax, #0x1301 int 0x10 call print_nl ! print hd0 cylinders call read_cursor mov cx, #15 mov bx, #0x000a ! page 0, attribute 10(normal, bright green color) mov bp, #cylinder mov ax, #0x1301 int 0x10 call read_cursor mov bp, #0x0080 call print_hex call print_nl ! print hd0 heads call read_cursor mov cx, #11 mov bx, #0x000a ! page 0, attribute 10(normal, bright green color) mov bp, #head mov ax, #0x1301 int 0x10 mov bp, #0x0082 call print_hex call print_nl ! print hd0 sectors call read_cursor mov cx, #13 mov bx, #0x000a ! page 0, attribute 10(normal, bright green color) mov bp, #sector mov ax, #0x1301 int 0x10 mov bp, #0x008E call print_hex call print_nl call print_nl ! ok, the read went well so we get current cursor position and save it for ! posterity. mov ax,#INITSEG ! this is done in bootsect already, but... mov ds,ax mov ah,#0x03 ! read cursor pos xor bh,bh int 0x10 ! save it in known place, con_init fetches mov [0],dx ! it from 0x90000. ! Get video-card data: mov ah,#0x0f int 0x10 mov [4],bx ! bh = display page mov [6],ax ! al = video mode, ah = window width ! now we want to move to protected mode ... cli ! no interrupts allowed ! ! first we move the system to it's rightful place mov ax,#0x0000 cld ! 'direction'=0, movs moves forward do_move: mov es,ax ! destination segment add ax,#0x1000 cmp ax,#0x9000 jz end_move mov ds,ax ! source segment sub di,di sub si,si mov cx,#0x8000 rep movsw jmp do_move ! then we load the segment descriptors end_move: mov ax,#SETUPSEG ! right, forgot this at first. didn't work :-) mov ds,ax lidt idt_48 ! load idt with 0,0 lgdt gdt_48 ! load gdt with whatever appropriate ! that was painless, now we enable A20 call empty_8042 mov al,#0xD1 ! command write out #0x64,al call empty_8042 mov al,#0xDF ! A20 on out #0x60,al call empty_8042 ! well, that went ok, I hope. Now we have to reprogram the interrupts :-( ! we put them right after the intel-reserved hardware interrupts, at ! int 0x20-0x2F. There they won't mess up anything. Sadly IBM really ! messed this up with the original PC, and they haven't been able to ! rectify it afterwards. Thus the bios puts interrupts at 0x08-0x0f, ! which is used for the internal hardware interrupts as well. We just ! have to reprogram the 8259's, and it isn't fun. mov al,#0x11 ! initialization sequence out #0x20,al ! send it to 8259A-1 .word 0x00eb,0x00eb ! jmp $+2, jmp $+2 out #0xA0,al ! and to 8259A-2 .word 0x00eb,0x00eb mov al,#0x20 ! start of hardware int's (0x20) out #0x21,al .word 0x00eb,0x00eb mov al,#0x28 ! start of hardware int's 2 (0x28) out #0xA1,al .word 0x00eb,0x00eb mov al,#0x04 ! 8259-1 is master out #0x21,al .word 0x00eb,0x00eb mov al,#0x02 ! 8259-2 is slave out #0xA1,al .word 0x00eb,0x00eb mov al,#0x01 ! 8086 mode for both out #0x21,al .word 0x00eb,0x00eb out #0xA1,al .word 0x00eb,0x00eb mov al,#0xFF ! mask off all interrupts for now out #0x21,al .word 0x00eb,0x00eb out #0xA1,al ! well, that certainly wasn't fun :-(. Hopefully it works, and we don't ! need no steenking BIOS anyway (except for the initial loading :-). ! The BIOS-routine wants lots of unnecessary data, and it's less ! "interesting" anyway. This is how REAL programmers do it. ! ! Well, now's the time to actually move into protected mode. To make ! things as simple as possible, we do no register set-up or anything, ! we let the gnu-compiled 32-bit programs do that. We just jump to ! absolute address 0x00000, in 32-bit protected mode. mov ax,#0x0001 ! protected mode (PE) bit lmsw ax ! This is it! jmpi 0,8 ! jmp offset 0 of segment 8 (cs) ! This routine checks that the keyboard command queue is empty ! No timeout is used - if this hangs there is something wrong with ! the machine, and we probably couldn't proceed anyway. empty_8042: .word 0x00eb,0x00eb in al,#0x64 ! 8042 status port test al,#2 ! is input buffer full? jnz empty_8042 ! yes - loop ret !以16进制方式打印栈顶的16位数 print_hex: push ax push bx push cx push dx mov ax, #0x0e30 ! 0 int 0x10 mov ax, #0x0e78 ! x int 0x10 mov cx, #4 mov dx, (bp) print_digit: rol dx, #4 mov ax, #0x0e0f mov bl, #0x0f ! bright green color and al, dl add al,#0x30 cmp al, #0x3a jl outp ! if less,是一个不大于9的数字 add al, #0x07 ! 是a~f,要加7 outp: int 0x10 loop print_digit pop dx pop cx pop bx pop ax ret print_nl: push ax push bx mov ax, #0x0e0d ! CR int 0x10 mov ax, #0x0e0A ! LR int 0x10 pop bx pop ax ret read_cursor: push ax push bx push cx mov ah, #0x03 ! read cursor pos xor bh, bh int 0x10 pop cx pop bx pop ax ret gdt: .word 0,0,0,0 ! dummy .word 0x07FF ! 8Mb - limit=2047 (2048*4096=8Mb) .word 0x0000 ! base address=0 .word 0x9A00 ! code read/exec .word 0x00C0 ! granularity=4096, 386 .word 0x07FF ! 8Mb - limit=2047 (2048*4096=8Mb) .word 0x0000 ! base address=0 .word 0x9200 ! data read/write .word 0x00C0 ! granularity=4096, 386 idt_48: .word 0 ! idt limit=0 .word 0,0 ! idt base=0L gdt_48: .word 0x800 ! gdt limit=2048, 256 GDT entries .word 512+gdt,0x9 ! gdt base = 0X9xxxx msg: .ascii "Now we are in SETUP" cursor: .ascii "Cursor Position: " .ascii "KB" memory: .ascii "Memory Size: KB" cylinder: .ascii "HD0 cylinders: " head: .ascii "HD0 heads: " sector: .ascii "HD0 sectors: " memsize: .word 0x0000 .text endtext: .data enddata: .bss endbss:
Wangzhike/HIT-Linux-0.11
5,938
4-processSwitchWithKernelStack/linux-0.11/boot/head.s
/* * linux/boot/head.s * * (C) 1991 Linus Torvalds */ /* * head.s contains the 32-bit startup code. * * NOTE!!! Startup happens at absolute address 0x00000000, which is also where * the page directory will exist. The startup code will be overwritten by * the page directory. */ .text .globl idt,gdt,pg_dir,tmp_floppy_area pg_dir: .globl startup_32 startup_32: movl $0x10,%eax mov %ax,%ds mov %ax,%es mov %ax,%fs mov %ax,%gs lss stack_start,%esp call setup_idt call setup_gdt movl $0x10,%eax # reload all the segment registers mov %ax,%ds # after changing gdt. CS was already mov %ax,%es # reloaded in 'setup_gdt' mov %ax,%fs mov %ax,%gs lss stack_start,%esp xorl %eax,%eax 1: incl %eax # check that A20 really IS enabled movl %eax,0x000000 # loop forever if it isn't cmpl %eax,0x100000 je 1b /* * NOTE! 486 should set bit 16, to check for write-protect in supervisor * mode. Then it would be unnecessary with the "verify_area()"-calls. * 486 users probably want to set the NE (#5) bit also, so as to use * int 16 for math errors. */ movl %cr0,%eax # check math chip andl $0x80000011,%eax # Save PG,PE,ET /* "orl $0x10020,%eax" here for 486 might be good */ orl $2,%eax # set MP movl %eax,%cr0 call check_x87 jmp after_page_tables /* * We depend on ET to be correct. This checks for 287/387. */ check_x87: fninit fstsw %ax cmpb $0,%al je 1f /* no coprocessor: have to set bits */ movl %cr0,%eax xorl $6,%eax /* reset MP, set EM */ movl %eax,%cr0 ret .align 2 1: .byte 0xDB,0xE4 /* fsetpm for 287, ignored by 387 */ ret /* * setup_idt * * sets up a idt with 256 entries pointing to * ignore_int, interrupt gates. It then loads * idt. Everything that wants to install itself * in the idt-table may do so themselves. Interrupts * are enabled elsewhere, when we can be relatively * sure everything is ok. This routine will be over- * written by the page tables. */ setup_idt: lea ignore_int,%edx movl $0x00080000,%eax movw %dx,%ax /* selector = 0x0008 = cs */ movw $0x8E00,%dx /* interrupt gate - dpl=0, present */ lea idt,%edi mov $256,%ecx rp_sidt: movl %eax,(%edi) movl %edx,4(%edi) addl $8,%edi dec %ecx jne rp_sidt lidt idt_descr ret /* * setup_gdt * * This routines sets up a new gdt and loads it. * Only two entries are currently built, the same * ones that were built in init.s. The routine * is VERY complicated at two whole lines, so this * rather long comment is certainly needed :-). * This routine will beoverwritten by the page tables. */ setup_gdt: lgdt gdt_descr ret /* * I put the kernel page tables right after the page directory, * using 4 of them to span 16 Mb of physical memory. People with * more than 16MB will have to expand this. */ .org 0x1000 pg0: .org 0x2000 pg1: .org 0x3000 pg2: .org 0x4000 pg3: .org 0x5000 /* * tmp_floppy_area is used by the floppy-driver when DMA cannot * reach to a buffer-block. It needs to be aligned, so that it isn't * on a 64kB border. */ tmp_floppy_area: .fill 1024,1,0 after_page_tables: pushl $0 # These are the parameters to main :-) pushl $0 pushl $0 pushl $L6 # return address for main, if it decides to. pushl $main jmp setup_paging L6: jmp L6 # main should never return here, but # just in case, we know what happens. /* This is the default interrupt "handler" :-) */ int_msg: .asciz "Unknown interrupt\n\r" .align 2 ignore_int: pushl %eax pushl %ecx pushl %edx push %ds push %es push %fs movl $0x10,%eax mov %ax,%ds mov %ax,%es mov %ax,%fs pushl $int_msg call printk popl %eax pop %fs pop %es pop %ds popl %edx popl %ecx popl %eax iret /* * Setup_paging * * This routine sets up paging by setting the page bit * in cr0. The page tables are set up, identity-mapping * the first 16MB. The pager assumes that no illegal * addresses are produced (ie >4Mb on a 4Mb machine). * * NOTE! Although all physical memory should be identity * mapped by this routine, only the kernel page functions * use the >1Mb addresses directly. All "normal" functions * use just the lower 1Mb, or the local data space, which * will be mapped to some other place - mm keeps track of * that. * * For those with more memory than 16 Mb - tough luck. I've * not got it, why should you :-) The source is here. Change * it. (Seriously - it shouldn't be too difficult. Mostly * change some constants etc. I left it at 16Mb, as my machine * even cannot be extended past that (ok, but it was cheap :-) * I've tried to show which constants to change by having * some kind of marker at them (search for "16Mb"), but I * won't guarantee that's all :-( ) */ .align 2 setup_paging: movl $1024*5,%ecx /* 5 pages - pg_dir+4 page tables */ xorl %eax,%eax xorl %edi,%edi /* pg_dir is at 0x000 */ cld;rep;stosl movl $pg0+7,pg_dir /* set present bit/user r/w */ movl $pg1+7,pg_dir+4 /* --------- " " --------- */ movl $pg2+7,pg_dir+8 /* --------- " " --------- */ movl $pg3+7,pg_dir+12 /* --------- " " --------- */ movl $pg3+4092,%edi movl $0xfff007,%eax /* 16Mb - 4096 + 7 (r/w user,p) */ std 1: stosl /* fill pages backwards - more efficient :-) */ subl $0x1000,%eax jge 1b xorl %eax,%eax /* pg_dir is at 0x0000 */ movl %eax,%cr3 /* cr3 - page directory start */ movl %cr0,%eax orl $0x80000000,%eax movl %eax,%cr0 /* set paging (PG) bit */ ret /* this also flushes prefetch-queue */ .align 2 .word 0 idt_descr: .word 256*8-1 # idt contains 256 entries .long idt .align 2 .word 0 gdt_descr: .word 256*8-1 # so does gdt (not that that's any .long gdt # magic number, but it works for me :^) .align 8 idt: .fill 256,8,0 # idt is uninitialized gdt: .quad 0x0000000000000000 /* NULL descriptor */ .quad 0x00c09a0000000fff /* 16Mb */ .quad 0x00c0920000000fff /* 16Mb */ .quad 0x0000000000000000 /* TEMPORARY - don't use */ .fill 252,8,0 /* space for LDT's and TSS's etc */
Wangzhike/HIT-Linux-0.11
6,623
4-processSwitchWithKernelStack/linux-0.11/kernel/system_call.s
/* * linux/kernel/system_call.s * * (C) 1991 Linus Torvalds */ /* * system_call.s contains the system-call low-level handling routines. * This also contains the timer-interrupt handler, as some of the code is * the same. The hd- and flopppy-interrupts are also here. * * NOTE: This code handles signal-recognition, which happens every time * after a timer-interrupt and after each system call. Ordinary interrupts * don't handle signal-recognition, as that would clutter them up totally * unnecessarily. * * Stack layout in 'ret_from_system_call': * * 0(%esp) - %eax * 4(%esp) - %ebx * 8(%esp) - %ecx * C(%esp) - %edx * 10(%esp) - %fs * 14(%esp) - %es * 18(%esp) - %ds * 1C(%esp) - %eip * 20(%esp) - %cs * 24(%esp) - %eflags * 28(%esp) - %oldesp * 2C(%esp) - %oldss */ SIG_CHLD = 17 EAX = 0x00 EBX = 0x04 ECX = 0x08 EDX = 0x0C FS = 0x10 ES = 0x14 DS = 0x18 EIP = 0x1C CS = 0x20 EFLAGS = 0x24 OLDESP = 0x28 OLDSS = 0x2C state = 0 # these are offsets into the task-struct. counter = 4 priority = 8 KERNEL_STACK = 12 signal = 16 sigaction = 20 # MUST be 16 (=len of sigaction) blocked = (33*16+4) # offsets within sigaction sa_handler = 0 sa_mask = 4 sa_flags = 8 sa_restorer = 12 nr_system_calls = 74 # origin is 72, now add sys_iam and sys_whoami /* * Ok, I get parallel printer interrupts while using the floppy for some * strange reason. Urgel. Now I just ignore them. */ .globl system_call,sys_fork,timer_interrupt,sys_execve .globl hd_interrupt,floppy_interrupt,parallel_interrupt .globl device_not_available, coprocessor_error .globl first_return_from_kernel, switch_to .align 2 bad_sys_call: movl $-1,%eax iret .align 2 reschedule: pushl $ret_from_sys_call jmp schedule .align 2 system_call: cmpl $nr_system_calls-1,%eax ja bad_sys_call push %ds push %es push %fs pushl %edx pushl %ecx # push %ebx,%ecx,%edx as parameters pushl %ebx # to the system call movl $0x10,%edx # set up ds,es to kernel space mov %dx,%ds mov %dx,%es movl $0x17,%edx # fs points to local data space mov %dx,%fs call sys_call_table(,%eax,4) pushl %eax movl current,%eax cmpl $0,state(%eax) # state jne reschedule cmpl $0,counter(%eax) # counter je reschedule ret_from_sys_call: movl current,%eax # task[0] cannot have signals cmpl task,%eax je 3f cmpw $0x0f,CS(%esp) # was old code segment supervisor ? jne 3f cmpw $0x17,OLDSS(%esp) # was stack segment = 0x17 ? jne 3f movl signal(%eax),%ebx movl blocked(%eax),%ecx notl %ecx andl %ebx,%ecx bsfl %ecx,%ecx je 3f btrl %ecx,%ebx movl %ebx,signal(%eax) incl %ecx pushl %ecx call do_signal popl %eax 3: popl %eax popl %ebx popl %ecx popl %edx pop %fs pop %es pop %ds iret .align 2 coprocessor_error: push %ds push %es push %fs pushl %edx pushl %ecx pushl %ebx pushl %eax movl $0x10,%eax mov %ax,%ds mov %ax,%es movl $0x17,%eax mov %ax,%fs pushl $ret_from_sys_call jmp math_error .align 2 device_not_available: push %ds push %es push %fs pushl %edx pushl %ecx pushl %ebx pushl %eax movl $0x10,%eax mov %ax,%ds mov %ax,%es movl $0x17,%eax mov %ax,%fs pushl $ret_from_sys_call clts # clear TS so that we can use math movl %cr0,%eax testl $0x4,%eax # EM (math emulation bit) je math_state_restore pushl %ebp pushl %esi pushl %edi call math_emulate popl %edi popl %esi popl %ebp ret .align 2 timer_interrupt: push %ds # save ds,es and put kernel data space push %es # into them. %fs is used by _system_call push %fs pushl %edx # we save %eax,%ecx,%edx as gcc doesn't pushl %ecx # save those across function calls. %ebx pushl %ebx # is saved as we use that in ret_sys_call pushl %eax movl $0x10,%eax mov %ax,%ds mov %ax,%es movl $0x17,%eax mov %ax,%fs incl jiffies movb $0x20,%al # EOI to interrupt controller #1 outb %al,$0x20 movl CS(%esp),%eax andl $3,%eax # %eax is CPL (0 or 3, 0=supervisor) pushl %eax call do_timer # 'do_timer(long CPL)' does everything from addl $4,%esp # task switching to accounting ... jmp ret_from_sys_call .align 2 sys_execve: lea EIP(%esp),%eax pushl %eax call do_execve addl $4,%esp ret .align 2 sys_fork: call find_empty_process testl %eax,%eax js 1f push %gs pushl %esi pushl %edi pushl %ebp pushl %eax call copy_process addl $20,%esp 1: ret .align 2 switch_to: # 建立堆栈框架 pushl %ebp movl %esp, %ebp pushl %ecx pushl %ebx pushl %eax movl 8(%ebp), %ebx # 取出下一个进程的PCB指针pnext ebx = pnext cmpl %ebx, current # 和current指针作比较 je 1f # 切换PCB movl %ebx, %eax xchgl %eax, current # eax=old_current, so current=pnext # TSS中的内核栈指针的重写 ## 虽然不再使用`ljmp TSS段选择子:不使用的段内偏移`进行任务切换, ## 但Intel的中断处理机制仍需要保持,因为CPU正是依靠这种机制在进行 ## 中断切换时能够找到内核栈并将`SS:ESP, EFLAGS, CS:EPI`这5个寄存器 ## 的值自动压入到内核栈,具体来说:在中断的时候依靠TR寄存器的值找到 ## 当前进程的TSS(TSS用于保存硬件上下文,包括内核栈的地址SS0:EIP0), ## 从TSS中找到内核栈的地址,将用户态下的这5个寄存器压到内核栈中, ## 这是沟通用户栈(用户态)和内核栈(内核态)的关键桥梁 movl tss, %ecx # ecx = tss of pnext, it also the new current addl $4096, %ebx # ebx=the top of current kernel stack(pnext) movl %ebx, 4(%ecx) # 将内核栈的栈顶写入到TSS中用于保存内核栈指针的ESP0 # 切换内核栈 movl %esp, KERNEL_STACK(%eax) movl 8(%ebp), %ebx # 再取一下ebx,因为前面修改了ebx的值 ebx=current(pnext) movl KERNEL_STACK(%ebx), %esp # 切换LDT movl 12(%ebp), %ecx lldt %cx # 切换完LDT之后重新取一下用于访问用户态的数据段寄存器FS的值,为了刷新FS寄存器的隐藏部分:段基地址和段限长 movl $0x17, %ecx mov %cx, %fs cmpl %eax, last_task_used_math # 和后面的`clts`配合来处理协处理器 jne 1f clts # 拆除堆栈框架 1: popl %eax popl %ebx popl %ecx popl %ebp ret first_return_from_kernel: popl %edx popl %edi popl %esi pop %gs pop %fs pop %es pop %ds # pushl $ret_from_sys_call iret hd_interrupt: pushl %eax pushl %ecx pushl %edx push %ds push %es push %fs movl $0x10,%eax mov %ax,%ds mov %ax,%es movl $0x17,%eax mov %ax,%fs movb $0x20,%al outb %al,$0xA0 # EOI to interrupt controller #1 jmp 1f # give port chance to breathe 1: jmp 1f 1: xorl %edx,%edx xchgl do_hd,%edx testl %edx,%edx jne 1f movl $unexpected_hd_interrupt,%edx 1: outb %al,$0x20 call *%edx # "interesting" way of handling intr. pop %fs pop %es pop %ds popl %edx popl %ecx popl %eax iret floppy_interrupt: pushl %eax pushl %ecx pushl %edx push %ds push %es push %fs movl $0x10,%eax mov %ax,%ds mov %ax,%es movl $0x17,%eax mov %ax,%fs movb $0x20,%al outb %al,$0x20 # EOI to interrupt controller #1 xorl %eax,%eax xchgl do_floppy,%eax testl %eax,%eax jne 1f movl $unexpected_floppy_interrupt,%eax 1: call *%eax # "interesting" way of handling intr. pop %fs pop %es pop %ds popl %edx popl %ecx popl %eax iret parallel_interrupt: pushl %eax movb $0x20,%al outb %al,$0x20 popl %eax iret
Wangzhike/HIT-Linux-0.11
2,289
4-processSwitchWithKernelStack/linux-0.11/kernel/asm.s
/* * linux/kernel/asm.s * * (C) 1991 Linus Torvalds */ /* * asm.s contains the low-level code for most hardware faults. * page_exception is handled by the mm, so that isn't here. This * file also handles (hopefully) fpu-exceptions due to TS-bit, as * the fpu must be properly saved/resored. This hasn't been tested. */ .globl divide_error,debug,nmi,int3,overflow,bounds,invalid_op .globl double_fault,coprocessor_segment_overrun .globl invalid_TSS,segment_not_present,stack_segment .globl general_protection,coprocessor_error,irq13,reserved divide_error: pushl $do_divide_error no_error_code: xchgl %eax,(%esp) pushl %ebx pushl %ecx pushl %edx pushl %edi pushl %esi pushl %ebp push %ds push %es push %fs pushl $0 # "error code" lea 44(%esp),%edx pushl %edx movl $0x10,%edx mov %dx,%ds mov %dx,%es mov %dx,%fs call *%eax addl $8,%esp pop %fs pop %es pop %ds popl %ebp popl %esi popl %edi popl %edx popl %ecx popl %ebx popl %eax iret debug: pushl $do_int3 # _do_debug jmp no_error_code nmi: pushl $do_nmi jmp no_error_code int3: pushl $do_int3 jmp no_error_code overflow: pushl $do_overflow jmp no_error_code bounds: pushl $do_bounds jmp no_error_code invalid_op: pushl $do_invalid_op jmp no_error_code coprocessor_segment_overrun: pushl $do_coprocessor_segment_overrun jmp no_error_code reserved: pushl $do_reserved jmp no_error_code irq13: pushl %eax xorb %al,%al outb %al,$0xF0 movb $0x20,%al outb %al,$0x20 jmp 1f 1: jmp 1f 1: outb %al,$0xA0 popl %eax jmp coprocessor_error double_fault: pushl $do_double_fault error_code: xchgl %eax,4(%esp) # error code <-> %eax xchgl %ebx,(%esp) # &function <-> %ebx pushl %ecx pushl %edx pushl %edi pushl %esi pushl %ebp push %ds push %es push %fs pushl %eax # error code lea 44(%esp),%eax # offset pushl %eax movl $0x10,%eax mov %ax,%ds mov %ax,%es mov %ax,%fs call *%ebx addl $8,%esp pop %fs pop %es pop %ds popl %ebp popl %esi popl %edi popl %edx popl %ecx popl %ebx popl %eax iret invalid_TSS: pushl $do_invalid_TSS jmp error_code segment_not_present: pushl $do_segment_not_present jmp error_code stack_segment: pushl $do_stack_segment jmp error_code general_protection: pushl $do_general_protection jmp error_code
Wangzhike/HIT-Linux-0.11
2,710
4-processSwitchWithKernelStack/linux-0.11/kernel/chr_drv/rs_io.s
/* * linux/kernel/rs_io.s * * (C) 1991 Linus Torvalds */ /* * rs_io.s * * This module implements the rs232 io interrupts. */ .text .globl rs1_interrupt,rs2_interrupt size = 1024 /* must be power of two ! and must match the value in tty_io.c!!! */ /* these are the offsets into the read/write buffer structures */ rs_addr = 0 head = 4 tail = 8 proc_list = 12 buf = 16 startup = 256 /* chars left in write queue when we restart it */ /* * These are the actual interrupt routines. They look where * the interrupt is coming from, and take appropriate action. */ .align 2 rs1_interrupt: pushl $table_list+8 jmp rs_int .align 2 rs2_interrupt: pushl $table_list+16 rs_int: pushl %edx pushl %ecx pushl %ebx pushl %eax push %es push %ds /* as this is an interrupt, we cannot */ pushl $0x10 /* know that bs is ok. Load it */ pop %ds pushl $0x10 pop %es movl 24(%esp),%edx movl (%edx),%edx movl rs_addr(%edx),%edx addl $2,%edx /* interrupt ident. reg */ rep_int: xorl %eax,%eax inb %dx,%al testb $1,%al jne end cmpb $6,%al /* this shouldn't happen, but ... */ ja end movl 24(%esp),%ecx pushl %edx subl $2,%edx call jmp_table(,%eax,2) /* NOTE! not *4, bit0 is 0 already */ popl %edx jmp rep_int end: movb $0x20,%al outb %al,$0x20 /* EOI */ pop %ds pop %es popl %eax popl %ebx popl %ecx popl %edx addl $4,%esp # jump over _table_list entry iret jmp_table: .long modem_status,write_char,read_char,line_status .align 2 modem_status: addl $6,%edx /* clear intr by reading modem status reg */ inb %dx,%al ret .align 2 line_status: addl $5,%edx /* clear intr by reading line status reg. */ inb %dx,%al ret .align 2 read_char: inb %dx,%al movl %ecx,%edx subl $table_list,%edx shrl $3,%edx movl (%ecx),%ecx # read-queue movl head(%ecx),%ebx movb %al,buf(%ecx,%ebx) incl %ebx andl $size-1,%ebx cmpl tail(%ecx),%ebx je 1f movl %ebx,head(%ecx) 1: pushl %edx call do_tty_interrupt addl $4,%esp ret .align 2 write_char: movl 4(%ecx),%ecx # write-queue movl head(%ecx),%ebx subl tail(%ecx),%ebx andl $size-1,%ebx # nr chars in queue je write_buffer_empty cmpl $startup,%ebx ja 1f movl proc_list(%ecx),%ebx # wake up sleeping process testl %ebx,%ebx # is there any? je 1f movl $0,(%ebx) 1: movl tail(%ecx),%ebx movb buf(%ecx,%ebx),%al outb %al,%dx incl %ebx andl $size-1,%ebx movl %ebx,tail(%ecx) cmpl head(%ecx),%ebx je write_buffer_empty ret .align 2 write_buffer_empty: movl proc_list(%ecx),%ebx # wake up sleeping process testl %ebx,%ebx # is there any? je 1f movl $0,(%ebx) 1: incl %edx inb %dx,%al jmp 1f 1: jmp 1f 1: andb $0xd,%al /* disable transmit interrupt */ outb %al,%dx ret
Wangzhike/HIT-Linux-0.11
12,774
4-processSwitchWithKernelStack/linux-0.11/kernel/chr_drv/keyboard.S
/* * linux/kernel/keyboard.S * * (C) 1991 Linus Torvalds */ /* * Thanks to Alfred Leung for US keyboard patches * Wolfgang Thiel for German keyboard patches * Marc Corsini for the French keyboard */ #include <linux/config.h> .text .globl keyboard_interrupt /* * these are for the keyboard read functions */ size = 1024 /* must be a power of two ! And MUST be the same as in tty_io.c !!!! */ head = 4 tail = 8 proc_list = 12 buf = 16 mode: .byte 0 /* caps, alt, ctrl and shift mode */ leds: .byte 2 /* num-lock, caps, scroll-lock mode (nom-lock on) */ e0: .byte 0 /* * con_int is the real interrupt routine that reads the * keyboard scan-code and converts it into the appropriate * ascii character(s). */ keyboard_interrupt: pushl %eax pushl %ebx pushl %ecx pushl %edx push %ds push %es movl $0x10,%eax mov %ax,%ds mov %ax,%es xor %al,%al /* %eax is scan code */ inb $0x60,%al cmpb $0xe0,%al je set_e0 cmpb $0xe1,%al je set_e1 call key_table(,%eax,4) movb $0,e0 e0_e1: inb $0x61,%al jmp 1f 1: jmp 1f 1: orb $0x80,%al jmp 1f 1: jmp 1f 1: outb %al,$0x61 jmp 1f 1: jmp 1f 1: andb $0x7F,%al outb %al,$0x61 movb $0x20,%al outb %al,$0x20 pushl $0 call do_tty_interrupt addl $4,%esp pop %es pop %ds popl %edx popl %ecx popl %ebx popl %eax iret set_e0: movb $1,e0 jmp e0_e1 set_e1: movb $2,e0 jmp e0_e1 /* * This routine fills the buffer with max 8 bytes, taken from * %ebx:%eax. (%edx is high). The bytes are written in the * order %al,%ah,%eal,%eah,%bl,%bh ... until %eax is zero. */ put_queue: pushl %ecx pushl %edx movl table_list,%edx # read-queue for console movl head(%edx),%ecx 1: movb %al,buf(%edx,%ecx) incl %ecx andl $size-1,%ecx cmpl tail(%edx),%ecx # buffer full - discard everything je 3f shrdl $8,%ebx,%eax je 2f shrl $8,%ebx jmp 1b 2: movl %ecx,head(%edx) movl proc_list(%edx),%ecx testl %ecx,%ecx je 3f movl $0,(%ecx) 3: popl %edx popl %ecx ret ctrl: movb $0x04,%al jmp 1f alt: movb $0x10,%al 1: cmpb $0,e0 je 2f addb %al,%al 2: orb %al,mode ret unctrl: movb $0x04,%al jmp 1f unalt: movb $0x10,%al 1: cmpb $0,e0 je 2f addb %al,%al 2: notb %al andb %al,mode ret lshift: orb $0x01,mode ret unlshift: andb $0xfe,mode ret rshift: orb $0x02,mode ret unrshift: andb $0xfd,mode ret caps: testb $0x80,mode jne 1f xorb $4,leds xorb $0x40,mode orb $0x80,mode set_leds: call kb_wait movb $0xed,%al /* set leds command */ outb %al,$0x60 call kb_wait movb leds,%al outb %al,$0x60 ret uncaps: andb $0x7f,mode ret scroll: xorb $1,leds jmp set_leds num: xorb $2,leds jmp set_leds /* * curosr-key/numeric keypad cursor keys are handled here. * checking for numeric keypad etc. */ cursor: subb $0x47,%al jb 1f cmpb $12,%al ja 1f jne cur2 /* check for ctrl-alt-del */ testb $0x0c,mode je cur2 testb $0x30,mode jne reboot cur2: cmpb $0x01,e0 /* e0 forces cursor movement */ je cur testb $0x02,leds /* not num-lock forces cursor */ je cur testb $0x03,mode /* shift forces cursor */ jne cur xorl %ebx,%ebx movb num_table(%eax),%al jmp put_queue 1: ret cur: movb cur_table(%eax),%al cmpb $'9,%al ja ok_cur movb $'~,%ah ok_cur: shll $16,%eax movw $0x5b1b,%ax xorl %ebx,%ebx jmp put_queue #if defined(KBD_FR) num_table: .ascii "789 456 1230." #else num_table: .ascii "789 456 1230," #endif cur_table: .ascii "HA5 DGC YB623" /* * this routine handles function keys */ func: pushl %eax pushl %ecx pushl %edx call show_stat popl %edx popl %ecx popl %eax subb $0x3B,%al jb end_func cmpb $9,%al jbe ok_func subb $18,%al cmpb $10,%al jb end_func cmpb $11,%al ja end_func ok_func: cmpl $4,%ecx /* check that there is enough room */ jl end_func movl func_table(,%eax,4),%eax xorl %ebx,%ebx jmp put_queue end_func: ret /* * function keys send F1:'esc [ [ A' F2:'esc [ [ B' etc. */ func_table: .long 0x415b5b1b,0x425b5b1b,0x435b5b1b,0x445b5b1b .long 0x455b5b1b,0x465b5b1b,0x475b5b1b,0x485b5b1b .long 0x495b5b1b,0x4a5b5b1b,0x4b5b5b1b,0x4c5b5b1b #if defined(KBD_FINNISH) key_map: .byte 0,27 .ascii "1234567890+'" .byte 127,9 .ascii "qwertyuiop}" .byte 0,13,0 .ascii "asdfghjkl|{" .byte 0,0 .ascii "'zxcvbnm,.-" .byte 0,'*,0,32 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte '-,0,0,0,'+ /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '< .fill 10,1,0 shift_map: .byte 0,27 .ascii "!\"#$%&/()=?`" .byte 127,9 .ascii "QWERTYUIOP]^" .byte 13,0 .ascii "ASDFGHJKL\\[" .byte 0,0 .ascii "*ZXCVBNM;:_" .byte 0,'*,0,32 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte '-,0,0,0,'+ /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '> .fill 10,1,0 alt_map: .byte 0,0 .ascii "\0@\0$\0\0{[]}\\\0" .byte 0,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte '~,13,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte 0,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte 0,0,0,0 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte 0,0,0,0,0 /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '| .fill 10,1,0 #elif defined(KBD_US) key_map: .byte 0,27 .ascii "1234567890-=" .byte 127,9 .ascii "qwertyuiop[]" .byte 13,0 .ascii "asdfghjkl;'" .byte '`,0 .ascii "\\zxcvbnm,./" .byte 0,'*,0,32 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte '-,0,0,0,'+ /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '< .fill 10,1,0 shift_map: .byte 0,27 .ascii "!@#$%^&*()_+" .byte 127,9 .ascii "QWERTYUIOP{}" .byte 13,0 .ascii "ASDFGHJKL:\"" .byte '~,0 .ascii "|ZXCVBNM<>?" .byte 0,'*,0,32 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte '-,0,0,0,'+ /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '> .fill 10,1,0 alt_map: .byte 0,0 .ascii "\0@\0$\0\0{[]}\\\0" .byte 0,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte '~,13,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte 0,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte 0,0,0,0 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte 0,0,0,0,0 /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '| .fill 10,1,0 #elif defined(KBD_GR) key_map: .byte 0,27 .ascii "1234567890\\'" .byte 127,9 .ascii "qwertzuiop@+" .byte 13,0 .ascii "asdfghjkl[]^" .byte 0,'# .ascii "yxcvbnm,.-" .byte 0,'*,0,32 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte '-,0,0,0,'+ /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '< .fill 10,1,0 shift_map: .byte 0,27 .ascii "!\"#$%&/()=?`" .byte 127,9 .ascii "QWERTZUIOP\\*" .byte 13,0 .ascii "ASDFGHJKL{}~" .byte 0,'' .ascii "YXCVBNM;:_" .byte 0,'*,0,32 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte '-,0,0,0,'+ /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '> .fill 10,1,0 alt_map: .byte 0,0 .ascii "\0@\0$\0\0{[]}\\\0" .byte 0,0 .byte '@,0,0,0,0,0,0,0,0,0,0 .byte '~,13,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte 0,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte 0,0,0,0 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte 0,0,0,0,0 /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '| .fill 10,1,0 #elif defined(KBD_FR) key_map: .byte 0,27 .ascii "&{\"'(-}_/@)=" .byte 127,9 .ascii "azertyuiop^$" .byte 13,0 .ascii "qsdfghjklm|" .byte '`,0,42 /* coin sup gauche, don't know, [*|mu] */ .ascii "wxcvbn,;:!" .byte 0,'*,0,32 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte '-,0,0,0,'+ /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '< .fill 10,1,0 shift_map: .byte 0,27 .ascii "1234567890]+" .byte 127,9 .ascii "AZERTYUIOP<>" .byte 13,0 .ascii "QSDFGHJKLM%" .byte '~,0,'# .ascii "WXCVBN?./\\" .byte 0,'*,0,32 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte '-,0,0,0,'+ /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '> .fill 10,1,0 alt_map: .byte 0,0 .ascii "\0~#{[|`\\^@]}" .byte 0,0 .byte '@,0,0,0,0,0,0,0,0,0,0 .byte '~,13,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte 0,0 .byte 0,0,0,0,0,0,0,0,0,0,0 .byte 0,0,0,0 /* 36-39 */ .fill 16,1,0 /* 3A-49 */ .byte 0,0,0,0,0 /* 4A-4E */ .byte 0,0,0,0,0,0,0 /* 4F-55 */ .byte '| .fill 10,1,0 #else #error "KBD-type not defined" #endif /* * do_self handles "normal" keys, ie keys that don't change meaning * and which have just one character returns. */ do_self: lea alt_map,%ebx testb $0x20,mode /* alt-gr */ jne 1f lea shift_map,%ebx testb $0x03,mode jne 1f lea key_map,%ebx 1: movb (%ebx,%eax),%al orb %al,%al je none testb $0x4c,mode /* ctrl or caps */ je 2f cmpb $'a,%al jb 2f cmpb $'},%al ja 2f subb $32,%al 2: testb $0x0c,mode /* ctrl */ je 3f cmpb $64,%al jb 3f cmpb $64+32,%al jae 3f subb $64,%al 3: testb $0x10,mode /* left alt */ je 4f orb $0x80,%al 4: andl $0xff,%eax xorl %ebx,%ebx call put_queue none: ret /* * minus has a routine of it's own, as a 'E0h' before * the scan code for minus means that the numeric keypad * slash was pushed. */ minus: cmpb $1,e0 jne do_self movl $'/,%eax xorl %ebx,%ebx jmp put_queue /* * This table decides which routine to call when a scan-code has been * gotten. Most routines just call do_self, or none, depending if * they are make or break. */ key_table: .long none,do_self,do_self,do_self /* 00-03 s0 esc 1 2 */ .long do_self,do_self,do_self,do_self /* 04-07 3 4 5 6 */ .long do_self,do_self,do_self,do_self /* 08-0B 7 8 9 0 */ .long do_self,do_self,do_self,do_self /* 0C-0F + ' bs tab */ .long do_self,do_self,do_self,do_self /* 10-13 q w e r */ .long do_self,do_self,do_self,do_self /* 14-17 t y u i */ .long do_self,do_self,do_self,do_self /* 18-1B o p } ^ */ .long do_self,ctrl,do_self,do_self /* 1C-1F enter ctrl a s */ .long do_self,do_self,do_self,do_self /* 20-23 d f g h */ .long do_self,do_self,do_self,do_self /* 24-27 j k l | */ .long do_self,do_self,lshift,do_self /* 28-2B { para lshift , */ .long do_self,do_self,do_self,do_self /* 2C-2F z x c v */ .long do_self,do_self,do_self,do_self /* 30-33 b n m , */ .long do_self,minus,rshift,do_self /* 34-37 . - rshift * */ .long alt,do_self,caps,func /* 38-3B alt sp caps f1 */ .long func,func,func,func /* 3C-3F f2 f3 f4 f5 */ .long func,func,func,func /* 40-43 f6 f7 f8 f9 */ .long func,num,scroll,cursor /* 44-47 f10 num scr home */ .long cursor,cursor,do_self,cursor /* 48-4B up pgup - left */ .long cursor,cursor,do_self,cursor /* 4C-4F n5 right + end */ .long cursor,cursor,cursor,cursor /* 50-53 dn pgdn ins del */ .long none,none,do_self,func /* 54-57 sysreq ? < f11 */ .long func,none,none,none /* 58-5B f12 ? ? ? */ .long none,none,none,none /* 5C-5F ? ? ? ? */ .long none,none,none,none /* 60-63 ? ? ? ? */ .long none,none,none,none /* 64-67 ? ? ? ? */ .long none,none,none,none /* 68-6B ? ? ? ? */ .long none,none,none,none /* 6C-6F ? ? ? ? */ .long none,none,none,none /* 70-73 ? ? ? ? */ .long none,none,none,none /* 74-77 ? ? ? ? */ .long none,none,none,none /* 78-7B ? ? ? ? */ .long none,none,none,none /* 7C-7F ? ? ? ? */ .long none,none,none,none /* 80-83 ? br br br */ .long none,none,none,none /* 84-87 br br br br */ .long none,none,none,none /* 88-8B br br br br */ .long none,none,none,none /* 8C-8F br br br br */ .long none,none,none,none /* 90-93 br br br br */ .long none,none,none,none /* 94-97 br br br br */ .long none,none,none,none /* 98-9B br br br br */ .long none,unctrl,none,none /* 9C-9F br unctrl br br */ .long none,none,none,none /* A0-A3 br br br br */ .long none,none,none,none /* A4-A7 br br br br */ .long none,none,unlshift,none /* A8-AB br br unlshift br */ .long none,none,none,none /* AC-AF br br br br */ .long none,none,none,none /* B0-B3 br br br br */ .long none,none,unrshift,none /* B4-B7 br br unrshift br */ .long unalt,none,uncaps,none /* B8-BB unalt br uncaps br */ .long none,none,none,none /* BC-BF br br br br */ .long none,none,none,none /* C0-C3 br br br br */ .long none,none,none,none /* C4-C7 br br br br */ .long none,none,none,none /* C8-CB br br br br */ .long none,none,none,none /* CC-CF br br br br */ .long none,none,none,none /* D0-D3 br br br br */ .long none,none,none,none /* D4-D7 br br br br */ .long none,none,none,none /* D8-DB br ? ? ? */ .long none,none,none,none /* DC-DF ? ? ? ? */ .long none,none,none,none /* E0-E3 e0 e1 ? ? */ .long none,none,none,none /* E4-E7 ? ? ? ? */ .long none,none,none,none /* E8-EB ? ? ? ? */ .long none,none,none,none /* EC-EF ? ? ? ? */ .long none,none,none,none /* F0-F3 ? ? ? ? */ .long none,none,none,none /* F4-F7 ? ? ? ? */ .long none,none,none,none /* F8-FB ? ? ? ? */ .long none,none,none,none /* FC-FF ? ? ? ? */ /* * kb_wait waits for the keyboard controller buffer to empty. * there is no timeout - if the buffer doesn't empty, we hang. */ kb_wait: pushl %eax 1: inb $0x64,%al testb $0x02,%al jne 1b popl %eax ret /* * This routine reboots the machine by asking the keyboard * controller to pulse the reset-line low. */ reboot: call kb_wait movw $0x1234,0x472 /* don't do memory check */ movb $0xfc,%al /* pulse reset and A20 low */ outb %al,$0x64 die: jmp die
wararyo/CapsuleSampler
6,430
src/Sampler_asm.S
#if defined ( __XTENSA__ ) #if __has_include (<sdkconfig.h>) #include <sdkconfig.h> #endif /// 波形合成処理を行う関数。 ループ一回につき4サンプル分の処理を行う。 // void sampler_process_inner(proc_inner_work_t* work, uint32_t length) // a2 = proc_inner_work_t* work // a3 = uint32_t length .global sampler_process_inner .section .text .align 4 sampler_process_inner: entry sp, 32 lsi f4, a2, 8 // f4 に pos_f を設定 lsi f14,a2, 16 // f14 に pitch を設定 l32i a4, a2, 4 // a4 に出力先アドレスを取得 add.s f5, f4, f14 // f5 = pos_f1 = pos_f + pitch add.s f14,f14,f14 // f14 pitch = pitch * 2 addx4 a15,a3, a4 // a15 に出力先アドレスの終了アドレスを設定 s32i a15,a2, 4 // 出力先終了アドレスを結果データに先に書き戻して置く srli a3, a3, 2 // length /= 4 ループ回数を1/4にする (4サンプルずつ処理するため) beqz a3, PROC_INNER1_END // length が 0 の場合は終了 // ループ開始前の時点で pos_f を4サンプル分作成しておく l32i a8, a2, 0 // a8 に元データのアドレスを取得 add.s f6, f4, f14 // f6 = pos_f2 = pos_f + pitch*2 add.s f7, f5, f14 // f7 = pos_f3 = pos_f1 + pitch*2 add.s f14,f14,f14 // f14 元のpitchの4倍の値になる utrunc.s a13,f5, 0 // a13 = pos_f1 の整数部分を取得 utrunc.s a14,f6, 0 // a14 = pos_f2 の整数部分を取得 utrunc.s a15,f7, 0 // a15 = pos_f3 の整数部分を取得 lsi f15,a2, 12 // f15 に gain を設定 addx2 a9, a13,a8 // a9 に元データの1つ先のサンプルアドレスを取得 addx2 a10,a14,a8 // a10 に元データの2つ先のサンプルアドレスを取得 addx2 a11,a15,a8 // a11 に元データの3つ先のサンプルアドレスを取得 ufloat.s f9, a13, 0 // f9 = pos_f1 の整数部分をfloatに変換 ufloat.s f10,a14, 0 // f10 = pos_f2 の整数部分をfloatに変換 ufloat.s f11,a15, 0 // f11 = pos_f3 の整数部分をfloatに変換 /// ここまでで f4, f5, f6, f7 に pos_f の値が4サンプル分が用意される。 /// また、 a8, a9, a10, a11 に データ取得アドレス 4サンプル分が用意される。 /// pitch は元の値の4倍にして f14 に格納しておく loop a3, PROC_INNER1_LOOP_END // ループ開始 //↓ここのコメントは結果が出るまでに必要なCPUサイクル数。 // 例えば a3:3c は a3に結果が出るのに3サイクルかかることを示す l16si a12,a8, 0 // a12 に元データ0 を取得 l16si a13,a9, 0 // a13 に元データ1 を取得 l16si a14,a8, 2 //f14:2c // a14 に元データ0 の右隣の値を取得 l16si a15,a9, 2 //f15:2c // a15 に元データ1 の右側の値を取得 sub.s f5, f5, f9 // f5 = pos_f1 の小数部分を計算 sub a14,a14,a12 // a14 = diff0 = 元データ0 と右隣の差分を計算 sub a15,a15,a13 // a15 = diff1 = 元データ1 と右隣の差分を計算 float.s f8, a12,0 // f8:1c // f8 = (float)a12 元データ0 を float に変換 float.s f9, a13,0 // f9:1c // f9 = (float)a13 元データ1 を float に変換 float.s f12,a14,0 //f12:1c // f12 = (float)a14 diff0を float に変換 float.s f13,a15,0 //f13:1c // f13 = (float)a15 diff1を float に変換 madd.s f8, f12,f4 // f8:3c // 出力値 f8 += diff0 * pos_f0 madd.s f9, f13,f5 // f9:3c // 出力値 f9 += diff1 * pos_f1 l16si a12,a10,0 // a12 に元データ2 を取得 l16si a13,a11,0 // a13 に元データ3 を取得 l16si a14,a10,2 // a14 に元データ2 の右隣の値を取得 l16si a15,a11,2 // a15 に元データ3 の右側の値を取得 sub.s f6, f6, f10 // f6 = pos_f2 の小数部分を計算 sub.s f7, f7, f11 // f7 = pos_f3 の小数部分を計算 sub a14,a14,a12 // a14 = diff2 = 元データ2 と右隣の差分を計算 sub a15,a15,a13 // a15 = diff3 = 元データ3 と右隣の差分を計算 float.s f10,a12,0 //f10:1c // f10 = (float)a12 元データ2 を float に変換 float.s f11,a13,0 //f11:1c // f11 = (float)a13 元データ3 を float に変換 float.s f12,a14,0 //f12:1c // f12 = (float)a14 diff2を float に変換 float.s f13,a15,0 //f13:1c // f13 = (float)a15 diff3を float に変換 madd.s f10,f12,f6 //f10:3c // 出力値 f10 += diff2 * pos_f2 madd.s f11,f13,f7 //f11:3c // 出力値 f11 += diff3 * pos_f3 // ESP32S3はSIMD命令が使用可能なので分岐する #if CONFIG_IDF_TARGET_ESP32S3 ee.ldf.128.ip f3,f2,f1,f0, a4, 0 // f0~f3 に既存の合成波形を読出しておく #else lsi f0, a4, 0 // f0 に既存の合成波形を読出しておく lsi f1, a4, 4 // f1 に既存の合成波形を読出しておく lsi f2, a4, 8 // f2 に既存の合成波形を読出しておく lsi f3, a4, 12 // f3 に既存の合成波形を読出しておく #endif madd.s f0, f8, f15 // f0:3c // f0 += 出力値 * gain madd.s f1, f9, f15 // f1:3c // f1 += 出力値 * gain madd.s f2,f10, f15 // f2:3c // f2 += 出力値 * gain madd.s f3,f11, f15 // f3:3c // f3 += 出力値 * gain add.s f4, f4, f14 // f4:3c // f4 = pos_f += pitch*4 add.s f5, f5, f14 // f5:3c // f5 = pos_f1 += pitch*4 add.s f6, f6, f14 // f6:3c // f6 = pos_f2 += pitch*4 add.s f7, f7, f14 // f7:3c // f7 = pos_f3 += pitch*4 // ESP32S3はSIMD命令が使用可能なので分岐する #if CONFIG_IDF_TARGET_ESP32S3 ee.stf.128.ip f3,f2,f1,f0, a4, 16 // f0~f3 の値を出力先にストアしa4を16進める #else ssi f0, a4, 0 // 合成結果の値 f0 を出力先にストア ssi f1, a4, 4 // 合成結果の値 f1 を出力先にストア ssi f2, a4, 8 // 合成結果の値 f2 を出力先にストア ssi f3, a4, 12 // 合成結果の値 f3 を出力先にストア addi a4, a4, 16 // 出力先アドレスを a4 を 16 バイト進める #endif utrunc.s a12,f4, 0 //a12:3c // a12 = pos_f の整数部分を取得 utrunc.s a13,f5, 0 //a13:3c // a13 = pos_f1 の整数部分を取得 utrunc.s a14,f6, 0 //a14:3c // a14 = pos_f2 の整数部分を取得 utrunc.s a15,f7, 0 //a15:3c // a15 = pos_f3 の整数部分を取得 addx2 a8, a12,a8 // a8 サンプルアドレスを進める addx2 a9, a13,a9 // a9 サンプルアドレスを進める addx2 a10,a14,a10 // a10 サンプルアドレスを進める addx2 a11,a15,a11 // a11 サンプルアドレスを進める ufloat.s f8, a12, 0 // f8:1c // f8 = pos_f の整数部分をfloatに変換 ufloat.s f9, a13, 0 // f9:1c // f9 = pos_f1 の整数部分をfloatに変換 ufloat.s f10,a14, 0 //f10:1c // f10 = pos_f2 の整数部分をfloatに変換 ufloat.s f11,a15, 0 //f11:1c // f11 = pos_f3 の整数部分をfloatに変換 sub.s f4, f4, f8 // f4 = pos_f の小数部分を計算 PROC_INNER1_LOOP_END: s32i a8, a2, 0 ssi f4, a2, 8 PROC_INNER1_END: retw #endif
MorseMicro/mm-iot-sdk
17,506
applications/mm-ekh08-u575/m2m_controller/bsp/startup_stm32u575zitxq.s
/** ****************************************************************************** * @file startup_stm32u575xx.s * @author MCD Application Team * @brief STM32U575xx devices vector table GCC toolchain. * This module performs: * - Set the initial SP * - Set the initial PC == Reset_Handler, * - Set the vector table entries with the exceptions ISR address, * - Configure the clock system * - Branches to main in the C library (which eventually * calls main()). * After Reset the Cortex-M33 processor is in Thread mode, * priority is Privileged, and the Stack is set to Main. ******************************************************************************* * @attention * * Copyright (c) 2021 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file * in the root directory of this software component. * If no LICENSE file comes with this software, it is provided AS-IS. * ******************************************************************************* */ .syntax unified .cpu cortex-m33 .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 .equ BootRAM, 0xF1E0F85F /** * @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 */ /* 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 initialization function.*/ bl SystemInit /* Call static constructors */ bl __libc_init_array /* Call the application's entry point.*/ bl main LoopForever: b LoopForever .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 /** * @brief This is a placeholder for the bootloader. * Since there is no bootloader, we just duplicate the reset vector. */ .section .bootloader,"a",%progbits .word _estack .word Reset_Handler /****************************************************************************** * * The minimal vector table for a Cortex-M33. 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 SecureFault_Handler .word 0 .word 0 .word 0 .word SVC_Handler .word DebugMon_Handler .word 0 .word PendSV_Handler .word SysTick_Handler .word WWDG_IRQHandler .word PVD_PVM_IRQHandler .word RTC_IRQHandler .word RTC_S_IRQHandler .word TAMP_IRQHandler .word RAMCFG_IRQHandler .word FLASH_IRQHandler .word FLASH_S_IRQHandler .word GTZC_IRQHandler .word RCC_IRQHandler .word RCC_S_IRQHandler .word EXTI0_IRQHandler .word EXTI1_IRQHandler .word EXTI2_IRQHandler .word EXTI3_IRQHandler .word EXTI4_IRQHandler .word EXTI5_IRQHandler .word EXTI6_IRQHandler .word EXTI7_IRQHandler .word EXTI8_IRQHandler .word EXTI9_IRQHandler .word EXTI10_IRQHandler .word EXTI11_IRQHandler .word EXTI12_IRQHandler .word EXTI13_IRQHandler .word EXTI14_IRQHandler .word EXTI15_IRQHandler .word IWDG_IRQHandler .word 0 .word GPDMA1_Channel0_IRQHandler .word GPDMA1_Channel1_IRQHandler .word GPDMA1_Channel2_IRQHandler .word GPDMA1_Channel3_IRQHandler .word GPDMA1_Channel4_IRQHandler .word GPDMA1_Channel5_IRQHandler .word GPDMA1_Channel6_IRQHandler .word GPDMA1_Channel7_IRQHandler .word ADC1_IRQHandler .word DAC1_IRQHandler .word FDCAN1_IT0_IRQHandler .word FDCAN1_IT1_IRQHandler .word TIM1_BRK_IRQHandler .word TIM1_UP_IRQHandler .word TIM1_TRG_COM_IRQHandler .word TIM1_CC_IRQHandler .word TIM2_IRQHandler .word TIM3_IRQHandler .word TIM4_IRQHandler .word TIM5_IRQHandler .word TIM6_IRQHandler .word TIM7_IRQHandler .word TIM8_BRK_IRQHandler .word TIM8_UP_IRQHandler .word TIM8_TRG_COM_IRQHandler .word TIM8_CC_IRQHandler .word I2C1_EV_IRQHandler .word I2C1_ER_IRQHandler .word I2C2_EV_IRQHandler .word I2C2_ER_IRQHandler .word SPI1_IRQHandler .word SPI2_IRQHandler .word USART1_IRQHandler .word USART2_IRQHandler .word USART3_IRQHandler .word UART4_IRQHandler .word UART5_IRQHandler .word LPUART1_IRQHandler .word LPTIM1_IRQHandler .word LPTIM2_IRQHandler .word TIM15_IRQHandler .word TIM16_IRQHandler .word TIM17_IRQHandler .word COMP_IRQHandler .word OTG_FS_IRQHandler .word CRS_IRQHandler .word FMC_IRQHandler .word OCTOSPI1_IRQHandler .word PWR_S3WU_IRQHandler .word SDMMC1_IRQHandler .word SDMMC2_IRQHandler .word GPDMA1_Channel8_IRQHandler .word GPDMA1_Channel9_IRQHandler .word GPDMA1_Channel10_IRQHandler .word GPDMA1_Channel11_IRQHandler .word GPDMA1_Channel12_IRQHandler .word GPDMA1_Channel13_IRQHandler .word GPDMA1_Channel14_IRQHandler .word GPDMA1_Channel15_IRQHandler .word I2C3_EV_IRQHandler .word I2C3_ER_IRQHandler .word SAI1_IRQHandler .word SAI2_IRQHandler .word TSC_IRQHandler .word 0 .word RNG_IRQHandler .word FPU_IRQHandler .word HASH_IRQHandler .word 0 .word LPTIM3_IRQHandler .word SPI3_IRQHandler .word I2C4_ER_IRQHandler .word I2C4_EV_IRQHandler .word MDF1_FLT0_IRQHandler .word MDF1_FLT1_IRQHandler .word MDF1_FLT2_IRQHandler .word MDF1_FLT3_IRQHandler .word UCPD1_IRQHandler .word ICACHE_IRQHandler .word 0 .word 0 .word LPTIM4_IRQHandler .word DCACHE1_IRQHandler .word ADF1_IRQHandler .word ADC4_IRQHandler .word LPDMA1_Channel0_IRQHandler .word LPDMA1_Channel1_IRQHandler .word LPDMA1_Channel2_IRQHandler .word LPDMA1_Channel3_IRQHandler .word DMA2D_IRQHandler .word DCMI_PSSI_IRQHandler .word OCTOSPI2_IRQHandler .word MDF1_FLT4_IRQHandler .word MDF1_FLT5_IRQHandler .word CORDIC_IRQHandler .word FMAC_IRQHandler /******************************************************************************* * * 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 SecureFault_Handler .thumb_set SecureFault_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_PVM_IRQHandler .thumb_set PVD_PVM_IRQHandler,Default_Handler .weak RTC_IRQHandler .thumb_set RTC_IRQHandler,Default_Handler .weak RTC_S_IRQHandler .thumb_set RTC_S_IRQHandler,Default_Handler .weak TAMP_IRQHandler .thumb_set TAMP_IRQHandler,Default_Handler .weak RAMCFG_IRQHandler .thumb_set RAMCFG_IRQHandler,Default_Handler .weak FLASH_IRQHandler .thumb_set FLASH_IRQHandler,Default_Handler .weak FLASH_S_IRQHandler .thumb_set FLASH_S_IRQHandler,Default_Handler .weak GTZC_IRQHandler .thumb_set GTZC_IRQHandler,Default_Handler .weak RCC_IRQHandler .thumb_set RCC_IRQHandler,Default_Handler .weak RCC_S_IRQHandler .thumb_set RCC_S_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 EXTI5_IRQHandler .thumb_set EXTI5_IRQHandler,Default_Handler .weak EXTI6_IRQHandler .thumb_set EXTI6_IRQHandler,Default_Handler .weak EXTI7_IRQHandler .thumb_set EXTI7_IRQHandler,Default_Handler .weak EXTI8_IRQHandler .thumb_set EXTI8_IRQHandler,Default_Handler .weak EXTI9_IRQHandler .thumb_set EXTI9_IRQHandler,Default_Handler .weak EXTI10_IRQHandler .thumb_set EXTI10_IRQHandler,Default_Handler .weak EXTI11_IRQHandler .thumb_set EXTI11_IRQHandler,Default_Handler .weak EXTI12_IRQHandler .thumb_set EXTI12_IRQHandler,Default_Handler .weak EXTI13_IRQHandler .thumb_set EXTI13_IRQHandler,Default_Handler .weak EXTI14_IRQHandler .thumb_set EXTI14_IRQHandler,Default_Handler .weak EXTI15_IRQHandler .thumb_set EXTI15_IRQHandler,Default_Handler .weak IWDG_IRQHandler .thumb_set IWDG_IRQHandler,Default_Handler .weak GPDMA1_Channel0_IRQHandler .thumb_set GPDMA1_Channel0_IRQHandler,Default_Handler .weak GPDMA1_Channel1_IRQHandler .thumb_set GPDMA1_Channel1_IRQHandler,Default_Handler .weak GPDMA1_Channel2_IRQHandler .thumb_set GPDMA1_Channel2_IRQHandler,Default_Handler .weak GPDMA1_Channel3_IRQHandler .thumb_set GPDMA1_Channel3_IRQHandler,Default_Handler .weak GPDMA1_Channel4_IRQHandler .thumb_set GPDMA1_Channel4_IRQHandler,Default_Handler .weak GPDMA1_Channel5_IRQHandler .thumb_set GPDMA1_Channel5_IRQHandler,Default_Handler .weak GPDMA1_Channel6_IRQHandler .thumb_set GPDMA1_Channel6_IRQHandler,Default_Handler .weak GPDMA1_Channel7_IRQHandler .thumb_set GPDMA1_Channel7_IRQHandler,Default_Handler .weak ADC1_IRQHandler .thumb_set ADC1_IRQHandler,Default_Handler .weak DAC1_IRQHandler .thumb_set DAC1_IRQHandler,Default_Handler .weak FDCAN1_IT0_IRQHandler .thumb_set FDCAN1_IT0_IRQHandler,Default_Handler .weak FDCAN1_IT1_IRQHandler .thumb_set FDCAN1_IT1_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 TIM5_IRQHandler .thumb_set TIM5_IRQHandler,Default_Handler .weak TIM6_IRQHandler .thumb_set TIM6_IRQHandler,Default_Handler .weak TIM7_IRQHandler .thumb_set TIM7_IRQHandler,Default_Handler .weak TIM8_BRK_IRQHandler .thumb_set TIM8_BRK_IRQHandler,Default_Handler .weak TIM8_UP_IRQHandler .thumb_set TIM8_UP_IRQHandler,Default_Handler .weak TIM8_TRG_COM_IRQHandler .thumb_set TIM8_TRG_COM_IRQHandler,Default_Handler .weak TIM8_CC_IRQHandler .thumb_set TIM8_CC_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 UART4_IRQHandler .thumb_set UART4_IRQHandler,Default_Handler .weak UART5_IRQHandler .thumb_set UART5_IRQHandler,Default_Handler .weak LPUART1_IRQHandler .thumb_set LPUART1_IRQHandler,Default_Handler .weak LPTIM1_IRQHandler .thumb_set LPTIM1_IRQHandler,Default_Handler .weak LPTIM2_IRQHandler .thumb_set LPTIM2_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 COMP_IRQHandler .thumb_set COMP_IRQHandler,Default_Handler .weak OTG_FS_IRQHandler .thumb_set OTG_FS_IRQHandler,Default_Handler .weak CRS_IRQHandler .thumb_set CRS_IRQHandler,Default_Handler .weak FMC_IRQHandler .thumb_set FMC_IRQHandler,Default_Handler .weak OCTOSPI1_IRQHandler .thumb_set OCTOSPI1_IRQHandler,Default_Handler .weak PWR_S3WU_IRQHandler .thumb_set PWR_S3WU_IRQHandler,Default_Handler .weak SDMMC1_IRQHandler .thumb_set SDMMC1_IRQHandler,Default_Handler .weak SDMMC2_IRQHandler .thumb_set SDMMC2_IRQHandler,Default_Handler .weak GPDMA1_Channel8_IRQHandler .thumb_set GPDMA1_Channel8_IRQHandler,Default_Handler .weak GPDMA1_Channel9_IRQHandler .thumb_set GPDMA1_Channel9_IRQHandler,Default_Handler .weak GPDMA1_Channel10_IRQHandler .thumb_set GPDMA1_Channel10_IRQHandler,Default_Handler .weak GPDMA1_Channel11_IRQHandler .thumb_set GPDMA1_Channel11_IRQHandler,Default_Handler .weak GPDMA1_Channel12_IRQHandler .thumb_set GPDMA1_Channel12_IRQHandler,Default_Handler .weak GPDMA1_Channel13_IRQHandler .thumb_set GPDMA1_Channel13_IRQHandler,Default_Handler .weak GPDMA1_Channel14_IRQHandler .thumb_set GPDMA1_Channel14_IRQHandler,Default_Handler .weak GPDMA1_Channel15_IRQHandler .thumb_set GPDMA1_Channel15_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 SAI1_IRQHandler .thumb_set SAI1_IRQHandler,Default_Handler .weak SAI2_IRQHandler .thumb_set SAI2_IRQHandler,Default_Handler .weak TSC_IRQHandler .thumb_set TSC_IRQHandler,Default_Handler .weak RNG_IRQHandler .thumb_set RNG_IRQHandler,Default_Handler .weak FPU_IRQHandler .thumb_set FPU_IRQHandler,Default_Handler .weak HASH_IRQHandler .thumb_set HASH_IRQHandler,Default_Handler .weak LPTIM3_IRQHandler .thumb_set LPTIM3_IRQHandler,Default_Handler .weak SPI3_IRQHandler .thumb_set SPI3_IRQHandler,Default_Handler .weak I2C4_ER_IRQHandler .thumb_set I2C4_ER_IRQHandler,Default_Handler .weak I2C4_EV_IRQHandler .thumb_set I2C4_EV_IRQHandler,Default_Handler .weak MDF1_FLT0_IRQHandler .thumb_set MDF1_FLT0_IRQHandler,Default_Handler .weak MDF1_FLT1_IRQHandler .thumb_set MDF1_FLT1_IRQHandler,Default_Handler .weak MDF1_FLT2_IRQHandler .thumb_set MDF1_FLT2_IRQHandler,Default_Handler .weak MDF1_FLT3_IRQHandler .thumb_set MDF1_FLT3_IRQHandler,Default_Handler .weak UCPD1_IRQHandler .thumb_set UCPD1_IRQHandler,Default_Handler .weak ICACHE_IRQHandler .thumb_set ICACHE_IRQHandler,Default_Handler .weak LPTIM4_IRQHandler .thumb_set LPTIM4_IRQHandler,Default_Handler .weak DCACHE1_IRQHandler .thumb_set DCACHE1_IRQHandler,Default_Handler .weak ADF1_IRQHandler .thumb_set ADF1_IRQHandler,Default_Handler .weak ADC4_IRQHandler .thumb_set ADC4_IRQHandler,Default_Handler .weak LPDMA1_Channel0_IRQHandler .thumb_set LPDMA1_Channel0_IRQHandler,Default_Handler .weak LPDMA1_Channel1_IRQHandler .thumb_set LPDMA1_Channel1_IRQHandler,Default_Handler .weak LPDMA1_Channel2_IRQHandler .thumb_set LPDMA1_Channel2_IRQHandler,Default_Handler .weak LPDMA1_Channel3_IRQHandler .thumb_set LPDMA1_Channel3_IRQHandler,Default_Handler .weak DMA2D_IRQHandler .thumb_set DMA2D_IRQHandler,Default_Handler .weak DCMI_PSSI_IRQHandler .thumb_set DCMI_PSSI_IRQHandler,Default_Handler .weak OCTOSPI2_IRQHandler .thumb_set OCTOSPI2_IRQHandler,Default_Handler .weak MDF1_FLT4_IRQHandler .thumb_set MDF1_FLT4_IRQHandler,Default_Handler .weak MDF1_FLT5_IRQHandler .thumb_set MDF1_FLT5_IRQHandler,Default_Handler .weak CORDIC_IRQHandler .thumb_set CORDIC_IRQHandler,Default_Handler .weak FMAC_IRQHandler .thumb_set FMAC_IRQHandler,Default_Handler
MorseMicro/mm-iot-sdk
17,506
applications/mm-ekh08-u575/m2m_agent/bsp/startup_stm32u575zitxq.s
/** ****************************************************************************** * @file startup_stm32u575xx.s * @author MCD Application Team * @brief STM32U575xx devices vector table GCC toolchain. * This module performs: * - Set the initial SP * - Set the initial PC == Reset_Handler, * - Set the vector table entries with the exceptions ISR address, * - Configure the clock system * - Branches to main in the C library (which eventually * calls main()). * After Reset the Cortex-M33 processor is in Thread mode, * priority is Privileged, and the Stack is set to Main. ******************************************************************************* * @attention * * Copyright (c) 2021 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file * in the root directory of this software component. * If no LICENSE file comes with this software, it is provided AS-IS. * ******************************************************************************* */ .syntax unified .cpu cortex-m33 .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 .equ BootRAM, 0xF1E0F85F /** * @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 */ /* 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 initialization function.*/ bl SystemInit /* Call static constructors */ bl __libc_init_array /* Call the application's entry point.*/ bl main LoopForever: b LoopForever .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 /** * @brief This is a placeholder for the bootloader. * Since there is no bootloader, we just duplicate the reset vector. */ .section .bootloader,"a",%progbits .word _estack .word Reset_Handler /****************************************************************************** * * The minimal vector table for a Cortex-M33. 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 SecureFault_Handler .word 0 .word 0 .word 0 .word SVC_Handler .word DebugMon_Handler .word 0 .word PendSV_Handler .word SysTick_Handler .word WWDG_IRQHandler .word PVD_PVM_IRQHandler .word RTC_IRQHandler .word RTC_S_IRQHandler .word TAMP_IRQHandler .word RAMCFG_IRQHandler .word FLASH_IRQHandler .word FLASH_S_IRQHandler .word GTZC_IRQHandler .word RCC_IRQHandler .word RCC_S_IRQHandler .word EXTI0_IRQHandler .word EXTI1_IRQHandler .word EXTI2_IRQHandler .word EXTI3_IRQHandler .word EXTI4_IRQHandler .word EXTI5_IRQHandler .word EXTI6_IRQHandler .word EXTI7_IRQHandler .word EXTI8_IRQHandler .word EXTI9_IRQHandler .word EXTI10_IRQHandler .word EXTI11_IRQHandler .word EXTI12_IRQHandler .word EXTI13_IRQHandler .word EXTI14_IRQHandler .word EXTI15_IRQHandler .word IWDG_IRQHandler .word 0 .word GPDMA1_Channel0_IRQHandler .word GPDMA1_Channel1_IRQHandler .word GPDMA1_Channel2_IRQHandler .word GPDMA1_Channel3_IRQHandler .word GPDMA1_Channel4_IRQHandler .word GPDMA1_Channel5_IRQHandler .word GPDMA1_Channel6_IRQHandler .word GPDMA1_Channel7_IRQHandler .word ADC1_IRQHandler .word DAC1_IRQHandler .word FDCAN1_IT0_IRQHandler .word FDCAN1_IT1_IRQHandler .word TIM1_BRK_IRQHandler .word TIM1_UP_IRQHandler .word TIM1_TRG_COM_IRQHandler .word TIM1_CC_IRQHandler .word TIM2_IRQHandler .word TIM3_IRQHandler .word TIM4_IRQHandler .word TIM5_IRQHandler .word TIM6_IRQHandler .word TIM7_IRQHandler .word TIM8_BRK_IRQHandler .word TIM8_UP_IRQHandler .word TIM8_TRG_COM_IRQHandler .word TIM8_CC_IRQHandler .word I2C1_EV_IRQHandler .word I2C1_ER_IRQHandler .word I2C2_EV_IRQHandler .word I2C2_ER_IRQHandler .word SPI1_IRQHandler .word SPI2_IRQHandler .word USART1_IRQHandler .word USART2_IRQHandler .word USART3_IRQHandler .word UART4_IRQHandler .word UART5_IRQHandler .word LPUART1_IRQHandler .word LPTIM1_IRQHandler .word LPTIM2_IRQHandler .word TIM15_IRQHandler .word TIM16_IRQHandler .word TIM17_IRQHandler .word COMP_IRQHandler .word OTG_FS_IRQHandler .word CRS_IRQHandler .word FMC_IRQHandler .word OCTOSPI1_IRQHandler .word PWR_S3WU_IRQHandler .word SDMMC1_IRQHandler .word SDMMC2_IRQHandler .word GPDMA1_Channel8_IRQHandler .word GPDMA1_Channel9_IRQHandler .word GPDMA1_Channel10_IRQHandler .word GPDMA1_Channel11_IRQHandler .word GPDMA1_Channel12_IRQHandler .word GPDMA1_Channel13_IRQHandler .word GPDMA1_Channel14_IRQHandler .word GPDMA1_Channel15_IRQHandler .word I2C3_EV_IRQHandler .word I2C3_ER_IRQHandler .word SAI1_IRQHandler .word SAI2_IRQHandler .word TSC_IRQHandler .word 0 .word RNG_IRQHandler .word FPU_IRQHandler .word HASH_IRQHandler .word 0 .word LPTIM3_IRQHandler .word SPI3_IRQHandler .word I2C4_ER_IRQHandler .word I2C4_EV_IRQHandler .word MDF1_FLT0_IRQHandler .word MDF1_FLT1_IRQHandler .word MDF1_FLT2_IRQHandler .word MDF1_FLT3_IRQHandler .word UCPD1_IRQHandler .word ICACHE_IRQHandler .word 0 .word 0 .word LPTIM4_IRQHandler .word DCACHE1_IRQHandler .word ADF1_IRQHandler .word ADC4_IRQHandler .word LPDMA1_Channel0_IRQHandler .word LPDMA1_Channel1_IRQHandler .word LPDMA1_Channel2_IRQHandler .word LPDMA1_Channel3_IRQHandler .word DMA2D_IRQHandler .word DCMI_PSSI_IRQHandler .word OCTOSPI2_IRQHandler .word MDF1_FLT4_IRQHandler .word MDF1_FLT5_IRQHandler .word CORDIC_IRQHandler .word FMAC_IRQHandler /******************************************************************************* * * 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 SecureFault_Handler .thumb_set SecureFault_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_PVM_IRQHandler .thumb_set PVD_PVM_IRQHandler,Default_Handler .weak RTC_IRQHandler .thumb_set RTC_IRQHandler,Default_Handler .weak RTC_S_IRQHandler .thumb_set RTC_S_IRQHandler,Default_Handler .weak TAMP_IRQHandler .thumb_set TAMP_IRQHandler,Default_Handler .weak RAMCFG_IRQHandler .thumb_set RAMCFG_IRQHandler,Default_Handler .weak FLASH_IRQHandler .thumb_set FLASH_IRQHandler,Default_Handler .weak FLASH_S_IRQHandler .thumb_set FLASH_S_IRQHandler,Default_Handler .weak GTZC_IRQHandler .thumb_set GTZC_IRQHandler,Default_Handler .weak RCC_IRQHandler .thumb_set RCC_IRQHandler,Default_Handler .weak RCC_S_IRQHandler .thumb_set RCC_S_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 EXTI5_IRQHandler .thumb_set EXTI5_IRQHandler,Default_Handler .weak EXTI6_IRQHandler .thumb_set EXTI6_IRQHandler,Default_Handler .weak EXTI7_IRQHandler .thumb_set EXTI7_IRQHandler,Default_Handler .weak EXTI8_IRQHandler .thumb_set EXTI8_IRQHandler,Default_Handler .weak EXTI9_IRQHandler .thumb_set EXTI9_IRQHandler,Default_Handler .weak EXTI10_IRQHandler .thumb_set EXTI10_IRQHandler,Default_Handler .weak EXTI11_IRQHandler .thumb_set EXTI11_IRQHandler,Default_Handler .weak EXTI12_IRQHandler .thumb_set EXTI12_IRQHandler,Default_Handler .weak EXTI13_IRQHandler .thumb_set EXTI13_IRQHandler,Default_Handler .weak EXTI14_IRQHandler .thumb_set EXTI14_IRQHandler,Default_Handler .weak EXTI15_IRQHandler .thumb_set EXTI15_IRQHandler,Default_Handler .weak IWDG_IRQHandler .thumb_set IWDG_IRQHandler,Default_Handler .weak GPDMA1_Channel0_IRQHandler .thumb_set GPDMA1_Channel0_IRQHandler,Default_Handler .weak GPDMA1_Channel1_IRQHandler .thumb_set GPDMA1_Channel1_IRQHandler,Default_Handler .weak GPDMA1_Channel2_IRQHandler .thumb_set GPDMA1_Channel2_IRQHandler,Default_Handler .weak GPDMA1_Channel3_IRQHandler .thumb_set GPDMA1_Channel3_IRQHandler,Default_Handler .weak GPDMA1_Channel4_IRQHandler .thumb_set GPDMA1_Channel4_IRQHandler,Default_Handler .weak GPDMA1_Channel5_IRQHandler .thumb_set GPDMA1_Channel5_IRQHandler,Default_Handler .weak GPDMA1_Channel6_IRQHandler .thumb_set GPDMA1_Channel6_IRQHandler,Default_Handler .weak GPDMA1_Channel7_IRQHandler .thumb_set GPDMA1_Channel7_IRQHandler,Default_Handler .weak ADC1_IRQHandler .thumb_set ADC1_IRQHandler,Default_Handler .weak DAC1_IRQHandler .thumb_set DAC1_IRQHandler,Default_Handler .weak FDCAN1_IT0_IRQHandler .thumb_set FDCAN1_IT0_IRQHandler,Default_Handler .weak FDCAN1_IT1_IRQHandler .thumb_set FDCAN1_IT1_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 TIM5_IRQHandler .thumb_set TIM5_IRQHandler,Default_Handler .weak TIM6_IRQHandler .thumb_set TIM6_IRQHandler,Default_Handler .weak TIM7_IRQHandler .thumb_set TIM7_IRQHandler,Default_Handler .weak TIM8_BRK_IRQHandler .thumb_set TIM8_BRK_IRQHandler,Default_Handler .weak TIM8_UP_IRQHandler .thumb_set TIM8_UP_IRQHandler,Default_Handler .weak TIM8_TRG_COM_IRQHandler .thumb_set TIM8_TRG_COM_IRQHandler,Default_Handler .weak TIM8_CC_IRQHandler .thumb_set TIM8_CC_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 UART4_IRQHandler .thumb_set UART4_IRQHandler,Default_Handler .weak UART5_IRQHandler .thumb_set UART5_IRQHandler,Default_Handler .weak LPUART1_IRQHandler .thumb_set LPUART1_IRQHandler,Default_Handler .weak LPTIM1_IRQHandler .thumb_set LPTIM1_IRQHandler,Default_Handler .weak LPTIM2_IRQHandler .thumb_set LPTIM2_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 COMP_IRQHandler .thumb_set COMP_IRQHandler,Default_Handler .weak OTG_FS_IRQHandler .thumb_set OTG_FS_IRQHandler,Default_Handler .weak CRS_IRQHandler .thumb_set CRS_IRQHandler,Default_Handler .weak FMC_IRQHandler .thumb_set FMC_IRQHandler,Default_Handler .weak OCTOSPI1_IRQHandler .thumb_set OCTOSPI1_IRQHandler,Default_Handler .weak PWR_S3WU_IRQHandler .thumb_set PWR_S3WU_IRQHandler,Default_Handler .weak SDMMC1_IRQHandler .thumb_set SDMMC1_IRQHandler,Default_Handler .weak SDMMC2_IRQHandler .thumb_set SDMMC2_IRQHandler,Default_Handler .weak GPDMA1_Channel8_IRQHandler .thumb_set GPDMA1_Channel8_IRQHandler,Default_Handler .weak GPDMA1_Channel9_IRQHandler .thumb_set GPDMA1_Channel9_IRQHandler,Default_Handler .weak GPDMA1_Channel10_IRQHandler .thumb_set GPDMA1_Channel10_IRQHandler,Default_Handler .weak GPDMA1_Channel11_IRQHandler .thumb_set GPDMA1_Channel11_IRQHandler,Default_Handler .weak GPDMA1_Channel12_IRQHandler .thumb_set GPDMA1_Channel12_IRQHandler,Default_Handler .weak GPDMA1_Channel13_IRQHandler .thumb_set GPDMA1_Channel13_IRQHandler,Default_Handler .weak GPDMA1_Channel14_IRQHandler .thumb_set GPDMA1_Channel14_IRQHandler,Default_Handler .weak GPDMA1_Channel15_IRQHandler .thumb_set GPDMA1_Channel15_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 SAI1_IRQHandler .thumb_set SAI1_IRQHandler,Default_Handler .weak SAI2_IRQHandler .thumb_set SAI2_IRQHandler,Default_Handler .weak TSC_IRQHandler .thumb_set TSC_IRQHandler,Default_Handler .weak RNG_IRQHandler .thumb_set RNG_IRQHandler,Default_Handler .weak FPU_IRQHandler .thumb_set FPU_IRQHandler,Default_Handler .weak HASH_IRQHandler .thumb_set HASH_IRQHandler,Default_Handler .weak LPTIM3_IRQHandler .thumb_set LPTIM3_IRQHandler,Default_Handler .weak SPI3_IRQHandler .thumb_set SPI3_IRQHandler,Default_Handler .weak I2C4_ER_IRQHandler .thumb_set I2C4_ER_IRQHandler,Default_Handler .weak I2C4_EV_IRQHandler .thumb_set I2C4_EV_IRQHandler,Default_Handler .weak MDF1_FLT0_IRQHandler .thumb_set MDF1_FLT0_IRQHandler,Default_Handler .weak MDF1_FLT1_IRQHandler .thumb_set MDF1_FLT1_IRQHandler,Default_Handler .weak MDF1_FLT2_IRQHandler .thumb_set MDF1_FLT2_IRQHandler,Default_Handler .weak MDF1_FLT3_IRQHandler .thumb_set MDF1_FLT3_IRQHandler,Default_Handler .weak UCPD1_IRQHandler .thumb_set UCPD1_IRQHandler,Default_Handler .weak ICACHE_IRQHandler .thumb_set ICACHE_IRQHandler,Default_Handler .weak LPTIM4_IRQHandler .thumb_set LPTIM4_IRQHandler,Default_Handler .weak DCACHE1_IRQHandler .thumb_set DCACHE1_IRQHandler,Default_Handler .weak ADF1_IRQHandler .thumb_set ADF1_IRQHandler,Default_Handler .weak ADC4_IRQHandler .thumb_set ADC4_IRQHandler,Default_Handler .weak LPDMA1_Channel0_IRQHandler .thumb_set LPDMA1_Channel0_IRQHandler,Default_Handler .weak LPDMA1_Channel1_IRQHandler .thumb_set LPDMA1_Channel1_IRQHandler,Default_Handler .weak LPDMA1_Channel2_IRQHandler .thumb_set LPDMA1_Channel2_IRQHandler,Default_Handler .weak LPDMA1_Channel3_IRQHandler .thumb_set LPDMA1_Channel3_IRQHandler,Default_Handler .weak DMA2D_IRQHandler .thumb_set DMA2D_IRQHandler,Default_Handler .weak DCMI_PSSI_IRQHandler .thumb_set DCMI_PSSI_IRQHandler,Default_Handler .weak OCTOSPI2_IRQHandler .thumb_set OCTOSPI2_IRQHandler,Default_Handler .weak MDF1_FLT4_IRQHandler .thumb_set MDF1_FLT4_IRQHandler,Default_Handler .weak MDF1_FLT5_IRQHandler .thumb_set MDF1_FLT5_IRQHandler,Default_Handler .weak CORDIC_IRQHandler .thumb_set CORDIC_IRQHandler,Default_Handler .weak FMAC_IRQHandler .thumb_set FMAC_IRQHandler,Default_Handler
MorseMicro/mm-iot-sdk
18,027
framework/src/platforms/mm-mm6108-ekh05/bsp/startup_stm32u585VIT6.s
/** ****************************************************************************** * @file startup_stm32u585xx.s * @author MCD Application Team * @brief STM32U585xx devices vector table GCC toolchain. * This module performs: * - Set the initial SP * - Set the initial PC == Reset_Handler, * - Set the vector table entries with the exceptions ISR address, * - Configure the clock system * - Branches to main in the C library (which eventually * calls main()). * After Reset the Cortex-M33 processor is in Thread mode, * priority is Privileged, and the Stack is set to Main. ******************************************************************************* * @attention * * Copyright (c) 2021 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file * in the root directory of this software component. * If no LICENSE file comes with this software, it is provided AS-IS. * ******************************************************************************* */ .syntax unified .cpu cortex-m33 .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 .equ BootRAM, 0xF1E0F85F /** * @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 */ /* 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 initialization function.*/ bl SystemInit /* Call static constructors */ bl __libc_init_array /* Call the application's entry point.*/ bl main LoopForever: b LoopForever .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 /** * @brief This is a placeholder for the bootloader. * Since there is no bootloader, we just duplicate the reset vector. */ .section .bootloader,"a",%progbits .word _estack .word Reset_Handler /****************************************************************************** * * The minimal vector table for a Cortex-M33. 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 SecureFault_Handler .word 0 .word 0 .word 0 .word SVC_Handler .word DebugMon_Handler .word 0 .word PendSV_Handler .word SysTick_Handler .word WWDG_IRQHandler .word PVD_PVM_IRQHandler .word RTC_IRQHandler .word RTC_S_IRQHandler .word TAMP_IRQHandler .word RAMCFG_IRQHandler .word FLASH_IRQHandler .word FLASH_S_IRQHandler .word GTZC_IRQHandler .word RCC_IRQHandler .word RCC_S_IRQHandler .word EXTI0_IRQHandler .word EXTI1_IRQHandler .word EXTI2_IRQHandler .word EXTI3_IRQHandler .word EXTI4_IRQHandler .word EXTI5_IRQHandler .word EXTI6_IRQHandler .word EXTI7_IRQHandler .word EXTI8_IRQHandler .word EXTI9_IRQHandler .word EXTI10_IRQHandler .word EXTI11_IRQHandler .word EXTI12_IRQHandler .word EXTI13_IRQHandler .word EXTI14_IRQHandler .word EXTI15_IRQHandler .word IWDG_IRQHandler .word SAES_IRQHandler .word GPDMA1_Channel0_IRQHandler .word GPDMA1_Channel1_IRQHandler .word GPDMA1_Channel2_IRQHandler .word GPDMA1_Channel3_IRQHandler .word GPDMA1_Channel4_IRQHandler .word GPDMA1_Channel5_IRQHandler .word GPDMA1_Channel6_IRQHandler .word GPDMA1_Channel7_IRQHandler .word ADC1_IRQHandler .word DAC1_IRQHandler .word FDCAN1_IT0_IRQHandler .word FDCAN1_IT1_IRQHandler .word TIM1_BRK_IRQHandler .word TIM1_UP_IRQHandler .word TIM1_TRG_COM_IRQHandler .word TIM1_CC_IRQHandler .word TIM2_IRQHandler .word TIM3_IRQHandler .word TIM4_IRQHandler .word TIM5_IRQHandler .word TIM6_IRQHandler .word TIM7_IRQHandler .word TIM8_BRK_IRQHandler .word TIM8_UP_IRQHandler .word TIM8_TRG_COM_IRQHandler .word TIM8_CC_IRQHandler .word I2C1_EV_IRQHandler .word I2C1_ER_IRQHandler .word I2C2_EV_IRQHandler .word I2C2_ER_IRQHandler .word SPI1_IRQHandler .word SPI2_IRQHandler .word USART1_IRQHandler .word USART2_IRQHandler .word USART3_IRQHandler .word UART4_IRQHandler .word UART5_IRQHandler .word LPUART1_IRQHandler .word LPTIM1_IRQHandler .word LPTIM2_IRQHandler .word TIM15_IRQHandler .word TIM16_IRQHandler .word TIM17_IRQHandler .word COMP_IRQHandler .word OTG_FS_IRQHandler .word CRS_IRQHandler .word FMC_IRQHandler .word OCTOSPI1_IRQHandler .word PWR_S3WU_IRQHandler .word SDMMC1_IRQHandler .word SDMMC2_IRQHandler .word GPDMA1_Channel8_IRQHandler .word GPDMA1_Channel9_IRQHandler .word GPDMA1_Channel10_IRQHandler .word GPDMA1_Channel11_IRQHandler .word GPDMA1_Channel12_IRQHandler .word GPDMA1_Channel13_IRQHandler .word GPDMA1_Channel14_IRQHandler .word GPDMA1_Channel15_IRQHandler .word I2C3_EV_IRQHandler .word I2C3_ER_IRQHandler .word SAI1_IRQHandler .word SAI2_IRQHandler .word TSC_IRQHandler .word AES_IRQHandler .word RNG_IRQHandler .word FPU_IRQHandler .word HASH_IRQHandler .word PKA_IRQHandler .word LPTIM3_IRQHandler .word SPI3_IRQHandler .word I2C4_ER_IRQHandler .word I2C4_EV_IRQHandler .word MDF1_FLT0_IRQHandler .word MDF1_FLT1_IRQHandler .word MDF1_FLT2_IRQHandler .word MDF1_FLT3_IRQHandler .word UCPD1_IRQHandler .word ICACHE_IRQHandler .word OTFDEC1_IRQHandler .word OTFDEC2_IRQHandler .word LPTIM4_IRQHandler .word DCACHE1_IRQHandler .word ADF1_IRQHandler .word ADC4_IRQHandler .word LPDMA1_Channel0_IRQHandler .word LPDMA1_Channel1_IRQHandler .word LPDMA1_Channel2_IRQHandler .word LPDMA1_Channel3_IRQHandler .word DMA2D_IRQHandler .word DCMI_PSSI_IRQHandler .word OCTOSPI2_IRQHandler .word MDF1_FLT4_IRQHandler .word MDF1_FLT5_IRQHandler .word CORDIC_IRQHandler .word FMAC_IRQHandler .word LSECSSD_IRQHandler /******************************************************************************* * * 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 SecureFault_Handler .thumb_set SecureFault_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_PVM_IRQHandler .thumb_set PVD_PVM_IRQHandler,Default_Handler .weak RTC_IRQHandler .thumb_set RTC_IRQHandler,Default_Handler .weak RTC_S_IRQHandler .thumb_set RTC_S_IRQHandler,Default_Handler .weak TAMP_IRQHandler .thumb_set TAMP_IRQHandler,Default_Handler .weak RAMCFG_IRQHandler .thumb_set RAMCFG_IRQHandler,Default_Handler .weak FLASH_IRQHandler .thumb_set FLASH_IRQHandler,Default_Handler .weak FLASH_S_IRQHandler .thumb_set FLASH_S_IRQHandler,Default_Handler .weak GTZC_IRQHandler .thumb_set GTZC_IRQHandler,Default_Handler .weak RCC_IRQHandler .thumb_set RCC_IRQHandler,Default_Handler .weak RCC_S_IRQHandler .thumb_set RCC_S_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 EXTI5_IRQHandler .thumb_set EXTI5_IRQHandler,Default_Handler .weak EXTI6_IRQHandler .thumb_set EXTI6_IRQHandler,Default_Handler .weak EXTI7_IRQHandler .thumb_set EXTI7_IRQHandler,Default_Handler .weak EXTI8_IRQHandler .thumb_set EXTI8_IRQHandler,Default_Handler .weak EXTI9_IRQHandler .thumb_set EXTI9_IRQHandler,Default_Handler .weak EXTI10_IRQHandler .thumb_set EXTI10_IRQHandler,Default_Handler .weak EXTI11_IRQHandler .thumb_set EXTI11_IRQHandler,Default_Handler .weak EXTI12_IRQHandler .thumb_set EXTI12_IRQHandler,Default_Handler .weak EXTI13_IRQHandler .thumb_set EXTI13_IRQHandler,Default_Handler .weak EXTI14_IRQHandler .thumb_set EXTI14_IRQHandler,Default_Handler .weak EXTI15_IRQHandler .thumb_set EXTI15_IRQHandler,Default_Handler .weak IWDG_IRQHandler .thumb_set IWDG_IRQHandler,Default_Handler .weak SAES_IRQHandler .thumb_set SAES_IRQHandler,Default_Handler .weak GPDMA1_Channel0_IRQHandler .thumb_set GPDMA1_Channel0_IRQHandler,Default_Handler .weak GPDMA1_Channel1_IRQHandler .thumb_set GPDMA1_Channel1_IRQHandler,Default_Handler .weak GPDMA1_Channel2_IRQHandler .thumb_set GPDMA1_Channel2_IRQHandler,Default_Handler .weak GPDMA1_Channel3_IRQHandler .thumb_set GPDMA1_Channel3_IRQHandler,Default_Handler .weak GPDMA1_Channel4_IRQHandler .thumb_set GPDMA1_Channel4_IRQHandler,Default_Handler .weak GPDMA1_Channel5_IRQHandler .thumb_set GPDMA1_Channel5_IRQHandler,Default_Handler .weak GPDMA1_Channel6_IRQHandler .thumb_set GPDMA1_Channel6_IRQHandler,Default_Handler .weak GPDMA1_Channel7_IRQHandler .thumb_set GPDMA1_Channel7_IRQHandler,Default_Handler .weak ADC1_IRQHandler .thumb_set ADC1_IRQHandler,Default_Handler .weak DAC1_IRQHandler .thumb_set DAC1_IRQHandler,Default_Handler .weak FDCAN1_IT0_IRQHandler .thumb_set FDCAN1_IT0_IRQHandler,Default_Handler .weak FDCAN1_IT1_IRQHandler .thumb_set FDCAN1_IT1_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 TIM5_IRQHandler .thumb_set TIM5_IRQHandler,Default_Handler .weak TIM6_IRQHandler .thumb_set TIM6_IRQHandler,Default_Handler .weak TIM7_IRQHandler .thumb_set TIM7_IRQHandler,Default_Handler .weak TIM8_BRK_IRQHandler .thumb_set TIM8_BRK_IRQHandler,Default_Handler .weak TIM8_UP_IRQHandler .thumb_set TIM8_UP_IRQHandler,Default_Handler .weak TIM8_TRG_COM_IRQHandler .thumb_set TIM8_TRG_COM_IRQHandler,Default_Handler .weak TIM8_CC_IRQHandler .thumb_set TIM8_CC_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 UART4_IRQHandler .thumb_set UART4_IRQHandler,Default_Handler .weak UART5_IRQHandler .thumb_set UART5_IRQHandler,Default_Handler .weak LPUART1_IRQHandler .thumb_set LPUART1_IRQHandler,Default_Handler .weak LPTIM1_IRQHandler .thumb_set LPTIM1_IRQHandler,Default_Handler .weak LPTIM2_IRQHandler .thumb_set LPTIM2_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 COMP_IRQHandler .thumb_set COMP_IRQHandler,Default_Handler .weak OTG_FS_IRQHandler .thumb_set OTG_FS_IRQHandler,Default_Handler .weak CRS_IRQHandler .thumb_set CRS_IRQHandler,Default_Handler .weak FMC_IRQHandler .thumb_set FMC_IRQHandler,Default_Handler .weak OCTOSPI1_IRQHandler .thumb_set OCTOSPI1_IRQHandler,Default_Handler .weak PWR_S3WU_IRQHandler .thumb_set PWR_S3WU_IRQHandler,Default_Handler .weak SDMMC1_IRQHandler .thumb_set SDMMC1_IRQHandler,Default_Handler .weak SDMMC2_IRQHandler .thumb_set SDMMC2_IRQHandler,Default_Handler .weak GPDMA1_Channel8_IRQHandler .thumb_set GPDMA1_Channel8_IRQHandler,Default_Handler .weak GPDMA1_Channel9_IRQHandler .thumb_set GPDMA1_Channel9_IRQHandler,Default_Handler .weak GPDMA1_Channel10_IRQHandler .thumb_set GPDMA1_Channel10_IRQHandler,Default_Handler .weak GPDMA1_Channel11_IRQHandler .thumb_set GPDMA1_Channel11_IRQHandler,Default_Handler .weak GPDMA1_Channel12_IRQHandler .thumb_set GPDMA1_Channel12_IRQHandler,Default_Handler .weak GPDMA1_Channel13_IRQHandler .thumb_set GPDMA1_Channel13_IRQHandler,Default_Handler .weak GPDMA1_Channel14_IRQHandler .thumb_set GPDMA1_Channel14_IRQHandler,Default_Handler .weak GPDMA1_Channel15_IRQHandler .thumb_set GPDMA1_Channel15_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 SAI1_IRQHandler .thumb_set SAI1_IRQHandler,Default_Handler .weak SAI2_IRQHandler .thumb_set SAI2_IRQHandler,Default_Handler .weak TSC_IRQHandler .thumb_set TSC_IRQHandler,Default_Handler .weak AES_IRQHandler .thumb_set AES_IRQHandler,Default_Handler .weak RNG_IRQHandler .thumb_set RNG_IRQHandler,Default_Handler .weak FPU_IRQHandler .thumb_set FPU_IRQHandler,Default_Handler .weak HASH_IRQHandler .thumb_set HASH_IRQHandler,Default_Handler .weak PKA_IRQHandler .thumb_set PKA_IRQHandler,Default_Handler .weak LPTIM3_IRQHandler .thumb_set LPTIM3_IRQHandler,Default_Handler .weak SPI3_IRQHandler .thumb_set SPI3_IRQHandler,Default_Handler .weak I2C4_ER_IRQHandler .thumb_set I2C4_ER_IRQHandler,Default_Handler .weak I2C4_EV_IRQHandler .thumb_set I2C4_EV_IRQHandler,Default_Handler .weak MDF1_FLT0_IRQHandler .thumb_set MDF1_FLT0_IRQHandler,Default_Handler .weak MDF1_FLT1_IRQHandler .thumb_set MDF1_FLT1_IRQHandler,Default_Handler .weak MDF1_FLT2_IRQHandler .thumb_set MDF1_FLT2_IRQHandler,Default_Handler .weak MDF1_FLT3_IRQHandler .thumb_set MDF1_FLT3_IRQHandler,Default_Handler .weak UCPD1_IRQHandler .thumb_set UCPD1_IRQHandler,Default_Handler .weak ICACHE_IRQHandler .thumb_set ICACHE_IRQHandler,Default_Handler .weak OTFDEC1_IRQHandler .thumb_set OTFDEC1_IRQHandler,Default_Handler .weak OTFDEC2_IRQHandler .thumb_set OTFDEC2_IRQHandler,Default_Handler .weak LPTIM4_IRQHandler .thumb_set LPTIM4_IRQHandler,Default_Handler .weak DCACHE1_IRQHandler .thumb_set DCACHE1_IRQHandler,Default_Handler .weak ADF1_IRQHandler .thumb_set ADF1_IRQHandler,Default_Handler .weak ADC4_IRQHandler .thumb_set ADC4_IRQHandler,Default_Handler .weak LPDMA1_Channel0_IRQHandler .thumb_set LPDMA1_Channel0_IRQHandler,Default_Handler .weak LPDMA1_Channel1_IRQHandler .thumb_set LPDMA1_Channel1_IRQHandler,Default_Handler .weak LPDMA1_Channel2_IRQHandler .thumb_set LPDMA1_Channel2_IRQHandler,Default_Handler .weak LPDMA1_Channel3_IRQHandler .thumb_set LPDMA1_Channel3_IRQHandler,Default_Handler .weak DMA2D_IRQHandler .thumb_set DMA2D_IRQHandler,Default_Handler .weak DCMI_PSSI_IRQHandler .thumb_set DCMI_PSSI_IRQHandler,Default_Handler .weak OCTOSPI2_IRQHandler .thumb_set OCTOSPI2_IRQHandler,Default_Handler .weak MDF1_FLT4_IRQHandler .thumb_set MDF1_FLT4_IRQHandler,Default_Handler .weak MDF1_FLT5_IRQHandler .thumb_set MDF1_FLT5_IRQHandler,Default_Handler .weak CORDIC_IRQHandler .thumb_set CORDIC_IRQHandler,Default_Handler .weak FMAC_IRQHandler .thumb_set FMAC_IRQHandler,Default_Handler .weak LSECSSD_IRQHandler .thumb_set LSECSSD_IRQHandler,Default_Handler
MorseMicro/mm-iot-sdk
17,506
framework/src/platforms/mm-ekh08-u575/bsp/startup_stm32u575zitxq.s
/** ****************************************************************************** * @file startup_stm32u575xx.s * @author MCD Application Team * @brief STM32U575xx devices vector table GCC toolchain. * This module performs: * - Set the initial SP * - Set the initial PC == Reset_Handler, * - Set the vector table entries with the exceptions ISR address, * - Configure the clock system * - Branches to main in the C library (which eventually * calls main()). * After Reset the Cortex-M33 processor is in Thread mode, * priority is Privileged, and the Stack is set to Main. ******************************************************************************* * @attention * * Copyright (c) 2021 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file * in the root directory of this software component. * If no LICENSE file comes with this software, it is provided AS-IS. * ******************************************************************************* */ .syntax unified .cpu cortex-m33 .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 .equ BootRAM, 0xF1E0F85F /** * @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 */ /* 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 initialization function.*/ bl SystemInit /* Call static constructors */ bl __libc_init_array /* Call the application's entry point.*/ bl main LoopForever: b LoopForever .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 /** * @brief This is a placeholder for the bootloader. * Since there is no bootloader, we just duplicate the reset vector. */ .section .bootloader,"a",%progbits .word _estack .word Reset_Handler /****************************************************************************** * * The minimal vector table for a Cortex-M33. 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 SecureFault_Handler .word 0 .word 0 .word 0 .word SVC_Handler .word DebugMon_Handler .word 0 .word PendSV_Handler .word SysTick_Handler .word WWDG_IRQHandler .word PVD_PVM_IRQHandler .word RTC_IRQHandler .word RTC_S_IRQHandler .word TAMP_IRQHandler .word RAMCFG_IRQHandler .word FLASH_IRQHandler .word FLASH_S_IRQHandler .word GTZC_IRQHandler .word RCC_IRQHandler .word RCC_S_IRQHandler .word EXTI0_IRQHandler .word EXTI1_IRQHandler .word EXTI2_IRQHandler .word EXTI3_IRQHandler .word EXTI4_IRQHandler .word EXTI5_IRQHandler .word EXTI6_IRQHandler .word EXTI7_IRQHandler .word EXTI8_IRQHandler .word EXTI9_IRQHandler .word EXTI10_IRQHandler .word EXTI11_IRQHandler .word EXTI12_IRQHandler .word EXTI13_IRQHandler .word EXTI14_IRQHandler .word EXTI15_IRQHandler .word IWDG_IRQHandler .word 0 .word GPDMA1_Channel0_IRQHandler .word GPDMA1_Channel1_IRQHandler .word GPDMA1_Channel2_IRQHandler .word GPDMA1_Channel3_IRQHandler .word GPDMA1_Channel4_IRQHandler .word GPDMA1_Channel5_IRQHandler .word GPDMA1_Channel6_IRQHandler .word GPDMA1_Channel7_IRQHandler .word ADC1_IRQHandler .word DAC1_IRQHandler .word FDCAN1_IT0_IRQHandler .word FDCAN1_IT1_IRQHandler .word TIM1_BRK_IRQHandler .word TIM1_UP_IRQHandler .word TIM1_TRG_COM_IRQHandler .word TIM1_CC_IRQHandler .word TIM2_IRQHandler .word TIM3_IRQHandler .word TIM4_IRQHandler .word TIM5_IRQHandler .word TIM6_IRQHandler .word TIM7_IRQHandler .word TIM8_BRK_IRQHandler .word TIM8_UP_IRQHandler .word TIM8_TRG_COM_IRQHandler .word TIM8_CC_IRQHandler .word I2C1_EV_IRQHandler .word I2C1_ER_IRQHandler .word I2C2_EV_IRQHandler .word I2C2_ER_IRQHandler .word SPI1_IRQHandler .word SPI2_IRQHandler .word USART1_IRQHandler .word USART2_IRQHandler .word USART3_IRQHandler .word UART4_IRQHandler .word UART5_IRQHandler .word LPUART1_IRQHandler .word LPTIM1_IRQHandler .word LPTIM2_IRQHandler .word TIM15_IRQHandler .word TIM16_IRQHandler .word TIM17_IRQHandler .word COMP_IRQHandler .word OTG_FS_IRQHandler .word CRS_IRQHandler .word FMC_IRQHandler .word OCTOSPI1_IRQHandler .word PWR_S3WU_IRQHandler .word SDMMC1_IRQHandler .word SDMMC2_IRQHandler .word GPDMA1_Channel8_IRQHandler .word GPDMA1_Channel9_IRQHandler .word GPDMA1_Channel10_IRQHandler .word GPDMA1_Channel11_IRQHandler .word GPDMA1_Channel12_IRQHandler .word GPDMA1_Channel13_IRQHandler .word GPDMA1_Channel14_IRQHandler .word GPDMA1_Channel15_IRQHandler .word I2C3_EV_IRQHandler .word I2C3_ER_IRQHandler .word SAI1_IRQHandler .word SAI2_IRQHandler .word TSC_IRQHandler .word 0 .word RNG_IRQHandler .word FPU_IRQHandler .word HASH_IRQHandler .word 0 .word LPTIM3_IRQHandler .word SPI3_IRQHandler .word I2C4_ER_IRQHandler .word I2C4_EV_IRQHandler .word MDF1_FLT0_IRQHandler .word MDF1_FLT1_IRQHandler .word MDF1_FLT2_IRQHandler .word MDF1_FLT3_IRQHandler .word UCPD1_IRQHandler .word ICACHE_IRQHandler .word 0 .word 0 .word LPTIM4_IRQHandler .word DCACHE1_IRQHandler .word ADF1_IRQHandler .word ADC4_IRQHandler .word LPDMA1_Channel0_IRQHandler .word LPDMA1_Channel1_IRQHandler .word LPDMA1_Channel2_IRQHandler .word LPDMA1_Channel3_IRQHandler .word DMA2D_IRQHandler .word DCMI_PSSI_IRQHandler .word OCTOSPI2_IRQHandler .word MDF1_FLT4_IRQHandler .word MDF1_FLT5_IRQHandler .word CORDIC_IRQHandler .word FMAC_IRQHandler /******************************************************************************* * * 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 SecureFault_Handler .thumb_set SecureFault_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_PVM_IRQHandler .thumb_set PVD_PVM_IRQHandler,Default_Handler .weak RTC_IRQHandler .thumb_set RTC_IRQHandler,Default_Handler .weak RTC_S_IRQHandler .thumb_set RTC_S_IRQHandler,Default_Handler .weak TAMP_IRQHandler .thumb_set TAMP_IRQHandler,Default_Handler .weak RAMCFG_IRQHandler .thumb_set RAMCFG_IRQHandler,Default_Handler .weak FLASH_IRQHandler .thumb_set FLASH_IRQHandler,Default_Handler .weak FLASH_S_IRQHandler .thumb_set FLASH_S_IRQHandler,Default_Handler .weak GTZC_IRQHandler .thumb_set GTZC_IRQHandler,Default_Handler .weak RCC_IRQHandler .thumb_set RCC_IRQHandler,Default_Handler .weak RCC_S_IRQHandler .thumb_set RCC_S_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 EXTI5_IRQHandler .thumb_set EXTI5_IRQHandler,Default_Handler .weak EXTI6_IRQHandler .thumb_set EXTI6_IRQHandler,Default_Handler .weak EXTI7_IRQHandler .thumb_set EXTI7_IRQHandler,Default_Handler .weak EXTI8_IRQHandler .thumb_set EXTI8_IRQHandler,Default_Handler .weak EXTI9_IRQHandler .thumb_set EXTI9_IRQHandler,Default_Handler .weak EXTI10_IRQHandler .thumb_set EXTI10_IRQHandler,Default_Handler .weak EXTI11_IRQHandler .thumb_set EXTI11_IRQHandler,Default_Handler .weak EXTI12_IRQHandler .thumb_set EXTI12_IRQHandler,Default_Handler .weak EXTI13_IRQHandler .thumb_set EXTI13_IRQHandler,Default_Handler .weak EXTI14_IRQHandler .thumb_set EXTI14_IRQHandler,Default_Handler .weak EXTI15_IRQHandler .thumb_set EXTI15_IRQHandler,Default_Handler .weak IWDG_IRQHandler .thumb_set IWDG_IRQHandler,Default_Handler .weak GPDMA1_Channel0_IRQHandler .thumb_set GPDMA1_Channel0_IRQHandler,Default_Handler .weak GPDMA1_Channel1_IRQHandler .thumb_set GPDMA1_Channel1_IRQHandler,Default_Handler .weak GPDMA1_Channel2_IRQHandler .thumb_set GPDMA1_Channel2_IRQHandler,Default_Handler .weak GPDMA1_Channel3_IRQHandler .thumb_set GPDMA1_Channel3_IRQHandler,Default_Handler .weak GPDMA1_Channel4_IRQHandler .thumb_set GPDMA1_Channel4_IRQHandler,Default_Handler .weak GPDMA1_Channel5_IRQHandler .thumb_set GPDMA1_Channel5_IRQHandler,Default_Handler .weak GPDMA1_Channel6_IRQHandler .thumb_set GPDMA1_Channel6_IRQHandler,Default_Handler .weak GPDMA1_Channel7_IRQHandler .thumb_set GPDMA1_Channel7_IRQHandler,Default_Handler .weak ADC1_IRQHandler .thumb_set ADC1_IRQHandler,Default_Handler .weak DAC1_IRQHandler .thumb_set DAC1_IRQHandler,Default_Handler .weak FDCAN1_IT0_IRQHandler .thumb_set FDCAN1_IT0_IRQHandler,Default_Handler .weak FDCAN1_IT1_IRQHandler .thumb_set FDCAN1_IT1_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 TIM5_IRQHandler .thumb_set TIM5_IRQHandler,Default_Handler .weak TIM6_IRQHandler .thumb_set TIM6_IRQHandler,Default_Handler .weak TIM7_IRQHandler .thumb_set TIM7_IRQHandler,Default_Handler .weak TIM8_BRK_IRQHandler .thumb_set TIM8_BRK_IRQHandler,Default_Handler .weak TIM8_UP_IRQHandler .thumb_set TIM8_UP_IRQHandler,Default_Handler .weak TIM8_TRG_COM_IRQHandler .thumb_set TIM8_TRG_COM_IRQHandler,Default_Handler .weak TIM8_CC_IRQHandler .thumb_set TIM8_CC_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 UART4_IRQHandler .thumb_set UART4_IRQHandler,Default_Handler .weak UART5_IRQHandler .thumb_set UART5_IRQHandler,Default_Handler .weak LPUART1_IRQHandler .thumb_set LPUART1_IRQHandler,Default_Handler .weak LPTIM1_IRQHandler .thumb_set LPTIM1_IRQHandler,Default_Handler .weak LPTIM2_IRQHandler .thumb_set LPTIM2_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 COMP_IRQHandler .thumb_set COMP_IRQHandler,Default_Handler .weak OTG_FS_IRQHandler .thumb_set OTG_FS_IRQHandler,Default_Handler .weak CRS_IRQHandler .thumb_set CRS_IRQHandler,Default_Handler .weak FMC_IRQHandler .thumb_set FMC_IRQHandler,Default_Handler .weak OCTOSPI1_IRQHandler .thumb_set OCTOSPI1_IRQHandler,Default_Handler .weak PWR_S3WU_IRQHandler .thumb_set PWR_S3WU_IRQHandler,Default_Handler .weak SDMMC1_IRQHandler .thumb_set SDMMC1_IRQHandler,Default_Handler .weak SDMMC2_IRQHandler .thumb_set SDMMC2_IRQHandler,Default_Handler .weak GPDMA1_Channel8_IRQHandler .thumb_set GPDMA1_Channel8_IRQHandler,Default_Handler .weak GPDMA1_Channel9_IRQHandler .thumb_set GPDMA1_Channel9_IRQHandler,Default_Handler .weak GPDMA1_Channel10_IRQHandler .thumb_set GPDMA1_Channel10_IRQHandler,Default_Handler .weak GPDMA1_Channel11_IRQHandler .thumb_set GPDMA1_Channel11_IRQHandler,Default_Handler .weak GPDMA1_Channel12_IRQHandler .thumb_set GPDMA1_Channel12_IRQHandler,Default_Handler .weak GPDMA1_Channel13_IRQHandler .thumb_set GPDMA1_Channel13_IRQHandler,Default_Handler .weak GPDMA1_Channel14_IRQHandler .thumb_set GPDMA1_Channel14_IRQHandler,Default_Handler .weak GPDMA1_Channel15_IRQHandler .thumb_set GPDMA1_Channel15_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 SAI1_IRQHandler .thumb_set SAI1_IRQHandler,Default_Handler .weak SAI2_IRQHandler .thumb_set SAI2_IRQHandler,Default_Handler .weak TSC_IRQHandler .thumb_set TSC_IRQHandler,Default_Handler .weak RNG_IRQHandler .thumb_set RNG_IRQHandler,Default_Handler .weak FPU_IRQHandler .thumb_set FPU_IRQHandler,Default_Handler .weak HASH_IRQHandler .thumb_set HASH_IRQHandler,Default_Handler .weak LPTIM3_IRQHandler .thumb_set LPTIM3_IRQHandler,Default_Handler .weak SPI3_IRQHandler .thumb_set SPI3_IRQHandler,Default_Handler .weak I2C4_ER_IRQHandler .thumb_set I2C4_ER_IRQHandler,Default_Handler .weak I2C4_EV_IRQHandler .thumb_set I2C4_EV_IRQHandler,Default_Handler .weak MDF1_FLT0_IRQHandler .thumb_set MDF1_FLT0_IRQHandler,Default_Handler .weak MDF1_FLT1_IRQHandler .thumb_set MDF1_FLT1_IRQHandler,Default_Handler .weak MDF1_FLT2_IRQHandler .thumb_set MDF1_FLT2_IRQHandler,Default_Handler .weak MDF1_FLT3_IRQHandler .thumb_set MDF1_FLT3_IRQHandler,Default_Handler .weak UCPD1_IRQHandler .thumb_set UCPD1_IRQHandler,Default_Handler .weak ICACHE_IRQHandler .thumb_set ICACHE_IRQHandler,Default_Handler .weak LPTIM4_IRQHandler .thumb_set LPTIM4_IRQHandler,Default_Handler .weak DCACHE1_IRQHandler .thumb_set DCACHE1_IRQHandler,Default_Handler .weak ADF1_IRQHandler .thumb_set ADF1_IRQHandler,Default_Handler .weak ADC4_IRQHandler .thumb_set ADC4_IRQHandler,Default_Handler .weak LPDMA1_Channel0_IRQHandler .thumb_set LPDMA1_Channel0_IRQHandler,Default_Handler .weak LPDMA1_Channel1_IRQHandler .thumb_set LPDMA1_Channel1_IRQHandler,Default_Handler .weak LPDMA1_Channel2_IRQHandler .thumb_set LPDMA1_Channel2_IRQHandler,Default_Handler .weak LPDMA1_Channel3_IRQHandler .thumb_set LPDMA1_Channel3_IRQHandler,Default_Handler .weak DMA2D_IRQHandler .thumb_set DMA2D_IRQHandler,Default_Handler .weak DCMI_PSSI_IRQHandler .thumb_set DCMI_PSSI_IRQHandler,Default_Handler .weak OCTOSPI2_IRQHandler .thumb_set OCTOSPI2_IRQHandler,Default_Handler .weak MDF1_FLT4_IRQHandler .thumb_set MDF1_FLT4_IRQHandler,Default_Handler .weak MDF1_FLT5_IRQHandler .thumb_set MDF1_FLT5_IRQHandler,Default_Handler .weak CORDIC_IRQHandler .thumb_set CORDIC_IRQHandler,Default_Handler .weak FMAC_IRQHandler .thumb_set FMAC_IRQHandler,Default_Handler
MorseMicro/mm-iot-sdk
17,506
framework/src/platforms/mm-ekh08-u575-sdio/bsp/startup_stm32u575zitxq.s
/** ****************************************************************************** * @file startup_stm32u575xx.s * @author MCD Application Team * @brief STM32U575xx devices vector table GCC toolchain. * This module performs: * - Set the initial SP * - Set the initial PC == Reset_Handler, * - Set the vector table entries with the exceptions ISR address, * - Configure the clock system * - Branches to main in the C library (which eventually * calls main()). * After Reset the Cortex-M33 processor is in Thread mode, * priority is Privileged, and the Stack is set to Main. ******************************************************************************* * @attention * * Copyright (c) 2021 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file * in the root directory of this software component. * If no LICENSE file comes with this software, it is provided AS-IS. * ******************************************************************************* */ .syntax unified .cpu cortex-m33 .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 .equ BootRAM, 0xF1E0F85F /** * @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 */ /* 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 initialization function.*/ bl SystemInit /* Call static constructors */ bl __libc_init_array /* Call the application's entry point.*/ bl main LoopForever: b LoopForever .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 /** * @brief This is a placeholder for the bootloader. * Since there is no bootloader, we just duplicate the reset vector. */ .section .bootloader,"a",%progbits .word _estack .word Reset_Handler /****************************************************************************** * * The minimal vector table for a Cortex-M33. 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 SecureFault_Handler .word 0 .word 0 .word 0 .word SVC_Handler .word DebugMon_Handler .word 0 .word PendSV_Handler .word SysTick_Handler .word WWDG_IRQHandler .word PVD_PVM_IRQHandler .word RTC_IRQHandler .word RTC_S_IRQHandler .word TAMP_IRQHandler .word RAMCFG_IRQHandler .word FLASH_IRQHandler .word FLASH_S_IRQHandler .word GTZC_IRQHandler .word RCC_IRQHandler .word RCC_S_IRQHandler .word EXTI0_IRQHandler .word EXTI1_IRQHandler .word EXTI2_IRQHandler .word EXTI3_IRQHandler .word EXTI4_IRQHandler .word EXTI5_IRQHandler .word EXTI6_IRQHandler .word EXTI7_IRQHandler .word EXTI8_IRQHandler .word EXTI9_IRQHandler .word EXTI10_IRQHandler .word EXTI11_IRQHandler .word EXTI12_IRQHandler .word EXTI13_IRQHandler .word EXTI14_IRQHandler .word EXTI15_IRQHandler .word IWDG_IRQHandler .word 0 .word GPDMA1_Channel0_IRQHandler .word GPDMA1_Channel1_IRQHandler .word GPDMA1_Channel2_IRQHandler .word GPDMA1_Channel3_IRQHandler .word GPDMA1_Channel4_IRQHandler .word GPDMA1_Channel5_IRQHandler .word GPDMA1_Channel6_IRQHandler .word GPDMA1_Channel7_IRQHandler .word ADC1_IRQHandler .word DAC1_IRQHandler .word FDCAN1_IT0_IRQHandler .word FDCAN1_IT1_IRQHandler .word TIM1_BRK_IRQHandler .word TIM1_UP_IRQHandler .word TIM1_TRG_COM_IRQHandler .word TIM1_CC_IRQHandler .word TIM2_IRQHandler .word TIM3_IRQHandler .word TIM4_IRQHandler .word TIM5_IRQHandler .word TIM6_IRQHandler .word TIM7_IRQHandler .word TIM8_BRK_IRQHandler .word TIM8_UP_IRQHandler .word TIM8_TRG_COM_IRQHandler .word TIM8_CC_IRQHandler .word I2C1_EV_IRQHandler .word I2C1_ER_IRQHandler .word I2C2_EV_IRQHandler .word I2C2_ER_IRQHandler .word SPI1_IRQHandler .word SPI2_IRQHandler .word USART1_IRQHandler .word USART2_IRQHandler .word USART3_IRQHandler .word UART4_IRQHandler .word UART5_IRQHandler .word LPUART1_IRQHandler .word LPTIM1_IRQHandler .word LPTIM2_IRQHandler .word TIM15_IRQHandler .word TIM16_IRQHandler .word TIM17_IRQHandler .word COMP_IRQHandler .word OTG_FS_IRQHandler .word CRS_IRQHandler .word FMC_IRQHandler .word OCTOSPI1_IRQHandler .word PWR_S3WU_IRQHandler .word SDMMC1_IRQHandler .word SDMMC2_IRQHandler .word GPDMA1_Channel8_IRQHandler .word GPDMA1_Channel9_IRQHandler .word GPDMA1_Channel10_IRQHandler .word GPDMA1_Channel11_IRQHandler .word GPDMA1_Channel12_IRQHandler .word GPDMA1_Channel13_IRQHandler .word GPDMA1_Channel14_IRQHandler .word GPDMA1_Channel15_IRQHandler .word I2C3_EV_IRQHandler .word I2C3_ER_IRQHandler .word SAI1_IRQHandler .word SAI2_IRQHandler .word TSC_IRQHandler .word 0 .word RNG_IRQHandler .word FPU_IRQHandler .word HASH_IRQHandler .word 0 .word LPTIM3_IRQHandler .word SPI3_IRQHandler .word I2C4_ER_IRQHandler .word I2C4_EV_IRQHandler .word MDF1_FLT0_IRQHandler .word MDF1_FLT1_IRQHandler .word MDF1_FLT2_IRQHandler .word MDF1_FLT3_IRQHandler .word UCPD1_IRQHandler .word ICACHE_IRQHandler .word 0 .word 0 .word LPTIM4_IRQHandler .word DCACHE1_IRQHandler .word ADF1_IRQHandler .word ADC4_IRQHandler .word LPDMA1_Channel0_IRQHandler .word LPDMA1_Channel1_IRQHandler .word LPDMA1_Channel2_IRQHandler .word LPDMA1_Channel3_IRQHandler .word DMA2D_IRQHandler .word DCMI_PSSI_IRQHandler .word OCTOSPI2_IRQHandler .word MDF1_FLT4_IRQHandler .word MDF1_FLT5_IRQHandler .word CORDIC_IRQHandler .word FMAC_IRQHandler /******************************************************************************* * * 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 SecureFault_Handler .thumb_set SecureFault_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_PVM_IRQHandler .thumb_set PVD_PVM_IRQHandler,Default_Handler .weak RTC_IRQHandler .thumb_set RTC_IRQHandler,Default_Handler .weak RTC_S_IRQHandler .thumb_set RTC_S_IRQHandler,Default_Handler .weak TAMP_IRQHandler .thumb_set TAMP_IRQHandler,Default_Handler .weak RAMCFG_IRQHandler .thumb_set RAMCFG_IRQHandler,Default_Handler .weak FLASH_IRQHandler .thumb_set FLASH_IRQHandler,Default_Handler .weak FLASH_S_IRQHandler .thumb_set FLASH_S_IRQHandler,Default_Handler .weak GTZC_IRQHandler .thumb_set GTZC_IRQHandler,Default_Handler .weak RCC_IRQHandler .thumb_set RCC_IRQHandler,Default_Handler .weak RCC_S_IRQHandler .thumb_set RCC_S_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 EXTI5_IRQHandler .thumb_set EXTI5_IRQHandler,Default_Handler .weak EXTI6_IRQHandler .thumb_set EXTI6_IRQHandler,Default_Handler .weak EXTI7_IRQHandler .thumb_set EXTI7_IRQHandler,Default_Handler .weak EXTI8_IRQHandler .thumb_set EXTI8_IRQHandler,Default_Handler .weak EXTI9_IRQHandler .thumb_set EXTI9_IRQHandler,Default_Handler .weak EXTI10_IRQHandler .thumb_set EXTI10_IRQHandler,Default_Handler .weak EXTI11_IRQHandler .thumb_set EXTI11_IRQHandler,Default_Handler .weak EXTI12_IRQHandler .thumb_set EXTI12_IRQHandler,Default_Handler .weak EXTI13_IRQHandler .thumb_set EXTI13_IRQHandler,Default_Handler .weak EXTI14_IRQHandler .thumb_set EXTI14_IRQHandler,Default_Handler .weak EXTI15_IRQHandler .thumb_set EXTI15_IRQHandler,Default_Handler .weak IWDG_IRQHandler .thumb_set IWDG_IRQHandler,Default_Handler .weak GPDMA1_Channel0_IRQHandler .thumb_set GPDMA1_Channel0_IRQHandler,Default_Handler .weak GPDMA1_Channel1_IRQHandler .thumb_set GPDMA1_Channel1_IRQHandler,Default_Handler .weak GPDMA1_Channel2_IRQHandler .thumb_set GPDMA1_Channel2_IRQHandler,Default_Handler .weak GPDMA1_Channel3_IRQHandler .thumb_set GPDMA1_Channel3_IRQHandler,Default_Handler .weak GPDMA1_Channel4_IRQHandler .thumb_set GPDMA1_Channel4_IRQHandler,Default_Handler .weak GPDMA1_Channel5_IRQHandler .thumb_set GPDMA1_Channel5_IRQHandler,Default_Handler .weak GPDMA1_Channel6_IRQHandler .thumb_set GPDMA1_Channel6_IRQHandler,Default_Handler .weak GPDMA1_Channel7_IRQHandler .thumb_set GPDMA1_Channel7_IRQHandler,Default_Handler .weak ADC1_IRQHandler .thumb_set ADC1_IRQHandler,Default_Handler .weak DAC1_IRQHandler .thumb_set DAC1_IRQHandler,Default_Handler .weak FDCAN1_IT0_IRQHandler .thumb_set FDCAN1_IT0_IRQHandler,Default_Handler .weak FDCAN1_IT1_IRQHandler .thumb_set FDCAN1_IT1_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 TIM5_IRQHandler .thumb_set TIM5_IRQHandler,Default_Handler .weak TIM6_IRQHandler .thumb_set TIM6_IRQHandler,Default_Handler .weak TIM7_IRQHandler .thumb_set TIM7_IRQHandler,Default_Handler .weak TIM8_BRK_IRQHandler .thumb_set TIM8_BRK_IRQHandler,Default_Handler .weak TIM8_UP_IRQHandler .thumb_set TIM8_UP_IRQHandler,Default_Handler .weak TIM8_TRG_COM_IRQHandler .thumb_set TIM8_TRG_COM_IRQHandler,Default_Handler .weak TIM8_CC_IRQHandler .thumb_set TIM8_CC_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 UART4_IRQHandler .thumb_set UART4_IRQHandler,Default_Handler .weak UART5_IRQHandler .thumb_set UART5_IRQHandler,Default_Handler .weak LPUART1_IRQHandler .thumb_set LPUART1_IRQHandler,Default_Handler .weak LPTIM1_IRQHandler .thumb_set LPTIM1_IRQHandler,Default_Handler .weak LPTIM2_IRQHandler .thumb_set LPTIM2_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 COMP_IRQHandler .thumb_set COMP_IRQHandler,Default_Handler .weak OTG_FS_IRQHandler .thumb_set OTG_FS_IRQHandler,Default_Handler .weak CRS_IRQHandler .thumb_set CRS_IRQHandler,Default_Handler .weak FMC_IRQHandler .thumb_set FMC_IRQHandler,Default_Handler .weak OCTOSPI1_IRQHandler .thumb_set OCTOSPI1_IRQHandler,Default_Handler .weak PWR_S3WU_IRQHandler .thumb_set PWR_S3WU_IRQHandler,Default_Handler .weak SDMMC1_IRQHandler .thumb_set SDMMC1_IRQHandler,Default_Handler .weak SDMMC2_IRQHandler .thumb_set SDMMC2_IRQHandler,Default_Handler .weak GPDMA1_Channel8_IRQHandler .thumb_set GPDMA1_Channel8_IRQHandler,Default_Handler .weak GPDMA1_Channel9_IRQHandler .thumb_set GPDMA1_Channel9_IRQHandler,Default_Handler .weak GPDMA1_Channel10_IRQHandler .thumb_set GPDMA1_Channel10_IRQHandler,Default_Handler .weak GPDMA1_Channel11_IRQHandler .thumb_set GPDMA1_Channel11_IRQHandler,Default_Handler .weak GPDMA1_Channel12_IRQHandler .thumb_set GPDMA1_Channel12_IRQHandler,Default_Handler .weak GPDMA1_Channel13_IRQHandler .thumb_set GPDMA1_Channel13_IRQHandler,Default_Handler .weak GPDMA1_Channel14_IRQHandler .thumb_set GPDMA1_Channel14_IRQHandler,Default_Handler .weak GPDMA1_Channel15_IRQHandler .thumb_set GPDMA1_Channel15_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 SAI1_IRQHandler .thumb_set SAI1_IRQHandler,Default_Handler .weak SAI2_IRQHandler .thumb_set SAI2_IRQHandler,Default_Handler .weak TSC_IRQHandler .thumb_set TSC_IRQHandler,Default_Handler .weak RNG_IRQHandler .thumb_set RNG_IRQHandler,Default_Handler .weak FPU_IRQHandler .thumb_set FPU_IRQHandler,Default_Handler .weak HASH_IRQHandler .thumb_set HASH_IRQHandler,Default_Handler .weak LPTIM3_IRQHandler .thumb_set LPTIM3_IRQHandler,Default_Handler .weak SPI3_IRQHandler .thumb_set SPI3_IRQHandler,Default_Handler .weak I2C4_ER_IRQHandler .thumb_set I2C4_ER_IRQHandler,Default_Handler .weak I2C4_EV_IRQHandler .thumb_set I2C4_EV_IRQHandler,Default_Handler .weak MDF1_FLT0_IRQHandler .thumb_set MDF1_FLT0_IRQHandler,Default_Handler .weak MDF1_FLT1_IRQHandler .thumb_set MDF1_FLT1_IRQHandler,Default_Handler .weak MDF1_FLT2_IRQHandler .thumb_set MDF1_FLT2_IRQHandler,Default_Handler .weak MDF1_FLT3_IRQHandler .thumb_set MDF1_FLT3_IRQHandler,Default_Handler .weak UCPD1_IRQHandler .thumb_set UCPD1_IRQHandler,Default_Handler .weak ICACHE_IRQHandler .thumb_set ICACHE_IRQHandler,Default_Handler .weak LPTIM4_IRQHandler .thumb_set LPTIM4_IRQHandler,Default_Handler .weak DCACHE1_IRQHandler .thumb_set DCACHE1_IRQHandler,Default_Handler .weak ADF1_IRQHandler .thumb_set ADF1_IRQHandler,Default_Handler .weak ADC4_IRQHandler .thumb_set ADC4_IRQHandler,Default_Handler .weak LPDMA1_Channel0_IRQHandler .thumb_set LPDMA1_Channel0_IRQHandler,Default_Handler .weak LPDMA1_Channel1_IRQHandler .thumb_set LPDMA1_Channel1_IRQHandler,Default_Handler .weak LPDMA1_Channel2_IRQHandler .thumb_set LPDMA1_Channel2_IRQHandler,Default_Handler .weak LPDMA1_Channel3_IRQHandler .thumb_set LPDMA1_Channel3_IRQHandler,Default_Handler .weak DMA2D_IRQHandler .thumb_set DMA2D_IRQHandler,Default_Handler .weak DCMI_PSSI_IRQHandler .thumb_set DCMI_PSSI_IRQHandler,Default_Handler .weak OCTOSPI2_IRQHandler .thumb_set OCTOSPI2_IRQHandler,Default_Handler .weak MDF1_FLT4_IRQHandler .thumb_set MDF1_FLT4_IRQHandler,Default_Handler .weak MDF1_FLT5_IRQHandler .thumb_set MDF1_FLT5_IRQHandler,Default_Handler .weak CORDIC_IRQHandler .thumb_set CORDIC_IRQHandler,Default_Handler .weak FMAC_IRQHandler .thumb_set FMAC_IRQHandler,Default_Handler
MorseMicro/mm-iot-sdk
18,027
framework/src/platforms/mm-mm6108-ekh05-sdio/bsp/startup_stm32u585VIT6.s
/** ****************************************************************************** * @file startup_stm32u585xx.s * @author MCD Application Team * @brief STM32U585xx devices vector table GCC toolchain. * This module performs: * - Set the initial SP * - Set the initial PC == Reset_Handler, * - Set the vector table entries with the exceptions ISR address, * - Configure the clock system * - Branches to main in the C library (which eventually * calls main()). * After Reset the Cortex-M33 processor is in Thread mode, * priority is Privileged, and the Stack is set to Main. ******************************************************************************* * @attention * * Copyright (c) 2021 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file * in the root directory of this software component. * If no LICENSE file comes with this software, it is provided AS-IS. * ******************************************************************************* */ .syntax unified .cpu cortex-m33 .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 .equ BootRAM, 0xF1E0F85F /** * @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 */ /* 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 initialization function.*/ bl SystemInit /* Call static constructors */ bl __libc_init_array /* Call the application's entry point.*/ bl main LoopForever: b LoopForever .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 /** * @brief This is a placeholder for the bootloader. * Since there is no bootloader, we just duplicate the reset vector. */ .section .bootloader,"a",%progbits .word _estack .word Reset_Handler /****************************************************************************** * * The minimal vector table for a Cortex-M33. 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 SecureFault_Handler .word 0 .word 0 .word 0 .word SVC_Handler .word DebugMon_Handler .word 0 .word PendSV_Handler .word SysTick_Handler .word WWDG_IRQHandler .word PVD_PVM_IRQHandler .word RTC_IRQHandler .word RTC_S_IRQHandler .word TAMP_IRQHandler .word RAMCFG_IRQHandler .word FLASH_IRQHandler .word FLASH_S_IRQHandler .word GTZC_IRQHandler .word RCC_IRQHandler .word RCC_S_IRQHandler .word EXTI0_IRQHandler .word EXTI1_IRQHandler .word EXTI2_IRQHandler .word EXTI3_IRQHandler .word EXTI4_IRQHandler .word EXTI5_IRQHandler .word EXTI6_IRQHandler .word EXTI7_IRQHandler .word EXTI8_IRQHandler .word EXTI9_IRQHandler .word EXTI10_IRQHandler .word EXTI11_IRQHandler .word EXTI12_IRQHandler .word EXTI13_IRQHandler .word EXTI14_IRQHandler .word EXTI15_IRQHandler .word IWDG_IRQHandler .word SAES_IRQHandler .word GPDMA1_Channel0_IRQHandler .word GPDMA1_Channel1_IRQHandler .word GPDMA1_Channel2_IRQHandler .word GPDMA1_Channel3_IRQHandler .word GPDMA1_Channel4_IRQHandler .word GPDMA1_Channel5_IRQHandler .word GPDMA1_Channel6_IRQHandler .word GPDMA1_Channel7_IRQHandler .word ADC1_IRQHandler .word DAC1_IRQHandler .word FDCAN1_IT0_IRQHandler .word FDCAN1_IT1_IRQHandler .word TIM1_BRK_IRQHandler .word TIM1_UP_IRQHandler .word TIM1_TRG_COM_IRQHandler .word TIM1_CC_IRQHandler .word TIM2_IRQHandler .word TIM3_IRQHandler .word TIM4_IRQHandler .word TIM5_IRQHandler .word TIM6_IRQHandler .word TIM7_IRQHandler .word TIM8_BRK_IRQHandler .word TIM8_UP_IRQHandler .word TIM8_TRG_COM_IRQHandler .word TIM8_CC_IRQHandler .word I2C1_EV_IRQHandler .word I2C1_ER_IRQHandler .word I2C2_EV_IRQHandler .word I2C2_ER_IRQHandler .word SPI1_IRQHandler .word SPI2_IRQHandler .word USART1_IRQHandler .word USART2_IRQHandler .word USART3_IRQHandler .word UART4_IRQHandler .word UART5_IRQHandler .word LPUART1_IRQHandler .word LPTIM1_IRQHandler .word LPTIM2_IRQHandler .word TIM15_IRQHandler .word TIM16_IRQHandler .word TIM17_IRQHandler .word COMP_IRQHandler .word OTG_FS_IRQHandler .word CRS_IRQHandler .word FMC_IRQHandler .word OCTOSPI1_IRQHandler .word PWR_S3WU_IRQHandler .word SDMMC1_IRQHandler .word SDMMC2_IRQHandler .word GPDMA1_Channel8_IRQHandler .word GPDMA1_Channel9_IRQHandler .word GPDMA1_Channel10_IRQHandler .word GPDMA1_Channel11_IRQHandler .word GPDMA1_Channel12_IRQHandler .word GPDMA1_Channel13_IRQHandler .word GPDMA1_Channel14_IRQHandler .word GPDMA1_Channel15_IRQHandler .word I2C3_EV_IRQHandler .word I2C3_ER_IRQHandler .word SAI1_IRQHandler .word SAI2_IRQHandler .word TSC_IRQHandler .word AES_IRQHandler .word RNG_IRQHandler .word FPU_IRQHandler .word HASH_IRQHandler .word PKA_IRQHandler .word LPTIM3_IRQHandler .word SPI3_IRQHandler .word I2C4_ER_IRQHandler .word I2C4_EV_IRQHandler .word MDF1_FLT0_IRQHandler .word MDF1_FLT1_IRQHandler .word MDF1_FLT2_IRQHandler .word MDF1_FLT3_IRQHandler .word UCPD1_IRQHandler .word ICACHE_IRQHandler .word OTFDEC1_IRQHandler .word OTFDEC2_IRQHandler .word LPTIM4_IRQHandler .word DCACHE1_IRQHandler .word ADF1_IRQHandler .word ADC4_IRQHandler .word LPDMA1_Channel0_IRQHandler .word LPDMA1_Channel1_IRQHandler .word LPDMA1_Channel2_IRQHandler .word LPDMA1_Channel3_IRQHandler .word DMA2D_IRQHandler .word DCMI_PSSI_IRQHandler .word OCTOSPI2_IRQHandler .word MDF1_FLT4_IRQHandler .word MDF1_FLT5_IRQHandler .word CORDIC_IRQHandler .word FMAC_IRQHandler .word LSECSSD_IRQHandler /******************************************************************************* * * 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 SecureFault_Handler .thumb_set SecureFault_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_PVM_IRQHandler .thumb_set PVD_PVM_IRQHandler,Default_Handler .weak RTC_IRQHandler .thumb_set RTC_IRQHandler,Default_Handler .weak RTC_S_IRQHandler .thumb_set RTC_S_IRQHandler,Default_Handler .weak TAMP_IRQHandler .thumb_set TAMP_IRQHandler,Default_Handler .weak RAMCFG_IRQHandler .thumb_set RAMCFG_IRQHandler,Default_Handler .weak FLASH_IRQHandler .thumb_set FLASH_IRQHandler,Default_Handler .weak FLASH_S_IRQHandler .thumb_set FLASH_S_IRQHandler,Default_Handler .weak GTZC_IRQHandler .thumb_set GTZC_IRQHandler,Default_Handler .weak RCC_IRQHandler .thumb_set RCC_IRQHandler,Default_Handler .weak RCC_S_IRQHandler .thumb_set RCC_S_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 EXTI5_IRQHandler .thumb_set EXTI5_IRQHandler,Default_Handler .weak EXTI6_IRQHandler .thumb_set EXTI6_IRQHandler,Default_Handler .weak EXTI7_IRQHandler .thumb_set EXTI7_IRQHandler,Default_Handler .weak EXTI8_IRQHandler .thumb_set EXTI8_IRQHandler,Default_Handler .weak EXTI9_IRQHandler .thumb_set EXTI9_IRQHandler,Default_Handler .weak EXTI10_IRQHandler .thumb_set EXTI10_IRQHandler,Default_Handler .weak EXTI11_IRQHandler .thumb_set EXTI11_IRQHandler,Default_Handler .weak EXTI12_IRQHandler .thumb_set EXTI12_IRQHandler,Default_Handler .weak EXTI13_IRQHandler .thumb_set EXTI13_IRQHandler,Default_Handler .weak EXTI14_IRQHandler .thumb_set EXTI14_IRQHandler,Default_Handler .weak EXTI15_IRQHandler .thumb_set EXTI15_IRQHandler,Default_Handler .weak IWDG_IRQHandler .thumb_set IWDG_IRQHandler,Default_Handler .weak SAES_IRQHandler .thumb_set SAES_IRQHandler,Default_Handler .weak GPDMA1_Channel0_IRQHandler .thumb_set GPDMA1_Channel0_IRQHandler,Default_Handler .weak GPDMA1_Channel1_IRQHandler .thumb_set GPDMA1_Channel1_IRQHandler,Default_Handler .weak GPDMA1_Channel2_IRQHandler .thumb_set GPDMA1_Channel2_IRQHandler,Default_Handler .weak GPDMA1_Channel3_IRQHandler .thumb_set GPDMA1_Channel3_IRQHandler,Default_Handler .weak GPDMA1_Channel4_IRQHandler .thumb_set GPDMA1_Channel4_IRQHandler,Default_Handler .weak GPDMA1_Channel5_IRQHandler .thumb_set GPDMA1_Channel5_IRQHandler,Default_Handler .weak GPDMA1_Channel6_IRQHandler .thumb_set GPDMA1_Channel6_IRQHandler,Default_Handler .weak GPDMA1_Channel7_IRQHandler .thumb_set GPDMA1_Channel7_IRQHandler,Default_Handler .weak ADC1_IRQHandler .thumb_set ADC1_IRQHandler,Default_Handler .weak DAC1_IRQHandler .thumb_set DAC1_IRQHandler,Default_Handler .weak FDCAN1_IT0_IRQHandler .thumb_set FDCAN1_IT0_IRQHandler,Default_Handler .weak FDCAN1_IT1_IRQHandler .thumb_set FDCAN1_IT1_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 TIM5_IRQHandler .thumb_set TIM5_IRQHandler,Default_Handler .weak TIM6_IRQHandler .thumb_set TIM6_IRQHandler,Default_Handler .weak TIM7_IRQHandler .thumb_set TIM7_IRQHandler,Default_Handler .weak TIM8_BRK_IRQHandler .thumb_set TIM8_BRK_IRQHandler,Default_Handler .weak TIM8_UP_IRQHandler .thumb_set TIM8_UP_IRQHandler,Default_Handler .weak TIM8_TRG_COM_IRQHandler .thumb_set TIM8_TRG_COM_IRQHandler,Default_Handler .weak TIM8_CC_IRQHandler .thumb_set TIM8_CC_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 UART4_IRQHandler .thumb_set UART4_IRQHandler,Default_Handler .weak UART5_IRQHandler .thumb_set UART5_IRQHandler,Default_Handler .weak LPUART1_IRQHandler .thumb_set LPUART1_IRQHandler,Default_Handler .weak LPTIM1_IRQHandler .thumb_set LPTIM1_IRQHandler,Default_Handler .weak LPTIM2_IRQHandler .thumb_set LPTIM2_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 COMP_IRQHandler .thumb_set COMP_IRQHandler,Default_Handler .weak OTG_FS_IRQHandler .thumb_set OTG_FS_IRQHandler,Default_Handler .weak CRS_IRQHandler .thumb_set CRS_IRQHandler,Default_Handler .weak FMC_IRQHandler .thumb_set FMC_IRQHandler,Default_Handler .weak OCTOSPI1_IRQHandler .thumb_set OCTOSPI1_IRQHandler,Default_Handler .weak PWR_S3WU_IRQHandler .thumb_set PWR_S3WU_IRQHandler,Default_Handler .weak SDMMC1_IRQHandler .thumb_set SDMMC1_IRQHandler,Default_Handler .weak SDMMC2_IRQHandler .thumb_set SDMMC2_IRQHandler,Default_Handler .weak GPDMA1_Channel8_IRQHandler .thumb_set GPDMA1_Channel8_IRQHandler,Default_Handler .weak GPDMA1_Channel9_IRQHandler .thumb_set GPDMA1_Channel9_IRQHandler,Default_Handler .weak GPDMA1_Channel10_IRQHandler .thumb_set GPDMA1_Channel10_IRQHandler,Default_Handler .weak GPDMA1_Channel11_IRQHandler .thumb_set GPDMA1_Channel11_IRQHandler,Default_Handler .weak GPDMA1_Channel12_IRQHandler .thumb_set GPDMA1_Channel12_IRQHandler,Default_Handler .weak GPDMA1_Channel13_IRQHandler .thumb_set GPDMA1_Channel13_IRQHandler,Default_Handler .weak GPDMA1_Channel14_IRQHandler .thumb_set GPDMA1_Channel14_IRQHandler,Default_Handler .weak GPDMA1_Channel15_IRQHandler .thumb_set GPDMA1_Channel15_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 SAI1_IRQHandler .thumb_set SAI1_IRQHandler,Default_Handler .weak SAI2_IRQHandler .thumb_set SAI2_IRQHandler,Default_Handler .weak TSC_IRQHandler .thumb_set TSC_IRQHandler,Default_Handler .weak AES_IRQHandler .thumb_set AES_IRQHandler,Default_Handler .weak RNG_IRQHandler .thumb_set RNG_IRQHandler,Default_Handler .weak FPU_IRQHandler .thumb_set FPU_IRQHandler,Default_Handler .weak HASH_IRQHandler .thumb_set HASH_IRQHandler,Default_Handler .weak PKA_IRQHandler .thumb_set PKA_IRQHandler,Default_Handler .weak LPTIM3_IRQHandler .thumb_set LPTIM3_IRQHandler,Default_Handler .weak SPI3_IRQHandler .thumb_set SPI3_IRQHandler,Default_Handler .weak I2C4_ER_IRQHandler .thumb_set I2C4_ER_IRQHandler,Default_Handler .weak I2C4_EV_IRQHandler .thumb_set I2C4_EV_IRQHandler,Default_Handler .weak MDF1_FLT0_IRQHandler .thumb_set MDF1_FLT0_IRQHandler,Default_Handler .weak MDF1_FLT1_IRQHandler .thumb_set MDF1_FLT1_IRQHandler,Default_Handler .weak MDF1_FLT2_IRQHandler .thumb_set MDF1_FLT2_IRQHandler,Default_Handler .weak MDF1_FLT3_IRQHandler .thumb_set MDF1_FLT3_IRQHandler,Default_Handler .weak UCPD1_IRQHandler .thumb_set UCPD1_IRQHandler,Default_Handler .weak ICACHE_IRQHandler .thumb_set ICACHE_IRQHandler,Default_Handler .weak OTFDEC1_IRQHandler .thumb_set OTFDEC1_IRQHandler,Default_Handler .weak OTFDEC2_IRQHandler .thumb_set OTFDEC2_IRQHandler,Default_Handler .weak LPTIM4_IRQHandler .thumb_set LPTIM4_IRQHandler,Default_Handler .weak DCACHE1_IRQHandler .thumb_set DCACHE1_IRQHandler,Default_Handler .weak ADF1_IRQHandler .thumb_set ADF1_IRQHandler,Default_Handler .weak ADC4_IRQHandler .thumb_set ADC4_IRQHandler,Default_Handler .weak LPDMA1_Channel0_IRQHandler .thumb_set LPDMA1_Channel0_IRQHandler,Default_Handler .weak LPDMA1_Channel1_IRQHandler .thumb_set LPDMA1_Channel1_IRQHandler,Default_Handler .weak LPDMA1_Channel2_IRQHandler .thumb_set LPDMA1_Channel2_IRQHandler,Default_Handler .weak LPDMA1_Channel3_IRQHandler .thumb_set LPDMA1_Channel3_IRQHandler,Default_Handler .weak DMA2D_IRQHandler .thumb_set DMA2D_IRQHandler,Default_Handler .weak DCMI_PSSI_IRQHandler .thumb_set DCMI_PSSI_IRQHandler,Default_Handler .weak OCTOSPI2_IRQHandler .thumb_set OCTOSPI2_IRQHandler,Default_Handler .weak MDF1_FLT4_IRQHandler .thumb_set MDF1_FLT4_IRQHandler,Default_Handler .weak MDF1_FLT5_IRQHandler .thumb_set MDF1_FLT5_IRQHandler,Default_Handler .weak CORDIC_IRQHandler .thumb_set CORDIC_IRQHandler,Default_Handler .weak FMAC_IRQHandler .thumb_set FMAC_IRQHandler,Default_Handler .weak LSECSSD_IRQHandler .thumb_set LSECSSD_IRQHandler,Default_Handler
MorseMicro/mm-iot-sdk
29,525
framework/src/platforms/mm-ekh08-h753/bsp/startup_stm32h753zitx.s
/** ****************************************************************************** * @file startup_stm32h753xx.s * @author MCD Application Team * @brief STM32H753xx 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 * * Copyright (c) 2017 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file * in the root directory of this software component. * If no LICENSE file comes with this software, it is provided AS-IS. * ****************************************************************************** */ .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 */ /* Call the clock system initialization function.*/ bl SystemInit /* 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 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 /** * @brief This is a placeholder for the bootloader. * Since there is no bootloader, we just duplicate the reset vector. */ .section .bootloader,"a",%progbits .word _estack .word Reset_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_IRQHandler /* DCMI */ .word CRYP_IRQHandler /* Crypto */ .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 SAI2_IRQHandler /* SAI2 */ .word QUADSPI_IRQHandler /* QUADSPI */ .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 OTG_FS_EP1_OUT_IRQHandler /* USB OTG FS End Point 1 Out */ .word OTG_FS_EP1_IN_IRQHandler /* USB OTG FS End Point 1 In */ .word OTG_FS_WKUP_IRQHandler /* USB OTG FS Wakeup through EXTI */ .word OTG_FS_IRQHandler /* USB OTG FS */ .word DMAMUX1_OVR_IRQHandler /* DMAMUX1 Overrun interrupt */ .word HRTIM1_Master_IRQHandler /* HRTIM Master Timer global Interrupt */ .word HRTIM1_TIMA_IRQHandler /* HRTIM Timer A global Interrupt */ .word HRTIM1_TIMB_IRQHandler /* HRTIM Timer B global Interrupt */ .word HRTIM1_TIMC_IRQHandler /* HRTIM Timer C global Interrupt */ .word HRTIM1_TIMD_IRQHandler /* HRTIM Timer D global Interrupt */ .word HRTIM1_TIME_IRQHandler /* HRTIM Timer E global Interrupt */ .word HRTIM1_FLT_IRQHandler /* HRTIM Fault global Interrupt */ .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 SAI3_IRQHandler /* SAI3 global Interrupt */ .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 JPEG_IRQHandler /* JPEG global Interrupt */ .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 0 /* Reserved */ .word 0 /* Reserved */ .word WAKEUP_PIN_IRQHandler /* Interrupt for all 6 wake-up pins */ /******************************************************************************* * * 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_IRQHandler .thumb_set DCMI_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 SAI2_IRQHandler .thumb_set SAI2_IRQHandler,Default_Handler .weak QUADSPI_IRQHandler .thumb_set QUADSPI_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 OTG_FS_EP1_OUT_IRQHandler .thumb_set OTG_FS_EP1_OUT_IRQHandler,Default_Handler .weak OTG_FS_EP1_IN_IRQHandler .thumb_set OTG_FS_EP1_IN_IRQHandler,Default_Handler .weak OTG_FS_WKUP_IRQHandler .thumb_set OTG_FS_WKUP_IRQHandler,Default_Handler .weak OTG_FS_IRQHandler .thumb_set OTG_FS_IRQHandler,Default_Handler .weak DMAMUX1_OVR_IRQHandler .thumb_set DMAMUX1_OVR_IRQHandler,Default_Handler .weak HRTIM1_Master_IRQHandler .thumb_set HRTIM1_Master_IRQHandler,Default_Handler .weak HRTIM1_TIMA_IRQHandler .thumb_set HRTIM1_TIMA_IRQHandler,Default_Handler .weak HRTIM1_TIMB_IRQHandler .thumb_set HRTIM1_TIMB_IRQHandler,Default_Handler .weak HRTIM1_TIMC_IRQHandler .thumb_set HRTIM1_TIMC_IRQHandler,Default_Handler .weak HRTIM1_TIMD_IRQHandler .thumb_set HRTIM1_TIMD_IRQHandler,Default_Handler .weak HRTIM1_TIME_IRQHandler .thumb_set HRTIM1_TIME_IRQHandler,Default_Handler .weak HRTIM1_FLT_IRQHandler .thumb_set HRTIM1_FLT_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 SAI3_IRQHandler .thumb_set SAI3_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 JPEG_IRQHandler .thumb_set JPEG_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 WAKEUP_PIN_IRQHandler .thumb_set WAKEUP_PIN_IRQHandler,Default_Handler
MorseMicro/mm-iot-sdk
12,287
framework/src/platforms/mm-ekh08-wb55-ble/bsp/startup_stm32wb55xx_cm4.s
/** ****************************************************************************** * @file startup_stm32wb55xx_cm4.s * @author MCD Application Team * @brief STM32WB55xx devices vector table GCC 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-M4 processor is in Thread mode, * priority is Privileged, and the Stack is set to Main. ****************************************************************************** * @attention * * Copyright (c) 2019-2021 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file * in the root directory of this software component. * If no LICENSE file comes with this software, it is provided AS-IS. * ****************************************************************************** */ .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 /* start address for the .MB_MEM2 section. defined in linker script */ .word _sMB_MEM2 /* end address for the .MB_MEM2 section. defined in linker script */ .word _eMB_MEM2 /* INIT_BSS macro is used to fill the specified region [start : end] with zeros */ .macro INIT_BSS start, end ldr r0, =\start ldr r1, =\end movs r3, #0 bl LoopFillZerobss .endm /* INIT_DATA macro is used to copy data in the region [start : end] starting from 'src' */ .macro INIT_DATA start, end, src ldr r0, =\start ldr r1, =\end ldr r2, =\src movs r3, #0 bl LoopCopyDataInit .endm .section .text.data_initializers CopyDataInit: ldr r4, [r2, r3] str r4, [r0, r3] adds r3, r3, #4 LoopCopyDataInit: adds r4, r0, r3 cmp r4, r1 bcc CopyDataInit bx lr FillZerobss: str r3, [r0] adds r0, r0, #4 LoopFillZerobss: cmp r0, r1 bcc FillZerobss bx lr .section .text.Reset_Handler .weak Reset_Handler .type Reset_Handler, %function Reset_Handler: ldr r0, =_estack mov sp, r0 /* set stack pointer */ /* Call the clock system initialization function.*/ bl SystemInit /* Copy the data segment initializers from flash to SRAM */ INIT_DATA _sdata, _edata, _sidata /* Zero fill the bss segments. */ INIT_BSS _sbss, _ebss INIT_BSS _sMB_MEM2, _eMB_MEM2 /* Call static constructors */ bl __libc_init_array /* Call the application s entry point.*/ bl main LoopForever: b LoopForever .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 /** * @brief This is a placeholder for the bootloader. * Since there is no bootloader, we just duplicate the reset vector. */ .section .bootloader,"a",%progbits .word _estack .word Reset_Handler /****************************************************************************** * * The minimal vector table for a Cortex-M4. 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 .word WWDG_IRQHandler .word PVD_PVM_IRQHandler .word TAMP_STAMP_LSECSS_IRQHandler .word RTC_WKUP_IRQHandler .word FLASH_IRQHandler .word RCC_IRQHandler .word EXTI0_IRQHandler .word EXTI1_IRQHandler .word EXTI2_IRQHandler .word EXTI3_IRQHandler .word EXTI4_IRQHandler .word DMA1_Channel1_IRQHandler .word DMA1_Channel2_IRQHandler .word DMA1_Channel3_IRQHandler .word DMA1_Channel4_IRQHandler .word DMA1_Channel5_IRQHandler .word DMA1_Channel6_IRQHandler .word DMA1_Channel7_IRQHandler .word ADC1_IRQHandler .word USB_HP_IRQHandler .word USB_LP_IRQHandler .word C2SEV_PWR_C2H_IRQHandler .word COMP_IRQHandler .word EXTI9_5_IRQHandler .word TIM1_BRK_IRQHandler .word TIM1_UP_TIM16_IRQHandler .word TIM1_TRG_COM_TIM17_IRQHandler .word TIM1_CC_IRQHandler .word TIM2_IRQHandler .word PKA_IRQHandler .word I2C1_EV_IRQHandler .word I2C1_ER_IRQHandler .word I2C3_EV_IRQHandler .word I2C3_ER_IRQHandler .word SPI1_IRQHandler .word SPI2_IRQHandler .word USART1_IRQHandler .word LPUART1_IRQHandler .word SAI1_IRQHandler .word TSC_IRQHandler .word EXTI15_10_IRQHandler .word RTC_Alarm_IRQHandler .word CRS_IRQHandler .word PWR_SOTF_BLEACT_802ACT_RFPHASE_IRQHandler .word IPCC_C1_RX_IRQHandler .word IPCC_C1_TX_IRQHandler .word HSEM_IRQHandler .word LPTIM1_IRQHandler .word LPTIM2_IRQHandler .word LCD_IRQHandler .word QUADSPI_IRQHandler .word AES1_IRQHandler .word AES2_IRQHandler .word RNG_IRQHandler .word FPU_IRQHandler .word DMA2_Channel1_IRQHandler .word DMA2_Channel2_IRQHandler .word DMA2_Channel3_IRQHandler .word DMA2_Channel4_IRQHandler .word DMA2_Channel5_IRQHandler .word DMA2_Channel6_IRQHandler .word DMA2_Channel7_IRQHandler .word DMAMUX1_OVR_IRQHandler /******************************************************************************* * * 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_PVM_IRQHandler .thumb_set PVD_PVM_IRQHandler,Default_Handler .weak TAMP_STAMP_LSECSS_IRQHandler .thumb_set TAMP_STAMP_LSECSS_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_Channel1_IRQHandler .thumb_set DMA1_Channel1_IRQHandler,Default_Handler .weak DMA1_Channel2_IRQHandler .thumb_set DMA1_Channel2_IRQHandler,Default_Handler .weak DMA1_Channel3_IRQHandler .thumb_set DMA1_Channel3_IRQHandler,Default_Handler .weak DMA1_Channel4_IRQHandler .thumb_set DMA1_Channel4_IRQHandler,Default_Handler .weak DMA1_Channel5_IRQHandler .thumb_set DMA1_Channel5_IRQHandler,Default_Handler .weak DMA1_Channel6_IRQHandler .thumb_set DMA1_Channel6_IRQHandler,Default_Handler .weak DMA1_Channel7_IRQHandler .thumb_set DMA1_Channel7_IRQHandler,Default_Handler .weak ADC1_IRQHandler .thumb_set ADC1_IRQHandler,Default_Handler .weak USB_HP_IRQHandler .thumb_set USB_HP_IRQHandler,Default_Handler .weak USB_LP_IRQHandler .thumb_set USB_LP_IRQHandler,Default_Handler .weak C2SEV_PWR_C2H_IRQHandler .thumb_set C2SEV_PWR_C2H_IRQHandler,Default_Handler .weak COMP_IRQHandler .thumb_set COMP_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_TIM16_IRQHandler .thumb_set TIM1_UP_TIM16_IRQHandler,Default_Handler .weak TIM1_TRG_COM_TIM17_IRQHandler .thumb_set TIM1_TRG_COM_TIM17_IRQHandler,Default_Handler .weak TIM1_CC_IRQHandler .thumb_set TIM1_CC_IRQHandler,Default_Handler .weak TIM2_IRQHandler .thumb_set TIM2_IRQHandler,Default_Handler .weak PKA_IRQHandler .thumb_set PKA_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 I2C3_EV_IRQHandler .thumb_set I2C3_EV_IRQHandler,Default_Handler .weak I2C3_ER_IRQHandler .thumb_set I2C3_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 LPUART1_IRQHandler .thumb_set LPUART1_IRQHandler,Default_Handler .weak SAI1_IRQHandler .thumb_set SAI1_IRQHandler,Default_Handler .weak TSC_IRQHandler .thumb_set TSC_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 CRS_IRQHandler .thumb_set CRS_IRQHandler,Default_Handler .weak PWR_SOTF_BLEACT_802ACT_RFPHASE_IRQHandler .thumb_set PWR_SOTF_BLEACT_802ACT_RFPHASE_IRQHandler,Default_Handler .weak IPCC_C1_RX_IRQHandler .thumb_set IPCC_C1_RX_IRQHandler,Default_Handler .weak IPCC_C1_TX_IRQHandler .thumb_set IPCC_C1_TX_IRQHandler,Default_Handler .weak HSEM_IRQHandler .thumb_set HSEM_IRQHandler,Default_Handler .weak LPTIM1_IRQHandler .thumb_set LPTIM1_IRQHandler,Default_Handler .weak LPTIM2_IRQHandler .thumb_set LPTIM2_IRQHandler,Default_Handler .weak LCD_IRQHandler .thumb_set LCD_IRQHandler,Default_Handler .weak QUADSPI_IRQHandler .thumb_set QUADSPI_IRQHandler,Default_Handler .weak AES1_IRQHandler .thumb_set AES1_IRQHandler,Default_Handler .weak AES2_IRQHandler .thumb_set AES2_IRQHandler,Default_Handler .weak RNG_IRQHandler .thumb_set RNG_IRQHandler,Default_Handler .weak FPU_IRQHandler .thumb_set FPU_IRQHandler,Default_Handler .weak DMA2_Channel1_IRQHandler .thumb_set DMA2_Channel1_IRQHandler,Default_Handler .weak DMA2_Channel2_IRQHandler .thumb_set DMA2_Channel2_IRQHandler,Default_Handler .weak DMA2_Channel3_IRQHandler .thumb_set DMA2_Channel3_IRQHandler,Default_Handler .weak DMA2_Channel4_IRQHandler .thumb_set DMA2_Channel4_IRQHandler,Default_Handler .weak DMA2_Channel5_IRQHandler .thumb_set DMA2_Channel5_IRQHandler,Default_Handler .weak DMA2_Channel6_IRQHandler .thumb_set DMA2_Channel6_IRQHandler,Default_Handler .weak DMA2_Channel7_IRQHandler .thumb_set DMA2_Channel7_IRQHandler,Default_Handler .weak DMAMUX1_OVR_IRQHandler .thumb_set DMAMUX1_OVR_IRQHandler,Default_Handler
MorseMicro/mm-iot-sdk
12,287
framework/src/platforms/mm-ekh08-wb55/bsp/startup_stm32wb55xx_cm4.s
/** ****************************************************************************** * @file startup_stm32wb55xx_cm4.s * @author MCD Application Team * @brief STM32WB55xx devices vector table GCC 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-M4 processor is in Thread mode, * priority is Privileged, and the Stack is set to Main. ****************************************************************************** * @attention * * Copyright (c) 2019-2021 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file * in the root directory of this software component. * If no LICENSE file comes with this software, it is provided AS-IS. * ****************************************************************************** */ .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 /* start address for the .MB_MEM2 section. defined in linker script */ .word _sMB_MEM2 /* end address for the .MB_MEM2 section. defined in linker script */ .word _eMB_MEM2 /* INIT_BSS macro is used to fill the specified region [start : end] with zeros */ .macro INIT_BSS start, end ldr r0, =\start ldr r1, =\end movs r3, #0 bl LoopFillZerobss .endm /* INIT_DATA macro is used to copy data in the region [start : end] starting from 'src' */ .macro INIT_DATA start, end, src ldr r0, =\start ldr r1, =\end ldr r2, =\src movs r3, #0 bl LoopCopyDataInit .endm .section .text.data_initializers CopyDataInit: ldr r4, [r2, r3] str r4, [r0, r3] adds r3, r3, #4 LoopCopyDataInit: adds r4, r0, r3 cmp r4, r1 bcc CopyDataInit bx lr FillZerobss: str r3, [r0] adds r0, r0, #4 LoopFillZerobss: cmp r0, r1 bcc FillZerobss bx lr .section .text.Reset_Handler .weak Reset_Handler .type Reset_Handler, %function Reset_Handler: ldr r0, =_estack mov sp, r0 /* set stack pointer */ /* Call the clock system initialization function.*/ bl SystemInit /* Copy the data segment initializers from flash to SRAM */ INIT_DATA _sdata, _edata, _sidata /* Zero fill the bss segments. */ INIT_BSS _sbss, _ebss INIT_BSS _sMB_MEM2, _eMB_MEM2 /* Call static constructors */ bl __libc_init_array /* Call the application s entry point.*/ bl main LoopForever: b LoopForever .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 /** * @brief This is a placeholder for the bootloader. * Since there is no bootloader, we just duplicate the reset vector. */ .section .bootloader,"a",%progbits .word _estack .word Reset_Handler /****************************************************************************** * * The minimal vector table for a Cortex-M4. 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 .word WWDG_IRQHandler .word PVD_PVM_IRQHandler .word TAMP_STAMP_LSECSS_IRQHandler .word RTC_WKUP_IRQHandler .word FLASH_IRQHandler .word RCC_IRQHandler .word EXTI0_IRQHandler .word EXTI1_IRQHandler .word EXTI2_IRQHandler .word EXTI3_IRQHandler .word EXTI4_IRQHandler .word DMA1_Channel1_IRQHandler .word DMA1_Channel2_IRQHandler .word DMA1_Channel3_IRQHandler .word DMA1_Channel4_IRQHandler .word DMA1_Channel5_IRQHandler .word DMA1_Channel6_IRQHandler .word DMA1_Channel7_IRQHandler .word ADC1_IRQHandler .word USB_HP_IRQHandler .word USB_LP_IRQHandler .word C2SEV_PWR_C2H_IRQHandler .word COMP_IRQHandler .word EXTI9_5_IRQHandler .word TIM1_BRK_IRQHandler .word TIM1_UP_TIM16_IRQHandler .word TIM1_TRG_COM_TIM17_IRQHandler .word TIM1_CC_IRQHandler .word TIM2_IRQHandler .word PKA_IRQHandler .word I2C1_EV_IRQHandler .word I2C1_ER_IRQHandler .word I2C3_EV_IRQHandler .word I2C3_ER_IRQHandler .word SPI1_IRQHandler .word SPI2_IRQHandler .word USART1_IRQHandler .word LPUART1_IRQHandler .word SAI1_IRQHandler .word TSC_IRQHandler .word EXTI15_10_IRQHandler .word RTC_Alarm_IRQHandler .word CRS_IRQHandler .word PWR_SOTF_BLEACT_802ACT_RFPHASE_IRQHandler .word IPCC_C1_RX_IRQHandler .word IPCC_C1_TX_IRQHandler .word HSEM_IRQHandler .word LPTIM1_IRQHandler .word LPTIM2_IRQHandler .word LCD_IRQHandler .word QUADSPI_IRQHandler .word AES1_IRQHandler .word AES2_IRQHandler .word RNG_IRQHandler .word FPU_IRQHandler .word DMA2_Channel1_IRQHandler .word DMA2_Channel2_IRQHandler .word DMA2_Channel3_IRQHandler .word DMA2_Channel4_IRQHandler .word DMA2_Channel5_IRQHandler .word DMA2_Channel6_IRQHandler .word DMA2_Channel7_IRQHandler .word DMAMUX1_OVR_IRQHandler /******************************************************************************* * * 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_PVM_IRQHandler .thumb_set PVD_PVM_IRQHandler,Default_Handler .weak TAMP_STAMP_LSECSS_IRQHandler .thumb_set TAMP_STAMP_LSECSS_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_Channel1_IRQHandler .thumb_set DMA1_Channel1_IRQHandler,Default_Handler .weak DMA1_Channel2_IRQHandler .thumb_set DMA1_Channel2_IRQHandler,Default_Handler .weak DMA1_Channel3_IRQHandler .thumb_set DMA1_Channel3_IRQHandler,Default_Handler .weak DMA1_Channel4_IRQHandler .thumb_set DMA1_Channel4_IRQHandler,Default_Handler .weak DMA1_Channel5_IRQHandler .thumb_set DMA1_Channel5_IRQHandler,Default_Handler .weak DMA1_Channel6_IRQHandler .thumb_set DMA1_Channel6_IRQHandler,Default_Handler .weak DMA1_Channel7_IRQHandler .thumb_set DMA1_Channel7_IRQHandler,Default_Handler .weak ADC1_IRQHandler .thumb_set ADC1_IRQHandler,Default_Handler .weak USB_HP_IRQHandler .thumb_set USB_HP_IRQHandler,Default_Handler .weak USB_LP_IRQHandler .thumb_set USB_LP_IRQHandler,Default_Handler .weak C2SEV_PWR_C2H_IRQHandler .thumb_set C2SEV_PWR_C2H_IRQHandler,Default_Handler .weak COMP_IRQHandler .thumb_set COMP_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_TIM16_IRQHandler .thumb_set TIM1_UP_TIM16_IRQHandler,Default_Handler .weak TIM1_TRG_COM_TIM17_IRQHandler .thumb_set TIM1_TRG_COM_TIM17_IRQHandler,Default_Handler .weak TIM1_CC_IRQHandler .thumb_set TIM1_CC_IRQHandler,Default_Handler .weak TIM2_IRQHandler .thumb_set TIM2_IRQHandler,Default_Handler .weak PKA_IRQHandler .thumb_set PKA_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 I2C3_EV_IRQHandler .thumb_set I2C3_EV_IRQHandler,Default_Handler .weak I2C3_ER_IRQHandler .thumb_set I2C3_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 LPUART1_IRQHandler .thumb_set LPUART1_IRQHandler,Default_Handler .weak SAI1_IRQHandler .thumb_set SAI1_IRQHandler,Default_Handler .weak TSC_IRQHandler .thumb_set TSC_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 CRS_IRQHandler .thumb_set CRS_IRQHandler,Default_Handler .weak PWR_SOTF_BLEACT_802ACT_RFPHASE_IRQHandler .thumb_set PWR_SOTF_BLEACT_802ACT_RFPHASE_IRQHandler,Default_Handler .weak IPCC_C1_RX_IRQHandler .thumb_set IPCC_C1_RX_IRQHandler,Default_Handler .weak IPCC_C1_TX_IRQHandler .thumb_set IPCC_C1_TX_IRQHandler,Default_Handler .weak HSEM_IRQHandler .thumb_set HSEM_IRQHandler,Default_Handler .weak LPTIM1_IRQHandler .thumb_set LPTIM1_IRQHandler,Default_Handler .weak LPTIM2_IRQHandler .thumb_set LPTIM2_IRQHandler,Default_Handler .weak LCD_IRQHandler .thumb_set LCD_IRQHandler,Default_Handler .weak QUADSPI_IRQHandler .thumb_set QUADSPI_IRQHandler,Default_Handler .weak AES1_IRQHandler .thumb_set AES1_IRQHandler,Default_Handler .weak AES2_IRQHandler .thumb_set AES2_IRQHandler,Default_Handler .weak RNG_IRQHandler .thumb_set RNG_IRQHandler,Default_Handler .weak FPU_IRQHandler .thumb_set FPU_IRQHandler,Default_Handler .weak DMA2_Channel1_IRQHandler .thumb_set DMA2_Channel1_IRQHandler,Default_Handler .weak DMA2_Channel2_IRQHandler .thumb_set DMA2_Channel2_IRQHandler,Default_Handler .weak DMA2_Channel3_IRQHandler .thumb_set DMA2_Channel3_IRQHandler,Default_Handler .weak DMA2_Channel4_IRQHandler .thumb_set DMA2_Channel4_IRQHandler,Default_Handler .weak DMA2_Channel5_IRQHandler .thumb_set DMA2_Channel5_IRQHandler,Default_Handler .weak DMA2_Channel6_IRQHandler .thumb_set DMA2_Channel6_IRQHandler,Default_Handler .weak DMA2_Channel7_IRQHandler .thumb_set DMA2_Channel7_IRQHandler,Default_Handler .weak DMAMUX1_OVR_IRQHandler .thumb_set DMAMUX1_OVR_IRQHandler,Default_Handler
mpw/Objective-Smalltalk
9,841
ObjSTNative/test-compiles/class-with-method-block.s
.section __TEXT,__text,regular,pure_instructions .build_version macos, 12, 3 sdk_version 12, 3 .p2align 2 ; -- Begin function -[Hi onLine:execute:] "-[Hi onLine:execute:]": ; @"\01-[Hi onLine:execute:]" .cfi_startproc ; %bb.0: stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill mov x29, sp .cfi_def_cfa w29, 16 .cfi_offset w30, -8 .cfi_offset w29, -16 mov x0, x3 mov x1, x2 ldr x8, [x3, #16] blr x8 ldp x29, x30, [sp], #16 ; 16-byte Folded Reload ret .cfi_endproc ; -- End function .p2align 2 ; -- Begin function -[Hi noCaptureBlockUse:] "-[Hi noCaptureBlockUse:]": ; @"\01-[Hi noCaptureBlockUse:]" .cfi_startproc ; %bb.0: stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill mov x29, sp .cfi_def_cfa w29, 16 .cfi_offset w30, -8 .cfi_offset w29, -16 Lloh0: adrp x3, ___block_literal_global@PAGE Lloh1: add x3, x3, ___block_literal_global@PAGEOFF bl "_objc_msgSend$onLine:execute:" ldp x29, x30, [sp], #16 ; 16-byte Folded Reload ret .loh AdrpAdd Lloh0, Lloh1 .cfi_endproc ; -- End function .p2align 2 ; -- Begin function __24-[Hi noCaptureBlockUse:]_block_invoke "___24-[Hi noCaptureBlockUse:]_block_invoke": ; @"__24-[Hi noCaptureBlockUse:]_block_invoke" .cfi_startproc ; %bb.0: stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill mov x29, sp .cfi_def_cfa w29, 16 .cfi_offset w30, -8 .cfi_offset w29, -16 mov x0, x1 bl _objc_msgSend$uppercaseString ldp x29, x30, [sp], #16 ; 16-byte Folded Reload ret .cfi_endproc ; -- End function .p2align 2 ; -- Begin function -[Hi lines:] "-[Hi lines:]": ; @"\01-[Hi lines:]" .cfi_startproc ; %bb.0: sub sp, sp, #80 stp x20, x19, [sp, #48] ; 16-byte Folded Spill stp x29, x30, [sp, #64] ; 16-byte Folded Spill add x29, sp, #64 .cfi_def_cfa w29, 16 .cfi_offset w30, -8 .cfi_offset w29, -16 .cfi_offset w19, -24 .cfi_offset w20, -32 mov x19, x2 Lloh2: adrp x8, _OBJC_CLASSLIST_REFERENCES_$_@PAGE Lloh3: ldr x0, [x8, _OBJC_CLASSLIST_REFERENCES_$_@PAGEOFF] bl _objc_msgSend$array mov x20, x0 Lloh4: adrp x8, __NSConcreteStackBlock@GOTPAGE Lloh5: ldr x8, [x8, __NSConcreteStackBlock@GOTPAGEOFF] mov w9, #-1040187392 Lloh6: adrp x10, "___12-[Hi lines:]_block_invoke"@PAGE Lloh7: add x10, x10, "___12-[Hi lines:]_block_invoke"@PAGEOFF stp x8, x9, [sp, #8] Lloh8: adrp x8, "___block_descriptor_40_e8_32o_e22_v24?0\"NSString\"8^B16l"@PAGE Lloh9: add x8, x8, "___block_descriptor_40_e8_32o_e22_v24?0\"NSString\"8^B16l"@PAGEOFF stp x10, x8, [sp, #24] str x0, [sp, #40] add x2, sp, #8 mov x0, x19 bl "_objc_msgSend$enumerateLinesUsingBlock:" mov x0, x20 ldp x29, x30, [sp, #64] ; 16-byte Folded Reload ldp x20, x19, [sp, #48] ; 16-byte Folded Reload add sp, sp, #80 ret .loh AdrpAdd Lloh8, Lloh9 .loh AdrpAdd Lloh6, Lloh7 .loh AdrpLdrGot Lloh4, Lloh5 .loh AdrpLdr Lloh2, Lloh3 .cfi_endproc ; -- End function .p2align 2 ; -- Begin function __12-[Hi lines:]_block_invoke "___12-[Hi lines:]_block_invoke": ; @"__12-[Hi lines:]_block_invoke" .cfi_startproc ; %bb.0: stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill mov x29, sp .cfi_def_cfa w29, 16 .cfi_offset w30, -8 .cfi_offset w29, -16 ldr x0, [x0, #32] mov x2, x1 bl "_objc_msgSend$addObject:" ldp x29, x30, [sp], #16 ; 16-byte Folded Reload ret .cfi_endproc ; -- End function .private_extern ___copy_helper_block_e8_32o ; -- Begin function __copy_helper_block_e8_32o .globl ___copy_helper_block_e8_32o .weak_def_can_be_hidden ___copy_helper_block_e8_32o .p2align 2 ___copy_helper_block_e8_32o: ; @__copy_helper_block_e8_32o .cfi_startproc ; %bb.0: stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill mov x29, sp .cfi_def_cfa w29, 16 .cfi_offset w30, -8 .cfi_offset w29, -16 add x0, x0, #32 ldr x1, [x1, #32] mov w2, #3 bl __Block_object_assign ldp x29, x30, [sp], #16 ; 16-byte Folded Reload ret .cfi_endproc ; -- End function .private_extern ___destroy_helper_block_e8_32o ; -- Begin function __destroy_helper_block_e8_32o .globl ___destroy_helper_block_e8_32o .weak_def_can_be_hidden ___destroy_helper_block_e8_32o .p2align 2 ___destroy_helper_block_e8_32o: ; @__destroy_helper_block_e8_32o .cfi_startproc ; %bb.0: stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill mov x29, sp .cfi_def_cfa w29, 16 .cfi_offset w30, -8 .cfi_offset w29, -16 ldr x0, [x0, #32] mov w1, #3 bl __Block_object_dispose ldp x29, x30, [sp], #16 ; 16-byte Folded Reload ret .cfi_endproc ; -- End function .section __TEXT,__cstring,cstring_literals l_.str: ; @.str .asciz "@\"NSString\"16@?0@\"NSString\"8" .private_extern "___block_descriptor_32_e28_\"NSString\"16?0\"NSString\"8l" ; @"__block_descriptor_32_e28_\01\22NSString\2216\01?0\01\22NSString\228l" .section __DATA,__const .globl "___block_descriptor_32_e28_\"NSString\"16?0\"NSString\"8l" .weak_def_can_be_hidden "___block_descriptor_32_e28_\"NSString\"16?0\"NSString\"8l" .p2align 3 "___block_descriptor_32_e28_\"NSString\"16?0\"NSString\"8l": .quad 0 ; 0x0 .quad 32 ; 0x20 .quad l_.str .quad 0 .p2align 3 ; @__block_literal_global ___block_literal_global: .quad __NSConcreteGlobalBlock .long 1342177280 ; 0x50000000 .long 0 ; 0x0 .quad "___24-[Hi noCaptureBlockUse:]_block_invoke" .quad "___block_descriptor_32_e28_\"NSString\"16?0\"NSString\"8l" .section __DATA,__objc_classrefs,regular,no_dead_strip .p2align 3 ; @"OBJC_CLASSLIST_REFERENCES_$_" _OBJC_CLASSLIST_REFERENCES_$_: .quad _OBJC_CLASS_$_NSMutableArray .section __TEXT,__cstring,cstring_literals l_.str.1: ; @.str.1 .asciz "v24@?0@\"NSString\"8^B16" .private_extern "___block_descriptor_40_e8_32o_e22_v24?0\"NSString\"8^B16l" ; @"__block_descriptor_40_e8_32o_e22_v24\01?0\01\22NSString\228^B16l" .section __DATA,__const .globl "___block_descriptor_40_e8_32o_e22_v24?0\"NSString\"8^B16l" .weak_def_can_be_hidden "___block_descriptor_40_e8_32o_e22_v24?0\"NSString\"8^B16l" .p2align 3 "___block_descriptor_40_e8_32o_e22_v24?0\"NSString\"8^B16l": .quad 0 ; 0x0 .quad 40 ; 0x28 .quad ___copy_helper_block_e8_32o .quad ___destroy_helper_block_e8_32o .quad l_.str.1 .quad 256 ; 0x100 .section __TEXT,__objc_classname,cstring_literals l_OBJC_CLASS_NAME_: ; @OBJC_CLASS_NAME_ .asciz "Hi" .section __DATA,__objc_const .p2align 3 ; @"_OBJC_METACLASS_RO_$_Hi" __OBJC_METACLASS_RO_$_Hi: .long 1 ; 0x1 .long 40 ; 0x28 .long 40 ; 0x28 .space 4 .quad 0 .quad l_OBJC_CLASS_NAME_ .quad 0 .quad 0 .quad 0 .quad 0 .quad 0 .section __DATA,__objc_data .globl _OBJC_METACLASS_$_Hi ; @"OBJC_METACLASS_$_Hi" .p2align 3 _OBJC_METACLASS_$_Hi: .quad _OBJC_METACLASS_$_NSObject .quad _OBJC_METACLASS_$_NSObject .quad __objc_empty_cache .quad 0 .quad __OBJC_METACLASS_RO_$_Hi .section __TEXT,__objc_methname,cstring_literals l_OBJC_METH_VAR_NAME_: ; @OBJC_METH_VAR_NAME_ .asciz "onLine:execute:" .section __TEXT,__objc_methtype,cstring_literals l_OBJC_METH_VAR_TYPE_: ; @OBJC_METH_VAR_TYPE_ .asciz "@32@0:8@16@?24" .section __TEXT,__objc_methname,cstring_literals l_OBJC_METH_VAR_NAME_.2: ; @OBJC_METH_VAR_NAME_.2 .asciz "noCaptureBlockUse:" .section __TEXT,__objc_methtype,cstring_literals l_OBJC_METH_VAR_TYPE_.3: ; @OBJC_METH_VAR_TYPE_.3 .asciz "@24@0:8@16" .section __TEXT,__objc_methname,cstring_literals l_OBJC_METH_VAR_NAME_.4: ; @OBJC_METH_VAR_NAME_.4 .asciz "lines:" .section __DATA,__objc_const .p2align 3 ; @"_OBJC_$_INSTANCE_METHODS_Hi" __OBJC_$_INSTANCE_METHODS_Hi: .long 24 ; 0x18 .long 3 ; 0x3 .quad l_OBJC_METH_VAR_NAME_ .quad l_OBJC_METH_VAR_TYPE_ .quad "-[Hi onLine:execute:]" .quad l_OBJC_METH_VAR_NAME_.2 .quad l_OBJC_METH_VAR_TYPE_.3 .quad "-[Hi noCaptureBlockUse:]" .quad l_OBJC_METH_VAR_NAME_.4 .quad l_OBJC_METH_VAR_TYPE_.3 .quad "-[Hi lines:]" .p2align 3 ; @"_OBJC_CLASS_RO_$_Hi" __OBJC_CLASS_RO_$_Hi: .long 0 ; 0x0 .long 8 ; 0x8 .long 8 ; 0x8 .space 4 .quad 0 .quad l_OBJC_CLASS_NAME_ .quad __OBJC_$_INSTANCE_METHODS_Hi .quad 0 .quad 0 .quad 0 .quad 0 .section __DATA,__objc_data .globl _OBJC_CLASS_$_Hi ; @"OBJC_CLASS_$_Hi" .p2align 3 _OBJC_CLASS_$_Hi: .quad _OBJC_METACLASS_$_Hi .quad _OBJC_CLASS_$_NSObject .quad __objc_empty_cache .quad 0 .quad __OBJC_CLASS_RO_$_Hi .section __DATA,__objc_classlist,regular,no_dead_strip .p2align 3 ; @"OBJC_LABEL_CLASS_$" l_OBJC_LABEL_CLASS_$: .quad _OBJC_CLASS_$_Hi .section __DATA,__objc_imageinfo,regular,no_dead_strip L_OBJC_IMAGE_INFO: .long 0 .long 64 .subsections_via_symbols
mpw/Objective-Smalltalk
3,834
ObjSTNative/test-compiles/empty-class.s
; ModuleID = 'empty-class.m' target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" target triple = "x86_64-apple-macosx10.9.0" %struct._objc_cache = type opaque %struct._class_t = type { %struct._class_t*, %struct._class_t*, %struct._objc_cache*, i8* (i8*, i8*)**, %struct._class_ro_t* } %struct._class_ro_t = type { i32, i32, i32, i8*, i8*, %struct.__method_list_t*, %struct._objc_protocol_list*, %struct._ivar_list_t*, i8*, %struct._prop_list_t* } %struct.__method_list_t = type { i32, i32, [0 x %struct._objc_method] } %struct._objc_method = type { i8*, i8*, i8* } %struct._objc_protocol_list = type { i64, [0 x %struct._protocol_t*] } %struct._protocol_t = type { i8*, i8*, %struct._objc_protocol_list*, %struct.__method_list_t*, %struct.__method_list_t*, %struct.__method_list_t*, %struct.__method_list_t*, %struct._prop_list_t*, i32, i32, i8** } %struct._prop_list_t = type { i32, i32, [0 x %struct._prop_t] } %struct._prop_t = type { i8*, i8* } %struct._ivar_list_t = type { i32, i32, [0 x %struct._ivar_t] } %struct._ivar_t = type { i64*, i8*, i8*, i32, i32 } @_objc_empty_cache = external global %struct._objc_cache @_objc_empty_vtable = external global i8* (i8*, i8*)* @"OBJC_METACLASS_$_NSObject" = external global %struct._class_t @"\01L_OBJC_CLASS_NAME_" = internal global [24 x i8] c"EmptyCodeGenTestClass01\00", section "__TEXT,__objc_classname,cstring_literals", align 1 @"\01l_OBJC_METACLASS_RO_$_EmptyCodeGenTestClass01" = internal global %struct._class_ro_t { i32 1, i32 40, i32 40, i8* null, i8* getelementptr inbounds ([24 x i8]* @"\01L_OBJC_CLASS_NAME_", i32 0, i32 0), %struct.__method_list_t* null, %struct._objc_protocol_list* null, %struct._ivar_list_t* null, i8* null, %struct._prop_list_t* null }, section "__DATA, __objc_const", align 8 @"OBJC_METACLASS_$_EmptyCodeGenTestClass01" = global %struct._class_t { %struct._class_t* @"OBJC_METACLASS_$_NSObject", %struct._class_t* @"OBJC_METACLASS_$_NSObject", %struct._objc_cache* @_objc_empty_cache, i8* (i8*, i8*)** @_objc_empty_vtable, %struct._class_ro_t* @"\01l_OBJC_METACLASS_RO_$_EmptyCodeGenTestClass01" }, section "__DATA, __objc_data", align 8 @"OBJC_CLASS_$_NSObject" = external global %struct._class_t @"\01l_OBJC_CLASS_RO_$_EmptyCodeGenTestClass01" = internal global %struct._class_ro_t { i32 0, i32 8, i32 8, i8* null, i8* getelementptr inbounds ([24 x i8]* @"\01L_OBJC_CLASS_NAME_", i32 0, i32 0), %struct.__method_list_t* null, %struct._objc_protocol_list* null, %struct._ivar_list_t* null, i8* null, %struct._prop_list_t* null }, section "__DATA, __objc_const", align 8 @"OBJC_CLASS_$_EmptyCodeGenTestClass01" = global %struct._class_t { %struct._class_t* @"OBJC_METACLASS_$_EmptyCodeGenTestClass01", %struct._class_t* @"OBJC_CLASS_$_NSObject", %struct._objc_cache* @_objc_empty_cache, i8* (i8*, i8*)** @_objc_empty_vtable, %struct._class_ro_t* @"\01l_OBJC_CLASS_RO_$_EmptyCodeGenTestClass01" }, section "__DATA, __objc_data", align 8 @"\01L_OBJC_LABEL_CLASS_$" = internal global [1 x i8*] [i8* bitcast (%struct._class_t* @"OBJC_CLASS_$_EmptyCodeGenTestClass01" to i8*)], section "__DATA, __objc_classlist, regular, no_dead_strip", align 8 @llvm.used = appending global [2 x i8*] [i8* getelementptr inbounds ([24 x i8]* @"\01L_OBJC_CLASS_NAME_", i32 0, i32 0), i8* bitcast ([1 x i8*]* @"\01L_OBJC_LABEL_CLASS_$" to i8*)], section "llvm.metadata" !llvm.module.flags = !{!0, !1, !2, !3} !0 = metadata !{i32 1, metadata !"Objective-C Version", i32 2} !1 = metadata !{i32 1, metadata !"Objective-C Image Info Version", i32 0} !2 = metadata !{i32 1, metadata !"Objective-C Image Info Section", metadata !"__DATA, __objc_imageinfo, regular, no_dead_strip"} !3 = metadata !{i32 4, metadata !"Objective-C Garbage Collection", i32 0}
mpw/Objective-Smalltalk
23,447
ObjSTNative/test-compiles/class-with-methods-old.s
; ModuleID = 'class-with-methods.m' target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" target triple = "x86_64-apple-macosx10.9.0" %0 = type opaque %1 = type opaque %2 = type opaque %3 = type opaque %struct.NSConstantString = type { i32*, i32, i8*, i64 } %struct._class_t = type { %struct._class_t*, %struct._class_t*, %struct._objc_cache*, i8* (i8*, i8*)**, %struct._class_ro_t* } %struct._objc_cache = type opaque %struct._class_ro_t = type { i32, i32, i32, i8*, i8*, %struct.__method_list_t*, %struct._objc_protocol_list*, %struct._ivar_list_t*, i8*, %struct._prop_list_t* } %struct.__method_list_t = type { i32, i32, [0 x %struct._objc_method] } %struct._objc_method = type { i8*, i8*, i8* } %struct._objc_protocol_list = type { i64, [0 x %struct._protocol_t*] } %struct._protocol_t = type { i8*, i8*, %struct._objc_protocol_list*, %struct.__method_list_t*, %struct.__method_list_t*, %struct.__method_list_t*, %struct.__method_list_t*, %struct._prop_list_t*, i32, i32, i8** } %struct._prop_list_t = type { i32, i32, [0 x %struct._prop_t] } %struct._prop_t = type { i8*, i8* } %struct._ivar_list_t = type { i32, i32, [0 x %struct._ivar_t] } %struct._ivar_t = type { i64*, i8*, i8*, i32, i32 } @"\01L_OBJC_METH_VAR_NAME_" = internal global [29 x i8] c"componentsSeparatedByString:\00", section "__TEXT,__objc_methname,cstring_literals", align 1 @"\01L_OBJC_SELECTOR_REFERENCES_" = internal externally_initialized global i8* getelementptr inbounds ([29 x i8]* @"\01L_OBJC_METH_VAR_NAME_", i64 0, i64 0), section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" @__CFConstantStringClassReference = external global [0 x i32] @.str = linker_private unnamed_addr constant [2 x i8] c"\0A\00", align 1 @_unnamed_cfstring_ = private constant %struct.NSConstantString { i32* getelementptr inbounds ([0 x i32]* @__CFConstantStringClassReference, i32 0, i32 0), i32 1992, i8* getelementptr inbounds ([2 x i8]* @.str, i32 0, i32 0), i64 1 }, section "__DATA,__cfstring" @"\01L_OBJC_METH_VAR_NAME_1" = internal global [22 x i8] c"components:splitInto:\00", section "__TEXT,__objc_methname,cstring_literals", align 1 @"\01L_OBJC_SELECTOR_REFERENCES_2" = internal externally_initialized global i8* getelementptr inbounds ([22 x i8]* @"\01L_OBJC_METH_VAR_NAME_1", i64 0, i64 0), section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" @"OBJC_IVAR_$_Hi.factor" = global i64 8, section "__DATA, __objc_ivar", align 8 @"\01L_OBJC_METH_VAR_NAME_3" = internal global [22 x i8] c"mulByAddition:factor:\00", section "__TEXT,__objc_methname,cstring_literals", align 1 @"\01L_OBJC_SELECTOR_REFERENCES_4" = internal externally_initialized global i8* getelementptr inbounds ([22 x i8]* @"\01L_OBJC_METH_VAR_NAME_3", i64 0, i64 0), section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" @"OBJC_CLASS_$_NSNumber" = external global %struct._class_t @"\01L_OBJC_CLASSLIST_REFERENCES_$_" = internal global %struct._class_t* @"OBJC_CLASS_$_NSNumber", section "__DATA, __objc_classrefs, regular, no_dead_strip", align 8 @"\01L_OBJC_METH_VAR_NAME_5" = internal global [15 x i8] c"numberWithInt:\00", section "__TEXT,__objc_methname,cstring_literals", align 1 @"\01L_OBJC_SELECTOR_REFERENCES_6" = internal externally_initialized global i8* getelementptr inbounds ([15 x i8]* @"\01L_OBJC_METH_VAR_NAME_5", i64 0, i64 0), section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" @"\01L_OBJC_METH_VAR_NAME_7" = internal global [5 x i8] c"mul:\00", section "__TEXT,__objc_methname,cstring_literals", align 1 @"\01L_OBJC_SELECTOR_REFERENCES_8" = internal externally_initialized global i8* getelementptr inbounds ([5 x i8]* @"\01L_OBJC_METH_VAR_NAME_7", i64 0, i64 0), section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" @"OBJC_IVAR_$_Hi._someProperty" = hidden global i64 16, section "__DATA, __objc_ivar", align 8 @_objc_empty_cache = external global %struct._objc_cache @_objc_empty_vtable = external global i8* (i8*, i8*)* @"OBJC_METACLASS_$_NSObject" = external global %struct._class_t @"\01L_OBJC_CLASS_NAME_" = internal global [3 x i8] c"Hi\00", section "__TEXT,__objc_classname,cstring_literals", align 1 @"\01l_OBJC_METACLASS_RO_$_Hi" = internal global %struct._class_ro_t { i32 1, i32 40, i32 40, i8* null, i8* getelementptr inbounds ([3 x i8]* @"\01L_OBJC_CLASS_NAME_", i32 0, i32 0), %struct.__method_list_t* null, %struct._objc_protocol_list* null, %struct._ivar_list_t* null, i8* null, %struct._prop_list_t* null }, section "__DATA, __objc_const", align 8 @"OBJC_METACLASS_$_Hi" = global %struct._class_t { %struct._class_t* @"OBJC_METACLASS_$_NSObject", %struct._class_t* @"OBJC_METACLASS_$_NSObject", %struct._objc_cache* @_objc_empty_cache, i8* (i8*, i8*)** @_objc_empty_vtable, %struct._class_ro_t* @"\01l_OBJC_METACLASS_RO_$_Hi" }, section "__DATA, __objc_data", align 8 @"OBJC_CLASS_$_NSObject" = external global %struct._class_t @"\01L_OBJC_METH_VAR_TYPE_" = internal global [14 x i8] c"@32@0:8@16@24\00", section "__TEXT,__objc_methtype,cstring_literals", align 1 @"\01L_OBJC_METH_VAR_NAME_9" = internal global [7 x i8] c"lines:\00", section "__TEXT,__objc_methname,cstring_literals", align 1 @"\01L_OBJC_METH_VAR_TYPE_10" = internal global [11 x i8] c"@24@0:8@16\00", section "__TEXT,__objc_methtype,cstring_literals", align 1 @"\01L_OBJC_METH_VAR_NAME_11" = internal global [8 x i8] c"double:\00", section "__TEXT,__objc_methname,cstring_literals", align 1 @"\01L_OBJC_METH_VAR_TYPE_12" = internal global [11 x i8] c"i20@0:8i16\00", section "__TEXT,__objc_methtype,cstring_literals", align 1 @"\01L_OBJC_METH_VAR_TYPE_13" = internal global [14 x i8] c"i24@0:8i16i20\00", section "__TEXT,__objc_methtype,cstring_literals", align 1 @"\01L_OBJC_METH_VAR_NAME_14" = internal global [15 x i8] c"mulByAddition:\00", section "__TEXT,__objc_methname,cstring_literals", align 1 @"\01L_OBJC_METH_VAR_NAME_15" = internal global [16 x i8] c"mulNSNumberBy3:\00", section "__TEXT,__objc_methname,cstring_literals", align 1 @"\01L_OBJC_METH_VAR_NAME_16" = internal global [12 x i8] c"makeNumber:\00", section "__TEXT,__objc_methname,cstring_literals", align 1 @"\01L_OBJC_METH_VAR_TYPE_17" = internal global [11 x i8] c"@20@0:8i16\00", section "__TEXT,__objc_methtype,cstring_literals", align 1 @"\01L_OBJC_METH_VAR_NAME_18" = internal global [12 x i8] c"makeNumber3\00", section "__TEXT,__objc_methname,cstring_literals", align 1 @"\01L_OBJC_METH_VAR_TYPE_19" = internal global [8 x i8] c"@16@0:8\00", section "__TEXT,__objc_methtype,cstring_literals", align 1 @"\01L_OBJC_METH_VAR_NAME_20" = internal global [7 x i8] c"factor\00", section "__TEXT,__objc_methname,cstring_literals", align 1 @"\01L_OBJC_METH_VAR_TYPE_21" = internal global [8 x i8] c"i16@0:8\00", section "__TEXT,__objc_methtype,cstring_literals", align 1 @"\01L_OBJC_METH_VAR_NAME_22" = internal global [11 x i8] c"setFactor:\00", section "__TEXT,__objc_methname,cstring_literals", align 1 @"\01L_OBJC_METH_VAR_TYPE_23" = internal global [11 x i8] c"v20@0:8i16\00", section "__TEXT,__objc_methtype,cstring_literals", align 1 @"\01L_OBJC_METH_VAR_NAME_24" = internal global [13 x i8] c"someProperty\00", section "__TEXT,__objc_methname,cstring_literals", align 1 @"\01L_OBJC_METH_VAR_NAME_25" = internal global [17 x i8] c"setSomeProperty:\00", section "__TEXT,__objc_methname,cstring_literals", align 1 @"\01L_OBJC_METH_VAR_TYPE_26" = internal global [11 x i8] c"v24@0:8@16\00", section "__TEXT,__objc_methtype,cstring_literals", align 1 @"\01l_OBJC_$_INSTANCE_METHODS_Hi" = internal global { i32, i32, [12 x %struct._objc_method] } { i32 24, i32 12, [12 x %struct._objc_method] [%struct._objc_method { i8* getelementptr inbounds ([22 x i8]* @"\01L_OBJC_METH_VAR_NAME_1", i32 0, i32 0), i8* getelementptr inbounds ([14 x i8]* @"\01L_OBJC_METH_VAR_TYPE_", i32 0, i32 0), i8* bitcast (%0* (%1*, i8*, %2*, %2*)* @"\01-[Hi components:splitInto:]" to i8*) }, %struct._objc_method { i8* getelementptr inbounds ([7 x i8]* @"\01L_OBJC_METH_VAR_NAME_9", i32 0, i32 0), i8* getelementptr inbounds ([11 x i8]* @"\01L_OBJC_METH_VAR_TYPE_10", i32 0, i32 0), i8* bitcast (%0* (%1*, i8*, %2*)* @"\01-[Hi lines:]" to i8*) }, %struct._objc_method { i8* getelementptr inbounds ([8 x i8]* @"\01L_OBJC_METH_VAR_NAME_11", i32 0, i32 0), i8* getelementptr inbounds ([11 x i8]* @"\01L_OBJC_METH_VAR_TYPE_12", i32 0, i32 0), i8* bitcast (i32 (%1*, i8*, i32)* @"\01-[Hi double:]" to i8*) }, %struct._objc_method { i8* getelementptr inbounds ([22 x i8]* @"\01L_OBJC_METH_VAR_NAME_3", i32 0, i32 0), i8* getelementptr inbounds ([14 x i8]* @"\01L_OBJC_METH_VAR_TYPE_13", i32 0, i32 0), i8* bitcast (i32 (%1*, i8*, i32, i32)* @"\01-[Hi mulByAddition:factor:]" to i8*) }, %struct._objc_method { i8* getelementptr inbounds ([15 x i8]* @"\01L_OBJC_METH_VAR_NAME_14", i32 0, i32 0), i8* getelementptr inbounds ([11 x i8]* @"\01L_OBJC_METH_VAR_TYPE_12", i32 0, i32 0), i8* bitcast (i32 (%1*, i8*, i32)* @"\01-[Hi mulByAddition:]" to i8*) }, %struct._objc_method { i8* getelementptr inbounds ([16 x i8]* @"\01L_OBJC_METH_VAR_NAME_15", i32 0, i32 0), i8* getelementptr inbounds ([11 x i8]* @"\01L_OBJC_METH_VAR_TYPE_10", i32 0, i32 0), i8* bitcast (%3* (%1*, i8*, %3*)* @"\01-[Hi mulNSNumberBy3:]" to i8*) }, %struct._objc_method { i8* getelementptr inbounds ([12 x i8]* @"\01L_OBJC_METH_VAR_NAME_16", i32 0, i32 0), i8* getelementptr inbounds ([11 x i8]* @"\01L_OBJC_METH_VAR_TYPE_17", i32 0, i32 0), i8* bitcast (%3* (%1*, i8*, i32)* @"\01-[Hi makeNumber:]" to i8*) }, %struct._objc_method { i8* getelementptr inbounds ([12 x i8]* @"\01L_OBJC_METH_VAR_NAME_18", i32 0, i32 0), i8* getelementptr inbounds ([8 x i8]* @"\01L_OBJC_METH_VAR_TYPE_19", i32 0, i32 0), i8* bitcast (%3* (%1*, i8*)* @"\01-[Hi makeNumber3]" to i8*) }, %struct._objc_method { i8* getelementptr inbounds ([7 x i8]* @"\01L_OBJC_METH_VAR_NAME_20", i32 0, i32 0), i8* getelementptr inbounds ([8 x i8]* @"\01L_OBJC_METH_VAR_TYPE_21", i32 0, i32 0), i8* bitcast (i32 (%1*, i8*)* @"\01-[Hi factor]" to i8*) }, %struct._objc_method { i8* getelementptr inbounds ([11 x i8]* @"\01L_OBJC_METH_VAR_NAME_22", i32 0, i32 0), i8* getelementptr inbounds ([11 x i8]* @"\01L_OBJC_METH_VAR_TYPE_23", i32 0, i32 0), i8* bitcast (void (%1*, i8*, i32)* @"\01-[Hi setFactor:]" to i8*) }, %struct._objc_method { i8* getelementptr inbounds ([13 x i8]* @"\01L_OBJC_METH_VAR_NAME_24", i32 0, i32 0), i8* getelementptr inbounds ([8 x i8]* @"\01L_OBJC_METH_VAR_TYPE_19", i32 0, i32 0), i8* bitcast (i8* (%1*, i8*)* @"\01-[Hi someProperty]" to i8*) }, %struct._objc_method { i8* getelementptr inbounds ([17 x i8]* @"\01L_OBJC_METH_VAR_NAME_25", i32 0, i32 0), i8* getelementptr inbounds ([11 x i8]* @"\01L_OBJC_METH_VAR_TYPE_26", i32 0, i32 0), i8* bitcast (void (%1*, i8*, i8*)* @"\01-[Hi setSomeProperty:]" to i8*) }] }, section "__DATA, __objc_const", align 8 @"\01L_OBJC_METH_VAR_TYPE_27" = internal global [2 x i8] c"i\00", section "__TEXT,__objc_methtype,cstring_literals", align 1 @"\01L_OBJC_METH_VAR_NAME_28" = internal global [14 x i8] c"_someProperty\00", section "__TEXT,__objc_methname,cstring_literals", align 1 @"\01L_OBJC_METH_VAR_TYPE_29" = internal global [2 x i8] c"@\00", section "__TEXT,__objc_methtype,cstring_literals", align 1 @"\01l_OBJC_$_INSTANCE_VARIABLES_Hi" = internal global { i32, i32, [2 x %struct._ivar_t] } { i32 32, i32 2, [2 x %struct._ivar_t] [%struct._ivar_t { i64* @"OBJC_IVAR_$_Hi.factor", i8* getelementptr inbounds ([7 x i8]* @"\01L_OBJC_METH_VAR_NAME_20", i32 0, i32 0), i8* getelementptr inbounds ([2 x i8]* @"\01L_OBJC_METH_VAR_TYPE_27", i32 0, i32 0), i32 2, i32 4 }, %struct._ivar_t { i64* @"OBJC_IVAR_$_Hi._someProperty", i8* getelementptr inbounds ([14 x i8]* @"\01L_OBJC_METH_VAR_NAME_28", i32 0, i32 0), i8* getelementptr inbounds ([2 x i8]* @"\01L_OBJC_METH_VAR_TYPE_29", i32 0, i32 0), i32 3, i32 8 }] }, section "__DATA, __objc_const", align 8 @"\01L_OBJC_PROP_NAME_ATTR_" = internal global [7 x i8] c"factor\00", section "__TEXT,__cstring,cstring_literals", align 1 @"\01L_OBJC_PROP_NAME_ATTR_30" = internal global [11 x i8] c"Ti,Vfactor\00", section "__TEXT,__cstring,cstring_literals", align 1 @"\01L_OBJC_PROP_NAME_ATTR_31" = internal global [13 x i8] c"someProperty\00", section "__TEXT,__cstring,cstring_literals", align 1 @"\01L_OBJC_PROP_NAME_ATTR_32" = internal global [22 x i8] c"T@,&,N,V_someProperty\00", section "__TEXT,__cstring,cstring_literals", align 1 @"\01l_OBJC_$_PROP_LIST_Hi" = internal global { i32, i32, [2 x %struct._prop_t] } { i32 16, i32 2, [2 x %struct._prop_t] [%struct._prop_t { i8* getelementptr inbounds ([7 x i8]* @"\01L_OBJC_PROP_NAME_ATTR_", i32 0, i32 0), i8* getelementptr inbounds ([11 x i8]* @"\01L_OBJC_PROP_NAME_ATTR_30", i32 0, i32 0) }, %struct._prop_t { i8* getelementptr inbounds ([13 x i8]* @"\01L_OBJC_PROP_NAME_ATTR_31", i32 0, i32 0), i8* getelementptr inbounds ([22 x i8]* @"\01L_OBJC_PROP_NAME_ATTR_32", i32 0, i32 0) }] }, section "__DATA, __objc_const", align 8 @"\01l_OBJC_CLASS_RO_$_Hi" = internal global %struct._class_ro_t { i32 0, i32 8, i32 24, i8* null, i8* getelementptr inbounds ([3 x i8]* @"\01L_OBJC_CLASS_NAME_", i32 0, i32 0), %struct.__method_list_t* bitcast ({ i32, i32, [12 x %struct._objc_method] }* @"\01l_OBJC_$_INSTANCE_METHODS_Hi" to %struct.__method_list_t*), %struct._objc_protocol_list* null, %struct._ivar_list_t* bitcast ({ i32, i32, [2 x %struct._ivar_t] }* @"\01l_OBJC_$_INSTANCE_VARIABLES_Hi" to %struct._ivar_list_t*), i8* null, %struct._prop_list_t* bitcast ({ i32, i32, [2 x %struct._prop_t] }* @"\01l_OBJC_$_PROP_LIST_Hi" to %struct._prop_list_t*) }, section "__DATA, __objc_const", align 8 @"OBJC_CLASS_$_Hi" = global %struct._class_t { %struct._class_t* @"OBJC_METACLASS_$_Hi", %struct._class_t* @"OBJC_CLASS_$_NSObject", %struct._objc_cache* @_objc_empty_cache, i8* (i8*, i8*)** @_objc_empty_vtable, %struct._class_ro_t* @"\01l_OBJC_CLASS_RO_$_Hi" }, section "__DATA, __objc_data", align 8 @"\01L_OBJC_LABEL_CLASS_$" = internal global [1 x i8*] [i8* bitcast (%struct._class_t* @"OBJC_CLASS_$_Hi" to i8*)], section "__DATA, __objc_classlist, regular, no_dead_strip", align 8 @llvm.used = appending global [42 x i8*] [i8* getelementptr inbounds ([29 x i8]* @"\01L_OBJC_METH_VAR_NAME_", i32 0, i32 0), i8* bitcast (i8** @"\01L_OBJC_SELECTOR_REFERENCES_" to i8*), i8* getelementptr inbounds ([22 x i8]* @"\01L_OBJC_METH_VAR_NAME_1", i32 0, i32 0), i8* bitcast (i8** @"\01L_OBJC_SELECTOR_REFERENCES_2" to i8*), i8* getelementptr inbounds ([22 x i8]* @"\01L_OBJC_METH_VAR_NAME_3", i32 0, i32 0), i8* bitcast (i8** @"\01L_OBJC_SELECTOR_REFERENCES_4" to i8*), i8* bitcast (%struct._class_t** @"\01L_OBJC_CLASSLIST_REFERENCES_$_" to i8*), i8* getelementptr inbounds ([15 x i8]* @"\01L_OBJC_METH_VAR_NAME_5", i32 0, i32 0), i8* bitcast (i8** @"\01L_OBJC_SELECTOR_REFERENCES_6" to i8*), i8* getelementptr inbounds ([5 x i8]* @"\01L_OBJC_METH_VAR_NAME_7", i32 0, i32 0), i8* bitcast (i8** @"\01L_OBJC_SELECTOR_REFERENCES_8" to i8*), i8* getelementptr inbounds ([3 x i8]* @"\01L_OBJC_CLASS_NAME_", i32 0, i32 0), i8* getelementptr inbounds ([14 x i8]* @"\01L_OBJC_METH_VAR_TYPE_", i32 0, i32 0), i8* getelementptr inbounds ([7 x i8]* @"\01L_OBJC_METH_VAR_NAME_9", i32 0, i32 0), i8* getelementptr inbounds ([11 x i8]* @"\01L_OBJC_METH_VAR_TYPE_10", i32 0, i32 0), i8* getelementptr inbounds ([8 x i8]* @"\01L_OBJC_METH_VAR_NAME_11", i32 0, i32 0), i8* getelementptr inbounds ([11 x i8]* @"\01L_OBJC_METH_VAR_TYPE_12", i32 0, i32 0), i8* getelementptr inbounds ([14 x i8]* @"\01L_OBJC_METH_VAR_TYPE_13", i32 0, i32 0), i8* getelementptr inbounds ([15 x i8]* @"\01L_OBJC_METH_VAR_NAME_14", i32 0, i32 0), i8* getelementptr inbounds ([16 x i8]* @"\01L_OBJC_METH_VAR_NAME_15", i32 0, i32 0), i8* getelementptr inbounds ([12 x i8]* @"\01L_OBJC_METH_VAR_NAME_16", i32 0, i32 0), i8* getelementptr inbounds ([11 x i8]* @"\01L_OBJC_METH_VAR_TYPE_17", i32 0, i32 0), i8* getelementptr inbounds ([12 x i8]* @"\01L_OBJC_METH_VAR_NAME_18", i32 0, i32 0), i8* getelementptr inbounds ([8 x i8]* @"\01L_OBJC_METH_VAR_TYPE_19", i32 0, i32 0), i8* getelementptr inbounds ([7 x i8]* @"\01L_OBJC_METH_VAR_NAME_20", i32 0, i32 0), i8* getelementptr inbounds ([8 x i8]* @"\01L_OBJC_METH_VAR_TYPE_21", i32 0, i32 0), i8* getelementptr inbounds ([11 x i8]* @"\01L_OBJC_METH_VAR_NAME_22", i32 0, i32 0), i8* getelementptr inbounds ([11 x i8]* @"\01L_OBJC_METH_VAR_TYPE_23", i32 0, i32 0), i8* getelementptr inbounds ([13 x i8]* @"\01L_OBJC_METH_VAR_NAME_24", i32 0, i32 0), i8* getelementptr inbounds ([17 x i8]* @"\01L_OBJC_METH_VAR_NAME_25", i32 0, i32 0), i8* getelementptr inbounds ([11 x i8]* @"\01L_OBJC_METH_VAR_TYPE_26", i32 0, i32 0), i8* bitcast ({ i32, i32, [12 x %struct._objc_method] }* @"\01l_OBJC_$_INSTANCE_METHODS_Hi" to i8*), i8* getelementptr inbounds ([2 x i8]* @"\01L_OBJC_METH_VAR_TYPE_27", i32 0, i32 0), i8* getelementptr inbounds ([14 x i8]* @"\01L_OBJC_METH_VAR_NAME_28", i32 0, i32 0), i8* getelementptr inbounds ([2 x i8]* @"\01L_OBJC_METH_VAR_TYPE_29", i32 0, i32 0), i8* bitcast ({ i32, i32, [2 x %struct._ivar_t] }* @"\01l_OBJC_$_INSTANCE_VARIABLES_Hi" to i8*), i8* getelementptr inbounds ([7 x i8]* @"\01L_OBJC_PROP_NAME_ATTR_", i32 0, i32 0), i8* getelementptr inbounds ([11 x i8]* @"\01L_OBJC_PROP_NAME_ATTR_30", i32 0, i32 0), i8* getelementptr inbounds ([13 x i8]* @"\01L_OBJC_PROP_NAME_ATTR_31", i32 0, i32 0), i8* getelementptr inbounds ([22 x i8]* @"\01L_OBJC_PROP_NAME_ATTR_32", i32 0, i32 0), i8* bitcast ({ i32, i32, [2 x %struct._prop_t] }* @"\01l_OBJC_$_PROP_LIST_Hi" to i8*), i8* bitcast ([1 x i8*]* @"\01L_OBJC_LABEL_CLASS_$" to i8*)], section "llvm.metadata" define internal %0* @"\01-[Hi components:splitInto:]"(%1* nocapture %self, i8* nocapture %_cmd, %2* %s, %2* %delimiter) optsize ssp uwtable { %1 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_", align 8, !invariant.load !4 %2 = bitcast %2* %s to i8* %3 = tail call %0* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to %0* (i8*, i8*, %2*)*)(i8* %2, i8* %1, %2* %delimiter) optsize ret %0* %3 } declare i8* @objc_msgSend(i8*, i8*, ...) nonlazybind define internal %0* @"\01-[Hi lines:]"(%1* %self, i8* nocapture %_cmd, %2* %s) optsize ssp uwtable { %1 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_2", align 8, !invariant.load !4 %2 = bitcast %1* %self to i8* %3 = tail call %0* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to %0* (i8*, i8*, %2*, %2*)*)(i8* %2, i8* %1, %2* %s, %2* bitcast (%struct.NSConstantString* @_unnamed_cfstring_ to %2*)) optsize ret %0* %3 } define internal i32 @"\01-[Hi double:]"(%1* nocapture %self, i8* nocapture %_cmd, i32 %input) nounwind readnone optsize ssp uwtable { %1 = shl nsw i32 %input, 1 ret i32 %1 } define internal i32 @"\01-[Hi mulByAddition:factor:]"(%1* nocapture %self, i8* nocapture %_cmd, i32 %input, i32 %lfactor) nounwind readnone optsize ssp uwtable { %1 = icmp sgt i32 %lfactor, 0 br i1 %1, label %.lr.ph, label %4 .lr.ph: ; preds = %0 %2 = mul i32 %lfactor, %lfactor %3 = add i32 %2, %input br label %4 ; <label>:4 ; preds = %.lr.ph, %0 %.0.lcssa = phi i32 [ %3, %.lr.ph ], [ %input, %0 ] ret i32 %.0.lcssa } define internal i32 @"\01-[Hi mulByAddition:]"(%1* %self, i8* nocapture %_cmd, i32 %input) optsize ssp uwtable { %1 = load i64* @"OBJC_IVAR_$_Hi.factor", align 8, !invariant.load !4 %2 = bitcast %1* %self to i8* %3 = getelementptr inbounds i8* %2, i64 %1 %4 = bitcast i8* %3 to i32* %5 = load i32* %4, align 4, !tbaa !5 %6 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_4", align 8, !invariant.load !4 %7 = tail call i32 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i32 (i8*, i8*, i32, i32)*)(i8* %2, i8* %6, i32 %input, i32 %5) optsize ret i32 %7 } define internal %3* @"\01-[Hi mulNSNumberBy3:]"(%1* nocapture %self, i8* nocapture %_cmd, %3* %num) optsize ssp uwtable { %1 = load %struct._class_t** @"\01L_OBJC_CLASSLIST_REFERENCES_$_", align 8 %2 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_6", align 8, !invariant.load !4 %3 = bitcast %struct._class_t* %1 to i8* %4 = tail call %3* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to %3* (i8*, i8*, i32)*)(i8* %3, i8* %2, i32 3) optsize %5 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_8", align 8, !invariant.load !4 %6 = bitcast %3* %num to i8* %7 = tail call i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, %3*)*)(i8* %6, i8* %5, %3* %4) optsize %8 = bitcast i8* %7 to %3* ret %3* %8 } define internal %3* @"\01-[Hi makeNumber:]"(%1* nocapture %self, i8* nocapture %_cmd, i32 %a) optsize ssp uwtable { %1 = load %struct._class_t** @"\01L_OBJC_CLASSLIST_REFERENCES_$_", align 8 %2 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_6", align 8, !invariant.load !4 %3 = bitcast %struct._class_t* %1 to i8* %4 = tail call %3* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to %3* (i8*, i8*, i32)*)(i8* %3, i8* %2, i32 %a) optsize ret %3* %4 } define internal %3* @"\01-[Hi makeNumber3]"(%1* nocapture %self, i8* nocapture %_cmd) optsize ssp uwtable { %1 = load %struct._class_t** @"\01L_OBJC_CLASSLIST_REFERENCES_$_", align 8 %2 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_6", align 8, !invariant.load !4 %3 = bitcast %struct._class_t* %1 to i8* %4 = tail call %3* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to %3* (i8*, i8*, i32)*)(i8* %3, i8* %2, i32 3) optsize ret %3* %4 } define internal i32 @"\01-[Hi factor]"(%1* nocapture %self, i8* nocapture %_cmd) nounwind readonly optsize ssp uwtable { %1 = load i64* @"OBJC_IVAR_$_Hi.factor", align 8, !invariant.load !4 %2 = bitcast %1* %self to i8* %3 = getelementptr inbounds i8* %2, i64 %1 %4 = bitcast i8* %3 to i32* %5 = load atomic i32* %4 unordered, align 4 ret i32 %5 } define internal void @"\01-[Hi setFactor:]"(%1* nocapture %self, i8* nocapture %_cmd, i32 %factor) nounwind optsize ssp uwtable { %1 = load i64* @"OBJC_IVAR_$_Hi.factor", align 8, !invariant.load !4 %2 = bitcast %1* %self to i8* %3 = getelementptr inbounds i8* %2, i64 %1 %4 = bitcast i8* %3 to i32* store atomic i32 %factor, i32* %4 unordered, align 4 ret void } define internal i8* @"\01-[Hi someProperty]"(%1* nocapture %self, i8* nocapture %_cmd) nounwind readonly optsize ssp uwtable { %1 = load i64* @"OBJC_IVAR_$_Hi._someProperty", align 8, !invariant.load !4 %2 = bitcast %1* %self to i8* %3 = getelementptr inbounds i8* %2, i64 %1 %4 = bitcast i8* %3 to i8** %5 = load i8** %4, align 8, !tbaa !6 ret i8* %5 } define internal void @"\01-[Hi setSomeProperty:]"(%1* %self, i8* %_cmd, i8* %someProperty) optsize ssp uwtable { %1 = bitcast %1* %self to i8* %2 = load i64* @"OBJC_IVAR_$_Hi._someProperty", align 8, !invariant.load !4 tail call void @objc_setProperty_nonatomic(i8* %1, i8* %_cmd, i8* %someProperty, i64 %2) optsize ret void } declare void @objc_setProperty_nonatomic(i8*, i8*, i8*, i64) !llvm.module.flags = !{!0, !1, !2, !3} !0 = metadata !{i32 1, metadata !"Objective-C Version", i32 2} !1 = metadata !{i32 1, metadata !"Objective-C Image Info Version", i32 0} !2 = metadata !{i32 1, metadata !"Objective-C Image Info Section", metadata !"__DATA, __objc_imageinfo, regular, no_dead_strip"} !3 = metadata !{i32 4, metadata !"Objective-C Garbage Collection", i32 0} !4 = metadata !{} !5 = metadata !{metadata !"int", metadata !6} !6 = metadata !{metadata !"omnipotent char", metadata !7} !7 = metadata !{metadata !"Simple C/C++ TBAA"}
mpw/Objective-Smalltalk
2,002
ObjSTNative/test-compiles/function-passing-block.s
.section __TEXT,__text,regular,pure_instructions .build_version macos, 12, 3 sdk_version 12, 3 .globl _bfn ; -- Begin function bfn .p2align 2 _bfn: ; @bfn .cfi_startproc ; %bb.0: sub sp, sp, #32 stp x29, x30, [sp, #16] ; 16-byte Folded Spill add x29, sp, #16 .cfi_def_cfa w29, 16 .cfi_offset w30, -8 .cfi_offset w29, -16 stur w0, [x29, #-4] adrp x0, ___block_literal_global@PAGE add x0, x0, ___block_literal_global@PAGEOFF bl _fn ldp x29, x30, [sp, #16] ; 16-byte Folded Reload add sp, sp, #32 ret .cfi_endproc ; -- End function .p2align 2 ; -- Begin function __bfn_block_invoke ___bfn_block_invoke: ; @__bfn_block_invoke .cfi_startproc ; %bb.0: sub sp, sp, #32 .cfi_def_cfa_offset 32 mov x8, x0 str x8, [sp, #24] str w1, [sp, #20] str x0, [sp, #8] ldr w8, [sp, #20] add w0, w8, #3 add sp, sp, #32 ret .cfi_endproc ; -- End function .section __TEXT,__cstring,cstring_literals l_.str: ; @.str .asciz "i12@?0i8" .private_extern "___block_descriptor_32_e8_i12?0i8l" ; @"__block_descriptor_32_e8_i12\01?0i8l" .section __DATA,__const .globl "___block_descriptor_32_e8_i12?0i8l" .weak_def_can_be_hidden "___block_descriptor_32_e8_i12?0i8l" .p2align 3 "___block_descriptor_32_e8_i12?0i8l": .quad 0 ; 0x0 .quad 32 ; 0x20 .quad l_.str .quad 0 .p2align 3 ; @__block_literal_global ___block_literal_global: .quad __NSConcreteGlobalBlock .long 1342177280 ; 0x50000000 .long 0 ; 0x0 .quad ___bfn_block_invoke .quad "___block_descriptor_32_e8_i12?0i8l" .section __DATA,__objc_imageinfo,regular,no_dead_strip L_OBJC_IMAGE_INFO: .long 0 .long 64 .subsections_via_symbols
mpw/Objective-Smalltalk
4,299
ObjSTNative/test-compiles/method-returning-arg-category.s
; ModuleID = 'method-returning-arg-category.m' target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" target triple = "x86_64-apple-macosx10.8.0" %0 = type opaque %struct._class_t = type { %struct._class_t*, %struct._class_t*, %struct._objc_cache*, i8* (i8*, i8*)**, %struct._class_ro_t* } %struct._objc_cache = type opaque %struct._class_ro_t = type { i32, i32, i32, i8*, i8*, %struct.__method_list_t*, %struct._objc_protocol_list*, %struct._ivar_list_t*, i8*, %struct._prop_list_t* } %struct.__method_list_t = type { i32, i32, [0 x %struct._objc_method] } %struct._objc_method = type { i8*, i8*, i8* } %struct._objc_protocol_list = type { i64, [0 x %struct._protocol_t*] } %struct._protocol_t = type { i8*, i8*, %struct._objc_protocol_list*, %struct.__method_list_t*, %struct.__method_list_t*, %struct.__method_list_t*, %struct.__method_list_t*, %struct._prop_list_t*, i32, i32, i8** } %struct._prop_list_t = type { i32, i32, [0 x %struct._prop_t] } %struct._prop_t = type { i8*, i8* } %struct._ivar_list_t = type { i32, i32, [0 x %struct._ivar_t] } %struct._ivar_t = type { i64*, i8*, i8*, i32, i32 } %struct._category_t = type { i8*, %struct._class_t*, %struct.__method_list_t*, %struct.__method_list_t*, %struct._objc_protocol_list*, %struct._prop_list_t* } @"\01L_OBJC_CLASS_NAME_" = internal global [6 x i8] c"empty\00", section "__TEXT,__objc_classname,cstring_literals", align 1 @"OBJC_CLASS_$_NSObject" = external global %struct._class_t @"\01L_OBJC_METH_VAR_NAME_" = internal global [7 x i8] c"empty:\00", section "__TEXT,__objc_methname,cstring_literals", align 1 @"\01L_OBJC_METH_VAR_TYPE_" = internal global [11 x i8] c"@24@0:8@16\00", section "__TEXT,__objc_methtype,cstring_literals", align 1 @"\01l_OBJC_$_CATEGORY_INSTANCE_METHODS_NSObject_$_empty" = internal global { i32, i32, [1 x %struct._objc_method] } { i32 24, i32 1, [1 x %struct._objc_method] [%struct._objc_method { i8* getelementptr inbounds ([7 x i8]* @"\01L_OBJC_METH_VAR_NAME_", i32 0, i32 0), i8* getelementptr inbounds ([11 x i8]* @"\01L_OBJC_METH_VAR_TYPE_", i32 0, i32 0), i8* bitcast (i8* (%0*, i8*, i8*)* @"\01-[NSObject(empty) empty:]" to i8*) }] }, section "__DATA, __objc_const", align 8 @"\01l_OBJC_$_CATEGORY_NSObject_$_empty" = internal global %struct._category_t { i8* getelementptr inbounds ([6 x i8]* @"\01L_OBJC_CLASS_NAME_", i32 0, i32 0), %struct._class_t* @"OBJC_CLASS_$_NSObject", %struct.__method_list_t* bitcast ({ i32, i32, [1 x %struct._objc_method] }* @"\01l_OBJC_$_CATEGORY_INSTANCE_METHODS_NSObject_$_empty" to %struct.__method_list_t*), %struct.__method_list_t* null, %struct._objc_protocol_list* null, %struct._prop_list_t* null }, section "__DATA, __objc_const", align 8 @"\01L_OBJC_LABEL_CATEGORY_$" = internal global [1 x i8*] [i8* bitcast (%struct._category_t* @"\01l_OBJC_$_CATEGORY_NSObject_$_empty" to i8*)], section "__DATA, __objc_catlist, regular, no_dead_strip", align 8 @llvm.used = appending global [6 x i8*] [i8* getelementptr inbounds ([6 x i8]* @"\01L_OBJC_CLASS_NAME_", i32 0, i32 0), i8* getelementptr inbounds ([7 x i8]* @"\01L_OBJC_METH_VAR_NAME_", i32 0, i32 0), i8* getelementptr inbounds ([11 x i8]* @"\01L_OBJC_METH_VAR_TYPE_", i32 0, i32 0), i8* bitcast ({ i32, i32, [1 x %struct._objc_method] }* @"\01l_OBJC_$_CATEGORY_INSTANCE_METHODS_NSObject_$_empty" to i8*), i8* bitcast (%struct._category_t* @"\01l_OBJC_$_CATEGORY_NSObject_$_empty" to i8*), i8* bitcast ([1 x i8*]* @"\01L_OBJC_LABEL_CATEGORY_$" to i8*)], section "llvm.metadata" define internal i8* @"\01-[NSObject(empty) empty:]"(%0* %self, i8* %_cmd, i8* %arg) uwtable ssp { %1 = alloca %0*, align 8 %2 = alloca i8*, align 8 %3 = alloca i8*, align 8 store %0* %self, %0** %1, align 8 store i8* %_cmd, i8** %2, align 8 store i8* %arg, i8** %3, align 8 %4 = load i8** %3, align 8 ret i8* %4 } !llvm.module.flags = !{!0, !1, !2, !3} !0 = metadata !{i32 1, metadata !"Objective-C Version", i32 2} !1 = metadata !{i32 1, metadata !"Objective-C Image Info Version", i32 0} !2 = metadata !{i32 1, metadata !"Objective-C Image Info Section", metadata !"__DATA, __objc_imageinfo, regular, no_dead_strip"} !3 = metadata !{i32 4, metadata !"Objective-C Garbage Collection", i32 0}
mpw/Objective-Smalltalk
3,261
ObjSTNative/test-compiles/class-with-method-arm64.s
.section __TEXT,__text,regular,pure_instructions .build_version macos, 11, 0 sdk_version 11, 0 .p2align 2 ; -- Begin function -[Hi components:splitInto:] "-[Hi components:splitInto:]": ; @"\01-[Hi components:splitInto:]" .cfi_startproc ; %bb.0: sub sp, sp, #48 ; =48 stp x29, x30, [sp, #32] ; 16-byte Folded Spill add x29, sp, #32 ; =32 .cfi_def_cfa w29, 16 .cfi_offset w30, -8 .cfi_offset w29, -16 str x0, [x29, #-8] str x1, [sp, #16] str x2, [sp, #8] str x3, [sp] ldr x0, [sp, #8] ldr x2, [sp] adrp x8, _OBJC_SELECTOR_REFERENCES_@PAGE add x8, x8, _OBJC_SELECTOR_REFERENCES_@PAGEOFF ldr x1, [x8] bl _objc_msgSend ldp x29, x30, [sp, #32] ; 16-byte Folded Reload add sp, sp, #48 ; =48 ret .cfi_endproc ; -- End function .section __TEXT,__objc_methname,cstring_literals l_OBJC_METH_VAR_NAME_: ; @OBJC_METH_VAR_NAME_ .asciz "componentsSeparatedByString:" .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip .p2align 3 ; @OBJC_SELECTOR_REFERENCES_ _OBJC_SELECTOR_REFERENCES_: .quad l_OBJC_METH_VAR_NAME_ .section __TEXT,__objc_classname,cstring_literals l_OBJC_CLASS_NAME_: ; @OBJC_CLASS_NAME_ .asciz "Hi" .section __DATA,__objc_const .p2align 3 ; @"_OBJC_METACLASS_RO_$_Hi" __OBJC_METACLASS_RO_$_Hi: .long 1 ; 0x1 .long 40 ; 0x28 .long 40 ; 0x28 .space 4 .quad 0 .quad l_OBJC_CLASS_NAME_ .quad 0 .quad 0 .quad 0 .quad 0 .quad 0 .section __DATA,__objc_data .globl _OBJC_METACLASS_$_Hi ; @"OBJC_METACLASS_$_Hi" .p2align 3 _OBJC_METACLASS_$_Hi: .quad _OBJC_METACLASS_$_NSObject .quad _OBJC_METACLASS_$_NSObject .quad __objc_empty_cache .quad 0 .quad __OBJC_METACLASS_RO_$_Hi .section __TEXT,__objc_methname,cstring_literals l_OBJC_METH_VAR_NAME_.1: ; @OBJC_METH_VAR_NAME_.1 .asciz "components:splitInto:" .section __TEXT,__objc_methtype,cstring_literals l_OBJC_METH_VAR_TYPE_: ; @OBJC_METH_VAR_TYPE_ .asciz "@32@0:8@16@24" .section __DATA,__objc_const .p2align 3 ; @"_OBJC_$_INSTANCE_METHODS_Hi" __OBJC_$_INSTANCE_METHODS_Hi: .long 24 ; 0x18 .long 1 ; 0x1 .quad l_OBJC_METH_VAR_NAME_.1 .quad l_OBJC_METH_VAR_TYPE_ .quad "-[Hi components:splitInto:]" .p2align 3 ; @"_OBJC_CLASS_RO_$_Hi" __OBJC_CLASS_RO_$_Hi: .long 0 ; 0x0 .long 8 ; 0x8 .long 8 ; 0x8 .space 4 .quad 0 .quad l_OBJC_CLASS_NAME_ .quad __OBJC_$_INSTANCE_METHODS_Hi .quad 0 .quad 0 .quad 0 .quad 0 .section __DATA,__objc_data .globl _OBJC_CLASS_$_Hi ; @"OBJC_CLASS_$_Hi" .p2align 3 _OBJC_CLASS_$_Hi: .quad _OBJC_METACLASS_$_Hi .quad _OBJC_CLASS_$_NSObject .quad __objc_empty_cache .quad 0 .quad __OBJC_CLASS_RO_$_Hi .section __DATA,__objc_classlist,regular,no_dead_strip .p2align 3 ; @"OBJC_LABEL_CLASS_$" l_OBJC_LABEL_CLASS_$: .quad _OBJC_CLASS_$_Hi .section __DATA,__objc_imageinfo,regular,no_dead_strip L_OBJC_IMAGE_INFO: .long 0 .long 64 .subsections_via_symbols
mpw/Objective-Smalltalk
1,910
ObjSTNative/test-compiles/empty-class-arm64.s
.section __TEXT,__text,regular,pure_instructions .build_version macos, 11, 0 sdk_version 11, 0 .section __TEXT,__objc_classname,cstring_literals l_OBJC_CLASS_NAME_: ; @OBJC_CLASS_NAME_ .asciz "EmptyCodeGenTestClass01" .section __DATA,__objc_const .p2align 3 ; @"_OBJC_METACLASS_RO_$_EmptyCodeGenTestClass01" __OBJC_METACLASS_RO_$_EmptyCodeGenTestClass01: .long 1 ; 0x1 .long 40 ; 0x28 .long 40 ; 0x28 .space 4 .quad 0 .quad l_OBJC_CLASS_NAME_ .quad 0 .quad 0 .quad 0 .quad 0 .quad 0 .section __DATA,__objc_data .globl _OBJC_METACLASS_$_EmptyCodeGenTestClass01 ; @"OBJC_METACLASS_$_EmptyCodeGenTestClass01" .p2align 3 _OBJC_METACLASS_$_EmptyCodeGenTestClass01: .quad _OBJC_METACLASS_$_NSObject .quad _OBJC_METACLASS_$_NSObject .quad __objc_empty_cache .quad 0 .quad __OBJC_METACLASS_RO_$_EmptyCodeGenTestClass01 .section __DATA,__objc_const .p2align 3 ; @"_OBJC_CLASS_RO_$_EmptyCodeGenTestClass01" __OBJC_CLASS_RO_$_EmptyCodeGenTestClass01: .long 0 ; 0x0 .long 8 ; 0x8 .long 8 ; 0x8 .space 4 .quad 0 .quad l_OBJC_CLASS_NAME_ .quad 0 .quad 0 .quad 0 .quad 0 .quad 0 .section __DATA,__objc_data .globl _OBJC_CLASS_$_EmptyCodeGenTestClass01 ; @"OBJC_CLASS_$_EmptyCodeGenTestClass01" .p2align 3 _OBJC_CLASS_$_EmptyCodeGenTestClass01: .quad _OBJC_METACLASS_$_EmptyCodeGenTestClass01 .quad _OBJC_CLASS_$_NSObject .quad __objc_empty_cache .quad 0 .quad __OBJC_CLASS_RO_$_EmptyCodeGenTestClass01 .section __DATA,__objc_classlist,regular,no_dead_strip .p2align 3 ; @"OBJC_LABEL_CLASS_$" l_OBJC_LABEL_CLASS_$: .quad _OBJC_CLASS_$_EmptyCodeGenTestClass01 .section __DATA,__objc_imageinfo,regular,no_dead_strip L_OBJC_IMAGE_INFO: .long 0 .long 64 .subsections_via_symbols
mpw/Objective-Smalltalk
3,649
ObjSTNative/test-compiles/another-empty-class.s
; ModuleID = 'another-empty-class.m' target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" target triple = "x86_64-apple-macosx10.9.0" %struct._objc_cache = type opaque %struct._class_t = type { %struct._class_t*, %struct._class_t*, %struct._objc_cache*, i8* (i8*, i8*)**, %struct._class_ro_t* } %struct._class_ro_t = type { i32, i32, i32, i8*, i8*, %struct.__method_list_t*, %struct._objc_protocol_list*, %struct._ivar_list_t*, i8*, %struct._prop_list_t* } %struct.__method_list_t = type { i32, i32, [0 x %struct._objc_method] } %struct._objc_method = type { i8*, i8*, i8* } %struct._objc_protocol_list = type { i64, [0 x %struct._protocol_t*] } %struct._protocol_t = type { i8*, i8*, %struct._objc_protocol_list*, %struct.__method_list_t*, %struct.__method_list_t*, %struct.__method_list_t*, %struct.__method_list_t*, %struct._prop_list_t*, i32, i32, i8** } %struct._prop_list_t = type { i32, i32, [0 x %struct._prop_t] } %struct._prop_t = type { i8*, i8* } %struct._ivar_list_t = type { i32, i32, [0 x %struct._ivar_t] } %struct._ivar_t = type { i64*, i8*, i8*, i32, i32 } @_objc_empty_cache = external global %struct._objc_cache @_objc_empty_vtable = external global i8* (i8*, i8*)* @"OBJC_METACLASS_$_NSObject" = external global %struct._class_t @"\01L_OBJC_CLASS_NAME_" = internal global [3 x i8] c"Hi\00", section "__TEXT,__objc_classname,cstring_literals", align 1 @"\01l_OBJC_METACLASS_RO_$_Hi" = internal global %struct._class_ro_t { i32 1, i32 40, i32 40, i8* null, i8* getelementptr inbounds ([3 x i8]* @"\01L_OBJC_CLASS_NAME_", i32 0, i32 0), %struct.__method_list_t* null, %struct._objc_protocol_list* null, %struct._ivar_list_t* null, i8* null, %struct._prop_list_t* null }, section "__DATA, __objc_const", align 8 @"OBJC_METACLASS_$_Hi" = global %struct._class_t { %struct._class_t* @"OBJC_METACLASS_$_NSObject", %struct._class_t* @"OBJC_METACLASS_$_NSObject", %struct._objc_cache* @_objc_empty_cache, i8* (i8*, i8*)** @_objc_empty_vtable, %struct._class_ro_t* @"\01l_OBJC_METACLASS_RO_$_Hi" }, section "__DATA, __objc_data", align 8 @"OBJC_CLASS_$_NSObject" = external global %struct._class_t @"\01l_OBJC_CLASS_RO_$_Hi" = internal global %struct._class_ro_t { i32 0, i32 8, i32 8, i8* null, i8* getelementptr inbounds ([3 x i8]* @"\01L_OBJC_CLASS_NAME_", i32 0, i32 0), %struct.__method_list_t* null, %struct._objc_protocol_list* null, %struct._ivar_list_t* null, i8* null, %struct._prop_list_t* null }, section "__DATA, __objc_const", align 8 @"OBJC_CLASS_$_Hi" = global %struct._class_t { %struct._class_t* @"OBJC_METACLASS_$_Hi", %struct._class_t* @"OBJC_CLASS_$_NSObject", %struct._objc_cache* @_objc_empty_cache, i8* (i8*, i8*)** @_objc_empty_vtable, %struct._class_ro_t* @"\01l_OBJC_CLASS_RO_$_Hi" }, section "__DATA, __objc_data", align 8 @"\01L_OBJC_LABEL_CLASS_$" = internal global [1 x i8*] [i8* bitcast (%struct._class_t* @"OBJC_CLASS_$_Hi" to i8*)], section "__DATA, __objc_classlist, regular, no_dead_strip", align 8 @llvm.used = appending global [2 x i8*] [i8* getelementptr inbounds ([3 x i8]* @"\01L_OBJC_CLASS_NAME_", i32 0, i32 0), i8* bitcast ([1 x i8*]* @"\01L_OBJC_LABEL_CLASS_$" to i8*)], section "llvm.metadata" !llvm.module.flags = !{!0, !1, !2, !3} !0 = metadata !{i32 1, metadata !"Objective-C Version", i32 2} !1 = metadata !{i32 1, metadata !"Objective-C Image Info Version", i32 0} !2 = metadata !{i32 1, metadata !"Objective-C Image Info Section", metadata !"__DATA, __objc_imageinfo, regular, no_dead_strip"} !3 = metadata !{i32 4, metadata !"Objective-C Garbage Collection", i32 0}
mpw/Objective-Smalltalk
1,598
ObjSTNative/test-compiles/method-returning-arg-category.s.s
.section __TEXT,__text,regular,pure_instructions .align 4, 0x90 "-[NSObject(empty) empty:]": ## @"\01-[NSObject(empty) empty:]" .cfi_startproc ## BB#0: movq %rdi, -8(%rsp) movq %rsi, -16(%rsp) movq %rdx, -24(%rsp) movq %rdx, %rax ret .cfi_endproc .section __TEXT,__objc_classname,cstring_literals L_OBJC_CLASS_NAME_: ## @"\01L_OBJC_CLASS_NAME_" .asciz "empty" .section __TEXT,__objc_methname,cstring_literals L_OBJC_METH_VAR_NAME_: ## @"\01L_OBJC_METH_VAR_NAME_" .asciz "empty:" .section __TEXT,__objc_methtype,cstring_literals L_OBJC_METH_VAR_TYPE_: ## @"\01L_OBJC_METH_VAR_TYPE_" .asciz "@24@0:8@16" .section __DATA,__objc_const .align 3 ## @"\01l_OBJC_$_CATEGORY_INSTANCE_METHODS_NSObject_$_empty" l_OBJC_$_CATEGORY_INSTANCE_METHODS_NSObject_$_empty: .long 24 ## 0x18 .long 1 ## 0x1 .quad L_OBJC_METH_VAR_NAME_ .quad L_OBJC_METH_VAR_TYPE_ .quad "-[NSObject(empty) empty:]" .align 3 ## @"\01l_OBJC_$_CATEGORY_NSObject_$_empty" l_OBJC_$_CATEGORY_NSObject_$_empty: .quad L_OBJC_CLASS_NAME_ .quad _OBJC_CLASS_$_NSObject .quad l_OBJC_$_CATEGORY_INSTANCE_METHODS_NSObject_$_empty .quad 0 .quad 0 .quad 0 .section __DATA,__objc_catlist,regular,no_dead_strip .align 3 ## @"\01L_OBJC_LABEL_CATEGORY_$" L_OBJC_LABEL_CATEGORY_$: .quad l_OBJC_$_CATEGORY_NSObject_$_empty .section __DATA,__objc_imageinfo,regular,no_dead_strip L_OBJC_IMAGE_INFO: .long 0 .long 0 .subsections_via_symbols
mpw/Objective-Smalltalk
6,030
ObjSTNative/test-compiles/class-with-method.s
; ModuleID = 'class-with-method.m' target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" target triple = "x86_64-apple-macosx10.8.0" %0 = type opaque %1 = type opaque %2 = type opaque %struct._objc_cache = type opaque %struct._class_t = type { %struct._class_t*, %struct._class_t*, %struct._objc_cache*, i8* (i8*, i8*)**, %struct._class_ro_t* } %struct._class_ro_t = type { i32, i32, i32, i8*, i8*, %struct.__method_list_t*, %struct._objc_protocol_list*, %struct._ivar_list_t*, i8*, %struct._prop_list_t* } %struct.__method_list_t = type { i32, i32, [0 x %struct._objc_method] } %struct._objc_method = type { i8*, i8*, i8* } %struct._objc_protocol_list = type { i64, [0 x %struct._protocol_t*] } %struct._protocol_t = type { i8*, i8*, %struct._objc_protocol_list*, %struct.__method_list_t*, %struct.__method_list_t*, %struct.__method_list_t*, %struct.__method_list_t*, %struct._prop_list_t*, i32, i32, i8** } %struct._prop_list_t = type { i32, i32, [0 x %struct._prop_t] } %struct._prop_t = type { i8*, i8* } %struct._ivar_list_t = type { i32, i32, [0 x %struct._ivar_t] } %struct._ivar_t = type { i64*, i8*, i8*, i32, i32 } @"\01L_OBJC_METH_VAR_NAME_" = internal global [29 x i8] c"componentsSeparatedByString:\00", section "__TEXT,__objc_methname,cstring_literals", align 1 @"\01L_OBJC_SELECTOR_REFERENCES_" = internal global i8* getelementptr inbounds ([29 x i8]* @"\01L_OBJC_METH_VAR_NAME_", i32 0, i32 0), section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" @_objc_empty_cache = external global %struct._objc_cache @_objc_empty_vtable = external global i8* (i8*, i8*)* @"OBJC_METACLASS_$_NSObject" = external global %struct._class_t @"\01L_OBJC_CLASS_NAME_" = internal global [3 x i8] c"Hi\00", section "__TEXT,__objc_classname,cstring_literals", align 1 @"\01l_OBJC_METACLASS_RO_$_Hi" = internal global %struct._class_ro_t { i32 1, i32 40, i32 40, i8* null, i8* getelementptr inbounds ([3 x i8]* @"\01L_OBJC_CLASS_NAME_", i32 0, i32 0), %struct.__method_list_t* null, %struct._objc_protocol_list* null, %struct._ivar_list_t* null, i8* null, %struct._prop_list_t* null }, section "__DATA, __objc_const", align 8 @"OBJC_METACLASS_$_Hi" = global %struct._class_t { %struct._class_t* @"OBJC_METACLASS_$_NSObject", %struct._class_t* @"OBJC_METACLASS_$_NSObject", %struct._objc_cache* @_objc_empty_cache, i8* (i8*, i8*)** @_objc_empty_vtable, %struct._class_ro_t* @"\01l_OBJC_METACLASS_RO_$_Hi" }, section "__DATA, __objc_data", align 8 @"OBJC_CLASS_$_NSObject" = external global %struct._class_t @"\01L_OBJC_METH_VAR_NAME_1" = internal global [22 x i8] c"components:splitInto:\00", section "__TEXT,__objc_methname,cstring_literals", align 1 @"\01L_OBJC_METH_VAR_TYPE_" = internal global [14 x i8] c"@32@0:8@16@24\00", section "__TEXT,__objc_methtype,cstring_literals", align 1 @"\01l_OBJC_$_INSTANCE_METHODS_Hi" = internal global { i32, i32, [1 x %struct._objc_method] } { i32 24, i32 1, [1 x %struct._objc_method] [%struct._objc_method { i8* getelementptr inbounds ([22 x i8]* @"\01L_OBJC_METH_VAR_NAME_1", i32 0, i32 0), i8* getelementptr inbounds ([14 x i8]* @"\01L_OBJC_METH_VAR_TYPE_", i32 0, i32 0), i8* bitcast (%0* (%1*, i8*, %2*, %2*)* @"\01-[Hi components:splitInto:]" to i8*) }] }, section "__DATA, __objc_const", align 8 @"\01l_OBJC_CLASS_RO_$_Hi" = internal global %struct._class_ro_t { i32 0, i32 8, i32 8, i8* null, i8* getelementptr inbounds ([3 x i8]* @"\01L_OBJC_CLASS_NAME_", i32 0, i32 0), %struct.__method_list_t* bitcast ({ i32, i32, [1 x %struct._objc_method] }* @"\01l_OBJC_$_INSTANCE_METHODS_Hi" to %struct.__method_list_t*), %struct._objc_protocol_list* null, %struct._ivar_list_t* null, i8* null, %struct._prop_list_t* null }, section "__DATA, __objc_const", align 8 @"OBJC_CLASS_$_Hi" = global %struct._class_t { %struct._class_t* @"OBJC_METACLASS_$_Hi", %struct._class_t* @"OBJC_CLASS_$_NSObject", %struct._objc_cache* @_objc_empty_cache, i8* (i8*, i8*)** @_objc_empty_vtable, %struct._class_ro_t* @"\01l_OBJC_CLASS_RO_$_Hi" }, section "__DATA, __objc_data", align 8 @"\01L_OBJC_LABEL_CLASS_$" = internal global [1 x i8*] [i8* bitcast (%struct._class_t* @"OBJC_CLASS_$_Hi" to i8*)], section "__DATA, __objc_classlist, regular, no_dead_strip", align 8 @llvm.used = appending global [7 x i8*] [i8* getelementptr inbounds ([29 x i8]* @"\01L_OBJC_METH_VAR_NAME_", i32 0, i32 0), i8* bitcast (i8** @"\01L_OBJC_SELECTOR_REFERENCES_" to i8*), i8* getelementptr inbounds ([3 x i8]* @"\01L_OBJC_CLASS_NAME_", i32 0, i32 0), i8* getelementptr inbounds ([22 x i8]* @"\01L_OBJC_METH_VAR_NAME_1", i32 0, i32 0), i8* getelementptr inbounds ([14 x i8]* @"\01L_OBJC_METH_VAR_TYPE_", i32 0, i32 0), i8* bitcast ({ i32, i32, [1 x %struct._objc_method] }* @"\01l_OBJC_$_INSTANCE_METHODS_Hi" to i8*), i8* bitcast ([1 x i8*]* @"\01L_OBJC_LABEL_CLASS_$" to i8*)], section "llvm.metadata" define internal %0* @"\01-[Hi components:splitInto:]"(%1* %self, i8* %_cmd, %2* %s, %2* %delimiter) uwtable ssp { %1 = alloca %1*, align 8 %2 = alloca i8*, align 8 %3 = alloca %2*, align 8 %4 = alloca %2*, align 8 store %1* %self, %1** %1, align 8 store i8* %_cmd, i8** %2, align 8 store %2* %s, %2** %3, align 8 store %2* %delimiter, %2** %4, align 8 %5 = load %2** %3, align 8 %6 = load %2** %4, align 8 %7 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_", !invariant.load !4 %8 = bitcast %2* %5 to i8* %9 = call %0* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to %0* (i8*, i8*, %2*)*)(i8* %8, i8* %7, %2* %6) ret %0* %9 } declare i8* @objc_msgSend(i8*, i8*, ...) nonlazybind !llvm.module.flags = !{!0, !1, !2, !3} !0 = metadata !{i32 1, metadata !"Objective-C Version", i32 2} !1 = metadata !{i32 1, metadata !"Objective-C Image Info Version", i32 0} !2 = metadata !{i32 1, metadata !"Objective-C Image Info Section", metadata !"__DATA, __objc_imageinfo, regular, no_dead_strip"} !3 = metadata !{i32 4, metadata !"Objective-C Garbage Collection", i32 0} !4 = metadata !{}
mpw/Objective-Smalltalk
23,447
ObjSTNative/test-compiles/class-with-methods.s
; ModuleID = 'class-with-methods.m' target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" target triple = "x86_64-apple-macosx10.9.0" %0 = type opaque %1 = type opaque %2 = type opaque %3 = type opaque %struct.NSConstantString = type { i32*, i32, i8*, i64 } %struct._class_t = type { %struct._class_t*, %struct._class_t*, %struct._objc_cache*, i8* (i8*, i8*)**, %struct._class_ro_t* } %struct._objc_cache = type opaque %struct._class_ro_t = type { i32, i32, i32, i8*, i8*, %struct.__method_list_t*, %struct._objc_protocol_list*, %struct._ivar_list_t*, i8*, %struct._prop_list_t* } %struct.__method_list_t = type { i32, i32, [0 x %struct._objc_method] } %struct._objc_method = type { i8*, i8*, i8* } %struct._objc_protocol_list = type { i64, [0 x %struct._protocol_t*] } %struct._protocol_t = type { i8*, i8*, %struct._objc_protocol_list*, %struct.__method_list_t*, %struct.__method_list_t*, %struct.__method_list_t*, %struct.__method_list_t*, %struct._prop_list_t*, i32, i32, i8** } %struct._prop_list_t = type { i32, i32, [0 x %struct._prop_t] } %struct._prop_t = type { i8*, i8* } %struct._ivar_list_t = type { i32, i32, [0 x %struct._ivar_t] } %struct._ivar_t = type { i64*, i8*, i8*, i32, i32 } @"\01L_OBJC_METH_VAR_NAME_" = internal global [29 x i8] c"componentsSeparatedByString:\00", section "__TEXT,__objc_methname,cstring_literals", align 1 @"\01L_OBJC_SELECTOR_REFERENCES_" = internal externally_initialized global i8* getelementptr inbounds ([29 x i8]* @"\01L_OBJC_METH_VAR_NAME_", i64 0, i64 0), section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" @__CFConstantStringClassReference = external global [0 x i32] @.str = linker_private unnamed_addr constant [2 x i8] c"\0A\00", align 1 @_unnamed_cfstring_ = private constant %struct.NSConstantString { i32* getelementptr inbounds ([0 x i32]* @__CFConstantStringClassReference, i32 0, i32 0), i32 1992, i8* getelementptr inbounds ([2 x i8]* @.str, i32 0, i32 0), i64 1 }, section "__DATA,__cfstring" @"\01L_OBJC_METH_VAR_NAME_1" = internal global [22 x i8] c"components:splitInto:\00", section "__TEXT,__objc_methname,cstring_literals", align 1 @"\01L_OBJC_SELECTOR_REFERENCES_2" = internal externally_initialized global i8* getelementptr inbounds ([22 x i8]* @"\01L_OBJC_METH_VAR_NAME_1", i64 0, i64 0), section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" @"OBJC_IVAR_$_Hi.factor" = global i64 8, section "__DATA, __objc_ivar", align 8 @"\01L_OBJC_METH_VAR_NAME_3" = internal global [22 x i8] c"mulByAddition:factor:\00", section "__TEXT,__objc_methname,cstring_literals", align 1 @"\01L_OBJC_SELECTOR_REFERENCES_4" = internal externally_initialized global i8* getelementptr inbounds ([22 x i8]* @"\01L_OBJC_METH_VAR_NAME_3", i64 0, i64 0), section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" @"OBJC_CLASS_$_NSNumber" = external global %struct._class_t @"\01L_OBJC_CLASSLIST_REFERENCES_$_" = internal global %struct._class_t* @"OBJC_CLASS_$_NSNumber", section "__DATA, __objc_classrefs, regular, no_dead_strip", align 8 @"\01L_OBJC_METH_VAR_NAME_5" = internal global [15 x i8] c"numberWithInt:\00", section "__TEXT,__objc_methname,cstring_literals", align 1 @"\01L_OBJC_SELECTOR_REFERENCES_6" = internal externally_initialized global i8* getelementptr inbounds ([15 x i8]* @"\01L_OBJC_METH_VAR_NAME_5", i64 0, i64 0), section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" @"\01L_OBJC_METH_VAR_NAME_7" = internal global [5 x i8] c"mul:\00", section "__TEXT,__objc_methname,cstring_literals", align 1 @"\01L_OBJC_SELECTOR_REFERENCES_8" = internal externally_initialized global i8* getelementptr inbounds ([5 x i8]* @"\01L_OBJC_METH_VAR_NAME_7", i64 0, i64 0), section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" @"OBJC_IVAR_$_Hi._someProperty" = hidden global i64 16, section "__DATA, __objc_ivar", align 8 @_objc_empty_cache = external global %struct._objc_cache @_objc_empty_vtable = external global i8* (i8*, i8*)* @"OBJC_METACLASS_$_NSObject" = external global %struct._class_t @"\01L_OBJC_CLASS_NAME_" = internal global [3 x i8] c"Hi\00", section "__TEXT,__objc_classname,cstring_literals", align 1 @"\01l_OBJC_METACLASS_RO_$_Hi" = internal global %struct._class_ro_t { i32 1, i32 40, i32 40, i8* null, i8* getelementptr inbounds ([3 x i8]* @"\01L_OBJC_CLASS_NAME_", i32 0, i32 0), %struct.__method_list_t* null, %struct._objc_protocol_list* null, %struct._ivar_list_t* null, i8* null, %struct._prop_list_t* null }, section "__DATA, __objc_const", align 8 @"OBJC_METACLASS_$_Hi" = global %struct._class_t { %struct._class_t* @"OBJC_METACLASS_$_NSObject", %struct._class_t* @"OBJC_METACLASS_$_NSObject", %struct._objc_cache* @_objc_empty_cache, i8* (i8*, i8*)** @_objc_empty_vtable, %struct._class_ro_t* @"\01l_OBJC_METACLASS_RO_$_Hi" }, section "__DATA, __objc_data", align 8 @"OBJC_CLASS_$_NSObject" = external global %struct._class_t @"\01L_OBJC_METH_VAR_TYPE_" = internal global [14 x i8] c"@32@0:8@16@24\00", section "__TEXT,__objc_methtype,cstring_literals", align 1 @"\01L_OBJC_METH_VAR_NAME_9" = internal global [7 x i8] c"lines:\00", section "__TEXT,__objc_methname,cstring_literals", align 1 @"\01L_OBJC_METH_VAR_TYPE_10" = internal global [11 x i8] c"@24@0:8@16\00", section "__TEXT,__objc_methtype,cstring_literals", align 1 @"\01L_OBJC_METH_VAR_NAME_11" = internal global [8 x i8] c"double:\00", section "__TEXT,__objc_methname,cstring_literals", align 1 @"\01L_OBJC_METH_VAR_TYPE_12" = internal global [11 x i8] c"i20@0:8i16\00", section "__TEXT,__objc_methtype,cstring_literals", align 1 @"\01L_OBJC_METH_VAR_TYPE_13" = internal global [14 x i8] c"i24@0:8i16i20\00", section "__TEXT,__objc_methtype,cstring_literals", align 1 @"\01L_OBJC_METH_VAR_NAME_14" = internal global [15 x i8] c"mulByAddition:\00", section "__TEXT,__objc_methname,cstring_literals", align 1 @"\01L_OBJC_METH_VAR_NAME_15" = internal global [16 x i8] c"mulNSNumberBy3:\00", section "__TEXT,__objc_methname,cstring_literals", align 1 @"\01L_OBJC_METH_VAR_NAME_16" = internal global [12 x i8] c"makeNumber:\00", section "__TEXT,__objc_methname,cstring_literals", align 1 @"\01L_OBJC_METH_VAR_TYPE_17" = internal global [11 x i8] c"@20@0:8i16\00", section "__TEXT,__objc_methtype,cstring_literals", align 1 @"\01L_OBJC_METH_VAR_NAME_18" = internal global [12 x i8] c"makeNumber3\00", section "__TEXT,__objc_methname,cstring_literals", align 1 @"\01L_OBJC_METH_VAR_TYPE_19" = internal global [8 x i8] c"@16@0:8\00", section "__TEXT,__objc_methtype,cstring_literals", align 1 @"\01L_OBJC_METH_VAR_NAME_20" = internal global [7 x i8] c"factor\00", section "__TEXT,__objc_methname,cstring_literals", align 1 @"\01L_OBJC_METH_VAR_TYPE_21" = internal global [8 x i8] c"i16@0:8\00", section "__TEXT,__objc_methtype,cstring_literals", align 1 @"\01L_OBJC_METH_VAR_NAME_22" = internal global [11 x i8] c"setFactor:\00", section "__TEXT,__objc_methname,cstring_literals", align 1 @"\01L_OBJC_METH_VAR_TYPE_23" = internal global [11 x i8] c"v20@0:8i16\00", section "__TEXT,__objc_methtype,cstring_literals", align 1 @"\01L_OBJC_METH_VAR_NAME_24" = internal global [13 x i8] c"someProperty\00", section "__TEXT,__objc_methname,cstring_literals", align 1 @"\01L_OBJC_METH_VAR_NAME_25" = internal global [17 x i8] c"setSomeProperty:\00", section "__TEXT,__objc_methname,cstring_literals", align 1 @"\01L_OBJC_METH_VAR_TYPE_26" = internal global [11 x i8] c"v24@0:8@16\00", section "__TEXT,__objc_methtype,cstring_literals", align 1 @"\01l_OBJC_$_INSTANCE_METHODS_Hi" = internal global { i32, i32, [12 x %struct._objc_method] } { i32 24, i32 12, [12 x %struct._objc_method] [%struct._objc_method { i8* getelementptr inbounds ([22 x i8]* @"\01L_OBJC_METH_VAR_NAME_1", i32 0, i32 0), i8* getelementptr inbounds ([14 x i8]* @"\01L_OBJC_METH_VAR_TYPE_", i32 0, i32 0), i8* bitcast (%0* (%1*, i8*, %2*, %2*)* @"\01-[Hi components:splitInto:]" to i8*) }, %struct._objc_method { i8* getelementptr inbounds ([7 x i8]* @"\01L_OBJC_METH_VAR_NAME_9", i32 0, i32 0), i8* getelementptr inbounds ([11 x i8]* @"\01L_OBJC_METH_VAR_TYPE_10", i32 0, i32 0), i8* bitcast (%0* (%1*, i8*, %2*)* @"\01-[Hi lines:]" to i8*) }, %struct._objc_method { i8* getelementptr inbounds ([8 x i8]* @"\01L_OBJC_METH_VAR_NAME_11", i32 0, i32 0), i8* getelementptr inbounds ([11 x i8]* @"\01L_OBJC_METH_VAR_TYPE_12", i32 0, i32 0), i8* bitcast (i32 (%1*, i8*, i32)* @"\01-[Hi double:]" to i8*) }, %struct._objc_method { i8* getelementptr inbounds ([22 x i8]* @"\01L_OBJC_METH_VAR_NAME_3", i32 0, i32 0), i8* getelementptr inbounds ([14 x i8]* @"\01L_OBJC_METH_VAR_TYPE_13", i32 0, i32 0), i8* bitcast (i32 (%1*, i8*, i32, i32)* @"\01-[Hi mulByAddition:factor:]" to i8*) }, %struct._objc_method { i8* getelementptr inbounds ([15 x i8]* @"\01L_OBJC_METH_VAR_NAME_14", i32 0, i32 0), i8* getelementptr inbounds ([11 x i8]* @"\01L_OBJC_METH_VAR_TYPE_12", i32 0, i32 0), i8* bitcast (i32 (%1*, i8*, i32)* @"\01-[Hi mulByAddition:]" to i8*) }, %struct._objc_method { i8* getelementptr inbounds ([16 x i8]* @"\01L_OBJC_METH_VAR_NAME_15", i32 0, i32 0), i8* getelementptr inbounds ([11 x i8]* @"\01L_OBJC_METH_VAR_TYPE_10", i32 0, i32 0), i8* bitcast (%3* (%1*, i8*, %3*)* @"\01-[Hi mulNSNumberBy3:]" to i8*) }, %struct._objc_method { i8* getelementptr inbounds ([12 x i8]* @"\01L_OBJC_METH_VAR_NAME_16", i32 0, i32 0), i8* getelementptr inbounds ([11 x i8]* @"\01L_OBJC_METH_VAR_TYPE_17", i32 0, i32 0), i8* bitcast (%3* (%1*, i8*, i32)* @"\01-[Hi makeNumber:]" to i8*) }, %struct._objc_method { i8* getelementptr inbounds ([12 x i8]* @"\01L_OBJC_METH_VAR_NAME_18", i32 0, i32 0), i8* getelementptr inbounds ([8 x i8]* @"\01L_OBJC_METH_VAR_TYPE_19", i32 0, i32 0), i8* bitcast (%3* (%1*, i8*)* @"\01-[Hi makeNumber3]" to i8*) }, %struct._objc_method { i8* getelementptr inbounds ([7 x i8]* @"\01L_OBJC_METH_VAR_NAME_20", i32 0, i32 0), i8* getelementptr inbounds ([8 x i8]* @"\01L_OBJC_METH_VAR_TYPE_21", i32 0, i32 0), i8* bitcast (i32 (%1*, i8*)* @"\01-[Hi factor]" to i8*) }, %struct._objc_method { i8* getelementptr inbounds ([11 x i8]* @"\01L_OBJC_METH_VAR_NAME_22", i32 0, i32 0), i8* getelementptr inbounds ([11 x i8]* @"\01L_OBJC_METH_VAR_TYPE_23", i32 0, i32 0), i8* bitcast (void (%1*, i8*, i32)* @"\01-[Hi setFactor:]" to i8*) }, %struct._objc_method { i8* getelementptr inbounds ([13 x i8]* @"\01L_OBJC_METH_VAR_NAME_24", i32 0, i32 0), i8* getelementptr inbounds ([8 x i8]* @"\01L_OBJC_METH_VAR_TYPE_19", i32 0, i32 0), i8* bitcast (i8* (%1*, i8*)* @"\01-[Hi someProperty]" to i8*) }, %struct._objc_method { i8* getelementptr inbounds ([17 x i8]* @"\01L_OBJC_METH_VAR_NAME_25", i32 0, i32 0), i8* getelementptr inbounds ([11 x i8]* @"\01L_OBJC_METH_VAR_TYPE_26", i32 0, i32 0), i8* bitcast (void (%1*, i8*, i8*)* @"\01-[Hi setSomeProperty:]" to i8*) }] }, section "__DATA, __objc_const", align 8 @"\01L_OBJC_METH_VAR_TYPE_27" = internal global [2 x i8] c"i\00", section "__TEXT,__objc_methtype,cstring_literals", align 1 @"\01L_OBJC_METH_VAR_NAME_28" = internal global [14 x i8] c"_someProperty\00", section "__TEXT,__objc_methname,cstring_literals", align 1 @"\01L_OBJC_METH_VAR_TYPE_29" = internal global [2 x i8] c"@\00", section "__TEXT,__objc_methtype,cstring_literals", align 1 @"\01l_OBJC_$_INSTANCE_VARIABLES_Hi" = internal global { i32, i32, [2 x %struct._ivar_t] } { i32 32, i32 2, [2 x %struct._ivar_t] [%struct._ivar_t { i64* @"OBJC_IVAR_$_Hi.factor", i8* getelementptr inbounds ([7 x i8]* @"\01L_OBJC_METH_VAR_NAME_20", i32 0, i32 0), i8* getelementptr inbounds ([2 x i8]* @"\01L_OBJC_METH_VAR_TYPE_27", i32 0, i32 0), i32 2, i32 4 }, %struct._ivar_t { i64* @"OBJC_IVAR_$_Hi._someProperty", i8* getelementptr inbounds ([14 x i8]* @"\01L_OBJC_METH_VAR_NAME_28", i32 0, i32 0), i8* getelementptr inbounds ([2 x i8]* @"\01L_OBJC_METH_VAR_TYPE_29", i32 0, i32 0), i32 3, i32 8 }] }, section "__DATA, __objc_const", align 8 @"\01L_OBJC_PROP_NAME_ATTR_" = internal global [7 x i8] c"factor\00", section "__TEXT,__cstring,cstring_literals", align 1 @"\01L_OBJC_PROP_NAME_ATTR_30" = internal global [11 x i8] c"Ti,Vfactor\00", section "__TEXT,__cstring,cstring_literals", align 1 @"\01L_OBJC_PROP_NAME_ATTR_31" = internal global [13 x i8] c"someProperty\00", section "__TEXT,__cstring,cstring_literals", align 1 @"\01L_OBJC_PROP_NAME_ATTR_32" = internal global [22 x i8] c"T@,&,N,V_someProperty\00", section "__TEXT,__cstring,cstring_literals", align 1 @"\01l_OBJC_$_PROP_LIST_Hi" = internal global { i32, i32, [2 x %struct._prop_t] } { i32 16, i32 2, [2 x %struct._prop_t] [%struct._prop_t { i8* getelementptr inbounds ([7 x i8]* @"\01L_OBJC_PROP_NAME_ATTR_", i32 0, i32 0), i8* getelementptr inbounds ([11 x i8]* @"\01L_OBJC_PROP_NAME_ATTR_30", i32 0, i32 0) }, %struct._prop_t { i8* getelementptr inbounds ([13 x i8]* @"\01L_OBJC_PROP_NAME_ATTR_31", i32 0, i32 0), i8* getelementptr inbounds ([22 x i8]* @"\01L_OBJC_PROP_NAME_ATTR_32", i32 0, i32 0) }] }, section "__DATA, __objc_const", align 8 @"\01l_OBJC_CLASS_RO_$_Hi" = internal global %struct._class_ro_t { i32 0, i32 8, i32 24, i8* null, i8* getelementptr inbounds ([3 x i8]* @"\01L_OBJC_CLASS_NAME_", i32 0, i32 0), %struct.__method_list_t* bitcast ({ i32, i32, [12 x %struct._objc_method] }* @"\01l_OBJC_$_INSTANCE_METHODS_Hi" to %struct.__method_list_t*), %struct._objc_protocol_list* null, %struct._ivar_list_t* bitcast ({ i32, i32, [2 x %struct._ivar_t] }* @"\01l_OBJC_$_INSTANCE_VARIABLES_Hi" to %struct._ivar_list_t*), i8* null, %struct._prop_list_t* bitcast ({ i32, i32, [2 x %struct._prop_t] }* @"\01l_OBJC_$_PROP_LIST_Hi" to %struct._prop_list_t*) }, section "__DATA, __objc_const", align 8 @"OBJC_CLASS_$_Hi" = global %struct._class_t { %struct._class_t* @"OBJC_METACLASS_$_Hi", %struct._class_t* @"OBJC_CLASS_$_NSObject", %struct._objc_cache* @_objc_empty_cache, i8* (i8*, i8*)** @_objc_empty_vtable, %struct._class_ro_t* @"\01l_OBJC_CLASS_RO_$_Hi" }, section "__DATA, __objc_data", align 8 @"\01L_OBJC_LABEL_CLASS_$" = internal global [1 x i8*] [i8* bitcast (%struct._class_t* @"OBJC_CLASS_$_Hi" to i8*)], section "__DATA, __objc_classlist, regular, no_dead_strip", align 8 @llvm.used = appending global [42 x i8*] [i8* getelementptr inbounds ([29 x i8]* @"\01L_OBJC_METH_VAR_NAME_", i32 0, i32 0), i8* bitcast (i8** @"\01L_OBJC_SELECTOR_REFERENCES_" to i8*), i8* getelementptr inbounds ([22 x i8]* @"\01L_OBJC_METH_VAR_NAME_1", i32 0, i32 0), i8* bitcast (i8** @"\01L_OBJC_SELECTOR_REFERENCES_2" to i8*), i8* getelementptr inbounds ([22 x i8]* @"\01L_OBJC_METH_VAR_NAME_3", i32 0, i32 0), i8* bitcast (i8** @"\01L_OBJC_SELECTOR_REFERENCES_4" to i8*), i8* bitcast (%struct._class_t** @"\01L_OBJC_CLASSLIST_REFERENCES_$_" to i8*), i8* getelementptr inbounds ([15 x i8]* @"\01L_OBJC_METH_VAR_NAME_5", i32 0, i32 0), i8* bitcast (i8** @"\01L_OBJC_SELECTOR_REFERENCES_6" to i8*), i8* getelementptr inbounds ([5 x i8]* @"\01L_OBJC_METH_VAR_NAME_7", i32 0, i32 0), i8* bitcast (i8** @"\01L_OBJC_SELECTOR_REFERENCES_8" to i8*), i8* getelementptr inbounds ([3 x i8]* @"\01L_OBJC_CLASS_NAME_", i32 0, i32 0), i8* getelementptr inbounds ([14 x i8]* @"\01L_OBJC_METH_VAR_TYPE_", i32 0, i32 0), i8* getelementptr inbounds ([7 x i8]* @"\01L_OBJC_METH_VAR_NAME_9", i32 0, i32 0), i8* getelementptr inbounds ([11 x i8]* @"\01L_OBJC_METH_VAR_TYPE_10", i32 0, i32 0), i8* getelementptr inbounds ([8 x i8]* @"\01L_OBJC_METH_VAR_NAME_11", i32 0, i32 0), i8* getelementptr inbounds ([11 x i8]* @"\01L_OBJC_METH_VAR_TYPE_12", i32 0, i32 0), i8* getelementptr inbounds ([14 x i8]* @"\01L_OBJC_METH_VAR_TYPE_13", i32 0, i32 0), i8* getelementptr inbounds ([15 x i8]* @"\01L_OBJC_METH_VAR_NAME_14", i32 0, i32 0), i8* getelementptr inbounds ([16 x i8]* @"\01L_OBJC_METH_VAR_NAME_15", i32 0, i32 0), i8* getelementptr inbounds ([12 x i8]* @"\01L_OBJC_METH_VAR_NAME_16", i32 0, i32 0), i8* getelementptr inbounds ([11 x i8]* @"\01L_OBJC_METH_VAR_TYPE_17", i32 0, i32 0), i8* getelementptr inbounds ([12 x i8]* @"\01L_OBJC_METH_VAR_NAME_18", i32 0, i32 0), i8* getelementptr inbounds ([8 x i8]* @"\01L_OBJC_METH_VAR_TYPE_19", i32 0, i32 0), i8* getelementptr inbounds ([7 x i8]* @"\01L_OBJC_METH_VAR_NAME_20", i32 0, i32 0), i8* getelementptr inbounds ([8 x i8]* @"\01L_OBJC_METH_VAR_TYPE_21", i32 0, i32 0), i8* getelementptr inbounds ([11 x i8]* @"\01L_OBJC_METH_VAR_NAME_22", i32 0, i32 0), i8* getelementptr inbounds ([11 x i8]* @"\01L_OBJC_METH_VAR_TYPE_23", i32 0, i32 0), i8* getelementptr inbounds ([13 x i8]* @"\01L_OBJC_METH_VAR_NAME_24", i32 0, i32 0), i8* getelementptr inbounds ([17 x i8]* @"\01L_OBJC_METH_VAR_NAME_25", i32 0, i32 0), i8* getelementptr inbounds ([11 x i8]* @"\01L_OBJC_METH_VAR_TYPE_26", i32 0, i32 0), i8* bitcast ({ i32, i32, [12 x %struct._objc_method] }* @"\01l_OBJC_$_INSTANCE_METHODS_Hi" to i8*), i8* getelementptr inbounds ([2 x i8]* @"\01L_OBJC_METH_VAR_TYPE_27", i32 0, i32 0), i8* getelementptr inbounds ([14 x i8]* @"\01L_OBJC_METH_VAR_NAME_28", i32 0, i32 0), i8* getelementptr inbounds ([2 x i8]* @"\01L_OBJC_METH_VAR_TYPE_29", i32 0, i32 0), i8* bitcast ({ i32, i32, [2 x %struct._ivar_t] }* @"\01l_OBJC_$_INSTANCE_VARIABLES_Hi" to i8*), i8* getelementptr inbounds ([7 x i8]* @"\01L_OBJC_PROP_NAME_ATTR_", i32 0, i32 0), i8* getelementptr inbounds ([11 x i8]* @"\01L_OBJC_PROP_NAME_ATTR_30", i32 0, i32 0), i8* getelementptr inbounds ([13 x i8]* @"\01L_OBJC_PROP_NAME_ATTR_31", i32 0, i32 0), i8* getelementptr inbounds ([22 x i8]* @"\01L_OBJC_PROP_NAME_ATTR_32", i32 0, i32 0), i8* bitcast ({ i32, i32, [2 x %struct._prop_t] }* @"\01l_OBJC_$_PROP_LIST_Hi" to i8*), i8* bitcast ([1 x i8*]* @"\01L_OBJC_LABEL_CLASS_$" to i8*)], section "llvm.metadata" define internal %0* @"\01-[Hi components:splitInto:]"(%1* nocapture %self, i8* nocapture %_cmd, %2* %s, %2* %delimiter) optsize ssp uwtable { %1 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_", align 8, !invariant.load !4 %2 = bitcast %2* %s to i8* %3 = tail call %0* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to %0* (i8*, i8*, %2*)*)(i8* %2, i8* %1, %2* %delimiter) optsize ret %0* %3 } declare i8* @objc_msgSend(i8*, i8*, ...) nonlazybind define internal %0* @"\01-[Hi lines:]"(%1* %self, i8* nocapture %_cmd, %2* %s) optsize ssp uwtable { %1 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_2", align 8, !invariant.load !4 %2 = bitcast %1* %self to i8* %3 = tail call %0* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to %0* (i8*, i8*, %2*, %2*)*)(i8* %2, i8* %1, %2* %s, %2* bitcast (%struct.NSConstantString* @_unnamed_cfstring_ to %2*)) optsize ret %0* %3 } define internal i32 @"\01-[Hi double:]"(%1* nocapture %self, i8* nocapture %_cmd, i32 %input) nounwind readnone optsize ssp uwtable { %1 = shl nsw i32 %input, 1 ret i32 %1 } define internal i32 @"\01-[Hi mulByAddition:factor:]"(%1* nocapture %self, i8* nocapture %_cmd, i32 %input, i32 %lfactor) nounwind readnone optsize ssp uwtable { %1 = icmp sgt i32 %lfactor, 0 br i1 %1, label %.lr.ph, label %4 .lr.ph: ; preds = %0 %2 = mul i32 %lfactor, %lfactor %3 = add i32 %2, %input br label %4 ; <label>:4 ; preds = %.lr.ph, %0 %.0.lcssa = phi i32 [ %3, %.lr.ph ], [ %input, %0 ] ret i32 %.0.lcssa } define internal i32 @"\01-[Hi mulByAddition:]"(%1* %self, i8* nocapture %_cmd, i32 %input) optsize ssp uwtable { %1 = load i64* @"OBJC_IVAR_$_Hi.factor", align 8, !invariant.load !4 %2 = bitcast %1* %self to i8* %3 = getelementptr inbounds i8* %2, i64 %1 %4 = bitcast i8* %3 to i32* %5 = load i32* %4, align 4, !tbaa !5 %6 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_4", align 8, !invariant.load !4 %7 = tail call i32 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i32 (i8*, i8*, i32, i32)*)(i8* %2, i8* %6, i32 %input, i32 %5) optsize ret i32 %7 } define internal %3* @"\01-[Hi mulNSNumberBy3:]"(%1* nocapture %self, i8* nocapture %_cmd, %3* %num) optsize ssp uwtable { %1 = load %struct._class_t** @"\01L_OBJC_CLASSLIST_REFERENCES_$_", align 8 %2 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_6", align 8, !invariant.load !4 %3 = bitcast %struct._class_t* %1 to i8* %4 = tail call %3* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to %3* (i8*, i8*, i32)*)(i8* %3, i8* %2, i32 3) optsize %5 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_8", align 8, !invariant.load !4 %6 = bitcast %3* %num to i8* %7 = tail call i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, %3*)*)(i8* %6, i8* %5, %3* %4) optsize %8 = bitcast i8* %7 to %3* ret %3* %8 } define internal %3* @"\01-[Hi makeNumber:]"(%1* nocapture %self, i8* nocapture %_cmd, i32 %a) optsize ssp uwtable { %1 = load %struct._class_t** @"\01L_OBJC_CLASSLIST_REFERENCES_$_", align 8 %2 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_6", align 8, !invariant.load !4 %3 = bitcast %struct._class_t* %1 to i8* %4 = tail call %3* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to %3* (i8*, i8*, i32)*)(i8* %3, i8* %2, i32 %a) optsize ret %3* %4 } define internal %3* @"\01-[Hi makeNumber3]"(%1* nocapture %self, i8* nocapture %_cmd) optsize ssp uwtable { %1 = load %struct._class_t** @"\01L_OBJC_CLASSLIST_REFERENCES_$_", align 8 %2 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_6", align 8, !invariant.load !4 %3 = bitcast %struct._class_t* %1 to i8* %4 = tail call %3* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to %3* (i8*, i8*, i32)*)(i8* %3, i8* %2, i32 3) optsize ret %3* %4 } define internal i32 @"\01-[Hi factor]"(%1* nocapture %self, i8* nocapture %_cmd) nounwind readonly optsize ssp uwtable { %1 = load i64* @"OBJC_IVAR_$_Hi.factor", align 8, !invariant.load !4 %2 = bitcast %1* %self to i8* %3 = getelementptr inbounds i8* %2, i64 %1 %4 = bitcast i8* %3 to i32* %5 = load atomic i32* %4 unordered, align 4 ret i32 %5 } define internal void @"\01-[Hi setFactor:]"(%1* nocapture %self, i8* nocapture %_cmd, i32 %factor) nounwind optsize ssp uwtable { %1 = load i64* @"OBJC_IVAR_$_Hi.factor", align 8, !invariant.load !4 %2 = bitcast %1* %self to i8* %3 = getelementptr inbounds i8* %2, i64 %1 %4 = bitcast i8* %3 to i32* store atomic i32 %factor, i32* %4 unordered, align 4 ret void } define internal i8* @"\01-[Hi someProperty]"(%1* nocapture %self, i8* nocapture %_cmd) nounwind readonly optsize ssp uwtable { %1 = load i64* @"OBJC_IVAR_$_Hi._someProperty", align 8, !invariant.load !4 %2 = bitcast %1* %self to i8* %3 = getelementptr inbounds i8* %2, i64 %1 %4 = bitcast i8* %3 to i8** %5 = load i8** %4, align 8, !tbaa !6 ret i8* %5 } define internal void @"\01-[Hi setSomeProperty:]"(%1* %self, i8* %_cmd, i8* %someProperty) optsize ssp uwtable { %1 = bitcast %1* %self to i8* %2 = load i64* @"OBJC_IVAR_$_Hi._someProperty", align 8, !invariant.load !4 tail call void @objc_setProperty_nonatomic(i8* %1, i8* %_cmd, i8* %someProperty, i64 %2) optsize ret void } declare void @objc_setProperty_nonatomic(i8*, i8*, i8*, i64) !llvm.module.flags = !{!0, !1, !2, !3} !0 = metadata !{i32 1, metadata !"Objective-C Version", i32 2} !1 = metadata !{i32 1, metadata !"Objective-C Image Info Version", i32 0} !2 = metadata !{i32 1, metadata !"Objective-C Image Info Section", metadata !"__DATA, __objc_imageinfo, regular, no_dead_strip"} !3 = metadata !{i32 4, metadata !"Objective-C Garbage Collection", i32 0} !4 = metadata !{} !5 = metadata !{metadata !"int", metadata !6} !6 = metadata !{metadata !"omnipotent char", metadata !7} !7 = metadata !{metadata !"Simple C/C++ TBAA"}
mpw/Objective-Smalltalk
1,261
ObjSTNative/test-compiles/use_class.s
.section __TEXT,__text,regular,pure_instructions .build_version macos, 12, 3 sdk_version 12, 3 .globl _functionThatReferencesClass ; -- Begin function functionThatReferencesClass .p2align 2 _functionThatReferencesClass: ; @functionThatReferencesClass .cfi_startproc ; %bb.0: stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill mov x29, sp .cfi_def_cfa w29, 16 .cfi_offset w30, -8 .cfi_offset w29, -16 adrp x8, _OBJC_CLASSLIST_REFERENCES_$_@PAGE ldr x0, [x8, _OBJC_CLASSLIST_REFERENCES_$_@PAGEOFF] bl _objc_opt_new adrp x8, _OBJC_CLASSLIST_REFERENCES_$_.1@PAGE ldr x0, [x8, _OBJC_CLASSLIST_REFERENCES_$_.1@PAGEOFF] bl _objc_opt_new ldp x29, x30, [sp], #16 ; 16-byte Folded Reload ret .cfi_endproc ; -- End function .section __DATA,__objc_classrefs,regular,no_dead_strip .p2align 3 ; @"OBJC_CLASSLIST_REFERENCES_$_" _OBJC_CLASSLIST_REFERENCES_$_: .quad _OBJC_CLASS_$_NSNumber .p2align 3 ; @"OBJC_CLASSLIST_REFERENCES_$_.1" _OBJC_CLASSLIST_REFERENCES_$_.1: .quad _OBJC_CLASS_$_NSObject .section __DATA,__objc_imageinfo,regular,no_dead_strip L_OBJC_IMAGE_INFO: .long 0 .long 64 .subsections_via_symbols
mpw/Objective-Smalltalk
17,921
ObjSTNative/test-compiles/class-with-methods-arm64.s
.section __TEXT,__text,regular,pure_instructions .build_version macos, 11, 0 sdk_version 11, 0 .p2align 2 ; -- Begin function -[Hi components:splitInto:] "-[Hi components:splitInto:]": ; @"\01-[Hi components:splitInto:]" .cfi_startproc ; %bb.0: sub sp, sp, #48 ; =48 stp x29, x30, [sp, #32] ; 16-byte Folded Spill add x29, sp, #32 ; =32 .cfi_def_cfa w29, 16 .cfi_offset w30, -8 .cfi_offset w29, -16 stur x0, [x29, #-8] str x1, [sp, #16] str x2, [sp, #8] str x3, [sp] ldr x0, [sp, #8] ldr x2, [sp] adrp x8, _OBJC_SELECTOR_REFERENCES_@PAGE add x8, x8, _OBJC_SELECTOR_REFERENCES_@PAGEOFF ldr x1, [x8] bl _objc_msgSend ldp x29, x30, [sp, #32] ; 16-byte Folded Reload add sp, sp, #48 ; =48 ret .cfi_endproc ; -- End function .p2align 2 ; -- Begin function -[Hi lines:] "-[Hi lines:]": ; @"\01-[Hi lines:]" .cfi_startproc ; %bb.0: sub sp, sp, #48 ; =48 stp x29, x30, [sp, #32] ; 16-byte Folded Spill add x29, sp, #32 ; =32 .cfi_def_cfa w29, 16 .cfi_offset w30, -8 .cfi_offset w29, -16 stur x0, [x29, #-8] str x1, [sp, #16] str x2, [sp, #8] ldur x0, [x29, #-8] ldr x2, [sp, #8] adrp x8, _OBJC_SELECTOR_REFERENCES_.2@PAGE add x8, x8, _OBJC_SELECTOR_REFERENCES_.2@PAGEOFF ldr x1, [x8] adrp x3, l__unnamed_cfstring_@PAGE add x3, x3, l__unnamed_cfstring_@PAGEOFF bl _objc_msgSend ldp x29, x30, [sp, #32] ; 16-byte Folded Reload add sp, sp, #48 ; =48 ret .cfi_endproc ; -- End function .p2align 2 ; -- Begin function -[Hi double:] "-[Hi double:]": ; @"\01-[Hi double:]" .cfi_startproc ; %bb.0: sub sp, sp, #32 ; =32 .cfi_def_cfa_offset 32 str x0, [sp, #24] str x1, [sp, #16] str w2, [sp, #12] ldr w8, [sp, #12] lsl w0, w8, #1 add sp, sp, #32 ; =32 ret .cfi_endproc ; -- End function .p2align 2 ; -- Begin function -[Hi mulByAddition:factor:] "-[Hi mulByAddition:factor:]": ; @"\01-[Hi mulByAddition:factor:]" .cfi_startproc ; %bb.0: sub sp, sp, #32 ; =32 .cfi_def_cfa_offset 32 str x0, [sp, #24] str x1, [sp, #16] str w2, [sp, #12] str w3, [sp, #8] str wzr, [sp, #4] LBB3_1: ; =>This Inner Loop Header: Depth=1 ldr w8, [sp, #4] ldr w9, [sp, #8] cmp w8, w9 b.ge LBB3_4 ; %bb.2: ; in Loop: Header=BB3_1 Depth=1 ldr w8, [sp, #8] ldr w9, [sp, #12] add w8, w9, w8 str w8, [sp, #12] ; %bb.3: ; in Loop: Header=BB3_1 Depth=1 ldr w8, [sp, #4] add w8, w8, #1 ; =1 str w8, [sp, #4] b LBB3_1 LBB3_4: ldr w0, [sp, #12] add sp, sp, #32 ; =32 ret .cfi_endproc ; -- End function .p2align 2 ; -- Begin function -[Hi mulByAddition:] "-[Hi mulByAddition:]": ; @"\01-[Hi mulByAddition:]" .cfi_startproc ; %bb.0: sub sp, sp, #48 ; =48 stp x29, x30, [sp, #32] ; 16-byte Folded Spill add x29, sp, #32 ; =32 .cfi_def_cfa w29, 16 .cfi_offset w30, -8 .cfi_offset w29, -16 stur x0, [x29, #-8] str x1, [sp, #16] str w2, [sp, #12] ldur x0, [x29, #-8] ldr w2, [sp, #12] ldur x8, [x29, #-8] ldr w3, [x8, #8] adrp x8, _OBJC_SELECTOR_REFERENCES_.4@PAGE add x8, x8, _OBJC_SELECTOR_REFERENCES_.4@PAGEOFF ldr x1, [x8] bl _objc_msgSend ldp x29, x30, [sp, #32] ; 16-byte Folded Reload add sp, sp, #48 ; =48 ret .cfi_endproc ; -- End function .p2align 2 ; -- Begin function -[Hi mulNSNumberBy3:] "-[Hi mulNSNumberBy3:]": ; @"\01-[Hi mulNSNumberBy3:]" .cfi_startproc ; %bb.0: sub sp, sp, #64 ; =64 stp x29, x30, [sp, #48] ; 16-byte Folded Spill add x29, sp, #48 ; =48 .cfi_def_cfa w29, 16 .cfi_offset w30, -8 .cfi_offset w29, -16 stur x0, [x29, #-8] stur x1, [x29, #-16] str x2, [sp, #24] ldr x0, [sp, #24] adrp x8, _OBJC_CLASSLIST_REFERENCES_$_@PAGE add x8, x8, _OBJC_CLASSLIST_REFERENCES_$_@PAGEOFF ldr x8, [x8] adrp x9, _OBJC_SELECTOR_REFERENCES_.6@PAGE add x9, x9, _OBJC_SELECTOR_REFERENCES_.6@PAGEOFF ldr x1, [x9] str x0, [sp, #16] ; 8-byte Folded Spill mov x0, x8 mov w2, #3 bl _objc_msgSend adrp x8, _OBJC_SELECTOR_REFERENCES_.8@PAGE add x8, x8, _OBJC_SELECTOR_REFERENCES_.8@PAGEOFF ldr x1, [x8] ldr x8, [sp, #16] ; 8-byte Folded Reload str x0, [sp, #8] ; 8-byte Folded Spill mov x0, x8 ldr x2, [sp, #8] ; 8-byte Folded Reload bl _objc_msgSend ldp x29, x30, [sp, #48] ; 16-byte Folded Reload add sp, sp, #64 ; =64 ret .cfi_endproc ; -- End function .p2align 2 ; -- Begin function -[Hi makeNumber:] "-[Hi makeNumber:]": ; @"\01-[Hi makeNumber:]" .cfi_startproc ; %bb.0: sub sp, sp, #48 ; =48 stp x29, x30, [sp, #32] ; 16-byte Folded Spill add x29, sp, #32 ; =32 .cfi_def_cfa w29, 16 .cfi_offset w30, -8 .cfi_offset w29, -16 stur x0, [x29, #-8] str x1, [sp, #16] str w2, [sp, #12] adrp x8, _OBJC_CLASSLIST_REFERENCES_$_@PAGE add x8, x8, _OBJC_CLASSLIST_REFERENCES_$_@PAGEOFF ldr x0, [x8] ldr w2, [sp, #12] adrp x8, _OBJC_SELECTOR_REFERENCES_.6@PAGE add x8, x8, _OBJC_SELECTOR_REFERENCES_.6@PAGEOFF ldr x1, [x8] bl _objc_msgSend ldp x29, x30, [sp, #32] ; 16-byte Folded Reload add sp, sp, #48 ; =48 ret .cfi_endproc ; -- End function .p2align 2 ; -- Begin function -[Hi makeNumber3] "-[Hi makeNumber3]": ; @"\01-[Hi makeNumber3]" .cfi_startproc ; %bb.0: sub sp, sp, #32 ; =32 stp x29, x30, [sp, #16] ; 16-byte Folded Spill add x29, sp, #16 ; =16 .cfi_def_cfa w29, 16 .cfi_offset w30, -8 .cfi_offset w29, -16 str x0, [sp, #8] str x1, [sp] adrp x8, _OBJC_CLASSLIST_REFERENCES_$_@PAGE add x8, x8, _OBJC_CLASSLIST_REFERENCES_$_@PAGEOFF ldr x0, [x8] adrp x8, _OBJC_SELECTOR_REFERENCES_.6@PAGE add x8, x8, _OBJC_SELECTOR_REFERENCES_.6@PAGEOFF ldr x1, [x8] mov w2, #3 bl _objc_msgSend ldp x29, x30, [sp, #16] ; 16-byte Folded Reload add sp, sp, #32 ; =32 ret .cfi_endproc ; -- End function .p2align 2 ; -- Begin function -[Hi factor] "-[Hi factor]": ; @"\01-[Hi factor]" .cfi_startproc ; %bb.0: sub sp, sp, #16 ; =16 .cfi_def_cfa_offset 16 str x0, [sp, #8] str x1, [sp] ldr x8, [sp, #8] ldr w0, [x8, #8] add sp, sp, #16 ; =16 ret .cfi_endproc ; -- End function .p2align 2 ; -- Begin function -[Hi setFactor:] "-[Hi setFactor:]": ; @"\01-[Hi setFactor:]" .cfi_startproc ; %bb.0: sub sp, sp, #32 ; =32 .cfi_def_cfa_offset 32 str x0, [sp, #24] str x1, [sp, #16] str w2, [sp, #12] ldr x8, [sp, #24] ldr w9, [sp, #12] str w9, [x8, #8] add sp, sp, #32 ; =32 ret .cfi_endproc ; -- End function .p2align 2 ; -- Begin function -[Hi someProperty] "-[Hi someProperty]": ; @"\01-[Hi someProperty]" .cfi_startproc ; %bb.0: sub sp, sp, #16 ; =16 .cfi_def_cfa_offset 16 str x0, [sp, #8] str x1, [sp] ldr x8, [sp, #8] ldr x0, [x8, #16] add sp, sp, #16 ; =16 ret .cfi_endproc ; -- End function .p2align 2 ; -- Begin function -[Hi setSomeProperty:] "-[Hi setSomeProperty:]": ; @"\01-[Hi setSomeProperty:]" .cfi_startproc ; %bb.0: sub sp, sp, #48 ; =48 stp x29, x30, [sp, #32] ; 16-byte Folded Spill add x29, sp, #32 ; =32 .cfi_def_cfa w29, 16 .cfi_offset w30, -8 .cfi_offset w29, -16 stur x0, [x29, #-8] str x1, [sp, #16] str x2, [sp, #8] ldr x1, [sp, #16] ldur x0, [x29, #-8] ldr x2, [sp, #8] mov x3, #16 bl _objc_setProperty_nonatomic ldp x29, x30, [sp, #32] ; 16-byte Folded Reload add sp, sp, #48 ; =48 ret .cfi_endproc ; -- End function .section __TEXT,__objc_methname,cstring_literals l_OBJC_METH_VAR_NAME_: ; @OBJC_METH_VAR_NAME_ .asciz "componentsSeparatedByString:" .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip .p2align 3 ; @OBJC_SELECTOR_REFERENCES_ _OBJC_SELECTOR_REFERENCES_: .quad l_OBJC_METH_VAR_NAME_ .section __TEXT,__cstring,cstring_literals l_.str: ; @.str .asciz "\n" .section __DATA,__cfstring .p2align 3 ; @_unnamed_cfstring_ l__unnamed_cfstring_: .quad ___CFConstantStringClassReference .long 1992 ; 0x7c8 .space 4 .quad l_.str .quad 1 ; 0x1 .section __TEXT,__objc_methname,cstring_literals l_OBJC_METH_VAR_NAME_.1: ; @OBJC_METH_VAR_NAME_.1 .asciz "components:splitInto:" .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip .p2align 3 ; @OBJC_SELECTOR_REFERENCES_.2 _OBJC_SELECTOR_REFERENCES_.2: .quad l_OBJC_METH_VAR_NAME_.1 .section __TEXT,__objc_methname,cstring_literals l_OBJC_METH_VAR_NAME_.3: ; @OBJC_METH_VAR_NAME_.3 .asciz "mulByAddition:factor:" .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip .p2align 3 ; @OBJC_SELECTOR_REFERENCES_.4 _OBJC_SELECTOR_REFERENCES_.4: .quad l_OBJC_METH_VAR_NAME_.3 .section __DATA,__objc_classrefs,regular,no_dead_strip .p2align 3 ; @"OBJC_CLASSLIST_REFERENCES_$_" _OBJC_CLASSLIST_REFERENCES_$_: .quad _OBJC_CLASS_$_NSNumber .section __TEXT,__objc_methname,cstring_literals l_OBJC_METH_VAR_NAME_.5: ; @OBJC_METH_VAR_NAME_.5 .asciz "numberWithInt:" .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip .p2align 3 ; @OBJC_SELECTOR_REFERENCES_.6 _OBJC_SELECTOR_REFERENCES_.6: .quad l_OBJC_METH_VAR_NAME_.5 .section __TEXT,__objc_methname,cstring_literals l_OBJC_METH_VAR_NAME_.7: ; @OBJC_METH_VAR_NAME_.7 .asciz "mul:" .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip .p2align 3 ; @OBJC_SELECTOR_REFERENCES_.8 _OBJC_SELECTOR_REFERENCES_.8: .quad l_OBJC_METH_VAR_NAME_.7 .section __TEXT,__objc_classname,cstring_literals l_OBJC_CLASS_NAME_: ; @OBJC_CLASS_NAME_ .asciz "Hi" .section __DATA,__objc_const .p2align 3 ; @"_OBJC_METACLASS_RO_$_Hi" __OBJC_METACLASS_RO_$_Hi: .long 1 ; 0x1 .long 40 ; 0x28 .long 40 ; 0x28 .space 4 .quad 0 .quad l_OBJC_CLASS_NAME_ .quad 0 .quad 0 .quad 0 .quad 0 .quad 0 .section __DATA,__objc_data .globl _OBJC_METACLASS_$_Hi ; @"OBJC_METACLASS_$_Hi" .p2align 3 _OBJC_METACLASS_$_Hi: .quad _OBJC_METACLASS_$_NSObject .quad _OBJC_METACLASS_$_NSObject .quad __objc_empty_cache .quad 0 .quad __OBJC_METACLASS_RO_$_Hi .section __TEXT,__objc_methtype,cstring_literals l_OBJC_METH_VAR_TYPE_: ; @OBJC_METH_VAR_TYPE_ .asciz "@32@0:8@16@24" .section __TEXT,__objc_methname,cstring_literals l_OBJC_METH_VAR_NAME_.9: ; @OBJC_METH_VAR_NAME_.9 .asciz "lines:" .section __TEXT,__objc_methtype,cstring_literals l_OBJC_METH_VAR_TYPE_.10: ; @OBJC_METH_VAR_TYPE_.10 .asciz "@24@0:8@16" .section __TEXT,__objc_methname,cstring_literals l_OBJC_METH_VAR_NAME_.11: ; @OBJC_METH_VAR_NAME_.11 .asciz "double:" .section __TEXT,__objc_methtype,cstring_literals l_OBJC_METH_VAR_TYPE_.12: ; @OBJC_METH_VAR_TYPE_.12 .asciz "i20@0:8i16" l_OBJC_METH_VAR_TYPE_.13: ; @OBJC_METH_VAR_TYPE_.13 .asciz "i24@0:8i16i20" .section __TEXT,__objc_methname,cstring_literals l_OBJC_METH_VAR_NAME_.14: ; @OBJC_METH_VAR_NAME_.14 .asciz "mulByAddition:" l_OBJC_METH_VAR_NAME_.15: ; @OBJC_METH_VAR_NAME_.15 .asciz "mulNSNumberBy3:" l_OBJC_METH_VAR_NAME_.16: ; @OBJC_METH_VAR_NAME_.16 .asciz "makeNumber:" .section __TEXT,__objc_methtype,cstring_literals l_OBJC_METH_VAR_TYPE_.17: ; @OBJC_METH_VAR_TYPE_.17 .asciz "@20@0:8i16" .section __TEXT,__objc_methname,cstring_literals l_OBJC_METH_VAR_NAME_.18: ; @OBJC_METH_VAR_NAME_.18 .asciz "makeNumber3" .section __TEXT,__objc_methtype,cstring_literals l_OBJC_METH_VAR_TYPE_.19: ; @OBJC_METH_VAR_TYPE_.19 .asciz "@16@0:8" .section __TEXT,__objc_methname,cstring_literals l_OBJC_METH_VAR_NAME_.20: ; @OBJC_METH_VAR_NAME_.20 .asciz "factor" .section __TEXT,__objc_methtype,cstring_literals l_OBJC_METH_VAR_TYPE_.21: ; @OBJC_METH_VAR_TYPE_.21 .asciz "i16@0:8" .section __TEXT,__objc_methname,cstring_literals l_OBJC_METH_VAR_NAME_.22: ; @OBJC_METH_VAR_NAME_.22 .asciz "setFactor:" .section __TEXT,__objc_methtype,cstring_literals l_OBJC_METH_VAR_TYPE_.23: ; @OBJC_METH_VAR_TYPE_.23 .asciz "v20@0:8i16" .section __TEXT,__objc_methname,cstring_literals l_OBJC_METH_VAR_NAME_.24: ; @OBJC_METH_VAR_NAME_.24 .asciz "someProperty" l_OBJC_METH_VAR_NAME_.25: ; @OBJC_METH_VAR_NAME_.25 .asciz "setSomeProperty:" .section __TEXT,__objc_methtype,cstring_literals l_OBJC_METH_VAR_TYPE_.26: ; @OBJC_METH_VAR_TYPE_.26 .asciz "v24@0:8@16" .section __DATA,__objc_const .p2align 3 ; @"_OBJC_$_INSTANCE_METHODS_Hi" __OBJC_$_INSTANCE_METHODS_Hi: .long 24 ; 0x18 .long 12 ; 0xc .quad l_OBJC_METH_VAR_NAME_.1 .quad l_OBJC_METH_VAR_TYPE_ .quad "-[Hi components:splitInto:]" .quad l_OBJC_METH_VAR_NAME_.9 .quad l_OBJC_METH_VAR_TYPE_.10 .quad "-[Hi lines:]" .quad l_OBJC_METH_VAR_NAME_.11 .quad l_OBJC_METH_VAR_TYPE_.12 .quad "-[Hi double:]" .quad l_OBJC_METH_VAR_NAME_.3 .quad l_OBJC_METH_VAR_TYPE_.13 .quad "-[Hi mulByAddition:factor:]" .quad l_OBJC_METH_VAR_NAME_.14 .quad l_OBJC_METH_VAR_TYPE_.12 .quad "-[Hi mulByAddition:]" .quad l_OBJC_METH_VAR_NAME_.15 .quad l_OBJC_METH_VAR_TYPE_.10 .quad "-[Hi mulNSNumberBy3:]" .quad l_OBJC_METH_VAR_NAME_.16 .quad l_OBJC_METH_VAR_TYPE_.17 .quad "-[Hi makeNumber:]" .quad l_OBJC_METH_VAR_NAME_.18 .quad l_OBJC_METH_VAR_TYPE_.19 .quad "-[Hi makeNumber3]" .quad l_OBJC_METH_VAR_NAME_.20 .quad l_OBJC_METH_VAR_TYPE_.21 .quad "-[Hi factor]" .quad l_OBJC_METH_VAR_NAME_.22 .quad l_OBJC_METH_VAR_TYPE_.23 .quad "-[Hi setFactor:]" .quad l_OBJC_METH_VAR_NAME_.24 .quad l_OBJC_METH_VAR_TYPE_.19 .quad "-[Hi someProperty]" .quad l_OBJC_METH_VAR_NAME_.25 .quad l_OBJC_METH_VAR_TYPE_.26 .quad "-[Hi setSomeProperty:]" .section __DATA,__objc_ivar .globl _OBJC_IVAR_$_Hi.factor ; @"OBJC_IVAR_$_Hi.factor" .p2align 2 _OBJC_IVAR_$_Hi.factor: .long 8 ; 0x8 .section __TEXT,__objc_methtype,cstring_literals l_OBJC_METH_VAR_TYPE_.27: ; @OBJC_METH_VAR_TYPE_.27 .asciz "i" .private_extern _OBJC_IVAR_$_Hi._someProperty ; @"OBJC_IVAR_$_Hi._someProperty" .section __DATA,__objc_ivar .globl _OBJC_IVAR_$_Hi._someProperty .p2align 2 _OBJC_IVAR_$_Hi._someProperty: .long 16 ; 0x10 .section __TEXT,__objc_methname,cstring_literals l_OBJC_METH_VAR_NAME_.28: ; @OBJC_METH_VAR_NAME_.28 .asciz "_someProperty" .section __TEXT,__objc_methtype,cstring_literals l_OBJC_METH_VAR_TYPE_.29: ; @OBJC_METH_VAR_TYPE_.29 .asciz "@" .section __DATA,__objc_const .p2align 3 ; @"_OBJC_$_INSTANCE_VARIABLES_Hi" __OBJC_$_INSTANCE_VARIABLES_Hi: .long 32 ; 0x20 .long 2 ; 0x2 .quad _OBJC_IVAR_$_Hi.factor .quad l_OBJC_METH_VAR_NAME_.20 .quad l_OBJC_METH_VAR_TYPE_.27 .long 2 ; 0x2 .long 4 ; 0x4 .quad _OBJC_IVAR_$_Hi._someProperty .quad l_OBJC_METH_VAR_NAME_.28 .quad l_OBJC_METH_VAR_TYPE_.29 .long 3 ; 0x3 .long 8 ; 0x8 .section __TEXT,__cstring,cstring_literals l_OBJC_PROP_NAME_ATTR_: ; @OBJC_PROP_NAME_ATTR_ .asciz "factor" l_OBJC_PROP_NAME_ATTR_.30: ; @OBJC_PROP_NAME_ATTR_.30 .asciz "Ti,Vfactor" l_OBJC_PROP_NAME_ATTR_.31: ; @OBJC_PROP_NAME_ATTR_.31 .asciz "someProperty" l_OBJC_PROP_NAME_ATTR_.32: ; @OBJC_PROP_NAME_ATTR_.32 .asciz "T@,&,N,V_someProperty" .section __DATA,__objc_const .p2align 3 ; @"_OBJC_$_PROP_LIST_Hi" __OBJC_$_PROP_LIST_Hi: .long 16 ; 0x10 .long 2 ; 0x2 .quad l_OBJC_PROP_NAME_ATTR_ .quad l_OBJC_PROP_NAME_ATTR_.30 .quad l_OBJC_PROP_NAME_ATTR_.31 .quad l_OBJC_PROP_NAME_ATTR_.32 .p2align 3 ; @"_OBJC_CLASS_RO_$_Hi" __OBJC_CLASS_RO_$_Hi: .long 0 ; 0x0 .long 8 ; 0x8 .long 24 ; 0x18 .space 4 .quad 0 .quad l_OBJC_CLASS_NAME_ .quad __OBJC_$_INSTANCE_METHODS_Hi .quad 0 .quad __OBJC_$_INSTANCE_VARIABLES_Hi .quad 0 .quad __OBJC_$_PROP_LIST_Hi .section __DATA,__objc_data .globl _OBJC_CLASS_$_Hi ; @"OBJC_CLASS_$_Hi" .p2align 3 _OBJC_CLASS_$_Hi: .quad _OBJC_METACLASS_$_Hi .quad _OBJC_CLASS_$_NSObject .quad __objc_empty_cache .quad 0 .quad __OBJC_CLASS_RO_$_Hi .section __DATA,__objc_classlist,regular,no_dead_strip .p2align 3 ; @"OBJC_LABEL_CLASS_$" l_OBJC_LABEL_CLASS_$: .quad _OBJC_CLASS_$_Hi .section __DATA,__objc_imageinfo,regular,no_dead_strip L_OBJC_IMAGE_INFO: .long 0 .long 64 .subsections_via_symbols
mpw/Objective-Smalltalk
2,785
ObjSTNative/test-compiles/empty-category.s
; ModuleID = 'empty-category.m' target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" target triple = "x86_64-apple-macosx10.8.0" %struct._class_t = type { %struct._class_t*, %struct._class_t*, %struct._objc_cache*, i8* (i8*, i8*)**, %struct._class_ro_t* } %struct._objc_cache = type opaque %struct._class_ro_t = type { i32, i32, i32, i8*, i8*, %struct.__method_list_t*, %struct._objc_protocol_list*, %struct._ivar_list_t*, i8*, %struct._prop_list_t* } %struct.__method_list_t = type { i32, i32, [0 x %struct._objc_method] } %struct._objc_method = type { i8*, i8*, i8* } %struct._objc_protocol_list = type { i64, [0 x %struct._protocol_t*] } %struct._protocol_t = type { i8*, i8*, %struct._objc_protocol_list*, %struct.__method_list_t*, %struct.__method_list_t*, %struct.__method_list_t*, %struct.__method_list_t*, %struct._prop_list_t*, i32, i32, i8** } %struct._prop_list_t = type { i32, i32, [0 x %struct._prop_t] } %struct._prop_t = type { i8*, i8* } %struct._ivar_list_t = type { i32, i32, [0 x %struct._ivar_t] } %struct._ivar_t = type { i64*, i8*, i8*, i32, i32 } %struct._category_t = type { i8*, %struct._class_t*, %struct.__method_list_t*, %struct.__method_list_t*, %struct._objc_protocol_list*, %struct._prop_list_t* } @"\01L_OBJC_CLASS_NAME_" = internal global [6 x i8] c"empty\00", section "__TEXT,__objc_classname,cstring_literals", align 1 @"OBJC_CLASS_$_NSObject" = external global %struct._class_t @"\01l_OBJC_$_CATEGORY_NSObject_$_empty" = internal global %struct._category_t { i8* getelementptr inbounds ([6 x i8]* @"\01L_OBJC_CLASS_NAME_", i32 0, i32 0), %struct._class_t* @"OBJC_CLASS_$_NSObject", %struct.__method_list_t* null, %struct.__method_list_t* null, %struct._objc_protocol_list* null, %struct._prop_list_t* null }, section "__DATA, __objc_const", align 8 @"\01L_OBJC_LABEL_CATEGORY_$" = internal global [1 x i8*] [i8* bitcast (%struct._category_t* @"\01l_OBJC_$_CATEGORY_NSObject_$_empty" to i8*)], section "__DATA, __objc_catlist, regular, no_dead_strip", align 8 @llvm.used = appending global [3 x i8*] [i8* getelementptr inbounds ([6 x i8]* @"\01L_OBJC_CLASS_NAME_", i32 0, i32 0), i8* bitcast (%struct._category_t* @"\01l_OBJC_$_CATEGORY_NSObject_$_empty" to i8*), i8* bitcast ([1 x i8*]* @"\01L_OBJC_LABEL_CATEGORY_$" to i8*)], section "llvm.metadata" !llvm.module.flags = !{!0, !1, !2, !3} !0 = metadata !{i32 1, metadata !"Objective-C Version", i32 2} !1 = metadata !{i32 1, metadata !"Objective-C Image Info Version", i32 0} !2 = metadata !{i32 1, metadata !"Objective-C Image Info Section", metadata !"__DATA, __objc_imageinfo, regular, no_dead_strip"} !3 = metadata !{i32 4, metadata !"Objective-C Garbage Collection", i32 0}
mpw/Objective-Smalltalk
1,837
ObjSTNative/test-compiles/method-returning-arg-category-arm64.s
.section __TEXT,__text,regular,pure_instructions .build_version macos, 11, 0 sdk_version 11, 0 .p2align 2 ; -- Begin function -[NSObject(empty) empty:] "-[NSObject(empty) empty:]": ; @"\01-[NSObject(empty) empty:]" .cfi_startproc ; %bb.0: sub sp, sp, #32 ; =32 .cfi_def_cfa_offset 32 str x0, [sp, #24] str x1, [sp, #16] str x2, [sp, #8] ldr x0, [sp, #8] add sp, sp, #32 ; =32 ret .cfi_endproc ; -- End function .section __TEXT,__objc_classname,cstring_literals l_OBJC_CLASS_NAME_: ; @OBJC_CLASS_NAME_ .asciz "empty" .section __TEXT,__objc_methname,cstring_literals l_OBJC_METH_VAR_NAME_: ; @OBJC_METH_VAR_NAME_ .asciz "empty:" .section __TEXT,__objc_methtype,cstring_literals l_OBJC_METH_VAR_TYPE_: ; @OBJC_METH_VAR_TYPE_ .asciz "@24@0:8@16" .section __DATA,__objc_const .p2align 3 ; @"_OBJC_$_CATEGORY_INSTANCE_METHODS_NSObject_$_empty" __OBJC_$_CATEGORY_INSTANCE_METHODS_NSObject_$_empty: .long 24 ; 0x18 .long 1 ; 0x1 .quad l_OBJC_METH_VAR_NAME_ .quad l_OBJC_METH_VAR_TYPE_ .quad "-[NSObject(empty) empty:]" .p2align 3 ; @"_OBJC_$_CATEGORY_NSObject_$_empty" __OBJC_$_CATEGORY_NSObject_$_empty: .quad l_OBJC_CLASS_NAME_ .quad _OBJC_CLASS_$_NSObject .quad __OBJC_$_CATEGORY_INSTANCE_METHODS_NSObject_$_empty .quad 0 .quad 0 .quad 0 .quad 0 .long 64 ; 0x40 .space 4 .section __DATA,__objc_catlist,regular,no_dead_strip .p2align 3 ; @"OBJC_LABEL_CATEGORY_$" l_OBJC_LABEL_CATEGORY_$: .quad __OBJC_$_CATEGORY_NSObject_$_empty .section __DATA,__objc_imageinfo,regular,no_dead_strip L_OBJC_IMAGE_INFO: .long 0 .long 64 .subsections_via_symbols
MrChromebox/SeaBIOS
4,474
vgasrc/vgaentry.S
// Rom layout and bios assembler to C interface. // // Copyright (C) 2009-2013 Kevin O'Connor <kevin@koconnor.net> // // This file may be distributed under the terms of the GNU LGPLv3 license. #include "asm-offsets.h" // BREGS_* #include "config.h" // CONFIG_* #include "entryfuncs.S" // ENTRY_* /**************************************************************** * Rom Header ****************************************************************/ .section .rom.header .code16 .global _rom_header, _rom_header_size, _rom_header_checksum _rom_header: .word 0xaa55 _rom_header_size: .byte 0 _rom_header_entry: jmp _optionrom_entry _rom_header_checksum: .byte 0 _rom_header_other: .space 17 _rom_header_pcidata: #if CONFIG_VGA_PCI == 1 .word rom_pci_data #else .word 0 #endif _rom_header_pnpdata: .word 0 _rom_header_other2: .word 0 _rom_header_signature: .asciz "IBM" #if CONFIG_VGA_ATI #include "ati-tables.S" #endif /**************************************************************** * Entry points ****************************************************************/ // This macro implements a call while avoiding instructions // that old versions of x86emu have problems with. .macro VGA_CALLL cfunc #if CONFIG_VGA_FIXUP_ASM pushw %ax callw \cfunc #else calll \cfunc #endif .endm // This macro is the same as ENTRY_ARG except VGA_CALLL is used. .macro ENTRY_ARG_VGA cfunc cli cld PUSHBREGS movw %ss, %ax // Move %ss to %ds movw %ax, %ds movl %esp, %ebx // Backup %esp, then zero high bits movzwl %sp, %esp movl %esp, %eax // First arg is pointer to struct bregs VGA_CALLL \cfunc movl %ebx, %esp // Restore %esp (including high bits) POPBREGS .endm DECLFUNC entry_104f05 entry_104f05: ENTRY_ARG_VGA vbe_104f05 lretw DECLFUNC _optionrom_entry _optionrom_entry: ENTRY_ARG_VGA vga_post lretw DECLFUNC entry_10 entry_10: ENTRY_ARG_VGA handle_10 iretw #define VGA_CUSTOM_BDA_FLAGS 0xb9 #define BF_EXTRA_STACK 0x40 // Entry point using extra stack DECLFUNC entry_10_extrastack entry_10_extrastack: cli cld pushw %ds pushl %eax movw $SEG_BDA, %ax // Check if extra stack is enabled movw %ax, %ds testb $BF_EXTRA_STACK, VGA_CUSTOM_BDA_FLAGS jz 1f movw %cs:ExtraStackSeg, %ds // Set %ds:%eax to space on ExtraStack movl $(CONFIG_VGA_EXTRA_STACK_SIZE-PUSHBREGS_size-16), %eax SAVEBREGS_POP_DSEAX // Save registers on extra stack movl %esp, PUSHBREGS_size+8(%eax) movw %ss, PUSHBREGS_size+12(%eax) popl BREGS_code(%eax) popw BREGS_flags(%eax) movw %ds, %dx // Setup %ss/%esp and call function movw %dx, %ss movl %eax, %esp VGA_CALLL handle_10 movl %esp, %eax // Restore registers and return movw PUSHBREGS_size+12(%eax), %ss movl PUSHBREGS_size+8(%eax), %esp popl %edx popw %dx pushw BREGS_flags(%eax) pushl BREGS_code(%eax) RESTOREBREGS_DSEAX iretw 1: // Use regular entry point if the extra stack is disabled popl %eax popw %ds jmp entry_10 // Timer irq handling DECLFUNC entry_timer_hook entry_timer_hook: ENTRY handle_timer_hook ljmpw *%cs:Timer_Hook_Resume // Timer irq handling on extra stack DECLFUNC entry_timer_hook_extrastack entry_timer_hook_extrastack: cli cld pushw %ds // Set %ds:%eax to space on ExtraStack pushl %eax movw %cs:ExtraStackSeg, %ds movl $(CONFIG_VGA_EXTRA_STACK_SIZE-PUSHBREGS_size-8), %eax SAVEBREGS_POP_DSEAX movl %esp, PUSHBREGS_size(%eax) movw %ss, PUSHBREGS_size+4(%eax) movw %ds, %dx // Setup %ss/%esp and call function movw %dx, %ss movl %eax, %esp calll handle_timer_hook movl %esp, %eax // Restore registers and return movw PUSHBREGS_size+4(%eax), %ss movl PUSHBREGS_size(%eax), %esp RESTOREBREGS_DSEAX ljmpw *%cs:Timer_Hook_Resume
MrChromebox/SeaBIOS
5,001
src/entryfuncs.S
// Macros for entering C code // // Copyright (C) 2008-2014 Kevin O'Connor <kevin@koconnor.net> // // This file may be distributed under the terms of the GNU LGPLv3 license. /**************************************************************** * Macros for save and restore of 'struct bregs' registers ****************************************************************/ #define PUSHBREGS_size 32 // Save registers (matches struct bregs) to stack .macro PUSHBREGS pushl %eax pushl %ecx pushl %edx pushl %ebx pushl %ebp pushl %esi pushl %edi pushw %es pushw %ds .endm // Restore registers (from struct bregs) from stack .macro POPBREGS popw %ds popw %es popl %edi popl %esi popl %ebp popl %ebx popl %edx popl %ecx popl %eax .endm // Save registers to struct bregs at %ds:%eax. The caller // should "pushw %ds ; pushl %eax" prior to calling - this macro // will pop them off. .macro SAVEBREGS_POP_DSEAX popl BREGS_eax(%eax) popw BREGS_ds(%eax) movl %edi, BREGS_edi(%eax) movl %esi, BREGS_esi(%eax) movl %ebp, BREGS_ebp(%eax) movl %ebx, BREGS_ebx(%eax) movl %edx, BREGS_edx(%eax) movl %ecx, BREGS_ecx(%eax) movw %es, BREGS_es(%eax) .endm // Restore registers from struct bregs at %ds:%eax .macro RESTOREBREGS_DSEAX movl BREGS_edi(%eax), %edi movl BREGS_esi(%eax), %esi movl BREGS_ebp(%eax), %ebp movl BREGS_ebx(%eax), %ebx movl BREGS_edx(%eax), %edx movl BREGS_ecx(%eax), %ecx movw BREGS_es(%eax), %es pushl BREGS_eax(%eax) movw BREGS_ds(%eax), %ds popl %eax .endm /**************************************************************** * Entry macros ****************************************************************/ // Call a C function - this does the minimal work necessary to // call into C. It sets up %ds, backs up %es, and backs up // those registers that are call clobbered by the C compiler. .macro ENTRY cfunc cli // In case something far-calls instead of using "int" cld pushl %eax // Save registers clobbered by C code pushl %ecx pushl %edx pushw %es pushw %ds movw %ss, %ax // Move %ss to %ds movw %ax, %ds pushl %esp // Backup %esp, then clear high bits movzwl %sp, %esp calll \cfunc popl %esp // Restore %esp (including high bits) popw %ds // Restore registers saved above popw %es popl %edx popl %ecx popl %eax .endm // Call a C function with current register list as an // argument. This backs up the registers and sets %eax // to point to the backup. On return, the registers are // restored from the structure. .macro ENTRY_ARG cfunc cli cld PUSHBREGS movw %ss, %ax // Move %ss to %ds movw %ax, %ds movl %esp, %ebx // Backup %esp, then zero high bits movzwl %sp, %esp movl %esp, %eax // First arg is pointer to struct bregs calll \cfunc movl %ebx, %esp // Restore %esp (including high bits) POPBREGS .endm // As above, but get calling function from stack. .macro ENTRY_ARG_ST cli cld pushl %ecx pushl %edx pushl %ebx pushl %ebp pushl %esi pushl %edi pushw %es pushw %ds movw %ss, %cx // Move %ss to %ds movw %cx, %ds movl %esp, %ebx // Backup %esp, then zero high bits movzwl %sp, %esp movl 28(%esp), %ecx // Get calling function movl %eax, 28(%esp) // Save %eax movl %esp, %eax // First arg is pointer to struct bregs calll *%ecx movl %ebx, %esp // Restore %esp (including high bits) POPBREGS .endm // Same as ENTRY_ARG, but don't mangle %esp .macro ENTRY_ARG_ESP cfunc cli cld PUSHBREGS movw %ss, %ax // Move %ss to %ds movw %ax, %ds movl %esp, %eax // First arg is pointer to struct bregs calll \cfunc POPBREGS .endm // Reset stack, transition to 32bit mode, and call a C function. .macro ENTRY_INTO32 cfunc xorw %dx, %dx movw %dx, %ss movl $ BUILD_STACK_ADDR , %esp movl $ \cfunc , %edx jmp transition32 .endm // Declare a function .macro DECLFUNC func .section .text.asm.\func .global \func .endm
MrChromebox/SeaBIOS
17,735
src/romlayout.S
// Rom layout and bios assembler to C interface. // // Copyright (C) 2008-2012 Kevin O'Connor <kevin@koconnor.net> // Copyright (C) 2002 MandrakeSoft S.A. // // This file may be distributed under the terms of the GNU LGPLv3 license. #include "asm-offsets.h" // BREGS_* #include "config.h" // CONFIG_* #include "entryfuncs.S" // ENTRY_* #include "hw/rtc.h" // CMOS_RESET_CODE #include "x86.h" // CR0_* .code16 /**************************************************************** * 16bit / 32bit call trampolines ****************************************************************/ // Place CPU into 32bit mode from 16bit mode. // %edx = return location (in 32bit mode) // Clobbers: ecx, flags, segment registers, cr0, idt/gdt DECLFUNC transition32 .global transition32_nmi_off transition32: // Disable irqs (and clear direction flag) cli cld // Disable nmi movl %eax, %ecx movl $CMOS_RESET_CODE|NMI_DISABLE_BIT, %eax outb %al, $PORT_CMOS_INDEX inb $PORT_CMOS_DATA, %al // enable a20 inb $PORT_A20, %al orb $A20_ENABLE_BIT, %al outb %al, $PORT_A20 movl %ecx, %eax transition32_nmi_off: // Set segment descriptors lidtw %cs:pmode_IDT_info lgdtw %cs:rombios32_gdt_48 // Enable protected mode movl %cr0, %ecx andl $~(CR0_PG|CR0_CD|CR0_NW), %ecx orl $CR0_PE, %ecx movl %ecx, %cr0 // start 32bit protected mode code ljmpl $SEG32_MODE32_CS, $(BUILD_BIOS_ADDR + 1f) .code32 // init data segments 1: movl $SEG32_MODE32_DS, %ecx movw %cx, %ds movw %cx, %es movw %cx, %ss movw %cx, %fs movw %cx, %gs jmpl *%edx .code16 // Place CPU into 16bit mode from 32bit mode. // %edx = return location (in 16bit mode) // Clobbers: ecx, flags, segment registers, cr0, idt/gdt DECLFUNC transition16 .global transition16big .code32 transition16: // Reset data segment limits movl $SEG32_MODE16_DS, %ecx movw %cx, %ds movw %cx, %es movw %cx, %ss movw %cx, %fs movw %cx, %gs // Jump to 16bit mode ljmpw $SEG32_MODE16_CS, $1f transition16big: movl $SEG32_MODE16BIG_DS, %ecx movw %cx, %ds movw %cx, %es movw %cx, %ss movw %cx, %fs movw %cx, %gs ljmpw $SEG32_MODE16BIG_CS, $1f .code16 // Disable protected mode 1: movl %cr0, %ecx andl $~CR0_PE, %ecx movl %ecx, %cr0 // far jump to flush CPU queue after transition to real mode ljmpw $SEG_BIOS, $2f // restore IDT to normal real-mode defaults 2: lidtw %cs:rmode_IDT_info // Clear segment registers xorw %cx, %cx movw %cx, %fs movw %cx, %gs movw %cx, %es movw %cx, %ds movw %cx, %ss // Assume stack is in segment 0 jmpl *%edx /**************************************************************** * External calling trampolines ****************************************************************/ // Far call a 16bit function from 16bit mode with a specified cpu register state // %eax = address of struct bregs, %edx = segment of struct bregs // Clobbers: %e[bc]x, %e[ds]i, flags DECLFUNC __farcall16 __farcall16: // Save %edx/%eax, %ebp pushl %ebp pushl %eax pushl %edx // Setup for iretw call movl %edx, %ds pushw %cs pushw $1f // return point pushw BREGS_flags(%eax) // flags pushl BREGS_code(%eax) // CS:IP // Load calling registers and invoke call RESTOREBREGS_DSEAX iretw // XXX - just do a lcalll 1: // Store flags, es, eax pushfw cli cld pushw %ds pushl %eax movw 0x08(%esp), %ds movl 0x0c(%esp), %eax SAVEBREGS_POP_DSEAX popw BREGS_flags(%eax) movw %ss, %cx movw %cx, %ds // Restore %ds == %ss // Remove %edx/%eax, restore %ebp popl %edx popl %eax popl %ebp retl // IRQ trampolines .macro IRQ_TRAMPOLINE num DECLFUNC irq_trampoline_0x\num irq_trampoline_0x\num : int $0x\num lretw .endm IRQ_TRAMPOLINE 02 IRQ_TRAMPOLINE 05 IRQ_TRAMPOLINE 10 IRQ_TRAMPOLINE 13 IRQ_TRAMPOLINE 15 IRQ_TRAMPOLINE 16 IRQ_TRAMPOLINE 18 IRQ_TRAMPOLINE 19 IRQ_TRAMPOLINE 1b IRQ_TRAMPOLINE 1c IRQ_TRAMPOLINE 4a /**************************************************************** * Misc. entry points. ****************************************************************/ // Entry point for QEMU smi interrupts. DECLFUNC entry_smi entry_smi: // Transition to 32bit mode. movl $1f + BUILD_BIOS_ADDR, %edx jmp transition32_nmi_off .code32 1: movl $BUILD_SMM_ADDR + 0x8000, %esp calll _cfunc32flat_handle_smi - BUILD_BIOS_ADDR rsm .code16 // Entry point for QEMU smp sipi interrupts. DECLFUNC entry_smp entry_smp: // Transition to 32bit mode. cli cld movl $2f + BUILD_BIOS_ADDR, %edx jmp transition32_nmi_off .code32 // Acquire lock and take ownership of shared stack 1: rep ; nop 2: lock btsl $0, SMPLock jc 1b movl SMPStack, %esp // Call handle_smp calll _cfunc32flat_handle_smp - BUILD_BIOS_ADDR // Release lock and halt processor. movl $0, SMPLock 3: hlt jmp 3b .code16 // Resume (and reboot) entry point - called from entry_post DECLFUNC entry_resume entry_resume: // Disable interrupts cli cld // Use the ExtraStack in low mem. movl $_zonelow_seg, %eax movw %ax, %ds movw %ax, %ss movl $ExtraStack + BUILD_EXTRA_STACK_SIZE, %esp // Call handler. jmp handle_resume // PMM entry point DECLFUNC entry_pmm entry_pmm: pushl %esp // Backup %esp, then clear high bits movzwl %sp, %esp pushfl // Save registers clobbered by C code cli cld PUSHBREGS movl %ss, %ecx // Move %ss to %ds movw %cx, %ds shll $4, %ecx movl $_cfunc32flat_handle_pmm, %eax // Setup: call32(handle_pmm, args, -1) leal PUSHBREGS_size+12(%esp, %ecx), %edx // %edx points to start of args movl $-1, %ecx calll __call32 movw %ax, BREGS_eax(%esp) // Modify %ax:%dx to return %eax shrl $16, %eax movw %ax, BREGS_edx(%esp) POPBREGS popfl popl %esp lretw // PnP entry points DECLFUNC entry_pnp_real .global entry_pnp_prot entry_pnp_prot: pushl %esp jmp 1f entry_pnp_real: pushl %esp // Backup %esp, then clear high bits movzwl %sp, %esp 1: pushfl // Save registers clobbered by C code cli cld PUSHBREGS movw %ss, %cx // Move %ss to %ds movw %cx, %ds leal PUSHBREGS_size+12(%esp), %eax // %eax points to start of u16 args calll handle_pnp movw %ax, BREGS_eax(%esp) // Modify %eax to return %ax POPBREGS popfl popl %esp lretw // APM entry points DECLFUNC entry_apm16 entry_apm16: pushfw // save flags pushl %eax // dummy ENTRY_ARG handle_apm addw $4, %sp // pop dummy popfw // restore flags lretw DECLFUNC entry_apm32 .code32 entry_apm32: pushfl pushl %gs pushl %cs // Move second descriptor after %cs to %gs addl $16, (%esp) popl %gs ENTRY_ARG_ESP _cfunc32seg_handle_apm popl %gs popfl lretl .code16 // PCI-BIOS entry points DECLFUNC entry_pcibios32 .code32 entry_pcibios32: pushfl pushl %gs // Backup %gs and set %gs=%ds pushl %ds popl %gs ENTRY_ARG_ESP _cfunc32seg_handle_pcibios popl %gs popfl lretl .code16 DECLFUNC entry_pcibios16 entry_pcibios16: ENTRY_ARG handle_pcibios iretw // int 1589 entry point DECLFUNC entry_1589 entry_1589: ENTRY_ARG handle_1589 iretw // BIOS32 support DECLFUNC entry_bios32 .code32 entry_bios32: pushfl #if CONFIG_PCIBIOS // Check for PCI-BIOS request cmpl $0x49435024, %eax // $PCI jne 1f movl $BUILD_BIOS_ADDR, %ebx movl $BUILD_BIOS_SIZE, %ecx movl $entry_pcibios32, %edx xorb %al, %al jmp 2f #endif // Unknown request 1: movb $0x80, %al // Return to caller 2: popfl lretl .code16 // 32bit elf entry point DECLFUNC entry_elf .code32 entry_elf: cli cld movl %eax, entry_elf_eax movl %ebx, entry_elf_ebx lidtl (BUILD_BIOS_ADDR + pmode_IDT_info) lgdtl (BUILD_BIOS_ADDR + rombios32_gdt_48) movl $SEG32_MODE32_DS, %eax movw %ax, %ds movw %ax, %es movw %ax, %fs movw %ax, %gs movw %ax, %ss movl $BUILD_STACK_ADDR, %esp ljmpl $SEG32_MODE32_CS, $_cfunc32flat_handle_post .code16 // UEFI Compatibility Support Module (CSM) entry point DECLFUNC entry_csm entry_csm: // Backup register state pushfw cli cld pushl %eax // dummy PUSHBREGS // Backup stack location and convert to a "flat pointer" movl %ss, %eax movw %ax, BREGS_code+2(%esp) // Store %ss in bregs->code.seg shll $4, %eax addl %esp, %eax // Change to BUILD_STACK_ADDR stack and call handle_csm(bregs) ENTRY_INTO32 _cfunc32flat_handle_csm DECLFUNC __csm_return .code32 __csm_return: movl $1f, %edx jmp transition16big .code16 // Switch back to original stack 1: movzwl BREGS_code+2(%eax), %edx movl %edx, %ecx shll $4, %ecx subl %ecx, %eax movl %edx, %ss movl %eax, %esp // Restore register state and return. POPBREGS addw $4, %sp // pop dummy popfw lretw // Serial console "hooked vga" entry point DECLFUNC entry_sercon entry_sercon: // Setup for chain loading to real vga handler pushfw pushl %cs:sercon_real_vga_handler // Set %ds to varlow segment cli cld pushw %ds pushl %eax movl $_zonelow_seg, %eax movl %eax, %ds // Test if the sercon handler can be called movl %esp, %eax // Test for broken x86emu pushl $1f retl 1: cmpl %esp, %eax jne 4f cmpb $0, sercon_enable // Test that sercon is enabled je 3f // call handle_sercon popl %eax popw %ds 2: pushl $handle_sercon #if CONFIG_ENTRY_EXTRASTACK jmp irqentry_arg_extrastack #else jmp irqentry_arg #endif // sercon disabled - check for legacy text modeset and otherwise exit 3: popl %eax popw %ds cmpw $0x0007, %ax jle 2b iretw // Running on broken x86emu - restore stack and exit 4: movl %eax, %esp popl %eax popw %ds iretw /**************************************************************** * Interrupt entry points ****************************************************************/ // Main entry point for hardware interrupts handled on extra stack DECLFUNC irqentry_extrastack irqentry_extrastack: cli cld pushw %ds // Set %ds:%eax to space on ExtraStack pushl %eax movl $_zonelow_seg, %eax movl %eax, %ds movl StackPos, %eax subl $PUSHBREGS_size+8, %eax SAVEBREGS_POP_DSEAX popl %ecx movl %esp, PUSHBREGS_size(%eax) movw %ss, PUSHBREGS_size+4(%eax) movw %ds, %dx // Setup %ss/%esp and call function movw %dx, %ss movl %eax, %esp calll *%ecx movl %esp, %eax // Restore registers and return movw PUSHBREGS_size+4(%eax), %ss movl PUSHBREGS_size(%eax), %esp RESTOREBREGS_DSEAX iretw // Main entry point for software interrupts handled on extra stack DECLFUNC irqentry_arg_extrastack irqentry_arg_extrastack: cli cld pushw %ds // Set %ds:%eax to space on ExtraStack pushl %eax movl $_zonelow_seg, %eax movl %eax, %ds movl StackPos, %eax subl $PUSHBREGS_size+16, %eax SAVEBREGS_POP_DSEAX // Save registers on extra stack popl %ecx movl %esp, PUSHBREGS_size+8(%eax) movw %ss, PUSHBREGS_size+12(%eax) popl BREGS_code(%eax) popw BREGS_flags(%eax) movw %ds, %dx // Setup %ss/%esp and call function movw %dx, %ss movl %eax, %esp calll *%ecx movl %esp, %eax // Restore registers and return movw PUSHBREGS_size+12(%eax), %ss movl PUSHBREGS_size+8(%eax), %esp popl %edx popw %dx pushw BREGS_flags(%eax) pushl BREGS_code(%eax) RESTOREBREGS_DSEAX iretw // Main entry point for software interrupts (using caller's stack) DECLFUNC irqentry_arg irqentry_arg: ENTRY_ARG_ST iretw // Helper macros for hardware interrupt declaration .macro IRQ_ENTRY num .global entry_\num entry_\num : pushl $ handle_\num jmp irqentry_extrastack .endm .macro DECL_IRQ_ENTRY num DECLFUNC entry_\num IRQ_ENTRY \num .endm // Helper macros for software interrupt declaration .macro IRQ_ENTRY_ARG num .global entry_\num entry_\num : pushl $ handle_\num #if CONFIG_ENTRY_EXTRASTACK jmp irqentry_arg_extrastack #else jmp irqentry_arg #endif .endm .macro DECL_IRQ_ENTRY_ARG num DECLFUNC entry_\num IRQ_ENTRY_ARG \num .endm // Various entry points (that don't require a fixed location). DECL_IRQ_ENTRY_ARG 13 DECL_IRQ_ENTRY 76 DECL_IRQ_ENTRY 70 DECL_IRQ_ENTRY 74 DECL_IRQ_ENTRY 75 DECL_IRQ_ENTRY hwpic1 DECL_IRQ_ENTRY hwpic2 // int 18/19 are special - they reset stack and call into 32bit mode. DECLFUNC entry_19 entry_19: ENTRY_INTO32 _cfunc32flat_handle_19 DECLFUNC entry_18 entry_18: ENTRY_INTO32 _cfunc32flat_handle_18 /**************************************************************** * Fixed position entry points ****************************************************************/ // Specify a location in the fixed part of bios area. .macro ORG addr .section .fixedaddr.\addr .endm ORG 0xe05b entry_post: cmpl $0, %cs:HaveRunPost // Check for resume/reboot jnz entry_resume ENTRY_INTO32 _cfunc32flat_handle_post // Normal entry point ORG 0xe2c3 .global entry_02 entry_02: ENTRY handle_02 // NMI handler does not switch onto extra stack iretw ORG 0xe3fe .global entry_13_official entry_13_official: jmp entry_13 // 0xe401 - OldFDPT in misc.c ORG 0xe6f2 .global entry_19_official entry_19_official: jmp entry_19 // 0xe6f5 - BIOS_CONFIG_TABLE in misc.c // 0xe729 - BaudTable in misc.c ORG 0xe739 IRQ_ENTRY_ARG 14 ORG 0xe82e IRQ_ENTRY_ARG 16 ORG 0xe987 IRQ_ENTRY 09 ORG 0xec59 IRQ_ENTRY_ARG 40 ORG 0xef57 IRQ_ENTRY 0e // 0xefc7 - diskette_param_table in misc.c ORG 0xefd2 IRQ_ENTRY_ARG 17 ORG 0xf045 entry_10_0x0f: // XXX - INT 10 Functions 0-Fh Entry Point iretw ORG 0xf065 entry_10: iretw // 0xf0a4 - VideoParams in misc.c ORG 0xf841 IRQ_ENTRY_ARG 12 ORG 0xf84d IRQ_ENTRY_ARG 11 ORG 0xf859 .global entry_15_official entry_15_official: cmpb $0x89, %ah je entry_1589 // 1589 calls return in protected mode IRQ_ENTRY_ARG 15 // 0xfa6e - vgafont8 in font.c ORG 0xfe6e .global entry_1a_official entry_1a_official: cmpb $0xb1, %ah je entry_pcibios16 // PCIBIOS calls can be in protected mode IRQ_ENTRY_ARG 1a ORG 0xfea5 IRQ_ENTRY 08 // 0xfef3 - InitVectors in misc.c ORG 0xff53 .global entry_iret_official entry_iret_official: iretw ORG 0xff54 IRQ_ENTRY_ARG 05 ORG 0xfff0 // Power-up Entry Point .global reset_vector reset_vector: ljmpw $SEG_BIOS, $entry_post // 0xfff5 - BiosDate in misc.c // 0xfffe - BiosModelId in misc.c // 0xffff - BiosChecksum in misc.c .end
MrOwlSage/objc4-906
26,319
runtime/objc-blocktramps-i386.s
/* * Copyright (c) 1999-2007 Apple Inc. All Rights Reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #ifdef __i386__ #include "objc-vm.h" .text .globl __objc_blockTrampolineImpl .globl __objc_blockTrampolineStart .globl __objc_blockTrampolineLast .align 12 /* PAGE_SHIFT */ __objc_blockTrampolineImpl: movl (%esp), %eax // return address pushed by trampoline // 4(%esp) is return address pushed by the call site movl 8(%esp), %ecx // self -> ecx movl %ecx, 12(%esp) // ecx -> _cmd movl -2*4096/*PAGE_SIZE */-5(%eax), %ecx // block object pointer -> ecx // trampoline is -5 bytes from the return address // data is -2 pages from the trampoline movl %ecx, 8(%esp) // ecx -> self ret // back to TrampolineEntry to preserve CPU's return stack .macro TrampolineEntry // This trampoline is 8 bytes long. // This callq is 5 bytes long. calll __objc_blockTrampolineImpl jmp *12(%ecx) // tail call block->invoke .endmacro .align 5 __objc_blockTrampolineStart: TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry __objc_blockTrampolineLast: TrampolineEntry .text .globl __objc_blockTrampolineImpl_stret .globl __objc_blockTrampolineStart_stret .globl __objc_blockTrampolineLast_stret .align 12 /* PAGE_SHIFT */ __objc_blockTrampolineImpl_stret: movl (%esp), %eax // return address pushed by trampoline // 4(%esp) is return address pushed by the call site // 8(%esp) is struct-return address movl 12(%esp), %ecx // self -> ecx movl %ecx, 16(%esp) // ecx -> _cmd movl -3*4096/*PAGE_SIZE*/-5(%eax), %ecx // block object pointer -> ecx // trampoline is -5 bytes from the return address // data is -3 pages from the trampoline movl %ecx, 12(%esp) // ecx -> self ret .macro TrampolineEntry_stret // This trampoline is 8 bytes long. // This callq is 5 bytes long. call __objc_blockTrampolineImpl_stret jmp *12(%ecx) // tail to block->invoke .endmacro .align 5 __objc_blockTrampolineStart_stret: TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret __objc_blockTrampolineLast_stret: TrampolineEntry_stret #endif
MrOwlSage/objc4-906
5,619
runtime/objc-blocktramps-arm.s
#if __arm__ #include <arm/arch.h> #include "objc-vm.h" .syntax unified .text .globl __objc_blockTrampolineImpl .globl __objc_blockTrampolineStart .globl __objc_blockTrampolineLast // Trampoline machinery assumes the trampolines are Thumb function pointers #if !__thumb2__ # error sorry #endif .thumb // Exported symbols are not marked as functions. // The trampoline construction code assumes that the Thumb bit is not set. .thumb_func L__objc_blockTrampolineImpl_func .align PAGE_MAX_SHIFT __objc_blockTrampolineImpl: L__objc_blockTrampolineImpl_func: /* r0 == self r12 == pc of trampoline's first instruction + PC bias lr == original return address */ mov r1, r0 // _cmd = self // Trampoline's data is two pages before the trampoline text. // Also correct PC bias of 4 bytes. sub r12, # 2*PAGE_MAX_SIZE ldr r0, [r12, #-4] // self = block object ldr pc, [r0, #12] // tail call block->invoke // not reached .macro TrampolineEntry mov r12, pc b L__objc_blockTrampolineImpl_func .align 3 .endmacro .macro TrampolineEntryX16 TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry .endmacro .macro TrampolineEntryX256 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 .endmacro .align 5 __objc_blockTrampolineStart: // 2048-4 trampolines to fill 16K page TrampolineEntryX256 TrampolineEntryX256 TrampolineEntryX256 TrampolineEntryX256 TrampolineEntryX256 TrampolineEntryX256 TrampolineEntryX256 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry __objc_blockTrampolineLast: TrampolineEntry // TrampolineEntry // TrampolineEntry // TrampolineEntry // TrampolineEntry .text .globl __objc_blockTrampolineImpl_stret .globl __objc_blockTrampolineStart_stret .globl __objc_blockTrampolineLast_stret // Trampoline machinery assumes the trampolines are Thumb function pointers #if !__thumb2__ # error sorry #endif .thumb // Exported symbols are not marked as functions. // The trampoline construction code assumes that the Thumb bit is not set. .thumb_func L__objc_blockTrampolineImpl_stret_func .align PAGE_MAX_SHIFT __objc_blockTrampolineImpl_stret: L__objc_blockTrampolineImpl_stret_func: /* r1 == self r12 == pc of trampoline's first instruction + PC bias lr == original return address */ mov r2, r1 // _cmd = self // Trampoline's data is three pages before the trampoline text. // Also correct PC bias of 4 bytes. sub r12, # 3*PAGE_MAX_SIZE ldr r1, [r12, #-4] // self = block object ldr pc, [r1, #12] // tail call block->invoke // not reached .macro TrampolineEntry_stret mov r12, pc b L__objc_blockTrampolineImpl_stret_func .align 3 .endmacro .macro TrampolineEntryX16_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret .endmacro .macro TrampolineEntryX256_stret TrampolineEntryX16_stret TrampolineEntryX16_stret TrampolineEntryX16_stret TrampolineEntryX16_stret TrampolineEntryX16_stret TrampolineEntryX16_stret TrampolineEntryX16_stret TrampolineEntryX16_stret TrampolineEntryX16_stret TrampolineEntryX16_stret TrampolineEntryX16_stret TrampolineEntryX16_stret TrampolineEntryX16_stret TrampolineEntryX16_stret TrampolineEntryX16_stret TrampolineEntryX16_stret .endmacro .align 5 __objc_blockTrampolineStart_stret: // 2048-4 trampolines to fill 16K page TrampolineEntryX256_stret TrampolineEntryX256_stret TrampolineEntryX256_stret TrampolineEntryX256_stret TrampolineEntryX256_stret TrampolineEntryX256_stret TrampolineEntryX256_stret TrampolineEntryX16_stret TrampolineEntryX16_stret TrampolineEntryX16_stret TrampolineEntryX16_stret TrampolineEntryX16_stret TrampolineEntryX16_stret TrampolineEntryX16_stret TrampolineEntryX16_stret TrampolineEntryX16_stret TrampolineEntryX16_stret TrampolineEntryX16_stret TrampolineEntryX16_stret TrampolineEntryX16_stret TrampolineEntryX16_stret TrampolineEntryX16_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret __objc_blockTrampolineLast_stret: TrampolineEntry_stret // TrampolineEntry_stret // TrampolineEntry_stret // TrampolineEntry_stret // TrampolineEntry_stret #endif
MrOwlSage/objc4-906
2,621
runtime/objc-blocktramps-arm64.s
#include <TargetConditionals.h> #if !TARGET_OS_EXCLAVEKIT #if __arm64__ #include "objc-vm.h" #include "arm64-asm.h" // Offset of block->invoke field. #if __LP64__ // true arm64 # define BLOCK_INVOKE 16 #else // arm64_32 # define BLOCK_INVOKE 12 #endif .text .globl __objc_blockTrampolineImpl .globl __objc_blockTrampolineStart .globl __objc_blockTrampolineLast .align PAGE_MAX_SHIFT __objc_blockTrampolineImpl: L_objc_blockTrampolineImpl: /* x0 == self x17 == address of called trampoline's data (2 pages before its code) lr == original return address */ mov x1, x0 // _cmd = self ldr p0, [x17] // self = block object add p15, p0, #BLOCK_INVOKE // x15 = &block->invoke ldr p16, [x15] // x16 = block->invoke TailCallBlockInvoke x16, x15 // pad up to TrampolineBlockPagePair header size nop nop nop .macro TrampolineEntry // load address of trampoline data (two pages before this instruction) adr x17, -2*PAGE_MAX_SIZE b L_objc_blockTrampolineImpl .endmacro .macro TrampolineEntryX16 TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry .endmacro .macro TrampolineEntryX256 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 .endmacro .align 3 __objc_blockTrampolineStart: // 2048-4 trampolines to fill 16K page TrampolineEntryX256 TrampolineEntryX256 TrampolineEntryX256 TrampolineEntryX256 TrampolineEntryX256 TrampolineEntryX256 TrampolineEntryX256 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntryX16 TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry __objc_blockTrampolineLast: TrampolineEntry // TrampolineEntry // TrampolineEntry // TrampolineEntry // TrampolineEntry #endif #endif // !TARGET_OS_EXCLAVEKIT
MrOwlSage/objc4-906
27,707
runtime/objc-blocktramps-x86_64.s
/* * Copyright (c) 1999-2007 Apple Inc. All Rights Reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #ifdef __x86_64__ #include "objc-vm.h" .text .globl __objc_blockTrampolineImpl .globl __objc_blockTrampolineStart .globl __objc_blockTrampolineLast .align PAGE_MAX_SHIFT __objc_blockTrampolineImpl: movq (%rsp), %r10 // read return address pushed by TrampolineEntry's callq movq %rdi, %rsi // arg1 -> arg2 movq -2*PAGE_MAX_SIZE-5(%r10), %rdi // block object pointer -> arg1 // trampoline is -5 bytes from the return address // data is -2 pages from the trampoline ret // back to TrampolineEntry to preserve CPU's return stack .macro TrampolineEntry1 // This trampoline is 8 bytes long. // This callq is 5 bytes long. callq __objc_blockTrampolineImpl jmp *16(%rdi) .endmacro .macro TrampolineEntry4 TrampolineEntry1 TrampolineEntry1 TrampolineEntry1 TrampolineEntry1 .endmacro #if PAGE_MAX_SHIFT == 12 #define TrampolineEntry TrampolineEntry1 #elif PAGE_MAX_SHIFT == 14 #define TrampolineEntry TrampolineEntry4 #else #error "unknown PAGE_MAX_SHIFT value" #endif .align 5 __objc_blockTrampolineStart: TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry // The above is 507 entries. #if PAGE_MAX_SHIFT == 14 // With 16kB pages, we need (4096*4-32)/8 = 2044 single entries, or // 511 "quad" entries as above. We need 3 more regular entries, then // 3 more singular entries, and finally a singular entry labeled Last. TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry1 TrampolineEntry1 TrampolineEntry1 __objc_blockTrampolineLast: TrampolineEntry1 #else // With 4kB pages, we need (4096-32)/8 = 508 entries. We have one // more at the end with the Last label for a total of 508. __objc_blockTrampolineLast: TrampolineEntry #endif .text .globl __objc_blockTrampolineImpl_stret .globl __objc_blockTrampolineStart_stret .globl __objc_blockTrampolineLast_stret .align PAGE_MAX_SHIFT __objc_blockTrampolineImpl_stret: // %rdi -- arg1 -- is address of return value's space. Don't mess with it. movq (%rsp), %r10 // read return address pushed by TrampolineEntry's callq movq %rsi, %rdx // arg2 -> arg3 movq -3*PAGE_MAX_SIZE-5(%r10), %rsi // block object pointer -> arg2 // trampoline is -5 bytes from the return address // data is -3 pages from the trampoline ret // back to TrampolineEntry to preserve CPU's return stack .macro TrampolineEntry_stret1 // This trampoline is 8 bytes long. // This callq is 5 bytes long. callq __objc_blockTrampolineImpl_stret jmp *16(%rsi) .endmacro .macro TrampolineEntry_stret4 TrampolineEntry_stret1 TrampolineEntry_stret1 TrampolineEntry_stret1 TrampolineEntry_stret1 .endmacro #if PAGE_MAX_SHIFT == 12 #define TrampolineEntry_stret TrampolineEntry_stret1 #elif PAGE_MAX_SHIFT == 14 #define TrampolineEntry_stret TrampolineEntry_stret4 #else #error "unknown PAGE_MAX_SHIFT value" #endif .align 5 __objc_blockTrampolineStart_stret: TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret // See the comment on non-stret's Last for why we have additional // entries here. #if PAGE_MAX_SHIFT == 14 TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret TrampolineEntry_stret1 TrampolineEntry_stret1 TrampolineEntry_stret1 __objc_blockTrampolineLast_stret: TrampolineEntry_stret1 #else __objc_blockTrampolineLast_stret: TrampolineEntry_stret #endif #endif
MrOwlSage/objc4-906
1,157
runtime/objc-sel-table.s
#include <TargetConditionals.h> #include "objc-vm.h" #if __LP64__ #if __arm64e__ // 0x6AE1 # define PTR(x) .quad x@AUTH(da, 27361, addr) #else # define PTR(x) .quad x #endif #else # define PTR(x) .long x #endif // These offsets are populated by the dyld shared cache builder. // They point to memory allocatd elsewhere in the shared cache. .section __TEXT,__objc_opt_ro .align 3 .private_extern __objc_opt_data __objc_opt_data: .long 16 /* table.version */ .long 0 /* table.flags */ .long 0 /* table.selopt_offset */ .long 0 /* table.headeropt_ro_offset */ .long 0 /* table.clsopt_offset */ .long 0 /* table.protocolopt_offset */ .long 0 /* table.headeropt_rw_offset */ .long 0 /* table.unused_protocolopt2_offset */ .long 0 /* table.largeSharedCachesClassOffset */ .long 0 /* table.largeSharedCachesProtocolOffset */ .space PAGE_MAX_SIZE-40 /* section of pointers that the shared cache optimizer wants to know about */ .section __DATA,__objc_opt_ptrs .align 3 #if TARGET_OS_OSX && __i386__ // old ABI .globl .objc_class_name_Protocol PTR(.objc_class_name_Protocol) #else // new ABI .globl _OBJC_CLASS_$_Protocol PTR(_OBJC_CLASS_$_Protocol) #endif
MrOwlSage/objc4-906
13,206
runtime/retain-release-helpers-arm64.s
/* * @APPLE_LICENSE_HEADER_START@ * * Copyright (c) 2021 Apple Inc. All Rights Reserved. * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ /******************************************************************** * * retain-release-helpers-arm64.s - ARM64 code for compressed retain/release sequences * ********************************************************************/ #ifdef __arm64 #include "isa.h" #include "arm64-asm.h" // We support the inlined fast path when we have an inline refcount. We don't // currently have support for indexed isa. #if ISA_HAS_INLINE_RC && !SUPPORT_INDEXED_ISA #define INLINE_RR_FASTPATH 1 #endif #if INLINE_RR_FASTPATH // Constants for various offsets and bit positions used later. #define HAS_DEFAULT_RR_BIT 2 #define NONPOINTER_ISA_BIT 0 #define IS_SWIFT_STABLE_BIT 1 #define SWIFT_CLASS_FLAGS_OFFSET (CLASS_BITS_OFFSET + PTRSIZE) // Located at &objc_class::bits + 1. #define SWIFT_CLASS_FLAG_USES_SWIFT_REFCOUNTING_BIT 1 #define CLASS_BITS_OFFSET (4 * PTRSIZE) #define CLASS_CACHE_FLAGS_OFFSET (3 * PTRSIZE) #define CLASS_CACHE_FLAGS_SHIFT 48 #define CLASS_CACHE_FLAG_HAS_CUSTOM_DEALLOC_INITIATION ((1<<12) << CLASS_CACHE_FLAGS_SHIFT) // Set up the selectors and selrefs we'll use with msgSend. .section __TEXT,__objc_methname,cstring_literals LRetain: .asciz "retain" LRelease: .asciz "release" LDealloc: .asciz "dealloc" LInitiateDealloc: .asciz "_objc_initiateDealloc" .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip .p2align PTRSHIFT LRetainRef: PTR LRetain LReleaseRef: PTR LRelease LDeallocRef: PTR LDealloc LInitiateDeallocRef: PTR LInitiateDealloc // Use ARM64e as a good-enough proxy for CAS support. #if __arm64e__ #define USE_CAS 1 #endif // Define a CLREX macro that expands to nothing when we use CAS. #if USE_CAS #define CLREX #else #define CLREX clrex #endif .text .align 2 .macro RetainFunction reg .ifc \reg, x1 RetainFunctionImpl \reg, p2 .else RetainFunctionImpl \reg, p1 .endif .endmacro .macro RetainFunctionImpl reg, tmpreg .globl _objc_retain_\reg _objc_retain_\reg: // These functions always return their argument. Move the argument into // x0 right away so that's always taken care of. The ands performs that // move and updates the condition flags for the nil/tagged check. ands x0, \reg, \reg // Check for nil and tagged pointers. #if SUPPORT_TAGGED_POINTERS b.le LnilOrTagged_retain // Check self <= 0 for tagged-or-nil. #else b.eq LnilOrTagged_retain // Check self == 0 when we don't have tagged pointers. #endif // Load raw isa value into p16. If we don't have CAS, load-exclusive. #if USE_CAS // CAS updates p16 so we begin our retry after the load. ldr p16, [\reg] Lretry_retain_\reg: #else Lretry_retain_\reg: // stxr does not update p16 so we need to reload it when retrying. ldxr p16, [\reg] #endif and p17, p16, #ISA_MASK_NOSIG // p17 contains the actual class pointer. ldr p17, [p17, #CLASS_BITS_OFFSET] // p17 contains the class's `bits` field. // If hasCustomRR, call swift_retain or msgSend retain. This code // expects the raw isa value in p16 and `bits` in p17. tbz p17, HAS_DEFAULT_RR_BIT, LcustomRR_retain tbz p16, NONPOINTER_ISA_BIT, LrawISA_retain // If raw isa pointer, call into C. // We now have: // * Raw isa field in p16. // * Object with nonpointer isa. // * And no custom RR override. // Check for deallocating. An object is deallocating when its inline // refcount is 0 and has_sidetable is 0. These fields are contiguous // at the top of the isa field, so we shift away the other bits and then // compare with zero. lsr p17, p16, #RC_HAS_SIDETABLE_BIT cbz p17, Ldeallocating_retain // We're ready to actually perform the retain. Next steps: // * Increment the inline refcount. // * Check for overflow. // * CAS the isa field. mov p17, RC_ONE adds p17, p16, p17 // New isa field value is in p17. b.cs Loverflow_retain #if USE_CAS mov \tmpreg, p16 cas p16, p17, [\reg] // Try to store the updated value. cmp \tmpreg, p16 b.ne Lretry_retain_\reg // On failure, retry. p16 has been loaded with the latest value. #else stxr w16, p17, [\reg] // Try to store the updated value. cbnz w16, Lretry_retain_\reg // On failure, retry. #endif ret .endmacro // The object is already in x0/w0, so we just need to clear our exclusive load // and call swift_retain or objc_msgSend. LcustomRR_retain: CLREX // Check the isSwiftStable bit, msgSend if this class isn't Swift. tbz p17, IS_SWIFT_STABLE_BIT, LmsgSend_retain // Load the Swift class flags into p17. and p17, p16, #ISA_MASK_NOSIG // p17 contains the actual class pointer. ldr w17, [p17, #SWIFT_CLASS_FLAGS_OFFSET] // If this class doesn't use Swift refcounting, msgSend. tbz w17, SWIFT_CLASS_FLAG_USES_SWIFT_REFCOUNTING_BIT, LmsgSend_retain // The class uses Swift refcounting. Call the pointer in swiftRetain. adrp x17, _swiftRetain@PAGE ldr x17, [x17, _swiftRetain@PAGEOFF] TailCallFunctionPointer x17 LmsgSend_retain: adrp x1, LRetainRef@PAGE ldr x1, [x1, LRetainRef@PAGEOFF] b _objc_msgSend // The object is already in x0/w0, so we just need to clear our exclusive load // and jump to objc_retain_full. LrawISA_retain: CLREX b _objc_retain_full // The object is already in x0/w0, so we just need to clear our exclusive load // and jump to _objc_rootRetain. Loverflow_retain: CLREX b __objc_rootRetain Ldeallocating_retain: // Clear our exclusive load of the isa before returning. CLREX LnilOrTagged_retain: // For nil/tagged/deallocating objects, release is a no-op. // The object is already in x0/w0, so we can just return. ret .globl _objc_retain _objc_retain: RetainFunction x0 RetainFunction x1 RetainFunction x2 RetainFunction x3 RetainFunction x4 RetainFunction x5 RetainFunction x6 RetainFunction x7 RetainFunction x8 RetainFunction x9 RetainFunction x10 RetainFunction x11 RetainFunction x12 RetainFunction x13 RetainFunction x14 RetainFunction x15 RetainFunction x19 RetainFunction x20 RetainFunction x21 RetainFunction x22 RetainFunction x23 RetainFunction x24 RetainFunction x25 RetainFunction x26 RetainFunction x27 RetainFunction x28 .macro ReleaseFunction reg .ifc \reg, x1 ReleaseFunctionImpl \reg, p2, p3 .else .ifc \reg, x2 ReleaseFunctionImpl \reg, p1, p3 .else ReleaseFunctionImpl \reg, p1, p2 .endif .endif .endmacro .macro ReleaseFunctionImpl reg, casReg, maskedIsaReg .text .align 2 .globl _objc_release_\reg _objc_release_\reg: // Many paths need the object pointer to be in x0. Move it here, and // also set the condition flags for the nil/tagged check. ands x0, \reg, \reg // Check for nil and tagged pointers. #if SUPPORT_TAGGED_POINTERS b.le LnilOrTagged_release // Check self <= 0 for tagged-or-nil. #else b.eq LnilOrTagged_release // Check self == 0 when we don't have tagged pointers. #endif // Load raw isa value into p16. If we don't have CAS, load-exclusive. #if USE_CAS // CAS updates p16 so we begin our retry after the load. ldr p16, [\reg] Lretry_release_\reg: #else Lretry_release_\reg: // stxr does not update p16 so we need to reload it when retrying. ldxr p16, [\reg] #endif and \maskedIsaReg, p16, #ISA_MASK_NOSIG // maskedIsaReg contains the actual class pointer. ldr p17, [\maskedIsaReg, #CLASS_BITS_OFFSET] // maskedIsaReg contains the class's `bits` field. // If hasCustomRR, call swift_release or msgSend release. This code // expects the raw isa value in p16 and `bits` in p17. tbz p17, HAS_DEFAULT_RR_BIT, LcustomRR_release_\reg tbz p16, NONPOINTER_ISA_BIT, LrawISA_release_\reg // If raw isa pointer, call into C. // We now have: // * Raw isa field in p16. // * Object with nonpointer isa. // * And no custom RR override. // Check for deallocating. An object is deallocating when its inline // refcount is 0 and has_sidetable is 0. These fields are contiguous // at the top of the isa field, so we shift away the other bits and then // compare with zero. lsr p17, p16, #RC_HAS_SIDETABLE_BIT cbz p17, Ldeallocating_release // If the inline refcount is zero and we have a sidetable, then we need // to call rootRelease to borrow from the sidetable. cmp p17, #1 b.eq Lcall_root_release_\reg // We're ready to actually perform the release. Next steps: // * Decrement the inline refcount. // * CAS the isa field. // * Check for zero. mov p17, RC_ONE sub p17, p16, p17 // isa -= RC_ONE #if USE_CAS mov \casReg, p16 cas p16, p17, [\reg] // Try to store the updated value. cmp \casReg, p16 b.ne Lretry_release_\reg // On failure, retry. p16 has been loaded with the latest value. #else // Store the new isa into the object. stxr w16, p17, [\reg] // Try to store the updated value. cbnz w16, Lretry_release_\reg // On failure, retry. #endif // Success. Did we transition to deallocating? If so, call dealloc. lsr p17, p17, #RC_HAS_SIDETABLE_BIT cbz p17, Ldealloc_\reg ret Ldealloc_\reg: // Successfully stored a deallocating isa into the object. Send dealloc // or _objc_initiateDealloc. // At this point, we have: // Masked isa in maskedIsaReg. // self in p0. ldr x17, [\maskedIsaReg, #CLASS_CACHE_FLAGS_OFFSET] adrp x1, LDeallocRef@PAGE ldr x1, [x1, LDeallocRef@PAGEOFF] adrp x2, LInitiateDeallocRef@PAGE ldr x2, [x2, LInitiateDeallocRef@PAGEOFF] tst x17, #CLASS_CACHE_FLAG_HAS_CUSTOM_DEALLOC_INITIATION csel x1, x1, x2, eq b _objc_msgSend Lcall_root_release_\reg: CLREX b __objc_rootRelease // Call swift_release or objc_msgSend. LcustomRR_release_\reg: CLREX // Check the isSwiftStable bit, msgSend if this class isn't Swift. tbz p17, IS_SWIFT_STABLE_BIT, LmsgSend_release // Load the Swift class flags into p17. and p17, p16, #ISA_MASK_NOSIG // p17 contains the actual class pointer. ldr w17, [p17, #SWIFT_CLASS_FLAGS_OFFSET] // If this class doesn't use Swift refcounting, msgSend. tbz w17, SWIFT_CLASS_FLAG_USES_SWIFT_REFCOUNTING_BIT, LmsgSend_release // The class uses Swift refcounting. Call the pointer in swiftRetain. adrp x17, _swiftRelease@PAGE ldr x17, [x17, _swiftRelease@PAGEOFF] TailCallFunctionPointer x17 LrawISA_release_\reg: // The object has a raw isa pointer, call into C for that. CLREX b _objc_release_full .endmacro Ldeallocating_release: // Clear our exclusive load of the isa before returning. CLREX LnilOrTagged_release: // For nil/tagged/deallocating objects, release is a no-op. ret LmsgSend_release: adrp x1, LReleaseRef@PAGE ldr x1, [x1, LReleaseRef@PAGEOFF] b _objc_msgSend .globl _objc_release _objc_release: ReleaseFunction x0 ReleaseFunction x1 ReleaseFunction x2 ReleaseFunction x3 ReleaseFunction x4 ReleaseFunction x5 ReleaseFunction x6 ReleaseFunction x7 ReleaseFunction x8 ReleaseFunction x9 ReleaseFunction x10 ReleaseFunction x11 ReleaseFunction x12 ReleaseFunction x13 ReleaseFunction x14 ReleaseFunction x15 ReleaseFunction x19 ReleaseFunction x20 ReleaseFunction x21 ReleaseFunction x22 ReleaseFunction x23 ReleaseFunction x24 ReleaseFunction x25 ReleaseFunction x26 ReleaseFunction x27 ReleaseFunction x28 #else // When !INLINE_RR_FASTPATH, generate simple thunks that call into objc_retain/release. .macro RetainFunction reg .text .align 2 .globl _objc_retain_\reg _objc_retain_\reg: mov x0, \reg b _objc_retain .endmacro .macro ReleaseFunction reg .text .align 2 .globl _objc_release_\reg _objc_release_\reg: mov x0, \reg b _objc_release .endmacro RetainFunction x1 RetainFunction x2 RetainFunction x3 RetainFunction x4 RetainFunction x5 RetainFunction x6 RetainFunction x7 RetainFunction x8 RetainFunction x9 RetainFunction x10 RetainFunction x11 RetainFunction x12 RetainFunction x13 RetainFunction x14 RetainFunction x15 RetainFunction x19 RetainFunction x20 RetainFunction x21 RetainFunction x22 RetainFunction x23 RetainFunction x24 RetainFunction x25 RetainFunction x26 RetainFunction x27 RetainFunction x28 ReleaseFunction x1 ReleaseFunction x2 ReleaseFunction x3 ReleaseFunction x4 ReleaseFunction x5 ReleaseFunction x6 ReleaseFunction x7 ReleaseFunction x8 ReleaseFunction x9 ReleaseFunction x10 ReleaseFunction x11 ReleaseFunction x12 ReleaseFunction x13 ReleaseFunction x14 ReleaseFunction x15 ReleaseFunction x19 ReleaseFunction x20 ReleaseFunction x21 ReleaseFunction x22 ReleaseFunction x23 ReleaseFunction x24 ReleaseFunction x25 ReleaseFunction x26 ReleaseFunction x27 ReleaseFunction x28 #endif // INLINE_RR_FASTPATH #endif
MrOwlSage/objc4-906
28,752
runtime/Messengers.subproj/objc-msg-simulator-x86_64.s
/* * Copyright (c) 1999-2007 Apple Inc. All Rights Reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #include <TargetConditionals.h> #if __x86_64__ && TARGET_OS_SIMULATOR && !TARGET_OS_MACCATALYST /******************************************************************** ******************************************************************** ** ** objc-msg-x86_64.s - x86-64 code to support objc messaging. ** ******************************************************************** ********************************************************************/ .data // _objc_restartableRanges is used by method dispatch // to get the critical regions for which method caches // cannot be garbage collected. .macro RestartableEntry .quad $0 .short LExit$0 - $0 .short 0xffff // The simulator doesn't support kernel based recovery .long 0 .endmacro .align 4 .private_extern _objc_restartableRanges _objc_restartableRanges: RestartableEntry _cache_getImp RestartableEntry _objc_msgSend RestartableEntry _objc_msgSend_fpret RestartableEntry _objc_msgSend_fp2ret RestartableEntry _objc_msgSend_stret RestartableEntry _objc_msgSendSuper RestartableEntry _objc_msgSendSuper_stret RestartableEntry _objc_msgSendSuper2 RestartableEntry _objc_msgSendSuper2_stret RestartableEntry _objc_msgLookup RestartableEntry _objc_msgLookup_fpret RestartableEntry _objc_msgLookup_fp2ret RestartableEntry _objc_msgLookup_stret RestartableEntry _objc_msgLookupSuper2 RestartableEntry _objc_msgLookupSuper2_stret .fill 16, 1, 0 /******************************************************************** * Recommended multi-byte NOP instructions * (Intel 64 and IA-32 Architectures Software Developer's Manual Volume 2B) ********************************************************************/ #define nop1 .byte 0x90 #define nop2 .byte 0x66,0x90 #define nop3 .byte 0x0F,0x1F,0x00 #define nop4 .byte 0x0F,0x1F,0x40,0x00 #define nop5 .byte 0x0F,0x1F,0x44,0x00,0x00 #define nop6 .byte 0x66,0x0F,0x1F,0x44,0x00,0x00 #define nop7 .byte 0x0F,0x1F,0x80,0x00,0x00,0x00,0x00 #define nop8 .byte 0x0F,0x1F,0x84,0x00,0x00,0x00,0x00,0x00 #define nop9 .byte 0x66,0x0F,0x1F,0x84,0x00,0x00,0x00,0x00,0x00 /******************************************************************** * Names for parameter registers. ********************************************************************/ #define a1 rdi #define a1d edi #define a1b dil #define a2 rsi #define a2d esi #define a2b sil #define a3 rdx #define a3d edx #define a3b dl #define a4 rcx #define a4d ecx #define a5 r8 #define a5d r8d #define a6 r9 #define a6d r9d /******************************************************************** * Names for relative labels * DO NOT USE THESE LABELS ELSEWHERE * Reserved labels: 6: 7: 8: 9: ********************************************************************/ #define LCacheMiss 6 #define LCacheMiss_f 6f #define LCacheMiss_b 6b #define LGetIsaDone 7 #define LGetIsaDone_f 7f #define LGetIsaDone_b 7b #define LNilOrTagged 8 #define LNilOrTagged_f 8f #define LNilOrTagged_b 8b #define LNil 9 #define LNil_f 9f #define LNil_b 9b /******************************************************************** * Macro parameters ********************************************************************/ #define NORMAL 0 #define FPRET 1 #define FP2RET 2 #define STRET 3 #define CALL 100 #define GETIMP 101 #define LOOKUP 102 #define MSGSEND 200 #define METHOD_INVOKE 201 #define METHOD_INVOKE_STRET 202 /******************************************************************** * * Structure definitions. * ********************************************************************/ // objc_super parameter to sendSuper #define receiver 0 #define class 8 // Selected field offsets in class structure // #define isa 0 USE GetIsa INSTEAD // Method descriptor #define method_name 0 #define method_imp 16 // Method cache #define cached_sel 0 #define cached_imp 8 ////////////////////////////////////////////////////////////////////// // // ENTRY functionName // // Assembly directives to begin an exported function. // // Takes: functionName - name of the exported function ////////////////////////////////////////////////////////////////////// .macro ENTRY .text .globl $0 .align 6, 0x90 $0: .endmacro .macro STATIC_ENTRY .text .private_extern $0 .align 2, 0x90 $0: .endmacro ////////////////////////////////////////////////////////////////////// // // END_ENTRY functionName // // Assembly directives to end an exported function. Just a placeholder, // a close-parenthesis for ENTRY, until it is needed for something. // // Takes: functionName - name of the exported function ////////////////////////////////////////////////////////////////////// .macro END_ENTRY LExit$0: .endmacro /******************************************************************** * UNWIND name, flags * Unwind info generation ********************************************************************/ .macro UNWIND .section __LD,__compact_unwind,regular,debug .quad $0 .set LUnwind$0, LExit$0 - $0 .long LUnwind$0 .long $1 .quad 0 /* no personality */ .quad 0 /* no LSDA */ .text .endmacro #define NoFrame 0x02010000 // no frame, no SP adjustment except return address #define FrameWithNoSaves 0x01000000 // frame, no non-volatile saves ////////////////////////////////////////////////////////////////////// // // SAVE_REGS // // Create a stack frame and save all argument registers in preparation // for a function call. ////////////////////////////////////////////////////////////////////// .macro SAVE_REGS kind .if \kind != MSGSEND && \kind != METHOD_INVOKE && \kind != METHOD_INVOKE_STRET .abort Unknown kind. .endif push %rbp mov %rsp, %rbp sub $0x80, %rsp movdqa %xmm0, -0x80(%rbp) push %rax // might be xmm parameter count movdqa %xmm1, -0x70(%rbp) push %a1 movdqa %xmm2, -0x60(%rbp) .if \kind == MSGSEND || \kind == METHOD_INVOKE_STRET push %a2 .endif movdqa %xmm3, -0x50(%rbp) .if \kind == MSGSEND || \kind == METHOD_INVOKE push %a3 .endif movdqa %xmm4, -0x40(%rbp) push %a4 movdqa %xmm5, -0x30(%rbp) push %a5 movdqa %xmm6, -0x20(%rbp) push %a6 movdqa %xmm7, -0x10(%rbp) .if \kind == MSGSEND push %r10 .endif .endmacro ////////////////////////////////////////////////////////////////////// // // RESTORE_REGS // // Restore all argument registers and pop the stack frame created by // SAVE_REGS. ////////////////////////////////////////////////////////////////////// .macro RESTORE_REGS kind .if \kind == MSGSEND pop %r10 orq $2, %r10 // for the sake of instrumentations, remember it was the slowpath .endif movdqa -0x80(%rbp), %xmm0 pop %a6 movdqa -0x70(%rbp), %xmm1 pop %a5 movdqa -0x60(%rbp), %xmm2 pop %a4 movdqa -0x50(%rbp), %xmm3 .if \kind == MSGSEND || \kind == METHOD_INVOKE pop %a3 .endif movdqa -0x40(%rbp), %xmm4 .if \kind == MSGSEND || \kind == METHOD_INVOKE_STRET pop %a2 .endif movdqa -0x30(%rbp), %xmm5 pop %a1 movdqa -0x20(%rbp), %xmm6 pop %rax movdqa -0x10(%rbp), %xmm7 leave .endmacro ///////////////////////////////////////////////////////////////////// // // CacheLookup return-type, caller // // Locate the implementation for a class in a selector's method cache. // // Takes: // $0 = NORMAL, FPRET, FP2RET, STRET // $1 = CALL, LOOKUP, GETIMP // a1 or a2 (STRET) = receiver // a2 or a3 (STRET) = selector // r10 = class to search // // On exit: r10 clobbered // (found) calls or returns IMP in r11, eq/ne set for forwarding // (not found) jumps to LCacheMiss, class still in r10 // ///////////////////////////////////////////////////////////////////// .macro CacheHit // r11 = found bucket .if $1 == GETIMP movq cached_imp(%r11), %rax // return imp cmpq $$0, %rax jz 9f // don't xor a nil imp xorq %r10, %rax // xor the isa with the imp 9: ret .else .if $1 == CALL movq cached_imp(%r11), %r11 // load imp xorq %r10, %r11 // xor imp and isa .if $0 != STRET // ne already set for forwarding by `xor` .else cmp %r11, %r11 // set eq for stret forwarding .endif jmp *%r11 // call imp .elseif $1 == LOOKUP movq cached_imp(%r11), %r11 xorq %r10, %r11 // return imp ^ isa ret .else .abort oops .endif .endif .endmacro .macro CacheLookup .if $0 != STRET movq %a2, %r11 // r11 = _cmd .else movq %a3, %r11 // r11 = _cmd .endif andl 24(%r10), %r11d // r11 = _cmd & class->cache.mask shlq $$4, %r11 // r11 = offset = (_cmd & mask)<<4 addq 16(%r10), %r11 // r11 = class->cache.buckets + offset .if $0 != STRET cmpq cached_sel(%r11), %a2 // if (bucket->sel != _cmd) .else cmpq cached_sel(%r11), %a3 // if (bucket->sel != _cmd) .endif jne 1f // scan more CacheHit $0, $1 // call or return imp 1: // loop cmpq $$1, cached_sel(%r11) jbe 3f // if (bucket->sel <= 1) wrap or miss addq $$16, %r11 // bucket++ 2: .if $0 != STRET cmpq cached_sel(%r11), %a2 // if (bucket->sel != _cmd) .else cmpq cached_sel(%r11), %a3 // if (bucket->sel != _cmd) .endif jne 1b // scan more CacheHit $0, $1 // call or return imp 3: // wrap or miss jb LCacheMiss_f // if (bucket->sel < 1) cache miss // wrap movq cached_imp(%r11), %r11 // bucket->imp is really first bucket jmp 2f // Clone scanning loop to miss instead of hang when cache is corrupt. // The slow path may detect any corruption and halt later. 1: // loop cmpq $$1, cached_sel(%r11) jbe 3f // if (bucket->sel <= 1) wrap or miss addq $$16, %r11 // bucket++ 2: .if $0 != STRET cmpq cached_sel(%r11), %a2 // if (bucket->sel != _cmd) .else cmpq cached_sel(%r11), %a3 // if (bucket->sel != _cmd) .endif jne 1b // scan more CacheHit $0, $1 // call or return imp 3: // double wrap or miss jmp LCacheMiss_f .endmacro ///////////////////////////////////////////////////////////////////// // // MethodTableLookup NORMAL|STRET // // Takes: a1 or a2 (STRET) = receiver // a2 or a3 (STRET) = selector to search for // r10 = class to search // // On exit: imp in %r11, eq/ne set for forwarding // ///////////////////////////////////////////////////////////////////// .macro MethodTableLookup SAVE_REGS MSGSEND // lookUpImpOrForward(obj, sel, cls, LOOKUP_INITIALIZE | LOOKUP_RESOLVER) .if $0 == NORMAL // receiver already in a1 // selector already in a2 .else movq %a2, %a1 movq %a3, %a2 .endif movq %r10, %a3 movl $$3, %a4d call _lookUpImpOrForward // IMP is now in %rax movq %rax, %r11 RESTORE_REGS MSGSEND .if $0 == NORMAL test %r11, %r11 // set ne for stret forwarding .else cmp %r11, %r11 // set eq for nonstret forwarding .endif .endmacro ///////////////////////////////////////////////////////////////////// // // GetIsaCheckNil return-type // GetIsaSupport return-type // NilTestReturnZero return-type // NilTestReturnIMP return-type // // Sets r10 = obj->isa. // Looks up the real class if receiver is a tagged pointer object. // Returns zero or a zero-returning IMP if obj is nil. // // Takes: $0 = NORMAL or FPRET or FP2RET or STRET // a1 or a2 (STRET) = receiver // // On exit from GetIsaCheckNil: // r10 = receiver->isa // r11 is clobbered // ///////////////////////////////////////////////////////////////////// .macro ZeroReturn xorl %eax, %eax xorl %edx, %edx xorps %xmm0, %xmm0 xorps %xmm1, %xmm1 .endmacro .macro ZeroReturnFPRET fldz ZeroReturn .endmacro .macro ZeroReturnFP2RET fldz fldz ZeroReturn .endmacro .macro ZeroReturnSTRET // rax gets the struct-return address as passed in rdi movq %rdi, %rax .endmacro STATIC_ENTRY __objc_msgNil ZeroReturn ret END_ENTRY __objc_msgNil STATIC_ENTRY __objc_msgNil_fpret ZeroReturnFPRET ret END_ENTRY __objc_msgNil_fpret STATIC_ENTRY __objc_msgNil_fp2ret ZeroReturnFP2RET ret END_ENTRY __objc_msgNil_fp2ret STATIC_ENTRY __objc_msgNil_stret ZeroReturnSTRET ret END_ENTRY __objc_msgNil_stret .macro GetIsaCheckNil .if $0 != STRET testq %a1, %a1 .else testq %a2, %a2 .endif jle LNilOrTagged_f // MSB tagged pointer looks negative .if $0 != STRET movq (%a1), %r10 // r10 = isa .else movq (%a2), %r10 // r10 = isa .endif LGetIsaDone: .endmacro .macro GetIsaSupport .align 3 LNilOrTagged: jz LNil_f // flags set by GetIsaCheckNil .if $0 != STRET movq %a1, %r11 .else movq %a2, %r11 .endif // basic tagged shrq $$60, %r11 leaq _objc_debug_taggedpointer_classes(%rip), %r10 movq (%r10, %r11, 8), %r10 // read isa from table leaq _OBJC_CLASS_$___NSUnrecognizedTaggedPointer(%rip), %r11 cmp %r10, %r11 jne LGetIsaDone_b // ext tagged .if $0 != STRET movq %a1, %r11 .else movq %a2, %r11 .endif shrq $$52, %r11 andl $$0xff, %r11d leaq _objc_debug_taggedpointer_ext_classes(%rip), %r10 movq (%r10, %r11, 8), %r10 // read isa from table jmp LGetIsaDone_b .endmacro .macro NilTestReturnZero LNil: .if $0 == NORMAL ZeroReturn .elseif $0 == FPRET ZeroReturnFPRET .elseif $0 == FP2RET ZeroReturnFP2RET .elseif $0 == STRET ZeroReturnSTRET .else .abort oops .endif ret .endmacro .macro NilTestReturnIMP LNil: .if $0 == NORMAL leaq __objc_msgNil(%rip), %r11 .elseif $0 == FPRET leaq __objc_msgNil_fpret(%rip), %r11 .elseif $0 == FP2RET leaq __objc_msgNil_fp2ret(%rip), %r11 .elseif $0 == STRET leaq __objc_msgNil_stret(%rip), %r11 .else .abort oops .endif ret .endmacro /******************************************************************** * IMP cache_getImp(Class cls, SEL sel) * * On entry: a1 = class whose cache is to be searched * a2 = selector to search for * * If found, returns method implementation. * If not found, returns NULL. ********************************************************************/ STATIC_ENTRY _cache_getImp // do lookup movq %a1, %r10 // move class to r10 for CacheLookup CacheLookup NORMAL, GETIMP // returns IMP on success LCacheMiss: // cache miss, return nil xorl %eax, %eax ret END_ENTRY _cache_getImp /******************************************************************** * * id objc_msgSend(id self, SEL _cmd,...); * IMP objc_msgLookup(id self, SEL _cmd, ...); * * objc_msgLookup ABI: * IMP returned in r11 * Forwarding returned in Z flag * r10 reserved for our use but not used * ********************************************************************/ .data .align 3 .globl _objc_debug_taggedpointer_classes _objc_debug_taggedpointer_classes: .fill 16, 8, 0 .globl _objc_debug_taggedpointer_ext_classes _objc_debug_taggedpointer_ext_classes: .fill 256, 8, 0 ENTRY _objc_msgSend UNWIND _objc_msgSend, NoFrame GetIsaCheckNil NORMAL // r10 = self->isa, or return zero CacheLookup NORMAL, CALL // calls IMP on success GetIsaSupport NORMAL NilTestReturnZero NORMAL // cache miss: go search the method lists LCacheMiss: // isa still in r10 jmp __objc_msgSend_uncached END_ENTRY _objc_msgSend ENTRY _objc_msgLookup GetIsaCheckNil NORMAL // r10 = self->isa, or return zero IMP CacheLookup NORMAL, LOOKUP // returns IMP on success GetIsaSupport NORMAL NilTestReturnIMP NORMAL // cache miss: go search the method lists LCacheMiss: // isa still in r10 jmp __objc_msgLookup_uncached END_ENTRY _objc_msgLookup ENTRY _objc_msgSend_fixup int3 END_ENTRY _objc_msgSend_fixup STATIC_ENTRY _objc_msgSend_fixedup // Load _cmd from the message_ref movq 8(%a2), %a2 jmp _objc_msgSend END_ENTRY _objc_msgSend_fixedup /******************************************************************** * * id objc_msgSendSuper(struct objc_super *super, SEL _cmd,...); * * struct objc_super { * id receiver; * Class class; * }; ********************************************************************/ ENTRY _objc_msgSendSuper UNWIND _objc_msgSendSuper, NoFrame // search the cache (objc_super in %a1) movq class(%a1), %r10 // class = objc_super->class movq receiver(%a1), %a1 // load real receiver CacheLookup NORMAL, CALL // calls IMP on success // cache miss: go search the method lists LCacheMiss: // class still in r10 jmp __objc_msgSend_uncached END_ENTRY _objc_msgSendSuper /******************************************************************** * id objc_msgSendSuper2 ********************************************************************/ ENTRY _objc_msgSendSuper2 UNWIND _objc_msgSendSuper2, NoFrame // objc_super->class is subclass of class to search // search the cache (objc_super in %a1) movq class(%a1), %r10 // cls = objc_super->class movq receiver(%a1), %a1 // load real receiver movq 8(%r10), %r10 // cls = class->superclass CacheLookup NORMAL, CALL // calls IMP on success // cache miss: go search the method lists LCacheMiss: // superclass still in r10 jmp __objc_msgSend_uncached END_ENTRY _objc_msgSendSuper2 ENTRY _objc_msgLookupSuper2 // objc_super->class is subclass of class to search // search the cache (objc_super in %a1) movq class(%a1), %r10 // cls = objc_super->class movq receiver(%a1), %a1 // load real receiver movq 8(%r10), %r10 // cls = class->superclass CacheLookup NORMAL, LOOKUP // returns IMP on success // cache miss: go search the method lists LCacheMiss: // superclass still in r10 jmp __objc_msgLookup_uncached END_ENTRY _objc_msgLookupSuper2 ENTRY _objc_msgSendSuper2_fixup int3 END_ENTRY _objc_msgSendSuper2_fixup STATIC_ENTRY _objc_msgSendSuper2_fixedup // Load _cmd from the message_ref movq 8(%a2), %a2 jmp _objc_msgSendSuper2 END_ENTRY _objc_msgSendSuper2_fixedup /******************************************************************** * * double objc_msgSend_fpret(id self, SEL _cmd,...); * Used for `long double` return only. `float` and `double` use objc_msgSend. * ********************************************************************/ ENTRY _objc_msgSend_fpret UNWIND _objc_msgSend_fpret, NoFrame GetIsaCheckNil FPRET // r10 = self->isa, or return zero CacheLookup FPRET, CALL // calls IMP on success GetIsaSupport FPRET NilTestReturnZero FPRET // cache miss: go search the method lists LCacheMiss: // isa still in r10 jmp __objc_msgSend_uncached END_ENTRY _objc_msgSend_fpret ENTRY _objc_msgLookup_fpret GetIsaCheckNil FPRET // r10 = self->isa, or return zero IMP CacheLookup FPRET, LOOKUP // returns IMP on success GetIsaSupport FPRET NilTestReturnIMP FPRET // cache miss: go search the method lists LCacheMiss: // isa still in r10 jmp __objc_msgLookup_uncached END_ENTRY _objc_msgLookup_fpret ENTRY _objc_msgSend_fpret_fixup int3 END_ENTRY _objc_msgSend_fpret_fixup STATIC_ENTRY _objc_msgSend_fpret_fixedup // Load _cmd from the message_ref movq 8(%a2), %a2 jmp _objc_msgSend_fpret END_ENTRY _objc_msgSend_fpret_fixedup /******************************************************************** * * double objc_msgSend_fp2ret(id self, SEL _cmd,...); * Used for `complex long double` return only. * ********************************************************************/ ENTRY _objc_msgSend_fp2ret UNWIND _objc_msgSend_fp2ret, NoFrame GetIsaCheckNil FP2RET // r10 = self->isa, or return zero CacheLookup FP2RET, CALL // calls IMP on success GetIsaSupport FP2RET NilTestReturnZero FP2RET // cache miss: go search the method lists LCacheMiss: // isa still in r10 jmp __objc_msgSend_uncached END_ENTRY _objc_msgSend_fp2ret ENTRY _objc_msgLookup_fp2ret GetIsaCheckNil FP2RET // r10 = self->isa, or return zero IMP CacheLookup FP2RET, LOOKUP // returns IMP on success GetIsaSupport FP2RET NilTestReturnIMP FP2RET // cache miss: go search the method lists LCacheMiss: // isa still in r10 jmp __objc_msgLookup_uncached END_ENTRY _objc_msgLookup_fp2ret ENTRY _objc_msgSend_fp2ret_fixup int3 END_ENTRY _objc_msgSend_fp2ret_fixup STATIC_ENTRY _objc_msgSend_fp2ret_fixedup // Load _cmd from the message_ref movq 8(%a2), %a2 jmp _objc_msgSend_fp2ret END_ENTRY _objc_msgSend_fp2ret_fixedup /******************************************************************** * * void objc_msgSend_stret(void *st_addr, id self, SEL _cmd, ...); * * objc_msgSend_stret is the struct-return form of msgSend. * The ABI calls for %a1 to be used as the address of the structure * being returned, with the parameters in the succeeding locations. * * On entry: %a1 is the address where the structure is returned, * %a2 is the message receiver, * %a3 is the selector ********************************************************************/ ENTRY _objc_msgSend_stret UNWIND _objc_msgSend_stret, NoFrame GetIsaCheckNil STRET // r10 = self->isa, or return zero CacheLookup STRET, CALL // calls IMP on success GetIsaSupport STRET NilTestReturnZero STRET // cache miss: go search the method lists LCacheMiss: // isa still in r10 jmp __objc_msgSend_stret_uncached END_ENTRY _objc_msgSend_stret ENTRY _objc_msgLookup_stret GetIsaCheckNil STRET // r10 = self->isa, or return zero IMP CacheLookup STRET, LOOKUP // returns IMP on success GetIsaSupport STRET NilTestReturnIMP STRET // cache miss: go search the method lists LCacheMiss: // isa still in r10 jmp __objc_msgLookup_stret_uncached END_ENTRY _objc_msgLookup_stret ENTRY _objc_msgSend_stret_fixup int3 END_ENTRY _objc_msgSend_stret_fixup STATIC_ENTRY _objc_msgSend_stret_fixedup // Load _cmd from the message_ref movq 8(%a3), %a3 jmp _objc_msgSend_stret END_ENTRY _objc_msgSend_stret_fixedup /******************************************************************** * * void objc_msgSendSuper_stret(void *st_addr, struct objc_super *super, SEL _cmd, ...); * * struct objc_super { * id receiver; * Class class; * }; * * objc_msgSendSuper_stret is the struct-return form of msgSendSuper. * The ABI calls for (sp+4) to be used as the address of the structure * being returned, with the parameters in the succeeding registers. * * On entry: %a1 is the address where the structure is returned, * %a2 is the address of the objc_super structure, * %a3 is the selector * ********************************************************************/ ENTRY _objc_msgSendSuper_stret UNWIND _objc_msgSendSuper_stret, NoFrame // search the cache (objc_super in %a2) movq class(%a2), %r10 // class = objc_super->class movq receiver(%a2), %a2 // load real receiver CacheLookup STRET, CALL // calls IMP on success // cache miss: go search the method lists LCacheMiss: // class still in r10 jmp __objc_msgSend_stret_uncached END_ENTRY _objc_msgSendSuper_stret /******************************************************************** * id objc_msgSendSuper2_stret ********************************************************************/ ENTRY _objc_msgSendSuper2_stret UNWIND _objc_msgSendSuper2_stret, NoFrame // search the cache (objc_super in %a2) movq class(%a2), %r10 // class = objc_super->class movq receiver(%a2), %a2 // load real receiver movq 8(%r10), %r10 // class = class->superclass CacheLookup STRET, CALL // calls IMP on success // cache miss: go search the method lists LCacheMiss: // superclass still in r10 jmp __objc_msgSend_stret_uncached END_ENTRY _objc_msgSendSuper2_stret ENTRY _objc_msgLookupSuper2_stret // search the cache (objc_super in %a2) movq class(%a2), %r10 // class = objc_super->class movq receiver(%a2), %a2 // load real receiver movq 8(%r10), %r10 // class = class->superclass CacheLookup STRET, LOOKUP // returns IMP on success // cache miss: go search the method lists LCacheMiss: // superclass still in r10 jmp __objc_msgLookup_stret_uncached END_ENTRY _objc_msgLookupSuper2_stret ENTRY _objc_msgSendSuper2_stret_fixup int3 END_ENTRY _objc_msgSendSuper2_stret_fixup STATIC_ENTRY _objc_msgSendSuper2_stret_fixedup // Load _cmd from the message_ref movq 8(%a3), %a3 jmp _objc_msgSendSuper2_stret END_ENTRY _objc_msgSendSuper2_stret_fixedup /******************************************************************** * * _objc_msgSend_uncached * _objc_msgSend_stret_uncached * The uncached method lookup. * ********************************************************************/ STATIC_ENTRY __objc_msgSend_uncached UNWIND __objc_msgSend_uncached, FrameWithNoSaves // THIS IS NOT A CALLABLE C FUNCTION // Out-of-band r10 is the searched class // r10 is already the class to search MethodTableLookup NORMAL // r11 = IMP jmp *%r11 // goto *imp END_ENTRY __objc_msgSend_uncached STATIC_ENTRY __objc_msgSend_stret_uncached UNWIND __objc_msgSend_stret_uncached, FrameWithNoSaves // THIS IS NOT A CALLABLE C FUNCTION // Out-of-band r10 is the searched class // r10 is already the class to search MethodTableLookup STRET // r11 = IMP jmp *%r11 // goto *imp END_ENTRY __objc_msgSend_stret_uncached STATIC_ENTRY __objc_msgLookup_uncached UNWIND __objc_msgLookup_uncached, FrameWithNoSaves // THIS IS NOT A CALLABLE C FUNCTION // Out-of-band r10 is the searched class // r10 is already the class to search MethodTableLookup NORMAL // r11 = IMP ret END_ENTRY __objc_msgLookup_uncached STATIC_ENTRY __objc_msgLookup_stret_uncached UNWIND __objc_msgLookup_stret_uncached, FrameWithNoSaves // THIS IS NOT A CALLABLE C FUNCTION // Out-of-band r10 is the searched class // r10 is already the class to search MethodTableLookup STRET // r11 = IMP ret END_ENTRY __objc_msgLookup_stret_uncached /******************************************************************** * * id _objc_msgForward(id self, SEL _cmd,...); * * _objc_msgForward and _objc_msgForward_stret are the externally-callable * functions returned by things like method_getImplementation(). * _objc_msgForward_impcache is the function pointer actually stored in * method caches. * ********************************************************************/ STATIC_ENTRY __objc_msgForward_impcache // Method cache version // THIS IS NOT A CALLABLE C FUNCTION // Out-of-band condition register is NE for stret, EQ otherwise. je __objc_msgForward_stret jmp __objc_msgForward END_ENTRY __objc_msgForward_impcache ENTRY __objc_msgForward // Non-stret version movq __objc_forward_handler(%rip), %r11 jmp *%r11 END_ENTRY __objc_msgForward ENTRY __objc_msgForward_stret // Struct-return version movq __objc_forward_stret_handler(%rip), %r11 jmp *%r11 END_ENTRY __objc_msgForward_stret ENTRY _objc_msgSend_debug jmp _objc_msgSend END_ENTRY _objc_msgSend_debug ENTRY _objc_msgSendSuper2_debug jmp _objc_msgSendSuper2 END_ENTRY _objc_msgSendSuper2_debug ENTRY _objc_msgSend_stret_debug jmp _objc_msgSend_stret END_ENTRY _objc_msgSend_stret_debug ENTRY _objc_msgSendSuper2_stret_debug jmp _objc_msgSendSuper2_stret END_ENTRY _objc_msgSendSuper2_stret_debug ENTRY _objc_msgSend_fpret_debug jmp _objc_msgSend_fpret END_ENTRY _objc_msgSend_fpret_debug ENTRY _objc_msgSend_fp2ret_debug jmp _objc_msgSend_fp2ret END_ENTRY _objc_msgSend_fp2ret_debug ENTRY _objc_msgSend_noarg jmp _objc_msgSend END_ENTRY _objc_msgSend_noarg ENTRY _method_invoke // See if this is a small method. testb $1, %a2b jnz L_method_invoke_small // We can directly load the IMP from big methods. movq method_imp(%a2), %r11 movq method_name(%a2), %a2 jmp *%r11 L_method_invoke_small: // Small methods require a call to handle swizzling. SAVE_REGS METHOD_INVOKE movq %a2, %a1 call __method_getImplementationAndName movq %rdx, %a2 movq %rax, %r11 RESTORE_REGS METHOD_INVOKE jmp *%r11 END_ENTRY _method_invoke ENTRY _method_invoke_stret // See if this is a small method. testb $1, %a3b jnz L_method_invoke_stret_small // We can directly load the IMP from big methods. movq method_imp(%a3), %r11 movq method_name(%a3), %a3 jmp *%r11 L_method_invoke_stret_small: // Small methods require a call to handle swizzling. SAVE_REGS METHOD_INVOKE_STRET movq %a3, %a1 call __method_getImplementationAndName movq %rdx, %a3 movq %rax, %r11 RESTORE_REGS METHOD_INVOKE_STRET jmp *%r11 END_ENTRY _method_invoke_stret .section __DATA,__objc_msg_break .quad 0 .quad 0 #endif
MrOwlSage/objc4-906
31,151
runtime/Messengers.subproj/objc-msg-i386.s
/* * Copyright (c) 1999-2007 Apple Inc. All Rights Reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #include <TargetConditionals.h> #if defined(__i386__) && !TARGET_OS_SIMULATOR /******************************************************************** ******************************************************************** ** ** objc-msg-i386.s - i386 code to support objc messaging. ** ******************************************************************** ********************************************************************/ /******************************************************************** * Data used by the ObjC runtime. * ********************************************************************/ .data // _objc_restartableRanges is used by method dispatch // to get the critical regions for which method caches // cannot be garbage collected. .macro RestartableEntry .long $0 .long 0 .short $1 - $0 .short 0xffff // The old runtime doesn't support kernel based recovery .long 0 .endmacro .align 4 .private_extern _objc_restartableRanges _objc_restartableRanges: RestartableEntry __cache_getImp, LGetImpExit RestartableEntry __cache_getMethod, LGetMethodExit RestartableEntry _objc_msgSend, LMsgSendExit RestartableEntry _objc_msgSend_fpret, LMsgSendFpretExit RestartableEntry _objc_msgSend_stret, LMsgSendStretExit RestartableEntry _objc_msgSendSuper, LMsgSendSuperExit RestartableEntry _objc_msgSendSuper_stret, LMsgSendSuperStretExit .fill 16, 1, 0 /******************************************************************** * * Common offsets. * ********************************************************************/ self = 4 super = 4 selector = 8 marg_size = 12 marg_list = 16 first_arg = 12 struct_addr = 4 self_stret = 8 super_stret = 8 selector_stret = 12 marg_size_stret = 16 marg_list_stret = 20 /******************************************************************** * * Structure definitions. * ********************************************************************/ // objc_super parameter to sendSuper receiver = 0 class = 4 // Selected field offsets in class structure isa = 0 cache = 32 // Method descriptor method_name = 0 method_imp = 8 // Cache header mask = 0 occupied = 4 buckets = 8 // variable length array #if defined(OBJC_INSTRUMENTED) // Cache instrumentation data, follows buckets hitCount = 0 hitProbes = hitCount + 4 maxHitProbes = hitProbes + 4 missCount = maxHitProbes + 4 missProbes = missCount + 4 maxMissProbes = missProbes + 4 flushCount = maxMissProbes + 4 flushedEntries = flushCount + 4 // Buckets in CacheHitHistogram and CacheMissHistogram CACHE_HISTOGRAM_SIZE = 512 #endif ////////////////////////////////////////////////////////////////////// // // ENTRY functionName // // Assembly directives to begin an exported function. // // Takes: functionName - name of the exported function ////////////////////////////////////////////////////////////////////// .macro ENTRY .text .globl $0 .align 4, 0x90 $0: .endmacro .macro STATIC_ENTRY .text .private_extern $0 .align 4, 0x90 $0: .endmacro ////////////////////////////////////////////////////////////////////// // // END_ENTRY functionName // // Assembly directives to end an exported function. Just a placeholder, // a close-parenthesis for ENTRY, until it is needed for something. // // Takes: functionName - name of the exported function ////////////////////////////////////////////////////////////////////// .macro END_ENTRY .endmacro ////////////////////////////////////////////////////////////////////// // // CALL_MCOUNTER // // Calls mcount() profiling routine. Must be called immediately on // function entry, before any prologue executes. // ////////////////////////////////////////////////////////////////////// .macro CALL_MCOUNTER #ifdef PROFILE // Current stack contents: ret pushl %ebp movl %esp,%ebp subl $$8,%esp // Current stack contents: ret, ebp, pad, pad call mcount movl %ebp,%esp popl %ebp #endif .endmacro ///////////////////////////////////////////////////////////////////// // // // CacheLookup WORD_RETURN | STRUCT_RETURN, MSG_SEND | MSG_SENDSUPER | CACHE_GET, cacheMissLabel // // Locate the implementation for a selector in a class method cache. // // Takes: WORD_RETURN (first parameter is at sp+4) // STRUCT_RETURN (struct address is at sp+4, first parameter at sp+8) // MSG_SEND (first parameter is receiver) // MSG_SENDSUPER (first parameter is address of objc_super structure) // CACHE_GET (first parameter is class; return method triplet) // selector in %ecx // class to search in %edx // // cacheMissLabel = label to branch to iff method is not cached // // On exit: (found) MSG_SEND and MSG_SENDSUPER: return imp in eax // (found) CACHE_GET: return method triplet in eax // (not found) jumps to cacheMissLabel // ///////////////////////////////////////////////////////////////////// // Values to specify to method lookup macros whether the return type of // the method is word or structure. WORD_RETURN = 0 STRUCT_RETURN = 1 // Values to specify to method lookup macros whether the first argument // is an object/class reference or a 'objc_super' structure. MSG_SEND = 0 // first argument is receiver, search the isa MSG_SENDSUPER = 1 // first argument is objc_super, search the class CACHE_GET = 2 // first argument is class, search that class .macro CacheLookup // load variables and save caller registers. pushl %edi // save scratch register movl cache(%edx), %edi // cache = class->cache pushl %esi // save scratch register #if defined(OBJC_INSTRUMENTED) pushl %ebx // save non-volatile register pushl %eax // save cache pointer xorl %ebx, %ebx // probeCount = 0 #endif movl mask(%edi), %esi // mask = cache->mask movl %ecx, %edx // index = selector shrl $$2, %edx // index = selector >> 2 // search the receiver's cache // ecx = selector // edi = cache // esi = mask // edx = index // eax = method (soon) LMsgSendProbeCache_$0_$1_$2: #if defined(OBJC_INSTRUMENTED) addl $$1, %ebx // probeCount += 1 #endif andl %esi, %edx // index &= mask movl buckets(%edi, %edx, 4), %eax // meth = cache->buckets[index] testl %eax, %eax // check for end of bucket je LMsgSendCacheMiss_$0_$1_$2 // go to cache miss code cmpl method_name(%eax), %ecx // check for method name match je LMsgSendCacheHit_$0_$1_$2 // go handle cache hit addl $$1, %edx // bump index ... jmp LMsgSendProbeCache_$0_$1_$2 // ... and loop // not found in cache: restore state and go to callers handler LMsgSendCacheMiss_$0_$1_$2: #if defined(OBJC_INSTRUMENTED) popl %edx // retrieve cache pointer movl mask(%edx), %esi // mask = cache->mask testl %esi, %esi // a mask of zero is only for the... je LMsgSendMissInstrumentDone_$0_$1_$2 // ... emptyCache, do not record anything // locate and update the CacheInstrumentation structure addl $$1, %esi // entryCount = mask + 1 shll $$2, %esi // tableSize = entryCount * sizeof(entry) addl $buckets, %esi // offset = buckets + tableSize addl %edx, %esi // cacheData = &cache->buckets[mask+1] movl missCount(%esi), %edi // addl $$1, %edi // movl %edi, missCount(%esi) // cacheData->missCount += 1 movl missProbes(%esi), %edi // addl %ebx, %edi // movl %edi, missProbes(%esi) // cacheData->missProbes += probeCount movl maxMissProbes(%esi), %edi// if (cacheData->maxMissProbes < probeCount) cmpl %ebx, %edi // jge LMsgSendMaxMissProbeOK_$0_$1_$2 // movl %ebx, maxMissProbes(%esi)// cacheData->maxMissProbes = probeCount LMsgSendMaxMissProbeOK_$0_$1_$2: // update cache miss probe histogram cmpl $CACHE_HISTOGRAM_SIZE, %ebx // pin probeCount to max index jl LMsgSendMissHistoIndexSet_$0_$1_$2 movl $(CACHE_HISTOGRAM_SIZE-1), %ebx LMsgSendMissHistoIndexSet_$0_$1_$2: LEA_STATIC_DATA %esi, _CacheMissHistogram, EXTERNAL_SYMBOL shll $$2, %ebx // convert probeCount to histogram index addl %ebx, %esi // calculate &CacheMissHistogram[probeCount<<2] movl 0(%esi), %edi // get current tally addl $$1, %edi // movl %edi, 0(%esi) // tally += 1 LMsgSendMissInstrumentDone_$0_$1_$2: popl %ebx // restore non-volatile register #endif .if $0 == WORD_RETURN // Regular word return .if $1 == MSG_SEND // MSG_SEND popl %esi // restore callers register popl %edi // restore callers register movl self(%esp), %edx // get messaged object movl isa(%edx), %eax // get objects class .elseif $1 == MSG_SENDSUPER // MSG_SENDSUPER // replace "super" arg with "receiver" movl super+8(%esp), %edi // get super structure movl receiver(%edi), %edx // get messaged object movl %edx, super+8(%esp) // make it the first argument movl class(%edi), %eax // get messaged class popl %esi // restore callers register popl %edi // restore callers register .else // CACHE_GET popl %esi // restore callers register popl %edi // restore callers register .endif .else // Struct return .if $1 == MSG_SEND // MSG_SEND (stret) popl %esi // restore callers register popl %edi // restore callers register movl self_stret(%esp), %edx // get messaged object movl isa(%edx), %eax // get objects class .elseif $1 == MSG_SENDSUPER // MSG_SENDSUPER (stret) // replace "super" arg with "receiver" movl super_stret+8(%esp), %edi// get super structure movl receiver(%edi), %edx // get messaged object movl %edx, super_stret+8(%esp)// make it the first argument movl class(%edi), %eax // get messaged class popl %esi // restore callers register popl %edi // restore callers register .else // CACHE_GET !! This should not happen. .endif .endif // edx = receiver // ecx = selector // eax = class jmp $2 // go to callers handler // eax points to matching cache entry .align 4, 0x90 LMsgSendCacheHit_$0_$1_$2: #if defined(OBJC_INSTRUMENTED) popl %edx // retrieve cache pointer movl mask(%edx), %esi // mask = cache->mask testl %esi, %esi // a mask of zero is only for the... je LMsgSendHitInstrumentDone_$0_$1_$2 // ... emptyCache, do not record anything // locate and update the CacheInstrumentation structure addl $$1, %esi // entryCount = mask + 1 shll $$2, %esi // tableSize = entryCount * sizeof(entry) addl $buckets, %esi // offset = buckets + tableSize addl %edx, %esi // cacheData = &cache->buckets[mask+1] movl hitCount(%esi), %edi addl $$1, %edi movl %edi, hitCount(%esi) // cacheData->hitCount += 1 movl hitProbes(%esi), %edi addl %ebx, %edi movl %edi, hitProbes(%esi) // cacheData->hitProbes += probeCount movl maxHitProbes(%esi), %edi// if (cacheData->maxHitProbes < probeCount) cmpl %ebx, %edi jge LMsgSendMaxHitProbeOK_$0_$1_$2 movl %ebx, maxHitProbes(%esi)// cacheData->maxHitProbes = probeCount LMsgSendMaxHitProbeOK_$0_$1_$2: // update cache hit probe histogram cmpl $CACHE_HISTOGRAM_SIZE, %ebx // pin probeCount to max index jl LMsgSendHitHistoIndexSet_$0_$1_$2 movl $(CACHE_HISTOGRAM_SIZE-1), %ebx LMsgSendHitHistoIndexSet_$0_$1_$2: LEA_STATIC_DATA %esi, _CacheHitHistogram, EXTERNAL_SYMBOL shll $$2, %ebx // convert probeCount to histogram index addl %ebx, %esi // calculate &CacheHitHistogram[probeCount<<2] movl 0(%esi), %edi // get current tally addl $$1, %edi // movl %edi, 0(%esi) // tally += 1 LMsgSendHitInstrumentDone_$0_$1_$2: popl %ebx // restore non-volatile register #endif // load implementation address, restore state, and we're done .if $1 == CACHE_GET // method triplet is already in eax .else movl method_imp(%eax), %eax // imp = method->method_imp .endif .if $0 == WORD_RETURN // Regular word return .if $1 == MSG_SENDSUPER // MSG_SENDSUPER // replace "super" arg with "self" movl super+8(%esp), %edi movl receiver(%edi), %esi movl %esi, super+8(%esp) .endif .else // Struct return .if $1 == MSG_SENDSUPER // MSG_SENDSUPER (stret) // replace "super" arg with "self" movl super_stret+8(%esp), %edi movl receiver(%edi), %esi movl %esi, super_stret+8(%esp) .endif .endif // restore caller registers popl %esi popl %edi .endmacro ///////////////////////////////////////////////////////////////////// // // MethodTableLookup WORD_RETURN | STRUCT_RETURN, MSG_SEND | MSG_SENDSUPER // // Takes: WORD_RETURN (first parameter is at sp+4) // STRUCT_RETURN (struct address is at sp+4, first parameter at sp+8) // MSG_SEND (first parameter is receiver) // MSG_SENDSUPER (first parameter is address of objc_super structure) // // edx = receiver // ecx = selector // eax = class // (all set by CacheLookup's miss case) // // Stack must be at 0xXXXXXXXc on entrance. // // On exit: esp unchanged // imp in eax // ///////////////////////////////////////////////////////////////////// .macro MethodTableLookup // stack has return address and nothing else subl $$(12+5*16), %esp movdqa %xmm3, 4*16(%esp) movdqa %xmm2, 3*16(%esp) movdqa %xmm1, 2*16(%esp) movdqa %xmm0, 1*16(%esp) // lookUpImpOrForward(obj, sel, cls, LOOKUP_INITIALIZE | LOOKUP_RESOLVER) movl $$3, 12(%esp) // LOOKUP_INITIALIZE | LOOKUP_RESOLVER movl %eax, 8(%esp) // class movl %ecx, 4(%esp) // selector movl %edx, 0(%esp) // receiver call _lookUpImpOrForward movdqa 4*16(%esp), %xmm3 movdqa 3*16(%esp), %xmm2 movdqa 2*16(%esp), %xmm1 movdqa 1*16(%esp), %xmm0 addl $$(12+5*16), %esp // pop parameters .endmacro /******************************************************************** * Method _cache_getMethod(Class cls, SEL sel, IMP msgForward_internal_imp) * * If found, returns method triplet pointer. * If not found, returns NULL. * * NOTE: _cache_getMethod never returns any cache entry whose implementation * is _objc_msgForward_impcache. It returns 1 instead. This prevents thread- * safety and memory management bugs in _class_lookupMethodAndLoadCache. * See _class_lookupMethodAndLoadCache for details. * * _objc_msgForward_impcache is passed as a parameter because it's more * efficient to do the (PIC) lookup once in the caller than repeatedly here. ********************************************************************/ STATIC_ENTRY __cache_getMethod // load the class and selector movl selector(%esp), %ecx movl self(%esp), %edx // do lookup CacheLookup WORD_RETURN, CACHE_GET, LGetMethodMiss // cache hit, method triplet in %eax movl first_arg(%esp), %ecx // check for _objc_msgForward_impcache cmpl method_imp(%eax), %ecx // if (imp==_objc_msgForward_impcache) je 1f // return (Method)1 ret // else return method triplet address 1: movl $1, %eax ret LGetMethodMiss: // cache miss, return nil xorl %eax, %eax // zero %eax ret LGetMethodExit: END_ENTRY __cache_getMethod /******************************************************************** * IMP _cache_getImp(Class cls, SEL sel) * * If found, returns method implementation. * If not found, returns NULL. ********************************************************************/ STATIC_ENTRY __cache_getImp // load the class and selector movl selector(%esp), %ecx movl self(%esp), %edx // do lookup CacheLookup WORD_RETURN, CACHE_GET, LGetImpMiss // cache hit, method triplet in %eax movl method_imp(%eax), %eax // return method imp ret LGetImpMiss: // cache miss, return nil xorl %eax, %eax // zero %eax ret LGetImpExit: END_ENTRY __cache_getImp /******************************************************************** * * id objc_msgSend(id self, SEL _cmd,...); * ********************************************************************/ ENTRY _objc_msgSend CALL_MCOUNTER // load receiver and selector movl selector(%esp), %ecx movl self(%esp), %eax // check whether receiver is nil testl %eax, %eax je LMsgSendNilSelf // receiver (in %eax) is non-nil: search the cache LMsgSendReceiverOk: movl isa(%eax), %edx // class = self->isa CacheLookup WORD_RETURN, MSG_SEND, LMsgSendCacheMiss xor %edx, %edx // set nonstret for msgForward_internal jmp *%eax // cache miss: go search the method lists LMsgSendCacheMiss: MethodTableLookup WORD_RETURN, MSG_SEND xor %edx, %edx // set nonstret for msgForward_internal jmp *%eax // goto *imp // message sent to nil: redirect to nil receiver, if any LMsgSendNilSelf: // %eax is already zero movl $0,%edx xorps %xmm0, %xmm0 LMsgSendDone: ret // guaranteed non-nil entry point (disabled for now) // .globl _objc_msgSendNonNil // _objc_msgSendNonNil: // movl self(%esp), %eax // jmp LMsgSendReceiverOk LMsgSendExit: END_ENTRY _objc_msgSend /******************************************************************** * * id objc_msgSendSuper(struct objc_super *super, SEL _cmd,...); * * struct objc_super { * id receiver; * Class class; * }; ********************************************************************/ ENTRY _objc_msgSendSuper CALL_MCOUNTER // load selector and class to search movl super(%esp), %eax // struct objc_super movl selector(%esp), %ecx movl class(%eax), %edx // struct objc_super->class // search the cache (class in %edx) CacheLookup WORD_RETURN, MSG_SENDSUPER, LMsgSendSuperCacheMiss xor %edx, %edx // set nonstret for msgForward_internal jmp *%eax // goto *imp // cache miss: go search the method lists LMsgSendSuperCacheMiss: MethodTableLookup WORD_RETURN, MSG_SENDSUPER xor %edx, %edx // set nonstret for msgForward_internal jmp *%eax // goto *imp // ignored selector: return self LMsgSendSuperIgnored: movl super(%esp), %eax movl receiver(%eax), %eax ret LMsgSendSuperExit: END_ENTRY _objc_msgSendSuper /******************************************************************** * id objc_msgSendv(id self, SEL _cmd, unsigned size, marg_list frame); * * On entry: * (sp+4) is the message receiver, * (sp+8) is the selector, * (sp+12) is the size of the marg_list, in bytes, * (sp+16) is the address of the marg_list * ********************************************************************/ ENTRY _objc_msgSendv #if defined(KERNEL) trap // _objc_msgSendv is not for the kernel #else pushl %ebp movl %esp, %ebp // stack is currently aligned assuming no extra arguments movl (marg_list+4)(%ebp), %edx addl $8, %edx // skip self & selector movl (marg_size+4)(%ebp), %ecx subl $8, %ecx // skip self & selector shrl $2, %ecx je LMsgSendvArgsOK // %esp = %esp - (16 - ((numVariableArguments & 3) << 2)) movl %ecx, %eax // 16-byte align stack andl $3, %eax shll $2, %eax subl $16, %esp addl %eax, %esp LMsgSendvArgLoop: decl %ecx movl 0(%edx, %ecx, 4), %eax pushl %eax jg LMsgSendvArgLoop LMsgSendvArgsOK: movl (selector+4)(%ebp), %ecx pushl %ecx movl (self+4)(%ebp),%ecx pushl %ecx call _objc_msgSend movl %ebp,%esp popl %ebp ret #endif END_ENTRY _objc_msgSendv /******************************************************************** * * double objc_msgSend_fpret(id self, SEL _cmd,...); * ********************************************************************/ ENTRY _objc_msgSend_fpret CALL_MCOUNTER // load receiver and selector movl selector(%esp), %ecx movl self(%esp), %eax // check whether receiver is nil testl %eax, %eax je LMsgSendFpretNilSelf // receiver (in %eax) is non-nil: search the cache LMsgSendFpretReceiverOk: movl isa(%eax), %edx // class = self->isa CacheLookup WORD_RETURN, MSG_SEND, LMsgSendFpretCacheMiss xor %edx, %edx // set nonstret for msgForward_internal jmp *%eax // goto *imp // cache miss: go search the method lists LMsgSendFpretCacheMiss: MethodTableLookup WORD_RETURN, MSG_SEND xor %edx, %edx // set nonstret for msgForward_internal jmp *%eax // goto *imp // message sent to nil: redirect to nil receiver, if any LMsgSendFpretNilSelf: // %eax is already zero fldz LMsgSendFpretDone: ret LMsgSendFpretExit: END_ENTRY _objc_msgSend_fpret /******************************************************************** * double objc_msgSendv_fpret(id self, SEL _cmd, unsigned size, marg_list frame); * * On entry: * (sp+4) is the message receiver, * (sp+8) is the selector, * (sp+12) is the size of the marg_list, in bytes, * (sp+16) is the address of the marg_list * ********************************************************************/ ENTRY _objc_msgSendv_fpret #if defined(KERNEL) trap // _objc_msgSendv is not for the kernel #else pushl %ebp movl %esp, %ebp // stack is currently aligned assuming no extra arguments movl (marg_list+4)(%ebp), %edx addl $8, %edx // skip self & selector movl (marg_size+4)(%ebp), %ecx subl $8, %ecx // skip self & selector shrl $2, %ecx je LMsgSendvFpretArgsOK // %esp = %esp - (16 - ((numVariableArguments & 3) << 2)) movl %ecx, %eax // 16-byte align stack andl $3, %eax shll $2, %eax subl $16, %esp addl %eax, %esp LMsgSendvFpretArgLoop: decl %ecx movl 0(%edx, %ecx, 4), %eax pushl %eax jg LMsgSendvFpretArgLoop LMsgSendvFpretArgsOK: movl (selector+4)(%ebp), %ecx pushl %ecx movl (self+4)(%ebp),%ecx pushl %ecx call _objc_msgSend_fpret movl %ebp,%esp popl %ebp ret #endif END_ENTRY _objc_msgSendv_fpret /******************************************************************** * * void objc_msgSend_stret(void *st_addr , id self, SEL _cmd, ...); * * * objc_msgSend_stret is the struct-return form of msgSend. * The ABI calls for (sp+4) to be used as the address of the structure * being returned, with the parameters in the succeeding locations. * * On entry: (sp+4)is the address where the structure is returned, * (sp+8) is the message receiver, * (sp+12) is the selector ********************************************************************/ ENTRY _objc_msgSend_stret CALL_MCOUNTER // load receiver and selector movl self_stret(%esp), %eax movl (selector_stret)(%esp), %ecx // check whether receiver is nil testl %eax, %eax je LMsgSendStretNilSelf // receiver (in %eax) is non-nil: search the cache LMsgSendStretReceiverOk: movl isa(%eax), %edx // class = self->isa CacheLookup STRUCT_RETURN, MSG_SEND, LMsgSendStretCacheMiss movl $1, %edx // set stret for objc_msgForward jmp *%eax // goto *imp // cache miss: go search the method lists LMsgSendStretCacheMiss: MethodTableLookup STRUCT_RETURN, MSG_SEND movl $1, %edx // set stret for objc_msgForward jmp *%eax // goto *imp // message sent to nil: redirect to nil receiver, if any LMsgSendStretNilSelf: ret $4 // pop struct return address (#2995932) // guaranteed non-nil entry point (disabled for now) // .globl _objc_msgSendNonNil_stret // _objc_msgSendNonNil_stret: // CALL_MCOUNTER // movl self_stret(%esp), %eax // jmp LMsgSendStretReceiverOk LMsgSendStretExit: END_ENTRY _objc_msgSend_stret /******************************************************************** * * void objc_msgSendSuper_stret(void *st_addr, struct objc_super *super, SEL _cmd, ...); * * struct objc_super { * id receiver; * Class class; * }; * * objc_msgSendSuper_stret is the struct-return form of msgSendSuper. * The ABI calls for (sp+4) to be used as the address of the structure * being returned, with the parameters in the succeeding registers. * * On entry: (sp+4)is the address where the structure is returned, * (sp+8) is the address of the objc_super structure, * (sp+12) is the selector * ********************************************************************/ ENTRY _objc_msgSendSuper_stret CALL_MCOUNTER // load selector and class to search movl super_stret(%esp), %eax // struct objc_super movl (selector_stret)(%esp), %ecx // get selector movl class(%eax), %edx // struct objc_super->class // search the cache (class in %edx) CacheLookup STRUCT_RETURN, MSG_SENDSUPER, LMsgSendSuperStretCacheMiss movl $1, %edx // set stret for objc_msgForward jmp *%eax // goto *imp // cache miss: go search the method lists LMsgSendSuperStretCacheMiss: MethodTableLookup STRUCT_RETURN, MSG_SENDSUPER movl $1, %edx // set stret for objc_msgForward jmp *%eax // goto *imp LMsgSendSuperStretExit: END_ENTRY _objc_msgSendSuper_stret /******************************************************************** * void objc_msgSendv_stret(void *st_addr, id self, SEL _cmd, unsigned size, marg_list frame); * * objc_msgSendv_stret is the struct-return form of msgSendv. * This function does not use the struct-return ABI; instead, the * structure return address is passed as a normal parameter. * * On entry: (sp+4) is the address in which the returned struct is put, * (sp+8) is the message receiver, * (sp+12) is the selector, * (sp+16) is the size of the marg_list, in bytes, * (sp+20) is the address of the marg_list * ********************************************************************/ ENTRY _objc_msgSendv_stret #if defined(KERNEL) trap // _objc_msgSendv_stret is not for the kernel #else pushl %ebp movl %esp, %ebp subl $12, %esp // align stack assuming no extra arguments movl (marg_list_stret+4)(%ebp), %edx addl $8, %edx // skip self & selector movl (marg_size_stret+4)(%ebp), %ecx subl $5, %ecx // skip self & selector shrl $2, %ecx jle LMsgSendvStretArgsOK // %esp = %esp - (16 - ((numVariableArguments & 3) << 2)) movl %ecx, %eax // 16-byte align stack andl $3, %eax shll $2, %eax subl $16, %esp addl %eax, %esp LMsgSendvStretArgLoop: decl %ecx movl 0(%edx, %ecx, 4), %eax pushl %eax jg LMsgSendvStretArgLoop LMsgSendvStretArgsOK: movl (selector_stret+4)(%ebp), %ecx pushl %ecx movl (self_stret+4)(%ebp),%ecx pushl %ecx movl (struct_addr+4)(%ebp),%ecx pushl %ecx call _objc_msgSend_stret movl %ebp,%esp popl %ebp ret #endif END_ENTRY _objc_msgSendv_stret /******************************************************************** * * id _objc_msgForward(id self, SEL _cmd,...); * ********************************************************************/ // _FwdSel is @selector(forward::), set up in map_images(). // ALWAYS dereference _FwdSel to get to "forward::" !! .data .align 2 .private_extern _FwdSel _FwdSel: .long 0 .cstring .align 2 LUnkSelStr: .ascii "Does not recognize selector %s (while forwarding %s)\0" .non_lazy_symbol_pointer L_forward_handler: .indirect_symbol __objc_forward_handler .long 0 L_forward_stret_handler: .indirect_symbol __objc_forward_stret_handler .long 0 STATIC_ENTRY __objc_msgForward_impcache // Method cache version // THIS IS NOT A CALLABLE C FUNCTION // Out-of-band register %edx is nonzero for stret, zero otherwise // Check return type (stret or not) testl %edx, %edx jnz __objc_msgForward_stret jmp __objc_msgForward END_ENTRY _objc_msgForward_impcache ENTRY __objc_msgForward // Non-struct return version // Get PIC base into %edx call L__objc_msgForward$pic_base L__objc_msgForward$pic_base: popl %edx // Call user handler, if any movl L_forward_handler-L__objc_msgForward$pic_base(%edx),%ecx movl (%ecx), %ecx testl %ecx, %ecx // if not NULL je 1f // skip to default handler jmp *%ecx // call __objc_forward_handler 1: // No user handler // Push stack frame pushl %ebp movl %esp, %ebp // Die if forwarding "forward::" movl (selector+4)(%ebp), %eax movl _FwdSel-L__objc_msgForward$pic_base(%edx),%ecx cmpl %ecx, %eax je LMsgForwardError // Call [receiver forward:sel :margs] subl $8, %esp // 16-byte align the stack leal (self+4)(%ebp), %ecx pushl %ecx // &margs pushl %eax // sel movl _FwdSel-L__objc_msgForward$pic_base(%edx),%ecx pushl %ecx // forward:: pushl (self+4)(%ebp) // receiver call _objc_msgSend movl %ebp, %esp popl %ebp ret LMsgForwardError: // Call __objc_error(receiver, "unknown selector %s %s", "forward::", forwardedSel) subl $8, %esp // 16-byte align the stack pushl (selector+4+4)(%ebp) // the forwarded selector movl _FwdSel-L__objc_msgForward$pic_base(%edx),%eax pushl %eax leal LUnkSelStr-L__objc_msgForward$pic_base(%edx),%eax pushl %eax pushl (self+4)(%ebp) call ___objc_error // never returns END_ENTRY __objc_msgForward ENTRY __objc_msgForward_stret // Struct return version // Get PIC base into %edx call L__objc_msgForwardStret$pic_base L__objc_msgForwardStret$pic_base: popl %edx // Call user handler, if any movl L_forward_stret_handler-L__objc_msgForwardStret$pic_base(%edx), %ecx movl (%ecx), %ecx testl %ecx, %ecx // if not NULL je 1f // skip to default handler jmp *%ecx // call __objc_forward_stret_handler 1: // No user handler // Push stack frame pushl %ebp movl %esp, %ebp // Die if forwarding "forward::" movl (selector_stret+4)(%ebp), %eax movl _FwdSel-L__objc_msgForwardStret$pic_base(%edx), %ecx cmpl %ecx, %eax je LMsgForwardStretError // Call [receiver forward:sel :margs] subl $8, %esp // 16-byte align the stack leal (self_stret+4)(%ebp), %ecx pushl %ecx // &margs pushl %eax // sel movl _FwdSel-L__objc_msgForwardStret$pic_base(%edx),%ecx pushl %ecx // forward:: pushl (self_stret+4)(%ebp) // receiver call _objc_msgSend movl %ebp, %esp popl %ebp ret $4 // pop struct return address (#2995932) LMsgForwardStretError: // Call __objc_error(receiver, "unknown selector %s %s", "forward::", forwardedSelector) subl $8, %esp // 16-byte align the stack pushl (selector_stret+4+4)(%ebp) // the forwarded selector leal _FwdSel-L__objc_msgForwardStret$pic_base(%edx),%eax pushl %eax leal LUnkSelStr-L__objc_msgForwardStret$pic_base(%edx),%eax pushl %eax pushl (self_stret+4)(%ebp) call ___objc_error // never returns END_ENTRY __objc_msgForward_stret ENTRY _method_invoke movl selector(%esp), %ecx movl method_name(%ecx), %edx movl method_imp(%ecx), %eax movl %edx, selector(%esp) jmp *%eax END_ENTRY _method_invoke ENTRY _method_invoke_stret movl selector_stret(%esp), %ecx movl method_name(%ecx), %edx movl method_imp(%ecx), %eax movl %edx, selector_stret(%esp) jmp *%eax END_ENTRY _method_invoke_stret .section __DATA,__objc_msg_break .long 0 .long 0 #endif
MrOwlSage/objc4-906
23,651
runtime/Messengers.subproj/objc-msg-simulator-i386.s
/* * Copyright (c) 1999-2009 Apple Inc. All Rights Reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #include <TargetConditionals.h> #if defined(__i386__) && TARGET_OS_SIMULATOR #include "objc-config.h" .data // _objc_restartableRanges is used by method dispatch // to get the critical regions for which method caches // cannot be garbage collected. .macro RestartableEntry .long $0 .long 0 .short LExit$0 - $0 .short 0xffff // The simulator doesn't support kernel based recovery .long 0 .endmacro .align 4 .private_extern _objc_restartableRanges _objc_restartableRanges: RestartableEntry _cache_getImp RestartableEntry _objc_msgSend RestartableEntry _objc_msgSend_fpret RestartableEntry _objc_msgSend_stret RestartableEntry _objc_msgSendSuper RestartableEntry _objc_msgSendSuper2 RestartableEntry _objc_msgSendSuper_stret RestartableEntry _objc_msgSendSuper2_stret RestartableEntry _objc_msgLookup RestartableEntry _objc_msgLookup_fpret RestartableEntry _objc_msgLookup_stret RestartableEntry _objc_msgLookupSuper2 RestartableEntry _objc_msgLookupSuper2_stret .fill 16, 1, 0 /******************************************************************** * Names for relative labels * DO NOT USE THESE LABELS ELSEWHERE * Reserved labels: 5: 6: 7: 8: 9: ********************************************************************/ #define LCacheMiss 5 #define LCacheMiss_f 5f #define LCacheMiss_b 5b #define LNilTestDone 6 #define LNilTestDone_f 6f #define LNilTestDone_b 6b #define LNilTestSlow 7 #define LNilTestSlow_f 7f #define LNilTestSlow_b 7b #define LGetIsaDone 8 #define LGetIsaDone_f 8f #define LGetIsaDone_b 8b #define LGetIsaSlow 9 #define LGetIsaSlow_f 9f #define LGetIsaSlow_b 9b /******************************************************************** * Macro parameters ********************************************************************/ #define NORMAL 0 #define FPRET 1 #define STRET 2 #define CALL 100 #define GETIMP 101 #define LOOKUP 102 /******************************************************************** * * Structure definitions. * ********************************************************************/ // Offsets from %esp #define self 4 #define super 4 #define selector 8 #define marg_size 12 #define marg_list 16 #define first_arg 12 #define struct_addr 4 #define self_stret 8 #define super_stret 8 #define selector_stret 12 #define marg_size_stret 16 #define marg_list_stret 20 // objc_super parameter to sendSuper #define receiver 0 #define class 4 // Selected field offsets in class structure #define isa 0 #define superclass 4 #define cache_buckets 8 #define cache_mask 12 // Method cache #define cached_sel 0 #define cached_imp 4 // Method descriptor #define method_name 0 #define method_imp 8 ////////////////////////////////////////////////////////////////////// // // ENTRY functionName // // Assembly directives to begin an exported function. // // Takes: functionName - name of the exported function ////////////////////////////////////////////////////////////////////// .macro ENTRY .text .globl $0 .align 2, 0x90 $0: .endmacro .macro STATIC_ENTRY .text .private_extern $0 .align 4, 0x90 $0: .endmacro ////////////////////////////////////////////////////////////////////// // // END_ENTRY functionName // // Assembly directives to end an exported function. Just a placeholder, // a close-parenthesis for ENTRY, until it is needed for something. // // Takes: functionName - name of the exported function ////////////////////////////////////////////////////////////////////// .macro END_ENTRY LExit$0: .endmacro /******************************************************************** * UNWIND name, flags * Unwind info generation ********************************************************************/ .macro UNWIND .section __LD,__compact_unwind,regular,debug .long $0 .set LUnwind$0, LExit$0 - $0 .long LUnwind$0 .long $1 .long 0 /* no personality */ .long 0 /* no LSDA */ .text .endmacro #define NoFrame 0x02010000 // no frame, no SP adjustment except return address #define FrameWithNoSaves 0x01000000 // frame, no non-volatile saves ////////////////////////////////////////////////////////////////////// // // SAVE_REGS // // Create a stack frame and save all argument registers in preparation // for a function call. ////////////////////////////////////////////////////////////////////// .macro SAVE_REGS pushl %ebp movl %esp, %ebp subl $$(8+5*16), %esp movdqa %xmm3, 4*16(%esp) movdqa %xmm2, 3*16(%esp) movdqa %xmm1, 2*16(%esp) movdqa %xmm0, 1*16(%esp) .endmacro ////////////////////////////////////////////////////////////////////// // // RESTORE_REGS // // Restore all argument registers and pop the stack frame created by // SAVE_REGS. ////////////////////////////////////////////////////////////////////// .macro RESTORE_REGS movdqa 4*16(%esp), %xmm3 movdqa 3*16(%esp), %xmm2 movdqa 2*16(%esp), %xmm1 movdqa 1*16(%esp), %xmm0 leave .endmacro ///////////////////////////////////////////////////////////////////// // // CacheLookup return-type, caller // // Locate the implementation for a selector in a class method cache. // // Takes: // $0 = NORMAL, FPRET, STRET // $1 = CALL, LOOKUP, GETIMP // ecx = selector to search for // edx = class to search // // On exit: ecx clobbered // (found) calls or returns IMP in eax, eq/ne set for forwarding // (not found) jumps to LCacheMiss, class still in edx // ///////////////////////////////////////////////////////////////////// .macro CacheHit // CacheHit must always be preceded by a not-taken `jne` instruction // in case the imp is _objc_msgForward_impcache. // eax = found bucket .if $1 == GETIMP movl cached_imp(%eax), %eax // return imp cmpl $$0, %eax jz 9f // don't xor a nil imp xorl %edx, %eax // xor the isa with the imp 9: ret .else .if $1 == CALL xorl cached_imp(%eax), %edx // xor imp and isa .if $0 != STRET // ne already set for forwarding by `xor` .else cmp %eax, %eax // set eq for stret forwarding .endif jmp *%edx // call imp .elseif $1 == LOOKUP movl cached_imp(%eax), %eax // return imp xorl %edx, %eax // xor isa into imp ret .else .abort oops .endif .endif .endmacro .macro CacheLookup movzwl cache_mask(%edx), %eax // eax = mask andl %ecx, %eax // eax = SEL & mask shll $$3, %eax // eax = offset = (SEL & mask) * 8 addl cache_buckets(%edx), %eax // eax = bucket = buckets+offset cmpl cached_sel(%eax), %ecx // if (bucket->sel != SEL) jne 1f // scan more // The `jne` above sets flags for CacheHit CacheHit $0, $1 // call or return imp 1: // loop cmpl $$1, cached_sel(%eax) jbe 3f // if (bucket->sel <= 1) wrap or miss addl $$8, %eax // bucket++ 2: cmpl cached_sel(%eax), %ecx // if (bucket->sel != sel) jne 1b // scan more // The `jne` above sets flags for CacheHit CacheHit $0, $1 // call or return imp 3: // wrap or miss jb LCacheMiss_f // if (bucket->sel < 1) cache miss // wrap movl cached_imp(%eax), %eax // bucket->imp is really first bucket jmp 2f // Clone scanning loop to miss instead of hang when cache is corrupt. // The slow path may detect any corruption and halt later. 1: // loop cmpl $$1, cached_sel(%eax) jbe 3f // if (bucket->sel <= 1) wrap or miss addl $$8, %eax // bucket++ 2: cmpl cached_sel(%eax), %ecx // if (bucket->sel != sel) jne 1b // scan more // The `jne` above sets flags for CacheHit CacheHit $0, $1 // call or return imp 3: // double wrap or miss jmp LCacheMiss_f .endmacro ///////////////////////////////////////////////////////////////////// // // MethodTableLookup NORMAL|STRET // // Takes: // receiver (not struct objc_super) and selector on stack // edx = class to search // // On exit: IMP in eax, eq/ne set for forwarding // ///////////////////////////////////////////////////////////////////// .macro MethodTableLookup SAVE_REGS .if $0 == NORMAL movl self+4(%ebp), %eax movl selector+4(%ebp), %ecx .else movl self_stret+4(%ebp), %eax movl selector_stret+4(%ebp), %ecx .endif // lookUpImpOrForward(obj, sel, cls, LOOKUP_INITIALIZE | LOOKUP_RESOLVER) movl $$3, 12(%esp) // LOOKUP_INITIALIZE | LOOKUP_RESOLVER movl %edx, 8(%esp) // class movl %ecx, 4(%esp) // selector movl %eax, 0(%esp) // receiver call _lookUpImpOrForward // imp in eax .if $0 == NORMAL test %eax, %eax // set ne for stret forwarding .else cmp %eax, %eax // set eq for nonstret forwarding .endif RESTORE_REGS .endmacro ///////////////////////////////////////////////////////////////////// // // NilTest return-type // // Takes: $0 = NORMAL or FPRET or STRET // eax = receiver // // On exit: Loads non-nil receiver in eax and self(esp) or self_stret(esp), // or returns zero. // // NilTestReturnZero return-type // // Takes: $0 = NORMAL or FPRET or STRET // eax = receiver // // On exit: Loads non-nil receiver in eax and self(esp) or self_stret(esp), // or returns zero. // // NilTestReturnIMP return-type // // Takes: $0 = NORMAL or FPRET or STRET // eax = receiver // // On exit: Loads non-nil receiver in eax and self(esp) or self_stret(esp), // or returns an IMP in eax that returns zero. // ///////////////////////////////////////////////////////////////////// .macro ZeroReturn xorl %eax, %eax xorl %edx, %edx xorps %xmm0, %xmm0 xorps %xmm1, %xmm1 .endmacro .macro ZeroReturnFPRET fldz .endmacro .macro ZeroReturnSTRET // empty .endmacro STATIC_ENTRY __objc_msgNil ZeroReturn ret END_ENTRY __objc_msgNil STATIC_ENTRY __objc_msgNil_fpret ZeroReturnFPRET ret END_ENTRY __objc_msgNil_fpret STATIC_ENTRY __objc_msgNil_stret ZeroReturnSTRET ret $4 END_ENTRY __objc_msgNil_stret .macro NilTest testl %eax, %eax jz LNilTestSlow_f LNilTestDone: .endmacro .macro NilTestReturnZero .align 3 LNilTestSlow: .if $0 == NORMAL ZeroReturn ret .elseif $0 == FPRET ZeroReturnFPRET ret .elseif $0 == STRET ZeroReturnSTRET ret $$4 .else .abort oops .endif .endmacro .macro NilTestReturnIMP .align 3 LNilTestSlow: call 1f 1: pop %eax .if $0 == NORMAL leal __objc_msgNil-1b(%eax), %eax .elseif $0 == FPRET leal __objc_msgNil_fpret-1b(%eax), %eax .elseif $0 == STRET leal __objc_msgNil_stret-1b(%eax), %eax .else .abort oops .endif ret .endmacro /******************************************************************** * IMP _cache_getImp(Class cls, SEL sel) * * If found, returns method implementation. * If not found, returns NULL. ********************************************************************/ STATIC_ENTRY _cache_getImp // load the class and selector movl selector(%esp), %ecx movl self(%esp), %edx CacheLookup NORMAL, GETIMP // returns IMP on success LCacheMiss: // cache miss, return nil xorl %eax, %eax ret END_ENTRY _cache_getImp /******************************************************************** * * id objc_msgSend(id self, SEL _cmd, ...); * IMP objc_msgLookup(id self, SEL _cmd, ...); * * objc_msgLookup ABI: * IMP returned in eax * Forwarding returned in Z flag * edx reserved for our use but not used * ********************************************************************/ ENTRY _objc_msgSend UNWIND _objc_msgSend, NoFrame movl selector(%esp), %ecx movl self(%esp), %eax NilTest NORMAL movl isa(%eax), %edx // class = self->isa CacheLookup NORMAL, CALL // calls IMP on success NilTestReturnZero NORMAL LCacheMiss: // isa still in edx jmp __objc_msgSend_uncached END_ENTRY _objc_msgSend ENTRY _objc_msgLookup UNWIND _objc_msgLookup, NoFrame movl selector(%esp), %ecx movl self(%esp), %eax NilTest NORMAL movl isa(%eax), %edx // class = self->isa CacheLookup NORMAL, LOOKUP // returns IMP on success NilTestReturnIMP NORMAL LCacheMiss: // isa still in edx jmp __objc_msgLookup_uncached END_ENTRY _objc_msgLookup /******************************************************************** * * id objc_msgSendSuper(struct objc_super *super, SEL _cmd, ...); * ********************************************************************/ ENTRY _objc_msgSendSuper UNWIND _objc_msgSendSuper, NoFrame movl selector(%esp), %ecx movl super(%esp), %eax // struct objc_super movl class(%eax), %edx // struct objc_super->class movl receiver(%eax), %eax // struct objc_super->receiver movl %eax, super(%esp) // replace super arg with receiver CacheLookup NORMAL, CALL // calls IMP on success LCacheMiss: // class still in edx jmp __objc_msgSend_uncached END_ENTRY _objc_msgSendSuper /******************************************************************** * * id objc_msgSendSuper2(struct objc_super *super, SEL _cmd, ...); * IMP objc_msgLookupSuper2(struct objc_super *super, SEL _cmd, ...); * ********************************************************************/ ENTRY _objc_msgSendSuper2 UNWIND _objc_msgSendSuper2, NoFrame movl selector(%esp), %ecx movl super(%esp), %eax // struct objc_super movl class(%eax), %edx // struct objc_super->class movl receiver(%eax), %eax // struct objc_super->receiver movl %eax, super(%esp) // replace super arg with receiver movl superclass(%edx), %edx // edx = objc_super->class->super_class CacheLookup NORMAL, CALL // calls IMP on success LCacheMiss: // class still in edx jmp __objc_msgSend_uncached END_ENTRY _objc_msgSendSuper2 ENTRY _objc_msgLookupSuper2 UNWIND _objc_msgLookupSuper2, NoFrame movl selector(%esp), %ecx movl super(%esp), %eax // struct objc_super movl class(%eax), %edx // struct objc_super->class movl receiver(%eax), %eax // struct objc_super->receiver movl %eax, super(%esp) // replace super arg with receiver movl superclass(%edx), %edx // edx = objc_super->class->super_class CacheLookup NORMAL, LOOKUP // returns IMP on success LCacheMiss: // class still in edx jmp __objc_msgLookup_uncached END_ENTRY _objc_msgLookupSuper2 /******************************************************************** * * double objc_msgSend_fpret(id self, SEL _cmd, ...); * IMP objc_msgLookup_fpret(id self, SEL _cmd, ...); * ********************************************************************/ ENTRY _objc_msgSend_fpret UNWIND _objc_msgSend_fpret, NoFrame movl selector(%esp), %ecx movl self(%esp), %eax NilTest FPRET movl isa(%eax), %edx // class = self->isa CacheLookup FPRET, CALL // calls IMP on success NilTestReturnZero FPRET LCacheMiss: // class still in edx jmp __objc_msgSend_uncached END_ENTRY _objc_msgSend_fpret ENTRY _objc_msgLookup_fpret UNWIND _objc_msgLookup_fpret, NoFrame movl selector(%esp), %ecx movl self(%esp), %eax NilTest FPRET movl isa(%eax), %edx // class = self->isa CacheLookup FPRET, LOOKUP // returns IMP on success NilTestReturnIMP FPRET LCacheMiss: // class still in edx jmp __objc_msgLookup_uncached END_ENTRY _objc_msgLookup_fpret /******************************************************************** * * void objc_msgSend_stret(void *st_addr, id self, SEL _cmd, ...); * IMP objc_msgLookup_stret(void *st_addr, id self, SEL _cmd, ...); * ********************************************************************/ ENTRY _objc_msgSend_stret UNWIND _objc_msgSend_stret, NoFrame movl selector_stret(%esp), %ecx movl self_stret(%esp), %eax NilTest STRET movl isa(%eax), %edx // class = self->isa CacheLookup STRET, CALL // calls IMP on success NilTestReturnZero STRET LCacheMiss: // class still in edx jmp __objc_msgSend_stret_uncached END_ENTRY _objc_msgSend_stret ENTRY _objc_msgLookup_stret UNWIND _objc_msgLookup_stret, NoFrame movl selector_stret(%esp), %ecx movl self_stret(%esp), %eax NilTest STRET movl isa(%eax), %edx // class = self->isa CacheLookup STRET, LOOKUP // returns IMP on success NilTestReturnIMP STRET LCacheMiss: // class still in edx jmp __objc_msgLookup_stret_uncached END_ENTRY _objc_msgLookup_stret /******************************************************************** * * void objc_msgSendSuper_stret(void *st_addr, struct objc_super *super, SEL _cmd, ...); * ********************************************************************/ ENTRY _objc_msgSendSuper_stret UNWIND _objc_msgSendSuper_stret, NoFrame movl selector_stret(%esp), %ecx movl super_stret(%esp), %eax // struct objc_super movl class(%eax), %edx // struct objc_super->class movl receiver(%eax), %eax // struct objc_super->receiver movl %eax, super_stret(%esp) // replace super arg with receiver CacheLookup STRET, CALL // calls IMP on success LCacheMiss: // class still in edx jmp __objc_msgSend_stret_uncached END_ENTRY _objc_msgSendSuper_stret /******************************************************************** * * void objc_msgSendSuper2_stret(void *st_addr, struct objc_super *super, SEL _cmd, ...); * IMP objc_msgLookupSuper2_stret(void *st_addr, struct objc_super *super, SEL _cmd, ...); * ********************************************************************/ ENTRY _objc_msgSendSuper2_stret UNWIND _objc_msgSendSuper2_stret, NoFrame movl selector_stret(%esp), %ecx movl super_stret(%esp), %eax // struct objc_super movl class(%eax), %edx // struct objc_super->class movl receiver(%eax), %eax // struct objc_super->receiver movl %eax, super_stret(%esp) // replace super arg with receiver mov superclass(%edx), %edx // edx = objc_super->class->super_class CacheLookup STRET, CALL // calls IMP on success // cache miss: go search the method lists LCacheMiss: // class still in edx jmp __objc_msgSend_stret_uncached END_ENTRY _objc_msgSendSuper2_stret ENTRY _objc_msgLookupSuper2_stret UNWIND _objc_msgLookupSuper2_stret, NoFrame movl selector_stret(%esp), %ecx movl super_stret(%esp), %eax // struct objc_super movl class(%eax), %edx // struct objc_super->class movl receiver(%eax), %eax // struct objc_super->receiver movl %eax, super_stret(%esp) // replace super arg with receiver mov superclass(%edx), %edx // edx = objc_super->class->super_class CacheLookup STRET, LOOKUP // returns IMP on success // cache miss: go search the method lists LCacheMiss: // class still in edx jmp __objc_msgLookup_stret_uncached END_ENTRY _objc_msgLookupSuper2_stret /******************************************************************** * * _objc_msgSend_uncached * _objc_msgSend_stret_uncached * _objc_msgLookup_uncached * _objc_msgLookup_stret_uncached * * The uncached method lookup. * ********************************************************************/ STATIC_ENTRY __objc_msgSend_uncached UNWIND __objc_msgSend_uncached, FrameWithNoSaves // THIS IS NOT A CALLABLE C FUNCTION // Out-of-band edx is the searched class // edx is already the class to search MethodTableLookup NORMAL jmp *%eax // call imp END_ENTRY __objc_msgSend_uncached STATIC_ENTRY __objc_msgSend_stret_uncached UNWIND __objc_msgSend_stret_uncached, FrameWithNoSaves // THIS IS NOT A CALLABLE C FUNCTION // Out-of-band edx is the searched class // edx is already the class to search MethodTableLookup STRET jmp *%eax // call imp END_ENTRY __objc_msgSend_stret_uncached STATIC_ENTRY __objc_msgLookup_uncached UNWIND __objc_msgLookup_uncached, FrameWithNoSaves // THIS IS NOT A CALLABLE C FUNCTION // Out-of-band edx is the searched class // edx is already the class to search MethodTableLookup NORMAL // eax = IMP ret END_ENTRY __objc_msgLookup_uncached STATIC_ENTRY __objc_msgLookup_stret_uncached UNWIND __objc_msgLookup_stret_uncached, FrameWithNoSaves // THIS IS NOT A CALLABLE C FUNCTION // Out-of-band edx is the searched class // edx is already the class to search MethodTableLookup STRET // eax = IMP ret END_ENTRY __objc_msgLookup_stret_uncached /******************************************************************** * * id _objc_msgForward(id self, SEL _cmd,...); * * _objc_msgForward and _objc_msgForward_stret are the externally-callable * functions returned by things like method_getImplementation(). * _objc_msgForward_impcache is the function pointer actually stored in * method caches. * ********************************************************************/ .non_lazy_symbol_pointer L_forward_handler: .indirect_symbol __objc_forward_handler .long 0 L_forward_stret_handler: .indirect_symbol __objc_forward_stret_handler .long 0 STATIC_ENTRY __objc_msgForward_impcache // Method cache version // THIS IS NOT A CALLABLE C FUNCTION // Out-of-band condition register is NE for stret, EQ otherwise. je __objc_msgForward_stret jmp __objc_msgForward END_ENTRY _objc_msgForward_impcache ENTRY __objc_msgForward // Non-struct return version call 1f 1: popl %edx movl L_forward_handler-1b(%edx), %edx jmp *(%edx) END_ENTRY __objc_msgForward ENTRY __objc_msgForward_stret // Struct return version call 1f 1: popl %edx movl L_forward_stret_handler-1b(%edx), %edx jmp *(%edx) END_ENTRY __objc_msgForward_stret ENTRY _objc_msgSend_debug jmp _objc_msgSend END_ENTRY _objc_msgSend_debug ENTRY _objc_msgSendSuper2_debug jmp _objc_msgSendSuper2 END_ENTRY _objc_msgSendSuper2_debug ENTRY _objc_msgSend_stret_debug jmp _objc_msgSend_stret END_ENTRY _objc_msgSend_stret_debug ENTRY _objc_msgSendSuper2_stret_debug jmp _objc_msgSendSuper2_stret END_ENTRY _objc_msgSendSuper2_stret_debug ENTRY _objc_msgSend_fpret_debug jmp _objc_msgSend_fpret END_ENTRY _objc_msgSend_fpret_debug ENTRY _objc_msgSend_noarg jmp _objc_msgSend END_ENTRY _objc_msgSend_noarg ENTRY _method_invoke // See if this is a small method. testb $1, selector(%esp) jnz L_method_invoke_small // We can directly load the IMP from big methods. movl selector(%esp), %ecx movl method_name(%ecx), %edx movl method_imp(%ecx), %eax movl %edx, selector(%esp) jmp *%eax L_method_invoke_small: // Small methods require a call to handle swizzling. SAVE_REGS movl selector+4(%ebp), %eax movl %eax, 0(%esp) call __method_getImplementationAndName RESTORE_REGS movl %edx, selector(%esp) jmp *%eax END_ENTRY _method_invoke ENTRY _method_invoke_stret // See if this is a small method. testb $1, selector_stret(%esp) jnz L_method_invoke_stret_small // We can directly load the IMP from big methods. movl selector_stret(%esp), %ecx movl method_name(%ecx), %edx movl method_imp(%ecx), %eax movl %edx, selector_stret(%esp) jmp *%eax L_method_invoke_stret_small: // Small methods require a call to handle swizzling. SAVE_REGS movl selector_stret+4(%ebp), %eax movl %eax, 0(%esp) call __method_getImplementationAndName RESTORE_REGS movl %edx, selector_stret(%esp) jmp *%eax END_ENTRY _method_invoke_stret .section __DATA,__objc_msg_break .long 0 .long 0 #endif
MrOwlSage/objc4-906
22,655
runtime/Messengers.subproj/objc-msg-arm.s
/* * @APPLE_LICENSE_HEADER_START@ * * Copyright (c) 1999-2007 Apple Computer, Inc. All Rights Reserved. * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ /******************************************************************** * * objc-msg-arm.s - ARM code to support objc messaging * ********************************************************************/ #ifdef __arm__ #include <arm/arch.h> #include "objc-config.h" #include "isa.h" #ifndef _ARM_ARCH_7 # error requires armv7 #endif // Set FP=1 on architectures that pass parameters in floating-point registers #if __ARM_ARCH_7K__ # define FP 1 #else # define FP 0 #endif #if FP # if !__ARM_NEON__ # error sorry # endif # define FP_RETURN_ZERO \ vmov.i32 q0, #0 ; \ vmov.i32 q1, #0 ; \ vmov.i32 q2, #0 ; \ vmov.i32 q3, #0 # define FP_SAVE \ vpush {q0-q3} # define FP_RESTORE \ vpop {q0-q3} #else # define FP_RETURN_ZERO # define FP_SAVE # define FP_RESTORE #endif .syntax unified #define MI_EXTERN(var) \ .non_lazy_symbol_pointer ;\ L##var##$$non_lazy_ptr: ;\ .indirect_symbol var ;\ .long 0 #define MI_GET_EXTERN(reg,var) \ movw reg, :lower16:(L##var##$$non_lazy_ptr-7f-4) ;\ movt reg, :upper16:(L##var##$$non_lazy_ptr-7f-4) ;\ 7: add reg, pc ;\ ldr reg, [reg] #define MI_GET_ADDRESS(reg,var) \ movw reg, :lower16:(var-7f-4) ;\ movt reg, :upper16:(var-7f-4) ;\ 7: add reg, pc ;\ .data #if SUPPORT_INDEXED_ISA .align 2 .globl _objc_indexed_classes _objc_indexed_classes: .fill ISA_INDEX_COUNT, 4, 0 #endif // _objc_restartableRanges is used by method dispatch // caching code to figure out whether any threads are actively // in the cache for dispatching. The labels surround the asm code // that do cache lookups. The tables are zero-terminated. .macro RestartableEntry .long LLookupStart$0 .long 0 .short LLookupEnd$0 - LLookupStart$0 .short 0xffff // poor ol' armv7 doesn't support kernel based recovery .long 0 .endmacro .align 4 .private_extern _objc_restartableRanges _objc_restartableRanges: RestartableEntry _cache_getImp RestartableEntry _objc_msgSend RestartableEntry _objc_msgSend_stret RestartableEntry _objc_msgSendSuper RestartableEntry _objc_msgSendSuper_stret RestartableEntry _objc_msgSendSuper2 RestartableEntry _objc_msgSendSuper2_stret RestartableEntry _objc_msgLookup RestartableEntry _objc_msgLookup_stret RestartableEntry _objc_msgLookupSuper2 RestartableEntry _objc_msgLookupSuper2_stret .fill 16, 1, 0 /******************************************************************** * Names for relative labels * DO NOT USE THESE LABELS ELSEWHERE * Reserved labels: 6: 7: 8: 9: ********************************************************************/ // 6: used by CacheLookup // 7: used by MI_GET_ADDRESS etc // 8: used by CacheLookup #define LNilReceiver 9 #define LNilReceiver_f 9f #define LNilReceiver_b 9b /******************************************************************** * Macro parameters ********************************************************************/ #define NORMAL 0 #define STRET 1 /******************************************************************** * * Structure definitions. * ********************************************************************/ /* objc_super parameter to sendSuper */ #define RECEIVER 0 #define CLASS 4 /* Selected field offsets in class structure */ #define ISA 0 #define SUPERCLASS 4 #define CACHE 8 #define CACHE_MASK 12 /* Field offsets in method cache bucket */ #define CACHED_SEL 0 #define CACHED_IMP 4 /* Selected field offsets in method structure */ #define METHOD_NAME 0 #define METHOD_TYPES 4 #define METHOD_IMP 8 ////////////////////////////////////////////////////////////////////// // // ENTRY functionName // // Assembly directives to begin an exported function. // // Takes: functionName - name of the exported function ////////////////////////////////////////////////////////////////////// .macro ENTRY /* name */ .text .thumb .align 5 .globl $0 .thumb_func $0: .endmacro .macro STATIC_ENTRY /*name*/ .text .thumb .align 5 .private_extern $0 .thumb_func $0: .endmacro ////////////////////////////////////////////////////////////////////// // // END_ENTRY functionName // // Assembly directives to end an exported function. Just a placeholder, // a close-parenthesis for ENTRY, until it is needed for something. // // Takes: functionName - name of the exported function ////////////////////////////////////////////////////////////////////// .macro END_ENTRY /* name */ LExit$0: .endmacro ////////////////////////////////////////////////////////////////////// // // SAVE_REGS // // Create a stack frame and save all argument registers in preparation // for a function call. ////////////////////////////////////////////////////////////////////// .macro SAVE_REGS stmfd sp!, {r0-r3,r7,lr} add r7, sp, #16 sub sp, #8 // align stack FP_SAVE .endmacro ////////////////////////////////////////////////////////////////////// // // RESTORE_REGS // // Restore all argument registers and pop the stack frame created by // SAVE_REGS. ////////////////////////////////////////////////////////////////////// .macro RESTORE_REGS FP_RESTORE add sp, #8 // align stack ldmfd sp!, {r0-r3,r7,lr} .endmacro ///////////////////////////////////////////////////////////////////// // // CacheLookup NORMAL|STRET <function> // CacheLookup2 NORMAL|STRET <function> // // Locate the implementation for a selector in a class's method cache. // // Takes: // $0 = NORMAL, STRET // r0 or r1 (STRET) = receiver // r1 or r2 (STRET) = selector // r9 = class to search in // // On exit: r9 clobbered // (found) continues after CacheLookup, IMP in r12, eq set // (not found) continues after CacheLookup2 // ///////////////////////////////////////////////////////////////////// .macro CacheLookup // // Restart protocol: // // As soon as we're past the LLookupStart$1 label we may have loaded // an invalid cache pointer or mask. // // When task_restartable_ranges_synchronize() is called, // (or when a signal hits us) before we're past LLookupEnd$1, // then our PC will be reset to LCacheMiss$1 which forcefully // jumps to the cache-miss codepath. // // It is assumed that the CacheMiss codepath starts right at the end // of CacheLookup2 and will re-setup the registers to meet the cache-miss // requirements: // // GETIMP: // The cache-miss is just returning NULL (setting r9 to 0) // // NORMAL and STRET: // - r0 or r1 (STRET) contains the receiver // - r1 or r2 (STRET) contains the selector // - r9 contains the isa (reloaded from r0/r1) // - other registers are set as per calling conventions // LLookupStart$1: ldrh r12, [r9, #CACHE_MASK] // r12 = mask ldr r9, [r9, #CACHE] // r9 = buckets .if $0 == STRET and r12, r12, r2 // r12 = index = SEL & mask .else and r12, r12, r1 // r12 = index = SEL & mask .endif add r9, r9, r12, LSL #3 // r9 = bucket = buckets+index*8 ldr r12, [r9, #CACHED_SEL] // r12 = bucket->sel 6: .if $0 == STRET teq r12, r2 .else teq r12, r1 .endif bne 8f ldr r12, [r9, #CACHED_IMP] // r12 = bucket->imp .if $0 == STRET tst r12, r12 // set ne for stret forwarding .else // eq already set for nonstret forwarding by `teq` above .endif .endmacro .macro CacheLookup2 #if CACHED_SEL != 0 # error this code requires that SEL be at offset 0 #endif 8: cmp r12, #1 blo LCacheMiss$1 // if (bucket->sel == 0) cache miss it eq // if (bucket->sel == 1) cache wrap ldreq r9, [r9, #CACHED_IMP] // bucket->imp is before first bucket ldr r12, [r9, #8]! // r12 = (++bucket)->sel b 6b LLookupEnd$1: LCacheMiss$1: .endmacro ///////////////////////////////////////////////////////////////////// // // GetClassFromIsa return-type // // Given an Isa, return the class for the Isa. // // Takes: // r9 = class // // On exit: r12 clobbered // r9 contains the class for this Isa. // ///////////////////////////////////////////////////////////////////// .macro GetClassFromIsa #if SUPPORT_INDEXED_ISA // Note: We are doing a little wasted work here to load values we might not // need. Branching turns out to be even worse when performance was measured. MI_GET_ADDRESS(r12, _objc_indexed_classes) tst.w r9, #ISA_INDEX_IS_NPI_MASK itt ne ubfxne r9, r9, #ISA_INDEX_SHIFT, #ISA_INDEX_BITS ldrne.w r9, [r12, r9, lsl #2] #endif .endmacro /******************************************************************** * IMP cache_getImp(Class cls, SEL sel) * * On entry: r0 = class whose cache is to be searched * r1 = selector to search for * * If found, returns method implementation. * If not found, returns NULL. ********************************************************************/ STATIC_ENTRY _cache_getImp mov r9, r0 CacheLookup NORMAL, _cache_getImp // cache hit, IMP in r12 mov r0, r12 bx lr // return imp CacheLookup2 GETIMP, _cache_getImp // cache miss, return nil mov r0, #0 bx lr END_ENTRY _cache_getImp /******************************************************************** * * id objc_msgSend(id self, SEL _cmd, ...); * IMP objc_msgLookup(id self, SEL _cmd, ...); * * objc_msgLookup ABI: * IMP returned in r12 * Forwarding returned in Z flag * r9 reserved for our use but not used * ********************************************************************/ ENTRY _objc_msgSend cbz r0, LNilReceiver_f ldr r9, [r0] // r9 = self->isa GetClassFromIsa // r9 = class CacheLookup NORMAL, _objc_msgSend // cache hit, IMP in r12, eq already set for nonstret forwarding bx r12 // call imp CacheLookup2 NORMAL, _objc_msgSend // cache miss ldr r9, [r0] // r9 = self->isa GetClassFromIsa // r9 = class b __objc_msgSend_uncached LNilReceiver: // r0 is already zero mov r1, #0 mov r2, #0 mov r3, #0 FP_RETURN_ZERO bx lr END_ENTRY _objc_msgSend ENTRY _objc_msgLookup cbz r0, LNilReceiver_f ldr r9, [r0] // r9 = self->isa GetClassFromIsa // r9 = class CacheLookup NORMAL, _objc_msgLookup // cache hit, IMP in r12, eq already set for nonstret forwarding bx lr CacheLookup2 NORMAL, _objc_msgLookup // cache miss ldr r9, [r0] // r9 = self->isa GetClassFromIsa // r9 = class b __objc_msgLookup_uncached LNilReceiver: MI_GET_ADDRESS(r12, __objc_msgNil) bx lr END_ENTRY _objc_msgLookup STATIC_ENTRY __objc_msgNil // r0 is already zero mov r1, #0 mov r2, #0 mov r3, #0 FP_RETURN_ZERO bx lr END_ENTRY __objc_msgNil /******************************************************************** * void objc_msgSend_stret(void *st_addr, id self, SEL op, ...); * IMP objc_msgLookup_stret(void *st_addr, id self, SEL op, ...); * * objc_msgSend_stret is the struct-return form of msgSend. * The ABI calls for r0 to be used as the address of the structure * being returned, with the parameters in the succeeding registers. * * On entry: r0 is the address where the structure is returned, * r1 is the message receiver, * r2 is the selector ********************************************************************/ ENTRY _objc_msgSend_stret cbz r1, LNilReceiver_f ldr r9, [r1] // r9 = self->isa GetClassFromIsa // r9 = class CacheLookup STRET, _objc_msgSend_stret // cache hit, IMP in r12, ne already set for stret forwarding bx r12 CacheLookup2 STRET, _objc_msgSend_stret // cache miss ldr r9, [r1] // r9 = self->isa GetClassFromIsa // r9 = class b __objc_msgSend_stret_uncached LNilReceiver: bx lr END_ENTRY _objc_msgSend_stret ENTRY _objc_msgLookup_stret cbz r1, LNilReceiver_f ldr r9, [r1] // r9 = self->isa GetClassFromIsa // r9 = class CacheLookup STRET, _objc_msgLookup_stret // cache hit, IMP in r12, ne already set for stret forwarding bx lr CacheLookup2 STRET, _objc_msgLookup_stret // cache miss ldr r9, [r1] // r9 = self->isa GetClassFromIsa // r9 = class b __objc_msgLookup_stret_uncached LNilReceiver: MI_GET_ADDRESS(r12, __objc_msgNil_stret) bx lr END_ENTRY _objc_msgLookup_stret STATIC_ENTRY __objc_msgNil_stret bx lr END_ENTRY __objc_msgNil_stret /******************************************************************** * id objc_msgSendSuper(struct objc_super *super, SEL op, ...) * * struct objc_super { * id receiver; * Class cls; // the class to search * } ********************************************************************/ ENTRY _objc_msgSendSuper ldr r9, [r0, #CLASS] // r9 = struct super->class CacheLookup NORMAL, _objc_msgSendSuper // cache hit, IMP in r12, eq already set for nonstret forwarding ldr r0, [r0, #RECEIVER] // load real receiver bx r12 // call imp CacheLookup2 NORMAL, _objc_msgSendSuper // cache miss ldr r9, [r0, #CLASS] // r9 = struct super->class ldr r0, [r0, #RECEIVER] // load real receiver b __objc_msgSend_uncached END_ENTRY _objc_msgSendSuper /******************************************************************** * id objc_msgSendSuper2(struct objc_super *super, SEL op, ...) * * struct objc_super { * id receiver; * Class cls; // SUBCLASS of the class to search * } ********************************************************************/ ENTRY _objc_msgSendSuper2 ldr r9, [r0, #CLASS] // class = struct super->class ldr r9, [r9, #SUPERCLASS] // class = class->superclass CacheLookup NORMAL, _objc_msgSendSuper2 // cache hit, IMP in r12, eq already set for nonstret forwarding ldr r0, [r0, #RECEIVER] // load real receiver bx r12 // call imp CacheLookup2 NORMAL, _objc_msgSendSuper2 // cache miss ldr r9, [r0, #CLASS] // class = struct super->class ldr r9, [r9, #SUPERCLASS] // class = class->superclass ldr r0, [r0, #RECEIVER] // load real receiver b __objc_msgSend_uncached END_ENTRY _objc_msgSendSuper2 ENTRY _objc_msgLookupSuper2 ldr r9, [r0, #CLASS] // class = struct super->class ldr r9, [r9, #SUPERCLASS] // class = class->superclass CacheLookup NORMAL, _objc_msgLookupSuper2 // cache hit, IMP in r12, eq already set for nonstret forwarding ldr r0, [r0, #RECEIVER] // load real receiver bx lr CacheLookup2 NORMAL, _objc_msgLookupSuper2 // cache miss ldr r9, [r0, #CLASS] ldr r9, [r9, #SUPERCLASS] // r9 = class to search ldr r0, [r0, #RECEIVER] // load real receiver b __objc_msgLookup_uncached END_ENTRY _objc_msgLookupSuper2 /******************************************************************** * void objc_msgSendSuper_stret(void *st_addr, objc_super *self, SEL op, ...); * * objc_msgSendSuper_stret is the struct-return form of msgSendSuper. * The ABI calls for r0 to be used as the address of the structure * being returned, with the parameters in the succeeding registers. * * On entry: r0 is the address where the structure is returned, * r1 is the address of the objc_super structure, * r2 is the selector ********************************************************************/ ENTRY _objc_msgSendSuper_stret ldr r9, [r1, #CLASS] // r9 = struct super->class CacheLookup STRET, _objc_msgSendSuper_stret // cache hit, IMP in r12, ne already set for stret forwarding ldr r1, [r1, #RECEIVER] // load real receiver bx r12 // call imp CacheLookup2 STRET, _objc_msgSendSuper_stret // cache miss ldr r9, [r1, #CLASS] // r9 = struct super->class ldr r1, [r1, #RECEIVER] // load real receiver b __objc_msgSend_stret_uncached END_ENTRY _objc_msgSendSuper_stret /******************************************************************** * id objc_msgSendSuper2_stret ********************************************************************/ ENTRY _objc_msgSendSuper2_stret ldr r9, [r1, #CLASS] // class = struct super->class ldr r9, [r9, #SUPERCLASS] // class = class->superclass CacheLookup STRET, _objc_msgSendSuper2_stret // cache hit, IMP in r12, ne already set for stret forwarding ldr r1, [r1, #RECEIVER] // load real receiver bx r12 // call imp CacheLookup2 STRET, _objc_msgSendSuper2_stret // cache miss ldr r9, [r1, #CLASS] // class = struct super->class ldr r9, [r9, #SUPERCLASS] // class = class->superclass ldr r1, [r1, #RECEIVER] // load real receiver b __objc_msgSend_stret_uncached END_ENTRY _objc_msgSendSuper2_stret ENTRY _objc_msgLookupSuper2_stret ldr r9, [r1, #CLASS] // class = struct super->class ldr r9, [r9, #SUPERCLASS] // class = class->superclass CacheLookup STRET, _objc_msgLookupSuper2_stret // cache hit, IMP in r12, ne already set for stret forwarding ldr r1, [r1, #RECEIVER] // load real receiver bx lr CacheLookup2 STRET, _objc_msgLookupSuper2_stret // cache miss ldr r9, [r1, #CLASS] ldr r9, [r9, #SUPERCLASS] // r9 = class to search ldr r1, [r1, #RECEIVER] // load real receiver b __objc_msgLookup_stret_uncached END_ENTRY _objc_msgLookupSuper2_stret ///////////////////////////////////////////////////////////////////// // // MethodTableLookup NORMAL|STRET // // Locate the implementation for a selector in a class's method lists. // // Takes: // $0 = NORMAL, STRET // r0 or r1 (STRET) = receiver // r1 or r2 (STRET) = selector // r9 = class to search in // // On exit: IMP in r12, eq/ne set for forwarding // ///////////////////////////////////////////////////////////////////// .macro MethodTableLookup SAVE_REGS // lookUpImpOrForward(obj, sel, cls, LOOKUP_INITIALIZE | LOOKUP_RESOLVER) .if $0 == NORMAL // receiver already in r0 // selector already in r1 .else mov r0, r1 // receiver mov r1, r2 // selector .endif mov r2, r9 // class to search mov r3, #3 // LOOKUP_INITIALIZE | LOOKUP_RESOLVER blx _lookUpImpOrForward mov r12, r0 // r12 = IMP .if $0 == NORMAL cmp r12, r12 // set eq for nonstret forwarding .else tst r12, r12 // set ne for stret forwarding .endif RESTORE_REGS .endmacro /******************************************************************** * * _objc_msgSend_uncached * _objc_msgSend_stret_uncached * _objc_msgLookup_uncached * _objc_msgLookup_stret_uncached * The uncached method lookup. * ********************************************************************/ STATIC_ENTRY __objc_msgSend_uncached // THIS IS NOT A CALLABLE C FUNCTION // Out-of-band r9 is the class to search MethodTableLookup NORMAL // returns IMP in r12 bx r12 END_ENTRY __objc_msgSend_uncached STATIC_ENTRY __objc_msgSend_stret_uncached // THIS IS NOT A CALLABLE C FUNCTION // Out-of-band r9 is the class to search MethodTableLookup STRET // returns IMP in r12 bx r12 END_ENTRY __objc_msgSend_stret_uncached STATIC_ENTRY __objc_msgLookup_uncached // THIS IS NOT A CALLABLE C FUNCTION // Out-of-band r9 is the class to search MethodTableLookup NORMAL // returns IMP in r12 bx lr END_ENTRY __objc_msgLookup_uncached STATIC_ENTRY __objc_msgLookup_stret_uncached // THIS IS NOT A CALLABLE C FUNCTION // Out-of-band r9 is the class to search MethodTableLookup STRET // returns IMP in r12 bx lr END_ENTRY __objc_msgLookup_stret_uncached /******************************************************************** * * id _objc_msgForward(id self, SEL _cmd,...); * * _objc_msgForward and _objc_msgForward_stret are the externally-callable * functions returned by things like method_getImplementation(). * _objc_msgForward_impcache is the function pointer actually stored in * method caches. * ********************************************************************/ MI_EXTERN(__objc_forward_handler) MI_EXTERN(__objc_forward_stret_handler) STATIC_ENTRY __objc_msgForward_impcache // Method cache version // THIS IS NOT A CALLABLE C FUNCTION // Out-of-band Z is 0 (EQ) for normal, 1 (NE) for stret beq __objc_msgForward b __objc_msgForward_stret END_ENTRY __objc_msgForward_impcache ENTRY __objc_msgForward // Non-stret version MI_GET_EXTERN(r12, __objc_forward_handler) ldr r12, [r12] bx r12 END_ENTRY __objc_msgForward ENTRY __objc_msgForward_stret // Struct-return version MI_GET_EXTERN(r12, __objc_forward_stret_handler) ldr r12, [r12] bx r12 END_ENTRY __objc_msgForward_stret ENTRY _objc_msgSend_noarg b _objc_msgSend END_ENTRY _objc_msgSend_noarg ENTRY _objc_msgSend_debug b _objc_msgSend END_ENTRY _objc_msgSend_debug ENTRY _objc_msgSendSuper2_debug b _objc_msgSendSuper2 END_ENTRY _objc_msgSendSuper2_debug ENTRY _objc_msgSend_stret_debug b _objc_msgSend_stret END_ENTRY _objc_msgSend_stret_debug ENTRY _objc_msgSendSuper2_stret_debug b _objc_msgSendSuper2_stret END_ENTRY _objc_msgSendSuper2_stret_debug ENTRY _method_invoke // See if this is a small method. lsls r12, r1, #31 bne.w L_method_invoke_small // We can directly load the IMP from big methods. // r1 is method triplet instead of SEL ldr r12, [r1, #METHOD_IMP] ldr r1, [r1, #METHOD_NAME] bx r12 L_method_invoke_small: // Small methods require a call to handle swizzling. SAVE_REGS mov r0, r1 bl __method_getImplementationAndName mov r12, r0 mov r9, r1 RESTORE_REGS mov r1, r9 bx r12 END_ENTRY _method_invoke ENTRY _method_invoke_stret // See if this is a small method. lsls r12, r2, #31 bne.w L_method_invoke_stret_small // We can directly load the IMP from big methods. // r2 is method triplet instead of SEL ldr r12, [r2, #METHOD_IMP] ldr r2, [r2, #METHOD_NAME] bx r12 L_method_invoke_stret_small: // Small methods require a call to handle swizzling. SAVE_REGS mov r0, r2 bl __method_getImplementationAndName mov r12, r0 mov r9, r1 RESTORE_REGS mov r2, r9 bx r12 END_ENTRY _method_invoke_stret .section __DATA,__objc_msg_break .long 0 .long 0 #endif
MrOwlSage/objc4-906
31,336
runtime/Messengers.subproj/objc-msg-x86_64.s
/* * Copyright (c) 1999-2007 Apple Inc. All Rights Reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #include <TargetConditionals.h> #if __x86_64__ && !(TARGET_OS_SIMULATOR && !TARGET_OS_MACCATALYST) #include "isa.h" /******************************************************************** ******************************************************************** ** ** objc-msg-x86_64.s - x86-64 code to support objc messaging. ** ******************************************************************** ********************************************************************/ .data // _objc_restartableRanges is used by method dispatch // to get the critical regions for which method caches // cannot be garbage collected. .macro RestartableEntry .quad LLookupStart$0 .short LLookupEnd$0 - LLookupStart$0 .short LCacheMiss$0 - LLookupStart$0 .long 0 .endmacro .align 4 .private_extern _objc_restartableRanges _objc_restartableRanges: RestartableEntry _cache_getImp RestartableEntry _objc_msgSend RestartableEntry _objc_msgSend_fpret RestartableEntry _objc_msgSend_fp2ret RestartableEntry _objc_msgSend_stret RestartableEntry _objc_msgSendSuper RestartableEntry _objc_msgSendSuper_stret RestartableEntry _objc_msgSendSuper2 RestartableEntry _objc_msgSendSuper2_stret RestartableEntry _objc_msgLookup RestartableEntry _objc_msgLookup_fpret RestartableEntry _objc_msgLookup_fp2ret RestartableEntry _objc_msgLookup_stret RestartableEntry _objc_msgLookupSuper2 RestartableEntry _objc_msgLookupSuper2_stret .fill 16, 1, 0 /******************************************************************** * Recommended multi-byte NOP instructions * (Intel 64 and IA-32 Architectures Software Developer's Manual Volume 2B) ********************************************************************/ #define nop1 .byte 0x90 #define nop2 .byte 0x66,0x90 #define nop3 .byte 0x0F,0x1F,0x00 #define nop4 .byte 0x0F,0x1F,0x40,0x00 #define nop5 .byte 0x0F,0x1F,0x44,0x00,0x00 #define nop6 .byte 0x66,0x0F,0x1F,0x44,0x00,0x00 #define nop7 .byte 0x0F,0x1F,0x80,0x00,0x00,0x00,0x00 #define nop8 .byte 0x0F,0x1F,0x84,0x00,0x00,0x00,0x00,0x00 #define nop9 .byte 0x66,0x0F,0x1F,0x84,0x00,0x00,0x00,0x00,0x00 /******************************************************************** * Harmless branch prefix hint for instruction alignment ********************************************************************/ #define PN .byte 0x2e /******************************************************************** * Names for parameter registers. ********************************************************************/ #define a1 rdi #define a1d edi #define a1b dil #define a2 rsi #define a2d esi #define a2b sil #define a3 rdx #define a3d edx #define a3b dl #define a4 rcx #define a4d ecx #define a5 r8 #define a5d r8d #define a6 r9 #define a6d r9d /******************************************************************** * Names for relative labels * DO NOT USE THESE LABELS ELSEWHERE * Reserved labels: 6: 7: 8: 9: ********************************************************************/ #define LNilTestSlow 7 #define LNilTestSlow_f 7f #define LNilTestSlow_b 7b #define LGetIsaDone 8 #define LGetIsaDone_f 8f #define LGetIsaDone_b 8b #define LGetIsaSlow 9 #define LGetIsaSlow_f 9f #define LGetIsaSlow_b 9b /******************************************************************** * Macro parameters ********************************************************************/ #define NORMAL 0 #define FPRET 1 #define FP2RET 2 #define STRET 3 #define CALL 100 #define GETIMP 101 #define LOOKUP 102 #define MSGSEND 200 #define METHOD_INVOKE 201 #define METHOD_INVOKE_STRET 202 /******************************************************************** * * Structure definitions. * ********************************************************************/ // objc_super parameter to sendSuper #define receiver 0 #define class 8 // Selected field offsets in class structure // #define isa 0 USE GetIsa INSTEAD // Method descriptor #define method_name 0 #define method_imp 16 // Method cache #define cached_sel 0 #define cached_imp 8 ////////////////////////////////////////////////////////////////////// // // ENTRY functionName // // Assembly directives to begin an exported function. // // Takes: functionName - name of the exported function ////////////////////////////////////////////////////////////////////// .macro ENTRY .text .globl $0 .align 6, 0x90 $0: .endmacro .macro STATIC_ENTRY .text .private_extern $0 .align 2, 0x90 $0: .endmacro ////////////////////////////////////////////////////////////////////// // // END_ENTRY functionName // // Assembly directives to end an exported function. Just a placeholder, // a close-parenthesis for ENTRY, until it is needed for something. // // Takes: functionName - name of the exported function ////////////////////////////////////////////////////////////////////// .macro END_ENTRY LExit$0: .endmacro /******************************************************************** * UNWIND name, flags * Unwind info generation ********************************************************************/ .macro UNWIND .section __LD,__compact_unwind,regular,debug .quad $0 .set LUnwind$0, LExit$0 - $0 .long LUnwind$0 .long $1 .quad 0 /* no personality */ .quad 0 /* no LSDA */ .text .endmacro #define NoFrame 0x02010000 // no frame, no SP adjustment except return address #define FrameWithNoSaves 0x01000000 // frame, no non-volatile saves ////////////////////////////////////////////////////////////////////// // // SAVE_REGS // // Create a stack frame and save all argument registers in preparation // for a function call. ////////////////////////////////////////////////////////////////////// .macro SAVE_REGS kind .if \kind != MSGSEND && \kind != METHOD_INVOKE && \kind != METHOD_INVOKE_STRET .abort Unknown kind. .endif push %rbp mov %rsp, %rbp sub $0x80, %rsp movdqa %xmm0, -0x80(%rbp) push %rax // might be xmm parameter count movdqa %xmm1, -0x70(%rbp) push %a1 movdqa %xmm2, -0x60(%rbp) .if \kind == MSGSEND || \kind == METHOD_INVOKE_STRET push %a2 .endif movdqa %xmm3, -0x50(%rbp) .if \kind == MSGSEND || \kind == METHOD_INVOKE push %a3 .endif movdqa %xmm4, -0x40(%rbp) push %a4 movdqa %xmm5, -0x30(%rbp) push %a5 movdqa %xmm6, -0x20(%rbp) push %a6 movdqa %xmm7, -0x10(%rbp) .if \kind == MSGSEND push %r10 .endif .endmacro ////////////////////////////////////////////////////////////////////// // // RESTORE_REGS // // Restore all argument registers and pop the stack frame created by // SAVE_REGS. ////////////////////////////////////////////////////////////////////// .macro RESTORE_REGS kind .if \kind == MSGSEND pop %r10 orq $2, %r10 // for the sake of instrumentations, remember it was the slowpath .endif movdqa -0x80(%rbp), %xmm0 pop %a6 movdqa -0x70(%rbp), %xmm1 pop %a5 movdqa -0x60(%rbp), %xmm2 pop %a4 movdqa -0x50(%rbp), %xmm3 .if \kind == MSGSEND || \kind == METHOD_INVOKE pop %a3 .endif movdqa -0x40(%rbp), %xmm4 .if \kind == MSGSEND || \kind == METHOD_INVOKE_STRET pop %a2 .endif movdqa -0x30(%rbp), %xmm5 pop %a1 movdqa -0x20(%rbp), %xmm6 pop %rax movdqa -0x10(%rbp), %xmm7 leave .endmacro ///////////////////////////////////////////////////////////////////// // // CacheLookup return-type, caller, function // // Locate the implementation for a class in a selector's method cache. // // When this is used in a function that doesn't hold the runtime lock, // this represents the critical section that may access dead memory. // If the kernel causes one of these functions to go down the recovery // path, we pretend the lookup failed by jumping the JumpMiss branch. // // Takes: // $0 = NORMAL, FPRET, FP2RET, STRET // $1 = CALL, LOOKUP, GETIMP // a1 or a2 (STRET) = receiver // a2 or a3 (STRET) = selector // r10 = class to search // // On exit: r10 clobbered // (found) calls or returns IMP in r11, eq/ne set for forwarding // (not found) jumps to LCacheMiss, class still in r10 // ///////////////////////////////////////////////////////////////////// .macro CacheHit // r11 = found bucket .if $1 == GETIMP movq cached_imp(%r11), %rax // return imp cmpq $$0, %rax jz 9f // don't xor a nil imp xorq %r10, %rax // xor the isa with the imp 9: ret .else .if $1 == CALL movq cached_imp(%r11), %r11 // load imp xorq %r10, %r11 // xor imp and isa .if $0 != STRET // ne already set for forwarding by `xor` .else cmp %r11, %r11 // set eq for stret forwarding .endif jmp *%r11 // call imp .elseif $1 == LOOKUP movq cached_imp(%r11), %r11 xorq %r10, %r11 // return imp ^ isa ret .else .abort oops .endif .endif .endmacro .macro CacheLookup // // Restart protocol: // // As soon as we're past the LLookupStart$1 label we may have loaded // an invalid cache pointer or mask. // // When task_restartable_ranges_synchronize() is called, // (or when a signal hits us) before we're past LLookupEnd$1, // then our PC will be reset to LCacheMiss$1 which forcefully // jumps to the cache-miss codepath which have the following // requirements: // // GETIMP: // The cache-miss is just returning NULL (setting %rax to 0) // // NORMAL and STRET: // - a1 or a2 (STRET) contains the receiver // - a2 or a3 (STRET) contains the selector // - r10 contains the isa // - other registers are set as per calling conventions // LLookupStart$2: .if $0 != STRET movq %a2, %r11 // r11 = _cmd .else movq %a3, %r11 // r11 = _cmd .endif andl 24(%r10), %r11d // r11 = _cmd & class->cache.mask shlq $$4, %r11 // r11 = offset = (_cmd & mask)<<4 addq 16(%r10), %r11 // r11 = class->cache.buckets + offset .if $0 != STRET cmpq cached_sel(%r11), %a2 // if (bucket->sel != _cmd) .else cmpq cached_sel(%r11), %a3 // if (bucket->sel != _cmd) .endif jne 1f // scan more CacheHit $0, $1 // call or return imp 1: // loop cmpq $$1, cached_sel(%r11) jbe 3f // if (bucket->sel <= 1) wrap or miss addq $$16, %r11 // bucket++ 2: .if $0 != STRET cmpq cached_sel(%r11), %a2 // if (bucket->sel != _cmd) .else cmpq cached_sel(%r11), %a3 // if (bucket->sel != _cmd) .endif jne 1b // scan more CacheHit $0, $1 // call or return imp 3: // wrap or miss jb LCacheMiss$2 // if (bucket->sel < 1) cache miss // wrap movq cached_imp(%r11), %r11 // bucket->imp is really first bucket jmp 2f // Clone scanning loop to miss instead of hang when cache is corrupt. // The slow path may detect any corruption and halt later. 1: // loop cmpq $$1, cached_sel(%r11) jbe 3f // if (bucket->sel <= 1) wrap or miss addq $$16, %r11 // bucket++ 2: .if $0 != STRET cmpq cached_sel(%r11), %a2 // if (bucket->sel != _cmd) .else cmpq cached_sel(%r11), %a3 // if (bucket->sel != _cmd) .endif jne 1b // scan more CacheHit $0, $1 // call or return imp 3: // double wrap or miss jmp LCacheMiss$2 LLookupEnd$2: .endmacro ///////////////////////////////////////////////////////////////////// // // MethodTableLookup NORMAL|STRET // // Takes: a1 or a2 (STRET) = receiver // a2 or a3 (STRET) = selector to search for // r10 = class to search // // On exit: imp in %r11, eq/ne set for forwarding // ///////////////////////////////////////////////////////////////////// .macro MethodTableLookup SAVE_REGS MSGSEND // lookUpImpOrForward(obj, sel, cls, LOOKUP_INITIALIZE | LOOKUP_RESOLVER) .if $0 == NORMAL // receiver already in a1 // selector already in a2 .else movq %a2, %a1 movq %a3, %a2 .endif movq %r10, %a3 movl $$3, %a4d call _lookUpImpOrForward // IMP is now in %rax movq %rax, %r11 RESTORE_REGS MSGSEND .if $0 == NORMAL test %r11, %r11 // set ne for nonstret forwarding .else cmp %r11, %r11 // set eq for stret forwarding .endif .endmacro ///////////////////////////////////////////////////////////////////// // // GetIsaFast return-type // GetIsaSupport return-type // // Sets r10 = obj->isa. Consults the tagged isa table if necessary. // // Takes: $0 = NORMAL or FPRET or FP2RET or STRET // a1 or a2 (STRET) = receiver // // On exit: r10 = receiver->isa // r11 is clobbered // ///////////////////////////////////////////////////////////////////// .macro GetIsaFast .if $0 != STRET testb $$1, %a1b PN jnz LGetIsaSlow_f movq $$ ISA_MASK, %r10 andq (%a1), %r10 .else testb $$1, %a2b PN jnz LGetIsaSlow_f movq $$ ISA_MASK, %r10 andq (%a2), %r10 .endif LGetIsaDone: .endmacro .macro GetIsaSupport LGetIsaSlow: .if $0 != STRET movl %a1d, %r11d .else movl %a2d, %r11d .endif andl $$0xF, %r11d // basic tagged leaq _objc_debug_taggedpointer_classes(%rip), %r10 movq (%r10, %r11, 8), %r10 // read isa from table leaq _OBJC_CLASS_$___NSUnrecognizedTaggedPointer(%rip), %r11 cmp %r10, %r11 jne LGetIsaDone_b // extended tagged .if $0 != STRET movl %a1d, %r11d .else movl %a2d, %r11d .endif shrl $$4, %r11d andl $$0xFF, %r11d leaq _objc_debug_taggedpointer_ext_classes(%rip), %r10 movq (%r10, %r11, 8), %r10 // read isa from table jmp LGetIsaDone_b .endmacro ///////////////////////////////////////////////////////////////////// // // NilTest return-type // // Takes: $0 = NORMAL or FPRET or FP2RET or STRET // %a1 or %a2 (STRET) = receiver // // On exit: Loads non-nil receiver in %a1 or %a2 (STRET) // or returns. // // NilTestReturnZero return-type // // Takes: $0 = NORMAL or FPRET or FP2RET or STRET // %a1 or %a2 (STRET) = receiver // // On exit: Loads non-nil receiver in %a1 or %a2 (STRET) // or returns zero. // // NilTestReturnIMP return-type // // Takes: $0 = NORMAL or FPRET or FP2RET or STRET // %a1 or %a2 (STRET) = receiver // // On exit: Loads non-nil receiver in %a1 or %a2 (STRET) // or returns an IMP in r11 that returns zero. // ///////////////////////////////////////////////////////////////////// .macro ZeroReturn xorl %eax, %eax xorl %edx, %edx xorps %xmm0, %xmm0 xorps %xmm1, %xmm1 .endmacro .macro ZeroReturnFPRET fldz ZeroReturn .endmacro .macro ZeroReturnFP2RET fldz fldz ZeroReturn .endmacro .macro ZeroReturnSTRET // rax gets the struct-return address as passed in rdi movq %rdi, %rax .endmacro STATIC_ENTRY __objc_msgNil ZeroReturn ret END_ENTRY __objc_msgNil STATIC_ENTRY __objc_msgNil_fpret ZeroReturnFPRET ret END_ENTRY __objc_msgNil_fpret STATIC_ENTRY __objc_msgNil_fp2ret ZeroReturnFP2RET ret END_ENTRY __objc_msgNil_fp2ret STATIC_ENTRY __objc_msgNil_stret ZeroReturnSTRET ret END_ENTRY __objc_msgNil_stret .macro NilTest .if $0 != STRET testq %a1, %a1 .else testq %a2, %a2 .endif PN jz LNilTestSlow_f .endmacro .macro NilTestReturnZero .align 3 LNilTestSlow: .if $0 == NORMAL ZeroReturn .elseif $0 == FPRET ZeroReturnFPRET .elseif $0 == FP2RET ZeroReturnFP2RET .elseif $0 == STRET ZeroReturnSTRET .else .abort oops .endif ret .endmacro .macro NilTestReturnIMP .align 3 LNilTestSlow: .if $0 == NORMAL leaq __objc_msgNil(%rip), %r11 .elseif $0 == FPRET leaq __objc_msgNil_fpret(%rip), %r11 .elseif $0 == FP2RET leaq __objc_msgNil_fp2ret(%rip), %r11 .elseif $0 == STRET leaq __objc_msgNil_stret(%rip), %r11 .else .abort oops .endif ret .endmacro /******************************************************************** * IMP cache_getImp(Class cls, SEL sel) * * On entry: a1 = class whose cache is to be searched * a2 = selector to search for * * If found, returns method implementation. * If not found, returns NULL. ********************************************************************/ STATIC_ENTRY _cache_getImp // do lookup movq %a1, %r10 // move class to r10 for CacheLookup // returns IMP on success CacheLookup NORMAL, GETIMP, _cache_getImp LCacheMiss_cache_getImp: // cache miss, return nil xorl %eax, %eax ret END_ENTRY _cache_getImp /******************************************************************** * * id objc_msgSend(id self, SEL _cmd,...); * IMP objc_msgLookup(id self, SEL _cmd, ...); * * objc_msgLookup ABI: * IMP returned in r11 * Forwarding returned in Z flag * r10 reserved for our use but not used * ********************************************************************/ .data .align 3 .globl _objc_debug_taggedpointer_classes _objc_debug_taggedpointer_classes: .fill 16, 8, 0 .globl _objc_debug_taggedpointer_ext_classes _objc_debug_taggedpointer_ext_classes: .fill 256, 8, 0 ENTRY _objc_msgSend UNWIND _objc_msgSend, NoFrame NilTest NORMAL GetIsaFast NORMAL // r10 = self->isa // calls IMP on success CacheLookup NORMAL, CALL, _objc_msgSend NilTestReturnZero NORMAL GetIsaSupport NORMAL // cache miss: go search the method lists LCacheMiss_objc_msgSend: // isa still in r10 jmp __objc_msgSend_uncached END_ENTRY _objc_msgSend ENTRY _objc_msgLookup NilTest NORMAL GetIsaFast NORMAL // r10 = self->isa // returns IMP on success CacheLookup NORMAL, LOOKUP, _objc_msgLookup NilTestReturnIMP NORMAL GetIsaSupport NORMAL // cache miss: go search the method lists LCacheMiss_objc_msgLookup: // isa still in r10 jmp __objc_msgLookup_uncached END_ENTRY _objc_msgLookup ENTRY _objc_msgSend_fixup int3 END_ENTRY _objc_msgSend_fixup STATIC_ENTRY _objc_msgSend_fixedup // Load _cmd from the message_ref movq 8(%a2), %a2 jmp _objc_msgSend END_ENTRY _objc_msgSend_fixedup /******************************************************************** * * id objc_msgSendSuper(struct objc_super *super, SEL _cmd,...); * * struct objc_super { * id receiver; * Class class; * }; ********************************************************************/ ENTRY _objc_msgSendSuper UNWIND _objc_msgSendSuper, NoFrame // search the cache (objc_super in %a1) movq class(%a1), %r10 // class = objc_super->class movq receiver(%a1), %a1 // load real receiver // calls IMP on success CacheLookup NORMAL, CALL, _objc_msgSendSuper // cache miss: go search the method lists LCacheMiss_objc_msgSendSuper: // class still in r10 jmp __objc_msgSend_uncached END_ENTRY _objc_msgSendSuper /******************************************************************** * id objc_msgSendSuper2 ********************************************************************/ ENTRY _objc_msgSendSuper2 UNWIND _objc_msgSendSuper2, NoFrame // objc_super->class is subclass of class to search // search the cache (objc_super in %a1) movq class(%a1), %r10 // cls = objc_super->class movq receiver(%a1), %a1 // load real receiver movq 8(%r10), %r10 // cls = class->superclass // calls IMP on success CacheLookup NORMAL, CALL, _objc_msgSendSuper2 // cache miss: go search the method lists LCacheMiss_objc_msgSendSuper2: // superclass still in r10 jmp __objc_msgSend_uncached END_ENTRY _objc_msgSendSuper2 ENTRY _objc_msgLookupSuper2 // objc_super->class is subclass of class to search // search the cache (objc_super in %a1) movq class(%a1), %r10 // cls = objc_super->class movq receiver(%a1), %a1 // load real receiver movq 8(%r10), %r10 // cls = class->superclass // returns IMP on success CacheLookup NORMAL, LOOKUP, _objc_msgLookupSuper2 // cache miss: go search the method lists LCacheMiss_objc_msgLookupSuper2: // superclass still in r10 jmp __objc_msgLookup_uncached END_ENTRY _objc_msgLookupSuper2 ENTRY _objc_msgSendSuper2_fixup int3 END_ENTRY _objc_msgSendSuper2_fixup STATIC_ENTRY _objc_msgSendSuper2_fixedup // Load _cmd from the message_ref movq 8(%a2), %a2 jmp _objc_msgSendSuper2 END_ENTRY _objc_msgSendSuper2_fixedup /******************************************************************** * * double objc_msgSend_fpret(id self, SEL _cmd,...); * Used for `long double` return only. `float` and `double` use objc_msgSend. * ********************************************************************/ ENTRY _objc_msgSend_fpret UNWIND _objc_msgSend_fpret, NoFrame NilTest FPRET GetIsaFast FPRET // r10 = self->isa // calls IMP on success CacheLookup FPRET, CALL, _objc_msgSend_fpret NilTestReturnZero FPRET GetIsaSupport FPRET // cache miss: go search the method lists LCacheMiss_objc_msgSend_fpret: // isa still in r10 jmp __objc_msgSend_uncached END_ENTRY _objc_msgSend_fpret ENTRY _objc_msgLookup_fpret NilTest FPRET GetIsaFast FPRET // r10 = self->isa // returns IMP on success CacheLookup FPRET, LOOKUP, _objc_msgLookup_fpret NilTestReturnIMP FPRET GetIsaSupport FPRET // cache miss: go search the method lists LCacheMiss_objc_msgLookup_fpret: // isa still in r10 jmp __objc_msgLookup_uncached END_ENTRY _objc_msgLookup_fpret ENTRY _objc_msgSend_fpret_fixup int3 END_ENTRY _objc_msgSend_fpret_fixup STATIC_ENTRY _objc_msgSend_fpret_fixedup // Load _cmd from the message_ref movq 8(%a2), %a2 jmp _objc_msgSend_fpret END_ENTRY _objc_msgSend_fpret_fixedup /******************************************************************** * * double objc_msgSend_fp2ret(id self, SEL _cmd,...); * Used for `complex long double` return only. * ********************************************************************/ ENTRY _objc_msgSend_fp2ret UNWIND _objc_msgSend_fp2ret, NoFrame NilTest FP2RET GetIsaFast FP2RET // r10 = self->isa // calls IMP on success CacheLookup FP2RET, CALL, _objc_msgSend_fp2ret NilTestReturnZero FP2RET GetIsaSupport FP2RET // cache miss: go search the method lists LCacheMiss_objc_msgSend_fp2ret: // isa still in r10 jmp __objc_msgSend_uncached END_ENTRY _objc_msgSend_fp2ret ENTRY _objc_msgLookup_fp2ret NilTest FP2RET GetIsaFast FP2RET // r10 = self->isa // returns IMP on success CacheLookup FP2RET, LOOKUP, _objc_msgLookup_fp2ret NilTestReturnIMP FP2RET GetIsaSupport FP2RET // cache miss: go search the method lists LCacheMiss_objc_msgLookup_fp2ret: // isa still in r10 jmp __objc_msgLookup_uncached END_ENTRY _objc_msgLookup_fp2ret ENTRY _objc_msgSend_fp2ret_fixup int3 END_ENTRY _objc_msgSend_fp2ret_fixup STATIC_ENTRY _objc_msgSend_fp2ret_fixedup // Load _cmd from the message_ref movq 8(%a2), %a2 jmp _objc_msgSend_fp2ret END_ENTRY _objc_msgSend_fp2ret_fixedup /******************************************************************** * * void objc_msgSend_stret(void *st_addr, id self, SEL _cmd, ...); * * objc_msgSend_stret is the struct-return form of msgSend. * The ABI calls for %a1 to be used as the address of the structure * being returned, with the parameters in the succeeding locations. * * On entry: %a1 is the address where the structure is returned, * %a2 is the message receiver, * %a3 is the selector ********************************************************************/ ENTRY _objc_msgSend_stret UNWIND _objc_msgSend_stret, NoFrame NilTest STRET GetIsaFast STRET // r10 = self->isa // calls IMP on success CacheLookup STRET, CALL, _objc_msgSend_stret NilTestReturnZero STRET GetIsaSupport STRET // cache miss: go search the method lists LCacheMiss_objc_msgSend_stret: // isa still in r10 jmp __objc_msgSend_stret_uncached END_ENTRY _objc_msgSend_stret ENTRY _objc_msgLookup_stret NilTest STRET GetIsaFast STRET // r10 = self->isa // returns IMP on success CacheLookup STRET, LOOKUP, _objc_msgLookup_stret NilTestReturnIMP STRET GetIsaSupport STRET // cache miss: go search the method lists LCacheMiss_objc_msgLookup_stret: // isa still in r10 jmp __objc_msgLookup_stret_uncached END_ENTRY _objc_msgLookup_stret ENTRY _objc_msgSend_stret_fixup int3 END_ENTRY _objc_msgSend_stret_fixup STATIC_ENTRY _objc_msgSend_stret_fixedup // Load _cmd from the message_ref movq 8(%a3), %a3 jmp _objc_msgSend_stret END_ENTRY _objc_msgSend_stret_fixedup /******************************************************************** * * void objc_msgSendSuper_stret(void *st_addr, struct objc_super *super, SEL _cmd, ...); * * struct objc_super { * id receiver; * Class class; * }; * * objc_msgSendSuper_stret is the struct-return form of msgSendSuper. * The ABI calls for (sp+4) to be used as the address of the structure * being returned, with the parameters in the succeeding registers. * * On entry: %a1 is the address where the structure is returned, * %a2 is the address of the objc_super structure, * %a3 is the selector * ********************************************************************/ ENTRY _objc_msgSendSuper_stret UNWIND _objc_msgSendSuper_stret, NoFrame // search the cache (objc_super in %a2) movq class(%a2), %r10 // class = objc_super->class movq receiver(%a2), %a2 // load real receiver // calls IMP on success CacheLookup STRET, CALL, _objc_msgSendSuper_stret // cache miss: go search the method lists LCacheMiss_objc_msgSendSuper_stret: // class still in r10 jmp __objc_msgSend_stret_uncached END_ENTRY _objc_msgSendSuper_stret /******************************************************************** * id objc_msgSendSuper2_stret ********************************************************************/ ENTRY _objc_msgSendSuper2_stret UNWIND _objc_msgSendSuper2_stret, NoFrame // search the cache (objc_super in %a2) movq class(%a2), %r10 // class = objc_super->class movq receiver(%a2), %a2 // load real receiver movq 8(%r10), %r10 // class = class->superclass // calls IMP on success CacheLookup STRET, CALL, _objc_msgSendSuper2_stret // cache miss: go search the method lists LCacheMiss_objc_msgSendSuper2_stret: // superclass still in r10 jmp __objc_msgSend_stret_uncached END_ENTRY _objc_msgSendSuper2_stret ENTRY _objc_msgLookupSuper2_stret // search the cache (objc_super in %a2) movq class(%a2), %r10 // class = objc_super->class movq receiver(%a2), %a2 // load real receiver movq 8(%r10), %r10 // class = class->superclass // returns IMP on success CacheLookup STRET, LOOKUP, _objc_msgLookupSuper2_stret // cache miss: go search the method lists LCacheMiss_objc_msgLookupSuper2_stret: // superclass still in r10 jmp __objc_msgLookup_stret_uncached END_ENTRY _objc_msgLookupSuper2_stret ENTRY _objc_msgSendSuper2_stret_fixup int3 END_ENTRY _objc_msgSendSuper2_stret_fixup STATIC_ENTRY _objc_msgSendSuper2_stret_fixedup // Load _cmd from the message_ref movq 8(%a3), %a3 jmp _objc_msgSendSuper2_stret END_ENTRY _objc_msgSendSuper2_stret_fixedup /******************************************************************** * * _objc_msgSend_uncached * _objc_msgSend_stret_uncached * _objc_msgLookup_uncached * _objc_msgLookup_stret_uncached * * The uncached method lookup. * ********************************************************************/ STATIC_ENTRY __objc_msgSend_uncached UNWIND __objc_msgSend_uncached, FrameWithNoSaves // THIS IS NOT A CALLABLE C FUNCTION // Out-of-band r10 is the searched class // r10 is already the class to search MethodTableLookup NORMAL // r11 = IMP jmp *%r11 // goto *imp END_ENTRY __objc_msgSend_uncached STATIC_ENTRY __objc_msgSend_stret_uncached UNWIND __objc_msgSend_stret_uncached, FrameWithNoSaves // THIS IS NOT A CALLABLE C FUNCTION // Out-of-band r10 is the searched class // r10 is already the class to search MethodTableLookup STRET // r11 = IMP jmp *%r11 // goto *imp END_ENTRY __objc_msgSend_stret_uncached STATIC_ENTRY __objc_msgLookup_uncached UNWIND __objc_msgLookup_uncached, FrameWithNoSaves // THIS IS NOT A CALLABLE C FUNCTION // Out-of-band r10 is the searched class // r10 is already the class to search MethodTableLookup NORMAL // r11 = IMP ret END_ENTRY __objc_msgLookup_uncached STATIC_ENTRY __objc_msgLookup_stret_uncached UNWIND __objc_msgLookup_stret_uncached, FrameWithNoSaves // THIS IS NOT A CALLABLE C FUNCTION // Out-of-band r10 is the searched class // r10 is already the class to search MethodTableLookup STRET // r11 = IMP ret END_ENTRY __objc_msgLookup_stret_uncached /******************************************************************** * * id _objc_msgForward(id self, SEL _cmd,...); * * _objc_msgForward and _objc_msgForward_stret are the externally-callable * functions returned by things like method_getImplementation(). * _objc_msgForward_impcache is the function pointer actually stored in * method caches. * ********************************************************************/ STATIC_ENTRY __objc_msgForward_impcache // Method cache version // THIS IS NOT A CALLABLE C FUNCTION // Out-of-band condition register is NE for stret, EQ otherwise. je __objc_msgForward_stret jmp __objc_msgForward END_ENTRY __objc_msgForward_impcache ENTRY __objc_msgForward // Non-stret version movq __objc_forward_handler(%rip), %r11 jmp *%r11 END_ENTRY __objc_msgForward ENTRY __objc_msgForward_stret // Struct-return version movq __objc_forward_stret_handler(%rip), %r11 jmp *%r11 END_ENTRY __objc_msgForward_stret ENTRY _objc_msgSend_debug jmp _objc_msgSend END_ENTRY _objc_msgSend_debug ENTRY _objc_msgSendSuper2_debug jmp _objc_msgSendSuper2 END_ENTRY _objc_msgSendSuper2_debug ENTRY _objc_msgSend_stret_debug jmp _objc_msgSend_stret END_ENTRY _objc_msgSend_stret_debug ENTRY _objc_msgSendSuper2_stret_debug jmp _objc_msgSendSuper2_stret END_ENTRY _objc_msgSendSuper2_stret_debug ENTRY _objc_msgSend_fpret_debug jmp _objc_msgSend_fpret END_ENTRY _objc_msgSend_fpret_debug ENTRY _objc_msgSend_fp2ret_debug jmp _objc_msgSend_fp2ret END_ENTRY _objc_msgSend_fp2ret_debug ENTRY _objc_msgSend_noarg jmp _objc_msgSend END_ENTRY _objc_msgSend_noarg ENTRY _method_invoke // See if this is a small method. testb $1, %a2b jnz L_method_invoke_small // We can directly load the IMP from big methods. movq method_imp(%a2), %r11 movq method_name(%a2), %a2 jmp *%r11 L_method_invoke_small: // Small methods require a call to handle swizzling. SAVE_REGS METHOD_INVOKE movq %a2, %a1 call __method_getImplementationAndName movq %rdx, %a2 movq %rax, %r11 RESTORE_REGS METHOD_INVOKE jmp *%r11 END_ENTRY _method_invoke ENTRY _method_invoke_stret // See if this is a small method. testb $1, %a3b jnz L_method_invoke_stret_small // We can directly load the IMP from big methods. movq method_imp(%a3), %r11 movq method_name(%a3), %a3 jmp *%r11 L_method_invoke_stret_small: // Small methods require a call to handle swizzling. SAVE_REGS METHOD_INVOKE_STRET movq %a3, %a1 call __method_getImplementationAndName movq %rdx, %a3 movq %rax, %r11 RESTORE_REGS METHOD_INVOKE_STRET jmp *%r11 END_ENTRY _method_invoke_stret .section __DATA,__objc_msg_break .quad 0 .quad 0 #endif
MrOwlSage/objc4-906
23,681
runtime/Messengers.subproj/objc-msg-arm64.s
/* * @APPLE_LICENSE_HEADER_START@ * * Copyright (c) 2011 Apple Inc. All Rights Reserved. * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ /******************************************************************** * * objc-msg-arm64.s - ARM64 code to support objc messaging * ********************************************************************/ #ifdef __arm64__ #include "isa.h" #include "objc-config.h" #include "arm64-asm.h" #if TARGET_OS_IPHONE && __LP64__ .section __TEXT,__objc_methname,cstring_literals l_MagicSelector: /* the shared cache builder knows about this value */ .byte 0xf0, 0x9f, 0xa4, 0xaf, 0 .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip .p2align 3 _MagicSelRef: .quad l_MagicSelector #endif .data // _objc_restartableRanges is used by method dispatch // caching code to figure out whether any threads are actively // in the cache for dispatching. The labels surround the asm code // that do cache lookups. The tables are zero-terminated. .macro RestartableEntry #if __LP64__ .quad LLookupStart$0 #else .long LLookupStart$0 .long 0 #endif .short LLookupEnd$0 - LLookupStart$0 .short LLookupRecover$0 - LLookupStart$0 .long 0 .endmacro .align 4 .private_extern _objc_restartableRanges _objc_restartableRanges: RestartableEntry _cache_getImp RestartableEntry _objc_msgSend RestartableEntry _objc_msgSendSuper2 RestartableEntry _objc_msgLookup RestartableEntry _objc_msgLookupSuper2 .fill 16, 1, 0 /* objc_super parameter to sendSuper */ #define RECEIVER 0 #define CLASS __SIZEOF_POINTER__ /* Selected field offsets in class structure */ #define SUPERCLASS __SIZEOF_POINTER__ #define CACHE (2 * __SIZEOF_POINTER__) /* Selected field offsets in method structure */ #define METHOD_NAME 0 #define METHOD_TYPES __SIZEOF_POINTER__ #define METHOD_IMP (2 * __SIZEOF_POINTER__) #define BUCKET_SIZE (2 * __SIZEOF_POINTER__) /******************************************************************** * GetClassFromIsa_p16 src, needs_auth, auth_address * src is a raw isa field. Sets p16 to the corresponding class pointer. * The raw isa might be an indexed isa to be decoded, or a * packed isa that needs to be masked. * * On exit: * src is unchanged * p16 is a class pointer * x10 is clobbered ********************************************************************/ #if SUPPORT_INDEXED_ISA .align 3 .globl _objc_indexed_classes _objc_indexed_classes: .fill ISA_INDEX_COUNT, PTRSIZE, 0 #endif .text .private_extern _objc_msgSend_indirect_branch _objc_msgSend_indirect_branch: .long LTailCallCachedImpIndirectBranch - . .macro GetClassFromIsa_p16 src, needs_auth, auth_address /* note: auth_address is not required if !needs_auth */ #if SUPPORT_INDEXED_ISA // Indexed isa mov p16, \src // optimistically set dst = src tbz p16, #ISA_INDEX_IS_NPI_BIT, 1f // done if not non-pointer isa // isa in p16 is indexed adrp x10, _objc_indexed_classes@PAGE add x10, x10, _objc_indexed_classes@PAGEOFF ubfx p16, p16, #ISA_INDEX_SHIFT, #ISA_INDEX_BITS // extract index ldr p16, [x10, p16, UXTP #PTRSHIFT] // load class from array 1: #elif __LP64__ .if \needs_auth == 0 // _cache_getImp takes an authed class already mov p16, \src .else // 64-bit packed isa ExtractISA p16, \src, \auth_address .endif #else // 32-bit raw isa mov p16, \src #endif .endmacro /******************************************************************** * ENTRY functionName * STATIC_ENTRY functionName * END_ENTRY functionName ********************************************************************/ .macro ENTRY /* name */ .text .align 5 .globl $0 $0: .endmacro .macro MSG_ENTRY /*name*/ .text .align 10 .globl $0 $0: .endmacro .macro STATIC_ENTRY /*name*/ .text .align 5 .private_extern $0 $0: .endmacro .macro END_ENTRY /* name */ LExit$0: .endmacro /******************************************************************** * UNWIND name, flags * Unwind info generation ********************************************************************/ .macro UNWIND .section __LD,__compact_unwind,regular,debug PTR $0 .set LUnwind$0, LExit$0 - $0 .long LUnwind$0 .long $1 PTR 0 /* no personality */ PTR 0 /* no LSDA */ .text .endmacro #define NoFrame 0x02000000 // no frame, no SP adjustment #define FrameWithNoSaves 0x04000000 // frame, no non-volatile saves #define MSGSEND 100 #define METHOD_INVOKE 101 ////////////////////////////////////////////////////////////////////// // // SAVE_REGS // // Create a stack frame and save all argument registers in preparation // for a function call. ////////////////////////////////////////////////////////////////////// .macro SAVE_REGS kind // push frame SignLR stp fp, lr, [sp, #-16]! mov fp, sp // save parameter registers: x0..x8, q0..q7 sub sp, sp, #(10*8 + 8*16) stp q0, q1, [sp, #(0*16)] stp q2, q3, [sp, #(2*16)] stp q4, q5, [sp, #(4*16)] stp q6, q7, [sp, #(6*16)] stp x0, x1, [sp, #(8*16+0*8)] stp x2, x3, [sp, #(8*16+2*8)] stp x4, x5, [sp, #(8*16+4*8)] stp x6, x7, [sp, #(8*16+6*8)] .if \kind == MSGSEND stp x8, x15, [sp, #(8*16+8*8)] mov x16, x15 // stashed by CacheLookup, restore to x16 .elseif \kind == METHOD_INVOKE str x8, [sp, #(8*16+8*8)] .else .abort Unknown kind. .endif .endmacro ////////////////////////////////////////////////////////////////////// // // RESTORE_REGS // // Restore all argument registers and pop the stack frame created by // SAVE_REGS. ////////////////////////////////////////////////////////////////////// .macro RESTORE_REGS kind ldp q0, q1, [sp, #(0*16)] ldp q2, q3, [sp, #(2*16)] ldp q4, q5, [sp, #(4*16)] ldp q6, q7, [sp, #(6*16)] ldp x0, x1, [sp, #(8*16+0*8)] ldp x2, x3, [sp, #(8*16+2*8)] ldp x4, x5, [sp, #(8*16+4*8)] ldp x6, x7, [sp, #(8*16+6*8)] .if \kind == MSGSEND ldp x8, x16, [sp, #(8*16+8*8)] orr x16, x16, #2 // for the sake of instrumentations, remember it was the slowpath .elseif \kind == METHOD_INVOKE ldr x8, [sp, #(8*16+8*8)] .else .abort Unknown kind. .endif mov sp, fp ldp fp, lr, [sp], #16 AuthenticateLR .endmacro /******************************************************************** * * CacheLookup NORMAL|GETIMP|LOOKUP <function> MissLabelDynamic MissLabelConstant * * MissLabelConstant is only used for the GETIMP variant. * * Locate the implementation for a selector in a class method cache. * * When this is used in a function that doesn't hold the runtime lock, * this represents the critical section that may access dead memory. * If the kernel causes one of these functions to go down the recovery * path, we pretend the lookup failed by jumping the JumpMiss branch. * * Takes: * x1 = selector * x16 = class to be searched * * Kills: * x9,x10,x11,x12,x13,x15,x17 * * Untouched: * x14 * * On exit: (found) calls or returns IMP * with x16 = class, x17 = IMP * In LOOKUP mode, the two low bits are set to 0x3 * if we hit a constant cache (used in objc_trace) * (not found) jumps to LCacheMiss * with x15 = class * For constant caches in LOOKUP mode, the low bit * of x16 is set to 0x1 to indicate we had to fallback. * In addition, when LCacheMiss is __objc_msgSend_uncached or * __objc_msgLookup_uncached, 0x2 will be set in x16 * to remember we took the slowpath. * So the two low bits of x16 on exit mean: * 0: dynamic hit * 1: fallback to the parent class, when there is a preoptimized cache * 2: slowpath * 3: preoptimized cache hit * ********************************************************************/ #define NORMAL 0 #define GETIMP 1 #define LOOKUP 2 // CacheHit: x17 = cached IMP, x10 = address of buckets, x1 = SEL, x16 = isa .macro CacheHit .if $0 == NORMAL TailCallCachedImp x17, x10, x1, x16 // authenticate and call imp .elseif $0 == GETIMP mov p0, p17 cbz p0, 9f // don't ptrauth a nil imp AuthAndResignAsIMP x0, x10, x1, x16, x17 // authenticate imp and re-sign as IMP 9: ret // return IMP .elseif $0 == LOOKUP // No nil check for ptrauth: the caller would crash anyway when they // jump to a nil IMP. We don't care if that jump also fails ptrauth. AuthAndResignAsIMP x17, x10, x1, x16, x10 // authenticate imp and re-sign as IMP cmp x16, x15 cinc x16, x16, ne // x16 += 1 when x15 != x16 (for instrumentation ; fallback to the parent class) ret // return imp via x17 .else .abort oops .endif .endmacro .macro CacheLookup Mode, Function, MissLabelDynamic, MissLabelConstant // // Restart protocol: // // As soon as we're past the LLookupStart\Function label we may have // loaded an invalid cache pointer or mask. // // When task_restartable_ranges_synchronize() is called, // (or when a signal hits us) before we're past LLookupEnd\Function, // then our PC will be reset to LLookupRecover\Function which forcefully // jumps to the cache-miss codepath which have the following // requirements: // // GETIMP: // The cache-miss is just returning NULL (setting x0 to 0) // // NORMAL and LOOKUP: // - x0 contains the receiver // - x1 contains the selector // - x16 contains the isa // - other registers are set as per calling conventions // mov x15, x16 // stash the original isa LLookupStart\Function: // p1 = SEL, p16 = isa #if CACHE_MASK_STORAGE == CACHE_MASK_STORAGE_HIGH_16_BIG_ADDRS ldr p10, [x16, #CACHE] // p10 = mask|buckets lsr p11, p10, #48 // p11 = mask and p10, p10, #0xffffffffffff // p10 = buckets and w12, w1, w11 // x12 = _cmd & mask #elif CACHE_MASK_STORAGE == CACHE_MASK_STORAGE_HIGH_16 ldr p11, [x16, #CACHE] // p11 = mask|buckets #if CONFIG_USE_PREOPT_CACHES #if __has_feature(ptrauth_calls) tbnz p11, #0, LLookupPreopt\Function and p10, p11, #0x0000ffffffffffff // p10 = buckets #else and p10, p11, #0x0000fffffffffffe // p10 = buckets tbnz p11, #0, LLookupPreopt\Function #endif eor p12, p1, p1, LSR #7 and p12, p12, p11, LSR #48 // x12 = (_cmd ^ (_cmd >> 7)) & mask #else and p10, p11, #0x0000ffffffffffff // p10 = buckets and p12, p1, p11, LSR #48 // x12 = _cmd & mask #endif // CONFIG_USE_PREOPT_CACHES #elif CACHE_MASK_STORAGE == CACHE_MASK_STORAGE_LOW_4 ldr p11, [x16, #CACHE] // p11 = mask|buckets and p10, p11, #~0xf // p10 = buckets and p11, p11, #0xf // p11 = maskShift mov p12, #0xffff lsr p11, p12, p11 // p11 = mask = 0xffff >> p11 and p12, p1, p11 // x12 = _cmd & mask #else #error Unsupported cache mask storage for ARM64. #endif add p13, p10, p12, LSL #(1+PTRSHIFT) // p13 = buckets + ((_cmd & mask) << (1+PTRSHIFT)) // do { 1: ldp p17, p9, [x13], #-BUCKET_SIZE // {imp, sel} = *bucket-- cmp p9, p1 // if (sel != _cmd) { b.ne 3f // scan more // } else { 2: CacheHit \Mode // hit: call or return imp // } 3: cbz p9, \MissLabelDynamic // if (sel == 0) goto Miss; cmp p13, p10 // } while (bucket >= buckets) b.hs 1b // wrap-around: // p10 = first bucket // p11 = mask (and maybe other bits on LP64) // p12 = _cmd & mask // // A full cache can happen with CACHE_ALLOW_FULL_UTILIZATION. // So stop when we circle back to the first probed bucket // rather than when hitting the first bucket again. // // Note that we might probe the initial bucket twice // when the first probed slot is the last entry. #if CACHE_MASK_STORAGE == CACHE_MASK_STORAGE_HIGH_16_BIG_ADDRS add p13, p10, w11, UXTW #(1+PTRSHIFT) // p13 = buckets + (mask << 1+PTRSHIFT) #elif CACHE_MASK_STORAGE == CACHE_MASK_STORAGE_HIGH_16 add p13, p10, p11, LSR #(48 - (1+PTRSHIFT)) // p13 = buckets + (mask << 1+PTRSHIFT) // see comment about maskZeroBits #elif CACHE_MASK_STORAGE == CACHE_MASK_STORAGE_LOW_4 add p13, p10, p11, LSL #(1+PTRSHIFT) // p13 = buckets + (mask << 1+PTRSHIFT) #else #error Unsupported cache mask storage for ARM64. #endif add p12, p10, p12, LSL #(1+PTRSHIFT) // p12 = first probed bucket // do { 4: ldp p17, p9, [x13], #-BUCKET_SIZE // {imp, sel} = *bucket-- cmp p9, p1 // if (sel == _cmd) b.eq 2b // goto hit cmp p9, #0 // } while (sel != 0 && ccmp p13, p12, #0, ne // bucket > first_probed) b.hi 4b LLookupEnd\Function: LLookupRecover\Function: b \MissLabelDynamic #if CONFIG_USE_PREOPT_CACHES #if CACHE_MASK_STORAGE != CACHE_MASK_STORAGE_HIGH_16 #error config unsupported #endif LLookupPreopt\Function: #if __has_feature(ptrauth_calls) and p10, p11, #0x007ffffffffffffe // p10 = buckets autdb x10, x16 // auth as early as possible #endif // x12 = (_cmd - first_shared_cache_sel) adrp x9, _MagicSelRef@PAGE ldr p9, [x9, _MagicSelRef@PAGEOFF] sub p12, p1, p9 // w9 = ((_cmd - first_shared_cache_sel) >> hash_shift & hash_mask) #if __has_feature(ptrauth_calls) // bits 63..60 of x11 are the number of bits in hash_mask // bits 59..55 of x11 is hash_shift lsr x17, x11, #55 // w17 = (hash_shift, ...) lsr w9, w12, w17 // >>= shift lsr x17, x11, #60 // w17 = mask_bits mov x11, #0x7fff lsr x11, x11, x17 // p11 = mask (0x7fff >> mask_bits) and x9, x9, x11 // &= mask #else // bits 63..53 of x11 is hash_mask // bits 52..48 of x11 is hash_shift lsr x17, x11, #48 // w17 = (hash_shift, hash_mask) lsr w9, w12, w17 // >>= shift and x9, x9, x11, LSR #53 // &= mask #endif // sel_offs is 26 bits because it needs to address a 64 MB buffer (~ 20 MB as of writing) // keep the remaining 38 bits for the IMP offset, which may need to reach // across the shared cache. This offset needs to be shifted << 2. We did this // to give it even more reach, given the alignment of source (the class data) // and destination (the IMP) ldr x17, [x10, x9, LSL #3] // x17 == (sel_offs << 38) | imp_offs cmp x12, x17, LSR #38 .if \Mode == GETIMP b.ne \MissLabelConstant // cache miss sbfiz x17, x17, #2, #38 // imp_offs = combined_imp_and_sel[0..37] << 2 sub x0, x16, x17 // imp = isa - imp_offs SignAsImp x0, x17 ret .else b.ne 5f // cache miss sbfiz x17, x17, #2, #38 // imp_offs = combined_imp_and_sel[0..37] << 2 sub x17, x16, x17 // imp = isa - imp_offs .if \Mode == NORMAL br x17 .elseif \Mode == LOOKUP orr x16, x16, #3 // for instrumentation, note that we hit a constant cache SignAsImp x17, x10 ret .else .abort unhandled mode \Mode .endif 5: ldur x9, [x10, #-16] // offset -16 is the fallback offset add x16, x16, x9 // compute the fallback isa b LLookupStart\Function // lookup again with a new isa .endif #endif // CONFIG_USE_PREOPT_CACHES .endmacro /******************************************************************** * * id objc_msgSend(id self, SEL _cmd, ...); * IMP objc_msgLookup(id self, SEL _cmd, ...); * * objc_msgLookup ABI: * IMP returned in x17 * x16 reserved for our use but not used * ********************************************************************/ #if SUPPORT_TAGGED_POINTERS .data .align 3 .globl _objc_debug_taggedpointer_ext_classes _objc_debug_taggedpointer_ext_classes: .fill 256, 8, 0 // Dispatch for split tagged pointers take advantage of the fact that // the extended tag classes array immediately precedes the standard // tag array. The .alt_entry directive ensures that the two stay // together. This is harmless when using non-split tagged pointers. .globl _objc_debug_taggedpointer_classes .alt_entry _objc_debug_taggedpointer_classes _objc_debug_taggedpointer_classes: .fill 16, 8, 0 // Look up the class for a tagged pointer in x0, placing it in x16. .macro GetTaggedClass and x10, x0, #0x7 // x10 = small tag asr x11, x0, #55 // x11 = large tag with 1s filling the top (because bit 63 is 1 on a tagged pointer) cmp x10, #7 // tag == 7? csel x12, x11, x10, eq // x12 = index in tagged pointer classes array, negative for extended tags. // The extended tag array is placed immediately before the basic tag array // so this looks into the right place either way. The sign extension done // by the asr instruction produces the value extended_tag - 256, which produces // the correct index in the extended tagged pointer classes array. // x16 = _objc_debug_taggedpointer_classes[x12] adrp x10, _objc_debug_taggedpointer_classes@PAGE add x10, x10, _objc_debug_taggedpointer_classes@PAGEOFF #if !__has_feature(ptrauth_calls) ldr x16, [x10, x12, LSL #3] #else add x10, x10, x12, LSL #3 ldr x16, [x10] movk x10, #TAGGED_POINTER_TABLE_ENTRY_DISCRIMINATOR, LSL #48 autdb x16, x10 #endif .endmacro #endif MSG_ENTRY _objc_msgSend UNWIND _objc_msgSend, NoFrame cmp p0, #0 // nil check and tagged pointer check #if SUPPORT_TAGGED_POINTERS b.le LNilOrTagged // (MSB tagged pointer looks negative) #else b.eq LReturnZero #endif ldr p14, [x0] // p14 = raw isa GetClassFromIsa_p16 p14, 1, x0 // p16 = class LGetIsaDone: // calls imp or objc_msgSend_uncached CacheLookup NORMAL, _objc_msgSend, __objc_msgSend_uncached #if SUPPORT_TAGGED_POINTERS LNilOrTagged: b.eq LReturnZero // nil check GetTaggedClass b LGetIsaDone // SUPPORT_TAGGED_POINTERS #endif LReturnZero: // x0 is already zero mov x1, #0 movi d0, #0 movi d1, #0 movi d2, #0 movi d3, #0 ret END_ENTRY _objc_msgSend ENTRY _objc_msgLookup UNWIND _objc_msgLookup, NoFrame cmp p0, #0 // nil check and tagged pointer check #if SUPPORT_TAGGED_POINTERS b.le LLookup_NilOrTagged // (MSB tagged pointer looks negative) #else b.eq LLookup_Nil #endif ldr p13, [x0] // p13 = isa GetClassFromIsa_p16 p13, 1, x0 // p16 = class LLookup_GetIsaDone: // returns imp CacheLookup LOOKUP, _objc_msgLookup, __objc_msgLookup_uncached #if SUPPORT_TAGGED_POINTERS LLookup_NilOrTagged: b.eq LLookup_Nil // nil check GetTaggedClass b LLookup_GetIsaDone // SUPPORT_TAGGED_POINTERS #endif LLookup_Nil: adr x17, __objc_msgNil SignAsImp x17, x16 ret END_ENTRY _objc_msgLookup STATIC_ENTRY __objc_msgNil // x0 is already zero mov x1, #0 movi d0, #0 movi d1, #0 movi d2, #0 movi d3, #0 ret END_ENTRY __objc_msgNil ENTRY _objc_msgSendSuper UNWIND _objc_msgSendSuper, NoFrame ldp p0, p16, [x0] // p0 = real receiver, p16 = class b L_objc_msgSendSuper2_body END_ENTRY _objc_msgSendSuper // no _objc_msgLookupSuper ENTRY _objc_msgSendSuper2 UNWIND _objc_msgSendSuper2, NoFrame #if __has_feature(ptrauth_calls) ldp x0, x17, [x0] // x0 = real receiver, x17 = class add x17, x17, #SUPERCLASS // x17 = &class->superclass ldr x16, [x17] // x16 = class->superclass AuthISASuper x16, x17, ISA_SIGNING_DISCRIMINATOR_CLASS_SUPERCLASS LMsgSendSuperResume: #else ldp p0, p16, [x0] // p0 = real receiver, p16 = class ldr p16, [x16, #SUPERCLASS] // p16 = class->superclass #endif L_objc_msgSendSuper2_body: CacheLookup NORMAL, _objc_msgSendSuper2, __objc_msgSend_uncached END_ENTRY _objc_msgSendSuper2 ENTRY _objc_msgLookupSuper2 UNWIND _objc_msgLookupSuper2, NoFrame #if __has_feature(ptrauth_calls) ldp x0, x17, [x0] // x0 = real receiver, x17 = class add x17, x17, #SUPERCLASS // x17 = &class->superclass ldr x16, [x17] // x16 = class->superclass AuthISASuper x16, x17, ISA_SIGNING_DISCRIMINATOR_CLASS_SUPERCLASS LMsgLookupSuperResume: #else ldp p0, p16, [x0] // p0 = real receiver, p16 = class ldr p16, [x16, #SUPERCLASS] // p16 = class->superclass #endif CacheLookup LOOKUP, _objc_msgLookupSuper2, __objc_msgLookup_uncached END_ENTRY _objc_msgLookupSuper2 .macro MethodTableLookup SAVE_REGS MSGSEND // lookUpImpOrForward(obj, sel, cls, LOOKUP_INITIALIZE | LOOKUP_RESOLVER) // receiver and selector already in x0 and x1 mov x2, x16 mov x3, #3 bl _lookUpImpOrForward // IMP in x0 mov x17, x0 RESTORE_REGS MSGSEND .endmacro STATIC_ENTRY __objc_msgSend_uncached UNWIND __objc_msgSend_uncached, FrameWithNoSaves // THIS IS NOT A CALLABLE C FUNCTION // Out-of-band p15 is the class to search MethodTableLookup TailCallFunctionPointer x17 END_ENTRY __objc_msgSend_uncached STATIC_ENTRY __objc_msgLookup_uncached UNWIND __objc_msgLookup_uncached, FrameWithNoSaves // THIS IS NOT A CALLABLE C FUNCTION // Out-of-band p15 is the class to search MethodTableLookup ret END_ENTRY __objc_msgLookup_uncached STATIC_ENTRY _cache_getImp GetClassFromIsa_p16 p0, 0 CacheLookup GETIMP, _cache_getImp, LGetImpMissDynamic, LGetImpMissConstant LGetImpMissDynamic: mov p0, #0 ret LGetImpMissConstant: mov p0, p2 ret END_ENTRY _cache_getImp /******************************************************************** * * id _objc_msgForward(id self, SEL _cmd,...); * * _objc_msgForward is the externally-callable * function returned by things like method_getImplementation(). * _objc_msgForward_impcache is the function pointer actually stored in * method caches. * ********************************************************************/ STATIC_ENTRY __objc_msgForward_impcache // No stret specialization. b __objc_msgForward END_ENTRY __objc_msgForward_impcache ENTRY __objc_msgForward adrp x17, __objc_forward_handler@PAGE ldr p17, [x17, __objc_forward_handler@PAGEOFF] TailCallFunctionPointer x17 END_ENTRY __objc_msgForward ENTRY _objc_msgSend_noarg b _objc_msgSend END_ENTRY _objc_msgSend_noarg ENTRY _objc_msgSend_debug b _objc_msgSend END_ENTRY _objc_msgSend_debug ENTRY _objc_msgSendSuper2_debug b _objc_msgSendSuper2 END_ENTRY _objc_msgSendSuper2_debug ENTRY _method_invoke // See if this is a small method. tbnz p1, #0, L_method_invoke_small // We can directly load the IMP from big methods. // x1 is method triplet instead of SEL #if __has_feature(ptrauth_calls) mov w17, #METHOD_SIGNING_DISCRIMINATOR autdb p1, p17 #endif // Strip off the kind field in the lower two bits. and p1, p1, ~0x3 add p16, p1, #METHOD_IMP ldr p17, [x16] ldr p1, [x1, #METHOD_NAME] #if __has_feature(ptrauth_calls) // Strip the selector for big signed methods. This is unnecessary for // big non-signed methods, but harmless. xpacd p1 #endif TailCallMethodListImp x17, x16 L_method_invoke_small: // Small methods require a call to handle swizzling. SAVE_REGS METHOD_INVOKE mov p0, p1 bl __method_getImplementationAndName // ARM64_32 packs both return values into x0, with SEL in the high bits and IMP in the low. // ARM64 just returns them in x0 and x1. mov x17, x0 #if __LP64__ mov x16, x1 #endif RESTORE_REGS METHOD_INVOKE #if __LP64__ mov x1, x16 #else lsr x1, x17, #32 mov w17, w17 #endif TailCallFunctionPointer x17 END_ENTRY _method_invoke #endif
msftguy/ssh-rd
15,839
_3rd/zlib/contrib/gcc_gvmat64/gvmat64.S
/* ;uInt longest_match_x64( ; deflate_state *s, ; IPos cur_match); // current match ; gvmat64.S -- Asm portion of the optimized longest_match for 32 bits x86_64 ; (AMD64 on Athlon 64, Opteron, Phenom ; and Intel EM64T on Pentium 4 with EM64T, Pentium D, Core 2 Duo, Core I5/I7) ; this file is translation from gvmat64.asm to GCC 4.x (for Linux, Mac XCode) ; Copyright (C) 1995-2010 Jean-loup Gailly, Brian Raiter and Gilles Vollant. ; ; File written by Gilles Vollant, by converting to assembly the longest_match ; from Jean-loup Gailly in deflate.c of zLib and infoZip zip. ; and by taking inspiration on asm686 with masm, optimised assembly code ; from Brian Raiter, written 1998 ; ; This software is provided 'as-is', without any express or implied ; warranty. In no event will the authors be held liable for any damages ; arising from the use of this software. ; ; Permission is granted to anyone to use this software for any purpose, ; including commercial applications, and to alter it and redistribute it ; freely, subject to the following restrictions: ; ; 1. The origin of this software must not be misrepresented; you must not ; claim that you wrote the original software. If you use this software ; in a product, an acknowledgment in the product documentation would be ; appreciated but is not required. ; 2. Altered source versions must be plainly marked as such, and must not be ; misrepresented as being the original software ; 3. This notice may not be removed or altered from any source distribution. ; ; http://www.zlib.net ; http://www.winimage.com/zLibDll ; http://www.muppetlabs.com/~breadbox/software/assembly.html ; ; to compile this file for zLib, I use option: ; gcc -c -arch x86_64 gvmat64.S ;uInt longest_match(s, cur_match) ; deflate_state *s; ; IPos cur_match; // current match / ; ; with XCode for Mac, I had strange error with some jump on intel syntax ; this is why BEFORE_JMP and AFTER_JMP are used */ #define BEFORE_JMP .att_syntax #define AFTER_JMP .intel_syntax noprefix #ifndef NO_UNDERLINE # define match_init _match_init # define longest_match _longest_match #endif .intel_syntax noprefix .globl match_init, longest_match .text longest_match: #define LocalVarsSize 96 /* ; register used : rax,rbx,rcx,rdx,rsi,rdi,r8,r9,r10,r11,r12 ; free register : r14,r15 ; register can be saved : rsp */ #define chainlenwmask (rsp + 8 - LocalVarsSize) #define nicematch (rsp + 16 - LocalVarsSize) #define save_rdi (rsp + 24 - LocalVarsSize) #define save_rsi (rsp + 32 - LocalVarsSize) #define save_rbx (rsp + 40 - LocalVarsSize) #define save_rbp (rsp + 48 - LocalVarsSize) #define save_r12 (rsp + 56 - LocalVarsSize) #define save_r13 (rsp + 64 - LocalVarsSize) #define save_r14 (rsp + 72 - LocalVarsSize) #define save_r15 (rsp + 80 - LocalVarsSize) /* ; all the +4 offsets are due to the addition of pending_buf_size (in zlib ; in the deflate_state structure since the asm code was first written ; (if you compile with zlib 1.0.4 or older, remove the +4). ; Note : these value are good with a 8 bytes boundary pack structure */ #define MAX_MATCH 258 #define MIN_MATCH 3 #define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1) /* ;;; Offsets for fields in the deflate_state structure. These numbers ;;; are calculated from the definition of deflate_state, with the ;;; assumption that the compiler will dword-align the fields. (Thus, ;;; changing the definition of deflate_state could easily cause this ;;; program to crash horribly, without so much as a warning at ;;; compile time. Sigh.) ; all the +zlib1222add offsets are due to the addition of fields ; in zlib in the deflate_state structure since the asm code was first written ; (if you compile with zlib 1.0.4 or older, use "zlib1222add equ (-4)"). ; (if you compile with zlib between 1.0.5 and 1.2.2.1, use "zlib1222add equ 0"). ; if you compile with zlib 1.2.2.2 or later , use "zlib1222add equ 8"). */ /* you can check the structure offset by running #include <stdlib.h> #include <stdio.h> #include "deflate.h" void print_depl() { deflate_state ds; deflate_state *s=&ds; printf("size pointer=%u\n",(int)sizeof(void*)); printf("#define dsWSize %u\n",(int)(((char*)&(s->w_size))-((char*)s))); printf("#define dsWMask %u\n",(int)(((char*)&(s->w_mask))-((char*)s))); printf("#define dsWindow %u\n",(int)(((char*)&(s->window))-((char*)s))); printf("#define dsPrev %u\n",(int)(((char*)&(s->prev))-((char*)s))); printf("#define dsMatchLen %u\n",(int)(((char*)&(s->match_length))-((char*)s))); printf("#define dsPrevMatch %u\n",(int)(((char*)&(s->prev_match))-((char*)s))); printf("#define dsStrStart %u\n",(int)(((char*)&(s->strstart))-((char*)s))); printf("#define dsMatchStart %u\n",(int)(((char*)&(s->match_start))-((char*)s))); printf("#define dsLookahead %u\n",(int)(((char*)&(s->lookahead))-((char*)s))); printf("#define dsPrevLen %u\n",(int)(((char*)&(s->prev_length))-((char*)s))); printf("#define dsMaxChainLen %u\n",(int)(((char*)&(s->max_chain_length))-((char*)s))); printf("#define dsGoodMatch %u\n",(int)(((char*)&(s->good_match))-((char*)s))); printf("#define dsNiceMatch %u\n",(int)(((char*)&(s->nice_match))-((char*)s))); } */ #define dsWSize 68 #define dsWMask 76 #define dsWindow 80 #define dsPrev 96 #define dsMatchLen 144 #define dsPrevMatch 148 #define dsStrStart 156 #define dsMatchStart 160 #define dsLookahead 164 #define dsPrevLen 168 #define dsMaxChainLen 172 #define dsGoodMatch 188 #define dsNiceMatch 192 #define window_size [ rcx + dsWSize] #define WMask [ rcx + dsWMask] #define window_ad [ rcx + dsWindow] #define prev_ad [ rcx + dsPrev] #define strstart [ rcx + dsStrStart] #define match_start [ rcx + dsMatchStart] #define Lookahead [ rcx + dsLookahead] //; 0ffffffffh on infozip #define prev_length [ rcx + dsPrevLen] #define max_chain_length [ rcx + dsMaxChainLen] #define good_match [ rcx + dsGoodMatch] #define nice_match [ rcx + dsNiceMatch] /* ; windows: ; parameter 1 in rcx(deflate state s), param 2 in rdx (cur match) ; see http://weblogs.asp.net/oldnewthing/archive/2004/01/14/58579.aspx and ; http://msdn.microsoft.com/library/en-us/kmarch/hh/kmarch/64bitAMD_8e951dd2-ee77-4728-8702-55ce4b5dd24a.xml.asp ; ; All registers must be preserved across the call, except for ; rax, rcx, rdx, r8, r9, r10, and r11, which are scratch. ; ; gcc on macosx-linux: ; see http://www.x86-64.org/documentation/abi-0.99.pdf ; param 1 in rdi, param 2 in rsi ; rbx, rsp, rbp, r12 to r15 must be preserved ;;; Save registers that the compiler may be using, and adjust esp to ;;; make room for our stack frame. ;;; Retrieve the function arguments. r8d will hold cur_match ;;; throughout the entire function. edx will hold the pointer to the ;;; deflate_state structure during the function's setup (before ;;; entering the main loop. ; ms: parameter 1 in rcx (deflate_state* s), param 2 in edx -> r8 (cur match) ; mac: param 1 in rdi, param 2 rsi ; this clear high 32 bits of r8, which can be garbage in both r8 and rdx */ mov [save_rbx],rbx mov [save_rbp],rbp mov rcx,rdi mov r8d,esi mov [save_r12],r12 mov [save_r13],r13 mov [save_r14],r14 mov [save_r15],r15 //;;; uInt wmask = s->w_mask; //;;; unsigned chain_length = s->max_chain_length; //;;; if (s->prev_length >= s->good_match) { //;;; chain_length >>= 2; //;;; } mov edi, prev_length mov esi, good_match mov eax, WMask mov ebx, max_chain_length cmp edi, esi jl LastMatchGood shr ebx, 2 LastMatchGood: //;;; chainlen is decremented once beforehand so that the function can //;;; use the sign flag instead of the zero flag for the exit test. //;;; It is then shifted into the high word, to make room for the wmask //;;; value, which it will always accompany. dec ebx shl ebx, 16 or ebx, eax //;;; on zlib only //;;; if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; mov eax, nice_match mov [chainlenwmask], ebx mov r10d, Lookahead cmp r10d, eax cmovnl r10d, eax mov [nicematch],r10d //;;; register Bytef *scan = s->window + s->strstart; mov r10, window_ad mov ebp, strstart lea r13, [r10 + rbp] //;;; Determine how many bytes the scan ptr is off from being //;;; dword-aligned. mov r9,r13 neg r13 and r13,3 //;;; IPos limit = s->strstart > (IPos)MAX_DIST(s) ? //;;; s->strstart - (IPos)MAX_DIST(s) : NIL; mov eax, window_size sub eax, MIN_LOOKAHEAD xor edi,edi sub ebp, eax mov r11d, prev_length cmovng ebp,edi //;;; int best_len = s->prev_length; //;;; Store the sum of s->window + best_len in esi locally, and in esi. lea rsi,[r10+r11] //;;; register ush scan_start = *(ushf*)scan; //;;; register ush scan_end = *(ushf*)(scan+best_len-1); //;;; Posf *prev = s->prev; movzx r12d,word ptr [r9] movzx ebx, word ptr [r9 + r11 - 1] mov rdi, prev_ad //;;; Jump into the main loop. mov edx, [chainlenwmask] cmp bx,word ptr [rsi + r8 - 1] jz LookupLoopIsZero LookupLoop1: and r8d, edx movzx r8d, word ptr [rdi + r8*2] cmp r8d, ebp jbe LeaveNow sub edx, 0x00010000 BEFORE_JMP js LeaveNow AFTER_JMP LoopEntry1: cmp bx,word ptr [rsi + r8 - 1] BEFORE_JMP jz LookupLoopIsZero AFTER_JMP LookupLoop2: and r8d, edx movzx r8d, word ptr [rdi + r8*2] cmp r8d, ebp BEFORE_JMP jbe LeaveNow AFTER_JMP sub edx, 0x00010000 BEFORE_JMP js LeaveNow AFTER_JMP LoopEntry2: cmp bx,word ptr [rsi + r8 - 1] BEFORE_JMP jz LookupLoopIsZero AFTER_JMP LookupLoop4: and r8d, edx movzx r8d, word ptr [rdi + r8*2] cmp r8d, ebp BEFORE_JMP jbe LeaveNow AFTER_JMP sub edx, 0x00010000 BEFORE_JMP js LeaveNow AFTER_JMP LoopEntry4: cmp bx,word ptr [rsi + r8 - 1] BEFORE_JMP jnz LookupLoop1 jmp LookupLoopIsZero AFTER_JMP /* ;;; do { ;;; match = s->window + cur_match; ;;; if (*(ushf*)(match+best_len-1) != scan_end || ;;; *(ushf*)match != scan_start) continue; ;;; [...] ;;; } while ((cur_match = prev[cur_match & wmask]) > limit ;;; && --chain_length != 0); ;;; ;;; Here is the inner loop of the function. The function will spend the ;;; majority of its time in this loop, and majority of that time will ;;; be spent in the first ten instructions. ;;; ;;; Within this loop: ;;; ebx = scanend ;;; r8d = curmatch ;;; edx = chainlenwmask - i.e., ((chainlen << 16) | wmask) ;;; esi = windowbestlen - i.e., (window + bestlen) ;;; edi = prev ;;; ebp = limit */ .balign 16 LookupLoop: and r8d, edx movzx r8d, word ptr [rdi + r8*2] cmp r8d, ebp BEFORE_JMP jbe LeaveNow AFTER_JMP sub edx, 0x00010000 BEFORE_JMP js LeaveNow AFTER_JMP LoopEntry: cmp bx,word ptr [rsi + r8 - 1] BEFORE_JMP jnz LookupLoop1 AFTER_JMP LookupLoopIsZero: cmp r12w, word ptr [r10 + r8] BEFORE_JMP jnz LookupLoop1 AFTER_JMP //;;; Store the current value of chainlen. mov [chainlenwmask], edx /* ;;; Point edi to the string under scrutiny, and esi to the string we ;;; are hoping to match it up with. In actuality, esi and edi are ;;; both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and edx is ;;; initialized to -(MAX_MATCH_8 - scanalign). */ lea rsi,[r8+r10] mov rdx, 0xfffffffffffffef8 //; -(MAX_MATCH_8) lea rsi, [rsi + r13 + 0x0108] //;MAX_MATCH_8] lea rdi, [r9 + r13 + 0x0108] //;MAX_MATCH_8] prefetcht1 [rsi+rdx] prefetcht1 [rdi+rdx] /* ;;; Test the strings for equality, 8 bytes at a time. At the end, ;;; adjust rdx so that it is offset to the exact byte that mismatched. ;;; ;;; We already know at this point that the first three bytes of the ;;; strings match each other, and they can be safely passed over before ;;; starting the compare loop. So what this code does is skip over 0-3 ;;; bytes, as much as necessary in order to dword-align the edi ;;; pointer. (rsi will still be misaligned three times out of four.) ;;; ;;; It should be confessed that this loop usually does not represent ;;; much of the total running time. Replacing it with a more ;;; straightforward "rep cmpsb" would not drastically degrade ;;; performance. */ LoopCmps: mov rax, [rsi + rdx] xor rax, [rdi + rdx] jnz LeaveLoopCmps mov rax, [rsi + rdx + 8] xor rax, [rdi + rdx + 8] jnz LeaveLoopCmps8 mov rax, [rsi + rdx + 8+8] xor rax, [rdi + rdx + 8+8] jnz LeaveLoopCmps16 add rdx,8+8+8 BEFORE_JMP jnz LoopCmps jmp LenMaximum AFTER_JMP LeaveLoopCmps16: add rdx,8 LeaveLoopCmps8: add rdx,8 LeaveLoopCmps: test eax, 0x0000FFFF jnz LenLower test eax,0xffffffff jnz LenLower32 add rdx,4 shr rax,32 or ax,ax BEFORE_JMP jnz LenLower AFTER_JMP LenLower32: shr eax,16 add rdx,2 LenLower: sub al, 1 adc rdx, 0 //;;; Calculate the length of the match. If it is longer than MAX_MATCH, //;;; then automatically accept it as the best possible match and leave. lea rax, [rdi + rdx] sub rax, r9 cmp eax, MAX_MATCH BEFORE_JMP jge LenMaximum AFTER_JMP /* ;;; If the length of the match is not longer than the best match we ;;; have so far, then forget it and return to the lookup loop. ;/////////////////////////////////// */ cmp eax, r11d jg LongerMatch lea rsi,[r10+r11] mov rdi, prev_ad mov edx, [chainlenwmask] BEFORE_JMP jmp LookupLoop AFTER_JMP /* ;;; s->match_start = cur_match; ;;; best_len = len; ;;; if (len >= nice_match) break; ;;; scan_end = *(ushf*)(scan+best_len-1); */ LongerMatch: mov r11d, eax mov match_start, r8d cmp eax, [nicematch] BEFORE_JMP jge LeaveNow AFTER_JMP lea rsi,[r10+rax] movzx ebx, word ptr [r9 + rax - 1] mov rdi, prev_ad mov edx, [chainlenwmask] BEFORE_JMP jmp LookupLoop AFTER_JMP //;;; Accept the current string, with the maximum possible length. LenMaximum: mov r11d,MAX_MATCH mov match_start, r8d //;;; if ((uInt)best_len <= s->lookahead) return (uInt)best_len; //;;; return s->lookahead; LeaveNow: mov eax, Lookahead cmp r11d, eax cmovng eax, r11d //;;; Restore the stack and return from whence we came. // mov rsi,[save_rsi] // mov rdi,[save_rdi] mov rbx,[save_rbx] mov rbp,[save_rbp] mov r12,[save_r12] mov r13,[save_r13] mov r14,[save_r14] mov r15,[save_r15] ret 0 //; please don't remove this string ! //; Your can freely use gvmat64 in any free or commercial app //; but it is far better don't remove the string in the binary! // db 0dh,0ah,"asm686 with masm, optimised assembly code from Brian Raiter, written 1998, converted to amd 64 by Gilles Vollant 2005",0dh,0ah,0 match_init: ret 0
msftguy/ssh-rd
42,842
_3rd/zlib/contrib/inflate86/inffast.S
/* * inffast.S is a hand tuned assembler version of: * * inffast.c -- fast decoding * Copyright (C) 1995-2003 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h * * Copyright (C) 2003 Chris Anderson <christop@charm.net> * Please use the copyright conditions above. * * This version (Jan-23-2003) of inflate_fast was coded and tested under * GNU/Linux on a pentium 3, using the gcc-3.2 compiler distribution. On that * machine, I found that gzip style archives decompressed about 20% faster than * the gcc-3.2 -O3 -fomit-frame-pointer compiled version. Your results will * depend on how large of a buffer is used for z_stream.next_in & next_out * (8K-32K worked best for my 256K cpu cache) and how much overhead there is in * stream processing I/O and crc32/addler32. In my case, this routine used * 70% of the cpu time and crc32 used 20%. * * I am confident that this version will work in the general case, but I have * not tested a wide variety of datasets or a wide variety of platforms. * * Jan-24-2003 -- Added -DUSE_MMX define for slightly faster inflating. * It should be a runtime flag instead of compile time flag... * * Jan-26-2003 -- Added runtime check for MMX support with cpuid instruction. * With -DUSE_MMX, only MMX code is compiled. With -DNO_MMX, only non-MMX code * is compiled. Without either option, runtime detection is enabled. Runtime * detection should work on all modern cpus and the recomended algorithm (flip * ID bit on eflags and then use the cpuid instruction) is used in many * multimedia applications. Tested under win2k with gcc-2.95 and gas-2.12 * distributed with cygwin3. Compiling with gcc-2.95 -c inffast.S -o * inffast.obj generates a COFF object which can then be linked with MSVC++ * compiled code. Tested under FreeBSD 4.7 with gcc-2.95. * * Jan-28-2003 -- Tested Athlon XP... MMX mode is slower than no MMX (and * slower than compiler generated code). Adjusted cpuid check to use the MMX * code only for Pentiums < P4 until I have more data on the P4. Speed * improvment is only about 15% on the Athlon when compared with code generated * with MSVC++. Not sure yet, but I think the P4 will also be slower using the * MMX mode because many of it's x86 ALU instructions execute in .5 cycles and * have less latency than MMX ops. Added code to buffer the last 11 bytes of * the input stream since the MMX code grabs bits in chunks of 32, which * differs from the inffast.c algorithm. I don't think there would have been * read overruns where a page boundary was crossed (a segfault), but there * could have been overruns when next_in ends on unaligned memory (unintialized * memory read). * * Mar-13-2003 -- P4 MMX is slightly slower than P4 NO_MMX. I created a C * version of the non-MMX code so that it doesn't depend on zstrm and zstate * structure offsets which are hard coded in this file. This was last tested * with zlib-1.2.0 which is currently in beta testing, newer versions of this * and inffas86.c can be found at http://www.eetbeetee.com/zlib/ and * http://www.charm.net/~christop/zlib/ */ /* * if you have underscore linking problems (_inflate_fast undefined), try * using -DGAS_COFF */ #if ! defined( GAS_COFF ) && ! defined( GAS_ELF ) #if defined( WIN32 ) || defined( __CYGWIN__ ) #define GAS_COFF /* windows object format */ #else #define GAS_ELF #endif #endif /* ! GAS_COFF && ! GAS_ELF */ #if defined( GAS_COFF ) /* coff externals have underscores */ #define inflate_fast _inflate_fast #define inflate_fast_use_mmx _inflate_fast_use_mmx #endif /* GAS_COFF */ .file "inffast.S" .globl inflate_fast .text .align 4,0 .L_invalid_literal_length_code_msg: .string "invalid literal/length code" .align 4,0 .L_invalid_distance_code_msg: .string "invalid distance code" .align 4,0 .L_invalid_distance_too_far_msg: .string "invalid distance too far back" #if ! defined( NO_MMX ) .align 4,0 .L_mask: /* mask[N] = ( 1 << N ) - 1 */ .long 0 .long 1 .long 3 .long 7 .long 15 .long 31 .long 63 .long 127 .long 255 .long 511 .long 1023 .long 2047 .long 4095 .long 8191 .long 16383 .long 32767 .long 65535 .long 131071 .long 262143 .long 524287 .long 1048575 .long 2097151 .long 4194303 .long 8388607 .long 16777215 .long 33554431 .long 67108863 .long 134217727 .long 268435455 .long 536870911 .long 1073741823 .long 2147483647 .long 4294967295 #endif /* NO_MMX */ .text /* * struct z_stream offsets, in zlib.h */ #define next_in_strm 0 /* strm->next_in */ #define avail_in_strm 4 /* strm->avail_in */ #define next_out_strm 12 /* strm->next_out */ #define avail_out_strm 16 /* strm->avail_out */ #define msg_strm 24 /* strm->msg */ #define state_strm 28 /* strm->state */ /* * struct inflate_state offsets, in inflate.h */ #define mode_state 0 /* state->mode */ #define wsize_state 32 /* state->wsize */ #define write_state 40 /* state->write */ #define window_state 44 /* state->window */ #define hold_state 48 /* state->hold */ #define bits_state 52 /* state->bits */ #define lencode_state 68 /* state->lencode */ #define distcode_state 72 /* state->distcode */ #define lenbits_state 76 /* state->lenbits */ #define distbits_state 80 /* state->distbits */ /* * inflate_fast's activation record */ #define local_var_size 64 /* how much local space for vars */ #define strm_sp 88 /* first arg: z_stream * (local_var_size + 24) */ #define start_sp 92 /* second arg: unsigned int (local_var_size + 28) */ /* * offsets for local vars on stack */ #define out 60 /* unsigned char* */ #define window 56 /* unsigned char* */ #define wsize 52 /* unsigned int */ #define write 48 /* unsigned int */ #define in 44 /* unsigned char* */ #define beg 40 /* unsigned char* */ #define buf 28 /* char[ 12 ] */ #define len 24 /* unsigned int */ #define last 20 /* unsigned char* */ #define end 16 /* unsigned char* */ #define dcode 12 /* code* */ #define lcode 8 /* code* */ #define dmask 4 /* unsigned int */ #define lmask 0 /* unsigned int */ /* * typedef enum inflate_mode consts, in inflate.h */ #define INFLATE_MODE_TYPE 11 /* state->mode flags enum-ed in inflate.h */ #define INFLATE_MODE_BAD 26 #if ! defined( USE_MMX ) && ! defined( NO_MMX ) #define RUN_TIME_MMX #define CHECK_MMX 1 #define DO_USE_MMX 2 #define DONT_USE_MMX 3 .globl inflate_fast_use_mmx .data .align 4,0 inflate_fast_use_mmx: /* integer flag for run time control 1=check,2=mmx,3=no */ .long CHECK_MMX #if defined( GAS_ELF ) /* elf info */ .type inflate_fast_use_mmx,@object .size inflate_fast_use_mmx,4 #endif #endif /* RUN_TIME_MMX */ #if defined( GAS_COFF ) /* coff info: scl 2 = extern, type 32 = function */ .def inflate_fast; .scl 2; .type 32; .endef #endif .text .align 32,0x90 inflate_fast: pushl %edi pushl %esi pushl %ebp pushl %ebx pushf /* save eflags (strm_sp, state_sp assumes this is 32 bits) */ subl $local_var_size, %esp cld #define strm_r %esi #define state_r %edi movl strm_sp(%esp), strm_r movl state_strm(strm_r), state_r /* in = strm->next_in; * out = strm->next_out; * last = in + strm->avail_in - 11; * beg = out - (start - strm->avail_out); * end = out + (strm->avail_out - 257); */ movl avail_in_strm(strm_r), %edx movl next_in_strm(strm_r), %eax addl %eax, %edx /* avail_in += next_in */ subl $11, %edx /* avail_in -= 11 */ movl %eax, in(%esp) movl %edx, last(%esp) movl start_sp(%esp), %ebp movl avail_out_strm(strm_r), %ecx movl next_out_strm(strm_r), %ebx subl %ecx, %ebp /* start -= avail_out */ negl %ebp /* start = -start */ addl %ebx, %ebp /* start += next_out */ subl $257, %ecx /* avail_out -= 257 */ addl %ebx, %ecx /* avail_out += out */ movl %ebx, out(%esp) movl %ebp, beg(%esp) movl %ecx, end(%esp) /* wsize = state->wsize; * write = state->write; * window = state->window; * hold = state->hold; * bits = state->bits; * lcode = state->lencode; * dcode = state->distcode; * lmask = ( 1 << state->lenbits ) - 1; * dmask = ( 1 << state->distbits ) - 1; */ movl lencode_state(state_r), %eax movl distcode_state(state_r), %ecx movl %eax, lcode(%esp) movl %ecx, dcode(%esp) movl $1, %eax movl lenbits_state(state_r), %ecx shll %cl, %eax decl %eax movl %eax, lmask(%esp) movl $1, %eax movl distbits_state(state_r), %ecx shll %cl, %eax decl %eax movl %eax, dmask(%esp) movl wsize_state(state_r), %eax movl write_state(state_r), %ecx movl window_state(state_r), %edx movl %eax, wsize(%esp) movl %ecx, write(%esp) movl %edx, window(%esp) movl hold_state(state_r), %ebp movl bits_state(state_r), %ebx #undef strm_r #undef state_r #define in_r %esi #define from_r %esi #define out_r %edi movl in(%esp), in_r movl last(%esp), %ecx cmpl in_r, %ecx ja .L_align_long /* if in < last */ addl $11, %ecx /* ecx = &in[ avail_in ] */ subl in_r, %ecx /* ecx = avail_in */ movl $12, %eax subl %ecx, %eax /* eax = 12 - avail_in */ leal buf(%esp), %edi rep movsb /* memcpy( buf, in, avail_in ) */ movl %eax, %ecx xorl %eax, %eax rep stosb /* memset( &buf[ avail_in ], 0, 12 - avail_in ) */ leal buf(%esp), in_r /* in = buf */ movl in_r, last(%esp) /* last = in, do just one iteration */ jmp .L_is_aligned /* align in_r on long boundary */ .L_align_long: testl $3, in_r jz .L_is_aligned xorl %eax, %eax movb (in_r), %al incl in_r movl %ebx, %ecx addl $8, %ebx shll %cl, %eax orl %eax, %ebp jmp .L_align_long .L_is_aligned: movl out(%esp), out_r #if defined( NO_MMX ) jmp .L_do_loop #endif #if defined( USE_MMX ) jmp .L_init_mmx #endif /*** Runtime MMX check ***/ #if defined( RUN_TIME_MMX ) .L_check_mmx: cmpl $DO_USE_MMX, inflate_fast_use_mmx je .L_init_mmx ja .L_do_loop /* > 2 */ pushl %eax pushl %ebx pushl %ecx pushl %edx pushf movl (%esp), %eax /* copy eflags to eax */ xorl $0x200000, (%esp) /* try toggling ID bit of eflags (bit 21) * to see if cpu supports cpuid... * ID bit method not supported by NexGen but * bios may load a cpuid instruction and * cpuid may be disabled on Cyrix 5-6x86 */ popf pushf popl %edx /* copy new eflags to edx */ xorl %eax, %edx /* test if ID bit is flipped */ jz .L_dont_use_mmx /* not flipped if zero */ xorl %eax, %eax cpuid cmpl $0x756e6547, %ebx /* check for GenuineIntel in ebx,ecx,edx */ jne .L_dont_use_mmx cmpl $0x6c65746e, %ecx jne .L_dont_use_mmx cmpl $0x49656e69, %edx jne .L_dont_use_mmx movl $1, %eax cpuid /* get cpu features */ shrl $8, %eax andl $15, %eax cmpl $6, %eax /* check for Pentium family, is 0xf for P4 */ jne .L_dont_use_mmx testl $0x800000, %edx /* test if MMX feature is set (bit 23) */ jnz .L_use_mmx jmp .L_dont_use_mmx .L_use_mmx: movl $DO_USE_MMX, inflate_fast_use_mmx jmp .L_check_mmx_pop .L_dont_use_mmx: movl $DONT_USE_MMX, inflate_fast_use_mmx .L_check_mmx_pop: popl %edx popl %ecx popl %ebx popl %eax jmp .L_check_mmx #endif /*** Non-MMX code ***/ #if defined ( NO_MMX ) || defined( RUN_TIME_MMX ) #define hold_r %ebp #define bits_r %bl #define bitslong_r %ebx .align 32,0x90 .L_while_test: /* while (in < last && out < end) */ cmpl out_r, end(%esp) jbe .L_break_loop /* if (out >= end) */ cmpl in_r, last(%esp) jbe .L_break_loop .L_do_loop: /* regs: %esi = in, %ebp = hold, %bl = bits, %edi = out * * do { * if (bits < 15) { * hold |= *((unsigned short *)in)++ << bits; * bits += 16 * } * this = lcode[hold & lmask] */ cmpb $15, bits_r ja .L_get_length_code /* if (15 < bits) */ xorl %eax, %eax lodsw /* al = *(ushort *)in++ */ movb bits_r, %cl /* cl = bits, needs it for shifting */ addb $16, bits_r /* bits += 16 */ shll %cl, %eax orl %eax, hold_r /* hold |= *((ushort *)in)++ << bits */ .L_get_length_code: movl lmask(%esp), %edx /* edx = lmask */ movl lcode(%esp), %ecx /* ecx = lcode */ andl hold_r, %edx /* edx &= hold */ movl (%ecx,%edx,4), %eax /* eax = lcode[hold & lmask] */ .L_dolen: /* regs: %esi = in, %ebp = hold, %bl = bits, %edi = out * * dolen: * bits -= this.bits; * hold >>= this.bits */ movb %ah, %cl /* cl = this.bits */ subb %ah, bits_r /* bits -= this.bits */ shrl %cl, hold_r /* hold >>= this.bits */ /* check if op is a literal * if (op == 0) { * PUP(out) = this.val; * } */ testb %al, %al jnz .L_test_for_length_base /* if (op != 0) 45.7% */ shrl $16, %eax /* output this.val char */ stosb jmp .L_while_test .L_test_for_length_base: /* regs: %esi = in, %ebp = hold, %bl = bits, %edi = out, %edx = len * * else if (op & 16) { * len = this.val * op &= 15 * if (op) { * if (op > bits) { * hold |= *((unsigned short *)in)++ << bits; * bits += 16 * } * len += hold & mask[op]; * bits -= op; * hold >>= op; * } */ #define len_r %edx movl %eax, len_r /* len = this */ shrl $16, len_r /* len = this.val */ movb %al, %cl testb $16, %al jz .L_test_for_second_level_length /* if ((op & 16) == 0) 8% */ andb $15, %cl /* op &= 15 */ jz .L_save_len /* if (!op) */ cmpb %cl, bits_r jae .L_add_bits_to_len /* if (op <= bits) */ movb %cl, %ch /* stash op in ch, freeing cl */ xorl %eax, %eax lodsw /* al = *(ushort *)in++ */ movb bits_r, %cl /* cl = bits, needs it for shifting */ addb $16, bits_r /* bits += 16 */ shll %cl, %eax orl %eax, hold_r /* hold |= *((ushort *)in)++ << bits */ movb %ch, %cl /* move op back to ecx */ .L_add_bits_to_len: movl $1, %eax shll %cl, %eax decl %eax subb %cl, bits_r andl hold_r, %eax /* eax &= hold */ shrl %cl, hold_r addl %eax, len_r /* len += hold & mask[op] */ .L_save_len: movl len_r, len(%esp) /* save len */ #undef len_r .L_decode_distance: /* regs: %esi = in, %ebp = hold, %bl = bits, %edi = out, %edx = dist * * if (bits < 15) { * hold |= *((unsigned short *)in)++ << bits; * bits += 16 * } * this = dcode[hold & dmask]; * dodist: * bits -= this.bits; * hold >>= this.bits; * op = this.op; */ cmpb $15, bits_r ja .L_get_distance_code /* if (15 < bits) */ xorl %eax, %eax lodsw /* al = *(ushort *)in++ */ movb bits_r, %cl /* cl = bits, needs it for shifting */ addb $16, bits_r /* bits += 16 */ shll %cl, %eax orl %eax, hold_r /* hold |= *((ushort *)in)++ << bits */ .L_get_distance_code: movl dmask(%esp), %edx /* edx = dmask */ movl dcode(%esp), %ecx /* ecx = dcode */ andl hold_r, %edx /* edx &= hold */ movl (%ecx,%edx,4), %eax /* eax = dcode[hold & dmask] */ #define dist_r %edx .L_dodist: movl %eax, dist_r /* dist = this */ shrl $16, dist_r /* dist = this.val */ movb %ah, %cl subb %ah, bits_r /* bits -= this.bits */ shrl %cl, hold_r /* hold >>= this.bits */ /* if (op & 16) { * dist = this.val * op &= 15 * if (op > bits) { * hold |= *((unsigned short *)in)++ << bits; * bits += 16 * } * dist += hold & mask[op]; * bits -= op; * hold >>= op; */ movb %al, %cl /* cl = this.op */ testb $16, %al /* if ((op & 16) == 0) */ jz .L_test_for_second_level_dist andb $15, %cl /* op &= 15 */ jz .L_check_dist_one cmpb %cl, bits_r jae .L_add_bits_to_dist /* if (op <= bits) 97.6% */ movb %cl, %ch /* stash op in ch, freeing cl */ xorl %eax, %eax lodsw /* al = *(ushort *)in++ */ movb bits_r, %cl /* cl = bits, needs it for shifting */ addb $16, bits_r /* bits += 16 */ shll %cl, %eax orl %eax, hold_r /* hold |= *((ushort *)in)++ << bits */ movb %ch, %cl /* move op back to ecx */ .L_add_bits_to_dist: movl $1, %eax shll %cl, %eax decl %eax /* (1 << op) - 1 */ subb %cl, bits_r andl hold_r, %eax /* eax &= hold */ shrl %cl, hold_r addl %eax, dist_r /* dist += hold & ((1 << op) - 1) */ jmp .L_check_window .L_check_window: /* regs: %esi = from, %ebp = hold, %bl = bits, %edi = out, %edx = dist * %ecx = nbytes * * nbytes = out - beg; * if (dist <= nbytes) { * from = out - dist; * do { * PUP(out) = PUP(from); * } while (--len > 0) { * } */ movl in_r, in(%esp) /* save in so from can use it's reg */ movl out_r, %eax subl beg(%esp), %eax /* nbytes = out - beg */ cmpl dist_r, %eax jb .L_clip_window /* if (dist > nbytes) 4.2% */ movl len(%esp), %ecx movl out_r, from_r subl dist_r, from_r /* from = out - dist */ subl $3, %ecx movb (from_r), %al movb %al, (out_r) movb 1(from_r), %al movb 2(from_r), %dl addl $3, from_r movb %al, 1(out_r) movb %dl, 2(out_r) addl $3, out_r rep movsb movl in(%esp), in_r /* move in back to %esi, toss from */ jmp .L_while_test .align 16,0x90 .L_check_dist_one: cmpl $1, dist_r jne .L_check_window cmpl out_r, beg(%esp) je .L_check_window decl out_r movl len(%esp), %ecx movb (out_r), %al subl $3, %ecx movb %al, 1(out_r) movb %al, 2(out_r) movb %al, 3(out_r) addl $4, out_r rep stosb jmp .L_while_test .align 16,0x90 .L_test_for_second_level_length: /* else if ((op & 64) == 0) { * this = lcode[this.val + (hold & mask[op])]; * } */ testb $64, %al jnz .L_test_for_end_of_block /* if ((op & 64) != 0) */ movl $1, %eax shll %cl, %eax decl %eax andl hold_r, %eax /* eax &= hold */ addl %edx, %eax /* eax += this.val */ movl lcode(%esp), %edx /* edx = lcode */ movl (%edx,%eax,4), %eax /* eax = lcode[val + (hold&mask[op])] */ jmp .L_dolen .align 16,0x90 .L_test_for_second_level_dist: /* else if ((op & 64) == 0) { * this = dcode[this.val + (hold & mask[op])]; * } */ testb $64, %al jnz .L_invalid_distance_code /* if ((op & 64) != 0) */ movl $1, %eax shll %cl, %eax decl %eax andl hold_r, %eax /* eax &= hold */ addl %edx, %eax /* eax += this.val */ movl dcode(%esp), %edx /* edx = dcode */ movl (%edx,%eax,4), %eax /* eax = dcode[val + (hold&mask[op])] */ jmp .L_dodist .align 16,0x90 .L_clip_window: /* regs: %esi = from, %ebp = hold, %bl = bits, %edi = out, %edx = dist * %ecx = nbytes * * else { * if (dist > wsize) { * invalid distance * } * from = window; * nbytes = dist - nbytes; * if (write == 0) { * from += wsize - nbytes; */ #define nbytes_r %ecx movl %eax, nbytes_r movl wsize(%esp), %eax /* prepare for dist compare */ negl nbytes_r /* nbytes = -nbytes */ movl window(%esp), from_r /* from = window */ cmpl dist_r, %eax jb .L_invalid_distance_too_far /* if (dist > wsize) */ addl dist_r, nbytes_r /* nbytes = dist - nbytes */ cmpl $0, write(%esp) jne .L_wrap_around_window /* if (write != 0) */ subl nbytes_r, %eax addl %eax, from_r /* from += wsize - nbytes */ /* regs: %esi = from, %ebp = hold, %bl = bits, %edi = out, %edx = dist * %ecx = nbytes, %eax = len * * if (nbytes < len) { * len -= nbytes; * do { * PUP(out) = PUP(from); * } while (--nbytes); * from = out - dist; * } * } */ #define len_r %eax movl len(%esp), len_r cmpl nbytes_r, len_r jbe .L_do_copy1 /* if (nbytes >= len) */ subl nbytes_r, len_r /* len -= nbytes */ rep movsb movl out_r, from_r subl dist_r, from_r /* from = out - dist */ jmp .L_do_copy1 cmpl nbytes_r, len_r jbe .L_do_copy1 /* if (nbytes >= len) */ subl nbytes_r, len_r /* len -= nbytes */ rep movsb movl out_r, from_r subl dist_r, from_r /* from = out - dist */ jmp .L_do_copy1 .L_wrap_around_window: /* regs: %esi = from, %ebp = hold, %bl = bits, %edi = out, %edx = dist * %ecx = nbytes, %eax = write, %eax = len * * else if (write < nbytes) { * from += wsize + write - nbytes; * nbytes -= write; * if (nbytes < len) { * len -= nbytes; * do { * PUP(out) = PUP(from); * } while (--nbytes); * from = window; * nbytes = write; * if (nbytes < len) { * len -= nbytes; * do { * PUP(out) = PUP(from); * } while(--nbytes); * from = out - dist; * } * } * } */ #define write_r %eax movl write(%esp), write_r cmpl write_r, nbytes_r jbe .L_contiguous_in_window /* if (write >= nbytes) */ addl wsize(%esp), from_r addl write_r, from_r subl nbytes_r, from_r /* from += wsize + write - nbytes */ subl write_r, nbytes_r /* nbytes -= write */ #undef write_r movl len(%esp), len_r cmpl nbytes_r, len_r jbe .L_do_copy1 /* if (nbytes >= len) */ subl nbytes_r, len_r /* len -= nbytes */ rep movsb movl window(%esp), from_r /* from = window */ movl write(%esp), nbytes_r /* nbytes = write */ cmpl nbytes_r, len_r jbe .L_do_copy1 /* if (nbytes >= len) */ subl nbytes_r, len_r /* len -= nbytes */ rep movsb movl out_r, from_r subl dist_r, from_r /* from = out - dist */ jmp .L_do_copy1 .L_contiguous_in_window: /* regs: %esi = from, %ebp = hold, %bl = bits, %edi = out, %edx = dist * %ecx = nbytes, %eax = write, %eax = len * * else { * from += write - nbytes; * if (nbytes < len) { * len -= nbytes; * do { * PUP(out) = PUP(from); * } while (--nbytes); * from = out - dist; * } * } */ #define write_r %eax addl write_r, from_r subl nbytes_r, from_r /* from += write - nbytes */ #undef write_r movl len(%esp), len_r cmpl nbytes_r, len_r jbe .L_do_copy1 /* if (nbytes >= len) */ subl nbytes_r, len_r /* len -= nbytes */ rep movsb movl out_r, from_r subl dist_r, from_r /* from = out - dist */ .L_do_copy1: /* regs: %esi = from, %esi = in, %ebp = hold, %bl = bits, %edi = out * %eax = len * * while (len > 0) { * PUP(out) = PUP(from); * len--; * } * } * } while (in < last && out < end); */ #undef nbytes_r #define in_r %esi movl len_r, %ecx rep movsb movl in(%esp), in_r /* move in back to %esi, toss from */ jmp .L_while_test #undef len_r #undef dist_r #endif /* NO_MMX || RUN_TIME_MMX */ /*** MMX code ***/ #if defined( USE_MMX ) || defined( RUN_TIME_MMX ) .align 32,0x90 .L_init_mmx: emms #undef bits_r #undef bitslong_r #define bitslong_r %ebp #define hold_mm %mm0 movd %ebp, hold_mm movl %ebx, bitslong_r #define used_mm %mm1 #define dmask2_mm %mm2 #define lmask2_mm %mm3 #define lmask_mm %mm4 #define dmask_mm %mm5 #define tmp_mm %mm6 movd lmask(%esp), lmask_mm movq lmask_mm, lmask2_mm movd dmask(%esp), dmask_mm movq dmask_mm, dmask2_mm pxor used_mm, used_mm movl lcode(%esp), %ebx /* ebx = lcode */ jmp .L_do_loop_mmx .align 32,0x90 .L_while_test_mmx: /* while (in < last && out < end) */ cmpl out_r, end(%esp) jbe .L_break_loop /* if (out >= end) */ cmpl in_r, last(%esp) jbe .L_break_loop .L_do_loop_mmx: psrlq used_mm, hold_mm /* hold_mm >>= last bit length */ cmpl $32, bitslong_r ja .L_get_length_code_mmx /* if (32 < bits) */ movd bitslong_r, tmp_mm movd (in_r), %mm7 addl $4, in_r psllq tmp_mm, %mm7 addl $32, bitslong_r por %mm7, hold_mm /* hold_mm |= *((uint *)in)++ << bits */ .L_get_length_code_mmx: pand hold_mm, lmask_mm movd lmask_mm, %eax movq lmask2_mm, lmask_mm movl (%ebx,%eax,4), %eax /* eax = lcode[hold & lmask] */ .L_dolen_mmx: movzbl %ah, %ecx /* ecx = this.bits */ movd %ecx, used_mm subl %ecx, bitslong_r /* bits -= this.bits */ testb %al, %al jnz .L_test_for_length_base_mmx /* if (op != 0) 45.7% */ shrl $16, %eax /* output this.val char */ stosb jmp .L_while_test_mmx .L_test_for_length_base_mmx: #define len_r %edx movl %eax, len_r /* len = this */ shrl $16, len_r /* len = this.val */ testb $16, %al jz .L_test_for_second_level_length_mmx /* if ((op & 16) == 0) 8% */ andl $15, %eax /* op &= 15 */ jz .L_decode_distance_mmx /* if (!op) */ psrlq used_mm, hold_mm /* hold_mm >>= last bit length */ movd %eax, used_mm movd hold_mm, %ecx subl %eax, bitslong_r andl .L_mask(,%eax,4), %ecx addl %ecx, len_r /* len += hold & mask[op] */ .L_decode_distance_mmx: psrlq used_mm, hold_mm /* hold_mm >>= last bit length */ cmpl $32, bitslong_r ja .L_get_dist_code_mmx /* if (32 < bits) */ movd bitslong_r, tmp_mm movd (in_r), %mm7 addl $4, in_r psllq tmp_mm, %mm7 addl $32, bitslong_r por %mm7, hold_mm /* hold_mm |= *((uint *)in)++ << bits */ .L_get_dist_code_mmx: movl dcode(%esp), %ebx /* ebx = dcode */ pand hold_mm, dmask_mm movd dmask_mm, %eax movq dmask2_mm, dmask_mm movl (%ebx,%eax,4), %eax /* eax = dcode[hold & lmask] */ .L_dodist_mmx: #define dist_r %ebx movzbl %ah, %ecx /* ecx = this.bits */ movl %eax, dist_r shrl $16, dist_r /* dist = this.val */ subl %ecx, bitslong_r /* bits -= this.bits */ movd %ecx, used_mm testb $16, %al /* if ((op & 16) == 0) */ jz .L_test_for_second_level_dist_mmx andl $15, %eax /* op &= 15 */ jz .L_check_dist_one_mmx .L_add_bits_to_dist_mmx: psrlq used_mm, hold_mm /* hold_mm >>= last bit length */ movd %eax, used_mm /* save bit length of current op */ movd hold_mm, %ecx /* get the next bits on input stream */ subl %eax, bitslong_r /* bits -= op bits */ andl .L_mask(,%eax,4), %ecx /* ecx = hold & mask[op] */ addl %ecx, dist_r /* dist += hold & mask[op] */ .L_check_window_mmx: movl in_r, in(%esp) /* save in so from can use it's reg */ movl out_r, %eax subl beg(%esp), %eax /* nbytes = out - beg */ cmpl dist_r, %eax jb .L_clip_window_mmx /* if (dist > nbytes) 4.2% */ movl len_r, %ecx movl out_r, from_r subl dist_r, from_r /* from = out - dist */ subl $3, %ecx movb (from_r), %al movb %al, (out_r) movb 1(from_r), %al movb 2(from_r), %dl addl $3, from_r movb %al, 1(out_r) movb %dl, 2(out_r) addl $3, out_r rep movsb movl in(%esp), in_r /* move in back to %esi, toss from */ movl lcode(%esp), %ebx /* move lcode back to %ebx, toss dist */ jmp .L_while_test_mmx .align 16,0x90 .L_check_dist_one_mmx: cmpl $1, dist_r jne .L_check_window_mmx cmpl out_r, beg(%esp) je .L_check_window_mmx decl out_r movl len_r, %ecx movb (out_r), %al subl $3, %ecx movb %al, 1(out_r) movb %al, 2(out_r) movb %al, 3(out_r) addl $4, out_r rep stosb movl lcode(%esp), %ebx /* move lcode back to %ebx, toss dist */ jmp .L_while_test_mmx .align 16,0x90 .L_test_for_second_level_length_mmx: testb $64, %al jnz .L_test_for_end_of_block /* if ((op & 64) != 0) */ andl $15, %eax psrlq used_mm, hold_mm /* hold_mm >>= last bit length */ movd hold_mm, %ecx andl .L_mask(,%eax,4), %ecx addl len_r, %ecx movl (%ebx,%ecx,4), %eax /* eax = lcode[hold & lmask] */ jmp .L_dolen_mmx .align 16,0x90 .L_test_for_second_level_dist_mmx: testb $64, %al jnz .L_invalid_distance_code /* if ((op & 64) != 0) */ andl $15, %eax psrlq used_mm, hold_mm /* hold_mm >>= last bit length */ movd hold_mm, %ecx andl .L_mask(,%eax,4), %ecx movl dcode(%esp), %eax /* ecx = dcode */ addl dist_r, %ecx movl (%eax,%ecx,4), %eax /* eax = lcode[hold & lmask] */ jmp .L_dodist_mmx .align 16,0x90 .L_clip_window_mmx: #define nbytes_r %ecx movl %eax, nbytes_r movl wsize(%esp), %eax /* prepare for dist compare */ negl nbytes_r /* nbytes = -nbytes */ movl window(%esp), from_r /* from = window */ cmpl dist_r, %eax jb .L_invalid_distance_too_far /* if (dist > wsize) */ addl dist_r, nbytes_r /* nbytes = dist - nbytes */ cmpl $0, write(%esp) jne .L_wrap_around_window_mmx /* if (write != 0) */ subl nbytes_r, %eax addl %eax, from_r /* from += wsize - nbytes */ cmpl nbytes_r, len_r jbe .L_do_copy1_mmx /* if (nbytes >= len) */ subl nbytes_r, len_r /* len -= nbytes */ rep movsb movl out_r, from_r subl dist_r, from_r /* from = out - dist */ jmp .L_do_copy1_mmx cmpl nbytes_r, len_r jbe .L_do_copy1_mmx /* if (nbytes >= len) */ subl nbytes_r, len_r /* len -= nbytes */ rep movsb movl out_r, from_r subl dist_r, from_r /* from = out - dist */ jmp .L_do_copy1_mmx .L_wrap_around_window_mmx: #define write_r %eax movl write(%esp), write_r cmpl write_r, nbytes_r jbe .L_contiguous_in_window_mmx /* if (write >= nbytes) */ addl wsize(%esp), from_r addl write_r, from_r subl nbytes_r, from_r /* from += wsize + write - nbytes */ subl write_r, nbytes_r /* nbytes -= write */ #undef write_r cmpl nbytes_r, len_r jbe .L_do_copy1_mmx /* if (nbytes >= len) */ subl nbytes_r, len_r /* len -= nbytes */ rep movsb movl window(%esp), from_r /* from = window */ movl write(%esp), nbytes_r /* nbytes = write */ cmpl nbytes_r, len_r jbe .L_do_copy1_mmx /* if (nbytes >= len) */ subl nbytes_r, len_r /* len -= nbytes */ rep movsb movl out_r, from_r subl dist_r, from_r /* from = out - dist */ jmp .L_do_copy1_mmx .L_contiguous_in_window_mmx: #define write_r %eax addl write_r, from_r subl nbytes_r, from_r /* from += write - nbytes */ #undef write_r cmpl nbytes_r, len_r jbe .L_do_copy1_mmx /* if (nbytes >= len) */ subl nbytes_r, len_r /* len -= nbytes */ rep movsb movl out_r, from_r subl dist_r, from_r /* from = out - dist */ .L_do_copy1_mmx: #undef nbytes_r #define in_r %esi movl len_r, %ecx rep movsb movl in(%esp), in_r /* move in back to %esi, toss from */ movl lcode(%esp), %ebx /* move lcode back to %ebx, toss dist */ jmp .L_while_test_mmx #undef hold_r #undef bitslong_r #endif /* USE_MMX || RUN_TIME_MMX */ /*** USE_MMX, NO_MMX, and RUNTIME_MMX from here on ***/ .L_invalid_distance_code: /* else { * strm->msg = "invalid distance code"; * state->mode = BAD; * } */ movl $.L_invalid_distance_code_msg, %ecx movl $INFLATE_MODE_BAD, %edx jmp .L_update_stream_state .L_test_for_end_of_block: /* else if (op & 32) { * state->mode = TYPE; * break; * } */ testb $32, %al jz .L_invalid_literal_length_code /* if ((op & 32) == 0) */ movl $0, %ecx movl $INFLATE_MODE_TYPE, %edx jmp .L_update_stream_state .L_invalid_literal_length_code: /* else { * strm->msg = "invalid literal/length code"; * state->mode = BAD; * } */ movl $.L_invalid_literal_length_code_msg, %ecx movl $INFLATE_MODE_BAD, %edx jmp .L_update_stream_state .L_invalid_distance_too_far: /* strm->msg = "invalid distance too far back"; * state->mode = BAD; */ movl in(%esp), in_r /* from_r has in's reg, put in back */ movl $.L_invalid_distance_too_far_msg, %ecx movl $INFLATE_MODE_BAD, %edx jmp .L_update_stream_state .L_update_stream_state: /* set strm->msg = %ecx, strm->state->mode = %edx */ movl strm_sp(%esp), %eax testl %ecx, %ecx /* if (msg != NULL) */ jz .L_skip_msg movl %ecx, msg_strm(%eax) /* strm->msg = msg */ .L_skip_msg: movl state_strm(%eax), %eax /* state = strm->state */ movl %edx, mode_state(%eax) /* state->mode = edx (BAD | TYPE) */ jmp .L_break_loop .align 32,0x90 .L_break_loop: /* * Regs: * * bits = %ebp when mmx, and in %ebx when non-mmx * hold = %hold_mm when mmx, and in %ebp when non-mmx * in = %esi * out = %edi */ #if defined( USE_MMX ) || defined( RUN_TIME_MMX ) #if defined( RUN_TIME_MMX ) cmpl $DO_USE_MMX, inflate_fast_use_mmx jne .L_update_next_in #endif /* RUN_TIME_MMX */ movl %ebp, %ebx .L_update_next_in: #endif #define strm_r %eax #define state_r %edx /* len = bits >> 3; * in -= len; * bits -= len << 3; * hold &= (1U << bits) - 1; * state->hold = hold; * state->bits = bits; * strm->next_in = in; * strm->next_out = out; */ movl strm_sp(%esp), strm_r movl %ebx, %ecx movl state_strm(strm_r), state_r shrl $3, %ecx subl %ecx, in_r shll $3, %ecx subl %ecx, %ebx movl out_r, next_out_strm(strm_r) movl %ebx, bits_state(state_r) movl %ebx, %ecx leal buf(%esp), %ebx cmpl %ebx, last(%esp) jne .L_buf_not_used /* if buf != last */ subl %ebx, in_r /* in -= buf */ movl next_in_strm(strm_r), %ebx movl %ebx, last(%esp) /* last = strm->next_in */ addl %ebx, in_r /* in += strm->next_in */ movl avail_in_strm(strm_r), %ebx subl $11, %ebx addl %ebx, last(%esp) /* last = &strm->next_in[ avail_in - 11 ] */ .L_buf_not_used: movl in_r, next_in_strm(strm_r) movl $1, %ebx shll %cl, %ebx decl %ebx #if defined( USE_MMX ) || defined( RUN_TIME_MMX ) #if defined( RUN_TIME_MMX ) cmpl $DO_USE_MMX, inflate_fast_use_mmx jne .L_update_hold #endif /* RUN_TIME_MMX */ psrlq used_mm, hold_mm /* hold_mm >>= last bit length */ movd hold_mm, %ebp emms .L_update_hold: #endif /* USE_MMX || RUN_TIME_MMX */ andl %ebx, %ebp movl %ebp, hold_state(state_r) #define last_r %ebx /* strm->avail_in = in < last ? 11 + (last - in) : 11 - (in - last) */ movl last(%esp), last_r cmpl in_r, last_r jbe .L_last_is_smaller /* if (in >= last) */ subl in_r, last_r /* last -= in */ addl $11, last_r /* last += 11 */ movl last_r, avail_in_strm(strm_r) jmp .L_fixup_out .L_last_is_smaller: subl last_r, in_r /* in -= last */ negl in_r /* in = -in */ addl $11, in_r /* in += 11 */ movl in_r, avail_in_strm(strm_r) #undef last_r #define end_r %ebx .L_fixup_out: /* strm->avail_out = out < end ? 257 + (end - out) : 257 - (out - end)*/ movl end(%esp), end_r cmpl out_r, end_r jbe .L_end_is_smaller /* if (out >= end) */ subl out_r, end_r /* end -= out */ addl $257, end_r /* end += 257 */ movl end_r, avail_out_strm(strm_r) jmp .L_done .L_end_is_smaller: subl end_r, out_r /* out -= end */ negl out_r /* out = -out */ addl $257, out_r /* out += 257 */ movl out_r, avail_out_strm(strm_r) #undef end_r #undef strm_r #undef state_r .L_done: addl $local_var_size, %esp popf popl %ebx popl %ebp popl %esi popl %edi ret #if defined( GAS_ELF ) /* elf info */ .type inflate_fast,@function .size inflate_fast,.-inflate_fast #endif
msftguy/ssh-rd
10,026
_3rd/zlib/contrib/asm686/match.S
/* match.S -- x86 assembly version of the zlib longest_match() function. * Optimized for the Intel 686 chips (PPro and later). * * Copyright (C) 1998, 2007 Brian Raiter <breadbox@muppetlabs.com> * * This software is provided 'as-is', without any express or implied * warranty. In no event will the author be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. */ #ifndef NO_UNDERLINE #define match_init _match_init #define longest_match _longest_match #endif #define MAX_MATCH (258) #define MIN_MATCH (3) #define MIN_LOOKAHEAD (MAX_MATCH + MIN_MATCH + 1) #define MAX_MATCH_8 ((MAX_MATCH + 7) & ~7) /* stack frame offsets */ #define chainlenwmask 0 /* high word: current chain len */ /* low word: s->wmask */ #define window 4 /* local copy of s->window */ #define windowbestlen 8 /* s->window + bestlen */ #define scanstart 16 /* first two bytes of string */ #define scanend 12 /* last two bytes of string */ #define scanalign 20 /* dword-misalignment of string */ #define nicematch 24 /* a good enough match size */ #define bestlen 28 /* size of best match so far */ #define scan 32 /* ptr to string wanting match */ #define LocalVarsSize (36) /* saved ebx 36 */ /* saved edi 40 */ /* saved esi 44 */ /* saved ebp 48 */ /* return address 52 */ #define deflatestate 56 /* the function arguments */ #define curmatch 60 /* All the +zlib1222add offsets are due to the addition of fields * in zlib in the deflate_state structure since the asm code was first written * (if you compile with zlib 1.0.4 or older, use "zlib1222add equ (-4)"). * (if you compile with zlib between 1.0.5 and 1.2.2.1, use "zlib1222add equ 0"). * if you compile with zlib 1.2.2.2 or later , use "zlib1222add equ 8"). */ #define zlib1222add (8) #define dsWSize (36+zlib1222add) #define dsWMask (44+zlib1222add) #define dsWindow (48+zlib1222add) #define dsPrev (56+zlib1222add) #define dsMatchLen (88+zlib1222add) #define dsPrevMatch (92+zlib1222add) #define dsStrStart (100+zlib1222add) #define dsMatchStart (104+zlib1222add) #define dsLookahead (108+zlib1222add) #define dsPrevLen (112+zlib1222add) #define dsMaxChainLen (116+zlib1222add) #define dsGoodMatch (132+zlib1222add) #define dsNiceMatch (136+zlib1222add) .file "match.S" .globl match_init, longest_match .text /* uInt longest_match(deflate_state *deflatestate, IPos curmatch) */ longest_match: /* Save registers that the compiler may be using, and adjust %esp to */ /* make room for our stack frame. */ pushl %ebp pushl %edi pushl %esi pushl %ebx subl $LocalVarsSize, %esp /* Retrieve the function arguments. %ecx will hold cur_match */ /* throughout the entire function. %edx will hold the pointer to the */ /* deflate_state structure during the function's setup (before */ /* entering the main loop). */ movl deflatestate(%esp), %edx movl curmatch(%esp), %ecx /* uInt wmask = s->w_mask; */ /* unsigned chain_length = s->max_chain_length; */ /* if (s->prev_length >= s->good_match) { */ /* chain_length >>= 2; */ /* } */ movl dsPrevLen(%edx), %eax movl dsGoodMatch(%edx), %ebx cmpl %ebx, %eax movl dsWMask(%edx), %eax movl dsMaxChainLen(%edx), %ebx jl LastMatchGood shrl $2, %ebx LastMatchGood: /* chainlen is decremented once beforehand so that the function can */ /* use the sign flag instead of the zero flag for the exit test. */ /* It is then shifted into the high word, to make room for the wmask */ /* value, which it will always accompany. */ decl %ebx shll $16, %ebx orl %eax, %ebx movl %ebx, chainlenwmask(%esp) /* if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; */ movl dsNiceMatch(%edx), %eax movl dsLookahead(%edx), %ebx cmpl %eax, %ebx jl LookaheadLess movl %eax, %ebx LookaheadLess: movl %ebx, nicematch(%esp) /* register Bytef *scan = s->window + s->strstart; */ movl dsWindow(%edx), %esi movl %esi, window(%esp) movl dsStrStart(%edx), %ebp lea (%esi,%ebp), %edi movl %edi, scan(%esp) /* Determine how many bytes the scan ptr is off from being */ /* dword-aligned. */ movl %edi, %eax negl %eax andl $3, %eax movl %eax, scanalign(%esp) /* IPos limit = s->strstart > (IPos)MAX_DIST(s) ? */ /* s->strstart - (IPos)MAX_DIST(s) : NIL; */ movl dsWSize(%edx), %eax subl $MIN_LOOKAHEAD, %eax subl %eax, %ebp jg LimitPositive xorl %ebp, %ebp LimitPositive: /* int best_len = s->prev_length; */ movl dsPrevLen(%edx), %eax movl %eax, bestlen(%esp) /* Store the sum of s->window + best_len in %esi locally, and in %esi. */ addl %eax, %esi movl %esi, windowbestlen(%esp) /* register ush scan_start = *(ushf*)scan; */ /* register ush scan_end = *(ushf*)(scan+best_len-1); */ /* Posf *prev = s->prev; */ movzwl (%edi), %ebx movl %ebx, scanstart(%esp) movzwl -1(%edi,%eax), %ebx movl %ebx, scanend(%esp) movl dsPrev(%edx), %edi /* Jump into the main loop. */ movl chainlenwmask(%esp), %edx jmp LoopEntry .balign 16 /* do { * match = s->window + cur_match; * if (*(ushf*)(match+best_len-1) != scan_end || * *(ushf*)match != scan_start) continue; * [...] * } while ((cur_match = prev[cur_match & wmask]) > limit * && --chain_length != 0); * * Here is the inner loop of the function. The function will spend the * majority of its time in this loop, and majority of that time will * be spent in the first ten instructions. * * Within this loop: * %ebx = scanend * %ecx = curmatch * %edx = chainlenwmask - i.e., ((chainlen << 16) | wmask) * %esi = windowbestlen - i.e., (window + bestlen) * %edi = prev * %ebp = limit */ LookupLoop: andl %edx, %ecx movzwl (%edi,%ecx,2), %ecx cmpl %ebp, %ecx jbe LeaveNow subl $0x00010000, %edx js LeaveNow LoopEntry: movzwl -1(%esi,%ecx), %eax cmpl %ebx, %eax jnz LookupLoop movl window(%esp), %eax movzwl (%eax,%ecx), %eax cmpl scanstart(%esp), %eax jnz LookupLoop /* Store the current value of chainlen. */ movl %edx, chainlenwmask(%esp) /* Point %edi to the string under scrutiny, and %esi to the string we */ /* are hoping to match it up with. In actuality, %esi and %edi are */ /* both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and %edx is */ /* initialized to -(MAX_MATCH_8 - scanalign). */ movl window(%esp), %esi movl scan(%esp), %edi addl %ecx, %esi movl scanalign(%esp), %eax movl $(-MAX_MATCH_8), %edx lea MAX_MATCH_8(%edi,%eax), %edi lea MAX_MATCH_8(%esi,%eax), %esi /* Test the strings for equality, 8 bytes at a time. At the end, * adjust %edx so that it is offset to the exact byte that mismatched. * * We already know at this point that the first three bytes of the * strings match each other, and they can be safely passed over before * starting the compare loop. So what this code does is skip over 0-3 * bytes, as much as necessary in order to dword-align the %edi * pointer. (%esi will still be misaligned three times out of four.) * * It should be confessed that this loop usually does not represent * much of the total running time. Replacing it with a more * straightforward "rep cmpsb" would not drastically degrade * performance. */ LoopCmps: movl (%esi,%edx), %eax xorl (%edi,%edx), %eax jnz LeaveLoopCmps movl 4(%esi,%edx), %eax xorl 4(%edi,%edx), %eax jnz LeaveLoopCmps4 addl $8, %edx jnz LoopCmps jmp LenMaximum LeaveLoopCmps4: addl $4, %edx LeaveLoopCmps: testl $0x0000FFFF, %eax jnz LenLower addl $2, %edx shrl $16, %eax LenLower: subb $1, %al adcl $0, %edx /* Calculate the length of the match. If it is longer than MAX_MATCH, */ /* then automatically accept it as the best possible match and leave. */ lea (%edi,%edx), %eax movl scan(%esp), %edi subl %edi, %eax cmpl $MAX_MATCH, %eax jge LenMaximum /* If the length of the match is not longer than the best match we */ /* have so far, then forget it and return to the lookup loop. */ movl deflatestate(%esp), %edx movl bestlen(%esp), %ebx cmpl %ebx, %eax jg LongerMatch movl windowbestlen(%esp), %esi movl dsPrev(%edx), %edi movl scanend(%esp), %ebx movl chainlenwmask(%esp), %edx jmp LookupLoop /* s->match_start = cur_match; */ /* best_len = len; */ /* if (len >= nice_match) break; */ /* scan_end = *(ushf*)(scan+best_len-1); */ LongerMatch: movl nicematch(%esp), %ebx movl %eax, bestlen(%esp) movl %ecx, dsMatchStart(%edx) cmpl %ebx, %eax jge LeaveNow movl window(%esp), %esi addl %eax, %esi movl %esi, windowbestlen(%esp) movzwl -1(%edi,%eax), %ebx movl dsPrev(%edx), %edi movl %ebx, scanend(%esp) movl chainlenwmask(%esp), %edx jmp LookupLoop /* Accept the current string, with the maximum possible length. */ LenMaximum: movl deflatestate(%esp), %edx movl $MAX_MATCH, bestlen(%esp) movl %ecx, dsMatchStart(%edx) /* if ((uInt)best_len <= s->lookahead) return (uInt)best_len; */ /* return s->lookahead; */ LeaveNow: movl deflatestate(%esp), %edx movl bestlen(%esp), %ebx movl dsLookahead(%edx), %eax cmpl %eax, %ebx jg LookaheadRet movl %ebx, %eax LookaheadRet: /* Restore the stack and return from whence we came. */ addl $LocalVarsSize, %esp popl %ebx popl %esi popl %edi popl %ebp match_init: ret
msftguy/ssh-rd
12,418
_3rd/zlib/contrib/amd64/amd64-match.S
/* * match.S -- optimized version of longest_match() * based on the similar work by Gilles Vollant, and Brian Raiter, written 1998 * * This is free software; you can redistribute it and/or modify it * under the terms of the BSD License. Use by owners of Che Guevarra * parafernalia is prohibited, where possible, and highly discouraged * elsewhere. */ #ifndef NO_UNDERLINE # define match_init _match_init # define longest_match _longest_match #endif #define scanend ebx #define scanendw bx #define chainlenwmask edx /* high word: current chain len low word: s->wmask */ #define curmatch rsi #define curmatchd esi #define windowbestlen r8 #define scanalign r9 #define scanalignd r9d #define window r10 #define bestlen r11 #define bestlend r11d #define scanstart r12d #define scanstartw r12w #define scan r13 #define nicematch r14d #define limit r15 #define limitd r15d #define prev rcx /* * The 258 is a "magic number, not a parameter -- changing it * breaks the hell loose */ #define MAX_MATCH (258) #define MIN_MATCH (3) #define MIN_LOOKAHEAD (MAX_MATCH + MIN_MATCH + 1) #define MAX_MATCH_8 ((MAX_MATCH + 7) & ~7) /* stack frame offsets */ #define LocalVarsSize (112) #define _chainlenwmask ( 8-LocalVarsSize)(%rsp) #define _windowbestlen (16-LocalVarsSize)(%rsp) #define save_r14 (24-LocalVarsSize)(%rsp) #define save_rsi (32-LocalVarsSize)(%rsp) #define save_rbx (40-LocalVarsSize)(%rsp) #define save_r12 (56-LocalVarsSize)(%rsp) #define save_r13 (64-LocalVarsSize)(%rsp) #define save_r15 (80-LocalVarsSize)(%rsp) .globl match_init, longest_match /* * On AMD64 the first argument of a function (in our case -- the pointer to * deflate_state structure) is passed in %rdi, hence our offsets below are * all off of that. */ /* you can check the structure offset by running #include <stdlib.h> #include <stdio.h> #include "deflate.h" void print_depl() { deflate_state ds; deflate_state *s=&ds; printf("size pointer=%u\n",(int)sizeof(void*)); printf("#define dsWSize (%3u)(%%rdi)\n",(int)(((char*)&(s->w_size))-((char*)s))); printf("#define dsWMask (%3u)(%%rdi)\n",(int)(((char*)&(s->w_mask))-((char*)s))); printf("#define dsWindow (%3u)(%%rdi)\n",(int)(((char*)&(s->window))-((char*)s))); printf("#define dsPrev (%3u)(%%rdi)\n",(int)(((char*)&(s->prev))-((char*)s))); printf("#define dsMatchLen (%3u)(%%rdi)\n",(int)(((char*)&(s->match_length))-((char*)s))); printf("#define dsPrevMatch (%3u)(%%rdi)\n",(int)(((char*)&(s->prev_match))-((char*)s))); printf("#define dsStrStart (%3u)(%%rdi)\n",(int)(((char*)&(s->strstart))-((char*)s))); printf("#define dsMatchStart (%3u)(%%rdi)\n",(int)(((char*)&(s->match_start))-((char*)s))); printf("#define dsLookahead (%3u)(%%rdi)\n",(int)(((char*)&(s->lookahead))-((char*)s))); printf("#define dsPrevLen (%3u)(%%rdi)\n",(int)(((char*)&(s->prev_length))-((char*)s))); printf("#define dsMaxChainLen (%3u)(%%rdi)\n",(int)(((char*)&(s->max_chain_length))-((char*)s))); printf("#define dsGoodMatch (%3u)(%%rdi)\n",(int)(((char*)&(s->good_match))-((char*)s))); printf("#define dsNiceMatch (%3u)(%%rdi)\n",(int)(((char*)&(s->nice_match))-((char*)s))); } */ /* to compile for XCode 3.2 on MacOSX x86_64 - run "gcc -g -c -DXCODE_MAC_X64_STRUCTURE amd64-match.S" */ #ifndef CURRENT_LINX_XCODE_MAC_X64_STRUCTURE #define dsWSize ( 68)(%rdi) #define dsWMask ( 76)(%rdi) #define dsWindow ( 80)(%rdi) #define dsPrev ( 96)(%rdi) #define dsMatchLen (144)(%rdi) #define dsPrevMatch (148)(%rdi) #define dsStrStart (156)(%rdi) #define dsMatchStart (160)(%rdi) #define dsLookahead (164)(%rdi) #define dsPrevLen (168)(%rdi) #define dsMaxChainLen (172)(%rdi) #define dsGoodMatch (188)(%rdi) #define dsNiceMatch (192)(%rdi) #else #ifndef STRUCT_OFFSET # define STRUCT_OFFSET (0) #endif #define dsWSize ( 56 + STRUCT_OFFSET)(%rdi) #define dsWMask ( 64 + STRUCT_OFFSET)(%rdi) #define dsWindow ( 72 + STRUCT_OFFSET)(%rdi) #define dsPrev ( 88 + STRUCT_OFFSET)(%rdi) #define dsMatchLen (136 + STRUCT_OFFSET)(%rdi) #define dsPrevMatch (140 + STRUCT_OFFSET)(%rdi) #define dsStrStart (148 + STRUCT_OFFSET)(%rdi) #define dsMatchStart (152 + STRUCT_OFFSET)(%rdi) #define dsLookahead (156 + STRUCT_OFFSET)(%rdi) #define dsPrevLen (160 + STRUCT_OFFSET)(%rdi) #define dsMaxChainLen (164 + STRUCT_OFFSET)(%rdi) #define dsGoodMatch (180 + STRUCT_OFFSET)(%rdi) #define dsNiceMatch (184 + STRUCT_OFFSET)(%rdi) #endif .text /* uInt longest_match(deflate_state *deflatestate, IPos curmatch) */ longest_match: /* * Retrieve the function arguments. %curmatch will hold cur_match * throughout the entire function (passed via rsi on amd64). * rdi will hold the pointer to the deflate_state (first arg on amd64) */ mov %rsi, save_rsi mov %rbx, save_rbx mov %r12, save_r12 mov %r13, save_r13 mov %r14, save_r14 mov %r15, save_r15 /* uInt wmask = s->w_mask; */ /* unsigned chain_length = s->max_chain_length; */ /* if (s->prev_length >= s->good_match) { */ /* chain_length >>= 2; */ /* } */ movl dsPrevLen, %eax movl dsGoodMatch, %ebx cmpl %ebx, %eax movl dsWMask, %eax movl dsMaxChainLen, %chainlenwmask jl LastMatchGood shrl $2, %chainlenwmask LastMatchGood: /* chainlen is decremented once beforehand so that the function can */ /* use the sign flag instead of the zero flag for the exit test. */ /* It is then shifted into the high word, to make room for the wmask */ /* value, which it will always accompany. */ decl %chainlenwmask shll $16, %chainlenwmask orl %eax, %chainlenwmask /* if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; */ movl dsNiceMatch, %eax movl dsLookahead, %ebx cmpl %eax, %ebx jl LookaheadLess movl %eax, %ebx LookaheadLess: movl %ebx, %nicematch /* register Bytef *scan = s->window + s->strstart; */ mov dsWindow, %window movl dsStrStart, %limitd lea (%limit, %window), %scan /* Determine how many bytes the scan ptr is off from being */ /* dword-aligned. */ mov %scan, %scanalign negl %scanalignd andl $3, %scanalignd /* IPos limit = s->strstart > (IPos)MAX_DIST(s) ? */ /* s->strstart - (IPos)MAX_DIST(s) : NIL; */ movl dsWSize, %eax subl $MIN_LOOKAHEAD, %eax xorl %ecx, %ecx subl %eax, %limitd cmovng %ecx, %limitd /* int best_len = s->prev_length; */ movl dsPrevLen, %bestlend /* Store the sum of s->window + best_len in %windowbestlen locally, and in memory. */ lea (%window, %bestlen), %windowbestlen mov %windowbestlen, _windowbestlen /* register ush scan_start = *(ushf*)scan; */ /* register ush scan_end = *(ushf*)(scan+best_len-1); */ /* Posf *prev = s->prev; */ movzwl (%scan), %scanstart movzwl -1(%scan, %bestlen), %scanend mov dsPrev, %prev /* Jump into the main loop. */ movl %chainlenwmask, _chainlenwmask jmp LoopEntry .balign 16 /* do { * match = s->window + cur_match; * if (*(ushf*)(match+best_len-1) != scan_end || * *(ushf*)match != scan_start) continue; * [...] * } while ((cur_match = prev[cur_match & wmask]) > limit * && --chain_length != 0); * * Here is the inner loop of the function. The function will spend the * majority of its time in this loop, and majority of that time will * be spent in the first ten instructions. */ LookupLoop: andl %chainlenwmask, %curmatchd movzwl (%prev, %curmatch, 2), %curmatchd cmpl %limitd, %curmatchd jbe LeaveNow subl $0x00010000, %chainlenwmask js LeaveNow LoopEntry: cmpw -1(%windowbestlen, %curmatch), %scanendw jne LookupLoop cmpw %scanstartw, (%window, %curmatch) jne LookupLoop /* Store the current value of chainlen. */ movl %chainlenwmask, _chainlenwmask /* %scan is the string under scrutiny, and %prev to the string we */ /* are hoping to match it up with. In actuality, %esi and %edi are */ /* both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and %edx is */ /* initialized to -(MAX_MATCH_8 - scanalign). */ mov $(-MAX_MATCH_8), %rdx lea (%curmatch, %window), %windowbestlen lea MAX_MATCH_8(%windowbestlen, %scanalign), %windowbestlen lea MAX_MATCH_8(%scan, %scanalign), %prev /* the prefetching below makes very little difference... */ prefetcht1 (%windowbestlen, %rdx) prefetcht1 (%prev, %rdx) /* * Test the strings for equality, 8 bytes at a time. At the end, * adjust %rdx so that it is offset to the exact byte that mismatched. * * It should be confessed that this loop usually does not represent * much of the total running time. Replacing it with a more * straightforward "rep cmpsb" would not drastically degrade * performance -- unrolling it, for example, makes no difference. */ #undef USE_SSE /* works, but is 6-7% slower, than non-SSE... */ LoopCmps: #ifdef USE_SSE /* Preload the SSE registers */ movdqu (%windowbestlen, %rdx), %xmm1 movdqu (%prev, %rdx), %xmm2 pcmpeqb %xmm2, %xmm1 movdqu 16(%windowbestlen, %rdx), %xmm3 movdqu 16(%prev, %rdx), %xmm4 pcmpeqb %xmm4, %xmm3 movdqu 32(%windowbestlen, %rdx), %xmm5 movdqu 32(%prev, %rdx), %xmm6 pcmpeqb %xmm6, %xmm5 movdqu 48(%windowbestlen, %rdx), %xmm7 movdqu 48(%prev, %rdx), %xmm8 pcmpeqb %xmm8, %xmm7 /* Check the comparisions' results */ pmovmskb %xmm1, %rax notw %ax bsfw %ax, %ax jnz LeaveLoopCmps /* this is the only iteration of the loop with a possibility of having incremented rdx by 0x108 (each loop iteration add 16*4 = 0x40 and (0x40*4)+8=0x108 */ add $8, %rdx jz LenMaximum add $8, %rdx pmovmskb %xmm3, %rax notw %ax bsfw %ax, %ax jnz LeaveLoopCmps add $16, %rdx pmovmskb %xmm5, %rax notw %ax bsfw %ax, %ax jnz LeaveLoopCmps add $16, %rdx pmovmskb %xmm7, %rax notw %ax bsfw %ax, %ax jnz LeaveLoopCmps add $16, %rdx jmp LoopCmps LeaveLoopCmps: add %rax, %rdx #else mov (%windowbestlen, %rdx), %rax xor (%prev, %rdx), %rax jnz LeaveLoopCmps mov 8(%windowbestlen, %rdx), %rax xor 8(%prev, %rdx), %rax jnz LeaveLoopCmps8 mov 16(%windowbestlen, %rdx), %rax xor 16(%prev, %rdx), %rax jnz LeaveLoopCmps16 add $24, %rdx jnz LoopCmps jmp LenMaximum # if 0 /* * This three-liner is tantalizingly simple, but bsf is a slow instruction, * and the complicated alternative down below is quite a bit faster. Sad... */ LeaveLoopCmps: bsf %rax, %rax /* find the first non-zero bit */ shrl $3, %eax /* divide by 8 to get the byte */ add %rax, %rdx # else LeaveLoopCmps16: add $8, %rdx LeaveLoopCmps8: add $8, %rdx LeaveLoopCmps: testl $0xFFFFFFFF, %eax /* Check the first 4 bytes */ jnz Check16 add $4, %rdx shr $32, %rax Check16: testw $0xFFFF, %ax jnz LenLower add $2, %rdx shrl $16, %eax LenLower: subb $1, %al adc $0, %rdx # endif #endif /* Calculate the length of the match. If it is longer than MAX_MATCH, */ /* then automatically accept it as the best possible match and leave. */ lea (%prev, %rdx), %rax sub %scan, %rax cmpl $MAX_MATCH, %eax jge LenMaximum /* If the length of the match is not longer than the best match we */ /* have so far, then forget it and return to the lookup loop. */ cmpl %bestlend, %eax jg LongerMatch mov _windowbestlen, %windowbestlen mov dsPrev, %prev movl _chainlenwmask, %edx jmp LookupLoop /* s->match_start = cur_match; */ /* best_len = len; */ /* if (len >= nice_match) break; */ /* scan_end = *(ushf*)(scan+best_len-1); */ LongerMatch: movl %eax, %bestlend movl %curmatchd, dsMatchStart cmpl %nicematch, %eax jge LeaveNow lea (%window, %bestlen), %windowbestlen mov %windowbestlen, _windowbestlen movzwl -1(%scan, %rax), %scanend mov dsPrev, %prev movl _chainlenwmask, %chainlenwmask jmp LookupLoop /* Accept the current string, with the maximum possible length. */ LenMaximum: movl $MAX_MATCH, %bestlend movl %curmatchd, dsMatchStart /* if ((uInt)best_len <= s->lookahead) return (uInt)best_len; */ /* return s->lookahead; */ LeaveNow: movl dsLookahead, %eax cmpl %eax, %bestlend cmovngl %bestlend, %eax LookaheadRet: /* Restore the registers and return from whence we came. */ mov save_rsi, %rsi mov save_rbx, %rbx mov save_r12, %r12 mov save_r13, %r13 mov save_r14, %r14 mov save_r15, %r15 ret match_init: ret
ms-iot/security
31,125
LimpetMCU/Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/arm/startup_stm32f439xx.s
;******************** (C) COPYRIGHT 2016 STMicroelectronics ******************** ;* File Name : startup_stm32f439xx.s ;* Author : MCD Application Team ;* Version : V2.4.3 ;* Date : 22-January-2016 ;* Description : STM32F439x devices vector table for MDK-ARM 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 CortexM4 processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;* <<< Use Configuration Wizard in Context Menu >>> ;******************************************************************************* ; ;* 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. ; ;******************************************************************************* ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000200 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD MemManage_Handler ; MPU Fault Handler DCD BusFault_Handler ; Bus Fault Handler DCD UsageFault_Handler ; Usage Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD DebugMon_Handler ; Debug Monitor Handler DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD WWDG_IRQHandler ; Window WatchDog DCD PVD_IRQHandler ; PVD through EXTI Line detection DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line DCD RTC_WKUP_IRQHandler ; RTC Wakeup through the EXTI line DCD FLASH_IRQHandler ; FLASH DCD RCC_IRQHandler ; RCC DCD EXTI0_IRQHandler ; EXTI Line0 DCD EXTI1_IRQHandler ; EXTI Line1 DCD EXTI2_IRQHandler ; EXTI Line2 DCD EXTI3_IRQHandler ; EXTI Line3 DCD EXTI4_IRQHandler ; EXTI Line4 DCD DMA1_Stream0_IRQHandler ; DMA1 Stream 0 DCD DMA1_Stream1_IRQHandler ; DMA1 Stream 1 DCD DMA1_Stream2_IRQHandler ; DMA1 Stream 2 DCD DMA1_Stream3_IRQHandler ; DMA1 Stream 3 DCD DMA1_Stream4_IRQHandler ; DMA1 Stream 4 DCD DMA1_Stream5_IRQHandler ; DMA1 Stream 5 DCD DMA1_Stream6_IRQHandler ; DMA1 Stream 6 DCD ADC_IRQHandler ; ADC1, ADC2 and ADC3s DCD CAN1_TX_IRQHandler ; CAN1 TX DCD CAN1_RX0_IRQHandler ; CAN1 RX0 DCD CAN1_RX1_IRQHandler ; CAN1 RX1 DCD CAN1_SCE_IRQHandler ; CAN1 SCE DCD EXTI9_5_IRQHandler ; External Line[9:5]s DCD TIM1_BRK_TIM9_IRQHandler ; TIM1 Break and TIM9 DCD TIM1_UP_TIM10_IRQHandler ; TIM1 Update and TIM10 DCD TIM1_TRG_COM_TIM11_IRQHandler ; TIM1 Trigger and Commutation and TIM11 DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare DCD TIM2_IRQHandler ; TIM2 DCD TIM3_IRQHandler ; TIM3 DCD TIM4_IRQHandler ; TIM4 DCD I2C1_EV_IRQHandler ; I2C1 Event DCD I2C1_ER_IRQHandler ; I2C1 Error DCD I2C2_EV_IRQHandler ; I2C2 Event DCD I2C2_ER_IRQHandler ; I2C2 Error DCD SPI1_IRQHandler ; SPI1 DCD SPI2_IRQHandler ; SPI2 DCD USART1_IRQHandler ; USART1 DCD USART2_IRQHandler ; USART2 DCD USART3_IRQHandler ; USART3 DCD EXTI15_10_IRQHandler ; External Line[15:10]s DCD RTC_Alarm_IRQHandler ; RTC Alarm (A and B) through EXTI Line DCD OTG_FS_WKUP_IRQHandler ; USB OTG FS Wakeup through EXTI line DCD TIM8_BRK_TIM12_IRQHandler ; TIM8 Break and TIM12 DCD TIM8_UP_TIM13_IRQHandler ; TIM8 Update and TIM13 DCD TIM8_TRG_COM_TIM14_IRQHandler ; TIM8 Trigger and Commutation and TIM14 DCD TIM8_CC_IRQHandler ; TIM8 Capture Compare DCD DMA1_Stream7_IRQHandler ; DMA1 Stream7 DCD FMC_IRQHandler ; FMC DCD SDIO_IRQHandler ; SDIO DCD TIM5_IRQHandler ; TIM5 DCD SPI3_IRQHandler ; SPI3 DCD UART4_IRQHandler ; UART4 DCD UART5_IRQHandler ; UART5 DCD TIM6_DAC_IRQHandler ; TIM6 and DAC1&2 underrun errors DCD TIM7_IRQHandler ; TIM7 DCD DMA2_Stream0_IRQHandler ; DMA2 Stream 0 DCD DMA2_Stream1_IRQHandler ; DMA2 Stream 1 DCD DMA2_Stream2_IRQHandler ; DMA2 Stream 2 DCD DMA2_Stream3_IRQHandler ; DMA2 Stream 3 DCD DMA2_Stream4_IRQHandler ; DMA2 Stream 4 DCD ETH_IRQHandler ; Ethernet DCD ETH_WKUP_IRQHandler ; Ethernet Wakeup through EXTI line DCD CAN2_TX_IRQHandler ; CAN2 TX DCD CAN2_RX0_IRQHandler ; CAN2 RX0 DCD CAN2_RX1_IRQHandler ; CAN2 RX1 DCD CAN2_SCE_IRQHandler ; CAN2 SCE DCD OTG_FS_IRQHandler ; USB OTG FS DCD DMA2_Stream5_IRQHandler ; DMA2 Stream 5 DCD DMA2_Stream6_IRQHandler ; DMA2 Stream 6 DCD DMA2_Stream7_IRQHandler ; DMA2 Stream 7 DCD USART6_IRQHandler ; USART6 DCD I2C3_EV_IRQHandler ; I2C3 event DCD I2C3_ER_IRQHandler ; I2C3 error DCD OTG_HS_EP1_OUT_IRQHandler ; USB OTG HS End Point 1 Out DCD OTG_HS_EP1_IN_IRQHandler ; USB OTG HS End Point 1 In DCD OTG_HS_WKUP_IRQHandler ; USB OTG HS Wakeup through EXTI DCD OTG_HS_IRQHandler ; USB OTG HS DCD DCMI_IRQHandler ; DCMI DCD CRYP_IRQHandler ; CRYPTO DCD HASH_RNG_IRQHandler ; Hash and Rng DCD FPU_IRQHandler ; FPU DCD UART7_IRQHandler ; UART7 DCD UART8_IRQHandler ; UART8 DCD SPI4_IRQHandler ; SPI4 DCD SPI5_IRQHandler ; SPI5 DCD SPI6_IRQHandler ; SPI6 DCD SAI1_IRQHandler ; SAI1 DCD LTDC_IRQHandler ; LTDC DCD LTDC_ER_IRQHandler ; LTDC error DCD DMA2D_IRQHandler ; DMA2D __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP MemManage_Handler\ PROC EXPORT MemManage_Handler [WEAK] B . ENDP BusFault_Handler\ PROC EXPORT BusFault_Handler [WEAK] B . ENDP UsageFault_Handler\ PROC EXPORT UsageFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP DebugMon_Handler\ PROC EXPORT DebugMon_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT WWDG_IRQHandler [WEAK] EXPORT PVD_IRQHandler [WEAK] EXPORT TAMP_STAMP_IRQHandler [WEAK] EXPORT RTC_WKUP_IRQHandler [WEAK] EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_IRQHandler [WEAK] EXPORT EXTI1_IRQHandler [WEAK] EXPORT EXTI2_IRQHandler [WEAK] EXPORT EXTI3_IRQHandler [WEAK] EXPORT EXTI4_IRQHandler [WEAK] EXPORT DMA1_Stream0_IRQHandler [WEAK] EXPORT DMA1_Stream1_IRQHandler [WEAK] EXPORT DMA1_Stream2_IRQHandler [WEAK] EXPORT DMA1_Stream3_IRQHandler [WEAK] EXPORT DMA1_Stream4_IRQHandler [WEAK] EXPORT DMA1_Stream5_IRQHandler [WEAK] EXPORT DMA1_Stream6_IRQHandler [WEAK] EXPORT ADC_IRQHandler [WEAK] EXPORT CAN1_TX_IRQHandler [WEAK] EXPORT CAN1_RX0_IRQHandler [WEAK] EXPORT CAN1_RX1_IRQHandler [WEAK] EXPORT CAN1_SCE_IRQHandler [WEAK] EXPORT EXTI9_5_IRQHandler [WEAK] EXPORT TIM1_BRK_TIM9_IRQHandler [WEAK] EXPORT TIM1_UP_TIM10_IRQHandler [WEAK] EXPORT TIM1_TRG_COM_TIM11_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT TIM2_IRQHandler [WEAK] EXPORT TIM3_IRQHandler [WEAK] EXPORT TIM4_IRQHandler [WEAK] EXPORT I2C1_EV_IRQHandler [WEAK] EXPORT I2C1_ER_IRQHandler [WEAK] EXPORT I2C2_EV_IRQHandler [WEAK] EXPORT I2C2_ER_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT SPI2_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] EXPORT USART2_IRQHandler [WEAK] EXPORT USART3_IRQHandler [WEAK] EXPORT EXTI15_10_IRQHandler [WEAK] EXPORT RTC_Alarm_IRQHandler [WEAK] EXPORT OTG_FS_WKUP_IRQHandler [WEAK] EXPORT TIM8_BRK_TIM12_IRQHandler [WEAK] EXPORT TIM8_UP_TIM13_IRQHandler [WEAK] EXPORT TIM8_TRG_COM_TIM14_IRQHandler [WEAK] EXPORT TIM8_CC_IRQHandler [WEAK] EXPORT DMA1_Stream7_IRQHandler [WEAK] EXPORT FMC_IRQHandler [WEAK] EXPORT SDIO_IRQHandler [WEAK] EXPORT TIM5_IRQHandler [WEAK] EXPORT SPI3_IRQHandler [WEAK] EXPORT UART4_IRQHandler [WEAK] EXPORT UART5_IRQHandler [WEAK] EXPORT TIM6_DAC_IRQHandler [WEAK] EXPORT TIM7_IRQHandler [WEAK] EXPORT DMA2_Stream0_IRQHandler [WEAK] EXPORT DMA2_Stream1_IRQHandler [WEAK] EXPORT DMA2_Stream2_IRQHandler [WEAK] EXPORT DMA2_Stream3_IRQHandler [WEAK] EXPORT DMA2_Stream4_IRQHandler [WEAK] EXPORT ETH_IRQHandler [WEAK] EXPORT ETH_WKUP_IRQHandler [WEAK] EXPORT CAN2_TX_IRQHandler [WEAK] EXPORT CAN2_RX0_IRQHandler [WEAK] EXPORT CAN2_RX1_IRQHandler [WEAK] EXPORT CAN2_SCE_IRQHandler [WEAK] EXPORT OTG_FS_IRQHandler [WEAK] EXPORT DMA2_Stream5_IRQHandler [WEAK] EXPORT DMA2_Stream6_IRQHandler [WEAK] EXPORT DMA2_Stream7_IRQHandler [WEAK] EXPORT USART6_IRQHandler [WEAK] EXPORT I2C3_EV_IRQHandler [WEAK] EXPORT I2C3_ER_IRQHandler [WEAK] EXPORT OTG_HS_EP1_OUT_IRQHandler [WEAK] EXPORT OTG_HS_EP1_IN_IRQHandler [WEAK] EXPORT OTG_HS_WKUP_IRQHandler [WEAK] EXPORT OTG_HS_IRQHandler [WEAK] EXPORT DCMI_IRQHandler [WEAK] EXPORT CRYP_IRQHandler [WEAK] EXPORT HASH_RNG_IRQHandler [WEAK] EXPORT FPU_IRQHandler [WEAK] EXPORT UART7_IRQHandler [WEAK] EXPORT UART8_IRQHandler [WEAK] EXPORT SPI4_IRQHandler [WEAK] EXPORT SPI5_IRQHandler [WEAK] EXPORT SPI6_IRQHandler [WEAK] EXPORT SAI1_IRQHandler [WEAK] EXPORT LTDC_IRQHandler [WEAK] EXPORT LTDC_ER_IRQHandler [WEAK] EXPORT DMA2D_IRQHandler [WEAK] WWDG_IRQHandler PVD_IRQHandler TAMP_STAMP_IRQHandler RTC_WKUP_IRQHandler FLASH_IRQHandler RCC_IRQHandler EXTI0_IRQHandler EXTI1_IRQHandler EXTI2_IRQHandler EXTI3_IRQHandler EXTI4_IRQHandler DMA1_Stream0_IRQHandler DMA1_Stream1_IRQHandler DMA1_Stream2_IRQHandler DMA1_Stream3_IRQHandler DMA1_Stream4_IRQHandler DMA1_Stream5_IRQHandler DMA1_Stream6_IRQHandler ADC_IRQHandler CAN1_TX_IRQHandler CAN1_RX0_IRQHandler CAN1_RX1_IRQHandler CAN1_SCE_IRQHandler EXTI9_5_IRQHandler TIM1_BRK_TIM9_IRQHandler TIM1_UP_TIM10_IRQHandler TIM1_TRG_COM_TIM11_IRQHandler TIM1_CC_IRQHandler TIM2_IRQHandler TIM3_IRQHandler TIM4_IRQHandler I2C1_EV_IRQHandler I2C1_ER_IRQHandler I2C2_EV_IRQHandler I2C2_ER_IRQHandler SPI1_IRQHandler SPI2_IRQHandler USART1_IRQHandler USART2_IRQHandler USART3_IRQHandler EXTI15_10_IRQHandler RTC_Alarm_IRQHandler OTG_FS_WKUP_IRQHandler TIM8_BRK_TIM12_IRQHandler TIM8_UP_TIM13_IRQHandler TIM8_TRG_COM_TIM14_IRQHandler TIM8_CC_IRQHandler DMA1_Stream7_IRQHandler FMC_IRQHandler SDIO_IRQHandler TIM5_IRQHandler SPI3_IRQHandler UART4_IRQHandler UART5_IRQHandler TIM6_DAC_IRQHandler TIM7_IRQHandler DMA2_Stream0_IRQHandler DMA2_Stream1_IRQHandler DMA2_Stream2_IRQHandler DMA2_Stream3_IRQHandler DMA2_Stream4_IRQHandler ETH_IRQHandler ETH_WKUP_IRQHandler CAN2_TX_IRQHandler CAN2_RX0_IRQHandler CAN2_RX1_IRQHandler CAN2_SCE_IRQHandler OTG_FS_IRQHandler DMA2_Stream5_IRQHandler DMA2_Stream6_IRQHandler DMA2_Stream7_IRQHandler USART6_IRQHandler I2C3_EV_IRQHandler I2C3_ER_IRQHandler OTG_HS_EP1_OUT_IRQHandler OTG_HS_EP1_IN_IRQHandler OTG_HS_WKUP_IRQHandler OTG_HS_IRQHandler DCMI_IRQHandler CRYP_IRQHandler HASH_RNG_IRQHandler FPU_IRQHandler UART7_IRQHandler UART8_IRQHandler SPI4_IRQHandler SPI5_IRQHandler SPI6_IRQHandler SAI1_IRQHandler LTDC_IRQHandler LTDC_ER_IRQHandler DMA2D_IRQHandler B . ENDP ALIGN ;******************************************************************************* ; User Stack and Heap initialization ;******************************************************************************* IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE*****
ms-iot/security
26,123
LimpetMCU/Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/arm/startup_stm32f411xe.s
;******************** (C) COPYRIGHT 2016 STMicroelectronics ******************** ;* File Name : startup_stm32f411xe.s ;* Author : MCD Application Team ;* Version : V2.4.3 ;* Date : 22-January-2016 ;* Description : STM32F411xExx devices vector table for MDK-ARM 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 CortexM4 processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;* <<< Use Configuration Wizard in Context Menu >>> ;******************************************************************************* ; ;* 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. ; ;******************************************************************************* ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000200 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD MemManage_Handler ; MPU Fault Handler DCD BusFault_Handler ; Bus Fault Handler DCD UsageFault_Handler ; Usage Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD DebugMon_Handler ; Debug Monitor Handler DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD WWDG_IRQHandler ; Window WatchDog DCD PVD_IRQHandler ; PVD through EXTI Line detection DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line DCD RTC_WKUP_IRQHandler ; RTC Wakeup through the EXTI line DCD FLASH_IRQHandler ; FLASH DCD RCC_IRQHandler ; RCC DCD EXTI0_IRQHandler ; EXTI Line0 DCD EXTI1_IRQHandler ; EXTI Line1 DCD EXTI2_IRQHandler ; EXTI Line2 DCD EXTI3_IRQHandler ; EXTI Line3 DCD EXTI4_IRQHandler ; EXTI Line4 DCD DMA1_Stream0_IRQHandler ; DMA1 Stream 0 DCD DMA1_Stream1_IRQHandler ; DMA1 Stream 1 DCD DMA1_Stream2_IRQHandler ; DMA1 Stream 2 DCD DMA1_Stream3_IRQHandler ; DMA1 Stream 3 DCD DMA1_Stream4_IRQHandler ; DMA1 Stream 4 DCD DMA1_Stream5_IRQHandler ; DMA1 Stream 5 DCD DMA1_Stream6_IRQHandler ; DMA1 Stream 6 DCD ADC_IRQHandler ; ADC1, ADC2 and ADC3s DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD EXTI9_5_IRQHandler ; External Line[9:5]s DCD TIM1_BRK_TIM9_IRQHandler ; TIM1 Break and TIM9 DCD TIM1_UP_TIM10_IRQHandler ; TIM1 Update and TIM10 DCD TIM1_TRG_COM_TIM11_IRQHandler ; TIM1 Trigger and Commutation and TIM11 DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare DCD TIM2_IRQHandler ; TIM2 DCD TIM3_IRQHandler ; TIM3 DCD TIM4_IRQHandler ; TIM4 DCD I2C1_EV_IRQHandler ; I2C1 Event DCD I2C1_ER_IRQHandler ; I2C1 Error DCD I2C2_EV_IRQHandler ; I2C2 Event DCD I2C2_ER_IRQHandler ; I2C2 Error DCD SPI1_IRQHandler ; SPI1 DCD SPI2_IRQHandler ; SPI2 DCD USART1_IRQHandler ; USART1 DCD USART2_IRQHandler ; USART2 DCD 0 ; Reserved DCD EXTI15_10_IRQHandler ; External Line[15:10]s DCD RTC_Alarm_IRQHandler ; RTC Alarm (A and B) through EXTI Line DCD OTG_FS_WKUP_IRQHandler ; USB OTG FS Wakeup through EXTI line DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD DMA1_Stream7_IRQHandler ; DMA1 Stream7 DCD 0 ; Reserved DCD SDIO_IRQHandler ; SDIO DCD TIM5_IRQHandler ; TIM5 DCD SPI3_IRQHandler ; SPI3 DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD DMA2_Stream0_IRQHandler ; DMA2 Stream 0 DCD DMA2_Stream1_IRQHandler ; DMA2 Stream 1 DCD DMA2_Stream2_IRQHandler ; DMA2 Stream 2 DCD DMA2_Stream3_IRQHandler ; DMA2 Stream 3 DCD DMA2_Stream4_IRQHandler ; DMA2 Stream 4 DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD OTG_FS_IRQHandler ; USB OTG FS DCD DMA2_Stream5_IRQHandler ; DMA2 Stream 5 DCD DMA2_Stream6_IRQHandler ; DMA2 Stream 6 DCD DMA2_Stream7_IRQHandler ; DMA2 Stream 7 DCD USART6_IRQHandler ; USART6 DCD I2C3_EV_IRQHandler ; I2C3 event DCD I2C3_ER_IRQHandler ; I2C3 error DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD FPU_IRQHandler ; FPU DCD 0 ; Reserved DCD 0 ; Reserved DCD SPI4_IRQHandler ; SPI4 DCD SPI5_IRQHandler ; SPI5 __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP MemManage_Handler\ PROC EXPORT MemManage_Handler [WEAK] B . ENDP BusFault_Handler\ PROC EXPORT BusFault_Handler [WEAK] B . ENDP UsageFault_Handler\ PROC EXPORT UsageFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP DebugMon_Handler\ PROC EXPORT DebugMon_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT WWDG_IRQHandler [WEAK] EXPORT PVD_IRQHandler [WEAK] EXPORT TAMP_STAMP_IRQHandler [WEAK] EXPORT RTC_WKUP_IRQHandler [WEAK] EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_IRQHandler [WEAK] EXPORT EXTI1_IRQHandler [WEAK] EXPORT EXTI2_IRQHandler [WEAK] EXPORT EXTI3_IRQHandler [WEAK] EXPORT EXTI4_IRQHandler [WEAK] EXPORT DMA1_Stream0_IRQHandler [WEAK] EXPORT DMA1_Stream1_IRQHandler [WEAK] EXPORT DMA1_Stream2_IRQHandler [WEAK] EXPORT DMA1_Stream3_IRQHandler [WEAK] EXPORT DMA1_Stream4_IRQHandler [WEAK] EXPORT DMA1_Stream5_IRQHandler [WEAK] EXPORT DMA1_Stream6_IRQHandler [WEAK] EXPORT ADC_IRQHandler [WEAK] EXPORT EXTI9_5_IRQHandler [WEAK] EXPORT TIM1_BRK_TIM9_IRQHandler [WEAK] EXPORT TIM1_UP_TIM10_IRQHandler [WEAK] EXPORT TIM1_TRG_COM_TIM11_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT TIM2_IRQHandler [WEAK] EXPORT TIM3_IRQHandler [WEAK] EXPORT TIM4_IRQHandler [WEAK] EXPORT I2C1_EV_IRQHandler [WEAK] EXPORT I2C1_ER_IRQHandler [WEAK] EXPORT I2C2_EV_IRQHandler [WEAK] EXPORT I2C2_ER_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT SPI2_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] EXPORT USART2_IRQHandler [WEAK] EXPORT EXTI15_10_IRQHandler [WEAK] EXPORT RTC_Alarm_IRQHandler [WEAK] EXPORT OTG_FS_WKUP_IRQHandler [WEAK] EXPORT DMA1_Stream7_IRQHandler [WEAK] EXPORT SDIO_IRQHandler [WEAK] EXPORT TIM5_IRQHandler [WEAK] EXPORT SPI3_IRQHandler [WEAK] EXPORT DMA2_Stream0_IRQHandler [WEAK] EXPORT DMA2_Stream1_IRQHandler [WEAK] EXPORT DMA2_Stream2_IRQHandler [WEAK] EXPORT DMA2_Stream3_IRQHandler [WEAK] EXPORT DMA2_Stream4_IRQHandler [WEAK] EXPORT OTG_FS_IRQHandler [WEAK] EXPORT DMA2_Stream5_IRQHandler [WEAK] EXPORT DMA2_Stream6_IRQHandler [WEAK] EXPORT DMA2_Stream7_IRQHandler [WEAK] EXPORT USART6_IRQHandler [WEAK] EXPORT I2C3_EV_IRQHandler [WEAK] EXPORT I2C3_ER_IRQHandler [WEAK] EXPORT FPU_IRQHandler [WEAK] EXPORT SPI4_IRQHandler [WEAK] EXPORT SPI5_IRQHandler [WEAK] WWDG_IRQHandler PVD_IRQHandler TAMP_STAMP_IRQHandler RTC_WKUP_IRQHandler FLASH_IRQHandler RCC_IRQHandler EXTI0_IRQHandler EXTI1_IRQHandler EXTI2_IRQHandler EXTI3_IRQHandler EXTI4_IRQHandler DMA1_Stream0_IRQHandler DMA1_Stream1_IRQHandler DMA1_Stream2_IRQHandler DMA1_Stream3_IRQHandler DMA1_Stream4_IRQHandler DMA1_Stream5_IRQHandler DMA1_Stream6_IRQHandler ADC_IRQHandler EXTI9_5_IRQHandler TIM1_BRK_TIM9_IRQHandler TIM1_UP_TIM10_IRQHandler TIM1_TRG_COM_TIM11_IRQHandler TIM1_CC_IRQHandler TIM2_IRQHandler TIM3_IRQHandler TIM4_IRQHandler I2C1_EV_IRQHandler I2C1_ER_IRQHandler I2C2_EV_IRQHandler I2C2_ER_IRQHandler SPI1_IRQHandler SPI2_IRQHandler USART1_IRQHandler USART2_IRQHandler EXTI15_10_IRQHandler RTC_Alarm_IRQHandler OTG_FS_WKUP_IRQHandler DMA1_Stream7_IRQHandler SDIO_IRQHandler TIM5_IRQHandler SPI3_IRQHandler DMA2_Stream0_IRQHandler DMA2_Stream1_IRQHandler DMA2_Stream2_IRQHandler DMA2_Stream3_IRQHandler DMA2_Stream4_IRQHandler OTG_FS_IRQHandler DMA2_Stream5_IRQHandler DMA2_Stream6_IRQHandler DMA2_Stream7_IRQHandler USART6_IRQHandler I2C3_EV_IRQHandler I2C3_ER_IRQHandler FPU_IRQHandler SPI4_IRQHandler SPI5_IRQHandler B . ENDP ALIGN ;******************************************************************************* ; User Stack and Heap initialization ;******************************************************************************* IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE*****
ms-iot/security
31,327
LimpetMCU/Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/arm/startup_stm32f469xx.s
;******************** (C) COPYRIGHT 2016 STMicroelectronics ******************** ;* File Name : startup_stm32f469xx.s ;* Author : MCD Application Team ;* Version : V2.4.3 ;* Date : 22-January-2016 ;* Description : STM32F469x devices vector table for MDK-ARM 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 CortexM4 processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;* <<< Use Configuration Wizard in Context Menu >>> ;******************************************************************************* ; ;* 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. ; ;******************************************************************************* ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000200 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD MemManage_Handler ; MPU Fault Handler DCD BusFault_Handler ; Bus Fault Handler DCD UsageFault_Handler ; Usage Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD DebugMon_Handler ; Debug Monitor Handler DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD WWDG_IRQHandler ; Window WatchDog DCD PVD_IRQHandler ; PVD through EXTI Line detection DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line DCD RTC_WKUP_IRQHandler ; RTC Wakeup through the EXTI line DCD FLASH_IRQHandler ; FLASH DCD RCC_IRQHandler ; RCC DCD EXTI0_IRQHandler ; EXTI Line0 DCD EXTI1_IRQHandler ; EXTI Line1 DCD EXTI2_IRQHandler ; EXTI Line2 DCD EXTI3_IRQHandler ; EXTI Line3 DCD EXTI4_IRQHandler ; EXTI Line4 DCD DMA1_Stream0_IRQHandler ; DMA1 Stream 0 DCD DMA1_Stream1_IRQHandler ; DMA1 Stream 1 DCD DMA1_Stream2_IRQHandler ; DMA1 Stream 2 DCD DMA1_Stream3_IRQHandler ; DMA1 Stream 3 DCD DMA1_Stream4_IRQHandler ; DMA1 Stream 4 DCD DMA1_Stream5_IRQHandler ; DMA1 Stream 5 DCD DMA1_Stream6_IRQHandler ; DMA1 Stream 6 DCD ADC_IRQHandler ; ADC1, ADC2 and ADC3s DCD CAN1_TX_IRQHandler ; CAN1 TX DCD CAN1_RX0_IRQHandler ; CAN1 RX0 DCD CAN1_RX1_IRQHandler ; CAN1 RX1 DCD CAN1_SCE_IRQHandler ; CAN1 SCE DCD EXTI9_5_IRQHandler ; External Line[9:5]s DCD TIM1_BRK_TIM9_IRQHandler ; TIM1 Break and TIM9 DCD TIM1_UP_TIM10_IRQHandler ; TIM1 Update and TIM10 DCD TIM1_TRG_COM_TIM11_IRQHandler ; TIM1 Trigger and Commutation and TIM11 DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare DCD TIM2_IRQHandler ; TIM2 DCD TIM3_IRQHandler ; TIM3 DCD TIM4_IRQHandler ; TIM4 DCD I2C1_EV_IRQHandler ; I2C1 Event DCD I2C1_ER_IRQHandler ; I2C1 Error DCD I2C2_EV_IRQHandler ; I2C2 Event DCD I2C2_ER_IRQHandler ; I2C2 Error DCD SPI1_IRQHandler ; SPI1 DCD SPI2_IRQHandler ; SPI2 DCD USART1_IRQHandler ; USART1 DCD USART2_IRQHandler ; USART2 DCD USART3_IRQHandler ; USART3 DCD EXTI15_10_IRQHandler ; External Line[15:10]s DCD RTC_Alarm_IRQHandler ; RTC Alarm (A and B) through EXTI Line DCD OTG_FS_WKUP_IRQHandler ; USB OTG FS Wakeup through EXTI line DCD TIM8_BRK_TIM12_IRQHandler ; TIM8 Break and TIM12 DCD TIM8_UP_TIM13_IRQHandler ; TIM8 Update and TIM13 DCD TIM8_TRG_COM_TIM14_IRQHandler ; TIM8 Trigger and Commutation and TIM14 DCD TIM8_CC_IRQHandler ; TIM8 Capture Compare DCD DMA1_Stream7_IRQHandler ; DMA1 Stream7 DCD FMC_IRQHandler ; FMC DCD SDIO_IRQHandler ; SDIO DCD TIM5_IRQHandler ; TIM5 DCD SPI3_IRQHandler ; SPI3 DCD UART4_IRQHandler ; UART4 DCD UART5_IRQHandler ; UART5 DCD TIM6_DAC_IRQHandler ; TIM6 and DAC1&2 underrun errors DCD TIM7_IRQHandler ; TIM7 DCD DMA2_Stream0_IRQHandler ; DMA2 Stream 0 DCD DMA2_Stream1_IRQHandler ; DMA2 Stream 1 DCD DMA2_Stream2_IRQHandler ; DMA2 Stream 2 DCD DMA2_Stream3_IRQHandler ; DMA2 Stream 3 DCD DMA2_Stream4_IRQHandler ; DMA2 Stream 4 DCD ETH_IRQHandler ; Ethernet DCD ETH_WKUP_IRQHandler ; Ethernet Wakeup through EXTI line DCD CAN2_TX_IRQHandler ; CAN2 TX DCD CAN2_RX0_IRQHandler ; CAN2 RX0 DCD CAN2_RX1_IRQHandler ; CAN2 RX1 DCD CAN2_SCE_IRQHandler ; CAN2 SCE DCD OTG_FS_IRQHandler ; USB OTG FS DCD DMA2_Stream5_IRQHandler ; DMA2 Stream 5 DCD DMA2_Stream6_IRQHandler ; DMA2 Stream 6 DCD DMA2_Stream7_IRQHandler ; DMA2 Stream 7 DCD USART6_IRQHandler ; USART6 DCD I2C3_EV_IRQHandler ; I2C3 event DCD I2C3_ER_IRQHandler ; I2C3 error DCD OTG_HS_EP1_OUT_IRQHandler ; USB OTG HS End Point 1 Out DCD OTG_HS_EP1_IN_IRQHandler ; USB OTG HS End Point 1 In DCD OTG_HS_WKUP_IRQHandler ; USB OTG HS Wakeup through EXTI DCD OTG_HS_IRQHandler ; USB OTG HS DCD DCMI_IRQHandler ; DCMI DCD 0 ; Reserved DCD HASH_RNG_IRQHandler ; Hash and Rng DCD FPU_IRQHandler ; FPU DCD UART7_IRQHandler ; UART7 DCD UART8_IRQHandler ; UART8 DCD SPI4_IRQHandler ; SPI4 DCD SPI5_IRQHandler ; SPI5 DCD SPI6_IRQHandler ; SPI6 DCD SAI1_IRQHandler ; SAI1 DCD LTDC_IRQHandler ; LTDC DCD LTDC_ER_IRQHandler ; LTDC error DCD DMA2D_IRQHandler ; DMA2D DCD QUADSPI_IRQHandler ; QUADSPI DCD DSI_IRQHandler ; DSI __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP MemManage_Handler\ PROC EXPORT MemManage_Handler [WEAK] B . ENDP BusFault_Handler\ PROC EXPORT BusFault_Handler [WEAK] B . ENDP UsageFault_Handler\ PROC EXPORT UsageFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP DebugMon_Handler\ PROC EXPORT DebugMon_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT WWDG_IRQHandler [WEAK] EXPORT PVD_IRQHandler [WEAK] EXPORT TAMP_STAMP_IRQHandler [WEAK] EXPORT RTC_WKUP_IRQHandler [WEAK] EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_IRQHandler [WEAK] EXPORT EXTI1_IRQHandler [WEAK] EXPORT EXTI2_IRQHandler [WEAK] EXPORT EXTI3_IRQHandler [WEAK] EXPORT EXTI4_IRQHandler [WEAK] EXPORT DMA1_Stream0_IRQHandler [WEAK] EXPORT DMA1_Stream1_IRQHandler [WEAK] EXPORT DMA1_Stream2_IRQHandler [WEAK] EXPORT DMA1_Stream3_IRQHandler [WEAK] EXPORT DMA1_Stream4_IRQHandler [WEAK] EXPORT DMA1_Stream5_IRQHandler [WEAK] EXPORT DMA1_Stream6_IRQHandler [WEAK] EXPORT ADC_IRQHandler [WEAK] EXPORT CAN1_TX_IRQHandler [WEAK] EXPORT CAN1_RX0_IRQHandler [WEAK] EXPORT CAN1_RX1_IRQHandler [WEAK] EXPORT CAN1_SCE_IRQHandler [WEAK] EXPORT EXTI9_5_IRQHandler [WEAK] EXPORT TIM1_BRK_TIM9_IRQHandler [WEAK] EXPORT TIM1_UP_TIM10_IRQHandler [WEAK] EXPORT TIM1_TRG_COM_TIM11_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT TIM2_IRQHandler [WEAK] EXPORT TIM3_IRQHandler [WEAK] EXPORT TIM4_IRQHandler [WEAK] EXPORT I2C1_EV_IRQHandler [WEAK] EXPORT I2C1_ER_IRQHandler [WEAK] EXPORT I2C2_EV_IRQHandler [WEAK] EXPORT I2C2_ER_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT SPI2_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] EXPORT USART2_IRQHandler [WEAK] EXPORT USART3_IRQHandler [WEAK] EXPORT EXTI15_10_IRQHandler [WEAK] EXPORT RTC_Alarm_IRQHandler [WEAK] EXPORT OTG_FS_WKUP_IRQHandler [WEAK] EXPORT TIM8_BRK_TIM12_IRQHandler [WEAK] EXPORT TIM8_UP_TIM13_IRQHandler [WEAK] EXPORT TIM8_TRG_COM_TIM14_IRQHandler [WEAK] EXPORT TIM8_CC_IRQHandler [WEAK] EXPORT DMA1_Stream7_IRQHandler [WEAK] EXPORT FMC_IRQHandler [WEAK] EXPORT SDIO_IRQHandler [WEAK] EXPORT TIM5_IRQHandler [WEAK] EXPORT SPI3_IRQHandler [WEAK] EXPORT UART4_IRQHandler [WEAK] EXPORT UART5_IRQHandler [WEAK] EXPORT TIM6_DAC_IRQHandler [WEAK] EXPORT TIM7_IRQHandler [WEAK] EXPORT DMA2_Stream0_IRQHandler [WEAK] EXPORT DMA2_Stream1_IRQHandler [WEAK] EXPORT DMA2_Stream2_IRQHandler [WEAK] EXPORT DMA2_Stream3_IRQHandler [WEAK] EXPORT DMA2_Stream4_IRQHandler [WEAK] EXPORT ETH_IRQHandler [WEAK] EXPORT ETH_WKUP_IRQHandler [WEAK] EXPORT CAN2_TX_IRQHandler [WEAK] EXPORT CAN2_RX0_IRQHandler [WEAK] EXPORT CAN2_RX1_IRQHandler [WEAK] EXPORT CAN2_SCE_IRQHandler [WEAK] EXPORT OTG_FS_IRQHandler [WEAK] EXPORT DMA2_Stream5_IRQHandler [WEAK] EXPORT DMA2_Stream6_IRQHandler [WEAK] EXPORT DMA2_Stream7_IRQHandler [WEAK] EXPORT USART6_IRQHandler [WEAK] EXPORT I2C3_EV_IRQHandler [WEAK] EXPORT I2C3_ER_IRQHandler [WEAK] EXPORT OTG_HS_EP1_OUT_IRQHandler [WEAK] EXPORT OTG_HS_EP1_IN_IRQHandler [WEAK] EXPORT OTG_HS_WKUP_IRQHandler [WEAK] EXPORT OTG_HS_IRQHandler [WEAK] EXPORT DCMI_IRQHandler [WEAK] EXPORT HASH_RNG_IRQHandler [WEAK] EXPORT FPU_IRQHandler [WEAK] EXPORT UART7_IRQHandler [WEAK] EXPORT UART8_IRQHandler [WEAK] EXPORT SPI4_IRQHandler [WEAK] EXPORT SPI5_IRQHandler [WEAK] EXPORT SPI6_IRQHandler [WEAK] EXPORT SAI1_IRQHandler [WEAK] EXPORT LTDC_IRQHandler [WEAK] EXPORT LTDC_ER_IRQHandler [WEAK] EXPORT DMA2D_IRQHandler [WEAK] EXPORT QUADSPI_IRQHandler [WEAK] EXPORT DSI_IRQHandler [WEAK] WWDG_IRQHandler PVD_IRQHandler TAMP_STAMP_IRQHandler RTC_WKUP_IRQHandler FLASH_IRQHandler RCC_IRQHandler EXTI0_IRQHandler EXTI1_IRQHandler EXTI2_IRQHandler EXTI3_IRQHandler EXTI4_IRQHandler DMA1_Stream0_IRQHandler DMA1_Stream1_IRQHandler DMA1_Stream2_IRQHandler DMA1_Stream3_IRQHandler DMA1_Stream4_IRQHandler DMA1_Stream5_IRQHandler DMA1_Stream6_IRQHandler ADC_IRQHandler CAN1_TX_IRQHandler CAN1_RX0_IRQHandler CAN1_RX1_IRQHandler CAN1_SCE_IRQHandler EXTI9_5_IRQHandler TIM1_BRK_TIM9_IRQHandler TIM1_UP_TIM10_IRQHandler TIM1_TRG_COM_TIM11_IRQHandler TIM1_CC_IRQHandler TIM2_IRQHandler TIM3_IRQHandler TIM4_IRQHandler I2C1_EV_IRQHandler I2C1_ER_IRQHandler I2C2_EV_IRQHandler I2C2_ER_IRQHandler SPI1_IRQHandler SPI2_IRQHandler USART1_IRQHandler USART2_IRQHandler USART3_IRQHandler EXTI15_10_IRQHandler RTC_Alarm_IRQHandler OTG_FS_WKUP_IRQHandler TIM8_BRK_TIM12_IRQHandler TIM8_UP_TIM13_IRQHandler TIM8_TRG_COM_TIM14_IRQHandler TIM8_CC_IRQHandler DMA1_Stream7_IRQHandler FMC_IRQHandler SDIO_IRQHandler TIM5_IRQHandler SPI3_IRQHandler UART4_IRQHandler UART5_IRQHandler TIM6_DAC_IRQHandler TIM7_IRQHandler DMA2_Stream0_IRQHandler DMA2_Stream1_IRQHandler DMA2_Stream2_IRQHandler DMA2_Stream3_IRQHandler DMA2_Stream4_IRQHandler ETH_IRQHandler ETH_WKUP_IRQHandler CAN2_TX_IRQHandler CAN2_RX0_IRQHandler CAN2_RX1_IRQHandler CAN2_SCE_IRQHandler OTG_FS_IRQHandler DMA2_Stream5_IRQHandler DMA2_Stream6_IRQHandler DMA2_Stream7_IRQHandler USART6_IRQHandler I2C3_EV_IRQHandler I2C3_ER_IRQHandler OTG_HS_EP1_OUT_IRQHandler OTG_HS_EP1_IN_IRQHandler OTG_HS_WKUP_IRQHandler OTG_HS_IRQHandler DCMI_IRQHandler HASH_RNG_IRQHandler FPU_IRQHandler UART7_IRQHandler UART8_IRQHandler SPI4_IRQHandler SPI5_IRQHandler SPI6_IRQHandler SAI1_IRQHandler LTDC_IRQHandler LTDC_ER_IRQHandler DMA2D_IRQHandler QUADSPI_IRQHandler DSI_IRQHandler B . ENDP ALIGN ;******************************************************************************* ; User Stack and Heap initialization ;******************************************************************************* IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE*****
ms-iot/security
18,556
LimpetMCU/Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/arm/startup_stm32f410tx.s
;******************** (C) COPYRIGHT 2016 STMicroelectronics ******************** ;* File Name : startup_stm32f410tx.s ;* Author : MCD Application Team ;* Version : V2.4.3 ;* Date : 22-January-2016 ;* Description : STM32F410Tx devices vector table for MDK-ARM 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 CortexM4 processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;* <<< Use Configuration Wizard in Context Menu >>> ;******************************************************************************* ; ;* 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. ; ;******************************************************************************* ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000200 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD MemManage_Handler ; MPU Fault Handler DCD BusFault_Handler ; Bus Fault Handler DCD UsageFault_Handler ; Usage Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD DebugMon_Handler ; Debug Monitor Handler DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD WWDG_IRQHandler ; Window WatchDog DCD PVD_IRQHandler ; PVD through EXTI Line detection DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line DCD RTC_WKUP_IRQHandler ; RTC Wakeup through the EXTI line DCD FLASH_IRQHandler ; FLASH DCD RCC_IRQHandler ; RCC DCD EXTI0_IRQHandler ; EXTI Line0 DCD EXTI1_IRQHandler ; EXTI Line1 DCD EXTI2_IRQHandler ; EXTI Line2 DCD EXTI3_IRQHandler ; EXTI Line3 DCD EXTI4_IRQHandler ; EXTI Line4 DCD DMA1_Stream0_IRQHandler ; DMA1 Stream 0 DCD DMA1_Stream1_IRQHandler ; DMA1 Stream 1 DCD DMA1_Stream2_IRQHandler ; DMA1 Stream 2 DCD DMA1_Stream3_IRQHandler ; DMA1 Stream 3 DCD DMA1_Stream4_IRQHandler ; DMA1 Stream 4 DCD DMA1_Stream5_IRQHandler ; DMA1 Stream 5 DCD DMA1_Stream6_IRQHandler ; DMA1 Stream 6 DCD ADC_IRQHandler ; ADC1, ADC2 and ADC3s DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD EXTI9_5_IRQHandler ; External Line[9:5]s DCD TIM1_BRK_TIM9_IRQHandler ; TIM1 Break and TIM9 DCD TIM1_UP_IRQHandler ; TIM1 Update DCD TIM1_TRG_COM_TIM11_IRQHandler ; TIM1 Trigger and Commutation and TIM11 DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD I2C1_EV_IRQHandler ; I2C1 Event DCD I2C1_ER_IRQHandler ; I2C1 Error DCD I2C2_EV_IRQHandler ; I2C2 Event DCD I2C2_ER_IRQHandler ; I2C2 Error DCD SPI1_IRQHandler ; SPI1 DCD 0 ; Reserved DCD USART1_IRQHandler ; USART1 DCD USART2_IRQHandler ; USART2 DCD 0 ; Reserved DCD EXTI15_10_IRQHandler ; External Line[15:10]s DCD RTC_Alarm_IRQHandler ; RTC Alarm (A and B) through EXTI Line DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD DMA1_Stream7_IRQHandler ; DMA1 Stream7 DCD 0 ; Reserved DCD 0 ; Reserved DCD TIM5_IRQHandler ; TIM5 DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD TIM6_DAC_IRQHandler ; TIM6 and DAC DCD 0 ; Reserved DCD DMA2_Stream0_IRQHandler ; DMA2 Stream 0 DCD DMA2_Stream1_IRQHandler ; DMA2 Stream 1 DCD DMA2_Stream2_IRQHandler ; DMA2 Stream 2 DCD DMA2_Stream3_IRQHandler ; DMA2 Stream 3 DCD DMA2_Stream4_IRQHandler ; DMA2 Stream 4 DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD DMA2_Stream5_IRQHandler ; DMA2 Stream 5 DCD DMA2_Stream6_IRQHandler ; DMA2 Stream 6 DCD DMA2_Stream7_IRQHandler ; DMA2 Stream 7 DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD RNG_IRQHandler ; RNG DCD FPU_IRQHandler ; FPU DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD FMPI2C1_EV_IRQHandler ; FMPI2C1 Event DCD FMPI2C1_ER_IRQHandler ; FMPI2C1 Error DCD LPTIM1_IRQHandler ; LP TIM1 __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP MemManage_Handler\ PROC EXPORT MemManage_Handler [WEAK] B . ENDP BusFault_Handler\ PROC EXPORT BusFault_Handler [WEAK] B . ENDP UsageFault_Handler\ PROC EXPORT UsageFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP DebugMon_Handler\ PROC EXPORT DebugMon_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT WWDG_IRQHandler [WEAK] EXPORT PVD_IRQHandler [WEAK] EXPORT TAMP_STAMP_IRQHandler [WEAK] EXPORT RTC_WKUP_IRQHandler [WEAK] EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_IRQHandler [WEAK] EXPORT EXTI1_IRQHandler [WEAK] EXPORT EXTI2_IRQHandler [WEAK] EXPORT EXTI3_IRQHandler [WEAK] EXPORT EXTI4_IRQHandler [WEAK] EXPORT DMA1_Stream0_IRQHandler [WEAK] EXPORT DMA1_Stream1_IRQHandler [WEAK] EXPORT DMA1_Stream2_IRQHandler [WEAK] EXPORT DMA1_Stream3_IRQHandler [WEAK] EXPORT DMA1_Stream4_IRQHandler [WEAK] EXPORT DMA1_Stream5_IRQHandler [WEAK] EXPORT DMA1_Stream6_IRQHandler [WEAK] EXPORT ADC_IRQHandler [WEAK] EXPORT EXTI9_5_IRQHandler [WEAK] EXPORT TIM1_BRK_TIM9_IRQHandler [WEAK] EXPORT TIM1_UP_IRQHandler [WEAK] EXPORT TIM1_TRG_COM_TIM11_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT I2C1_EV_IRQHandler [WEAK] EXPORT I2C1_ER_IRQHandler [WEAK] EXPORT I2C2_EV_IRQHandler [WEAK] EXPORT I2C2_ER_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] EXPORT USART2_IRQHandler [WEAK] EXPORT EXTI15_10_IRQHandler [WEAK] EXPORT RTC_Alarm_IRQHandler [WEAK] EXPORT DMA1_Stream7_IRQHandler [WEAK] EXPORT TIM5_IRQHandler [WEAK] EXPORT TIM6_DAC_IRQHandler [WEAK] EXPORT DMA2_Stream0_IRQHandler [WEAK] EXPORT DMA2_Stream1_IRQHandler [WEAK] EXPORT DMA2_Stream2_IRQHandler [WEAK] EXPORT DMA2_Stream3_IRQHandler [WEAK] EXPORT DMA2_Stream4_IRQHandler [WEAK] EXPORT DMA2_Stream4_IRQHandler [WEAK] EXPORT DMA2_Stream5_IRQHandler [WEAK] EXPORT DMA2_Stream6_IRQHandler [WEAK] EXPORT DMA2_Stream7_IRQHandler [WEAK] EXPORT RNG_IRQHandler [WEAK] EXPORT FPU_IRQHandler [WEAK] EXPORT FMPI2C1_EV_IRQHandler [WEAK] EXPORT FMPI2C1_ER_IRQHandler [WEAK] EXPORT LPTIM1_IRQHandler [WEAK] WWDG_IRQHandler PVD_IRQHandler TAMP_STAMP_IRQHandler RTC_WKUP_IRQHandler FLASH_IRQHandler RCC_IRQHandler EXTI0_IRQHandler EXTI1_IRQHandler EXTI2_IRQHandler EXTI3_IRQHandler EXTI4_IRQHandler DMA1_Stream0_IRQHandler DMA1_Stream1_IRQHandler DMA1_Stream2_IRQHandler DMA1_Stream3_IRQHandler DMA1_Stream4_IRQHandler DMA1_Stream5_IRQHandler DMA1_Stream6_IRQHandler ADC_IRQHandler EXTI9_5_IRQHandler TIM1_BRK_TIM9_IRQHandler TIM1_UP_IRQHandler TIM1_TRG_COM_TIM11_IRQHandler TIM1_CC_IRQHandler I2C1_EV_IRQHandler I2C1_ER_IRQHandler I2C2_EV_IRQHandler I2C2_ER_IRQHandler SPI1_IRQHandler USART1_IRQHandler USART2_IRQHandler EXTI15_10_IRQHandler RTC_Alarm_IRQHandler DMA1_Stream7_IRQHandler TIM5_IRQHandler TIM6_DAC_IRQHandler DMA2_Stream0_IRQHandler DMA2_Stream1_IRQHandler DMA2_Stream2_IRQHandler DMA2_Stream3_IRQHandler DMA2_Stream4_IRQHandler DMA2_Stream5_IRQHandler DMA2_Stream6_IRQHandler DMA2_Stream7_IRQHandler RNG_IRQHandler FPU_IRQHandler FMPI2C1_EV_IRQHandler FMPI2C1_ER_IRQHandler LPTIM1_IRQHandler B . ENDP ALIGN ;******************************************************************************* ; User Stack and Heap initialization ;******************************************************************************* IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE*****
ms-iot/security
31,237
LimpetMCU/Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/arm/startup_stm32f429xx.s
;******************** (C) COPYRIGHT 2016 STMicroelectronics ******************** ;* File Name : startup_stm32f429xx.s ;* Author : MCD Application Team ;* Version : V2.4.3 ;* Date : 22-January-2016 ;* Description : STM32F429x devices vector table for MDK-ARM 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 CortexM4 processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;* <<< Use Configuration Wizard in Context Menu >>> ;******************************************************************************* ; ;* 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. ; ;******************************************************************************* ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000200 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD MemManage_Handler ; MPU Fault Handler DCD BusFault_Handler ; Bus Fault Handler DCD UsageFault_Handler ; Usage Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD DebugMon_Handler ; Debug Monitor Handler DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD WWDG_IRQHandler ; Window WatchDog DCD PVD_IRQHandler ; PVD through EXTI Line detection DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line DCD RTC_WKUP_IRQHandler ; RTC Wakeup through the EXTI line DCD FLASH_IRQHandler ; FLASH DCD RCC_IRQHandler ; RCC DCD EXTI0_IRQHandler ; EXTI Line0 DCD EXTI1_IRQHandler ; EXTI Line1 DCD EXTI2_IRQHandler ; EXTI Line2 DCD EXTI3_IRQHandler ; EXTI Line3 DCD EXTI4_IRQHandler ; EXTI Line4 DCD DMA1_Stream0_IRQHandler ; DMA1 Stream 0 DCD DMA1_Stream1_IRQHandler ; DMA1 Stream 1 DCD DMA1_Stream2_IRQHandler ; DMA1 Stream 2 DCD DMA1_Stream3_IRQHandler ; DMA1 Stream 3 DCD DMA1_Stream4_IRQHandler ; DMA1 Stream 4 DCD DMA1_Stream5_IRQHandler ; DMA1 Stream 5 DCD DMA1_Stream6_IRQHandler ; DMA1 Stream 6 DCD ADC_IRQHandler ; ADC1, ADC2 and ADC3s DCD CAN1_TX_IRQHandler ; CAN1 TX DCD CAN1_RX0_IRQHandler ; CAN1 RX0 DCD CAN1_RX1_IRQHandler ; CAN1 RX1 DCD CAN1_SCE_IRQHandler ; CAN1 SCE DCD EXTI9_5_IRQHandler ; External Line[9:5]s DCD TIM1_BRK_TIM9_IRQHandler ; TIM1 Break and TIM9 DCD TIM1_UP_TIM10_IRQHandler ; TIM1 Update and TIM10 DCD TIM1_TRG_COM_TIM11_IRQHandler ; TIM1 Trigger and Commutation and TIM11 DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare DCD TIM2_IRQHandler ; TIM2 DCD TIM3_IRQHandler ; TIM3 DCD TIM4_IRQHandler ; TIM4 DCD I2C1_EV_IRQHandler ; I2C1 Event DCD I2C1_ER_IRQHandler ; I2C1 Error DCD I2C2_EV_IRQHandler ; I2C2 Event DCD I2C2_ER_IRQHandler ; I2C2 Error DCD SPI1_IRQHandler ; SPI1 DCD SPI2_IRQHandler ; SPI2 DCD USART1_IRQHandler ; USART1 DCD USART2_IRQHandler ; USART2 DCD USART3_IRQHandler ; USART3 DCD EXTI15_10_IRQHandler ; External Line[15:10]s DCD RTC_Alarm_IRQHandler ; RTC Alarm (A and B) through EXTI Line DCD OTG_FS_WKUP_IRQHandler ; USB OTG FS Wakeup through EXTI line DCD TIM8_BRK_TIM12_IRQHandler ; TIM8 Break and TIM12 DCD TIM8_UP_TIM13_IRQHandler ; TIM8 Update and TIM13 DCD TIM8_TRG_COM_TIM14_IRQHandler ; TIM8 Trigger and Commutation and TIM14 DCD TIM8_CC_IRQHandler ; TIM8 Capture Compare DCD DMA1_Stream7_IRQHandler ; DMA1 Stream7 DCD FMC_IRQHandler ; FMC DCD SDIO_IRQHandler ; SDIO DCD TIM5_IRQHandler ; TIM5 DCD SPI3_IRQHandler ; SPI3 DCD UART4_IRQHandler ; UART4 DCD UART5_IRQHandler ; UART5 DCD TIM6_DAC_IRQHandler ; TIM6 and DAC1&2 underrun errors DCD TIM7_IRQHandler ; TIM7 DCD DMA2_Stream0_IRQHandler ; DMA2 Stream 0 DCD DMA2_Stream1_IRQHandler ; DMA2 Stream 1 DCD DMA2_Stream2_IRQHandler ; DMA2 Stream 2 DCD DMA2_Stream3_IRQHandler ; DMA2 Stream 3 DCD DMA2_Stream4_IRQHandler ; DMA2 Stream 4 DCD ETH_IRQHandler ; Ethernet DCD ETH_WKUP_IRQHandler ; Ethernet Wakeup through EXTI line DCD CAN2_TX_IRQHandler ; CAN2 TX DCD CAN2_RX0_IRQHandler ; CAN2 RX0 DCD CAN2_RX1_IRQHandler ; CAN2 RX1 DCD CAN2_SCE_IRQHandler ; CAN2 SCE DCD OTG_FS_IRQHandler ; USB OTG FS DCD DMA2_Stream5_IRQHandler ; DMA2 Stream 5 DCD DMA2_Stream6_IRQHandler ; DMA2 Stream 6 DCD DMA2_Stream7_IRQHandler ; DMA2 Stream 7 DCD USART6_IRQHandler ; USART6 DCD I2C3_EV_IRQHandler ; I2C3 event DCD I2C3_ER_IRQHandler ; I2C3 error DCD OTG_HS_EP1_OUT_IRQHandler ; USB OTG HS End Point 1 Out DCD OTG_HS_EP1_IN_IRQHandler ; USB OTG HS End Point 1 In DCD OTG_HS_WKUP_IRQHandler ; USB OTG HS Wakeup through EXTI DCD OTG_HS_IRQHandler ; USB OTG HS DCD DCMI_IRQHandler ; DCMI DCD 0 ; Reserved DCD HASH_RNG_IRQHandler ; Hash and Rng DCD FPU_IRQHandler ; FPU DCD UART7_IRQHandler ; UART7 DCD UART8_IRQHandler ; UART8 DCD SPI4_IRQHandler ; SPI4 DCD SPI5_IRQHandler ; SPI5 DCD SPI6_IRQHandler ; SPI6 DCD SAI1_IRQHandler ; SAI1 DCD LTDC_IRQHandler ; LTDC DCD LTDC_ER_IRQHandler ; LTDC error DCD DMA2D_IRQHandler ; DMA2D __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP MemManage_Handler\ PROC EXPORT MemManage_Handler [WEAK] B . ENDP BusFault_Handler\ PROC EXPORT BusFault_Handler [WEAK] B . ENDP UsageFault_Handler\ PROC EXPORT UsageFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP DebugMon_Handler\ PROC EXPORT DebugMon_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT WWDG_IRQHandler [WEAK] EXPORT PVD_IRQHandler [WEAK] EXPORT TAMP_STAMP_IRQHandler [WEAK] EXPORT RTC_WKUP_IRQHandler [WEAK] EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_IRQHandler [WEAK] EXPORT EXTI1_IRQHandler [WEAK] EXPORT EXTI2_IRQHandler [WEAK] EXPORT EXTI3_IRQHandler [WEAK] EXPORT EXTI4_IRQHandler [WEAK] EXPORT DMA1_Stream0_IRQHandler [WEAK] EXPORT DMA1_Stream1_IRQHandler [WEAK] EXPORT DMA1_Stream2_IRQHandler [WEAK] EXPORT DMA1_Stream3_IRQHandler [WEAK] EXPORT DMA1_Stream4_IRQHandler [WEAK] EXPORT DMA1_Stream5_IRQHandler [WEAK] EXPORT DMA1_Stream6_IRQHandler [WEAK] EXPORT ADC_IRQHandler [WEAK] EXPORT CAN1_TX_IRQHandler [WEAK] EXPORT CAN1_RX0_IRQHandler [WEAK] EXPORT CAN1_RX1_IRQHandler [WEAK] EXPORT CAN1_SCE_IRQHandler [WEAK] EXPORT EXTI9_5_IRQHandler [WEAK] EXPORT TIM1_BRK_TIM9_IRQHandler [WEAK] EXPORT TIM1_UP_TIM10_IRQHandler [WEAK] EXPORT TIM1_TRG_COM_TIM11_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT TIM2_IRQHandler [WEAK] EXPORT TIM3_IRQHandler [WEAK] EXPORT TIM4_IRQHandler [WEAK] EXPORT I2C1_EV_IRQHandler [WEAK] EXPORT I2C1_ER_IRQHandler [WEAK] EXPORT I2C2_EV_IRQHandler [WEAK] EXPORT I2C2_ER_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT SPI2_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] EXPORT USART2_IRQHandler [WEAK] EXPORT USART3_IRQHandler [WEAK] EXPORT EXTI15_10_IRQHandler [WEAK] EXPORT RTC_Alarm_IRQHandler [WEAK] EXPORT OTG_FS_WKUP_IRQHandler [WEAK] EXPORT TIM8_BRK_TIM12_IRQHandler [WEAK] EXPORT TIM8_UP_TIM13_IRQHandler [WEAK] EXPORT TIM8_TRG_COM_TIM14_IRQHandler [WEAK] EXPORT TIM8_CC_IRQHandler [WEAK] EXPORT DMA1_Stream7_IRQHandler [WEAK] EXPORT FMC_IRQHandler [WEAK] EXPORT SDIO_IRQHandler [WEAK] EXPORT TIM5_IRQHandler [WEAK] EXPORT SPI3_IRQHandler [WEAK] EXPORT UART4_IRQHandler [WEAK] EXPORT UART5_IRQHandler [WEAK] EXPORT TIM6_DAC_IRQHandler [WEAK] EXPORT TIM7_IRQHandler [WEAK] EXPORT DMA2_Stream0_IRQHandler [WEAK] EXPORT DMA2_Stream1_IRQHandler [WEAK] EXPORT DMA2_Stream2_IRQHandler [WEAK] EXPORT DMA2_Stream3_IRQHandler [WEAK] EXPORT DMA2_Stream4_IRQHandler [WEAK] EXPORT ETH_IRQHandler [WEAK] EXPORT ETH_WKUP_IRQHandler [WEAK] EXPORT CAN2_TX_IRQHandler [WEAK] EXPORT CAN2_RX0_IRQHandler [WEAK] EXPORT CAN2_RX1_IRQHandler [WEAK] EXPORT CAN2_SCE_IRQHandler [WEAK] EXPORT OTG_FS_IRQHandler [WEAK] EXPORT DMA2_Stream5_IRQHandler [WEAK] EXPORT DMA2_Stream6_IRQHandler [WEAK] EXPORT DMA2_Stream7_IRQHandler [WEAK] EXPORT USART6_IRQHandler [WEAK] EXPORT I2C3_EV_IRQHandler [WEAK] EXPORT I2C3_ER_IRQHandler [WEAK] EXPORT OTG_HS_EP1_OUT_IRQHandler [WEAK] EXPORT OTG_HS_EP1_IN_IRQHandler [WEAK] EXPORT OTG_HS_WKUP_IRQHandler [WEAK] EXPORT OTG_HS_IRQHandler [WEAK] EXPORT DCMI_IRQHandler [WEAK] EXPORT HASH_RNG_IRQHandler [WEAK] EXPORT FPU_IRQHandler [WEAK] EXPORT UART7_IRQHandler [WEAK] EXPORT UART8_IRQHandler [WEAK] EXPORT SPI4_IRQHandler [WEAK] EXPORT SPI5_IRQHandler [WEAK] EXPORT SPI6_IRQHandler [WEAK] EXPORT SAI1_IRQHandler [WEAK] EXPORT LTDC_IRQHandler [WEAK] EXPORT LTDC_ER_IRQHandler [WEAK] EXPORT DMA2D_IRQHandler [WEAK] WWDG_IRQHandler PVD_IRQHandler TAMP_STAMP_IRQHandler RTC_WKUP_IRQHandler FLASH_IRQHandler RCC_IRQHandler EXTI0_IRQHandler EXTI1_IRQHandler EXTI2_IRQHandler EXTI3_IRQHandler EXTI4_IRQHandler DMA1_Stream0_IRQHandler DMA1_Stream1_IRQHandler DMA1_Stream2_IRQHandler DMA1_Stream3_IRQHandler DMA1_Stream4_IRQHandler DMA1_Stream5_IRQHandler DMA1_Stream6_IRQHandler ADC_IRQHandler CAN1_TX_IRQHandler CAN1_RX0_IRQHandler CAN1_RX1_IRQHandler CAN1_SCE_IRQHandler EXTI9_5_IRQHandler TIM1_BRK_TIM9_IRQHandler TIM1_UP_TIM10_IRQHandler TIM1_TRG_COM_TIM11_IRQHandler TIM1_CC_IRQHandler TIM2_IRQHandler TIM3_IRQHandler TIM4_IRQHandler I2C1_EV_IRQHandler I2C1_ER_IRQHandler I2C2_EV_IRQHandler I2C2_ER_IRQHandler SPI1_IRQHandler SPI2_IRQHandler USART1_IRQHandler USART2_IRQHandler USART3_IRQHandler EXTI15_10_IRQHandler RTC_Alarm_IRQHandler OTG_FS_WKUP_IRQHandler TIM8_BRK_TIM12_IRQHandler TIM8_UP_TIM13_IRQHandler TIM8_TRG_COM_TIM14_IRQHandler TIM8_CC_IRQHandler DMA1_Stream7_IRQHandler FMC_IRQHandler SDIO_IRQHandler TIM5_IRQHandler SPI3_IRQHandler UART4_IRQHandler UART5_IRQHandler TIM6_DAC_IRQHandler TIM7_IRQHandler DMA2_Stream0_IRQHandler DMA2_Stream1_IRQHandler DMA2_Stream2_IRQHandler DMA2_Stream3_IRQHandler DMA2_Stream4_IRQHandler ETH_IRQHandler ETH_WKUP_IRQHandler CAN2_TX_IRQHandler CAN2_RX0_IRQHandler CAN2_RX1_IRQHandler CAN2_SCE_IRQHandler OTG_FS_IRQHandler DMA2_Stream5_IRQHandler DMA2_Stream6_IRQHandler DMA2_Stream7_IRQHandler USART6_IRQHandler I2C3_EV_IRQHandler I2C3_ER_IRQHandler OTG_HS_EP1_OUT_IRQHandler OTG_HS_EP1_IN_IRQHandler OTG_HS_WKUP_IRQHandler OTG_HS_IRQHandler DCMI_IRQHandler HASH_RNG_IRQHandler FPU_IRQHandler UART7_IRQHandler UART8_IRQHandler SPI4_IRQHandler SPI5_IRQHandler SPI6_IRQHandler SAI1_IRQHandler LTDC_IRQHandler LTDC_ER_IRQHandler DMA2D_IRQHandler B . ENDP ALIGN ;******************************************************************************* ; User Stack and Heap initialization ;******************************************************************************* IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE*****
ms-iot/security
25,998
LimpetMCU/Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/arm/startup_stm32f401xe.s
;******************** (C) COPYRIGHT 2016 STMicroelectronics ******************** ;* File Name : startup_stm32f401xe.s ;* Author : MCD Application Team ;* Version : V2.4.3 ;* Date : 22-January-2016 ;* Description : STM32F401xe devices vector table for MDK-ARM 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 CortexM4 processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;* <<< Use Configuration Wizard in Context Menu >>> ;******************************************************************************* ; ;* 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. ; ;******************************************************************************* ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000200 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD MemManage_Handler ; MPU Fault Handler DCD BusFault_Handler ; Bus Fault Handler DCD UsageFault_Handler ; Usage Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD DebugMon_Handler ; Debug Monitor Handler DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD WWDG_IRQHandler ; Window WatchDog DCD PVD_IRQHandler ; PVD through EXTI Line detection DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line DCD RTC_WKUP_IRQHandler ; RTC Wakeup through the EXTI line DCD FLASH_IRQHandler ; FLASH DCD RCC_IRQHandler ; RCC DCD EXTI0_IRQHandler ; EXTI Line0 DCD EXTI1_IRQHandler ; EXTI Line1 DCD EXTI2_IRQHandler ; EXTI Line2 DCD EXTI3_IRQHandler ; EXTI Line3 DCD EXTI4_IRQHandler ; EXTI Line4 DCD DMA1_Stream0_IRQHandler ; DMA1 Stream 0 DCD DMA1_Stream1_IRQHandler ; DMA1 Stream 1 DCD DMA1_Stream2_IRQHandler ; DMA1 Stream 2 DCD DMA1_Stream3_IRQHandler ; DMA1 Stream 3 DCD DMA1_Stream4_IRQHandler ; DMA1 Stream 4 DCD DMA1_Stream5_IRQHandler ; DMA1 Stream 5 DCD DMA1_Stream6_IRQHandler ; DMA1 Stream 6 DCD ADC_IRQHandler ; ADC1, ADC2 and ADC3s DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD EXTI9_5_IRQHandler ; External Line[9:5]s DCD TIM1_BRK_TIM9_IRQHandler ; TIM1 Break and TIM9 DCD TIM1_UP_TIM10_IRQHandler ; TIM1 Update and TIM10 DCD TIM1_TRG_COM_TIM11_IRQHandler ; TIM1 Trigger and Commutation and TIM11 DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare DCD TIM2_IRQHandler ; TIM2 DCD TIM3_IRQHandler ; TIM3 DCD TIM4_IRQHandler ; TIM4 DCD I2C1_EV_IRQHandler ; I2C1 Event DCD I2C1_ER_IRQHandler ; I2C1 Error DCD I2C2_EV_IRQHandler ; I2C2 Event DCD I2C2_ER_IRQHandler ; I2C2 Error DCD SPI1_IRQHandler ; SPI1 DCD SPI2_IRQHandler ; SPI2 DCD USART1_IRQHandler ; USART1 DCD USART2_IRQHandler ; USART2 DCD 0 ; Reserved DCD EXTI15_10_IRQHandler ; External Line[15:10]s DCD RTC_Alarm_IRQHandler ; RTC Alarm (A and B) through EXTI Line DCD OTG_FS_WKUP_IRQHandler ; USB OTG FS Wakeup through EXTI line DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD DMA1_Stream7_IRQHandler ; DMA1 Stream7 DCD 0 ; Reserved DCD SDIO_IRQHandler ; SDIO DCD TIM5_IRQHandler ; TIM5 DCD SPI3_IRQHandler ; SPI3 DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD DMA2_Stream0_IRQHandler ; DMA2 Stream 0 DCD DMA2_Stream1_IRQHandler ; DMA2 Stream 1 DCD DMA2_Stream2_IRQHandler ; DMA2 Stream 2 DCD DMA2_Stream3_IRQHandler ; DMA2 Stream 3 DCD DMA2_Stream4_IRQHandler ; DMA2 Stream 4 DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD OTG_FS_IRQHandler ; USB OTG FS DCD DMA2_Stream5_IRQHandler ; DMA2 Stream 5 DCD DMA2_Stream6_IRQHandler ; DMA2 Stream 6 DCD DMA2_Stream7_IRQHandler ; DMA2 Stream 7 DCD USART6_IRQHandler ; USART6 DCD I2C3_EV_IRQHandler ; I2C3 event DCD I2C3_ER_IRQHandler ; I2C3 error DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD FPU_IRQHandler ; FPU DCD 0 ; Reserved DCD 0 ; Reserved DCD SPI4_IRQHandler ; SPI4 __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP MemManage_Handler\ PROC EXPORT MemManage_Handler [WEAK] B . ENDP BusFault_Handler\ PROC EXPORT BusFault_Handler [WEAK] B . ENDP UsageFault_Handler\ PROC EXPORT UsageFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP DebugMon_Handler\ PROC EXPORT DebugMon_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT WWDG_IRQHandler [WEAK] EXPORT PVD_IRQHandler [WEAK] EXPORT TAMP_STAMP_IRQHandler [WEAK] EXPORT RTC_WKUP_IRQHandler [WEAK] EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_IRQHandler [WEAK] EXPORT EXTI1_IRQHandler [WEAK] EXPORT EXTI2_IRQHandler [WEAK] EXPORT EXTI3_IRQHandler [WEAK] EXPORT EXTI4_IRQHandler [WEAK] EXPORT DMA1_Stream0_IRQHandler [WEAK] EXPORT DMA1_Stream1_IRQHandler [WEAK] EXPORT DMA1_Stream2_IRQHandler [WEAK] EXPORT DMA1_Stream3_IRQHandler [WEAK] EXPORT DMA1_Stream4_IRQHandler [WEAK] EXPORT DMA1_Stream5_IRQHandler [WEAK] EXPORT DMA1_Stream6_IRQHandler [WEAK] EXPORT ADC_IRQHandler [WEAK] EXPORT EXTI9_5_IRQHandler [WEAK] EXPORT TIM1_BRK_TIM9_IRQHandler [WEAK] EXPORT TIM1_UP_TIM10_IRQHandler [WEAK] EXPORT TIM1_TRG_COM_TIM11_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT TIM2_IRQHandler [WEAK] EXPORT TIM3_IRQHandler [WEAK] EXPORT TIM4_IRQHandler [WEAK] EXPORT I2C1_EV_IRQHandler [WEAK] EXPORT I2C1_ER_IRQHandler [WEAK] EXPORT I2C2_EV_IRQHandler [WEAK] EXPORT I2C2_ER_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT SPI2_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] EXPORT USART2_IRQHandler [WEAK] EXPORT EXTI15_10_IRQHandler [WEAK] EXPORT RTC_Alarm_IRQHandler [WEAK] EXPORT OTG_FS_WKUP_IRQHandler [WEAK] EXPORT DMA1_Stream7_IRQHandler [WEAK] EXPORT SDIO_IRQHandler [WEAK] EXPORT TIM5_IRQHandler [WEAK] EXPORT SPI3_IRQHandler [WEAK] EXPORT DMA2_Stream0_IRQHandler [WEAK] EXPORT DMA2_Stream1_IRQHandler [WEAK] EXPORT DMA2_Stream2_IRQHandler [WEAK] EXPORT DMA2_Stream3_IRQHandler [WEAK] EXPORT DMA2_Stream4_IRQHandler [WEAK] EXPORT OTG_FS_IRQHandler [WEAK] EXPORT DMA2_Stream5_IRQHandler [WEAK] EXPORT DMA2_Stream6_IRQHandler [WEAK] EXPORT DMA2_Stream7_IRQHandler [WEAK] EXPORT USART6_IRQHandler [WEAK] EXPORT I2C3_EV_IRQHandler [WEAK] EXPORT I2C3_ER_IRQHandler [WEAK] EXPORT FPU_IRQHandler [WEAK] EXPORT SPI4_IRQHandler [WEAK] WWDG_IRQHandler PVD_IRQHandler TAMP_STAMP_IRQHandler RTC_WKUP_IRQHandler FLASH_IRQHandler RCC_IRQHandler EXTI0_IRQHandler EXTI1_IRQHandler EXTI2_IRQHandler EXTI3_IRQHandler EXTI4_IRQHandler DMA1_Stream0_IRQHandler DMA1_Stream1_IRQHandler DMA1_Stream2_IRQHandler DMA1_Stream3_IRQHandler DMA1_Stream4_IRQHandler DMA1_Stream5_IRQHandler DMA1_Stream6_IRQHandler ADC_IRQHandler EXTI9_5_IRQHandler TIM1_BRK_TIM9_IRQHandler TIM1_UP_TIM10_IRQHandler TIM1_TRG_COM_TIM11_IRQHandler TIM1_CC_IRQHandler TIM2_IRQHandler TIM3_IRQHandler TIM4_IRQHandler I2C1_EV_IRQHandler I2C1_ER_IRQHandler I2C2_EV_IRQHandler I2C2_ER_IRQHandler SPI1_IRQHandler SPI2_IRQHandler USART1_IRQHandler USART2_IRQHandler EXTI15_10_IRQHandler RTC_Alarm_IRQHandler OTG_FS_WKUP_IRQHandler DMA1_Stream7_IRQHandler SDIO_IRQHandler TIM5_IRQHandler SPI3_IRQHandler DMA2_Stream0_IRQHandler DMA2_Stream1_IRQHandler DMA2_Stream2_IRQHandler DMA2_Stream3_IRQHandler DMA2_Stream4_IRQHandler OTG_FS_IRQHandler DMA2_Stream5_IRQHandler DMA2_Stream6_IRQHandler DMA2_Stream7_IRQHandler USART6_IRQHandler I2C3_EV_IRQHandler I2C3_ER_IRQHandler FPU_IRQHandler SPI4_IRQHandler B . ENDP ALIGN ;******************************************************************************* ; User Stack and Heap initialization ;******************************************************************************* IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE*****
ms-iot/security
29,675
LimpetMCU/Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/arm/startup_stm32f417xx.s
;******************** (C) COPYRIGHT 2016 STMicroelectronics ******************** ;* File Name : startup_stm32f417xx.s ;* Author : MCD Application Team ;* Version : V2.4.3 ;* Date : 22-January-2016 ;* Description : STM32F417xx devices vector table for MDK-ARM 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 CortexM4 processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;* <<< Use Configuration Wizard in Context Menu >>> ;******************************************************************************* ; ;* 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. ; ;******************************************************************************* ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000200 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD MemManage_Handler ; MPU Fault Handler DCD BusFault_Handler ; Bus Fault Handler DCD UsageFault_Handler ; Usage Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD DebugMon_Handler ; Debug Monitor Handler DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD WWDG_IRQHandler ; Window WatchDog DCD PVD_IRQHandler ; PVD through EXTI Line detection DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line DCD RTC_WKUP_IRQHandler ; RTC Wakeup through the EXTI line DCD FLASH_IRQHandler ; FLASH DCD RCC_IRQHandler ; RCC DCD EXTI0_IRQHandler ; EXTI Line0 DCD EXTI1_IRQHandler ; EXTI Line1 DCD EXTI2_IRQHandler ; EXTI Line2 DCD EXTI3_IRQHandler ; EXTI Line3 DCD EXTI4_IRQHandler ; EXTI Line4 DCD DMA1_Stream0_IRQHandler ; DMA1 Stream 0 DCD DMA1_Stream1_IRQHandler ; DMA1 Stream 1 DCD DMA1_Stream2_IRQHandler ; DMA1 Stream 2 DCD DMA1_Stream3_IRQHandler ; DMA1 Stream 3 DCD DMA1_Stream4_IRQHandler ; DMA1 Stream 4 DCD DMA1_Stream5_IRQHandler ; DMA1 Stream 5 DCD DMA1_Stream6_IRQHandler ; DMA1 Stream 6 DCD ADC_IRQHandler ; ADC1, ADC2 and ADC3s DCD CAN1_TX_IRQHandler ; CAN1 TX DCD CAN1_RX0_IRQHandler ; CAN1 RX0 DCD CAN1_RX1_IRQHandler ; CAN1 RX1 DCD CAN1_SCE_IRQHandler ; CAN1 SCE DCD EXTI9_5_IRQHandler ; External Line[9:5]s DCD TIM1_BRK_TIM9_IRQHandler ; TIM1 Break and TIM9 DCD TIM1_UP_TIM10_IRQHandler ; TIM1 Update and TIM10 DCD TIM1_TRG_COM_TIM11_IRQHandler ; TIM1 Trigger and Commutation and TIM11 DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare DCD TIM2_IRQHandler ; TIM2 DCD TIM3_IRQHandler ; TIM3 DCD TIM4_IRQHandler ; TIM4 DCD I2C1_EV_IRQHandler ; I2C1 Event DCD I2C1_ER_IRQHandler ; I2C1 Error DCD I2C2_EV_IRQHandler ; I2C2 Event DCD I2C2_ER_IRQHandler ; I2C2 Error DCD SPI1_IRQHandler ; SPI1 DCD SPI2_IRQHandler ; SPI2 DCD USART1_IRQHandler ; USART1 DCD USART2_IRQHandler ; USART2 DCD USART3_IRQHandler ; USART3 DCD EXTI15_10_IRQHandler ; External Line[15:10]s DCD RTC_Alarm_IRQHandler ; RTC Alarm (A and B) through EXTI Line DCD OTG_FS_WKUP_IRQHandler ; USB OTG FS Wakeup through EXTI line DCD TIM8_BRK_TIM12_IRQHandler ; TIM8 Break and TIM12 DCD TIM8_UP_TIM13_IRQHandler ; TIM8 Update and TIM13 DCD TIM8_TRG_COM_TIM14_IRQHandler ; TIM8 Trigger and Commutation and TIM14 DCD TIM8_CC_IRQHandler ; TIM8 Capture Compare DCD DMA1_Stream7_IRQHandler ; DMA1 Stream7 DCD FMC_IRQHandler ; FMC DCD SDIO_IRQHandler ; SDIO DCD TIM5_IRQHandler ; TIM5 DCD SPI3_IRQHandler ; SPI3 DCD UART4_IRQHandler ; UART4 DCD UART5_IRQHandler ; UART5 DCD TIM6_DAC_IRQHandler ; TIM6 and DAC1&2 underrun errors DCD TIM7_IRQHandler ; TIM7 DCD DMA2_Stream0_IRQHandler ; DMA2 Stream 0 DCD DMA2_Stream1_IRQHandler ; DMA2 Stream 1 DCD DMA2_Stream2_IRQHandler ; DMA2 Stream 2 DCD DMA2_Stream3_IRQHandler ; DMA2 Stream 3 DCD DMA2_Stream4_IRQHandler ; DMA2 Stream 4 DCD ETH_IRQHandler ; Ethernet DCD ETH_WKUP_IRQHandler ; Ethernet Wakeup through EXTI line DCD CAN2_TX_IRQHandler ; CAN2 TX DCD CAN2_RX0_IRQHandler ; CAN2 RX0 DCD CAN2_RX1_IRQHandler ; CAN2 RX1 DCD CAN2_SCE_IRQHandler ; CAN2 SCE DCD OTG_FS_IRQHandler ; USB OTG FS DCD DMA2_Stream5_IRQHandler ; DMA2 Stream 5 DCD DMA2_Stream6_IRQHandler ; DMA2 Stream 6 DCD DMA2_Stream7_IRQHandler ; DMA2 Stream 7 DCD USART6_IRQHandler ; USART6 DCD I2C3_EV_IRQHandler ; I2C3 event DCD I2C3_ER_IRQHandler ; I2C3 error DCD OTG_HS_EP1_OUT_IRQHandler ; USB OTG HS End Point 1 Out DCD OTG_HS_EP1_IN_IRQHandler ; USB OTG HS End Point 1 In DCD OTG_HS_WKUP_IRQHandler ; USB OTG HS Wakeup through EXTI DCD OTG_HS_IRQHandler ; USB OTG HS DCD DCMI_IRQHandler ; DCMI DCD CRYP_IRQHandler ; CRYPTO DCD HASH_RNG_IRQHandler ; Hash and Rng DCD FPU_IRQHandler ; FPU __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP MemManage_Handler\ PROC EXPORT MemManage_Handler [WEAK] B . ENDP BusFault_Handler\ PROC EXPORT BusFault_Handler [WEAK] B . ENDP UsageFault_Handler\ PROC EXPORT UsageFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP DebugMon_Handler\ PROC EXPORT DebugMon_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT WWDG_IRQHandler [WEAK] EXPORT PVD_IRQHandler [WEAK] EXPORT TAMP_STAMP_IRQHandler [WEAK] EXPORT RTC_WKUP_IRQHandler [WEAK] EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_IRQHandler [WEAK] EXPORT EXTI1_IRQHandler [WEAK] EXPORT EXTI2_IRQHandler [WEAK] EXPORT EXTI3_IRQHandler [WEAK] EXPORT EXTI4_IRQHandler [WEAK] EXPORT DMA1_Stream0_IRQHandler [WEAK] EXPORT DMA1_Stream1_IRQHandler [WEAK] EXPORT DMA1_Stream2_IRQHandler [WEAK] EXPORT DMA1_Stream3_IRQHandler [WEAK] EXPORT DMA1_Stream4_IRQHandler [WEAK] EXPORT DMA1_Stream5_IRQHandler [WEAK] EXPORT DMA1_Stream6_IRQHandler [WEAK] EXPORT ADC_IRQHandler [WEAK] EXPORT CAN1_TX_IRQHandler [WEAK] EXPORT CAN1_RX0_IRQHandler [WEAK] EXPORT CAN1_RX1_IRQHandler [WEAK] EXPORT CAN1_SCE_IRQHandler [WEAK] EXPORT EXTI9_5_IRQHandler [WEAK] EXPORT TIM1_BRK_TIM9_IRQHandler [WEAK] EXPORT TIM1_UP_TIM10_IRQHandler [WEAK] EXPORT TIM1_TRG_COM_TIM11_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT TIM2_IRQHandler [WEAK] EXPORT TIM3_IRQHandler [WEAK] EXPORT TIM4_IRQHandler [WEAK] EXPORT I2C1_EV_IRQHandler [WEAK] EXPORT I2C1_ER_IRQHandler [WEAK] EXPORT I2C2_EV_IRQHandler [WEAK] EXPORT I2C2_ER_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT SPI2_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] EXPORT USART2_IRQHandler [WEAK] EXPORT USART3_IRQHandler [WEAK] EXPORT EXTI15_10_IRQHandler [WEAK] EXPORT RTC_Alarm_IRQHandler [WEAK] EXPORT OTG_FS_WKUP_IRQHandler [WEAK] EXPORT TIM8_BRK_TIM12_IRQHandler [WEAK] EXPORT TIM8_UP_TIM13_IRQHandler [WEAK] EXPORT TIM8_TRG_COM_TIM14_IRQHandler [WEAK] EXPORT TIM8_CC_IRQHandler [WEAK] EXPORT DMA1_Stream7_IRQHandler [WEAK] EXPORT FMC_IRQHandler [WEAK] EXPORT SDIO_IRQHandler [WEAK] EXPORT TIM5_IRQHandler [WEAK] EXPORT SPI3_IRQHandler [WEAK] EXPORT UART4_IRQHandler [WEAK] EXPORT UART5_IRQHandler [WEAK] EXPORT TIM6_DAC_IRQHandler [WEAK] EXPORT TIM7_IRQHandler [WEAK] EXPORT DMA2_Stream0_IRQHandler [WEAK] EXPORT DMA2_Stream1_IRQHandler [WEAK] EXPORT DMA2_Stream2_IRQHandler [WEAK] EXPORT DMA2_Stream3_IRQHandler [WEAK] EXPORT DMA2_Stream4_IRQHandler [WEAK] EXPORT ETH_IRQHandler [WEAK] EXPORT ETH_WKUP_IRQHandler [WEAK] EXPORT CAN2_TX_IRQHandler [WEAK] EXPORT CAN2_RX0_IRQHandler [WEAK] EXPORT CAN2_RX1_IRQHandler [WEAK] EXPORT CAN2_SCE_IRQHandler [WEAK] EXPORT OTG_FS_IRQHandler [WEAK] EXPORT DMA2_Stream5_IRQHandler [WEAK] EXPORT DMA2_Stream6_IRQHandler [WEAK] EXPORT DMA2_Stream7_IRQHandler [WEAK] EXPORT USART6_IRQHandler [WEAK] EXPORT I2C3_EV_IRQHandler [WEAK] EXPORT I2C3_ER_IRQHandler [WEAK] EXPORT OTG_HS_EP1_OUT_IRQHandler [WEAK] EXPORT OTG_HS_EP1_IN_IRQHandler [WEAK] EXPORT OTG_HS_WKUP_IRQHandler [WEAK] EXPORT OTG_HS_IRQHandler [WEAK] EXPORT DCMI_IRQHandler [WEAK] EXPORT CRYP_IRQHandler [WEAK] EXPORT HASH_RNG_IRQHandler [WEAK] EXPORT FPU_IRQHandler [WEAK] WWDG_IRQHandler PVD_IRQHandler TAMP_STAMP_IRQHandler RTC_WKUP_IRQHandler FLASH_IRQHandler RCC_IRQHandler EXTI0_IRQHandler EXTI1_IRQHandler EXTI2_IRQHandler EXTI3_IRQHandler EXTI4_IRQHandler DMA1_Stream0_IRQHandler DMA1_Stream1_IRQHandler DMA1_Stream2_IRQHandler DMA1_Stream3_IRQHandler DMA1_Stream4_IRQHandler DMA1_Stream5_IRQHandler DMA1_Stream6_IRQHandler ADC_IRQHandler CAN1_TX_IRQHandler CAN1_RX0_IRQHandler CAN1_RX1_IRQHandler CAN1_SCE_IRQHandler EXTI9_5_IRQHandler TIM1_BRK_TIM9_IRQHandler TIM1_UP_TIM10_IRQHandler TIM1_TRG_COM_TIM11_IRQHandler TIM1_CC_IRQHandler TIM2_IRQHandler TIM3_IRQHandler TIM4_IRQHandler I2C1_EV_IRQHandler I2C1_ER_IRQHandler I2C2_EV_IRQHandler I2C2_ER_IRQHandler SPI1_IRQHandler SPI2_IRQHandler USART1_IRQHandler USART2_IRQHandler USART3_IRQHandler EXTI15_10_IRQHandler RTC_Alarm_IRQHandler OTG_FS_WKUP_IRQHandler TIM8_BRK_TIM12_IRQHandler TIM8_UP_TIM13_IRQHandler TIM8_TRG_COM_TIM14_IRQHandler TIM8_CC_IRQHandler DMA1_Stream7_IRQHandler FMC_IRQHandler SDIO_IRQHandler TIM5_IRQHandler SPI3_IRQHandler UART4_IRQHandler UART5_IRQHandler TIM6_DAC_IRQHandler TIM7_IRQHandler DMA2_Stream0_IRQHandler DMA2_Stream1_IRQHandler DMA2_Stream2_IRQHandler DMA2_Stream3_IRQHandler DMA2_Stream4_IRQHandler ETH_IRQHandler ETH_WKUP_IRQHandler CAN2_TX_IRQHandler CAN2_RX0_IRQHandler CAN2_RX1_IRQHandler CAN2_SCE_IRQHandler OTG_FS_IRQHandler DMA2_Stream5_IRQHandler DMA2_Stream6_IRQHandler DMA2_Stream7_IRQHandler USART6_IRQHandler I2C3_EV_IRQHandler I2C3_ER_IRQHandler OTG_HS_EP1_OUT_IRQHandler OTG_HS_EP1_IN_IRQHandler OTG_HS_WKUP_IRQHandler OTG_HS_IRQHandler DCMI_IRQHandler CRYP_IRQHandler HASH_RNG_IRQHandler FPU_IRQHandler B . ENDP ALIGN ;******************************************************************************* ; User Stack and Heap initialization ;******************************************************************************* IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE*****
ms-iot/security
30,942
LimpetMCU/Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/arm/startup_stm32f437xx.s
;******************** (C) COPYRIGHT 2016 STMicroelectronics ******************** ;* File Name : startup_stm32f437xx.s ;* Author : MCD Application Team ;* Version : V2.4.3 ;* Date : 22-January-2016 ;* Description : STM32F437x devices vector table for MDK-ARM 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 CortexM4 processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;* <<< Use Configuration Wizard in Context Menu >>> ;******************************************************************************* ; ;* 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. ; ;******************************************************************************* ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000200 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD MemManage_Handler ; MPU Fault Handler DCD BusFault_Handler ; Bus Fault Handler DCD UsageFault_Handler ; Usage Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD DebugMon_Handler ; Debug Monitor Handler DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD WWDG_IRQHandler ; Window WatchDog DCD PVD_IRQHandler ; PVD through EXTI Line detection DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line DCD RTC_WKUP_IRQHandler ; RTC Wakeup through the EXTI line DCD FLASH_IRQHandler ; FLASH DCD RCC_IRQHandler ; RCC DCD EXTI0_IRQHandler ; EXTI Line0 DCD EXTI1_IRQHandler ; EXTI Line1 DCD EXTI2_IRQHandler ; EXTI Line2 DCD EXTI3_IRQHandler ; EXTI Line3 DCD EXTI4_IRQHandler ; EXTI Line4 DCD DMA1_Stream0_IRQHandler ; DMA1 Stream 0 DCD DMA1_Stream1_IRQHandler ; DMA1 Stream 1 DCD DMA1_Stream2_IRQHandler ; DMA1 Stream 2 DCD DMA1_Stream3_IRQHandler ; DMA1 Stream 3 DCD DMA1_Stream4_IRQHandler ; DMA1 Stream 4 DCD DMA1_Stream5_IRQHandler ; DMA1 Stream 5 DCD DMA1_Stream6_IRQHandler ; DMA1 Stream 6 DCD ADC_IRQHandler ; ADC1, ADC2 and ADC3s DCD CAN1_TX_IRQHandler ; CAN1 TX DCD CAN1_RX0_IRQHandler ; CAN1 RX0 DCD CAN1_RX1_IRQHandler ; CAN1 RX1 DCD CAN1_SCE_IRQHandler ; CAN1 SCE DCD EXTI9_5_IRQHandler ; External Line[9:5]s DCD TIM1_BRK_TIM9_IRQHandler ; TIM1 Break and TIM9 DCD TIM1_UP_TIM10_IRQHandler ; TIM1 Update and TIM10 DCD TIM1_TRG_COM_TIM11_IRQHandler ; TIM1 Trigger and Commutation and TIM11 DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare DCD TIM2_IRQHandler ; TIM2 DCD TIM3_IRQHandler ; TIM3 DCD TIM4_IRQHandler ; TIM4 DCD I2C1_EV_IRQHandler ; I2C1 Event DCD I2C1_ER_IRQHandler ; I2C1 Error DCD I2C2_EV_IRQHandler ; I2C2 Event DCD I2C2_ER_IRQHandler ; I2C2 Error DCD SPI1_IRQHandler ; SPI1 DCD SPI2_IRQHandler ; SPI2 DCD USART1_IRQHandler ; USART1 DCD USART2_IRQHandler ; USART2 DCD USART3_IRQHandler ; USART3 DCD EXTI15_10_IRQHandler ; External Line[15:10]s DCD RTC_Alarm_IRQHandler ; RTC Alarm (A and B) through EXTI Line DCD OTG_FS_WKUP_IRQHandler ; USB OTG FS Wakeup through EXTI line DCD TIM8_BRK_TIM12_IRQHandler ; TIM8 Break and TIM12 DCD TIM8_UP_TIM13_IRQHandler ; TIM8 Update and TIM13 DCD TIM8_TRG_COM_TIM14_IRQHandler ; TIM8 Trigger and Commutation and TIM14 DCD TIM8_CC_IRQHandler ; TIM8 Capture Compare DCD DMA1_Stream7_IRQHandler ; DMA1 Stream7 DCD FMC_IRQHandler ; FMC DCD SDIO_IRQHandler ; SDIO DCD TIM5_IRQHandler ; TIM5 DCD SPI3_IRQHandler ; SPI3 DCD UART4_IRQHandler ; UART4 DCD UART5_IRQHandler ; UART5 DCD TIM6_DAC_IRQHandler ; TIM6 and DAC1&2 underrun errors DCD TIM7_IRQHandler ; TIM7 DCD DMA2_Stream0_IRQHandler ; DMA2 Stream 0 DCD DMA2_Stream1_IRQHandler ; DMA2 Stream 1 DCD DMA2_Stream2_IRQHandler ; DMA2 Stream 2 DCD DMA2_Stream3_IRQHandler ; DMA2 Stream 3 DCD DMA2_Stream4_IRQHandler ; DMA2 Stream 4 DCD ETH_IRQHandler ; Ethernet DCD ETH_WKUP_IRQHandler ; Ethernet Wakeup through EXTI line DCD CAN2_TX_IRQHandler ; CAN2 TX DCD CAN2_RX0_IRQHandler ; CAN2 RX0 DCD CAN2_RX1_IRQHandler ; CAN2 RX1 DCD CAN2_SCE_IRQHandler ; CAN2 SCE DCD OTG_FS_IRQHandler ; USB OTG FS DCD DMA2_Stream5_IRQHandler ; DMA2 Stream 5 DCD DMA2_Stream6_IRQHandler ; DMA2 Stream 6 DCD DMA2_Stream7_IRQHandler ; DMA2 Stream 7 DCD USART6_IRQHandler ; USART6 DCD I2C3_EV_IRQHandler ; I2C3 event DCD I2C3_ER_IRQHandler ; I2C3 error DCD OTG_HS_EP1_OUT_IRQHandler ; USB OTG HS End Point 1 Out DCD OTG_HS_EP1_IN_IRQHandler ; USB OTG HS End Point 1 In DCD OTG_HS_WKUP_IRQHandler ; USB OTG HS Wakeup through EXTI DCD OTG_HS_IRQHandler ; USB OTG HS DCD DCMI_IRQHandler ; DCMI DCD CRYP_IRQHandler ; CRYPTO DCD HASH_RNG_IRQHandler ; Hash and Rng DCD FPU_IRQHandler ; FPU DCD UART7_IRQHandler ; UART7 DCD UART8_IRQHandler ; UART8 DCD SPI4_IRQHandler ; SPI4 DCD SPI5_IRQHandler ; SPI5 DCD SPI6_IRQHandler ; SPI6 DCD SAI1_IRQHandler ; SAI1 DCD 0 ; Reserved DCD 0 ; Reserved DCD DMA2D_IRQHandler ; DMA2D __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP MemManage_Handler\ PROC EXPORT MemManage_Handler [WEAK] B . ENDP BusFault_Handler\ PROC EXPORT BusFault_Handler [WEAK] B . ENDP UsageFault_Handler\ PROC EXPORT UsageFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP DebugMon_Handler\ PROC EXPORT DebugMon_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT WWDG_IRQHandler [WEAK] EXPORT PVD_IRQHandler [WEAK] EXPORT TAMP_STAMP_IRQHandler [WEAK] EXPORT RTC_WKUP_IRQHandler [WEAK] EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_IRQHandler [WEAK] EXPORT EXTI1_IRQHandler [WEAK] EXPORT EXTI2_IRQHandler [WEAK] EXPORT EXTI3_IRQHandler [WEAK] EXPORT EXTI4_IRQHandler [WEAK] EXPORT DMA1_Stream0_IRQHandler [WEAK] EXPORT DMA1_Stream1_IRQHandler [WEAK] EXPORT DMA1_Stream2_IRQHandler [WEAK] EXPORT DMA1_Stream3_IRQHandler [WEAK] EXPORT DMA1_Stream4_IRQHandler [WEAK] EXPORT DMA1_Stream5_IRQHandler [WEAK] EXPORT DMA1_Stream6_IRQHandler [WEAK] EXPORT ADC_IRQHandler [WEAK] EXPORT CAN1_TX_IRQHandler [WEAK] EXPORT CAN1_RX0_IRQHandler [WEAK] EXPORT CAN1_RX1_IRQHandler [WEAK] EXPORT CAN1_SCE_IRQHandler [WEAK] EXPORT EXTI9_5_IRQHandler [WEAK] EXPORT TIM1_BRK_TIM9_IRQHandler [WEAK] EXPORT TIM1_UP_TIM10_IRQHandler [WEAK] EXPORT TIM1_TRG_COM_TIM11_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT TIM2_IRQHandler [WEAK] EXPORT TIM3_IRQHandler [WEAK] EXPORT TIM4_IRQHandler [WEAK] EXPORT I2C1_EV_IRQHandler [WEAK] EXPORT I2C1_ER_IRQHandler [WEAK] EXPORT I2C2_EV_IRQHandler [WEAK] EXPORT I2C2_ER_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT SPI2_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] EXPORT USART2_IRQHandler [WEAK] EXPORT USART3_IRQHandler [WEAK] EXPORT EXTI15_10_IRQHandler [WEAK] EXPORT RTC_Alarm_IRQHandler [WEAK] EXPORT OTG_FS_WKUP_IRQHandler [WEAK] EXPORT TIM8_BRK_TIM12_IRQHandler [WEAK] EXPORT TIM8_UP_TIM13_IRQHandler [WEAK] EXPORT TIM8_TRG_COM_TIM14_IRQHandler [WEAK] EXPORT TIM8_CC_IRQHandler [WEAK] EXPORT DMA1_Stream7_IRQHandler [WEAK] EXPORT FMC_IRQHandler [WEAK] EXPORT SDIO_IRQHandler [WEAK] EXPORT TIM5_IRQHandler [WEAK] EXPORT SPI3_IRQHandler [WEAK] EXPORT UART4_IRQHandler [WEAK] EXPORT UART5_IRQHandler [WEAK] EXPORT TIM6_DAC_IRQHandler [WEAK] EXPORT TIM7_IRQHandler [WEAK] EXPORT DMA2_Stream0_IRQHandler [WEAK] EXPORT DMA2_Stream1_IRQHandler [WEAK] EXPORT DMA2_Stream2_IRQHandler [WEAK] EXPORT DMA2_Stream3_IRQHandler [WEAK] EXPORT DMA2_Stream4_IRQHandler [WEAK] EXPORT ETH_IRQHandler [WEAK] EXPORT ETH_WKUP_IRQHandler [WEAK] EXPORT CAN2_TX_IRQHandler [WEAK] EXPORT CAN2_RX0_IRQHandler [WEAK] EXPORT CAN2_RX1_IRQHandler [WEAK] EXPORT CAN2_SCE_IRQHandler [WEAK] EXPORT OTG_FS_IRQHandler [WEAK] EXPORT DMA2_Stream5_IRQHandler [WEAK] EXPORT DMA2_Stream6_IRQHandler [WEAK] EXPORT DMA2_Stream7_IRQHandler [WEAK] EXPORT USART6_IRQHandler [WEAK] EXPORT I2C3_EV_IRQHandler [WEAK] EXPORT I2C3_ER_IRQHandler [WEAK] EXPORT OTG_HS_EP1_OUT_IRQHandler [WEAK] EXPORT OTG_HS_EP1_IN_IRQHandler [WEAK] EXPORT OTG_HS_WKUP_IRQHandler [WEAK] EXPORT OTG_HS_IRQHandler [WEAK] EXPORT DCMI_IRQHandler [WEAK] EXPORT CRYP_IRQHandler [WEAK] EXPORT HASH_RNG_IRQHandler [WEAK] EXPORT FPU_IRQHandler [WEAK] EXPORT UART7_IRQHandler [WEAK] EXPORT UART8_IRQHandler [WEAK] EXPORT SPI4_IRQHandler [WEAK] EXPORT SPI5_IRQHandler [WEAK] EXPORT SPI6_IRQHandler [WEAK] EXPORT SAI1_IRQHandler [WEAK] EXPORT DMA2D_IRQHandler [WEAK] WWDG_IRQHandler PVD_IRQHandler TAMP_STAMP_IRQHandler RTC_WKUP_IRQHandler FLASH_IRQHandler RCC_IRQHandler EXTI0_IRQHandler EXTI1_IRQHandler EXTI2_IRQHandler EXTI3_IRQHandler EXTI4_IRQHandler DMA1_Stream0_IRQHandler DMA1_Stream1_IRQHandler DMA1_Stream2_IRQHandler DMA1_Stream3_IRQHandler DMA1_Stream4_IRQHandler DMA1_Stream5_IRQHandler DMA1_Stream6_IRQHandler ADC_IRQHandler CAN1_TX_IRQHandler CAN1_RX0_IRQHandler CAN1_RX1_IRQHandler CAN1_SCE_IRQHandler EXTI9_5_IRQHandler TIM1_BRK_TIM9_IRQHandler TIM1_UP_TIM10_IRQHandler TIM1_TRG_COM_TIM11_IRQHandler TIM1_CC_IRQHandler TIM2_IRQHandler TIM3_IRQHandler TIM4_IRQHandler I2C1_EV_IRQHandler I2C1_ER_IRQHandler I2C2_EV_IRQHandler I2C2_ER_IRQHandler SPI1_IRQHandler SPI2_IRQHandler USART1_IRQHandler USART2_IRQHandler USART3_IRQHandler EXTI15_10_IRQHandler RTC_Alarm_IRQHandler OTG_FS_WKUP_IRQHandler TIM8_BRK_TIM12_IRQHandler TIM8_UP_TIM13_IRQHandler TIM8_TRG_COM_TIM14_IRQHandler TIM8_CC_IRQHandler DMA1_Stream7_IRQHandler FMC_IRQHandler SDIO_IRQHandler TIM5_IRQHandler SPI3_IRQHandler UART4_IRQHandler UART5_IRQHandler TIM6_DAC_IRQHandler TIM7_IRQHandler DMA2_Stream0_IRQHandler DMA2_Stream1_IRQHandler DMA2_Stream2_IRQHandler DMA2_Stream3_IRQHandler DMA2_Stream4_IRQHandler ETH_IRQHandler ETH_WKUP_IRQHandler CAN2_TX_IRQHandler CAN2_RX0_IRQHandler CAN2_RX1_IRQHandler CAN2_SCE_IRQHandler OTG_FS_IRQHandler DMA2_Stream5_IRQHandler DMA2_Stream6_IRQHandler DMA2_Stream7_IRQHandler USART6_IRQHandler I2C3_EV_IRQHandler I2C3_ER_IRQHandler OTG_HS_EP1_OUT_IRQHandler OTG_HS_EP1_IN_IRQHandler OTG_HS_WKUP_IRQHandler OTG_HS_IRQHandler DCMI_IRQHandler CRYP_IRQHandler HASH_RNG_IRQHandler FPU_IRQHandler UART7_IRQHandler UART8_IRQHandler SPI4_IRQHandler SPI5_IRQHandler SPI6_IRQHandler SAI1_IRQHandler DMA2D_IRQHandler B . ENDP ALIGN ;******************************************************************************* ; User Stack and Heap initialization ;******************************************************************************* IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE*****
ms-iot/security
29,795
LimpetMCU/Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/arm/startup_stm32f407xx.s
;******************** (C) COPYRIGHT 2016 STMicroelectronics ******************** ;* File Name : startup_stm32f407xx.s ;* Author : MCD Application Team ;* Version : V2.4.3 ;* Date : 22-January-2016 ;* Description : STM32F407xx devices vector table for MDK-ARM 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 CortexM4 processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;* <<< Use Configuration Wizard in Context Menu >>> ;******************************************************************************* ; ;* 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. ; ;******************************************************************************* ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000200 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD MemManage_Handler ; MPU Fault Handler DCD BusFault_Handler ; Bus Fault Handler DCD UsageFault_Handler ; Usage Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD DebugMon_Handler ; Debug Monitor Handler DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD WWDG_IRQHandler ; Window WatchDog DCD PVD_IRQHandler ; PVD through EXTI Line detection DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line DCD RTC_WKUP_IRQHandler ; RTC Wakeup through the EXTI line DCD FLASH_IRQHandler ; FLASH DCD RCC_IRQHandler ; RCC DCD EXTI0_IRQHandler ; EXTI Line0 DCD EXTI1_IRQHandler ; EXTI Line1 DCD EXTI2_IRQHandler ; EXTI Line2 DCD EXTI3_IRQHandler ; EXTI Line3 DCD EXTI4_IRQHandler ; EXTI Line4 DCD DMA1_Stream0_IRQHandler ; DMA1 Stream 0 DCD DMA1_Stream1_IRQHandler ; DMA1 Stream 1 DCD DMA1_Stream2_IRQHandler ; DMA1 Stream 2 DCD DMA1_Stream3_IRQHandler ; DMA1 Stream 3 DCD DMA1_Stream4_IRQHandler ; DMA1 Stream 4 DCD DMA1_Stream5_IRQHandler ; DMA1 Stream 5 DCD DMA1_Stream6_IRQHandler ; DMA1 Stream 6 DCD ADC_IRQHandler ; ADC1, ADC2 and ADC3s DCD CAN1_TX_IRQHandler ; CAN1 TX DCD CAN1_RX0_IRQHandler ; CAN1 RX0 DCD CAN1_RX1_IRQHandler ; CAN1 RX1 DCD CAN1_SCE_IRQHandler ; CAN1 SCE DCD EXTI9_5_IRQHandler ; External Line[9:5]s DCD TIM1_BRK_TIM9_IRQHandler ; TIM1 Break and TIM9 DCD TIM1_UP_TIM10_IRQHandler ; TIM1 Update and TIM10 DCD TIM1_TRG_COM_TIM11_IRQHandler ; TIM1 Trigger and Commutation and TIM11 DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare DCD TIM2_IRQHandler ; TIM2 DCD TIM3_IRQHandler ; TIM3 DCD TIM4_IRQHandler ; TIM4 DCD I2C1_EV_IRQHandler ; I2C1 Event DCD I2C1_ER_IRQHandler ; I2C1 Error DCD I2C2_EV_IRQHandler ; I2C2 Event DCD I2C2_ER_IRQHandler ; I2C2 Error DCD SPI1_IRQHandler ; SPI1 DCD SPI2_IRQHandler ; SPI2 DCD USART1_IRQHandler ; USART1 DCD USART2_IRQHandler ; USART2 DCD USART3_IRQHandler ; USART3 DCD EXTI15_10_IRQHandler ; External Line[15:10]s DCD RTC_Alarm_IRQHandler ; RTC Alarm (A and B) through EXTI Line DCD OTG_FS_WKUP_IRQHandler ; USB OTG FS Wakeup through EXTI line DCD TIM8_BRK_TIM12_IRQHandler ; TIM8 Break and TIM12 DCD TIM8_UP_TIM13_IRQHandler ; TIM8 Update and TIM13 DCD TIM8_TRG_COM_TIM14_IRQHandler ; TIM8 Trigger and Commutation and TIM14 DCD TIM8_CC_IRQHandler ; TIM8 Capture Compare DCD DMA1_Stream7_IRQHandler ; DMA1 Stream7 DCD FMC_IRQHandler ; FMC DCD SDIO_IRQHandler ; SDIO DCD TIM5_IRQHandler ; TIM5 DCD SPI3_IRQHandler ; SPI3 DCD UART4_IRQHandler ; UART4 DCD UART5_IRQHandler ; UART5 DCD TIM6_DAC_IRQHandler ; TIM6 and DAC1&2 underrun errors DCD TIM7_IRQHandler ; TIM7 DCD DMA2_Stream0_IRQHandler ; DMA2 Stream 0 DCD DMA2_Stream1_IRQHandler ; DMA2 Stream 1 DCD DMA2_Stream2_IRQHandler ; DMA2 Stream 2 DCD DMA2_Stream3_IRQHandler ; DMA2 Stream 3 DCD DMA2_Stream4_IRQHandler ; DMA2 Stream 4 DCD ETH_IRQHandler ; Ethernet DCD ETH_WKUP_IRQHandler ; Ethernet Wakeup through EXTI line DCD CAN2_TX_IRQHandler ; CAN2 TX DCD CAN2_RX0_IRQHandler ; CAN2 RX0 DCD CAN2_RX1_IRQHandler ; CAN2 RX1 DCD CAN2_SCE_IRQHandler ; CAN2 SCE DCD OTG_FS_IRQHandler ; USB OTG FS DCD DMA2_Stream5_IRQHandler ; DMA2 Stream 5 DCD DMA2_Stream6_IRQHandler ; DMA2 Stream 6 DCD DMA2_Stream7_IRQHandler ; DMA2 Stream 7 DCD USART6_IRQHandler ; USART6 DCD I2C3_EV_IRQHandler ; I2C3 event DCD I2C3_ER_IRQHandler ; I2C3 error DCD OTG_HS_EP1_OUT_IRQHandler ; USB OTG HS End Point 1 Out DCD OTG_HS_EP1_IN_IRQHandler ; USB OTG HS End Point 1 In DCD OTG_HS_WKUP_IRQHandler ; USB OTG HS Wakeup through EXTI DCD OTG_HS_IRQHandler ; USB OTG HS DCD DCMI_IRQHandler ; DCMI DCD 0 ; Reserved DCD HASH_RNG_IRQHandler ; Hash and Rng DCD FPU_IRQHandler ; FPU __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP MemManage_Handler\ PROC EXPORT MemManage_Handler [WEAK] B . ENDP BusFault_Handler\ PROC EXPORT BusFault_Handler [WEAK] B . ENDP UsageFault_Handler\ PROC EXPORT UsageFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP DebugMon_Handler\ PROC EXPORT DebugMon_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT WWDG_IRQHandler [WEAK] EXPORT PVD_IRQHandler [WEAK] EXPORT TAMP_STAMP_IRQHandler [WEAK] EXPORT RTC_WKUP_IRQHandler [WEAK] EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_IRQHandler [WEAK] EXPORT EXTI1_IRQHandler [WEAK] EXPORT EXTI2_IRQHandler [WEAK] EXPORT EXTI3_IRQHandler [WEAK] EXPORT EXTI4_IRQHandler [WEAK] EXPORT DMA1_Stream0_IRQHandler [WEAK] EXPORT DMA1_Stream1_IRQHandler [WEAK] EXPORT DMA1_Stream2_IRQHandler [WEAK] EXPORT DMA1_Stream3_IRQHandler [WEAK] EXPORT DMA1_Stream4_IRQHandler [WEAK] EXPORT DMA1_Stream5_IRQHandler [WEAK] EXPORT DMA1_Stream6_IRQHandler [WEAK] EXPORT ADC_IRQHandler [WEAK] EXPORT CAN1_TX_IRQHandler [WEAK] EXPORT CAN1_RX0_IRQHandler [WEAK] EXPORT CAN1_RX1_IRQHandler [WEAK] EXPORT CAN1_SCE_IRQHandler [WEAK] EXPORT EXTI9_5_IRQHandler [WEAK] EXPORT TIM1_BRK_TIM9_IRQHandler [WEAK] EXPORT TIM1_UP_TIM10_IRQHandler [WEAK] EXPORT TIM1_TRG_COM_TIM11_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT TIM2_IRQHandler [WEAK] EXPORT TIM3_IRQHandler [WEAK] EXPORT TIM4_IRQHandler [WEAK] EXPORT I2C1_EV_IRQHandler [WEAK] EXPORT I2C1_ER_IRQHandler [WEAK] EXPORT I2C2_EV_IRQHandler [WEAK] EXPORT I2C2_ER_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT SPI2_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] EXPORT USART2_IRQHandler [WEAK] EXPORT USART3_IRQHandler [WEAK] EXPORT EXTI15_10_IRQHandler [WEAK] EXPORT RTC_Alarm_IRQHandler [WEAK] EXPORT OTG_FS_WKUP_IRQHandler [WEAK] EXPORT TIM8_BRK_TIM12_IRQHandler [WEAK] EXPORT TIM8_UP_TIM13_IRQHandler [WEAK] EXPORT TIM8_TRG_COM_TIM14_IRQHandler [WEAK] EXPORT TIM8_CC_IRQHandler [WEAK] EXPORT DMA1_Stream7_IRQHandler [WEAK] EXPORT FMC_IRQHandler [WEAK] EXPORT SDIO_IRQHandler [WEAK] EXPORT TIM5_IRQHandler [WEAK] EXPORT SPI3_IRQHandler [WEAK] EXPORT UART4_IRQHandler [WEAK] EXPORT UART5_IRQHandler [WEAK] EXPORT TIM6_DAC_IRQHandler [WEAK] EXPORT TIM7_IRQHandler [WEAK] EXPORT DMA2_Stream0_IRQHandler [WEAK] EXPORT DMA2_Stream1_IRQHandler [WEAK] EXPORT DMA2_Stream2_IRQHandler [WEAK] EXPORT DMA2_Stream3_IRQHandler [WEAK] EXPORT DMA2_Stream4_IRQHandler [WEAK] EXPORT ETH_IRQHandler [WEAK] EXPORT ETH_WKUP_IRQHandler [WEAK] EXPORT CAN2_TX_IRQHandler [WEAK] EXPORT CAN2_RX0_IRQHandler [WEAK] EXPORT CAN2_RX1_IRQHandler [WEAK] EXPORT CAN2_SCE_IRQHandler [WEAK] EXPORT OTG_FS_IRQHandler [WEAK] EXPORT DMA2_Stream5_IRQHandler [WEAK] EXPORT DMA2_Stream6_IRQHandler [WEAK] EXPORT DMA2_Stream7_IRQHandler [WEAK] EXPORT USART6_IRQHandler [WEAK] EXPORT I2C3_EV_IRQHandler [WEAK] EXPORT I2C3_ER_IRQHandler [WEAK] EXPORT OTG_HS_EP1_OUT_IRQHandler [WEAK] EXPORT OTG_HS_EP1_IN_IRQHandler [WEAK] EXPORT OTG_HS_WKUP_IRQHandler [WEAK] EXPORT OTG_HS_IRQHandler [WEAK] EXPORT DCMI_IRQHandler [WEAK] EXPORT HASH_RNG_IRQHandler [WEAK] EXPORT FPU_IRQHandler [WEAK] WWDG_IRQHandler PVD_IRQHandler TAMP_STAMP_IRQHandler RTC_WKUP_IRQHandler FLASH_IRQHandler RCC_IRQHandler EXTI0_IRQHandler EXTI1_IRQHandler EXTI2_IRQHandler EXTI3_IRQHandler EXTI4_IRQHandler DMA1_Stream0_IRQHandler DMA1_Stream1_IRQHandler DMA1_Stream2_IRQHandler DMA1_Stream3_IRQHandler DMA1_Stream4_IRQHandler DMA1_Stream5_IRQHandler DMA1_Stream6_IRQHandler ADC_IRQHandler CAN1_TX_IRQHandler CAN1_RX0_IRQHandler CAN1_RX1_IRQHandler CAN1_SCE_IRQHandler EXTI9_5_IRQHandler TIM1_BRK_TIM9_IRQHandler TIM1_UP_TIM10_IRQHandler TIM1_TRG_COM_TIM11_IRQHandler TIM1_CC_IRQHandler TIM2_IRQHandler TIM3_IRQHandler TIM4_IRQHandler I2C1_EV_IRQHandler I2C1_ER_IRQHandler I2C2_EV_IRQHandler I2C2_ER_IRQHandler SPI1_IRQHandler SPI2_IRQHandler USART1_IRQHandler USART2_IRQHandler USART3_IRQHandler EXTI15_10_IRQHandler RTC_Alarm_IRQHandler OTG_FS_WKUP_IRQHandler TIM8_BRK_TIM12_IRQHandler TIM8_UP_TIM13_IRQHandler TIM8_TRG_COM_TIM14_IRQHandler TIM8_CC_IRQHandler DMA1_Stream7_IRQHandler FMC_IRQHandler SDIO_IRQHandler TIM5_IRQHandler SPI3_IRQHandler UART4_IRQHandler UART5_IRQHandler TIM6_DAC_IRQHandler TIM7_IRQHandler DMA2_Stream0_IRQHandler DMA2_Stream1_IRQHandler DMA2_Stream2_IRQHandler DMA2_Stream3_IRQHandler DMA2_Stream4_IRQHandler ETH_IRQHandler ETH_WKUP_IRQHandler CAN2_TX_IRQHandler CAN2_RX0_IRQHandler CAN2_RX1_IRQHandler CAN2_SCE_IRQHandler OTG_FS_IRQHandler DMA2_Stream5_IRQHandler DMA2_Stream6_IRQHandler DMA2_Stream7_IRQHandler USART6_IRQHandler I2C3_EV_IRQHandler I2C3_ER_IRQHandler OTG_HS_EP1_OUT_IRQHandler OTG_HS_EP1_IN_IRQHandler OTG_HS_WKUP_IRQHandler OTG_HS_IRQHandler DCMI_IRQHandler HASH_RNG_IRQHandler FPU_IRQHandler B . ENDP ALIGN ;******************************************************************************* ; User Stack and Heap initialization ;******************************************************************************* IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE*****
ms-iot/security
31,055
LimpetMCU/Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/arm/startup_stm32f446xx.s
;******************** (C) COPYRIGHT 2016 STMicroelectronics ******************** ;* File Name : startup_stm32f446xx.s ;* Author : MCD Application Team ;* Version : V2.4.3 ;* Date : 22-January-2016 ;* Description : STM32F446x devices vector table for MDK-ARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == Reset_Handler ;* - Set the vector table entries with the exceptions ISR address ;* After Reset the CortexM4 processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;* <<< Use Configuration Wizard in Context Menu >>> ;******************************************************************************* ; ;* 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. ; ;******************************************************************************* ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000200 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD MemManage_Handler ; MPU Fault Handler DCD BusFault_Handler ; Bus Fault Handler DCD UsageFault_Handler ; Usage Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD DebugMon_Handler ; Debug Monitor Handler DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD WWDG_IRQHandler ; Window WatchDog DCD PVD_IRQHandler ; PVD through EXTI Line detection DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line DCD RTC_WKUP_IRQHandler ; RTC Wakeup through the EXTI line DCD FLASH_IRQHandler ; FLASH DCD RCC_IRQHandler ; RCC DCD EXTI0_IRQHandler ; EXTI Line0 DCD EXTI1_IRQHandler ; EXTI Line1 DCD EXTI2_IRQHandler ; EXTI Line2 DCD EXTI3_IRQHandler ; EXTI Line3 DCD EXTI4_IRQHandler ; EXTI Line4 DCD DMA1_Stream0_IRQHandler ; DMA1 Stream 0 DCD DMA1_Stream1_IRQHandler ; DMA1 Stream 1 DCD DMA1_Stream2_IRQHandler ; DMA1 Stream 2 DCD DMA1_Stream3_IRQHandler ; DMA1 Stream 3 DCD DMA1_Stream4_IRQHandler ; DMA1 Stream 4 DCD DMA1_Stream5_IRQHandler ; DMA1 Stream 5 DCD DMA1_Stream6_IRQHandler ; DMA1 Stream 6 DCD ADC_IRQHandler ; ADC1, ADC2 and ADC3s DCD CAN1_TX_IRQHandler ; CAN1 TX DCD CAN1_RX0_IRQHandler ; CAN1 RX0 DCD CAN1_RX1_IRQHandler ; CAN1 RX1 DCD CAN1_SCE_IRQHandler ; CAN1 SCE DCD EXTI9_5_IRQHandler ; External Line[9:5]s DCD TIM1_BRK_TIM9_IRQHandler ; TIM1 Break and TIM9 DCD TIM1_UP_TIM10_IRQHandler ; TIM1 Update and TIM10 DCD TIM1_TRG_COM_TIM11_IRQHandler ; TIM1 Trigger and Commutation and TIM11 DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare DCD TIM2_IRQHandler ; TIM2 DCD TIM3_IRQHandler ; TIM3 DCD TIM4_IRQHandler ; TIM4 DCD I2C1_EV_IRQHandler ; I2C1 Event DCD I2C1_ER_IRQHandler ; I2C1 Error DCD I2C2_EV_IRQHandler ; I2C2 Event DCD I2C2_ER_IRQHandler ; I2C2 Error DCD SPI1_IRQHandler ; SPI1 DCD SPI2_IRQHandler ; SPI2 DCD USART1_IRQHandler ; USART1 DCD USART2_IRQHandler ; USART2 DCD USART3_IRQHandler ; USART3 DCD EXTI15_10_IRQHandler ; External Line[15:10]s DCD RTC_Alarm_IRQHandler ; RTC Alarm (A and B) through EXTI Line DCD OTG_FS_WKUP_IRQHandler ; USB OTG FS Wakeup through EXTI line DCD TIM8_BRK_TIM12_IRQHandler ; TIM8 Break and TIM12 DCD TIM8_UP_TIM13_IRQHandler ; TIM8 Update and TIM13 DCD TIM8_TRG_COM_TIM14_IRQHandler ; TIM8 Trigger and Commutation and TIM14 DCD TIM8_CC_IRQHandler ; TIM8 Capture Compare DCD DMA1_Stream7_IRQHandler ; DMA1 Stream7 DCD FMC_IRQHandler ; FMC DCD SDIO_IRQHandler ; SDIO DCD TIM5_IRQHandler ; TIM5 DCD SPI3_IRQHandler ; SPI3 DCD UART4_IRQHandler ; UART4 DCD UART5_IRQHandler ; UART5 DCD TIM6_DAC_IRQHandler ; TIM6 and DAC1&2 underrun errors DCD TIM7_IRQHandler ; TIM7 DCD DMA2_Stream0_IRQHandler ; DMA2 Stream 0 DCD DMA2_Stream1_IRQHandler ; DMA2 Stream 1 DCD DMA2_Stream2_IRQHandler ; DMA2 Stream 2 DCD DMA2_Stream3_IRQHandler ; DMA2 Stream 3 DCD DMA2_Stream4_IRQHandler ; DMA2 Stream 4 DCD 0 ; Reserved DCD 0 ; Reserved DCD CAN2_TX_IRQHandler ; CAN2 TX DCD CAN2_RX0_IRQHandler ; CAN2 RX0 DCD CAN2_RX1_IRQHandler ; CAN2 RX1 DCD CAN2_SCE_IRQHandler ; CAN2 SCE DCD OTG_FS_IRQHandler ; USB OTG FS DCD DMA2_Stream5_IRQHandler ; DMA2 Stream 5 DCD DMA2_Stream6_IRQHandler ; DMA2 Stream 6 DCD DMA2_Stream7_IRQHandler ; DMA2 Stream 7 DCD USART6_IRQHandler ; USART6 DCD I2C3_EV_IRQHandler ; I2C3 event DCD I2C3_ER_IRQHandler ; I2C3 error DCD OTG_HS_EP1_OUT_IRQHandler ; USB OTG HS End Point 1 Out DCD OTG_HS_EP1_IN_IRQHandler ; USB OTG HS End Point 1 In DCD OTG_HS_WKUP_IRQHandler ; USB OTG HS Wakeup through EXTI DCD OTG_HS_IRQHandler ; USB OTG HS DCD DCMI_IRQHandler ; DCMI DCD 0 ; Reserved DCD 0 ; Reserved DCD FPU_IRQHandler ; FPU DCD 0 ; Reserved DCD 0 ; Reserved DCD SPI4_IRQHandler ; SPI4 DCD 0 ; Reserved DCD 0 ; Reserved DCD SAI1_IRQHandler ; SAI1 DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SAI2_IRQHandler ; SAI2 DCD QUADSPI_IRQHandler ; QuadSPI DCD CEC_IRQHandler ; CEC DCD SPDIF_RX_IRQHandler ; SPDIF RX DCD I2C4_Event_IRQHandler ; I2C 4 Event DCD I2C4_Error_IRQHandler ; I2C 4 Error __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP MemManage_Handler\ PROC EXPORT MemManage_Handler [WEAK] B . ENDP BusFault_Handler\ PROC EXPORT BusFault_Handler [WEAK] B . ENDP UsageFault_Handler\ PROC EXPORT UsageFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP DebugMon_Handler\ PROC EXPORT DebugMon_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT WWDG_IRQHandler [WEAK] EXPORT PVD_IRQHandler [WEAK] EXPORT TAMP_STAMP_IRQHandler [WEAK] EXPORT RTC_WKUP_IRQHandler [WEAK] EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_IRQHandler [WEAK] EXPORT EXTI1_IRQHandler [WEAK] EXPORT EXTI2_IRQHandler [WEAK] EXPORT EXTI3_IRQHandler [WEAK] EXPORT EXTI4_IRQHandler [WEAK] EXPORT DMA1_Stream0_IRQHandler [WEAK] EXPORT DMA1_Stream1_IRQHandler [WEAK] EXPORT DMA1_Stream2_IRQHandler [WEAK] EXPORT DMA1_Stream3_IRQHandler [WEAK] EXPORT DMA1_Stream4_IRQHandler [WEAK] EXPORT DMA1_Stream5_IRQHandler [WEAK] EXPORT DMA1_Stream6_IRQHandler [WEAK] EXPORT ADC_IRQHandler [WEAK] EXPORT CAN1_TX_IRQHandler [WEAK] EXPORT CAN1_RX0_IRQHandler [WEAK] EXPORT CAN1_RX1_IRQHandler [WEAK] EXPORT CAN1_SCE_IRQHandler [WEAK] EXPORT EXTI9_5_IRQHandler [WEAK] EXPORT TIM1_BRK_TIM9_IRQHandler [WEAK] EXPORT TIM1_UP_TIM10_IRQHandler [WEAK] EXPORT TIM1_TRG_COM_TIM11_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT TIM2_IRQHandler [WEAK] EXPORT TIM3_IRQHandler [WEAK] EXPORT TIM4_IRQHandler [WEAK] EXPORT I2C1_EV_IRQHandler [WEAK] EXPORT I2C1_ER_IRQHandler [WEAK] EXPORT I2C2_EV_IRQHandler [WEAK] EXPORT I2C2_ER_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT SPI2_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] EXPORT USART2_IRQHandler [WEAK] EXPORT USART3_IRQHandler [WEAK] EXPORT EXTI15_10_IRQHandler [WEAK] EXPORT RTC_Alarm_IRQHandler [WEAK] EXPORT OTG_FS_WKUP_IRQHandler [WEAK] EXPORT TIM8_BRK_TIM12_IRQHandler [WEAK] EXPORT TIM8_UP_TIM13_IRQHandler [WEAK] EXPORT TIM8_TRG_COM_TIM14_IRQHandler [WEAK] EXPORT TIM8_CC_IRQHandler [WEAK] EXPORT DMA1_Stream7_IRQHandler [WEAK] EXPORT FMC_IRQHandler [WEAK] EXPORT SDIO_IRQHandler [WEAK] EXPORT TIM5_IRQHandler [WEAK] EXPORT SPI3_IRQHandler [WEAK] EXPORT UART4_IRQHandler [WEAK] EXPORT UART5_IRQHandler [WEAK] EXPORT TIM6_DAC_IRQHandler [WEAK] EXPORT TIM7_IRQHandler [WEAK] EXPORT DMA2_Stream0_IRQHandler [WEAK] EXPORT DMA2_Stream1_IRQHandler [WEAK] EXPORT DMA2_Stream2_IRQHandler [WEAK] EXPORT DMA2_Stream3_IRQHandler [WEAK] EXPORT DMA2_Stream4_IRQHandler [WEAK] EXPORT CAN2_TX_IRQHandler [WEAK] EXPORT CAN2_RX0_IRQHandler [WEAK] EXPORT CAN2_RX1_IRQHandler [WEAK] EXPORT CAN2_SCE_IRQHandler [WEAK] EXPORT OTG_FS_IRQHandler [WEAK] EXPORT DMA2_Stream5_IRQHandler [WEAK] EXPORT DMA2_Stream6_IRQHandler [WEAK] EXPORT DMA2_Stream7_IRQHandler [WEAK] EXPORT USART6_IRQHandler [WEAK] EXPORT I2C3_EV_IRQHandler [WEAK] EXPORT I2C3_ER_IRQHandler [WEAK] EXPORT OTG_HS_EP1_OUT_IRQHandler [WEAK] EXPORT OTG_HS_EP1_IN_IRQHandler [WEAK] EXPORT OTG_HS_WKUP_IRQHandler [WEAK] EXPORT OTG_HS_IRQHandler [WEAK] EXPORT DCMI_IRQHandler [WEAK] EXPORT FPU_IRQHandler [WEAK] EXPORT SPI4_IRQHandler [WEAK] EXPORT SAI1_IRQHandler [WEAK] EXPORT SPI4_IRQHandler [WEAK] EXPORT SAI1_IRQHandler [WEAK] EXPORT SAI2_IRQHandler [WEAK] EXPORT QUADSPI_IRQHandler [WEAK] EXPORT CEC_IRQHandler [WEAK] EXPORT SPDIF_RX_IRQHandler [WEAK] EXPORT I2C4_Event_IRQHandler [WEAK] EXPORT I2C4_Error_IRQHandler [WEAK] WWDG_IRQHandler PVD_IRQHandler TAMP_STAMP_IRQHandler RTC_WKUP_IRQHandler FLASH_IRQHandler RCC_IRQHandler EXTI0_IRQHandler EXTI1_IRQHandler EXTI2_IRQHandler EXTI3_IRQHandler EXTI4_IRQHandler DMA1_Stream0_IRQHandler DMA1_Stream1_IRQHandler DMA1_Stream2_IRQHandler DMA1_Stream3_IRQHandler DMA1_Stream4_IRQHandler DMA1_Stream5_IRQHandler DMA1_Stream6_IRQHandler ADC_IRQHandler CAN1_TX_IRQHandler CAN1_RX0_IRQHandler CAN1_RX1_IRQHandler CAN1_SCE_IRQHandler EXTI9_5_IRQHandler TIM1_BRK_TIM9_IRQHandler TIM1_UP_TIM10_IRQHandler TIM1_TRG_COM_TIM11_IRQHandler TIM1_CC_IRQHandler TIM2_IRQHandler TIM3_IRQHandler TIM4_IRQHandler I2C1_EV_IRQHandler I2C1_ER_IRQHandler I2C2_EV_IRQHandler I2C2_ER_IRQHandler SPI1_IRQHandler SPI2_IRQHandler USART1_IRQHandler USART2_IRQHandler USART3_IRQHandler EXTI15_10_IRQHandler RTC_Alarm_IRQHandler OTG_FS_WKUP_IRQHandler TIM8_BRK_TIM12_IRQHandler TIM8_UP_TIM13_IRQHandler TIM8_TRG_COM_TIM14_IRQHandler TIM8_CC_IRQHandler DMA1_Stream7_IRQHandler FMC_IRQHandler SDIO_IRQHandler TIM5_IRQHandler SPI3_IRQHandler UART4_IRQHandler UART5_IRQHandler TIM6_DAC_IRQHandler TIM7_IRQHandler DMA2_Stream0_IRQHandler DMA2_Stream1_IRQHandler DMA2_Stream2_IRQHandler DMA2_Stream3_IRQHandler DMA2_Stream4_IRQHandler CAN2_TX_IRQHandler CAN2_RX0_IRQHandler CAN2_RX1_IRQHandler CAN2_SCE_IRQHandler OTG_FS_IRQHandler DMA2_Stream5_IRQHandler DMA2_Stream6_IRQHandler DMA2_Stream7_IRQHandler USART6_IRQHandler I2C3_EV_IRQHandler I2C3_ER_IRQHandler OTG_HS_EP1_OUT_IRQHandler OTG_HS_EP1_IN_IRQHandler OTG_HS_WKUP_IRQHandler OTG_HS_IRQHandler DCMI_IRQHandler FPU_IRQHandler SPI4_IRQHandler SAI1_IRQHandler SAI2_IRQHandler QUADSPI_IRQHandler CEC_IRQHandler SPDIF_RX_IRQHandler I2C4_Event_IRQHandler I2C4_Error_IRQHandler B . ENDP ALIGN ;******************************************************************************* ; User Stack and Heap initialization ;******************************************************************************* IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE*****
ms-iot/security
30,938
LimpetMCU/Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/arm/startup_stm32f427xx.s
;******************** (C) COPYRIGHT 2016 STMicroelectronics ******************** ;* File Name : startup_stm32f427xx.s ;* Author : MCD Application Team ;* Version : V2.4.3 ;* Date : 22-January-2016 ;* Description : STM32F427x devices vector table for MDK-ARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == Reset_Handler ;* - Set the vector table entries with the exceptions ISR address ;* After Reset the CortexM4 processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;* <<< Use Configuration Wizard in Context Menu >>> ;******************************************************************************* ; ;* 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. ; ;******************************************************************************* ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000200 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD MemManage_Handler ; MPU Fault Handler DCD BusFault_Handler ; Bus Fault Handler DCD UsageFault_Handler ; Usage Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD DebugMon_Handler ; Debug Monitor Handler DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD WWDG_IRQHandler ; Window WatchDog DCD PVD_IRQHandler ; PVD through EXTI Line detection DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line DCD RTC_WKUP_IRQHandler ; RTC Wakeup through the EXTI line DCD FLASH_IRQHandler ; FLASH DCD RCC_IRQHandler ; RCC DCD EXTI0_IRQHandler ; EXTI Line0 DCD EXTI1_IRQHandler ; EXTI Line1 DCD EXTI2_IRQHandler ; EXTI Line2 DCD EXTI3_IRQHandler ; EXTI Line3 DCD EXTI4_IRQHandler ; EXTI Line4 DCD DMA1_Stream0_IRQHandler ; DMA1 Stream 0 DCD DMA1_Stream1_IRQHandler ; DMA1 Stream 1 DCD DMA1_Stream2_IRQHandler ; DMA1 Stream 2 DCD DMA1_Stream3_IRQHandler ; DMA1 Stream 3 DCD DMA1_Stream4_IRQHandler ; DMA1 Stream 4 DCD DMA1_Stream5_IRQHandler ; DMA1 Stream 5 DCD DMA1_Stream6_IRQHandler ; DMA1 Stream 6 DCD ADC_IRQHandler ; ADC1, ADC2 and ADC3s DCD CAN1_TX_IRQHandler ; CAN1 TX DCD CAN1_RX0_IRQHandler ; CAN1 RX0 DCD CAN1_RX1_IRQHandler ; CAN1 RX1 DCD CAN1_SCE_IRQHandler ; CAN1 SCE DCD EXTI9_5_IRQHandler ; External Line[9:5]s DCD TIM1_BRK_TIM9_IRQHandler ; TIM1 Break and TIM9 DCD TIM1_UP_TIM10_IRQHandler ; TIM1 Update and TIM10 DCD TIM1_TRG_COM_TIM11_IRQHandler ; TIM1 Trigger and Commutation and TIM11 DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare DCD TIM2_IRQHandler ; TIM2 DCD TIM3_IRQHandler ; TIM3 DCD TIM4_IRQHandler ; TIM4 DCD I2C1_EV_IRQHandler ; I2C1 Event DCD I2C1_ER_IRQHandler ; I2C1 Error DCD I2C2_EV_IRQHandler ; I2C2 Event DCD I2C2_ER_IRQHandler ; I2C2 Error DCD SPI1_IRQHandler ; SPI1 DCD SPI2_IRQHandler ; SPI2 DCD USART1_IRQHandler ; USART1 DCD USART2_IRQHandler ; USART2 DCD USART3_IRQHandler ; USART3 DCD EXTI15_10_IRQHandler ; External Line[15:10]s DCD RTC_Alarm_IRQHandler ; RTC Alarm (A and B) through EXTI Line DCD OTG_FS_WKUP_IRQHandler ; USB OTG FS Wakeup through EXTI line DCD TIM8_BRK_TIM12_IRQHandler ; TIM8 Break and TIM12 DCD TIM8_UP_TIM13_IRQHandler ; TIM8 Update and TIM13 DCD TIM8_TRG_COM_TIM14_IRQHandler ; TIM8 Trigger and Commutation and TIM14 DCD TIM8_CC_IRQHandler ; TIM8 Capture Compare DCD DMA1_Stream7_IRQHandler ; DMA1 Stream7 DCD FMC_IRQHandler ; FMC DCD SDIO_IRQHandler ; SDIO DCD TIM5_IRQHandler ; TIM5 DCD SPI3_IRQHandler ; SPI3 DCD UART4_IRQHandler ; UART4 DCD UART5_IRQHandler ; UART5 DCD TIM6_DAC_IRQHandler ; TIM6 and DAC1&2 underrun errors DCD TIM7_IRQHandler ; TIM7 DCD DMA2_Stream0_IRQHandler ; DMA2 Stream 0 DCD DMA2_Stream1_IRQHandler ; DMA2 Stream 1 DCD DMA2_Stream2_IRQHandler ; DMA2 Stream 2 DCD DMA2_Stream3_IRQHandler ; DMA2 Stream 3 DCD DMA2_Stream4_IRQHandler ; DMA2 Stream 4 DCD ETH_IRQHandler ; Ethernet DCD ETH_WKUP_IRQHandler ; Ethernet Wakeup through EXTI line DCD CAN2_TX_IRQHandler ; CAN2 TX DCD CAN2_RX0_IRQHandler ; CAN2 RX0 DCD CAN2_RX1_IRQHandler ; CAN2 RX1 DCD CAN2_SCE_IRQHandler ; CAN2 SCE DCD OTG_FS_IRQHandler ; USB OTG FS DCD DMA2_Stream5_IRQHandler ; DMA2 Stream 5 DCD DMA2_Stream6_IRQHandler ; DMA2 Stream 6 DCD DMA2_Stream7_IRQHandler ; DMA2 Stream 7 DCD USART6_IRQHandler ; USART6 DCD I2C3_EV_IRQHandler ; I2C3 event DCD I2C3_ER_IRQHandler ; I2C3 error DCD OTG_HS_EP1_OUT_IRQHandler ; USB OTG HS End Point 1 Out DCD OTG_HS_EP1_IN_IRQHandler ; USB OTG HS End Point 1 In DCD OTG_HS_WKUP_IRQHandler ; USB OTG HS Wakeup through EXTI DCD OTG_HS_IRQHandler ; USB OTG HS DCD DCMI_IRQHandler ; DCMI DCD 0 ; Reserved DCD HASH_RNG_IRQHandler ; Hash and Rng DCD FPU_IRQHandler ; FPU DCD UART7_IRQHandler ; UART7 DCD UART8_IRQHandler ; UART8 DCD SPI4_IRQHandler ; SPI4 DCD SPI5_IRQHandler ; SPI5 DCD SPI6_IRQHandler ; SPI6 DCD SAI1_IRQHandler ; SAI1 DCD 0 ; Reserved DCD 0 ; Reserved DCD DMA2D_IRQHandler ; DMA2D __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP MemManage_Handler\ PROC EXPORT MemManage_Handler [WEAK] B . ENDP BusFault_Handler\ PROC EXPORT BusFault_Handler [WEAK] B . ENDP UsageFault_Handler\ PROC EXPORT UsageFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP DebugMon_Handler\ PROC EXPORT DebugMon_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT WWDG_IRQHandler [WEAK] EXPORT PVD_IRQHandler [WEAK] EXPORT TAMP_STAMP_IRQHandler [WEAK] EXPORT RTC_WKUP_IRQHandler [WEAK] EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_IRQHandler [WEAK] EXPORT EXTI1_IRQHandler [WEAK] EXPORT EXTI2_IRQHandler [WEAK] EXPORT EXTI3_IRQHandler [WEAK] EXPORT EXTI4_IRQHandler [WEAK] EXPORT DMA1_Stream0_IRQHandler [WEAK] EXPORT DMA1_Stream1_IRQHandler [WEAK] EXPORT DMA1_Stream2_IRQHandler [WEAK] EXPORT DMA1_Stream3_IRQHandler [WEAK] EXPORT DMA1_Stream4_IRQHandler [WEAK] EXPORT DMA1_Stream5_IRQHandler [WEAK] EXPORT DMA1_Stream6_IRQHandler [WEAK] EXPORT ADC_IRQHandler [WEAK] EXPORT CAN1_TX_IRQHandler [WEAK] EXPORT CAN1_RX0_IRQHandler [WEAK] EXPORT CAN1_RX1_IRQHandler [WEAK] EXPORT CAN1_SCE_IRQHandler [WEAK] EXPORT EXTI9_5_IRQHandler [WEAK] EXPORT TIM1_BRK_TIM9_IRQHandler [WEAK] EXPORT TIM1_UP_TIM10_IRQHandler [WEAK] EXPORT TIM1_TRG_COM_TIM11_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT TIM2_IRQHandler [WEAK] EXPORT TIM3_IRQHandler [WEAK] EXPORT TIM4_IRQHandler [WEAK] EXPORT I2C1_EV_IRQHandler [WEAK] EXPORT I2C1_ER_IRQHandler [WEAK] EXPORT I2C2_EV_IRQHandler [WEAK] EXPORT I2C2_ER_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT SPI2_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] EXPORT USART2_IRQHandler [WEAK] EXPORT USART3_IRQHandler [WEAK] EXPORT EXTI15_10_IRQHandler [WEAK] EXPORT RTC_Alarm_IRQHandler [WEAK] EXPORT OTG_FS_WKUP_IRQHandler [WEAK] EXPORT TIM8_BRK_TIM12_IRQHandler [WEAK] EXPORT TIM8_UP_TIM13_IRQHandler [WEAK] EXPORT TIM8_TRG_COM_TIM14_IRQHandler [WEAK] EXPORT TIM8_CC_IRQHandler [WEAK] EXPORT DMA1_Stream7_IRQHandler [WEAK] EXPORT FMC_IRQHandler [WEAK] EXPORT SDIO_IRQHandler [WEAK] EXPORT TIM5_IRQHandler [WEAK] EXPORT SPI3_IRQHandler [WEAK] EXPORT UART4_IRQHandler [WEAK] EXPORT UART5_IRQHandler [WEAK] EXPORT TIM6_DAC_IRQHandler [WEAK] EXPORT TIM7_IRQHandler [WEAK] EXPORT DMA2_Stream0_IRQHandler [WEAK] EXPORT DMA2_Stream1_IRQHandler [WEAK] EXPORT DMA2_Stream2_IRQHandler [WEAK] EXPORT DMA2_Stream3_IRQHandler [WEAK] EXPORT DMA2_Stream4_IRQHandler [WEAK] EXPORT ETH_IRQHandler [WEAK] EXPORT ETH_WKUP_IRQHandler [WEAK] EXPORT CAN2_TX_IRQHandler [WEAK] EXPORT CAN2_RX0_IRQHandler [WEAK] EXPORT CAN2_RX1_IRQHandler [WEAK] EXPORT CAN2_SCE_IRQHandler [WEAK] EXPORT OTG_FS_IRQHandler [WEAK] EXPORT DMA2_Stream5_IRQHandler [WEAK] EXPORT DMA2_Stream6_IRQHandler [WEAK] EXPORT DMA2_Stream7_IRQHandler [WEAK] EXPORT USART6_IRQHandler [WEAK] EXPORT I2C3_EV_IRQHandler [WEAK] EXPORT I2C3_ER_IRQHandler [WEAK] EXPORT OTG_HS_EP1_OUT_IRQHandler [WEAK] EXPORT OTG_HS_EP1_IN_IRQHandler [WEAK] EXPORT OTG_HS_WKUP_IRQHandler [WEAK] EXPORT OTG_HS_IRQHandler [WEAK] EXPORT DCMI_IRQHandler [WEAK] EXPORT HASH_RNG_IRQHandler [WEAK] EXPORT FPU_IRQHandler [WEAK] EXPORT UART7_IRQHandler [WEAK] EXPORT UART8_IRQHandler [WEAK] EXPORT SPI4_IRQHandler [WEAK] EXPORT SPI5_IRQHandler [WEAK] EXPORT SPI6_IRQHandler [WEAK] EXPORT SAI1_IRQHandler [WEAK] EXPORT DMA2D_IRQHandler [WEAK] WWDG_IRQHandler PVD_IRQHandler TAMP_STAMP_IRQHandler RTC_WKUP_IRQHandler FLASH_IRQHandler RCC_IRQHandler EXTI0_IRQHandler EXTI1_IRQHandler EXTI2_IRQHandler EXTI3_IRQHandler EXTI4_IRQHandler DMA1_Stream0_IRQHandler DMA1_Stream1_IRQHandler DMA1_Stream2_IRQHandler DMA1_Stream3_IRQHandler DMA1_Stream4_IRQHandler DMA1_Stream5_IRQHandler DMA1_Stream6_IRQHandler ADC_IRQHandler CAN1_TX_IRQHandler CAN1_RX0_IRQHandler CAN1_RX1_IRQHandler CAN1_SCE_IRQHandler EXTI9_5_IRQHandler TIM1_BRK_TIM9_IRQHandler TIM1_UP_TIM10_IRQHandler TIM1_TRG_COM_TIM11_IRQHandler TIM1_CC_IRQHandler TIM2_IRQHandler TIM3_IRQHandler TIM4_IRQHandler I2C1_EV_IRQHandler I2C1_ER_IRQHandler I2C2_EV_IRQHandler I2C2_ER_IRQHandler SPI1_IRQHandler SPI2_IRQHandler USART1_IRQHandler USART2_IRQHandler USART3_IRQHandler EXTI15_10_IRQHandler RTC_Alarm_IRQHandler OTG_FS_WKUP_IRQHandler TIM8_BRK_TIM12_IRQHandler TIM8_UP_TIM13_IRQHandler TIM8_TRG_COM_TIM14_IRQHandler TIM8_CC_IRQHandler DMA1_Stream7_IRQHandler FMC_IRQHandler SDIO_IRQHandler TIM5_IRQHandler SPI3_IRQHandler UART4_IRQHandler UART5_IRQHandler TIM6_DAC_IRQHandler TIM7_IRQHandler DMA2_Stream0_IRQHandler DMA2_Stream1_IRQHandler DMA2_Stream2_IRQHandler DMA2_Stream3_IRQHandler DMA2_Stream4_IRQHandler ETH_IRQHandler ETH_WKUP_IRQHandler CAN2_TX_IRQHandler CAN2_RX0_IRQHandler CAN2_RX1_IRQHandler CAN2_SCE_IRQHandler OTG_FS_IRQHandler DMA2_Stream5_IRQHandler DMA2_Stream6_IRQHandler DMA2_Stream7_IRQHandler USART6_IRQHandler I2C3_EV_IRQHandler I2C3_ER_IRQHandler OTG_HS_EP1_OUT_IRQHandler OTG_HS_EP1_IN_IRQHandler OTG_HS_WKUP_IRQHandler OTG_HS_IRQHandler DCMI_IRQHandler HASH_RNG_IRQHandler FPU_IRQHandler UART7_IRQHandler UART8_IRQHandler SPI4_IRQHandler SPI5_IRQHandler SPI6_IRQHandler SAI1_IRQHandler DMA2D_IRQHandler B . ENDP ALIGN ;******************************************************************************* ; User Stack and Heap initialization ;******************************************************************************* IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE*****
ms-iot/security
18,791
LimpetMCU/Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/arm/startup_stm32f410rx.s
;******************** (C) COPYRIGHT 2016 STMicroelectronics ******************** ;* File Name : startup_stm32f410rx.s ;* Author : MCD Application Team ;* Version : V2.4.3 ;* Date : 22-January-2016 ;* Description : STM32F410Rx devices vector table for MDK-ARM 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 CortexM4 processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;* <<< Use Configuration Wizard in Context Menu >>> ;******************************************************************************* ; ;* 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. ; ;******************************************************************************* ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000200 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD MemManage_Handler ; MPU Fault Handler DCD BusFault_Handler ; Bus Fault Handler DCD UsageFault_Handler ; Usage Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD DebugMon_Handler ; Debug Monitor Handler DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD WWDG_IRQHandler ; Window WatchDog DCD PVD_IRQHandler ; PVD through EXTI Line detection DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line DCD RTC_WKUP_IRQHandler ; RTC Wakeup through the EXTI line DCD FLASH_IRQHandler ; FLASH DCD RCC_IRQHandler ; RCC DCD EXTI0_IRQHandler ; EXTI Line0 DCD EXTI1_IRQHandler ; EXTI Line1 DCD EXTI2_IRQHandler ; EXTI Line2 DCD EXTI3_IRQHandler ; EXTI Line3 DCD EXTI4_IRQHandler ; EXTI Line4 DCD DMA1_Stream0_IRQHandler ; DMA1 Stream 0 DCD DMA1_Stream1_IRQHandler ; DMA1 Stream 1 DCD DMA1_Stream2_IRQHandler ; DMA1 Stream 2 DCD DMA1_Stream3_IRQHandler ; DMA1 Stream 3 DCD DMA1_Stream4_IRQHandler ; DMA1 Stream 4 DCD DMA1_Stream5_IRQHandler ; DMA1 Stream 5 DCD DMA1_Stream6_IRQHandler ; DMA1 Stream 6 DCD ADC_IRQHandler ; ADC1, ADC2 and ADC3s DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD EXTI9_5_IRQHandler ; External Line[9:5]s DCD TIM1_BRK_TIM9_IRQHandler ; TIM1 Break and TIM9 DCD TIM1_UP_IRQHandler ; TIM1 Update DCD TIM1_TRG_COM_TIM11_IRQHandler ; TIM1 Trigger and Commutation and TIM11 DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD I2C1_EV_IRQHandler ; I2C1 Event DCD I2C1_ER_IRQHandler ; I2C1 Error DCD I2C2_EV_IRQHandler ; I2C2 Event DCD I2C2_ER_IRQHandler ; I2C2 Error DCD SPI1_IRQHandler ; SPI1 DCD SPI2_IRQHandler ; SPI2 DCD USART1_IRQHandler ; USART1 DCD USART2_IRQHandler ; USART2 DCD 0 ; Reserved DCD EXTI15_10_IRQHandler ; External Line[15:10]s DCD RTC_Alarm_IRQHandler ; RTC Alarm (A and B) through EXTI Line DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD DMA1_Stream7_IRQHandler ; DMA1 Stream7 DCD 0 ; Reserved DCD 0 ; Reserved DCD TIM5_IRQHandler ; TIM5 DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD TIM6_DAC_IRQHandler ; TIM6 and DAC DCD 0 ; Reserved DCD DMA2_Stream0_IRQHandler ; DMA2 Stream 0 DCD DMA2_Stream1_IRQHandler ; DMA2 Stream 1 DCD DMA2_Stream2_IRQHandler ; DMA2 Stream 2 DCD DMA2_Stream3_IRQHandler ; DMA2 Stream 3 DCD DMA2_Stream4_IRQHandler ; DMA2 Stream 4 DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD DMA2_Stream5_IRQHandler ; DMA2 Stream 5 DCD DMA2_Stream6_IRQHandler ; DMA2 Stream 6 DCD DMA2_Stream7_IRQHandler ; DMA2 Stream 7 DCD USART6_IRQHandler ; USART6 DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD RNG_IRQHandler ; RNG DCD FPU_IRQHandler ; FPU DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SPI5_IRQHandler ; SPI5 DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD FMPI2C1_EV_IRQHandler ; FMPI2C1 Event DCD FMPI2C1_ER_IRQHandler ; FMPI2C1 Error DCD LPTIM1_IRQHandler ; LP TIM1 __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP MemManage_Handler\ PROC EXPORT MemManage_Handler [WEAK] B . ENDP BusFault_Handler\ PROC EXPORT BusFault_Handler [WEAK] B . ENDP UsageFault_Handler\ PROC EXPORT UsageFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP DebugMon_Handler\ PROC EXPORT DebugMon_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT WWDG_IRQHandler [WEAK] EXPORT PVD_IRQHandler [WEAK] EXPORT TAMP_STAMP_IRQHandler [WEAK] EXPORT RTC_WKUP_IRQHandler [WEAK] EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_IRQHandler [WEAK] EXPORT EXTI1_IRQHandler [WEAK] EXPORT EXTI2_IRQHandler [WEAK] EXPORT EXTI3_IRQHandler [WEAK] EXPORT EXTI4_IRQHandler [WEAK] EXPORT DMA1_Stream0_IRQHandler [WEAK] EXPORT DMA1_Stream1_IRQHandler [WEAK] EXPORT DMA1_Stream2_IRQHandler [WEAK] EXPORT DMA1_Stream3_IRQHandler [WEAK] EXPORT DMA1_Stream4_IRQHandler [WEAK] EXPORT DMA1_Stream5_IRQHandler [WEAK] EXPORT DMA1_Stream6_IRQHandler [WEAK] EXPORT ADC_IRQHandler [WEAK] EXPORT EXTI9_5_IRQHandler [WEAK] EXPORT TIM1_BRK_TIM9_IRQHandler [WEAK] EXPORT TIM1_UP_IRQHandler [WEAK] EXPORT TIM1_TRG_COM_TIM11_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT I2C1_EV_IRQHandler [WEAK] EXPORT I2C1_ER_IRQHandler [WEAK] EXPORT I2C2_EV_IRQHandler [WEAK] EXPORT I2C2_ER_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT SPI2_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] EXPORT USART2_IRQHandler [WEAK] EXPORT EXTI15_10_IRQHandler [WEAK] EXPORT RTC_Alarm_IRQHandler [WEAK] EXPORT DMA1_Stream7_IRQHandler [WEAK] EXPORT TIM5_IRQHandler [WEAK] EXPORT TIM6_DAC_IRQHandler [WEAK] EXPORT DMA2_Stream0_IRQHandler [WEAK] EXPORT DMA2_Stream1_IRQHandler [WEAK] EXPORT DMA2_Stream2_IRQHandler [WEAK] EXPORT DMA2_Stream3_IRQHandler [WEAK] EXPORT DMA2_Stream4_IRQHandler [WEAK] EXPORT DMA2_Stream4_IRQHandler [WEAK] EXPORT DMA2_Stream5_IRQHandler [WEAK] EXPORT DMA2_Stream6_IRQHandler [WEAK] EXPORT DMA2_Stream7_IRQHandler [WEAK] EXPORT USART6_IRQHandler [WEAK] EXPORT RNG_IRQHandler [WEAK] EXPORT FPU_IRQHandler [WEAK] EXPORT SPI5_IRQHandler [WEAK] EXPORT FMPI2C1_EV_IRQHandler [WEAK] EXPORT FMPI2C1_ER_IRQHandler [WEAK] EXPORT LPTIM1_IRQHandler [WEAK] WWDG_IRQHandler PVD_IRQHandler TAMP_STAMP_IRQHandler RTC_WKUP_IRQHandler FLASH_IRQHandler RCC_IRQHandler EXTI0_IRQHandler EXTI1_IRQHandler EXTI2_IRQHandler EXTI3_IRQHandler EXTI4_IRQHandler DMA1_Stream0_IRQHandler DMA1_Stream1_IRQHandler DMA1_Stream2_IRQHandler DMA1_Stream3_IRQHandler DMA1_Stream4_IRQHandler DMA1_Stream5_IRQHandler DMA1_Stream6_IRQHandler ADC_IRQHandler EXTI9_5_IRQHandler TIM1_BRK_TIM9_IRQHandler TIM1_UP_IRQHandler TIM1_TRG_COM_TIM11_IRQHandler TIM1_CC_IRQHandler I2C1_EV_IRQHandler I2C1_ER_IRQHandler I2C2_EV_IRQHandler I2C2_ER_IRQHandler SPI1_IRQHandler SPI2_IRQHandler USART1_IRQHandler USART2_IRQHandler EXTI15_10_IRQHandler RTC_Alarm_IRQHandler DMA1_Stream7_IRQHandler TIM5_IRQHandler TIM6_DAC_IRQHandler DMA2_Stream0_IRQHandler DMA2_Stream1_IRQHandler DMA2_Stream2_IRQHandler DMA2_Stream3_IRQHandler DMA2_Stream4_IRQHandler DMA2_Stream5_IRQHandler DMA2_Stream6_IRQHandler DMA2_Stream7_IRQHandler USART6_IRQHandler RNG_IRQHandler FPU_IRQHandler SPI5_IRQHandler FMPI2C1_EV_IRQHandler FMPI2C1_ER_IRQHandler LPTIM1_IRQHandler B . ENDP ALIGN ;******************************************************************************* ; User Stack and Heap initialization ;******************************************************************************* IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE*****
ms-iot/security
29,309
LimpetMCU/Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/arm/startup_stm32f415xx.s
;******************** (C) COPYRIGHT 2016 STMicroelectronics ******************** ;* File Name : startup_stm32f415xx.s ;* Author : MCD Application Team ;* Version : V2.4.3 ;* Date : 22-January-2016 ;* Description : STM32F415xx devices vector table for MDK-ARM 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 CortexM4 processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;* <<< Use Configuration Wizard in Context Menu >>> ;******************************************************************************* ; ;* 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. ; ;******************************************************************************* ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000200 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD MemManage_Handler ; MPU Fault Handler DCD BusFault_Handler ; Bus Fault Handler DCD UsageFault_Handler ; Usage Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD DebugMon_Handler ; Debug Monitor Handler DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD WWDG_IRQHandler ; Window WatchDog DCD PVD_IRQHandler ; PVD through EXTI Line detection DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line DCD RTC_WKUP_IRQHandler ; RTC Wakeup through the EXTI line DCD FLASH_IRQHandler ; FLASH DCD RCC_IRQHandler ; RCC DCD EXTI0_IRQHandler ; EXTI Line0 DCD EXTI1_IRQHandler ; EXTI Line1 DCD EXTI2_IRQHandler ; EXTI Line2 DCD EXTI3_IRQHandler ; EXTI Line3 DCD EXTI4_IRQHandler ; EXTI Line4 DCD DMA1_Stream0_IRQHandler ; DMA1 Stream 0 DCD DMA1_Stream1_IRQHandler ; DMA1 Stream 1 DCD DMA1_Stream2_IRQHandler ; DMA1 Stream 2 DCD DMA1_Stream3_IRQHandler ; DMA1 Stream 3 DCD DMA1_Stream4_IRQHandler ; DMA1 Stream 4 DCD DMA1_Stream5_IRQHandler ; DMA1 Stream 5 DCD DMA1_Stream6_IRQHandler ; DMA1 Stream 6 DCD ADC_IRQHandler ; ADC1, ADC2 and ADC3s DCD CAN1_TX_IRQHandler ; CAN1 TX DCD CAN1_RX0_IRQHandler ; CAN1 RX0 DCD CAN1_RX1_IRQHandler ; CAN1 RX1 DCD CAN1_SCE_IRQHandler ; CAN1 SCE DCD EXTI9_5_IRQHandler ; External Line[9:5]s DCD TIM1_BRK_TIM9_IRQHandler ; TIM1 Break and TIM9 DCD TIM1_UP_TIM10_IRQHandler ; TIM1 Update and TIM10 DCD TIM1_TRG_COM_TIM11_IRQHandler ; TIM1 Trigger and Commutation and TIM11 DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare DCD TIM2_IRQHandler ; TIM2 DCD TIM3_IRQHandler ; TIM3 DCD TIM4_IRQHandler ; TIM4 DCD I2C1_EV_IRQHandler ; I2C1 Event DCD I2C1_ER_IRQHandler ; I2C1 Error DCD I2C2_EV_IRQHandler ; I2C2 Event DCD I2C2_ER_IRQHandler ; I2C2 Error DCD SPI1_IRQHandler ; SPI1 DCD SPI2_IRQHandler ; SPI2 DCD USART1_IRQHandler ; USART1 DCD USART2_IRQHandler ; USART2 DCD USART3_IRQHandler ; USART3 DCD EXTI15_10_IRQHandler ; External Line[15:10]s DCD RTC_Alarm_IRQHandler ; RTC Alarm (A and B) through EXTI Line DCD OTG_FS_WKUP_IRQHandler ; USB OTG FS Wakeup through EXTI line DCD TIM8_BRK_TIM12_IRQHandler ; TIM8 Break and TIM12 DCD TIM8_UP_TIM13_IRQHandler ; TIM8 Update and TIM13 DCD TIM8_TRG_COM_TIM14_IRQHandler ; TIM8 Trigger and Commutation and TIM14 DCD TIM8_CC_IRQHandler ; TIM8 Capture Compare DCD DMA1_Stream7_IRQHandler ; DMA1 Stream7 DCD FMC_IRQHandler ; FMC DCD SDIO_IRQHandler ; SDIO DCD TIM5_IRQHandler ; TIM5 DCD SPI3_IRQHandler ; SPI3 DCD UART4_IRQHandler ; UART4 DCD UART5_IRQHandler ; UART5 DCD TIM6_DAC_IRQHandler ; TIM6 and DAC1&2 underrun errors DCD TIM7_IRQHandler ; TIM7 DCD DMA2_Stream0_IRQHandler ; DMA2 Stream 0 DCD DMA2_Stream1_IRQHandler ; DMA2 Stream 1 DCD DMA2_Stream2_IRQHandler ; DMA2 Stream 2 DCD DMA2_Stream3_IRQHandler ; DMA2 Stream 3 DCD DMA2_Stream4_IRQHandler ; DMA2 Stream 4 DCD 0 ; Reserved DCD 0 ; Reserved DCD CAN2_TX_IRQHandler ; CAN2 TX DCD CAN2_RX0_IRQHandler ; CAN2 RX0 DCD CAN2_RX1_IRQHandler ; CAN2 RX1 DCD CAN2_SCE_IRQHandler ; CAN2 SCE DCD OTG_FS_IRQHandler ; USB OTG FS DCD DMA2_Stream5_IRQHandler ; DMA2 Stream 5 DCD DMA2_Stream6_IRQHandler ; DMA2 Stream 6 DCD DMA2_Stream7_IRQHandler ; DMA2 Stream 7 DCD USART6_IRQHandler ; USART6 DCD I2C3_EV_IRQHandler ; I2C3 event DCD I2C3_ER_IRQHandler ; I2C3 error DCD OTG_HS_EP1_OUT_IRQHandler ; USB OTG HS End Point 1 Out DCD OTG_HS_EP1_IN_IRQHandler ; USB OTG HS End Point 1 In DCD OTG_HS_WKUP_IRQHandler ; USB OTG HS Wakeup through EXTI DCD OTG_HS_IRQHandler ; USB OTG HS DCD 0 ; Reserved DCD CRYP_IRQHandler ; CRYPTO DCD HASH_RNG_IRQHandler ; Hash and Rng DCD FPU_IRQHandler ; FPU __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP MemManage_Handler\ PROC EXPORT MemManage_Handler [WEAK] B . ENDP BusFault_Handler\ PROC EXPORT BusFault_Handler [WEAK] B . ENDP UsageFault_Handler\ PROC EXPORT UsageFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP DebugMon_Handler\ PROC EXPORT DebugMon_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT WWDG_IRQHandler [WEAK] EXPORT PVD_IRQHandler [WEAK] EXPORT TAMP_STAMP_IRQHandler [WEAK] EXPORT RTC_WKUP_IRQHandler [WEAK] EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_IRQHandler [WEAK] EXPORT EXTI1_IRQHandler [WEAK] EXPORT EXTI2_IRQHandler [WEAK] EXPORT EXTI3_IRQHandler [WEAK] EXPORT EXTI4_IRQHandler [WEAK] EXPORT DMA1_Stream0_IRQHandler [WEAK] EXPORT DMA1_Stream1_IRQHandler [WEAK] EXPORT DMA1_Stream2_IRQHandler [WEAK] EXPORT DMA1_Stream3_IRQHandler [WEAK] EXPORT DMA1_Stream4_IRQHandler [WEAK] EXPORT DMA1_Stream5_IRQHandler [WEAK] EXPORT DMA1_Stream6_IRQHandler [WEAK] EXPORT ADC_IRQHandler [WEAK] EXPORT CAN1_TX_IRQHandler [WEAK] EXPORT CAN1_RX0_IRQHandler [WEAK] EXPORT CAN1_RX1_IRQHandler [WEAK] EXPORT CAN1_SCE_IRQHandler [WEAK] EXPORT EXTI9_5_IRQHandler [WEAK] EXPORT TIM1_BRK_TIM9_IRQHandler [WEAK] EXPORT TIM1_UP_TIM10_IRQHandler [WEAK] EXPORT TIM1_TRG_COM_TIM11_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT TIM2_IRQHandler [WEAK] EXPORT TIM3_IRQHandler [WEAK] EXPORT TIM4_IRQHandler [WEAK] EXPORT I2C1_EV_IRQHandler [WEAK] EXPORT I2C1_ER_IRQHandler [WEAK] EXPORT I2C2_EV_IRQHandler [WEAK] EXPORT I2C2_ER_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT SPI2_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] EXPORT USART2_IRQHandler [WEAK] EXPORT USART3_IRQHandler [WEAK] EXPORT EXTI15_10_IRQHandler [WEAK] EXPORT RTC_Alarm_IRQHandler [WEAK] EXPORT OTG_FS_WKUP_IRQHandler [WEAK] EXPORT TIM8_BRK_TIM12_IRQHandler [WEAK] EXPORT TIM8_UP_TIM13_IRQHandler [WEAK] EXPORT TIM8_TRG_COM_TIM14_IRQHandler [WEAK] EXPORT TIM8_CC_IRQHandler [WEAK] EXPORT DMA1_Stream7_IRQHandler [WEAK] EXPORT FMC_IRQHandler [WEAK] EXPORT SDIO_IRQHandler [WEAK] EXPORT TIM5_IRQHandler [WEAK] EXPORT SPI3_IRQHandler [WEAK] EXPORT UART4_IRQHandler [WEAK] EXPORT UART5_IRQHandler [WEAK] EXPORT TIM6_DAC_IRQHandler [WEAK] EXPORT TIM7_IRQHandler [WEAK] EXPORT DMA2_Stream0_IRQHandler [WEAK] EXPORT DMA2_Stream1_IRQHandler [WEAK] EXPORT DMA2_Stream2_IRQHandler [WEAK] EXPORT DMA2_Stream3_IRQHandler [WEAK] EXPORT DMA2_Stream4_IRQHandler [WEAK] EXPORT CAN2_TX_IRQHandler [WEAK] EXPORT CAN2_RX0_IRQHandler [WEAK] EXPORT CAN2_RX1_IRQHandler [WEAK] EXPORT CAN2_SCE_IRQHandler [WEAK] EXPORT OTG_FS_IRQHandler [WEAK] EXPORT DMA2_Stream5_IRQHandler [WEAK] EXPORT DMA2_Stream6_IRQHandler [WEAK] EXPORT DMA2_Stream7_IRQHandler [WEAK] EXPORT USART6_IRQHandler [WEAK] EXPORT I2C3_EV_IRQHandler [WEAK] EXPORT I2C3_ER_IRQHandler [WEAK] EXPORT OTG_HS_EP1_OUT_IRQHandler [WEAK] EXPORT OTG_HS_EP1_IN_IRQHandler [WEAK] EXPORT OTG_HS_WKUP_IRQHandler [WEAK] EXPORT OTG_HS_IRQHandler [WEAK] EXPORT CRYP_IRQHandler [WEAK] EXPORT HASH_RNG_IRQHandler [WEAK] EXPORT FPU_IRQHandler [WEAK] WWDG_IRQHandler PVD_IRQHandler TAMP_STAMP_IRQHandler RTC_WKUP_IRQHandler FLASH_IRQHandler RCC_IRQHandler EXTI0_IRQHandler EXTI1_IRQHandler EXTI2_IRQHandler EXTI3_IRQHandler EXTI4_IRQHandler DMA1_Stream0_IRQHandler DMA1_Stream1_IRQHandler DMA1_Stream2_IRQHandler DMA1_Stream3_IRQHandler DMA1_Stream4_IRQHandler DMA1_Stream5_IRQHandler DMA1_Stream6_IRQHandler ADC_IRQHandler CAN1_TX_IRQHandler CAN1_RX0_IRQHandler CAN1_RX1_IRQHandler CAN1_SCE_IRQHandler EXTI9_5_IRQHandler TIM1_BRK_TIM9_IRQHandler TIM1_UP_TIM10_IRQHandler TIM1_TRG_COM_TIM11_IRQHandler TIM1_CC_IRQHandler TIM2_IRQHandler TIM3_IRQHandler TIM4_IRQHandler I2C1_EV_IRQHandler I2C1_ER_IRQHandler I2C2_EV_IRQHandler I2C2_ER_IRQHandler SPI1_IRQHandler SPI2_IRQHandler USART1_IRQHandler USART2_IRQHandler USART3_IRQHandler EXTI15_10_IRQHandler RTC_Alarm_IRQHandler OTG_FS_WKUP_IRQHandler TIM8_BRK_TIM12_IRQHandler TIM8_UP_TIM13_IRQHandler TIM8_TRG_COM_TIM14_IRQHandler TIM8_CC_IRQHandler DMA1_Stream7_IRQHandler FMC_IRQHandler SDIO_IRQHandler TIM5_IRQHandler SPI3_IRQHandler UART4_IRQHandler UART5_IRQHandler TIM6_DAC_IRQHandler TIM7_IRQHandler DMA2_Stream0_IRQHandler DMA2_Stream1_IRQHandler DMA2_Stream2_IRQHandler DMA2_Stream3_IRQHandler DMA2_Stream4_IRQHandler CAN2_TX_IRQHandler CAN2_RX0_IRQHandler CAN2_RX1_IRQHandler CAN2_SCE_IRQHandler OTG_FS_IRQHandler DMA2_Stream5_IRQHandler DMA2_Stream6_IRQHandler DMA2_Stream7_IRQHandler USART6_IRQHandler I2C3_EV_IRQHandler I2C3_ER_IRQHandler OTG_HS_EP1_OUT_IRQHandler OTG_HS_EP1_IN_IRQHandler OTG_HS_WKUP_IRQHandler OTG_HS_IRQHandler CRYP_IRQHandler HASH_RNG_IRQHandler FPU_IRQHandler B . ENDP ALIGN ;******************************************************************************* ; User Stack and Heap initialization ;******************************************************************************* IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE*****
ms-iot/security
31,397
LimpetMCU/Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/arm/startup_stm32f479xx.s
;******************** (C) COPYRIGHT 2016 STMicroelectronics ******************** ;* File Name : startup_stm32f479xx.s ;* Author : MCD Application Team ;* Version : V2.4.3 ;* Date : 22-January-2016 ;* Description : STM32F479x devices vector table for MDK-ARM 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 CortexM4 processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;* <<< Use Configuration Wizard in Context Menu >>> ;******************************************************************************* ; ;* 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. ; ;******************************************************************************* ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000200 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD MemManage_Handler ; MPU Fault Handler DCD BusFault_Handler ; Bus Fault Handler DCD UsageFault_Handler ; Usage Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD DebugMon_Handler ; Debug Monitor Handler DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD WWDG_IRQHandler ; Window WatchDog DCD PVD_IRQHandler ; PVD through EXTI Line detection DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line DCD RTC_WKUP_IRQHandler ; RTC Wakeup through the EXTI line DCD FLASH_IRQHandler ; FLASH DCD RCC_IRQHandler ; RCC DCD EXTI0_IRQHandler ; EXTI Line0 DCD EXTI1_IRQHandler ; EXTI Line1 DCD EXTI2_IRQHandler ; EXTI Line2 DCD EXTI3_IRQHandler ; EXTI Line3 DCD EXTI4_IRQHandler ; EXTI Line4 DCD DMA1_Stream0_IRQHandler ; DMA1 Stream 0 DCD DMA1_Stream1_IRQHandler ; DMA1 Stream 1 DCD DMA1_Stream2_IRQHandler ; DMA1 Stream 2 DCD DMA1_Stream3_IRQHandler ; DMA1 Stream 3 DCD DMA1_Stream4_IRQHandler ; DMA1 Stream 4 DCD DMA1_Stream5_IRQHandler ; DMA1 Stream 5 DCD DMA1_Stream6_IRQHandler ; DMA1 Stream 6 DCD ADC_IRQHandler ; ADC1, ADC2 and ADC3s DCD CAN1_TX_IRQHandler ; CAN1 TX DCD CAN1_RX0_IRQHandler ; CAN1 RX0 DCD CAN1_RX1_IRQHandler ; CAN1 RX1 DCD CAN1_SCE_IRQHandler ; CAN1 SCE DCD EXTI9_5_IRQHandler ; External Line[9:5]s DCD TIM1_BRK_TIM9_IRQHandler ; TIM1 Break and TIM9 DCD TIM1_UP_TIM10_IRQHandler ; TIM1 Update and TIM10 DCD TIM1_TRG_COM_TIM11_IRQHandler ; TIM1 Trigger and Commutation and TIM11 DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare DCD TIM2_IRQHandler ; TIM2 DCD TIM3_IRQHandler ; TIM3 DCD TIM4_IRQHandler ; TIM4 DCD I2C1_EV_IRQHandler ; I2C1 Event DCD I2C1_ER_IRQHandler ; I2C1 Error DCD I2C2_EV_IRQHandler ; I2C2 Event DCD I2C2_ER_IRQHandler ; I2C2 Error DCD SPI1_IRQHandler ; SPI1 DCD SPI2_IRQHandler ; SPI2 DCD USART1_IRQHandler ; USART1 DCD USART2_IRQHandler ; USART2 DCD USART3_IRQHandler ; USART3 DCD EXTI15_10_IRQHandler ; External Line[15:10]s DCD RTC_Alarm_IRQHandler ; RTC Alarm (A and B) through EXTI Line DCD OTG_FS_WKUP_IRQHandler ; USB OTG FS Wakeup through EXTI line DCD TIM8_BRK_TIM12_IRQHandler ; TIM8 Break and TIM12 DCD TIM8_UP_TIM13_IRQHandler ; TIM8 Update and TIM13 DCD TIM8_TRG_COM_TIM14_IRQHandler ; TIM8 Trigger and Commutation and TIM14 DCD TIM8_CC_IRQHandler ; TIM8 Capture Compare DCD DMA1_Stream7_IRQHandler ; DMA1 Stream7 DCD FMC_IRQHandler ; FMC DCD SDIO_IRQHandler ; SDIO DCD TIM5_IRQHandler ; TIM5 DCD SPI3_IRQHandler ; SPI3 DCD UART4_IRQHandler ; UART4 DCD UART5_IRQHandler ; UART5 DCD TIM6_DAC_IRQHandler ; TIM6 and DAC1&2 underrun errors DCD TIM7_IRQHandler ; TIM7 DCD DMA2_Stream0_IRQHandler ; DMA2 Stream 0 DCD DMA2_Stream1_IRQHandler ; DMA2 Stream 1 DCD DMA2_Stream2_IRQHandler ; DMA2 Stream 2 DCD DMA2_Stream3_IRQHandler ; DMA2 Stream 3 DCD DMA2_Stream4_IRQHandler ; DMA2 Stream 4 DCD ETH_IRQHandler ; Ethernet DCD ETH_WKUP_IRQHandler ; Ethernet Wakeup through EXTI line DCD CAN2_TX_IRQHandler ; CAN2 TX DCD CAN2_RX0_IRQHandler ; CAN2 RX0 DCD CAN2_RX1_IRQHandler ; CAN2 RX1 DCD CAN2_SCE_IRQHandler ; CAN2 SCE DCD OTG_FS_IRQHandler ; USB OTG FS DCD DMA2_Stream5_IRQHandler ; DMA2 Stream 5 DCD DMA2_Stream6_IRQHandler ; DMA2 Stream 6 DCD DMA2_Stream7_IRQHandler ; DMA2 Stream 7 DCD USART6_IRQHandler ; USART6 DCD I2C3_EV_IRQHandler ; I2C3 event DCD I2C3_ER_IRQHandler ; I2C3 error DCD OTG_HS_EP1_OUT_IRQHandler ; USB OTG HS End Point 1 Out DCD OTG_HS_EP1_IN_IRQHandler ; USB OTG HS End Point 1 In DCD OTG_HS_WKUP_IRQHandler ; USB OTG HS Wakeup through EXTI DCD OTG_HS_IRQHandler ; USB OTG HS DCD DCMI_IRQHandler ; DCMI DCD CRYP_IRQHandler ; CRYPTO DCD HASH_RNG_IRQHandler ; Hash and Rng DCD FPU_IRQHandler ; FPU DCD UART7_IRQHandler ; UART7 DCD UART8_IRQHandler ; UART8 DCD SPI4_IRQHandler ; SPI4 DCD SPI5_IRQHandler ; SPI5 DCD SPI6_IRQHandler ; SPI6 DCD SAI1_IRQHandler ; SAI1 DCD LTDC_IRQHandler ; LTDC DCD LTDC_ER_IRQHandler ; LTDC error DCD DMA2D_IRQHandler ; DMA2D DCD QUADSPI_IRQHandler ; QUADSPI DCD DSI_IRQHandler ; DSI __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP MemManage_Handler\ PROC EXPORT MemManage_Handler [WEAK] B . ENDP BusFault_Handler\ PROC EXPORT BusFault_Handler [WEAK] B . ENDP UsageFault_Handler\ PROC EXPORT UsageFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP DebugMon_Handler\ PROC EXPORT DebugMon_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT WWDG_IRQHandler [WEAK] EXPORT PVD_IRQHandler [WEAK] EXPORT TAMP_STAMP_IRQHandler [WEAK] EXPORT RTC_WKUP_IRQHandler [WEAK] EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_IRQHandler [WEAK] EXPORT EXTI1_IRQHandler [WEAK] EXPORT EXTI2_IRQHandler [WEAK] EXPORT EXTI3_IRQHandler [WEAK] EXPORT EXTI4_IRQHandler [WEAK] EXPORT DMA1_Stream0_IRQHandler [WEAK] EXPORT DMA1_Stream1_IRQHandler [WEAK] EXPORT DMA1_Stream2_IRQHandler [WEAK] EXPORT DMA1_Stream3_IRQHandler [WEAK] EXPORT DMA1_Stream4_IRQHandler [WEAK] EXPORT DMA1_Stream5_IRQHandler [WEAK] EXPORT DMA1_Stream6_IRQHandler [WEAK] EXPORT ADC_IRQHandler [WEAK] EXPORT CAN1_TX_IRQHandler [WEAK] EXPORT CAN1_RX0_IRQHandler [WEAK] EXPORT CAN1_RX1_IRQHandler [WEAK] EXPORT CAN1_SCE_IRQHandler [WEAK] EXPORT EXTI9_5_IRQHandler [WEAK] EXPORT TIM1_BRK_TIM9_IRQHandler [WEAK] EXPORT TIM1_UP_TIM10_IRQHandler [WEAK] EXPORT TIM1_TRG_COM_TIM11_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT TIM2_IRQHandler [WEAK] EXPORT TIM3_IRQHandler [WEAK] EXPORT TIM4_IRQHandler [WEAK] EXPORT I2C1_EV_IRQHandler [WEAK] EXPORT I2C1_ER_IRQHandler [WEAK] EXPORT I2C2_EV_IRQHandler [WEAK] EXPORT I2C2_ER_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT SPI2_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] EXPORT USART2_IRQHandler [WEAK] EXPORT USART3_IRQHandler [WEAK] EXPORT EXTI15_10_IRQHandler [WEAK] EXPORT RTC_Alarm_IRQHandler [WEAK] EXPORT OTG_FS_WKUP_IRQHandler [WEAK] EXPORT TIM8_BRK_TIM12_IRQHandler [WEAK] EXPORT TIM8_UP_TIM13_IRQHandler [WEAK] EXPORT TIM8_TRG_COM_TIM14_IRQHandler [WEAK] EXPORT TIM8_CC_IRQHandler [WEAK] EXPORT DMA1_Stream7_IRQHandler [WEAK] EXPORT FMC_IRQHandler [WEAK] EXPORT SDIO_IRQHandler [WEAK] EXPORT TIM5_IRQHandler [WEAK] EXPORT SPI3_IRQHandler [WEAK] EXPORT UART4_IRQHandler [WEAK] EXPORT UART5_IRQHandler [WEAK] EXPORT TIM6_DAC_IRQHandler [WEAK] EXPORT TIM7_IRQHandler [WEAK] EXPORT DMA2_Stream0_IRQHandler [WEAK] EXPORT DMA2_Stream1_IRQHandler [WEAK] EXPORT DMA2_Stream2_IRQHandler [WEAK] EXPORT DMA2_Stream3_IRQHandler [WEAK] EXPORT DMA2_Stream4_IRQHandler [WEAK] EXPORT ETH_IRQHandler [WEAK] EXPORT ETH_WKUP_IRQHandler [WEAK] EXPORT CAN2_TX_IRQHandler [WEAK] EXPORT CAN2_RX0_IRQHandler [WEAK] EXPORT CAN2_RX1_IRQHandler [WEAK] EXPORT CAN2_SCE_IRQHandler [WEAK] EXPORT OTG_FS_IRQHandler [WEAK] EXPORT DMA2_Stream5_IRQHandler [WEAK] EXPORT DMA2_Stream6_IRQHandler [WEAK] EXPORT DMA2_Stream7_IRQHandler [WEAK] EXPORT USART6_IRQHandler [WEAK] EXPORT I2C3_EV_IRQHandler [WEAK] EXPORT I2C3_ER_IRQHandler [WEAK] EXPORT OTG_HS_EP1_OUT_IRQHandler [WEAK] EXPORT OTG_HS_EP1_IN_IRQHandler [WEAK] EXPORT OTG_HS_WKUP_IRQHandler [WEAK] EXPORT OTG_HS_IRQHandler [WEAK] EXPORT DCMI_IRQHandler [WEAK] EXPORT CRYP_IRQHandler [WEAK] EXPORT HASH_RNG_IRQHandler [WEAK] EXPORT FPU_IRQHandler [WEAK] EXPORT UART7_IRQHandler [WEAK] EXPORT UART8_IRQHandler [WEAK] EXPORT SPI4_IRQHandler [WEAK] EXPORT SPI5_IRQHandler [WEAK] EXPORT SPI6_IRQHandler [WEAK] EXPORT SAI1_IRQHandler [WEAK] EXPORT LTDC_IRQHandler [WEAK] EXPORT LTDC_ER_IRQHandler [WEAK] EXPORT DMA2D_IRQHandler [WEAK] EXPORT QUADSPI_IRQHandler [WEAK] EXPORT DSI_IRQHandler [WEAK] WWDG_IRQHandler PVD_IRQHandler TAMP_STAMP_IRQHandler RTC_WKUP_IRQHandler FLASH_IRQHandler RCC_IRQHandler EXTI0_IRQHandler EXTI1_IRQHandler EXTI2_IRQHandler EXTI3_IRQHandler EXTI4_IRQHandler DMA1_Stream0_IRQHandler DMA1_Stream1_IRQHandler DMA1_Stream2_IRQHandler DMA1_Stream3_IRQHandler DMA1_Stream4_IRQHandler DMA1_Stream5_IRQHandler DMA1_Stream6_IRQHandler ADC_IRQHandler CAN1_TX_IRQHandler CAN1_RX0_IRQHandler CAN1_RX1_IRQHandler CAN1_SCE_IRQHandler EXTI9_5_IRQHandler TIM1_BRK_TIM9_IRQHandler TIM1_UP_TIM10_IRQHandler TIM1_TRG_COM_TIM11_IRQHandler TIM1_CC_IRQHandler TIM2_IRQHandler TIM3_IRQHandler TIM4_IRQHandler I2C1_EV_IRQHandler I2C1_ER_IRQHandler I2C2_EV_IRQHandler I2C2_ER_IRQHandler SPI1_IRQHandler SPI2_IRQHandler USART1_IRQHandler USART2_IRQHandler USART3_IRQHandler EXTI15_10_IRQHandler RTC_Alarm_IRQHandler OTG_FS_WKUP_IRQHandler TIM8_BRK_TIM12_IRQHandler TIM8_UP_TIM13_IRQHandler TIM8_TRG_COM_TIM14_IRQHandler TIM8_CC_IRQHandler DMA1_Stream7_IRQHandler FMC_IRQHandler SDIO_IRQHandler TIM5_IRQHandler SPI3_IRQHandler UART4_IRQHandler UART5_IRQHandler TIM6_DAC_IRQHandler TIM7_IRQHandler DMA2_Stream0_IRQHandler DMA2_Stream1_IRQHandler DMA2_Stream2_IRQHandler DMA2_Stream3_IRQHandler DMA2_Stream4_IRQHandler ETH_IRQHandler ETH_WKUP_IRQHandler CAN2_TX_IRQHandler CAN2_RX0_IRQHandler CAN2_RX1_IRQHandler CAN2_SCE_IRQHandler OTG_FS_IRQHandler DMA2_Stream5_IRQHandler DMA2_Stream6_IRQHandler DMA2_Stream7_IRQHandler USART6_IRQHandler I2C3_EV_IRQHandler I2C3_ER_IRQHandler OTG_HS_EP1_OUT_IRQHandler OTG_HS_EP1_IN_IRQHandler OTG_HS_WKUP_IRQHandler OTG_HS_IRQHandler DCMI_IRQHandler CRYP_IRQHandler HASH_RNG_IRQHandler FPU_IRQHandler UART7_IRQHandler UART8_IRQHandler SPI4_IRQHandler SPI5_IRQHandler SPI6_IRQHandler SAI1_IRQHandler LTDC_IRQHandler LTDC_ER_IRQHandler DMA2D_IRQHandler QUADSPI_IRQHandler DSI_IRQHandler B . ENDP ALIGN ;******************************************************************************* ; User Stack and Heap initialization ;******************************************************************************* IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE*****
ms-iot/security
26,002
LimpetMCU/Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/arm/startup_stm32f401xc.s
;******************** (C) COPYRIGHT 2016 STMicroelectronics ******************** ;* File Name : startup_stm32f401xc.s ;* Author : MCD Application Team ;* Version : V2.4.3 ;* Date : 22-January-2016 ;* Description : STM32F401xc devices vector table for MDK-ARM 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 CortexM4 processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;* <<< Use Configuration Wizard in Context Menu >>> ;******************************************************************************* ; ;* 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. ; ;******************************************************************************* ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000200 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD MemManage_Handler ; MPU Fault Handler DCD BusFault_Handler ; Bus Fault Handler DCD UsageFault_Handler ; Usage Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD DebugMon_Handler ; Debug Monitor Handler DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD WWDG_IRQHandler ; Window WatchDog DCD PVD_IRQHandler ; PVD through EXTI Line detection DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line DCD RTC_WKUP_IRQHandler ; RTC Wakeup through the EXTI line DCD FLASH_IRQHandler ; FLASH DCD RCC_IRQHandler ; RCC DCD EXTI0_IRQHandler ; EXTI Line0 DCD EXTI1_IRQHandler ; EXTI Line1 DCD EXTI2_IRQHandler ; EXTI Line2 DCD EXTI3_IRQHandler ; EXTI Line3 DCD EXTI4_IRQHandler ; EXTI Line4 DCD DMA1_Stream0_IRQHandler ; DMA1 Stream 0 DCD DMA1_Stream1_IRQHandler ; DMA1 Stream 1 DCD DMA1_Stream2_IRQHandler ; DMA1 Stream 2 DCD DMA1_Stream3_IRQHandler ; DMA1 Stream 3 DCD DMA1_Stream4_IRQHandler ; DMA1 Stream 4 DCD DMA1_Stream5_IRQHandler ; DMA1 Stream 5 DCD DMA1_Stream6_IRQHandler ; DMA1 Stream 6 DCD ADC_IRQHandler ; ADC1, ADC2 and ADC3s DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD EXTI9_5_IRQHandler ; External Line[9:5]s DCD TIM1_BRK_TIM9_IRQHandler ; TIM1 Break and TIM9 DCD TIM1_UP_TIM10_IRQHandler ; TIM1 Update and TIM10 DCD TIM1_TRG_COM_TIM11_IRQHandler ; TIM1 Trigger and Commutation and TIM11 DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare DCD TIM2_IRQHandler ; TIM2 DCD TIM3_IRQHandler ; TIM3 DCD TIM4_IRQHandler ; TIM4 DCD I2C1_EV_IRQHandler ; I2C1 Event DCD I2C1_ER_IRQHandler ; I2C1 Error DCD I2C2_EV_IRQHandler ; I2C2 Event DCD I2C2_ER_IRQHandler ; I2C2 Error DCD SPI1_IRQHandler ; SPI1 DCD SPI2_IRQHandler ; SPI2 DCD USART1_IRQHandler ; USART1 DCD USART2_IRQHandler ; USART2 DCD 0 ; Reserved DCD EXTI15_10_IRQHandler ; External Line[15:10]s DCD RTC_Alarm_IRQHandler ; RTC Alarm (A and B) through EXTI Line DCD OTG_FS_WKUP_IRQHandler ; USB OTG FS Wakeup through EXTI line DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD DMA1_Stream7_IRQHandler ; DMA1 Stream7 DCD 0 ; Reserved DCD SDIO_IRQHandler ; SDIO DCD TIM5_IRQHandler ; TIM5 DCD SPI3_IRQHandler ; SPI3 DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD DMA2_Stream0_IRQHandler ; DMA2 Stream 0 DCD DMA2_Stream1_IRQHandler ; DMA2 Stream 1 DCD DMA2_Stream2_IRQHandler ; DMA2 Stream 2 DCD DMA2_Stream3_IRQHandler ; DMA2 Stream 3 DCD DMA2_Stream4_IRQHandler ; DMA2 Stream 4 DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD OTG_FS_IRQHandler ; USB OTG FS DCD DMA2_Stream5_IRQHandler ; DMA2 Stream 5 DCD DMA2_Stream6_IRQHandler ; DMA2 Stream 6 DCD DMA2_Stream7_IRQHandler ; DMA2 Stream 7 DCD USART6_IRQHandler ; USART6 DCD I2C3_EV_IRQHandler ; I2C3 event DCD I2C3_ER_IRQHandler ; I2C3 error DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD FPU_IRQHandler ; FPU DCD 0 ; Reserved DCD 0 ; Reserved DCD SPI4_IRQHandler ; SPI4 __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP MemManage_Handler\ PROC EXPORT MemManage_Handler [WEAK] B . ENDP BusFault_Handler\ PROC EXPORT BusFault_Handler [WEAK] B . ENDP UsageFault_Handler\ PROC EXPORT UsageFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP DebugMon_Handler\ PROC EXPORT DebugMon_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT WWDG_IRQHandler [WEAK] EXPORT PVD_IRQHandler [WEAK] EXPORT TAMP_STAMP_IRQHandler [WEAK] EXPORT RTC_WKUP_IRQHandler [WEAK] EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_IRQHandler [WEAK] EXPORT EXTI1_IRQHandler [WEAK] EXPORT EXTI2_IRQHandler [WEAK] EXPORT EXTI3_IRQHandler [WEAK] EXPORT EXTI4_IRQHandler [WEAK] EXPORT DMA1_Stream0_IRQHandler [WEAK] EXPORT DMA1_Stream1_IRQHandler [WEAK] EXPORT DMA1_Stream2_IRQHandler [WEAK] EXPORT DMA1_Stream3_IRQHandler [WEAK] EXPORT DMA1_Stream4_IRQHandler [WEAK] EXPORT DMA1_Stream5_IRQHandler [WEAK] EXPORT DMA1_Stream6_IRQHandler [WEAK] EXPORT ADC_IRQHandler [WEAK] EXPORT EXTI9_5_IRQHandler [WEAK] EXPORT TIM1_BRK_TIM9_IRQHandler [WEAK] EXPORT TIM1_UP_TIM10_IRQHandler [WEAK] EXPORT TIM1_TRG_COM_TIM11_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT TIM2_IRQHandler [WEAK] EXPORT TIM3_IRQHandler [WEAK] EXPORT TIM4_IRQHandler [WEAK] EXPORT I2C1_EV_IRQHandler [WEAK] EXPORT I2C1_ER_IRQHandler [WEAK] EXPORT I2C2_EV_IRQHandler [WEAK] EXPORT I2C2_ER_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT SPI2_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] EXPORT USART2_IRQHandler [WEAK] EXPORT EXTI15_10_IRQHandler [WEAK] EXPORT RTC_Alarm_IRQHandler [WEAK] EXPORT OTG_FS_WKUP_IRQHandler [WEAK] EXPORT DMA1_Stream7_IRQHandler [WEAK] EXPORT SDIO_IRQHandler [WEAK] EXPORT TIM5_IRQHandler [WEAK] EXPORT SPI3_IRQHandler [WEAK] EXPORT DMA2_Stream0_IRQHandler [WEAK] EXPORT DMA2_Stream1_IRQHandler [WEAK] EXPORT DMA2_Stream2_IRQHandler [WEAK] EXPORT DMA2_Stream3_IRQHandler [WEAK] EXPORT DMA2_Stream4_IRQHandler [WEAK] EXPORT OTG_FS_IRQHandler [WEAK] EXPORT DMA2_Stream5_IRQHandler [WEAK] EXPORT DMA2_Stream6_IRQHandler [WEAK] EXPORT DMA2_Stream7_IRQHandler [WEAK] EXPORT USART6_IRQHandler [WEAK] EXPORT I2C3_EV_IRQHandler [WEAK] EXPORT I2C3_ER_IRQHandler [WEAK] EXPORT FPU_IRQHandler [WEAK] EXPORT SPI4_IRQHandler [WEAK] WWDG_IRQHandler PVD_IRQHandler TAMP_STAMP_IRQHandler RTC_WKUP_IRQHandler FLASH_IRQHandler RCC_IRQHandler EXTI0_IRQHandler EXTI1_IRQHandler EXTI2_IRQHandler EXTI3_IRQHandler EXTI4_IRQHandler DMA1_Stream0_IRQHandler DMA1_Stream1_IRQHandler DMA1_Stream2_IRQHandler DMA1_Stream3_IRQHandler DMA1_Stream4_IRQHandler DMA1_Stream5_IRQHandler DMA1_Stream6_IRQHandler ADC_IRQHandler EXTI9_5_IRQHandler TIM1_BRK_TIM9_IRQHandler TIM1_UP_TIM10_IRQHandler TIM1_TRG_COM_TIM11_IRQHandler TIM1_CC_IRQHandler TIM2_IRQHandler TIM3_IRQHandler TIM4_IRQHandler I2C1_EV_IRQHandler I2C1_ER_IRQHandler I2C2_EV_IRQHandler I2C2_ER_IRQHandler SPI1_IRQHandler SPI2_IRQHandler USART1_IRQHandler USART2_IRQHandler EXTI15_10_IRQHandler RTC_Alarm_IRQHandler OTG_FS_WKUP_IRQHandler DMA1_Stream7_IRQHandler SDIO_IRQHandler TIM5_IRQHandler SPI3_IRQHandler DMA2_Stream0_IRQHandler DMA2_Stream1_IRQHandler DMA2_Stream2_IRQHandler DMA2_Stream3_IRQHandler DMA2_Stream4_IRQHandler OTG_FS_IRQHandler DMA2_Stream5_IRQHandler DMA2_Stream6_IRQHandler DMA2_Stream7_IRQHandler USART6_IRQHandler I2C3_EV_IRQHandler I2C3_ER_IRQHandler FPU_IRQHandler SPI4_IRQHandler B . ENDP ALIGN ;******************************************************************************* ; User Stack and Heap initialization ;******************************************************************************* IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE*****
ms-iot/security
29,333
LimpetMCU/Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/arm/startup_stm32f405xx.s
;******************** (C) COPYRIGHT 2016 STMicroelectronics ******************** ;* File Name : startup_stm32f405xx.s ;* Author : MCD Application Team ;* Version : V2.4.3 ;* Date : 22-January-2016 ;* Description : STM32F405xx devices vector table for MDK-ARM 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 CortexM4 processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;* <<< Use Configuration Wizard in Context Menu >>> ;******************************************************************************* ; ;* 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. ; ;******************************************************************************* ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000200 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD MemManage_Handler ; MPU Fault Handler DCD BusFault_Handler ; Bus Fault Handler DCD UsageFault_Handler ; Usage Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD DebugMon_Handler ; Debug Monitor Handler DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD WWDG_IRQHandler ; Window WatchDog DCD PVD_IRQHandler ; PVD through EXTI Line detection DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line DCD RTC_WKUP_IRQHandler ; RTC Wakeup through the EXTI line DCD FLASH_IRQHandler ; FLASH DCD RCC_IRQHandler ; RCC DCD EXTI0_IRQHandler ; EXTI Line0 DCD EXTI1_IRQHandler ; EXTI Line1 DCD EXTI2_IRQHandler ; EXTI Line2 DCD EXTI3_IRQHandler ; EXTI Line3 DCD EXTI4_IRQHandler ; EXTI Line4 DCD DMA1_Stream0_IRQHandler ; DMA1 Stream 0 DCD DMA1_Stream1_IRQHandler ; DMA1 Stream 1 DCD DMA1_Stream2_IRQHandler ; DMA1 Stream 2 DCD DMA1_Stream3_IRQHandler ; DMA1 Stream 3 DCD DMA1_Stream4_IRQHandler ; DMA1 Stream 4 DCD DMA1_Stream5_IRQHandler ; DMA1 Stream 5 DCD DMA1_Stream6_IRQHandler ; DMA1 Stream 6 DCD ADC_IRQHandler ; ADC1, ADC2 and ADC3s DCD CAN1_TX_IRQHandler ; CAN1 TX DCD CAN1_RX0_IRQHandler ; CAN1 RX0 DCD CAN1_RX1_IRQHandler ; CAN1 RX1 DCD CAN1_SCE_IRQHandler ; CAN1 SCE DCD EXTI9_5_IRQHandler ; External Line[9:5]s DCD TIM1_BRK_TIM9_IRQHandler ; TIM1 Break and TIM9 DCD TIM1_UP_TIM10_IRQHandler ; TIM1 Update and TIM10 DCD TIM1_TRG_COM_TIM11_IRQHandler ; TIM1 Trigger and Commutation and TIM11 DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare DCD TIM2_IRQHandler ; TIM2 DCD TIM3_IRQHandler ; TIM3 DCD TIM4_IRQHandler ; TIM4 DCD I2C1_EV_IRQHandler ; I2C1 Event DCD I2C1_ER_IRQHandler ; I2C1 Error DCD I2C2_EV_IRQHandler ; I2C2 Event DCD I2C2_ER_IRQHandler ; I2C2 Error DCD SPI1_IRQHandler ; SPI1 DCD SPI2_IRQHandler ; SPI2 DCD USART1_IRQHandler ; USART1 DCD USART2_IRQHandler ; USART2 DCD USART3_IRQHandler ; USART3 DCD EXTI15_10_IRQHandler ; External Line[15:10]s DCD RTC_Alarm_IRQHandler ; RTC Alarm (A and B) through EXTI Line DCD OTG_FS_WKUP_IRQHandler ; USB OTG FS Wakeup through EXTI line DCD TIM8_BRK_TIM12_IRQHandler ; TIM8 Break and TIM12 DCD TIM8_UP_TIM13_IRQHandler ; TIM8 Update and TIM13 DCD TIM8_TRG_COM_TIM14_IRQHandler ; TIM8 Trigger and Commutation and TIM14 DCD TIM8_CC_IRQHandler ; TIM8 Capture Compare DCD DMA1_Stream7_IRQHandler ; DMA1 Stream7 DCD FMC_IRQHandler ; FMC DCD SDIO_IRQHandler ; SDIO DCD TIM5_IRQHandler ; TIM5 DCD SPI3_IRQHandler ; SPI3 DCD UART4_IRQHandler ; UART4 DCD UART5_IRQHandler ; UART5 DCD TIM6_DAC_IRQHandler ; TIM6 and DAC1&2 underrun errors DCD TIM7_IRQHandler ; TIM7 DCD DMA2_Stream0_IRQHandler ; DMA2 Stream 0 DCD DMA2_Stream1_IRQHandler ; DMA2 Stream 1 DCD DMA2_Stream2_IRQHandler ; DMA2 Stream 2 DCD DMA2_Stream3_IRQHandler ; DMA2 Stream 3 DCD DMA2_Stream4_IRQHandler ; DMA2 Stream 4 DCD 0 ; Reserved DCD 0 ; Reserved DCD CAN2_TX_IRQHandler ; CAN2 TX DCD CAN2_RX0_IRQHandler ; CAN2 RX0 DCD CAN2_RX1_IRQHandler ; CAN2 RX1 DCD CAN2_SCE_IRQHandler ; CAN2 SCE DCD OTG_FS_IRQHandler ; USB OTG FS DCD DMA2_Stream5_IRQHandler ; DMA2 Stream 5 DCD DMA2_Stream6_IRQHandler ; DMA2 Stream 6 DCD DMA2_Stream7_IRQHandler ; DMA2 Stream 7 DCD USART6_IRQHandler ; USART6 DCD I2C3_EV_IRQHandler ; I2C3 event DCD I2C3_ER_IRQHandler ; I2C3 error DCD OTG_HS_EP1_OUT_IRQHandler ; USB OTG HS End Point 1 Out DCD OTG_HS_EP1_IN_IRQHandler ; USB OTG HS End Point 1 In DCD OTG_HS_WKUP_IRQHandler ; USB OTG HS Wakeup through EXTI DCD OTG_HS_IRQHandler ; USB OTG HS DCD 0 ; Reserved DCD 0 ; Reserved DCD HASH_RNG_IRQHandler ; Hash and Rng DCD FPU_IRQHandler ; FPU __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP MemManage_Handler\ PROC EXPORT MemManage_Handler [WEAK] B . ENDP BusFault_Handler\ PROC EXPORT BusFault_Handler [WEAK] B . ENDP UsageFault_Handler\ PROC EXPORT UsageFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP DebugMon_Handler\ PROC EXPORT DebugMon_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT WWDG_IRQHandler [WEAK] EXPORT PVD_IRQHandler [WEAK] EXPORT TAMP_STAMP_IRQHandler [WEAK] EXPORT RTC_WKUP_IRQHandler [WEAK] EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_IRQHandler [WEAK] EXPORT EXTI1_IRQHandler [WEAK] EXPORT EXTI2_IRQHandler [WEAK] EXPORT EXTI3_IRQHandler [WEAK] EXPORT EXTI4_IRQHandler [WEAK] EXPORT DMA1_Stream0_IRQHandler [WEAK] EXPORT DMA1_Stream1_IRQHandler [WEAK] EXPORT DMA1_Stream2_IRQHandler [WEAK] EXPORT DMA1_Stream3_IRQHandler [WEAK] EXPORT DMA1_Stream4_IRQHandler [WEAK] EXPORT DMA1_Stream5_IRQHandler [WEAK] EXPORT DMA1_Stream6_IRQHandler [WEAK] EXPORT ADC_IRQHandler [WEAK] EXPORT CAN1_TX_IRQHandler [WEAK] EXPORT CAN1_RX0_IRQHandler [WEAK] EXPORT CAN1_RX1_IRQHandler [WEAK] EXPORT CAN1_SCE_IRQHandler [WEAK] EXPORT EXTI9_5_IRQHandler [WEAK] EXPORT TIM1_BRK_TIM9_IRQHandler [WEAK] EXPORT TIM1_UP_TIM10_IRQHandler [WEAK] EXPORT TIM1_TRG_COM_TIM11_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT TIM2_IRQHandler [WEAK] EXPORT TIM3_IRQHandler [WEAK] EXPORT TIM4_IRQHandler [WEAK] EXPORT I2C1_EV_IRQHandler [WEAK] EXPORT I2C1_ER_IRQHandler [WEAK] EXPORT I2C2_EV_IRQHandler [WEAK] EXPORT I2C2_ER_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT SPI2_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] EXPORT USART2_IRQHandler [WEAK] EXPORT USART3_IRQHandler [WEAK] EXPORT EXTI15_10_IRQHandler [WEAK] EXPORT RTC_Alarm_IRQHandler [WEAK] EXPORT OTG_FS_WKUP_IRQHandler [WEAK] EXPORT TIM8_BRK_TIM12_IRQHandler [WEAK] EXPORT TIM8_UP_TIM13_IRQHandler [WEAK] EXPORT TIM8_TRG_COM_TIM14_IRQHandler [WEAK] EXPORT TIM8_CC_IRQHandler [WEAK] EXPORT DMA1_Stream7_IRQHandler [WEAK] EXPORT FMC_IRQHandler [WEAK] EXPORT SDIO_IRQHandler [WEAK] EXPORT TIM5_IRQHandler [WEAK] EXPORT SPI3_IRQHandler [WEAK] EXPORT UART4_IRQHandler [WEAK] EXPORT UART5_IRQHandler [WEAK] EXPORT TIM6_DAC_IRQHandler [WEAK] EXPORT TIM7_IRQHandler [WEAK] EXPORT DMA2_Stream0_IRQHandler [WEAK] EXPORT DMA2_Stream1_IRQHandler [WEAK] EXPORT DMA2_Stream2_IRQHandler [WEAK] EXPORT DMA2_Stream3_IRQHandler [WEAK] EXPORT DMA2_Stream4_IRQHandler [WEAK] EXPORT CAN2_TX_IRQHandler [WEAK] EXPORT CAN2_RX0_IRQHandler [WEAK] EXPORT CAN2_RX1_IRQHandler [WEAK] EXPORT CAN2_SCE_IRQHandler [WEAK] EXPORT OTG_FS_IRQHandler [WEAK] EXPORT DMA2_Stream5_IRQHandler [WEAK] EXPORT DMA2_Stream6_IRQHandler [WEAK] EXPORT DMA2_Stream7_IRQHandler [WEAK] EXPORT USART6_IRQHandler [WEAK] EXPORT I2C3_EV_IRQHandler [WEAK] EXPORT I2C3_ER_IRQHandler [WEAK] EXPORT OTG_HS_EP1_OUT_IRQHandler [WEAK] EXPORT OTG_HS_EP1_IN_IRQHandler [WEAK] EXPORT OTG_HS_WKUP_IRQHandler [WEAK] EXPORT OTG_HS_IRQHandler [WEAK] EXPORT HASH_RNG_IRQHandler [WEAK] EXPORT FPU_IRQHandler [WEAK] WWDG_IRQHandler PVD_IRQHandler TAMP_STAMP_IRQHandler RTC_WKUP_IRQHandler FLASH_IRQHandler RCC_IRQHandler EXTI0_IRQHandler EXTI1_IRQHandler EXTI2_IRQHandler EXTI3_IRQHandler EXTI4_IRQHandler DMA1_Stream0_IRQHandler DMA1_Stream1_IRQHandler DMA1_Stream2_IRQHandler DMA1_Stream3_IRQHandler DMA1_Stream4_IRQHandler DMA1_Stream5_IRQHandler DMA1_Stream6_IRQHandler ADC_IRQHandler CAN1_TX_IRQHandler CAN1_RX0_IRQHandler CAN1_RX1_IRQHandler CAN1_SCE_IRQHandler EXTI9_5_IRQHandler TIM1_BRK_TIM9_IRQHandler TIM1_UP_TIM10_IRQHandler TIM1_TRG_COM_TIM11_IRQHandler TIM1_CC_IRQHandler TIM2_IRQHandler TIM3_IRQHandler TIM4_IRQHandler I2C1_EV_IRQHandler I2C1_ER_IRQHandler I2C2_EV_IRQHandler I2C2_ER_IRQHandler SPI1_IRQHandler SPI2_IRQHandler USART1_IRQHandler USART2_IRQHandler USART3_IRQHandler EXTI15_10_IRQHandler RTC_Alarm_IRQHandler OTG_FS_WKUP_IRQHandler TIM8_BRK_TIM12_IRQHandler TIM8_UP_TIM13_IRQHandler TIM8_TRG_COM_TIM14_IRQHandler TIM8_CC_IRQHandler DMA1_Stream7_IRQHandler FMC_IRQHandler SDIO_IRQHandler TIM5_IRQHandler SPI3_IRQHandler UART4_IRQHandler UART5_IRQHandler TIM6_DAC_IRQHandler TIM7_IRQHandler DMA2_Stream0_IRQHandler DMA2_Stream1_IRQHandler DMA2_Stream2_IRQHandler DMA2_Stream3_IRQHandler DMA2_Stream4_IRQHandler CAN2_TX_IRQHandler CAN2_RX0_IRQHandler CAN2_RX1_IRQHandler CAN2_SCE_IRQHandler OTG_FS_IRQHandler DMA2_Stream5_IRQHandler DMA2_Stream6_IRQHandler DMA2_Stream7_IRQHandler USART6_IRQHandler I2C3_EV_IRQHandler I2C3_ER_IRQHandler OTG_HS_EP1_OUT_IRQHandler OTG_HS_EP1_IN_IRQHandler OTG_HS_WKUP_IRQHandler OTG_HS_IRQHandler HASH_RNG_IRQHandler FPU_IRQHandler B . ENDP ALIGN ;******************************************************************************* ; User Stack and Heap initialization ;******************************************************************************* IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE*****
ms-iot/security
18,791
LimpetMCU/Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/arm/startup_stm32f410cx.s
;******************** (C) COPYRIGHT 2016 STMicroelectronics ******************** ;* File Name : startup_stm32f410cx.s ;* Author : MCD Application Team ;* Version : V2.4.3 ;* Date : 22-January-2016 ;* Description : STM32F410Cx devices vector table for MDK-ARM 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 CortexM4 processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;* <<< Use Configuration Wizard in Context Menu >>> ;******************************************************************************* ; ;* 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. ; ;******************************************************************************* ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000200 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD MemManage_Handler ; MPU Fault Handler DCD BusFault_Handler ; Bus Fault Handler DCD UsageFault_Handler ; Usage Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD DebugMon_Handler ; Debug Monitor Handler DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD WWDG_IRQHandler ; Window WatchDog DCD PVD_IRQHandler ; PVD through EXTI Line detection DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line DCD RTC_WKUP_IRQHandler ; RTC Wakeup through the EXTI line DCD FLASH_IRQHandler ; FLASH DCD RCC_IRQHandler ; RCC DCD EXTI0_IRQHandler ; EXTI Line0 DCD EXTI1_IRQHandler ; EXTI Line1 DCD EXTI2_IRQHandler ; EXTI Line2 DCD EXTI3_IRQHandler ; EXTI Line3 DCD EXTI4_IRQHandler ; EXTI Line4 DCD DMA1_Stream0_IRQHandler ; DMA1 Stream 0 DCD DMA1_Stream1_IRQHandler ; DMA1 Stream 1 DCD DMA1_Stream2_IRQHandler ; DMA1 Stream 2 DCD DMA1_Stream3_IRQHandler ; DMA1 Stream 3 DCD DMA1_Stream4_IRQHandler ; DMA1 Stream 4 DCD DMA1_Stream5_IRQHandler ; DMA1 Stream 5 DCD DMA1_Stream6_IRQHandler ; DMA1 Stream 6 DCD ADC_IRQHandler ; ADC1, ADC2 and ADC3s DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD EXTI9_5_IRQHandler ; External Line[9:5]s DCD TIM1_BRK_TIM9_IRQHandler ; TIM1 Break and TIM9 DCD TIM1_UP_IRQHandler ; TIM1 Update DCD TIM1_TRG_COM_TIM11_IRQHandler ; TIM1 Trigger and Commutation and TIM11 DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD I2C1_EV_IRQHandler ; I2C1 Event DCD I2C1_ER_IRQHandler ; I2C1 Error DCD I2C2_EV_IRQHandler ; I2C2 Event DCD I2C2_ER_IRQHandler ; I2C2 Error DCD SPI1_IRQHandler ; SPI1 DCD SPI2_IRQHandler ; SPI2 DCD USART1_IRQHandler ; USART1 DCD USART2_IRQHandler ; USART2 DCD 0 ; Reserved DCD EXTI15_10_IRQHandler ; External Line[15:10]s DCD RTC_Alarm_IRQHandler ; RTC Alarm (A and B) through EXTI Line DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD DMA1_Stream7_IRQHandler ; DMA1 Stream7 DCD 0 ; Reserved DCD 0 ; Reserved DCD TIM5_IRQHandler ; TIM5 DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD TIM6_DAC_IRQHandler ; TIM6 and DAC DCD 0 ; Reserved DCD DMA2_Stream0_IRQHandler ; DMA2 Stream 0 DCD DMA2_Stream1_IRQHandler ; DMA2 Stream 1 DCD DMA2_Stream2_IRQHandler ; DMA2 Stream 2 DCD DMA2_Stream3_IRQHandler ; DMA2 Stream 3 DCD DMA2_Stream4_IRQHandler ; DMA2 Stream 4 DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD DMA2_Stream5_IRQHandler ; DMA2 Stream 5 DCD DMA2_Stream6_IRQHandler ; DMA2 Stream 6 DCD DMA2_Stream7_IRQHandler ; DMA2 Stream 7 DCD USART6_IRQHandler ; USART6 DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD RNG_IRQHandler ; RNG DCD FPU_IRQHandler ; FPU DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SPI5_IRQHandler ; SPI5 DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD FMPI2C1_EV_IRQHandler ; FMPI2C1 Event DCD FMPI2C1_ER_IRQHandler ; FMPI2C1 Error DCD LPTIM1_IRQHandler ; LP TIM1 __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP MemManage_Handler\ PROC EXPORT MemManage_Handler [WEAK] B . ENDP BusFault_Handler\ PROC EXPORT BusFault_Handler [WEAK] B . ENDP UsageFault_Handler\ PROC EXPORT UsageFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP DebugMon_Handler\ PROC EXPORT DebugMon_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT WWDG_IRQHandler [WEAK] EXPORT PVD_IRQHandler [WEAK] EXPORT TAMP_STAMP_IRQHandler [WEAK] EXPORT RTC_WKUP_IRQHandler [WEAK] EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_IRQHandler [WEAK] EXPORT EXTI1_IRQHandler [WEAK] EXPORT EXTI2_IRQHandler [WEAK] EXPORT EXTI3_IRQHandler [WEAK] EXPORT EXTI4_IRQHandler [WEAK] EXPORT DMA1_Stream0_IRQHandler [WEAK] EXPORT DMA1_Stream1_IRQHandler [WEAK] EXPORT DMA1_Stream2_IRQHandler [WEAK] EXPORT DMA1_Stream3_IRQHandler [WEAK] EXPORT DMA1_Stream4_IRQHandler [WEAK] EXPORT DMA1_Stream5_IRQHandler [WEAK] EXPORT DMA1_Stream6_IRQHandler [WEAK] EXPORT ADC_IRQHandler [WEAK] EXPORT EXTI9_5_IRQHandler [WEAK] EXPORT TIM1_BRK_TIM9_IRQHandler [WEAK] EXPORT TIM1_UP_IRQHandler [WEAK] EXPORT TIM1_TRG_COM_TIM11_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT I2C1_EV_IRQHandler [WEAK] EXPORT I2C1_ER_IRQHandler [WEAK] EXPORT I2C2_EV_IRQHandler [WEAK] EXPORT I2C2_ER_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT SPI2_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] EXPORT USART2_IRQHandler [WEAK] EXPORT EXTI15_10_IRQHandler [WEAK] EXPORT RTC_Alarm_IRQHandler [WEAK] EXPORT DMA1_Stream7_IRQHandler [WEAK] EXPORT TIM5_IRQHandler [WEAK] EXPORT TIM6_DAC_IRQHandler [WEAK] EXPORT DMA2_Stream0_IRQHandler [WEAK] EXPORT DMA2_Stream1_IRQHandler [WEAK] EXPORT DMA2_Stream2_IRQHandler [WEAK] EXPORT DMA2_Stream3_IRQHandler [WEAK] EXPORT DMA2_Stream4_IRQHandler [WEAK] EXPORT DMA2_Stream4_IRQHandler [WEAK] EXPORT DMA2_Stream5_IRQHandler [WEAK] EXPORT DMA2_Stream6_IRQHandler [WEAK] EXPORT DMA2_Stream7_IRQHandler [WEAK] EXPORT USART6_IRQHandler [WEAK] EXPORT RNG_IRQHandler [WEAK] EXPORT FPU_IRQHandler [WEAK] EXPORT SPI5_IRQHandler [WEAK] EXPORT FMPI2C1_EV_IRQHandler [WEAK] EXPORT FMPI2C1_ER_IRQHandler [WEAK] EXPORT LPTIM1_IRQHandler [WEAK] WWDG_IRQHandler PVD_IRQHandler TAMP_STAMP_IRQHandler RTC_WKUP_IRQHandler FLASH_IRQHandler RCC_IRQHandler EXTI0_IRQHandler EXTI1_IRQHandler EXTI2_IRQHandler EXTI3_IRQHandler EXTI4_IRQHandler DMA1_Stream0_IRQHandler DMA1_Stream1_IRQHandler DMA1_Stream2_IRQHandler DMA1_Stream3_IRQHandler DMA1_Stream4_IRQHandler DMA1_Stream5_IRQHandler DMA1_Stream6_IRQHandler ADC_IRQHandler EXTI9_5_IRQHandler TIM1_BRK_TIM9_IRQHandler TIM1_UP_IRQHandler TIM1_TRG_COM_TIM11_IRQHandler TIM1_CC_IRQHandler I2C1_EV_IRQHandler I2C1_ER_IRQHandler I2C2_EV_IRQHandler I2C2_ER_IRQHandler SPI1_IRQHandler SPI2_IRQHandler USART1_IRQHandler USART2_IRQHandler EXTI15_10_IRQHandler RTC_Alarm_IRQHandler DMA1_Stream7_IRQHandler TIM5_IRQHandler TIM6_DAC_IRQHandler DMA2_Stream0_IRQHandler DMA2_Stream1_IRQHandler DMA2_Stream2_IRQHandler DMA2_Stream3_IRQHandler DMA2_Stream4_IRQHandler DMA2_Stream5_IRQHandler DMA2_Stream6_IRQHandler DMA2_Stream7_IRQHandler USART6_IRQHandler RNG_IRQHandler FPU_IRQHandler SPI5_IRQHandler FMPI2C1_EV_IRQHandler FMPI2C1_ER_IRQHandler LPTIM1_IRQHandler B . ENDP ALIGN ;******************************************************************************* ; User Stack and Heap initialization ;******************************************************************************* IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE*****
ms-iot/security
25,844
LimpetMCU/Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/gcc/startup_stm32f439xx.s
/** ****************************************************************************** * @file startup_stm32f439xx.s * @author MCD Application Team * @version V2.4.3 * @date 22-January-2016 * @brief STM32F439xx 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 */ /* 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 FMC_IRQHandler /* FMC */ .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 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 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 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_IRQHandler /* DCMI */ .word CRYP_IRQHandler /* CRYP crypto */ .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 */ /******************************************************************************* * * 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 FMC_IRQHandler .thumb_set FMC_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 ETH_IRQHandler .thumb_set ETH_IRQHandler,Default_Handler .weak ETH_WKUP_IRQHandler .thumb_set ETH_WKUP_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 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_IRQHandler .thumb_set DCMI_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 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
ms-iot/security
21,739
LimpetMCU/Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/gcc/startup_stm32f411xe.s
/** ****************************************************************************** * @file startup_stm32f411xe.s * @author MCD Application Team * @version V2.4.3 * @date 22-January-2016 * @brief STM32F411xExx 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 */ /* 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 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .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 0 /* Reserved */ .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 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word DMA1_Stream7_IRQHandler /* DMA1 Stream7 */ .word 0 /* Reserved */ .word SDIO_IRQHandler /* SDIO */ .word TIM5_IRQHandler /* TIM5 */ .word SPI3_IRQHandler /* SPI3 */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .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 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .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 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word FPU_IRQHandler /* FPU */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word SPI4_IRQHandler /* SPI4 */ .word SPI5_IRQHandler /* SPI5 */ /******************************************************************************* * * 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 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 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 DMA1_Stream7_IRQHandler .thumb_set DMA1_Stream7_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 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 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 FPU_IRQHandler .thumb_set FPU_IRQHandler,Default_Handler .weak SPI4_IRQHandler .thumb_set SPI4_IRQHandler,Default_Handler .weak SPI5_IRQHandler .thumb_set SPI5_IRQHandler,Default_Handler /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
ms-iot/security
26,096
LimpetMCU/Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/gcc/startup_stm32f469xx.s
/** ****************************************************************************** * @file startup_stm32f469xx.s * @author MCD Application Team * @version V2.4.3 * @date 22-January-2016 * @brief STM32F469xx 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 */ /* 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 FMC_IRQHandler /* FMC */ .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 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 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 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_IRQHandler /* DCMI */ .word 0 /* Reserved */ .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 QUADSPI_IRQHandler /* QUADSPI */ .word DSI_IRQHandler /* DSI */ /******************************************************************************* * * 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 FMC_IRQHandler .thumb_set FMC_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 ETH_IRQHandler .thumb_set ETH_IRQHandler,Default_Handler .weak ETH_WKUP_IRQHandler .thumb_set ETH_WKUP_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 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_IRQHandler .thumb_set DCMI_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 QUADSPI_IRQHandler .thumb_set QUADSPI_IRQHandler,Default_Handler .weak DSI_IRQHandler .thumb_set DSI_IRQHandler,Default_Handler /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
ms-iot/security
20,308
LimpetMCU/Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/gcc/startup_stm32f410tx.s
/** ****************************************************************************** * @file startup_stm32f410tx.s * @author MCD Application Team * @version V2.4.3 * @date 22-January-2016 * @brief STM32F410Tx 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 */ /* 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 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word EXTI9_5_IRQHandler /* External Line[9:5]s */ .word TIM1_BRK_TIM9_IRQHandler /* TIM1 Break and TIM9 */ .word TIM1_UP_IRQHandler /* TIM1 Update */ .word TIM1_TRG_COM_TIM11_IRQHandler /* TIM1 Trigger and Commutation and TIM11 */ .word TIM1_CC_IRQHandler /* TIM1 Capture Compare */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .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 0 /* Reserved */ .word USART1_IRQHandler /* USART1 */ .word USART2_IRQHandler /* USART2 */ .word 0 /* Reserved */ .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 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word DMA1_Stream7_IRQHandler /* DMA1 Stream7 */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word TIM5_IRQHandler /* TIM5 */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word TIM6_DAC_IRQHandler /* TIM6 and DAC */ .word 0 /* Reserved */ .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 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .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 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word RNG_IRQHandler /* RNG */ .word FPU_IRQHandler /* FPU */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word FMPI2C1_EV_IRQHandler /* FMPI2C1 Event */ .word FMPI2C1_ER_IRQHandler /* FMPI2C1 Error */ .word LPTIM1_IRQHandler /* LP TIM1 */ /******************************************************************************* * * 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 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_IRQHandler .thumb_set TIM1_UP_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 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 USART1_IRQHandler .thumb_set USART1_IRQHandler,Default_Handler .weak USART2_IRQHandler .thumb_set USART2_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 DMA1_Stream7_IRQHandler .thumb_set DMA1_Stream7_IRQHandler,Default_Handler .weak TIM5_IRQHandler .thumb_set TIM5_IRQHandler,Default_Handler .weak TIM6_DAC_IRQHandler .thumb_set TIM6_DAC_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 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 RNG_IRQHandler .thumb_set RNG_IRQHandler,Default_Handler .weak FPU_IRQHandler .thumb_set FPU_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 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
ms-iot/security
25,737
LimpetMCU/Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/gcc/startup_stm32f429xx.s
/** ****************************************************************************** * @file startup_stm32f429xx.s * @author MCD Application Team * @version V2.4.3 * @date 22-January-2016 * @brief STM32F429xx 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 */ /* 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 FMC_IRQHandler /* FMC */ .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 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 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 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_IRQHandler /* DCMI */ .word 0 /* Reserved */ .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_IRQHandler */ .word LTDC_ER_IRQHandler /* LTDC_ER_IRQHandler */ .word DMA2D_IRQHandler /* DMA2D */ /******************************************************************************* * * 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 FMC_IRQHandler .thumb_set FMC_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 ETH_IRQHandler .thumb_set ETH_IRQHandler,Default_Handler .weak ETH_WKUP_IRQHandler .thumb_set ETH_WKUP_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 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_IRQHandler .thumb_set DCMI_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 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
ms-iot/security
21,563
LimpetMCU/Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/gcc/startup_stm32f401xe.s
/** ****************************************************************************** * @file startup_stm32f401xe.s * @author MCD Application Team * @version V2.4.3 * @date 22-January-2016 * @brief STM32F401xExx 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 */ /* 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 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .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 0 /* Reserved */ .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 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word DMA1_Stream7_IRQHandler /* DMA1 Stream7 */ .word 0 /* Reserved */ .word SDIO_IRQHandler /* SDIO */ .word TIM5_IRQHandler /* TIM5 */ .word SPI3_IRQHandler /* SPI3 */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .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 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .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 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word FPU_IRQHandler /* FPU */ .word 0 /* Reserved */ .word 0 /* Reserved */ .word SPI4_IRQHandler /* SPI4 */ /******************************************************************************* * * 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 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 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 DMA1_Stream7_IRQHandler .thumb_set DMA1_Stream7_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 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 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 FPU_IRQHandler .thumb_set FPU_IRQHandler,Default_Handler .weak SPI4_IRQHandler .thumb_set SPI4_IRQHandler,Default_Handler /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
ms-iot/security
24,364
LimpetMCU/Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/gcc/startup_stm32f417xx.s
/** ****************************************************************************** * @file startup_stm32f417xx.s * @author MCD Application Team * @version V2.4.3 * @date 22-January-2016 * @brief STM32F417xx 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 */ /* 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 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 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 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_IRQHandler /* DCMI */ .word CRYP_IRQHandler /* CRYP crypto */ .word HASH_RNG_IRQHandler /* Hash and Rng */ .word FPU_IRQHandler /* FPU */ /******************************************************************************* * * 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 ETH_IRQHandler .thumb_set ETH_IRQHandler,Default_Handler .weak ETH_WKUP_IRQHandler .thumb_set ETH_WKUP_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 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_IRQHandler .thumb_set DCMI_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 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
ms-iot/security
25,675
LimpetMCU/Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/gcc/startup_stm32f437xx.s
/** ****************************************************************************** * @file startup_stm32f437xx.s * @author MCD Application Team * @version V2.4.3 * @date 22-January-2016 * @brief STM32F437xx 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 */ /* 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 FMC_IRQHandler /* FMC */ .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 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 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 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_IRQHandler /* DCMI */ .word CRYP_IRQHandler /* CRYP crypto */ .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 0 /* Reserved */ .word 0 /* Reserved */ .word DMA2D_IRQHandler /* DMA2D */ /******************************************************************************* * * 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 FMC_IRQHandler .thumb_set FMC_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 ETH_IRQHandler .thumb_set ETH_IRQHandler,Default_Handler .weak ETH_WKUP_IRQHandler .thumb_set ETH_WKUP_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 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_IRQHandler .thumb_set DCMI_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 DMA2D_IRQHandler .thumb_set DMA2D_IRQHandler,Default_Handler /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
ms-iot/security
24,335
LimpetMCU/Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/gcc/startup_stm32f407xx.s
/** ****************************************************************************** * @file startup_stm32f407xx.s * @author MCD Application Team * @version V2.4.3 * @date 22-January-2016 * @brief STM32F407xx 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 */ /* 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 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 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 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_IRQHandler /* DCMI */ .word 0 /* CRYP crypto */ .word HASH_RNG_IRQHandler /* Hash and Rng */ .word FPU_IRQHandler /* FPU */ /******************************************************************************* * * 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 ETH_IRQHandler .thumb_set ETH_IRQHandler,Default_Handler .weak ETH_WKUP_IRQHandler .thumb_set ETH_WKUP_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 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_IRQHandler .thumb_set DCMI_IRQHandler,Default_Handler .weak HASH_RNG_IRQHandler .thumb_set HASH_RNG_IRQHandler,Default_Handler .weak FPU_IRQHandler .thumb_set FPU_IRQHandler,Default_Handler /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/