1 // Post memory manager (PMM) calls
3 // Copyright (C) 2009 Kevin O'Connor <kevin@koconnor.net>
5 // This file may be distributed under the terms of the GNU LGPLv3 license.
7 #include "util.h" // checksum
8 #include "config.h" // BUILD_BIOS_ADDR
20 extern struct pmmheader PMMHEADER;
22 #define PMM_SIGNATURE 0x4d4d5024 // $PMM
25 struct pmmheader PMMHEADER __aligned(16) VAR16EXPORT = {
27 .length = sizeof(PMMHEADER),
28 .entry_seg = SEG_BIOS,
32 #define FUNCTION_NOT_SUPPORTED 0xffffffff
36 handle_pmm00(u16 *args)
38 u32 length = *(u32*)&args[1], handle = *(u32*)&args[3];
40 dprintf(1, "pmm00: length=%x handle=%x flags=%x\n"
41 , length, handle, flags);
48 handle_pmm01(u16 *args)
50 u32 handle = *(u32*)&args[1];
51 dprintf(1, "pmm01: handle=%x\n", handle);
58 handle_pmm02(u16 *args)
60 u32 buffer = *(u32*)&args[1];
61 dprintf(1, "pmm02: buffer=%x\n", buffer);
67 handle_pmmXX(u16 *args)
69 return FUNCTION_NOT_SUPPORTED;
76 return FUNCTION_NOT_SUPPORTED;
79 dprintf(DEBUG_HDL_pmm, "pmm call arg1=%x\n", arg1);
82 case 0x00: return handle_pmm00(args);
83 case 0x01: return handle_pmm01(args);
84 case 0x02: return handle_pmm02(args);
85 default: return handle_pmmXX(args);
90 extern void entry_pmm();
98 dprintf(3, "init PMM\n");
100 PMMHEADER.signature = PMM_SIGNATURE;
101 PMMHEADER.entry_offset = (u32)entry_pmm - BUILD_BIOS_ADDR;
102 PMMHEADER.checksum -= checksum(&PMMHEADER, sizeof(PMMHEADER));
111 dprintf(3, "finalize PMM\n");
113 PMMHEADER.signature = 0;
114 PMMHEADER.entry_offset = 0;
116 // XXX - zero low-memory allocations.