Code: Select all
;restart patch for Mac OS X 10.5.2 (vanilla mach_kernel 9.2.2)
;author: byuu
;license: public domain
;date: 2008-04-28
;assemble with "yasm -f bin restart.asm -o restart.bin"
bits 32
%define base 0x09d80e
%define relative(n) n - (base + $ - zero)
zero:
push ebp
mov ebp,esp
sub esp,24
mov eax,[ebp+8]
test eax,eax
je .shutdown
.restart
mov dword[esp],0x4621f4
call relative(0x0232f8)
; mov dword[esp],1
xor eax,eax
inc eax
mov [esp],eax
call relative(0x32066a)
; jmp .hang
mov al,0xfe
out 0x64,al
hlt
.shutdown
mov dword[esp],0x462204
call relative(0x0232f8)
; mov dword[esp],0
xor eax,eax
mov [esp],eax
call relative(0x32066a)
.hang
jmp .hang
;original:
;offset hex
;09d80e 55 89 e5 83 ec 18 8b 45 08 85 c0 74 1a c7 04 24
;09d81e f4 21 46 00 e8 d1 5a f8 ff c7 04 24 01 00 00 00
;09d82e e8 37 2e 28 00 eb 18 c7 04 24 04 22 46 00 e8 b7
;09d83e 5a f8 ff c7 04 24 00 00 00 00 e8 1d 2e 28 00 eb
;09d84e fe
;modified:
;offset hex
;09d80e 55 89 e5 83 ec 18 8b 45 08 85 c0 74 1c c7 04 24
;09d81e f4 21 46 00 e8 d1 5a f8 ff 31 c0 40 89 04 24 e8
;09d82e 38 2e 28 00 b0 fe e6 64 f4 c7 04 24 04 22 46 00
;09d83e e8 b5 5a f8 ff 31 c0 89 04 24 e8 1d 2e 28 00 eb
;09d84e fe