summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/bcopy32.inc3
-rw-r--r--core/extern.inc15
-rw-r--r--core/head.inc1
-rw-r--r--core/parseconfig.inc4
-rw-r--r--core/pm.inc6
-rw-r--r--core/pmcall.inc12
-rw-r--r--core/rllpack.c4
-rw-r--r--core/rllpack.inc52
-rw-r--r--core/ui.inc8
9 files changed, 36 insertions, 69 deletions
diff --git a/core/bcopy32.inc b/core/bcopy32.inc
index 00f6b7e2..6537546b 100644
--- a/core/bcopy32.inc
+++ b/core/bcopy32.inc
@@ -45,8 +45,7 @@
; EDI - first byte after target
;
bcopy: jecxz .ret
- push dword pm_bcopy
- call pm_call
+ pm_call pm_bcopy
add edi,ecx
add esi,ecx
.ret: ret
diff --git a/core/extern.inc b/core/extern.inc
new file mode 100644
index 00000000..f765cffe
--- /dev/null
+++ b/core/extern.inc
@@ -0,0 +1,15 @@
+;
+; extern.inc
+;
+; Prototypes for external functions
+
+%ifndef EXTERN_INC
+%define EXTERN_INC
+
+ ; rllpack.c
+ extern rllpack, rllunpack
+
+ ; hello.c
+ extern hello
+
+%endif ; EXTERN_INC
diff --git a/core/head.inc b/core/head.inc
index 2753a42e..ff62b602 100644
--- a/core/head.inc
+++ b/core/head.inc
@@ -24,6 +24,7 @@
%include "config.inc"
%include "layout.inc"
%include "pmcall.inc"
+%include "extern.inc"
%include "kernel.inc"
%include "bios.inc"
%include "tracers.inc"
diff --git a/core/parseconfig.inc b/core/parseconfig.inc
index 8dea6b3f..77afaa65 100644
--- a/core/parseconfig.inc
+++ b/core/parseconfig.inc
@@ -426,7 +426,7 @@ commit_vk:
mov esi,VKernelBuf
mov edi,[VKernelEnd]
mov ecx,vk_size
- call rllpack
+ pm_call rllpack
mov [VKernelEnd],edi
.nolabel:
ret
@@ -474,5 +474,3 @@ IPAppend db 0 ; Default IPAPPEND option
command_line resb max_cmd_len+2 ; Command line buffer
alignb 4
default_cmd resb max_cmd_len+1 ; "default" command line
-
-%include "rllpack.inc"
diff --git a/core/pm.inc b/core/pm.inc
index f5bcc5b7..3b7dab48 100644
--- a/core/pm.inc
+++ b/core/pm.inc
@@ -22,7 +22,7 @@
section .text16
;
-; pm_call: call PM routine in low memory from RM
+; _pm_call: call PM routine in low memory from RM
;
; on stack = PM routine to call (a 32-bit address)
;
@@ -32,8 +32,10 @@
;
; All registers and the flags saved/restored
;
+; This routine is invoked by the pm_call macro.
+;
bits 16
-pm_call:
+_pm_call:
pushfd
pushad
push ds
diff --git a/core/pmcall.inc b/core/pmcall.inc
index 29050500..0a580150 100644
--- a/core/pmcall.inc
+++ b/core/pmcall.inc
@@ -5,8 +5,8 @@
;; as the RM frame pointer.
;;
-%ifndef PMCALL_H
-%define PMCALL_H
+%ifndef PMCALL_INC
+%define PMCALL_INC
%define RM_GS word [ebp]
%define RM_FS word [ebp+2]
@@ -61,4 +61,10 @@
%define RM_FLAGSL byte [ebp+40]
%define RM_FLAGSH byte [ebp+41]
-%endif ; PMCALL_H
+; Convenience macro to call a PM function
+%macro pm_call 1
+ push dword %1
+ call _pm_call
+%endmacro
+
+%endif ; PMCALL_INC
diff --git a/core/rllpack.c b/core/rllpack.c
index fa504c75..26613916 100644
--- a/core/rllpack.c
+++ b/core/rllpack.c
@@ -31,7 +31,7 @@
#include <stddef.h>
#include <string.h>
-void pm_rllpack(com32sys_t *regs)
+void rllpack(com32sys_t *regs)
{
uint8_t *i = (uint8_t *)(regs->esi.l);
uint8_t *o = (uint8_t *)(regs->edi.l);
@@ -77,7 +77,7 @@ void pm_rllpack(com32sys_t *regs)
regs->edi.l = (size_t)o;
}
-void pm_rllunpack(com32sys_t *regs)
+void rllunpack(com32sys_t *regs)
{
uint8_t *i = (uint8_t *)regs->esi.l;
uint8_t *o = (uint8_t *)regs->edi.l;
diff --git a/core/rllpack.inc b/core/rllpack.inc
deleted file mode 100644
index 63140a18..00000000
--- a/core/rllpack.inc
+++ /dev/null
@@ -1,52 +0,0 @@
-; -*- fundamental -*- ---------------------------------------------------
-;
-; Copyright 2007-2009 H. Peter Anvin - All Rights Reserved
-; Copyright 2009 Intel Corporation; author: H. Peter Anvin
-;
-; This program is free software; you can redistribute it and/or modify
-; it under the terms of the GNU General Public License as published by
-; the Free Software Foundation, Inc., 53 Temple Place Ste 330,
-; Boston MA 02111-1307, USA; either version 2 of the License, or
-; (at your option) any later version; incorporated herein by reference.
-;
-; -----------------------------------------------------------------------
-
-;
-; rllpack.inc
-;
-; Very simple RLL compressor/decompressor, used to pack binary structures
-; together.
-;
-; Format of leading byte
-; 1-128 = x verbatim bytes follow
-; 129-223 = (x-126) times subsequent byte
-; 224-255 = (x-224)*256+(next byte) times the following byte
-; 0 = end of data
-;
-; These structures are stored *in reverse order* in high memory.
-; High memory pointers point to one byte beyond the end.
-;
-
- section .text16
-
-;
-; rllpack:
-; Pack ECX bytes from ESI into EDI.
-; Returns updated ESI and EDI.
-;
-rllpack:
- extern pm_rllpack
- push dword pm_rllpack
- call pm_call
- ret
-;
-; rllunpack:
-; Unpack bytes from ESI into EDI
-; On return ESI, EDI are updated and
-; ECX contains number of bytes output.
-;
-rllunpack:
- extern pm_rllunpack
- push dword pm_rllunpack
- call pm_call
- ret
diff --git a/core/ui.inc b/core/ui.inc
index 7f3106a4..5ac8d8c2 100644
--- a/core/ui.inc
+++ b/core/ui.inc
@@ -46,9 +46,7 @@ no_config_file:
.no_bootonce:
; *** TEST HACK ***
- extern hello
- push dword hello
- call pm_call
+ pm_call hello
;
; Check whether or not we are supposed to display the boot prompt.
@@ -167,7 +165,7 @@ display_labels:
push cx ; save command line size
mov edi,VKernelBuf
- call rllunpack
+ pm_call rllunpack
; ESI updated on return
sub di,cx ; Return to beginning of buf
@@ -356,7 +354,7 @@ vk_check:
jbe .not_vk
mov edi,VKernelBuf
- call rllunpack
+ pm_call rllunpack
; ESI updated on return
sub di,cx ; Return to beginning of buf