[SeaBIOS] [RFC][PATCH 2/2] Add another test function and call tests from 16 bit.

Stefan Berger stefanb at linux.vnet.ibm.com
Mon Nov 22 18:09:33 CET 2010


The following patch adds another test function, 'hello_world' to the 32 
bit functions. The intention is to show what needs to be done to support 
one more function call -- not much. This and the already-existing test 
function are then called from handle_1a in 16 bit space.

After enabling the debugging output, the following then becomes visible:

handle_1a at 0x00008356
Calling hello world
Hello world at 0x7ffe48f3
test at 0x7ffe4905
a=7,b=8,c=9,d=10,e=11,f=12
Result from upcall res=56

The result 'res' is the result of a*b.

Signed-off-by: Stefan Berger <stefanb at us.ibm.com>

---
  src/clock.c  |    5 +++++
  src/upcall.c |    5 +++++
  2 files changed, 10 insertions(+)

Index: seabios/src/clock.c
===================================================================
--- seabios.orig/src/clock.c
+++ seabios/src/clock.c
@@ -13,6 +13,7 @@
  #include "bregs.h" // struct bregs
  #include "biosvar.h" // GET_GLOBAL
  #include "usb-hid.h" // usb_check_event
+#include "upcall.h"

  // RTC register flags
  #define RTC_A_UIP 0x80
@@ -445,6 +446,10 @@ handle_1aXX(struct bregs *regs)
  void VISIBLE16
  handle_1a(struct bregs *regs)
  {
+dprintf(1, "handle_1a at %p\n", handle_1a);
+dprintf(1,"Calling hello world\n");
+hello_world();
+dprintf(1,"Result from upcall res=%d\n", test_highbios(7,8,9,10,11,12));
      debug_enter(regs, DEBUG_HDL_1a);
      switch (regs->ah) {
      case 0x00: handle_1a00(regs); break;
Index: seabios/src/upcall.c
===================================================================
--- seabios.orig/src/upcall.c
+++ seabios/src/upcall.c
@@ -11,6 +11,11 @@ test_highbios(u8 a, u16 b, u32 c, u8 d,
      return a*b;
  }

+void
+hello_world(void)
+{
+    dprintf(1,"Hello world at %p\n", hello_world);
+}

  #define FUNC(IDX, NUMPARMS, RETTYPE, NAME, PARMS ...) \
      [IDX] = NAME,
Index: seabios/src/upcall_protos.h
===================================================================
--- seabios.orig/src/upcall_protos.h
+++ seabios/src/upcall_protos.h
@@ -6,7 +6,9 @@
  /* all function names below must be expanded with _upcall */

  # define test_highbios test_highbios_upcall
+# define hello_world   hello_world_upcall

  #endif

  FUNC(0, 6, int , test_highbios, u8 a, u16 b, u32 c,u8 d, u16 e, int f)
+FUNC(1, 0, void, hello_world  , void)
\ No newline at end of file



More information about the SeaBIOS mailing list