func.s
来自「一个微型操作系统源码」· S 代码 · 共 62 行
S
62 行
[segment .text][BITS 32]%imacro EXPORT 1 GLOBAL %1 align 4 %1:%endmacro; unsigned char get_byte(unsigned short sel, unsigned long addr)EXPORT get_byte mov ax, [esp+4] mov gs, ax mov edx, [esp+8] xor eax, eax mov al, byte [gs:edx] ret; unsigned short get_word(unsigned short sel, unsigned long addr)EXPORT get_word mov ax, [esp+4] mov gs, ax mov edx, [esp+8] xor eax, eax mov ax, word [gs:edx] ret; unsigned long get_long(unsigned short sel, unsigned long addr)EXPORT get_long mov ax, [esp+4] mov gs, ax mov edx, [esp+8] mov eax, dword [gs:edx] ret; void put_byte(unsigned short sel, unsigned long addr, unsigned char val)EXPORT put_byte mov ax, [esp+4] mov gs, ax mov edx, [esp+8] mov al, byte [esp+12] mov [gs:edx], al ret; void put_word(unsigned short sel, unsigned long addr, unsigned short val)EXPORT put_word mov ax, [esp+4] mov gs, ax mov edx, [esp+8] mov ax, word [esp+12] mov [gs:edx], ax ret; void put_long(unsigned short sel, unsigned long addr, unsigned long val)EXPORT put_long mov ax, [esp+4] mov gs, ax mov edx, [esp+8] mov eax, [esp+12] mov [gs:edx], eax ret
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?