📄 lib386.t
字号:
06212 push eax06213 jmp edx06214 1:06215 .extern EODDZ06216 .extern .trp06217 mov eax,EODDZ06218 push edx06219 jmp .trp++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/lib/i386/em/em_sri.s ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++06300 .sect .text; .sect .rom; .sect .data; .sect .bss06301 .sect .text06302 .define .sri06303 06304 ! #bytes in eax06305 .sri:06306 pop edx ! return address06307 cmp eax,406308 jne 1f06309 pop eax06310 pop ecx06311 sar eax,cl06312 push eax06313 jmp edx06314 1:06315 .extern EODDZ06316 .extern .trp06317 mov eax,EODDZ06318 push edx06319 jmp .trp.Ep 34 src/lib/i386/em/em_sti.s++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/lib/i386/em/em_sti.s ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++06400 .sect .text; .sect .rom; .sect .data; .sect .bss06401 .sect .text06402 .define .sti06403 .define .sts06404 06405 ! #bytes in ecx06406 ! address in ebx06407 ! save edi/esi. they might be register variables06408 .sts:06409 pop edx06410 sar ecx,106411 jnb 1f06412 pop eax06413 movb (ebx),al06414 jmp edx06415 1:06416 sar ecx,106417 jnb 1f06418 pop eax06419 o16 mov (ebx),ax06420 jmp edx06421 1:06422 push edx06423 mov edx,edi06424 mov edi,ebx06425 pop ebx06426 jmp 1f06427 .sti:06428 ! only called with count >> 406429 mov edx,edi06430 mov edi,ebx06431 pop ebx06432 sar ecx,206433 1:06434 mov eax,esi06435 mov esi,esp06436 rep movs06437 mov esp,esi06438 mov edi,edx06439 mov esi,eax06440 jmp ebx.Op 35 src/lib/i386/em/em_stop.s++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/lib/i386/em/em_stop.s ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++06500 .sect .text; .sect .rom; .sect .data; .sect .bss06501 .sect .text06502 .define .stop06503 .stop:06504 jmp ___exit++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/lib/i386/em/em_strhp.s ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++06600 .sect .text; .sect .rom; .sect .data; .sect .bss06601 .sect .text06602 .define .strhp06603 .extern .reghp, .limhp, EHEAP, .trp06604 06605 .strhp:06606 pop ebx06607 pop eax06608 mov (.reghp),eax06609 cmp eax,(.limhp)06610 jb 1f06611 add eax,0200006612 and eax,~077706613 push ebx06614 push eax06615 call __brk06616 pop ecx06617 pop ebx06618 cmp eax,-106619 je 2f06620 1:06621 mov (.limhp),ecx06622 jmp ebx06623 2:06624 mov eax,EHEAP06625 push ebx06626 jmp .trp.Ep 36 src/lib/i386/em/em_trp.s++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/lib/i386/em/em_trp.s ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++06700 .sect .text; .sect .rom; .sect .data; .sect .bss06701 .sect .text06702 .define .trp06703 .extern .trppc, .stop06704 06705 ! eax is trap number06706 .trp:06707 xor ebx,ebx06708 xchg ebx,(.trppc)06709 test ebx,ebx06710 jz 2f06711 push eax06712 call ebx06713 pop eax06714 ret06715 2:06716 push eax06717 call .stop++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/lib/i386/em/em_unknown.s ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++06800 .sect .text; .sect .rom; .sect .data; .sect .bss06801 .sect .text06802 .define .unknown06803 .extern EILLINS, .fat06804 06805 .unknown:06806 mov eax,EILLINS06807 push eax06808 jmp .fat++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/lib/i386/em/em_xor.s ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++06900 .sect .text; .sect .rom; .sect .data; .sect .bss06901 .sect .text06902 .define .xor06903 06904 ! #bytes in ecx06905 .xor:06906 pop ebx ! return address06907 mov edx,edi06908 mov edi,esp06909 add edi,ecx06910 sar ecx,206911 1:06912 pop eax06913 xor eax,(edi)06914 stos.Op 37 src/lib/i386/em/em_xor.s06915 loop 1b06916 mov edi,edx06917 jmp ebx++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/lib/i386/head/em_abs.h ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++07000 /* $Header: em_abs.h,v 1.3 87/03/10 08:58:45 ceriel Exp $ */07001 /*07002 * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.07003 * See the copyright notice in the ACK home directory, in the file "Copyright".07004 */07005 #define LINO_AD 007006 #define FILN_AD 407007 07008 #define LINO (*(int *)(_hol0()+LINO_AD))07009 #define FILN (*(char **)(_hol0()+FILN_AD))07010 07011 #define EARRAY 007012 #define ERANGE 107013 #define ESET 207014 #define EIOVFL 307015 #define EFOVFL 407016 #define EFUNFL 507017 #define EIDIVZ 607018 #define EFDIVZ 707019 #define EIUND 807020 #define EFUND 907021 #define ECONV 1007022 07023 #define ESTACK 1607024 #define EHEAP 1707025 #define EILLINS 1807026 #define EODDZ 1907027 #define ECASE 2007028 #define EMEMFLT 2107029 #define EBADPTR 2207030 #define EBADPC 2307031 #define EBADLAE 2407032 #define EBADMON 2507033 #define EBADLIN 2607034 #define EBADGTO 27.Ep 38 src/lib/i386/head/em_head.s++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/lib/i386/head/em_head.s ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++07100 #07101 .sect .text; .sect .rom; .sect .data; .sect .bss07102 .define ERANGE,ESET,EHEAP,ECASE,EILLINS,EIDIVZ,EODDZ07103 .define .trppc, .ignmask07104 07105 ERANGE = 107106 ESET = 207107 EIDIVZ = 607108 EHEAP = 1707109 EILLINS = 1807110 EODDZ = 1907111 ECASE = 2007112 07113 #include <em_abs.h>07114 07115 .sect .data07116 .trppc:07117 .data4 007118 .ignmask:07119 .data4 EIOVFL | EIUND | ECONV | EFOVFL | EFUNFL++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/lib/i386/misc/alloca.s ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++07200 #07201 ! alloca() - allocate space on the stack Author: Kees J. Bot07202 ! 2 Dec 199307203 .sect .text; .sect .rom; .sect .data; .sect .bss07204 07205 .sect .text07206 .align 1607207 .define _alloca07208 _alloca:07209 #if __ACK__07210 pop ecx ! Return address07211 pop eax ! Bytes to allocate07212 add eax, 2*4+3 ! Add space for two saved register variables07213 andb al, 0xFC ! Align07214 mov ebx, esp ! Keep current esp07215 sub esp, eax ! Lower stack07216 mov eax, esp ! Return value07217 push 4(ebx) ! Push what is probably the saved esi07218 push (ebx) ! Saved edi07219 ! Now ACK can still do:07220 ! pop edi; pop esi; leave; ret07221 push eax ! Dummy argument07222 jmp ecx07223 #else07224 pop ecx ! Return address.Op 39 src/lib/i386/misc/alloca.s07225 pop eax ! Bytes to allocate07226 add eax, 307227 andb al, 0xFC ! Align07228 sub esp, eax ! Lower stack07229 mov eax, esp ! Return value07230 push eax ! Dummy argument07231 jmp ecx07232 #endif++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/lib/i386/misc/getprocessor.s ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++07300 ! getprocessor() - determine processor type Author: Kees J. Bot07301 ! 26 Jan 199407302 07303 .sect .text; .sect .rom; .sect .data; .sect .bss07304 .sect .text07305 07306 ! int getprocessor(void);07307 ! Return 386, 486, 586, ...07308 07309 .define _getprocessor07310 07311 _getprocessor:07312 push ebp07313 mov ebp, esp07314 and esp, 0xFFFFFFFC ! Align stack to avoid AC fault07315 mov ecx, 0x00040000 ! Try to flip the AC bit introduced on the 48607316 call flip07317 mov eax, 386 ! 386 if it didn't react to "flipping"07318 jz gotprocessor07319 mov ecx, 0x00200000 ! Try to flip the ID bit introduced on the 58607320 call flip07321 mov eax, 486 ! 486 if it didn't react07322 jz gotprocessor07323 pushf07324 pusha ! Save the world07325 mov eax, 107326 .data1 0x0F, 0xA2 ! CPUID instruction tells the processor type07327 andb ah, 0x0F ! Extract the family (5, 6, ...)07328 movzxb eax, ah07329 imul eax, 100 ! 500, 600, ...07330 add eax, 86 ! 586, 686, ...07331 mov 7*4(esp), eax ! Pass eax through07332 popa07333 popf07334 gotprocessor:07335 leave07336 ret07337 07338 flip:07339 pushf ! Push eflags07340 pop eax ! eax = eflags07341 mov edx, eax ! Save original eflags07342 xor eax, ecx ! Flip the bit to test07343 push eax ! Push modified eflags value07344 popf ! Load modified eflags register.Ep 40 src/lib/i386/misc/getprocessor.s07345 pushf07346 pop eax ! Get it again07347 push edx07348 popf ! Restore original eflags register07349 xor eax, edx ! See if the bit changed07350 test eax, ecx07351 ret++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/lib/i386/misc/iolib.s ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++07400 ! Some I/O related routines like:07401 ! unsigned char inb(int port);07402 ! unsigned short inw(int port);07403 ! void outb(int port, int value);07404 ! void outw(int port, int value);07405 ! void rep_inb(int port, unsigned char *buf, size_t count);07406 ! void rep_inw(int port, unsigned short *buf, size_t count);07407 ! void rep_outb(int port, unsigned char *buf, size_t count);07408 ! void rep_outw(int port, unsigned short *buf, size_t count);07409 ! void intr_enable(void);07410 ! void intr_disable(void);07411 07412 .sect .text; .sect .rom; .sect .data; .sect .bss07413 07414 .sect .text07415 .define _inb07416 _inb:07417 push ebp07418 mov ebp, esp07419 mov edx, 8(ebp) ! port07420 xor eax, eax07421 inb dx ! read 1 byte07422 pop ebp07423 ret07424 07425 .define _inw07426 _inw:07427 push ebp07428 mov ebp, esp07429 mov edx, 8(ebp) ! port07430 xor eax, eax07431 o16 in dx ! read 1 word07432 pop ebp07433 ret07434 07435 .define _outb07436 _outb:07437 push ebp07438 mov ebp, esp07439 mov edx, 8(ebp) ! port07440 mov eax, 8+4(ebp) ! value07441 outb dx ! output 1 byte07442 pop ebp07443 ret07444 .Op 41 src/lib/i386/misc/iolib.s07445 .define _outw07446 _outw:07447 push ebp07448 mov ebp, esp07449 mov edx, 8(ebp) ! port07450 mov eax, 8+4(ebp) ! value07451 o16 out dx ! output 1 word07452 pop ebp07453 ret07454 07455 .define _rep_inb07456 _rep_inb:07457 push ebp07458 mov ebp, esp07459 push edi07460 mov edx, 8(ebp) ! port07461 mov edi, 12(ebp) ! buf07462 mov ecx, 16(ebp) ! byte count07463 rep07464 inb dx ! input many bytes07465 pop edi07466 pop ebp07467 ret07468 07469 .define _rep_inw07470 _rep_inw:07471 push ebp07472 mov ebp, esp07473 push edi07474 mov edx, 8(ebp) ! port07475 mov edi, 12(ebp) ! buf07476 mov ecx, 16(ebp) ! byte count07477 shr ecx, 1 ! word count07478 rep07479 o16 in dx
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -