rename __CDECL16_ENTRY and EXIT
This commit is contained in:
@@ -35,7 +35,7 @@ endstruc
|
||||
|
||||
ALIGN 4, db 0x90
|
||||
GetMemoryMap:
|
||||
__CDECL16_ENTRY
|
||||
__CDECL16_PROC_ENTRY
|
||||
push es ; save segment register
|
||||
.func:
|
||||
mov dword [SteviaInfo + SteviaInfoStruct_t.MemoryMapEntries], 0
|
||||
@@ -83,11 +83,11 @@ GetMemoryMap:
|
||||
ERROR STAGE2_MM_E820_NO_SMAP
|
||||
.endp:
|
||||
pop es
|
||||
__CDECL16_EXIT
|
||||
__CDECL16_PROC_EXIT
|
||||
ret
|
||||
|
||||
PrintMemoryMap:
|
||||
__CDECL16_ENTRY
|
||||
__CDECL16_PROC_ENTRY
|
||||
.func:
|
||||
mov eax, dword [SteviaInfo + SteviaInfoStruct_t.MemoryMapEntries]
|
||||
cmp eax, 0
|
||||
@@ -106,15 +106,15 @@ PrintMemoryMap:
|
||||
; print_string strformat_buffer
|
||||
|
||||
.endp:
|
||||
__CDECL16_EXIT
|
||||
__CDECL16_PROC_EXIT
|
||||
ret
|
||||
|
||||
FormatMemoryMapEntry:
|
||||
__CDECL16_ENTRY
|
||||
__CDECL16_PROC_ENTRY
|
||||
.func:
|
||||
; create a string buffer somewhere and return address to result string in ax
|
||||
.endp:
|
||||
__CDECL16_EXIT
|
||||
__CDECL16_PROC_EXIT
|
||||
ret
|
||||
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
; Bits 6-7 - 00: HDD activity LED off; any other value is "on"
|
||||
ALIGN 4, db 0x90
|
||||
EnableA20:
|
||||
__CDECL16_ENTRY
|
||||
__CDECL16_PROC_ENTRY
|
||||
push ds
|
||||
push es
|
||||
.a20_check:
|
||||
@@ -134,7 +134,7 @@ EnableA20:
|
||||
.endp:
|
||||
pop es
|
||||
pop ds
|
||||
__CDECL16_EXIT
|
||||
__CDECL16_PROC_EXIT
|
||||
ret
|
||||
|
||||
%endif
|
||||
|
||||
@@ -76,7 +76,7 @@ endstruc
|
||||
; uint16_t count, uint8_t drive_num)
|
||||
ALIGN 4, db 0x90
|
||||
read_disk_raw:
|
||||
__CDECL16_ENTRY
|
||||
__CDECL16_PROC_ENTRY
|
||||
.func:
|
||||
mov ax, LBAPkt_t_size
|
||||
push ax ; len
|
||||
@@ -123,7 +123,7 @@ read_disk_raw:
|
||||
ERROR STAGE2_MBR_DISK_READ_ERROR
|
||||
%endif
|
||||
.endf:
|
||||
__CDECL16_EXIT
|
||||
__CDECL16_PROC_EXIT
|
||||
ret
|
||||
|
||||
%endif
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
ALIGN 4, db 0x90
|
||||
SetTextMode:
|
||||
.prolog:
|
||||
__CDECL16_ENTRY
|
||||
__CDECL16_PROC_ENTRY
|
||||
pushf
|
||||
.func:
|
||||
xor ah, ah ; Set Video mode BIOS function
|
||||
@@ -33,14 +33,14 @@ SetTextMode:
|
||||
int 0x10 ; call video interrupt
|
||||
.endp:
|
||||
popf
|
||||
__CDECL16_EXIT
|
||||
__CDECL16_PROC_EXIT
|
||||
ret
|
||||
|
||||
; disables blinking text mode cursor via crtc pokes
|
||||
; 0x3D4/0x3D5 for color, mono at 0x3B4/0x3B5
|
||||
ALIGN 4, db 0x90
|
||||
disable_cursor_crtc:
|
||||
__CDECL16_ENTRY
|
||||
__CDECL16_PROC_ENTRY
|
||||
.func:
|
||||
mov dx, 0x3D4
|
||||
mov al, 0xA ; low cursor shape register
|
||||
@@ -50,13 +50,13 @@ disable_cursor_crtc:
|
||||
mov al, 0x20 ; bits 6-7 unused, bit 5 disables the cursor, bits 0-4 control the cursor shape
|
||||
out dx, al
|
||||
.endp:
|
||||
__CDECL16_EXIT
|
||||
__CDECL16_PROC_EXIT
|
||||
ret
|
||||
|
||||
; disables blinking text mode cursor via BIOS int 10h, ah = 01
|
||||
ALIGN 4, db 0x90
|
||||
disable_cursor_bios:
|
||||
__CDECL16_ENTRY
|
||||
__CDECL16_PROC_ENTRY
|
||||
.func:
|
||||
push bx
|
||||
mov ah, 03h ; read cursor pos & shape
|
||||
@@ -68,14 +68,14 @@ disable_cursor_bios:
|
||||
int 10h
|
||||
pop bx
|
||||
.endp:
|
||||
__CDECL16_EXIT
|
||||
__CDECL16_PROC_EXIT
|
||||
ret
|
||||
|
||||
; Prints a C-Style string (null terminated) using BIOS vga teletype call
|
||||
; void PrintString(char* buf)
|
||||
ALIGN 4, db 0x90
|
||||
PrintString:
|
||||
__CDECL16_ENTRY
|
||||
__CDECL16_PROC_ENTRY
|
||||
mov di, [bp + 4] ; first arg is char[]
|
||||
.str_len:
|
||||
xor cx, cx ; ECX = 0
|
||||
@@ -101,14 +101,14 @@ PrintString:
|
||||
jcxz PrintString.endp
|
||||
jmp PrintString.print_L0 ; Fetch next character from string
|
||||
.endp:
|
||||
__CDECL16_EXIT
|
||||
__CDECL16_PROC_EXIT
|
||||
ret ; Return from procedure
|
||||
|
||||
; Prints a single character
|
||||
; void PrintCharacter(char c);
|
||||
ALIGN 4, db 0x90
|
||||
PrintCharacter:
|
||||
__CDECL16_ENTRY
|
||||
__CDECL16_PROC_ENTRY
|
||||
.func:
|
||||
mov al, byte [bp + 4] ; AL = character c
|
||||
mov ah, 0x0E ; INT 0x10, AH=0x0E call
|
||||
@@ -116,7 +116,7 @@ PrintCharacter:
|
||||
int 0x10 ; call video interrupt
|
||||
; TODO: check for carry and clear carry before call
|
||||
.endp:
|
||||
__CDECL16_EXIT
|
||||
__CDECL16_PROC_EXIT
|
||||
ret
|
||||
|
||||
; TODO: fix the prolog, epilog and stack usage to confirm with cdecl16
|
||||
@@ -124,7 +124,7 @@ PrintCharacter:
|
||||
; void PrintDWORD(uint32_t val);
|
||||
ALIGN 4, db 0x90
|
||||
PrintDWORD:
|
||||
__CDECL16_ENTRY
|
||||
__CDECL16_PROC_ENTRY
|
||||
.func:
|
||||
mov si, IntToHex_table
|
||||
mov ebx, 16 ; base-16
|
||||
@@ -166,7 +166,7 @@ PrintDWORD:
|
||||
jmp PrintDWORD.print_stack
|
||||
|
||||
.endp:
|
||||
__CDECL16_EXIT
|
||||
__CDECL16_PROC_EXIT
|
||||
ret
|
||||
%endif
|
||||
%define __INC_VIDEO
|
||||
@@ -13,8 +13,8 @@
|
||||
; You should have received a copy of the GNU General Public License
|
||||
; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
%ifnmacro __CDECL16_ENTRY
|
||||
%macro __CDECL16_ENTRY 0-1
|
||||
%ifnmacro __CDECL16_PROC_ENTRY
|
||||
%macro __CDECL16_PROC_ENTRY 0-1
|
||||
push bp
|
||||
mov bp, sp
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
%endmacro
|
||||
%endif
|
||||
|
||||
%ifnmacro __CDECL16_EXIT
|
||||
%macro __CDECL16_EXIT 0
|
||||
%ifnmacro __CDECL16_PROC_EXIT
|
||||
%macro __CDECL16_PROC_EXIT 0
|
||||
pop bx
|
||||
pop di
|
||||
pop si
|
||||
@@ -42,7 +42,6 @@
|
||||
; __CDECL16_ARGS nargs
|
||||
; Creates %$arg1 .. %$argN as [bp+4], [bp+6], ...
|
||||
; for use inside of function bodies
|
||||
;
|
||||
%ifnmacro __CDECL16_ARGS
|
||||
%macro __CDECL16_ARGS 1
|
||||
%assign %$__i 1
|
||||
@@ -112,20 +111,26 @@
|
||||
%endmacro
|
||||
%endif
|
||||
|
||||
|
||||
%ifnmacro __CDECL16_CALLER_SAVE
|
||||
%macro __CDECL16_CALLER_SAVE 0
|
||||
push ax
|
||||
push cx
|
||||
push dx
|
||||
%ifnmacro CLOB
|
||||
; e.g CLOB ax dx ... inside func entry, then UNCLOB ax dx at all exits
|
||||
; ordering is already taken care of
|
||||
; i.e if you CLOB ax cx dx then UNCLOB ax cx dx, the unclob is reversed
|
||||
%macro __CDECL16_CLOB 1-*
|
||||
%assign %$i 1
|
||||
%rep %0
|
||||
push %[%$i]
|
||||
%assign %$i %$i+1
|
||||
%endrep
|
||||
%endmacro
|
||||
%endif
|
||||
|
||||
%ifnmacro __CDECL16_CALLER_RESTORE
|
||||
%macro __CDECL16_CALLER_RESTORE 0
|
||||
pop dx
|
||||
pop cx
|
||||
pop ax
|
||||
%ifnmacro __CDECL16_UNCLOB
|
||||
%macro UNCLOB 1-*
|
||||
%assign %$i %0
|
||||
%rep %0
|
||||
pop %[%$i]
|
||||
%assign %$i %$i-1
|
||||
%endrep
|
||||
%endmacro
|
||||
%endif
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
; returns: none
|
||||
ALIGN 4, db 0x90
|
||||
InitFATDriver:
|
||||
__CDECL16_ENTRY
|
||||
__CDECL16_PROC_ENTRY
|
||||
.func:
|
||||
mov ax, FAT32_State_t_size
|
||||
push ax ; length of fat32_state structure
|
||||
@@ -70,14 +70,14 @@ InitFATDriver:
|
||||
mov eax, dword [bx + FAT32_ebpb_t.root_clus_dword]
|
||||
mov dword [di + FAT32_State_t.curr_dir_cluster_32], eax
|
||||
.endp:
|
||||
__CDECL16_EXIT
|
||||
__CDECL16_PROC_EXIT
|
||||
ret
|
||||
.error:
|
||||
ERROR STAGE2_FAT32_INIT_CF
|
||||
|
||||
ALIGN 4, db 0x90
|
||||
FSInfoPrinter:
|
||||
__CDECL16_ENTRY
|
||||
__CDECL16_PROC_ENTRY
|
||||
.func:
|
||||
;info we want to print to validate we are loading stuff from the disk correctly
|
||||
; boot_drive # (i.e 0x80)
|
||||
@@ -88,7 +88,7 @@ FSInfoPrinter:
|
||||
; print entire FAT32 state
|
||||
;
|
||||
.endp:
|
||||
__CDECL16_EXIT
|
||||
__CDECL16_PROC_EXIT
|
||||
ret
|
||||
.error:
|
||||
ERROR STAGE2_ERROR_INFOPRINTER
|
||||
@@ -104,7 +104,7 @@ FSInfoPrinter:
|
||||
; uint32_t SearchFATDIR(uint8_t* SFN);
|
||||
ALIGN 4, db 0x90
|
||||
SearchFATDIR:
|
||||
__CDECL16_ENTRY
|
||||
__CDECL16_PROC_ENTRY
|
||||
.file_lookup:
|
||||
print_string SearchFATDIR_info
|
||||
mov bx, fat32_state
|
||||
@@ -201,7 +201,7 @@ SearchFATDIR:
|
||||
mov ax, [si + FAT32_SFN_t.cluster_16_low]
|
||||
; eax == first cluster of file
|
||||
.endp:
|
||||
__CDECL16_EXIT
|
||||
__CDECL16_PROC_EXIT
|
||||
ret
|
||||
|
||||
; BUG: this function needs review
|
||||
@@ -210,7 +210,7 @@ SearchFATDIR:
|
||||
; if eax == 0x0FFFFFF7 then this is a cluster that is marked as bad
|
||||
ALIGN 4, db 0x90
|
||||
NextCluster:
|
||||
__CDECL16_ENTRY
|
||||
__CDECL16_PROC_ENTRY
|
||||
.func:
|
||||
print_string NextFATCluster_info
|
||||
|
||||
@@ -275,7 +275,7 @@ NextCluster:
|
||||
mov si, fat_buffer
|
||||
mov eax, dword [bx+si+0]
|
||||
.endp:
|
||||
__CDECL16_EXIT
|
||||
__CDECL16_PROC_EXIT
|
||||
ret
|
||||
.error_cfdivz:
|
||||
ERROR STAGE2_FAT32_NCLUS_CFDIVZ
|
||||
@@ -283,7 +283,7 @@ NextCluster:
|
||||
; uint8_t ReadFATCluster(uint16_t seg, uint16_t offset, uint32_t cluster)
|
||||
ALIGN 4, db 0x90
|
||||
ReadFATCluster:
|
||||
__CDECL16_ENTRY
|
||||
__CDECL16_PROC_ENTRY
|
||||
.func:
|
||||
print_string ReadFATCluster_info
|
||||
|
||||
@@ -318,7 +318,7 @@ ReadFATCluster:
|
||||
call read_disk_raw
|
||||
add sp, 0xC
|
||||
.endp:
|
||||
__CDECL16_EXIT
|
||||
__CDECL16_PROC_EXIT
|
||||
ret
|
||||
.error:
|
||||
ERROR STAGE2_FAT32_CLS2LBA_CF
|
||||
|
||||
@@ -12,7 +12,7 @@ endstruc
|
||||
; void arena_init(ArenaState *a)
|
||||
;
|
||||
arena_init:
|
||||
__CDECL16_ENTRY
|
||||
__CDECL16_PROC_ENTRY
|
||||
.func:
|
||||
mov ax, word [bp + 4] ; ptr to state structure
|
||||
mov di, ax
|
||||
@@ -35,7 +35,7 @@ arena_init:
|
||||
add sp, 0x6
|
||||
|
||||
.endp:
|
||||
__CDECL16_EXIT
|
||||
__CDECL16_PROC_EXIT
|
||||
ret
|
||||
|
||||
; size_t align_up(size_t x, size_t a)
|
||||
@@ -44,7 +44,7 @@ arena_init:
|
||||
; (x + (a-1)) & ~(a-1)
|
||||
; return value in ax
|
||||
arena_align_up:
|
||||
__CDECL16_ENTRY
|
||||
__CDECL16_PROC_ENTRY
|
||||
.func:
|
||||
; if a == 0 return x
|
||||
mov ax, [bp + 4] ; x
|
||||
@@ -81,7 +81,7 @@ arena_align_up:
|
||||
|
||||
mov ax, cx ; move to ax and return
|
||||
.endp:
|
||||
__CDECL16_EXIT
|
||||
__CDECL16_PROC_EXIT
|
||||
ret
|
||||
|
||||
; void* arena_alloc(size_t bytes, size_t align)
|
||||
@@ -89,7 +89,7 @@ arena_align_up:
|
||||
; bp-4 - aligned_ptr
|
||||
; bp-6 - new_end
|
||||
arena_alloc:
|
||||
__CDECL16_ENTRY 0x10
|
||||
__CDECL16_PROC_ENTRY 0x10
|
||||
.func:
|
||||
; remove bytes from pool and increment mark to the new cursor location
|
||||
; return a pointer to the begining of allocated segment
|
||||
@@ -133,36 +133,36 @@ arena_alloc:
|
||||
; return aligned_ptr
|
||||
mov ax, word [bp - 4]
|
||||
.endp:
|
||||
__CDECL16_EXIT
|
||||
__CDECL16_PROC_EXIT
|
||||
ret
|
||||
.error:
|
||||
ERROR STEVIA_DEBUG_ERR
|
||||
|
||||
arena_mark:
|
||||
__CDECL16_ENTRY
|
||||
__CDECL16_PROC_ENTRY
|
||||
.func:
|
||||
; return the current location of the 'cursor' in the allocator
|
||||
ERROR STEVIA_DEBUG_UNIMPLEMENTED
|
||||
.endp:
|
||||
__CDECL16_EXIT
|
||||
__CDECL16_PROC_EXIT
|
||||
ret
|
||||
|
||||
arena_reset_to:
|
||||
__CDECL16_ENTRY
|
||||
__CDECL16_PROC_ENTRY
|
||||
.func:
|
||||
; rewind the arena to a previously marked point
|
||||
ERROR STEVIA_DEBUG_UNIMPLEMENTED
|
||||
.endp:
|
||||
__CDECL16_EXIT
|
||||
__CDECL16_PROC_EXIT
|
||||
ret
|
||||
|
||||
arena_reset:
|
||||
__CDECL16_ENTRY
|
||||
__CDECL16_PROC_ENTRY
|
||||
.func:
|
||||
; reset the entire heap to a fresh state
|
||||
ERROR STEVIA_DEBUG_UNIMPLEMENTED
|
||||
.endp:
|
||||
__CDECL16_EXIT
|
||||
__CDECL16_PROC_EXIT
|
||||
ret
|
||||
|
||||
%endif
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
; void* kmemset_byte(void* dst, uint8_t val, uint16_t len);
|
||||
ALIGN 4, db 0x90
|
||||
kmemset:
|
||||
__CDECL16_ENTRY
|
||||
__CDECL16_PROC_ENTRY
|
||||
.func:
|
||||
mov cx, [bp + 8] ; uint16_t len
|
||||
mov al, byte [bp + 6] ; uint8_t val
|
||||
@@ -29,14 +29,14 @@ kmemset:
|
||||
rep stosb
|
||||
mov ax, di ; return pointer to dest + len (last elem of dest)
|
||||
.endp:
|
||||
__CDECL16_EXIT
|
||||
__CDECL16_PROC_EXIT
|
||||
ret
|
||||
|
||||
; uint8_t* kmemset(uint16_t* dest, uint16_t* src, uint16_t len);
|
||||
; not overlap safe
|
||||
ALIGN 4, db 0x90
|
||||
kmemcpy:
|
||||
__CDECL16_ENTRY
|
||||
__CDECL16_PROC_ENTRY
|
||||
.func:
|
||||
mov cx, [bp + 8] ; len
|
||||
mov si, [bp + 6] ; src
|
||||
@@ -46,7 +46,7 @@ kmemcpy:
|
||||
rep movsb
|
||||
mov ax, di ; return pointer to dest
|
||||
.endf:
|
||||
__CDECL16_EXIT
|
||||
__CDECL16_PROC_EXIT
|
||||
ret
|
||||
|
||||
%endif
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
; not overlap safe, only for
|
||||
ALIGN 4, db 0x90
|
||||
kmemcpy5:
|
||||
__CDECL16_ENTRY
|
||||
__CDECL16_PROC_ENTRY
|
||||
push ds
|
||||
push es
|
||||
.setup_segments:
|
||||
@@ -41,7 +41,7 @@ kmemcpy5:
|
||||
pop es
|
||||
pop ds
|
||||
.endf:
|
||||
__CDECL16_EXIT
|
||||
__CDECL16_PROC_EXIT
|
||||
ret
|
||||
|
||||
%define __INC_KMEMCPY5_FUNC
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
; word kmemset_byte(word segment, word dst, byte val, word len);
|
||||
ALIGN 4, db 0x90
|
||||
kmemset4:
|
||||
__CDECL16_ENTRY
|
||||
__CDECL16_PROC_ENTRY
|
||||
.setup_segment:
|
||||
push es
|
||||
mov ax, [bp + 4]
|
||||
@@ -35,7 +35,7 @@ kmemset4:
|
||||
.restore_segments:
|
||||
pop es
|
||||
.endf:
|
||||
__CDECL16_EXIT
|
||||
__CDECL16_PROC_EXIT
|
||||
ret
|
||||
|
||||
%endif
|
||||
|
||||
@@ -264,7 +264,7 @@ hcf:
|
||||
ALIGN 4, db 0x90
|
||||
EnterUnrealMode:
|
||||
__BOCHS_MAGIC_DEBUG
|
||||
__CDECL16_ENTRY
|
||||
__CDECL16_PROC_ENTRY
|
||||
cli ; no interrupts
|
||||
.func:
|
||||
lgdt [((__STAGE2_SEGMENT << 4) + unreal_gdt_info)] ; load unreal gdt
|
||||
@@ -301,7 +301,7 @@ EnterUnrealMode:
|
||||
; to easily access data outside of 64KiB boundries using ds/es addressing
|
||||
__TINY_DS_ES
|
||||
|
||||
__CDECL16_EXIT
|
||||
__CDECL16_PROC_EXIT
|
||||
ret
|
||||
end_text:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user