A method for patching a chip, wherein the chip comprises a first program, and the method comprises: when a function that needs to be replaced in the first program is run, determining whether a distance between an address of the function that needs to be replaced and an address of a patch function of the function that needs to be replaced exceeds a short address range that can be jumped by a jump instruction; under a case that the distance between the address of the function that needs to be replaced and the address of the patch function exceeds the short address range, executing an interrupt service routine according to a pre-stored correspondence relationship between the address of the function that needs to be replaced and an interrupt instruction, wherein the interrupt service routine is a service routine scheduled by an interrupt instruction corresponding to the function that needs to be replaced, and a return address of the interrupt service routine is the address of the patch function; or under a case that the distance between the address of the function that needs to be replaced and the address of the patch function does not exceed the short address range, jumping to an address of a patch function of the function that needs to be replaced using a jump instruction and running the patch function according to the address of the patch function, to perform patch processing on the first program; wherein when the function that needs to be replaced in the first program is run, executing the interrupt service routine according to the pre-stored correspondence relationship between the address of the function that needs to be replaced and the interrupt instruction comprises: when the function that needs to be replaced in the first program is run, determining an interrupt instruction corresponding to the function that needs to be replaced according to the pre-stored correspondence relationship between the address of the function that needs to be replaced and the interrupt instruction; determining an interrupt number according to the interrupt instruction; and executing the interrupt service routine corresponding to the interrupt number according to the interrupt number; wherein after running the patch function according to the address of the patch function, the method further comprises: running a next function of the function that needs to be replaced in the first program. when a function that needs to be replaced in the first program is run, determining whether a distance between an address of the function that needs to be replaced and an address of a patch function of the function that needs to be replaced exceeds a short address range that can be jumped by a jump instruction; under a case that the distance between the address of the function that needs to be replaced and the address of the patch function exceeds the short address range, executing an interrupt service routine according to a pre-stored correspondence relationship between the address of the function that needs to be replaced and an interrupt instruction, wherein the interrupt service routine is a service routine scheduled by an interrupt instruction corresponding to the function that needs to be replaced, and a return address of the interrupt service routine is the address of the patch function; or under a case that the distance between the address of the function that needs to be replaced and the address of the patch function does not exceed the short address range, jumping to an address of a patch function of the function that needs to be replaced using a jump instruction and running the patch function according to the address of the patch function, to perform patch processing on the first program; wherein when the function that needs to be replaced in the first program is run, executing the interrupt service routine according to the pre-stored correspondence relationship between the address of the function that needs to be replaced and the interrupt instruction comprises: when the function that needs to be replaced in the first program is run, determining an interrupt instruction corresponding to the function that needs to be replaced according to the pre-stored correspondence relationship between the address of the function that needs to be replaced and the interrupt instruction; determining an interrupt number according to the interrupt instruction; and executing the interrupt service routine corresponding to the interrupt number according to the interrupt number; wherein after running the patch function according to the address of the patch function, the method further comprises: running a next function of the function that needs to be replaced in the first program. when the function that needs to be replaced in the first program is run, determining an interrupt instruction corresponding to the function that needs to be replaced according to the pre-stored correspondence relationship between the address of the function that needs to be replaced and the interrupt instruction; determining an interrupt number according to the interrupt instruction; and executing the interrupt service routine corresponding to the interrupt number according to the interrupt number; wherein after running the patch function according to the address of the patch function, the method further comprises: running a next function of the function that needs to be replaced in the first program.