3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; version 2 of the License.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #include <psl1ght/lv2/net.h>
22 #include <udp_printf.h>
25 * GameOS system manager object in HV process 9
27 #define GAMEOS_SYSMGR_OFFSET 0x000a5dd0ull
30 * log2 of boot memory size for GameOS (3.41)
32 #define LOG2_PAGE_SIZE_OFFSET (GAMEOS_SYSMGR_OFFSET + 0x1b0ull)
33 #define LOG2_PAGE_SIZE 0x0000001bull
36 * Ability mask for GameOS (3.41)
38 #define ABILITY_MASK_OFFSET (GAMEOS_SYSMGR_OFFSET + 0x1c0ull)
39 #define IOS_NET_EURUS_LPAR_BIT_MASK (1ull << 9)
44 #define SLL_LOAD_LV2_OFFSET 0x00165e44ull
46 static uint8_t otheros_bootloader_loader
[] = {
47 #include "otheros_bootloader_loader.hex"
53 int main(int argc
, char **argv
)
55 uint64_t ability_mask
;
62 PRINTF("%s:%d: start\n", __func__
, __LINE__
);
64 PRINTF("%s:%d: OtherOS bootloader loader size (0x%08x)\n",
65 __func__
, __LINE__
, sizeof(otheros_bootloader_loader
));
69 PRINTF("%s:%d: lv1_map failed (0x%08x)\n", __func__
, __LINE__
, result
);
73 PRINTF("%s:%d: patching log2 page size\n", __func__
, __LINE__
);
75 lv1_poke(LOG2_PAGE_SIZE_OFFSET
, LOG2_PAGE_SIZE
);
78 * Patch ios.net.eurus.lpar bit in ability mask because GameOS uses HV calls 195 and 196
79 * to access PS3 gelic wireless device but Linux uses HV call lv1_net_control !!!
82 PRINTF("%s:%d: patching ios.net.eurus.lpar bit in ability mask\n", __func__
, __LINE__
);
84 ability_mask
= lv1_peek(ABILITY_MASK_OFFSET
);
85 ability_mask
&= ~IOS_NET_EURUS_LPAR_BIT_MASK
;
86 lv1_poke(ABILITY_MASK_OFFSET
, ability_mask
);
88 PRINTF("%s:%d: patching sll load lv2\n", __func__
, __LINE__
);
90 lv1_memcpy_to(SLL_LOAD_LV2_OFFSET
, otheros_bootloader_loader
, sizeof(otheros_bootloader_loader
));
92 PRINTF("%s:%d: end\n", __func__
, __LINE__
);
98 PRINTF("%s:%d: lv1_unmap failed (0x%08x)\n", __func__
, __LINE__
, result
);